chop-logic-components 4.1.0 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/components/atoms/button/Button.d.ts +7 -0
- package/dist/components/atoms/button/icon-button/IconButton.d.ts +3 -0
- package/dist/components/atoms/button/inner-button/InnerButton.d.ts +3 -0
- package/dist/components/atoms/button/primary-button/PrimaryButton.d.ts +3 -0
- package/dist/components/atoms/button/secondary-button/SecondaryButton.d.ts +3 -0
- package/dist/components/atoms/editable-text/EditView.d.ts +14 -0
- package/dist/components/atoms/editable-text/EditableText.d.ts +4 -0
- package/dist/components/atoms/editable-text/ReadView.d.ts +10 -0
- package/dist/components/atoms/editable-text/useEditModeState.d.ts +6 -0
- package/dist/components/atoms/editable-text/useInputFocus.d.ts +2 -0
- package/dist/components/atoms/editable-text/useValueState.d.ts +6 -0
- package/dist/components/atoms/error-message/ErrorMessage.d.ts +10 -0
- package/dist/components/atoms/header/Header.d.ts +4 -0
- package/dist/components/atoms/icon/Icon.d.ts +11 -0
- package/dist/components/atoms/image/BasicImage.d.ts +13 -0
- package/dist/components/atoms/image/FallBackImage.d.ts +2 -0
- package/dist/components/atoms/image/Image.d.ts +6 -0
- package/dist/components/atoms/image/ResponsivePicture.d.ts +15 -0
- package/dist/components/atoms/index.d.ts +11 -0
- package/dist/components/atoms/input/Input.d.ts +5 -0
- package/dist/components/atoms/label/Label.d.ts +16 -0
- package/dist/components/atoms/link/Link.d.ts +4 -0
- package/dist/components/atoms/portal/Portal.d.ts +5 -0
- package/dist/components/atoms/tooltip/Tooltip.controller.d.ts +19 -0
- package/dist/components/atoms/tooltip/Tooltip.d.ts +4 -0
- package/dist/components/contexts/form/FormContext.d.ts +7 -0
- package/dist/components/contexts/index.d.ts +4 -0
- package/dist/components/contexts/theme/ThemeContext.d.ts +8 -0
- package/dist/components/contexts/theme/ThemeProvider.d.ts +8 -0
- package/dist/components/hocs/index.d.ts +3 -0
- package/dist/components/hocs/with-error-boundary/with-error-boundary.d.ts +6 -0
- package/dist/components/hocs/with-figure-caption/with-figure-caption.d.ts +6 -0
- package/dist/components/hocs/with-tooltip/with-tooltip.d.ts +7 -0
- package/dist/components/molecules/accordion/Accordion.d.ts +4 -0
- package/dist/components/molecules/accordion/AccordionItem.d.ts +3 -0
- package/dist/components/molecules/alert/Alert.d.ts +4 -0
- package/dist/components/molecules/alert/Alert.helpers.d.ts +3 -0
- package/dist/components/molecules/alert/AlertProgressBar.d.ts +4 -0
- package/dist/components/molecules/breadcrumbs/BreadcrumbItem.d.ts +7 -0
- package/dist/components/molecules/breadcrumbs/BreadcrumbList.d.ts +6 -0
- package/dist/components/molecules/breadcrumbs/Breadcrumbs.d.ts +4 -0
- package/dist/components/molecules/checkbox/Checkbox.controller.d.ts +9 -0
- package/dist/components/molecules/checkbox/Checkbox.d.ts +9 -0
- package/dist/components/molecules/checkbox/Checkbox.helpers.d.ts +6 -0
- package/dist/components/molecules/checkbox/CheckboxStateful.d.ts +4 -0
- package/dist/components/molecules/checkbox/CheckboxStateless.d.ts +4 -0
- package/dist/components/molecules/index.d.ts +10 -0
- package/dist/components/molecules/multi-select/MultiSelect.Combobox.d.ts +15 -0
- package/dist/components/molecules/multi-select/MultiSelect.Dropdown.d.ts +11 -0
- package/dist/components/molecules/multi-select/MultiSelect.controller.d.ts +13 -0
- package/dist/components/molecules/multi-select/MultiSelect.d.ts +4 -0
- package/dist/components/molecules/multi-select/MultiSelect.helpers.d.ts +9 -0
- package/dist/components/molecules/multi-select/MultiSelectComboboxSelectedValues.d.ts +8 -0
- package/dist/components/molecules/multi-select/Option.d.ts +8 -0
- package/dist/components/molecules/numeric-input/NumericInput.controller.d.ts +22 -0
- package/dist/components/molecules/numeric-input/NumericInput.d.ts +9 -0
- package/dist/components/molecules/numeric-input/NumericInput.helpers.d.ts +13 -0
- package/dist/components/molecules/numeric-input/NumericInputStateful.d.ts +4 -0
- package/dist/components/molecules/numeric-input/NumericInputStateless.d.ts +4 -0
- package/dist/components/molecules/search/Search.controller.d.ts +12 -0
- package/dist/components/molecules/search/Search.d.ts +4 -0
- package/dist/components/molecules/select/Select.controller.d.ts +14 -0
- package/dist/components/molecules/select/Select.d.ts +4 -0
- package/dist/components/molecules/select/Select.helpers.d.ts +7 -0
- package/dist/components/molecules/select/combobox/Combobox.d.ts +15 -0
- package/dist/components/molecules/select/dropdown/Dropdown.d.ts +14 -0
- package/dist/components/molecules/select/option/Option.d.ts +10 -0
- package/dist/components/molecules/switch/Switch.controller.d.ts +10 -0
- package/dist/components/molecules/switch/Switch.d.ts +4 -0
- package/dist/components/molecules/switch/Switch.helpers.d.ts +6 -0
- package/dist/components/molecules/text-input/TextInput.controller.d.ts +17 -0
- package/dist/components/molecules/text-input/TextInput.d.ts +9 -0
- package/dist/components/molecules/text-input/TextInput.helpers.d.ts +11 -0
- package/dist/components/molecules/text-input/TextInputButtons.d.ts +11 -0
- package/dist/components/molecules/text-input/TextInputStateful.d.ts +4 -0
- package/dist/components/molecules/text-input/TextInputStateless.d.ts +4 -0
- package/dist/components/organisms/dialog/Dialog.d.ts +4 -0
- package/dist/components/organisms/form/Form.controller.d.ts +14 -0
- package/dist/components/organisms/form/Form.d.ts +4 -0
- package/dist/components/organisms/form/Form.helpers.d.ts +4 -0
- package/dist/components/organisms/grid/Grid.controller.d.ts +15 -0
- package/dist/components/organisms/grid/Grid.d.ts +4 -0
- package/dist/components/organisms/grid/Grid.helpers.d.ts +6 -0
- package/dist/components/organisms/grid/body/GridBody.d.ts +13 -0
- package/dist/components/organisms/grid/checkbox/GridCheckbox.d.ts +6 -0
- package/dist/components/organisms/grid/column-group/GridColumnGroup.d.ts +6 -0
- package/dist/components/organisms/grid/data-cell/GridDataCell.d.ts +4 -0
- package/dist/components/organisms/grid/grid-row/GridRow.d.ts +13 -0
- package/dist/components/organisms/grid/head/GridHead.d.ts +13 -0
- package/dist/components/organisms/grid/header-cell/HeaderCell.d.ts +5 -0
- package/dist/components/organisms/grid/select-all-grid-rows-cell/SelectAllGridRowsCell.d.ts +10 -0
- package/dist/components/organisms/grid/select-grid-row-cell/SelectGridRowCell.d.ts +10 -0
- package/dist/components/organisms/index.d.ts +5 -0
- package/dist/components/organisms/menu/Menu.d.ts +4 -0
- package/dist/components/organisms/menu/leaf/MenuLeaf.d.ts +5 -0
- package/dist/components/organisms/menu/list-item/MenuListItem.d.ts +10 -0
- package/dist/components/organisms/menu/sub-menu/SubMenu.d.ts +14 -0
- package/dist/components/organisms/tabs/Tabs.d.ts +4 -0
- package/dist/components/organisms/tabs/button/TabButton.d.ts +18 -0
- package/dist/components/organisms/tabs/content/TabContent.d.ts +8 -0
- package/dist/components/organisms/tabs/edit-input/TabEditInput.d.ts +14 -0
- package/dist/components/organisms/tabs/list/TabList.d.ts +19 -0
- package/dist/enums/alert-mode.d.ts +7 -0
- package/dist/enums/button-view.d.ts +6 -0
- package/dist/enums/element-size.d.ts +8 -0
- package/dist/enums/icon-name.d.ts +284 -0
- package/dist/enums/index.d.ts +8 -0
- package/dist/enums/loader-view.d.ts +11 -0
- package/dist/enums/orientation-mode.d.ts +4 -0
- package/dist/enums/semantic-color.d.ts +7 -0
- package/dist/enums/tooltip-container.d.ts +7 -0
- package/dist/hooks/index.d.ts +15 -0
- package/dist/hooks/use-auto-close/use-auto-close.d.ts +6 -0
- package/dist/hooks/use-click-outside/use-click-outside.d.ts +8 -0
- package/dist/hooks/use-container-dimensions/use-container-dimensions.d.ts +8 -0
- package/dist/hooks/use-debounce/use-debounce.d.ts +1 -0
- package/dist/hooks/use-element-ids/use-element-ids.d.ts +5 -0
- package/dist/hooks/use-is-hovered/use-is-hovered.d.ts +2 -0
- package/dist/hooks/use-is-mounted/use-is-mounted.d.ts +1 -0
- package/dist/hooks/use-is-overflow/use-is-overflow.d.ts +6 -0
- package/dist/hooks/use-key-press/use-key-press.d.ts +8 -0
- package/dist/hooks/use-modal-focus-trap/use-modal-focus-trap.d.ts +7 -0
- package/dist/hooks/use-remaining-timer/use-remaining-timer.d.ts +9 -0
- package/dist/hooks/use-reset-form-input/use-reset-form-input.d.ts +1 -0
- package/dist/hooks/use-theme/use-theme.d.ts +4 -0
- package/dist/hooks/use-tooltip-position/use-tooltip-position.d.ts +12 -0
- package/dist/hooks/use-window-dimensions/use-window-dimensions.d.ts +2 -0
- package/dist/index.d.ts +2 -924
- package/dist/main.d.ts +8 -0
- package/dist/types/_common.d.ts +35 -0
- package/dist/types/accordion.d.ts +8 -0
- package/dist/types/alert.d.ts +11 -0
- package/dist/types/breadcrumbs.d.ts +10 -0
- package/dist/types/button.d.ts +11 -0
- package/dist/types/checkbox.d.ts +9 -0
- package/dist/types/dialog.d.ts +9 -0
- package/dist/types/editable-text.d.ts +12 -0
- package/dist/types/form.d.ts +18 -0
- package/dist/types/grid.d.ts +27 -0
- package/dist/types/header.d.ts +9 -0
- package/dist/types/image.d.ts +21 -0
- package/dist/types/index.d.ts +23 -0
- package/dist/types/link.d.ts +9 -0
- package/dist/types/loader.d.ts +6 -0
- package/dist/types/menu.d.ts +17 -0
- package/dist/types/multi-select.d.ts +7 -0
- package/dist/types/numeric.d.ts +19 -0
- package/dist/types/search.d.ts +16 -0
- package/dist/types/select.d.ts +7 -0
- package/dist/types/switch.d.ts +13 -0
- package/dist/types/tabs.d.ts +23 -0
- package/dist/types/text.d.ts +17 -0
- package/dist/types/tooltip.d.ts +11 -0
- package/dist/utils/get-class-name.d.ts +5 -0
- package/dist/utils/handle-dropdown-list-key-press.d.ts +7 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/move-focus-on-element-by-id.d.ts +1 -0
- package/package.json +17 -13
package/README.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|

