reshaped 3.9.1-canary.3 → 3.10.0-canary.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.d.ts +2 -2
- package/dist/bundle.js +2 -2
- package/dist/components/Accordion/AccordionControlled.js +1 -1
- package/dist/components/Accordion/AccordionTrigger.js +1 -1
- package/dist/components/ActionBar/ActionBar.js +2 -1
- package/dist/components/Avatar/Avatar.js +2 -1
- package/dist/components/Badge/Badge.js +1 -1
- package/dist/components/Badge/BadgeContainer.js +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/components/Button/Button.js +2 -1
- package/dist/components/Button/ButtonGroup.js +1 -1
- package/dist/components/Calendar/CalendarDate.js +1 -1
- package/dist/components/Card/Card.js +1 -1
- package/dist/components/Carousel/Carousel.js +3 -2
- package/dist/components/Carousel/CarouselControl.js +1 -1
- package/dist/components/Checkbox/Checkbox.js +2 -1
- package/dist/components/Container/Container.js +1 -1
- package/dist/components/Dismissible/Dismissible.js +1 -1
- package/dist/components/Divider/Divider.js +2 -1
- package/dist/components/DropdownMenu/DropdownMenu.js +1 -1
- package/dist/components/FileUpload/FileUpload.js +1 -1
- package/dist/components/Flyout/Flyout.types.d.ts +1 -1
- package/dist/components/Flyout/FlyoutContent.js +1 -1
- package/dist/components/Flyout/FlyoutControlled.js +2 -1
- package/dist/components/Grid/Grid.js +2 -1
- package/dist/components/Hidden/Hidden.js +2 -1
- package/dist/components/HiddenInput/HiddenInput.js +1 -1
- package/dist/components/Hotkey/Hotkey.js +1 -1
- package/dist/components/Icon/Icon.js +1 -1
- package/dist/components/Image/Image.js +1 -1
- package/dist/components/Link/Link.js +1 -1
- package/dist/components/Loader/Loader.js +2 -1
- package/dist/components/MenuItem/MenuItem.js +2 -1
- package/dist/components/Modal/Modal.js +3 -2
- package/dist/components/Overlay/Overlay.js +2 -2
- package/dist/components/Popover/Popover.js +1 -1
- package/dist/components/Progress/Progress.js +1 -1
- package/dist/components/ProgressIndicator/ProgressIndicator.js +1 -1
- package/dist/components/Radio/Radio.js +2 -1
- package/dist/components/Reshaped/Reshaped.js +1 -1
- package/dist/components/Resizable/Resizable.js +1 -1
- package/dist/components/Resizable/ResizableHandle.js +1 -1
- package/dist/components/Scrim/Scrim.js +1 -1
- package/dist/components/ScrollArea/ScrollArea.js +2 -2
- package/dist/components/Select/SelectNative.js +1 -1
- package/dist/components/Select/SelectRoot.js +2 -1
- package/dist/components/Skeleton/Skeleton.js +1 -1
- package/dist/components/Slider/Slider.utilities.d.ts +7 -0
- package/dist/components/Slider/Slider.utilities.js +11 -0
- package/dist/components/Slider/SliderControlled.js +15 -6
- package/dist/components/Slider/SliderThumb.js +1 -1
- package/dist/components/Switch/Switch.js +2 -1
- package/dist/components/Table/Table.js +2 -1
- package/dist/components/Tabs/TabsItem.js +2 -2
- package/dist/components/Tabs/TabsList.js +1 -1
- package/dist/components/Tabs/TabsPanel.js +2 -2
- package/dist/components/Text/Text.js +2 -1
- package/dist/components/TextArea/TextArea.js +2 -1
- package/dist/components/TextField/TextField.js +2 -1
- package/dist/components/Theme/Theme.js +1 -1
- package/dist/components/Timeline/Timeline.js +1 -1
- package/dist/components/Toast/ToastContainer.js +3 -2
- package/dist/components/Toast/ToastRegion.js +2 -2
- package/dist/components/View/View.js +2 -1
- package/dist/components/_private/Aligner/Aligner.js +1 -1
- package/dist/components/_private/Expandable/Expandable.js +1 -1
- package/dist/core/Actionable/Actionable.js +1 -1
- package/dist/hooks/_private/useDrag.js +1 -1
- package/dist/hooks/_private/useFadeSide.js +1 -1
- package/dist/hooks/_private/useSingletonKeyboardMode.js +1 -1
- package/dist/hooks/useKeyboardArrowNavigation.js +1 -1
- package/dist/hooks/useScrollLock.js +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/utilities/helpers.d.ts +0 -1
- package/dist/utilities/helpers.js +0 -14
- package/dist/utilities/props.d.ts +0 -4
- package/dist/utilities/props.js +0 -18
- package/package.json +4 -4
- package/dist/utilities/Chain.d.ts +0 -20
- package/dist/utilities/Chain.js +0 -60
- package/dist/utilities/a11y/TrapFocus.d.ts +0 -28
- package/dist/utilities/a11y/TrapFocus.js +0 -162
- package/dist/utilities/a11y/TrapScreenReader.d.ts +0 -15
- package/dist/utilities/a11y/TrapScreenReader.js +0 -42
- package/dist/utilities/a11y/focus.d.ts +0 -38
- package/dist/utilities/a11y/focus.js +0 -101
- package/dist/utilities/a11y/index.d.ts +0 -4
- package/dist/utilities/a11y/index.js +0 -3
- package/dist/utilities/a11y/keyboardMode.d.ts +0 -3
- package/dist/utilities/a11y/keyboardMode.js +0 -10
- package/dist/utilities/a11y/types.d.ts +0 -24
- package/dist/utilities/a11y/types.js +0 -1
- package/dist/utilities/css.d.ts +0 -7
- package/dist/utilities/css.js +0 -18
- package/dist/utilities/dom/event.d.ts +0 -7
- package/dist/utilities/dom/event.js +0 -11
- package/dist/utilities/dom/find.d.ts +0 -10
- package/dist/utilities/dom/find.js +0 -37
- package/dist/utilities/dom/index.d.ts +0 -3
- package/dist/utilities/dom/index.js +0 -3
- package/dist/utilities/dom/shadowDom.d.ts +0 -1
- package/dist/utilities/dom/shadowDom.js +0 -4
- package/dist/utilities/platform.d.ts +0 -1
- package/dist/utilities/platform.js +0 -16
- package/dist/utilities/scroll/disable.d.ts +0 -7
- package/dist/utilities/scroll/disable.js +0 -15
- package/dist/utilities/scroll/helpers.d.ts +0 -1
- package/dist/utilities/scroll/helpers.js +0 -17
- package/dist/utilities/scroll/index.d.ts +0 -2
- package/dist/utilities/scroll/index.js +0 -2
- package/dist/utilities/scroll/lock.d.ts +0 -5
- package/dist/utilities/scroll/lock.js +0 -32
- package/dist/utilities/scroll/lockSafari.d.ts +0 -2
- package/dist/utilities/scroll/lockSafari.js +0 -20
- package/dist/utilities/scroll/lockStandard.d.ts +0 -4
- package/dist/utilities/scroll/lockStandard.js +0 -15
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { classNames } from "@reshaped/utilities";
|
|
4
|
+
import { disableScroll, enableScroll } from "@reshaped/utilities/internal";
|
|
3
5
|
import React from "react";
|
|
4
6
|
import { useFormControl } from "../FormControl/index.js";
|
|
5
7
|
import useElementId from "../../hooks/useElementId.js";
|
|
6
8
|
import useHandlerRef from "../../hooks/useHandlerRef.js";
|
|
7
9
|
import useRTL from "../../hooks/useRTL.js";
|
|
8
|
-
import { triggerChangeEvent } from "../../utilities/dom/index.js";
|
|
9
|
-
import { classNames } from "../../utilities/props.js";
|
|
10
|
-
import { disableScroll, enableScroll } from "../../utilities/scroll/index.js";
|
|
11
10
|
import s from "./Slider.module.css";
|
|
12
|
-
import { applyStepToValue, getDragCoord } from "./Slider.utilities.js";
|
|
11
|
+
import { applyStepToValue, getDragCoord, triggerChangeEvent } from "./Slider.utilities.js";
|
|
13
12
|
import SliderThumb from "./SliderThumb.js";
|
|
14
13
|
const THUMB_SIZE = 16;
|
|
15
14
|
const SliderControlled = (props) => {
|
|
@@ -93,13 +92,18 @@ const SliderControlled = (props) => {
|
|
|
93
92
|
// @ts-ignore
|
|
94
93
|
if (options.commit)
|
|
95
94
|
onChangeCommitRef.current?.(args);
|
|
95
|
+
// Keyboard changes should commit immediately
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
97
|
+
// @ts-ignore
|
|
98
|
+
if (options.native && !draggingId)
|
|
99
|
+
onChangeCommitRef.current?.(args);
|
|
96
100
|
// Manually controlled resolving of single/range handlers
|
|
97
101
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
98
102
|
// @ts-ignore
|
|
99
103
|
if (options.native)
|
|
100
104
|
onChangeRef.current?.(args);
|
|
101
105
|
triggerChangeEvent(minInputRef.current, value.toString());
|
|
102
|
-
}, [maxValue, name, minName, maxName,
|
|
106
|
+
}, [range, maxValue, name, minName, maxName, draggingId, onChangeCommitRef, onChangeRef]);
|
|
103
107
|
const handleMaxChange = React.useCallback((value, options = {}) => {
|
|
104
108
|
const args = range
|
|
105
109
|
? { minValue: minValue, maxValue: value, name, minName, maxName }
|
|
@@ -109,13 +113,18 @@ const SliderControlled = (props) => {
|
|
|
109
113
|
// @ts-ignore
|
|
110
114
|
if (options.commit)
|
|
111
115
|
onChangeCommitRef.current?.(args);
|
|
116
|
+
// Keyboard changes should commit immediately
|
|
117
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
118
|
+
// @ts-ignore
|
|
119
|
+
if (options.native && !draggingId)
|
|
120
|
+
onChangeCommitRef.current?.(args);
|
|
112
121
|
// Manually controlled resolving of single/range handlers
|
|
113
122
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
114
123
|
// @ts-ignore
|
|
115
124
|
if (options.native)
|
|
116
125
|
onChangeRef.current?.(args);
|
|
117
126
|
triggerChangeEvent(maxInputRef.current, value.toString());
|
|
118
|
-
}, [minValue, name, minName, maxName,
|
|
127
|
+
}, [range, minValue, name, minName, maxName, onChangeCommitRef, draggingId, onChangeRef]);
|
|
119
128
|
const handleMouseDown = ({ nativeEvent }) => {
|
|
120
129
|
if (disabled)
|
|
121
130
|
return;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { classNames } from "@reshaped/utilities";
|
|
3
4
|
import React from "react";
|
|
4
5
|
import Text from "../Text/index.js";
|
|
5
6
|
import Theme from "../Theme/index.js";
|
|
6
|
-
import { classNames } from "../../utilities/props.js";
|
|
7
7
|
import s from "./Slider.module.css";
|
|
8
8
|
import { getPrecision } from "./Slider.utilities.js";
|
|
9
9
|
const SliderThumb = React.forwardRef((props, ref) => {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { classNames } from "@reshaped/utilities";
|
|
3
4
|
import { useFormControl } from "../FormControl/index.js";
|
|
4
5
|
import Text from "../Text/index.js";
|
|
5
6
|
import useElementId from "../../hooks/useElementId.js";
|
|
6
|
-
import {
|
|
7
|
+
import { responsiveClassNames, responsivePropDependency } from "../../utilities/props.js";
|
|
7
8
|
import s from "./Switch.module.css";
|
|
8
9
|
const Switch = (props) => {
|
|
9
10
|
const { children, name, checked, size = "medium", reversed, defaultChecked, onChange, onFocus, onBlur, className, attributes, } = props;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { classNames } from "@reshaped/utilities";
|
|
3
4
|
import React, { isValidElement } from "react";
|
|
4
5
|
import useFadeSide from "../../hooks/_private/useFadeSide.js";
|
|
5
6
|
import { resolveMixin } from "../../styles/mixin.js";
|
|
6
|
-
import {
|
|
7
|
+
import { responsiveVariables } from "../../utilities/props.js";
|
|
7
8
|
import s from "./Table.module.css";
|
|
8
9
|
const TableCellPrivate = (props) => {
|
|
9
10
|
const { minWidth, rowSpan, colSpan, align, verticalAlign, tagName: TagName, padding, paddingInline, paddingBlock, children, className, attributes, } = props;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { classNames } from "@reshaped/utilities";
|
|
4
|
+
import { findParent } from "@reshaped/utilities/internal";
|
|
3
5
|
import React from "react";
|
|
4
6
|
import Actionable from "../Actionable/index.js";
|
|
5
7
|
import HiddenInput from "../HiddenInput/index.js";
|
|
6
8
|
import Icon from "../Icon/index.js";
|
|
7
9
|
import Text from "../Text/index.js";
|
|
8
10
|
import useIsomorphicLayoutEffect from "../../hooks/useIsomorphicLayoutEffect.js";
|
|
9
|
-
import { findParent } from "../../utilities/dom/index.js";
|
|
10
|
-
import { classNames } from "../../utilities/props.js";
|
|
11
11
|
import s from "./Tabs.module.css";
|
|
12
12
|
import { useTabs } from "./TabsContext.js";
|
|
13
13
|
const TabsItem = React.forwardRef((props, ref) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { classNames } from "@reshaped/utilities";
|
|
3
4
|
import React from "react";
|
|
4
5
|
import Actionable from "../Actionable/index.js";
|
|
5
6
|
import Icon from "../Icon/index.js";
|
|
@@ -9,7 +10,6 @@ import useKeyboardArrowNavigation from "../../hooks/useKeyboardArrowNavigation.j
|
|
|
9
10
|
import useRTL from "../../hooks/useRTL.js";
|
|
10
11
|
import IconChevronLeft from "../../icons/ChevronLeft.js";
|
|
11
12
|
import IconChevronRight from "../../icons/ChevronRight.js";
|
|
12
|
-
import { classNames } from "../../utilities/props.js";
|
|
13
13
|
import s from "./Tabs.module.css";
|
|
14
14
|
import { useTabs } from "./TabsContext.js";
|
|
15
15
|
import TabsItem from "./TabsItem.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { classNames } from "@reshaped/utilities";
|
|
4
|
+
import { getFocusableElements } from "@reshaped/utilities/internal";
|
|
3
5
|
import React from "react";
|
|
4
|
-
import { getFocusableElements } from "../../utilities/a11y/index.js";
|
|
5
|
-
import { classNames } from "../../utilities/props.js";
|
|
6
6
|
import s from "./Tabs.module.css";
|
|
7
7
|
import { useTabs } from "./TabsContext.js";
|
|
8
8
|
const TabsPanel = (props) => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { classNames } from "@reshaped/utilities";
|
|
2
3
|
import { resolveMixin } from "../../styles/mixin.js";
|
|
3
|
-
import {
|
|
4
|
+
import { responsiveClassNames } from "../../utilities/props.js";
|
|
4
5
|
import s from "./Text.module.css";
|
|
5
6
|
const tagMap = {
|
|
6
7
|
"title-1": "h1",
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { classNames } from "@reshaped/utilities";
|
|
3
4
|
import React from "react";
|
|
4
5
|
import { useFormControl } from "../FormControl/index.js";
|
|
5
6
|
import useElementId from "../../hooks/useElementId.js";
|
|
6
|
-
import {
|
|
7
|
+
import { responsiveClassNames } from "../../utilities/props.js";
|
|
7
8
|
import s from "./TextArea.module.css";
|
|
8
9
|
const TextArea = (props) => {
|
|
9
10
|
const { onChange, onFocus, onBlur, name, value, defaultValue, placeholder, size = "medium", variant = "outline", resize, className, attributes, } = props;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { classNames } from "@reshaped/utilities";
|
|
3
4
|
import React from "react";
|
|
4
5
|
import { useFormControl } from "../FormControl/index.js";
|
|
5
6
|
import Icon from "../Icon/index.js";
|
|
6
7
|
import useElementId from "../../hooks/useElementId.js";
|
|
7
|
-
import {
|
|
8
|
+
import { responsiveClassNames, responsivePropDependency } from "../../utilities/props.js";
|
|
8
9
|
import s from "./TextField.module.css";
|
|
9
10
|
const TextFieldSlot = (props) => {
|
|
10
11
|
const { slot, icon, size, affix, position, id } = props;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { classNames } from "@reshaped/utilities";
|
|
3
4
|
import React from "react";
|
|
4
5
|
import useIsomorphicLayoutEffect from "../../hooks/useIsomorphicLayoutEffect.js";
|
|
5
|
-
import { classNames } from "../../utilities/props.js";
|
|
6
6
|
import { ThemeContext } from "./Theme.context.js";
|
|
7
7
|
import s from "./Theme.module.css";
|
|
8
8
|
import { getRootThemeEl } from "./Theme.utilities.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { classNames } from "@reshaped/utilities";
|
|
2
3
|
import React, { isValidElement } from "react";
|
|
3
4
|
import View from "../View/index.js";
|
|
4
|
-
import { classNames } from "../../utilities/props.js";
|
|
5
5
|
import s from "./Timeline.module.css";
|
|
6
6
|
export const TimelineItem = (props) => {
|
|
7
7
|
const { children, markerSlot, className, attributes } = props;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { TrapFocus } from "@reshaped/utilities";
|
|
4
|
+
import { classNames } from "@reshaped/utilities";
|
|
5
|
+
import { checkKeyboardMode } from "@reshaped/utilities/internal";
|
|
3
6
|
import React from "react";
|
|
4
|
-
import { checkKeyboardMode, TrapFocus } from "../../utilities/a11y/index.js";
|
|
5
7
|
import { onNextFrame } from "../../utilities/animation.js";
|
|
6
|
-
import { classNames } from "../../utilities/props.js";
|
|
7
8
|
import Toast from "./Toast.js";
|
|
8
9
|
import { timeouts } from "./Toast.constants.js";
|
|
9
10
|
import ToastContext from "./Toast.context.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { classNames } from "@reshaped/utilities";
|
|
4
|
+
import { focusableSelector } from "@reshaped/utilities/internal";
|
|
3
5
|
import React from "react";
|
|
4
|
-
import { focusableSelector } from "../../utilities/a11y/index.js";
|
|
5
|
-
import { classNames } from "../../utilities/props.js";
|
|
6
6
|
import ToastContext from "./Toast.context.js";
|
|
7
7
|
import s from "./Toast.module.css";
|
|
8
8
|
import ToastContainer from "./ToastContainer.js";
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { createElement as _createElement } from "react";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { classNames } from "@reshaped/utilities";
|
|
3
4
|
import React, { isValidElement } from "react";
|
|
4
5
|
import Divider from "../Divider/index.js";
|
|
5
6
|
import Hidden from "../Hidden/index.js";
|
|
6
7
|
import { resolveMixin } from "../../styles/mixin.js";
|
|
7
|
-
import {
|
|
8
|
+
import { responsiveClassNames, responsiveVariables } from "../../utilities/props.js";
|
|
8
9
|
import s from "./View.module.css";
|
|
9
10
|
export const ViewItem = (props) => {
|
|
10
11
|
const { columns, grow, shrink, gapBefore,
|
|
@@ -7,7 +7,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
7
7
|
* It relies on using a data-rs-aligner-target attribute in other components and works based
|
|
8
8
|
* on the --rs-p, --rs-p-v and --rs-p-h css variables
|
|
9
9
|
*/
|
|
10
|
-
import { classNames } from "
|
|
10
|
+
import { classNames } from "@reshaped/utilities";
|
|
11
11
|
import s from "./Aligner.module.css";
|
|
12
12
|
const Aligner = (props) => {
|
|
13
13
|
const { side: passedSide = "all", children, className, attributes } = props;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { classNames } from "@reshaped/utilities";
|
|
3
4
|
import React from "react";
|
|
4
5
|
import useIsomorphicLayoutEffect from "../../../hooks/useIsomorphicLayoutEffect.js";
|
|
5
6
|
import { onNextFrame } from "../../../utilities/animation.js";
|
|
6
|
-
import { classNames } from "../../../utilities/props.js";
|
|
7
7
|
import s from "./Expandable.module.css";
|
|
8
8
|
const Expandable = (props) => {
|
|
9
9
|
const { children, active, attributes } = props;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { classNames } from "@reshaped/utilities";
|
|
3
4
|
import { forwardRef } from "react";
|
|
4
5
|
import * as keys from "../../constants/keys.js";
|
|
5
|
-
import { classNames } from "../../utilities/props.js";
|
|
6
6
|
const Actionable = forwardRef((props, ref) => {
|
|
7
7
|
const { children, render, href, onClick, type, disabled, as, stopPropagation, className, attributes, } = props;
|
|
8
8
|
const rootAttributes = { ...attributes };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { disableScroll, enableScroll } from "@reshaped/utilities/internal";
|
|
2
3
|
import React from "react";
|
|
3
4
|
import * as keys from "../../constants/keys.js";
|
|
4
5
|
import useHandlerRef from "../useHandlerRef.js";
|
|
5
6
|
import useHotkeys from "../useHotkeys.js";
|
|
6
7
|
import useToggle from "../useToggle.js";
|
|
7
|
-
import { disableScroll, enableScroll } from "../../utilities/scroll/index.js";
|
|
8
8
|
const useDrag = (cb, options) => {
|
|
9
9
|
const { disabled, containerRef: passedContainerRef, orientation = "all" } = options || {};
|
|
10
10
|
const cbRef = useHandlerRef(cb);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { rafThrottle } from "@reshaped/utilities/internal";
|
|
2
3
|
import React from "react";
|
|
3
4
|
import useIsomorphicLayoutEffect from "../useIsomorphicLayoutEffect.js";
|
|
4
5
|
import useRTL from "../useRTL.js";
|
|
5
|
-
import { rafThrottle } from "../../utilities/helpers.js";
|
|
6
6
|
const useFadeSide = (scrollableRef, options = {}) => {
|
|
7
7
|
const { disabled } = options;
|
|
8
8
|
const [rtl] = useRTL();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { activateKeyboardMode, deactivateKeyboardMode } from "@reshaped/utilities/internal";
|
|
3
4
|
import React from "react";
|
|
4
5
|
import * as keys from "../../constants/keys.js";
|
|
5
|
-
import { activateKeyboardMode, deactivateKeyboardMode } from "../../utilities/a11y/index.js";
|
|
6
6
|
export const SingletonKeyboardModeContext = React.createContext({
|
|
7
7
|
disabledRef: null,
|
|
8
8
|
disable: () => { },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { focusFirstElement, focusLastElement, focusNextElement, focusPreviousElement, getFocusableElements, } from "@reshaped/utilities/internal";
|
|
1
2
|
import React, { useEffect } from "react";
|
|
2
|
-
import { focusFirstElement, focusLastElement, focusNextElement, focusPreviousElement, getFocusableElements, } from "../utilities/a11y/index.js";
|
|
3
3
|
import useHotkeys from "./useHotkeys.js";
|
|
4
4
|
const useKeyboardArrowNavigation = (props) => {
|
|
5
5
|
const { ref, disabled, orientation, circular } = props;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { lockScroll } from "@reshaped/utilities";
|
|
2
3
|
import React from "react";
|
|
3
|
-
import { lockScroll } from "../utilities/scroll/index.js";
|
|
4
4
|
const useScrollLock = (options) => {
|
|
5
5
|
const { containerRef, originRef } = options || {};
|
|
6
6
|
const [locked, setLocked] = React.useState(false);
|
|
@@ -9,11 +9,11 @@ const useScrollLock = (options) => {
|
|
|
9
9
|
unlockScrollRef.current = lockScroll({
|
|
10
10
|
containerEl: containerRef?.current,
|
|
11
11
|
originEl: originRef?.current,
|
|
12
|
-
|
|
12
|
+
callback: () => setLocked(true),
|
|
13
13
|
});
|
|
14
14
|
}, [containerRef, originRef]);
|
|
15
15
|
const handleUnlockScroll = React.useCallback(() => {
|
|
16
|
-
unlockScrollRef.current?.(() => setLocked(false));
|
|
16
|
+
unlockScrollRef.current?.({ callback: () => setLocked(false) });
|
|
17
17
|
unlockScrollRef.current = null;
|
|
18
18
|
}, []);
|
|
19
19
|
return React.useMemo(() => ({
|
package/dist/index.d.ts
CHANGED
|
@@ -146,8 +146,8 @@ export { default as useToggle } from "./hooks/useToggle";
|
|
|
146
146
|
/**
|
|
147
147
|
* Utility functions
|
|
148
148
|
*/
|
|
149
|
-
export {
|
|
150
|
-
export { TrapFocus } from "
|
|
149
|
+
export { responsivePropDependency } from "./utilities/props";
|
|
150
|
+
export { TrapFocus, classNames } from "@reshaped/utilities";
|
|
151
151
|
/**
|
|
152
152
|
* Types
|
|
153
153
|
*/
|
package/dist/index.js
CHANGED
|
@@ -84,8 +84,8 @@ export { default as useToggle } from "./hooks/useToggle.js";
|
|
|
84
84
|
/**
|
|
85
85
|
* Utility functions
|
|
86
86
|
*/
|
|
87
|
-
export {
|
|
88
|
-
export { TrapFocus } from "
|
|
87
|
+
export { responsivePropDependency } from "./utilities/props.js";
|
|
88
|
+
export { TrapFocus, classNames } from "@reshaped/utilities";
|
|
89
89
|
/**
|
|
90
90
|
* Dev utilities
|
|
91
91
|
*/
|
|
@@ -6,17 +6,3 @@ export const range = (start, end) => {
|
|
|
6
6
|
return [];
|
|
7
7
|
return Array.from({ length: end - start + 1 }, (_, i) => start + i);
|
|
8
8
|
};
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
-
export const rafThrottle = (fn) => {
|
|
11
|
-
let rafId = null;
|
|
12
|
-
let args = null;
|
|
13
|
-
return function (...newArgs) {
|
|
14
|
-
args = newArgs;
|
|
15
|
-
if (rafId === null) {
|
|
16
|
-
rafId = requestAnimationFrame(() => {
|
|
17
|
-
rafId = null;
|
|
18
|
-
fn(...args);
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import type * as G from "../types/global";
|
|
2
2
|
type Value = string | boolean | number | undefined;
|
|
3
3
|
type ClassNameResolver = string | ((value: Value) => string);
|
|
4
|
-
/**
|
|
5
|
-
* Resolve an array of values into a classname string
|
|
6
|
-
*/
|
|
7
|
-
export declare const classNames: (...args: G.ClassName[]) => string;
|
|
8
4
|
export declare const responsiveClassNames: <V extends G.Responsive<Value>>(s: Record<string, string>, className: ClassNameResolver, value: V, options?: {
|
|
9
5
|
excludeValueFromClassName?: boolean;
|
|
10
6
|
}) => string[];
|
package/dist/utilities/props.js
CHANGED
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resolve an array of values into a classname string
|
|
3
|
-
*/
|
|
4
|
-
export const classNames = (...args) => {
|
|
5
|
-
return args
|
|
6
|
-
.reduce((acc, cur) => {
|
|
7
|
-
if (Array.isArray(cur)) {
|
|
8
|
-
const className = classNames(...cur);
|
|
9
|
-
if (!className)
|
|
10
|
-
return acc;
|
|
11
|
-
return `${acc} ${className}`;
|
|
12
|
-
}
|
|
13
|
-
if (cur)
|
|
14
|
-
return `${acc} ${cur}`;
|
|
15
|
-
return acc;
|
|
16
|
-
}, "")
|
|
17
|
-
.trim();
|
|
18
|
-
};
|
|
19
1
|
const applyClassName = (passedClassName, value, options) => {
|
|
20
2
|
const { base, excludeValueFromClassName } = options || {};
|
|
21
3
|
const className = typeof passedClassName === "string" ? passedClassName : passedClassName(value);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reshaped",
|
|
3
3
|
"description": "Professionally crafted design system in React & Figma for building products of any scale and complexity",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.10.0-canary.4",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"email": "hello@reshaped.so",
|
|
7
7
|
"homepage": "https://reshaped.so",
|
|
@@ -91,17 +91,17 @@
|
|
|
91
91
|
"csstype": "3.1.3",
|
|
92
92
|
"culori": "4.0.2",
|
|
93
93
|
"postcss-custom-media": "11.0.6",
|
|
94
|
-
"@reshaped/utilities": "3.
|
|
94
|
+
"@reshaped/utilities": "3.10.0-canary.4"
|
|
95
95
|
},
|
|
96
96
|
"scripts": {
|
|
97
|
-
"clean": "
|
|
97
|
+
"clean": "bash ./bin/clean.sh",
|
|
98
98
|
"dev": "storybook dev -p 3001 -c ../../.storybook --disable-telemetry",
|
|
99
99
|
"build": "pnpm clean && pnpm build:esm && pnpm build:css && pnpm build:bundle",
|
|
100
100
|
"build:themes": "node bin/cli.js theming --config dist/cli/theming/reshaped.config.js --output src/themes",
|
|
101
101
|
"build:esm": "tsc -p tsconfig.esm.json && resolve-tspaths -p tsconfig.esm.json",
|
|
102
102
|
"build:css": "postcss \"src/**/*.css\" --dir dist --base src --config tools/build",
|
|
103
103
|
"build:stories": "tsc -p tsconfig.stories.json && resolve-tspaths -p tsconfig.stories.json",
|
|
104
|
-
"build:bundle": "vite build && cp dist/index.d.ts dist/bundle.d.ts",
|
|
104
|
+
"build:bundle": "vite build && shx cp dist/index.d.ts dist/bundle.d.ts",
|
|
105
105
|
"build:size": "pnpm clean && pnpm build:esm && pnpm build:bundle",
|
|
106
106
|
"release:local": "pnpm build && pnpm pack --out reshaped-local.tgz",
|
|
107
107
|
"test:browser": "vitest run --project=storybook",
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
type ID = number;
|
|
2
|
-
type Item<T> = {
|
|
3
|
-
previousId?: ID | null;
|
|
4
|
-
nextId?: ID | null;
|
|
5
|
-
data: T;
|
|
6
|
-
};
|
|
7
|
-
declare class Chain<T = unknown> {
|
|
8
|
-
chain: Record<ID, Item<T>>;
|
|
9
|
-
tailId: ID | null;
|
|
10
|
-
idCounter: ID;
|
|
11
|
-
generateId(): number;
|
|
12
|
-
getAll(): Record<number, Item<T>>;
|
|
13
|
-
get(id: ID): Item<T>;
|
|
14
|
-
isLast(id: ID): boolean;
|
|
15
|
-
isEmpty(): boolean;
|
|
16
|
-
add(data: T): number;
|
|
17
|
-
remove(id: ID): T | undefined;
|
|
18
|
-
removePreviousTill(id: ID, condition: (item: Item<T>) => boolean): T | undefined;
|
|
19
|
-
}
|
|
20
|
-
export default Chain;
|
package/dist/utilities/Chain.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
class Chain {
|
|
2
|
-
chain = {};
|
|
3
|
-
tailId = null;
|
|
4
|
-
idCounter = 0;
|
|
5
|
-
generateId() {
|
|
6
|
-
this.idCounter += 1;
|
|
7
|
-
return this.idCounter;
|
|
8
|
-
}
|
|
9
|
-
getAll() {
|
|
10
|
-
return this.chain;
|
|
11
|
-
}
|
|
12
|
-
get(id) {
|
|
13
|
-
return this.chain[id];
|
|
14
|
-
}
|
|
15
|
-
isLast(id) {
|
|
16
|
-
return this.tailId !== null && id === this.tailId;
|
|
17
|
-
}
|
|
18
|
-
isEmpty() {
|
|
19
|
-
return typeof this.tailId !== "number";
|
|
20
|
-
}
|
|
21
|
-
add(data) {
|
|
22
|
-
const previousId = this.tailId;
|
|
23
|
-
const previousItem = previousId && this.get(previousId);
|
|
24
|
-
const id = this.generateId();
|
|
25
|
-
this.chain[id] = { previousId, data };
|
|
26
|
-
if (previousItem)
|
|
27
|
-
previousItem.nextId = id;
|
|
28
|
-
this.tailId = id;
|
|
29
|
-
return id;
|
|
30
|
-
}
|
|
31
|
-
remove(id) {
|
|
32
|
-
const target = this.chain[id];
|
|
33
|
-
if (!target)
|
|
34
|
-
return;
|
|
35
|
-
const previousId = target.previousId;
|
|
36
|
-
const previousItem = previousId && this.get(previousId);
|
|
37
|
-
const nextId = target.nextId;
|
|
38
|
-
const nextItem = nextId && this.get(nextId);
|
|
39
|
-
if (previousItem)
|
|
40
|
-
previousItem.nextId = target.nextId ?? null;
|
|
41
|
-
if (nextItem)
|
|
42
|
-
nextItem.previousId = target.previousId ?? null;
|
|
43
|
-
if (!nextId)
|
|
44
|
-
this.tailId = previousId ?? null;
|
|
45
|
-
const data = this.get(id).data;
|
|
46
|
-
delete this.chain[id];
|
|
47
|
-
return data;
|
|
48
|
-
}
|
|
49
|
-
removePreviousTill(id, condition) {
|
|
50
|
-
const target = this.get(id);
|
|
51
|
-
const data = this.remove(id);
|
|
52
|
-
if (!target || !target.previousId)
|
|
53
|
-
return data;
|
|
54
|
-
const keepIterating = !condition(target);
|
|
55
|
-
if (keepIterating)
|
|
56
|
-
return this.removePreviousTill(target.previousId, condition);
|
|
57
|
-
return data;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
export default Chain;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import Chain from "../Chain";
|
|
2
|
-
import type { FocusableElement, TrapMode } from "./types";
|
|
3
|
-
type ReleaseOptions = {
|
|
4
|
-
withoutFocusReturn?: boolean;
|
|
5
|
-
};
|
|
6
|
-
type TrapOptions = {
|
|
7
|
-
onRelease?: () => void;
|
|
8
|
-
includeTrigger?: boolean;
|
|
9
|
-
initialFocusEl?: FocusableElement | null;
|
|
10
|
-
mode?: TrapMode;
|
|
11
|
-
};
|
|
12
|
-
declare class TrapFocus {
|
|
13
|
-
#private;
|
|
14
|
-
static chain: Chain<TrapFocus>;
|
|
15
|
-
trapped?: boolean;
|
|
16
|
-
constructor();
|
|
17
|
-
/**
|
|
18
|
-
* Trap the focus, add observer and keyboard event listeners
|
|
19
|
-
* and create a chain item
|
|
20
|
-
*/
|
|
21
|
-
trap: (root: HTMLElement, options?: TrapOptions) => void;
|
|
22
|
-
/**
|
|
23
|
-
* Disabled the trap focus for the element,
|
|
24
|
-
* cleanup all observers/handlers and trap for the previous element in the chain
|
|
25
|
-
*/
|
|
26
|
-
release: (releaseOptions?: ReleaseOptions) => void;
|
|
27
|
-
}
|
|
28
|
-
export default TrapFocus;
|