@chotot/clad-ui 2.0.0-next.4 → 2.1.0

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 (200) hide show
  1. package/README.md +7 -9
  2. package/dist/components/Announcer/Announcer.stories.d.ts.map +1 -1
  3. package/dist/components/Announcer/Announcer.stories.js +1 -26
  4. package/dist/components/Badge/Badge.d.ts +1 -1
  5. package/dist/components/Badge/Badge.d.ts.map +1 -1
  6. package/dist/components/Badge/Badge.js +34 -24
  7. package/dist/components/Badge/Badge.stories.d.ts.map +1 -1
  8. package/dist/components/Badge/Badge.stories.js +61 -54
  9. package/dist/components/Badge/Badge.styles.d.ts +1 -0
  10. package/dist/components/Badge/Badge.styles.d.ts.map +1 -1
  11. package/dist/components/Badge/Badge.styles.js +17 -8
  12. package/dist/components/Breadcrumbs/BreadcrumbItem.d.ts +6 -0
  13. package/dist/components/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -0
  14. package/dist/components/Breadcrumbs/BreadcrumbItem.js +11 -0
  15. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
  16. package/dist/components/Breadcrumbs/Breadcrumbs.js +7 -25
  17. package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts +0 -11
  18. package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts.map +1 -1
  19. package/dist/components/Breadcrumbs/Breadcrumbs.stories.js +47 -96
  20. package/dist/components/Button/Button.d.ts +8 -17
  21. package/dist/components/Button/Button.d.ts.map +1 -1
  22. package/dist/components/Button/Button.js +5 -3
  23. package/dist/components/Button/Button.stories.d.ts +78 -4
  24. package/dist/components/Button/Button.stories.d.ts.map +1 -1
  25. package/dist/components/Button/Button.stories.js +105 -11
  26. package/dist/components/Button/Button.styles.d.ts.map +1 -1
  27. package/dist/components/Button/Button.styles.js +30 -11
  28. package/dist/components/Button/GhostButton.d.ts +6 -26
  29. package/dist/components/Button/GhostButton.d.ts.map +1 -1
  30. package/dist/components/Button/GhostButton.js +4 -4
  31. package/dist/components/Button/GhostButton.stories.d.ts +80 -2
  32. package/dist/components/Button/GhostButton.stories.d.ts.map +1 -1
  33. package/dist/components/Button/GhostButton.stories.js +80 -7
  34. package/dist/components/Button/GhostButton.styles.d.ts.map +1 -1
  35. package/dist/components/Button/GhostButton.styles.js +17 -1
  36. package/dist/components/Button/IconButton.d.ts +1 -2
  37. package/dist/components/Button/IconButton.d.ts.map +1 -1
  38. package/dist/components/Button/IconButton.js +2 -7
  39. package/dist/components/Button/IconButton.stories.d.ts +75 -3
  40. package/dist/components/Button/IconButton.stories.d.ts.map +1 -1
  41. package/dist/components/Button/IconButton.stories.js +74 -7
  42. package/dist/components/Button/constant.d.ts +10 -0
  43. package/dist/components/Button/constant.d.ts.map +1 -0
  44. package/dist/components/Button/constant.js +21 -0
  45. package/dist/components/Checkbox/Checkbox.stories.d.ts +0 -10
  46. package/dist/components/Checkbox/Checkbox.stories.d.ts.map +1 -1
  47. package/dist/components/Checkbox/Checkbox.stories.js +1 -34
  48. package/dist/components/Chip/Chip.stories.js +1 -1
  49. package/dist/components/CurrencyInput/CurrencyInput.stories.js +1 -1
  50. package/dist/components/DatePicker/DatePicker.d.ts +4 -0
  51. package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
  52. package/dist/components/DatePicker/DatePicker.js +4 -1
  53. package/dist/components/DatePicker/DatePicker.stories.d.ts +1 -0
  54. package/dist/components/DatePicker/DatePicker.stories.d.ts.map +1 -1
  55. package/dist/components/Dropdown/Dropdown.d.ts.map +1 -1
  56. package/dist/components/Dropdown/Dropdown.js +5 -0
  57. package/dist/components/Dropdown/Dropdown.styles.d.ts.map +1 -1
  58. package/dist/components/Dropdown/Dropdown.styles.js +27 -3
  59. package/dist/components/Input/Input.d.ts +1 -1
  60. package/dist/components/Input/Input.d.ts.map +1 -1
  61. package/dist/components/Input/Input.js +17 -15
  62. package/dist/components/Input/Input.stories.js +1 -1
  63. package/dist/components/Pagination/PageItem.d.ts +6 -11
  64. package/dist/components/Pagination/PageItem.d.ts.map +1 -1
  65. package/dist/components/Pagination/PageItem.js +11 -5
  66. package/dist/components/Pagination/Pagination.stories.d.ts +0 -3
  67. package/dist/components/Pagination/Pagination.stories.d.ts.map +1 -1
  68. package/dist/components/Pagination/Pagination.stories.js +5 -15
  69. package/dist/components/Popover/Popover.stories.d.ts.map +1 -1
  70. package/dist/components/Popover/Popover.stories.js +1 -0
  71. package/dist/components/RadioButton/RadioButton.stories.d.ts +0 -10
  72. package/dist/components/RadioButton/RadioButton.stories.d.ts.map +1 -1
  73. package/dist/components/RadioButton/RadioButton.stories.js +1 -38
  74. package/dist/components/RowItem/RowItem.d.ts.map +1 -1
  75. package/dist/components/RowItem/RowItem.js +3 -6
  76. package/dist/components/RowItem/RowItem.stories.d.ts.map +1 -1
  77. package/dist/components/RowItem/RowItem.stories.js +1 -2
  78. package/dist/components/Slider/Slider.stories.js +1 -1
  79. package/dist/components/Snack/Snack.stories.js +1 -1
  80. package/dist/components/Tabs/Tab.d.ts +7 -14
  81. package/dist/components/Tabs/Tab.d.ts.map +1 -1
  82. package/dist/components/Tabs/Tab.js +6 -9
  83. package/dist/components/Tabs/Tabs.stories.d.ts +3 -3
  84. package/dist/components/Tabs/Tabs.stories.d.ts.map +1 -1
  85. package/dist/components/Tabs/Tabs.stories.js +32 -10
  86. package/dist/components/Tabs/Tabs.styles.js +1 -1
  87. package/dist/components/TextArea/TextArea.d.ts +1 -1
  88. package/dist/components/TextArea/TextArea.stories.js +1 -1
  89. package/dist/components/TextLabel/TextLabel.stories.js +1 -1
  90. package/dist/components/ToggleSwitch/ToggleSwitch.stories.js +1 -1
  91. package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
  92. package/dist/components/Tooltip/Tooltip.js +2 -1
  93. package/dist/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
  94. package/dist/components/Tooltip/Tooltip.stories.js +1 -30
  95. package/dist/components/index.d.ts +2 -0
  96. package/dist/components/index.d.ts.map +1 -1
  97. package/dist/components/index.js +1 -0
  98. package/dist/index.d.ts +4 -0
  99. package/dist/index.d.ts.map +1 -1
  100. package/dist/index.js +4 -0
  101. package/dist/patterns/Drawer/Drawer.d.ts +1 -0
  102. package/dist/patterns/Drawer/Drawer.d.ts.map +1 -1
  103. package/dist/patterns/Drawer/Drawer.js +7 -16
  104. package/dist/patterns/Drawer/Drawer.stories.d.ts +6 -0
  105. package/dist/patterns/Drawer/Drawer.stories.d.ts.map +1 -1
  106. package/dist/patterns/Drawer/Drawer.stories.js +23 -24
  107. package/dist/patterns/Drawer/Drawer.styles.d.ts +1 -2
  108. package/dist/patterns/Drawer/Drawer.styles.d.ts.map +1 -1
  109. package/dist/patterns/Drawer/Drawer.styles.js +1 -6
  110. package/dist/patterns/EmptyState/EmptyState.d.ts +1 -1
  111. package/dist/patterns/EmptyState/EmptyState.d.ts.map +1 -1
  112. package/dist/patterns/EmptyState/EmptyState.js +52 -47
  113. package/dist/patterns/EmptyState/EmptyState.stories.d.ts +11 -1
  114. package/dist/patterns/EmptyState/EmptyState.stories.d.ts.map +1 -1
  115. package/dist/patterns/EmptyState/EmptyState.stories.js +51 -12
  116. package/dist/patterns/EmptyState/EmptyState.styles.d.ts +3 -15
  117. package/dist/patterns/EmptyState/EmptyState.styles.d.ts.map +1 -1
  118. package/dist/patterns/EmptyState/EmptyState.styles.js +23 -40
  119. package/dist/patterns/InputGroup/InputGroup.d.ts +1 -1
  120. package/dist/patterns/InputGroup/InputGroup.styles.d.ts.map +1 -1
  121. package/dist/patterns/InputGroup/InputGroup.styles.js +3 -2
  122. package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.d.ts +1 -1
  123. package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.d.ts.map +1 -1
  124. package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.js +4 -0
  125. package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.stories.js +1 -1
  126. package/dist/patterns/Popup/Popup.d.ts +1 -0
  127. package/dist/patterns/Popup/Popup.d.ts.map +1 -1
  128. package/dist/patterns/Popup/Popup.js +6 -15
  129. package/dist/patterns/Popup/Popup.stories.d.ts +6 -0
  130. package/dist/patterns/Popup/Popup.stories.d.ts.map +1 -1
  131. package/dist/patterns/Popup/Popup.stories.js +29 -30
  132. package/dist/patterns/Popup/Popup.styles.d.ts +1 -2
  133. package/dist/patterns/Popup/Popup.styles.d.ts.map +1 -1
  134. package/dist/patterns/Popup/Popup.styles.js +1 -6
  135. package/dist/patterns/RangeInput/RangeInput.d.ts +30 -0
  136. package/dist/patterns/RangeInput/RangeInput.d.ts.map +1 -0
  137. package/dist/patterns/RangeInput/RangeInput.js +27 -0
  138. package/dist/patterns/RangeInput/RangeInput.stories.d.ts +68 -0
  139. package/dist/patterns/RangeInput/RangeInput.stories.d.ts.map +1 -0
  140. package/dist/patterns/RangeInput/RangeInput.stories.js +121 -0
  141. package/dist/patterns/RangeInput/RangeInput.styles.d.ts +5 -0
  142. package/dist/patterns/RangeInput/RangeInput.styles.d.ts.map +1 -0
  143. package/dist/patterns/RangeInput/RangeInput.styles.js +32 -0
  144. package/dist/patterns/SearchInput/SearchInput.d.ts +1 -1
  145. package/dist/patterns/SearchInput/SearchInput.d.ts.map +1 -1
  146. package/dist/patterns/SearchInput/SearchInput.js +7 -8
  147. package/dist/patterns/SearchInput/SearchInput.stories.d.ts.map +1 -1
  148. package/dist/patterns/SearchInput/SearchInput.stories.js +1 -3
  149. package/dist/patterns/Searchbar/Searchbar.d.ts +28 -0
  150. package/dist/patterns/Searchbar/Searchbar.d.ts.map +1 -0
  151. package/dist/patterns/Searchbar/Searchbar.js +37 -0
  152. package/dist/patterns/Searchbar/Searchbar.stories.d.ts +70 -0
  153. package/dist/patterns/Searchbar/Searchbar.stories.d.ts.map +1 -0
  154. package/dist/patterns/Searchbar/Searchbar.stories.js +80 -0
  155. package/dist/patterns/Searchbar/Searchbar.styles.d.ts +3 -0
  156. package/dist/patterns/Searchbar/Searchbar.styles.d.ts.map +1 -0
  157. package/dist/patterns/Searchbar/Searchbar.styles.js +48 -0
  158. package/dist/patterns/TagCloud/TagCloud.d.ts +1 -1
  159. package/dist/patterns/TagCloud/TagCloud.stories.d.ts.map +1 -1
  160. package/dist/patterns/TagCloud/TagCloud.stories.js +1 -5
  161. package/dist/patterns/index.d.ts +4 -0
  162. package/dist/patterns/index.d.ts.map +1 -1
  163. package/dist/patterns/index.js +2 -0
  164. package/dist/storybook/ColorFoundationList.js +2 -2
  165. package/dist/theme/chotot.d.ts +57 -52
  166. package/dist/theme/chotot.d.ts.map +1 -1
  167. package/dist/theme/chotot.js +18 -13
  168. package/dist/theme/ct-job.d.ts +56 -51
  169. package/dist/theme/ct-job.d.ts.map +1 -1
  170. package/dist/theme/ct-pty.d.ts +56 -51
  171. package/dist/theme/ct-pty.d.ts.map +1 -1
  172. package/dist/theme/ct-veh.d.ts +57 -52
  173. package/dist/theme/ct-veh.d.ts.map +1 -1
  174. package/dist/theme/ct-veh.js +1 -1
  175. package/dist/theme/mudah.js +1 -1
  176. package/dist/typography/HeaderAnnotation.d.ts +19 -0
  177. package/dist/typography/HeaderAnnotation.d.ts.map +1 -0
  178. package/dist/typography/HeaderAnnotation.js +15 -0
  179. package/dist/typography/index.d.ts +2 -0
  180. package/dist/typography/index.d.ts.map +1 -1
  181. package/dist/typography/index.js +1 -0
  182. package/dist/utils/index.d.ts +1 -0
  183. package/dist/utils/index.js +1 -0
  184. package/dist/utils/scrollLock/index.d.ts +7 -0
  185. package/dist/utils/scrollLock/index.d.ts.map +1 -0
  186. package/dist/utils/scrollLock/index.js +7 -0
  187. package/dist/utils/scrollLock/scrollLock.styles.d.ts +6 -0
  188. package/dist/utils/scrollLock/scrollLock.styles.d.ts.map +1 -0
  189. package/dist/utils/scrollLock/scrollLock.styles.js +9 -0
  190. package/dist/utils/scrollLock/useBodyScrollLock.d.ts +10 -0
  191. package/dist/utils/scrollLock/useBodyScrollLock.d.ts.map +1 -0
  192. package/dist/utils/scrollLock/useBodyScrollLock.js +41 -0
  193. package/dist/utils/sx.d.ts +8 -8
  194. package/dist/utils/types.d.ts +23 -0
  195. package/dist/utils/types.d.ts.map +1 -0
  196. package/dist/utils/types.js +5 -0
  197. package/package.json +4 -3
  198. package/dist/storybook/GuideImage.d.ts +0 -9
  199. package/dist/storybook/GuideImage.d.ts.map +0 -1
  200. package/dist/storybook/GuideImage.js +0 -40