|
|
4
4
|
|
|
5
5
|
#### Code Quality Checks
|
|
6
|
+
[](https://github.com/ChopLogic/chop-logic-components/actions/workflows/ci.yml)
|
|
6
7
|
[](https://codecov.io/gh/ChopLogic/chop-logic-components)
|
|
7
8
|
[](https://dashboard.stryker-mutator.io/reports/github.com/ChopLogic/chop-logic-components/main)
|
|
8
9
|
[](https://sonarcloud.io/summary/new_code?id=ChopLogic_chop-logic-components)
|
|
@@ -38,6 +39,15 @@ Components has the tools to make it easier.
|
|
|
38
39
|
- [Playground](https://choplogic.github.io/chop-logic-components)
|
|
39
40
|
- [Changelog](CHANGELOG.md)
|
|
40
41
|
|
|
42
|
+
## Quality assurance
|
|
43
|
+
|
|
44
|
+
Automated checks include [**CI**](https://github.com/ChopLogic/chop-logic-components/actions/workflows/ci.yml)
|
|
45
|
+
(typecheck, lint, unit tests, library build, Storybook test runner), [**Codecov**](https://codecov.io/gh/ChopLogic/chop-logic-components),
|
|
46
|
+
[**SonarCloud**](https://sonarcloud.io/summary/new_code?id=ChopLogic_chop-logic-components), and scheduled
|
|
47
|
+
[**mutation testing**](https://dashboard.stryker-mutator.io/reports/github.com/ChopLogic/chop-logic-components/main).
|
|
48
|
+
Contributor workflow and coverage expectations are described in [CONTRIBUTING.md](CONTRIBUTING.md); architectural
|
|
49
|
+
decisions are recorded under [docs/adr/](docs/adr/).
|
|
50
|
+
|
|
41
51
|
## 📦 Installation
|
|
42
52
|
|
|
43
53
|
To get started with Chop Logic, install it via npm or yarn:
|
|
@@ -68,6 +78,7 @@ yarn add chop-logic-components
|
|
|
68
78
|
| `typecheck` | Performs a full type check without emitting output. |
|
|
69
79
|
| `test` | Runs unit tests using Vitest in watch mode (interactive). |
|
|
70
80
|
| `test:ci` | Runs tests once in CI mode and allows empty test sets. |
|
|
81
|
+
| `test:integration` | Builds Storybook and runs the Storybook test runner (Playwright) against static output—integration smoke tests. |
|
|
71
82
|
| `coverage` | Runs tests and generates a coverage report using Vitest. |
|
|
72
83
|
| `test:mutation` | Runs mutation testing using Stryker to verify test quality. |
|
|
73
84
|
| `release:version` | Bumps the version (`patch`, `minor`, or `major`), commits the change, creates a Git tag, and pushes to `main`. Usage: `npm run release:version patch` |
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ChopLogicComponentProps } from '../../../types';
|
|
2
|
+
import { FC, RefObject } from 'react';
|
|
3
|
+
interface EditViewProps extends ChopLogicComponentProps {
|
|
4
|
+
multiline: boolean;
|
|
5
|
+
value: string;
|
|
6
|
+
placeholder: string;
|
|
7
|
+
onChange: (value: string) => void;
|
|
8
|
+
onBlur: () => void;
|
|
9
|
+
onKeyDown: (event: React.KeyboardEvent) => void;
|
|
10
|
+
className: string;
|
|
11
|
+
inputRef: RefObject<HTMLTextAreaElement | HTMLInputElement | null>;
|
|
12
|
+
}
|
|
13
|
+
export declare const EditView: FC<EditViewProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ChopLogicComponentProps } from '../../../types';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
interface ReadViewProps extends ChopLogicComponentProps {
|
|
4
|
+
value: string;
|
|
5
|
+
placeholder: string;
|
|
6
|
+
onClick: (event: React.MouseEvent) => void;
|
|
7
|
+
className: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const ReadView: FC<ReadViewProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ElementSize, IconName } from '../../../enums';
|
|
2
|
+
import { ChopLogicComponentProps } from '../../../types';
|
|
3
|
+
import { FC } from 'react';
|
|
4
|
+
export interface IconProps extends ChopLogicComponentProps {
|
|
5
|
+
name?: IconName;
|
|
6
|
+
testId?: string;
|
|
7
|
+
hidden?: boolean;
|
|
8
|
+
size?: ElementSize;
|
|
9
|
+
}
|
|
10
|
+
declare const Icon: FC<IconProps>;
|
|
11
|
+
export default Icon;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
src: string;
|
|
4
|
+
alt: string;
|
|
5
|
+
sizes?: string;
|
|
6
|
+
width?: number | string;
|
|
7
|
+
height?: number | string;
|
|
8
|
+
loading?: 'lazy' | 'eager';
|
|
9
|
+
decoding?: 'sync' | 'async' | 'auto';
|
|
10
|
+
onError?: (event: React.SyntheticEvent<HTMLImageElement, Event>) => void;
|
|
11
|
+
};
|
|
12
|
+
export declare const BasicImage: FC<Props>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ImageSource } from '../../../types';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
type Props = {
|
|
4
|
+
sources: ImageSource[];
|
|
5
|
+
src: string;
|
|
6
|
+
alt: string;
|
|
7
|
+
sizes?: string;
|
|
8
|
+
width?: number | string;
|
|
9
|
+
height?: number | string;
|
|
10
|
+
loading?: 'lazy' | 'eager';
|
|
11
|
+
decoding?: 'sync' | 'async' | 'auto';
|
|
12
|
+
onError?: (event: React.SyntheticEvent<HTMLImageElement, Event>) => void;
|
|
13
|
+
};
|
|
14
|
+
export declare const ResponsivePicture: FC<Props>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { default as Button } from './button/Button';
|
|
2
|
+
export { default as EditableText } from './editable-text/EditableText';
|
|
3
|
+
export { default as ErrorMessage } from './error-message/ErrorMessage';
|
|
4
|
+
export { default as Header } from './header/Header';
|
|
5
|
+
export { default as Icon } from './icon/Icon';
|
|
6
|
+
export { default as Image } from './image/Image';
|
|
7
|
+
export { default as Input } from './input/Input';
|
|
8
|
+
export { default as Label } from './label/Label';
|
|
9
|
+
export { default as Link } from './link/Link';
|
|
10
|
+
export { default as Portal } from './portal/Portal';
|
|
11
|
+
export { default as Tooltip } from './tooltip/Tooltip';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { InputHTMLAttributes } from 'react';
|
|
2
|
+
declare const _default: import('react').ForwardRefExoticComponent<InputHTMLAttributes<HTMLInputElement> & {
|
|
3
|
+
children?: import('react').ReactNode | undefined;
|
|
4
|
+
} & import('react').RefAttributes<HTMLInputElement>>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ElementSize, IconName } from '../../../enums';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
type LabelProps = {
|
|
4
|
+
label: string;
|
|
5
|
+
required: boolean;
|
|
6
|
+
inputId: string;
|
|
7
|
+
isTextHidden?: boolean;
|
|
8
|
+
icon?: IconName;
|
|
9
|
+
iconPosition?: 'left' | 'right';
|
|
10
|
+
iconSize?: ElementSize;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
className?: string;
|
|
13
|
+
testId?: string;
|
|
14
|
+
};
|
|
15
|
+
declare const Label: FC<LabelProps>;
|
|
16
|
+
export default Label;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MouseEvent } from 'react';
|
|
2
|
+
type Params = {
|
|
3
|
+
autoClose: boolean;
|
|
4
|
+
autoCloseDelay: number;
|
|
5
|
+
id?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const useTooltipController: ({ id, autoClose, autoCloseDelay }: Params) => {
|
|
8
|
+
elementId: string;
|
|
9
|
+
openTooltip: () => void;
|
|
10
|
+
closeTooltip: () => void;
|
|
11
|
+
toggleTooltip: () => void;
|
|
12
|
+
handleContextMenu: (e: MouseEvent) => void;
|
|
13
|
+
top: number;
|
|
14
|
+
left: number;
|
|
15
|
+
isOpened: boolean;
|
|
16
|
+
wrapperRef: import('react').RefObject<null>;
|
|
17
|
+
tooltipRef: import('react').RefObject<HTMLDivElement | null>;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FormInputParams, FormValues } from '../../../types';
|
|
2
|
+
export interface FormContextProps {
|
|
3
|
+
onChangeFormInput?: (params: FormInputParams) => void;
|
|
4
|
+
initialValues?: FormValues;
|
|
5
|
+
resetSignal?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const FormContext: import('react').Context<FormContextProps>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const CL_LIGHT_THEME_CLASS = "cl-components-light-theme";
|
|
2
|
+
export declare const CL_DARK_THEME_CLASS = "cl-components-dark-theme";
|
|
3
|
+
type ThemeMode = typeof CL_LIGHT_THEME_CLASS | typeof CL_DARK_THEME_CLASS;
|
|
4
|
+
export declare const ThemeContext: import('react').Context<{
|
|
5
|
+
mode?: ThemeMode;
|
|
6
|
+
setMode: (mode: ThemeMode) => void;
|
|
7
|
+
}>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { CL_DARK_THEME_CLASS, CL_LIGHT_THEME_CLASS } from './ThemeContext';
|
|
3
|
+
type ThemeMode = typeof CL_LIGHT_THEME_CLASS | typeof CL_DARK_THEME_CLASS;
|
|
4
|
+
export declare const ThemeProvider: FC<{
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
injectedMode?: ThemeMode;
|
|
7
|
+
}>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentType, FC } from 'react';
|
|
2
|
+
type WithTooltipProps = {
|
|
3
|
+
tooltip?: string;
|
|
4
|
+
visibleOn?: 'hover' | 'click' | 'focus' | 'contextmenu';
|
|
5
|
+
};
|
|
6
|
+
export declare function withTooltip<P extends object>(Component: ComponentType<P>): FC<P & WithTooltipProps>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ChangeEvent, ChangeEventHandler } from 'react';
|
|
2
|
+
export declare function useCheckboxController({ name, defaultChecked, onChange, }: {
|
|
3
|
+
name: string;
|
|
4
|
+
defaultChecked?: boolean;
|
|
5
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
6
|
+
}): {
|
|
7
|
+
handleChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
8
|
+
checked: boolean;
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CheckboxProps } from '../../../types';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Checkbox component factory
|
|
5
|
+
* Renders either a stateful or stateless component
|
|
6
|
+
* based on the `stateless` prop.
|
|
7
|
+
*/
|
|
8
|
+
declare const Checkbox: FC<CheckboxProps>;
|
|
9
|
+
export default Checkbox;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { default as Accordion } from './accordion/Accordion';
|
|
2
|
+
export { default as Alert } from './alert/Alert';
|
|
3
|
+
export { default as Breadcrumbs } from './breadcrumbs/Breadcrumbs';
|
|
4
|
+
export { default as Checkbox } from './checkbox/Checkbox';
|
|
5
|
+
export { default as MultiSelect } from './multi-select/MultiSelect';
|
|
6
|
+
export { default as NumericInput } from './numeric-input/NumericInput';
|
|
7
|
+
export { default as Search } from './search/Search';
|
|
8
|
+
export { default as Select } from './select/Select';
|
|
9
|
+
export { default as Switch } from './switch/Switch';
|
|
10
|
+
export { default as TextInput } from './text-input/TextInput';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MultiSelectValue } from '../../../types';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
type Props = {
|
|
4
|
+
opened: boolean;
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
required: boolean;
|
|
7
|
+
onClick: () => void;
|
|
8
|
+
comboboxId: string;
|
|
9
|
+
dropdownId: string;
|
|
10
|
+
values?: MultiSelectValue[];
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
name: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const MultiSelectCombobox: FC<Props>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MultiSelectValue } from '../../../types';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
type Props = {
|
|
4
|
+
options: MultiSelectValue[];
|
|
5
|
+
opened: boolean;
|
|
6
|
+
dropdownId: string;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
onSelect: (id: string) => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const MultiSelectDropdown: FC<Props>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MultiSelectValue, SelectValue } from '../../../types';
|
|
2
|
+
export declare function useMultiSelectController({ name, defaultValue, onChange, options, }: {
|
|
3
|
+
name: string;
|
|
4
|
+
defaultValue?: string | number | readonly string[];
|
|
5
|
+
onChange?: (values?: SelectValue[]) => void;
|
|
6
|
+
options: SelectValue[];
|
|
7
|
+
}): {
|
|
8
|
+
handleClose: () => void;
|
|
9
|
+
handleToggle: () => void;
|
|
10
|
+
handleSelect: (id: string) => void;
|
|
11
|
+
opened: boolean;
|
|
12
|
+
values: MultiSelectValue[];
|
|
13
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FormValues, MultiSelectValue, SelectValue } from '../../../types';
|
|
2
|
+
export declare function getMultiSelectInitialValues({ name, options, initialValues, defaultValue, }: {
|
|
3
|
+
name: string;
|
|
4
|
+
options: SelectValue[];
|
|
5
|
+
initialValues?: FormValues;
|
|
6
|
+
defaultValue?: string | number | readonly string[];
|
|
7
|
+
}): MultiSelectValue[];
|
|
8
|
+
export declare const getMultiSelectFormValues: (options: MultiSelectValue[]) => string[];
|
|
9
|
+
export declare const getMultiSelectUpdatedValues: (options: MultiSelectValue[], id: string) => MultiSelectValue[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { NumericInputValidator } from '../../../types';
|
|
2
|
+
import { ChangeEvent, ChangeEventHandler } from 'react';
|
|
3
|
+
export declare function useNumericInputController({ name, defaultValue, onChange, onDecrement, onIncrement, min, max, step, required, validator, }: {
|
|
4
|
+
name: string;
|
|
5
|
+
defaultValue?: string | number | readonly string[];
|
|
6
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
7
|
+
onIncrement?: () => void;
|
|
8
|
+
onDecrement?: () => void;
|
|
9
|
+
min?: string | number;
|
|
10
|
+
max?: string | number;
|
|
11
|
+
step: number;
|
|
12
|
+
required: boolean;
|
|
13
|
+
validator?: NumericInputValidator;
|
|
14
|
+
}): {
|
|
15
|
+
handleChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
16
|
+
value: number;
|
|
17
|
+
valid: boolean;
|
|
18
|
+
minValue: number;
|
|
19
|
+
maxValue: number;
|
|
20
|
+
handleIncrement: () => void;
|
|
21
|
+
handleDecrement: () => void;
|
|
22
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NumericInputProps } from '../../../types';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* NumericInput component factory
|
|
5
|
+
* Renders either a stateful or stateless component
|
|
6
|
+
* based on the `stateless` prop.
|
|
7
|
+
*/
|
|
8
|
+
declare const NumericInput: FC<NumericInputProps>;
|
|
9
|
+
export default NumericInput;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FormValues, NumericInputValidator } from '../../../types';
|
|
2
|
+
export declare function getNumericInputInitialValue({ name, initialValues, defaultValue, }: {
|
|
3
|
+
name: string;
|
|
4
|
+
initialValues?: FormValues;
|
|
5
|
+
defaultValue?: string | number | readonly string[];
|
|
6
|
+
}): number;
|
|
7
|
+
export declare function validateNumericInputValue({ value, required, validator, maxValue, minValue, }: {
|
|
8
|
+
value?: number;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
validator?: NumericInputValidator;
|
|
11
|
+
maxValue?: number;
|
|
12
|
+
minValue?: number;
|
|
13
|
+
}): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SearchProps } from '../../../types';
|
|
2
|
+
export declare function useSearchController({ onSearch, onClear, maxLength, minLength, searchMode, debounceDelay, }: Omit<SearchProps, 'label' | 'onBlur' | 'onFocus' | 'id' | 'tabIndex' | 'className' | 'name' | 'placeholder' | 'disabled' | 'clearable' | 'spellCheck' | 'autoComplete'>): {
|
|
3
|
+
searchValue: string;
|
|
4
|
+
isSearchButtonVisible: boolean;
|
|
5
|
+
isLabelIconVisible: boolean;
|
|
6
|
+
isClearButtonVisible: boolean;
|
|
7
|
+
isSearchValueValid: boolean;
|
|
8
|
+
handleChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
9
|
+
handleClear: () => void;
|
|
10
|
+
handleSearchClick: () => void;
|
|
11
|
+
handleKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
12
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SelectValue } from '../../../types';
|
|
2
|
+
export declare function useSelectController({ name, defaultValue, onChange, options, }: {
|
|
3
|
+
name: string;
|
|
4
|
+
defaultValue?: string | number | readonly string[];
|
|
5
|
+
onChange?: (value?: SelectValue) => void;
|
|
6
|
+
options: SelectValue[];
|
|
7
|
+
}): {
|
|
8
|
+
selected: SelectValue | undefined;
|
|
9
|
+
opened: boolean;
|
|
10
|
+
handleClear: () => void;
|
|
11
|
+
handleClose: () => void;
|
|
12
|
+
handleToggle: () => void;
|
|
13
|
+
handleSelect: (id: string) => void;
|
|
14
|
+
};
|