@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
@@ -1,24 +1,46 @@
1
1
  import { css } from '@linaria/core';
2
2
  import { styled } from '@linaria/react';
3
3
  import theme from '@clad-ui/theme';
4
- const { fontSizes, colors, typo, space } = theme;
4
+ const { colors, typo, space, radii } = theme;
5
+ // Keep legacy behavior for sm size
5
6
  export const badgeSizeSmallClass = css `
6
- padding: 0 ${space.xxs};
7
- height: ${space.md};
8
- font-size: ${fontSizes.xxs};
9
- min-width: ${space.md};
10
- min-height: ${space.md};
11
- line-height: 6px;
12
- ${typo.body.annotation};
7
+ && {
8
+ padding: 0 ${space.xxs};
9
+ height: ${space.md};
10
+ min-width: ${space.md};
11
+ min-height: ${space.md};
12
+
13
+ ${typo.body.annotation};
14
+ }
13
15
  `;
14
16
  export const badgeSizeMediumClass = css `
15
- padding: 0 ${space.xxs};
16
- height: ${space.mdl};
17
- font-size: ${fontSizes.xs};
18
- min-width: ${space.mdl};
19
- min-height: ${space.mdl};
20
- line-height: 10px;
21
- ${typo.body.caption};
17
+ && {
18
+ padding: 0 ${space.xxs};
19
+ height: ${space.mdl};
20
+ min-width: ${space.mdl};
21
+ min-height: ${space.mdl};
22
+
23
+ ${typo.label.annotation};
24
+ }
25
+ `;
26
+ export const badgeSizeLargeClass = css `
27
+ && {
28
+ padding: 0 6px;
29
+ height: ${space.lg};
30
+ min-width: ${space.lg};
31
+ min-height: ${space.lg};
32
+
33
+ ${typo.label.caption};
34
+ }
35
+ `;
36
+ export const badgeSizeDotClass = css `
37
+ && {
38
+ width: 6px;
39
+ height: 6px;
40
+ border-radius: ${radii.circle};
41
+ box-sizing: content-box;
42
+ border-width: 1px;
43
+ }
22
44
  `;
23
45
  export const StyledBadgeWrapper = styled.div `
24
46
  position: relative;
@@ -34,14 +56,51 @@ export const StyledBadge = styled.div `
34
56
  outline-offset: 1px;
35
57
  text-decoration: inherit;
36
58
  position: absolute;
37
- display: block;
59
+ display: flex;
60
+ align-items: center;
61
+ justify-content: center;
38
62
  z-index: ${({ zIndex }) => zIndex};
39
- border: 1px solid ${colors.borderBlank};
63
+ border: 2px solid ${colors.borderBlank};
40
64
  color: ${colors.textBlank};
41
- background-color: ${({ backgroundColor }) => colors[backgroundColor]};
42
65
  top: ${({ badgePosition }) => badgePosition.top};
43
66
  left: ${({ badgePosition }) => badgePosition.left};
44
67
  right: ${({ badgePosition }) => badgePosition.right};
45
68
  transform: ${({ badgePosition }) => badgePosition.transform};
46
69
  border-radius: ${({ badgeSizing }) => badgeSizing.borderRadius};
