reshaped 3.9.1-canary.3 → 3.10.0-canary.10
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 +5 -12
- package/dist/bundle.js +2 -2
- package/dist/cli/theming/tailwind.js +1 -0
- 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 +2 -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 +2 -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 +2 -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 +3 -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 +2 -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 +2 -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 -6
- package/dist/components/Flyout/useFlyout.d.ts +2 -2
- package/dist/components/Flyout/useFlyout.js +5 -5
- package/dist/components/Flyout/utilities/safeArea.d.ts +2 -2
- package/dist/components/Flyout/utilities/safeArea.js +0 -14
- package/dist/components/Grid/Grid.js +2 -1
- package/dist/components/Grid/Grid.types.d.ts +5 -4
- package/dist/components/Hidden/Hidden.js +2 -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 +2 -1
- package/dist/components/Loader/Loader.types.d.ts +3 -2
- package/dist/components/MenuItem/MenuItem.js +2 -1
- package/dist/components/MenuItem/MenuItem.types.d.ts +3 -2
- package/dist/components/Modal/Modal.js +7 -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 +2 -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 +2 -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/Slider.utilities.d.ts +7 -0
- package/dist/components/Slider/Slider.utilities.js +11 -0
- package/dist/components/Slider/SliderControlled.js +15 -8
- package/dist/components/Slider/SliderThumb.js +1 -1
- package/dist/components/Stepper/Stepper.types.d.ts +5 -4
- package/dist/components/Switch/Switch.js +2 -1
- package/dist/components/Switch/Switch.types.d.ts +4 -3
- package/dist/components/Table/Table.js +2 -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 +2 -1
- package/dist/components/Text/Text.types.d.ts +3 -2
- package/dist/components/TextArea/TextArea.js +2 -1
- package/dist/components/TextArea/TextArea.types.d.ts +5 -4
- package/dist/components/TextField/TextField.js +2 -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 -2
- 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 +2 -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 +5 -12
- package/dist/index.js +3 -11
- 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/themes/figma/tailwind.css +1 -1
- package/dist/themes/fragments/twitter/tailwind.css +1 -1
- package/dist/themes/reshaped/tailwind.css +1 -1
- package/dist/themes/slate/tailwind.css +1 -1
- package/dist/types/global.d.ts +0 -15
- package/dist/utilities/helpers.d.ts +0 -1
- package/dist/utilities/helpers.js +0 -14
- package/dist/utilities/props.d.ts +2 -5
- package/dist/utilities/props.js +0 -18
- package/package.json +4 -4
- 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
- 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,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { classNames, useHotkeys, useRTL } from "@reshaped/headless";
|
|
3
4
|
import React from "react";
|
|
4
5
|
import { useFlyoutContext } from "../Flyout/index.js";
|
|
5
6
|
import Icon from "../Icon/index.js";
|
|
6
7
|
import MenuItem from "../MenuItem/index.js";
|
|
7
8
|
import Popover from "../Popover/index.js";
|
|
8
9
|
import * as keys from "../../constants/keys.js";
|
|
9
|
-
import useHotkeys from "../../hooks/useHotkeys.js";
|
|
10
|
-
import useRTL from "../../hooks/useRTL.js";
|
|
11
10
|
import IconChevronRight from "../../icons/ChevronRight.js";
|
|
12
|
-
import { classNames } from "../../utilities/props.js";
|
|
13
11
|
import s from "./DropdownMenu.module.css";
|
|
14
12
|
const DropdownMenuSubContext = React.createContext(null);
|
|
15
13
|
const DropdownMenuSubTriggerContext = React.createContext(false);
|
|
@@ -3,7 +3,7 @@ import type { MenuItemProps } from "../MenuItem";
|
|
|
3
3
|
import type { PopoverProps, PopoverInstance } from "../Popover";
|
|
4
4
|
import type React from "react";
|
|
5
5
|
export type Instance = PopoverInstance;
|
|
6
|
-
export type Props = Pick<PopoverProps, "children" | "position" | "forcePosition" | "fallbackPositions" | "fallbackAdjustLayout" | "fallbackMinWidth" | "fallbackMinHeight" | "triggerType" | "contentGap" | "contentShift" | "contentMaxHeight" | "onOpen" | "onClose" | "active" | "defaultActive" | "width" | "disableHideAnimation" | "disableCloseOnOutsideClick" | "instanceRef" | "containerRef" | "positionRef" | "originCoordinates" | "borderRadius" | "elevation" | "initialFocusRef"> & {
|
|
6
|
+
export type Props = Pick<PopoverProps, "children" | "position" | "forcePosition" | "fallbackPositions" | "fallbackAdjustLayout" | "fallbackMinWidth" | "fallbackMinHeight" | "triggerType" | "contentGap" | "contentShift" | "contentMaxHeight" | "contentZIndex" | "onOpen" | "onClose" | "active" | "defaultActive" | "width" | "disableHideAnimation" | "disableCloseOnOutsideClick" | "instanceRef" | "containerRef" | "positionRef" | "originCoordinates" | "borderRadius" | "elevation" | "initialFocusRef"> & {
|
|
7
7
|
/** Change component trap focus keyboard behavior and shortcuts */
|
|
8
8
|
trapFocusMode?: Extract<PopoverProps["trapFocusMode"], "action-menu" | "selection-menu"> | false;
|
|
9
9
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { classNames, useToggle } from "@reshaped/headless";
|
|
3
4
|
import HiddenVisually from "../HiddenVisually/index.js";
|
|
4
5
|
import View from "../View/index.js";
|
|
5
|
-
import useToggle from "../../hooks/useToggle.js";
|
|
6
|
-
import { classNames } from "../../utilities/props.js";
|
|
7
6
|
import s from "./FileUpload.module.css";
|
|
8
7
|
export const FileUploadTrigger = (props) => {
|
|
9
8
|
const { children } = props;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Attributes, ClassName } from "@reshaped/headless";
|
|
1
2
|
import type { ViewProps } from "../View";
|
|
2
3
|
import type React from "react";
|
|
3
4
|
import type * as G from "../../types/global";
|
|
@@ -19,11 +20,11 @@ export type Props = {
|
|
|
19
20
|
/** Change component to render inline making it more compact */
|
|
20
21
|
inline?: boolean;
|
|
21
22
|
/** Additional classname for the root element */
|
|
22
|
-
className?:
|
|
23
|
+
className?: ClassName;
|
|
23
24
|
/** Additional attributes for the root element */
|
|
24
|
-
attributes?:
|
|
25
|
+
attributes?: Attributes<"div">;
|
|
25
26
|
/** Additional attributes for the input element */
|
|
26
|
-
inputAttributes?:
|
|
27
|
+
inputAttributes?: Attributes<"input">;
|
|
27
28
|
};
|
|
28
29
|
export type TriggerProps = {
|
|
29
30
|
/** Node for inserting children */
|
|
@@ -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 { TrapMode } from "
|
|
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, useIsomorphicLayoutEffect } from "@reshaped/headless";
|
|
3
4
|
import React from "react";
|
|
4
5
|
import Portal from "../_private/Portal/index.js";
|
|
5
|
-
import useIsomorphicLayoutEffect from "../../hooks/useIsomorphicLayoutEffect.js";
|
|
6
|
-
import { classNames } from "../../utilities/props.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,14 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { TrapFocus, useHotkeys, useIsomorphicLayoutEffect, useHandlerRef, useOnClickOutside, } from "@reshaped/headless";
|
|
4
|
+
import { checkKeyboardMode, } from "@reshaped/headless/internal";
|
|
3
5
|
import React from "react";
|
|
4
6
|
import useIsDismissible from "../../hooks/_private/useIsDismissible.js";
|
|
5
7
|
import usePrevious from "../../hooks/_private/usePrevious.js";
|
|
6
8
|
import useElementId from "../../hooks/useElementId.js";
|
|
7
|
-
import useHandlerRef from "../../hooks/useHandlerRef.js";
|
|
8
|
-
import useHotkeys from "../../hooks/useHotkeys.js";
|
|
9
|
-
import useIsomorphicLayoutEffect from "../../hooks/useIsomorphicLayoutEffect.js";
|
|
10
|
-
import useOnClickOutside from "../../hooks/useOnClickOutside.js";
|
|
11
|
-
import { TrapFocus, checkKeyboardMode } from "../../utilities/a11y/index.js";
|
|
12
9
|
import { checkTransitions } from "../../utilities/animation.js";
|
|
13
10
|
import * as timeouts from "./Flyout.constants.js";
|
|
14
11
|
import { Provider, useFlyoutTriggerContext, useFlyoutContext, useFlyoutContentContext, } from "./Flyout.context.js";
|
|
@@ -16,7 +13,7 @@ import useFlyout from "./useFlyout.js";
|
|
|
16
13
|
import cooldown from "./utilities/cooldown.js";
|
|
17
14
|
import { createSafeArea } from "./utilities/safeArea.js";
|
|
18
15
|
const FlyoutControlled = (props) => {
|
|
19
|
-
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;
|
|
20
17
|
const fallbackPositions = props.fallbackPositions === false || forcePosition ? [] : props.fallbackPositions;
|
|
21
18
|
const onOpenRef = useHandlerRef(onOpen);
|
|
22
19
|
const onCloseRef = useHandlerRef(onClose);
|
|
@@ -349,6 +346,7 @@ const FlyoutControlled = (props) => {
|
|
|
349
346
|
handleContentMouseUp,
|
|
350
347
|
triggerType,
|
|
351
348
|
trapFocusMode,
|
|
349
|
+
contentZIndex,
|
|
352
350
|
contentClassName,
|
|
353
351
|
contentAttributes,
|
|
354
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;
|
|
@@ -38,7 +38,7 @@ const useFlyout = (args) => {
|
|
|
38
38
|
fallbackMinHeight,
|
|
39
39
|
contentGap: (contentGap ?? 0) * unitModifier,
|
|
40
40
|
contentShift: (contentShift ?? 0) * unitModifier,
|
|
41
|
-
|
|
41
|
+
onDeactivate: handleClose,
|
|
42
42
|
};
|
|
43
43
|
}, [
|
|
44
44
|
cachedFallbackPositions,
|
|
@@ -60,14 +60,14 @@ const useFlyout = (args) => {
|
|
|
60
60
|
if (!flyoutOptions)
|
|
61
61
|
return;
|
|
62
62
|
flyoutRef.current = new Flyout(flyoutOptions);
|
|
63
|
-
const result = flyoutRef.current.
|
|
63
|
+
const result = flyoutRef.current.activate();
|
|
64
64
|
setPosition(result.position);
|
|
65
65
|
setStatus("visible");
|
|
66
66
|
}, [getFlyoutOptions]);
|
|
67
67
|
const remove = useCallback(() => {
|
|
68
68
|
if (!flyoutRef.current)
|
|
69
69
|
return;
|
|
70
|
-
flyoutRef.current.
|
|
70
|
+
flyoutRef.current.deactivate();
|
|
71
71
|
setStatus("idle");
|
|
72
72
|
}, []);
|
|
73
73
|
const updatePosition = useCallback(() => {
|
|
@@ -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 {};
|
|
@@ -49,21 +49,7 @@ export function createSafeArea(options) {
|
|
|
49
49
|
}
|
|
50
50
|
const contentRect = contentRef.current.getBoundingClientRect();
|
|
51
51
|
const [corner1, corner2] = getContentCorners(contentRect, position);
|
|
52
|
-
// Add buffer to origin based on position to extend safe area
|
|
53
|
-
const buffer = 10;
|
|
54
52
|
const origin = { x: passedOrigin.x, y: passedOrigin.y };
|
|
55
|
-
if (position?.startsWith("bottom")) {
|
|
56
|
-
origin.y -= buffer;
|
|
57
|
-
}
|
|
58
|
-
else if (position?.startsWith("top")) {
|
|
59
|
-
origin.y += buffer;
|
|
60
|
-
}
|
|
61
|
-
else if (position?.startsWith("start")) {
|
|
62
|
-
origin.x += buffer;
|
|
63
|
-
}
|
|
64
|
-
else if (position?.startsWith("end")) {
|
|
65
|
-
origin.x -= buffer;
|
|
66
|
-
}
|
|
67
53
|
const triangle = [origin, corner1, corner2];
|
|
68
54
|
let timeoutId = null;
|
|
69
55
|
const cleanup = () => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { classNames } from "@reshaped/headless";
|
|
2
3
|
import { resolveMixin } from "../../styles/mixin.js";
|
|
3
|
-
import {
|
|
4
|
+
import { responsiveVariables, responsivePropDependency } from "../../utilities/props.js";
|
|
4
5
|
import s from "./Grid.module.css";
|
|
5
6
|
export const GridItem = (props) => {
|
|
6
7
|
const { area, colStart, colEnd, colSpan, rowStart, rowEnd, rowSpan, children, className,
|
|
@@ -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,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { classNames
|
|
2
|
+
import { classNames } from "@reshaped/headless";
|
|
3
|
+
import { responsiveClassNames } from "../../utilities/props.js";
|
|
3
4
|
import s from "./Hidden.module.css";
|
|
4
5
|
const Hidden = (props) => {
|
|
5
6
|
const { as: TagName = "div", children, visibility, hide } = props;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { classNames } from "@reshaped/headless";
|
|
2
3
|
import { useCheckboxGroup } from "../CheckboxGroup/index.js";
|
|
3
4
|
import { useFormControl } from "../FormControl/index.js";
|
|
4
5
|
import { useRadioGroup } from "../RadioGroup/index.js";
|
|
5
|
-
import { classNames } from "../../utilities/props.js";
|
|
6
6
|
import s from "./HiddenInput.module.css";
|
|
7
7
|
const HiddenInput = (props) => {
|
|
8
8
|
const { type, value, className, onBlur, onFocus, onChange, attributes } = props;
|
|
@@ -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,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { classNames } from "@reshaped/headless";
|
|
2
3
|
import Text from "../Text/index.js";
|
|
3
|
-
import { classNames } from "../../utilities/props.js";
|
|
4
4
|
import s from "./Hotkey.module.css";
|
|
5
5
|
const Hotkey = (props) => {
|
|
6
6
|
const { children, active, className, attributes } = props;
|
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { classNames } from "@reshaped/headless";
|
|
2
3
|
import React from "react";
|
|
3
4
|
import { resolveMixin } from "../../styles/mixin.js";
|
|
4
|
-
import { classNames } from "../../utilities/props.js";
|
|
5
5
|
import s from "./Icon.module.css";
|
|
6
6
|
const Icon = (props) => {
|
|
7
7
|
const { svg: Component, className, color, size = "1em", autoWidth, attributes } = props;
|
|
@@ -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,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { classNames } from "@reshaped/headless";
|
|
3
4
|
import React from "react";
|
|
4
5
|
import { resolveMixin } from "../../styles/mixin.js";
|
|
5
|
-
import { classNames } from "../../utilities/props.js";
|
|
6
6
|
import s from "./Image.module.css";
|
|
7
7
|
const Image = (props) => {
|
|
8
8
|
const { src, alt, width, maxWidth, height, aspectRatio, onLoad, onError, fallback, outline, displayMode = "cover", borderRadius, className, attributes, imageAttributes: passedImageAttributes, renderImage, } = props;
|
|
@@ -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,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { classNames } from "@reshaped/headless";
|
|
2
3
|
import { forwardRef } from "react";
|
|
3
4
|
import Actionable from "../Actionable/index.js";
|
|
4
5
|
import Icon from "../Icon/index.js";
|
|
5
|
-
import { classNames } from "../../utilities/props.js";
|
|
6
6
|
import s from "./Link.module.css";
|
|
7
7
|
const Link = forwardRef((props, ref) => {
|
|
8
8
|
const { icon, disabled, href, color = "primary", variant = "underline", className, children, attributes, type, onClick, stopPropagation, render, } = props;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { classNames
|
|
2
|
+
import { classNames } from "@reshaped/headless";
|
|
3
|
+
import { responsiveClassNames } from "../../utilities/props.js";
|
|
3
4
|
import s from "./Loader.module.css";
|
|
4
5
|
const Loader = (props) => {
|
|
5
6
|
const { size = "small", color = "primary", className, attributes } = 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,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { classNames } from "@reshaped/headless";
|
|
2
3
|
import { forwardRef } from "react";
|
|
3
4
|
import Actionable from "../Actionable/index.js";
|
|
4
5
|
import Icon from "../Icon/index.js";
|
|
5
6
|
import View from "../View/index.js";
|
|
6
|
-
import {
|
|
7
|
+
import { responsiveClassNames, responsivePropDependency } from "../../utilities/props.js";
|
|
7
8
|
import s from "./MenuItem.module.css";
|
|
8
9
|
const MenuItem = forwardRef((props, ref) => {
|
|
9
10
|
const { icon, startSlot, endSlot, children, color = "primary", selected, highlighted, disabled, onClick, href, size = "medium", roundedCorners, stopPropagation, as, render, className, attributes, } = props;
|
|
@@ -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,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { classNames, useHandlerRef } from "@reshaped/headless";
|
|
4
|
+
import { enableScroll, disableScroll } from "@reshaped/headless/internal";
|
|
3
5
|
import React from "react";
|
|
4
6
|
import Overlay from "../Overlay/index.js";
|
|
5
7
|
import Text from "../Text/index.js";
|
|
6
8
|
import useElementId from "../../hooks/useElementId.js";
|
|
7
|
-
import useHandlerRef from "../../hooks/useHandlerRef.js";
|
|
8
9
|
import useResponsiveClientValue from "../../hooks/useResponsiveClientValue.js";
|
|
9
10
|
import { resolveMixin } from "../../styles/mixin.js";
|
|
10
|
-
import {
|
|
11
|
-
import { enableScroll, disableScroll } from "../../utilities/scroll/index.js";
|
|
11
|
+
import { responsiveVariables, responsiveClassNames } from "../../utilities/props.js";
|
|
12
12
|
import s from "./Modal.module.css";
|
|
13
13
|
const DRAG_THRESHOLD = 32;
|
|
14
14
|
const DRAG_OPPOSITE_THRESHOLD = 100;
|
|
@@ -40,7 +40,7 @@ export const ModalSubtitle = (props) => {
|
|
|
40
40
|
return (_jsx(Text, { variant: "body-3", color: "neutral-faded", attributes: { id: `${id}-subtitle` }, children: children }));
|
|
41
41
|
};
|
|
42
42
|
const Modal = (props) => {
|
|
43
|
-
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;
|
|
44
44
|
const onCloseRef = useHandlerRef(onClose);
|
|
45
45
|
const id = useElementId();
|
|
46
46
|
const clientPosition = useResponsiveClientValue(position);
|
|
@@ -56,6 +56,7 @@ const Modal = (props) => {
|
|
|
56
56
|
const [dragDistance, setDragDistance] = React.useState(0);
|
|
57
57
|
const [hideProgress, setHideProgress] = React.useState(0);
|
|
58
58
|
const mixinStyles = resolveMixin({ padding });
|
|
59
|
+
const shouldBeContained = containerRef && contained !== false;
|
|
59
60
|
const value = React.useMemo(() => ({
|
|
60
61
|
titleMounted,
|
|
61
62
|
setTitleMounted,
|
|
@@ -165,10 +166,10 @@ const Modal = (props) => {
|
|
|
165
166
|
setHideProgress(progress / 2);
|
|
166
167
|
dragDistanceRef.current = dragDistance;
|
|
167
168
|
}, [dragDistance, clientPosition, rootRef]);
|
|
168
|
-
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: {
|
|
169
170
|
onTouchStart: handleDragStart,
|
|
170
171
|
}, children: ({ active }) => {
|
|
171
|
-
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);
|
|
172
173
|
return (_jsx(Context.Provider, { value: value, children: _jsx("div", { ...attributes, style: {
|
|
173
174
|
...mixinStyles.variables,
|
|
174
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";
|