@kumix/ui 0.3.6 → 0.3.7

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 (152) hide show
  1. package/dist/components/agents/ai-sidebar.d.ts +17 -1
  2. package/dist/components/agents/ai-sidebar.d.ts.map +1 -1
  3. package/dist/components/agents/ai-sidebar.js +90 -14
  4. package/dist/components/agents/ai-sidebar.js.map +1 -1
  5. package/dist/components/agents/chat-app.d.ts +10 -5
  6. package/dist/components/agents/chat-app.d.ts.map +1 -1
  7. package/dist/components/agents/chat-app.js +54 -5
  8. package/dist/components/agents/chat-app.js.map +1 -1
  9. package/dist/components/agents/citations.d.ts.map +1 -1
  10. package/dist/components/agents/citations.js +5 -6
  11. package/dist/components/agents/citations.js.map +1 -1
  12. package/dist/components/agents/tool-approval.d.ts.map +1 -1
  13. package/dist/components/agents/tool-approval.js +1 -1
  14. package/dist/components/agents/tool-approval.js.map +1 -1
  15. package/dist/components/motion/action-swap.d.ts.map +1 -1
  16. package/dist/components/motion/action-swap.js +2 -2
  17. package/dist/components/motion/action-swap.js.map +1 -1
  18. package/dist/components/motion/animated-sidebar.js +1 -0
  19. package/dist/components/motion/animated-sidebar.js.map +1 -1
  20. package/dist/components/motion/availability-scheduler/copy-menu.js +1 -1
  21. package/dist/components/motion/availability-scheduler/day-row.d.ts +5 -2
  22. package/dist/components/motion/availability-scheduler/day-row.d.ts.map +1 -1
  23. package/dist/components/motion/availability-scheduler/day-row.js +18 -8
  24. package/dist/components/motion/availability-scheduler/day-row.js.map +1 -1
  25. package/dist/components/motion/availability-scheduler/index.d.ts.map +1 -1
  26. package/dist/components/motion/availability-scheduler/index.js +27 -5
  27. package/dist/components/motion/availability-scheduler/index.js.map +1 -1
  28. package/dist/components/motion/availability-scheduler/time-select.d.ts +3 -1
  29. package/dist/components/motion/availability-scheduler/time-select.d.ts.map +1 -1
  30. package/dist/components/motion/availability-scheduler/time-select.js +3 -1
  31. package/dist/components/motion/availability-scheduler/time-select.js.map +1 -1
  32. package/dist/components/motion/bottom-sheet.d.ts.map +1 -1
  33. package/dist/components/motion/bottom-sheet.js +2 -1
  34. package/dist/components/motion/bottom-sheet.js.map +1 -1
  35. package/dist/components/motion/command-palette.d.ts.map +1 -1
  36. package/dist/components/motion/command-palette.js +3 -1
  37. package/dist/components/motion/command-palette.js.map +1 -1
  38. package/dist/components/motion/context-menu.d.ts.map +1 -1
  39. package/dist/components/motion/context-menu.js +16 -6
  40. package/dist/components/motion/context-menu.js.map +1 -1
  41. package/dist/components/motion/cylinder-carousel.d.ts.map +1 -1
  42. package/dist/components/motion/cylinder-carousel.js +4 -3
  43. package/dist/components/motion/cylinder-carousel.js.map +1 -1
  44. package/dist/components/motion/expandable-action-bar.d.ts +6 -0
  45. package/dist/components/motion/expandable-action-bar.d.ts.map +1 -1
  46. package/dist/components/motion/expandable-action-bar.js +38 -9
  47. package/dist/components/motion/expandable-action-bar.js.map +1 -1
  48. package/dist/components/motion/hold-action-button.d.ts +1 -1
  49. package/dist/components/motion/hold-action-button.d.ts.map +1 -1
  50. package/dist/components/motion/hold-action-button.js +64 -50
  51. package/dist/components/motion/hold-action-button.js.map +1 -1
  52. package/dist/components/motion/morphing-tabs.d.ts.map +1 -1
  53. package/dist/components/motion/morphing-tabs.js +59 -18
  54. package/dist/components/motion/morphing-tabs.js.map +1 -1
  55. package/dist/components/motion/notification-stack.d.ts.map +1 -1
  56. package/dist/components/motion/notification-stack.js +28 -11
  57. package/dist/components/motion/notification-stack.js.map +1 -1
  58. package/dist/components/motion/popover-morph.d.ts.map +1 -1
  59. package/dist/components/motion/popover-morph.js +26 -11
  60. package/dist/components/motion/popover-morph.js.map +1 -1
  61. package/dist/components/motion/popover.d.ts.map +1 -1
  62. package/dist/components/motion/popover.js +39 -28
  63. package/dist/components/motion/popover.js.map +1 -1
  64. package/dist/components/motion/preview-rail.d.ts.map +1 -1
  65. package/dist/components/motion/preview-rail.js +42 -13
  66. package/dist/components/motion/preview-rail.js.map +1 -1
  67. package/dist/components/motion/pull-to-refresh.d.ts.map +1 -1
  68. package/dist/components/motion/pull-to-refresh.js +8 -7
  69. package/dist/components/motion/pull-to-refresh.js.map +1 -1
  70. package/dist/components/motion/range-slider-bubble.d.ts.map +1 -1
  71. package/dist/components/motion/range-slider-bubble.js +2 -1
  72. package/dist/components/motion/range-slider-bubble.js.map +1 -1
  73. package/dist/components/motion/range-slider-fluid.d.ts.map +1 -1
  74. package/dist/components/motion/range-slider-fluid.js +2 -1
  75. package/dist/components/motion/range-slider-fluid.js.map +1 -1
  76. package/dist/components/motion/range-slider-ruler.d.ts.map +1 -1
  77. package/dist/components/motion/range-slider-ruler.js +2 -1
  78. package/dist/components/motion/range-slider-ruler.js.map +1 -1
  79. package/dist/components/motion/range-slider-wave.d.ts.map +1 -1
  80. package/dist/components/motion/range-slider-wave.js +2 -1
  81. package/dist/components/motion/range-slider-wave.js.map +1 -1
  82. package/dist/components/motion/range-slider.d.ts.map +1 -1
  83. package/dist/components/motion/range-slider.js +2 -1
  84. package/dist/components/motion/range-slider.js.map +1 -1
  85. package/dist/components/motion/select.d.ts +15 -1
  86. package/dist/components/motion/select.d.ts.map +1 -1
  87. package/dist/components/motion/select.js +15 -4
  88. package/dist/components/motion/select.js.map +1 -1
  89. package/dist/components/motion/slide-action-button.d.ts.map +1 -1
  90. package/dist/components/motion/slide-action-button.js +3 -2
  91. package/dist/components/motion/slide-action-button.js.map +1 -1
  92. package/dist/components/motion/swipeable-list.d.ts.map +1 -1
  93. package/dist/components/motion/swipeable-list.js +2 -1
  94. package/dist/components/motion/swipeable-list.js.map +1 -1
  95. package/dist/components/motion/table/index.d.ts.map +1 -1
  96. package/dist/components/motion/table/index.js +64 -6
  97. package/dist/components/motion/table/index.js.map +1 -1
  98. package/dist/components/motion/table/table-header.d.ts.map +1 -1
  99. package/dist/components/motion/table/table-header.js +3 -2
  100. package/dist/components/motion/table/table-header.js.map +1 -1
  101. package/dist/components/motion/text-reveal.d.ts.map +1 -1
  102. package/dist/components/motion/text-reveal.js +72 -48
  103. package/dist/components/motion/text-reveal.js.map +1 -1
  104. package/dist/components/motion/tooltip.d.ts.map +1 -1
  105. package/dist/components/motion/tooltip.js +35 -15
  106. package/dist/components/motion/tooltip.js.map +1 -1
  107. package/dist/components/motion/wheel-picker.d.ts.map +1 -1
  108. package/dist/components/motion/wheel-picker.js +4 -3
  109. package/dist/components/motion/wheel-picker.js.map +1 -1
  110. package/dist/components/reui/badge.d.ts +1 -1
  111. package/dist/components/reui/icon-tile.d.ts +1 -1
  112. package/dist/components/ui/attachment.d.ts +1 -1
  113. package/dist/components/ui/badge.d.ts +1 -1
  114. package/dist/components/ui/bubble.d.ts +1 -1
  115. package/dist/components/ui/button-group.d.ts +1 -1
  116. package/dist/components/ui/button.d.ts +2 -2
  117. package/dist/components/ui/field.d.ts +1 -1
  118. package/dist/components/ui/item.d.ts +1 -1
  119. package/dist/components/ui/marker.d.ts +1 -1
  120. package/dist/components/ui/tabs.d.ts +1 -1
  121. package/dist/{copy-menu-Bk5GP9Gp.js → copy-menu-1FKoMc9o.js} +9 -2
  122. package/dist/copy-menu-1FKoMc9o.js.map +1 -0
  123. package/dist/hooks/use-dismiss.d.ts +34 -0
  124. package/dist/hooks/use-dismiss.d.ts.map +1 -0
  125. package/dist/hooks/use-dismiss.js +78 -0
  126. package/dist/hooks/use-dismiss.js.map +1 -0
  127. package/dist/hooks/use-favicon.d.ts +17 -0
  128. package/dist/hooks/use-favicon.d.ts.map +1 -0
  129. package/dist/hooks/use-favicon.js +35 -0
  130. package/dist/hooks/use-favicon.js.map +1 -0
  131. package/dist/hooks/use-hover-gesture.d.ts +38 -0
  132. package/dist/hooks/use-hover-gesture.d.ts.map +1 -0
  133. package/dist/hooks/use-hover-gesture.js +46 -0
  134. package/dist/hooks/use-hover-gesture.js.map +1 -0
  135. package/dist/hooks/use-slider.d.ts.map +1 -1
  136. package/dist/hooks/use-slider.js +3 -2
  137. package/dist/hooks/use-slider.js.map +1 -1
  138. package/dist/hooks/use-tap-gesture.d.ts +47 -0
  139. package/dist/hooks/use-tap-gesture.d.ts.map +1 -0
  140. package/dist/hooks/use-tap-gesture.js +51 -0
  141. package/dist/hooks/use-tap-gesture.js.map +1 -0
  142. package/dist/hooks/use-touch-capable.d.ts +15 -0
  143. package/dist/hooks/use-touch-capable.d.ts.map +1 -0
  144. package/dist/hooks/use-touch-capable.js +29 -0
  145. package/dist/hooks/use-touch-capable.js.map +1 -0
  146. package/dist/lib/touch.d.ts +66 -0
  147. package/dist/lib/touch.d.ts.map +1 -0
  148. package/dist/lib/touch.js +79 -0
  149. package/dist/lib/touch.js.map +1 -0
  150. package/dist/types-smkWN_7x.d.ts.map +1 -1
  151. package/package.json +1 -1
  152. package/dist/copy-menu-Bk5GP9Gp.js.map +0 -1
@@ -10,6 +10,22 @@ const DEFAULT_SPRING = {
10
10
  damping: 26,
11
11
  mass: 1.2
12
12
  };
