@adea-ai/ui 0.159.3 → 0.159.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"action-button.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/action-button/action-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,GAAG,EACR,KAAK,cAAc,EACpB,MAAM,UAAU,CAAA;AAGjB,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAMlE;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,cAAc,GAAG,QAAQ,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG;IACpF,8FAA8F;IAC9F,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iGAAiG;IACjG,WAAW,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;IACjD;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACzB;;;;OAIG;IACH,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACnC,uFAAuF;IACvF,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,uFAAuF;IACvF,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AA0CD,wBAAgB,YAAY,CAAC,CAAC,SAAS,cAAc,GAAG,QAAQ,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,eA0L5F"}
1
+ {"version":3,"file":"action-button.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/action-button/action-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,GAAG,EACR,KAAK,cAAc,EACpB,MAAM,UAAU,CAAA;AAGjB,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAMlE;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,cAAc,GAAG,QAAQ,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG;IACpF,8FAA8F;IAC9F,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iGAAiG;IACjG,WAAW,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;IACjD;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACzB;;;;OAIG;IACH,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACnC,uFAAuF;IACvF,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,uFAAuF;IACvF,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AA0CD,wBAAgB,YAAY,CAAC,CAAC,SAAS,cAAc,GAAG,QAAQ,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,eA+L5F"}
@@ -68,6 +68,8 @@ function ActionButton(props) {
68
68
  });
69
69
  const [tooltipSuppression, setTooltipSuppression] = createSignal(null);
70
70
  const forwarded = rest;
