reshaped 3.7.4 → 3.8.0-canary.0
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-extra.md +3 -0
- package/CHANGELOG.md +40 -55
- package/LICENSE.md +1 -1
- package/README.md +24 -0
- package/dist/bundle.css +1 -1
- package/dist/bundle.js +10 -10
- package/dist/cjs/themes/index.d.ts +1 -0
- package/dist/cjs/themes/index.js +3 -1
- package/dist/components/Accordion/Accordion.types.d.ts +13 -2
- package/dist/components/ActionBar/ActionBar.types.d.ts +10 -0
- package/dist/components/Actionable/Actionable.types.d.ts +14 -0
- package/dist/components/Alert/Alert.types.d.ts +11 -0
- package/dist/components/Autocomplete/Autocomplete.types.d.ts +7 -0
- package/dist/components/Avatar/Avatar.types.d.ts +18 -0
- package/dist/components/Avatar/tests/Avatar.stories.js +1 -1
- package/dist/components/Badge/Badge.types.d.ts +25 -1
- package/dist/components/Badge/tests/Badge.test.stories.js +3 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +11 -0
- package/dist/components/Button/Button.types.d.ts +20 -0
- package/dist/components/Calendar/Calendar.types.d.ts +31 -0
- package/dist/components/Calendar/tests/Calendar.stories.js +1 -1
- package/dist/components/Card/Card.types.d.ts +12 -0
- package/dist/components/Carousel/Carousel.types.d.ts +13 -0
- package/dist/components/Checkbox/Checkbox.types.d.ts +19 -0
- package/dist/components/Checkbox/tests/Checkbox.stories.js +1 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.types.d.ts +10 -0
- package/dist/components/Container/Container.types.d.ts +11 -1
- package/dist/components/Dismissible/Dismissible.types.d.ts +10 -0
- package/dist/components/Divider/Divider.types.d.ts +6 -0
- package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +3 -0
- package/dist/components/FileUpload/FileUpload.types.d.ts +10 -0
- package/dist/components/Flyout/Flyout.types.d.ts +38 -0
- package/dist/components/Flyout/FlyoutContent.js +1 -1
- package/dist/components/FormControl/FormControl.types.d.ts +9 -0
- package/dist/components/Grid/Grid.js +3 -1
- package/dist/components/Grid/Grid.module.css +1 -1
- package/dist/components/Grid/Grid.types.d.ts +31 -0
- package/dist/components/Grid/tests/Grid.stories.d.ts +3 -0
- package/dist/components/Grid/tests/Grid.stories.js +39 -1
- package/dist/components/Hidden/Hidden.types.d.ts +4 -0
- package/dist/components/HiddenVisually/HiddenVisually.types.d.ts +1 -0
- package/dist/components/Hotkey/Hotkey.types.d.ts +4 -0
- package/dist/components/Icon/Icon.types.d.ts +6 -0
- package/dist/components/Image/Image.types.d.ts +15 -0
- package/dist/components/Link/Link.types.d.ts +7 -0
- package/dist/components/Loader/Loader.types.d.ts +5 -0
- package/dist/components/MenuItem/MenuItem.types.d.ts +13 -1
- package/dist/components/Modal/Modal.types.d.ts +19 -0
- package/dist/components/NumberField/NumberField.types.d.ts +10 -0
- package/dist/components/Overlay/Overlay.types.d.ts +13 -0
- package/dist/components/Pagination/Pagination.types.d.ts +11 -29
- package/dist/components/PinField/PinField.types.d.ts +13 -0
- package/dist/components/Popover/Popover.types.d.ts +3 -0
- package/dist/components/Progress/Progress.types.d.ts +9 -0
- package/dist/components/ProgressIndicator/ProgressIndicator.js +13 -84
- package/dist/components/ProgressIndicator/ProgressIndicator.module.css +1 -1
- package/dist/components/ProgressIndicator/ProgressIndicator.types.d.ts +8 -0
- package/dist/components/ProgressIndicator/tests/ProgressIndicator.stories.js +8 -1
- package/dist/components/Radio/Radio.types.d.ts +12 -0
- package/dist/components/RadioGroup/RadioGroup.types.d.ts +14 -0
- package/dist/components/Reshaped/Reshaped.types.d.ts +12 -0
- package/dist/components/Resizable/Resizable.types.d.ts +7 -0
- package/dist/components/Scrim/Scrim.types.d.ts +6 -1
- package/dist/components/ScrollArea/ScrollArea.types.d.ts +7 -0
- package/dist/components/Select/Select.types.d.ts +27 -0
- package/dist/components/Skeleton/Skeleton.types.d.ts +2 -0
- package/dist/components/Slider/Slider.types.d.ts +56 -0
- package/dist/components/Stepper/Stepper.types.d.ts +13 -0
- package/dist/components/Switch/Switch.types.d.ts +16 -0
- package/dist/components/Table/Table.types.d.ts +29 -0
- package/dist/components/Tabs/Tabs.module.css +1 -1
- package/dist/components/Tabs/Tabs.types.d.ts +24 -0
- package/dist/components/Tabs/TabsItem.js +2 -2
- package/dist/components/Tabs/tests/Tabs.stories.js +6 -6
- package/dist/components/Text/Text.types.d.ts +12 -0
- package/dist/components/TextArea/TextArea.types.d.ts +17 -0
- package/dist/components/TextField/TextField.types.d.ts +29 -0
- package/dist/components/Theme/Theme.js +4 -1
- package/dist/components/Theme/Theme.types.d.ts +5 -0
- package/dist/components/Timeline/Timeline.types.d.ts +7 -0
- package/dist/components/Toast/Toast.types.d.ts +18 -0
- package/dist/components/ToggleButton/ToggleButton.types.d.ts +9 -0
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.types.d.ts +8 -0
- package/dist/components/Tooltip/Tooltip.types.d.ts +5 -0
- package/dist/components/View/View.types.d.ts +56 -1
- package/dist/components/_private/Aligner/Aligner.types.d.ts +6 -0
- package/dist/themes/index.d.ts +1 -0
- package/dist/themes/index.js +1 -0
- package/package.json +21 -17
- package/LICENSE-SOURCE.md +0 -40
- package/dist/components/Grid/tests/Grid.test.stories.d.ts +0 -23
- package/dist/components/Grid/tests/Grid.test.stories.js +0 -42
@@ -1,19 +1,29 @@
|
|
1
1
|
import type { TextFieldBaseProps } from "../TextField";
|
2
2
|
import type * as G from "../../types/global";
|
3
3
|
export type BaseProps = Omit<TextFieldBaseProps, "endSlot" | "onChange" | "rounded" | "multiline"> & {
|
4
|
+
/** Callback when the component value is changed */
|
4
5
|
onChange?: G.ChangeHandler<number>;
|
6
|
+
/** aria-label attribute for the increase button */
|
5
7
|
increaseAriaLabel: string;
|
8
|
+
/** aria-label attribute for the decrease button */
|
6
9
|
decreaseAriaLabel: string;
|
10
|
+
/** Minimum value supported in the form field */
|
7
11
|
min?: number;
|
12
|
+
/** Maximum value supported in the form field */
|
8
13
|
max?: number;
|
14
|
+
/** Step at which the value will increase or decrease when clicking the button controls */
|
9
15
|
step?: number;
|
10
16
|
};
|
11
17
|
export type ControlledProps = BaseProps & {
|
18
|
+
/** Value of the form field, enables controlled mode */
|
12
19
|
value: number | null;
|
20
|
+
/** Default value of the form field, enables uncontrolled mode */
|
13
21
|
defaultValue?: never;
|
14
22
|
};
|
15
23
|
export type UncontrolledProps = BaseProps & {
|
24
|
+
/** Value of the form field, enables controlled mode */
|
16
25
|
value?: never;
|
26
|
+
/** Default value of the form field, enables uncontrolled mode */
|
17
27
|
defaultValue?: number;
|
18
28
|
};
|
19
29
|
export type Props = ControlledProps | UncontrolledProps;
|
@@ -2,21 +2,34 @@ import type React from "react";
|
|
2
2
|
import type * as G from "../../types/global";
|
3
3
|
export type CloseReason = "overlay-click" | "escape-key";
|
4
4
|
export type Props = {
|
5
|
+
/** Make the overlay transparent */
|
5
6
|
transparent?: boolean | number;
|
7
|
+
/** Make the overlay blurred */
|
6
8
|
blurred?: boolean;
|
9
|
+
/** Control the overflow of the component content */
|
7
10
|
overflow?: "auto" | "hidden";
|
11
|
+
/** Node for inserting children, render function receives the state of the component as an argument */
|
8
12
|
children?: React.ReactNode | ((props: {
|
9
13
|
active: boolean;
|
10
14
|
}) => React.ReactNode);
|
15
|
+
/** Control the visibility of the component */
|
11
16
|
active?: boolean;
|
17
|
+
/** Callback when the component is closed */
|
12
18
|
onClose?: (args: {
|
13
19
|
reason: CloseReason;
|
14
20
|
}) => void;
|
21
|
+
/** Callback after the component close transition is complete */
|
15
22
|
onAfterClose?: () => void;
|
23
|
+
/** Callback when the component is opened */
|
16
24
|
onOpen?: () => void;
|
25
|
+
/** Callback after the component open transition is complete */
|
17
26
|
onAfterOpen?: () => void;
|
27
|
+
/** Disable closing the component on outside click */
|
18
28
|
disableCloseOnClick?: boolean;
|
29
|
+
/** Element to render the component in */
|
19
30
|
containerRef?: React.RefObject<HTMLElement | null>;
|
31
|
+
/** Additional classname for the root element */
|
20
32
|
className?: G.ClassName;
|
33
|
+
/** Additional attributes for the root element */
|
21
34
|
attributes?: G.Attributes<"div">;
|
22
35
|
};
|
@@ -1,52 +1,34 @@
|
|
1
1
|
import type * as G from "../../types/global";
|
2
2
|
export type BaseProps = {
|
3
|
-
/**
|
4
|
-
* Total number of pages available
|
5
|
-
*/
|
3
|
+
/** Total number of pages available */
|
6
4
|
total: number;
|
7
|
-
/**
|
8
|
-
* Event handler triggered when the current page changes
|
9
|
-
*/
|
5
|
+
/** Callback when the current page changes */
|
10
6
|
onChange?: (args: {
|
11
7
|
page: number;
|
12
8
|
}) => void;
|
13
|
-
/**
|
14
|
-
* Function to dynamically get an aria-label for each
|
15
|
-
*/
|
9
|
+
/** Function to dynamically get an aria-label for each page */
|
16
10
|
pageAriaLabel?: (args: {
|
17
11
|
page: number;
|
18
12
|
}) => string;
|
19
|
-
/**
|
20
|
-
* aria-label for the previous page button
|
21
|
-
*/
|
13
|
+
/** aria-label attribute for the previous page button */
|
22
14
|
previousAriaLabel: string;
|
23
|
-
/**
|
24
|
-
* aria-label for the next page button
|
25
|
-
*/
|
15
|
+
/** aria-label attribute for the next page button */
|
26
16
|
nextAriaLabel: string;
|
27
|
-
/**
|
28
|
-
* Custom root element className
|
29
|
-
*/
|
17
|
+
/** Additional classname for the root element */
|
30
18
|
className?: G.ClassName;
|
31
|
-
/**
|
32
|
-
* Custom root element attributes
|
33
|
-
*/
|
19
|
+
/** Additional attributes for the root element */
|
34
20
|
attributes?: G.Attributes<"div">;
|
35
21
|
};
|
36
22
|
export type ControlledProps = BaseProps & {
|
37
|
-
/**
|
38
|
-
* Currently selected page number, starts with 1.
|
39
|
-
* Enables controlled component behavior.
|
40
|
-
*/
|
23
|
+
/** Currently selected page number, starts with 1, enables controlled mode */
|
41
24
|
page: number;
|
25
|
+
/** Default selected page number, starts with 1, enables uncontrolled mode */
|
42
26
|
defaultPage?: never;
|
43
27
|
};
|
44
28
|
export type UncontrolledProps = BaseProps & {
|
29
|
+
/** Currently selected page number, starts with 1, enables controlled mode */
|
45
30
|
page?: never;
|
46
|
-
/**
|
47
|
-
* Default selected page number, starts with 1.
|
48
|
-
* Enables uncontrolled component behavior.
|
49
|
-
*/
|
31
|
+
/** Default selected page number, starts with 1, enables uncontrolled mode */
|
50
32
|
defaultPage?: number;
|
51
33
|
};
|
52
34
|
export type Props = ControlledProps | UncontrolledProps;
|
@@ -1,22 +1,35 @@
|
|
1
1
|
import type * as G from "../../types/global";
|
2
2
|
export type Size = "small" | "medium" | "large" | "xlarge";
|
3
3
|
type BaseProps = {
|
4
|
+
/** Name of the input element */
|
4
5
|
name: string;
|
6
|
+
/** Amount of characters in the pin */
|
5
7
|
valueLength?: number;
|
8
|
+
/** Character pattern used in the input value */
|
6
9
|
pattern?: "alphabetic" | "numeric" | "alphanumeric";
|
10
|
+
/** Component size */
|
7
11
|
size?: G.Responsive<Size>;
|
12
|
+
/** Input fields render variant */
|
8
13
|
variant?: "outline" | "faded";
|
14
|
+
/** Callback when the input value changes */
|
9
15
|
onChange?: G.ChangeHandler<string>;
|
16
|
+
/** Additional attributes for the input element */
|
10
17
|
inputAttributes?: G.Attributes<"input">;
|
18
|
+
/** Additional classname for the root element */
|
11
19
|
className?: G.ClassName;
|
20
|
+
/** Additional attributes for the root element */
|
12
21
|
attributes?: G.Attributes<"div">;
|
13
22
|
};
|
14
23
|
export type ControlledProps = BaseProps & {
|
24
|
+
/** Value of the input element, enables controlled mode */
|
15
25
|
value: string;
|
26
|
+
/** Default value of the input element, enables uncontrolled mode */
|
16
27
|
defaultValue?: never;
|
17
28
|
};
|
18
29
|
export type UncontrolledProps = BaseProps & {
|
30
|
+
/** Value of the input element, enables controlled mode */
|
19
31
|
value?: never;
|
32
|
+
/** Default value of the input element, enables uncontrolled mode */
|
20
33
|
defaultValue?: string;
|
21
34
|
};
|
22
35
|
export type Props = ControlledProps | UncontrolledProps;
|
@@ -2,8 +2,11 @@ import type React from "react";
|
|
2
2
|
import type { FlyoutProps, FlyoutInstance } from "../Flyout";
|
3
3
|
export type Instance = FlyoutInstance;
|
4
4
|
export type Props = Pick<FlyoutProps, "id" | "position" | "forcePosition" | "fallbackPositions" | "onOpen" | "onClose" | "width" | "trapFocusMode" | "active" | "defaultActive" | "contentGap" | "contentShift" | "instanceRef" | "triggerType" | "disableHideAnimation" | "disableContentHover" | "disableCloseOnOutsideClick" | "autoFocus" | "containerRef" | "initialFocusRef" | "originCoordinates"> & {
|
5
|
+
/** Node for inserting children */
|
5
6
|
children?: React.ReactNode;
|
7
|
+
/** Content element padding, unit token multiplier */
|
6
8
|
padding?: number;
|
9
|
+
/** Component elevation level */
|
7
10
|
elevation?: "raised" | "overlay";
|
8
11
|
/** @deprecated use Flyout utility instead, will be removed in v4 */
|
9
12
|
variant?: "elevated" | "headless";
|
@@ -1,12 +1,21 @@
|
|
1
1
|
import type * as G from "../../types/global";
|
2
2
|
export type Props = {
|
3
|
+
/** Value of the progress bar controlling the size of the fill */
|
3
4
|
value?: number;
|
5
|
+
/** Lower value boundary of the progress bar */
|
4
6
|
max?: number;
|
7
|
+
/** Upper value boundary of the progress bar */
|
5
8
|
min?: number;
|
9
|
+
/** Component size */
|
6
10
|
size?: "small" | "medium";
|
11
|
+
/** Component color scheme */
|
7
12
|
color?: "primary" | "critical" | "warning" | "positive" | "media";
|
13
|
+
/** Duration of the progress bar animation in milliseconds */
|
8
14
|
duration?: number;
|
15
|
+
/** aria-label attribute for the root element */
|
9
16
|
ariaLabel?: string;
|
17
|
+
/** Additional classname for the root element */
|
10
18
|
className?: G.ClassName;
|
19
|
+
/** Additional attributes for the root element */
|
11
20
|
attributes?: G.Attributes<"div">;
|
12
21
|
};
|
@@ -1,30 +1,12 @@
|
|
1
1
|
"use client";
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
3
|
-
import React from "react";
|
4
3
|
import { classNames } from "../../utilities/props.js";
|
5
|
-
import { onNextFrame } from "../../utilities/animation.js";
|
6
|
-
import usePrevious from "../../hooks/_private/usePrevious.js";
|
7
4
|
import s from "./ProgressIndicator.module.css";
|
8
|
-
const
|
9
|
-
const
|
5
|
+
const VISIBLE_ITEMS = 7;
|
6
|
+
const HALF_ITEMS = Math.floor(VISIBLE_ITEMS / 2);
|
10
7
|
const ProgressIndicator = (props) => {
|
11
8
|
const { total, activeIndex = 0, color = "primary", ariaLabel, className, attributes } = props;
|
12
|
-
const
|
13
|
-
const firstRenderedIndex = React.useMemo(() => {
|
14
|
-
if (allItemsVisible)
|
15
|
-
return 0;
|
16
|
-
if (activeIndex <= BOUNDARY)
|
17
|
-
return 0;
|
18
|
-
if (activeIndex >= total - 1 - BOUNDARY)
|
19
|
-
return total - MAX_RENDERED_ITEMS;
|
20
|
-
return activeIndex - BOUNDARY;
|
21
|
-
}, [activeIndex, allItemsVisible, total]);
|
22
|
-
const [startIndex, setStartIndex] = React.useState(firstRenderedIndex);
|
23
|
-
const previousActiveIndex = usePrevious(activeIndex);
|
24
|
-
const [shift, setShift] = React.useState(null);
|
25
|
-
const [animated, setAnimatedState] = React.useState(true);
|
26
|
-
const animatedRef = React.useRef(true);
|
27
|
-
const rootClassName = classNames(s.root, className, shift && s[`--shift-${shift}`], color && s[`--color-${color}`], animated && s["--animated"]);
|
9
|
+
const rootClassName = classNames(s.root, className, color && s[`--color-${color}`]);
|
28
10
|
const barAttributes = ariaLabel
|
29
11
|
? {
|
30
12
|
"aria-label": ariaLabel,
|
@@ -34,69 +16,16 @@ const ProgressIndicator = (props) => {
|
|
34
16
|
"aria-valuemax": total - 1,
|
35
17
|
}
|
36
18
|
: {};
|
37
|
-
const
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
setAnimated(false);
|
48
|
-
};
|
49
|
-
React.useEffect(() => {
|
50
|
-
if (animated)
|
51
|
-
return;
|
52
|
-
setShift(null);
|
53
|
-
}, [animated]);
|
54
|
-
React.useEffect(() => {
|
55
|
-
if (shift)
|
56
|
-
return;
|
57
|
-
onNextFrame(() => setAnimated(true));
|
58
|
-
}, [shift, firstRenderedIndex]);
|
59
|
-
React.useEffect(() => {
|
60
|
-
if (previousActiveIndex === activeIndex)
|
61
|
-
return;
|
62
|
-
const direction = previousActiveIndex && activeIndex < previousActiveIndex ? "start" : "end";
|
63
|
-
const lastIndex = total - 1;
|
64
|
-
const endThreshold = lastIndex - BOUNDARY;
|
65
|
-
const isAtStartEdge = activeIndex < BOUNDARY || (direction === "end" && activeIndex === BOUNDARY);
|
66
|
-
const isAtEndEdge = activeIndex > endThreshold || (direction === "start" && activeIndex === endThreshold);
|
67
|
-
const isAtEdge = isAtStartEdge || isAtEndEdge;
|
68
|
-
if (allItemsVisible || isAtEdge || !animatedRef.current) {
|
69
|
-
setStartIndex(firstRenderedIndex);
|
70
|
-
return;
|
71
|
-
}
|
72
|
-
setStartIndex(firstRenderedIndex);
|
73
|
-
setShift(direction);
|
74
|
-
}, [activeIndex, firstRenderedIndex, allItemsVisible, previousActiveIndex, total]);
|
75
|
-
const renderItems = () => {
|
76
|
-
let selectionDelta = 0;
|
77
|
-
if (shift === "start")
|
78
|
-
selectionDelta = -1;
|
79
|
-
if (shift === "end")
|
80
|
-
selectionDelta = 1;
|
81
|
-
const itemAmount = Math.min(MAX_RENDERED_ITEMS, total);
|
82
|
-
const items = [];
|
83
|
-
const lastIndex = total - 1;
|
84
|
-
const activeVisibleIndex = activeIndex - startIndex + selectionDelta;
|
85
|
-
const rightExtra = Math.max(BOUNDARY - activeIndex, 0);
|
86
|
-
const leftExtra = Math.max(BOUNDARY - (lastIndex - activeIndex), 0);
|
87
|
-
const rightModifierIndex = activeVisibleIndex + rightExtra + 1;
|
88
|
-
const leftModifierIndex = activeVisibleIndex - leftExtra - 1;
|
89
|
-
for (let i = 0; i < itemAmount; i += 1) {
|
90
|
-
const isActive = i === activeVisibleIndex;
|
91
|
-
const isSmall = i === rightModifierIndex + 1 || i === leftModifierIndex - 1;
|
92
|
-
const isSmaller = i === rightModifierIndex + 2 || i === leftModifierIndex - 2;
|
93
|
-
const isHidden = i > rightModifierIndex + 2 || i < leftModifierIndex - 2;
|
94
|
-
const itemClassName = classNames(s.item, isActive && s["item--active"], !allItemsVisible && isSmall && s["item--variant-secondary"], !allItemsVisible && isSmaller && s["item--variant-tertiary"], !allItemsVisible && isHidden && s["item--variant-hidden"]);
|
95
|
-
items.push(_jsx("div", { className: itemClassName }, i));
|
96
|
-
}
|
97
|
-
return items;
|
98
|
-
};
|
99
|
-
return (_jsx("div", { ...attributes, className: rootClassName, children: _jsx("div", { ...barAttributes, className: s.container, onTransitionEnd: handleTransitionEnd, children: renderItems() }) }));
|
19
|
+
const transformIndex = total > VISIBLE_ITEMS
|
20
|
+
? Math.min(total - VISIBLE_ITEMS, Math.max(0, activeIndex - HALF_ITEMS))
|
21
|
+
: 0;
|
22
|
+
return (_jsx("div", { ...attributes, className: rootClassName, children: _jsx("div", { ...barAttributes, className: s.container, style: {
|
23
|
+
"--rs-progress-indicator-mod": transformIndex,
|
24
|
+
}, children: Array.from({ length: total }).map((_, i) => {
|
25
|
+
const itemClassName = classNames(s.item, i === activeIndex && s["item--active"], (i < activeIndex - (HALF_ITEMS - 1) || i > activeIndex + (HALF_ITEMS - 1)) &&
|
26
|
+
s["item--variant-secondary"]);
|
27
|
+
return _jsx("div", { className: itemClassName }, i);
|
28
|
+
}) }) }));
|
100
29
|
};
|
101
30
|
ProgressIndicator.displayName = "ProgressIndicator";
|
102
31
|
export default ProgressIndicator;
|
@@ -1 +1 @@
|
|
1
|
-
.root{line-height:0}.container{display:inline-flex;position:relative;
|
1
|
+
.root{box-sizing:initial;line-height:0;margin-inline:calc(var(--rs-unit-x4) * -1);mask-image:linear-gradient(to right,transparent 0,#000 var(--rs-unit-x4),#000 calc(100% - var(--rs-unit-x4)),transparent 100%);max-width:calc(var(--rs-unit-x2) * 15);overflow:hidden;padding-inline:var(--rs-unit-x4)}.container{display:inline-flex;position:relative;transform:translateX(calc(var(--rs-unit-x4) * -1 * var(--rs-progress-indicator-mod)));transition:var(--rs-duration-slow) var(--rs-easing-decelerate);transition-property:transform;vertical-align:top}.item{background:var(--rs-color-background-neutral);border-radius:var(--rs-radius-circular);height:var(--rs-unit-x2);margin-inline-start:var(--rs-unit-x2);transform:translateZ(0);transition:var(--rs-duration-slow) var(--rs-easing-decelerate);transition-property:transform,opacity,background-color,width;width:var(--rs-unit-x2)}.item:first-child{margin-inline-start:0}.item.item--active{background:var(--rs-color-background-primary);width:var(--rs-unit-x6)}.item.item--variant-secondary{opacity:.5}.--color-media .item{background:var(--rs-color-white);opacity:.5}.--color-media .item.item--active{opacity:1}.--color-media .item.item--variant-secondary{opacity:.25}
|
@@ -1,9 +1,17 @@
|
|
1
1
|
import type * as G from "../../types/global";
|
2
2
|
export type Props = {
|
3
|
+
/** Total amount of progress indicator dots */
|
3
4
|
total: number;
|
5
|
+
/** Index of the active progress indicator dot */
|
4
6
|
activeIndex?: number;
|
7
|
+
/** Component size */
|
8
|
+
size?: "small" | "medium";
|
9
|
+
/** Component color scheme */
|
5
10
|
color?: "primary" | "media";
|
11
|
+
/** aria-label attribute for the root element */
|
6
12
|
ariaLabel?: string;
|
13
|
+
/** Additional classname for the root element */
|
7
14
|
className?: G.ClassName;
|
15
|
+
/** Additional attributes for the root element */
|
8
16
|
attributes?: G.Attributes<"div">;
|
9
17
|
};
|
@@ -36,7 +36,14 @@ export const base = {
|
|
36
36
|
</Button>
|
37
37
|
<Text weight="medium">Index: {activeIndex}</Text>
|
38
38
|
</View>
|
39
|
-
|
39
|
+
|
40
|
+
<View borderRadius="medium" overflow="hidden" width="300px">
|
41
|
+
<Scrim position="bottom" backgroundSlot={<View aspectRatio={16 / 9} backgroundColor="neutral-faded"/>}>
|
42
|
+
<View align="center">
|
43
|
+
<ProgressIndicator total={total} activeIndex={activeIndex} color="media"/>
|
44
|
+
</View>
|
45
|
+
</Scrim>
|
46
|
+
</View>
|
40
47
|
</View>
|
41
48
|
</Example.Item>
|
42
49
|
</Example>);
|
@@ -1,17 +1,29 @@
|
|
1
1
|
import type React from "react";
|
2
2
|
import type * as G from "../../types/global";
|
3
3
|
type BaseProps = {
|
4
|
+
/** Node for inserting children */
|
4
5
|
children?: React.ReactNode;
|
6
|
+
/** Name of the input element */
|
5
7
|
name?: string;
|
8
|
+
/** Disable the form field from the form submission */
|
6
9
|
disabled?: boolean;
|
10
|
+
/** Indicate that the form field has an error */
|
7
11
|
hasError?: boolean;
|
12
|
+
/** Value of the input element */
|
8
13
|
value: string;
|
14
|
+
/** Component size */
|
9
15
|
size?: G.Responsive<"small" | "medium" | "large">;
|
16
|
+
/** Callback when the input value changes */
|
10
17
|
onChange?: G.ChangeHandler<boolean>;
|
18
|
+
/** Callback when the input is focused */
|
11
19
|
onFocus?: (e: React.FocusEvent) => void;
|
20
|
+
/** Callback when the input is blurred */
|
12
21
|
onBlur?: (e: React.FocusEvent) => void;
|
22
|
+
/** Additional classname for the root element */
|
13
23
|
className?: G.ClassName;
|
24
|
+
/** Additional attributes for the root element */
|
14
25
|
attributes?: G.Attributes<"label">;
|
26
|
+
/** Additional attributes for the input element */
|
15
27
|
inputAttributes?: G.Attributes<"input">;
|
16
28
|
};
|
17
29
|
export type ControlledProps = BaseProps & {
|
@@ -2,19 +2,33 @@ import type React from "react";
|
|
2
2
|
import type * as G from "../../types/global";
|
3
3
|
import type { RadioProps } from "../Radio";
|
4
4
|
type BaseProps = {
|
5
|
+
/** Unique identifier for the radio group */
|
5
6
|
id?: string;
|
7
|
+
/** Node for inserting children */
|
6
8
|
children?: React.ReactNode;
|
9
|
+
/** Disable the form field from the form submission */
|
7
10
|
disabled?: boolean;
|
11
|
+
/** Name of the input element */
|
8
12
|
name: string;
|
13
|
+
/** Indicate that the form field has an error */
|
9
14
|
hasError?: boolean;
|
15
|
+
/** Callback when the input value changes */
|
10
16
|
onChange?: G.ChangeHandler<string>;
|
17
|
+
/** Additional classname for the root element */
|
18
|
+
className?: G.ClassName;
|
19
|
+
/** Additional attributes for the root element */
|
20
|
+
attributes?: G.Attributes<"div">;
|
11
21
|
};
|
12
22
|
export type ControlledProps = BaseProps & {
|
23
|
+
/** Value of the input element, enables controlled mode */
|
13
24
|
value: string | null;
|
25
|
+
/** Default value of the input element, enables uncontrolled mode */
|
14
26
|
defaultValue?: never;
|
15
27
|
};
|
16
28
|
export type UncontrolledProps = BaseProps & {
|
29
|
+
/** Value of the input element, enables controlled mode */
|
17
30
|
value?: never;
|
31
|
+
/** Default value of the input element, enables uncontrolled mode */
|
18
32
|
defaultValue?: string;
|
19
33
|
};
|
20
34
|
export type Props = ControlledProps | UncontrolledProps;
|
@@ -3,14 +3,26 @@ import type { GlobalColorModeProps, ThemeProps } from "../Theme";
|
|
3
3
|
import type { ToastProviderProps } from "../Toast";
|
4
4
|
import type * as G from "../../types/global";
|
5
5
|
export type Props = {
|
6
|
+
/** Node for inserting children */
|
6
7
|
children?: React.ReactNode;
|
8
|
+
/** Theme of the application, enables controlled mode */
|
7
9
|
theme?: NonNullable<ThemeProps["name"]>;
|
10
|
+
/** Default theme of the application, enables uncontrolled mode */
|
8
11
|
defaultTheme?: NonNullable<ThemeProps["defaultName"]>;
|
12
|
+
/** Default content direction of the application */
|
9
13
|
defaultRTL?: boolean;
|
14
|
+
/** Color mode of the application, enables controlled mode */
|
10
15
|
colorMode?: GlobalColorModeProps["mode"];
|
16
|
+
/** Default color mode of the application, enables uncontrolled mode */
|
11
17
|
defaultColorMode?: GlobalColorModeProps["defaultMode"];
|
18
|
+
/** Default viewport size of the application */
|
12
19
|
defaultViewport?: G.Viewport;
|
20
|
+
/** Global options for the ToastProvider */
|
13
21
|
toastOptions?: ToastProviderProps["options"];
|
22
|
+
/** Enable scoped mode for applications not using Reshaped provider at the application root */
|
14
23
|
scoped?: boolean;
|
24
|
+
/** Additional classname for the root element */
|
15
25
|
className?: G.ClassName;
|
26
|
+
/** Additional attributes for the root element */
|
27
|
+
attributes?: G.Attributes<"div">;
|
16
28
|
};
|
@@ -2,19 +2,26 @@ import type React from "react";
|
|
2
2
|
import type { ViewProps } from "../View";
|
3
3
|
import type { UseDragCallbackArgs } from "../../hooks/_private/useDrag";
|
4
4
|
export type Props = {
|
5
|
+
/** Component render variant */
|
5
6
|
variant?: "bordered" | "borderless";
|
7
|
+
/** Component content direction with the resize handle rendered in between the chidlren */
|
6
8
|
direction?: Extract<ViewProps["direction"], "row" | "column">;
|
7
9
|
} & Pick<ViewProps, "children" | "className" | "attributes" | "height" | "gap">;
|
8
10
|
export type ItemProps = {
|
11
|
+
/** Node for inserting content */
|
9
12
|
children: React.ReactNode;
|
13
|
+
/** Minimum size of the resizable pane */
|
10
14
|
minSize?: `${number}px`;
|
15
|
+
/** Maximum size of the resizable pane */
|
11
16
|
maxSize?: `${number}px`;
|
17
|
+
/** Default size of the resizable pane */
|
12
18
|
defaultSize?: `${number}px`;
|
13
19
|
};
|
14
20
|
export type PrivateItemProps = ItemProps & {
|
15
21
|
index: number;
|
16
22
|
};
|
17
23
|
export type HandleProps = {
|
24
|
+
/** Render function for custom resize handles with attributes and props passed as arguments */
|
18
25
|
children?: (attributes: {
|
19
26
|
ref: React.RefObject<HTMLButtonElement | null>;
|
20
27
|
}, props: Pick<Props, "direction"> & {
|
@@ -1,11 +1,16 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import type * as G from "../../types/global";
|
3
3
|
export type Props = {
|
4
|
+
/** Node for inserting content */
|
4
5
|
children?: React.ReactNode;
|
6
|
+
/** Node for inserting background content behind the scrim */
|
5
7
|
backgroundSlot?: React.ReactNode;
|
8
|
+
/** Component content position */
|
6
9
|
position?: "full" | "top" | "bottom" | "start" | "end";
|
7
|
-
|
10
|
+
/** Additional classname for the scrim element */
|
8
11
|
scrimClassName?: G.ClassName;
|
12
|
+
/** Additional classname for the root element */
|
9
13
|
className?: G.ClassName;
|
14
|
+
/** Additional attributes for the root element */
|
10
15
|
attributes?: G.Attributes<"div">;
|
11
16
|
};
|
@@ -1,12 +1,19 @@
|
|
1
1
|
import type React from "react";
|
2
2
|
import type * as G from "../../types/global";
|
3
3
|
export type Props = {
|
4
|
+
/** Node for inserting content */
|
4
5
|
children: React.ReactNode;
|
6
|
+
/** Scrollbar visibility behavior based on the user interaction */
|
5
7
|
scrollbarDisplay?: "visible" | "hover" | "hidden";
|
8
|
+
/** Callback when the scroll area is scrolled */
|
6
9
|
onScroll?: (args: G.Coordinates) => void;
|
10
|
+
/** Height of the scroll area, literal css value or unit token multiplier */
|
7
11
|
height?: G.Responsive<string | number>;
|
12
|
+
/** Maximum height of the scroll area, literal css value or unit token multiplier */
|
8
13
|
maxHeight?: G.Responsive<string | number>;
|
14
|
+
/** Additional classname for the root element */
|
9
15
|
className?: G.ClassName;
|
16
|
+
/** Additional attributes for the root element */
|
10
17
|
attributes?: G.Attributes<"div">;
|
11
18
|
};
|
12
19
|
export type BarProps = {
|
@@ -5,38 +5,65 @@ import type { ActionableProps } from "../Actionable";
|
|
5
5
|
import type { IconProps } from "../Icon";
|
6
6
|
type Size = G.Responsive<"small" | "medium" | "large" | "xlarge">;
|
7
7
|
type Option = {
|
8
|
+
/** Option text label */
|
8
9
|
label: string;
|
10
|
+
/** Option value used in the form submission */
|
9
11
|
value: string;
|
12
|
+
/** Disable the option from the selection */
|
10
13
|
disabled?: boolean;
|
11
14
|
};
|
12
15
|
export type ButtonTriggerProps = {
|
16
|
+
/** Callback when the button is clicked */
|
13
17
|
onClick?: () => void;
|
18
|
+
/** Node for inserting children */
|
14
19
|
children?: React.ReactNode;
|
20
|
+
/** Additional attributes for the input element */
|
15
21
|
inputAttributes?: ActionableProps["attributes"];
|
22
|
+
/** Callback when the input is focused */
|
16
23
|
onFocus?: (e: React.FocusEvent<HTMLButtonElement>) => void;
|
24
|
+
/** Callback when the input is blurred */
|
17
25
|
onBlur?: (e: React.FocusEvent<HTMLButtonElement>) => void;
|
26
|
+
/** Options for the select */
|
18
27
|
options?: never;
|
28
|
+
/** Callback when the input value changes */
|
19
29
|
onChange?: never;
|
20
30
|
};
|
21
31
|
export type SelectTriggerProps = {
|
32
|
+
/** Options for the select */
|
22
33
|
options: Option[];
|
34
|
+
/** Callback when the input value changes */
|
23
35
|
onChange?: G.ChangeHandler<string, React.ChangeEvent<HTMLSelectElement>>;
|
36
|
+
/** Callback when the input is focused */
|
24
37
|
onFocus?: (e: React.FocusEvent<HTMLSelectElement>) => void;
|
38
|
+
/** Callback when the input is blurred */
|
25
39
|
onBlur?: (e: React.FocusEvent<HTMLSelectElement>) => void;
|
40
|
+
/** Additional attributes for the input element */
|
26
41
|
inputAttributes?: G.Attributes<"select">;
|
42
|
+
/** Callback when the button is clicked */
|
27
43
|
onClick?: never;
|
44
|
+
/** Node for inserting children */
|
28
45
|
children?: never;
|
29
46
|
};
|
30
47
|
type BaseProps = ((ButtonTriggerProps | SelectTriggerProps) & Pick<FormControlProps, "hasError">) & {
|
48
|
+
/** Unique identifier for the select */
|
31
49
|
id?: string;
|
50
|
+
/** Name of the input element */
|
32
51
|
name: string;
|
52
|
+
/** Component size */
|
33
53
|
size?: Size;
|
54
|
+
/** Component render variant */
|
34
55
|
variant?: "outline" | "faded" | "headless";
|
56
|
+
/** Disable the select user interaction and form submission */
|
35
57
|
disabled?: boolean;
|
58
|
+
/** Placeholder text when there is no value selected */
|
36
59
|
placeholder?: string;
|
60
|
+
/** Icon to display in the select start position */
|
37
61
|
icon?: IconProps["svg"];
|
62
|
+
/** Node for inserting content before the select value */
|
38
63
|
startSlot?: React.ReactNode;
|
64
|
+
/** Additional classname for the root element */
|
39
65
|
className?: G.ClassName;
|
66
|
+
/** Additional attributes for the root element */
|
40
67
|
attributes?: G.Attributes<"div">;
|
41
68
|
};
|
42
69
|
export type ControlledProps = BaseProps & {
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import type { ViewProps } from "../View";
|
2
2
|
import type * as G from "../../types/global";
|
3
3
|
export type Props = Pick<ViewProps, "width" | "height" | "borderRadius"> & {
|
4
|
+
/** Additional classname for the root element */
|
4
5
|
className?: G.ClassName;
|
6
|
+
/** Additional attributes for the root element */
|
5
7
|
attributes?: G.Attributes<"div">;
|
6
8
|
};
|