@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.
Files changed (224) hide show
  1. package/README.md +3 -3
  2. package/components/Announcer/Announcer.d.ts +9 -4
  3. package/components/Announcer/Announcer.stories.d.ts +142 -0
  4. package/components/Announcer/{Announcer.stories.js → Announcer.stories.tsx} +36 -31
  5. package/components/Announcer/Announcer.styles.d.ts +24 -12
  6. package/components/Announcer/{Announcer.styles.js → Announcer.styles.ts} +43 -18
  7. package/components/Announcer/Announcer.tsx +62 -47
  8. package/components/Badge/Badge.d.ts +4 -2
  9. package/components/Badge/Badge.stories.d.ts +61 -0
  10. package/components/Badge/{Badge.stories.js → Badge.stories.tsx} +5 -5
  11. package/components/Badge/Badge.styles.d.ts +20 -5
  12. package/components/Badge/{Badge.styles.js → Badge.styles.ts} +14 -1
  13. package/components/Badge/Badge.tsx +8 -4
  14. package/components/Box/Box.d.ts +3 -3
  15. package/components/Box/Box.stories.d.ts +240 -0
  16. package/components/Box/{Box.stories.js → Box.stories.tsx} +2 -2
  17. package/components/Box/Box.styles.d.ts +19 -4
  18. package/components/Box/{Box.styles.js → Box.styles.ts} +17 -4
  19. package/components/Box/Box.tsx +4 -4
  20. package/components/Breadcrumbs/Breadcrumbs.d.ts +2 -2
  21. package/components/Breadcrumbs/Breadcrumbs.stories.d.ts +52 -0
  22. package/components/Breadcrumbs/{Breadcrumbs.stories.js → Breadcrumbs.stories.tsx} +17 -15
  23. package/components/Breadcrumbs/Breadcrumbs.styles.d.ts +5 -4
  24. package/components/Breadcrumbs/Breadcrumbs.tsx +2 -2
  25. package/components/Button/Button.d.ts +21 -6
  26. package/components/Button/Button.stories.d.ts +103 -0
  27. package/components/Button/{Button.stories.js → Button.stories.tsx} +5 -1
  28. package/components/Button/Button.styles.d.ts +1 -1
  29. package/components/Button/{Button.styles.js → Button.styles.ts} +100 -6
  30. package/components/Button/Button.tsx +51 -18
  31. package/components/Button/ButtonLink.d.ts +4 -4
  32. package/components/Button/ButtonLink.stories.d.ts +30 -0
  33. package/components/Button/ButtonLink.styles.d.ts +1 -1
  34. package/components/Button/ButtonLink.tsx +5 -5
  35. package/components/Button/IconButton.d.ts +3 -29
  36. package/components/Button/IconButton.stories.d.ts +60 -0
  37. package/components/Button/{IconButton.stories.js → IconButton.stories.tsx} +27 -0
  38. package/components/Button/IconButton.tsx +2 -42
  39. package/components/Checkbox/Checkbox.d.ts +3 -3
  40. package/components/Checkbox/Checkbox.stories.d.ts +88 -0
  41. package/components/Checkbox/Checkbox.styles.d.ts +2 -2
  42. package/components/Checkbox/Checkbox.tsx +3 -6
  43. package/components/Chip/Chip.d.ts +5 -4
  44. package/components/Chip/Chip.stories.d.ts +153 -0
  45. package/components/Chip/{Chip.stories.js → Chip.stories.tsx} +4 -5
  46. package/components/Chip/Chip.styles.d.ts +11 -8
  47. package/components/Chip/{Chip.styles.js → Chip.styles.ts} +4 -4
  48. package/components/Chip/Chip.tsx +19 -12
  49. package/components/CurrencyInput/CurrencyInput.d.ts +3 -56
  50. package/components/CurrencyInput/CurrencyInput.stories.d.ts +104 -0
  51. package/components/CurrencyInput/{CurrencyInput.stories.js → CurrencyInput.stories.tsx} +2 -2
  52. package/components/CurrencyInput/CurrencyInput.styles.d.ts +16 -10
  53. package/components/CurrencyInput/{CurrencyInput.styles.js → CurrencyInput.styles.ts} +23 -9
  54. package/components/CurrencyInput/CurrencyInput.tsx +7 -61
  55. package/components/Dropdown/Dropdown.d.ts +22 -7
  56. package/components/Dropdown/Dropdown.stories.d.ts +148 -0
  57. package/components/Dropdown/{Dropdown.stories.js → Dropdown.stories.tsx} +115 -1
  58. package/components/Dropdown/Dropdown.styles.d.ts +10 -0
  59. package/components/Dropdown/Dropdown.styles.ts +42 -0
  60. package/components/Dropdown/Dropdown.tsx +120 -24
  61. package/components/Grid/Col.d.ts +2 -2
  62. package/components/Grid/Col.tsx +6 -3
  63. package/components/Grid/Grid.styles.d.ts +25 -5
  64. package/components/Grid/{Grid.styles.js → Grid.styles.ts} +16 -3
  65. package/components/Grid/aGrid.stories.d.ts +127 -0
  66. package/components/Grid/bCol.stories.d.ts +74 -0
  67. package/components/Input/Input.d.ts +14 -10
  68. package/components/Input/Input.stories.d.ts +226 -0
  69. package/components/Input/{Input.stories.js → Input.stories.tsx} +20 -16
  70. package/components/Input/Input.styles.d.ts +22 -11
  71. package/components/Input/{Input.styles.js → Input.styles.ts} +29 -7
  72. package/components/Input/Input.tsx +22 -20
  73. package/components/Popover/Popover.d.ts +44 -0
  74. package/components/Popover/Popover.stories.d.ts +53 -0
  75. package/components/Popover/Popover.stories.tsx +133 -0
  76. package/components/Popover/Popover.tsx +121 -0
  77. package/components/RadioButton/RadioButton.d.ts +5 -6
  78. package/components/RadioButton/RadioButton.stories.d.ts +94 -0
  79. package/components/RadioButton/RadioButton.styles.d.ts +7 -3
  80. package/components/RadioButton/{RadioButton.styles.js → RadioButton.styles.ts} +1 -1
  81. package/components/RadioButton/RadioButton.tsx +5 -11
  82. package/components/RowItem/RowItem.d.ts +27 -9
  83. package/components/RowItem/RowItem.stories.d.ts +131 -0
  84. package/components/RowItem/RowItem.stories.tsx +710 -0
  85. package/components/RowItem/RowItem.styles.d.ts +31 -10
  86. package/components/RowItem/{RowItem.styles.js → RowItem.styles.ts} +41 -13
  87. package/components/RowItem/RowItem.tsx +106 -42
  88. package/components/ShapeIcon/ShapeIcon.d.ts +23 -16
  89. package/components/ShapeIcon/ShapeIcon.stories.d.ts +91 -0
  90. package/components/ShapeIcon/{ShapeIcon.stories.js → ShapeIcon.stories.tsx} +21 -8
  91. package/components/ShapeIcon/ShapeIcon.styles.d.ts +8 -3
  92. package/components/ShapeIcon/{ShapeIcon.styles.js → ShapeIcon.styles.ts} +6 -3
  93. package/components/ShapeIcon/ShapeIcon.tsx +25 -21
  94. package/components/Slider/Slider.d.ts +9 -7
  95. package/components/Slider/Slider.stories.d.ts +81 -0
  96. package/components/Slider/{Slider.stories.js → Slider.stories.tsx} +7 -7
  97. package/components/Slider/Slider.styles.d.ts +15 -11
  98. package/components/Slider/{Slider.styles.js → Slider.styles.ts} +1 -1
  99. package/components/Slider/Slider.tsx +21 -16
  100. package/components/Snack/Snack.d.ts +4 -5
  101. package/components/Snack/Snack.stories.d.ts +87 -0
  102. package/components/Snack/Snack.styles.d.ts +9 -8
  103. package/components/Snack/{Snack.styles.js → Snack.styles.ts} +4 -4
  104. package/components/Snack/Snack.tsx +14 -11
  105. package/components/Tabs/Tab.d.ts +6 -6
  106. package/components/Tabs/Tab.tsx +6 -7
  107. package/components/Tabs/Tabs.d.ts +7 -4
  108. package/components/Tabs/Tabs.stories.d.ts +64 -0
  109. package/components/Tabs/{Tabs.stories.js → Tabs.stories.tsx} +2 -2
  110. package/components/Tabs/Tabs.styles.d.ts +30 -12
  111. package/components/Tabs/{Tabs.styles.js → Tabs.styles.ts} +4 -4
  112. package/components/Tabs/Tabs.tsx +11 -7
  113. package/components/TextArea/TextArea.d.ts +24 -11
  114. package/components/TextArea/TextArea.stories.d.ts +151 -0
  115. package/components/TextArea/{TextArea.stories.js → TextArea.stories.tsx} +5 -96
  116. package/components/TextArea/TextArea.styles.d.ts +18 -16
  117. package/components/TextArea/{TextArea.styles.js → TextArea.styles.ts} +39 -19
  118. package/components/TextArea/TextArea.tsx +85 -31
  119. package/components/TextLabel/TextLabel.d.ts +35 -0
  120. package/components/TextLabel/TextLabel.stories.d.ts +40 -0
  121. package/components/TextLabel/TextLabel.stories.tsx +177 -0
  122. package/components/TextLabel/TextLabel.styles.d.ts +9 -0
  123. package/components/TextLabel/TextLabel.styles.ts +24 -0
  124. package/components/TextLabel/TextLabel.tsx +112 -0
  125. package/components/ToggleSwitch/ToggleSwitch.d.ts +2 -2
  126. package/components/ToggleSwitch/ToggleSwitch.stories.d.ts +38 -0
  127. package/components/ToggleSwitch/ToggleSwitch.styles.d.ts +21 -14
  128. package/components/ToggleSwitch/{ToggleSwitch.styles.js → ToggleSwitch.styles.ts} +8 -12
  129. package/components/ToggleSwitch/ToggleSwitch.tsx +12 -6
  130. package/components/Tooltip/Tooltip.d.ts +9 -3
  131. package/components/Tooltip/Tooltip.spec.js +5 -3
  132. package/components/Tooltip/Tooltip.styles.d.ts +7 -8
  133. package/components/Tooltip/Tooltip.tsx +10 -3
  134. package/components/index.d.ts +2 -0
  135. package/components/index.ts +2 -0
  136. package/icons/PrivateSellerAvatar.d.ts +3 -0
  137. package/icons/PrivateSellerAvatar.js +3 -0
  138. package/icons/Sda.d.ts +5 -2
  139. package/icons/Sda.js +7 -7
  140. package/icons/VerifiedShop.d.ts +3 -0
  141. package/icons/VerifiedShop.js +3 -0
  142. package/package.json +6 -6
  143. package/patterns/Drawer/Drawer.d.ts +13 -13
  144. package/patterns/Drawer/Drawer.stories.d.ts +90 -0
  145. package/patterns/Drawer/{Drawer.stories.js → Drawer.stories.tsx} +25 -0
  146. package/patterns/Drawer/Drawer.styles.d.ts +30 -26
  147. package/patterns/Drawer/{Drawer.styles.js → Drawer.styles.ts} +2 -5
  148. package/patterns/Drawer/Drawer.tsx +20 -41
  149. package/patterns/EmptyState/EmptyState.d.ts +5 -4
  150. package/patterns/EmptyState/EmptyState.stories.d.ts +40 -0
  151. package/patterns/EmptyState/EmptyState.styles.d.ts +10 -10
  152. package/patterns/EmptyState/{EmptyState.styles.js → EmptyState.styles.ts} +5 -4
  153. package/patterns/EmptyState/EmptyState.tsx +14 -12
  154. package/patterns/InputGroup/InputGroup.d.ts +4 -0
  155. package/patterns/InputGroup/InputGroup.styles.d.ts +5 -4
  156. package/patterns/InputGroup/InputGroup.tsx +11 -5
  157. package/patterns/LegacyDialog/DialogMainIcon.d.ts +1 -0
  158. package/patterns/LegacyDialog/DialogMainIcon.js +51 -0
  159. package/patterns/LegacyDialog/LegacyDialog.d.ts +3 -3
  160. package/patterns/LegacyDialog/LegacyDialog.styles.d.ts +8 -10
  161. package/patterns/LegacyDialog/LegacyDialog.styles.js +1 -46
  162. package/patterns/LegacyDialog/LegacyDialog.tsx +5 -11
  163. package/patterns/LegacyPopup/LegacyPopup.d.ts +4 -4
  164. package/patterns/LegacyPopup/LegacyPopup.styles.d.ts +18 -13
  165. package/patterns/LegacyPopup/{LegacyPopup.styles.js → LegacyPopup.styles.ts} +3 -1
  166. package/patterns/LegacyPopup/LegacyPopup.tsx +4 -6
  167. package/patterns/MultiSearchDropdown/MultiSearchDropdown.d.ts +20 -17
  168. package/patterns/MultiSearchDropdown/MultiSearchDropdown.stories.d.ts +125 -0
  169. package/patterns/MultiSearchDropdown/{MultiSearchDropdown.stories.js → MultiSearchDropdown.stories.tsx} +31 -30
  170. package/patterns/MultiSearchDropdown/MultiSearchDropdown.styles.d.ts +22 -21
  171. package/patterns/MultiSearchDropdown/{MultiSearchDropdown.styles.js → MultiSearchDropdown.styles.ts} +1 -7
  172. package/patterns/MultiSearchDropdown/MultiSearchDropdown.tsx +33 -32
  173. package/patterns/Popup/Popup.d.ts +8 -7
  174. package/patterns/Popup/Popup.stories.d.ts +102 -0
  175. package/patterns/Popup/Popup.styles.d.ts +41 -30
  176. package/patterns/Popup/{Popup.styles.js → Popup.styles.ts} +26 -33
  177. package/patterns/Popup/Popup.tsx +14 -33
  178. package/patterns/SearchInput/SearchInput.d.ts +38 -21
  179. package/patterns/SearchInput/SearchInput.stories.d.ts +186 -0
  180. package/patterns/SearchInput/{SearchInput.stories.js → SearchInput.stories.tsx} +78 -45
  181. package/patterns/SearchInput/SearchInput.styles.d.ts +6 -5
  182. package/patterns/SearchInput/{SearchInput.styles.js → SearchInput.styles.ts} +7 -4
  183. package/patterns/SearchInput/SearchInput.tsx +53 -34
  184. package/patterns/TagCloud/TagCloud.d.ts +19 -6
  185. package/patterns/TagCloud/TagCloud.stories.d.ts +159 -0
  186. package/patterns/TagCloud/{TagCloud.stories.js → TagCloud.stories.tsx} +59 -14
  187. package/patterns/TagCloud/TagCloud.styles.d.ts +12 -8
  188. package/patterns/TagCloud/{TagCloud.styles.js → TagCloud.styles.ts} +6 -7
  189. package/patterns/TagCloud/TagCloud.tsx +24 -8
  190. package/patterns/TagCloud/TagCloudMultiActive.d.ts +6 -4
  191. package/patterns/TagCloud/TagCloudMultiActive.tsx +5 -5
  192. package/patterns/TagCloud/TagCloudSingleActive.d.ts +5 -2
  193. package/patterns/TagCloud/TagCloudSingleActive.tsx +18 -5
  194. package/patterns/patterns-index.spec.js +1 -1
  195. package/storybook/GuideImage.d.ts +2 -2
  196. package/storybook/Swatch.d.ts +2 -2
  197. package/theme/__snapshots__/chotot.spec.js.snap +2 -2
  198. package/theme/chotot-color1.d.ts +7 -14
  199. package/theme/chotot.d.ts +32 -32
  200. package/theme/chotot.js +4 -4
  201. package/theme/ct-job.d.ts +6 -14
  202. package/theme/ct-pty.d.ts +6 -8
  203. package/theme/mudah.d.ts +14 -13
  204. package/types.d.ts +0 -9
  205. package/utils/_simulateChangeEvent.d.ts +18 -3
  206. package/utils/_simulateChangeEvent.js +13 -6
  207. package/utils/_simulateChangeEvent.spec.js +1 -1
  208. package/utils/cx.d.ts +8 -4
  209. package/utils/cx.js +8 -4
  210. package/utils/sx.d.ts +12 -4192
  211. package/components/RowItem/RowItem.stories.js +0 -560
  212. /package/components/Breadcrumbs/{Breadcrumbs.styles.js → Breadcrumbs.styles.ts} +0 -0
  213. /package/components/Button/{ButtonLink.stories.js → ButtonLink.stories.tsx} +0 -0
  214. /package/components/Button/{ButtonLink.styles.js → ButtonLink.styles.ts} +0 -0
  215. /package/components/Checkbox/{Checkbox.stories.js → Checkbox.stories.tsx} +0 -0
  216. /package/components/Checkbox/{Checkbox.styles.js → Checkbox.styles.ts} +0 -0
  217. /package/components/Grid/{aGrid.stories.js → aGrid.stories.tsx} +0 -0
  218. /package/components/Grid/{bCol.stories.js → bCol.stories.tsx} +0 -0
  219. /package/components/RadioButton/{RadioButton.stories.js → RadioButton.stories.tsx} +0 -0
  220. /package/components/Snack/{Snack.stories.js → Snack.stories.tsx} +0 -0
  221. /package/components/ToggleSwitch/{ToggleSwitch.stories.js → ToggleSwitch.stories.tsx} +0 -0
  222. /package/patterns/EmptyState/{EmptyState.stories.js → EmptyState.stories.tsx} +0 -0
  223. /package/patterns/InputGroup/{InputGroup.styles.js → InputGroup.styles.ts} +0 -0
  224. /package/patterns/Popup/{Popup.stories.js → Popup.stories.tsx} +0 -0
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- export type TabProps = {
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: any, value: any) => void;
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?: string;
42
+ as?: React.ElementType;
43
43
  /**
44
44
  * Element Id
45
45
  */
