@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,177 @@
1
+ import React from 'react';
2
+ import { css } from '@linaria/core';
3
+ import theme from '@clad-ui/theme';
4
+ import Col from '../Grid/Col';
5
+ import Grid from '../Grid/Grid';
6
+ import TextLabel from './TextLabel';
7
+
8
+ const { colors } = theme;
9
+
10
+ const textLabelStory = {
11
+ title: 'Components/TextLabel',
12
+ component: TextLabel,
13
+ tags: ['autodocs'],
14
+ parameters: {
15
+ docs: {
16
+ description: {
17
+ component: `
18
+ \`✅ Stable\` [\`🎨 Figma Specs\`](https://www.figma.com/file/sPjl33KoaW0bKVZOmm66iQ/CHOTOT-Design-System?node-id=17176%3A34882&t=EPNuQtKvlw2DSxrI-4)
19
+
20
+ ## How to use
21
+ - **Use case for type="text"**: Used to communicate promotions, marketing campaigns, or featured content.
22
+ - **Use case for type="status"**: Used to communicate statuses or conditions.
23
+ `,
24
+ },
25
+ },
26
+ },
27
+ args: {
28
+ label: 'Text Label',
29
+ },
30
+ };
31
+
32
+ export default textLabelStory;
33
+
34
+ export const Overview = {
35
+ render: (args) => (
36
+ <Grid rowCols={[1, 3]}>
37
+ <Col>
38
+ <TextLabel {...args} />
39
+ </Col>
40
+ </Grid>
41
+ ),
42
+ };
43
+
44
+ const columnClass = css`
45
+ display: flex;
46
+ flex-direction: column;
47
+ height: fit-content;
48
+ justify-content: space-between;
49
+ flex: 1;
50
+ gap: 1px;
51
+ `;
52
+
53
+ const rowClass = css`
54
+ display: flex;
55
+ flex-direction: row;
56
+ gap: 1px;
57
+ justify-content: space-between;
58
+ background: ${colors.backgroundSecondary};
59
+ flex: 1;
60
+ `;
61
+
62
+ const cellClass = css`
63
+ background: white;
64
+ padding: 8px 0 8px 20px;
65
+ margin: 0;
66
+ line-height: 20px;
67
+ content: '';
68
+ height: 36px;
69
+ `;
70
+
71
+ export const TypesAndColors = {
72
+ render: () => (
73
+ <div className={rowClass}>
74
+ <div className={columnClass}>
75
+ <p className={cellClass} />
76
+ <p className={cellClass}>
77
+ <code>color=&quot;error&quot;</code>
78
+ </p>
79
+ <p className={cellClass}>
80
+ <code>color=&quot;info&quot;</code>
81
+ </p>
82
+ <p className={cellClass}>
83
+ <code>color=&quot;success&quot;</code>
84
+ </p>
85
+ <p className={cellClass}>
86
+ <code>color=&quot;warning&quot;</code>
87
+ </p>
88
+ <p className={cellClass}>
89
+ <code>color=&quot;neutral&quot;</code>
90
+ </p>
91
+ </div>
92
+ <div className={columnClass}>
93
+ <p className={cellClass}>
94
+ <code>type=&quot;status&quot;</code>
95
+ </p>
96
+ <div className={cellClass}>
97
+ <TextLabel label="Text Label" type="status" color="error" />
98
+ </div>
99
+ <div className={cellClass}>
100
+ <TextLabel label="Text Label" type="status" color="info" />
101
+ </div>
102
+ <div className={cellClass}>
103
+ <TextLabel label="Text Label" type="status" color="success" />
104
+ </div>
105
+ <div className={cellClass}>
106
+ <TextLabel label="Text Label" type="status" color="warning" />
107
+ </div>
108
+ <div className={cellClass}>
109
+ <TextLabel label="Text Label" type="status" color="neutral" />
110
+ </div>
111
+ </div>
112
+ <div className={columnClass}>
113
+ <p className={cellClass}>
114
+ <code>type=&quot;text&quot;</code>
115
+ </p>
116
+ <div className={cellClass}>
117
+ <TextLabel label="Text Label" type="text" color="error" />
118
+ </div>
119
+ <div className={cellClass}>
120
+ <TextLabel label="Text Label" type="text" color="info" />
121
+ </div>
122
+ <div className={cellClass}>
123
+ <TextLabel label="Text Label" type="text" color="success" />
124
+ </div>
125
+ <div className={cellClass}>
126
+ <TextLabel label="Text Label" type="text" color="warning" />
127
+ </div>
128
+ <div className={cellClass}>
129
+ <TextLabel label="Text Label" type="text" color="neutral" />
130
+ </div>
131
+ </div>
132
+ </div>
133
+ ),
134
+ parameters: {
135
+ docs: {
136
+ description: {
137
+ story: 'Illustrate the type and color props',
138
+ },
139
+ },
140
+ },
141
+ };
142
+
143
+ export const Sizes = {
144
+ render: () => (
145
+ <Grid>
146
+ <div style={{ flex: 1 }}>
147
+ <div className={cellClass}>
148
+ <code>size=&quot;md&quot;</code>
149
+ </div>
150
+ <div className={cellClass}>
151
+ <TextLabel label="Text Label" type="text" color="info" size="md" />
152
+ </div>
153
+ <div className={cellClass}>
154
+ <TextLabel label="Text Label" type="status" color="info" size="md" />
155
+ </div>
156
+ </div>
157
+ <div style={{ borderLeft: '1px solid #f4f4f4', flex: 1 }}>
158
+ <div className={cellClass}>
159
+ <code>size=&quot;sm&quot;</code>
160
+ </div>
161
+ <div className={cellClass}>
162
+ <TextLabel label="Text Label" type="text" color="info" size="sm" />
163
+ </div>
164
+ <div className={cellClass}>
165
+ <TextLabel label="Text Label" type="status" color="info" size="sm" />
166
+ </div>
167
+ </div>
168
+ </Grid>
169
+ ),
170
+ parameters: {
171
+ docs: {
172
+ description: {
173
+ story: 'Illustrate the size prop',
174
+ },
175
+ },
176
+ },
177
+ };
@@ -0,0 +1,9 @@
1
+ export declare const StyledTextLabel: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
2
+ type: "text" | "status";
3
+ size: "sm" | "md";
4
+ textColor: string;
5
+ fontSize: string;
6
+ backgroundColor: string;
7
+ } & {
8
+ as?: import("react").ElementType;
9
+ }>;
@@ -0,0 +1,24 @@
1
+ import { styled } from '@linaria/react';
2
+
3
+ import theme from '@clad-ui/theme';
4
+
5
+ const { space, radii } = theme;
6
+
7
+ export const StyledTextLabel = styled.div<{
8
+ type: 'text' | 'status';
9
+ size: 'sm' | 'md';
10
+ textColor: string;
11
+ fontSize: string;
12
+ backgroundColor: string;
13
+ }>`
14
+ width: fit-content;
15
+ background-color: ${({ backgroundColor }) => backgroundColor};
16
+ color: ${({ textColor }) => textColor};
17
+ display: flex;
18
+ flex-direction: row;
19
+ gap: ${space.xxs};
20
+ font-size: ${({ fontSize }) => fontSize};
21
+ line-height: ${({ fontSize }) => fontSize};
22
+ padding: ${space.xxs};
23
+ border-radius: ${radii.sm};
24
+ `;
@@ -0,0 +1,112 @@
1
+ import * as React from 'react';
2
+ import theme from '@clad-ui/theme';
3
+ import { StyledTextLabel } from './TextLabel.styles';
4
+ import InfoFilled from '../../icons/InfoFilled';
5
+ import CircleCheckFilled from '../../icons/CircleCheckFilled';
6
+ import CloseFilled from '../../icons/CloseFilled';
7
+ import WarningFilled from '../../icons/WarningFilled';
8
+
9
+ const { colors, fontSizes } = theme;
10
+ export interface TextLabelProps {
11
+ /**
12
+ * Size of Text Label
13
+ * @default 'md'
14
+ */
15
+ size?: 'md' | 'sm';
16
+ /**
17
+ * Badge Label
18
+ */
19
+ label?: string;
20
+ /**
21
+ * Badge Background Color
22
+ */
23
+ color?: 'info' | 'success' | 'error' | 'warning' | 'neutral';
24
+ /**
25
+ * Types
26
+ */
27
+ type?: 'text' | 'status';
28
+ /**
29
+ * Classname
30
+ */
31
+ className?: string;
32
+ /**
33
+ * Custom icon
34
+ */
35
+ icon?: React.ReactNode;
36
+ }
37
+
38
+ const typeConfig = {
39
+ info: {
40
+ IconComponent: InfoFilled,
41
+ iconColor: colors.iconInfo,
42
+ textColor: colors.textInfo,
43
+ backgroundColor: colors.backgroundInfoLight,
44
+ },
45
+ neutral: {
46
+ IconComponent: InfoFilled,
47
+ iconColor: colors.iconTertiary,
48
+ textColor: colors.textTertiary,
49
+ backgroundColor: colors.backgroundSecondary,
50
+ },
51
+ success: {
52
+ IconComponent: CircleCheckFilled,
53
+ iconColor: colors.iconSuccess,
54
+ textColor: colors.textSuccess,
55
+ backgroundColor: colors.backgroundSuccessLight,
56
+ },
57
+ error: {
58
+ IconComponent: CloseFilled,
59
+ iconColor: colors.iconError,
60
+ textColor: colors.textError,
61
+ backgroundColor: colors.backgroundErrorLight,
62
+ },
63
+ warning: {
64
+ IconComponent: WarningFilled,
65
+ iconColor: colors.iconWarning,
66
+ textColor: colors.textWarning,
67
+ backgroundColor: colors.backgroundWarningLight,
68
+ },
69
+ };
70
+
71
+ /**
72
+ * Text Label Component
73
+ *
74
+ * `✅ Stable`
75
+ */
76
+
77
+ const TextLabel: React.FC<TextLabelProps> = ({
78
+ size = 'md',
79
+ label = '',
80
+ color = 'info',
81
+ type = 'text',
82
+ className = '',
83
+ icon,
84
+ }) => {
85
+
86
+ const typeStyles = React.useMemo(() => {
87
+ const { IconComponent, iconColor, textColor, backgroundColor } = typeConfig[color] || typeConfig.info;
88
+ return {
89
+ icon: <IconComponent color={iconColor} width={12} height={12} />,
90
+ color: type === 'text' ? textColor : colors.textPrimary,
91
+ backgroundColor,
92
+ };
93
+ }, [type, color]);
94
+
95
+ const fontSize = size === 'md' ? fontSizes.xs : fontSizes.xxs;
96
+
97
+ return (
98
+ <StyledTextLabel
99
+ className={className}
100
+ type={type}
101
+ size={size}
102
+ fontSize={fontSize}
103
+ textColor={typeStyles.color}
104
+ backgroundColor={typeStyles.backgroundColor}
105
+ >
106
+ {type === 'status' ? (icon ? icon : typeStyles.icon) : null}
107
+ <span>{label}</span>
108
+ </StyledTextLabel>
109
+ );
110
+ };
111
+
112
+ export default TextLabel;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- export type ToggleSwitchProps = {
2
+ export interface ToggleSwitchProps {
3
3
  /**
4
4
  * Checkbox id
5
5
  */
@@ -32,7 +32,7 @@ export type ToggleSwitchProps = {
32
32
  * Change event
33
33
  */
34
34
  onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
35
- };
35
+ }
36
36
  /**
37
37
  * Renders a checkbox element.
38
38
  *
@@ -0,0 +1,38 @@
1
+ import React from 'react';
2
+ declare const toggleSwitchStory: {
3
+ title: string;
4
+ component: React.FC<import("./ToggleSwitch").ToggleSwitchProps>;
5
+ tags: string[];
6
+ parameters: {
7
+ docs: {
8
+ description: {
9
+ component: string;
10
+ };
11
+ };
12
+ };
13
+ };
14
+ export default toggleSwitchStory;
15
+ export declare const Overview: {
16
+ render: (args: any) => JSX.Element;
17
+ };
18
+ export declare const DisabledToggle: {
19
+ render: () => JSX.Element;
20
+ parameters: {
21
+ docs: {
22
+ description: {
23
+ story: string;
24
+ };
25
+ };
26
+ };
27
+ };
28
+ export declare const GetAndSetCheckedToggle: {
29
+ render: () => JSX.Element;
30
+ parameters: {
31
+ docs: {
32
+ description: {
33
+ story: string;
34
+ };
35
+ };
36
+ };
37
+ };
38
+ export declare const Colors: () => JSX.Element;
@@ -1,14 +1,21 @@
1
- /**
2
- * @type {any}
3
- */
4
- export const ToggleSwitchWrapper: any;
5
- /**
6
- * @type {React.FC<any>}
7
- */
8
- export const StyledToggleSwitchInner: React.FC<any>;
9
- /**
10
- * @type {any}
11
- */
12
- export const StyledToggleSwitchSwitcher: any;
13
- export const ToggleSwitchCheckboxClass: import("@linaria/core").LinariaClassName;
14
- export const ToggleSwitchLabelClass: import("@linaria/core").LinariaClassName;
1
+ export declare const ToggleSwitchWrapper: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
2
+ width: string;
3
+ } & {
4
+ as?: import("react").ElementType;
5
+ }>;
6
+ export declare const StyledToggleSwitchInner: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & {
7
+ height: string;
8
+ color: string;
9
+ } & {
10
+ as?: import("react").ElementType;
11
+ }>;
12
+ export declare const StyledToggleSwitchSwitcher: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & {
13
+ switcher: string;
14
+ margin: string;
15
+ right: string;
16
+ boxShadow: string;
17
+ } & {
18
+ as?: import("react").ElementType;
19
+ }>;
20
+ export declare const ToggleSwitchCheckboxClass: import("@linaria/core").LinariaClassName;
21
+ export declare const ToggleSwitchLabelClass: import("@linaria/core").LinariaClassName;
@@ -4,10 +4,7 @@ import theme from '@clad-ui/theme';
4
4
 