@@ -1,6 +1,6 @@
1
1
  import theme from '@clad-ui/theme';
2
2
  import { css } from '@linaria/core';
3
- const { colors, radii, fontSizes, typo, space } = theme;
3
+ const { colors, radii, fontSizes, typo, sizes, space } = theme;
4
4
  const buttonClass = css `
5
5
  /* Standard highlight for manual testing & verification */
6
6
  outline: 1px solid var(--cladebug);
@@ -45,10 +45,11 @@ const buttonClass = css `
45
45
 
46
46
  /* Sizes */
47
47
  &.small {
48
- /* outer height: 24px */
49
- ${typo.label.caption}
50
- padding: ${space.xxxs} ${space.xs};
48
+ padding: ${space.none} ${space.xs};
51
49
  border-radius: 6px;
50
+ height: ${sizes.sm};
51
+
52
+ ${typo.label.caption}
52
53
 
53
54
  &.icon {
54
55
  padding: 3px;
@@ -61,11 +62,12 @@ const buttonClass = css `
61
62
 
62
63
  &,
63
64
  &.medium {
64
- /* outer height: 32px */
65
- ${typo.label.section}
66
- padding: ${space.xxs} ${space.sm};
65
+ height: ${sizes.lg};
66
+ padding: ${space.none} ${space.sm};
67
67
  border-radius: ${radii.md};
68
68
 
69
+ ${typo.label.section}
70
+
69
71
  &.icon {
70
72
  padding: 5px;
71
73
  }
@@ -76,11 +78,12 @@ const buttonClass = css `
76
78
  }
77
79
 
78
80
  &.large {
79
- /* outer height: 40px */
80
- ${typo.label.page}
81
- padding: ${space.xs} ${space.md}; /* minus borders */
81
+ height: ${sizes.lxl};
82
+ padding: ${space.none} ${space.md}; /* minus borders 7px - 1px and space.md - 1px */
82
83
  border-radius: ${radii.md};
83
-
84
+
85
+ ${typo.label.page}
86
+
84
87
  &.icon {
85
88
  padding: 7px; /* minus border */
86
89
  }
@@ -90,6 +93,22 @@ const buttonClass = css `
90
93
  }
91
94
  }
92
95
 
96
+ &.xlarge {
97
+ height: ${sizes.xl};
98
+ padding: ${space.none} ${space.md}; /* minus borders 7px - 1px and space.md - 1px */
99
+ border-radius: ${radii.md};
100
+
101
+ ${typo.label.page}
102
+
103
+ &.icon {
104
+ padding: 11px; /* minus border */
105
+ }
106
+
107
+ & > svg {
108
+ font-size: ${fontSizes.xxl};
109
+ }
110
+ }
111
+
93
112
  /* SOLID */
94
113
  &,
95
114
  &.primary {
@@ -1,13 +1,5 @@
1
- import * as React from 'react';
2
- export interface GhostButtonProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
3
- /** null
4
- * The href attribute specifies the link's destination
5
- */
6
- href?: string;
7
- /**
8
- * The target attribute specifies where to open the linked document
9
- */
10
- target?: string;
1
+ import { type HTMLCladUIProps, type ReactRef } from '../../utils/types';
2
+ export interface GhostButtonProps extends HTMLCladUIProps<'a'> {
11
3
  /**
12
4
  * Different looks of button
13
5
  */
@@ -27,7 +19,7 @@ export interface GhostButtonProps extends React.AnchorHTMLAttributes<HTMLAnchorE
27
19
  /**
28
20
  * Button's size
29
21
  */
30
- size?: 'large' | 'medium' | 'small';
22
+ size?: 'xlarge' | 'large' | 'medium' | 'small';
31
23
  /**
32
24
  * Whether this button is disabled. No events triggered.
33
25
  */
@@ -36,32 +28,20 @@ export interface GhostButtonProps extends React.AnchorHTMLAttributes<HTMLAnchorE
36
28
  * Whether this button stretch to fill up container's width
37
29
  */
38
30
  stretch?: boolean;
39
- /**
40
- * Element or component to be rendered as
41
- */
42
- as?: React.ElementType;
43
- /**
44
- * Children
45
- */
46
- children?: React.ReactNode;
47
- /**
48
- * Click event
49
- */
50
- onClick?: React.MouseEventHandler<HTMLElement>;
51
31
  /**
52
32
  * Additional classes to be added for customization
53
33
  */
54
34
  className?: string;
55
35
  /**
56
- * Ref
36
+ * Ref to the DOM node.
57
37
  */
58
- ref?: React.Ref<any>;
38
+ ref?: ReactRef<HTMLAnchorElement | null>;
59
39
  }
60
40
  /**
61
41
  * Renders a standard button element.
62
42
  *
63
43
  * `✅ Stable`
64
44
  */
65
- export declare const Button: React.ForwardRefExoticComponent<Omit<GhostButtonProps, "ref"> & React.RefAttributes<HTMLElement>>;
45
+ export declare const Button: import("../../utils/types").InternalForwardRefRenderFunction<"a", GhostButtonProps>;
66
46
  export default Button;
67
47
  //# sourceMappingURL=GhostButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GhostButton.d.ts","sourceRoot":"","sources":["../../../components/Button/GhostButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,WAAW,gBAAiB,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IACrF;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAC;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;IACtD;;OAEG;IACH,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;IACtC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC3B;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC/C;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CACtB;AAED;;;;GAIG;AAEH,eAAO,MAAM,MAAM,mGA6ClB,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"GhostButton.d.ts","sourceRoot":"","sources":["../../../components/Button/GhostButton.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEpF,MAAM,WAAW,gBAAiB,SAAQ,eAAe,CAAC,GAAG,CAAC;IAC5D;;OAEG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAC;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;IACtD;;OAEG;IACH,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;IACtC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC3B;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC/C;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,GAAG,CAAC,EAAE,QAAQ,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;CAC1C;AAED;;;;GAIG;AAEH,eAAO,MAAM,MAAM,qFAsCjB,CAAC;AAEH,eAAe,MAAM,CAAC"}
@@ -1,23 +1,23 @@
1
1
  import * as React from 'react';
2
2
  import { cx } from '../../utils';
3
3
  import buttonClass from './GhostButton.styles';
4
+ import { forwardRef } from '../../utils/types';
4
5
  /**
5
6
  * Renders a standard button element.
6
7
  *
7
8
  * `✅ Stable`
8
9
  */
9
10
  // Why have 'export' here? https://github.com/storybookjs/storybook/issues/9511
10
- export const Button = React.forwardRef(({ as = 'a', children, href = '', target = '', disabled = false, className, onClick, radius = 'normal', size = 'medium', stretch = false, variant = 'button', weight = 'bold', color = 'link', ...props }, ref) => {
11
+ export const Button = forwardRef((props, ref) => {
12
+ const { as = 'a', children, disabled = false, className, onClick, radius = 'normal', size = 'medium', stretch = false, variant = 'button', weight = 'bold', color = 'link', ...rest } = props;
11
13
  const extraClasses = cx(buttonClass, variant === 'button' ? color : 'hyperlink h-' + color, `r-${radius}`, size, `w-${weight}`, `t-${color}`, stretch && 'stretch', disabled && 'disabled', className);
12
14
  const attrs = {
13
15
  ref,
14
16
  className: extraClasses,
15
- href,
16
- target,
17
17
  disabled: disabled && true,
18
18
  onClick: !disabled && onClick ? onClick : undefined,
19
19
  'data-clad': 'Ghost Button',
20
- ...props,
20
+ ...rest,
21
21
  };
22
22
  return React.createElement(as, attrs, children);
23
23
  });
@@ -1,7 +1,6 @@
1
- import React from 'react';
2
1
  declare const ghostButtonStories: {
3
2
  title: string;
4
- component: React.ForwardRefExoticComponent<Omit<import("./GhostButton").GhostButtonProps, "ref"> & React.RefAttributes<HTMLElement>>;
3
+ component: import("../../utils/types").InternalForwardRefRenderFunction<"a", import("./GhostButton").GhostButtonProps>;
5
4
  tags: string[];
6
5
  parameters: {
7
6
  docs: {
@@ -11,10 +10,88 @@ declare const ghostButtonStories: {
11
10
  };
12
11
  };
13
12
  argTypes: {
13
+ variant: {
14
+ control: {
15
+ type: string;
16
+ };
17
+ options: string[];
18
+ description: string;
19
+ };
20
+ color: {
21
+ control: {
22
+ type: string;
23
+ };
24
+ options: string[];
25
+ description: string;
26
+ };
27
+ radius: {
28
+ control: {
29
+ type: string;
30
+ };
31
+ options: string[];
32
+ description: string;
33
+ };
34
+ weight: {
35
+ control: {
36
+ type: string;
37
+ };
38
+ options: string[];
39
+ description: string;
40
+ };
41
+ size: {
42
+ control: {
43
+ type: string;
44
+ };
45
+ options: string[];
46
+ description: string;
47
+ };
48
+ disabled: {
49
+ control: {
50
+ type: string;
51
+ };
52
+ description: string;
53
+ };
54
+ stretch: {
55
+ control: {
56
+ type: string;
57
+ };
58
+ description: string;
59
+ };
60
+ className: {
61
+ control: {
62
+ type: string;
63
+ };
64
+ description: string;
65
+ };
14
66
  children: {
15
67
  control: {
16
68
  type: string;
17
69
  };
70
+ description: string;
71
+ };
72
+ as: {
73
+ control: {
74
+ type: string;
75
+ };
76
+ options: string[];
77
+ description: string;
78
+ };
79
+ href: {
80
+ control: {
81
+ type: string;
82
+ };
83
+ description: string;
84
+ };
85
+ target: {
86
+ control: {
87
+ type: string;
88
+ };
89
+ options: string[];
90
+ description: string;
91
+ };
92
+ onClick: {
93
+ action: string;
94
+ description: string;
18
95
  };
19
96
  };
20
97
  };
@@ -27,5 +104,6 @@ export declare const Overview: {
27
104
  };
28
105
  export declare const ButtonVariant: () => JSX.Element;
29
106
  export declare const HyperlinkVariant: () => JSX.Element;
107
+ export declare const ButtonWithNextLink: () => JSX.Element;
30
108
  export declare const Disabled: () => JSX.Element;
31
109
  //# sourceMappingURL=GhostButton.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GhostButton.stories.d.ts","sourceRoot":"","sources":["../../../components/Button/GhostButton.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;CAsBvB,CAAC;AACF,eAAe,kBAAkB,CAAC;AAElC,eAAO,MAAM,QAAQ;;;;;CAGpB,CAAC;AAEF,eAAO,MAAM,aAAa,mBAyBzB,CAAC;AAEF,eAAO,MAAM,gBAAgB,mBA8B5B,CAAC;AAEF,eAAO,MAAM,QAAQ,mBASpB,CAAC"}
1
+ {"version":3,"file":"GhostButton.stories.d.ts","sourceRoot":"","sources":["../../../components/Button/GhostButton.stories.tsx"],"names":[],"mappings":"AAUA,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4EvB,CAAC;AACF,eAAe,kBAAkB,CAAC;AAElC,eAAO,MAAM,QAAQ;;;;;CAGpB,CAAC;AAEF,eAAO,MAAM,aAAa,mBA8BzB,CAAC;AAEF,eAAO,MAAM,gBAAgB,mBAmC5B,CAAC;AAEF,eAAO,MAAM,kBAAkB,mBAuC9B,CAAC;AAEF,eAAO,MAAM,QAAQ,mBASpB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import GhostButton from './GhostButton';
3
+ import { BUTTON_RADII, BUTTON_SIZES, BUTTON_WEIGHTS, GHOST_BUTTON_VARIANTS, GHOST_BUTTON_COLORS, } from './constant';
3
4
  const ghostButtonStories = {
4
5
  title: 'Components/Buttons/Ghost Button (Button Link)',
5
6
  component: GhostButton,
@@ -10,16 +11,70 @@ const ghostButtonStories = {
10
11
  component: `Hypelinks (anchor tags) that appear like buttons. It has the same props list as [Button component](../?path=/docs/components-buttons-button--overview)
11
12
  except the \`as\` prop is always \`a\`.
12
13
 
13
- \`✅ Stable\` [\`🎨 Figma Specs\`](https://www.figma.com/file/sPjl33KoaW0bKVZOmm66iQ/CHOTOT-Design-System?node-id=17176%3A32491&t=EPNuQtKvlw2DSxrI-4)
14
+ \`✅ Stable\` [\`🎨 Figma Specs\`](https://www.figma.com/design/DfQM6G9p8PSNEoOzNGRjWD/v3.0-CHOTOT-Design-System---Processing?node-id=41-12614&t=hz8QJLqNrGvTVY8R-4)
14
15
  `,
15
16
  },
16
17
  },
