@kumix/ui 0.4.1 → 0.4.2

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 (224) hide show
  1. package/README.md +37 -30
  2. package/dist/{cascader-types-DVT-znZ-.d.ts → cascader-types-zhnUQ4sP.d.ts} +11 -3
  3. package/dist/cascader-types-zhnUQ4sP.d.ts.map +1 -0
  4. package/dist/components/agents/agent-code.js +1 -1
  5. package/dist/components/charts/candlestick-chart/context.d.ts.map +1 -1
  6. package/dist/components/charts/donut-chart/context.d.ts.map +1 -1
  7. package/dist/components/charts/liquidity-heatmap.d.ts.map +1 -1
  8. package/dist/components/charts/order-book.d.ts.map +1 -1
  9. package/dist/components/charts/treemap.d.ts.map +1 -1
  10. package/dist/components/charts/volume-profile.d.ts.map +1 -1
  11. package/dist/components/motion/action-swap.d.ts +1 -1
  12. package/dist/components/motion/action-swap.d.ts.map +1 -1
  13. package/dist/components/motion/action-swap.js +43 -20
  14. package/dist/components/motion/action-swap.js.map +1 -1
  15. package/dist/components/motion/animated-badge.d.ts +1 -1
  16. package/dist/components/motion/animated-badge.d.ts.map +1 -1
  17. package/dist/components/motion/animated-badge.js +60 -101
  18. package/dist/components/motion/animated-badge.js.map +1 -1
  19. package/dist/components/motion/animated-sidebar.js +1 -1
  20. package/dist/components/motion/animated-toast-stack.js +1 -1
  21. package/dist/components/motion/attachment-upload.js +1 -1
  22. package/dist/components/motion/availability-scheduler/copy-menu.js +1 -1
  23. package/dist/components/motion/availability-scheduler/day-row.js +1 -1
  24. package/dist/components/motion/availability-scheduler/index.js +1 -1
  25. package/dist/components/motion/bloom-menu.d.ts.map +1 -1
  26. package/dist/components/motion/bloom-menu.js +73 -8
  27. package/dist/components/motion/bloom-menu.js.map +1 -1
  28. package/dist/components/motion/bottom-sheet.d.ts.map +1 -1
  29. package/dist/components/motion/bottom-sheet.js +6 -10
  30. package/dist/components/motion/bottom-sheet.js.map +1 -1
  31. package/dist/components/motion/bouncy-accordion.d.ts.map +1 -1
  32. package/dist/components/motion/bouncy-accordion.js +35 -22
  33. package/dist/components/motion/bouncy-accordion.js.map +1 -1
  34. package/dist/components/motion/center-morph-modal.js +1 -1
  35. package/dist/components/motion/color-picker.d.ts.map +1 -1
  36. package/dist/components/motion/command-palette.js +1 -1
  37. package/dist/components/motion/context-menu.js +1 -1
  38. package/dist/components/motion/date-range-picker.d.ts.map +1 -1
  39. package/dist/components/motion/drawer.d.ts +1 -1
  40. package/dist/components/motion/drawer.d.ts.map +1 -1
  41. package/dist/components/motion/drawer.js +10 -10
  42. package/dist/components/motion/drawer.js.map +1 -1
  43. package/dist/components/motion/expandable-action-bar.d.ts.map +1 -1
  44. package/dist/components/motion/feedback-widget.js +4 -1
  45. package/dist/components/motion/feedback-widget.js.map +1 -1
  46. package/dist/components/motion/morphing-lightbox.d.ts.map +1 -1
  47. package/dist/components/motion/morphing-lightbox.js +1 -1
  48. package/dist/components/motion/morphing-modal.d.ts +6 -1
  49. package/dist/components/motion/morphing-modal.d.ts.map +1 -1
  50. package/dist/components/motion/morphing-modal.js +37 -5
  51. package/dist/components/motion/morphing-modal.js.map +1 -1
  52. package/dist/components/motion/morphing-search.js +1 -1
  53. package/dist/components/motion/morphing-tabs.js +1 -1
  54. package/dist/components/motion/otp-input.js +19 -11
  55. package/dist/components/motion/otp-input.js.map +1 -1
  56. package/dist/components/motion/popover-morph.d.ts +4 -3
  57. package/dist/components/motion/popover-morph.d.ts.map +1 -1
  58. package/dist/components/motion/popover-morph.js +47 -55
  59. package/dist/components/motion/popover-morph.js.map +1 -1
  60. package/dist/components/motion/popover.js +7 -1
  61. package/dist/components/motion/popover.js.map +1 -1
  62. package/dist/components/motion/prediction-market-card.js +1 -1
  63. package/dist/components/motion/prediction-market.js +1 -1
  64. package/dist/components/motion/project-folder.js +1 -1
  65. package/dist/components/motion/radio.d.ts +5 -1
  66. package/dist/components/motion/radio.d.ts.map +1 -1
  67. package/dist/components/motion/radio.js +53 -5
  68. package/dist/components/motion/radio.js.map +1 -1
  69. package/dist/components/motion/select-morph.d.ts +1 -1
  70. package/dist/components/motion/select-morph.d.ts.map +1 -1
  71. package/dist/components/motion/select-morph.js +89 -21
  72. package/dist/components/motion/select-morph.js.map +1 -1
  73. package/dist/components/motion/select.d.ts.map +1 -1
  74. package/dist/components/motion/select.js +153 -135
  75. package/dist/components/motion/select.js.map +1 -1
  76. package/dist/components/motion/shader-background.d.ts +3 -2
  77. package/dist/components/motion/shader-background.d.ts.map +1 -1
  78. package/dist/components/motion/shader-background.js +9 -3
  79. package/dist/components/motion/shader-background.js.map +1 -1
  80. package/dist/components/motion/shared-layout-bg.d.ts.map +1 -1
  81. package/dist/components/motion/shared-layout-bg.js +17 -3
  82. package/dist/components/motion/shared-layout-bg.js.map +1 -1
  83. package/dist/components/motion/swipeable-list.d.ts.map +1 -1
  84. package/dist/components/motion/swipeable-list.js +61 -4
  85. package/dist/components/motion/swipeable-list.js.map +1 -1
  86. package/dist/components/motion/table/row-handle.js +1 -1
  87. package/dist/components/motion/table/table-header.js +1 -1
  88. package/dist/components/motion/tabs.d.ts +12 -3
  89. package/dist/components/motion/tabs.d.ts.map +1 -1
  90. package/dist/components/motion/tabs.js +248 -26
  91. package/dist/components/motion/tabs.js.map +1 -1
  92. package/dist/components/motion/theme-toggle.js +1 -1
  93. package/dist/components/reui/alert.d.ts +1 -1
  94. package/dist/components/reui/autocomplete.d.ts +1 -1
  95. package/dist/components/reui/autocomplete.d.ts.map +1 -1
  96. package/dist/components/reui/autocomplete.js +1 -1
  97. package/dist/components/reui/autocomplete.js.map +1 -1
  98. package/dist/components/reui/badge.d.ts +2 -2
  99. package/dist/components/reui/cascader/cascader-async.d.ts +21 -5
  100. package/dist/components/reui/cascader/cascader-async.d.ts.map +1 -1
  101. package/dist/components/reui/cascader/cascader-async.js +61 -34
  102. package/dist/components/reui/cascader/cascader-async.js.map +1 -1
  103. package/dist/components/reui/cascader/cascader-columns.d.ts.map +1 -1
  104. package/dist/components/reui/cascader/cascader-columns.js +5 -2
  105. package/dist/components/reui/cascader/cascader-columns.js.map +1 -1
  106. package/dist/components/reui/cascader/cascader-context.d.ts +3 -1
  107. package/dist/components/reui/cascader/cascader-context.d.ts.map +1 -1
  108. package/dist/components/reui/cascader/cascader-context.js.map +1 -1
  109. package/dist/components/reui/cascader/cascader-i18n.d.ts +1 -1
  110. package/dist/components/reui/cascader/cascader-item.d.ts +1 -1
  111. package/dist/components/reui/cascader/cascader-lib.d.ts +34 -8
  112. package/dist/components/reui/cascader/cascader-lib.d.ts.map +1 -1
  113. package/dist/components/reui/cascader/cascader-lib.js +145 -29
  114. package/dist/components/reui/cascader/cascader-lib.js.map +1 -1
  115. package/dist/components/reui/cascader/cascader-nav.d.ts +1 -1
  116. package/dist/components/reui/cascader/cascader-types.d.ts +1 -1
  117. package/dist/components/reui/cascader/cascader.d.ts +13 -8
  118. package/dist/components/reui/cascader/cascader.d.ts.map +1 -1
  119. package/dist/components/reui/cascader/cascader.js +31 -16
  120. package/dist/components/reui/cascader/cascader.js.map +1 -1
  121. package/dist/components/reui/code-block/code-block.d.ts.map +1 -1
  122. package/dist/components/reui/color-picker.js +1 -1
  123. package/dist/components/reui/data-grid/data-grid-cell-selection.d.ts.map +1 -1
  124. package/dist/components/reui/data-grid/data-grid-cell-selection.js +1 -0
  125. package/dist/components/reui/data-grid/data-grid-cell-selection.js.map +1 -1
  126. package/dist/components/reui/data-grid/data-grid-column-filter.d.ts.map +1 -1
  127. package/dist/components/reui/data-grid/data-grid-column-filter.js +1 -0
  128. package/dist/components/reui/data-grid/data-grid-column-filter.js.map +1 -1
  129. package/dist/components/reui/data-grid/data-grid-column-header.d.ts +6 -8
  130. package/dist/components/reui/data-grid/data-grid-column-header.d.ts.map +1 -1
  131. package/dist/components/reui/data-grid/data-grid-column-header.js +7 -8
  132. package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -1
  133. package/dist/components/reui/data-grid/data-grid-column-visibility.d.ts.map +1 -1
  134. package/dist/components/reui/data-grid/data-grid-column-visibility.js +1 -0
  135. package/dist/components/reui/data-grid/data-grid-column-visibility.js.map +1 -1
  136. package/dist/components/reui/data-grid/data-grid-pagination.d.ts.map +1 -1
  137. package/dist/components/reui/data-grid/data-grid-pagination.js +1 -0
  138. package/dist/components/reui/data-grid/data-grid-pagination.js.map +1 -1
  139. package/dist/components/reui/data-grid/data-grid-scroll-area.d.ts.map +1 -1
  140. package/dist/components/reui/data-grid/data-grid-scroll-area.js +1 -0
  141. package/dist/components/reui/data-grid/data-grid-scroll-area.js.map +1 -1
  142. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.d.ts.map +1 -1
  143. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +3 -2
  144. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js.map +1 -1
  145. package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts.map +1 -1
  146. package/dist/components/reui/data-grid/data-grid-table-dnd.js +2 -1
  147. package/dist/components/reui/data-grid/data-grid-table-dnd.js.map +1 -1
  148. package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts.map +1 -1
  149. package/dist/components/reui/data-grid/data-grid-table-virtual.js +2 -1
  150. package/dist/components/reui/data-grid/data-grid-table-virtual.js.map +1 -1
  151. package/dist/components/reui/data-grid/data-grid-table.d.ts +6 -11
  152. package/dist/components/reui/data-grid/data-grid-table.d.ts.map +1 -1
  153. package/dist/components/reui/data-grid/data-grid-table.js +22 -22
  154. package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
  155. package/dist/components/reui/data-grid/data-grid.d.ts +16 -1
  156. package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -1
  157. package/dist/components/reui/data-grid/data-grid.js +80 -22
  158. package/dist/components/reui/data-grid/data-grid.js.map +1 -1
  159. package/dist/components/reui/date-selector.d.ts.map +1 -1
  160. package/dist/components/reui/date-selector.js +21 -15
  161. package/dist/components/reui/date-selector.js.map +1 -1
  162. package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +3 -5
  163. package/dist/components/reui/event-calendar/event-calendar-agenda-view.js.map +1 -1
  164. package/dist/components/reui/event-calendar/event-calendar-nav.d.ts.map +1 -1
  165. package/dist/components/reui/event-calendar/event-calendar-nav.js +2 -2
  166. package/dist/components/reui/event-calendar/event-calendar-nav.js.map +1 -1
  167. package/dist/components/reui/event-calendar/event-calendar.d.ts.map +1 -1
  168. package/dist/components/reui/event-calendar/event-calendar.js +34 -31
  169. package/dist/components/reui/event-calendar/event-calendar.js.map +1 -1
  170. package/dist/components/reui/file-type.d.ts +302 -6
  171. package/dist/components/reui/file-type.d.ts.map +1 -1
  172. package/dist/components/reui/file-type.js +416 -13
  173. package/dist/components/reui/file-type.js.map +1 -1
  174. package/dist/components/reui/filters/filters-builder.d.ts +1 -1
  175. package/dist/components/reui/filters/filters-lib.d.ts +1 -1
  176. package/dist/components/reui/frame.d.ts +1 -1
  177. package/dist/components/reui/gantt/gantt-nav.d.ts.map +1 -1
  178. package/dist/components/reui/gantt/gantt-nav.js +2 -2
  179. package/dist/components/reui/gantt/gantt-nav.js.map +1 -1
  180. package/dist/components/reui/gantt/gantt.d.ts.map +1 -1
  181. package/dist/components/reui/gantt/gantt.js +5 -2
  182. package/dist/components/reui/gantt/gantt.js.map +1 -1
  183. package/dist/components/reui/icon-tile.d.ts +2 -2
  184. package/dist/components/reui/number-field.d.ts +3 -3
  185. package/dist/components/reui/phone-input.js +30 -27
  186. package/dist/components/reui/phone-input.js.map +1 -1
  187. package/dist/components/reui/rating.d.ts +1 -1
  188. package/dist/components/reui/time-picker.js +1 -1
  189. package/dist/components/ui/attachment.d.ts +2 -2
  190. package/dist/components/ui/badge.d.ts +1 -1
  191. package/dist/components/ui/bubble.d.ts +1 -1
  192. package/dist/components/ui/button.d.ts +2 -2
  193. package/dist/components/ui/chart.d.ts.map +1 -1
  194. package/dist/components/ui/code-block.d.ts +29 -0
  195. package/dist/components/ui/code-block.d.ts.map +1 -0
  196. package/dist/components/ui/code-block.js +124 -0
  197. package/dist/components/ui/code-block.js.map +1 -0
  198. package/dist/components/ui/empty.d.ts +1 -1
  199. package/dist/components/ui/item.d.ts +2 -2
  200. package/dist/components/ui/marker.d.ts +1 -1
  201. package/dist/components/ui/sidebar.d.ts +1 -1
  202. package/dist/components/ui/toggle.d.ts +1 -1
  203. package/dist/components/ui/trace.d.ts +21 -0
  204. package/dist/components/ui/trace.d.ts.map +1 -0
  205. package/dist/components/ui/trace.js +77 -0
  206. package/dist/components/ui/trace.js.map +1 -0
  207. package/dist/context-BYXeJQnz.d.ts.map +1 -1
  208. package/dist/{copy-menu-BXUh52bu.js → copy-menu-DOg9Jh-U.js} +2 -2
  209. package/dist/{copy-menu-BXUh52bu.js.map → copy-menu-DOg9Jh-U.js.map} +1 -1
  210. package/dist/hooks/use-focus-trap.d.ts +22 -0
  211. package/dist/hooks/use-focus-trap.d.ts.map +1 -0
  212. package/dist/hooks/use-focus-trap.js +80 -0
  213. package/dist/hooks/use-focus-trap.js.map +1 -0
  214. package/dist/hooks/use-highlighted-code.d.ts +5 -0
  215. package/dist/hooks/use-highlighted-code.d.ts.map +1 -0
  216. package/dist/hooks/use-highlighted-code.js +128 -0
  217. package/dist/hooks/use-highlighted-code.js.map +1 -0
  218. package/dist/hooks/use-listbox.d.ts +29 -0
  219. package/dist/hooks/use-listbox.d.ts.map +1 -0
  220. package/dist/hooks/use-listbox.js +75 -0
  221. package/dist/hooks/use-listbox.js.map +1 -0
  222. package/dist/tooltip-C01qUgsW.d.ts.map +1 -1
  223. package/package.json +8 -8
  224. package/dist/cascader-types-DVT-znZ-.d.ts.map +0 -1
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { EASE_OUT } from "../../lib/ease.js";
2
+ import { EASE_OUT, SPRING_LAYOUT, SPRING_SWAP } from "../../lib/ease.js";
3
3
  import { cn } from "@kumix/utils";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
