@chotot/clad-ui 2.1.0 → 2.3.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 (62) hide show
  1. package/README.md +2 -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 +11 -6
  5. package/dist/components/Badge/Badge.stories.d.ts.map +1 -1
  6. package/dist/components/Badge/Badge.stories.js +143 -124
  7. package/dist/components/Badge/Badge.styles.d.ts +1 -1
  8. package/dist/components/Badge/Badge.styles.d.ts.map +1 -1
  9. package/dist/components/Badge/Badge.styles.js +67 -17
  10. package/dist/components/Button/Button.d.ts.map +1 -1
  11. package/dist/components/Button/Button.js +1 -0
  12. package/dist/components/Button/GhostButton.d.ts.map +1 -1
  13. package/dist/components/Button/GhostButton.js +1 -0
  14. package/dist/components/Button/IconButton.d.ts.map +1 -1
  15. package/dist/components/Button/IconButton.js +1 -0
  16. package/dist/components/Chip/Chip.d.ts +1 -1
  17. package/dist/components/Chip/Chip.d.ts.map +1 -1
  18. package/dist/components/Chip/Chip.js +2 -2
  19. package/dist/components/Chip/Chip.stories.d.ts +11 -0
  20. package/dist/components/Chip/Chip.stories.d.ts.map +1 -1
  21. package/dist/components/Chip/Chip.stories.js +81 -24
  22. package/dist/components/Chip/Chip.styles.d.ts.map +1 -1
  23. package/dist/components/Chip/Chip.styles.js +56 -50
  24. package/dist/components/Input/Input.styles.d.ts.map +1 -1
  25. package/dist/components/Input/Input.styles.js +14 -0
  26. package/dist/components/Pagination/PageItem.d.ts.map +1 -1
  27. package/dist/components/Pagination/PageItem.js +1 -0
  28. package/dist/components/RowItem/RowItem.styles.d.ts.map +1 -1
  29. package/dist/components/RowItem/RowItem.styles.js +8 -0
  30. package/dist/components/Snack/Snack.d.ts +9 -0
  31. package/dist/components/Snack/Snack.d.ts.map +1 -1
  32. package/dist/components/Snack/Snack.js +7 -4
  33. package/dist/components/Snack/Snack.stories.d.ts +22 -0
  34. package/dist/components/Snack/Snack.stories.d.ts.map +1 -1
  35. package/dist/components/Snack/Snack.stories.js +137 -0
  36. package/dist/components/Snack/Snack.styles.d.ts +7 -1
  37. package/dist/components/Snack/Snack.styles.d.ts.map +1 -1
  38. package/dist/components/Snack/Snack.styles.js +44 -3
  39. package/dist/components/TextArea/TextArea.styles.d.ts.map +1 -1
  40. package/dist/components/TextArea/TextArea.styles.js +5 -0
  41. package/dist/icons/ChevronDown.d.ts.map +1 -1
  42. package/dist/icons/ChevronDown.js +1 -3
  43. package/dist/icons/ChevronLeft.d.ts.map +1 -1
  44. package/dist/icons/ChevronLeft.js +1 -3
  45. package/dist/icons/ChevronRight.d.ts.map +1 -1
  46. package/dist/icons/ChevronRight.js +1 -3
  47. package/dist/icons/ChevronUp.d.ts.map +1 -1
  48. package/dist/icons/ChevronUp.js +1 -3
  49. package/dist/patterns/Drawer/Drawer.d.ts +19 -10
  50. package/dist/patterns/Drawer/Drawer.d.ts.map +1 -1
  51. package/dist/patterns/Drawer/Drawer.js +30 -18
  52. package/dist/patterns/Drawer/Drawer.stories.d.ts +20 -0
  53. package/dist/patterns/Drawer/Drawer.stories.d.ts.map +1 -1
  54. package/dist/patterns/Drawer/Drawer.stories.js +329 -42
  55. package/dist/patterns/Drawer/Drawer.styles.d.ts +1 -1
  56. package/dist/patterns/Drawer/Drawer.styles.d.ts.map +1 -1
  57. package/dist/patterns/Drawer/Drawer.styles.js +11 -1
  58. package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.d.ts.map +1 -1
  59. package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.styles.d.ts.map +1 -1
  60. package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.styles.js +1 -5
  61. package/dist/storybook/Popover.js +1 -0
  62. package/package.json +5 -1