5
5
  const { space, colors, radii } = theme;
6
6
 
7
- /**
8
- * @type {any}
9
- */
10
- export const ToggleSwitchWrapper = styled.div`
7
+ export const ToggleSwitchWrapper = styled.div<{ width: string }>`
11
8
  position: relative;
12
9
  overflow: hidden;
13
10
  width: ${({ width }) => width};
@@ -30,10 +27,7 @@ export const ToggleSwitchWrapper = styled.div`
30
27
  }
31
28
  `;
32
29
 
33
- /**
34
- * @type {React.FC<any>}
35
- */
36
- export const StyledToggleSwitchInner = styled.span`
30
+ export const StyledToggleSwitchInner = styled.span<{ height: string; color: string }>`
37
31
  display: block;
38
32
  width: 200%;
39
33
  margin-left: -100%;
@@ -66,10 +60,12 @@ export const StyledToggleSwitchInner = styled.span`
66
60
  }
67
61
  `;
68
62
 
69
- /**
70
- * @type {any}
71
- */
72
- export const StyledToggleSwitchSwitcher = styled.span`
63
+ export const StyledToggleSwitchSwitcher = styled.span<{
64
+ switcher: string;
65
+ margin: string;
66
+ right: string;
67
+ boxShadow: string;
68
+ }>`
73
69
  display: block;
