@chotot/clad-ui 2.0.0-next.4 → 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.
- package/README.md +7 -9
- package/dist/components/Announcer/Announcer.stories.d.ts.map +1 -1
- package/dist/components/Announcer/Announcer.stories.js +1 -26
- package/dist/components/Badge/Badge.d.ts +1 -1
- package/dist/components/Badge/Badge.d.ts.map +1 -1
- package/dist/components/Badge/Badge.js +34 -24
- package/dist/components/Badge/Badge.stories.d.ts.map +1 -1
- package/dist/components/Badge/Badge.stories.js +61 -54
- package/dist/components/Badge/Badge.styles.d.ts +1 -0
- package/dist/components/Badge/Badge.styles.d.ts.map +1 -1
- package/dist/components/Badge/Badge.styles.js +17 -8
- package/dist/components/Breadcrumbs/BreadcrumbItem.d.ts +6 -0
- package/dist/components/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -0
- package/dist/components/Breadcrumbs/BreadcrumbItem.js +11 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +7 -25
- package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts +0 -11
- package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts.map +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.stories.js +47 -96
- package/dist/components/Button/Button.d.ts +8 -17
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.js +5 -3
- package/dist/components/Button/Button.stories.d.ts +78 -4
- package/dist/components/Button/Button.stories.d.ts.map +1 -1
- package/dist/components/Button/Button.stories.js +105 -11
- package/dist/components/Button/Button.styles.d.ts.map +1 -1
- package/dist/components/Button/Button.styles.js +30 -11
- package/dist/components/Button/GhostButton.d.ts +6 -26
- package/dist/components/Button/GhostButton.d.ts.map +1 -1
- package/dist/components/Button/GhostButton.js +4 -4
- package/dist/components/Button/GhostButton.stories.d.ts +80 -2
- package/dist/components/Button/GhostButton.stories.d.ts.map +1 -1
- package/dist/components/Button/GhostButton.stories.js +80 -7
- package/dist/components/Button/GhostButton.styles.d.ts.map +1 -1
- package/dist/components/Button/GhostButton.styles.js +17 -1
- package/dist/components/Button/IconButton.d.ts +1 -2
- package/dist/components/Button/IconButton.d.ts.map +1 -1
- package/dist/components/Button/IconButton.js +2 -7
- package/dist/components/Button/IconButton.stories.d.ts +75 -3
- package/dist/components/Button/IconButton.stories.d.ts.map +1 -1
- package/dist/components/Button/IconButton.stories.js +74 -7
- package/dist/components/Button/constant.d.ts +10 -0
- package/dist/components/Button/constant.d.ts.map +1 -0
- package/dist/components/Button/constant.js +21 -0
- package/dist/components/Checkbox/Checkbox.stories.d.ts +0 -10
- package/dist/components/Checkbox/Checkbox.stories.d.ts.map +1 -1
- package/dist/components/Checkbox/Checkbox.stories.js +1 -34
- package/dist/components/Chip/Chip.stories.js +1 -1
- package/dist/components/CurrencyInput/CurrencyInput.stories.js +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +4 -0
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.js +4 -1
- package/dist/components/DatePicker/DatePicker.stories.d.ts +1 -0
- package/dist/components/DatePicker/DatePicker.stories.d.ts.map +1 -1
- package/dist/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/components/Dropdown/Dropdown.js +5 -0
- package/dist/components/Dropdown/Dropdown.styles.d.ts.map +1 -1
- package/dist/components/Dropdown/Dropdown.styles.js +27 -3
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Input/Input.d.ts.map +1 -1
- package/dist/components/Input/Input.js +17 -15
- package/dist/components/Input/Input.stories.js +1 -1
- package/dist/components/Pagination/PageItem.d.ts +6 -11
- package/dist/components/Pagination/PageItem.d.ts.map +1 -1
- package/dist/components/Pagination/PageItem.js +11 -5
- package/dist/components/Pagination/Pagination.stories.d.ts +0 -3
- package/dist/components/Pagination/Pagination.stories.d.ts.map +1 -1
- package/dist/components/Pagination/Pagination.stories.js +5 -15
- package/dist/components/Popover/Popover.stories.d.ts.map +1 -1
- package/dist/components/Popover/Popover.stories.js +1 -0
- package/dist/components/RadioButton/RadioButton.stories.d.ts +0 -10
- package/dist/components/RadioButton/RadioButton.stories.d.ts.map +1 -1
- package/dist/components/RadioButton/RadioButton.stories.js +1 -38
- package/dist/components/RowItem/RowItem.d.ts.map +1 -1
- package/dist/components/RowItem/RowItem.js +3 -6
- package/dist/components/RowItem/RowItem.stories.d.ts.map +1 -1
- package/dist/components/RowItem/RowItem.stories.js +1 -2
- package/dist/components/Slider/Slider.stories.js +1 -1
- package/dist/components/Snack/Snack.stories.js +1 -1
- package/dist/components/Tabs/Tab.d.ts +7 -14
- package/dist/components/Tabs/Tab.d.ts.map +1 -1
- package/dist/components/Tabs/Tab.js +6 -9
- package/dist/components/Tabs/Tabs.stories.d.ts +3 -3
- package/dist/components/Tabs/Tabs.stories.d.ts.map +1 -1
- package/dist/components/Tabs/Tabs.stories.js +32 -10
- package/dist/components/Tabs/Tabs.styles.js +1 -1
- package/dist/components/TextArea/TextArea.d.ts +1 -1
- package/dist/components/TextArea/TextArea.stories.js +1 -1
- package/dist/components/TextLabel/TextLabel.stories.js +1 -1
- package/dist/components/ToggleSwitch/ToggleSwitch.stories.js +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/Tooltip/Tooltip.js +2 -1
- package/dist/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/components/Tooltip/Tooltip.stories.js +1 -30
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/patterns/Drawer/Drawer.d.ts +1 -0
- package/dist/patterns/Drawer/Drawer.d.ts.map +1 -1
- package/dist/patterns/Drawer/Drawer.js +7 -16
- package/dist/patterns/Drawer/Drawer.stories.d.ts +6 -0
- package/dist/patterns/Drawer/Drawer.stories.d.ts.map +1 -1
- package/dist/patterns/Drawer/Drawer.stories.js +23 -24
- package/dist/patterns/Drawer/Drawer.styles.d.ts +1 -2
- package/dist/patterns/Drawer/Drawer.styles.d.ts.map +1 -1
- package/dist/patterns/Drawer/Drawer.styles.js +1 -6
- package/dist/patterns/EmptyState/EmptyState.d.ts +1 -1
- package/dist/patterns/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/patterns/EmptyState/EmptyState.js +52 -47
- package/dist/patterns/EmptyState/EmptyState.stories.d.ts +11 -1
- package/dist/patterns/EmptyState/EmptyState.stories.d.ts.map +1 -1
- package/dist/patterns/EmptyState/EmptyState.stories.js +51 -12
- package/dist/patterns/EmptyState/EmptyState.styles.d.ts +3 -15
- package/dist/patterns/EmptyState/EmptyState.styles.d.ts.map +1 -1
- package/dist/patterns/EmptyState/EmptyState.styles.js +23 -40
- package/dist/patterns/InputGroup/InputGroup.d.ts +1 -1
- package/dist/patterns/InputGroup/InputGroup.styles.d.ts.map +1 -1
- package/dist/patterns/InputGroup/InputGroup.styles.js +3 -2
- package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.d.ts +1 -1
- package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.d.ts.map +1 -1
- package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.js +4 -0
- package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.stories.js +1 -1
- package/dist/patterns/Popup/Popup.d.ts +1 -0
- package/dist/patterns/Popup/Popup.d.ts.map +1 -1
- package/dist/patterns/Popup/Popup.js +6 -15
- package/dist/patterns/Popup/Popup.stories.d.ts +6 -0
- package/dist/patterns/Popup/Popup.stories.d.ts.map +1 -1
- package/dist/patterns/Popup/Popup.stories.js +29 -30
- package/dist/patterns/Popup/Popup.styles.d.ts +1 -2
- package/dist/patterns/Popup/Popup.styles.d.ts.map +1 -1
- package/dist/patterns/Popup/Popup.styles.js +1 -6
- package/dist/patterns/RangeInput/RangeInput.d.ts +30 -0
- package/dist/patterns/RangeInput/RangeInput.d.ts.map +1 -0
- package/dist/patterns/RangeInput/RangeInput.js +27 -0
- package/dist/patterns/RangeInput/RangeInput.stories.d.ts +68 -0
- package/dist/patterns/RangeInput/RangeInput.stories.d.ts.map +1 -0
- package/dist/patterns/RangeInput/RangeInput.stories.js +121 -0
- package/dist/patterns/RangeInput/RangeInput.styles.d.ts +5 -0
- package/dist/patterns/RangeInput/RangeInput.styles.d.ts.map +1 -0
- package/dist/patterns/RangeInput/RangeInput.styles.js +32 -0
- package/dist/patterns/SearchInput/SearchInput.d.ts +1 -1
- package/dist/patterns/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/patterns/SearchInput/SearchInput.js +7 -8
- package/dist/patterns/SearchInput/SearchInput.stories.d.ts.map +1 -1
- package/dist/patterns/SearchInput/SearchInput.stories.js +1 -3
- package/dist/patterns/Searchbar/Searchbar.d.ts +28 -0
- package/dist/patterns/Searchbar/Searchbar.d.ts.map +1 -0
- package/dist/patterns/Searchbar/Searchbar.js +37 -0
- package/dist/patterns/Searchbar/Searchbar.stories.d.ts +70 -0
- package/dist/patterns/Searchbar/Searchbar.stories.d.ts.map +1 -0
- package/dist/patterns/Searchbar/Searchbar.stories.js +80 -0
- package/dist/patterns/Searchbar/Searchbar.styles.d.ts +3 -0
- package/dist/patterns/Searchbar/Searchbar.styles.d.ts.map +1 -0
- package/dist/patterns/Searchbar/Searchbar.styles.js +48 -0
- package/dist/patterns/TagCloud/TagCloud.d.ts +1 -1
- package/dist/patterns/TagCloud/TagCloud.stories.d.ts.map +1 -1
- package/dist/patterns/TagCloud/TagCloud.stories.js +1 -5
- package/dist/patterns/index.d.ts +4 -0
- package/dist/patterns/index.d.ts.map +1 -1
- package/dist/patterns/index.js +2 -0
- package/dist/storybook/ColorFoundationList.js +2 -2
- package/dist/theme/chotot.d.ts +57 -52
- package/dist/theme/chotot.d.ts.map +1 -1
- package/dist/theme/chotot.js +18 -13
- package/dist/theme/ct-job.d.ts +56 -51
- package/dist/theme/ct-job.d.ts.map +1 -1
- package/dist/theme/ct-pty.d.ts +56 -51
- package/dist/theme/ct-pty.d.ts.map +1 -1
- package/dist/theme/ct-veh.d.ts +57 -52
- package/dist/theme/ct-veh.d.ts.map +1 -1
- package/dist/theme/ct-veh.js +1 -1
- package/dist/theme/mudah.js +1 -1
- package/dist/typography/HeaderAnnotation.d.ts +19 -0
- package/dist/typography/HeaderAnnotation.d.ts.map +1 -0
- package/dist/typography/HeaderAnnotation.js +15 -0
- package/dist/typography/index.d.ts +2 -0
- package/dist/typography/index.d.ts.map +1 -1
- package/dist/typography/index.js +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/scrollLock/index.d.ts +7 -0
- package/dist/utils/scrollLock/index.d.ts.map +1 -0
- package/dist/utils/scrollLock/index.js +7 -0
- package/dist/utils/scrollLock/scrollLock.styles.d.ts +6 -0
- package/dist/utils/scrollLock/scrollLock.styles.d.ts.map +1 -0
- package/dist/utils/scrollLock/scrollLock.styles.js +9 -0
- package/dist/utils/scrollLock/useBodyScrollLock.d.ts +10 -0
- package/dist/utils/scrollLock/useBodyScrollLock.d.ts.map +1 -0
- package/dist/utils/scrollLock/useBodyScrollLock.js +41 -0
- package/dist/utils/sx.d.ts +8 -8
- package/dist/utils/types.d.ts +23 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/types.js +5 -0
- package/package.json +4 -3
- package/dist/storybook/GuideImage.d.ts +0 -9
- package/dist/storybook/GuideImage.d.ts.map +0 -1
- package/dist/storybook/GuideImage.js +0 -40
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import theme from '@clad-ui/theme';
|
|
2
|
-
import {
|
|
3
|
-
const { colors,
|
|
4
|
-
export const
|
|
2
|
+
import { css } from '@linaria/core';
|
|
3
|
+
const { colors, space, typo } = theme;
|
|
4
|
+
export const emptyStateClass = css `
|
|
5
5
|
display: flex;
|
|
6
6
|
justify-content: center;
|
|
7
7
|
align-items: center;
|
|
@@ -10,51 +10,34 @@ export const StyledEmptyState = styled.div `
|
|
|
10
10
|
outline: 1px solid var(--cladebug);
|
|
11
11
|
outline-offset: 1px;
|
|
12
12
|
position: relative;
|
|
13
|
-
`;
|
|
14
|
-
export const StyledEmptyHeaderText = styled.h3 `
|
|
15
|
-
font-size: ${fontSizes.h3};
|
|
16
|
-
line-height: ${lineHeights.md};
|
|
17
|
-
font-weight: ${fontWeights.bold};
|
|
18
|
-
color: ${colors.textPrimary};
|
|
19
|
-
`;
|
|
20
|
-
export const StyledEmptyBodyText = styled.p `
|
|
21
|
-
font-size: ${fontSizes.sm};
|
|
22
|
-
line-height: ${lineHeights.xs};
|
|
23
|
-
color: ${colors.textPrimary};
|
|
24
|
-
text-align: center;
|
|
25
|
-
white-space: break-spaces;
|
|
26
|
-
max-width: ${sizes.$md};
|
|
27
|
-
margin-bottom: ${space.md};
|
|
28
13
|
|
|
29
|
-
|
|
30
|
-
|
|
14
|
+
img {
|
|
15
|
+
object-fit: contain;
|
|
31
16
|
}
|
|
32
17
|
`;
|
|
33
|
-
export const
|
|
18
|
+
export const emptyStateContentClass = css `
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
gap: ${space.xs};
|
|
24
|
+
`;
|
|
25
|
+
export const emptyStateContentTextClass = css `
|
|
34
26
|
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
35
28
|
align-items: center;
|
|
36
29
|
justify-content: center;
|
|
37
|
-
|
|
38
|
-
width:
|
|
39
|
-
|
|
30
|
+
gap: ${space.xxs};
|
|
31
|
+
max-width: 700px;
|
|
32
|
+
text-align: center;
|
|
40
33
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
height: auto;
|
|
44
|
-
max-width: 375px;
|
|
45
|
-
max-height: 245px;
|
|
34
|
+
h3 {
|
|
35
|
+
${typo.display.annotation}
|
|
46
36
|
}
|
|
47
37
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
img {
|
|
53
|
-
max-width: 400px;
|
|
54
|
-
max-height: 260px;
|
|
55
|
-
}
|
|
38
|
+
p {
|
|
39
|
+
${typo.body.section}
|
|
40
|
+
color: ${colors.textSecondary};
|
|
41
|
+
white-space: pre-line;
|
|
56
42
|
}
|
|
57
43
|
`;
|
|
58
|
-
export const StyledButtonWrapper = styled.div `
|
|
59
|
-
min-width: 180px;
|
|
60
|
-
`;
|
|
@@ -9,7 +9,7 @@ export type InputGroupProps = {
|
|
|
9
9
|
*/
|
|
10
10
|
status?: 'default' | 'error';
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Prompt a helptext below input group (useful when implemented with form validation)
|
|
13
13
|
*/
|
|
14
14
|
helptext?: string;
|
|
15
15
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputGroup.styles.d.ts","sourceRoot":"","sources":["../../../patterns/InputGroup/InputGroup.styles.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,OAAO;;
|
|
1
|
+
{"version":3,"file":"InputGroup.styles.d.ts","sourceRoot":"","sources":["../../../patterns/InputGroup/InputGroup.styles.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,OAAO;;EA0EZ,CAAC;AAEF,QAAA,MAAM,SAAS;;EAQd,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -49,8 +49,9 @@ const Wrapper = styled.div `
|
|
|
49
49
|
border-bottom-left-radius: 0;
|
|
50
50
|
border-top-right-radius: 10px;
|
|
51
51
|
border-bottom-right-radius: 10px;
|
|
52
|
+
height: auto;
|
|
52
53
|
|
|
53
|
-
> :first-child {
|
|
54
|
+
> :first-child:not(svg) {
|
|
54
55
|
border: 0;
|
|
55
56
|
border-left: 1px solid ${colors.borderThin};
|
|
56
57
|
border-top-left-radius: 0;
|
|
@@ -59,7 +60,7 @@ const Wrapper = styled.div `
|
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
> :not(:first-child):not(:last-child) {
|
|
62
|
-
> :first-child {
|
|
63
|
+
> :first-child:not(svg) {
|
|
63
64
|
border: 0;
|
|
64
65
|
border-left: 1px solid ${colors.borderThin};
|
|
65
66
|
border-radius: 0;
|
|
@@ -82,7 +82,7 @@ export interface MultiSearchDropdownProps {
|
|
|
82
82
|
*/
|
|
83
83
|
required?: boolean;
|
|
84
84
|
/**
|
|
85
|
-
*
|
|
85
|
+
* Prompt a helptext below input group (useful when implemented with form validation)
|
|
86
86
|
*/
|
|
87
87
|
helptext?: string;
|
|
88
88
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSearchDropdown.d.ts","sourceRoot":"","sources":["../../../patterns/MultiSearchDropdown/MultiSearchDropdown.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAc,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AA6BnD,MAAM,MAAM,yBAAyB,GAAG;IACtC,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,KAAK,CAAC,EAAE,yBAAyB,EAAE,CAAC;IACpC;;OAEG;IACH,OAAO,CAAC,EAAE,yBAAyB,EAAE,CAAC;IACtC;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,yBAAyB,EAAE,CAAC,EAAE,KAAK,CAAC,cAAc,KAAK,IAAI,CAAC;IAC/E;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC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AM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IACnF;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACzD;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC1D;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACzD;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC7B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,QAAA,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CA8X3D,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -57,6 +57,10 @@ const MultiSearchDropdown = ({ id, label = '', value = [], options = [], onInput
|
|
|
57
57
|
setValues(value);
|
|
58
58
|
}
|
|
59
59
|
}, [value.length]);
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
setModifiedOptions(options);
|
|
62
|
+
setFilteredOptions(options);
|
|
63
|
+
}, [options]);
|
|
60
64
|
// the positioning stuff...
|
|
61
65
|
const { renderLayer, triggerProps: { ref: setTriggerRef }, // ref from useLayer is a function
|
|
62
66
|
layerProps, triggerBounds,
|
|
@@ -71,7 +71,7 @@ const searchInputStories = {
|
|
|
71
71
|
component: `Search Input component that carefully takes care of accessibility
|
|
72
72
|
and allow keyboard controls.
|
|
73
73
|
|
|
74
|
-
\`✅ Stable\` [\`🎨 Figma Specs\`](https://www.figma.com/
|
|
74
|
+
\`✅ Stable\` [\`🎨 Figma Specs\`](https://www.figma.com/design/DfQM6G9p8PSNEoOzNGRjWD/v3.0-CHOTOT-Design-System---Processing?node-id=865-13593&t=hz8QJLqNrGvTVY8R-4)
|
|
75
75
|
|
|
76
76
|
## How to use
|
|
77
77
|
|
|
@@ -73,6 +73,7 @@ export interface PopupProps {
|
|
|
73
73
|
* To apply `overflow-y: visible` for the `ChildrenWrapper` in some specific case that have to use some `custom Dropdown relatives` inside Popup
|
|
74
74
|
*/
|
|
75
75
|
childrenOverflowVisible?: boolean;
|
|
76
|
+
needBypassScrollLock?: boolean;
|
|
76
77
|
}
|
|
77
78
|
/**
|
|
78
79
|
* Popup is a window sitting overtop of the main content to provide information or inquire confirmation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popup.d.ts","sourceRoot":"","sources":["../../../patterns/Popup/Popup.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAe,EAAE,KAAK,WAAW,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"Popup.d.ts","sourceRoot":"","sources":["../../../patterns/Popup/Popup.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAe,EAAE,KAAK,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAuC1E,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,SAAS,CAA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import { cx, noop } from '../../utils';
|
|
3
|
+
import { cx, noop, useBodyScrollLock } from '../../utils';
|
|
4
4
|
import createUniversalPortal from '../../utils/createUniversalPortal';
|
|
5
5
|
import Button from '../../components/Button/Button';
|
|
6
|
-
import { Modal, StyledPopup, CloseButtonClass, ChildrenWrapper, StyledHeader, StyledWrapper, StyledButtonGroup, StyledImage, buttonClass, showChildrenOverflowClass,
|
|
6
|
+
import { Modal, StyledPopup, CloseButtonClass, ChildrenWrapper, StyledHeader, StyledWrapper, StyledButtonGroup, StyledImage, buttonClass, showChildrenOverflowClass, Backdrop, StyledTitle, } from './Popup.styles';
|
|
7
7
|
import Close from '../../icons/Close';
|
|
8
8
|
const BTN_GROUP_POSITION = {
|
|
9
9
|
left: {
|
|
@@ -36,20 +36,11 @@ const BTN_GROUP_DIRECTION = {
|
|
|
36
36
|
* `✅ Stable`
|
|
37
37
|
* }>}
|
|
38
38
|
*/
|
|
39
|
-
const Popup = ({ className = '', title = '', img, imgSize = 'lg', children, primaryBtnLabel = 'Xác nhận', secondaryBtnLabel, primaryColor = 'primary', secondaryColor = 'tertiary', haveClose = true, btnGroupDirection = 'row', btnRowPosition = 'justify', open = false, onClose, onPrimaryButtonClick = noop, onSecondaryButtonClick = null, childrenOverflowVisible = false, }) => {
|
|
40
|
-
const { useRef
|
|
39
|
+
const Popup = ({ className = '', title = '', img, imgSize = 'lg', children, primaryBtnLabel = 'Xác nhận', secondaryBtnLabel, primaryColor = 'primary', secondaryColor = 'tertiary', haveClose = true, btnGroupDirection = 'row', btnRowPosition = 'justify', open = false, onClose, onPrimaryButtonClick = noop, onSecondaryButtonClick = null, childrenOverflowVisible = false, needBypassScrollLock = false, }) => {
|
|
40
|
+
const { useRef } = React;
|
|
41
41
|
const modalRef = useRef(null);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
document.body.classList.add(preventBodyScrollClass);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
document.body.classList.remove(preventBodyScrollClass);
|
|
48
|
-
}
|
|
49
|
-
return () => {
|
|
50
|
-
document.body.classList.remove(preventBodyScrollClass);
|
|
51
|
-
};
|
|
52
|
-
}, [open]);
|
|
42
|
+
// Use the new scroll lock hook with reference counting
|
|
43
|
+
useBodyScrollLock(open && !needBypassScrollLock);
|
|
53
44
|
const childrenWrapperClasses = cx((typeof children === 'string' || typeof children === 'number') && 'is-single-string', typeof primaryBtnLabel === 'string' && !primaryBtnLabel.trim() && 'no-button', childrenOverflowVisible && showChildrenOverflowClass);
|
|
54
45
|
const btnGroupProps = {
|
|
55
46
|
position: BTN_GROUP_POSITION === null || BTN_GROUP_POSITION === void 0 ? void 0 : BTN_GROUP_POSITION[btnRowPosition],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popup.stories.d.ts","sourceRoot":"","sources":["../../../patterns/Popup/Popup.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Popup.stories.d.ts","sourceRoot":"","sources":["../../../patterns/Popup/Popup.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAQnD,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6CjB,CAAC;AAEF,eAAe,YAAY,CAAC;AAM5B,eAAO,MAAM,QAAQ;;CAgBpB,CAAC;AA+BF,eAAO,MAAM,YAAY;;;;;;;;;;CAgDxB,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;CA4E3B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;CAkD3B,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;;;;;CAoFrB,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;CA4E5B,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;CAqCtB,CAAC"}
|
|
@@ -2,15 +2,10 @@
|
|
|
2
2
|
import React, { useState, useEffect } from 'react';
|
|
3
3
|
import { styled } from '@linaria/react';
|
|
4
4
|
import { css } from '@linaria/core';
|
|
5
|
-
import { guideImageClass } from '../../storybook/GuideImage';
|
|
6
5
|
import Button from '../../components/Button/Button';
|
|
7
6
|
import Popup from './Popup';
|
|
8
|
-
import { preventBodyScrollClass } from './Popup.styles';
|
|
9
7
|
import Box from '../../components/Box/Box';
|
|
10
8
|
import { inlineCreatePortal, releaseCreatePortal } from '../../utils/_inlineCreatePortal';
|
|
11
|
-
const releaseCreatePortalWithBodyClass = () => {
|
|
12
|
-
releaseCreatePortal(preventBodyScrollClass);
|
|
13
|
-
};
|
|
14
9
|
const PopupStories = {
|
|
15
10
|
title: 'Patterns/Popup',
|
|
16
11
|
component: Popup,
|
|
@@ -19,16 +14,15 @@ const PopupStories = {
|
|
|
19
14
|
docs: {
|
|
20
15
|
description: {
|
|
21
16
|
component: ` Popup is a window sitting overtop of the main content to provide information or inquire confirmation.
|
|
22
|
-
|
|
17
|
+
Popup is very intrusive toward user and should be used sparingly.
|
|
23
18
|
|
|
24
|
-
\`🧪 Revamped in 1.2+ \` [\`🎨 Figma Specs\`](https://www.figma.com/
|
|
19
|
+
\`🧪 Revamped in 1.2+ \` [\`🎨 Figma Specs\`](https://www.figma.com/design/DfQM6G9p8PSNEoOzNGRjWD/v3.0-CHOTOT-Design-System---Processing?node-id=958-3770&t=hz8QJLqNrGvTVY8R-4) \`🌟 Dialog Successor \`
|
|
25
20
|
|
|
26
21
|
## How to use
|
|
27
22
|
* Show promotion, label explanation, information or What’s new.
|
|
28
23
|
* Request confirmation when user perform important or destructive actions.
|
|
29
24
|
* Congrat user after completing a userflow or achieve a milestone.
|
|
30
25
|
|
|
31
|
-
<img className="${guideImageClass}" src="./new-popup-how.png" />
|
|
32
26
|
`,
|
|
33
27
|
},
|
|
34
28
|
},
|
|
@@ -41,6 +35,11 @@ const PopupStories = {
|
|
|
41
35
|
},
|
|
42
36
|
open: {},
|
|
43
37
|
className: { control: null },
|
|
38
|
+
// Hide internal prop from Storybook controls and documentation
|
|
39
|
+
needBypassScrollLock: {
|
|
40
|
+
control: null,
|
|
41
|
+
table: { disable: true },
|
|
42
|
+
},
|
|
44
43
|
},
|
|
45
44
|
args: {
|
|
46
45
|
title: 'Popup title',
|
|
@@ -100,19 +99,19 @@ export const WithChildren = {
|
|
|
100
99
|
render: () => {
|
|
101
100
|
inlineCreatePortal();
|
|
102
101
|
useEffect(() => {
|
|
103
|
-
|
|
102
|
+
releaseCreatePortal();
|
|
104
103
|
}, []);
|
|
105
104
|
return (<>
|
|
106
105
|
<p>Dialog has string as children.</p>
|
|
107
106
|
<Box width="full" className={popupInlineClass}>
|
|
108
|
-
<Popup open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Popup title" primaryBtnLabel="Button">
|
|
107
|
+
<Popup open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Popup title" primaryBtnLabel="Button" needBypassScrollLock>
|
|
109
108
|
Popup's children in this case is a string.
|
|
110
109
|
</Popup>
|
|
111
110
|
</Box>
|
|
112
111
|
<p className={mt24}>Popup has React component as children.</p>
|
|
113
112
|
|
|
114
113
|
<Box width="full" className={popupInlineClass}>
|
|
115
|
-
<Popup open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Popup title" primaryBtnLabel="Button">
|
|
114
|
+
<Popup open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Popup title" primaryBtnLabel="Button" needBypassScrollLock>
|
|
116
115
|
<Placeholder>Popup's children in this case is a React component.</Placeholder>
|
|
117
116
|
</Popup>
|
|
118
117
|
</Box>
|
|
@@ -131,30 +130,30 @@ export const ButtonGroupDemo = {
|
|
|
131
130
|
render: () => {
|
|
132
131
|
inlineCreatePortal();
|
|
133
132
|
useEffect(() => {
|
|
134
|
-
|
|
133
|
+
releaseCreatePortal();
|
|
135
134
|
}, []);
|
|
136
135
|
return (<>
|
|
137
136
|
<p>Default</p>
|
|
138
137
|
<Box width="full" className={popupInlineClass}>
|
|
139
|
-
<Popup title="No Button ? No Problem" primaryBtnLabel="" open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick}>
|
|
138
|
+
<Popup title="No Button ? No Problem" primaryBtnLabel="" open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} needBypassScrollLock>
|
|
140
139
|
<div>This is Popup without Button Group</div>
|
|
141
140
|
</Popup>
|
|
142
141
|
</Box>
|
|
143
142
|
<p className={mt24}>With only CTA Button</p>
|
|
144
143
|
<Box width="full" className={popupInlineClass}>
|
|
145
|
-
<Popup title="Primary Only" primaryBtnLabel="Only Me" open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick}>
|
|
144
|
+
<Popup title="Primary Only" primaryBtnLabel="Only Me" open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} needBypassScrollLock>
|
|
146
145
|
<div>This is Popup one Primary Button</div>
|
|
147
146
|
</Popup>
|
|
148
147
|
</Box>
|
|
149
148
|
<p className={mt24}>With Primary & Secondary Buttons</p>
|
|
150
149
|
<Box width="full" className={popupInlineClass}>
|
|
151
|
-
<Popup title="Two button" primaryBtnLabel="Primary" secondaryBtnLabel="Secondary" open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick}>
|
|
150
|
+
<Popup title="Two button" primaryBtnLabel="Primary" secondaryBtnLabel="Secondary" open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} needBypassScrollLock>
|
|
152
151
|
<div>This is Popup with Primary & Secondary Buttons</div>
|
|
153
152
|
</Popup>
|
|
154
153
|
</Box>
|
|
155
154
|
<p className={mt24}>With Button Group on Right </p>
|
|
156
155
|
<Box width="full" className={popupInlineClass}>
|
|
157
|
-
<Popup title="Right Side Button Group" primaryBtnLabel="Primary" secondaryBtnLabel="Secondary" btnRowPosition="right" open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick}>
|
|
156
|
+
<Popup title="Right Side Button Group" primaryBtnLabel="Primary" secondaryBtnLabel="Secondary" btnRowPosition="right" open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} needBypassScrollLock>
|
|
158
157
|
<div>This is Popup with Primary & Secondary Buttons on right side`</div>
|
|
159
158
|
</Popup>
|
|
160
159
|
</Box>
|
|
@@ -173,18 +172,18 @@ export const ButtonDirection = {
|
|
|
173
172
|
render: () => {
|
|
174
173
|
inlineCreatePortal();
|
|
175
174
|
useEffect(() => {
|
|
176
|
-
|
|
175
|
+
releaseCreatePortal();
|
|
177
176
|
}, []);
|
|
178
177
|
return (<>
|
|
179
178
|
<p>Row Direction</p>
|
|
180
179
|
<Box width="full" className={popupInlineClass}>
|
|
181
|
-
<Popup title="Row Direction" primaryBtnLabel="Primary" secondaryBtnLabel="Secondary" btnGroupDirection="row" open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick}>
|
|
180
|
+
<Popup title="Row Direction" primaryBtnLabel="Primary" secondaryBtnLabel="Secondary" btnGroupDirection="row" open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} needBypassScrollLock>
|
|
182
181
|
<div>Row Direction</div>
|
|
183
182
|
</Popup>
|
|
184
183
|
</Box>
|
|
185
184
|
<p className={mt24}>Column Direction</p>
|
|
186
185
|
<Box width="full" className={popupInlineClass}>
|
|
187
|
-
<Popup title="Column Direction" primaryBtnLabel="Primary" secondaryBtnLabel="Secondary" btnGroupDirection="column" open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick}>
|
|
186
|
+
<Popup title="Column Direction" primaryBtnLabel="Primary" secondaryBtnLabel="Secondary" btnGroupDirection="column" open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} needBypassScrollLock>
|
|
188
187
|
<div>Column Direction</div>
|
|
189
188
|
</Popup>
|
|
190
189
|
</Box>
|
|
@@ -203,30 +202,30 @@ export const ImageDemo = {
|
|
|
203
202
|
render: () => {
|
|
204
203
|
inlineCreatePortal();
|
|
205
204
|
useEffect(() => {
|
|
206
|
-
|
|
205
|
+
releaseCreatePortal();
|
|
207
206
|
}, []);
|
|
208
207
|
return (<>
|
|
209
208
|
<p>Small Size Image</p>
|
|
210
209
|
<Box width="full" className={popupInlineClass}>
|
|
211
|
-
<Popup title="Small Size Image" primaryBtnLabel="Primary" secondaryBtnLabel="Secondary" img="https://cdn.chotot.com/admincentre/960_579.jpg" imgSize="sm" open onClose={() => alert('Close')} onPrimaryButtonClick={onMainBtnClick}>
|
|
210
|
+
<Popup title="Small Size Image" primaryBtnLabel="Primary" secondaryBtnLabel="Secondary" img="https://cdn.chotot.com/admincentre/960_579.jpg" imgSize="sm" open onClose={() => alert('Close')} onPrimaryButtonClick={onMainBtnClick} needBypassScrollLock>
|
|
212
211
|
<div>Small Size Image</div>
|
|
213
212
|
</Popup>
|
|
214
213
|
</Box>
|
|
215
214
|
<p className={mt24}>Medium Size Image</p>
|
|
216
215
|
<Box width="full" className={popupInlineClass}>
|
|
217
|
-
<Popup title="Medium Size Image" primaryBtnLabel="Primary" secondaryBtnLabel="Secondary" img="https://cdn.chotot.com/admincentre/960_579.jpg" imgSize="md" open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick}>
|
|
216
|
+
<Popup title="Medium Size Image" primaryBtnLabel="Primary" secondaryBtnLabel="Secondary" img="https://cdn.chotot.com/admincentre/960_579.jpg" imgSize="md" open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} needBypassScrollLock>
|
|
218
217
|
<div>Medium Size Image</div>
|
|
219
218
|
</Popup>
|
|
220
219
|
</Box>
|
|
221
220
|
<p className={mt24}>Large Size Image</p>
|
|
222
221
|
<Box width="full" className={popupInlineClass}>
|
|
223
|
-
<Popup title="Large Size Image" primaryBtnLabel="Primary" secondaryBtnLabel="Secondary" img="https://cdn.chotot.com/admincentre/960_579.jpg" imgSize="lg" open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick}>
|
|
222
|
+
<Popup title="Large Size Image" primaryBtnLabel="Primary" secondaryBtnLabel="Secondary" img="https://cdn.chotot.com/admincentre/960_579.jpg" imgSize="lg" open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} needBypassScrollLock>
|
|
224
223
|
<div>Large Size Image</div>
|
|
225
224
|
</Popup>
|
|
226
225
|
</Box>
|
|
227
226
|
<p className={mt24}>No Image (Default)</p>
|
|
228
227
|
<Box width="full" className={popupInlineClass}>
|
|
229
|
-
<Popup title="No Image" primaryBtnLabel="Primary" secondaryBtnLabel="Secondary" open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick}>
|
|
228
|
+
<Popup title="No Image" primaryBtnLabel="Primary" secondaryBtnLabel="Secondary" open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} needBypassScrollLock>
|
|
230
229
|
<div>No Image</div>
|
|
231
230
|
</Popup>
|
|
232
231
|
</Box>
|
|
@@ -245,12 +244,12 @@ export const SpecialUsageDemo = {
|
|
|
245
244
|
render: () => {
|
|
246
245
|
inlineCreatePortal();
|
|
247
246
|
useEffect(() => {
|
|
248
|
-
|
|
247
|
+
releaseCreatePortal();
|
|
249
248
|
}, []);
|
|
250
249
|
return (<>
|
|
251
250
|
<p>Payment Green</p>
|
|
252
251
|
<Box width="full" className={popupInlineClass}>
|
|
253
|
-
<Popup title="Thanh toán thành công" primaryBtnLabel="Xác nhận" primaryColor="positive" haveClose={false} open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick}>
|
|
252
|
+
<Popup title="Thanh toán thành công" primaryBtnLabel="Xác nhận" primaryColor="positive" haveClose={false} open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} needBypassScrollLock>
|
|
254
253
|
<div>
|
|
255
254
|
Chợ Tốt đã nhận được thanh toán <b>450.000 đ</b> của bạn. Người bán sẽ tiến hành xác
|
|
256
255
|
nhận đơn.
|
|
@@ -259,7 +258,7 @@ export const SpecialUsageDemo = {
|
|
|
259
258
|
</Box>
|
|
260
259
|
<p className={mt24}>Red Alert</p>
|
|
261
260
|
<Box width="full" className={popupInlineClass}>
|
|
262
|
-
<Popup title="Xóa tài khoản Chợ Tốt" primaryBtnLabel="Xoá tài khoản" secondaryBtnLabel="Trở về" primaryColor="critical" btnGroupDirection="column" haveClose={false} open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick}>
|
|
261
|
+
<Popup title="Xóa tài khoản Chợ Tốt" primaryBtnLabel="Xoá tài khoản" secondaryBtnLabel="Trở về" primaryColor="critical" btnGroupDirection="column" haveClose={false} open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} needBypassScrollLock>
|
|
263
262
|
<div>
|
|
264
263
|
Tài khoản sẽ bị xóa vĩnh viễn và không thể hoàn tác. Bạn có chắc muốn xóa tài khoản
|
|
265
264
|
không?
|
|
@@ -268,7 +267,7 @@ export const SpecialUsageDemo = {
|
|
|
268
267
|
</Box>
|
|
269
268
|
<p className={mt24}>Marketing Banner with Image</p>
|
|
270
269
|
<Box width="full" className={popupInlineClass}>
|
|
271
|
-
<Popup title="Sắm chuẩn xế mới Rước tài vận mới" primaryBtnLabel="Đã hiểu" secondaryBtnLabel="Trở về" img="https://cdn.chotot.com/admincentre/960_579.jpg" imgSize="lg" open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick}>
|
|
270
|
+
<Popup title="Sắm chuẩn xế mới Rước tài vận mới" primaryBtnLabel="Đã hiểu" secondaryBtnLabel="Trở về" img="https://cdn.chotot.com/admincentre/960_579.jpg" imgSize="lg" open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} needBypassScrollLock>
|
|
272
271
|
Đối Tác cam kết chất lượng và pháp lý xe (không tai nạn, cho thợ máy kiểm xe, xe sang
|
|
273
272
|
tên)
|
|
274
273
|
</Popup>
|
|
@@ -288,7 +287,7 @@ export const BoxExample = {
|
|
|
288
287
|
render: () => {
|
|
289
288
|
inlineCreatePortal();
|
|
290
289
|
useEffect(() => {
|
|
291
|
-
|
|
290
|
+
releaseCreatePortal();
|
|
292
291
|
}, []);
|
|
293
292
|
const html = `
|
|
294
293
|
<p>
|
|
@@ -303,7 +302,7 @@ export const BoxExample = {
|
|
|
303
302
|
return (<>
|
|
304
303
|
<p>HTML content</p>
|
|
305
304
|
<Box width="full" className={popupInlineClass}>
|
|
306
|
-
<Popup open title="Lưu ý" primaryBtnLabel="Đồng ý">
|
|
305
|
+
<Popup open title="Lưu ý" primaryBtnLabel="Đồng ý" needBypassScrollLock>
|
|
307
306
|
<Box dangerousHtml={html}/>
|
|
308
307
|
</Popup>
|
|
309
308
|
</Box>
|
|
@@ -33,10 +33,9 @@ declare const ChildrenWrapper: import("@linaria/react").StyledMeta & import("rea
|
|
|
33
33
|
declare const StyledImage: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLImageElement> & import("react").ImgHTMLAttributes<HTMLImageElement> & Record<never, unknown> & {
|
|
34
34
|
as?: import("react").ElementType;
|
|
35
35
|
}>;
|
|
36
|
-
declare const preventBodyScrollClass: import("@linaria/core").LinariaClassName;
|
|
37
36
|
declare const showChildrenOverflowClass: import("@linaria/core").LinariaClassName;
|
|
38
37
|
declare const Backdrop: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
|
|
39
38
|
as?: import("react").ElementType;
|
|
40
39
|
}>;
|
|
41
|
-
export { Modal, StyledPopup, CloseButtonClass, StyledHeader, StyledWrapper, ChildrenWrapper, StyledButtonGroup, StyledImage, Backdrop, buttonClass, showChildrenOverflowClass,
|
|
40
|
+
export { Modal, StyledPopup, CloseButtonClass, StyledHeader, StyledWrapper, ChildrenWrapper, StyledButtonGroup, StyledImage, Backdrop, buttonClass, showChildrenOverflowClass, StyledTitle, };
|
|
42
41
|
//# sourceMappingURL=Popup.styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popup.styles.d.ts","sourceRoot":"","sources":["../../../patterns/Popup/Popup.styles.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,KAAK;;EAUV,CAAC;AAEF,QAAA,MAAM,WAAW;;EAqChB,CAAC;AAEF,QAAA,MAAM,WAAW;;EAOhB,CAAC;AAEF,QAAA,MAAM,YAAY;;EA4DjB,CAAC;AAEF,QAAA,MAAM,aAAa;eAA2B,OAAO;;;EAGpD,CAAC;AAEF,QAAA,MAAM,iBAAiB;cACX;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE;uBACjB;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE;;;EAS7C,CAAC;AAEF,QAAA,MAAM,WAAW,0CAGhB,CAAC;AAEF,QAAA,MAAM,gBAAgB,0CA6BrB,CAAC;AAEF,QAAA,MAAM,eAAe;;EAwCpB,CAAC;AAEF,QAAA,MAAM,WAAW;;EAIhB,CAAC;AAGF,QAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"Popup.styles.d.ts","sourceRoot":"","sources":["../../../patterns/Popup/Popup.styles.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,KAAK;;EAUV,CAAC;AAEF,QAAA,MAAM,WAAW;;EAqChB,CAAC;AAEF,QAAA,MAAM,WAAW;;EAOhB,CAAC;AAEF,QAAA,MAAM,YAAY;;EA4DjB,CAAC;AAEF,QAAA,MAAM,aAAa;eAA2B,OAAO;;;EAGpD,CAAC;AAEF,QAAA,MAAM,iBAAiB;cACX;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE;uBACjB;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE;;;EAS7C,CAAC;AAEF,QAAA,MAAM,WAAW,0CAGhB,CAAC;AAEF,QAAA,MAAM,gBAAgB,0CA6BrB,CAAC;AAEF,QAAA,MAAM,eAAe;;EAwCpB,CAAC;AAEF,QAAA,MAAM,WAAW;;EAIhB,CAAC;AAGF,QAAA,MAAM,yBAAyB,0CAE9B,CAAC;AACF,QAAA,MAAM,QAAQ;;EAQb,CAAC;AAEF,OAAO,EACL,KAAK,EACL,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,QAAQ,EACR,WAAW,EACX,yBAAyB,EACzB,WAAW,GACZ,CAAC"}
|
|
@@ -213,11 +213,6 @@ const StyledImage = styled.img `
|
|
|
213
213
|
height: 100%;
|
|
214
214
|
object-fit: cover;
|
|
215
215
|
`;
|
|
216
|
-
// We need to use !important to override the body scroll
|
|
217
|
-
const preventBodyScrollClass = css `
|
|
218
|
-
/* stylelint-disable declaration-no-important */
|
|
219
|
-
overflow: hidden !important;
|
|
220
|
-
`;
|
|
221
216
|
// To visible children inside children wrapper in overflow-y case
|
|
222
217
|
const showChildrenOverflowClass = css `
|
|
223
218
|
overflow-y: visible;
|
|
@@ -231,4 +226,4 @@ const Backdrop = styled.div `
|
|
|
231
226
|
height: ${sizes.full};
|
|
232
227
|
opacity: 0.3;
|
|
233
228
|
`;
|
|
234
|
-
export { Modal, StyledPopup, CloseButtonClass, StyledHeader, StyledWrapper, ChildrenWrapper, StyledButtonGroup, StyledImage, Backdrop, buttonClass, showChildrenOverflowClass,
|
|
229
|
+
export { Modal, StyledPopup, CloseButtonClass, StyledHeader, StyledWrapper, ChildrenWrapper, StyledButtonGroup, StyledImage, Backdrop, buttonClass, showChildrenOverflowClass, StyledTitle, };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type RangeInputProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Input group content
|
|
5
|
+
*/
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Input group status (useful when implemented with form validation)
|
|
9
|
+
*/
|
|
10
|
+
status?: 'default' | 'error';
|
|
11
|
+
/**
|
|
12
|
+
* Prompt a helptext below input group (useful when implemented with form validation)
|
|
13
|
+
*/
|
|
14
|
+
helptext?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Custom helptext
|
|
17
|
+
*/
|
|
18
|
+
helptextClassName?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Custom class name
|
|
21
|
+
*/
|
|
22
|
+
className?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Custom separator component
|
|
25
|
+
*/
|
|
26
|
+
separatorComponent?: React.ReactNode;
|
|
27
|
+
};
|
|
28
|
+
declare const RangeInput: React.FC<RangeInputProps>;
|
|
29
|
+
export default RangeInput;
|
|
30
|
+
//# sourceMappingURL=RangeInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RangeInput.d.ts","sourceRoot":"","sources":["../../../patterns/RangeInput/RangeInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACtC,CAAC;AAEF,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAkCzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { cx } from '../../utils';
|
|
3
|
+
import { Paragraph } from '../../components/Input/Input.styles';
|
|
4
|
+
import { containerClass, helptextClass, inputWrapperClass, separatorClass, } from './RangeInput.styles';
|
|
5
|
+
const RangeInput = ({ children, helptext = '', helptextClassName = '', className = '', status = 'default', separatorComponent, }) => {
|
|
6
|
+
const isWithError = status === 'error';
|
|
7
|
+
const containerCss = cx(containerClass, className);
|
|
8
|
+
const helptextCss = cx(helptextClass, helptextClassName, isWithError && 'error');
|
|
9
|
+
return (<div className={containerCss} data-clad="Range Input">
|
|
10
|
+
<div className={inputWrapperClass}>
|
|
11
|
+
{React.Children.map(children, (child, index) => {
|
|
12
|
+
var _a;
|
|
13
|
+
const key = (_a = child === null || child === void 0 ? void 0 : child.key) !== null && _a !== void 0 ? _a : index;
|
|
14
|
+
let renderSeparator = null;
|
|
15
|
+
if (index > 0) {
|
|
16
|
+
renderSeparator = separatorComponent || <p className={separatorClass}>-</p>;
|
|
17
|
+
}
|
|
18
|
+
return (<span key={key} className="separator-wrapper">
|
|
19
|
+
{renderSeparator}
|
|
20
|
+
{child}
|
|
21
|
+
</span>);
|
|
22
|
+
})}
|
|
23
|
+
</div>
|
|
24
|
+
{helptext ? <Paragraph className={helptextCss}>{helptext}</Paragraph> : null}
|
|
25
|
+
</div>);
|
|
26
|
+
};
|
|
27
|
+
export default RangeInput;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: React.FC<import("./RangeInput").RangeInputProps>;
|
|
5
|
+
tags: string[];
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
argTypes: {
|
|
14
|
+
status: {
|
|
15
|
+
control: string;
|
|
16
|
+
options: string[];
|
|
17
|
+
description: string;
|
|
18
|
+
defaultValue: string;
|
|
19
|
+
};
|
|
20
|
+
helptext: {
|
|
21
|
+
control: string;
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
helptextClassName: {
|
|
25
|
+
control: string;
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
className: {
|
|
29
|
+
control: string;
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
separatorComponent: {
|
|
33
|
+
control: boolean;
|
|
34
|
+
description: string;
|
|
35
|
+
};
|
|
36
|
+
children: {
|
|
37
|
+
control: boolean;
|
|
38
|
+
description: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
args: {
|
|
42
|
+
status: string;
|
|
43
|
+
helptext: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export default meta;
|
|
47
|
+
export declare const Overview: {
|
|
48
|
+
render: (args: any) => JSX.Element;
|
|
49
|
+
};
|
|
50
|
+
export declare const PriceRange: {
|
|
51
|
+
render: () => JSX.Element;
|
|
52
|
+
};
|
|
53
|
+
export declare const WithLongError: {
|
|
54
|
+
render: () => JSX.Element;
|
|
55
|
+
};
|
|
56
|
+
export declare const CustomSeparator: {
|
|
57
|
+
render: () => JSX.Element;
|
|
58
|
+
};
|
|
59
|
+
export declare const WithoutLabels: {
|
|
60
|
+
render: () => JSX.Element;
|
|
61
|
+
};
|
|
62
|
+
export declare const MultipleRanges: {
|
|
63
|
+
render: () => JSX.Element;
|
|
64
|
+
};
|
|
65
|
+
export declare const Disabled: {
|
|
66
|
+
render: () => JSX.Element;
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=RangeInput.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RangeInput.stories.d.ts","sourceRoot":"","sources":["../../../patterns/RangeInput/RangeInput.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8CT,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,QAAQ;mBACJ,GAAG;CAqBnB,CAAC;AAEF,eAAO,MAAM,UAAU;;CAwBtB,CAAC;AAEF,eAAO,MAAM,aAAa;;CAyBzB,CAAC;AAEF,eAAO,MAAM,eAAe;;CAe3B,CAAC;AAEF,eAAO,MAAM,aAAa;;CAoBzB,CAAC;AAEF,eAAO,MAAM,cAAc;;CA4B1B,CAAC;AAEF,eAAO,MAAM,QAAQ;;CAOpB,CAAC"}
|