chop-logic-components 4.0.3 → 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 +23 -8
- 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.css +1 -1
- 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/icon/Icon2.js +7 -11
- 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/index.js +2 -0
- package/dist/components/hocs/with-error-boundary/with-error-boundary.d.ts +6 -0
- package/dist/components/hocs/with-error-boundary/with-error-boundary.js +32 -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/multi-select/Option.js +11 -11
- 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/select/option/Option2.js +10 -10
- 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/switch/Switch2.js +4 -4
- 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/molecules/text-input/TextInputStateless.js +8 -8
- package/dist/components/organisms/dialog/Dialog.css +1 -1
- 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/content/TabContent2.js +3 -3
- 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 -917
- package/dist/index.es.js +42 -41
- package/dist/main.d.ts +8 -0
- package/dist/styles/main.css +1 -1
- 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 +22 -18
|
@@ -10,22 +10,22 @@ var o = ({ value: o, onSelect: s }) => {
|
|
|
10
10
|
"cl-select-option",
|
|
11
11
|
"cl-select-option_multi",
|
|
12
12
|
{ "cl-select-option_selected": u }
|
|
13
|
-
])
|
|
14
|
-
switch (t.key) {
|
|
15
|
-
case " ":
|
|
16
|
-
case "SpaceBar":
|
|
17
|
-
case "Enter":
|
|
18
|
-
t.preventDefault(), s(e);
|
|
19
|
-
break;
|
|
20
|
-
default: break;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
13
|
+
]);
|
|
23
14
|
return /* @__PURE__ */ a("li", {
|
|
24
15
|
id: c,
|
|
25
16
|
role: "option",
|
|
26
17
|
"aria-selected": u,
|
|
27
18
|
tabIndex: 0,
|
|
28
|
-
onKeyDown:
|
|
19
|
+
onKeyDown: ((e) => (t) => {
|
|
20
|
+
switch (t.key) {
|
|
21
|
+
case " ":
|
|
22
|
+
case "SpaceBar":
|
|
23
|
+
case "Enter":
|
|
24
|
+
t.preventDefault(), s(e);
|
|
25
|
+
break;
|
|
26
|
+
default: break;
|
|
27
|
+
}
|
|
28
|
+
})(c),
|
|
29
29
|
onClick: () => s(c),
|
|
30
30
|
className: d,
|
|
31
31
|
children: [u ? /* @__PURE__ */ i(r, {
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FormValues, SelectValue } from '../../../types';
|
|
2
|
+
export declare function getSelectInitialValue({ name, options, initialValues, defaultValue, }: {
|
|
3
|
+
name: string;
|
|
4
|
+
options: SelectValue[];
|
|
5
|
+
initialValues?: FormValues;
|
|
6
|
+
defaultValue?: string | number | readonly string[];
|
|
7
|
+
}): SelectValue | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SelectValue } 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
|
+
selected?: SelectValue;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
name: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const SelectCombobox: FC<Props>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SelectValue } from '../../../../types';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
type Props = {
|
|
4
|
+
options: SelectValue[];
|
|
5
|
+
opened: boolean;
|
|
6
|
+
dropdownId: string;
|
|
7
|
+
comboboxId: string;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
selected?: SelectValue;
|
|
10
|
+
onSelect: (id: string) => void;
|
|
11
|
+
onClear: () => void;
|
|
12
|
+
};
|
|
13
|
+
export declare const SelectDropdown: FC<Props>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SelectValue } from '../../../../types';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
type Props = {
|
|
4
|
+
value: SelectValue;
|
|
5
|
+
selected: boolean;
|
|
6
|
+
onSelect: (id: string) => void;
|
|
7
|
+
onClear: () => void;
|
|
8
|
+
};
|
|
9
|
+
export declare const SelectOption: FC<Props>;
|
|
10
|
+
export {};
|
|
@@ -8,22 +8,22 @@ import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
|
8
8
|
var o = ({ value: o, selected: s, onSelect: c, onClear: l }) => {
|
|
9
9
|
let { id: u, label: d } = o, f = e(["cl-select-option", { "cl-select-option_selected": s }]), p = (e) => {
|
|
10
10
|
s ? l() : c(e);
|
|
11
|
-
}, m = (e) => (t) => {
|
|
12
|
-
switch (t.key) {
|
|
13
|
-
case " ":
|
|
14
|
-
case "SpaceBar":
|
|
15
|
-
case "Enter":
|
|
16
|
-
t.preventDefault(), p(e);
|
|
17
|
-
break;
|
|
18
|
-
default: break;
|
|
19
|
-
}
|
|
20
11
|
};
|
|
21
12
|
return /* @__PURE__ */ a("li", {
|
|
22
13
|
id: u,
|
|
23
14
|
role: "option",
|
|
24
15
|
"aria-selected": s,
|
|
25
16
|
tabIndex: 0,
|
|
26
|
-
onKeyDown:
|
|
17
|
+
onKeyDown: ((e) => (t) => {
|
|
18
|
+
switch (t.key) {
|
|
19
|
+
case " ":
|
|
20
|
+
case "SpaceBar":
|
|
21
|
+
case "Enter":
|
|
22
|
+
t.preventDefault(), p(e);
|
|
23
|
+
break;
|
|
24
|
+
default: break;
|
|
25
|
+
}
|
|
26
|
+
})(u),
|
|
27
27
|
onClick: () => p(u),
|
|
28
28
|
className: f,
|
|
29
29
|
children: [/* @__PURE__ */ i("span", { children: d }), s && /* @__PURE__ */ i(r, {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { KeyboardEvent } from 'react';
|
|
2
|
+
export declare function useSwitchController({ name, defaultChecked, onChange, }: {
|
|
3
|
+
name: string;
|
|
4
|
+
defaultChecked?: boolean;
|
|
5
|
+
onChange?: (checked: boolean) => void;
|
|
6
|
+
}): {
|
|
7
|
+
checked: boolean;
|
|
8
|
+
handleChange: (checked: boolean) => void;
|
|
9
|
+
handleKeyDown: (event: KeyboardEvent<HTMLDivElement>) => void;
|
|
10
|
+
};
|
|
@@ -15,16 +15,16 @@ var i = ({ checked: i, onChange: a, label: o, disabled: s = !1, className: c, id
|
|
|
15
15
|
"cl-switch__checked": p,
|
|
16
16
|
"cl-switch_disabled": s
|
|
17
17
|
}
|
|
18
|
-
])
|
|
19
|
-
s || m(!p);
|
|
20
|
-
};
|
|
18
|
+
]);
|
|
21
19
|
return /* @__PURE__ */ r("div", {
|
|
22
20
|
role: "switch",
|
|
23
21
|
"aria-checked": p,
|
|
24
22
|
"aria-label": o,
|
|
25
23
|
tabIndex: s ? -1 : 0,
|
|
26
24
|
className: g,
|
|
27
|
-
onClick:
|
|
25
|
+
onClick: () => {
|
|
26
|
+
s || m(!p);
|
|
27
|
+
},
|
|
28
28
|
onKeyDown: h,
|
|
29
29
|
id: l,
|
|
30
30
|
children: [
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ChopLogicRegExpWithFlags, TextInputValidator } from '../../../types';
|
|
2
|
+
import { ChangeEvent, ChangeEventHandler } from 'react';
|
|
3
|
+
export declare function useTextInputController({ name, defaultValue, onChange, onClear, required, validator, }: {
|
|
4
|
+
name: string;
|
|
5
|
+
required: boolean;
|
|
6
|
+
validator?: ChopLogicRegExpWithFlags | TextInputValidator;
|
|
7
|
+
defaultValue?: string | number | readonly string[];
|
|
8
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
9
|
+
onClear?: () => void;
|
|
10
|
+
}): {
|
|
11
|
+
value: string;
|
|
12
|
+
valid: boolean;
|
|
13
|
+
passwordShown: boolean;
|
|
14
|
+
handleChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
15
|
+
handleClear: () => void;
|
|
16
|
+
togglePassword: () => void;
|
|
17
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TextInputProps } from '../../../types';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* TextInput component factory
|
|
5
|
+
* Renders either a stateful or stateless component
|
|
6
|
+
* based on the `stateless` prop.
|
|
7
|
+
*/
|
|
8
|
+
declare const TextInput: FC<TextInputProps>;
|
|
9
|
+
export default TextInput;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ChopLogicRegExpWithFlags, FormValues, TextInputValidator } from '../../../types';
|
|
2
|
+
export declare function validateTextInputValue({ value, required, validator, }: {
|
|
3
|
+
value: string;
|
|
4
|
+
required: boolean;
|
|
5
|
+
validator?: ChopLogicRegExpWithFlags | TextInputValidator;
|
|
6
|
+
}): boolean;
|
|
7
|
+
export declare function getTextInputInitialValue({ name, initialValues, defaultValue, }: {
|
|
8
|
+
name: string;
|
|
9
|
+
initialValues?: FormValues;
|
|
10
|
+
defaultValue?: string | number | readonly string[];
|
|
11
|
+
}): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
declare const TextInputButtons: FC<{
|
|
3
|
+
clearable: boolean;
|
|
4
|
+
isPasswordButtonVisible: boolean;
|
|
5
|
+
handleClear: () => void;
|
|
6
|
+
togglePassword: () => void;
|
|
7
|
+
passwordShown: boolean;
|
|
8
|
+
label: string;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
}>;
|
|
11
|
+
export default TextInputButtons;
|
|
@@ -8,14 +8,10 @@ import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
|
8
8
|
import { useState as s } from "react";
|
|
9
9
|
//#region src/components/molecules/text-input/TextInputStateless.tsx
|
|
10
10
|
var c = ({ name: c, label: l, errorMessage: u, value: d, onChange: f, onBlur: p, onFocus: m, onClear: h, maxLength: g, id: _, tabIndex: v, placeholder: y = "Type here...", disabled: b = !1, required: x = !1, clearable: S = !0, readOnly: C = !1, autoComplete: w = "off", type: T = "text", className: E, style: D, defaultValue: O }) => {
|
|
11
|
-
let k = _ ?? `text-input-${c}`, A = `${c}-error`, [j, M] = s(!1), N = T === "password"
|
|
12
|
-
M(!j);
|
|
13
|
-
}, I = () => {
|
|
14
|
-
f && f({ target: { value: "" } }), h?.();
|
|
15
|
-
};
|
|
11
|
+
let k = _ ?? `text-input-${c}`, A = `${c}-error`, [j, M] = s(!1), N = T === "password";
|
|
16
12
|
return /* @__PURE__ */ o("div", {
|
|
17
13
|
style: D,
|
|
18
|
-
className:
|
|
14
|
+
className: e(["cl-text-input", E]),
|
|
19
15
|
children: [/* @__PURE__ */ a(r, {
|
|
20
16
|
label: l,
|
|
21
17
|
required: x,
|
|
@@ -42,8 +38,12 @@ var c = ({ name: c, label: l, errorMessage: u, value: d, onChange: f, onBlur: p,
|
|
|
42
38
|
children: [/* @__PURE__ */ a(i, {
|
|
43
39
|
clearable: S,
|
|
44
40
|
isPasswordButtonVisible: N,
|
|
45
|
-
handleClear:
|
|
46
|
-
|
|
41
|
+
handleClear: () => {
|
|
42
|
+
f && f({ target: { value: "" } }), h?.();
|
|
43
|
+
},
|
|
44
|
+
togglePassword: () => {
|
|
45
|
+
M(!j);
|
|
46
|
+
},
|
|
47
47
|
passwordShown: j,
|
|
48
48
|
label: l,
|
|
49
49
|
disabled: b
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.cl-dialog{width:100%;height:100%;z-index:inherit;background-color
|
|
1
|
+
.cl-dialog{width:100%;height:100%;z-index:inherit;background-color:var(--cl-shadow-background);justify-content:center;align-items:center;animation:.4s cl-fade-in;display:flex;position:fixed;top:0;left:0}.cl-dialog__layout{z-index:var(--cl-z-index-modal);background-color:var(--cl-base-background-color);box-shadow:var(--cl-box-shadow);color:var(--cl-base-font-color);padding:var(--cl-l-gap);border-top-left-radius:var(--cl-border-radius);border-top-right-radius:var(--cl-border-radius);height:90%;font-family:var(--cl-core-font);font-size:var(--cl-typography-base-mobile);letter-spacing:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-weight:400;line-height:1.5;position:absolute;bottom:0;left:0}.cl-dialog__button{right:var(--cl-s-gap);top:var(--cl-s-gap);position:absolute}@media (width>=640px){.cl-dialog__layout{font-size:var(--cl-typography-base-tablet)}.cl-dialog__button{right:var(--cl-m-gap);top:var(--cl-m-gap)}}@media (width>=1024px){.cl-dialog__layout{font-size:var(--cl-typography-base-desktop);padding:var(--cl-xl-gap)}.cl-dialog__button{right:var(--cl-l-gap);top:var(--cl-l-gap)}}@media screen and (width>=640px){.cl-dialog__layout{border-bottom-left-radius:var(--cl-border-radius);border-bottom-right-radius:var(--cl-border-radius);width:fit-content;min-width:40%;max-width:90%;height:fit-content;max-height:90%;position:relative}}.cl-dialog_closing{animation:.4s cl-fade-out}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FormInputParams, FormValues } from '../../../types';
|
|
2
|
+
import { FormEvent, FormEventHandler } from 'react';
|
|
3
|
+
export declare function useFormController({ initialValues, onReset, onSubmit, onClickSubmit, }: {
|
|
4
|
+
initialValues?: FormValues;
|
|
5
|
+
onReset?: FormEventHandler<HTMLFormElement>;
|
|
6
|
+
onSubmit?: FormEventHandler<HTMLFormElement>;
|
|
7
|
+
onClickSubmit?: (data: FormValues) => void;
|
|
8
|
+
}): {
|
|
9
|
+
handleInputChange: (params: FormInputParams) => void;
|
|
10
|
+
handleSubmit: (event: FormEvent<HTMLFormElement>) => void;
|
|
11
|
+
handleReset: (event: FormEvent<HTMLFormElement>) => void;
|
|
12
|
+
resetSignal: number;
|
|
13
|
+
valid: boolean;
|
|
14
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FormInputParams, FormValidationState, FormValues } from '../../../types';
|
|
2
|
+
export declare function getInitialValidationState(data?: FormValues): FormValidationState;
|
|
3
|
+
export declare function updateValidationState(state: FormValidationState, params: FormInputParams): FormValidationState;
|
|
4
|
+
export declare function isFormDataValid(state: FormValidationState): boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { GridItem } from '../../../types';
|
|
2
|
+
export declare const useGridController: ({ data, id, onSelect, }: {
|
|
3
|
+
data: GridItem[];
|
|
4
|
+
id?: string;
|
|
5
|
+
onSelect?: (ids: string[]) => void;
|
|
6
|
+
}) => {
|
|
7
|
+
elementId: string;
|
|
8
|
+
isAllSelected: boolean;
|
|
9
|
+
isAllCheckboxDisabled: boolean;
|
|
10
|
+
selectedIds: string[];
|
|
11
|
+
handleSelectAll: () => void;
|
|
12
|
+
handleDeselectAll: () => void;
|
|
13
|
+
handleSelectRowById: (id: string) => void;
|
|
14
|
+
handleDeselectRowById: (id: string) => void;
|
|
15
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { GridColumn, GridItem, GridRowValue, RenderDataItemCallback } from '../../../types';
|
|
2
|
+
export declare function getGridRowValues({ item, columns, renderDataItem, }: {
|
|
3
|
+
item: GridItem;
|
|
4
|
+
columns: GridColumn[];
|
|
5
|
+
renderDataItem?: RenderDataItemCallback;
|
|
6
|
+
}): GridRowValue[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GridColumn, GridItem, RenderDataItemCallback } from '../../../../types';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
type Props = {
|
|
4
|
+
data: GridItem[];
|
|
5
|
+
columns: GridColumn[];
|
|
6
|
+
selectedIds: string[];
|
|
7
|
+
selectRowById: (id: string) => void;
|
|
8
|
+
deselectRowById: (id: string) => void;
|
|
9
|
+
renderDataItem?: RenderDataItemCallback;
|
|
10
|
+
selectable: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare const GridBody: FC<Props>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GridRowValue } from '../../../../types';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
type Props = {
|
|
4
|
+
rowId: string;
|
|
5
|
+
selectedIds: string[];
|
|
6
|
+
selectRowById: (id: string) => void;
|
|
7
|
+
deselectRowById: (id: string) => void;
|
|
8
|
+
selectable: boolean;
|
|
9
|
+
values: GridRowValue[];
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare const GridRow: FC<Props>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GridColumn } from '../../../../types';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
type GridHeadProps = {
|
|
4
|
+
columns: GridColumn[];
|
|
5
|
+
gridId: string;
|
|
6
|
+
selectable: boolean;
|
|
7
|
+
isAllSelected: boolean;
|
|
8
|
+
isAllCheckboxDisabled?: boolean;
|
|
9
|
+
selectAll: () => void;
|
|
10
|
+
deselectAll: () => void;
|
|
11
|
+
};
|
|
12
|
+
export declare const GridHead: FC<GridHeadProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
rowId: string;
|
|
4
|
+
isRowSelected: boolean;
|
|
5
|
+
selectRowById: (id: string) => void;
|
|
6
|
+
deselectRowById: (id: string) => void;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const SelectGridRowCell: FC<Props>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { OrientationMode } from '../../../../enums';
|
|
2
|
+
import { MenuItem } from '../../../../types';
|
|
3
|
+
import { FC, PropsWithChildren } from 'react';
|
|
4
|
+
type Props = PropsWithChildren & {
|
|
5
|
+
item: MenuItem;
|
|
6
|
+
mode: OrientationMode;
|
|
7
|
+
openedOn?: 'hover' | 'click';
|
|
8
|
+
};
|
|
9
|
+
export declare const MenuListItem: FC<Props>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { OrientationMode } from '../../../../enums';
|
|
2
|
+
import { MenuItem } from '../../../../types';
|
|
3
|
+
import { FC, PropsWithChildren } from 'react';
|
|
4
|
+
type Props = PropsWithChildren & {
|
|
5
|
+
item: MenuItem;
|
|
6
|
+
isSubMenuOpened: boolean;
|
|
7
|
+
mode: OrientationMode;
|
|
8
|
+
toggleSubMenu: () => void;
|
|
9
|
+
closeSubMenu: () => void;
|
|
10
|
+
openSubMenu: () => void;
|
|
11
|
+
openedOn?: 'hover' | 'click';
|
|
12
|
+
};
|
|
13
|
+
export declare const SubMenu: FC<Props>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OrientationMode } from '../../../../enums';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
type Props = {
|
|
4
|
+
title: string;
|
|
5
|
+
tabId: string;
|
|
6
|
+
onTabSelect: (id: string) => void;
|
|
7
|
+
tabPanelId: string;
|
|
8
|
+
isSelected: boolean;
|
|
9
|
+
mode: OrientationMode;
|
|
10
|
+
isDisabled?: boolean;
|
|
11
|
+
stretched?: boolean;
|
|
12
|
+
editable?: boolean;
|
|
13
|
+
onTabTitleChange?: (newTitle: string) => void;
|
|
14
|
+
onTabDelete?: (id: string) => void;
|
|
15
|
+
extendable?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare const TabButton: FC<Props>;
|
|
18
|
+
export {};
|