@chotot/clad-ui 2.0.0-next.4 → 2.0.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 +5 -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.stories.d.ts.map +1 -1
- package/dist/components/Badge/Badge.stories.js +1 -2
- 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 +10 -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 +28 -83
- package/dist/components/Button/Button.d.ts +7 -16
- 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 +2 -2
- package/dist/components/Button/Button.stories.d.ts.map +1 -1
- package/dist/components/Button/Button.stories.js +19 -1
- package/dist/components/Button/Button.styles.d.ts.map +1 -1
- package/dist/components/Button/Button.styles.js +14 -11
- package/dist/components/Button/GhostButton.d.ts +5 -25
- 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 +2 -2
- package/dist/components/Button/GhostButton.stories.d.ts.map +1 -1
- package/dist/components/Button/GhostButton.stories.js +19 -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 +2 -2
- package/dist/components/Button/IconButton.stories.d.ts.map +1 -1
- package/dist/components/Button/IconButton.stories.js +18 -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/Input/Input.d.ts.map +1 -1
- package/dist/components/Input/Input.js +2 -13
- 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.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 +5 -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/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 +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -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.stories.js +1 -1
- 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/SearchInput/SearchInput.stories.d.ts.map +1 -1
- package/dist/patterns/SearchInput/SearchInput.stories.js +1 -3
- package/dist/patterns/TagCloud/TagCloud.stories.d.ts.map +1 -1
- package/dist/patterns/TagCloud/TagCloud.stories.js +1 -5
- package/dist/theme/chotot.d.ts +49 -48
- package/dist/theme/chotot.d.ts.map +1 -1
- package/dist/theme/chotot.js +8 -7
- package/dist/theme/ct-job.d.ts +48 -47
- package/dist/theme/ct-job.d.ts.map +1 -1
- package/dist/theme/ct-pty.d.ts +48 -47
- package/dist/theme/ct-pty.d.ts.map +1 -1
- package/dist/theme/ct-veh.d.ts +49 -48
- package/dist/theme/ct-veh.d.ts.map +1 -1
- package/dist/theme/ct-veh.js +1 -1
- 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
|
@@ -2,16 +2,11 @@
|
|
|
2
2
|
import React, { useState, useLayoutEffect } 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 Drawer from './Drawer';
|
|
8
|
-
import { preventBodyScrollClass } from './Drawer.styles';
|
|
9
7
|
import Box from '../../components/Box/Box';
|
|
10
8
|
import MoreVertical from '../../icons/MoreVertical';
|
|
11
9
|
import { inlineCreatePortal, releaseCreatePortal } from '../../utils/_inlineCreatePortal';
|
|
12
|
-
const releaseCreatePortalWithBodyClass = () => {
|
|
13
|
-
releaseCreatePortal(preventBodyScrollClass);
|
|
14
|
-
};
|
|
15
10
|
const DrawerStories = {
|
|
16
11
|
title: 'Patterns/Drawer',
|
|
17
12
|
component: Drawer,
|
|
@@ -21,14 +16,13 @@ const DrawerStories = {
|
|
|
21
16
|
description: {
|
|
22
17
|
component: ` Drawer are sheets to provide information or to collect information inputs. In most cases, Drawers are anchored to the bottom of the screen in Mobile & App view, and centered in desktop view.
|
|
23
18
|
|
|
24
|
-
\`✅ Stable\` [\`🎨 Figma Specs\`](https://www.figma.com/
|
|
19
|
+
\`✅ Stable\` [\`🎨 Figma Specs\`](https://www.figma.com/design/DfQM6G9p8PSNEoOzNGRjWD/v3.0-CHOTOT-Design-System---Processing?node-id=44-8801&t=hz8QJLqNrGvTVY8R-4) \`🌟 Legacy Popup 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
|
* Congrats user after completing a userflow or achieve a milestone.
|
|
30
25
|
|
|
31
|
-
<img className="${guideImageClass}" src="./drawer-how.png" />
|
|
32
26
|
`,
|
|
33
27
|
},
|
|
34
28
|
},
|
|
@@ -41,6 +35,11 @@ const DrawerStories = {
|
|
|
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: 'Drawer title',
|
|
@@ -127,19 +126,19 @@ export const WithChildren = {
|
|
|
127
126
|
render: () => {
|
|
128
127
|
inlineCreatePortal();
|
|
129
128
|
useLayoutEffect(() => {
|
|
130
|
-
|
|
129
|
+
releaseCreatePortal();
|
|
131
130
|
}, []);
|
|
132
131
|
return (<>
|
|
133
132
|
<p>Dialog has string as children.</p>
|
|
134
133
|
<Box width="full" className={popupInlineClass}>
|
|
135
|
-
<Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Drawer title" primaryBtnLabel="Button">
|
|
134
|
+
<Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Drawer title" primaryBtnLabel="Button" needBypassScrollLock>
|
|
136
135
|
Drawer's children in this case is a string. By default children have no padding,
|
|
137
136
|
margin for UI customization
|
|
138
137
|
</Drawer>
|
|
139
138
|
</Box>
|
|
140
139
|
<p className={mt24}>Drawer has React component as children.</p>
|
|
141
140
|
<Box width="full" className={popupInlineClass}>
|
|
142
|
-
<Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Drawer title" primaryBtnLabel="Button">
|
|
141
|
+
<Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Drawer title" primaryBtnLabel="Button" needBypassScrollLock>
|
|
143
142
|
<Placeholder>Drawer's children in this case is a React component.</Placeholder>
|
|
144
143
|
</Drawer>
|
|
145
144
|
</Box>
|
|
@@ -161,7 +160,7 @@ export const CustomizeWithImage = {
|
|
|
161
160
|
return (<>
|
|
162
161
|
<p>Limit Children Height</p>
|
|
163
162
|
<Box width="full" height="vH" className={`${popupInlineClass} ${ip100vhClass}`}>
|
|
164
|
-
<Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} primaryBtnLabel="One Primary">
|
|
163
|
+
<Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} primaryBtnLabel="One Primary" needBypassScrollLock>
|
|
165
164
|
<ChildrenLimitHeigthWrapper>
|
|
166
165
|
<img src="https://cdn.chotot.com/admincentre/960_579.jpg" alt="img"/>
|
|
167
166
|
<ChildrenTextWrapper>
|
|
@@ -219,7 +218,7 @@ export const CustomizeWithImage = {
|
|
|
219
218
|
</Box>
|
|
220
219
|
<p className={mt24}>No Limit Children Height</p>
|
|
221
220
|
<Box width="full" height="vH" className={`${popupInlineClass} ${ip100vhClass}`}>
|
|
222
|
-
<Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} primaryBtnLabel="One Primary">
|
|
221
|
+
<Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} primaryBtnLabel="One Primary" needBypassScrollLock>
|
|
223
222
|
<ChildrenWrapper>
|
|
224
223
|
<img src="https://cdn.chotot.com/admincentre/960_579.jpg" alt="img"/>
|
|
225
224
|
<ChildrenTextWrapper>
|
|
@@ -290,12 +289,12 @@ export const CustomizeHeader = {
|
|
|
290
289
|
render: () => {
|
|
291
290
|
inlineCreatePortal();
|
|
292
291
|
useLayoutEffect(() => {
|
|
293
|
-
|
|
292
|
+
releaseCreatePortal();
|
|
294
293
|
}, []);
|
|
295
294
|
return (<>
|
|
296
295
|
<p>Optional Button Label Text</p>
|
|
297
296
|
<Box width="full" className={popupInlineClass}>
|
|
298
|
-
<Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="With Optional Button Text" primaryBtnLabel="Primary" secondaryBtnLabel="Click to Dismiss" optionalBtnLabel="Button Link">
|
|
297
|
+
<Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="With Optional Button Text" primaryBtnLabel="Primary" secondaryBtnLabel="Click to Dismiss" optionalBtnLabel="Button Link" needBypassScrollLock>
|
|
299
298
|
<ChildrenWrapper>
|
|
300
299
|
<ChildrenTextWrapper>
|
|
301
300
|
<h5>Section 1</h5>
|
|
@@ -313,7 +312,7 @@ export const CustomizeHeader = {
|
|
|
313
312
|
</Box>
|
|
314
313
|
<p className={mt24}>Optional Button Label Icon</p>
|
|
315
314
|
<Box width="full" className={popupInlineClass}>
|
|
316
|
-
<Drawer open onClose={() => alert('Close clicked')} title="With Optional Button Icon" onPrimaryButtonClick={onMainBtnClick} primaryBtnLabel="Primary" optionalBtnLabel={<MoreVertical />}>
|
|
315
|
+
<Drawer open onClose={() => alert('Close clicked')} title="With Optional Button Icon" onPrimaryButtonClick={onMainBtnClick} primaryBtnLabel="Primary" optionalBtnLabel={<MoreVertical />} needBypassScrollLock>
|
|
317
316
|
<ChildrenWrapper>
|
|
318
317
|
<ChildrenTextWrapper>
|
|
319
318
|
<h5>Section 1</h5>
|
|
@@ -331,7 +330,7 @@ export const CustomizeHeader = {
|
|
|
331
330
|
</Box>
|
|
332
331
|
<p className={mt24}>No Close button example</p>
|
|
333
332
|
<Box width="full" className={popupInlineClass}>
|
|
334
|
-
<Drawer open haveClose={false} onClose={() => alert('Close clicked')} title="With Optional Button Icon" onPrimaryButtonClick={onMainBtnClick} primaryBtnLabel="Primary">
|
|
333
|
+
<Drawer open haveClose={false} onClose={() => alert('Close clicked')} title="With Optional Button Icon" onPrimaryButtonClick={onMainBtnClick} primaryBtnLabel="Primary" needBypassScrollLock>
|
|
335
334
|
<ChildrenWrapper>
|
|
336
335
|
<ChildrenTextWrapper>
|
|
337
336
|
<h5>Section 1</h5>
|
|
@@ -362,12 +361,12 @@ export const ButtonsPosition = {
|
|
|
362
361
|
render: () => {
|
|
363
362
|
inlineCreatePortal();
|
|
364
363
|
useLayoutEffect(() => {
|
|
365
|
-
|
|
364
|
+
releaseCreatePortal();
|
|
366
365
|
}, []);
|
|
367
366
|
return (<>
|
|
368
367
|
<p>Buttons on the Left</p>
|
|
369
368
|
<Box width="full" className={popupInlineClass}>
|
|
370
|
-
<Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Buttons on the Left" primaryBtnLabel="Primary" secondaryBtnLabel="Click to Dismiss" btnRowPosition="left">
|
|
369
|
+
<Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Buttons on the Left" primaryBtnLabel="Primary" secondaryBtnLabel="Click to Dismiss" btnRowPosition="left" needBypassScrollLock>
|
|
371
370
|
<ChildrenWrapper>
|
|
372
371
|
<ChildrenTextWrapper>
|
|
373
372
|
<h5>Section 1</h5>
|
|
@@ -385,7 +384,7 @@ export const ButtonsPosition = {
|
|
|
385
384
|
</Box>
|
|
386
385
|
<p className={mt24}>Buttons Jutify</p>
|
|
387
386
|
<Box width="full" className={popupInlineClass}>
|
|
388
|
-
<Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Buttons Jutify" primaryBtnLabel="Primary" secondaryBtnLabel="Click to Dismiss" btnRowPosition="justify">
|
|
387
|
+
<Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Buttons Jutify" primaryBtnLabel="Primary" secondaryBtnLabel="Click to Dismiss" btnRowPosition="justify" needBypassScrollLock>
|
|
389
388
|
<ChildrenWrapper>
|
|
390
389
|
<ChildrenTextWrapper>
|
|
391
390
|
<h5>Section 1</h5>
|
|
@@ -403,7 +402,7 @@ export const ButtonsPosition = {
|
|
|
403
402
|
</Box>
|
|
404
403
|
<p className={mt24}>Button on the Right</p>
|
|
405
404
|
<Box width="full" className={popupInlineClass}>
|
|
406
|
-
<Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Buttons on the Right" primaryBtnLabel="Primary" secondaryBtnLabel="Secondary" btnRowPosition="right">
|
|
405
|
+
<Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Buttons on the Right" primaryBtnLabel="Primary" secondaryBtnLabel="Secondary" btnRowPosition="right" needBypassScrollLock>
|
|
407
406
|
<ChildrenWrapper>
|
|
408
407
|
<ChildrenTextWrapper>
|
|
409
408
|
<h5>Section 1</h5>
|
|
@@ -443,14 +442,14 @@ export const EmptyDrawer = {
|
|
|
443
442
|
console.log('raf timeout release');
|
|
444
443
|
// this is magic to release the inline portal
|
|
445
444
|
// properly and avoid scroll lock
|
|
446
|
-
|
|
445
|
+
releaseCreatePortal();
|
|
447
446
|
});
|
|
448
447
|
});
|
|
449
448
|
}, []);
|
|
450
449
|
return (<>
|
|
451
450
|
<p>Empty Drawer No Styling</p>
|
|
452
451
|
<Box width="full" className={popupInlineClass}>
|
|
453
|
-
<Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} isEmptyDrawer>
|
|
452
|
+
<Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} isEmptyDrawer needBypassScrollLock>
|
|
454
453
|
Amet minim mollit non deserunt ullamco est sit aliqua dolor do amet sint Amet minim
|
|
455
454
|
mollit non deserunt ullamco est sit aliqua dolor do amet sint Amet minim mollit non
|
|
456
455
|
deserunt ullamco est sit aliqua dolor do amet sint Amet minim mollit non deserunt
|
|
@@ -477,7 +476,7 @@ export const ContentClassName = {
|
|
|
477
476
|
useLayoutEffect(() => {
|
|
478
477
|
requestAnimationFrame(() => {
|
|
479
478
|
requestAnimationFrame(() => {
|
|
480
|
-
|
|
479
|
+
releaseCreatePortal();
|
|
481
480
|
});
|
|
482
481
|
});
|
|
483
482
|
}, []);
|
|
@@ -485,7 +484,7 @@ export const ContentClassName = {
|
|
|
485
484
|
padding: 0;
|
|
486
485
|
`;
|
|
487
486
|
return (<Box width="full" className={popupInlineClass}>
|
|
488
|
-
<Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Content class name demo" primaryBtnLabel="Primary" secondaryBtnLabel="Click to Dismiss" btnRowPosition="justify" contentClassName={contentClassName}>
|
|
487
|
+
<Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Content class name demo" primaryBtnLabel="Primary" secondaryBtnLabel="Click to Dismiss" btnRowPosition="justify" contentClassName={contentClassName} needBypassScrollLock>
|
|
489
488
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nec purus nec nunc lacinia
|
|
490
489
|
maximus. Donec vel luctus nisi. In hac habitasse platea dictumst. Nulla facilisi. Nullam
|
|
491
490
|
nec purus nec nunc lacinia maximus. Donec vel luctus nisi. In hac habitasse platea dictumst.
|
|
@@ -18,7 +18,6 @@ declare const StyledButtonGroup: import("@linaria/react").StyledMeta & import("r
|
|
|
18
18
|
as?: import("react").ElementType;
|
|
19
19
|
}>;
|
|
20
20
|
declare const buttonClass: import("@linaria/core").LinariaClassName;
|
|
21
|
-
declare const preventBodyScrollClass: import("@linaria/core").LinariaClassName;
|
|
22
21
|
declare const CloseButton: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Record<never, unknown> & {
|
|
23
22
|
as?: import("react").ElementType;
|
|
24
23
|
}>;
|
|
@@ -36,5 +35,5 @@ declare const HeaderTopBar: import("@linaria/react").StyledMeta & import("react"
|
|
|
36
35
|
as?: import("react").ElementType;
|
|
37
36
|
}>;
|
|
38
37
|
declare const noSpacingClass: import("@linaria/core").LinariaClassName;
|
|
39
|
-
export { Modal, StyledPopup, CloseButton, OptionButton, StyledHeader, ChildrenWrapper, ChildrenContent, StyledButtonGroup, Backdrop, buttonClass, showChildrenOverflowClass, HeaderTopBar, noSpacingClass,
|
|
38
|
+
export { Modal, StyledPopup, CloseButton, OptionButton, StyledHeader, ChildrenWrapper, ChildrenContent, StyledButtonGroup, Backdrop, buttonClass, showChildrenOverflowClass, HeaderTopBar, noSpacingClass, };
|
|
40
39
|
//# sourceMappingURL=Drawer.styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.styles.d.ts","sourceRoot":"","sources":["../../../patterns/Drawer/Drawer.styles.ts"],"names":[],"mappings":"AAmBA,QAAA,MAAM,KAAK;;EAeV,CAAC;AAEF,QAAA,MAAM,QAAQ;;EAQb,CAAC;AAEF,QAAA,MAAM,WAAW;;EA4DhB,CAAC;AAEF,QAAA,MAAM,YAAY;;EAYjB,CAAC;AAEF,QAAA,MAAM,iBAAiB;cAA0B;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE;;;EAkB1E,CAAC;AAEF,QAAA,MAAM,WAAW,0CAGhB,CAAC;
|
|
1
|
+
{"version":3,"file":"Drawer.styles.d.ts","sourceRoot":"","sources":["../../../patterns/Drawer/Drawer.styles.ts"],"names":[],"mappings":"AAmBA,QAAA,MAAM,KAAK;;EAeV,CAAC;AAEF,QAAA,MAAM,QAAQ;;EAQb,CAAC;AAEF,QAAA,MAAM,WAAW;;EA4DhB,CAAC;AAEF,QAAA,MAAM,YAAY;;EAYjB,CAAC;AAEF,QAAA,MAAM,iBAAiB;cAA0B;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE;;;EAkB1E,CAAC;AAEF,QAAA,MAAM,WAAW,0CAGhB,CAAC;AAEF,QAAA,MAAM,WAAW;;EA0ChB,CAAC;AAEF,QAAA,MAAM,YAAY;;EA2CjB,CAAC;AAEF,QAAA,MAAM,eAAe;;EAiCpB,CAAC;AAEF,QAAA,MAAM,eAAe;;EAiCpB,CAAC;AAGF,QAAA,MAAM,yBAAyB,0CAE9B,CAAC;AAEF,QAAA,MAAM,YAAY;;EAcjB,CAAC;AAEF,QAAA,MAAM,cAAc,0CAEnB,CAAC;AAEF,OAAO,EACL,KAAK,EACL,WAAW,EACX,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,yBAAyB,EACzB,YAAY,EACZ,cAAc,GACf,CAAC"}
|
|
@@ -124,11 +124,6 @@ const buttonClass = css `
|
|
|
124
124
|
justify-content: center;
|
|
125
125
|
width: ${sizes.full};
|
|
126
126
|
`;
|
|
127
|
-
// We need to use !important to override the body scroll
|
|
128
|
-
const preventBodyScrollClass = css `
|
|
129
|
-
/* stylelint-disable declaration-no-important */
|
|
130
|
-
overflow: hidden !important;
|
|
131
|
-
`;
|
|
132
127
|
const CloseButton = styled.button `
|
|
133
128
|
position: absolute;
|
|
134
129
|
top: ${space.md};
|
|
@@ -306,4 +301,4 @@ const HeaderTopBar = styled.div `
|
|
|
306
301
|
const noSpacingClass = css `
|
|
307
302
|
margin: 0;
|
|
308
303
|
`;
|
|
309
|
-
export { Modal, StyledPopup, CloseButton, OptionButton, StyledHeader, ChildrenWrapper, ChildrenContent, StyledButtonGroup, Backdrop, buttonClass, showChildrenOverflowClass, HeaderTopBar, noSpacingClass,
|
|
304
|
+
export { Modal, StyledPopup, CloseButton, OptionButton, StyledHeader, ChildrenWrapper, ChildrenContent, StyledButtonGroup, Backdrop, buttonClass, showChildrenOverflowClass, HeaderTopBar, noSpacingClass, };
|
|
@@ -11,7 +11,7 @@ const emptyStateStories = {
|
|
|
11
11
|
description: {
|
|
12
12
|
component: `EmptyState for showing Empty UI
|
|
13
13
|
|
|
14
|
-
\`✅ Stable\` [\`🎨 Figma Specs\`](https://www.figma.com/
|
|
14
|
+
\`✅ Stable\` [\`🎨 Figma Specs\`](https://www.figma.com/design/DfQM6G9p8PSNEoOzNGRjWD/v3.0-CHOTOT-Design-System---Processing?node-id=14424-23223&t=hz8QJLqNrGvTVY8R-4)
|
|
15
15
|
|
|
16
16
|
## How to use
|
|
17
17
|
EmptyState is a component for showing empty UI base on type of empty with an interactive button
|
|
@@ -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,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,iBAAiB,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;IACrC;;OAEG;IACH,cAAc,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;IAC9C;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC7B;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC/C;;OAEG;IACH,oBAAoB,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAClE;;OAEG;IACH,sBAAsB,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACpE;;OAEG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B;;OAEG;IACH,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B;;OAEG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;;;;;;;;;;GAWG;AAEH,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CA6F/B,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
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, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchInput.stories.d.ts","sourceRoot":"","sources":["../../../patterns/SearchInput/SearchInput.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SearchInput.stories.d.ts","sourceRoot":"","sources":["../../../patterns/SearchInput/SearchInput.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAWrD,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsFvB,CAAC;AAEF,eAAe,kBAAkB,CAAC;AAElC,eAAO,MAAM,QAAQ;mBACJ,GAAG;CA0BnB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;CAsCxB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;CA8CzB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;CAgCtB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;;CAiCpB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;CAgCvB,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;CAgC3B,CAAC;AAQF,eAAO,MAAM,MAAM;;;;;;;;;;CA0ElB,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;CAgE1B,CAAC;AAuFF,eAAO,MAAM,cAAc;;;;;;;;;CA8B1B,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useState, useCallback } from 'react';
|
|
2
2
|
import theme from '@clad-ui/theme';
|
|
3
3
|
import debounce from 'lodash/debounce';
|
|
4
|
-
import { guideImageClass } from '../../storybook/GuideImage';
|
|
5
4
|
import SearchInput from './SearchInput';
|
|
6
5
|
import Grid from '../../components/Grid/Grid';
|
|
7
6
|
import Col from '../../components/Grid/Col';
|
|
@@ -17,7 +16,7 @@ const searchInputStories = {
|
|
|
17
16
|
component: `Search Input component that carefully takes care of accessibility
|
|
18
17
|
and allow keyboard controls.
|
|
19
18
|
|
|
20
|
-
\`🧪 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=865-13593&t=hz8QJLqNrGvTVY8R-4)
|
|
21
20
|
|
|
22
21
|
## How to use
|
|
23
22
|
|
|
@@ -35,7 +34,6 @@ Usage:
|
|
|
35
34
|
Note:
|
|
36
35
|
- z-index of the selections list should be larger then modal z-index, for inside modal use case.
|
|
37
36
|
|
|
38
|
-
<img className="${guideImageClass}" src="./search-input.png" alt="Search Input screenshot" />
|
|
39
37
|
`,
|
|
40
38
|
},
|
|
41
39
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagCloud.stories.d.ts","sourceRoot":"","sources":["../../../patterns/TagCloud/TagCloud.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TagCloud.stories.d.ts","sourceRoot":"","sources":["../../../patterns/TagCloud/TagCloud.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAuBnD,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8DpB,CAAC;AAEF,eAAe,eAAe,CAAC;AAE/B,eAAO,MAAM,QAAQ;;CAapB,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;CA4CjC,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;CA+B1B,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;CA8BxB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;CA6BxB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;CAmCvB,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;CAuC5B,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;CA+BtB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;CAqCvB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;CA4BxB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;CAoCzB,CAAC"}
|