@chotot/clad-ui 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/README.md +3 -1
  2. package/dist/components/Badge/Badge.d.ts +1 -1
  3. package/dist/components/Badge/Badge.d.ts.map +1 -1
  4. package/dist/components/Badge/Badge.js +34 -24
  5. package/dist/components/Badge/Badge.stories.d.ts.map +1 -1
  6. package/dist/components/Badge/Badge.stories.js +60 -52
  7. package/dist/components/Badge/Badge.styles.d.ts +1 -0
  8. package/dist/components/Badge/Badge.styles.d.ts.map +1 -1
  9. package/dist/components/Badge/Badge.styles.js +17 -8
  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.stories.d.ts +76 -2
  16. package/dist/components/Button/Button.stories.d.ts.map +1 -1
  17. package/dist/components/Button/Button.stories.js +86 -10
  18. package/dist/components/Button/Button.styles.d.ts.map +1 -1
  19. package/dist/components/Button/Button.styles.js +16 -0
  20. package/dist/components/Button/GhostButton.d.ts +1 -1
  21. package/dist/components/Button/GhostButton.d.ts.map +1 -1
  22. package/dist/components/Button/GhostButton.stories.d.ts +78 -0
  23. package/dist/components/Button/GhostButton.stories.d.ts.map +1 -1
  24. package/dist/components/Button/GhostButton.stories.js +62 -7
  25. package/dist/components/Button/GhostButton.styles.d.ts.map +1 -1
  26. package/dist/components/Button/GhostButton.styles.js +17 -1
  27. package/dist/components/Button/IconButton.stories.d.ts +73 -1
  28. package/dist/components/Button/IconButton.stories.d.ts.map +1 -1
  29. package/dist/components/Button/IconButton.stories.js +57 -8
  30. package/dist/components/Button/constant.d.ts +10 -0
  31. package/dist/components/Button/constant.d.ts.map +1 -0
  32. package/dist/components/Button/constant.js +21 -0
  33. package/dist/components/DatePicker/DatePicker.d.ts +4 -0
  34. package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
  35. package/dist/components/DatePicker/DatePicker.js +4 -1
  36. package/dist/components/DatePicker/DatePicker.stories.d.ts +1 -0
  37. package/dist/components/DatePicker/DatePicker.stories.d.ts.map +1 -1
  38. package/dist/components/Dropdown/Dropdown.d.ts.map +1 -1
  39. package/dist/components/Dropdown/Dropdown.js +5 -0
  40. package/dist/components/Dropdown/Dropdown.styles.d.ts.map +1 -1
  41. package/dist/components/Dropdown/Dropdown.styles.js +27 -3
  42. package/dist/components/Input/Input.d.ts +1 -1
  43. package/dist/components/Input/Input.d.ts.map +1 -1
  44. package/dist/components/Input/Input.js +15 -2
  45. package/dist/components/RowItem/RowItem.d.ts.map +1 -1
  46. package/dist/components/RowItem/RowItem.js +3 -6
  47. package/dist/components/Tabs/Tab.d.ts.map +1 -1
  48. package/dist/components/Tabs/Tab.js +1 -0
  49. package/dist/components/Tabs/Tabs.styles.js +1 -1
  50. package/dist/components/TextArea/TextArea.d.ts +1 -1
  51. package/dist/index.d.ts +3 -0
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +3 -0
  54. package/dist/patterns/EmptyState/EmptyState.d.ts +1 -1
  55. package/dist/patterns/EmptyState/EmptyState.d.ts.map +1 -1
  56. package/dist/patterns/EmptyState/EmptyState.js +52 -47
  57. package/dist/patterns/EmptyState/EmptyState.stories.d.ts +11 -1
  58. package/dist/patterns/EmptyState/EmptyState.stories.d.ts.map +1 -1
  59. package/dist/patterns/EmptyState/EmptyState.stories.js +50 -11
  60. package/dist/patterns/EmptyState/EmptyState.styles.d.ts +3 -15
  61. package/dist/patterns/EmptyState/EmptyState.styles.d.ts.map +1 -1
  62. package/dist/patterns/EmptyState/EmptyState.styles.js +23 -40
  63. package/dist/patterns/InputGroup/InputGroup.d.ts +1 -1
  64. package/dist/patterns/InputGroup/InputGroup.styles.d.ts.map +1 -1
  65. package/dist/patterns/InputGroup/InputGroup.styles.js +3 -2
  66. package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.d.ts +1 -1
  67. package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.d.ts.map +1 -1
  68. package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.js +4 -0
  69. package/dist/patterns/RangeInput/RangeInput.d.ts +30 -0
  70. package/dist/patterns/RangeInput/RangeInput.d.ts.map +1 -0
  71. package/dist/patterns/RangeInput/RangeInput.js +27 -0
  72. package/dist/patterns/RangeInput/RangeInput.stories.d.ts +68 -0
  73. package/dist/patterns/RangeInput/RangeInput.stories.d.ts.map +1 -0
  74. package/dist/patterns/RangeInput/RangeInput.stories.js +121 -0
  75. package/dist/patterns/RangeInput/RangeInput.styles.d.ts +5 -0
  76. package/dist/patterns/RangeInput/RangeInput.styles.d.ts.map +1 -0
  77. package/dist/patterns/RangeInput/RangeInput.styles.js +32 -0
  78. package/dist/patterns/SearchInput/SearchInput.d.ts +1 -1
  79. package/dist/patterns/SearchInput/SearchInput.d.ts.map +1 -1
  80. package/dist/patterns/SearchInput/SearchInput.js +7 -8
  81. package/dist/patterns/Searchbar/Searchbar.d.ts +28 -0
  82. package/dist/patterns/Searchbar/Searchbar.d.ts.map +1 -0
  83. package/dist/patterns/Searchbar/Searchbar.js +37 -0
  84. package/dist/patterns/Searchbar/Searchbar.stories.d.ts +70 -0
  85. package/dist/patterns/Searchbar/Searchbar.stories.d.ts.map +1 -0
  86. package/dist/patterns/Searchbar/Searchbar.stories.js +80 -0
  87. package/dist/patterns/Searchbar/Searchbar.styles.d.ts +3 -0
  88. package/dist/patterns/Searchbar/Searchbar.styles.d.ts.map +1 -0
  89. package/dist/patterns/Searchbar/Searchbar.styles.js +48 -0
  90. package/dist/patterns/TagCloud/TagCloud.d.ts +1 -1
  91. package/dist/patterns/index.d.ts +4 -0
  92. package/dist/patterns/index.d.ts.map +1 -1
  93. package/dist/patterns/index.js +2 -0
  94. package/dist/storybook/ColorFoundationList.js +2 -2
  95. package/dist/theme/chotot.d.ts +8 -4
  96. package/dist/theme/chotot.d.ts.map +1 -1
  97. package/dist/theme/chotot.js +10 -6
  98. package/dist/theme/ct-job.d.ts +8 -4
  99. package/dist/theme/ct-job.d.ts.map +1 -1
  100. package/dist/theme/ct-pty.d.ts +8 -4
  101. package/dist/theme/ct-pty.d.ts.map +1 -1
  102. package/dist/theme/ct-veh.d.ts +8 -4
  103. package/dist/theme/ct-veh.d.ts.map +1 -1
  104. package/dist/theme/mudah.js +1 -1
  105. package/dist/typography/HeaderAnnotation.d.ts +19 -0
  106. package/dist/typography/HeaderAnnotation.d.ts.map +1 -0
  107. package/dist/typography/HeaderAnnotation.js +15 -0
  108. package/dist/typography/index.d.ts +2 -0
  109. package/dist/typography/index.d.ts.map +1 -1
  110. package/dist/typography/index.js +1 -0
  111. package/package.json +1 -1
