@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
@@ -48,7 +48,7 @@ const mapElementToListItem = (element: React.ReactElement, isLast: boolean) => {
48
48
  );
49
49
  };
50
50
 
51
- export type BreadcrumbsProps = {
51
+ export interface BreadcrumbsProps {
52
52
  /**
53
53
  * Breadcrumbs className
54
54
  */
@@ -61,7 +61,7 @@ export type BreadcrumbsProps = {
61
61
  * Whether this Breadcrumbs is show or not
62
62
  */
63
63
  isShow?: boolean;
64
- };
64
+ }
65
65
 
66
66
  const Breadcrumbs: React.FC<BreadcrumbsProps> = ({ className, children, isShow = true }) => {
67
67
  // return Placeholder if children is not valid element(s), or isShow is false
@@ -1,27 +1,41 @@
1
1
  import * as React from 'react';
2
- export type ButtonProps = {
2
+ /**
3
+ * Color selection for button color prop
4
+ */
5
+ export type ButtonColor = 'accent' | 'caution' | 'chotot' | 'critical' | 'error' | 'info' | 'neutral' | 'positive' | 'primary' | 'success' | 'tertiary';
6
+ /**
7
+ * Variant selection for button variant prop
8
+ */
9
+ export type ButtonVariant = 'default' | 'outline' | 'solid' | 'tonal';
10
+ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
3
11
  /**
4
12
  * Different looks of button
13
+ * @default solid
5
14
  */
6
- variant?: 'outline' | 'solid' | 'tonal';
15
+ variant?: ButtonVariant;
7
16
  /**
8
17
  * Color of the background (solid) or stroke (outline) of the button
18
+ * @default primary
9
19
  */
10
- color?: 'accent' | 'caution' | 'chotot' | 'critical' | 'error' | 'info' | 'neutral' | 'positive' | 'primary' | 'success' | 'tertiary';
20
+ color?: ButtonColor;
11
21
  /**
12
22
  * Border radius
23
+ * @default normal
13
24
  */
14
25
  radius?: 'circle' | 'normal' | 'pill';
15
26
  /**
16
27
  * Font weight of label
28
+ * @default bold
17
29
  */
18
30
  weight?: 'bold' | 'normal';
19
31
  /**
20
32
  * Button's size
33
+ * @default medium
21
34
  */
22
35
  size?: 'large' | 'medium' | 'small';
23
36
  /**
24
37
  * Whether this button is disabled. No events triggered.
38
+ * @default false
25
39
  */
26
40
  disabled?: boolean;
27
41
  /**
@@ -34,8 +48,9 @@ export type ButtonProps = {
34
48
  stretch?: boolean;
35
49
  /**
36
50
  * Element or component to be rendered as
51
+ * @default button
37
52
  */
38
- as?: string;
53
+ as?: React.ElementType;
39
54
  /**
40
55
  * Children
41
56
  */
@@ -43,7 +58,7 @@ export type ButtonProps = {
43
58
  /**
44
59
  * Click event
45
60
  */
46
- onClick?: () => void;
61
+ onClick?: React.MouseEventHandler<HTMLElement>;
47
62
  /**
48
63
  * Additional classes to be added for customization
49
64
  */
@@ -52,7 +67,7 @@ export type ButtonProps = {
52
67
  * Display loading icon
53
68
  */
54
69
  isLoading?: boolean;
55
- };
70
+ }
56
71
  /**
57
72
  * Renders a standard button element.
58
73
  *
@@ -0,0 +1,103 @@
1
+ import React from 'react';
2
+ declare const buttonStories: {
3
+ title: string;
4
+ component: React.ForwardRefExoticComponent<import("./Button").ButtonProps & React.RefAttributes<unknown>>;
5
+ tags: string[];
6
+ parameters: {
7
+ docs: {
8
+ description: {
9
+ component: string;
10
+ };
11
+ };
12
+ };
13
+ argTypes: {
14
+ color: {
15
+ options: string[];
16
+ };
17
+ children: {
18
+ control: {
19
+ type: string;
20
+ };
21
+ };
22
+ as: {
23
+ options: string[];
24
+ control: {
25
+ type: string;
26
+ };
27
+ };
28
+ };
29
+ };
30
+ export default buttonStories;
31
+ export declare const Overview: {
32
+ (args: any): JSX.Element;
33
+ args: {
34
+ children: string;
35
+ as: string;
36
+ onClick: () => void;
37
+ };
38
+ };
39
+ export declare const VariantSolid: () => JSX.Element;
40
+ export declare const VariantOutline: {
41
+ render: () => JSX.Element;
42
+ parameters: {
43
+ docs: {
44
+ description: {
45
+ story: string;
46
+ };
47
+ };
48
+ };
49
+ };
50
+ export declare const VariantTonal: () => JSX.Element;
51
+ export declare const Sizes: () => JSX.Element;
52
+ export declare const BorderRadius: () => JSX.Element;
53
+ export declare const Disabled: {
54
+ render: () => JSX.Element;
55
+ parameters: {
56
+ docs: {
57
+ description: {
58
+ story: string;
59
+ };
60
+ };
61
+ };
62
+ };
63
+ export declare const LoadingState: {
64
+ render: () => JSX.Element;
65
+ parameters: {
66
+ docs: {
67
+ description: {
68
+ story: string;
69
+ };
70
+ };
71
+ };
72
+ };
73
+ export declare const WithIcons: () => JSX.Element;
74
+ export declare const IconButtons: {
75
+ render: () => JSX.Element;
76
+ parameters: {
77
+ docs: {
78
+ description: {
79
+ story: string;
80
+ };
81
+ };
82
+ };
83
+ };
84
+ export declare const Stretch: {
85
+ render: () => JSX.Element;
86
+ parameters: {
87
+ docs: {
88
+ description: {
89
+ story: string;
90
+ };
91
+ };
92
+ };
93
+ };
94
+ export declare const ExtraClasses: {
95
+ render: () => JSX.Element;
96
+ parameters: {
97
+ docs: {
98
+ description: {
99
+ story: string;
100
+ };
101
+ };
102
+ };
103
+ };
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import { css } from '@linaria/core';
3
-
4
3
  import Button from './Button';
5
4
  import IconButton from './IconButton';
6
5
  // import sx from '../../utils/sx';
@@ -10,6 +9,8 @@ import SpeechBubbles from '../../icons/SpeechBubbles';
10
9
  import Download from '../../icons/Download';
11
10
  import Location from '../../icons/Location';
12
11
 
12
+ const ALLOWED_COLORS = ['primary', 'info', 'success', 'error', 'neutral'];
13
+
13
14
  const buttonStories = {
14
15
  title: 'Components/Buttons/Button',
15
16
  component: Button,
@@ -25,6 +26,9 @@ const buttonStories = {
25
26
  },
26
27
  },
27
28
  argTypes: {
29
+ color: {
30
+ options: ALLOWED_COLORS,
31
+ },
28
32
  children: {
29
33
  control: {
30
34
  type: 'text',
@@ -1,2 +1,2 @@
1
- export default buttonClass;
2
1
  declare const buttonClass: import("@linaria/core").LinariaClassName;
2
+ export default buttonClass;
@@ -87,6 +87,7 @@ const buttonClass = css`
87
87
  }
88
88
  }
89
89
 
90
+ /* SOLID */
90
91
  &,
91
92
  &.primary {
92
93
  color: ${colors.textBlank};
@@ -154,17 +155,17 @@ const buttonClass = css`
154
155
  }
155
156
  &.neutral {
156
157
  color: ${colors.textBlank};
157
- background-color: ${colors.gray400};
158
- border-color: ${colors.gray400};
158
+ background-color: ${colors.backgroundInverted};
159
+ border-color: ${colors.interactionNeutralHover};
159
160
  &:hover {
160
161
  color: ${colors.textBlank};
161
- background-color: ${colors.gray300};
162
- border-color: ${colors.gray300};
162
+ background-color: ${colors.interactionNeutralHover};
163
+ border-color: ${colors.interactionNeutralHover};
163
164
  }
164
165
  &:active {
165
166
  color: ${colors.textBlank};
166
- background-color: ${colors.gray500};
167
- border-color: ${colors.gray500};
167
+ background-color: ${colors.interactionNeutralPressed};
168
+ border-color: ${colors.interactionNeutralPressed};
168
169
  }
169
170
  }
170
171
  &.chotot {
@@ -197,6 +198,85 @@ const buttonClass = css`
197
198
  border-color: ${colors.cautionDark};
198
199
  }
199
200
  }
201
+ /* DEFAULT */
202
+ &.default,
203
+ &.default.d-primary {
204
+ color: ${colors.buttonPrimary};
205
+ background-color: transparent;
206
+ border-color: transparent;
207
+ &:hover {
208
+ color: ${colors.interactionBrandHover};
209
+ background-color: transparent;
210
+ border-color: transparent;
211
+ }
212
+ &:active {
213
+ color: ${colors.interactionBrandPressed};
214
+ background-color: transparent;
215
+ border-color: transparent;
216
+ }
217
+ }
218
+ &.d-info {
219
+ color: ${colors.buttonInfo};
220
+ background-color: transparent;
221
+ border-color: transparent;
222
+ &:hover {
223
+ color: ${colors.interactionInfoHover};
224
+ background-color: transparent;
225
+ border-color: transparent;
226
+ }
227
+ &:active {
228
+ color: ${colors.interactionInfoPressed};
229
+ background-color: transparent;
230
+ border-color: transparent;
231
+ }
232
+ }
233
+ &.d-success,
234
+ &.d-accent,
235
+ &.d-positive {
236
+ color: ${colors.buttonSuccess};
237
+ background-color: transparent;
238
+ border-color: transparent;
239
+ &:hover {
240
+ color: ${colors.interactionSuccessHover};
241
+ background-color: transparent;
242
+ border-color: transparent;
243
+ }
244
+ &:active {
245
+ color: ${colors.interactionSuccessPressed};
246
+ background-color: transparent;
247
+ border-color: transparent;
248
+ }
249
+ }
250
+ &.d-error,
251
+ &.d-critical {
252
+ color: ${colors.textError};
253
+ background-color: transparent;
254
+ border-color: transparent;
255
+
256
+ &:hover {
257
+ color: ${colors.interactionErrorLightHover};
258
+ background: transparent;
259
+ background-color: transparent;
260
+ }
261
+ &:active {
262
+ color: ${colors.interactionErrorLightPressed};
263
+ background: transparent;
264
+ background-color: transparent;
265
+ }
266
+ }
267
+ &.d-neutral {
268
+ color: ${colors.textPrimary};
269
+ background: transparent;
270
+ border-color: transparent;
271
+ &:hover {
272
+ color: ${colors.textPrimary};
273
+ background: transparent;
274
+ }
275
+ &:active {
276
+ color: ${colors.textPrimary};
277
+ background: transparent;
278
+ }
279
+ }
200
280
 
201
281
  /* Outline button */
202
282
  &.outline,
@@ -286,6 +366,20 @@ const buttonClass = css`
286
366
  color: ${colors.cautionDark};
287
367
  }
288
368
  }
369
+ &.o-neutral {
370
+ color: ${colors.textPrimary};
371
+ border-color: ${colors.borderRegular};
372
+ &:hover {
373
+ color: ${colors.textPrimary};
374
+ background: ${colors.interactionNeutralLightHover};
375
+ border-color: ${colors.borderRegular};
376
+ }
377
+ &:active {
378
+ color: ${colors.textPrimary};
379
+ background: ${colors.interactionNeutralLightPressed};
380
+ border-color: ${colors.borderRegular};
381
+ }
382
+ }
289
383
 
290
384
  /* Tonal button */
291
385
  &.tonal,
@@ -1,42 +1,58 @@
1
1
  import * as React from 'react';
2
2
  import { cx } from '../../utils';
3
- import buttonClass from './Button.styles.js';
4
3
  import { Loading } from '../../icons';
4
+ import buttonClass from './Button.styles';
5
5
 
6
- export type ButtonProps = {
6
+ /**
7
+ * Color selection for button color prop
8
+ */
9
+ export type ButtonColor =
10
+ | 'accent'
11
+ | 'caution'
12
+ | 'chotot'
13
+ | 'critical'
14
+ | 'error'
15
+ | 'info'
16
+ | 'neutral'
17
+ | 'positive'
18
+ | 'primary'
19
+ | 'success'
20
+ | 'tertiary';
21
+
22
+ /**
23
+ * Variant selection for button variant prop
24
+ */
25
+ export type ButtonVariant = 'default' | 'outline' | 'solid' | 'tonal';
26
+
27
+ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
7
28
  /**
8
29
  * Different looks of button
30
+ * @default solid
9
31
  */
10
- variant?: 'outline' | 'solid' | 'tonal';
32
+ variant?: ButtonVariant;
11
33
  /**
12
34
  * Color of the background (solid) or stroke (outline) of the button
35
+ * @default primary
13
36
  */
14
- color?:
15
- | 'accent'
16
- | 'caution'
17
- | 'chotot'
18
- | 'critical'
19
- | 'error'
20
- | 'info'
21
- | 'neutral'
22
- | 'positive'
23
- | 'primary'
24
- | 'success'
25
- | 'tertiary';
37
+ color?: ButtonColor;
26
38
  /**
27
39
  * Border radius
40
+ * @default normal
28
41
  */
29
42
  radius?: 'circle' | 'normal' | 'pill';
30
43
  /**
31
44
  * Font weight of label
45
+ * @default bold
32
46
  */
33
47
  weight?: 'bold' | 'normal';
34
48
  /**
35
49
  * Button's size
50
+ * @default medium
36
51
  */
37
52
  size?: 'large' | 'medium' | 'small';
38
53
  /**
39
54
  * Whether this button is disabled. No events triggered.
55
+ * @default false
40
56
  */
41
57
  disabled?: boolean;
42
58
  /**
@@ -49,8 +65,9 @@ export type ButtonProps = {
49
65
  stretch?: boolean;
50
66
  /**
51
67
  * Element or component to be rendered as
68
+ * @default button
52
69
  */
53
- as?: string;
70
+ as?: React.ElementType;
54
71
  /**
55
72
  * Children
56
73
  */
@@ -58,7 +75,7 @@ export type ButtonProps = {
58
75
  /**
59
76
  * Click event
60
77
  */
61
- onClick?: () => void;
78
+ onClick?: React.MouseEventHandler<HTMLElement>;
62
79
  /**
63
80
  * Additional classes to be added for customization
64
81
  */
@@ -67,6 +84,22 @@ export type ButtonProps = {
67
84
  * Display loading icon
68
85
  */
69
86
  isLoading?: boolean;
87
+ }
88
+
89
+ const variantResolver = (variant: string, color: string) => {
90
+ if (variant === 'default') {
91
+ // DEFAULT
92
+ return `default d-${color}`;
93
+ } else if (variant === 'outline') {
94
+ // OUTLINE
95
+ return `outline o-${color}`;
96
+ } else if (variant === 'tonal') {
97
+ // TONAL
98
+ return `tonal t-${color}`;
99
+ } else {
100
+ // SOLID
101
+ return color;
102
+ }
70
103
  };
71
104
 
72
105
  /**
@@ -112,7 +145,7 @@ const Button = React.forwardRef(
112
145
  // prettier-ignore
113
146
  const className = cx(
114
147
  buttonClass,
115
- variant === 'outline' ? 'outline o-' + color : (variant === 'tonal' ? 'tonal t-' + color : color),
148
+ variantResolver(variant, color),
116
149
  `r-${radius}`,
117
150
  size,
118
151
  `w-${weight}`,
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- export type ButtonLinkProps = {
2
+ export interface ButtonLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
3
3
  /** null
4
4
  * The href attribute specifies the link's destination
5
5
  */
@@ -39,7 +39,7 @@ export type ButtonLinkProps = {
39
39
  /**
40
40
  * Element or component to be rendered as
41
41
  */
42
- as?: string;
42
+ as?: React.ElementType;
43
43
  /**
44
44
  * Children
45
45
  */
@@ -47,7 +47,7 @@ export type ButtonLinkProps = {
47
47
  /**
48
48
  * Click event
49
49
  */
50
- onClick?: () => void;
50
+ onClick?: React.MouseEventHandler<HTMLElement>;
51
51
  /**
52
52
  * Additional classes to be added for customization
53
53
  */
@@ -56,7 +56,7 @@ export type ButtonLinkProps = {
56
56
  * Ref
57
57
  */
58
58
  ref?: React.Ref<any>;
59
- };
59
+ }
60
60
  /**
61
61
  * Renders a standard button element.
62
62
  *
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ declare const buttonLinkStories: {
3
+ title: string;
4
+ component: React.ForwardRefExoticComponent<Omit<import("./ButtonLink").ButtonLinkProps, "ref"> & React.RefAttributes<HTMLElement>>;
5
+ tags: string[];
6
+ parameters: {
7
+ docs: {
8
+ description: {
9
+ component: string;
10
+ };
11
+ };
12
+ };
13
+ argTypes: {
14
+ children: {
15
+ control: {
16
+ type: string;
17
+ };
18
+ };
19
+ };
20
+ };
21
+ export default buttonLinkStories;
22
+ export declare const Overview: {
23
+ render: (args: any) => JSX.Element;
24
+ args: {
25
+ children: string;
26
+ };
27
+ };
28
+ export declare const ButtonVariant: () => JSX.Element;
29
+ export declare const HyperlinkVariant: () => JSX.Element;
30
+ export declare const Disabled: () => JSX.Element;
@@ -1,2 +1,2 @@
1
- export default buttonClass;
2
1
  declare const buttonClass: import("@linaria/core").LinariaClassName;
2
+ export default buttonClass;
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { cx } from '../../utils';
3
3
  import buttonClass from './ButtonLink.styles';
4
4
 
5
- export type ButtonLinkProps = {
5
+ export interface ButtonLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
6
6
  /** null
7
7
  * The href attribute specifies the link's destination
8
8
  */
@@ -42,7 +42,7 @@ export type ButtonLinkProps = {
42
42
  /**
43
43
  * Element or component to be rendered as
44
44
  */
45
- as?: string;
45
+ as?: React.ElementType;
46
46
  /**
47
47
  * Children
48
48
  */
@@ -50,7 +50,7 @@ export type ButtonLinkProps = {
50
50
  /**
51
51
  * Click event
52
52
  */
53
- onClick?: () => void;
53
+ onClick?: React.MouseEventHandler<HTMLElement>;
54
54
  /**
55
55
  * Additional classes to be added for customization
56
56
  */
@@ -59,7 +59,7 @@ export type ButtonLinkProps = {
59
59
  * Ref
60
60
  */
61
61
  ref?: React.Ref<any>;
62
- };
62
+ }
63
63
 
64
64
  /**
65
65
  * Renders a standard button element.
@@ -105,7 +105,7 @@ export const Button = React.forwardRef<HTMLElement, ButtonLinkProps>(
105
105
  href,
106
106
  target,
107
107
  disabled: disabled && true,
108
- onClick: !disabled && onClick && onClick,
108
+ onClick: !disabled && onClick ? onClick : undefined,
109
109
  ...props,
110
110
  };
111
111
 
@@ -1,33 +1,7 @@
1
1
  import * as React from 'react';
2
- export type IconButtonProps = {
3
- /**
4
- * Different looks of button
5
- */
6
- variant?: 'outline' | 'solid';
7
- /**
8
- * Color of the background (solid) or stroke (outline) of the button
9
- */
10
- color?: 'accent' | 'caution' | 'chotot' | 'critical' | 'error' | 'info' | 'neutral' | 'positive' | 'primary' | 'success' | 'tertiary';
11
- /**
12
- * Border radius
13
- */
14
- radius?: 'circle' | 'normal';
15
- /**
16
- * Button's size
17
- */
18
- size?: 'large' | 'medium' | 'small';
19
- /**
20
- * Whether this button is disabled. No events triggered.
21
- */
22
- disabled?: boolean;
23
- /**
24
- * Element or component to be rendered as
25
- */
26
- as?: React.ElementType;
27
- children?: React.ReactNode;
28
- extraClasses?: string;
29
- onClick?: () => void;
30
- };
2
+ import { type ButtonProps } from './Button';
3
+ export interface IconButtonProps extends Omit<ButtonProps, 'stretch' | 'icon'> {
4
+ }
31
5
  /**
32
6
  * Icons as interactive buttons / links. It has the same props list as [Button component](/docs/components-shapeicon--docs)
33
7
  *
@@ -0,0 +1,60 @@
1
+ import React from 'react';
2
+ declare const iconButtonStories: {
3
+ title: string;
4
+ component: React.FC<import("./IconButton").IconButtonProps>;
5
+ tags: string[];
6
+ parameters: {
7
+ docs: {
8
+ description: {
9
+ component: string;
10
+ };
11
+ };
12
+ };
13
+ argTypes: {
14
+ as: {
15
+ options: string[];
16
+ control: {
17
+ type: string;
18
+ };
19
+ };
20
+ };
21
+ };
22
+ export default iconButtonStories;
23
+ export declare const Overview: {
24
+ render: (args: any) => JSX.Element;
25
+ argTypes: {
26
+ children: {
27
+ options: string[];
28
+ control: {
29
+ type: string;
30
+ };
31
+ };
32
+ };
33
+ args: {
34
+ children: string;
35
+ as: string;
36
+ color: string;
37
+ size: string;
38
+ radius: string;
39
+ };
40
+ };
41
+ export declare const Variants: {
42
+ render: () => JSX.Element;
43
+ parameters: {
44
+ docs: {
45
+ description: {
46
+ story: string;
47
+ };
48
+ };
49
+ };
50
+ };
51
+ export declare const ExtraClasses: {
52
+ render: () => JSX.Element;
53
+ parameters: {
54
+ docs: {
55
+ description: {
56
+ story: string;
57
+ };
58
+ };
59
+ };
60
+ };