@yahoo/uds 3.116.0-beta.2 → 3.116.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/dist/automated-config/dist/generated/autoVariants.cjs +0 -10
- package/dist/automated-config/dist/generated/autoVariants.d.cts +0 -10
- package/dist/automated-config/dist/generated/autoVariants.d.ts +0 -10
- package/dist/automated-config/dist/generated/autoVariants.js +0 -10
- package/dist/automated-config/dist/generated/generatedConfigs.cjs +0 -1842
- package/dist/automated-config/dist/generated/generatedConfigs.d.cts +1 -194
- package/dist/automated-config/dist/generated/generatedConfigs.d.ts +1 -194
- package/dist/automated-config/dist/generated/generatedConfigs.js +1 -1842
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.cjs +0 -78
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.cts +1 -2
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.ts +1 -2
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.js +0 -78
- package/dist/cli/commands/sync.cjs +0 -6
- package/dist/cli/commands/sync.js +0 -6
- 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 +119 -55
- package/dist/components/client/Tooltip/TooltipContent.js +120 -56
- package/dist/components/client/Tooltip/tooltipContext.cjs +1 -0
- package/dist/components/client/Tooltip/tooltipContext.d.cts +2 -1
- package/dist/components/client/Tooltip/tooltipContext.d.ts +2 -1
- package/dist/components/client/Tooltip/tooltipContext.js +1 -0
- package/dist/{hooks/useSvgFloatingContent.cjs → components/client/Tooltip/useTooltipContent.cjs} +48 -81
- package/dist/components/client/Tooltip/useTooltipContent.d.cts +66 -0
- package/dist/components/client/Tooltip/useTooltipContent.d.ts +66 -0
- package/dist/{hooks/useSvgFloatingContent.js → components/client/Tooltip/useTooltipContent.js} +43 -76
- package/dist/components/client/Tooltip/util.cjs +248 -0
- package/dist/{utils/svgFloatingContentUtils.d.cts → components/client/Tooltip/util.d.cts} +62 -25
- package/dist/{utils/svgFloatingContentUtils.d.ts → components/client/Tooltip/util.d.ts} +62 -25
- package/dist/components/client/Tooltip/util.js +240 -0
- package/dist/components/client/index.cjs +0 -8
- package/dist/components/client/index.d.cts +5 -10
- package/dist/components/client/index.d.ts +5 -10
- package/dist/components/client/index.js +1 -5
- package/dist/components/client/providers/UDSConfigProvider.cjs +2 -6
- package/dist/components/client/providers/UDSConfigProvider.d.cts +1 -2
- package/dist/components/client/providers/UDSConfigProvider.d.ts +1 -2
- package/dist/components/client/providers/UDSConfigProvider.js +2 -6
- package/dist/components/experimental/client/{ExperimentalPopover.cjs → Popover.cjs} +1 -10
- package/dist/components/experimental/client/Popover.d.cts +29 -0
- package/dist/components/experimental/client/Popover.d.ts +29 -0
- package/dist/components/experimental/client/{ExperimentalPopover.js → Popover.js} +1 -10
- 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 +0 -12
- package/dist/components/index.d.cts +5 -9
- package/dist/components/index.d.ts +5 -9
- package/dist/components/index.js +1 -9
- package/dist/config/dist/index.cjs +1 -79
- package/dist/config/dist/index.js +1 -79
- package/dist/index.cjs +10 -21
- package/dist/index.d.cts +10 -15
- package/dist/index.d.ts +10 -15
- package/dist/index.js +11 -16
- package/dist/runtime/index.cjs +0 -2
- package/dist/runtime/index.d.cts +2 -3
- package/dist/runtime/index.d.ts +2 -3
- package/dist/runtime/index.js +1 -2
- package/dist/runtime/udsConfig.cjs +1 -3
- package/dist/runtime/udsConfig.d.cts +1 -3
- package/dist/runtime/udsConfig.d.ts +1 -3
- package/dist/runtime/udsConfig.js +1 -3
- package/dist/styles/styler.d.cts +96 -106
- package/dist/styles/styler.d.ts +96 -106
- package/dist/styles/variants.d.cts +0 -30
- package/dist/styles/variants.d.ts +0 -30
- package/dist/tailwind/dist/commands/css.helpers.cjs +6 -2
- package/dist/tailwind/dist/commands/css.helpers.js +6 -2
- package/dist/tailwind/dist/commands/generateComponentData.cjs +2 -0
- package/dist/tailwind/dist/commands/generateComponentData.js +3 -1
- package/dist/tailwind/dist/commands/generatePurgeCSSData.cjs +3 -8
- package/dist/tailwind/dist/commands/generatePurgeCSSData.js +3 -8
- package/dist/tailwind/dist/commands/purge.cjs +2 -2
- package/dist/tailwind/dist/commands/purge.js +2 -2
- package/dist/tailwind/dist/css/generate.cjs +6 -4
- package/dist/tailwind/dist/css/generate.helpers.cjs +4 -1
- package/dist/tailwind/dist/css/generate.helpers.js +4 -1
- package/dist/tailwind/dist/css/generate.js +7 -5
- package/dist/tailwind/dist/css/nodeUtils.cjs +30 -2
- package/dist/tailwind/dist/css/nodeUtils.js +30 -3
- package/dist/tailwind/dist/css/runner.cjs +52 -19
- package/dist/tailwind/dist/css/runner.helpers.cjs +2 -2
- package/dist/tailwind/dist/css/runner.helpers.js +2 -2
- package/dist/tailwind/dist/css/runner.js +53 -20
- package/dist/tailwind/dist/css/theme.d.cts +2 -2
- package/dist/tailwind/dist/css/theme.d.ts +2 -2
- package/dist/tailwind/dist/purger/legacy/purgeCSS.cjs +19 -8
- package/dist/tailwind/dist/purger/legacy/purgeCSS.js +19 -8
- package/dist/tailwind/dist/purger/optimized/purge.cjs +2 -1
- package/dist/tailwind/dist/purger/optimized/purge.js +2 -1
- package/dist/tailwind/dist/purger/optimized/purgeFromCode.cjs +22 -2
- package/dist/tailwind/dist/purger/optimized/purgeFromCode.js +22 -2
- package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.cjs +5 -4
- package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.js +5 -4
- package/dist/tailwind/dist/purger/optimized/utils/files.cjs +12 -10
- package/dist/tailwind/dist/purger/optimized/utils/files.js +12 -9
- package/dist/tailwind/dist/tailwind/plugins/components.cjs +0 -1
- package/dist/tailwind/dist/tailwind/plugins/components.js +1 -2
- package/dist/tailwind/dist/tailwind/plugins/getTailwindAsUdsColors.cjs +294 -10
- package/dist/tailwind/dist/tailwind/plugins/getTailwindAsUdsColors.js +294 -9
- package/dist/tailwind/dist/utils/entryPoints.cjs +63 -0
- package/dist/tailwind/dist/utils/entryPoints.js +55 -0
- package/dist/tokens/automation/configs/index.cjs +0 -1
- 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 +0 -1
- 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 +1 -2
- 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 +1 -51
- package/dist/types/dist/index.d.ts +1 -51
- package/dist/uds/generated/componentData.cjs +887 -1029
- package/dist/uds/generated/componentData.js +840 -952
- package/dist/uds/generated/tailwindPurge.cjs +221 -247
- package/dist/uds/generated/tailwindPurge.js +221 -247
- package/dist/uds/package.cjs +1 -1
- package/dist/uds/package.js +1 -1
- package/generated/componentData.json +1195 -1337
- package/generated/tailwindPurge.ts +5 -4604
- package/package.json +2 -2
- package/dist/components/SvgFloatingOverlay.cjs +0 -122
- package/dist/components/SvgFloatingOverlay.d.cts +0 -42
- package/dist/components/SvgFloatingOverlay.d.ts +0 -42
- package/dist/components/SvgFloatingOverlay.js +0 -120
- package/dist/components/client/Popover/Popover.cjs +0 -96
- package/dist/components/client/Popover/Popover.d.cts +0 -55
- package/dist/components/client/Popover/Popover.d.ts +0 -55
- package/dist/components/client/Popover/Popover.js +0 -94
- package/dist/components/client/Popover/PopoverContent.cjs +0 -171
- package/dist/components/client/Popover/PopoverContent.d.cts +0 -26
- package/dist/components/client/Popover/PopoverContent.d.ts +0 -26
- package/dist/components/client/Popover/PopoverContent.js +0 -169
- package/dist/components/client/Popover/PopoverContext.cjs +0 -11
- package/dist/components/client/Popover/PopoverContext.d.cts +0 -21
- package/dist/components/client/Popover/PopoverContext.d.ts +0 -21
- package/dist/components/client/Popover/PopoverContext.js +0 -9
- package/dist/components/client/Popover/PopoverTrigger.cjs +0 -26
- package/dist/components/client/Popover/PopoverTrigger.d.cts +0 -14
- package/dist/components/client/Popover/PopoverTrigger.d.ts +0 -14
- package/dist/components/client/Popover/PopoverTrigger.js +0 -24
- package/dist/components/client/Popover/UDSPopoverConfigProvider.cjs +0 -40
- package/dist/components/client/Popover/UDSPopoverConfigProvider.d.cts +0 -28
- package/dist/components/client/Popover/UDSPopoverConfigProvider.d.ts +0 -28
- package/dist/components/client/Popover/UDSPopoverConfigProvider.js +0 -37
- package/dist/components/client/Popover/index.cjs +0 -12
- package/dist/components/client/Popover/index.d.cts +0 -7
- package/dist/components/client/Popover/index.d.ts +0 -7
- package/dist/components/client/Popover/index.js +0 -8
- package/dist/components/experimental/client/ExperimentalPopover.d.cts +0 -40
- package/dist/components/experimental/client/ExperimentalPopover.d.ts +0 -40
- package/dist/hooks/useSvgFloatingContent.d.cts +0 -74
- package/dist/hooks/useSvgFloatingContent.d.ts +0 -74
- package/dist/runtime/popoverConfig.cjs +0 -41
- package/dist/runtime/popoverConfig.d.cts +0 -24
- package/dist/runtime/popoverConfig.d.ts +0 -24
- package/dist/runtime/popoverConfig.js +0 -40
- package/dist/tailwind/dist/.prettierrc.cjs +0 -13
- package/dist/tailwind/dist/.prettierrc.js +0 -12
- package/dist/utils/parseShadow.cjs +0 -120
- package/dist/utils/parseShadow.d.cts +0 -33
- package/dist/utils/parseShadow.d.ts +0 -33
- package/dist/utils/parseShadow.js +0 -118
- package/dist/utils/svgFloatingContentUtils.cjs +0 -121
- package/dist/utils/svgFloatingContentUtils.js +0 -117
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yahoo/uds",
|
|
3
3
|
"description": "Yahoo Universal System",
|
|
4
|
-
"version": "3.116.0
|
|
4
|
+
"version": "3.116.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -206,9 +206,9 @@
|
|
|
206
206
|
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist && rm -rf .coverage",
|
|
207
207
|
"dev": "concurrently bun:dev:*",
|
|
208
208
|
"dev:fixtures": "bun run ./scripts/buildFixtures.ts --watch",
|
|
209
|
-
"dev:purgeCSSData": "bun run ./scripts/generatePurgeCSSData.ts --watch",
|
|
210
209
|
"dev:ts": "tsdown --watch",
|
|
211
210
|
"format:pkg": "bun --cwd ../../ syncpack format",
|
|
211
|
+
"generate:componentData": "bun run ./src/cli/runner.ts generateComponentData",
|
|
212
212
|
"lint": "eslint -c eslint.config.mjs .",
|
|
213
213
|
"lint:fix": "bun run lint --fix",
|
|
214
214
|
"lint:pkg": "bun publint",
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
4
|
-
const require_styles_styler = require('../styles/styler.cjs');
|
|
5
|
-
const require_components_Box = require('./Box.cjs');
|
|
6
|
-
let react = require("react");
|
|
7
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
-
|
|
9
|
-
//#region src/components/SvgFloatingOverlay.tsx
|
|
10
|
-
const SvgFloatingOverlay = ({ blurClassName, blurStyle, childTransitionStyle, svgPath, dimensions, shadows, svgClassNames, shadowFilterId, shadowPadding, arrowHeight, contentWrapperSlotProps, children, borderRadius, svgBaseStyle, svgBorderStyle }) => {
|
|
11
|
-
const svgSharedProps = {
|
|
12
|
-
"aria-hidden": true,
|
|
13
|
-
style: childTransitionStyle,
|
|
14
|
-
viewBox: `0 0 ${dimensions.width} ${dimensions.height}`
|
|
15
|
-
};
|
|
16
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
17
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Box.Box, {
|
|
18
|
-
className: blurClassName,
|
|
19
|
-
style: {
|
|
20
|
-
...blurStyle,
|
|
21
|
-
...childTransitionStyle
|
|
22
|
-
}
|
|
23
|
-
}),
|
|
24
|
-
svgPath && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
25
|
-
...svgSharedProps,
|
|
26
|
-
className: require_styles_styler.cx("absolute top-0 left-0 w-full h-full overflow-visible pointer-events-none", "z-[2]"),
|
|
27
|
-
children: [
|
|
28
|
-
shadows.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("defs", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("filter", {
|
|
29
|
-
id: shadowFilterId,
|
|
30
|
-
filterUnits: "userSpaceOnUse",
|
|
31
|
-
x: -(shadowPadding + arrowHeight),
|
|
32
|
-
y: -(shadowPadding + arrowHeight),
|
|
33
|
-
width: dimensions.width + 2 * (shadowPadding + arrowHeight),
|
|
34
|
-
height: dimensions.height + 2 * (shadowPadding + arrowHeight),
|
|
35
|
-
colorInterpolationFilters: "sRGB",
|
|
36
|
-
children: [
|
|
37
|
-
shadows.map((shadow, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [
|
|
38
|
-
shadow.spread !== 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("feMorphology", {
|
|
39
|
-
in: "SourceAlpha",
|
|
40
|
-
operator: shadow.spread > 0 ? "dilate" : "erode",
|
|
41
|
-
radius: Math.abs(shadow.spread),
|
|
42
|
-
result: `spread${i}`
|
|
43
|
-
}),
|
|
44
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("feGaussianBlur", {
|
|
45
|
-
in: shadow.spread !== 0 ? `spread${i}` : "SourceAlpha",
|
|
46
|
-
stdDeviation: shadow.blur / 2,
|
|
47
|
-
result: `blurred${i}`
|
|
48
|
-
}),
|
|
49
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("feOffset", {
|
|
50
|
-
in: `blurred${i}`,
|
|
51
|
-
dx: shadow.x,
|
|
52
|
-
dy: shadow.y,
|
|
53
|
-
result: `offset${i}`
|
|
54
|
-
}),
|
|
55
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("feFlood", {
|
|
56
|
-
floodColor: shadow.color,
|
|
57
|
-
result: `color${i}`
|
|
58
|
-
}),
|
|
59
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("feComposite", {
|
|
60
|
-
in: `color${i}`,
|
|
61
|
-
in2: `offset${i}`,
|
|
62
|
-
operator: "in",
|
|
63
|
-
result: `shadow${i}`
|
|
64
|
-
})
|
|
65
|
-
] }, i)),
|
|
66
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("feMerge", {
|
|
67
|
-
result: "mergedShadows",
|
|
68
|
-
children: shadows.map((_, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("feMergeNode", { in: `shadow${i}` }, i))
|
|
69
|
-
}),
|
|
70
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("feComposite", {
|
|
71
|
-
in: "mergedShadows",
|
|
72
|
-
in2: "SourceAlpha",
|
|
73
|
-
operator: "out"
|
|
74
|
-
})
|
|
75
|
-
]
|
|
76
|
-
}) }),
|
|
77
|
-
shadows.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
78
|
-
d: svgPath,
|
|
79
|
-
fill: "black",
|
|
80
|
-
filter: `url(#${shadowFilterId})`
|
|
81
|
-
}),
|
|
82
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
83
|
-
d: svgPath,
|
|
84
|
-
className: svgClassNames.base,
|
|
85
|
-
style: svgBaseStyle
|
|
86
|
-
})
|
|
87
|
-
]
|
|
88
|
-
}),
|
|
89
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Box.Box, {
|
|
90
|
-
position: "relative",
|
|
91
|
-
flexGrow: "1",
|
|
92
|
-
overflow: "hidden",
|
|
93
|
-
className: require_styles_styler.cx("z-[3]", "max-h-full", contentWrapperSlotProps?.className),
|
|
94
|
-
style: {
|
|
95
|
-
...childTransitionStyle,
|
|
96
|
-
borderRadius
|
|
97
|
-
},
|
|
98
|
-
...contentWrapperSlotProps,
|
|
99
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Box.Box, {
|
|
100
|
-
overflow: "auto",
|
|
101
|
-
flexGrow: "1",
|
|
102
|
-
display: "block",
|
|
103
|
-
className: "max-h-full",
|
|
104
|
-
children
|
|
105
|
-
})
|
|
106
|
-
}),
|
|
107
|
-
svgPath && svgClassNames.border && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
108
|
-
...svgSharedProps,
|
|
109
|
-
className: require_styles_styler.cx("absolute top-0 left-0 w-full h-full overflow-visible pointer-events-none", "z-[3]"),
|
|
110
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
111
|
-
d: svgPath,
|
|
112
|
-
className: svgClassNames.border,
|
|
113
|
-
fill: "transparent",
|
|
114
|
-
style: svgBorderStyle
|
|
115
|
-
})
|
|
116
|
-
})
|
|
117
|
-
] });
|
|
118
|
-
};
|
|
119
|
-
SvgFloatingOverlay.displayName = "SvgFloatingOverlay";
|
|
120
|
-
|
|
121
|
-
//#endregion
|
|
122
|
-
exports.SvgFloatingOverlay = SvgFloatingOverlay;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { BoxProps } from "./Box.cjs";
|
|
3
|
-
import { UseSvgFloatingContentReturn } from "../hooks/useSvgFloatingContent.cjs";
|
|
4
|
-
import { CSSProperties } from "react";
|
|
5
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
|
-
|
|
7
|
-
//#region src/components/SvgFloatingOverlay.d.ts
|
|
8
|
-
interface SvgFloatingOverlayProps extends Pick<UseSvgFloatingContentReturn, 'blurStyle' | 'childTransitionStyle' | 'svgPath' | 'shadows' | 'shadowFilterId' | 'shadowPadding' | 'dimensions'> {
|
|
9
|
-
blurClassName: string;
|
|
10
|
-
svgClassNames: {
|
|
11
|
-
base: string;
|
|
12
|
-
border?: string;
|
|
13
|
-
};
|
|
14
|
-
arrowHeight: number;
|
|
15
|
-
children: React.ReactNode;
|
|
16
|
-
contentWrapperSlotProps?: Partial<BoxProps>;
|
|
17
|
-
borderRadius?: number;
|
|
18
|
-
svgBaseStyle?: CSSProperties;
|
|
19
|
-
svgBorderStyle?: CSSProperties;
|
|
20
|
-
}
|
|
21
|
-
declare const SvgFloatingOverlay: {
|
|
22
|
-
({
|
|
23
|
-
blurClassName,
|
|
24
|
-
blurStyle,
|
|
25
|
-
childTransitionStyle,
|
|
26
|
-
svgPath,
|
|
27
|
-
dimensions,
|
|
28
|
-
shadows,
|
|
29
|
-
svgClassNames,
|
|
30
|
-
shadowFilterId,
|
|
31
|
-
shadowPadding,
|
|
32
|
-
arrowHeight,
|
|
33
|
-
contentWrapperSlotProps,
|
|
34
|
-
children,
|
|
35
|
-
borderRadius,
|
|
36
|
-
svgBaseStyle,
|
|
37
|
-
svgBorderStyle
|
|
38
|
-
}: SvgFloatingOverlayProps): react_jsx_runtime0.JSX.Element;
|
|
39
|
-
displayName: string;
|
|
40
|
-
};
|
|
41
|
-
//#endregion
|
|
42
|
-
export { SvgFloatingOverlay };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { BoxProps } from "./Box.js";
|
|
3
|
-
import { UseSvgFloatingContentReturn } from "../hooks/useSvgFloatingContent.js";
|
|
4
|
-
import { CSSProperties } from "react";
|
|
5
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
|
-
|
|
7
|
-
//#region src/components/SvgFloatingOverlay.d.ts
|
|
8
|
-
interface SvgFloatingOverlayProps extends Pick<UseSvgFloatingContentReturn, 'blurStyle' | 'childTransitionStyle' | 'svgPath' | 'shadows' | 'shadowFilterId' | 'shadowPadding' | 'dimensions'> {
|
|
9
|
-
blurClassName: string;
|
|
10
|
-
svgClassNames: {
|
|
11
|
-
base: string;
|
|
12
|
-
border?: string;
|
|
13
|
-
};
|
|
14
|
-
arrowHeight: number;
|
|
15
|
-
children: React.ReactNode;
|
|
16
|
-
contentWrapperSlotProps?: Partial<BoxProps>;
|
|
17
|
-
borderRadius?: number;
|
|
18
|
-
svgBaseStyle?: CSSProperties;
|
|
19
|
-
svgBorderStyle?: CSSProperties;
|
|
20
|
-
}
|
|
21
|
-
declare const SvgFloatingOverlay: {
|
|
22
|
-
({
|
|
23
|
-
blurClassName,
|
|
24
|
-
blurStyle,
|
|
25
|
-
childTransitionStyle,
|
|
26
|
-
svgPath,
|
|
27
|
-
dimensions,
|
|
28
|
-
shadows,
|
|
29
|
-
svgClassNames,
|
|
30
|
-
shadowFilterId,
|
|
31
|
-
shadowPadding,
|
|
32
|
-
arrowHeight,
|
|
33
|
-
contentWrapperSlotProps,
|
|
34
|
-
children,
|
|
35
|
-
borderRadius,
|
|
36
|
-
svgBaseStyle,
|
|
37
|
-
svgBorderStyle
|
|
38
|
-
}: SvgFloatingOverlayProps): react_jsx_runtime0.JSX.Element;
|
|
39
|
-
displayName: string;
|
|
40
|
-
};
|
|
41
|
-
//#endregion
|
|
42
|
-
export { SvgFloatingOverlay };
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
-
import { cx } from "../styles/styler.js";
|
|
3
|
-
import { Box } from "./Box.js";
|
|
4
|
-
import { Fragment } from "react";
|
|
5
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
|
|
7
|
-
//#region src/components/SvgFloatingOverlay.tsx
|
|
8
|
-
const SvgFloatingOverlay = ({ blurClassName, blurStyle, childTransitionStyle, svgPath, dimensions, shadows, svgClassNames, shadowFilterId, shadowPadding, arrowHeight, contentWrapperSlotProps, children, borderRadius, svgBaseStyle, svgBorderStyle }) => {
|
|
9
|
-
const svgSharedProps = {
|
|
10
|
-
"aria-hidden": true,
|
|
11
|
-
style: childTransitionStyle,
|
|
12
|
-
viewBox: `0 0 ${dimensions.width} ${dimensions.height}`
|
|
13
|
-
};
|
|
14
|
-
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
15
|
-
/* @__PURE__ */ jsx(Box, {
|
|
16
|
-
className: blurClassName,
|
|
17
|
-
style: {
|
|
18
|
-
...blurStyle,
|
|
19
|
-
...childTransitionStyle
|
|
20
|
-
}
|
|
21
|
-
}),
|
|
22
|
-
svgPath && /* @__PURE__ */ jsxs("svg", {
|
|
23
|
-
...svgSharedProps,
|
|
24
|
-
className: cx("absolute top-0 left-0 w-full h-full overflow-visible pointer-events-none", "z-[2]"),
|
|
25
|
-
children: [
|
|
26
|
-
shadows.length > 0 && /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("filter", {
|
|
27
|
-
id: shadowFilterId,
|
|
28
|
-
filterUnits: "userSpaceOnUse",
|
|
29
|
-
x: -(shadowPadding + arrowHeight),
|
|
30
|
-
y: -(shadowPadding + arrowHeight),
|
|
31
|
-
width: dimensions.width + 2 * (shadowPadding + arrowHeight),
|
|
32
|
-
height: dimensions.height + 2 * (shadowPadding + arrowHeight),
|
|
33
|
-
colorInterpolationFilters: "sRGB",
|
|
34
|
-
children: [
|
|
35
|
-
shadows.map((shadow, i) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
36
|
-
shadow.spread !== 0 && /* @__PURE__ */ jsx("feMorphology", {
|
|
37
|
-
in: "SourceAlpha",
|
|
38
|
-
operator: shadow.spread > 0 ? "dilate" : "erode",
|
|
39
|
-
radius: Math.abs(shadow.spread),
|
|
40
|
-
result: `spread${i}`
|
|
41
|
-
}),
|
|
42
|
-
/* @__PURE__ */ jsx("feGaussianBlur", {
|
|
43
|
-
in: shadow.spread !== 0 ? `spread${i}` : "SourceAlpha",
|
|
44
|
-
stdDeviation: shadow.blur / 2,
|
|
45
|
-
result: `blurred${i}`
|
|
46
|
-
}),
|
|
47
|
-
/* @__PURE__ */ jsx("feOffset", {
|
|
48
|
-
in: `blurred${i}`,
|
|
49
|
-
dx: shadow.x,
|
|
50
|
-
dy: shadow.y,
|
|
51
|
-
result: `offset${i}`
|
|
52
|
-
}),
|
|
53
|
-
/* @__PURE__ */ jsx("feFlood", {
|
|
54
|
-
floodColor: shadow.color,
|
|
55
|
-
result: `color${i}`
|
|
56
|
-
}),
|
|
57
|
-
/* @__PURE__ */ jsx("feComposite", {
|
|
58
|
-
in: `color${i}`,
|
|
59
|
-
in2: `offset${i}`,
|
|
60
|
-
operator: "in",
|
|
61
|
-
result: `shadow${i}`
|
|
62
|
-
})
|
|
63
|
-
] }, i)),
|
|
64
|
-
/* @__PURE__ */ jsx("feMerge", {
|
|
65
|
-
result: "mergedShadows",
|
|
66
|
-
children: shadows.map((_, i) => /* @__PURE__ */ jsx("feMergeNode", { in: `shadow${i}` }, i))
|
|
67
|
-
}),
|
|
68
|
-
/* @__PURE__ */ jsx("feComposite", {
|
|
69
|
-
in: "mergedShadows",
|
|
70
|
-
in2: "SourceAlpha",
|
|
71
|
-
operator: "out"
|
|
72
|
-
})
|
|
73
|
-
]
|
|
74
|
-
}) }),
|
|
75
|
-
shadows.length > 0 && /* @__PURE__ */ jsx("path", {
|
|
76
|
-
d: svgPath,
|
|
77
|
-
fill: "black",
|
|
78
|
-
filter: `url(#${shadowFilterId})`
|
|
79
|
-
}),
|
|
80
|
-
/* @__PURE__ */ jsx("path", {
|
|
81
|
-
d: svgPath,
|
|
82
|
-
className: svgClassNames.base,
|
|
83
|
-
style: svgBaseStyle
|
|
84
|
-
})
|
|
85
|
-
]
|
|
86
|
-
}),
|
|
87
|
-
/* @__PURE__ */ jsx(Box, {
|
|
88
|
-
position: "relative",
|
|
89
|
-
flexGrow: "1",
|
|
90
|
-
overflow: "hidden",
|
|
91
|
-
className: cx("z-[3]", "max-h-full", contentWrapperSlotProps?.className),
|
|
92
|
-
style: {
|
|
93
|
-
...childTransitionStyle,
|
|
94
|
-
borderRadius
|
|
95
|
-
},
|
|
96
|
-
...contentWrapperSlotProps,
|
|
97
|
-
children: /* @__PURE__ */ jsx(Box, {
|
|
98
|
-
overflow: "auto",
|
|
99
|
-
flexGrow: "1",
|
|
100
|
-
display: "block",
|
|
101
|
-
className: "max-h-full",
|
|
102
|
-
children
|
|
103
|
-
})
|
|
104
|
-
}),
|
|
105
|
-
svgPath && svgClassNames.border && /* @__PURE__ */ jsx("svg", {
|
|
106
|
-
...svgSharedProps,
|
|
107
|
-
className: cx("absolute top-0 left-0 w-full h-full overflow-visible pointer-events-none", "z-[3]"),
|
|
108
|
-
children: /* @__PURE__ */ jsx("path", {
|
|
109
|
-
d: svgPath,
|
|
110
|
-
className: svgClassNames.border,
|
|
111
|
-
fill: "transparent",
|
|
112
|
-
style: svgBorderStyle
|
|
113
|
-
})
|
|
114
|
-
})
|
|
115
|
-
] });
|
|
116
|
-
};
|
|
117
|
-
SvgFloatingOverlay.displayName = "SvgFloatingOverlay";
|
|
118
|
-
|
|
119
|
-
//#endregion
|
|
120
|
-
export { SvgFloatingOverlay };
|
|
@@ -1,96 +0,0 @@
|
|
|
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;
|
|
@@ -1,55 +0,0 @@
|
|
|
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 };
|
|
@@ -1,55 +0,0 @@
|
|
|
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 };
|
|
@@ -1,94 +0,0 @@
|
|
|
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 };
|