@@ -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;AAEH,eAAe,MAAM,CAAC"}
@@ -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"}
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import GhostButton from './GhostButton';
3
+ import { BUTTON_RADII, BUTTON_SIZES, BUTTON_WEIGHTS, GHOST_BUTTON_VARIANTS, GHOST_BUTTON_COLORS, } from './constant';
3
4
  const ghostButtonStories = {
4
5
  title: 'Components/Buttons/Ghost Button (Button Link)',
5
6
  component: GhostButton,
@@ -16,10 +17,64 @@ except the \`as\` prop is always \`a\`.
16
17
  },
17
18
  },
18
19
  argTypes: {
20
+ variant: {
21
+ control: { type: 'select' },
22
+ options: GHOST_BUTTON_VARIANTS,
23
+ description: 'Different looks of button',
24
+ },
25
+ color: {
26
+ control: { type: 'select' },
27
+ options: GHOST_BUTTON_COLORS,
28
+ description: 'Text color',
29
+ },
30
+ radius: {
31
+ control: { type: 'select' },
32
+ options: BUTTON_RADII,
33
+ description: 'Border radius',
34
+ },
35
+ weight: {
36
+ control: { type: 'select' },
37
+ options: BUTTON_WEIGHTS,
38
+ description: 'Font weight of label',
39
+ },
40
+ size: {
41
+ control: { type: 'select' },
42
+ options: BUTTON_SIZES,
43
+ description: "Button's size",
44
+ },
45
+ disabled: {
46
+ control: { type: 'boolean' },
47
+ description: 'Whether this button is disabled. No events triggered.',
48
+ },
49
+ stretch: {
50
+ control: { type: 'boolean' },
51
+ description: "Whether this button stretch to fill up container's width",
52
+ },
53
+ className: {
54
+ control: { type: 'text' },
55
+ description: 'Additional classes to be added for customization',
56
+ },
19
57
  children: {
20
- control: {
21
- type: 'text',
22
- },
58
+ control: { type: 'text' },
59
+ description: 'Button content/label',
60
+ },
61
+ as: {
62
+ control: { type: 'select' },
63
+ options: ['button', 'a'],
64
+ description: 'HTML element or component to render as',
65
+ },
66
+ href: {
67
+ control: { type: 'text' },
68
+ description: 'URL for the link',
69
+ },
70
+ target: {
71
+ control: { type: 'select' },
72
+ options: ['_blank', '_self', '_parent', '_top'],
73
+ description: 'Where to open the linked document',
74
+ },
75
+ onClick: {
76
+ action: 'clicked',
77
+ description: 'Click event handler',
23
78
  },
24
79
  },
25
80
  };
@@ -28,7 +83,7 @@ export const Overview = {
28
83
  render: (args) => <GhostButton href="#" {...args}/>,
29
84
  args: { children: 'This is a button link' },
30
85
  };
31
- export const ButtonVariant = ( /* args */) => (<div>
86
+ export const ButtonVariant = () => (<div>
32
87
  <GhostButton href="https://clad-ui.chotot.org/" target="_blank" variant="button" color="link">
33
88
  Button Variant
34
89
  </GhostButton>
@@ -42,7 +97,7 @@ export const ButtonVariant = ( /* args */) => (<div>
42
97
  Button Variant
43
98
  </GhostButton>
44
99
  </div>);
45
- export const HyperlinkVariant = ( /* args */) => (<div>
100
+ export const HyperlinkVariant = () => (<div>
46
101
  <GhostButton href="https://clad-ui.chotot.org/" target="_blank" variant="hyperlink" color="link">
47
102
  Hyperlink Variant
48
103
  </GhostButton>
@@ -56,7 +111,7 @@ export const HyperlinkVariant = ( /* args */) => (<div>
56
111
  Hyperlink Variant
57
112
  </GhostButton>
58
113
  </div>);
59
- export const ButtonWithNextLink = ( /* args */) => {
114
+ export const ButtonWithNextLink = () => {
60
115
  // replace "a" with NextLink
61
116
  const NextLink = 'a';
62
117
  return (<div>
@@ -74,7 +129,7 @@ export const ButtonWithNextLink = ( /* args */) => {
74
129
  </GhostButton>
75
130
  </div>);
76
131
  };
77
- export const Disabled = ( /* args */) => (<div>
132
+ export const Disabled = () => (<div>
78
133
  <GhostButton variant="button" href="https://clad-ui.chotot.org/" target="_blank" disabled>
79
134
  Disabled Button Variant
80
135
  </GhostButton>
@@ -1 +1 @@
1
- {"version":3,"file":"GhostButton.styles.d.ts","sourceRoot":"","sources":["../../../components/Button/GhostButton.styles.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,WAAW,0CAyKhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"GhostButton.styles.d.ts","sourceRoot":"","sources":["../../../components/Button/GhostButton.styles.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,WAAW,0CAyLhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import theme from '@clad-ui/theme';
2
2
  import { css } from '@linaria/core';
3
- const { colors, radii, fontSizes, fontWeights, typo } = theme;
3
+ const { colors, radii, fontSizes, fontWeights, typo, sizes, space } = theme;
4
4
  const buttonClass = css `
5
5
  /* Standard highlight for manual testing & verification */
6
6
  outline: 1px solid var(--cladebug);
@@ -151,6 +151,22 @@ const buttonClass = css `
151
151
  padding: 9px; /* minus borders */
152
152
  }
153
153
 
154
+ &.xlarge {
155
+ height: ${sizes.xl};
156
+ padding: ${space.none} ${space.md}; /* minus borders 7px - 1px and space.md - 1px */
157
+ border-radius: ${radii.md};
158
+
159
+ ${typo.label.page}
160
+
161
+ &.icon {
162
+ padding: 11px; /* minus border */
163
+ }
164
+
165
+ & > svg {
166
+ font-size: ${fontSizes.xxl};
167
+ }
168
+ }
169
+
154
170
  /* Border radius */
155
171
  &.r-normal {
156
172
  border-radius: ${radii.sm};
@@ -10,11 +10,83 @@ declare const iconButtonStories: {
10
10
  };
11
11
  };
12
12
  argTypes: {
13
- as: {
13
+ variant: {
14
+ control: {
15
+ type: string;
16
+ };
17
+ options: import("./Button").ButtonVariant[];
18
+ description: string;
19
+ };
20
+ color: {
21
+ control: {
22
+ type: string;
23
+ };
24
+ options: import("./Button").ButtonColor[];
25
+ description: string;
26
+ };
27
+ radius: {
28
+ control: {
29
+ type: string;
30
+ };
14
31
  options: string[];
32
+ description: string;
33
+ };
34
+ weight: {
15
35
  control: {
16
36
  type: string;
17
37
  };
38
+ options: string[];
39
+ description: string;
40
+ };
41
+ size: {
42
+ control: {
43
+ type: string;
44
+ };
45
+ options: string[];
46
+ description: string;
47
+ };
48
+ width: {
49
+ control: {
50
+ type: string;
51
+ };
52
+ options: string[];
53
+ description: string;
54
+ };
55
+ disabled: {
56
+ control: {
57
+ type: string;
58
+ };
59
+ description: string;
60
+ };
61
+ extraClasses: {
62
+ control: {
63
+ type: string;
64
+ };
65
+ description: string;
66
+ };
67
+ isLoading: {
68
+ control: {
69
+ type: string;
70
+ };
71
+ description: string;
72
+ };
73
+ children: {
74
+ control: {
75
+ type: string;
76
+ };
77
+ options: string[];
78
+ description: string;
79
+ };
80
+ as: {
81
+ control: {
82
+ type: string;
83
+ };
84
+ options: string[];
85
+ description: string;
86
+ };
87
+ onClick: {
88
+ action: string;
89
+ description: string;
18
90
  };
19
91
  };
20
92
  };
@@ -1 +1 @@
1
- {"version":3,"file":"IconButton.stories.d.ts","sourceRoot":"","sources":["../../../components/Button/IconButton.stories.tsx"],"names":[],"mappings":"AAUA,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;CAsBtB,CAAC;AAEF,eAAe,iBAAiB,CAAC;AAEjC,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;CA0BpB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;CAyBpB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;CAgCxB,CAAC;AAEF,eAAO,MAAM,kBAAkB,mBA2C9B,CAAC"}
1
+ {"version":3,"file":"IconButton.stories.d.ts","sourceRoot":"","sources":["../../../components/Button/IconButton.stories.tsx"],"names":[],"mappings":"AAkBA,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwEtB,CAAC;AAEF,eAAe,iBAAiB,CAAC;AAEjC,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;CA0BpB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;CAwBpB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;CAgCxB,CAAC;AAEF,eAAO,MAAM,kBAAkB,mBA2C9B,CAAC"}
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { css } from '@linaria/core';
3
3
  import IconButton from './IconButton';
4
4
  import * as iconComponents from '../../icons';
5
+ import { BUTTON_COLORS, BUTTON_RADII, BUTTON_SIZES, BUTTON_VARIANTS, BUTTON_WEIGHTS, SIZE_OPTIONS, } from './constant';
5
6
  // get the list of monochrome icon names
6
7
  const icons = Object.keys(iconComponents).filter((iconName) => iconComponents[iconName].type === 'monochrome');
7
8
  const iconButtonStories = {
@@ -19,11 +20,61 @@ const iconButtonStories = {
19
20
  },
20
21
  },
21
22
  argTypes: {
23
+ variant: {
24
+ control: { type: 'select' },
25
+ options: BUTTON_VARIANTS,
26
+ description: 'Different looks of button',
27
+ },
28
+ color: {
29
+ control: { type: 'select' },
30
+ options: BUTTON_COLORS,
31
+ description: 'Color of the background (solid) or stroke (outline) of the button',
32
+ },
33
+ radius: {
34
+ control: { type: 'select' },
35
+ options: BUTTON_RADII,
36
+ description: 'Border radius',
37
+ },
38
+ weight: {
39
+ control: { type: 'select' },
40
+ options: BUTTON_WEIGHTS,
41
+ description: 'Font weight of label',
42
+ },
43
+ size: {
44
+ control: { type: 'select' },
45
+ options: BUTTON_SIZES,
46
+ description: "Button's size",
47
+ },
48
+ width: {
49
+ control: { type: 'select' },
50
+ options: SIZE_OPTIONS,
51
+ description: 'Button width',
52
+ },
53
+ disabled: {
54
+ control: { type: 'boolean' },
55
+ description: 'Whether this button is disabled. No events triggered.',
56
+ },
57
+ extraClasses: {
58
+ control: { type: 'text' },
59
+ description: 'Additional classes to be added for customization',
60
+ },
61
+ isLoading: {
62
+ control: { type: 'boolean' },
63
+ description: 'Display loading icon',
64
+ },
65
+ children: {
66
+ control: { type: 'select' },
67
+ options: icons,
68
+ description: 'Icon component to display',
69
+ },
22
70
  as: {
71
+ control: { type: 'select' },
23
72
  options: ['button', 'a'],
24
- control: {
25
- type: 'select',
26
- },
73
+ description: 'HTML element or component to render as',
74
+ },
75
+ onClick: {
76
+ action: 'clicked',
77
+ description: 'Click event handler',
27
78
  },
28
79
  },
29
80
  };
@@ -52,9 +103,7 @@ export const Overview = {
52
103
  },
53
104
  };
54
105
  export const Variants = {
55
- render: ( /* args */) => (
56
- // Below is sample class definition, colors should be from theme
57
- <div style={{ display: 'flex', gap: '8px' }}>
106
+ render: () => (<div style={{ display: 'flex', gap: '8px' }}>
58
107
  <IconButton variant="default" color="primary" size="large">
59
108
  <iconComponents.Heart />
60
109
  </IconButton>
@@ -77,7 +126,7 @@ export const Variants = {
77
126
  },
78
127
  };
79
128
  export const ExtraClasses = {
80
- render: ( /* args */) => {
129
+ render: () => {
81
130
  // Below is sample class definition, colors should be from theme
82
131
  const extraClass = css `
83
132
  border: none;
@@ -105,7 +154,7 @@ export const ExtraClasses = {
105
154
  },
106
155
  },
