@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
package/components/Tabs/Tab.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export
|
|
2
|
+
export interface TabProps {
|
|
3
3
|
/**
|
|
4
4
|
* Tab icon
|
|
5
5
|
*/
|
|
@@ -27,7 +27,7 @@ export type TabProps = {
|
|
|
27
27
|
/**
|
|
28
28
|
* On click event. Internal props is handled by `Tabs` component
|
|
29
29
|
*/
|
|
30
|
-
onClick?: (event:
|
|
30
|
+
onClick?: (event: React.MouseEvent<HTMLElement>, value: number | string) => void;
|
|
31
31
|
/**
|
|
32
32
|
* TabIndex html attribute. Internal props is handled by `Tabs` component
|
|
33
33
|
*/
|
|
@@ -39,11 +39,11 @@ export type TabProps = {
|
|
|
39
39
|
/**
|
|
40
40
|
* Element or component to be rendered as
|
|
41
41
|
*/
|
|
42
|
-
as?:
|
|
42
|
+
as?: React.ElementType;
|
|
43
43
|
/**
|
|
44
44
|
* Element Id
|
|
45
45
|
*/
|
|
46
|
-
id?:
|
|
46
|
+
id?: string;
|
|
47
47
|
/**
|
|
48
48
|
* href attribute for <a> tag
|
|
49
49
|
*/
|
|
@@ -64,11 +64,11 @@ export type TabProps = {
|
|
|
64
64
|
* Line clamp
|
|
65
65
|
*/
|
|
66
66
|
lineClamp?: number;
|
|
67
|
-
}
|
|
67
|
+
}
|
|
68
68
|
/**
|
|
69
69
|
* Tab is a Tabs children. That is used to render the label/icon content.
|
|
70
70
|
*
|
|
71
71
|
* `✅ Stable`
|
|
72
72
|
*/
|
|
73
|
-
declare const Tab: React.
|
|
73
|
+
declare const Tab: React.ForwardRefExoticComponent<TabProps & React.RefAttributes<React.ReactElement<any, string | React.JSXElementConstructor<any>>>>;
|
|
74
74
|
export default Tab;
|
package/components/Tabs/Tab.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { cx, noop } from '../../utils';
|
|
3
3
|
import { TabRootClass, TabLabel, TabIconWrapper, verticalAlignClass } from './Tabs.styles';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export interface TabProps {
|
|
6
6
|
/**
|
|
7
7
|
* Tab icon
|
|
8
8
|
*/
|
|
@@ -30,7 +30,7 @@ export type TabProps = {
|
|
|
30
30
|
/**
|
|
31
31
|
* On click event. Internal props is handled by `Tabs` component
|
|
32
32
|
*/
|
|
33
|
-
onClick?: (event
|
|
33
|
+
onClick?: (event: React.MouseEvent<HTMLElement>, value: number | string) => void;
|
|
34
34
|
/**
|
|
35
35
|
* TabIndex html attribute. Internal props is handled by `Tabs` component
|
|
36
36
|
*/
|
|
@@ -42,11 +42,11 @@ export type TabProps = {
|
|
|
42
42
|
/**
|
|
43
43
|
* Element or component to be rendered as
|
|
44
44
|
*/
|
|
45
|
-
as?:
|
|
45
|
+
as?: React.ElementType;
|
|
46
46
|
/**
|
|
47
47
|
* Element Id
|
|
48
48
|
*/
|
|
49
|
-
id?:
|
|
49
|
+
id?: string;
|
|
50
50
|
/**
|
|
51
51
|
* href attribute for <a> tag
|
|
52
52
|
*/
|
|
@@ -67,15 +67,14 @@ export type TabProps = {
|
|
|
67
67
|
* Line clamp
|
|
68
68
|
*/
|
|
69
69
|
lineClamp?: number;
|
|
70
|
-
}
|
|
70
|
+
}
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* Tab is a Tabs children. That is used to render the label/icon content.
|
|
74
74
|
*
|
|
75
75
|
* `✅ Stable`
|
|
76
76
|
*/
|
|
77
|
-
|
|
78
|
-
const Tab: React.FC<TabProps> = React.forwardRef((props, ref) => {
|
|
77
|
+
const Tab = React.forwardRef<React.ReactElement, TabProps>((props, ref) => {
|
|
79
78
|
const {
|
|
80
79
|
value,
|
|
81
80
|
label = '',
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export
|
|
2
|
+
export interface TabsOnChangeHandler<ValueType = number | string> {
|
|
3
|
+
(event: React.MouseEvent<HTMLElement>, value: ValueType): void;
|
|
4
|
+
}
|
|
5
|
+
export interface TabsProps {
|
|
3
6
|
/**
|
|
4
7
|
* `Tab` children.
|
|
5
8
|
*/
|
|
@@ -11,11 +14,11 @@ export type TabsProps = {
|
|
|
11
14
|
/**
|
|
12
15
|
* handle change tab selected value
|
|
13
16
|
*/
|
|
14
|
-
onChange?:
|
|
17
|
+
onChange?: TabsOnChangeHandler;
|
|
15
18
|
/**
|
|
16
19
|
* Current tab selected value
|
|
17
20
|
*/
|
|
18
|
-
value?:
|
|
21
|
+
value?: number | string;
|
|
19
22
|
/**
|
|
20
23
|
* Tabs display behavior
|
|
21
24
|
*/
|
|
@@ -48,7 +51,7 @@ export type TabsProps = {
|
|
|
48
51
|
* Select the width (in pixels) to scroll horizontally with each click (default value is the width of one child element)
|
|
49
52
|
*/
|
|
50
53
|
widthScroll?: number;
|
|
51
|
-
}
|
|
54
|
+
}
|
|
52
55
|
/**
|
|
53
56
|
* Tabs is used to navigate between groups of content that are related and at the same level of hierarchy.
|
|
54
57
|
*
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const tabsStories: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: React.FC<import("./Tabs").TabsProps>;
|
|
5
|
+
tags: string[];
|
|
6
|
+
subcomponents: {
|
|
7
|
+
Tab: React.ForwardRefExoticComponent<import("./Tab").TabProps & React.RefAttributes<React.ReactElement<any, string | React.JSXElementConstructor<any>>>>;
|
|
8
|
+
};
|
|
9
|
+
parameters: {
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
argTypes: {
|
|
17
|
+
variant: {
|
|
18
|
+
options: string[];
|
|
19
|
+
control: {
|
|
20
|
+
type: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
children: {
|
|
24
|
+
control: {
|
|
25
|
+
disable: boolean;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
className: {
|
|
29
|
+
control: {
|
|
30
|
+
disable: boolean;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
value: {
|
|
34
|
+
control: {
|
|
35
|
+
disable: boolean;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export default tabsStories;
|
|
41
|
+
export declare const Overview: {
|
|
42
|
+
render: (args: any) => JSX.Element;
|
|
43
|
+
args: {
|
|
44
|
+
variant: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export declare const WithDivider: () => JSX.Element;
|
|
48
|
+
export declare const NormalFontWeightForDeactiveTab: () => JSX.Element;
|
|
49
|
+
export declare const CustomWidthForEachTab: () => JSX.Element;
|
|
50
|
+
export declare const CustomHeightAndLineClamp: () => JSX.Element;
|
|
51
|
+
export declare const WithImage: () => JSX.Element;
|
|
52
|
+
export declare const OnlyIcon: () => JSX.Element;
|
|
53
|
+
export declare const Scrollable: {
|
|
54
|
+
render: () => JSX.Element;
|
|
55
|
+
parameters: {
|
|
56
|
+
docs: {
|
|
57
|
+
description: {
|
|
58
|
+
story: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
export declare const WithScrollButton: () => JSX.Element;
|
|
64
|
+
export declare const WithHrefLink: () => JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import theme from '@clad-ui/theme';
|
|
3
3
|
import Tab from './Tab';
|
|
4
|
-
import Tabs from './Tabs';
|
|
4
|
+
import Tabs, { type TabsOnChangeHandler } from './Tabs';
|
|
5
5
|
import Box from '../Box/Box';
|
|
6
6
|
import {
|
|
7
7
|
AdDashboard,
|
|
@@ -56,7 +56,7 @@ const AppStory = ({ children }) => <Box width={['full', 'half']}>{children}</Box
|
|
|
56
56
|
export const Overview = {
|
|
57
57
|
render: (args) => {
|
|
58
58
|
const [currentTab, setCurrentTab] = useState(0);
|
|
59
|
-
const handleOnchange = (event, value) => {
|
|
59
|
+
const handleOnchange: TabsOnChangeHandler<number> = (event, value) => {
|
|
60
60
|
event.preventDefault();
|
|
61
61
|
setCurrentTab(value);
|
|
62
62
|
};
|
|
@@ -1,24 +1,42 @@
|
|
|
1
|
+
declare const TabRootClass: import("@linaria/core").LinariaClassName;
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
+
* @type {React.FC<any>}
|
|
3
4
|
*/
|
|
4
|
-
|
|
5
|
+
declare const TabLabel: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & {
|
|
6
|
+
lineClamp?: number;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
} & {
|
|
9
|
+
as?: import("react").ElementType;
|
|
10
|
+
}>;
|
|
11
|
+
declare const TabIconWrapper: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown> & {
|
|
12
|
+
as?: import("react").ElementType;
|
|
13
|
+
}>;
|
|
5
14
|
/**
|
|
6
|
-
*
|
|
15
|
+
* @type {React.FC<any>}
|
|
7
16
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
17
|
+
declare const TabsRoot: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
18
|
+
height?: string;
|
|
19
|
+
} & {
|
|
20
|
+
as?: import("react").ElementType;
|
|
11
21
|
}>;
|
|
12
|
-
export const TabRootClass: import("@linaria/core").LinariaClassName;
|
|
13
22
|
/**
|
|
14
23
|
* @type {React.FC<any>}
|
|
15
24
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
25
|
+
declare const TabsScroller: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
26
|
+
scrollable?: boolean;
|
|
27
|
+
} & {
|
|
28
|
+
as?: import("react").ElementType;
|
|
29
|
+
}>;
|
|
30
|
+
declare const TabsIndicator: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown> & {
|
|
31
|
+
as?: import("react").ElementType;
|
|
19
32
|
}>;
|
|
20
33
|
/**
|
|
21
34
|
* @type {React.FC<any>}
|
|
22
35
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
36
|
+
declare const ScrollButton: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
37
|
+
isHidden: boolean;
|
|
38
|
+
} & {
|
|
39
|
+
as?: import("react").ElementType;
|
|
40
|
+
}>;
|
|
41
|
+
declare const verticalAlignClass: import("@linaria/core").LinariaClassName;
|
|
42
|
+
export { TabsRoot, TabsScroller, TabsIndicator, TabRootClass, TabLabel, TabIconWrapper, ScrollButton, verticalAlignClass, };
|
|
@@ -44,7 +44,7 @@ const TabRootClass = css`
|
|
|
44
44
|
/**
|
|
45
45
|
* @type {React.FC<any>}
|
|
46
46
|
*/
|
|
47
|
-
const TabLabel = styled.span
|
|
47
|
+
const TabLabel = styled.span<{ lineClamp?: number; disabled?: boolean }>`
|
|
48
48
|
display: inline-flex;
|
|
49
49
|
align-items: center;
|
|
50
50
|
flex-direction: column;
|
|
@@ -89,7 +89,7 @@ const TabIconWrapper = styled.span`
|
|
|
89
89
|
/**
|
|
90
90
|
* @type {React.FC<any>}
|
|
91
91
|
*/
|
|
92
|
-
const TabsRoot = styled.div
|
|
92
|
+
const TabsRoot = styled.div<{ height?: string }>`
|
|
93
93
|
display: flex;
|
|
94
94
|
flex-direction: row;
|
|
95
95
|
overflow: hidden;
|
|
@@ -103,7 +103,7 @@ const TabsRoot = styled.div`
|
|
|
103
103
|
/**
|
|
104
104
|
* @type {React.FC<any>}
|
|
105
105
|
*/
|
|
106
|
-
const TabsScroller = styled.div
|
|
106
|
+
const TabsScroller = styled.div<{ scrollable?: boolean }>`
|
|
107
107
|
overflow-x: ${({ scrollable }) => (scrollable ? 'auto' : 'hidden')};
|
|
108
108
|
flex: 1 1 auto;
|
|
109
109
|
display: flex;
|
|
@@ -130,7 +130,7 @@ const TabsIndicator = styled.span`
|
|
|
130
130
|
/**
|
|
131
131
|
* @type {React.FC<any>}
|
|
132
132
|
*/
|
|
133
|
-
const ScrollButton = styled.button
|
|
133
|
+
const ScrollButton = styled.button<{ isHidden: boolean }>`
|
|
134
134
|
height: auto;
|
|
135
135
|
width: 52px;
|
|
136
136
|
background-color: ${colors.backgroundPrimary};
|
package/components/Tabs/Tabs.tsx
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { cx } from '../../utils';
|
|
2
|
+
import { cx, noop } from '../../utils';
|
|
3
3
|
import { TabsRoot, TabsScroller, TabsIndicator, ScrollButton } from './Tabs.styles';
|
|
4
4
|
import { ChevronLeft, ChevronRight } from '../../icons';
|
|
5
5
|
|
|
6
|
-
export
|
|
6
|
+
export interface TabsOnChangeHandler<ValueType = number | string> {
|
|
7
|
+
(event: React.MouseEvent<HTMLElement>, value: ValueType): void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface TabsProps {
|
|
7
11
|
/**
|
|
8
12
|
* `Tab` children.
|
|
9
13
|
*/
|
|
@@ -15,11 +19,11 @@ export type TabsProps = {
|
|
|
15
19
|
/**
|
|
16
20
|
* handle change tab selected value
|
|
17
21
|
*/
|
|
18
|
-
onChange?:
|
|
22
|
+
onChange?: TabsOnChangeHandler;
|
|
19
23
|
/**
|
|
20
24
|
* Current tab selected value
|
|
21
25
|
*/
|
|
22
|
-
value?:
|
|
26
|
+
value?: number | string;
|
|
23
27
|
/**
|
|
24
28
|
* Tabs display behavior
|
|
25
29
|
*/
|
|
@@ -52,7 +56,7 @@ export type TabsProps = {
|
|
|
52
56
|
* Select the width (in pixels) to scroll horizontally with each click (default value is the width of one child element)
|
|
53
57
|
*/
|
|
54
58
|
widthScroll?: number;
|
|
55
|
-
}
|
|
59
|
+
}
|
|
56
60
|
|
|
57
61
|
/**
|
|
58
62
|
* Tabs is used to navigate between groups of content that are related and at the same level of hierarchy.
|
|
@@ -61,14 +65,14 @@ export type TabsProps = {
|
|
|
61
65
|
*/
|
|
62
66
|
const Tabs: React.FC<TabsProps> = ({
|
|
63
67
|
children: ChildrenProp,
|
|
64
|
-
onChange =
|
|
68
|
+
onChange = noop,
|
|
65
69
|
className = '',
|
|
66
70
|
value = false,
|
|
67
71
|
variant = 'standard',
|
|
68
72
|
indicatorColor = 'primary',
|
|
69
73
|
showDivider = false,
|
|
70
74
|
fontWeight = 'bold',
|
|
71
|
-
height =
|
|
75
|
+
height = undefined,
|
|
72
76
|
lineClamp = 1,
|
|
73
77
|
showScrollBtn = false,
|
|
74
78
|
widthScroll,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export type TextAreaProps = {
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type Sizes } from '@clad-ui/theme';
|
|
3
|
+
export interface TextAreaProps {
|
|
5
4
|
/**
|
|
6
5
|
* TextArea name
|
|
7
6
|
*/
|
|
@@ -13,23 +12,23 @@ export type TextAreaProps = {
|
|
|
13
12
|
/**
|
|
14
13
|
* TextArea ref (implement with useRef() hooks)
|
|
15
14
|
*/
|
|
16
|
-
inputRef?: React.RefObject<
|
|
15
|
+
inputRef?: React.RefObject<HTMLTextAreaElement>;
|
|
17
16
|
/**
|
|
18
17
|
* The TextArea content value
|
|
19
18
|
*/
|
|
20
|
-
value?:
|
|
19
|
+
value?: string;
|
|
21
20
|
/**
|
|
22
21
|
* Callback when user input
|
|
23
22
|
*/
|
|
24
|
-
onChange?:
|
|
23
|
+
onChange?: React.ChangeEventHandler<HTMLTextAreaElement>;
|
|
25
24
|
/**
|
|
26
25
|
* Callback when user blur
|
|
27
26
|
*/
|
|
28
|
-
onBlur?:
|
|
27
|
+
onBlur?: React.FocusEventHandler<HTMLTextAreaElement>;
|
|
29
28
|
/**
|
|
30
29
|
* Callback when user focus
|
|
31
30
|
*/
|
|
32
|
-
onFocus?:
|
|
31
|
+
onFocus?: React.FocusEventHandler<HTMLTextAreaElement>;
|
|
33
32
|
/**
|
|
34
33
|
* Disabled TextArea
|
|
35
34
|
*/
|
|
@@ -50,10 +49,19 @@ export type TextAreaProps = {
|
|
|
50
49
|
* Promp a helptext below TextArea (useful when implemented with form validation)
|
|
51
50
|
*/
|
|
52
51
|
helptext?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Custom helptext
|
|
54
|
+
*/
|
|
55
|
+
helptextClassName?: string;
|
|
53
56
|
/**
|
|
54
57
|
* Allow user to resize TextArea
|
|
55
58
|
*/
|
|
56
59
|
resize?: 'both' | 'horizontal' | 'none' | 'vertical';
|
|
60
|
+
/**
|
|
61
|
+
* Auto resize the TextArea based on content
|
|
62
|
+
* @default false
|
|
63
|
+
*/
|
|
64
|
+
autoSize?: boolean;
|
|
57
65
|
/**
|
|
58
66
|
* Number of lines
|
|
59
67
|
*/
|
|
@@ -69,7 +77,7 @@ export type TextAreaProps = {
|
|
|
69
77
|
/**
|
|
70
78
|
* TextArea width
|
|
71
79
|
*/
|
|
72
|
-
width?:
|
|
80
|
+
width?: Sizes;
|
|
73
81
|
/**
|
|
74
82
|
* Maximum number of characters allowed. 0, null and undefined mean no limitation
|
|
75
83
|
*/
|
|
@@ -78,7 +86,12 @@ export type TextAreaProps = {
|
|
|
78
86
|
* Resizeable on focus event ?
|
|
79
87
|
*/
|
|
80
88
|
isResizeableOnFocus?: boolean;
|
|
81
|
-
|
|
89
|
+
/**
|
|
90
|
+
* If allow to remove input content with clear icon
|
|
91
|
+
* @default true
|
|
92
|
+
*/
|
|
93
|
+
allowClear?: boolean;
|
|
94
|
+
}
|
|
82
95
|
/**
|
|
83
96
|
* TextArea component that has floating label, caption and resizability.
|
|
84
97
|
*
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const textAreaStories: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: React.FC<import("./TextArea").TextAreaProps>;
|
|
5
|
+
tags: string[];
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
argTypes: {
|
|
14
|
+
width: {
|
|
15
|
+
control: {
|
|
16
|
+
type: string;
|
|
17
|
+
};
|
|
18
|
+
options: string[];
|
|
19
|
+
};
|
|
20
|
+
characterLimit: {
|
|
21
|
+
control: {
|
|
22
|
+
type: string;
|
|
23
|
+
min: number;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
disabled: {};
|
|
27
|
+
required: {};
|
|
28
|
+
status: {};
|
|
29
|
+
resize: {};
|
|
30
|
+
lines: {};
|
|
31
|
+
id: {
|
|
32
|
+
control: null;
|
|
33
|
+
};
|
|
34
|
+
name: {
|
|
35
|
+
control: null;
|
|
36
|
+
};
|
|
37
|
+
value: {
|
|
38
|
+
control: null;
|
|
39
|
+
};
|
|
40
|
+
onChange: {
|
|
41
|
+
control: null;
|
|
42
|
+
};
|
|
43
|
+
onBlur: {
|
|
44
|
+
control: null;
|
|
45
|
+
};
|
|
46
|
+
onFocus: {
|
|
47
|
+
control: null;
|
|
48
|
+
};
|
|
49
|
+
inputRef: {
|
|
50
|
+
control: null;
|
|
51
|
+
};
|
|
52
|
+
inputMode: {
|
|
53
|
+
control: null;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
args: {
|
|
57
|
+
label: string;
|
|
58
|
+
helptext: string;
|
|
59
|
+
placeholder: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
export default textAreaStories;
|
|
63
|
+
export declare const Overview: {
|
|
64
|
+
render: (args: any) => JSX.Element;
|
|
65
|
+
};
|
|
66
|
+
export declare const ValueBinding: {
|
|
67
|
+
render: () => JSX.Element;
|
|
68
|
+
parameters: {
|
|
69
|
+
docs: {
|
|
70
|
+
description: {
|
|
71
|
+
story: string;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
export declare const WithLines: {
|
|
77
|
+
render: () => JSX.Element;
|
|
78
|
+
name: string;
|
|
79
|
+
parameters: {
|
|
80
|
+
docs: {
|
|
81
|
+
description: {
|
|
82
|
+
story: string;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
export declare const WithResize: {
|
|
88
|
+
render: () => JSX.Element;
|
|
89
|
+
name: string;
|
|
90
|
+
parameters: {
|
|
91
|
+
docs: {
|
|
92
|
+
description: {
|
|
93
|
+
story: string;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
export declare const Required: {
|
|
99
|
+
render: () => JSX.Element;
|
|
100
|
+
name: string;
|
|
101
|
+
parameters: {
|
|
102
|
+
docs: {
|
|
103
|
+
description: {
|
|
104
|
+
story: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
export declare const WithPlaceholder: {
|
|
110
|
+
render: () => JSX.Element;
|
|
111
|
+
name: string;
|
|
112
|
+
parameters: {
|
|
113
|
+
docs: {
|
|
114
|
+
description: {
|
|
115
|
+
story: string;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
export declare const WithHelptext: {
|
|
121
|
+
render: () => JSX.Element;
|
|
122
|
+
name: string;
|
|
123
|
+
parameters: {
|
|
124
|
+
docs: {
|
|
125
|
+
description: {
|
|
126
|
+
story: string;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
export declare const ErrorStatus: {
|
|
132
|
+
render: () => JSX.Element;
|
|
133
|
+
name: string;
|
|
134
|
+
parameters: {
|
|
135
|
+
docs: {
|
|
136
|
+
description: {
|
|
137
|
+
story: string;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
export declare const AllowClear: {
|
|
143
|
+
render: () => JSX.Element;
|
|
144
|
+
parameters: {
|
|
145
|
+
docs: {
|
|
146
|
+
description: {
|
|
147
|
+
story: string;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
};
|