@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
@@ -62,6 +62,33 @@ export const Overview = {
62
62
  },
63
63
  };
64
64
 
65
+ export const Variants = {
66
+ render: (/* args */) => (
67
+ // Below is sample class definition, colors should be from theme
68
+ <div style={{ display: 'flex', gap: '8px' }}>
69
+ <IconButton variant="default" color="primary" size="large">
70
+ <iconComponents.Heart />
71
+ </IconButton>
72
+ <IconButton variant="solid" color="primary" size="large">
73
+ <iconComponents.Heart />
74
+ </IconButton>
75
+ <IconButton variant="tonal" color="primary" size="large">
76
+ <iconComponents.Heart />
77
+ </IconButton>
78
+ <IconButton variant="outline" color="primary" size="large">
79
+ <iconComponents.Heart />
80
+ </IconButton>
81
+ </div>
82
+ ),
83
+ parameters: {
84
+ docs: {
85
+ description: {
86
+ story: 'The `variant` options include default, solid, tonal, and outline.',
87
+ },
88
+ },
89
+ },
90
+ };
91
+
65
92
  export const ExtraClasses = {
66
93
  render: (/* args */) => {
67
94
  // Below is sample class definition, colors should be from theme
@@ -1,46 +1,7 @@
1
1
  import * as React from 'react';
2
- import Button from './Button';
2
+ import Button, { type ButtonProps } from './Button';
3
3
 
4
- export type IconButtonProps = {
5
- /**
6
- * Different looks of button
7
- */
8
- variant?: 'outline' | 'solid';
9
- /**
10
- * Color of the background (solid) or stroke (outline) of the button
11
- */
12
- color?:
13
- | 'accent'
14
- | 'caution'
15
- | 'chotot'
16
- | 'critical'
17
- | 'error'
18
- | 'info'
19
- | 'neutral'
20
- | 'positive'
21
- | 'primary'
22
- | 'success'
23
- | 'tertiary';
24
- /**
25
- * Border radius
26
- */
27
- radius?: 'circle' | 'normal';
28
- /**
29
- * Button's size
30
- */
31
- size?: 'large' | 'medium' | 'small';
32
- /**
33
- * Whether this button is disabled. No events triggered.
34
- */
35
- disabled?: boolean;
36
- /**
37
- * Element or component to be rendered as
38
- */
39
- as?: React.ElementType;
40
- children?: React.ReactNode;
41
- extraClasses?: string;
42
- onClick?: () => void;
43
- };
4
+ export interface IconButtonProps extends Omit<ButtonProps, 'stretch' | 'icon'> {}
44
5
 
45
6
  /**
46
7
  * Icons as interactive buttons / links. It has the same props list as [Button component](/docs/components-shapeicon--docs)
@@ -68,5 +29,4 @@ const IconButton: React.FC<IconButtonProps> = ({
68
29
  return <Button icon as={as} {...props} />;
69
30
  };
70
31
 
71
-
72
32
  export default IconButton;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- export type CheckboxProps = {
2
+ export interface CheckboxProps {
3
3
  /**
4
4
  * Checkbox id
5
5
  */
@@ -35,8 +35,8 @@ export type CheckboxProps = {
35
35
  /**
36
36
  * Change event
37
37
  */
38
- onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
39
- };
38
+ onChange?: React.ChangeEventHandler<HTMLInputElement>;
39
+ }
40
40
  /**
41
41
  * Renders a checkbox element.
42
42
  *
@@ -0,0 +1,88 @@
1
+ import React from 'react';
2
+ declare const checkboxStories: {
3
+ title: string;
4
+ component: React.FC<import("./Checkbox").CheckboxProps>;
5
+ tags: string[];
6
+ parameters: {
7
+ docs: {
8
+ description: {
9
+ component: string;
10
+ };
11
+ };
12
+ };
13
+ argTypes: {
14
+ checked: {};
15
+ disabled: {};
16
+ color: {};
17
+ label: {
18
+ control: null;
19
+ };
20
+ id: {
21
+ control: null;
22
+ };
23
+ className: {
24
+ control: null;
25
+ };
26
+ name: {
27
+ control: null;
28
+ };
29
+ value: {
30
+ control: null;
31
+ };
32
+ };
33
+ };
34
+ export default checkboxStories;
35
+ export declare const Overview: {
36
+ render: (args: any) => JSX.Element;
37
+ };
38
+ export declare const WithoutLabel: () => JSX.Element;
39
+ export declare const WithLabel: {
40
+ render: () => JSX.Element;
41
+ parameters: {
42
+ docs: {
43
+ description: {
44
+ story: string;
45
+ };
46
+ };
47
+ };
48
+ };
49
+ export declare const DefaultChecked: {
50
+ render: () => JSX.Element;
51
+ parameters: {
52
+ docs: {
53
+ description: {
54
+ story: string;
55
+ };
56
+ };
57
+ };
58
+ };
59
+ export declare const Disabled: {
60
+ render: () => JSX.Element;
61
+ parameters: {
62
+ docs: {
63
+ description: {
64
+ story: string;
65
+ };
66
+ };
67
+ };
68
+ };
69
+ export declare const Colors: {
70
+ render: () => JSX.Element;
71
+ parameters: {
72
+ docs: {
73
+ description: {
74
+ story: string;
75
+ };
76
+ };
77
+ };
78
+ };
79
+ export declare const UsageGuide: {
80
+ render: () => JSX.Element;
81
+ parameters: {
82
+ docs: {
83
+ source: {
84
+ code: never[];
85
+ };
86
+ };
87
+ };
88
+ };
@@ -1,4 +1,4 @@
1
- export default StyledCheckbox;
2
1
  declare const StyledCheckbox: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLLabelElement> & import("react").LabelHTMLAttributes<HTMLLabelElement> & Record<never, unknown> & {
3
- as?: import("react").ElementType<any> | undefined;
2
+ as?: import("react").ElementType;
4
3
  }>;
4
+ export default StyledCheckbox;
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { cx, noop } from '../../utils';
3
3
  import StyledCheckbox from './Checkbox.styles';
4
4
 
5
- export type CheckboxProps = {
5
+ export interface CheckboxProps {
6
6
  /**
7
7
  * Checkbox id
8
8
  */
@@ -49,15 +49,14 @@ export type CheckboxProps = {
49
49
  /**
50
50
  * Change event
51
51
  */
52
- onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
53
- };
52
+ onChange?: React.ChangeEventHandler<HTMLInputElement>;
53
+ }
54
54
 
