@chotot/clad-ui 2.0.0 → 2.2.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 (118) hide show
  1. package/README.md +4 -2
  2. package/dist/components/Badge/Badge.d.ts +10 -2
  3. package/dist/components/Badge/Badge.d.ts.map +1 -1
  4. package/dist/components/Badge/Badge.js +42 -27
  5. package/dist/components/Badge/Badge.stories.d.ts.map +1 -1
  6. package/dist/components/Badge/Badge.stories.js +153 -126
  7. package/dist/components/Badge/Badge.styles.d.ts +2 -1
  8. package/dist/components/Badge/Badge.styles.d.ts.map +1 -1
  9. package/dist/components/Badge/Badge.styles.js +77 -18
  10. package/dist/components/Breadcrumbs/BreadcrumbItem.js +1 -0
  11. package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts.map +1 -1
  12. package/dist/components/Breadcrumbs/Breadcrumbs.stories.js +19 -13
  13. package/dist/components/Button/Button.d.ts +1 -1
  14. package/dist/components/Button/Button.d.ts.map +1 -1
  15. package/dist/components/Button/Button.js +1 -0
  16. package/dist/components/Button/Button.stories.d.ts +76 -2
  17. package/dist/components/Button/Button.stories.d.ts.map +1 -1
  18. package/dist/components/Button/Button.stories.js +86 -10
  19. package/dist/components/Button/Button.styles.d.ts.map +1 -1
  20. package/dist/components/Button/Button.styles.js +16 -0
  21. package/dist/components/Button/GhostButton.d.ts +1 -1
  22. package/dist/components/Button/GhostButton.d.ts.map +1 -1
  23. package/dist/components/Button/GhostButton.js +1 -0
  24. package/dist/components/Button/GhostButton.stories.d.ts +78 -0
  25. package/dist/components/Button/GhostButton.stories.d.ts.map +1 -1
  26. package/dist/components/Button/GhostButton.stories.js +62 -7
  27. package/dist/components/Button/GhostButton.styles.d.ts.map +1 -1
  28. package/dist/components/Button/GhostButton.styles.js +17 -1
  29. package/dist/components/Button/IconButton.d.ts.map +1 -1
  30. package/dist/components/Button/IconButton.js +1 -0
  31. package/dist/components/Button/IconButton.stories.d.ts +73 -1
  32. package/dist/components/Button/IconButton.stories.d.ts.map +1 -1
  33. package/dist/components/Button/IconButton.stories.js +57 -8
  34. package/dist/components/Button/constant.d.ts +10 -0
  35. package/dist/components/Button/constant.d.ts.map +1 -0
  36. package/dist/components/Button/constant.js +21 -0
  37. package/dist/components/DatePicker/DatePicker.d.ts +4 -0
  38. package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
  39. package/dist/components/DatePicker/DatePicker.js +4 -1
  40. package/dist/components/DatePicker/DatePicker.stories.d.ts +1 -0
  41. package/dist/components/DatePicker/DatePicker.stories.d.ts.map +1 -1
  42. package/dist/components/Dropdown/Dropdown.d.ts.map +1 -1
  43. package/dist/components/Dropdown/Dropdown.js +5 -0
  44. package/dist/components/Dropdown/Dropdown.styles.d.ts.map +1 -1
  45. package/dist/components/Dropdown/Dropdown.styles.js +27 -3
  46. package/dist/components/Input/Input.d.ts +1 -1
  47. package/dist/components/Input/Input.d.ts.map +1 -1
  48. package/dist/components/Input/Input.js +15 -2
  49. package/dist/components/Pagination/PageItem.d.ts.map +1 -1
  50. package/dist/components/Pagination/PageItem.js +1 -0
  51. package/dist/components/RowItem/RowItem.d.ts.map +1 -1
  52. package/dist/components/RowItem/RowItem.js +3 -6
  53. package/dist/components/Tabs/Tab.d.ts.map +1 -1
  54. package/dist/components/Tabs/Tab.js +1 -0
  55. package/dist/components/Tabs/Tabs.styles.js +1 -1
  56. package/dist/components/TextArea/TextArea.d.ts +1 -1
  57. package/dist/index.d.ts +3 -0
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +3 -0
  60. package/dist/patterns/EmptyState/EmptyState.d.ts +1 -1
  61. package/dist/patterns/EmptyState/EmptyState.d.ts.map +1 -1
  62. package/dist/patterns/EmptyState/EmptyState.js +52 -47
  63. package/dist/patterns/EmptyState/EmptyState.stories.d.ts +11 -1
  64. package/dist/patterns/EmptyState/EmptyState.stories.d.ts.map +1 -1
  65. package/dist/patterns/EmptyState/EmptyState.stories.js +50 -11
  66. package/dist/patterns/EmptyState/EmptyState.styles.d.ts +3 -15
  67. package/dist/patterns/EmptyState/EmptyState.styles.d.ts.map +1 -1
  68. package/dist/patterns/EmptyState/EmptyState.styles.js +23 -40
  69. package/dist/patterns/InputGroup/InputGroup.d.ts +1 -1
  70. package/dist/patterns/InputGroup/InputGroup.styles.d.ts.map +1 -1
  71. package/dist/patterns/InputGroup/InputGroup.styles.js +3 -2
  72. package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.d.ts +1 -1
  73. package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.d.ts.map +1 -1
  74. package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.js +4 -0
  75. package/dist/patterns/RangeInput/RangeInput.d.ts +30 -0
  76. package/dist/patterns/RangeInput/RangeInput.d.ts.map +1 -0
  77. package/dist/patterns/RangeInput/RangeInput.js +27 -0
  78. package/dist/patterns/RangeInput/RangeInput.stories.d.ts +68 -0
  79. package/dist/patterns/RangeInput/RangeInput.stories.d.ts.map +1 -0
  80. package/dist/patterns/RangeInput/RangeInput.stories.js +121 -0
  81. package/dist/patterns/RangeInput/RangeInput.styles.d.ts +5 -0
  82. package/dist/patterns/RangeInput/RangeInput.styles.d.ts.map +1 -0
  83. package/dist/patterns/RangeInput/RangeInput.styles.js +32 -0
  84. package/dist/patterns/SearchInput/SearchInput.d.ts +1 -1
  85. package/dist/patterns/SearchInput/SearchInput.d.ts.map +1 -1
  86. package/dist/patterns/SearchInput/SearchInput.js +7 -8
  87. package/dist/patterns/Searchbar/Searchbar.d.ts +28 -0
  88. package/dist/patterns/Searchbar/Searchbar.d.ts.map +1 -0
  89. package/dist/patterns/Searchbar/Searchbar.js +37 -0
  90. package/dist/patterns/Searchbar/Searchbar.stories.d.ts +70 -0
  91. package/dist/patterns/Searchbar/Searchbar.stories.d.ts.map +1 -0
  92. package/dist/patterns/Searchbar/Searchbar.stories.js +80 -0
  93. package/dist/patterns/Searchbar/Searchbar.styles.d.ts +3 -0
  94. package/dist/patterns/Searchbar/Searchbar.styles.d.ts.map +1 -0
  95. package/dist/patterns/Searchbar/Searchbar.styles.js +48 -0
  96. package/dist/patterns/TagCloud/TagCloud.d.ts +1 -1
  97. package/dist/patterns/index.d.ts +4 -0
  98. package/dist/patterns/index.d.ts.map +1 -1
  99. package/dist/patterns/index.js +2 -0
  100. package/dist/storybook/ColorFoundationList.js +2 -2
  101. package/dist/storybook/Popover.js +1 -0
  102. package/dist/theme/chotot.d.ts +8 -4
  103. package/dist/theme/chotot.d.ts.map +1 -1
  104. package/dist/theme/chotot.js +10 -6
  105. package/dist/theme/ct-job.d.ts +8 -4
  106. package/dist/theme/ct-job.d.ts.map +1 -1
  107. package/dist/theme/ct-pty.d.ts +8 -4
  108. package/dist/theme/ct-pty.d.ts.map +1 -1
  109. package/dist/theme/ct-veh.d.ts +8 -4
  110. package/dist/theme/ct-veh.d.ts.map +1 -1
  111. package/dist/theme/mudah.js +1 -1
  112. package/dist/typography/HeaderAnnotation.d.ts +19 -0
  113. package/dist/typography/HeaderAnnotation.d.ts.map +1 -0
  114. package/dist/typography/HeaderAnnotation.js +15 -0
  115. package/dist/typography/index.d.ts +2 -0
  116. package/dist/typography/index.d.ts.map +1 -1
  117. package/dist/typography/index.js +1 -0
  118. package/package.json +5 -1
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <!-- badges -->
2
2
 
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
- [<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)
3
+ [<img src="https://img.shields.io/badge/@chotot/clad--ui-2.1.0-FFBA00" alt="@chotot/clad-ui npm version" />](https://www.npmjs.com/package/@chotot/clad-ui)
4
+ [<img src="https://img.shields.io/badge/@chotot/charts-1.0.2-FFBA00" alt="@chotot/charts npm version" />](https://www.npmjs.com/package/@chotot/charts)
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)
7
7
  [<img src="https://img.shields.io/badge/storybook-7.6.20-FF4785" alt="Storybook dependency version" />](https://storybook.js.org/)
@@ -96,6 +96,8 @@ Maintaining the system:
96
96
  | 35 | ToggleSwitch | ✅ 1.0+ | | ✅ |
97
97
  | 36 | Tooltip | ✅ 1.0+ | ✅ | ✅ |
98
98
  | 37 | Pagination | 🧪 1.6+ | | |
99
+ | 38 | InputRange | 🧪 2.1+ | | |
100
+ | 39 | Searchbar | 🧪 2.1+ | | |
99
101
 
100
102
  **Legend:**
101
103
  ✅: stable; 🧪: beta; ⚠️: deprecated; [1.0+]: since this version
@@ -3,7 +3,7 @@ export interface BadgeProps {
3
3
  /**
4
4
  * Size of Badge
5
5
  */
6
- size?: 'md' | 'sm';
6
+ size?: 'lg' | 'md' | 'sm' | 'dot';
7
7
  /**
8
8
  * Badge Label
9
9
  */
@@ -11,7 +11,11 @@ export interface BadgeProps {
11
11
  /**
12
12
  * Badge Background Color
13
13
  */
14
- backgroundColor?: 'accent' | 'caution' | 'critical' | 'info' | 'neutral' | 'positive' | 'primary' | 'secondary';
14
+ backgroundColor?: 'error' | 'warning' | 'info' | 'success' | 'neutral';
15
+ /**
16
+ * Badge Variant
17
+ */
18
+ variant?: 'solid' | 'tonal';
15
19
  /**
16
20
  * Badge Position
17
21
  */
@@ -28,6 +32,10 @@ export interface BadgeProps {
28
32
  * z-index
29
33
  */
30
34
  zIndex?: number;
35
+ /**
36
+ * Badge Class Name
37
+ */
38
+ className?: string;
31
39
  }
32
40
  /**
33
41
  * Badge Component for menus and notifications
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../components/Badge/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,eAAe,CAAC,EACZ,QAAQ,GACR,SAAS,GACT,UAAU,GACV,MAAM,GACN,SAAS,GACT,UAAU,GACV,SAAS,GACT,WAAW,CAAC;IAChB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC;IAC5C;;OAEG;IACH,YAAY,CAAC,EAAE,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC7E;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AAEH,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CA+E/B,CAAC;AAEF,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../components/Badge/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IAClC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,eAAe,CAAC,EACZ,OAAO,GACP,SAAS,GACT,MAAM,GACN,SAAS,GACT,SAAS,CAAA;IACb;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC;IAC5C;;OAEG;IACH,YAAY,CAAC,EAAE,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC7E;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AAEH,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAgG/B,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -1,35 +1,39 @@
1
1
  import * as React from 'react';
2
2
  import theme from '@clad-ui/theme';
3
- import { badgeSizeSmallClass, badgeSizeMediumClass, StyledBadgeWrapper, StyledBadge, } from './Badge.styles';
3
+ import { badgeSizeSmallClass, badgeSizeLargeClass, badgeSizeMediumClass, StyledBadgeWrapper, StyledBadge, badgeSizeDotClass, } from './Badge.styles';
4
+ import cx from '../../utils/cx';
4
5
  const { radii } = theme;
6
+ const { useMemo } = React;
5
7
  /**
6
8
  * Badge Component for menus and notifications
7
9
  *
8
10
  * `✅ Stable`
9
11
  */
10
- const Badge = ({ size = 'sm', children = 'Default Badge Children', label = '', backgroundColor = 'primary', position = 'topRight', zIndex = 1, borderRadius = 'none', }) => {
11
- const badgePosition = ((_position) => {
12
- switch (_position) {
12
+ const Badge = ({ size = 'sm', children = 'Default Badge Children', label = '', backgroundColor = 'warning', variant = 'solid', position = 'topRight', zIndex = 1, borderRadius: borderRadiusProp = 'none', className = '', }) => {
13
+ const badgePosition = useMemo(() => {
14
+ const positionValue = { dot: '1px', sm: '8px', md: '8px', lg: '10px' }[size] || '8px';
15
+ switch (position) {
16
+ // Keep legacy behavior for right position
17
+ case 'right':
18
+ return {
19
+ top: '50%',
20
+ left: 'unset',
21
+ right: `-${positionValue}`,
22
+ transform: 'translateX(100%) translateY(-50%)',
23
+ };
13
24
  case 'topRight':
14
25
  return {
15
- top: '-8px',
26
+ top: `-${positionValue}`,
16
27
  left: 'unset',
17
- right: '0',
18
- transform: 'translateX(50%)',
28
+ right: `-${positionValue}`,
29
+ transform: 'unset',
19
30
  };
20
31
  case 'topLeft':
21
32
  return {
22
- top: '-8px',
23
- left: '0',
33
+ top: `-${positionValue}`,
34
+ left: `-${positionValue}`,
24
35
  right: 'unset',
25
- transform: 'translateX(-50%)',
26
- };
27
- case 'right':
28
- return {
29
- top: '50%',
30
- left: 'unset',
31
- right: '-8px',
32
- transform: 'translateX(100%) translateY(-50%)',
36
+ transform: 'unset',
33
37
  };
34
38
  default:
35
39
  return {
@@ -39,37 +43,48 @@ const Badge = ({ size = 'sm', children = 'Default Badge Children', label = '', b
39
43
  transform: 'unset',
40
44
  };
41
45
  }
42
- })(position);
43
- const badgeSizing = ((_size, _borderRadius) => {
44
- switch (_size) {
46
+ }, [position, size]);
47
+ const badgeSizing = useMemo(() => {
48
+ const borderRadius = borderRadiusProp ? radii[borderRadiusProp] : radii.pill;
49
+ switch (size) {
45
50
  case 'sm':
46
51
  return {
52
+ // Keep legacy behavior for sm size
47
53
  className: badgeSizeSmallClass,
48
- borderRadius: _borderRadius ? radii[_borderRadius] : radii.xs,
54
+ borderRadius,
49
55
  };
50
56
  case 'md':
51
57
  return {
52
58
  className: badgeSizeMediumClass,
53
- borderRadius: _borderRadius ? radii[_borderRadius] : radii.sm,
59
+ borderRadius,
60
+ };
61
+ case 'lg':
62
+ return {
63
+ className: badgeSizeLargeClass,
64
+ borderRadius,
65
+ };
66
+ case 'dot':
67
+ return {
68
+ borderRadius,
69
+ className: badgeSizeDotClass,
54
70
  };
55
71
  default:
56
72
  return {
57
73
  className: '',
58
- borderRadius: '',
74
+ borderRadius: radii.pill,
59
75
  };
60
76
  }
61
- })(size, borderRadius);
77
+ }, [size, borderRadiusProp]);
62
78
  const attrs = {
63
- backgroundColor,
64
79
  position,
65
80
  badgeSizing,
66
81
  badgePosition,
67
- className: badgeSizing.className,
68
82
  zIndex,
83
+ className: cx(badgeSizing.className, backgroundColor, variant, className),
69
84
  };
70
85
  return (<StyledBadgeWrapper>
71
86
  <StyledBadge data-clad="Badge" {...attrs}>
72
- {label}
87
+ {size !== 'dot' && label}
73
88
  </StyledBadge>
74
89
  {children}
75
90
  </StyledBadgeWrapper>);
@@ -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;;;;;;;;;;;;;;;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"}
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;;;;;;;;;CA+CxB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;CAkKzB,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;CAkC5B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;CAwChC,CAAC"}
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
- import { css } from '@linaria/core';
3
2
  import theme from '@clad-ui/theme';
4
3
  import Col from '../Grid/Col';
5
4
  import Grid from '../Grid/Grid';
6
5
  import Badge from './Badge';
7
6
  import Button from '../Button/Button';
8
- const { colors, space, fontSizes } = theme;
7
+ import Chat from '../../icons/Chat';
8
+ const { colors } = theme;
9
9
  const badgeStory = {
10
10
  title: 'Components/Badge',
11
11
  component: Badge,
@@ -53,122 +53,163 @@ export const Overview = {
53
53
  export const SizeVariants = {
54
54
  render: () => (<Grid>
55
55
  <Col>
56
- Without size input :
57
- <div style={{ marginTop: '24px' }}>
58
- <Badge label="default sm">
59
- <Button color="tertiary"> No size input</Button>
60
- </Badge>
61
- </div>
56
+ <Badge size="lg" label="99+" position="topRight" borderRadius="pill" backgroundColor="error">
57
+ <Button color="tertiary" variant="outline">
58
+ Large (lg)
59
+ </Button>
60
+ </Badge>
61
+ </Col>
62
+ <Col>
63
+ <Badge size="md" label="9" position="topRight" borderRadius="pill" backgroundColor="error">
64
+ <Button color="tertiary" variant="outline">
65
+ Medium (md)
66
+ </Button>
67
+ </Badge>
62
68
  </Col>
63
69
  <Col>
64
- Small size:
65
- <div style={{ marginTop: '24px' }}>
66
- <Badge size="sm" label="9">
67
- <Button color="tertiary"> sm Input</Button>
68
- </Badge>
69
- </div>
70
+ <Badge size="sm" label="9" position="topRight" borderRadius="pill" backgroundColor="error">
71
+ <Button color="tertiary" variant="outline">
72
+ Small (sm)
73
+ </Button>
74
+ </Badge>
70
75
  </Col>
76
+
71
77
  <Col>
72
- Medium size:
73
- <div style={{ marginTop: '24px' }}>
74
- <Badge size="md" label="999">
75
- <Button color="tertiary"> md Input</Button>
76
- </Badge>
77
- </div>
78
+ <Badge size="dot" borderRadius="circle" position="topRight" backgroundColor="error">
79
+ <Chat style={{ width: '20px', height: '20px' }}/>
80
+ </Badge>
78
81
  </Col>
79
82
  </Grid>),
80
83
  parameters: {
81
84
  docs: {
82
85
  description: {
83
- story: 'Show how to use size variants',
86
+ story: 'Badge supports 4 size variants: sm (small), md (medium), lg (large), and dot (notification indicator without label).',
84
87
  },
85
88
  },
86
89
  },
87
90
  };
88
91
  export const ColorVariants = {
89
- render: () => (<Grid>
90
- <Col>
91
- Without color input :
92
- <div style={{ marginTop: '24px' }}>
93
- <Badge label="default primary color">
94
- <Button color="primary"> No color input</Button>
95
- </Badge>
96
- </div>
97
- </Col>
98
- <Col>
99
- With color input:
100
- <div style={{ marginTop: '24px' }}>
101
- <Badge backgroundColor="critical" label="critical">
102
- <Button color="primary"> With color input </Button>
103
- </Badge>
104
- </div>
105
- </Col>
106
- </Grid>),
92
+ render: () => (<>
93
+ <div style={{ marginBottom: '32px' }}>
94
+ <h3 style={{ marginBottom: '16px', fontSize: '16px', fontWeight: '600' }}>
95
+ Solid Variant (Default)
96
+ </h3>
97
+ <Grid>
98
+ <Col>
99
+ <Badge size="sm" backgroundColor="error" label="99+" position="topRight" borderRadius="pill">
100
+ <Button color="tertiary" variant="outline">
101
+ Error
102
+ </Button>
103
+ </Badge>
104
+ </Col>
105
+ <Col>
106
+ <Badge size="sm" backgroundColor="info" label="99+" position="topRight" borderRadius="pill">
107
+ <Button color="tertiary" variant="outline">
108
+ Info
109
+ </Button>
110
+ </Badge>
111
+ </Col>
112
+ <Col>
113
+ <Badge size="sm" backgroundColor="success" label="99+" position="topRight" borderRadius="pill">
114
+ <Button color="tertiary" variant="outline">
115
+ Success
116
+ </Button>
117
+ </Badge>
118
+ </Col>
119
+ <Col>
120
+ <Badge size="sm" backgroundColor="neutral" label="99+" position="topRight" borderRadius="pill">
121
+ <Button color="tertiary" variant="outline">
122
+ Neutral
123
+ </Button>
124
+ </Badge>
125
+ </Col>
126
+ <Col>
127
+ <Badge size="sm" backgroundColor="warning" label="99+" position="topRight" borderRadius="pill">
128
+ <Button color="tertiary" variant="outline">
129
+ Warning
130
+ </Button>
131
+ </Badge>
132
+ </Col>
133
+ </Grid>
134
+ </div>
135
+
136
+ <div>
137
+ <h3 style={{ marginBottom: '16px', fontSize: '16px', fontWeight: '600' }}>Tonal Variant</h3>
138
+ <Grid>
139
+ <Col>
140
+ <Badge size="sm" backgroundColor="error" variant="tonal" label="99+" position="topRight" borderRadius="pill">
141
+ <Button color="tertiary" variant="outline">
142
+ Error
143
+ </Button>
144
+ </Badge>
145
+ </Col>
146
+ <Col>
147
+ <Badge size="sm" backgroundColor="info" variant="tonal" label="99+" position="topRight" borderRadius="pill">
148
+ <Button color="tertiary" variant="outline">
149
+ Info
150
+ </Button>
151
+ </Badge>
152
+ </Col>
153
+ <Col>
154
+ <Badge size="sm" backgroundColor="success" variant="tonal" label="99+" position="topRight" borderRadius="pill">
155
+ <Button color="tertiary" variant="outline">
156
+ Success
157
+ </Button>
158
+ </Badge>
159
+ </Col>
160
+ <Col>
161
+ <Badge size="sm" backgroundColor="neutral" variant="tonal" label="99+" position="topRight" borderRadius="pill">
162
+ <Button color="tertiary" variant="outline">
163
+ Neutral
164
+ </Button>
165
+ </Badge>
166
+ </Col>
167
+ <Col>
168
+ <Badge size="sm" backgroundColor="warning" variant="tonal" label="99+" position="topRight" borderRadius="pill">
169
+ <Button color="tertiary" variant="outline">
170
+ Warning
171
+ </Button>
172
+ </Badge>
173
+ </Col>
174
+ </Grid>
175
+ </div>
176
+ </>),
107
177
  parameters: {
108
178
  docs: {
109
179
  description: {
110
- story: 'Show how to use color props',
180
+ story: 'Badge supports solid (default) and tonal variants across all color options: error, info, success, neutral, and warning.',
111
181
  },
112
182
  },
113
183
  },
114
184
  };
115
185
  export const PositionVariants = {
116
- render: () => {
117
- const demoWrapperClass = css `
118
- display: flex;
119
- flex-direction: column;
120
- gap: ${space.sm};
121
- `;
122
- const demoClass = css `
123
- display: flex;
124
- flex-direction: column;
125
- `;
126
- const demoBorderedClass = css `
127
- display: flex;
128
- flex-direction: column;
129
- border: 1px solid ${colors.borderRegular};
130
- padding: 8px;
131
- `;
132
- const titleClass = css `
133
- font-size: ${fontSizes.body};
134
- line-height: ${space.md};
135
- `;
136
- const descriptionClass = css `
137
- font-size: ${fontSizes.xs};
138
- line-height: ${space.md};
139
- color: ${colors.textTertiary};
140
- `;
141
- return (<Grid rowCols={[1, 3]} justify="between">
142
- <Col>
143
- <div className={demoWrapperClass}>
144
- <Badge position="right" label="Mới">
145
- <div className={demoClass}>
146
- <div className={titleClass}>Vật dụng gì đó</div>
147
- <div className={descriptionClass}>Position: right</div>
148
- </div>
149
- </Badge>
150
-
151
- <Badge position="topRight" label="Mới">
152
- <div className={demoBorderedClass}>
153
- <div className={titleClass}>Vật dụng gì đó</div>
154
- <div className={descriptionClass}>Position: topright</div>
155
- </div>
156
- </Badge>
157
-
158
- <Badge position="topLeft" label="Mới">
159
- <div className={demoBorderedClass}>
160
- <div className={titleClass}>Vật dụng gì đó</div>
161
- <div className={descriptionClass}>Position: topleft</div>
162
- </div>
163
- </Badge>
164
- </div>
165
- </Col>
166
- </Grid>);
167
- },
186
+ render: () => (<Grid>
187
+ <Col>
188
+ <Badge position="right" label="New">
189
+ <Button color="tertiary" variant="outline">
190
+ Right
191
+ </Button>
192
+ </Badge>
193
+ </Col>
194
+ <Col>
195
+ <Badge position="topRight" label="99+" borderRadius="pill">
196
+ <Button color="tertiary" variant="outline">
197
+ Top Right
198
+ </Button>
199
+ </Badge>
200
+ </Col>
201
+ <Col>
202
+ <Badge position="topLeft" label="99+" borderRadius="pill">
203
+ <Button color="tertiary" variant="outline">
204
+ Top Left
205
+ </Button>
206
+ </Badge>
207
+ </Col>
208
+ </Grid>),
168
209
  parameters: {
169
210
  docs: {
170
211
  description: {
171
- story: 'Show how to use color props',
212
+ story: 'Badge position: right (inline), topRight, and topLeft (overlay).',
172
213
  },
173
214
  },
174
215
  },
@@ -176,50 +217,36 @@ export const PositionVariants = {
176
217
  export const BorderRadiusVariants = {
177
218
  render: () => (<Grid>
178
219
  <Col>
179
- borderRadius sm Short Text
180
- <div style={{ marginTop: '24px' }}>
181
- <Badge borderRadius="sm" label="9">
182
- <Button color="tertiary" variant="outline">
183
- Border Radius: sm
184
- </Button>
185
- </Badge>
186
- </div>
220
+ <Badge label="99+" position="topRight" backgroundColor="error">
221
+ <Button color="tertiary" variant="outline">
222
+ Default
223
+ </Button>
224
+ </Badge>
187
225
  </Col>
188
226
  <Col>
189
- borderRadius sm Long Text
190
- <div style={{ marginTop: '24px' }}>
191
- <Badge borderRadius="sm" label="999999">
192
- <Button color="tertiary" variant="outline">
193
- Border Radius: sm
194
- </Button>
195
- </Badge>
196
- </div>
227
+ <Badge borderRadius="sm" label="99+" position="topRight" backgroundColor="error">
228
+ <Button color="tertiary" variant="outline">
229
+ Small
230
+ </Button>
231
+ </Badge>
197
232
  </Col>
198
233
  <Col>
199
- borderRadius xl Short Text
200
- <div style={{ marginTop: '24px' }}>
201
- <Badge borderRadius="xl" label="9">
202
- <Button color="tertiary" variant="outline">
203
- Border Radius: xl
204
- </Button>
205
- </Badge>
206
- </div>
234
+ <Badge borderRadius="pill" label="99+" position="topRight" backgroundColor="error">
235
+ <Button color="tertiary" variant="outline">
236
+ Pill
237
+ </Button>
238
+ </Badge>
207
239
  </Col>
208
240
  <Col>
209
- borderRadius xl Long Text
210
- <div style={{ marginTop: '24px' }}>
211
- <Badge borderRadius="xl" label="999999">
212
- <Button color="tertiary" variant="outline">
213
- Border Radius: xl
214
- </Button>
215
- </Badge>
216
- </div>
241
+ <Badge borderRadius="circle" size="dot" position="topRight" backgroundColor="error">
242
+ <Chat style={{ width: '20px', height: '20px' }}/>
243
+ </Badge>
217
244
  </Col>
218
245
  </Grid>),
219
246
  parameters: {
220
247
  docs: {
221
248
  description: {
222
- story: 'Show how to use borderRadius props and how it look',
249
+ story: 'Typical border radius options: sm, xl, pill (fully rounded), and circle (for dots). Other options available: none, xs, md, lg.',
223
250
  },
224
251
  },
225
252
  },
@@ -1,5 +1,7 @@
1
1
  export declare const badgeSizeSmallClass: import("@linaria/core").LinariaClassName;
2
2
  export declare const badgeSizeMediumClass: import("@linaria/core").LinariaClassName;
3
+ export declare const badgeSizeLargeClass: import("@linaria/core").LinariaClassName;
4
+ export declare const badgeSizeDotClass: import("@linaria/core").LinariaClassName;
3
5
  export declare const StyledBadgeWrapper: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
4
6
  as?: import("react").ElementType;
5
7
  }>;
@@ -8,7 +10,6 @@ export declare const StyledBadgeWrapper: import("@linaria/react").StyledMeta & i
8
10
  */
9
11
  export declare const StyledBadge: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
10
12
  zIndex: number;
11
- backgroundColor: string;
12
13
  badgePosition: {
13
14
  top: string;
14
15
  left: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.styles.d.ts","sourceRoot":"","sources":["../../../components/Badge/Badge.styles.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,mBAAmB,0CAQ/B,CAAC;AACF,eAAO,MAAM,oBAAoB,0CAQhC,CAAC;AACF,eAAO,MAAM,kBAAkB;;EAI9B,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,WAAW;YACd,MAAM;qBACG,MAAM;mBACR;QACb,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;KACnB;iBACY;QACX,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;KACnB;;;EAiBF,CAAC"}
1
+ {"version":3,"file":"Badge.styles.d.ts","sourceRoot":"","sources":["../../../components/Badge/Badge.styles.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,mBAAmB,0CAS/B,CAAC;AAEF,eAAO,MAAM,oBAAoB,0CAShC,CAAC;AACF,eAAO,MAAM,mBAAmB,0CAS/B,CAAC;AAEF,eAAO,MAAM,iBAAiB,0CAQ7B,CAAC;AAEF,eAAO,MAAM,kBAAkB;;EAI9B,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,WAAW;YACd,MAAM;mBACC;QACb,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;KACnB;iBACY;QACX,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;KACnB;;;EAsDF,CAAC"}