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,520 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { expect, fn, userEvent, within } from "storybook/test";
|
|
3
|
-
import IconZap from "../../../icons/Zap.js";
|
|
4
|
-
import { Example, Placeholder } from "../../../utilities/storybook/index.js";
|
|
5
|
-
import useToggle from "../../../hooks/useToggle.js";
|
|
6
|
-
import Modal from "../../Modal/index.js";
|
|
7
|
-
import MenuItem from "../../MenuItem/index.js";
|
|
8
|
-
import Select from "../index.js";
|
|
9
|
-
import FormControl from "../../FormControl/index.js";
|
|
10
|
-
export default {
|
|
11
|
-
title: "Components/Select",
|
|
12
|
-
component: Select,
|
|
13
|
-
parameters: {
|
|
14
|
-
iframe: {
|
|
15
|
-
url: "https://reshaped.so/docs/components/select",
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
export const nativeRender = {
|
|
20
|
-
name: "native rendering, options, name, id",
|
|
21
|
-
render: () => (<Example>
|
|
22
|
-
<Example.Item title="native with options prop">
|
|
23
|
-
<Select name="animal" id="animal-1" placeholder="Select an animal" options={[
|
|
24
|
-
{ label: "Dog", value: "dog" },
|
|
25
|
-
{ label: "Turtle", value: "turtle" },
|
|
26
|
-
]} inputAttributes={{
|
|
27
|
-
"aria-label": "Select an animal",
|
|
28
|
-
}}/>
|
|
29
|
-
</Example.Item>
|
|
30
|
-
<Example.Item title="native with option tags">
|
|
31
|
-
<Select name="animal" id="animal-2" placeholder="Select an animal" inputAttributes={{
|
|
32
|
-
"aria-label": "Select an animal",
|
|
33
|
-
}}>
|
|
34
|
-
<option value="dog">Dog</option>
|
|
35
|
-
<option value="turtle">Turtle</option>
|
|
36
|
-
</Select>
|
|
37
|
-
</Example.Item>
|
|
38
|
-
</Example>),
|
|
39
|
-
play: ({ canvas }) => {
|
|
40
|
-
const [selectWithProp, selectWithTags] = canvas.getAllByRole("combobox");
|
|
41
|
-
const optionsFromProps = within(selectWithProp).getAllByRole("option");
|
|
42
|
-
const optionsFromTags = within(selectWithTags).getAllByRole("option");
|
|
43
|
-
expect(selectWithProp).toHaveAttribute("name", "animal");
|
|
44
|
-
expect(selectWithProp).toHaveAttribute("id", "animal-1");
|
|
45
|
-
expect(optionsFromProps).toHaveLength(3);
|
|
46
|
-
expect(optionsFromProps[0]).toHaveTextContent("Select an animal");
|
|
47
|
-
expect(optionsFromProps[1]).toHaveTextContent("Dog");
|
|
48
|
-
expect(optionsFromProps[2]).toHaveTextContent("Turtle");
|
|
49
|
-
expect(selectWithTags).toHaveAttribute("name", "animal");
|
|
50
|
-
expect(selectWithTags).toHaveAttribute("id", "animal-2");
|
|
51
|
-
expect(optionsFromTags).toHaveLength(3);
|
|
52
|
-
expect(optionsFromTags[0]).toHaveTextContent("Select an animal");
|
|
53
|
-
expect(optionsFromTags[1]).toHaveTextContent("Dog");
|
|
54
|
-
expect(optionsFromTags[2]).toHaveTextContent("Turtle");
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
export const customRender = {
|
|
58
|
-
name: "custom rendering, name, id, option groups",
|
|
59
|
-
render: () => (<Example>
|
|
60
|
-
<Example.Item title="custom with options">
|
|
61
|
-
<Select.Custom name="animal" id="animal-1" placeholder="Select an animal" inputAttributes={{
|
|
62
|
-
"aria-label": "Select an animal",
|
|
63
|
-
}}>
|
|
64
|
-
<Select.Option value="dog">Dog</Select.Option>
|
|
65
|
-
<Select.Option value="turtle">Turtle</Select.Option>
|
|
66
|
-
</Select.Custom>
|
|
67
|
-
</Example.Item>
|
|
68
|
-
<Example.Item title="native with option tags">
|
|
69
|
-
<Select.Custom name="animal-2" id="animal-2" placeholder="Select an animal" inputAttributes={{
|
|
70
|
-
"aria-label": "Select an animal",
|
|
71
|
-
}}>
|
|
72
|
-
<Select.OptionGroup label="Birds">
|
|
73
|
-
<Select.Option value="pigeon">Pigeon</Select.Option>
|
|
74
|
-
<Select.Option value="parrot">Parrot</Select.Option>
|
|
75
|
-
</Select.OptionGroup>
|
|
76
|
-
<Select.OptionGroup label="Sea Mammals">
|
|
77
|
-
<Select.Option value="whale">Whale</Select.Option>
|
|
78
|
-
<Select.Option value="dolphin">Dolphin</Select.Option>
|
|
79
|
-
</Select.OptionGroup>
|
|
80
|
-
</Select.Custom>
|
|
81
|
-
</Example.Item>
|
|
82
|
-
</Example>),
|
|
83
|
-
play: async ({ canvas, canvasElement, mount }) => {
|
|
84
|
-
await mount();
|
|
85
|
-
const [trigger] = canvas.getAllByRole("button");
|
|
86
|
-
const hiddenInputs = canvasElement.querySelectorAll('input[type="hidden"]');
|
|
87
|
-
const [hiddenInput] = Array.from(hiddenInputs);
|
|
88
|
-
// Testing only options
|
|
89
|
-
expect(hiddenInput).toHaveAttribute("name", "animal");
|
|
90
|
-
expect(hiddenInput).toHaveAttribute("id", "animal-1");
|
|
91
|
-
expect(trigger).toHaveTextContent("Select an animal");
|
|
92
|
-
await userEvent.click(trigger);
|
|
93
|
-
const options = within(canvasElement.ownerDocument.body).getAllByRole("option");
|
|
94
|
-
expect(options).toHaveLength(2);
|
|
95
|
-
expect(options[0]).toHaveTextContent("Dog");
|
|
96
|
-
expect(options[1]).toHaveTextContent("Turtle");
|
|
97
|
-
// Testing options with groups
|
|
98
|
-
// Remount to instantly close select
|
|
99
|
-
await mount();
|
|
100
|
-
const [_, triggerWithGroups] = canvas.getAllByRole("button");
|
|
101
|
-
const hiddenInputs2 = canvasElement.querySelectorAll('input[type="hidden"]');
|
|
102
|
-
const [__, hiddenInputWithGroups] = Array.from(hiddenInputs2);
|
|
103
|
-
await userEvent.click(triggerWithGroups);
|
|
104
|
-
const optionsWithGroups = within(canvasElement.ownerDocument.body).getAllByRole("option");
|
|
105
|
-
const optionGroups = within(canvasElement.ownerDocument.body).getAllByRole("group");
|
|
106
|
-
expect(hiddenInputWithGroups).toHaveAttribute("name", "animal-2");
|
|
107
|
-
expect(hiddenInputWithGroups).toHaveAttribute("id", "animal-2");
|
|
108
|
-
expect(triggerWithGroups).toHaveTextContent("Select an animal");
|
|
109
|
-
expect(optionGroups).toHaveLength(2);
|
|
110
|
-
expect(optionGroups[0]).toHaveTextContent("Birds");
|
|
111
|
-
expect(optionGroups[1]).toHaveTextContent("Sea Mammals");
|
|
112
|
-
expect(optionsWithGroups).toHaveLength(4);
|
|
113
|
-
expect(optionsWithGroups[0]).toHaveTextContent("Pigeon");
|
|
114
|
-
expect(optionsWithGroups[1]).toHaveTextContent("Parrot");
|
|
115
|
-
expect(optionsWithGroups[2]).toHaveTextContent("Whale");
|
|
116
|
-
expect(optionsWithGroups[3]).toHaveTextContent("Dolphin");
|
|
117
|
-
},
|
|
118
|
-
};
|
|
119
|
-
export const nativeHandlers = {
|
|
120
|
-
name: "native, controlled, uncontrolled, onFocus, onBlur, onChange",
|
|
121
|
-
args: {
|
|
122
|
-
handleChange: fn(),
|
|
123
|
-
handleControlledChange: fn(),
|
|
124
|
-
handleFocus: fn(),
|
|
125
|
-
handleBlur: fn(),
|
|
126
|
-
handleClick: fn(),
|
|
127
|
-
},
|
|
128
|
-
render: (args) => (<Example>
|
|
129
|
-
<Example.Item title="native, uncontrolled, onChange">
|
|
130
|
-
<Select name="animal" placeholder="Select an animal" defaultValue="dog" onChange={args.handleChange} inputAttributes={{
|
|
131
|
-
"aria-label": "Select an animal",
|
|
132
|
-
}}>
|
|
133
|
-
<option value="dog">Dog</option>
|
|
134
|
-
<option value="turtle">Turtle</option>
|
|
135
|
-
</Select>
|
|
136
|
-
</Example.Item>
|
|
137
|
-
<Example.Item title="native, controlled, onChange">
|
|
138
|
-
<Select name="animal-2" placeholder="Select an animal" value="dog" onChange={args.handleControlledChange} inputAttributes={{
|
|
139
|
-
"aria-label": "Select an animal",
|
|
140
|
-
}}>
|
|
141
|
-
<option value="dog">Dog</option>
|
|
142
|
-
<option value="turtle">Turtle</option>
|
|
143
|
-
</Select>
|
|
144
|
-
</Example.Item>
|
|
145
|
-
<Example.Item title="native, onFocus, onBlur, onClick">
|
|
146
|
-
<Select name="animal-3" placeholder="Select an animal" defaultValue="dog" onFocus={args.handleFocus} onBlur={args.handleBlur} onClick={args.handleClick} inputAttributes={{
|
|
147
|
-
"aria-label": "Select an animal",
|
|
148
|
-
}}>
|
|
149
|
-
<option value="dog">Dog</option>
|
|
150
|
-
<option value="turtle">Turtle</option>
|
|
151
|
-
</Select>
|
|
152
|
-
</Example.Item>
|
|
153
|
-
</Example>),
|
|
154
|
-
play: async ({ canvas, args }) => {
|
|
155
|
-
const [uncontrolled, controlled, focusable] = canvas.getAllByRole("combobox");
|
|
156
|
-
// Uncontrolled
|
|
157
|
-
expect(uncontrolled).toHaveValue("dog");
|
|
158
|
-
await userEvent.selectOptions(uncontrolled, "turtle");
|
|
159
|
-
expect(uncontrolled).toHaveValue("turtle");
|
|
160
|
-
expect(args.handleChange).toHaveBeenCalledTimes(1);
|
|
161
|
-
expect(args.handleChange).toHaveBeenCalledWith({
|
|
162
|
-
name: "animal",
|
|
163
|
-
value: "turtle",
|
|
164
|
-
event: expect.objectContaining({ target: uncontrolled }),
|
|
165
|
-
});
|
|
166
|
-
// Controlled
|
|
167
|
-
expect(controlled).toHaveValue("dog");
|
|
168
|
-
await userEvent.selectOptions(controlled, "turtle");
|
|
169
|
-
expect(controlled).toHaveValue("dog");
|
|
170
|
-
expect(args.handleControlledChange).toHaveBeenCalledTimes(1);
|
|
171
|
-
expect(args.handleControlledChange).toHaveBeenCalledWith({
|
|
172
|
-
name: "animal-2",
|
|
173
|
-
value: "turtle",
|
|
174
|
-
event: expect.objectContaining({ target: controlled }),
|
|
175
|
-
});
|
|
176
|
-
// Focus + blur
|
|
177
|
-
await userEvent.click(focusable);
|
|
178
|
-
expect(args.handleFocus).toHaveBeenCalledTimes(1);
|
|
179
|
-
expect(args.handleFocus).toHaveBeenCalledWith(expect.objectContaining({ target: focusable }));
|
|
180
|
-
expect(args.handleClick).toHaveBeenCalledTimes(1);
|
|
181
|
-
expect(args.handleClick).toHaveBeenCalledWith(expect.objectContaining({ target: focusable }));
|
|
182
|
-
await userEvent.click(document.body);
|
|
183
|
-
expect(args.handleBlur).toHaveBeenCalledTimes(1);
|
|
184
|
-
expect(args.handleBlur).toHaveBeenCalledWith(expect.objectContaining({ target: focusable }));
|
|
185
|
-
},
|
|
186
|
-
};
|
|
187
|
-
export const customHandlers = {
|
|
188
|
-
name: "custom, controlled, uncontrolled, onFocus, onBlur, onChange",
|
|
189
|
-
args: {
|
|
190
|
-
handleChange: fn(),
|
|
191
|
-
handleControlledChange: fn(),
|
|
192
|
-
handleFocus: fn(),
|
|
193
|
-
handleBlur: fn(),
|
|
194
|
-
handleClick: fn(),
|
|
195
|
-
},
|
|
196
|
-
render: (args) => (<Example>
|
|
197
|
-
<Example.Item title="custom, uncontrolled, onChange">
|
|
198
|
-
<Select.Custom name="animal" placeholder="Select an animal" defaultValue="dog" onChange={args.handleChange} inputAttributes={{
|
|
199
|
-
"aria-label": "Select an animal",
|
|
200
|
-
}}>
|
|
201
|
-
<Select.Option value="dog">Dog</Select.Option>
|
|
202
|
-
<Select.Option value="turtle">Turtle</Select.Option>
|
|
203
|
-
</Select.Custom>
|
|
204
|
-
</Example.Item>
|
|
205
|
-
<Example.Item title="custom, controlled, onChange">
|
|
206
|
-
<Select.Custom name="animal-2" placeholder="Select an animal" value="dog" onChange={args.handleControlledChange} inputAttributes={{
|
|
207
|
-
"aria-label": "Select an animal",
|
|
208
|
-
}}>
|
|
209
|
-
<Select.Option value="dog">Dog</Select.Option>
|
|
210
|
-
<Select.Option value="turtle">Turtle</Select.Option>
|
|
211
|
-
</Select.Custom>
|
|
212
|
-
</Example.Item>
|
|
213
|
-
<Example.Item title="native, onFocus, onBlur, onClick">
|
|
214
|
-
<Select.Custom name="animal-3" placeholder="Select an animal" defaultValue="dog" onFocus={args.handleFocus} onBlur={args.handleBlur} onClick={args.handleClick} inputAttributes={{
|
|
215
|
-
"aria-label": "Select an animal",
|
|
216
|
-
}}>
|
|
217
|
-
<Select.Option value="dog">Dog</Select.Option>
|
|
218
|
-
<Select.Option value="turtle">Turtle</Select.Option>
|
|
219
|
-
</Select.Custom>
|
|
220
|
-
</Example.Item>
|
|
221
|
-
</Example>),
|
|
222
|
-
play: async ({ canvas, canvasElement, args, mount }) => {
|
|
223
|
-
await mount();
|
|
224
|
-
const [uncontrolled] = canvas.getAllByRole("button");
|
|
225
|
-
const hiddenInputs = canvasElement.querySelectorAll('input[type="hidden"]');
|
|
226
|
-
const [inputUncontrolled] = Array.from(hiddenInputs);
|
|
227
|
-
// Uncontrolled
|
|
228
|
-
expect(inputUncontrolled).toHaveValue("dog");
|
|
229
|
-
await userEvent.click(uncontrolled);
|
|
230
|
-
const [_, uncontrolledOption] = within(canvasElement.ownerDocument.body).getAllByRole("option");
|
|
231
|
-
await userEvent.click(uncontrolledOption);
|
|
232
|
-
expect(inputUncontrolled).toHaveValue("turtle");
|
|
233
|
-
expect(args.handleChange).toHaveBeenCalledTimes(1);
|
|
234
|
-
expect(args.handleChange).toHaveBeenCalledWith({
|
|
235
|
-
name: "animal",
|
|
236
|
-
value: "turtle",
|
|
237
|
-
});
|
|
238
|
-
// Controlled
|
|
239
|
-
await mount();
|
|
240
|
-
const [__, controlled, focusable] = canvas.getAllByRole("button");
|
|
241
|
-
const hiddenInputs2 = canvasElement.querySelectorAll('input[type="hidden"]');
|
|
242
|
-
const [___, inputControlled] = Array.from(hiddenInputs2);
|
|
243
|
-
expect(inputControlled).toHaveValue("dog");
|
|
244
|
-
await userEvent.click(controlled);
|
|
245
|
-
const [____, controlledOption] = within(canvasElement.ownerDocument.body).getAllByRole("option");
|
|
246
|
-
await userEvent.click(controlledOption);
|
|
247
|
-
expect(inputControlled).toHaveValue("dog");
|
|
248
|
-
expect(args.handleControlledChange).toHaveBeenCalledTimes(1);
|
|
249
|
-
expect(args.handleControlledChange).toHaveBeenCalledWith({
|
|
250
|
-
name: "animal-2",
|
|
251
|
-
value: "turtle",
|
|
252
|
-
});
|
|
253
|
-
// Focus + blur + click
|
|
254
|
-
await userEvent.click(focusable);
|
|
255
|
-
expect(args.handleFocus).toHaveBeenCalledTimes(1);
|
|
256
|
-
expect(args.handleFocus).toHaveBeenCalledWith(expect.objectContaining({ target: focusable }));
|
|
257
|
-
expect(args.handleClick).toHaveBeenCalledTimes(1);
|
|
258
|
-
expect(args.handleClick).toHaveBeenCalledWith(expect.objectContaining({ target: focusable }));
|
|
259
|
-
await userEvent.click(document.body);
|
|
260
|
-
expect(args.handleBlur).toHaveBeenCalledTimes(1);
|
|
261
|
-
expect(args.handleBlur).toHaveBeenCalledWith(expect.objectContaining({ target: focusable }));
|
|
262
|
-
},
|
|
263
|
-
};
|
|
264
|
-
export const triggerOnly = {
|
|
265
|
-
name: "trigger only, onClick",
|
|
266
|
-
args: {
|
|
267
|
-
handleClick: fn(),
|
|
268
|
-
},
|
|
269
|
-
render: (args) => {
|
|
270
|
-
const toggle = useToggle();
|
|
271
|
-
const [value, setValue] = React.useState("Dog");
|
|
272
|
-
const handleClick = (e) => {
|
|
273
|
-
args.handleClick(e);
|
|
274
|
-
toggle.toggle();
|
|
275
|
-
};
|
|
276
|
-
return (<Example>
|
|
277
|
-
<Example.Item title="trigger only, onClick">
|
|
278
|
-
<Select name="animal" placeholder="Select an animal" onClick={handleClick} value="dog" inputAttributes={{
|
|
279
|
-
"aria-label": "Select an animal",
|
|
280
|
-
}}>
|
|
281
|
-
{value}
|
|
282
|
-
</Select>
|
|
283
|
-
<Modal active={toggle.active} onClose={toggle.deactivate} position="bottom" padding={2} attributes={{ "aria-label": "Select an animal" }}>
|
|
284
|
-
<div role="listbox" aria-label="Select an animal">
|
|
285
|
-
<MenuItem roundedCorners onClick={() => {
|
|
286
|
-
setValue("Dog");
|
|
287
|
-
toggle.deactivate();
|
|
288
|
-
}} attributes={{
|
|
289
|
-
role: "option",
|
|
290
|
-
}}>
|
|
291
|
-
Dog
|
|
292
|
-
</MenuItem>
|
|
293
|
-
<MenuItem roundedCorners attributes={{
|
|
294
|
-
role: "option",
|
|
295
|
-
}} onClick={() => {
|
|
296
|
-
setValue("Turtle");
|
|
297
|
-
toggle.deactivate();
|
|
298
|
-
}}>
|
|
299
|
-
Turtle
|
|
300
|
-
</MenuItem>
|
|
301
|
-
</div>
|
|
302
|
-
</Modal>
|
|
303
|
-
</Example.Item>
|
|
304
|
-
</Example>);
|
|
305
|
-
},
|
|
306
|
-
play: async ({ canvas, args, canvasElement }) => {
|
|
307
|
-
const [trigger] = canvas.getAllByRole("button");
|
|
308
|
-
const hiddenInputs = canvasElement.querySelectorAll('input[type="hidden"]');
|
|
309
|
-
const [input] = Array.from(hiddenInputs);
|
|
310
|
-
expect(trigger).toHaveTextContent("Dog");
|
|
311
|
-
expect(input).toHaveAttribute("name", "animal");
|
|
312
|
-
expect(input).toHaveValue("dog");
|
|
313
|
-
await userEvent.click(trigger);
|
|
314
|
-
expect(args.handleClick).toHaveBeenCalledTimes(1);
|
|
315
|
-
expect(args.handleClick).toHaveBeenCalledWith(expect.objectContaining({ target: trigger }));
|
|
316
|
-
},
|
|
317
|
-
};
|
|
318
|
-
export const multiple = {
|
|
319
|
-
name: "multiple",
|
|
320
|
-
args: {
|
|
321
|
-
handleChange: fn(),
|
|
322
|
-
},
|
|
323
|
-
render: (args) => (<Example>
|
|
324
|
-
<Example.Item title="multiple">
|
|
325
|
-
<Select.Custom multiple name="animal" placeholder="Select an animal" defaultValue={["dog"]} onChange={args.handleChange}>
|
|
326
|
-
<Select.Option value="dog">Dog</Select.Option>
|
|
327
|
-
<Select.Option value="turtle">Turtle</Select.Option>
|
|
328
|
-
</Select.Custom>
|
|
329
|
-
</Example.Item>
|
|
330
|
-
</Example>),
|
|
331
|
-
play: async ({ canvas, canvasElement, args }) => {
|
|
332
|
-
const [uncontrolled] = canvas.getAllByRole("button");
|
|
333
|
-
const hiddenInputs = canvasElement.querySelectorAll('input[type="hidden"]');
|
|
334
|
-
const [inputUncontrolled] = Array.from(hiddenInputs);
|
|
335
|
-
// Uncontrolled
|
|
336
|
-
expect(inputUncontrolled).toHaveValue('["dog"]');
|
|
337
|
-
await userEvent.click(uncontrolled);
|
|
338
|
-
const [_, uncontrolledOption] = within(canvasElement.ownerDocument.body).getAllByRole("option");
|
|
339
|
-
await userEvent.click(uncontrolledOption);
|
|
340
|
-
expect(inputUncontrolled).toHaveValue('["dog","turtle"]');
|
|
341
|
-
expect(args.handleChange).toHaveBeenCalledTimes(1);
|
|
342
|
-
expect(args.handleChange).toHaveBeenCalledWith({
|
|
343
|
-
name: "animal",
|
|
344
|
-
value: ["dog", "turtle"],
|
|
345
|
-
});
|
|
346
|
-
},
|
|
347
|
-
};
|
|
348
|
-
export const variant = {
|
|
349
|
-
name: "variant",
|
|
350
|
-
render: () => (<Example>
|
|
351
|
-
<Example.Item title="variant: faded, native">
|
|
352
|
-
<Select variant="faded" name="animal" placeholder="Select an animal" inputAttributes={{ "aria-label": "Select an animal" }}>
|
|
353
|
-
<option value="dog">Dog</option>
|
|
354
|
-
<option value="turtle">Turtle</option>
|
|
355
|
-
</Select>
|
|
356
|
-
</Example.Item>
|
|
357
|
-
|
|
358
|
-
<Example.Item title="variant: faded, custom">
|
|
359
|
-
<Select.Custom variant="faded" name="animal-2" placeholder="Select an animal" inputAttributes={{ "aria-label": "Select an animal" }}>
|
|
360
|
-
<Select.Option value="dog">Dog</Select.Option>
|
|
361
|
-
<Select.Option value="turtle">Turtle</Select.Option>
|
|
362
|
-
</Select.Custom>
|
|
363
|
-
</Example.Item>
|
|
364
|
-
|
|
365
|
-
<Example.Item title="variant: headless, native">
|
|
366
|
-
<Select variant="headless" name="animal-3" placeholder="Select an animal" inputAttributes={{ "aria-label": "Select an animal" }}>
|
|
367
|
-
<option value="dog">Dog</option>
|
|
368
|
-
<option value="turtle">Turtle</option>
|
|
369
|
-
</Select>
|
|
370
|
-
</Example.Item>
|
|
371
|
-
|
|
372
|
-
<Example.Item title="variant: headless, custom">
|
|
373
|
-
<Select.Custom variant="headless" name="animal-4" placeholder="Select an animal" inputAttributes={{ "aria-label": "Select an animal" }}>
|
|
374
|
-
<Select.Option value="dog">Dog</Select.Option>
|
|
375
|
-
<Select.Option value="turtle">Turtle</Select.Option>
|
|
376
|
-
</Select.Custom>
|
|
377
|
-
</Example.Item>
|
|
378
|
-
</Example>),
|
|
379
|
-
};
|
|
380
|
-
export const size = {
|
|
381
|
-
name: "size",
|
|
382
|
-
render: () => (<Example>
|
|
383
|
-
<Example.Item title="size: small">
|
|
384
|
-
<Select.Custom size="small" name="animal" placeholder="Select an animal">
|
|
385
|
-
<Select.Option value="dog">Dog</Select.Option>
|
|
386
|
-
<Select.Option value="turtle">Turtle</Select.Option>
|
|
387
|
-
</Select.Custom>
|
|
388
|
-
</Example.Item>
|
|
389
|
-
<Example.Item title="size: medium">
|
|
390
|
-
<Select.Custom size="medium" name="animal" placeholder="Select an animal">
|
|
391
|
-
<Select.Option value="dog">Dog</Select.Option>
|
|
392
|
-
<Select.Option value="turtle">Turtle</Select.Option>
|
|
393
|
-
</Select.Custom>
|
|
394
|
-
</Example.Item>
|
|
395
|
-
<Example.Item title="size: large">
|
|
396
|
-
<Select.Custom size="large" name="animal" placeholder="Select an animal">
|
|
397
|
-
<Select.Option value="dog">Dog</Select.Option>
|
|
398
|
-
<Select.Option value="turtle">Turtle</Select.Option>
|
|
399
|
-
</Select.Custom>
|
|
400
|
-
</Example.Item>
|
|
401
|
-
<Example.Item title="size: xlarge">
|
|
402
|
-
<Select.Custom size="xlarge" name="animal" placeholder="Select an animal">
|
|
403
|
-
<Select.Option value="dog">Dog</Select.Option>
|
|
404
|
-
<Select.Option value="turtle">Turtle</Select.Option>
|
|
405
|
-
</Select.Custom>
|
|
406
|
-
</Example.Item>
|
|
407
|
-
</Example>),
|
|
408
|
-
};
|
|
409
|
-
export const startSlot = {
|
|
410
|
-
name: "icon,startSlot",
|
|
411
|
-
render: () => (<Example>
|
|
412
|
-
<Example.Item title="icon">
|
|
413
|
-
<Select.Custom name="animal" placeholder="Select an animal" icon={IconZap}>
|
|
414
|
-
<Select.Option value="dog">Dog</Select.Option>
|
|
415
|
-
<Select.Option value="turtle">Turtle</Select.Option>
|
|
416
|
-
</Select.Custom>
|
|
417
|
-
</Example.Item>
|
|
418
|
-
|
|
419
|
-
<Example.Item title="startSlot">
|
|
420
|
-
<Select.Custom name="animal" placeholder="Select an animal" startSlot={<Placeholder h={20}/>}>
|
|
421
|
-
<Select.Option value="dog">Dog</Select.Option>
|
|
422
|
-
<Select.Option value="turtle">Turtle</Select.Option>
|
|
423
|
-
</Select.Custom>
|
|
424
|
-
</Example.Item>
|
|
425
|
-
</Example>),
|
|
426
|
-
};
|
|
427
|
-
export const error = {
|
|
428
|
-
name: "error",
|
|
429
|
-
render: () => (<Example>
|
|
430
|
-
<Example.Item title="error">
|
|
431
|
-
<Select.Custom name="animal" placeholder="Select an animal" hasError>
|
|
432
|
-
<Select.Option value="dog">Dog</Select.Option>
|
|
433
|
-
<Select.Option value="turtle">Turtle</Select.Option>
|
|
434
|
-
</Select.Custom>
|
|
435
|
-
</Example.Item>
|
|
436
|
-
</Example>),
|
|
437
|
-
};
|
|
438
|
-
export const disabled = {
|
|
439
|
-
name: "disabled",
|
|
440
|
-
render: () => (<Example>
|
|
441
|
-
<Example.Item title="disabled, native">
|
|
442
|
-
<Select name="animal" placeholder="Select an animal" disabled inputAttributes={{ "aria-label": "Select an animal" }}>
|
|
443
|
-
<option value="dog">Dog</option>
|
|
444
|
-
<option value="turtle">Turtle</option>
|
|
445
|
-
</Select>
|
|
446
|
-
</Example.Item>
|
|
447
|
-
<Example.Item title="disabled, custom">
|
|
448
|
-
<Select.Custom name="animal-2" placeholder="Select an animal" disabled inputAttributes={{ "aria-label": "Select an animal" }}>
|
|
449
|
-
<Select.Option value="dog">Dog</Select.Option>
|
|
450
|
-
<Select.Option value="turtle">Turtle</Select.Option>
|
|
451
|
-
</Select.Custom>
|
|
452
|
-
</Example.Item>
|
|
453
|
-
</Example>),
|
|
454
|
-
play: ({ canvas }) => {
|
|
455
|
-
const [native] = canvas.getAllByRole("combobox");
|
|
456
|
-
const [custom] = canvas.getAllByRole("button");
|
|
457
|
-
expect(native).toBeDisabled();
|
|
458
|
-
expect(custom).toBeDisabled();
|
|
459
|
-
},
|
|
460
|
-
};
|
|
461
|
-
export const className = {
|
|
462
|
-
name: "className, attributes, inputAttributes",
|
|
463
|
-
render: () => (<Example>
|
|
464
|
-
<Example.Item title="native, className, attributes, inputAttributes">
|
|
465
|
-
<Select name="animal" placeholder="Select an animal" className="native-class" attributes={{ id: "test-id" }} inputAttributes={{ "aria-label": "test-label" }}>
|
|
466
|
-
<option value="dog">Dog</option>
|
|
467
|
-
<option value="turtle">Turtle</option>
|
|
468
|
-
</Select>
|
|
469
|
-
</Example.Item>
|
|
470
|
-
<Example.Item title="custom, className, attributes, inputAttributes">
|
|
471
|
-
<Select.Custom name="animal" placeholder="Select an animal" className="custom-class" attributes={{ id: "test-id" }} inputAttributes={{ "aria-label": "test-label" }}>
|
|
472
|
-
<Select.Option value="dog">Dog</Select.Option>
|
|
473
|
-
<Select.Option value="turtle">Turtle</Select.Option>
|
|
474
|
-
</Select.Custom>
|
|
475
|
-
</Example.Item>
|
|
476
|
-
</Example>),
|
|
477
|
-
play: ({ canvas, canvasElement }) => {
|
|
478
|
-
const native = canvasElement.querySelector(".native-class");
|
|
479
|
-
const nativeInput = canvas.getByRole("combobox");
|
|
480
|
-
const custom = canvasElement.querySelector(".custom-class");
|
|
481
|
-
const [customTrigger] = canvas.getAllByRole("button");
|
|
482
|
-
expect(native).toHaveAttribute("id", "test-id");
|
|
483
|
-
expect(nativeInput).toHaveAttribute("aria-label", "test-label");
|
|
484
|
-
expect(custom).toHaveAttribute("id", "test-id");
|
|
485
|
-
expect(customTrigger).toHaveAttribute("aria-label", "test-label");
|
|
486
|
-
},
|
|
487
|
-
};
|
|
488
|
-
export const fallback = {
|
|
489
|
-
name: "test: fallbackAdjustLayout",
|
|
490
|
-
render: () => (<Example>
|
|
491
|
-
<Example.Item title="fallback">
|
|
492
|
-
<Select.Custom name="animal" placeholder="Select an animal" inputAttributes={{ "aria-label": "Select an animal" }}>
|
|
493
|
-
{[...Array(100)].map((_, index) => (<Select.Option key={index} value={`item-${index}`}>
|
|
494
|
-
Item {index + 1}
|
|
495
|
-
</Select.Option>))}
|
|
496
|
-
</Select.Custom>
|
|
497
|
-
<div style={{ height: "1000px" }}></div>
|
|
498
|
-
<Select.Custom name="animal" placeholder="Select an animal" inputAttributes={{ "aria-label": "Select an animal" }}>
|
|
499
|
-
{[...Array(100)].map((_, index) => (<Select.Option key={index} value={`item-${index}`}>
|
|
500
|
-
Item {index + 1}
|
|
501
|
-
</Select.Option>))}
|
|
502
|
-
</Select.Custom>
|
|
503
|
-
</Example.Item>
|
|
504
|
-
</Example>),
|
|
505
|
-
};
|
|
506
|
-
export const formControl = {
|
|
507
|
-
name: "test: with FormControl",
|
|
508
|
-
render: () => (<Example>
|
|
509
|
-
<Example.Item title="FormControl">
|
|
510
|
-
<FormControl hasError>
|
|
511
|
-
<FormControl.Label>Animal</FormControl.Label>
|
|
512
|
-
<Select.Custom name="animal" placeholder="Select an animal">
|
|
513
|
-
<Select.Option value="dog">Dog</Select.Option>
|
|
514
|
-
<Select.Option value="turtle">Turtle</Select.Option>
|
|
515
|
-
</Select.Custom>
|
|
516
|
-
<FormControl.Error>This field is required</FormControl.Error>
|
|
517
|
-
</FormControl>
|
|
518
|
-
</Example.Item>
|
|
519
|
-
</Example>),
|
|
520
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
|
2
|
-
declare const _default: {
|
|
3
|
-
title: string;
|
|
4
|
-
component: import("react").FC<import("./..").SkeletonProps>;
|
|
5
|
-
parameters: {
|
|
6
|
-
iframe: {
|
|
7
|
-
url: string;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export default _default;
|
|
12
|
-
export declare const variant: {
|
|
13
|
-
name: string;
|
|
14
|
-
render: () => import("react").JSX.Element;
|
|
15
|
-
};
|
|
16
|
-
export declare const radius: {
|
|
17
|
-
name: string;
|
|
18
|
-
render: () => import("react").JSX.Element;
|
|
19
|
-
};
|
|
20
|
-
export declare const className: StoryObj;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { Example } from "../../../utilities/storybook/index.js";
|
|
2
|
-
import Skeleton from "../index.js";
|
|
3
|
-
import { expect } from "storybook/test";
|
|
4
|
-
export default {
|
|
5
|
-
title: "Components/Skeleton",
|
|
6
|
-
component: Skeleton,
|
|
7
|
-
parameters: {
|
|
8
|
-
iframe: {
|
|
9
|
-
url: "https://reshaped.so/docs/components/skeleton",
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
export const variant = {
|
|
14
|
-
name: "variant",
|
|
15
|
-
render: () => (<Example>
|
|
16
|
-
<Example.Item title="text">
|
|
17
|
-
<Skeleton />
|
|
18
|
-
</Example.Item>
|
|
19
|
-
|
|
20
|
-
<Example.Item title="view, rectangle">
|
|
21
|
-
<Skeleton width="100px" height="100px"/>
|
|
22
|
-
</Example.Item>
|
|
23
|
-
|
|
24
|
-
<Example.Item title="view, circle">
|
|
25
|
-
<Skeleton width="100px" height="100px" borderRadius="circular"/>
|
|
26
|
-
</Example.Item>
|
|
27
|
-
|
|
28
|
-
<Example.Item title="view, rectangle, responsive">
|
|
29
|
-
<Skeleton width={{ s: "100px", m: "200px" }} height={{ s: "100px", m: "200px" }}/>
|
|
30
|
-
</Example.Item>
|
|
31
|
-
</Example>),
|
|
32
|
-
};
|
|
33
|
-
export const radius = {
|
|
34
|
-
name: "radius",
|
|
35
|
-
render: () => (<Example>
|
|
36
|
-
<Example.Item title="radius=small">
|
|
37
|
-
<Skeleton width="60px" height="60px" borderRadius="small"/>
|
|
38
|
-
</Example.Item>
|
|
39
|
-
|
|
40
|
-
<Example.Item title="radius=medium">
|
|
41
|
-
<Skeleton width="60px" height="60px" borderRadius="medium"/>
|
|
42
|
-
</Example.Item>
|
|
43
|
-
|
|
44
|
-
<Example.Item title="radius=large">
|
|
45
|
-
<Skeleton width="60px" height="60px" borderRadius="large"/>
|
|
46
|
-
</Example.Item>
|
|
47
|
-
|
|
48
|
-
<Example.Item title="radius=circular">
|
|
49
|
-
<Skeleton width="60px" height="60px" borderRadius="circular"/>
|
|
50
|
-
</Example.Item>
|
|
51
|
-
</Example>),
|
|
52
|
-
};
|
|
53
|
-
export const className = {
|
|
54
|
-
name: "className, attributes",
|
|
55
|
-
render: () => (<div data-testid="root">
|
|
56
|
-
<Skeleton className="test-classname" attributes={{ id: "test-id" }}/>
|
|
57
|
-
</div>),
|
|
58
|
-
play: async ({ canvas }) => {
|
|
59
|
-
const root = canvas.getByTestId("root").firstChild;
|
|
60
|
-
expect(root).toHaveClass("test-classname");
|
|
61
|
-
expect(root).toHaveAttribute("id", "test-id");
|
|
62
|
-
},
|
|
63
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { StoryObj } from "@storybook/react-vite";
|
|
3
|
-
import { Mock } from "storybook/test";
|
|
4
|
-
declare const _default: {
|
|
5
|
-
title: string;
|
|
6
|
-
component: React.FC<import("./..").SliderProps>;
|
|
7
|
-
parameters: {
|
|
8
|
-
iframe: {
|
|
9
|
-
url: string;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
export default _default;
|
|
14
|
-
export declare const base: StoryObj;
|
|
15
|
-
export declare const orientation: {
|
|
16
|
-
name: string;
|
|
17
|
-
render: () => React.JSX.Element;
|
|
18
|
-
};
|
|
19
|
-
export declare const minMax: StoryObj;
|
|
20
|
-
export declare const step: StoryObj;
|
|
21
|
-
export declare const disabled: StoryObj;
|
|
22
|
-
export declare const renderValue: StoryObj;
|
|
23
|
-
export declare const defaultValue: StoryObj<{
|
|
24
|
-
handleChange: Mock;
|
|
25
|
-
handleChangeCommit: Mock;
|
|
26
|
-
}>;
|
|
27
|
-
export declare const value: StoryObj<{
|
|
28
|
-
handleChange: Mock;
|
|
29
|
-
handleChangeCommit: Mock;
|
|
30
|
-
}>;
|
|
31
|
-
export declare const rangeDefaultValue: StoryObj<{
|
|
32
|
-
handleChange: Mock;
|
|
33
|
-
handleChangeCommit: Mock;
|
|
34
|
-
}>;
|
|
35
|
-
export declare const rangeValue: StoryObj<{
|
|
36
|
-
handleChange: Mock;
|
|
37
|
-
handleChangeCommit: Mock;
|
|
38
|
-
}>;
|
|
39
|
-
export declare const className: StoryObj;
|
|
40
|
-
export declare const testForm: StoryObj<{
|
|
41
|
-
handleFormChange: Mock;
|
|
42
|
-
handleFormInit: Mock;
|
|
43
|
-
}>;
|
|
44
|
-
export declare const testSwipe: {
|
|
45
|
-
name: string;
|
|
46
|
-
render: () => React.JSX.Element;
|
|
47
|
-
};
|