reshaped 3.10.0-canary.5 → 3.10.0-canary.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.css +1 -1
- package/dist/bundle.d.ts +4 -11
- package/dist/bundle.js +2 -2
- package/dist/components/Accordion/Accordion.types.d.ts +3 -2
- package/dist/components/Accordion/AccordionControlled.js +1 -2
- package/dist/components/Accordion/AccordionTrigger.js +1 -1
- package/dist/components/ActionBar/ActionBar.js +1 -1
- package/dist/components/ActionBar/ActionBar.types.d.ts +3 -2
- package/dist/components/Actionable/Actionable.d.ts +2 -2
- package/dist/components/Actionable/Actionable.js +1 -1
- package/dist/components/Actionable/Actionable.types.d.ts +1 -1
- package/dist/components/Actionable/index.d.ts +1 -1
- package/dist/components/Alert/Alert.types.d.ts +3 -2
- package/dist/components/Autocomplete/Autocomplete.js +3 -5
- package/dist/components/Autocomplete/Autocomplete.types.d.ts +1 -1
- package/dist/components/Avatar/Avatar.js +1 -1
- package/dist/components/Avatar/Avatar.types.d.ts +5 -4
- package/dist/components/Badge/Badge.js +1 -1
- package/dist/components/Badge/Badge.types.d.ts +4 -4
- package/dist/components/Badge/BadgeContainer.js +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +3 -3
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/Button.types.d.ts +3 -2
- package/dist/components/Button/ButtonGroup.js +1 -1
- package/dist/components/Calendar/CalendarDate.js +1 -1
- package/dist/components/Calendar/useCalendarKeyboardNavigation.js +1 -1
- package/dist/components/Card/Card.d.ts +6 -14
- package/dist/components/Card/Card.js +1 -1
- package/dist/components/Card/Card.types.d.ts +4 -3
- package/dist/components/Carousel/Carousel.js +2 -4
- package/dist/components/Carousel/Carousel.types.d.ts +3 -2
- package/dist/components/Carousel/CarouselControl.js +1 -2
- package/dist/components/Checkbox/Checkbox.js +1 -2
- package/dist/components/Checkbox/Checkbox.types.d.ts +4 -3
- package/dist/components/Container/Container.js +1 -1
- package/dist/components/Container/Container.types.d.ts +3 -2
- package/dist/components/ContextMenu/ContextMenu.js +1 -2
- package/dist/components/Dismissible/Dismissible.js +1 -1
- package/dist/components/Dismissible/Dismissible.types.d.ts +3 -3
- package/dist/components/Divider/Divider.js +1 -1
- package/dist/components/Divider/Divider.types.d.ts +3 -2
- package/dist/components/DropdownMenu/DropdownMenu.js +1 -3
- package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +1 -1
- package/dist/components/FileUpload/FileUpload.js +1 -2
- package/dist/components/FileUpload/FileUpload.types.d.ts +4 -3
- package/dist/components/Flyout/Flyout.module.css +1 -1
- package/dist/components/Flyout/Flyout.types.d.ts +9 -7
- package/dist/components/Flyout/FlyoutContent.js +3 -3
- package/dist/components/Flyout/FlyoutControlled.js +4 -7
- package/dist/components/Flyout/useFlyout.d.ts +2 -2
- package/dist/components/Flyout/useFlyout.js +2 -2
- package/dist/components/Flyout/utilities/safeArea.d.ts +2 -2
- package/dist/components/Grid/Grid.js +1 -1
- package/dist/components/Grid/Grid.types.d.ts +5 -4
- package/dist/components/Hidden/Hidden.js +1 -1
- package/dist/components/HiddenInput/HiddenInput.js +1 -1
- package/dist/components/HiddenInput/HiddenInput.types.d.ts +3 -2
- package/dist/components/Hotkey/Hotkey.js +1 -1
- package/dist/components/Hotkey/Hotkey.types.d.ts +3 -3
- package/dist/components/Icon/Icon.js +1 -1
- package/dist/components/Icon/Icon.types.d.ts +3 -2
- package/dist/components/Image/Image.js +1 -1
- package/dist/components/Image/Image.types.d.ts +5 -4
- package/dist/components/Link/Link.js +1 -1
- package/dist/components/Loader/Loader.js +1 -1
- package/dist/components/Loader/Loader.types.d.ts +3 -2
- package/dist/components/MenuItem/MenuItem.js +1 -1
- package/dist/components/MenuItem/MenuItem.types.d.ts +3 -2
- package/dist/components/Modal/Modal.js +6 -6
- package/dist/components/Modal/Modal.types.d.ts +5 -4
- package/dist/components/NumberField/NumberFieldControlled.js +1 -2
- package/dist/components/Overlay/Overlay.js +7 -12
- package/dist/components/Overlay/Overlay.types.d.ts +5 -3
- package/dist/components/Pagination/Pagination.types.d.ts +3 -3
- package/dist/components/PinField/PinField.types.d.ts +4 -3
- package/dist/components/PinField/PinFieldControlled.js +1 -1
- package/dist/components/Popover/Popover.js +1 -1
- package/dist/components/Popover/Popover.types.d.ts +1 -1
- package/dist/components/Progress/Progress.js +1 -1
- package/dist/components/Progress/Progress.types.d.ts +3 -3
- package/dist/components/ProgressIndicator/ProgressIndicator.js +1 -1
- package/dist/components/ProgressIndicator/ProgressIndicator.types.d.ts +3 -3
- package/dist/components/Radio/Radio.js +1 -1
- package/dist/components/Radio/Radio.types.d.ts +4 -3
- package/dist/components/RadioGroup/RadioGroup.types.d.ts +3 -2
- package/dist/components/Reshaped/Reshaped.js +4 -11
- package/dist/components/Reshaped/Reshaped.types.d.ts +3 -2
- 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/Scrim/Scrim.types.d.ts +4 -4
- package/dist/components/ScrollArea/ScrollArea.js +2 -4
- package/dist/components/ScrollArea/ScrollArea.types.d.ts +5 -3
- package/dist/components/Select/Select.types.d.ts +5 -4
- package/dist/components/Select/SelectNative.js +1 -1
- package/dist/components/Select/SelectRoot.js +1 -1
- package/dist/components/Skeleton/Skeleton.js +1 -1
- package/dist/components/Skeleton/Skeleton.types.d.ts +3 -3
- package/dist/components/Slider/Slider.types.d.ts +3 -3
- package/dist/components/Slider/SliderControlled.js +2 -4
- package/dist/components/Slider/SliderThumb.js +1 -1
- package/dist/components/Stepper/Stepper.types.d.ts +5 -4
- package/dist/components/Switch/Switch.js +1 -1
- package/dist/components/Switch/Switch.types.d.ts +4 -3
- package/dist/components/Table/Table.js +1 -1
- package/dist/components/Table/Table.types.d.ts +12 -12
- package/dist/components/Tabs/Tabs.types.d.ts +6 -6
- package/dist/components/Tabs/TabsItem.js +2 -3
- package/dist/components/Tabs/TabsList.js +1 -4
- package/dist/components/Tabs/TabsPanel.js +2 -2
- package/dist/components/Text/Text.js +1 -1
- package/dist/components/Text/Text.types.d.ts +3 -2
- package/dist/components/TextArea/TextArea.js +1 -1
- package/dist/components/TextArea/TextArea.types.d.ts +5 -4
- package/dist/components/TextField/TextField.js +1 -1
- package/dist/components/TextField/TextField.types.d.ts +4 -3
- package/dist/components/Theme/GlobalColorMode.js +1 -1
- package/dist/components/Theme/Theme.js +1 -2
- package/dist/components/Theme/Theme.types.d.ts +2 -1
- package/dist/components/Timeline/Timeline.js +1 -1
- package/dist/components/Timeline/Timeline.types.d.ts +5 -5
- package/dist/components/Toast/Toast.types.d.ts +3 -3
- package/dist/components/Toast/ToastContainer.js +2 -3
- package/dist/components/Toast/ToastRegion.js +2 -2
- package/dist/components/ToggleButton/ToggleButtonUncontrolled.js +1 -1
- package/dist/components/ToggleButtonGroup/ToggleButtonGroupControlled.js +1 -1
- package/dist/components/Tooltip/Tooltip.types.d.ts +1 -1
- package/dist/components/View/View.js +1 -1
- package/dist/components/View/View.types.d.ts +5 -4
- package/dist/components/_private/Aligner/Aligner.js +1 -1
- package/dist/components/_private/Aligner/Aligner.types.d.ts +3 -3
- package/dist/components/_private/Expandable/Expandable.js +2 -2
- package/dist/components/_private/Expandable/Expandable.types.d.ts +2 -2
- package/dist/components/_private/Portal/Portal.js +1 -2
- package/dist/hooks/_private/useDrag.js +2 -4
- package/dist/hooks/_private/useFadeSide.js +2 -3
- package/dist/hooks/_private/useSingletonViewport.d.ts +10 -0
- package/dist/hooks/_private/useSingletonViewport.js +52 -0
- package/dist/hooks/useResponsiveClientValue.js +15 -53
- package/dist/hooks/useViewport.d.ts +2 -0
- package/dist/hooks/useViewport.js +6 -0
- package/dist/index.d.ts +4 -11
- package/dist/index.js +2 -10
- package/dist/styles/mixin.d.ts +2 -2
- package/dist/styles/types.d.ts +2 -1
- package/dist/tests/ThemesPlayground.js +1 -1
- package/dist/types/global.d.ts +0 -15
- package/dist/utilities/props.d.ts +2 -1
- package/package.json +2 -2
- package/dist/core/Actionable/Actionable.d.ts +0 -4
- package/dist/core/Actionable/Actionable.js +0 -73
- package/dist/core/Actionable/Actionable.types.d.ts +0 -34
- package/dist/core/Actionable/Actionable.types.js +0 -1
- package/dist/core/Actionable/index.d.ts +0 -2
- package/dist/core/Actionable/index.js +0 -1
- package/dist/hooks/_private/useSingletonEnvironment.d.ts +0 -9
- package/dist/hooks/_private/useSingletonEnvironment.js +0 -33
- package/dist/hooks/_private/useSingletonHotkeys.d.ts +0 -35
- package/dist/hooks/_private/useSingletonHotkeys.js +0 -191
- package/dist/hooks/_private/useSingletonKeyboardMode.d.ts +0 -13
- package/dist/hooks/_private/useSingletonKeyboardMode.js +0 -58
- package/dist/hooks/useHandlerRef.d.ts +0 -8
- package/dist/hooks/useHandlerRef.js +0 -16
- package/dist/hooks/useHotkeys.d.ts +0 -11
- package/dist/hooks/useHotkeys.js +0 -27
- package/dist/hooks/useIsomorphicLayoutEffect.d.ts +0 -3
- package/dist/hooks/useIsomorphicLayoutEffect.js +0 -4
- package/dist/hooks/useKeyboardArrowNavigation.d.ts +0 -9
- package/dist/hooks/useKeyboardArrowNavigation.js +0 -62
- package/dist/hooks/useKeyboardMode.d.ts +0 -7
- package/dist/hooks/useKeyboardMode.js +0 -13
- package/dist/hooks/useOnClickOutside.d.ts +0 -5
- package/dist/hooks/useOnClickOutside.js +0 -63
- package/dist/hooks/useRTL.d.ts +0 -2
- package/dist/hooks/useRTL.js +0 -7
- package/dist/hooks/useScrollLock.d.ts +0 -10
- package/dist/hooks/useScrollLock.js +0 -25
- package/dist/hooks/useToggle.d.ts +0 -7
- package/dist/hooks/useToggle.js +0 -19
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Attributes, ClassName } from "@reshaped/headless";
|
|
1
2
|
import type { FormControlProps } from "../FormControl";
|
|
2
3
|
import type { IconProps } from "../Icon";
|
|
3
4
|
import type React from "react";
|
|
@@ -49,11 +50,11 @@ export type BaseProps = {
|
|
|
49
50
|
/** Callback when the text field is blurred */
|
|
50
51
|
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
51
52
|
/** Additional classname for the root element */
|
|
52
|
-
className?:
|
|
53
|
+
className?: ClassName;
|
|
53
54
|
/** Additional attributes for the root element */
|
|
54
|
-
attributes?:
|
|
55
|
+
attributes?: Attributes<"div">;
|
|
55
56
|
/** Additional attributes for the input element */
|
|
56
|
-
inputAttributes?:
|
|
57
|
+
inputAttributes?: Attributes<"input">;
|
|
57
58
|
} & Pick<FormControlProps, "hasError">;
|
|
58
59
|
export type ControlledProps = BaseProps & {
|
|
59
60
|
/** Value of the text field, enables controlled mode */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useIsomorphicLayoutEffect } from "@reshaped/headless";
|
|
3
4
|
import React from "react";
|
|
4
|
-
import useIsomorphicLayoutEffect from "../../hooks/useIsomorphicLayoutEffect.js";
|
|
5
5
|
import { enableTransitions, disableTransitions, onNextFrame } from "../../utilities/animation.js";
|
|
6
6
|
import { GlobalColorModeContext } from "./Theme.context.js";
|
|
7
7
|
import { getRootThemeEl } from "./Theme.utilities.js";
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { classNames } from "@reshaped/
|
|
3
|
+
import { classNames, useIsomorphicLayoutEffect } from "@reshaped/headless";
|
|
4
4
|
import React from "react";
|
|
5
|
-
import useIsomorphicLayoutEffect from "../../hooks/useIsomorphicLayoutEffect.js";
|
|
6
5
|
import { ThemeContext } from "./Theme.context.js";
|
|
7
6
|
import s from "./Theme.module.css";
|
|
8
7
|
import { getRootThemeEl } from "./Theme.utilities.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import * as G from "../../types/global";
|
|
3
|
+
import type { ClassName } from "@reshaped/headless";
|
|
3
4
|
export type GlobalColorModeContextData = {
|
|
4
5
|
mode: G.ColorMode;
|
|
5
6
|
setMode: (mode: G.ColorMode) => void;
|
|
@@ -20,7 +21,7 @@ export type Props = {
|
|
|
20
21
|
/** Color mode to use */
|
|
21
22
|
colorMode?: G.ColorMode | "inverted";
|
|
22
23
|
/** Additional classname for the root element */
|
|
23
|
-
className?:
|
|
24
|
+
className?: ClassName;
|
|
24
25
|
/** Node for inserting children */
|
|
25
26
|
children?: React.ReactNode;
|
|
26
27
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { classNames } from "@reshaped/
|
|
2
|
+
import { classNames } from "@reshaped/headless";
|
|
3
3
|
import React, { isValidElement } from "react";
|
|
4
4
|
import View from "../View/index.js";
|
|
5
5
|
import s from "./Timeline.module.css";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import type { Attributes, ClassName } from "@reshaped/headless";
|
|
1
2
|
import type React from "react";
|
|
2
|
-
import type * as G from "../../types/global";
|
|
3
3
|
export type Props = {
|
|
4
4
|
/** Node for inserting children */
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
/** Additional classname for the root element */
|
|
7
|
-
className?:
|
|
7
|
+
className?: ClassName;
|
|
8
8
|
/** Additional attributes for the root element */
|
|
9
|
-
attributes?:
|
|
9
|
+
attributes?: Attributes<"ul">;
|
|
10
10
|
};
|
|
11
11
|
export type ItemProps = {
|
|
12
12
|
/** Node for rendering custom item markers */
|
|
@@ -14,7 +14,7 @@ export type ItemProps = {
|
|
|
14
14
|
/** Node for inserting children */
|
|
15
15
|
children?: React.ReactNode;
|
|
16
16
|
/** Additional classname for the item element */
|
|
17
|
-
className?:
|
|
17
|
+
className?: ClassName;
|
|
18
18
|
/** Additional attributes for the item element */
|
|
19
|
-
attributes?:
|
|
19
|
+
attributes?: Attributes<"li">;
|
|
20
20
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { Attributes, ClassName } from "@reshaped/headless";
|
|
1
2
|
import type { IconProps } from "../Icon";
|
|
2
3
|
import type React from "react";
|
|
3
|
-
import type * as G from "../../types/global";
|
|
4
4
|
export type Status = "entering" | "entered" | "exited";
|
|
5
5
|
export type TimeoutAlias = "short" | "long";
|
|
6
6
|
export type Timeout = TimeoutAlias | number;
|
|
@@ -27,9 +27,9 @@ export type Props = {
|
|
|
27
27
|
*/
|
|
28
28
|
color?: "neutral" | "primary" | "critical" | "positive" | "warning" | "inverted";
|
|
29
29
|
/** Additional classname for the root element */
|
|
30
|
-
className?:
|
|
30
|
+
className?: ClassName;
|
|
31
31
|
/** Additional attributes for the root element */
|
|
32
|
-
attributes?:
|
|
32
|
+
attributes?: Attributes<"div">;
|
|
33
33
|
};
|
|
34
34
|
export type ProviderProps = {
|
|
35
35
|
/** Node for inserting children */
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { TrapFocus } from "@reshaped/
|
|
4
|
-
import {
|
|
5
|
-
import { checkKeyboardMode } from "@reshaped/utilities/internal";
|
|
3
|
+
import { TrapFocus, classNames } from "@reshaped/headless";
|
|
4
|
+
import { checkKeyboardMode } from "@reshaped/headless/internal";
|
|
6
5
|
import React from "react";
|
|
7
6
|
import { onNextFrame } from "../../utilities/animation.js";
|
|
8
7
|
import Toast from "./Toast.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { classNames } from "@reshaped/
|
|
4
|
-
import { focusableSelector } from "@reshaped/
|
|
3
|
+
import { classNames } from "@reshaped/headless";
|
|
4
|
+
import { focusableSelector } from "@reshaped/headless/internal";
|
|
5
5
|
import React from "react";
|
|
6
6
|
import ToastContext from "./Toast.context.js";
|
|
7
7
|
import s from "./Toast.module.css";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import useToggle from "
|
|
3
|
+
import { useToggle } from "@reshaped/headless";
|
|
4
4
|
import ToggleButtonControlled from "./ToggleButtonControlled.js";
|
|
5
5
|
const ToggleButtonUncontrolled = (props) => {
|
|
6
6
|
const { defaultChecked, onChange, ...buttonProps } = props;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useKeyboardArrowNavigation } from "@reshaped/headless";
|
|
3
4
|
import React from "react";
|
|
4
5
|
import Button from "../Button/index.js";
|
|
5
|
-
import useKeyboardArrowNavigation from "../../hooks/useKeyboardArrowNavigation.js";
|
|
6
6
|
import Context from "./ToggleButtonGroup.context.js";
|
|
7
7
|
const ToggleButtonGroupControlled = (props) => {
|
|
8
8
|
const { onChange, value, selectionMode = "single", children, color, selectedColor, ...buttonGroupProps } = props;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { FlyoutProps, FlyoutTriggerAttributes } from "../Flyout";
|
|
3
|
-
export type Props = Pick<FlyoutProps, "id" | "position" | "onOpen" | "onClose" | "active" | "disabled" | "disableContentHover" | "containerRef" | "positionRef" | "contentGap" | "contentShift" | "contentMaxWidth" | "originCoordinates" | "contentAttributes" | "contentClassName" | "instanceRef"> & {
|
|
3
|
+
export type Props = Pick<FlyoutProps, "id" | "position" | "onOpen" | "onClose" | "active" | "disabled" | "disableContentHover" | "containerRef" | "positionRef" | "contentGap" | "contentShift" | "contentMaxWidth" | "contentZIndex" | "originCoordinates" | "contentAttributes" | "contentClassName" | "instanceRef"> & {
|
|
4
4
|
/** Node for inserting children */
|
|
5
5
|
children: (attributes: FlyoutTriggerAttributes) => React.ReactNode;
|
|
6
6
|
/** Text content for the tooltip */
|
|
@@ -1,6 +1,6 @@
|
|
|
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/
|
|
3
|
+
import { classNames } from "@reshaped/headless";
|
|
4
4
|
import React, { isValidElement } from "react";
|
|
5
5
|
import Divider from "../Divider/index.js";
|
|
6
6
|
import Hidden from "../Hidden/index.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Attributes, ClassName } from "@reshaped/headless";
|
|
1
2
|
import type React from "react";
|
|
2
3
|
import type * as TStyles from "../../styles/types";
|
|
3
4
|
import type * as G from "../../types/global";
|
|
@@ -93,9 +94,9 @@ export type Props<TagName extends keyof React.JSX.IntrinsicElements | void = voi
|
|
|
93
94
|
/** Add transition for the properties */
|
|
94
95
|
animated?: boolean;
|
|
95
96
|
/** Additional classname for the root element */
|
|
96
|
-
className?:
|
|
97
|
+
className?: ClassName;
|
|
97
98
|
/** Additional attributes for the root element */
|
|
98
|
-
attributes?:
|
|
99
|
+
attributes?: Attributes<TagName>;
|
|
99
100
|
} & Pick<ItemProps, "grow" | "shrink">;
|
|
100
101
|
export type ItemProps<TagName extends keyof React.JSX.IntrinsicElements | void = void> = {
|
|
101
102
|
/** Flex order of the item inside the parent */
|
|
@@ -111,9 +112,9 @@ export type ItemProps<TagName extends keyof React.JSX.IntrinsicElements | void =
|
|
|
111
112
|
/** Render as a different element */
|
|
112
113
|
as?: TagName extends keyof React.JSX.IntrinsicElements ? TagName : keyof React.JSX.IntrinsicElements;
|
|
113
114
|
/** Additional attributes for the root element */
|
|
114
|
-
attributes?:
|
|
115
|
+
attributes?: Attributes<TagName>;
|
|
115
116
|
/** Additional classname for the root element */
|
|
116
|
-
className?:
|
|
117
|
+
className?: ClassName;
|
|
117
118
|
/** Node for inserting the item content */
|
|
118
119
|
children?: React.ReactNode;
|
|
119
120
|
};
|
|
@@ -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 "@reshaped/
|
|
10
|
+
import { classNames } from "@reshaped/headless";
|
|
11
11
|
import s from "./Aligner.module.css";
|
|
12
12
|
const Aligner = (props) => {
|
|
13
13
|
const { side: passedSide = "all", children, className, attributes } = props;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { ClassName, Attributes } from "@reshaped/headless";
|
|
2
2
|
type Side = "start" | "end" | "top" | "bottom" | "inline" | "block" | "all";
|
|
3
3
|
export type Props = {
|
|
4
4
|
/** Node for inserting children components */
|
|
@@ -8,8 +8,8 @@ export type Props = {
|
|
|
8
8
|
*/
|
|
9
9
|
side?: Side | Side[];
|
|
10
10
|
/** Additional classname for the root element */
|
|
11
|
-
className?:
|
|
11
|
+
className?: ClassName;
|
|
12
12
|
/** Additional attributes for the root element */
|
|
13
|
-
attributes?:
|
|
13
|
+
attributes?: Attributes<"div">;
|
|
14
14
|
};
|
|
15
15
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { useIsomorphicLayoutEffect } from "@reshaped/headless";
|
|
4
|
+
import { classNames } from "@reshaped/headless";
|
|
4
5
|
import React from "react";
|
|
5
|
-
import useIsomorphicLayoutEffect from "../../../hooks/useIsomorphicLayoutEffect.js";
|
|
6
6
|
import { onNextFrame } from "../../../utilities/animation.js";
|
|
7
7
|
import s from "./Expandable.module.css";
|
|
8
8
|
const Expandable = (props) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
2
|
+
import type { Attributes } from "@reshaped/headless";
|
|
3
3
|
export type ContentProps = {
|
|
4
4
|
active?: boolean;
|
|
5
5
|
children?: React.ReactNode;
|
|
6
|
-
attributes?:
|
|
6
|
+
attributes?: Attributes<"div">;
|
|
7
7
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useIsomorphicLayoutEffect, useToggle } from "@reshaped/headless";
|
|
3
4
|
import React from "react";
|
|
4
5
|
import ReactDOM from "react-dom";
|
|
5
6
|
import Theme from "../../Theme/index.js";
|
|
6
|
-
import useIsomorphicLayoutEffect from "../../../hooks/useIsomorphicLayoutEffect.js";
|
|
7
|
-
import useToggle from "../../../hooks/useToggle.js";
|
|
8
7
|
import s from "./Portal.module.css";
|
|
9
8
|
const PortalScopeContext = React.createContext({});
|
|
10
9
|
export const usePortalScope = () => {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { useHotkeys, useHandlerRef, useToggle } from "@reshaped/headless";
|
|
3
|
+
import { disableScroll, enableScroll } from "@reshaped/headless/internal";
|
|
3
4
|
import React from "react";
|
|
4
5
|
import * as keys from "../../constants/keys.js";
|
|
5
|
-
import useHandlerRef from "../useHandlerRef.js";
|
|
6
|
-
import useHotkeys from "../useHotkeys.js";
|
|
7
|
-
import useToggle from "../useToggle.js";
|
|
8
6
|
const useDrag = (cb, options) => {
|
|
9
7
|
const { disabled, containerRef: passedContainerRef, orientation = "all" } = options || {};
|
|
10
8
|
const cbRef = useHandlerRef(cb);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { useIsomorphicLayoutEffect, useRTL } from "@reshaped/headless";
|
|
3
|
+
import { rafThrottle } from "@reshaped/headless/internal";
|
|
3
4
|
import React from "react";
|
|
4
|
-
import useIsomorphicLayoutEffect from "../useIsomorphicLayoutEffect.js";
|
|
5
|
-
import useRTL from "../useRTL.js";
|
|
6
5
|
const useFadeSide = (scrollableRef, options = {}) => {
|
|
7
6
|
const { disabled } = options;
|
|
8
7
|
const [rtl] = useRTL();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type * as G from "../../types/global";
|
|
3
|
+
export declare const SingletonViewportProvider: React.FC<{
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
defaultViewport?: G.Viewport;
|
|
6
|
+
}>;
|
|
7
|
+
declare const useSingletonViewport: () => {
|
|
8
|
+
viewport: G.Viewport;
|
|
9
|
+
};
|
|
10
|
+
export default useSingletonViewport;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useIsomorphicLayoutEffect } from "@reshaped/headless";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import defaultBreakpoints from "../../constants/breakpoints.js";
|
|
6
|
+
const SingletonViewportContext = React.createContext({
|
|
7
|
+
viewport: "s",
|
|
8
|
+
});
|
|
9
|
+
export const SingletonViewportProvider = (props) => {
|
|
10
|
+
const { children, defaultViewport = "s" } = props;
|
|
11
|
+
const [viewport, setViewport] = React.useState(defaultViewport);
|
|
12
|
+
useIsomorphicLayoutEffect(() => {
|
|
13
|
+
const rootThemeEl = document.querySelector("[data-rs-theme]");
|
|
14
|
+
const rootStyle = rootThemeEl && window.getComputedStyle(rootThemeEl);
|
|
15
|
+
/**
|
|
16
|
+
* We generate variables for the viewport breakpoints in the themes
|
|
17
|
+
* We use them here in case they're custom and fallback to the default values
|
|
18
|
+
* in case there is no SSR passing the data-rs-theme attribute
|
|
19
|
+
*/
|
|
20
|
+
const breakpoints = {
|
|
21
|
+
m: (rootStyle && Number(rootStyle.getPropertyValue("--rs-viewport-m-min"))) ||
|
|
22
|
+
defaultBreakpoints.m,
|
|
23
|
+
l: (rootStyle && Number(rootStyle.getPropertyValue("--rs-viewport-l-min"))) ||
|
|
24
|
+
defaultBreakpoints.l,
|
|
25
|
+
xl: (rootStyle && Number(rootStyle.getPropertyValue("--rs-viewport-xl-min"))) ||
|
|
26
|
+
defaultBreakpoints.xl,
|
|
27
|
+
};
|
|
28
|
+
const mediaQueries = {
|
|
29
|
+
s: `(max-width: ${breakpoints.m - 1}px)`,
|
|
30
|
+
m: `(min-width: ${breakpoints.m}px) and (max-width: ${breakpoints.l - 1}px)`,
|
|
31
|
+
l: `(min-width: ${breakpoints.l}px) and (max-width: ${breakpoints.xl - 1}px)`,
|
|
32
|
+
xl: `(min-width: ${breakpoints.xl}px)`,
|
|
33
|
+
};
|
|
34
|
+
const viewports = Object.keys(mediaQueries);
|
|
35
|
+
const matchers = viewports.map((viewport) => {
|
|
36
|
+
const mq = window.matchMedia(mediaQueries[viewport]);
|
|
37
|
+
return { mq, handler: () => mq.matches && setViewport(viewport) };
|
|
38
|
+
});
|
|
39
|
+
matchers.forEach(({ handler, mq }) => {
|
|
40
|
+
handler();
|
|
41
|
+
mq.addEventListener("change", handler);
|
|
42
|
+
});
|
|
43
|
+
return () => {
|
|
44
|
+
matchers.forEach(({ handler, mq }) => {
|
|
45
|
+
mq.removeEventListener("change", handler);
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
}, []);
|
|
49
|
+
return (_jsx(SingletonViewportContext.Provider, { value: { viewport }, children: children }));
|
|
50
|
+
};
|
|
51
|
+
const useSingletonViewport = () => React.useContext(SingletonViewportContext);
|
|
52
|
+
export default useSingletonViewport;
|
|
@@ -1,57 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { SingletonEnvironmentContext } from "./_private/useSingletonEnvironment.js";
|
|
5
|
-
import useIsomorphicLayoutEffect from "./useIsomorphicLayoutEffect.js";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import useViewport from "./useViewport.js";
|
|
6
4
|
const useResponsiveClientValue = (value) => {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
l: (rootStyle && Number(rootStyle.getPropertyValue("--rs-viewport-l-min"))) ||
|
|
21
|
-
defaultBreakpoints.l,
|
|
22
|
-
xl: (rootStyle && Number(rootStyle.getPropertyValue("--rs-viewport-xl-min"))) ||
|
|
23
|
-
defaultBreakpoints.xl,
|
|
24
|
-
};
|
|
25
|
-
const mediaQueries = {
|
|
26
|
-
s: `(max-width: ${breakpoints.m - 1}px)`,
|
|
27
|
-
m: `(min-width: ${breakpoints.m}px) and (max-width: ${breakpoints.l - 1}px)`,
|
|
28
|
-
l: `(min-width: ${breakpoints.l}px) and (max-width: ${breakpoints.xl - 1}px)`,
|
|
29
|
-
xl: `(min-width: ${breakpoints.xl}px)`,
|
|
30
|
-
};
|
|
31
|
-
const viewports = Object.keys(mediaQueries);
|
|
32
|
-
const matchers = viewports.map((viewport) => {
|
|
33
|
-
const mq = window.matchMedia(mediaQueries[viewport]);
|
|
34
|
-
return { mq, handler: () => mq.matches && setViewport(viewport) };
|
|
35
|
-
});
|
|
36
|
-
matchers.forEach(({ handler, mq }) => {
|
|
37
|
-
handler();
|
|
38
|
-
mq.addEventListener("change", handler);
|
|
39
|
-
});
|
|
40
|
-
return () => {
|
|
41
|
-
matchers.forEach(({ handler, mq }) => {
|
|
42
|
-
mq.removeEventListener("change", handler);
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
}, []);
|
|
46
|
-
if (typeof value !== "object" || value === null || !("s" in value)) {
|
|
47
|
-
return value;
|
|
48
|
-
}
|
|
49
|
-
if (viewport === "xl")
|
|
50
|
-
return value.xl ?? value.l ?? value.m ?? value.s;
|
|
51
|
-
if (viewport === "l")
|
|
52
|
-
return value.l ?? value.m ?? value.s;
|
|
53
|
-
if (viewport === "m")
|
|
54
|
-
return value.m ?? value.s;
|
|
55
|
-
return value.s;
|
|
5
|
+
const viewport = useViewport();
|
|
6
|
+
return useMemo(() => {
|
|
7
|
+
if (typeof value !== "object" || value === null || !("s" in value)) {
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
if (viewport === "xl")
|
|
11
|
+
return value.xl ?? value.l ?? value.m ?? value.s;
|
|
12
|
+
if (viewport === "l")
|
|
13
|
+
return value.l ?? value.m ?? value.s;
|
|
14
|
+
if (viewport === "m")
|
|
15
|
+
return value.m ?? value.s;
|
|
16
|
+
return value.s;
|
|
17
|
+
}, [viewport, value]);
|
|
56
18
|
};
|
|
57
19
|
export default useResponsiveClientValue;
|
package/dist/index.d.ts
CHANGED
|
@@ -131,28 +131,21 @@ export type { ViewProps, ViewItemProps } from "./components/View";
|
|
|
131
131
|
/**
|
|
132
132
|
* Hooks
|
|
133
133
|
*/
|
|
134
|
+
export { useHotkeys, useIsomorphicLayoutEffect, useRTL, useKeyboardArrowNavigation, useKeyboardMode, useHandlerRef, useOnClickOutside, useScrollLock, useToggle, } from "@reshaped/headless";
|
|
134
135
|
export { useFormControl } from "./components/FormControl";
|
|
135
136
|
export { default as Theme, useTheme, type ThemeProps } from "./components/Theme";
|
|
136
|
-
export { default as useHandlerRef } from "./hooks/useHandlerRef";
|
|
137
|
-
export { default as useHotkeys } from "./hooks/useHotkeys";
|
|
138
|
-
export { default as useIsomorphicLayoutEffect } from "./hooks/useIsomorphicLayoutEffect";
|
|
139
|
-
export { default as useKeyboardMode } from "./hooks/useKeyboardMode";
|
|
140
|
-
export { default as useKeyboardArrowNavigation } from "./hooks/useKeyboardArrowNavigation";
|
|
141
|
-
export { default as useOnClickOutside } from "./hooks/useOnClickOutside";
|
|
142
137
|
export { default as useResponsiveClientValue } from "./hooks/useResponsiveClientValue";
|
|
143
|
-
export { default as useRTL } from "./hooks/useRTL";
|
|
144
|
-
export { default as useScrollLock } from "./hooks/useScrollLock";
|
|
145
|
-
export { default as useToggle } from "./hooks/useToggle";
|
|
146
138
|
/**
|
|
147
139
|
* Utility functions
|
|
148
140
|
*/
|
|
149
141
|
export { responsivePropDependency } from "./utilities/props";
|
|
150
|
-
export { TrapFocus, classNames } from "@reshaped/
|
|
142
|
+
export { TrapFocus, classNames } from "@reshaped/headless";
|
|
151
143
|
/**
|
|
152
144
|
* Types
|
|
153
145
|
*/
|
|
146
|
+
export type { Attributes } from "@reshaped/headless";
|
|
154
147
|
export type { ReshapedConfig } from "./types/config";
|
|
155
|
-
export type { Responsive,
|
|
148
|
+
export type { Responsive, ColorMode } from "./types/global";
|
|
156
149
|
/**
|
|
157
150
|
* Dev utilities
|
|
158
151
|
*/
|
package/dist/index.js
CHANGED
|
@@ -69,23 +69,15 @@ export { default as View } from "./components/View/index.js";
|
|
|
69
69
|
/**
|
|
70
70
|
* Hooks
|
|
71
71
|
*/
|
|
72
|
+
export { useHotkeys, useIsomorphicLayoutEffect, useRTL, useKeyboardArrowNavigation, useKeyboardMode, useHandlerRef, useOnClickOutside, useScrollLock, useToggle, } from "@reshaped/headless";
|
|
72
73
|
export { useFormControl } from "./components/FormControl/index.js";
|
|
73
74
|
export { default as Theme, useTheme } from "./components/Theme/index.js";
|
|
74
|
-
export { default as useHandlerRef } from "./hooks/useHandlerRef.js";
|
|
75
|
-
export { default as useHotkeys } from "./hooks/useHotkeys.js";
|
|
76
|
-
export { default as useIsomorphicLayoutEffect } from "./hooks/useIsomorphicLayoutEffect.js";
|
|
77
|
-
export { default as useKeyboardMode } from "./hooks/useKeyboardMode.js";
|
|
78
|
-
export { default as useKeyboardArrowNavigation } from "./hooks/useKeyboardArrowNavigation.js";
|
|
79
|
-
export { default as useOnClickOutside } from "./hooks/useOnClickOutside.js";
|
|
80
75
|
export { default as useResponsiveClientValue } from "./hooks/useResponsiveClientValue.js";
|
|
81
|
-
export { default as useRTL } from "./hooks/useRTL.js";
|
|
82
|
-
export { default as useScrollLock } from "./hooks/useScrollLock.js";
|
|
83
|
-
export { default as useToggle } from "./hooks/useToggle.js";
|
|
84
76
|
/**
|
|
85
77
|
* Utility functions
|
|
86
78
|
*/
|
|
87
79
|
export { responsivePropDependency } from "./utilities/props.js";
|
|
88
|
-
export { TrapFocus, classNames } from "@reshaped/
|
|
80
|
+
export { TrapFocus, classNames } from "@reshaped/headless";
|
|
89
81
|
/**
|
|
90
82
|
* Dev utilities
|
|
91
83
|
*/
|
package/dist/styles/mixin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { ClassName } from "@reshaped/headless";
|
|
1
2
|
import type { Mixin } from "./types";
|
|
2
|
-
import type * as G from "../types/global";
|
|
3
3
|
export declare const resolveMixin: (mixin: Mixin) => {
|
|
4
4
|
variables: React.CSSProperties;
|
|
5
|
-
classNames:
|
|
5
|
+
classNames: ClassName[];
|
|
6
6
|
};
|
package/dist/styles/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import * as G from "../types/global";
|
|
3
|
+
import type { ClassName } from "@reshaped/headless";
|
|
3
4
|
type Unit = number;
|
|
4
5
|
type Literal = string;
|
|
5
6
|
type Size = Literal | Unit;
|
|
@@ -26,7 +27,7 @@ export type BorderColor = "neutral" | "neutral-faded" | "critical" | "critical-f
|
|
|
26
27
|
*/
|
|
27
28
|
export type StyleResolver<Value> = (value?: G.Responsive<Value>) => {
|
|
28
29
|
variables?: React.CSSProperties;
|
|
29
|
-
classNames?:
|
|
30
|
+
classNames?: ClassName;
|
|
30
31
|
};
|
|
31
32
|
export type Mixin = {
|
|
32
33
|
align?: G.Responsive<Align>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useToggle } from "@reshaped/headless";
|
|
2
3
|
import React from "react";
|
|
3
4
|
import Alert from "../components/Alert/index.js";
|
|
4
5
|
import Avatar from "../components/Avatar/index.js";
|
|
@@ -18,7 +19,6 @@ import Table from "../components/Table/index.js";
|
|
|
18
19
|
import Text from "../components/Text/index.js";
|
|
19
20
|
import TextField from "../components/TextField/index.js";
|
|
20
21
|
import View from "../components/View/index.js";
|
|
21
|
-
import useToggle from "../hooks/useToggle.js";
|
|
22
22
|
import IconChevronDown from "../icons/ChevronDown.js";
|
|
23
23
|
import IconChevronRight from "../icons/ChevronRight.js";
|
|
24
24
|
import IconZap from "../icons/Zap.js";
|
package/dist/types/global.d.ts
CHANGED
|
@@ -1,24 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
/**
|
|
3
|
-
* DOM
|
|
4
|
-
*/
|
|
5
|
-
type ClassNameValue = string | null | undefined | false;
|
|
6
|
-
export type ClassName = ClassNameValue | ClassNameValue[] | ClassName[];
|
|
7
|
-
export type CSSVariable = `--${string}`;
|
|
8
|
-
export type StyleAttribute = React.CSSProperties | (React.CSSProperties & Record<CSSVariable, string | number | undefined>);
|
|
9
|
-
type DataAttributes = object | Record<`data-${string}`, string | boolean>;
|
|
10
|
-
export type Attributes<TagName extends keyof React.JSX.IntrinsicElements | void = void> = (TagName extends keyof React.JSX.IntrinsicElements ? React.JSX.IntrinsicElements[TagName] : React.HTMLAttributes<HTMLElement>) & DataAttributes & {
|
|
11
|
-
style?: StyleAttribute;
|
|
12
|
-
};
|
|
13
2
|
export type Viewport = "s" | "m" | "l" | "xl";
|
|
14
3
|
export type ResponsiveOnly<T> = {
|
|
15
4
|
[key in Viewport]?: T;
|
|
16
5
|
};
|
|
17
6
|
export type Responsive<T> = T | ResponsiveOnly<T>;
|
|
18
|
-
export type Coordinates = {
|
|
19
|
-
x: number;
|
|
20
|
-
y: number;
|
|
21
|
-
};
|
|
22
7
|
/**
|
|
23
8
|
* Form handlers
|
|
24
9
|
*/
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import type { CSSVariable } from "@reshaped/headless";
|
|
1
2
|
import type * as G from "../types/global";
|
|
2
3
|
type Value = string | boolean | number | undefined;
|
|
3
4
|
type ClassNameResolver = string | ((value: Value) => string);
|
|
4
5
|
export declare const responsiveClassNames: <V extends G.Responsive<Value>>(s: Record<string, string>, className: ClassNameResolver, value: V, options?: {
|
|
5
6
|
excludeValueFromClassName?: boolean;
|
|
6
7
|
}) => string[];
|
|
7
|
-
export declare const responsiveVariables: <V extends Value = Value>(variableName:
|
|
8
|
+
export declare const responsiveVariables: <V extends Value = Value>(variableName: CSSVariable, value?: G.Responsive<V>) => Record<CSSVariable, V>;
|
|
8
9
|
export declare const responsivePropDependency: <Result, T>(prop: G.Responsive<T>, resolver: (value: T, key: G.Viewport) => Result) => Result;
|
|
9
10
|
export {};
|
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.10.0-canary.
|
|
4
|
+
"version": "3.10.0-canary.7",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"email": "hello@reshaped.so",
|
|
7
7
|
"homepage": "https://reshaped.so",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"csstype": "3.1.3",
|
|
92
92
|
"culori": "4.0.2",
|
|
93
93
|
"postcss-custom-media": "11.0.6",
|
|
94
|
-
"@reshaped/
|
|
94
|
+
"@reshaped/headless": "3.10.0-canary.7"
|
|
95
95
|
},
|
|
96
96
|
"scripts": {
|
|
97
97
|
"clean": "bash ./bin/clean.sh",
|