@@ -2,7 +2,7 @@
2
2
  import * as React from 'react';
3
3
  import theme from '@clad-ui/theme';
4
4
  import { cx } from '../../utils';
5
- import { ChevronDownFilled, Close } from '../../icons';
5
+ import { ChevronDown, Close } from '../../icons';
6
6
  import { CloseButton, StyledChip, ChipInteractiveCss, DisabledChipCss } from './Chip.styles';
7
7
  const { sizes } = theme;
8
8
  const keysOfSizes = ['initial', ...Object.keys(sizes)];
@@ -29,7 +29,7 @@ const Chip = ({ value, size = 'lg', active = false, className = '', href = null,
29
29
  }}>
30
30
  <Close />
31
31
  </CloseButton>)}
32
- {dropdownIcon ? <ChevronDownFilled /> : null}
32
+ {dropdownIcon ? <ChevronDown /> : null}
33
33
  </StyledChip>);
34
34
  };
35
35
  export default Chip;
@@ -63,6 +63,17 @@ export declare const OutlineVariant: {
63
63
  };
64
64
  };
65
65
  };
66
+ export declare const GhostVariant: {
67
+ render: () => JSX.Element;
68
+ name: string;
69
+ parameters: {
70
+ docs: {
71
+ description: {
72
+ story: string;
73
+ };
74
+ };
75
+ };
76
+ };
66
77
  export declare const DisabledChip: {
67
78
  render: () => JSX.Element;
68
79
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Chip.stories.d.ts","sourceRoot":"","sources":["../../../components/Chip/Chip.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkChB,CAAC;AAEF,eAAe,WAAW,CAAC;AAa3B,eAAO,MAAM,QAAQ;;CAepB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;CAezB,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;CAkB1B,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;CAmBxB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;CAmBxB,CAAC;AAIF,eAAO,MAAM,gBAAgB;;;;;;;;;;CA0B5B,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;CAqBvB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;CA8BxB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;;CAkDpB,CAAC;AAEF,eAAO,MAAM,MAAM;;;;;;;;;;CA6BlB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;CA6BzB,CAAC"}
1
+ {"version":3,"file":"Chip.stories.d.ts","sourceRoot":"","sources":["../../../components/Chip/Chip.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkChB,CAAC;AAEF,eAAe,WAAW,CAAC;AAa3B,eAAO,MAAM,QAAQ;;CAepB,CAAC;AAKF,eAAO,MAAM,aAAa;;;;;;;;;;CAqBzB,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;CA+B1B,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;CAgCxB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;CAmBxB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;CAmBxB,CAAC;AAGF,eAAO,MAAM,gBAAgB;;;;;;;;;;CA0B5B,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;CAqBvB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;CA8BxB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;;CA4DpB,CAAC;AAEF,eAAO,MAAM,MAAM;;;;;;;;;;CA6BlB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;CA6BzB,CAAC"}
@@ -64,31 +64,80 @@ export const Overview = {
64
64
  </>);
65
65
  },
66
66
  };
67
+ const Br = () => <p style={{ display: 'block', content: ' ', height: '10px' }}/>;
67
68
  export const NormalVariant = {
68
69
  render: () => (<>
69
- <Chip>Normal Chip</Chip> <Chip active>Active Normal Chip</Chip>
70
+ <Chip>Normal Chip</Chip>{' '}
71
+ <Chip active>Active Normal Chip</Chip>{' '}
72
+ <Chip disabled>Disabled Normal Chip</Chip>
73
+ <Br />
74
+ <Chip onClose={onChipClosed}>Normal with Close</Chip>{' '}
75
+ <Chip dropdownIcon>Normal with Dropdown</Chip>{' '}
76
+ <Chip icon={<Label />}>Normal with Icon</Chip>
70
77
  </>),
71
78
  name: 'Normal variant',
72
79
  parameters: {
73
80
  docs: {
74
81
  description: {
75
- story: 'Normal is the default variant',
82
+ story: 'Normal is the default variant with filled background.',
76
83
  },
77
84
  },
78
85
  },
79
86
  };
