@chotot/clad-ui 2.2.0 → 2.3.1-next.1

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 (57) hide show
  1. package/README.md +1 -1
  2. package/dist/components/Button/Button.styles.js +12 -12
  3. package/dist/components/Button/GhostButton.styles.js +10 -10
  4. package/dist/components/Chip/Chip.d.ts +1 -1
  5. package/dist/components/Chip/Chip.d.ts.map +1 -1
  6. package/dist/components/Chip/Chip.js +2 -2
  7. package/dist/components/Chip/Chip.stories.d.ts +11 -0
  8. package/dist/components/Chip/Chip.stories.d.ts.map +1 -1
  9. package/dist/components/Chip/Chip.stories.js +81 -24
  10. package/dist/components/Chip/Chip.styles.d.ts.map +1 -1
  11. package/dist/components/Chip/Chip.styles.js +64 -58
  12. package/dist/components/Input/Input.styles.d.ts.map +1 -1
  13. package/dist/components/Input/Input.styles.js +33 -19
  14. package/dist/components/RowItem/RowItem.styles.d.ts.map +1 -1
  15. package/dist/components/RowItem/RowItem.styles.js +8 -0
  16. package/dist/components/Snack/Snack.d.ts +9 -0
  17. package/dist/components/Snack/Snack.d.ts.map +1 -1
  18. package/dist/components/Snack/Snack.js +7 -4
  19. package/dist/components/Snack/Snack.stories.d.ts +22 -0
  20. package/dist/components/Snack/Snack.stories.d.ts.map +1 -1
  21. package/dist/components/Snack/Snack.stories.js +137 -0
  22. package/dist/components/Snack/Snack.styles.d.ts +7 -1
  23. package/dist/components/Snack/Snack.styles.d.ts.map +1 -1
  24. package/dist/components/Snack/Snack.styles.js +44 -3
  25. package/dist/components/TextArea/TextArea.styles.d.ts.map +1 -1
  26. package/dist/components/TextArea/TextArea.styles.js +12 -8
  27. package/dist/icons/ChevronDown.d.ts.map +1 -1
  28. package/dist/icons/ChevronDown.js +1 -3
  29. package/dist/icons/ChevronLeft.d.ts.map +1 -1
  30. package/dist/icons/ChevronLeft.js +1 -3
  31. package/dist/icons/ChevronRight.d.ts.map +1 -1
  32. package/dist/icons/ChevronRight.js +1 -3
  33. package/dist/icons/ChevronUp.d.ts.map +1 -1
  34. package/dist/icons/ChevronUp.js +1 -3
  35. package/dist/patterns/Drawer/Drawer.d.ts +19 -10
  36. package/dist/patterns/Drawer/Drawer.d.ts.map +1 -1
  37. package/dist/patterns/Drawer/Drawer.js +30 -18
  38. package/dist/patterns/Drawer/Drawer.stories.d.ts +20 -0
  39. package/dist/patterns/Drawer/Drawer.stories.d.ts.map +1 -1
  40. package/dist/patterns/Drawer/Drawer.stories.js +329 -42
  41. package/dist/patterns/Drawer/Drawer.styles.d.ts +1 -1
  42. package/dist/patterns/Drawer/Drawer.styles.d.ts.map +1 -1
  43. package/dist/patterns/Drawer/Drawer.styles.js +11 -1
  44. package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.d.ts.map +1 -1
  45. package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.styles.d.ts.map +1 -1
  46. package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.styles.js +1 -5
  47. package/dist/storybook/Type.d.ts +1 -1
  48. package/dist/theme/chotot.d.ts +3 -2
  49. package/dist/theme/chotot.d.ts.map +1 -1
  50. package/dist/theme/chotot.js +3 -2
  51. package/dist/theme/ct-job.d.ts +3 -2
  52. package/dist/theme/ct-job.d.ts.map +1 -1
  53. package/dist/theme/ct-pty.d.ts +3 -2
  54. package/dist/theme/ct-pty.d.ts.map +1 -1
  55. package/dist/theme/ct-veh.d.ts +3 -2
  56. package/dist/theme/ct-veh.d.ts.map +1 -1
  57. package/package.json +1 -1