55
55
  /**
56
56
  * Renders a checkbox element.
57
57
  *
58
58
  * `✅ Stable`
59
59
  */
60
-
61
60
  const Checkbox: React.FC<CheckboxProps> = ({
62
61
  id = '',
63
62
  className = '',
@@ -93,6 +92,4 @@ const Checkbox: React.FC<CheckboxProps> = ({
93
92
  );
94
93
  };
95
94
 
96
-
97
-
98
95
  export default Checkbox;
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  declare const keysOfSizes: readonly ["initial", ...string[]];
3
3
  type Size = (typeof keysOfSizes)[number];
4
- export type ChipProps = {
4
+ export interface ChipProps {
5
5
  /**
6
6
  * Whether this chip is active or not
7
7
  */
@@ -30,11 +30,11 @@ export type ChipProps = {
30
30
  /**
31
31
  * Element or component to be rendered as
32
32
  */
33
- as?: React.ReactElement | string;
33
+ as?: React.ElementType;
34
34
  /**
35
35
  * Click event
36
36
  */
37
- onClick?: (event: React.MouseEvent<HTMLElement>) => void;
37
+ onClick?: React.MouseEventHandler<HTMLElement>;
38
38
  /**
39
39
  * Chip min-width
40
40
  */
@@ -57,9 +57,10 @@ export type ChipProps = {
57
57
  variant?: 'normal' | 'outline';
58
58
  /**
59
59
  * Toggle to show dropdown icon on the right
60
+ * @default: false
60
61
  */
61
62
  dropdownIcon?: boolean;
62
- };
63
+ }
63
64
  /**
64
65
  * Chip is the atom component to be used as stand-alone Badges, or in patterns like Tag Cloud, Tabs
65
66
  *
@@ -0,0 +1,153 @@
1
+ import React from 'react';
2
+ declare const chipStories: {
3
+ title: string;
4
+ component: React.FC<import("./Chip").ChipProps>;
5
+ tags: string[];
6
+ parameters: {
7
+ docs: {
8
+ description: {
9
+ component: string;
10
+ };
11
+ };
12
+ };
13
+ argTypes: {
14
+ active: {};
15
+ children: {
16
+ control: {
17
+ type: string;
18
+ };
19
+ };
20
+ minWidth: {
21
+ options: string[];
22
+ control: {
23
+ type: string;
24
+ };
25
+ };
26
+ href: {
27
+ control: null;
28
+ };
29
+ as: {
30
+ control: null;
31
+ };
32
+ className: {
33
+ control: null;
34
+ };
35
+ };
36
+ args: {
37
+ children: string;
38
+ };
39
+ };
40
+ export default chipStories;
41
+ export declare const Overview: {
42
+ render: (props: any) => JSX.Element;
43
+ };
44
+ export declare const NormalVariant: {
45
+ render: () => JSX.Element;
46
+ name: string;
47
+ parameters: {
48
+ docs: {
49
+ description: {
50
+ story: string;
51
+ };
52
+ };
53
+ };
54
+ };
55
+ export declare const OutlineVariant: {
56
+ render: () => JSX.Element;
57
+ name: string;
58
+ parameters: {
59
+ docs: {
60
+ description: {
61
+ story: string;
62
+ };
63
+ };
64
+ };
65
+ };
66
+ export declare const DisabledChip: {
67
+ render: () => JSX.Element;
68
+ name: string;
69
+ parameters: {
70
+ docs: {
71
+ description: {
72
+ story: string;
73
+ };
74
+ };
75
+ };
76
+ };
77
+ export declare const WithLeftIcon: {
78
+ render: () => JSX.Element;
79
+ name: string;
80
+ parameters: {
81
+ docs: {
82
+ description: {
83
+ story: string;
84
+ };
85
+ };
86
+ };
87
+ };
88
+ export declare const WithDropdownIcon: {
89
+ render: () => JSX.Element;
90
+ name: string;
91
+ parameters: {
92
+ docs: {
93
+ description: {
94
+ story: string;
95
+ };
96
+ };
97
+ };
98
+ };
99
+ export declare const WithOnClose: {
100
+ render: () => JSX.Element;
101
+ name: string;
102
+ parameters: {
103
+ docs: {
104
+ description: {
105
+ story: string;
106
+ };
107
+ };
108
+ };
109
+ };
110
+ export declare const WithMinWidth: {
111
+ render: () => JSX.Element;
112
+ name: string;
113
+ parameters: {
114
+ docs: {
115
+ description: {
116
+ story: string;
117
+ };
118
+ };
119
+ };
120
+ };
121
+ export declare const WithSize: {
122
+ render: () => JSX.Element;
123
+ name: string;
124
+ parameters: {
125
+ docs: {
126
+ description: {
127
+ story: string;
128
+ };
129
+ };
130
+ };
131
+ };
132
+ export declare const WithAs: {
133
+ render: () => JSX.Element;
134
+ name: string;
135
+ parameters: {
136
+ docs: {
137
+ description: {
138
+ story: string;
139
+ };
140
+ };
141
+ };
142
+ };
143
+ export declare const WithClassName: {
144
+ render: () => JSX.Element;
145
+ name: string;
146
+ parameters: {
147
+ docs: {
148
+ description: {
149
+ story: string;
150
+ };
151
+ };
152
+ };
153
+ };
@@ -35,7 +35,6 @@ const chipStories = {
35
35
  },
36
36
  href: { control: null },
37
37
  as: { control: null },
38
- onClick: { control: null },
39
38
  className: { control: null },
40
39
  },
41
40
  args: {
@@ -58,11 +57,11 @@ const onChipClosed = (value, e) => {
58
57
 
59
58
  export const Overview = {
60
59
  render: (props) => {
61
- const { onClose, dropdownIcon, children, ...rest } = props;
60
+ const { onClose, children, ...rest } = props;
62
61
  return (
63
62
  <>
64
63
  <Chip {...rest}>{children}</Chip>{' '}
65
- <Chip onClose={props.onClose} {...rest}>
64
+ <Chip onClose={onClose} {...rest}>
66
65
  Chip with Close
67
66
  </Chip>{' '}
68
67
  <Chip dropdownIcon {...rest}>
@@ -152,6 +151,8 @@ export const WithLeftIcon = {
152
151
  },
153
152
  };
154
153
 
154
+ const Br = () => <p style={{ display: 'block', content: ' ', height: '10px' }} />;
155
+
155
156
  export const WithDropdownIcon = {
156
157
  render: () => (
157
158
  <div>
@@ -180,8 +181,6 @@ export const WithDropdownIcon = {
180
181
  },
181
182
  };
182
183
 
183
- const Br = () => <p style={{ display: 'block', content: ' ', height: '10px' }} />;
184
-
185
184
  export const WithOnClose = {
186
185
  render: () => (
187
186
  <>
@@ -1,9 +1,12 @@
1
- export const CloseButton: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Record<never, unknown> & {
2
- as?: import("react").ElementType<any> | undefined;
1
+ declare const StyledChip: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & {
2
+ size: string;
3
+ minWidth: string;
4
+ } & {
5
+ as?: import("react").ElementType;
3
6
  }>;
4
- /**
5
- * @type {any}
6
- */
7
- export const StyledChip: any;
8
- export const ChipInterativeCss: import("@linaria/core").LinariaClassName;
9
- export const DisabledChipCss: import("@linaria/core").LinariaClassName;
7
+ declare const ChipInterativeCss: import("@linaria/core").LinariaClassName;
8
+ declare const DisabledChipCss: import("@linaria/core").LinariaClassName;
9
+ declare const CloseButton: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Record<never, unknown> & {
10
+ as?: import("react").ElementType;
11
+ }>;
12
+ export { CloseButton, StyledChip, ChipInterativeCss, DisabledChipCss };
@@ -4,10 +4,10 @@ import theme from '@clad-ui/theme';
4
4
 
5
5
  const { colors, space, fontSizes, radii, sizes, fontWeights } = theme;
6
6
 
7
- /**
8
- * @type {any}
9
- */
10
- const StyledChip = styled.span`
7
+ const StyledChip = styled.span<{
8
+ size: string;
9
+ minWidth: string;
10
+ }>`
11
11
  position: relative;
12
12
  display: inline-flex;
13
13
  justify-content: center;
@@ -8,7 +8,7 @@ const { sizes } = theme;
8
8
  const keysOfSizes = ['initial', ...Object.keys(sizes)] as const;
9
9
  type Size = (typeof keysOfSizes)[number];
10
10
 
11
- export type ChipProps = {
11
+ export interface ChipProps {
12
12
  /**
13
13
  * Whether this chip is active or not
14
14
  */
@@ -37,11 +37,11 @@ export type ChipProps = {
37
37
  /**
38
38
  * Element or component to be rendered as
39
39
  */
40
- as?: React.ReactElement | string;
40
+ as?: React.ElementType;
41
41
  /**
42
42
  * Click event
43
43
  */
44
- onClick?: (event: React.MouseEvent<HTMLElement>) => void;
44
+ onClick?: React.MouseEventHandler<HTMLElement>;
45
45
  /**
46
46
  * Chip min-width
47
47
  */
@@ -64,9 +64,10 @@ export type ChipProps = {
64
64
  variant?: 'normal' | 'outline';
65
65
  /**
66
66
  * Toggle to show dropdown icon on the right
67
+ * @default: false
67
68
  */
68
69
  dropdownIcon?: boolean;
69
- };
70
+ }
70
71
 
71
72
  /**
72
73
  * Chip is the atom component to be used as stand-alone Badges, or in patterns like Tag Cloud, Tabs
@@ -82,34 +83,40 @@ const Chip: React.FC<ChipProps> = ({
82
83
  href = null,
83
84
  children,
84
85
  as = 'a',
85
- onClick,
86
+ onClick = () => {},
86
87
  minWidth = 'initial',
87
88
  onClose,
88
89
  disabled = false,
89
90
  icon,
90
91
  variant = 'normal',
91
- dropdownIcon,
92
+ dropdownIcon = false,
92
93
  }) => {
93
94
  const chipClasses = cx(
94
95
  active && 'active',
95
- className,
96
96
  typeof onClose !== 'function' && !disabled && ChipInterativeCss,
97
97
  disabled && DisabledChipCss,
98
98
  `size-${size}`,
99
99
  `variant-${variant}`,
100
100
  icon && 'p-right',
101
- dropdownIcon && 'p-left'
101
+ dropdownIcon && 'p-left',
102
+ className
102
103
  );
103
104
  const chipMinWidth = sizes[minWidth] || 'initial';
104
105
  const attrs = {
105
106
  href,
106
- onClick: !disabled && onClick,
107
- as,
108
- type: as === 'button' && 'button',
107
+ onClick: !disabled ? onClick : undefined,
108
+ type: as === 'button' ? 'button' : undefined,
109
+ size,
109
110
  };
110
111
 
111
112
  return (
112
- <StyledChip {...attrs} className={chipClasses} minWidth={chipMinWidth} value={value}>
113
+ <StyledChip
114
+ {...attrs}
115
+ as={as}
116
+ className={chipClasses}
117
+ minWidth={chipMinWidth}
118
+ data-value={typeof value === 'string' ? value : value?.text}
119
+ >
113
120
  {icon ? icon : null}
114
121
  {children}
115
122
  {typeof onClose === 'function' && !disabled && !dropdownIcon && (
@@ -1,63 +1,10 @@
1
1
  import * as React from 'react';
2
- declare const keysOfSizes: readonly string[];
3
- type Size = (typeof keysOfSizes)[number];
4
- export type CurrencyInputProps = {
5
- /**
6
- * Input name
7
- */
8
- name?: string;
9
- /**
10
- * Input label
11
- */
12
- label?: string;
13
- /**
14
- * Input ref (implement with useRef() hooks)
15
- */
16
- inputRef?: React.MutableRefObject<any> | React.RefCallback<HTMLInputElement>;
17
- /**
18
- * The input content value
19
- */
20
- value?: number | string;
21
- /**
22
- * Callback when user input. Return event value with numeric value in string. eg: 1200.25
23
- */
24
- onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
2
+ import { type InputProps } from '../Input/Input';
3
+ export interface CurrencyInputProps extends InputProps {
25
4
  /**
26
5
  * Callback when user input. Return formatted value. eg: 1.200,25
27
6
  */
28
7
  onFormatChange?: (value: string) => void;
29
- /**
30
- * Callback when user blur
31
- */
32
- onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
33
- /**
34
- * Callback when user focus
35
- */
36
- onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
37
- /**
38
- * Disabled input
39
- */
40
- disabled?: boolean;
41
- /**
42
- * Whether this input is required or not
43
- */
44
- required?: boolean;
45
- /**
46
- * The id of input
47
- */
48
- id?: string;
49
- /**
50
- * Input status (useful when implemented with form validation)
51
- */
52
- status?: 'default' | 'error';
53
- /**
54
- * Promp a helptext below input (useful when implemented with form validation)
55
- */
56
- helptext?: string;
57
- /**
58
- * Input width
59
- */
60
- width?: Size;
61
8
  /**
62
9
  * Suffix. eg: đ, $ or £,...
63
10
  */
@@ -82,7 +29,7 @@ export type CurrencyInputProps = {
82
29
  * Allow negative value
83
30
  */
84
31
  allowNegativeValue?: boolean;
85
- };
32
+ }
86
33
  /**
87
34
  * CurrencyInput component allows users to input money amount with numeric keyboard,
88
35
  * automatic thousand separators, currency indicator