reshaped 3.8.0-canary.7 → 3.8.0-canary.9
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 +19 -0
- package/dist/bundle.css +1 -1
- package/dist/bundle.js +9 -9
- package/dist/components/Accordion/AccordionControlled.js +1 -0
- package/dist/components/Actionable/Actionable.js +1 -0
- package/dist/components/Actionable/Actionable.module.css +1 -1
- package/dist/components/Alert/tests/Alert.stories.d.ts +6 -5
- package/dist/components/Alert/tests/Alert.stories.js +15 -2
- 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/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.module.css +1 -1
- package/dist/components/Card/tests/Card.stories.d.ts +28 -6
- 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/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/FlyoutContent.js +3 -0
- package/dist/components/Flyout/FlyoutControlled.js +6 -1
- package/dist/components/Flyout/utilities/flyout.js +0 -1
- 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/tests/Icon.stories.d.ts +3 -0
- package/dist/components/Icon/tests/Icon.stories.js +23 -0
- package/dist/components/Link/tests/Link.stories.d.ts +28 -5
- package/dist/components/Link/tests/Link.stories.js +141 -58
- package/dist/components/Link/tests/Link.test.stories.d.ts +0 -13
- package/dist/components/Link/tests/Link.test.stories.js +0 -85
- 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/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 +366 -214
- package/dist/components/Overlay/Overlay.js +1 -0
- 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.module.css +1 -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.module.css +1 -1
- package/dist/components/Select/Select.types.d.ts +38 -11
- package/dist/components/Select/SelectCustom.js +2 -1
- package/dist/components/Select/SelectCustomControlled.js +24 -9
- package/dist/components/Select/SelectCustomUncontrolled.js +10 -7
- package/dist/components/Select/SelectTrigger.js +1 -1
- package/dist/components/Select/tests/Select.stories.d.ts +3 -0
- package/dist/components/Select/tests/Select.stories.js +91 -34
- 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/tests/Stepper.stories.d.ts +18 -4
- package/dist/components/Stepper/tests/Stepper.stories.js +99 -70
- 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.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/tests/Timeline.stories.d.ts +10 -2
- package/dist/components/Timeline/tests/Timeline.stories.js +69 -42
- 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/ToggleButtonGroup/ToggleButtonGroupControlled.js +1 -0
- 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 +1 -0
- 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/usePrevious.js +1 -0
- package/dist/hooks/tests/useDrag.stories.js +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/package.json +21 -21
- 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 -28
- package/dist/components/Button/tests/Button.test.stories.js +0 -135
- 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 -27
- package/dist/components/MenuItem/tests/MenuItem.test.stories.js +0 -116
- 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/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
@@ -7,13 +7,14 @@ import { isMatchingComponentChildId, responsivePropDependency } from "../../util
|
|
7
7
|
import SelectRoot from "./SelectRoot.js";
|
8
8
|
import SelectTrigger from "./SelectTrigger.js";
|
9
9
|
const SelectCustomControlled = (props) => {
|
10
|
-
const { children, value, name, placeholder, size } = props;
|
10
|
+
const { children, value, name, placeholder, size, multiple, width = "trigger", position, fallbackPositions, } = props;
|
11
11
|
const initialFocusRef = React.useRef(null);
|
12
12
|
const searchStringRef = React.useRef("");
|
13
13
|
const searchTimeoutRef = React.useRef(null);
|
14
14
|
const dropdownRef = React.useRef(null);
|
15
15
|
const indexedOptions = [];
|
16
|
-
|
16
|
+
const selectedOptions = [];
|
17
|
+
const hasValue = multiple ? value.length > 0 : value;
|
17
18
|
const traverseOptionList = (children) => {
|
18
19
|
return React.Children.map(children, (child, index) => {
|
19
20
|
if (!React.isValidElement(child))
|
@@ -21,10 +22,10 @@ const SelectCustomControlled = (props) => {
|
|
21
22
|
if (isMatchingComponentChildId(child, "Select.Option")) {
|
22
23
|
const component = child;
|
23
24
|
const option = component.props;
|
24
|
-
const matchingValue = option.value === value;
|
25
|
+
const matchingValue = multiple ? value.includes(option.value) : option.value === value;
|
25
26
|
const selected = matchingValue || (!placeholder && !value && index === 0);
|
26
27
|
if (selected)
|
27
|
-
|
28
|
+
selectedOptions.push(option);
|
28
29
|
indexedOptions.push({
|
29
30
|
value: option.value,
|
30
31
|
text: typeof option.children === "string" ? option.children : option.value,
|
@@ -32,10 +33,18 @@ const SelectCustomControlled = (props) => {
|
|
32
33
|
return React.cloneElement(component, {
|
33
34
|
key: option.value,
|
34
35
|
onClick: (e) => {
|
35
|
-
props.onChange?.({ value: option.value, name });
|
36
36
|
option.onClick?.(e);
|
37
|
+
if (multiple) {
|
38
|
+
const nextValue = selected
|
39
|
+
? value.filter((v) => v !== option.value)
|
40
|
+
: [...value, option.value];
|
41
|
+
props.onChange?.({ value: nextValue, name });
|
42
|
+
}
|
43
|
+
else {
|
44
|
+
props.onChange?.({ value: option.value, name });
|
45
|
+
}
|
37
46
|
},
|
38
|
-
startSlot: option?.startSlot || (
|
47
|
+
startSlot: option?.startSlot || (hasValue && _jsx(Icon, { svg: selected ? CheckmarkIcon : null })),
|
39
48
|
attributes: {
|
40
49
|
...component.props.attributes,
|
41
50
|
ref: selected ? initialFocusRef : undefined,
|
@@ -53,6 +62,7 @@ const SelectCustomControlled = (props) => {
|
|
53
62
|
return null;
|
54
63
|
});
|
55
64
|
};
|
65
|
+
// eslint-disable-next-line react-hooks/refs
|
56
66
|
const resolvedChildren = traverseOptionList(children);
|
57
67
|
const handleKeyDown = (e) => {
|
58
68
|
const key = e.key;
|
@@ -72,7 +82,7 @@ const SelectCustomControlled = (props) => {
|
|
72
82
|
}, 1000);
|
73
83
|
};
|
74
84
|
return (_jsx(SelectRoot, { ...props, children: (props) => {
|
75
|
-
return (_jsxs(DropdownMenu, { width:
|
85
|
+
return (_jsxs(DropdownMenu, { width: width, disableHideAnimation: true, position: position ?? "bottom", fallbackPositions: fallbackPositions ?? (position ? undefined : ["bottom", "top"]), fallbackAdjustLayout: true, fallbackMinHeight: "150px", borderRadius: responsivePropDependency(size, (size) => size === "large" || size === "xlarge" ? "medium" : "small"), initialFocusRef: initialFocusRef, children: [_jsx(DropdownMenu.Trigger, { children: (attributes) => {
|
76
86
|
const triggerProps = {
|
77
87
|
...props,
|
78
88
|
inputAttributes: {
|
@@ -80,8 +90,13 @@ const SelectCustomControlled = (props) => {
|
|
80
90
|
...attributes,
|
81
91
|
},
|
82
92
|
};
|
83
|
-
return (_jsx(SelectTrigger, { ...triggerProps, value:
|
84
|
-
} }), _jsx(DropdownMenu.Content, { attributes: {
|
93
|
+
return (_jsx(SelectTrigger, { ...triggerProps, value: value, children: selectedOptions?.map((option) => option.children).join(", ") }));
|
94
|
+
} }), _jsx(DropdownMenu.Content, { attributes: {
|
95
|
+
ref: dropdownRef,
|
96
|
+
onKeyDown: handleKeyDown,
|
97
|
+
// Ignore the default menu role since we're using options
|
98
|
+
role: undefined,
|
99
|
+
}, children: resolvedChildren })] }));
|
85
100
|
} }));
|
86
101
|
};
|
87
102
|
SelectCustomControlled.displayName = "SelectCustomControlled";
|
@@ -3,13 +3,16 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import React from "react";
|
4
4
|
import SelectCustomControlled from "./SelectCustomControlled.js";
|
5
5
|
const SelectCustomUncontrolled = (props) => {
|
6
|
-
const { defaultValue, onChange, ...controlledProps } = props;
|
7
|
-
const [value, setValue] = React.useState(defaultValue || "");
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
const { defaultValue, onChange, multiple, ...controlledProps } = props;
|
7
|
+
const [value, setValue] = React.useState(defaultValue || (multiple ? [] : ""));
|
8
|
+
return (
|
9
|
+
// @ts-expect-error -- avoid complicating the types and implementation
|
10
|
+
_jsx(SelectCustomControlled, { ...controlledProps, multiple: multiple, value: value,
|
11
|
+
// @ts-expect-error -- avoid complicating the types and implementation
|
12
|
+
onChange: (args) => {
|
13
|
+
setValue(args.value);
|
14
|
+
onChange?.(args);
|
15
|
+
} }));
|
13
16
|
};
|
14
17
|
SelectCustomUncontrolled.displayName = "SelectCustomUncontrolled";
|
15
18
|
export default SelectCustomUncontrolled;
|
@@ -11,6 +11,6 @@ const SelectTrigger = (props) => {
|
|
11
11
|
onFocus: onFocus || inputAttributes?.onFocus,
|
12
12
|
onBlur: onBlur || inputAttributes?.onBlur,
|
13
13
|
...inputAttributes,
|
14
|
-
}, children: [_jsx(SelectStartContent, { startSlot: startSlot, icon: icon, size: size }), children ? _jsx(Text, { maxLines: 1, children: children }) : null, placeholder && !children ? _jsx(Text, { color: "disabled", children: placeholder }) : null, _jsx(SelectEndContent, { disabled: disabled, size: size })] }), _jsx("input", { type: "hidden", value: value, name: name, id: id })] }));
|
14
|
+
}, children: [_jsx(SelectStartContent, { startSlot: startSlot, icon: icon, size: size }), children ? _jsx(Text, { maxLines: 1, children: children }) : null, placeholder && !children ? _jsx(Text, { color: "disabled", children: placeholder }) : null, _jsx(SelectEndContent, { disabled: disabled, size: size })] }), _jsx("input", { type: "hidden", value: typeof value === "string" ? value : JSON.stringify(value), name: name, id: id })] }));
|
15
15
|
};
|
16
16
|
export default SelectTrigger;
|
@@ -34,6 +34,9 @@ export declare const customHandlers: StoryObj<{
|
|
34
34
|
export declare const triggerOnly: StoryObj<{
|
35
35
|
handleClick: Mock;
|
36
36
|
}>;
|
37
|
+
export declare const multiple: StoryObj<{
|
38
|
+
handleChange: Mock;
|
39
|
+
}>;
|
37
40
|
export declare const variant: StoryObj;
|
38
41
|
export declare const size: StoryObj;
|
39
42
|
export declare const startSlot: StoryObj;
|
@@ -80,10 +80,11 @@ export const customRender = {
|
|
80
80
|
</Select.Custom>
|
81
81
|
</Example.Item>
|
82
82
|
</Example>),
|
83
|
-
play: async ({ canvas, canvasElement }) => {
|
84
|
-
|
83
|
+
play: async ({ canvas, canvasElement, mount }) => {
|
84
|
+
await mount();
|
85
|
+
const [trigger] = canvas.getAllByRole("button");
|
85
86
|
const hiddenInputs = canvasElement.querySelectorAll('input[type="hidden"]');
|
86
|
-
const [hiddenInput
|
87
|
+
const [hiddenInput] = Array.from(hiddenInputs);
|
87
88
|
// Testing only options
|
88
89
|
expect(hiddenInput).toHaveAttribute("name", "animal");
|
89
90
|
expect(hiddenInput).toHaveAttribute("id", "animal-1");
|
@@ -94,12 +95,17 @@ export const customRender = {
|
|
94
95
|
expect(options[0]).toHaveTextContent("Dog");
|
95
96
|
expect(options[1]).toHaveTextContent("Turtle");
|
96
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");
|
97
106
|
expect(hiddenInputWithGroups).toHaveAttribute("name", "animal-2");
|
98
107
|
expect(hiddenInputWithGroups).toHaveAttribute("id", "animal-2");
|
99
108
|
expect(triggerWithGroups).toHaveTextContent("Select an animal");
|
100
|
-
await userEvent.click(triggerWithGroups);
|
101
|
-
const optionGroups = within(canvasElement.ownerDocument.body).getAllByRole("group");
|
102
|
-
const optionsWithGroups = within(canvasElement.ownerDocument.body).getAllByRole("option");
|
103
109
|
expect(optionGroups).toHaveLength(2);
|
104
110
|
expect(optionGroups[0]).toHaveTextContent("Birds");
|
105
111
|
expect(optionGroups[1]).toHaveTextContent("Sea Mammals");
|
@@ -121,19 +127,25 @@ export const nativeHandlers = {
|
|
121
127
|
},
|
122
128
|
render: (args) => (<Example>
|
123
129
|
<Example.Item title="native, uncontrolled, onChange">
|
124
|
-
<Select name="animal" placeholder="Select an animal" defaultValue="dog" onChange={args.handleChange}
|
130
|
+
<Select name="animal" placeholder="Select an animal" defaultValue="dog" onChange={args.handleChange} inputAttributes={{
|
131
|
+
"aria-label": "Select an animal",
|
132
|
+
}}>
|
125
133
|
<option value="dog">Dog</option>
|
126
134
|
<option value="turtle">Turtle</option>
|
127
135
|
</Select>
|
128
136
|
</Example.Item>
|
129
137
|
<Example.Item title="native, controlled, onChange">
|
130
|
-
<Select name="animal" placeholder="Select an animal" value="dog" onChange={args.handleControlledChange}
|
138
|
+
<Select name="animal-2" placeholder="Select an animal" value="dog" onChange={args.handleControlledChange} inputAttributes={{
|
139
|
+
"aria-label": "Select an animal",
|
140
|
+
}}>
|
131
141
|
<option value="dog">Dog</option>
|
132
142
|
<option value="turtle">Turtle</option>
|
133
143
|
</Select>
|
134
144
|
</Example.Item>
|
135
145
|
<Example.Item title="native, onFocus, onBlur, onClick">
|
136
|
-
<Select name="animal" placeholder="Select an animal" defaultValue="dog" onFocus={args.handleFocus} onBlur={args.handleBlur} onClick={args.handleClick}
|
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
|
+
}}>
|
137
149
|
<option value="dog">Dog</option>
|
138
150
|
<option value="turtle">Turtle</option>
|
139
151
|
</Select>
|
@@ -157,7 +169,7 @@ export const nativeHandlers = {
|
|
157
169
|
expect(controlled).toHaveValue("dog");
|
158
170
|
expect(args.handleControlledChange).toHaveBeenCalledTimes(1);
|
159
171
|
expect(args.handleControlledChange).toHaveBeenCalledWith({
|
160
|
-
name: "animal",
|
172
|
+
name: "animal-2",
|
161
173
|
value: "turtle",
|
162
174
|
event: expect.objectContaining({ target: controlled }),
|
163
175
|
});
|
@@ -183,28 +195,35 @@ export const customHandlers = {
|
|
183
195
|
},
|
184
196
|
render: (args) => (<Example>
|
185
197
|
<Example.Item title="custom, uncontrolled, onChange">
|
186
|
-
<Select.Custom name="animal" placeholder="Select an animal" defaultValue="dog" onChange={args.handleChange}
|
198
|
+
<Select.Custom name="animal" placeholder="Select an animal" defaultValue="dog" onChange={args.handleChange} inputAttributes={{
|
199
|
+
"aria-label": "Select an animal",
|
200
|
+
}}>
|
187
201
|
<Select.Option value="dog">Dog</Select.Option>
|
188
202
|
<Select.Option value="turtle">Turtle</Select.Option>
|
189
203
|
</Select.Custom>
|
190
204
|
</Example.Item>
|
191
205
|
<Example.Item title="custom, controlled, onChange">
|
192
|
-
<Select.Custom name="animal-2" placeholder="Select an animal" value="dog" onChange={args.handleControlledChange}
|
206
|
+
<Select.Custom name="animal-2" placeholder="Select an animal" value="dog" onChange={args.handleControlledChange} inputAttributes={{
|
207
|
+
"aria-label": "Select an animal",
|
208
|
+
}}>
|
193
209
|
<Select.Option value="dog">Dog</Select.Option>
|
194
210
|
<Select.Option value="turtle">Turtle</Select.Option>
|
195
211
|
</Select.Custom>
|
196
212
|
</Example.Item>
|
197
213
|
<Example.Item title="native, onFocus, onBlur, onClick">
|
198
|
-
<Select.Custom name="animal-3" placeholder="Select an animal" defaultValue="dog" onFocus={args.handleFocus} onBlur={args.handleBlur} onClick={args.handleClick}
|
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
|
+
}}>
|
199
217
|
<Select.Option value="dog">Dog</Select.Option>
|
200
218
|
<Select.Option value="turtle">Turtle</Select.Option>
|
201
219
|
</Select.Custom>
|
202
220
|
</Example.Item>
|
203
221
|
</Example>),
|
204
|
-
play: async ({ canvas, canvasElement, args }) => {
|
205
|
-
|
222
|
+
play: async ({ canvas, canvasElement, args, mount }) => {
|
223
|
+
await mount();
|
224
|
+
const [uncontrolled] = canvas.getAllByRole("button");
|
206
225
|
const hiddenInputs = canvasElement.querySelectorAll('input[type="hidden"]');
|
207
|
-
const [inputUncontrolled
|
226
|
+
const [inputUncontrolled] = Array.from(hiddenInputs);
|
208
227
|
// Uncontrolled
|
209
228
|
expect(inputUncontrolled).toHaveValue("dog");
|
210
229
|
await userEvent.click(uncontrolled);
|
@@ -217,14 +236,18 @@ export const customHandlers = {
|
|
217
236
|
value: "turtle",
|
218
237
|
});
|
219
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);
|
220
243
|
expect(inputControlled).toHaveValue("dog");
|
221
244
|
await userEvent.click(controlled);
|
222
|
-
const [
|
245
|
+
const [____, controlledOption] = within(canvasElement.ownerDocument.body).getAllByRole("option");
|
223
246
|
await userEvent.click(controlledOption);
|
224
247
|
expect(inputControlled).toHaveValue("dog");
|
225
|
-
expect(args.
|
226
|
-
expect(args.
|
227
|
-
name: "animal",
|
248
|
+
expect(args.handleControlledChange).toHaveBeenCalledTimes(1);
|
249
|
+
expect(args.handleControlledChange).toHaveBeenCalledWith({
|
250
|
+
name: "animal-2",
|
228
251
|
value: "turtle",
|
229
252
|
});
|
230
253
|
// Focus + blur + click
|
@@ -252,26 +275,30 @@ export const triggerOnly = {
|
|
252
275
|
};
|
253
276
|
return (<Example>
|
254
277
|
<Example.Item title="trigger only, onClick">
|
255
|
-
<Select name="animal" placeholder="Select an animal" onClick={handleClick} value="dog"
|
278
|
+
<Select name="animal" placeholder="Select an animal" onClick={handleClick} value="dog" inputAttributes={{
|
279
|
+
"aria-label": "Select an animal",
|
280
|
+
}}>
|
256
281
|
{value}
|
257
282
|
</Select>
|
258
|
-
<Modal active={toggle.active} onClose={toggle.deactivate} position="bottom" padding={2}>
|
259
|
-
<
|
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={() => {
|
260
286
|
setValue("Dog");
|
261
287
|
toggle.deactivate();
|
262
288
|
}} attributes={{
|
263
289
|
role: "option",
|
264
290
|
}}>
|
265
|
-
|
266
|
-
|
267
|
-
|
291
|
+
Dog
|
292
|
+
</MenuItem>
|
293
|
+
<MenuItem roundedCorners attributes={{
|
268
294
|
role: "option",
|
269
295
|
}} onClick={() => {
|
270
296
|
setValue("Turtle");
|
271
297
|
toggle.deactivate();
|
272
298
|
}}>
|
273
|
-
|
274
|
-
|
299
|
+
Turtle
|
300
|
+
</MenuItem>
|
301
|
+
</div>
|
275
302
|
</Modal>
|
276
303
|
</Example.Item>
|
277
304
|
</Example>);
|
@@ -288,32 +315,62 @@ export const triggerOnly = {
|
|
288
315
|
expect(args.handleClick).toHaveBeenCalledWith(expect.objectContaining({ target: trigger }));
|
289
316
|
},
|
290
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
|
+
};
|
291
348
|
export const variant = {
|
292
349
|
name: "variant",
|
293
350
|
render: () => (<Example>
|
294
351
|
<Example.Item title="variant: faded, native">
|
295
|
-
<Select variant="faded" name="animal" placeholder="Select an animal">
|
352
|
+
<Select variant="faded" name="animal" placeholder="Select an animal" inputAttributes={{ "aria-label": "Select an animal" }}>
|
296
353
|
<option value="dog">Dog</option>
|
297
354
|
<option value="turtle">Turtle</option>
|
298
355
|
</Select>
|
299
356
|
</Example.Item>
|
300
357
|
|
301
358
|
<Example.Item title="variant: faded, custom">
|
302
|
-
<Select.Custom variant="faded" name="animal" placeholder="Select an animal">
|
359
|
+
<Select.Custom variant="faded" name="animal-2" placeholder="Select an animal" inputAttributes={{ "aria-label": "Select an animal" }}>
|
303
360
|
<Select.Option value="dog">Dog</Select.Option>
|
304
361
|
<Select.Option value="turtle">Turtle</Select.Option>
|
305
362
|
</Select.Custom>
|
306
363
|
</Example.Item>
|
307
364
|
|
308
365
|
<Example.Item title="variant: headless, native">
|
309
|
-
<Select variant="headless" name="animal" placeholder="Select an animal">
|
366
|
+
<Select variant="headless" name="animal-3" placeholder="Select an animal" inputAttributes={{ "aria-label": "Select an animal" }}>
|
310
367
|
<option value="dog">Dog</option>
|
311
368
|
<option value="turtle">Turtle</option>
|
312
369
|
</Select>
|
313
370
|
</Example.Item>
|
314
371
|
|
315
372
|
<Example.Item title="variant: headless, custom">
|
316
|
-
<Select.Custom variant="headless" name="animal" placeholder="Select an animal">
|
373
|
+
<Select.Custom variant="headless" name="animal-4" placeholder="Select an animal" inputAttributes={{ "aria-label": "Select an animal" }}>
|
317
374
|
<Select.Option value="dog">Dog</Select.Option>
|
318
375
|
<Select.Option value="turtle">Turtle</Select.Option>
|
319
376
|
</Select.Custom>
|
@@ -382,13 +439,13 @@ export const disabled = {
|
|
382
439
|
name: "disabled",
|
383
440
|
render: () => (<Example>
|
384
441
|
<Example.Item title="disabled, native">
|
385
|
-
<Select name="animal" placeholder="Select an animal" disabled>
|
442
|
+
<Select name="animal" placeholder="Select an animal" disabled inputAttributes={{ "aria-label": "Select an animal" }}>
|
386
443
|
<option value="dog">Dog</option>
|
387
444
|
<option value="turtle">Turtle</option>
|
388
445
|
</Select>
|
389
446
|
</Example.Item>
|
390
447
|
<Example.Item title="disabled, custom">
|
391
|
-
<Select.Custom name="animal" placeholder="Select an animal" disabled>
|
448
|
+
<Select.Custom name="animal-2" placeholder="Select an animal" disabled inputAttributes={{ "aria-label": "Select an animal" }}>
|
392
449
|
<Select.Option value="dog">Dog</Select.Option>
|
393
450
|
<Select.Option value="turtle">Turtle</Select.Option>
|
394
451
|
</Select.Custom>
|
@@ -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}
|
@@ -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,7 +15,20 @@ declare const _default: {
|
|
14
15
|
};
|
15
16
|
};
|
16
17
|
export default _default;
|
17
|
-
export declare const direction:
|
18
|
-
|
19
|
-
|
20
|
-
|
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
|
+
};
|