@@ -10,11 +10,25 @@ const inputClasses = css `
10
10
  appearance: none;
11
11
  outline: none;
12
12
  border: none;
13
- padding: 14px ${space.sm} 0 ${space.sm};
13
+ padding: 20px ${space.sm} 0 ${space.sm};
14
14
  border-radius: ${radii.lg};
15
15
  background-color: ${colors.backgroundPrimary};
16
16
  text-overflow: ellipsis;
17
- ${typo.body.section}
17
+ ${typo.body.page}
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 */
18
32
 
19
33
  &.required + label::after {
20
34
  content: '*';
@@ -39,15 +53,15 @@ const inputClasses = css `
39
53
  &::placeholder {
40
54
  opacity: 1;
41
55
  color: ${colors.textSecondary};
42
- ${typo.body.section}
56
+ ${typo.body.page}
43
57
  }
44
58
 
45
59
  &.hasPlaceholder + label,
46
60
  &.hasValue + label,
47
61
  &:-webkit-autofill + label {
48
- transform: scale(0.7143) translateY(-10px);
62
+ transform: scale(0.75) translateY(-10px);
49
63
  color: ${colors.textPrimary};
50
- font-weight: ${fontWeights.bold};
64
+ font-weight: ${fontWeights.semiBold};
51
65
  }
52
66
 
53
67
  &.showRightIcon {
@@ -57,9 +71,9 @@ const inputClasses = css `
57
71
  export default inputClasses;
58
72
  const inputFocusClasses = css `
59
73
  &:focus + label {
60
- transform: scale(0.7143) translateY(-10px);
74
+ transform: scale(0.75) translateY(-10px);
61
75
  color: ${colors.borderBlack};
62
- font-weight: ${fontWeights.bold};
76
+ font-weight: ${fontWeights.semiBold};
63
77
  }
64
78
  `;
65
79
  /**
@@ -79,14 +93,14 @@ const Paragraph = styled.p `
79
93
  text-align: left;
80
94
  margin-top: ${space.xxs};
81
95
  margin-bottom: ${space.none};
82
- ${typo.body.annotation};
96
+ ${typo.body.caption};
83
97
  `;
84
98
  /**
85
99
  * @type {React.FC<any>}
86
100
  */
87
101
  const InputWrapper = styled.div `
88
102
  width: ${sizes.full};
89
- height: ${sizes.xl};
103
+ height: 56px;
90
104
  position: relative;
91
105
  border-radius: ${radii.lg};
92
106
  border: ${borderWidths.md} ${borderStyles.solid} ${colors.borderRegular};
@@ -137,7 +151,7 @@ const InputWrapper = styled.div `
137
151
 
138
152
  & > label {
139
153
  position: absolute;
140
- top: 13px;
154
+ top: 14px;
141
155
  left: ${space.sm};
142
156
  cursor: text;
143
157
  pointer-events: none;
@@ -145,14 +159,14 @@ const InputWrapper = styled.div `
145
159
  transition: transform 0.1s ease;
146
160
  color: ${colors.textSecondary};
147
161
  margin-bottom: ${space.none};
148
- ${typo.body.section}
162
+ ${typo.body.page}
149
163
  }
150
164
 
151
165
  & > button {
152
166
  background: transparent;
153
167
  outline: none;
154
168
  border: none;
155
- height: ${sizes.xl};
169
+ height: 56px;
156
170
  min-width: ${sizes.xxs};
157
171
  position: absolute;
158
172
  top: 0;
@@ -171,7 +185,7 @@ const InputWrapper = styled.div `
171
185
 
172
186
  /* apply for svg in dropdown */
173
187
  & > svg {
174
- height: ${sizes.xl};
188
+ height: 56px;
175
189
  position: absolute;
176
190
  top: -1px;
177
191
  right: ${space.sm};
@@ -179,11 +193,11 @@ const InputWrapper = styled.div `
179
193
  }