13
+ /**
14
+ * One tokenizer for both modes: a line becomes the words it is made of, each
15
+ * carrying the whitespace that follows it. Word mode animates a group at a
16
+ * time, char mode the characters inside one — so the two can't drift apart on
17
+ * what counts as a word or where a space belongs. Runs of whitespace and tabs
18
+ * survive as their own group rather than collapsing.
19
+ */
20
+ function toWordGroups(line) {
21
+ return (line.match(/\S+\s*|\s+/g) ?? []).map((chunk) => {
22
+ const text = chunk.replace(/\s+$/, "");
23
+ return {
24
+ text,
25
+ trailing: chunk.slice(text.length)
26
+ };
27
+ });
28
+ }
13
29
  function TextReveal({ text, as: Comp = "span", className, split = "word", stagger = .09, delay = 0, blur = 12, yOffset = "40%", spring, once = true, whileInView = false, children }) {
14
30
  const ref = useRef(null);
15
31
  const inView = useInView(ref, {
@@ -29,60 +45,68 @@ function TextReveal({ text, as: Comp = "span", className, split = "word", stagge
29
45
  ref,
30
46
  className: cn("block", className),
31
47
  children: [lines.map((line) => {
32
- const units = split === "word" ? line.split(" ") : Array.from(line);
33
48
  const lineCount = lineCounts.get(line) ?? 0;
34
49
  lineCounts.set(line, lineCount + 1);
35
50
  const lineKey = `${line}-${lineCount}`;
36
51
  const unitCounts = /* @__PURE__ */ new Map();
52
+ const renderUnit = (unit) => {
53
+ const d = delay + unitIndex * stagger;
54
+ unitIndex += 1;
55
+ const unitCount = unitCounts.get(unit) ?? 0;
56
+ unitCounts.set(unit, unitCount + 1);
57
+ const unitKey = `${unit}-${unitCount}`;
58
+ const initial = reduce ? { opacity: 0 } : {
59
+ y: yOffset,
60
+ opacity: 0,
61
+ filter: `blur(${blur}px)`
62
+ };
63
+ const animate = shouldAnimate ? reduce ? { opacity: 1 } : {
64
+ y: 0,
65
+ opacity: 1,
66
+ filter: "blur(0px)"
67
+ } : initial;
68
+ const transition = reduce ? { opacity: {
69
+ duration: .25,
70
+ ease: EASE_OUT,
71
+ delay: d * .3
72
+ } } : {
73
+ y: {
74
+ type: "spring",
75
+ ...s,
76
+ delay: d
77
+ },
78
+ opacity: {
79
+ duration: .7,
80
+ ease: EASE_OUT,
81
+ delay: d
82
+ },
83
+ filter: {
84
+ duration: .9,
85
+ ease: EASE_OUT,
86
+ delay: d
87
+ }
88
+ };
89
+ return /* @__PURE__ */ jsx(motion.span, {
90
+ initial,
91
+ animate,
92
+ transition,
93
+ className: "inline-block whitespace-pre will-change-transform",
94
+ children: unit
95
+ }, unitKey);
96
+ };
97
+ const groups = toWordGroups(line);
98
+ const groupCounts = /* @__PURE__ */ new Map();
37
99
  return /* @__PURE__ */ jsx("span", {
38
100
  className: "block",
39
- children: units.map((unit, i) => {
40
- const d = delay + unitIndex * stagger;
41
- unitIndex += 1;
42
- const unitCount = unitCounts.get(unit) ?? 0;
43
- unitCounts.set(unit, unitCount + 1);
44
- const unitKey = `${unit}-${unitCount}`;
45
- const initial = reduce ? { opacity: 0 } : {
46
- y: yOffset,
47
- opacity: 0,
48
- filter: `blur(${blur}px)`
49
- };
50
- const animate = shouldAnimate ? reduce ? { opacity: 1 } : {
51
- y: 0,
52
- opacity: 1,
53
- filter: "blur(0px)"
54
- } : initial;
55
- const transition = reduce ? { opacity: {
56
- duration: .25,
57
- ease: EASE_OUT,
58
- delay: d * .3
59
- } } : {
60
- y: {
61
- type: "spring",
62
- ...s,
63
- delay: d
64
- },
65
- opacity: {
66
- duration: .7,
67
- ease: EASE_OUT,
68
- delay: d
69
- },
70
- filter: {
71
- duration: .9,
72
- ease: EASE_OUT,
73
- delay: d
74
- }
75
- };
76
- return /* @__PURE__ */ jsxs(motion.span, {
77
- initial,
78
- animate,
79
- transition,
80
- className: "inline-block will-change-transform",
81
- children: [unit, split === "word" && i < units.length - 1 ? /* @__PURE__ */ jsx("span", {
82
- className: "inline-block",
83
- children: "\xA0"
84
- }) : null]
85
- }, unitKey);
101
+ children: groups.map((group) => {
102
+ const whole = group.text + group.trailing;
103
+ if (split !== "char") return renderUnit(whole);
104
+ const groupCount = groupCounts.get(whole) ?? 0;
105
+ groupCounts.set(whole, groupCount + 1);
106
+ return /* @__PURE__ */ jsx("span", {
107
+ className: "inline-block whitespace-pre",
108
+ children: Array.from(whole).map((char) => renderUnit(char))
109
+ }, `${whole}-${groupCount}`);
86
110
  })
87
111
  }, lineKey);
88
112
  }), children]
@@ -1 +1 @@
1
- {"version":3,"file":"text-reveal.js","names":[],"sources":["../../../src/components/motion/text-reveal.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ElementType, type ReactNode, useRef } from \"react\";\nimport { motion, type Transition, useInView, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\ntype SplitMode = \"word\" | \"char\";\n\nexport interface TextRevealProps {\n text: string | string[];\n as?: ElementType;\n className?: string;\n split?: SplitMode;\n stagger?: number;\n delay?: number;\n blur?: number;\n yOffset?: string | number;\n spring?: { stiffness?: number; damping?: number; mass?: number };\n once?: boolean;\n whileInView?: boolean;\n children?: ReactNode;\n}\n\nconst DEFAULT_SPRING = { stiffness: 140, damping: 26, mass: 1.2 };\n\nexport function TextReveal({\n text,\n as: Comp = \"span\",\n className,\n split = \"word\",\n stagger = 0.09,\n delay = 0,\n blur = 12,\n yOffset = \"40%\",\n spring,\n once = true,\n whileInView = false,\n children,\n}: TextRevealProps) {\n const ref = useRef<HTMLElement>(null);\n const inView = useInView(ref, { once, amount: 0.4 });\n const reduce = useReducedMotion();\n const shouldAnimate = whileInView ? inView : true;\n\n const lines = Array.isArray(text) ? text : [text];\n const s = { ...DEFAULT_SPRING, ...spring };\n\n let unitIndex = 0;\n const lineCounts = new Map<string, number>();\n\n return (\n <Comp ref={ref} className={cn(\"block\", className)}>\n {lines.map((line) => {\n const units = split === \"word\" ? line.split(\" \") : Array.from(line);\n const lineCount = lineCounts.get(line) ?? 0;\n lineCounts.set(line, lineCount + 1);\n const lineKey = `${line}-${lineCount}`;\n const unitCounts = new Map<string, number>();\n\n return (\n <span key={lineKey} className=\"block\">\n {units.map((unit, i) => {\n const d = delay + unitIndex * stagger;\n unitIndex += 1;\n const unitCount = unitCounts.get(unit) ?? 0;\n unitCounts.set(unit, unitCount + 1);\n const unitKey = `${unit}-${unitCount}`;\n const initial = reduce\n ? { opacity: 0 }\n : { y: yOffset, opacity: 0, filter: `blur(${blur}px)` };\n const animate = shouldAnimate\n ? reduce\n ? { opacity: 1 }\n : { y: 0, opacity: 1, filter: \"blur(0px)\" }\n : initial;\n const transition: Transition = reduce\n ? { opacity: { duration: 0.25, ease: EASE_OUT, delay: d * 0.3 } }\n : {\n y: { type: \"spring\" as const, ...s, delay: d },\n opacity: { duration: 0.7, ease: EASE_OUT, delay: d },\n filter: { duration: 0.9, ease: EASE_OUT, delay: d },\n };\n return (\n <motion.span\n key={unitKey}\n initial={initial}\n animate={animate}\n transition={transition}\n className=\"inline-block will-change-transform\"\n >\n {unit}\n {split === \"word\" && i < units.length - 1 ? (\n <span className=\"inline-block\">&nbsp;</span>\n ) : null}\n </motion.span>\n );\n })}\n </span>\n );\n })}\n {children}\n </Comp>\n );\n}\n"],"mappings":";;;;;;;AAyBA,MAAM,iBAAiB;C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AS;MAAG,QAAQ;KAAY,IAC1C;KACJ,MAAM,aAAyB,SAC3B,EAAE,SAAS;MAAE,UAAU;MAAM,MAAM;MAAU,OAAO,IAAI;KAAI,EAAE,IAC9D;MACE,GAAG;OAAE,MAAM;OAAmB,GAAG;OAAG,OAAO;MAAE;MAC7C,SAAS;OAAE,UAAU;OAAK,MAAM;OAAU,OAAO;MAAE;MACnD,QAAQ;OAAE,UAAU;OAAK,MAAM;OAAU,OAAO;MAAE;KACpD;KACJ,OACE,qBAAC,OAAO,MAAR;MAEW;MACA;MACG;MACZ,WAAU;MALZ,UAAA,CAOG,MACA,UAAU,UAAU,IAAI,MAAM,SAAS,IACtC,oBAAC,QAAD;OAAM,WAAU;OAAe,UAAA;MAAY,CAAA,IACzC,IACO;KAVN,GAAA,OAUM;IAEjB,CAAC;GACG,GArCK,OAqCL;EAEV,CAAC,GACA,QACG;;AAEV"}
1
+ {"version":3,"file":"text-reveal.js","names":[],"sources":["../../../src/components/motion/text-reveal.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ElementType, type ReactNode, useRef } from \"react\";\nimport { motion, type Transition, useInView, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\ntype SplitMode = \"word\" | \"char\";\n\nexport interface TextRevealProps {\n text: string | string[];\n as?: ElementType;\n className?: string;\n split?: SplitMode;\n stagger?: number;\n delay?: number;\n blur?: number;\n yOffset?: string | number;\n spring?: { stiffness?: number; damping?: number; mass?: number };\n once?: boolean;\n whileInView?: boolean;\n children?: ReactNode;\n}\n\nconst DEFAULT_SPRING = { stiffness: 140, damping: 26, mass: 1.2 };\n\ntype WordGroup = { text: string; trailing: string };\n\n/**\n * One tokenizer for both modes: a line becomes the words it is made of, each\n * carrying the whitespace that follows it. Word mode animates a group at a\n * time, char mode the characters inside one — so the two can't drift apart on\n * what counts as a word or where a space belongs. Runs of whitespace and tabs\n * survive as their own group rather than collapsing.\n */\nfunction toWordGroups(line: string): WordGroup[] {\n const chunks = line.match(/\\S+\\s*|\\s+/g) ?? [];\n return chunks.map((chunk) => {\n const text = chunk.replace(/\\s+$/, \"\");\n return { text, trailing: chunk.slice(text.length) };\n });\n}\n\nexport function TextReveal({\n text,\n as: Comp = \"span\",\n className,\n split = \"word\",\n stagger = 0.09,\n delay = 0,\n blur = 12,\n yOffset = \"40%\",\n spring,\n once = true,\n whileInView = false,\n children,\n}: TextRevealProps) {\n const ref = useRef<HTMLElement>(null);\n const inView = useInView(ref, { once, amount: 0.4 });\n const reduce = useReducedMotion();\n const shouldAnimate = whileInView ? inView : true;\n\n const lines = Array.isArray(text) ? text : [text];\n const s = { ...DEFAULT_SPRING, ...spring };\n\n let unitIndex = 0;\n const lineCounts = new Map<string, number>();\n\n return (\n <Comp ref={ref} className={cn(\"block\", className)}>\n {lines.map((line) => {\n const lineCount = lineCounts.get(line) ?? 0;\n lineCounts.set(line, lineCount + 1);\n const lineKey = `${line}-${lineCount}`;\n const unitCounts = new Map<string, number>();\n\n const renderUnit = (unit: string) => {\n const d = delay + unitIndex * stagger;\n unitIndex += 1;\n const unitCount = unitCounts.get(unit) ?? 0;\n unitCounts.set(unit, unitCount + 1);\n const unitKey = `${unit}-${unitCount}`;\n const initial = reduce\n ? { opacity: 0 }\n : { y: yOffset, opacity: 0, filter: `blur(${blur}px)` };\n const animate = shouldAnimate\n ? reduce\n ? { opacity: 1 }\n : { y: 0, opacity: 1, filter: \"blur(0px)\" }\n : initial;\n const transition: Transition = reduce\n ? { opacity: { duration: 0.25, ease: EASE_OUT, delay: d * 0.3 } }\n : {\n y: { type: \"spring\" as const, ...s, delay: d },\n opacity: { duration: 0.7, ease: EASE_OUT, delay: d },\n filter: { duration: 0.9, ease: EASE_OUT, delay: d },\n };\n return (\n <motion.span\n key={unitKey}\n initial={initial}\n animate={animate}\n transition={transition}\n // `whitespace-pre` is load-bearing: a unit's trailing space is\n // inside an inline-block and would otherwise collapse to zero\n // width, running every word together.\n className=\"inline-block whitespace-pre will-change-transform\"\n >\n {unit}\n </motion.span>\n );\n };\n\n const groups = toWordGroups(line);\n const groupCounts = new Map<string, number>();\n\n return (\n <span key={lineKey} className=\"block\">\n {groups.map((group) => {\n const whole = group.text + group.trailing;\n // Characters animate one at a time, but each word (plus the\n // space that follows it) sits in its own inline-block so a long\n // line wraps between words instead of mid-word.\n if (split !== \"char\") return renderUnit(whole);\n\n const groupCount = groupCounts.get(whole) ?? 0;\n groupCounts.set(whole, groupCount + 1);\n return (\n <span key={`${whole}-${groupCount}`} className=\"inline-block whitespace-pre\">\n {Array.from(whole).map((char) => renderUnit(char))}\n </span>\n );\n })}\n </span>\n );\n })}\n {children}\n </Comp>\n );\n}\n"],"mappings":";;;;;;;AAyBA,MAAM,iBAAiB;CAAE,WAAW;CAAK,SAAS;CAAI,MAAM;AAAI;;;;;;;;AAWhE,SAAS,aAAa,MAA2B;CAE/C,QADe,KAAK,MAAM,aAAa,KAAK,CAAC,EAAA,CAC/B,KAAK,UAAU;EAC3B,MAAM,OAAO,MAAM,QAAQ,QAAQ,EAAE;EACrC,OAAO;GAAE;GAAM,UAAU,MAAM,MAAM,KAAK,MAAM;EAAE;CACpD,CAAC;AACH;AAEA,SAAgB,WAAW,EACzB,MACA,IAAI,OAAO,QACX,WACA,QAAQ,QACR,UAAU,KACV,QAAQ,GACR,OAAO,IACP,UAAU,OACV,QACA,OAAO,MACP,cAAc,OACd,YACkB;CAClB,MAAM,MAAM,OAAoB,IAAI;CACpC,MAAM,SAAS,UAAU,KAAK;EAAE;EAAM,QAAQ;CAAI,CAAC;CACnD,MAAM,SAAS,iBAAiB;CAChC,MAAM,gBAAgB,cAAc,SAAS;CAE7C,MAAM,QAAQ,MAAM,QAAQ,IAAI,IAAI,OAAO,CAAC,IAAI;CAChD,MAAM,IAAI;EAAE,GAAG;EAAgB,GAAG;CAAO;CAEzC,IAAI,YAAY;CAChB,MAAM,6BAAa,IAAI,IAAoB;CAE3C,OACE,qBAAC,MAAD;EAAW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KAC7C,YAAY,IAAI,OAAO,aAAa,CAAC;KACrC,OACE,oBAAC,QAAD;MAAqC,WAAU;MAC5C,UAAA,MAAM,KAAK,KAAK,CAAC,CAAC,KAAK,SAAS,WAAW,IAAI,CAAC;KAC7C,GAFK,GAAG,MAAM,GAAG,YAEjB;IAEV,CAAC;GACG,GAhBK,OAgBL;EAEV,CAAC,GACA,QACG;;AAEV"}
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.d.ts","names":[],"sources":["../../../src/components/motion/tooltip.tsx"],"mappings":";;KAqBK;UAEY;EACf,SAAS;EACT,UAAU;EACV,OAAO;;EAEP;EACA;;EAEA;;iBA6Ec,UACd,SACA,UACA,MACA,OACA,WACA,oBACC,+BAAY,IAAA"}
1
+ {"version":3,"file":"tooltip.d.ts","names":[],"sources":["../../../src/components/motion/tooltip.tsx"],"mappings":";;KAwBK;UAEY;EACf,SAAS;EACT,UAAU;EACV,OAAO;;EAEP;EACA;;EAEA;;iBA6Ec,UACd,SACA,UACA,MACA,OACA,WACA,oBACC,+BAAY,IAAA"}
@@ -1,5 +1,7 @@
1
1
  "use client";
2
- import { useHoverCapable } from "../../hooks/use-hover-capable.js";
2
+ import { useDismiss } from "../../hooks/use-dismiss.js";
3
+ import { useHoverGesture } from "../../hooks/use-hover-gesture.js";
4
+ import { useTapGesture } from "../../hooks/use-tap-gesture.js";
3
5
  import { EASE_OUT } from "../../lib/ease.js";
4
6
  import { cloneElement, isValidElement, useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
5
7
  import { cn } from "@kumix/utils";
@@ -95,8 +97,8 @@ function Tooltip({ content, children, side = "top", delay = 120, className, wrap
95
97
  const id = useId();
96
98
  const timer = useRef(null);
97
99
  const anchorRef = useRef(null);
100
+ const hover = useHoverGesture();
98
101
  const reduce = useReducedMotion();
99
- const canHover = useHoverCapable();
100
102
  const place = useCallback(() => {
101
103
  const el = anchorRef.current;
102
104
  if (!el) return;
@@ -124,18 +126,13 @@ function Tooltip({ content, children, side = "top", delay = 120, className, wrap
124
126
  setCoords(point[side]);
125
127
  }, [side]);
126
128
  const show = useCallback(() => {
127
- if (!canHover) return;
128
129
  if (timer.current) clearTimeout(timer.current);
129
130
  const warm = Date.now() - lastHiddenAt < WARM_WINDOW_MS;
130
131
  timer.current = setTimeout(() => {
131
132
  place();
132
133
  setOpen(true);
133
134
  }, warm ? 0 : delay);
134
- }, [
135
- canHover,
136
- delay,
137
- place
138
- ]);
135
+ }, [delay, place]);
139
136
  const hide = useCallback(() => {
140
137
  if (timer.current) {
141
138
  clearTimeout(timer.current);
@@ -144,6 +141,23 @@ function Tooltip({ content, children, side = "top", delay = 120, className, wrap
144
141
  if (open) lastHiddenAt = Date.now();
145
142
  setOpen(false);
146
143
  }, [open]);
144
+ const tap = useTapGesture();
145
+ const toggleOnTap = useCallback(() => {
146
+ const gesture = tap.take();
147
+ if (!gesture || gesture.pointerType === "mouse") return;
148
+ if (gesture.state) {
149
+ hide();
150
+ return;
151
+ }
152
+ if (timer.current) clearTimeout(timer.current);
153
+ place();
154
+ setOpen(true);
155
+ }, [
156
+ hide,
157
+ place,
158
+ tap
159
+ ]);
160
+ useDismiss(open, hide, anchorRef);
147
161
  useEffect(() => {
148
162
  if (!open) return;
149
163
  const onMove = () => place();
@@ -156,16 +170,22 @@ function Tooltip({ content, children, side = "top", delay = 120, className, wrap
156
170
  }, [open, place]);
157
171
  const variants = useMemo(() => reduce ? REDUCED_VARIANTS : buildVariants(side), [reduce, side]);
158
172
  if (!isValidElement(children)) return children;
159
- const trigger = cloneElement(children, {
160
- onMouseEnter: show,
161
- onMouseLeave: hide,
162
- onFocus: show,
163
- onBlur: hide,
164
- "aria-describedby": id
165
- });
173
+ const trigger = cloneElement(children, { "aria-describedby": id });
166
174
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
167
175
  ref: anchorRef,
168
176
  className: cn("relative inline-flex align-middle", wrapperClassName),
177
+ onPointerEnter: (event) => {
178
+ if (hover.enter(event)) show();
179
+ },
180
+ onPointerLeave: (event) => {
181
+ if (hover.leave(event)) hide();
182
+ },
183
+ onFocus: show,
184
+ onBlur: hide,
185
+ onPointerDown: (event) => tap.start(event, open),
186
+ onPointerCancel: tap.drop,
187
+ onKeyDown: tap.drop,
188
+ onClick: toggleOnTap,
169
189
  children: trigger
170
190
  }), typeof document !== "undefined" ? createPortal(/* @__PURE__ */ jsx(AnimatePresence, { children: open && coords ? /* @__PURE__ */ jsx("span", {
171
191
  "aria-hidden": true,
@@ -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 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 { useHoverCapable } from \"../../hooks/use-hover-capable\";\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 reduce = useReducedMotion();\n const canHover = useHoverCapable();\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 (!canHover) return;\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 }, [canHover, 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 // 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 const trigger = cloneElement(children as ReactElement<Record<string, unknown>>, {\n onMouseEnter: show,\n onMouseLeave: hide,\n onFocus: show,\n onBlur: hide,\n \"aria-describedby\": id,\n });\n\n return (\n <>\n <span ref={anchorRef} className={cn(\"relative inline-flex align-middle\", wrapperClassName)}>\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":";;;;;;;;;AAmCA,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,MAAM;GACJ,SAAS;GACT,OAAO;GACP,QAAQ;GACR,IAAI,EAAE,KAAK,KAAK;GAChB,IAAI,EAAE,KAAK,KAAK;GAChB,YAAY;IAAE,UAAU;IAAM,MAAM;GAAS;EAC/C;CACF;AACF;AAEA,MAAM,mBAA6B;CACjC,SAAS,EAAE,SAAS,EAAE;CACtB,SAAS;EAAE,SAAS;EAAG,YAAY;GAAE,UAAU;GAAM,MAAM;EAAS;CAAE;CACtE,MAAM;EAAE,SAAS;EAAG,YAAY;GAAE,UAAU;GAAK,MAAM;EAAS;CAAE;AACpE;AAIA,MAAM,iBAAiB;AACvB,IAAI,eAAe;AAEnB,SAA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gBAAgB;EACd,IAAI,CAAC,MAAM;EACX,MAAM,eAAe,MAAM;EAC3B,OAAO,iBAAiB,UAAU,QAAQ,IAAI;EAC9C,OAAO,iBAAiB,UAAU,MAAM;EACxC,aAAa;GACX,OAAO,oBAAoB,UAAU,QAAQ,IAAI;GACjD,OAAO,oBAAoB,UAAU,MAAM;EAC7C;CACF,GAAG,CAAC,MAAM,KAAK,CAAC;CAEhB,MAAM,WAAW,cAAe,SAAS,mBAAmB,cAAc,IAAI,GAAI,CAAC,QAAQ,IAAI,CAAC;CAEhG,IAAI,CAAC,eAAe,QAAQ,GAAG,OAAO;CAEtC,MAAM,UAAU,aAAa,UAAmD;EAC9E,cAAc;EACd,cAAc;EACd,SAAS;EACT,QAAQ;EACR,oBAAoB;CACtB,CAAC;CAED,OACE,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,QAAD;EAAM,KAAK;EAAW,WAAW,GAAG,qCAAqC,gBAAgB;EACtF,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 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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E,oBAAoB,GACtB,CAAC;CAED,OACE,qBAAA,YAAA,EAAA,UAAA,CACE,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,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 +1 @@
1
- {"version":3,"file":"wheel-picker.d.ts","names":[],"sources":["../../../src/components/motion/wheel-picker.tsx"],"mappings":";KAgBY;EAA+B;EAAe;;UAEzC;EACf,SAAS;EACT;EACA;EACA,iBAAiB;;EAEjB;;EAEA;EACA;;EAEA;EACA;EACA;;iBA2Bc,cACd,SACA,OACA,cACA,eACA,cACA,YACA,UACA,OACA,yBACc,aACb,mCAAgB,IAAA"}
1
+ {"version":3,"file":"wheel-picker.d.ts","names":[],"sources":["../../../src/components/motion/wheel-picker.tsx"],"mappings":";KAiBY;EAA+B;EAAe;;UAEzC;EACf,SAAS;EACT;EACA;EACA,iBAAiB;;EAEjB;;EAEA;EACA;;EAEA;EACA;EACA;;iBA2Bc,cACd,SACA,OACA,cACA,eACA,cACA,YACA,UACA,OACA,yBACc,aACb,mCAAgB,IAAA"}
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import { TOUCH_GESTURE_CLASS, capturePointer, releasePointer } from "../../lib/touch.js";
2
3
  import { createTickPlayer } from "../../lib/tick-sound.js";
3
4
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
4
5
  import { cn } from "@kumix/utils";
@@ -231,8 +232,8 @@ function WheelPicker({ options, value, defaultValue, onValueChange, visibleCount
231
232
  }, [itemHeight, fling]);
232
233
  const onPointerDown = useCallback((event) => {
233
234
  if (disabled || reduce || event.pointerType === "touch") return;
234
- event.currentTarget.setPointerCapture(event.pointerId);
235
235
  beginDrag(event.clientY);
236
+ capturePointer(event.currentTarget, event.pointerId);
236
237
  }, [
237
238
  disabled,
238
239
  reduce,
@@ -244,7 +245,7 @@ function WheelPicker({ options, value, defaultValue, onValueChange, visibleCount
244
245
  }, [moveDrag]);
245
246
  const onPointerUp = useCallback((event) => {
246
247
  if (event.pointerType === "touch") return;
247
- event.currentTarget.releasePointerCapture?.(event.pointerId);
248
+ releasePointer(event.currentTarget, event.pointerId);
248
249
  endDrag();
249
250
  }, [endDrag]);
250
251
  const wheelSnap = useRef(null);
@@ -393,7 +394,7 @@ function WheelPicker({ options, value, defaultValue, onValueChange, visibleCount
393
394
  onPointerMove,
394
395
  onPointerUp,
395
396
  onPointerCancel: onPointerUp,
396
- className: cn("relative touch-none select-none overflow-hidden rounded-2xl border border-border bg-card outline-none focus-visible:ring-2 focus-visible:ring-foreground/20", grabbing ? "cursor-grabbing" : "cursor-grab", disabled && "pointer-events-none opacity-50", maskFade, className),
397
+ className: cn("relative touch-none overflow-hidden rounded-2xl border border-border bg-card outline-none focus-visible:ring-2 focus-visible:ring-foreground/20", TOUCH_GESTURE_CLASS, grabbing ? "cursor-grabbing" : "cursor-grab", disabled && "pointer-events-none opacity-50", maskFade, className),
397
398
  style: {
398
399
  height,
399
400
  perspective: 1e3
@@ -1 +1 @@
1
- {"version":3,"file":"wheel-picker.js","names":[],"sources":["../../../src/components/motion/wheel-picker.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type KeyboardEvent,\n type PointerEvent,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { createTickPlayer } from \"../../lib/tick-sound\";\n\nexport type WheelPickerOption = string | { label: string; value: string };\n\nexport interface WheelPickerProps {\n options: WheelPickerOption[];\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n /** Rows visible through the window, odd. More = flatter curve. Default 5. */\n visibleCount?: number;\n /** Row height in px. Default 36. */\n itemHeight?: number;\n disabled?: boolean;\n /** Play a short tick each time the selected value changes. Default false. */\n sound?: boolean;\n className?: string;\n \"aria-label\"?: string;\n}\n\nconst DEG = Math.PI / 180;\n// Physics constants, tuned for an iOS-like flick rather than reused from the\n// shared spring tokens: the wheel coasts in whole-row units and springs to an\n// integer detent, which a layout spring can't express cleanly.\nconst DECELERATION = 0.00042; // rows per ms², how fast a flick bleeds off (lower = freer)\nconst MAX_VELOCITY = 0.18; // rows per ms, caps a hard fling\nconst VELOCITY_WINDOW = 90; // ms of recent drag to average a release velocity over\nconst WHEEL_SENS = 0.012; // rows per pixel of wheel delta\nconst WHEEL_SETTLE = 110; // ms of wheel idle before snapping to a row\nconst easeOutCubic = (p: number) => 1 - (1 - p) ** 3;\n// Overshoots the target by a few percent then settles — the little spring\n// bounce as a row snaps home. `BACK` sets how far it drifts past.\nconst BACK = 1.35;\nconst easeOutBack = (p: number) => 1 + (BACK + 1) * (p - 1) ** 3 + BACK * (p - 1) ** 2;\n\nconst clamp = (v: number, lo: number, hi: number) => Math.max(lo, Math.min(v, hi));\n\nfunction optionValue(option: WheelPickerOption) {\n return typeof option === \"string\" ? option : option.value;\n}\nfunction optionLabel(option: WheelPickerOption) {\n return typeof option === \"string\" ? option : option.label;\n}\n\nexport function WheelPicker({\n options,\n value,\n defaultValue,\n onValueChange,\n visibleCount = 5,\n itemHeight = 36,\n disabled = false,\n sound = false,\n className,\n \"aria-label\": ariaLabel,\n}: WheelPickerProps) {\n const reduce = useReducedMotion() ?? false;\n const controlled = value !== undefined;\n const last = options.length - 1;\n\n const indexOf = useCallback(\n (v: string | undefined) => {\n const i = options.findIndex((o) => optionValue(o) === v);\n return i < 0 ? 0 : i;\n },\n [options],\n );\n\n const [internal, setInternal] = useState(() => defaultValue ?? value);\n const currentValue = controlled ? value : internal;\n const [grabbing, setGrabbing] = useState(false);\n\n // Cylinder geometry. Each row spans `itemAngle`; `radius` seats the rows on\n // the drum; rows past `hideBeyond` sit behind the horizon and are dropped.\n const { itemAngle, radius, height, hideBeyond } = useMemo(() => {\n const rowsEachSide = Math.max(1, Math.floor(visibleCount / 2));\n const cutoff = rowsEachSide + 1;\n const angle = 90 / cutoff;\n const r = itemHeight / Math.tan(angle * DEG);\n return {\n itemAngle: angle,\n radius: r,\n hideBeyond: cutoff,\n height: Math.round(2 * r * Math.sin(rowsEachSide * angle * DEG) + itemHeight),\n };\n }, [visibleCount, itemHeight]);\n\n const container = useRef<HTMLDivElement>(null);\n const drumRef = useRef<HTMLUListElement>(null);\n const bandRef = useRef<HTMLUListElement>(null);\n // Scroll position measured in rows (a float index). One source of truth for\n // both layers: the drum rotates by `itemAngle·scroll`, the crisp band slides\n // by `itemHeight·scroll`.\n const scroll = useRef(indexOf(currentValue));\n const raf = useRef(0);\n const emitted = useRef(currentValue);\n const tickPlayer = useRef<ReturnType<typeof createTickPlayer> | null>(null);\n const lastTick = useRef(indexOf(currentValue));\n\n const paint = useCallback(\n (s: number) => {\n const drum = drumRef.current;\n const band = bandRef.current;\n if (drum) {\n drum.style.transform = `translateZ(${-radius}px) rotateX(${itemAngle * s}deg)`;\n for (const node of Array.from(drum.children)) {\n const li = node as HTMLLIElement;\n const i = Number(li.dataset.index);\n const want = Math.abs(i - s) > hideBeyond ? \"hidden\" : \"visible\";\n // Write only on change — an unconditional write every frame thrashes\n // style recalc and is what made the drag feel draggy on mobile.\n if (li.style.visibility !== want) li.style.visibility = want;\n }\n }\n // The band is the SAME drum, clipped to the centre row — driven by the\n // identical transform so the crisp copy sits exactly on the dimmed one,\n // with no parallax ghost as rows cross the window. It needs the same\n // horizon cull, or the row on the back of the drum bleeds into the front.\n if (band) {\n band.style.transform = `translateZ(${-radius}px) rotateX(${itemAngle * s}deg)`;\n for (const node of Array.from(band.children)) {\n const li = node as HTMLLIElement;\n const i = Number(li.dataset.index);\n const want = Math.abs(i - s) > hideBeyond ? \"hidden\" : \"visible\";\n if (li.style.visibility !== want) li.style.visibility = want;\n }\n }\n },\n [radius, itemAngle, hideBeyond],\n );\n\n const getPlayer = useCallback(() => {\n if (!tickPlayer.current) tickPlayer.current = createTickPlayer();\n return tickPlayer.current;\n }, []);\n\n const emit = useCallback(\n (i: number) => {\n const v = optionValue(options[clamp(i, 0, last)]);\n if (v === emitted.current) return;\n emitted.current = v;\n // Reduced motion has no drum/glide path to tick from — it's an\n // onClick straight into emit, so the tick lives here instead.\n if (sound && reduce) getPlayer().play();\n if (!controlled) setInternal(v);\n onValueChange?.(v);\n },\n [options, last, controlled, onValueChange, sound, reduce, getPlayer],\n );\n\n // Drum path: fires a tick whenever the nearest row changes, independent of\n // `emit` (which only fires on settle during a glide/fling, not per row\n // crossed). Gated on `!reduce` since the reduced render never calls this.\n const maybeTick = useCallback(\n (pos: number) => {\n const row = clamp(Math.round(pos), 0, last);\n if (!sound || reduce) {\n lastTick.current = row;\n return;\n }\n if (row === lastTick.current) return;\n lastTick.current = row;\n getPlayer().play();\n },\n [sound, reduce, last, getPlayer],\n );\n\n const stop = useCallback(() => cancelAnimationFrame(raf.current), []);\n\n // Ease `scroll` from where it is to an integer detent over `duration`. The\n // easing may overshoot (spring bounce) before it resolves exactly on `to`.\n const glide = useCallback(\n (to: number, duration: number, ease: (p: number) => number = easeOutCubic) => {\n stop();\n const from = scroll.current;\n const dist = to - from;\n if (!dist || duration <= 0) {\n scroll.current = to;\n paint(to);\n maybeTick(to);\n emit(to);\n return;\n }\n const start = performance.now();\n const tick = (now: number) => {\n const p = (now - start) / duration;\n if (p >= 1) {\n scroll.current = to;\n paint(to);\n maybeTick(to);\n emit(to);\n return;\n }\n scroll.current = from + dist * ease(p);\n paint(scroll.current);\n maybeTick(scroll.current);\n raf.current = requestAnimationFrame(tick);\n };\n raf.current = requestAnimationFrame(tick);\n },\n [stop, paint, emit, maybeTick],\n );\n\n // Project where a flick of `velocity` (rows/ms) coasts to, snap to a row.\n const fling = useCallback(\n (velocity: number) => {\n const from = scroll.current;\n if (from < 0 || from > last) {\n glide(clamp(Math.round(from), 0, last), 260); // rubber-band back\n return;\n }\n const dir = Math.sign(velocity);\n const coast = ((velocity * velocity) / (2 * DECELERATION)) * dir;\n const to = clamp(Math.round(from + coast), 0, last);\n // Long, spring-tipped settle so a hard flick reads as free momentum\n // coasting to rest with a gentle bounce, never a clipped stop.\n const duration = clamp(Math.sqrt(Math.abs(to - from)) * 300 + 240, 280, 1700);\n glide(to, duration, easeOutBack);\n },\n [glide, last],\n );\n\n const step = useCallback(\n (by: number) => glide(clamp(Math.round(scroll.current) + by, 0, last), 300, easeOutBack),\n [glide, last],\n );\n\n // Drag: track recent points for a release velocity; rubber-band past the ends.\n const drag = useRef<{\n y: number;\n scroll: number;\n pts: [number, number][];\n } | null>(null);\n // Coalesce touch/pointer moves to one paint per animation frame — raw move\n // events fire several times per frame (and off-frame) on high-refresh\n // screens, and painting each one is what made the drag feel choppy.\n const dragFrame = useRef(0);\n const latestY = useRef(0);\n // Shared drag core, driven by a Y coordinate from either a mouse pointer or a\n // native touch. Touch is bound with non-passive listeners in the effect below\n // so the move can preventDefault the page scroll — React's synthetic touch\n // events are passive and can't, which is why finger-drag did nothing on\n // mobile.\n const beginDrag = useCallback(\n (y: number) => {\n stop();\n if (sound) getPlayer().prepare();\n setGrabbing(true);\n drag.current = {\n y,\n scroll: scroll.current,\n pts: [[y, performance.now()]],\n };\n },\n [stop, sound, getPlayer],\n );\n const moveDrag = useCallback(\n (y: number) => {\n const d = drag.current;\n if (!d) return;\n // Record every sample for an accurate release velocity, but only render\n // the newest position once per frame.\n latestY.current = y;\n d.pts.push([y, performance.now()]);\n if (d.pts.length > 8) d.pts.shift();\n if (dragFrame.current) return;\n dragFrame.current = requestAnimationFrame(() => {\n dragFrame.current = 0;\n const dd = drag.current;\n if (!dd) return;\n let next = dd.scroll + (dd.y - latestY.current) / itemHeight;\n if (next < 0) next *= 0.3;\n else if (next > last) next = last + (next - last) * 0.3;\n scroll.current = next;\n paint(next);\n maybeTick(next);\n emit(Math.round(clamp(next, 0, last)));\n });\n },\n [itemHeight, last, paint, emit, maybeTick],\n );\n const endDrag = useCallback(() => {\n const d = drag.current;\n if (!d) return;\n if (dragFrame.current) {\n cancelAnimationFrame(dragFrame.current);\n dragFrame.current = 0;\n }\n drag.current = null;\n setGrabbing(false);\n // Average velocity over the last `VELOCITY_WINDOW` ms of movement rather\n // than the final two samples — a single noisy frame otherwise makes an\n // even flick feel like it caught or slipped.\n const pts = d.pts;\n let v = 0;\n if (pts.length > 1) {\n const latest = pts[pts.length - 1];\n let ref = pts[0];\n for (const p of pts) {\n if (latest[1] - p[1] <= VELOCITY_WINDOW) {\n ref = p;\n break;\n }\n }\n const dt = latest[1] - ref[1];\n if (dt > 0) {\n const raw = (ref[0] - latest[0]) / itemHeight / dt;\n v = clamp(raw, -MAX_VELOCITY, MAX_VELOCITY);\n }\n }\n fling(v);\n }, [itemHeight, fling]);\n\n // Mouse / pen only — touch runs through the native listeners in the effect.\n const onPointerDown = useCallback(\n (event: PointerEvent<HTMLDivElement>) => {\n if (disabled || reduce || event.pointerType === \"touch\") return;\n event.currentTarget.setPointerCapture(event.pointerId);\n beginDrag(event.clientY);\n },\n [disabled, reduce, beginDrag],\n );\n const onPointerMove = useCallback(\n (event: PointerEvent<HTMLDivElement>) => {\n if (event.pointerType === \"touch\") return;\n moveDrag(event.clientY);\n },\n [moveDrag],\n );\n const onPointerUp = useCallback(\n (event: PointerEvent<HTMLDivElement>) => {\n if (event.pointerType === \"touch\") return;\n event.currentTarget.releasePointerCapture?.(event.pointerId);\n endDrag();\n },\n [endDrag],\n );\n\n // Wheel drives `scroll` continuously — like a drag — then snaps once it goes\n // idle. Firing a fresh eased step per notch instead stacks overlapping\n // animations that keep interrupting each other, which read as lag.\n const wheelSnap = useRef<ReturnType<typeof setTimeout> | null>(null);\n const onWheel = useCallback(\n (event: globalThis.WheelEvent) => {\n // Native (non-passive) so preventDefault actually stops the page from\n // scrolling behind the wheel — React's synthetic wheel listener is\n // passive, so a handler on the element cannot cancel the scroll.\n if (disabled || reduce) return;\n event.preventDefault();\n if (sound) getPlayer().prepare();\n stop();\n const px = event.deltaMode === 1 ? event.deltaY * 16 : event.deltaY;\n const next = clamp(scroll.current + px * WHEEL_SENS, 0, last);\n scroll.current = next;\n paint(next);\n maybeTick(next);\n emit(Math.round(next));\n if (wheelSnap.current) clearTimeout(wheelSnap.current);\n wheelSnap.current = setTimeout(() => {\n glide(clamp(Math.round(scroll.current), 0, last), 240, easeOutBack);\n }, WHEEL_SETTLE);\n },\n [disabled, reduce, sound, last, paint, emit, stop, glide, maybeTick, getPlayer],\n );\n\n const onKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if (disabled) return;\n const at = Math.round(scroll.current);\n const map: Record<string, number> = {\n ArrowUp: -1,\n ArrowDown: 1,\n Home: -at,\n End: last - at,\n };\n if (event.key in map) {\n event.preventDefault();\n if (sound) getPlayer().prepare();\n step(map[event.key]);\n }\n },\n [disabled, sound, last, step, getPlayer],\n );\n\n // Paint the starting frame, and follow controlled/value changes from outside\n // unless a gesture is mid-flight.\n useEffect(() => {\n if (drag.current) return;\n const target = indexOf(currentValue);\n emitted.current = currentValue;\n if (Math.abs(Math.round(scroll.current) - target) < 0.001) {\n paint(scroll.current);\n return;\n }\n glide(target, 260);\n }, [currentValue, indexOf, paint, glide]);\n\n useEffect(\n () => () => {\n cancelAnimationFrame(raf.current);\n cancelAnimationFrame(dragFrame.current);\n if (wheelSnap.current) clearTimeout(wheelSnap.current);\n tickPlayer.current?.dispose();\n },\n [],\n );\n\n // Native touch + wheel listeners, bound non-passively so touchmove and wheel\n // can block the page from scrolling while the wheel spins. React's synthetic\n // touch/wheel handlers are passive, so preventDefault there is a no-op and the\n // gesture scrolls the page instead of driving the drum.\n useEffect(() => {\n const el = container.current;\n if (!el || reduce || disabled) return;\n const onStart = (e: TouchEvent) => {\n const t = e.touches[0];\n if (t) beginDrag(t.clientY);\n };\n const onMove = (e: TouchEvent) => {\n const t = e.touches[0];\n if (!t || !drag.current) return;\n e.preventDefault();\n moveDrag(t.clientY);\n };\n const onEnd = () => endDrag();\n el.addEventListener(\"touchstart\", onStart, { passive: true });\n el.addEventListener(\"touchmove\", onMove, { passive: false });\n el.addEventListener(\"touchend\", onEnd);\n el.addEventListener(\"touchcancel\", onEnd);\n el.addEventListener(\"wheel\", onWheel, { passive: false });\n return () => {\n el.removeEventListener(\"touchstart\", onStart);\n el.removeEventListener(\"touchmove\", onMove);\n el.removeEventListener(\"touchend\", onEnd);\n el.removeEventListener(\"touchcancel\", onEnd);\n el.removeEventListener(\"wheel\", onWheel);\n };\n }, [reduce, disabled, beginDrag, moveDrag, endDrag, onWheel]);\n\n const maskFade =\n \"[mask-image:linear-gradient(to_bottom,transparent,#000_22%,#000_78%,transparent)]\";\n\n if (reduce) {\n const pad = (height - itemHeight) / 2;\n return (\n <div\n className={cn(\n \"relative overflow-hidden rounded-2xl border border-border bg-card\",\n disabled && \"pointer-events-none opacity-50\",\n className,\n )}\n style={{ height }}\n >\n <div\n className=\"pointer-events-none absolute inset-x-0 top-1/2 z-10 -translate-y-1/2 border-border border-y bg-foreground/4\"\n style={{ height: itemHeight }}\n />\n <ul\n className={cn(\n \"h-full snap-y snap-mandatory overflow-y-auto scroll-smooth [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden\",\n maskFade,\n )}\n style={{ paddingTop: pad, paddingBottom: pad }}\n >\n {options.map((option) => {\n const v = optionValue(option);\n return (\n <li key={v} className=\"snap-center\">\n <button\n type=\"button\"\n disabled={disabled}\n onClick={() => emit(options.indexOf(option))}\n className={cn(\n \"flex w-full items-center justify-center font-medium\",\n v === currentValue ? \"text-foreground\" : \"text-muted-foreground\",\n )}\n style={{ height: itemHeight }}\n >\n {optionLabel(option)}\n </button>\n </li>\n );\n })}\n </ul>\n </div>\n );\n }\n\n return (\n <div\n ref={container}\n role=\"listbox\"\n aria-label={ariaLabel}\n tabIndex={disabled ? -1 : 0}\n onKeyDown={onKeyDown}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={onPointerUp}\n onPointerCancel={onPointerUp}\n className={cn(\n \"relative touch-none select-none overflow-hidden rounded-2xl border border-border bg-card outline-none focus-visible:ring-2 focus-visible:ring-foreground/20\",\n grabbing ? \"cursor-grabbing\" : \"cursor-grab\",\n disabled && \"pointer-events-none opacity-50\",\n maskFade,\n className,\n )}\n style={{ height, perspective: 1000 }}\n >\n {/* Curved drum of dimmed rows. */}\n <ul\n ref={drumRef}\n aria-hidden\n className=\"backface-hidden transform-3d absolute inset-x-0 top-1/2 m-0 h-0 list-none p-0 will-change-transform\"\n >\n {options.map((option, i) => (\n <li\n key={optionValue(option)}\n data-index={i}\n className=\"absolute inset-x-0 flex items-center justify-center font-medium text-muted-foreground\"\n style={{\n top: -itemHeight / 2,\n height: itemHeight,\n transform: `rotateX(${-itemAngle * i}deg) translateZ(${radius}px)`,\n }}\n >\n {optionLabel(option)}\n </li>\n ))}\n </ul>\n\n {/* Center band: the very same drum, clipped to one row and drawn crisp.\n Its own perspective, centred on the container middle, matches the main\n drum's projection so the two copies register exactly. */}\n <div\n className=\"pointer-events-none absolute inset-x-0 top-1/2 z-10 -translate-y-1/2 overflow-hidden rounded-md bg-foreground/4\"\n style={{ height: itemHeight, perspective: 1000 }}\n >\n <ul\n ref={bandRef}\n aria-hidden\n className=\"backface-hidden transform-3d absolute inset-x-0 top-1/2 m-0 h-0 list-none p-0 will-change-transform\"\n >\n {options.map((option, i) => (\n <li\n key={optionValue(option)}\n data-index={i}\n className=\"absolute inset-x-0 flex items-center justify-center font-medium text-foreground\"\n style={{\n top: -itemHeight / 2,\n height: itemHeight,\n transform: `rotateX(${-itemAngle * i}deg) translateZ(${radius}px)`,\n }}\n >\n {optionLabel(option)}\n </li>\n ))}\n </ul>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;AAkCA,MAAM,MAAM,KAAK,KAAK;AAItB,MAAM,eAAe;AACrB,MAAM,eAAe;AACrB,MAAM,kBAAkB;AACxB,MAAM,aAAa;AACnB,MAAM,eAAe;AACrB,MAAM,gBAAgB,MAAc,KAAK,IAAI,MAAM;AAGnD,MAAM,OAAO;AACb,MAAM,eAAe,MAAc,IAAK,QAAa,IAAI,MAAM,IAAI,QAAQ,IAAI,MAAM;AAErF,MAAM,SAAS,GAAW,IAAY,OAAe,KAAK,IAAI,IAAI,KAAK,IAAI,GAAG,EAAE,CAAC;AAEjF,SAAS,YAAY,QAA2B;CAC9C,OAAO,OAAO,WAAW,WAAW,SAAS,OAAO;AACtD;AACA,SAAS,YAAY,QAA2B;CAC9C,OAAO,OAAO,WAAW,WAAW,SAAS,OAAO;AACtD;AAEA,SAAgB,YAAY,EAC1B,SACA,OACA,cACA,eACA,eAAe,GACf,aAAa,IACb,WAAW,OACX,QAAQ,OACR,WACA,cAAc,aACK;CACnB,MAAM,SAAS,iBAAiB,KAAK;CACrC,MAAM,aAAa,UAAU,KAAA;CAC7B,MAAM,OAAO,QAAQ,SAAS;CAE9B,MAAM,UAAU,aACb,MAA0B;EACzB,MAAM,IAAI,QAAQ,WAAW,MAAM,YAAY,CAAC,MAAM,CAAC;EACvD,OAAO,IAAI,IAAI,IAAI;CACrB,GACA,CA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EACb,iBAAiB;EACjB,WAAW,GACT,+JACA,WAAW,oBAAoB,eAC/B,YAAY,kCACZ,UACA,SACF;EACA,OAAO;GAAE;GAAQ,aAAa;EAAK;EAjBrC,UAAA,CAoBE,oBAAC,MAAD;GACE,KAAK;GACL,eAAA;GACA,WAAU;GAET,UAAA,QAAQ,KAAK,QAAQ,MACpB,oBAAC,MAAD;IAEE,cAAY;IACZ,WAAU;IACV,OAAO;KACL,KAAK,CAAC,aAAa;KACnB,QAAQ;KACR,WAAW,WAAW,CAAC,YAAY,EAAE,kBAAkB,OAAO;IAChE;IAEC,UAAA,YAAY,MAAM;GACjB,GAVG,YAAY,MAAM,CAUrB,CACL;EACC,CAAA,GAKJ,oBAAC,OAAD;GACE,WAAU;GACV,OAAO;IAAE,QAAQ;IAAY,aAAa;GAAK;GAE/C,UAAA,oBAAC,MAAD;IACE,KAAK;IACL,eAAA;IACA,WAAU;IAET,UAAA,QAAQ,KAAK,QAAQ,MACpB,oBAAC,MAAD;KAEE,cAAY;KACZ,WAAU;KACV,OAAO;MACL,KAAK,CAAC,aAAa;MACnB,QAAQ;MACR,WAAW,WAAW,CAAC,YAAY,EAAE,kBAAkB,OAAO;KAChE;KAEC,UAAA,YAAY,MAAM;IACjB,GAVG,YAAY,MAAM,CAUrB,CACL;GACC,CAAA;EACD,CAAA,CACF;;AAET"}
1
+ {"version":3,"file":"wheel-picker.js","names":[],"sources":["../../../src/components/motion/wheel-picker.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type KeyboardEvent,\n type PointerEvent,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { createTickPlayer } from \"../../lib/tick-sound\";\nimport { capturePointer, releasePointer, TOUCH_GESTURE_CLASS } from \"../../lib/touch\";\n\nexport type WheelPickerOption = string | { label: string; value: string };\n\nexport interface WheelPickerProps {\n options: WheelPickerOption[];\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n /** Rows visible through the window, odd. More = flatter curve. Default 5. */\n visibleCount?: number;\n /** Row height in px. Default 36. */\n itemHeight?: number;\n disabled?: boolean;\n /** Play a short tick each time the selected value changes. Default false. */\n sound?: boolean;\n className?: string;\n \"aria-label\"?: string;\n}\n\nconst DEG = Math.PI / 180;\n// Physics constants, tuned for an iOS-like flick rather than reused from the\n// shared spring tokens: the wheel coasts in whole-row units and springs to an\n// integer detent, which a layout spring can't express cleanly.\nconst DECELERATION = 0.00042; // rows per ms², how fast a flick bleeds off (lower = freer)\nconst MAX_VELOCITY = 0.18; // rows per ms, caps a hard fling\nconst VELOCITY_WINDOW = 90; // ms of recent drag to average a release velocity over\nconst WHEEL_SENS = 0.012; // rows per pixel of wheel delta\nconst WHEEL_SETTLE = 110; // ms of wheel idle before snapping to a row\nconst easeOutCubic = (p: number) => 1 - (1 - p) ** 3;\n// Overshoots the target by a few percent then settles — the little spring\n// bounce as a row snaps home. `BACK` sets how far it drifts past.\nconst BACK = 1.35;\nconst easeOutBack = (p: number) => 1 + (BACK + 1) * (p - 1) ** 3 + BACK * (p - 1) ** 2;\n\nconst clamp = (v: number, lo: number, hi: number) => Math.max(lo, Math.min(v, hi));\n\nfunction optionValue(option: WheelPickerOption) {\n return typeof option === \"string\" ? option : option.value;\n}\nfunction optionLabel(option: WheelPickerOption) {\n return typeof option === \"string\" ? option : option.label;\n}\n\nexport function WheelPicker({\n options,\n value,\n defaultValue,\n onValueChange,\n visibleCount = 5,\n itemHeight = 36,\n disabled = false,\n sound = false,\n className,\n \"aria-label\": ariaLabel,\n}: WheelPickerProps) {\n const reduce = useReducedMotion() ?? false;\n const controlled = value !== undefined;\n const last = options.length - 1;\n\n const indexOf = useCallback(\n (v: string | undefined) => {\n const i = options.findIndex((o) => optionValue(o) === v);\n return i < 0 ? 0 : i;\n },\n [options],\n );\n\n const [internal, setInternal] = useState(() => defaultValue ?? value);\n const currentValue = controlled ? value : internal;\n const [grabbing, setGrabbing] = useState(false);\n\n // Cylinder geometry. Each row spans `itemAngle`; `radius` seats the rows on\n // the drum; rows past `hideBeyond` sit behind the horizon and are dropped.\n const { itemAngle, radius, height, hideBeyond } = useMemo(() => {\n const rowsEachSide = Math.max(1, Math.floor(visibleCount / 2));\n const cutoff = rowsEachSide + 1;\n const angle = 90 / cutoff;\n const r = itemHeight / Math.tan(angle * DEG);\n return {\n itemAngle: angle,\n radius: r,\n hideBeyond: cutoff,\n height: Math.round(2 * r * Math.sin(rowsEachSide * angle * DEG) + itemHeight),\n };\n }, [visibleCount, itemHeight]);\n\n const container = useRef<HTMLDivElement>(null);\n const drumRef = useRef<HTMLUListElement>(null);\n const bandRef = useRef<HTMLUListElement>(null);\n // Scroll position measured in rows (a float index). One source of truth for\n // both layers: the drum rotates by `itemAngle·scroll`, the crisp band slides\n // by `itemHeight·scroll`.\n const scroll = useRef(indexOf(currentValue));\n const raf = useRef(0);\n const emitted = useRef(currentValue);\n const tickPlayer = useRef<ReturnType<typeof createTickPlayer> | null>(null);\n const lastTick = useRef(indexOf(currentValue));\n\n const paint = useCallback(\n (s: number) => {\n const drum = drumRef.current;\n const band = bandRef.current;\n if (drum) {\n drum.style.transform = `translateZ(${-radius}px) rotateX(${itemAngle * s}deg)`;\n for (const node of Array.from(drum.children)) {\n const li = node as HTMLLIElement;\n const i = Number(li.dataset.index);\n const want = Math.abs(i - s) > hideBeyond ? \"hidden\" : \"visible\";\n // Write only on change — an unconditional write every frame thrashes\n // style recalc and is what made the drag feel draggy on mobile.\n if (li.style.visibility !== want) li.style.visibility = want;\n }\n }\n // The band is the SAME drum, clipped to the centre row — driven by the\n // identical transform so the crisp copy sits exactly on the dimmed one,\n // with no parallax ghost as rows cross the window. It needs the same\n // horizon cull, or the row on the back of the drum bleeds into the front.\n if (band) {\n band.style.transform = `translateZ(${-radius}px) rotateX(${itemAngle * s}deg)`;\n for (const node of Array.from(band.children)) {\n const li = node as HTMLLIElement;\n const i = Number(li.dataset.index);\n const want = Math.abs(i - s) > hideBeyond ? \"hidden\" : \"visible\";\n if (li.style.visibility !== want) li.style.visibility = want;\n }\n }\n },\n [radius, itemAngle, hideBeyond],\n );\n\n const getPlayer = useCallback(() => {\n if (!tickPlayer.current) tickPlayer.current = createTickPlayer();\n return tickPlayer.current;\n }, []);\n\n const emit = useCallback(\n (i: number) => {\n const v = optionValue(options[clamp(i, 0, last)]);\n if (v === emitted.current) return;\n emitted.current = v;\n // Reduced motion has no drum/glide path to tick from — it's an\n // onClick straight into emit, so the tick lives here instead.\n if (sound && reduce) getPlayer().play();\n if (!controlled) setInternal(v);\n onValueChange?.(v);\n },\n [options, last, controlled, onValueChange, sound, reduce, getPlayer],\n );\n\n // Drum path: fires a tick whenever the nearest row changes, independent of\n // `emit` (which only fires on settle during a glide/fling, not per row\n // crossed). Gated on `!reduce` since the reduced render never calls this.\n const maybeTick = useCallback(\n (pos: number) => {\n const row = clamp(Math.round(pos), 0, last);\n if (!sound || reduce) {\n lastTick.current = row;\n return;\n }\n if (row === lastTick.current) return;\n lastTick.current = row;\n getPlayer().play();\n },\n [sound, reduce, last, getPlayer],\n );\n\n const stop = useCallback(() => cancelAnimationFrame(raf.current), []);\n\n // Ease `scroll` from where it is to an integer detent over `duration`. The\n // easing may overshoot (spring bounce) before it resolves exactly on `to`.\n const glide = useCallback(\n (to: number, duration: number, ease: (p: number) => number = easeOutCubic) => {\n stop();\n const from = scroll.current;\n const dist = to - from;\n if (!dist || duration <= 0) {\n scroll.current = to;\n paint(to);\n maybeTick(to);\n emit(to);\n return;\n }\n const start = performance.now();\n const tick = (now: number) => {\n const p = (now - start) / duration;\n if (p >= 1) {\n scroll.current = to;\n paint(to);\n maybeTick(to);\n emit(to);\n return;\n }\n scroll.current = from + dist * ease(p);\n paint(scroll.current);\n maybeTick(scroll.current);\n raf.current = requestAnimationFrame(tick);\n };\n raf.current = requestAnimationFrame(tick);\n },\n [stop, paint, emit, maybeTick],\n );\n\n // Project where a flick of `velocity` (rows/ms) coasts to, snap to a row.\n const fling = useCallback(\n (velocity: number) => {\n const from = scroll.current;\n if (from < 0 || from > last) {\n glide(clamp(Math.round(from), 0, last), 260); // rubber-band back\n return;\n }\n const dir = Math.sign(velocity);\n const coast = ((velocity * velocity) / (2 * DECELERATION)) * dir;\n const to = clamp(Math.round(from + coast), 0, last);\n // Long, spring-tipped settle so a hard flick reads as free momentum\n // coasting to rest with a gentle bounce, never a clipped stop.\n const duration = clamp(Math.sqrt(Math.abs(to - from)) * 300 + 240, 280, 1700);\n glide(to, duration, easeOutBack);\n },\n [glide, last],\n );\n\n const step = useCallback(\n (by: number) => glide(clamp(Math.round(scroll.current) + by, 0, last), 300, easeOutBack),\n [glide, last],\n );\n\n // Drag: track recent points for a release velocity; rubber-band past the ends.\n const drag = useRef<{\n y: number;\n scroll: number;\n pts: [number, number][];\n } | null>(null);\n // Coalesce touch/pointer moves to one paint per animation frame — raw move\n // events fire several times per frame (and off-frame) on high-refresh\n // screens, and painting each one is what made the drag feel choppy.\n const dragFrame = useRef(0);\n const latestY = useRef(0);\n // Shared drag core, driven by a Y coordinate from either a mouse pointer or a\n // native touch. Touch is bound with non-passive listeners in the effect below\n // so the move can preventDefault the page scroll — React's synthetic touch\n // events are passive and can't, which is why finger-drag did nothing on\n // mobile.\n const beginDrag = useCallback(\n (y: number) => {\n stop();\n if (sound) getPlayer().prepare();\n setGrabbing(true);\n drag.current = {\n y,\n scroll: scroll.current,\n pts: [[y, performance.now()]],\n };\n },\n [stop, sound, getPlayer],\n );\n const moveDrag = useCallback(\n (y: number) => {\n const d = drag.current;\n if (!d) return;\n // Record every sample for an accurate release velocity, but only render\n // the newest position once per frame.\n latestY.current = y;\n d.pts.push([y, performance.now()]);\n if (d.pts.length > 8) d.pts.shift();\n if (dragFrame.current) return;\n dragFrame.current = requestAnimationFrame(() => {\n dragFrame.current = 0;\n const dd = drag.current;\n if (!dd) return;\n let next = dd.scroll + (dd.y - latestY.current) / itemHeight;\n if (next < 0) next *= 0.3;\n else if (next > last) next = last + (next - last) * 0.3;\n scroll.current = next;\n paint(next);\n maybeTick(next);\n emit(Math.round(clamp(next, 0, last)));\n });\n },\n [itemHeight, last, paint, emit, maybeTick],\n );\n const endDrag = useCallback(() => {\n const d = drag.current;\n if (!d) return;\n if (dragFrame.current) {\n cancelAnimationFrame(dragFrame.current);\n dragFrame.current = 0;\n }\n drag.current = null;\n setGrabbing(false);\n // Average velocity over the last `VELOCITY_WINDOW` ms of movement rather\n // than the final two samples — a single noisy frame otherwise makes an\n // even flick feel like it caught or slipped.\n const pts = d.pts;\n let v = 0;\n if (pts.length > 1) {\n const latest = pts[pts.length - 1];\n let ref = pts[0];\n for (const p of pts) {\n if (latest[1] - p[1] <= VELOCITY_WINDOW) {\n ref = p;\n break;\n }\n }\n const dt = latest[1] - ref[1];\n if (dt > 0) {\n const raw = (ref[0] - latest[0]) / itemHeight / dt;\n v = clamp(raw, -MAX_VELOCITY, MAX_VELOCITY);\n }\n }\n fling(v);\n }, [itemHeight, fling]);\n\n // Mouse / pen only — touch runs through the native listeners in the effect.\n const onPointerDown = useCallback(\n (event: PointerEvent<HTMLDivElement>) => {\n if (disabled || reduce || event.pointerType === \"touch\") return;\n beginDrag(event.clientY);\n capturePointer(event.currentTarget, event.pointerId);\n },\n [disabled, reduce, beginDrag],\n );\n const onPointerMove = useCallback(\n (event: PointerEvent<HTMLDivElement>) => {\n if (event.pointerType === \"touch\") return;\n moveDrag(event.clientY);\n },\n [moveDrag],\n );\n const onPointerUp = useCallback(\n (event: PointerEvent<HTMLDivElement>) => {\n if (event.pointerType === \"touch\") return;\n // Also the pointercancel handler, where the capture is already gone —\n // an unguarded release throws there and the drum never settles.\n releasePointer(event.currentTarget, event.pointerId);\n endDrag();\n },\n [endDrag],\n );\n\n // Wheel drives `scroll` continuously — like a drag — then snaps once it goes\n // idle. Firing a fresh eased step per notch instead stacks overlapping\n // animations that keep interrupting each other, which read as lag.\n const wheelSnap = useRef<ReturnType<typeof setTimeout> | null>(null);\n const onWheel = useCallback(\n (event: globalThis.WheelEvent) => {\n // Native (non-passive) so preventDefault actually stops the page from\n // scrolling behind the wheel — React's synthetic wheel listener is\n // passive, so a handler on the element cannot cancel the scroll.\n if (disabled || reduce) return;\n event.preventDefault();\n if (sound) getPlayer().prepare();\n stop();\n const px = event.deltaMode === 1 ? event.deltaY * 16 : event.deltaY;\n const next = clamp(scroll.current + px * WHEEL_SENS, 0, last);\n scroll.current = next;\n paint(next);\n maybeTick(next);\n emit(Math.round(next));\n if (wheelSnap.current) clearTimeout(wheelSnap.current);\n wheelSnap.current = setTimeout(() => {\n glide(clamp(Math.round(scroll.current), 0, last), 240, easeOutBack);\n }, WHEEL_SETTLE);\n },\n [disabled, reduce, sound, last, paint, emit, stop, glide, maybeTick, getPlayer],\n );\n\n const onKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if (disabled) return;\n const at = Math.round(scroll.current);\n const map: Record<string, number> = {\n ArrowUp: -1,\n ArrowDown: 1,\n Home: -at,\n End: last - at,\n };\n if (event.key in map) {\n event.preventDefault();\n if (sound) getPlayer().prepare();\n step(map[event.key]);\n }\n },\n [disabled, sound, last, step, getPlayer],\n );\n\n // Paint the starting frame, and follow controlled/value changes from outside\n // unless a gesture is mid-flight.\n useEffect(() => {\n if (drag.current) return;\n const target = indexOf(currentValue);\n emitted.current = currentValue;\n if (Math.abs(Math.round(scroll.current) - target) < 0.001) {\n paint(scroll.current);\n return;\n }\n glide(target, 260);\n }, [currentValue, indexOf, paint, glide]);\n\n useEffect(\n () => () => {\n cancelAnimationFrame(raf.current);\n cancelAnimationFrame(dragFrame.current);\n if (wheelSnap.current) clearTimeout(wheelSnap.current);\n tickPlayer.current?.dispose();\n },\n [],\n );\n\n // Native touch + wheel listeners, bound non-passively so touchmove and wheel\n // can block the page from scrolling while the wheel spins. React's synthetic\n // touch/wheel handlers are passive, so preventDefault there is a no-op and the\n // gesture scrolls the page instead of driving the drum.\n useEffect(() => {\n const el = container.current;\n if (!el || reduce || disabled) return;\n const onStart = (e: TouchEvent) => {\n const t = e.touches[0];\n if (t) beginDrag(t.clientY);\n };\n const onMove = (e: TouchEvent) => {\n const t = e.touches[0];\n if (!t || !drag.current) return;\n e.preventDefault();\n moveDrag(t.clientY);\n };\n const onEnd = () => endDrag();\n el.addEventListener(\"touchstart\", onStart, { passive: true });\n el.addEventListener(\"touchmove\", onMove, { passive: false });\n el.addEventListener(\"touchend\", onEnd);\n el.addEventListener(\"touchcancel\", onEnd);\n el.addEventListener(\"wheel\", onWheel, { passive: false });\n return () => {\n el.removeEventListener(\"touchstart\", onStart);\n el.removeEventListener(\"touchmove\", onMove);\n el.removeEventListener(\"touchend\", onEnd);\n el.removeEventListener(\"touchcancel\", onEnd);\n el.removeEventListener(\"wheel\", onWheel);\n };\n }, [reduce, disabled, beginDrag, moveDrag, endDrag, onWheel]);\n\n const maskFade =\n \"[mask-image:linear-gradient(to_bottom,transparent,#000_22%,#000_78%,transparent)]\";\n\n if (reduce) {\n const pad = (height - itemHeight) / 2;\n return (\n <div\n className={cn(\n \"relative overflow-hidden rounded-2xl border border-border bg-card\",\n disabled && \"pointer-events-none opacity-50\",\n className,\n )}\n style={{ height }}\n >\n <div\n className=\"pointer-events-none absolute inset-x-0 top-1/2 z-10 -translate-y-1/2 border-border border-y bg-foreground/4\"\n style={{ height: itemHeight }}\n />\n <ul\n className={cn(\n \"h-full snap-y snap-mandatory overflow-y-auto scroll-smooth [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden\",\n maskFade,\n )}\n style={{ paddingTop: pad, paddingBottom: pad }}\n >\n {options.map((option) => {\n const v = optionValue(option);\n return (\n <li key={v} className=\"snap-center\">\n <button\n type=\"button\"\n disabled={disabled}\n onClick={() => emit(options.indexOf(option))}\n className={cn(\n \"flex w-full items-center justify-center font-medium\",\n v === currentValue ? \"text-foreground\" : \"text-muted-foreground\",\n )}\n style={{ height: itemHeight }}\n >\n {optionLabel(option)}\n </button>\n </li>\n );\n })}\n </ul>\n </div>\n );\n }\n\n return (\n <div\n ref={container}\n role=\"listbox\"\n aria-label={ariaLabel}\n tabIndex={disabled ? -1 : 0}\n onKeyDown={onKeyDown}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={onPointerUp}\n onPointerCancel={onPointerUp}\n className={cn(\n \"relative touch-none overflow-hidden rounded-2xl border border-border bg-card outline-none focus-visible:ring-2 focus-visible:ring-foreground/20\",\n // The drum owns the whole gesture; iOS must not open its callout or\n // start a drag out of the same press and cancel ours.\n TOUCH_GESTURE_CLASS,\n grabbing ? \"cursor-grabbing\" : \"cursor-grab\",\n disabled && \"pointer-events-none opacity-50\",\n maskFade,\n className,\n )}\n style={{ height, perspective: 1000 }}\n >\n {/* Curved drum of dimmed rows. */}\n <ul\n ref={drumRef}\n aria-hidden\n className=\"backface-hidden transform-3d absolute inset-x-0 top-1/2 m-0 h-0 list-none p-0 will-change-transform\"\n >\n {options.map((option, i) => (\n <li\n key={optionValue(option)}\n data-index={i}\n className=\"absolute inset-x-0 flex items-center justify-center font-medium text-muted-foreground\"\n style={{\n top: -itemHeight / 2,\n height: itemHeight,\n transform: `rotateX(${-itemAngle * i}deg) translateZ(${radius}px)`,\n }}\n >\n {optionLabel(option)}\n </li>\n ))}\n </ul>\n\n {/* Center band: the very same drum, clipped to one row and drawn crisp.\n Its own perspective, centred on the container middle, matches the main\n drum's projection so the two copies register exactly. */}\n <div\n className=\"pointer-events-none absolute inset-x-0 top-1/2 z-10 -translate-y-1/2 overflow-hidden rounded-md bg-foreground/4\"\n style={{ height: itemHeight, perspective: 1000 }}\n >\n <ul\n ref={bandRef}\n aria-hidden\n className=\"backface-hidden transform-3d absolute inset-x-0 top-1/2 m-0 h-0 list-none p-0 will-change-transform\"\n >\n {options.map((option, i) => (\n <li\n key={optionValue(option)}\n data-index={i}\n className=\"absolute inset-x-0 flex items-center justify-center font-medium text-foreground\"\n style={{\n top: -itemHeight / 2,\n height: itemHeight,\n transform: `rotateX(${-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a;KACnB,QAAQ;KACR,WAAW,WAAW,CAAC,YAAY,EAAE,kBAAkB,OAAO;IAChE;IAEC,UAAA,YAAY,MAAM;GACjB,GAVG,YAAY,MAAM,CAUrB,CACL;EACC,CAAA,GAKJ,oBAAC,OAAD;GACE,WAAU;GACV,OAAO;IAAE,QAAQ;IAAY,aAAa;GAAK;GAE/C,UAAA,oBAAC,MAAD;IACE,KAAK;IACL,eAAA;IACA,WAAU;IAET,UAAA,QAAQ,KAAK,QAAQ,MACpB,oBAAC,MAAD;KAEE,cAAY;KACZ,WAAU;KACV,OAAO;MACL,KAAK,CAAC,aAAa;MACnB,QAAQ;MACR,WAAW,WAAW,CAAC,YAAY,EAAE,kBAAkB,OAAO;KAChE;KAEC,UAAA,YAAY,MAAM;IACjB,GAVG,YAAY,MAAM,CAUrB,CACL;GACC,CAAA;EACD,CAAA,CACF;;AAET"}
@@ -2,7 +2,7 @@ import { VariantProps } from "class-variance-authority";
2
2
  import { useRender } from "@base-ui/react/use-render";
3
3
  //#region src/components/reui/badge.d.ts
4
4
  declare const badgeVariants: (props?: ({
5
- variant?: "outline" | "default" | "destructive" | "info" | "success" | "warning" | "invert" | "secondary" | "focus" | "primary-light" | "warning-light" | "success-light" | "info-light" | "destructive-light" | "invert-light" | "focus-light" | "primary-outline" | "warning-outline" | "success-outline" | "info-outline" | "destructive-outline" | "invert-outline" | "focus-outline" | null | undefined;
5
+ variant?: "outline" | "secondary" | "default" | "destructive" | "info" | "success" | "warning" | "invert" | "focus" | "primary-light" | "warning-light" | "success-light" | "info-light" | "destructive-light" | "invert-light" | "focus-light" | "primary-outline" | "warning-outline" | "success-outline" | "info-outline" | "destructive-outline" | "invert-outline" | "focus-outline" | null | undefined;
6
6
  size?: "default" | "sm" | "lg" | "xs" | "xl" | null | undefined;
7
7
  radius?: "default" | "full" | null | undefined;
8
8
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -22,7 +22,7 @@ import { useRender } from "@base-ui/react/use-render";
22
22
  * default to `text-primary`; override it to recolor without touching internals.
23
23
  */
24
24
  declare const iconTileVariants: (props?: ({
25
- variant?: "soft" | "solid" | "outline" | "elevated" | "frame" | null | undefined;
25
+ variant?: "outline" | "soft" | "solid" | "elevated" | "frame" | null | undefined;
26
26
  size?: "default" | "sm" | "lg" | "xs" | "xl" | null | undefined;
27
27
  radius?: "default" | "full" | null | undefined;
28
28
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -5,7 +5,7 @@ import { useRender } from "@base-ui/react/use-render";
5
5
  //#region src/components/ui/attachment.d.ts
6
6
  declare const attachmentVariants: (props?: ({
7
7
  size?: "default" | "sm" | "xs" | null | undefined;
8
- orientation?: "horizontal" | "vertical" | null | undefined;
8
+ orientation?: "vertical" | "horizontal" | null | undefined;
9
9
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
10
10
  declare function Attachment({ className, state, size, orientation, ...props }: React$1.ComponentProps<"div"> & VariantProps<typeof attachmentVariants> & {
11
11
  state?: "idle" | "uploading" | "processing" | "error" | "done";
@@ -2,7 +2,7 @@ import { VariantProps } from "class-variance-authority";
2
2
  import { useRender } from "@base-ui/react/use-render";
3
3
  //#region src/components/ui/badge.d.ts
4
4
  declare const badgeVariants: (props?: ({
5
- variant?: "link" | "outline" | "ghost" | "default" | "destructive" | "secondary" | null | undefined;
5
+ variant?: "ghost" | "outline" | "secondary" | "default" | "link" | "destructive" | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
7
  declare function Badge({ className, variant, render, ...props }: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
8
8
  //#endregion
@@ -4,7 +4,7 @@ import { useRender } from "@base-ui/react/use-render";
4
4
  //#region src/components/ui/bubble.d.ts
5
5
  declare function BubbleGroup({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
6
6
  declare const bubbleVariants: (props?: ({
7
- variant?: "outline" | "ghost" | "default" | "destructive" | "secondary" | "muted" | "tinted" | null | undefined;
7
+ variant?: "ghost" | "outline" | "secondary" | "default" | "destructive" | "muted" | "tinted" | null | undefined;
8
8
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
9
  declare function Bubble({ variant, align, className, ...props }: React$1.ComponentProps<"div"> & VariantProps<typeof bubbleVariants> & {
10
10
  align?: "start" | "end";
@@ -3,7 +3,7 @@ import { VariantProps } from "class-variance-authority";
3
3
  import { useRender } from "@base-ui/react/use-render";
4
4
  //#region src/components/ui/button-group.d.ts
5
5
  declare const buttonGroupVariants: (props?: ({
6
- orientation?: "horizontal" | "vertical" | null | undefined;
6
+ orientation?: "vertical" | "horizontal" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
8
  declare function ButtonGroup({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>): import("react").JSX.Element;
9
9
  declare function ButtonGroupText({ className, render, ...props }: useRender.ComponentProps<"div">): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
@@ -2,8 +2,8 @@ import { Button as Button$1 } from "@base-ui/react/button";
2
2
  import { VariantProps } from "class-variance-authority";
3
3
  //#region src/components/ui/button.d.ts
4
4
  declare const buttonVariants: (props?: ({
5
- variant?: "link" | "outline" | "ghost" | "default" | "destructive" | "secondary" | null | undefined;
6
- size?: "default" | "sm" | "lg" | "icon" | "xs" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
5
+ variant?: "ghost" | "outline" | "secondary" | "default" | "link" | "destructive" | null | undefined;
6
+ size?: "default" | "sm" | "icon" | "lg" | "xs" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
8
  declare function Button({ className, variant, size, ...props }: Button$1.Props & VariantProps<typeof buttonVariants>): import("react").JSX.Element;
9
9
  //#endregion
@@ -7,7 +7,7 @@ declare function FieldLegend({ className, variant, ...props }: React.ComponentPr
7
7
  }): import("react").JSX.Element;
8
8
  declare function FieldGroup({ className, ...props }: React.ComponentProps<"div">): import("react").JSX.Element;
9
9
  declare const fieldVariants: (props?: ({
10
- orientation?: "horizontal" | "vertical" | "responsive" | null | undefined;
10
+ orientation?: "vertical" | "horizontal" | "responsive" | null | undefined;
11
11
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
12
12
  declare function Field({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>): import("react").JSX.Element;
13
13
  declare function FieldContent({ className, ...props }: React.ComponentProps<"div">): import("react").JSX.Element;