reshaped 3.8.8 → 3.9.0-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.css +1 -1
- package/dist/bundle.js +11 -11
- package/dist/components/Button/Button.module.css +1 -1
- package/dist/components/Card/Card.d.ts +1 -1
- package/dist/components/Divider/Divider.js +3 -3
- package/dist/components/Divider/Divider.module.css +1 -1
- package/dist/components/Divider/Divider.types.d.ts +6 -0
- package/dist/components/DropdownMenu/DropdownMenu.js +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +1 -1
- package/dist/components/Flyout/Flyout.constants.d.ts +1 -3
- package/dist/components/Flyout/Flyout.constants.js +1 -3
- package/dist/components/Flyout/Flyout.types.d.ts +2 -0
- package/dist/components/Flyout/FlyoutControlled.js +10 -11
- package/dist/components/Flyout/utilities/cooldown.js +1 -2
- package/dist/components/Icon/Icon.module.css +1 -1
- package/dist/components/Popover/Popover.types.d.ts +1 -1
- package/dist/components/Progress/Progress.module.css +1 -1
- package/dist/components/Select/Select.module.css +1 -1
- package/dist/components/Select/Select.types.d.ts +16 -11
- package/dist/components/Select/SelectCustomControlled.js +27 -10
- package/dist/components/Select/SelectGroup.d.ts +4 -0
- package/dist/components/Select/SelectGroup.js +10 -0
- package/dist/components/Select/SelectTrigger.js +1 -1
- package/dist/components/Select/index.d.ts +3 -2
- package/dist/components/Select/index.js +3 -2
- package/dist/components/Tabs/TabsContext.d.ts +1 -1
- package/dist/components/TextArea/TextArea.module.css +1 -1
- package/dist/components/TextArea/TextArea.types.d.ts +1 -1
- package/dist/components/TextField/TextField.module.css +1 -1
- package/dist/components/TextField/TextField.types.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.types.d.ts +1 -1
- package/dist/config/tailwind.d.ts +1 -1
- package/package.json +31 -30
- package/dist/components/Accordion/tests/Accordion.stories.d.ts +0 -44
- package/dist/components/Accordion/tests/Accordion.stories.js +0 -204
- package/dist/components/ActionBar/tests/ActionBar.stories.d.ts +0 -40
- package/dist/components/ActionBar/tests/ActionBar.stories.js +0 -223
- package/dist/components/Actionable/tests/Actionable.stories.d.ts +0 -41
- package/dist/components/Actionable/tests/Actionable.stories.js +0 -220
- package/dist/components/Alert/tests/Alert.stories.d.ts +0 -24
- package/dist/components/Alert/tests/Alert.stories.js +0 -78
- package/dist/components/Autocomplete/tests/Autocomplete.stories.d.ts +0 -32
- package/dist/components/Autocomplete/tests/Autocomplete.stories.js +0 -246
- package/dist/components/Avatar/tests/Avatar.stories.d.ts +0 -31
- package/dist/components/Avatar/tests/Avatar.stories.js +0 -176
- package/dist/components/Badge/tests/Badge.stories.d.ts +0 -55
- package/dist/components/Badge/tests/Badge.stories.js +0 -328
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.d.ts +0 -40
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.js +0 -187
- package/dist/components/Button/tests/Button.stories.d.ts +0 -79
- package/dist/components/Button/tests/Button.stories.js +0 -789
- package/dist/components/Calendar/tests/Calendar.stories.d.ts +0 -29
- package/dist/components/Calendar/tests/Calendar.stories.js +0 -255
- package/dist/components/Card/tests/Card.stories.d.ts +0 -52
- package/dist/components/Card/tests/Card.stories.js +0 -125
- package/dist/components/Carousel/tests/Carousel.stories.d.ts +0 -34
- package/dist/components/Carousel/tests/Carousel.stories.js +0 -224
- package/dist/components/Checkbox/tests/Checkbox.stories.d.ts +0 -30
- package/dist/components/Checkbox/tests/Checkbox.stories.js +0 -171
- package/dist/components/CheckboxGroup/tests/CheckboxGroup.stories.d.ts +0 -19
- package/dist/components/CheckboxGroup/tests/CheckboxGroup.stories.js +0 -83
- package/dist/components/Container/tests/Container.stories.d.ts +0 -24
- package/dist/components/Container/tests/Container.stories.js +0 -75
- package/dist/components/ContextMenu/tests/ContextMenu.stories.d.ts +0 -26
- package/dist/components/ContextMenu/tests/ContextMenu.stories.js +0 -70
- package/dist/components/Dismissible/tests/Dismissible.stories.d.ts +0 -25
- package/dist/components/Dismissible/tests/Dismissible.stories.js +0 -97
- package/dist/components/Divider/tests/Divider.stories.d.ts +0 -18
- package/dist/components/Divider/tests/Divider.stories.js +0 -94
- package/dist/components/DropdownMenu/tests/DropdownMenu.stories.d.ts +0 -53
- package/dist/components/DropdownMenu/tests/DropdownMenu.stories.js +0 -278
- package/dist/components/FileUpload/tests/FileUpload.stories.d.ts +0 -31
- package/dist/components/FileUpload/tests/FileUpload.stories.js +0 -140
- package/dist/components/Flyout/tests/Flyout.stories.d.ts +0 -102
- package/dist/components/Flyout/tests/Flyout.stories.js +0 -708
- package/dist/components/FormControl/tests/FormControl.stories.d.ts +0 -31
- package/dist/components/FormControl/tests/FormControl.stories.js +0 -143
- package/dist/components/Grid/tests/Grid.stories.d.ts +0 -38
- package/dist/components/Grid/tests/Grid.stories.js +0 -245
- package/dist/components/Hidden/tests/Hidden.stories.d.ts +0 -16
- package/dist/components/Hidden/tests/Hidden.stories.js +0 -48
- package/dist/components/HiddenVisually/tests/HiddenVisually.stories.d.ts +0 -16
- package/dist/components/HiddenVisually/tests/HiddenVisually.stories.js +0 -28
- package/dist/components/Hotkey/tests/Hotkey.stories.d.ts +0 -13
- package/dist/components/Hotkey/tests/Hotkey.stories.js +0 -53
- package/dist/components/Icon/tests/Icon.stories.d.ts +0 -25
- package/dist/components/Icon/tests/Icon.stories.js +0 -113
- package/dist/components/Image/tests/Image.stories.d.ts +0 -41
- package/dist/components/Image/tests/Image.stories.js +0 -196
- package/dist/components/Link/tests/Link.stories.d.ts +0 -42
- package/dist/components/Link/tests/Link.stories.js +0 -155
- package/dist/components/Loader/tests/Loader.stories.d.ts +0 -21
- package/dist/components/Loader/tests/Loader.stories.js +0 -68
- package/dist/components/MenuItem/tests/MenuItem.stories.d.ts +0 -59
- package/dist/components/MenuItem/tests/MenuItem.stories.js +0 -236
- package/dist/components/Modal/tests/Modal.stories.d.ts +0 -64
- package/dist/components/Modal/tests/Modal.stories.js +0 -410
- package/dist/components/NumberField/tests/NumberField.stories.d.ts +0 -28
- package/dist/components/NumberField/tests/NumberField.stories.js +0 -258
- package/dist/components/Overlay/tests/Overlay.stories.d.ts +0 -28
- package/dist/components/Overlay/tests/Overlay.stories.js +0 -202
- package/dist/components/Pagination/tests/Pagination.stories.d.ts +0 -24
- package/dist/components/Pagination/tests/Pagination.stories.js +0 -105
- package/dist/components/PinField/tests/PinField.stories.d.ts +0 -34
- package/dist/components/PinField/tests/PinField.stories.js +0 -209
- package/dist/components/Popover/tests/Popover.stories.d.ts +0 -69
- package/dist/components/Popover/tests/Popover.stories.js +0 -340
- package/dist/components/Progress/tests/Progress.stories.d.ts +0 -30
- package/dist/components/Progress/tests/Progress.stories.js +0 -102
- package/dist/components/ProgressIndicator/tests/ProgressIndicator.stories.d.ts +0 -19
- package/dist/components/ProgressIndicator/tests/ProgressIndicator.stories.js +0 -92
- package/dist/components/Radio/tests/Radio.stories.d.ts +0 -35
- package/dist/components/Radio/tests/Radio.stories.js +0 -162
- package/dist/components/RadioGroup/tests/RadioGroup.stories.d.ts +0 -19
- package/dist/components/RadioGroup/tests/RadioGroup.stories.js +0 -77
- package/dist/components/Reshaped/tests/Reshaped.stories.d.ts +0 -34
- package/dist/components/Reshaped/tests/Reshaped.stories.js +0 -108
- package/dist/components/Resizable/tests/Resizable.stories.d.ts +0 -38
- package/dist/components/Resizable/tests/Resizable.stories.js +0 -185
- package/dist/components/Scrim/tests/Scrim.stories.d.ts +0 -20
- package/dist/components/Scrim/tests/Scrim.stories.js +0 -67
- package/dist/components/ScrollArea/tests/ScrollArea.stories.d.ts +0 -37
- package/dist/components/ScrollArea/tests/ScrollArea.stories.js +0 -244
- package/dist/components/Select/SelectOptionGroup.d.ts +0 -4
- package/dist/components/Select/SelectOptionGroup.js +0 -9
- package/dist/components/Select/tests/Select.stories.d.ts +0 -47
- package/dist/components/Select/tests/Select.stories.js +0 -520
- package/dist/components/Skeleton/tests/Skeleton.stories.d.ts +0 -20
- package/dist/components/Skeleton/tests/Skeleton.stories.js +0 -63
- package/dist/components/Slider/tests/Slider.stories.d.ts +0 -47
- package/dist/components/Slider/tests/Slider.stories.js +0 -279
- package/dist/components/Stepper/tests/Stepper.stories.d.ts +0 -31
- package/dist/components/Stepper/tests/Stepper.stories.js +0 -135
- package/dist/components/Switch/tests/Switch.stories.d.ts +0 -22
- package/dist/components/Switch/tests/Switch.stories.js +0 -137
- package/dist/components/Switch/tests/Switch.test.stories.d.ts +0 -13
- package/dist/components/Switch/tests/Switch.test.stories.js +0 -11
- package/dist/components/Table/tests/Table.stories.d.ts +0 -42
- package/dist/components/Table/tests/Table.stories.js +0 -348
- package/dist/components/Tabs/tests/Tabs.stories.d.ts +0 -62
- package/dist/components/Tabs/tests/Tabs.stories.js +0 -539
- package/dist/components/Text/tests/Text.stories.d.ts +0 -48
- package/dist/components/Text/tests/Text.stories.js +0 -201
- package/dist/components/TextArea/tests/TextArea.stories.d.ts +0 -53
- package/dist/components/TextArea/tests/TextArea.stories.js +0 -200
- package/dist/components/TextField/tests/TextField.stories.d.ts +0 -53
- package/dist/components/TextField/tests/TextField.stories.js +0 -237
- package/dist/components/Theme/tests/Theme.stories.d.ts +0 -25
- package/dist/components/Theme/tests/Theme.stories.js +0 -171
- package/dist/components/Timeline/tests/Timeline.stories.d.ts +0 -22
- package/dist/components/Timeline/tests/Timeline.stories.js +0 -86
- package/dist/components/Toast/tests/Toast.stories.d.ts +0 -41
- package/dist/components/Toast/tests/Toast.stories.js +0 -432
- package/dist/components/ToggleButton/tests/ToggleButton.stories.d.ts +0 -27
- package/dist/components/ToggleButton/tests/ToggleButton.stories.js +0 -97
- package/dist/components/ToggleButtonGroup/tests/ToggleButtonGroup.stories.d.ts +0 -27
- package/dist/components/ToggleButtonGroup/tests/ToggleButtonGroup.stories.js +0 -169
- package/dist/components/Tooltip/tests/Tooltip.stories.d.ts +0 -28
- package/dist/components/Tooltip/tests/Tooltip.stories.js +0 -182
- package/dist/components/View/tests/View.stories.d.ts +0 -141
- package/dist/components/View/tests/View.stories.js +0 -1329
- package/dist/components/_private/Portal/tests/Portal.stories.d.ts +0 -6
- package/dist/components/_private/Portal/tests/Portal.stories.js +0 -17
- package/dist/hooks/tests/useDrag.stories.d.ts +0 -31
- package/dist/hooks/tests/useDrag.stories.js +0 -147
- package/dist/hooks/tests/useElementId.stories.d.ts +0 -11
- package/dist/hooks/tests/useElementId.stories.js +0 -23
- package/dist/hooks/tests/useHandlerRef.stories.d.ts +0 -14
- package/dist/hooks/tests/useHandlerRef.stories.js +0 -44
- package/dist/hooks/tests/useHotkeys.stories.d.ts +0 -43
- package/dist/hooks/tests/useHotkeys.stories.js +0 -158
- package/dist/hooks/tests/useKeyboardArrowNavigation.stories.d.ts +0 -15
- package/dist/hooks/tests/useKeyboardArrowNavigation.stories.js +0 -128
- package/dist/hooks/tests/useKeyboardMode.stories.d.ts +0 -11
- package/dist/hooks/tests/useKeyboardMode.stories.js +0 -42
- package/dist/hooks/tests/useOnClickOutside.stories.d.ts +0 -23
- package/dist/hooks/tests/useOnClickOutside.stories.js +0 -111
- package/dist/hooks/tests/useRTL.stories.d.ts +0 -11
- package/dist/hooks/tests/useRTL.stories.js +0 -23
- package/dist/hooks/tests/useResponsiveClientValue.stories.d.ts +0 -18
- package/dist/hooks/tests/useResponsiveClientValue.stories.js +0 -30
- package/dist/hooks/tests/useScrollLock.stories.d.ts +0 -14
- package/dist/hooks/tests/useScrollLock.stories.js +0 -97
- package/dist/hooks/tests/useToggle.stories.d.ts +0 -13
- package/dist/hooks/tests/useToggle.stories.js +0 -59
- package/dist/tests/ShadowDOM.stories.d.ts +0 -6
- package/dist/tests/ShadowDOM.stories.js +0 -110
- package/dist/tests/themes.stories.d.ts +0 -16
- package/dist/tests/themes.stories.js +0 -327
- package/dist/utilities/a11y/tests/TrapFocus.stories.d.ts +0 -14
- package/dist/utilities/a11y/tests/TrapFocus.stories.js +0 -615
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { Example } from "../../../utilities/storybook/index.js";
|
|
2
|
-
import View from "../../View/index.js";
|
|
3
|
-
import Icon from "../index.js";
|
|
4
|
-
import Text from "../../Text/index.js";
|
|
5
|
-
import IconZap from "../../../icons/Zap.js";
|
|
6
|
-
import IconMic from "../../../icons/Mic.js";
|
|
7
|
-
import { expect } from "storybook/test";
|
|
8
|
-
export default {
|
|
9
|
-
title: "Utility components/Icon",
|
|
10
|
-
component: Icon,
|
|
11
|
-
parameters: {
|
|
12
|
-
iframe: {
|
|
13
|
-
url: "https://reshaped.so/docs/utilities/icon",
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
export const size = {
|
|
18
|
-
name: "size",
|
|
19
|
-
render: () => (<Example>
|
|
20
|
-
<Example.Item title="size: 4">
|
|
21
|
-
<Icon svg={IconZap} size={4}/>
|
|
22
|
-
</Example.Item>
|
|
23
|
-
<Example.Item title="size: 8">
|
|
24
|
-
<Icon svg={IconZap} size={8}/>
|
|
25
|
-
</Example.Item>
|
|
26
|
-
<Example.Item title="size: 100%">
|
|
27
|
-
<View width={25} height={25}>
|
|
28
|
-
<Icon svg={IconZap} size="100%"/>
|
|
29
|
-
</View>
|
|
30
|
-
</Example.Item>
|
|
31
|
-
<Example.Item title={["responsive size", "[s] 5", "[m]: 10"]}>
|
|
32
|
-
<Icon svg={IconZap} size={{ s: 5, m: 10 }}/>
|
|
33
|
-
</Example.Item>
|
|
34
|
-
<Example.Item title="size: inherit from font">
|
|
35
|
-
<Text variant="title-6">
|
|
36
|
-
<View direction="row" align="center" gap={2}>
|
|
37
|
-
<Icon svg={IconZap}/>
|
|
38
|
-
<View.Item>Reshaped</View.Item>
|
|
39
|
-
</View>
|
|
40
|
-
</Text>
|
|
41
|
-
</Example.Item>
|
|
42
|
-
</Example>),
|
|
43
|
-
};
|
|
44
|
-
export const color = {
|
|
45
|
-
name: "color",
|
|
46
|
-
render: () => (<Example>
|
|
47
|
-
<Example.Item title="color: neutral">
|
|
48
|
-
<Icon svg={IconZap} color="neutral"/>
|
|
49
|
-
</Example.Item>
|
|
50
|
-
<Example.Item title="color: neutral-faded">
|
|
51
|
-
<Icon svg={IconZap} color="neutral-faded"/>
|
|
52
|
-
</Example.Item>
|
|
53
|
-
<Example.Item title="color: primary">
|
|
54
|
-
<Icon svg={IconZap} color="primary"/>
|
|
55
|
-
</Example.Item>
|
|
56
|
-
<Example.Item title="color: critical">
|
|
57
|
-
<Icon svg={IconZap} color="critical"/>
|
|
58
|
-
</Example.Item>
|
|
59
|
-
<Example.Item title="color: positive">
|
|
60
|
-
<Icon svg={IconZap} color="positive"/>
|
|
61
|
-
</Example.Item>
|
|
62
|
-
<Example.Item title="color: disabled">
|
|
63
|
-
<Icon svg={IconZap} color="disabled"/>
|
|
64
|
-
</Example.Item>
|
|
65
|
-
<Example.Item title="color: inherit">
|
|
66
|
-
<div style={{ color: "tomato" }}>
|
|
67
|
-
<Icon svg={IconZap}/>
|
|
68
|
-
</div>
|
|
69
|
-
</Example.Item>
|
|
70
|
-
</Example>),
|
|
71
|
-
};
|
|
72
|
-
export const autoWidth = {
|
|
73
|
-
name: "autoWidth, blank",
|
|
74
|
-
render: () => (<Example>
|
|
75
|
-
<Example.Item title="square boundaries">
|
|
76
|
-
<div style={{ background: "var(--rs-color-background-neutral)", display: "inline-block" }}>
|
|
77
|
-
<Icon svg={IconMic} size={10}/>
|
|
78
|
-
</div>
|
|
79
|
-
</Example.Item>
|
|
80
|
-
<Example.Item title="auto width boundaries">
|
|
81
|
-
<div style={{ background: "var(--rs-color-background-neutral)", display: "inline-block" }}>
|
|
82
|
-
<Icon svg={IconMic} size={10} autoWidth/>
|
|
83
|
-
</div>
|
|
84
|
-
</Example.Item>
|
|
85
|
-
<Example.Item title="blank">
|
|
86
|
-
<div style={{ background: "var(--rs-color-background-neutral)", display: "inline-block" }}>
|
|
87
|
-
<Icon svg={null} size={10}/>
|
|
88
|
-
</div>
|
|
89
|
-
</Example.Item>
|
|
90
|
-
</Example>),
|
|
91
|
-
};
|
|
92
|
-
export const className = {
|
|
93
|
-
name: "className, attributes",
|
|
94
|
-
render: () => (<div data-testid="root">
|
|
95
|
-
<Icon svg={IconZap} className="test-classname" attributes={{ id: "test-id" }}/>
|
|
96
|
-
</div>),
|
|
97
|
-
play: async ({ canvas }) => {
|
|
98
|
-
const root = canvas.getByTestId("root").firstChild;
|
|
99
|
-
expect(root).toHaveClass("test-classname");
|
|
100
|
-
expect(root).toHaveAttribute("id", "test-id");
|
|
101
|
-
},
|
|
102
|
-
};
|
|
103
|
-
export const render = {
|
|
104
|
-
name: "test: hidden from sr",
|
|
105
|
-
render: () => (<div data-testid="root">
|
|
106
|
-
<Icon svg={IconZap}/>
|
|
107
|
-
</div>),
|
|
108
|
-
play: ({ canvas }) => {
|
|
109
|
-
const root = canvas.getByTestId("root").firstChild;
|
|
110
|
-
expect(root).toBeInTheDocument();
|
|
111
|
-
expect(root).toHaveAttribute("aria-hidden");
|
|
112
|
-
},
|
|
113
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
|
2
|
-
import { fn, Mock } from "storybook/test";
|
|
3
|
-
declare const _default: {
|
|
4
|
-
title: string;
|
|
5
|
-
component: import("react").FC<import("..").ImageProps>;
|
|
6
|
-
parameters: {
|
|
7
|
-
iframe: {
|
|
8
|
-
url: string;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export default _default;
|
|
13
|
-
export declare const src: StoryObj;
|
|
14
|
-
export declare const size: {
|
|
15
|
-
name: string;
|
|
16
|
-
render: () => import("react").JSX.Element;
|
|
17
|
-
};
|
|
18
|
-
export declare const radius: {
|
|
19
|
-
name: string;
|
|
20
|
-
render: () => import("react").JSX.Element;
|
|
21
|
-
};
|
|
22
|
-
export declare const displayMode: {
|
|
23
|
-
name: string;
|
|
24
|
-
render: () => import("react").JSX.Element;
|
|
25
|
-
};
|
|
26
|
-
export declare const onLoad: StoryObj<{
|
|
27
|
-
handleLoad: ReturnType<typeof fn>;
|
|
28
|
-
}>;
|
|
29
|
-
export declare const onError: StoryObj<{
|
|
30
|
-
handleError: Mock;
|
|
31
|
-
}>;
|
|
32
|
-
export declare const fallback: {
|
|
33
|
-
name: string;
|
|
34
|
-
render: () => import("react").JSX.Element;
|
|
35
|
-
};
|
|
36
|
-
export declare const renderImage: StoryObj;
|
|
37
|
-
export declare const imageAttributes: StoryObj;
|
|
38
|
-
export declare const ratio: {
|
|
39
|
-
name: string;
|
|
40
|
-
render: () => import("react").JSX.Element;
|
|
41
|
-
};
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import { expect, fn, waitFor } from "storybook/test";
|
|
2
|
-
import { Example } from "../../../utilities/storybook/index.js";
|
|
3
|
-
import View from "../../View/index.js";
|
|
4
|
-
import Icon from "../../Icon/index.js";
|
|
5
|
-
import IconZap from "../../../icons/Zap.js";
|
|
6
|
-
import Image from "../Image.js";
|
|
7
|
-
export default {
|
|
8
|
-
title: "Utility components/Image",
|
|
9
|
-
component: Image,
|
|
10
|
-
parameters: {
|
|
11
|
-
iframe: {
|
|
12
|
-
url: "https://reshaped.so/docs/utilities/image",
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
const imgUrl = "https://images.unsplash.com/photo-1536880756060-98a6a140f0a7?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1600&q=80";
|
|
17
|
-
export const src = {
|
|
18
|
-
name: "src, alt",
|
|
19
|
-
render: () => (<Example>
|
|
20
|
-
<Example.Item title="src, alt">
|
|
21
|
-
<Image src={imgUrl} alt="Image alt"/>
|
|
22
|
-
</Example.Item>
|
|
23
|
-
|
|
24
|
-
<Example.Item title="src">
|
|
25
|
-
<Image src={imgUrl}/>
|
|
26
|
-
</Example.Item>
|
|
27
|
-
</Example>),
|
|
28
|
-
play: ({ canvas }) => {
|
|
29
|
-
const presentation = canvas.getByRole("presentation");
|
|
30
|
-
const img = canvas.getByRole("img");
|
|
31
|
-
expect(presentation).toBeInTheDocument();
|
|
32
|
-
expect(img).toBeInTheDocument();
|
|
33
|
-
expect(img).toHaveAccessibleName("Image alt");
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
export const size = {
|
|
37
|
-
name: "width, height, maxWidth, aspectRatio",
|
|
38
|
-
render: () => (<Example>
|
|
39
|
-
<Example.Item title="width: 200px">
|
|
40
|
-
<Image src={imgUrl} width="200px"/>
|
|
41
|
-
</Example.Item>
|
|
42
|
-
<Example.Item title="height: 200px">
|
|
43
|
-
<Image src={imgUrl} height="200px"/>
|
|
44
|
-
</Example.Item>
|
|
45
|
-
<Example.Item title="maxWidth: 200px">
|
|
46
|
-
<Image src={imgUrl} maxWidth="200px"/>
|
|
47
|
-
</Example.Item>
|
|
48
|
-
<Example.Item title="aspectRatio: 1/1">
|
|
49
|
-
<Image src={imgUrl} aspectRatio={1 / 1} width="300px"/>
|
|
50
|
-
</Example.Item>
|
|
51
|
-
<Example.Item title={["responsive width", "[s] 200px", "[m+] 300px"]}>
|
|
52
|
-
<Image src={imgUrl} width={{ s: "200px", m: "300px" }}/>
|
|
53
|
-
</Example.Item>
|
|
54
|
-
</Example>),
|
|
55
|
-
};
|
|
56
|
-
export const radius = {
|
|
57
|
-
name: "borderRadius",
|
|
58
|
-
render: () => (<Example>
|
|
59
|
-
<Example.Item title="radius: small">
|
|
60
|
-
<View width="300px">
|
|
61
|
-
<Image src={imgUrl} borderRadius="small"/>
|
|
62
|
-
</View>
|
|
63
|
-
</Example.Item>
|
|
64
|
-
<Example.Item title="radius: medium">
|
|
65
|
-
<View width="300px">
|
|
66
|
-
<Image src={imgUrl} borderRadius="medium"/>
|
|
67
|
-
</View>
|
|
68
|
-
</Example.Item>
|
|
69
|
-
<Example.Item title="radius: large">
|
|
70
|
-
<View width="300px">
|
|
71
|
-
<Image src={imgUrl} borderRadius="large"/>
|
|
72
|
-
</View>
|
|
73
|
-
</Example.Item>
|
|
74
|
-
</Example>),
|
|
75
|
-
};
|
|
76
|
-
export const displayMode = {
|
|
77
|
-
name: "displayMode",
|
|
78
|
-
render: () => (<Example>
|
|
79
|
-
<Example.Item title="mode: cover">
|
|
80
|
-
<Image src={imgUrl} height="200px" width="100%" displayMode="cover"/>
|
|
81
|
-
</Example.Item>
|
|
82
|
-
<Example.Item title="mode: contain">
|
|
83
|
-
<Image src={imgUrl} height="200px" width="100%" displayMode="contain"/>
|
|
84
|
-
</Example.Item>
|
|
85
|
-
</Example>),
|
|
86
|
-
};
|
|
87
|
-
export const onLoad = {
|
|
88
|
-
name: "onLoad",
|
|
89
|
-
args: {
|
|
90
|
-
handleLoad: fn(),
|
|
91
|
-
},
|
|
92
|
-
render: (args) => <Image src={imgUrl} alt="photo" onLoad={args.handleLoad}/>,
|
|
93
|
-
play: async ({ canvas, args }) => {
|
|
94
|
-
const { handleLoad } = args;
|
|
95
|
-
const img = canvas.getByRole("img");
|
|
96
|
-
await waitFor(() => {
|
|
97
|
-
expect(handleLoad).toHaveBeenCalledTimes(1);
|
|
98
|
-
expect(handleLoad).toHaveBeenCalledWith(expect.objectContaining({ target: img, type: "load" }));
|
|
99
|
-
});
|
|
100
|
-
},
|
|
101
|
-
};
|
|
102
|
-
export const onError = {
|
|
103
|
-
name: "onError",
|
|
104
|
-
args: {
|
|
105
|
-
handleError: fn(),
|
|
106
|
-
},
|
|
107
|
-
render: (args) => <Image src="/invalid.png" alt="photo" onError={args.handleError}/>,
|
|
108
|
-
play: async ({ canvas, args }) => {
|
|
109
|
-
const { handleError } = args;
|
|
110
|
-
const img = canvas.getByRole("img");
|
|
111
|
-
await waitFor(() => {
|
|
112
|
-
expect(handleError).toHaveBeenCalledTimes(1);
|
|
113
|
-
expect(handleError).toHaveBeenCalledWith(expect.objectContaining({ target: img, type: "error" }));
|
|
114
|
-
});
|
|
115
|
-
},
|
|
116
|
-
};
|
|
117
|
-
export const fallback = {
|
|
118
|
-
name: "fallback",
|
|
119
|
-
render: () => (<Example>
|
|
120
|
-
<Example.Item title="fallback, background, on error">
|
|
121
|
-
<View width="300px">
|
|
122
|
-
<View aspectRatio={16 / 9}>
|
|
123
|
-
<Image src="error" fallback/>
|
|
124
|
-
</View>
|
|
125
|
-
</View>
|
|
126
|
-
</Example.Item>
|
|
127
|
-
<Example.Item title="fallback, image, on error">
|
|
128
|
-
<View width="300px">
|
|
129
|
-
<View aspectRatio={16 / 9}>
|
|
130
|
-
<Image src="error" fallback={imgUrl}/>
|
|
131
|
-
</View>
|
|
132
|
-
</View>
|
|
133
|
-
</Example.Item>
|
|
134
|
-
|
|
135
|
-
<Example.Item title="fallback, icon, on error">
|
|
136
|
-
<View width="300px">
|
|
137
|
-
<View aspectRatio={16 / 9}>
|
|
138
|
-
<Image src="error" fallback={<Icon svg={IconZap} size={10}/>}/>
|
|
139
|
-
</View>
|
|
140
|
-
</View>
|
|
141
|
-
</Example.Item>
|
|
142
|
-
<Example.Item title="fallback, icon, no url">
|
|
143
|
-
<View width="300px">
|
|
144
|
-
<View aspectRatio={16 / 9}>
|
|
145
|
-
<Image fallback={<Icon svg={IconZap} size={10}/>}/>
|
|
146
|
-
</View>
|
|
147
|
-
</View>
|
|
148
|
-
</Example.Item>
|
|
149
|
-
</Example>),
|
|
150
|
-
};
|
|
151
|
-
export const renderImage = {
|
|
152
|
-
name: "renderImage",
|
|
153
|
-
render: () => (<Example>
|
|
154
|
-
<Example.Item title="renderImage">
|
|
155
|
-
<Image src={imgUrl} alt="Amsterdam canal" renderImage={(attributes) => <img {...attributes} id="test-image"/>}/>
|
|
156
|
-
</Example.Item>
|
|
157
|
-
<Example.Item title="renderImage, fallback">
|
|
158
|
-
<Image src="error" fallback={imgUrl} alt="Amsterdam canal 2" renderImage={(attributes) => <img {...attributes} id="test-image-fallback"/>}/>
|
|
159
|
-
</Example.Item>
|
|
160
|
-
</Example>),
|
|
161
|
-
play: ({ canvas }) => {
|
|
162
|
-
const images = canvas.getAllByRole("img");
|
|
163
|
-
expect(images[0]).toHaveAccessibleName("Amsterdam canal");
|
|
164
|
-
expect(images[0]).toHaveAttribute("id", "test-image");
|
|
165
|
-
expect(images[1]).toHaveAccessibleName("Amsterdam canal 2");
|
|
166
|
-
expect(images[1]).toHaveAttribute("id", "test-image-fallback");
|
|
167
|
-
},
|
|
168
|
-
};
|
|
169
|
-
export const imageAttributes = {
|
|
170
|
-
name: "className, attributes,imageAttributes",
|
|
171
|
-
render: () => (<div data-testid="root">
|
|
172
|
-
<Image src={imgUrl} alt="photo" className="test-classname" attributes={{ id: "test-id" }} imageAttributes={{ "data-testid": "test-img-id" }}/>
|
|
173
|
-
</div>),
|
|
174
|
-
play: async ({ canvas }) => {
|
|
175
|
-
const img = canvas.getByRole("img");
|
|
176
|
-
const root = canvas.getByTestId("root").firstChild;
|
|
177
|
-
expect(root).toHaveClass("test-classname");
|
|
178
|
-
expect(root).toHaveAttribute("id", "test-id");
|
|
179
|
-
expect(img).toHaveAttribute("data-testid", "test-img-id");
|
|
180
|
-
},
|
|
181
|
-
};
|
|
182
|
-
export const ratio = {
|
|
183
|
-
name: "test: aspectRatio",
|
|
184
|
-
render: () => (<Example>
|
|
185
|
-
<Example.Item title="ratio: 16/9">
|
|
186
|
-
<View aspectRatio={16 / 9}>
|
|
187
|
-
<Image src={imgUrl}/>
|
|
188
|
-
</View>
|
|
189
|
-
</Example.Item>
|
|
190
|
-
<Example.Item title="ratio: 16/9, displayMode: contain">
|
|
191
|
-
<View aspectRatio={16 / 9}>
|
|
192
|
-
<Image src={imgUrl} displayMode="contain"/>
|
|
193
|
-
</View>
|
|
194
|
-
</Example.Item>
|
|
195
|
-
</Example>),
|
|
196
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { fn } from "storybook/test";
|
|
2
|
-
import { StoryObj } from "@storybook/react-vite";
|
|
3
|
-
declare const _default: {
|
|
4
|
-
title: string;
|
|
5
|
-
component: import("react").ForwardRefExoticComponent<Pick<import("../../Actionable").ActionableProps, "children" | "disabled" | "className" | "attributes" | "render" | "type" | "onClick" | "href" | "stopPropagation"> & {
|
|
6
|
-
icon?: import("../../Icon").IconProps["svg"];
|
|
7
|
-
color?: "inherit" | "critical" | "primary" | "positive" | "warning";
|
|
8
|
-
variant?: "plain" | "underline";
|
|
9
|
-
} & import("react").RefAttributes<import("../../Actionable").ActionableRef>>;
|
|
10
|
-
parameters: {
|
|
11
|
-
iframe: {
|
|
12
|
-
url: string;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export default _default;
|
|
17
|
-
export declare const variant: {
|
|
18
|
-
name: string;
|
|
19
|
-
render: () => import("react").JSX.Element;
|
|
20
|
-
};
|
|
21
|
-
export declare const color: {
|
|
22
|
-
name: string;
|
|
23
|
-
render: () => import("react").JSX.Element;
|
|
24
|
-
};
|
|
25
|
-
export declare const icon: {
|
|
26
|
-
name: string;
|
|
27
|
-
render: () => import("react").JSX.Element;
|
|
28
|
-
};
|
|
29
|
-
export declare const href: StoryObj;
|
|
30
|
-
export declare const onClick: StoryObj<{
|
|
31
|
-
handleClick: ReturnType<typeof fn>;
|
|
32
|
-
}>;
|
|
33
|
-
export declare const hrefOnClick: StoryObj<{
|
|
34
|
-
handleClick: ReturnType<typeof fn>;
|
|
35
|
-
}>;
|
|
36
|
-
export declare const disabled: StoryObj;
|
|
37
|
-
export declare const render: StoryObj;
|
|
38
|
-
export declare const className: StoryObj;
|
|
39
|
-
export declare const testMultilineInText: {
|
|
40
|
-
name: string;
|
|
41
|
-
render: () => import("react").JSX.Element;
|
|
42
|
-
};
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import { Example } from "../../../utilities/storybook/index.js";
|
|
2
|
-
import Link from "../index.js";
|
|
3
|
-
import Text from "../../Text/index.js";
|
|
4
|
-
import IconZap from "../../../icons/Zap.js";
|
|
5
|
-
import { expect, fn, userEvent } from "storybook/test";
|
|
6
|
-
export default {
|
|
7
|
-
title: "Components/Link",
|
|
8
|
-
component: Link,
|
|
9
|
-
parameters: {
|
|
10
|
-
iframe: {
|
|
11
|
-
url: "https://reshaped.so/docs/components/breadcrumbs",
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
export const variant = {
|
|
16
|
-
name: "variant",
|
|
17
|
-
render: () => (<Example>
|
|
18
|
-
<Example.Item title="variant: underline">
|
|
19
|
-
<Link href="http://reshaped.so" attributes={{ target: "_blank" }}>
|
|
20
|
-
Reshaped
|
|
21
|
-
</Link>
|
|
22
|
-
</Example.Item>
|
|
23
|
-
<Example.Item title="variant: plain">
|
|
24
|
-
<Link onClick={() => { }} variant="plain">
|
|
25
|
-
Link
|
|
26
|
-
</Link>
|
|
27
|
-
</Example.Item>
|
|
28
|
-
</Example>),
|
|
29
|
-
};
|
|
30
|
-
export const color = {
|
|
31
|
-
name: "color",
|
|
32
|
-
render: () => (<Example>
|
|
33
|
-
<Example.Item title="color: primary">
|
|
34
|
-
<Link color="primary">Link</Link>
|
|
35
|
-
</Example.Item>
|
|
36
|
-
<Example.Item title="color: critical">
|
|
37
|
-
<Link color="critical">Link</Link>
|
|
38
|
-
</Example.Item>
|
|
39
|
-
<Example.Item title="color: positive">
|
|
40
|
-
<Link color="positive">Link</Link>
|
|
41
|
-
</Example.Item>
|
|
42
|
-
<Example.Item title="color: warning">
|
|
43
|
-
<Link color="warning">Link</Link>
|
|
44
|
-
</Example.Item>
|
|
45
|
-
<Example.Item title="color: inherit">
|
|
46
|
-
<Link color="inherit">Link</Link>
|
|
47
|
-
</Example.Item>
|
|
48
|
-
</Example>),
|
|
49
|
-
};
|
|
50
|
-
export const icon = {
|
|
51
|
-
name: "icon",
|
|
52
|
-
render: () => (<Example>
|
|
53
|
-
<Example.Item title="icon, variant: underline">
|
|
54
|
-
<Link icon={IconZap}>Link</Link>
|
|
55
|
-
</Example.Item>
|
|
56
|
-
<Example.Item title="icon, variant: plain">
|
|
57
|
-
<Link icon={IconZap} variant="plain">
|
|
58
|
-
Link
|
|
59
|
-
</Link>
|
|
60
|
-
</Example.Item>
|
|
61
|
-
<Example.Item title={["icon, variant: underline", "should inherit display-1 size from the parent"]}>
|
|
62
|
-
<Text variant="title-3">
|
|
63
|
-
<Link icon={IconZap} variant="underline">
|
|
64
|
-
Instant delivery
|
|
65
|
-
</Link>
|
|
66
|
-
</Text>
|
|
67
|
-
</Example.Item>
|
|
68
|
-
</Example>),
|
|
69
|
-
};
|
|
70
|
-
export const href = {
|
|
71
|
-
name: "href",
|
|
72
|
-
render: () => <Link href="https://reshaped.so">Trigger</Link>,
|
|
73
|
-
play: async ({ canvas }) => {
|
|
74
|
-
const el = canvas.getByRole("link");
|
|
75
|
-
expect(el).toHaveAttribute("href", "https://reshaped.so");
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
export const onClick = {
|
|
79
|
-
name: "onClick",
|
|
80
|
-
args: {
|
|
81
|
-
handleClick: fn(),
|
|
82
|
-
},
|
|
83
|
-
render: (args) => <Link onClick={args.handleClick}>Trigger</Link>,
|
|
84
|
-
play: async ({ canvas, args }) => {
|
|
85
|
-
const { handleClick } = args;
|
|
86
|
-
const el = canvas.getAllByRole("button")[0];
|
|
87
|
-
await userEvent.click(el);
|
|
88
|
-
expect(el).toHaveAttribute("type", "button");
|
|
89
|
-
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
90
|
-
expect(handleClick).toHaveBeenCalledWith(expect.objectContaining({ target: el }));
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
export const hrefOnClick = {
|
|
94
|
-
name: "href + onClick",
|
|
95
|
-
args: {
|
|
96
|
-
handleClick: fn(),
|
|
97
|
-
},
|
|
98
|
-
render: (args) => (<Link onClick={(e) => {
|
|
99
|
-
e.preventDefault();
|
|
100
|
-
args.handleClick(e);
|
|
101
|
-
}} href="https://reshaped.so">
|
|
102
|
-
Trigger
|
|
103
|
-
</Link>),
|
|
104
|
-
play: async ({ canvas, args }) => {
|
|
105
|
-
const { handleClick } = args;
|
|
106
|
-
const el = canvas.getByRole("link");
|
|
107
|
-
await userEvent.click(el);
|
|
108
|
-
expect(el).toHaveAttribute("href", "https://reshaped.so");
|
|
109
|
-
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
110
|
-
expect(handleClick).toHaveBeenCalledWith(expect.objectContaining({ target: el }));
|
|
111
|
-
},
|
|
112
|
-
};
|
|
113
|
-
export const disabled = {
|
|
114
|
-
name: "disabled",
|
|
115
|
-
render: () => (<Link disabled onClick={() => { }}>
|
|
116
|
-
Trigger
|
|
117
|
-
</Link>),
|
|
118
|
-
play: async ({ canvas }) => {
|
|
119
|
-
const el = canvas.getAllByRole("button")[0];
|
|
120
|
-
expect(el).toBeDisabled();
|
|
121
|
-
},
|
|
122
|
-
};
|
|
123
|
-
export const render = {
|
|
124
|
-
name: "render",
|
|
125
|
-
render: () => <Link render={(props) => <section {...props}/>}>Trigger</Link>,
|
|
126
|
-
play: async ({ canvas }) => {
|
|
127
|
-
const el = canvas.getByText("Trigger");
|
|
128
|
-
expect(el).toBeInTheDocument();
|
|
129
|
-
expect(el.tagName).toBe("SECTION");
|
|
130
|
-
},
|
|
131
|
-
};
|
|
132
|
-
export const className = {
|
|
133
|
-
name: "className, attributes",
|
|
134
|
-
render: () => (<div data-testid="root">
|
|
135
|
-
<Link className="test-classname" attributes={{ id: "test-id" }}>
|
|
136
|
-
Trigger
|
|
137
|
-
</Link>
|
|
138
|
-
</div>),
|
|
139
|
-
play: async ({ canvas }) => {
|
|
140
|
-
const root = canvas.getByTestId("root").firstChild;
|
|
141
|
-
expect(root).toHaveClass("test-classname");
|
|
142
|
-
expect(root).toHaveAttribute("id", "test-id");
|
|
143
|
-
},
|
|
144
|
-
};
|
|
145
|
-
export const testMultilineInText = {
|
|
146
|
-
name: "test: multiline",
|
|
147
|
-
render: () => (<Example>
|
|
148
|
-
<Example.Item title="should wrap inside the text">
|
|
149
|
-
<div>
|
|
150
|
-
Someone asked me to write this text that is boring to ready for everyone and to add
|
|
151
|
-
<Link href="/">this very very long link</Link> to it.
|
|
152
|
-
</div>
|
|
153
|
-
</Example.Item>
|
|
154
|
-
</Example>),
|
|
155
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
|
2
|
-
declare const _default: {
|
|
3
|
-
title: string;
|
|
4
|
-
component: import("react").FC<import("./..").LoaderProps>;
|
|
5
|
-
parameters: {
|
|
6
|
-
iframe: {
|
|
7
|
-
url: string;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export default _default;
|
|
12
|
-
export declare const size: {
|
|
13
|
-
name: string;
|
|
14
|
-
render: () => import("react").JSX.Element;
|
|
15
|
-
};
|
|
16
|
-
export declare const color: {
|
|
17
|
-
name: string;
|
|
18
|
-
render: () => import("react").JSX.Element;
|
|
19
|
-
};
|
|
20
|
-
export declare const ariaLabel: StoryObj;
|
|
21
|
-
export declare const className: StoryObj;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { Example } from "../../../utilities/storybook/index.js";
|
|
2
|
-
import Loader from "../index.js";
|
|
3
|
-
import { expect } from "storybook/test";
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/Loader",
|
|
6
|
-
component: Loader,
|
|
7
|
-
parameters: {
|
|
8
|
-
iframe: {
|
|
9
|
-
url: "https://reshaped.so/docs/components/loader",
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
export const size = {
|
|
14
|
-
name: "size",
|
|
15
|
-
render: () => {
|
|
16
|
-
return (<Example>
|
|
17
|
-
<Example.Item title="size: medium">
|
|
18
|
-
<Loader size="medium" ariaLabel="Loading"/>
|
|
19
|
-
</Example.Item>
|
|
20
|
-
<Example.Item title="size: small">
|
|
21
|
-
<Loader size="small" ariaLabel="Loading"/>
|
|
22
|
-
</Example.Item>
|
|
23
|
-
<Example.Item title="size: large">
|
|
24
|
-
<Loader size="large" ariaLabel="Loading"/>
|
|
25
|
-
</Example.Item>
|
|
26
|
-
<Example.Item title={["responsive size", "[s] small", "[m+] medium"]}>
|
|
27
|
-
<Loader size={{ s: "small", m: "medium" }} ariaLabel="Loading"/>
|
|
28
|
-
</Example.Item>
|
|
29
|
-
</Example>);
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
export const color = {
|
|
33
|
-
name: "color",
|
|
34
|
-
render: () => (<Example>
|
|
35
|
-
<Example.Item title="color: primary">
|
|
36
|
-
<Loader ariaLabel="Loading"/>
|
|
37
|
-
</Example.Item>
|
|
38
|
-
<Example.Item title="color: critical">
|
|
39
|
-
<Loader color="critical" ariaLabel="Loading"/>
|
|
40
|
-
</Example.Item>
|
|
41
|
-
<Example.Item title="color: positive">
|
|
42
|
-
<Loader color="positive" ariaLabel="Loading"/>
|
|
43
|
-
</Example.Item>
|
|
44
|
-
<Example.Item title="color: inherit">
|
|
45
|
-
<Loader color="inherit" ariaLabel="Loading"/>
|
|
46
|
-
</Example.Item>
|
|
47
|
-
</Example>),
|
|
48
|
-
};
|
|
49
|
-
export const ariaLabel = {
|
|
50
|
-
name: "ariaLabel",
|
|
51
|
-
render: () => <Loader ariaLabel="Loading" attributes={{ "data-testid": "root" }}/>,
|
|
52
|
-
play: async ({ canvas }) => {
|
|
53
|
-
const root = canvas.getByTestId("root");
|
|
54
|
-
expect(root).toHaveAttribute("aria-live", "assertive");
|
|
55
|
-
expect(root).toHaveAttribute("aria-label", "Loading");
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
export const className = {
|
|
59
|
-
name: "className, attributes",
|
|
60
|
-
render: () => (<div data-testid="root">
|
|
61
|
-
<Loader className="test-classname" attributes={{ id: "test-id" }} ariaLabel="Loading"/>
|
|
62
|
-
</div>),
|
|
63
|
-
play: async ({ canvas }) => {
|
|
64
|
-
const root = canvas.getByTestId("root").firstChild;
|
|
65
|
-
expect(root).toHaveClass("test-classname");
|
|
66
|
-
expect(root).toHaveAttribute("id", "test-id");
|
|
67
|
-
},
|
|
68
|
-
};
|