@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,710 @@
1
+ import React, { useState } from 'react';
2
+ import RowItem, { type RowItemOnChangeEvent } from './RowItem';
3
+ import Col from '../Grid/Col';
4
+ import Grid from '../Grid/Grid';
5
+ import BoyFace from '../../icons/BoyFace';
6
+ import InfoFilled from '../../icons/InfoFilled';
7
+ import Info from '../../icons/Info';
8
+
9
+ import ShapeIcon from '../ShapeIcon/ShapeIcon';
10
+ import * as iconComponents from '../../icons';
11
+
12
+ const iconsNameArr = Object.keys(iconComponents);
13
+ const iconsItemArr = Object.keys(iconComponents).map((iconName) => iconComponents[iconName]);
14
+
15
+ const icons = iconsNameArr.reduce((a, v, index) => ({ ...a, [v]: iconsItemArr[index] }), {});
16
+
17
+ const rowItemStories = {
18
+ title: 'Components/Row Item (List)',
19
+ component: RowItem,
20
+ tags: ['autodocs'],
21
+ parameters: {
22
+ docs: {
23
+ description: {
24
+ component: `Row item component for menus and Popups
25
+
26
+ \`✅ Stable\` [\`🎨 Figma Specs\`](https://www.figma.com/file/sPjl33KoaW0bKVZOmm66iQ/CHOTOT-Design-System?node-id=17176%3A56800&t=kAUFUd513UAFnEne-4)
27
+
28
+ ## How to use
29
+ Row Items are interactive components which are often used as children in menus or Popups[link to popup].
30
+
31
+ There are three main types of Row Item:
32
+
33
+ - Menu items: clickable menus with customizable icon and label and an optional description line
34
+ - Checkboxes: behave like a checkbox with additional \`name\`, \`value\` and \`checked\` props
35
+ - Radio buttons: behave like a radio button with additional \`name\`, \`value\` and \`checked\` props. **A radio button group share a same name.**
36
+ <img src="./row-item-how.png" />
37
+ `,
38
+ },
39
+ },
40
+ },
41
+ argTypes: {
42
+ children: {
43
+ control: {
44
+ type: 'text',
45
+ },
46
+ },
47
+ icon: {
48
+ options: iconsNameArr,
49
+ mapping: icons,
50
+ control: {
51
+ type: 'select',
52
+ },
53
+ },
54
+ },
55
+ };
56
+
57
+ export default rowItemStories;
58
+
59
+ export const Overview = {
60
+ render: (args) => (
61
+ <Grid rowCols={[1, 3]}>
62
+ <Col>
63
+ <RowItem type="list" {...args}>
64
+ {args.children}
65
+ </RowItem>
66
+ <RowItem type="list" {...args}>
67
+ {args.children}
68
+ </RowItem>
69
+ </Col>
70
+ </Grid>
71
+ ),
72
+ };
73
+
74
+ export const Type = {
75
+ render: () => (
76
+ <Grid rowCols={[1, 3]}>
77
+ <Col>
78
+ <RowItem type="list" value="1">
79
+ List
80
+ </RowItem>
81
+ <RowItem type="radio" value="2">
82
+ Radio
83
+ </RowItem>
84
+ <RowItem type="checkbox" value="3">
85
+ Checkbox
86
+ </RowItem>
87
+ <RowItem type="chevron" value="4">
88
+ Chevron
89
+ </RowItem>
90
+ <RowItem type="accordion" value="5">
91
+ Accordion
92
+ </RowItem>
93
+ </Col>
94
+ </Grid>
95
+ ),
96
+
97
+ parameters: {
98
+ docs: {
99
+ description: {
100
+ story: 'Illustrate the usage of `type` prop.',
101
+ },
102
+ },
103
+ },
104
+ };
105
+
106
+ export const RadioType = {
107
+ render: () => {
108
+ const [event, setEvent] = useState({
109
+ name: '',
110
+ value: null,
111
+ });
112
+
113
+ const [selected, setSelected] = useState({
114
+ value: null,
115
+ checked: null,
116
+ });
117
+
118
+ const onChange = (e) => {
119
+ setSelected(e);
120
+ setEvent({
121
+ name: 'RowItem Radio Value',
122
+ value: e.value,
123
+ });
124
+ };
125
+
126
+ return (
127
+ <Grid rowCols={[1, 3]}>
128
+ <Col>
129
+ <RowItem
130
+ type="radio"
131
+ checked={selected.value === '1'}
132
+ name="eventRadio"
133
+ value="1"
134
+ onChange={onChange}
135
+ >
136
+ Row content 1
137
+ </RowItem>
138
+ <RowItem
139
+ type="radio"
140
+ checked={selected.value === '2'}
141
+ name="eventRadio"
142
+ value="2"
143
+ onChange={onChange}
144
+ >
145
+ Row content 2
146
+ </RowItem>
147
+ <RowItem
148
+ type="radio"
149
+ checked={selected.value === '3'}
150
+ name="eventRadio"
151
+ value="3"
152
+ onChange={onChange}
153
+ >
154
+ Row content 3
155
+ </RowItem>
156
+ </Col>
157
+ <Col>
158
+ <div>
159
+ <h3>Event name:</h3>
160
+ <div>{event.name}</div>
161
+ <h3>Event Value:</h3>
162
+ <div>{selected.value}</div>
163
+ </div>
164
+ </Col>
165
+ </Grid>
166
+ );
167
+ },
168
+
169
+ parameters: {
170
+ docs: {
171
+ description: {
172
+ story: 'Illustrate the usage of the onClick event with `type="radio"`.',
173
+ },
174
+ },
175
+ },
176
+ };
177
+
178
+ export const CheckboxType = {
179
+ render: () => {
180
+ const [event, setEvent] = useState<{ name: string; value: string[] }>({
181
+ name: '',
182
+ value: [],
183
+ });
184
+ const [selected, setSelected] = useState<string[]>([]);
185
+
186
+ const onChange = (e: RowItemOnChangeEvent) => {
187
+ const { value } = e;
188
+ const tempArr = selected;
189
+ let tempRes: string[] = [];
190
+ if (tempArr.includes(value)) {
191
+ tempRes = tempArr.filter((val) => val !== value);
192
+ setSelected(tempRes);
193
+ } else {
194
+ tempArr.push(value);
195
+ tempRes = [...tempArr];
196
+ setSelected(tempRes);
197
+ }
198
+ setEvent({
199
+ name: 'RowItem Checkbox Value',
200
+ value: tempRes,
201
+ });
202
+ };
203
+
204
+ return (
205
+ <Grid rowCols={[1, 3]}>
206
+ <Col>
207
+ <RowItem
208
+ type="checkbox"
209
+ checked={selected.includes('1')}
210
+ name="eventCheckbox"
211
+ value="1"
212
+ onChange={onChange}
213
+ >
214
+ Row content 1
215
+ </RowItem>
216
+ <RowItem
217
+ type="checkbox"
218
+ checked={selected.includes('2')}
219
+ name="eventCheckbox"
220
+ value="2"
221
+ onChange={onChange}
222
+ >
223
+ Row content 2
224
+ </RowItem>
225
+ <RowItem
226
+ type="checkbox"
227
+ checked={selected.includes('3')}
228
+ name="eventCheckbox"
229
+ value="3"
230
+ onChange={onChange}
231
+ >
232
+ Row content 3
233
+ </RowItem>
234
+ </Col>
235
+ <Col>
236
+ <div>
237
+ <h3>Event name:</h3>
238
+ <div>{event.name}</div>
239
+ <h3>Event Value:</h3>
240
+ <div>{JSON.stringify(selected)}</div>
241
+ </div>
242
+ </Col>
243
+ </Grid>
244
+ );
245
+ },
246
+
247
+ parameters: {
248
+ docs: {
249
+ description: {
250
+ story: 'Illustrate the usage of the onClick event with `type="checkbox"`.',
251
+ },
252
+ },
253
+ },
254
+ };
255
+
256
+ export const Size = {
257
+ render: () => {
258
+ const [selected, setSelected] = useState();
259
+
260
+ const onChange = (e) => {
261
+ setSelected(e.value);
262
+ };
263
+
264
+ return (
265
+ <Grid rowCols={[1, 3]}>
266
+ <Col>
267
+ <RowItem type="radio" size="lg" value="1" checked={selected === '1'} onChange={onChange}>
268
+ Large
269
+ </RowItem>
270
+ <RowItem type="radio" size="md" value="2" checked={selected === '2'} onChange={onChange}>
271
+ Medium
272
+ </RowItem>
273
+ <RowItem type="radio" size="sm" value="3" checked={selected === '3'} onChange={onChange}>
274
+ Small
275
+ </RowItem>
276
+ </Col>
277
+ </Grid>
278
+ );
279
+ },
280
+
281
+ parameters: {
282
+ docs: {
283
+ description: {
284
+ story: 'Illustrate the usage of `size` prop.',
285
+ },
286
+ },
287
+ },
288
+ };
289
+
290
+ export const Inverted = {
291
+ render: () => {
292
+ const [selected, setSelected] = useState<string[]>([]);
293
+ const onChange = (e: RowItemOnChangeEvent) => {
294
+ const { value } = e;
295
+ const tempArr = selected;
296
+ let tempRes: string[] = [];
297
+ if (tempArr.includes(value)) {
298
+ tempRes = tempArr.filter((val) => val !== value);
299
+ setSelected(tempRes);
300
+ } else {
301
+ tempArr.push(value);
302
+ tempRes = [...tempArr];
303
+ setSelected(tempRes);
304
+ }
305
+ };
306
+ const ImageIcon = () => (
307
+ <svg
308
+ width="24"
309
+ height="24"
310
+ viewBox="0 0 24 24"
311
+ fill="none"
312
+ xmlns="http://www.w3.org/2000/svg"
313
+ >
314
+ <path
315
+ fillRule="evenodd"
316
+ clipRule="evenodd"
317
+ d="M3.75078 5.20078C3.72317 5.20078 3.70078 5.22317 3.70078 5.25078V18.7508C3.70078 18.7784 3.72317 18.8008 3.75078 18.8008H20.2508C20.2784 18.8008 20.3008 18.7784 20.3008 18.7508V5.25078C20.3008 5.22317 20.2784 5.20078 20.2508 5.20078H3.75078ZM2.30078 5.25078C2.30078 4.44997 2.94997 3.80078 3.75078 3.80078H20.2508C21.0516 3.80078 21.7008 4.44997 21.7008 5.25078V18.7508C21.7008 19.5516 21.0516 20.2008 20.2508 20.2008H3.75078C2.94997 20.2008 2.30078 19.5516 2.30078 18.7508V5.25078Z"
318
+ fill="#222222"
319
+ />
320
+ <path
321
+ fillRule="evenodd"
322
+ clipRule="evenodd"
323
+ d="M8.25078 11.5133C8.24415 11.5133 8.23759 11.5146 8.23147 11.5172C8.22535 11.5197 8.21981 11.5235 8.21516 11.5282L8.2114 11.532L3.49576 16.2476C3.22239 16.521 2.77917 16.521 2.50581 16.2476C2.23244 15.9743 2.23244 15.531 2.50581 15.2577L7.21982 10.5437C7.35429 10.4077 7.51435 10.2997 7.69077 10.2258C7.86813 10.1515 8.0585 10.1133 8.25078 10.1133C8.44307 10.1133 8.63343 10.1515 8.8108 10.2258C8.98722 10.2997 9.14727 10.4077 9.28175 10.5437L13.4652 14.7271C13.4698 14.7318 13.4754 14.7356 13.4815 14.7381C13.4876 14.7407 13.4942 14.742 13.5008 14.742C13.5074 14.742 13.514 14.7407 13.5201 14.7381C13.5262 14.7356 13.5318 14.7318 13.5364 14.7271L13.5402 14.7233L15.4698 12.7937C15.6043 12.6577 15.7643 12.5497 15.9408 12.4758C16.1181 12.4015 16.3085 12.3633 16.5008 12.3633C16.6931 12.3633 16.8834 12.4015 17.0608 12.4758C17.2372 12.5497 17.3973 12.6577 17.5318 12.7937C17.5325 12.7944 17.5332 12.7951 17.5339 12.7959L21.4958 16.7577C21.7691 17.031 21.7691 17.4743 21.4958 17.7476C21.2224 18.021 20.7792 18.021 20.5058 17.7476L16.5364 13.7782C16.5317 13.7735 16.5262 13.7697 16.5201 13.7672C16.514 13.7646 16.5074 13.7633 16.5008 13.7633C16.4942 13.7633 16.4876 13.7646 16.4815 13.7672C16.4754 13.7697 16.4698 13.7735 16.4652 13.7782L16.4614 13.782L14.5318 15.7116C14.3973 15.8476 14.2372 15.9556 14.0608 16.0295C13.8834 16.1038 13.6931 16.142 13.5008 16.142C13.3085 16.142 13.1181 16.1038 12.9408 16.0295C12.7643 15.9556 12.6043 15.8476 12.4698 15.7116L8.28639 11.5282C8.28174 11.5235 8.27621 11.5197 8.27009 11.5172C8.26398 11.5146 8.25741 11.5133 8.25078 11.5133Z"
324
+ fill="#222222"
325
+ />
326
+ <path
327
+ d="M14.625 10.5C15.2463 10.5 15.75 9.99632 15.75 9.375C15.75 8.75368 15.2463 8.25 14.625 8.25C14.0037 8.25 13.5 8.75368 13.5 9.375C13.5 9.99632 14.0037 10.5 14.625 10.5Z"
328
+ fill="#222222"
329
+ />
330
+ </svg>
331
+ );
332
+
333
+ return (
334
+ <Grid rowCols={[1, 3]}>
335
+ <Col>
336
+ <RowItem
337
+ type="checkbox"
338
+ icon={<ImageIcon />}
339
+ name="eventIcon"
340
+ value="1"
341
+ checked={selected.includes('1')}
342
+ onChange={onChange}
343
+ description="This is a field description. Use when field requires more explanation. "
344
+ >
345
+ Action on the right
346
+ </RowItem>
347
+
348
+ <RowItem
349
+ type="checkbox"
350
+ icon={<ImageIcon />}
351
+ name="eventIcon"
352
+ value="2"
353
+ onChange={onChange}
354
+ checked={selected.includes('2')}
355
+ inverted
356
+ description="This is a field description. Use when field requires more explanation. "
357
+ >
358
+ Action on the left
359
+ </RowItem>
360
+ </Col>
361
+ </Grid>
362
+ );
363
+ },
364
+
365
+ parameters: {
366
+ docs: {
367
+ description: {
368
+ story: 'Illustrate the usage of `inveted` prop.',
369
+ },
370
+ },
371
+ },
372
+ };
373
+
374
+ export const Icon = {
375
+ render: () => {
376
+ const [selected, setSelected] = useState();
377
+
378
+ const onChange = (e) => {
379
+ setSelected(e.value);
380
+ };
381
+ const ImageIcon = () => (
382
+ <svg
383
+ width="24"
384
+ height="24"
385
+ viewBox="0 0 24 24"
386
+ fill="none"
387
+ xmlns="http://www.w3.org/2000/svg"
388
+ >
389
+ <path
390
+ fillRule="evenodd"
391
+ clipRule="evenodd"
392
+ d="M3.75078 5.20078C3.72317 5.20078 3.70078 5.22317 3.70078 5.25078V18.7508C3.70078 18.7784 3.72317 18.8008 3.75078 18.8008H20.2508C20.2784 18.8008 20.3008 18.7784 20.3008 18.7508V5.25078C20.3008 5.22317 20.2784 5.20078 20.2508 5.20078H3.75078ZM2.30078 5.25078C2.30078 4.44997 2.94997 3.80078 3.75078 3.80078H20.2508C21.0516 3.80078 21.7008 4.44997 21.7008 5.25078V18.7508C21.7008 19.5516 21.0516 20.2008 20.2508 20.2008H3.75078C2.94997 20.2008 2.30078 19.5516 2.30078 18.7508V5.25078Z"
393
+ fill="#222222"
394
+ />
395
+ <path
396
+ fillRule="evenodd"
397
+ clipRule="evenodd"
398
+ d="M8.25078 11.5133C8.24415 11.5133 8.23759 11.5146 8.23147 11.5172C8.22535 11.5197 8.21981 11.5235 8.21516 11.5282L8.2114 11.532L3.49576 16.2476C3.22239 16.521 2.77917 16.521 2.50581 16.2476C2.23244 15.9743 2.23244 15.531 2.50581 15.2577L7.21982 10.5437C7.35429 10.4077 7.51435 10.2997 7.69077 10.2258C7.86813 10.1515 8.0585 10.1133 8.25078 10.1133C8.44307 10.1133 8.63343 10.1515 8.8108 10.2258C8.98722 10.2997 9.14727 10.4077 9.28175 10.5437L13.4652 14.7271C13.4698 14.7318 13.4754 14.7356 13.4815 14.7381C13.4876 14.7407 13.4942 14.742 13.5008 14.742C13.5074 14.742 13.514 14.7407 13.5201 14.7381C13.5262 14.7356 13.5318 14.7318 13.5364 14.7271L13.5402 14.7233L15.4698 12.7937C15.6043 12.6577 15.7643 12.5497 15.9408 12.4758C16.1181 12.4015 16.3085 12.3633 16.5008 12.3633C16.6931 12.3633 16.8834 12.4015 17.0608 12.4758C17.2372 12.5497 17.3973 12.6577 17.5318 12.7937C17.5325 12.7944 17.5332 12.7951 17.5339 12.7959L21.4958 16.7577C21.7691 17.031 21.7691 17.4743 21.4958 17.7476C21.2224 18.021 20.7792 18.021 20.5058 17.7476L16.5364 13.7782C16.5317 13.7735 16.5262 13.7697 16.5201 13.7672C16.514 13.7646 16.5074 13.7633 16.5008 13.7633C16.4942 13.7633 16.4876 13.7646 16.4815 13.7672C16.4754 13.7697 16.4698 13.7735 16.4652 13.7782L16.4614 13.782L14.5318 15.7116C14.3973 15.8476 14.2372 15.9556 14.0608 16.0295C13.8834 16.1038 13.6931 16.142 13.5008 16.142C13.3085 16.142 13.1181 16.1038 12.9408 16.0295C12.7643 15.9556 12.6043 15.8476 12.4698 15.7116L8.28639 11.5282C8.28174 11.5235 8.27621 11.5197 8.27009 11.5172C8.26398 11.5146 8.25741 11.5133 8.25078 11.5133Z"
399
+ fill="#222222"
400
+ />
401
+ <path
402
+ d="M14.625 10.5C15.2463 10.5 15.75 9.99632 15.75 9.375C15.75 8.75368 15.2463 8.25 14.625 8.25C14.0037 8.25 13.5 8.75368 13.5 9.375C13.5 9.99632 14.0037 10.5 14.625 10.5Z"
403
+ fill="#222222"
404
+ />
405
+ </svg>
406
+ );
407
+
408
+ return (
409
+ <Grid rowCols={[1, 3]}>
410
+ <Col>
411
+ <RowItem
412
+ type="radio"
413
+ icon={<ImageIcon />}
414
+ name="eventIcon"
415
+ value="1"
416
+ checked={selected === '1'}
417
+ onChange={onChange}
418
+ >
419
+ With icon
420
+ </RowItem>
421
+ <RowItem
422
+ type="radio"
423
+ icon={
424
+ <ShapeIcon bg="backgroundInverted" color="white" radius="sm" size="md">
425
+ <BoyFace />
426
+ </ShapeIcon>
427
+ }
428
+ value="2"
429
+ checked={selected === '2'}
430
+ onChange={onChange}
431
+ >
432
+ With icon
433
+ </RowItem>
434
+ <RowItem
435
+ type="radio"
436
+ name="eventIcon"
437
+ value="3"
438
+ checked={selected === '3'}
439
+ onChange={onChange}
440
+ >
441
+ Without icon
442
+ </RowItem>
443
+ </Col>
444
+ </Grid>
445
+ );
446
+ },
447
+
448
+ parameters: {
449
+ docs: {
450
+ description: {
451
+ story: 'Illustrate the usage of `icon` prop.',
452
+ },
453
+ },
454
+ },
455
+ };
456
+
457
+ export const Description = {
458
+ render: () => {
459
+ const [selected, setSelected] = useState<string[]>([]);
460
+ const onChange = (e: RowItemOnChangeEvent) => {
461
+ const { value } = e;
462
+ const tempArr = selected;
463
+ let tempRes: string[] = [];
464
+ if (tempArr.includes(value)) {
465
+ tempRes = tempArr.filter((val) => val !== value);
466
+ setSelected(tempRes);
467
+ } else {
468
+ tempArr.push(value);
469
+ tempRes = [...tempArr];
470
+ setSelected(tempRes);
471
+ }
472
+ };
473
+ return (
474
+ <Grid rowCols={[1, 3]}>
475
+ <Col>
476
+ <RowItem
477
+ type="checkbox"
478
+ name="eventIcon"
479
+ value="1"
480
+ checked={selected.includes('1')}
481
+ onChange={onChange}
482
+ >
483
+ Without description
484
+ </RowItem>
485
+
486
+ <RowItem
487
+ type="checkbox"
488
+ name="eventIcon"
489
+ value="2"
490
+ checked={selected.includes('2')}
491
+ onChange={onChange}
492
+ description="This is a field description. Use when field requires more explanation. "
493
+ >
494
+ With icon description and description
495
+ </RowItem>
496
+ </Col>
497
+ </Grid>
498
+ );
499
+ },
500
+
501
+ parameters: {
502
+ docs: {
503
+ description: {
504
+ story: 'Illustrate the usage of `icon` prop.',
505
+ },
506
+ },
507
+ },
508
+ };
509
+
510
+ export const OnClickEvent = {
511
+ render: () => {
512
+ const [event, setEvent] = useState({
513
+ name: '',
514
+ value: null,
515
+ });
516
+
517
+ const onClick = (e) => {
518
+ e.persist();
519
+ setEvent({
520
+ name: 'Icon RowItem on click',
521
+ value: e.target.outerHTML,
522
+ });
523
+ };
524
+ const ImageIcon = () => (
525
+ <svg
526
+ width="24"
527
+ height="24"
528
+ viewBox="0 0 24 24"
529
+ fill="none"
530
+ xmlns="http://www.w3.org/2000/svg"
531
+ >
532
+ <path
533
+ fillRule="evenodd"
534
+ clipRule="evenodd"
535
+ d="M3.75078 5.20078C3.72317 5.20078 3.70078 5.22317 3.70078 5.25078V18.7508C3.70078 18.7784 3.72317 18.8008 3.75078 18.8008H20.2508C20.2784 18.8008 20.3008 18.7784 20.3008 18.7508V5.25078C20.3008 5.22317 20.2784 5.20078 20.2508 5.20078H3.75078ZM2.30078 5.25078C2.30078 4.44997 2.94997 3.80078 3.75078 3.80078H20.2508C21.0516 3.80078 21.7008 4.44997 21.7008 5.25078V18.7508C21.7008 19.5516 21.0516 20.2008 20.2508 20.2008H3.75078C2.94997 20.2008 2.30078 19.5516 2.30078 18.7508V5.25078Z"
536
+ fill="#222222"
537
+ />
538
+ <path
539
+ fillRule="evenodd"
540
+ clipRule="evenodd"
541
+ d="M8.25078 11.5133C8.24415 11.5133 8.23759 11.5146 8.23147 11.5172C8.22535 11.5197 8.21981 11.5235 8.21516 11.5282L8.2114 11.532L3.49576 16.2476C3.22239 16.521 2.77917 16.521 2.50581 16.2476C2.23244 15.9743 2.23244 15.531 2.50581 15.2577L7.21982 10.5437C7.35429 10.4077 7.51435 10.2997 7.69077 10.2258C7.86813 10.1515 8.0585 10.1133 8.25078 10.1133C8.44307 10.1133 8.63343 10.1515 8.8108 10.2258C8.98722 10.2997 9.14727 10.4077 9.28175 10.5437L13.4652 14.7271C13.4698 14.7318 13.4754 14.7356 13.4815 14.7381C13.4876 14.7407 13.4942 14.742 13.5008 14.742C13.5074 14.742 13.514 14.7407 13.5201 14.7381C13.5262 14.7356 13.5318 14.7318 13.5364 14.7271L13.5402 14.7233L15.4698 12.7937C15.6043 12.6577 15.7643 12.5497 15.9408 12.4758C16.1181 12.4015 16.3085 12.3633 16.5008 12.3633C16.6931 12.3633 16.8834 12.4015 17.0608 12.4758C17.2372 12.5497 17.3973 12.6577 17.5318 12.7937C17.5325 12.7944 17.5332 12.7951 17.5339 12.7959L21.4958 16.7577C21.7691 17.031 21.7691 17.4743 21.4958 17.7476C21.2224 18.021 20.7792 18.021 20.5058 17.7476L16.5364 13.7782C16.5317 13.7735 16.5262 13.7697 16.5201 13.7672C16.514 13.7646 16.5074 13.7633 16.5008 13.7633C16.4942 13.7633 16.4876 13.7646 16.4815 13.7672C16.4754 13.7697 16.4698 13.7735 16.4652 13.7782L16.4614 13.782L14.5318 15.7116C14.3973 15.8476 14.2372 15.9556 14.0608 16.0295C13.8834 16.1038 13.6931 16.142 13.5008 16.142C13.3085 16.142 13.1181 16.1038 12.9408 16.0295C12.7643 15.9556 12.6043 15.8476 12.4698 15.7116L8.28639 11.5282C8.28174 11.5235 8.27621 11.5197 8.27009 11.5172C8.26398 11.5146 8.25741 11.5133 8.25078 11.5133Z"
542
+ fill="#222222"
543
+ />
544
+ <path
545
+ d="M14.625 10.5C15.2463 10.5 15.75 9.99632 15.75 9.375C15.75 8.75368 15.2463 8.25 14.625 8.25C14.0037 8.25 13.5 8.75368 13.5 9.375C13.5 9.99632 14.0037 10.5 14.625 10.5Z"
546
+ fill="#222222"
547
+ />
548
+ </svg>
549
+ );
550
+
551
+ return (
552
+ <Grid rowCols={[1, 3]}>
553
+ <Col>
554
+ <RowItem type="list" icon={<ImageIcon />} name="eventIcon" value="2" onClick={onClick}>
555
+ Use Svg Icon
556
+ </RowItem>
557
+ <RowItem
558
+ type="list"
559
+ icon={
560
+ <ShapeIcon bg="backgroundInverted" color="white" radius="sm" size="md">
561
+ <BoyFace />
562
+ </ShapeIcon>
563
+ }
564
+ name="eventIcon"
565
+ value="1"
566
+ onClick={onClick}
567
+ >
568
+ Use Shape Icon `size=md`
569
+ </RowItem>
570
+ </Col>
571
+ <Col>
572
+ <div>
573
+ <h3>Event name:</h3>
574
+ <div>{event.name}</div>
575
+ <h3>Event Value:</h3>
576
+ <div>{event.value}</div>
577
+ </div>
578
+ </Col>
579
+ </Grid>
580
+ );
581
+ },
582
+
583
+ parameters: {
584
+ docs: {
585
+ description: {
586
+ story: 'Illustrate the usage of `onClick`.',
587
+ },
588
+ },
589
+ },
590
+ };
591
+
592
+ export const BorderVariants = {
593
+ render: () => (
594
+ <Grid rowCols={[1, 3]}>
595
+ <Col>
596
+ <RowItem
597
+ type="list"
598
+ icon={
599
+ <ShapeIcon bg="positive" color="white" radius="circle" size="md">
600
+ <BoyFace />
601
+ </ShapeIcon>
602
+ }
603
+ name="borderVar"
604
+ value="1"
605
+ >
606
+ Row with border none
607
+ </RowItem>
608
+ <RowItem
609
+ type="list"
610
+ icon={
611
+ <ShapeIcon bg="critical" color="white" radius="circle" size="md">
612
+ <BoyFace />
613
+ </ShapeIcon>
614
+ }
615
+ name="borderVar"
616
+ value="2"
617
+ border="wrap"
618
+ >
619
+ Row with border wrap
620
+ </RowItem>
621
+ <RowItem
622
+ type="list"
623
+ icon={
624
+ <ShapeIcon bg="primary" color="white" radius="circle" size="md">
625
+ <BoyFace />
626
+ </ShapeIcon>
627
+ }
628
+ name="borderVar"
629
+ value="3"
630
+ border="bottom"
631
+ >
632
+ Row with border bottom
633
+ </RowItem>
634
+ </Col>
635
+ </Grid>
636
+ ),
637
+
638
+ parameters: {
639
+ docs: {
640
+ description: {
641
+ story: 'Illustrate the usage of `border` prop.',
642
+ },
643
+ },
644
+ },
645
+ };
646
+
647
+ export const Collapse = {
648
+ render: () => {
649
+ const [isCollapsed, setIsCollapsed] = useState(true);
650
+ const [isCollapsed2, setIsCollapsed2] = useState(false);
651
+
652
+ const handleCollapseChange = (newValue: boolean) => {
653
+ setIsCollapsed(newValue);
654
+ };
655
+ const handleCollapseChange2 = (newValue: boolean) => {
656
+ setIsCollapsed2(newValue);
657
+ };
658
+ return (
659
+ <Grid rowCols={[1, 3]}>
660
+ <Col>
661
+ <RowItem
662
+ isCollapsed={isCollapsed}
663
+ onCollapseChange={handleCollapseChange}
664
+ collapsibleContent={
665
+ <div style={{ padding: '16px' }}>This section contains additional information.</div>
666
+ }
667
+ type="accordion"
668
+ icon={
669
+ <ShapeIcon bg="none" color="textInfo" radius="circle" size="sm">
670
+ <Info width={24} height={24} />
671
+ </ShapeIcon>
672
+ }
673
+ name="borderVar"
674
+ value="1"
675
+ border="wrap"
676
+ >
677
+ Short information
678
+ </RowItem>
679
+ <RowItem
680
+ isCollapsed={isCollapsed2}
681
+ onCollapseChange={handleCollapseChange2}
682
+ collapsibleContent={
683
+ <div style={{ padding: '16px' }}>This section contains additional information.</div>
684
+ }
685
+ border="wrap"
686
+ type="accordion"
687
+ icon={
688
+ <ShapeIcon bg="none" color="textInfo" radius="circle" size="md">
689
+ <InfoFilled width={24} height={24} />
690
+ </ShapeIcon>
691
+ }
692
+ name="borderVar"
693
+ value="1"
694
+ >
695
+ Short information 2
696
+ </RowItem>
697
+ </Col>
698
+ </Grid>
699
+ );
700
+ },
701
+
702
+ parameters: {
703
+ docs: {
704
+ description: {
705
+ story:
706
+ 'Illustrate expand/collapse functionality using `collapsibleContent`, `isCollapsed`, and `onCollapseChange` props.',
707
+ },
708
+ },
709
+ },
710
+ };