46
- id?: number | string;
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.FC<TabProps>;
73
+ declare const Tab: React.ForwardRefExoticComponent<TabProps & React.RefAttributes<React.ReactElement<any, string | React.JSXElementConstructor<any>>>>;
74
74
  export default Tab;
@@ -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 type TabProps = {
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, value) => void;
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?: string;
45
+ as?: React.ElementType;
46
46
  /**
47
47
  * Element Id
48
48
  */
49
- id?: number | string;
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 type TabsProps = {
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?: any;
17
+ onChange?: TabsOnChangeHandler;
15
18
  /**
16
19
  * Current tab selected value
17
20
  */
18
- value?: any;
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
- * @type {React.FC<any>}
3
+ * @type {React.FC<any>}
3
4
  */
4
- export const TabsRoot: React.FC<any>;
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
- * @type {React.FC<any>}
15
+ * @type {React.FC<any>}
7
16
  */
8
- export const TabsScroller: React.FC<any>;
9
- export const TabsIndicator: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown> & {
10
- as?: import("react").ElementType<any> | undefined;
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
- export const TabLabel: React.FC<any>;
17
- export const TabIconWrapper: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown> & {
18
- as?: import("react").ElementType<any> | undefined;
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
- export const ScrollButton: React.FC<any>;
24
- export const verticalAlignClass: import("@linaria/core").LinariaClassName;
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};
@@ -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 type TabsProps = {
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?: any;
22
+ onChange?: TabsOnChangeHandler;
19
23
  /**
20
24
  * Current tab selected value
21
25
  */
22
- value?: any;
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 = null,
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 = null,
75
+ height = undefined,
72
76
  lineClamp = 1,
73
77
  showScrollBtn = false,
74
78
  widthScroll,
@@ -1,7 +1,6 @@
1
- import React from 'react';
2
- declare const keyOfSizes: readonly string[];
3
- type Size = (typeof keyOfSizes)[number];
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<any>;
15
+ inputRef?: React.RefObject<HTMLTextAreaElement>;
17
16
  /**
18
17
  * The TextArea content value
19
18
  */
20
- value?: number | string;
19
+ value?: string;
21
20
  /**
22
21
  * Callback when user input
23
22
  */
24
- onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
23
+ onChange?: React.ChangeEventHandler<HTMLTextAreaElement>;
25
24
  /**
26
25
  * Callback when user blur
27
26
  */
28
- onBlur?: () => void;
27
+ onBlur?: React.FocusEventHandler<HTMLTextAreaElement>;
29
28
  /**
30
29
  * Callback when user focus
31
30
  */
32
- onFocus?: () => void;
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?: Size;
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
+ };