@@ -29,134 +29,90 @@ const ICONS = {
29
29
  danger: X,
30
30
  loading: LoaderCircle
31
31
  };
32
+ const ROLL_EXIT_TRANSITION = {
33
+ duration: .14,
34
+ ease: EASE_OUT
35
+ };
36
+ const ROLL_BLUR = "blur(3px)";
32
37
  const ICON_ROLL_VARIANTS = {
33
38
  initial: {
34
- opacity: .72,
35
- y: "80%",
36
- scale: .92,
37
- rotate: -8,
38
- filter: "blur(6px)"
39
+ opacity: 0,
40
+ y: 12,
41
+ filter: ROLL_BLUR
39
42
  },
40
43
  animate: {
41
44
  opacity: 1,
42
- y: "0%",
43
- scale: 1,
44
- rotate: 0,
45
+ y: 0,
45
46
  filter: "blur(0px)",
46
- transition: {
47
- y: {
48
- type: "spring",
49
- stiffness: 210,
50
- damping: 24,
51
- mass: .85
52
- },
53
- scale: {
54
- type: "spring",
55
- stiffness: 250,
56
- damping: 24,
57
- mass: .75
58
- },
59
- rotate: {
60
- duration: .28,
61
- ease: EASE_OUT
62
- },
63
- opacity: {
64
- duration: .28,
65
- ease: EASE_OUT
66
- },
67
- filter: {
68
- duration: .42,
69
- ease: EASE_OUT
70
- }
71
- }
47
+ transition: SPRING_SWAP
72
48
  },
73
49
  exit: {
74
- opacity: .5,
75
- y: "-80%",
76
- scale: .96,
77
- rotate: 8,
78
- filter: "blur(6px)",
79
- transition: {
80
- duration: .22,
81
- ease: EASE_OUT
82
- }
50
+ opacity: 0,
51
+ y: -12,
52
+ filter: ROLL_BLUR,
53
+ transition: ROLL_EXIT_TRANSITION
83
54
  }
84
55
  };
85
56
  const TEXT_ROLL_VARIANTS = {
86
57
  initial: {
87
- opacity: .76,
88
- y: "85%",
89
- filter: "blur(6px)"
58
+ opacity: 0,
59
+ y: "90%",
60
+ filter: ROLL_BLUR
90
61
  },
91
62
  animate: {
92
63
  opacity: 1,
93
64
  y: "0%",
94
65
  filter: "blur(0px)",
95
- transition: {
96
- y: {
97
- type: "spring",
98
- stiffness: 210,
99
- damping: 24,
100
- mass: .85
101
- },
102
- opacity: {
103
- duration: .3,
104
- ease: EASE_OUT
105
- },
106
- filter: {
107
- duration: .42,
108
- ease: EASE_OUT
109
- }
110
- }
66
+ transition: SPRING_SWAP
111
67
  },
112
68
  exit: {
113
- opacity: .5,
114
- y: "-85%",
115
- filter: "blur(6px)",
116
- transition: {
117
- duration: .2,
118
- ease: EASE_OUT
119
- }
69
+ opacity: 0,
70
+ y: "-90%",
71
+ filter: ROLL_BLUR,
72
+ transition: ROLL_EXIT_TRANSITION
120
73
  }
121
74
  };
