@cognitap/radiant 0.0.15 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## 0.0.16
8
+
9
+ - Add Tooltip.
10
+
7
11
  ## 0.0.15
8
12
 
9
13
  - Add Popover.
@@ -34,7 +38,7 @@
34
38
 
35
39
  ## 0.0.8
36
40
 
37
- - Add Select with item focus, Field/native forms, themes and springs; open at trigger width without drift or flashes.
41
+ - Add Select with item focus, Field/forms, themes and springs; match trigger width without drift or flashes.
38
42
 
39
43
  ## 0.0.7
40
44
 
@@ -0,0 +1,40 @@
1
+ import { type ComponentProps, type ReactNode } from 'react';
2
+ import { type ButtonProps, type ButtonRenderProps } from './Button.js';
3
+ import type { PopoverSide, PopoverAlign } from './internal/popover.js';
4
+ import type { ThemeStyle } from './themes/defineTheme.js';
5
+ export type TooltipProps = ({
6
+ open: boolean;
7
+ defaultOpen?: never;
8
+ } | {
9
+ open?: undefined;
10
+ defaultOpen?: boolean;
11
+ }) & {
12
+ onOpenChange?: (open: boolean) => void;
13
+ openDelay?: number;
14
+ closeDelay?: number;
15
+ children?: ReactNode;
16
+ };
17
+ export type TooltipState = {
18
+ open: boolean;
19
+ setOpen: (open: boolean) => void;
20
+ contentId: string;
21
+ };
22
+ export declare function useTooltip(): TooltipState | null;
23
+ export declare function Tooltip({ open, defaultOpen, onOpenChange, openDelay, closeDelay, children }: TooltipProps): import("react").JSX.Element;
24
+ export type TooltipTriggerProps = ButtonProps;
25
+ export type TooltipRenderProps = ButtonRenderProps;
26
+ export type TooltipPortalProps = {
27
+ children?: ReactNode;
28
+ };
29
+ export type TooltipContentProps = Omit<ComponentProps<'span'>, 'style' | 'id' | 'role' | 'popover' | 'tabIndex'> & {
30
+ style?: ThemeStyle;
31
+ side?: PopoverSide;
32
+ align?: PopoverAlign;
33
+ sideOffset?: number;
34
+ collisionPadding?: number;
35
+ motion?: 'inherit' | 'off';
36
+ };
37
+ export declare function TooltipTrigger({ ref, onClick, onFocus, onBlur, onPointerEnter, onPointerLeave, onPointerDown, ...props }: TooltipTriggerProps): import("react").JSX.Element;
38
+ export declare function TooltipPortal({ children }: TooltipPortalProps): ReactNode;
39
+ export declare function TooltipContent({ ref, className, side, align, sideOffset, collisionPadding, motion, onPointerEnter, onPointerLeave, ...props }: TooltipContentProps): import("react").JSX.Element;
40
+ //# sourceMappingURL=Tooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/Tooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,EAQL,KAAK,cAAc,EACnB,KAAK,SAAS,EAEf,MAAM,OAAO,CAAA;AAEd,OAAO,EAAU,KAAK,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAI9E,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAKtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEzD,MAAM,MAAM,YAAY,GAAG,CACvB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,KAAK,CAAA;CAAE,GACtC;IAAE,IAAI,CAAC,EAAE,SAAS,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,CAC9C,GAAG;IACF,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACtC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,CAAA;AACD,MAAM,MAAM,YAAY,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAAC,SAAS,EA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{ createContext, useCallback, useContext, useEffect, useId, useRef, useState } from 'react';
4
+ import { createPortal } from 'react-dom';
5
+ import { Button } from './Button.js';
6
+ import { cn } from './cn.js';
7
+ import { joinIds } from './internal/ids.js';
8
+ import { composeAction } from './internal/events.js';
9
+ import { useControllableState } from './react/useControllableState.js';
10
+ import { useComposedRefs } from './react/useComposedRefs.js';
11
+ import { usePopoverSurface } from './react/usePopoverSurface.js';
12
+ import { useTransitionHost } from './motion/host.js';
13
+ const TooltipContext = createContext(null);
14
+ export function useTooltip() {
15
+ return useContext(TooltipContext);
16
+ }
17
+ function useTooltipContext() {
18
+ const value = useContext(TooltipContext);
19
+ if (!value)
20
+ throw new Error('Tooltip parts must render inside Tooltip.');
21
+ return value;
22
+ }
23
+ export function Tooltip({ open, defaultOpen, onOpenChange, openDelay = 500, closeDelay = 150, children }) {
24
+ if (![openDelay, closeDelay].every(n => Number.isFinite(n) && n >= 0))
25
+ throw new TypeError('Tooltip delays must be finite, nonnegative numbers.');
26
+ const state = useControllableState({
27
+ name: 'Tooltip',
28
+ value: open,
29
+ defaultValue: defaultOpen,
30
+ initialValue: false,
31
+ onChange: onOpenChange
32
+ });
33
+ const contentId = useId();
34
+ const [trigger, setTrigger] = useState(null);
35
+ const content = useRef(null);
36
+ const timer = useRef(null);
37
+ const activity = useRef({ focused: false, hovered: false, suppressed: false, touch: false });
38
+ const clear = () => {
39
+ if (timer.current)
40
+ timer.current.view.clearTimeout(timer.current.id);
41
+ timer.current = null;
42
+ };
43
+ const latest = useRef(state.request);
44
+ useEffect(() => {
45
+ latest.current = state.request;
46
+ });
47
+ useEffect(() => () => clear(), []);
48
+ const schedule = useCallback((next, delay) => {
49
+ clear();
50
+ const view = trigger?.ownerDocument.defaultView;
51
+ if (!view)
52
+ return;
53
+ timer.current = {
54
+ view,
55
+ id: view.setTimeout(() => {
56
+ timer.current = null;
57
+ latest.current(next);
58
+ }, delay)
59
+ };
60
+ }, [trigger]);
61
+ const dismiss = () => {
62
+ clear();
63
+ activity.current.suppressed = true;
64
+ state.request(false);
65
+ };
66
+ const enter = (focus = false) => {
67
+ if (focus && !activity.current.focused)
68
+ activity.current.suppressed = false;
69
+ if (focus)
70
+ activity.current.focused = true;
71
+ else
72
+ activity.current.hovered = true;
73
+ clear();
74
+ if (activity.current.suppressed || activity.current.touch)
75
+ return;
76
+ if (focus)
77
+ state.request(true);
78
+ else if (!state.value)
79
+ schedule(true, openDelay);
80
+ };
81
+ const leave = (focus = false) => {
82
+ if (focus) {
83
+ activity.current.focused = false;
84
+ activity.current.touch = false;
85
+ }
86
+ else
87
+ activity.current.hovered = false;
88
+ if (activity.current.focused || activity.current.hovered)
89
+ return;
90
+ activity.current.suppressed = false;
91
+ schedule(false, closeDelay);
92
+ };
93
+ useEffect(() => {
94
+ if (!trigger || !state.value)
95
+ return;
96
+ const move = (event) => {
97
+ if (event.pointerType === 'touch' ||
98
+ activity.current.focused ||
99
+ activity.current.hovered ||
100
+ activity.current.suppressed)
101
+ return;
102
+ const panel = content.current;
103
+ if (!panel)
104
+ return;
105
+ const a = trigger.getBoundingClientRect();
106
+ const b = panel.getBoundingClientRect();
107
+ // Keep a hoverable bridge across the placement gap, including magnified pointer movement.
108
+ const within = event.clientX >= Math.min(a.left, b.left) &&
109
+ event.clientX <= Math.max(a.right, b.right) &&
110
+ event.clientY >= Math.min(a.top, b.top) &&
111
+ event.clientY <= Math.max(a.bottom, b.bottom);
112
+ if (within)
113
+ clear();
114
+ else if (!timer.current)
115
+ schedule(false, closeDelay);
116
+ };
117
+ trigger.ownerDocument.addEventListener('pointermove', move);
118
+ return () => trigger.ownerDocument.removeEventListener('pointermove', move);
119
+ }, [trigger, state.value, closeDelay, schedule]);
120
+ return (_jsx(TooltipContext.Provider, { value: {
121
+ open: state.value,
122
+ setOpen: state.request,
123
+ contentId,
124
+ trigger,
125
+ setTrigger,
126
+ content,
127
+ enter,
128
+ leave,
129
+ dismiss,
130
+ touch: () => {
131
+ activity.current.touch = true;
132
+ dismiss();
133
+ }
134
+ }, children: children }));
135
+ }
136
+ export function TooltipTrigger({ ref, onClick, onFocus, onBlur, onPointerEnter, onPointerLeave, onPointerDown, ...props }) {
137
+ const tip = useTooltipContext();
138
+ const hostRef = useComposedRefs(tip.setTrigger, ref);
139
+ return (_jsx(Button, { ...props, ref: hostRef, "data-slot": joinIds('tooltip-trigger', props['data-slot']), "aria-describedby": joinIds(tip.contentId, props['aria-describedby']), onFocus: event => {
140
+ onFocus?.(event);
141
+ tip.enter(true);
142
+ }, onBlur: event => {
143
+ onBlur?.(event);
144
+ tip.leave(true);
145
+ }, onPointerEnter: composeAction(onPointerEnter, event => {
146
+ if (event.pointerType !== 'touch')
147
+ tip.enter();
148
+ }), onPointerLeave: composeAction(onPointerLeave, event => {
149
+ if (event.pointerType !== 'touch')
150
+ tip.leave();
151
+ }), onPointerDown: event => {
152
+ onPointerDown?.(event);
153
+ if (event.pointerType === 'touch')
154
+ tip.touch();
155
+ }, onClick: composeAction(onClick, tip.dismiss) }));
156
+ }
157
+ export function TooltipPortal({ children }) {
158
+ const tip = useTooltipContext();
159
+ return tip.trigger?.parentElement ? createPortal(children, tip.trigger.parentElement) : children;
160
+ }
161
+ export function TooltipContent({ ref, className, side = 'top', align = 'center', sideOffset = 8, collisionPadding = 8, motion = 'inherit', onPointerEnter, onPointerLeave, ...props }) {
162
+ const tip = useTooltipContext();
163
+ if (![sideOffset, collisionPadding].every(n => Number.isFinite(n) && n >= 0))
164
+ throw new TypeError('Tooltip offsets must be finite, nonnegative numbers.');
165
+ const hostRef = useComposedRefs(tip.content, ref);
166
+ const restoreFocus = useRef(false);
167
+ const { ref: transitionRef, active, off } = useTransitionHost('popup', hostRef, motion === 'off');
168
+ usePopoverSurface(tip.content, tip.trigger, tip.open, tip.dismiss, restoreFocus, {
169
+ side,
170
+ align,
171
+ sideOffset,
172
+ collisionPadding
173
+ });
174
+ return (_jsx("span", { ...props, ref: transitionRef, id: tip.contentId, role: "tooltip", popover: "manual", tabIndex: undefined, "data-slot": "tooltip-content", "data-state": tip.open ? 'open' : 'closed', "data-side": side, "data-align": align, "data-motion": motion, onPointerEnter: composeAction(onPointerEnter, event => {
175
+ if (event.pointerType !== 'touch')
176
+ tip.enter();
177
+ }), onPointerLeave: composeAction(onPointerLeave, event => {
178
+ if (event.pointerType !== 'touch')
179
+ tip.leave();
180
+ }), className: cn('fixed right-auto bottom-auto m-0 box-border block min-w-0 w-max overflow-auto break-words text-start antialiased [&:not(:popover-open)]:hidden', 'left-[var(--_rad-popover-left,0px)] top-[var(--_rad-popover-top,0px)] max-w-[min(var(--rad-tooltip-max-width,20rem),var(--_rad-popover-max-width,calc(100vw-1rem)))] max-h-[var(--_rad-popover-max-height,calc(100dvh-1rem))]', 'p-[var(--rad-tooltip-padding,0.625rem)] rounded-[var(--rad-tooltip-radius,var(--rad-control-radius,0.5rem))]', 'bg-[var(--rad-tooltip-background,var(--rad-color-surface,white))] [color:var(--rad-tooltip-color,var(--rad-color-foreground))] [border-color:var(--rad-tooltip-border-color,var(--rad-color-border))] [border-width:var(--rad-tooltip-border-width,var(--rad-surface-border-width,1px))] [border-style:var(--rad-tooltip-border-style,var(--rad-surface-border-style,solid))] [box-shadow:var(--rad-tooltip-shadow,var(--rad-surface-overlay-shadow,0_8px_32px_#0003))]', 'font-[family-name:var(--rad-typography-roles-ui-supporting-family,system-ui,sans-serif)] text-[length:var(--rad-tooltip-font-size,var(--rad-typography-roles-ui-supporting-size,0.8125rem))] font-[number:var(--rad-tooltip-font-weight,var(--rad-typography-roles-ui-supporting-weight,400))] leading-[var(--rad-typography-roles-ui-supporting-line-height,1.5)]', 'forced-colors:border-[CanvasText] forced-colors:bg-[Canvas] forced-colors:text-[CanvasText]', active && !off && 'opacity-[var(--_rad-popup-enter,0)] motion-reduce:opacity-100', className) }));
181
+ }
182
+ //# sourceMappingURL=Tooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../src/Tooltip.tsx"],"names":[],"mappings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AE,KAAK,CAAC,EAAE;YACpD,IAAI,KAAK,CAAC,WAAW,KAAK,OAAO;gBAAE,GAAG,CAAC,KAAK,EAAE,CAAA;QAChD,CAAC,CAAC,EACF,cAAc,EAAE,aAAa,CAAC,cAAc,EAAE,KAAK,CAAC,EAAE;YACpD,IAAI,KAAK,CAAC,WAAW,KAAK,OAAO;gBAAE,GAAG,CAAC,KAAK,EAAE,CAAA;QAChD,CAAC,CAAC,EACF,SAAS,EAAE,EAAE,CACX,gJAAgJ,EAChJ,+NAA+N,EAC/N,8GAA8G,EAC9G,ycAAyc,EACzc,oWAAoW,EACpW,6FAA6F,EAC7F,MAAM,IAAI,CAAC,GAAG,IAAI,+DAA+D,EACjF,SAAS,CACV,GACD,CACH,CAAA;AACH,CAAC","sourcesContent":["'use client'\n\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n type ComponentProps,\n type ReactNode,\n type RefObject\n} from 'react'\nimport { createPortal } from 'react-dom'\nimport { Button, type ButtonProps, type ButtonRenderProps } from './Button.js'\nimport { cn } from './cn.js'\nimport { joinIds } from './internal/ids.js'\nimport { composeAction } from './internal/events.js'\nimport type { PopoverSide, PopoverAlign } from './internal/popover.js'\nimport { useControllableState } from './react/useControllableState.js'\nimport { useComposedRefs } from './react/useComposedRefs.js'\nimport { usePopoverSurface } from './react/usePopoverSurface.js'\nimport { useTransitionHost } from './motion/host.js'\nimport type { ThemeStyle } from './themes/defineTheme.js'\n\nexport type TooltipProps = (\n | { open: boolean; defaultOpen?: never }\n | { open?: undefined; defaultOpen?: boolean }\n) & {\n onOpenChange?: (open: boolean) => void\n openDelay?: number\n closeDelay?: number\n children?: ReactNode\n}\nexport type TooltipState = { open: boolean; setOpen: (open: boolean) => void; contentId: string }\ntype Context = TooltipState & {\n trigger: HTMLButtonElement | null\n setTrigger: (node: HTMLButtonElement | null) => void\n content: RefObject<HTMLSpanElement | null>\n enter: (focus?: boolean) => void\n leave: (focus?: boolean) => void\n dismiss: () => void\n touch: () => void\n}\nconst TooltipContext = createContext<Context | null>(null)\nexport function useTooltip(): TooltipState | null {\n return useContext(TooltipContext)\n}\nfunction useTooltipContext() {\n const value = useContext(TooltipContext)\n if (!value) throw new Error('Tooltip parts must render inside Tooltip.')\n return value\n}\n\nexport function Tooltip({\n open,\n defaultOpen,\n onOpenChange,\n openDelay = 500,\n closeDelay = 150,\n children\n}: TooltipProps) {\n if (![openDelay, closeDelay].every(n => Number.isFinite(n) && n >= 0))\n throw new TypeError('Tooltip delays must be finite, nonnegative numbers.')\n const state = useControllableState({\n name: 'Tooltip',\n value: open,\n defaultValue: defaultOpen,\n initialValue: false,\n onChange: onOpenChange\n })\n const contentId = useId()\n const [trigger, setTrigger] = useState<HTMLButtonElement | null>(null)\n const content = useRef<HTMLSpanElement>(null)\n const timer = useRef<{ view: Window; id: number } | null>(null)\n const activity = useRef({ focused: false, hovered: false, suppressed: false, touch: false })\n const clear = () => {\n if (timer.current) timer.current.view.clearTimeout(timer.current.id)\n timer.current = null\n }\n const latest = useRef(state.request)\n useEffect(() => {\n latest.current = state.request\n })\n useEffect(() => () => clear(), [])\n const schedule = useCallback(\n (next: boolean, delay: number) => {\n clear()\n const view = trigger?.ownerDocument.defaultView\n if (!view) return\n timer.current = {\n view,\n id: view.setTimeout(() => {\n timer.current = null\n latest.current(next)\n }, delay)\n }\n },\n [trigger]\n )\n const dismiss = () => {\n clear()\n activity.current.suppressed = true\n state.request(false)\n }\n const enter = (focus = false) => {\n if (focus && !activity.current.focused) activity.current.suppressed = false\n if (focus) activity.current.focused = true\n else activity.current.hovered = true\n clear()\n if (activity.current.suppressed || activity.current.touch) return\n if (focus) state.request(true)\n else if (!state.value) schedule(true, openDelay)\n }\n const leave = (focus = false) => {\n if (focus) {\n activity.current.focused = false\n activity.current.touch = false\n } else activity.current.hovered = false\n if (activity.current.focused || activity.current.hovered) return\n activity.current.suppressed = false\n schedule(false, closeDelay)\n }\n useEffect(() => {\n if (!trigger || !state.value) return\n const move = (event: PointerEvent) => {\n if (\n event.pointerType === 'touch' ||\n activity.current.focused ||\n activity.current.hovered ||\n activity.current.suppressed\n )\n return\n const panel = content.current\n if (!panel) return\n const a = trigger.getBoundingClientRect()\n const b = panel.getBoundingClientRect()\n // Keep a hoverable bridge across the placement gap, including magnified pointer movement.\n const within =\n event.clientX >= Math.min(a.left, b.left) &&\n event.clientX <= Math.max(a.right, b.right) &&\n event.clientY >= Math.min(a.top, b.top) &&\n event.clientY <= Math.max(a.bottom, b.bottom)\n if (within) clear()\n else if (!timer.current) schedule(false, closeDelay)\n }\n trigger.ownerDocument.addEventListener('pointermove', move)\n return () => trigger.ownerDocument.removeEventListener('pointermove', move)\n }, [trigger, state.value, closeDelay, schedule])\n return (\n <TooltipContext.Provider\n value={{\n open: state.value,\n setOpen: state.request,\n contentId,\n trigger,\n setTrigger,\n content,\n enter,\n leave,\n dismiss,\n touch: () => {\n activity.current.touch = true\n dismiss()\n }\n }}\n >\n {children}\n </TooltipContext.Provider>\n )\n}\n\nexport type TooltipTriggerProps = ButtonProps\nexport type TooltipRenderProps = ButtonRenderProps\nexport type TooltipPortalProps = { children?: ReactNode }\nexport type TooltipContentProps = Omit<\n ComponentProps<'span'>,\n 'style' | 'id' | 'role' | 'popover' | 'tabIndex'\n> & {\n style?: ThemeStyle\n side?: PopoverSide\n align?: PopoverAlign\n sideOffset?: number\n collisionPadding?: number\n motion?: 'inherit' | 'off'\n}\nexport function TooltipTrigger({\n ref,\n onClick,\n onFocus,\n onBlur,\n onPointerEnter,\n onPointerLeave,\n onPointerDown,\n ...props\n}: TooltipTriggerProps) {\n const tip = useTooltipContext()\n const hostRef = useComposedRefs(tip.setTrigger, ref)\n return (\n <Button\n {...props}\n ref={hostRef}\n data-slot={joinIds('tooltip-trigger', props['data-slot'])}\n aria-describedby={joinIds(tip.contentId, props['aria-describedby'])}\n onFocus={event => {\n onFocus?.(event)\n tip.enter(true)\n }}\n onBlur={event => {\n onBlur?.(event)\n tip.leave(true)\n }}\n onPointerEnter={composeAction(onPointerEnter, event => {\n if (event.pointerType !== 'touch') tip.enter()\n })}\n onPointerLeave={composeAction(onPointerLeave, event => {\n if (event.pointerType !== 'touch') tip.leave()\n })}\n onPointerDown={event => {\n onPointerDown?.(event)\n if (event.pointerType === 'touch') tip.touch()\n }}\n onClick={composeAction(onClick, tip.dismiss)}\n />\n )\n}\nexport function TooltipPortal({ children }: TooltipPortalProps) {\n const tip = useTooltipContext()\n return tip.trigger?.parentElement ? createPortal(children, tip.trigger.parentElement) : children\n}\nexport function TooltipContent({\n ref,\n className,\n side = 'top',\n align = 'center',\n sideOffset = 8,\n collisionPadding = 8,\n motion = 'inherit',\n onPointerEnter,\n onPointerLeave,\n ...props\n}: TooltipContentProps) {\n const tip = useTooltipContext()\n if (![sideOffset, collisionPadding].every(n => Number.isFinite(n) && n >= 0))\n throw new TypeError('Tooltip offsets must be finite, nonnegative numbers.')\n const hostRef = useComposedRefs(tip.content, ref)\n const restoreFocus = useRef(false)\n const { ref: transitionRef, active, off } = useTransitionHost('popup', hostRef, motion === 'off')\n usePopoverSurface(tip.content, tip.trigger, tip.open, tip.dismiss, restoreFocus, {\n side,\n align,\n sideOffset,\n collisionPadding\n })\n return (\n <span\n {...props}\n ref={transitionRef}\n id={tip.contentId}\n role=\"tooltip\"\n popover=\"manual\"\n tabIndex={undefined}\n data-slot=\"tooltip-content\"\n data-state={tip.open ? 'open' : 'closed'}\n data-side={side}\n data-align={align}\n data-motion={motion}\n onPointerEnter={composeAction(onPointerEnter, event => {\n if (event.pointerType !== 'touch') tip.enter()\n })}\n onPointerLeave={composeAction(onPointerLeave, event => {\n if (event.pointerType !== 'touch') tip.leave()\n })}\n className={cn(\n 'fixed right-auto bottom-auto m-0 box-border block min-w-0 w-max overflow-auto break-words text-start antialiased [&:not(:popover-open)]:hidden',\n 'left-[var(--_rad-popover-left,0px)] top-[var(--_rad-popover-top,0px)] max-w-[min(var(--rad-tooltip-max-width,20rem),var(--_rad-popover-max-width,calc(100vw-1rem)))] max-h-[var(--_rad-popover-max-height,calc(100dvh-1rem))]',\n 'p-[var(--rad-tooltip-padding,0.625rem)] rounded-[var(--rad-tooltip-radius,var(--rad-control-radius,0.5rem))]',\n 'bg-[var(--rad-tooltip-background,var(--rad-color-surface,white))] [color:var(--rad-tooltip-color,var(--rad-color-foreground))] [border-color:var(--rad-tooltip-border-color,var(--rad-color-border))] [border-width:var(--rad-tooltip-border-width,var(--rad-surface-border-width,1px))] [border-style:var(--rad-tooltip-border-style,var(--rad-surface-border-style,solid))] [box-shadow:var(--rad-tooltip-shadow,var(--rad-surface-overlay-shadow,0_8px_32px_#0003))]',\n 'font-[family-name:var(--rad-typography-roles-ui-supporting-family,system-ui,sans-serif)] text-[length:var(--rad-tooltip-font-size,var(--rad-typography-roles-ui-supporting-size,0.8125rem))] font-[number:var(--rad-tooltip-font-weight,var(--rad-typography-roles-ui-supporting-weight,400))] leading-[var(--rad-typography-roles-ui-supporting-line-height,1.5)]',\n 'forced-colors:border-[CanvasText] forced-colors:bg-[Canvas] forced-colors:text-[CanvasText]',\n active && !off && 'opacity-[var(--_rad-popup-enter,0)] motion-reduce:opacity-100',\n className\n )}\n />\n )\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../src/cn.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AAOpC,eAAO,MAAM,EAAE,EAAE,UAqJf,CAAA"}
1
+ {"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../src/cn.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AAOpC,eAAO,MAAM,EAAE,EAAE,UA6Jf,CAAA"}
@@ -14,6 +14,7 @@ export const cn = createCn({
14
14
  'font-(--rad-tabs-font-family)'
15
15
  ],
16
16
  'font-weight': [
17
+ 'font-(--rad-tooltip-font-weight)',
17
18
  ...roleClasses('font', 'weight'),
18
19
  'font-(--rad-combobox-font-weight)',
19
20
  'font-(--rad-select-font-weight)',
@@ -21,6 +22,7 @@ export const cn = createCn({
21
22
  'font-(--rad-tabs-font-weight)'
22
23
  ],
23
24
  'font-size': [
25
+ 'text-(--rad-tooltip-font-size)',
24
26
  ...roleClasses('text', 'size'),
25
27
  ...roleClasses('text', 'fluid-size'),
26
28
  'text-(--rad-combobox-font-size)',
@@ -42,6 +44,7 @@ export const cn = createCn({
42
44
  'w-(--rad-slider-height)',
43
45
  'w-(--rad-slider-length)'
44
46
  ],
47
+ 'max-w': ['max-w-(--rad-tooltip-max-width)'],
45
48
  size: ['size-(--rad-slider-thumb-size)', 'size-(--rad-slider-track-size)'],
46
49
  gap: [
47
50
  'gap-(--rad-popover-gap)',
@@ -58,6 +61,7 @@ export const cn = createCn({
58
61
  'px-(--rad-tabs-trigger-padding)'
59
62
  ],
60
63
  p: [
64
+ 'p-(--rad-tooltip-padding)',
61
65
  'p-(--rad-popover-padding)',
62
66
  'p-(--rad-combobox-content-padding)',
63
67
  'p-(--rad-select-content-padding)',
@@ -65,6 +69,7 @@ export const cn = createCn({
65
69
  'p-(--rad-tabs-content-padding)'
66
70
  ],
67
71
  rounded: [
72
+ 'rounded-(--rad-tooltip-radius)',
68
73
  'rounded-(--rad-popover-radius)',
69
74
  'rounded-(--rad-combobox-radius)',
70
75
  'rounded-(--rad-select-radius)',
@@ -82,6 +87,7 @@ export const cn = createCn({
82
87
  'rounded-(--rad-tabs-content-radius)'
83
88
  ],
84
89
  'border-w': [
90
+ 'border-(--rad-tooltip-border-width)',
85
91
  'border-(--rad-popover-border-width)',
86
92
  'border-(--rad-combobox-border-width)',
87
93
  'border-(--rad-select-border-width)',
@@ -91,6 +97,7 @@ export const cn = createCn({
91
97
  'border-(--rad-tabs-trigger-border-width)'
92
98
  ],
93
99
  'border-style': [
100
+ 'border-(--rad-tooltip-border-style)',
94
101
  'border-(--rad-popover-border-style)',
95
102
  'border-(--rad-combobox-border-style)',
96
103
  'border-(--rad-select-border-style)',
@@ -98,6 +105,7 @@ export const cn = createCn({
98
105
  'border-(--rad-switch-border-style)'
99
106
  ],
100
107
  shadow: [
108
+ 'shadow-(--rad-tooltip-shadow)',
101
109
  'shadow-(--rad-popover-shadow)',
102
110
  'shadow-(--rad-combobox-shadow)',
103
111
  'shadow-(--rad-select-shadow)',
@@ -1 +1 @@
1
- {"version":3,"file":"cn.js","sourceRoot":"","sources":["../../src/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,iFAAiF;AACjF,sFAAsF;AACtF,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,IAAY,EAAE,EAAE,CACnD,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,MAAM,4BAA4B,IAAI,IAAI,IAAI,GAAG,CAAC,CAAA;AACnF,MAAM,CAAC,MAAM,EAAE,GAAe,QAAQ,CAAC;IACrC,MAAM,EAAE;QACN,WAAW,EAAE;YACX,aAAa,EAAE;gBACb,GAAG,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC;gBAChC,mCAAmC;gBACnC,iCAAiC;gBACjC,mCAAmC;gBACnC,+BAA+B;aAChC;YACD,aAAa,EAAE;gBACb,GAAG,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC;gBAChC,mCAAmC;gBACnC,iCAAiC;gBACjC,mCAAmC;gBACnC,+BAA+B;aAChC;YACD,WAAW,EAAE;gBACX,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC;gBAC9B,GAAG,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC;gBACpC,iCAAiC;gBACjC,+BAA+B;gBAC/B,iCAAiC;gBACjC,gCAAgC;gBAChC,6BAA6B;aAC9B;YACD,CAAC,EAAE;gBACD,2BAA2B;gBAC3B,yBAAyB;gBACzB,yBAAyB;gBACzB,yBA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DAAiD;gBACjD,+CAA+C;gBAC/C,+CAA+C;gBAC/C,6CAA6C;aAC9C;YACD,WAAW,EAAE;gBACX,qCAAqC;gBACrC,sCAAsC;gBACtC,oCAAoC;gBACpC,oCAAoC;gBACpC,kCAAkC;aACnC;YACD,gBAAgB,EAAE;gBAChB,6CAA6C;gBAC7C,8CAA8C;gBAC9C,4CAA4C;gBAC5C,4CAA4C;gBAC5C,0CAA0C;aAC3C;YACD,eAAe,EAAE;gBACf,qCAAqC;gBACrC,sCAAsC;gBACtC,oCAAoC;gBACpC,oCAAoC;gBACpC,kCAAkC;aACnC;YACD,OAAO,EAAE,CAAC,uCAAuC,CAAC;YAClD,iBAAiB,EAAE;gBACjB,sDAAsD;gBACtD,+DAA+D;gBAC/D,6DAA6D;aAC9D;YACD,OAAO,EAAE,WAAW,CAAC,SAAS,EAAE,aAAa,CAAC;YAC9C,QAAQ,EAAE,WAAW,CAAC,UAAU,EAAE,gBAAgB,CAAC;YACnD,iBAAiB,EAAE,WAAW,CAAC,YAAY,EAAE,SAAS,CAAC;YACvD,GAAG,EAAE;gBACH,uCAAuC;gBACvC,4CAA4C;gBAC5C,2CAA2C;aAC5C;SACF;KACF;CACF,CAAC,CAAA","sourcesContent":["import { createCn } from 'cn/config'\nimport type { CnFunction } from 'cn'\nimport { typographyRoles } from './themes/tokens.js'\n\n// Semantic hooks live in the components layer. For callers using token shorthand\n// utilities, register non-color variables explicitly rather than guessing from names.\nconst roleClasses = (prefix: string, leaf: string) =>\n typographyRoles.map(role => `${prefix}-(--rad-typography-roles-${role}-${leaf})`)\nexport const cn: CnFunction = createCn({\n extend: {\n classGroups: {\n 'font-family': [\n ...roleClasses('font', 'family'),\n 'font-(--rad-combobox-font-family)',\n 'font-(--rad-select-font-family)',\n 'font-(--rad-textarea-font-family)',\n 'font-(--rad-tabs-font-family)'\n ],\n 'font-weight': [\n ...roleClasses('font', 'weight'),\n 'font-(--rad-combobox-font-weight)',\n 'font-(--rad-select-font-weight)',\n 'font-(--rad-textarea-font-weight)',\n 'font-(--rad-tabs-font-weight)'\n ],\n 'font-size': [\n ...roleClasses('text', 'size'),\n ...roleClasses('text', 'fluid-size'),\n 'text-(--rad-combobox-font-size)',\n 'text-(--rad-select-font-size)',\n 'text-(--rad-textarea-font-size)',\n 'text-(--rad-switch-label-size)',\n 'text-(--rad-tabs-font-size)'\n ],\n h: [\n 'h-(--rad-combobox-height)',\n 'h-(--rad-select-height)',\n 'h-(--rad-switch-height)',\n 'h-(--rad-slider-height)',\n 'h-(--rad-slider-length)'\n ],\n w: [\n 'w-(--rad-popover-width)',\n 'w-(--rad-switch-width)',\n 'w-(--rad-slider-height)',\n 'w-(--rad-slider-length)'\n ],\n size: ['size-(--rad-slider-thumb-size)', 'size-(--rad-slider-track-size)'],\n gap: [\n 'gap-(--rad-popover-gap)',\n 'gap-(--rad-switch-gap)',\n 'gap-(--rad-tabs-gap)',\n 'gap-(--rad-tabs-list-gap)'\n ],\n 'min-h': ['min-h-(--rad-textarea-min-height)', 'min-h-(--rad-tabs-trigger-height)'],\n py: ['py-(--rad-textarea-padding-block)'],\n px: [\n 'px-(--rad-combobox-padding)',\n 'px-(--rad-select-padding)',\n 'px-(--rad-textarea-padding)',\n 'px-(--rad-tabs-trigger-padding)'\n ],\n p: [\n 'p-(--rad-popover-padding)',\n 'p-(--rad-combobox-content-padding)',\n 'p-(--rad-select-content-padding)',\n 'p-(--rad-tabs-list-padding)',\n 'p-(--rad-tabs-content-padding)'\n ],\n rounded: [\n 'rounded-(--rad-popover-radius)',\n 'rounded-(--rad-combobox-radius)',\n 'rounded-(--rad-select-radius)',\n 'rounded-(--rad-textarea-radius)',\n 'rounded-(--rad-switch-radius)',\n 'rounded-(--rad-switch-thumb-radius)',\n 'rounded-(--rad-combobox-content-radius)',\n 'rounded-(--rad-select-content-radius)',\n 'rounded-(--rad-combobox-item-radius)',\n 'rounded-(--rad-select-item-radius)',\n 'rounded-(--rad-slider-track-radius)',\n 'rounded-(--rad-slider-thumb-radius)',\n 'rounded-(--rad-tabs-list-radius)',\n 'rounded-(--rad-tabs-trigger-radius)',\n 'rounded-(--rad-tabs-content-radius)'\n ],\n 'border-w': [\n 'border-(--rad-popover-border-width)',\n 'border-(--rad-combobox-border-width)',\n 'border-(--rad-select-border-width)',\n 'border-(--rad-textarea-border-width)',\n 'border-(--rad-switch-border-width)',\n 'border-(--rad-slider-thumb-border-width)',\n 'border-(--rad-tabs-trigger-border-width)'\n ],\n 'border-style': [\n 'border-(--rad-popover-border-style)',\n 'border-(--rad-combobox-border-style)',\n 'border-(--rad-select-border-style)',\n 'border-(--rad-textarea-border-style)',\n 'border-(--rad-switch-border-style)'\n ],\n shadow: [\n 'shadow-(--rad-popover-shadow)',\n 'shadow-(--rad-combobox-shadow)',\n 'shadow-(--rad-select-shadow)',\n 'shadow-(--rad-combobox-content-shadow)',\n 'shadow-(--rad-select-content-shadow)',\n 'shadow-(--rad-textarea-shadow)',\n 'shadow-(--rad-slider-thumb-shadow)'\n ],\n 'corner-shape': [\n '[corner-shape:var(--rad-popover-corner-shape)]',\n '[corner-shape:var(--rad-combobox-corner-shape)]',\n '[corner-shape:var(--rad-select-corner-shape)]',\n '[corner-shape:var(--rad-textarea-corner-shape)]',\n '[corner-shape:var(--rad-switch-corner-shape)]',\n '[corner-shape:var(--rad-slider-corner-shape)]',\n '[corner-shape:var(--rad-tabs-corner-shape)]'\n ],\n 'outline-w': [\n 'outline-(--rad-popover-focus-width)',\n 'outline-(--rad-textarea-focus-width)',\n 'outline-(--rad-switch-focus-width)',\n 'outline-(--rad-slider-focus-width)',\n 'outline-(--rad-tabs-focus-width)'\n ],\n 'outline-offset': [\n 'outline-offset-(--rad-popover-focus-offset)',\n 'outline-offset-(--rad-textarea-focus-offset)',\n 'outline-offset-(--rad-switch-focus-offset)',\n 'outline-offset-(--rad-slider-focus-offset)',\n 'outline-offset-(--rad-tabs-focus-offset)'\n ],\n 'outline-style': [\n 'outline-(--rad-popover-focus-style)',\n 'outline-(--rad-textarea-focus-style)',\n 'outline-(--rad-switch-focus-style)',\n 'outline-(--rad-slider-focus-style)',\n 'outline-(--rad-tabs-focus-style)'\n ],\n opacity: ['opacity-(--rad-tabs-disabled-opacity)'],\n 'backdrop-filter': [\n '[backdrop-filter:var(--rad-popover-backdrop-filter)]',\n '[backdrop-filter:var(--rad-combobox-content-backdrop-filter)]',\n '[backdrop-filter:var(--rad-select-content-backdrop-filter)]'\n ],\n leading: roleClasses('leading', 'line-height'),\n tracking: roleClasses('tracking', 'letter-spacing'),\n 'max-inline-size': roleClasses('max-inline', 'measure'),\n mbs: [\n 'mbs-(--rad-typography-flow-paragraph)',\n 'mbs-(--rad-typography-flow-heading-before)',\n 'mbs-(--rad-typography-flow-heading-after)'\n ]\n }\n }\n})\n"]}
1
+ {"version":3,"file":"cn.js","sourceRoot":"","sources":["../../src/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,iFAAiF;AACjF,sFAAsF;AACtF,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,IAAY,EAAE,EAAE,CACnD,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,MAAM,4BAA4B,IAAI,IAAI,IAAI,GAAG,CAAC,CAAA;AACnF,MAAM,CAAC,MAAM,EAAE,GAAe,QAAQ,CAAC;IACrC,MAAM,EAAE;QACN,WAAW,EAAE;YACX,aAAa,EAAE;gBACb,GAAG,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC;gBAChC,mCAAmC;gBACnC,iCAAiC;gBACjC,mCAAmC;gBACnC,+BAA+B;aAChC;YACD,aAAa,EAAE;gBACb,kCAAkC;gBAClC,GAAG,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC;gBAChC,mCAAmC;gBACnC,iCAAiC;gBACjC,mCAAmC;gBACnC,+BAA+B;aAChC;YACD,WAAW,EAAE;g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;gBACtC,oCAAoC;gBACpC,0CAA0C;gBAC1C,0CAA0C;aAC3C;YACD,cAAc,EAAE;gBACd,qCAAqC;gBACrC,qCAAqC;gBACrC,sCAAsC;gBACtC,oCAAoC;gBACpC,sCAAsC;gBACtC,oCAAoC;aACrC;YACD,MAAM,EAAE;gBACN,+BAA+B;gBAC/B,+BAA+B;gBAC/B,gCAAgC;gBAChC,8BAA8B;gBAC9B,wCAAwC;gBACxC,sCAAsC;gBACtC,gCAAgC;gBAChC,oCAAoC;aACrC;YACD,cAAc,EAAE;gBACd,gDAAgD;gBAChD,iDAAiD;gBACjD,+CAA+C;gBAC/C,iDAAiD;gBACjD,+CAA+C;gBAC/C,+CAA+C;gBAC/C,6CAA6C;aAC9C;YACD,WAAW,EAAE;gBACX,qCAAqC;gBACrC,sCAAsC;gBACtC,oCAAoC;gBACpC,oCAAoC;gBACpC,kCAAkC;aACnC;YACD,gBAAgB,EAAE;gBAChB,6CAA6C;gBAC7C,8CAA8C;gBAC9C,4CAA4C;gBAC5C,4CAA4C;gBAC5C,0CAA0C;aAC3C;YACD,eAAe,EAAE;gBACf,qCAAqC;gBACrC,sCAAsC;gBACtC,oCAAoC;gBACpC,oCAAoC;gBACpC,kCAAkC;aACnC;YACD,OAAO,EAAE,CAAC,uCAAuC,CAAC;YAClD,iBAAiB,EAAE;gBACjB,sDAAsD;gBACtD,+DAA+D;gBAC/D,6DAA6D;aAC9D;YACD,OAAO,EAAE,WAAW,CAAC,SAAS,EAAE,aAAa,CAAC;YAC9C,QAAQ,EAAE,WAAW,CAAC,UAAU,EAAE,gBAAgB,CAAC;YACnD,iBAAiB,EAAE,WAAW,CAAC,YAAY,EAAE,SAAS,CAAC;YACvD,GAAG,EAAE;gBACH,uCAAuC;gBACvC,4CAA4C;gBAC5C,2CAA2C;aAC5C;SACF;KACF;CACF,CAAC,CAAA","sourcesContent":["import { createCn } from 'cn/config'\nimport type { CnFunction } from 'cn'\nimport { typographyRoles } from './themes/tokens.js'\n\n// Semantic hooks live in the components layer. For callers using token shorthand\n// utilities, register non-color variables explicitly rather than guessing from names.\nconst roleClasses = (prefix: string, leaf: string) =>\n typographyRoles.map(role => `${prefix}-(--rad-typography-roles-${role}-${leaf})`)\nexport const cn: CnFunction = createCn({\n extend: {\n classGroups: {\n 'font-family': [\n ...roleClasses('font', 'family'),\n 'font-(--rad-combobox-font-family)',\n 'font-(--rad-select-font-family)',\n 'font-(--rad-textarea-font-family)',\n 'font-(--rad-tabs-font-family)'\n ],\n 'font-weight': [\n 'font-(--rad-tooltip-font-weight)',\n ...roleClasses('font', 'weight'),\n 'font-(--rad-combobox-font-weight)',\n 'font-(--rad-select-font-weight)',\n 'font-(--rad-textarea-font-weight)',\n 'font-(--rad-tabs-font-weight)'\n ],\n 'font-size': [\n 'text-(--rad-tooltip-font-size)',\n ...roleClasses('text', 'size'),\n ...roleClasses('text', 'fluid-size'),\n 'text-(--rad-combobox-font-size)',\n 'text-(--rad-select-font-size)',\n 'text-(--rad-textarea-font-size)',\n 'text-(--rad-switch-label-size)',\n 'text-(--rad-tabs-font-size)'\n ],\n h: [\n 'h-(--rad-combobox-height)',\n 'h-(--rad-select-height)',\n 'h-(--rad-switch-height)',\n 'h-(--rad-slider-height)',\n 'h-(--rad-slider-length)'\n ],\n w: [\n 'w-(--rad-popover-width)',\n 'w-(--rad-switch-width)',\n 'w-(--rad-slider-height)',\n 'w-(--rad-slider-length)'\n ],\n 'max-w': ['max-w-(--rad-tooltip-max-width)'],\n size: ['size-(--rad-slider-thumb-size)', 'size-(--rad-slider-track-size)'],\n gap: [\n 'gap-(--rad-popover-gap)',\n 'gap-(--rad-switch-gap)',\n 'gap-(--rad-tabs-gap)',\n 'gap-(--rad-tabs-list-gap)'\n ],\n 'min-h': ['min-h-(--rad-textarea-min-height)', 'min-h-(--rad-tabs-trigger-height)'],\n py: ['py-(--rad-textarea-padding-block)'],\n px: [\n 'px-(--rad-combobox-padding)',\n 'px-(--rad-select-padding)',\n 'px-(--rad-textarea-padding)',\n 'px-(--rad-tabs-trigger-padding)'\n ],\n p: [\n 'p-(--rad-tooltip-padding)',\n 'p-(--rad-popover-padding)',\n 'p-(--rad-combobox-content-padding)',\n 'p-(--rad-select-content-padding)',\n 'p-(--rad-tabs-list-padding)',\n 'p-(--rad-tabs-content-padding)'\n ],\n rounded: [\n 'rounded-(--rad-tooltip-radius)',\n 'rounded-(--rad-popover-radius)',\n 'rounded-(--rad-combobox-radius)',\n 'rounded-(--rad-select-radius)',\n 'rounded-(--rad-textarea-radius)',\n 'rounded-(--rad-switch-radius)',\n 'rounded-(--rad-switch-thumb-radius)',\n 'rounded-(--rad-combobox-content-radius)',\n 'rounded-(--rad-select-content-radius)',\n 'rounded-(--rad-combobox-item-radius)',\n 'rounded-(--rad-select-item-radius)',\n 'rounded-(--rad-slider-track-radius)',\n 'rounded-(--rad-slider-thumb-radius)',\n 'rounded-(--rad-tabs-list-radius)',\n 'rounded-(--rad-tabs-trigger-radius)',\n 'rounded-(--rad-tabs-content-radius)'\n ],\n 'border-w': [\n 'border-(--rad-tooltip-border-width)',\n 'border-(--rad-popover-border-width)',\n 'border-(--rad-combobox-border-width)',\n 'border-(--rad-select-border-width)',\n 'border-(--rad-textarea-border-width)',\n 'border-(--rad-switch-border-width)',\n 'border-(--rad-slider-thumb-border-width)',\n 'border-(--rad-tabs-trigger-border-width)'\n ],\n 'border-style': [\n 'border-(--rad-tooltip-border-style)',\n 'border-(--rad-popover-border-style)',\n 'border-(--rad-combobox-border-style)',\n 'border-(--rad-select-border-style)',\n 'border-(--rad-textarea-border-style)',\n 'border-(--rad-switch-border-style)'\n ],\n shadow: [\n 'shadow-(--rad-tooltip-shadow)',\n 'shadow-(--rad-popover-shadow)',\n 'shadow-(--rad-combobox-shadow)',\n 'shadow-(--rad-select-shadow)',\n 'shadow-(--rad-combobox-content-shadow)',\n 'shadow-(--rad-select-content-shadow)',\n 'shadow-(--rad-textarea-shadow)',\n 'shadow-(--rad-slider-thumb-shadow)'\n ],\n 'corner-shape': [\n '[corner-shape:var(--rad-popover-corner-shape)]',\n '[corner-shape:var(--rad-combobox-corner-shape)]',\n '[corner-shape:var(--rad-select-corner-shape)]',\n '[corner-shape:var(--rad-textarea-corner-shape)]',\n '[corner-shape:var(--rad-switch-corner-shape)]',\n '[corner-shape:var(--rad-slider-corner-shape)]',\n '[corner-shape:var(--rad-tabs-corner-shape)]'\n ],\n 'outline-w': [\n 'outline-(--rad-popover-focus-width)',\n 'outline-(--rad-textarea-focus-width)',\n 'outline-(--rad-switch-focus-width)',\n 'outline-(--rad-slider-focus-width)',\n 'outline-(--rad-tabs-focus-width)'\n ],\n 'outline-offset': [\n 'outline-offset-(--rad-popover-focus-offset)',\n 'outline-offset-(--rad-textarea-focus-offset)',\n 'outline-offset-(--rad-switch-focus-offset)',\n 'outline-offset-(--rad-slider-focus-offset)',\n 'outline-offset-(--rad-tabs-focus-offset)'\n ],\n 'outline-style': [\n 'outline-(--rad-popover-focus-style)',\n 'outline-(--rad-textarea-focus-style)',\n 'outline-(--rad-switch-focus-style)',\n 'outline-(--rad-slider-focus-style)',\n 'outline-(--rad-tabs-focus-style)'\n ],\n opacity: ['opacity-(--rad-tabs-disabled-opacity)'],\n 'backdrop-filter': [\n '[backdrop-filter:var(--rad-popover-backdrop-filter)]',\n '[backdrop-filter:var(--rad-combobox-content-backdrop-filter)]',\n '[backdrop-filter:var(--rad-select-content-backdrop-filter)]'\n ],\n leading: roleClasses('leading', 'line-height'),\n tracking: roleClasses('tracking', 'letter-spacing'),\n 'max-inline-size': roleClasses('max-inline', 'measure'),\n mbs: [\n 'mbs-(--rad-typography-flow-paragraph)',\n 'mbs-(--rad-typography-flow-heading-before)',\n 'mbs-(--rad-typography-flow-heading-after)'\n ]\n }\n }\n})\n"]}
@@ -1,6 +1,8 @@
1
1
  export { Combobox, ComboboxInput, ComboboxTrigger, ComboboxClear, ComboboxPortal, ComboboxContent, ComboboxItem, ComboboxStatus, useCombobox } from './Combobox.js';
2
2
  export type { ComboboxProps, ComboboxOption, ComboboxState, ComboboxInputProps, ComboboxTriggerProps, ComboboxClearProps, ComboboxContentProps, ComboboxItemProps, ComboboxStatusProps } from './Combobox.js';
3
3
  export { Button } from './Button.js';
4
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipPortal, useTooltip } from './Tooltip.js';
5
+ export type { TooltipProps, TooltipState, TooltipTriggerProps, TooltipContentProps, TooltipPortalProps, TooltipRenderProps } from './Tooltip.js';
4
6
  export { Popover, PopoverTrigger, PopoverContent, PopoverClose, PopoverPortal, usePopover } from './Popover.js';
5
7
  export type { PopoverProps, PopoverState, PopoverTriggerProps, PopoverContentProps, PopoverCloseProps, PopoverPortalProps, PopoverRenderProps, PopoverSide, PopoverAlign } from './Popover.js';
6
8
  export { Link } from './Link.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,aAAa,EACb,eAAe,EACf,aAAa,EACb,cAAc,EACd,eAAe,EACf,YAAY,EACZ,cAAc,EACd,WAAW,EACZ,MAAM,eAAe,CAAA;AACtB,YAAY,EACV,aAAa,EACb,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,EACd,YAAY,EACZ,aAAa,EACb,UAAU,EACX,MAAM,cAAc,CAAA;AACrB,YAAY,EACV,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACb,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,YAAY,EAAE,SAAS,EAAE,e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,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAC9E,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,aAAa,EACb,eAAe,EACf,aAAa,EACb,cAAc,EACd,eAAe,EACf,YAAY,EACZ,cAAc,EACd,WAAW,EACZ,MAAM,eAAe,CAAA;AACtB,YAAY,EACV,aAAa,EACb,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACjG,YAAY,EACV,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,EACd,YAAY,EACZ,aAAa,EACb,UAAU,EACX,MAAM,cAAc,CAAA;AACrB,YAAY,EACV,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACb,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,WAAW,E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nB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAC9E,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,oBAAoB,CAAA"}
@@ -1,5 +1,6 @@
1
1
  export { Combobox, ComboboxInput, ComboboxTrigger, ComboboxClear, ComboboxPortal, ComboboxContent, ComboboxItem, ComboboxStatus, useCombobox } from './Combobox.js';
2
2
  export { Button } from './Button.js';
3
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipPortal, useTooltip } from './Tooltip.js';
3
4
  export { Popover, PopoverTrigger, PopoverContent, PopoverClose, PopoverPortal, usePopover } from './Popover.js';
4
5
  export { Link } from './Link.js';
5
6
  export { Field, useField } from './Field.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,aAAa,EACb,eAAe,EACf,aAAa,EACb,cAAc,EACd,eAAe,EACf,YAAY,EACZ,cAAc,EACd,WAAW,EACZ,MAAM,eAAe,CAAA;AAYtB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,EACd,YAAY,EACZ,aAAa,EACb,UAAU,EACX,MAAM,cAAc,CAAA;AAYrB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAE5C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,IAAI,EAAE,QAAQ,EA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EACnB,mBAAmB,EACnB,2BAA2B,EAC5B,MAAM,mBAAmB,CAAA;AAiB1B,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAE7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAUxD,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA","sourcesContent":["export {\n Combobox,\n ComboboxInput,\n ComboboxTrigger,\n ComboboxClear,\n ComboboxPortal,\n ComboboxContent,\n ComboboxItem,\n ComboboxStatus,\n useCombobox\n} from './Combobox.js'\nexport type {\n ComboboxProps,\n ComboboxOption,\n ComboboxState,\n ComboboxInputProps,\n ComboboxTriggerProps,\n ComboboxClearProps,\n ComboboxContentProps,\n ComboboxItemProps,\n ComboboxStatusProps\n} from './Combobox.js'\nexport { Button } from './Button.js'\nexport {\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverClose,\n PopoverPortal,\n usePopover\n} from './Popover.js'\nexport type {\n PopoverProps,\n PopoverState,\n PopoverTriggerProps,\n PopoverContentProps,\n PopoverCloseProps,\n PopoverPortalProps,\n PopoverRenderProps,\n PopoverSide,\n PopoverAlign\n} from './Popover.js'\nexport { Link } from './Link.js'\nexport type { LinkProps, LinkRenderProps, LinkVariant } from './Link.js'\nexport { Field, useField } from './Field.js'\nexport type { FieldControlProps, FieldLayout, FieldProps, FieldState } from './Field.js'\nexport { Input } from './Input.js'\nexport type { InputProps } from './Input.js'\nexport { Textarea } from './Textarea.js'\nexport type { TextareaProps } from './Textarea.js'\nexport { Slider } from './Slider.js'\nexport type { SliderProps } from './Slider.js'\nexport { Tabs, TabsList, TabsTrigger, TabsContent, useTabs } from './Tabs.js'\nexport type {\n TabsProps,\n TabsListProps,\n TabsTriggerProps,\n TabsContentProps,\n TabsState\n} from './Tabs.js'\nexport {\n Select,\n SelectTrigger,\n SelectValue,\n SelectIcon,\n SelectPortal,\n SelectContent,\n SelectViewport,\n SelectItem,\n SelectItemText,\n SelectItemIndicator,\n SelectGroup,\n useSelect\n} from './Select.js'\nexport type {\n SelectProps,\n SelectOption,\n SelectState,\n SelectTriggerProps,\n SelectValueProps,\n SelectIconProps,\n SelectContentProps,\n SelectViewportProps,\n SelectItemProps,\n SelectItemTextProps,\n SelectGroupProps\n} from './Select.js'\nexport { Switch } from './Switch.js'\nexport type { SwitchProps } from './Switch.js'\nexport { Checkbox } from './Checkbox.js'\nexport type { CheckboxProps } from './Checkbox.js'\nexport { Radio, RadioGroup } from './RadioGroup.js'\nexport type { RadioGroupProps, RadioProps } from './RadioGroup.js'\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogTitle,\n DialogTrigger,\n useDialog\n} from './Dialog.js'\nexport type {\n DialogCloseProps,\n DialogContentProps,\n DialogDescriptionProps,\n DialogProps,\n DialogRenderProps,\n DialogState,\n DialogTitleProps,\n DialogTriggerProps\n} from './Dialog.js'\nexport {\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogContent,\n AlertDialogTitle,\n AlertDialogDescription,\n AlertDialogAction,\n AlertDialogCancel,\n useAlertDialog\n} from './AlertDialog.js'\nexport type {\n AlertDialogProps,\n AlertDialogState,\n AlertDialogRenderProps,\n AlertDialogTriggerProps,\n AlertDialogContentProps,\n AlertDialogTitleProps,\n AlertDialogDescriptionProps,\n AlertDialogActionProps,\n AlertDialogCancelProps\n} from './AlertDialog.js'\nexport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n useCollapsible\n} from './Collapsible.js'\nexport type {\n CollapsibleContentProps,\n CollapsibleProps,\n CollapsibleState,\n CollapsibleTriggerProps\n} from './Collapsible.js'\nexport {\n Accordion,\n AccordionContent,\n AccordionItem,\n AccordionTrigger,\n useAccordion\n} from './Accordion.js'\nexport type {\n AccordionContentProps,\n AccordionHeadingLevel,\n AccordionItemProps,\n AccordionProps,\n AccordionState,\n AccordionTriggerProps,\n AccordionValue\n} from './Accordion.js'\nexport { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from './Card.js'\nexport type {\n CardContentProps,\n CardDescriptionProps,\n CardFooterProps,\n CardHeaderProps,\n CardHeadingLevel,\n CardProps,\n CardTitleProps\n} from './Card.js'\nexport { defineTheme, updateThemeAppearance, defaultTheme } from './themes/index.js'\nexport type {\n SharedTokens,\n ThemeAppearanceSettings,\n ThemeGeometrySettings,\n Theme,\n ThemeComponentOverrides,\n ThemeDefinition,\n ThemeLayer,\n ThemeMode,\n ThemeStyle,\n ThemeTokens\n} from './themes/index.js'\nexport { ThemeScope } from './ThemeScope.js'\nexport type { ThemeScopeProps } from './ThemeScope.js'\nexport type { ButtonProps, ButtonRenderProps, ButtonVariant } from './Button.js'\nexport { generateTypography, typographyPresets, typographyRoles } from './typography/index.js'\nexport type * from './typography/types.js'\nexport type { ControlSize, Tone } from './presentation.js'\n\nexport {\n defineThemeDocument,\n parseThemeDocument,\n compileThemeDocument,\n updateThemeDocument,\n exportThemeSections,\n themeDocumentFromDefinition\n} from './themes/index.js'\nexport type {\n ThemeDocument,\n ThemeSectionExport,\n ThemeSections,\n ThemeSectionName,\n ThemeSection,\n ThemeColorSection,\n ThemeColorStop,\n ThemeBrandSource,\n ThemePalette,\n ThemeMotionSection,\n ThemeTypographySection,\n ThemeFontAxis,\n ThemeFontMetadata\n} from './themes/index.js'\n\nexport { generateColorWall, colorCalibrationPresets } from './color/index.js'\nexport type { ColorWall, ColorWallInput, ColorCalibrationPreset } from './color/index.js'\nexport { recommendColorPalette } from './color/index.js'\nexport type {\n ColorPalette,\n ColorPaletteOptions,\n PaletteModeColors,\n PaletteColorPair,\n PaletteContrastCheck,\n WorkingPaletteRole\n} from './color/index.js'\n\nexport { defineMotionProfile, defaultMotionProfile } from './motion/config.js'\nexport type {\n MotionProfile,\n MotionProfileInput,\n MotionInteraction,\n SpringParameters\n} from './motion/config.js'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,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kB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACf,MAAM,kBAAkB,CAAA;AAYzB,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACf,MAAM,kBAAkB,CAAA;AAOzB,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACb,MAAM,gBAAgB,CAAA;AAUvB,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAUjG,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAapF,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAG5C,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAI9F,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,2BAA2B,EAC5B,MAAM,mBAAmB,CAAA;AAiB1B,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAE7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAUxD,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA","sourcesContent":["export {\n Combobox,\n ComboboxInput,\n ComboboxTrigger,\n ComboboxClear,\n ComboboxPortal,\n ComboboxContent,\n ComboboxItem,\n ComboboxStatus,\n useCombobox\n} from './Combobox.js'\nexport type {\n ComboboxProps,\n ComboboxOption,\n ComboboxState,\n ComboboxInputProps,\n ComboboxTriggerProps,\n ComboboxClearProps,\n ComboboxContentProps,\n ComboboxItemProps,\n ComboboxStatusProps\n} from './Combobox.js'\nexport { Button } from './Button.js'\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipPortal, useTooltip } from './Tooltip.js'\nexport type {\n TooltipProps,\n TooltipState,\n TooltipTriggerProps,\n TooltipContentProps,\n TooltipPortalProps,\n TooltipRenderProps\n} from './Tooltip.js'\nexport {\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverClose,\n PopoverPortal,\n usePopover\n} from './Popover.js'\nexport type {\n PopoverProps,\n PopoverState,\n PopoverTriggerProps,\n PopoverContentProps,\n PopoverCloseProps,\n PopoverPortalProps,\n PopoverRenderProps,\n PopoverSide,\n PopoverAlign\n} from './Popover.js'\nexport { Link } from './Link.js'\nexport type { LinkProps, LinkRenderProps, LinkVariant } from './Link.js'\nexport { Field, useField } from './Field.js'\nexport type { FieldControlProps, FieldLayout, FieldProps, FieldState } from './Field.js'\nexport { Input } from './Input.js'\nexport type { InputProps } from './Input.js'\nexport { Textarea } from './Textarea.js'\nexport type { TextareaProps } from './Textarea.js'\nexport { Slider } from './Slider.js'\nexport type { SliderProps } from './Slider.js'\nexport { Tabs, TabsList, TabsTrigger, TabsContent, useTabs } from './Tabs.js'\nexport type {\n TabsProps,\n TabsListProps,\n TabsTriggerProps,\n TabsContentProps,\n TabsState\n} from './Tabs.js'\nexport {\n Select,\n SelectTrigger,\n SelectValue,\n SelectIcon,\n SelectPortal,\n SelectContent,\n SelectViewport,\n SelectItem,\n SelectItemText,\n SelectItemIndicator,\n SelectGroup,\n useSelect\n} from './Select.js'\nexport type {\n SelectProps,\n SelectOption,\n SelectState,\n SelectTriggerProps,\n SelectValueProps,\n SelectIconProps,\n SelectContentProps,\n SelectViewportProps,\n SelectItemProps,\n SelectItemTextProps,\n SelectGroupProps\n} from './Select.js'\nexport { Switch } from './Switch.js'\nexport type { SwitchProps } from './Switch.js'\nexport { Checkbox } from './Checkbox.js'\nexport type { CheckboxProps } from './Checkbox.js'\nexport { Radio, RadioGroup } from './RadioGroup.js'\nexport type { RadioGroupProps, RadioProps } from './RadioGroup.js'\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogTitle,\n DialogTrigger,\n useDialog\n} from './Dialog.js'\nexport type {\n DialogCloseProps,\n DialogContentProps,\n DialogDescriptionProps,\n DialogProps,\n DialogRenderProps,\n DialogState,\n DialogTitleProps,\n DialogTriggerProps\n} from './Dialog.js'\nexport {\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogContent,\n AlertDialogTitle,\n AlertDialogDescription,\n AlertDialogAction,\n AlertDialogCancel,\n useAlertDialog\n} from './AlertDialog.js'\nexport type {\n AlertDialogProps,\n AlertDialogState,\n AlertDialogRenderProps,\n AlertDialogTriggerProps,\n AlertDialogContentProps,\n AlertDialogTitleProps,\n AlertDialogDescriptionProps,\n AlertDialogActionProps,\n AlertDialogCancelProps\n} from './AlertDialog.js'\nexport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n useCollapsible\n} from './Collapsible.js'\nexport type {\n CollapsibleContentProps,\n CollapsibleProps,\n CollapsibleState,\n CollapsibleTriggerProps\n} from './Collapsible.js'\nexport {\n Accordion,\n AccordionContent,\n AccordionItem,\n AccordionTrigger,\n useAccordion\n} from './Accordion.js'\nexport type {\n AccordionContentProps,\n AccordionHeadingLevel,\n AccordionItemProps,\n AccordionProps,\n AccordionState,\n AccordionTriggerProps,\n AccordionValue\n} from './Accordion.js'\nexport { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from './Card.js'\nexport type {\n CardContentProps,\n CardDescriptionProps,\n CardFooterProps,\n CardHeaderProps,\n CardHeadingLevel,\n CardProps,\n CardTitleProps\n} from './Card.js'\nexport { defineTheme, updateThemeAppearance, defaultTheme } from './themes/index.js'\nexport type {\n SharedTokens,\n ThemeAppearanceSettings,\n ThemeGeometrySettings,\n Theme,\n ThemeComponentOverrides,\n ThemeDefinition,\n ThemeLayer,\n ThemeMode,\n ThemeStyle,\n ThemeTokens\n} from './themes/index.js'\nexport { ThemeScope } from './ThemeScope.js'\nexport type { ThemeScopeProps } from './ThemeScope.js'\nexport type { ButtonProps, ButtonRenderProps, ButtonVariant } from './Button.js'\nexport { generateTypography, typographyPresets, typographyRoles } from './typography/index.js'\nexport type * from './typography/types.js'\nexport type { ControlSize, Tone } from './presentation.js'\n\nexport {\n defineThemeDocument,\n parseThemeDocument,\n compileThemeDocument,\n updateThemeDocument,\n exportThemeSections,\n themeDocumentFromDefinition\n} from './themes/index.js'\nexport type {\n ThemeDocument,\n ThemeSectionExport,\n ThemeSections,\n ThemeSectionName,\n ThemeSection,\n ThemeColorSection,\n ThemeColorStop,\n ThemeBrandSource,\n ThemePalette,\n ThemeMotionSection,\n ThemeTypographySection,\n ThemeFontAxis,\n ThemeFontMetadata\n} from './themes/index.js'\n\nexport { generateColorWall, colorCalibrationPresets } from './color/index.js'\nexport type { ColorWall, ColorWallInput, ColorCalibrationPreset } from './color/index.js'\nexport { recommendColorPalette } from './color/index.js'\nexport type {\n ColorPalette,\n ColorPaletteOptions,\n PaletteModeColors,\n PaletteColorPair,\n PaletteContrastCheck,\n WorkingPaletteRole\n} from './color/index.js'\n\nexport { defineMotionProfile, defaultMotionProfile } from './motion/config.js'\nexport type {\n MotionProfile,\n MotionProfileInput,\n MotionInteraction,\n SpringParameters\n} from './motion/config.js'\n"]}
@@ -1,6 +1,6 @@
1
1
  import { type RefObject } from 'react';
2
2
  import { type PopoverAlign, type PopoverSide } from '../internal/popover.js';
3
- export declare function usePopoverSurface(nodeRef: RefObject<HTMLDivElement | null>, trigger: HTMLButtonElement | null, open: boolean, close: (restore: boolean) => void, restoreFocus: RefObject<boolean>, options: {
3
+ export declare function usePopoverSurface<Node extends HTMLElement>(nodeRef: RefObject<Node | null>, trigger: HTMLButtonElement | null, open: boolean, close: (restore: boolean) => void, restoreFocus: RefObject<boolean>, options: {
4
4
  initialFocusRef?: RefObject<HTMLElement | null>;
5
5
  side: PopoverSide;
6
6
  align: PopoverAlign;
@@ -1 +1 @@
1
- {"version":3,"file":"usePopoverSurface.d.ts","sourceRoot":"","sources":["../../../src/react/usePopoverSurface.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACzE,OAAO,EAAmB,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAK7F,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,EACzC,OAAO,EAAE,iBAAiB,GAAG,IAAI,EACjC,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,EACjC,YAAY,EAAE,SAAS,CAAC,OAAO,CAAC,EAChC,OAAO,EAAE;IACP,eAAe,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAC/C,IAAI,EAAE,WAAW,CAAA;IACjB,KAAK,EAAE,YAAY,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,gBAAgB,EAAE,MAAM,CAAA;CACzB,QA0LF"}
1
+ {"version":3,"file":"usePopoverSurface.d.ts","sourceRoot":"","sources":["../../../src/react/usePopoverSurface.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACzE,OAAO,EAAmB,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAK7F,wBAAgB,iBAAiB,CAAC,IAAI,SAAS,WAAW,EACxD,OAAO,EAAE,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,EAC/B,OAAO,EAAE,iBAAiB,GAAG,IAAI,EACjC,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,EACjC,YAAY,EAAE,SAAS,CAAC,OAAO,CAAC,EAChC,OAAO,EAAE;IACP,eAAe,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAC/C,IAAI,EAAE,WAAW,CAAA;IACjB,KAAK,EAA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AC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;YACjD,GAAG,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;YAC3C,GAAG,CAAC,cAAc,EAAE,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;YAC3D,GAAG,CAAC,cAAc,EAAE,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;YAC3D,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;YACpC,IAAI,CAAC,KAAK,CAAC,MAAM;gBAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;YACrC,IAAI,aAAa,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,OAAO,CAAC,WAAW;gBAC5E,OAAO,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAA;YACxC,IAAI,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;gBAAE,IAAI,CAAC,WAAW,EAAE,CAAA;YACrD,UAAU,CAAC,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAA;QAC/B,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC,CAAA;IACtD,eAAe,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,gBAAgB,CAAC,CAAC,CAAA;AAC1F,CAAC","sourcesContent":["'use client'\n\nimport { useLayoutEffect, useRef, useState, type RefObject } from 'react'\nimport { positionPopover, type PopoverAlign, type PopoverSide } from '../internal/popover.js'\n\n// Each document owns its layers; imports never inspect a browser global.\nconst layers = new WeakMap<Document, HTMLElement[]>()\n\nexport function usePopoverSurface(\n nodeRef: RefObject<HTMLDivElement | null>,\n trigger: HTMLButtonElement | null,\n open: boolean,\n close: (restore: boolean) => void,\n restoreFocus: RefObject<boolean>,\n options: {\n initialFocusRef?: RefObject<HTMLElement | null>\n side: PopoverSide\n align: PopoverAlign\n sideOffset: number\n collisionPadding: number\n }\n) {\n const latest = useRef({ ...options, open, close })\n const reposition = useRef(() => {})\n const ancestorClosing = useRef(false)\n const [generation, setGeneration] = useState(0)\n useLayoutEffect(() => {\n latest.current = { ...options, open, close }\n })\n const { side, align, sideOffset, collisionPadding } = options\n\n useLayoutEffect(() => {\n const node = nodeRef.current\n if (!node || !trigger) return\n const ancestors: HTMLElement[] = []\n for (let parent = trigger.parentElement; parent; parent = parent.parentElement) {\n if (parent.matches('dialog, [popover]')) ancestors.push(parent)\n }\n const reconcile = () => {\n if (!latest.current.open) return\n const visible = trigger.checkVisibility()\n if (!visible && node.matches(':popover-open')) {\n ancestorClosing.current = true\n latest.current.close(false)\n node.hidePopover()\n setGeneration(value => value + 1)\n } else if (visible && !node.matches(':popover-open')) setGeneration(value => value + 1)\n }\n const observer = new node.ownerDocument.defaultView!.MutationObserver(reconcile)\n for (const ancestor of ancestors) {\n observer.observe(ancestor, { attributes: true, attributeFilter: ['open', 'data-state'] })\n ancestor.addEventListener('toggle', reconcile)\n }\n return () => {\n observer.disconnect()\n for (const ancestor of ancestors) ancestor.removeEventListener('toggle', reconcile)\n }\n }, [nodeRef, trigger])\n\n useLayoutEffect(() => {\n const node = nodeRef.current\n if (!node || !trigger || !open || !trigger.checkVisibility() || generation < 0) return\n const doc = node.ownerDocument\n const win = doc.defaultView!\n const shouldRestore = () => restoreFocus.current\n const place = () => {\n if (!node.isConnected || !node.matches(':popover-open')) return\n const { side, align, sideOffset, collisionPadding } = latest.current\n const viewport = win.visualViewport\n const view = {\n top: viewport?.offsetTop ?? 0,\n left: viewport?.offsetLeft ?? 0,\n width: viewport?.width ?? win.innerWidth,\n height: viewport?.height ?? win.innerHeight\n }\n node.style.setProperty(\n '--_rad-popover-max-width',\n `${Math.max(0, view.width - 2 * collisionPadding)}px`\n )\n node.style.setProperty(\n '--_rad-popover-max-height',\n `${Math.max(0, view.height - 2 * collisionPadding)}px`\n )\n const css = win.getComputedStyle(node)\n const next = positionPopover({\n anchor: trigger.getBoundingClientRect(),\n width: node.offsetWidth,\n height:\n node.scrollHeight + parseFloat(css.borderTopWidth) + parseFloat(css.borderBottomWidth),\n viewport: view,\n side,\n align,\n offset: sideOffset,\n padding: collisionPadding,\n rtl: win.getComputedStyle(trigger).direction === 'rtl'\n })\n for (const key of ['left', 'top', 'maxWidth', 'maxHeight'] as const) {\n const property = key === 'maxWidth' ? 'max-width' : key === 'maxHeight' ? 'max-height' : key\n node.style.setProperty(`--_rad-popover-${property}`, `${next[key]}px`)\n }\n node.dataset.side = next.side\n node.dataset.align = next.align\n }\n // A manual native popover keeps controlled owners authoritative and avoids auto-stack reopen loops.\n // The source preserves the browser's logical Tab order without assigning content semantics.\n node.showPopover({ source: trigger })\n ancestorClosing.current = false\n reposition.current = place\n place()\n const target = latest.current.initialFocusRef?.current\n if (target && node.contains(target)) target.focus({ preventScroll: true })\n const stack = layers.get(doc) ?? []\n layers.set(doc, stack)\n const descendant = stack.findIndex(layer => node.contains(layer))\n if (descendant < 0) stack.push(node)\n else stack.splice(descendant, 0, node)\n let frame = 0\n const schedule = () => {\n if (!frame)\n frame = win.requestAnimationFrame(() => {\n frame = 0\n place()\n })\n }\n const inside = (target: EventTarget | null) =>\n target instanceof win.Node && (node.contains(target) || trigger.contains(target))\n let pointerDismissed = false\n const pointerEnd = () => {\n pointerDismissed = false\n }\n const outside = (event: PointerEvent | FocusEvent) => {\n if (\n event.type === 'focusin' &&\n (event.target === doc.body || event.target === doc.documentElement)\n )\n return\n if (event.type === 'focusin' && pointerDismissed) return\n if (event.type === 'pointerdown') pointerDismissed = !inside(event.target)\n if (!inside(event.target)) latest.current.close(false)\n }\n const escape = (event: KeyboardEvent) => {\n if (\n event.key !== 'Escape' ||\n event.defaultPrevented ||\n stack.filter(layer => layer.matches(':popover-open')).at(-1) !== node\n )\n return\n const modal = Array.from(doc.querySelectorAll('dialog:modal')).at(-1)\n if (modal && !modal.contains(node)) return\n const nested =\n event.target instanceof win.Element ? event.target.closest('[popover]:popover-open') : null\n if (\n nested &&\n nested !== node &&\n node.contains(nested) &&\n nested.getAttribute('popover') !== 'manual'\n )\n return\n event.preventDefault()\n event.stopPropagation()\n latest.current.close(true)\n }\n const toggle = () => {\n if (ancestorClosing.current || node.matches(':popover-open') || !latest.current.open) return\n latest.current.close(true)\n // Native hide is an observation; a controlled owner may refuse the request.\n setGeneration(value => value + 1)\n }\n const observer = new win.ResizeObserver(schedule)\n const mutations = new win.MutationObserver(schedule)\n observer.observe(trigger)\n observer.observe(node)\n mutations.observe(node, { childList: true, subtree: true, characterData: true })\n node.addEventListener('toggle', toggle)\n doc.addEventListener('pointerdown', outside, true)\n doc.addEventListener('pointerup', pointerEnd, true)\n doc.addEventListener('pointercancel', pointerEnd, true)\n doc.addEventListener('focusin', outside)\n doc.addEventListener('keydown', escape)\n doc.addEventListener('scroll', schedule, true)\n win.addEventListener('resize', schedule)\n win.visualViewport?.addEventListener('resize', schedule)\n win.visualViewport?.addEventListener('scroll', schedule)\n return () => {\n observer.disconnect()\n mutations.disconnect()\n win.cancelAnimationFrame(frame)\n node.removeEventListener('toggle', toggle)\n doc.removeEventListener('pointerdown', outside, true)\n doc.removeEventListener('pointerup', pointerEnd, true)\n doc.removeEventListener('pointercancel', pointerEnd, true)\n doc.removeEventListener('focusin', outside)\n doc.removeEventListener('keydown', escape)\n doc.removeEventListener('scroll', schedule, true)\n win.removeEventListener('resize', schedule)\n win.visualViewport?.removeEventListener('resize', schedule)\n win.visualViewport?.removeEventListener('scroll', schedule)\n stack.splice(stack.indexOf(node), 1)\n if (!stack.length) layers.delete(doc)\n if (shouldRestore() && node.contains(doc.activeElement) && trigger.isConnected)\n trigger.focus({ preventScroll: true })\n if (node.matches(':popover-open')) node.hidePopover()\n reposition.current = () => {}\n }\n }, [nodeRef, trigger, open, generation, restoreFocus])\n useLayoutEffect(() => reposition.current(), [side, align, sideOffset, collisionPadding])\n}\n"]}
1
+ {"version":3,"file":"usePopoverSurface.js","sourceRoot":"","sources":["../../../src/react/usePopoverSurface.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAA;AACzE,OAAO,EAAE,eAAe,EAAuC,MAAM,wBAAwB,CAAA;AAE7F,yEAAyE;AACzE,MAAM,MAAM,GAAG,IAAI,OAAO,EAA2B,CAAA;AAErD,MAAM,UAAU,iBAAiB,CAC/B,OAA+B,EAC/B,OAAiC,EACjC,IAAa,EACb,KAAiC,EACjC,YAAgC,EAChC,OAMC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;IAClD,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;IACnC,MAAM,eAAe,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IACrC,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC/C,eAAe,CAAC,GAAG,EAAE;QACnB,MAAM,CAAC,OAAO,GAAG,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;IAC9C,CAAC,CAAC,CAAA;IACF,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAA;IAE7D,eAAe,CAAC,GAAG,EAAE;QACnB,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAA;QAC5B,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO;YAAE,OAAM;QAC7B,MAAM,SAAS,GAAkB,EAAE,CAAA;QACnC,KAAK,IAAI,MAAM,GAA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AAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;YACjD,GAAG,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;YAC3C,GAAG,CAAC,cAAc,EAAE,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;YAC3D,GAAG,CAAC,cAAc,EAAE,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;YAC3D,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;YACpC,IAAI,CAAC,KAAK,CAAC,MAAM;gBAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;YACrC,IAAI,aAAa,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,OAAO,CAAC,WAAW;gBAC5E,OAAO,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAA;YACxC,IAAI,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;gBAAE,IAAI,CAAC,WAAW,EAAE,CAAA;YACrD,UAAU,CAAC,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAA;QAC/B,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC,CAAA;IACtD,eAAe,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,gBAAgB,CAAC,CAAC,CAAA;AAC1F,CAAC","sourcesContent":["'use client'\n\nimport { useLayoutEffect, useRef, useState, type RefObject } from 'react'\nimport { positionPopover, type PopoverAlign, type PopoverSide } from '../internal/popover.js'\n\n// Each document owns its layers; imports never inspect a browser global.\nconst layers = new WeakMap<Document, HTMLElement[]>()\n\nexport function usePopoverSurface<Node extends HTMLElement>(\n nodeRef: RefObject<Node | null>,\n trigger: HTMLButtonElement | null,\n open: boolean,\n close: (restore: boolean) => void,\n restoreFocus: RefObject<boolean>,\n options: {\n initialFocusRef?: RefObject<HTMLElement | null>\n side: PopoverSide\n align: PopoverAlign\n sideOffset: number\n collisionPadding: number\n }\n) {\n const latest = useRef({ ...options, open, close })\n const reposition = useRef(() => {})\n const ancestorClosing = useRef(false)\n const [generation, setGeneration] = useState(0)\n useLayoutEffect(() => {\n latest.current = { ...options, open, close }\n })\n const { side, align, sideOffset, collisionPadding } = options\n\n useLayoutEffect(() => {\n const node = nodeRef.current\n if (!node || !trigger) return\n const ancestors: HTMLElement[] = []\n for (let parent = trigger.parentElement; parent; parent = parent.parentElement) {\n if (parent.matches('dialog, [popover]')) ancestors.push(parent)\n }\n const reconcile = () => {\n if (!latest.current.open) return\n const visible = trigger.checkVisibility()\n if (!visible && node.matches(':popover-open')) {\n ancestorClosing.current = true\n latest.current.close(false)\n node.hidePopover()\n setGeneration(value => value + 1)\n } else if (visible && !node.matches(':popover-open')) setGeneration(value => value + 1)\n }\n const observer = new node.ownerDocument.defaultView!.MutationObserver(reconcile)\n for (const ancestor of ancestors) {\n observer.observe(ancestor, { attributes: true, attributeFilter: ['open', 'data-state'] })\n ancestor.addEventListener('toggle', reconcile)\n }\n return () => {\n observer.disconnect()\n for (const ancestor of ancestors) ancestor.removeEventListener('toggle', reconcile)\n }\n }, [nodeRef, trigger])\n\n useLayoutEffect(() => {\n const node = nodeRef.current\n if (!node || !trigger || !open || !trigger.checkVisibility() || generation < 0) return\n const doc = node.ownerDocument\n const win = doc.defaultView!\n const shouldRestore = () => restoreFocus.current\n const place = () => {\n if (!node.isConnected || !node.matches(':popover-open')) return\n const { side, align, sideOffset, collisionPadding } = latest.current\n const viewport = win.visualViewport\n const view = {\n top: viewport?.offsetTop ?? 0,\n left: viewport?.offsetLeft ?? 0,\n width: viewport?.width ?? win.innerWidth,\n height: viewport?.height ?? win.innerHeight\n }\n node.style.setProperty(\n '--_rad-popover-max-width',\n `${Math.max(0, view.width - 2 * collisionPadding)}px`\n )\n node.style.setProperty(\n '--_rad-popover-max-height',\n `${Math.max(0, view.height - 2 * collisionPadding)}px`\n )\n const css = win.getComputedStyle(node)\n const next = positionPopover({\n anchor: trigger.getBoundingClientRect(),\n width: node.offsetWidth,\n height:\n node.scrollHeight + parseFloat(css.borderTopWidth) + parseFloat(css.borderBottomWidth),\n viewport: view,\n side,\n align,\n offset: sideOffset,\n padding: collisionPadding,\n rtl: win.getComputedStyle(trigger).direction === 'rtl'\n })\n for (const key of ['left', 'top', 'maxWidth', 'maxHeight'] as const) {\n const property = key === 'maxWidth' ? 'max-width' : key === 'maxHeight' ? 'max-height' : key\n node.style.setProperty(`--_rad-popover-${property}`, `${next[key]}px`)\n }\n node.dataset.side = next.side\n node.dataset.align = next.align\n }\n // A manual native popover keeps controlled owners authoritative and avoids auto-stack reopen loops.\n // The source preserves the browser's logical Tab order without assigning content semantics.\n node.showPopover({ source: trigger })\n ancestorClosing.current = false\n reposition.current = place\n place()\n const target = latest.current.initialFocusRef?.current\n if (target && node.contains(target)) target.focus({ preventScroll: true })\n const stack = layers.get(doc) ?? []\n layers.set(doc, stack)\n const descendant = stack.findIndex(layer => node.contains(layer))\n if (descendant < 0) stack.push(node)\n else stack.splice(descendant, 0, node)\n let frame = 0\n const schedule = () => {\n if (!frame)\n frame = win.requestAnimationFrame(() => {\n frame = 0\n place()\n })\n }\n const inside = (target: EventTarget | null) =>\n target instanceof win.Node && (node.contains(target) || trigger.contains(target))\n let pointerDismissed = false\n const pointerEnd = () => {\n pointerDismissed = false\n }\n const outside = (event: PointerEvent | FocusEvent) => {\n if (\n event.type === 'focusin' &&\n (event.target === doc.body || event.target === doc.documentElement)\n )\n return\n if (event.type === 'focusin' && pointerDismissed) return\n if (event.type === 'pointerdown') pointerDismissed = !inside(event.target)\n if (!inside(event.target)) latest.current.close(false)\n }\n const escape = (event: KeyboardEvent) => {\n if (\n event.key !== 'Escape' ||\n event.defaultPrevented ||\n stack.filter(layer => layer.matches(':popover-open')).at(-1) !== node\n )\n return\n const modal = Array.from(doc.querySelectorAll('dialog:modal')).at(-1)\n if (modal && !modal.contains(node)) return\n const nested =\n event.target instanceof win.Element ? event.target.closest('[popover]:popover-open') : null\n if (\n nested &&\n nested !== node &&\n node.contains(nested) &&\n nested.getAttribute('popover') !== 'manual'\n )\n return\n event.preventDefault()\n event.stopPropagation()\n latest.current.close(true)\n }\n const toggle = () => {\n if (ancestorClosing.current || node.matches(':popover-open') || !latest.current.open) return\n latest.current.close(true)\n // Native hide is an observation; a controlled owner may refuse the request.\n setGeneration(value => value + 1)\n }\n const observer = new win.ResizeObserver(schedule)\n const mutations = new win.MutationObserver(schedule)\n observer.observe(trigger)\n observer.observe(node)\n mutations.observe(node, { childList: true, subtree: true, characterData: true })\n node.addEventListener('toggle', toggle)\n doc.addEventListener('pointerdown', outside, true)\n doc.addEventListener('pointerup', pointerEnd, true)\n doc.addEventListener('pointercancel', pointerEnd, true)\n doc.addEventListener('focusin', outside)\n doc.addEventListener('keydown', escape)\n doc.addEventListener('scroll', schedule, true)\n win.addEventListener('resize', schedule)\n win.visualViewport?.addEventListener('resize', schedule)\n win.visualViewport?.addEventListener('scroll', schedule)\n return () => {\n observer.disconnect()\n mutations.disconnect()\n win.cancelAnimationFrame(frame)\n node.removeEventListener('toggle', toggle)\n doc.removeEventListener('pointerdown', outside, true)\n doc.removeEventListener('pointerup', pointerEnd, true)\n doc.removeEventListener('pointercancel', pointerEnd, true)\n doc.removeEventListener('focusin', outside)\n doc.removeEventListener('keydown', escape)\n doc.removeEventListener('scroll', schedule, true)\n win.removeEventListener('resize', schedule)\n win.visualViewport?.removeEventListener('resize', schedule)\n win.visualViewport?.removeEventListener('scroll', schedule)\n stack.splice(stack.indexOf(node), 1)\n if (!stack.length) layers.delete(doc)\n if (shouldRestore() && node.contains(doc.activeElement) && trigger.isConnected)\n trigger.focus({ preventScroll: true })\n if (node.matches(':popover-open')) node.hidePopover()\n reposition.current = () => {}\n }\n }, [nodeRef, trigger, open, generation, restoreFocus])\n useLayoutEffect(() => reposition.current(), [side, align, sideOffset, collisionPadding])\n}\n"]}