reshaped 3.5.4-canary.0 → 3.6.0-canary.1
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 +29 -46
- package/dist/bundle.css +1 -1
- package/dist/bundle.d.ts +37 -32
- package/dist/bundle.js +11 -11
- package/dist/components/Accordion/AccordionControlled.js +1 -1
- package/dist/components/Accordion/AccordionTrigger.js +1 -1
- package/dist/components/ActionBar/ActionBar.js +1 -1
- package/dist/components/Actionable/Actionable.js +1 -1
- package/dist/components/Avatar/Avatar.js +1 -1
- package/dist/components/Badge/Badge.js +1 -1
- package/dist/components/Badge/BadgeContainer.js +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/Button.types.d.ts +1 -1
- package/dist/components/Button/ButtonGroup.js +1 -1
- package/dist/components/Calendar/CalendarDate.js +1 -1
- package/dist/components/Card/Card.d.ts +1 -1
- package/dist/components/Card/Card.js +1 -1
- package/dist/components/Card/tests/Card.stories.d.ts +1 -1
- package/dist/components/Card/tests/Card.test.stories.d.ts +1 -1
- package/dist/components/Carousel/Carousel.js +4 -3
- package/dist/components/Carousel/CarouselControl.js +1 -1
- package/dist/components/Checkbox/Checkbox.js +1 -1
- package/dist/components/Container/Container.js +1 -1
- package/dist/components/Dismissible/Dismissible.js +1 -1
- package/dist/components/Divider/Divider.js +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.js +2 -2
- package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +1 -1
- package/dist/components/DropdownMenu/tests/DropdownMenu.stories.d.ts +1 -1
- package/dist/components/DropdownMenu/tests/DropdownMenu.test.stories.d.ts +1 -1
- package/dist/components/FileUpload/FileUpload.js +1 -1
- package/dist/components/Flyout/Flyout.constants.d.ts +6 -0
- package/dist/components/Flyout/Flyout.constants.js +19 -0
- package/dist/components/{_private/Flyout → Flyout}/Flyout.types.d.ts +3 -3
- package/dist/components/{_private/Flyout → Flyout}/FlyoutContent.js +28 -22
- package/dist/components/{_private/Flyout → Flyout}/FlyoutControlled.js +9 -9
- package/dist/components/{_private/Flyout → Flyout}/tests/Flyout.stories.d.ts +6 -4
- package/dist/components/{_private/Flyout → Flyout}/tests/Flyout.stories.js +128 -118
- package/dist/components/{_private/Flyout → Flyout}/useFlyout.d.ts +1 -1
- package/dist/components/Flyout/useFlyout.js +116 -0
- package/dist/components/Flyout/utilities/calculatePosition.d.ts +30 -0
- package/dist/components/Flyout/utilities/calculatePosition.js +129 -0
- package/dist/components/Flyout/utilities/flyout.d.ts +11 -0
- package/dist/components/Flyout/utilities/flyout.js +79 -0
- package/dist/components/Flyout/utilities/isFullyVisible.d.ts +10 -0
- package/dist/components/Flyout/utilities/isFullyVisible.js +24 -0
- package/dist/components/FormControl/FormControl.context.d.ts +0 -2
- package/dist/components/Grid/Grid.js +1 -1
- package/dist/components/Hidden/Hidden.js +1 -1
- package/dist/components/Hotkey/Hotkey.js +1 -1
- package/dist/components/Icon/Icon.js +1 -1
- package/dist/components/Image/Image.js +1 -1
- package/dist/components/Link/Link.d.ts +1 -1
- package/dist/components/Link/Link.js +1 -1
- package/dist/components/Loader/Loader.js +1 -1
- package/dist/components/MenuItem/MenuItem.js +1 -1
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/NumberField/NumberFieldControlled.js +1 -1
- package/dist/components/Overlay/Overlay.js +1 -1
- package/dist/components/PinField/PinFieldControlled.js +1 -1
- package/dist/components/Popover/Popover.d.ts +1 -1
- package/dist/components/Popover/Popover.js +4 -4
- package/dist/components/Popover/Popover.module.css +1 -1
- package/dist/components/Popover/Popover.types.d.ts +3 -1
- package/dist/components/Popover/tests/Popover.stories.d.ts +48 -9
- package/dist/components/Popover/tests/Popover.stories.js +209 -85
- package/dist/components/Progress/Progress.js +1 -1
- package/dist/components/ProgressIndicator/ProgressIndicator.js +1 -1
- package/dist/components/Radio/Radio.js +1 -1
- package/dist/components/Reshaped/Reshaped.js +1 -1
- package/dist/components/Resizable/Resizable.js +1 -1
- package/dist/components/Scrim/Scrim.js +1 -1
- package/dist/components/ScrollArea/ScrollArea.js +6 -6
- package/dist/components/ScrollArea/ScrollArea.module.css +1 -1
- package/dist/components/Select/Select.js +1 -1
- package/dist/components/Skeleton/Skeleton.js +1 -1
- package/dist/components/Slider/Slider.types.d.ts +34 -7
- package/dist/components/Slider/SliderControlled.js +32 -20
- package/dist/components/Slider/SliderThumb.js +4 -4
- package/dist/components/Slider/SliderUncontrolled.js +3 -2
- package/dist/components/Slider/tests/Slider.stories.d.ts +38 -8
- package/dist/components/Slider/tests/Slider.stories.js +268 -54
- package/dist/components/Stepper/Stepper.js +1 -1
- package/dist/components/Switch/Switch.js +1 -1
- package/dist/components/Table/Table.js +6 -3
- package/dist/components/Table/Table.module.css +1 -1
- package/dist/components/Tabs/TabsContext.d.ts +2 -2
- package/dist/components/Tabs/TabsItem.js +1 -1
- package/dist/components/Tabs/TabsList.js +3 -34
- package/dist/components/Tabs/TabsPanel.js +1 -1
- package/dist/components/Text/Text.js +1 -1
- package/dist/components/TextArea/TextArea.js +1 -1
- package/dist/components/TextField/TextField.js +1 -1
- package/dist/components/Theme/Theme.js +1 -1
- package/dist/components/Timeline/Timeline.js +1 -1
- package/dist/components/Toast/ToastContainer.js +1 -1
- package/dist/components/Toast/ToastRegion.js +1 -1
- package/dist/components/Tooltip/Tooltip.js +1 -1
- package/dist/components/Tooltip/Tooltip.types.d.ts +1 -1
- package/dist/components/View/View.js +1 -1
- package/dist/components/_private/Aligner/Aligner.js +1 -1
- package/dist/components/_private/Expandable/Expandable.js +1 -1
- package/dist/components/_private/HiddenInput/HiddenInput.js +1 -1
- package/dist/config/tailwind.d.ts +1 -1
- package/dist/hooks/_private/useFadeSide.d.ts +5 -0
- package/dist/hooks/_private/useFadeSide.js +47 -0
- package/dist/hooks/useIsomorphicLayoutEffect.d.ts +1 -1
- package/dist/index.d.ts +37 -32
- package/dist/index.js +21 -17
- package/dist/styles/align/index.js +1 -1
- package/dist/styles/aspectRatio/index.js +1 -1
- package/dist/styles/bleed/index.js +1 -1
- package/dist/styles/border/index.js +1 -1
- package/dist/styles/height/index.js +1 -1
- package/dist/styles/inset/index.js +1 -1
- package/dist/styles/justify/index.js +1 -1
- package/dist/styles/maxHeight/index.js +1 -1
- package/dist/styles/maxWidth/index.js +1 -1
- package/dist/styles/minHeight/index.js +1 -1
- package/dist/styles/minWidth/index.js +1 -1
- package/dist/styles/padding/index.js +1 -1
- package/dist/styles/position/index.js +1 -1
- package/dist/styles/radius/index.js +1 -1
- package/dist/styles/textAlign/index.js +1 -1
- package/dist/styles/width/index.js +1 -1
- package/dist/utilities/dom/event.d.ts +7 -0
- package/dist/utilities/dom/event.js +11 -0
- package/dist/utilities/dom/find.d.ts +6 -9
- package/dist/utilities/dom/find.js +17 -15
- package/dist/utilities/dom/index.d.ts +2 -1
- package/dist/utilities/dom/index.js +2 -1
- package/dist/utilities/helpers.d.ts +1 -15
- package/dist/utilities/helpers.js +11 -133
- package/dist/utilities/props.d.ts +13 -0
- package/dist/utilities/props.js +83 -0
- package/dist/utilities/scroll/lock.js +4 -3
- package/package.json +24 -24
- package/CHANGELOG-old.md +0 -14
- package/dist/components/Popover/tests/Popover.test.stories.d.ts +0 -39
- package/dist/components/Popover/tests/Popover.test.stories.js +0 -167
- package/dist/components/Slider/tests/Slider.test.stories.d.ts +0 -38
- package/dist/components/Slider/tests/Slider.test.stories.js +0 -150
- package/dist/components/_private/Flyout/Flyout.constants.d.ts +0 -3
- package/dist/components/_private/Flyout/Flyout.constants.js +0 -3
- package/dist/components/_private/Flyout/useFlyout.js +0 -211
- package/dist/components/_private/Flyout/utilities/calculatePosition.d.ts +0 -19
- package/dist/components/_private/Flyout/utilities/calculatePosition.js +0 -102
- package/dist/components/_private/Flyout/utilities/isFullyVisible.d.ts +0 -8
- package/dist/components/_private/Flyout/utilities/isFullyVisible.js +0 -16
- /package/dist/components/{_private/Flyout → Flyout}/Flyout.context.d.ts +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/Flyout.context.js +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/Flyout.d.ts +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/Flyout.js +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/Flyout.module.css +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/Flyout.types.js +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/FlyoutContent.d.ts +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/FlyoutControlled.d.ts +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/FlyoutTrigger.d.ts +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/FlyoutTrigger.js +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/FlyoutUncontrolled.d.ts +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/FlyoutUncontrolled.js +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/index.d.ts +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/index.js +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/utilities/cooldown.d.ts +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/utilities/cooldown.js +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/utilities/getPositionFallbacks.d.ts +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/utilities/getPositionFallbacks.js +0 -0
@@ -0,0 +1,79 @@
|
|
1
|
+
import { getRectFromCoordinates, getShadowRoot, findClosestPositionContainer } from "../../../utilities/dom/index.js";
|
2
|
+
import calculatePosition from "./calculatePosition.js";
|
3
|
+
import getPositionFallbacks from "./getPositionFallbacks.js";
|
4
|
+
import isFullyVisible from "./isFullyVisible.js";
|
5
|
+
import { resetStyles } from "../Flyout.constants.js";
|
6
|
+
/**
|
7
|
+
* Set position of the target element to fit on the screen
|
8
|
+
*/
|
9
|
+
const flyout = (args) => {
|
10
|
+
const { triggerEl, flyoutEl, triggerBounds: passedTriggerBounds, contentShift = 0, contentGap = 0, position, fallbackPositions, width, container: passedContainer, lastUsedFallback, onFallback, rtl, } = args;
|
11
|
+
const targetClone = flyoutEl.cloneNode(true);
|
12
|
+
const baseUnit = getComputedStyle(flyoutEl).getPropertyValue("--rs-unit-x1");
|
13
|
+
const unitModifier = baseUnit ? parseInt(baseUnit) : 4;
|
14
|
+
const triggerBounds = passedTriggerBounds || triggerEl?.getBoundingClientRect();
|
15
|
+
if (!triggerBounds)
|
16
|
+
return;
|
17
|
+
const resolvedTriggerBounds = getRectFromCoordinates(triggerBounds);
|
18
|
+
// Reset all styles applied on the previous hook execution
|
19
|
+
targetClone.style.cssText = "";
|
20
|
+
Object.keys(resetStyles).forEach((key) => {
|
21
|
+
const value = resetStyles[key];
|
22
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
23
|
+
// @ts-ignore
|
24
|
+
if (value)
|
25
|
+
targetClone.style[key] = value.toString();
|
26
|
+
});
|
27
|
+
if (width === "trigger") {
|
28
|
+
targetClone.style.width = `${resolvedTriggerBounds.width}px`;
|
29
|
+
}
|
30
|
+
else if (width && width !== "full") {
|
31
|
+
targetClone.style.width = width;
|
32
|
+
}
|
33
|
+
const shadowRoot = triggerEl && getShadowRoot(triggerEl);
|
34
|
+
// Insert inside shadow root if possible to make sure styles are applied correctly
|
35
|
+
(shadowRoot || document.body).appendChild(targetClone);
|
36
|
+
const cloneRect = targetClone.getBoundingClientRect();
|
37
|
+
const flyoutBounds = { width: cloneRect.width, height: cloneRect.height };
|
38
|
+
const closestFixedContainer = !passedContainer && triggerEl ? findClosestPositionContainer({ el: triggerEl }) : undefined;
|
39
|
+
const container = passedContainer ||
|
40
|
+
// Render inside fixed position container automatically to keep their position synced on scroll
|
41
|
+
closestFixedContainer ||
|
42
|
+
document.body;
|
43
|
+
const renderContainerBounds = container.getBoundingClientRect();
|
44
|
+
const visualContainerBounds = (passedContainer || document.body).getBoundingClientRect();
|
45
|
+
let calculated = null;
|
46
|
+
const testOrder = getPositionFallbacks(position, fallbackPositions);
|
47
|
+
testOrder.some((currentPosition) => {
|
48
|
+
const tested = calculatePosition({
|
49
|
+
triggerBounds: resolvedTriggerBounds,
|
50
|
+
flyoutBounds,
|
51
|
+
containerBounds: renderContainerBounds,
|
52
|
+
position: currentPosition,
|
53
|
+
contentGap: contentGap * unitModifier,
|
54
|
+
contentShift: contentShift * unitModifier,
|
55
|
+
rtl,
|
56
|
+
width,
|
57
|
+
passedContainer,
|
58
|
+
});
|
59
|
+
const visible = isFullyVisible({
|
60
|
+
flyoutBounds: tested.boundaries,
|
61
|
+
visualContainerBounds,
|
62
|
+
renderContainerBounds,
|
63
|
+
container,
|
64
|
+
});
|
65
|
+
const validPosition = visible || fallbackPositions?.length === 0;
|
66
|
+
// Saving first try in case non of the options work
|
67
|
+
if (validPosition || lastUsedFallback === currentPosition) {
|
68
|
+
calculated = tested;
|
69
|
+
onFallback(currentPosition);
|
70
|
+
}
|
71
|
+
return validPosition;
|
72
|
+
});
|
73
|
+
if (!calculated) {
|
74
|
+
throw new Error(`[Reshaped] Can't calculate styles for the ${position} position`);
|
75
|
+
}
|
76
|
+
targetClone.parentNode?.removeChild(targetClone);
|
77
|
+
return calculated;
|
78
|
+
};
|
79
|
+
export default flyout;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
/**
|
2
|
+
* Check if element visually fits on the screen
|
3
|
+
*/
|
4
|
+
declare const isFullyVisible: (args: {
|
5
|
+
flyoutBounds: Pick<DOMRect, "left" | "top" | "width" | "height">;
|
6
|
+
visualContainerBounds: DOMRect;
|
7
|
+
renderContainerBounds: DOMRect;
|
8
|
+
container: HTMLElement;
|
9
|
+
}) => boolean;
|
10
|
+
export default isFullyVisible;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
/**
|
2
|
+
* Check if element visually fits on the screen
|
3
|
+
*/
|
4
|
+
const isFullyVisible = (args) => {
|
5
|
+
const { flyoutBounds, visualContainerBounds, renderContainerBounds, container } = args;
|
6
|
+
const scrollX = container === document.body ? window.scrollX : container.scrollLeft;
|
7
|
+
const scrollY = container === document.body ? window.scrollY : container.scrollTop;
|
8
|
+
if (renderContainerBounds.left + flyoutBounds.left - scrollX < visualContainerBounds.left) {
|
9
|
+
return false;
|
10
|
+
}
|
11
|
+
if (renderContainerBounds.top + flyoutBounds.top - scrollY < visualContainerBounds.top) {
|
12
|
+
return false;
|
13
|
+
}
|
14
|
+
if (renderContainerBounds.left + flyoutBounds.left + flyoutBounds.width - scrollX >
|
15
|
+
visualContainerBounds.right) {
|
16
|
+
return false;
|
17
|
+
}
|
18
|
+
if (renderContainerBounds.top + flyoutBounds.top + flyoutBounds.height - scrollY >
|
19
|
+
visualContainerBounds.bottom) {
|
20
|
+
return false;
|
21
|
+
}
|
22
|
+
return true;
|
23
|
+
};
|
24
|
+
export default isFullyVisible;
|
@@ -184,8 +184,6 @@ export declare const useFormControl: () => {
|
|
184
184
|
onProgressCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
185
185
|
onRateChange?: React.ReactEventHandler<HTMLElement> | undefined;
|
186
186
|
onRateChangeCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
187
|
-
onResize?: React.ReactEventHandler<HTMLElement> | undefined;
|
188
|
-
onResizeCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
189
187
|
onSeeked?: React.ReactEventHandler<HTMLElement> | undefined;
|
190
188
|
onSeekedCapture?: React.ReactEventHandler<HTMLElement> | undefined;
|
191
189
|
onSeeking?: React.ReactEventHandler<HTMLElement> | undefined;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import { classNames, responsiveVariables, responsivePropDependency } from "../../utilities/
|
2
|
+
import { classNames, responsiveVariables, responsivePropDependency } from "../../utilities/props.js";
|
3
3
|
import getAlignStyles from "../../styles/align/index.js";
|
4
4
|
import getJustifyStyles from "../../styles/justify/index.js";
|
5
5
|
import s from "./Grid.module.css";
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import { classNames, responsiveClassNames } from "../../utilities/
|
2
|
+
import { classNames, responsiveClassNames } from "../../utilities/props.js";
|
3
3
|
import s from "./Hidden.module.css";
|
4
4
|
const Hidden = (props) => {
|
5
5
|
const { as: TagName = "div", children, visibility, hide } = props;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import Text from "../Text/index.js";
|
3
|
-
import { classNames } from "../../utilities/
|
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,6 +1,6 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import React from "react";
|
3
|
-
import { classNames } from "../../utilities/
|
3
|
+
import { classNames } from "../../utilities/props.js";
|
4
4
|
import getHeightStyles from "../../styles/height/index.js";
|
5
5
|
import s from "./Icon.module.css";
|
6
6
|
const Icon = (props) => {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use client";
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
3
3
|
import React from "react";
|
4
|
-
import { classNames } from "../../utilities/
|
4
|
+
import { classNames } from "../../utilities/props.js";
|
5
5
|
import s from "./Image.module.css";
|
6
6
|
import getRadiusStyles from "../../styles/radius/index.js";
|
7
7
|
import getWidthStyles from "../../styles/width/index.js";
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { type ActionableRef } from "../Actionable";
|
2
|
-
declare const Link: import("react").ForwardRefExoticComponent<Pick<import("../Actionable").ActionableProps, "disabled" | "
|
2
|
+
declare const Link: import("react").ForwardRefExoticComponent<Pick<import("../Actionable").ActionableProps, "disabled" | "children" | "className" | "attributes" | "type" | "href" | "onClick" | "stopPropagation"> & {
|
3
3
|
icon?: import("../Icon").IconProps["svg"];
|
4
4
|
color?: "inherit" | "critical" | "primary" | "positive" | "warning";
|
5
5
|
variant?: "plain" | "underline";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import { forwardRef } from "react";
|
3
|
-
import { classNames } from "../../utilities/
|
3
|
+
import { classNames } from "../../utilities/props.js";
|
4
4
|
import Actionable from "../Actionable/index.js";
|
5
5
|
import Icon from "../Icon/index.js";
|
6
6
|
import s from "./Link.module.css";
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import { classNames, responsiveClassNames } from "../../utilities/
|
2
|
+
import { classNames, responsiveClassNames } from "../../utilities/props.js";
|
3
3
|
import s from "./Loader.module.css";
|
4
4
|
const Loader = (props) => {
|
5
5
|
const { size = "small", color = "primary", className, attributes } = props;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import { forwardRef } from "react";
|
3
|
-
import { classNames, responsiveClassNames, responsivePropDependency } from "../../utilities/
|
3
|
+
import { classNames, responsiveClassNames, responsivePropDependency } from "../../utilities/props.js";
|
4
4
|
import Actionable from "../Actionable/index.js";
|
5
5
|
import Icon from "../Icon/index.js";
|
6
6
|
import View from "../View/index.js";
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use client";
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
3
3
|
import React from "react";
|
4
|
-
import { classNames, responsiveVariables, responsiveClassNames } from "../../utilities/
|
4
|
+
import { classNames, responsiveVariables, responsiveClassNames } from "../../utilities/props.js";
|
5
5
|
import { enableUserSelect, disableUserSelect } from "../../utilities/dom/index.js";
|
6
6
|
import { enableScroll, disableScroll } from "../../utilities/scroll/index.js";
|
7
7
|
import useResponsiveClientValue from "../../hooks/useResponsiveClientValue.js";
|
@@ -13,7 +13,7 @@ import useElementId from "../../hooks/useElementId.js";
|
|
13
13
|
import useHotkeys from "../../hooks/useHotkeys.js";
|
14
14
|
import useHandlerRef from "../../hooks/useHandlerRef.js";
|
15
15
|
import * as keys from "../../constants/keys.js";
|
16
|
-
import { responsiveClassNames, responsivePropDependency } from "../../utilities/
|
16
|
+
import { responsiveClassNames, responsivePropDependency } from "../../utilities/props.js";
|
17
17
|
import s from "./NumberField.module.css";
|
18
18
|
const NumberFieldControlled = (props) => {
|
19
19
|
const { increaseAriaLabel, decreaseAriaLabel, min, max, step = 1, name, value, onChange, size = "medium", ...textFieldProps } = props;
|
@@ -2,7 +2,7 @@
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
3
3
|
import React from "react";
|
4
4
|
import { onNextFrame } from "../../utilities/animation.js";
|
5
|
-
import { classNames } from "../../utilities/
|
5
|
+
import { classNames } from "../../utilities/props.js";
|
6
6
|
import { TrapFocus } from "../../utilities/a11y/index.js";
|
7
7
|
import useToggle from "../../hooks/useToggle.js";
|
8
8
|
import useIsomorphicLayoutEffect from "../../hooks/useIsomorphicLayoutEffect.js";
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use client";
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
3
3
|
import React from "react";
|
4
|
-
import { responsivePropDependency } from "../../utilities/
|
4
|
+
import { responsivePropDependency } from "../../utilities/props.js";
|
5
5
|
import View from "../View/index.js";
|
6
6
|
import Text from "../Text/index.js";
|
7
7
|
import useHotkeys from "../../hooks/useHotkeys.js";
|
@@ -1,15 +1,15 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import { classNames } from "../../utilities/
|
3
|
-
import Flyout, { useFlyoutContext } from "../
|
2
|
+
import { classNames } from "../../utilities/props.js";
|
3
|
+
import Flyout, { useFlyoutContext } from "../Flyout/index.js";
|
4
4
|
import Dismissible from "../Dismissible/index.js";
|
5
5
|
import s from "./Popover.module.css";
|
6
6
|
import getPaddingStyles from "../../styles/padding/index.js";
|
7
7
|
const Popover = (props) => {
|
8
|
-
const { width, variant = "elevated", triggerType = "click", position = "bottom", ...flyoutProps } = props;
|
8
|
+
const { width, variant = "elevated", triggerType = "click", position = "bottom", elevation, ...flyoutProps } = props;
|
9
9
|
const padding = props.padding ?? (variant === "headless" ? 0 : 4);
|
10
10
|
const trapFocusMode = props.trapFocusMode || (triggerType === "hover" ? "content-menu" : undefined);
|
11
11
|
const paddingStyles = getPaddingStyles(padding);
|
12
|
-
const contentClassName = classNames(s.content, !!width && s["content--has-width"], variant && s[`content--variant-${variant}`]);
|
12
|
+
const contentClassName = classNames(s.content, !!width && s["content--has-width"], variant && s[`content--variant-${variant}`], elevation && s[`content--elevation-${elevation}`]);
|
13
13
|
return (_jsx(Flyout, { ...flyoutProps, position: position, trapFocusMode: trapFocusMode, triggerType: triggerType, width: width, contentClassName: contentClassName, contentAttributes: { style: { ...paddingStyles?.variables } } }));
|
14
14
|
};
|
15
15
|
const PopoverDismissible = (props) => {
|
@@ -1 +1 @@
|
|
1
|
-
.content{max-width:360px}.content--variant-elevated{background:var(--rs-color-background-elevation-overlay);border:1px solid var(--rs-color-border-neutral-faded);border-radius:var(--rs-radius-medium);box-shadow:var(--rs-shadow-overlay);color:var(--rs-color-foreground-neutral);min-width:220px;overflow:hidden}.content.content--has-width{max-width:none;min-width:0}@media (--rs-viewport-s ){.content{max-width:none}}
|
1
|
+
.content{max-width:360px}.content--variant-elevated{background:var(--rs-color-background-elevation-overlay);border:1px solid var(--rs-color-border-neutral-faded);border-radius:var(--rs-radius-medium);box-shadow:var(--rs-shadow-overlay);color:var(--rs-color-foreground-neutral);min-width:220px;overflow:hidden}.content--variant-elevated.content--elevation-raised{box-shadow:var(--rs-shadow-raised)}.content.content--has-width{max-width:none;min-width:0}@media (--rs-viewport-s ){.content{max-width:none}}
|
@@ -1,8 +1,10 @@
|
|
1
1
|
import type React from "react";
|
2
|
-
import type { FlyoutProps, FlyoutInstance } from "../
|
2
|
+
import type { FlyoutProps, FlyoutInstance } from "../Flyout";
|
3
3
|
export type Instance = FlyoutInstance;
|
4
4
|
export type Props = Pick<FlyoutProps, "id" | "position" | "forcePosition" | "fallbackPositions" | "onOpen" | "onClose" | "width" | "trapFocusMode" | "active" | "defaultActive" | "contentGap" | "contentShift" | "instanceRef" | "triggerType" | "disableHideAnimation" | "disableContentHover" | "disableCloseOnOutsideClick" | "containerRef" | "initialFocusRef" | "originCoordinates"> & {
|
5
5
|
children?: React.ReactNode;
|
6
6
|
padding?: number;
|
7
|
+
elevation?: "raised" | "overlay";
|
8
|
+
/** @deprecated use Flyout utility instead, will be removed in v4 */
|
7
9
|
variant?: "elevated" | "headless";
|
8
10
|
};
|
@@ -1,9 +1,11 @@
|
|
1
|
+
import { StoryObj } from "@storybook/react";
|
2
|
+
import { fn } from "@storybook/test";
|
1
3
|
declare const _default: {
|
2
4
|
title: string;
|
3
5
|
component: import("react").FC<import("./..").PopoverProps> & {
|
4
6
|
Dismissible: import("react").FC<import("../../Dismissible").DismissibleProps>;
|
5
|
-
Trigger: import("react").FC<import("../../
|
6
|
-
Content: import("react").FC<import("../../
|
7
|
+
Trigger: import("react").FC<import("../../Flyout").FlyoutTriggerProps>;
|
8
|
+
Content: import("react").FC<import("../../Flyout").FlyoutContentProps>;
|
7
9
|
};
|
8
10
|
parameters: {
|
9
11
|
iframe: {
|
@@ -12,10 +14,47 @@ declare const _default: {
|
|
12
14
|
};
|
13
15
|
};
|
14
16
|
export default _default;
|
15
|
-
export declare const position:
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
export declare const
|
20
|
-
|
21
|
-
|
17
|
+
export declare const position: {
|
18
|
+
name: string;
|
19
|
+
render: () => import("react").JSX.Element;
|
20
|
+
};
|
21
|
+
export declare const widthNumber: {
|
22
|
+
name: string;
|
23
|
+
render: () => import("react").JSX.Element;
|
24
|
+
};
|
25
|
+
export declare const widthFull: {
|
26
|
+
name: string;
|
27
|
+
render: () => import("react").JSX.Element;
|
28
|
+
};
|
29
|
+
export declare const padding: {
|
30
|
+
name: string;
|
31
|
+
render: () => import("react").JSX.Element;
|
32
|
+
};
|
33
|
+
export declare const elevation: {
|
34
|
+
name: string;
|
35
|
+
render: () => import("react").JSX.Element;
|
36
|
+
};
|
37
|
+
export declare const defaultActive: StoryObj<{
|
38
|
+
handleOpen: ReturnType<typeof fn>;
|
39
|
+
handleClose: ReturnType<typeof fn>;
|
40
|
+
}>;
|
41
|
+
export declare const active: StoryObj<{
|
42
|
+
handleOpen: ReturnType<typeof fn>;
|
43
|
+
handleClose: ReturnType<typeof fn>;
|
44
|
+
}>;
|
45
|
+
export declare const activeFalse: StoryObj<{
|
46
|
+
handleOpen: ReturnType<typeof fn>;
|
47
|
+
handleClose: ReturnType<typeof fn>;
|
48
|
+
}>;
|
49
|
+
export declare const dismissible: StoryObj<{
|
50
|
+
handleClose: ReturnType<typeof fn>;
|
51
|
+
}>;
|
52
|
+
export declare const className: StoryObj;
|
53
|
+
export declare const testWithTooltip: {
|
54
|
+
name: string;
|
55
|
+
render: () => import("react").JSX.Element;
|
56
|
+
};
|
57
|
+
export declare const variant: {
|
58
|
+
name: string;
|
59
|
+
render: () => import("react").JSX.Element;
|
60
|
+
};
|