122
- function AnimatedBadge({ status = "neutral", size = "md", children, icon, showIcon = true, pulse = status === "loading", contentKey, className, ...rest }) {
75
+ const REST = {
76
+ opacity: 1,
77
+ y: 0,
78
+ filter: "blur(0px)"
79
+ };
80
+ const REST_EXIT = {
81
+ opacity: 0,
82
+ transition: { duration: 0 }
83
+ };
84
+ function AnimatedBadge({ status = "neutral", size = "md", children, icon, showIcon = true, pulse = status === "loading", contentKey, className, style, ...rest }) {
123
85
  const reduce = useReducedMotion();
86
+ const slotLayout = reduce ? false : "position";
124
87
  const Icon = ICONS[status];
88
+ const hasLabel = children != null && typeof children !== "boolean" && children !== "";
125
89
  const resolvedContentKey = contentKey ?? (typeof children === "string" || typeof children === "number" ? children : status);
126
90
  return /* @__PURE__ */ jsxs(motion.span, {
127
- layout: true,
128
- transition: {
129
- type: "spring",
130
- stiffness: 420,
131
- damping: 30,
132
- mass: .7
133
- },
91
+ layout: !reduce,
92
+ transition: SPRING_LAYOUT,
93
+ style,
134
94
  className: cn("relative inline-flex shrink-0 items-center overflow-hidden whitespace-nowrap rounded-full border font-medium tabular-nums", "transition-colors duration-300", STATUS_CLASS[status], SIZE_CLASS[size], className),
135
95
  ...rest,
136
96
  children: [
137
97
  pulse && !reduce ? /* @__PURE__ */ jsx(motion.span, {
138
98
  "aria-hidden": true,
139
- className: "absolute inset-0 rounded-full bg-current opacity-10",
140
- animate: {
141
- scale: [
142
- .94,
143
- 1.08,
144
- .94
145
- ],
146
- opacity: [
147
- .08,
148
- .16,
149
- .08
150
- ]
151
- },
99
+ className: "absolute inset-0 rounded-full bg-current",
100
+ initial: { opacity: .06 },
101
+ animate: { opacity: [
102
+ .06,
103
+ .18,
104
+ .06
105
+ ] },
152
106
  transition: {
153
107
  duration: 1.6,
154
108
  repeat: Infinity,
155
109
  ease: "easeInOut"
156
110
  }
157
111
  }) : null,
158
- showIcon ? /* @__PURE__ */ jsx("span", {
159
- className: "relative z-10 inline-flex items-center justify-center overflow-hidden",
112
+ showIcon ? /* @__PURE__ */ jsx(motion.span, {
113
+ layout: slotLayout,
114
+ transition: SPRING_LAYOUT,
115
+ className: "relative z-10 inline-grid shrink-0 place-items-center overflow-hidden",
160
116
  children: /* @__PURE__ */ jsx(AnimatePresence, {
161
117
  mode: "popLayout",
162
118
  initial: false,
@@ -165,9 +121,9 @@ function AnimatedBadge({ status = "neutral", size = "md", children, icon, showIc
165
121
  "data-badge-icon": true,
166
122
  variants: ICON_ROLL_VARIANTS,
167
123
  initial: reduce ? false : "initial",
168
- animate: reduce ? { opacity: 1 } : "animate",
169
- exit: reduce ? void 0 : "exit",
170
- className: "inline-flex will-change-transform",
124
+ animate: reduce ? REST : "animate",
125
+ exit: reduce ? REST_EXIT : "exit",
126
+ className: "col-start-1 row-start-1 inline-flex items-center justify-center",
171
127
  children: status === "loading" && !reduce && !icon ? /* @__PURE__ */ jsx(motion.span, {
172
128
  animate: { rotate: 360 },
173
129
  transition: {
@@ -181,8 +137,11 @@ function AnimatedBadge({ status = "neutral", size = "md", children, icon, showIc
181
137
  }, status)
182
138
  })
183
139
  }) : null,
184
- children != null ? /* @__PURE__ */ jsx("span", {
185
- className: "relative z-10 inline-flex overflow-hidden",
140
+ hasLabel ? /* @__PURE__ */ jsx(motion.span, {
141
+ layout: slotLayout,
142
+ transition: SPRING_LAYOUT,
143
+ className: "relative z-10 inline-flex",
144
+ style: { clipPath: "inset(0 -999px)" },
186
145
  children: /* @__PURE__ */ jsx(AnimatePresence, {
187
146
  mode: "popLayout",
188
147
  initial: false,
@@ -190,9 +149,9 @@ function AnimatedBadge({ status = "neutral", size = "md", children, icon, showIc
190
149
  "data-badge-label": true,
191
150
  variants: TEXT_ROLL_VARIANTS,
192
151
  initial: reduce ? false : "initial",
193
- animate: reduce ? { opacity: 1 } : "animate",
194
- exit: reduce ? void 0 : "exit",
195
- className: "inline-block will-change-transform",
152
+ animate: reduce ? REST : "animate",
153
+ exit: reduce ? REST_EXIT : "exit",
154
+ className: "inline-block",
196
155
  children
197
156
  }, resolvedContentKey)
198
157
  })
@@ -1 +1 @@
1
- {"version":3,"file":"animated-badge.js","names":[],"sources":["../../../src/components/motion/animated-badge.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { AlertTriangle, Check, Circle, Info, LoaderCircle, type LucideIcon, X } from \"lucide-react\";\nimport {\n AnimatePresence,\n type HTMLMotionProps,\n motion,\n useReducedMotion,\n type Variants,\n} from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\nexport type AnimatedBadgeStatus = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\" | \"loading\";\n\nexport type AnimatedBadgeSize = \"sm\" | \"md\";\n\nexport interface AnimatedBadgeProps extends Omit<HTMLMotionProps<\"span\">, \"children\"> {\n status?: AnimatedBadgeStatus;\n size?: AnimatedBadgeSize;\n children?: ReactNode;\n icon?: ReactNode;\n showIcon?: boolean;\n pulse?: boolean;\n contentKey?: string | number;\n}\n\nconst STATUS_CLASS: Record<AnimatedBadgeStatus, string> = {\n neutral: \"border-border bg-card text-muted-foreground\",\n info: \"border-primary/30 bg-muted text-primary\",\n success: \"border-emerald-500/30 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400\",\n warning: \"border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400\",\n danger: \"border-destructive/30 bg-destructive/10 text-destructive\",\n loading: \"border-primary/30 bg-muted text-primary\",\n};\n\nconst SIZE_CLASS: Record<AnimatedBadgeSize, string> = {\n sm: \"h-6 gap-1.5 px-2 text-[11px]\",\n md: \"h-8 gap-2 px-3 text-xs\",\n};\n\nconst ICON_CLASS: Record<AnimatedBadgeSize, string> = {\n sm: \"h-3 w-3\",\n md: \"h-3.5 w-3.5\",\n};\n\nconst ICONS: Record<AnimatedBadgeStatus, LucideIcon> = {\n neutral: Circle,\n info: Info,\n success: Check,\n warning: AlertTriangle,\n danger: X,\n loading: LoaderCircle,\n};\n\nconst ICON_ROLL_VARIANTS: Variants = {\n initial: {\n opacity: 0.72,\n y: \"80%\",\n scale: 0.92,\n rotate: -8,\n filter: \"blur(6px)\",\n },\n animate: {\n opacity: 1,\n y: \"0%\",\n scale: 1,\n rotate: 0,\n filter: \"blur(0px)\",\n transition: {\n y: { type: \"spring\", stiffness: 210, damping: 24, mass: 0.85 },\n scale: { type: \"spring\", stiffness: 250, damping: 24, mass: 0.75 },\n rotate: { duration: 0.28, ease: EASE_OUT },\n opacity: { duration: 0.28, ease: EASE_OUT },\n filter: { duration: 0.42, ease: EASE_OUT },\n },\n },\n exit: {\n opacity: 0.5,\n y: \"-80%\",\n scale: 0.96,\n rotate: 8,\n filter: \"blur(6px)\",\n transition: { duration: 0.22, ease: EASE_OUT },\n },\n};\n\nconst TEXT_ROLL_VARIANTS: Variants = {\n initial: { opacity: 0.76, y: \"85%\", filter: \"blur(6px)\" },\n animate: {\n opacity: 1,\n y: \"0%\",\n filter: \"blur(0px)\",\n transition: {\n y: { type: \"spring\", stiffness: 210, damping: 24, mass: 0.85 },\n opacity: { duration: 0.3, ease: EASE_OUT },\n filter: { duration: 0.42, ease: EASE_OUT },\n },\n },\n exit: {\n opacity: 0.5,\n y: \"-85%\",\n filter: \"blur(6px)\",\n transition: { duration: 0.2, ease: EASE_OUT },\n },\n};\n\nexport function AnimatedBadge({\n status = \"neutral\",\n size = \"md\",\n children,\n icon,\n showIcon = true,\n pulse = status === \"loading\",\n contentKey,\n className,\n ...rest\n}: AnimatedBadgeProps) {\n const reduce = useReducedMotion();\n const Icon = ICONS[status];\n const resolvedContentKey =\n contentKey ??\n (typeof children === \"string\" || typeof children === \"number\" ? children : status);\n\n return (\n <motion.span\n layout\n transition={{ type: \"spring\", stiffness: 420, damping: 30, mass: 0.7 }}\n className={cn(\n \"relative inline-flex shrink-0 items-center overflow-hidden whitespace-nowrap rounded-full border font-medium tabular-nums\",\n \"transition-colors duration-300\",\n STATUS_CLASS[status],\n SIZE_CLASS[size],\n className,\n )}\n {...rest}\n >\n {pulse && !reduce ? (\n <motion.span\n aria-hidden\n className=\"absolute inset-0 rounded-full bg-current opacity-10\"\n animate={{ scale: [0.94, 1.08, 0.94], opacity: [0.08, 0.16, 0.08] }}\n transition={{ duration: 1.6, repeat: Infinity, ease: \"easeInOut\" }}\n />\n ) : null}\n {showIcon ? (\n <span className=\"relative z-10 inline-flex items-center justify-center overflow-hidden\">\n <AnimatePresence mode=\"popLayout\" initial={false}>\n <motion.span\n key={status}\n aria-hidden\n data-badge-icon\n variants={ICON_ROLL_VARIANTS}\n initial={reduce ? false : \"initial\"}\n animate={reduce ? { opacity: 1 } : \"animate\"}\n exit={reduce ? undefined : \"exit\"}\n className=\"inline-flex will-change-transform\"\n >\n {status === \"loading\" && !reduce && !icon ? (\n <motion.span\n animate={{ rotate: 360 }}\n transition={{ duration: 1, repeat: Infinity, ease: \"linear\" }}\n className=\"inline-flex\"\n >\n <Icon className={ICON_CLASS[size]} />\n </motion.span>\n ) : (\n (icon ?? <Icon className={ICON_CLASS[size]} />)\n )}\n </motion.span>\n </AnimatePresence>\n </span>\n ) : null}\n {children != null ? (\n <span className=\"relative z-10 inline-flex overflow-hidden\">\n <AnimatePresence mode=\"popLayout\" initial={false}>\n <motion.span\n key={resolvedContentKey}\n data-badge-label\n variants={TEXT_ROLL_VARIANTS}\n initial={reduce ? false : \"initial\"}\n animate={reduce ? { opacity: 1 } : \"animate\"}\n exit={reduce ? undefined : \"exit\"}\n className=\"inline-block will-change-transform\"\n >\n {children}\n </motion.span>\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,EAAM,WAAW,WAAW,MAAQ,CAAA;KAEpC,GApBN,MAoBM;IACE,CAAA;GACb,CAAA,IACJ;GACH,YAAY,OACX,oBAAC,QAAD;IAAM,WAAU;IACd,UAAA,oBAAC,iBAAD;KAAiB,MAAK;KAAY,SAAS;KACzC,UAAA,oBAAC,OAAO,MAAR;MAEE,oBAAA;MACA,UAAU;MACV,SAAS,SAAS,QAAQ;MAC1B,SAAS,SAAS,EAAE,SAAS,EAAE,IAAI;MACnC,MAAM,SAAS,KAAA,IAAY;MAC3B,WAAU;MAET;KACU,GATN,kBASM;IACE,CAAA;GACb,CAAA,IACJ;EACO;;AAEjB"}
1
+ {"version":3,"file":"animated-badge.js","names":[],"sources":["../../../src/components/motion/animated-badge.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { AlertTriangle, Check, Circle, Info, LoaderCircle, type LucideIcon, X } from \"lucide-react\";\nimport {\n AnimatePresence,\n type HTMLMotionProps,\n motion,\n useReducedMotion,\n type Variants,\n} from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT, SPRING_LAYOUT, SPRING_SWAP } from \"../../lib/ease\";\n\nexport type AnimatedBadgeStatus = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\" | \"loading\";\n\nexport type AnimatedBadgeSize = \"sm\" | \"md\";\n\nexport interface AnimatedBadgeProps extends Omit<HTMLMotionProps<\"span\">, \"children\"> {\n status?: AnimatedBadgeStatus;\n size?: AnimatedBadgeSize;\n children?: ReactNode;\n icon?: ReactNode;\n showIcon?: boolean;\n pulse?: boolean;\n contentKey?: string | number;\n}\n\nconst STATUS_CLASS: Record<AnimatedBadgeStatus, string> = {\n neutral: \"border-border bg-card text-muted-foreground\",\n info: \"border-primary/30 bg-muted text-primary\",\n success: \"border-emerald-500/30 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400\",\n warning: \"border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400\",\n danger: \"border-destructive/30 bg-destructive/10 text-destructive\",\n loading: \"border-primary/30 bg-muted text-primary\",\n};\n\nconst SIZE_CLASS: Record<AnimatedBadgeSize, string> = {\n sm: \"h-6 gap-1.5 px-2 text-[11px]\",\n md: \"h-8 gap-2 px-3 text-xs\",\n};\n\nconst ICON_CLASS: Record<AnimatedBadgeSize, string> = {\n sm: \"h-3 w-3\",\n md: \"h-3.5 w-3.5\",\n};\n\nconst ICONS: Record<AnimatedBadgeStatus, LucideIcon> = {\n neutral: Circle,\n info: Info,\n success: Check,\n warning: AlertTriangle,\n danger: X,\n loading: LoaderCircle,\n};\n\n// Status swaps roll like the action swap primitives: the leaving glyphs\n// slide up and out while the next ones slide in from below. Both fade from\n// fully transparent through a light blur, so the label never reads as a\n// solid smudge sitting on top of the badge, and the exit outruns the entry.\nconst ROLL_EXIT_TRANSITION = { duration: 0.14, ease: EASE_OUT } as const;\nconst ROLL_BLUR = \"blur(3px)\";\n\nconst ICON_ROLL_VARIANTS: Variants = {\n initial: { opacity: 0, y: 12, filter: ROLL_BLUR },\n animate: {\n opacity: 1,\n y: 0,\n filter: \"blur(0px)\",\n transition: SPRING_SWAP,\n },\n exit: {\n opacity: 0,\n y: -12,\n filter: ROLL_BLUR,\n transition: ROLL_EXIT_TRANSITION,\n },\n};\n\nconst TEXT_ROLL_VARIANTS: Variants = {\n initial: { opacity: 0, y: \"90%\", filter: ROLL_BLUR },\n animate: {\n opacity: 1,\n y: \"0%\",\n filter: \"blur(0px)\",\n transition: SPRING_SWAP,\n },\n exit: {\n opacity: 0,\n y: \"-90%\",\n filter: ROLL_BLUR,\n transition: ROLL_EXIT_TRANSITION,\n },\n};\n\n// Reduced motion swaps in place: the next content lands at rest and the\n// leaving content hides on its first frame instead of overlapping it.\nconst REST = { opacity: 1, y: 0, filter: \"blur(0px)\" } as const;\nconst REST_EXIT = { opacity: 0, transition: { duration: 0 } } as const;\n\nexport function AnimatedBadge({\n status = \"neutral\",\n size = \"md\",\n children,\n icon,\n showIcon = true,\n pulse = status === \"loading\",\n contentKey,\n className,\n style,\n ...rest\n}: AnimatedBadgeProps) {\n const reduce = useReducedMotion();\n // Reduced motion skips the layout projection altogether: a zero-duration\n // layout animation still paints one transformed frame.\n const slotLayout = reduce ? false : (\"position\" as const);\n const Icon = ICONS[status];\n // `0` is a real label; booleans and \"\" from conditional callers are not and\n // must not reserve the gap and an empty slot.\n const hasLabel = children != null && typeof children !== \"boolean\" && children !== \"\";\n const resolvedContentKey =\n contentKey ??\n (typeof children === \"string\" || typeof children === \"number\" ? children : status);\n\n return (\n <motion.span\n layout={!reduce}\n transition={SPRING_LAYOUT}\n style={style}\n className={cn(\n \"relative inline-flex shrink-0 items-center overflow-hidden whitespace-nowrap rounded-full border font-medium tabular-nums\",\n \"transition-colors duration-300\",\n STATUS_CLASS[status],\n SIZE_CLASS[size],\n className,\n )}\n {...rest}\n >\n {/* The pulse breathes through opacity alone. Scaling this layer would\n shrink it inside the pill and open a ring between fill and border. */}\n {pulse && !reduce ? (\n <motion.span\n aria-hidden\n className=\"absolute inset-0 rounded-full bg-current\"\n initial={{ opacity: 0.06 }}\n animate={{ opacity: [0.06, 0.18, 0.06] }}\n transition={{ duration: 1.6, repeat: Infinity, ease: \"easeInOut\" }}\n />\n ) : null}\n {/* The badge animates its width with a scale transform. Slots opt into\n position-only layout so motion counter-scales them and the glyphs\n keep their shape while the pill stretches around them. */}\n {showIcon ? (\n <motion.span\n layout={slotLayout}\n transition={SPRING_LAYOUT}\n className=\"relative z-10 inline-grid shrink-0 place-items-center overflow-hidden\"\n >\n <AnimatePresence mode=\"popLayout\" initial={false}>\n <motion.span\n key={status}\n aria-hidden\n data-badge-icon\n variants={ICON_ROLL_VARIANTS}\n initial={reduce ? false : \"initial\"}\n animate={reduce ? REST : \"animate\"}\n exit={reduce ? REST_EXIT : \"exit\"}\n className=\"col-start-1 row-start-1 inline-flex items-center justify-center\"\n >\n {status === \"loading\" && !reduce && !icon ? (\n <motion.span\n animate={{ rotate: 360 }}\n transition={{ duration: 1, repeat: Infinity, ease: \"linear\" }}\n className=\"inline-flex\"\n >\n <Icon className={ICON_CLASS[size]} />\n </motion.span>\n ) : (\n (icon ?? <Icon className={ICON_CLASS[size]} />)\n )}\n </motion.span>\n </AnimatePresence>\n </motion.span>\n ) : null}\n {hasLabel ? (\n // Clip the roll to the line box only; a longer leaving label may run\n // past the slot and is clipped by the pill instead of cut mid-glyph.\n <motion.span\n layout={slotLayout}\n transition={SPRING_LAYOUT}\n className=\"relative z-10 inline-flex\"\n style={{ clipPath: \"inset(0 -999px)\" }}\n >\n <AnimatePresence mode=\"popLayout\" initial={false}>\n <motion.span\n key={resolvedContentKey}\n data-badge-label\n variants={TEXT_ROLL_VARIANTS}\n initial={reduce ? false : \"initial\"}\n animate={reduce ? REST : \"animate\"}\n exit={reduce ? REST_EXIT : \"exit\"}\n className=\"inline-block\"\n >\n {children}\n </motion.span>\n </AnimatePresence>\n </motion.span>\n ) : null}\n </motion.span>\n );\n}\n"],"mappings":";;;;;;;AA6BA,MAAM,eAAoD;CACxD,SAAS;CACT,MAAM;CACN,SAAS;CACT,SAAS;CACT,QAAQ;CACR,SAAS;AACX;AAEA,MAAM,aAAgD;CACpD,IAAI;CACJ,IAAI;AACN;AAEA,MAAM,aAAgD;CACpD,IAAI;CACJ,IAAI;AACN;AAEA,MAAM,QAAiD;CACrD,SAAS;CACT,MAAM;CACN,SAAS;CACT,SAAS;CACT,QAAQ;CACR,SAAS;AACX;AAMA,MAAM,uBAAuB;CAAE,UAAU;CAAM,MAAM;AAAS;AAC9D,MAAM,YAAY;AAElB,MAAM,qBAA+B;CACnC,SAAS;EAAE,SAAS;EAAG,GAAG;EAAI,QAAQ;CAAU;CAChD,SAAS;EACP,SAAS;EACT,GAAG;EACH,QAAQ;EACR,YAAY;CACd;CACA,MAAM;EACJ,SAAS;EACT,GAAG;EACH,QAAQ;EACR,YAAY;CACd;AACF;AAEA,MAAM,qBAA+B;CACnC,SAAS;EAAE,SAAS;EAAG,GAAG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AAA,WAAW,aAAa,CAAC,UAAU,CAAC,OACnC,oBAAC,OAAO,MAAR;OACE,SAAS,EAAE,QAAQ,IAAI;OACvB,YAAY;QAAE,UAAU;QAAG,QAAQ;QAAU,MAAM;OAAS;OAC5D,WAAU;OAEV,UAAA,oBAAC,MAAD,EAAM,WAAW,WAAW,MAAQ,CAAA;MACzB,CAAA,IAEZ,QAAQ,oBAAC,MAAD,EAAM,WAAW,WAAW,MAAQ,CAAA;KAEpC,GApBN,MAoBM;IACE,CAAA;GACN,CAAA,IACX;GACH,WAGC,oBAAC,OAAO,MAAR;IACE,QAAQ;IACR,YAAY;IACZ,WAAU;IACV,OAAO,EAAE,UAAU,kBAAkB;IAErC,UAAA,oBAAC,iBAAD;KAAiB,MAAK;KAAY,SAAS;KACzC,UAAA,oBAAC,OAAO,MAAR;MAEE,oBAAA;MACA,UAAU;MACV,SAAS,SAAS,QAAQ;MAC1B,SAAS,SAAS,OAAO;MACzB,MAAM,SAAS,YAAY;MAC3B,WAAU;MAET;KACU,GATN,kBASM;IACE,CAAA;GACN,CAAA,IACX;EACO;;AAEjB"}
@@ -5,8 +5,8 @@ import { createContext, createElement, forwardRef, useCallback, useContext, useE
5
5
  import { cn } from "@kumix/utils";
6
6
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
7
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
8
- import { ChevronRight } from "lucide-react";
9
8
  import { createPortal } from "react-dom";
9
+ import { ChevronRight } from "lucide-react";
10
10
  //#region src/components/motion/animated-sidebar.tsx
11
11
  const MOBILE_QUERY = "(max-width: 767px)";
12
12
  const SIDEBAR_KEYBOARD_SHORTCUT = "b";
@@ -4,8 +4,8 @@ import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
4
4
  import { cn } from "@kumix/utils";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
7
- import { AlertCircle, Bell, Check, Info, LoaderCircle, X } from "lucide-react";
8
7
  import { createPortal } from "react-dom";
8
+ import { AlertCircle, Bell, Check, Info, LoaderCircle, X } from "lucide-react";
9
9
  //#region src/components/motion/animated-toast-stack.tsx
10
10
  const STACK_SPRING = {
11
11
  type: "spring",
@@ -6,8 +6,8 @@ import { useCallback, useEffect, useId, useRef, useState } from "react";
6
6
  import { cn } from "@kumix/utils";
7
7
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
8
  import { AnimatePresence, LayoutGroup, motion, useReducedMotion } from "motion/react";
9
- import { AlertCircle, Check, ExternalLink, FileImage, Link, LoaderCircle, Mic, Paperclip, Pause, Play, RotateCcw, Upload, X } from "lucide-react";
10
9
  import { createPortal } from "react-dom";
10
+ import { AlertCircle, Check, ExternalLink, FileImage, Link, LoaderCircle, Mic, Paperclip, Pause, Play, RotateCcw, Upload, X } from "lucide-react";
11
11
  //#region src/components/motion/attachment-upload.tsx
12
12
  const ITEM_TRANSITION = {
13
13
  duration: .2,
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export { t as CopyMenu } from "../../../copy-menu-BXUh52bu.js";
2
+ export { t as CopyMenu } from "../../../copy-menu-DOg9Jh-U.js";
@@ -3,7 +3,7 @@ import { SPRING_LAYOUT } from "../../../lib/ease.js";
3
3
  import { t as Tooltip } from "../../../tooltip-Bam5KeYe.js";
4
4
  import { Switch } from "../switch.js";
5
5
  import { IconButton } from "./icon-button.js";
6
- import { c as startOptions, i as clampRange, l as toMinutes, o as endOptions, s as panelKey, t as CopyMenu, u as toValue } from "../../../copy-menu-BXUh52bu.js";
6
+ import { c as startOptions, i as clampRange, l as toMinutes, o as endOptions, s as panelKey, t as CopyMenu, u as toValue } from "../../../copy-menu-DOg9Jh-U.js";
7
7
  import { TimeSelect } from "./time-select.js";
8
8
  import { useRef, useState } from "react";
9
9
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { a as defaultWeek, n as WEEKDAYS, r as buildOptions, s as panelKey } from "../../../copy-menu-BXUh52bu.js";
2
+ import { a as defaultWeek, n as WEEKDAYS, r as buildOptions, s as panelKey } from "../../../copy-menu-DOg9Jh-U.js";
3
3
  import { DayRow } from "./day-row.js";
4
4
  import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
5
5
  import { cn } from "@kumix/utils";
@@ -1 +1 @@
1
- {"version":3,"file":"bloom-menu.d.ts","names":[],"sources":["../../../src/components/motion/bloom-menu.tsx"],"mappings":";;KASK;EAAa;EAAe,MAAM;IAAgB;;;iBAmBtC;EACf,QAAQ;EACR,YAAY;EACZ;;wBAGc,YAAY,OAAe,UAAU,aAAa,iCAAc,IAAA"}
1
+ {"version":3,"file":"bloom-menu.d.ts","names":[],"sources":["../../../src/components/motion/bloom-menu.tsx"],"mappings":";;KAoBK;EAAa;EAAe,MAAM;IAAgB;;;iBAmBtC;EACf,QAAQ;EACR,YAAY;EACZ;;wBAGc,YAAY,OAAe,UAAU,aAAa,iCAAc,IAAA"}
@@ -1,6 +1,8 @@
1
1
  "use client";
2
+ import { useOnOpen } from "../../hooks/use-on-open.js";
3
+ import { useRowCursor } from "../../hooks/use-row-cursor.js";
2
4
  import { EASE_OUT } from "../../lib/ease.js";
3
- import { useEffect, useId, useRef, useState } from "react";
5
+ import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
4
6
  import { cn } from "@kumix/utils";
5
7
  import { jsx, jsxs } from "react/jsx-runtime";
6
8
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
@@ -42,11 +44,51 @@ function BloomMenu({ items = ITEMS, onSelect, className }) {
42
44
  const [open, setOpen] = useState(false);
43
45
  const reduce = useReducedMotion();
44
46
  const layoutId = useId();
47
+ const menuId = useId();
45
48
  const ref = useRef(null);
49
+ const triggerRef = useRef(null);
50
+ const itemRefs = useRef(/* @__PURE__ */ new Map());
51
+ const restoreFocus = useRef(false);
52
+ const rows = useMemo(() => items.map((item) => ({ id: item.label })), [items]);
53
+ const { activeIndex, moveTo } = useRowCursor(rows, "");
54
+ useOnOpen(open, () => moveTo(null));
55
+ const activeId = rows[activeIndex]?.id;
56
+ const close = useCallback((returnFocus) => {
57
+ if (returnFocus && ref.current?.contains(document.activeElement)) restoreFocus.current = true;
58
+ setOpen(false);
59
+ }, []);
60
+ useEffect(() => {
61
+ if (open) {
62
+ if (activeId !== void 0) itemRefs.current.get(activeId)?.focus({ preventScroll: true });
63
+ return;
64
+ }
65
+ if (!restoreFocus.current) return;
66
+ restoreFocus.current = false;
67
+ triggerRef.current?.focus();
68
+ }, [open, activeId]);
69
+ const COLS = 3;
70
+ const onGridKeyDown = (event) => {
71
+ const last = rows.length - 1;
72
+ const step = {
73
+ ArrowRight: 1,
74
+ ArrowLeft: -1,
75
+ ArrowDown: COLS,
76
+ ArrowUp: -3
77
+ };
78
+ let next = null;
79
+ if (event.key in step) {
80
+ const target = activeIndex + step[event.key];
81
+ next = target < 0 || target > last ? activeIndex : target;
82
+ } else if (event.key === "Home") next = 0;
83
+ else if (event.key === "End") next = last;
84
+ if (next === null) return;
85
+ event.preventDefault();
86
+ moveTo(rows[next].id);
87
+ };
46
88
  useEffect(() => {
47
89
  if (!open) return;
48
90
  const onKey = (e) => {
49
- if (e.key === "Escape") setOpen(false);
91
+ if (e.key === "Escape") close(true);
50
92
  };
51
93
  const onPointer = (e) => {
52
94
  if (ref.current && !ref.current.contains(e.target)) setOpen(false);
@@ -57,7 +99,7 @@ function BloomMenu({ items = ITEMS, onSelect, className }) {
57
99
  window.removeEventListener("keydown", onKey);
58
100
  window.removeEventListener("pointerdown", onPointer);
59
101
  };
60
- }, [open]);
102
+ }, [open, close]);
61
103
  const morph = reduce ? { duration: .15 } : SPRING_FOLDER;
62
104
  return /* @__PURE__ */ jsxs("div", {
63
105
  ref,
@@ -73,6 +115,10 @@ function BloomMenu({ items = ITEMS, onSelect, className }) {
73
115
  children: open ? /* @__PURE__ */ jsx(motion.div, {
74
116
  layoutId,
75
117
  transition: morph,
118
+ onBlur: (event) => {
119
+ const next = event.relatedTarget;
120
+ if (next instanceof Node && !ref.current?.contains(next)) close(false);
121
+ },
76
122
  style: { borderRadius: 16 },
77
123
  className: "w-[min(86vw,420px)] overflow-hidden border border-border bg-card",
78
124
  children: /* @__PURE__ */ jsxs(motion.div, {
@@ -86,13 +132,14 @@ function BloomMenu({ items = ITEMS, onSelect, className }) {
86
132
  children: [/* @__PURE__ */ jsxs("div", {
87
133
  className: "flex items-center justify-between border-border border-b px-4 py-3",
88
134
  children: [/* @__PURE__ */ jsx("span", {
135
+ id: `${menuId}-label`,
89
136
  className: "font-medium text-muted-foreground text-sm",
90
137
  children: "Create"
91
138
  }), /* @__PURE__ */ jsx("button", {
92
139
  type: "button",
93
- onClick: () => setOpen(false),
140
+ onClick: () => close(true),
94
141
  "aria-label": "Close menu",
95
- className: "text-muted-foreground transition-colors hover:text-foreground",
142
+ className: "rounded-sm text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",
96
143
  children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
97
144
  })]
98
145
  }), /* @__PURE__ */ jsx(motion.div, {
@@ -103,6 +150,10 @@ function BloomMenu({ items = ITEMS, onSelect, className }) {
103
150
  duration: .45,
104
151
  ease: EASE_OUT
105
152
  },
153
+ id: menuId,
154
+ role: "menu",
155
+ "aria-labelledby": `${menuId}-label`,
156
+ onKeyDown: onGridKeyDown,
106
157
  className: "grid grid-cols-3",
107
158
  children: items.map((item, i) => {
108
159
  const cols = 3;
@@ -111,12 +162,19 @@ function BloomMenu({ items = ITEMS, onSelect, className }) {
111
162
  const row = Math.floor(i / cols);
112
163
  const dist = Math.hypot(col - 1, row - (rows - 1) / 2);
113
164
  return /* @__PURE__ */ jsx("button", {
165
+ ref: (node) => {
166
+ if (node) itemRefs.current.set(item.label, node);
167
+ else itemRefs.current.delete(item.label);
168
+ },
114
169
  type: "button",
170
+ role: "menuitem",
171
+ tabIndex: item.label === activeId ? 0 : -1,
172
+ onFocus: () => moveTo(item.label),
115
173
  onClick: () => {
116
174
  onSelect?.(item.label);
117
- setOpen(false);
175
+ close(true);
118
176
  },
119
- className: cn("flex items-center justify-center px-3 py-6 text-muted-foreground transition-colors hover:text-foreground", i % 3 !== 2 && "border-border border-r", i < 3 && "border-border border-b"),
177
+ className: cn("flex items-center justify-center px-3 py-6 text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:bg-muted/60 focus-visible:text-foreground", i % 3 !== 2 && "border-border border-r", i < 3 && "border-border border-b"),
120
178
  children: /* @__PURE__ */ jsxs(motion.span, {
121
179
  initial: reduce ? { opacity: 0 } : {
122
180
  opacity: 0,
@@ -145,6 +203,7 @@ function BloomMenu({ items = ITEMS, onSelect, className }) {
145
203
  })]
146
204
  })
147
205
  }, "panel") : /* @__PURE__ */ jsx(motion.button, {
206
+ ref: triggerRef,
148
207
  type: "button",
149
208
  layoutId,
150
209
  transition: morph,
@@ -152,8 +211,14 @@ function BloomMenu({ items = ITEMS, onSelect, className }) {
152
211
  onClick: () => setOpen(true),
153
212
  "aria-haspopup": "menu",
154
213
  "aria-expanded": open,
214
+ onKeyDown: (event) => {
215
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
216
+ event.preventDefault();
217
+ setOpen(true);
218
+ }
219
+ },
155
220
  whileTap: reduce ? void 0 : { scale: .97 },
156
- className: "inline-flex h-11 w-36 items-center justify-center border border-border bg-card font-medium text-foreground text-sm",
221
+ className: "inline-flex h-11 w-36 items-center justify-center border border-border bg-card font-medium text-foreground text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring",
157
222
  children: /* @__PURE__ */ jsxs(motion.span, {
158
223
  layout: true,
159
224
  className: "inline-flex items-center gap-2 whitespace-nowrap",
@@ -1 +1 @@
1
- {"version":3,"file":"bloom-menu.js","names":[],"sources":["../../../src/components/motion/bloom-menu.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ComponentType, useEffect, useId, useRef, useState } from \"react\";\nimport { Bell, FileText, FolderClosed, LayoutGrid, Link, Plus, Table, X } from \"lucide-react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\ntype MenuItem = { label: string; icon: ComponentType<{ className?: string }> };\n\nconst ITEMS: MenuItem[] = [\n { label: \"Doc\", icon: FileText },\n { label: \"Board\", icon: LayoutGrid },\n { label: \"Table\", icon: Table },\n { label: \"Folder\", icon: FolderClosed },\n { label: \"Reminder\", icon: Bell },\n { label: \"Link\", icon: Link },\n];\n\n// Folder-open feel: a touch of overshoot as the panel expands, kept subtle.\nconst SPRING_FOLDER = {\n type: \"spring\",\n stiffness: 300,\n damping: 32,\n mass: 0.9,\n} as const;\n\nexport interface BloomMenuProps {\n items?: MenuItem[];\n onSelect?: (label: string) => void;\n className?: string;\n}\n\nexport function BloomMenu({ items = ITEMS, onSelect, className }: BloomMenuProps) {\n const [open, setOpen] = useState(false);\n const reduce = useReducedMotion();\n const layoutId = useId();\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (!open) return;\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") setOpen(false);\n };\n const onPointer = (e: PointerEvent) => {\n if (ref.current && !ref.current.contains(e.target as Node)) setOpen(false);\n };\n window.addEventListener(\"keydown\", onKey);\n window.addEventListener(\"pointerdown\", onPointer);\n return () => {\n window.removeEventListener(\"keydown\", onKey);\n window.removeEventListener(\"pointerdown\", onPointer);\n };\n }, [open]);\n\n const morph = reduce ? { duration: 0.15 } : SPRING_FOLDER;\n\n return (\n <div ref={ref} className={cn(\"relative inline-flex\", className)}>\n {/* spacer fixes the anchor to the trigger size */}\n <div className=\"h-11 w-36\" aria-hidden />\n\n {/* Centering box sized to the OPEN panel and centered on the trigger.\n place-items-center only centers an item that fits its cell, so the cell\n must be as wide as the panel — otherwise the overflow left-anchors and\n the panel expands rightward. The box is a fixed size per viewport (vw\n doesn't change mid-animation), so its -translate centering never drifts\n the way a content-sized wrapper would. Both states share its center, so\n the morph grows from the middle outward in every direction. */}\n <div className=\"pointer-events-none absolute top-1/2 left-1/2 z-30 grid h-[300px] w-[min(86vw,420px)] -translate-x-1/2 -translate-y-1/2 place-items-center *:pointer-events-auto\">\n {/* popLayout pulls the exiting trigger out of grid flow at once, so the\n grid never briefly holds two rows and shoves the panel off-center */}\n <AnimatePresence initial={false} mode=\"popLayout\">\n {open ? (\n <motion.div\n key=\"panel\"\n layoutId={layoutId}\n transition={morph}\n style={{ borderRadius: 16 }}\n className=\"w-[min(86vw,420px)] overflow-hidden border border-border bg-card\"\n >\n <motion.div\n // `layout` lets framer undo the box's morph scaling so this\n // content stays crisp instead of stretching with the resize.\n layout\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n transition={{ delay: reduce ? 0 : 0.12, duration: 0.2 }}\n >\n {/* header */}\n <div className=\"flex items-center justify-between border-border border-b px-4 py-3\">\n <span className=\"font-medium text-muted-foreground text-sm\">Create</span>\n <button\n type=\"button\"\n onClick={() => setOpen(false)}\n aria-label=\"Close menu\"\n className=\"text-muted-foreground transition-colors hover:text-foreground\"\n >\n <X className=\"h-4 w-4\" />\n </button>\n </div>\n\n {/* grid */}\n <motion.div\n // Iris reveal: start as a small box at the grid center and open\n // outward to all four corners, so the menu grows from the middle\n // in every direction instead of wiping top-down.\n initial={reduce ? false : { clipPath: \"inset(45% 34% 45% 34%)\" }}\n animate={{ clipPath: \"inset(0% 0% 0% 0%)\" }}\n transition={{\n delay: reduce ? 0 : 0.08,\n duration: 0.45,\n ease: EASE_OUT,\n }}\n className=\"grid grid-cols-3\"\n >\n {items.map((item, i) => {\n // Radial stagger: delay each item by its distance from the\n // grid center so the four corners animate together and the\n // open reads as center-out, not corner-by-corner.\n const cols = 3;\n const rows = Math.ceil(items.length / cols);\n const col = i % cols;\n const row = Math.floor(i / cols);\n const dist = Math.hypot(col - (cols - 1) / 2, row - (rows - 1) / 2);\n return (\n <button\n key={item.label}\n type=\"button\"\n onClick={() => {\n onSelect?.(item.label);\n setOpen(false);\n }}\n // Static cell with hairline borders (no animated fill) so\n // the grid lines never flicker as items stagger in. Only the\n // inner content animates.\n className={cn(\n \"flex items-center justify-center px-3 py-6 text-muted-foreground transition-colors hover:text-foreground\",\n i % 3 !== 2 && \"border-border border-r\",\n i < 3 && \"border-border border-b\",\n )}\n >\n <motion.span\n initial={\n reduce\n ? { opacity: 0 }\n : { opacity: 0, scale: 0.85, filter: \"blur(6px)\" }\n }\n animate={{ opacity: 1, scale: 1, filter: \"blur(0px)\" }}\n transition={{\n delay: reduce ? 0 : 0.1 + dist * 0.07,\n type: \"spring\",\n stiffness: 440,\n damping: 34,\n }}\n className=\"flex flex-col items-center gap-2\"\n >\n <item.icon className=\"h-5 w-5\" />\n <span className=\"font-medium text-sm\">{item.label}</span>\n </motion.span>\n </button>\n );\n })}\n </motion.div>\n </motion.div>\n </motion.div>\n ) : (\n <motion.button\n key=\"trigger\"\n type=\"button\"\n layoutId={layoutId}\n transition={morph}\n style={{ borderRadius: 16 }}\n onClick={() => setOpen(true)}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n whileTap={reduce ? undefined : { scale: 0.97 }}\n className=\"inline-flex h-11 w-36 items-center justify-center border border-border bg-card font-medium text-foreground text-sm\"\n >\n {/* own `layout` counter-scales the label so it stays crisp while the\n button box morphs, instead of stretching with it */}\n <motion.span layout className=\"inline-flex items-center gap-2 whitespace-nowrap\">\n Create\n <Plus className=\"h-4 w-4\" />\n </motion.span>\n </motion.button>\n )}\n </AnimatePresence>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAWA,MAAM,QAAoB;CACxB;EAAE,OAAO;EAAO,MAAM;CAAS;CAC/B;EAAE,OAAO;EAAS,MAAM;CAAW;CACnC;EAAE,OAAO;EAAS,MAAM;CAAM;CAC9B;EAAE,OAAO;EAAU,MAAM;CAAa;CACtC;EAAE,OAAO;EAAY,MAAM;CAAK;CAChC;EAAE,OAAO;EAAQ,MAAM;C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F;;IACF,GA1FN,OA0FM,IAEZ,oBAAC,OAAO,QAAR;KAEE,MAAK;KACK;KACV,YAAY;KACZ,OAAO,EAAE,cAAc,GAAG;KAC1B,eAAe,QAAQ,IAAI;KAC3B,iBAAc;KACd,iBAAe;KACf,UAAU,SAAS,KAAA,IAAY,EAAE,OAAO,IAAK;KAC7C,WAAU;KAIV,UAAA,qBAAC,OAAO,MAAR;MAAa,QAAA;MAAO,WAAU;MAA9B,UAAA,CAAiF,UAE/E,oBAAC,MAAD,EAAM,WAAU,UAAW,CAAA,CAChB;;IACA,GAjBT,SAiBS;GAEF,CAAA;EACd,CAAA,CACF;;AAET"}
1
+ {"version":3,"file":"bloom-menu.js","names":[],"sources":["../../../src/components/motion/bloom-menu.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ComponentType,\n type KeyboardEvent,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { Bell, FileText, FolderClosed, LayoutGrid, Link, Plus, Table, X } from \"lucide-react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useOnOpen } from \"../../hooks/use-on-open\";\nimport { useRowCursor } from \"../../hooks/use-row-cursor\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\ntype MenuItem = { label: string; icon: ComponentType<{ className?: string }> };\n\nconst ITEMS: MenuItem[] = [\n { label: \"Doc\", icon: FileText },\n { label: \"Board\", icon: LayoutGrid },\n { label: \"Table\", icon: Table },\n { label: \"Folder\", icon: FolderClosed },\n { label: \"Reminder\", icon: Bell },\n { label: \"Link\", icon: Link },\n];\n\n// Folder-open feel: a touch of overshoot as the panel expands, kept subtle.\nconst SPRING_FOLDER = {\n type: \"spring\",\n stiffness: 300,\n damping: 32,\n mass: 0.9,\n} as const;\n\nexport interface BloomMenuProps {\n items?: MenuItem[];\n onSelect?: (label: string) => void;\n className?: string;\n}\n\nexport function BloomMenu({ items = ITEMS, onSelect, className }: BloomMenuProps) {\n const [open, setOpen] = useState(false);\n const reduce = useReducedMotion();\n const layoutId = useId();\n const menuId = useId();\n const ref = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const itemRefs = useRef(new Map<string, HTMLButtonElement>());\n // Set when the menu closes holding focus: the trigger is unmounted while\n // open, so focus can only go back once it has mounted again.\n const restoreFocus = useRef(false);\n\n // The roving tab stop, resolved during render. Opening starts on the first\n // item; arrow keys walk the grid from there.\n const rows = useMemo(() => items.map((item) => ({ id: item.label })), [items]);\n const { activeIndex, moveTo } = useRowCursor(rows, \"\");\n useOnOpen(open, () => moveTo(null));\n const activeId = rows[activeIndex]?.id;\n\n const close = useCallback((returnFocus: boolean) => {\n if (returnFocus && ref.current?.contains(document.activeElement)) restoreFocus.current = true;\n setOpen(false);\n }, []);\n\n useEffect(() => {\n if (open) {\n if (activeId !== undefined) itemRefs.current.get(activeId)?.focus({ preventScroll: true });\n return;\n }\n if (!restoreFocus.current) return;\n restoreFocus.current = false;\n triggerRef.current?.focus();\n }, [open, activeId]);\n\n const COLS = 3;\n const onGridKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n const last = rows.length - 1;\n const step: Record<string, number> = {\n ArrowRight: 1,\n ArrowLeft: -1,\n ArrowDown: COLS,\n ArrowUp: -COLS,\n };\n let next: number | null = null;\n if (event.key in step) {\n const target = activeIndex + step[event.key];\n next = target < 0 || target > last ? activeIndex : target;\n } else if (event.key === \"Home\") next = 0;\n else if (event.key === \"End\") next = last;\n if (next === null) return;\n event.preventDefault();\n moveTo(rows[next].id);\n };\n\n useEffect(() => {\n if (!open) return;\n const onKey = (e: globalThis.KeyboardEvent) => {\n if (e.key === \"Escape\") close(true);\n };\n const onPointer = (e: PointerEvent) => {\n if (ref.current && !ref.current.contains(e.target as Node)) setOpen(false);\n };\n window.addEventListener(\"keydown\", onKey);\n window.addEventListener(\"pointerdown\", onPointer);\n return () => {\n window.removeEventListener(\"keydown\", onKey);\n window.removeEventListener(\"pointerdown\", onPointer);\n };\n }, [open, close]);\n\n const morph = reduce ? { duration: 0.15 } : SPRING_FOLDER;\n\n return (\n <div ref={ref} className={cn(\"relative inline-flex\", className)}>\n {/* spacer fixes the anchor to the trigger size */}\n <div className=\"h-11 w-36\" aria-hidden />\n\n {/* Centering box sized to the OPEN panel and centered on the trigger.\n place-items-center only centers an item that fits its cell, so the cell\n must be as wide as the panel — otherwise the overflow left-anchors and\n the panel expands rightward. The box is a fixed size per viewport (vw\n doesn't change mid-animation), so its -translate centering never drifts\n the way a content-sized wrapper would. Both states share its center, so\n the morph grows from the middle outward in every direction. */}\n <div className=\"pointer-events-none absolute top-1/2 left-1/2 z-30 grid h-[300px] w-[min(86vw,420px)] -translate-x-1/2 -translate-y-1/2 place-items-center *:pointer-events-auto\">\n {/* popLayout pulls the exiting trigger out of grid flow at once, so the\n grid never briefly holds two rows and shoves the panel off-center */}\n <AnimatePresence initial={false} mode=\"popLayout\">\n {open ? (\n <motion.div\n key=\"panel\"\n layoutId={layoutId}\n transition={morph}\n // Focus leaving the open menu closes it, as a click outside does.\n onBlur={(event) => {\n const next = event.relatedTarget;\n if (next instanceof Node && !ref.current?.contains(next)) close(false);\n }}\n style={{ borderRadius: 16 }}\n className=\"w-[min(86vw,420px)] overflow-hidden border border-border bg-card\"\n >\n <motion.div\n // `layout` lets framer undo the box's morph scaling so this\n // content stays crisp instead of stretching with the resize.\n layout\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n transition={{ delay: reduce ? 0 : 0.12, duration: 0.2 }}\n >\n {/* header */}\n <div className=\"flex items-center justify-between border-border border-b px-4 py-3\">\n <span\n id={`${menuId}-label`}\n className=\"font-medium text-muted-foreground text-sm\"\n >\n Create\n </span>\n <button\n type=\"button\"\n onClick={() => close(true)}\n aria-label=\"Close menu\"\n className=\"rounded-sm text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <X className=\"h-4 w-4\" />\n </button>\n </div>\n\n {/* grid */}\n <motion.div\n // Iris reveal: start as a small box at the grid center and open\n // outward to all four corners, so the menu grows from the middle\n // in every direction instead of wiping top-down.\n initial={reduce ? false : { clipPath: \"inset(45% 34% 45% 34%)\" }}\n animate={{ clipPath: \"inset(0% 0% 0% 0%)\" }}\n transition={{\n delay: reduce ? 0 : 0.08,\n duration: 0.45,\n ease: EASE_OUT,\n }}\n id={menuId}\n role=\"menu\"\n aria-labelledby={`${menuId}-label`}\n onKeyDown={onGridKeyDown}\n className=\"grid grid-cols-3\"\n >\n {items.map((item, i) => {\n // Radial stagger: delay each item by its distance from the\n // grid center so the four corners animate together and the\n // open reads as center-out, not corner-by-corner.\n const cols = 3;\n const rows = Math.ceil(items.length / cols);\n const col = i % cols;\n const row = Math.floor(i / cols);\n const dist = Math.hypot(col - (cols - 1) / 2, row - (rows - 1) / 2);\n return (\n <button\n key={item.label}\n ref={(node) => {\n if (node) itemRefs.current.set(item.label, node);\n else itemRefs.current.delete(item.label);\n }}\n type=\"button\"\n role=\"menuitem\"\n tabIndex={item.label === activeId ? 0 : -1}\n onFocus={() => moveTo(item.label)}\n onClick={() => {\n onSelect?.(item.label);\n close(true);\n }}\n // Static cell with hairline borders (no animated fill) so\n // the grid lines never flicker as items stagger in. Only the\n // inner content animates.\n className={cn(\n \"flex items-center justify-center px-3 py-6 text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:bg-muted/60 focus-visible:text-foreground\",\n i % 3 !== 2 && \"border-border border-r\",\n i < 3 && \"border-border border-b\",\n )}\n >\n <motion.span\n initial={\n reduce\n ? { opacity: 0 }\n : { opacity: 0, scale: 0.85, filter: \"blur(6px)\" }\n }\n animate={{ opacity: 1, scale: 1, filter: \"blur(0px)\" }}\n transition={{\n delay: reduce ? 0 : 0.1 + dist * 0.07,\n type: \"spring\",\n stiffness: 440,\n damping: 34,\n }}\n className=\"flex flex-col items-center gap-2\"\n >\n <item.icon className=\"h-5 w-5\" />\n <span className=\"font-medium text-sm\">{item.label}</span>\n </motion.span>\n </button>\n );\n })}\n </motion.div>\n </motion.div>\n </motion.div>\n ) : (\n <motion.button\n key=\"trigger\"\n ref={triggerRef}\n type=\"button\"\n layoutId={layoutId}\n transition={morph}\n style={{ borderRadius: 16 }}\n onClick={() => setOpen(true)}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n onKeyDown={(event) => {\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n setOpen(true);\n }\n }}\n whileTap={reduce ? undefined : { scale: 0.97 }}\n className=\"inline-flex h-11 w-36 items-center justify-center border border-border bg-card font-medium text-foreground text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {/* own `layout` counter-scales the label so it stays crisp while the\n button box morphs, instead of stretching with it */}\n <motion.span layout className=\"inline-flex items-center gap-2 whitespace-nowrap\">\n Create\n <Plus className=\"h-4 w-4\" />\n </motion.span>\n </motion.button>\n )}\n </AnimatePresence>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AAsBA,MAAM,QAAoB;CACxB;EAAE,OAAO;EAAO,MAAM;CAAS;CAC/B;EAAE,OAAO;EAAS,MAAM;CAAW;CACnC;EAAE,OAAO;EAAS,MAAM;CAAM;CAC9B;EAAE,OAAO;EAAU,MAAM;CAAa;CACtC;EAAE,OAAO;EAAY,MAAM;CAAK;CAChC;EAAE,OAAO;EAAQ,MAAM;CAAK;AAC9B;AAGA,MAAM,gBAAgB;CACpB,MAAM;CACN,WAAW;CACX,SAAS;CACT,MAAM;AACR;AAQA,SAAgB,UAAU,EAAE,QAAQ,OAAO,UAAU,aAA6B;CAChF,MAAM,CAAC,MAAM,WAAW,SAAS,KAAK;CACtC,MAAM,SAAS,iBAAiB;CAChC,MAAM,WAAW,MAAM;CACvB,MAAM,SAAS,MAAM;CACrB,MAAM,MAAM,OAAuB,IAAI;CACvC,MAAM,aAAa,OAA0B,IAAI;CACjD,MAAM,WAAW,uBAAO,IAAI,IAA+B,CAAC;CAG5D,MAAM,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A+GM,IAEZ,oBAAC,OAAO,QAAR;KAEE,KAAK;KACL,MAAK;KACK;KACV,YAAY;KACZ,OAAO,EAAE,cAAc,GAAG;KAC1B,eAAe,QAAQ,IAAI;KAC3B,iBAAc;KACd,iBAAe;KACf,YAAY,UAAU;MACpB,IAAI,MAAM,QAAQ,eAAe,MAAM,QAAQ,WAAW;OACxD,MAAM,eAAe;OACrB,QAAQ,IAAI;MACd;KACF;KACA,UAAU,SAAS,KAAA,IAAY,EAAE,OAAO,IAAK;KAC7C,WAAU;KAIV,UAAA,qBAAC,OAAO,MAAR;MAAa,QAAA;MAAO,WAAU;MAA9B,UAAA,CAAiF,UAE/E,oBAAC,MAAD,EAAM,WAAU,UAAW,CAAA,CAChB;;IACA,GAxBT,SAwBS;GAEF,CAAA;EACd,CAAA,CACF;;AAET"}
@@ -1 +1 @@
1
- {"version":3,"file":"bottom-sheet.d.ts","names":[],"sources":["../../../src/components/motion/bottom-sheet.tsx"],"mappings":";;iBAsBiB;EACf;EACA,eAAe;;EAEf;EACA;EACA;EACA;EACA,WAAW;EACX;;EAEA;;wBAGc,cACd,MACA,cACA,YACA,aACA,OACA,aACA,UACA,WACA,oBACC,mCAAgB"}
1
+ {"version":3,"file":"bottom-sheet.d.ts","names":[],"sources":["../../../src/components/motion/bottom-sheet.tsx"],"mappings":";;iBAuBiB;EACf;EACA,eAAe;;EAEf;EACA;EACA;EACA;EACA,WAAW;EACX;;EAEA;;wBAGc,cACd,MACA,cACA,YACA,aACA,OACA,aACA,UACA,WACA,oBACC,mCAAgB"}
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import { useFocusTrap } from "../../hooks/use-focus-trap.js";
2
3
  import { TOUCH_GESTURE_CONTENT_CLASS } from "../../lib/touch.js";
3
4
  import { EASE_DRAWER } from "../../lib/ease.js";
4
5
  import { t as PresenceGate } from "../../presence-gate-BekdC4Bo.js";
@@ -28,6 +29,7 @@ function BottomSheet({ open, onOpenChange, snapPoints = [.5, .92], defaultSnap =
28
29
  useEffect(() => {
29
30
  if (open) setSnap(defaultSnap);
30
31
  }, [open, defaultSnap]);
32
+ useFocusTrap(open && mounted, sheetRef, { onEscape: () => onOpenChange(false) });
31
33
  useEffect(() => {
32
34
  if (!open) return;
33
35
  const body = document.body;
@@ -44,15 +46,7 @@ function BottomSheet({ open, onOpenChange, snapPoints = [.5, .92], defaultSnap =
44
46
  body.style.left = "0";
45
47
  body.style.right = "0";
46
48
  body.style.overflow = "hidden";
47
- const onKey = (event) => {
48
- if (event.key === "Escape") {
49
- event.preventDefault();
50
- onOpenChange(false);
51
- }
52
- };
53
- window.addEventListener("keydown", onKey);
54
49
  return () => {
55
- window.removeEventListener("keydown", onKey);
56
50
  body.style.position = prev.position;
57
51
  body.style.top = prev.top;
58
52
  body.style.left = prev.left;
@@ -60,7 +54,7 @@ function BottomSheet({ open, onOpenChange, snapPoints = [.5, .92], defaultSnap =
60
54
  body.style.overflow = prev.overflow;
61
55
  window.scrollTo(0, scrollY);
62
56
  };
63
- }, [open, onOpenChange]);
57
+ }, [open]);
64
58
  const onDragEnd = (_, info) => {
65
59
  const velocity = info.velocity.y;
66
60
  const offset = info.offset.y;
@@ -86,6 +80,7 @@ function BottomSheet({ open, onOpenChange, snapPoints = [.5, .92], defaultSnap =
86
80
  return createPortal(/* @__PURE__ */ jsxs(AnimatePresence, { children: [open ? /* @__PURE__ */ jsx(PresenceGate, { children: ({ gate }) => /* @__PURE__ */ jsx(motion.button, {
87
81
  type: "button",
88
82
  "aria-label": "Close bottom sheet",
83
+ tabIndex: -1,
89
84
  initial: { opacity: 0 },
90
85
  animate: { opacity: 1 },
91
86
  exit: { opacity: 0 },
@@ -132,9 +127,10 @@ function BottomSheet({ open, onOpenChange, snapPoints = [.5, .92], defaultSnap =
132
127
  ...heightStyle,
133
128
  ...gate.style
134
129
  },
135
- className: cn("pointer-events-auto fixed right-0 bottom-0 left-0 z-50 mx-auto flex max-w-2xl flex-col overflow-hidden rounded-t-3xl will-change-transform", "border border-border bg-background shadow-xl", className),
130
+ className: cn("pointer-events-auto fixed right-0 bottom-0 left-0 z-50 mx-auto flex max-w-2xl flex-col overflow-hidden rounded-t-3xl outline-none will-change-transform", "border border-border bg-background shadow-xl", className),
136
131
  role: "dialog",
137
132
  "aria-modal": "true",
133
+ tabIndex: -1,
138
134
  "aria-labelledby": title ? titleId : void 0,
139
135
  "aria-describedby": description ? descriptionId : void 0,
140
136
  "aria-label": title ? void 0 : "Bottom sheet",