@chotot/clad-ui 2.0.0-next.4 โ†’ 2.0.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 (128) hide show
  1. package/README.md +5 -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.stories.d.ts.map +1 -1
  5. package/dist/components/Badge/Badge.stories.js +1 -2
  6. package/dist/components/Breadcrumbs/BreadcrumbItem.d.ts +6 -0
  7. package/dist/components/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -0
  8. package/dist/components/Breadcrumbs/BreadcrumbItem.js +10 -0
  9. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
  10. package/dist/components/Breadcrumbs/Breadcrumbs.js +7 -25
  11. package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts +0 -11
  12. package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts.map +1 -1
  13. package/dist/components/Breadcrumbs/Breadcrumbs.stories.js +28 -83
  14. package/dist/components/Button/Button.d.ts +7 -16
  15. package/dist/components/Button/Button.d.ts.map +1 -1
  16. package/dist/components/Button/Button.js +5 -3
  17. package/dist/components/Button/Button.stories.d.ts +2 -2
  18. package/dist/components/Button/Button.stories.d.ts.map +1 -1
  19. package/dist/components/Button/Button.stories.js +19 -1
  20. package/dist/components/Button/Button.styles.d.ts.map +1 -1
  21. package/dist/components/Button/Button.styles.js +14 -11
  22. package/dist/components/Button/GhostButton.d.ts +5 -25
  23. package/dist/components/Button/GhostButton.d.ts.map +1 -1
  24. package/dist/components/Button/GhostButton.js +4 -4
  25. package/dist/components/Button/GhostButton.stories.d.ts +2 -2
  26. package/dist/components/Button/GhostButton.stories.d.ts.map +1 -1
  27. package/dist/components/Button/GhostButton.stories.js +19 -1
  28. package/dist/components/Button/IconButton.d.ts +1 -2
  29. package/dist/components/Button/IconButton.d.ts.map +1 -1
  30. package/dist/components/Button/IconButton.js +2 -7
  31. package/dist/components/Button/IconButton.stories.d.ts +2 -2
  32. package/dist/components/Button/IconButton.stories.d.ts.map +1 -1
  33. package/dist/components/Button/IconButton.stories.js +18 -0
  34. package/dist/components/Checkbox/Checkbox.stories.d.ts +0 -10
  35. package/dist/components/Checkbox/Checkbox.stories.d.ts.map +1 -1
  36. package/dist/components/Checkbox/Checkbox.stories.js +1 -34
  37. package/dist/components/Chip/Chip.stories.js +1 -1
  38. package/dist/components/CurrencyInput/CurrencyInput.stories.js +1 -1
  39. package/dist/components/Input/Input.d.ts.map +1 -1
  40. package/dist/components/Input/Input.js +2 -13
  41. package/dist/components/Input/Input.stories.js +1 -1
  42. package/dist/components/Pagination/PageItem.d.ts +6 -11
  43. package/dist/components/Pagination/PageItem.d.ts.map +1 -1
  44. package/dist/components/Pagination/PageItem.js +11 -5
  45. package/dist/components/Pagination/Pagination.stories.d.ts +0 -3
  46. package/dist/components/Pagination/Pagination.stories.d.ts.map +1 -1
  47. package/dist/components/Pagination/Pagination.stories.js +5 -15
  48. package/dist/components/Popover/Popover.stories.d.ts.map +1 -1
  49. package/dist/components/Popover/Popover.stories.js +1 -0
  50. package/dist/components/RadioButton/RadioButton.stories.d.ts +0 -10
  51. package/dist/components/RadioButton/RadioButton.stories.d.ts.map +1 -1
  52. package/dist/components/RadioButton/RadioButton.stories.js +1 -38
  53. package/dist/components/RowItem/RowItem.stories.d.ts.map +1 -1
  54. package/dist/components/RowItem/RowItem.stories.js +1 -2
  55. package/dist/components/Slider/Slider.stories.js +1 -1
  56. package/dist/components/Snack/Snack.stories.js +1 -1
  57. package/dist/components/Tabs/Tab.d.ts +7 -14
  58. package/dist/components/Tabs/Tab.d.ts.map +1 -1
  59. package/dist/components/Tabs/Tab.js +5 -9
  60. package/dist/components/Tabs/Tabs.stories.d.ts +3 -3
  61. package/dist/components/Tabs/Tabs.stories.d.ts.map +1 -1
  62. package/dist/components/Tabs/Tabs.stories.js +32 -10
  63. package/dist/components/TextArea/TextArea.stories.js +1 -1
  64. package/dist/components/TextLabel/TextLabel.stories.js +1 -1
  65. package/dist/components/ToggleSwitch/ToggleSwitch.stories.js +1 -1
  66. package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
  67. package/dist/components/Tooltip/Tooltip.js +2 -1
  68. package/dist/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
  69. package/dist/components/Tooltip/Tooltip.stories.js +1 -30
  70. package/dist/components/index.d.ts +2 -0
  71. package/dist/components/index.d.ts.map +1 -1
  72. package/dist/components/index.js +1 -0
  73. package/dist/index.d.ts +1 -0
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +1 -0
  76. package/dist/patterns/Drawer/Drawer.d.ts +1 -0
  77. package/dist/patterns/Drawer/Drawer.d.ts.map +1 -1
  78. package/dist/patterns/Drawer/Drawer.js +7 -16
  79. package/dist/patterns/Drawer/Drawer.stories.d.ts +6 -0
  80. package/dist/patterns/Drawer/Drawer.stories.d.ts.map +1 -1
  81. package/dist/patterns/Drawer/Drawer.stories.js +23 -24
  82. package/dist/patterns/Drawer/Drawer.styles.d.ts +1 -2
  83. package/dist/patterns/Drawer/Drawer.styles.d.ts.map +1 -1
  84. package/dist/patterns/Drawer/Drawer.styles.js +1 -6
  85. package/dist/patterns/EmptyState/EmptyState.stories.js +1 -1
  86. package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.stories.js +1 -1
  87. package/dist/patterns/Popup/Popup.d.ts +1 -0
  88. package/dist/patterns/Popup/Popup.d.ts.map +1 -1
  89. package/dist/patterns/Popup/Popup.js +6 -15
  90. package/dist/patterns/Popup/Popup.stories.d.ts +6 -0
  91. package/dist/patterns/Popup/Popup.stories.d.ts.map +1 -1
  92. package/dist/patterns/Popup/Popup.stories.js +29 -30
  93. package/dist/patterns/Popup/Popup.styles.d.ts +1 -2
  94. package/dist/patterns/Popup/Popup.styles.d.ts.map +1 -1
  95. package/dist/patterns/Popup/Popup.styles.js +1 -6
  96. package/dist/patterns/SearchInput/SearchInput.stories.d.ts.map +1 -1
  97. package/dist/patterns/SearchInput/SearchInput.stories.js +1 -3
  98. package/dist/patterns/TagCloud/TagCloud.stories.d.ts.map +1 -1
  99. package/dist/patterns/TagCloud/TagCloud.stories.js +1 -5
  100. package/dist/theme/chotot.d.ts +49 -48
  101. package/dist/theme/chotot.d.ts.map +1 -1
  102. package/dist/theme/chotot.js +8 -7
  103. package/dist/theme/ct-job.d.ts +48 -47
  104. package/dist/theme/ct-job.d.ts.map +1 -1
  105. package/dist/theme/ct-pty.d.ts +48 -47
  106. package/dist/theme/ct-pty.d.ts.map +1 -1
  107. package/dist/theme/ct-veh.d.ts +49 -48
  108. package/dist/theme/ct-veh.d.ts.map +1 -1
  109. package/dist/theme/ct-veh.js +1 -1
  110. package/dist/utils/index.d.ts +1 -0
  111. package/dist/utils/index.js +1 -0
  112. package/dist/utils/scrollLock/index.d.ts +7 -0
  113. package/dist/utils/scrollLock/index.d.ts.map +1 -0
  114. package/dist/utils/scrollLock/index.js +7 -0
  115. package/dist/utils/scrollLock/scrollLock.styles.d.ts +6 -0
  116. package/dist/utils/scrollLock/scrollLock.styles.d.ts.map +1 -0
  117. package/dist/utils/scrollLock/scrollLock.styles.js +9 -0
  118. package/dist/utils/scrollLock/useBodyScrollLock.d.ts +10 -0
  119. package/dist/utils/scrollLock/useBodyScrollLock.d.ts.map +1 -0
  120. package/dist/utils/scrollLock/useBodyScrollLock.js +41 -0
  121. package/dist/utils/sx.d.ts +8 -8
  122. package/dist/utils/types.d.ts +23 -0
  123. package/dist/utils/types.d.ts.map +1 -0
  124. package/dist/utils/types.js +5 -0
  125. package/package.json +4 -3
  126. package/dist/storybook/GuideImage.d.ts +0 -9
  127. package/dist/storybook/GuideImage.d.ts.map +0 -1
  128. package/dist/storybook/GuideImage.js +0 -40
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <!-- badges -->
2
2
 
