@42-central/ui-react 0.17.1 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (311) hide show
  1. package/dist/{chunk-FD6P6PLQ.js → chunk-5JHDSVEZ.js} +3 -3
  2. package/dist/{chunk-FD6P6PLQ.js.map → chunk-5JHDSVEZ.js.map} +1 -1
  3. package/dist/{chunk-QMW7D5GU.js → chunk-5OQLFX47.js} +4 -3
  4. package/dist/chunk-5OQLFX47.js.map +1 -0
  5. package/dist/{chunk-VZ2TPU4B.js → chunk-6GDMSENK.js} +3 -2
  6. package/dist/chunk-6GDMSENK.js.map +1 -0
  7. package/dist/{chunk-TNNH3FVQ.js → chunk-6OLTJYSX.js} +24 -8
  8. package/dist/chunk-6OLTJYSX.js.map +1 -0
  9. package/dist/{chunk-POKDSVQT.js → chunk-AE7QTLJ5.js} +5 -4
  10. package/dist/chunk-AE7QTLJ5.js.map +1 -0
  11. package/dist/{chunk-44OV3PNH.js → chunk-B2YJKRNQ.js} +3 -3
  12. package/dist/{chunk-44OV3PNH.js.map → chunk-B2YJKRNQ.js.map} +1 -1
  13. package/dist/{chunk-YIQI2CF3.js → chunk-CTSO6V72.js} +3 -2
  14. package/dist/chunk-CTSO6V72.js.map +1 -0
  15. package/dist/{chunk-EVVMHTCL.js → chunk-EBREIC3L.js} +4 -3
  16. package/dist/chunk-EBREIC3L.js.map +1 -0
  17. package/dist/{chunk-UNSAA7YG.js → chunk-FHG54IT5.js} +3 -2
  18. package/dist/chunk-FHG54IT5.js.map +1 -0
  19. package/dist/{chunk-3GYOIQW7.js → chunk-FZIHZT5R.js} +5 -5
  20. package/dist/{chunk-3GYOIQW7.js.map → chunk-FZIHZT5R.js.map} +1 -1
  21. package/dist/{chunk-2H46IXW4.js → chunk-HAQJQFE6.js} +28 -8
  22. package/dist/chunk-HAQJQFE6.js.map +1 -0
  23. package/dist/{chunk-IHYFYMHJ.js → chunk-HT5JAHR3.js} +6 -6
  24. package/dist/{chunk-IHYFYMHJ.js.map → chunk-HT5JAHR3.js.map} +1 -1
  25. package/dist/chunk-I4SQQIP5.js +12 -0
  26. package/dist/chunk-I4SQQIP5.js.map +1 -0
  27. package/dist/{chunk-J3PELDH3.js → chunk-JITF6I7N.js} +22 -6
  28. package/dist/chunk-JITF6I7N.js.map +1 -0
  29. package/dist/{chunk-IFWCCAQV.js → chunk-KHMFNH3X.js} +3 -2
  30. package/dist/chunk-KHMFNH3X.js.map +1 -0
  31. package/dist/{chunk-SIG4DMNZ.js → chunk-MI2WZRK3.js} +4 -4
  32. package/dist/{chunk-SIG4DMNZ.js.map → chunk-MI2WZRK3.js.map} +1 -1
  33. package/dist/{chunk-YON5Y336.js → chunk-O23Y5ML4.js} +8 -8
  34. package/dist/{chunk-YON5Y336.js.map → chunk-O23Y5ML4.js.map} +1 -1
  35. package/dist/{chunk-P7A3BCAC.js → chunk-OWG4BCQR.js} +3 -3
  36. package/dist/{chunk-P7A3BCAC.js.map → chunk-OWG4BCQR.js.map} +1 -1
  37. package/dist/{chunk-FUWSTUDM.js → chunk-PH354ECN.js} +4 -4
  38. package/dist/{chunk-FUWSTUDM.js.map → chunk-PH354ECN.js.map} +1 -1
  39. package/dist/{chunk-U5GW5EBR.js → chunk-RAUOFTUH.js} +12 -20
  40. package/dist/chunk-RAUOFTUH.js.map +1 -0
  41. package/dist/{chunk-2762HZYX.js → chunk-S2HWWR2H.js} +47 -25
  42. package/dist/chunk-S2HWWR2H.js.map +1 -0
  43. package/dist/{chunk-VLUKI3HL.js → chunk-S7N4LGLZ.js} +6 -13
  44. package/dist/chunk-S7N4LGLZ.js.map +1 -0
  45. package/dist/{chunk-NSOA3GMZ.js → chunk-UHNRAI6V.js} +3 -3
  46. package/dist/{chunk-NSOA3GMZ.js.map → chunk-UHNRAI6V.js.map} +1 -1
  47. package/dist/{chunk-3NZXWCGF.js → chunk-WHKKN3ZK.js} +6 -6
  48. package/dist/{chunk-3NZXWCGF.js.map → chunk-WHKKN3ZK.js.map} +1 -1
  49. package/dist/{chunk-MOI7B3KH.js → chunk-WQN64ZHG.js} +5 -5
  50. package/dist/{chunk-MOI7B3KH.js.map → chunk-WQN64ZHG.js.map} +1 -1
  51. package/dist/chunk-WSIVRDRB.js +34 -0
  52. package/dist/chunk-WSIVRDRB.js.map +1 -0
  53. package/dist/{chunk-6SWK4XG5.js → chunk-YXE4B6X3.js} +2 -2
  54. package/dist/chunk-YXE4B6X3.js.map +1 -0
  55. package/dist/{chunk-NGAQITWP.js → chunk-Z2Z5EXVT.js} +10 -7
  56. package/dist/chunk-Z2Z5EXVT.js.map +1 -0
  57. package/dist/{chunk-IXKELBJA.js → chunk-ZDXQ64A7.js} +63 -44
  58. package/dist/chunk-ZDXQ64A7.js.map +1 -0
  59. package/dist/components/accordion/accordion-data.d.ts +3 -2
  60. package/dist/components/accordion/accordion-data.d.ts.map +1 -1
  61. package/dist/components/accordion/accordion.d.ts +2 -2
  62. package/dist/components/accordion/accordion.d.ts.map +1 -1
  63. package/dist/components/accordion/index.js +20 -8
  64. package/dist/components/accordion/index.js.map +1 -1
  65. package/dist/components/action-icon/action-icon.d.ts +3 -4
  66. package/dist/components/action-icon/action-icon.d.ts.map +1 -1
  67. package/dist/components/action-icon/index.js +2 -1
  68. package/dist/components/alert/alert.d.ts +1 -1
  69. package/dist/components/alert/alert.d.ts.map +1 -1
  70. package/dist/components/alert/index.js +16 -4
  71. package/dist/components/alert/index.js.map +1 -1
  72. package/dist/components/app-shell/app-shell.d.ts +3 -2
  73. package/dist/components/app-shell/app-shell.d.ts.map +1 -1
  74. package/dist/components/app-shell/index.js +4 -2
  75. package/dist/components/app-shell/index.js.map +1 -1
  76. package/dist/components/autocomplete/index.js +5 -4
  77. package/dist/components/autocomplete/index.js.map +1 -1
  78. package/dist/components/breadcrumb/breadcrumb.d.ts +3 -2
  79. package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -1
  80. package/dist/components/breadcrumb/index.js +11 -5
  81. package/dist/components/breadcrumb/index.js.map +1 -1
  82. package/dist/components/button/button.d.ts +4 -4
  83. package/dist/components/button/button.d.ts.map +1 -1
  84. package/dist/components/button/index.js +2 -1
  85. package/dist/components/button-multi-select/index.js +4 -3
  86. package/dist/components/button-multi-select/index.js.map +1 -1
  87. package/dist/components/button-select/index.js +4 -3
  88. package/dist/components/button-select/index.js.map +1 -1
  89. package/dist/components/calendar/index.js +3 -2
  90. package/dist/components/checkbox/index.js +2 -2
  91. package/dist/components/choice-card-group/index.js +1 -1
  92. package/dist/components/circular-progress/circular-progress.d.ts +3 -2
  93. package/dist/components/circular-progress/circular-progress.d.ts.map +1 -1
  94. package/dist/components/circular-progress/index.js +1 -0
  95. package/dist/components/circular-progress/index.js.map +1 -1
  96. package/dist/components/clipboard/clipboard.d.ts +1 -1
  97. package/dist/components/clipboard/clipboard.d.ts.map +1 -1
  98. package/dist/components/clipboard/index.js +9 -5
  99. package/dist/components/clipboard/index.js.map +1 -1
  100. package/dist/components/code-block/chrome.d.ts +4 -1
  101. package/dist/components/code-block/chrome.d.ts.map +1 -1
  102. package/dist/components/code-block/chrome.js +5 -4
  103. package/dist/components/code-block/code-block.d.ts +7 -1
  104. package/dist/components/code-block/code-block.d.ts.map +1 -1
  105. package/dist/components/code-block/index.d.ts +1 -1
  106. package/dist/components/code-block/index.js +12 -10
  107. package/dist/components/code-block/index.js.map +1 -1
  108. package/dist/components/code-block/notation.d.ts +5 -2
  109. package/dist/components/code-block/notation.d.ts.map +1 -1
  110. package/dist/components/code-block/static.d.ts +4 -1
  111. package/dist/components/code-block/static.d.ts.map +1 -1
  112. package/dist/components/code-block/static.js +5 -4
  113. package/dist/components/code-block/static.js.map +1 -1
  114. package/dist/components/collapse/collapse.d.ts +7 -3
  115. package/dist/components/collapse/collapse.d.ts.map +1 -1
  116. package/dist/components/collapse/index.js +2 -1
  117. package/dist/components/combobox/combobox.d.ts +11 -10
  118. package/dist/components/combobox/combobox.d.ts.map +1 -1
  119. package/dist/components/combobox/index.js +5 -4
  120. package/dist/components/combobox-list/index.js +6 -5
  121. package/dist/components/data-table/index.js +20 -19
  122. package/dist/components/data-table/index.js.map +1 -1
  123. package/dist/components/date-picker/index.js +12 -11
  124. package/dist/components/date-picker/index.js.map +1 -1
  125. package/dist/components/divider/divider.d.ts +3 -2
  126. package/dist/components/divider/divider.d.ts.map +1 -1
  127. package/dist/components/divider/index.js +1 -1
  128. package/dist/components/drawer/drawer.d.ts +6 -5
  129. package/dist/components/drawer/drawer.d.ts.map +1 -1
  130. package/dist/components/drawer/index.js +3 -2
  131. package/dist/components/field/field.d.ts +7 -4
  132. package/dist/components/field/field.d.ts.map +1 -1
  133. package/dist/components/field/index.js +1 -1
  134. package/dist/components/file-upload/index.js +3 -2
  135. package/dist/components/file-upload/index.js.map +1 -1
  136. package/dist/components/hover-card/index.js +1 -1
  137. package/dist/components/input/index.js +2 -2
  138. package/dist/components/input/input.d.ts +3 -2
  139. package/dist/components/input/input.d.ts.map +1 -1
  140. package/dist/components/menu/index.js +3 -2
  141. package/dist/components/menu/index.js.map +1 -1
  142. package/dist/components/menu/menu-data.d.ts +6 -1
  143. package/dist/components/menu/menu-data.d.ts.map +1 -1
  144. package/dist/components/menu/menu.d.ts +5 -5
  145. package/dist/components/menu/menu.d.ts.map +1 -1
  146. package/dist/components/modal/index.js +3 -2
  147. package/dist/components/modal/modal.d.ts +4 -3
  148. package/dist/components/modal/modal.d.ts.map +1 -1
  149. package/dist/components/multi-combobox-list/index.js +6 -5
  150. package/dist/components/multi-select/index.js +7 -6
  151. package/dist/components/multi-select/index.js.map +1 -1
  152. package/dist/components/nav-link/index.js +3 -2
  153. package/dist/components/nav-link/tanstack.js +3 -2
  154. package/dist/components/nav-link/tanstack.js.map +1 -1
  155. package/dist/components/notification/index.js +4 -3
  156. package/dist/components/notification/index.js.map +1 -1
  157. package/dist/components/notification/notification.d.ts +3 -2
  158. package/dist/components/notification/notification.d.ts.map +1 -1
  159. package/dist/components/number-input/index.js +4 -4
  160. package/dist/components/overlays/index.js +5 -4
  161. package/dist/components/overlays/index.js.map +1 -1
  162. package/dist/components/password-input/index.js +2 -2
  163. package/dist/components/pill/index.js +2 -1
  164. package/dist/components/pill/pill.d.ts +4 -2
  165. package/dist/components/pill/pill.d.ts.map +1 -1
  166. package/dist/components/pills-input/index.js +5 -4
  167. package/dist/components/pills-input/pills-input.d.ts +3 -2
  168. package/dist/components/pills-input/pills-input.d.ts.map +1 -1
  169. package/dist/components/pin-input/index.js +2 -2
  170. package/dist/components/popover/index.js +1 -1
  171. package/dist/components/popover/popover.d.ts +3 -2
  172. package/dist/components/popover/popover.d.ts.map +1 -1
  173. package/dist/components/progress/index.js +1 -0
  174. package/dist/components/progress/index.js.map +1 -1
  175. package/dist/components/progress/progress.d.ts +3 -2
  176. package/dist/components/progress/progress.d.ts.map +1 -1
  177. package/dist/components/radio-group/index.js +1 -1
  178. package/dist/components/rating/index.js +2 -1
  179. package/dist/components/rating/index.js.map +1 -1
  180. package/dist/components/rating/rating.d.ts +3 -2
  181. package/dist/components/rating/rating.d.ts.map +1 -1
  182. package/dist/components/schedule/index.d.ts +2 -2
  183. package/dist/components/schedule/index.js +50 -23
  184. package/dist/components/schedule/index.js.map +1 -1
  185. package/dist/components/schedule/schedule-agenda-list.d.ts +6 -7
  186. package/dist/components/schedule/schedule-agenda-list.d.ts.map +1 -1
  187. package/dist/components/schedule/schedule-agenda-view.d.ts +19 -16
  188. package/dist/components/schedule/schedule-agenda-view.d.ts.map +1 -1
  189. package/dist/components/schedule/schedule-dates.d.ts.map +1 -1
  190. package/dist/components/schedule/schedule-days-view.d.ts +3 -2
  191. package/dist/components/schedule/schedule-days-view.d.ts.map +1 -1
  192. package/dist/components/schedule/schedule-month-view.d.ts +3 -2
  193. package/dist/components/schedule/schedule-month-view.d.ts.map +1 -1
  194. package/dist/components/schedule/schedule-next-up.d.ts +4 -3
  195. package/dist/components/schedule/schedule-next-up.d.ts.map +1 -1
  196. package/dist/components/schedule/schedule-toolbar.d.ts +1 -1
  197. package/dist/components/schedule/schedule-toolbar.d.ts.map +1 -1
  198. package/dist/components/schedule/schedule-types.d.ts +5 -3
  199. package/dist/components/schedule/schedule-types.d.ts.map +1 -1
  200. package/dist/components/schedule/schedule-views.d.ts +2 -2
  201. package/dist/components/schedule/schedule-views.d.ts.map +1 -1
  202. package/dist/components/schedule/schedule-year-view.d.ts +3 -2
  203. package/dist/components/schedule/schedule-year-view.d.ts.map +1 -1
  204. package/dist/components/schedule/schedule.d.ts +9 -6
  205. package/dist/components/schedule/schedule.d.ts.map +1 -1
  206. package/dist/components/segment-group/index.js +2 -2
  207. package/dist/components/select/index.js +4 -4
  208. package/dist/components/slider/index.js +2 -1
  209. package/dist/components/slider/index.js.map +1 -1
  210. package/dist/components/slider/slider.d.ts +3 -2
  211. package/dist/components/slider/slider.d.ts.map +1 -1
  212. package/dist/components/switch/index.js +1 -1
  213. package/dist/components/tabs/index.js +1 -1
  214. package/dist/components/tabs/tabs-data.d.ts +3 -2
  215. package/dist/components/tabs/tabs-data.d.ts.map +1 -1
  216. package/dist/components/tags-input/index.js +6 -5
  217. package/dist/components/tags-input/index.js.map +1 -1
  218. package/dist/components/text-input/index.js +2 -2
  219. package/dist/components/textarea/index.js +2 -2
  220. package/dist/components/time-input/index.js +6 -6
  221. package/dist/components/timeline/index.js +8 -5
  222. package/dist/components/timeline/index.js.map +1 -1
  223. package/dist/components/timeline/timeline.d.ts +1 -1
  224. package/dist/components/timeline/timeline.d.ts.map +1 -1
  225. package/dist/components/tooltip/index.js +1 -1
  226. package/dist/components/tooltip/tooltip.d.ts +2 -1
  227. package/dist/components/tooltip/tooltip.d.ts.map +1 -1
  228. package/dist/components/tree-multi-select/index.js +6 -5
  229. package/dist/components/tree-multi-select/index.js.map +1 -1
  230. package/dist/components/tree-select/index.js +3 -3
  231. package/dist/lib/as-child.d.ts +104 -0
  232. package/dist/lib/as-child.d.ts.map +1 -0
  233. package/package.json +1 -1
  234. package/src/as-child.contract.test.tsx +809 -0
  235. package/src/components/accordion/accordion-data.tsx +8 -5
  236. package/src/components/accordion/accordion.test.tsx +40 -0
  237. package/src/components/accordion/accordion.tsx +23 -6
  238. package/src/components/action-icon/action-icon.tsx +9 -24
  239. package/src/components/alert/alert.test.tsx +17 -0
  240. package/src/components/alert/alert.tsx +21 -2
  241. package/src/components/app-shell/app-shell.tsx +3 -1
  242. package/src/components/breadcrumb/breadcrumb.test.tsx +30 -0
  243. package/src/components/breadcrumb/breadcrumb.tsx +21 -12
  244. package/src/components/button/button.tsx +21 -50
  245. package/src/components/circular-progress/circular-progress.tsx +4 -1
  246. package/src/components/clipboard/clipboard.test.tsx +18 -0
  247. package/src/components/clipboard/clipboard.tsx +8 -2
  248. package/src/components/code-block/chrome.tsx +60 -36
  249. package/src/components/code-block/code-block.test.tsx +27 -0
  250. package/src/components/code-block/code-block.tsx +13 -3
  251. package/src/components/code-block/notation.test.ts +8 -0
  252. package/src/components/code-block/notation.ts +6 -3
  253. package/src/components/code-block/static.tsx +8 -2
  254. package/src/components/collapse/collapse.tsx +33 -15
  255. package/src/components/combobox/combobox.test.tsx +38 -0
  256. package/src/components/combobox/combobox.tsx +24 -10
  257. package/src/components/divider/divider.tsx +3 -1
  258. package/src/components/drawer/drawer.tsx +37 -16
  259. package/src/components/field/field.tsx +7 -3
  260. package/src/components/input/input.tsx +3 -1
  261. package/src/components/menu/menu-data.tsx +8 -1
  262. package/src/components/menu/menu.test.tsx +52 -0
  263. package/src/components/menu/menu.tsx +83 -35
  264. package/src/components/modal/close-trigger.test.tsx +38 -0
  265. package/src/components/modal/modal.tsx +29 -13
  266. package/src/components/notification/notification.tsx +4 -1
  267. package/src/components/pill/pill.tsx +29 -20
  268. package/src/components/pills-input/pills-input.tsx +3 -1
  269. package/src/components/popover/popover.tsx +3 -1
  270. package/src/components/progress/progress.tsx +4 -1
  271. package/src/components/rating/rating.tsx +27 -23
  272. package/src/components/schedule/index.ts +1 -1
  273. package/src/components/schedule/schedule-agenda-list.tsx +6 -7
  274. package/src/components/schedule/schedule-agenda-view.test.tsx +105 -28
  275. package/src/components/schedule/schedule-agenda-view.tsx +41 -28
  276. package/src/components/schedule/schedule-dates.test.ts +37 -52
  277. package/src/components/schedule/schedule-dates.ts +22 -25
  278. package/src/components/schedule/schedule-days-view.tsx +3 -1
  279. package/src/components/schedule/schedule-month-view.tsx +3 -1
  280. package/src/components/schedule/schedule-next-up.tsx +6 -2
  281. package/src/components/schedule/schedule-toolbar.test.tsx +26 -0
  282. package/src/components/schedule/schedule-toolbar.tsx +13 -1
  283. package/src/components/schedule/schedule-types.ts +5 -3
  284. package/src/components/schedule/schedule-views.ts +4 -5
  285. package/src/components/schedule/schedule-year-view.tsx +3 -1
  286. package/src/components/schedule/schedule.test.tsx +66 -22
  287. package/src/components/schedule/schedule.tsx +22 -13
  288. package/src/components/slider/slider.tsx +4 -0
  289. package/src/components/tabs/tabs-data.tsx +17 -14
  290. package/src/components/timeline/timeline.tsx +102 -95
  291. package/src/components/tooltip/tooltip.tsx +2 -1
  292. package/src/lib/as-child.test.tsx +70 -0
  293. package/src/lib/as-child.ts +119 -0
  294. package/dist/chunk-2762HZYX.js.map +0 -1
  295. package/dist/chunk-2H46IXW4.js.map +0 -1
  296. package/dist/chunk-6SWK4XG5.js.map +0 -1
  297. package/dist/chunk-EVVMHTCL.js.map +0 -1
  298. package/dist/chunk-HWNPXAEN.js +0 -31
  299. package/dist/chunk-HWNPXAEN.js.map +0 -1
  300. package/dist/chunk-IFWCCAQV.js.map +0 -1
  301. package/dist/chunk-IXKELBJA.js.map +0 -1
  302. package/dist/chunk-J3PELDH3.js.map +0 -1
  303. package/dist/chunk-NGAQITWP.js.map +0 -1
  304. package/dist/chunk-POKDSVQT.js.map +0 -1
  305. package/dist/chunk-QMW7D5GU.js.map +0 -1
  306. package/dist/chunk-TNNH3FVQ.js.map +0 -1
  307. package/dist/chunk-U5GW5EBR.js.map +0 -1
  308. package/dist/chunk-UNSAA7YG.js.map +0 -1
  309. package/dist/chunk-VLUKI3HL.js.map +0 -1
  310. package/dist/chunk-VZ2TPU4B.js.map +0 -1
  311. package/dist/chunk-YIQI2CF3.js.map +0 -1