80
87
  export const OutlineVariant = {
81
88
  render: () => (<>
82
- <Chip variant="outline">Outline Chip</Chip>
89
+ <Chip variant="outline">Outline Chip</Chip>{' '}
83
90
  <Chip variant="outline" active>
84
91
  Active Outline Chip
92
+ </Chip>{' '}
93
+ <Chip variant="outline" disabled>
94
+ Disabled Outline Chip
95
+ </Chip>
96
+ <Br />
97
+ <Chip variant="outline" onClose={onChipClosed}>
98
+ Outline with Close
99
+ </Chip>{' '}
100
+ <Chip variant="outline" dropdownIcon>
101
+ Outline with Dropdown
102
+ </Chip>{' '}
103
+ <Chip variant="outline" icon={<Label />}>
104
+ Outline with Icon
85
105
  </Chip>
86
106
  </>),
87
107
  name: 'Outline variant',
88
108
  parameters: {
89
109
  docs: {
90
110
  description: {
91
- story: 'Use prop variant="outline" to select outline variant',
111
+ story: 'Use prop variant="outline" to select outline variant with border.',
112
+ },
113
+ },
114
+ },
115
+ };
116
+ export const GhostVariant = {
117
+ render: () => (<>
118
+ <Chip variant="ghost">Ghost Chip</Chip>{' '}
119
+ <Chip variant="ghost" active>
120
+ Active Ghost Chip
121
+ </Chip>{' '}
122
+ <Chip variant="ghost" disabled>
123
+ Disabled Ghost Chip
124
+ </Chip>
125
+ <Br />
126
+ <Chip variant="ghost" onClose={onChipClosed}>
127
+ Ghost with Close
128
+ </Chip>{' '}
129
+ <Chip variant="ghost" dropdownIcon>
130
+ Ghost with Dropdown
131
+ </Chip>{' '}
132
+ <Chip variant="ghost" icon={<Label />}>
133
+ Ghost with Icon
134
+ </Chip>
135
+ </>),
136
+ name: 'Ghost variant',
137
+ parameters: {
138
+ docs: {
139
+ description: {
140
+ story: 'Use prop variant="ghost" to select ghost variant. Ghost chips have white background by default, light background on hover, and gray background when active.',
92
141
  },
93
142
  },
94
143
  },
@@ -125,7 +174,6 @@ export const WithLeftIcon = {
125
174
  },
126
175
  },
127
176
  };