180
194
 
181
195
  &.hasLeftIcon > input {
182
- padding-left: 40px;
196
+ padding-left: 44px;
183
197
  }
184
198
 
185
199
  &.hasLeftIcon > label {
186
- left: 40px;
200
+ left: 44px;
187
201
  }
188
202
 
189
203
  .password-icon {
@@ -261,10 +275,10 @@ const ValidationIcon = styled.div `
261
275
  `;
262
276
  const LeftIcon = styled.div `
263
277
  position: absolute;
264
- top: ${space.sm};
278
+ top: ${space.md};
265
279
  left: ${space.sm};
266
- width: ${space.mdl};
267
- height: ${space.mdl};
268
- font-size: 20px;
280
+ width: ${space.lg};
281
+ height: ${space.lg};
282
+ font-size: 24px;
269
283
  `;
270
284
  export { inputFocusClasses, InputWrapper, Paragraph, Container, TooltipWrapper, ValidationIcon, LeftIcon, };
@@ -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"}
@@ -1,6 +1,7 @@
1
1
  import React, { useState } from 'react';
2
2
  import { css } from '@linaria/core';
3
3
  import theme from '@clad-ui/theme';
4
+ import { CircleCheckFilled, WarningFilled, InfoFilled, BellFilled } from '../../icons';
4
5
  import Button from '../Button/Button';
5
6
  import Checkbox from '../Checkbox/Checkbox';
6
7
  import Snack from './Snack';
@@ -280,3 +281,139 @@ export const WithAutoHideDuration = {
280
281
  },
281
282
  },
282
283
  };
