reshaped 3.8.0-canary.1 → 3.8.0-canary.10
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 +83 -18
- package/dist/bundle.css +1 -1
- package/dist/bundle.d.ts +1 -1
- package/dist/bundle.js +11 -11
- package/dist/components/Accordion/AccordionControlled.js +1 -0
- package/dist/components/Actionable/Actionable.js +17 -3
- package/dist/components/Actionable/Actionable.module.css +1 -1
- package/dist/components/Actionable/Actionable.types.d.ts +15 -3
- package/dist/components/Actionable/tests/Actionable.stories.d.ts +13 -1
- package/dist/components/Actionable/tests/Actionable.stories.js +127 -7
- package/dist/components/Alert/tests/Alert.stories.d.ts +6 -5
- package/dist/components/Alert/tests/Alert.stories.js +15 -2
- package/dist/components/Autocomplete/Autocomplete.js +2 -2
- package/dist/components/Autocomplete/Autocomplete.types.d.ts +1 -1
- package/dist/components/Badge/Badge.module.css +1 -1
- package/dist/components/Badge/tests/Badge.stories.d.ts +5 -0
- package/dist/components/Badge/tests/Badge.stories.js +34 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js +1 -0
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.d.ts +8 -4
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.stories.js +57 -1
- package/dist/components/Button/Button.js +2 -2
- package/dist/components/Button/Button.types.d.ts +1 -1
- package/dist/components/Button/tests/Button.stories.d.ts +54 -12
- package/dist/components/Button/tests/Button.stories.js +725 -588
- package/dist/components/Calendar/CalendarMonth.js +1 -0
- package/dist/components/Card/Card.d.ts +1 -1
- package/dist/components/Card/Card.module.css +1 -1
- package/dist/components/Card/tests/Card.stories.d.ts +29 -7
- package/dist/components/Card/tests/Card.stories.js +110 -65
- package/dist/components/Carousel/Carousel.js +1 -0
- package/dist/components/Carousel/Carousel.module.css +1 -1
- package/dist/components/Checkbox/Checkbox.module.css +1 -1
- package/dist/components/Checkbox/tests/Checkbox.stories.d.ts +20 -4
- package/dist/components/Checkbox/tests/Checkbox.stories.js +150 -79
- package/dist/components/CheckboxGroup/tests/CheckboxGroup.stories.d.ts +9 -2
- package/dist/components/CheckboxGroup/tests/CheckboxGroup.stories.js +67 -35
- package/dist/components/Container/tests/Container.stories.d.ts +2 -0
- package/dist/components/Container/tests/Container.stories.js +14 -0
- package/dist/components/ContextMenu/tests/ContextMenu.stories.d.ts +10 -1
- package/dist/components/ContextMenu/tests/ContextMenu.stories.js +57 -13
- package/dist/components/Dismissible/tests/Dismissible.stories.d.ts +5 -0
- package/dist/components/Dismissible/tests/Dismissible.stories.js +30 -1
- package/dist/components/Divider/tests/Divider.stories.d.ts +8 -3
- package/dist/components/Divider/tests/Divider.stories.js +71 -41
- package/dist/components/DropdownMenu/DropdownMenu.js +4 -4
- package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +2 -2
- package/dist/components/DropdownMenu/tests/DropdownMenu.stories.d.ts +35 -6
- package/dist/components/DropdownMenu/tests/DropdownMenu.stories.js +222 -115
- package/dist/components/DropdownMenu/tests/DropdownMenu.test.stories.d.ts +0 -15
- package/dist/components/DropdownMenu/tests/DropdownMenu.test.stories.js +0 -106
- package/dist/components/FileUpload/FileUpload.module.css +1 -1
- package/dist/components/Flyout/Flyout.module.css +1 -1
- package/dist/components/Flyout/Flyout.types.d.ts +7 -7
- package/dist/components/Flyout/FlyoutContent.js +4 -1
- package/dist/components/Flyout/FlyoutControlled.js +10 -3
- package/dist/components/Flyout/index.d.ts +1 -1
- package/dist/components/Flyout/tests/Flyout.stories.d.ts +8 -0
- package/dist/components/Flyout/tests/Flyout.stories.js +81 -33
- package/dist/components/Flyout/useFlyout.d.ts +1 -7
- package/dist/components/Flyout/useFlyout.js +5 -1
- package/dist/components/Flyout/utilities/calculatePosition.d.ts +3 -2
- package/dist/components/Flyout/utilities/calculatePosition.js +47 -22
- package/dist/components/Flyout/utilities/flyout.js +3 -2
- package/dist/components/Flyout/utilities/getPositionFallbacks.js +3 -3
- package/dist/components/Flyout/utilities/isFullyVisible.d.ts +0 -2
- package/dist/components/Flyout/utilities/isFullyVisible.js +5 -7
- package/dist/components/FormControl/FormControl.context.d.ts +1 -1
- package/dist/components/FormControl/tests/FormControl.stories.d.ts +2 -0
- package/dist/components/FormControl/tests/FormControl.stories.js +35 -0
- package/dist/components/Hidden/tests/Hidden.stories.d.ts +2 -0
- package/dist/components/Hidden/tests/Hidden.stories.js +9 -0
- package/dist/components/HiddenVisually/tests/HiddenVisually.stories.d.ts +2 -0
- package/dist/components/HiddenVisually/tests/HiddenVisually.stories.js +9 -0
- package/dist/components/Hotkey/tests/Hotkey.stories.d.ts +2 -0
- package/dist/components/Hotkey/tests/Hotkey.stories.js +15 -0
- package/dist/components/Icon/Icon.js +2 -2
- package/dist/components/Icon/Icon.types.d.ts +1 -1
- package/dist/components/Icon/tests/Icon.stories.d.ts +3 -0
- package/dist/components/Icon/tests/Icon.stories.js +29 -1
- package/dist/components/Link/Link.d.ts +1 -1
- package/dist/components/Link/Link.js +2 -2
- package/dist/components/Link/Link.types.d.ts +1 -1
- package/dist/components/Link/tests/Link.stories.d.ts +29 -6
- package/dist/components/Link/tests/Link.stories.js +141 -58
- package/dist/components/Link/tests/Link.test.stories.d.ts +1 -13
- package/dist/components/Link/tests/Link.test.stories.js +0 -76
- package/dist/components/Loader/tests/Loader.stories.d.ts +11 -2
- package/dist/components/Loader/tests/Loader.stories.js +52 -25
- package/dist/components/Loader/tests/Loader.test.stories.d.ts +0 -3
- package/dist/components/Loader/tests/Loader.test.stories.js +0 -21
- package/dist/components/MenuItem/MenuItem.js +2 -2
- package/dist/components/MenuItem/MenuItem.module.css +1 -1
- package/dist/components/MenuItem/MenuItem.types.d.ts +1 -1
- package/dist/components/MenuItem/tests/MenuItem.stories.d.ts +37 -7
- package/dist/components/MenuItem/tests/MenuItem.stories.js +218 -112
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/Modal/Modal.module.css +1 -1
- package/dist/components/Modal/tests/Modal.stories.d.ts +53 -10
- package/dist/components/Modal/tests/Modal.stories.js +367 -210
- package/dist/components/Overlay/Overlay.js +2 -1
- package/dist/components/Overlay/tests/Overlay.stories.d.ts +15 -1
- package/dist/components/Overlay/tests/Overlay.stories.js +135 -1
- package/dist/components/Pagination/tests/Pagination.stories.d.ts +14 -1
- package/dist/components/Pagination/tests/Pagination.stories.js +93 -15
- package/dist/components/PinField/tests/PinField.stories.d.ts +1 -1
- package/dist/components/PinField/tests/PinField.stories.js +1 -1
- package/dist/components/Popover/Popover.js +2 -2
- package/dist/components/Popover/Popover.module.css +1 -1
- package/dist/components/Popover/Popover.types.d.ts +3 -1
- package/dist/components/Progress/tests/Progress.stories.d.ts +19 -4
- package/dist/components/Progress/tests/Progress.stories.js +85 -49
- package/dist/components/Radio/Radio.module.css +1 -1
- package/dist/components/Radio/tests/Radio.stories.d.ts +25 -4
- package/dist/components/Radio/tests/Radio.stories.js +147 -65
- package/dist/components/RadioGroup/tests/RadioGroup.stories.d.ts +9 -2
- package/dist/components/RadioGroup/tests/RadioGroup.stories.js +64 -38
- package/dist/components/Reshaped/Reshaped.css +1 -1
- package/dist/components/Scrim/tests/Scrim.stories.d.ts +10 -2
- package/dist/components/Scrim/tests/Scrim.stories.js +51 -31
- package/dist/components/ScrollArea/ScrollArea.module.css +1 -1
- package/dist/components/Select/Select.d.ts +8 -1
- package/dist/components/Select/Select.js +22 -48
- package/dist/components/Select/Select.module.css +1 -1
- package/dist/components/Select/Select.types.d.ts +83 -38
- package/dist/components/Select/SelectCustom.d.ts +3 -0
- package/dist/components/Select/SelectCustom.js +12 -0
- package/dist/components/Select/SelectCustomControlled.d.ts +4 -0
- package/dist/components/Select/SelectCustomControlled.js +105 -0
- package/dist/components/Select/SelectCustomUncontrolled.d.ts +4 -0
- package/dist/components/Select/SelectCustomUncontrolled.js +18 -0
- package/dist/components/Select/SelectEndContent.d.ts +3 -0
- package/dist/components/Select/SelectEndContent.js +12 -0
- package/dist/components/Select/SelectNative.d.ts +4 -0
- package/dist/components/Select/SelectNative.js +29 -0
- package/dist/components/Select/SelectOption.d.ts +4 -0
- package/dist/components/Select/SelectOption.js +13 -0
- package/dist/components/Select/SelectOptionGroup.d.ts +4 -0
- package/dist/components/Select/SelectOptionGroup.js +9 -0
- package/dist/components/Select/SelectRoot.d.ts +4 -0
- package/dist/components/Select/SelectRoot.js +21 -0
- package/dist/components/Select/SelectStartContent.d.ts +3 -0
- package/dist/components/Select/SelectStartContent.js +20 -0
- package/dist/components/Select/SelectTrigger.d.ts +4 -0
- package/dist/components/Select/SelectTrigger.js +16 -0
- package/dist/components/Select/tests/Select.stories.d.ts +38 -10
- package/dist/components/Select/tests/Select.stories.js +504 -175
- package/dist/components/Skeleton/tests/Skeleton.stories.d.ts +10 -2
- package/dist/components/Skeleton/tests/Skeleton.stories.js +46 -28
- package/dist/components/Slider/Slider.module.css +1 -1
- package/dist/components/Stepper/Stepper.js +2 -2
- package/dist/components/Stepper/Stepper.types.d.ts +2 -0
- package/dist/components/Stepper/tests/Stepper.stories.d.ts +18 -3
- package/dist/components/Stepper/tests/Stepper.stories.js +99 -47
- package/dist/components/Switch/Switch.module.css +1 -1
- package/dist/components/Switch/tests/Switch.stories.d.ts +10 -2
- package/dist/components/Switch/tests/Switch.stories.js +77 -23
- package/dist/components/Switch/tests/Switch.test.stories.d.ts +0 -10
- package/dist/components/Switch/tests/Switch.test.stories.js +0 -68
- package/dist/components/Table/Table.js +5 -3
- package/dist/components/Table/Table.module.css +1 -1
- package/dist/components/Table/tests/Table.stories.d.ts +25 -5
- package/dist/components/Table/tests/Table.stories.js +274 -177
- package/dist/components/Table/tests/Table.test.stories.d.ts +0 -5
- package/dist/components/Table/tests/Table.test.stories.js +0 -82
- package/dist/components/Tabs/Tabs.module.css +1 -1
- package/dist/components/Tabs/TabsControlled.js +1 -0
- package/dist/components/TextArea/TextArea.module.css +1 -1
- package/dist/components/TextArea/tests/TextArea.stories.d.ts +41 -9
- package/dist/components/TextArea/tests/TextArea.stories.js +179 -93
- package/dist/components/TextField/TextField.js +1 -1
- package/dist/components/TextField/TextField.module.css +1 -1
- package/dist/components/TextField/tests/TextField.stories.d.ts +41 -11
- package/dist/components/TextField/tests/TextField.stories.js +206 -132
- package/dist/components/TextField/tests/TextField.test.stories.d.ts +0 -13
- package/dist/components/TextField/tests/TextField.test.stories.js +0 -88
- package/dist/components/Theme/Theme.module.css +1 -1
- package/dist/components/Timeline/Timeline.js +2 -2
- package/dist/components/Timeline/tests/Timeline.stories.d.ts +10 -2
- package/dist/components/Timeline/tests/Timeline.stories.js +69 -45
- package/dist/components/Timeline/tests/Timeline.test.stories.d.ts +0 -2
- package/dist/components/Timeline/tests/Timeline.test.stories.js +0 -21
- package/dist/components/Toast/ToastContainer.js +1 -0
- package/dist/components/Toast/ToastRegion.js +1 -0
- package/dist/components/Toast/tests/Toast.stories.d.ts +32 -8
- package/dist/components/Toast/tests/Toast.stories.js +111 -37
- package/dist/components/ToggleButton/ToggleButton.types.d.ts +1 -1
- package/dist/components/ToggleButtonGroup/ToggleButtonGroupControlled.js +1 -0
- package/dist/components/Tooltip/Tooltip.js +1 -1
- package/dist/components/Tooltip/Tooltip.types.d.ts +2 -2
- package/dist/components/Tooltip/tests/Tooltip.stories.d.ts +18 -4
- package/dist/components/Tooltip/tests/Tooltip.stories.js +139 -107
- package/dist/components/Tooltip/tests/Tooltip.test.stories.d.ts +0 -6
- package/dist/components/Tooltip/tests/Tooltip.test.stories.js +0 -29
- package/dist/components/View/View.js +11 -4
- package/dist/components/View/tests/View.stories.d.ts +4 -0
- package/dist/components/View/tests/View.stories.js +39 -0
- package/dist/components/_private/Expandable/Expandable.js +3 -1
- package/dist/components/_private/Portal/Portal.js +4 -1
- package/dist/hooks/_private/useIsDismissible.d.ts +1 -0
- package/dist/hooks/_private/useIsDismissible.js +6 -6
- package/dist/hooks/_private/usePrevious.js +1 -0
- package/dist/hooks/tests/useDrag.stories.js +1 -1
- package/dist/hooks/useScrollLock.js +5 -3
- package/dist/index.d.ts +1 -1
- package/dist/styles/resolvers/align/align.css +1 -1
- package/dist/styles/resolvers/aspectRatio/aspectRatio.css +1 -1
- package/dist/styles/resolvers/bleed/bleed.module.css +1 -1
- package/dist/styles/resolvers/justify/justify.css +1 -1
- package/dist/styles/resolvers/maxHeight/maxHeight.module.css +1 -1
- package/dist/styles/resolvers/maxWidth/maxWidth.module.css +1 -1
- package/dist/styles/resolvers/minHeight/minHeight.module.css +1 -1
- package/dist/styles/resolvers/minWidth/minWidth.module.css +1 -1
- package/dist/styles/resolvers/position/position.css +1 -1
- package/dist/styles/resolvers/textAlign/textAlign.css +1 -1
- package/dist/styles/resolvers/width/width.module.css +1 -1
- package/dist/utilities/scroll/disable.js +2 -2
- package/dist/utilities/scroll/index.d.ts +1 -1
- package/dist/utilities/scroll/index.js +1 -1
- package/dist/utilities/scroll/lock.d.ts +1 -2
- package/dist/utilities/scroll/lock.js +16 -15
- package/dist/utilities/scroll/lockSafari.js +1 -0
- package/package.json +23 -23
- package/dist/components/Actionable/tests/Actionable.test.stories.d.ts +0 -32
- package/dist/components/Actionable/tests/Actionable.test.stories.js +0 -130
- package/dist/components/Alert/tests/Alert.test.stories.d.ts +0 -15
- package/dist/components/Alert/tests/Alert.test.stories.js +0 -26
- package/dist/components/Badge/tests/Badge.test.stories.d.ts +0 -20
- package/dist/components/Badge/tests/Badge.test.stories.js +0 -46
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.test.stories.d.ts +0 -23
- package/dist/components/Breadcrumbs/tests/Breadcrumbs.test.stories.js +0 -76
- package/dist/components/Button/tests/Button.test.stories.d.ts +0 -27
- package/dist/components/Button/tests/Button.test.stories.js +0 -112
- package/dist/components/Card/tests/Card.test.stories.d.ts +0 -35
- package/dist/components/Card/tests/Card.test.stories.js +0 -54
- package/dist/components/Checkbox/tests/Checkbox.test.stories.d.ts +0 -25
- package/dist/components/Checkbox/tests/Checkbox.test.stories.js +0 -104
- package/dist/components/CheckboxGroup/tests/CheckboxGroup.test.stories.d.ts +0 -22
- package/dist/components/CheckboxGroup/tests/CheckboxGroup.test.stories.js +0 -78
- package/dist/components/Container/tests/Container.test.stories.d.ts +0 -15
- package/dist/components/Container/tests/Container.test.stories.js +0 -26
- package/dist/components/ContextMenu/tests/ContextMenu.test.stories.d.ts +0 -25
- package/dist/components/ContextMenu/tests/ContextMenu.test.stories.js +0 -53
- package/dist/components/Dismissible/tests/Dismissible.test.stories.d.ts +0 -19
- package/dist/components/Dismissible/tests/Dismissible.test.stories.js +0 -42
- package/dist/components/Divider/tests/Divider.test.stories.d.ts +0 -18
- package/dist/components/Divider/tests/Divider.test.stories.js +0 -47
- package/dist/components/FormControl/tests/FormControl.test.stories.d.ts +0 -20
- package/dist/components/FormControl/tests/FormControl.test.stories.js +0 -49
- package/dist/components/Hidden/tests/Hidden.test.stories.d.ts +0 -15
- package/dist/components/Hidden/tests/Hidden.test.stories.js +0 -20
- package/dist/components/HiddenVisually/tests/HiddenVisually.test.stories.d.ts +0 -15
- package/dist/components/HiddenVisually/tests/HiddenVisually.test.stories.js +0 -20
- package/dist/components/Hotkey/tests/Hotkey.test.stories.d.ts +0 -15
- package/dist/components/Hotkey/tests/Hotkey.test.stories.js +0 -26
- package/dist/components/Icon/tests/Icon.test.stories.d.ts +0 -16
- package/dist/components/Icon/tests/Icon.test.stories.js +0 -35
- package/dist/components/MenuItem/tests/MenuItem.test.stories.d.ts +0 -26
- package/dist/components/MenuItem/tests/MenuItem.test.stories.js +0 -100
- package/dist/components/Modal/tests/Modal.test.stories.d.ts +0 -31
- package/dist/components/Modal/tests/Modal.test.stories.js +0 -149
- package/dist/components/Overlay/tests/Overlay.test.stories.d.ts +0 -28
- package/dist/components/Overlay/tests/Overlay.test.stories.js +0 -148
- package/dist/components/Pagination/tests/Pagination.test.stories.d.ts +0 -23
- package/dist/components/Pagination/tests/Pagination.test.stories.js +0 -86
- package/dist/components/Progress/tests/Progress.test.stories.d.ts +0 -16
- package/dist/components/Progress/tests/Progress.test.stories.js +0 -35
- package/dist/components/Radio/tests/Radio.test.stories.d.ts +0 -30
- package/dist/components/Radio/tests/Radio.test.stories.js +0 -118
- package/dist/components/RadioGroup/tests/RadioGroup.test.stories.d.ts +0 -22
- package/dist/components/RadioGroup/tests/RadioGroup.test.stories.js +0 -78
- package/dist/components/Scrim/tests/Scrim.test.stories.d.ts +0 -15
- package/dist/components/Scrim/tests/Scrim.test.stories.js +0 -25
- package/dist/components/Select/tests/Select.test.stories.d.ts +0 -27
- package/dist/components/Select/tests/Select.test.stories.js +0 -132
- package/dist/components/Skeleton/tests/Skeleton.test.stories.d.ts +0 -15
- package/dist/components/Skeleton/tests/Skeleton.test.stories.js +0 -23
- package/dist/components/Stepper/tests/Stepper.test.stories.d.ts +0 -20
- package/dist/components/Stepper/tests/Stepper.test.stories.js +0 -28
- package/dist/components/TextArea/tests/TextArea.test.stories.d.ts +0 -28
- package/dist/components/TextArea/tests/TextArea.test.stories.js +0 -99
- package/dist/components/Toast/tests/Toast.test.stories.d.ts +0 -16
- package/dist/components/Toast/tests/Toast.test.stories.js +0 -101
- package/dist/components/View/tests/View.test.stories.d.ts +0 -24
- package/dist/components/View/tests/View.test.stories.js +0 -50
@@ -1,3 +1,4 @@
|
|
1
|
+
import { StoryObj } from "@storybook/react-vite";
|
1
2
|
declare const _default: {
|
2
3
|
title: string;
|
3
4
|
component: import("react").FC<import("./..").SkeletonProps>;
|
@@ -8,5 +9,12 @@ declare const _default: {
|
|
8
9
|
};
|
9
10
|
};
|
10
11
|
export default _default;
|
11
|
-
export declare const variant:
|
12
|
-
|
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,5 +1,6 @@
|
|
1
1
|
import { Example } from "../../../utilities/storybook/index.js";
|
2
2
|
import Skeleton from "../index.js";
|
3
|
+
import { expect } from "storybook/test";
|
3
4
|
export default {
|
4
5
|
title: "Components/Skeleton",
|
5
6
|
component: Skeleton,
|
@@ -9,37 +10,54 @@ export default {
|
|
9
10
|
},
|
10
11
|
},
|
11
12
|
};
|
12
|
-
export const variant =
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
export const variant = {
|
14
|
+
name: "variant",
|
15
|
+
render: () => (<Example>
|
16
|
+
<Example.Item title="text">
|
17
|
+
<Skeleton />
|
18
|
+
</Example.Item>
|
16
19
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
+
<Example.Item title="view, rectangle">
|
21
|
+
<Skeleton width="100px" height="100px"/>
|
22
|
+
</Example.Item>
|
20
23
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
+
<Example.Item title="view, circle">
|
25
|
+
<Skeleton width="100px" height="100px" borderRadius="circular"/>
|
26
|
+
</Example.Item>
|
24
27
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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>
|
33
39
|
|
34
|
-
|
35
|
-
|
36
|
-
|
40
|
+
<Example.Item title="radius=medium">
|
41
|
+
<Skeleton width="60px" height="60px" borderRadius="medium"/>
|
42
|
+
</Example.Item>
|
37
43
|
|
38
|
-
|
39
|
-
|
40
|
-
|
44
|
+
<Example.Item title="radius=large">
|
45
|
+
<Skeleton width="60px" height="60px" borderRadius="large"/>
|
46
|
+
</Example.Item>
|
41
47
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
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 +1 @@
|
|
1
|
-
.root{--rs-slider-overflow-gap:var(--rs-unit-x1);--rs-slider-thumb-size:var(--rs-unit-x4);align-items:center;cursor:pointer;display:flex;position:relative;user-select:none;-webkit-tap-highlight-color:transparent}.root:has(.thumb:hover,.thumb--active,.input:focus-visible){overflow:visible}.bar{background:var(--rs-color-background-neutral);border-radius:var(--rs-radius-small);position:relative}.bar,.input{overflow:hidden}.input{height:1px;opacity:0;pointer-events:none;position:absolute;width:1px}.selection{background:var(--rs-color-background-primary);position:absolute}.tooltip{--rs-slider-tooltip-translate:calc(-50% + var(--rs-slider-tooltip-offset, 0px));background:var(--rs-color-background-elevation-overlay);border-radius:var(--rs-radius-small);box-shadow:var(--rs-shadow-overlay);box-sizing:initial;color:var(--rs-color-foreground-neutral);font-variant-numeric:tabular-nums;min-width:var(--rs-line-height-caption-1);opacity:0;padding:calc(var(--rs-unit-x1) / 2) var(--rs-unit-x1);pointer-events:none;text-align:center;transition:var(--rs-duration-fast) var(--rs-easing-standard);transition-property:opacity,transform;user-select:none;white-space:nowrap;will-change:transform}.thumb,.thumbs,.tooltip{position:absolute}.thumb:before{background:var(--rs-color-background-primary);border-radius:var(--rs-radius-circular);box-shadow:0 0 0 2px var(--rs-color-background-elevation-base);box-sizing:border-box;height:var(--rs-slider-thumb-size);transition:var(--rs-duration-fast) var(--rs-easing-standard);transition-property:box-shadow;width:var(--rs-slider-thumb-size)}.thumb:after,.thumb:before{content:"";position:absolute}.thumb:after{cursor:grab;height:var(--rs-unit-x7);width:var(--rs-unit-x7)}.thumb:hover .tooltip{opacity:1}.thumb--active:after,[data-rs-keyboard] .input:focus+.thumb:after{cursor:grabbing}.thumb--active:before,[data-rs-keyboard] .input:focus+.thumb:before{box-shadow:0 0 0 1px var(--rs-color-background-elevation-base)}.thumb--active .tooltip,[data-rs-keyboard] .input:focus+.thumb .tooltip{opacity:1}[data-rs-keyboard] .input:focus+.thumb:before{box-shadow:var(--rs-focus
|
1
|
+
.root{--rs-slider-overflow-gap:var(--rs-unit-x1);--rs-slider-thumb-size:var(--rs-unit-x4);align-items:center;cursor:pointer;display:flex;position:relative;user-select:none;-webkit-tap-highlight-color:transparent}.root:has(.thumb:hover,.thumb--active,.input:focus-visible){overflow:visible}.bar{background:var(--rs-color-background-neutral);border-radius:var(--rs-radius-small);position:relative}.bar,.input{overflow:hidden}.input{height:1px;opacity:0;pointer-events:none;position:absolute;width:1px}.selection{background:var(--rs-color-background-primary);position:absolute}.tooltip{--rs-slider-tooltip-translate:calc(-50% + var(--rs-slider-tooltip-offset, 0px));background:var(--rs-color-background-elevation-overlay);border-radius:var(--rs-radius-small);box-shadow:var(--rs-shadow-overlay);box-sizing:initial;color:var(--rs-color-foreground-neutral);font-variant-numeric:tabular-nums;min-width:var(--rs-line-height-caption-1);opacity:0;padding:calc(var(--rs-unit-x1) / 2) var(--rs-unit-x1);pointer-events:none;text-align:center;transition:var(--rs-duration-fast) var(--rs-easing-standard);transition-property:opacity,transform;user-select:none;white-space:nowrap;will-change:transform}.thumb,.thumbs,.tooltip{position:absolute}.thumb:before{background:var(--rs-color-background-primary);border-radius:var(--rs-radius-circular);box-shadow:0 0 0 2px var(--rs-color-background-elevation-base);box-sizing:border-box;height:var(--rs-slider-thumb-size);transition:var(--rs-duration-fast) var(--rs-easing-standard);transition-property:box-shadow;width:var(--rs-slider-thumb-size)}.thumb:after,.thumb:before{content:"";position:absolute}.thumb:after{cursor:grab;height:var(--rs-unit-x7);width:var(--rs-unit-x7)}.thumb:hover .tooltip{opacity:1}.thumb--active:after,[data-rs-keyboard] .input:focus+.thumb:after{cursor:grabbing}.thumb--active:before,[data-rs-keyboard] .input:focus+.thumb:before{box-shadow:0 0 0 1px var(--rs-color-background-elevation-base)}.thumb--active .tooltip,[data-rs-keyboard] .input:focus+.thumb .tooltip{opacity:1}[data-rs-keyboard] .input:focus+.thumb:before{box-shadow:var(--rs-shadow-focus)}.--orientation-horizontal{height:var(--rs-slider-thumb-size);margin-inline:calc(var(--rs-slider-overflow-gap) * -1);overflow-x:clip;padding-inline:var(--rs-slider-overflow-gap)}.--orientation-horizontal .bar{height:var(--rs-unit-x1);width:100%}.--orientation-horizontal .selection{height:100%;inset-inline-start:var(--rs-slider-selection-start);width:var(--rs-slider-selection-size)}.--orientation-horizontal .tooltip{bottom:100%;left:50%;transform:translate(var(--rs-slider-tooltip-translate))}.--orientation-horizontal .thumbs{height:100%;inset-inline:calc(var(--rs-slider-thumb-size) / 2 + var(--rs-slider-overflow-gap))}.--orientation-horizontal .thumb{height:100%;inset-inline-start:var(--ts-slider-thumb-position);width:0}.--orientation-horizontal .thumb:after,.--orientation-horizontal .thumb:before{left:0;top:50%;transform:translate(-50%,-50%)}.--orientation-horizontal .input:focus+.thumb .tooltip,.--orientation-horizontal .thumb--active .tooltip,.--orientation-horizontal .thumb:hover .tooltip{transform:translate(var(--rs-slider-tooltip-translate),calc(var(--rs-unit-x1) * -1.5))}.--orientation-vertical{flex-direction:column;height:100%;margin-block:calc(var(--rs-slider-overflow-gap) * -1);overflow-y:clip;padding-block:var(--rs-slider-overflow-gap);width:var(--rs-slider-thumb-size)}.--orientation-vertical .bar{height:100%;width:var(--rs-unit-x1)}.--orientation-vertical .selection{height:var(--rs-slider-selection-size);inset-block-end:var(--rs-slider-selection-start);inset-inline-start:auto;width:100%}.--orientation-vertical .tooltip{inset-inline-start:100%;top:50%;transform:translateY(var(--rs-slider-tooltip-translate))}.--orientation-vertical .thumbs{inset-block:calc(var(--rs-slider-thumb-size) / 2 + var(--rs-slider-overflow-gap));width:100%}.--orientation-vertical .thumb{height:0;inset-block-end:var(--ts-slider-thumb-position);width:100%}.--orientation-vertical .thumb:after,.--orientation-vertical .thumb:before{left:50%;top:0;transform:translate(-50%,-50%)}.--orientation-vertical .input:focus+.thumb .tooltip,.--orientation-vertical .thumb--active .tooltip,.--orientation-vertical .thumb:hover .tooltip{transform:translate(calc(var(--rs-unit-x1) * 1.5),-50%)}.--disabled{cursor:not-allowed}.--disabled .bar{background-color:var(--rs-color-background-disabled)}.--disabled .selection,.--disabled .thumb:before{background-color:var(--rs-color-foreground-disabled)}.--disabled .thumb:after{cursor:not-allowed}.--disabled .thumb:hover .tooltip{opacity:0}
|
@@ -18,10 +18,10 @@ const StepperItemPrivate = (props) => {
|
|
18
18
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
19
19
|
const StepperItem = (_) => null;
|
20
20
|
const Stepper = (props) => {
|
21
|
-
const { children, direction = "row", activeId, labelDisplay, className, attributes } = props;
|
21
|
+
const { children, direction = "row", activeId, labelDisplay, gap = 3, className, attributes, } = props;
|
22
22
|
const vertical = direction === "column";
|
23
23
|
const length = React.Children.count(children);
|
24
|
-
return (_jsx(View, { attributes: attributes, direction: direction, align: vertical ? "stretch" : "center", className: className, gap:
|
24
|
+
return (_jsx(View, { attributes: attributes, direction: direction, align: vertical ? "stretch" : "center", className: className, gap: gap, wrap: false, children: React.Children.map(children, (child, index) => {
|
25
25
|
if (!React.isValidElement(child))
|
26
26
|
return null;
|
27
27
|
if (child.type !== StepperItem)
|
@@ -9,6 +9,8 @@ export type Props = {
|
|
9
9
|
children?: React.ReactNode;
|
10
10
|
/** Direction of the stepper */
|
11
11
|
direction?: "row" | "column";
|
12
|
+
/** Gap between items (default: 3) */
|
13
|
+
gap?: G.Responsive<number>;
|
12
14
|
/** Additional classname for the root element */
|
13
15
|
className?: G.ClassName;
|
14
16
|
/** Additional attributes for the root element */
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import React from "react";
|
2
|
+
import { StoryObj } from "@storybook/react-vite";
|
2
3
|
declare const _default: {
|
3
4
|
title: string;
|
4
5
|
component: React.FC<import("./..").StepperProps> & {
|
@@ -14,6 +15,20 @@ declare const _default: {
|
|
14
15
|
};
|
15
16
|
};
|
16
17
|
export default _default;
|
17
|
-
export declare const direction:
|
18
|
-
|
19
|
-
|
18
|
+
export declare const direction: {
|
19
|
+
name: string;
|
20
|
+
render: () => React.JSX.Element;
|
21
|
+
};
|
22
|
+
export declare const labelDisplay: {
|
23
|
+
name: string;
|
24
|
+
render: () => React.JSX.Element;
|
25
|
+
};
|
26
|
+
export declare const gap: {
|
27
|
+
name: string;
|
28
|
+
render: () => React.JSX.Element;
|
29
|
+
};
|
30
|
+
export declare const className: StoryObj;
|
31
|
+
export declare const edgeCases: {
|
32
|
+
name: string;
|
33
|
+
render: () => React.JSX.Element;
|
34
|
+
};
|
@@ -3,6 +3,7 @@ import { Example, Placeholder } from "../../../utilities/storybook/index.js";
|
|
3
3
|
import Stepper from "../index.js";
|
4
4
|
import Button from "../../Button/index.js";
|
5
5
|
import View from "../../View/index.js";
|
6
|
+
import { expect } from "storybook/test";
|
6
7
|
export default {
|
7
8
|
title: "Components/Stepper",
|
8
9
|
component: Stepper,
|
@@ -33,51 +34,102 @@ const Demo = (props) => {
|
|
33
34
|
</Stepper.Item>
|
34
35
|
</Stepper>);
|
35
36
|
};
|
36
|
-
export const direction =
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
<Stepper
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
<Stepper
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
37
|
+
export const direction = {
|
38
|
+
name: "direction",
|
39
|
+
render: () => (<Example>
|
40
|
+
<Example.Item title="direction: row">
|
41
|
+
<Stepper activeId="1">
|
42
|
+
<Stepper.Item completed title="Step 1" subtitle="Step subtitle"/>
|
43
|
+
<Stepper.Item title="Step 2"/>
|
44
|
+
<Stepper.Item title="Step 3 very long title"/>
|
45
|
+
</Stepper>
|
46
|
+
</Example.Item>
|
47
|
+
<Example.Item title="direction: column">
|
48
|
+
<Stepper activeId="1" direction="column">
|
49
|
+
<Stepper.Item completed title="Step 1" subtitle="Step subtitle"/>
|
50
|
+
<Stepper.Item title="Step 2"/>
|
51
|
+
<Stepper.Item title="Step 3 very long title"/>
|
52
|
+
</Stepper>
|
53
|
+
</Example.Item>
|
54
|
+
</Example>),
|
55
|
+
};
|
56
|
+
export const labelDisplay = {
|
57
|
+
name: "labelDisplay",
|
58
|
+
render: () => (<Example>
|
59
|
+
<Example.Item title="direction: row, labels hidden">
|
60
|
+
<Stepper activeId="1" labelDisplay="hidden">
|
61
|
+
<Stepper.Item completed title="Step 1" subtitle="Step subtitle"/>
|
62
|
+
<Stepper.Item title="Step 2"/>
|
63
|
+
<Stepper.Item title="Step 3 very long title"/>
|
64
|
+
</Stepper>
|
65
|
+
</Example.Item>
|
66
|
+
<Example.Item title="direction: column, labels hiden">
|
67
|
+
<Stepper activeId="1" direction="column" labelDisplay="hidden">
|
68
|
+
<Stepper.Item completed title="Step 1" subtitle="Step subtitle"/>
|
69
|
+
<Stepper.Item title="Step 2"/>
|
70
|
+
<Stepper.Item title="Step 3 very long title"/>
|
71
|
+
</Stepper>
|
72
|
+
</Example.Item>
|
73
|
+
<Example.Item title="direction: row, labels hidden on s">
|
74
|
+
<Stepper activeId="1" labelDisplay={{ s: "hidden", m: "inline" }}>
|
75
|
+
<Stepper.Item completed title="Step 1" subtitle="Step subtitle"/>
|
76
|
+
<Stepper.Item title="Step 2"/>
|
77
|
+
<Stepper.Item title="Step 3 very long title"/>
|
78
|
+
</Stepper>
|
79
|
+
</Example.Item>
|
80
|
+
</Example>),
|
81
|
+
};
|
82
|
+
export const gap = {
|
83
|
+
name: "gap",
|
84
|
+
render: () => (<Example>
|
85
|
+
<Example.Item title="gap: 6, direction: row">
|
86
|
+
<Stepper activeId="1" gap={6}>
|
87
|
+
<Stepper.Item completed title="Step 1" subtitle="Step subtitle"/>
|
88
|
+
<Stepper.Item title="Step 2"/>
|
89
|
+
<Stepper.Item title="Step 3 very long title"/>
|
90
|
+
</Stepper>
|
91
|
+
</Example.Item>
|
92
|
+
<Example.Item title="gap: 6, direction: column">
|
93
|
+
<Stepper activeId="1" direction="column" gap={6}>
|
94
|
+
<Stepper.Item completed title="Step 1" subtitle="Step subtitle"/>
|
95
|
+
<Stepper.Item title="Step 2"/>
|
96
|
+
<Stepper.Item title="Step 3 very long title"/>
|
97
|
+
</Stepper>
|
98
|
+
</Example.Item>
|
99
|
+
<Example.Item title={["responsive gap", "[s] 2", "[m+] 5"]}>
|
100
|
+
<Stepper activeId="1" gap={{ s: 2, m: 5 }}>
|
101
|
+
<Stepper.Item completed title="Step 1" subtitle="Step subtitle"/>
|
102
|
+
<Stepper.Item title="Step 2"/>
|
103
|
+
<Stepper.Item title="Step 3 very long title"/>
|
104
|
+
</Stepper>
|
105
|
+
</Example.Item>
|
106
|
+
</Example>),
|
107
|
+
};
|
108
|
+
export const className = {
|
109
|
+
name: "className, attributes",
|
110
|
+
render: () => (<div data-testid="root">
|
111
|
+
<Stepper className="test-classname" attributes={{ id: "test-id" }}>
|
112
|
+
<Stepper.Item attributes={{ id: "test-item-id" }} className="test-item-classname"/>
|
72
113
|
</Stepper>
|
73
|
-
</
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
"
|
78
|
-
"
|
79
|
-
"
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
114
|
+
</div>),
|
115
|
+
play: async ({ canvas }) => {
|
116
|
+
const root = canvas.getByTestId("root").firstChild;
|
117
|
+
const item = root?.firstChild;
|
118
|
+
expect(root).toHaveClass("test-classname");
|
119
|
+
expect(root).toHaveAttribute("id", "test-id");
|
120
|
+
expect(item).toHaveClass("test-item-classname");
|
121
|
+
expect(item).toHaveAttribute("id", "test-item-id");
|
122
|
+
},
|
123
|
+
};
|
124
|
+
export const edgeCases = {
|
125
|
+
name: "test: edge cases",
|
126
|
+
render: () => (<Example>
|
127
|
+
<Example.Item title={[
|
128
|
+
"multiline subtitle",
|
129
|
+
"should wrap the text correctly",
|
130
|
+
"should display the connector correctly",
|
131
|
+
]}>
|
132
|
+
<Demo activeId={0} subtitle="It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy"/>
|
133
|
+
</Example.Item>
|
134
|
+
</Example>),
|
135
|
+
};
|
@@ -1 +1 @@
|
|
1
|
-
.root{align-items:center;display:inline-flex;gap:var(--rs-switch-gap);position:relative;vertical-align:top;-webkit-tap-highlight-color:transparent}.root.--reversed{flex-direction:row-reverse}.input{border:0;height:1px;left:0;opacity:0;outline:none;position:absolute;top:0;width:1px}.input:checked+.area{background:var(--rs-color-background-primary);border-color:transparent}.input:checked+.area .thumb{transform:translateX(calc(var(--rs-switch-width) - var(--rs-switch-height)))}[dir=rtl] .input:checked+.area .thumb{transform:translateX(calc(var(--rs-switch-height) - var(--rs-switch-width)))}[data-rs-keyboard] .input:focus+.area{box-shadow:var(--rs-focus
|
1
|
+
.root{align-items:center;display:inline-flex;gap:var(--rs-switch-gap);position:relative;vertical-align:top;-webkit-tap-highlight-color:transparent}.root.--reversed{flex-direction:row-reverse}.input{border:0;height:1px;left:0;opacity:0;outline:none;position:absolute;top:0;width:1px}.input:checked+.area{background:var(--rs-color-background-primary);border-color:transparent}.input:checked+.area .thumb{transform:translateX(calc(var(--rs-switch-width) - var(--rs-switch-height)))}[dir=rtl] .input:checked+.area .thumb{transform:translateX(calc(var(--rs-switch-height) - var(--rs-switch-width)))}[data-rs-keyboard] .input:focus+.area{box-shadow:var(--rs-shadow-focus)}.input[disabled]+.area{background:var(--rs-color-background-disabled);cursor:not-allowed}.input[disabled]+.area .thumb{opacity:.8}.input[disabled]:checked+.area{background:var(--rs-color-background-primary);opacity:.4}.input[disabled]:checked+.area .thumb{opacity:1}.area{align-items:center;background:var(--rs-color-background-neutral);border:2px solid transparent;border-radius:var(--rs-radius-circular);box-sizing:border-box;cursor:pointer;display:flex;height:var(--rs-switch-height);transition:var(--rs-duration-fast) var(--rs-easing-standard);transition-property:background,border;width:var(--rs-switch-width)}.hitbox{height:24px;inset-inline:0;position:absolute;top:50%;transform:translateY(-50%)}.thumb{background:var(--rs-color-white);border-radius:var(--rs-radius-circular);box-shadow:var(--rs-shadow-raised);height:calc(var(--rs-switch-height) - var(--rs-unit-x1));transition:var(--rs-duration-fast) var(--rs-easing-standard);transition-property:transform;width:calc(var(--rs-switch-height) - var(--rs-unit-x1))}.--size-small{--rs-switch-height:var(--rs-unit-x4);--rs-switch-width:var(--rs-unit-x6);--rs-switch-gap:var(--rs-unit-x1);--rs-switch-line-height:var(--rs-line-height-caption-1);--rs-switch-font-size:var(--rs-font-size-caption-1)}.--size-medium{--rs-switch-height:var(--rs-unit-x5);--rs-switch-width:var(--rs-unit-x8);--rs-switch-gap:var(--rs-unit-x2);--rs-switch-line-height:var(--rs-line-height-body-3);--rs-switch-font-size:var(--rs-font-size-body-3)}.--size-large{--rs-switch-height:var(--rs-unit-x6);--rs-switch-width:var(--rs-unit-x10);--rs-switch-gap:var(--rs-unit-x2);--rs-switch-line-height:var(--rs-line-height-body-2);--rs-switch-font-size:var(--rs-font-size-body-2)}@media (--rs-viewport-m ){.--size-small--m{--rs-switch-height:var(--rs-unit-x4);--rs-switch-width:var(--rs-unit-x6);--rs-switch-gap:var(--rs-unit-x1);--rs-switch-line-height:var(--rs-line-height-caption-1);--rs-switch-font-size:var(--rs-font-size-caption-1)}.--size-medium--m{--rs-switch-height:var(--rs-unit-x5);--rs-switch-width:var(--rs-unit-x8);--rs-switch-gap:var(--rs-unit-x2);--rs-switch-line-height:var(--rs-line-height-body-3);--rs-switch-font-size:var(--rs-font-size-body-3)}.--size-large--m{--rs-switch-height:var(--rs-unit-x6);--rs-switch-width:var(--rs-unit-x10);--rs-switch-gap:var(--rs-unit-x2);--rs-switch-line-height:var(--rs-line-height-body-2);--rs-switch-font-size:var(--rs-font-size-body-2)}}@media (--rs-viewport-l ){.--size-small--l{--rs-switch-height:var(--rs-unit-x4);--rs-switch-width:var(--rs-unit-x6);--rs-switch-gap:var(--rs-unit-x1);--rs-switch-line-height:var(--rs-line-height-caption-1);--rs-switch-font-size:var(--rs-font-size-caption-1)}.--size-medium--l{--rs-switch-height:var(--rs-unit-x5);--rs-switch-width:var(--rs-unit-x8);--rs-switch-gap:var(--rs-unit-x2);--rs-switch-line-height:var(--rs-line-height-body-3);--rs-switch-font-size:var(--rs-font-size-body-3)}.--size-large--l{--rs-switch-height:var(--rs-unit-x6);--rs-switch-width:var(--rs-unit-x10);--rs-switch-gap:var(--rs-unit-x2);--rs-switch-line-height:var(--rs-line-height-body-2);--rs-switch-font-size:var(--rs-font-size-body-2)}}@media (--rs-viewport-xl ){.--size-small--xl{--rs-switch-height:var(--rs-unit-x4);--rs-switch-width:var(--rs-unit-x6);--rs-switch-gap:var(--rs-unit-x1);--rs-switch-line-height:var(--rs-line-height-caption-1);--rs-switch-font-size:var(--rs-font-size-caption-1)}.--size-medium--xl{--rs-switch-height:var(--rs-unit-x5);--rs-switch-width:var(--rs-unit-x8);--rs-switch-gap:var(--rs-unit-x2);--rs-switch-line-height:var(--rs-line-height-body-3);--rs-switch-font-size:var(--rs-font-size-body-3)}.--size-large--xl{--rs-switch-height:var(--rs-unit-x6);--rs-switch-width:var(--rs-unit-x10);--rs-switch-gap:var(--rs-unit-x2);--rs-switch-line-height:var(--rs-line-height-body-2);--rs-switch-font-size:var(--rs-font-size-body-2)}}
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import { StoryObj } from "@storybook/react-vite";
|
2
|
+
import { fn } from "storybook/test";
|
1
3
|
declare const _default: {
|
2
4
|
title: string;
|
3
5
|
component: import("react").FC<import("./..").SwitchProps>;
|
@@ -8,7 +10,13 @@ declare const _default: {
|
|
8
10
|
};
|
9
11
|
};
|
10
12
|
export default _default;
|
11
|
-
export declare const selection: () => import("react").JSX.Element;
|
12
13
|
export declare const size: () => import("react").JSX.Element;
|
13
14
|
export declare const label: () => import("react").JSX.Element;
|
14
|
-
export declare const
|
15
|
+
export declare const defaultChecked: StoryObj<{
|
16
|
+
handleChange: ReturnType<typeof fn>;
|
17
|
+
}>;
|
18
|
+
export declare const checked: StoryObj<{
|
19
|
+
handleChange: ReturnType<typeof fn>;
|
20
|
+
}>;
|
21
|
+
export declare const disabled: StoryObj;
|
22
|
+
export declare const className: StoryObj;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { Example } from "../../../utilities/storybook/index.js";
|
2
2
|
import Switch from "../index.js";
|
3
3
|
import View from "../../View/index.js";
|
4
|
+
import { expect, fn, userEvent } from "storybook/test";
|
4
5
|
export default {
|
5
6
|
title: "Components/Switch",
|
6
7
|
component: Switch,
|
@@ -10,17 +11,6 @@ export default {
|
|
10
11
|
},
|
11
12
|
},
|
12
13
|
};
|
13
|
-
export const selection = () => (<Example>
|
14
|
-
<Example.Item title="unselected">
|
15
|
-
<Switch name="active" inputAttributes={{ "aria-label": "test switch" }}/>
|
16
|
-
</Example.Item>
|
17
|
-
<Example.Item title="selected, uncontrolled">
|
18
|
-
<Switch name="active" defaultChecked inputAttributes={{ "aria-label": "test switch" }}/>
|
19
|
-
</Example.Item>
|
20
|
-
<Example.Item title="selected, controlled">
|
21
|
-
<Switch name="active" checked inputAttributes={{ "aria-label": "test switch" }}/>
|
22
|
-
</Example.Item>
|
23
|
-
</Example>);
|
24
14
|
export const size = () => (<Example>
|
25
15
|
<Example.Item title="size: medium">
|
26
16
|
<Switch name="active" size="medium" inputAttributes={{ "aria-label": "test switch" }}/>
|
@@ -68,16 +58,80 @@ export const label = () => (<Example>
|
|
68
58
|
</View>
|
69
59
|
</Example.Item>
|
70
60
|
</Example>);
|
71
|
-
export const
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
61
|
+
export const defaultChecked = {
|
62
|
+
name: "defaultChecked, uncontrolled",
|
63
|
+
args: {
|
64
|
+
handleChange: fn(),
|
65
|
+
},
|
66
|
+
render: (args) => (<Switch name="test-name" defaultChecked onChange={args.handleChange}>
|
67
|
+
Label
|
68
|
+
</Switch>),
|
69
|
+
play: async ({ canvas, args }) => {
|
70
|
+
const input = canvas.getByRole("checkbox");
|
71
|
+
expect(input).toBeChecked();
|
72
|
+
await userEvent.click(input);
|
73
|
+
expect(args.handleChange).toBeCalledTimes(1);
|
74
|
+
expect(args.handleChange).toHaveBeenCalledWith({
|
75
|
+
name: "test-name",
|
76
|
+
checked: false,
|
77
|
+
event: expect.objectContaining({ target: input }),
|
78
|
+
});
|
79
|
+
expect(input).not.toBeChecked();
|
80
|
+
},
|
81
|
+
};
|
82
|
+
export const checked = {
|
83
|
+
name: "checked, uncontrolled",
|
84
|
+
args: {
|
85
|
+
handleChange: fn(),
|
86
|
+
},
|
87
|
+
render: (args) => (<Switch name="test-name" checked onChange={args.handleChange}>
|
88
|
+
Label
|
89
|
+
</Switch>),
|
90
|
+
play: async ({ canvas, args }) => {
|
91
|
+
const input = canvas.getByRole("checkbox");
|
92
|
+
expect(input).toBeChecked();
|
93
|
+
await userEvent.click(input);
|
94
|
+
expect(args.handleChange).toBeCalledTimes(1);
|
95
|
+
expect(args.handleChange).toHaveBeenCalledWith({
|
96
|
+
name: "test-name",
|
97
|
+
checked: false,
|
98
|
+
event: expect.objectContaining({ target: input }),
|
99
|
+
});
|
100
|
+
expect(input).toBeChecked();
|
101
|
+
},
|
102
|
+
};
|
103
|
+
export const disabled = {
|
104
|
+
name: "disabled",
|
105
|
+
render: () => (<Example>
|
106
|
+
<Example.Item title="disabled, unselected">
|
107
|
+
<Switch name="active" disabled inputAttributes={{ "aria-label": "test switch" }}/>
|
108
|
+
</Example.Item>
|
109
|
+
<Example.Item title="disabled, selected">
|
110
|
+
<Switch name="active" disabled defaultChecked inputAttributes={{ "aria-label": "test switch" }}/>
|
111
|
+
</Example.Item>
|
112
|
+
<Example.Item title="disabled, with label">
|
113
|
+
<Switch name="active" disabled>
|
114
|
+
Switch
|
115
|
+
</Switch>
|
116
|
+
</Example.Item>
|
117
|
+
</Example>),
|
118
|
+
play: async ({ canvas }) => {
|
119
|
+
const [input] = canvas.getAllByRole("checkbox");
|
120
|
+
expect(input).toBeDisabled();
|
121
|
+
},
|
122
|
+
};
|
123
|
+
export const className = {
|
124
|
+
name: "className, attributes",
|
125
|
+
render: () => (<div data-testid="root">
|
126
|
+
<Switch className="test-classname" attributes={{ id: "test-id" }} inputAttributes={{ "aria-label": "test select", id: "test-input-id" }} name="name">
|
127
|
+
Label
|
81
128
|
</Switch>
|
82
|
-
</
|
83
|
-
|
129
|
+
</div>),
|
130
|
+
play: async ({ canvas }) => {
|
131
|
+
const root = canvas.getByTestId("root").firstChild;
|
132
|
+
const input = canvas.getByRole("checkbox");
|
133
|
+
expect(root).toHaveClass("test-classname");
|
134
|
+
expect(root).toHaveAttribute("id", "test-id");
|
135
|
+
expect(input).toHaveAttribute("id", "test-input-id");
|
136
|
+
},
|
137
|
+
};
|
@@ -1,5 +1,3 @@
|
|
1
|
-
import { StoryObj } from "@storybook/react-vite";
|
2
|
-
import { fn } from "storybook/test";
|
3
1
|
declare const _default: {
|
4
2
|
title: string;
|
5
3
|
component: import("react").FC<import("./..").SwitchProps>;
|
@@ -13,11 +11,3 @@ declare const _default: {
|
|
13
11
|
};
|
14
12
|
};
|
15
13
|
export default _default;
|
16
|
-
export declare const defaultChecked: StoryObj<{
|
17
|
-
handleChange: ReturnType<typeof fn>;
|
18
|
-
}>;
|
19
|
-
export declare const checked: StoryObj<{
|
20
|
-
handleChange: ReturnType<typeof fn>;
|
21
|
-
}>;
|
22
|
-
export declare const disabled: StoryObj;
|
23
|
-
export declare const className: StoryObj;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { expect, fn, userEvent } from "storybook/test";
|
2
1
|
import Switch from "../index.js";
|
3
2
|
export default {
|
4
3
|
title: "Components/Switch/tests",
|
@@ -10,70 +9,3 @@ export default {
|
|
10
9
|
chromatic: { disableSnapshot: true },
|
11
10
|
},
|
12
11
|
};
|
13
|
-
export const defaultChecked = {
|
14
|
-
name: "defaultChecked, uncontrolled",
|
15
|
-
args: {
|
16
|
-
handleChange: fn(),
|
17
|
-
},
|
18
|
-
render: (args) => (<Switch name="test-name" defaultChecked onChange={args.handleChange}>
|
19
|
-
Label
|
20
|
-
</Switch>),
|
21
|
-
play: async ({ canvas, args }) => {
|
22
|
-
const input = canvas.getByRole("checkbox");
|
23
|
-
expect(input).toBeChecked();
|
24
|
-
await userEvent.click(input);
|
25
|
-
expect(args.handleChange).toBeCalledTimes(1);
|
26
|
-
expect(args.handleChange).toHaveBeenCalledWith({
|
27
|
-
name: "test-name",
|
28
|
-
checked: false,
|
29
|
-
event: expect.objectContaining({ target: input }),
|
30
|
-
});
|
31
|
-
expect(input).not.toBeChecked();
|
32
|
-
},
|
33
|
-
};
|
34
|
-
export const checked = {
|
35
|
-
name: "checked, uncontrolled",
|
36
|
-
args: {
|
37
|
-
handleChange: fn(),
|
38
|
-
},
|
39
|
-
render: (args) => (<Switch name="test-name" checked onChange={args.handleChange}>
|
40
|
-
Label
|
41
|
-
</Switch>),
|
42
|
-
play: async ({ canvas, args }) => {
|
43
|
-
const input = canvas.getByRole("checkbox");
|
44
|
-
expect(input).toBeChecked();
|
45
|
-
await userEvent.click(input);
|
46
|
-
expect(args.handleChange).toBeCalledTimes(1);
|
47
|
-
expect(args.handleChange).toHaveBeenCalledWith({
|
48
|
-
name: "test-name",
|
49
|
-
checked: false,
|
50
|
-
event: expect.objectContaining({ target: input }),
|
51
|
-
});
|
52
|
-
expect(input).toBeChecked();
|
53
|
-
},
|
54
|
-
};
|
55
|
-
export const disabled = {
|
56
|
-
name: "disabled",
|
57
|
-
render: () => (<Switch disabled name="name">
|
58
|
-
Label
|
59
|
-
</Switch>),
|
60
|
-
play: async ({ canvas }) => {
|
61
|
-
const input = canvas.getByRole("checkbox");
|
62
|
-
expect(input).toBeDisabled();
|
63
|
-
},
|
64
|
-
};
|
65
|
-
export const className = {
|
66
|
-
name: "className, attributes",
|
67
|
-
render: () => (<div data-testid="root">
|
68
|
-
<Switch className="test-classname" attributes={{ id: "test-id" }} inputAttributes={{ "aria-label": "test select", id: "test-input-id" }} name="name">
|
69
|
-
Label
|
70
|
-
</Switch>
|
71
|
-
</div>),
|
72
|
-
play: async ({ canvas }) => {
|
73
|
-
const root = canvas.getByTestId("root").firstChild;
|
74
|
-
const input = canvas.getByRole("checkbox");
|
75
|
-
expect(root).toHaveClass("test-classname");
|
76
|
-
expect(root).toHaveAttribute("id", "test-id");
|
77
|
-
expect(input).toHaveAttribute("id", "test-input-id");
|
78
|
-
},
|
79
|
-
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use client";
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
3
|
-
import React from "react";
|
3
|
+
import React, { isValidElement } from "react";
|
4
4
|
import { classNames, responsiveVariables } from "../../utilities/props.js";
|
5
5
|
import { resolveMixin } from "../../styles/mixin.js";
|
6
6
|
import s from "./Table.module.css";
|
@@ -43,8 +43,10 @@ const Table = (props) => {
|
|
43
43
|
const fadeSide = useFadeSide(rootRef);
|
44
44
|
const rootClassNames = classNames(s.root, className, border && s["--border-outer"], columnBorder && s["--border-column"], (fadeSide === "start" || fadeSide === "both") && s["--fade-start"], (fadeSide === "end" || fadeSide === "both") && s["--fade-end"]);
|
45
45
|
const [firstChild] = React.Children.toArray(children);
|
46
|
-
|
47
|
-
|
46
|
+
const isElement = isValidElement(firstChild);
|
47
|
+
const isBody = isElement && firstChild.type === TableBody;
|
48
|
+
const isHead = isElement && firstChild.type === TableHead;
|
49
|
+
return (_jsx("div", { ...attributes, className: rootClassNames, ref: rootRef, children: _jsx("table", { className: s.table, children: isBody || isHead ? children : _jsx(TableBody, { children: children }) }) }));
|
48
50
|
};
|
49
51
|
Table.Cell = TableCell;
|
50
52
|
Table.Heading = TableHeading;
|
@@ -1 +1 @@
|
|
1
|
-
@property --rs-table-fade-start{syntax:"<length>";initial-value:0;inherits:false}@property --rs-table-fade-end{syntax:"<length>";initial-value:0;inherits:false}.root{mask-image:linear-gradient(to right,transparent 0,#000 var(--rs-table-fade-start),#000 calc(100% - var(--rs-table-fade-end)),transparent 100%);overflow:auto;transition:var(--rs-duration-medium) var(--rs-easing-decelerate);transition-property:--rs-table-fade-start,--rs-table-fade-end}.table{border-collapse:separate;min-width:100%;overflow:hidden}.row{transition:background-color var(--rs-duration-fast) var(--rs-easing-standard)}.row[tabindex]{cursor:pointer}[data-rs-keyboard] .row:focus{box-shadow:var(--rs-focus-inset
|
1
|
+
@property --rs-table-fade-start{syntax:"<length>";initial-value:0;inherits:false}@property --rs-table-fade-end{syntax:"<length>";initial-value:0;inherits:false}.root{mask-image:linear-gradient(to right,transparent 0,#000 var(--rs-table-fade-start),#000 calc(100% - var(--rs-table-fade-end)),transparent 100%);overflow:auto;transition:var(--rs-duration-medium) var(--rs-easing-decelerate);transition-property:--rs-table-fade-start,--rs-table-fade-end}.table{border-collapse:separate;min-width:100%;overflow:hidden}.row{transition:background-color var(--rs-duration-fast) var(--rs-easing-standard)}.row[tabindex]{cursor:pointer}[data-rs-keyboard] .row:focus{box-shadow:var(--rs-shadow-focus-inset);outline:none;z-index:var(--rs-z-index-relative)}.cell{--rs-table-p-vertical-s:3;--rs-table-p-horizontal-s:4;padding:calc(var(--rs-unit-x1) * var(--rs-table-p-vertical-s)) calc(var(--rs-unit-x1) * var(--rs-table-p-horizontal-s));text-align:start;vertical-align:top}.cell:not(:last-child){padding-inline-end:0}.head+.body .row:first-child .cell,.row:not(:first-child) .cell{border-top:1px solid var(--rs-color-border-neutral-faded)}.cell--align-start{text-align:start}.cell--align-center{text-align:center}.cell--align-end{text-align:end}.cell--valign-start{vertical-align:top}.cell--valign-center{vertical-align:middle}.cell--valign-end{vertical-align:bottom}.cell--width-auto{white-space:nowrap}.--row-highlighted{background-color:rgba(var(--rs-color-rgb-background-neutral),24%)}.--border-outer .table{border:1px solid var(--rs-color-border-neutral-faded);border-radius:var(--rs-radius-medium)}.--border-column .cell:not(:first-child){border-inline-start:1px solid var(--rs-color-border-neutral-faded)}.--border-column .cell:not(:last-child){padding-inline-end:calc(var(--rs-unit-x1) * var(--rs-table-p-horizontal-s))}.--fade-start,[dir=rtl] .--fade-end{--rs-table-fade-start:var(--rs-unit-x4)}.--fade-end,[dir=rtl] .--fade-start{--rs-table-fade-end:var(--rs-unit-x4)}
|