@yahoo/uds 3.115.0 → 3.116.0-beta.2
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/automated-config/dist/generated/autoVariants.cjs +10 -0
- package/dist/automated-config/dist/generated/autoVariants.d.cts +10 -0
- package/dist/automated-config/dist/generated/autoVariants.d.ts +10 -0
- package/dist/automated-config/dist/generated/autoVariants.js +10 -0
- package/dist/automated-config/dist/generated/generatedConfigs.cjs +1842 -0
- package/dist/automated-config/dist/generated/generatedConfigs.d.cts +194 -1
- package/dist/automated-config/dist/generated/generatedConfigs.d.ts +194 -1
- package/dist/automated-config/dist/generated/generatedConfigs.js +1842 -1
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.cjs +78 -0
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.cts +2 -1
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.ts +2 -1
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.js +78 -0
- package/dist/cli/commands/sync.cjs +6 -0
- package/dist/cli/commands/sync.js +6 -0
- package/dist/components/SvgFloatingOverlay.cjs +122 -0
- package/dist/components/SvgFloatingOverlay.d.cts +42 -0
- package/dist/components/SvgFloatingOverlay.d.ts +42 -0
- package/dist/components/SvgFloatingOverlay.js +120 -0
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +1 -1
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +1 -1
- package/dist/components/client/Popover/Popover.cjs +96 -0
- package/dist/components/client/Popover/Popover.d.cts +55 -0
- package/dist/components/client/Popover/Popover.d.ts +55 -0
- package/dist/components/client/Popover/Popover.js +94 -0
- package/dist/components/client/Popover/PopoverContent.cjs +171 -0
- package/dist/components/client/Popover/PopoverContent.d.cts +26 -0
- package/dist/components/client/Popover/PopoverContent.d.ts +26 -0
- package/dist/components/client/Popover/PopoverContent.js +169 -0
- package/dist/components/client/Popover/PopoverContext.cjs +11 -0
- package/dist/components/client/Popover/PopoverContext.d.cts +21 -0
- package/dist/components/client/Popover/PopoverContext.d.ts +21 -0
- package/dist/components/client/Popover/PopoverContext.js +9 -0
- package/dist/components/client/Popover/PopoverTrigger.cjs +26 -0
- package/dist/components/client/Popover/PopoverTrigger.d.cts +14 -0
- package/dist/components/client/Popover/PopoverTrigger.d.ts +14 -0
- package/dist/components/client/Popover/PopoverTrigger.js +24 -0
- package/dist/components/client/Popover/UDSPopoverConfigProvider.cjs +40 -0
- package/dist/components/client/Popover/UDSPopoverConfigProvider.d.cts +28 -0
- package/dist/components/client/Popover/UDSPopoverConfigProvider.d.ts +28 -0
- package/dist/components/client/Popover/UDSPopoverConfigProvider.js +37 -0
- package/dist/components/client/Popover/index.cjs +12 -0
- package/dist/components/client/Popover/index.d.cts +7 -0
- package/dist/components/client/Popover/index.d.ts +7 -0
- package/dist/components/client/Popover/index.js +8 -0
- package/dist/components/client/Toast/Toast.cjs +3 -3
- package/dist/components/client/Toast/Toast.d.cts +1 -1
- package/dist/components/client/Toast/Toast.d.ts +1 -1
- package/dist/components/client/Toast/Toast.js +3 -3
- package/dist/components/client/Toast/UDSToastConfigProvider.d.cts +5 -5
- package/dist/components/client/Toast/UDSToastConfigProvider.d.ts +5 -5
- package/dist/components/client/Toast/index.d.cts +1 -1
- package/dist/components/client/Toast/index.d.ts +1 -1
- package/dist/components/client/Tooltip/Tooltip.cjs +6 -6
- package/dist/components/client/Tooltip/Tooltip.d.cts +1 -1
- package/dist/components/client/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/client/Tooltip/Tooltip.js +6 -6
- package/dist/components/client/Tooltip/TooltipContent.cjs +55 -119
- package/dist/components/client/Tooltip/TooltipContent.js +56 -120
- package/dist/components/client/Tooltip/tooltipContext.cjs +0 -1
- package/dist/components/client/Tooltip/tooltipContext.d.cts +1 -2
- package/dist/components/client/Tooltip/tooltipContext.d.ts +1 -2
- package/dist/components/client/Tooltip/tooltipContext.js +0 -1
- package/dist/components/client/index.cjs +8 -0
- package/dist/components/client/index.d.cts +10 -5
- package/dist/components/client/index.d.ts +10 -5
- package/dist/components/client/index.js +5 -1
- package/dist/components/client/providers/UDSConfigProvider.cjs +6 -2
- package/dist/components/client/providers/UDSConfigProvider.d.cts +2 -1
- package/dist/components/client/providers/UDSConfigProvider.d.ts +2 -1
- package/dist/components/client/providers/UDSConfigProvider.js +6 -2
- package/dist/components/experimental/client/{Popover.cjs → ExperimentalPopover.cjs} +10 -1
- package/dist/components/experimental/client/ExperimentalPopover.d.cts +40 -0
- package/dist/components/experimental/client/ExperimentalPopover.d.ts +40 -0
- package/dist/components/experimental/client/{Popover.js → ExperimentalPopover.js} +10 -1
- package/dist/components/experimental/client/index.cjs +10 -10
- package/dist/components/experimental/client/index.d.cts +2 -2
- package/dist/components/experimental/client/index.d.ts +2 -2
- package/dist/components/experimental/client/index.js +1 -1
- package/dist/components/experimental/index.cjs +19 -19
- package/dist/components/experimental/index.d.cts +2 -2
- package/dist/components/experimental/index.d.ts +2 -2
- package/dist/components/experimental/index.js +1 -1
- package/dist/components/index.cjs +12 -0
- package/dist/components/index.d.cts +9 -5
- package/dist/components/index.d.ts +9 -5
- package/dist/components/index.js +9 -1
- package/dist/config/dist/index.cjs +79 -1
- package/dist/config/dist/index.js +79 -1
- package/dist/{components/client/Tooltip/useTooltipContent.cjs → hooks/useSvgFloatingContent.cjs} +81 -48
- package/dist/hooks/useSvgFloatingContent.d.cts +74 -0
- package/dist/hooks/useSvgFloatingContent.d.ts +74 -0
- package/dist/{components/client/Tooltip/useTooltipContent.js → hooks/useSvgFloatingContent.js} +76 -43
- package/dist/index.cjs +21 -10
- package/dist/index.d.cts +15 -10
- package/dist/index.d.ts +15 -10
- package/dist/index.js +16 -11
- package/dist/runtime/index.cjs +2 -0
- package/dist/runtime/index.d.cts +3 -2
- package/dist/runtime/index.d.ts +3 -2
- package/dist/runtime/index.js +2 -1
- package/dist/runtime/popoverConfig.cjs +41 -0
- package/dist/runtime/popoverConfig.d.cts +24 -0
- package/dist/runtime/popoverConfig.d.ts +24 -0
- package/dist/runtime/popoverConfig.js +40 -0
- package/dist/runtime/udsConfig.cjs +3 -1
- package/dist/runtime/udsConfig.d.cts +3 -1
- package/dist/runtime/udsConfig.d.ts +3 -1
- package/dist/runtime/udsConfig.js +3 -1
- package/dist/styles/styler.d.cts +90 -80
- package/dist/styles/styler.d.ts +90 -80
- package/dist/styles/variants.d.cts +30 -0
- package/dist/styles/variants.d.ts +30 -0
- package/dist/tailwind/dist/tailwind/plugins/components.cjs +1 -0
- package/dist/tailwind/dist/tailwind/plugins/components.js +2 -1
- package/dist/tokens/automation/configs/index.cjs +1 -0
- package/dist/tokens/automation/configs/index.d.cts +2 -2
- package/dist/tokens/automation/configs/index.d.ts +2 -2
- package/dist/tokens/automation/configs/index.js +2 -2
- package/dist/tokens/automation/index.cjs +1 -0
- package/dist/tokens/automation/index.d.cts +2 -2
- package/dist/tokens/automation/index.d.ts +2 -2
- package/dist/tokens/automation/index.js +2 -2
- package/dist/tokens/index.cjs +2 -1
- package/dist/tokens/index.d.cts +3 -3
- package/dist/tokens/index.d.ts +3 -3
- package/dist/tokens/index.js +3 -3
- package/dist/tokens/types.d.cts +2 -2
- package/dist/tokens/types.d.ts +2 -2
- package/dist/types/dist/index.d.cts +51 -1
- package/dist/types/dist/index.d.ts +51 -1
- package/dist/uds/generated/componentData.cjs +298 -139
- package/dist/uds/generated/componentData.js +263 -140
- package/dist/uds/generated/tailwindPurge.cjs +52 -26
- package/dist/uds/generated/tailwindPurge.js +52 -26
- package/dist/utils/parseShadow.cjs +120 -0
- package/dist/utils/parseShadow.d.cts +33 -0
- package/dist/utils/parseShadow.d.ts +33 -0
- package/dist/utils/parseShadow.js +118 -0
- package/dist/utils/svgFloatingContentUtils.cjs +121 -0
- package/dist/{components/client/Tooltip/util.d.cts → utils/svgFloatingContentUtils.d.cts} +25 -62
- package/dist/{components/client/Tooltip/util.d.ts → utils/svgFloatingContentUtils.d.ts} +25 -62
- package/dist/utils/svgFloatingContentUtils.js +117 -0
- package/generated/componentData.json +337 -185
- package/generated/tailwindPurge.ts +50 -27
- package/package.json +1 -1
- package/dist/components/client/Tooltip/useTooltipContent.d.cts +0 -66
- package/dist/components/client/Tooltip/useTooltipContent.d.ts +0 -66
- package/dist/components/client/Tooltip/util.cjs +0 -248
- package/dist/components/client/Tooltip/util.js +0 -240
- package/dist/components/experimental/client/Popover.d.cts +0 -29
- package/dist/components/experimental/client/Popover.d.ts +0 -29
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
5
|
+
const require_components_client_Popover_PopoverContext = require('./PopoverContext.cjs');
|
|
6
|
+
const require_components_client_Popover_UDSPopoverConfigProvider = require('./UDSPopoverConfigProvider.cjs');
|
|
7
|
+
let react = require("react");
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
let _ariakit_react = require("@ariakit/react");
|
|
10
|
+
let motion_react = require("motion/react");
|
|
11
|
+
|
|
12
|
+
//#region src/components/client/Popover/Popover.tsx
|
|
13
|
+
const POPOVER_OPEN_EVENT = "uds:popover-open";
|
|
14
|
+
/**
|
|
15
|
+
* **⚙️️ A Popover component that anchors to a trigger element
|
|
16
|
+
*
|
|
17
|
+
* @componentType Client component
|
|
18
|
+
*
|
|
19
|
+
* @description
|
|
20
|
+
* Popover is a floating surface used to display contextual content anchored to a trigger. It is typically used for lightweight interactions such as quick settings, inline actions, previews, and simple selection.
|
|
21
|
+
*
|
|
22
|
+
* Popover is a container component, the shell is consistent, but the content inside can vary widely depending on product needs.*
|
|
23
|
+
* @see
|
|
24
|
+
* Check out the {@link https://uds.build/docs/components/popover Popover Docs} for more info
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* 'use client';
|
|
29
|
+
* import { Popover, PopoverTrigger, PopoverContent, Button } from "@yahoo/uds";
|
|
30
|
+
*
|
|
31
|
+
* <Popover>
|
|
32
|
+
* <PopoverTrigger>
|
|
33
|
+
* <Button>Popover Trigger</Button>
|
|
34
|
+
* </PopoverTrigger>
|
|
35
|
+
* <PopoverContent>basic popover content</PopoverContent>
|
|
36
|
+
* </Popover>
|
|
37
|
+
*```
|
|
38
|
+
*
|
|
39
|
+
* @related [Toast](https://uds.build/docs/components/toast), [Tooltip](https://uds.build/docs/components/tooltip)
|
|
40
|
+
**/
|
|
41
|
+
function Popover({ children, placement, open, defaultOpen = false, portal = true, hideArrow = false, hideDismissButton = false, onClose, onOpen, reduceMotion: forceReduceMotion = false, disableAutoFocus = false, disableVerticalSpacing = false, disableHorizontalSpacing = false, sameWidth = false, gutter = 4 }) {
|
|
42
|
+
const controlledProps = open !== void 0 ? {
|
|
43
|
+
showTimeout: 0,
|
|
44
|
+
hideTimeout: 0,
|
|
45
|
+
timeout: 0,
|
|
46
|
+
...open ? { mounted: true } : {}
|
|
47
|
+
} : void 0;
|
|
48
|
+
const { animationDuration: animationDurationConfig, ariaKitPlacement } = require_components_client_Popover_UDSPopoverConfigProvider.usePopoverConfig({ placement });
|
|
49
|
+
const id = (0, react.useId)();
|
|
50
|
+
const store = (0, _ariakit_react.usePopoverStore)({ defaultOpen });
|
|
51
|
+
const handleSetOpen = (0, react.useCallback)((newOpen) => {
|
|
52
|
+
if (newOpen) {
|
|
53
|
+
onOpen?.();
|
|
54
|
+
document.dispatchEvent(new CustomEvent(POPOVER_OPEN_EVENT, { detail: id }));
|
|
55
|
+
}
|
|
56
|
+
}, [onOpen, id]);
|
|
57
|
+
(0, react.useEffect)(() => {
|
|
58
|
+
const handler = (e) => {
|
|
59
|
+
if (("detail" in e ? e.detail : void 0) !== id) store?.setState("open", false);
|
|
60
|
+
};
|
|
61
|
+
document.addEventListener(POPOVER_OPEN_EVENT, handler);
|
|
62
|
+
return () => document.removeEventListener(POPOVER_OPEN_EVENT, handler);
|
|
63
|
+
}, [id, store]);
|
|
64
|
+
const isControlled = open !== void 0;
|
|
65
|
+
const reducedMotion = (0, motion_react.useReducedMotion)() || forceReduceMotion;
|
|
66
|
+
const animationDuration = reducedMotion ? 0 : animationDurationConfig;
|
|
67
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Popover_PopoverContext.PopoverInternalContext.Provider, {
|
|
68
|
+
value: {
|
|
69
|
+
portal,
|
|
70
|
+
hideArrow,
|
|
71
|
+
hideDismissButton,
|
|
72
|
+
onClose,
|
|
73
|
+
isControlled,
|
|
74
|
+
animationDuration,
|
|
75
|
+
reducedMotion,
|
|
76
|
+
disableAutoFocus,
|
|
77
|
+
disableVerticalSpacing,
|
|
78
|
+
disableHorizontalSpacing,
|
|
79
|
+
sameWidth,
|
|
80
|
+
gutter
|
|
81
|
+
},
|
|
82
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ariakit_react.PopoverProvider, {
|
|
83
|
+
placement: ariaKitPlacement,
|
|
84
|
+
animated: animationDuration,
|
|
85
|
+
open,
|
|
86
|
+
setOpen: handleSetOpen,
|
|
87
|
+
store,
|
|
88
|
+
...controlledProps,
|
|
89
|
+
children
|
|
90
|
+
})
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
Popover.displayName = "Popover";
|
|
94
|
+
|
|
95
|
+
//#endregion
|
|
96
|
+
exports.Popover = Popover;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
|
|
2
|
+
import { UniversalPopoverProps } from "../../../types/dist/index.cjs";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/components/client/Popover/Popover.d.ts
|
|
6
|
+
type PopoverProps = UniversalPopoverProps;
|
|
7
|
+
/**
|
|
8
|
+
* **⚙️️ A Popover component that anchors to a trigger element
|
|
9
|
+
*
|
|
10
|
+
* @componentType Client component
|
|
11
|
+
*
|
|
12
|
+
* @description
|
|
13
|
+
* Popover is a floating surface used to display contextual content anchored to a trigger. It is typically used for lightweight interactions such as quick settings, inline actions, previews, and simple selection.
|
|
14
|
+
*
|
|
15
|
+
* Popover is a container component, the shell is consistent, but the content inside can vary widely depending on product needs.*
|
|
16
|
+
* @see
|
|
17
|
+
* Check out the {@link https://uds.build/docs/components/popover Popover Docs} for more info
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* 'use client';
|
|
22
|
+
* import { Popover, PopoverTrigger, PopoverContent, Button } from "@yahoo/uds";
|
|
23
|
+
*
|
|
24
|
+
* <Popover>
|
|
25
|
+
* <PopoverTrigger>
|
|
26
|
+
* <Button>Popover Trigger</Button>
|
|
27
|
+
* </PopoverTrigger>
|
|
28
|
+
* <PopoverContent>basic popover content</PopoverContent>
|
|
29
|
+
* </Popover>
|
|
30
|
+
*```
|
|
31
|
+
*
|
|
32
|
+
* @related [Toast](https://uds.build/docs/components/toast), [Tooltip](https://uds.build/docs/components/tooltip)
|
|
33
|
+
**/
|
|
34
|
+
declare function Popover({
|
|
35
|
+
children,
|
|
36
|
+
placement,
|
|
37
|
+
open,
|
|
38
|
+
defaultOpen,
|
|
39
|
+
portal,
|
|
40
|
+
hideArrow,
|
|
41
|
+
hideDismissButton,
|
|
42
|
+
onClose,
|
|
43
|
+
onOpen,
|
|
44
|
+
reduceMotion: forceReduceMotion,
|
|
45
|
+
disableAutoFocus,
|
|
46
|
+
disableVerticalSpacing,
|
|
47
|
+
disableHorizontalSpacing,
|
|
48
|
+
sameWidth,
|
|
49
|
+
gutter
|
|
50
|
+
}: PopoverProps): react_jsx_runtime0.JSX.Element;
|
|
51
|
+
declare namespace Popover {
|
|
52
|
+
var displayName: string;
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { Popover };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
|
|
2
|
+
import { UniversalPopoverProps } from "../../../types/dist/index.js";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/components/client/Popover/Popover.d.ts
|
|
6
|
+
type PopoverProps = UniversalPopoverProps;
|
|
7
|
+
/**
|
|
8
|
+
* **⚙️️ A Popover component that anchors to a trigger element
|
|
9
|
+
*
|
|
10
|
+
* @componentType Client component
|
|
11
|
+
*
|
|
12
|
+
* @description
|
|
13
|
+
* Popover is a floating surface used to display contextual content anchored to a trigger. It is typically used for lightweight interactions such as quick settings, inline actions, previews, and simple selection.
|
|
14
|
+
*
|
|
15
|
+
* Popover is a container component, the shell is consistent, but the content inside can vary widely depending on product needs.*
|
|
16
|
+
* @see
|
|
17
|
+
* Check out the {@link https://uds.build/docs/components/popover Popover Docs} for more info
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* 'use client';
|
|
22
|
+
* import { Popover, PopoverTrigger, PopoverContent, Button } from "@yahoo/uds";
|
|
23
|
+
*
|
|
24
|
+
* <Popover>
|
|
25
|
+
* <PopoverTrigger>
|
|
26
|
+
* <Button>Popover Trigger</Button>
|
|
27
|
+
* </PopoverTrigger>
|
|
28
|
+
* <PopoverContent>basic popover content</PopoverContent>
|
|
29
|
+
* </Popover>
|
|
30
|
+
*```
|
|
31
|
+
*
|
|
32
|
+
* @related [Toast](https://uds.build/docs/components/toast), [Tooltip](https://uds.build/docs/components/tooltip)
|
|
33
|
+
**/
|
|
34
|
+
declare function Popover({
|
|
35
|
+
children,
|
|
36
|
+
placement,
|
|
37
|
+
open,
|
|
38
|
+
defaultOpen,
|
|
39
|
+
portal,
|
|
40
|
+
hideArrow,
|
|
41
|
+
hideDismissButton,
|
|
42
|
+
onClose,
|
|
43
|
+
onOpen,
|
|
44
|
+
reduceMotion: forceReduceMotion,
|
|
45
|
+
disableAutoFocus,
|
|
46
|
+
disableVerticalSpacing,
|
|
47
|
+
disableHorizontalSpacing,
|
|
48
|
+
sameWidth,
|
|
49
|
+
gutter
|
|
50
|
+
}: PopoverProps): react_jsx_runtime0.JSX.Element;
|
|
51
|
+
declare namespace Popover {
|
|
52
|
+
var displayName: string;
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { Popover };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
3
|
+
import { PopoverInternalContext } from "./PopoverContext.js";
|
|
4
|
+
import { usePopoverConfig } from "./UDSPopoverConfigProvider.js";
|
|
5
|
+
import { useCallback, useEffect, useId } from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { PopoverProvider, usePopoverStore } from "@ariakit/react";
|
|
8
|
+
import { useReducedMotion } from "motion/react";
|
|
9
|
+
|
|
10
|
+
//#region src/components/client/Popover/Popover.tsx
|
|
11
|
+
const POPOVER_OPEN_EVENT = "uds:popover-open";
|
|
12
|
+
/**
|
|
13
|
+
* **⚙️️ A Popover component that anchors to a trigger element
|
|
14
|
+
*
|
|
15
|
+
* @componentType Client component
|
|
16
|
+
*
|
|
17
|
+
* @description
|
|
18
|
+
* Popover is a floating surface used to display contextual content anchored to a trigger. It is typically used for lightweight interactions such as quick settings, inline actions, previews, and simple selection.
|
|
19
|
+
*
|
|
20
|
+
* Popover is a container component, the shell is consistent, but the content inside can vary widely depending on product needs.*
|
|
21
|
+
* @see
|
|
22
|
+
* Check out the {@link https://uds.build/docs/components/popover Popover Docs} for more info
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* 'use client';
|
|
27
|
+
* import { Popover, PopoverTrigger, PopoverContent, Button } from "@yahoo/uds";
|
|
28
|
+
*
|
|
29
|
+
* <Popover>
|
|
30
|
+
* <PopoverTrigger>
|
|
31
|
+
* <Button>Popover Trigger</Button>
|
|
32
|
+
* </PopoverTrigger>
|
|
33
|
+
* <PopoverContent>basic popover content</PopoverContent>
|
|
34
|
+
* </Popover>
|
|
35
|
+
*```
|
|
36
|
+
*
|
|
37
|
+
* @related [Toast](https://uds.build/docs/components/toast), [Tooltip](https://uds.build/docs/components/tooltip)
|
|
38
|
+
**/
|
|
39
|
+
function Popover({ children, placement, open, defaultOpen = false, portal = true, hideArrow = false, hideDismissButton = false, onClose, onOpen, reduceMotion: forceReduceMotion = false, disableAutoFocus = false, disableVerticalSpacing = false, disableHorizontalSpacing = false, sameWidth = false, gutter = 4 }) {
|
|
40
|
+
const controlledProps = open !== void 0 ? {
|
|
41
|
+
showTimeout: 0,
|
|
42
|
+
hideTimeout: 0,
|
|
43
|
+
timeout: 0,
|
|
44
|
+
...open ? { mounted: true } : {}
|
|
45
|
+
} : void 0;
|
|
46
|
+
const { animationDuration: animationDurationConfig, ariaKitPlacement } = usePopoverConfig({ placement });
|
|
47
|
+
const id = useId();
|
|
48
|
+
const store = usePopoverStore({ defaultOpen });
|
|
49
|
+
const handleSetOpen = useCallback((newOpen) => {
|
|
50
|
+
if (newOpen) {
|
|
51
|
+
onOpen?.();
|
|
52
|
+
document.dispatchEvent(new CustomEvent(POPOVER_OPEN_EVENT, { detail: id }));
|
|
53
|
+
}
|
|
54
|
+
}, [onOpen, id]);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
const handler = (e) => {
|
|
57
|
+
if (("detail" in e ? e.detail : void 0) !== id) store?.setState("open", false);
|
|
58
|
+
};
|
|
59
|
+
document.addEventListener(POPOVER_OPEN_EVENT, handler);
|
|
60
|
+
return () => document.removeEventListener(POPOVER_OPEN_EVENT, handler);
|
|
61
|
+
}, [id, store]);
|
|
62
|
+
const isControlled = open !== void 0;
|
|
63
|
+
const reducedMotion = useReducedMotion() || forceReduceMotion;
|
|
64
|
+
const animationDuration = reducedMotion ? 0 : animationDurationConfig;
|
|
65
|
+
return /* @__PURE__ */ jsx(PopoverInternalContext.Provider, {
|
|
66
|
+
value: {
|
|
67
|
+
portal,
|
|
68
|
+
hideArrow,
|
|
69
|
+
hideDismissButton,
|
|
70
|
+
onClose,
|
|
71
|
+
isControlled,
|
|
72
|
+
animationDuration,
|
|
73
|
+
reducedMotion,
|
|
74
|
+
disableAutoFocus,
|
|
75
|
+
disableVerticalSpacing,
|
|
76
|
+
disableHorizontalSpacing,
|
|
77
|
+
sameWidth,
|
|
78
|
+
gutter
|
|
79
|
+
},
|
|
80
|
+
children: /* @__PURE__ */ jsx(PopoverProvider, {
|
|
81
|
+
placement: ariaKitPlacement,
|
|
82
|
+
animated: animationDuration,
|
|
83
|
+
open,
|
|
84
|
+
setOpen: handleSetOpen,
|
|
85
|
+
store,
|
|
86
|
+
...controlledProps,
|
|
87
|
+
children
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
Popover.displayName = "Popover";
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
export { Popover };
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
5
|
+
const require_index = require('../../../fixtures/dist/index.cjs');
|
|
6
|
+
const require_styles_styler = require('../../../styles/styler.cjs');
|
|
7
|
+
const require_components_Box = require('../../Box.cjs');
|
|
8
|
+
const require_components_IconSlot = require('../../IconSlot.cjs');
|
|
9
|
+
const require_components_client_Pressable = require('../Pressable.cjs');
|
|
10
|
+
const require_components_client_Popover_PopoverContext = require('./PopoverContext.cjs');
|
|
11
|
+
const require_components_client_Popover_UDSPopoverConfigProvider = require('./UDSPopoverConfigProvider.cjs');
|
|
12
|
+
const require_hooks_useForkRef = require('../../../hooks/useForkRef.cjs');
|
|
13
|
+
const require_hooks_useSvgFloatingContent = require('../../../hooks/useSvgFloatingContent.cjs');
|
|
14
|
+
const require_components_SvgFloatingOverlay = require('../../SvgFloatingOverlay.cjs');
|
|
15
|
+
let react = require("react");
|
|
16
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
17
|
+
let _yahoo_uds_icons = require("@yahoo/uds-icons");
|
|
18
|
+
let _ariakit_react = require("@ariakit/react");
|
|
19
|
+
|
|
20
|
+
//#region src/components/client/Popover/PopoverContent.tsx
|
|
21
|
+
const ARROW_HEIGHT = 12;
|
|
22
|
+
const ARROW_WIDTH = 22;
|
|
23
|
+
const ARROW_TIP_RADIUS_FRACTION = .3;
|
|
24
|
+
const PopoverContent = (0, react.forwardRef)(function PopoverContent({ children, className, closeIcon = _yahoo_uds_icons.Cross, slotProps, maxWidth, maxHeight }, ref) {
|
|
25
|
+
const store = (0, _ariakit_react.usePopoverContext)();
|
|
26
|
+
const open = (0, _ariakit_react.useStoreState)(store, "open");
|
|
27
|
+
const internalContext = (0, react.useContext)(require_components_client_Popover_PopoverContext.PopoverInternalContext);
|
|
28
|
+
const disableVerticalSpacing = internalContext?.disableVerticalSpacing ?? false;
|
|
29
|
+
const disableHorizontalSpacing = internalContext?.disableHorizontalSpacing ?? false;
|
|
30
|
+
const sameWidth = internalContext?.sameWidth ?? false;
|
|
31
|
+
const gutter = internalContext?.gutter ?? 4;
|
|
32
|
+
const currentPlacement = (0, _ariakit_react.useStoreState)(store, "currentPlacement");
|
|
33
|
+
const placement = (0, _ariakit_react.useStoreState)(store, "placement");
|
|
34
|
+
const effectivePlacement = currentPlacement ?? placement ?? "top";
|
|
35
|
+
const { borderRadius, gap, spacingHorizontal, spacingVertical, dismissButtonSize } = require_components_client_Popover_UDSPopoverConfigProvider.usePopoverConfig();
|
|
36
|
+
const defaultBorderRadius = borderRadius["default"];
|
|
37
|
+
const defaultGap = gap["default"];
|
|
38
|
+
const defaultSpacingHorizontal = spacingHorizontal["default"];
|
|
39
|
+
const defaultSpacingVertical = spacingVertical["default"];
|
|
40
|
+
const defaultDismissButtonSize = dismissButtonSize["default"];
|
|
41
|
+
const arrowRef = (0, react.useRef)(null);
|
|
42
|
+
const reducedMotion = internalContext ? internalContext.reducedMotion : false;
|
|
43
|
+
const animationDuration = reducedMotion || !internalContext ? 0 : internalContext.animationDuration;
|
|
44
|
+
const { internalRef, shift, onPositionUpdate, ...svgFloatingContentProps } = require_hooks_useSvgFloatingContent.useSvgFloatingContent({
|
|
45
|
+
open: open ?? false,
|
|
46
|
+
effectivePlacement,
|
|
47
|
+
borderRadius: defaultBorderRadius,
|
|
48
|
+
arrowRef,
|
|
49
|
+
animationDuration,
|
|
50
|
+
hideArrow: internalContext?.hideArrow,
|
|
51
|
+
arrowWidth: ARROW_WIDTH,
|
|
52
|
+
arrowHeight: ARROW_HEIGHT,
|
|
53
|
+
arrowTipRadiusFraction: ARROW_TIP_RADIUS_FRACTION
|
|
54
|
+
});
|
|
55
|
+
const mergedRef = require_hooks_useForkRef.useForkRef(ref, internalRef);
|
|
56
|
+
const { className: closeIconClassName, ...closeIconProps } = slotProps?.closeIcon ?? {};
|
|
57
|
+
const { className: closeIconContainerClassName, ...closeIconContainerProps } = slotProps?.closeIconContainer ?? {};
|
|
58
|
+
const classNames = {
|
|
59
|
+
root: require_styles_styler.getStyles({
|
|
60
|
+
popoverSizeRoot: "default",
|
|
61
|
+
popoverVariantRoot: "default",
|
|
62
|
+
display: "flex",
|
|
63
|
+
position: "relative",
|
|
64
|
+
className: require_styles_styler.cx("z-[9999]", "outline-none", "focus-visible:outline-none", className)
|
|
65
|
+
}),
|
|
66
|
+
contentWrapper: require_styles_styler.getStyles({
|
|
67
|
+
display: "block",
|
|
68
|
+
spacingTop: disableVerticalSpacing ? "0" : defaultSpacingVertical,
|
|
69
|
+
spacingStart: disableHorizontalSpacing ? "0" : defaultSpacingHorizontal,
|
|
70
|
+
spacingBottom: disableVerticalSpacing ? "0" : defaultSpacingVertical,
|
|
71
|
+
spacingEnd: internalContext?.hideDismissButton ? disableHorizontalSpacing ? "0" : defaultSpacingHorizontal : void 0
|
|
72
|
+
}),
|
|
73
|
+
svgBase: require_styles_styler.getStyles({
|
|
74
|
+
popoverSizeSvgBase: "default",
|
|
75
|
+
popoverVariantSvgBase: "default",
|
|
76
|
+
className: require_styles_styler.cx("uds-bgBlurFillFallback")
|
|
77
|
+
}),
|
|
78
|
+
svgBorder: require_styles_styler.getStyles({
|
|
79
|
+
popoverSizeSvgBorder: "default",
|
|
80
|
+
popoverVariantSvgBorder: "default"
|
|
81
|
+
}),
|
|
82
|
+
blur: require_styles_styler.getStyles({
|
|
83
|
+
popoverVariantBlur: "default",
|
|
84
|
+
position: "absolute",
|
|
85
|
+
width: "full",
|
|
86
|
+
height: "full",
|
|
87
|
+
className: require_styles_styler.cx("uds-bgBlurFallback", "top-0", "left-0", "z-[1]")
|
|
88
|
+
}),
|
|
89
|
+
closeIconContainer: require_styles_styler.getStyles({
|
|
90
|
+
flexShrink: "0",
|
|
91
|
+
borderRadius: "full",
|
|
92
|
+
alignItems: "center",
|
|
93
|
+
justifyContent: "center",
|
|
94
|
+
display: "flex",
|
|
95
|
+
className: require_styles_styler.cx(reducedMotion ? "duration-0" : "duration-120", "transition-[background-color]", "bg-carbon-15/0", "hover:bg-carbon-15/10", "active:bg-carbon-15/15")
|
|
96
|
+
}),
|
|
97
|
+
closeIcon: require_styles_styler.getStyles({
|
|
98
|
+
popoverVariantCloseIcon: "default",
|
|
99
|
+
popoverSizeCloseIcon: "default"
|
|
100
|
+
})
|
|
101
|
+
};
|
|
102
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_ariakit_react.Popover, {
|
|
103
|
+
hideOnInteractOutside: (event) => {
|
|
104
|
+
if (internalContext && !internalContext.isControlled) return true;
|
|
105
|
+
internalContext?.onClose?.(event);
|
|
106
|
+
return false;
|
|
107
|
+
},
|
|
108
|
+
ref: mergedRef,
|
|
109
|
+
className: classNames.root,
|
|
110
|
+
portal: internalContext ? internalContext.portal : true,
|
|
111
|
+
gutter: internalContext?.hideArrow ? gutter : ARROW_HEIGHT + gutter,
|
|
112
|
+
updatePosition: onPositionUpdate,
|
|
113
|
+
style: {
|
|
114
|
+
...shift.x !== 0 || shift.y !== 0 ? { transform: `translate(${shift.x}px, ${shift.y}px)` } : {},
|
|
115
|
+
maxWidth,
|
|
116
|
+
maxHeight
|
|
117
|
+
},
|
|
118
|
+
onClose: internalContext?.onClose,
|
|
119
|
+
sameWidth,
|
|
120
|
+
autoFocusOnShow: !internalContext?.disableAutoFocus,
|
|
121
|
+
autoFocusOnHide: !internalContext?.disableAutoFocus,
|
|
122
|
+
children: [
|
|
123
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_SvgFloatingOverlay.SvgFloatingOverlay, {
|
|
124
|
+
blurClassName: classNames.blur,
|
|
125
|
+
svgClassNames: {
|
|
126
|
+
base: classNames.svgBase,
|
|
127
|
+
border: classNames.svgBorder
|
|
128
|
+
},
|
|
129
|
+
arrowHeight: ARROW_HEIGHT,
|
|
130
|
+
contentWrapperSlotProps: { alignItems: "flex-start" },
|
|
131
|
+
borderRadius: defaultBorderRadius,
|
|
132
|
+
svgBaseStyle: slotProps?.svgBase?.style,
|
|
133
|
+
svgBorderStyle: slotProps?.svgBorder?.style,
|
|
134
|
+
...svgFloatingContentProps,
|
|
135
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Box.Box, {
|
|
136
|
+
className: require_styles_styler.cx(classNames.contentWrapper),
|
|
137
|
+
style: { paddingInlineEnd: internalContext?.hideDismissButton || disableHorizontalSpacing ? void 0 : require_index.spacingMap[defaultGap] + require_index.spacingMap[defaultSpacingHorizontal] + defaultDismissButtonSize },
|
|
138
|
+
children
|
|
139
|
+
})
|
|
140
|
+
}),
|
|
141
|
+
!internalContext?.hideDismissButton && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ariakit_react.PopoverDismiss, { render: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Pressable.Pressable, {
|
|
142
|
+
className: require_styles_styler.cx(classNames.closeIconContainer, "absolute", "z-[4]", closeIconContainerClassName),
|
|
143
|
+
...closeIconContainerProps,
|
|
144
|
+
style: {
|
|
145
|
+
...closeIconContainerProps?.style,
|
|
146
|
+
top: require_index.spacingMap[defaultSpacingVertical],
|
|
147
|
+
insetInlineEnd: require_index.spacingMap[defaultSpacingHorizontal],
|
|
148
|
+
width: defaultDismissButtonSize,
|
|
149
|
+
height: defaultDismissButtonSize,
|
|
150
|
+
...svgFloatingContentProps.childTransitionStyle
|
|
151
|
+
},
|
|
152
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
153
|
+
icon: closeIcon,
|
|
154
|
+
iconProps: {
|
|
155
|
+
className: require_styles_styler.cx(classNames.closeIcon, closeIconClassName),
|
|
156
|
+
...closeIconProps
|
|
157
|
+
}
|
|
158
|
+
})
|
|
159
|
+
}) }),
|
|
160
|
+
!internalContext?.hideArrow && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ariakit_react.PopoverArrow, {
|
|
161
|
+
size: 1,
|
|
162
|
+
ref: arrowRef,
|
|
163
|
+
style: { opacity: 0 }
|
|
164
|
+
})
|
|
165
|
+
]
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
PopoverContent.displayName = "PopoverContent";
|
|
169
|
+
|
|
170
|
+
//#endregion
|
|
171
|
+
exports.PopoverContent = PopoverContent;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
import { IconPropsWithSVGProps, UniversalPopoverContentProps } from "../../../types/dist/index.cjs";
|
|
3
|
+
import { PressableProps } from "../Pressable.cjs";
|
|
4
|
+
import "../../../index.cjs";
|
|
5
|
+
import * as react from "react";
|
|
6
|
+
import { CSSProperties } from "react";
|
|
7
|
+
|
|
8
|
+
//#region src/components/client/Popover/PopoverContent.d.ts
|
|
9
|
+
type DataAttributes = {
|
|
10
|
+
[name: `data-${string}`]: string;
|
|
11
|
+
};
|
|
12
|
+
interface PopoverContentProps extends UniversalPopoverContentProps {
|
|
13
|
+
slotProps?: {
|
|
14
|
+
closeIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
15
|
+
closeIconContainer?: Partial<PressableProps & DataAttributes>;
|
|
16
|
+
svgBase?: {
|
|
17
|
+
style?: CSSProperties & Record<`--${string}`, string | undefined>;
|
|
18
|
+
};
|
|
19
|
+
svgBorder?: {
|
|
20
|
+
style?: CSSProperties & Record<`--${string}`, string | undefined>;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
declare const PopoverContent: react.ForwardRefExoticComponent<PopoverContentProps & react.RefAttributes<HTMLInputElement>>;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { PopoverContent };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
import { IconPropsWithSVGProps, UniversalPopoverContentProps } from "../../../types/dist/index.js";
|
|
3
|
+
import { PressableProps } from "../Pressable.js";
|
|
4
|
+
import "../../../index.js";
|
|
5
|
+
import * as react from "react";
|
|
6
|
+
import { CSSProperties } from "react";
|
|
7
|
+
|
|
8
|
+
//#region src/components/client/Popover/PopoverContent.d.ts
|
|
9
|
+
type DataAttributes = {
|
|
10
|
+
[name: `data-${string}`]: string;
|
|
11
|
+
};
|
|
12
|
+
interface PopoverContentProps extends UniversalPopoverContentProps {
|
|
13
|
+
slotProps?: {
|
|
14
|
+
closeIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
15
|
+
closeIconContainer?: Partial<PressableProps & DataAttributes>;
|
|
16
|
+
svgBase?: {
|
|
17
|
+
style?: CSSProperties & Record<`--${string}`, string | undefined>;
|
|
18
|
+
};
|
|
19
|
+
svgBorder?: {
|
|
20
|
+
style?: CSSProperties & Record<`--${string}`, string | undefined>;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
declare const PopoverContent: react.ForwardRefExoticComponent<PopoverContentProps & react.RefAttributes<HTMLInputElement>>;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { PopoverContent };
|