70
+
71
+ &.error {
72
+ background-color: ${colors.backgroundError};
73
+ &.tonal {
74
+ background-color: ${colors.backgroundErrorLight};
75
+ color: ${colors.textError};
76
+ }
77
+ }
78
+ &.warning {
79
+ background-color: ${colors.backgroundWarning};
80
+ &.tonal {
81
+ background-color: ${colors.backgroundWarningLight};
82
+ color: ${colors.textWarning};
83
+ }
84
+ }
85
+ &.info {
86
+ background-color: ${colors.backgroundInfo};
87
+ &.tonal {
88
+ background-color: ${colors.backgroundInfoLight};
89
+ color: ${colors.textInfo};
90
+ }
91
+ }
92
+ &.success {
93
+ background-color: ${colors.backgroundSuccess};
94
+ &.tonal {
95
+ background-color: ${colors.backgroundSuccessLight};
96
+ color: ${colors.textSuccess};
97
+ }
98
+ }
99
+ &.neutral {
100
+ background-color: ${colors.backgroundInverted};
101
+ &.tonal {
102
+ background-color: ${colors.backgroundTertiary};
103
+ color: ${colors.textSecondary};
104
+ }
105
+ }
47
106
  `;
@@ -8,3 +8,4 @@ const BreadcrumbItem = forwardRef((props, ref) => {
8
8
  return (<GhostButton className={cx(labelClass, className)} as={as} ref={ref} variant="hyperlink" size="small" weight="normal" color="tertiary" {...rest}/>);
9
9
  });
10
10
  export default BreadcrumbItem;
11
+ BreadcrumbItem.displayName = 'BreadcrumbItem';
@@ -1 +1 @@
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
+ {"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;;;;;;;;;;CAiClC,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;CA4BxB,CAAC"}
@@ -61,11 +61,11 @@ export const WithIsShow = {
61
61
  const [open, setOpen] = useState(true);
62
62
  return (<>
63
63
  <Breadcrumbs isShow={open}>
64
- <a href="/">Chợ Tốt</a>
65
- <a href="/toan-quoc/mua-ban">Toàn quốc</a>
66
- <a href="/toan-quoc/mua-ban-do-gia-dung-noi-that-cay-canh">
64
+ <BreadcrumbItem href="/">Chợ Tốt</BreadcrumbItem>
65
+ <BreadcrumbItem href="/toan-quoc/mua-ban">Toàn quốc</BreadcrumbItem>
66
+ <BreadcrumbItem href="/toan-quoc/mua-ban-do-gia-dung-noi-that-cay-canh">
67
67
  Đồ gia dụng, nội thất, cây cảnh
68
- </a>
68
+ </BreadcrumbItem>
69
69
  </Breadcrumbs>
70
70
  <br />
71
71
  <Button onClick={() => setOpen((prevOpen) => !prevOpen)}>Toggle Breadcrumbs</Button>
@@ -76,16 +76,22 @@ export const WithIsShow = {
76
76
  export const LongBreadcrumbsExample = {
77
77
  render: () => (<Box maxWidth={['full', '$md']}>
78
78
  <Breadcrumbs>
79
- <a href="/">Chợ Tốt</a>
80
- <a href="/ho-chi-minh/">Tp Hồ Chí Minh</a>
81
- <a href="/ho-chi-minh/quan-1">Quận 1</a>
82
- <a href="/ho-chi-minh/quan-1/phuong-ben-nghe">Phường Bến Nghé</a>
83
- <a href="/ho-chi-minh/quan-1/phuong-ben-nghe/do-dien-tu">Đồ điện tử</a>
84
- <a href="/ho-chi-minh/quan-1/phuong-ben-nghe/dien-thoai">Điện thoại</a>
85
- <a href="/ho-chi-minh/quan-1/phuong-ben-nghe/dien-thoai/samsung">Samsung</a>
86
- <a href="/ho-chi-minh/quan-1/phuong-ben-nghe/galaxy-note-fan-edition">
79
+ <BreadcrumbItem href="/">Chợ Tốt</BreadcrumbItem>
80
+ <BreadcrumbItem href="/ho-chi-minh/">Tp Hồ Chí Minh</BreadcrumbItem>
81
+ <BreadcrumbItem href="/ho-chi-minh/quan-1">Quận 1</BreadcrumbItem>
82
+ <BreadcrumbItem href="/ho-chi-minh/quan-1/phuong-ben-nghe">Phường Bến Nghé</BreadcrumbItem>
83
+ <BreadcrumbItem href="/ho-chi-minh/quan-1/phuong-ben-nghe/do-dien-tu">
84
+ Đồ điện tử
85
+ </BreadcrumbItem>
86
+ <BreadcrumbItem href="/ho-chi-minh/quan-1/phuong-ben-nghe/dien-thoai">
87
+ Điện thoại
88
+ </BreadcrumbItem>
89
+ <BreadcrumbItem href="/ho-chi-minh/quan-1/phuong-ben-nghe/dien-thoai/samsung">
90
+ Samsung
91
+ </BreadcrumbItem>
92
+ <BreadcrumbItem href="/ho-chi-minh/quan-1/phuong-ben-nghe/galaxy-note-fan-edition">
87
93
  Galaxy Note Fan Edition
88
- </a>
94
+ </BreadcrumbItem>
89
95
  </Breadcrumbs>
90
96
  </Box>),
91
97
  name: 'Ex: Long Breadcrumbs',
@@ -36,7 +36,7 @@ export interface ButtonProps extends HTMLCladUIProps<'button'> {
36
36
  * Button's size
37
37
  * @default medium
38
38
  */
39
- size?: 'large' | 'medium' | 'small';
39
+ size?: 'xlarge' | 'large' | 'medium' | 'small';
40
40
  /**
41
41
  * Button width
42
42
  */
@@ -1 +1 @@
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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forwardRef((props, ref) => {
62
62
  };
63
63
  return React.createElement(as || 'button', attrs, isLoading && React.createElement(Loading, { className: 'loading-icon' }), children);
64
64
  });
65
+ Button.displayName = 'Button';
65
66
  export default Button;
@@ -10,19 +10,94 @@ declare const buttonStories: {
10
10
  };
11
11
  };
12
12
  argTypes: {
13
+ variant: {
14
+ control: {
15
+ type: string;
16
+ };
17
+ options: import("./Button").ButtonVariant[];
18
+ description: string;
19
+ };
13
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
+ };
14
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
+ 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
+ icon: {
62
+ control: {
63
+ type: string;
64
+ };
65
+ description: string;
66
+ };
67
+ stretch: {
68
+ control: {
69
+ type: string;
70
+ };
71
+ description: string;
72
+ };
73
+ extraClasses: {
74
+ control: {
75
+ type: string;
76
+ };
77
+ description: string;
78
+ };
79
+ isLoading: {
80
+ control: {
81
+ type: string;
82
+ };
83
+ description: string;
15
84
  };
16
85
  children: {
17
86
  control: {
18
87
  type: string;
19
88
  };
89
+ description: string;
20
90
  };
21
91
  as: {
22
- options: string[];
23
92
  control: {
24
93
  type: string;
25
94
  };
95
+ options: string[];
96
+ description: string;
97
+ };
98
+ onClick: {
99
+ action: string;
100
+ description: string;
26
101
  };
27
102
  };
28
103
  };
@@ -32,7 +107,6 @@ export declare const Overview: {
32
107
  args: {
33
108
  children: string;
34
109
  as: string;
35
- onClick: () => void;
36
110
  };
37
111
  };
38
112
  export declare const VariantSolid: () => JSX.Element;
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"Button.stories.d.ts","sourceRoot":"","sources":["../../../components/Button/Button.stories.tsx"],"names":[],"mappings":"AAkBA,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+ElB,CAAC;AAEF,eAAe,aAAa,CAAC;AAG7B,eAAO,MAAM,QAAQ;;;;;;CAAiC,CAAC;AAUvD,eAAO,MAAM,YAAY,mBA6BxB,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;CA6C1B,CAAC;AAEF,eAAO,MAAM,YAAY,mBAmCxB,CAAC;AAEF,eAAO,MAAM,KAAK,mBAoDjB,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;;;;;;;;;CAgFvB,CAAC;AAaF,eAAO,MAAM,OAAO;;;;;;;;;CAsBnB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;CA2BxB,CAAC;AAEF,eAAO,MAAM,kBAAkB,mBA+B9B,CAAC"}
@@ -7,7 +7,7 @@ import Heart from '../../icons/Heart';
7
7
  import SpeechBubbles from '../../icons/SpeechBubbles';
8
8
  import Download from '../../icons/Download';
9
9
  import Location from '../../icons/Location';
10
- const ALLOWED_COLORS = ['primary', 'info', 'success', 'error', 'neutral'];
10
+ import { BUTTON_COLORS, BUTTON_RADII, BUTTON_SIZES, BUTTON_VARIANTS, BUTTON_WEIGHTS, SIZE_OPTIONS, } from './constant';
11
11
  const buttonStories = {
12
12
  title: 'Components/Buttons/Button',
13
13
  component: Button,
@@ -23,27 +23,75 @@ const buttonStories = {
23
23
  },
24
24
  },
25
25
  argTypes: {
26
+ variant: {
27
+ control: { type: 'select' },
28
+ options: BUTTON_VARIANTS,
29
+ description: 'Different looks of button',
30
+ },
26
31
  color: {
27
- options: ALLOWED_COLORS,
32
+ control: { type: 'select' },
33
+ options: BUTTON_COLORS,
34
+ description: 'Color of the background (solid) or stroke (outline) of the button',
35
+ },
36
+ radius: {
37
+ control: { type: 'select' },
38
+ options: BUTTON_RADII,
39
+ description: 'Border radius',
40
+ },
41
+ weight: {
42
+ control: { type: 'select' },
43
+ options: BUTTON_WEIGHTS,
44
+ description: 'Font weight of label',
45
+ },
46
+ size: {
47
+ control: { type: 'select' },
48
+ options: BUTTON_SIZES,
49
+ description: "Button's size",
50
+ },
51
+ width: {
52
+ control: { type: 'select' },
53
+ options: SIZE_OPTIONS,
54
+ description: 'Button width',
55
+ },
56
+ disabled: {
57
+ control: { type: 'boolean' },
58
+ description: 'Whether this button is disabled. No events triggered.',
59
+ },
60
+ icon: {
61
+ control: { type: 'boolean' },
62
+ description: 'This button has equal and appropriate paddings to cater for icon buttons',
63
+ },
64
+ stretch: {
65
+ control: { type: 'boolean' },
66
+ description: "Whether this button stretch to fill up container's width",
67
+ },
68
+ extraClasses: {
69
+ control: { type: 'text' },
70
+ description: 'Additional classes to be added for customization',
71
+ },
72
+ isLoading: {
73
+ control: { type: 'boolean' },
74
+ description: 'Display loading icon',
28
75
  },
29
76
  children: {
30
- control: {
31
- type: 'text',
32
- },
77
+ control: { type: 'text' },
78
+ description: 'Button content/label',
33
79
  },
34
80
  as: {
81
+ control: { type: 'select' },
35
82
  options: ['button', 'a'],
36
- control: {
37
- type: 'select',
38
- },
83
+ description: 'HTML element or component to render as',
84
+ },
85
+ onClick: {
86
+ action: 'clicked',
87
+ description: 'Click event handler',
39
88
  },
40
89
  },
41
90
  };
42
91
  export default buttonStories;
43
92
  // top-most story will have the props breakdown
44
93
  export const Overview = (args) => <Button {...args}/>;
45
- // eslint-disable-next-line no-alert
46
- Overview.args = { children: 'Label', as: 'button', onClick: () => alert('clicked') };
94
+ Overview.args = { children: 'Label', as: 'button' };
47
95
  const storyClass = css `