284
+ export const WithIcon = {
285
+ render: () => {
286
+ const [open1, setOpen1] = useState(false);
287
+ const [open2, setOpen2] = useState(false);
288
+ const [open3, setOpen3] = useState(false);
289
+ const [open4, setOpen4] = useState(false);
290
+ const closeAllSnack = () => {
291
+ setOpen1(false);
292
+ setOpen2(false);
293
+ setOpen3(false);
294
+ setOpen4(false);
295
+ };
296
+ const openSnackHandler1 = () => {
297
+ closeAllSnack();
298
+ setOpen1(true);
299
+ };
300
+ const closeSnackHandler1 = () => {
301
+ setOpen1(false);
302
+ };
303
+ const openSnackHandler2 = () => {
304
+ closeAllSnack();
305
+ setOpen2(true);
306
+ };
307
+ const closeSnackHandler2 = () => {
308
+ setOpen2(false);
309
+ };
310
+ const openSnackHandler3 = () => {
311
+ closeAllSnack();
312
+ setOpen3(true);
313
+ };
314
+ const closeSnackHandler3 = () => {
315
+ setOpen3(false);
316
+ };
317
+ const openSnackHandler4 = () => {
318
+ closeAllSnack();
319
+ setOpen4(true);
320
+ };
321
+ const closeSnackHandler4 = () => {
322
+ setOpen4(false);
323
+ };
324
+ return (<>
325
+ <p>Success message with icon</p>
326
+ <Button onClick={openSnackHandler1}>Show Success</Button>
327
+ {!!open1 && (<Snack onClose={closeSnackHandler1} icon={<CircleCheckFilled />}>
328
+ Cập nhật ảnh đại diện thành công
329
+ </Snack>)}
330
+ <p className={marginTopClass}>Error message with icon</p>
331
+ <Button onClick={openSnackHandler2}>Show Error</Button>
332
+ {!!open2 && (<Snack onClose={closeSnackHandler2} icon={<WarningFilled />}>
333
+ Đã có lỗi xảy ra.
334
+ </Snack>)}
335
+ <p className={marginTopClass}>Info message with icon</p>
336
+ <Button onClick={openSnackHandler3}>Show Info</Button>
337
+ {!!open3 && (<Snack onClose={closeSnackHandler3} icon={<InfoFilled />}>
338
+ Ai đang điền thông tin cho bạn...
339
+ </Snack>)}
340
+ <p className={marginTopClass}>Notification with icon and action</p>
341
+ <Button onClick={openSnackHandler4}>Show Notification</Button>
342
+ {!!open4 && (<Snack onClose={closeSnackHandler4} icon={<BellFilled />} actionLabel="Thử lại" onActionClick={() => {
343
+ console.log('Retry clicked');
344
+ }}>
345
+ Mất kết nối mạng.
346
+ </Snack>)}
347
+ </>);
348
+ },
349
+ name: 'With icon',
350
+ parameters: {
351
+ docs: {
352
+ description: {
353
+ story: 'Add custom icons to Snacks using the `icon` prop. The icon will always appear on the left side of the message. You can pass any React node as an icon.',
354
+ },
355
+ },
356
+ },
357
+ };
358
+ export const WithLayout = {
359
+ render: () => {
360
+ const [open1, setOpen1] = useState(false);
361
+ const [open2, setOpen2] = useState(false);
362
+ const [open3, setOpen3] = useState(false);
363
+ const closeAllSnack = () => {
364
+ setOpen1(false);
365
+ setOpen2(false);
366
+ setOpen3(false);
367
+ };
368
+ const openSnackHandler1 = () => {
369
+ closeAllSnack();
370
+ setOpen1(true);
371
+ };
372
+ const closeSnackHandler1 = () => {
373
+ setOpen1(false);
374
+ };
375
+ const openSnackHandler2 = () => {
376
+ closeAllSnack();
377
+ setOpen2(true);
378
+ };
379
+ const closeSnackHandler2 = () => {
380
+ setOpen2(false);
381
+ };
382
+ const openSnackHandler3 = () => {
383
+ closeAllSnack();
384
+ setOpen3(true);
385
+ };
386
+ const closeSnackHandler3 = () => {
387
+ setOpen3(false);
388
+ };
389
+ return (<>
390
+ <p>Horizontal layout (default) - Icon, text, and action button in one row</p>
391
+ <Button onClick={openSnackHandler1}>Show Horizontal</Button>
392
+ {!!open1 && (<Snack onClose={closeSnackHandler1} icon={<CircleCheckFilled />} actionLabel="Hoàn tác" layout="horizontal" desktopSize="md" autoHideDuration="xxxxl" onActionClick={() => {
393
+ console.log('Undo clicked');
394
+ }}>
395
+ Cập nhật ảnh đại diện không thành công, vui lòng thử lại với ảnh có kích thước nhỏ hơn
396
+ </Snack>)}
397
+ <p className={marginTopClass}>Vertical layout - Action button on second line</p>
398
+ <Button onClick={openSnackHandler2}>Show Vertical</Button>
399
+ {!!open2 && (<Snack onClose={closeSnackHandler2} icon={<CircleCheckFilled />} actionLabel="Đăng lại ảnh khác" layout="vertical" desktopSize="md" autoHideDuration="xxxxl" onActionClick={() => {
400
+ console.log('Re-upload clicked');
401
+ }}>
402
+ Cập nhật ảnh đại diện không thành công, vui lòng thử lại với ảnh có kích thước nhỏ hơn
403
+ </Snack>)}
404
+ <p className={marginTopClass}>Text only (centered)</p>
405
+ <Button onClick={openSnackHandler3}>Show Text Only</Button>
406
+ {!!open3 && (<Snack onClose={closeSnackHandler3}>
407
+ Tin đã được đưa vào danh sách theo dõi.
408
+ </Snack>)}
409
+ </>);
410
+ },
411
+ name: 'With layout',
412
+ parameters: {
413
+ docs: {
414
+ description: {
415
+ story: 'Use the `layout` prop to control the orientation of content and action button. `horizontal` (default) places everything in one row, while `vertical` stacks the action button on a second line. Text without icon and action button is centered.',
416
+ },
417
+ },
418
+ },
419
+ };
@@ -10,5 +10,11 @@ declare const CloseButton: import("@linaria/react").StyledMeta & import("react")
10
10
  declare const ActionButton: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Record<never, unknown> & {
11
11
  as?: import("react").ElementType;
12
12
  }>;
