@arun-dev/headless 4.3.0 → 4.5.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.
@@ -0,0 +1,12 @@
1
+ /**
2
+ * CSS anchor positioning for popups placed beside a trigger — Popover and Tooltip
3
+ * (decision 12). Internal: shared between components, not exported (decision 9).
4
+ *
5
+ * The trigger carries a generated `anchor-name`; the popup names it in `position-anchor`
6
+ * and is placed by `position-area`, flipping across the axis it opens along when there is
7
+ * no room. All inline, so the browser keeps it attached with nothing measured.
8
+ */
9
+ type AnchorSide = 'top' | 'bottom' | 'left' | 'right';
10
+ type AnchorAlign = 'start' | 'center' | 'end';
11
+
12
+ export type { AnchorSide as A, AnchorAlign as a };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * CSS anchor positioning for popups placed beside a trigger — Popover and Tooltip
3
+ * (decision 12). Internal: shared between components, not exported (decision 9).
4
+ *
5
+ * The trigger carries a generated `anchor-name`; the popup names it in `position-anchor`
6
+ * and is placed by `position-area`, flipping across the axis it opens along when there is
7
+ * no room. All inline, so the browser keeps it attached with nothing measured.
8
+ */
9
+ type AnchorSide = 'top' | 'bottom' | 'left' | 'right';
10
+ type AnchorAlign = 'start' | 'center' | 'end';
11
+
12
+ export type { AnchorSide as A, AnchorAlign as a };
@@ -0,0 +1,27 @@
1
+ // src/core/anchoring.ts
2
+ function anchorNameFor(id) {
3
+ return `--hl-anchor-${id.replace(/[^a-zA-Z0-9_-]/g, "")}`;
4
+ }
5
+ var POSITION_AREA = {
6
+ bottom: { start: "bottom span-right", center: "bottom", end: "bottom span-left" },
7
+ top: { start: "top span-right", center: "top", end: "top span-left" },
8
+ right: { start: "right span-bottom", center: "right", end: "right span-top" },
9
+ left: { start: "left span-bottom", center: "left", end: "left span-top" }
10
+ };
11
+ function anchoredPopupStyle(anchorName, side, align) {
12
+ return {
13
+ positionAnchor: anchorName,
14
+ positionArea: POSITION_AREA[side][align],
15
+ // Flip across the axis it opens on; the other axis is left alone.
16
+ positionTryFallbacks: side === "top" || side === "bottom" ? "flip-block" : "flip-inline"
17
+ };
18
+ }
19
+ function anchoredDataAttributes(side, align) {
20
+ return { "data-side": side, "data-align": align };
21
+ }
22
+
23
+ export {
24
+ anchorNameFor,
25
+ anchoredPopupStyle,
26
+ anchoredDataAttributes
27
+ };
@@ -0,0 +1,322 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/popover/index.ts
21
+ var popover_exports = {};
22
+ __export(popover_exports, {
23
+ Popover: () => index_parts_exports
24
+ });
25
+ module.exports = __toCommonJS(popover_exports);
26
+
27
+ // src/popover/index.parts.ts
28
+ var index_parts_exports = {};
29
+ __export(index_parts_exports, {
30
+ Close: () => PopoverClose,
31
+ Popup: () => PopoverPopup,
32
+ Root: () => PopoverRoot,
33
+ Trigger: () => PopoverTrigger
34
+ });
35
+
36
+ // src/popover/PopoverRoot.tsx
37
+ var import_react3 = require("react");
38
+
39
+ // src/core/anchoring.ts
40
+ function anchorNameFor(id) {
41
+ return `--hl-anchor-${id.replace(/[^a-zA-Z0-9_-]/g, "")}`;
42
+ }
43
+ var POSITION_AREA = {
44
+ bottom: { start: "bottom span-right", center: "bottom", end: "bottom span-left" },
45
+ top: { start: "top span-right", center: "top", end: "top span-left" },
46
+ right: { start: "right span-bottom", center: "right", end: "right span-top" },
47
+ left: { start: "left span-bottom", center: "left", end: "left span-top" }
48
+ };
49
+ function anchoredPopupStyle(anchorName, side, align) {
50
+ return {
51
+ positionAnchor: anchorName,
52
+ positionArea: POSITION_AREA[side][align],
53
+ // Flip across the axis it opens on; the other axis is left alone.
54
+ positionTryFallbacks: side === "top" || side === "bottom" ? "flip-block" : "flip-inline"
55
+ };
56
+ }
57
+ function anchoredDataAttributes(side, align) {
58
+ return { "data-side": side, "data-align": align };
59
+ }
60
+
61
+ // src/core/useControlled.ts
62
+ var import_react = require("react");
63
+ function useControlled({
64
+ controlled,
65
+ default: defaultValue,
66
+ name = "Component",
67
+ state = "value"
68
+ }) {
69
+ const { current: isControlled } = (0, import_react.useRef)(controlled !== void 0);
70
+ const [uncontrolled, setUncontrolled] = (0, import_react.useState)(defaultValue);
71
+ const defaultRef = (0, import_react.useRef)(defaultValue);
72
+ const value = isControlled ? controlled : uncontrolled;
73
+ if (process.env.NODE_ENV !== "production") {
74
+ if (isControlled !== (controlled !== void 0)) {
75
+ console.error(
76
+ `${name}: cannot switch between controlled and uncontrolled \`${state}\`. Decide which one this component is for the whole of its life.`
77
+ );
78
+ }
79
+ if (!isControlled && defaultRef.current !== defaultValue) {
80
+ console.error(
81
+ `${name}: cannot change the default \`${state}\` after mount. It is only read once, so later changes are silently ignored.`
82
+ );
83
+ }
84
+ }
85
+ const setValue = (0, import_react.useCallback)(
86
+ (next) => {
87
+ if (!isControlled) setUncontrolled(next);
88
+ },
89
+ [isControlled]
90
+ );
91
+ return [value, setValue];
92
+ }
93
+
94
+ // src/popover/PopoverRootContext.ts
95
+ var import_react2 = require("react");
96
+ var PopoverRootContext = (0, import_react2.createContext)(null);
97
+ function usePopoverRootContext(part) {
98
+ const context = (0, import_react2.useContext)(PopoverRootContext);
99
+ if (context === null) {
100
+ throw new Error(`<Popover.${part}> must be rendered inside <Popover.Root>.`);
101
+ }
102
+ return context;
103
+ }
104
+
105
+ // src/popover/PopoverRoot.tsx
106
+ var import_jsx_runtime = require("react/jsx-runtime");
107
+ function PopoverRoot({
108
+ open: openProp,
109
+ defaultOpen,
110
+ onOpenChange,
111
+ children
112
+ }) {
113
+ const [open, setOpenState] = useControlled({
114
+ controlled: openProp,
115
+ default: defaultOpen ?? false,
116
+ name: "Popover.Root",
117
+ state: "open"
118
+ });
119
+ const setOpen = (0, import_react3.useCallback)(
120
+ (next) => {
121
+ if (next === open) return;
122
+ setOpenState(next);
123
+ onOpenChange?.(next);
124
+ },
125
+ [open, setOpenState, onOpenChange]
126
+ );
127
+ const id = (0, import_react3.useId)();
128
+ const triggerRef = (0, import_react3.useRef)(null);
129
+ const context = (0, import_react3.useMemo)(
130
+ () => ({ open, setOpen, popupId: id, anchorName: anchorNameFor(id), triggerRef }),
131
+ [open, setOpen, id]
132
+ );
133
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverRootContext.Provider, { value: context, children });
134
+ }
135
+
136
+ // src/core/useRender.ts
137
+ var import_react4 = require("react");
138
+
139
+ // src/core/mergeProps.ts
140
+ function isEventHandler(key) {
141
+ return key.length > 2 && key.startsWith("on") && key[2] === key[2]?.toUpperCase();
142
+ }
143
+ function mergeRefs(...refs) {
144
+ return (node) => {
145
+ const cleanups = refs.map((ref) => {
146
+ if (typeof ref === "function") {
147
+ const result = ref(node);
148
+ return typeof result === "function" ? result : () => ref(null);
149
+ }
150
+ if (ref && typeof ref === "object") {
151
+ ref.current = node;
152
+ return () => {
153
+ ref.current = null;
154
+ };
155
+ }
156
+ return void 0;
157
+ });
158
+ return () => {
159
+ cleanups.forEach((cleanup) => {
160
+ if (typeof cleanup === "function") cleanup();
161
+ });
162
+ };
163
+ };
164
+ }
165
+ function isSyntheticEvent(event) {
166
+ return typeof event === "object" && event !== null && "nativeEvent" in event;
167
+ }
168
+ function makeEventPreventable(event) {
169
+ if (Object.prototype.hasOwnProperty.call(event, "preventComponentHandler")) return;
170
+ const target = event;
171
+ target.preventComponentHandler = () => {
172
+ target.componentHandlerPrevented = true;
173
+ };
174
+ }
175
+ function isComponentHandlerPrevented(event) {
176
+ return typeof event === "object" && event !== null && event.componentHandlerPrevented === true;
177
+ }
178
+ function chainHandlers(earlier, value) {
179
+ return (...args) => {
180
+ const event = args[0];
181
+ if (isSyntheticEvent(event)) makeEventPreventable(event);
182
+ value(...args);
183
+ if (isComponentHandlerPrevented(event)) return;
184
+ earlier(...args);
185
+ };
186
+ }
187
+ function mergeProps(...objects) {
188
+ const merged = {};
189
+ for (const props of objects) {
190
+ if (!props) continue;
191
+ for (const key of Object.keys(props)) {
192
+ const value = props[key];
193
+ if (value === void 0) continue;
194
+ if (isEventHandler(key) && typeof value === "function") {
195
+ const earlier = merged[key];
196
+ merged[key] = typeof earlier === "function" ? chainHandlers(earlier, value) : value;
197
+ } else if (key === "className") {
198
+ merged.className = merged.className ? `${String(merged.className)} ${String(value)}` : value;
199
+ } else if (key === "style") {
200
+ merged.style = { ...merged.style, ...value };
201
+ } else if (key === "ref") {
202
+ merged.ref = merged.ref ? mergeRefs(merged.ref, value) : value;
203
+ } else {
204
+ merged[key] = value;
205
+ }
206
+ }
207
+ }
208
+ return merged;
209
+ }
210
+
211
+ // src/core/useRender.ts
212
+ function useRender({
213
+ render,
214
+ defaultTagName,
215
+ props,
216
+ consumerProps
217
+ }) {
218
+ const merged = mergeProps(props, consumerProps);
219
+ if ((0, import_react4.isValidElement)(render)) {
220
+ return (0, import_react4.cloneElement)(render, mergeProps(merged, render.props));
221
+ }
222
+ return (0, import_react4.createElement)(defaultTagName, merged);
223
+ }
224
+
225
+ // src/popover/popoverDataAttributes.ts
226
+ function popoverDataAttributes({ open }) {
227
+ return {
228
+ "data-open": open ? "" : void 0,
229
+ "data-closed": open ? void 0 : ""
230
+ };
231
+ }
232
+
233
+ // src/popover/PopoverTrigger.tsx
234
+ function PopoverTrigger({ className, children, render, ...rest }) {
235
+ const { open, setOpen, popupId, anchorName, triggerRef } = usePopoverRootContext("Trigger");
236
+ return useRender({
237
+ render,
238
+ defaultTagName: "button",
239
+ props: {
240
+ type: "button",
241
+ "aria-haspopup": "dialog",
242
+ "aria-expanded": open,
243
+ "aria-controls": popupId,
244
+ ...popoverDataAttributes({ open }),
245
+ style: { anchorName },
246
+ className,
247
+ children,
248
+ ref: triggerRef,
249
+ onClick() {
250
+ setOpen(!open);
251
+ }
252
+ },
253
+ consumerProps: rest
254
+ });
255
+ }
256
+
257
+ // src/popover/PopoverPopup.tsx
258
+ var import_react5 = require("react");
259
+ function PopoverPopup({
260
+ side = "bottom",
261
+ align = "center",
262
+ className,
263
+ children,
264
+ render,
265
+ ...rest
266
+ }) {
267
+ const { open, setOpen, popupId, anchorName, triggerRef } = usePopoverRootContext("Popup");
268
+ const elementRef = (0, import_react5.useRef)(null);
269
+ const [, resync] = (0, import_react5.useReducer)((n) => n + 1, 0);
270
+ (0, import_react5.useEffect)(() => {
271
+ const popup = elementRef.current;
272
+ if (!popup || typeof popup.showPopover !== "function") return;
273
+ const shown = popup.matches(":popover-open");
274
+ if (open && !shown) {
275
+ popup.showPopover({ source: triggerRef.current ?? void 0 });
276
+ } else if (!open && shown) popup.hidePopover();
277
+ });
278
+ return useRender({
279
+ render,
280
+ defaultTagName: "div",
281
+ props: {
282
+ id: popupId,
283
+ popover: "auto",
284
+ role: "dialog",
285
+ ...anchoredDataAttributes(side, align),
286
+ ...popoverDataAttributes({ open }),
287
+ style: anchoredPopupStyle(anchorName, side, align),
288
+ className,
289
+ children,
290
+ ref: elementRef,
291
+ onToggle(event) {
292
+ if (event.target !== event.currentTarget) return;
293
+ if (event.nativeEvent.newState !== "closed") return;
294
+ setOpen(false);
295
+ resync();
296
+ }
297
+ },
298
+ consumerProps: rest
299
+ });
300
+ }
301
+
302
+ // src/popover/PopoverClose.tsx
303
+ function PopoverClose({ className, children, render, ...rest }) {
304
+ const { setOpen } = usePopoverRootContext("Close");
305
+ return useRender({
306
+ render,
307
+ defaultTagName: "button",
308
+ props: {
309
+ type: "button",
310
+ className,
311
+ children,
312
+ onClick() {
313
+ setOpen(false);
314
+ }
315
+ },
316
+ consumerProps: rest
317
+ });
318
+ }
319
+ // Annotate the CommonJS export names for ESM import in node:
320
+ 0 && (module.exports = {
321
+ Popover
322
+ });
@@ -0,0 +1,99 @@
1
+ import * as react from 'react';
2
+ import { ReactNode, ReactElement, Ref, ComponentPropsWithRef } from 'react';
3
+ import { A as AnchorSide, a as AnchorAlign } from '../anchoring-Btxi0QwC.cjs';
4
+
5
+ type PopoverRootProps = {
6
+ /**
7
+ * Controlled state. Provide `onOpenChange` alongside it.
8
+ *
9
+ * Never `undefined` once mounted: the mode is latched at mount, as for Switch.
10
+ */
11
+ open?: boolean;
12
+ /** Initial state when uncontrolled. Read once, at mount. */
13
+ defaultOpen?: boolean;
14
+ /**
15
+ * Called on every request to open or close — Trigger, Close, Esc, or a click outside.
16
+ * A controlled popover moves only if the parent accepts it.
17
+ */
18
+ onOpenChange?: (open: boolean) => void;
19
+ children?: ReactNode;
20
+ };
21
+ /**
22
+ * Holds a popover's state and shares it with its parts. Renders no element of its own.
23
+ *
24
+ * The popup is a native `popover`, placed by CSS anchor positioning (decision 12): the
25
+ * platform supplies the top layer, light dismiss, Esc, the Tab order from the trigger and
26
+ * focus return; the browser keeps it attached. This component adds state, one setter every
27
+ * close goes through, and the anchor wiring.
28
+ */
29
+ declare function PopoverRoot({ open: openProp, defaultOpen, onOpenChange, children, }: PopoverRootProps): react.JSX.Element;
30
+
31
+ type PopoverTriggerOwnProps = {
32
+ /** Element to render instead of the default `<button>`. Props and ref are merged onto it. */
33
+ render?: ReactElement;
34
+ /** Ref to the rendered element. Merged with any ref on the `render` element. */
35
+ ref?: Ref<HTMLElement>;
36
+ };
37
+ type PopoverTriggerProps = PopoverTriggerOwnProps & Omit<ComponentPropsWithRef<'button'>, keyof PopoverTriggerOwnProps>;
38
+ /**
39
+ * Opens and closes the popover, and is what it is anchored to: it carries the
40
+ * `anchor-name` the popup positions against. A native `<button>`, so focus and activation
41
+ * are the platform's.
42
+ *
43
+ * It becomes the popup's invoker when it opens, so a click on it while open is not a
44
+ * click outside — it toggles the popover closed rather than light-dismissing and reopening.
45
+ */
46
+ declare function PopoverTrigger({ className, children, render, ...rest }: PopoverTriggerProps): ReactElement<unknown, string | react.JSXElementConstructor<any>>;
47
+
48
+ type PopoverSide = AnchorSide;
49
+ type PopoverAlign = AnchorAlign;
50
+ type PopoverPopupOwnProps = {
51
+ /** Which side of the trigger to open on. Flips to the opposite side when there is no room. */
52
+ side?: PopoverSide;
53
+ /** Where along that side: flush with the trigger's start or end edge, or centred on it. */
54
+ align?: PopoverAlign;
55
+ /** Element to render instead of the default `<div>`. Props and ref are merged onto it. */
56
+ render?: ReactElement;
57
+ /** Ref to the rendered element. Merged with any ref on the `render` element. */
58
+ ref?: Ref<HTMLElement>;
59
+ };
60
+ type PopoverPopupProps = PopoverPopupOwnProps & Omit<ComponentPropsWithRef<'div'>, keyof PopoverPopupOwnProps | 'popover'>;
61
+ /**
62
+ * The popup: a native `popover="auto"`, shown with `showPopover({ source })` whenever the
63
+ * Root is open and hidden when it is not. State drives the element, never the reverse.
64
+ *
65
+ * Placement is CSS anchor positioning, set inline: `position-anchor` names the trigger,
66
+ * `position-area` comes from `side` and `align`, and `position-try-fallbacks` flips it
67
+ * when there is no room (decision 12). `data-side` and `data-align` repeat the request —
68
+ * not where a fallback moved it, which script cannot observe.
69
+ *
70
+ * Light dismiss and Esc close the element before anyone is asked; the `toggle` event
71
+ * reports it through the Root, and the element reopens if the state stays open.
72
+ *
73
+ * `role="dialog"`, non-modal. Name it with `aria-label` or `aria-labelledby`.
74
+ */
75
+ declare function PopoverPopup({ side, align, className, children, render, ...rest }: PopoverPopupProps): ReactElement<unknown, string | react.JSXElementConstructor<any>>;
76
+
77
+ type PopoverCloseOwnProps = {
78
+ /** Element to render instead of the default `<button>`. Props and ref are merged onto it. */
79
+ render?: ReactElement;
80
+ /** Ref to the rendered element. Merged with any ref on the `render` element. */
81
+ ref?: Ref<HTMLElement>;
82
+ };
83
+ type PopoverCloseProps = PopoverCloseOwnProps & Omit<ComponentPropsWithRef<'button'>, keyof PopoverCloseOwnProps>;
84
+ /**
85
+ * Closes the popover. Esc and a click outside already do; this is the visible way, for
86
+ * pointer users and for screen reader users who would not guess either.
87
+ */
88
+ declare function PopoverClose({ className, children, render, ...rest }: PopoverCloseProps): ReactElement<unknown, string | react.JSXElementConstructor<any>>;
89
+
90
+ declare namespace index_parts {
91
+ export { PopoverClose as Close, PopoverPopup as Popup, PopoverRoot as Root, PopoverTrigger as Trigger };
92
+ }
93
+
94
+ /** The state Popover.Root shares with its parts, and projects as `data-*` attributes. */
95
+ type PopoverState = {
96
+ open: boolean;
97
+ };
98
+
99
+ export { index_parts as Popover, type PopoverAlign, type PopoverCloseProps, type PopoverPopupProps, type PopoverRootProps, type PopoverSide, type PopoverState, type PopoverTriggerProps };
@@ -0,0 +1,99 @@
1
+ import * as react from 'react';
2
+ import { ReactNode, ReactElement, Ref, ComponentPropsWithRef } from 'react';
3
+ import { A as AnchorSide, a as AnchorAlign } from '../anchoring-Btxi0QwC.js';
4
+
5
+ type PopoverRootProps = {
6
+ /**
7
+ * Controlled state. Provide `onOpenChange` alongside it.
8
+ *
9
+ * Never `undefined` once mounted: the mode is latched at mount, as for Switch.
10
+ */
11
+ open?: boolean;
12
+ /** Initial state when uncontrolled. Read once, at mount. */
13
+ defaultOpen?: boolean;
14
+ /**
15
+ * Called on every request to open or close — Trigger, Close, Esc, or a click outside.
16
+ * A controlled popover moves only if the parent accepts it.
17
+ */
18
+ onOpenChange?: (open: boolean) => void;
19
+ children?: ReactNode;
20
+ };
21
+ /**
22
+ * Holds a popover's state and shares it with its parts. Renders no element of its own.
23
+ *
24
+ * The popup is a native `popover`, placed by CSS anchor positioning (decision 12): the
25
+ * platform supplies the top layer, light dismiss, Esc, the Tab order from the trigger and
26
+ * focus return; the browser keeps it attached. This component adds state, one setter every
27
+ * close goes through, and the anchor wiring.
28
+ */
29
+ declare function PopoverRoot({ open: openProp, defaultOpen, onOpenChange, children, }: PopoverRootProps): react.JSX.Element;
30
+
31
+ type PopoverTriggerOwnProps = {
32
+ /** Element to render instead of the default `<button>`. Props and ref are merged onto it. */
33
+ render?: ReactElement;
34
+ /** Ref to the rendered element. Merged with any ref on the `render` element. */
35
+ ref?: Ref<HTMLElement>;
36
+ };
37
+ type PopoverTriggerProps = PopoverTriggerOwnProps & Omit<ComponentPropsWithRef<'button'>, keyof PopoverTriggerOwnProps>;
38
+ /**
39
+ * Opens and closes the popover, and is what it is anchored to: it carries the
40
+ * `anchor-name` the popup positions against. A native `<button>`, so focus and activation
41
+ * are the platform's.
42
+ *
43
+ * It becomes the popup's invoker when it opens, so a click on it while open is not a
44
+ * click outside — it toggles the popover closed rather than light-dismissing and reopening.
45
+ */
46
+ declare function PopoverTrigger({ className, children, render, ...rest }: PopoverTriggerProps): ReactElement<unknown, string | react.JSXElementConstructor<any>>;
47
+
48
+ type PopoverSide = AnchorSide;
49
+ type PopoverAlign = AnchorAlign;
50
+ type PopoverPopupOwnProps = {
51
+ /** Which side of the trigger to open on. Flips to the opposite side when there is no room. */
52
+ side?: PopoverSide;
53
+ /** Where along that side: flush with the trigger's start or end edge, or centred on it. */
54
+ align?: PopoverAlign;
55
+ /** Element to render instead of the default `<div>`. Props and ref are merged onto it. */
56
+ render?: ReactElement;
57
+ /** Ref to the rendered element. Merged with any ref on the `render` element. */
58
+ ref?: Ref<HTMLElement>;
59
+ };
60
+ type PopoverPopupProps = PopoverPopupOwnProps & Omit<ComponentPropsWithRef<'div'>, keyof PopoverPopupOwnProps | 'popover'>;
61
+ /**
62
+ * The popup: a native `popover="auto"`, shown with `showPopover({ source })` whenever the
63
+ * Root is open and hidden when it is not. State drives the element, never the reverse.
64
+ *
65
+ * Placement is CSS anchor positioning, set inline: `position-anchor` names the trigger,
66
+ * `position-area` comes from `side` and `align`, and `position-try-fallbacks` flips it
67
+ * when there is no room (decision 12). `data-side` and `data-align` repeat the request —
68
+ * not where a fallback moved it, which script cannot observe.
69
+ *
70
+ * Light dismiss and Esc close the element before anyone is asked; the `toggle` event
71
+ * reports it through the Root, and the element reopens if the state stays open.
72
+ *
73
+ * `role="dialog"`, non-modal. Name it with `aria-label` or `aria-labelledby`.
74
+ */
75
+ declare function PopoverPopup({ side, align, className, children, render, ...rest }: PopoverPopupProps): ReactElement<unknown, string | react.JSXElementConstructor<any>>;
76
+
77
+ type PopoverCloseOwnProps = {
78
+ /** Element to render instead of the default `<button>`. Props and ref are merged onto it. */
79
+ render?: ReactElement;
80
+ /** Ref to the rendered element. Merged with any ref on the `render` element. */
81
+ ref?: Ref<HTMLElement>;
82
+ };
83
+ type PopoverCloseProps = PopoverCloseOwnProps & Omit<ComponentPropsWithRef<'button'>, keyof PopoverCloseOwnProps>;
84
+ /**
85
+ * Closes the popover. Esc and a click outside already do; this is the visible way, for
86
+ * pointer users and for screen reader users who would not guess either.
87
+ */
88
+ declare function PopoverClose({ className, children, render, ...rest }: PopoverCloseProps): ReactElement<unknown, string | react.JSXElementConstructor<any>>;
89
+
90
+ declare namespace index_parts {
91
+ export { PopoverClose as Close, PopoverPopup as Popup, PopoverRoot as Root, PopoverTrigger as Trigger };
92
+ }
93
+
94
+ /** The state Popover.Root shares with its parts, and projects as `data-*` attributes. */
95
+ type PopoverState = {
96
+ open: boolean;
97
+ };
98
+
99
+ export { index_parts as Popover, type PopoverAlign, type PopoverCloseProps, type PopoverPopupProps, type PopoverRootProps, type PopoverSide, type PopoverState, type PopoverTriggerProps };