reshaped 3.2.7 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/dist/bundle.css +1 -1
- package/dist/bundle.d.ts +2 -0
- package/dist/bundle.js +11 -11
- package/dist/cjs/themes/_generator/definitions/figma.js +1 -0
- package/dist/cjs/themes/_generator/definitions/reshaped.js +5 -4
- package/dist/cjs/themes/_generator/tokens/duration/duration.types.d.ts +1 -1
- package/dist/cjs/themes/_generator/transform.js +17 -7
- package/dist/cjs/themes/_generator/utilities/generateColors.js +6 -6
- package/dist/cjs/themes/_generator/utilities/resolveTokenReference.js +1 -1
- package/dist/cjs/themes/figma/theme.css +1 -1
- package/dist/cjs/themes/reshaped/theme.css +1 -1
- package/dist/cjs/themes/slate/theme.css +1 -1
- package/dist/components/Alert/tests/Alert.stories.d.ts +5 -4
- package/dist/components/Alert/tests/Alert.stories.js +3 -2
- package/dist/components/Autocomplete/Autocomplete.js +3 -3
- package/dist/components/Autocomplete/Autocomplete.types.d.ts +8 -9
- package/dist/components/Badge/Badge.module.css +1 -1
- package/dist/components/Button/Button.module.css +1 -1
- package/dist/components/Card/Card.js +1 -1
- package/dist/components/ContextMenu/ContextMenu.d.ts +10 -0
- package/dist/components/ContextMenu/ContextMenu.js +37 -0
- package/dist/components/ContextMenu/ContextMenu.module.css +1 -0
- package/dist/components/ContextMenu/ContextMenu.types.d.ts +2 -0
- package/dist/components/ContextMenu/ContextMenu.types.js +1 -0
- package/dist/components/ContextMenu/index.d.ts +2 -0
- package/dist/components/ContextMenu/index.js +1 -0
- package/dist/components/ContextMenu/tests/ContextMenu.stories.d.ts +18 -0
- package/dist/components/ContextMenu/tests/ContextMenu.stories.js +27 -0
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +1 -2
- package/dist/components/DropdownMenu/DropdownMenu.js +2 -2
- package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +4 -4
- package/dist/components/DropdownMenu/tests/DropdownMenu.stories.d.ts +1 -1
- package/dist/components/DropdownMenu/tests/DropdownMenu.stories.js +8 -0
- package/dist/components/FormControl/FormControl.context.d.ts +86 -86
- package/dist/components/Grid/Grid.js +5 -1
- package/dist/components/Hotkey/Hotkey.module.css +1 -1
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/Modal/Modal.module.css +1 -1
- package/dist/components/Popover/Popover.js +1 -1
- package/dist/components/Popover/Popover.types.d.ts +1 -1
- package/dist/components/Resizable/Resizable.js +2 -2
- package/dist/components/Resizable/Resizable.module.css +1 -1
- package/dist/components/Resizable/Resizable.types.d.ts +3 -1
- package/dist/components/Resizable/tests/Resizable.stories.js +34 -1
- package/dist/components/ScrollArea/ScrollArea.js +9 -9
- package/dist/components/ScrollArea/ScrollArea.module.css +1 -1
- package/dist/components/ScrollArea/ScrollArea.types.d.ts +1 -4
- package/dist/components/ScrollArea/tests/ScrollArea.stories.d.ts +6 -4
- package/dist/components/ScrollArea/tests/ScrollArea.stories.js +28 -2
- package/dist/components/Table/Table.module.css +1 -1
- package/dist/components/Tabs/Tabs.module.css +1 -1
- package/dist/components/Tabs/Tabs.types.d.ts +2 -0
- package/dist/components/Tabs/TabsContext.d.ts +2 -2
- package/dist/components/Tabs/TabsPanel.js +3 -3
- package/dist/components/Text/Text.js +2 -1
- package/dist/components/TextField/TextField.js +4 -4
- package/dist/components/TextField/TextField.module.css +1 -1
- package/dist/components/TextField/TextField.types.d.ts +1 -0
- package/dist/components/Toast/Toast.js +3 -2
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.js +4 -4
- package/dist/components/Tooltip/Tooltip.types.d.ts +1 -1
- package/dist/components/Tooltip/tests/Tooltip.stories.d.ts +1 -1
- package/dist/components/View/View.js +8 -3
- package/dist/components/View/View.module.css +1 -1
- package/dist/components/View/View.types.d.ts +5 -5
- package/dist/components/View/tests/View.stories.js +6 -0
- package/dist/components/_private/Flyout/Flyout.module.css +1 -1
- package/dist/components/_private/Flyout/Flyout.types.d.ts +2 -1
- package/dist/components/_private/Flyout/FlyoutContent.js +6 -4
- package/dist/components/_private/Flyout/FlyoutControlled.js +12 -9
- package/dist/components/_private/Flyout/tests/Flyout.stories.d.ts +1 -0
- package/dist/components/_private/Flyout/tests/Flyout.stories.js +16 -1
- package/dist/components/_private/Flyout/useFlyout.d.ts +6 -11
- package/dist/components/_private/Flyout/useFlyout.js +19 -30
- package/dist/components/_private/Flyout/utilities/isFullyVisible.d.ts +6 -0
- package/dist/components/_private/Flyout/utilities/isFullyVisible.js +16 -0
- package/dist/components/_private/Portal/Portal.js +5 -2
- package/dist/hooks/_private/useOnClickOutside.d.ts +1 -1
- package/dist/hooks/_private/useOnClickOutside.js +8 -5
- package/dist/hooks/_private/useSingletonKeyboardMode.js +4 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/styles/align/align.css +1 -0
- package/dist/styles/align/index.d.ts +2 -1
- package/dist/styles/align/index.js +3 -3
- package/dist/styles/aspectRatio/aspectRatio.css +1 -0
- package/dist/styles/aspectRatio/index.d.ts +2 -1
- package/dist/styles/aspectRatio/index.js +2 -2
- package/dist/styles/bleed/bleed.module.css +1 -1
- package/dist/styles/bleed/index.js +2 -5
- package/dist/styles/height/height.module.css +1 -1
- package/dist/styles/height/index.js +2 -2
- package/dist/styles/inset/index.d.ts +2 -1
- package/dist/styles/inset/index.js +4 -7
- package/dist/styles/inset/inset.css +1 -0
- package/dist/styles/justify/index.d.ts +2 -1
- package/dist/styles/justify/index.js +3 -3
- package/dist/styles/justify/justify.css +1 -0
- package/dist/styles/maxHeight/index.js +2 -2
- package/dist/styles/maxHeight/maxHeight.module.css +1 -1
- package/dist/styles/maxWidth/index.js +2 -2
- package/dist/styles/maxWidth/maxWidth.module.css +1 -1
- package/dist/styles/minHeight/index.js +2 -2
- package/dist/styles/minHeight/minHeight.module.css +1 -1
- package/dist/styles/minWidth/index.js +2 -2
- package/dist/styles/minWidth/minWidth.module.css +1 -1
- package/dist/styles/padding/index.d.ts +2 -1
- package/dist/styles/padding/index.js +2 -2
- package/dist/styles/padding/padding.css +1 -0
- package/dist/styles/position/index.d.ts +2 -1
- package/dist/styles/position/index.js +4 -4
- package/dist/styles/position/position.css +1 -0
- package/dist/styles/textAlign/index.d.ts +2 -1
- package/dist/styles/textAlign/index.js +3 -3
- package/dist/styles/textAlign/textAlign.css +1 -0
- package/dist/styles/types.d.ts +5 -0
- package/dist/styles/width/index.js +2 -2
- package/dist/styles/width/width.module.css +1 -1
- package/dist/themes/_generator/definitions/figma.js +1 -0
- package/dist/themes/_generator/definitions/reshaped.js +5 -4
- package/dist/themes/_generator/tests/themes.stories.d.ts +4 -3
- package/dist/themes/_generator/tests/themes.stories.js +3 -2
- package/dist/themes/_generator/tokens/duration/duration.types.d.ts +1 -1
- package/dist/themes/_generator/utilities/generateColors.js +6 -6
- package/dist/themes/_generator/utilities/resolveTokenReference.js +1 -1
- package/dist/themes/figma/theme.css +1 -1
- package/dist/themes/reshaped/theme.css +1 -1
- package/dist/themes/slate/theme.css +1 -1
- package/dist/types/global.d.ts +4 -0
- package/dist/utilities/a11y/TrapFocus.js +1 -0
- package/dist/utilities/a11y/focus.d.ts +1 -1
- package/dist/utilities/a11y/focus.js +4 -1
- package/dist/utilities/a11y/tests/TrapFocus.stories.d.ts +6 -0
- package/dist/utilities/a11y/tests/TrapFocus.stories.js +59 -0
- package/dist/utilities/dom/find.d.ts +9 -0
- package/dist/utilities/dom/find.js +26 -0
- package/dist/utilities/dom/flyout.d.ts +2 -1
- package/dist/utilities/dom/flyout.js +13 -18
- package/dist/utilities/dom/index.d.ts +2 -2
- package/dist/utilities/dom/index.js +2 -2
- package/dist/utilities/scroll/lock.js +6 -2
- package/package.json +32 -32
- package/dist/styles/align/align.module.css +0 -1
- package/dist/styles/aspectRatio/aspectRatio.module.css +0 -1
- package/dist/styles/inset/inset.module.css +0 -1
- package/dist/styles/justify/justify.module.css +0 -1
- package/dist/styles/padding/padding.module.css +0 -1
- package/dist/styles/position/position.module.css +0 -1
- package/dist/styles/textAlign/textAlign.module.css +0 -1
@@ -15,7 +15,7 @@ import cooldown from "./utilities/cooldown.js";
|
|
15
15
|
import { Provider, useFlyoutTriggerContext, useFlyoutContext, useFlyoutContentContext, } from "./Flyout.context.js";
|
16
16
|
import useHandlerRef from "../../../hooks/useHandlerRef.js";
|
17
17
|
const FlyoutRoot = (props) => {
|
18
|
-
const { triggerType = "click", groupTimeouts, onOpen, onClose, children, disabled, forcePosition, trapFocusMode, width, disableHideAnimation, disableContentHover, disableCloseOnOutsideClick, contentGap = 2, contentShift, contentClassName, contentAttributes, position: passedPosition, active: passedActive, id: passedId, instanceRef, containerRef, initialFocusRef, } = props;
|
18
|
+
const { triggerType = "click", groupTimeouts, onOpen, onClose, children, disabled, forcePosition, trapFocusMode, width, disableHideAnimation, disableContentHover, disableCloseOnOutsideClick, originCoordinates, contentGap = 2, contentShift, contentClassName, contentAttributes, position: passedPosition, active: passedActive, id: passedId, instanceRef, containerRef, initialFocusRef, } = props;
|
19
19
|
const fallbackPositions = props.fallbackPositions === false || forcePosition ? [] : props.fallbackPositions;
|
20
20
|
const onOpenRef = useHandlerRef(onOpen);
|
21
21
|
const onCloseRef = useHandlerRef(onClose);
|
@@ -33,7 +33,7 @@ const FlyoutRoot = (props) => {
|
|
33
33
|
*/
|
34
34
|
const triggerElRef = (!parentFlyoutContentContext && parentFlyoutTriggerContext?.triggerElRef) ||
|
35
35
|
internalTriggerElRef;
|
36
|
-
const triggerBoundsRef = React.useRef(
|
36
|
+
const triggerBoundsRef = React.useRef();
|
37
37
|
const flyoutElRef = React.useRef(null);
|
38
38
|
const id = useElementId(passedId);
|
39
39
|
const timerRef = React.useRef();
|
@@ -44,7 +44,7 @@ const FlyoutRoot = (props) => {
|
|
44
44
|
const transitionStartedRef = React.useRef(false);
|
45
45
|
// Lock blur event while pressing anywhere inside the flyout content
|
46
46
|
const lockedBlurEffects = React.useRef(false);
|
47
|
-
// Focus shouldn't
|
47
|
+
// Focus shouldn't return back to the trigger when user intentionally clicks outside the flyout
|
48
48
|
const shouldReturnFocusRef = React.useRef(true);
|
49
49
|
// Touch devices trigger onMouseEnter but we don't need to apply regular hover timeouts
|
50
50
|
// So we're saving a flag on touch start and then change the mouse enter behavior
|
@@ -52,7 +52,7 @@ const FlyoutRoot = (props) => {
|
|
52
52
|
const flyout = useFlyout({
|
53
53
|
triggerElRef,
|
54
54
|
flyoutElRef,
|
55
|
-
triggerBoundsRef,
|
55
|
+
triggerBounds: originCoordinates ?? triggerBoundsRef.current,
|
56
56
|
width,
|
57
57
|
position: passedPosition,
|
58
58
|
defaultActive: resolvedActive,
|
@@ -74,11 +74,12 @@ const FlyoutRoot = (props) => {
|
|
74
74
|
* Called from the internal actions
|
75
75
|
*/
|
76
76
|
const handleOpen = React.useCallback(() => {
|
77
|
-
|
78
|
-
|
77
|
+
if (lockedRef.current)
|
78
|
+
return;
|
79
|
+
if (isRendered && triggerType !== "hover")
|
79
80
|
return;
|
80
81
|
onOpenRef.current?.();
|
81
|
-
}, [isRendered,
|
82
|
+
}, [onOpenRef, isRendered, triggerType]);
|
82
83
|
const handleClose = React.useCallback((options) => {
|
83
84
|
const isLocked = triggerType === "click" && !isDismissible();
|
84
85
|
const canClose = !isLocked && (isRendered || disabled);
|
@@ -164,7 +165,7 @@ const FlyoutRoot = (props) => {
|
|
164
165
|
* After animation has started, we're sure about the correct bounds
|
165
166
|
* so drop the cache to make flyout work when trigger moves around
|
166
167
|
*/
|
167
|
-
triggerBoundsRef.current =
|
168
|
+
triggerBoundsRef.current = undefined;
|
168
169
|
}, [resolvedActive]);
|
169
170
|
const handleTransitionEnd = React.useCallback((e) => {
|
170
171
|
if (flyoutElRef.current !== e.currentTarget || e.propertyName !== "transform")
|
@@ -277,12 +278,14 @@ const FlyoutRoot = (props) => {
|
|
277
278
|
}), [handleOpen, handleClose, updatePosition]);
|
278
279
|
useHotkeys({ Escape: () => handleClose() }, [handleClose]);
|
279
280
|
useOnClickOutside([flyoutElRef, triggerElRef], () => {
|
281
|
+
if (!isRendered)
|
282
|
+
return;
|
280
283
|
if (disableCloseOnOutsideClick)
|
281
284
|
return;
|
282
285
|
// Clicking outside changes focused element so we don't need to set it back ourselves
|
283
286
|
shouldReturnFocusRef.current = false;
|
284
287
|
handleClose();
|
285
|
-
});
|
288
|
+
}, [isRendered]);
|
286
289
|
return (_jsx(Provider, { value: {
|
287
290
|
id,
|
288
291
|
flyout,
|
@@ -5,6 +5,7 @@ declare const _default: {
|
|
5
5
|
export default _default;
|
6
6
|
export declare const position: () => React.JSX.Element;
|
7
7
|
export declare const dynamicPosition: () => React.JSX.Element;
|
8
|
+
export declare const originCoordinates: () => React.JSX.Element;
|
8
9
|
export declare const modes: () => React.JSX.Element;
|
9
10
|
export declare const width: () => React.JSX.Element;
|
10
11
|
export declare const offset: () => React.JSX.Element;
|
@@ -51,6 +51,21 @@ export const position = () => (<div style={{ paddingTop: 200 }}>
|
|
51
51
|
export const dynamicPosition = () => (<div style={{ position: "absolute", top: 0, left: "50%" }}>
|
52
52
|
<Demo position="top"/>
|
53
53
|
</div>);
|
54
|
+
export const originCoordinates = () => {
|
55
|
+
const [coordinates, setCoordinates] = React.useState(null);
|
56
|
+
return (<Example>
|
57
|
+
<Example.Item>
|
58
|
+
<View height={25} width={25} attributes={{
|
59
|
+
onContextMenu: (e) => {
|
60
|
+
e.preventDefault();
|
61
|
+
setCoordinates({ x: e.clientX, y: e.clientY });
|
62
|
+
},
|
63
|
+
}} backgroundColor="neutral-faded" borderRadius="medium"/>
|
64
|
+
<br /> <br />
|
65
|
+
<Demo position="top" originCoordinates={coordinates} active={!!coordinates} onClose={() => setCoordinates(null)}/>
|
66
|
+
</Example.Item>
|
67
|
+
</Example>);
|
68
|
+
};
|
54
69
|
export const modes = () => (<Example>
|
55
70
|
<Example.Item title="dialog click">
|
56
71
|
<Demo position="bottom-start" trapFocusMode="dialog">
|
@@ -187,7 +202,7 @@ export const customPortalTarget = () => {
|
|
187
202
|
return (<Example>
|
188
203
|
<Example.Item title="Custom containerRef">
|
189
204
|
<View padding={4} paddingInline={40} height={50} overflow="auto" backgroundColor="neutral-faded" borderRadius="small" attributes={{ ref: portalRef }}>
|
190
|
-
<Flyout position="bottom-end"
|
205
|
+
<Flyout position="bottom-end" active>
|
191
206
|
<Flyout.Trigger>{(attributes) => <button {...attributes}>Open</button>}</Flyout.Trigger>
|
192
207
|
<Flyout.Content>
|
193
208
|
<div style={{
|
@@ -1,22 +1,17 @@
|
|
1
1
|
import React from "react";
|
2
|
+
import type * as G from "../../../types/global";
|
2
3
|
import type * as T from "./Flyout.types";
|
3
|
-
|
4
|
-
* Typings
|
5
|
-
*/
|
6
|
-
type ElementRef = React.RefObject<HTMLElement>;
|
7
|
-
type PassedFlyoutOptions = {
|
4
|
+
type UseFlyout = (args: {
|
8
5
|
width?: T.Width;
|
9
6
|
position?: T.Position;
|
10
7
|
defaultActive?: boolean;
|
11
8
|
fallbackPositions?: T.Position[];
|
12
|
-
container?: HTMLElement | null;
|
13
|
-
};
|
14
|
-
type UseFlyout = (args: PassedFlyoutOptions & {
|
15
|
-
triggerElRef: ElementRef;
|
16
|
-
flyoutElRef: ElementRef;
|
17
|
-
triggerBoundsRef: React.RefObject<DOMRect | undefined>;
|
18
9
|
contentGap?: number;
|
19
10
|
contentShift?: number;
|
11
|
+
container?: HTMLElement | null;
|
12
|
+
triggerElRef: React.RefObject<HTMLElement>;
|
13
|
+
flyoutElRef: React.RefObject<HTMLElement>;
|
14
|
+
triggerBounds?: DOMRect | G.Coordinates;
|
20
15
|
}) => Pick<T.State, "styles" | "position" | "status"> & {
|
21
16
|
updatePosition: (options?: {
|
22
17
|
sync?: boolean;
|
@@ -1,23 +1,9 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import useRTL from "../../../hooks/useRTL.js";
|
3
|
-
import {
|
3
|
+
import { findClosestRenderContainer, getShadowRoot, getRectFromCoordinates } from "../../../utilities/dom/index.js";
|
4
4
|
import calculatePosition from "./utilities/calculatePosition.js";
|
5
5
|
import getPositionFallbacks from "./utilities/getPositionFallbacks.js";
|
6
|
-
|
7
|
-
* Check if element visually fits on the screen
|
8
|
-
*/
|
9
|
-
const fullyVisible = (args) => {
|
10
|
-
const { styles, scopeOffset } = args;
|
11
|
-
const htmlEl = document.documentElement;
|
12
|
-
const pageLeft = htmlEl.scrollLeft;
|
13
|
-
const pageRight = pageLeft + htmlEl.clientWidth;
|
14
|
-
const pageTop = htmlEl.scrollTop;
|
15
|
-
const pageBottom = pageTop + htmlEl.clientHeight;
|
16
|
-
return (styles.left + scopeOffset.left >= pageLeft &&
|
17
|
-
styles.left + styles.width + scopeOffset.left <= pageRight &&
|
18
|
-
styles.top + scopeOffset.top >= pageTop &&
|
19
|
-
styles.top + styles.height + scopeOffset.top <= pageBottom);
|
20
|
-
};
|
6
|
+
import isFullyVisible from "./utilities/isFullyVisible.js";
|
21
7
|
/**
|
22
8
|
* Order of keys here is responsible for the order of styles applied
|
23
9
|
*/
|
@@ -33,7 +19,6 @@ const resetStyles = {
|
|
33
19
|
left: 0,
|
34
20
|
top: 0,
|
35
21
|
position: "fixed",
|
36
|
-
// opacity: 0,
|
37
22
|
visibility: "hidden",
|
38
23
|
animation: "none",
|
39
24
|
transition: "none",
|
@@ -46,9 +31,12 @@ const flyout = (args) => {
|
|
46
31
|
const { triggerEl, flyoutEl, triggerBounds: passedTriggerBounds, contentShift = 0, contentGap = 0, ...options } = args;
|
47
32
|
const { position, fallbackPositions, width, container, lastUsedFallback, onFallback } = options;
|
48
33
|
const targetClone = flyoutEl.cloneNode(true);
|
49
|
-
const triggerBounds = passedTriggerBounds || triggerEl.getBoundingClientRect();
|
50
34
|
const baseUnit = getComputedStyle(flyoutEl).getPropertyValue("--rs-unit-x1");
|
51
35
|
const unitModifier = baseUnit ? parseInt(baseUnit) : 0;
|
36
|
+
const triggerBounds = passedTriggerBounds || triggerEl?.getBoundingClientRect();
|
37
|
+
if (!triggerBounds)
|
38
|
+
return;
|
39
|
+
const resolvedTriggerBounds = getRectFromCoordinates(triggerBounds);
|
52
40
|
// Reset all styles applied on the previous hook execution
|
53
41
|
targetClone.style.cssText = "";
|
54
42
|
Object.keys(resetStyles).forEach((key) => {
|
@@ -58,17 +46,17 @@ const flyout = (args) => {
|
|
58
46
|
});
|
59
47
|
if (width) {
|
60
48
|
if (width === "trigger") {
|
61
|
-
targetClone.style.width = `${
|
49
|
+
targetClone.style.width = `${resolvedTriggerBounds.width}px`;
|
62
50
|
}
|
63
51
|
else if (width !== "full") {
|
64
52
|
targetClone.style.width = width;
|
65
53
|
}
|
66
54
|
}
|
67
|
-
const shadowRoot = getShadowRoot(triggerEl);
|
55
|
+
const shadowRoot = triggerEl && getShadowRoot(triggerEl);
|
68
56
|
// Insert inside shadow root if possible to make sure styles are applied correctly
|
69
57
|
(shadowRoot || document.body).appendChild(targetClone);
|
70
58
|
const flyoutBounds = targetClone.getBoundingClientRect();
|
71
|
-
const containerParent = container ||
|
59
|
+
const containerParent = container || (triggerEl ? findClosestRenderContainer({ el: triggerEl }) : document.body);
|
72
60
|
const containerBounds = containerParent.getBoundingClientRect();
|
73
61
|
const scopeOffset = {
|
74
62
|
top: containerBounds.top + document.documentElement.scrollTop - containerParent.scrollTop,
|
@@ -79,14 +67,14 @@ const flyout = (args) => {
|
|
79
67
|
testOrder.some((currentPosition) => {
|
80
68
|
const tested = calculatePosition({
|
81
69
|
...options,
|
82
|
-
triggerBounds,
|
70
|
+
triggerBounds: resolvedTriggerBounds,
|
83
71
|
flyoutBounds,
|
84
72
|
scopeOffset,
|
85
73
|
position: currentPosition,
|
86
74
|
contentGap: contentGap * unitModifier,
|
87
75
|
contentShift: contentShift * unitModifier,
|
88
76
|
});
|
89
|
-
const visible =
|
77
|
+
const visible = isFullyVisible(tested);
|
90
78
|
const validPosition = visible || fallbackPositions?.length === 0;
|
91
79
|
// Saving first try in case non of the options work
|
92
80
|
if (validPosition || lastUsedFallback === currentPosition) {
|
@@ -96,7 +84,7 @@ const flyout = (args) => {
|
|
96
84
|
return validPosition;
|
97
85
|
});
|
98
86
|
if (!calculated) {
|
99
|
-
throw new Error(`Reshaped
|
87
|
+
throw new Error(`[Reshaped] Can't calculate styles for the ${position} position`);
|
100
88
|
}
|
101
89
|
targetClone.parentNode?.removeChild(targetClone);
|
102
90
|
return calculated;
|
@@ -132,11 +120,11 @@ const flyoutReducer = (state, action) => {
|
|
132
120
|
return state;
|
133
121
|
return { ...state, status: "idle", styles: resetStyles };
|
134
122
|
default:
|
135
|
-
throw new Error("Invalid reducer type");
|
123
|
+
throw new Error("[Reshaped] Invalid flyout reducer type");
|
136
124
|
}
|
137
125
|
};
|
138
126
|
const useFlyout = (args) => {
|
139
|
-
const { triggerElRef, flyoutElRef,
|
127
|
+
const { triggerElRef, flyoutElRef, triggerBounds, contentGap, contentShift, ...options } = args;
|
140
128
|
const { position: defaultPosition = "bottom", fallbackPositions, width, container } = options;
|
141
129
|
const lastUsedFallbackRef = React.useRef(defaultPosition);
|
142
130
|
// Memo the array internally to avoid new arrays triggering useCallback
|
@@ -165,12 +153,12 @@ const useFlyout = (args) => {
|
|
165
153
|
lastUsedFallbackRef.current = position;
|
166
154
|
}, []);
|
167
155
|
const updatePosition = React.useCallback((options) => {
|
168
|
-
if (!
|
156
|
+
if (!flyoutElRef.current)
|
169
157
|
return;
|
170
158
|
const nextFlyoutData = flyout({
|
171
159
|
triggerEl: triggerElRef.current,
|
172
160
|
flyoutEl: flyoutElRef.current,
|
173
|
-
triggerBounds
|
161
|
+
triggerBounds,
|
174
162
|
width,
|
175
163
|
position: defaultPosition,
|
176
164
|
fallbackPositions: cachedFallbackPositions,
|
@@ -181,8 +169,9 @@ const useFlyout = (args) => {
|
|
181
169
|
contentGap,
|
182
170
|
contentShift,
|
183
171
|
});
|
184
|
-
if (nextFlyoutData)
|
172
|
+
if (nextFlyoutData) {
|
185
173
|
dispatch({ type: "position", payload: { ...nextFlyoutData, sync: options?.sync } });
|
174
|
+
}
|
186
175
|
}, [
|
187
176
|
container,
|
188
177
|
defaultPosition,
|
@@ -190,7 +179,7 @@ const useFlyout = (args) => {
|
|
190
179
|
isRTL,
|
191
180
|
flyoutElRef,
|
192
181
|
triggerElRef,
|
193
|
-
|
182
|
+
triggerBounds,
|
194
183
|
width,
|
195
184
|
contentGap,
|
196
185
|
contentShift,
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/**
|
2
|
+
* Check if element visually fits on the screen
|
3
|
+
*/
|
4
|
+
const isFullyVisible = (args) => {
|
5
|
+
const { styles, scopeOffset } = args;
|
6
|
+
const htmlEl = document.documentElement;
|
7
|
+
const pageLeft = htmlEl.scrollLeft;
|
8
|
+
const pageRight = pageLeft + htmlEl.clientWidth;
|
9
|
+
const pageTop = htmlEl.scrollTop;
|
10
|
+
const pageBottom = pageTop + htmlEl.clientHeight;
|
11
|
+
return (styles.left + scopeOffset.left >= pageLeft &&
|
12
|
+
styles.left + styles.width + scopeOffset.left <= pageRight &&
|
13
|
+
styles.top + scopeOffset.top >= pageTop &&
|
14
|
+
styles.top + styles.height + scopeOffset.top <= pageBottom);
|
15
|
+
};
|
16
|
+
export default isFullyVisible;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
"use client";
|
2
|
-
import { jsx as _jsx
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
3
3
|
import React from "react";
|
4
4
|
import ReactDOM from "react-dom";
|
5
5
|
import Theme from "../../Theme/index.js";
|
@@ -29,7 +29,10 @@ const Portal = (props) => {
|
|
29
29
|
const nextScopeRef = targetRef || portal.scopeRef;
|
30
30
|
const targetEl = nextScopeRef?.current || defaultTargetEl;
|
31
31
|
/* Preserve the current theme when rendered in body */
|
32
|
-
return
|
32
|
+
return [
|
33
|
+
ReactDOM.createPortal(_jsx(Theme, { children: children }), targetEl),
|
34
|
+
_jsx("div", { ref: rootRef, className: s.root }, "root"),
|
35
|
+
];
|
33
36
|
};
|
34
37
|
function PortalScope(props) {
|
35
38
|
const { children } = props;
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import React from "react";
|
2
|
-
declare const useOnClickOutside: (refs: React.RefObject<HTMLElement>[], handler: (event: Event) => void) => void;
|
2
|
+
declare const useOnClickOutside: (refs: React.RefObject<HTMLElement>[], handler: (event: Event) => void, deps: any[]) => void;
|
3
3
|
export default useOnClickOutside;
|
@@ -1,17 +1,20 @@
|
|
1
1
|
import useHandlerRef from "../useHandlerRef.js";
|
2
2
|
import React from "react";
|
3
|
-
const useOnClickOutside = (refs, handler) => {
|
3
|
+
const useOnClickOutside = (refs, handler, deps) => {
|
4
4
|
const handlerRef = useHandlerRef(handler);
|
5
5
|
React.useEffect(() => {
|
6
6
|
if (!handlerRef.current)
|
7
7
|
return;
|
8
8
|
const handleClick = (event) => {
|
9
|
+
if (event instanceof MouseEvent && event.button === 2) {
|
10
|
+
return;
|
11
|
+
}
|
9
12
|
let isInside = false;
|
10
13
|
const clickedEl = event.composedPath()[0];
|
11
14
|
refs.forEach((elRef) => {
|
12
|
-
if (!elRef.current
|
13
|
-
|
14
|
-
|
15
|
+
if (!elRef.current)
|
16
|
+
return;
|
17
|
+
if (elRef.current === clickedEl || elRef.current.contains(clickedEl)) {
|
15
18
|
isInside = true;
|
16
19
|
}
|
17
20
|
});
|
@@ -27,6 +30,6 @@ const useOnClickOutside = (refs, handler) => {
|
|
27
30
|
document.removeEventListener("touchstart", handleClick);
|
28
31
|
};
|
29
32
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
30
|
-
}, [handlerRef, ...refs]);
|
33
|
+
}, [handlerRef, ...refs, ...deps]);
|
31
34
|
};
|
32
35
|
export default useOnClickOutside;
|
@@ -1,10 +1,14 @@
|
|
1
1
|
import React from "react";
|
2
|
+
import * as keys from "../../constants/keys.js";
|
2
3
|
import { enableKeyboardMode, disableKeyboardMode } from "../../utilities/a11y/index.js";
|
3
4
|
const useSingletonKeyboardMode = () => {
|
4
5
|
React.useEffect(() => {
|
5
6
|
const handleKeyDown = (e) => {
|
6
7
|
if (e.metaKey || e.altKey || e.ctrlKey)
|
7
8
|
return;
|
9
|
+
// Prevent focus ring from appearing when using mouse but closing with esc
|
10
|
+
if (e.key === keys.ESC)
|
11
|
+
return;
|
8
12
|
enableKeyboardMode();
|
9
13
|
};
|
10
14
|
const handleClick = () => {
|
package/dist/index.d.ts
CHANGED
@@ -31,6 +31,8 @@ export { default as CheckboxGroup } from "./components/CheckboxGroup";
|
|
31
31
|
export type { CheckboxGroupProps } from "./components/CheckboxGroup";
|
32
32
|
export { default as Container } from "./components/Container";
|
33
33
|
export type { ContainerProps } from "./components/Container";
|
34
|
+
export { default as ContextMenu } from "./components/ContextMenu";
|
35
|
+
export type { ContextMenuProps } from "./components/ContextMenu";
|
34
36
|
export { default as Dismissible } from "./components/Dismissible";
|
35
37
|
export type { DismissibleProps } from "./components/Dismissible";
|
36
38
|
export { default as Divider } from "./components/Divider";
|
package/dist/index.js
CHANGED
@@ -16,6 +16,7 @@ export { default as Carousel } from "./components/Carousel/index.js";
|
|
16
16
|
export { default as Checkbox } from "./components/Checkbox/index.js";
|
17
17
|
export { default as CheckboxGroup } from "./components/CheckboxGroup/index.js";
|
18
18
|
export { default as Container } from "./components/Container/index.js";
|
19
|
+
export { default as ContextMenu } from "./components/ContextMenu/index.js";
|
19
20
|
export { default as Dismissible } from "./components/Dismissible/index.js";
|
20
21
|
export { default as Divider } from "./components/Divider/index.js";
|
21
22
|
export { default as DropdownMenu } from "./components/DropdownMenu/index.js";
|
@@ -0,0 +1 @@
|
|
1
|
+
[style*="--rs-align-"]{align-items:var(--rs-align)!important;--rs-align-s: ;--rs-align-m:var(--rs-align-s);--rs-align-l:var(--rs-align-m);--rs-align-xl:var(--rs-align-l);--rs-align:var(--rs-align-s)}@media (--rs-viewport-m ){[style*="--rs-align-"]{--rs-align:var(--rs-align-m)}}@media (--rs-viewport-l ){[style*="--rs-align-"]{--rs-align:var(--rs-align-l)}}@media (--rs-viewport-xl ){[style*="--rs-align-"]{--rs-align:var(--rs-align-xl)}}
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import {
|
2
|
-
import
|
1
|
+
import { responsiveVariables } from "../../utilities/helpers.js";
|
2
|
+
import "./align.css";
|
3
3
|
const getAlignStyles = (value) => {
|
4
4
|
if (!value)
|
5
5
|
return null;
|
6
6
|
return {
|
7
|
-
|
7
|
+
variables: responsiveVariables("--rs-align", value),
|
8
8
|
};
|
9
9
|
};
|
10
10
|
export default getAlignStyles;
|
@@ -0,0 +1 @@
|
|
1
|
+
[style*="--rs-ratio-"]{--rs-ratio-s:0;--rs-ratio-m:var(--rs-ratio-s);--rs-ratio-l:var(--rs-ratio-m);--rs-ratio-xl:var(--rs-ratio-l);--rs-ratio:var(--rs-ratio-s)}[style*="--rs-ratio-"]:empty,[style*="--rs-ratio-"]:not(:empty)>*{aspect-ratio:var(--rs-ratio)}[style*="--rs-ratio-"]>img{object-fit:cover}@media (--rs-viewport-m ){[style*="--rs-ratio-"]{--rs-ratio:var(--rs-ratio-m)}}@media (--rs-viewport-l ){[style*="--rs-ratio-"]{--rs-ratio:var(--rs-ratio-l)}}@media (--rs-viewport-xl ){[style*="--rs-ratio-"]{--rs-ratio:var(--rs-ratio-xl)}}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { responsiveVariables } from "../../utilities/helpers.js";
|
2
|
-
import
|
2
|
+
import "./aspectRatio.css";
|
3
3
|
const getAspectRatioStyles = (value) => {
|
4
4
|
if (!value)
|
5
5
|
return null;
|
6
6
|
const variables = responsiveVariables("--rs-ratio", value);
|
7
|
-
return {
|
7
|
+
return { variables };
|
8
8
|
};
|
9
9
|
export default getAspectRatioStyles;
|
@@ -1 +1 @@
|
|
1
|
-
.root{margin-left:calc(var(--rs-unit-x1) * var(--rs-bleed) * -1);margin-right:calc(var(--rs-unit-x1) * var(--rs-bleed) * -1);--rs-bleed-s:0;--rs-bleed-m:var(--rs-bleed-s);--rs-bleed-l:var(--rs-bleed-m);--rs-bleed-xl:var(--rs-bleed-l);--rs-bleed:var(--rs-bleed-s)}.--bleed{border-left-style:none!important;border-radius:0;border-right-style:none!important}@media (--rs-viewport-m ){.root{--rs-bleed:var(--rs-bleed-m)}.--bleed-true--m{border-left-style:none!important;border-radius:0;border-right-style:none!important}.--bleed-false--m{border-left-style:solid!important;border-radius:var(--rs-radius);border-right-style:solid!important}}@media (--rs-viewport-l ){.root{--rs-bleed:var(--rs-bleed-l)}.--bleed-true--l{border-left-style:none!important;border-radius:0;border-right-style:none!important}.--bleed-false--l{border-left-style:solid!important;border-radius:var(--rs-radius);border-right-style:solid!important}}@media (--rs-viewport-xl ){.root{--rs-bleed:var(--rs-bleed-xl)}.--bleed-true--xl{border-left-style:none!important;border-radius:0;border-right-style:none!important}.--bleed-false--xl{border-left-style:solid!important;border-radius:var(--rs-radius);border-right-style:solid!important}}
|
1
|
+
.root[style*="--rs-bleed-"]{margin-left:calc(var(--rs-unit-x1) * var(--rs-bleed) * -1);margin-right:calc(var(--rs-unit-x1) * var(--rs-bleed) * -1);--rs-bleed-s:0;--rs-bleed-m:var(--rs-bleed-s);--rs-bleed-l:var(--rs-bleed-m);--rs-bleed-xl:var(--rs-bleed-l);--rs-bleed:var(--rs-bleed-s)}.--bleed{border-left-style:none!important;border-radius:0;border-right-style:none!important}@media (--rs-viewport-m ){.root[style*="--rs-bleed-"]{--rs-bleed:var(--rs-bleed-m)}.--bleed-true--m{border-left-style:none!important;border-radius:0;border-right-style:none!important}.--bleed-false--m{border-left-style:solid!important;border-radius:var(--rs-radius);border-right-style:solid!important}}@media (--rs-viewport-l ){.root[style*="--rs-bleed-"]{--rs-bleed:var(--rs-bleed-l)}.--bleed-true--l{border-left-style:none!important;border-radius:0;border-right-style:none!important}.--bleed-false--l{border-left-style:solid!important;border-radius:var(--rs-radius);border-right-style:solid!important}}@media (--rs-viewport-xl ){.root[style*="--rs-bleed-"]{--rs-bleed:var(--rs-bleed-xl)}.--bleed-true--xl{border-left-style:none!important;border-radius:0;border-right-style:none!important}.--bleed-false--xl{border-left-style:solid!important;border-radius:var(--rs-radius);border-right-style:solid!important}}
|
@@ -3,11 +3,8 @@ import s from "./bleed.module.css";
|
|
3
3
|
const getBleedStyles = (value) => {
|
4
4
|
if (value === undefined)
|
5
5
|
return null;
|
6
|
-
const classNames =
|
7
|
-
s.root,
|
8
|
-
...responsiveClassNames(s, "--bleed", responsivePropDependency(value, (value) => typeof value === "number" && value > 0)),
|
9
|
-
];
|
6
|
+
const classNames = responsiveClassNames(s, "--bleed", responsivePropDependency(value, (value) => typeof value === "number" && value > 0));
|
10
7
|
const variables = responsiveVariables("--rs-bleed", value);
|
11
|
-
return { classNames, variables };
|
8
|
+
return { classNames: [s.root, classNames], variables };
|
12
9
|
};
|
13
10
|
export default getBleedStyles;
|
@@ -1 +1 @@
|
|
1
|
-
.
|
1
|
+
.root{--rs-h-s:auto;--rs-h-m:var(--rs-h-s);--rs-h-l:var(--rs-h-m);--rs-h-xl:var(--rs-h-l);height:var(--rs-h)!important}.--type-literal{--rs-h:var(--rs-h-s)}.--type-unit{--rs-h:calc(var(--rs-h-s) * var(--rs-unit-x1))}@media (--rs-viewport-m ){.--type-literal--m{--rs-h:var(--rs-h-m)}.--type-unit--m{--rs-h:calc(var(--rs-h-m) * var(--rs-unit-x1))}}@media (--rs-viewport-l ){.--type-literal--l{--rs-h:var(--rs-h-l)}.--type-unit--l{--rs-h:calc(var(--rs-h-l) * var(--rs-unit-x1))}}@media (--rs-viewport-xl ){.--type-literal--xl{--rs-h:var(--rs-h-xl)}.--type-unit--xl{--rs-h:calc(var(--rs-h-xl) * var(--rs-unit-x1))}}
|
@@ -4,7 +4,7 @@ const getHeightStyles = (value) => {
|
|
4
4
|
if (!value)
|
5
5
|
return null;
|
6
6
|
const variables = responsiveVariables("--rs-h", value);
|
7
|
-
const classNames = responsiveClassNames(s, (value) => (typeof value === "number" ? "unit" : "literal"), value, { excludeValueFromClassName: true });
|
8
|
-
return { classNames, variables };
|
7
|
+
const classNames = responsiveClassNames(s, (value) => (typeof value === "number" ? "--type-unit" : "--type-literal"), value, { excludeValueFromClassName: true });
|
8
|
+
return { classNames: [s.root, classNames], variables };
|
9
9
|
};
|
10
10
|
export default getHeightStyles;
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import * as T from "../types";
|
2
2
|
import * as G from "../../types/global";
|
3
|
-
|
3
|
+
import "./inset.css";
|
4
|
+
declare const getInsetStyles: (value?: G.Responsive<number | "auto">, side?: "top" | "bottom" | "start" | "end") => T.VariableStyleUtilityResult;
|
4
5
|
export default getInsetStyles;
|
@@ -1,14 +1,11 @@
|
|
1
|
-
import { responsiveVariables
|
2
|
-
import
|
1
|
+
import { responsiveVariables } from "../../utilities/helpers.js";
|
2
|
+
import "./inset.css";
|
3
3
|
const getInsetStyles = (value, side) => {
|
4
4
|
if (value === undefined)
|
5
5
|
return null;
|
6
|
-
const suffix = side ? `-${side}` : "";
|
6
|
+
const suffix = side ? `-${side}` : "-all";
|
7
7
|
const variableName = `--rs-inset${suffix}`;
|
8
8
|
const variables = responsiveVariables(variableName, value);
|
9
|
-
|
10
|
-
excludeValueFromClassName: true,
|
11
|
-
});
|
12
|
-
return { classNames, variables };
|
9
|
+
return { variables };
|
13
10
|
};
|
14
11
|
export default getInsetStyles;
|
@@ -0,0 +1 @@
|
|
1
|
+
[style*="--rs-inset-all-"]{inset:calc(var(--rs-inset-all) * var(--rs-unit-x1));--rs-inset-all-s:0;--rs-inset-all-m:var(--rs-inset-all-s);--rs-inset-all-l:var(--rs-inset-all-m);--rs-inset-all-xl:var(--rs-inset-all-l);--rs-inset-all:var(--rs-inset-all-s)}[style*="--rs-inset-end-"]{inset-inline-end:calc(var(--rs-inset-end) * var(--rs-unit-x1));--rs-inset-end-s:0;--rs-inset-end-m:var(--rs-inset-end-s);--rs-inset-end-l:var(--rs-inset-end-m);--rs-inset-end-xl:var(--rs-inset-end-l);--rs-inset-end:var(--rs-inset-end-s)}[style*="--rs-inset-start-"]{inset-inline-start:calc(var(--rs-inset-start) * var(--rs-unit-x1));--rs-inset-start-s:0;--rs-inset-start-m:var(--rs-inset-start-s);--rs-inset-start-l:var(--rs-inset-start-m);--rs-inset-start-xl:var(--rs-inset-start-l);--rs-inset-start:var(--rs-inset-start-s)}[style*="--rs-inset-top-"]{inset-block-start:calc(var(--rs-inset-top) * var(--rs-unit-x1));--rs-inset-top-s:0;--rs-inset-top-m:var(--rs-inset-top-s);--rs-inset-top-l:var(--rs-inset-top-m);--rs-inset-top-xl:var(--rs-inset-top-l);--rs-inset-top:var(--rs-inset-top-s)}[style*="--rs-inset-bottom-"]{inset-block-end:calc(var(--rs-inset-bottom) * var(--rs-unit-x1));--rs-inset-bottom-s:0;--rs-inset-bottom-m:var(--rs-inset-bottom-s);--rs-inset-bottom-l:var(--rs-inset-bottom-m);--rs-inset-bottom-xl:var(--rs-inset-bottom-l);--rs-inset-bottom:var(--rs-inset-bottom-s)}@media (--rs-viewport-m ){[style*="--rs-inset-all-"]{--rs-inset-all:var(--rs-inset-all-m)}[style*="--rs-inset-end-"]{--rs-inset-end:var(--rs-inset-end-m)}[style*="--rs-inset-start-"]{--rs-inset-start:var(--rs-inset-start-m)}[style*="--rs-inset-top-"]{--rs-inset-top:var(--rs-inset-top-m)}[style*="--rs-inset-bottom-"]{--rs-inset-bottom:var(--rs-inset-bottom-m)}}@media (--rs-viewport-l ){[style*="--rs-inset-all-"]{--rs-inset-all:var(--rs-inset-all-l)}[style*="--rs-inset-end-"]{--rs-inset-end:var(--rs-inset-end-l)}[style*="--rs-inset-start-"]{--rs-inset-start:var(--rs-inset-start-l)}[style*="--rs-inset-top-"]{--rs-inset-top:var(--rs-inset-top-l)}[style*="--rs-inset-bottom-"]{--rs-inset-bottom:var(--rs-inset-bottom-l)}}@media (--rs-viewport-xl ){[style*="--rs-inset-all-"]{--rs-inset-all:var(--rs-inset-all-xl)}[style*="--rs-inset-end-"]{--rs-inset-end:var(--rs-inset-end-xl)}[style*="--rs-inset-start-"]{--rs-inset-start:var(--rs-inset-start-xl)}[style*="--rs-inset-top-"]{--rs-inset-top:var(--rs-inset-top-xl)}[style*="--rs-inset-bottom-"]{--rs-inset-bottom:var(--rs-inset-bottom-xl)}}
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import {
|
2
|
-
import
|
1
|
+
import { responsiveVariables } from "../../utilities/helpers.js";
|
2
|
+
import "./justify.css";
|
3
3
|
const getJustifyStyles = (value) => {
|
4
4
|
if (!value)
|
5
5
|
return null;
|
6
6
|
return {
|
7
|
-
|
7
|
+
variables: responsiveVariables("--rs-justify", value),
|
8
8
|
};
|
9
9
|
};
|
10
10
|
export default getJustifyStyles;
|
@@ -0,0 +1 @@
|
|
1
|
+
[style*="--rs-justify-"]{justify-content:var(--rs-justify)!important;--rs-justify-s: ;--rs-justify-m:var(--rs-justify-s);--rs-justify-l:var(--rs-justify-m);--rs-justify-xl:var(--rs-justify-l);--rs-justify:var(--rs-justify-s)}@media (--rs-viewport-m ){[style*="--rs-justify-"]{--rs-justify:var(--rs-justify-m)}}@media (--rs-viewport-l ){[style*="--rs-justify-"]{--rs-justify:var(--rs-justify-l)}}@media (--rs-viewport-xl ){[style*="--rs-justify-"]{--rs-justify:var(--rs-justify-xl)}}
|
@@ -4,7 +4,7 @@ const getMaxHeightStyles = (value) => {
|
|
4
4
|
if (!value)
|
5
5
|
return null;
|
6
6
|
const variables = responsiveVariables("--rs-max-h", value);
|
7
|
-
const classNames = responsiveClassNames(s, (value) => (typeof value === "number" ? "unit" : "literal"), value, { excludeValueFromClassName: true });
|
8
|
-
return { classNames, variables };
|
7
|
+
const classNames = responsiveClassNames(s, (value) => (typeof value === "number" ? "--type-unit" : "--type-literal"), value, { excludeValueFromClassName: true });
|
8
|
+
return { classNames: [s.root, classNames], variables };
|
9
9
|
};
|
10
10
|
export default getMaxHeightStyles;
|
@@ -1 +1 @@
|
|
1
|
-
.
|
1
|
+
.root[style*="--rs-max-h-"]{--rs-max-h-s:none;--rs-max-h-m:var(--rs-max-h-s);--rs-max-h-l:var(--rs-max-h-m);--rs-max-h-xl:var(--rs-max-h-l);--rs-max-h:var(--rs-max-h-s)}.--type-literal{max-height:var(--rs-max-h)!important}.--type-unit{max-height:calc(var(--rs-max-h) * var(--rs-unit-x1))!important}@media (--rs-viewport-m ){.root[style*="--rs-max-h-"]{--rs-max-h:var(--rs-max-h-m)}.--type-literal--m{max-height:var(--rs-max-h)!important}.--type-unit--m{max-height:calc(var(--rs-max-h) * var(--rs-unit-x1))!important}}@media (--rs-viewport-l ){.root[style*="--rs-max-h-"]{--rs-max-h:var(--rs-max-h-l)}.--type-literal--l{max-height:var(--rs-max-h)!important}.--type-unit--l{max-height:calc(var(--rs-max-h) * var(--rs-unit-x1))!important}}@media (--rs-viewport-xl ){.root[style*="--rs-max-h-"]{--rs-max-h:var(--rs-max-h-xl)}.--type-literal--xl{max-height:var(--rs-max-h)!important}.--type-unit--xl{max-height:calc(var(--rs-max-h) * var(--rs-unit-x1))!important}}
|
@@ -4,7 +4,7 @@ const getMaxWidthStyles = (value) => {
|
|
4
4
|
if (!value)
|
5
5
|
return null;
|
6
6
|
const variables = responsiveVariables("--rs-max-w", value);
|
7
|
-
const classNames = responsiveClassNames(s, (value) => (typeof value === "number" ? "unit" : "literal"), value, { excludeValueFromClassName: true });
|
8
|
-
return { classNames, variables };
|
7
|
+
const classNames = responsiveClassNames(s, (value) => (typeof value === "number" ? "--type-unit" : "--type-literal"), value, { excludeValueFromClassName: true });
|
8
|
+
return { classNames: [s.root, classNames], variables };
|
9
9
|
};
|
10
10
|
export default getMaxWidthStyles;
|
@@ -1 +1 @@
|
|
1
|
-
.
|
1
|
+
.root[style*="--rs-max-w-"]{--rs-max-w-s:none;--rs-max-w-m:var(--rs-max-w-s);--rs-max-w-l:var(--rs-max-w-m);--rs-max-w-xl:var(--rs-max-w-l);--rs-max-w:var(--rs-max-w-s)}.--type-literal{max-width:var(--rs-max-w)!important}.--type-unit{max-width:calc(var(--rs-max-w) * var(--rs-unit-x1))!important}@media (--rs-viewport-m ){.root[style*="--rs-max-w-"]{--rs-max-w:var(--rs-max-w-m)}.--type-literal--m{max-width:var(--rs-max-w)!important}.--type-unit--m{max-width:calc(var(--rs-max-w) * var(--rs-unit-x1))!important}}@media (--rs-viewport-l ){.root[style*="--rs-max-w-"]{--rs-max-w:var(--rs-max-w-l)}.--type-literal--l{max-width:var(--rs-max-w)!important}.--type-unit--l{max-width:calc(var(--rs-max-w) * var(--rs-unit-x1))!important}}@media (--rs-viewport-xl ){.root[style*="--rs-max-w-"]{--rs-max-w:var(--rs-max-w-xl)}.--type-literal--xl{max-width:var(--rs-max-w)!important}.--type-unit--xl{max-width:calc(var(--rs-max-w) * var(--rs-unit-x1))!important}}
|
@@ -4,7 +4,7 @@ const getMinHeightStyles = (value) => {
|
|
4
4
|
if (!value)
|
5
5
|
return null;
|
6
6
|
const variables = responsiveVariables("--rs-min-h", value);
|
7
|
-
const classNames = responsiveClassNames(s, (value) => (typeof value === "number" ? "unit" : "literal"), value, { excludeValueFromClassName: true });
|
8
|
-
return { classNames, variables };
|
7
|
+
const classNames = responsiveClassNames(s, (value) => (typeof value === "number" ? "--type-unit" : "--type-literal"), value, { excludeValueFromClassName: true });
|
8
|
+
return { classNames: [s.root, classNames], variables };
|
9
9
|
};
|
10
10
|
export default getMinHeightStyles;
|
@@ -1 +1 @@
|
|
1
|
-
.
|
1
|
+
.root[style*="--rs-min-h-"]{--rs-min-h-s:none;--rs-min-h-m:var(--rs-min-h-s);--rs-min-h-l:var(--rs-min-h-m);--rs-min-h-xl:var(--rs-min-h-l);--rs-min-h:var(--rs-min-h-s)}.--type-literal{min-height:var(--rs-min-h)!important}.--type-unit{min-height:calc(var(--rs-min-h) * var(--rs-unit-x1))!important}@media (--rs-viewport-m ){.root[style*="--rs-min-h-"]{--rs-min-h:var(--rs-min-h-m)}.--type-literal--m{min-height:var(--rs-min-h)!important}.--type-unit--m{min-height:calc(var(--rs-min-h) * var(--rs-unit-x1))!important}}@media (--rs-viewport-l ){.root[style*="--rs-min-h-"]{--rs-min-h:var(--rs-min-h-l)}.--type-literal--l{min-height:var(--rs-min-h)!important}.--type-unit--l{min-height:calc(var(--rs-min-h) * var(--rs-unit-x1))!important}}@media (--rs-viewport-xl ){.root[style*="--rs-min-h-"]{--rs-min-h:var(--rs-min-h-xl)}.--type-literal--xl{min-height:var(--rs-min-h)!important}.--type-unit--xl{min-height:calc(var(--rs-min-h) * var(--rs-unit-x1))!important}}
|