13
- export { SnackWrapper, StyledSnack, CloseButton, ActionButton };
13
+ declare const IconWrapper: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
14
+ as?: import("react").ElementType;
15
+ }>;
16
+ declare const ContentWrapper: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
17
+ as?: import("react").ElementType;
18
+ }>;
19
+ export { SnackWrapper, StyledSnack, CloseButton, ActionButton, IconWrapper, ContentWrapper };
14
20
  //# sourceMappingURL=Snack.styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Snack.styles.d.ts","sourceRoot":"","sources":["../../../components/Snack/Snack.styles.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,YAAY;;EAQjB,CAAC;AAEF,QAAA,MAAM,WAAW;;EA0DhB,CAAC;AAEF,QAAA,MAAM,WAAW;;EAiBhB,CAAC;AAEF,QAAA,MAAM,YAAY;;EAUjB,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"Snack.styles.d.ts","sourceRoot":"","sources":["../../../components/Snack/Snack.styles.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,YAAY;;EAQjB,CAAC;AAEF,QAAA,MAAM,WAAW;;EAiEhB,CAAC;AAEF,QAAA,MAAM,WAAW;;EAiBhB,CAAC;AAEF,QAAA,MAAM,YAAY;;EAejB,CAAC;AAEF,QAAA,MAAM,WAAW;;EAehB,CAAC;AAEF,QAAA,MAAM,cAAc;;EAYnB,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC"}
@@ -37,6 +37,7 @@ const StyledSnack = styled.div `
37
37
  display: flex;
38
38
  align-items: center;
39
39
  justify-content: space-between;
40
+ gap: 8px;
40
41
  color: ${colors.textBlank};
41
42
  background-color: ${colors.backgroundInverted};
42
43
  border-radius: ${radii.lg};
@@ -53,6 +54,12 @@ const StyledSnack = styled.div `
53
54
  animation-name: fadeOut;
54
55
  }
55
56
 