@@ -2,6 +2,7 @@ import { ark, type HTMLArkProps } from "@ark-ui/react"
2
2
  import { cva, type VariantProps } from "class-variance-authority"
3
3
  import type { CSSProperties, ReactElement, ReactNode } from "react"
4
4
  import { Children, cloneElement, isValidElement } from "react"
5
+ import { composeChildren } from "../../lib/as-child"
5
6
  import { cn } from "../../lib/cn"
6
7
  import type { Color } from "../../lib/colors"
7
8
  import {
@@ -505,6 +506,7 @@ const TimelineItem = ({
505
506
  // Read by `TimelineRoot` (see `stateAt`); kept off the `<li>`.
506
507
  active: _active,
507
508
  testId,
509
+ asChild,
508
510
  ...rest
509
511
  }: TimelineItemInternalProps) => {
510
512
  const isGradient = variant === "gradient"
@@ -527,6 +529,7 @@ const TimelineItem = ({
527
529
 
528
530
  return (
529
531
  <ark.li
532
+ asChild={asChild}
530
533
  style={
531
534
  {
532
535
  ...(size ? { "--tl-bullet-size": BULLET_SIZE[size] } : undefined),
@@ -547,105 +550,109 @@ const TimelineItem = ({
547
550
  })}
548
551
  {...rest}
549
552
  >
550
- {/* Two line segments share `data-part="line"` (so the first/last-item
551
- suppression selectors above match both) but differ in `data-edge`
552
- for layout and visibility. Both are a `--tl-line-width`-wide
553
- background bar rather than a border, so a gradient fill and the
554
- `--tl-line-mask` dash pattern can be combined.
553
+ {composeChildren(asChild, children, (own) => (
554
+ <>
555
+ {/* Two line segments share `data-part="line"` (so the first/last-item
556
+ suppression selectors above match both) but differ in `data-edge`
557
+ for layout and visibility. Both are a `--tl-line-width`-wide
558
+ background bar rather than a border, so a gradient fill and the
559
+ `--tl-line-mask` dash pattern can be combined.
555
560
 
556
- `data-edge="start"` (leading) fills the gap `axisOffset` opens
557
- *above* this item's own (shifted-down) bullet — a plain height of
558
- `--tl-axis-offset` (0, i.e. invisible, when `axisOffset` isn't
559
- set), `self-start` so it sits flush at the row's own top edge.
560
- Hidden on the first item: nothing renders above the very first
561
- bullet to connect to. It's flat in this item's own entry color:
562
- the previous item's trailing segment has already blended into
563
- exactly that color by the time it reaches this row's top edge, so
564
- the two meet with no seam. Only its dash pattern comes from the
565
- previous item (`prevItem.lineVariant`), since it continues that
566
- item's segment.
561
+ `data-edge="start"` (leading) fills the gap `axisOffset` opens
562
+ *above* this item's own (shifted-down) bullet — a plain height of
563
+ `--tl-axis-offset` (0, i.e. invisible, when `axisOffset` isn't
564
+ set), `self-start` so it sits flush at the row's own top edge.
565
+ Hidden on the first item: nothing renders above the very first
566
+ bullet to connect to. It's flat in this item's own entry color:
567
+ the previous item's trailing segment has already blended into
568
+ exactly that color by the time it reaches this row's top edge, so
569
+ the two meet with no seam. Only its dash pattern comes from the
570
+ previous item (`prevItem.lineVariant`), since it continues that
571
+ item's segment.
567
572
 
568
- `data-edge="end"` (trailing) is the connector to the next item: a
569
- grid item in the same cell as the bullet (col/row-start-2/1,
570
- default align-self:stretch fills the row's real height), whose
571
- margin-top pushes its own box down by exactly the bullet's
572
- diameter plus `--tl-axis-offset` — so it stops right at the
573
- bullet's edge instead of running behind it, and the hollow
574
- variants can stay genuinely transparent. Hidden on the last item.
573
+ `data-edge="end"` (trailing) is the connector to the next item: a
574
+ grid item in the same cell as the bullet (col/row-start-2/1,
575
+ default align-self:stretch fills the row's real height), whose
576
+ margin-top pushes its own box down by exactly the bullet's
577
+ diameter plus `--tl-axis-offset` — so it stops right at the
578
+ bullet's edge instead of running behind it, and the hollow
579
+ variants can stay genuinely transparent. Hidden on the last item.
575
580
 
576
- It blends from this item's exit color to the next item's entry
577
- color. Those are usually two *different* palettes, and a `--c-*`
578
- slot only resolves against the `data-color` of the element it's
579
- read on, so it takes two elements: the outer span carries this
580
- item's palette and declares `--tl-from`, the inner one carries the
581
- next item's and declares `--tl-to`. A custom property inherits its
582
- *computed* value — the `var(--c-solid)` in `--tl-from` is already
583
- substituted with this item's color by the time the inner span reads
584
- it — so the inner span sees both colors at once. The outer span stays
585
- the direct grid item (stretching through a nested element is
586
- unreliable); the inner one just fills it with `absolute inset-0`.
581
+ It blends from this item's exit color to the next item's entry
582
+ color. Those are usually two *different* palettes, and a `--c-*`
583
+ slot only resolves against the `data-color` of the element it's
584
+ read on, so it takes two elements: the outer span carries this
585
+ item's palette and declares `--tl-from`, the inner one carries the
586
+ next item's and declares `--tl-to`. A custom property inherits its
587
+ *computed* value — the `var(--c-solid)` in `--tl-from` is already
588
+ substituted with this item's color by the time the inner span reads
589
+ it — so the inner span sees both colors at once. The outer span stays
590
+ the direct grid item (stretching through a nested element is
591
+ unreliable); the inner one just fills it with `absolute inset-0`.
587
592
 
588
- `--tl-bullet-size`/`--tl-axis-offset` are declared on the `<li>`
589
- (see `timelineVariants` / this component's own `style`), not
590
- scoped to the bullet, so these siblings can read the same values
591
- as the axis div below — siblings can only stay in sync through a
592
- shared var. */}
593
- <span
594
- data-part="line"
595
- data-edge="start"
596
- data-color={entry.dataColor}
597
- style={{ "--tl-from": entry.value, ...leadingMask } as CSSProperties}
598
- className={cn(
599
- "col-start-2 row-start-1 self-start justify-self-center w-(--tl-line-width)",
600
- "h-(--tl-axis-offset,0px) bg-(--tl-from) [mask-image:var(--tl-line-mask)]",
601
- )}
602
- />
603
- <span
604
- data-part="line"
605
- data-edge="end"
606
- data-color={exit.dataColor}
607
- style={{ "--tl-from": exit.value, ...ownMask } as CSSProperties}
608
- className={cn(
609
- "relative col-start-2 row-start-1 justify-self-center w-(--tl-line-width)",
610
- "mt-[calc(var(--tl-bullet-size)+var(--tl-axis-offset,0px))]",
611
- "[mask-image:var(--tl-line-mask)]",
612
- )}
613
- >
614
- <span
615
- data-color={target.dataColor}
616
- style={{ "--tl-to": target.value } as CSSProperties}
617
- className="absolute inset-0 [background-image:linear-gradient(to_bottom_in_oklab,var(--tl-from),var(--tl-to))]"
618
- />
619
- </span>
620
- <div
621
- data-part="axis"
622
- className="col-start-2 row-start-1 flex justify-center self-start pt-(--tl-axis-offset)"
623
- >
624
- <span
625
- data-part="bullet"
626
- // A pending bullet drops its palette: `[data-color]` and the
627
- // `pending` slot remap would both set `--c-*` on this one element,
628
- // leaving the winner to stylesheet order. The disabled slots it
629
- // remaps to are shared by every palette anyway.
630
- data-color={!isGradient && !pending ? color : undefined}
631
- style={gradientVars as CSSProperties}
632
- className={cn(
633
- timelineBulletVariants({
634
- variant,
635
- // A pending `default` step is a bare outer ring: no inset gap
636
- // and center to draw.
637
- ringed: !bullet && !(pending && (variant ?? "default") === "default"),
638
- state,
639
- }),
640
- "size-(--tl-bullet-size) grid place-items-center overflow-hidden",
641
- "[&_svg]:size-full [&_svg]:p-0.5",
642
- isGradient && !pending && gradient?.dir && GRADIENT_DIR_CLASS[gradient.dir],
643
- )}
644
- >
645
- {bullet}
646
- </span>
647
- </div>
648
- {children}
593
+ `--tl-bullet-size`/`--tl-axis-offset` are declared on the `<li>`
594
+ (see `timelineVariants` / this component's own `style`), not
595
+ scoped to the bullet, so these siblings can read the same values
596
+ as the axis div below — siblings can only stay in sync through a
597
+ shared var. */}
598
+ <span
599
+ data-part="line"
600
+ data-edge="start"
601
+ data-color={entry.dataColor}
602
+ style={{ "--tl-from": entry.value, ...leadingMask } as CSSProperties}
603
+ className={cn(
604
+ "col-start-2 row-start-1 self-start justify-self-center w-(--tl-line-width)",
605
+ "h-(--tl-axis-offset,0px) bg-(--tl-from) [mask-image:var(--tl-line-mask)]",
606
+ )}
607
+ />
608
+ <span
609
+ data-part="line"
610
+ data-edge="end"
611
+ data-color={exit.dataColor}
612
+ style={{ "--tl-from": exit.value, ...ownMask } as CSSProperties}
613
+ className={cn(
614
+ "relative col-start-2 row-start-1 justify-self-center w-(--tl-line-width)",
615
+ "mt-[calc(var(--tl-bullet-size)+var(--tl-axis-offset,0px))]",
616
+ "[mask-image:var(--tl-line-mask)]",
617
+ )}
618
+ >
619
+ <span
620
+ data-color={target.dataColor}
621
+ style={{ "--tl-to": target.value } as CSSProperties}
622
+ className="absolute inset-0 [background-image:linear-gradient(to_bottom_in_oklab,var(--tl-from),var(--tl-to))]"
623
+ />
624
+ </span>
625
+ <div
626
+ data-part="axis"
627
+ className="col-start-2 row-start-1 flex justify-center self-start pt-(--tl-axis-offset)"
628
+ >
629
+ <span
630
+ data-part="bullet"
631
+ // A pending bullet drops its palette: `[data-color]` and the
632
+ // `pending` slot remap would both set `--c-*` on this one element,
633
+ // leaving the winner to stylesheet order. The disabled slots it
634
+ // remaps to are shared by every palette anyway.
635
+ data-color={!isGradient && !pending ? color : undefined}
636
+ style={gradientVars as CSSProperties}
637
+ className={cn(
638
+ timelineBulletVariants({
639
+ variant,
640
+ // A pending `default` step is a bare outer ring: no inset gap
641
+ // and center to draw.
642
+ ringed: !bullet && !(pending && (variant ?? "default") === "default"),
643
+ state,
644
+ }),
645
+ "size-(--tl-bullet-size) grid place-items-center overflow-hidden",
646
+ "[&_svg]:size-full [&_svg]:p-0.5",
647
+ isGradient && !pending && gradient?.dir && GRADIENT_DIR_CLASS[gradient.dir],
648
+ )}
649
+ >
650
+ {bullet}
651
+ </span>
652
+ </div>
653
+ {own}
654
+ </>
655
+ ))}
649
656
  </ark.li>
650
657
  )
651
658
  }
@@ -6,6 +6,7 @@ import { Tooltip as ArkTooltip } from "@ark-ui/react/tooltip"
6
6
  import { cva, type VariantProps } from "class-variance-authority"
7
7
  import { createContext, type ReactNode, useContext, useId } from "react"
8
8
  import { match } from "ts-pattern"
9
+ import type { NoAsChild } from "../../lib/as-child"
9
10
  import { cn } from "../../lib/cn"
10
11
  import { focusStyles } from "../../lib/focus-styles"
11
12
  import { useOverlayContainer } from "../../lib/overlay-container"
@@ -177,7 +178,7 @@ const Content = ({ className, children, testId, ...rest }: TooltipContentProps)
177
178
  return <Portal container={portalContainer}>{bubble}</Portal>
178
179
  }
