@kumix/ui 0.3.14 → 0.3.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +15 -15
  2. package/dist/components/motion/animated-toast-stack.js +4 -3
  3. package/dist/components/motion/animated-toast-stack.js.map +1 -1
  4. package/dist/components/motion/command-palette.d.ts.map +1 -1
  5. package/dist/components/motion/command-palette.js +2 -21
  6. package/dist/components/motion/command-palette.js.map +1 -1
  7. package/dist/components/motion/tabs.js +1 -1
  8. package/dist/components/motion/tabs.js.map +1 -1
  9. package/dist/components/motion/tooltip-surface.d.ts +12 -0
  10. package/dist/components/motion/tooltip-surface.d.ts.map +1 -0
  11. package/dist/components/motion/tooltip-surface.js +97 -0
  12. package/dist/components/motion/tooltip-surface.js.map +1 -0
  13. package/dist/components/motion/tooltip.d.ts +13 -3
  14. package/dist/components/motion/tooltip.d.ts.map +1 -1
  15. package/dist/components/motion/tooltip.js +74 -103
  16. package/dist/components/motion/tooltip.js.map +1 -1
  17. package/dist/components/reui/alert.d.ts +1 -1
  18. package/dist/components/reui/autocomplete.d.ts +1 -1
  19. package/dist/components/reui/autocomplete.d.ts.map +1 -1
  20. package/dist/components/reui/autocomplete.js +1 -1
  21. package/dist/components/reui/autocomplete.js.map +1 -1
  22. package/dist/components/reui/badge.d.ts +2 -2
  23. package/dist/components/reui/cascader/cascader-virtual.d.ts.map +1 -1
  24. package/dist/components/reui/cascader/cascader-virtual.js +2 -0
  25. package/dist/components/reui/cascader/cascader-virtual.js.map +1 -1
  26. package/dist/components/reui/data-grid/data-grid-pagination.d.ts +2 -0
  27. package/dist/components/reui/data-grid/data-grid-pagination.d.ts.map +1 -1
  28. package/dist/components/reui/data-grid/data-grid-pagination.js +103 -42
  29. package/dist/components/reui/data-grid/data-grid-pagination.js.map +1 -1
  30. package/dist/components/reui/data-grid/data-grid-table.js +1 -1
  31. package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
  32. package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -1
  33. package/dist/components/reui/data-grid/data-grid.js.map +1 -1
  34. package/dist/components/reui/event-calendar/event-calendar-resource-view.d.ts.map +1 -1
  35. package/dist/components/reui/event-calendar/event-calendar-resource-view.js +3 -4
  36. package/dist/components/reui/event-calendar/event-calendar-resource-view.js.map +1 -1
  37. package/dist/components/reui/event-calendar/event-calendar-time-grid.d.ts +9 -1
  38. package/dist/components/reui/event-calendar/event-calendar-time-grid.d.ts.map +1 -1
  39. package/dist/components/reui/event-calendar/event-calendar-time-grid.js +11 -4
  40. package/dist/components/reui/event-calendar/event-calendar-time-grid.js.map +1 -1
  41. package/dist/components/reui/event-calendar/event-calendar.d.ts.map +1 -1
  42. package/dist/components/reui/event-calendar/event-calendar.js.map +1 -1
  43. package/dist/components/reui/filters/filters-advanced.js.map +1 -1
  44. package/dist/components/reui/filters/filters-builder.js +1 -1
  45. package/dist/components/reui/filters/filters-editors.js +1 -1
  46. package/dist/components/reui/filters/filters-types.d.ts +8 -0
  47. package/dist/components/reui/filters/filters-types.d.ts.map +1 -1
  48. package/dist/components/reui/frame.d.ts +6 -12
  49. package/dist/components/reui/frame.d.ts.map +1 -1
  50. package/dist/components/reui/frame.js +9 -16
  51. package/dist/components/reui/frame.js.map +1 -1
  52. package/dist/components/reui/gantt/gantt.d.ts.map +1 -1
  53. package/dist/components/reui/gantt/gantt.js.map +1 -1
  54. package/dist/components/reui/icon-tile.d.ts +2 -2
  55. package/dist/components/reui/number-field.d.ts +3 -3
  56. package/dist/components/reui/number-field.d.ts.map +1 -1
  57. package/dist/components/reui/number-field.js +3 -3
  58. package/dist/components/reui/number-field.js.map +1 -1
  59. package/dist/components/reui/rating.d.ts +1 -1
  60. package/dist/components/ui/attachment.d.ts +2 -2
  61. package/dist/components/ui/badge.d.ts +1 -1
  62. package/dist/components/ui/bubble.d.ts +1 -1
  63. package/dist/components/ui/button-group.d.ts +1 -1
  64. package/dist/components/ui/button.d.ts +2 -2
  65. package/dist/components/ui/field.d.ts +1 -1
  66. package/dist/components/ui/item.d.ts +3 -3
  67. package/dist/components/ui/marker.d.ts +1 -1
  68. package/dist/components/ui/sidebar.d.ts +2 -2
  69. package/dist/components/ui/tabs.d.ts +1 -1
  70. package/dist/components/ui/toggle.d.ts +2 -2
  71. package/dist/hooks/use-dismiss.d.ts +1 -1
  72. package/dist/hooks/use-dismiss.d.ts.map +1 -1
  73. package/dist/hooks/use-dismiss.js.map +1 -1
  74. package/dist/lib/command-search.d.ts +10 -0
  75. package/dist/lib/command-search.d.ts.map +1 -0
  76. package/dist/lib/command-search.js +52 -0
  77. package/dist/lib/command-search.js.map +1 -0
  78. package/package.json +5 -5
@@ -2,11 +2,11 @@
2
2
  import { useDismiss } from "../../hooks/use-dismiss.js";
3
3
  import { useHoverGesture } from "../../hooks/use-hover-gesture.js";
4
4
  import { useTapGesture } from "../../hooks/use-tap-gesture.js";
5
- import { EASE_OUT } from "../../lib/ease.js";
6
- import { cloneElement, isValidElement, useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
5
+ import { TooltipSurface } from "./tooltip-surface.js";
6
+ import { cloneElement, isValidElement, useCallback, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
7
7
  import { cn } from "@kumix/utils";
8
8
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
- import { AnimatePresence, motion, useReducedMotion } from "motion/react";
9
+ import { AnimatePresence } from "motion/react";
10
10
  import { createPortal } from "react-dom";
11
11
  //#region src/components/motion/tooltip.tsx
12
12
  const GAP = 8;
@@ -22,109 +22,73 @@ const transformOrigin = {
22
22
  left: "right center",
23
23
  right: "left center"
24
24
  };
25
- const offsetFrom = {
26
- top: { y: 8 },
27
- bottom: { y: -8 },
28
- left: { x: 8 },
29
- right: { x: -8 }
30
- };
31
- function buildVariants(side) {
32
- const o = offsetFrom[side];
33
- return {
34
- initial: {
35
- opacity: 0,
36
- scale: .9,
37
- filter: "blur(5px)",
38
- x: o.x ?? 0,
39
- y: o.y ?? 0
40
- },
41
- animate: {
42
- opacity: 1,
43
- scale: 1,
44
- filter: "blur(0px)",
45
- x: 0,
46
- y: 0,
47
- transition: {
48
- type: "spring",
49
- stiffness: 380,
50
- damping: 30,
51
- mass: .7,
52
- opacity: {
53
- duration: .14,
54
- ease: EASE_OUT
55
- },
56
- filter: {
57
- duration: .18,
58
- ease: EASE_OUT
59
- }
60
- }
61
- },
62
- exit: {
63
- opacity: 0,
64
- scale: .94,
65
- filter: "blur(3px)",
66
- x: (o.x ?? 0) * .6,
67
- y: (o.y ?? 0) * .6,
68
- transition: {
69
- duration: .12,
70
- ease: EASE_OUT
71
- }
72
- }
73
- };
74
- }
75
- const REDUCED_VARIANTS = {
76
- initial: { opacity: 0 },
77
- animate: {
78
- opacity: 1,
79
- transition: {
80
- duration: .14,
81
- ease: EASE_OUT
82
- }
83
- },
84
- exit: {
85
- opacity: 0,
86
- transition: {
87
- duration: .1,
88
- ease: EASE_OUT
89
- }
90
- }
91
- };
92
25
  const WARM_WINDOW_MS = 300;
93
26
  let lastHiddenAt = 0;
94
- function Tooltip({ content, children, side = "top", delay = 120, className, wrapperClassName }) {
95
- const [open, setOpen] = useState(false);
27
+ function Tooltip({ content, children, side = "top", delay = 120, className, wrapperClassName, anchorRef: externalAnchorRef, anchorPoint, open: controlledOpen, onOpenChange, id: providedId }) {
28
+ const [internalOpen, setInternalOpen] = useState(false);
29
+ const open = controlledOpen ?? internalOpen;
30
+ const setOpen = useCallback((next) => {
31
+ if (controlledOpen === void 0) setInternalOpen(next);
32
+ onOpenChange?.(next);
33
+ }, [controlledOpen, onOpenChange]);
96
34
  const [coords, setCoords] = useState(null);
97
- const id = useId();
35
+ const generatedId = useId();
36
+ const id = providedId ?? generatedId;
98
37
  const timer = useRef(null);
99
- const anchorRef = useRef(null);
38
+ const wrapperRef = useRef(null);
39
+ const anchorRef = externalAnchorRef ?? wrapperRef;
100
40
  const hover = useHoverGesture();
101
- const reduce = useReducedMotion();
41
+ const surfaceRef = useRef(null);
102
42
  const place = useCallback(() => {
103
43
  const el = anchorRef.current;
104
44
  if (!el) return;
105
45
  const r = el.getBoundingClientRect();
106
- const cx = r.left + r.width / 2;
107
- const cy = r.top + r.height / 2;
108
- const point = {
46
+ const cx = r.left + r.width * (anchorPoint?.x ?? .5);
47
+ const cy = r.top + r.height * (anchorPoint?.y ?? .5);
48
+ const next = {
109
49
  top: {
110
- top: r.top - GAP,
50
+ top: (anchorPoint ? cy : r.top) - GAP,
111
51
  left: cx
112
52
  },
113
53
  bottom: {
114
- top: r.bottom + GAP,
54
+ top: (anchorPoint ? cy : r.bottom) + GAP,
115
55
  left: cx
116
56
  },
117
57
  left: {
118
58
  top: cy,
119
- left: r.left - GAP
59
+ left: (anchorPoint ? cx : r.left) - GAP
120
60
  },
121
61
  right: {
122
62
  top: cy,
123
- left: r.right + GAP
63
+ left: (anchorPoint ? cx : r.right) + GAP
124
64
  }
125
- };
126
- setCoords(point[side]);
127
- }, [side]);
65
+ }[side];
66
+ const width = surfaceRef.current?.offsetWidth ?? 0;
67
+ const height = surfaceRef.current?.offsetHeight ?? 0;
68
+ const dx = side === "left" ? width : side === "right" ? 0 : width / 2;
69
+ const dy = side === "top" ? height : side === "bottom" ? 0 : height / 2;
70
+ next.left = Math.max(GAP + dx, Math.min(next.left, window.innerWidth - GAP - width + dx));
71
+ next.top = Math.max(GAP + dy, Math.min(next.top, window.innerHeight - GAP - height + dy));
72
+ setCoords((previous) => previous?.top === next.top && previous.left === next.left ? previous : next);
73
+ }, [
74
+ side,
75
+ anchorRef,
76
+ anchorPoint
77
+ ]);
78
+ const positioned = coords !== null;
79
+ useLayoutEffect(() => {
80
+ if (!open) return;
81
+ place();
82
+ const observer = new ResizeObserver(place);
83
+ if (anchorRef.current) observer.observe(anchorRef.current);
84
+ if (positioned && surfaceRef.current) observer.observe(surfaceRef.current);
85
+ return () => observer.disconnect();
86
+ }, [
87
+ open,
88
+ place,
89
+ anchorRef,
90
+ positioned
91
+ ]);
128
92
  const show = useCallback(() => {
129
93
  if (timer.current) clearTimeout(timer.current);
130
94
  const warm = Date.now() - lastHiddenAt < WARM_WINDOW_MS;
@@ -132,7 +96,11 @@ function Tooltip({ content, children, side = "top", delay = 120, className, wrap
132
96
  place();
133
97
  setOpen(true);
134
98
  }, warm ? 0 : delay);
135
- }, [delay, place]);
99
+ }, [
100
+ delay,
101
+ place,
102
+ setOpen
103
+ ]);
136
104
  const hide = useCallback(() => {
137
105
  if (timer.current) {
138
106
  clearTimeout(timer.current);
@@ -140,7 +108,7 @@ function Tooltip({ content, children, side = "top", delay = 120, className, wrap
140
108
  }
141
109
  if (open) lastHiddenAt = Date.now();
142
110
  setOpen(false);
143
- }, [open]);
111
+ }, [open, setOpen]);
144
112
  const tap = useTapGesture();