74
70
  width: ${({ switcher }) => switcher};
75
71
  height: ${({ switcher }) => switcher};
@@ -7,10 +7,11 @@ import {
7
7
  ToggleSwitchLabelClass,
8
8
  StyledToggleSwitchInner,
9
9
  StyledToggleSwitchSwitcher,
10
- } from './ToggleSwitch.styles.js';
10
+ } from './ToggleSwitch.styles';
11
11
 
12
12
  const { space } = theme;
13
- export type ToggleSwitchProps = {
13
+
14
+ export interface ToggleSwitchProps {
14
15
  /**
15
16
  * Checkbox id
16
17
  */
@@ -31,7 +32,14 @@ export type ToggleSwitchProps = {
31
32
  * Change radio buttons active state color
32
33
  */
33
34
  color?:
34
- 'accent' | 'caution' | 'critical' | 'info' | 'neutral' | 'positive' | 'primary' | 'secondary';
35
+ | 'accent'
36
+ | 'caution'
37
+ | 'critical'
38
+ | 'info'
39
+ | 'neutral'
40
+ | 'positive'
41
+ | 'primary'
42
+ | 'secondary';
35
43
  /**
36
44
  * Toggle Size
37
45
  */
@@ -44,7 +52,7 @@ export type ToggleSwitchProps = {
44
52
  * Change event
45
53
  */
46
54
  onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
47
- };
55
+ }
48
56
 
49
57
  /**
50
58
  * Renders a checkbox element.
@@ -107,7 +115,6 @@ const ToggleSwitch: React.FC<ToggleSwitchProps> = ({
107
115
  className={cx(defaultChecked && 'active')}
108
116
  />
109
117
  <StyledToggleSwitchSwitcher
110
- width={sizeResolver().width}
111
118
  switcher={sizeResolver().switcher}
112
119
  margin={sizeResolver().margin}
113
120
  right={sizeResolver().right}
@@ -129,5 +136,4 @@ const ToggleSwitch: React.FC<ToggleSwitchProps> = ({
129
136
  );
130
137
  };
131
138
 
132
-
133
139
  export default ToggleSwitch;
@@ -1,8 +1,8 @@
1
- import React from 'react';
1
+ import * as React from 'react';
2
2
  import { type Durations, type Space } from '@clad-ui/theme';
3
3
  export type TooltipPlacement = 'bottom-center' | 'bottom-end' | 'bottom-start' | 'center' | 'left-center' | 'left-end' | 'left-start' | 'right-center' | 'right-end' | 'right-start' | 'top-center' | 'top-end' | 'top-start';
4
4
  export type TooltipVariant = 'dark' | 'light';
5
- export type TooltipProps = {
5
+ export interface TooltipProps {
6
6
  /**
7
7
  * String or element that the Tooltip wraps
8
8
  */
@@ -17,10 +17,12 @@ export type TooltipProps = {
17
17
  text?: string;
18
18
  /**
19
19
  * Different looks of Tooltip
20
+ * @default dark
20
21
  */
21
22
  variant?: TooltipVariant;
22
23
  /**
23
24
  * Preferred placement of the Tooltip
25
+ * @default bottom-center
24
26
  */
25
27
  placement?: TooltipPlacement;
26
28
  /**
@@ -41,6 +43,7 @@ export type TooltipProps = {
41
43
  arrowOffset?: Space;
42
44
  /**
43
45
  * Distance between Tooltip and trigger
46
+ * @default sm
44
47
  */
45
48
  triggerOffset?: Space;
46
49
  /**
@@ -56,6 +59,7 @@ export type TooltipProps = {
56
59
  zIndex?: number;
57
60
  /**
58
61
  * Time of fade animation (ms)
62
+ * @default xs
59
63
  */
60
64
  fadeDuration?: Durations;
61
65
  /**
@@ -68,13 +72,15 @@ export type TooltipProps = {
68
72
  thumbnail?: string;
69
73
  /**
70
74
  * Have close button or not
75
+ * @default false
71
76
  */
72
77
  haveClose?: boolean;
73
78
  /**
74
79
  * Max width of tooltip
80
+ * @default 280px
75
81
  */
76
82
  maxWidth?: string;
77
- };
83
+ }
78
84
  /**
79
85
  * Tooltip is a common graphical user interface that appears when user hovers a specific text or component to provide information that user needs to be aware of.
80
86
  *
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
- import { render, fireEvent } from '@testing-library/react';
2
+ import { render, fireEvent, waitFor } from '@testing-library/react';
3
3
  import Tooltip from './Tooltip';
4
4
 
5
5
  import '@testing-library/jest-dom';
6
6
 
7
7
  describe('components/Tooltip', () => {
8
- it('without hoverable should be close on outside click', () => {
8
+ it('without hoverable should be close on outside click', async () => {
9
9
  const Component = () => (
10
10
  <>
11
11
  <div>Dummy</div>
@@ -22,6 +22,8 @@ describe('components/Tooltip', () => {
22
22
 
23
23
  fireEvent.click(dummy);
24
24
  fireEvent.animationEnd(tooltip);
25
- expect(tooltip).not.toBeInTheDocument();
25
+ await waitFor(() => {
26
+ expect(tooltip).not.toBeInTheDocument();
27
+ });
26
28
  });
27
29
  });
@@ -1,28 +1,27 @@
1
- /// <reference types="react" />
2
1
  import { type Durations } from '@clad-ui/theme';
3
2
  declare const StyledTooltip: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
4
3
  maxWidth: string;
5
4
  zIndex: number;
6
5
  fadeDuration: Durations;
7
6
  } & {
8
- as?: import("react").ElementType<any> | undefined;
7
+ as?: import("react").ElementType;
9
8
  }>;
10
9
  declare const ContentWrapper: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
11
- as?: import("react").ElementType<any> | undefined;
10
+ as?: import("react").ElementType;
12
11
  }>;
13
12
  declare const Thumbnail: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLImageElement> & import("react").ImgHTMLAttributes<HTMLImageElement> & Record<never, unknown> & {
14
- as?: import("react").ElementType<any> | undefined;
13
+ as?: import("react").ElementType;
15
14
  }>;
16
15
  declare const Content: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
17
- as?: import("react").ElementType<any> | undefined;
16
+ as?: import("react").ElementType;
18
17
  }>;
19
18
  declare const Title: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown> & {
20
- as?: import("react").ElementType<any> | undefined;
19
+ as?: import("react").ElementType;
21
20
  }>;
22
21
  declare const Text: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown> & {
23
- as?: import("react").ElementType<any> | undefined;
22
+ as?: import("react").ElementType;
24
23
  }>;
25
24
  declare const CloseIcon: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
26
- as?: import("react").ElementType<any> | undefined;
25
+ as?: import("react").ElementType;
27
26
  }>;
28
27
  export { StyledTooltip, Thumbnail, ContentWrapper, Content, Title, Text, CloseIcon };
@@ -1,4 +1,5 @@
1
- import React, { useState, useLayoutEffect } from 'react';
1
+ import * as React from 'react';
2
+ import { useState, useLayoutEffect } from 'react';
2
3
  import { useLayer, useHover, Arrow } from 'react-laag';
3
4
  import theme, { type Durations, type Space } from '@clad-ui/theme';
4
5
  import { cx } from '../../utils';
@@ -34,7 +35,7 @@ export type TooltipPlacement =
34
35
 
35
36
  export type TooltipVariant = 'dark' | 'light';
36
37
 
37
- export type TooltipProps = {
38
+ export interface TooltipProps {
38
39
  /**
39
40
  * String or element that the Tooltip wraps
40
41
  */
@@ -49,10 +50,12 @@ export type TooltipProps = {
49
50
  text?: string;
50
51
  /**
51
52
  * Different looks of Tooltip
53
+ * @default dark
52
54
  */
53
55
  variant?: TooltipVariant;
54
56
  /**
55
57
  * Preferred placement of the Tooltip
58
+ * @default bottom-center
56
59
  */
57
60
  placement?: TooltipPlacement;
58
61
  /**
@@ -73,6 +76,7 @@ export type TooltipProps = {
73
76
  arrowOffset?: Space;
74
77
  /**
75
78
  * Distance between Tooltip and trigger
79
+ * @default sm
76
80
  */
77
81
  triggerOffset?: Space;
78
82
  /**
@@ -88,6 +92,7 @@ export type TooltipProps = {
88
92
  zIndex?: number;
89
93
  /**
90
94
  * Time of fade animation (ms)
95
+ * @default xs
91
96
  */
92
97
  fadeDuration?: Durations;
93
98
  /**
@@ -100,13 +105,15 @@ export type TooltipProps = {
100
105
  thumbnail?: string;
101
106
  /**
102
107
  * Have close button or not
108
+ * @default false
103
109
  */
104
110
  haveClose?: boolean;
105
111
  /**
106
112
  * Max width of tooltip
113
+ * @default 280px
107
114
  */
108
115
  maxWidth?: string;
109
- };
116
+ }
110
117
 
111
118
  /**
112
119
  * Tooltip is a common graphical user interface that appears when user hovers a specific text or component to provide information that user needs to be aware of.