17
18
  },
18
19
  argTypes: {
20
+ variant: {
21
+ control: { type: 'select' },
22
+ options: GHOST_BUTTON_VARIANTS,
23
+ description: 'Different looks of button',
24
+ },
25
+ color: {
26
+ control: { type: 'select' },
27
+ options: GHOST_BUTTON_COLORS,
28
+ description: 'Text color',
29
+ },
30
+ radius: {
31
+ control: { type: 'select' },
32
+ options: BUTTON_RADII,
33
+ description: 'Border radius',
34
+ },
35
+ weight: {
36
+ control: { type: 'select' },
37
+ options: BUTTON_WEIGHTS,
38
+ description: 'Font weight of label',
39
+ },
40
+ size: {
41
+ control: { type: 'select' },
42
+ options: BUTTON_SIZES,
43
+ description: "Button's size",
44
+ },
45
+ disabled: {
46
+ control: { type: 'boolean' },
47
+ description: 'Whether this button is disabled. No events triggered.',
48
+ },
49
+ stretch: {
50
+ control: { type: 'boolean' },
51
+ description: "Whether this button stretch to fill up container's width",
52
+ },
53
+ className: {
54
+ control: { type: 'text' },
55
+ description: 'Additional classes to be added for customization',
56
+ },
19
57
  children: {
20
- control: {
21
- type: 'text',
22
- },
58
+ control: { type: 'text' },
59
+ description: 'Button content/label',
60
+ },
61
+ as: {
62
+ control: { type: 'select' },
63
+ options: ['button', 'a'],
64
+ description: 'HTML element or component to render as',
65
+ },
66
+ href: {
67
+ control: { type: 'text' },
68
+ description: 'URL for the link',
69
+ },
70
+ target: {
71
+ control: { type: 'select' },
72
+ options: ['_blank', '_self', '_parent', '_top'],
73
+ description: 'Where to open the linked document',
74
+ },
75
+ onClick: {
76
+ action: 'clicked',
77
+ description: 'Click event handler',
23
78
  },
24
79
  },
