@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
@@ -2,12 +2,23 @@ import * as React from 'react';
2
2
  import TagCloudSingleActive from './TagCloudSingleActive';
3
3
  import TagCloudMultiActive from './TagCloudMultiActive';
4
4
 
5
- type TagCloudOption = {
5
+ export type TagCloudOption = {
6
6
  value: string;
7
7
  label: string;
8
8
  };
9
9
 
10
- export type TagCloudProps = {
10
+ export type TagCloudValue<T extends boolean | undefined = undefined> = T extends true
11
+ ? string[]
12
+ : string;
13
+
14
+ /**
15
+ * Tag Cloud change event, value is stored in target.value
16
+ */
17
+ export interface TagCloudChangeEvent<Multi extends boolean | undefined = undefined> extends Event {
18
+ target: Omit<EventTarget, 'value'> & { value: TagCloudValue<Multi> };
19
+ }
20
+
21
+ export interface TagCloudProps {
11
22
  /**
12
23
  * Tag cloud className
13
24
  */
@@ -23,11 +34,11 @@ export type TagCloudProps = {
23
34
  /**
24
35
  * Value of the active chip(s)
25
36
  */
26
- value?: string[] | string;
37
+ value?: TagCloudValue<this['multiple']>;
27
38
  /**
28
39
  * Change event
29
40
  */
30
- onChange?: () => void;
41
+ onChange?: (event: TagCloudChangeEvent<this['multiple']>) => void;
31
42
  /**
32
43
  * Whether this tag cloud requires at least 1 option or not
33
44
  */
@@ -43,7 +54,7 @@ export type TagCloudProps = {
43
54
  /**
44
55
  * Tag cloud ref
45
56
  */
46
- tagCloudRef?: React.RefObject<HTMLDivElement> | ((instance) => void) | null;
57
+ tagCloudRef?: React.RefObject<HTMLDivElement>;
47
58
  /**
48
59
  * Tag cloud status (useful when implemented with validation)
49
60
  */
@@ -56,7 +67,11 @@ export type TagCloudProps = {
56
67
  * Chip variant
57
68
  */
58
69
  variant?: 'normal' | 'outline';
59
- };
70
+ /**
71
+ * selected Text FontWeight
72
+ */
73
+ selectedTextStyle?: 'bold' | 'normal';
74
+ }
60
75
  /**
61
76
  * Tag Cloud pattern, including multiple Chip components
62
77
  *
@@ -72,10 +87,11 @@ const TagCloud: React.FC<TagCloudProps> = ({
72
87
  required = false,
73
88
  multiple = false,
74
89
  maxSelection = 0,
75
- tagCloudRef = null,
90
+ tagCloudRef,
76
91
  status = 'default',
77
92
  helptext = '',
78
93
  variant = 'normal',
94
+ selectedTextStyle = 'bold',
79
95
  }) => {
80
96
  const props = {
81
97
  className,
@@ -88,11 +104,11 @@ const TagCloud: React.FC<TagCloudProps> = ({
88
104
  status,
89
105
  variant,
90
106
  helptext,
107
+ selectedTextStyle,
91
108
  maxSelection: multiple ? maxSelection : undefined,
92
109
  };
93
110
 
94
111
  return multiple ? <TagCloudMultiActive {...props} /> : <TagCloudSingleActive {...props} />;
95
112
  };
96
113
 
97
-
98
114
  export default TagCloud;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  declare const valueFilter: (currentValue: any, acceptableValues: any) => any;
3
3
  declare const chipActiveValuesHandler: (key: any, value: any, maxSelection: any) => any[];
4
- export type TabCloudProps = {
4
+ export interface TabCloudProps {
5
5
  className?: string;
6
6
  options?: {
7
7
  value: string;
@@ -9,14 +9,16 @@ export type TabCloudProps = {
9
9
  }[];
10
10
  label?: string;
11
11
  value?: string[] | string;
12
- onChange?: any;
12
+ onChange?: (event: Event & {
13
+ target: HTMLInputElement;
14
+ }) => void;
13
15
  required?: boolean;
14
16
  maxSelection?: number;
15
- tagCloudRef?: any;
17
+ tagCloudRef?: React.RefObject<HTMLDivElement>;
16
18
  status?: 'default' | 'error';
17
19
  helptext?: string;
18
20
  variant?: 'normal' | 'outline';
19
- };
21
+ }
20
22
  declare const TagCloudMultiActive: React.FC<TabCloudProps>;
21
23
  export { valueFilter, chipActiveValuesHandler };
22
24
  export default TagCloudMultiActive;
@@ -34,19 +34,19 @@ const chipActiveValuesHandler = (key, value, maxSelection) => {
34
34
  return [];
35
35
  };
36
36
 
37
- export type TabCloudProps = {
37
+ export interface TabCloudProps {
38
38
  className?: string;
39
39
  options?: { value: string; label: string }[];
40
40
  label?: string;
41
41
  value?: string[] | string;
42
- onChange?: any;
42
+ onChange?: (event: Event & { target: HTMLInputElement }) => void;
43
43
  required?: boolean;
44
44
  maxSelection?: number;
45
- tagCloudRef?: any;
45
+ tagCloudRef?: React.RefObject<HTMLDivElement>;
46
46
  status?: 'default' | 'error';
47
47
  helptext?: string;
48
48
  variant?: 'normal' | 'outline';
49
- };
49
+ }
50
50
 
51
51
  const TagCloudMultiActive: React.FC<TabCloudProps> = ({
52
52
  className,
@@ -61,7 +61,7 @@ const TagCloudMultiActive: React.FC<TabCloudProps> = ({
61
61
  helptext,
62
62
  variant,
63
63
  }) => {
64
- const defaultRef = useRef();
64
+ const defaultRef = useRef<HTMLDivElement>(null);
65
65
  const ref = tagCloudRef || defaultRef;
66
66
 
67
67
  const onChipClicked = (key, activeValues, maxChips) => {
@@ -7,12 +7,15 @@ export type TagCloudProps = {
7
7
  }[];
8
8
  label?: string;
9
9
  value?: string[] | string;
10
- onChange?: any;
10
+ onChange?: (event: Event & {
11
+ target: HTMLInputElement;
12
+ }) => void;
11
13
  required?: boolean;
12
- tagCloudRef?: any;
14
+ tagCloudRef?: React.RefObject<HTMLDivElement>;
13
15
  status?: 'default' | 'error';
14
16
  helptext?: string;
15
17
  variant?: 'normal' | 'outline';
18
+ selectedTextStyle?: 'bold' | 'normal';
16
19
  };
17
20
  declare const TagCloudSingleActive: React.FC<TagCloudProps>;
18
21
  export default TagCloudSingleActive;
@@ -1,23 +1,31 @@
1
1
  import React, { useRef } from 'react';
2
2
  import theme from '@clad-ui/theme';
3
+ import { css } from '@linaria/core';
4
+ import { cx } from '../../utils';
3
5
  import Chip from '../../components/Chip/Chip';
4
6
  import { StyledTagCloud, StyledLabel, Paragraph } from './TagCloud.styles';
5
7
  import simulateChangeEvent from '../../utils/_simulateChangeEvent';
6
8
 
7
- const { colors } = theme;
9
+ const { colors, fontWeights } = theme;
8
10
  export type TagCloudProps = {
9
11
  className?: string;
10
12
  options?: { value: string; label: string }[];
11
13
  label?: string;
12
14
  value?: string[] | string;
13
- onChange?: any;
15
+ onChange?: (event: Event & { target: HTMLInputElement }) => void;
14
16
  required?: boolean;
15
- tagCloudRef?: any;
17
+ tagCloudRef?: React.RefObject<HTMLDivElement>;
16
18
  status?: 'default' | 'error';
17
19
  helptext?: string;
18
20
  variant?: 'normal' | 'outline';
21
+ selectedTextStyle?: 'bold' | 'normal';
19
22
  };
20
23
 
24
+ const tagCloudClass = css`
25
+ &.active {
26
+ font-weight: ${fontWeights.normal};
27
+ }
28
+ `;
21
29
 
22
30
  const TagCloudSingleActive: React.FC<TagCloudProps> = ({
23
31
  className,
@@ -30,16 +38,21 @@ const TagCloudSingleActive: React.FC<TagCloudProps> = ({
30
38
  status,
31
39
  helptext,
32
40
  variant,
41
+ selectedTextStyle,
33
42
  }) => {
34
- const defaultRef = useRef();
43
+ const defaultRef = useRef<HTMLDivElement>(null);
35
44
  const ref = tagCloudRef || defaultRef;
36
45
 
37
46
  const onChipClicked = (key) => {
38
- if (onChange) onChange(simulateChangeEvent(ref, key));
47
+ if (onChange && ref) {
48
+ const event = simulateChangeEvent(ref, key);
49
+ onChange(event);
50
+ }
39
51
  };
40
52
 
41
53
  const chipComponents = options?.map((option) => (
42
54
  <Chip
55
+ className={cx(selectedTextStyle === 'normal' && tagCloudClass)}
43
56
  key={option.value}
44
57
  active={option.value === value}
45
58
  as="button"
@@ -3,7 +3,7 @@ import path from 'path';
3
3
  import * as components from './index.ts';
4
4
 
5
5
  // add module name here to get ignored
6
- const ignoredModules = ['index', 'TagCloudSingleActive', 'TagCloudMultiActive'];
6
+ const ignoredModules = ['index', 'TagCloudSingleActive', 'TagCloudMultiActive', 'DialogMainIcon'];
7
7
 
8
8
  describe('patterns/index', () => {
9
9
  it('should export all components inside patterns folder', (done) => {
@@ -1,8 +1,8 @@
1
1
  export default GuideImage;
2
2
  declare function GuideImage({ isBad, isGood, alt, ...props }: {
3
3
  [x: string]: any;
4
- isBad: any;
5
- isGood: any;
4
+ isBad?: boolean | undefined;
5
+ isGood?: boolean | undefined;
6
6
  alt: any;
7
7
  }): JSX.Element;
8
8
  declare namespace GuideImage {
@@ -4,7 +4,7 @@ export default Swatch;
4
4
  * @type {React.FC<{colorName, description}>}
5
5
  */
6
6
  declare const Swatch: React.FC<{
7
- colorName;
8
- description;
7
+ colorName: any;
8
+ description: any;
9
9
  }>;
10
10
  import React from 'react';
@@ -406,9 +406,9 @@ exports[`chotot theme should match current snapshot 1`] = `
406
406
  },
407
407
  "zIndices": {
408
408
  "down": -1,
409
- "dropdown": 1600,
409
+ "dropdown": 1700,
410
410
  "initial": "auto",
411
- "modal": 1700,
411
+ "modal": 1600,
412
412
  "neutral": 0,
413
413
  "notification": 1900,
414
414
  "tooltip": 1800,
@@ -372,9 +372,6 @@ declare const newTheme: {
372
372
  readonly body: "14px";
373
373
  readonly xxs: "10px";
374
374
  readonly xs: "12px";
375
- /**
376
- * Background color. A contrast color for emphasizing UI
377
- */
378
375
  readonly sm: "14px";
379
376
  readonly md: "16px";
380
377
  readonly lg: "18px";
@@ -412,9 +409,9 @@ declare const newTheme: {
412
409
  readonly xl: 1.5;
413
410
  };
414
411
  mediaQueries: {
415
- ip5: string;
416
- tablet: string;
417
- desktop: string;
412
+ ip5: `screen and (max-width: 320px)` | string;
413
+ tablet: `screen and (min-width: {breakpoints.md})` | string;
414
+ desktop: `screen and (min-width: {breakpoints.lg})` | string;
418
415
  };
419
416
  radii: {
420
417
  none: "0";
@@ -434,9 +431,7 @@ declare const newTheme: {
434
431
  };
435
432
  sizes: {
436
433
  xxxs: "12px";
437
- xxs: "16px"; /**
438
- * Body background color
439
- */
434
+ xxs: "16px";
440
435
  xs: "20px";
441
436
  sm: "24px";
442
437
  md: "28px";
@@ -453,9 +448,7 @@ declare const newTheme: {
453
448
  $xl: "864px";
454
449
  vW: "100vw";
455
450
  vH: "100vh";
456
- quarter: "25%"; /**
457
- * De-emphasized / footer text color
458
- */
451
+ quarter: "25%";
459
452
  third: "33.33%";
460
453
  half: "50%";
461
454
  twoThird: "66.66%";
@@ -483,7 +476,7 @@ declare const newTheme: {
483
476
  down: -1;
484
477
  notification: 1900;
485
478
  tooltip: 1800;
486
- modal: 1700;
487
- dropdown: 1600;
479
+ modal: 1600;
480
+ dropdown: 1700;
488
481
  };
489
482
  };
package/theme/chotot.d.ts CHANGED
@@ -289,23 +289,23 @@ declare const theme: Readonly<{
289
289
  md: "2px";
290
290
  lg: "3px";
291
291
  xl: "4px";
292
- '0': '0px';
293
- '1': '1px';
294
- '2': '2px';
295
- '3': '3px';
296
- '4': '4px';
292
+ '0': "0px";
293
+ '1': "1px";
294
+ '2': "2px";
295
+ '3': "3px";
296
+ '4': "4px";
297
297
  };
298
298
  breakpoints: {
299
- 0: '576px';
300
- 1: '768px';
301
- 2: '992px';
302
- 3: '1200px';
303
- 4: '1400px';
304
- sm: '576px';
305
- md: '768px';
306
- lg: '992px';
307
- xl: '1200px';
308
- xxl: '1400px';
299
+ 0: "576px";
300
+ 1: "768px";
301
+ 2: "992px";
302
+ 3: "1200px";
303
+ 4: "1400px";
304
+ sm: "576px";
305
+ md: "768px";
306
+ lg: "992px";
307
+ xl: "1200px";
308
+ xxl: "1400px";
309
309
  };
310
310
  colors: {
311
311
  /**
@@ -1013,8 +1013,8 @@ declare const theme: Readonly<{
1013
1013
  readonly bold: 700;
1014
1014
  };
1015
1015
  gradients: {
1016
- toDark: 'linear-gradient(180deg, rgba(0, 0, 0, 0.00) 3%, #101426 100%)';
1017
- toLight: 'linear-gradient(0deg, #FFFFFF 0%, rgba(255, 255, 255, 0.00) 100%)';
1016
+ toDark: "linear-gradient(180deg, rgba(0, 0, 0, 0.00) 3%, #101426 100%)";
1017
+ toLight: "linear-gradient(0deg, #FFFFFF 0%, rgba(255, 255, 255, 0.00) 100%)";
1018
1018
  };
1019
1019
  letterSpacings: any[];
1020
1020
  lineHeights: {
@@ -1089,10 +1089,10 @@ declare const theme: Readonly<{
1089
1089
  circle: string;
1090
1090
  };
1091
1091
  shadows: {
1092
- none: 'none';
1093
- sm: '0px 2px 4px rgba(0,0,0,.5)';
1094
- md: '0px 0px 8px rgba(0,0,0,.3)';
1095
- lg: '2px 2px 14px rgba(0,0,0,.3)';
1092
+ none: "none";
1093
+ sm: "0px 2px 4px rgba(0,0,0,.5)";
1094
+ md: "0px 0px 8px rgba(0,0,0,.3)";
1095
+ lg: "2px 2px 14px rgba(0,0,0,.3)";
1096
1096
  };
1097
1097
  sizes: {
1098
1098
  xxxs: "12px";
@@ -1111,14 +1111,14 @@ declare const theme: Readonly<{
1111
1111
  $md: "480px";
1112
1112
  $lg: "636px";
1113
1113
  $xl: "864px";
1114
- vW: '100vw';
1115
- vH: '100vh';
1116
- quarter: '25%';
1117
- third: '33.33%';
1118
- half: '50%';
1119
- twoThird: '66.66%';
1120
- threeQuarter: '75%';
1121
- full: '100%';
1114
+ vW: "100vw";
1115
+ vH: "100vh";
1116
+ quarter: "25%";
1117
+ third: "33.33%";
1118
+ half: "50%";
1119
+ twoThird: "66.66%";
1120
+ threeQuarter: "75%";
1121
+ full: "100%";
1122
1122
  };
1123
1123
  space: {
1124
1124
  none: "0px";
@@ -1135,13 +1135,13 @@ declare const theme: Readonly<{
1135
1135
  xxxxxl: "128px";
1136
1136
  };
1137
1137
  zIndices: {
1138
- initial: 'auto';
1138
+ initial: "auto";
1139
1139
  neutral: 0;
1140
1140
  up: 1;
1141
1141
  down: -1;
1142
1142
  notification: 1900;
1143
1143
  tooltip: 1800;
1144
- modal: 1700;
1145
- dropdown: 1600;
1144
+ modal: 1600;
1145
+ dropdown: 1700;
1146
1146
  };
1147
1147
  }>;
package/theme/chotot.js CHANGED
@@ -1196,8 +1196,8 @@ const letterSpacings = [];
1196
1196
  down: -1,
1197
1197
  notification: 1900,
1198
1198
  tooltip: 1800,
1199
- modal: 1700,
1200
- dropdown: 1600,
1199
+ modal: 1600,
1200
+ dropdown: 1700,
1201
1201
  }}
1202
1202
  */
1203
1203
  const zIndices = {
@@ -1207,8 +1207,8 @@ const zIndices = {
1207
1207
  down: -1,
1208
1208
  notification: 1900,
1209
1209
  tooltip: 1800,
1210
- modal: 1700,
1211
- dropdown: 1600,
1210
+ modal: 1600,
1211
+ dropdown: 1700,
1212
1212
  };
1213
1213
 
1214
1214
  /**
package/theme/ct-job.d.ts CHANGED
@@ -317,23 +317,15 @@ declare const jobTheme: {
317
317
  '4': "4px";
318
318
  };
319
319
  breakpoints: {
320
- /**
321
- * Brand text color
322
- */
323
320
  0: "576px";
324
321
  1: "768px";
325
322
  2: "992px";
326
- 3: "1200px"; /**
327
- * Primary button solid background color
328
- */
323
+ 3: "1200px";
329
324
  4: "1400px";
330
325
  sm: "576px";
331
326
  md: "768px";
332
327
  lg: "992px";
333
328
  xl: "1200px";
334
- /**
335
- * Primary button solid background color
336
- */
337
329
  xxl: "1400px";
338
330
  };
339
331
  durations: {
@@ -405,9 +397,9 @@ declare const jobTheme: {
405
397
  readonly xl: 1.5;
406
398
  };
407
399
  mediaQueries: {
408
- ip5: string;
409
- tablet: string;
410
- desktop: string;
400
+ ip5: `screen and (max-width: 320px)` | string;
401
+ tablet: `screen and (min-width: {breakpoints.md})` | string;
402
+ desktop: `screen and (min-width: {breakpoints.lg})` | string;
411
403
  };
412
404
  radii: {
413
405
  none: "0";
@@ -472,7 +464,7 @@ declare const jobTheme: {
472
464
  down: -1;
473
465
  notification: 1900;
474
466
  tooltip: 1800;
475
- modal: 1700;
476
- dropdown: 1600;
467
+ modal: 1600;
468
+ dropdown: 1700;
477
469
  };
478
470
  };
package/theme/ct-pty.d.ts CHANGED
@@ -570,9 +570,7 @@ declare const propertyTheme: {
570
570
  };
571
571
  breakpoints: {
572
572
  0: "576px";
573
- 1: "768px"; /**
574
- * Brand color for decorations: banner, illustrations, tag...
575
- */
573
+ 1: "768px";
576
574
  2: "992px";
577
575
  3: "1200px";
578
576
  4: "1400px";
@@ -651,9 +649,9 @@ declare const propertyTheme: {
651
649
  readonly xl: 1.5;
652
650
  };
653
651
  mediaQueries: {
654
- ip5: string;
655
- tablet: string;
656
- desktop: string;
652
+ ip5: `screen and (max-width: 320px)` | string;
653
+ tablet: `screen and (min-width: {breakpoints.md})` | string;
654
+ desktop: `screen and (min-width: {breakpoints.lg})` | string;
657
655
  };
658
656
  radii: {
659
657
  none: "0";
@@ -718,7 +716,7 @@ declare const propertyTheme: {
718
716
  down: -1;
719
717
  notification: 1900;
720
718
  tooltip: 1800;
721
- modal: 1700;
722
- dropdown: 1600;
719
+ modal: 1600;
720
+ dropdown: 1700;
723
721
  };
724
722
  };
package/theme/mudah.d.ts CHANGED
@@ -28,43 +28,44 @@ declare const theme: Readonly<{
28
28
  length: number;
29
29
  toString(): string;
30
30
  toLocaleString(): string;
31
+ toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string;
31
32
  pop(): string | undefined;
32
33
  push(...items: string[]): number;
33
34
  concat(...items: ConcatArray<string>[]): string[];
34
35
  concat(...items: (string | ConcatArray<string>)[]): string[];
35
- join(separator?: string | undefined): string;
36
+ join(separator?: string): string;
36
37
  reverse(): string[];
37
38
  shift(): string | undefined;
38
- slice(start?: number | undefined, end?: number | undefined): string[];
39
+ slice(start?: number, end?: number): string[];
39
40
  sort(compareFn?: ((a: string, b: string) => number) | undefined): string[];
40
- splice(start: number, deleteCount?: number | undefined): string[];
41
+ splice(start: number, deleteCount?: number): string[];
41
42
  splice(start: number, deleteCount: number, ...items: string[]): string[];
42
43
  unshift(...items: string[]): number;
43
- indexOf(searchElement: string, fromIndex?: number | undefined): number;
44
- lastIndexOf(searchElement: string, fromIndex?: number | undefined): number;
44
+ indexOf(searchElement: string, fromIndex?: number): number;
45
+ lastIndexOf(searchElement: string, fromIndex?: number): number;
45
46
  every<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): this is S[];
46
47
  every(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean;
47
48
  some(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean;
48
49
  forEach(callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any): void;
49
50
  map<U>(callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any): U[];
50
- filter<S_1 extends string>(predicate: (value: string, index: number, array: string[]) => value is S_1, thisArg?: any): S_1[];
51
+ filter<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S[];
51
52
  filter(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[];
52
53
  reduce(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
53
54
  reduce(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
54
- reduce<U_1>(callbackfn: (previousValue: U_1, currentValue: string, currentIndex: number, array: string[]) => U_1, initialValue: U_1): U_1;
55
+ reduce<U>(callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U;
55
56
  reduceRight(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
56
57
  reduceRight(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
57
- reduceRight<U_2>(callbackfn: (previousValue: U_2, currentValue: string, currentIndex: number, array: string[]) => U_2, initialValue: U_2): U_2;
58
- find<S_2 extends string>(predicate: (value: string, index: number, obj: string[]) => value is S_2, thisArg?: any): S_2 | undefined;
58
+ reduceRight<U>(callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U;
59
+ find<S extends string>(predicate: (value: string, index: number, obj: string[]) => value is S, thisArg?: any): S | undefined;
59
60
  find(predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): string | undefined;
60
61
  findIndex(predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): number;
61
- fill(value: string, start?: number | undefined, end?: number | undefined): string[];
62
- copyWithin(target: number, start: number, end?: number | undefined): string[];
62
+ fill(value: string, start?: number, end?: number): string[];
63
+ copyWithin(target: number, start: number, end?: number): string[];
63
64
  entries(): IterableIterator<[number, string]>;
64
65
  keys(): IterableIterator<number>;
65
66
  values(): IterableIterator<string>;
66
- includes(searchElement: string, fromIndex?: number | undefined): boolean;
67
- flatMap<U_3, This = undefined>(callback: (this: This, value: string, index: number, array: string[]) => U_3 | readonly U_3[], thisArg?: This | undefined): U_3[];
67
+ includes(searchElement: string, fromIndex?: number): boolean;
68
+ flatMap<U, This = undefined>(callback: (this: This, value: string, index: number, array: string[]) => U | readonly U[], thisArg?: This | undefined): U[];
68
69
  flat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[];
69
70
  at(index: number): string | undefined;
70
71
  [Symbol.iterator](): IterableIterator<string>;
package/types.d.ts CHANGED
@@ -12,12 +12,3 @@ export type NextLink = {
12
12
  onClick?: MouseEventHandler | ((event: MouseEvent, value: any) => void);
13
13
  ref?: any;
14
14
  };
15
-
16
- export type LinariaClassName = string & { __linariaClassName: true };
17
-
18
- export type ClassName<T = string> = T | '' | 0 | false | null | void;
19
-
20
- interface ICX {
21
- (...classNames: ClassName<LinariaClassName>[]): LinariaClassName;
22
- (...classNames: ClassName[]): string;
23
- }
@@ -1,9 +1,24 @@
1
1
  export default simulateChangeEvent;
2
+ /**
3
+ * Conditional type to determine returned type based on ref type
4
+ */
5
+ export type SimulatedEvent<RefType extends import("react").RefObject<any> | null | undefined> = RefType extends import("react").RefObject<any> ? Event & {
6
+ simulated: boolean;
7
+ target: Omit<HTMLInputElement, "value"> & {
8
+ value: any;
9
+ };
10
+ } : null;
11
+ /**
12
+ * Conditional type to determine returned type based on ref type
13
+ * @template {import ('react').RefObject | null | undefined} RefType
14
+ * @typedef {RefType extends import ('react').RefObject ? Event & { simulated: boolean, target: Omit<HTMLInputElement, 'value'> & { value: any } } : null} SimulatedEvent
15
+ */
2
16
  /**
3
17
  * Simulate change event where your input doesn't support onChange natively or to trigger onChange programatically
4
- * @param {import ('react').MutableRefObject} ref DOM element ref, required
18
+ * @template {import ('react').RefObject | null | undefined} RefType
19
+ * @param {RefType} ref DOM element ref, required
5
20
  * @param {any} newValue new value to trigger
6
21
  * @param {any?} currentValue current value, if obmit, will attempt to get it from `ref.current.value`
7
- * @return {Event | null} Event object with proper `target` set, call `onChange(event)` if your component doesn't trigger onChange natively
22
+ * @return {SimulatedEvent<RefType>} Event object with proper `target` set, call `onChange(event)` if your component doesn't trigger onChange natively
8
23
  */
9
- declare function simulateChangeEvent(ref: import("react").MutableRefObject<any>, newValue: any, currentValue?: any | null): Event | null;
24
+ declare function simulateChangeEvent<RefType extends import("react").RefObject<any> | null | undefined>(ref: RefType, newValue: any, currentValue?: any | null): SimulatedEvent<RefType>;