@adea-ai/ui 0.110.0 → 0.111.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/composites/account-menu/account-menu.js +1 -1
- package/dist/components/composites/action-button/action-button.js +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.d.ts +17 -2
- package/dist/components/composites/appearance-editor/accent-swatch-groups.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js +47 -122
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js +0 -4
- package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.js +1 -1
- package/dist/components/composites/appearance-editor/font-settings-group.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/font-settings-group.js +60 -68
- package/dist/components/composites/appearance-editor/font-settings-group.js.map +1 -1
- package/dist/components/composites/appearance-editor/index.js +1 -1
- package/dist/components/layout/split-layout/split-layout.d.ts.map +1 -1
- package/dist/components/layout/split-layout/split-layout.js +5 -2
- package/dist/components/layout/split-layout/split-layout.js.map +1 -1
- package/dist/components/theme/appearance-panel.d.ts.map +1 -1
- package/dist/components/theme/appearance-panel.js +0 -3
- package/dist/components/theme/appearance-panel.js.map +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.js +2 -2
- package/dist/components/ui/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/ui/combobox/combobox.d.ts.map +1 -1
- package/dist/components/ui/combobox/combobox.js +1 -1
- package/dist/components/ui/combobox/combobox.js.map +1 -1
- package/dist/components/ui/context-menu/context-menu.d.ts.map +1 -1
- package/dist/components/ui/context-menu/context-menu.js +2 -2
- package/dist/components/ui/context-menu/context-menu.js.map +1 -1
- package/dist/components/ui/dialog/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog/dialog.js +17 -11
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/components/ui/drawer/drawer.js +1 -1
- package/dist/components/ui/drawer/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +22 -2
- package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.js +79 -30
- package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/ui/dropdown-menu/index.d.ts +1 -0
- package/dist/components/ui/dropdown-menu/index.d.ts.map +1 -1
- package/dist/components/ui/menubar/menubar.d.ts.map +1 -1
- package/dist/components/ui/menubar/menubar.js +2 -2
- package/dist/components/ui/menubar/menubar.js.map +1 -1
- package/dist/components/ui/select/index.d.ts +1 -0
- package/dist/components/ui/select/index.d.ts.map +1 -1
- package/dist/components/ui/select/select.d.ts +7 -1
- package/dist/components/ui/select/select.d.ts.map +1 -1
- package/dist/components/ui/select/select.js +34 -20
- package/dist/components/ui/select/select.js.map +1 -1
- package/dist/components/ui/sheet/sheet.js +1 -1
- package/dist/components/ui/sheet/sheet.js.map +1 -1
- package/dist/components/ui/tooltip/tooltip.d.ts +16 -6
- package/dist/components/ui/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip/tooltip.js +17 -6
- package/dist/components/ui/tooltip/tooltip.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/lib/overlay.d.ts +30 -1
- package/dist/lib/overlay.d.ts.map +1 -1
- package/dist/lib/overlay.js +37 -2
- package/dist/lib/overlay.js.map +1 -1
- package/dist/r/dialog.json +1 -0
- package/dist/r/registry.json +2 -1
- package/dist/r/split-layout.json +1 -1
- package/dist/r/src/components/composites/appearance-editor/accent-swatch-groups.tsx +33 -86
- package/dist/r/src/components/composites/appearance-editor/appearance-choices.tsx +0 -3
- package/dist/r/src/components/composites/appearance-editor/font-settings-group.tsx +20 -7
- package/dist/r/src/components/layout/split-layout/split-layout.tsx +4 -3
- package/dist/r/src/components/theme/appearance-panel.tsx +0 -1
- package/dist/r/src/components/ui/alert-dialog/alert-dialog.tsx +2 -2
- package/dist/r/src/components/ui/combobox/combobox.tsx +3 -1
- package/dist/r/src/components/ui/context-menu/context-menu.tsx +6 -2
- package/dist/r/src/components/ui/dialog/dialog.tsx +19 -12
- package/dist/r/src/components/ui/drawer/drawer.tsx +1 -1
- package/dist/r/src/components/ui/dropdown-menu/dropdown-menu.tsx +44 -6
- package/dist/r/src/components/ui/dropdown-menu/index.ts +1 -0
- package/dist/r/src/components/ui/menubar/menubar.tsx +6 -2
- package/dist/r/src/components/ui/select/index.ts +1 -0
- package/dist/r/src/components/ui/select/select.tsx +31 -6
- package/dist/r/src/components/ui/sheet/sheet.tsx +1 -1
- package/dist/r/src/components/ui/tooltip/tooltip.tsx +34 -3
- package/dist/r/src/lib/overlay.ts +45 -1
- package/package.json +1 -1
- package/registry.json +2 -1
- package/src/components/composites/appearance-editor/accent-swatch-groups.tsx +33 -86
- package/src/components/composites/appearance-editor/appearance-choices.tsx +0 -3
- package/src/components/composites/appearance-editor/font-settings-group.tsx +20 -7
- package/src/components/layout/split-layout/split-layout.tsx +4 -3
- package/src/components/theme/appearance-panel.tsx +0 -1
- package/src/components/ui/alert-dialog/alert-dialog.tsx +2 -2
- package/src/components/ui/combobox/combobox.tsx +3 -1
- package/src/components/ui/context-menu/context-menu.tsx +6 -2
- package/src/components/ui/dialog/dialog.tsx +19 -12
- package/src/components/ui/drawer/drawer.tsx +1 -1
- package/src/components/ui/dropdown-menu/dropdown-menu.tsx +44 -6
- package/src/components/ui/dropdown-menu/index.ts +1 -0
- package/src/components/ui/menubar/menubar.tsx +6 -2
- package/src/components/ui/select/index.ts +1 -0
- package/src/components/ui/select/select.tsx +31 -6
- package/src/components/ui/sheet/sheet.tsx +1 -1
- package/src/components/ui/tooltip/tooltip.tsx +34 -3
- package/src/lib/overlay.ts +45 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { cn } from "../../../lib/utils.js";
|
|
2
|
-
import { tooltipTip } from "../../../lib/overlay.js";
|
|
3
|
-
import { createComponent, isServer, memo, mergeProps } from "solid-js/web";
|
|
4
|
-
import { createContext, createEffect, createSignal, createUniqueId, onCleanup, splitProps, useContext } from "solid-js";
|
|
2
|
+
import { tooltipTip, topLayerProps } from "../../../lib/overlay.js";
|
|
3
|
+
import { createComponent, insert, isServer, memo, mergeProps, template } from "solid-js/web";
|
|
4
|
+
import { Show, createContext, createEffect, createSignal, createUniqueId, onCleanup, splitProps, useContext } from "solid-js";
|
|
5
5
|
import { Tooltip, useTooltipContext } from "@kobalte/core/tooltip";
|
|
6
6
|
//#region src/components/ui/tooltip/tooltip.tsx
|
|
7
|
+
var _tmpl$ = /*#__PURE__*/ template(`<span data-slot=tooltip-icon aria-hidden=true class="flex size-4 shrink-0 items-center justify-center [&_svg]:size-4">`);
|
|
7
8
|
var tooltipDefaults = {
|
|
8
9
|
/** Long enough that a pointer crossing a toolbar does not strobe tooltips. */
|
|
9
10
|
openDelay: 400,
|
|
@@ -257,6 +258,7 @@ function TooltipContent(props) {
|
|
|
257
258
|
const [local, rest] = splitProps(props, [
|
|
258
259
|
"class",
|
|
259
260
|
"children",
|
|
261
|
+
"icon",
|
|
260
262
|
"aria-hidden",
|
|
261
263
|
"onEscapeKeyDown",
|
|
262
264
|
"onPointerDownOutside"
|
|
@@ -266,7 +268,7 @@ function TooltipContent(props) {
|
|
|
266
268
|
return createComponent(Tooltip.Content, mergeProps({
|
|
267
269
|
"data-slot": "tooltip-content",
|
|
268
270
|
get ["class"]() {
|
|
269
|
-
return cn(tooltipTip, "z-(--z-tooltip) w-fit max-w-(--tooltip-max-width) px-2 py-1", "origin-(--kb-tooltip-content-transform-origin) text-balance", "data-expanded:animate-in data-expanded:fade-in-0 data-expanded:zoom-in-95", "data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", "data-expanded:duration-150 data-closed:duration-100", local.class);
|
|
271
|
+
return cn(tooltipTip, "z-(--z-tooltip) w-fit max-w-(--tooltip-max-width) px-2 py-1", "origin-(--kb-tooltip-content-transform-origin) text-balance", "data-expanded:animate-in data-expanded:fade-in-0 data-expanded:zoom-in-95", "data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", "data-expanded:duration-150 data-closed:duration-100", { "flex items-center gap-2 whitespace-nowrap": !!local.icon }, local.class);
|
|
270
272
|
},
|
|
271
273
|
style: { "pointer-events": "none" },
|
|
272
274
|
get ["aria-hidden"]() {
|
|
@@ -280,8 +282,17 @@ function TooltipContent(props) {
|
|
|
280
282
|
invokeEventHandler(local.onPointerDownOutside, event);
|
|
281
283
|
if (!event.defaultPrevented) interaction?.markCloseIntent();
|
|
282
284
|
}
|
|
283
|
-
}, rest, { get children() {
|
|
284
|
-
return
|
|
285
|
+
}, topLayerProps, rest, { get children() {
|
|
286
|
+
return [createComponent(Show, {
|
|
287
|
+
get when() {
|
|
288
|
+
return local.icon;
|
|
289
|
+
},
|
|
290
|
+
children: (icon) => (() => {
|
|
291
|
+
var _el$ = _tmpl$();
|
|
292
|
+
insert(_el$, icon);
|
|
293
|
+
return _el$;
|
|
294
|
+
})()
|
|
295
|
+
}), memo(() => local.children)];
|
|
285
296
|
} }));
|
|
286
297
|
} });
|
|
287
298
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.js","names":["Tooltip","KobalteTooltip","useTooltipContext","ComponentProps","createContext","createEffect","createSignal","createUniqueId","onCleanup","splitProps","useContext","isServer","tooltipTip","cn","TooltipTiming","openDelay","closeDelay","skipDelayDuration","tooltipDefaults","TooltipTimingContext","TooltipInteraction","id","trigger","HTMLElement","setTrigger","element","isOpen","isDisabled","isTriggerFocused","markOpenIntent","clearOpenIntent","requestCloseFromAnotherTooltip","markPointerCloseIntent","clearPointerCloseIntent","markCloseIntent","TooltipInteractionContext","openTooltipInteractions","Set","pendingTooltipOpenId","tooltipScrollListenerAttached","clearPendingTooltipOpen","undefined","tooltipScrollContainsTrigger","event","Event","target","window","Node","contains","handleTooltipScroll","interaction","handleTooltipPointerMove","PointerEvent","setTooltipInteractionOpen","open","has","add","addEventListener","document","delete","size","removeEventListener","registerTooltipInteraction","invokeEventHandler","handler","Array","isArray","callback","data","TooltipProviderProps","children","TooltipProvider","props","_$createComponent","Provider","value","TooltipRootProps","timing","local","rest","controlled","uncontrolledOpen","setUncontrolledOpen","defaultOpen","closeIntent","ignoreDuplicateClose","onOpenChange","next","source","pointerCloseIntentUntil","pointerCloseIntentTimeout","ReturnType","setTimeout","clearTimeout","Date","now","queueMicrotask","disabled","Boolean","activeElement","openInteraction","focusedTrigger","anotherTooltipOpening","pointerClosePending","handleKeyDown","KeyboardEvent","key","_$mergeProps","TooltipTrigger","Trigger","ref","onFocus","defaultPrevented","onBlur","onPointerEnter","onPointerLeave","onClick","TooltipContentProps","Content","TooltipContent","context","Portal","class","style","aria-hidden","_$memo","onEscapeKeyDown","onPointerDownOutside","_$createComponent","Tooltip","KobalteTooltip","_$mergeProps","_$memo"],"sources":["../../../../src/components/ui/tooltip/tooltip.tsx"],"sourcesContent":["import { Tooltip as KobalteTooltip, useTooltipContext } from '@kobalte/core/tooltip'\nimport type { ComponentProps } from 'solid-js'\nimport {\n createContext,\n createEffect,\n createSignal,\n createUniqueId,\n onCleanup,\n splitProps,\n useContext,\n} from 'solid-js'\nimport { isServer } from 'solid-js/web'\nimport { tooltipTip } from '#lib/overlay'\nimport { cn } from '#lib/utils'\n\n/**\n * The provider sets the *timing* defaults for every tooltip below it.\n *\n * Timing is the part of a tooltip that has to agree across an app: one that\n * opens in 200ms in a toolbar and 700ms in a sidebar reads as a bug. The\n * provider is where that agreement lives. It is optional — a tooltip outside a\n * provider falls back to the same defaults — so a consumer can drop it in\n * without restructuring anything.\n */\ntype TooltipTiming = {\n openDelay: number\n closeDelay: number\n skipDelayDuration: number\n}\n\nconst tooltipDefaults: TooltipTiming = {\n /** Long enough that a pointer crossing a toolbar does not strobe tooltips. */\n openDelay: 400,\n /** Short, because the pointer has already left the control. */\n closeDelay: 80,\n /**\n * After a tooltip has been seen, the next one opens immediately for this\n * long. This is what makes moving along a row of icons feel like one\n * gesture instead of four separate waits.\n */\n skipDelayDuration: 500,\n}\n\nconst TooltipTimingContext = createContext<TooltipTiming>(tooltipDefaults)\n\ntype TooltipInteraction = {\n id: string\n trigger: () => HTMLElement | undefined\n setTrigger: (element: HTMLElement) => void\n isOpen: () => boolean\n isDisabled: () => boolean\n isTriggerFocused: () => boolean\n markOpenIntent: () => void\n clearOpenIntent: () => void\n requestCloseFromAnotherTooltip: () => void\n markPointerCloseIntent: () => void\n clearPointerCloseIntent: () => void\n markCloseIntent: () => void\n}\n\nconst TooltipInteractionContext = createContext<TooltipInteraction>()\nconst openTooltipInteractions = new Set<TooltipInteraction>()\nlet pendingTooltipOpenId: string | undefined\nlet tooltipScrollListenerAttached = false\n\nfunction clearPendingTooltipOpen(id: string) {\n if (pendingTooltipOpenId === id) pendingTooltipOpenId = undefined\n}\n\nfunction tooltipScrollContainsTrigger(event: Event, trigger: HTMLElement) {\n const target = event.target\n return target === window || (target instanceof Node && target.contains(trigger))\n}\n\nfunction handleTooltipScroll(event: Event) {\n for (const interaction of openTooltipInteractions) {\n const trigger = interaction.trigger()\n if (interaction.isOpen() && trigger && tooltipScrollContainsTrigger(event, trigger)) {\n interaction.markCloseIntent()\n }\n }\n}\n\nfunction handleTooltipPointerMove(event: PointerEvent) {\n for (const interaction of openTooltipInteractions) {\n const trigger = interaction.trigger()\n const target = event.target\n if (\n interaction.isOpen() &&\n interaction.isTriggerFocused() &&\n trigger &&\n !(target instanceof Node && trigger.contains(target))\n ) {\n interaction.markPointerCloseIntent()\n }\n }\n}\n\nfunction setTooltipInteractionOpen(interaction: TooltipInteraction, open: boolean) {\n if (isServer) return\n\n if (open) {\n if (openTooltipInteractions.has(interaction)) return\n openTooltipInteractions.add(interaction)\n if (!tooltipScrollListenerAttached) {\n tooltipScrollListenerAttached = true\n // Register before Kobalte's global listeners so intentional scroll\n // dismissal can be distinguished from its delayed pointer dismissal.\n window.addEventListener('scroll', handleTooltipScroll, true)\n document.addEventListener('pointermove', handleTooltipPointerMove, true)\n }\n } else {\n openTooltipInteractions.delete(interaction)\n if (openTooltipInteractions.size === 0 && tooltipScrollListenerAttached) {\n tooltipScrollListenerAttached = false\n window.removeEventListener('scroll', handleTooltipScroll, true)\n document.removeEventListener('pointermove', handleTooltipPointerMove, true)\n }\n }\n}\n\nfunction registerTooltipInteraction(interaction: TooltipInteraction) {\n onCleanup(() => {\n setTooltipInteractionOpen(interaction, false)\n clearPendingTooltipOpen(interaction.id)\n })\n}\n\nfunction invokeEventHandler(handler: unknown, event: Event) {\n if (Array.isArray(handler)) {\n const [callback, data] = handler as [(data: unknown, event: Event) => void, unknown]\n callback(data, event)\n } else if (typeof handler === 'function') {\n const callback = handler as (event: Event) => void\n callback(event)\n }\n}\n\nexport type TooltipProviderProps = {\n children?: ComponentProps<'div'>['children']\n openDelay?: number\n closeDelay?: number\n skipDelayDuration?: number\n}\n\nexport function TooltipProvider(props: TooltipProviderProps) {\n return (\n <TooltipTimingContext.Provider\n value={{\n openDelay: props.openDelay ?? tooltipDefaults.openDelay,\n closeDelay: props.closeDelay ?? tooltipDefaults.closeDelay,\n skipDelayDuration: props.skipDelayDuration ?? tooltipDefaults.skipDelayDuration,\n }}\n >\n {props.children}\n </TooltipTimingContext.Provider>\n )\n}\n\nexport type TooltipRootProps = ComponentProps<typeof KobalteTooltip>\n\nexport function Tooltip(props: TooltipRootProps) {\n const timing = useContext(TooltipTimingContext)\n const [local, rest] = splitProps(props, ['open', 'defaultOpen', 'onOpenChange', 'disabled'])\n const id = createUniqueId()\n const controlled = () => local.open !== undefined\n const [uncontrolledOpen, setUncontrolledOpen] = createSignal(local.defaultOpen ?? false)\n const isOpen = () => (controlled() ? (local.open ?? false) : uncontrolledOpen())\n const [trigger, setTrigger] = createSignal<HTMLElement>()\n let closeIntent = false\n let ignoreDuplicateClose = false\n let onOpenChange: (next: boolean, source?: 'handoff') => void\n let pointerCloseIntentUntil = 0\n let pointerCloseIntentTimeout: ReturnType<typeof setTimeout> | undefined\n const clearPointerCloseIntent = () => {\n pointerCloseIntentUntil = 0\n if (pointerCloseIntentTimeout) clearTimeout(pointerCloseIntentTimeout)\n pointerCloseIntentTimeout = undefined\n }\n const markPointerCloseIntent = () => {\n if (!isOpen()) return\n clearPointerCloseIntent()\n const closeDelay = props.closeDelay ?? timing.closeDelay\n pointerCloseIntentUntil = Date.now() + closeDelay + 50\n pointerCloseIntentTimeout = setTimeout(clearPointerCloseIntent, closeDelay + 50)\n }\n const markCloseIntent = () => {\n closeIntent = true\n clearPointerCloseIntent()\n queueMicrotask(() => {\n closeIntent = false\n })\n }\n const requestCloseFromAnotherTooltip = () => {\n if (!isOpen()) return\n\n // Another trigger is an explicit handoff, even when a focused tooltip has\n // a pending pointer-close intent that would otherwise suppress Kobalte's\n // close callback. Route the request through the same controlled/uncontrolled\n // state contract as Kobalte and ignore its duplicate callback for this turn.\n ignoreDuplicateClose = true\n queueMicrotask(() => {\n ignoreDuplicateClose = false\n })\n onOpenChange(false, 'handoff')\n }\n const interaction: TooltipInteraction = {\n id,\n trigger,\n setTrigger,\n isOpen,\n isDisabled: () => local.disabled ?? false,\n isTriggerFocused: () =>\n Boolean(trigger() && typeof document !== 'undefined' && trigger() === document.activeElement),\n markOpenIntent: () => {\n clearPointerCloseIntent()\n pendingTooltipOpenId = id\n // A focused tooltip ignores ordinary pointer movement, but entering or\n // focusing another tooltip is an explicit transfer.\n for (const openInteraction of openTooltipInteractions) {\n if (openInteraction.id !== id) openInteraction.requestCloseFromAnotherTooltip()\n }\n },\n clearOpenIntent: () => clearPendingTooltipOpen(id),\n requestCloseFromAnotherTooltip,\n markPointerCloseIntent,\n clearPointerCloseIntent,\n markCloseIntent,\n }\n registerTooltipInteraction(interaction)\n onCleanup(() => {\n clearPointerCloseIntent()\n ignoreDuplicateClose = false\n })\n if (isOpen()) setTooltipInteractionOpen(interaction, true)\n createEffect(() => setTooltipInteractionOpen(interaction, isOpen()))\n onOpenChange = (next: boolean, source) => {\n if (!next && source !== 'handoff' && ignoreDuplicateClose) return\n\n if (next) {\n clearPendingTooltipOpen(id)\n clearPointerCloseIntent()\n // Install this capture listener before Kobalte's open-state effect adds\n // its scroll listener later in the same update.\n setTooltipInteractionOpen(interaction, true)\n } else {\n const focusedTrigger = interaction.isTriggerFocused()\n const anotherTooltipOpening =\n pendingTooltipOpenId !== undefined && pendingTooltipOpenId !== id\n const pointerClosePending = Date.now() <= pointerCloseIntentUntil\n if (\n source !== 'handoff' &&\n focusedTrigger &&\n pointerClosePending &&\n !closeIntent &&\n !anotherTooltipOpening\n ) {\n clearPointerCloseIntent()\n return\n }\n closeIntent = false\n clearPointerCloseIntent()\n clearPendingTooltipOpen(id)\n }\n\n if (!controlled()) setUncontrolledOpen(next)\n local.onOpenChange?.(next)\n if (next) {\n // A controlled parent can reject the open request without changing its\n // signal, so the effect above would not rerun to release this listener.\n queueMicrotask(() => {\n if (!isOpen()) setTooltipInteractionOpen(interaction, false)\n })\n }\n }\n\n // Kobalte dismisses on Escape only when its content owns the top-most\n // layer, and a handoff keeps the previous tooltip's content mounted while\n // it exits — swallowing the key for the tooltip that just took over.\n // Listening on document (capture) closes this tooltip first; the layer's\n // own handler still runs for anything stacked above it.\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key !== 'Escape') return\n markCloseIntent()\n onOpenChange(false)\n }\n createEffect(() => {\n if (isServer || !isOpen()) return\n document.addEventListener('keydown', handleKeyDown, true)\n onCleanup(() => document.removeEventListener('keydown', handleKeyDown, true))\n })\n\n return (\n <TooltipInteractionContext.Provider value={interaction}>\n <KobalteTooltip\n open={isOpen()}\n onOpenChange={onOpenChange}\n disabled={local.disabled}\n openDelay={props.openDelay ?? timing.openDelay}\n closeDelay={props.closeDelay ?? timing.closeDelay}\n skipDelayDuration={props.skipDelayDuration ?? timing.skipDelayDuration}\n {...rest}\n />\n </TooltipInteractionContext.Provider>\n )\n}\n\nexport function TooltipTrigger(props: ComponentProps<typeof KobalteTooltip.Trigger>) {\n const interaction = useContext(TooltipInteractionContext)\n const [local, rest] = splitProps(props, [\n 'ref',\n 'onFocus',\n 'onBlur',\n 'onPointerEnter',\n 'onPointerLeave',\n 'onClick',\n ])\n\n return (\n <KobalteTooltip.Trigger\n {...rest}\n ref={(element) => {\n interaction?.setTrigger(element)\n if (typeof local.ref === 'function') local.ref(element)\n }}\n onFocus={(event) => {\n invokeEventHandler(local.onFocus, event)\n if (!event.defaultPrevented && !interaction?.isDisabled()) interaction?.markOpenIntent()\n }}\n onBlur={(event) => {\n invokeEventHandler(local.onBlur, event)\n interaction?.clearOpenIntent()\n interaction?.markCloseIntent()\n }}\n onPointerEnter={(event) => {\n invokeEventHandler(local.onPointerEnter, event)\n if (!event.defaultPrevented && !interaction?.isDisabled()) interaction?.markOpenIntent()\n }}\n onPointerLeave={(event) => {\n invokeEventHandler(local.onPointerLeave, event)\n interaction?.clearOpenIntent()\n interaction?.markPointerCloseIntent()\n }}\n onClick={(event) => {\n invokeEventHandler(local.onClick, event)\n interaction?.markCloseIntent()\n }}\n />\n )\n}\n\nexport type TooltipContentProps = ComponentProps<typeof KobalteTooltip.Content>\n\nexport function TooltipContent(props: TooltipContentProps) {\n const interaction = useContext(TooltipInteractionContext)\n const [local, rest] = splitProps(props, [\n 'class',\n 'children',\n 'aria-hidden',\n 'onEscapeKeyDown',\n 'onPointerDownOutside',\n ])\n const context = useTooltipContext()\n\n // Kobalte keeps force-mounted and exiting content present after close. Hide\n // that retained tooltip from assistive technology until it opens again.\n return (\n <KobalteTooltip.Portal>\n <KobalteTooltip.Content\n /* The slot is what base.css's pointer-transparency rule keys on; every\n tip carries it, so no consumer has to remember to pass it. */\n data-slot=\"tooltip-content\"\n class={cn(\n tooltipTip,\n // The max width is a token, not a fixed measure: it has to fall\n // behind the viewport at large root font sizes or the tip — which\n // Kobalte can shift but never shrink — forces a horizontal scroll.\n 'z-(--z-tooltip) w-fit max-w-(--tooltip-max-width) px-2 py-1',\n 'origin-(--kb-tooltip-content-transform-origin) text-balance',\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 'data-expanded:duration-150 data-closed:duration-100',\n local.class\n )}\n // A tooltip is never interactive: the content is plain text, and the\n // placement draws the tip below its action — where a hit-testing tip\n // would hold the next control hostage, open or departing. Kobalte\n // inlines pointer-events auto, so this is forced after its merge; the\n // pointer belongs to the control underneath.\n style={{ 'pointer-events': 'none' }}\n aria-hidden={context.isOpen() ? local['aria-hidden'] : true}\n onEscapeKeyDown={(event) => {\n invokeEventHandler(local.onEscapeKeyDown, event)\n if (!event.defaultPrevented) interaction?.markCloseIntent()\n }}\n onPointerDownOutside={(event) => {\n invokeEventHandler(local.onPointerDownOutside, event)\n if (!event.defaultPrevented) interaction?.markCloseIntent()\n }}\n {...rest}\n >\n {local.children}\n </KobalteTooltip.Content>\n </KobalteTooltip.Portal>\n )\n}\n"],"mappings":";;;;;;AA8BA,IAAMkB,kBAAiC;;CAErCH,WAAW;;CAEXC,YAAY;;;;;;CAMZC,mBAAmB;AACrB;AAEA,IAAME,uBAAuBf,cAA6Bc,eAAe;AAiBzE,IAAMiB,4BAA4B/B,cAAkC;AACpE,IAAMgC,0CAA0B,IAAIC,IAAwB;AAC5D,IAAIC;AACJ,IAAIC,gCAAgC;AAEpC,SAASC,wBAAwBnB,IAAY;CAC3C,IAAIiB,yBAAyBjB,IAAIiB,uBAAuBG,KAAAA;AAC1D;AAEA,SAASC,6BAA6BC,OAAcrB,SAAsB;CACxE,MAAMuB,SAASF,MAAME;CACrB,OAAOA,WAAWC,UAAWD,kBAAkBE,QAAQF,OAAOG,SAAS1B,OAAO;AAChF;AAEA,SAAS2B,oBAAoBN,OAAc;CACzC,KAAK,MAAMO,eAAed,yBAAyB;EACjD,MAAMd,UAAU4B,YAAY5B,QAAQ;EACpC,IAAI4B,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iBnF,KAAK;IAC/C,IAAI,CAACA,MAAMqE,kBAAkB9D,aAAahB,gBAAgB;GAC5D;GACA6F,uBAAuBpF,UAAU;IAC/BoB,mBAAmBe,MAAMiD,sBAAsBpF,KAAK;IACpD,IAAI,CAACA,MAAMqE,kBAAkB9D,aAAahB,gBAAgB;GAC5D;EAAC,GACG6C,MAAI,EAAA,IAAAT,WAAA;GAAA,OAEPQ,MAAMR;EAAQ,EAAA,CAAA,CAAA;CAAA,EAAA,CAAA;AAIvB"}
|
|
1
|
+
{"version":3,"file":"tooltip.js","names":["Tooltip","KobalteTooltip","useTooltipContext","ComponentProps","JSX","createContext","createEffect","createSignal","createUniqueId","onCleanup","Show","splitProps","useContext","isServer","tooltipTip","topLayerProps","cn","TooltipTiming","openDelay","closeDelay","skipDelayDuration","tooltipDefaults","TooltipTimingContext","TooltipInteraction","id","trigger","HTMLElement","setTrigger","element","isOpen","isDisabled","isTriggerFocused","markOpenIntent","clearOpenIntent","requestCloseFromAnotherTooltip","markPointerCloseIntent","clearPointerCloseIntent","markCloseIntent","TooltipInteractionContext","openTooltipInteractions","Set","pendingTooltipOpenId","tooltipScrollListenerAttached","clearPendingTooltipOpen","undefined","tooltipScrollContainsTrigger","event","Event","target","window","Node","contains","handleTooltipScroll","interaction","handleTooltipPointerMove","PointerEvent","setTooltipInteractionOpen","open","has","add","addEventListener","document","delete","size","removeEventListener","registerTooltipInteraction","invokeEventHandler","handler","Array","isArray","callback","data","TooltipProviderProps","children","TooltipProvider","props","_$createComponent","Provider","value","TooltipRootProps","timing","local","rest","controlled","uncontrolledOpen","setUncontrolledOpen","defaultOpen","closeIntent","ignoreDuplicateClose","onOpenChange","next","source","pointerCloseIntentUntil","pointerCloseIntentTimeout","ReturnType","setTimeout","clearTimeout","Date","now","queueMicrotask","disabled","Boolean","activeElement","openInteraction","focusedTrigger","anotherTooltipOpening","pointerClosePending","handleKeyDown","KeyboardEvent","key","_$mergeProps","TooltipTrigger","Trigger","ref","onFocus","defaultPrevented","onBlur","onPointerEnter","onPointerLeave","onClick","TooltipContentProps","Content","icon","Element","TooltipContent","context","Portal","class","style","aria-hidden","_$memo","onEscapeKeyDown","onPointerDownOutside","when","_el$","_tmpl$","_$insert","_$createComponent","Tooltip","KobalteTooltip","_$mergeProps","_$memo"],"sources":["../../../../src/components/ui/tooltip/tooltip.tsx"],"sourcesContent":["import { Tooltip as KobalteTooltip, useTooltipContext } from '@kobalte/core/tooltip'\nimport type { ComponentProps, JSX } from 'solid-js'\nimport {\n createContext,\n createEffect,\n createSignal,\n createUniqueId,\n onCleanup,\n Show,\n splitProps,\n useContext,\n} from 'solid-js'\nimport { isServer } from 'solid-js/web'\nimport { tooltipTip, topLayerProps } from '#lib/overlay'\nimport { cn } from '#lib/utils'\n\n/**\n * The provider sets the *timing* defaults for every tooltip below it.\n *\n * Timing is the part of a tooltip that has to agree across an app: one that\n * opens in 200ms in a toolbar and 700ms in a sidebar reads as a bug. The\n * provider is where that agreement lives. It is optional — a tooltip outside a\n * provider falls back to the same defaults — so a consumer can drop it in\n * without restructuring anything.\n */\ntype TooltipTiming = {\n openDelay: number\n closeDelay: number\n skipDelayDuration: number\n}\n\nconst tooltipDefaults: TooltipTiming = {\n /** Long enough that a pointer crossing a toolbar does not strobe tooltips. */\n openDelay: 400,\n /** Short, because the pointer has already left the control. */\n closeDelay: 80,\n /**\n * After a tooltip has been seen, the next one opens immediately for this\n * long. This is what makes moving along a row of icons feel like one\n * gesture instead of four separate waits.\n */\n skipDelayDuration: 500,\n}\n\nconst TooltipTimingContext = createContext<TooltipTiming>(tooltipDefaults)\n\ntype TooltipInteraction = {\n id: string\n trigger: () => HTMLElement | undefined\n setTrigger: (element: HTMLElement) => void\n isOpen: () => boolean\n isDisabled: () => boolean\n isTriggerFocused: () => boolean\n markOpenIntent: () => void\n clearOpenIntent: () => void\n requestCloseFromAnotherTooltip: () => void\n markPointerCloseIntent: () => void\n clearPointerCloseIntent: () => void\n markCloseIntent: () => void\n}\n\nconst TooltipInteractionContext = createContext<TooltipInteraction>()\nconst openTooltipInteractions = new Set<TooltipInteraction>()\nlet pendingTooltipOpenId: string | undefined\nlet tooltipScrollListenerAttached = false\n\nfunction clearPendingTooltipOpen(id: string) {\n if (pendingTooltipOpenId === id) pendingTooltipOpenId = undefined\n}\n\nfunction tooltipScrollContainsTrigger(event: Event, trigger: HTMLElement) {\n const target = event.target\n return target === window || (target instanceof Node && target.contains(trigger))\n}\n\nfunction handleTooltipScroll(event: Event) {\n for (const interaction of openTooltipInteractions) {\n const trigger = interaction.trigger()\n if (interaction.isOpen() && trigger && tooltipScrollContainsTrigger(event, trigger)) {\n interaction.markCloseIntent()\n }\n }\n}\n\nfunction handleTooltipPointerMove(event: PointerEvent) {\n for (const interaction of openTooltipInteractions) {\n const trigger = interaction.trigger()\n const target = event.target\n if (\n interaction.isOpen() &&\n interaction.isTriggerFocused() &&\n trigger &&\n !(target instanceof Node && trigger.contains(target))\n ) {\n interaction.markPointerCloseIntent()\n }\n }\n}\n\nfunction setTooltipInteractionOpen(interaction: TooltipInteraction, open: boolean) {\n if (isServer) return\n\n if (open) {\n if (openTooltipInteractions.has(interaction)) return\n openTooltipInteractions.add(interaction)\n if (!tooltipScrollListenerAttached) {\n tooltipScrollListenerAttached = true\n // Register before Kobalte's global listeners so intentional scroll\n // dismissal can be distinguished from its delayed pointer dismissal.\n window.addEventListener('scroll', handleTooltipScroll, true)\n document.addEventListener('pointermove', handleTooltipPointerMove, true)\n }\n } else {\n openTooltipInteractions.delete(interaction)\n if (openTooltipInteractions.size === 0 && tooltipScrollListenerAttached) {\n tooltipScrollListenerAttached = false\n window.removeEventListener('scroll', handleTooltipScroll, true)\n document.removeEventListener('pointermove', handleTooltipPointerMove, true)\n }\n }\n}\n\nfunction registerTooltipInteraction(interaction: TooltipInteraction) {\n onCleanup(() => {\n setTooltipInteractionOpen(interaction, false)\n clearPendingTooltipOpen(interaction.id)\n })\n}\n\nfunction invokeEventHandler(handler: unknown, event: Event) {\n if (Array.isArray(handler)) {\n const [callback, data] = handler as [(data: unknown, event: Event) => void, unknown]\n callback(data, event)\n } else if (typeof handler === 'function') {\n const callback = handler as (event: Event) => void\n callback(event)\n }\n}\n\nexport type TooltipProviderProps = {\n children?: ComponentProps<'div'>['children']\n openDelay?: number\n closeDelay?: number\n skipDelayDuration?: number\n}\n\nexport function TooltipProvider(props: TooltipProviderProps) {\n return (\n <TooltipTimingContext.Provider\n value={{\n openDelay: props.openDelay ?? tooltipDefaults.openDelay,\n closeDelay: props.closeDelay ?? tooltipDefaults.closeDelay,\n skipDelayDuration: props.skipDelayDuration ?? tooltipDefaults.skipDelayDuration,\n }}\n >\n {props.children}\n </TooltipTimingContext.Provider>\n )\n}\n\nexport type TooltipRootProps = ComponentProps<typeof KobalteTooltip>\n\nexport function Tooltip(props: TooltipRootProps) {\n const timing = useContext(TooltipTimingContext)\n const [local, rest] = splitProps(props, ['open', 'defaultOpen', 'onOpenChange', 'disabled'])\n const id = createUniqueId()\n const controlled = () => local.open !== undefined\n const [uncontrolledOpen, setUncontrolledOpen] = createSignal(local.defaultOpen ?? false)\n const isOpen = () => (controlled() ? (local.open ?? false) : uncontrolledOpen())\n const [trigger, setTrigger] = createSignal<HTMLElement>()\n let closeIntent = false\n let ignoreDuplicateClose = false\n let onOpenChange: (next: boolean, source?: 'handoff') => void\n let pointerCloseIntentUntil = 0\n let pointerCloseIntentTimeout: ReturnType<typeof setTimeout> | undefined\n const clearPointerCloseIntent = () => {\n pointerCloseIntentUntil = 0\n if (pointerCloseIntentTimeout) clearTimeout(pointerCloseIntentTimeout)\n pointerCloseIntentTimeout = undefined\n }\n const markPointerCloseIntent = () => {\n if (!isOpen()) return\n clearPointerCloseIntent()\n const closeDelay = props.closeDelay ?? timing.closeDelay\n pointerCloseIntentUntil = Date.now() + closeDelay + 50\n pointerCloseIntentTimeout = setTimeout(clearPointerCloseIntent, closeDelay + 50)\n }\n const markCloseIntent = () => {\n closeIntent = true\n clearPointerCloseIntent()\n queueMicrotask(() => {\n closeIntent = false\n })\n }\n const requestCloseFromAnotherTooltip = () => {\n if (!isOpen()) return\n\n // Another trigger is an explicit handoff, even when a focused tooltip has\n // a pending pointer-close intent that would otherwise suppress Kobalte's\n // close callback. Route the request through the same controlled/uncontrolled\n // state contract as Kobalte and ignore its duplicate callback for this turn.\n ignoreDuplicateClose = true\n queueMicrotask(() => {\n ignoreDuplicateClose = false\n })\n onOpenChange(false, 'handoff')\n }\n const interaction: TooltipInteraction = {\n id,\n trigger,\n setTrigger,\n isOpen,\n isDisabled: () => local.disabled ?? false,\n isTriggerFocused: () =>\n Boolean(trigger() && typeof document !== 'undefined' && trigger() === document.activeElement),\n markOpenIntent: () => {\n clearPointerCloseIntent()\n pendingTooltipOpenId = id\n // A focused tooltip ignores ordinary pointer movement, but entering or\n // focusing another tooltip is an explicit transfer.\n for (const openInteraction of openTooltipInteractions) {\n if (openInteraction.id !== id) openInteraction.requestCloseFromAnotherTooltip()\n }\n },\n clearOpenIntent: () => clearPendingTooltipOpen(id),\n requestCloseFromAnotherTooltip,\n markPointerCloseIntent,\n clearPointerCloseIntent,\n markCloseIntent,\n }\n registerTooltipInteraction(interaction)\n onCleanup(() => {\n clearPointerCloseIntent()\n ignoreDuplicateClose = false\n })\n if (isOpen()) setTooltipInteractionOpen(interaction, true)\n createEffect(() => setTooltipInteractionOpen(interaction, isOpen()))\n onOpenChange = (next: boolean, source) => {\n if (!next && source !== 'handoff' && ignoreDuplicateClose) return\n\n if (next) {\n clearPendingTooltipOpen(id)\n clearPointerCloseIntent()\n // Install this capture listener before Kobalte's open-state effect adds\n // its scroll listener later in the same update.\n setTooltipInteractionOpen(interaction, true)\n } else {\n const focusedTrigger = interaction.isTriggerFocused()\n const anotherTooltipOpening =\n pendingTooltipOpenId !== undefined && pendingTooltipOpenId !== id\n const pointerClosePending = Date.now() <= pointerCloseIntentUntil\n if (\n source !== 'handoff' &&\n focusedTrigger &&\n pointerClosePending &&\n !closeIntent &&\n !anotherTooltipOpening\n ) {\n clearPointerCloseIntent()\n return\n }\n closeIntent = false\n clearPointerCloseIntent()\n clearPendingTooltipOpen(id)\n }\n\n if (!controlled()) setUncontrolledOpen(next)\n local.onOpenChange?.(next)\n if (next) {\n // A controlled parent can reject the open request without changing its\n // signal, so the effect above would not rerun to release this listener.\n queueMicrotask(() => {\n if (!isOpen()) setTooltipInteractionOpen(interaction, false)\n })\n }\n }\n\n // Kobalte dismisses on Escape only when its content owns the top-most\n // layer, and a handoff keeps the previous tooltip's content mounted while\n // it exits — swallowing the key for the tooltip that just took over.\n // Listening on document (capture) closes this tooltip first; the layer's\n // own handler still runs for anything stacked above it.\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key !== 'Escape') return\n markCloseIntent()\n onOpenChange(false)\n }\n createEffect(() => {\n if (isServer || !isOpen()) return\n document.addEventListener('keydown', handleKeyDown, true)\n onCleanup(() => document.removeEventListener('keydown', handleKeyDown, true))\n })\n\n return (\n <TooltipInteractionContext.Provider value={interaction}>\n <KobalteTooltip\n open={isOpen()}\n onOpenChange={onOpenChange}\n disabled={local.disabled}\n openDelay={props.openDelay ?? timing.openDelay}\n closeDelay={props.closeDelay ?? timing.closeDelay}\n skipDelayDuration={props.skipDelayDuration ?? timing.skipDelayDuration}\n {...rest}\n />\n </TooltipInteractionContext.Provider>\n )\n}\n\nexport function TooltipTrigger(props: ComponentProps<typeof KobalteTooltip.Trigger>) {\n const interaction = useContext(TooltipInteractionContext)\n const [local, rest] = splitProps(props, [\n 'ref',\n 'onFocus',\n 'onBlur',\n 'onPointerEnter',\n 'onPointerLeave',\n 'onClick',\n ])\n\n return (\n <KobalteTooltip.Trigger\n {...rest}\n ref={(element) => {\n interaction?.setTrigger(element)\n if (typeof local.ref === 'function') local.ref(element)\n }}\n onFocus={(event) => {\n invokeEventHandler(local.onFocus, event)\n if (!event.defaultPrevented && !interaction?.isDisabled()) interaction?.markOpenIntent()\n }}\n onBlur={(event) => {\n invokeEventHandler(local.onBlur, event)\n interaction?.clearOpenIntent()\n interaction?.markCloseIntent()\n }}\n onPointerEnter={(event) => {\n invokeEventHandler(local.onPointerEnter, event)\n if (!event.defaultPrevented && !interaction?.isDisabled()) interaction?.markOpenIntent()\n }}\n onPointerLeave={(event) => {\n invokeEventHandler(local.onPointerLeave, event)\n interaction?.clearOpenIntent()\n interaction?.markPointerCloseIntent()\n }}\n onClick={(event) => {\n invokeEventHandler(local.onClick, event)\n interaction?.markCloseIntent()\n }}\n />\n )\n}\n\nexport type TooltipContentProps = ComponentProps<typeof KobalteTooltip.Content> & {\n /**\n * A leading icon, repeating the trigger's glyph inside the tip — the side\n * rail's icon+label treatment, offered so a toolbar or rail tooltip does not\n * have to hand-roll it. Decorative by contract: the tip is `aria-hidden`\n * while closed and never the accessible name, so the icon must not be the\n * only carrier of meaning. Size it by leaving the svg bare; the slot fixes\n * it to the system's control size.\n */\n icon?: JSX.Element\n}\n\nexport function TooltipContent(props: TooltipContentProps) {\n const interaction = useContext(TooltipInteractionContext)\n const [local, rest] = splitProps(props, [\n 'class',\n 'children',\n 'icon',\n 'aria-hidden',\n 'onEscapeKeyDown',\n 'onPointerDownOutside',\n ])\n const context = useTooltipContext()\n\n // Kobalte keeps force-mounted and exiting content present after close. Hide\n // that retained tooltip from assistive technology until it opens again.\n return (\n <KobalteTooltip.Portal>\n <KobalteTooltip.Content\n /* The slot is what base.css's pointer-transparency rule keys on; every\n tip carries it, so no consumer has to remember to pass it. */\n data-slot=\"tooltip-content\"\n class={cn(\n tooltipTip,\n // The max width is a token, not a fixed measure: it has to fall\n // behind the viewport at large root font sizes or the tip — which\n // Kobalte can shift but never shrink — forces a horizontal scroll.\n 'z-(--z-tooltip) w-fit max-w-(--tooltip-max-width) px-2 py-1',\n 'origin-(--kb-tooltip-content-transform-origin) text-balance',\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 'data-expanded:duration-150 data-closed:duration-100',\n // An icon+label tip is one row that reads as a unit, so the label\n // never wraps under the glyph.\n { 'flex items-center gap-2 whitespace-nowrap': !!local.icon },\n local.class\n )}\n // A tooltip is never interactive: the content is plain text, and the\n // placement draws the tip below its action — where a hit-testing tip\n // would hold the next control hostage, open or departing. Kobalte\n // inlines pointer-events auto, so this is forced after its merge; the\n // pointer belongs to the control underneath.\n style={{ 'pointer-events': 'none' }}\n aria-hidden={context.isOpen() ? local['aria-hidden'] : true}\n onEscapeKeyDown={(event) => {\n invokeEventHandler(local.onEscapeKeyDown, event)\n if (!event.defaultPrevented) interaction?.markCloseIntent()\n }}\n onPointerDownOutside={(event) => {\n invokeEventHandler(local.onPointerDownOutside, event)\n if (!event.defaultPrevented) interaction?.markCloseIntent()\n }}\n // A tooltip opened from inside a modal dialog is part of that dialog's\n // surface, so it carries the same top-layer exemption as a menu or a\n // popover — without it the dialog's hide-outside observer aria-hides\n // the tip while it is on screen.\n {...topLayerProps}\n {...rest}\n >\n <Show when={local.icon}>\n {(icon) => (\n <span\n data-slot=\"tooltip-icon\"\n aria-hidden=\"true\"\n class=\"flex size-4 shrink-0 items-center justify-center [&_svg]:size-4\"\n >\n {icon()}\n </span>\n )}\n </Show>\n {local.children}\n </KobalteTooltip.Content>\n </KobalteTooltip.Portal>\n )\n}\n"],"mappings":";;;;;;;AA+BA,IAAMqB,kBAAiC;;CAErCH,WAAW;;CAEXC,YAAY;;;;;;CAMZC,mBAAmB;AACrB;AAEA,IAAME,uBAAuBjB,cAA6BgB,eAAe;AAiBzE,IAAMiB,4BAA4BjC,cAAkC;AACpE,IAAMkC,0CAA0B,IAAIC,IAAwB;AAC5D,IAAIC;AACJ,IAAIC,gCAAgC;AAEpC,SAASC,wBAAwBnB,IAAY;CAC3C,IAAIiB,yBAAyBjB,IAAIiB,uBAAuBG,KAAAA;AAC1D;AAEA,SAASC,6BAA6BC,OAAcrB,SAAsB;CACxE,MAAMuB,SAASF,MAAME;CACrB,OAAOA,WAAWC,UAAWD,kBAAkBE,QAAQF,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OAAO,EAAE,kBAAkB,OAAO;GAAC,KAAA,iBAAA;IAAA,OACtBE,WAAA,CAAA,CAAAL,QAAQhG,OAAO,CAAC,CAAA,CAAA,IAAGoD,MAAM,iBAAiB;GAAI;GAC3DkD,kBAAkBrF,UAAU;IAC1BoB,mBAAmBe,MAAMkD,iBAAiBrF,KAAK;IAC/C,IAAI,CAACA,MAAMqE,kBAAkB9D,aAAahB,gBAAgB;GAC5D;GACA+F,uBAAuBtF,UAAU;IAC/BoB,mBAAmBe,MAAMmD,sBAAsBtF,KAAK;IACpD,IAAI,CAACA,MAAMqE,kBAAkB9D,aAAahB,gBAAgB;GAC5D;EAAC,GAKGtB,eACAmE,MAAI,EAAA,IAAAT,WAAA;GAAA,OAAA,CAAAG,gBAEPlE,MAAI;IAAA,IAAC2H,OAAI;KAAA,OAAEpD,MAAMyC;IAAI;IAAAjD,WAClBiD,gBAAI;KAAA,IAAAY,OAAAC,OAAA;KAAAC,OAAAF,MAMDZ,IAAI;KAAA,OAAAY;IAAA,EAAA,CAAA;GAER,CAAA,GAAAJ,WAEFjD,MAAMR,QAAQ,CAAA;EAAA,EAAA,CAAA,CAAA;CAAA,EAAA,CAAA;AAIvB"}
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./component
|
|
|
20
20
|
import { Combobox, ComboboxClear, ComboboxContent, ComboboxControl, ComboboxInput, ComboboxItem, ComboboxSection, ComboboxTrigger } from "./components/ui/combobox/combobox.js";
|
|
21
21
|
import { ValueCombobox } from "./components/ui/combobox/value-combobox.js";
|
|
22
22
|
import { CodeBlock, InlineCode, TALL_CODE_BLOCK_PX } from "./components/ui/code-block/code-block.js";
|
|
23
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/ui/tooltip/tooltip.js";
|
|
23
24
|
import { Dialog, DialogClose, DialogCloseButton, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from "./components/ui/dialog/dialog.js";
|
|
24
25
|
import { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandLoading, CommandSeparator, CommandShortcut } from "./components/ui/command/command.js";
|
|
25
26
|
import { ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger } from "./components/ui/context-menu/context-menu.js";
|
|
@@ -30,7 +31,6 @@ import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMe
|
|
|
30
31
|
import { EntityIcon, entityIconVariants, monogram } from "./components/ui/entity-icon/entity-icon.js";
|
|
31
32
|
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "./components/ui/empty/empty.js";
|
|
32
33
|
import { Spinner } from "./components/ui/spinner/spinner.js";
|
|
33
|
-
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/ui/tooltip/tooltip.js";
|
|
34
34
|
import { ActionButton } from "./components/composites/action-button/action-button.js";
|
|
35
35
|
import { EmptyState } from "./components/ui/empty/empty-state.js";
|
|
36
36
|
import { Label } from "./components/ui/label/label.js";
|
|
@@ -103,7 +103,6 @@ import { accentPresets, allTokens, colorTokens, densityTokens, designTokens, ele
|
|
|
103
103
|
import { isThemeAccentId } from "./lib/theme-accents.js";
|
|
104
104
|
import { appearancePreviewThemes, builtinThemes, contrastRatio, defaultDarkThemeId, defaultLightThemeId, resolveAccentPreset, themeAccentsFor, themeById, themeCssVariables, themeFamilies, themeRecordById, themeRecords, themesForAppearance, validateTheme, validateThemeRegistry, withAccent } from "./lib/themes.js";
|
|
105
105
|
import { APPEARANCE_EDITOR_FONT_AXES, APPEARANCE_EDITOR_FONT_SIZE_MAX, APPEARANCE_EDITOR_FONT_SIZE_MIN, DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS, applyAppearanceFontSettings, fontSettingsBootstrapScript, normalizeAppearanceEditorFontSettings, normalizeAppearanceEditorFontSize } from "./lib/appearance-font-settings.js";
|
|
106
|
-
import { PalettePreview, ThemeMiniature, ThemeMiniatureSplit } from "./components/composites/appearance-editor/theme-preview.js";
|
|
107
106
|
import { AppearanceFontSettingsGroup } from "./components/composites/appearance-editor/font-settings-group.js";
|
|
108
107
|
import { ThemePicker, ThemePreview, ThemeSwatch } from "./components/theme/theme-picker.js";
|
|
109
108
|
import { ThemeProvider, defaultThemeSelection, inlineScriptLiteral, resolvedDensity, themeScript, useTheme } from "./components/theme/theme-provider.js";
|
|
@@ -122,6 +121,7 @@ import { SettingsNavigation } from "./components/composites/settings/settings-na
|
|
|
122
121
|
import { SettingsLayout } from "./components/composites/settings/settings-layout.js";
|
|
123
122
|
import { SceneControls } from "./components/composites/scene-controls/scene-controls.js";
|
|
124
123
|
import { PropertyList, PropertyRow, PropertyTerm, PropertyValue, Stat, StatGroup } from "./components/composites/stat/stat.js";
|
|
124
|
+
import { PalettePreview, ThemeMiniature, ThemeMiniatureSplit } from "./components/composites/appearance-editor/theme-preview.js";
|
|
125
125
|
import { AppearanceEditor, AppearanceEditorActions, AppearancePopover } from "./components/composites/appearance-editor/appearance-editor.js";
|
|
126
126
|
import { formatBytes, formatReleaseDate, plainTextFromMarkdown } from "./lib/version-notes.js";
|
|
127
127
|
import { UpdateDialog } from "./components/composites/update-dialog/update-dialog.js";
|
package/dist/lib/overlay.d.ts
CHANGED
|
@@ -9,8 +9,24 @@
|
|
|
9
9
|
* library would inherit all three. Declaring the surface once is what makes
|
|
10
10
|
* "an overlay looks like this" a fact rather than a convention.
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
import { type VariantProps } from '#lib/variants';
|
|
13
|
+
/** The panel itself: fill, hairline edge, radius, elevation. Menus, popovers
|
|
14
|
+
* and the command palette float on the elevated overlay rung (`--popover`). */
|
|
13
15
|
export declare const overlaySurface = "bg-popover text-popover-foreground rounded-xl border border-border shadow-lg";
|
|
16
|
+
/**
|
|
17
|
+
* The modal panel: the same hairline edge, radius and elevation, painted on the
|
|
18
|
+
* *neutral* theme surface instead of the elevated overlay rung.
|
|
19
|
+
*
|
|
20
|
+
* `--popover` is the catalogue's `surfaceElevated`, whose derivation amplifies
|
|
21
|
+
* the canvas hue's chroma on the elevated step. On the dark default's violet
|
|
22
|
+
* canvas that makes the dialog the most chromatic surface in the ladder —
|
|
23
|
+
* `oklch(0.2406 0.0088 300.91)`, red above green in sRGB — and on a full dialog
|
|
24
|
+
* panel that cast reads as a warm tint the canvas never has. shadcn's own
|
|
25
|
+
* convention already splits the two: a Dialog paints `bg-background`, menus and
|
|
26
|
+
* popovers paint `bg-popover`. The veil, the hairline and the elevation shadow
|
|
27
|
+
* carry the separation the lighter fill no longer provides.
|
|
28
|
+
*/
|
|
29
|
+
export declare const dialogSurface = "bg-background text-foreground rounded-xl border border-border shadow-lg";
|
|
14
30
|
/**
|
|
15
31
|
* Overlay titles have one fixed typography role. Keep this small recipe shared
|
|
16
32
|
* without loading the configurable Heading component into every dialog.
|
|
@@ -53,6 +69,19 @@ export declare const destructiveMenuItem = "border-s-2 border-destructive ps-1.5
|
|
|
53
69
|
export declare const menuLabel = "px-2 py-1.5 text-2xs font-medium tracking-wide text-muted-foreground uppercase";
|
|
54
70
|
/** The rule between menu groups. */
|
|
55
71
|
export declare const menuSeparator = "bg-border -mx-1 my-1 h-px";
|
|
72
|
+
/**
|
|
73
|
+
* A leading colour swatch on a menu or select row: the sanctioned way to carry
|
|
74
|
+
* a card-tone colour into a list of options. The tones are the system's accent
|
|
75
|
+
* and status roles — the vocabulary a Badge already speaks — so the colour an
|
|
76
|
+
* option shows in a menu is the colour its badge carries on a card, and a
|
|
77
|
+
* caller never passes a raw colour into a list. The dot is `aria-hidden`; the
|
|
78
|
+
* label carries the meaning, so a tone is never the only signal.
|
|
79
|
+
*/
|
|
80
|
+
export declare const menuSwatchTone: (props?: ({
|
|
81
|
+
tone?: "destructive" | "success" | "warning" | "info" | "neutral" | "primary" | null | undefined;
|
|
82
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
83
|
+
/** The tones a menu row's swatch can take. */
|
|
84
|
+
export type MenuSwatchTone = NonNullable<VariantProps<typeof menuSwatchTone>['tone']>;
|
|
56
85
|
/** Padding shared by every menu-list surface. */
|
|
57
86
|
export declare const menuContentPadding = "p-1";
|
|
58
87
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../src/lib/overlay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,
|
|
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;;;;;GAKG;AACH,eAAO,MAAM,UAAU,+FACuE,CAAA;AAE9F;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,QAIf,CAAA;AAEX;qCACqC;AACrC,eAAO,MAAM,aAAa,QAGf,CAAA;AAEX,+DAA+D;AAC/D,eAAO,MAAM,YAAY,+BAA+B,CAAA;AAExD;;;GAGG;AACH,eAAO,MAAM,QAAQ,QAOV,CAAA;AAEX,qFAAqF;AACrF,eAAO,MAAM,mBAAmB,kGACiE,CAAA;AAEjG,4CAA4C;AAC5C,eAAO,MAAM,SAAS,mFAC4D,CAAA;AAElF,oCAAoC;AACpC,eAAO,MAAM,aAAa,8BAA8B,CAAA;AAExD;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc;;8EAYzB,CAAA;AAEF,8CAA8C;AAC9C,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AAErF,iDAAiD;AACjD,eAAO,MAAM,kBAAkB,QAAQ,CAAA;AAEvC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa;;CAAuC,CAAA"}
|
package/dist/lib/overlay.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { cva } from "./variants.js";
|
|
1
2
|
//#region src/lib/overlay.ts
|
|
2
3
|
/**
|
|
3
4
|
* Shared strings for the overlay layer: dialogs, sheets, menus, popovers,
|
|
@@ -10,9 +11,24 @@
|
|
|
10
11
|
* library would inherit all three. Declaring the surface once is what makes
|
|
11
12
|
* "an overlay looks like this" a fact rather than a convention.
|
|
12
13
|
*/
|
|
13
|
-
/** The panel itself: fill, hairline edge, radius, elevation.
|
|
14
|
+
/** The panel itself: fill, hairline edge, radius, elevation. Menus, popovers
|
|
15
|
+
* and the command palette float on the elevated overlay rung (`--popover`). */
|
|
14
16
|
var overlaySurface = "bg-popover text-popover-foreground rounded-xl border border-border shadow-lg";
|
|
15
17
|
/**
|
|
18
|
+
* The modal panel: the same hairline edge, radius and elevation, painted on the
|
|
19
|
+
* *neutral* theme surface instead of the elevated overlay rung.
|
|
20
|
+
*
|
|
21
|
+
* `--popover` is the catalogue's `surfaceElevated`, whose derivation amplifies
|
|
22
|
+
* the canvas hue's chroma on the elevated step. On the dark default's violet
|
|
23
|
+
* canvas that makes the dialog the most chromatic surface in the ladder —
|
|
24
|
+
* `oklch(0.2406 0.0088 300.91)`, red above green in sRGB — and on a full dialog
|
|
25
|
+
* panel that cast reads as a warm tint the canvas never has. shadcn's own
|
|
26
|
+
* convention already splits the two: a Dialog paints `bg-background`, menus and
|
|
27
|
+
* popovers paint `bg-popover`. The veil, the hairline and the elevation shadow
|
|
28
|
+
* carry the separation the lighter fill no longer provides.
|
|
29
|
+
*/
|
|
30
|
+
var dialogSurface = "bg-background text-foreground rounded-xl border border-border shadow-lg";
|
|
31
|
+
/**
|
|
16
32
|
* Overlay titles have one fixed typography role. Keep this small recipe shared
|
|
17
33
|
* without loading the configurable Heading component into every dialog.
|
|
18
34
|
*/
|
|
@@ -66,6 +82,25 @@ var menuLabel = "px-2 py-1.5 text-2xs font-medium tracking-wide text-muted-foreg
|
|
|
66
82
|
/** The rule between menu groups. */
|
|
67
83
|
var menuSeparator = "bg-border -mx-1 my-1 h-px";
|
|
68
84
|
/**
|
|
85
|
+
* A leading colour swatch on a menu or select row: the sanctioned way to carry
|
|
86
|
+
* a card-tone colour into a list of options. The tones are the system's accent
|
|
87
|
+
* and status roles — the vocabulary a Badge already speaks — so the colour an
|
|
88
|
+
* option shows in a menu is the colour its badge carries on a card, and a
|
|
89
|
+
* caller never passes a raw colour into a list. The dot is `aria-hidden`; the
|
|
90
|
+
* label carries the meaning, so a tone is never the only signal.
|
|
91
|
+
*/
|
|
92
|
+
var menuSwatchTone = cva("size-2 shrink-0 rounded-full", {
|
|
93
|
+
variants: { tone: {
|
|
94
|
+
neutral: "bg-muted-foreground",
|
|
95
|
+
primary: "bg-primary",
|
|
96
|
+
success: "bg-success",
|
|
97
|
+
warning: "bg-warning",
|
|
98
|
+
destructive: "bg-destructive",
|
|
99
|
+
info: "bg-info"
|
|
100
|
+
} },
|
|
101
|
+
defaultVariants: { tone: "neutral" }
|
|
102
|
+
});
|
|
103
|
+
/**
|
|
69
104
|
* Marks a floating layer — a menu, a listbox, a popover — as part of the top
|
|
70
105
|
* layer.
|
|
71
106
|
*
|
|
@@ -79,6 +114,6 @@ var menuSeparator = "bg-border -mx-1 my-1 h-px";
|
|
|
79
114
|
*/
|
|
80
115
|
var topLayerProps = { "data-kb-top-layer": "" };
|
|
81
116
|
//#endregion
|
|
82
|
-
export { destructiveMenuItem, menuItem, menuLabel, menuSeparator, overlayMotion, overlayPositioner, overlayScrim, overlaySurface, overlayTitle, popoverArrow, popoverMotion, tooltipTip, topLayerProps };
|
|
117
|
+
export { destructiveMenuItem, dialogSurface, menuItem, menuLabel, menuSeparator, menuSwatchTone, overlayMotion, overlayPositioner, overlayScrim, overlaySurface, overlayTitle, popoverArrow, popoverMotion, tooltipTip, topLayerProps };
|
|
83
118
|
|
|
84
119
|
//# sourceMappingURL=overlay.js.map
|
package/dist/lib/overlay.js.map
CHANGED
|
@@ -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\n/** The panel itself: fill, hairline edge, radius, elevation. */\nexport const overlaySurface =\n 'bg-popover text-popover-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/**\n * The tip: the card-toned bubble an explanation shows in. The side rail draws\n * it flush to a collapsed row and every floating tooltip composes the same\n * fill, edge, and type, so a control never explains itself in two visual\n * languages.\n */\nexport const tooltipTip =\n 'bg-card text-card-foreground rounded-md border border-border text-sm font-medium shadow-lg'\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 overlayMotion = [\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 'data-expanded:duration-200 data-closed:duration-150',\n].join(' ')\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].join(' ')\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 */\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 [&_svg]:size-4',\n '[&_svg:not([class*=text-])]:text-muted-foreground',\n].join(' ')\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 rule between menu groups. */\nexport const menuSeparator = 'bg-border -mx-1 my-1 h-px'\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"],"mappings":"
|
|
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/**\n * The tip: the card-toned bubble an explanation shows in. The side rail draws\n * it flush to a collapsed row and every floating tooltip composes the same\n * fill, edge, and type, so a control never explains itself in two visual\n * languages.\n */\nexport const tooltipTip =\n 'bg-card text-card-foreground rounded-md border border-border text-sm font-medium shadow-lg'\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 overlayMotion = [\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 'data-expanded:duration-200 data-closed:duration-150',\n].join(' ')\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].join(' ')\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 */\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 [&_svg]:size-4',\n '[&_svg:not([class*=text-])]:text-muted-foreground',\n].join(' ')\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 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"],"mappings":";;;;;;;;;;;;;;;AAgBA,IAAa,iBACX;;;;;;;;;;;;;;AAeF,IAAa,gBACX;;;;;AAMF,IAAa,eAAe;;AAG5B,IAAa,oBAAoB;;AAGjC,IAAa,eACX;;;;;;;AAQF,IAAa,aACX;;;;;;;;;;AAWF,IAAa,gBAAgB;CAC3B;CACA;CACA;AACF,CAAC,CAAC,KAAK,GAAG;;;AAIV,IAAa,gBAAgB,CAC3B,mGACA,qDACF,CAAC,CAAC,KAAK,GAAG;;AAGV,IAAa,eAAe;;;;;AAM5B,IAAa,WAAW;CACtB;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,CAAC,KAAK,GAAG;;AAGV,IAAa,sBACX;;AAGF,IAAa,YACX;;AAGF,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;;;;;;;;;;;;;AAoBD,IAAa,gBAAgB,EAAE,qBAAqB,GAAG"}
|
package/dist/r/dialog.json
CHANGED
package/dist/r/registry.json
CHANGED
|
@@ -568,6 +568,7 @@
|
|
|
568
568
|
"lucide-solid@^1.51.0"
|
|
569
569
|
],
|
|
570
570
|
"registryDependencies": [
|
|
571
|
+
"@adea-ai/ui/tooltip",
|
|
571
572
|
"lib"
|
|
572
573
|
],
|
|
573
574
|
"files": [
|
|
@@ -1804,7 +1805,7 @@
|
|
|
1804
1805
|
"lucide-solid@^1.51.0"
|
|
1805
1806
|
],
|
|
1806
1807
|
"registryDependencies": [
|
|
1807
|
-
"@adea-ai/ui/button",
|
|
1808
|
+
"@adea-ai/ui/action-button",
|
|
1808
1809
|
"lib"
|
|
1809
1810
|
],
|
|
1810
1811
|
"files": [
|
package/dist/r/split-layout.json
CHANGED
|
@@ -22,11 +22,7 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
import { RadioGroup as Radio } from '@kobalte/core/radio-group'
|
|
25
|
-
import { For
|
|
26
|
-
import { cn } from '../../../lib/utils'
|
|
27
|
-
|
|
28
|
-
export const PRIMARY_ACCENT_IDS = ['blue', 'green', 'amber', 'cyan', 'pink'] as const
|
|
29
|
-
const primaryAccentIds: ReadonlySet<string> = new Set(PRIMARY_ACCENT_IDS)
|
|
25
|
+
import { For } from 'solid-js'
|
|
30
26
|
|
|
31
27
|
type AccentOption = Readonly<{
|
|
32
28
|
id: string
|
|
@@ -37,104 +33,55 @@ type AccentOption = Readonly<{
|
|
|
37
33
|
|
|
38
34
|
type AccentSwatchGroupsProps = {
|
|
39
35
|
accentOptions: readonly AccentOption[]
|
|
40
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Accepted for host compatibility and no longer rendered. The picker offers
|
|
38
|
+
* one theme-scoped group — the theme's own primary followed by the presets —
|
|
39
|
+
* instead of splitting additional presets and the theme pair's accent slots
|
|
40
|
+
* into labelled groups of their own. A stored theme-accent id still resolves
|
|
41
|
+
* (`resolveAccentPreset`) and is still described by the row; it is just no
|
|
42
|
+
* longer offered as a swatch, and a host can stop feeding this list.
|
|
43
|
+
*/
|
|
44
|
+
themeAccentOptions?: readonly AccentOption[]
|
|
41
45
|
resolvedAppearance: 'light' | 'dark'
|
|
42
46
|
themeDefaultColor: string
|
|
43
47
|
}
|
|
44
48
|
|
|
49
|
+
/**
|
|
50
|
+
* The accent choices, as ONE group: the theme's own primary first, then every
|
|
51
|
+
* preset the host feeds, each painted with its value for the resolved
|
|
52
|
+
* appearance — which is what makes the group theme-scoped rather than a
|
|
53
|
+
* catalogue table. The custom-color entry is the host's (`AccentChoices`
|
|
54
|
+
* renders it beside this grid), because whether a free-form colour is accepted
|
|
55
|
+
* is the host's validation to own.
|
|
56
|
+
*/
|
|
45
57
|
export function AccentSwatchGroups(props: AccentSwatchGroupsProps) {
|
|
46
|
-
const
|
|
47
|
-
PRIMARY_ACCENT_IDS.flatMap((id) => {
|
|
48
|
-
const option = props.accentOptions.find((candidate) => candidate.id === id)
|
|
49
|
-
return option ? [option] : []
|
|
50
|
-
})
|
|
51
|
-
const additionalAccents = () =>
|
|
52
|
-
props.accentOptions.filter(
|
|
53
|
-
(option) => option.id !== 'theme' && !primaryAccentIds.has(option.id)
|
|
54
|
-
)
|
|
58
|
+
const presets = () => props.accentOptions.filter((option) => option.id !== 'theme')
|
|
55
59
|
|
|
56
60
|
return (
|
|
57
|
-
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
label={option.label}
|
|
70
|
-
color={(props.resolvedAppearance === 'light' ? option.light : option.dark) ?? ''}
|
|
71
|
-
group="primary"
|
|
72
|
-
/>
|
|
73
|
-
)}
|
|
74
|
-
</For>
|
|
75
|
-
</div>
|
|
76
|
-
<Show when={additionalAccents().length > 0}>
|
|
77
|
-
<div class="flex flex-col gap-1">
|
|
78
|
-
<span class="text-xs font-medium text-muted-foreground">Additional colors</span>
|
|
79
|
-
<div class="flex flex-wrap gap-2">
|
|
80
|
-
<For each={additionalAccents()}>
|
|
81
|
-
{(option) => (
|
|
82
|
-
<AccentSwatch
|
|
83
|
-
id={option.id}
|
|
84
|
-
label={option.label}
|
|
85
|
-
color={(props.resolvedAppearance === 'light' ? option.light : option.dark) ?? ''}
|
|
86
|
-
group="additional"
|
|
87
|
-
/>
|
|
88
|
-
)}
|
|
89
|
-
</For>
|
|
90
|
-
</div>
|
|
91
|
-
</div>
|
|
92
|
-
</Show>
|
|
93
|
-
<Show when={props.themeAccentOptions.length > 0}>
|
|
94
|
-
<div class="flex flex-col gap-1">
|
|
95
|
-
<span class="text-xs font-medium text-muted-foreground">Theme accents</span>
|
|
96
|
-
<div class="grid grid-cols-3 gap-2">
|
|
97
|
-
<For each={props.themeAccentOptions}>
|
|
98
|
-
{(option) => (
|
|
99
|
-
<AccentSwatch
|
|
100
|
-
id={option.id}
|
|
101
|
-
label={'Theme ' + option.label.toLowerCase()}
|
|
102
|
-
color={(props.resolvedAppearance === 'light' ? option.light : option.dark) ?? ''}
|
|
103
|
-
group="theme"
|
|
104
|
-
dashed
|
|
105
|
-
/>
|
|
106
|
-
)}
|
|
107
|
-
</For>
|
|
108
|
-
</div>
|
|
109
|
-
</div>
|
|
110
|
-
</Show>
|
|
111
|
-
</>
|
|
61
|
+
<div class="grid grid-cols-4 gap-2" data-accent-grid>
|
|
62
|
+
<AccentSwatch id="theme" label="Theme default" color={props.themeDefaultColor} />
|
|
63
|
+
<For each={presets()}>
|
|
64
|
+
{(option) => (
|
|
65
|
+
<AccentSwatch
|
|
66
|
+
id={option.id}
|
|
67
|
+
label={option.label}
|
|
68
|
+
color={(props.resolvedAppearance === 'light' ? option.light : option.dark) ?? ''}
|
|
69
|
+
/>
|
|
70
|
+
)}
|
|
71
|
+
</For>
|
|
72
|
+
</div>
|
|
112
73
|
)
|
|
113
74
|
}
|
|
114
75
|
|
|
115
|
-
function AccentSwatch(props: {
|
|
116
|
-
id: string
|
|
117
|
-
label: string
|
|
118
|
-
color: string
|
|
119
|
-
group: 'primary' | 'additional' | 'theme'
|
|
120
|
-
dashed?: boolean
|
|
121
|
-
}) {
|
|
76
|
+
function AccentSwatch(props: { id: string; label: string; color: string }) {
|
|
122
77
|
return (
|
|
123
78
|
<Radio.Item
|
|
124
79
|
value={props.id}
|
|
125
80
|
data-accent-option={props.id}
|
|
126
|
-
data-primary-accent={props.group === 'primary' ? props.id : undefined}
|
|
127
|
-
data-additional-accent={props.group === 'additional' ? props.id : undefined}
|
|
128
|
-
data-theme-accent={props.group === 'theme' ? props.id : undefined}
|
|
129
81
|
class="rounded-full focus-within:ring-3 focus-within:ring-ring/50"
|
|
130
82
|
>
|
|
131
83
|
<Radio.ItemInput />
|
|
132
|
-
<Radio.ItemLabel
|
|
133
|
-
class={cn(
|
|
134
|
-
'block size-7 cursor-pointer rounded-full border p-0.5 data-[checked]:border-primary data-[checked]:ring-1 data-[checked]:ring-primary',
|
|
135
|
-
{ 'border-dashed data-[checked]:border-solid': props.dashed }
|
|
136
|
-
)}
|
|
137
|
-
>
|
|
84
|
+
<Radio.ItemLabel class="block size-7 cursor-pointer rounded-full border p-0.5 data-[checked]:border-primary data-[checked]:ring-1 data-[checked]:ring-primary">
|
|
138
85
|
<span
|
|
139
86
|
class="block size-full rounded-full"
|
|
140
87
|
aria-hidden="true"
|
|
@@ -104,8 +104,6 @@ export function AccentChoices(props: AppearanceEditorProps) {
|
|
|
104
104
|
// user will see it.
|
|
105
105
|
const resolvedAppearance = () =>
|
|
106
106
|
props.draft.mode === 'system' ? props.resolvedAppearance : props.draft.mode
|
|
107
|
-
// The accents the previewed theme pair carries, offered after the presets.
|
|
108
|
-
const themeAccents = () => props.themeAccentOptions ?? []
|
|
109
107
|
const accentSelection = () => (isCustomAccent(props) ? 'custom' : props.draft.accent)
|
|
110
108
|
return (
|
|
111
109
|
<Radio
|
|
@@ -122,7 +120,6 @@ export function AccentChoices(props: AppearanceEditorProps) {
|
|
|
122
120
|
>
|
|
123
121
|
<AccentSwatchGroups
|
|
124
122
|
accentOptions={props.accentOptions}
|
|
125
|
-
themeAccentOptions={themeAccents()}
|
|
126
123
|
resolvedAppearance={resolvedAppearance()}
|
|
127
124
|
themeDefaultColor={
|
|
128
125
|
resolvedAppearance() === 'light'
|