128
- const Br = () => <p style={{ display: 'block', content: ' ', height: '10px' }}/>;
129
177
  export const WithDropdownIcon = {
130
178
  render: () => (<div>
131
179
  <Chip dropdownIcon>Default Chip</Chip>
@@ -196,47 +244,56 @@ export const WithMinWidth = {
196
244
  };
197
245
  export const WithSize = {
198
246
  render: () => (<>
199
- <p>Size sm with height=24px</p>
247
+ <p>Size sm with height=24px, icon 16px, gap 2px</p>
200
248
  <Chip size="sm">Size sm</Chip>
201
249
  <Chip size="sm" active>
202
- Size sm
250
+ Active
251
+ </Chip>
252
+ <Chip size="sm" icon={<Label />}>
253
+ With Icon
203
254
  </Chip>
204
- <Chip size="sm" variant="outline">
205
- Size sm
255
+ <Chip size="sm" onClose={onChipClosed}>
256
+ With Close
206
257
  </Chip>
207
- <Chip size="sm" variant="outline" active>
208
- Size sm
258
+ <Chip size="sm" dropdownIcon>
259
+ With Dropdown
209
260
  </Chip>
210
261
  <Br />
211
- <p>Size lg with height=32px</p>
262
+ <p>Size lg with height=32px, icon 20px, gap 4px (default)</p>
212
263
  <Chip size="lg">Size lg</Chip>
213
264
  <Chip size="lg" active>
214
- Size lg
265
+ Active
215
266
  </Chip>
216
- <Chip size="lg" variant="outline">
217
- Size lg
267
+ <Chip size="lg" icon={<Label />}>
268
+ With Icon
218
269
  </Chip>
219
- <Chip size="lg" variant="outline" active>
220
- Size lg
270
+ <Chip size="lg" onClose={onChipClosed}>
271
+ With Close
272
+ </Chip>
273
+ <Chip size="lg" dropdownIcon>
274
+ With Dropdown
221
275
  </Chip>
222
276
  <Br />
223
- <p>Size xl with height=40px</p>
277
+ <p>Size xl with height=40px, icon 24px, gap 4px</p>
224
278
  <Chip size="xl">Size xl</Chip>
225
279
  <Chip size="xl" active>
226
- Size xl
280
+ Active
281
+ </Chip>
282
+ <Chip size="xl" icon={<Label />}>
283
+ With Icon
227
284
  </Chip>
228
- <Chip size="xl" variant="outline">
229
- Size xl
285
+ <Chip size="xl" onClose={onChipClosed}>
286
+ With Close
230
287
  </Chip>
231
- <Chip size="xl" variant="outline" active>
232
- Size xl
288
+ <Chip size="xl" dropdownIcon>
289
+ With Dropdown
233
290
  </Chip>
234
291
  </>),
235
292
  name: 'With size',
236
293
  parameters: {
237
294
  docs: {
238
295
  description: {
239
- story: 'Chip with size will affect height',
296
+ story: 'Chip with different sizes. Each size has different height, icon size, and gap between icon and text. Size sm: 16px icon with 2px gap. Size lg: 20px icon with 4px gap (default). Size xl: 24px icon with 4px gap.',
240
297
  },
241
298
  },
242
299
  },
@@ -1 +1 @@
1
- {"version":3,"file":"Chip.styles.d.ts","sourceRoot":"","sources":["../../../components/Chip/Chip.styles.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,UAAU;UACR,MAAM;cACF,MAAM;;;EAiFjB,CAAC;AAEF,QAAA,MAAM,kBAAkB,0CAuBvB,CAAC;AAEF,QAAA,MAAM,eAAe,0CAepB,CAAC;AAEF,QAAA,MAAM,WAAW;;EAiDhB,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,kBAAkB,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"Chip.styles.d.ts","sourceRoot":"","sources":["../../../components/Chip/Chip.styles.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,UAAU;UACR,MAAM;cACF,MAAM;;;EAuGjB,CAAC;AAEF,QAAA,MAAM,kBAAkB,0CAmCvB,CAAC;AAEF,QAAA,MAAM,eAAe,0CAwBpB,CAAC;AAEF,QAAA,MAAM,WAAW;;EAYhB,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,kBAAkB,EAAE,eAAe,EAAE,CAAC"}
@@ -10,7 +10,7 @@ const StyledChip = styled.span `
10
10
  display: inline-flex;
11
11
  justify-content: center;
12
12
  align-items: center;
13
- gap: 2px;
13
+ gap: 4px;
14
14
  height: ${({ size }) => sizes[size]};
15
15
  width: fit-content;
16
16
  border-radius: ${radii.pill};
@@ -18,15 +18,17 @@ const StyledChip = styled.span `
18
18
  cursor: pointer;
19
19
  min-width: ${({ minWidth }) => minWidth};
20
20
  text-align: center;
21
+ vertical-align: middle;
21
22
 
22
23
  &.size-sm {
23
24
  height: ${sizes.sm};
24
25
  padding: 3px ${space.xs};
26
+ gap: 2px;
25
27
  ${typo.tagline.annotation};
26
28
 
27
29
  svg {
28
- width: ${sizes.xxs};
29
- height: ${sizes.xxs};
30
+ width: 16px;
31
+ height: 16px;
30
32
  }
31
33
  }
32
34
 
@@ -47,8 +49,8 @@ const StyledChip = styled.span `
47
49
  ${typo.tagline.section};
48
50
 
49
51
  svg {
50
- width: ${sizes.sm};
51
- height: ${sizes.sm};
52
+ width: 24px;
53
+ height: 24px;
52
54
  }
53
55
  }
54
56
 
@@ -58,11 +60,31 @@ const StyledChip = styled.span `
58
60
  }
59
61
 
60
62
  &.variant-outline.active {
61
- border: ${borderWidths.sm} solid ${colors.borderBlack};
63
+ border: ${borderWidths.sm} solid ${colors.borderBold};
62
64
  background-color: ${colors.backgroundSecondary};
63
65
  color: ${colors.textPrimary};
64
66
  }
65
67
 
68
+ &.variant-ghost {
69
+ background-color: ${colors.backgroundPrimary};
70
+ color: ${colors.textPrimary};
71
+ }
72
+
73
+ &.variant-ghost:not(.active):hover {
74
+ background-color: ${colors.interactionNeutralLightHover};
75
+ color: ${colors.textPrimary};
76
+ }
77
+
78
+ &.variant-ghost.active {
79
+ background-color: ${colors.backgroundSecondary};
80
+ color: ${colors.textPrimary};
81
+ }
82
+
83
+ &.variant-ghost.active:hover {
84
+ background-color: ${colors.interactionNeutralLightHover};
85
+ color: ${colors.textPrimary};
86
+ }
87
+
66
88
  &:hover {
67
89
  background-color: ${colors.interactionNeutralLightHover};
68
90
  }
@@ -106,12 +128,25 @@ const ChipInteractiveCss = css `
106
128
  background-color: ${colors.interactionNeutralLightHover};
107
129
  color: ${colors.textPrimary};
108
130
  }
131
+
132
+ &.variant-ghost:not([href]):hover,
133
+ &.variant-ghost:hover {
134
+ background-color: ${colors.interactionNeutralLightHover};
135
+ color: ${colors.textPrimary};
136
+ }
137
+
138
+ &.variant-ghost.active:not([href]):hover,
139
+ &.variant-ghost.active:hover {
140
+ background-color: ${colors.interactionNeutralLightHover};
141
+ color: ${colors.textPrimary};
142
+ }
109
143
  `;
110
144
  const DisabledChipCss = css `
111
145
  /* stylelint-disable declaration-no-important */
112
146
  color: ${colors.textDisabled} !important;
113
147
  user-select: none;
114
148
  cursor: not-allowed;
149
+
115
150
  &.variant-normal,
116
151
  &.variant-normal:hover,
117
152
  &.variant-outline,
@@ -122,55 +157,26 @@ const DisabledChipCss = css `
122
157
  &.variant-outline {
123
158
  border: 1px solid ${colors.borderThin};
124
159
  }
160
+
161
+ &.variant-ghost,
162
+ &.variant-ghost:hover,
163
+ &.variant-ghost.active,
164
+ &.variant-ghost.active:hover {
165
+ background-color: ${colors.backgroundPrimary} !important;
166
+ color: ${colors.textDisabled} !important;
167
+ }
125
168
  `;
126
169
  const CloseButton = styled.button `
127
170
  background: transparent;
171
+ border: none;
128
172
  display: flex;
129
173
  justify-content: center;
130
174
  align-items: center;
131
-
132
- /* Increase hit box and maintain layout */
133
- padding: ${space.sm};
134
- margin: -${space.sm};
135
- margin-left: -${space.xs};
136
-
137
- svg {
138
- background-color: ${colors.iconTertiary};
139
- border-radius: ${radii.circle};
140
- color: ${colors.buttonBlank};
141
- }
142
- &:hover {
143
- svg {
144
- background-color: ${colors.gray300};
145
- }
146
- }
147
- &:active {
148
- svg {
149
- background-color: ${colors.gray500};
150
- }
151
- }
152
- &:focus {
153
- outline: none;
154
- }
155
- &.size-sm {
156
- svg {
157
- width: 12px;
158
- height: 12px;
159
- }
160
- }
161
-
162
- &.size-lg {
163
- svg {
164
- width: 14px;
165
- height: 14px;
166
- }
167
- }
168
-
169
- &.size-xl {
170
- svg {
171
- width: 16px;
172
- height: 16px;
173
- }
174
- }
175
+ width: 24px;
176
+ height: 24px;
177
+ padding: 0;
178
+ margin: 0;
179
+ cursor: pointer;
180
+ color: inherit;
175
181
  `;
176
182
  export { CloseButton, StyledChip, ChipInteractiveCss, DisabledChipCss };
@@ -1 +1 @@
1
- {"version":3,"file":"Input.styles.d.ts","sourceRoot":"","sources":["../../../components/Input/Input.styles.ts"],"names":[],"mappings":"AAkBA,QAAA,MAAM,YAAY,0CAmDjB,CAAC;AAEF,eAAe,YAAY,CAAC;AAE5B,QAAA,MAAM,iBAAiB,0CAMtB,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,SAAS;oBACG,MAAM;;;EAOvB,CAAC;AAEF,QAAA,MAAM,SAAS;;EAQd,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,YAAY;mBACD,MAAM;;;EA2GtB,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,cAAc;;EA2DnB,CAAC;AAEF,QAAA,MAAM,cAAc;;EAInB,CAAC;AAEF,QAAA,MAAM,QAAQ;;EAOb,CAAC;AAEF,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,SAAS,EACT,cAAc,EACd,cAAc,EACd,QAAQ,GACT,CAAC"}
1
+ {"version":3,"file":"Input.styles.d.ts","sourceRoot":"","sources":["../../../components/Input/Input.styles.ts"],"names":[],"mappings":"AAkBA,QAAA,MAAM,YAAY,0CAiEjB,CAAC;AAEF,eAAe,YAAY,CAAC;AAE5B,QAAA,MAAM,iBAAiB,0CAMtB,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,SAAS;oBACG,MAAM;;;EAOvB,CAAC;AAEF,QAAA,MAAM,SAAS;;EAQd,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,YAAY;mBACD,MAAM;;;EA2GtB,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,cAAc;;EA2DnB,CAAC;AAEF,QAAA,MAAM,cAAc;;EAInB,CAAC;AAEF,QAAA,MAAM,QAAQ;;EAOb,CAAC;AAEF,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,SAAS,EACT,cAAc,EACd,cAAc,EACd,QAAQ,GACT,CAAC"}
@@ -16,6 +16,20 @@ const inputClasses = css `
16
16
  text-overflow: ellipsis;
17
17
  ${typo.body.section}
18
18
 
19
+ /* Hide the up and down arrows in the input number */
20
+ /* stylelint-disable property-no-vendor-prefix */
21
+ &::-webkit-outer-spin-button,
22
+ &::-webkit-inner-spin-button {
23
+ -webkit-appearance: none;
24
+ margin: 0;
25
+ }
26
+
27
+ /* Firefox */
28
+ &[type='number'] {
29
+ -moz-appearance: textfield;
30
+ }
31
+ /* stylelint-enable property-no-vendor-prefix */
32
+
19
33
  &.required + label::after {
20
34
  content: '*';
21
35
  margin-left: ${space.xxs};
@@ -1 +1 @@
1
- {"version":3,"file":"PageItem.d.ts","sourceRoot":"","sources":["../../../components/Pagination/PageItem.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGnE,MAAM,WAAW,aAAc,SAAQ,eAAe,CAAC,QAAQ,CAAC;IAC9D;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,GAAG,CAAC,EAAE,QAAQ,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;CAC1C;AAED,QAAA,MAAM,QAAQ,uFAWZ,CAAC;AAEH,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"PageItem.d.ts","sourceRoot":"","sources":["../../../components/Pagination/PageItem.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGnE,MAAM,WAAW,aAAc,SAAQ,eAAe,CAAC,QAAQ,CAAC;IAC9D;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,GAAG,CAAC,EAAE,QAAQ,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;CAC1C;AAED,QAAA,MAAM,QAAQ,uFAWZ,CAAC;AAIH,eAAe,QAAQ,CAAC"}
@@ -12,4 +12,5 @@ const PageItem = forwardRef((props, ref) => {
12
12
  };
13
13
  return React.createElement(as || 'button', attributes, page || children);
14
14
  });
15
+ PageItem.displayName = 'PageItem';
15
16
  export default PageItem;
@@ -1 +1 @@
1
- {"version":3,"file":"RowItem.styles.d.ts","sourceRoot":"","sources":["../../../components/RowItem/RowItem.styles.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,0CAcxB,CAAC;AAEF,eAAO,MAAM,SAAS;aACX,MAAM;eACJ,MAAM;YACT;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf;;;EAeF,CAAC;AAEF,eAAO,MAAM,UAAU;;EAGtB,CAAC;AAEF,eAAO,MAAM,UAAU;;EAKtB,CAAC;AAEF,eAAO,MAAM,YAAY;cACb,OAAO;;;EAUlB,CAAC;AAEF,eAAO,MAAM,iBAAiB;;EAG7B,CAAC;AAEF,eAAO,MAAM,kBAAkB;iBAA6B,OAAO;;;EAIlE,CAAC"}
1
+ {"version":3,"file":"RowItem.styles.d.ts","sourceRoot":"","sources":["../../../components/RowItem/RowItem.styles.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,0CAcxB,CAAC;AAEF,eAAO,MAAM,SAAS;aACX,MAAM;eACJ,MAAM;YACT;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf;;;EAeF,CAAC;AAEF,eAAO,MAAM,UAAU;;EAWtB,CAAC;AAEF,eAAO,MAAM,UAAU;;EAKtB,CAAC;AAEF,eAAO,MAAM,YAAY;cACb,OAAO;;;EAUlB,CAAC;AAEF,eAAO,MAAM,iBAAiB;;EAG7B,CAAC;AAEF,eAAO,MAAM,kBAAkB;iBAA6B,OAAO;;;EAIlE,CAAC"}
@@ -35,6 +35,14 @@ export const StyledRow = styled.div `
35
35
  export const StyledIcon = styled.div `
36
36
  max-width: fit-content;
37
37
  width: auto;
38
+ display: flex;
39
+ align-items: center;
40
+ justify-content: center;
41
+
42
+ /* vertical centering for checkbox and radio */
43
+ label, div {
44
+ height: ${sizes.xs};
45
+ }
38
46
  `;
39
47
  export const StyledText = styled.div `
40
48
  width: 100%;
@@ -29,6 +29,15 @@ export interface SnackProps {
29
29
  * Label of action button
30
30
  */
31
31
  actionLabel?: string;
32
+ /**
33
+ * Custom icon to display on the left
34
+ */
35
+ icon?: React.ReactNode;
36
+ /**
37
+ * Layout orientation for content and action button
38
+ * @default 'horizontal'
39
+ */
40
+ layout?: 'horizontal' | 'vertical';
32
41
  }
33
42
  /**
34
43
  * Snack is used to inform user of a process that has just been performed or will perform.
@@ -1 +1 @@
1
- {"version":3,"file":"Snack.d.ts","sourceRoot":"","sources":["../../../components/Snack/Snack.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAc,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAQvD,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjC;;OAEG;IACH,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAC3D;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAuD/B,CAAC;AAEF,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"Snack.d.ts","sourceRoot":"","sources":["../../../components/Snack/Snack.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAc,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAevD,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjC;;OAEG;IACH,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAC3D;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;CACpC;AAED;;;;GAIG;AACH,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAkE/B,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -2,7 +2,7 @@
2
2
  import * as React from 'react';
3
3
  import theme from '@clad-ui/theme';
4
4
  import { cx, noop } from '../../utils';
5
- import { SnackWrapper, StyledSnack, CloseButton, ActionButton } from './Snack.styles';
5
+ import { SnackWrapper, StyledSnack, CloseButton, ActionButton, IconWrapper, ContentWrapper, } from './Snack.styles';
6
6
  import createUniversalPortal from '../../utils/createUniversalPortal';
7
7
  import { Close } from '../../icons';
8
8
  const { durations } = theme;
@@ -11,7 +11,7 @@ const { durations } = theme;
11
11
  *
12
12
  * `✅ Stable`
13
13
  */
14
- const Snack = ({ children, onClose = noop, desktopSize = 'lg', autoHideDuration = 'xl', haveClose = false, onActionClick = () => { }, actionLabel = '', }) => {
14
+ const Snack = ({ children, onClose = noop, desktopSize = 'lg', autoHideDuration = 'xl', haveClose = false, onActionClick = () => { }, actionLabel = '', icon, layout = 'horizontal', }) => {
15
15
  const { useState, useEffect } = React;
16
16
  const [isExiting, setIsExiting] = useState(false);
17
17
  useEffect(() => {
@@ -30,8 +30,11 @@ const Snack = ({ children, onClose = noop, desktopSize = 'lg', autoHideDuration
30
30
  };
31
31
  return (<>
32
32
  {createUniversalPortal(<SnackWrapper>
33
- <StyledSnack className={cx(desktopSize, isExiting && 'exit')} onAnimationEnd={onAnimationEnd} data-clad="Snack">
34
- {children}
33
+ <StyledSnack className={cx(desktopSize, isExiting && 'exit', actionLabel && 'hasAction', layout === 'vertical' && actionLabel && 'verticalLayout', !icon && !actionLabel && !haveClose && 'centerText')} onAnimationEnd={onAnimationEnd} data-clad="Snack">
34
+ <ContentWrapper>
35
+ {!!icon && <IconWrapper>{icon}</IconWrapper>}
36
+ {children}
37
+ </ContentWrapper>
35
38
  {!!haveClose && actionLabel.length === 0 && (<CloseButton type="button" onClick={() => {
36
39
  onClose();
37
40
  }}>
@@ -85,4 +85,26 @@ export declare const WithAutoHideDuration: {
85
85
  };
86
86
  };
87
87
  };
88
+ export declare const WithIcon: {
89
+ render: () => JSX.Element;
90
+ name: string;
91
+ parameters: {
92
+ docs: {
93
+ description: {
94
+ story: string;
95
+ };
96
+ };
97
+ };
98
+ };
99
+ export declare const WithLayout: {
100
+ render: () => JSX.Element;
101
+ name: string;
102
+ parameters: {
103
+ docs: {
104
+ description: {
105
+ story: string;
106
+ };
107
+ };
108
+ };
109
+ };
88
110
  //# sourceMappingURL=Snack.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Snack.stories.d.ts","sourceRoot":"","sources":["../../../components/Snack/Snack.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AASxC,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCjB,CAAC;AAEF,eAAe,YAAY,CAAC;AAM5B,eAAO,MAAM,QAAQ;;CAgBpB,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;CAoD/B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;CAqD3B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;CA6D5B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;CAsE3B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;CAkDhC,CAAC"}
1
+ {"version":3,"file":"Snack.stories.d.ts","sourceRoot":"","sources":["../../../components/Snack/Snack.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAUxC,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCjB,CAAC;AAEF,eAAe,YAAY,CAAC;AAM5B,eAAO,MAAM,QAAQ;;CAgBpB,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;CAoD/B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;CAqD3B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;CA6D5B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;CAsE3B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;CAkDhC,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;;CA8FpB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;CA2FtB,CAAC"}