3
- [<img src="https://img.shields.io/badge/clad--ui-2.0.0--next.4-FFBA00" alt="clad-ui npm version" />](http://npmjs.cmco.io/-/web/detail/clad-ui)
3
+ [<img src="https://img.shields.io/badge/clad--ui-2.0.0-FFBA00" alt="clad-ui npm version" />](http://npmjs.cmco.io/-/web/detail/clad-ui)
4
4
  [<img src="https://img.shields.io/badge/@clad--ui/charts-1.0.2-FFBA00" alt="@clad-ui/charts npm version" />](http://npmjs.cmco.io/-/web/detail/clad-ui)
5
5
  [<img src="https://img.shields.io/badge/react-%3E=16.8-0088CC" alt="React dependency version" />](https://github.com/facebook/react/)
6
6
  [<img src="https://img.shields.io/badge/linaria-^4.2.10-DE2D68" alt="Linaria dependency version" />](https://github.com/callstack/linaria)
@@ -55,7 +55,7 @@ Maintaining the system:
55
55
  ## Components Status
56
56
 
57
57
  **Date update:**
58
- 2023-02-21
58
+ 2025-07-31
59
59
 
60
60
  | No | Component | Web | iOS | Android |
61
61
  | --- | ------------------------ | ------- | --- | ------- |
@@ -78,7 +78,7 @@ Maintaining the system:
78
78
  | 17 | LegacyDialog | โœ… 1.0+ | | |
79
79
  | 18 | LegacyPopup | โœ… 1.0+ | | |
80
80
  | 19 | MultiSearchDropdown\* | โœ… 1.0+ | | โœ… |
81
- | 20 | Notification | N/A | | โœ… |
81
+ | 20 | Notification | N/A | | โœ… |
82
82
  | 21 | Input/ Input Text | โœ… 1.2+ | โœ… | โœ… |
83
83
  | 22 | InputGroup | โœ… 1.0+ | โœ… | |
84
84
  | 23 | Popup | โœ… 1.2+ | | โœ… |
@@ -95,7 +95,7 @@ Maintaining the system:
95
95
  | 34 | TextLabel | โœ… 1.5+ | โœ… | โœ… |
96
96
  | 35 | ToggleSwitch | โœ… 1.0+ | | โœ… |
97
97
  | 36 | Tooltip | โœ… 1.0+ | โœ… | โœ… |
98
- | 37 | Pagination | ๐Ÿงช 1.6+ | | |
98
+ | 37 | Pagination | ๐Ÿงช 1.6+ | | |
99
99
 
100
100
  **Legend:**
101
101
  โœ…: stable; ๐Ÿงช: beta; โš ๏ธ: deprecated; [1.0+]: since this version
@@ -124,11 +124,7 @@ Open browser Devtool (F12) and add following CSS to the `:root` element:
124
124
 
125
125
  ## Frequently Asked Questions
126
126
 
127
- #### 1. Does this design system work with `create-react-app`?
128
-
129
- Yes. Since our solution introduce a custom Babel plugin and Webpack loader, it's not possible to use `clad-ui` with non-configurable `react-scripts`. You have to eject `react-scripts` to be able to customize Babel and webpack config or use [`react-app-rewired`](https://github.com/timarney/react-app-rewired).
130
-
131
- #### 2. Does this design system work with `Next.js` apps?
127
+ #### 1. Does this design system work with `Next.js` apps?
132
128
 
133
129
  Yes. But it requires custom next.js config. Refer to [Chotot Next.js Framework](https://github.com/carousell/ct-next-starterkit/) to see how it's configured.
134
130
 
@@ -1 +1 @@
1
- {"version":3,"file":"Announcer.stories.d.ts","sourceRoot":"","sources":["../../../components/Announcer/Announcer.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAQnD,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqDrB,CAAC;AAEF,eAAe,gBAAgB,CAAC;AAOhC,eAAO,MAAM,QAAQ;;CAmBpB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;CAiCxB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;CAoCzB,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;CAmB9B,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;;CAiFpB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;CAmBtB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;CAsCvB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;CAsBxB,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;CAwC9B,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;CAuCtB,CAAC"}
1
+ {"version":3,"file":"Announcer.stories.d.ts","sourceRoot":"","sources":["../../../components/Announcer/Announcer.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAKnD,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqDrB,CAAC;AAEF,eAAe,gBAAgB,CAAC;AAOhC,eAAO,MAAM,QAAQ;;CAmBpB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;CA6BxB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;CAoCzB,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;CAmB9B,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;;CAiFpB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;CAmBtB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;CAsCvB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;CAsBxB,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;CAwC9B,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;CAiBtB,CAAC"}
@@ -1,9 +1,6 @@
1
1
  import React, { useState, useEffect } from 'react';
2
- import GuideImage from '../../storybook/GuideImage';
3
2
  import Button from '../Button/Button';
4
3
  import Announcer from './Announcer';
5
- import Grid from '../Grid/Grid';
6
- import Col from '../Grid/Col';
7
4
  import { Heart } from '../../icons';
8
5
  const announcerStories = {
9
6
  title: 'Components/Announcer',
@@ -14,7 +11,7 @@ const announcerStories = {
14
11
  description: {
15
12
  component: `Announcer box is used to displayed system messages, which can be dismissed.
16
13
 
17
- \`โœ… Stable\` [\`๐ŸŽจ Figma Specs\`](https://www.figma.com/file/sPjl33KoaW0bKVZOmm66iQ/CHOTOT-Design-System?node-id=17176%3A31672&t=KSxcQ4tweTEzgFwq-4)
14
+ \`โœ… Stable\` [\`๐ŸŽจ Figma Specs\`](https://www.figma.com/design/DfQM6G9p8PSNEoOzNGRjWD/v3.0-CHOTOT-Design-System---Processing?node-id=38-11659&t=hz8QJLqNrGvTVY8R-4)
18
15
 
19
16
  ## How to use
20
17
 
@@ -290,29 +287,7 @@ export const UsageGuide = {
290
287
  On mobile viewport, when Announcer description (a.k.a children or dangerousHtml prop) number
291
288
  of line is more than 4, it will be truncated into 2 with an expand button.
292
289
  </p>
293
- <GuideImage src="./announcer-collapsed.png" alt="Announcer - Collapsed"/>
294
290
  <br />
295
- <h4>DO&apos;s</h4>
296
- <Grid rowCols={[1, 1, 2]} gutterx="sm" align="center">
297
- <Col>
298
- <GuideImage isGood src="./announcer-do-1.png" alt="Announcer - Do_1"/>
299
- </Col>
300
- <Col>
301
- <GuideImage isGood src="./announcer-do-2.png" alt="Announcer - Do_2"/>
302
- </Col>
303
- </Grid>
304
- <br />
305
- <h4>DON&apos;Ts</h4>
306
- <Grid rowCols={[1, 1, 2]} gutterx="sm" align="center">
307
- <Col>
308
- <GuideImage isBad src="./announcer-dont-1.png" alt="Announcer - Dont_1"/>
309
- <p>Wrong icon as well as background-color.</p>
310
- </Col>
311
- <Col>
312
- <GuideImage isBad src="./announcer-dont-2.png" alt="Announcer - Dont_2"/>
313
- <p>Wrong color on both regular Announcer and empty state Announcer.</p>
314
- </Col>
315
- </Grid>
316
291
  </>),
317
292
  parameters: {
318
293
  docs: {
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.stories.d.ts","sourceRoot":"","sources":["../../../components/Badge/Badge.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;CA6Bf,CAAC;AAEF,eAAe,UAAU,CAAC;AAE1B,eAAO,MAAM,QAAQ;;CAiBpB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;CAqCxB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;CA6BzB,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;CA+D5B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;CAqDhC,CAAC"}
1
+ {"version":3,"file":"Badge.stories.d.ts","sourceRoot":"","sources":["../../../components/Badge/Badge.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;CA4Bf,CAAC;AAEF,eAAe,UAAU,CAAC;AAE1B,eAAO,MAAM,QAAQ;;CAiBpB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;CAqCxB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;CA6BzB,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;CA+D5B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;CAqDhC,CAAC"}
@@ -15,7 +15,7 @@ const badgeStory = {
15
15
  description: {
16
16
  component: `Badge Component for menus and notifications
17
17
 
18
- \`โœ… Stable\` [\`๐ŸŽจ Figma Specs\`](https://www.figma.com/file/sPjl33KoaW0bKVZOmm66iQ/CHOTOT-Design-System?node-id=17176%3A39136&t=EPNuQtKvlw2DSxrI-4)
18
+ \`โœ… Stable\` [\`๐ŸŽจ Figma Specs\`](https://www.figma.com/design/DfQM6G9p8PSNEoOzNGRjWD/v3.0-CHOTOT-Design-System---Processing?node-id=42-33055&t=hz8QJLqNrGvTVY8R-4)
19
19
 
20
20
  ## How to use
21
21
  Badge component is a static components which usually use in draw attention or supply count for some notification components
@@ -26,7 +26,6 @@ const badgeStory = {
26
26
  - Badge use \`string\` for color which mean \`Hex\` color or \`string\` or \`color from themes\` are all usable
27
27
  \`Example (red, #fcfcfc, theme.colors.orange2)\`
28
28
 
29
- <img src="./badge-how-to.png" />
30
29
  `,
31
30
  },
32
31
  },
@@ -0,0 +1,6 @@
1
+ import { type GhostButtonProps } from '../Button/GhostButton';
2
+ export interface BreadcrumbItemProps extends GhostButtonProps {
3
+ }
4
+ declare const BreadcrumbItem: import("../../utils/types").InternalForwardRefRenderFunction<"a", BreadcrumbItemProps>;
5
+ export default BreadcrumbItem;
6
+ //# sourceMappingURL=BreadcrumbItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BreadcrumbItem.d.ts","sourceRoot":"","sources":["../../../components/Breadcrumbs/BreadcrumbItem.tsx"],"names":[],"mappings":"AAIA,OAAoB,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE3E,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;CAAG;AAEhE,QAAA,MAAM,cAAc,wFAelB,CAAC;AAEH,eAAe,cAAc,CAAC"}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { cx } from '../../utils';
3
+ import { labelClass } from './Breadcrumbs.styles';
4
+ import { forwardRef } from '../../utils/types';
5
+ import GhostButton from '../Button/GhostButton';
6
+ const BreadcrumbItem = forwardRef((props, ref) => {
7
+ const { as = 'a', className, ...rest } = props;
8
+ return (<GhostButton className={cx(labelClass, className)} as={as} ref={ref} variant="hyperlink" size="small" weight="normal" color="tertiary" {...rest}/>);
9
+ });
10
+ export default BreadcrumbItem;
@@ -1 +1 @@
1
- {"version":3,"file":"Breadcrumbs.d.ts","sourceRoot":"","sources":["../../../components/Breadcrumbs/Breadcrumbs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA2D/B,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;IAC9C;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAmB3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"Breadcrumbs.d.ts","sourceRoot":"","sources":["../../../components/Breadcrumbs/Breadcrumbs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAsB/B,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;IAC9C;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAwB3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,34 +1,16 @@
1
1
  import * as React from 'react';
2
2
  import { Children, isValidElement } from 'react';
3
3
  import { cx } from '../../utils';
4
- import { StyledBreadcrumbs, Placeholder, labelClass, separatorClass } from './Breadcrumbs.styles';
5
- import ButtonLink from '../Button/ButtonLink';
4
+ import { StyledBreadcrumbs, Placeholder, separatorClass } from './Breadcrumbs.styles';
5
+ import BreadcrumbItem from './BreadcrumbItem';
6
6
  const mapElementToListItem = (element, isLast) => {
7
- // normal <a>
8
- if (element.type === 'a') {
9
- // last element in breadcrumb must not be rendered as <a>
10
- return isLast ? (<span itemProp="name" style={{ marginLeft: '4px' }}>
7
+ if (isLast) {
8
+ return (<span itemProp="name" style={{ marginLeft: '4px' }}>
11
9
  {element.props.children}
12
- </span>) : (<>
13
- <ButtonLink variant="hyperlink" size="small" weight="normal" href={element.props.href} color="tertiary" className={labelClass}>
14
- {element.props.children}
15
- </ButtonLink>
16
- <span className={separatorClass}>/</span>
17
- </>);
10
+ </span>);
18
11
  }
19
- // <a> with wrapper tag
20
- const childrenElement = element.props.children;
21
- if (childrenElement.type !== 'a') {
22
- // not render elements with wrong structure
23
- return null;
24
- }
25
- // last element in breadcrumb must not be rendered as <a>
26
- return isLast ? (<span itemProp="item" style={{ marginLeft: '4px' }}>
27
- {childrenElement.props.children}
28
- </span>) : (<>
29
- <ButtonLink variant="hyperlink" size="small" weight="normal" href={childrenElement.props.href} color="tertiary" className={labelClass}>
30
- {childrenElement.props.children}
31
- </ButtonLink>
12
+ return (<>
13
+ <BreadcrumbItem {...element.props}/>
32
14
  <span className={separatorClass}>/</span>
33
15
  </>);
34
16
  };
@@ -24,17 +24,6 @@ export default breadcrumbsStories;
24
24
  export declare const Overview: {
25
25
  render: (args: any) => JSX.Element;
26
26
  };
27
- export declare const ChildrenWithWrapper: {
28
- render: () => JSX.Element;
29
- name: string;
30
- parameters: {
31
- docs: {
32
- description: {
33
- story: string;
34
- };
35
- };
36
- };
37
- };
38
27
  export declare const WithIsShow: {
39
28
  render: () => JSX.Element;
40
29
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Breadcrumbs.stories.d.ts","sourceRoot":"","sources":["../../../components/Breadcrumbs/Breadcrumbs.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAC;AA0BxC,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;CA4CvB,CAAC;AAEF,eAAe,kBAAkB,CAAC;AAElC,eAAO,MAAM,QAAQ;;CAQpB,CAAC;AAqCF,eAAO,MAAM,mBAAmB;;;;;;;;;;CAyB/B,CAAC;AAEF,eAAO,MAAM,UAAU;;;CAmBtB,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;CA2BlC,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;CA2BxB,CAAC"}
1
+ {"version":3,"file":"Breadcrumbs.stories.d.ts","sourceRoot":"","sources":["../../../components/Breadcrumbs/Breadcrumbs.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAMxC,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;CA0CvB,CAAC;AAEF,eAAe,kBAAkB,CAAC;AAElC,eAAO,MAAM,QAAQ;;CAUpB,CAAC;AAEF,eAAO,MAAM,UAAU;;;CAmBtB,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;CA2BlC,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;CA4BxB,CAAC"}
@@ -1,28 +1,8 @@
1
- /* eslint-disable jsx-a11y/anchor-is-valid */
2
1
  import React, { useState } from 'react';
3
- import { css } from '@linaria/core';
4
- import { guideImageClass } from '../../storybook/GuideImage';
5
2
  import Breadcrumbs from './Breadcrumbs';
6
3
  import Button from '../Button/Button';
7
4
  import Box from '../Box/Box';
8
- const gridClass = css `
9
- /* stylelint-disable declaration-no-important */
10
- display: flex;
11
- justify-content: space-between;
12
- flex-wrap: wrap;
13
- margin: 0 -8px !important;
14
-
15
- & > div {
16
- padding: 0 8px;
17
- width: 100%;
18
- }
19
-
20
- @media screen and (min-width: 992px) {
21
- & > div {
22
- width: 50%;
23
- }
24
- }
25
- `;
5
+ import BreadcrumbItem from './BreadcrumbItem';
26
6
  const breadcrumbsStories = {
27
7
  title: 'Components/Breadcrumbs',
28
8
  component: Breadcrumbs,
@@ -32,7 +12,7 @@ const breadcrumbsStories = {
32
12
  description: {
33
13
  component: `Breadcrumbs displays the current location within a hierarchy. It allows going back to states higher up in the hierarchy.
34
14
 
35
- \`๐ŸงชBeta\` [\`๐ŸŽจ Figma Specs\`](https://www.figma.com/file/sPjl33KoaW0bKVZOmm66iQ/CHOTOT-Design-System?node-id=17176%3A32420&t=EPNuQtKvlw2DSxrI-4)
15
+ \`๐Ÿงช Beta\` [\`๐ŸŽจ Figma Specs\`](https://www.figma.com/design/DfQM6G9p8PSNEoOzNGRjWD/v3.0-CHOTOT-Design-System---Processing?node-id=42-33451&t=hz8QJLqNrGvTVY8R-4)
36
16
 
37
17
  ## How to use
38
18
 
@@ -47,15 +27,13 @@ Elements with wrong format will not be rendered.
47
27
 
48
28
  The last item will have its \`a\` tag replaced with \`span\`.
49
29
 
50
- <div className="${gridClass}">
30
+ <div>
51
31
  <div>
52
32
  <p>On mobile, Breadcrumbs is scrollable if necessary.</p>
53
- <img className="${guideImageClass}" src="./breadcrumbs-how-1.png" />
54
33
  </div>
55
-
34
+
56
35
  <div>
57
36
  <p>On desktop, Breadcrumbs is not scrollable. Overflow text content will be truncated.</p>
58
- <img className="${guideImageClass}" src="./breadcrumbs-how-2.png" />
59
37
  </div>
60
38
  </div>
61
39
  `,
@@ -71,47 +49,12 @@ The last item will have its \`a\` tag replaced with \`span\`.
71
49
  export default breadcrumbsStories;
72
50
  export const Overview = {
73
51
  render: (args) => (<Breadcrumbs {...args}>
74
- <a href="/">Chแปฃ Tแป‘t</a>
75
- <a href="/toan-quoc/mua-ban">Toร n quแป‘c</a>
76
- <a href="/toan-quoc/mua-ban-do-gia-dung-noi-that-cay-canh">ฤแป“ gia dแปฅng, nแป™i thแบฅt, cรขy cแบฃnh</a>
77
- </Breadcrumbs>),
78
- };
79
- /**
80
- * Mimic `next/link` component
81
- */
82
- const Link = React.forwardRef(function LinkComponent({ href, children = '', legacyBehavior, prefetch, replace }, ref) {
83
- const handleClick = (event) => {
84
- // stop default hyperlink redirection
85
- event.preventDefault();
86
- // eslint-disable-next-line no-alert
87
- alert(`Simulated Next.js Link click to ${href} ${legacyBehavior ? 'with legacyBehavior' : ''} ${prefetch ? 'and prefetch' : ''} ${replace ? 'and replace' : ''}`);
88
- };
89
- return (<a href={href} onClick={handleClick} ref={ref}>
90
- {children && children.type === 'a'
91
- ? children.props.children
92
- : children}
93
- </a>);
94
- });
95
- export const ChildrenWithWrapper = {
96
- render: () => (<Breadcrumbs>
97
- <Link href="/">
98
- <a>Chแปฃ Tแป‘t</a>
99
- </Link>
100
- <Link href="/toan-quoc/mua-ban">
101
- <a>Toร n quแป‘c</a>
102
- </Link>
103
- <Link href="/toan-quoc/mua-ban-do-gia-dung-noi-that-cay-canh">
104
- <a>ฤแป“ gia dแปฅng, nแป™i thแบฅt, cรขy cแบฃnh</a>
105
- </Link>
52
+ <BreadcrumbItem href="/">Chแปฃ Tแป‘t</BreadcrumbItem>
53
+ <BreadcrumbItem href="/toan-quoc/mua-ban">Toร n quแป‘c</BreadcrumbItem>
54
+ <BreadcrumbItem href="/toan-quoc/mua-ban-do-gia-dung-noi-that-cay-canh">
55
+ ฤแป“ gia dแปฅng, nแป™i thแบฅt, cรขy cแบฃnh
56
+ </BreadcrumbItem>
106
57
  </Breadcrumbs>),
107
- name: 'Children with wrapper',
108
- parameters: {
109
- docs: {
110
- description: {
111
- story: 'Breadcrumbs will only inject meta data into `a` tags inside wrapper tags, it will not modify original behavior, which means we can safely use `Link` component in Next.js for client-side routing as children.',
112
- },
113
- },
114
- },
115
58
  };
116
59
  export const WithIsShow = {
117
60
  render: () => {
@@ -155,26 +98,28 @@ export const LongBreadcrumbsExample = {
155
98
  },
156
99
  };
157
100
  export const WithNextLink = {
158
- render: () => (<Box maxWidth={['full', '$md']}>
159
- <Breadcrumbs>
160
- <a href="/" target="_blank">
161
- Chแปฃ Tแป‘t
162
- </a>
163
- <Link prefetch href="/do-dien-tu" replace>
164
- ฤแป“ ฤ‘iแป‡n tแปญ
165
- </Link>
166
- <Link legacyBehavior href="/mua-ban-dien-thoai">
167
- <a>ฤiแป‡n thoแบกi</a>
168
- </Link>
169
- <a href="/mua-ban-dien-thoai-apple-sdmd1" target="_blank">
170
- Apple
171
- </a>
172
- </Breadcrumbs>
173
- </Box>),
101
+ render: () => {
102
+ // replace "a" with NextLink
103
+ const NextLink = 'a';
104
+ return (<Box maxWidth={['full', '$md']}>
105
+ <Breadcrumbs>
106
+ <BreadcrumbItem as={NextLink} href="/">
107
+ Chแปฃ Tแป‘t
108
+ </BreadcrumbItem>
109
+ <BreadcrumbItem as={NextLink} href="/do-dien-tu">
110
+ ฤแป“ ฤ‘iแป‡n tแปญ
111
+ </BreadcrumbItem>
112
+ <BreadcrumbItem href="/mua-ban-dien-thoai">ฤiแป‡n thoแบกi</BreadcrumbItem>
113
+ <BreadcrumbItem as={NextLink} href="/mua-ban-dien-thoai-apple-sdmd1">
114
+ Apple
115
+ </BreadcrumbItem>
116
+ </Breadcrumbs>
117
+ </Box>);
118
+ },
174
119
  parameters: {
175
120
  docs: {
176
121
  description: {
177
- story: 'This example demonstrates how to use Breadcrumbs with `next/link`, including both the new Link and the legacy Link behavior',
122
+ story: 'This example demonstrates how to use Breadcrumbs with `next/link`',
178
123
  },
179
124
  },
180
125
  },
@@ -1,5 +1,5 @@
1
- import * as React from 'react';
2
1
  import { type Sizes } from '@clad-ui/theme';
2
+ import { type HTMLCladUIProps, type ReactRef } from '../../utils/types';
3
3
  /**
4
4
  * @deprecated
5
5
  */
@@ -12,7 +12,7 @@ export type ButtonColor = 'error' | 'info' | 'neutral' | 'primary' | 'success' |
12
12
  * Variant selection for button variant prop
13
13
  */
14
14
  export type ButtonVariant = 'default' | 'outline' | 'solid' | 'tonal';
15
- export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
15
+ export interface ButtonProps extends HTMLCladUIProps<'button'> {
16
16
  /**
17
17
  * Different looks of button
18
18
  */
@@ -54,19 +54,6 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
54
54
  * Whether this button stretch to fill up container's width
55
55
  */
56
56
  stretch?: boolean;
57
- /**
58
- * Element or component to be rendered as
59
- * @default button
60
- */
61
- as?: React.ElementType;
62
- /**
63
- * Children
64
- */
65
- children?: React.ReactNode;
66
- /**
67
- * Click event
68
- */
69
- onClick?: React.MouseEventHandler<HTMLElement>;
70
57
  /**
71
58
  * Additional classes to be added for customization
72
59
  */
@@ -75,12 +62,16 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
75
62
  * Display loading icon
76
63
  */
77
64
  isLoading?: boolean;
65
+ /**
66
+ * Ref to the DOM node.
67
+ */
68
+ ref?: ReactRef<HTMLButtonElement | null>;
78
69
  }
79
70
  /**
80
71
  * Renders a standard button element.
81
72
  *
82
73
  * `โœ… Stable`
83
74
  */
84
- declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
75
+ declare const Button: import("../../utils/types").InternalForwardRefRenderFunction<"button", ButtonProps>;
85
76
  export default Button;
86
77
  //# sourceMappingURL=Button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAc,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAOnD;;GAEG;AACH,KAAK,qBAAqB,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAEvF;;GAEG;AACH,MAAM,MAAM,WAAW,GACnB,OAAO,GACP,MAAM,GACN,SAAS,GACT,SAAS,GACT,SAAS,GACT,UAAU,GACV,qBAAqB,CAAC;AAE1B;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAEtE,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IAChF;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB;;;OAGG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;;OAGG;IACH,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;IACtC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC3B;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;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,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAkBD;;;;GAIG;AACH,QAAA,MAAM,MAAM,uFAqEX,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../components/Button/Button.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAInD,OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAIpF;;GAEG;AACH,KAAK,qBAAqB,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAEvF;;GAEG;AACH,MAAM,MAAM,WAAW,GACnB,OAAO,GACP,MAAM,GACN,SAAS,GACT,SAAS,GACT,SAAS,GACT,UAAU,GACV,qBAAqB,CAAC;AAE1B;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAEtE,MAAM,WAAW,WAAY,SAAQ,eAAe,CAAC,QAAQ,CAAC;IAC5D;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB;;;OAGG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;;OAGG;IACH,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;IACtC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC3B;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,GAAG,CAAC,EAAE,QAAQ,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;CAC1C;AAkBD;;;;GAIG;AACH,QAAA,MAAM,MAAM,qFAkEV,CAAC;AAEH,eAAe,MAAM,CAAC"}
@@ -3,6 +3,7 @@ import theme from '@clad-ui/theme';
3
3
  import { cx } from '../../utils';
4
4
  import { Loading } from '../../icons';
5
5
  import buttonClass from './Button.styles';
6
+ import { forwardRef } from '../../utils/types';
6
7
  const { sizes } = theme;
7
8
  const variantResolver = (variant, color) => {
8
9
  if (variant === 'default') {
@@ -27,8 +28,9 @@ const variantResolver = (variant, color) => {
27
28
  *
28
29
  * `โœ… Stable`
29
30
  */
30
- const Button = React.forwardRef(({ as = 'button', children, color = 'primary', disabled = false, extraClasses = '', icon = false, onClick, radius = 'normal', size = 'medium', stretch = false, variant = 'solid', weight = 'bold', isLoading = false, width, ...props }, ref) => {
31
+ const Button = forwardRef((props, ref) => {
31
32
  var _a, _b, _c;
33
+ const { as, children, color = 'primary', disabled = false, extraClasses = '', icon = false, onClick, radius = 'normal', size = 'medium', stretch = false, variant = 'solid', weight = 'bold', isLoading = false, width, ...rest } = props;
32
34
  let iconClass = '';
33
35
  if (icon) {
34
36
  // square/circle icon buttons
@@ -56,8 +58,8 @@ const Button = React.forwardRef(({ as = 'button', children, color = 'primary', d
56
58
  width: width && `${sizes[width]}`,
57
59
  },
58
60
  'data-clad': 'Button',
59
- ...props,
61
+ ...rest,
60
62
  };
61
- return React.createElement(as, attrs, isLoading && React.createElement(Loading, { className: 'loading-icon' }), children);
63
+ return React.createElement(as || 'button', attrs, isLoading && React.createElement(Loading, { className: 'loading-icon' }), children);
62
64
  });
63
65
  export default Button;
@@ -1,7 +1,6 @@
1
- import React from 'react';
2
1
  declare const buttonStories: {
3
2
  title: string;
4
- component: React.ForwardRefExoticComponent<import("./Button").ButtonProps & React.RefAttributes<HTMLButtonElement>>;
3
+ component: import("../../utils/types").InternalForwardRefRenderFunction<"button", import("./Button").ButtonProps>;
5
4
  tags: string[];
6
5
  parameters: {
7
6
  docs: {
@@ -102,4 +101,5 @@ export declare const ExtraClasses: {
102
101
  };
103
102
  };
104
103
  };
104
+ export declare const ButtonWithNextLink: () => JSX.Element;
105
105
  //# sourceMappingURL=Button.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.stories.d.ts","sourceRoot":"","sources":["../../../components/Button/Button.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BlB,CAAC;AAEF,eAAe,aAAa,CAAC;AAG7B,eAAO,MAAM,QAAQ;;;;;;;CAAiC,CAAC;AAWvD,eAAO,MAAM,YAAY,mBA6BxB,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;CA6C1B,CAAC;AAEF,eAAO,MAAM,YAAY,mBAmCxB,CAAC;AAEF,eAAO,MAAM,KAAK,mBAwCjB,CAAC;AAEF,eAAO,MAAM,KAAK,mBAajB,CAAC;AAEF,eAAO,MAAM,YAAY,mBAexB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;CAyBpB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;CAoBxB,CAAC;AAEF,eAAO,MAAM,SAAS,mBA0BrB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;CAgEvB,CAAC;AAaF,eAAO,MAAM,OAAO;;;;;;;;;CAsBnB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;CA2BxB,CAAC"}
1
+ {"version":3,"file":"Button.stories.d.ts","sourceRoot":"","sources":["../../../components/Button/Button.stories.tsx"],"names":[],"mappings":"AAYA,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BlB,CAAC;AAEF,eAAe,aAAa,CAAC;AAG7B,eAAO,MAAM,QAAQ;;;;;;;CAAiC,CAAC;AAWvD,eAAO,MAAM,YAAY,mBA6BxB,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;CA6C1B,CAAC;AAEF,eAAO,MAAM,YAAY,mBAmCxB,CAAC;AAEF,eAAO,MAAM,KAAK,mBAwCjB,CAAC;AAEF,eAAO,MAAM,KAAK,mBAajB,CAAC;AAEF,eAAO,MAAM,YAAY,mBAexB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;CAyBpB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;CAoBxB,CAAC;AAEF,eAAO,MAAM,SAAS,mBA0BrB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;CAgEvB,CAAC;AAaF,eAAO,MAAM,OAAO;;;;;;;;;CAsBnB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;CA2BxB,CAAC;AAEF,eAAO,MAAM,kBAAkB,mBA+B9B,CAAC"}
@@ -17,7 +17,7 @@ const buttonStories = {
17
17
  description: {
18
18
  component: `Renders a standard button element.
19
19
 
20
- \`๐Ÿงช Revamped in 1.2+\` [\`๐ŸŽจ Figma Specs\`](https://www.figma.com/file/sPjl33KoaW0bKVZOmm66iQ/CHOTOT-Design-System?node-id=17176%3A32491&t=EPNuQtKvlw2DSxrI-4)
20
+ \`๐Ÿงช Revamped in 1.2+\` [\`๐ŸŽจ Figma Specs\`](https://www.figma.com/design/DfQM6G9p8PSNEoOzNGRjWD/v3.0-CHOTOT-Design-System---Processing?node-id=41-12614&t=hz8QJLqNrGvTVY8R-4)
21
21
  `,
22
22
  },
23
23
  },
@@ -402,3 +402,21 @@ export const ExtraClasses = {
402
402
  },
403
403
  },
404
404
  };
405
+ export const ButtonWithNextLink = ( /* args */) => {
406
+ // replace "a" with NextLink
407
+ const NextLink = 'a';
408
+ return (<div className={storyClass}>
409
+ <Button as={NextLink} href="/iframe.html?viewMode=story&id=components-buttons-button--button-with-next-link&example=click-me-1">
410
+ Click me 1
411
+ </Button>
412
+ <Button as={NextLink} href="/iframe.html?viewMode=story&id=components-buttons-button--button-with-next-link&example=click-me-2">
413
+ Click me 2
414
+ </Button>
415
+ <Button as={NextLink} href="/iframe.html?viewMode=story&id=components-buttons-button--button-with-next-link&example=click-me-3">
416
+ Click me 3
417
+ </Button>
418
+ <Button as={NextLink} href="/iframe.html?viewMode=story&id=components-buttons-button--button-with-next-link&example=click-me-4">
419
+ Click me 4
420
+ </Button>
421
+ </div>);
422
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"Button.styles.d.ts","sourceRoot":"","sources":["../../../components/Button/Button.styles.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,WAAW,0CAygBhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"Button.styles.d.ts","sourceRoot":"","sources":["../../../components/Button/Button.styles.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,WAAW,0CA4gBhB,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, 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
  }
@@ -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
  */
@@ -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