107
156
  };
108
- export const ButtonWithNextLink = ( /* args */) => {
157
+ export const ButtonWithNextLink = () => {
109
158
  // replace "a" with NextLink
110
159
  const NextLink = 'a';
111
160
  return (<div style={{ display: 'flex', gap: '8px' }}>
@@ -0,0 +1,10 @@
1
+ import { type ButtonColor, type ButtonVariant } from './Button';
2
+ export declare const BUTTON_VARIANTS: ButtonVariant[];
3
+ export declare const BUTTON_COLORS: ButtonColor[];
4
+ export declare const BUTTON_SIZES: string[];
5
+ export declare const BUTTON_RADII: string[];
6
+ export declare const BUTTON_WEIGHTS: string[];
7
+ export declare const SIZE_OPTIONS: string[];
8
+ export declare const GHOST_BUTTON_VARIANTS: string[];
9
+ export declare const GHOST_BUTTON_COLORS: string[];
10
+ //# sourceMappingURL=constant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../../../components/Button/constant.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAEhE,eAAO,MAAM,eAAe,EAAE,aAAa,EAA6C,CAAC;AACzF,eAAO,MAAM,aAAa,EAAE,WAAW,EAYtC,CAAC;AACF,eAAO,MAAM,YAAY,UAAyC,CAAC;AACnE,eAAO,MAAM,YAAY,UAA+B,CAAC;AACzD,eAAO,MAAM,cAAc,UAAqB,CAAC;AACjD,eAAO,MAAM,YAAY,UAA2B,CAAC;AACrD,eAAO,MAAM,qBAAqB,UAA0B,CAAC;AAC7D,eAAO,MAAM,mBAAmB,UAA+C,CAAC"}
@@ -0,0 +1,21 @@
1
+ import theme from '@clad-ui/theme';
2
+ export const BUTTON_VARIANTS = ['default', 'outline', 'solid', 'tonal'];
3
+ export const BUTTON_COLORS = [
4
+ 'error',
5
+ 'info',
6
+ 'neutral',
7
+ 'primary',
8
+ 'success',
9
+ 'tertiary',
10
+ 'chotot',
11
+ 'accent',
12
+ 'caution',
13
+ 'critical',
14
+ 'positive',
15
+ ];
16
+ export const BUTTON_SIZES = ['xlarge', 'large', 'medium', 'small'];
17
+ export const BUTTON_RADII = ['circle', 'normal', 'pill'];
18
+ export const BUTTON_WEIGHTS = ['bold', 'normal'];
19
+ export const SIZE_OPTIONS = Object.keys(theme.sizes);
20
+ export const GHOST_BUTTON_VARIANTS = ['button', 'hyperlink'];
21
+ export const GHOST_BUTTON_COLORS = ['link', 'primary', 'secondary', 'tertiary'];