48
96
  & > * {
49
97
  margin: 0.5em 1em 0.5em 0;
@@ -165,6 +213,9 @@ export const Sizes = ( /* args */) => (<div className={storyClass}>
165
213
  <Button color="primary" size="large">
166
214
  Large
167
215
  </Button>
216
+ <Button color="primary" size="xlarge">
217
+ XLarge
218
+ </Button>
168
219
  <Button color="error" size="small" weight="normal">
169
220
  SMALL
170
221
  </Button>
@@ -174,6 +225,9 @@ export const Sizes = ( /* args */) => (<div className={storyClass}>
174
225
  <Button color="error" size="large" weight="normal">
175
226
  LARGE
176
227
  </Button>
228
+ <Button color="error" size="xlarge" weight="normal">
229
+ XLarge
230
+ </Button>
177
231
  <br />
178
232
  <Button color="info" variant="outline" size="small">
179
233
  Small
@@ -184,6 +238,9 @@ export const Sizes = ( /* args */) => (<div className={storyClass}>
184
238
  <Button color="info" variant="outline" size="large">
185
239
  Large
186
240
  </Button>
241
+ <Button color="info" variant="outline" size="xlarge">
242
+ XLarge
243
+ </Button>
187
244
  <Button color="success" variant="outline" size="small" weight="normal">
188
245
  SMALL
189
246
  </Button>
@@ -193,6 +250,9 @@ export const Sizes = ( /* args */) => (<div className={storyClass}>
193
250
  <Button color="success" variant="outline" size="large" weight="normal">
194
251
  LARGE
195
252
  </Button>
253
+ <Button color="info" variant="outline" size="xlarge" weight="normal">
254
+ XLarge
255
+ </Button>
196
256
  </div>);
197
257
  export const Width = ( /* args */) => (<div className={storyClass}>
198
258
  <Button width="xxxl">80px</Button>
@@ -288,6 +348,22 @@ export const WithIcons = ( /* args */) => (<div className={storyClass}>
288
348
  </div>);
289
349
  export const IconButtons = {
290
350
  render: ( /* args */) => (<div className={storyClass}>
351
+ <IconButton color="success" size="xlarge">
352
+ <Phone />
353
+ </IconButton>
354
+
355
+ <IconButton color="success" size="xlarge" variant="outline">
356
+ <Download />
357
+ </IconButton>
358
+
359
+ <IconButton color="error" size="xlarge" radius="circle">
360
+ <SpeechBubbles />
361
+ </IconButton>
362
+
363
+ <IconButton color="error" size="xlarge" radius="circle" variant="outline">
364
+ <Heart />
365
+ </IconButton>
366
+
291
367
  <IconButton color="success" size="large">
292
368
  <Phone />
293
369
  </IconButton>
@@ -1 +1 @@
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
+ {"version":3,"file":"Button.styles.d.ts","sourceRoot":"","sources":["../../../components/Button/Button.styles.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,WAAW,0CA4hBhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -93,6 +93,22 @@ const buttonClass = css `
93
93
  }
94
94
  }
95
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
+
96
112
  /* SOLID */
97
113
  &,
98
114
  &.primary {
@@ -19,7 +19,7 @@ export interface GhostButtonProps extends HTMLCladUIProps<'a'> {
19
19
  /**
20
20
  * Button's size
21
21
  */
22
- size?: 'large' | 'medium' | 'small';
22
+ size?: 'xlarge' | 'large' | 'medium' | 'small';
23
23
  /**
24
24
  * Whether this button is disabled. No events triggered.
25
25
  */
@@ -1 +1 @@
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,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,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
+ {"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;AAIH,eAAe,MAAM,CAAC"}
@@ -21,4 +21,5 @@ export const Button = forwardRef((props, ref) => {
21
21
  };
22
22
  return React.createElement(as, attrs, children);
23
23
  });
24
+ Button.displayName = 'GhostButton';
24
25
  export default Button;
@@ -10,10 +10,88 @@ declare const ghostButtonStories: {
10
10
  };
11
11
  };
12
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
+ };
13
66
  children: {
14
67
  control: {
15
68
  type: string;
16
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;
17
95
  };
18
96
  };
19
97
  };
@@ -1 +1 @@
1
- {"version":3,"file":"GhostButton.stories.d.ts","sourceRoot":"","sources":["../../../components/Button/GhostButton.stories.tsx"],"names":[],"mappings":"AAGA,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;CAsBvB,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
+ {"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"}