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 +1 @@
|
|
|
1
|
-
.content{--rs-flyout-max-h:100%;--rs-flyout-max-w:100%;--rs-flyout-origin-x:50%;--rs-flyout-origin-y:50%;display:flex;flex-direction:column;isolation:isolate;pointer-events:none;position:absolute;z-index:var(--rs-z-index
|
|
1
|
+
.content{--rs-flyout-max-h:100%;--rs-flyout-max-w:100%;--rs-flyout-z-index:var(--rs-z-index-absolute);--rs-flyout-origin-x:50%;--rs-flyout-origin-y:50%;display:flex;flex-direction:column;isolation:isolate;pointer-events:none;position:absolute;z-index:var(--rs-flyout-z-index)}.content.--hover{pointer-events:all}.content.--hover-disabled,.content.--hover-disabled .inner{pointer-events:none}.inner{backface-visibility:hidden;flex-grow:1;height:100%;max-height:var(--rs-flyout-max-h);max-width:var(--rs-flyout-max-w);opacity:0;outline:none;overflow:auto;pointer-events:all;transform:scale(.92) translateY(0);transform-origin:var(--rs-flyout-origin-x) var(--rs-flyout-origin-y);transition:1ms var(--rs-easing-accelerate)}[data-rs-keyboard] .inner:focus{box-shadow:var(--rs-shadow-focus)}.content.--width-trigger .inner{transform:scale(1) translateY(var(--rs-unit-x2))}.content.--position-top,.content.--position-top-end,.content.--position-top-start{--rs-flyout-origin-y:100%}.content.--position-bottom,.content.--position-bottom-end,.content.--position-bottom-start{--rs-flyout-origin-y:0%}.content.--position-bottom-start,.content.--position-top-start{--rs-flyout-origin-x:0%}.content.--position-bottom-end,.content.--position-start,.content.--position-start-bottom,.content.--position-start-top,.content.--position-top-end{--rs-flyout-origin-x:100%}.content.--position-end,.content.--position-end-bottom,.content.--position-end-top{--rs-flyout-origin-x:0%}.content.--position-end-top,.content.--position-start-top{--rs-flyout-origin-y:0%}.content.--position-end-bottom,.content.--position-start-bottom{--rs-flyout-origin-y:100%}.content.--visible .inner{opacity:1;transform:scale(1) translateY(0)}.content.--animated .inner{transition-duration:var(--rs-duration-rapid);transition-property:opacity,transform}.content.--animated.--visible .inner{transition-duration:var(--rs-duration-fast);transition-timing-function:var(--rs-easing-decelerate)}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type {
|
|
3
|
-
import type
|
|
2
|
+
import type { Attributes, ClassName } from "@reshaped/headless";
|
|
3
|
+
import type { TrapMode, Coordinates } from "@reshaped/headless/internal";
|
|
4
4
|
/**
|
|
5
5
|
* Utility
|
|
6
6
|
*/
|
|
@@ -115,7 +115,7 @@ type BaseProps = {
|
|
|
115
115
|
*/
|
|
116
116
|
autoFocus?: boolean;
|
|
117
117
|
/** Origin coordinates for the content when there is no trigger element */
|
|
118
|
-
originCoordinates?:
|
|
118
|
+
originCoordinates?: Coordinates;
|
|
119
119
|
/** Node for inserting children */
|
|
120
120
|
children?: React.ReactNode;
|
|
121
121
|
/** Callback when the content is opened */
|
|
@@ -134,10 +134,12 @@ type BaseProps = {
|
|
|
134
134
|
contentMaxHeight?: string;
|
|
135
135
|
/** Maximum width for the content */
|
|
136
136
|
contentMaxWidth?: string;
|
|
137
|
+
/** Z-index for the content element */
|
|
138
|
+
contentZIndex?: number;
|
|
137
139
|
/** Additional classname for the content element */
|
|
138
140
|
contentClassName?: string;
|
|
139
141
|
/** Additional attributes for the content element */
|
|
140
|
-
contentAttributes?:
|
|
142
|
+
contentAttributes?: Attributes<"div">;
|
|
141
143
|
/** Ref accessor for the flyout methods */
|
|
142
144
|
instanceRef?: React.Ref<Instance>;
|
|
143
145
|
/** Container to render the content in using a portal, position is calculated based on the container bounds
|
|
@@ -164,9 +166,9 @@ export type ContentProps = {
|
|
|
164
166
|
/** Node for inserting children */
|
|
165
167
|
children?: React.ReactNode;
|
|
166
168
|
/** Additional classname for the content element */
|
|
167
|
-
className?:
|
|
169
|
+
className?: ClassName;
|
|
168
170
|
/** Additional attributes for the content element */
|
|
169
|
-
attributes?:
|
|
171
|
+
attributes?: Attributes<"div">;
|
|
170
172
|
};
|
|
171
173
|
export type ContextProps = {
|
|
172
174
|
id: string;
|
|
@@ -190,7 +192,7 @@ export type ContextProps = {
|
|
|
190
192
|
handleContentMouseDown: () => void;
|
|
191
193
|
handleContentMouseUp: () => void;
|
|
192
194
|
isSubmenu: boolean;
|
|
193
|
-
} & Pick<Props, "triggerType" | "contentClassName" | "contentAttributes" | "contentGap" | "contentMaxHeight" | "contentMaxWidth" | "trapFocusMode" | "containerRef" | "disableContentHover" | "autoFocus">;
|
|
195
|
+
} & Pick<Props, "triggerType" | "contentClassName" | "contentAttributes" | "contentGap" | "contentMaxHeight" | "contentMaxWidth" | "contentZIndex" | "trapFocusMode" | "containerRef" | "disableContentHover" | "autoFocus">;
|
|
194
196
|
export type TriggerContextProps = {
|
|
195
197
|
elRef?: ContextProps["triggerElRef"];
|
|
196
198
|
};
|
|
@@ -1,15 +1,14 @@
|
|
|
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
5
|
import Portal from "../_private/Portal/index.js";
|
|
6
|
-
import useIsomorphicLayoutEffect from "../../hooks/useIsomorphicLayoutEffect.js";
|
|
7
6
|
import { useFlyoutContext, ContentProvider } from "./Flyout.context.js";
|
|
8
7
|
import s from "./Flyout.module.css";
|
|
9
8
|
import cooldown from "./utilities/cooldown.js";
|
|
10
9
|
const FlyoutContent = (props) => {
|
|
11
10
|
const { children, className, attributes } = props;
|
|
12
|
-
const { flyout, id, flyoutElRef, handleTransitionEnd, triggerType, handleContentMouseEnter, handleMouseLeave, handleContentMouseDown, handleContentMouseUp, contentClassName, contentAttributes, contentMaxHeight, contentMaxWidth, trapFocusMode, disableContentHover, autoFocus, width, isSubmenu, } = useFlyoutContext();
|
|
11
|
+
const { flyout, id, flyoutElRef, handleTransitionEnd, triggerType, handleContentMouseEnter, handleMouseLeave, handleContentMouseDown, handleContentMouseUp, contentClassName, contentAttributes, contentMaxHeight, contentMaxWidth, contentZIndex, trapFocusMode, disableContentHover, autoFocus, width, isSubmenu, } = useFlyoutContext();
|
|
13
12
|
const { status, position } = flyout;
|
|
14
13
|
const [mounted, setMounted] = React.useState(false);
|
|
15
14
|
useIsomorphicLayoutEffect(() => {
|
|
@@ -43,6 +42,7 @@ const FlyoutContent = (props) => {
|
|
|
43
42
|
const content = (_jsx(ContentProvider, { value: { elRef: flyoutElRef }, children: _jsx("div", { className: rootClassNames, style: {
|
|
44
43
|
"--rs-flyout-max-h": contentMaxHeight,
|
|
45
44
|
"--rs-flyout-max-w": contentMaxWidth,
|
|
45
|
+
"--rs-flyout-z-index": contentZIndex,
|
|
46
46
|
}, ref: flyoutElRef, onTransitionEnd: handleTransitionEnd, onMouseEnter: triggerType === "hover" ? handleContentMouseEnter : undefined, onMouseLeave: triggerType === "hover" ? handleMouseLeave : undefined, onMouseDown: handleContentMouseDown, onTouchStart: handleContentMouseDown, onMouseUp: handleContentMouseUp, onTouchEnd: handleContentMouseUp, children: _jsx("div", { role: role, ...attributes, id: id, tabIndex: !autoFocus ? -1 : undefined, "aria-modal": role === "dialog" ? true : undefined, style: { ...attributes?.style, ...contentAttributes?.style }, className: innerClassNames, children: children }) }) }));
|
|
47
47
|
return _jsx(Portal, { children: content });
|
|
48
48
|
};
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { TrapFocus } from "@reshaped/
|
|
4
|
-
import { checkKeyboardMode } from "@reshaped/
|
|
3
|
+
import { TrapFocus, useHotkeys, useIsomorphicLayoutEffect, useHandlerRef, useOnClickOutside, } from "@reshaped/headless";
|
|
4
|
+
import { checkKeyboardMode, } from "@reshaped/headless/internal";
|
|
5
5
|
import React from "react";
|
|
6
6
|
import useIsDismissible from "../../hooks/_private/useIsDismissible.js";
|
|
7
7
|
import usePrevious from "../../hooks/_private/usePrevious.js";
|
|
8
8
|
import useElementId from "../../hooks/useElementId.js";
|
|
9
|
-
import useHandlerRef from "../../hooks/useHandlerRef.js";
|
|
10
|
-
import useHotkeys from "../../hooks/useHotkeys.js";
|
|
11
|
-
import useIsomorphicLayoutEffect from "../../hooks/useIsomorphicLayoutEffect.js";
|
|
12
|
-
import useOnClickOutside from "../../hooks/useOnClickOutside.js";
|
|
13
9
|
import { checkTransitions } from "../../utilities/animation.js";
|
|
14
10
|
import * as timeouts from "./Flyout.constants.js";
|
|
15
11
|
import { Provider, useFlyoutTriggerContext, useFlyoutContext, useFlyoutContentContext, } from "./Flyout.context.js";
|
|
@@ -17,7 +13,7 @@ import useFlyout from "./useFlyout.js";
|
|
|
17
13
|
import cooldown from "./utilities/cooldown.js";
|
|
18
14
|
import { createSafeArea } from "./utilities/safeArea.js";
|
|
19
15
|
const FlyoutControlled = (props) => {
|
|
20
|
-
const { triggerType = "click", groupTimeouts, onOpen, onClose, children, disabled, forcePosition, fallbackAdjustLayout, fallbackMinHeight, trapFocusMode = "dialog", width, disableHideAnimation, disableContentHover, disableCloseOnOutsideClick, autoFocus = true, originCoordinates, contentGap = 2, contentShift, contentMaxHeight, contentMaxWidth, contentClassName, contentAttributes, position: passedPosition, active: passedActive, id: passedId, instanceRef, containerRef, initialFocusRef, positionRef, } = props;
|
|
16
|
+
const { triggerType = "click", groupTimeouts, onOpen, onClose, children, disabled, forcePosition, fallbackAdjustLayout, fallbackMinHeight, trapFocusMode = "dialog", width, disableHideAnimation, disableContentHover, disableCloseOnOutsideClick, autoFocus = true, originCoordinates, contentGap = 2, contentShift, contentMaxHeight, contentMaxWidth, contentZIndex, contentClassName, contentAttributes, position: passedPosition, active: passedActive, id: passedId, instanceRef, containerRef, initialFocusRef, positionRef, } = props;
|
|
21
17
|
const fallbackPositions = props.fallbackPositions === false || forcePosition ? [] : props.fallbackPositions;
|
|
22
18
|
const onOpenRef = useHandlerRef(onOpen);
|
|
23
19
|
const onCloseRef = useHandlerRef(onClose);
|
|
@@ -350,6 +346,7 @@ const FlyoutControlled = (props) => {
|
|
|
350
346
|
handleContentMouseUp,
|
|
351
347
|
triggerType,
|
|
352
348
|
trapFocusMode,
|
|
349
|
+
contentZIndex,
|
|
353
350
|
contentClassName,
|
|
354
351
|
contentAttributes,
|
|
355
352
|
contentGap,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { type Coordinates } from "@reshaped/headless/internal";
|
|
1
2
|
import type * as T from "./Flyout.types";
|
|
2
|
-
import type * as G from "../../types/global";
|
|
3
3
|
type UseFlyout = (args: Pick<T.Props, "width" | "position" | "defaultActive" | "fallbackAdjustLayout" | "fallbackMinHeight" | "contentGap" | "contentShift" | "onClose"> & {
|
|
4
4
|
fallbackPositions?: T.Position[];
|
|
5
5
|
container?: HTMLElement | null;
|
|
6
6
|
triggerElRef: React.RefObject<HTMLElement | null>;
|
|
7
7
|
flyoutElRef: React.RefObject<HTMLElement | null>;
|
|
8
|
-
triggerCoordinatesRef: React.RefObject<DOMRect |
|
|
8
|
+
triggerCoordinatesRef: React.RefObject<DOMRect | Coordinates | null>;
|
|
9
9
|
}) => Pick<T.State, "position" | "status"> & {
|
|
10
10
|
updatePosition: (options?: {
|
|
11
11
|
fallback?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useIsomorphicLayoutEffect } from "@reshaped/headless";
|
|
2
|
+
import { Flyout } from "@reshaped/headless/internal";
|
|
2
3
|
import { useCallback, useMemo, useRef, useState } from "react";
|
|
3
|
-
import useIsomorphicLayoutEffect from "../../hooks/useIsomorphicLayoutEffect.js";
|
|
4
4
|
const useFlyout = (args) => {
|
|
5
5
|
const { triggerElRef, flyoutElRef, triggerCoordinatesRef, contentGap, contentShift, onClose, ...options } = args;
|
|
6
6
|
const { position: defaultPosition = "bottom", fallbackPositions, fallbackAdjustLayout, fallbackMinHeight, width, container, } = options;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { Coordinates } from "@reshaped/headless/internal";
|
|
2
2
|
type SafePolygonOptions = {
|
|
3
3
|
contentRef: React.RefObject<HTMLElement | null>;
|
|
4
4
|
triggerRef: React.RefObject<HTMLElement | null>;
|
|
5
5
|
position: string | null | undefined;
|
|
6
6
|
onClose: () => void;
|
|
7
|
-
origin:
|
|
7
|
+
origin: Coordinates;
|
|
8
8
|
};
|
|
9
9
|
export declare function createSafeArea(options: SafePolygonOptions): () => void;
|
|
10
10
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { classNames } from "@reshaped/
|
|
2
|
+
import { classNames } from "@reshaped/headless";
|
|
3
3
|
import { resolveMixin } from "../../styles/mixin.js";
|
|
4
4
|
import { responsiveVariables, responsivePropDependency } from "../../utilities/props.js";
|
|
5
5
|
import s from "./Grid.module.css";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Attributes, ClassName } from "@reshaped/headless";
|
|
1
2
|
import type { Property } from "csstype";
|
|
2
3
|
import type React from "react";
|
|
3
4
|
import type * as TStyles from "../../styles/types";
|
|
@@ -36,9 +37,9 @@ export type Props<TagName extends keyof React.JSX.IntrinsicElements | void = voi
|
|
|
36
37
|
/** Custom root element html tag */
|
|
37
38
|
as?: TagName extends keyof React.JSX.IntrinsicElements ? TagName : keyof React.JSX.IntrinsicElements;
|
|
38
39
|
/** Additional classname for the root element */
|
|
39
|
-
className?:
|
|
40
|
+
className?: ClassName;
|
|
40
41
|
/** Additional attributes for the root element */
|
|
41
|
-
attributes?:
|
|
42
|
+
attributes?: Attributes<TagName>;
|
|
42
43
|
};
|
|
43
44
|
export type ItemProps<TagName extends keyof React.JSX.IntrinsicElements | void = void> = {
|
|
44
45
|
/** Grid area for template syntax */
|
|
@@ -60,7 +61,7 @@ export type ItemProps<TagName extends keyof React.JSX.IntrinsicElements | void =
|
|
|
60
61
|
/** Custom item element html tag */
|
|
61
62
|
as?: TagName extends keyof React.JSX.IntrinsicElements ? TagName : keyof React.JSX.IntrinsicElements;
|
|
62
63
|
/** Additional classname for the item element */
|
|
63
|
-
className?:
|
|
64
|
+
className?: ClassName;
|
|
64
65
|
/** Additional attributes for the item element */
|
|
65
|
-
attributes?:
|
|
66
|
+
attributes?: Attributes<TagName>;
|
|
66
67
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { classNames } from "@reshaped/
|
|
2
|
+
import { classNames } from "@reshaped/headless";
|
|
3
3
|
import { responsiveClassNames } from "../../utilities/props.js";
|
|
4
4
|
import s from "./Hidden.module.css";
|
|
5
5
|
const Hidden = (props) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { classNames } from "@reshaped/
|
|
2
|
+
import { classNames } from "@reshaped/headless";
|
|
3
3
|
import { useCheckboxGroup } from "../CheckboxGroup/index.js";
|
|
4
4
|
import { useFormControl } from "../FormControl/index.js";
|
|
5
5
|
import { useRadioGroup } from "../RadioGroup/index.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import type { Attributes, ClassName } from "@reshaped/headless";
|
|
2
3
|
import type * as G from "../../types/global";
|
|
3
4
|
export type Props = {
|
|
4
5
|
/** Name of the input element */
|
|
@@ -20,7 +21,7 @@ export type Props = {
|
|
|
20
21
|
/** Type of the input element */
|
|
21
22
|
type: "checkbox" | "radio";
|
|
22
23
|
/** Additional classname for the root element */
|
|
23
|
-
className?:
|
|
24
|
+
className?: ClassName;
|
|
24
25
|
/** Additional attributes for the input element */
|
|
25
|
-
attributes?:
|
|
26
|
+
attributes?: Attributes<"input">;
|
|
26
27
|
};
|
|
@@ -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
|
/** Highlight the component, can be used to show when hotkey is pressed */
|
|
7
7
|
active?: boolean;
|
|
8
8
|
/** Additional classname for the root element */
|
|
9
|
-
className?:
|
|
9
|
+
className?: ClassName;
|
|
10
10
|
/** Additional attributes for the root element */
|
|
11
|
-
attributes?:
|
|
11
|
+
attributes?: Attributes<"span">;
|
|
12
12
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { classNames } from "@reshaped/
|
|
2
|
+
import { classNames } from "@reshaped/headless";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { resolveMixin } from "../../styles/mixin.js";
|
|
5
5
|
import s from "./Icon.module.css";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Attributes, ClassName } from "@reshaped/headless";
|
|
1
2
|
import type React from "react";
|
|
2
3
|
import type * as G from "../../types/global";
|
|
3
4
|
export type Props = {
|
|
@@ -10,7 +11,7 @@ export type Props = {
|
|
|
10
11
|
/** Use the width of the svg asset instead of providing a square bounding box */
|
|
11
12
|
autoWidth?: boolean;
|
|
12
13
|
/** Additional classname for the root element */
|
|
13
|
-
className?:
|
|
14
|
+
className?: ClassName;
|
|
14
15
|
/** Additional attributes for the root element */
|
|
15
|
-
attributes?:
|
|
16
|
+
attributes?: Attributes<"span">;
|
|
16
17
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { classNames } from "@reshaped/
|
|
3
|
+
import { classNames } from "@reshaped/headless";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { resolveMixin } from "../../styles/mixin.js";
|
|
6
6
|
import s from "./Image.module.css";
|
|
@@ -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";
|
|
@@ -27,14 +28,14 @@ export type Props = {
|
|
|
27
28
|
/** Image fallback content if the image fails to load or was not provided */
|
|
28
29
|
fallback?: string | React.ReactNode | boolean;
|
|
29
30
|
/** Image render function, can be used for integrating with Image component in 3rd party frameworks */
|
|
30
|
-
renderImage?: (attributes: Omit<
|
|
31
|
+
renderImage?: (attributes: Omit<Attributes<"img">, "src" | "alt"> & {
|
|
31
32
|
src: string;
|
|
32
33
|
alt: string;
|
|
33
34
|
}) => React.ReactNode;
|
|
34
35
|
/** Additional attributes for the image element */
|
|
35
|
-
imageAttributes?:
|
|
36
|
+
imageAttributes?: Attributes<"img">;
|
|
36
37
|
/** Additional classname for the root element */
|
|
37
|
-
className?:
|
|
38
|
+
className?: ClassName;
|
|
38
39
|
/** Additional attributes for the root element */
|
|
39
|
-
attributes?:
|
|
40
|
+
attributes?: Attributes<"div"> & Attributes<"img">;
|
|
40
41
|
};
|
|
@@ -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 { forwardRef } from "react";
|
|
4
4
|
import Actionable from "../Actionable/index.js";
|
|
5
5
|
import Icon from "../Icon/index.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { classNames } from "@reshaped/
|
|
2
|
+
import { classNames } from "@reshaped/headless";
|
|
3
3
|
import { responsiveClassNames } from "../../utilities/props.js";
|
|
4
4
|
import s from "./Loader.module.css";
|
|
5
5
|
const Loader = (props) => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Attributes, ClassName } from "@reshaped/headless";
|
|
1
2
|
import type * as G from "../../types/global";
|
|
2
3
|
export type Props = {
|
|
3
4
|
/** Component size */
|
|
@@ -7,7 +8,7 @@ export type Props = {
|
|
|
7
8
|
/** aria-label attribute for the root element */
|
|
8
9
|
ariaLabel?: string;
|
|
9
10
|
/** Additional classname for the root element */
|
|
10
|
-
className?:
|
|
11
|
+
className?: ClassName;
|
|
11
12
|
/** Additional attributes for the root element */
|
|
12
|
-
attributes?:
|
|
13
|
+
attributes?: Attributes<"span">;
|
|
13
14
|
};
|
|
@@ -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 { forwardRef } from "react";
|
|
4
4
|
import Actionable from "../Actionable/index.js";
|
|
5
5
|
import Icon from "../Icon/index.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Attributes, ClassName } from "@reshaped/headless";
|
|
1
2
|
import type { ActionableProps } from "../Actionable";
|
|
2
3
|
import type { IconProps } from "../Icon";
|
|
3
4
|
import type React from "react";
|
|
@@ -27,7 +28,7 @@ export type AlignerProps = {
|
|
|
27
28
|
/** Node for inserting children */
|
|
28
29
|
children: React.ReactElement;
|
|
29
30
|
/** Additional classname for the root element */
|
|
30
|
-
className?:
|
|
31
|
+
className?: ClassName;
|
|
31
32
|
/** Additional attributes for the root element */
|
|
32
|
-
attributes?:
|
|
33
|
+
attributes?: Attributes<"div">;
|
|
33
34
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { classNames } from "@reshaped/
|
|
4
|
-
import { enableScroll, disableScroll } from "@reshaped/
|
|
3
|
+
import { classNames, useHandlerRef } from "@reshaped/headless";
|
|
4
|
+
import { enableScroll, disableScroll } from "@reshaped/headless/internal";
|
|
5
5
|
import React from "react";
|
|
6
6
|
import Overlay from "../Overlay/index.js";
|
|
7
7
|
import Text from "../Text/index.js";
|
|
8
8
|
import useElementId from "../../hooks/useElementId.js";
|
|
9
|
-
import useHandlerRef from "../../hooks/useHandlerRef.js";
|
|
10
9
|
import useResponsiveClientValue from "../../hooks/useResponsiveClientValue.js";
|
|
11
10
|
import { resolveMixin } from "../../styles/mixin.js";
|
|
12
11
|
import { responsiveVariables, responsiveClassNames } from "../../utilities/props.js";
|
|
@@ -41,7 +40,7 @@ export const ModalSubtitle = (props) => {
|
|
|
41
40
|
return (_jsx(Text, { variant: "body-3", color: "neutral-faded", attributes: { id: `${id}-subtitle` }, children: children }));
|
|
42
41
|
};
|
|
43
42
|
const Modal = (props) => {
|
|
44
|
-
const { children, onClose, onOpen, onAfterClose, onAfterOpen, active, size, padding = 4, position = "center", overflow, transparentOverlay, blurredOverlay, ariaLabel, autoFocus = true, disableSwipeGesture, disableCloseOnOutsideClick, containerRef, overlayClassName, className, attributes, } = props;
|
|
43
|
+
const { children, onClose, onOpen, onAfterClose, onAfterOpen, active, size, padding = 4, position = "center", overflow, transparentOverlay, blurredOverlay, ariaLabel, autoFocus = true, disableSwipeGesture, disableCloseOnOutsideClick, containerRef, contained, overlayClassName, className, attributes, } = props;
|
|
45
44
|
const onCloseRef = useHandlerRef(onClose);
|
|
46
45
|
const id = useElementId();
|
|
47
46
|
const clientPosition = useResponsiveClientValue(position);
|
|
@@ -57,6 +56,7 @@ const Modal = (props) => {
|
|
|
57
56
|
const [dragDistance, setDragDistance] = React.useState(0);
|
|
58
57
|
const [hideProgress, setHideProgress] = React.useState(0);
|
|
59
58
|
const mixinStyles = resolveMixin({ padding });
|
|
59
|
+
const shouldBeContained = containerRef && contained !== false;
|
|
60
60
|
const value = React.useMemo(() => ({
|
|
61
61
|
titleMounted,
|
|
62
62
|
setTitleMounted,
|
|
@@ -166,10 +166,10 @@ const Modal = (props) => {
|
|
|
166
166
|
setHideProgress(progress / 2);
|
|
167
167
|
dragDistanceRef.current = dragDistance;
|
|
168
168
|
}, [dragDistance, clientPosition, rootRef]);
|
|
169
|
-
return (_jsx(Overlay, { onClose: onClose, onOpen: onOpen, onAfterClose: onAfterClose, onAfterOpen: onAfterOpen, disableCloseOnClick: disableCloseOnOutsideClick, active: active, transparent: transparentOverlay || hideProgress, blurred: blurredOverlay, overflow: clientPosition === "center" ? "auto" : "hidden", className: overlayClassName, containerRef: containerRef, attributes: {
|
|
169
|
+
return (_jsx(Overlay, { onClose: onClose, onOpen: onOpen, onAfterClose: onAfterClose, onAfterOpen: onAfterOpen, disableCloseOnClick: disableCloseOnOutsideClick, active: active, transparent: transparentOverlay || hideProgress, blurred: blurredOverlay, overflow: clientPosition === "center" ? "auto" : "hidden", className: overlayClassName, contained: contained, containerRef: containerRef, attributes: {
|
|
170
170
|
onTouchStart: handleDragStart,
|
|
171
171
|
}, children: ({ active }) => {
|
|
172
|
-
const rootClassNames = classNames(s.root, className, active && s["--active"], dragging && s["--dragging"], overflow && s[`--overflow-${overflow}`],
|
|
172
|
+
const rootClassNames = classNames(s.root, className, active && s["--active"], dragging && s["--dragging"], overflow && s[`--overflow-${overflow}`], shouldBeContained && s["--contained"], responsiveClassNames(s, "--position", position), mixinStyles.classNames);
|
|
173
173
|
return (_jsx(Context.Provider, { value: value, children: _jsx("div", { ...attributes, style: {
|
|
174
174
|
...mixinStyles.variables,
|
|
175
175
|
...responsiveVariables("--rs-modal-size", size),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Attributes, ClassName } from "@reshaped/headless";
|
|
1
2
|
import type { OverlayProps, OverlayCloseReason } from "../Overlay";
|
|
2
3
|
import type React from "react";
|
|
3
4
|
import type * as G from "../../types/global";
|
|
@@ -46,11 +47,11 @@ export type Props = {
|
|
|
46
47
|
/** aria-label attribute for the root element, useful when there is no visible title */
|
|
47
48
|
ariaLabel?: string;
|
|
48
49
|
/** Additional classname for the root element */
|
|
49
|
-
className?:
|
|
50
|
+
className?: ClassName;
|
|
50
51
|
/** Additional classname for the overlay element */
|
|
51
|
-
overlayClassName?:
|
|
52
|
+
overlayClassName?: ClassName;
|
|
52
53
|
/** Additional attributes for the root element */
|
|
53
|
-
attributes?:
|
|
54
|
+
attributes?: Attributes<"div"> & {
|
|
54
55
|
ref?: React.RefObject<HTMLDivElement | null>;
|
|
55
56
|
};
|
|
56
|
-
} & Pick<OverlayProps, "onOpen" | "onAfterOpen" | "onAfterClose" | "active" | "containerRef">;
|
|
57
|
+
} & Pick<OverlayProps, "onOpen" | "onAfterOpen" | "onAfterClose" | "active" | "containerRef" | "contained">;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useHotkeys, useHandlerRef } from "@reshaped/headless";
|
|
3
4
|
import React from "react";
|
|
4
5
|
import Actionable from "../Actionable/index.js";
|
|
5
6
|
import { useFormControl } from "../FormControl/index.js";
|
|
@@ -7,8 +8,6 @@ import Icon from "../Icon/index.js";
|
|
|
7
8
|
import TextField from "../TextField/index.js";
|
|
8
9
|
import * as keys from "../../constants/keys.js";
|
|
9
10
|
import useElementId from "../../hooks/useElementId.js";
|
|
10
|
-
import useHandlerRef from "../../hooks/useHandlerRef.js";
|
|
11
|
-
import useHotkeys from "../../hooks/useHotkeys.js";
|
|
12
11
|
import IconChevronDown from "../../icons/ChevronDown.js";
|
|
13
12
|
import IconChevronUp from "../../icons/ChevronUp.js";
|
|
14
13
|
import IconMinus from "../../icons/Minus.js";
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { TrapFocus } from "@reshaped/
|
|
4
|
-
import { classNames } from "@reshaped/
|
|
3
|
+
import { TrapFocus, useHotkeys, useIsomorphicLayoutEffect, useHandlerRef, useScrollLock, useToggle, } from "@reshaped/headless";
|
|
4
|
+
import { classNames } from "@reshaped/headless";
|
|
5
5
|
import React from "react";
|
|
6
6
|
import Portal from "../_private/Portal/index.js";
|
|
7
7
|
import useIsDismissible from "../../hooks/_private/useIsDismissible.js";
|
|
8
|
-
import useHandlerRef from "../../hooks/useHandlerRef.js";
|
|
9
|
-
import useHotkeys from "../../hooks/useHotkeys.js";
|
|
10
|
-
import useIsomorphicLayoutEffect from "../../hooks/useIsomorphicLayoutEffect.js";
|
|
11
|
-
import useScrollLock from "../../hooks/useScrollLock.js";
|
|
12
|
-
import useToggle from "../../hooks/useToggle.js";
|
|
13
8
|
import { onNextFrame } from "../../utilities/animation.js";
|
|
14
9
|
import s from "./Overlay.module.css";
|
|
15
10
|
const Overlay = (props) => {
|
|
16
|
-
const { active, children, transparent, blurred, overflow, onClose, onOpen, onAfterClose, onAfterOpen, disableCloseOnClick, containerRef, className, attributes, } = props;
|
|
11
|
+
const { active, children, transparent, blurred, overflow, onClose, onOpen, onAfterClose, onAfterOpen, disableCloseOnClick, containerRef, contained, className, attributes, } = props;
|
|
17
12
|
// Selectors wrapped with refs to simplify working with useEffect dependency array
|
|
18
13
|
const onCloseRef = useHandlerRef(onClose);
|
|
19
14
|
const onOpenRef = useHandlerRef(onOpen);
|
|
@@ -32,7 +27,8 @@ const Overlay = (props) => {
|
|
|
32
27
|
const { active: rendered, activate: render, deactivate: remove } = useToggle(active || false);
|
|
33
28
|
const { active: visible, activate: show, deactivate: hide } = useToggle(active || false);
|
|
34
29
|
const isDismissible = useIsDismissible({ active, contentRef, hasTrigger: false });
|
|
35
|
-
const
|
|
30
|
+
const shouldBeContained = containerRef && contained !== false;
|
|
31
|
+
const rootClassNames = classNames(s.root, visible && s["--visible"], isTransparent && s["--click-through"], blurred && s["--blurred"], animated && s["--animated"], shouldBeContained && s["--contained"], overflow === "auto" && s["--overflow-auto"], className);
|
|
36
32
|
const isInsideContent = (el) => {
|
|
37
33
|
if (!contentRef.current)
|
|
38
34
|
return;
|
|
@@ -100,9 +96,8 @@ const Overlay = (props) => {
|
|
|
100
96
|
const containerEl = containerRef?.current;
|
|
101
97
|
if (containerEl) {
|
|
102
98
|
originalOverflowRef.current = containerEl.style.overflow;
|
|
103
|
-
|
|
104
|
-
containerEl.style.
|
|
105
|
-
containerEl.style.isolation = "isolate";
|
|
99
|
+
containerEl.style.setProperty("overflow", "hidden");
|
|
100
|
+
containerEl.style.setProperty("isolation", "isolate");
|
|
106
101
|
setOffset([containerEl.scrollLeft, containerEl.scrollTop]);
|
|
107
102
|
}
|
|
108
103
|
trapFocus.trap(contentRef.current, {
|
|
@@ -1,5 +1,5 @@
|
|
|
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 CloseReason = "overlay-click" | "escape-key";
|
|
4
4
|
export type Props = {
|
|
5
5
|
/** Make the overlay transparent */
|
|
@@ -28,8 +28,10 @@ export type Props = {
|
|
|
28
28
|
disableCloseOnClick?: boolean;
|
|
29
29
|
/** Element to render the component in */
|
|
30
30
|
containerRef?: React.RefObject<HTMLElement | null>;
|
|
31
|
+
/** Contain the component within the container element. Defaults to true when containerRef is provided */
|
|
32
|
+
contained?: boolean;
|
|
31
33
|
/** Additional classname for the root element */
|
|
32
|
-
className?:
|
|
34
|
+
className?: ClassName;
|
|
33
35
|
/** Additional attributes for the root element */
|
|
34
|
-
attributes?:
|
|
36
|
+
attributes?: Attributes<"div">;
|
|
35
37
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { Attributes, ClassName } from "@reshaped/headless";
|
|
2
2
|
export type BaseProps = {
|
|
3
3
|
/** Total number of pages available */
|
|
4
4
|
total: number;
|
|
@@ -15,9 +15,9 @@ export type BaseProps = {
|
|
|
15
15
|
/** aria-label attribute for the next page button */
|
|
16
16
|
nextAriaLabel: string;
|
|
17
17
|
/** Additional classname for the root element */
|
|
18
|
-
className?:
|
|
18
|
+
className?: ClassName;
|
|
19
19
|
/** Additional attributes for the root element */
|
|
20
|
-
attributes?:
|
|
20
|
+
attributes?: Attributes<"div">;
|
|
21
21
|
};
|
|
22
22
|
export type ControlledProps = BaseProps & {
|
|
23
23
|
/** Currently selected page number, starts with 1, enables controlled mode */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Attributes, ClassName } from "@reshaped/headless";
|
|
1
2
|
import type * as G from "../../types/global";
|
|
2
3
|
export type Size = "small" | "medium" | "large" | "xlarge";
|
|
3
4
|
type BaseProps = {
|
|
@@ -14,11 +15,11 @@ type BaseProps = {
|
|
|
14
15
|
/** Callback when the input value changes */
|
|
15
16
|
onChange?: G.ChangeHandler<string>;
|
|
16
17
|
/** Additional attributes for the input element */
|
|
17
|
-
inputAttributes?:
|
|
18
|
+
inputAttributes?: Attributes<"input">;
|
|
18
19
|
/** Additional classname for the root element */
|
|
19
|
-
className?:
|
|
20
|
+
className?: ClassName;
|
|
20
21
|
/** Additional attributes for the root element */
|
|
21
|
-
attributes?:
|
|
22
|
+
attributes?: Attributes<"div">;
|
|
22
23
|
};
|
|
23
24
|
export type ControlledProps = BaseProps & {
|
|
24
25
|
/** Value of the input element, enables controlled mode */
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useHotkeys } from "@reshaped/headless";
|
|
3
4
|
import React from "react";
|
|
4
5
|
import { useFormControl } from "../FormControl/index.js";
|
|
5
6
|
import Text from "../Text/index.js";
|
|
6
7
|
import View from "../View/index.js";
|
|
7
8
|
import * as keys from "../../constants/keys.js";
|
|
8
|
-
import useHotkeys from "../../hooks/useHotkeys.js";
|
|
9
9
|
import { onNextFrame } from "../../utilities/animation.js";
|
|
10
10
|
import { responsivePropDependency } from "../../utilities/props.js";
|
|
11
11
|
import { regExpNumericChar, regExpAlphabeticChar, regExpAlphaNumericChar, } from "./PinField.constants.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { classNames } from "@reshaped/
|
|
2
|
+
import { classNames } from "@reshaped/headless";
|
|
3
3
|
import Dismissible from "../Dismissible/index.js";
|
|
4
4
|
import Flyout, { useFlyoutContext } from "../Flyout/index.js";
|
|
5
5
|
import { resolveMixin } from "../../styles/mixin.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FlyoutProps, FlyoutInstance } from "../Flyout";
|
|
2
2
|
import type React from "react";
|
|
3
3
|
export type Instance = FlyoutInstance;
|
|
4
|
-
export type Props = Pick<FlyoutProps, "id" | "position" | "forcePosition" | "fallbackPositions" | "fallbackAdjustLayout" | "fallbackMinWidth" | "fallbackMinHeight" | "onOpen" | "onClose" | "width" | "trapFocusMode" | "active" | "defaultActive" | "contentGap" | "contentShift" | "contentMaxHeight" | "instanceRef" | "triggerType" | "disableHideAnimation" | "disableContentHover" | "disableCloseOnOutsideClick" | "autoFocus" | "containerRef" | "positionRef" | "initialFocusRef" | "originCoordinates"> & {
|
|
4
|
+
export type Props = Pick<FlyoutProps, "id" | "position" | "forcePosition" | "fallbackPositions" | "fallbackAdjustLayout" | "fallbackMinWidth" | "fallbackMinHeight" | "onOpen" | "onClose" | "width" | "trapFocusMode" | "active" | "defaultActive" | "contentGap" | "contentShift" | "contentMaxHeight" | "contentZIndex" | "instanceRef" | "triggerType" | "disableHideAnimation" | "disableContentHover" | "disableCloseOnOutsideClick" | "autoFocus" | "containerRef" | "positionRef" | "initialFocusRef" | "originCoordinates"> & {
|
|
5
5
|
/** Node for inserting children */
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
/** Content element padding, unit token multiplier */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { classNames } from "@reshaped/
|
|
2
|
+
import { classNames } from "@reshaped/headless";
|
|
3
3
|
import s from "./Progress.module.css";
|
|
4
4
|
const Progress = (props) => {
|
|
5
5
|
const { value = 0, min = 0, max = 100, color = "primary", size = "medium", duration, ariaLabel, className, attributes, } = props;
|