@chotot/clad-ui 1.2.5 → 1.3.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 +3 -3
- package/components/Announcer/Announcer.d.ts +9 -4
- package/components/Announcer/Announcer.stories.d.ts +142 -0
- package/components/Announcer/{Announcer.stories.js → Announcer.stories.tsx} +36 -31
- package/components/Announcer/Announcer.styles.d.ts +24 -12
- package/components/Announcer/{Announcer.styles.js → Announcer.styles.ts} +43 -18
- package/components/Announcer/Announcer.tsx +62 -47
- package/components/Badge/Badge.d.ts +4 -2
- package/components/Badge/Badge.stories.d.ts +61 -0
- package/components/Badge/{Badge.stories.js → Badge.stories.tsx} +5 -5
- package/components/Badge/Badge.styles.d.ts +20 -5
- package/components/Badge/{Badge.styles.js → Badge.styles.ts} +14 -1
- package/components/Badge/Badge.tsx +8 -4
- package/components/Box/Box.d.ts +3 -3
- package/components/Box/Box.stories.d.ts +240 -0
- package/components/Box/{Box.stories.js → Box.stories.tsx} +2 -2
- package/components/Box/Box.styles.d.ts +19 -4
- package/components/Box/{Box.styles.js → Box.styles.ts} +17 -4
- package/components/Box/Box.tsx +4 -4
- package/components/Breadcrumbs/Breadcrumbs.d.ts +2 -2
- package/components/Breadcrumbs/Breadcrumbs.stories.d.ts +52 -0
- package/components/Breadcrumbs/{Breadcrumbs.stories.js → Breadcrumbs.stories.tsx} +17 -15
- package/components/Breadcrumbs/Breadcrumbs.styles.d.ts +5 -4
- package/components/Breadcrumbs/Breadcrumbs.tsx +2 -2
- package/components/Button/Button.d.ts +21 -6
- package/components/Button/Button.stories.d.ts +103 -0
- package/components/Button/{Button.stories.js → Button.stories.tsx} +5 -1
- package/components/Button/Button.styles.d.ts +1 -1
- package/components/Button/{Button.styles.js → Button.styles.ts} +100 -6
- package/components/Button/Button.tsx +51 -18
- package/components/Button/ButtonLink.d.ts +4 -4
- package/components/Button/ButtonLink.stories.d.ts +30 -0
- package/components/Button/ButtonLink.styles.d.ts +1 -1
- package/components/Button/ButtonLink.tsx +5 -5
- package/components/Button/IconButton.d.ts +3 -29
- package/components/Button/IconButton.stories.d.ts +60 -0
- package/components/Button/{IconButton.stories.js → IconButton.stories.tsx} +27 -0
- package/components/Button/IconButton.tsx +2 -42
- package/components/Checkbox/Checkbox.d.ts +3 -3
- package/components/Checkbox/Checkbox.stories.d.ts +88 -0
- package/components/Checkbox/Checkbox.styles.d.ts +2 -2
- package/components/Checkbox/Checkbox.tsx +3 -6
- package/components/Chip/Chip.d.ts +5 -4
- package/components/Chip/Chip.stories.d.ts +153 -0
- package/components/Chip/{Chip.stories.js → Chip.stories.tsx} +4 -5
- package/components/Chip/Chip.styles.d.ts +11 -8
- package/components/Chip/{Chip.styles.js → Chip.styles.ts} +4 -4
- package/components/Chip/Chip.tsx +19 -12
- package/components/CurrencyInput/CurrencyInput.d.ts +3 -56
- package/components/CurrencyInput/CurrencyInput.stories.d.ts +104 -0
- package/components/CurrencyInput/{CurrencyInput.stories.js → CurrencyInput.stories.tsx} +2 -2
- package/components/CurrencyInput/CurrencyInput.styles.d.ts +16 -10
- package/components/CurrencyInput/{CurrencyInput.styles.js → CurrencyInput.styles.ts} +23 -9
- package/components/CurrencyInput/CurrencyInput.tsx +7 -61
- package/components/Dropdown/Dropdown.d.ts +22 -7
- package/components/Dropdown/Dropdown.stories.d.ts +148 -0
- package/components/Dropdown/{Dropdown.stories.js → Dropdown.stories.tsx} +115 -1
- package/components/Dropdown/Dropdown.styles.d.ts +10 -0
- package/components/Dropdown/Dropdown.styles.ts +42 -0
- package/components/Dropdown/Dropdown.tsx +120 -24
- package/components/Grid/Col.d.ts +2 -2
- package/components/Grid/Col.tsx +6 -3
- package/components/Grid/Grid.styles.d.ts +25 -5
- package/components/Grid/{Grid.styles.js → Grid.styles.ts} +16 -3
- package/components/Grid/aGrid.stories.d.ts +127 -0
- package/components/Grid/bCol.stories.d.ts +74 -0
- package/components/Input/Input.d.ts +14 -10
- package/components/Input/Input.stories.d.ts +226 -0
- package/components/Input/{Input.stories.js → Input.stories.tsx} +20 -16
- package/components/Input/Input.styles.d.ts +22 -11
- package/components/Input/{Input.styles.js → Input.styles.ts} +29 -7
- package/components/Input/Input.tsx +22 -20
- package/components/Popover/Popover.d.ts +44 -0
- package/components/Popover/Popover.stories.d.ts +53 -0
- package/components/Popover/Popover.stories.tsx +133 -0
- package/components/Popover/Popover.tsx +121 -0
- package/components/RadioButton/RadioButton.d.ts +5 -6
- package/components/RadioButton/RadioButton.stories.d.ts +94 -0
- package/components/RadioButton/RadioButton.styles.d.ts +7 -3
- package/components/RadioButton/{RadioButton.styles.js → RadioButton.styles.ts} +1 -1
- package/components/RadioButton/RadioButton.tsx +5 -11
- package/components/RowItem/RowItem.d.ts +27 -9
- package/components/RowItem/RowItem.stories.d.ts +131 -0
- package/components/RowItem/RowItem.stories.tsx +710 -0
- package/components/RowItem/RowItem.styles.d.ts +31 -10
- package/components/RowItem/{RowItem.styles.js → RowItem.styles.ts} +41 -13
- package/components/RowItem/RowItem.tsx +106 -42
- package/components/ShapeIcon/ShapeIcon.d.ts +23 -16
- package/components/ShapeIcon/ShapeIcon.stories.d.ts +91 -0
- package/components/ShapeIcon/{ShapeIcon.stories.js → ShapeIcon.stories.tsx} +21 -8
- package/components/ShapeIcon/ShapeIcon.styles.d.ts +8 -3
- package/components/ShapeIcon/{ShapeIcon.styles.js → ShapeIcon.styles.ts} +6 -3
- package/components/ShapeIcon/ShapeIcon.tsx +25 -21
- package/components/Slider/Slider.d.ts +9 -7
- package/components/Slider/Slider.stories.d.ts +81 -0
- package/components/Slider/{Slider.stories.js → Slider.stories.tsx} +7 -7
- package/components/Slider/Slider.styles.d.ts +15 -11
- package/components/Slider/{Slider.styles.js → Slider.styles.ts} +1 -1
- package/components/Slider/Slider.tsx +21 -16
- package/components/Snack/Snack.d.ts +4 -5
- package/components/Snack/Snack.stories.d.ts +87 -0
- package/components/Snack/Snack.styles.d.ts +9 -8
- package/components/Snack/{Snack.styles.js → Snack.styles.ts} +4 -4
- package/components/Snack/Snack.tsx +14 -11
- package/components/Tabs/Tab.d.ts +6 -6
- package/components/Tabs/Tab.tsx +6 -7
- package/components/Tabs/Tabs.d.ts +7 -4
- package/components/Tabs/Tabs.stories.d.ts +64 -0
- package/components/Tabs/{Tabs.stories.js → Tabs.stories.tsx} +2 -2
- package/components/Tabs/Tabs.styles.d.ts +30 -12
- package/components/Tabs/{Tabs.styles.js → Tabs.styles.ts} +4 -4
- package/components/Tabs/Tabs.tsx +11 -7
- package/components/TextArea/TextArea.d.ts +24 -11
- package/components/TextArea/TextArea.stories.d.ts +151 -0
- package/components/TextArea/{TextArea.stories.js → TextArea.stories.tsx} +5 -96
- package/components/TextArea/TextArea.styles.d.ts +18 -16
- package/components/TextArea/{TextArea.styles.js → TextArea.styles.ts} +39 -19
- package/components/TextArea/TextArea.tsx +85 -31
- package/components/TextLabel/TextLabel.d.ts +35 -0
- package/components/TextLabel/TextLabel.stories.d.ts +40 -0
- package/components/TextLabel/TextLabel.stories.tsx +177 -0
- package/components/TextLabel/TextLabel.styles.d.ts +9 -0
- package/components/TextLabel/TextLabel.styles.ts +24 -0
- package/components/TextLabel/TextLabel.tsx +112 -0
- package/components/ToggleSwitch/ToggleSwitch.d.ts +2 -2
- package/components/ToggleSwitch/ToggleSwitch.stories.d.ts +38 -0
- package/components/ToggleSwitch/ToggleSwitch.styles.d.ts +21 -14
- package/components/ToggleSwitch/{ToggleSwitch.styles.js → ToggleSwitch.styles.ts} +8 -12
- package/components/ToggleSwitch/ToggleSwitch.tsx +12 -6
- package/components/Tooltip/Tooltip.d.ts +9 -3
- package/components/Tooltip/Tooltip.spec.js +5 -3
- package/components/Tooltip/Tooltip.styles.d.ts +7 -8
- package/components/Tooltip/Tooltip.tsx +10 -3
- package/components/index.d.ts +2 -0
- package/components/index.ts +2 -0
- package/icons/PrivateSellerAvatar.d.ts +3 -0
- package/icons/PrivateSellerAvatar.js +3 -0
- package/icons/Sda.d.ts +5 -2
- package/icons/Sda.js +7 -7
- package/icons/VerifiedShop.d.ts +3 -0
- package/icons/VerifiedShop.js +3 -0
- package/package.json +6 -6
- package/patterns/Drawer/Drawer.d.ts +13 -13
- package/patterns/Drawer/Drawer.stories.d.ts +90 -0
- package/patterns/Drawer/{Drawer.stories.js → Drawer.stories.tsx} +25 -0
- package/patterns/Drawer/Drawer.styles.d.ts +30 -26
- package/patterns/Drawer/{Drawer.styles.js → Drawer.styles.ts} +2 -5
- package/patterns/Drawer/Drawer.tsx +20 -41
- package/patterns/EmptyState/EmptyState.d.ts +5 -4
- package/patterns/EmptyState/EmptyState.stories.d.ts +40 -0
- package/patterns/EmptyState/EmptyState.styles.d.ts +10 -10
- package/patterns/EmptyState/{EmptyState.styles.js → EmptyState.styles.ts} +5 -4
- package/patterns/EmptyState/EmptyState.tsx +14 -12
- package/patterns/InputGroup/InputGroup.d.ts +4 -0
- package/patterns/InputGroup/InputGroup.styles.d.ts +5 -4
- package/patterns/InputGroup/InputGroup.tsx +11 -5
- package/patterns/LegacyDialog/DialogMainIcon.d.ts +1 -0
- package/patterns/LegacyDialog/DialogMainIcon.js +51 -0
- package/patterns/LegacyDialog/LegacyDialog.d.ts +3 -3
- package/patterns/LegacyDialog/LegacyDialog.styles.d.ts +8 -10
- package/patterns/LegacyDialog/LegacyDialog.styles.js +1 -46
- package/patterns/LegacyDialog/LegacyDialog.tsx +5 -11
- package/patterns/LegacyPopup/LegacyPopup.d.ts +4 -4
- package/patterns/LegacyPopup/LegacyPopup.styles.d.ts +18 -13
- package/patterns/LegacyPopup/{LegacyPopup.styles.js → LegacyPopup.styles.ts} +3 -1
- package/patterns/LegacyPopup/LegacyPopup.tsx +4 -6
- package/patterns/MultiSearchDropdown/MultiSearchDropdown.d.ts +20 -17
- package/patterns/MultiSearchDropdown/MultiSearchDropdown.stories.d.ts +125 -0
- package/patterns/MultiSearchDropdown/{MultiSearchDropdown.stories.js → MultiSearchDropdown.stories.tsx} +31 -30
- package/patterns/MultiSearchDropdown/MultiSearchDropdown.styles.d.ts +22 -21
- package/patterns/MultiSearchDropdown/{MultiSearchDropdown.styles.js → MultiSearchDropdown.styles.ts} +1 -7
- package/patterns/MultiSearchDropdown/MultiSearchDropdown.tsx +33 -32
- package/patterns/Popup/Popup.d.ts +8 -7
- package/patterns/Popup/Popup.stories.d.ts +102 -0
- package/patterns/Popup/Popup.styles.d.ts +41 -30
- package/patterns/Popup/{Popup.styles.js → Popup.styles.ts} +26 -33
- package/patterns/Popup/Popup.tsx +14 -33
- package/patterns/SearchInput/SearchInput.d.ts +38 -21
- package/patterns/SearchInput/SearchInput.stories.d.ts +186 -0
- package/patterns/SearchInput/{SearchInput.stories.js → SearchInput.stories.tsx} +78 -45
- package/patterns/SearchInput/SearchInput.styles.d.ts +6 -5
- package/patterns/SearchInput/{SearchInput.styles.js → SearchInput.styles.ts} +7 -4
- package/patterns/SearchInput/SearchInput.tsx +53 -34
- package/patterns/TagCloud/TagCloud.d.ts +19 -6
- package/patterns/TagCloud/TagCloud.stories.d.ts +159 -0
- package/patterns/TagCloud/{TagCloud.stories.js → TagCloud.stories.tsx} +59 -14
- package/patterns/TagCloud/TagCloud.styles.d.ts +12 -8
- package/patterns/TagCloud/{TagCloud.styles.js → TagCloud.styles.ts} +6 -7
- package/patterns/TagCloud/TagCloud.tsx +24 -8
- package/patterns/TagCloud/TagCloudMultiActive.d.ts +6 -4
- package/patterns/TagCloud/TagCloudMultiActive.tsx +5 -5
- package/patterns/TagCloud/TagCloudSingleActive.d.ts +5 -2
- package/patterns/TagCloud/TagCloudSingleActive.tsx +18 -5
- package/patterns/patterns-index.spec.js +1 -1
- package/storybook/GuideImage.d.ts +2 -2
- package/storybook/Swatch.d.ts +2 -2
- package/theme/__snapshots__/chotot.spec.js.snap +2 -2
- package/theme/chotot-color1.d.ts +7 -14
- package/theme/chotot.d.ts +32 -32
- package/theme/chotot.js +4 -4
- package/theme/ct-job.d.ts +6 -14
- package/theme/ct-pty.d.ts +6 -8
- package/theme/mudah.d.ts +14 -13
- package/types.d.ts +0 -9
- package/utils/_simulateChangeEvent.d.ts +18 -3
- package/utils/_simulateChangeEvent.js +13 -6
- package/utils/_simulateChangeEvent.spec.js +1 -1
- package/utils/cx.d.ts +8 -4
- package/utils/cx.js +8 -4
- package/utils/sx.d.ts +12 -4192
- package/components/RowItem/RowItem.stories.js +0 -560
- /package/components/Breadcrumbs/{Breadcrumbs.styles.js → Breadcrumbs.styles.ts} +0 -0
- /package/components/Button/{ButtonLink.stories.js → ButtonLink.stories.tsx} +0 -0
- /package/components/Button/{ButtonLink.styles.js → ButtonLink.styles.ts} +0 -0
- /package/components/Checkbox/{Checkbox.stories.js → Checkbox.stories.tsx} +0 -0
- /package/components/Checkbox/{Checkbox.styles.js → Checkbox.styles.ts} +0 -0
- /package/components/Grid/{aGrid.stories.js → aGrid.stories.tsx} +0 -0
- /package/components/Grid/{bCol.stories.js → bCol.stories.tsx} +0 -0
- /package/components/RadioButton/{RadioButton.stories.js → RadioButton.stories.tsx} +0 -0
- /package/components/Snack/{Snack.stories.js → Snack.stories.tsx} +0 -0
- /package/components/ToggleSwitch/{ToggleSwitch.stories.js → ToggleSwitch.stories.tsx} +0 -0
- /package/patterns/EmptyState/{EmptyState.stories.js → EmptyState.stories.tsx} +0 -0
- /package/patterns/InputGroup/{InputGroup.styles.js → InputGroup.styles.ts} +0 -0
- /package/patterns/Popup/{Popup.stories.js → Popup.stories.tsx} +0 -0
|
@@ -2,12 +2,23 @@ import * as React from 'react';
|
|
|
2
2
|
import TagCloudSingleActive from './TagCloudSingleActive';
|
|
3
3
|
import TagCloudMultiActive from './TagCloudMultiActive';
|
|
4
4
|
|
|
5
|
-
type TagCloudOption = {
|
|
5
|
+
export type TagCloudOption = {
|
|
6
6
|
value: string;
|
|
7
7
|
label: string;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
export type
|
|
10
|
+
export type TagCloudValue<T extends boolean | undefined = undefined> = T extends true
|
|
11
|
+
? string[]
|
|
12
|
+
: string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Tag Cloud change event, value is stored in target.value
|
|
16
|
+
*/
|
|
17
|
+
export interface TagCloudChangeEvent<Multi extends boolean | undefined = undefined> extends Event {
|
|
18
|
+
target: Omit<EventTarget, 'value'> & { value: TagCloudValue<Multi> };
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface TagCloudProps {
|
|
11
22
|
/**
|
|
12
23
|
* Tag cloud className
|
|
13
24
|
*/
|
|
@@ -23,11 +34,11 @@ export type TagCloudProps = {
|
|
|
23
34
|
/**
|
|
24
35
|
* Value of the active chip(s)
|
|
25
36
|
*/
|
|
26
|
-
value?:
|
|
37
|
+
value?: TagCloudValue<this['multiple']>;
|
|
27
38
|
/**
|
|
28
39
|
* Change event
|
|
29
40
|
*/
|
|
30
|
-
onChange?: () => void;
|
|
41
|
+
onChange?: (event: TagCloudChangeEvent<this['multiple']>) => void;
|
|
31
42
|
/**
|
|
32
43
|
* Whether this tag cloud requires at least 1 option or not
|
|
33
44
|
*/
|
|
@@ -43,7 +54,7 @@ export type TagCloudProps = {
|
|
|
43
54
|
/**
|
|
44
55
|
* Tag cloud ref
|
|
45
56
|
*/
|
|
46
|
-
tagCloudRef?: React.RefObject<HTMLDivElement
|
|
57
|
+
tagCloudRef?: React.RefObject<HTMLDivElement>;
|
|
47
58
|
/**
|
|
48
59
|
* Tag cloud status (useful when implemented with validation)
|
|
49
60
|
*/
|
|
@@ -56,7 +67,11 @@ export type TagCloudProps = {
|
|
|
56
67
|
* Chip variant
|
|
57
68
|
*/
|
|
58
69
|
variant?: 'normal' | 'outline';
|
|
59
|
-
|
|
70
|
+
/**
|
|
71
|
+
* selected Text FontWeight
|
|
72
|
+
*/
|
|
73
|
+
selectedTextStyle?: 'bold' | 'normal';
|
|
74
|
+
}
|
|
60
75
|
/**
|
|
61
76
|
* Tag Cloud pattern, including multiple Chip components
|
|
62
77
|
*
|
|
@@ -72,10 +87,11 @@ const TagCloud: React.FC<TagCloudProps> = ({
|
|
|
72
87
|
required = false,
|
|
73
88
|
multiple = false,
|
|
74
89
|
maxSelection = 0,
|
|
75
|
-
tagCloudRef
|
|
90
|
+
tagCloudRef,
|
|
76
91
|
status = 'default',
|
|
77
92
|
helptext = '',
|
|
78
93
|
variant = 'normal',
|
|
94
|
+
selectedTextStyle = 'bold',
|
|
79
95
|
}) => {
|
|
80
96
|
const props = {
|
|
81
97
|
className,
|
|
@@ -88,11 +104,11 @@ const TagCloud: React.FC<TagCloudProps> = ({
|
|
|
88
104
|
status,
|
|
89
105
|
variant,
|
|
90
106
|
helptext,
|
|
107
|
+
selectedTextStyle,
|
|
91
108
|
maxSelection: multiple ? maxSelection : undefined,
|
|
92
109
|
};
|
|
93
110
|
|
|
94
111
|
return multiple ? <TagCloudMultiActive {...props} /> : <TagCloudSingleActive {...props} />;
|
|
95
112
|
};
|
|
96
113
|
|
|
97
|
-
|
|
98
114
|
export default TagCloud;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
declare const valueFilter: (currentValue: any, acceptableValues: any) => any;
|
|
3
3
|
declare const chipActiveValuesHandler: (key: any, value: any, maxSelection: any) => any[];
|
|
4
|
-
export
|
|
4
|
+
export interface TabCloudProps {
|
|
5
5
|
className?: string;
|
|
6
6
|
options?: {
|
|
7
7
|
value: string;
|
|
@@ -9,14 +9,16 @@ export type TabCloudProps = {
|
|
|
9
9
|
}[];
|
|
10
10
|
label?: string;
|
|
11
11
|
value?: string[] | string;
|
|
12
|
-
onChange?:
|
|
12
|
+
onChange?: (event: Event & {
|
|
13
|
+
target: HTMLInputElement;
|
|
14
|
+
}) => void;
|
|
13
15
|
required?: boolean;
|
|
14
16
|
maxSelection?: number;
|
|
15
|
-
tagCloudRef?:
|
|
17
|
+
tagCloudRef?: React.RefObject<HTMLDivElement>;
|
|
16
18
|
status?: 'default' | 'error';
|
|
17
19
|
helptext?: string;
|
|
18
20
|
variant?: 'normal' | 'outline';
|
|
19
|
-
}
|
|
21
|
+
}
|
|
20
22
|
declare const TagCloudMultiActive: React.FC<TabCloudProps>;
|
|
21
23
|
export { valueFilter, chipActiveValuesHandler };
|
|
22
24
|
export default TagCloudMultiActive;
|
|
@@ -34,19 +34,19 @@ const chipActiveValuesHandler = (key, value, maxSelection) => {
|
|
|
34
34
|
return [];
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
export
|
|
37
|
+
export interface TabCloudProps {
|
|
38
38
|
className?: string;
|
|
39
39
|
options?: { value: string; label: string }[];
|
|
40
40
|
label?: string;
|
|
41
41
|
value?: string[] | string;
|
|
42
|
-
onChange?:
|
|
42
|
+
onChange?: (event: Event & { target: HTMLInputElement }) => void;
|
|
43
43
|
required?: boolean;
|
|
44
44
|
maxSelection?: number;
|
|
45
|
-
tagCloudRef?:
|
|
45
|
+
tagCloudRef?: React.RefObject<HTMLDivElement>;
|
|
46
46
|
status?: 'default' | 'error';
|
|
47
47
|
helptext?: string;
|
|
48
48
|
variant?: 'normal' | 'outline';
|
|
49
|
-
}
|
|
49
|
+
}
|
|
50
50
|
|
|
51
51
|
const TagCloudMultiActive: React.FC<TabCloudProps> = ({
|
|
52
52
|
className,
|
|
@@ -61,7 +61,7 @@ const TagCloudMultiActive: React.FC<TabCloudProps> = ({
|
|
|
61
61
|
helptext,
|
|
62
62
|
variant,
|
|
63
63
|
}) => {
|
|
64
|
-
const defaultRef = useRef();
|
|
64
|
+
const defaultRef = useRef<HTMLDivElement>(null);
|
|
65
65
|
const ref = tagCloudRef || defaultRef;
|
|
66
66
|
|
|
67
67
|
const onChipClicked = (key, activeValues, maxChips) => {
|
|
@@ -7,12 +7,15 @@ export type TagCloudProps = {
|
|
|
7
7
|
}[];
|
|
8
8
|
label?: string;
|
|
9
9
|
value?: string[] | string;
|
|
10
|
-
onChange?:
|
|
10
|
+
onChange?: (event: Event & {
|
|
11
|
+
target: HTMLInputElement;
|
|
12
|
+
}) => void;
|
|
11
13
|
required?: boolean;
|
|
12
|
-
tagCloudRef?:
|
|
14
|
+
tagCloudRef?: React.RefObject<HTMLDivElement>;
|
|
13
15
|
status?: 'default' | 'error';
|
|
14
16
|
helptext?: string;
|
|
15
17
|
variant?: 'normal' | 'outline';
|
|
18
|
+
selectedTextStyle?: 'bold' | 'normal';
|
|
16
19
|
};
|
|
17
20
|
declare const TagCloudSingleActive: React.FC<TagCloudProps>;
|
|
18
21
|
export default TagCloudSingleActive;
|
|
@@ -1,23 +1,31 @@
|
|
|
1
1
|
import React, { useRef } from 'react';
|
|
2
2
|
import theme from '@clad-ui/theme';
|
|
3
|
+
import { css } from '@linaria/core';
|
|
4
|
+
import { cx } from '../../utils';
|
|
3
5
|
import Chip from '../../components/Chip/Chip';
|
|
4
6
|
import { StyledTagCloud, StyledLabel, Paragraph } from './TagCloud.styles';
|
|
5
7
|
import simulateChangeEvent from '../../utils/_simulateChangeEvent';
|
|
6
8
|
|
|
7
|
-
const { colors } = theme;
|
|
9
|
+
const { colors, fontWeights } = theme;
|
|
8
10
|
export type TagCloudProps = {
|
|
9
11
|
className?: string;
|
|
10
12
|
options?: { value: string; label: string }[];
|
|
11
13
|
label?: string;
|
|
12
14
|
value?: string[] | string;
|
|
13
|
-
onChange?:
|
|
15
|
+
onChange?: (event: Event & { target: HTMLInputElement }) => void;
|
|
14
16
|
required?: boolean;
|
|
15
|
-
tagCloudRef?:
|
|
17
|
+
tagCloudRef?: React.RefObject<HTMLDivElement>;
|
|
16
18
|
status?: 'default' | 'error';
|
|
17
19
|
helptext?: string;
|
|
18
20
|
variant?: 'normal' | 'outline';
|
|
21
|
+
selectedTextStyle?: 'bold' | 'normal';
|
|
19
22
|
};
|
|
20
23
|
|
|
24
|
+
const tagCloudClass = css`
|
|
25
|
+
&.active {
|
|
26
|
+
font-weight: ${fontWeights.normal};
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
21
29
|
|
|
22
30
|
const TagCloudSingleActive: React.FC<TagCloudProps> = ({
|
|
23
31
|
className,
|
|
@@ -30,16 +38,21 @@ const TagCloudSingleActive: React.FC<TagCloudProps> = ({
|
|
|
30
38
|
status,
|
|
31
39
|
helptext,
|
|
32
40
|
variant,
|
|
41
|
+
selectedTextStyle,
|
|
33
42
|
}) => {
|
|
34
|
-
const defaultRef = useRef();
|
|
43
|
+
const defaultRef = useRef<HTMLDivElement>(null);
|
|
35
44
|
const ref = tagCloudRef || defaultRef;
|
|
36
45
|
|
|
37
46
|
const onChipClicked = (key) => {
|
|
38
|
-
if (onChange
|
|
47
|
+
if (onChange && ref) {
|
|
48
|
+
const event = simulateChangeEvent(ref, key);
|
|
49
|
+
onChange(event);
|
|
50
|
+
}
|
|
39
51
|
};
|
|
40
52
|
|
|
41
53
|
const chipComponents = options?.map((option) => (
|
|
42
54
|
<Chip
|
|
55
|
+
className={cx(selectedTextStyle === 'normal' && tagCloudClass)}
|
|
43
56
|
key={option.value}
|
|
44
57
|
active={option.value === value}
|
|
45
58
|
as="button"
|
|
@@ -3,7 +3,7 @@ import path from 'path';
|
|
|
3
3
|
import * as components from './index.ts';
|
|
4
4
|
|
|
5
5
|
// add module name here to get ignored
|
|
6
|
-
const ignoredModules = ['index', 'TagCloudSingleActive', 'TagCloudMultiActive'];
|
|
6
|
+
const ignoredModules = ['index', 'TagCloudSingleActive', 'TagCloudMultiActive', 'DialogMainIcon'];
|
|
7
7
|
|
|
8
8
|
describe('patterns/index', () => {
|
|
9
9
|
it('should export all components inside patterns folder', (done) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export default GuideImage;
|
|
2
2
|
declare function GuideImage({ isBad, isGood, alt, ...props }: {
|
|
3
3
|
[x: string]: any;
|
|
4
|
-
isBad
|
|
5
|
-
isGood
|
|
4
|
+
isBad?: boolean | undefined;
|
|
5
|
+
isGood?: boolean | undefined;
|
|
6
6
|
alt: any;
|
|
7
7
|
}): JSX.Element;
|
|
8
8
|
declare namespace GuideImage {
|
package/storybook/Swatch.d.ts
CHANGED
|
@@ -406,9 +406,9 @@ exports[`chotot theme should match current snapshot 1`] = `
|
|
|
406
406
|
},
|
|
407
407
|
"zIndices": {
|
|
408
408
|
"down": -1,
|
|
409
|
-
"dropdown":
|
|
409
|
+
"dropdown": 1700,
|
|
410
410
|
"initial": "auto",
|
|
411
|
-
"modal":
|
|
411
|
+
"modal": 1600,
|
|
412
412
|
"neutral": 0,
|
|
413
413
|
"notification": 1900,
|
|
414
414
|
"tooltip": 1800,
|
package/theme/chotot-color1.d.ts
CHANGED
|
@@ -372,9 +372,6 @@ declare const newTheme: {
|
|
|
372
372
|
readonly body: "14px";
|
|
373
373
|
readonly xxs: "10px";
|
|
374
374
|
readonly xs: "12px";
|
|
375
|
-
/**
|
|
376
|
-
* Background color. A contrast color for emphasizing UI
|
|
377
|
-
*/
|
|
378
375
|
readonly sm: "14px";
|
|
379
376
|
readonly md: "16px";
|
|
380
377
|
readonly lg: "18px";
|
|
@@ -412,9 +409,9 @@ declare const newTheme: {
|
|
|
412
409
|
readonly xl: 1.5;
|
|
413
410
|
};
|
|
414
411
|
mediaQueries: {
|
|
415
|
-
ip5: string;
|
|
416
|
-
tablet: string;
|
|
417
|
-
desktop: string;
|
|
412
|
+
ip5: `screen and (max-width: 320px)` | string;
|
|
413
|
+
tablet: `screen and (min-width: {breakpoints.md})` | string;
|
|
414
|
+
desktop: `screen and (min-width: {breakpoints.lg})` | string;
|
|
418
415
|
};
|
|
419
416
|
radii: {
|
|
420
417
|
none: "0";
|
|
@@ -434,9 +431,7 @@ declare const newTheme: {
|
|
|
434
431
|
};
|
|
435
432
|
sizes: {
|
|
436
433
|
xxxs: "12px";
|
|
437
|
-
xxs: "16px";
|
|
438
|
-
* Body background color
|
|
439
|
-
*/
|
|
434
|
+
xxs: "16px";
|
|
440
435
|
xs: "20px";
|
|
441
436
|
sm: "24px";
|
|
442
437
|
md: "28px";
|
|
@@ -453,9 +448,7 @@ declare const newTheme: {
|
|
|
453
448
|
$xl: "864px";
|
|
454
449
|
vW: "100vw";
|
|
455
450
|
vH: "100vh";
|
|
456
|
-
quarter: "25%";
|
|
457
|
-
* De-emphasized / footer text color
|
|
458
|
-
*/
|
|
451
|
+
quarter: "25%";
|
|
459
452
|
third: "33.33%";
|
|
460
453
|
half: "50%";
|
|
461
454
|
twoThird: "66.66%";
|
|
@@ -483,7 +476,7 @@ declare const newTheme: {
|
|
|
483
476
|
down: -1;
|
|
484
477
|
notification: 1900;
|
|
485
478
|
tooltip: 1800;
|
|
486
|
-
modal:
|
|
487
|
-
dropdown:
|
|
479
|
+
modal: 1600;
|
|
480
|
+
dropdown: 1700;
|
|
488
481
|
};
|
|
489
482
|
};
|
package/theme/chotot.d.ts
CHANGED
|
@@ -289,23 +289,23 @@ declare const theme: Readonly<{
|
|
|
289
289
|
md: "2px";
|
|
290
290
|
lg: "3px";
|
|
291
291
|
xl: "4px";
|
|
292
|
-
'0':
|
|
293
|
-
'1':
|
|
294
|
-
'2':
|
|
295
|
-
'3':
|
|
296
|
-
'4':
|
|
292
|
+
'0': "0px";
|
|
293
|
+
'1': "1px";
|
|
294
|
+
'2': "2px";
|
|
295
|
+
'3': "3px";
|
|
296
|
+
'4': "4px";
|
|
297
297
|
};
|
|
298
298
|
breakpoints: {
|
|
299
|
-
0:
|
|
300
|
-
1:
|
|
301
|
-
2:
|
|
302
|
-
3:
|
|
303
|
-
4:
|
|
304
|
-
sm:
|
|
305
|
-
md:
|
|
306
|
-
lg:
|
|
307
|
-
xl:
|
|
308
|
-
xxl:
|
|
299
|
+
0: "576px";
|
|
300
|
+
1: "768px";
|
|
301
|
+
2: "992px";
|
|
302
|
+
3: "1200px";
|
|
303
|
+
4: "1400px";
|
|
304
|
+
sm: "576px";
|
|
305
|
+
md: "768px";
|
|
306
|
+
lg: "992px";
|
|
307
|
+
xl: "1200px";
|
|
308
|
+
xxl: "1400px";
|
|
309
309
|
};
|
|
310
310
|
colors: {
|
|
311
311
|
/**
|
|
@@ -1013,8 +1013,8 @@ declare const theme: Readonly<{
|
|
|
1013
1013
|
readonly bold: 700;
|
|
1014
1014
|
};
|
|
1015
1015
|
gradients: {
|
|
1016
|
-
toDark:
|
|
1017
|
-
toLight:
|
|
1016
|
+
toDark: "linear-gradient(180deg, rgba(0, 0, 0, 0.00) 3%, #101426 100%)";
|
|
1017
|
+
toLight: "linear-gradient(0deg, #FFFFFF 0%, rgba(255, 255, 255, 0.00) 100%)";
|
|
1018
1018
|
};
|
|
1019
1019
|
letterSpacings: any[];
|
|
1020
1020
|
lineHeights: {
|
|
@@ -1089,10 +1089,10 @@ declare const theme: Readonly<{
|
|
|
1089
1089
|
circle: string;
|
|
1090
1090
|
};
|
|
1091
1091
|
shadows: {
|
|
1092
|
-
none:
|
|
1093
|
-
sm:
|
|
1094
|
-
md:
|
|
1095
|
-
lg:
|
|
1092
|
+
none: "none";
|
|
1093
|
+
sm: "0px 2px 4px rgba(0,0,0,.5)";
|
|
1094
|
+
md: "0px 0px 8px rgba(0,0,0,.3)";
|
|
1095
|
+
lg: "2px 2px 14px rgba(0,0,0,.3)";
|
|
1096
1096
|
};
|
|
1097
1097
|
sizes: {
|
|
1098
1098
|
xxxs: "12px";
|
|
@@ -1111,14 +1111,14 @@ declare const theme: Readonly<{
|
|
|
1111
1111
|
$md: "480px";
|
|
1112
1112
|
$lg: "636px";
|
|
1113
1113
|
$xl: "864px";
|
|
1114
|
-
vW:
|
|
1115
|
-
vH:
|
|
1116
|
-
quarter:
|
|
1117
|
-
third:
|
|
1118
|
-
half:
|
|
1119
|
-
twoThird:
|
|
1120
|
-
threeQuarter:
|
|
1121
|
-
full:
|
|
1114
|
+
vW: "100vw";
|
|
1115
|
+
vH: "100vh";
|
|
1116
|
+
quarter: "25%";
|
|
1117
|
+
third: "33.33%";
|
|
1118
|
+
half: "50%";
|
|
1119
|
+
twoThird: "66.66%";
|
|
1120
|
+
threeQuarter: "75%";
|
|
1121
|
+
full: "100%";
|
|
1122
1122
|
};
|
|
1123
1123
|
space: {
|
|
1124
1124
|
none: "0px";
|
|
@@ -1135,13 +1135,13 @@ declare const theme: Readonly<{
|
|
|
1135
1135
|
xxxxxl: "128px";
|
|
1136
1136
|
};
|
|
1137
1137
|
zIndices: {
|
|
1138
|
-
initial:
|
|
1138
|
+
initial: "auto";
|
|
1139
1139
|
neutral: 0;
|
|
1140
1140
|
up: 1;
|
|
1141
1141
|
down: -1;
|
|
1142
1142
|
notification: 1900;
|
|
1143
1143
|
tooltip: 1800;
|
|
1144
|
-
modal:
|
|
1145
|
-
dropdown:
|
|
1144
|
+
modal: 1600;
|
|
1145
|
+
dropdown: 1700;
|
|
1146
1146
|
};
|
|
1147
1147
|
}>;
|
package/theme/chotot.js
CHANGED
|
@@ -1196,8 +1196,8 @@ const letterSpacings = [];
|
|
|
1196
1196
|
down: -1,
|
|
1197
1197
|
notification: 1900,
|
|
1198
1198
|
tooltip: 1800,
|
|
1199
|
-
modal:
|
|
1200
|
-
dropdown:
|
|
1199
|
+
modal: 1600,
|
|
1200
|
+
dropdown: 1700,
|
|
1201
1201
|
}}
|
|
1202
1202
|
*/
|
|
1203
1203
|
const zIndices = {
|
|
@@ -1207,8 +1207,8 @@ const zIndices = {
|
|
|
1207
1207
|
down: -1,
|
|
1208
1208
|
notification: 1900,
|
|
1209
1209
|
tooltip: 1800,
|
|
1210
|
-
modal:
|
|
1211
|
-
dropdown:
|
|
1210
|
+
modal: 1600,
|
|
1211
|
+
dropdown: 1700,
|
|
1212
1212
|
};
|
|
1213
1213
|
|
|
1214
1214
|
/**
|
package/theme/ct-job.d.ts
CHANGED
|
@@ -317,23 +317,15 @@ declare const jobTheme: {
|
|
|
317
317
|
'4': "4px";
|
|
318
318
|
};
|
|
319
319
|
breakpoints: {
|
|
320
|
-
/**
|
|
321
|
-
* Brand text color
|
|
322
|
-
*/
|
|
323
320
|
0: "576px";
|
|
324
321
|
1: "768px";
|
|
325
322
|
2: "992px";
|
|
326
|
-
3: "1200px";
|
|
327
|
-
* Primary button solid background color
|
|
328
|
-
*/
|
|
323
|
+
3: "1200px";
|
|
329
324
|
4: "1400px";
|
|
330
325
|
sm: "576px";
|
|
331
326
|
md: "768px";
|
|
332
327
|
lg: "992px";
|
|
333
328
|
xl: "1200px";
|
|
334
|
-
/**
|
|
335
|
-
* Primary button solid background color
|
|
336
|
-
*/
|
|
337
329
|
xxl: "1400px";
|
|
338
330
|
};
|
|
339
331
|
durations: {
|
|
@@ -405,9 +397,9 @@ declare const jobTheme: {
|
|
|
405
397
|
readonly xl: 1.5;
|
|
406
398
|
};
|
|
407
399
|
mediaQueries: {
|
|
408
|
-
ip5: string;
|
|
409
|
-
tablet: string;
|
|
410
|
-
desktop: string;
|
|
400
|
+
ip5: `screen and (max-width: 320px)` | string;
|
|
401
|
+
tablet: `screen and (min-width: {breakpoints.md})` | string;
|
|
402
|
+
desktop: `screen and (min-width: {breakpoints.lg})` | string;
|
|
411
403
|
};
|
|
412
404
|
radii: {
|
|
413
405
|
none: "0";
|
|
@@ -472,7 +464,7 @@ declare const jobTheme: {
|
|
|
472
464
|
down: -1;
|
|
473
465
|
notification: 1900;
|
|
474
466
|
tooltip: 1800;
|
|
475
|
-
modal:
|
|
476
|
-
dropdown:
|
|
467
|
+
modal: 1600;
|
|
468
|
+
dropdown: 1700;
|
|
477
469
|
};
|
|
478
470
|
};
|
package/theme/ct-pty.d.ts
CHANGED
|
@@ -570,9 +570,7 @@ declare const propertyTheme: {
|
|
|
570
570
|
};
|
|
571
571
|
breakpoints: {
|
|
572
572
|
0: "576px";
|
|
573
|
-
1: "768px";
|
|
574
|
-
* Brand color for decorations: banner, illustrations, tag...
|
|
575
|
-
*/
|
|
573
|
+
1: "768px";
|
|
576
574
|
2: "992px";
|
|
577
575
|
3: "1200px";
|
|
578
576
|
4: "1400px";
|
|
@@ -651,9 +649,9 @@ declare const propertyTheme: {
|
|
|
651
649
|
readonly xl: 1.5;
|
|
652
650
|
};
|
|
653
651
|
mediaQueries: {
|
|
654
|
-
ip5: string;
|
|
655
|
-
tablet: string;
|
|
656
|
-
desktop: string;
|
|
652
|
+
ip5: `screen and (max-width: 320px)` | string;
|
|
653
|
+
tablet: `screen and (min-width: {breakpoints.md})` | string;
|
|
654
|
+
desktop: `screen and (min-width: {breakpoints.lg})` | string;
|
|
657
655
|
};
|
|
658
656
|
radii: {
|
|
659
657
|
none: "0";
|
|
@@ -718,7 +716,7 @@ declare const propertyTheme: {
|
|
|
718
716
|
down: -1;
|
|
719
717
|
notification: 1900;
|
|
720
718
|
tooltip: 1800;
|
|
721
|
-
modal:
|
|
722
|
-
dropdown:
|
|
719
|
+
modal: 1600;
|
|
720
|
+
dropdown: 1700;
|
|
723
721
|
};
|
|
724
722
|
};
|
package/theme/mudah.d.ts
CHANGED
|
@@ -28,43 +28,44 @@ declare const theme: Readonly<{
|
|
|
28
28
|
length: number;
|
|
29
29
|
toString(): string;
|
|
30
30
|
toLocaleString(): string;
|
|
31
|
+
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string;
|
|
31
32
|
pop(): string | undefined;
|
|
32
33
|
push(...items: string[]): number;
|
|
33
34
|
concat(...items: ConcatArray<string>[]): string[];
|
|
34
35
|
concat(...items: (string | ConcatArray<string>)[]): string[];
|
|
35
|
-
join(separator?: string
|
|
36
|
+
join(separator?: string): string;
|
|
36
37
|
reverse(): string[];
|
|
37
38
|
shift(): string | undefined;
|
|
38
|
-
slice(start?: number
|
|
39
|
+
slice(start?: number, end?: number): string[];
|
|
39
40
|
sort(compareFn?: ((a: string, b: string) => number) | undefined): string[];
|
|
40
|
-
splice(start: number, deleteCount?: number
|
|
41
|
+
splice(start: number, deleteCount?: number): string[];
|
|
41
42
|
splice(start: number, deleteCount: number, ...items: string[]): string[];
|
|
42
43
|
unshift(...items: string[]): number;
|
|
43
|
-
indexOf(searchElement: string, fromIndex?: number
|
|
44
|
-
lastIndexOf(searchElement: string, fromIndex?: number
|
|
44
|
+
indexOf(searchElement: string, fromIndex?: number): number;
|
|
45
|
+
lastIndexOf(searchElement: string, fromIndex?: number): number;
|
|
45
46
|
every<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): this is S[];
|
|
46
47
|
every(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean;
|
|
47
48
|
some(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean;
|
|
48
49
|
forEach(callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any): void;
|
|
49
50
|
map<U>(callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any): U[];
|
|
50
|
-
filter<
|
|
51
|
+
filter<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S[];
|
|
51
52
|
filter(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[];
|
|
52
53
|
reduce(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
|
|
53
54
|
reduce(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
|
|
54
|
-
reduce<
|
|
55
|
+
reduce<U>(callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U;
|
|
55
56
|
reduceRight(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
|
|
56
57
|
reduceRight(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
|
|
57
|
-
reduceRight<
|
|
58
|
-
find<
|
|
58
|
+
reduceRight<U>(callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U;
|
|
59
|
+
find<S extends string>(predicate: (value: string, index: number, obj: string[]) => value is S, thisArg?: any): S | undefined;
|
|
59
60
|
find(predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): string | undefined;
|
|
60
61
|
findIndex(predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): number;
|
|
61
|
-
fill(value: string, start?: number
|
|
62
|
-
copyWithin(target: number, start: number, end?: number
|
|
62
|
+
fill(value: string, start?: number, end?: number): string[];
|
|
63
|
+
copyWithin(target: number, start: number, end?: number): string[];
|
|
63
64
|
entries(): IterableIterator<[number, string]>;
|
|
64
65
|
keys(): IterableIterator<number>;
|
|
65
66
|
values(): IterableIterator<string>;
|
|
66
|
-
includes(searchElement: string, fromIndex?: number
|
|
67
|
-
flatMap<
|
|
67
|
+
includes(searchElement: string, fromIndex?: number): boolean;
|
|
68
|
+
flatMap<U, This = undefined>(callback: (this: This, value: string, index: number, array: string[]) => U | readonly U[], thisArg?: This | undefined): U[];
|
|
68
69
|
flat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[];
|
|
69
70
|
at(index: number): string | undefined;
|
|
70
71
|
[Symbol.iterator](): IterableIterator<string>;
|
package/types.d.ts
CHANGED
|
@@ -12,12 +12,3 @@ export type NextLink = {
|
|
|
12
12
|
onClick?: MouseEventHandler | ((event: MouseEvent, value: any) => void);
|
|
13
13
|
ref?: any;
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
export type LinariaClassName = string & { __linariaClassName: true };
|
|
17
|
-
|
|
18
|
-
export type ClassName<T = string> = T | '' | 0 | false | null | void;
|
|
19
|
-
|
|
20
|
-
interface ICX {
|
|
21
|
-
(...classNames: ClassName<LinariaClassName>[]): LinariaClassName;
|
|
22
|
-
(...classNames: ClassName[]): string;
|
|
23
|
-
}
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
export default simulateChangeEvent;
|
|
2
|
+
/**
|
|
3
|
+
* Conditional type to determine returned type based on ref type
|
|
4
|
+
*/
|
|
5
|
+
export type SimulatedEvent<RefType extends import("react").RefObject<any> | null | undefined> = RefType extends import("react").RefObject<any> ? Event & {
|
|
6
|
+
simulated: boolean;
|
|
7
|
+
target: Omit<HTMLInputElement, "value"> & {
|
|
8
|
+
value: any;
|
|
9
|
+
};
|
|
10
|
+
} : null;
|
|
11
|
+
/**
|
|
12
|
+
* Conditional type to determine returned type based on ref type
|
|
13
|
+
* @template {import ('react').RefObject | null | undefined} RefType
|
|
14
|
+
* @typedef {RefType extends import ('react').RefObject ? Event & { simulated: boolean, target: Omit<HTMLInputElement, 'value'> & { value: any } } : null} SimulatedEvent
|
|
15
|
+
*/
|
|
2
16
|
/**
|
|
3
17
|
* Simulate change event where your input doesn't support onChange natively or to trigger onChange programatically
|
|
4
|
-
* @
|
|
18
|
+
* @template {import ('react').RefObject | null | undefined} RefType
|
|
19
|
+
* @param {RefType} ref DOM element ref, required
|
|
5
20
|
* @param {any} newValue new value to trigger
|
|
6
21
|
* @param {any?} currentValue current value, if obmit, will attempt to get it from `ref.current.value`
|
|
7
|
-
* @return {
|
|
22
|
+
* @return {SimulatedEvent<RefType>} Event object with proper `target` set, call `onChange(event)` if your component doesn't trigger onChange natively
|
|
8
23
|
*/
|
|
9
|
-
declare function simulateChangeEvent
|
|
24
|
+
declare function simulateChangeEvent<RefType extends import("react").RefObject<any> | null | undefined>(ref: RefType, newValue: any, currentValue?: any | null): SimulatedEvent<RefType>;
|