179
180
 
180
- export type TooltipArrowProps = ArkTooltip.ArrowProps & WithTestId
181
+ export type TooltipArrowProps = NoAsChild<ArkTooltip.ArrowProps> & WithTestId
181
182
 
182
183
  /** The little arrow linking the bubble to its trigger. Compose it inside a
183
184
  * `Tooltip.Content` (or let the convenience form's `withArrow` add it for you).
@@ -0,0 +1,70 @@
1
+ import { render } from "@testing-library/react"
2
+ import { describe, expect, it } from "vitest"
3
+ import { type ForbidAsChild, type NoAsChild, withAsChildContent } from "./as-child"
4
+
5
+ /**
6
+ * Type-level guards for the two forbid shapes, plus the folding helper's
7
+ * runtime. As in `available-if.test.ts`, `pnpm typecheck` enforces the
8
+ * negative cases, and each `@ts-expect-error` has a positive twin proving the
9
+ * line is otherwise well-formed.
10
+ */
11
+
12
+ type Slice = { asChild?: boolean; id?: string }
13
+ const Part = (_: NoAsChild<Slice>) => null
14
+
15
+ /** A discriminated pair kept outside the omitted slice, the way
16
+ * `NotificationProps` keeps `ToastHue`. */
17
+ type Hue = { type: "info"; color?: undefined } | { type?: undefined; color?: string }
18
+ const Paired = (_: Omit<Slice, "asChild"> & ForbidAsChild & Hue) => null
19
+
20
+ describe("NoAsChild", () => {
21
+ it("rejects asChild passed directly", () => {
22
+ // @ts-expect-error asChild is unavailable, and the brand says why.
23
+ const bad = <Part asChild />
24
+ const ok = <Part id="x" />
25
+ expect([bad, ok]).toHaveLength(2)
26
+ })
27
+
28
+ it("rejects asChild arriving through a spread", () => {
29
+ const forwarded = { asChild: true }
30
+ // @ts-expect-error a spread is how prop bags get forwarded, so it must be caught too.
31
+ const bad = <Part {...forwarded} />
32
+ const allowed = { id: "x" }
33
+ const ok = <Part {...allowed} />
34
+ expect([bad, ok]).toHaveLength(2)
35
+ })
36
+
37
+ it("still allows an explicit undefined", () => {
38
+ expect(<Part asChild={undefined} />).toBeTruthy()
39
+ })
40
+ })
41
+
42
+ describe("ForbidAsChild", () => {
43
+ it("leaves a union beside it intact", () => {
44
+ // @ts-expect-error `type` and `color` stay exclusive: no Omit flattened the union.
45
+ const bad = <Paired type="info" color="red" />
46
+ const ok = [<Paired key="t" type="info" />, <Paired key="c" color="red" />]
47
+ expect([bad, ...ok]).toHaveLength(3)
48
+ })
49
+
50
+ it("rejects asChild", () => {
51
+ // @ts-expect-error asChild is unavailable here too.
52
+ const bad = <Paired asChild />
53
+ expect(bad).toBeTruthy()
54
+ })
55
+ })
56
+
57
+ describe("withAsChildContent", () => {
58
+ it("rebuilds an element child's own children and merges extra props", () => {
59
+ const { container } = render(
60
+ withAsChildContent(<a href="/x">label</a>, (own) => <b>{own}</b>, { title: "t" }),
61
+ )
62
+ const link = container.querySelector("a")
63
+ expect(link?.innerHTML).toBe("<b>label</b>")
64
+ expect(link?.getAttribute("title")).toBe("t")
65
+ })
66
+
67
+ it("passes a non-element child through untouched", () => {
68
+ expect(withAsChildContent("text", (own) => <b>{own}</b>)).toBe("text")
69
+ })
70
+ })
@@ -0,0 +1,119 @@
1
+ import { cloneElement, isValidElement, type ReactNode } from "react"
2
+ import type { UnavailableProps } from "./available-if"
3
+
4
+ /**
5
+ * The two sanctioned ways for a kit part to meet Ark's `asChild`.
6
+ *
7
+ * Ark's factory clones **exactly one** valid element under `asChild` and
8
+ * renders `null` otherwise (`isValidElement(children) ? clone : null`). So a
9
+ * part that renders anything besides a bare `{children}` — an icon, a
10
+ * section, an indicator, a default fallback — breaks in one of two ways:
11
+ *
12
+ * - **It renders nothing.** Two or more JSX child expressions become an
13
+ * array, even when some of them evaluate to `false`
14
+ * (`{start && <Start/>}{children}{end && <End/>}`), and an array is not an
15
+ * element.
16
+ * - **Its own content is lost or misplaced.** Under `asChild`, `children`
17
+ * *is* the consumer's element, so `children ?? <DefaultIcon/>` never
18
+ * reaches the fallback, and a wrapper (`<Provider>{children}</Provider>`)
19
+ * is what gets cloned instead of the consumer's element.
20
+ *
21
+ * Every such part must pick one of these:
22
+ *
23
+ * - **`withAsChildContent`** — the part can sensibly *become* the consumer's
24
+ * element (a menu item rendered as a router `<Link>`, a crumb, an alert
25
+ * that links somewhere). The kit's content is folded into the child's own
26
+ * children, so Ark still receives a single element.
27
+ * - **`NoAsChild`** — the part renders structure that cannot live inside an
28
+ * arbitrary element (a slider's track and thumbs, a scheduler grid). The
29
+ * prop becomes a compile error that says why.
30
+ *
31
+ * `as-child.contract.test.tsx` enforces the choice: it derives every public
32
+ * part that accepts `asChild` from the component entries, renders each one
33
+ * with an `<a>` child, and fails the typecheck when a part is in neither its
34
+ * render table nor `NoAsChild`.
35
+ */
36
+
37
+ /**
38
+ * Rebuilds the single `asChild` child's own children through `render`, so
39
+ * kit content (sections, icons, spinners) lands *inside* the element Ark
40
+ * clones instead of beside it. `extra` is merged onto the child too, for the
41
+ * odd prop the kit has to own (a click guard while loading).
42
+ *
43
+ * A child that isn't a single element falls through unchanged, leaving
44
+ * Ark's own handling of the misuse as it is.
45
+ *
46
+ * ```tsx
47
+ * <ArkMenu.Item asChild {...rest}>
48
+ * {withAsChildContent(children, (own) => (
49
+ * <>
50
+ * <StartSection>{startSection}</StartSection>
51
+ * {own}
52
+ * </>
53
+ * ))}
54
+ * </ArkMenu.Item>
55
+ * ```
56
+ */
57
+ export const withAsChildContent = (
58
+ child: ReactNode,
59
+ render: (own: ReactNode) => ReactNode,
60
+ extra?: Record<string, unknown>,
61
+ ): ReactNode => {
62
+ if (!isValidElement<{ children?: ReactNode }>(child)) return child
63
+ return cloneElement(child, { ...extra, children: render(child.props.children) })
64
+ }
65
+
66
+ /**
67
+ * The usual call site: `render` wraps the part's `children` with its own
68
+ * content either way, around `children` normally and inside the consumer's
69
+ * element under `asChild`. One `render` serves both branches, so the two
70
+ * can't drift apart.
71
+ *
72
+ * ```tsx
73
+ * <ArkMenu.Item asChild={asChild} {...rest}>
74
+ * {composeChildren(asChild, children, (own) => <>{icon}{own}</>)}
75
+ * </ArkMenu.Item>
76
+ * ```
77
+ */
78
+ export const composeChildren = (
79
+ asChild: boolean | undefined,
80
+ children: ReactNode,
81
+ render: (own: ReactNode) => ReactNode,
82
+ ): ReactNode => (asChild ? withAsChildContent(children, render) : render(children))
83
+
84
+ /** The sentence a caller reads when passing `asChild` to a `NoAsChild` part. */
85
+ export type NoAsChildReason =
86
+ "renders its own structure around its children, so asChild is not supported"
87
+
88
+ /**
89
+ * The forbid shape on its own: `asChild` typed as a branded `Unavailable`.
90
+ * Intersect it beside a props type (`Omit<RootProps, "children"> &
91
+ * ForbidAsChild & { data }`); `NoAsChild<P>` is the same thing as a wrapper.
92
+ *
93
+ * Uses the brand rather than omitting the key, because omission is silent
94
+ * on a JSX spread (`<Slider {...props} />`), which is exactly how prop bags
95
+ * get forwarded. Either way the error names the reason:
96
+ *
97
+ * Type 'boolean' is not assignable to type 'Unavailable<"renders its own
98
+ * structure around its children, so asChild is not supported">'
99
+ */
100
+ export type ForbidAsChild = UnavailableProps<{ asChild?: boolean }, NoAsChildReason>
101
+
102
+ /**
103
+ * `P` with `asChild` forbidden: `P & ForbidAsChild`, so `asChild` resolves
104
+ * to `(boolean & Unavailable<…>) | undefined`, which nothing but `undefined`
105
+ * satisfies.
106
+ *
107
+ * An intersection, not `Omit<P, "asChild"> & …`. `Omit` re-maps every key of
108
+ * a large HTML/Ark props type, and measured on the forbidden parts that cost
109
+ * each importing file about 38k extra type instantiations (+8.6%); the
110
+ * intersection costs nothing measurable. It also leaves a union in `P` (a
111
+ * discriminated `type` / `color` pair, a slot-size union) and any generic
112
+ * untouched, where `Omit` would flatten the one and hide the other from
113
+ * inference.
114
+ *
115
+ * The component destructures `asChild` out before spreading the rest onto
116
+ * its Ark part (`({ asChild: _asChild, ...rest })`), so a JS caller that
117
+ * passes it anyway gets the normal render rather than Ark's `null`.
118
+ */
119
+ export type NoAsChild<P> = P & ForbidAsChild
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/menu/menu.tsx"],"names":["ArkMenu"],"mappings":";;;;;;;;;;;;;;;;;AA4DA,IAAM,WAAA,GAAc,EAAA;AAAA,EAClB,aAAA;AAAA,EACA,kCAAA;AAAA,EACA;AACF,CAAA;AAQA,IAAM,QAAA,GAAW,GAAA;AAAA,EACf;AAAA,IACE,kFAAA;AAAA,IACA,0BAAA;AAAA,IACA,kCAAA;AAAA,IACA;AAAA,GACF;AA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K,OAAO,SAAA,EAAW,GAAG,MAAK,KAAwB;AAC/E,EAAA,MAAM,OAAO,cAAA,EAAe;AAC5B,EAAA,MAAM,WAAW,kBAAA,EAAmB;AACpC,EAAA,MAAM,EAAE,aAAA,EAAe,mBAAA,EAAqB,GAAG,OAAA,KAAY,IAAA,CAAK,eAAA,CAAgB,EAAE,KAAA,EAAO,CAAA;AACzF,EAAA,uBACE,GAAA;AAAA,IAAC,GAAA,CAAI,MAAA;AAAA,IAAJ;AAAA,MACE,GAAG,UAAA;AAAA,QACF;AAAA,UACE,GAAG,OAAA;AAAA,UACH,eAAA,EAAiB,QAAA,CAAS,SAAA,GAAY,MAAA,GAAY,QAAQ,eAAe,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAKzE,WAAA,EAAa,CAAC,KAAA,KAAqB,KAAA,CAAM,cAAA;AAAe,SAC1D;AAAA;AAAA;AAAA;AAAA;AAAA,QAKA,EAAE,GAAG,IAAA,EAAM,WAAW,EAAA,CAAG,aAAA,EAAe,SAAS,CAAA;AAAE,OACrD;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;AAGO,IAAM,iBAAiBA,IAAA,CAAQ;AAC/B,IAAM,YAAYA,IAAA,CAAQ;AAC1B,IAAM,UAAUA,IAAA,CAAQ;AAExB,IAAM,SAAA,GAAY;AAElB,IAAM,UAAA,GAAa","file":"chunk-2762HZYX.js","sourcesContent":["\"use client\"\n\nimport { ark } from \"@ark-ui/react/factory\"\nimport { useLocaleContext } from \"@ark-ui/react/locale\"\nimport { Menu as ArkMenu, useMenuContext } from \"@ark-ui/react/menu\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { usePresenceContext } from \"@ark-ui/react/presence\"\nimport { mergeProps } from \"@ark-ui/react/utils\"\nimport { cva } from \"class-variance-authority\"\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type DragEvent,\n type ReactNode,\n type Ref,\n useContext,\n useId,\n} from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport { useNestedLayer } from \"../../lib/overlay-layer\"\nimport { type LogicalPosition, resolveLogicalPlacement } from \"../../lib/placement\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { CheckIcon, ChevronIcon } from \"../popover/icons\"\nimport {\n popoverChevron,\n popoverChrome,\n popoverGroupLabel,\n popoverIndicator,\n} from \"../popover/popover\"\n\n/**\n * Menu — the kit's dropdown of actions, a styled layer over Ark UI's Menu.\n * It's the click-triggered sibling of `Popover` (a free-form panel): Ark's Menu\n * machine wires roving focus, type-ahead, `role=\"menu\"` / `menuitem`,\n * `aria-haspopup` / `aria-expanded`, submenus, and checkbox / radio selection.\n *\n * Two ways to use it — the compound parts (this file) give full control; the\n * data-driven `<Menu data={…}>` convenience (see `menu-data.tsx`) covers the\n * common action-menu case and is built on these very parts.\n *\n * <Menu.Root>\n * <Menu.Trigger asChild><Button>Open</Button></Menu.Trigger>\n * <Menu.Content>\n * <Menu.Item startSection={<User />} onClick={openProfile}>Profile</Menu.Item>\n * <Menu.Divider />\n * <Menu.Item color=\"red\" startSection={<Trash />} onClick={remove}>Delete</Menu.Item>\n * </Menu.Content>\n * </Menu.Root>\n *\n * Portaled by default (escapes `overflow:hidden` ancestors), sized to content,\n * and animated via the kit's shared `popover-in/out` tokens.\n */\n\n/** Menu surface — the shared floating chrome, sized to content and scrollable\n * when tall. Unlike the form pickers' `popoverContent` (an `overflow-hidden`\n * clip around a nested scroller) a Menu scrolls natively, so Ark needs no\n * `scrollToIndexFn` workaround. */\nconst menuContent = cn(\n popoverChrome,\n \"flex w-max min-w-40 flex-col p-1\",\n \"max-h-[min(24rem,var(--available-height,24rem))] overflow-y-auto overscroll-contain\",\n)\n\n/** A single menu row — shared by `Item`, `CheckboxItem`, `RadioItem`, and\n * `SubTrigger` so every row is visually identical. Mirrors `popoverOption`'s\n * neutral look, but the `colored` variant swaps the text + highlight tints to\n * the palette slot vars (`--c-text` / `--c-soft`) resolved from `data-color` —\n * e.g. a red \"Delete\". Highlight is `data-highlighted`, selection is\n * `data-[state=checked]`, disabled is `data-disabled`, all owned by Ark. */\nconst menuItem = cva(\n [\n \"relative flex cursor-pointer items-center gap-2 rounded-xs px-2.5 py-1.5 text-md\",\n \"select-none outline-none\",\n \"data-[state=checked]:font-medium\",\n \"data-disabled:pointer-events-none data-disabled:opacity-50\",\n ],\n {\n variants: {\n colored: {\n // Neutral highlight is transparent — a low-opacity black/white wash,\n // not an opaque gray — matching the surface's own background-dependent\n // tint (no Figma reference for this state yet).\n false: [\n \"text-gray-light-900 dark:text-gray-dark-100\",\n \"data-highlighted:bg-black/5 dark:data-highlighted:bg-white/8\",\n ],\n // Slot vars already shift by theme (colors.css), so no `dark:` needed.\n true: [\"text-(--c-text)\", \"data-highlighted:bg-(--c-soft)\"],\n },\n },\n defaultVariants: { colored: false },\n },\n)\n\n/** Hairline between groups of items. Same shade as Popover's own\n * Header/Footer/Body slotEdge dividers (brand-900/20 / white/15) — both are\n * separator lines on the identical popoverChrome panel, so they shouldn't\n * drift to different weights. */\nconst menuDivider = \"-mx-1 my-1 h-px border-0 bg-brand-900/20 dark:bg-white/15\"\n\ntype MenuPlacement = NonNullable<NonNullable<ArkMenu.RootProps[\"positioning\"]>[\"placement\"]>\n\n/** `position` accepts Ark's physical placements plus the logical, RTL-aware\n * horizontal sides `start` / `end` (resolved to `left` / `right` by direction). */\nexport type MenuPosition = LogicalPosition<MenuPlacement>\n\ntype MenuContextValue = {\n withinPortal: boolean\n container?: HTMLElement | null\n}\nconst MenuContext = createContext<MenuContextValue>({ withinPortal: true })\n\nexport type MenuRootProps = Omit<ArkMenu.RootProps, \"positioning\" | \"onOpenChange\"> & {\n /** Dropdown placement relative to the trigger. Prefer the logical `start` / `end`\n * sides (RTL-aware), or use any Ark placement (`bottom-start`, `top`, …).\n * Defaults to `\"bottom-start\"`. */\n position?: MenuPosition\n /** Gap in px between the trigger and the dropdown. */\n offset?: number\n /** Render the dropdown in a Portal so it escapes clipping ancestors. Default `true`. */\n withinPortal?: boolean\n /** Portal target. Defaults to the enclosing `Modal`/`Drawer` when there is\n * one (so the panel stays above it), else `document.body`. */\n container?: HTMLElement | null\n /** Called when the menu opens or closes (flattened from Ark's detail object). */\n onOpenChange?: (open: boolean) => void\n /** Fires on close (any source) — Escape, outside interaction, item selection, or a controlled `onOpenChange`. */\n onClose?: () => void\n}\n\nconst Root = ({\n position = \"bottom\",\n offset,\n withinPortal = true,\n container,\n onOpenChange,\n onClose,\n children,\n ...rest\n}: MenuRootProps) => {\n const { dir } = useLocaleContext()\n return (\n <MenuContext.Provider value={{ withinPortal, container }}>\n <ArkMenu.Root\n positioning={{ placement: resolveLogicalPlacement(position, dir), gutter: offset }}\n onOpenChange={({ open }) => {\n onOpenChange?.(open)\n if (!open) onClose?.()\n }}\n {...rest}\n >\n {children}\n </ArkMenu.Root>\n </MenuContext.Provider>\n )\n}\n\nexport type MenuContentProps = ArkMenu.ContentProps & WithTestId\n\nconst Content = ({ className, children, testId, ...rest }: MenuContentProps) => {\n const { withinPortal, container } = useContext(MenuContext)\n const portalContainer = useOverlayContainer(container)\n // Holds an enclosing Modal/Drawer/Popover open while the menu is; see `lib/overlay-layer.tsx`.\n useNestedLayer(useMenuContext().open)\n const panel = (\n <ArkMenu.Positioner>\n <ArkMenu.Content\n className={cn(menuContent, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </ArkMenu.Content>\n </ArkMenu.Positioner>\n )\n if (!withinPortal) return panel\n return <Portal container={portalContainer}>{panel}</Portal>\n}\n\n/** Shared inline-start wrapper for a `startSection`. Sizes a bare icon to 16px\n * (`size-4`, like Button `md` / Input / Accordion) so every row's label starts\n * on the same column whatever icon it carries. Scoped to this slot — not the\n * whole row — so SVGs in `children` / `endSection` and the row's own indicator\n * or chevron keep their sizes. `:where()` drops the rule to zero class\n * specificity, so a size class on the icon itself (`className=\"size-5\"`) still\n * wins; Lucide's `size` prop is only an HTML attribute and does not. */\nconst StartSection = ({ children }: { children: ReactNode }) => (\n <span className=\"inline-flex shrink-0 items-center [:where(&)_svg]:size-4\">{children}</span>\n)\n\n/** Shared inline-end wrapper for a `endSection` (pushes it to the far edge). */\nconst EndSection = ({ children }: { children: ReactNode }) => (\n <span className=\"ms-auto inline-flex shrink-0 items-center gap-2 text-gray-light-500 dark:text-gray-dark-400\">\n {children}\n </span>\n)\n\nexport type MenuItemProps = Omit<ArkMenu.ItemProps, \"value\" | \"onClick\" | \"onSelect\"> &\n WithTestId & {\n /** Unique value — used for type-ahead + the selection detail. Auto-generated\n * when omitted (Mantine-style items need no explicit value). */\n value?: string\n /** Content before the label (usually an icon — a bare SVG is sized to 16px;\n * a size class on the icon overrides it). */\n startSection?: ReactNode\n /** Content after the label, pushed to the inline-end. */\n endSection?: ReactNode\n /** Palette for the row — colors the label + highlight tint (e.g. `\"red\"` for a\n * destructive action). Resolved from `data-color` via the slot vars. */\n color?: Color\n /** Fires when the item is selected — on click *and* keyboard activation\n * (Enter / Space), not just a pointer click. Wraps Ark's `onSelect`. */\n onClick?: () => void\n }\n\nconst Item = ({\n value,\n startSection,\n endSection,\n color,\n onClick,\n className,\n children,\n testId,\n ...rest\n}: MenuItemProps) => {\n const autoId = useId()\n return (\n <ArkMenu.Item\n value={value ?? autoId}\n onSelect={onClick}\n data-color={color}\n className={cn(menuItem({ colored: color != null }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {startSection != null && <StartSection>{startSection}</StartSection>}\n {children}\n {endSection != null && <EndSection>{endSection}</EndSection>}\n </ArkMenu.Item>\n )\n}\n\n/** Optional decorative leader for a section heading — the code-themed `// ` from\n * `Text`'s `prefix`. Hidden from screen readers and the clipboard\n * (`aria-hidden` + `select-none`); renders nothing when unset (off by default). */\nconst HeadingPrefix = ({ prefix }: { prefix: ReactNode }) =>\n prefix === undefined ? null : (\n <span aria-hidden=\"true\" className=\"select-none\">\n {prefix}\n </span>\n )\n\nexport type MenuLabelProps = Omit<ComponentPropsWithoutRef<\"div\">, \"prefix\"> &\n WithTestId & {\n /** Decorative leader before the label (e.g. `\"// \"`). Off by default; hidden\n * from screen readers and the clipboard. */\n prefix?: ReactNode\n }\n\n/** Standalone section heading (Mantine parity). For grouped items with proper\n * ARIA wiring, prefer `Menu.ItemGroup` + `Menu.ItemGroupLabel`. */\nconst Label = ({ className, prefix, children, testId, ...rest }: MenuLabelProps) => (\n <div className={cn(popoverGroupLabel, className)} {...props({ \"data-testid\": testId })} {...rest}>\n <HeadingPrefix prefix={prefix} />\n {children}\n </div>\n)\n\nexport type MenuItemGroupLabelProps = Omit<ArkMenu.ItemGroupLabelProps, \"prefix\"> &\n WithTestId & {\n /** Decorative leader before the label (e.g. `\"// \"`). Off by default; hidden\n * from screen readers and the clipboard. */\n prefix?: ReactNode\n }\n\nconst ItemGroupLabel = ({\n className,\n prefix,\n children,\n testId,\n ...rest\n}: MenuItemGroupLabelProps) => (\n <ArkMenu.ItemGroupLabel\n className={cn(popoverGroupLabel, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n <HeadingPrefix prefix={prefix} />\n {children}\n </ArkMenu.ItemGroupLabel>\n)\n\nconst Divider = ({ className, testId, ...rest }: ArkMenu.SeparatorProps & WithTestId) => (\n <ArkMenu.Separator\n className={cn(menuDivider, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type MenuCheckboxItemProps = ArkMenu.CheckboxItemProps &\n WithTestId & {\n startSection?: ReactNode\n color?: Color\n }\n\nconst CheckboxItem = ({\n startSection,\n color,\n className,\n children,\n testId,\n ...rest\n}: MenuCheckboxItemProps) => (\n <ArkMenu.CheckboxItem\n data-color={color}\n className={cn(menuItem({ colored: color != null }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {startSection != null && <StartSection>{startSection}</StartSection>}\n {children}\n <ArkMenu.ItemIndicator className={popoverIndicator}>\n <CheckIcon />\n </ArkMenu.ItemIndicator>\n </ArkMenu.CheckboxItem>\n)\n\nexport type MenuRadioGroupProps = Omit<\n ArkMenu.RadioItemGroupProps,\n \"onValueChange\" | \"onChange\"\n> & {\n /** Called with the newly selected value (flattened from Ark's detail object). */\n onChange?: (value: string) => void\n}\n\nconst RadioGroup = ({ onChange, ...rest }: MenuRadioGroupProps) => (\n <ArkMenu.RadioItemGroup\n onValueChange={onChange ? ({ value }) => onChange(value) : undefined}\n {...rest}\n />\n)\n\nexport type MenuRadioItemProps = ArkMenu.RadioItemProps &\n WithTestId & {\n startSection?: ReactNode\n color?: Color\n }\n\nconst RadioItem = ({\n startSection,\n color,\n className,\n children,\n testId,\n ...rest\n}: MenuRadioItemProps) => (\n <ArkMenu.RadioItem\n data-color={color}\n className={cn(menuItem({ colored: color != null }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {startSection != null && <StartSection>{startSection}</StartSection>}\n {children}\n <ArkMenu.ItemIndicator className={popoverIndicator}>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"lucide lucide-dot-big\"\n aria-hidden=\"true\"\n >\n <title>Dot big</title>\n <circle cx=\"12.1\" cy=\"12.1\" r=\"4\"></circle>\n </svg>\n </ArkMenu.ItemIndicator>\n </ArkMenu.RadioItem>\n)\n\nexport type MenuSubProps = Omit<ArkMenu.RootProps, \"positioning\"> & {\n /** Gap in px between the trigger row and the submenu. Ark manages submenu\n * *placement* itself (RTL-aware `right-start` / `left-start`, flush to the\n * parent), so only this main-axis gap is adjustable. Defaults to `10`. */\n offset?: number\n}\n\n/** A submenu opens flush to its trigger row, so its first item lands one surface\n * inset *below* the trigger — the `menuContent` top border (1px) + top padding\n * (`p-1` = 4px). Nudging the submenu up by that inset lines the first sub-item\n * up with the trigger row. Cross-axis is the vertical axis for the (Ark-forced)\n * `right-start` / `left-start` placements, and Floating UI maps a negative value\n * to \"up\" in both directions — so one constant covers LTR and RTL. */\nconst SUBMENU_ALIGN_OFFSET = -5\n\n/** Submenu root — a nested Ark Menu whose triggering row is `Menu.SubTrigger`.\n * Inherits the parent's portal settings via context (see `Menu.SubContent`).\n *\n * Ark's menu machine hard-overrides a submenu's placement and `gutter` (to `0`),\n * so a `gutter`-based offset is silently dropped. It leaves `offset` untouched,\n * and Floating UI resolves the axes as `offset.mainAxis ?? gutter` (the gap) and\n * `offset.crossAxis` (the top alignment) — so the whole `offset` object is the\n * one path that survives the override. */\nconst Sub = ({ offset = 10, children, ...rest }: MenuSubProps) => (\n <ArkMenu.Root\n positioning={{ offset: { mainAxis: offset, crossAxis: SUBMENU_ALIGN_OFFSET } }}\n {...rest}\n >\n {children}\n </ArkMenu.Root>\n)\n\nexport type MenuSubTriggerProps = ArkMenu.TriggerItemProps &\n WithTestId & {\n startSection?: ReactNode\n color?: Color\n }\n\nconst SubTrigger = ({\n startSection,\n color,\n className,\n children,\n testId,\n ...rest\n}: MenuSubTriggerProps) => (\n <ArkMenu.TriggerItem\n data-color={color}\n className={cn(menuItem({ colored: color != null }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {startSection != null && <StartSection>{startSection}</StartSection>}\n {children}\n <span className={cn(popoverChevron, \"ms-auto -me-1 -rotate-90 rtl:rotate-90 [&_svg]:size-4\")}>\n <ChevronIcon />\n </span>\n </ArkMenu.TriggerItem>\n)\n\nexport {\n CheckboxItem,\n Content,\n Divider,\n Item,\n ItemGroupLabel,\n Label,\n RadioGroup,\n RadioItem,\n Root,\n Sub,\n SubTrigger,\n}\n\nexport type MenuTriggerProps = ArkMenu.TriggerProps & { ref?: Ref<HTMLButtonElement> }\n\n/** Ark's `Menu.Trigger` minus one handler. Zag's trigger calls `preventDefault()`\n * on `pointerdown`, which cancels the browser's own mouse-down focus of the\n * button. With no pointer-initiated focus on record, Chromium treats every\n * later *programmatic* focus as keyboard-like: Zag's `focus()` on the content\n * when the menu opens, and its `focus()` back on the trigger when it closes,\n * both match `:focus-visible`, so a mouse user gets the keyboard ring on the\n * trigger after every menu interaction (#227).\n *\n * Leaving `pointerdown` alone restores the platform behaviour — the click\n * focuses the button without a ring, and the programmatic focuses that follow\n * inherit that. Keyboard users keep the ring, since a Tab/Enter/Escape still\n * marks the focus as keyboard-driven. It's also how Zag's own Popover trigger\n * behaves (it never cancels `pointerdown`). */\nexport const Trigger = ({ ref, value, className, ...rest }: MenuTriggerProps) => {\n const menu = useMenuContext()\n const presence = usePresenceContext()\n const { onPointerDown: _cancelsNativeFocus, ...trigger } = menu.getTriggerProps({ value })\n return (\n <ark.button\n {...mergeProps(\n {\n ...trigger,\n \"aria-controls\": presence.unmounted ? undefined : trigger[\"aria-controls\"],\n // The canceled `pointerdown` also blocked a native drag as a side\n // effect: an `asChild` `<a href>`, or the `<img>` of an avatar\n // trigger, would otherwise lift a drag ghost off the trigger.\n // Canceling `dragstart` instead leaves the press, and its focus, alone.\n onDragStart: (event: DragEvent) => event.preventDefault(),\n },\n // Same side effect for text: a double-click or drag on a non-button\n // trigger (`asChild` + `<span role=\"button\">`) would select its label.\n // CSS restores that. It lands on the `asChild` child too, and the\n // consumer's `className` comes last so it can override it.\n { ...rest, className: cn(\"select-none\", className) },\n )}\n ref={ref}\n />\n )\n}\n\n/** Ark parts re-exported unchanged (no styling needed). */\nexport const ContextTrigger = ArkMenu.ContextTrigger\nexport const ItemGroup = ArkMenu.ItemGroup\nexport const Context = ArkMenu.Context\n/** Alias for `Divider` (Ark's name for the same part). */\nexport const Separator = Divider\n/** Submenu dropdown — identical surface + portalling to `Menu.Content`. */\nexport const SubContent = Content\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/drawer/drawer.tsx"],"names":["Ark"],"mappings":";;;;;;;;;;;;AAgCA,IAAM,kBAAA,GAAqB;AAAA,EACzB,KAAA,EAAO,OAAA;AAAA,EACP,GAAA,EAAK,KA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AAA,CAAO,OAAA,GAAU,aAAA;AACjB,MAAA,CAAO,OAAA,GAAU,aAAA;AACjB,MAAA,CAAO,QAAA,GAAW,cAAA;AAClB,MAAA,CAAO,UAAA,GAAa,gBAAA;AACpB,MAAA,CAAO,KAAA,GAAQ,WAAA;AACf,MAAA,CAAO,WAAA,GAAc,iBAAA;AACrB,MAAA,CAAO,YAAA,GAAe,kBAAA;AACtB,MAAA,CAAO,OAAA,GAAU,aAAA;AACjB,MAAA,CAAO,MAAA,GAAS,YAAA;AAChB,MAAA,CAAO,IAAA,GAAO,UAAA;AACd,MAAA,CAAO,MAAA,GAAS,YAAA","file":"chunk-2H46IXW4.js","sourcesContent":["\"use client\"\n\nimport { Drawer as Ark } from \"@ark-ui/react/drawer\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { cva } from \"class-variance-authority\"\nimport { X } from \"lucide-react\"\nimport { type ComponentPropsWithoutRef, type ReactNode, useRef } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { OverlayContainerProvider } from \"../../lib/overlay-container\"\nimport { OverlayLayerProvider, useLayerGuard } from \"../../lib/overlay-layer\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { ActionIcon } from \"../action-icon/action-icon\"\n\n/**\n * Drawer — edge-anchored panel on top of Ark UI's Drawer state machine. Ark\n * owns swipe-to-dismiss, snap points, focus-trap, scroll-lock and the\n * `data-state=\"open|closed\"` attribute; this wrapper adds an RTL-aware\n * `placement` prop (Ark has none) by writing `data-placement` on the positioner\n * + content and deriving Ark's logical `swipeDirection`. Docking, sizing and\n * the slide animation are pure CSS keyed on `[data-placement]` (see\n * `theme.css`), so `start`/`end` flip automatically under `dir=\"rtl\"`.\n *\n * Mirrors `Modal`'s dual API: high-level `<Drawer open placement size … >` plus\n * low-level parts (`Drawer.Root`, `Drawer.Content`, …). Padding flows through\n * the `--drawer-px` CSS var.\n */\n\nexport type DrawerPlacement = \"start\" | \"end\" | \"top\" | \"bottom\"\n\n/** placement → Ark logical swipe axis (RTL handled by Ark for start/end). */\nconst PLACEMENT_TO_SWIPE = {\n start: \"start\",\n end: \"end\",\n top: \"up\",\n bottom: \"down\",\n} as const\n\nconst isInline = (p: DrawerPlacement) => p === \"start\" || p === \"end\"\n\n/** Inline placements size on width; block placements size on height. */\nconst INLINE_SIZE: Record<Size, string> = {\n xs: \"w-[18rem]\",\n sm: \"w-[22rem]\",\n md: \"w-[28rem]\",\n lg: \"w-[34rem]\",\n xl: \"w-[42rem]\",\n}\nconst BLOCK_SIZE: Record<Size, string> = {\n xs: \"h-[30dvh]\",\n sm: \"h-[40dvh]\",\n md: \"h-[55dvh]\",\n lg: \"h-[70dvh]\",\n xl: \"h-[85dvh]\",\n}\n\nconst PADDING: Record<Size, string> = {\n xs: \"0.75rem\",\n sm: \"1rem\",\n md: \"1.25rem\",\n lg: \"1.5rem\",\n xl: \"2rem\",\n}\n\nconst drawerBackdrop = cva([\n \"fixed inset-0 z-[calc(var(--modal-z,150)+var(--layer-index,0))] bg-black/50 backdrop-blur-lg\",\n \"data-[state=open]:animate-fade-in data-[state=closed]:animate-fade-out\",\n])\n\nconst drawerPositioner = cva(\n \"fixed inset-0 z-[calc(var(--modal-z,150)+var(--layer-index,0))] flex\",\n {\n variants: {\n placement: {\n start: \"items-stretch justify-start\",\n end: \"items-stretch justify-end\",\n top: \"items-start justify-stretch\",\n bottom: \"items-end justify-stretch\",\n },\n },\n defaultVariants: { placement: \"end\" },\n },\n)\n\nexport type DrawerPositionerProps = ComponentPropsWithoutRef<typeof Ark.Positioner>\n\n/** Publishes itself as the portal target for any overlay opened inside the\n * drawer, so a Menu/Select/DatePicker in a drawer body stays above the panel\n * instead of behind it. See `lib/overlay-container.tsx`. */\nconst DrawerPositioner = ({ children, ...rest }: DrawerPositionerProps) => {\n const positioner = useRef<HTMLDivElement>(null)\n return (\n <Ark.Positioner ref={positioner} {...rest}>\n <OverlayContainerProvider value={positioner}>{children}</OverlayContainerProvider>\n </Ark.Positioner>\n )\n}\n\nconst drawerContent = cva([\n \"relative flex flex-col overflow-hidden\",\n \"bg-brand-50 text-gray-light-900 shadow-2xl\",\n \"dark:bg-brand-950 dark:text-gray-dark-25\",\n \"focus:outline-none\",\n // border on the docked edge only — keyed by data-placement in theme.css\n \"data-[placement=start]:border-e data-[placement=end]:border-s\",\n \"data-[placement=top]:border-b data-[placement=bottom]:border-t\",\n \"border-brand-900/20 dark:border-white/15\",\n \"data-[state=open]:animate-drawer-in data-[state=closed]:animate-drawer-out\",\n])\n\n// ---------------------------------------------------------------------------\n// Low-level parts\n// ---------------------------------------------------------------------------\n\nexport type DrawerRootProps = ComponentPropsWithoutRef<typeof Ark.Root>\n\n/** Ark's root, plus the nested-layer guard: while a picker opened inside the\n * drawer is open, an outside click closes the picker only, not the drawer\n * under it. See `lib/overlay-layer.tsx`. */\nexport const DrawerRoot = ({ onPointerDownOutside, children, ...rest }: DrawerRootProps) => {\n const guard = useLayerGuard(onPointerDownOutside)\n return (\n <Ark.Root onPointerDownOutside={guard.onPointerDownOutside} {...rest}>\n <OverlayLayerProvider value={guard.layers}>{children}</OverlayLayerProvider>\n </Ark.Root>\n )\n}\nexport const DrawerTrigger = Ark.Trigger\nexport const DrawerContext = Ark.Context\n\nexport type DrawerBackdropProps = ComponentPropsWithoutRef<typeof Ark.Backdrop> & WithTestId\n\nexport const DrawerBackdrop = ({ className, testId, ...rest }: DrawerBackdropProps) => (\n <Ark.Backdrop\n className={cn(drawerBackdrop(), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type DrawerTitleProps = ComponentPropsWithoutRef<typeof Ark.Title> & WithTestId\n\nexport const DrawerTitle = ({ className, testId, ...rest }: DrawerTitleProps) => (\n <Ark.Title\n className={cn(\"text-lg font-semibold leading-tight\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type DrawerDescriptionProps = ComponentPropsWithoutRef<typeof Ark.Description> & WithTestId\n\nexport const DrawerDescription = ({ className, testId, ...rest }: DrawerDescriptionProps) => (\n <Ark.Description\n className={cn(\"text-sm text-gray-light-500 dark:text-gray-dark-400\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type DrawerCloseTriggerProps = ComponentPropsWithoutRef<typeof Ark.CloseTrigger> &\n WithTestId & {\n \"aria-label\"?: string\n }\n\nexport const DrawerCloseTrigger = ({\n children,\n className,\n \"aria-label\": ariaLabel = \"Close\",\n testId,\n ...rest\n}: DrawerCloseTriggerProps) => (\n <Ark.CloseTrigger asChild {...rest}>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n size=\"sm\"\n aria-label={ariaLabel}\n className={className}\n testId={testId}\n >\n {children ?? <X />}\n </ActionIcon>\n </Ark.CloseTrigger>\n)\n\nexport type DrawerGrabberProps = ComponentPropsWithoutRef<typeof Ark.Grabber> & WithTestId\n\nexport const DrawerGrabber = ({ className, testId, ...rest }: DrawerGrabberProps) => (\n <Ark.Grabber\n className={cn(\n \"flex shrink-0 cursor-grab touch-none items-center justify-center py-2\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n <Ark.GrabberIndicator className=\"h-1.5 w-20 rounded-full bg-gray-light-300 dark:bg-gray-dark-700\" />\n </Ark.Grabber>\n)\n\nexport type DrawerHeaderProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\nexport const DrawerHeader = ({ className, testId, ...rest }: DrawerHeaderProps) => (\n <div\n className={cn(\n \"flex items-start justify-between gap-4 px-(--drawer-px,1.25rem) pt-(--drawer-px,1.25rem) pb-3\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type DrawerBodyProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\nexport const DrawerBody = ({ className, testId, ...rest }: DrawerBodyProps) => (\n <div\n className={cn(\"flex-1 overflow-y-auto px-(--drawer-px,1.25rem) py-1\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type DrawerFooterProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\nexport const DrawerFooter = ({ className, testId, ...rest }: DrawerFooterProps) => (\n <div\n className={cn(\n \"flex items-center justify-end gap-2 px-(--drawer-px,1.25rem) pb-(--drawer-px,1.25rem) pt-4\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\n// ---------------------------------------------------------------------------\n// High-level props-driven Drawer\n// ---------------------------------------------------------------------------\n\ntype ArkRootProps = ComponentPropsWithoutRef<typeof Ark.Root>\n\nexport type DrawerClassNames = Partial<\n Record<\n | \"backdrop\"\n | \"positioner\"\n | \"content\"\n | \"header\"\n | \"title\"\n | \"description\"\n | \"body\"\n | \"grabber\"\n | \"closeButton\",\n string\n >\n>\n\nexport type DrawerProps = Omit<\n ArkRootProps,\n \"open\" | \"defaultOpen\" | \"onOpenChange\" | \"children\" | \"swipeDirection\"\n> &\n WithTestId & {\n /** Controlled open state. */\n open?: boolean\n /** Uncontrolled initial open state. */\n defaultOpen?: boolean\n /** Fires with the next open state. Flattened from Ark's `{ open }`. */\n onOpenChange?: (open: boolean) => void\n /** Fires on close (any source) — Escape, backdrop click, swipe, or a controlled `onOpenChange`. */\n onClose?: () => void\n /** RTL-aware docking edge. @default \"end\" */\n placement?: DrawerPlacement\n size?: Size\n title?: ReactNode\n description?: ReactNode\n /** Render the default close button in the header. @default true */\n withCloseButton?: boolean\n /** Show the drag grabber handle. @default false */\n withGrabber?: boolean\n /**\n * Render the dimming backdrop. Set `false` when an ancestor (e.g. the modals\n * manager) draws a single shared backdrop for the whole overlay stack.\n * @default true\n */\n withBackdrop?: boolean\n /** Inner padding token; sets `--drawer-px`. @default \"md\" */\n padding?: Size\n closeOnEscape?: boolean\n closeOnInteractOutside?: boolean\n /** Fires after the exit animation completes — the manager unmounts on this. */\n onExitComplete?: () => void\n /** Portal target. Defaults to `document.body`. */\n container?: HTMLElement | null\n children?: ReactNode\n className?: string\n classNames?: DrawerClassNames\n }\n\nexport const Drawer = ({\n open,\n defaultOpen,\n onOpenChange,\n onClose,\n placement = \"end\",\n size = \"md\",\n title,\n description,\n withCloseButton = true,\n withGrabber = false,\n withBackdrop = true,\n padding = \"md\",\n closeOnEscape,\n closeOnInteractOutside,\n onExitComplete,\n container,\n children,\n className,\n classNames,\n testId,\n ...rest\n}: DrawerProps) => {\n const hasHeader = title != null || description != null || withCloseButton\n const sizeClass = isInline(placement)\n ? `${INLINE_SIZE[size]} h-full max-w-[90vw]`\n : `${BLOCK_SIZE[size]} w-full max-h-[90dvh]`\n\n return (\n <DrawerRoot\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={({ open: next }) => {\n onOpenChange?.(next)\n if (!next) onClose?.()\n }}\n swipeDirection={PLACEMENT_TO_SWIPE[placement]}\n closeOnEscape={closeOnEscape}\n closeOnInteractOutside={closeOnInteractOutside}\n // Unmount the whole content tree (incl. the `fixed inset-0` positioner)\n // on close — otherwise the positioner lingers as a transparent overlay\n // that swallows page clicks. `lazyMount` keeps it out of the DOM until\n // first open.\n lazyMount\n unmountOnExit\n modal={withBackdrop}\n onExitComplete={onExitComplete}\n {...rest}\n >\n <Portal container={container ? { current: container } : undefined}>\n {withBackdrop && <DrawerBackdrop className={classNames?.backdrop} />}\n <DrawerPositioner\n data-placement={placement}\n className={cn(drawerPositioner({ placement }), classNames?.positioner)}\n >\n <Ark.Content\n data-placement={placement}\n style={{ [\"--drawer-px\" as string]: PADDING[padding] }}\n className={cn(drawerContent(), sizeClass, className, classNames?.content)}\n {...props({ \"data-testid\": testId })}\n >\n {withGrabber && <DrawerGrabber className={classNames?.grabber} />}\n {hasHeader && (\n <DrawerHeader className={classNames?.header}>\n <div className=\"flex flex-col gap-1\">\n {title != null && (\n <DrawerTitle className={classNames?.title}>{title}</DrawerTitle>\n )}\n {description != null && (\n <DrawerDescription className={classNames?.description}>\n {description}\n </DrawerDescription>\n )}\n </div>\n {withCloseButton && <DrawerCloseTrigger className={classNames?.closeButton} />}\n </DrawerHeader>\n )}\n <DrawerBody\n className={cn(\n !hasHeader && !withGrabber && \"pt-(--drawer-px,1.25rem)\",\n \"pb-(--drawer-px,1.25rem)\",\n classNames?.body,\n )}\n >\n {children}\n </DrawerBody>\n </Ark.Content>\n </DrawerPositioner>\n </Portal>\n </DrawerRoot>\n )\n}\n\nDrawer.Root = DrawerRoot\nDrawer.Trigger = DrawerTrigger\nDrawer.Context = DrawerContext\nDrawer.Backdrop = DrawerBackdrop\nDrawer.Positioner = DrawerPositioner\nDrawer.Title = DrawerTitle\nDrawer.Description = DrawerDescription\nDrawer.CloseTrigger = DrawerCloseTrigger\nDrawer.Grabber = DrawerGrabber\nDrawer.Header = DrawerHeader\nDrawer.Body = DrawerBody\nDrawer.Footer = DrawerFooter\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/tooltip/tooltip.tsx"],"names":["ArkTooltip"],"mappings":";;;;;;;;;;;;;AAmDA,IAAM,cAAA,GAAiB,EAAA;AAAA,EACrB,oCAAA;AAAA,EACA,yCAAA;AAAA,EACA,oFAAA;AAAA,EACA,8EAAA;AAAA,EACA,yEAAA;AAAA,EACA;AACF,CAAA;AAWA,IAAM,iBAAA,GAAoB,sBAAA;AAK1B,IAAM,YAAA,GAAe,EAAA,CAAG,mBAAA,EAAqB,2CAA2C,CAAA;AAKxF,IAAM,cAAA,GAAiB,GAAA;AAAA,EACrB;AAAA,IACE,gEAAA;AAAA,IACA,6BAAA;AAAA,IACA,WAAA,EAAY;AAAA,IACZ;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,IAAA,EAAM,4FAAA;AAAA,QACN,MAAA,EAAQ;AAAA;AACV,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,OAAA,EAAS;AAAA;AACX;AAEJ,CAAA;AAYA,IAAM,cAAA,GAAiB,aAAA,CAAmC,EAAE,YAAA,EAAc,MAAM,CAAA;AAkBh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AAAA,MAACA,SAAA,CAAW,OAAA;AAAA,MAAX;AAAA,QACC,OAAA,EAAO,IAAA;AAAA,QACP,SAAA,EAAW,GAAG,cAAA,CAAe,EAAE,SAAS,CAAA,EAAG,YAAY,OAAO,CAAA;AAAA,QAG9D,8BAAC,MAAA,EAAA,EAAK,QAAA,EAAU,CAAA,EAAG,kBAAA,EAAkB,IAClC,QAAA,EACH;AAAA;AAAA,KAEH,CAAA;AAAA,yBACF,OAAA,EAAA,EAAQ,SAAA,EAAW,UAAA,EAAY,OAAA,EAAS,IAAQ,MAAA,EAC9C,QAAA,EAAA;AAAA,MAAA,SAAA,oBAAa,GAAA,CAAC,KAAA,EAAA,EAAM,SAAA,EAAW,UAAA,EAAY,KAAA,EAAO,CAAA;AAAA,MAClD;AAAA,KAAA,EACH;AAAA,GAAA,EACF,CAAA;AAEJ,CAAA;AAEO,IAAM,OAAA,GAAU,MAAA,CAAO,MAAA,CAAO,gBAAA,EAAkB;AAAA,EACrD,IAAA;AAAA,EACA,SAASA,SAAA,CAAW,OAAA;AAAA,EACpB,OAAA;AAAA,EACA;AACF,CAAC","file":"chunk-6SWK4XG5.js","sourcesContent":["\"use client\"\n\nimport { useLocaleContext } from \"@ark-ui/react/locale\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { Tooltip as ArkTooltip } from \"@ark-ui/react/tooltip\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { createContext, type ReactNode, useContext, useId } from \"react\"\nimport { match } from \"ts-pattern\"\nimport { cn } from \"../../lib/cn\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport { type LogicalPosition, resolveLogicalPlacement } from \"../../lib/placement\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\n\n/**\n * Tooltip — the kit's hover/focus **hint**, a styled layer over Ark UI's\n * Tooltip. It's the lightweight counterpart to `Popover` (which is a clickable,\n * focus-trapping panel): Ark's Tooltip machine opens on hover *and* keyboard\n * focus, wires `role=\"tooltip\"` + `aria-describedby` automatically, dismisses on\n * `Esc` / scroll / pointer-down, and never traps focus.\n *\n * Two ways to use it — the convenience form drops into running text or wraps any\n * element; the compound parts mirror `Popover.Root` / `Trigger` / `Content`.\n *\n * // 1. Inline — `children` become a focusable inline trigger\n * <Tooltip label=\"A project at 42.\">norm</Tooltip>\n *\n * // 2. Wrap an element — `asChild` makes the child the trigger\n * <Tooltip label=\"Delete\" asChild>\n * <ActionIcon aria-label=\"Delete\"><Trash /></ActionIcon>\n * </Tooltip>\n *\n * // 3. Compound\n * <Tooltip.Root position=\"end\">\n * <Tooltip.Trigger asChild><Button>Hover</Button></Tooltip.Trigger>\n * <Tooltip.Content>\n * <Tooltip.Arrow />\n * Rich <strong>content</strong>\n * </Tooltip.Content>\n * </Tooltip.Root>\n *\n * Visually it reuses the Popover's open/close animation but renders as a small,\n * **inverted** bubble (dark surface in light mode, light in dark) to read as an\n * ephemeral hint rather than a panel. Add `withArrow` (convenience form) or a\n * `Tooltip.Arrow` part (compound) to point the bubble at its trigger.\n */\n\n/** Inverted compact bubble — reuses the shared `popover-in/out` animation tokens\n * (which already honour reduced-motion in `theme.css`) and the placement-origin\n * trick so it grows out of the trigger's edge. */\nconst tooltipContent = cn(\n \"max-w-[16rem] rounded-xs px-2 py-1\",\n \"text-xs leading-snug focus:outline-none\",\n \"bg-gray-light-900 text-gray-light-25 dark:bg-gray-dark-100 dark:text-gray-dark-900\",\n \"data-[state=open]:animate-popover-in data-[state=closed]:animate-popover-out\",\n \"data-[placement^=top]:origin-bottom data-[placement^=bottom]:origin-top\",\n \"data-[placement^=left]:origin-right data-[placement^=right]:origin-left\",\n)\n\n/** The bubble's shadow lives on the *positioner* (this wrapper), not on the\n * content. A `box-shadow` on the content paints as one unit *with* its\n * background, so it lands on top of the behind-arrow (`-z-1`) and smears\n * across the protruding tip. Hosting the shadow here reorders the paint to\n * shadow → arrow → content: the positioner's shadow sits at the back of its\n * stacking context (it's the `isolate` root), the arrow paints above it, and\n * the content background paints last — so the shadow never touches the arrow,\n * the arrow never covers the label, and the bubble keeps its shadow.\n * `rounded-xs` matches the content radius so the shadow's corners line up. */\nconst tooltipPositioner = \"rounded-xs shadow-md\"\n\n/** Inverted arrow matching the bubble surface. The `!` overrides are required\n * because Ark sets the arrow background via an inline style; `-z-1` tucks the\n * square behind the bubble so only the rotated corner pokes out as the tip. */\nconst tooltipArrow = cn(\"-z-1! rounded-xxs\", \"bg-gray-light-900! dark:bg-gray-dark-100!\")\n\n/** Resets the `<button>` Ark renders for the default trigger down to plain inline\n * text, so a Tooltip can sit on a word inside a `<p>` while staying keyboard-\n * focusable. `cursor-help` signals the hint; `[font:inherit]` matches the prose. */\nconst tooltipTrigger = cva(\n [\n \"inline cursor-help appearance-none border-0 bg-transparent p-0\",\n \"[font:inherit] text-inherit\",\n focusStyles(),\n \"rounded-xs\",\n ],\n {\n variants: {\n variant: {\n text: \"underline decoration-dotted underline-offset-2 text-gray-light-900 dark:text-gray-dark-100\",\n inline: \"\",\n },\n },\n defaultVariants: {\n variant: \"inline\",\n },\n },\n)\n\ntype TooltipPlacement = NonNullable<NonNullable<ArkTooltip.RootProps[\"positioning\"]>[\"placement\"]>\n\n/** `position` accepts Ark's physical placements plus the logical, RTL-aware\n * horizontal sides `start` / `end` (resolved to `left` / `right` by direction). */\nexport type TooltipPosition = LogicalPosition<TooltipPlacement>\n\ntype TooltipContextValue = {\n withinPortal: boolean\n container?: HTMLElement | null\n}\nconst TooltipContext = createContext<TooltipContextValue>({ withinPortal: true })\n\nexport type TooltipRootProps = Omit<ArkTooltip.RootProps, \"positioning\"> & {\n /** Bubble placement relative to the trigger. Prefer the logical `start` / `end`\n * sides (RTL-aware), or use any Ark placement (`top`, `bottom`, `top-start`, …).\n * Defaults to `\"top\"`. */\n position?: TooltipPosition\n /** Gap in px between the trigger and the bubble. */\n offset?: number\n /** Render the bubble in a Portal so it escapes clipping ancestors. Default `true`. */\n withinPortal?: boolean\n /** Portal target. Defaults to the enclosing `Modal`/`Drawer` when there is\n * one (so the panel stays above it), else `document.body`. */\n container?: HTMLElement | null\n /** Fires on close (any source) — pointer/focus leaving the trigger, Escape, or a controlled `onOpenChange`. */\n onClose?: () => void\n}\n\nconst Root = ({\n position = \"top\",\n offset,\n withinPortal = true,\n container,\n children,\n onOpenChange,\n onClose,\n ...rest\n}: TooltipRootProps) => {\n const { dir } = useLocaleContext()\n return (\n <TooltipContext.Provider value={{ withinPortal, container }}>\n {/* Mount the bubble only while shown (lazyMount + unmountOnExit): closed →\n nothing rendered, so an inline trigger never emits a positioner <div>\n into a host <p> on SSR. Both are overridable via `...rest`. */}\n <ArkTooltip.Root\n lazyMount\n unmountOnExit\n positioning={{ placement: resolveLogicalPlacement(position, dir), gutter: offset }}\n onOpenChange={(details) => {\n onOpenChange?.(details)\n if (!details.open) onClose?.()\n }}\n {...rest}\n >\n {children}\n </ArkTooltip.Root>\n </TooltipContext.Provider>\n )\n}\n\nexport type TooltipContentProps = ArkTooltip.ContentProps & WithTestId\n\nconst Content = ({ className, children, testId, ...rest }: TooltipContentProps) => {\n const { withinPortal, container } = useContext(TooltipContext)\n const portalContainer = useOverlayContainer(container)\n const bubble = (\n <ArkTooltip.Positioner className={tooltipPositioner}>\n <ArkTooltip.Content\n className={cn(tooltipContent, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </ArkTooltip.Content>\n </ArkTooltip.Positioner>\n )\n if (!withinPortal) return bubble\n return <Portal container={portalContainer}>{bubble}</Portal>\n}\n\nexport type TooltipArrowProps = ArkTooltip.ArrowProps & WithTestId\n\n/** The little arrow linking the bubble to its trigger. Compose it inside a\n * `Tooltip.Content` (or let the convenience form's `withArrow` add it for you).\n * The CSS vars size the square (`--arrow-size`) and pull it back under the\n * bubble (`--arrow-offset`) so it reads as a pointer, not a detached diamond. */\nconst Arrow = ({ className, style, testId }: TooltipArrowProps) => (\n <ArkTooltip.Arrow\n style={{ [\"--arrow-size\" as string]: \"12px\", [\"--arrow-offset\" as string]: \"-8px\", ...style }}\n {...props({ \"data-testid\": testId })}\n >\n <ArkTooltip.ArrowTip className={cn(tooltipArrow, className)} />\n </ArkTooltip.Arrow>\n)\n\nexport type TooltipProps = TooltipRootProps &\n WithTestId & {\n /** The hint shown on hover and keyboard focus. Named `label` for parity with\n * the rest of the kit; wired as a description via Ark's `aria-describedby`. */\n label: ReactNode\n /** The trigger. By default it's wrapped in a focusable inline trigger (so it\n * drops into running text); with `asChild`, this element *is* the trigger. */\n children: ReactNode\n /** Render `children` as the trigger instead of wrapping them. */\n asChild?: boolean\n /** Add a small arrow pointing at the trigger. For the compound form, compose\n * `<Tooltip.Arrow />` inside `<Tooltip.Content>` instead. */\n withArrow?: boolean\n variant?: VariantProps<typeof tooltipTrigger>[\"variant\"]\n classNames?: { trigger?: string; content?: string; arrow?: string }\n }\n\n/** Convenience form: `Root` + `Trigger` + `Content` wired from `label`/`children`.\n * `testId` lands on `Content` (the rendered bubble) — `Root` has no DOM node\n * of its own. */\nconst TooltipComponent = ({\n label,\n children,\n asChild,\n classNames,\n withArrow,\n variant = \"inline\",\n testId,\n ...root\n}: TooltipProps) => {\n const id = `tooltip-${useId()}`\n\n return (\n <Root {...root}>\n {match({ asChild })\n .with({ asChild: true }, () => <ArkTooltip.Trigger asChild>{children}</ArkTooltip.Trigger>)\n .otherwise(() => (\n <ArkTooltip.Trigger\n asChild\n className={cn(tooltipTrigger({ variant }), classNames?.trigger)}\n >\n {/** biome-ignore lint/a11y/noNoninteractiveTabindex: This is for text inline display */}\n <span tabIndex={0} aria-describedby={id}>\n {children}\n </span>\n </ArkTooltip.Trigger>\n ))}\n <Content className={classNames?.content} id={id} testId={testId}>\n {withArrow && <Arrow className={classNames?.arrow} />}\n {label}\n </Content>\n </Root>\n )\n}\n\nexport const Tooltip = Object.assign(TooltipComponent, {\n Root,\n Trigger: ArkTooltip.Trigger,\n Content,\n Arrow,\n})\n"]}