@transferwise/components 46.37.0 → 46.38.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 +1 -1
- package/build/index.js +159 -317
- package/build/index.js.map +1 -1
- package/build/index.mjs +154 -311
- package/build/index.mjs.map +1 -1
- package/build/main.css +127 -108
- package/build/styles/main.css +127 -108
- package/build/styles/uploadInput/UploadInput.css +25 -27
- package/build/styles/uploadInput/uploadButton/UploadButton.css +24 -38
- package/build/styles/uploadInput/uploadItem/UploadItem.css +81 -46
- package/build/types/actionButton/ActionButton.d.ts +2 -2
- package/build/types/actionButton/ActionButton.d.ts.map +1 -1
- package/build/types/actionOption/ActionOption.d.ts +0 -1
- package/build/types/actionOption/ActionOption.d.ts.map +1 -1
- package/build/types/alert/Alert.d.ts +0 -1
- package/build/types/alert/Alert.d.ts.map +1 -1
- package/build/types/alert/inlineMarkdown/InlineMarkdown.d.ts +4 -11
- package/build/types/alert/inlineMarkdown/InlineMarkdown.d.ts.map +1 -1
- package/build/types/alert/inlineMarkdown/index.d.ts +2 -1
- package/build/types/alert/inlineMarkdown/index.d.ts.map +1 -1
- package/build/types/avatar/Avatar.d.ts +0 -1
- package/build/types/avatar/Avatar.d.ts.map +1 -1
- package/build/types/avatar/colors/colors.d.ts.map +1 -1
- package/build/types/avatarWrapper/AvatarWrapper.d.ts +0 -1
- package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
- package/build/types/body/Body.d.ts +2 -2
- package/build/types/body/Body.d.ts.map +1 -1
- package/build/types/button/Button.d.ts +0 -1
- package/build/types/button/Button.d.ts.map +1 -1
- package/build/types/button/Button.messages.d.ts +3 -3
- package/build/types/button/classMap.d.ts +6 -6
- package/build/types/card/Card.d.ts +16 -20
- package/build/types/card/Card.d.ts.map +1 -1
- package/build/types/card/index.d.ts +2 -1
- package/build/types/card/index.d.ts.map +1 -1
- package/build/types/checkbox/Checkbox.d.ts +15 -20
- package/build/types/checkbox/Checkbox.d.ts.map +1 -1
- package/build/types/checkbox/index.d.ts +2 -2
- package/build/types/checkbox/index.d.ts.map +1 -1
- package/build/types/checkboxOption/CheckboxOption.d.ts +2 -3
- package/build/types/checkboxOption/CheckboxOption.d.ts.map +1 -1
- package/build/types/chevron/Chevron.d.ts +0 -1
- package/build/types/chevron/Chevron.d.ts.map +1 -1
- package/build/types/chips/Chip.d.ts +0 -1
- package/build/types/chips/Chip.d.ts.map +1 -1
- package/build/types/chips/Chips.d.ts +0 -1
- package/build/types/chips/Chips.d.ts.map +1 -1
- package/build/types/circularButton/CircularButton.d.ts +0 -1
- package/build/types/circularButton/CircularButton.d.ts.map +1 -1
- package/build/types/common/RadioButton/RadioButton.d.ts +0 -1
- package/build/types/common/RadioButton/RadioButton.d.ts.map +1 -1
- package/build/types/common/action/Action.d.ts +0 -1
- package/build/types/common/action/Action.d.ts.map +1 -1
- package/build/types/common/closeButton/CloseButton.d.ts +4 -5
- package/build/types/common/closeButton/CloseButton.d.ts.map +1 -1
- package/build/types/common/commonProps.d.ts +0 -1
- package/build/types/common/commonProps.d.ts.map +1 -1
- package/build/types/common/dateUtils/getMonthNames/getMonthNames.d.ts +1 -1
- package/build/types/common/dateUtils/getMonthNames/getMonthNames.d.ts.map +1 -1
- package/build/types/common/focusBoundary/FocusBoundary.d.ts +0 -1
- package/build/types/common/focusBoundary/FocusBoundary.d.ts.map +1 -1
- package/build/types/common/hooks/useDirection/useDirection.d.ts.map +1 -1
- package/build/types/common/hooks/useResizeObserver.d.ts +0 -1
- package/build/types/common/hooks/useResizeObserver.d.ts.map +1 -1
- package/build/types/common/panel/Panel.d.ts +8 -8
- package/build/types/common/panel/Panel.d.ts.map +1 -1
- package/build/types/common/polymorphicWithOverrides/PolymorphicWithOverrides.d.ts +0 -1
- package/build/types/common/polymorphicWithOverrides/PolymorphicWithOverrides.d.ts.map +1 -1
- package/build/types/common/responsivePanel/ResponsivePanel.d.ts +8 -9
- package/build/types/common/responsivePanel/ResponsivePanel.d.ts.map +1 -1
- package/build/types/criticalBanner/CriticalCommsBanner.d.ts +0 -1
- package/build/types/criticalBanner/CriticalCommsBanner.d.ts.map +1 -1
- package/build/types/dateInput/DateInput.d.ts +0 -1
- package/build/types/dateInput/DateInput.d.ts.map +1 -1
- package/build/types/dateLookup/DateLookup.d.ts +1 -1
- package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/dateLookup/dateHeader/DateHeader.d.ts +0 -1
- package/build/types/dateLookup/dateHeader/DateHeader.d.ts.map +1 -1
- package/build/types/dateLookup/dateTrigger/DateTrigger.d.ts +0 -1
- package/build/types/dateLookup/dateTrigger/DateTrigger.d.ts.map +1 -1
- package/build/types/dateLookup/dayCalendar/DayCalendar.d.ts +0 -1
- package/build/types/dateLookup/dayCalendar/DayCalendar.d.ts.map +1 -1
- package/build/types/dateLookup/dayCalendar/table/DayCalendarTable.d.ts +0 -1
- package/build/types/dateLookup/dayCalendar/table/DayCalendarTable.d.ts.map +1 -1
- package/build/types/dateLookup/monthCalendar/MonthCalendar.d.ts +0 -1
- package/build/types/dateLookup/monthCalendar/MonthCalendar.d.ts.map +1 -1
- package/build/types/dateLookup/monthCalendar/table/MonthCalendarTable.d.ts +0 -1
- package/build/types/dateLookup/monthCalendar/table/MonthCalendarTable.d.ts.map +1 -1
- package/build/types/dateLookup/tableLink/TableLink.d.ts +0 -1
- package/build/types/dateLookup/tableLink/TableLink.d.ts.map +1 -1
- package/build/types/dateLookup/yearCalendar/YearCalendar.d.ts +0 -1
- package/build/types/dateLookup/yearCalendar/YearCalendar.d.ts.map +1 -1
- package/build/types/dateLookup/yearCalendar/table/YearCalendarTable.d.ts +0 -1
- package/build/types/dateLookup/yearCalendar/table/YearCalendarTable.d.ts.map +1 -1
- package/build/types/decision/Decision.d.ts +1 -2
- package/build/types/decision/Decision.d.ts.map +1 -1
- package/build/types/definitionList/DefinitionList.d.ts +19 -24
- package/build/types/definitionList/DefinitionList.d.ts.map +1 -1
- package/build/types/definitionList/index.d.ts +2 -1
- package/build/types/definitionList/index.d.ts.map +1 -1
- package/build/types/dimmer/Dimmer.d.ts.map +1 -1
- package/build/types/drawer/Drawer.d.ts +18 -36
- package/build/types/drawer/Drawer.d.ts.map +1 -1
- package/build/types/drawer/index.d.ts +2 -1
- package/build/types/drawer/index.d.ts.map +1 -1
- package/build/types/dropFade/DropFade.d.ts.map +1 -1
- package/build/types/emphasis/Emphasis.d.ts +0 -1
- package/build/types/emphasis/Emphasis.d.ts.map +1 -1
- package/build/types/field/Field.d.ts +0 -1
- package/build/types/field/Field.d.ts.map +1 -1
- package/build/types/flowNavigation/FlowNavigation.d.ts +0 -1
- package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
- package/build/types/flowNavigation/backButton/BackButton.d.ts +3 -3
- package/build/types/flowNavigation/backButton/index.d.ts +1 -1
- package/build/types/flowNavigation/backButton/index.d.ts.map +1 -1
- package/build/types/header/Header.d.ts +0 -1
- package/build/types/header/Header.d.ts.map +1 -1
- package/build/types/image/Image.d.ts +0 -1
- package/build/types/image/Image.d.ts.map +1 -1
- package/build/types/index.d.ts +4 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/info/Info.d.ts +0 -1
- package/build/types/info/Info.d.ts.map +1 -1
- package/build/types/inputWithDisplayFormat/InputWithDisplayFormat.d.ts +0 -1
- package/build/types/inputWithDisplayFormat/InputWithDisplayFormat.d.ts.map +1 -1
- package/build/types/inputs/Input.d.ts +0 -1
- package/build/types/inputs/Input.d.ts.map +1 -1
- package/build/types/inputs/InputGroup.d.ts +0 -1
- package/build/types/inputs/InputGroup.d.ts.map +1 -1
- package/build/types/inputs/SearchInput.d.ts +0 -1
- package/build/types/inputs/SearchInput.d.ts.map +1 -1
- package/build/types/inputs/SelectInput.d.ts +0 -1
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/inputs/TextArea.d.ts +0 -1
- package/build/types/inputs/TextArea.d.ts.map +1 -1
- package/build/types/inputs/_BottomSheet.d.ts +0 -1
- package/build/types/inputs/_BottomSheet.d.ts.map +1 -1
- package/build/types/inputs/_ButtonInput.d.ts +0 -1
- package/build/types/inputs/_ButtonInput.d.ts.map +1 -1
- package/build/types/inputs/_Popover.d.ts +0 -1
- package/build/types/inputs/_Popover.d.ts.map +1 -1
- package/build/types/inputs/contexts.d.ts +0 -1
- package/build/types/inputs/contexts.d.ts.map +1 -1
- package/build/types/label/Label.d.ts +0 -1
- package/build/types/label/Label.d.ts.map +1 -1
- package/build/types/loader/Loader.d.ts +0 -1
- package/build/types/loader/Loader.d.ts.map +1 -1
- package/build/types/logo/Logo.d.ts +15 -23
- package/build/types/logo/Logo.d.ts.map +1 -1
- package/build/types/logo/index.d.ts +1 -2
- package/build/types/logo/index.d.ts.map +1 -1
- package/build/types/markdown/Markdown.d.ts +0 -1
- package/build/types/markdown/Markdown.d.ts.map +1 -1
- package/build/types/money/Money.d.ts +0 -1
- package/build/types/money/Money.d.ts.map +1 -1
- package/build/types/moneyInput/MoneyInput.d.ts +0 -1
- package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
- package/build/types/navigationOption/NavigationOption.d.ts +0 -1
- package/build/types/navigationOption/NavigationOption.d.ts.map +1 -1
- package/build/types/phoneNumberInput/PhoneNumberInput.d.ts +0 -1
- package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
- package/build/types/popover/Popover.d.ts +0 -1
- package/build/types/popover/Popover.d.ts.map +1 -1
- package/build/types/progress/Progress.d.ts +0 -1
- package/build/types/progress/Progress.d.ts.map +1 -1
- package/build/types/progressBar/ProgressBar.d.ts +0 -1
- package/build/types/progressBar/ProgressBar.d.ts.map +1 -1
- package/build/types/provider/Provider.d.ts +0 -1
- package/build/types/provider/Provider.d.ts.map +1 -1
- package/build/types/radio/Radio.d.ts +0 -1
- package/build/types/radio/Radio.d.ts.map +1 -1
- package/build/types/radioGroup/RadioGroup.d.ts +0 -1
- package/build/types/radioGroup/RadioGroup.d.ts.map +1 -1
- package/build/types/radioOption/RadioOption.d.ts +0 -1
- package/build/types/radioOption/RadioOption.d.ts.map +1 -1
- package/build/types/segmentedControl/SegmentedControl.d.ts +0 -1
- package/build/types/segmentedControl/SegmentedControl.d.ts.map +1 -1
- package/build/types/select/index.d.ts +1 -1
- package/build/types/select/index.d.ts.map +1 -1
- package/build/types/select/option/index.d.ts +1 -1
- package/build/types/select/option/index.d.ts.map +1 -1
- package/build/types/select/searchBox/SearchBox.d.ts +3 -3
- package/build/types/select/searchBox/SearchBox.d.ts.map +1 -1
- package/build/types/slidingPanel/SlidingPanel.d.ts +1 -1
- package/build/types/slidingPanel/SlidingPanel.d.ts.map +1 -1
- package/build/types/snackbar/Snackbar.d.ts +2 -1
- package/build/types/snackbar/Snackbar.d.ts.map +1 -1
- package/build/types/snackbar/SnackbarContext.d.ts +0 -1
- package/build/types/snackbar/SnackbarContext.d.ts.map +1 -1
- package/build/types/snackbar/SnackbarProvider.d.ts +0 -1
- package/build/types/snackbar/SnackbarProvider.d.ts.map +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts +0 -1
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/build/types/sticky/Sticky.d.ts +32 -4
- package/build/types/sticky/Sticky.d.ts.map +1 -1
- package/build/types/switchOption/SwitchOption.d.ts +0 -1
- package/build/types/switchOption/SwitchOption.d.ts.map +1 -1
- package/build/types/tabs/TabList.d.ts +1 -1
- package/build/types/tabs/TabPanel.d.ts +4 -4
- package/build/types/tabs/Tabs.d.ts.map +1 -1
- package/build/types/test-utils/story-config.d.ts +8 -0
- package/build/types/test-utils/story-config.d.ts.map +1 -1
- package/build/types/textareaWithDisplayFormat/TextareaWithDisplayFormat.d.ts +0 -1
- package/build/types/textareaWithDisplayFormat/TextareaWithDisplayFormat.d.ts.map +1 -1
- package/build/types/tile/Tile.d.ts +16 -37
- package/build/types/tile/Tile.d.ts.map +1 -1
- package/build/types/tile/index.d.ts +1 -1
- package/build/types/tile/index.d.ts.map +1 -1
- package/build/types/typeahead/Typeahead.d.ts.map +1 -1
- package/build/types/typeahead/typeaheadOption/TypeaheadOption.d.ts +0 -1
- package/build/types/typeahead/typeaheadOption/TypeaheadOption.d.ts.map +1 -1
- package/build/types/typeahead/util/highlight.d.ts +0 -1
- package/build/types/typeahead/util/highlight.d.ts.map +1 -1
- package/build/types/upload/Upload.d.ts.map +1 -1
- package/build/types/upload/Upload.messages.d.ts +20 -20
- package/build/types/upload/steps/completeStep/completeStep.d.ts +10 -10
- package/build/types/upload/steps/mediaUploadStep/mediaUploadStep.d.ts +8 -8
- package/build/types/upload/steps/processingStep/processingStep.d.ts +8 -8
- package/build/types/upload/steps/uploadImageStep/uploadImageStep.d.ts +9 -9
- package/build/types/upload/steps/uploadImageStep/uploadImageStep.d.ts.map +1 -1
- package/build/types/uploadInput/UploadInput.d.ts +0 -1
- package/build/types/uploadInput/UploadInput.d.ts.map +1 -1
- package/build/types/uploadInput/types.d.ts +9 -1
- package/build/types/uploadInput/types.d.ts.map +1 -1
- package/build/types/uploadInput/uploadButton/UploadButton.d.ts +1 -6
- package/build/types/uploadInput/uploadButton/UploadButton.d.ts.map +1 -1
- package/build/types/uploadInput/uploadItem/UploadItem.d.ts +0 -1
- package/build/types/uploadInput/uploadItem/UploadItem.d.ts.map +1 -1
- package/build/types/withDisplayFormat/WithDisplayFormat.d.ts.map +1 -1
- package/build/types/withNextPortal/withNextPortal.d.ts +0 -1
- package/build/types/withNextPortal/withNextPortal.d.ts.map +1 -1
- package/package.json +1 -2
- package/src/alert/inlineMarkdown/InlineMarkdown.tsx +13 -0
- package/src/alert/inlineMarkdown/index.ts +2 -0
- package/src/card/{Card.story.js → Card.story.tsx} +6 -15
- package/src/card/{Card.js → Card.tsx} +23 -34
- package/src/card/index.ts +2 -0
- package/src/checkbox/{Checkbox.spec.js → Checkbox.spec.tsx} +5 -5
- package/src/checkbox/{Checkbox.js → Checkbox.tsx} +19 -41
- package/src/checkbox/index.ts +2 -0
- package/src/decision/Decision.tsx +1 -1
- package/src/definitionList/{DefinitionList.story.js → DefinitionList.story.tsx} +22 -2
- package/src/definitionList/DefinitionList.tsx +95 -0
- package/src/definitionList/index.ts +2 -0
- package/src/drawer/{Drawer.rtl.spec.js → Drawer.rtl.spec.tsx} +4 -2
- package/src/drawer/{Drawer.story.js → Drawer.story.tsx} +20 -28
- package/src/drawer/{Drawer.js → Drawer.tsx} +26 -31
- package/src/drawer/index.ts +2 -0
- package/src/index.ts +4 -0
- package/src/logo/Logo.story.tsx +3 -6
- package/src/logo/{Logo.js → Logo.tsx} +25 -35
- package/src/logo/index.ts +1 -0
- package/src/main.css +127 -108
- package/src/section/Section.story.tsx +0 -2
- package/src/slidingPanel/SlidingPanel.spec.js +2 -1
- package/src/slidingPanel/SlidingPanel.tsx +3 -0
- package/src/snackbar/Snackbar.story.tsx +20 -100
- package/src/snackbar/Snackbar.tests.story.tsx +281 -0
- package/src/snackbar/Snackbar.tsx +8 -12
- package/src/sticky/Sticky.spec.tsx +71 -0
- package/src/sticky/Sticky.story.tsx +72 -15
- package/src/sticky/Sticky.tsx +49 -5
- package/src/test-utils/Parameters.d.ts +8 -0
- package/src/test-utils/story-config.ts +5 -0
- package/src/tile/{Tile.spec.js → Tile.spec.tsx} +1 -1
- package/src/tile/{Tile.js → Tile.tsx} +24 -35
- package/src/uploadInput/UploadInput.css +25 -27
- package/src/uploadInput/UploadInput.less +24 -23
- package/src/uploadInput/UploadInput.story.tsx +60 -10
- package/src/uploadInput/UploadInput.tsx +1 -4
- package/src/uploadInput/types.ts +11 -1
- package/src/uploadInput/uploadButton/UploadButton.css +24 -38
- package/src/uploadInput/uploadButton/UploadButton.less +27 -40
- package/src/uploadInput/uploadButton/UploadButton.spec.tsx +0 -1
- package/src/uploadInput/uploadButton/UploadButton.tsx +12 -37
- package/src/uploadInput/uploadItem/UploadItem.css +81 -46
- package/src/uploadInput/uploadItem/UploadItem.less +75 -40
- package/src/uploadInput/uploadItem/UploadItem.tsx +30 -25
- package/src/uploadInput/uploadItem/UploadItemBody.tsx +1 -1
- package/build/types/logo/logoTypes.d.ts +0 -6
- package/build/types/logo/logoTypes.d.ts.map +0 -1
- package/src/alert/inlineMarkdown/InlineMarkdown.js +0 -21
- package/src/alert/inlineMarkdown/index.js +0 -1
- package/src/card/index.js +0 -1
- package/src/checkbox/index.js +0 -3
- package/src/definitionList/DefinitionList.js +0 -100
- package/src/definitionList/index.js +0 -1
- package/src/drawer/index.js +0 -1
- package/src/logo/index.js +0 -2
- package/src/logo/logoTypes.ts +0 -6
- package/src/snackbar/Snackbar.spec.js +0 -112
- package/src/sticky/Sticky.spec.js +0 -34
- /package/src/card/{Card.spec.js → Card.spec.tsx} +0 -0
- /package/src/checkbox/__snapshots__/{Checkbox.spec.js.snap → Checkbox.spec.tsx.snap} +0 -0
- /package/src/drawer/__snapshots__/{Drawer.rtl.spec.js.snap → Drawer.rtl.spec.tsx.snap} +0 -0
- /package/src/logo/{Logo.spec.js → Logo.spec.tsx} +0 -0
- /package/src/logo/__snapshots__/{Logo.spec.js.snap → Logo.spec.tsx.snap} +0 -0
- /package/src/tile/{Tile.story.js → Tile.story.tsx} +0 -0
- /package/src/tile/__snapshots__/{Tile.spec.js.snap → Tile.spec.tsx.snap} +0 -0
- /package/src/tile/{index.js → index.ts} +0 -0
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { action } from '@storybook/addon-actions';
|
|
2
2
|
import { number } from '@storybook/addon-knobs';
|
|
3
|
-
import { StoryContext } from '@storybook/react';
|
|
4
|
-
import { userEvent,
|
|
5
|
-
import {
|
|
3
|
+
import type { StoryContext } from '@storybook/react';
|
|
4
|
+
import { userEvent, within } from '@storybook/test';
|
|
5
|
+
import { wait } from '../test-utils/wait';
|
|
6
6
|
|
|
7
7
|
import Button from '../button';
|
|
8
|
-
import CheckboxOption from '../checkboxOption/CheckboxOption';
|
|
9
|
-
import { wait } from '../test-utils/wait';
|
|
10
8
|
|
|
11
9
|
import { Snackbar } from './Snackbar';
|
|
12
10
|
import { SnackbarConsumer } from './SnackbarContext';
|
|
@@ -17,113 +15,35 @@ export default {
|
|
|
17
15
|
title: 'Dialogs/Snackbar',
|
|
18
16
|
};
|
|
19
17
|
|
|
20
|
-
export const
|
|
18
|
+
export const Basic = () => {
|
|
21
19
|
const timeout = number('timeout (ms)', 10000000);
|
|
22
20
|
|
|
23
21
|
return (
|
|
24
22
|
<SnackbarProvider timeout={timeout}>
|
|
25
23
|
<SnackbarConsumer>
|
|
26
24
|
{({ createSnackbar }) => (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
</Button>
|
|
42
|
-
<div className="p-t-3">
|
|
43
|
-
<CheckboxOption
|
|
44
|
-
title="In mobile view, snackbar is full-width, not centered"
|
|
45
|
-
media={<Mobile />}
|
|
46
|
-
/>
|
|
47
|
-
<CheckboxOption
|
|
48
|
-
title="In RTL, snackbar is not left aligned"
|
|
49
|
-
content={
|
|
50
|
-
<a
|
|
51
|
-
href="https://transferwise.atlassian.net/browse/DS-4642"
|
|
52
|
-
target="_blank"
|
|
53
|
-
rel="noreferrer"
|
|
54
|
-
>
|
|
55
|
-
Bug DS-4642
|
|
56
|
-
</a>
|
|
57
|
-
}
|
|
58
|
-
media={<Switch />}
|
|
59
|
-
/>
|
|
60
|
-
<CheckboxOption
|
|
61
|
-
title="In RTL, snackbar has proper padding on left and right of button"
|
|
62
|
-
content={
|
|
63
|
-
<a
|
|
64
|
-
href="https://transferwise.atlassian.net/browse/DS-4643"
|
|
65
|
-
target="_blank"
|
|
66
|
-
rel="noreferrer"
|
|
67
|
-
>
|
|
68
|
-
Bug DS-4643
|
|
69
|
-
</a>
|
|
70
|
-
}
|
|
71
|
-
media={<Switch />}
|
|
72
|
-
/>
|
|
73
|
-
<CheckboxOption
|
|
74
|
-
title="In light mode, snackbar has drop shadow"
|
|
75
|
-
content={
|
|
76
|
-
<a
|
|
77
|
-
href="https://transferwise.atlassian.net/browse/DS-4477"
|
|
78
|
-
target="_blank"
|
|
79
|
-
rel="noreferrer"
|
|
80
|
-
>
|
|
81
|
-
Bug DS-4477
|
|
82
|
-
</a>
|
|
83
|
-
}
|
|
84
|
-
media={<Bulb />}
|
|
85
|
-
/>
|
|
86
|
-
<CheckboxOption title="In dark mode, snackbar has no drop shadow" media={<Theme />} />
|
|
87
|
-
<CheckboxOption
|
|
88
|
-
title="In dark mode, snackbar is inverted and has light background"
|
|
89
|
-
media={<Theme />}
|
|
90
|
-
/>
|
|
91
|
-
<CheckboxOption
|
|
92
|
-
title="Font size is 14 px, not 16px"
|
|
93
|
-
content={
|
|
94
|
-
<a
|
|
95
|
-
href="https://transferwise.atlassian.net/browse/DS-3716"
|
|
96
|
-
target="_blank"
|
|
97
|
-
rel="noreferrer"
|
|
98
|
-
>
|
|
99
|
-
Bug DS-3716
|
|
100
|
-
</a>
|
|
101
|
-
}
|
|
102
|
-
media={<Info size="16" />}
|
|
103
|
-
/>
|
|
104
|
-
<CheckboxOption
|
|
105
|
-
title="Snackbar isn't transparent (get some text behind it to make sure)"
|
|
106
|
-
content={
|
|
107
|
-
<a
|
|
108
|
-
href="https://transferwise.atlassian.net/browse/DS-3740"
|
|
109
|
-
target="_blank"
|
|
110
|
-
rel="noreferrer"
|
|
111
|
-
>
|
|
112
|
-
Bug DS-3740
|
|
113
|
-
</a>
|
|
114
|
-
}
|
|
115
|
-
media={<Coins />}
|
|
116
|
-
/>
|
|
117
|
-
</div>
|
|
118
|
-
</>
|
|
25
|
+
<Button
|
|
26
|
+
block
|
|
27
|
+
onClick={() => {
|
|
28
|
+
createSnackbar({
|
|
29
|
+
action: {
|
|
30
|
+
label: 'View',
|
|
31
|
+
onClick: () => action('View button clicked.'),
|
|
32
|
+
},
|
|
33
|
+
text: <span>Some text</span>,
|
|
34
|
+
});
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
Show Snackbar
|
|
38
|
+
</Button>
|
|
119
39
|
)}
|
|
120
40
|
</SnackbarConsumer>
|
|
121
41
|
</SnackbarProvider>
|
|
122
42
|
);
|
|
123
43
|
};
|
|
124
44
|
|
|
125
|
-
|
|
126
|
-
await wait(0);
|
|
45
|
+
Basic.play = async ({ canvasElement }: StoryContext) => {
|
|
46
|
+
await wait(0);
|
|
127
47
|
const canvas = within(canvasElement);
|
|
128
48
|
await userEvent.click(canvas.getByRole('button'));
|
|
129
49
|
};
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { userEvent, within } from '@storybook/test';
|
|
2
|
+
import { action } from '@storybook/addon-actions';
|
|
3
|
+
import { Mobile as MobileIcon, Theme, Switch, Bulb, Info, Coins, Team } from '@transferwise/icons';
|
|
4
|
+
import { Snackbar, type SnackbarProps } from './Snackbar';
|
|
5
|
+
import { SnackbarConsumer } from './SnackbarContext';
|
|
6
|
+
import SnackbarProvider from './SnackbarProvider';
|
|
7
|
+
import Button from '../button';
|
|
8
|
+
import CheckboxOption from '../checkboxOption';
|
|
9
|
+
import { storyConfig } from '../test-utils';
|
|
10
|
+
import { wait } from '../test-utils/wait';
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
title: 'Dialogs/Snackbar/Tests',
|
|
14
|
+
component: Snackbar,
|
|
15
|
+
argTypes: {},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const launchSnackbar = async (canvasElement: HTMLElement) => {
|
|
19
|
+
await wait(0);
|
|
20
|
+
const canvas = within(canvasElement);
|
|
21
|
+
await userEvent.click(canvas.getByRole('button'));
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type Args = Partial<SnackbarProps> & {
|
|
25
|
+
extraContext: React.ReactNode;
|
|
26
|
+
timeout: number;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const TIMEOUT = 10000000;
|
|
30
|
+
|
|
31
|
+
const Default = {
|
|
32
|
+
args: {
|
|
33
|
+
timeout: TIMEOUT,
|
|
34
|
+
} as Args,
|
|
35
|
+
play: async ({ canvasElement }: { canvasElement: HTMLElement }) => {
|
|
36
|
+
await launchSnackbar(canvasElement);
|
|
37
|
+
},
|
|
38
|
+
render: (args: Args) => {
|
|
39
|
+
return (
|
|
40
|
+
<SnackbarProvider timeout={args.timeout}>
|
|
41
|
+
<SnackbarConsumer>
|
|
42
|
+
{({ createSnackbar }) => (
|
|
43
|
+
<>
|
|
44
|
+
<Button
|
|
45
|
+
block
|
|
46
|
+
onClick={() => {
|
|
47
|
+
createSnackbar({
|
|
48
|
+
action: {
|
|
49
|
+
label: 'View',
|
|
50
|
+
onClick: () => action('View button clicked.'),
|
|
51
|
+
},
|
|
52
|
+
text: <span>Some text</span>,
|
|
53
|
+
});
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
Show Snackbar
|
|
57
|
+
</Button>
|
|
58
|
+
{args.extraContext}
|
|
59
|
+
</>
|
|
60
|
+
)}
|
|
61
|
+
</SnackbarConsumer>
|
|
62
|
+
</SnackbarProvider>
|
|
63
|
+
);
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const Basic = {
|
|
68
|
+
args: {
|
|
69
|
+
...Default.args,
|
|
70
|
+
extraContext: (
|
|
71
|
+
<div className="p-t-3">
|
|
72
|
+
<CheckboxOption
|
|
73
|
+
title="In light mode, snackbar has drop shadow"
|
|
74
|
+
content={
|
|
75
|
+
<a
|
|
76
|
+
href="https://transferwise.atlassian.net/browse/DS-4477"
|
|
77
|
+
target="_blank"
|
|
78
|
+
rel="noreferrer"
|
|
79
|
+
>
|
|
80
|
+
Bug DS-4477
|
|
81
|
+
</a>
|
|
82
|
+
}
|
|
83
|
+
media={<Bulb />}
|
|
84
|
+
/>
|
|
85
|
+
<CheckboxOption
|
|
86
|
+
title="Font size is 14 px, not 16px"
|
|
87
|
+
content={
|
|
88
|
+
<a
|
|
89
|
+
href="https://transferwise.atlassian.net/browse/DS-3716"
|
|
90
|
+
target="_blank"
|
|
91
|
+
rel="noreferrer"
|
|
92
|
+
>
|
|
93
|
+
Bug DS-3716
|
|
94
|
+
</a>
|
|
95
|
+
}
|
|
96
|
+
media={<Info size="16" />}
|
|
97
|
+
/>
|
|
98
|
+
</div>
|
|
99
|
+
) as React.ReactNode,
|
|
100
|
+
},
|
|
101
|
+
play: Default.play,
|
|
102
|
+
render: Default.render,
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const Mobile = storyConfig(
|
|
106
|
+
{
|
|
107
|
+
args: {
|
|
108
|
+
...Default.args,
|
|
109
|
+
extraContext: (
|
|
110
|
+
<div className="p-t-3">
|
|
111
|
+
<CheckboxOption
|
|
112
|
+
title="In mobile view, snackbar is full-width, not centered"
|
|
113
|
+
media={<MobileIcon />}
|
|
114
|
+
/>
|
|
115
|
+
</div>
|
|
116
|
+
) as React.ReactNode,
|
|
117
|
+
},
|
|
118
|
+
play: Default.play,
|
|
119
|
+
render: Default.render,
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
variants: ['mobile'],
|
|
123
|
+
},
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
const switchToDarkMode = async (context: { canvasElement: HTMLElement }) => {
|
|
127
|
+
await Default.play(context);
|
|
128
|
+
|
|
129
|
+
// the snackbar is outside the storybook dom so dark mode doesn't apply
|
|
130
|
+
const body = document.querySelector('div.np-theme-personal');
|
|
131
|
+
if (body) {
|
|
132
|
+
body.setAttribute('class', 'np-theme-personal--dark');
|
|
133
|
+
}
|
|
134
|
+
const snackbar = document.querySelector('div.snackbar');
|
|
135
|
+
if (snackbar) {
|
|
136
|
+
snackbar.setAttribute('class', 'snackbar np-theme-personal--dark');
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export const DarkMode = storyConfig(
|
|
141
|
+
{
|
|
142
|
+
args: {
|
|
143
|
+
...Default.args,
|
|
144
|
+
extraContext: (
|
|
145
|
+
<div className="p-t-3">
|
|
146
|
+
<CheckboxOption title="In dark mode, snackbar has no drop shadow" media={<Theme />} />
|
|
147
|
+
<CheckboxOption
|
|
148
|
+
title="In dark mode, snackbar is inverted and has light background"
|
|
149
|
+
media={<Theme />}
|
|
150
|
+
/>
|
|
151
|
+
</div>
|
|
152
|
+
) as React.ReactNode,
|
|
153
|
+
},
|
|
154
|
+
play: switchToDarkMode,
|
|
155
|
+
render: Default.render,
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
variants: ['dark'],
|
|
159
|
+
},
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
const switchToRTL = async (context: { canvasElement: HTMLElement }) => {
|
|
163
|
+
await Default.play(context);
|
|
164
|
+
// the snackbar is outside the storybook dom so the RTL variant doesn't apply
|
|
165
|
+
const body = document.querySelector('div.storybook-container');
|
|
166
|
+
if (body) {
|
|
167
|
+
body.setAttribute('dir', 'rtl');
|
|
168
|
+
}
|
|
169
|
+
const snackbar = document.querySelector('div.snackbar');
|
|
170
|
+
if (snackbar) {
|
|
171
|
+
snackbar.setAttribute('dir', 'rtl');
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export const RTL = storyConfig(
|
|
176
|
+
{
|
|
177
|
+
args: {
|
|
178
|
+
...Default.args,
|
|
179
|
+
extraContext: (
|
|
180
|
+
<div className="p-t-3">
|
|
181
|
+
<CheckboxOption
|
|
182
|
+
title="In RTL, snackbar is not left aligned"
|
|
183
|
+
content={
|
|
184
|
+
<a
|
|
185
|
+
href="https://transferwise.atlassian.net/browse/DS-4642"
|
|
186
|
+
target="_blank"
|
|
187
|
+
rel="noreferrer"
|
|
188
|
+
>
|
|
189
|
+
Bug DS-4642
|
|
190
|
+
</a>
|
|
191
|
+
}
|
|
192
|
+
media={<Switch />}
|
|
193
|
+
/>
|
|
194
|
+
<CheckboxOption
|
|
195
|
+
title="In RTL, snackbar has proper padding on left and right of button"
|
|
196
|
+
content={
|
|
197
|
+
<a
|
|
198
|
+
href="https://transferwise.atlassian.net/browse/DS-4643"
|
|
199
|
+
target="_blank"
|
|
200
|
+
rel="noreferrer"
|
|
201
|
+
>
|
|
202
|
+
Bug DS-4643
|
|
203
|
+
</a>
|
|
204
|
+
}
|
|
205
|
+
media={<Switch />}
|
|
206
|
+
/>
|
|
207
|
+
</div>
|
|
208
|
+
) as React.ReactNode,
|
|
209
|
+
},
|
|
210
|
+
play: switchToRTL,
|
|
211
|
+
render: Default.render,
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
variants: ['rtl'],
|
|
215
|
+
},
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
export const RTLMobile = storyConfig(
|
|
219
|
+
{
|
|
220
|
+
args: {
|
|
221
|
+
...RTL.args,
|
|
222
|
+
},
|
|
223
|
+
play: switchToRTL,
|
|
224
|
+
render: Default.render,
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
variants: ['rtl', 'mobile'],
|
|
228
|
+
},
|
|
229
|
+
);
|
|
230
|
+
|
|
231
|
+
export const Zoom400 = storyConfig(
|
|
232
|
+
{
|
|
233
|
+
args: {
|
|
234
|
+
...Default.args,
|
|
235
|
+
extraContext: (
|
|
236
|
+
<div className="p-t-3">
|
|
237
|
+
<CheckboxOption
|
|
238
|
+
content="Snackbar isn't transparent (I'm going to make this text very long so that it will fill up the entire page and go behind the snackbar. This way, when you look at it you will easily be able to tell if the snackbar is transparent and recognize the bug because we don't want it to be transparent. Transparent is bad. When we first did rebrand we had a lot of problems with transparencies. I don't know what happened to them. I don't see them a lot anymore but I also don't remember anybody fixing them.)"
|
|
239
|
+
title={
|
|
240
|
+
<a
|
|
241
|
+
href="https://transferwise.atlassian.net/browse/DS-3716"
|
|
242
|
+
target="_blank"
|
|
243
|
+
rel="noreferrer"
|
|
244
|
+
>
|
|
245
|
+
Bug DS-3716
|
|
246
|
+
</a>
|
|
247
|
+
}
|
|
248
|
+
media={<Coins />}
|
|
249
|
+
/>
|
|
250
|
+
</div>
|
|
251
|
+
),
|
|
252
|
+
},
|
|
253
|
+
|
|
254
|
+
play: Default.play,
|
|
255
|
+
render: Default.render,
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
variants: ['400%'],
|
|
259
|
+
},
|
|
260
|
+
);
|
|
261
|
+
|
|
262
|
+
export const MultipleClicks = {
|
|
263
|
+
args: {
|
|
264
|
+
...Default.args,
|
|
265
|
+
extraContext: (
|
|
266
|
+
<div className="p-t-3">
|
|
267
|
+
<CheckboxOption
|
|
268
|
+
title="Snackbar is only shown once even if clicked many times"
|
|
269
|
+
media={<Team />}
|
|
270
|
+
/>
|
|
271
|
+
</div>
|
|
272
|
+
),
|
|
273
|
+
},
|
|
274
|
+
play: async ({ canvasElement }: { canvasElement: HTMLElement }) => {
|
|
275
|
+
const canvas = within(canvasElement);
|
|
276
|
+
for (let i = 0; i < 8; i += 1) {
|
|
277
|
+
await userEvent.click(canvas.getByRole('button'));
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
render: Default.render,
|
|
281
|
+
};
|
|
@@ -3,7 +3,7 @@ import { CSSTransition } from 'react-transition-group';
|
|
|
3
3
|
|
|
4
4
|
import ActionButton from '../actionButton';
|
|
5
5
|
import Body from '../body';
|
|
6
|
-
import { Theme, ThemeDark, ThemeLight } from '../common';
|
|
6
|
+
import { Theme, type ThemeDark, type ThemeLight } from '../common';
|
|
7
7
|
import { DirectionContext } from '../provider/direction';
|
|
8
8
|
import withNextPortal from '../withNextPortal/withNextPortal';
|
|
9
9
|
|
|
@@ -15,6 +15,7 @@ export interface SnackbarProps {
|
|
|
15
15
|
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
16
16
|
};
|
|
17
17
|
text: React.ReactNode;
|
|
18
|
+
/** @deprecated */
|
|
18
19
|
theme?: ThemeLight | ThemeDark;
|
|
19
20
|
timeout: number;
|
|
20
21
|
timestamp: number;
|
|
@@ -66,10 +67,10 @@ export class Snackbar extends Component<SnackbarProps, SnackbarState> {
|
|
|
66
67
|
};
|
|
67
68
|
|
|
68
69
|
componentDidUpdate(previousProps: SnackbarProps) {
|
|
69
|
-
const { action, text,
|
|
70
|
+
const { action, text, timestamp } = this.props;
|
|
70
71
|
|
|
71
72
|
if (!previousProps.text) {
|
|
72
|
-
this.setState({ visible: true, action, text
|
|
73
|
+
this.setState({ visible: true, action, text }, () => {
|
|
73
74
|
this.setLeaveTimeout();
|
|
74
75
|
});
|
|
75
76
|
} else if (previousProps.timestamp !== timestamp) {
|
|
@@ -78,19 +79,19 @@ export class Snackbar extends Component<SnackbarProps, SnackbarState> {
|
|
|
78
79
|
if (this.state.visible) {
|
|
79
80
|
this.setState({ visible: false }, () => {
|
|
80
81
|
this.transitionTimeout = window.setTimeout(() => {
|
|
81
|
-
this.setState({ visible: true, action, text
|
|
82
|
+
this.setState({ visible: true, action, text });
|
|
82
83
|
this.setLeaveTimeout();
|
|
83
84
|
}, CSS_TRANSITION_DURATION);
|
|
84
85
|
});
|
|
85
86
|
} else {
|
|
86
|
-
this.setState({ visible: true, action, text
|
|
87
|
+
this.setState({ visible: true, action, text });
|
|
87
88
|
this.setLeaveTimeout();
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
render() {
|
|
93
|
-
const { action, text,
|
|
94
|
+
const { action, text, visible } = this.state;
|
|
94
95
|
const { timeout } = this.props;
|
|
95
96
|
|
|
96
97
|
return (
|
|
@@ -106,12 +107,7 @@ export class Snackbar extends Component<SnackbarProps, SnackbarState> {
|
|
|
106
107
|
}}
|
|
107
108
|
unmountOnExit
|
|
108
109
|
>
|
|
109
|
-
<Body
|
|
110
|
-
ref={this.bodyRef}
|
|
111
|
-
as="span"
|
|
112
|
-
className={`snackbar__text snackbar__text--${theme}`}
|
|
113
|
-
aria-live="polite"
|
|
114
|
-
>
|
|
110
|
+
<Body ref={this.bodyRef} as="span" className="snackbar__text" aria-live="polite">
|
|
115
111
|
{text}
|
|
116
112
|
{action ? (
|
|
117
113
|
<ActionButton className="snackbar__text__action" onClick={action.onClick}>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import Sticky, { StickyProps } from './Sticky';
|
|
3
|
+
|
|
4
|
+
describe('Sticky', () => {
|
|
5
|
+
const defaultProps = {
|
|
6
|
+
open: true,
|
|
7
|
+
children: <div>Test Content</div>,
|
|
8
|
+
position: 'bottom' as const,
|
|
9
|
+
testId: 'test-sticky-panel',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
let rerenderSticky: (props?: StickyProps) => void;
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
const { rerender } = render(<Sticky {...defaultProps} />);
|
|
16
|
+
|
|
17
|
+
rerenderSticky = (props?: StickyProps) => {
|
|
18
|
+
rerender(<Sticky {...defaultProps} {...props} />);
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('renders with default props', () => {
|
|
23
|
+
expect(screen.getByTestId('test-sticky-panel')).toBeVisible();
|
|
24
|
+
expect(screen.getByTestId('test-sticky-panel')).toHaveClass('sliding-panel--open-bottom');
|
|
25
|
+
expect(screen.getByText('Test Content')).toBeInTheDocument();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test('renders with open `false`', async () => {
|
|
29
|
+
const props: StickyProps = {
|
|
30
|
+
...defaultProps,
|
|
31
|
+
open: false, // Ensure the Sticky is initially open
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
expect(screen.getByTestId('test-sticky-panel')).toBeVisible();
|
|
35
|
+
|
|
36
|
+
// Change props to close the Sticky
|
|
37
|
+
rerenderSticky(props);
|
|
38
|
+
|
|
39
|
+
await waitFor(() => {
|
|
40
|
+
// Use queryByText instead of getByText for conditional presence checks
|
|
41
|
+
expect(screen.queryByText('Test Content')).not.toBeInTheDocument();
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('renders new content', () => {
|
|
46
|
+
const props: StickyProps = {
|
|
47
|
+
...defaultProps,
|
|
48
|
+
children: <div>New Test Content</div>,
|
|
49
|
+
};
|
|
50
|
+
expect(screen.getByText('Test Content')).toBeInTheDocument();
|
|
51
|
+
|
|
52
|
+
// Change props
|
|
53
|
+
rerenderSticky(props);
|
|
54
|
+
|
|
55
|
+
expect(screen.getByText('New Test Content')).toBeInTheDocument();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('renders with position set to `top`', () => {
|
|
59
|
+
const props: StickyProps = {
|
|
60
|
+
...defaultProps,
|
|
61
|
+
position: 'top',
|
|
62
|
+
};
|
|
63
|
+
expect(screen.getByTestId('test-sticky-panel')).toBeInTheDocument();
|
|
64
|
+
expect(screen.getByTestId('test-sticky-panel')).toHaveClass('sliding-panel--open-bottom');
|
|
65
|
+
|
|
66
|
+
// Change props
|
|
67
|
+
rerenderSticky(props);
|
|
68
|
+
|
|
69
|
+
expect(screen.getByTestId('test-sticky-panel')).toHaveClass('sliding-panel--open-top');
|
|
70
|
+
});
|
|
71
|
+
});
|
|
@@ -1,22 +1,79 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import Sticky from './Sticky';
|
|
4
|
+
import { allModes } from '../../.storybook/modes';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
const meta: Meta<typeof Sticky> = {
|
|
6
7
|
component: Sticky,
|
|
7
|
-
title: '
|
|
8
|
+
title: 'Dialogs/Sticky',
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
args: {
|
|
11
|
+
open: true,
|
|
12
|
+
position: 'bottom', // Default position
|
|
13
|
+
children: (
|
|
14
|
+
<div className="d-flex justify-content-start align-items-start flex-wrap p-x-4 p-y-4">
|
|
15
|
+
<p className="m-b-0">Default text for Sticky component.</p>
|
|
16
|
+
</div>
|
|
17
|
+
),
|
|
18
|
+
},
|
|
19
|
+
parameters: {
|
|
20
|
+
chromatic: {
|
|
21
|
+
// 🔶 Test each story for Sticky
|
|
22
|
+
modes: {
|
|
23
|
+
ltr: allModes.ltr,
|
|
24
|
+
rtl: allModes.rtl,
|
|
25
|
+
light: allModes.light,
|
|
26
|
+
dark: allModes.dark,
|
|
27
|
+
brightGreen: allModes.brightGreen,
|
|
28
|
+
forestGreen: allModes.forestGreen,
|
|
29
|
+
desktop: allModes.desktop,
|
|
30
|
+
tablet: allModes.tablet,
|
|
31
|
+
largeMobile: allModes.largeMobile,
|
|
32
|
+
smallMobile: allModes.smallMobile,
|
|
33
|
+
zoom400: allModes.zoom400,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
docs: {
|
|
37
|
+
canvas: {
|
|
38
|
+
layout: 'padded',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
8
42
|
};
|
|
9
43
|
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
44
|
+
export default meta;
|
|
45
|
+
|
|
46
|
+
// Represents a story object for the `Sticky` component.
|
|
47
|
+
type Story = StoryObj<typeof Sticky>;
|
|
48
|
+
|
|
49
|
+
export const Default: Story = {}; // Default story with no additional props
|
|
50
|
+
|
|
51
|
+
export const PositionTop: Story = {
|
|
52
|
+
args: {
|
|
53
|
+
position: 'top', // Set the position prop to 'top'
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const WithLongContent: Story = {
|
|
58
|
+
args: {
|
|
59
|
+
children: (
|
|
60
|
+
<div className="p-x-4 p-y-4">
|
|
61
|
+
<p>
|
|
62
|
+
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Optio ipsa rem fugiat
|
|
63
|
+
repellendus nisi dolorum, recusandae aperiam repudiandae natus quaerat, explicabo fugit!
|
|
64
|
+
Odit illum vero eius quasi, error soluta veritatis.
|
|
65
|
+
</p>
|
|
66
|
+
<p>
|
|
67
|
+
Recusandae a animi tenetur magni itaque optio in aut enim odio. Minima, veritatis error
|
|
68
|
+
dicta expedita aliquam officiis deleniti repellat rerum nam ad quam dolorum reiciendis
|
|
69
|
+
voluptas doloremque quis eveniet.
|
|
70
|
+
</p>
|
|
71
|
+
<p>
|
|
72
|
+
Adipisci nulla quos magnam blanditiis minima nesciunt odio mollitia, fuga ullam aliquid
|
|
73
|
+
qui iure delectus dolores corporis officiis autem iste quia at ea sint tempore,
|
|
74
|
+
repudiandae amet? Error, praesentium eaque.
|
|
75
|
+
</p>
|
|
19
76
|
</div>
|
|
20
|
-
|
|
21
|
-
|
|
77
|
+
),
|
|
78
|
+
},
|
|
22
79
|
};
|