@kumix/ui 0.3.4 → 0.3.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.
Files changed (62) hide show
  1. package/dist/components/agents/agent-activity/activity-row.d.ts +1 -1
  2. package/dist/components/agents/agent-activity/index.d.ts +2 -2
  3. package/dist/components/agents/agent-activity/index.d.ts.map +1 -1
  4. package/dist/components/agents/agent-activity/index.js +9 -3
  5. package/dist/components/agents/agent-activity/index.js.map +1 -1
  6. package/dist/components/agents/loading-states/reasoning-text.d.ts.map +1 -1
  7. package/dist/components/agents/loading-states/reasoning-text.js +7 -39
  8. package/dist/components/agents/loading-states/reasoning-text.js.map +1 -1
  9. package/dist/components/motion/combobox/content.d.ts +16 -0
  10. package/dist/components/motion/combobox/content.d.ts.map +1 -0
  11. package/dist/components/motion/combobox/content.js +91 -0
  12. package/dist/components/motion/combobox/content.js.map +1 -0
  13. package/dist/components/motion/combobox/context.d.ts +63 -0
  14. package/dist/components/motion/combobox/context.d.ts.map +1 -0
  15. package/dist/components/motion/combobox/context.js +235 -0
  16. package/dist/components/motion/combobox/context.js.map +1 -0
  17. package/dist/components/motion/combobox/list.d.ts +40 -0
  18. package/dist/components/motion/combobox/list.d.ts.map +1 -0
  19. package/dist/components/motion/combobox/list.js +143 -0
  20. package/dist/components/motion/combobox/list.js.map +1 -0
  21. package/dist/components/motion/combobox/trigger.d.ts +21 -0
  22. package/dist/components/motion/combobox/trigger.d.ts.map +1 -0
  23. package/dist/components/motion/combobox/trigger.js +115 -0
  24. package/dist/components/motion/combobox/trigger.js.map +1 -0
  25. package/dist/components/motion/combobox.d.ts +5 -0
  26. package/dist/components/motion/combobox.js +6 -0
  27. package/dist/components/motion/popover.d.ts.map +1 -1
  28. package/dist/components/motion/popover.js +22 -25
  29. package/dist/components/motion/popover.js.map +1 -1
  30. package/dist/components/motion/text-scramble.d.ts +17 -0
  31. package/dist/components/motion/text-scramble.d.ts.map +1 -0
  32. package/dist/components/motion/text-scramble.js +64 -0
  33. package/dist/components/motion/text-scramble.js.map +1 -0
  34. package/dist/components/reui/alert.d.ts +1 -1
  35. package/dist/components/reui/autocomplete.d.ts +1 -1
  36. package/dist/components/reui/badge.d.ts +2 -2
  37. package/dist/components/reui/data-grid/data-grid-column-filter.js +2 -2
  38. package/dist/components/reui/date-selector.js +1 -1
  39. package/dist/components/reui/event-calendar/event-calendar-month-view.js +1 -1
  40. package/dist/components/reui/event-calendar/event-calendar-nav.js +1 -1
  41. package/dist/components/reui/filters.js +3 -3
  42. package/dist/components/reui/frame.d.ts +1 -1
  43. package/dist/components/reui/gantt/gantt-bar.js +1 -1
  44. package/dist/components/reui/gantt/gantt-nav.js +1 -1
  45. package/dist/components/reui/gantt/gantt-view.js +3 -3
  46. package/dist/components/reui/icon-tile.d.ts +2 -2
  47. package/dist/components/reui/number-field.d.ts +3 -3
  48. package/dist/components/reui/phone-input.js +1 -1
  49. package/dist/components/reui/rating.d.ts +1 -1
  50. package/dist/components/ui/attachment.d.ts +2 -2
  51. package/dist/components/ui/badge.d.ts +1 -1
  52. package/dist/components/ui/button-group.d.ts +1 -1
  53. package/dist/components/ui/button.d.ts +2 -2
  54. package/dist/components/ui/field.d.ts +1 -1
  55. package/dist/components/ui/item.d.ts +2 -2
  56. package/dist/components/ui/marker.d.ts +1 -1
  57. package/dist/components/ui/sidebar.d.ts +1 -1
  58. package/dist/components/ui/sidebar.js +2 -2
  59. package/dist/components/ui/toggle.d.ts +1 -1
  60. package/dist/{types-j36vVGtZ.d.ts → types-kSZH1k8K.d.ts} +11 -1
  61. package/dist/{types-j36vVGtZ.d.ts.map → types-kSZH1k8K.d.ts.map} +1 -1
  62. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"popover.d.ts","names":[],"sources":["../../../src/components/motion/popover.tsx"],"mappings":";;KA8BK;KACA;KACA;UA+IY;EACf,UAAU;;EAEV;;EAEA;EACA,gBAAgB;;EAEhB,UAAU;;EAEV,OAAO;;EAEP,QAAQ;;EAER;;EAEA;;EAEA;EACA;;iBAGc,UACd,UACA,MAAM,gBACN,aACA,cACA,SACA,MACA,OACA,YACA,aACA,aACA,aACC,+BAAY,IAAA;UA0IE;;EAEf,UAAU;;iBAGI,iBAAiB,YAAY,sBAAmB,aAAA,kDAAA;UA2C/C;EACf,UAAU;EACV;;iBAGc,iBAAiB,UAAU,aAAa,sCAAmB"}
1
+ {"version":3,"file":"popover.d.ts","names":[],"sources":["../../../src/components/motion/popover.tsx"],"mappings":";;KA8BK;KACA;KACA;UA8KY;EACf,UAAU;;EAEV;;EAEA;EACA,gBAAgB;;EAEhB,UAAU;;EAEV,OAAO;;EAEP,QAAQ;;EAER;;EAEA;;EAEA;EACA;;iBAGc,UACd,UACA,MAAM,gBACN,aACA,cACA,SACA,MACA,OACA,YACA,aACA,aACA,aACC,+BAAY,IAAA;UA0IE;;EAEf,UAAU;;iBAGI,iBAAiB,YAAY,sBAAmB,aAAA,kDAAA;UA2C/C;EACf,UAAU;EACV;;iBAGc,iBAAiB,UAAU,aAAa,sCAAmB"}
@@ -76,6 +76,25 @@ function clipForProgress(geo, progress, supportsShape) {
76
76
  const rect = rectAtProgress(geo, progress);
77
77
  return supportsShape ? roundedRectShape(rect) : insetFor(rect, geo.layerW, geo.layerH);
78
78
  }
79
+ function roundedRectPath(rect) {
80
+ const radius = Math.max(0, Math.min(rect.r, rect.w / 2, rect.h / 2));
81
+ const n = (value) => value.toFixed(3);
82
+ const x1 = rect.x;
83
+ const y1 = rect.y;
84
+ const x2 = rect.x + rect.w;
85
+ const y2 = rect.y + rect.h;
86
+ const arc = `A${n(radius)} ${n(radius)} 0 0 1`;
87
+ return `M${n(x1 + radius)} ${n(y1)}H${n(x2 - radius)}${arc} ${n(x2)} ${n(y1 + radius)}V${n(y2 - radius)}${arc} ${n(x2 - radius)} ${n(y2)}H${n(x1 + radius)}${arc} ${n(x1)} ${n(y2 - radius)}V${n(y1 + radius)}${arc} ${n(x1 + radius)} ${n(y1)}Z`;
88
+ }
89
+ function triggerCutout(geo) {
90
+ return `path(evenodd, "${roundedRectPath({
91
+ x: 0,
92
+ y: 0,
93
+ w: geo.layerW,
94
+ h: geo.layerH,
95
+ r: 0
96
+ })} ${roundedRectPath(geo.trigger)}")`;
97
+ }
79
98
  const PopoverContext = createContext(null);
80
99
  function usePopoverContext(component) {
81
100
  const ctx = useContext(PopoverContext);
@@ -264,7 +283,6 @@ function PopoverContent({ children, className }) {
264
283
  onMouseEnter: openHover,
265
284
  onMouseLeave: scheduleClose
266
285
  } : {};
267
- const maskId = `${gooId}-trigger-cutout`;
268
286
  if (!portalReady) return null;
269
287
  return createPortal(/* @__PURE__ */ jsxs("div", {
270
288
  "data-popover-portal": "",
@@ -279,7 +297,7 @@ function PopoverContent({ children, className }) {
279
297
  width: "0",
280
298
  height: "0",
281
299
  className: "absolute",
282
- children: [/* @__PURE__ */ jsx("title", { children: "Popover visual effects" }), /* @__PURE__ */ jsxs("defs", { children: [/* @__PURE__ */ jsxs("filter", {
300
+ children: [/* @__PURE__ */ jsx("title", { children: "Popover visual effects" }), /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("filter", {
283
301
  id: gooId,
284
302
  x: "-50%",
285
303
  y: "-50%",
@@ -303,27 +321,7 @@ function PopoverContent({ children, className }) {
303
321
  operator: "atop"
304
322
  })
305
323
  ]
306
- }), /* @__PURE__ */ jsxs("mask", {
307
- id: maskId,
308
- maskUnits: "userSpaceOnUse",
309
- maskContentUnits: "userSpaceOnUse",
310
- x: 0,
311
- y: 0,
312
- width: geo.layerW,
313
- height: geo.layerH,
314
- children: [/* @__PURE__ */ jsx("rect", {
315
- width: geo.layerW,
316
- height: geo.layerH,
317
- fill: "white"
318
- }), /* @__PURE__ */ jsx("rect", {
319
- x: geo.trigger.x,
320
- y: geo.trigger.y,
321
- width: geo.trigger.w,
322
- height: geo.trigger.h,
323
- rx: geo.trigger.r,
324
- fill: "black"
325
- })]
326
- })] })]
324
+ }) })]
327
325
  }),