57
+ &.verticalLayout {
58
+ flex-direction: column;
59
+ align-items: flex-start;
60
+ gap: 2px;
61
+ }
62
+
56
63
  @media ${mediaQueries.tablet} {
57
64
  margin: 0 auto;
58
65
 
@@ -89,13 +96,47 @@ const CloseButton = styled.button `
89
96
  `;
90
97
  const ActionButton = styled.button `
91
98
  background-color: transparent;
92
- position: absolute;
93
- right: ${space.sm};
94
99
  color: ${colors.textChotot};
95
100
  ${typo.label.section}
101
+ padding: 0;
102
+ white-space: nowrap;
103
+ flex-shrink: 0;
104
+
105
+ .verticalLayout & {
106
+ align-self: flex-end;
107
+ }
96
108
 
97
109
  &:focus {
98
110
  outline: none;
99
111
  }
100
112
  `;
101
- export { SnackWrapper, StyledSnack, CloseButton, ActionButton };
113
+ const IconWrapper = styled.div `
114
+ display: flex;
115
+ align-items: center;
116
+ justify-content: center;
117
+ margin-right: ${space.sm};
118
+ flex-shrink: 0;
119
+ line-height: 1;
120
+ width: ${space.mdl};
121
+ height: ${space.mdl};
122
+
123
+ svg {
124
+ width: ${space.mdl};
125
+ height: ${space.mdl};
126
+ color: ${colors.iconBlank};
127
+ }
128
+ `;
129
+ const ContentWrapper = styled.div `
130
+ display: flex;
131
+ align-items: center;
132
+ gap: 0;
133
+ flex: 1;
134
+ min-width: 0;
135
+ text-align: left;
136
+
137
+ .centerText & {
138
+ justify-content: center;
139
+ text-align: center;
140
+ }
141
+ `;
142
+ export { SnackWrapper, StyledSnack, CloseButton, ActionButton, IconWrapper, ContentWrapper };
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.styles.d.ts","sourceRoot":"","sources":["../../../components/TextArea/TextArea.styles.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,SAAS;oBAAgC,MAAM;;;EAOpD,CAAC;AAEF,QAAA,MAAM,eAAe;mBAA+B,MAAM;cAAY,OAAO;;;EAiG5E,CAAC;AAEF,QAAA,MAAM,cAAc;;EA2CnB,CAAC;AAEF,QAAA,MAAM,SAAS;;EAQd,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"TextArea.styles.d.ts","sourceRoot":"","sources":["../../../components/TextArea/TextArea.styles.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,SAAS;oBAAgC,MAAM;;;EAOpD,CAAC;AAEF,QAAA,MAAM,eAAe;mBAA+B,MAAM;cAAY,OAAO;;;EAqG5E,CAAC;AAEF,QAAA,MAAM,cAAc;;EA2CnB,CAAC;AAEF,QAAA,MAAM,SAAS;;EAQd,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAE,SAAS,EAAE,CAAC"}
@@ -14,10 +14,15 @@ const TextAreaWrapper = styled.div `
14
14
  border-radius: ${radii.lg};
15
15
  border: ${borderWidths.md} ${borderStyles.solid} ${colors.borderRegular};
16
16
  height: ${({ wrapperHeight, autoSize }) => `${autoSize || wrapperHeight || 'auto'}`};
17
- min-height: ${({ wrapperHeight }) => `${wrapperHeight || sizes.xl}`};
17
+ min-height: ${({ wrapperHeight }) => `${wrapperHeight || '56px'}`};
18
18
  background-color: ${colors.backgroundPrimary};
19
19
  position: relative;
20
20
 
21
+ &:hover {
22
+ border: ${borderWidths.md} ${borderStyles.solid} ${colors.borderBlack};
23
+ transition: all 0.3s ease;
24
+ }
25
+
21
26
  /* set resize to the wrapper instead of the textarea to make sure the border move along while resizing */
22
27
  &.resize-both {
23
28
  resize: both;
@@ -53,8 +58,7 @@ const TextAreaWrapper = styled.div `
53
58
  transform-origin: top left;
54
59
  transition: transform 0.1s ease;
55
60
  color: ${colors.textPrimary};
56
- font-weight: ${fontWeights.bold};
57
- ${typo.body.section}
61
+ ${typo.body.page}
58
62
  }
59
63
 