71
+ let element;
72
+ const popupOpen = () => element?.getAttribute("aria-expanded") === "true";
71
73
  const buttonProps = mergeProps$1(rest, {
72
74
  get "data-slot"() {
73
75
  return forwarded["data-slot"] ?? "action-button";
@@ -103,10 +105,11 @@ function ActionButton(props) {
103
105
  get "aria-describedby"() {
104
106
  return forwarded["aria-describedby"] ?? (local.tooltip && tooltipOpen() ? tooltipId : void 0);
105
107
  },
106
- ref: (element) => {
107
- deferred.ref(element);
108
+ ref: (button) => {
109
+ element = button;
110
+ deferred.ref(button);
108
111
  const callerRef = forwarded.ref;
109
- if (typeof callerRef === "function") callerRef(element);
112
+ if (typeof callerRef === "function") callerRef(button);
110
113
  },
111
114
  onPointerEnter: deferred.onPointerEnter,
112
115
  onFocus: deferred.onFocus,
@@ -169,7 +172,7 @@ function ActionButton(props) {
169
172
  return tooltipOpen();
170
173
  },
171
174
  onOpenChange: (open) => {
172
- if (open && tooltipSuppression()) return;
175
+ if (open && (tooltipSuppression() || popupOpen())) return;
173
176
  setTooltipOpen(open);
174
177
  },
175
178
  get children() {
@@ -1 +1 @@
1
- {"version":3,"file":"action-button.js","names":["For","Show","createRoot","mergeProps","createSignal","createUniqueId","splitProps","callHandler","Polymorphic","buttonVariants","cn","Kbd","KbdGroup","Spinner","createDeferredTooltip","Tooltip","TooltipContent","TooltipTrigger","tooltip","tooltipSide","tooltipIcon","tooltipShortcut","busy","busyLabel","invokeHandler","handler","event","chainedHandler","before","guardedClick","disabled","onActivate","isDisabled","dispose","preventDefault","stopImmediatePropagation","ActionButton","props","local","rest","href","busyStatus","tooltipOpen","setTooltipOpen","tooltipId","deferred","enabled","onPointerEnter","onFocus","tooltipSuppression","setTooltipSuppression","forwarded","buttonProps","class","variant","size","touchTarget","type","tabIndex","as","undefined","role","ref","element","callerRef","onClick","detail","onPointerLeave","onBlur","onClickCapture","contents","_$createComponent","when","children","label","_$memo","fallback","_$mergeProps","_el$","_tmpl$","_$spread","_$insert","armed","tooltipSlot","placement","open","onOpenChange","Target","id","icon","length","_el$3","_tmpl$3","each","key","_el$2","_tmpl$2"],"sources":["../../../../src/components/composites/action-button/action-button.tsx"],"sourcesContent":["import {\n For,\n Show,\n createRoot,\n mergeProps,\n createSignal,\n createUniqueId,\n splitProps,\n type ComponentProps,\n type JSX,\n type ValidComponent,\n} from 'solid-js'\nimport { callHandler } from '#lib/events'\nimport { Polymorphic } from '@kobalte/core/polymorphic'\nimport { buttonVariants, type ButtonProps } from '../../ui/button'\nimport { cn } from '#lib/utils'\nimport { Kbd, KbdGroup } from '../../ui/kbd'\nimport { Spinner } from '../../ui/spinner'\nimport { createDeferredTooltip, Tooltip, TooltipContent, TooltipTrigger } from '../../ui/tooltip'\n\n/**\n * ActionButton.\n *\n * A Button with optional explanatory tooltip and busy feedback. Use it for a\n * simple action that needs these states; actions with product-specific rules\n * should compose Button directly.\n *\n * The tooltip trigger is the polymorphic Button itself; the tooltip mounts on\n * its first hover or keyboard focus (see createDeferredTooltip). A disabled native\n * control cannot receive pointer or keyboard events. When a tooltip is set,\n * disabled actions therefore use focusable `aria-disabled` semantics and guard\n * activation; without a tooltip, native buttons retain native disabling.\n * Custom polymorphic components must forward aria, event, and href props for\n * these guarantees to apply.\n */\nexport type ActionButtonProps<T extends ValidComponent = 'button'> = ButtonProps<T> & {\n /** A short explanation, also shown on keyboard focus. The Button still needs its own name. */\n tooltip?: string\n /** Placement of the explanation; icon actions live in bars, so it defaults below the control. */\n tooltipSide?: 'top' | 'right' | 'bottom' | 'left'\n /**\n * A leading icon repeated inside the explanation, forwarded to the shared\n * tooltip's `icon` slot so a bar of icon actions gets the icon+label tip\n * without hand-composing Button and Tooltip. Decorative by contract: the tip\n * is never the accessible name, so the icon must not carry meaning the label\n * lacks. Size it by leaving the svg bare; the slot fixes it to control size.\n */\n tooltipIcon?: JSX.Element\n /**\n * The action's keyboard chord, one entry per key (`['⇧', '⌘', 'D']`), drawn as keys after the\n * explanation. Decorative like the rest of the tip: put the parseable chord on the control\n * itself with `aria-keyshortcuts`.\n */\n tooltipShortcut?: readonly string[]\n /** Disables the action and announces the busy label through a polite status region. */\n busy?: boolean\n /** The activity announced while busy. The Button's accessible name stays unchanged. */\n busyLabel?: string\n}\n\ntype ForwardedHandler = JSX.EventHandlerUnion<Element, Event> | undefined\ntype ForwardedEvent = Event & { currentTarget: Element; target: Element }\n\nfunction invokeHandler(handler: unknown, event: Event) {\n callHandler(handler as ForwardedHandler, event as ForwardedEvent)\n}\n\nfunction chainedHandler(handler: () => unknown, before: (event: Event) => void) {\n return (event: Event) => {\n before(event)\n invokeHandler(handler(), event)\n }\n}\n\nfunction guardedClick(\n handler: () => unknown,\n disabled: () => boolean,\n onActivate: (event: MouseEvent) => void = () => {}\n) {\n return (event: MouseEvent) => {\n // A polymorphic trigger can provide a getter that creates reactive work.\n // Event callbacks have no owner, so dispose any such work after the read.\n const isDisabled = createRoot((dispose) => {\n try {\n return disabled()\n } finally {\n dispose()\n }\n })\n if (isDisabled) {\n event.preventDefault()\n event.stopImmediatePropagation()\n return\n }\n\n onActivate(event)\n invokeHandler(handler(), event)\n }\n}\n\nexport function ActionButton<T extends ValidComponent = 'button'>(props: ActionButtonProps<T>) {\n const [local, rest] = splitProps(props as ActionButtonProps & { href?: string }, [\n 'as',\n 'variant',\n 'size',\n 'touchTarget',\n 'class',\n 'children',\n 'disabled',\n 'aria-busy',\n 'tooltip',\n 'tooltipSide',\n 'tooltipIcon',\n 'tooltipShortcut',\n 'busy',\n 'busyLabel',\n // Split, not read from `rest`: mergeProps falls back to an earlier source when a\n // getter returns undefined, so a disabled link could not drop its href otherwise.\n 'href',\n ])\n const busy = () => local.busy ?? false\n const disabled = () => busy() || !!local.disabled\n const busyStatus = () => local.busyLabel ?? 'Working'\n const [tooltipOpen, setTooltipOpen] = createSignal(false)\n const tooltipId = `action-button-tooltip-${createUniqueId()}`\n // The tooltip mounts on the first hover or keyboard focus; until then the\n // button renders alone (see createDeferredTooltip).\n const deferred = createDeferredTooltip({\n enabled: () => !!local.tooltip,\n onPointerEnter: () => rest.onPointerEnter,\n onFocus: () => rest.onFocus,\n })\n const [tooltipSuppression, setTooltipSuppression] = createSignal<'pointer' | 'focus' | null>(null)\n const forwarded = rest as Record<string, unknown>\n\n // One props object for the life of the button. Each value is a getter, so it stays\n // reactive per key, and the handlers are created once and read the caller's handler\n // when they run. (Spreading a function's result instead compiles to a memo that\n // rebuilds every key and handler whenever any prop it reads changes.)\n const buttonProps = mergeProps(rest, {\n // The inner Button would otherwise announce itself as a plain `button`; a\n // caller's own slot still wins.\n get 'data-slot'() {\n return (forwarded['data-slot'] as string | undefined) ?? 'action-button'\n },\n // Button's own class, computed here: rendering Polymorphic directly saves a\n // component layer and a splitProps over every key, on every action button.\n get class() {\n return cn(\n buttonVariants({\n variant: local.variant,\n size: local.size,\n touchTarget: local.touchTarget,\n }),\n local.class,\n local.tooltip && disabled() && 'aria-disabled:pointer-events-auto'\n )\n },\n // As Button sets it: a custom component that renders a native button inside a\n // form must not submit by accident. A caller's own type still wins.\n get type() {\n return (forwarded.type as string | undefined) ?? 'button'\n },\n get disabled() {\n return disabled() && !local.tooltip\n },\n get 'aria-disabled'() {\n return disabled() ? true : rest['aria-disabled']\n },\n // Make tooltip-bearing native controls explicit tab stops in WebKit configurations that\n // otherwise skip implicit button stops. A caller's tabIndex remains authoritative.\n get tabIndex() {\n return (\n rest.tabIndex ??\n (local.as === 'a' && disabled() ? (local.tooltip ? 0 : -1) : local.tooltip ? 0 : undefined)\n )\n },\n get role() {\n return local.as === 'a' && disabled() ? 'link' : rest.role\n },\n get href() {\n return local.as === 'a' && disabled() ? undefined : local.href\n },\n get 'aria-busy'() {\n return busy() || local['aria-busy']\n },\n get 'aria-describedby'() {\n return (\n (forwarded['aria-describedby'] as string | undefined) ??\n (local.tooltip && tooltipOpen() ? tooltipId : undefined)\n )\n },\n ref: (element: HTMLElement) => {\n deferred.ref(element)\n const callerRef = forwarded.ref\n if (typeof callerRef === 'function') callerRef(element)\n },\n onPointerEnter: deferred.onPointerEnter,\n onFocus: deferred.onFocus,\n onClick: guardedClick(\n () => rest.onClick,\n disabled,\n (event) => {\n if (!local.tooltip) return\n setTooltipSuppression(event.detail > 0 ? 'pointer' : 'focus')\n setTooltipOpen(false)\n }\n ),\n onPointerLeave: chainedHandler(\n () => rest.onPointerLeave,\n () => {\n if (tooltipSuppression() === 'pointer') setTooltipSuppression(null)\n }\n ),\n onBlur: chainedHandler(\n () => rest.onBlur,\n () => {\n if (tooltipSuppression() === 'focus') setTooltipSuppression(null)\n }\n ),\n onClickCapture: forwarded.onClickCapture\n ? guardedClick(() => forwarded.onClickCapture, disabled)\n : undefined,\n // Only when the caller uses them: each is a native listener on every button.\n 'on:click': forwarded['on:click']\n ? guardedClick(() => forwarded['on:click'], disabled)\n : undefined,\n 'oncapture:click': forwarded['oncapture:click']\n ? guardedClick(() => forwarded['oncapture:click'], disabled)\n : undefined,\n })\n\n const contents = () => (\n <>\n <Show when={busy()}>\n <Spinner size=\"sm\" label={false} aria-hidden=\"true\" data-icon=\"inline-start\" />\n </Show>\n {local.children}\n </>\n )\n\n return (\n <>\n {/* A native button, the common case, is written directly: Polymorphic goes\n through Dynamic, a memo and a component per button. */}\n <Show\n when={local.as === undefined || local.as === 'button'}\n fallback={\n <Polymorphic as={local.as} {...(buttonProps as ComponentProps<'button'>)}>\n {contents()}\n </Polymorphic>\n }\n >\n <button {...(buttonProps as ComponentProps<'button'>)}>{contents()}</button>\n </Show>\n <Show when={deferred.armed() && local.tooltip}>\n {(tooltipSlot) => (\n <Tooltip\n placement={local.tooltipSide ?? 'bottom'}\n open={tooltipOpen()}\n onOpenChange={(open) => {\n if (open && tooltipSuppression()) return\n setTooltipOpen(open)\n }}\n >\n <TooltipTrigger as={deferred.Target} />\n <TooltipContent id={tooltipId} icon={local.tooltipIcon}>\n <Show when={local.tooltipShortcut?.length} fallback={tooltipSlot()}>\n <span class=\"inline-flex items-center gap-2 whitespace-nowrap\">\n {tooltipSlot()}\n <KbdGroup data-slot=\"action-button-shortcut\" aria-hidden=\"true\">\n <For each={local.tooltipShortcut}>{(key) => <Kbd>{key}</Kbd>}</For>\n </KbdGroup>\n </span>\n </Show>\n </TooltipContent>\n </Tooltip>\n )}\n </Show>\n <Show when={busy()}>\n <span role=\"status\" aria-live=\"polite\" class=\"visually-hidden\">\n {busyStatus()}\n </span>\n </Show>\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AA+DA,SAASwB,cAAcC,SAAkBC,OAAc;CACrDnB,YAAYkB,SAA6BC,KAAuB;AAClE;AAEA,SAASC,eAAeF,SAAwBG,QAAgC;CAC9E,QAAQF,UAAiB;EACvBE,OAAOF,KAAK;EACZF,cAAcC,QAAQ,GAAGC,KAAK;CAChC;AACF;AAEA,SAASG,aACPJ,SACAK,UACAC,mBAAgD,CAAC,GACjD;CACA,QAAQL,UAAsB;EAU5B,IAPmBxB,YAAY+B,YAAY;GACzC,IAAI;IACF,OAAO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A,GAAAhB,gBAClCvD,gBAAc;MAACwE,IAAI5C;MAAS,IAAE6C,OAAI;OAAA,OAAEnD,MAAMlB;MAAW;MAAA,IAAAqD,WAAA;OAAA,OAAAF,gBACnDtE,MAAI;QAAA,IAACuE,OAAI;SAAA,OAAElC,MAAMjB,iBAAiBqE;QAAM;QAAA,IAAEd,WAAQ;SAAA,OAAEO,YAAY;QAAC;QAAA,IAAAV,WAAA;SAAA,IAAAkB,QAAAC,QAAA;SAAAX,OAAAU,OAE7DR,aAAW,IAAA;SAAAF,OAAAU,OAAApB,gBACX3D,UAAQ;UAAA,aAAA;UAAA,eAAA;UAAA,IAAA6D,WAAA;WAAA,OAAAF,gBACNvE,KAAG;YAAA,IAAC6F,OAAI;aAAA,OAAEvD,MAAMjB;YAAe;YAAAoD,WAAIqB,QAAGvB,gBAAM5D,KAAG,EAAA8D,UAAEqB,IAAG,CAAA;WAAO,CAAA;UAAA;SAAA,CAAA,GAAA,IAAA;SAAA,OAAAH;QAAA;OAAA,CAAA;MAAA;KAAA,CAAA,CAAA;IAAA;GAAA,CAAA;EAMvE,CAAA;EAAApB,gBAEFtE,MAAI;GAAA,IAACuE,OAAI;IAAA,OAAElD,KAAK;GAAC;GAAA,IAAAmD,WAAA;IAAA,IAAAsB,QAAAC,QAAA;IAAAf,OAAAc,OAEbtD,UAAU;IAAA,OAAAsD;GAAA;EAAA,CAAA;CAAA;AAKrB"}
1
+ {"version":3,"file":"action-button.js","names":["For","Show","createRoot","mergeProps","createSignal","createUniqueId","splitProps","callHandler","Polymorphic","buttonVariants","cn","Kbd","KbdGroup","Spinner","createDeferredTooltip","Tooltip","TooltipContent","TooltipTrigger","tooltip","tooltipSide","tooltipIcon","tooltipShortcut","busy","busyLabel","invokeHandler","handler","event","chainedHandler","before","guardedClick","disabled","onActivate","isDisabled","dispose","preventDefault","stopImmediatePropagation","ActionButton","props","local","rest","href","busyStatus","tooltipOpen","setTooltipOpen","tooltipId","deferred","enabled","onPointerEnter","onFocus","tooltipSuppression","setTooltipSuppression","forwarded","element","popupOpen","getAttribute","buttonProps","class","variant","size","touchTarget","type","tabIndex","as","undefined","role","ref","button","callerRef","onClick","detail","onPointerLeave","onBlur","onClickCapture","contents","_$createComponent","when","children","label","_$memo","fallback","_$mergeProps","_el$","_tmpl$","_$spread","_$insert","armed","tooltipSlot","placement","open","onOpenChange","Target","id","icon","length","_el$3","_tmpl$3","each","key","_el$2","_tmpl$2"],"sources":["../../../../src/components/composites/action-button/action-button.tsx"],"sourcesContent":["import {\n For,\n Show,\n createRoot,\n mergeProps,\n createSignal,\n createUniqueId,\n splitProps,\n type ComponentProps,\n type JSX,\n type ValidComponent,\n} from 'solid-js'\nimport { callHandler } from '#lib/events'\nimport { Polymorphic } from '@kobalte/core/polymorphic'\nimport { buttonVariants, type ButtonProps } from '../../ui/button'\nimport { cn } from '#lib/utils'\nimport { Kbd, KbdGroup } from '../../ui/kbd'\nimport { Spinner } from '../../ui/spinner'\nimport { createDeferredTooltip, Tooltip, TooltipContent, TooltipTrigger } from '../../ui/tooltip'\n\n/**\n * ActionButton.\n *\n * A Button with optional explanatory tooltip and busy feedback. Use it for a\n * simple action that needs these states; actions with product-specific rules\n * should compose Button directly.\n *\n * The tooltip trigger is the polymorphic Button itself; the tooltip mounts on\n * its first hover or keyboard focus (see createDeferredTooltip). A disabled native\n * control cannot receive pointer or keyboard events. When a tooltip is set,\n * disabled actions therefore use focusable `aria-disabled` semantics and guard\n * activation; without a tooltip, native buttons retain native disabling.\n * Custom polymorphic components must forward aria, event, and href props for\n * these guarantees to apply.\n */\nexport type ActionButtonProps<T extends ValidComponent = 'button'> = ButtonProps<T> & {\n /** A short explanation, also shown on keyboard focus. The Button still needs its own name. */\n tooltip?: string\n /** Placement of the explanation; icon actions live in bars, so it defaults below the control. */\n tooltipSide?: 'top' | 'right' | 'bottom' | 'left'\n /**\n * A leading icon repeated inside the explanation, forwarded to the shared\n * tooltip's `icon` slot so a bar of icon actions gets the icon+label tip\n * without hand-composing Button and Tooltip. Decorative by contract: the tip\n * is never the accessible name, so the icon must not carry meaning the label\n * lacks. Size it by leaving the svg bare; the slot fixes it to control size.\n */\n tooltipIcon?: JSX.Element\n /**\n * The action's keyboard chord, one entry per key (`['⇧', '⌘', 'D']`), drawn as keys after the\n * explanation. Decorative like the rest of the tip: put the parseable chord on the control\n * itself with `aria-keyshortcuts`.\n */\n tooltipShortcut?: readonly string[]\n /** Disables the action and announces the busy label through a polite status region. */\n busy?: boolean\n /** The activity announced while busy. The Button's accessible name stays unchanged. */\n busyLabel?: string\n}\n\ntype ForwardedHandler = JSX.EventHandlerUnion<Element, Event> | undefined\ntype ForwardedEvent = Event & { currentTarget: Element; target: Element }\n\nfunction invokeHandler(handler: unknown, event: Event) {\n callHandler(handler as ForwardedHandler, event as ForwardedEvent)\n}\n\nfunction chainedHandler(handler: () => unknown, before: (event: Event) => void) {\n return (event: Event) => {\n before(event)\n invokeHandler(handler(), event)\n }\n}\n\nfunction guardedClick(\n handler: () => unknown,\n disabled: () => boolean,\n onActivate: (event: MouseEvent) => void = () => {}\n) {\n return (event: MouseEvent) => {\n // A polymorphic trigger can provide a getter that creates reactive work.\n // Event callbacks have no owner, so dispose any such work after the read.\n const isDisabled = createRoot((dispose) => {\n try {\n return disabled()\n } finally {\n dispose()\n }\n })\n if (isDisabled) {\n event.preventDefault()\n event.stopImmediatePropagation()\n return\n }\n\n onActivate(event)\n invokeHandler(handler(), event)\n }\n}\n\nexport function ActionButton<T extends ValidComponent = 'button'>(props: ActionButtonProps<T>) {\n const [local, rest] = splitProps(props as ActionButtonProps & { href?: string }, [\n 'as',\n 'variant',\n 'size',\n 'touchTarget',\n 'class',\n 'children',\n 'disabled',\n 'aria-busy',\n 'tooltip',\n 'tooltipSide',\n 'tooltipIcon',\n 'tooltipShortcut',\n 'busy',\n 'busyLabel',\n // Split, not read from `rest`: mergeProps falls back to an earlier source when a\n // getter returns undefined, so a disabled link could not drop its href otherwise.\n 'href',\n ])\n const busy = () => local.busy ?? false\n const disabled = () => busy() || !!local.disabled\n const busyStatus = () => local.busyLabel ?? 'Working'\n const [tooltipOpen, setTooltipOpen] = createSignal(false)\n const tooltipId = `action-button-tooltip-${createUniqueId()}`\n // The tooltip mounts on the first hover or keyboard focus; until then the\n // button renders alone (see createDeferredTooltip).\n const deferred = createDeferredTooltip({\n enabled: () => !!local.tooltip,\n onPointerEnter: () => rest.onPointerEnter,\n onFocus: () => rest.onFocus,\n })\n const [tooltipSuppression, setTooltipSuppression] = createSignal<'pointer' | 'focus' | null>(null)\n const forwarded = rest as Record<string, unknown>\n let element: HTMLElement | undefined\n // A trigger whose popup is open (a menu, a sheet) names itself already; its tip would sit over\n // that popup and take the first Escape meant for it.\n const popupOpen = () => element?.getAttribute('aria-expanded') === 'true'\n\n // One props object for the life of the button. Each value is a getter, so it stays\n // reactive per key, and the handlers are created once and read the caller's handler\n // when they run. (Spreading a function's result instead compiles to a memo that\n // rebuilds every key and handler whenever any prop it reads changes.)\n const buttonProps = mergeProps(rest, {\n // The inner Button would otherwise announce itself as a plain `button`; a\n // caller's own slot still wins.\n get 'data-slot'() {\n return (forwarded['data-slot'] as string | undefined) ?? 'action-button'\n },\n // Button's own class, computed here: rendering Polymorphic directly saves a\n // component layer and a splitProps over every key, on every action button.\n get class() {\n return cn(\n buttonVariants({\n variant: local.variant,\n size: local.size,\n touchTarget: local.touchTarget,\n }),\n local.class,\n local.tooltip && disabled() && 'aria-disabled:pointer-events-auto'\n )\n },\n // As Button sets it: a custom component that renders a native button inside a\n // form must not submit by accident. A caller's own type still wins.\n get type() {\n return (forwarded.type as string | undefined) ?? 'button'\n },\n get disabled() {\n return disabled() && !local.tooltip\n },\n get 'aria-disabled'() {\n return disabled() ? true : rest['aria-disabled']\n },\n // Make tooltip-bearing native controls explicit tab stops in WebKit configurations that\n // otherwise skip implicit button stops. A caller's tabIndex remains authoritative.\n get tabIndex() {\n return (\n rest.tabIndex ??\n (local.as === 'a' && disabled() ? (local.tooltip ? 0 : -1) : local.tooltip ? 0 : undefined)\n )\n },\n get role() {\n return local.as === 'a' && disabled() ? 'link' : rest.role\n },\n get href() {\n return local.as === 'a' && disabled() ? undefined : local.href\n },\n get 'aria-busy'() {\n return busy() || local['aria-busy']\n },\n get 'aria-describedby'() {\n return (\n (forwarded['aria-describedby'] as string | undefined) ??\n (local.tooltip && tooltipOpen() ? tooltipId : undefined)\n )\n },\n ref: (button: HTMLElement) => {\n element = button\n deferred.ref(button)\n const callerRef = forwarded.ref\n if (typeof callerRef === 'function') callerRef(button)\n },\n onPointerEnter: deferred.onPointerEnter,\n onFocus: deferred.onFocus,\n onClick: guardedClick(\n () => rest.onClick,\n disabled,\n (event) => {\n if (!local.tooltip) return\n setTooltipSuppression(event.detail > 0 ? 'pointer' : 'focus')\n setTooltipOpen(false)\n }\n ),\n onPointerLeave: chainedHandler(\n () => rest.onPointerLeave,\n () => {\n if (tooltipSuppression() === 'pointer') setTooltipSuppression(null)\n }\n ),\n onBlur: chainedHandler(\n () => rest.onBlur,\n () => {\n if (tooltipSuppression() === 'focus') setTooltipSuppression(null)\n }\n ),\n onClickCapture: forwarded.onClickCapture\n ? guardedClick(() => forwarded.onClickCapture, disabled)\n : undefined,\n // Only when the caller uses them: each is a native listener on every button.\n 'on:click': forwarded['on:click']\n ? guardedClick(() => forwarded['on:click'], disabled)\n : undefined,\n 'oncapture:click': forwarded['oncapture:click']\n ? guardedClick(() => forwarded['oncapture:click'], disabled)\n : undefined,\n })\n\n const contents = () => (\n <>\n <Show when={busy()}>\n <Spinner size=\"sm\" label={false} aria-hidden=\"true\" data-icon=\"inline-start\" />\n </Show>\n {local.children}\n </>\n )\n\n return (\n <>\n {/* A native button, the common case, is written directly: Polymorphic goes\n through Dynamic, a memo and a component per button. */}\n <Show\n when={local.as === undefined || local.as === 'button'}\n fallback={\n <Polymorphic as={local.as} {...(buttonProps as ComponentProps<'button'>)}>\n {contents()}\n </Polymorphic>\n }\n >\n <button {...(buttonProps as ComponentProps<'button'>)}>{contents()}</button>\n </Show>\n <Show when={deferred.armed() && local.tooltip}>\n {(tooltipSlot) => (\n <Tooltip\n placement={local.tooltipSide ?? 'bottom'}\n open={tooltipOpen()}\n onOpenChange={(open) => {\n if (open && (tooltipSuppression() || popupOpen())) return\n setTooltipOpen(open)\n }}\n >\n <TooltipTrigger as={deferred.Target} />\n <TooltipContent id={tooltipId} icon={local.tooltipIcon}>\n <Show when={local.tooltipShortcut?.length} fallback={tooltipSlot()}>\n <span class=\"inline-flex items-center gap-2 whitespace-nowrap\">\n {tooltipSlot()}\n <KbdGroup data-slot=\"action-button-shortcut\" aria-hidden=\"true\">\n <For each={local.tooltipShortcut}>{(key) => <Kbd>{key}</Kbd>}</For>\n </KbdGroup>\n </span>\n </Show>\n </TooltipContent>\n </Tooltip>\n )}\n </Show>\n <Show when={busy()}>\n <span role=\"status\" aria-live=\"polite\" class=\"visually-hidden\">\n {busyStatus()}\n </span>\n </Show>\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AA+DA,SAASwB,cAAcC,SAAkBC,OAAc;CACrDnB,YAAYkB,SAA6BC,KAAuB;AAClE;AAEA,SAASC,eAAeF,SAAwBG,QAAgC;CAC9E,QAAQF,UAAiB;EACvBE,OAAOF,KAAK;EACZF,cAAcC,QAAQ,GAAGC,KAAK;CAChC;AACF;AAEA,SAASG,aACPJ,SACAK,UACAC,mBAAgD,CAAC,GACjD;CACA,QAAQL,UAAsB;EAU5B,IAPmBxB,YAAY+B,YAAY;GACzC,IAAI;IACF,OAAOH,SAAS;GAClB,UAAU;IACRG,QAAQ;GACV;EACF,CACID,GAAY;GACdN,MAAMQ,eAAe;GACrBR,MAAMS,yBAAyB;GAC/B;EACF;EAEAJ,WAAWL,KAAK;EAChBF,cAAcC,QAAQ,GAAGC,KAAK;CAChC;AACF;AAEA,SAAgBU,aAAkDC,OAA6B;CAC7F,MAAM,CAACC,OAAOC,QAAQjC,WAAW+B,OAAgD;EAC/E;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAC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;QAAA,IAAEd,WAAQ;SAAA,OAAEO,YAAY;QAAC;QAAA,IAAAV,WAAA;SAAA,IAAAkB,QAAAC,QAAA;SAAAX,OAAAU,OAE7DR,aAAW,IAAA;SAAAF,OAAAU,OAAApB,gBACX9D,UAAQ;UAAA,aAAA;UAAA,eAAA;UAAA,IAAAgE,WAAA;WAAA,OAAAF,gBACN1E,KAAG;YAAA,IAACgG,OAAI;aAAA,OAAE1D,MAAMjB;YAAe;YAAAuD,WAAIqB,QAAGvB,gBAAM/D,KAAG,EAAAiE,UAAEqB,IAAG,CAAA;WAAO,CAAA;UAAA;SAAA,CAAA,GAAA,IAAA;SAAA,OAAAH;QAAA;OAAA,CAAA;MAAA;KAAA,CAAA,CAAA;IAAA;GAAA,CAAA;EAMvE,CAAA;EAAApB,gBAEFzE,MAAI;GAAA,IAAC0E,OAAI;IAAA,OAAErD,KAAK;GAAC;GAAA,IAAAsD,WAAA;IAAA,IAAAsB,QAAAC,QAAA;IAAAf,OAAAc,OAEbzD,UAAU;IAAA,OAAAyD;GAAA;EAAA,CAAA;CAAA;AAKrB"}
@@ -15,8 +15,8 @@ import type { ComponentProps } from 'solid-js';
15
15
  * invalid direct children of the ARIA menu. Set `modal` explicitly when the
16
16
  * surrounding interaction needs modal containment.
17
17
  *
18
- * The `destructive` variant marks the row with a status-coloured edge and
19
- * highlighted tint while keeping its label on the body foreground. Pairing it
18
+ * The `destructive` variant colours the row's icon with the destructive status
19
+ * and tints its highlight while keeping its label on the body foreground. Pairing it
20
20
  * with an AlertDialog is the caller's job.
21
21
  *
22
22
  * An item that opens something else, a dialog, a sheet, passes it as
@@ -23,8 +23,8 @@ var DropdownMenuScopeContext = createContext();
23
23
  * invalid direct children of the ARIA menu. Set `modal` explicitly when the
24
24
  * surrounding interaction needs modal containment.
25
25
  *
26
- * The `destructive` variant marks the row with a status-coloured edge and
27
- * highlighted tint while keeping its label on the body foreground. Pairing it
26
+ * The `destructive` variant colours the row's icon with the destructive status
27
+ * and tints its highlight while keeping its label on the body foreground. Pairing it
28
28
  * with an AlertDialog is the caller's job.
29
29
  *
30
30
  * An item that opens something else, a dialog, a sheet, passes it as
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown-menu.js","names":["DropdownMenu","KobalteDropdownMenu","useMenuContext","createContext","onCleanup","splitProps","useContext","callHandler","topLayerProps","cn","createMenuParts","menuPanel","orientation","setAfterClose","callback","takeAfterClose","disposed","DropdownMenuScopeContext","Trigger","props","local","rest","afterClose","undefined","scope","_$createComponent","Provider","value","children","_$mergeProps","modal","onOpenChange","open","SCROLLABLE_OVERFLOW","OVERFLOW_PROPERTIES","property","priority","readInlineOverflow","element","HTMLElement","map","style","getPropertyValue","getPropertyPriority","declarationsMatch","declarations","every","bypassUnboundedScrollLookup","trigger","scrollRoot","document","scrollingElement","documentElement","window","getComputedStyle","overflow","temporaryStyles","Array","original","applied","parent","parentElement","computed","overflowX","overflowY","test","setProperty","push","length","queueMicrotask","isConnected","removeProperty","DropdownMenuTrigger","inheritedOrientation","onPointerDown","event","disabled","defaultPrevented","isPrimary","button","altKey","ctrlKey","metaKey","shiftKey","currentTarget","isNativeLink","HTMLAnchorElement","hasAttribute","focus","preventScroll","pointerType","preventDefault","onKeyDown","menubarOrientation","closest","getAttribute","includes","key","Portal","TAB_STOP_SELECTOR","isTabStop","tabIndex","matches","getClientRects","tabStopAt","target","control","adjacentTabStop","from","backwards","dialog","ownerDocument","body","stops","querySelectorAll","filter","ordered","toSorted","a","b","index","indexOf","step","at","MENU_ROW_SELECTOR","Content","hideArrow","portalMount","tabKey","DropdownMenuContent","menu","leaveTarget","onTab","isComposing","panel","stopPropagation","rows","row","active","activeElement","triggerRef","close","onCloseAutoFocus","isOpen","mount","class","ref","addEventListener","removeEventListener","_$memo","Arrow","parts","DropdownMenuItem","Item","onSelectAfterClose","onSelect","DropdownMenuShortcut","Shortcut","DropdownMenuCheckboxItem","CheckboxItem","DropdownMenuRadioItem","RadioItem","DropdownMenuLabel","Label","DropdownMenuSeparator","Separator","DropdownMenuSubTrigger","SubTrigger","DropdownMenuSubContent","SubContent"],"sources":["../../../../src/components/ui/dropdown-menu/dropdown-menu.tsx"],"sourcesContent":["import { DropdownMenu as KobalteDropdownMenu } from '@kobalte/core/dropdown-menu'\nimport { useMenuContext } from '@kobalte/core/menu'\nimport type { Accessor, ComponentProps } from 'solid-js'\nimport { createContext, onCleanup, splitProps, useContext } from 'solid-js'\nimport { callHandler } from '#lib/events'\nimport { popoverArrow, topLayerProps } from '#lib/overlay'\nimport { cn } from '#lib/utils'\nimport { createMenuParts, menuPanel } from './menu-parts'\n\ntype MenuOrientation = 'horizontal' | 'vertical'\ntype DropdownMenuScope = {\n orientation: Accessor<MenuOrientation | undefined>\n /** Queue work for after the menu has closed and focus has settled. */\n setAfterClose: (callback: (() => void) | undefined) => void\n takeAfterClose: () => (() => void) | undefined\n disposed: () => boolean\n}\nconst DropdownMenuScopeContext = createContext<DropdownMenuScope>()\ntype HandlerEvent<Handler> = Handler extends (...args: infer Arguments) => void\n ? Arguments[0]\n : never\ntype DropdownMenuTriggerKeyEvent = HandlerEvent<\n NonNullable<ComponentProps<typeof KobalteDropdownMenu.Trigger>['onKeyDown']>\n>\ntype DropdownMenuTriggerPointerEvent = HandlerEvent<\n NonNullable<ComponentProps<typeof KobalteDropdownMenu.Trigger>['onPointerDown']>\n>\n\n/**\n * DropdownMenu.\n *\n * A list of actions on a trigger, with radio groups for persistent choices\n * that fit naturally in a compact menu. Use Select for form inputs whose\n * selected value needs the field-style control, and Popover for arbitrary\n * content.\n *\n * Kobalte supplies the full menu contract, arrow keys, typeahead, the roving\n * highlight, Escape to close and return focus, which is exactly what a\n * hand-rolled `div` with click handlers gets wrong.\n * Menus are nonmodal by default so their generated focus guards do not become\n * invalid direct children of the ARIA menu. Set `modal` explicitly when the\n * surrounding interaction needs modal containment.\n *\n * The `destructive` variant marks the row with a status-coloured edge and\n * highlighted tint while keeping its label on the body foreground. Pairing it\n * with an AlertDialog is the caller's job.\n *\n * An item that opens something else, a dialog, a sheet, passes it as\n * `onSelectAfterClose`, which runs once the menu has closed and returned focus\n * to its trigger, so the next layer captures the trigger as the control to\n * return to.\n */\nexport function DropdownMenu(props: ComponentProps<typeof KobalteDropdownMenu>) {\n const [local, rest] = splitProps(props, ['modal', 'orientation', 'onOpenChange'])\n let afterClose: (() => void) | undefined\n let disposed = false\n onCleanup(() => {\n disposed = true\n afterClose = undefined\n })\n const scope: DropdownMenuScope = {\n orientation: () => local.orientation,\n setAfterClose: (callback) => (afterClose = callback),\n takeAfterClose: () => {\n const callback = afterClose\n afterClose = undefined\n return callback\n },\n disposed: () => disposed,\n }\n return (\n <DropdownMenuScopeContext.Provider value={scope}>\n <KobalteDropdownMenu\n modal={local.modal ?? false}\n orientation={local.orientation}\n onOpenChange={(open) => {\n if (open) afterClose = undefined\n local.onOpenChange?.(open)\n }}\n {...rest}\n />\n </DropdownMenuScopeContext.Provider>\n )\n}\n\nconst SCROLLABLE_OVERFLOW = /(auto|scroll)/\nconst OVERFLOW_PROPERTIES = ['overflow', 'overflow-x', 'overflow-y'] as const\n\ntype OverflowProperty = (typeof OVERFLOW_PROPERTIES)[number]\ntype OverflowDeclaration = Readonly<{\n property: OverflowProperty\n value: string\n priority: string\n}>\n\nfunction readInlineOverflow(element: HTMLElement): OverflowDeclaration[] {\n return OVERFLOW_PROPERTIES.map((property) => ({\n property,\n value: element.style.getPropertyValue(property),\n priority: element.style.getPropertyPriority(property),\n }))\n}\n\nfunction declarationsMatch(element: HTMLElement, declarations: OverflowDeclaration[]) {\n return declarations.every(\n ({ property, value, priority }) =>\n element.style.getPropertyValue(property) === value &&\n element.style.getPropertyPriority(property) === priority\n )\n}\n\nfunction bypassUnboundedScrollLookup(trigger: HTMLElement) {\n const scrollRoot = document.scrollingElement ?? document.documentElement\n if (window.getComputedStyle(scrollRoot).overflow !== 'hidden') return\n\n const temporaryStyles: Array<{\n element: HTMLElement\n original: OverflowDeclaration[]\n applied: OverflowDeclaration[]\n }> = []\n\n for (let element: HTMLElement | null = trigger; element;) {\n const parent: HTMLElement | null = element.parentElement\n if (element !== scrollRoot) {\n const computed = window.getComputedStyle(element)\n const overflow = `${computed.overflow} ${computed.overflowX} ${computed.overflowY}`\n if (SCROLLABLE_OVERFLOW.test(overflow)) {\n const original = readInlineOverflow(element)\n element.style.setProperty('overflow', 'clip', 'important')\n temporaryStyles.push({ element, original, applied: readInlineOverflow(element) })\n }\n }\n element = parent\n }\n\n if (temporaryStyles.length === 0) return\n\n // Kobalte 0.13.14's keyboard open path synchronously walks scroll parents\n // and never terminates when the root scroller is `overflow: hidden`.\n // Clipping only non-root scroll ancestors makes that walk stop at the locked\n // viewport. Restore those declarations once the event handler finishes, and\n // leave any newer owner write untouched.\n queueMicrotask(() => {\n for (const { element, original, applied } of temporaryStyles) {\n if (!element.isConnected || !declarationsMatch(element, applied)) continue\n for (const property of OVERFLOW_PROPERTIES) element.style.removeProperty(property)\n for (const { property, value, priority } of original) {\n if (value) element.style.setProperty(property, value, priority)\n }\n }\n })\n}\n\nexport function DropdownMenuTrigger(props: ComponentProps<typeof KobalteDropdownMenu.Trigger>) {\n const inheritedOrientation = useContext(DropdownMenuScopeContext)?.orientation\n const [local, rest] = splitProps(props, ['disabled', 'onKeyDown', 'onPointerDown'])\n const onPointerDown = (event: DropdownMenuTriggerPointerEvent) => {\n callHandler(local.onPointerDown, event)\n\n // WebKit can leave focus on a previous control when a native button gets\n // a pointer click. Focus the trigger before Kobalte opens the menu so an\n // enclosing modal focus scope does not restore focus and dismiss the menu.\n if (\n local.disabled ||\n event.defaultPrevented ||\n !event.isPrimary ||\n event.button !== 0 ||\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n event.shiftKey\n ) {\n return\n }\n const trigger = event.currentTarget\n const isNativeLink = trigger instanceof HTMLAnchorElement && trigger.hasAttribute('href')\n if (trigger instanceof HTMLElement && !isNativeLink) {\n trigger.focus({ preventScroll: true })\n // Focusing first is not enough in WebKit: the press's default mousedown\n // action runs afterwards and moves focus off a button to the nearest\n // focusable ancestor, inside a dialog, the dialog, so the menu that\n // just opened still reads focus leaving it and closes. Cancelling the\n // default keeps focus where it was put.\n if (event.pointerType !== 'touch') event.preventDefault()\n }\n }\n const onKeyDown = (event: DropdownMenuTriggerKeyEvent) => {\n // Kobalte's MenuTrigger does not consult defaultPrevented before its own\n // open-key handling. Preserve its existing callback behavior; this wrapper\n // only makes the pre-open scroll-parent lookup terminate.\n callHandler(local.onKeyDown, event)\n\n if (local.disabled) return\n const trigger = event.currentTarget\n if (!(trigger instanceof HTMLElement)) return\n const menubarOrientation = trigger.closest('[role=\"menubar\"]')?.getAttribute('aria-orientation')\n const orientation =\n inheritedOrientation?.() ?? (menubarOrientation === 'vertical' ? 'vertical' : 'horizontal')\n const openingArrow = orientation === 'horizontal' ? 'ArrowDown' : 'ArrowRight'\n if (!['Enter', ' ', openingArrow].includes(event.key)) return\n const isNativeLink = trigger instanceof HTMLAnchorElement && trigger.hasAttribute('href')\n if (isNativeLink && (event.key === 'Enter' || event.key === ' ')) return\n bypassUnboundedScrollLookup(trigger)\n }\n\n return (\n <KobalteDropdownMenu.Trigger\n {...rest}\n disabled={local.disabled}\n onPointerDown={onPointerDown}\n onKeyDown={onKeyDown}\n />\n )\n}\n\nexport { Portal as DropdownMenuPortal } from '@kobalte/core/dropdown-menu'\n\n/** The controls a pointer press can focus. */\nconst TAB_STOP_SELECTOR =\n 'a[href], area[href], button, input, select, textarea, iframe, [tabindex], [contenteditable], details > summary:first-of-type'\n\n/** Whether Tab can land on the element as the page stands now. */\nexport function isTabStop(element: HTMLElement) {\n return (\n (element.tabIndex >= 0 ||\n (element.matches('details > summary:first-of-type') && !element.hasAttribute('tabindex'))) &&\n !element.matches(':disabled') &&\n element.getAttribute('aria-disabled') !== 'true' &&\n element.closest('[hidden], [inert], [aria-hidden=\"true\"]') === null &&\n element.getClientRects().length > 0\n )\n}\n\n/** The focusable control under a pointer press, if Tab could reach it. */\nexport function tabStopAt(target: Element): HTMLElement | undefined {\n const control = target.closest<HTMLElement>(TAB_STOP_SELECTOR)\n return control && isTabStop(control) ? control : undefined\n}\n\n/**\n * The tab stop before or after `from` inside the enclosing dialog (wrapping,\n * as the dialog's focus trap does) or the document (not wrapping), skipping\n * any open menu.\n */\nfunction adjacentTabStop(from: HTMLElement, backwards: boolean): HTMLElement | undefined {\n const dialog = from.closest<HTMLElement>('[role=\"dialog\"]')\n const scope = dialog ?? from.ownerDocument.body\n // Every element, not just TAB_STOP_SELECTOR: the native tabIndex decides,\n // which keeps details summaries and explicit tabindex overrides in order.\n const stops = Array.from(scope.querySelectorAll<HTMLElement>('*')).filter(\n (element) => isTabStop(element) && element.closest('[role=\"menu\"]') === null\n )\n const ordered = [\n ...stops.filter((element) => element.tabIndex > 0).toSorted((a, b) => a.tabIndex - b.tabIndex),\n ...stops.filter((element) => element.tabIndex <= 0),\n ]\n const index = ordered.indexOf(from)\n if (index < 0) return undefined\n const step = backwards ? -1 : 1\n return ordered[index + step] ?? (dialog ? (backwards ? ordered.at(-1) : ordered[0]) : undefined)\n}\n\nconst MENU_ROW_SELECTOR = '[role=\"menuitem\"], [role=\"menuitemradio\"], [role=\"menuitemcheckbox\"]'\n\nexport type DropdownMenuContentProps = ComponentProps<typeof KobalteDropdownMenu.Content> & {\n /**\n * Kept for callers that hid the arrow explicitly; the arrow is now hidden by\n * default. Pass `false` to draw one. The default flipped because Kobalte\n * reserves half of the arrow's 30px box as popper gutter, a menu anchored to\n * its trigger floated 15px off it, which read as a gap rather than as a\n * pointer, and every anchored caller already passed `hideArrow`.\n */\n hideArrow?: boolean\n /** Mount under an owner element such as a modal, keeping the menu in its accessible subtree. */\n portalMount?: HTMLElement\n /**\n * What Tab does while the menu is open. Kobalte 0.13.14 swallows it and\n * leaves focus where it was; `leave` closes the menu and moves on to the tab\n * stop after (or, with Shift, before) the trigger, inside an enclosing\n * dialog or the page; `cycle` moves between the menu's enabled rows.\n */\n tabKey?: 'leave' | 'cycle'\n}\n\nexport function DropdownMenuContent(props: DropdownMenuContentProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'hideArrow',\n 'children',\n 'portalMount',\n 'tabKey',\n 'ref',\n 'onCloseAutoFocus',\n ])\n const scope = useContext(DropdownMenuScopeContext)\n const menu = useMenuContext()\n let leaveTarget: HTMLElement | undefined\n\n // A capture listener on the panel, because Kobalte's list handler moves focus\n // on Tab itself and runs whatever a caller's `onKeyDown` does.\n const onTab = (event: KeyboardEvent) => {\n if (event.key !== 'Tab' || event.isComposing || !local.tabKey) return\n const panel = event.currentTarget as HTMLElement\n event.preventDefault()\n event.stopPropagation()\n if (local.tabKey === 'cycle') {\n const rows = Array.from(panel.querySelectorAll<HTMLElement>(MENU_ROW_SELECTOR)).filter(\n (row) => row.getAttribute('aria-disabled') !== 'true'\n )\n if (!rows.length) return\n const active = document.activeElement\n const index = active instanceof HTMLElement ? rows.indexOf(active) : -1\n const step = event.shiftKey ? -1 : 1\n const next =\n index < 0\n ? event.shiftKey\n ? rows.length - 1\n : 0\n : (index + step + rows.length) % rows.length\n rows[next]?.focus()\n return\n }\n const trigger = menu.triggerRef()\n leaveTarget = trigger ? adjacentTabStop(trigger, event.shiftKey) : undefined\n // Focus first, so a nonmodal menu sees the focus leave and skips its own\n // return-to-trigger; then close in case it did not dismiss itself.\n leaveTarget?.focus({ preventScroll: true })\n menu.close(true)\n }\n\n const onCloseAutoFocus = (event: Event) => {\n local.onCloseAutoFocus?.(event)\n const target = leaveTarget\n leaveTarget = undefined\n if (target) {\n event.preventDefault()\n // Kobalte's focus scope restores its stale mount-time focus after this\n // callback; land on the Tab destination once that has run.\n queueMicrotask(() => {\n if (!menu.isOpen() && target.isConnected && document.activeElement !== target) {\n target.focus({ preventScroll: true })\n }\n })\n }\n const afterClose = scope?.takeAfterClose()\n // Kobalte returns focus to the trigger and releases its focus scope after\n // this callback; the queued work runs once that has finished.\n if (afterClose) queueMicrotask(() => scope?.disposed() || afterClose())\n }\n\n return (\n <KobalteDropdownMenu.Portal mount={local.portalMount}>\n <KobalteDropdownMenu.Content\n {...topLayerProps}\n class={cn(menuPanel, 'min-w-[10rem]', local.class)}\n {...rest}\n ref={(element: HTMLDivElement) => {\n element.addEventListener('keydown', onTab, true)\n onCleanup(() => element.removeEventListener('keydown', onTab, true))\n if (typeof local.ref === 'function') local.ref(element)\n }}\n onCloseAutoFocus={onCloseAutoFocus}\n >\n {local.hideArrow === false && (\n /* Rendered only when a caller asks for it back: the popper folds half\n the arrow's box into the content's gutter, so an arrow and a flush\n menu have never been true at once. */\n <KobalteDropdownMenu.Arrow aria-hidden=\"true\" class={popoverArrow} />\n )}\n {local.children}\n </KobalteDropdownMenu.Content>\n </KobalteDropdownMenu.Portal>\n )\n}\n\nconst parts = createMenuParts(KobalteDropdownMenu, 'dropdown-menu')\n\nexport function DropdownMenuItem(\n props: ComponentProps<typeof parts.Item> & {\n /**\n * Runs after the menu has closed and returned focus to its trigger, the\n * place to open a dialog or sheet, which then returns focus to the trigger.\n */\n onSelectAfterClose?: () => void\n }\n) {\n const scope = useContext(DropdownMenuScopeContext)\n const [local, rest] = splitProps(props, ['onSelectAfterClose', 'onSelect'])\n return (\n <parts.Item\n {...rest}\n onSelect={() => {\n scope?.setAfterClose(local.onSelectAfterClose)\n local.onSelect?.()\n }}\n />\n )\n}\n\nexport const DropdownMenuShortcut = parts.Shortcut\nexport const DropdownMenuCheckboxItem = parts.CheckboxItem\nexport const DropdownMenuRadioItem = parts.RadioItem\nexport const DropdownMenuLabel = parts.Label\nexport const DropdownMenuSeparator = parts.Separator\nexport const DropdownMenuSubTrigger = parts.SubTrigger\nexport const DropdownMenuSubContent = parts.SubContent\nexport {\n Group as DropdownMenuGroup,\n RadioGroup as DropdownMenuRadioGroup,\n Sub as DropdownMenuSub,\n} from '@kobalte/core/dropdown-menu'\n"],"mappings":";;;;;;;;;AAiBA,IAAMiB,2BAA2Bd,cAAiC;;;;;;;;;;;;;;;;;;;;;;;;;AAmClE,SAAgBH,eAAamB,OAAmD;CAC9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names":["DropdownMenu","KobalteDropdownMenu","useMenuContext","createContext","onCleanup","splitProps","useContext","callHandler","topLayerProps","cn","createMenuParts","menuPanel","orientation","setAfterClose","callback","takeAfterClose","disposed","DropdownMenuScopeContext","Trigger","props","local","rest","afterClose","undefined","scope","_$createComponent","Provider","value","children","_$mergeProps","modal","onOpenChange","open","SCROLLABLE_OVERFLOW","OVERFLOW_PROPERTIES","property","priority","readInlineOverflow","element","HTMLElement","map","style","getPropertyValue","getPropertyPriority","declarationsMatch","declarations","every","bypassUnboundedScrollLookup","trigger","scrollRoot","document","scrollingElement","documentElement","window","getComputedStyle","overflow","temporaryStyles","Array","original","applied","parent","parentElement","computed","overflowX","overflowY","test","setProperty","push","length","queueMicrotask","isConnected","removeProperty","DropdownMenuTrigger","inheritedOrientation","onPointerDown","event","disabled","defaultPrevented","isPrimary","button","altKey","ctrlKey","metaKey","shiftKey","currentTarget","isNativeLink","HTMLAnchorElement","hasAttribute","focus","preventScroll","pointerType","preventDefault","onKeyDown","menubarOrientation","closest","getAttribute","includes","key","Portal","TAB_STOP_SELECTOR","isTabStop","tabIndex","matches","getClientRects","tabStopAt","target","control","adjacentTabStop","from","backwards","dialog","ownerDocument","body","stops","querySelectorAll","filter","ordered","toSorted","a","b","index","indexOf","step","at","MENU_ROW_SELECTOR","Content","hideArrow","portalMount","tabKey","DropdownMenuContent","menu","leaveTarget","onTab","isComposing","panel","stopPropagation","rows","row","active","activeElement","triggerRef","close","onCloseAutoFocus","isOpen","mount","class","ref","addEventListener","removeEventListener","_$memo","Arrow","parts","DropdownMenuItem","Item","onSelectAfterClose","onSelect","DropdownMenuShortcut","Shortcut","DropdownMenuCheckboxItem","CheckboxItem","DropdownMenuRadioItem","RadioItem","DropdownMenuLabel","Label","DropdownMenuSeparator","Separator","DropdownMenuSubTrigger","SubTrigger","DropdownMenuSubContent","SubContent"],"sources":["../../../../src/components/ui/dropdown-menu/dropdown-menu.tsx"],"sourcesContent":["import { DropdownMenu as KobalteDropdownMenu } from '@kobalte/core/dropdown-menu'\nimport { useMenuContext } from '@kobalte/core/menu'\nimport type { Accessor, ComponentProps } from 'solid-js'\nimport { createContext, onCleanup, splitProps, useContext } from 'solid-js'\nimport { callHandler } from '#lib/events'\nimport { popoverArrow, topLayerProps } from '#lib/overlay'\nimport { cn } from '#lib/utils'\nimport { createMenuParts, menuPanel } from './menu-parts'\n\ntype MenuOrientation = 'horizontal' | 'vertical'\ntype DropdownMenuScope = {\n orientation: Accessor<MenuOrientation | undefined>\n /** Queue work for after the menu has closed and focus has settled. */\n setAfterClose: (callback: (() => void) | undefined) => void\n takeAfterClose: () => (() => void) | undefined\n disposed: () => boolean\n}\nconst DropdownMenuScopeContext = createContext<DropdownMenuScope>()\ntype HandlerEvent<Handler> = Handler extends (...args: infer Arguments) => void\n ? Arguments[0]\n : never\ntype DropdownMenuTriggerKeyEvent = HandlerEvent<\n NonNullable<ComponentProps<typeof KobalteDropdownMenu.Trigger>['onKeyDown']>\n>\ntype DropdownMenuTriggerPointerEvent = HandlerEvent<\n NonNullable<ComponentProps<typeof KobalteDropdownMenu.Trigger>['onPointerDown']>\n>\n\n/**\n * DropdownMenu.\n *\n * A list of actions on a trigger, with radio groups for persistent choices\n * that fit naturally in a compact menu. Use Select for form inputs whose\n * selected value needs the field-style control, and Popover for arbitrary\n * content.\n *\n * Kobalte supplies the full menu contract, arrow keys, typeahead, the roving\n * highlight, Escape to close and return focus, which is exactly what a\n * hand-rolled `div` with click handlers gets wrong.\n * Menus are nonmodal by default so their generated focus guards do not become\n * invalid direct children of the ARIA menu. Set `modal` explicitly when the\n * surrounding interaction needs modal containment.\n *\n * The `destructive` variant colours the row's icon with the destructive status\n * and tints its highlight while keeping its label on the body foreground. Pairing it\n * with an AlertDialog is the caller's job.\n *\n * An item that opens something else, a dialog, a sheet, passes it as\n * `onSelectAfterClose`, which runs once the menu has closed and returned focus\n * to its trigger, so the next layer captures the trigger as the control to\n * return to.\n */\nexport function DropdownMenu(props: ComponentProps<typeof KobalteDropdownMenu>) {\n const [local, rest] = splitProps(props, ['modal', 'orientation', 'onOpenChange'])\n let afterClose: (() => void) | undefined\n let disposed = false\n onCleanup(() => {\n disposed = true\n afterClose = undefined\n })\n const scope: DropdownMenuScope = {\n orientation: () => local.orientation,\n setAfterClose: (callback) => (afterClose = callback),\n takeAfterClose: () => {\n const callback = afterClose\n afterClose = undefined\n return callback\n },\n disposed: () => disposed,\n }\n return (\n <DropdownMenuScopeContext.Provider value={scope}>\n <KobalteDropdownMenu\n modal={local.modal ?? false}\n orientation={local.orientation}\n onOpenChange={(open) => {\n if (open) afterClose = undefined\n local.onOpenChange?.(open)\n }}\n {...rest}\n />\n </DropdownMenuScopeContext.Provider>\n )\n}\n\nconst SCROLLABLE_OVERFLOW = /(auto|scroll)/\nconst OVERFLOW_PROPERTIES = ['overflow', 'overflow-x', 'overflow-y'] as const\n\ntype OverflowProperty = (typeof OVERFLOW_PROPERTIES)[number]\ntype OverflowDeclaration = Readonly<{\n property: OverflowProperty\n value: string\n priority: string\n}>\n\nfunction readInlineOverflow(element: HTMLElement): OverflowDeclaration[] {\n return OVERFLOW_PROPERTIES.map((property) => ({\n property,\n value: element.style.getPropertyValue(property),\n priority: element.style.getPropertyPriority(property),\n }))\n}\n\nfunction declarationsMatch(element: HTMLElement, declarations: OverflowDeclaration[]) {\n return declarations.every(\n ({ property, value, priority }) =>\n element.style.getPropertyValue(property) === value &&\n element.style.getPropertyPriority(property) === priority\n )\n}\n\nfunction bypassUnboundedScrollLookup(trigger: HTMLElement) {\n const scrollRoot = document.scrollingElement ?? document.documentElement\n if (window.getComputedStyle(scrollRoot).overflow !== 'hidden') return\n\n const temporaryStyles: Array<{\n element: HTMLElement\n original: OverflowDeclaration[]\n applied: OverflowDeclaration[]\n }> = []\n\n for (let element: HTMLElement | null = trigger; element;) {\n const parent: HTMLElement | null = element.parentElement\n if (element !== scrollRoot) {\n const computed = window.getComputedStyle(element)\n const overflow = `${computed.overflow} ${computed.overflowX} ${computed.overflowY}`\n if (SCROLLABLE_OVERFLOW.test(overflow)) {\n const original = readInlineOverflow(element)\n element.style.setProperty('overflow', 'clip', 'important')\n temporaryStyles.push({ element, original, applied: readInlineOverflow(element) })\n }\n }\n element = parent\n }\n\n if (temporaryStyles.length === 0) return\n\n // Kobalte 0.13.14's keyboard open path synchronously walks scroll parents\n // and never terminates when the root scroller is `overflow: hidden`.\n // Clipping only non-root scroll ancestors makes that walk stop at the locked\n // viewport. Restore those declarations once the event handler finishes, and\n // leave any newer owner write untouched.\n queueMicrotask(() => {\n for (const { element, original, applied } of temporaryStyles) {\n if (!element.isConnected || !declarationsMatch(element, applied)) continue\n for (const property of OVERFLOW_PROPERTIES) element.style.removeProperty(property)\n for (const { property, value, priority } of original) {\n if (value) element.style.setProperty(property, value, priority)\n }\n }\n })\n}\n\nexport function DropdownMenuTrigger(props: ComponentProps<typeof KobalteDropdownMenu.Trigger>) {\n const inheritedOrientation = useContext(DropdownMenuScopeContext)?.orientation\n const [local, rest] = splitProps(props, ['disabled', 'onKeyDown', 'onPointerDown'])\n const onPointerDown = (event: DropdownMenuTriggerPointerEvent) => {\n callHandler(local.onPointerDown, event)\n\n // WebKit can leave focus on a previous control when a native button gets\n // a pointer click. Focus the trigger before Kobalte opens the menu so an\n // enclosing modal focus scope does not restore focus and dismiss the menu.\n if (\n local.disabled ||\n event.defaultPrevented ||\n !event.isPrimary ||\n event.button !== 0 ||\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n event.shiftKey\n ) {\n return\n }\n const trigger = event.currentTarget\n const isNativeLink = trigger instanceof HTMLAnchorElement && trigger.hasAttribute('href')\n if (trigger instanceof HTMLElement && !isNativeLink) {\n trigger.focus({ preventScroll: true })\n // Focusing first is not enough in WebKit: the press's default mousedown\n // action runs afterwards and moves focus off a button to the nearest\n // focusable ancestor, inside a dialog, the dialog, so the menu that\n // just opened still reads focus leaving it and closes. Cancelling the\n // default keeps focus where it was put.\n if (event.pointerType !== 'touch') event.preventDefault()\n }\n }\n const onKeyDown = (event: DropdownMenuTriggerKeyEvent) => {\n // Kobalte's MenuTrigger does not consult defaultPrevented before its own\n // open-key handling. Preserve its existing callback behavior; this wrapper\n // only makes the pre-open scroll-parent lookup terminate.\n callHandler(local.onKeyDown, event)\n\n if (local.disabled) return\n const trigger = event.currentTarget\n if (!(trigger instanceof HTMLElement)) return\n const menubarOrientation = trigger.closest('[role=\"menubar\"]')?.getAttribute('aria-orientation')\n const orientation =\n inheritedOrientation?.() ?? (menubarOrientation === 'vertical' ? 'vertical' : 'horizontal')\n const openingArrow = orientation === 'horizontal' ? 'ArrowDown' : 'ArrowRight'\n if (!['Enter', ' ', openingArrow].includes(event.key)) return\n const isNativeLink = trigger instanceof HTMLAnchorElement && trigger.hasAttribute('href')\n if (isNativeLink && (event.key === 'Enter' || event.key === ' ')) return\n bypassUnboundedScrollLookup(trigger)\n }\n\n return (\n <KobalteDropdownMenu.Trigger\n {...rest}\n disabled={local.disabled}\n onPointerDown={onPointerDown}\n onKeyDown={onKeyDown}\n />\n )\n}\n\nexport { Portal as DropdownMenuPortal } from '@kobalte/core/dropdown-menu'\n\n/** The controls a pointer press can focus. */\nconst TAB_STOP_SELECTOR =\n 'a[href], area[href], button, input, select, textarea, iframe, [tabindex], [contenteditable], details > summary:first-of-type'\n\n/** Whether Tab can land on the element as the page stands now. */\nexport function isTabStop(element: HTMLElement) {\n return (\n (element.tabIndex >= 0 ||\n (element.matches('details > summary:first-of-type') && !element.hasAttribute('tabindex'))) &&\n !element.matches(':disabled') &&\n element.getAttribute('aria-disabled') !== 'true' &&\n element.closest('[hidden], [inert], [aria-hidden=\"true\"]') === null &&\n element.getClientRects().length > 0\n )\n}\n\n/** The focusable control under a pointer press, if Tab could reach it. */\nexport function tabStopAt(target: Element): HTMLElement | undefined {\n const control = target.closest<HTMLElement>(TAB_STOP_SELECTOR)\n return control && isTabStop(control) ? control : undefined\n}\n\n/**\n * The tab stop before or after `from` inside the enclosing dialog (wrapping,\n * as the dialog's focus trap does) or the document (not wrapping), skipping\n * any open menu.\n */\nfunction adjacentTabStop(from: HTMLElement, backwards: boolean): HTMLElement | undefined {\n const dialog = from.closest<HTMLElement>('[role=\"dialog\"]')\n const scope = dialog ?? from.ownerDocument.body\n // Every element, not just TAB_STOP_SELECTOR: the native tabIndex decides,\n // which keeps details summaries and explicit tabindex overrides in order.\n const stops = Array.from(scope.querySelectorAll<HTMLElement>('*')).filter(\n (element) => isTabStop(element) && element.closest('[role=\"menu\"]') === null\n )\n const ordered = [\n ...stops.filter((element) => element.tabIndex > 0).toSorted((a, b) => a.tabIndex - b.tabIndex),\n ...stops.filter((element) => element.tabIndex <= 0),\n ]\n const index = ordered.indexOf(from)\n if (index < 0) return undefined\n const step = backwards ? -1 : 1\n return ordered[index + step] ?? (dialog ? (backwards ? ordered.at(-1) : ordered[0]) : undefined)\n}\n\nconst MENU_ROW_SELECTOR = '[role=\"menuitem\"], [role=\"menuitemradio\"], [role=\"menuitemcheckbox\"]'\n\nexport type DropdownMenuContentProps = ComponentProps<typeof KobalteDropdownMenu.Content> & {\n /**\n * Kept for callers that hid the arrow explicitly; the arrow is now hidden by\n * default. Pass `false` to draw one. The default flipped because Kobalte\n * reserves half of the arrow's 30px box as popper gutter, a menu anchored to\n * its trigger floated 15px off it, which read as a gap rather than as a\n * pointer, and every anchored caller already passed `hideArrow`.\n */\n hideArrow?: boolean\n /** Mount under an owner element such as a modal, keeping the menu in its accessible subtree. */\n portalMount?: HTMLElement\n /**\n * What Tab does while the menu is open. Kobalte 0.13.14 swallows it and\n * leaves focus where it was; `leave` closes the menu and moves on to the tab\n * stop after (or, with Shift, before) the trigger, inside an enclosing\n * dialog or the page; `cycle` moves between the menu's enabled rows.\n */\n tabKey?: 'leave' | 'cycle'\n}\n\nexport function DropdownMenuContent(props: DropdownMenuContentProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'hideArrow',\n 'children',\n 'portalMount',\n 'tabKey',\n 'ref',\n 'onCloseAutoFocus',\n ])\n const scope = useContext(DropdownMenuScopeContext)\n const menu = useMenuContext()\n let leaveTarget: HTMLElement | undefined\n\n // A capture listener on the panel, because Kobalte's list handler moves focus\n // on Tab itself and runs whatever a caller's `onKeyDown` does.\n const onTab = (event: KeyboardEvent) => {\n if (event.key !== 'Tab' || event.isComposing || !local.tabKey) return\n const panel = event.currentTarget as HTMLElement\n event.preventDefault()\n event.stopPropagation()\n if (local.tabKey === 'cycle') {\n const rows = Array.from(panel.querySelectorAll<HTMLElement>(MENU_ROW_SELECTOR)).filter(\n (row) => row.getAttribute('aria-disabled') !== 'true'\n )\n if (!rows.length) return\n const active = document.activeElement\n const index = active instanceof HTMLElement ? rows.indexOf(active) : -1\n const step = event.shiftKey ? -1 : 1\n const next =\n index < 0\n ? event.shiftKey\n ? rows.length - 1\n : 0\n : (index + step + rows.length) % rows.length\n rows[next]?.focus()\n return\n }\n const trigger = menu.triggerRef()\n leaveTarget = trigger ? adjacentTabStop(trigger, event.shiftKey) : undefined\n // Focus first, so a nonmodal menu sees the focus leave and skips its own\n // return-to-trigger; then close in case it did not dismiss itself.\n leaveTarget?.focus({ preventScroll: true })\n menu.close(true)\n }\n\n const onCloseAutoFocus = (event: Event) => {\n local.onCloseAutoFocus?.(event)\n const target = leaveTarget\n leaveTarget = undefined\n if (target) {\n event.preventDefault()\n // Kobalte's focus scope restores its stale mount-time focus after this\n // callback; land on the Tab destination once that has run.\n queueMicrotask(() => {\n if (!menu.isOpen() && target.isConnected && document.activeElement !== target) {\n target.focus({ preventScroll: true })\n }\n })\n }\n const afterClose = scope?.takeAfterClose()\n // Kobalte returns focus to the trigger and releases its focus scope after\n // this callback; the queued work runs once that has finished.\n if (afterClose) queueMicrotask(() => scope?.disposed() || afterClose())\n }\n\n return (\n <KobalteDropdownMenu.Portal mount={local.portalMount}>\n <KobalteDropdownMenu.Content\n {...topLayerProps}\n class={cn(menuPanel, 'min-w-[10rem]', local.class)}\n {...rest}\n ref={(element: HTMLDivElement) => {\n element.addEventListener('keydown', onTab, true)\n onCleanup(() => element.removeEventListener('keydown', onTab, true))\n if (typeof local.ref === 'function') local.ref(element)\n }}\n onCloseAutoFocus={onCloseAutoFocus}\n >\n {local.hideArrow === false && (\n /* Rendered only when a caller asks for it back: the popper folds half\n the arrow's box into the content's gutter, so an arrow and a flush\n menu have never been true at once. */\n <KobalteDropdownMenu.Arrow aria-hidden=\"true\" class={popoverArrow} />\n )}\n {local.children}\n </KobalteDropdownMenu.Content>\n </KobalteDropdownMenu.Portal>\n )\n}\n\nconst parts = createMenuParts(KobalteDropdownMenu, 'dropdown-menu')\n\nexport function DropdownMenuItem(\n props: ComponentProps<typeof parts.Item> & {\n /**\n * Runs after the menu has closed and returned focus to its trigger, the\n * place to open a dialog or sheet, which then returns focus to the trigger.\n */\n onSelectAfterClose?: () => void\n }\n) {\n const scope = useContext(DropdownMenuScopeContext)\n const [local, rest] = splitProps(props, ['onSelectAfterClose', 'onSelect'])\n return (\n <parts.Item\n {...rest}\n onSelect={() => {\n scope?.setAfterClose(local.onSelectAfterClose)\n local.onSelect?.()\n }}\n />\n )\n}\n\nexport const DropdownMenuShortcut = parts.Shortcut\nexport const DropdownMenuCheckboxItem = parts.CheckboxItem\nexport const DropdownMenuRadioItem = parts.RadioItem\nexport const DropdownMenuLabel = parts.Label\nexport const DropdownMenuSeparator = parts.Separator\nexport const DropdownMenuSubTrigger = parts.SubTrigger\nexport const DropdownMenuSubContent = parts.SubContent\nexport {\n Group as DropdownMenuGroup,\n RadioGroup as DropdownMenuRadioGroup,\n Sub as DropdownMenuSub,\n} from '@kobalte/core/dropdown-menu'\n"],"mappings":";;;;;;;;;AAiBA,IAAMiB,2BAA2Bd,cAAiC;;;;;;;;;;;;;;;;;;;;;;;;;AAmClE,SAAgBH,eAAamB,OAAmD;CAC9E,MAAM,CAACC,OAAOC,QAAQhB,WAAWc,OAAO;EAAC;EAAS;EAAe;CAAc,CAAC;CAChF,IAAIG;CACJ,IAAIN,WAAW;CACfZ,gBAAgB;EACdY,WAAW;EAC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;GAAC,EAAA,GAC9C5H,MAAI;IAAA6H,MACF5G,YAA4B;KAChCA,QAAQ6G,iBAAiB,WAAWf,OAAO,IAAI;KAC/ChI,gBAAgBkC,QAAQ8G,oBAAoB,WAAWhB,OAAO,IAAI,CAAC;KACnE,IAAI,OAAOhH,MAAM8H,QAAQ,YAAY9H,MAAM8H,IAAI5G,OAAO;IACxD;IACkBwG;IAAgB,IAAAlH,WAAA;KAAA,OAAA,CAAAyH,WAEjCA,WAAAjI,MAAM0G,cAAc,KAAK,CAAA,CAAA,KACxBrG,gBAGCxB,aAAoBqJ,OAAK;MAAA,eAAA;MAAA,SAAA;KAAuC,CAAA,CAClE,GAAAD,WACAjI,MAAMQ,QAAQ,CAAA;IAAA;GAAA,CAAA,CAAA;EAAA;CAAA,CAAA;AAIvB;AAEA,IAAM2H,QAAQ7I,gBAAgBT,cAAqB,eAAe;AAElE,SAAgBuJ,iBACdrI,OAOA;CACA,MAAMK,QAAQlB,WAAWW,wBAAwB;CACjD,MAAM,CAACG,OAAOC,QAAQhB,WAAWc,OAAO,CAAC,sBAAsB,UAAU,CAAC;CAC1E,OAAAM,gBACG8H,MAAME,MAAI5H,WACLR,MAAI,EACRsI,gBAAgB;EACdnI,OAAOX,cAAcO,MAAMsI,kBAAkB;EAC7CtI,MAAMuI,WAAW;CACnB,EAAC,CAAA,CAAA;AAGP;AAEA,IAAaC,uBAAuBL,MAAMM;AAC1C,IAAaC,2BAA2BP,MAAMQ;AAC9C,IAAaC,wBAAwBT,MAAMU;AAC3C,IAAaC,oBAAoBX,MAAMY;AACvC,IAAaC,wBAAwBb,MAAMc;AAC3C,IAAaC,yBAAyBf,MAAMgB;AAC5C,IAAaC,yBAAyBjB,MAAMkB"}
@@ -83,8 +83,11 @@ export declare const popoverArrow = "fill-popover stroke-border";
83
83
  * indicator's accent.
84
84
  */
85
85
  export declare const menuItem: string;
86
- /** A destructive action keeps readable text and marks its row with a status edge. */
87
- export declare const destructiveMenuItem = "border-s-2 border-destructive ps-1.5 text-foreground data-[highlighted]:bg-destructive-subtle";
86
+ /**
87
+ * A destructive action keeps readable body text; its icon takes the status colour and the
88
+ * highlight a destructive tint. No edge bar: the row lines up with its neighbours.
89
+ */
90
+ export declare const destructiveMenuItem = "text-foreground data-[highlighted]:bg-destructive-subtle [&_svg:not([data-slot$=-indicator]_*)]:text-destructive!";
88
91
  /** The label above a group of menu rows. */
89
92
  export declare const menuLabel = "px-2 py-1.5 text-2xs font-medium tracking-wide text-muted-foreground uppercase";
90
93
  /** The chord drawn at a row's trailing edge: menus and the command palette. */
@@ -1 +1 @@
1
- {"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../src/lib/overlay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AAEtD;+EAC+E;AAC/E,eAAO,MAAM,cAAc,iFACqD,CAAA;AAEhF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,4EACiD,CAAA;AAE3E;;;GAGG;AACH,eAAO,MAAM,YAAY,wDAAwD,CAAA;AAEjF,yEAAyE;AACzE,eAAO,MAAM,iBAAiB,6DAA6D,CAAA;AAE3F,gDAAgD;AAChD,eAAO,MAAM,YAAY,yFAC+D,CAAA;AAExF,+DAA+D;AAC/D,eAAO,MAAM,kBAAkB,oGACoE,CAAA;AAEnG,gDAAgD;AAChD,eAAO,MAAM,aAAa,qCAAqC,CAAA;AAE/D,+FAA+F;AAC/F,eAAO,MAAM,aAAa,2DAA2D,CAAA;AAErF,2CAA2C;AAC3C,eAAO,MAAM,kBAAkB,kCAAkC,CAAA;AAEjE,iEAAiE;AACjE,eAAO,MAAM,kBAAkB,QAGkE,CAAA;AAEjG;;;;;GAKG;AACH,eAAO,MAAM,UAAU,iEAAiE,CAAA;AAExF;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,QAEkD,CAAA;AAE1E,yDAAyD;AACzD,eAAO,MAAM,aAAa,yMAAuE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;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,8BAA8B,CAAA"}
@@ -84,8 +84,11 @@ var popoverArrow = "fill-popover stroke-border";
84
84
  * indicator's accent.
85
85
  */
86
86
  var menuItem = "relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none transition-colors ease-out data-[highlighted]:bg-surface-hover data-[highlighted]:text-foreground data-[disabled]:pointer-events-none data-[disabled]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([data-slot$=-indicator]_*)]:size-4 [&_svg:not([class*=text-]):not([data-slot$=-indicator]_*)]:text-muted-foreground";
87
- /** A destructive action keeps readable text and marks its row with a status edge. */
88
- var destructiveMenuItem = "border-s-2 border-destructive ps-1.5 text-foreground data-[highlighted]:bg-destructive-subtle";
87
+ /**
88
+ * A destructive action keeps readable body text; its icon takes the status colour and the
89
+ * highlight a destructive tint. No edge bar: the row lines up with its neighbours.
90
+ */
91
+ var destructiveMenuItem = "text-foreground data-[highlighted]:bg-destructive-subtle [&_svg:not([data-slot$=-indicator]_*)]:text-destructive!";
89
92
  /** The label above a group of menu rows. */
90
93
  var menuLabel = "px-2 py-1.5 text-2xs font-medium tracking-wide text-muted-foreground uppercase";
91
94
  /** The chord drawn at a row's trailing edge: menus and the command palette. */
@@ -1 +1 @@
1
- {"version":3,"file":"overlay.js","names":[],"sources":["../../src/lib/overlay.ts"],"sourcesContent":["/**\n * Shared strings for the overlay layer: dialogs, sheets, menus, popovers,\n * tooltips and the command palette.\n *\n * These live here rather than in each component because the overlay family is\n * where consistency is most visible and least likely to survive duplication.\n * A dialog, a sheet and a dropdown that disagree about their border, radius,\n * motion or shadow read as three different apps, and an app that adopts this\n * library would inherit all three. Declaring the surface once is what makes\n * \"an overlay looks like this\" a fact rather than a convention.\n */\n\nimport { cva, type VariantProps } from '#lib/variants'\n\n/** The panel itself: fill, hairline edge, radius, elevation. Menus, popovers\n * and the command palette float on the elevated overlay rung (`--popover`). */\nexport const overlaySurface =\n 'bg-popover text-popover-foreground rounded-xl border border-border shadow-lg'\n\n/**\n * The modal panel: the same hairline edge, radius and elevation, painted on the\n * *neutral* theme surface instead of the elevated overlay rung.\n *\n * `--popover` is the catalogue's `surfaceElevated`, whose derivation amplifies\n * the canvas hue's chroma on the elevated step. On the dark default's violet\n * canvas that makes the dialog the most chromatic surface in the ladder,\n * `oklch(0.2406 0.0088 300.91)`, red above green in sRGB, and on a full dialog\n * panel that cast reads as a warm tint the canvas never has. shadcn's own\n * convention already splits the two: a Dialog paints `bg-background`, menus and\n * popovers paint `bg-popover`. The veil, the hairline and the elevation shadow\n * carry the separation the lighter fill no longer provides.\n */\nexport const dialogSurface =\n 'bg-background text-foreground rounded-xl border border-border shadow-lg'\n\n/**\n * Overlay titles have one fixed typography role. Keep this small recipe shared\n * without loading the configurable Heading component into every dialog.\n */\nexport const overlayTitle = 'font-semibold text-base tracking-tight leading-none'\n\n/** The span of the portal wrapper that centres a dialog-like overlay. */\nexport const overlayPositioner = 'fixed inset-0 z-(--z-dialog) grid place-items-center p-4'\n\n/** The dimming layer behind a modal overlay. */\nexport const overlayScrim =\n 'fixed inset-0 z-(--z-dialog) bg-scrim/50 supports-[backdrop-filter]:backdrop-blur-xs'\n\n/** The scrim fades; it never zooms with the panel above it. */\nexport const overlayScrimMotion =\n 'data-expanded:animate-in data-expanded:fade-in-0 data-closed:animate-out data-closed:fade-out-0'\n\n/** The title block of a dialog-shaped panel. */\nexport const overlayHeader = 'flex flex-col gap-1.5 text-start'\n\n/** The action row of a dialog-shaped panel: stacked on a phone, trailing on a wider window. */\nexport const overlayFooter = 'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end'\n\n/** The sentence under an overlay title. */\nexport const overlayDescription = 'text-muted-foreground text-sm'\n\n/** The icon-only close in a dialog or sheet's top-end corner. */\nexport const overlayCornerClose =\n 'absolute top-3.5 end-3.5 rounded-md p-1 text-muted-foreground ' +\n 'transition-colors ease-out hover:bg-surface-hover hover:text-foreground ' +\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle outline-none'\n\n/**\n * The tip: shadcn's inverted chip, foreground on background, so an explanation\n * never reads as a popover that could hold controls. The side rail draws it\n * flush to a collapsed row and every floating tooltip composes the same fill\n * and type, so a control never explains itself in two visual languages.\n */\nexport const tooltipTip = 'bg-foreground text-background rounded-md text-xs font-medium'\n\n/**\n * Entrance and exit motion, expressed as data-state classes.\n *\n * `data-expanded` / `data-closed` are Kobalte's; `data-side-*` come from its\n * popper positioning and let a menu slide in from the edge it is anchored to,\n * which is what makes a dropdown feel attached to its trigger rather than\n * dropped on the screen. Exit motion is shorter than entry, because a\n * dismissal should feel immediate while an arrival benefits from being seen.\n */\nexport const overlayZoom =\n 'data-expanded:animate-in data-expanded:fade-in-0 data-expanded:zoom-in-95 ' +\n 'data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95'\n\n/** `overlayZoom` at the panel's pace: menus, dialogs. */\nexport const overlayMotion = `${overlayZoom} data-expanded:duration-200 data-closed:duration-150`\n\n/** `overlayZoom` at a hint's pace: the tooltip and the hover card. */\nexport const tooltipMotion = `${overlayZoom} data-expanded:duration-150 data-closed:duration-100`\n\n/** Popover-style motion: no zoom, so a panel anchored to a control does not\n * appear to breathe away from it. */\nexport const popoverMotion =\n 'data-expanded:animate-in data-expanded:fade-in-0 data-closed:animate-out data-closed:fade-out-0 ' +\n 'data-expanded:duration-150 data-closed:duration-100'\n\n/** The popper arrow. Sized in the component; coloured here. */\nexport const popoverArrow = 'fill-popover stroke-border'\n\n/**\n * A menu row: the shared height, radius, hover fill and focus treatment for\n * every item inside a menu, listbox or command list.\n *\n * The row sizes and dims the icons a caller puts in it, but not the glyph of\n * its selection indicator (any `[data-slot$=-indicator]`): a descendant `svg`\n * rule outranks a single utility on the glyph, so without the exclusion a\n * radio item's `size-2` dot drew as a 16px muted disc and every check lost the\n * indicator's accent.\n */\nexport const menuItem =\n 'relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none ' +\n 'transition-colors ease-out ' +\n 'data-[highlighted]:bg-surface-hover data-[highlighted]:text-foreground ' +\n 'data-[disabled]:pointer-events-none data-[disabled]:text-muted-foreground ' +\n '[&_svg]:pointer-events-none [&_svg]:shrink-0 ' +\n '[&_svg:not([data-slot$=-indicator]_*)]:size-4 ' +\n '[&_svg:not([class*=text-]):not([data-slot$=-indicator]_*)]:text-muted-foreground'\n\n/** A destructive action keeps readable text and marks its row with a status edge. */\nexport const destructiveMenuItem =\n 'border-s-2 border-destructive ps-1.5 text-foreground data-[highlighted]:bg-destructive-subtle'\n\n/** The label above a group of menu rows. */\nexport const menuLabel =\n 'px-2 py-1.5 text-2xs font-medium tracking-wide text-muted-foreground uppercase'\n\n/** The chord drawn at a row's trailing edge: menus and the command palette. */\nexport const menuShortcut = 'text-muted-foreground ms-auto text-xs tracking-widest'\n\n/** The rule between menu groups. */\nexport const menuSeparator = 'bg-border -mx-1 my-1 h-px'\n\n/**\n * A leading colour swatch on a menu or select row: the sanctioned way to carry\n * a card-tone colour into a list of options. The tones are the system's accent\n * and status roles, the vocabulary a Badge already speaks, so the colour an\n * option shows in a menu is the colour its badge carries on a card, and a\n * caller never passes a raw colour into a list. The dot is `aria-hidden`; the\n * label carries the meaning, so a tone is never the only signal.\n */\nexport const menuSwatchTone = cva('size-2 shrink-0 rounded-full', {\n variants: {\n tone: {\n neutral: 'bg-muted-foreground',\n primary: 'bg-primary',\n success: 'bg-success',\n warning: 'bg-warning',\n destructive: 'bg-destructive',\n info: 'bg-info',\n },\n },\n defaultVariants: { tone: 'neutral' },\n})\n\n/** The tones a menu row's swatch can take. */\nexport type MenuSwatchTone = NonNullable<VariantProps<typeof menuSwatchTone>['tone']>\n\n/** Padding shared by every menu-list surface. */\nexport const menuContentPadding = 'p-1'\n\n/**\n * Marks a floating layer, a menu, a listbox, a popover, as part of the top\n * layer.\n *\n * A modal dialog hides everything outside itself from assistive technology\n * (`aria-hidden` on its siblings) and keeps watching `<body>` for new nodes.\n * A menu or select opened from inside the dialog portals to `<body>`, so the\n * dialog hid it too: the list was on screen, focused, and invisible to a\n * screen reader, and an outside-click check could treat a click on it as a\n * click away from the dialog. Kobalte exempts nodes carrying this attribute\n * from both, so every floating layer carries it.\n */\nexport const topLayerProps = { 'data-kb-top-layer': '' } as const\n\n/**\n * Marks a portal mounted while another modal layer is already open as a layer\n * of its own rather than background.\n *\n * Kobalte's hide-outside observer walks body children added after its layer\n * opened and aria-hides them a frame later, so a non-modal dialog portaled in\n * during that window would land outside the accessibility tree. That observer\n * exempts added nodes carrying the React Aria spelling it ported;\n * `data-kb-top-layer` (`topLayerProps`) is only honoured by a newer layer's\n * initial walk, which must still hide this portal.\n */\nexport const lateLayerAttribute = 'data-react-aria-top-layer'\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,IAAa,iBACX;;;;;;;;;;;;;;AAeF,IAAa,gBACX;;;;;AAMF,IAAa,eAAe;;AAG5B,IAAa,oBAAoB;;AAGjC,IAAa,eACX;;AAGF,IAAa,qBACX;;AAGF,IAAa,gBAAgB;;AAG7B,IAAa,gBAAgB;;AAG7B,IAAa,qBAAqB;;AAGlC,IAAa,qBACX;;;;;;;AAUF,IAAa,aAAa;;;;;;;;;;AAW1B,IAAa,cACX;;AAIF,IAAa,gBAAgB,GAAG,YAAY;;AAG5C,IAAa,gBAAgB,GAAG,YAAY;;;AAI5C,IAAa,gBACX;;AAIF,IAAa,eAAe;;;;;;;;;;;AAY5B,IAAa,WACX;;AASF,IAAa,sBACX;;AAGF,IAAa,YACX;;AAGF,IAAa,eAAe;;AAG5B,IAAa,gBAAgB;;;;;;;;;AAU7B,IAAa,iBAAiB,IAAI,gCAAgC;CAChE,UAAU,EACR,MAAM;EACJ,SAAS;EACT,SAAS;EACT,SAAS;EACT,SAAS;EACT,aAAa;EACb,MAAM;CACR,EACF;CACA,iBAAiB,EAAE,MAAM,UAAU;AACrC,CAAC;;AAMD,IAAa,qBAAqB;;;;;;;;;;;;;AAclC,IAAa,gBAAgB,EAAE,qBAAqB,GAAG;;;;;;;;;;;;AAavD,IAAa,qBAAqB"}
1
+ {"version":3,"file":"overlay.js","names":[],"sources":["../../src/lib/overlay.ts"],"sourcesContent":["/**\n * Shared strings for the overlay layer: dialogs, sheets, menus, popovers,\n * tooltips and the command palette.\n *\n * These live here rather than in each component because the overlay family is\n * where consistency is most visible and least likely to survive duplication.\n * A dialog, a sheet and a dropdown that disagree about their border, radius,\n * motion or shadow read as three different apps, and an app that adopts this\n * library would inherit all three. Declaring the surface once is what makes\n * \"an overlay looks like this\" a fact rather than a convention.\n */\n\nimport { cva, type VariantProps } from '#lib/variants'\n\n/** The panel itself: fill, hairline edge, radius, elevation. Menus, popovers\n * and the command palette float on the elevated overlay rung (`--popover`). */\nexport const overlaySurface =\n 'bg-popover text-popover-foreground rounded-xl border border-border shadow-lg'\n\n/**\n * The modal panel: the same hairline edge, radius and elevation, painted on the\n * *neutral* theme surface instead of the elevated overlay rung.\n *\n * `--popover` is the catalogue's `surfaceElevated`, whose derivation amplifies\n * the canvas hue's chroma on the elevated step. On the dark default's violet\n * canvas that makes the dialog the most chromatic surface in the ladder,\n * `oklch(0.2406 0.0088 300.91)`, red above green in sRGB, and on a full dialog\n * panel that cast reads as a warm tint the canvas never has. shadcn's own\n * convention already splits the two: a Dialog paints `bg-background`, menus and\n * popovers paint `bg-popover`. The veil, the hairline and the elevation shadow\n * carry the separation the lighter fill no longer provides.\n */\nexport const dialogSurface =\n 'bg-background text-foreground rounded-xl border border-border shadow-lg'\n\n/**\n * Overlay titles have one fixed typography role. Keep this small recipe shared\n * without loading the configurable Heading component into every dialog.\n */\nexport const overlayTitle = 'font-semibold text-base tracking-tight leading-none'\n\n/** The span of the portal wrapper that centres a dialog-like overlay. */\nexport const overlayPositioner = 'fixed inset-0 z-(--z-dialog) grid place-items-center p-4'\n\n/** The dimming layer behind a modal overlay. */\nexport const overlayScrim =\n 'fixed inset-0 z-(--z-dialog) bg-scrim/50 supports-[backdrop-filter]:backdrop-blur-xs'\n\n/** The scrim fades; it never zooms with the panel above it. */\nexport const overlayScrimMotion =\n 'data-expanded:animate-in data-expanded:fade-in-0 data-closed:animate-out data-closed:fade-out-0'\n\n/** The title block of a dialog-shaped panel. */\nexport const overlayHeader = 'flex flex-col gap-1.5 text-start'\n\n/** The action row of a dialog-shaped panel: stacked on a phone, trailing on a wider window. */\nexport const overlayFooter = 'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end'\n\n/** The sentence under an overlay title. */\nexport const overlayDescription = 'text-muted-foreground text-sm'\n\n/** The icon-only close in a dialog or sheet's top-end corner. */\nexport const overlayCornerClose =\n 'absolute top-3.5 end-3.5 rounded-md p-1 text-muted-foreground ' +\n 'transition-colors ease-out hover:bg-surface-hover hover:text-foreground ' +\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle outline-none'\n\n/**\n * The tip: shadcn's inverted chip, foreground on background, so an explanation\n * never reads as a popover that could hold controls. The side rail draws it\n * flush to a collapsed row and every floating tooltip composes the same fill\n * and type, so a control never explains itself in two visual languages.\n */\nexport const tooltipTip = 'bg-foreground text-background rounded-md text-xs font-medium'\n\n/**\n * Entrance and exit motion, expressed as data-state classes.\n *\n * `data-expanded` / `data-closed` are Kobalte's; `data-side-*` come from its\n * popper positioning and let a menu slide in from the edge it is anchored to,\n * which is what makes a dropdown feel attached to its trigger rather than\n * dropped on the screen. Exit motion is shorter than entry, because a\n * dismissal should feel immediate while an arrival benefits from being seen.\n */\nexport const overlayZoom =\n 'data-expanded:animate-in data-expanded:fade-in-0 data-expanded:zoom-in-95 ' +\n 'data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95'\n\n/** `overlayZoom` at the panel's pace: menus, dialogs. */\nexport const overlayMotion = `${overlayZoom} data-expanded:duration-200 data-closed:duration-150`\n\n/** `overlayZoom` at a hint's pace: the tooltip and the hover card. */\nexport const tooltipMotion = `${overlayZoom} data-expanded:duration-150 data-closed:duration-100`\n\n/** Popover-style motion: no zoom, so a panel anchored to a control does not\n * appear to breathe away from it. */\nexport const popoverMotion =\n 'data-expanded:animate-in data-expanded:fade-in-0 data-closed:animate-out data-closed:fade-out-0 ' +\n 'data-expanded:duration-150 data-closed:duration-100'\n\n/** The popper arrow. Sized in the component; coloured here. */\nexport const popoverArrow = 'fill-popover stroke-border'\n\n/**\n * A menu row: the shared height, radius, hover fill and focus treatment for\n * every item inside a menu, listbox or command list.\n *\n * The row sizes and dims the icons a caller puts in it, but not the glyph of\n * its selection indicator (any `[data-slot$=-indicator]`): a descendant `svg`\n * rule outranks a single utility on the glyph, so without the exclusion a\n * radio item's `size-2` dot drew as a 16px muted disc and every check lost the\n * indicator's accent.\n */\nexport const menuItem =\n 'relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none ' +\n 'transition-colors ease-out ' +\n 'data-[highlighted]:bg-surface-hover data-[highlighted]:text-foreground ' +\n 'data-[disabled]:pointer-events-none data-[disabled]:text-muted-foreground ' +\n '[&_svg]:pointer-events-none [&_svg]:shrink-0 ' +\n '[&_svg:not([data-slot$=-indicator]_*)]:size-4 ' +\n '[&_svg:not([class*=text-]):not([data-slot$=-indicator]_*)]:text-muted-foreground'\n\n/**\n * A destructive action keeps readable body text; its icon takes the status colour and the\n * highlight a destructive tint. No edge bar: the row lines up with its neighbours.\n */\nexport const destructiveMenuItem =\n 'text-foreground data-[highlighted]:bg-destructive-subtle [&_svg:not([data-slot$=-indicator]_*)]:text-destructive!'\n\n/** The label above a group of menu rows. */\nexport const menuLabel =\n 'px-2 py-1.5 text-2xs font-medium tracking-wide text-muted-foreground uppercase'\n\n/** The chord drawn at a row's trailing edge: menus and the command palette. */\nexport const menuShortcut = 'text-muted-foreground ms-auto text-xs tracking-widest'\n\n/** The rule between menu groups. */\nexport const menuSeparator = 'bg-border -mx-1 my-1 h-px'\n\n/**\n * A leading colour swatch on a menu or select row: the sanctioned way to carry\n * a card-tone colour into a list of options. The tones are the system's accent\n * and status roles, the vocabulary a Badge already speaks, so the colour an\n * option shows in a menu is the colour its badge carries on a card, and a\n * caller never passes a raw colour into a list. The dot is `aria-hidden`; the\n * label carries the meaning, so a tone is never the only signal.\n */\nexport const menuSwatchTone = cva('size-2 shrink-0 rounded-full', {\n variants: {\n tone: {\n neutral: 'bg-muted-foreground',\n primary: 'bg-primary',\n success: 'bg-success',\n warning: 'bg-warning',\n destructive: 'bg-destructive',\n info: 'bg-info',\n },\n },\n defaultVariants: { tone: 'neutral' },\n})\n\n/** The tones a menu row's swatch can take. */\nexport type MenuSwatchTone = NonNullable<VariantProps<typeof menuSwatchTone>['tone']>\n\n/** Padding shared by every menu-list surface. */\nexport const menuContentPadding = 'p-1'\n\n/**\n * Marks a floating layer, a menu, a listbox, a popover, as part of the top\n * layer.\n *\n * A modal dialog hides everything outside itself from assistive technology\n * (`aria-hidden` on its siblings) and keeps watching `<body>` for new nodes.\n * A menu or select opened from inside the dialog portals to `<body>`, so the\n * dialog hid it too: the list was on screen, focused, and invisible to a\n * screen reader, and an outside-click check could treat a click on it as a\n * click away from the dialog. Kobalte exempts nodes carrying this attribute\n * from both, so every floating layer carries it.\n */\nexport const topLayerProps = { 'data-kb-top-layer': '' } as const\n\n/**\n * Marks a portal mounted while another modal layer is already open as a layer\n * of its own rather than background.\n *\n * Kobalte's hide-outside observer walks body children added after its layer\n * opened and aria-hides them a frame later, so a non-modal dialog portaled in\n * during that window would land outside the accessibility tree. That observer\n * exempts added nodes carrying the React Aria spelling it ported;\n * `data-kb-top-layer` (`topLayerProps`) is only honoured by a newer layer's\n * initial walk, which must still hide this portal.\n */\nexport const lateLayerAttribute = 'data-react-aria-top-layer'\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,IAAa,iBACX;;;;;;;;;;;;;;AAeF,IAAa,gBACX;;;;;AAMF,IAAa,eAAe;;AAG5B,IAAa,oBAAoB;;AAGjC,IAAa,eACX;;AAGF,IAAa,qBACX;;AAGF,IAAa,gBAAgB;;AAG7B,IAAa,gBAAgB;;AAG7B,IAAa,qBAAqB;;AAGlC,IAAa,qBACX;;;;;;;AAUF,IAAa,aAAa;;;;;;;;;;AAW1B,IAAa,cACX;;AAIF,IAAa,gBAAgB,GAAG,YAAY;;AAG5C,IAAa,gBAAgB,GAAG,YAAY;;;AAI5C,IAAa,gBACX;;AAIF,IAAa,eAAe;;;;;;;;;;;AAY5B,IAAa,WACX;;;;;AAYF,IAAa,sBACX;;AAGF,IAAa,YACX;;AAGF,IAAa,eAAe;;AAG5B,IAAa,gBAAgB;;;;;;;;;AAU7B,IAAa,iBAAiB,IAAI,gCAAgC;CAChE,UAAU,EACR,MAAM;EACJ,SAAS;EACT,SAAS;EACT,SAAS;EACT,SAAS;EACT,aAAa;EACb,MAAM;CACR,EACF;CACA,iBAAiB,EAAE,MAAM,UAAU;AACrC,CAAC;;AAMD,IAAa,qBAAqB;;;;;;;;;;;;;AAclC,IAAa,gBAAgB,EAAE,qBAAqB,GAAG;;;;;;;;;;;;AAavD,IAAa,qBAAqB"}
@@ -132,6 +132,10 @@ export function ActionButton<T extends ValidComponent = 'button'>(props: ActionB
132
132
  })
133
133
  const [tooltipSuppression, setTooltipSuppression] = createSignal<'pointer' | 'focus' | null>(null)
134
134
  const forwarded = rest as Record<string, unknown>
135
+ let element: HTMLElement | undefined
136
+ // A trigger whose popup is open (a menu, a sheet) names itself already; its tip would sit over
137
+ // that popup and take the first Escape meant for it.
138
+ const popupOpen = () => element?.getAttribute('aria-expanded') === 'true'
135
139
 
136
140
  // One props object for the life of the button. Each value is a getter, so it stays
137
141
  // reactive per key, and the handlers are created once and read the caller's handler
@@ -190,10 +194,11 @@ export function ActionButton<T extends ValidComponent = 'button'>(props: ActionB
190
194
  (local.tooltip && tooltipOpen() ? tooltipId : undefined)
191
195
  )
192
196
  },
193
- ref: (element: HTMLElement) => {
194
- deferred.ref(element)
197
+ ref: (button: HTMLElement) => {
198
+ element = button
199
+ deferred.ref(button)
195
200
  const callerRef = forwarded.ref
196
- if (typeof callerRef === 'function') callerRef(element)
201
+ if (typeof callerRef === 'function') callerRef(button)
197
202
  },
198
203
  onPointerEnter: deferred.onPointerEnter,
199
204
  onFocus: deferred.onFocus,
@@ -259,7 +264,7 @@ export function ActionButton<T extends ValidComponent = 'button'>(props: ActionB
259
264
  placement={local.tooltipSide ?? 'bottom'}
260
265
  open={tooltipOpen()}
261
266
  onOpenChange={(open) => {
262
- if (open && tooltipSuppression()) return
267
+ if (open && (tooltipSuppression() || popupOpen())) return
263
268
  setTooltipOpen(open)
264
269
  }}
265
270
  >
@@ -41,8 +41,8 @@ type DropdownMenuTriggerPointerEvent = HandlerEvent<
41
41
  * invalid direct children of the ARIA menu. Set `modal` explicitly when the
42
42
  * surrounding interaction needs modal containment.
43
43
  *
44
- * The `destructive` variant marks the row with a status-coloured edge and
45
- * highlighted tint while keeping its label on the body foreground. Pairing it
44
+ * The `destructive` variant colours the row's icon with the destructive status
45
+ * and tints its highlight while keeping its label on the body foreground. Pairing it
46
46
  * with an AlertDialog is the caller's job.
47
47
  *
48
48
  * An item that opens something else, a dialog, a sheet, passes it as
@@ -120,9 +120,12 @@ export const menuItem =
120
120
  '[&_svg:not([data-slot$=-indicator]_*)]:size-4 ' +
121
121
  '[&_svg:not([class*=text-]):not([data-slot$=-indicator]_*)]:text-muted-foreground'
122
122
 
123
- /** A destructive action keeps readable text and marks its row with a status edge. */
123
+ /**
124
+ * A destructive action keeps readable body text; its icon takes the status colour and the
125
+ * highlight a destructive tint. No edge bar: the row lines up with its neighbours.
126
+ */
124
127
  export const destructiveMenuItem =
125
- 'border-s-2 border-destructive ps-1.5 text-foreground data-[highlighted]:bg-destructive-subtle'
128
+ 'text-foreground data-[highlighted]:bg-destructive-subtle [&_svg:not([data-slot$=-indicator]_*)]:text-destructive!'
126
129
 
127
130
  /** The label above a group of menu rows. */
128
131
  export const menuLabel =
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adea-ai/ui",
3
- "version": "0.159.3",
3
+ "version": "0.159.5",
4
4
  "description": "The Adea design system: Kobalte-backed Solid components, semantic OKLCH tokens, and the app-shell layout primitives shared by Adea and Cortana.",
5
5
  "keywords": [
6
6
  "adea",
@@ -132,6 +132,10 @@ export function ActionButton<T extends ValidComponent = 'button'>(props: ActionB
132
132
  })
133
133
  const [tooltipSuppression, setTooltipSuppression] = createSignal<'pointer' | 'focus' | null>(null)
134
134
  const forwarded = rest as Record<string, unknown>
135
+ let element: HTMLElement | undefined
136
+ // A trigger whose popup is open (a menu, a sheet) names itself already; its tip would sit over
137
+ // that popup and take the first Escape meant for it.
138
+ const popupOpen = () => element?.getAttribute('aria-expanded') === 'true'
135
139
 
136
140
  // One props object for the life of the button. Each value is a getter, so it stays
137
141
  // reactive per key, and the handlers are created once and read the caller's handler
@@ -190,10 +194,11 @@ export function ActionButton<T extends ValidComponent = 'button'>(props: ActionB
190
194
  (local.tooltip && tooltipOpen() ? tooltipId : undefined)
191
195
  )
192
196
  },
193
- ref: (element: HTMLElement) => {
194
- deferred.ref(element)
197
+ ref: (button: HTMLElement) => {
198
+ element = button
199
+ deferred.ref(button)
195
200
  const callerRef = forwarded.ref
196
- if (typeof callerRef === 'function') callerRef(element)
201
+ if (typeof callerRef === 'function') callerRef(button)
197
202
  },
198
203
  onPointerEnter: deferred.onPointerEnter,
199
204
  onFocus: deferred.onFocus,
@@ -259,7 +264,7 @@ export function ActionButton<T extends ValidComponent = 'button'>(props: ActionB
259
264
  placement={local.tooltipSide ?? 'bottom'}
260
265
  open={tooltipOpen()}
261
266
  onOpenChange={(open) => {
262
- if (open && tooltipSuppression()) return
267
+ if (open && (tooltipSuppression() || popupOpen())) return
263
268
  setTooltipOpen(open)
264
269
  }}
265
270
  >
@@ -41,8 +41,8 @@ type DropdownMenuTriggerPointerEvent = HandlerEvent<
41
41
  * invalid direct children of the ARIA menu. Set `modal` explicitly when the
42
42
  * surrounding interaction needs modal containment.
43
43
  *
44
- * The `destructive` variant marks the row with a status-coloured edge and
45
- * highlighted tint while keeping its label on the body foreground. Pairing it
44
+ * The `destructive` variant colours the row's icon with the destructive status
45
+ * and tints its highlight while keeping its label on the body foreground. Pairing it
46
46
  * with an AlertDialog is the caller's job.
47
47
  *
48
48
  * An item that opens something else, a dialog, a sheet, passes it as
@@ -120,9 +120,12 @@ export const menuItem =
120
120
  '[&_svg:not([data-slot$=-indicator]_*)]:size-4 ' +
121
121
  '[&_svg:not([class*=text-]):not([data-slot$=-indicator]_*)]:text-muted-foreground'
122
122
 
123
- /** A destructive action keeps readable text and marks its row with a status edge. */
123
+ /**
124
+ * A destructive action keeps readable body text; its icon takes the status colour and the
125
+ * highlight a destructive tint. No edge bar: the row lines up with its neighbours.
126
+ */
124
127
  export const destructiveMenuItem =
125
- 'border-s-2 border-destructive ps-1.5 text-foreground data-[highlighted]:bg-destructive-subtle'
128
+ 'text-foreground data-[highlighted]:bg-destructive-subtle [&_svg:not([data-slot$=-indicator]_*)]:text-destructive!'
126
129
 
127
130
  /** The label above a group of menu rows. */
128
131
  export const menuLabel =