25
80
  };
@@ -28,7 +83,7 @@ export const Overview = {
28
83
  render: (args) => <GhostButton href="#" {...args}/>,
29
84
  args: { children: 'This is a button link' },
30
85
  };
31
- export const ButtonVariant = ( /* args */) => (<div>
86
+ export const ButtonVariant = () => (<div>
32
87
  <GhostButton href="https://clad-ui.chotot.org/" target="_blank" variant="button" color="link">
33
88
  Button Variant
34
89
  </GhostButton>
@@ -42,7 +97,7 @@ export const ButtonVariant = ( /* args */) => (<div>
42
97
  Button Variant
43
98
  </GhostButton>
44
99
  </div>);
45
- export const HyperlinkVariant = ( /* args */) => (<div>
100
+ export const HyperlinkVariant = () => (<div>
46
101
  <GhostButton href="https://clad-ui.chotot.org/" target="_blank" variant="hyperlink" color="link">
47
102
  Hyperlink Variant
48
103
  </GhostButton>
@@ -56,7 +111,25 @@ export const HyperlinkVariant = ( /* args */) => (<div>
56
111
  Hyperlink Variant
57
112
  </GhostButton>
58
113
  </div>);
59
- export const Disabled = ( /* args */) => (<div>
114
+ export const ButtonWithNextLink = () => {
115
+ // replace "a" with NextLink
116
+ const NextLink = 'a';
117
+ return (<div>
118
+ <GhostButton as={NextLink} href="/iframe.html?viewMode=story&id=components-buttons-ghost-button-button-link--button-with-next-link&example=click-me-1" variant="button" color="link">
119
+ Click me 1
120
+ </GhostButton>
121
+ <GhostButton as={NextLink} href="/iframe.html?viewMode=story&id=components-buttons-ghost-button-button-link--button-with-next-link&example=click-me-2" variant="button" color="primary">
122
+ Click me 2
123
+ </GhostButton>
124
+ <GhostButton as={NextLink} href="/iframe.html?viewMode=story&id=components-buttons-ghost-button-button-link--button-with-next-link&example=click-me-3" variant="button" color="secondary">
125
+ Click me 3
126
+ </GhostButton>
127
+ <GhostButton as={NextLink} href="/iframe.html?viewMode=story&id=components-buttons-ghost-button-button-link--button-with-next-link&example=click-me-4" variant="button" color="tertiary">
128
+ Click me 4
129
+ </GhostButton>
130
+ </div>);
131
+ };
132
+ export const Disabled = () => (<div>
60
133
  <GhostButton variant="button" href="https://clad-ui.chotot.org/" target="_blank" disabled>
61
134
  Disabled Button Variant
62
135
  </GhostButton>
@@ -1 +1 @@
1
- {"version":3,"file":"GhostButton.styles.d.ts","sourceRoot":"","sources":["../../../components/Button/GhostButton.styles.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,WAAW,0CAyKhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"GhostButton.styles.d.ts","sourceRoot":"","sources":["../../../components/Button/GhostButton.styles.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,WAAW,0CAyLhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import theme from '@clad-ui/theme';
2
2
  import { css } from '@linaria/core';
3
- const { colors, radii, fontSizes, fontWeights, typo } = theme;
3
+ const { colors, radii, fontSizes, fontWeights, typo, sizes, space } = theme;
4
4
  const buttonClass = css `
5
5
  /* Standard highlight for manual testing & verification */
6
6
  outline: 1px solid var(--cladebug);
@@ -151,6 +151,22 @@ const buttonClass = css `
151
151
  padding: 9px; /* minus borders */
152
152
  }
153
153
 
154
+ &.xlarge {
155
+ height: ${sizes.xl};
156
+ padding: ${space.none} ${space.md}; /* minus borders 7px - 1px and space.md - 1px */
157
+ border-radius: ${radii.md};
158
+
159
+ ${typo.label.page}
160
+
161
+ &.icon {
162
+ padding: 11px; /* minus border */
163
+ }
164
+
165
+ & > svg {
166
+ font-size: ${fontSizes.xxl};
167
+ }
168
+ }
169
+
154
170
  /* Border radius */
155
171
  &.r-normal {
156
172
  border-radius: ${radii.sm};
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { type ButtonProps } from './Button';
3
2
  export interface IconButtonProps extends Omit<ButtonProps, 'stretch' | 'icon'> {
4
3
  }
@@ -7,6 +6,6 @@ export interface IconButtonProps extends Omit<ButtonProps, 'stretch' | 'icon'> {
7
6
  *
8
7
  * `✅ Stable`
9
8
  */
10
- declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
9
+ declare const IconButton: import("../../utils/types").InternalForwardRefRenderFunction<"button", IconButtonProps>;
11
10
  export default IconButton;
12
11
  //# sourceMappingURL=IconButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../components/Button/IconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAe,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAEpD,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,CAAC;CAAG;AAEjF;;;;GAIG;AAEH,QAAA,MAAM,UAAU,2FAuBf,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../components/Button/IconButton.tsx"],"names":[],"mappings":"AACA,OAAe,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAGpD,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,CAAC;CAAG;AAEjF;;;;GAIG;AAEH,QAAA,MAAM,UAAU,yFAEd,CAAC;AAEH,eAAe,UAAU,CAAC"}
@@ -1,15 +1,10 @@
1
1
  import * as React from 'react';
2
2
  import Button from './Button';
3
+ import { forwardRef } from '../../utils/types';
3
4
  /**
4
5
  * Icons as interactive buttons / links. It has the same props list as [Button component](/docs/components-shapeicon--docs)
5
6
  *
6
7
  * `✅ Stable`
7
8
  */
8
- const IconButton = React.forwardRef(({ as = 'a', color = 'primary', variant = 'solid', radius = 'normal', size = 'medium', children, disabled = false, extraClasses, onClick, }, ref) => {
9
- const props = { color, variant, radius, size, children, disabled, extraClasses, onClick };
10
- if (as !== 'a' && as !== 'button') {
11
- throw new Error(`IconButton must be rendered as <a> or <button>. It is currently rendered as ${as}`);
12
- }
13
- return <Button icon as={as} {...props} data-clad="Icon Button" ref={ref}/>;
14
- });
9
+ const IconButton = forwardRef((props, ref) => (<Button icon ref={ref} data-clad="Icon Button" {...props}/>));
15
10
  export default IconButton;
@@ -1,7 +1,6 @@
1
- import React from 'react';
2
1
  declare const iconButtonStories: {
3
2
  title: string;
4
- component: React.ForwardRefExoticComponent<import("./IconButton").IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
3
+ component: import("../../utils/types").InternalForwardRefRenderFunction<"button", import("./IconButton").IconButtonProps>;
5
4
  tags: string[];
6
5
  parameters: {
7
6
  docs: {
@@ -11,11 +10,83 @@ declare const iconButtonStories: {
11
10
  };
12
11
  };
13
12
  argTypes: {
14
- as: {
13
+ variant: {
14
+ control: {
15
+ type: string;
16
+ };
17
+ options: import("./Button").ButtonVariant[];
18
+ description: string;
19
+ };
20
+ color: {
21
+ control: {
22
+ type: string;
23
+ };
24
+ options: import("./Button").ButtonColor[];
25
+ description: string;
26
+ };
27
+ radius: {
28
+ control: {
29
+ type: string;
30
+ };
15
31
  options: string[];
32
+ description: string;
33
+ };
34
+ weight: {
16
35
  control: {
17
36
  type: string;
18
37
  };
38
+ options: string[];
39
+ description: string;
40
+ };
41
+ size: {
42
+ control: {
43
+ type: string;
44
+ };
45
+ options: string[];
46
+ description: string;
47
+ };
48
+ width: {
49
+ control: {
50
+ type: string;
51
+ };
52
+ options: string[];
53
+ description: string;
54
+ };
55
+ disabled: {
56
+ control: {
57
+ type: string;
58
+ };
59
+ description: string;
60
+ };
61
+ extraClasses: {
62
+ control: {
63
+ type: string;
64
+ };
65
+ description: string;
66
+ };
67
+ isLoading: {
68
+ control: {
69
+ type: string;
70
+ };
71
+ description: string;
72
+ };
73
+ children: {
74
+ control: {
75
+ type: string;
76
+ };
77
+ options: string[];
78
+ description: string;
79
+ };
80
+ as: {
81
+ control: {
82
+ type: string;
83
+ };
84
+ options: string[];
85
+ description: string;
86
+ };
87
+ onClick: {
88
+ action: string;
89
+ description: string;
19
90
  };
20
91
  };
21
92
  };
@@ -58,4 +129,5 @@ export declare const ExtraClasses: {
58
129
  };
59
130
  };
60
131
  };
132
+ export declare const ButtonWithNextLink: () => JSX.Element;
61
133
  //# sourceMappingURL=IconButton.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"IconButton.stories.d.ts","sourceRoot":"","sources":["../../../components/Button/IconButton.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;CAsBtB,CAAC;AAEF,eAAe,iBAAiB,CAAC;AAEjC,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;CA0BpB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;CAyBpB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;CAgCxB,CAAC"}
1
+ {"version":3,"file":"IconButton.stories.d.ts","sourceRoot":"","sources":["../../../components/Button/IconButton.stories.tsx"],"names":[],"mappings":"AAkBA,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwEtB,CAAC;AAEF,eAAe,iBAAiB,CAAC;AAEjC,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;CA0BpB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;CAwBpB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;CAgCxB,CAAC;AAEF,eAAO,MAAM,kBAAkB,mBA2C9B,CAAC"}