Skip to content

Commit

Permalink
Work on MultiSearch component.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrause committed Nov 28, 2024
1 parent 7060de8 commit 67da159
Show file tree
Hide file tree
Showing 15 changed files with 1,489 additions and 950 deletions.
6 changes: 5 additions & 1 deletion biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
"linter": {
"enabled": true,
"include": ["app/**/*", "src/**/*", "tests/**/*"],
"ignore": [
"src/components/tables/MultiSearch/MultiSearch.tsx" // Ignore for now (need to focus on type errors first)
],
"rules": {
"recommended": true,
"complexity": {
Expand All @@ -32,7 +35,8 @@
},
"style": {
"useImportType": "off",
"noUnusedTemplateLiteral": "off"
"noUnusedTemplateLiteral": "off",
"noUselessElse": "off"
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"lint:style": "stylelint 'src/**/*.scss'",
"lint:script": "biome lint",
"lint": "npm run lint:style && npm run lint:script",
"test": "npm run check:types && npm run lint:style",
"test:unit": "vitest run --root=.",
"test": "npm run check:types; npm run lint:style; npm run test:unit",
"test-ui": "vitest --ui",
"coverage": "vitest run --coverage",
"start": "npm run storybook:serve",
Expand Down
6 changes: 3 additions & 3 deletions package.json.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ const packageConfig = {
'check:types': 'tsc --noEmit',
'lint:style': `stylelint 'src/**/*.scss'`,
'lint:script': 'biome lint',
'lint': 'npm run lint:style && npm run lint:script',
'lint': 'npm run lint:style; npm run lint:script',

// Test
// Note: use `vitest run --root=. src/...` to run a single test file
//'test': 'vitest run --root=.', // Need to specify `--root=.` since the vite root is set to `./app`
'test': 'npm run check:types && npm run lint:style',
'test:unit': 'vitest run --root=.', // Need to specify `--root=.` since the vite root is set to `./app`
'test': 'npm run check:types; npm run lint:style; npm run test:unit',
'test-ui': 'vitest --ui',
'coverage': 'vitest run --coverage',

Expand Down
1 change: 0 additions & 1 deletion scripts/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ const runImportIcons = async (args: ScriptArgs) => {
'page-fwd': 'page-forward',
'user-account': 'user-profile', // "User account" is a misleading term considering our information architecture
'users': 'user',
// NOTE: missing `account` icon
};

const pathIcons = path.join(process.cwd(), './src/assets/icons_new');
Expand Down
28 changes: 15 additions & 13 deletions src/components/forms/fields/CheckboxField/CheckboxField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,36 +42,36 @@ export const CheckboxFieldTitle = ({ className, children, titleOptional, titleTo
</h1>
);

export type CheckboxFieldProps = ComponentProps<'div'> & {
export type CheckboxFieldProps = ComponentProps<typeof Checkbox> & {
/** Whether this component should be unstyled. */
unstyled?: undefined | boolean,

/** A label to be displayed after the checkbox. */
label: string,

/** An optional supporting copy to be displayed under the label. */
sublabel?: undefined | string,

/** An optional title. */
title?: undefined | string,

/** An optional tooltip to be displayed on an info icon next to the title. */
titleTooltip?: undefined | string,

/** Whether to display the optional observation on title. */
titleOptional?: undefined | boolean,

/** Whether the checkbox is checked by default. Passed down to Checkbox component. */
defaultChecked?: undefined | boolean,

/** Whether the checkbox is checked. Passed down to Checkbox component. */
checked?: undefined | boolean,

/** Whether the checkbox is disabled. Passed down to Checkbox component. */
disabled?: undefined | boolean,

/** The onChange event for the checkbox. Passed down to Checkbox component. */
onChange?: (e: React.FormEvent) => void,
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void,
};

/**
Expand All @@ -86,8 +86,9 @@ export const CheckboxField = (props: CheckboxFieldProps) => {
titleOptional,
titleTooltip,
className,
...propsRest
} = props;

return (
<div className={cx(
'bk',
Expand All @@ -102,13 +103,14 @@ export const CheckboxField = (props: CheckboxFieldProps) => {
{title}
</CheckboxFieldTitle>
)}
{/* biome ignore lint/a11y/noLabelWithoutControl: the `<Checkbox>` will resolve to an `<input>` */}
{/* biome-ignore lint/a11y/noLabelWithoutControl: the `<Checkbox>` will resolve to an `<input>` */}
<label className={cl['bk-checkbox-field__label']}>
<Checkbox
checked={props.checked}
defaultChecked={props.defaultChecked}
disabled={props.disabled}
onChange={props.onChange}
{...propsRest}
/>
<span className={cl['bk-checkbox-field__label__content']}>
{label}
Expand Down
8 changes: 4 additions & 4 deletions src/components/forms/fields/CheckboxGroup/CheckboxGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
|* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of
|* the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import { classNames as cx } from '../../../../util/componentUtil.ts';
import { classNames as cx, type ComponentProps } from '../../../../util/componentUtil.ts';
import * as React from 'react';

import cl from './CheckboxGroup.module.scss';
Expand All @@ -12,9 +12,9 @@ import { CheckboxField } from '../CheckboxField/CheckboxField.tsx';

export { cl as CheckboxGroupClassNames };

export type CheckboxGroupProps = React.PropsWithChildren<{
direction?: undefined | "vertical" | "horizontal";
}>;
export type CheckboxGroupProps = ComponentProps<'div'> & {
direction?: undefined | 'vertical' | 'horizontal';
};

/**
* Checkbox group component, wrapping multiple CheckboxField components vertically or horizontally.
Expand Down
2 changes: 0 additions & 2 deletions src/components/tables/DataTable/table/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ export const DataTable = <D extends object>(props: DataTableProps<D>) => {
</table>
);
};
DataTable.displayName = 'DataTable';


type DataTableSyncProps<D extends object> = DataTableProps<D> & {
Expand Down Expand Up @@ -244,4 +243,3 @@ export const DataTableAsync = <D extends object>(props: DataTableAsyncProps<D>)
</div>
);
};
DataTableAsync.displayName = 'DataTableAsync';
Loading

0 comments on commit 67da159

Please sign in to comment.