145
113
  const toggleOnTap = useCallback(() => {
146
114
  const gesture = tap.take();
@@ -155,7 +123,8 @@ function Tooltip({ content, children, side = "top", delay = 120, className, wrap
155
123
  }, [
156
124
  hide,
157
125
  place,
158
- tap
126
+ tap,
127
+ setOpen
159
128
  ]);
160
129
  useDismiss(open, hide, anchorRef);
161
130
  useEffect(() => {
@@ -168,11 +137,13 @@ function Tooltip({ content, children, side = "top", delay = 120, className, wrap
168
137
  window.removeEventListener("resize", onMove);
169
138
  };
170
139
  }, [open, place]);
171
- const variants = useMemo(() => reduce ? REDUCED_VARIANTS : buildVariants(side), [reduce, side]);
172
- if (!isValidElement(children)) return children;
173
- const trigger = cloneElement(children, { "aria-describedby": id });
174
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
175
- ref: anchorRef,
140
+ useEffect(() => () => {
141
+ if (timer.current) clearTimeout(timer.current);
142
+ }, []);
143
+ if (!externalAnchorRef && !isValidElement(children)) return children;
144
+ const trigger = isValidElement(children) ? cloneElement(children, { "aria-describedby": id }) : null;
145
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [!externalAnchorRef ? /* @__PURE__ */ jsx("span", {
146
+ ref: wrapperRef,
176
147
  className: cn("relative inline-flex align-middle", wrapperClassName),
177
148
  onPointerEnter: (event) => {
178
149
  if (hover.enter(event)) show();
@@ -187,23 +158,23 @@ function Tooltip({ content, children, side = "top", delay = 120, className, wrap
187
158
  onKeyDown: tap.drop,
188
159
  onClick: toggleOnTap,
189
160
  children: trigger
190
- }), typeof document !== "undefined" ? createPortal(/* @__PURE__ */ jsx(AnimatePresence, { children: open && coords ? /* @__PURE__ */ jsx("span", {
191
- "aria-hidden": true,
161
+ }) : null, typeof document !== "undefined" ? createPortal(/* @__PURE__ */ jsx(AnimatePresence, { children: open && coords ? /* @__PURE__ */ jsx("span", {
192
162
  className: "pointer-events-none fixed z-9999",
193
163
  style: {
194
164
  top: coords.top,
195
165
  left: coords.left,
196
166
  transform: anchorTransform[side]
197
167
  },
198
- children: /* @__PURE__ */ jsx(motion.span, {
168
+ children: /* @__PURE__ */ jsx(TooltipSurface, {
169
+ ref: surfaceRef,
199
170
  id,
200
- role: "tooltip",
201
- variants,
202
- initial: "initial",
203
- animate: "animate",
204
- exit: "exit",
205
- style: { transformOrigin: transformOrigin[side] },
206
- className: cn("block whitespace-nowrap rounded-lg border border-border bg-background px-2.5 py-1 font-medium text-foreground text-xs shadow-lg", className),
171
+ side,
172
+ style: {
173
+ transformOrigin: transformOrigin[side],
174
+ maxWidth: "calc(100vw - 16px)",
175
+ whiteSpace: "normal"
176
+ },
177
+ className,
207
178
  children: content
208
179
  })
209
180
  }) : null }), document.body) : null] });
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.js","names":[],"sources":["../../../src/components/motion/tooltip.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n cloneElement,\n isValidElement,\n type PointerEvent,\n type ReactElement,\n type ReactNode,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { AnimatePresence, motion, useReducedMotion, type Variants } from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useDismiss } from \"../../hooks/use-dismiss\";\nimport { useHoverGesture } from \"../../hooks/use-hover-gesture\";\nimport { useTapGesture } from \"../../hooks/use-tap-gesture\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\ntype Side = \"top\" | \"right\" | \"bottom\" | \"left\";\n\nexport interface TooltipProps {\n content: ReactNode;\n children: ReactElement;\n side?: Side;\n /** Delay before showing (ms). Default 120. */\n delay?: number;\n className?: string;\n /** Classes for the outer wrapper span. Use to fix baseline / fill parent. */\n wrapperClassName?: string;\n}\n\n// Gap between trigger and tooltip, in px.\nconst GAP = 8;\n\n// Centering transform for the fixed-positioned anchor point, per side.\nconst anchorTransform: Record<Side, string> = {\n top: \"translate(-50%, -100%)\",\n bottom: \"translate(-50%, 0)\",\n left: \"translate(-100%, -50%)\",\n right: \"translate(0, -50%)\",\n};\n\nconst transformOrigin: Record<Side, string> = {\n top: \"center bottom\",\n bottom: \"center top\",\n left: \"right center\",\n right: \"left center\",\n};\n\n// Offset is in the direction *away* from the trigger — content originates near\n// the trigger and rises into resting position.\nconst offsetFrom: Record<Side, { x?: number; y?: number }> = {\n top: { y: 8 },\n bottom: { y: -8 },\n left: { x: 8 },\n right: { x: -8 },\n};\n\nfunction buildVariants(side: Side): Variants {\n const o = offsetFrom[side];\n return {\n initial: {\n opacity: 0,\n scale: 0.9,\n filter: \"blur(5px)\",\n x: o.x ?? 0,\n y: o.y ?? 0,\n },\n animate: {\n opacity: 1,\n scale: 1,\n filter: \"blur(0px)\",\n x: 0,\n y: 0,\n transition: {\n type: \"spring\",\n stiffness: 380,\n damping: 30,\n mass: 0.7,\n opacity: { duration: 0.14, ease: EASE_OUT },\n filter: { duration: 0.18, ease: EASE_OUT },\n },\n },\n exit: {\n opacity: 0,\n scale: 0.94,\n filter: \"blur(3px)\",\n x: (o.x ?? 0) * 0.6,\n y: (o.y ?? 0) * 0.6,\n transition: { duration: 0.12, ease: EASE_OUT },\n },\n };\n}\n\nconst REDUCED_VARIANTS: Variants = {\n initial: { opacity: 0 },\n animate: { opacity: 1, transition: { duration: 0.14, ease: EASE_OUT } },\n exit: { opacity: 0, transition: { duration: 0.1, ease: EASE_OUT } },\n};\n\n// Once any tooltip has just closed, neighbouring tooltips open without the\n// initial delay — moving along a toolbar feels instant after the first one.\nconst WARM_WINDOW_MS = 300;\nlet lastHiddenAt = 0;\n\nexport function Tooltip({\n content,\n children,\n side = \"top\",\n delay = 120,\n className,\n wrapperClassName,\n}: TooltipProps) {\n const [open, setOpen] = useState(false);\n const [coords, setCoords] = useState<{ top: number; left: number } | null>(null);\n const id = useId();\n const timer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const anchorRef = useRef<HTMLSpanElement>(null);\n const hover = useHoverGesture();\n const reduce = useReducedMotion();\n\n // Anchor point in viewport coords, on the edge of the trigger facing `side`.\n // Position:fixed means these viewport coords place the tooltip directly, so\n // it escapes every ancestor's stacking context and overflow.\n const place = useCallback(() => {\n const el = anchorRef.current;\n if (!el) return;\n const r = el.getBoundingClientRect();\n const cx = r.left + r.width / 2;\n const cy = r.top + r.height / 2;\n const point: Record<Side, { top: number; left: number }> = {\n top: { top: r.top - GAP, left: cx },\n bottom: { top: r.bottom + GAP, left: cx },\n left: { top: cy, left: r.left - GAP },\n right: { top: cy, left: r.right + GAP },\n };\n setCoords(point[side]);\n }, [side]);\n\n const show = useCallback(() => {\n if (timer.current) clearTimeout(timer.current);\n const warm = Date.now() - lastHiddenAt < WARM_WINDOW_MS;\n timer.current = setTimeout(\n () => {\n place();\n setOpen(true);\n },\n warm ? 0 : delay,\n );\n }, [delay, place]);\n\n const hide = useCallback(() => {\n if (timer.current) {\n clearTimeout(timer.current);\n timer.current = null;\n }\n if (open) lastHiddenAt = Date.now();\n setOpen(false);\n }, [open]);\n\n // A finger never hovers, and Safari does not focus a button on tap either, so\n // the label is only reachable if the tap itself opens the tooltip. A click\n // carries no pointerType, so the pointerdown that preceded it is what says\n // whether this was a tap; keyboard activation arrives with no pointerdown at\n // all, and focus has already shown the label there.\n const tap = useTapGesture<boolean>();\n\n const toggleOnTap = useCallback(() => {\n const gesture = tap.take();\n if (!gesture || gesture.pointerType === \"mouse\") return;\n if (gesture.state) {\n hide();\n return;\n }\n if (timer.current) clearTimeout(timer.current);\n place();\n setOpen(true);\n }, [hide, place, tap]);\n\n // ...and closed again by the next tap that lands somewhere else. The label\n // covers nothing interactive, so that tap passes through to what it hit.\n useDismiss(open, hide, anchorRef);\n\n // Keep the tooltip pinned to the trigger while it's open and the page scrolls\n // or resizes (fixed coords are viewport-relative).\n useEffect(() => {\n if (!open) return;\n const onMove = () => place();\n window.addEventListener(\"scroll\", onMove, true);\n window.addEventListener(\"resize\", onMove);\n return () => {\n window.removeEventListener(\"scroll\", onMove, true);\n window.removeEventListener(\"resize\", onMove);\n };\n }, [open, place]);\n\n const variants = useMemo(() => (reduce ? REDUCED_VARIANTS : buildVariants(side)), [reduce, side]);\n\n if (!isValidElement(children)) return children;\n\n // The label describes the trigger, so it has to name the trigger itself.\n // Everything else the tooltip needs is read off the anchor below instead of\n // cloned on: a handler written onto the child is the child's handler as far\n // as that child can tell, and a component that owns its activation —\n // hard-wiring onClick and spreading the rest of its props over it, as\n // ThemeToggle does — then runs the tooltip's instead of its own. Composing\n // with `props.onClick` cannot save it either, because a component element's\n // props hold nothing the component does internally.\n const trigger = cloneElement(children as ReactElement<Record<string, unknown>>, {\n \"aria-describedby\": id,\n });\n\n return (\n <>\n <span\n ref={anchorRef}\n className={cn(\"relative inline-flex align-middle\", wrapperClassName)}\n // Pointer events, not the mouse pair: a tap fires compatibility\n // mouseenter/mouseleave that carry no pointerType, which raced the tap\n // path into opening and closing the same label.\n onPointerEnter={(event: PointerEvent) => {\n if (hover.enter(event)) show();\n }}\n onPointerLeave={(event: PointerEvent) => {\n if (hover.leave(event)) hide();\n }}\n onFocus={show}\n onBlur={hide}\n onPointerDown={(event: PointerEvent) => tap.start(event, open)}\n // A gesture the platform took away sends no click, and a key press\n // starts an activation that never had a pointer behind it. Either way\n // the record has to go, or the next click reads a finger that has long\n // since lifted.\n onPointerCancel={tap.drop}\n onKeyDown={tap.drop}\n onClick={toggleOnTap}\n >\n {trigger}\n </span>\n {typeof document !== \"undefined\"\n ? createPortal(\n <AnimatePresence>\n {open && coords ? (\n <span\n aria-hidden\n className=\"pointer-events-none fixed z-9999\"\n style={{\n top: coords.top,\n left: coords.left,\n transform: anchorTransform[side],\n }}\n >\n <motion.span\n id={id}\n role=\"tooltip\"\n variants={variants}\n initial=\"initial\"\n animate=\"animate\"\n exit=\"exit\"\n style={{ transformOrigin: transformOrigin[side] }}\n className={cn(\n \"block whitespace-nowrap rounded-lg border border-border bg-background px-2.5 py-1 font-medium text-foreground text-xs shadow-lg\",\n className,\n )}\n >\n {content}\n </motion.span>\n </span>\n ) : null}\n </AnimatePresence>,\n document.body,\n )\n : null}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;AAsCA,MAAM,MAAM;AAGZ,MAAM,kBAAwC;CAC5C,KAAK;CACL,QAAQ;CACR,MAAM;CACN,OAAO;AACT;AAEA,MAAM,kBAAwC;CAC5C,KAAK;CACL,QAAQ;CACR,MAAM;CACN,OAAO;AACT;AAIA,MAAM,aAAuD;CAC3D,KAAK,EAAE,GAAG,EAAE;CACZ,QAAQ,EAAE,GAAG,GAAG;CAChB,MAAM,EAAE,GAAG,EAAE;CACb,OAAO,EAAE,GAAG,GAAG;AACjB;AAEA,SAAS,cAAc,MAAsB;CAC3C,MAAM,IAAI,WAAW;CACrB,OAAO;EACL,SAAS;GACP,SAAS;GACT,OAAO;GACP,QAAQ;GACR,GAAG,EAAE,KAAK;GACV,GAAG,EAAE,KAAK;EACZ;EACA,SAAS;GACP,SAAS;GACT,OAAO;GACP,QAAQ;GACR,GAAG;GACH,GAAG;GACH,YAAY;IACV,MAAM;IACN,WAAW;IACX,SAAS;IACT,MAAM;IACN,SAAS;KAAE,UAAU;KAAM,MAAM;IAAS;IAC1C,QAAQ;KAAE,UAAU;KAAM,MAAM;IAAS;GAC3C;EACF;EACA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qC,gBAAgB;EAInE,iBAAiB,UAAwB;GACvC,IAAI,MAAM,MAAM,KAAK,GAAG,KAAK;EAC/B;EACA,iBAAiB,UAAwB;GACvC,IAAI,MAAM,MAAM,KAAK,GAAG,KAAK;EAC/B;EACA,SAAS;EACT,QAAQ;EACR,gBAAgB,UAAwB,IAAI,MAAM,OAAO,IAAI;EAK7D,iBAAiB,IAAI;EACrB,WAAW,IAAI;EACf,SAAS;EAER,UAAA;CACG,CAAA,GACL,OAAO,aAAa,cACjB,aACE,oBAAC,iBAAD,EAAA,UACG,QAAQ,SACP,oBAAC,QAAD;EACE,eAAA;EACA,WAAU;EACV,OAAO;GACL,KAAK,OAAO;GACZ,MAAM,OAAO;GACb,WAAW,gBAAgB;EAC7B;EAEA,UAAA,oBAAC,OAAO,MAAR;GACM;GACJ,MAAK;GACK;GACV,SAAQ;GACR,SAAQ;GACR,MAAK;GACL,OAAO,EAAE,iBAAiB,gBAAgB,MAAM;GAChD,WAAW,GACT,mIACA,SACF;GAEC,UAAA;EACU,CAAA;CACT,CAAA,IACJ,KACW,CAAA,GACjB,SAAS,IACX,IACA,IACJ,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"tooltip.js","names":[],"sources":["../../../src/components/motion/tooltip.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n cloneElement,\n isValidElement,\n type PointerEvent,\n type ReactElement,\n type ReactNode,\n type RefObject,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport { AnimatePresence } from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useDismiss } from \"../../hooks/use-dismiss\";\nimport { useHoverGesture } from \"../../hooks/use-hover-gesture\";\nimport { useTapGesture } from \"../../hooks/use-tap-gesture\";\nimport { TooltipSurface } from \"./tooltip-surface\";\n\ntype Side = \"top\" | \"right\" | \"bottom\" | \"left\";\n\nexport interface TooltipProps {\n content: ReactNode;\n children?: ReactElement;\n /** Existing trigger for controlled integrations such as chart cells. */\n anchorRef?: RefObject<HTMLElement | SVGElement | null>;\n /** Point within the anchor, as fractions of its rendered width and height. */\n anchorPoint?: { x: number; y: number };\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n id?: string;\n side?: Side;\n /** Delay before showing (ms). Default 120. */\n delay?: number;\n className?: string;\n /** Classes for the outer wrapper span. Use to fix baseline / fill parent. */\n wrapperClassName?: string;\n}\n\n// Gap between trigger and tooltip, in px.\nconst GAP = 8;\n\n// Centering transform for the fixed-positioned anchor point, per side.\nconst anchorTransform: Record<Side, string> = {\n top: \"translate(-50%, -100%)\",\n bottom: \"translate(-50%, 0)\",\n left: \"translate(-100%, -50%)\",\n right: \"translate(0, -50%)\",\n};\n\nconst transformOrigin: Record<Side, string> = {\n top: \"center bottom\",\n bottom: \"center top\",\n left: \"right center\",\n right: \"left center\",\n};\n\n// Once any tooltip has just closed, neighbouring tooltips open without the\n// initial delay — moving along a toolbar feels instant after the first one.\nconst WARM_WINDOW_MS = 300;\nlet lastHiddenAt = 0;\n\nexport function Tooltip({\n content,\n children,\n side = \"top\",\n delay = 120,\n className,\n wrapperClassName,\n anchorRef: externalAnchorRef,\n anchorPoint,\n open: controlledOpen,\n onOpenChange,\n id: providedId,\n}: TooltipProps) {\n const [internalOpen, setInternalOpen] = useState(false);\n const open = controlledOpen ?? internalOpen;\n const setOpen = useCallback(\n (next: boolean) => {\n if (controlledOpen === undefined) setInternalOpen(next);\n onOpenChange?.(next);\n },\n [controlledOpen, onOpenChange],\n );\n const [coords, setCoords] = useState<{ top: number; left: number } | null>(null);\n const generatedId = useId();\n const id = providedId ?? generatedId;\n const timer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const wrapperRef = useRef<HTMLSpanElement>(null);\n const anchorRef = externalAnchorRef ?? wrapperRef;\n const hover = useHoverGesture();\n const surfaceRef = useRef<HTMLSpanElement>(null);\n\n // Anchor point in viewport coords, on the edge of the trigger facing `side`.\n // Position:fixed means these viewport coords place the tooltip directly, so\n // it escapes every ancestor's stacking context and overflow.\n const place = useCallback(() => {\n const el = anchorRef.current;\n if (!el) return;\n const r = el.getBoundingClientRect();\n const cx = r.left + r.width * (anchorPoint?.x ?? 0.5);\n const cy = r.top + r.height * (anchorPoint?.y ?? 0.5);\n const point: Record<Side, { top: number; left: number }> = {\n top: { top: (anchorPoint ? cy : r.top) - GAP, left: cx },\n bottom: { top: (anchorPoint ? cy : r.bottom) + GAP, left: cx },\n left: { top: cy, left: (anchorPoint ? cx : r.left) - GAP },\n right: { top: cy, left: (anchorPoint ? cx : r.right) + GAP },\n };\n const next = point[side];\n const width = surfaceRef.current?.offsetWidth ?? 0;\n const height = surfaceRef.current?.offsetHeight ?? 0;\n const dx = side === \"left\" ? width : side === \"right\" ? 0 : width / 2;\n const dy = side === \"top\" ? height : side === \"bottom\" ? 0 : height / 2;\n next.left = Math.max(GAP + dx, Math.min(next.left, window.innerWidth - GAP - width + dx));\n next.top = Math.max(GAP + dy, Math.min(next.top, window.innerHeight - GAP - height + dy));\n setCoords((previous) =>\n previous?.top === next.top && previous.left === next.left ? previous : next,\n );\n }, [side, anchorRef, anchorPoint]);\n\n const positioned = coords !== null;\n useLayoutEffect(() => {\n if (!open) return;\n place();\n const observer = new ResizeObserver(place);\n if (anchorRef.current) observer.observe(anchorRef.current);\n if (positioned && surfaceRef.current) observer.observe(surfaceRef.current);\n return () => observer.disconnect();\n }, [open, place, anchorRef, positioned]);\n\n const show = useCallback(() => {\n if (timer.current) clearTimeout(timer.current);\n const warm = Date.now() - lastHiddenAt < WARM_WINDOW_MS;\n timer.current = setTimeout(\n () => {\n place();\n setOpen(true);\n },\n warm ? 0 : delay,\n );\n }, [delay, place, setOpen]);\n\n const hide = useCallback(() => {\n if (timer.current) {\n clearTimeout(timer.current);\n timer.current = null;\n }\n if (open) lastHiddenAt = Date.now();\n setOpen(false);\n }, [open, setOpen]);\n\n // A finger never hovers, and Safari does not focus a button on tap either, so\n // the label is only reachable if the tap itself opens the tooltip. A click\n // carries no pointerType, so the pointerdown that preceded it is what says\n // whether this was a tap; keyboard activation arrives with no pointerdown at\n // all, and focus has already shown the label there.\n const tap = useTapGesture<boolean>();\n\n const toggleOnTap = useCallback(() => {\n const gesture = tap.take();\n if (!gesture || gesture.pointerType === \"mouse\") return;\n if (gesture.state) {\n hide();\n return;\n }\n if (timer.current) clearTimeout(timer.current);\n place();\n setOpen(true);\n }, [hide, place, tap, setOpen]);\n\n // ...and closed again by the next tap that lands somewhere else. The label\n // covers nothing interactive, so that tap passes through to what it hit.\n useDismiss(open, hide, anchorRef);\n\n // Keep the tooltip pinned to the trigger while it's open and the page scrolls\n // or resizes (fixed coords are viewport-relative).\n useEffect(() => {\n if (!open) return;\n const onMove = () => place();\n window.addEventListener(\"scroll\", onMove, true);\n window.addEventListener(\"resize\", onMove);\n return () => {\n window.removeEventListener(\"scroll\", onMove, true);\n window.removeEventListener(\"resize\", onMove);\n };\n }, [open, place]);\n\n useEffect(\n () => () => {\n if (timer.current) clearTimeout(timer.current);\n },\n [],\n );\n\n if (!externalAnchorRef && !isValidElement(children)) return children;\n\n // The label describes the trigger, so it has to name the trigger itself.\n // Everything else the tooltip needs is read off the anchor below instead of\n // cloned on: a handler written onto the child is the child's handler as far\n // as that child can tell, and a component that owns its activation —\n // hard-wiring onClick and spreading the rest of its props over it, as\n // ThemeToggle does — then runs the tooltip's instead of its own. Composing\n // with `props.onClick` cannot save it either, because a component element's\n // props hold nothing the component does internally.\n const trigger = isValidElement(children)\n ? cloneElement(children as ReactElement<Record<string, unknown>>, {\n \"aria-describedby\": id,\n })\n : null;\n\n return (\n <>\n {!externalAnchorRef ? (\n <span\n ref={wrapperRef}\n className={cn(\"relative inline-flex align-middle\", wrapperClassName)}\n // Pointer events, not the mouse pair: a tap fires compatibility\n // mouseenter/mouseleave that carry no pointerType, which raced the tap\n // path into opening and closing the same label.\n onPointerEnter={(event: PointerEvent) => {\n if (hover.enter(event)) show();\n }}\n onPointerLeave={(event: PointerEvent) => {\n if (hover.leave(event)) hide();\n }}\n onFocus={show}\n onBlur={hide}\n onPointerDown={(event: PointerEvent) => tap.start(event, open)}\n // A gesture the platform took away sends no click, and a key press\n // starts an activation that never had a pointer behind it. Either way\n // the record has to go, or the next click reads a finger that has long\n // since lifted.\n onPointerCancel={tap.drop}\n onKeyDown={tap.drop}\n onClick={toggleOnTap}\n >\n {trigger}\n </span>\n ) : null}\n {typeof document !== \"undefined\"\n ? createPortal(\n <AnimatePresence>\n {open && coords ? (\n <span\n className=\"pointer-events-none fixed z-9999\"\n style={{\n top: coords.top,\n left: coords.left,\n transform: anchorTransform[side],\n }}\n >\n <TooltipSurface\n ref={surfaceRef}\n id={id}\n side={side}\n style={{\n transformOrigin: transformOrigin[side],\n maxWidth: \"calc(100vw - 16px)\",\n whiteSpace: \"normal\",\n }}\n className={className}\n >\n {content}\n </TooltipSurface>\n </span>\n ) : null}\n </AnimatePresence>,\n document.body,\n )\n : null}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;AA8CA,MAAM,MAAM;AAGZ,MAAM,kBAAwC;CAC5C,KAAK;CACL,QAAQ;CACR,MAAM;CACN,OAAO;AACT;AAEA,MAAM,kBAAwC;CAC5C,KAAK;CACL,QAAQ;CACR,MAAM;CACN,OAAO;AACT;AAIA,MAAM,iBAAiB;AACvB,IAAI,eAAe;AAEnB,SAAgB,QAAQ,EACtB,SACA,UACA,OAAO,OACP,QAAQ,KACR,WACA,kBACA,WAAW,mBACX,aACA,MAAM,gBACN,cACA,IAAI,cACW;CACf,MAAM,CAAC,cAAc,mBAAmB,SAAS,KAAK;CACtD,MAAM,OAAO,kBAAkB;CAC/B,MAAM,UAAU,aACb,SAAkB;EACjB,IAAI,mBAAmB,KAAA,GAAW,gBAAgB,IAAI;EACtD,eAAe,IAAI;CACrB,GACA,CAAC,gBAAgB,YAAY,CAC/B;CACA,MAAM,CAAC,QAAQ,aAAa,SAA+C,IAAI;CAC/E,MAAM,cAAc,MAAM;CAC1B,MAAM,KAA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EAC7C;CACF,GAAG,CAAC,MAAM,KAAK,CAAC;CAEhB,sBACc;EACV,IAAI,MAAM,SAAS,aAAa,MAAM,OAAO;CAC/C,GACA,CAAC,CACH;CAEA,IAAI,CAAC,qBAAqB,CAAC,eAAe,QAAQ,GAAG,OAAO;CAU5D,MAAM,UAAU,eAAe,QAAQ,IACnC,aAAa,UAAmD,EAC9D,oBAAoB,GACtB,CAAC,IACD;CAEJ,OACE,qBAAA,YAAA,EAAA,UAAA,CACG,CAAC,oBACA,oBAAC,QAAD;EACE,KAAK;EACL,WAAW,GAAG,qCAAqC,gBAAgB;EAInE,iBAAiB,UAAwB;GACvC,IAAI,MAAM,MAAM,KAAK,GAAG,KAAK;EAC/B;EACA,iBAAiB,UAAwB;GACvC,IAAI,MAAM,MAAM,KAAK,GAAG,KAAK;EAC/B;EACA,SAAS;EACT,QAAQ;EACR,gBAAgB,UAAwB,IAAI,MAAM,OAAO,IAAI;EAK7D,iBAAiB,IAAI;EACrB,WAAW,IAAI;EACf,SAAS;EAER,UAAA;CACG,CAAA,IACJ,MACH,OAAO,aAAa,cACjB,aACE,oBAAC,iBAAD,EAAA,UACG,QAAQ,SACP,oBAAC,QAAD;EACE,WAAU;EACV,OAAO;GACL,KAAK,OAAO;GACZ,MAAM,OAAO;GACb,WAAW,gBAAgB;EAC7B;EAEA,UAAA,oBAAC,gBAAD;GACE,KAAK;GACD;GACE;GACN,OAAO;IACL,iBAAiB,gBAAgB;IACjC,UAAU;IACV,YAAY;GACd;GACW;GAEV,UAAA;EACa,CAAA;CACZ,CAAA,IACJ,KACW,CAAA,GACjB,SAAS,IACX,IACA,IACJ,EAAA,CAAA;AAEN"}
@@ -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?: "default" | "info" | "success" | "warning" | "destructive" | "invert" | null | undefined;
4
+ variant?: "default" | "success" | "destructive" | "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;
@@ -1 +1 @@
1
- {"version":3,"file":"autocomplete.d.ts","names":[],"sources":["../../../src/components/reui/autocomplete.tsx"],"mappings":";;;cASM,gBAAa;;6CAelB;cAEK,qBAAY,eAAA;iBAET,uBAAuB,SAAS,eAAsB,MAAM,wBAAK,IAAA;iBAIjE,oBACP,WACA,MACA,WACA,gBACG,SACF,KAAK,eAAsB,MAAM,iBAClC,oBAAoB;EAClB;EACA;oBACD,IAAA;iBAeM,qBAAqB,cAAc,SAAS,eAAsB,OAAO,wBAAK,IAAA;iBAU9E,wBAAwB,SAAS,eAAsB,OAAO,wBAAK,IAAA;iBAInE,0BAA0B,SAAS,eAAsB,SAAS,wBAAK,IAAA;iBAIvE,yBAAyB,cAAc,SAAS,eAAsB,WAAW,wBAAK,IAAA;iBAUtF,mBACP,WACA,wBACG,SACF,eAAsB,KAAK;EAC5B;EACA;EACA;oBACD,IAAA;iBAoBQ,4BACJ,SACF,MAAM,sBAAsB,eAAsB,8BAAW,IAAA;iBAIvD,kBACP,cACG,SACF,MAAM,sBAAsB,eAAsB,uBAAI,IAAA;iBAUhD,mBACP,cACG,SACF,MAAM,sBAAsB,eAAsB,wBAAK,IAAA;iBAgBzC,iCACP,MAAM,sBAAsB,eAAsB;EAC1D,QAAQ,eAAsB,WAAW;EACzC,aAAa,eAAsB,WAAW;EAC9C,cAAc,eAAsB,WAAW;EAC/C,OAAO,eAAsB,WAAW;EACxC,SAAS,eAAsB,WAAW;EAC1C;;iBAGO,sBACP,WACA,UACA,cACA,OACA,YACA,aACA,MACA,WACG,SACF,2CAAwB,IAAA;iBA4BlB,uBAAuB,SAAS,MAAM,sBAAsB,eAAsB,yBAAM,IAAA;iBAIxF,yBACP,cACG,SACF,MAAM,sBAAsB,eAAsB,8BAAW,IAAA;iBAUvD,oBACP,cACG,SACF,MAAM,sBAAsB,eAAsB,yBAAM,IAAA;iBAalD,oBACP,cACG,SACF,MAAM,sBAAsB,eAAsB,yBAAM,IAAA;iBAelD,sBACP,cACG,SACF,MAAM,sBAAsB,eAAsB,2BAAQ,IAAA;iBAepD,uBAAuB,SAAS,MAAM,sBAAsB,eAAsB,yBAAM,IAAA;iBAIxF,wBACP,cACG,SACF,MAAM,sBAAsB,eAAsB,6BAAU,IAAA"}
1
+ {"version":3,"file":"autocomplete.d.ts","names":[],"sources":["../../../src/components/reui/autocomplete.tsx"],"mappings":";;;cASM,gBAAa;;6CAelB;cAEK,qBAAY,eAAA;iBAET,uBAAuB,SAAS,eAAsB,MAAM,wBAAK,IAAA;iBAIjE,oBACP,WACA,MACA,WACA,gBACG,SACF,KAAK,eAAsB,MAAM,iBAClC,oBAAoB;EAClB;EACA;oBACD,IAAA;iBAeM,qBAAqB,cAAc,SAAS,eAAsB,OAAO,wBAAK,IAAA;iBAU9E,wBAAwB,SAAS,eAAsB,OAAO,wBAAK,IAAA;iBAInE,0BAA0B,SAAS,eAAsB,SAAS,wBAAK,IAAA;iBAIvE,yBAAyB,cAAc,SAAS,eAAsB,WAAW,wBAAK,IAAA;iBAUtF,mBACP,WACA,wBACG,SACF,eAAsB,KAAK;EAC5B;EACA;EACA;oBACD,IAAA;iBAoBQ,4BACJ,SACF,MAAM,sBAAsB,eAAsB,8BAAW,IAAA;iBAIvD,kBACP,cACG,SACF,MAAM,sBAAsB,eAAsB,uBAAI,IAAA;iBAUhD,mBACP,cACG,SACF,MAAM,sBAAsB,eAAsB,wBAAK,IAAA;iBAkBzC,iCACP,MAAM,sBAAsB,eAAsB;EAC1D,QAAQ,eAAsB,WAAW;EACzC,aAAa,eAAsB,WAAW;EAC9C,cAAc,eAAsB,WAAW;EAC/C,OAAO,eAAsB,WAAW;EACxC,SAAS,eAAsB,WAAW;EAC1C;;iBAGO,sBACP,WACA,UACA,cACA,OACA,YACA,aACA,MACA,WACG,SACF,2CAAwB,IAAA;iBA4BlB,uBAAuB,SAAS,MAAM,sBAAsB,eAAsB,yBAAM,IAAA;iBAIxF,yBACP,cACG,SACF,MAAM,sBAAsB,eAAsB,8BAAW,IAAA;iBAUvD,oBACP,cACG,SACF,MAAM,sBAAsB,eAAsB,yBAAM,IAAA;iBAalD,oBACP,cACG,SACF,MAAM,sBAAsB,eAAsB,yBAAM,IAAA;iBAelD,sBACP,cACG,SACF,MAAM,sBAAsB,eAAsB,2BAAQ,IAAA;iBAepD,uBAAuB,SAAS,MAAM,sBAAsB,eAAsB,yBAAM,IAAA;iBAIxF,wBACP,cACG,SACF,MAAM,sBAAsB,eAAsB,6BAAU,IAAA"}
@@ -88,7 +88,7 @@ function AutocompleteRow({ className, ...props }) {
88
88
  function AutocompleteItem({ className, ...props }) {
89
89
  return /* @__PURE__ */ jsx(Autocomplete$1.Item, {
90
90
  "data-slot": "autocomplete-item",
91
- className: cn("gap-1.5 text-foreground data-highlighted:text-foreground data-highlighted:before:bg-accent", "rounded-md", "data-highlighted:before:rounded-md", "([class*='size-'])]:size-4 ([class*='size-'])]:size-4 ([class*='size-'])]:size-4 ([class*='size-'])]:size-3.5 ([class*='size-'])]:size-4 ([class*='size-'])]:size-3.5 relative flex cursor-default select-none items-center px-1.5 py-1 text-sm outline-hidden transition-colors data-disabled:pointer-events-none data-highlighted:relative data-highlighted:z-0 data-disabled:opacity-50 data-highlighted:before:absolute data-highlighted:before:inset-x-0 data-highlighted:before:inset-y-0 data-highlighted:before:z-[-1] [&_svg:not([class*='size-'])]:size-4 [&_svg:not([role=img]):not([class*=text-])]:opacity-60 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
91
+ className: cn("gap-1.5 text-foreground data-highlighted:text-foreground data-highlighted:before:bg-accent", "rounded-md", "data-highlighted:before:rounded-md", "relative flex cursor-default select-none items-center px-1.5 py-1 text-sm outline-hidden transition-colors data-disabled:pointer-events-none data-highlighted:relative data-highlighted:z-0 data-disabled:opacity-50 data-highlighted:before:absolute data-highlighted:before:inset-x-0 data-highlighted:before:inset-y-0 data-highlighted:before:z-[-1] [&_svg:not([class*='size-'])]:size-4 [&_svg:not([role=img]):not([class*=text-])]:opacity-60 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
92
92
  ...props
93
93
  });
94
94
  }
@@ -1 +1 @@
1
- {"version":3,"file":"autocomplete.js","names":["AutocompletePrimitive"],"sources":["../../../src/components/reui/autocomplete.tsx"],"sourcesContent":["\"use client\";\n\nimport { Autocomplete as AutocompletePrimitive } from \"@base-ui/react/autocomplete\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { ChevronsUpDownIcon, XIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { ScrollArea } from \"../ui/scroll-area\";\n\nconst inputVariants = cva(\n \"flex w-full rounded-lg border border-input bg-transparent text-foreground text-sm outline-none transition-colors placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [[readonly]]:cursor-not-allowed [[readonly]]:bg-muted/80\",\n {\n variants: {\n size: {\n sm: \"h-7 px-2 [&~[data-slot=autocomplete-clear]]:end-1.5 [&~[data-slot=autocomplete-trigger]]:end-1.5\",\n default:\n \"h-8 px-2.5 [&~[data-slot=autocomplete-clear]]:end-1.75 [&~[data-slot=autocomplete-trigger]]:end-1.75\",\n lg: \"h-9 px-2.5 [&~[data-slot=autocomplete-clear]]:end-2 [&~[data-slot=autocomplete-trigger]]:end-2\",\n },\n },\n defaultVariants: {\n size: \"default\",\n },\n },\n);\n\nconst Autocomplete = AutocompletePrimitive.Root;\n\nfunction AutocompleteValue({ ...props }: AutocompletePrimitive.Value.Props) {\n return <AutocompletePrimitive.Value data-slot=\"autocomplete-value\" {...props} />;\n}\n\nfunction AutocompleteInput({\n className,\n size = \"default\",\n showClear = false,\n showTrigger = false,\n ...props\n}: Omit<AutocompletePrimitive.Input.Props, \"size\"> &\n VariantProps<typeof inputVariants> & {\n showClear?: boolean;\n showTrigger?: boolean;\n }) {\n return (\n <div className=\"relative w-full\">\n <AutocompletePrimitive.Input\n data-slot=\"autocomplete-input\"\n data-size={size}\n className={cn(inputVariants({ size }), className)}\n {...props}\n />\n {showTrigger && <AutocompleteTrigger />}\n {showClear && <AutocompleteClear />}\n </div>\n );\n}\n\nfunction AutocompleteStatus({ className, ...props }: AutocompletePrimitive.Status.Props) {\n return (\n <AutocompletePrimitive.Status\n data-slot=\"autocomplete-status\"\n className={cn(\"px-2 py-1.5 text-muted-foreground text-sm empty:m-0 empty:p-0\", className)}\n {...props}\n />\n );\n}\n\nfunction AutocompletePortal({ ...props }: AutocompletePrimitive.Portal.Props) {\n return <AutocompletePrimitive.Portal data-slot=\"autocomplete-portal\" {...props} />;\n}\n\nfunction AutocompleteBackdrop({ ...props }: AutocompletePrimitive.Backdrop.Props) {\n return <AutocompletePrimitive.Backdrop data-slot=\"autocomplete-backdrop\" {...props} />;\n}\n\nfunction AutocompletePositioner({ className, ...props }: AutocompletePrimitive.Positioner.Props) {\n return (\n <AutocompletePrimitive.Positioner\n data-slot=\"autocomplete-positioner\"\n className={cn(\"z-50 outline-none\", className)}\n {...props}\n />\n );\n}\n\nfunction AutocompleteList({\n className,\n scrollAreaClassName,\n ...props\n}: AutocompletePrimitive.List.Props & {\n scrollAreaClassName?: string;\n scrollFade?: boolean;\n scrollbarGutter?: boolean;\n}) {\n return (\n <ScrollArea\n className={cn(\n \"size-full min-h-0 **:data-[slot=scroll-area-viewport]:h-full **:data-[slot=scroll-area-viewport]:overscroll-contain\",\n scrollAreaClassName,\n )}\n >\n <AutocompletePrimitive.List\n data-slot=\"autocomplete-list\"\n className={cn(\n \"in-data-has-overflow-y:me-3 not-empty:scroll-py-1 not-empty:px-1 not-empty:py-1\",\n className,\n )}\n {...props}\n />\n </ScrollArea>\n );\n}\n\nfunction AutocompleteCollection({\n ...props\n}: React.ComponentProps<typeof AutocompletePrimitive.Collection>) {\n return <AutocompletePrimitive.Collection data-slot=\"autocomplete-collection\" {...props} />;\n}\n\nfunction AutocompleteRow({\n className,\n ...props\n}: React.ComponentProps<typeof AutocompletePrimitive.Row>) {\n return (\n <AutocompletePrimitive.Row\n data-slot=\"autocomplete-row\"\n className={cn(\"flex items-center gap-2\", className)}\n {...props}\n />\n );\n}\n\nfunction AutocompleteItem({\n className,\n ...props\n}: React.ComponentProps<typeof AutocompletePrimitive.Item>) {\n return (\n <AutocompletePrimitive.Item\n data-slot=\"autocomplete-item\"\n className={cn(\n \"gap-1.5 text-foreground data-highlighted:text-foreground data-highlighted:before:bg-accent\",\n \"rounded-md\",\n \"data-highlighted:before:rounded-md\",\n \"([class*='size-'])]:size-4 ([class*='size-'])]:size-4 ([class*='size-'])]:size-4 ([class*='size-'])]:size-3.5 ([class*='size-'])]:size-4 ([class*='size-'])]:size-3.5 relative flex cursor-default select-none items-center px-1.5 py-1 text-sm outline-hidden transition-colors data-disabled:pointer-events-none data-highlighted:relative data-highlighted:z-0 data-disabled:opacity-50 data-highlighted:before:absolute data-highlighted:before:inset-x-0 data-highlighted:before:inset-y-0 data-highlighted:before:z-[-1] [&_svg:not([class*='size-'])]:size-4 [&_svg:not([role=img]):not([class*=text-])]:opacity-60 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport interface AutocompleteContentProps\n extends React.ComponentProps<typeof AutocompletePrimitive.Popup> {\n align?: AutocompletePrimitive.Positioner.Props[\"align\"];\n sideOffset?: AutocompletePrimitive.Positioner.Props[\"sideOffset\"];\n alignOffset?: AutocompletePrimitive.Positioner.Props[\"alignOffset\"];\n side?: AutocompletePrimitive.Positioner.Props[\"side\"];\n anchor?: AutocompletePrimitive.Positioner.Props[\"anchor\"];\n showBackdrop?: boolean;\n}\n\nfunction AutocompleteContent({\n className,\n children,\n showBackdrop = false,\n align = \"start\",\n sideOffset = 4,\n alignOffset = 0,\n side = \"bottom\",\n anchor,\n ...props\n}: AutocompleteContentProps) {\n return (\n <AutocompletePortal>\n {showBackdrop && <AutocompleteBackdrop />}\n <AutocompletePositioner\n align={align}\n sideOffset={sideOffset}\n alignOffset={alignOffset}\n side={side}\n anchor={anchor}\n >\n <div className=\"relative flex max-h-full\">\n <AutocompletePrimitive.Popup\n data-slot=\"autocomplete-popup\"\n className={cn(\n \"flex max-h-[min(var(--available-height),24rem)] w-(--anchor-width) max-w-(--available-width) origin-(--transform-origin) scroll-pt-2 scroll-pb-2 flex-col overscroll-contain rounded-lg bg-popover py-0.5 text-popover-foreground shadow-md ring-1 ring-foreground/10 transition-[scale,opacity] has-data-[side=none]:scale-100 has-data-starting-style:scale-98 has-data-starting-style:opacity-0 has-data-[side=none]:transition-none\",\n className,\n )}\n {...props}\n >\n {children}\n </AutocompletePrimitive.Popup>\n </div>\n </AutocompletePositioner>\n </AutocompletePortal>\n );\n}\n\nfunction AutocompleteGroup({ ...props }: React.ComponentProps<typeof AutocompletePrimitive.Group>) {\n return <AutocompletePrimitive.Group data-slot=\"autocomplete-group\" {...props} />;\n}\n\nfunction AutocompleteGroupLabel({\n className,\n ...props\n}: React.ComponentProps<typeof AutocompletePrimitive.GroupLabel>) {\n return (\n <AutocompletePrimitive.GroupLabel\n data-slot=\"autocomplete-group-label\"\n className={cn(\"px-1.5 py-1 font-medium text-muted-foreground text-xs\", className)}\n {...props}\n />\n );\n}\n\nfunction AutocompleteEmpty({\n className,\n ...props\n}: React.ComponentProps<typeof AutocompletePrimitive.Empty>) {\n return (\n <AutocompletePrimitive.Empty\n data-slot=\"autocomplete-empty\"\n className={cn(\n \"px-2 py-1.5 text-center text-muted-foreground text-sm empty:m-0 empty:p-0\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction AutocompleteClear({\n className,\n ...props\n}: React.ComponentProps<typeof AutocompletePrimitive.Clear>) {\n return (\n <AutocompletePrimitive.Clear\n data-slot=\"autocomplete-clear\"\n className={cn(\n \"absolute top-1/2 -translate-y-1/2 cursor-pointer opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-disabled:pointer-events-none\",\n className,\n )}\n {...props}\n >\n <XIcon className=\"size-4\" />\n </AutocompletePrimitive.Clear>\n );\n}\n\nfunction AutocompleteTrigger({\n className,\n ...props\n}: React.ComponentProps<typeof AutocompletePrimitive.Trigger>) {\n return (\n <AutocompletePrimitive.Trigger\n data-slot=\"autocomplete-trigger\"\n className={cn(\n \"absolute top-1/2 -translate-y-1/2 cursor-pointer ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none has-[+[data-slot=autocomplete-clear]]:hidden data-disabled:pointer-events-none\",\n className,\n )}\n {...props}\n >\n <ChevronsUpDownIcon className=\"size-4 opacity-70\" />\n </AutocompletePrimitive.Trigger>\n );\n}\n\nfunction AutocompleteArrow({ ...props }: React.ComponentProps<typeof AutocompletePrimitive.Arrow>) {\n return <AutocompletePrimitive.Arrow data-slot=\"autocomplete-arrow\" {...props} />;\n}\n\nfunction AutocompleteSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof AutocompletePrimitive.Separator>) {\n return (\n <AutocompletePrimitive.Separator\n data-slot=\"autocomplete-separator\"\n className={cn(\"my-1.5 h-px bg-border\", className)}\n {...props}\n />\n );\n}\n\nexport {\n Autocomplete,\n AutocompleteArrow,\n AutocompleteBackdrop,\n AutocompleteClear,\n AutocompleteCollection,\n AutocompleteContent,\n AutocompleteEmpty,\n AutocompleteGroup,\n AutocompleteGroupLabel,\n AutocompleteInput,\n AutocompleteItem,\n AutocompleteList,\n AutocompletePortal,\n AutocompletePositioner,\n AutocompleteRow,\n AutocompleteSeparator,\n AutocompleteStatus,\n AutocompleteTrigger,\n AutocompleteValue,\n};\n"],"mappings":";;;;;;;;AASA,MAAM,gBAAgB,IACpB,0hBACA;CACE,UAAU,EACR,MAAM;EACJ,IAAI;EACJ,SACE;EACF,IAAI;CACN,EACF;CACA,iBAAiB,EACf,MAAM,UACR;AACF,CACF;AAEA,MAAM,eAAeA,eAAsB;AAE3C,SAAS,kBAAkB,EAAE,GAAG,SAA4C;CAC1E,OAAO,oBAACA,eAAsB,OAAvB;EAA6B,aAAU;EAAqB,GAAI;CAAQ,CAAA;AACjF;AAEA,SAAS,kBAAkB,EACzB,WACA,OAAO,WACP,YAAY,OACZ,cAAc,OACd,GAAG,SAKA;CACH,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACE,oBAACA,eAAsB,OAAvB;IACE,aAAU;IACV,aAAW;IACX,WAAW,GAAG,cAAc,EAAE,KAAK,CAAC,GAAG,SAAS;IAChD,GAAI;GACL,CAAA;GACA,eAAe,oBAAC,qBAAD,CAAsB,CAAA;GACrC,aAAa,oBAAC,mBAAD,CAAoB,CAAA;EAC/B;;AAET;AAEA,SAAS,mBAAmB,EAAE,WAAW,GAAG,SAA6C;CACvF,OACE,oBAACA,eAAsB,QAAvB;EACE,aAAU;EACV,WAAW,GAAG,iEAAiE,SAAS;EACxF,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,mBAAmB,EAAE,GAAG,SAA6C;CAC5E,OAAO,oBAACA,e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1
+ {"version":3,"file":"autocomplete.js","names":["AutocompletePrimitive"],"sources":["../../../src/components/reui/autocomplete.tsx"],"sourcesContent":["\"use client\";\n\nimport { Autocomplete as AutocompletePrimitive } from \"@base-ui/react/autocomplete\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { ChevronsUpDownIcon, XIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { ScrollArea } from \"../ui/scroll-area\";\n\nconst inputVariants = cva(\n \"flex w-full rounded-lg border border-input bg-transparent text-foreground text-sm outline-none transition-colors placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [[readonly]]:cursor-not-allowed [[readonly]]:bg-muted/80\",\n {\n variants: {\n size: {\n sm: \"h-7 px-2 [&~[data-slot=autocomplete-clear]]:end-1.5 [&~[data-slot=autocomplete-trigger]]:end-1.5\",\n default:\n \"h-8 px-2.5 [&~[data-slot=autocomplete-clear]]:end-1.75 [&~[data-slot=autocomplete-trigger]]:end-1.75\",\n lg: \"h-9 px-2.5 [&~[data-slot=autocomplete-clear]]:end-2 [&~[data-slot=autocomplete-trigger]]:end-2\",\n },\n },\n defaultVariants: {\n size: \"default\",\n },\n },\n);\n\nconst Autocomplete = AutocompletePrimitive.Root;\n\nfunction AutocompleteValue({ ...props }: AutocompletePrimitive.Value.Props) {\n return <AutocompletePrimitive.Value data-slot=\"autocomplete-value\" {...props} />;\n}\n\nfunction AutocompleteInput({\n className,\n size = \"default\",\n showClear = false,\n showTrigger = false,\n ...props\n}: Omit<AutocompletePrimitive.Input.Props, \"size\"> &\n VariantProps<typeof inputVariants> & {\n showClear?: boolean;\n showTrigger?: boolean;\n }) {\n return (\n <div className=\"relative w-full\">\n <AutocompletePrimitive.Input\n data-slot=\"autocomplete-input\"\n data-size={size}\n className={cn(inputVariants({ size }), className)}\n {...props}\n />\n {showTrigger && <AutocompleteTrigger />}\n {showClear && <AutocompleteClear />}\n </div>\n );\n}\n\nfunction AutocompleteStatus({ className, ...props }: AutocompletePrimitive.Status.Props) {\n return (\n <AutocompletePrimitive.Status\n data-slot=\"autocomplete-status\"\n className={cn(\"px-2 py-1.5 text-muted-foreground text-sm empty:m-0 empty:p-0\", className)}\n {...props}\n />\n );\n}\n\nfunction AutocompletePortal({ ...props }: AutocompletePrimitive.Portal.Props) {\n return <AutocompletePrimitive.Portal data-slot=\"autocomplete-portal\" {...props} />;\n}\n\nfunction AutocompleteBackdrop({ ...props }: AutocompletePrimitive.Backdrop.Props) {\n return <AutocompletePrimitive.Backdrop data-slot=\"autocomplete-backdrop\" {...props} />;\n}\n\nfunction AutocompletePositioner({ className, ...props }: AutocompletePrimitive.Positioner.Props) {\n return (\n <AutocompletePrimitive.Positioner\n data-slot=\"autocomplete-positioner\"\n className={cn(\"z-50 outline-none\", className)}\n {...props}\n />\n );\n}\n\nfunction AutocompleteList({\n className,\n scrollAreaClassName,\n ...props\n}: AutocompletePrimitive.List.Props & {\n scrollAreaClassName?: string;\n scrollFade?: boolean;\n scrollbarGutter?: boolean;\n}) {\n return (\n <ScrollArea\n className={cn(\n \"size-full min-h-0 **:data-[slot=scroll-area-viewport]:h-full **:data-[slot=scroll-area-viewport]:overscroll-contain\",\n scrollAreaClassName,\n )}\n >\n <AutocompletePrimitive.List\n data-slot=\"autocomplete-list\"\n className={cn(\n \"in-data-has-overflow-y:me-3 not-empty:scroll-py-1 not-empty:px-1 not-empty:py-1\",\n className,\n )}\n {...props}\n />\n </ScrollArea>\n );\n}\n\nfunction AutocompleteCollection({\n ...props\n}: React.ComponentProps<typeof AutocompletePrimitive.Collection>) {\n return <AutocompletePrimitive.Collection data-slot=\"autocomplete-collection\" {...props} />;\n}\n\nfunction AutocompleteRow({\n className,\n ...props\n}: React.ComponentProps<typeof AutocompletePrimitive.Row>) {\n return (\n <AutocompletePrimitive.Row\n data-slot=\"autocomplete-row\"\n className={cn(\"flex items-center gap-2\", className)}\n {...props}\n />\n );\n}\n\nfunction AutocompleteItem({\n className,\n ...props\n}: React.ComponentProps<typeof AutocompletePrimitive.Item>) {\n return (\n <AutocompletePrimitive.Item\n data-slot=\"autocomplete-item\"\n className={cn(\n \"gap-1.5 text-foreground data-highlighted:text-foreground data-highlighted:before:bg-accent\",\n \"rounded-md\",\n \"data-highlighted:before:rounded-md\",\n // Icon sizing mirrors .cn-select-item. Rhea tracks nova, matching its\n // .cn-input metrics; the row radius above follows .cn-*-item at xl.\n \"relative flex cursor-default select-none items-center px-1.5 py-1 text-sm outline-hidden transition-colors data-disabled:pointer-events-none data-highlighted:relative data-highlighted:z-0 data-disabled:opacity-50 data-highlighted:before:absolute data-highlighted:before:inset-x-0 data-highlighted:before:inset-y-0 data-highlighted:before:z-[-1] [&_svg:not([class*='size-'])]:size-4 [&_svg:not([role=img]):not([class*=text-])]:opacity-60 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport interface AutocompleteContentProps\n extends React.ComponentProps<typeof AutocompletePrimitive.Popup> {\n align?: AutocompletePrimitive.Positioner.Props[\"align\"];\n sideOffset?: AutocompletePrimitive.Positioner.Props[\"sideOffset\"];\n alignOffset?: AutocompletePrimitive.Positioner.Props[\"alignOffset\"];\n side?: AutocompletePrimitive.Positioner.Props[\"side\"];\n anchor?: AutocompletePrimitive.Positioner.Props[\"anchor\"];\n showBackdrop?: boolean;\n}\n\nfunction AutocompleteContent({\n className,\n children,\n showBackdrop = false,\n align = \"start\",\n sideOffset = 4,\n alignOffset = 0,\n side = \"bottom\",\n anchor,\n ...props\n}: AutocompleteContentProps) {\n return (\n <AutocompletePortal>\n {showBackdrop && <AutocompleteBackdrop />}\n <AutocompletePositioner\n align={align}\n sideOffset={sideOffset}\n alignOffset={alignOffset}\n side={side}\n anchor={anchor}\n >\n <div className=\"relative flex max-h-full\">\n <AutocompletePrimitive.Popup\n data-slot=\"autocomplete-popup\"\n className={cn(\n \"flex max-h-[min(var(--available-height),24rem)] w-(--anchor-width) max-w-(--available-width) origin-(--transform-origin) scroll-pt-2 scroll-pb-2 flex-col overscroll-contain rounded-lg bg-popover py-0.5 text-popover-foreground shadow-md ring-1 ring-foreground/10 transition-[scale,opacity] has-data-[side=none]:scale-100 has-data-starting-style:scale-98 has-data-starting-style:opacity-0 has-data-[side=none]:transition-none\",\n className,\n )}\n {...props}\n >\n {children}\n </AutocompletePrimitive.Popup>\n </div>\n </AutocompletePositioner>\n </AutocompletePortal>\n );\n}\n\nfunction AutocompleteGroup({ ...props }: React.ComponentProps<typeof AutocompletePrimitive.Group>) {\n return <AutocompletePrimitive.Group data-slot=\"autocomplete-group\" {...props} />;\n}\n\nfunction AutocompleteGroupLabel({\n className,\n ...props\n}: React.ComponentProps<typeof AutocompletePrimitive.GroupLabel>) {\n return (\n <AutocompletePrimitive.GroupLabel\n data-slot=\"autocomplete-group-label\"\n className={cn(\"px-1.5 py-1 font-medium text-muted-foreground text-xs\", className)}\n {...props}\n />\n );\n}\n\nfunction AutocompleteEmpty({\n className,\n ...props\n}: React.ComponentProps<typeof AutocompletePrimitive.Empty>) {\n return (\n <AutocompletePrimitive.Empty\n data-slot=\"autocomplete-empty\"\n className={cn(\n \"px-2 py-1.5 text-center text-muted-foreground text-sm empty:m-0 empty:p-0\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction AutocompleteClear({\n className,\n ...props\n}: React.ComponentProps<typeof AutocompletePrimitive.Clear>) {\n return (\n <AutocompletePrimitive.Clear\n data-slot=\"autocomplete-clear\"\n className={cn(\n \"absolute top-1/2 -translate-y-1/2 cursor-pointer opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-disabled:pointer-events-none\",\n className,\n )}\n {...props}\n >\n <XIcon className=\"size-4\" />\n </AutocompletePrimitive.Clear>\n );\n}\n\nfunction AutocompleteTrigger({\n className,\n ...props\n}: React.ComponentProps<typeof AutocompletePrimitive.Trigger>) {\n return (\n <AutocompletePrimitive.Trigger\n data-slot=\"autocomplete-trigger\"\n className={cn(\n \"absolute top-1/2 -translate-y-1/2 cursor-pointer ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none has-[+[data-slot=autocomplete-clear]]:hidden data-disabled:pointer-events-none\",\n className,\n )}\n {...props}\n >\n <ChevronsUpDownIcon className=\"size-4 opacity-70\" />\n </AutocompletePrimitive.Trigger>\n );\n}\n\nfunction AutocompleteArrow({ ...props }: React.ComponentProps<typeof AutocompletePrimitive.Arrow>) {\n return <AutocompletePrimitive.Arrow data-slot=\"autocomplete-arrow\" {...props} />;\n}\n\nfunction AutocompleteSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof AutocompletePrimitive.Separator>) {\n return (\n <AutocompletePrimitive.Separator\n data-slot=\"autocomplete-separator\"\n className={cn(\"my-1.5 h-px bg-border\", className)}\n {...props}\n />\n );\n}\n\nexport {\n Autocomplete,\n AutocompleteArrow,\n AutocompleteBackdrop,\n AutocompleteClear,\n AutocompleteCollection,\n AutocompleteContent,\n AutocompleteEmpty,\n AutocompleteGroup,\n AutocompleteGroupLabel,\n AutocompleteInput,\n AutocompleteItem,\n AutocompleteList,\n AutocompletePortal,\n AutocompletePositioner,\n AutocompleteRow,\n AutocompleteSeparator,\n AutocompleteStatus,\n AutocompleteTrigger,\n AutocompleteValue,\n};\n"],"mappings":";;;;;;;;AASA,MAAM,gBAAgB,IACpB,0hBACA;CACE,UAAU,EACR,MAAM;EACJ,IAAI;EACJ,SACE;EACF,IAAI;CACN,EACF;CACA,iBAAiB,EACf,MAAM,UACR;AACF,CACF;AAEA,MAAM,eAAeA,eAAsB;AAE3C,SAAS,kBAAkB,EAAE,GAAG,SAA4C;CAC1E,OAAO,oBAACA,eAAsB,OAAvB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AAvB;EACE,aAAU;EACV,WAAW,GACT,8PACA,SACF;EACA,GAAI;EAEJ,UAAA,oBAAC,OAAD,EAAO,WAAU,SAAU,CAAA;CACA,CAAA;AAEjC;AAEA,SAAS,oBAAoB,EAC3B,WACA,GAAG,SAC0D;CAC7D,OACE,oBAACA,eAAsB,SAAvB;EACE,aAAU;EACV,WAAW,GACT,2PACA,SACF;EACA,GAAI;EAEJ,UAAA,oBAAC,oBAAD,EAAoB,WAAU,oBAAqB,CAAA;CACtB,CAAA;AAEnC;AAEA,SAAS,kBAAkB,EAAE,GAAG,SAAmE;CACjG,OAAO,oBAACA,eAAsB,OAAvB;EAA6B,aAAU;EAAqB,GAAI;CAAQ,CAAA;AACjF;AAEA,SAAS,sBAAsB,EAC7B,WACA,GAAG,SAC4D;CAC/D,OACE,oBAACA,eAAsB,WAAvB;EACE,aAAU;EACV,WAAW,GAAG,yBAAyB,SAAS;EAChD,GAAI;CACL,CAAA;AAEL"}
@@ -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?: "default" | "outline" | "secondary" | "info" | "success" | "warning" | "destructive" | "focus" | "invert" | "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?: "outline" | "secondary" | "default" | "success" | "destructive" | "info" | "warning" | "focus" | "invert" | "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 +1 @@
1
- {"version":3,"file":"cascader-virtual.d.ts","names":[],"sources":["../../../../src/components/reui/cascader/cascader-virtual.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;iBAmCiB;EACf;EACA,wBAAwB;EACxB;EACA;;EAEA,aAAa;;EAEb;;YAGU,sBAAsB,YAAY,aAAa;;;;;;;wBAQ3C,yBACd,OACA,kBACA,cACA,UACA,YACA,eACC,gCAAgC;iBAsHlB;;EAEf;;EAEA;;;;;;;;;iBAUO,qBAAqB,OAAO,4BAAyB,QAAA,IAAA;iBA2F7C,mCAAmC;EAClD,QAAQ;;;;;;;;;iBAUD,wBAAwB,QAAQ,cAAc,YAAY,6BAA0B,QAAA,IAAA"}
1
+ {"version":3,"file":"cascader-virtual.d.ts","names":[],"sources":["../../../../src/components/reui/cascader/cascader-virtual.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;iBAmCiB;EACf;EACA,wBAAwB;EACxB;EACA;;EAEA,aAAa;;EAEb;;YAGU,sBAAsB,YAAY,aAAa;;;;;;;wBAQ3C,yBACd,OACA,kBACA,cACA,UACA,YACA,eACC,gCAAgC;iBAuHlB;;EAEf;;EAEA;;;;;;;;;iBAUO,qBAAqB,OAAO,4BAAyB,QAAA,IAAA;iBAgG7C,mCAAmC;EAClD,QAAQ;;;;;;;;;iBAUD,wBAAwB,QAAQ,cAAc,YAAY,6BAA0B,QAAA,IAAA"}
@@ -105,6 +105,7 @@ function CascaderVirtualItems(props) {
105
105
  return /* @__PURE__ */ jsx(CascaderVirtualRows, { ...props });
106
106
  }
107
107
  function CascaderVirtualRows({ estimateSize, overscan }) {
108
+ "use no memo";
108
109
  const { estimateRowSize, overscan: rootOverscan, mode, isBranch, isSelectable, isSelected, isIndeterminate } = useCascaderActions();
109
110
  const { renderedItems, treeRows, deepResults, loadStates } = useCascaderState();
110
111
  const highlight = useCascaderHighlight();
@@ -187,6 +188,7 @@ function CascaderVirtualActiveColumnRows(props) {
187
188
  });
188
189
  }
189
190
  function CascaderVirtualColumnRows({ column, estimateSize, overscan, activeIndex }) {
191
+ "use no memo";
190
192
  const { estimateRowSize, overscan: rootOverscan, baseId, isBranch, isSelectable, isSelected, isIndeterminate } = useCascaderActions();
191
193
  const { loadStates } = useCascaderState();
192
194
  const [contentElement, setContentElement] = React$1.useState(null);
@@ -1 +1 @@
1
- {"version":3,"file":"cascader-virtual.js","names":["React"],"sources":["../../../../src/components/reui/cascader/cascader-virtual.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport {\n defaultRangeExtractor,\n type Range,\n useVirtualizer,\n type Virtualizer,\n} from \"@tanstack/react-virtual\";\n\nimport { CascaderColumnPanel } from \"./cascader-columns\";\nimport type { CascaderColumn } from \"./cascader-context\";\nimport { useCascaderActions, useCascaderHighlight, useCascaderState } from \"./cascader-context\";\nimport { CascaderItem, CascaderItems, getCascaderMoreProps } from \"./cascader-item\";\n\n/**\n * Windowing for the cascader, in its own file so the primitive's own install\n * never pulls `@tanstack/react-virtual` in. Base UI forces three rules:\n *\n * 1. A windowed row MUST carry an explicit `index`; the fallback\n * `findItemIndex` is O(n) per row and returns `-1` on the frame a level swap\n * renders empty, dangling `aria-activedescendant`.\n * 2. That index is DESTRUCTIVE while unvirtualized (`useCompositeListItem`\n * skips registration, `CompositeList` truncates `elementsRef` to zero and\n * the first arrow key highlights nothing), so rows stay plain until the root\n * flips `virtualized`, gated inside `CascaderItem`.\n * 3. No `Combobox.Collection` and no FUNCTION CHILD on `Combobox.List`, which\n * implicitly wraps one in a Collection: a Collection renders every filtered\n * item.\n */\n\n/* -------------------------------------------------------------------------- */\n/* Virtualizer */\n/* -------------------------------------------------------------------------- */\n\nexport interface UseCascaderVirtualizerOptions {\n count: number;\n getScrollElement: () => HTMLElement | null;\n estimateSize?: number;\n overscan?: number;\n /** Key rows by node value, never by index: a tree expand shifts every index. */\n getItemKey: (index: number) => string | number;\n /** Render index of the highlighted row, or `-1`. Pinned into the window. */\n activeIndex?: number;\n}\n\nexport type CascaderVirtualizer = Virtualizer<HTMLElement, HTMLElement>;\n\n/**\n * The cascader's virtualizer: TanStack plus the highlight pinning and\n * scroll-into-view a combobox list needs. `activeIndex` is clamped here, not by\n * the caller: emitted from a layout effect, it can be one commit ahead of a\n * level that just shrank and would otherwise scroll to a row that is gone.\n */\nexport function useCascaderVirtualizer({\n count,\n getScrollElement,\n estimateSize = 32,\n overscan = 8,\n getItemKey,\n activeIndex = -1,\n}: UseCascaderVirtualizerOptions): CascaderVirtualizer {\n const active = activeIndex >= 0 && activeIndex < count ? activeIndex : -1;\n\n // Keeps the highlighted row mounted so `aria-activedescendant` never dangles.\n const rangeExtractor = React.useCallback(\n (range: Range) => {\n const indices = new Set(defaultRangeExtractor(range));\n if (active !== -1) indices.add(active);\n return Array.from(indices).sort((a, b) => a - b);\n },\n [active],\n );\n\n const measureEstimate = React.useCallback(() => estimateSize, [estimateSize]);\n\n // React Compiler bails on `useVirtualizer`; harmless, rows memoise one by one.\n const virtualizer = useVirtualizer<HTMLElement, HTMLElement>({\n count,\n getScrollElement,\n estimateSize: measureEstimate,\n overscan,\n getItemKey,\n rangeExtractor,\n });\n\n // Base UI's scroll-into-view no-ops on a windowed-out row (empty `listRef`).\n React.useEffect(() => {\n if (active === -1) return;\n virtualizer.scrollToIndex(active, { align: \"auto\" });\n }, [active, virtualizer]);\n\n return virtualizer;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Geometry */\n/* -------------------------------------------------------------------------- */\n\ninterface CascaderVirtualGutter {\n block: number;\n inline: number;\n}\n\nconst NO_GUTTER: CascaderVirtualGutter = { block: 0, inline: 0 };\n\n/**\n * The ROWS' BOX's own padding, never the scrollport's (separate element, reads\n * a flat zero). Measured because every style sets its own: a windowed row is\n * positioned against this box's PADDING box while the scroll-height spacer is\n * an in-flow child of its CONTENT box, so without it rows sit flush.\n */\nfunction useCascaderVirtualGutter(contentElement: HTMLElement | null): CascaderVirtualGutter {\n const [gutter, setGutter] = React.useState<CascaderVirtualGutter>(NO_GUTTER);\n\n React.useLayoutEffect(() => {\n if (!contentElement) return;\n const styles = getComputedStyle(contentElement);\n const block = Number.parseFloat(styles.paddingTop) || 0;\n const inline = Number.parseFloat(styles.paddingInlineStart || styles.paddingLeft) || 0;\n setGutter((previous) =>\n previous.block === block && previous.inline === inline ? previous : { block, inline },\n );\n }, [contentElement]);\n\n return gutter;\n}\n\n/** Logical insets, not `left` / `width`, so RTL needs no second code path. */\nfunction cascaderVirtualRowStyle(\n start: number,\n gutter: CascaderVirtualGutter,\n): React.CSSProperties {\n return {\n position: \"absolute\",\n top: 0,\n insetInlineStart: gutter.inline,\n insetInlineEnd: gutter.inline,\n transform: `translateY(${start + gutter.block}px)`,\n };\n}\n\n/**\n * The element that actually SCROLLS: the `ScrollArea` viewport above the rows'\n * box, not the rows' box itself, which never overflows, so a virtualizer aimed\n * at it would read a full `clientHeight` and render every row. `closest` rather\n * than `parentElement`, plus a fallback to the content element, keeps a\n * hand-written `overflow-y-auto` container working.\n */\nfunction cascaderScrollElement(content: HTMLElement | null): HTMLElement | null {\n if (!content) return null;\n return content.closest<HTMLElement>('[data-slot=\"scroll-area-viewport\"]') ?? content;\n}\n\n/**\n * `role=\"presentation\"` keeps the listbox owning nothing but options, and this\n * node's parent IS the rows' box, saving a ref threaded through `CascaderList`.\n */\nfunction CascaderVirtualSpacer({\n height,\n onContentElement,\n}: {\n height: number;\n onContentElement: (element: HTMLElement | null) => void;\n}) {\n return (\n <div\n ref={(node) => onContentElement(node?.parentElement ?? null)}\n role=\"presentation\"\n data-slot=\"cascader-virtual-spacer\"\n style={{ height }}\n />\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Rows */\n/* -------------------------------------------------------------------------- */\n\nexport interface CascaderVirtualItemsProps {\n /** Row height before measurement. Defaults to the root `estimateRowSize`. */\n estimateSize?: number;\n /** Rows rendered beyond each edge. Defaults to the root `overscan`. */\n overscan?: number;\n}\n\n/**\n * Windowed replacement for `CascaderItems`, dropped inside `CascaderList`. The\n * registration is a LAYOUT effect because the root derives `virtualized` from\n * it and the flip has to land before the browser paints. Until the root has\n * seen it, this renders exactly what `CascaderItems` does, so no frame carries\n * indexed rows while Base UI still owns the composite list.\n */\nfunction CascaderVirtualItems(props: CascaderVirtualItemsProps) {\n const { virtualized, registerVirtualRenderer } = useCascaderActions();\n\n React.useLayoutEffect(() => registerVirtualRenderer(), [registerVirtualRenderer]);\n\n if (!virtualized) return <CascaderItems />;\n\n return <CascaderVirtualRows {...props} />;\n}\n\nfunction CascaderVirtualRows({ estimateSize, overscan }: CascaderVirtualItemsProps) {\n const {\n estimateRowSize,\n overscan: rootOverscan,\n mode,\n isBranch,\n isSelectable,\n isSelected,\n isIndeterminate,\n } = useCascaderActions();\n const { renderedItems, treeRows, deepResults, loadStates } = useCascaderState();\n // Re-renders on every highlight change, and has to: the pinned row and the\n // scroll target are both derived from it.\n const highlight = useCascaderHighlight();\n\n const [contentElement, setContentElement] = React.useState<HTMLElement | null>(null);\n const gutter = useCascaderVirtualGutter(contentElement);\n\n const tree = mode === \"tree\";\n const count = tree ? treeRows.length : renderedItems.length;\n const showPath = !tree && deepResults !== null;\n\n const getItemKey = React.useCallback(\n (index: number) => (tree ? treeRows[index]?.node.value : renderedItems[index]?.value) ?? index,\n [tree, treeRows, renderedItems],\n );\n\n const virtualizer = useCascaderVirtualizer({\n count,\n getScrollElement: () => cascaderScrollElement(contentElement),\n estimateSize: estimateSize ?? estimateRowSize,\n overscan: overscan ?? rootOverscan,\n getItemKey,\n activeIndex: highlight.index,\n });\n\n return (\n <>\n <CascaderVirtualSpacer\n height={virtualizer.getTotalSize()}\n onContentElement={setContentElement}\n />\n {virtualizer.getVirtualItems().map((row) => {\n const flat = tree ? treeRows[row.index] : undefined;\n const node = tree ? flat?.node : renderedItems[row.index];\n // For one commit after a query narrows the level, the window can name\n // a row it no longer has; the count recomputes on the same tick.\n if (!node) return null;\n\n return (\n <CascaderItem\n key={row.key}\n /* Measured, not estimated: rows are two lines with a `description`\n and three in deep search, and row height is per style. An\n estimate alone would make `scrollToIndex` land on the wrong row. */\n ref={virtualizer.measureElement}\n data-index={row.index}\n style={cascaderVirtualRowStyle(row.start, gutter)}\n node={node}\n index={row.index}\n depth={flat?.depth}\n expanded={flat?.expanded}\n branch={flat ? flat.branch : isBranch(node)}\n selectable={isSelectable(node)}\n selected={isSelected(node)}\n indeterminate={isIndeterminate(node)}\n {...getCascaderMoreProps(node, loadStates)}\n showPath={showPath}\n aria-setsize={flat ? flat.setSize : count}\n aria-posinset={flat ? flat.posInSet : row.index + 1}\n />\n );\n })}\n </>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Column */\n/* -------------------------------------------------------------------------- */\n\nexport interface CascaderVirtualColumnProps extends CascaderVirtualItemsProps {\n column: CascaderColumn;\n}\n\n/**\n * Windowed replacement for one Miller column, passed through the\n * `CascaderColumns` render slot. One virtualizer PER COLUMN, since columns\n * scroll independently, and only the deepest is Base UI's listbox: the trail\n * behind is `as=\"button\"` rows outside Base UI, so it windows on its own row\n * count rather than waiting for the root to flip.\n */\nfunction CascaderVirtualColumn({ column, estimateSize, overscan }: CascaderVirtualColumnProps) {\n const { virtualized, registerVirtualRenderer, virtualize, virtualizeThreshold } =\n useCascaderActions();\n\n React.useLayoutEffect(() => registerVirtualRenderer(), [registerVirtualRenderer]);\n\n const windowed = column.active\n ? virtualized\n : (virtualize ?? column.items.length >= virtualizeThreshold);\n\n if (!windowed) return <CascaderColumnPanel column={column} />;\n\n return (\n <CascaderColumnPanel column={column} virtualized>\n {column.active ? (\n <CascaderVirtualActiveColumnRows\n column={column}\n estimateSize={estimateSize}\n overscan={overscan}\n />\n ) : (\n <CascaderVirtualColumnRows\n column={column}\n estimateSize={estimateSize}\n overscan={overscan}\n activeIndex={-1}\n />\n )}\n </CascaderColumnPanel>\n );\n}\n\n/** Only the active column subscribes to the highlight; a trail column must not. */\nfunction CascaderVirtualActiveColumnRows(props: CascaderVirtualColumnProps) {\n const highlight = useCascaderHighlight();\n return <CascaderVirtualColumnRows {...props} activeIndex={highlight.index} />;\n}\n\nfunction CascaderVirtualColumnRows({\n column,\n estimateSize,\n overscan,\n activeIndex,\n}: CascaderVirtualColumnProps & { activeIndex: number }) {\n const {\n estimateRowSize,\n overscan: rootOverscan,\n baseId,\n isBranch,\n isSelectable,\n isSelected,\n isIndeterminate,\n } = useCascaderActions();\n const { loadStates } = useCascaderState();\n\n const [contentElement, setContentElement] = React.useState<HTMLElement | null>(null);\n const gutter = useCascaderVirtualGutter(contentElement);\n\n const items = column.items;\n const getItemKey = React.useCallback((index: number) => items[index]?.value ?? index, [items]);\n\n const virtualizer = useCascaderVirtualizer({\n count: items.length,\n getScrollElement: () => cascaderScrollElement(contentElement),\n estimateSize: estimateSize ?? estimateRowSize,\n overscan: overscan ?? rootOverscan,\n getItemKey,\n activeIndex,\n });\n\n return (\n <>\n <CascaderVirtualSpacer\n height={virtualizer.getTotalSize()}\n onContentElement={setContentElement}\n />\n {virtualizer.getVirtualItems().map((row) => {\n const node = items[row.index];\n if (!node) return null;\n const open = node.value === column.activeValue;\n\n return (\n <CascaderItem\n key={row.key}\n ref={virtualizer.measureElement}\n data-index={row.index}\n style={cascaderVirtualRowStyle(row.start, gutter)}\n node={node}\n as={column.active ? \"option\" : \"button\"}\n depth={column.depth}\n branch={isBranch(node)}\n selectable={isSelectable(node)}\n selected={isSelected(node)}\n indeterminate={isIndeterminate(node)}\n {...getCascaderMoreProps(node, loadStates)}\n data-open={open || undefined}\n className={open ? \"bg-accent/60 text-accent-foreground\" : undefined}\n /* Only the listbox column may carry an index or listbox metadata.\n A trail row is a `role=\"button\"`, which allows neither. */\n {...(column.active\n ? {\n index: row.index,\n \"aria-setsize\": items.length,\n \"aria-posinset\": row.index + 1,\n }\n : null)}\n {...(!column.active && open\n ? {\n \"aria-expanded\": true,\n \"aria-controls\": `${baseId}-column-${column.depth + 1}`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W,QAAQ,KAAA;GACnB,WAAW,OAAO,wCAAwC,KAAA;GAG1D,GAAK,OAAO,SACR;IACE,OAAO,IAAI;IACX,gBAAgB,MAAM;IACtB,iBAAiB,IAAI,QAAQ;GAC/B,IACA;GACJ,GAAK,CAAC,OAAO,UAAU,OACnB;IACE,iBAAiB;IACjB,iBAAiB,GAAG,OAAO,UAAU,OAAO,QAAQ;GACtD,IACA;EACL,GA7BM,IAAI,GA6BV;CAEL,CAAC,CACD,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"cascader-virtual.js","names":["React"],"sources":["../../../../src/components/reui/cascader/cascader-virtual.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport {\n defaultRangeExtractor,\n type Range,\n useVirtualizer,\n type Virtualizer,\n} from \"@tanstack/react-virtual\";\n\nimport { CascaderColumnPanel } from \"./cascader-columns\";\nimport type { CascaderColumn } from \"./cascader-context\";\nimport { useCascaderActions, useCascaderHighlight, useCascaderState } from \"./cascader-context\";\nimport { CascaderItem, CascaderItems, getCascaderMoreProps } from \"./cascader-item\";\n\n/**\n * Windowing for the cascader, in its own file so the primitive's own install\n * never pulls `@tanstack/react-virtual` in. Base UI forces three rules:\n *\n * 1. A windowed row MUST carry an explicit `index`; the fallback\n * `findItemIndex` is O(n) per row and returns `-1` on the frame a level swap\n * renders empty, dangling `aria-activedescendant`.\n * 2. That index is DESTRUCTIVE while unvirtualized (`useCompositeListItem`\n * skips registration, `CompositeList` truncates `elementsRef` to zero and\n * the first arrow key highlights nothing), so rows stay plain until the root\n * flips `virtualized`, gated inside `CascaderItem`.\n * 3. No `Combobox.Collection` and no FUNCTION CHILD on `Combobox.List`, which\n * implicitly wraps one in a Collection: a Collection renders every filtered\n * item.\n */\n\n/* -------------------------------------------------------------------------- */\n/* Virtualizer */\n/* -------------------------------------------------------------------------- */\n\nexport interface UseCascaderVirtualizerOptions {\n count: number;\n getScrollElement: () => HTMLElement | null;\n estimateSize?: number;\n overscan?: number;\n /** Key rows by node value, never by index: a tree expand shifts every index. */\n getItemKey: (index: number) => string | number;\n /** Render index of the highlighted row, or `-1`. Pinned into the window. */\n activeIndex?: number;\n}\n\nexport type CascaderVirtualizer = Virtualizer<HTMLElement, HTMLElement>;\n\n/**\n * The cascader's virtualizer: TanStack plus the highlight pinning and\n * scroll-into-view a combobox list needs. `activeIndex` is clamped here, not by\n * the caller: emitted from a layout effect, it can be one commit ahead of a\n * level that just shrank and would otherwise scroll to a row that is gone.\n */\nexport function useCascaderVirtualizer({\n count,\n getScrollElement,\n estimateSize = 32,\n overscan = 8,\n getItemKey,\n activeIndex = -1,\n}: UseCascaderVirtualizerOptions): CascaderVirtualizer {\n const active = activeIndex >= 0 && activeIndex < count ? activeIndex : -1;\n\n // Keeps the highlighted row mounted so `aria-activedescendant` never dangles.\n const rangeExtractor = React.useCallback(\n (range: Range) => {\n const indices = new Set(defaultRangeExtractor(range));\n if (active !== -1) indices.add(active);\n return Array.from(indices).sort((a, b) => a - b);\n },\n [active],\n );\n\n const measureEstimate = React.useCallback(() => estimateSize, [estimateSize]);\n\n // React Compiler bails on `useVirtualizer` HERE, and only here - the bail does not\n // propagate to the components that call this hook. They opt out themselves.\n const virtualizer = useVirtualizer<HTMLElement, HTMLElement>({\n count,\n getScrollElement,\n estimateSize: measureEstimate,\n overscan,\n getItemKey,\n rangeExtractor,\n });\n\n // Base UI's scroll-into-view no-ops on a windowed-out row (empty `listRef`).\n React.useEffect(() => {\n if (active === -1) return;\n virtualizer.scrollToIndex(active, { align: \"auto\" });\n }, [active, virtualizer]);\n\n return virtualizer;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Geometry */\n/* -------------------------------------------------------------------------- */\n\ninterface CascaderVirtualGutter {\n block: number;\n inline: number;\n}\n\nconst NO_GUTTER: CascaderVirtualGutter = { block: 0, inline: 0 };\n\n/**\n * The ROWS' BOX's own padding, never the scrollport's (separate element, reads\n * a flat zero). Measured because every style sets its own: a windowed row is\n * positioned against this box's PADDING box while the scroll-height spacer is\n * an in-flow child of its CONTENT box, so without it rows sit flush.\n */\nfunction useCascaderVirtualGutter(contentElement: HTMLElement | null): CascaderVirtualGutter {\n const [gutter, setGutter] = React.useState<CascaderVirtualGutter>(NO_GUTTER);\n\n React.useLayoutEffect(() => {\n if (!contentElement) return;\n const styles = getComputedStyle(contentElement);\n const block = Number.parseFloat(styles.paddingTop) || 0;\n const inline = Number.parseFloat(styles.paddingInlineStart || styles.paddingLeft) || 0;\n setGutter((previous) =>\n previous.block === block && previous.inline === inline ? previous : { block, inline },\n );\n }, [contentElement]);\n\n return gutter;\n}\n\n/** Logical insets, not `left` / `width`, so RTL needs no second code path. */\nfunction cascaderVirtualRowStyle(\n start: number,\n gutter: CascaderVirtualGutter,\n): React.CSSProperties {\n return {\n position: \"absolute\",\n top: 0,\n insetInlineStart: gutter.inline,\n insetInlineEnd: gutter.inline,\n transform: `translateY(${start + gutter.block}px)`,\n };\n}\n\n/**\n * The element that actually SCROLLS: the `ScrollArea` viewport above the rows'\n * box, not the rows' box itself, which never overflows, so a virtualizer aimed\n * at it would read a full `clientHeight` and render every row. `closest` rather\n * than `parentElement`, plus a fallback to the content element, keeps a\n * hand-written `overflow-y-auto` container working.\n */\nfunction cascaderScrollElement(content: HTMLElement | null): HTMLElement | null {\n if (!content) return null;\n return content.closest<HTMLElement>('[data-slot=\"scroll-area-viewport\"]') ?? content;\n}\n\n/**\n * `role=\"presentation\"` keeps the listbox owning nothing but options, and this\n * node's parent IS the rows' box, saving a ref threaded through `CascaderList`.\n */\nfunction CascaderVirtualSpacer({\n height,\n onContentElement,\n}: {\n height: number;\n onContentElement: (element: HTMLElement | null) => void;\n}) {\n return (\n <div\n ref={(node) => onContentElement(node?.parentElement ?? null)}\n role=\"presentation\"\n data-slot=\"cascader-virtual-spacer\"\n style={{ height }}\n />\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Rows */\n/* -------------------------------------------------------------------------- */\n\nexport interface CascaderVirtualItemsProps {\n /** Row height before measurement. Defaults to the root `estimateRowSize`. */\n estimateSize?: number;\n /** Rows rendered beyond each edge. Defaults to the root `overscan`. */\n overscan?: number;\n}\n\n/**\n * Windowed replacement for `CascaderItems`, dropped inside `CascaderList`. The\n * registration is a LAYOUT effect because the root derives `virtualized` from\n * it and the flip has to land before the browser paints. Until the root has\n * seen it, this renders exactly what `CascaderItems` does, so no frame carries\n * indexed rows while Base UI still owns the composite list.\n */\nfunction CascaderVirtualItems(props: CascaderVirtualItemsProps) {\n const { virtualized, registerVirtualRenderer } = useCascaderActions();\n\n React.useLayoutEffect(() => registerVirtualRenderer(), [registerVirtualRenderer]);\n\n if (!virtualized) return <CascaderItems />;\n\n return <CascaderVirtualRows {...props} />;\n}\n\nfunction CascaderVirtualRows({ estimateSize, overscan }: CascaderVirtualItemsProps) {\n /* The `useCascaderVirtualizer` bail does NOT reach here: the compiler caches\n `getVirtualItems()` on the virtualizer, whose identity never changes, so the\n window freezes on scroll. Inert where no compiler runs. */\n \"use no memo\";\n\n const {\n estimateRowSize,\n overscan: rootOverscan,\n mode,\n isBranch,\n isSelectable,\n isSelected,\n isIndeterminate,\n } = useCascaderActions();\n const { renderedItems, treeRows, deepResults, loadStates } = useCascaderState();\n // Re-renders on every highlight change, and has to: the pinned row and the\n // scroll target are both derived from it.\n const highlight = useCascaderHighlight();\n\n const [contentElement, setContentElement] = React.useState<HTMLElement | null>(null);\n const gutter = useCascaderVirtualGutter(contentElement);\n\n const tree = mode === \"tree\";\n const count = tree ? treeRows.length : renderedItems.length;\n const showPath = !tree && deepResults !== null;\n\n const getItemKey = React.useCallback(\n (index: number) => (tree ? treeRows[index]?.node.value : renderedItems[index]?.value) ?? index,\n [tree, treeRows, renderedItems],\n );\n\n const virtualizer = useCascaderVirtualizer({\n count,\n getScrollElement: () => cascaderScrollElement(contentElement),\n estimateSize: estimateSize ?? estimateRowSize,\n overscan: overscan ?? rootOverscan,\n getItemKey,\n activeIndex: highlight.index,\n });\n\n return (\n <>\n <CascaderVirtualSpacer\n height={virtualizer.getTotalSize()}\n onContentElement={setContentElement}\n />\n {virtualizer.getVirtualItems().map((row) => {\n const flat = tree ? treeRows[row.index] : undefined;\n const node = tree ? flat?.node : renderedItems[row.index];\n // For one commit after a query narrows the level, the window can name\n // a row it no longer has; the count recomputes on the same tick.\n if (!node) return null;\n\n return (\n <CascaderItem\n key={row.key}\n /* Measured, not estimated: rows are two lines with a `description`\n and three in deep search, and row height is per style. An\n estimate alone would make `scrollToIndex` land on the wrong row. */\n ref={virtualizer.measureElement}\n data-index={row.index}\n style={cascaderVirtualRowStyle(row.start, gutter)}\n node={node}\n index={row.index}\n depth={flat?.depth}\n expanded={flat?.expanded}\n branch={flat ? flat.branch : isBranch(node)}\n selectable={isSelectable(node)}\n selected={isSelected(node)}\n indeterminate={isIndeterminate(node)}\n {...getCascaderMoreProps(node, loadStates)}\n showPath={showPath}\n aria-setsize={flat ? flat.setSize : count}\n aria-posinset={flat ? flat.posInSet : row.index + 1}\n />\n );\n })}\n </>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Column */\n/* -------------------------------------------------------------------------- */\n\nexport interface CascaderVirtualColumnProps extends CascaderVirtualItemsProps {\n column: CascaderColumn;\n}\n\n/**\n * Windowed replacement for one Miller column, passed through the\n * `CascaderColumns` render slot. One virtualizer PER COLUMN, since columns\n * scroll independently, and only the deepest is Base UI's listbox: the trail\n * behind is `as=\"button\"` rows outside Base UI, so it windows on its own row\n * count rather than waiting for the root to flip.\n */\nfunction CascaderVirtualColumn({ column, estimateSize, overscan }: CascaderVirtualColumnProps) {\n const { virtualized, registerVirtualRenderer, virtualize, virtualizeThreshold } =\n useCascaderActions();\n\n React.useLayoutEffect(() => registerVirtualRenderer(), [registerVirtualRenderer]);\n\n const windowed = column.active\n ? virtualized\n : (virtualize ?? column.items.length >= virtualizeThreshold);\n\n if (!windowed) return <CascaderColumnPanel column={column} />;\n\n return (\n <CascaderColumnPanel column={column} virtualized>\n {column.active ? (\n <CascaderVirtualActiveColumnRows\n column={column}\n estimateSize={estimateSize}\n overscan={overscan}\n />\n ) : (\n <CascaderVirtualColumnRows\n column={column}\n estimateSize={estimateSize}\n overscan={overscan}\n activeIndex={-1}\n />\n )}\n </CascaderColumnPanel>\n );\n}\n\n/** Only the active column subscribes to the highlight; a trail column must not. */\nfunction CascaderVirtualActiveColumnRows(props: CascaderVirtualColumnProps) {\n const highlight = useCascaderHighlight();\n return <CascaderVirtualColumnRows {...props} activeIndex={highlight.index} />;\n}\n\nfunction CascaderVirtualColumnRows({\n column,\n estimateSize,\n overscan,\n activeIndex,\n}: CascaderVirtualColumnProps & { activeIndex: number }) {\n /* The `useCascaderVirtualizer` bail does NOT reach here: the compiler caches\n `getVirtualItems()` on the virtualizer, whose identity never changes, so the\n window freezes on scroll. Inert where no compiler runs. */\n \"use no memo\";\n\n const {\n estimateRowSize,\n overscan: rootOverscan,\n baseId,\n isBranch,\n isSelectable,\n isSelected,\n isIndeterminate,\n } = useCascaderActions();\n const { loadStates } = useCascaderState();\n\n const [contentElement, setContentElement] = React.useState<HTMLElement | null>(null);\n const gutter = useCascaderVirtualGutter(contentElement);\n\n const items = column.items;\n const getItemKey = React.useCallback((index: number) => items[index]?.value ?? index, [items]);\n\n const virtualizer = useCascaderVirtualizer({\n count: items.length,\n getScrollElement: () => cascaderScrollElement(contentElement),\n estimateSize: estimateSize ?? estimateRowSize,\n overscan: overscan ?? rootOverscan,\n getItemKey,\n activeIndex,\n });\n\n return (\n <>\n <CascaderVirtualSpacer\n height={virtualizer.getTotalSize()}\n onContentElement={setContentElement}\n />\n {virtualizer.getVirtualItems().map((row) => {\n const node = items[row.index];\n if (!node) return null;\n const open = node.value === column.activeValue;\n\n return (\n <CascaderItem\n key={row.key}\n ref={virtualizer.measureElement}\n data-index={row.index}\n style={cascaderVirtualRowStyle(row.start, gutter)}\n node={node}\n as={column.active ? \"option\" : \"button\"}\n depth={column.depth}\n branch={isBranch(node)}\n selectable={isSelectable(node)}\n selected={isSelected(node)}\n indeterminate={isIndeterminate(node)}\n {...getCascaderMoreProps(node, loadStates)}\n data-open={open || undefined}\n className={open ? \"bg-accent/60 text-accent-foreground\" : undefined}\n /* Only the listbox column may carry an index or listbox metadata.\n A trail row is a `role=\"button\"`, which allows neither. */\n {...(column.active\n ? {\n index: row.index,\n \"aria-setsize\": items.length,\n \"aria-posinset\": row.index + 1,\n }\n : null)}\n {...(!column.active && open\n ? {\n \"aria-expanded\": true,\n \"aria-controls\": `${baseId}-column-${column.depth + 1}`,\n }\n : null)}\n />\n );\n })}\n </>\n );\n}\n\nexport { CascaderVirtualColumn, CascaderVirtualItems };\n"],"mappings":";;;;;;;;;;;;;;AAsDA,SAAgB,uBAAuB,EACrC,OACA,kBACA,eAAe,IACf,WAAW,GACX,YACA,cAAc,MACuC;CACrD,MAAM,SAAS,eAAe,KAAK,cAAc,QAAQ,cAAc;CAGvE,MAAM,iBAAiBA,QAAM,aAC1B,UAAiB;EAChB,MAAM,UAAU,IAAI,IAAI,sBAAsB,KAAK,CAAC;EACpD,IAAI,WAAW,IAAI,QAAQ,IAAI,MAAM;EACrC,OAAO,MAAM,KAAK,OAAO,CAAC,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC;CACjD,GACA,CAAC,MAAM,CACT;CAEA,MAAM,kBAAkBA,QAAM,kBAAkB,cAAc,CAAC,YAAY,CAAC;CAI5E,MAAM,cAAc,eAAyC;EAC3D;EACA;EACA,cAAc;EACd;EACA;EACA;CACF,CAAC;CAGD,QAAM,gBAAgB;EACpB,IAAI,WAAW,IAAI;EACnB,YAAY,cAAc,QAAQ,EAAE,OAAO,OAAO,CAAC;CACrD,GAAG,CAAC,QAAQ,WAAW,CAAC;CAExB,OAAO;AACT;AAWA,MAAM,YAAmC;CAAE,OAAO;CAAG,QAAQ;AAAE;;;;;;;AAQ/D,SAAS,yBAAyB,gBAA2D;CAC3F,MAAM,CAAC,QAAQ,aAAaA,QAAM,SAAgC,SAAS;CAE3E,QAAM,sBAAsB;EAC1B,IAAI,CAAC,gBA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AK,UAAU,OAAO;EAEnC,OACE,oBAAC,cAAD;GAEE,KAAK,YAAY;GACjB,cAAY,IAAI;GAChB,OAAO,wBAAwB,IAAI,OAAO,MAAM;GAC1C;GACN,IAAI,OAAO,SAAS,WAAW;GAC/B,OAAO,OAAO;GACd,QAAQ,SAAS,IAAI;GACrB,YAAY,aAAa,IAAI;GAC7B,UAAU,WAAW,IAAI;GACzB,eAAe,gBAAgB,IAAI;GACnC,GAAI,qBAAqB,MAAM,UAAU;GACzC,aAAW,QAAQ,KAAA;GACnB,WAAW,OAAO,wCAAwC,KAAA;GAG1D,GAAK,OAAO,SACR;IACE,OAAO,IAAI;IACX,gBAAgB,MAAM;IACtB,iBAAiB,IAAI,QAAQ;GAC/B,IACA;GACJ,GAAK,CAAC,OAAO,UAAU,OACnB;IACE,iBAAiB;IACjB,iBAAiB,GAAG,OAAO,UAAU,OAAO,QAAQ;GACtD,IACA;EACL,GA7BM,IAAI,GA6BV;CAEL,CAAC,CACD,EAAA,CAAA;AAEN"}
@@ -7,6 +7,8 @@ interface DataGridPaginationProps {
7
7
  sizesDescription?: string;
8
8
  sizesSkeleton?: ReactNode;
9
9
  more?: boolean;
10
+ /** Page buttons the truncated middle shows; the row adds first, last and
11
+ * an ellipsis for each hidden stretch. Clamped to a minimum of 3. */
10
12
  moreLimit?: number;
11
13
  info?: string;
12
14
  infoSkeleton?: ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"data-grid-pagination.d.ts","names":[],"sources":["../../../../src/components/reui/data-grid/data-grid-pagination.tsx"],"mappings":";;UAWU;EACR;EACA;EACA;EACA;EACA,gBAAgB;EAChB;EACA;EACA;EACA,eAAe;EACf;EACA;EACA;EACA;EACA;;iBAGO,mBAAmB,OAAO,0BAA0B,IAAI"}
1
+ {"version":3,"file":"data-grid-pagination.d.ts","names":[],"sources":["../../../../src/components/reui/data-grid/data-grid-pagination.tsx"],"mappings":";;UAWU;EACR;EACA;EACA;EACA;EACA,gBAAgB;EAChB;;;EAGA;EACA;EACA,eAAe;EACf;EACA;EACA;EACA;EACA;;iBAiGO,mBAAmB,OAAO,0BAA0B,IAAI"}