reshaped 3.3.11 → 3.3.13
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/CHANGELOG.md +12 -0
- package/dist/bundle.css +1 -1
- package/dist/bundle.d.ts +1 -1
- package/dist/bundle.js +16 -17
- package/dist/cjs/themes/_generator/utilities/generateColors.d.ts +1 -1
- package/dist/cjs/themes/_generator/utilities/generateColors.js +3 -2
- package/dist/cjs/themes/_generator/utilities/tests/color.test.js +32 -31
- package/dist/cjs/themes/slate/theme.css +1 -1
- package/dist/components/Accordion/tests/Accordion.stories.d.ts +30 -8
- package/dist/components/Accordion/tests/Accordion.stories.js +172 -119
- package/dist/components/ActionBar/tests/ActionBar.stories.d.ts +12 -3
- package/dist/components/ActionBar/tests/ActionBar.stories.js +51 -36
- package/dist/components/ActionBar/tests/ActionBar.test.stories.d.ts +15 -0
- package/dist/components/ActionBar/tests/ActionBar.test.stories.js +26 -0
- package/dist/components/Actionable/Actionable.js +1 -1
- package/dist/components/Actionable/tests/Actionable.stories.d.ts +19 -5
- package/dist/components/Actionable/tests/Actionable.stories.js +88 -63
- package/dist/components/Actionable/tests/Actionable.test.stories.d.ts +32 -0
- package/dist/components/Actionable/tests/Actionable.test.stories.js +130 -0
- package/dist/components/Alert/Alert.js +1 -1
- package/dist/components/Alert/tests/Alert.stories.d.ts +12 -3
- package/dist/components/Alert/tests/Alert.stories.js +51 -86
- package/dist/components/Alert/tests/Alert.test.stories.d.ts +15 -0
- package/dist/components/Alert/tests/Alert.test.stories.js +26 -0
- package/dist/components/Autocomplete/Autocomplete.js +9 -2
- package/dist/components/Autocomplete/tests/Autocomplete.stories.d.ts +6 -2
- package/dist/components/Autocomplete/tests/Autocomplete.stories.js +94 -111
- package/dist/components/Autocomplete/tests/Autocomplete.test.stories.d.ts +23 -0
- package/dist/components/Autocomplete/tests/Autocomplete.test.stories.js +86 -0
- package/dist/components/Avatar/Avatar.js +1 -1
- package/dist/components/Avatar/tests/Avatar.stories.d.ts +14 -4
- package/dist/components/Avatar/tests/Avatar.stories.js +94 -80
- package/dist/components/Avatar/tests/Avatar.test.stories.d.ts +17 -0
- package/dist/components/Avatar/tests/Avatar.test.stories.js +39 -0
- package/dist/components/Badge/tests/Badge.stories.d.ts +33 -8
- package/dist/components/Badge/tests/Badge.stories.js +238 -212
- package/dist/components/Badge/tests/Badge.test.stories.d.ts +20 -0
- package/dist/components/Badge/tests/Badge.test.stories.js +44 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js +2 -2
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +1 -0
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.d.ts +24 -5
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.js +114 -95
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.test.stories.d.ts +23 -0
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.test.stories.js +76 -0
- package/dist/components/Button/Button.js +5 -2
- package/dist/components/Button/Button.module.css +1 -1
- package/dist/components/Button/Button.types.d.ts +1 -0
- package/dist/components/Button/tests/Button.stories.d.ts +2 -2
- package/dist/components/Button/tests/Button.stories.js +77 -74
- package/dist/components/Button/tests/Button.test.stories.d.ts +27 -0
- package/dist/components/Button/tests/Button.test.stories.js +112 -0
- package/dist/components/Calendar/tests/Calendar.test.stories.d.ts +26 -0
- package/dist/components/Calendar/tests/Calendar.test.stories.js +161 -0
- package/dist/components/Card/tests/Card.stories.d.ts +0 -1
- package/dist/components/Card/tests/Card.stories.js +0 -11
- package/dist/components/Card/tests/Card.test.stories.d.ts +35 -0
- package/dist/components/Card/tests/Card.test.stories.js +54 -0
- package/dist/components/Carousel/Carousel.js +52 -4
- package/dist/components/Carousel/Carousel.types.d.ts +4 -0
- package/dist/components/Carousel/CarouselControl.js +1 -1
- package/dist/components/Carousel/tests/Carousel.stories.d.ts +23 -4
- package/dist/components/Carousel/tests/Carousel.stories.js +199 -102
- package/dist/components/Checkbox/tests/Checkbox.test.stories.d.ts +25 -0
- package/dist/components/Checkbox/tests/Checkbox.test.stories.js +104 -0
- package/dist/components/CheckboxGroup/tests/CheckboxGroup.test.stories.d.ts +22 -0
- package/dist/components/CheckboxGroup/tests/CheckboxGroup.test.stories.js +78 -0
- package/dist/components/Container/tests/Container.stories.d.ts +12 -3
- package/dist/components/Container/tests/Container.stories.js +50 -31
- package/dist/components/Container/tests/Container.test.stories.d.ts +15 -0
- package/dist/components/Container/tests/Container.test.stories.js +26 -0
- package/dist/components/ContextMenu/ContextMenu.js +13 -9
- package/dist/components/ContextMenu/tests/ContextMenu.stories.js +2 -3
- package/dist/components/ContextMenu/tests/ContextMenu.test.stories.d.ts +26 -0
- package/dist/components/ContextMenu/tests/ContextMenu.test.stories.js +53 -0
- package/dist/components/Dismissible/Dismissible.js +1 -1
- package/dist/components/Dismissible/tests/Dismissible.stories.d.ts +10 -3
- package/dist/components/Dismissible/tests/Dismissible.stories.js +51 -34
- package/dist/components/Dismissible/tests/Dismissible.test.stories.d.ts +19 -0
- package/dist/components/Dismissible/tests/Dismissible.test.stories.js +42 -0
- package/dist/components/Divider/tests/Divider.test.stories.d.ts +18 -0
- package/dist/components/Divider/tests/Divider.test.stories.js +47 -0
- package/dist/components/DropdownMenu/tests/DropdownMenu.test.stories.d.ts +37 -0
- package/dist/components/DropdownMenu/tests/DropdownMenu.test.stories.js +117 -0
- package/dist/components/FileUpload/tests/FileUpload.test.stories.d.ts +22 -0
- package/dist/components/FileUpload/tests/FileUpload.test.stories.js +52 -0
- package/dist/components/FormControl/FormControlCaption.js +1 -1
- package/dist/components/FormControl/FormControlLabel.js +1 -1
- package/dist/components/FormControl/tests/FormControl.stories.d.ts +11 -5
- package/dist/components/FormControl/tests/FormControl.stories.js +78 -73
- package/dist/components/FormControl/tests/FormControl.test.stories.d.ts +20 -0
- package/dist/components/FormControl/tests/FormControl.test.stories.js +49 -0
- package/dist/components/Grid/tests/Grid.stories.d.ts +20 -5
- package/dist/components/Grid/tests/Grid.stories.js +164 -149
- package/dist/components/Grid/tests/Grid.test.stories.d.ts +19 -0
- package/dist/components/Grid/tests/Grid.test.stories.js +42 -0
- package/dist/components/Hidden/tests/Hidden.stories.d.ts +4 -1
- package/dist/components/Hidden/tests/Hidden.stories.js +28 -25
- package/dist/components/Hidden/tests/Hidden.test.stories.d.ts +15 -0
- package/dist/components/Hidden/tests/Hidden.test.stories.js +20 -0
- package/dist/components/HiddenVisually/tests/HiddenVisually.stories.d.ts +4 -1
- package/dist/components/HiddenVisually/tests/HiddenVisually.stories.js +8 -5
- package/dist/components/HiddenVisually/tests/HiddenVisually.test.stories.d.ts +15 -0
- package/dist/components/HiddenVisually/tests/HiddenVisually.test.stories.js +20 -0
- package/dist/components/Hotkey/tests/Hotkey.test.stories.d.ts +15 -0
- package/dist/components/Hotkey/tests/Hotkey.test.stories.js +26 -0
- package/dist/components/Icon/tests/Icon.stories.d.ts +12 -3
- package/dist/components/Icon/tests/Icon.stories.js +69 -60
- package/dist/components/Icon/tests/Icon.test.stories.d.ts +16 -0
- package/dist/components/Icon/tests/Icon.test.stories.js +35 -0
- package/dist/components/Image/tests/Image.stories.d.ts +24 -5
- package/dist/components/Image/tests/Image.stories.js +95 -75
- package/dist/components/Image/tests/Image.test.stories.d.ts +25 -0
- package/dist/components/Image/tests/Image.test.stories.js +80 -0
- package/dist/components/Link/tests/Link.test.stories.d.ts +29 -0
- package/dist/components/Link/tests/Link.test.stories.js +87 -0
- package/dist/components/Loader/Loader.js +1 -1
- package/dist/components/Loader/Loader.types.d.ts +1 -0
- package/dist/components/Loader/tests/Loader.stories.js +8 -8
- package/dist/components/Loader/tests/Loader.test.stories.d.ts +16 -0
- package/dist/components/Loader/tests/Loader.test.stories.js +32 -0
- package/dist/components/MenuItem/tests/MenuItem.test.stories.d.ts +26 -0
- package/dist/components/MenuItem/tests/MenuItem.test.stories.js +100 -0
- package/dist/components/Modal/tests/Modal.test.stories.d.ts +32 -0
- package/dist/components/Modal/tests/Modal.test.stories.js +149 -0
- package/dist/components/Overlay/tests/Overlay.stories.d.ts +4 -2
- package/dist/components/Overlay/tests/Overlay.stories.js +53 -53
- package/dist/components/Overlay/tests/Overlay.test.stories.d.ts +28 -0
- package/dist/components/Overlay/tests/Overlay.test.stories.js +146 -0
- package/dist/components/Pagination/tests/Pagination.test.stories.d.ts +23 -0
- package/dist/components/Pagination/tests/Pagination.test.stories.js +86 -0
- package/dist/components/PinField/tests/PinField.stories.d.ts +0 -1
- package/dist/components/PinField/tests/PinField.stories.js +10 -19
- package/dist/components/PinField/tests/PinField.test.stories.d.ts +29 -0
- package/dist/components/PinField/tests/PinField.test.stories.js +177 -0
- package/dist/components/Popover/tests/Popover.test.stories.d.ts +40 -0
- package/dist/components/Popover/tests/Popover.test.stories.js +167 -0
- package/dist/components/Progress/Progress.js +2 -2
- package/dist/components/Progress/Progress.types.d.ts +1 -0
- package/dist/components/Progress/tests/Progress.stories.js +10 -10
- package/dist/components/Progress/tests/Progress.test.stories.d.ts +16 -0
- package/dist/components/Progress/tests/Progress.test.stories.js +35 -0
- package/dist/components/Radio/tests/Radio.test.stories.d.ts +30 -0
- package/dist/components/Radio/tests/Radio.test.stories.js +118 -0
- package/dist/components/RadioGroup/tests/RadioGroup.test.stories.d.ts +22 -0
- package/dist/components/RadioGroup/tests/RadioGroup.test.stories.js +78 -0
- package/dist/components/Reshaped/tests/Reshaped.stories.d.ts +33 -0
- package/dist/components/Reshaped/tests/Reshaped.stories.js +88 -0
- package/dist/components/Resizable/Resizable.js +1 -0
- package/dist/components/Resizable/tests/Resizable.stories.d.ts +3 -0
- package/dist/components/Resizable/tests/Resizable.stories.js +4 -0
- package/dist/components/Resizable/tests/Resizable.test.stories.d.ts +19 -0
- package/dist/components/Resizable/tests/Resizable.test.stories.js +25 -0
- package/dist/components/Scrim/tests/Scrim.test.stories.d.ts +15 -0
- package/dist/components/Scrim/tests/Scrim.test.stories.js +25 -0
- package/dist/components/ScrollArea/ScrollArea.js +1 -1
- package/dist/components/ScrollArea/ScrollArea.module.css +1 -1
- package/dist/components/ScrollArea/tests/ScrollArea.stories.d.ts +17 -4
- package/dist/components/ScrollArea/tests/ScrollArea.stories.js +114 -139
- package/dist/components/ScrollArea/tests/ScrollArea.test.stories.d.ts +23 -0
- package/dist/components/ScrollArea/tests/ScrollArea.test.stories.js +66 -0
- package/dist/components/Select/tests/Select.stories.d.ts +1 -1
- package/dist/components/Select/tests/Select.stories.js +5 -12
- package/dist/components/Select/tests/Select.test.stories.d.ts +27 -0
- package/dist/components/Select/tests/Select.test.stories.js +132 -0
- package/dist/components/Skeleton/tests/Skeleton.test.stories.d.ts +15 -0
- package/dist/components/Skeleton/tests/Skeleton.test.stories.js +23 -0
- package/dist/components/Slider/tests/Slider.stories.d.ts +0 -1
- package/dist/components/Slider/tests/Slider.stories.js +8 -9
- package/dist/components/Slider/tests/Slider.test.stories.d.ts +38 -0
- package/dist/components/Slider/tests/Slider.test.stories.js +150 -0
- package/dist/components/Stepper/Stepper.js +1 -1
- package/dist/components/Stepper/tests/Stepper.stories.js +0 -3
- package/dist/components/Stepper/tests/Stepper.test.stories.d.ts +18 -0
- package/dist/components/Stepper/tests/Stepper.test.stories.js +28 -0
- package/dist/components/Switch/tests/Switch.test.stories.d.ts +23 -0
- package/dist/components/Switch/tests/Switch.test.stories.js +79 -0
- package/dist/components/Table/index.d.ts +1 -1
- package/dist/components/Table/tests/Table.stories.d.ts +5 -5
- package/dist/components/Table/tests/Table.test.stories.d.ts +25 -0
- package/dist/components/Table/tests/Table.test.stories.js +93 -0
- package/dist/components/Tabs/tests/Tabs.stories.js +4 -4
- package/dist/components/Tabs/tests/Tabs.test.stories.d.ts +28 -0
- package/dist/components/Tabs/tests/Tabs.test.stories.js +128 -0
- package/dist/components/Text/tests/Text.stories.d.ts +28 -7
- package/dist/components/Text/tests/Text.stories.js +148 -125
- package/dist/components/Text/tests/Text.test.stories.d.ts +18 -0
- package/dist/components/Text/tests/Text.test.stories.js +49 -0
- package/dist/components/TextArea/TextArea.module.css +1 -1
- package/dist/components/TextArea/tests/TextArea.stories.js +1 -1
- package/dist/components/TextArea/tests/TextArea.test.stories.d.ts +29 -0
- package/dist/components/TextArea/tests/TextArea.test.stories.js +99 -0
- package/dist/components/TextField/tests/TextField.stories.js +1 -1
- package/dist/components/TextField/tests/TextField.test.stories.d.ts +29 -0
- package/dist/components/TextField/tests/TextField.test.stories.js +99 -0
- package/dist/components/Theme/tests/Theme.test.stories.d.ts +24 -0
- package/dist/components/Theme/tests/Theme.test.stories.js +133 -0
- package/dist/components/Timeline/tests/Timeline.test.stories.d.ts +18 -0
- package/dist/components/Timeline/tests/Timeline.test.stories.js +32 -0
- package/dist/components/Toast/tests/Toast.test.stories.d.ts +16 -0
- package/dist/components/Toast/tests/Toast.test.stories.js +101 -0
- package/dist/components/Tooltip/tests/Tooltip.stories.js +0 -14
- package/dist/components/Tooltip/tests/Tooltip.test.stories.d.ts +19 -0
- package/dist/components/Tooltip/tests/Tooltip.test.stories.js +40 -0
- package/dist/components/View/View.js +1 -2
- package/dist/components/View/tests/View.stories.d.ts +112 -28
- package/dist/components/View/tests/View.stories.js +1092 -1012
- package/dist/components/View/tests/View.test.stories.d.ts +20 -0
- package/dist/components/View/tests/View.test.stories.js +50 -0
- package/dist/components/_private/Flyout/FlyoutContent.js +1 -1
- package/dist/components/_private/Flyout/tests/Flyout.stories.js +4 -4
- package/dist/components/_private/Flyout/tests/Flyout.test.stories.d.ts +28 -0
- package/dist/components/_private/Flyout/tests/Flyout.test.stories.js +205 -0
- package/dist/components/_private/Portal/tests/Portal.stories.js +1 -1
- package/dist/hooks/_private/useSingletonHotkeys.d.ts +3 -3
- package/dist/hooks/_private/useSingletonHotkeys.js +1 -1
- package/dist/hooks/tests/useDrag.stories.js +1 -0
- package/dist/hooks/tests/useDrag.test.stories.d.ts +26 -0
- package/dist/hooks/tests/useDrag.test.stories.js +120 -0
- package/dist/hooks/tests/useElementId.stories.d.ts +6 -0
- package/dist/hooks/tests/useElementId.stories.js +19 -0
- package/dist/hooks/tests/useHotkeys.test.stories.d.ts +39 -0
- package/dist/hooks/tests/useHotkeys.test.stories.js +119 -0
- package/dist/hooks/tests/useRTL.stories.d.ts +6 -0
- package/dist/hooks/tests/useRTL.stories.js +25 -0
- package/dist/hooks/tests/useResponsiveClientValue.stories.d.ts +9 -1
- package/dist/hooks/tests/useResponsiveClientValue.stories.js +22 -9
- package/dist/hooks/tests/useScrollLock.stories.d.ts +6 -0
- package/dist/hooks/tests/useScrollLock.stories.js +22 -0
- package/dist/hooks/tests/useToggle.stories.d.ts +8 -0
- package/dist/hooks/tests/useToggle.stories.js +54 -0
- package/dist/hooks/useHotkeys.js +0 -2
- package/dist/hooks/useScrollLock.d.ts +1 -0
- package/dist/hooks/useScrollLock.js +7 -3
- package/dist/index.d.ts +1 -1
- package/dist/tests/ShadowDOM.stories.js +1 -1
- package/dist/themes/_generator/tests/themes.stories.d.ts +3 -0
- package/dist/themes/_generator/tests/themes.stories.js +7 -11
- package/dist/themes/_generator/utilities/generateColors.d.ts +1 -1
- package/dist/themes/_generator/utilities/generateColors.js +3 -2
- package/dist/themes/slate/theme.css +1 -1
- package/dist/utilities/helpers.d.ts +1 -0
- package/dist/utilities/helpers.js +3 -0
- package/dist/utilities/scroll/lock.d.ts +1 -0
- package/dist/utilities/scroll/lock.js +3 -3
- package/dist/utilities/scroll/lockSafari.d.ts +1 -1
- package/dist/utilities/scroll/lockSafari.js +4 -5
- package/dist/utilities/scroll/lockStandard.d.ts +4 -1
- package/dist/utilities/scroll/lockStandard.js +7 -2
- package/dist/utilities/storybook/Example.js +1 -2
- package/package.json +42 -41
- package/dist/components/Theme/tests/Theme.stories.d.ts +0 -13
- package/dist/components/Theme/tests/Theme.stories.js +0 -80
- package/dist/utilities/storybook/Example.module.css +0 -1
@@ -0,0 +1,49 @@
|
|
1
|
+
import { expect } from "@storybook/test";
|
2
|
+
import Text from "../index.js";
|
3
|
+
export default {
|
4
|
+
title: "Utilities/Text/tests",
|
5
|
+
component: Text,
|
6
|
+
parameters: {
|
7
|
+
iframe: {
|
8
|
+
url: "https://reshaped.so/docs/utilities/text",
|
9
|
+
},
|
10
|
+
chromatic: { disableSnapshot: true },
|
11
|
+
},
|
12
|
+
};
|
13
|
+
export const asProp = {
|
14
|
+
name: "as",
|
15
|
+
render: () => <Text as="h1">Content</Text>,
|
16
|
+
play: async ({ canvas }) => {
|
17
|
+
const el = canvas.getByRole("heading");
|
18
|
+
expect(el).toBeInTheDocument();
|
19
|
+
},
|
20
|
+
};
|
21
|
+
export const headingAs = {
|
22
|
+
name: "heading tag resolving",
|
23
|
+
render: () => <Text variant="title-3">Content</Text>,
|
24
|
+
play: async ({ canvas }) => {
|
25
|
+
const el = canvas.getByRole("heading");
|
26
|
+
expect(el.tagName).toBe("H3");
|
27
|
+
},
|
28
|
+
};
|
29
|
+
export const headingAsResponsive = {
|
30
|
+
name: "heading tag resolving, responsive",
|
31
|
+
render: () => <Text variant={{ s: "title-3", m: "title-4" }}>Content</Text>,
|
32
|
+
play: async ({ canvas }) => {
|
33
|
+
const el = canvas.getByRole("heading");
|
34
|
+
expect(el.tagName).toBe("H4");
|
35
|
+
},
|
36
|
+
};
|
37
|
+
export const className = {
|
38
|
+
name: "className, attributes",
|
39
|
+
render: () => (<div data-testid="root">
|
40
|
+
<Text className="test-classname" attributes={{ id: "test-id" }}>
|
41
|
+
Content
|
42
|
+
</Text>
|
43
|
+
</div>),
|
44
|
+
play: async ({ canvas }) => {
|
45
|
+
const root = canvas.getByTestId("root").firstChild;
|
46
|
+
expect(root).toHaveClass("test-classname");
|
47
|
+
expect(root).toHaveAttribute("id", "test-id");
|
48
|
+
},
|
49
|
+
};
|
@@ -1 +1 @@
|
|
1
|
-
.root{display:grid;position:relative}.root:after{content:attr(data-rs-textarea-value) " ";visibility:hidden;white-space:pre-wrap}.input,.root:after{border:1px solid var(--rs-color-border-neutral);box-sizing:border-box;flex-grow:1;font-family:var(--rs-font-family-body);font-weight:var(--rs-font-weight-regular);grid-area:1/1/2/2;padding:calc(var(--rs-p) - 1px);width:100%;word-break:break-
|
1
|
+
.root{display:grid;position:relative}.root:after{content:attr(data-rs-textarea-value) " ";visibility:hidden;white-space:pre-wrap}.input,.root:after{border:1px solid var(--rs-color-border-neutral);box-sizing:border-box;flex-grow:1;font-family:var(--rs-font-family-body);font-weight:var(--rs-font-weight-regular);grid-area:1/1/2/2;padding:calc(var(--rs-p) - 1px);width:100%;word-break:break-all}.input{background:var(--rs-color-background-elevation-base);border-radius:var(--rs-radius-small);color:var(--rs-color-foreground-neutral);outline:none;position:relative;z-index:1}.input:focus{border-color:var(--rs-color-border-primary);box-shadow:0 0 0 1px var(--rs-color-border-primary)}.input[disabled]{background:var(--rs-color-background-disabled-faded);border-color:var(--rs-color-border-disabled);color:var(--rs-color-foreground-disabled);cursor:not-allowed}.--size-medium{--rs-p:var(--rs-unit-x2);border-radius:var(--rs-radius-small)}.--size-medium .input{font-size:var(--rs-font-size-body-3);letter-spacing:var(--rs-letter-spacing-body-3);line-height:var(--rs-line-height-body-3)}.--size-large{--rs-p:var(--rs-unit-x3);border-radius:var(--rs-radius-medium)}.--size-large .input{font-size:var(--rs-font-size-body-2);letter-spacing:var(--rs-letter-spacing-body-2);line-height:var(--rs-line-height-body-2)}.--size-xlarge{--rs-p:var(--rs-unit-x4);border-radius:var(--rs-radius-medium)}.--size-xlarge .input{font-size:var(--rs-font-size-body-2);letter-spacing:var(--rs-letter-spacing-body-2);line-height:var(--rs-line-height-body-2)}.root.--variant-faded .input{background:var(--rs-color-background-neutral-faded);border-color:transparent}.root.--variant-faded .input:focus{border-color:var(--rs-color-border-primary)}.root.--variant-headless .input{background:transparent;border-color:transparent}.root.--variant-headless .input:focus,.root.--variant-headless.--status-error .input,.root.--variant-headless.--status-error .input:focus{border-color:transparent;box-shadow:none}.root.--status-error .input{border-color:var(--rs-color-border-critical)}.root.--status-error .input:active,.root.--status-error .input:focus{border-color:var(--rs-color-border-primary);box-shadow:0 0 0 1px var(--rs-color-border-primary)}.root.--resize-auto .input,.root.--resize-none .input{resize:none}@media (--rs-viewport-s ) and (hover:none){.input{font-size:var(--rs-font-size-body-2)!important}}@media (--rs-viewport-m ){.--size-medium--m{--rs-p:var(--rs-unit-x2);border-radius:var(--rs-radius-small)}.--size-medium--m .input{font-size:var(--rs-font-size-body-3);letter-spacing:var(--rs-letter-spacing-body-3);line-height:var(--rs-line-height-body-3)}.--size-large--m{--rs-p:var(--rs-unit-x3);border-radius:var(--rs-radius-medium)}.--size-large--m .input{font-size:var(--rs-font-size-body-2);letter-spacing:var(--rs-letter-spacing-body-2);line-height:var(--rs-line-height-body-2)}.--size-xlarge--m{--rs-p:var(--rs-unit-x4);border-radius:var(--rs-radius-medium)}.--size-xlarge--m .input{font-size:var(--rs-font-size-body-2);letter-spacing:var(--rs-letter-spacing-body-2);line-height:var(--rs-line-height-body-2)}}@media (--rs-viewport-l ){.--size-medium--l{--rs-p:var(--rs-unit-x2);border-radius:var(--rs-radius-small)}.--size-medium--l .input{font-size:var(--rs-font-size-body-3);letter-spacing:var(--rs-letter-spacing-body-3);line-height:var(--rs-line-height-body-3)}.--size-large--l{--rs-p:var(--rs-unit-x3);border-radius:var(--rs-radius-medium)}.--size-large--l .input{font-size:var(--rs-font-size-body-2);letter-spacing:var(--rs-letter-spacing-body-2);line-height:var(--rs-line-height-body-2)}.--size-xlarge--l{--rs-p:var(--rs-unit-x4);border-radius:var(--rs-radius-medium)}.--size-xlarge--l .input{font-size:var(--rs-font-size-body-2);letter-spacing:var(--rs-letter-spacing-body-2);line-height:var(--rs-line-height-body-2)}}@media (--rs-viewport-xl ){.--size-medium--xl{--rs-p:var(--rs-unit-x2);border-radius:var(--rs-radius-small)}.--size-medium--xl .input{font-size:var(--rs-font-size-body-3);letter-spacing:var(--rs-letter-spacing-body-3);line-height:var(--rs-line-height-body-3)}.--size-large--xl{--rs-p:var(--rs-unit-x3);border-radius:var(--rs-radius-medium)}.--size-large--xl .input{font-size:var(--rs-font-size-body-2);letter-spacing:var(--rs-letter-spacing-body-2);line-height:var(--rs-line-height-body-2)}.--size-xlarge--xl{--rs-p:var(--rs-unit-x4);border-radius:var(--rs-radius-medium)}.--size-xlarge--xl .input{font-size:var(--rs-font-size-body-2);letter-spacing:var(--rs-letter-spacing-body-2);line-height:var(--rs-line-height-body-2)}}
|
@@ -109,6 +109,6 @@ export const edgeCases = () => (<Example>
|
|
109
109
|
<Example.Item title="long value without breaks">
|
110
110
|
<TextArea name="hey" defaultValue={`<div style="position:relative;width:100%;padding-top:calc(150% + 72px)">
|
111
111
|
<iframe src="nskjdfdsdkjfsjkdfhbsjlhdfbsjlhfbs;jhbsdljfhsbljhfsbljhfbsjlfdhbsljhfbsdljhfbsljhfbslufbhsdlfds" />
|
112
|
-
</div>`} resize="auto"/>
|
112
|
+
</div>`} resize="auto" placeholder="Placeholder"/>
|
113
113
|
</Example.Item>
|
114
114
|
</Example>);
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { StoryObj } from "@storybook/react";
|
2
|
+
import { fn } from "@storybook/test";
|
3
|
+
declare const _default: {
|
4
|
+
title: string;
|
5
|
+
component: {
|
6
|
+
(props: import("./..").TextAreaProps): import("react").JSX.Element;
|
7
|
+
Aligner: (props: import("../../_private/Aligner").AlignerProps) => import("react").JSX.Element;
|
8
|
+
};
|
9
|
+
parameters: {
|
10
|
+
iframe: {
|
11
|
+
url: string;
|
12
|
+
};
|
13
|
+
chromatic: {
|
14
|
+
disableSnapshot: boolean;
|
15
|
+
};
|
16
|
+
};
|
17
|
+
};
|
18
|
+
export default _default;
|
19
|
+
export declare const render: StoryObj;
|
20
|
+
export declare const placeholder: StoryObj;
|
21
|
+
export declare const id: StoryObj;
|
22
|
+
export declare const disabled: StoryObj;
|
23
|
+
export declare const defaultValue: StoryObj<{
|
24
|
+
handleChange: ReturnType<typeof fn>;
|
25
|
+
}>;
|
26
|
+
export declare const value: StoryObj<{
|
27
|
+
handleChange: ReturnType<typeof fn>;
|
28
|
+
}>;
|
29
|
+
export declare const className: StoryObj;
|
@@ -0,0 +1,99 @@
|
|
1
|
+
import { expect, fn, userEvent } from "@storybook/test";
|
2
|
+
import TextArea from "../index.js";
|
3
|
+
export default {
|
4
|
+
title: "Components/TextArea/tests",
|
5
|
+
component: TextArea,
|
6
|
+
parameters: {
|
7
|
+
iframe: {
|
8
|
+
url: "https://reshaped.so/docs/components/text-area",
|
9
|
+
},
|
10
|
+
chromatic: { disableSnapshot: true },
|
11
|
+
},
|
12
|
+
};
|
13
|
+
export const render = {
|
14
|
+
name: "base",
|
15
|
+
render: () => <TextArea name="test-name" inputAttributes={{ "aria-label": "Label" }}/>,
|
16
|
+
play: async ({ canvas }) => {
|
17
|
+
const input = canvas.getByRole("textbox");
|
18
|
+
expect(input).toHaveAttribute("name", "test-name");
|
19
|
+
expect(input).toHaveAccessibleName("Label");
|
20
|
+
},
|
21
|
+
};
|
22
|
+
export const placeholder = {
|
23
|
+
name: "placeholder",
|
24
|
+
render: () => (<TextArea name="test-name" placeholder="Placeholder" inputAttributes={{ "aria-label": "Label" }}/>),
|
25
|
+
play: async ({ canvas }) => {
|
26
|
+
const input = canvas.getByRole("textbox");
|
27
|
+
expect(input).toHaveValue("");
|
28
|
+
expect(input).toHaveAttribute("placeholder", "Placeholder");
|
29
|
+
},
|
30
|
+
};
|
31
|
+
export const id = {
|
32
|
+
name: "id",
|
33
|
+
render: () => (<TextArea name="test-name" id="test-id" inputAttributes={{ "aria-label": "Label" }}/>),
|
34
|
+
play: async ({ canvas }) => {
|
35
|
+
const input = canvas.getByRole("textbox");
|
36
|
+
expect(input).toHaveAttribute("id", "test-id");
|
37
|
+
},
|
38
|
+
};
|
39
|
+
export const disabled = {
|
40
|
+
name: "disabled",
|
41
|
+
render: () => <TextArea name="test-name" disabled inputAttributes={{ "aria-label": "Label" }}/>,
|
42
|
+
play: async ({ canvas }) => {
|
43
|
+
const input = canvas.getByRole("textbox");
|
44
|
+
expect(input).toBeDisabled();
|
45
|
+
},
|
46
|
+
};
|
47
|
+
export const defaultValue = {
|
48
|
+
name: "defaultValue, uncontrolled",
|
49
|
+
args: {
|
50
|
+
handleChange: fn(),
|
51
|
+
},
|
52
|
+
render: (args) => (<TextArea name="test-name" defaultValue="value" onChange={args.handleChange} inputAttributes={{ "aria-label": "Label" }}/>),
|
53
|
+
play: async ({ canvas, args }) => {
|
54
|
+
const input = canvas.getByRole("textbox");
|
55
|
+
expect(input).toHaveValue("value");
|
56
|
+
input.focus();
|
57
|
+
await userEvent.keyboard("2");
|
58
|
+
expect(args.handleChange).toBeCalledTimes(1);
|
59
|
+
expect(args.handleChange).toHaveBeenCalledWith({
|
60
|
+
name: "test-name",
|
61
|
+
value: "2value",
|
62
|
+
event: expect.objectContaining({ target: input }),
|
63
|
+
});
|
64
|
+
expect(input).toHaveValue("2value");
|
65
|
+
},
|
66
|
+
};
|
67
|
+
export const value = {
|
68
|
+
name: "value, controlled",
|
69
|
+
args: {
|
70
|
+
handleChange: fn(),
|
71
|
+
},
|
72
|
+
render: (args) => (<TextArea name="test-name" value="value" onChange={args.handleChange} inputAttributes={{ "aria-label": "Label" }}/>),
|
73
|
+
play: async ({ canvas, args }) => {
|
74
|
+
const input = canvas.getByRole("textbox");
|
75
|
+
expect(input).toHaveValue("value");
|
76
|
+
input.focus();
|
77
|
+
await userEvent.keyboard("2");
|
78
|
+
expect(args.handleChange).toBeCalledTimes(1);
|
79
|
+
expect(args.handleChange).toHaveBeenCalledWith({
|
80
|
+
name: "test-name",
|
81
|
+
value: "2value",
|
82
|
+
event: expect.objectContaining({ target: input }),
|
83
|
+
});
|
84
|
+
expect(input).toHaveValue("value");
|
85
|
+
},
|
86
|
+
};
|
87
|
+
export const className = {
|
88
|
+
name: "className, attributes",
|
89
|
+
render: () => (<div data-testid="root">
|
90
|
+
<TextArea className="test-classname" attributes={{ id: "test-id" }} name="name" inputAttributes={{ id: "test-input-id", "aria-label": "Label" }}/>
|
91
|
+
</div>),
|
92
|
+
play: async ({ canvas }) => {
|
93
|
+
const root = canvas.getByTestId("root").firstChild;
|
94
|
+
const input = canvas.getByRole("textbox");
|
95
|
+
expect(root).toHaveClass("test-classname");
|
96
|
+
expect(root).toHaveAttribute("id", "test-id");
|
97
|
+
expect(input).toHaveAttribute("id", "test-input-id");
|
98
|
+
},
|
99
|
+
};
|
@@ -113,7 +113,7 @@ export const slots = () => (<Example>
|
|
113
113
|
<TextField name="Name" placeholder="Enter your name" value="Reshaped" startSlot={<Placeholder h={20}/>}/>
|
114
114
|
</Example.Item>
|
115
115
|
<Example.Item title={["endSlot", "vertical and horizontal padding aligned"]}>
|
116
|
-
<TextField name="Name" placeholder="Enter your name" value="Reshaped" endSlot={<Button icon={IconZap} size="small" onClick={() => { }}/>}/>
|
116
|
+
<TextField name="Name" placeholder="Enter your name" value="Reshaped" endSlot={<Button icon={IconZap} size="small" onClick={() => { }} attributes={{ "aria-label": "Action" }}/>}/>
|
117
117
|
</Example.Item>
|
118
118
|
<Example.Item title="multiline wrap">
|
119
119
|
<TextField name="Name" placeholder="Enter your name" value="Reshaped" startSlot={[...Array(10).keys()].map((i) => (<Badge key={i}>Item {i + 1}</Badge>))} multiline/>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { StoryObj } from "@storybook/react";
|
2
|
+
import { fn } from "@storybook/test";
|
3
|
+
declare const _default: {
|
4
|
+
title: string;
|
5
|
+
component: {
|
6
|
+
(props: import("./..").TextFieldProps): import("react").JSX.Element;
|
7
|
+
Aligner: (props: import("../../_private/Aligner").AlignerProps) => import("react").JSX.Element;
|
8
|
+
};
|
9
|
+
parameters: {
|
10
|
+
iframe: {
|
11
|
+
url: string;
|
12
|
+
};
|
13
|
+
chromatic: {
|
14
|
+
disableSnapshot: boolean;
|
15
|
+
};
|
16
|
+
};
|
17
|
+
};
|
18
|
+
export default _default;
|
19
|
+
export declare const render: StoryObj;
|
20
|
+
export declare const placeholder: StoryObj;
|
21
|
+
export declare const id: StoryObj;
|
22
|
+
export declare const disabled: StoryObj;
|
23
|
+
export declare const defaultValue: StoryObj<{
|
24
|
+
handleChange: ReturnType<typeof fn>;
|
25
|
+
}>;
|
26
|
+
export declare const value: StoryObj<{
|
27
|
+
handleChange: ReturnType<typeof fn>;
|
28
|
+
}>;
|
29
|
+
export declare const className: StoryObj;
|
@@ -0,0 +1,99 @@
|
|
1
|
+
import { expect, fn, userEvent } from "@storybook/test";
|
2
|
+
import TextField from "../index.js";
|
3
|
+
export default {
|
4
|
+
title: "Components/TextField/tests",
|
5
|
+
component: TextField,
|
6
|
+
parameters: {
|
7
|
+
iframe: {
|
8
|
+
url: "https://reshaped.so/docs/components/text-area",
|
9
|
+
},
|
10
|
+
chromatic: { disableSnapshot: true },
|
11
|
+
},
|
12
|
+
};
|
13
|
+
export const render = {
|
14
|
+
name: "base",
|
15
|
+
render: () => <TextField name="test-name" inputAttributes={{ "aria-label": "Label" }}/>,
|
16
|
+
play: async ({ canvas }) => {
|
17
|
+
const input = canvas.getByRole("textbox");
|
18
|
+
expect(input).toHaveAttribute("name", "test-name");
|
19
|
+
expect(input).toHaveAccessibleName("Label");
|
20
|
+
},
|
21
|
+
};
|
22
|
+
export const placeholder = {
|
23
|
+
name: "placeholder",
|
24
|
+
render: () => (<TextField name="test-name" placeholder="Placeholder" inputAttributes={{ "aria-label": "Label" }}/>),
|
25
|
+
play: async ({ canvas }) => {
|
26
|
+
const input = canvas.getByRole("textbox");
|
27
|
+
expect(input).toHaveValue("");
|
28
|
+
expect(input).toHaveAttribute("placeholder", "Placeholder");
|
29
|
+
},
|
30
|
+
};
|
31
|
+
export const id = {
|
32
|
+
name: "id",
|
33
|
+
render: () => (<TextField name="test-name" id="test-id" inputAttributes={{ "aria-label": "Label" }}/>),
|
34
|
+
play: async ({ canvas }) => {
|
35
|
+
const input = canvas.getByRole("textbox");
|
36
|
+
expect(input).toHaveAttribute("id", "test-id");
|
37
|
+
},
|
38
|
+
};
|
39
|
+
export const disabled = {
|
40
|
+
name: "disabled",
|
41
|
+
render: () => <TextField name="test-name" disabled inputAttributes={{ "aria-label": "Label" }}/>,
|
42
|
+
play: async ({ canvas }) => {
|
43
|
+
const input = canvas.getByRole("textbox");
|
44
|
+
expect(input).toBeDisabled();
|
45
|
+
},
|
46
|
+
};
|
47
|
+
export const defaultValue = {
|
48
|
+
name: "defaultValue, uncontrolled",
|
49
|
+
args: {
|
50
|
+
handleChange: fn(),
|
51
|
+
},
|
52
|
+
render: (args) => (<TextField name="test-name" defaultValue="value" onChange={args.handleChange} inputAttributes={{ "aria-label": "Label" }}/>),
|
53
|
+
play: async ({ canvas, args }) => {
|
54
|
+
const input = canvas.getByRole("textbox");
|
55
|
+
expect(input).toHaveValue("value");
|
56
|
+
input.focus();
|
57
|
+
await userEvent.keyboard("2");
|
58
|
+
expect(args.handleChange).toBeCalledTimes(1);
|
59
|
+
expect(args.handleChange).toHaveBeenCalledWith({
|
60
|
+
name: "test-name",
|
61
|
+
value: "value2",
|
62
|
+
event: expect.objectContaining({ target: input }),
|
63
|
+
});
|
64
|
+
expect(input).toHaveValue("value2");
|
65
|
+
},
|
66
|
+
};
|
67
|
+
export const value = {
|
68
|
+
name: "value, controlled",
|
69
|
+
args: {
|
70
|
+
handleChange: fn(),
|
71
|
+
},
|
72
|
+
render: (args) => (<TextField name="test-name" value="value" onChange={args.handleChange} inputAttributes={{ "aria-label": "Label" }}/>),
|
73
|
+
play: async ({ canvas, args }) => {
|
74
|
+
const input = canvas.getByRole("textbox");
|
75
|
+
expect(input).toHaveValue("value");
|
76
|
+
input.focus();
|
77
|
+
await userEvent.keyboard("2");
|
78
|
+
expect(args.handleChange).toBeCalledTimes(1);
|
79
|
+
expect(args.handleChange).toHaveBeenCalledWith({
|
80
|
+
name: "test-name",
|
81
|
+
value: "value2",
|
82
|
+
event: expect.objectContaining({ target: input }),
|
83
|
+
});
|
84
|
+
expect(input).toHaveValue("value");
|
85
|
+
},
|
86
|
+
};
|
87
|
+
export const className = {
|
88
|
+
name: "className, attributes",
|
89
|
+
render: () => (<div data-testid="root">
|
90
|
+
<TextField className="test-classname" attributes={{ id: "test-id" }} name="name" inputAttributes={{ id: "test-input-id", "aria-label": "Label" }}/>
|
91
|
+
</div>),
|
92
|
+
play: async ({ canvas }) => {
|
93
|
+
const root = canvas.getByTestId("root").firstChild;
|
94
|
+
const input = canvas.getByRole("textbox");
|
95
|
+
expect(root).toHaveClass("test-classname");
|
96
|
+
expect(root).toHaveAttribute("id", "test-id");
|
97
|
+
expect(input).toHaveAttribute("id", "test-input-id");
|
98
|
+
},
|
99
|
+
};
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { StoryObj } from "@storybook/react";
|
2
|
+
declare const _default: {
|
3
|
+
title: string;
|
4
|
+
component: (props: import("./..").ThemeProps) => import("react").JSX.Element;
|
5
|
+
parameters: {
|
6
|
+
iframe: {
|
7
|
+
url: string;
|
8
|
+
};
|
9
|
+
chromatic: {
|
10
|
+
disableSnapshot: boolean;
|
11
|
+
};
|
12
|
+
};
|
13
|
+
};
|
14
|
+
export default _default;
|
15
|
+
export declare const light: StoryObj;
|
16
|
+
export declare const dark: StoryObj;
|
17
|
+
export declare const inherited: StoryObj;
|
18
|
+
export declare const inverted: StoryObj;
|
19
|
+
export declare const controlled: StoryObj;
|
20
|
+
export declare const uncontrolled: StoryObj;
|
21
|
+
export declare const disabledTransition: {
|
22
|
+
name: string;
|
23
|
+
render: () => import("react").JSX.Element;
|
24
|
+
};
|
@@ -0,0 +1,133 @@
|
|
1
|
+
import { expect, userEvent } from "@storybook/test";
|
2
|
+
import Card from "../../Card/index.js";
|
3
|
+
import Button from "../../Button/index.js";
|
4
|
+
import View from "../../View/index.js";
|
5
|
+
import MenuItem from "../../MenuItem/index.js";
|
6
|
+
import Theme, { useTheme } from "../index.js";
|
7
|
+
import { Example } from "../../../utilities/storybook/index.js";
|
8
|
+
export default {
|
9
|
+
title: "Utilities/Theme/tests",
|
10
|
+
component: Theme,
|
11
|
+
parameters: {
|
12
|
+
iframe: {
|
13
|
+
url: "https://reshaped.so/docs/utilities/theme",
|
14
|
+
},
|
15
|
+
chromatic: { disableSnapshot: true },
|
16
|
+
},
|
17
|
+
};
|
18
|
+
export const light = {
|
19
|
+
name: "light",
|
20
|
+
render: () => (<Theme name="reshaped" colorMode="light">
|
21
|
+
<Card attributes={{ "data-testid": "test-id" }}>Content</Card>
|
22
|
+
</Theme>),
|
23
|
+
play: ({ canvas }) => {
|
24
|
+
const root = canvas.getByTestId("test-id").parentNode;
|
25
|
+
expect(root).toHaveAttribute("data-rs-theme", "reshaped");
|
26
|
+
expect(root).toHaveAttribute("data-rs-color-mode", "light");
|
27
|
+
},
|
28
|
+
};
|
29
|
+
export const dark = {
|
30
|
+
name: "dark",
|
31
|
+
render: () => (<Theme name="reshaped" colorMode="dark">
|
32
|
+
<Card attributes={{ "data-testid": "test-id" }}>Content</Card>
|
33
|
+
</Theme>),
|
34
|
+
play: ({ canvas }) => {
|
35
|
+
const root = canvas.getByTestId("test-id").parentNode;
|
36
|
+
expect(root).toHaveAttribute("data-rs-theme", "reshaped");
|
37
|
+
expect(root).toHaveAttribute("data-rs-color-mode", "dark");
|
38
|
+
},
|
39
|
+
};
|
40
|
+
export const inherited = {
|
41
|
+
name: "inherited",
|
42
|
+
render: () => (<Theme name="reshaped">
|
43
|
+
<Card attributes={{ "data-testid": "test-id" }}>Content</Card>
|
44
|
+
</Theme>),
|
45
|
+
play: ({ canvas }) => {
|
46
|
+
const root = canvas.getByTestId("test-id").parentNode;
|
47
|
+
expect(root).toHaveAttribute("data-rs-theme", "reshaped");
|
48
|
+
// Our storybook setup uses dark by default
|
49
|
+
expect(root).toHaveAttribute("data-rs-color-mode", "dark");
|
50
|
+
},
|
51
|
+
};
|
52
|
+
export const inverted = {
|
53
|
+
name: "inverted",
|
54
|
+
render: () => (<Theme name="reshaped" colorMode="inverted">
|
55
|
+
<Card attributes={{ "data-testid": "test-id" }}>Content</Card>
|
56
|
+
</Theme>),
|
57
|
+
play: ({ canvas }) => {
|
58
|
+
const root = canvas.getByTestId("test-id").parentNode;
|
59
|
+
expect(root).toHaveAttribute("data-rs-theme", "reshaped");
|
60
|
+
expect(root).toHaveAttribute("data-rs-color-mode", "light");
|
61
|
+
},
|
62
|
+
};
|
63
|
+
export const controlled = {
|
64
|
+
name: "controlled",
|
65
|
+
render: () => {
|
66
|
+
const Internal = () => {
|
67
|
+
const { setTheme, theme } = useTheme();
|
68
|
+
return (<Button color="primary" onClick={() => setTheme("slate")}>
|
69
|
+
Switch to slate
|
70
|
+
</Button>);
|
71
|
+
};
|
72
|
+
return (<div data-testid="root">
|
73
|
+
<Theme name="reshaped">
|
74
|
+
<Internal />
|
75
|
+
</Theme>
|
76
|
+
</div>);
|
77
|
+
},
|
78
|
+
play: async ({ canvas }) => {
|
79
|
+
const root = canvas.getByTestId("root").firstChild;
|
80
|
+
const trigger = canvas.getAllByRole("button")[0];
|
81
|
+
expect(root).toHaveAttribute("data-rs-theme", "reshaped");
|
82
|
+
expect(root).toHaveAttribute("data-rs-color-mode", "dark");
|
83
|
+
await userEvent.click(trigger);
|
84
|
+
expect(root).toHaveAttribute("data-rs-theme", "reshaped");
|
85
|
+
expect(root).toHaveAttribute("data-rs-color-mode", "dark");
|
86
|
+
},
|
87
|
+
};
|
88
|
+
export const uncontrolled = {
|
89
|
+
name: "uncontrolled",
|
90
|
+
render: () => {
|
91
|
+
const Internal = () => {
|
92
|
+
const { setTheme } = useTheme();
|
93
|
+
return (<Button color="primary" onClick={() => setTheme("slate")}>
|
94
|
+
Switch to slate
|
95
|
+
</Button>);
|
96
|
+
};
|
97
|
+
return (<div data-testid="root">
|
98
|
+
<Theme defaultName="reshaped">
|
99
|
+
<Internal />
|
100
|
+
</Theme>
|
101
|
+
</div>);
|
102
|
+
},
|
103
|
+
play: async ({ canvas }) => {
|
104
|
+
const root = canvas.getByTestId("root").firstChild;
|
105
|
+
const trigger = canvas.getAllByRole("button")[0];
|
106
|
+
expect(root).toHaveAttribute("data-rs-theme", "reshaped");
|
107
|
+
expect(root).toHaveAttribute("data-rs-color-mode", "dark");
|
108
|
+
await userEvent.click(trigger);
|
109
|
+
expect(root).toHaveAttribute("data-rs-theme", "slate");
|
110
|
+
expect(root).toHaveAttribute("data-rs-color-mode", "dark");
|
111
|
+
},
|
112
|
+
};
|
113
|
+
export const disabledTransition = {
|
114
|
+
name: "disabled transitions",
|
115
|
+
render: () => {
|
116
|
+
const { invertColorMode } = useTheme();
|
117
|
+
return (<Example>
|
118
|
+
<Example.Item title="should have no transitions while switching color mode">
|
119
|
+
<View gap={3}>
|
120
|
+
<Button onClick={invertColorMode}>Invert mode</Button>
|
121
|
+
|
122
|
+
<MenuItem selected>Test transition</MenuItem>
|
123
|
+
|
124
|
+
<Card>Default card</Card>
|
125
|
+
|
126
|
+
<Theme colorMode="inverted">
|
127
|
+
<Card>Inverted card</Card>
|
128
|
+
</Theme>
|
129
|
+
</View>
|
130
|
+
</Example.Item>
|
131
|
+
</Example>);
|
132
|
+
},
|
133
|
+
};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { StoryObj } from "@storybook/react";
|
2
|
+
declare const _default: {
|
3
|
+
title: string;
|
4
|
+
component: {
|
5
|
+
(props: import("./..").TimelineProps): import("react").JSX.Element;
|
6
|
+
Item: (props: import("./..").TimelineItemProps) => import("react").JSX.Element;
|
7
|
+
};
|
8
|
+
parameters: {
|
9
|
+
iframe: {
|
10
|
+
url: string;
|
11
|
+
};
|
12
|
+
chromatic: {
|
13
|
+
disableSnapshot: boolean;
|
14
|
+
};
|
15
|
+
};
|
16
|
+
};
|
17
|
+
export default _default;
|
18
|
+
export declare const className: StoryObj;
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { expect } from "@storybook/test";
|
2
|
+
import Timeline from "../index.js";
|
3
|
+
export default {
|
4
|
+
title: "Components/Timeline/tests",
|
5
|
+
component: Timeline,
|
6
|
+
parameters: {
|
7
|
+
iframe: {
|
8
|
+
url: "https://reshaped.so/docs/components/timeline",
|
9
|
+
},
|
10
|
+
chromatic: { disableSnapshot: true },
|
11
|
+
},
|
12
|
+
};
|
13
|
+
export const className = {
|
14
|
+
name: "className, attributes",
|
15
|
+
render: () => (<div data-testid="root">
|
16
|
+
<Timeline className="test-classname" attributes={{ id: "test-id" }}>
|
17
|
+
<Timeline.Item className="test-item-classname" attributes={{ id: "test-item-id" }}>
|
18
|
+
Content
|
19
|
+
</Timeline.Item>
|
20
|
+
<Timeline.Item>Content</Timeline.Item>
|
21
|
+
</Timeline>
|
22
|
+
</div>),
|
23
|
+
play: async ({ canvas }) => {
|
24
|
+
const root = canvas.getByTestId("root").firstChild;
|
25
|
+
const items = canvas.getAllByRole("listitem");
|
26
|
+
expect(root).toHaveClass("test-classname");
|
27
|
+
expect(root).toHaveAttribute("id", "test-id");
|
28
|
+
expect(items).toHaveLength(2);
|
29
|
+
expect(items[0]).toHaveClass("test-item-classname");
|
30
|
+
expect(items[0]).toHaveAttribute("id", "test-item-id");
|
31
|
+
},
|
32
|
+
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { StoryObj } from "@storybook/react";
|
2
|
+
declare const _default: {
|
3
|
+
title: string;
|
4
|
+
parameters: {
|
5
|
+
iframe: {
|
6
|
+
url: string;
|
7
|
+
};
|
8
|
+
chromatic: {
|
9
|
+
disableSnapshot: boolean;
|
10
|
+
};
|
11
|
+
};
|
12
|
+
};
|
13
|
+
export default _default;
|
14
|
+
export declare const base: StoryObj;
|
15
|
+
export declare const nested: StoryObj;
|
16
|
+
export declare const className: StoryObj;
|