328
326
  /* @__PURE__ */ jsxs("div", {
329
327
  "aria-hidden": true,
@@ -334,8 +332,7 @@ function PopoverContent({ children, className }) {
334
332
  width: geo.layerW,
335
333
  height: geo.layerH,
336
334
  filter: reduce ? void 0 : `url(#${gooId})`,
337
- mask: `url(#${maskId})`,
338
- WebkitMask: `url(#${maskId})`
335
+ clipPath: triggerCutout(geo)
339
336
  },
340
337
  children: [/* @__PURE__ */ jsx("div", {
341
338
  className: "absolute bg-popover",
@@ -1 +1 @@
1
- {"version":3,"file":"popover.js","names":[],"sources":["../../../src/components/motion/popover.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n cloneElement,\n createContext,\n isValidElement,\n type ReactElement,\n type ReactNode,\n type Ref,\n useCallback,\n useContext,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport {\n animate,\n type MotionValue,\n useMotionValue,\n useMotionValueEvent,\n useReducedMotion,\n} from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { usePopoverPortalPosition } from \"./popover-position\";\n\ntype Side = \"top\" | \"bottom\";\ntype Align = \"start\" | \"center\" | \"end\";\ntype TriggerMode = \"click\" | \"hover\";\n\n// This morph needs less bounce than layout motion: too much overshoot makes\n// the liquid neck balloon past the final panel edges.\nconst GOO_OPEN_SPRING = {\n type: \"spring\",\n visualDuration: 0.3,\n bounce: 0.15,\n} as const;\nconst GOO_CLOSE_SPRING = {\n type: \"spring\",\n visualDuration: 0.21,\n bounce: 0.15,\n} as const;\nconst HOVER_CLOSE_DELAY = 120;\nconst CIRCLE_KAPPA = 0.5523;\n\nconst lerp = (a: number, b: number, t: number) => a + (b - a) * t;\n\ninterface Rect {\n x: number;\n y: number;\n w: number;\n h: number;\n r: number;\n}\ninterface Geo {\n layerW: number;\n layerH: number;\n left: number;\n top: number;\n trigger: Rect;\n panel: Rect;\n}\n\n// Trigger rect and panel rect in a shared local coordinate box.\nfunction buildGeo(\n tW: number,\n tH: number,\n cW: number,\n cH: number,\n side: Side,\n align: Align,\n gap: number,\n panelRadius: number,\n): Geo {\n const py = side === \"bottom\" ? tH + gap : -(gap + cH);\n const px = align === \"start\" ? 0 : align === \"end\" ? tW - cW : (tW - cW) / 2;\n\n const left = Math.min(0, px);\n const top = Math.min(0, py);\n const layerW = Math.max(tW, px + cW) - left;\n const layerH = Math.max(tH, py + cH) - top;\n\n const triggerRadius = Math.min(tH / 2, panelRadius);\n\n return {\n layerW,\n layerH,\n left,\n top,\n trigger: { x: -left, y: -top, w: tW, h: tH, r: triggerRadius },\n panel: { x: px - left, y: py - top, w: cW, h: cH, r: panelRadius },\n };\n}\n\nfunction rectAtProgress(geo: Geo, progress: number): Rect {\n const trigger = geo.trigger;\n const panel = geo.panel;\n\n return {\n x: lerp(trigger.x, panel.x, progress),\n y: lerp(trigger.y, panel.y, progress),\n w: lerp(trigger.w, panel.w, progress),\n h: lerp(trigger.h, panel.h, progress),\n r: lerp(trigger.r, panel.r, progress),\n };\n}\n\nfunction insetFor(rect: Rect, layerW: number, layerH: number) {\n const top = rect.y;\n const right = layerW - (rect.x + rect.w);\n const bottom = layerH - (rect.y + rect.h);\n const left = rect.x;\n return `inset(${top}px ${right}px ${bottom}px ${left}px round ${rect.r}px)`;\n}\n\nfunction roundedRectShape(rect: Rect) {\n const radius = Math.max(0, Math.min(rect.r, rect.w / 2, rect.h / 2));\n const control = radius * CIRCLE_KAPPA;\n const x1 = rect.x;\n const y1 = rect.y;\n const x2 = rect.x + rect.w;\n const y2 = rect.y + rect.h;\n const px = (value: number) => `${value.toFixed(3)}px`;\n\n return (\n `shape(from ${px(x1 + radius)} ${px(y1)}, ` +\n `line to ${px(x2 - radius)} ${px(y1)}, ` +\n `curve to ${px(x2)} ${px(y1 + radius)} with ${px(x2 - radius + control)} ${px(y1)} / ${px(x2)} ${px(y1 + radius - control)}, ` +\n `line to ${px(x2)} ${px(y2 - radius)}, ` +\n `curve to ${px(x2 - radius)} ${px(y2)} with ${px(x2)} ${px(y2 - radius + control)} / ${px(x2 - radius + control)} ${px(y2)}, ` +\n `line to ${px(x1 + radius)} ${px(y2)}, ` +\n `curve to ${px(x1)} ${px(y2 - radius)} with ${px(x1 + radius - control)} ${px(y2)} / ${px(x1)} ${px(y2 - radius + control)}, ` +\n `line to ${px(x1)} ${px(y1 + radius)}, ` +\n `curve to ${px(x1 + radius)} ${px(y1)} with ${px(x1)} ${px(y1 + radius - control)} / ${px(x1 + radius - control)} ${px(y1)}, ` +\n \"close)\"\n );\n}\n\nfunction clipForProgress(geo: Geo, progress: number, supportsShape: boolean) {\n const rect = rectAtProgress(geo, progress);\n return supportsShape ? roundedRectShape(rect) : insetFor(rect, geo.layerW, geo.layerH);\n}\n\ninterface PopoverContextValue {\n open: boolean;\n setOpen: (open: boolean) => void;\n toggle: () => void;\n openHover: () => void;\n scheduleClose: () => void;\n triggerMode: TriggerMode;\n side: Side;\n align: Align;\n gap: number;\n panelRadius: number;\n gooStrength: number;\n reduce: boolean;\n gooId: string;\n contentId: string;\n progress: MotionValue<number>;\n triggerRef: React.MutableRefObject<HTMLElement | null>;\n contentRef: React.MutableRefObject<HTMLDivElement | null>;\n}\n\nconst PopoverContext = createContext<PopoverContextValue | null>(null);\n\nfunction usePopoverContext(component: string) {\n const ctx = useContext(PopoverContext);\n if (!ctx) throw new Error(`${component} must be used within <Popover>`);\n return ctx;\n}\n\nexport interface PopoverProps {\n children: ReactNode;\n /** Controlled open state. */\n open?: boolean;\n /** Uncontrolled initial open state. */\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n /** How the popover is summoned. Default \"click\". */\n trigger?: TriggerMode;\n /** Which side of the trigger the panel oozes out of. Default \"bottom\". */\n side?: Side;\n /** Alignment along the trigger's edge. Default \"center\". */\n align?: Align;\n /** Gap between trigger and panel, in px — the length of the gooey neck. Default 14. */\n sideOffset?: number;\n /** Corner radius of the open panel, in px. Default 16. */\n panelRadius?: number;\n /** Blur radius feeding the goo filter — higher melts more. Default 8. */\n gooStrength?: number;\n className?: string;\n}\n\nexport function Popover({\n children,\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n trigger = \"click\",\n side = \"bottom\",\n align = \"center\",\n sideOffset = 14,\n panelRadius = 16,\n gooStrength = 8,\n className,\n}: PopoverProps) {\n const reduce = useReducedMotion() ?? false;\n const gooId = useId().replace(/:/g, \"\");\n const contentId = useId();\n const rootRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n const closeTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const progress = useMotionValue(defaultOpen ? 1 : 0);\n\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const controlled = controlledOpen !== undefined;\n const open = controlled ? controlledOpen : internalOpen;\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (!controlled) setInternalOpen(next);\n onOpenChange?.(next);\n },\n [controlled, onOpenChange],\n );\n\n const cancelClose = useCallback(() => {\n if (closeTimer.current) {\n clearTimeout(closeTimer.current);\n closeTimer.current = null;\n }\n }, []);\n\n const openHover = useCallback(() => {\n cancelClose();\n setOpen(true);\n }, [cancelClose, setOpen]);\n\n const scheduleClose = useCallback(() => {\n cancelClose();\n closeTimer.current = setTimeout(() => setOpen(false), HOVER_CLOSE_DELAY);\n }, [cancelClose, setOpen]);\n\n const toggle = useCallback(() => setOpen(!open), [setOpen, open]);\n\n useEffect(() => () => cancelClose(), [cancelClose]);\n\n useEffect(() => {\n const animation = animate(\n progress,\n open ? 1 : 0,\n reduce ? { duration: 0 } : open ? GOO_OPEN_SPRING : GOO_CLOSE_SPRING,\n );\n return () => animation.stop();\n }, [open, progress, reduce]);\n\n useEffect(() => {\n if (!open) return;\n const onKey = (e: KeyboardEvent) => e.key === \"Escape\" && setOpen(false);\n // The panel is portalled, so both trees participate in outside detection.\n const onPointer = (e: PointerEvent) => {\n const target = e.target as Node;\n if (\n rootRef.current &&\n !rootRef.current.contains(target) &&\n !contentRef.current?.contains(target)\n )\n setOpen(false);\n };\n window.addEventListener(\"keydown\", onKey);\n if (trigger === \"click\") window.addEventListener(\"pointerdown\", onPointer);\n return () => {\n window.removeEventListener(\"keydown\", onKey);\n window.removeEventListener(\"pointerdown\", onPointer);\n };\n }, [open, setOpen, trigger]);\n\n const ctx = useMemo<PopoverContextValue>(\n () => ({\n open,\n setOpen,\n toggle,\n openHover,\n scheduleClose,\n triggerMode: trigger,\n side,\n align,\n gap: sideOffset,\n panelRadius,\n gooStrength,\n reduce,\n gooId,\n contentId,\n progress,\n triggerRef,\n contentRef,\n }),\n [\n open,\n setOpen,\n toggle,\n openHover,\n scheduleClose,\n trigger,\n side,\n align,\n sideOffset,\n panelRadius,\n gooStrength,\n reduce,\n gooId,\n contentId,\n progress,\n ],\n );\n\n const hoverHandlers =\n trigger === \"hover\" ? { onMouseEnter: openHover, onMouseLeave: scheduleClose } : {};\n\n return (\n <PopoverContext.Provider value={ctx}>\n <div\n ref={rootRef}\n className={cn(\"relative isolate inline-flex\", className)}\n {...hoverHandlers}\n >\n {children}\n </div>\n </PopoverContext.Provider>\n );\n}\n\nfunction mergeRefs<T>(...refs: Array<Ref<T> | undefined>) {\n return (node: T | null) => {\n for (const ref of refs) {\n if (typeof ref === \"function\") ref(node);\n else if (ref && typeof ref === \"object\")\n (ref as React.MutableRefObject<T | null>).current = node;\n }\n };\n}\n\nexport interface PopoverTriggerProps {\n /** A single focusable element (e.g. a Button) that opens the popover. */\n children: ReactElement;\n}\n\nexport function PopoverTrigger({ children }: PopoverTriggerProps) {\n const ctx = usePopoverContext(\"PopoverTrigger\");\n\n if (!isValidElement(children)) return children;\n\n const child = children as ReactElement<Record<string, unknown>>;\n const childProps = child.props;\n const childRef = (childProps as { ref?: Ref<HTMLElement> }).ref;\n\n const compose =\n (name: string, handler: () => void) => (event: { defaultPrevented?: boolean }) => {\n (childProps[name] as ((e: unknown) => void) | undefined)?.(event);\n if (!event.defaultPrevented) handler();\n };\n\n const handlers: Record<string, unknown> =\n ctx.triggerMode === \"hover\"\n ? {\n onFocus: compose(\"onFocus\", ctx.openHover),\n onBlur: compose(\"onBlur\", ctx.scheduleClose),\n }\n : { onClick: compose(\"onClick\", ctx.toggle) };\n\n return cloneElement(child, {\n ...handlers,\n ref: mergeRefs(childRef, (node: HTMLElement | null) => {\n ctx.triggerRef.current = node;\n }),\n // Above the goo layer (z-[-1]) so the neck reads behind it.\n className: cn(\"relative z-0\", childProps.className as string | undefined),\n \"aria-haspopup\": \"dialog\",\n \"aria-expanded\": ctx.open,\n \"aria-controls\": ctx.open ? ctx.contentId : undefined,\n \"data-state\": ctx.open ? \"open\" : \"closed\",\n });\n}\n\nconst ALIGN_ORIGIN: Record<Align, string> = {\n start: \"left\",\n center: \"center\",\n end: \"right\",\n};\n\nexport interface PopoverContentProps {\n children: ReactNode;\n className?: string;\n}\n\nexport function PopoverContent({ children, className }: PopoverContentProps) {\n const ctx = usePopoverContext(\"PopoverContent\");\n const [portalReady, setPortalReady] = useState(false);\n const {\n side,\n align,\n gap,\n panelRadius,\n gooStrength,\n reduce,\n gooId,\n contentId,\n progress,\n triggerRef,\n contentRef,\n open,\n triggerMode,\n openHover,\n scheduleClose,\n } = ctx;\n\n const measureRef = contentRef;\n const blobRef = useRef<HTMLDivElement>(null);\n const clipRef = useRef<HTMLDivElement>(null);\n const geoRef = useRef<Geo | null>(null);\n const supportsShapeRef = useRef(false);\n const layout = usePopoverPortalPosition(triggerRef, measureRef, portalReady);\n\n useEffect(() => setPortalReady(true), []);\n\n const geo = useMemo(\n () =>\n buildGeo(\n layout?.trigger.width ?? 0,\n layout?.trigger.height ?? 0,\n layout?.content.width ?? 0,\n layout?.content.height ?? 0,\n side,\n align,\n gap,\n panelRadius,\n ),\n [layout, side, align, gap, panelRadius],\n );\n\n // Morph the same clip on the goo body and the content, so the whole popover\n // oozes as one and the text reveals with it.\n const render = useCallback((g: Geo | null, p: number) => {\n if (!g || g.layerW === 0) return;\n const clip = clipForProgress(g, p, supportsShapeRef.current);\n if (blobRef.current) blobRef.current.style.clipPath = clip;\n if (clipRef.current) clipRef.current.style.clipPath = clip;\n }, []);\n\n useLayoutEffect(() => {\n supportsShapeRef.current =\n typeof CSS !== \"undefined\" &&\n typeof CSS.supports === \"function\" &&\n CSS.supports(\"clip-path\", \"shape(from 0px 0px, line to 1px 1px, close)\");\n geoRef.current = geo;\n render(geo, progress.get());\n }, [geo, progress, render]);\n\n useMotionValueEvent(progress, \"change\", (p) => render(geoRef.current, p));\n\n const hoverHandlers =\n triggerMode === \"hover\" ? { onMouseEnter: openHover, onMouseLeave: scheduleClose } : {};\n const maskId = `${gooId}-trigger-cutout`;\n\n // Match the server and first client render, then attach the portal after\n // hydration. This preserves SSR without regenerating the page on the client.\n if (!portalReady) return null;\n\n return createPortal(\n <div\n data-popover-portal=\"\"\n className=\"pointer-events-none fixed top-0 left-0 isolate z-9999 size-0\"\n style={{\n visibility: layout ? \"visible\" : \"hidden\",\n transform: `translate3d(${layout?.trigger.left ?? 0}px, ${layout?.trigger.top ?? 0}px, 0)`,\n }}\n >\n {/* Goo filter: blur, sharpen the alpha back into solid shapes, then lay\n the crisp original on top so blobs merge with liquid edges. The mask\n removes the real trigger area so this top-layer copy never covers its\n label or focus ring. */}\n <svg aria-hidden width=\"0\" height=\"0\" className=\"absolute\">\n <title>Popover visual effects</title>\n <defs>\n <filter id={gooId} x=\"-50%\" y=\"-50%\" width=\"200%\" height=\"200%\">\n <feGaussianBlur in=\"SourceGraphic\" stdDeviation={gooStrength} result=\"blur\" />\n <feColorMatrix\n in=\"blur\"\n mode=\"matrix\"\n values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 22 -10\"\n result=\"goo\"\n />\n <feComposite in=\"SourceGraphic\" in2=\"goo\" operator=\"atop\" />\n </filter>\n <mask\n id={maskId}\n maskUnits=\"userSpaceOnUse\"\n maskContentUnits=\"userSpaceOnUse\"\n x={0}\n y={0}\n width={geo.layerW}\n height={geo.layerH}\n >\n <rect width={geo.layerW} height={geo.layerH} fill=\"white\" />\n <rect\n x={geo.trigger.x}\n y={geo.trigger.y}\n width={geo.trigger.w}\n height={geo.trigger.h}\n rx={geo.trigger.r}\n fill=\"black\"\n />\n </mask>\n </defs>\n </svg>\n\n {/* Goo body: static trigger pill + morphing blob. */}\n <div\n aria-hidden\n className=\"pointer-events-none absolute z-[-1]\"\n style={{\n left: geo.left,\n top: geo.top,\n width: geo.layerW,\n height: geo.layerH,\n filter: reduce ? undefined : `url(#${gooId})`,\n mask: `url(#${maskId})`,\n WebkitMask: `url(#${maskId})`,\n }}\n >\n <div\n className=\"absolute bg-popover\"\n style={{\n left: geo.trigger.x,\n top: geo.trigger.y,\n width: geo.trigger.w,\n height: geo.trigger.h,\n borderRadius: geo.trigger.r,\n }}\n />\n <div\n ref={blobRef}\n className=\"absolute inset-0 bg-popover\"\n style={{\n clipPath: clipForProgress(geo, progress.get(), false),\n }}\n />\n </div>\n\n {/* Content is clipped by the same morph. The portal wrapper stays\n pointer-transparent; only the fully open panel accepts interaction. */}\n <div\n className=\"pointer-events-none absolute z-10\"\n style={{\n left: geo.left,\n top: geo.top,\n width: geo.layerW,\n height: geo.layerH,\n }}\n >\n <div\n ref={clipRef}\n inert={!open}\n className=\"absolute inset-0\"\n style={{\n clipPath: clipForProgress(geo, progress.get(), false),\n pointerEvents: open ? \"auto\" : \"none\",\n }}\n >\n <div\n ref={measureRef}\n id={contentId}\n role=\"dialog\"\n {...hoverHandlers}\n style={{\n position: \"absolute\",\n left: geo.panel.x,\n top: geo.panel.y,\n transformOrigin: `${ALIGN_ORIGIN[align]} ${side === \"bottom\" ? \"top\" : \"bottom\"}`,\n }}\n className={cn(\n \"w-max max-w-[min(92vw,20rem)] p-4 text-popover-foreground outline-none\",\n className,\n )}\n >\n {children}\n </div>\n </div>\n </div>\n </div>,\n document.body,\n );\n}\n"],"mappings":";;;;;;;;AAoCA,MAAM,kBAAkB;CACtB,MAAM;CACN,gBAAgB;CAChB,QAA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E,eAAA;IACA,WAAU;IACV,OAAO;KACL,MAAM,IAAI;KACV,KAAK,IAAI;KACT,OAAO,IAAI;KACX,QAAQ,IAAI;KACZ,QAAQ,SAAS,KAAA,IAAY,QAAQ,MAAM;KAC3C,MAAM,QAAQ,OAAO;KACrB,YAAY,QAAQ,OAAO;IAC7B;IAXF,UAAA,CAaE,oBAAC,OAAD;KACE,WAAU;KACV,OAAO;MACL,MAAM,IAAI,QAAQ;MAClB,KAAK,IAAI,QAAQ;MACjB,OAAO,IAAI,QAAQ;MACnB,QAAQ,IAAI,QAAQ;MACpB,cAAc,IAAI,QAAQ;KAC5B;IACD,CAAA,GACD,oBAAC,OAAD;KACE,KAAK;KACL,WAAU;KACV,OAAO,EACL,UAAU,gBAAgB,KAAK,SAAS,IAAI,GAAG,KAAK,EACtD;IACD,CAAA,CACE;;GAIL,oBAAC,OAAD;IACE,WAAU;IACV,OAAO;KACL,MAAM,IAAI;KACV,KAAK,IAAI;KACT,OAAO,IAAI;KACX,QAAQ,IAAI;IACd;IAEA,UAAA,oBAAC,OAAD;KACE,KAAK;KACL,OAAO,CAAC;KACR,WAAU;KACV,OAAO;MACL,UAAU,gBAAgB,KAAK,SAAS,IAAI,GAAG,KAAK;MACpD,eAAe,OAAO,SAAS;KACjC;KAEA,UAAA,oBAAC,OAAD;MACE,KAAK;MACL,IAAI;MACJ,MAAK;MACL,GAAI;MACJ,OAAO;OACL,UAAU;OACV,MAAM,IAAI,MAAM;OAChB,KAAK,IAAI,MAAM;OACf,iBAAiB,GAAG,aAAa,OAAO,GAAG,SAAS,WAAW,QAAQ;MACzE;MACA,WAAW,GACT,0EACA,SACF;MAEC;KACE,CAAA;IACF,CAAA;GACF,CAAA;EACF;CACL,CAAA,GAAA,SAAS,IACX;AACF"}
1
+ {"version":3,"file":"popover.js","names":[],"sources":["../../../src/components/motion/popover.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n cloneElement,\n createContext,\n isValidElement,\n type ReactElement,\n type ReactNode,\n type Ref,\n useCallback,\n useContext,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport {\n animate,\n type MotionValue,\n useMotionValue,\n useMotionValueEvent,\n useReducedMotion,\n} from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { usePopoverPortalPosition } from \"./popover-position\";\n\ntype Side = \"top\" | \"bottom\";\ntype Align = \"start\" | \"center\" | \"end\";\ntype TriggerMode = \"click\" | \"hover\";\n\n// This morph needs less bounce than layout motion: too much overshoot makes\n// the liquid neck balloon past the final panel edges.\nconst GOO_OPEN_SPRING = {\n type: \"spring\",\n visualDuration: 0.3,\n bounce: 0.15,\n} as const;\nconst GOO_CLOSE_SPRING = {\n type: \"spring\",\n visualDuration: 0.21,\n bounce: 0.15,\n} as const;\nconst HOVER_CLOSE_DELAY = 120;\nconst CIRCLE_KAPPA = 0.5523;\n\nconst lerp = (a: number, b: number, t: number) => a + (b - a) * t;\n\ninterface Rect {\n x: number;\n y: number;\n w: number;\n h: number;\n r: number;\n}\ninterface Geo {\n layerW: number;\n layerH: number;\n left: number;\n top: number;\n trigger: Rect;\n panel: Rect;\n}\n\n// Trigger rect and panel rect in a shared local coordinate box.\nfunction buildGeo(\n tW: number,\n tH: number,\n cW: number,\n cH: number,\n side: Side,\n align: Align,\n gap: number,\n panelRadius: number,\n): Geo {\n const py = side === \"bottom\" ? tH + gap : -(gap + cH);\n const px = align === \"start\" ? 0 : align === \"end\" ? tW - cW : (tW - cW) / 2;\n\n const left = Math.min(0, px);\n const top = Math.min(0, py);\n const layerW = Math.max(tW, px + cW) - left;\n const layerH = Math.max(tH, py + cH) - top;\n\n const triggerRadius = Math.min(tH / 2, panelRadius);\n\n return {\n layerW,\n layerH,\n left,\n top,\n trigger: { x: -left, y: -top, w: tW, h: tH, r: triggerRadius },\n panel: { x: px - left, y: py - top, w: cW, h: cH, r: panelRadius },\n };\n}\n\nfunction rectAtProgress(geo: Geo, progress: number): Rect {\n const trigger = geo.trigger;\n const panel = geo.panel;\n\n return {\n x: lerp(trigger.x, panel.x, progress),\n y: lerp(trigger.y, panel.y, progress),\n w: lerp(trigger.w, panel.w, progress),\n h: lerp(trigger.h, panel.h, progress),\n r: lerp(trigger.r, panel.r, progress),\n };\n}\n\nfunction insetFor(rect: Rect, layerW: number, layerH: number) {\n const top = rect.y;\n const right = layerW - (rect.x + rect.w);\n const bottom = layerH - (rect.y + rect.h);\n const left = rect.x;\n return `inset(${top}px ${right}px ${bottom}px ${left}px round ${rect.r}px)`;\n}\n\nfunction roundedRectShape(rect: Rect) {\n const radius = Math.max(0, Math.min(rect.r, rect.w / 2, rect.h / 2));\n const control = radius * CIRCLE_KAPPA;\n const x1 = rect.x;\n const y1 = rect.y;\n const x2 = rect.x + rect.w;\n const y2 = rect.y + rect.h;\n const px = (value: number) => `${value.toFixed(3)}px`;\n\n return (\n `shape(from ${px(x1 + radius)} ${px(y1)}, ` +\n `line to ${px(x2 - radius)} ${px(y1)}, ` +\n `curve to ${px(x2)} ${px(y1 + radius)} with ${px(x2 - radius + control)} ${px(y1)} / ${px(x2)} ${px(y1 + radius - control)}, ` +\n `line to ${px(x2)} ${px(y2 - radius)}, ` +\n `curve to ${px(x2 - radius)} ${px(y2)} with ${px(x2)} ${px(y2 - radius + control)} / ${px(x2 - radius + control)} ${px(y2)}, ` +\n `line to ${px(x1 + radius)} ${px(y2)}, ` +\n `curve to ${px(x1)} ${px(y2 - radius)} with ${px(x1 + radius - control)} ${px(y2)} / ${px(x1)} ${px(y2 - radius + control)}, ` +\n `line to ${px(x1)} ${px(y1 + radius)}, ` +\n `curve to ${px(x1 + radius)} ${px(y1)} with ${px(x1)} ${px(y1 + radius - control)} / ${px(x1 + radius - control)} ${px(y1)}, ` +\n \"close)\"\n );\n}\n\nfunction clipForProgress(geo: Geo, progress: number, supportsShape: boolean) {\n const rect = rectAtProgress(geo, progress);\n return supportsShape ? roundedRectShape(rect) : insetFor(rect, geo.layerW, geo.layerH);\n}\n\nfunction roundedRectPath(rect: Rect) {\n const radius = Math.max(0, Math.min(rect.r, rect.w / 2, rect.h / 2));\n const n = (value: number) => value.toFixed(3);\n const x1 = rect.x;\n const y1 = rect.y;\n const x2 = rect.x + rect.w;\n const y2 = rect.y + rect.h;\n const arc = `A${n(radius)} ${n(radius)} 0 0 1`;\n\n // A zero radius makes every arc degenerate to a line, so this also draws\n // plain rectangles.\n return (\n `M${n(x1 + radius)} ${n(y1)}` +\n `H${n(x2 - radius)}${arc} ${n(x2)} ${n(y1 + radius)}` +\n `V${n(y2 - radius)}${arc} ${n(x2 - radius)} ${n(y2)}` +\n `H${n(x1 + radius)}${arc} ${n(x1)} ${n(y2 - radius)}` +\n `V${n(y1 + radius)}${arc} ${n(x1 + radius)} ${n(y1)}Z`\n );\n}\n\n// The goo layer is portalled above the page, so its copy of the trigger pill\n// would cover the real trigger's label and focus ring. Punching the trigger\n// back out keeps the real one visible and clips the blur to the layer box.\n// This is a clip path rather than a CSS mask on purpose: WebKit silently\n// ignores `mask: url(#id)` pointing at an SVG <mask> element, which left the\n// label hidden behind the goo in Safari.\nfunction triggerCutout(geo: Geo) {\n const layer = { x: 0, y: 0, w: geo.layerW, h: geo.layerH, r: 0 };\n return `path(evenodd, \"${roundedRectPath(layer)} ${roundedRectPath(geo.trigger)}\")`;\n}\n\ninterface PopoverContextValue {\n open: boolean;\n setOpen: (open: boolean) => void;\n toggle: () => void;\n openHover: () => void;\n scheduleClose: () => void;\n triggerMode: TriggerMode;\n side: Side;\n align: Align;\n gap: number;\n panelRadius: number;\n gooStrength: number;\n reduce: boolean;\n gooId: string;\n contentId: string;\n progress: MotionValue<number>;\n triggerRef: React.MutableRefObject<HTMLElement | null>;\n contentRef: React.MutableRefObject<HTMLDivElement | null>;\n}\n\nconst PopoverContext = createContext<PopoverContextValue | null>(null);\n\nfunction usePopoverContext(component: string) {\n const ctx = useContext(PopoverContext);\n if (!ctx) throw new Error(`${component} must be used within <Popover>`);\n return ctx;\n}\n\nexport interface PopoverProps {\n children: ReactNode;\n /** Controlled open state. */\n open?: boolean;\n /** Uncontrolled initial open state. */\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n /** How the popover is summoned. Default \"click\". */\n trigger?: TriggerMode;\n /** Which side of the trigger the panel oozes out of. Default \"bottom\". */\n side?: Side;\n /** Alignment along the trigger's edge. Default \"center\". */\n align?: Align;\n /** Gap between trigger and panel, in px — the length of the gooey neck. Default 14. */\n sideOffset?: number;\n /** Corner radius of the open panel, in px. Default 16. */\n panelRadius?: number;\n /** Blur radius feeding the goo filter — higher melts more. Default 8. */\n gooStrength?: number;\n className?: string;\n}\n\nexport function Popover({\n children,\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n trigger = \"click\",\n side = \"bottom\",\n align = \"center\",\n sideOffset = 14,\n panelRadius = 16,\n gooStrength = 8,\n className,\n}: PopoverProps) {\n const reduce = useReducedMotion() ?? false;\n const gooId = useId().replace(/:/g, \"\");\n const contentId = useId();\n const rootRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n const closeTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const progress = useMotionValue(defaultOpen ? 1 : 0);\n\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const controlled = controlledOpen !== undefined;\n const open = controlled ? controlledOpen : internalOpen;\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (!controlled) setInternalOpen(next);\n onOpenChange?.(next);\n },\n [controlled, onOpenChange],\n );\n\n const cancelClose = useCallback(() => {\n if (closeTimer.current) {\n clearTimeout(closeTimer.current);\n closeTimer.current = null;\n }\n }, []);\n\n const openHover = useCallback(() => {\n cancelClose();\n setOpen(true);\n }, [cancelClose, setOpen]);\n\n const scheduleClose = useCallback(() => {\n cancelClose();\n closeTimer.current = setTimeout(() => setOpen(false), HOVER_CLOSE_DELAY);\n }, [cancelClose, setOpen]);\n\n const toggle = useCallback(() => setOpen(!open), [setOpen, open]);\n\n useEffect(() => () => cancelClose(), [cancelClose]);\n\n useEffect(() => {\n const animation = animate(\n progress,\n open ? 1 : 0,\n reduce ? { duration: 0 } : open ? GOO_OPEN_SPRING : GOO_CLOSE_SPRING,\n );\n return () => animation.stop();\n }, [open, progress, reduce]);\n\n useEffect(() => {\n if (!open) return;\n const onKey = (e: KeyboardEvent) => e.key === \"Escape\" && setOpen(false);\n // The panel is portalled, so both trees participate in outside detection.\n const onPointer = (e: PointerEvent) => {\n const target = e.target as Node;\n if (\n rootRef.current &&\n !rootRef.current.contains(target) &&\n !contentRef.current?.contains(target)\n )\n setOpen(false);\n };\n window.addEventListener(\"keydown\", onKey);\n if (trigger === \"click\") window.addEventListener(\"pointerdown\", onPointer);\n return () => {\n window.removeEventListener(\"keydown\", onKey);\n window.removeEventListener(\"pointerdown\", onPointer);\n };\n }, [open, setOpen, trigger]);\n\n const ctx = useMemo<PopoverContextValue>(\n () => ({\n open,\n setOpen,\n toggle,\n openHover,\n scheduleClose,\n triggerMode: trigger,\n side,\n align,\n gap: sideOffset,\n panelRadius,\n gooStrength,\n reduce,\n gooId,\n contentId,\n progress,\n triggerRef,\n contentRef,\n }),\n [\n open,\n setOpen,\n toggle,\n openHover,\n scheduleClose,\n trigger,\n side,\n align,\n sideOffset,\n panelRadius,\n gooStrength,\n reduce,\n gooId,\n contentId,\n progress,\n ],\n );\n\n const hoverHandlers =\n trigger === \"hover\" ? { onMouseEnter: openHover, onMouseLeave: scheduleClose } : {};\n\n return (\n <PopoverContext.Provider value={ctx}>\n <div\n ref={rootRef}\n className={cn(\"relative isolate inline-flex\", className)}\n {...hoverHandlers}\n >\n {children}\n </div>\n </PopoverContext.Provider>\n );\n}\n\nfunction mergeRefs<T>(...refs: Array<Ref<T> | undefined>) {\n return (node: T | null) => {\n for (const ref of refs) {\n if (typeof ref === \"function\") ref(node);\n else if (ref && typeof ref === \"object\")\n (ref as React.MutableRefObject<T | null>).current = node;\n }\n };\n}\n\nexport interface PopoverTriggerProps {\n /** A single focusable element (e.g. a Button) that opens the popover. */\n children: ReactElement;\n}\n\nexport function PopoverTrigger({ children }: PopoverTriggerProps) {\n const ctx = usePopoverContext(\"PopoverTrigger\");\n\n if (!isValidElement(children)) return children;\n\n const child = children as ReactElement<Record<string, unknown>>;\n const childProps = child.props;\n const childRef = (childProps as { ref?: Ref<HTMLElement> }).ref;\n\n const compose =\n (name: string, handler: () => void) => (event: { defaultPrevented?: boolean }) => {\n (childProps[name] as ((e: unknown) => void) | undefined)?.(event);\n if (!event.defaultPrevented) handler();\n };\n\n const handlers: Record<string, unknown> =\n ctx.triggerMode === \"hover\"\n ? {\n onFocus: compose(\"onFocus\", ctx.openHover),\n onBlur: compose(\"onBlur\", ctx.scheduleClose),\n }\n : { onClick: compose(\"onClick\", ctx.toggle) };\n\n return cloneElement(child, {\n ...handlers,\n ref: mergeRefs(childRef, (node: HTMLElement | null) => {\n ctx.triggerRef.current = node;\n }),\n // Above the goo layer (z-[-1]) so the neck reads behind it.\n className: cn(\"relative z-0\", childProps.className as string | undefined),\n \"aria-haspopup\": \"dialog\",\n \"aria-expanded\": ctx.open,\n \"aria-controls\": ctx.open ? ctx.contentId : undefined,\n \"data-state\": ctx.open ? \"open\" : \"closed\",\n });\n}\n\nconst ALIGN_ORIGIN: Record<Align, string> = {\n start: \"left\",\n center: \"center\",\n end: \"right\",\n};\n\nexport interface PopoverContentProps {\n children: ReactNode;\n className?: string;\n}\n\nexport function PopoverContent({ children, className }: PopoverContentProps) {\n const ctx = usePopoverContext(\"PopoverContent\");\n const [portalReady, setPortalReady] = useState(false);\n const {\n side,\n align,\n gap,\n panelRadius,\n gooStrength,\n reduce,\n gooId,\n contentId,\n progress,\n triggerRef,\n contentRef,\n open,\n triggerMode,\n openHover,\n scheduleClose,\n } = ctx;\n\n const measureRef = contentRef;\n const blobRef = useRef<HTMLDivElement>(null);\n const clipRef = useRef<HTMLDivElement>(null);\n const geoRef = useRef<Geo | null>(null);\n const supportsShapeRef = useRef(false);\n const layout = usePopoverPortalPosition(triggerRef, measureRef, portalReady);\n\n useEffect(() => setPortalReady(true), []);\n\n const geo = useMemo(\n () =>\n buildGeo(\n layout?.trigger.width ?? 0,\n layout?.trigger.height ?? 0,\n layout?.content.width ?? 0,\n layout?.content.height ?? 0,\n side,\n align,\n gap,\n panelRadius,\n ),\n [layout, side, align, gap, panelRadius],\n );\n\n // Morph the same clip on the goo body and the content, so the whole popover\n // oozes as one and the text reveals with it.\n const render = useCallback((g: Geo | null, p: number) => {\n if (!g || g.layerW === 0) return;\n const clip = clipForProgress(g, p, supportsShapeRef.current);\n if (blobRef.current) blobRef.current.style.clipPath = clip;\n if (clipRef.current) clipRef.current.style.clipPath = clip;\n }, []);\n\n useLayoutEffect(() => {\n supportsShapeRef.current =\n typeof CSS !== \"undefined\" &&\n typeof CSS.supports === \"function\" &&\n CSS.supports(\"clip-path\", \"shape(from 0px 0px, line to 1px 1px, close)\");\n geoRef.current = geo;\n render(geo, progress.get());\n }, [geo, progress, render]);\n\n useMotionValueEvent(progress, \"change\", (p) => render(geoRef.current, p));\n\n const hoverHandlers =\n triggerMode === \"hover\" ? { onMouseEnter: openHover, onMouseLeave: scheduleClose } : {};\n\n // Match the server and first client render, then attach the portal after\n // hydration. This preserves SSR without regenerating the page on the client.\n if (!portalReady) return null;\n\n return createPortal(\n <div\n data-popover-portal=\"\"\n className=\"pointer-events-none fixed top-0 left-0 isolate z-9999 size-0\"\n style={{\n visibility: layout ? \"visible\" : \"hidden\",\n transform: `translate3d(${layout?.trigger.left ?? 0}px, ${layout?.trigger.top ?? 0}px, 0)`,\n }}\n >\n {/* Goo filter: blur, sharpen the alpha back into solid shapes, then lay\n the crisp original on top so blobs merge with liquid edges. */}\n <svg aria-hidden width=\"0\" height=\"0\" className=\"absolute\">\n <title>Popover visual effects</title>\n <defs>\n <filter id={gooId} x=\"-50%\" y=\"-50%\" width=\"200%\" height=\"200%\">\n <feGaussianBlur in=\"SourceGraphic\" stdDeviation={gooStrength} result=\"blur\" />\n <feColorMatrix\n in=\"blur\"\n mode=\"matrix\"\n values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 22 -10\"\n result=\"goo\"\n />\n <feComposite in=\"SourceGraphic\" in2=\"goo\" operator=\"atop\" />\n </filter>\n </defs>\n </svg>\n\n {/* Goo body: static trigger pill + morphing blob. */}\n <div\n aria-hidden\n className=\"pointer-events-none absolute z-[-1]\"\n style={{\n left: geo.left,\n top: geo.top,\n width: geo.layerW,\n height: geo.layerH,\n filter: reduce ? undefined : `url(#${gooId})`,\n clipPath: triggerCutout(geo),\n }}\n >\n <div\n className=\"absolute bg-popover\"\n style={{\n left: geo.trigger.x,\n top: geo.trigger.y,\n width: geo.trigger.w,\n height: geo.trigger.h,\n borderRadius: geo.trigger.r,\n }}\n />\n <div\n ref={blobRef}\n className=\"absolute inset-0 bg-popover\"\n style={{\n clipPath: clipForProgress(geo, progress.get(), false),\n }}\n />\n </div>\n\n {/* Content is clipped by the same morph. The portal wrapper stays\n pointer-transparent; only the fully open panel accepts interaction. */}\n <div\n className=\"pointer-events-none absolute z-10\"\n style={{\n left: geo.left,\n top: geo.top,\n width: geo.layerW,\n height: geo.layerH,\n }}\n >\n <div\n ref={clipRef}\n inert={!open}\n className=\"absolute inset-0\"\n style={{\n clipPath: clipForProgress(geo, progress.get(), false),\n pointerEvents: open ? \"auto\" : \"none\",\n }}\n >\n <div\n ref={measureRef}\n id={contentId}\n role=\"dialog\"\n {...hoverHandlers}\n style={{\n position: \"absolute\",\n left: geo.panel.x,\n top: geo.panel.y,\n transformOrigin: `${ALIGN_ORIGIN[align]} ${side === \"bottom\" ? \"top\" : \"bottom\"}`,\n }}\n className={cn(\n \"w-max max-w-[min(92vw,20rem)] p-4 text-popover-foreground outline-none\",\n className,\n )}\n >\n {children}\n </div>\n </div>\n </div>\n </div>,\n document.body,\n );\n}\n"],"mappings":";;;;;;;;AAoCA,MAAM,kBAAkB;CACtB,MA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AO,CAAC;KACR,WAAU;KACV,OAAO;MACL,UAAU,gBAAgB,KAAK,SAAS,IAAI,GAAG,KAAK;MACpD,eAAe,OAAO,SAAS;KACjC;KAEA,UAAA,oBAAC,OAAD;MACE,KAAK;MACL,IAAI;MACJ,MAAK;MACL,GAAI;MACJ,OAAO;OACL,UAAU;OACV,MAAM,IAAI,MAAM;OAChB,KAAK,IAAI,MAAM;OACf,iBAAiB,GAAG,aAAa,OAAO,GAAG,SAAS,WAAW,QAAQ;MACzE;MACA,WAAW,GACT,0EACA,SACF;MAEC;KACE,CAAA;IACF,CAAA;GACF,CAAA;EACF;CACL,CAAA,GAAA,SAAS,IACX;AACF"}
@@ -0,0 +1,17 @@
1
+ import { CSSProperties } from "react";
2
+ //#region src/components/motion/text-scramble.d.ts
3
+ interface TextScrambleProps {
4
+ /** Final text revealed by the scramble animation. */
5
+ text: string;
6
+ /** Maximum animation duration in milliseconds. */
7
+ duration?: number;
8
+ /** Characters sampled while unresolved positions are scrambling. */
9
+ glyphs?: string;
10
+ className?: string;
11
+ style?: CSSProperties;
12
+ }
13
+ /** Character scramble that resolves to `text` and respects reduced motion. */
14
+ declare function TextScramble({ text, duration, glyphs, className, style }: TextScrambleProps): import("react").JSX.Element;
15
+ //#endregion
16
+ export { TextScramble, TextScrambleProps };
17
+ //# sourceMappingURL=text-scramble.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-scramble.d.ts","names":[],"sources":["../../../src/components/motion/text-scramble.tsx"],"mappings":";;UASiB;;EAEf;;EAEA;;EAEA;EACA;EACA,QAAQ;;;iBAIM,eACd,MACA,UACA,QACA,WACA,SACC,oCAAiB,IAAA"}
@@ -0,0 +1,64 @@
1
+ "use client";
2
+ import { useEffect, useRef, useState } from "react";
3
+ import { cn } from "@kumix/utils";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { useReducedMotion } from "motion/react";
6
+ //#region src/components/motion/text-scramble.tsx
7
+ const DEFAULT_GLYPHS = "ABCDEFGHJKLMNPQRSTUVWXYZ0123456789#%&@$?/";
8
+ /** Character scramble that resolves to `text` and respects reduced motion. */
9
+ function TextScramble({ text, duration, glyphs = DEFAULT_GLYPHS, className, style }) {
10
+ const reduce = useReducedMotion() ?? false;
11
+ const [display, setDisplay] = useState(text);
12
+ const mounted = useRef(false);
13
+ useEffect(() => {
14
+ if (!mounted.current) {
15
+ mounted.current = true;
16
+ setDisplay(text);
17
+ return;
18
+ }
19
+ if (reduce || !glyphs) {
20
+ setDisplay(text);
21
+ return;
22
+ }
23
+ const characters = text.split("");
24
+ const startedAt = performance.now();
25
+ const animationDuration = duration ?? Math.min(760, Math.max(420, characters.length * 32));
26
+ let frame = 0;
27
+ let lastUpdate = 0;
28
+ const animate = (now) => {
29
+ if (now - lastUpdate >= 40) {
30
+ lastUpdate = now;
31
+ const progress = Math.min((now - startedAt) / animationDuration, 1);
32
+ const settled = Math.floor(progress * characters.length);
33
+ setDisplay(characters.map((character, index) => {
34
+ if (index < settled || character === " ") return character;
35
+ return glyphs[Math.floor(Math.random() * glyphs.length)];
36
+ }).join(""));
37
+ }
38
+ if (now - startedAt < animationDuration) frame = requestAnimationFrame(animate);
39
+ else setDisplay(text);
40
+ };
41
+ frame = requestAnimationFrame(animate);
42
+ return () => cancelAnimationFrame(frame);
43
+ }, [
44
+ duration,
45
+ glyphs,
46
+ reduce,
47
+ text
48
+ ]);
49
+ return /* @__PURE__ */ jsxs("span", {
50
+ className: cn("inline-block whitespace-pre", className),
51
+ style,
52
+ children: [/* @__PURE__ */ jsx("span", {
53
+ className: "sr-only",
54
+ children: text
55
+ }), /* @__PURE__ */ jsx("span", {
56
+ "aria-hidden": "true",
57
+ children: reduce ? text : display
58
+ })]
59
+ });
60
+ }
61
+ //#endregion
62
+ export { TextScramble };
63
+
64
+ //# sourceMappingURL=text-scramble.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-scramble.js","names":[],"sources":["../../../src/components/motion/text-scramble.tsx"],"sourcesContent":["\"use client\";\n\nimport { type CSSProperties, useEffect, useRef, useState } from \"react\";\nimport { useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\n\nconst DEFAULT_GLYPHS = \"ABCDEFGHJKLMNPQRSTUVWXYZ0123456789#%&@$?/\";\n\nexport interface TextScrambleProps {\n /** Final text revealed by the scramble animation. */\n text: string;\n /** Maximum animation duration in milliseconds. */\n duration?: number;\n /** Characters sampled while unresolved positions are scrambling. */\n glyphs?: string;\n className?: string;\n style?: CSSProperties;\n}\n\n/** Character scramble that resolves to `text` and respects reduced motion. */\nexport function TextScramble({\n text,\n duration,\n glyphs = DEFAULT_GLYPHS,\n className,\n style,\n}: TextScrambleProps) {\n const reduce = useReducedMotion() ?? false;\n const [display, setDisplay] = useState(text);\n const mounted = useRef(false);\n\n useEffect(() => {\n if (!mounted.current) {\n mounted.current = true;\n setDisplay(text);\n return;\n }\n\n if (reduce || !glyphs) {\n setDisplay(text);\n return;\n }\n\n const characters = text.split(\"\");\n const startedAt = performance.now();\n const animationDuration = duration ?? Math.min(760, Math.max(420, characters.length * 32));\n let frame = 0;\n let lastUpdate = 0;\n\n const animate = (now: number) => {\n if (now - lastUpdate >= 40) {\n lastUpdate = now;\n const progress = Math.min((now - startedAt) / animationDuration, 1);\n const settled = Math.floor(progress * characters.length);\n setDisplay(\n characters\n .map((character, index) => {\n if (index < settled || character === \" \") return character;\n return glyphs[Math.floor(Math.random() * glyphs.length)];\n })\n .join(\"\"),\n );\n }\n\n if (now - startedAt < animationDuration) {\n frame = requestAnimationFrame(animate);\n } else {\n setDisplay(text);\n }\n };\n\n frame = requestAnimationFrame(animate);\n return () => cancelAnimationFrame(frame);\n }, [duration, glyphs, reduce, text]);\n\n return (\n <span className={cn(\"inline-block whitespace-pre\", className)} style={style}>\n <span className=\"sr-only\">{text}</span>\n <span aria-hidden=\"true\">{reduce ? text : display}</span>\n </span>\n );\n}\n"],"mappings":";;;;;;AAOA,MAAM,iBAAiB;;AAcvB,SAAgB,aAA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pD;;AAEV"}
@@ -1,7 +1,7 @@
1
1
  import { VariantProps } from "class-variance-authority";
2
2
  //#region src/components/reui/alert.d.ts
3
3
  declare const alertVariants: (props?: ({
4
- variant?: "success" | "default" | "destructive" | "info" | "warning" | "invert" | null | undefined;
4
+ variant?: "default" | "destructive" | "success" | "info" | "warning" | "invert" | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
6
  declare function Alert({ className, variant, ...props }: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>): import("react").JSX.Element;
7
7
  declare function AlertTitle({ className, ...props }: React.ComponentProps<"div">): import("react").JSX.Element;
@@ -2,7 +2,7 @@ import { VariantProps } from "class-variance-authority";
2
2
  import { Autocomplete as Autocomplete$1 } from "@base-ui/react/autocomplete";
3
3
  //#region src/components/reui/autocomplete.d.ts
4
4
  declare const inputVariants: (props?: ({
5
- size?: "sm" | "default" | "lg" | null | undefined;
5
+ size?: "default" | "sm" | "lg" | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
7
  declare const Autocomplete: typeof Autocomplete$1.Root;
8
8
  declare function AutocompleteValue({ ...props }: Autocomplete$1.Value.Props): import("react").JSX.Element;
@@ -2,8 +2,8 @@ import { VariantProps } from "class-variance-authority";
2
2
  import { useRender } from "@base-ui/react/use-render";
3
3
  //#region src/components/reui/badge.d.ts
4
4
  declare const badgeVariants: (props?: ({
5
- variant?: "success" | "default" | "destructive" | "secondary" | "outline" | "info" | "warning" | "invert" | "focus" | "primary-light" | "warning-light" | "success-light" | "info-light" | "destructive-light" | "invert-light" | "focus-light" | "primary-outline" | "warning-outline" | "success-outline" | "info-outline" | "destructive-outline" | "invert-outline" | "focus-outline" | null | undefined;
6
- size?: "sm" | "default" | "lg" | "xs" | "xl" | null | undefined;
5
+ variant?: "default" | "destructive" | "secondary" | "outline" | "success" | "info" | "warning" | "invert" | "focus" | "primary-light" | "warning-light" | "success-light" | "info-light" | "destructive-light" | "invert-light" | "focus-light" | "primary-outline" | "warning-outline" | "success-outline" | "info-outline" | "destructive-outline" | "invert-outline" | "focus-outline" | null | undefined;
6
+ size?: "default" | "sm" | "xs" | "lg" | "xl" | null | undefined;
7
7
  radius?: "default" | "full" | null | undefined;
8
8
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
9
  interface BadgeProps extends useRender.ComponentProps<"span"> {
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { Button } from "../../ui/button.js";
3
- import { Separator } from "../../ui/separator.js";
3
+ import { Badge } from "../badge.js";
4
4
  import { Input } from "../../ui/input.js";
5
+ import { Separator } from "../../ui/separator.js";
5
6
  import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover.js";
6
- import { Badge } from "../badge.js";
7
7
  import { useMemo, useState } from "react";
8
8
  import { cn } from "@kumix/utils";
9
9
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { useIsMobile } from "../../hooks/use-mobile.js";
3
3
  import { Button } from "../ui/button.js";
4
+ import { ScrollArea } from "../ui/scroll-area.js";
4
5
  import { Calendar, CalendarDayButton } from "../ui/calendar.js";
5
6
  import { Input } from "../ui/input.js";
6
- import { ScrollArea } from "../ui/scroll-area.js";
7
7
  import { Tabs, TabsList, TabsTrigger } from "../ui/tabs.js";
8
8
  import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
9
9
  import { cn } from "@kumix/utils";
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover.js";
3
2
  import { ScrollArea } from "../../ui/scroll-area.js";
3
+ import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover.js";
4
4
  import { getDayKey, getRangeKey, resolveOffDay, toZoned, zonedStartOfDay } from "./event-calendar-lib.js";
5
5
  import { EventCalendarViewContext, useEventCalendar, useEventCalendarDay, useEventCalendarSelector, useEventCalendarSettings, useEventCalendarViewConfig, useEventCalendarViewSettings, useEventCalendarWeek } from "./event-calendar.js";
6
6
  import { useEventCalendarGestures, wasRecentChipPress, wasRecentDrag } from "./event-calendar-dnd.js";
@@ -2,8 +2,8 @@
2
2
  import { Button } from "../../ui/button.js";
3
3
  import { Calendar } from "../../ui/calendar.js";
4
4
  import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuTrigger } from "../../ui/dropdown-menu.js";
5
- import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover.js";
6
5
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../ui/tooltip.js";
6
+ import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover.js";
7
7
  import { toZoned } from "./event-calendar-lib.js";
8
8
  import { useEventCalendarNavigation, useEventCalendarSettings, useEventCalendarView, useEventCalendarViewConfig } from "./event-calendar.js";
9
9
  import { useState } from "react";
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
  "use no memo";
3
3
  import { Button } from "../ui/button.js";
4
- import { ButtonGroup, ButtonGroupText } from "../ui/button-group.js";
4
+ import { ScrollArea } from "../ui/scroll-area.js";
5
5
  import { Input } from "../ui/input.js";
6
- import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText } from "../ui/input-group.js";
6
+ import { ButtonGroup, ButtonGroupText } from "../ui/button-group.js";
7
7
  import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "../ui/dropdown-menu.js";
8
+ import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText } from "../ui/input-group.js";
8
9
  import { Kbd } from "../ui/kbd.js";
9
- import { ScrollArea } from "../ui/scroll-area.js";
10
10
  import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip.js";
11
11
  import { createContext, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
12
12
  import { cn } from "@kumix/utils";
@@ -14,7 +14,7 @@ import { VariantProps } from "class-variance-authority";
14
14
  */
15
15
  declare const frameVariants: (props?: ({
16
16
  variant?: "default" | "ghost" | "inverse" | null | undefined;
17
- spacing?: "sm" | "default" | "lg" | "xs" | null | undefined;
17
+ spacing?: "default" | "sm" | "xs" | "lg" | null | undefined;
18
18
  stacked?: boolean | null | undefined;
19
19
  dense?: boolean | null | undefined;
20
20
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { ContextMenu, ContextMenuContent, ContextMenuTrigger } from "../../ui/context-menu.js";
3
2
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../ui/tooltip.js";
3
+ import { ContextMenu, ContextMenuContent, ContextMenuTrigger } from "../../ui/context-menu.js";
4
4
  import { flattenResources, toZoned } from "./gantt-lib.js";
5
5
  import { useGantt, useGanttSelector, useGanttViewConfig } from "./gantt.js";
6
6
  import { useGanttGestures, wasRecentDrag } from "./gantt-dnd.js";
@@ -2,8 +2,8 @@
2
2
  import { Button } from "../../ui/button.js";
3
3
  import { Calendar } from "../../ui/calendar.js";
4
4
  import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuTrigger } from "../../ui/dropdown-menu.js";
5
- import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover.js";
6
5
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../ui/tooltip.js";
6
+ import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover.js";
7
7
  import { toZoned } from "./gantt-lib.js";
8
8
  import { useGanttNavigation, useGanttScale, useGanttSettings, useGanttViewConfig } from "./gantt.js";
9
9
  import { useState } from "react";
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { Button } from "../../ui/button.js";
3
- import { Checkbox } from "../../ui/checkbox.js";
4
- import { ContextMenu, ContextMenuContent, ContextMenuTrigger } from "../../ui/context-menu.js";
5
3
  import { ScrollArea as ScrollArea$1, ScrollBar } from "../../ui/scroll-area.js";
6
4
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../ui/tooltip.js";
5
+ import { Checkbox } from "../../ui/checkbox.js";
6
+ import { ContextMenu, ContextMenuContent, ContextMenuTrigger } from "../../ui/context-menu.js";
7
7
  import { getDayKey, getLaneKey, getRangeKey, packTimedSegments, reorderResources, resolveOffDay, toZoned, zonedStartOfDay } from "./gantt-lib.js";
8
8
  import { resolveScheduleMode, resolveTimelineLines, useGantt, useGanttSelector, useGanttSettings, useGanttViewConfig } from "./gantt.js";
9
9
  import { cancelActiveGanttGestures, markGestureEnd, useGanttGestureTeardown, useGanttGestures, wasRecentDrag } from "./gantt-dnd.js";
@@ -12,9 +12,9 @@ import { memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useStat
12
12
  import { cn } from "@kumix/utils";
13
13
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
14
14
  import { ChevronLeftIcon, ChevronRightIcon, GripVerticalIcon, MinusIcon, PlusIcon } from "lucide-react";
15
+ import { ScrollArea } from "@base-ui/react/scroll-area";
15
16
  import { mergeProps } from "@base-ui/react/merge-props";
16
17
  import { useRender } from "@base-ui/react/use-render";
17
- import { ScrollArea } from "@base-ui/react/scroll-area";
18
18
  import { addDays, addMinutes, addMonths, format, getWeek, startOfMonth, startOfQuarter, startOfWeek } from "date-fns";
19
19
  //#region src/components/reui/gantt/gantt-view.tsx
20
20
  /** Current time, refreshed on an interval and on tab focus. */
@@ -22,8 +22,8 @@ import { useRender } from "@base-ui/react/use-render";
22
22
  * default to `text-primary`; override it to recolor without touching internals.
23
23
  */
24
24
  declare const iconTileVariants: (props?: ({
25
- variant?: "outline" | "soft" | "solid" | "elevated" | "frame" | null | undefined;
26
- size?: "sm" | "default" | "lg" | "xs" | "xl" | null | undefined;
25
+ variant?: "outline" | "elevated" | "soft" | "solid" | "frame" | null | undefined;
26
+ size?: "default" | "sm" | "xs" | "lg" | "xl" | null | undefined;
27
27
  radius?: "default" | "full" | null | undefined;
28
28
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
29
29
  interface IconTileProps extends useRender.ComponentProps<"span"> {
@@ -3,13 +3,13 @@ import { VariantProps } from "class-variance-authority";
3
3
  import { NumberField as NumberField$1 } from "@base-ui/react/number-field";
4
4
  //#region src/components/reui/number-field.d.ts
5
5
  declare const numberFieldGroupVariants: (props?: ({
6
- size?: "sm" | "default" | "lg" | null | undefined;
6
+ size?: "default" | "sm" | "lg" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
8
  declare const numberFieldButtonVariants: (props?: ({
9
- size?: "sm" | "default" | "lg" | null | undefined;
9
+ size?: "default" | "sm" | "lg" | null | undefined;
10
10
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
11
11
  declare const numberFieldInputVariants: (props?: ({
12
- size?: "sm" | "default" | "lg" | null | undefined;
12
+ size?: "default" | "sm" | "lg" | null | undefined;
13
13
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
14
14
  declare function NumberField({ id, className, size, ...props }: NumberField$1.Root.Props & VariantProps<typeof numberFieldGroupVariants>): import("react").JSX.Element;
15
15
  declare function NumberFieldGroup({ className, size: sizeProp, ...props }: NumberField$1.Group.Props & Partial<VariantProps<typeof numberFieldGroupVariants>>): import("react").JSX.Element;
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { Button } from "../ui/button.js";
3
+ import { ScrollArea } from "../ui/scroll-area.js";
3
4
  import { Input } from "../ui/input.js";
4
5
  import { Combobox, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue } from "../ui/combobox.js";
5
- import { ScrollArea } from "../ui/scroll-area.js";
6
6
  import { createContext, useContext, useMemo, useState } from "react";
7
7
  import { cn } from "@kumix/utils";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,7 +1,7 @@
1
1
  import { VariantProps } from "class-variance-authority";
2
2
  //#region src/components/reui/rating.d.ts
3
3
  declare const ratingVariants: (props?: ({
4
- size?: "sm" | "default" | "lg" | null | undefined;
4
+ size?: "default" | "sm" | "lg" | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
6
  declare function Rating({ rating, maxRating, size, className, starClassName, showValue, editable, onRatingChange, ...props }: React.ComponentProps<"div"> & VariantProps<typeof ratingVariants> & {
7
7
  /**
@@ -4,8 +4,8 @@ import { VariantProps } from "class-variance-authority";
4
4
  import { useRender } from "@base-ui/react/use-render";
5
5
  //#region src/components/ui/attachment.d.ts
6
6
  declare const attachmentVariants: (props?: ({
7
- size?: "sm" | "default" | "xs" | null | undefined;
8
- orientation?: "vertical" | "horizontal" | null | undefined;
7
+ size?: "default" | "sm" | "xs" | null | undefined;
8
+ orientation?: "horizontal" | "vertical" | null | undefined;
9
9
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
10
10
  declare function Attachment({ className, state, size, orientation, ...props }: React$1.ComponentProps<"div"> & VariantProps<typeof attachmentVariants> & {
11
11
  state?: "idle" | "uploading" | "processing" | "error" | "done";
@@ -2,7 +2,7 @@ import { VariantProps } from "class-variance-authority";
2
2
  import { useRender } from "@base-ui/react/use-render";
3
3
  //#region src/components/ui/badge.d.ts
4
4
  declare const badgeVariants: (props?: ({
5
- variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
5
+ variant?: "default" | "destructive" | "link" | "secondary" | "outline" | "ghost" | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
7
  declare function Badge({ className, variant, render, ...props }: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
8
8
  //#endregion
@@ -3,7 +3,7 @@ import { VariantProps } from "class-variance-authority";
3
3
  import { useRender } from "@base-ui/react/use-render";
4
4
  //#region src/components/ui/button-group.d.ts
5
5
  declare const buttonGroupVariants: (props?: ({
6
- orientation?: "vertical" | "horizontal" | null | undefined;
6
+ orientation?: "horizontal" | "vertical" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
8
  declare function ButtonGroup({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>): import("react").JSX.Element;
9
9
  declare function ButtonGroupText({ className, render, ...props }: useRender.ComponentProps<"div">): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
@@ -2,8 +2,8 @@ import { Button as Button$1 } from "@base-ui/react/button";
2
2
  import { VariantProps } from "class-variance-authority";
3
3
  //#region src/components/ui/button.d.ts
4
4
  declare const buttonVariants: (props?: ({
5
- variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
6
- size?: "sm" | "default" | "lg" | "xs" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
5
+ variant?: "default" | "destructive" | "link" | "secondary" | "outline" | "ghost" | null | undefined;
6
+ size?: "default" | "sm" | "xs" | "icon" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
8
  declare function Button({ className, variant, size, ...props }: Button$1.Props & VariantProps<typeof buttonVariants>): import("react").JSX.Element;
9
9
  //#endregion
@@ -7,7 +7,7 @@ declare function FieldLegend({ className, variant, ...props }: React.ComponentPr
7
7
  }): import("react").JSX.Element;
8
8
  declare function FieldGroup({ className, ...props }: React.ComponentProps<"div">): import("react").JSX.Element;
9
9
  declare const fieldVariants: (props?: ({
10
- orientation?: "vertical" | "horizontal" | "responsive" | null | undefined;
10
+ orientation?: "horizontal" | "vertical" | "responsive" | null | undefined;
11
11
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
12
12
  declare function Field({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>): import("react").JSX.Element;
13
13
  declare function FieldContent({ className, ...props }: React.ComponentProps<"div">): import("react").JSX.Element;
@@ -7,11 +7,11 @@ declare function ItemGroup({ className, ...props }: React$1.ComponentProps<"div"
7
7
  declare function ItemSeparator({ className, ...props }: React$1.ComponentProps<typeof Separator>): React$1.JSX.Element;
8
8
  declare const itemVariants: (props?: ({
9
9
  variant?: "default" | "outline" | "muted" | null | undefined;
10
- size?: "sm" | "default" | "xs" | null | undefined;
10
+ size?: "default" | "sm" | "xs" | null | undefined;
11
11
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
12
12
  declare function Item({ className, variant, size, render, ...props }: useRender.ComponentProps<"div"> & VariantProps<typeof itemVariants>): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
13
13
  declare const itemMediaVariants: (props?: ({
14
- variant?: "image" | "default" | "icon" | null | undefined;
14
+ variant?: "default" | "image" | "icon" | null | undefined;
15
15
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
16
16
  declare function ItemMedia({ className, variant, ...props }: React$1.ComponentProps<"div"> & VariantProps<typeof itemMediaVariants>): React$1.JSX.Element;
17
17
  declare function ItemContent({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;