@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
@@ -0,0 +1,226 @@
1
+ import React from 'react';
2
+ declare const inputStories: {
3
+ title: string;
4
+ component: React.FC<import("./Input").InputProps>;
5
+ tags: string[];
6
+ parameters: {
7
+ docs: {
8
+ description: {
9
+ component: string;
10
+ };
11
+ };
12
+ };
13
+ argTypes: {
14
+ width: {
15
+ options: string[];
16
+ control: {
17
+ type: string;
18
+ };
19
+ };
20
+ type: {};
21
+ disabled: {};
22
+ required: {};
23
+ allowClear: {};
24
+ status: {};
25
+ showPassword: {};
26
+ tooltip: {};
27
+ i18n: {};
28
+ inputMode: {};
29
+ id: {
30
+ control: null;
31
+ };
32
+ name: {
33
+ control: null;
34
+ };
35
+ value: {
36
+ control: null;
37
+ };
38
+ onChange: {
39
+ control: null;
40
+ };
41
+ onBlur: {
42
+ control: null;
43
+ };
44
+ onFocus: {
45
+ control: null;
46
+ };
47
+ inputRef: {
48
+ control: null;
49
+ };
50
+ characterLimit: {
51
+ control: {
52
+ type: string;
53
+ min: number;
54
+ };
55
+ };
56
+ };
57
+ args: {
58
+ label: string;
59
+ helptext: string;
60
+ };
61
+ };
62
+ export default inputStories;
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 WithHelptext: {
77
+ render: () => JSX.Element;
78
+ parameters: {
79
+ docs: {
80
+ description: {
81
+ story: string;
82
+ };
83
+ };
84
+ };
85
+ };
86
+ export declare const WithIcon: {
87
+ render: () => JSX.Element;
88
+ parameters: {
89
+ docs: {
90
+ description: {
91
+ story: string;
92
+ };
93
+ };
94
+ };
95
+ };
96
+ export declare const NoLabel: {
97
+ render: () => JSX.Element;
98
+ parameters: {
99
+ docs: {
100
+ description: {
101
+ story: string;
102
+ };
103
+ };
104
+ };
105
+ };
106
+ export declare const KeyboardEvent: {
107
+ render: () => JSX.Element;
108
+ parameters: {
109
+ docs: {
110
+ description: {
111
+ story: string;
112
+ };
113
+ };
114
+ };
115
+ };
116
+ export declare const AllowClear: {
117
+ render: () => JSX.Element;
118
+ parameters: {
119
+ docs: {
120
+ description: {
121
+ story: string;
122
+ };
123
+ };
124
+ };
125
+ };
126
+ export declare const WithTooltip: {
127
+ render: () => JSX.Element;
128
+ parameters: {
129
+ docs: {
130
+ description: {
131
+ story: string;
132
+ };
133
+ };
134
+ };
135
+ };
136
+ export declare const ClearAndTooltip: () => JSX.Element;
137
+ export declare const ShowPassword: {
138
+ render: () => JSX.Element;
139
+ parameters: {
140
+ docs: {
141
+ description: {
142
+ story: string;
143
+ };
144
+ };
145
+ };
146
+ };
147
+ export declare const Required: {
148
+ render: () => JSX.Element;
149
+ parameters: {
150
+ docs: {
151
+ description: {
152
+ story: string;
153
+ };
154
+ };
155
+ };
156
+ };
157
+ export declare const ErrorStatus: {
158
+ render: () => JSX.Element;
159
+ parameters: {
160
+ docs: {
161
+ description: {
162
+ story: string;
163
+ };
164
+ };
165
+ };
166
+ };
167
+ export declare const SuccessStatus: {
168
+ render: () => JSX.Element;
169
+ parameters: {
170
+ docs: {
171
+ description: {
172
+ story: string;
173
+ };
174
+ };
175
+ };
176
+ };
177
+ export declare const Disabled: {
178
+ render: () => JSX.Element;
179
+ parameters: {
180
+ docs: {
181
+ description: {
182
+ story: string;
183
+ };
184
+ };
185
+ };
186
+ };
187
+ export declare const WithCharacterLimit: {
188
+ render: () => JSX.Element;
189
+ name: string;
190
+ parameters: {
191
+ docs: {
192
+ description: {
193
+ story: string;
194
+ };
195
+ };
196
+ };
197
+ };
198
+ export declare const Internationalization: {
199
+ render: () => JSX.Element;
200
+ parameters: {
201
+ docs: {
202
+ description: {
203
+ story: string;
204
+ };
205
+ };
206
+ };
207
+ };
208
+ export declare const MultipleInputs: {
209
+ render: () => JSX.Element;
210
+ name: string;
211
+ };
212
+ export declare const DebounceExample: {
213
+ render: () => JSX.Element;
214
+ name: string;
215
+ };
216
+ export declare const WithPlaceholder: {
217
+ render: () => JSX.Element;
218
+ name: string;
219
+ parameters: {
220
+ docs: {
221
+ description: {
222
+ story: string;
223
+ };
224
+ };
225
+ };
226
+ };
@@ -470,7 +470,7 @@ export const Internationalization = {
470
470
  render: () => {
471
471
  const [value, setValue] = useState('a');
472
472
  return (
473
- <Grid rowCols={[1, 2]} gutterx="sm">
473
+ <Grid rowCols={[1, 2]} gutterx="sm" guttery="sm">
474
474
  <Col>
475
475
  <Input
476
476
  label="Vietnamese (Default)"
@@ -535,7 +535,7 @@ export const Internationalization = {
535
535
 
536
536
  export const MultipleInputs = {
537
537
  render: () => {
538
- const [inputs, setInputs] = useState({});
538
+ const [inputs, setInputs] = useState<{ number?: string; password?: string }>({});
539
539
  const handleForm = (e) => {
540
540
  e.preventDefault();
541
541
  // eslint-disable-next-line no-alert
@@ -549,20 +549,24 @@ export const MultipleInputs = {
549
549
  <Grid rowCols={[1, 2]}>
550
550
  <Col>
551
551
  <form className={formClass} onSubmit={handleForm}>
552
- <Input
553
- name="number"
554
- type="tel"
555
- label="Phone Number"
556
- onChange={onInputChange}
557
- value={inputs?.number}
558
- />
559
- <Input
560
- name="password"
561
- type="password"
562
- label="Password"
563
- onChange={onInputChange}
564
- value={inputs?.password}
565
- />
552
+ <span style={{ marginBottom: '16px' }}>
553
+ <Input
554
+ name="number"
555
+ type="tel"
556
+ label="Phone Number"
557
+ onChange={onInputChange}
558
+ value={inputs?.number}
559
+ />
560
+ </span>
561
+ <span style={{ marginBottom: '16px' }}>
562
+ <Input
563
+ name="password"
564
+ type="password"
565
+ label="Password"
566
+ onChange={onInputChange}
567
+ value={inputs?.password}
568
+ />
569
+ </span>
566
570
  <Button type="submit" stretch disabled={!(inputs?.number && inputs?.password)}>
567
571
  Submit
568
572
  </Button>
@@ -1,24 +1,35 @@
1
- export default inputClasses;
2
1
  declare const inputClasses: import("@linaria/core").LinariaClassName;
3
- export const inputFocusClasses: import("@linaria/core").LinariaClassName;
2
+ export default inputClasses;
3
+ declare const inputFocusClasses: import("@linaria/core").LinariaClassName;
4
4
  /**
5
5
  * @type {React.FC<any>}
6
6
  */
7
- export const InputWrapper: React.FC<any>;
8
- export const Paragraph: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLParagraphElement> & import("react").HTMLAttributes<HTMLParagraphElement> & Record<never, unknown> & {
9
- as?: import("react").ElementType<any> | undefined;
7
+ declare const Container: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
8
+ containerWidth: string;
9
+ } & {
10
+ as?: import("react").ElementType;
11
+ }>;
12
+ declare const Paragraph: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLParagraphElement> & import("react").HTMLAttributes<HTMLParagraphElement> & Record<never, unknown> & {
13
+ as?: import("react").ElementType;
10
14
  }>;
11
15
  /**
12
16
  * @type {React.FC<any>}
13
17
  */
14
- export const Container: React.FC<any>;
18
+ declare const InputWrapper: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
19
+ paddingRight?: number;
20
+ } & {
21
+ as?: import("react").ElementType;
22
+ }>;
15
23
  /**
16
24
  * @type {any}
17
25
  */
18
- export const TooltipWrapper: any;
19
- export const VadidationIcon: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
20
- as?: import("react").ElementType<any> | undefined;
26
+ declare const TooltipWrapper: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
27
+ as?: import("react").ElementType;
28
+ }>;
29
+ declare const VadidationIcon: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
30
+ as?: import("react").ElementType;
21
31
  }>;
22
- export const LeftIcon: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
23
- as?: import("react").ElementType<any> | undefined;
32
+ declare const LeftIcon: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
33
+ as?: import("react").ElementType;
24
34
  }>;
35
+ export { inputFocusClasses, InputWrapper, Paragraph, Container, TooltipWrapper, VadidationIcon, LeftIcon, };
@@ -43,6 +43,7 @@ const inputClasses = css`
43
43
  &:disabled {
44
44
  background-color: ${colors.backgroundSecondary};
45
45
  cursor: default;
46
+ color: ${colors.textTertiary};
46
47
  }
47
48
 
48
49
  &.noLabel {
@@ -59,8 +60,9 @@ const inputClasses = css`
59
60
  &.hasPlaceholder + label,
60
61
  &.hasValue + label,
61
62
  &:-webkit-autofill + label {
62
- transform: scale(0.7143) translateY(-10px);
63
+ transform: scale(0.7857) translateY(-10px);
63
64
  font-weight: ${fontWeights.bold};
65
+ color: ${colors.textPrimary};
64
66
  }
65
67
 
66
68
  &.showRightIcon {
@@ -72,7 +74,7 @@ export default inputClasses;
72
74
 
73
75
  const inputFocusClasses = css`
74
76
  &:focus + label {
75
- transform: scale(0.7143) translateY(-10px);
77
+ transform: scale(0.7857) translateY(-10px);
76
78
  font-weight: ${fontWeights.bold};
77
79
  }
78
80
  `;
@@ -80,12 +82,14 @@ const inputFocusClasses = css`
80
82
  /**
81
83
  * @type {React.FC<any>}
82
84
  */
83
- const Container = styled.div`
85
+ const Container = styled.div<{
86
+ containerWidth: string;
87
+ }>`
84
88
  width: ${({ containerWidth }) => containerWidth};
85
89
  `;
86
90
 
87
91
  const Paragraph = styled.p`
88
- color: ${colors.textTertiary};
92
+ color: ${colors.textSecondary};
89
93
  font-size: ${fontSizes.xxs};
90
94
  min-height: ${sizes.xxs};
91
95
  margin-left: ${space.sm};
@@ -96,7 +100,9 @@ const Paragraph = styled.p`
96
100
  /**
97
101
  * @type {React.FC<any>}
98
102
  */
99
- const InputWrapper = styled.div`
103
+ const InputWrapper = styled.div<{
104
+ paddingRight?: number;
105
+ }>`
100
106
  width: ${sizes.full};
101
107
  height: ${sizes.xl};
102
108
  position: relative;
@@ -111,6 +117,18 @@ const InputWrapper = styled.div`
111
117
 
112
118
  &:focus-within {
113
119
  border-color: ${colors.borderBrand};
120
+
121
+ &:not(.error) > label {
122
+ color: ${colors.textBrand};
123
+ }
124
+
125
+ & > label {
126
+ color: ${colors.textPrimary};
127
+ }
128
+ }
129
+
130
+ &.error > label {
131
+ color: ${colors.textError};
114
132
  }
115
133
 
116
134
  &.error {
@@ -125,17 +143,21 @@ const InputWrapper = styled.div`
125
143
  border-color: ${colors.backgroundSecondary};
126
144
  background-color: ${colors.backgroundSecondary};
127
145
  border: ${borderWidths.sm} ${borderStyles.solid} ${colors.borderRegular};
146
+
147
+ & > label {
148
+ color: ${colors.textTertiary};
149
+ }
128
150
  }
129
151
 
130
152
  & > label {
131
153
  position: absolute;
132
- top: 13px;
154
+ top: 11px;
133
155
  left: ${space.sm};
134
156
  cursor: text;
135
157
  pointer-events: none;
136
158
  transform-origin: top left;
137
159
  transition: transform 0.1s ease;
138
- color: ${colors.textTertiary};
160
+ color: ${colors.textSecondary};
139
161
  font-size: ${fontSizes.sm};
140
162
  }
141
163
 
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
- import theme from '@clad-ui/theme';
2
+ import theme, { type Sizes } from '@clad-ui/theme';
3
3
  import { cx, noop } from '../../utils';
4
4
  import simulateChangeEvent from '../../utils/_simulateChangeEvent';
5
- import InfoFilled from '../../icons/InfoFilled';
5
+ import Info from '../../icons/Info';
6
6
  import inputClasses, {
7
7
  Container,
8
8
  inputFocusClasses,
@@ -11,15 +11,11 @@ import inputClasses, {
11
11
  TooltipWrapper,
12
12
  VadidationIcon,
13
13
  LeftIcon,
14
- } from './Input.styles.js';
14
+ } from './Input.styles';
15
15
  import ShapeIcon from '../ShapeIcon/ShapeIcon';
16
16
  import { CircleCheckFilled, CloseFilled, WarningFilled } from '../../icons';
17
17
 
18
- const keysOfSizes = [...Object.keys(theme.sizes)] as const;
19
-
20
- type Size = (typeof keysOfSizes)[number];
21
-
22
- export type InputProps = {
18
+ export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
23
19
  /**
24
20
  * Input name
25
21
  */
@@ -43,23 +39,23 @@ export type InputProps = {
43
39
  /**
44
40
  * Callback when user input
45
41
  */
46
- onChange?: React.ChangeEventHandler;
42
+ onChange?: React.ChangeEventHandler<HTMLInputElement>;
47
43
  /**
48
44
  * Callback when user blur
49
45
  */
50
- onBlur?: React.FocusEventHandler;
46
+ onBlur?: React.FocusEventHandler<HTMLInputElement>;
51
47
  /**
52
48
  * Callback when keydown
53
49
  */
54
- onKeyDown?: React.KeyboardEventHandler;
50
+ onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
55
51
  /**
56
52
  * Callback when keyup
57
53
  */
58
- onKeyUp?: React.KeyboardEventHandler;
54
+ onKeyUp?: React.KeyboardEventHandler<HTMLInputElement>;
59
55
  /**
60
56
  * Callback when user focus
61
57
  */
62
- onFocus?: React.FocusEventHandler;
58
+ onFocus?: React.FocusEventHandler<HTMLInputElement>;
63
59
  /**
64
60
  * Disabled input
65
61
  */
@@ -74,6 +70,7 @@ export type InputProps = {
74
70
  id?: string;
75
71
  /**
76
72
  * If allow to remove input content with clear icon
73
+ * @default true
77
74
  */
78
75
  allowClear?: boolean;
79
76
  /**
@@ -84,6 +81,10 @@ export type InputProps = {
84
81
  * Promp a helptext below input (useful when implemented with form validation)
85
82
  */
86
83
  helptext?: string;
84
+ /**
85
+ * Custom helptext
86
+ */
87
+ helptextClassName?: string;
87
88
  /**
88
89
  * Show entered password
89
90
  */
@@ -106,7 +107,7 @@ export type InputProps = {
106
107
  /**
107
108
  * Input width
108
109
  */
109
- width?: Size;
110
+ width?: Sizes;
110
111
  /**
111
112
  * Maximum number of characters allowed. 0, null and undefined mean no limitation
112
113
  */
@@ -123,7 +124,7 @@ export type InputProps = {
123
124
  * Input placeholder
124
125
  */
125
126
  placeholder?: string;
126
- };
127
+ }
127
128
  const { sizes, colors } = theme;
128
129
 
129
130
  /**
@@ -146,7 +147,7 @@ const Input: React.FC<InputProps> = ({
146
147
  status = 'default',
147
148
  helptext = '',
148
149
  inputRef = null,
149
- allowClear = false,
150
+ allowClear = true,
150
151
  showPassword = false,
151
152
  tooltip = '',
152
153
  i18n = {
@@ -161,6 +162,7 @@ const Input: React.FC<InputProps> = ({
161
162
  showValidationIcon = false,
162
163
  icon,
163
164
  placeholder = '',
165
+ helptextClassName = '',
164
166
  ...props
165
167
  }) => {
166
168
  const { useState, useRef, useEffect } = React;
@@ -334,7 +336,7 @@ const Input: React.FC<InputProps> = ({
334
336
  {!!isWithTooltip && (
335
337
  <TooltipWrapper className={tooltipClassname}>
336
338
  <span ref={tooltipIconRef}>
337
- <InfoFilled width="20px" height="20px" color={colors.iconTertiary} />
339
+ <Info width="20px" height="20px" color={colors.iconTertiary} />
338
340
  </span>
339
341
  <p>{tooltip}</p>
340
342
  </TooltipWrapper>
@@ -346,15 +348,15 @@ const Input: React.FC<InputProps> = ({
346
348
  <ShapeIcon bg="none" color="iconError" size="lg">
347
349
  <WarningFilled />
348
350
  </ShapeIcon>
349
- ) : (status === 'success' ? (
351
+ ) : status === 'success' ? (
350
352
  <ShapeIcon bg="none" color="iconSuccess" size="lg">
351
353
  <CircleCheckFilled />
352
354
  </ShapeIcon>
353
- ) : null)}
355
+ ) : null}
354
356
  </VadidationIcon>
355
357
  ) : null}
356
358
  </InputWrapper>
357
- <Paragraph>{helptext}</Paragraph>
359
+ <Paragraph className={helptextClassName}>{helptext}</Paragraph>
358
360
  </Container>
359
361
  );
360
362
  };
@@ -0,0 +1,44 @@
1
+ import * as React from 'react';
2
+ import { type Placement } from 'react-laag';
3
+ export interface PopoverProps {
4
+ /**
5
+ * The `anchorEl` is used to set the position of the popover.
6
+ */
7
+ anchorEl: React.RefObject<HTMLElement>;
8
+ /**
9
+ * If `true`, the popover is visible.
10
+ * @default false
11
+ */
12
+ open?: boolean;
13
+ /**
14
+ * Callback fired when the popover is outside clicked.
15
+ */
16
+ onOutsideClick?: () => void;
17
+ /**
18
+ * Callback fired when the mouse leaves the popover.
19
+ */
20
+ onOutsideHover?: () => void;
21
+ /**
22
+ * The `placement` of the popover.
23
+ * @default 'top-center'
24
+ */
25
+ placement?: Placement;
26
+ /**
27
+ * If `true`, the popover will be placed in a more visible place.
28
+ * @default false
29
+ */
30
+ autoPlacement?: boolean;
31
+ /**
32
+ * Distance from the anchor element to the popover.
33
+ * @default 0
34
+ */
35
+ offset?: number;
36
+ /**
37
+ * Width of the popover.
38
+ * @default max width of the anchor element
39
+ */
40
+ width?: number;
41
+ children?: React.ReactNode;
42
+ }
43
+ declare const Popover: React.FC<PopoverProps & React.HTMLAttributes<HTMLDivElement>>;
44
+ export default Popover;
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ declare const popoverStories: {
3
+ title: string;
4
+ component: React.FC<import("./Popover").PopoverProps & React.HTMLAttributes<HTMLDivElement>>;
5
+ tags: string[];
6
+ parameters: {
7
+ docs: {
8
+ description: {
9
+ component: string;
10
+ };
11
+ };
12
+ };
13
+ argTypes: {
14
+ placement: {
15
+ options: string[];
16
+ control: {
17
+ type: string;
18
+ };
19
+ defaultValue: string;
20
+ };
21
+ open: {
22
+ control: {
23
+ type: string;
24
+ };
25
+ defaultValue: boolean;
26
+ };
27
+ autoPlacement: {
28
+ control: {
29
+ type: string;
30
+ };
31
+ defaultValue: boolean;
32
+ };
33
+ offset: {
34
+ control: {
35
+ type: string;
36
+ };
37
+ defaultValue: number;
38
+ };
39
+ width: {
40
+ control: {
41
+ type: string;
42
+ };
43
+ defaultValue: number;
44
+ };
45
+ };
46
+ };
47
+ export default popoverStories;
48
+ export declare const ShowOnClick: {
49
+ render: (args: any) => JSX.Element;
50
+ };
51
+ export declare const ShowOnHover: {
52
+ render: (args: any) => JSX.Element;
53
+ };