60
64
  &:focus-within {
@@ -110,14 +114,14 @@ const TextAreaWrapper = styled.div `
110
114
  const StyledTextArea = styled.textarea `
111
115
  border-radius: ${radii.lg};
112
116
  width: ${sizes.full};
113
- padding: 0 ${space.sm} ${space.xxs} ${space.sm};
117
+ padding: 0 ${space.xs} ${space.sm} ${space.sm};
114
118
  outline: none;
115
119
  border: none;
116
120
  line-height: 20px;
117
121
  height: calc(${sizes.full} - 20px); /* minus focus-capture div */
118
122
  resize: none;
119
123
  background-color: ${colors.backgroundPrimary};
120
- ${typo.body.section}
124
+ ${typo.body.page}
121
125
 
122
126
  &:disabled {
123
127
  background-color: ${colors.backgroundSecondary};
@@ -147,8 +151,8 @@ const StyledTextArea = styled.textarea `
147
151
  &:focus + label,
148
152
  &.hasValue + label,
149
153
  &:-webkit-autofill + label {
150
- transform: scale(0.8571) translateY(-3px);
151
- ${typo.label.caption}
154
+ transform: scale(0.75) translateY(-3px);
155
+ font-weight: ${fontWeights.semiBold};
152
156
  }
153
157
  `;
154
158
  const Paragraph = styled.p `
@@ -158,6 +162,6 @@ const Paragraph = styled.p `
158
162
  text-align: left;
159
163
  margin-top: ${space.xxs};
160
164
  margin-bottom: ${space.none};
161
- ${typo.body.annotation};
165
+ ${typo.body.caption};
162
166
  `;
163
167
  export { Container, TextAreaWrapper, StyledTextArea, Paragraph };
@@ -1 +1 @@
1
- {"version":3,"file":"ChevronDown.d.ts","sourceRoot":"","sources":["../../icons/ChevronDown.js"],"names":[],"mappings":";AAEA,yDAcC"}
1
+ {"version":3,"file":"ChevronDown.d.ts","sourceRoot":"","sources":["../../icons/ChevronDown.js"],"names":[],"mappings":";AAEA,yDAeC"}
@@ -1,7 +1,5 @@
1
1
  import * as React from 'react';
2
2
  const SvgChevronDown = (props) => (<svg data-type="monochrome" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1em" height="1em" fill="none" {...props}>
3
- <g fill="currentColor">
4
- <path d="M4.68451 8.05853C4.99693 7.74611 5.50346 7.74611 5.81588 8.05853L12.0002 14.2428L18.1845 8.05853C18.4969 7.74611 19.0035 7.74611 19.3159 8.05853C19.6283 8.37095 19.6283 8.87748 19.3159 9.1899L12.5659 15.9399C12.2535 16.2523 11.7469 16.2523 11.4345 15.9399L4.68451 9.1899C4.37209 8.87748 4.37209 8.37095 4.68451 8.05853Z"/>
5
- </g>
3
+ <path d="M6.26267 9.32433C6.61242 8.94273 7.1903 8.89456 7.59666 9.19737L7.67576 9.2628L12 13.2237L16.3242 9.2628L16.4033 9.19737C16.8096 8.89457 17.3875 8.94271 17.7373 9.32433C18.087 9.70608 18.0842 10.2858 17.747 10.6642L17.6758 10.7374L12.6767 15.3175C12.2945 15.6677 11.7074 15.6676 11.3252 15.3175L6.3242 10.7374L6.25291 10.6651C5.9153 10.2868 5.91286 9.70628 6.26267 9.32433Z" fill="currentColor"/>
6
4
  </svg>);
7
5
  export default SvgChevronDown;
@@ -1 +1 @@
1
- {"version":3,"file":"ChevronLeft.d.ts","sourceRoot":"","sources":["../../icons/ChevronLeft.js"],"names":[],"mappings":";AAEA,yDAcC"}
1
+ {"version":3,"file":"ChevronLeft.d.ts","sourceRoot":"","sources":["../../icons/ChevronLeft.js"],"names":[],"mappings":";AAEA,yDAeC"}
@@ -1,7 +1,5 @@
1
1
  import * as React from 'react';
2
2
  const SvgChevronLeft = (props) => (<svg data-type="monochrome" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1em" height="1em" fill="none" {...props}>
3
- <g fill="currentColor">
4
- <path d="M15.9409 4.68353C16.2533 4.99595 16.2533 5.50248 15.9409 5.8149L9.75657 11.9992L15.9409 18.1835C16.2533 18.496 16.2533 19.0025 15.9409 19.3149C15.6285 19.6273 15.1219 19.6273 14.8095 19.3149L8.05951 12.5649C7.74709 12.2525 7.74709 11.746 8.05951 11.4335L14.8095 4.68353C15.1219 4.37111 15.6285 4.37111 15.9409 4.68353Z"/>
5
- </g>
3
+ <path d="M8.22438 12.6309C7.90403 12.2382 7.92662 11.6592 8.29274 11.293L13.2927 6.29304L13.3689 6.22469C13.7617 5.90433 14.3407 5.92693 14.7068 6.29304C15.0729 6.65916 15.0955 7.23816 14.7752 7.63094L14.7068 7.70711L10.4138 12.0001L14.7068 16.293C15.0973 16.6836 15.0973 17.3166 14.7068 17.7071C14.3163 18.0976 13.6833 18.0976 13.2927 17.7071L8.29274 12.7071L8.22438 12.6309Z" fill="currentColor"/>
6
4
  </svg>);
7
5
  export default SvgChevronLeft;
@@ -1 +1 @@
1
- {"version":3,"file":"ChevronRight.d.ts","sourceRoot":"","sources":["../../icons/ChevronRight.js"],"names":[],"mappings":";AAEA,0DAcC"}
1
+ {"version":3,"file":"ChevronRight.d.ts","sourceRoot":"","sources":["../../icons/ChevronRight.js"],"names":[],"mappings":";AAEA,0DAeC"}
@@ -1,7 +1,5 @@
1
1
  import * as React from 'react';
2
2
  const SvgChevronRight = (props) => (<svg data-type="monochrome" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1em" height="1em" fill="none" {...props}>
3
- <g fill="currentColor">
4
- <path d="M8.05951 4.68353C8.37193 4.37111 8.87846 4.37111 9.19088 4.68353L15.9409 11.4335C16.2533 11.746 16.2533 12.2525 15.9409 12.5649L9.19088 19.3149C8.87846 19.6273 8.37193 19.6273 8.05951 19.3149C7.74709 19.0025 7.74709 18.496 8.05951 18.1835L14.2438 11.9992L8.05951 5.8149C7.74709 5.50248 7.74709 4.99595 8.05951 4.68353Z"/>
5
- </g>
3
+ <path d="M16 11.9999C16 12.2651 15.8946 12.5194 15.707 12.707L10.707 17.707L10.6309 17.7753C10.2381 18.0957 9.65908 18.0731 9.29297 17.707C8.92685 17.3408 8.90426 16.7618 9.22461 16.3691L9.29297 16.2929L13.5859 11.9999L9.29297 7.70696C8.90244 7.31643 8.90244 6.68342 9.29297 6.29289C9.68349 5.90237 10.3165 5.90237 10.707 6.29289L15.707 11.2929L15.7734 11.3661C15.9193 11.5441 16 11.7678 16 11.9999Z" fill="currentColor"/>
6
4
  </svg>);
7
5
  export default SvgChevronRight;
@@ -1 +1 @@
1
- {"version":3,"file":"ChevronUp.d.ts","sourceRoot":"","sources":["../../icons/ChevronUp.js"],"names":[],"mappings":";AAEA,uDAcC"}
1
+ {"version":3,"file":"ChevronUp.d.ts","sourceRoot":"","sources":["../../icons/ChevronUp.js"],"names":[],"mappings":";AAEA,uDAeC"}
@@ -1,7 +1,5 @@
1
1
  import * as React from 'react';
2
2
  const SvgChevronUp = (props) => (<svg data-type="monochrome" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="1em" height="1em" fill="none" {...props}>
3
- <g fill="currentColor">
4
- <path d="M11.4345 8.05853C11.7469 7.74611 12.2535 7.74611 12.5659 8.05853L19.3159 14.8085C19.6283 15.121 19.6283 15.6275 19.3159 15.9399C19.0035 16.2523 18.4969 16.2523 18.1845 15.9399L12.0002 9.75559L5.81588 15.9399C5.50346 16.2523 4.99693 16.2523 4.68451 15.9399C4.37209 15.6275 4.37209 15.121 4.68451 14.8085L11.4345 8.05853Z"/>
5
- </g>
3
+ <path d="M11.3993 9.20119C11.7802 8.91389 12.3183 8.9342 12.6766 9.26271L17.6757 13.8467C18.0825 14.2198 18.11 14.8518 17.7372 15.2588C17.3639 15.6659 16.7312 15.6936 16.3241 15.3203L11.9999 11.3565L7.67565 15.3203L7.59655 15.3858C7.19021 15.6887 6.61241 15.6405 6.26257 15.2588C5.8897 14.8517 5.91729 14.2198 6.32409 13.8467L11.3251 9.26271L11.3993 9.20119Z" fill="currentColor"/>
6
4
  </svg>);
7
5
  export default SvgChevronUp;