@womp/kookie-ui 0.25.0 → 0.25.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 (339) hide show
  1. package/components.css +19 -3
  2. package/dist/cjs/components/_internal/base-button.d.ts.map +1 -1
  3. package/dist/cjs/components/_internal/base-button.js +1 -1
  4. package/dist/cjs/components/_internal/base-button.js.map +4 -4
  5. package/dist/cjs/components/_internal/shell-bottom.js +1 -1
  6. package/dist/cjs/components/_internal/shell-bottom.js.map +3 -3
  7. package/dist/cjs/components/_internal/shell-inspector.d.ts.map +1 -1
  8. package/dist/cjs/components/_internal/shell-inspector.js +1 -1
  9. package/dist/cjs/components/_internal/shell-inspector.js.map +3 -3
  10. package/dist/cjs/components/_internal/shell-resizable.d.ts +6 -0
  11. package/dist/cjs/components/_internal/shell-resizable.d.ts.map +1 -1
  12. package/dist/cjs/components/_internal/shell-resizable.js +1 -1
  13. package/dist/cjs/components/_internal/shell-resizable.js.map +3 -3
  14. package/dist/cjs/components/_internal/shell-sidebar.d.ts.map +1 -1
  15. package/dist/cjs/components/_internal/shell-sidebar.js +1 -1
  16. package/dist/cjs/components/_internal/shell-sidebar.js.map +3 -3
  17. package/dist/cjs/components/accordion.js +1 -1
  18. package/dist/cjs/components/accordion.js.map +4 -4
  19. package/dist/cjs/components/alert-dialog.js +1 -1
  20. package/dist/cjs/components/alert-dialog.js.map +4 -4
  21. package/dist/cjs/components/avatar.js +1 -1
  22. package/dist/cjs/components/avatar.js.map +4 -4
  23. package/dist/cjs/components/button.js +1 -1
  24. package/dist/cjs/components/button.js.map +4 -4
  25. package/dist/cjs/components/card.js +1 -1
  26. package/dist/cjs/components/card.js.map +4 -4
  27. package/dist/cjs/components/chatbar.js +1 -1
  28. package/dist/cjs/components/chatbar.js.map +4 -4
  29. package/dist/cjs/components/checkbox-group.js +1 -1
  30. package/dist/cjs/components/checkbox-group.js.map +4 -4
  31. package/dist/cjs/components/checkbox.js +1 -1
  32. package/dist/cjs/components/checkbox.js.map +4 -4
  33. package/dist/cjs/components/chip.js +1 -1
  34. package/dist/cjs/components/chip.js.map +4 -4
  35. package/dist/cjs/components/combobox.js +1 -1
  36. package/dist/cjs/components/combobox.js.map +4 -4
  37. package/dist/cjs/components/context-menu.js +1 -1
  38. package/dist/cjs/components/context-menu.js.map +4 -4
  39. package/dist/cjs/components/dialog.js +1 -1
  40. package/dist/cjs/components/dialog.js.map +4 -4
  41. package/dist/cjs/components/dropdown-menu.js +1 -1
  42. package/dist/cjs/components/dropdown-menu.js.map +4 -4
  43. package/dist/cjs/components/index.js +2 -2
  44. package/dist/cjs/components/index.js.map +4 -4
  45. package/dist/cjs/components/message-scroller.js +1 -1
  46. package/dist/cjs/components/message-scroller.js.map +4 -4
  47. package/dist/cjs/components/navbar.js +1 -1
  48. package/dist/cjs/components/navbar.js.map +4 -4
  49. package/dist/cjs/components/notice.js +1 -1
  50. package/dist/cjs/components/notice.js.map +4 -4
  51. package/dist/cjs/components/popover.js +1 -1
  52. package/dist/cjs/components/popover.js.map +4 -4
  53. package/dist/cjs/components/radio-group.js +1 -1
  54. package/dist/cjs/components/radio-group.js.map +4 -4
  55. package/dist/cjs/components/radio.js +1 -1
  56. package/dist/cjs/components/radio.js.map +4 -4
  57. package/dist/cjs/components/segmented-control.js +1 -1
  58. package/dist/cjs/components/segmented-control.js.map +4 -4
  59. package/dist/cjs/components/select.js +1 -1
  60. package/dist/cjs/components/select.js.map +4 -4
  61. package/dist/cjs/components/sheet.js +1 -1
  62. package/dist/cjs/components/sheet.js.map +4 -4
  63. package/dist/cjs/components/shell.js +1 -1
  64. package/dist/cjs/components/shell.js.map +4 -4
  65. package/dist/cjs/components/sidebar.d.ts.map +1 -1
  66. package/dist/cjs/components/sidebar.js +1 -1
  67. package/dist/cjs/components/sidebar.js.map +4 -4
  68. package/dist/cjs/components/slider.js +1 -1
  69. package/dist/cjs/components/slider.js.map +4 -4
  70. package/dist/cjs/components/switch.js +1 -1
  71. package/dist/cjs/components/switch.js.map +4 -4
  72. package/dist/cjs/components/table.js +1 -1
  73. package/dist/cjs/components/table.js.map +4 -4
  74. package/dist/cjs/components/tabs.js +1 -1
  75. package/dist/cjs/components/tabs.js.map +4 -4
  76. package/dist/cjs/components/text-area.js +1 -1
  77. package/dist/cjs/components/text-area.js.map +4 -4
  78. package/dist/cjs/components/text-field.js +2 -2
  79. package/dist/cjs/components/text-field.js.map +4 -4
  80. package/dist/cjs/components/theme.js +1 -1
  81. package/dist/cjs/components/theme.js.map +4 -4
  82. package/dist/cjs/components/toggle.js +1 -1
  83. package/dist/cjs/components/toggle.js.map +4 -4
  84. package/dist/cjs/components/toolbar.d.ts.map +1 -1
  85. package/dist/cjs/components/toolbar.js +1 -1
  86. package/dist/cjs/components/toolbar.js.map +4 -4
  87. package/dist/cjs/components/tooltip.js +1 -1
  88. package/dist/cjs/components/tooltip.js.map +4 -4
  89. package/dist/cjs/helpers/index.d.ts +1 -0
  90. package/dist/cjs/helpers/index.d.ts.map +1 -1
  91. package/dist/cjs/helpers/index.js +4 -4
  92. package/dist/cjs/helpers/index.js.map +3 -3
  93. package/dist/cjs/helpers/theme-size.d.ts +8 -30
  94. package/dist/cjs/helpers/theme-size.d.ts.map +1 -1
  95. package/dist/cjs/helpers/theme-size.js +1 -1
  96. package/dist/cjs/helpers/theme-size.js.map +3 -3
  97. package/dist/cjs/hooks/theme-size.d.ts +32 -0
  98. package/dist/cjs/hooks/theme-size.d.ts.map +1 -0
  99. package/dist/cjs/hooks/theme-size.js +3 -0
  100. package/dist/cjs/hooks/theme-size.js.map +7 -0
  101. package/dist/cjs/index.js +4 -4
  102. package/dist/cjs/index.js.map +4 -4
  103. package/dist/cjs/props/index.js +1 -1
  104. package/dist/cjs/props/index.js.map +4 -4
  105. package/dist/esm/chunk-3B25RLWX.js +3 -0
  106. package/dist/esm/chunk-3B25RLWX.js.map +7 -0
  107. package/dist/esm/{chunk-PF67GJ5D.js → chunk-3CY6H4TE.js} +2 -2
  108. package/dist/esm/chunk-3CY6H4TE.js.map +7 -0
  109. package/dist/esm/{chunk-2EXOL2BR.js → chunk-3L2MDOYC.js} +2 -2
  110. package/dist/esm/chunk-3L2MDOYC.js.map +7 -0
  111. package/dist/esm/{chunk-KNBSG2WA.js → chunk-5CFSNNYS.js} +2 -2
  112. package/dist/esm/chunk-5CFSNNYS.js.map +7 -0
  113. package/dist/esm/{chunk-4ABQ6CDI.js → chunk-5EBJOOXE.js} +2 -2
  114. package/dist/esm/chunk-5EBJOOXE.js.map +7 -0
  115. package/dist/esm/{chunk-E4EMG3RC.js → chunk-5L4DZ2D3.js} +2 -2
  116. package/dist/esm/chunk-5L4DZ2D3.js.map +7 -0
  117. package/dist/esm/chunk-5ON3XLRD.js +3 -0
  118. package/dist/esm/chunk-5ON3XLRD.js.map +7 -0
  119. package/dist/esm/{chunk-UZAS4PYM.js → chunk-5TJH35TF.js} +2 -2
  120. package/dist/esm/{chunk-GPQSC6GL.js → chunk-5XR5PTDR.js} +2 -2
  121. package/dist/esm/chunk-5XR5PTDR.js.map +7 -0
  122. package/dist/esm/{chunk-AOBY2OUZ.js → chunk-63MUJFVF.js} +2 -2
  123. package/dist/esm/chunk-63MUJFVF.js.map +7 -0
  124. package/dist/esm/chunk-6AUIIXXE.js +2 -0
  125. package/dist/esm/chunk-6AUIIXXE.js.map +7 -0
  126. package/dist/esm/{chunk-4Q5PUIDJ.js → chunk-6RJQ5LLP.js} +2 -2
  127. package/dist/esm/{chunk-YVZTQA2L.js → chunk-7B3XDZXZ.js} +2 -2
  128. package/dist/esm/chunk-7B3XDZXZ.js.map +7 -0
  129. package/dist/esm/{chunk-7IHBNDCE.js → chunk-7X7VWR3F.js} +2 -2
  130. package/dist/esm/chunk-7X7VWR3F.js.map +7 -0
  131. package/dist/esm/{chunk-45O3JZWQ.js → chunk-7XHE6TOA.js} +2 -2
  132. package/dist/esm/chunk-7XHE6TOA.js.map +7 -0
  133. package/dist/esm/chunk-AQ7VUGQQ.js +3 -0
  134. package/dist/esm/chunk-AQ7VUGQQ.js.map +7 -0
  135. package/dist/esm/{chunk-54HUG34P.js → chunk-BVFHJP5E.js} +2 -2
  136. package/dist/esm/chunk-BVFHJP5E.js.map +7 -0
  137. package/dist/esm/{chunk-CRCYUJMK.js → chunk-BXZSJKWA.js} +2 -2
  138. package/dist/esm/chunk-BXZSJKWA.js.map +7 -0
  139. package/dist/esm/{chunk-IQ2RMFOM.js → chunk-CQG4U5BR.js} +2 -2
  140. package/dist/esm/{chunk-YNCI5PY6.js → chunk-FPGBCCML.js} +2 -2
  141. package/dist/esm/chunk-FPGBCCML.js.map +7 -0
  142. package/dist/esm/{chunk-A7QRPXXB.js → chunk-HHSFAOIO.js} +2 -2
  143. package/dist/esm/chunk-HHSFAOIO.js.map +7 -0
  144. package/dist/esm/{chunk-NMQGDBLD.js → chunk-MQEWEAH5.js} +2 -2
  145. package/dist/esm/chunk-MQEWEAH5.js.map +7 -0
  146. package/dist/esm/{chunk-YIKLO2XL.js → chunk-N3QLHFHB.js} +2 -2
  147. package/dist/esm/chunk-N3QLHFHB.js.map +7 -0
  148. package/dist/esm/{chunk-LCG3JZ3C.js → chunk-N5H7C3PZ.js} +2 -2
  149. package/dist/esm/chunk-N5H7C3PZ.js.map +7 -0
  150. package/dist/esm/{chunk-N53NJCEM.js → chunk-OQWD63AI.js} +2 -2
  151. package/dist/esm/chunk-OQWD63AI.js.map +7 -0
  152. package/dist/esm/chunk-PCLO3ZZY.js +3 -0
  153. package/dist/esm/chunk-PCLO3ZZY.js.map +7 -0
  154. package/dist/esm/{chunk-2XZ7477Y.js → chunk-PZZJH2LR.js} +2 -2
  155. package/dist/esm/chunk-PZZJH2LR.js.map +7 -0
  156. package/dist/esm/chunk-QKCNGEX4.js +3 -0
  157. package/dist/esm/chunk-QKCNGEX4.js.map +7 -0
  158. package/dist/esm/{chunk-PPQ7URZL.js → chunk-R4PGFURL.js} +2 -2
  159. package/dist/esm/{chunk-UUQGOQ5H.js → chunk-RB5VHWAW.js} +2 -2
  160. package/dist/esm/chunk-RB5VHWAW.js.map +7 -0
  161. package/dist/esm/{chunk-AG2YETE6.js → chunk-VPRAXHLL.js} +2 -2
  162. package/dist/esm/chunk-VPRAXHLL.js.map +7 -0
  163. package/dist/esm/{chunk-7J7RPEPB.js → chunk-VRQEWMC6.js} +2 -2
  164. package/dist/esm/chunk-VRQEWMC6.js.map +7 -0
  165. package/dist/esm/{chunk-UFJGZUKK.js → chunk-W4MQ6TEK.js} +2 -2
  166. package/dist/esm/chunk-W4MQ6TEK.js.map +7 -0
  167. package/dist/esm/{chunk-3223MHQK.js → chunk-WJ4H2O2G.js} +2 -2
  168. package/dist/esm/chunk-WMODMXEU.js +3 -0
  169. package/dist/esm/chunk-WMODMXEU.js.map +7 -0
  170. package/dist/esm/{chunk-JZVLP2VF.js → chunk-XPVRXQSW.js} +2 -2
  171. package/dist/esm/chunk-XPVRXQSW.js.map +7 -0
  172. package/dist/esm/{chunk-BUZGRMDD.js → chunk-Y2BTPKK6.js} +2 -2
  173. package/dist/esm/chunk-YOSCUA6Z.js +3 -0
  174. package/dist/esm/chunk-YOSCUA6Z.js.map +7 -0
  175. package/dist/esm/{chunk-X272YV2E.js → chunk-Z563IAE3.js} +2 -2
  176. package/dist/esm/chunk-Z563IAE3.js.map +7 -0
  177. package/dist/esm/{chunk-GZ333J7L.js → chunk-ZDSY6CJL.js} +2 -2
  178. package/dist/esm/chunk-ZDSY6CJL.js.map +7 -0
  179. package/dist/esm/{chunk-ENAW44VE.js → chunk-ZYKJTNAT.js} +2 -2
  180. package/dist/esm/chunk-ZYKJTNAT.js.map +7 -0
  181. package/dist/esm/components/_internal/base-button.d.ts.map +1 -1
  182. package/dist/esm/components/_internal/base-button.js +1 -1
  183. package/dist/esm/components/_internal/shell-bottom.js +1 -1
  184. package/dist/esm/components/_internal/shell-inspector.d.ts.map +1 -1
  185. package/dist/esm/components/_internal/shell-inspector.js +1 -1
  186. package/dist/esm/components/_internal/shell-resizable.d.ts +6 -0
  187. package/dist/esm/components/_internal/shell-resizable.d.ts.map +1 -1
  188. package/dist/esm/components/_internal/shell-resizable.js +1 -1
  189. package/dist/esm/components/_internal/shell-sidebar.d.ts.map +1 -1
  190. package/dist/esm/components/_internal/shell-sidebar.js +1 -1
  191. package/dist/esm/components/accordion.js +1 -1
  192. package/dist/esm/components/alert-dialog.js +1 -1
  193. package/dist/esm/components/avatar.js +1 -1
  194. package/dist/esm/components/button.js +1 -1
  195. package/dist/esm/components/card.js +1 -1
  196. package/dist/esm/components/chatbar.js +1 -1
  197. package/dist/esm/components/checkbox-group.js +1 -1
  198. package/dist/esm/components/checkbox.js +1 -1
  199. package/dist/esm/components/chip.js +1 -1
  200. package/dist/esm/components/combobox.js +1 -1
  201. package/dist/esm/components/context-menu.js +1 -1
  202. package/dist/esm/components/dialog.js +1 -1
  203. package/dist/esm/components/dropdown-menu.js +1 -1
  204. package/dist/esm/components/index.js +1 -1
  205. package/dist/esm/components/message-scroller.js +1 -1
  206. package/dist/esm/components/navbar.js +1 -1
  207. package/dist/esm/components/notice.js +1 -1
  208. package/dist/esm/components/popover.js +1 -1
  209. package/dist/esm/components/radio-group.js +1 -1
  210. package/dist/esm/components/radio.js +1 -1
  211. package/dist/esm/components/segmented-control.js +1 -1
  212. package/dist/esm/components/select.js +1 -1
  213. package/dist/esm/components/sheet.js +1 -1
  214. package/dist/esm/components/shell.js +1 -1
  215. package/dist/esm/components/sidebar.d.ts.map +1 -1
  216. package/dist/esm/components/sidebar.js +1 -1
  217. package/dist/esm/components/slider.js +1 -1
  218. package/dist/esm/components/switch.js +1 -1
  219. package/dist/esm/components/table.js +1 -1
  220. package/dist/esm/components/tabs.js +1 -1
  221. package/dist/esm/components/text-area.js +1 -1
  222. package/dist/esm/components/text-field.js +1 -1
  223. package/dist/esm/components/theme.js +1 -1
  224. package/dist/esm/components/toggle.js +1 -1
  225. package/dist/esm/components/toolbar.d.ts.map +1 -1
  226. package/dist/esm/components/toolbar.js +1 -1
  227. package/dist/esm/components/tooltip.js +1 -1
  228. package/dist/esm/helpers/index.d.ts +1 -0
  229. package/dist/esm/helpers/index.d.ts.map +1 -1
  230. package/dist/esm/helpers/index.js +1 -1
  231. package/dist/esm/helpers/index.js.map +4 -4
  232. package/dist/esm/helpers/theme-size.d.ts +8 -30
  233. package/dist/esm/helpers/theme-size.d.ts.map +1 -1
  234. package/dist/esm/helpers/theme-size.js +1 -1
  235. package/dist/esm/hooks/theme-size.d.ts +32 -0
  236. package/dist/esm/hooks/theme-size.d.ts.map +1 -0
  237. package/dist/esm/hooks/theme-size.js +3 -0
  238. package/dist/esm/hooks/theme-size.js.map +7 -0
  239. package/dist/esm/index.js +1 -1
  240. package/dist/esm/props/font-family.prop.js +1 -1
  241. package/dist/esm/props/font-family.prop.js.map +4 -4
  242. package/dist/esm/props/index.js +1 -1
  243. package/dist/esm/props/index.js.map +4 -4
  244. package/package.json +1 -1
  245. package/src/components/_internal/base-button.tsx +56 -42
  246. package/src/components/_internal/shell-inspector.tsx +3 -1
  247. package/src/components/_internal/shell-resizable.tsx +13 -0
  248. package/src/components/_internal/shell-sidebar.tsx +3 -1
  249. package/src/components/accordion.tsx +1 -1
  250. package/src/components/alert-dialog.tsx +1 -1
  251. package/src/components/avatar.tsx +1 -1
  252. package/src/components/card.tsx +1 -1
  253. package/src/components/chatbar.tsx +1 -1
  254. package/src/components/checkbox-group.tsx +1 -1
  255. package/src/components/checkbox.tsx +1 -1
  256. package/src/components/combobox.tsx +1 -1
  257. package/src/components/context-menu.tsx +1 -1
  258. package/src/components/dialog.tsx +1 -1
  259. package/src/components/dropdown-menu.tsx +1 -1
  260. package/src/components/navbar.tsx +1 -1
  261. package/src/components/notice.tsx +1 -1
  262. package/src/components/popover.css +4 -2
  263. package/src/components/popover.tsx +1 -1
  264. package/src/components/radio-group.tsx +1 -1
  265. package/src/components/radio.tsx +1 -1
  266. package/src/components/segmented-control.tsx +1 -1
  267. package/src/components/select.tsx +1 -1
  268. package/src/components/sheet.css +4 -2
  269. package/src/components/sheet.tsx +1 -1
  270. package/src/components/shell.css +7 -2
  271. package/src/components/shell.tsx +1 -1
  272. package/src/components/sidebar.css +10 -0
  273. package/src/components/sidebar.tsx +16 -1
  274. package/src/components/slider.tsx +1 -1
  275. package/src/components/switch.tsx +1 -1
  276. package/src/components/table.tsx +1 -1
  277. package/src/components/tabs.tsx +1 -1
  278. package/src/components/text-area.tsx +1 -1
  279. package/src/components/text-field.tsx +1 -1
  280. package/src/components/theme.tsx +1 -1
  281. package/src/components/toolbar.tsx +17 -8
  282. package/src/helpers/index.ts +3 -0
  283. package/src/helpers/theme-size.ts +8 -46
  284. package/src/hooks/theme-size.ts +50 -0
  285. package/src/styles/tokens/color.css +3 -0
  286. package/styles.css +21 -3
  287. package/tokens/base.css +2 -0
  288. package/tokens.css +2 -0
  289. package/dist/esm/chunk-2EXOL2BR.js.map +0 -7
  290. package/dist/esm/chunk-2IUGM657.js +0 -3
  291. package/dist/esm/chunk-2IUGM657.js.map +0 -7
  292. package/dist/esm/chunk-2XZ7477Y.js.map +0 -7
  293. package/dist/esm/chunk-3WZLXGUE.js +0 -3
  294. package/dist/esm/chunk-3WZLXGUE.js.map +0 -7
  295. package/dist/esm/chunk-3YLYGKFB.js +0 -2
  296. package/dist/esm/chunk-3YLYGKFB.js.map +0 -7
  297. package/dist/esm/chunk-45O3JZWQ.js.map +0 -7
  298. package/dist/esm/chunk-4ABQ6CDI.js.map +0 -7
  299. package/dist/esm/chunk-54HUG34P.js.map +0 -7
  300. package/dist/esm/chunk-7IHBNDCE.js.map +0 -7
  301. package/dist/esm/chunk-7J7RPEPB.js.map +0 -7
  302. package/dist/esm/chunk-A7QRPXXB.js.map +0 -7
  303. package/dist/esm/chunk-AG2YETE6.js.map +0 -7
  304. package/dist/esm/chunk-AOBY2OUZ.js.map +0 -7
  305. package/dist/esm/chunk-CRCYUJMK.js.map +0 -7
  306. package/dist/esm/chunk-DI7RUMLO.js +0 -3
  307. package/dist/esm/chunk-DI7RUMLO.js.map +0 -7
  308. package/dist/esm/chunk-E4EMG3RC.js.map +0 -7
  309. package/dist/esm/chunk-ENAW44VE.js.map +0 -7
  310. package/dist/esm/chunk-EVCQ6TG5.js +0 -3
  311. package/dist/esm/chunk-EVCQ6TG5.js.map +0 -7
  312. package/dist/esm/chunk-G32GSPNO.js +0 -3
  313. package/dist/esm/chunk-G32GSPNO.js.map +0 -7
  314. package/dist/esm/chunk-GPQSC6GL.js.map +0 -7
  315. package/dist/esm/chunk-GZ333J7L.js.map +0 -7
  316. package/dist/esm/chunk-JIF77MRB.js +0 -3
  317. package/dist/esm/chunk-JIF77MRB.js.map +0 -7
  318. package/dist/esm/chunk-JZVLP2VF.js.map +0 -7
  319. package/dist/esm/chunk-KNBSG2WA.js.map +0 -7
  320. package/dist/esm/chunk-LB2HB4NG.js +0 -3
  321. package/dist/esm/chunk-LB2HB4NG.js.map +0 -7
  322. package/dist/esm/chunk-LCG3JZ3C.js.map +0 -7
  323. package/dist/esm/chunk-N53NJCEM.js.map +0 -7
  324. package/dist/esm/chunk-NMQGDBLD.js.map +0 -7
  325. package/dist/esm/chunk-PF67GJ5D.js.map +0 -7
  326. package/dist/esm/chunk-UFJGZUKK.js.map +0 -7
  327. package/dist/esm/chunk-UUQGOQ5H.js.map +0 -7
  328. package/dist/esm/chunk-VCV7RACK.js +0 -2
  329. package/dist/esm/chunk-VCV7RACK.js.map +0 -7
  330. package/dist/esm/chunk-X272YV2E.js.map +0 -7
  331. package/dist/esm/chunk-YIKLO2XL.js.map +0 -7
  332. package/dist/esm/chunk-YNCI5PY6.js.map +0 -7
  333. package/dist/esm/chunk-YVZTQA2L.js.map +0 -7
  334. /package/dist/esm/{chunk-UZAS4PYM.js.map → chunk-5TJH35TF.js.map} +0 -0
  335. /package/dist/esm/{chunk-4Q5PUIDJ.js.map → chunk-6RJQ5LLP.js.map} +0 -0
  336. /package/dist/esm/{chunk-IQ2RMFOM.js.map → chunk-CQG4U5BR.js.map} +0 -0
  337. /package/dist/esm/{chunk-PPQ7URZL.js.map → chunk-R4PGFURL.js.map} +0 -0
  338. /package/dist/esm/{chunk-3223MHQK.js.map → chunk-WJ4H2O2G.js.map} +0 -0
  339. /package/dist/esm/{chunk-BUZGRMDD.js.map → chunk-Y2BTPKK6.js.map} +0 -0
@@ -1,3 +0,0 @@
1
- "use client";
2
- import*as t from"react";import{useLayoutEffect as h}from"radix-ui/internal";function q(e,s="horizontal"){if(e==null)return;if(typeof e=="number"&&Number.isFinite(e))return e;let i=String(e).trim();if(!i)return;if(i.endsWith("px"))return Number.parseFloat(i);if(i.endsWith("rem")){let l=Number.parseFloat(getComputedStyle(document.documentElement).fontSize||"16")||16;return Number.parseFloat(i)*l}if(i.endsWith("%")){let l=Number.parseFloat(i),a=s==="horizontal"?document.documentElement.clientWidth||window.innerWidth||0:document.documentElement.clientHeight||window.innerHeight||0;return l/100*a}let c=Number.parseFloat(i);return Number.isFinite(c)?c:void 0}var N=(e,s,i)=>Math.max(s??e,Math.min(i??e,e));function D(e){let{name:s,elementRef:i,cssVarName:c,orientation:l,minSize:a,maxSize:f,resizable:x,size:g,defaultSize:C,paneId:S,persistence:I}=e,o=t.useRef(e);h(()=>{o.current=e});let b=t.useRef(null),P=t.useRef(0);t.useEffect(()=>()=>{b.current&&clearTimeout(b.current)},[]);let p=t.useCallback((n,r)=>{let{onSizeChange:u,sizeUpdate:d,sizeUpdateMs:R}=o.current;if(u){if(d==="debounce"){b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{b.current=null,o.current.onSizeChange?.(n,r)},R);return}if(d==="throttle"){let V=Date.now();if(V-P.current<R)return;P.current=V}u(n,r)}},[]),y=t.useCallback(n=>q(n,l==="vertical"?"horizontal":"vertical"),[l]),w=t.useRef(!1),m=t.useCallback((n,r)=>{let u=i.current;if(u){u.style.setProperty(c,`${n}px`);for(let d of u.querySelectorAll(":scope > .kui-ShellResizer"))d.setAttribute("aria-valuenow",String(Math.round(n)));r&&(w.current=!0)}},[i,c]);h(()=>{w.current||m(e.expandedSize,!1)},[e.expandedSize,m]),h(()=>{if(g!==void 0||C===void 0)return;let n=y(C);if(typeof n!="number"||!Number.isFinite(n))return;let r=N(n,a,f);m(r,!0),p(r,{reason:"init"})},[]),h(()=>{if(g===void 0||o.current.overlayingNow())return;let n=y(g);if(typeof n!="number"||!Number.isFinite(n))return;let r=N(n,a,f);m(r,!0),p(r,{reason:"controlled"})},[g,a,f,e.overlaying,y,m,p]);let T=I!==void 0,z=t.useMemo(()=>{if(T)return{load:()=>o.current.persistence?.load?.(),save:r=>o.current.persistence?.save?.(r)};if(!S)return;let n=`kookie-ui:shell:${s}:${S}`;return{load:()=>{if(!(typeof window>"u"))try{let r=window.localStorage.getItem(n);return r?Number(r):void 0}catch{return}},save:r=>{if(!(typeof window>"u"))try{window.localStorage.setItem(n,String(r))}catch{}}}},[s,S,T]);h(()=>{if(!x||!z?.load||o.current.overlayingNow())return;let n=!0,r=d=>{if(!n||typeof d!="number"||!Number.isFinite(d))return;let R=N(d,a,f);m(R,!0),o.current.onResize?.(R)},u=z.load();return u instanceof Promise?u.then(r).catch(d=>{}):r(u),()=>{n=!1}},[x,z,e.overlaying,m,a,f,s]);let E=t.useCallback(n=>o.current.onResize?.(n),[]),v=t.useCallback(n=>{w.current=!0,o.current.onResizeStart?.(n)},[]),k=t.useCallback(n=>{o.current.onResizeEnd?.(n),p(n,{reason:"resize"}),z?.save?.(n)},[p,z]),M=t.useCallback(()=>o.current.requestCollapse(),[]),F=t.useCallback(()=>o.current.requestToggle(),[]);return t.useMemo(()=>({containerRef:i,controls:e.elementId,cssVarName:c,minSize:a,maxSize:f,defaultSize:e.expandedSize,orientation:l,edge:e.edge,growth:e.growth,onResize:E,onResizeStart:v,onResizeEnd:k,target:s,collapsible:e.collapsible,snapPoints:e.snapPoints,snapTolerance:e.snapTolerance??8,collapseThreshold:e.collapseThreshold,requestCollapse:M,requestToggle:F}),[i,e.elementId,c,a,f,e.expandedSize,l,e.edge,e.growth,E,v,k,s,e.collapsible,e.snapPoints,e.snapTolerance,e.collapseThreshold,M,F])}function H(e,s){let i=t.Children.toArray(e),c=i.filter(a=>t.isValidElement(a)&&a.type===s),l=i.filter(a=>!(t.isValidElement(a)&&a.type===s));return{handles:c,content:l}}export{D as a,H as b};
3
- //# sourceMappingURL=chunk-DI7RUMLO.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/components/_internal/shell-resizable.tsx", "../../src/helpers/normalize-to-px.ts"],
4
- "sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport { useLayoutEffect } from 'radix-ui/internal';\nimport { normalizeToPx } from '../../helpers/normalize-to-px.js';\nimport type { PaneName, PaneSizePersistence } from '../shell.types.js';\nimport type { PaneResizeContextValue } from './shell-resize.js';\n\nexport type SizeChangeMeta = { reason: 'init' | 'resize' | 'controlled' };\n\nexport type ResizableOptions = {\n name: PaneName;\n /** The pane's element id, which the handle names in `aria-controls`. */\n elementId: string;\n elementRef: React.RefObject<HTMLElement | null>;\n cssVarName: string;\n orientation: 'vertical' | 'horizontal';\n edge: 'start' | 'end';\n growth: (isRtl: boolean) => 1 | -1;\n expandedSize: number;\n minSize: number;\n maxSize: number;\n resizable: boolean;\n collapsible: boolean;\n size: number | string | undefined;\n defaultSize: number | string | undefined;\n onSizeChange: ((size: number, meta: SizeChangeMeta) => void) | undefined;\n sizeUpdate: 'throttle' | 'debounce' | undefined;\n sizeUpdateMs: number;\n onResize: ((size: number) => void) | undefined;\n onResizeStart: ((size: number) => void) | undefined;\n onResizeEnd: ((size: number) => void) | undefined;\n snapPoints: number[] | undefined;\n snapTolerance: number | undefined;\n collapseThreshold: number | undefined;\n paneId: string | undefined;\n persistence: PaneSizePersistence | undefined;\n /** Whether the pane is presented as an overlay right now. An overlay keeps its designed size and persists nothing. */\n overlaying: boolean;\n /** The same question asked at effect time, for a pane whose presentation is learnt after its first render. */\n overlayingNow: () => boolean;\n requestCollapse: () => void;\n requestToggle: () => void;\n};\n\n/**\n * Clamps to [min, max]. When the two cross (an app passing a maximum computed\n * from a narrow window below its fixed minimum), the minimum wins, as it did\n * in 0.7.\n */\nconst clampTo = (value: number, min: number | undefined, max: number | undefined) => Math.max(min ?? value, Math.min(max ?? value, value));\n\n/** Everything a resizable pane shares: size props, persistence, and the handle's context. */\nexport function useResizablePane(options: ResizableOptions): PaneResizeContextValue {\n const { name, elementRef, cssVarName, orientation, minSize, maxSize, resizable, size, defaultSize, paneId, persistence } = options;\n\n // The latest callbacks, so the size emitter does not change identity when a\n // consumer passes an inline function. A controlled `size` is reported again\n // only when the size, the minimum or the maximum changes.\n const latest = React.useRef(options);\n useLayoutEffect(() => {\n latest.current = options;\n });\n\n const debounceRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n const throttleRef = React.useRef(0);\n React.useEffect(\n () => () => {\n if (debounceRef.current) clearTimeout(debounceRef.current);\n },\n [],\n );\n const emitSizeChange = React.useCallback((value: number, meta: SizeChangeMeta) => {\n const { onSizeChange, sizeUpdate, sizeUpdateMs } = latest.current;\n if (!onSizeChange) return;\n if (sizeUpdate === 'debounce') {\n if (debounceRef.current) clearTimeout(debounceRef.current);\n debounceRef.current = setTimeout(() => {\n debounceRef.current = null;\n latest.current.onSizeChange?.(value, meta);\n }, sizeUpdateMs);\n return;\n }\n if (sizeUpdate === 'throttle') {\n const now = Date.now();\n if (now - throttleRef.current < sizeUpdateMs) return;\n throttleRef.current = now;\n }\n onSizeChange(value, meta);\n }, []);\n\n const toPx = React.useCallback((value: number | string | undefined) => normalizeToPx(value, orientation === 'vertical' ? 'horizontal' : 'vertical'), [orientation]);\n\n /**\n * The one way a size reaches the pane: the size variable, and the value\n * every handle of this pane announces. Once anything but `expandedSize` has\n * written a size (a default, a controlled value, a persisted value or a\n * resize), the pane owns that size and a new `expandedSize` leaves it alone.\n */\n const ownedRef = React.useRef(false);\n const writeSize = React.useCallback(\n (value: number, own: boolean) => {\n const el = elementRef.current;\n if (!el) return;\n el.style.setProperty(cssVarName, `${value}px`);\n for (const handle of el.querySelectorAll(':scope > .kui-ShellResizer')) handle.setAttribute('aria-valuenow', String(Math.round(value)));\n if (own) ownedRef.current = true;\n },\n [elementRef, cssVarName],\n );\n\n // expandedSize: the size until something else sets one. Declared first, so\n // the effects below win on mount.\n useLayoutEffect(() => {\n if (!ownedRef.current) writeSize(options.expandedSize, false);\n }, [options.expandedSize, writeSize]);\n\n // defaultSize: applied once, on mount.\n useLayoutEffect(() => {\n if (size !== undefined || defaultSize === undefined) return;\n const px = toPx(defaultSize);\n if (typeof px !== 'number' || !Number.isFinite(px)) return;\n const clamped = clampTo(px, minSize, maxSize);\n writeSize(clamped, true);\n emitSizeChange(clamped, { reason: 'init' });\n // An uncontrolled initial value: applied on mount and never re-applied.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Controlled size. A drag stands until the app passes a different value.\n // Not while the pane is an overlay: an overlay keeps its designed size, and\n // an app's frame-sized limits (a maximum taken from the window) would\n // otherwise squeeze the drawer and report the squeezed size back. The size\n // is applied again when the pane returns to the frame.\n useLayoutEffect(() => {\n if (size === undefined || latest.current.overlayingNow()) return;\n const px = toPx(size);\n if (typeof px !== 'number' || !Number.isFinite(px)) return;\n const clamped = clampTo(px, minSize, maxSize);\n writeSize(clamped, true);\n emitSizeChange(clamped, { reason: 'controlled' });\n }, [size, minSize, maxSize, options.overlaying, toPx, writeSize, emitSizeChange]);\n\n // A persistence adapter from `paneId` when none is given. A given one is read through\n // `latest`, so an inline object (the documented shape) does not reload the size every render.\n const hasPersistence = persistence !== undefined;\n const adapter = React.useMemo<PaneSizePersistence | undefined>(() => {\n if (hasPersistence) {\n return {\n load: () => latest.current.persistence?.load?.(),\n save: (value: number) => latest.current.persistence?.save?.(value),\n };\n }\n if (!paneId) return undefined;\n const key = `kookie-ui:shell:${name}:${paneId}`;\n return {\n load: () => {\n if (typeof window === 'undefined') return undefined;\n try {\n const stored = window.localStorage.getItem(key);\n return stored ? Number(stored) : undefined;\n } catch (err) {\n if (process.env.NODE_ENV !== 'production') console.warn(`Shell.${name}: failed to load persisted size`, err);\n return undefined;\n }\n },\n save: (value: number) => {\n if (typeof window === 'undefined') return;\n try {\n window.localStorage.setItem(key, String(value));\n } catch (err) {\n if (process.env.NODE_ENV !== 'production') console.warn(`Shell.${name}: failed to save persisted size`, err);\n }\n },\n };\n }, [name, paneId, hasPersistence]);\n\n // Persisted size, loaded in a layout effect and clamped, so a reload does\n // not paint the default and then jump. Only where the pane is in the frame:\n // an overlay keeps its designed size.\n useLayoutEffect(() => {\n if (!resizable || !adapter?.load || latest.current.overlayingNow()) return undefined;\n let mounted = true;\n const apply = (value: number | undefined) => {\n if (!mounted || typeof value !== 'number' || !Number.isFinite(value)) return;\n const clamped = clampTo(value, minSize, maxSize);\n writeSize(clamped, true);\n latest.current.onResize?.(clamped);\n };\n const loaded = adapter.load();\n if (loaded instanceof Promise) {\n loaded.then(apply).catch((err) => {\n if (process.env.NODE_ENV !== 'production') console.warn(`Shell.${name}: failed to load persisted size`, err);\n });\n } else {\n apply(loaded);\n }\n return () => {\n mounted = false;\n };\n }, [resizable, adapter, options.overlaying, writeSize, minSize, maxSize, name]);\n\n const onResize = React.useCallback((value: number) => latest.current.onResize?.(value), []);\n const onResizeStart = React.useCallback((value: number) => {\n // A resize makes the size the user's: a new expandedSize no longer moves it.\n ownedRef.current = true;\n latest.current.onResizeStart?.(value);\n }, []);\n const onResizeEnd = React.useCallback(\n (value: number) => {\n latest.current.onResizeEnd?.(value);\n emitSizeChange(value, { reason: 'resize' });\n adapter?.save?.(value);\n },\n [emitSizeChange, adapter],\n );\n const requestCollapse = React.useCallback(() => latest.current.requestCollapse(), []);\n const requestToggle = React.useCallback(() => latest.current.requestToggle(), []);\n\n return React.useMemo(\n () => ({\n containerRef: elementRef,\n controls: options.elementId,\n cssVarName,\n minSize,\n maxSize,\n defaultSize: options.expandedSize,\n orientation,\n edge: options.edge,\n growth: options.growth,\n onResize,\n onResizeStart,\n onResizeEnd,\n target: name,\n collapsible: options.collapsible,\n snapPoints: options.snapPoints,\n snapTolerance: options.snapTolerance ?? 8,\n collapseThreshold: options.collapseThreshold,\n requestCollapse,\n requestToggle,\n }),\n [\n elementRef,\n options.elementId,\n cssVarName,\n minSize,\n maxSize,\n options.expandedSize,\n orientation,\n options.edge,\n options.growth,\n onResize,\n onResizeStart,\n onResizeEnd,\n name,\n options.collapsible,\n options.snapPoints,\n options.snapTolerance,\n options.collapseThreshold,\n requestCollapse,\n requestToggle,\n ],\n );\n}\n\n/** Splits a pane's children into its handles and the rest. */\nexport function splitHandles(children: React.ReactNode, handleType: React.ElementType) {\n const all = React.Children.toArray(children);\n const handles = all.filter((el) => React.isValidElement(el) && el.type === handleType) as React.ReactElement[];\n const content = all.filter((el) => !(React.isValidElement(el) && el.type === handleType));\n return { handles, content };\n}\n", "/**\n * Normalize CSS length values to pixels.\n * Supports: px, rem, %, and bare numbers.\n *\n * @param value - The value to normalize (number, string, or undefined)\n * @param orientation - 'horizontal' for width-based % or 'vertical' for height-based %\n * @returns The value in pixels, or undefined if invalid\n */\nexport function normalizeToPx(\n value: number | string | undefined,\n orientation: 'horizontal' | 'vertical' = 'horizontal',\n): number | undefined {\n if (value == null) return undefined;\n if (typeof value === 'number' && Number.isFinite(value)) return value;\n\n const str = String(value).trim();\n if (!str) return undefined;\n\n // px: direct parse\n if (str.endsWith('px')) return Number.parseFloat(str);\n\n // rem: multiply by root font size\n if (str.endsWith('rem')) {\n const rem = Number.parseFloat(getComputedStyle(document.documentElement).fontSize || '16') || 16;\n return Number.parseFloat(str) * rem;\n }\n\n // %: calculate based on viewport dimension\n if (str.endsWith('%')) {\n const pct = Number.parseFloat(str);\n const base =\n orientation === 'horizontal'\n ? document.documentElement.clientWidth || window.innerWidth || 0\n : document.documentElement.clientHeight || window.innerHeight || 0;\n return (pct / 100) * base;\n }\n\n // Bare number-like string\n const n = Number.parseFloat(str);\n return Number.isFinite(n) ? n : undefined;\n}\n\n"],
5
- "mappings": ";AAEA,UAAYA,MAAW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A,cAAAC,EACA,YAAAC,EACA,OAAQxC,EACR,YAAaD,EAAQ,YACrB,WAAYA,EAAQ,WACpB,cAAeA,EAAQ,eAAiB,EACxC,kBAAmBA,EAAQ,kBAC3B,gBAAA0C,EACA,cAAAC,CACF,GACA,CACEzC,EACAF,EAAQ,UACRG,EACAE,EACAC,EACAN,EAAQ,aACRI,EACAJ,EAAQ,KACRA,EAAQ,OACRuC,EACAC,EACAC,EACAxC,EACAD,EAAQ,YACRA,EAAQ,WACRA,EAAQ,cACRA,EAAQ,kBACR0C,EACAC,CACF,CACF,CACF,CAGO,SAASC,EAAaC,EAA2BC,EAA+B,CACrF,IAAMC,EAAY,WAAS,QAAQF,CAAQ,EACrCG,EAAUD,EAAI,OAAQpB,GAAa,iBAAeA,CAAE,GAAKA,EAAG,OAASmB,CAAU,EAC/EG,EAAUF,EAAI,OAAQpB,GAAO,EAAQ,iBAAeA,CAAE,GAAKA,EAAG,OAASmB,EAAW,EACxF,MAAO,CAAE,QAAAE,EAAS,QAAAC,CAAQ,CAC5B",
6
- "names": ["React", "useLayoutEffect", "normalizeToPx", "value", "orientation", "str", "rem", "pct", "base", "n", "clampTo", "value", "min", "max", "useResizablePane", "options", "name", "elementRef", "cssVarName", "orientation", "minSize", "maxSize", "resizable", "size", "defaultSize", "paneId", "persistence", "latest", "useLayoutEffect", "debounceRef", "throttleRef", "emitSizeChange", "meta", "onSizeChange", "sizeUpdate", "sizeUpdateMs", "now", "toPx", "normalizeToPx", "ownedRef", "writeSize", "own", "el", "handle", "px", "clamped", "hasPersistence", "adapter", "key", "stored", "mounted", "apply", "loaded", "err", "onResize", "onResizeStart", "onResizeEnd", "requestCollapse", "requestToggle", "splitHandles", "children", "handleType", "all", "handles", "content"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/components/dropdown-menu.tsx"],
4
- "sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { DropdownMenu as DropdownMenuPrimitive, Slot } from 'radix-ui';\nimport { useCallbackRef } from 'radix-ui/internal';\n\nimport { ScrollArea } from './scroll-area.js';\nimport {\n dropdownMenuContentPropDefs,\n dropdownMenuSubContentPropDefs,\n dropdownMenuItemPropDefs,\n dropdownMenuCheckboxItemPropDefs,\n dropdownMenuRadioItemPropDefs,\n} from './dropdown-menu.props.js';\nimport { Theme, useThemeContext } from './theme.js';\nimport { ChevronDownIcon, ThickCheckIcon, ThickChevronLeftIcon, ThickChevronRightIcon, ThickDotIcon } from './icons.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSizeProps } from '../helpers/theme-size.js';\nimport {\n DrillDownLevelContext,\n DrillDownRoot,\n SubContext,\n useCreateDrillDownStore,\n useDrillDownStore,\n usePanelPosition,\n useStackEntry,\n useSubContext,\n} from './_internal/dropdown-menu-drill-down.js';\nimport {\n MenuCloseProvider,\n MenuGroupLabelProvider,\n MenuProvider,\n useMenuGroupLabelId,\n useMenuGroupLabelledBy,\n} from './_internal/menu-context.js';\nimport {\n MenuShortcut,\n getMenuAlignOffset,\n toAriaKeyShortcuts,\n useResolvedResponsiveValue,\n} from './_internal/base-menu.utils.js';\nimport { requireReactElement } from '../helpers/require-react-element.js';\n\nimport type { SubmenuBehavior } from './_internal/dropdown-menu-drill-down.js';\nimport type { IconProps } from './icons.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { GetPropDefTypes, Responsive } from '../props/prop-def.js';\n\n/**\n * Open state of the menu, mirrored from Root so Content can reset drill-down\n * navigation when a force-mounted menu opens again.\n */\nconst DropdownMenuOpenContext = React.createContext(false);\n\ninterface DropdownMenuRootProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Root> {}\nconst DropdownMenuRoot: React.FC<DropdownMenuRootProps> = (props) => {\n const { open: openProp, defaultOpen = false, onOpenChange } = props;\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);\n const open = openProp ?? uncontrolledOpen;\n\n const handleOpenChangeProp = useCallbackRef(onOpenChange);\n const handleOpenChange = React.useCallback(\n (next: boolean) => {\n setUncontrolledOpen(next);\n handleOpenChangeProp(next);\n },\n [handleOpenChangeProp],\n );\n\n const close = React.useCallback(() => handleOpenChange(false), [handleOpenChange]);\n\n return (\n <DropdownMenuOpenContext.Provider value={open}>\n <MenuCloseProvider value={close}>\n <DropdownMenuPrimitive.Root {...props} open={open} onOpenChange={handleOpenChange} />\n </MenuCloseProvider>\n </DropdownMenuOpenContext.Provider>\n );\n};\nDropdownMenuRoot.displayName = 'DropdownMenu.Root';\n\ntype DropdownMenuTriggerElement = React.ElementRef<typeof DropdownMenuPrimitive.Trigger>;\ninterface DropdownMenuTriggerProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Trigger, RemovedProps> {}\nconst DropdownMenuTrigger = React.forwardRef<DropdownMenuTriggerElement, DropdownMenuTriggerProps>(\n ({ children, ...props }, forwardedRef) => (\n <DropdownMenuPrimitive.Trigger {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </DropdownMenuPrimitive.Trigger>\n ),\n);\nDropdownMenuTrigger.displayName = 'DropdownMenu.Trigger';\n\n/** Visual props shared by Content and SubContent. */\ntype DropdownMenuSurfaceProps = GetPropDefTypes<typeof dropdownMenuSubContentPropDefs>;\n\ntype DropdownMenuContentContextValue = {\n size?: DropdownMenuSurfaceProps['size'];\n color?: DropdownMenuSurfaceProps['color'];\n};\nconst DropdownMenuContentContext = React.createContext<DropdownMenuContentContextValue>({});\n\n/** Keys that navigate back one drill-down level, by writing direction. */\nconst BACK_KEYS = { ltr: 'ArrowLeft', rtl: 'ArrowRight' } as const;\nconst FORWARD_KEYS = { ltr: 'ArrowRight', rtl: 'ArrowLeft' } as const;\n\nfunction isTextEntryTarget(target: EventTarget | null) {\n return (\n target instanceof HTMLElement &&\n (target.isContentEditable || target.tagName === 'INPUT' || target.tagName === 'TEXTAREA')\n );\n}\n\nfunction getDirection(element: HTMLElement | null): 'ltr' | 'rtl' {\n return element?.closest('[dir]')?.getAttribute('dir') === 'rtl' ? 'rtl' : 'ltr';\n}\n\ntype DropdownMenuContentElement = React.ElementRef<typeof DropdownMenuPrimitive.Content>;\ninterface DropdownMenuContentProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Content, RemovedProps>,\n DropdownMenuSurfaceProps {\n container?: React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Portal>['container'];\n /**\n * Controls how submenus behave.\n * - `cascade`: Default cascading behavior where submenus open to the side (portal-based)\n * - `drill-down`: Mobile-friendly behavior where submenus replace the content inline\n * Supports responsive values: `{ initial: 'drill-down', md: 'cascade' }`\n */\n submenuBehavior?: Responsive<SubmenuBehavior>;\n /**\n * When true, skips the ScrollArea wrapper to allow VirtualMenu to handle its own scrolling.\n * Use this when rendering virtualized lists inside the dropdown.\n */\n virtualized?: boolean;\n}\nconst DropdownMenuContent = React.forwardRef<DropdownMenuContentElement, DropdownMenuContentProps>(\n (ownProps, forwardedRef) => {\n const props = useThemeSizeProps(ownProps, dropdownMenuContentPropDefs.size);\n const themeContext = useThemeContext();\n const {\n size = dropdownMenuContentPropDefs.size.default,\n } = props;\n const {\n className,\n children,\n color,\n container,\n forceMount,\n submenuBehavior,\n virtualized = false,\n onEscapeKeyDown,\n onKeyDown,\n ...contentProps\n } = extractProps(props, dropdownMenuContentPropDefs);\n\n const resolvedColor = color || themeContext.accentColor;\n const behavior = useResolvedResponsiveValue<SubmenuBehavior>(submenuBehavior, 'cascade');\n const isDrillDown = behavior === 'drill-down';\n const open = React.useContext(DropdownMenuOpenContext);\n const drillDownStore = useCreateDrillDownStore();\n\n // Escape goes back one drill-down level before it closes the menu.\n const handleEscapeKeyDown = (event: KeyboardEvent) => {\n onEscapeKeyDown?.(event);\n if (event.defaultPrevented || !isDrillDown || drillDownStore.getDepth() === 0) return;\n event.preventDefault();\n drillDownStore.pop('keyboard');\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || !isDrillDown || drillDownStore.getDepth() === 0) return;\n if (isTextEntryTarget(event.target)) return;\n if (event.key === BACK_KEYS[getDirection(event.currentTarget)]) {\n event.preventDefault();\n drillDownStore.pop('keyboard');\n }\n };\n\n const contextValue = React.useMemo(\n () => ({ size, color: resolvedColor }),\n [size, resolvedColor],\n );\n\n const contentBody = (\n <MenuProvider size={size}>\n <DropdownMenuContentContext.Provider value={contextValue}>\n <DrillDownRoot store={drillDownStore} behavior={behavior} open={open}>\n {children}\n </DrillDownRoot>\n </DropdownMenuContentContext.Provider>\n </MenuProvider>\n );\n\n return (\n <DropdownMenuPrimitive.Portal container={container} forceMount={forceMount}>\n <Theme asChild>\n <DropdownMenuPrimitive.Content\n data-accent-color={resolvedColor}\n align=\"start\"\n sideOffset={4}\n collisionPadding={10}\n {...contentProps}\n onEscapeKeyDown={handleEscapeKeyDown}\n onKeyDown={handleKeyDown}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'kui-PopperContent',\n 'kui-BaseMenuContent',\n 'kui-variant-soft',\n 'kui-DropdownMenuContent',\n className,\n )}\n >\n {virtualized ? (\n <div className={classNames('kui-BaseMenuViewport', 'kui-DropdownMenuViewport', 'kui-virtualized')}>\n {contentBody}\n </div>\n ) : (\n <ScrollArea type=\"auto\" scrollbars=\"vertical\">\n <div className={classNames('kui-BaseMenuViewport', 'kui-DropdownMenuViewport')}>\n {contentBody}\n </div>\n </ScrollArea>\n )}\n </DropdownMenuPrimitive.Content>\n </Theme>\n </DropdownMenuPrimitive.Portal>\n );\n },\n);\nDropdownMenuContent.displayName = 'DropdownMenu.Content';\n\ntype DropdownMenuLabelElement = React.ElementRef<typeof DropdownMenuPrimitive.Label>;\ninterface DropdownMenuLabelProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Label, RemovedProps> {}\nconst DropdownMenuLabel = React.forwardRef<DropdownMenuLabelElement, DropdownMenuLabelProps>(\n ({ className, id: idProp, ...props }, forwardedRef) => {\n const isLevelVisible = React.useContext(DrillDownLevelContext);\n const id = useMenuGroupLabelId(idProp, isLevelVisible);\n if (!isLevelVisible) return null;\n return (\n <DropdownMenuPrimitive.Label\n {...props}\n id={id}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-BaseMenuLabel', 'kui-DropdownMenuLabel', className)}\n />\n );\n },\n);\nDropdownMenuLabel.displayName = 'DropdownMenu.Label';\n\ntype DropdownMenuItemElement = React.ElementRef<typeof DropdownMenuPrimitive.Item>;\ntype DropdownMenuItemOwnProps = GetPropDefTypes<typeof dropdownMenuItemPropDefs>;\ninterface DropdownMenuItemProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Item, RemovedProps>,\n DropdownMenuItemOwnProps {}\nconst DropdownMenuItem = React.forwardRef<DropdownMenuItemElement, DropdownMenuItemProps>(\n (props, forwardedRef) => {\n const {\n className,\n children,\n color = dropdownMenuItemPropDefs.color.default,\n shortcut,\n ...itemProps\n } = props;\n // In drill-down mode, items of levels that are not on screen do not mount.\n if (!React.useContext(DrillDownLevelContext)) return null;\n return (\n <DropdownMenuPrimitive.Item\n data-accent-color={color}\n aria-keyshortcuts={shortcut ? toAriaKeyShortcuts(shortcut) : undefined}\n {...itemProps}\n ref={forwardedRef}\n className={classNames('kui-reset', 'kui-BaseMenuItem', 'kui-DropdownMenuItem', className)}\n >\n <Slot.Slottable>{children}</Slot.Slottable>\n {shortcut && <MenuShortcut shortcut={shortcut} className=\"kui-DropdownMenuShortcut\" />}\n </DropdownMenuPrimitive.Item>\n );\n },\n);\nDropdownMenuItem.displayName = 'DropdownMenu.Item';\n\ntype DropdownMenuGroupElement = React.ElementRef<typeof DropdownMenuPrimitive.Group>;\ninterface DropdownMenuGroupProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Group, RemovedProps> {}\nconst DropdownMenuGroup = React.forwardRef<DropdownMenuGroupElement, DropdownMenuGroupProps>(\n ({ className, 'aria-labelledby': ariaLabelledBy, ...props }, forwardedRef) => {\n const [labelledBy, setLabelId] = useMenuGroupLabelledBy(ariaLabelledBy);\n // A drill-down level that is not on screen keeps its groups only to hold the open path.\n const isLevelVisible = React.useContext(DrillDownLevelContext);\n return (\n <MenuGroupLabelProvider value={setLabelId}>\n <DropdownMenuPrimitive.Group\n {...(isLevelVisible ? { 'aria-labelledby': labelledBy } : { role: 'none' })}\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-BaseMenuGroup', 'kui-DropdownMenuGroup', className)}\n />\n </MenuGroupLabelProvider>\n );\n },\n);\nDropdownMenuGroup.displayName = 'DropdownMenu.Group';\n\ntype DropdownMenuRadioGroupElement = React.ElementRef<typeof DropdownMenuPrimitive.RadioGroup>;\ninterface DropdownMenuRadioGroupProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.RadioGroup, RemovedProps> {}\nconst DropdownMenuRadioGroup = React.forwardRef<\n DropdownMenuRadioGroupElement,\n DropdownMenuRadioGroupProps\n>(({ className, 'aria-labelledby': ariaLabelledBy, ...props }, forwardedRef) => {\n const [labelledBy, setLabelId] = useMenuGroupLabelledBy(ariaLabelledBy);\n const isLevelVisible = React.useContext(DrillDownLevelContext);\n return (\n <MenuGroupLabelProvider value={setLabelId}>\n <DropdownMenuPrimitive.RadioGroup\n {...(isLevelVisible ? { 'aria-labelledby': labelledBy } : { role: 'none' })}\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-BaseMenuRadioGroup', 'kui-DropdownMenuRadioGroup', className)}\n />\n </MenuGroupLabelProvider>\n );\n});\nDropdownMenuRadioGroup.displayName = 'DropdownMenu.RadioGroup';\n\ntype DropdownMenuRadioItemElement = React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>;\ntype DropdownMenuRadioItemOwnProps = GetPropDefTypes<typeof dropdownMenuRadioItemPropDefs>;\ninterface DropdownMenuRadioItemProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.RadioItem, RemovedProps>,\n DropdownMenuRadioItemOwnProps {}\nconst DropdownMenuRadioItem = React.forwardRef<\n DropdownMenuRadioItemElement,\n DropdownMenuRadioItemProps\n>((props, forwardedRef) => {\n const {\n children,\n className,\n color = dropdownMenuRadioItemPropDefs.color.default,\n ...itemProps\n } = props;\n if (!React.useContext(DrillDownLevelContext)) return null;\n return (\n <DropdownMenuPrimitive.RadioItem\n {...itemProps}\n asChild={false}\n ref={forwardedRef}\n data-accent-color={color}\n className={classNames(\n 'kui-BaseMenuItem',\n 'kui-BaseMenuRadioItem',\n 'kui-DropdownMenuItem',\n 'kui-DropdownMenuRadioItem',\n className,\n )}\n >\n <Slot.Slottable>{children}</Slot.Slottable>\n <DropdownMenuPrimitive.ItemIndicator className=\"kui-BaseMenuItemIndicator kui-DropdownMenuItemIndicator\">\n <ThickDotIcon className=\"kui-BaseMenuItemIndicatorIcon kui-DropdownMenuItemIndicatorIcon\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </DropdownMenuPrimitive.RadioItem>\n );\n});\nDropdownMenuRadioItem.displayName = 'DropdownMenu.RadioItem';\n\ntype DropdownMenuCheckboxItemElement = React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>;\ntype DropdownMenuCheckboxItemOwnProps = GetPropDefTypes<typeof dropdownMenuCheckboxItemPropDefs>;\ninterface DropdownMenuCheckboxItemProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.CheckboxItem, RemovedProps>,\n DropdownMenuCheckboxItemOwnProps {}\nconst DropdownMenuCheckboxItem = React.forwardRef<\n DropdownMenuCheckboxItemElement,\n DropdownMenuCheckboxItemProps\n>((props, forwardedRef) => {\n const {\n children,\n className,\n shortcut,\n color = dropdownMenuCheckboxItemPropDefs.color.default,\n ...itemProps\n } = props;\n if (!React.useContext(DrillDownLevelContext)) return null;\n return (\n <DropdownMenuPrimitive.CheckboxItem\n aria-keyshortcuts={shortcut ? toAriaKeyShortcuts(shortcut) : undefined}\n {...itemProps}\n asChild={false}\n ref={forwardedRef}\n data-accent-color={color}\n className={classNames(\n 'kui-BaseMenuItem',\n 'kui-BaseMenuCheckboxItem',\n 'kui-DropdownMenuItem',\n 'kui-DropdownMenuCheckboxItem',\n className,\n )}\n >\n <Slot.Slottable>{children}</Slot.Slottable>\n <DropdownMenuPrimitive.ItemIndicator className=\"kui-BaseMenuItemIndicator kui-DropdownMenuItemIndicator\">\n <ThickCheckIcon className=\"kui-BaseMenuItemIndicatorIcon kui-DropdownMenuItemIndicatorIcon\" />\n </DropdownMenuPrimitive.ItemIndicator>\n {shortcut && <MenuShortcut shortcut={shortcut} className=\"kui-DropdownMenuShortcut\" />}\n </DropdownMenuPrimitive.CheckboxItem>\n );\n});\nDropdownMenuCheckboxItem.displayName = 'DropdownMenu.CheckboxItem';\n\ninterface DropdownMenuSubProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Sub> {\n /**\n * Label displayed in the back button when using drill-down mode.\n * If not provided, defaults to \"Back\".\n */\n label?: React.ReactNode;\n}\nconst DropdownMenuSub: React.FC<DropdownMenuSubProps> = ({\n label = 'Back',\n open,\n defaultOpen,\n onOpenChange,\n children,\n}) => {\n const drillDownStore = useDrillDownStore();\n const id = React.useId();\n const subContextValue = React.useMemo(() => ({ id, label }), [id, label]);\n const isOpenInDrillDown = usePanelPosition(drillDownStore, id) !== 'closed';\n\n const handleOpenChange = useCallbackRef(onOpenChange);\n const isControlled = open !== undefined;\n\n // Drill-down, controlled: navigating asks `onOpenChange` and leaves the stack to `open`.\n React.useLayoutEffect(() => {\n if (!drillDownStore || !isControlled) return;\n drillDownStore.setController(id, handleOpenChange);\n return () => drillDownStore.setController(id, null);\n }, [drillDownStore, isControlled, id, handleOpenChange]);\n\n React.useLayoutEffect(() => {\n if (!drillDownStore || open === undefined) return;\n if (open && !drillDownStore.isOpen(id)) drillDownStore.open(id, drillDownStore.takePendingModality(id));\n else if (!open && drillDownStore.isOpen(id)) drillDownStore.close(id, drillDownStore.takePendingModality(id));\n }, [drillDownStore, open, id]);\n\n // A `defaultOpen` push on mount is the starting state, not a change to report.\n const defaultOpenRef = React.useRef(open === undefined && Boolean(defaultOpen));\n React.useLayoutEffect(() => {\n if (drillDownStore && defaultOpenRef.current) drillDownStore.open(id);\n else defaultOpenRef.current = false;\n // Only on mount, like an uncontrolled default.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Uncontrolled, the stack drives `onOpenChange`. Controlled, it reports only a close\n // the `open` prop did not ask for, such as a parent level closing.\n const wasOpenRef = React.useRef(isOpenInDrillDown);\n React.useEffect(() => {\n if (!drillDownStore || wasOpenRef.current === isOpenInDrillDown) return;\n wasOpenRef.current = isOpenInDrillDown;\n if (isOpenInDrillDown && defaultOpenRef.current) {\n defaultOpenRef.current = false;\n return;\n }\n if (open !== undefined && open === isOpenInDrillDown) return;\n handleOpenChange(isOpenInDrillDown);\n }, [drillDownStore, isOpenInDrillDown, handleOpenChange, open]);\n\n // Radix Sub stays mounted in both behaviors so switching behavior does not\n // remount the subtree. It only renders context; in drill-down its trigger\n // and content are never rendered, so it reports no open changes of its own.\n return (\n <SubContext.Provider value={subContextValue}>\n <DropdownMenuPrimitive.Sub\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={drillDownStore ? undefined : onOpenChange}\n >\n {children}\n </DropdownMenuPrimitive.Sub>\n </SubContext.Provider>\n );\n};\nDropdownMenuSub.displayName = 'DropdownMenu.Sub';\n\ntype DropdownMenuSubTriggerElement = React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>;\ninterface DropdownMenuSubTriggerProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.SubTrigger, RemovedProps> {}\nconst DropdownMenuSubTrigger = React.forwardRef<\n DropdownMenuSubTriggerElement,\n DropdownMenuSubTriggerProps\n>((props, forwardedRef) => {\n const { className, children, onKeyDown, ...subTriggerProps } = props;\n const drillDownStore = useDrillDownStore();\n const subContext = useSubContext();\n const isLevelVisible = React.useContext(DrillDownLevelContext);\n\n if (drillDownStore && subContext) {\n if (!isLevelVisible) return null;\n\n const handleSelect = (event: Event) => {\n // Navigating does not close the menu.\n event.preventDefault();\n drillDownStore.push(subContext.id);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || subTriggerProps.disabled) return;\n if (event.key === FORWARD_KEYS[getDirection(event.currentTarget)]) {\n event.preventDefault();\n drillDownStore.push(subContext.id, 'keyboard');\n }\n };\n\n return (\n // The row navigates within the same menu, so it announces no popup.\n <DropdownMenuPrimitive.Item\n {...subTriggerProps}\n data-drill-down-trigger={subContext.id}\n data-drill-down-name={subTriggerProps.textValue}\n onSelect={handleSelect}\n onKeyDown={handleKeyDown}\n ref={forwardedRef}\n className={classNames(\n 'kui-reset',\n 'kui-BaseMenuItem',\n 'kui-BaseMenuSubTrigger',\n 'kui-DropdownMenuItem',\n 'kui-DropdownMenuSubTrigger',\n 'kui-DropdownMenuDrillDownSubTrigger',\n className,\n )}\n >\n {children}\n <div className=\"kui-BaseMenuShortcut kui-DropdownMenuShortcut\">\n <ThickChevronRightIcon className=\"kui-BaseMenuSubTriggerIcon kui-DropdownMenuSubTriggerIcon\" />\n </div>\n </DropdownMenuPrimitive.Item>\n );\n }\n\n return (\n <DropdownMenuPrimitive.SubTrigger\n {...subTriggerProps}\n onKeyDown={onKeyDown}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'kui-BaseMenuItem',\n 'kui-BaseMenuSubTrigger',\n 'kui-DropdownMenuItem',\n 'kui-DropdownMenuSubTrigger',\n className,\n )}\n >\n {children}\n <div className=\"kui-BaseMenuShortcut kui-DropdownMenuShortcut\">\n <ThickChevronRightIcon className=\"kui-BaseMenuSubTriggerIcon kui-DropdownMenuSubTriggerIcon\" />\n </div>\n </DropdownMenuPrimitive.SubTrigger>\n );\n});\nDropdownMenuSubTrigger.displayName = 'DropdownMenu.SubTrigger';\n\ntype DropdownMenuSeparatorElement = React.ElementRef<typeof DropdownMenuPrimitive.Separator>;\ninterface DropdownMenuSeparatorProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Separator, RemovedProps> {}\nconst DropdownMenuSeparator = React.forwardRef<\n DropdownMenuSeparatorElement,\n DropdownMenuSeparatorProps\n>(({ className, ...props }, forwardedRef) => {\n if (!React.useContext(DrillDownLevelContext)) return null;\n return (\n <DropdownMenuPrimitive.Separator\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-BaseMenuSeparator', 'kui-DropdownMenuSeparator', className)}\n />\n );\n});\nDropdownMenuSeparator.displayName = 'DropdownMenu.Separator';\n\n/** The row at the top of a drill-down panel that returns to the parent level. */\nfunction DrillDownBackItem({ label, name }: { label: React.ReactNode; name: string }) {\n const drillDownStore = useDrillDownStore();\n\n const handleSelect = React.useCallback(\n (event: Event) => {\n // Navigating does not close the menu.\n event.preventDefault();\n drillDownStore?.pop();\n },\n [drillDownStore],\n );\n\n // The visible label is often the submenu title, so the accessible name says\n // what the row does while still containing the visible text.\n const labelText = typeof label === 'string' ? label : name;\n const ariaLabel = labelText && labelText !== 'Back' ? `Back from ${labelText}` : undefined;\n\n return (\n <DropdownMenuPrimitive.Item\n aria-label={ariaLabel}\n textValue={labelText || 'Back'}\n onSelect={handleSelect}\n className={classNames(\n 'kui-reset',\n 'kui-BaseMenuItem',\n 'kui-DropdownMenuItem',\n 'kui-DropdownMenuDrillDownBackItem',\n )}\n >\n <ThickChevronLeftIcon className=\"kui-BaseMenuSubTriggerIcon kui-DropdownMenuDrillDownBackIcon\" />\n <span className=\"kui-DropdownMenuDrillDownBackLabel\">{label}</span>\n </DropdownMenuPrimitive.Item>\n );\n}\n\n/** Radix positioning and layer props that have no meaning for an inline drill-down panel. */\ntype PopperOnlyProps =\n | 'loop'\n | 'onEscapeKeyDown'\n | 'onPointerDownOutside'\n | 'onFocusOutside'\n | 'onInteractOutside'\n | 'sideOffset'\n | 'alignOffset'\n | 'avoidCollisions'\n | 'collisionBoundary'\n | 'collisionPadding'\n | 'arrowPadding'\n | 'sticky'\n | 'hideWhenDetached'\n | 'updatePositionStrategy';\n\nfunction omitPopperProps<T extends Record<string, unknown>>(props: T): Omit<T, PopperOnlyProps> {\n const {\n loop: _loop,\n onEscapeKeyDown: _onEscapeKeyDown,\n onPointerDownOutside: _onPointerDownOutside,\n onFocusOutside: _onFocusOutside,\n onInteractOutside: _onInteractOutside,\n sideOffset: _sideOffset,\n alignOffset: _alignOffset,\n avoidCollisions: _avoidCollisions,\n collisionBoundary: _collisionBoundary,\n collisionPadding: _collisionPadding,\n arrowPadding: _arrowPadding,\n sticky: _sticky,\n hideWhenDetached: _hideWhenDetached,\n updatePositionStrategy: _updatePositionStrategy,\n ...rest\n } = props;\n return rest;\n}\n\ntype DropdownMenuSubContentElement = React.ElementRef<typeof DropdownMenuPrimitive.SubContent>;\ninterface DropdownMenuSubContentProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.SubContent, RemovedProps>,\n DropdownMenuSurfaceProps {\n container?: React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Portal>['container'];\n /**\n * When true, skips the ScrollArea wrapper so a VirtualMenu can handle its own\n * scrolling. Applies to cascade submenus; a drill-down panel scrolls with the\n * root content.\n */\n virtualized?: boolean;\n}\nconst DropdownMenuSubContent = React.forwardRef<\n DropdownMenuSubContentElement,\n DropdownMenuSubContentProps\n>((props, forwardedRef) => {\n const drillDownStore = useDrillDownStore();\n const subContext = useSubContext();\n\n if (drillDownStore && subContext) {\n return (\n <DrillDownPanel {...props} ref={forwardedRef} store={drillDownStore} sub={subContext} />\n );\n }\n return <CascadeSubContent {...props} ref={forwardedRef} />;\n});\nDropdownMenuSubContent.displayName = 'DropdownMenu.SubContent';\n\nconst CascadeSubContent = React.forwardRef<DropdownMenuSubContentElement, DropdownMenuSubContentProps>(\n (props, forwardedRef) => {\n const parent = React.useContext(DropdownMenuContentContext);\n\n // A submenu inherits the parent surface, and its own props win.\n const size = props.size ?? parent.size;\n const color = props.color ?? parent.color;\n\n const {\n className,\n children,\n container,\n forceMount,\n color: _color,\n virtualized = false,\n ...subContentProps\n } = extractProps({ ...props, size }, dropdownMenuSubContentPropDefs);\n\n const scalarSize = useResolvedResponsiveValue(size, dropdownMenuSubContentPropDefs.size.default);\n\n const contextValue = React.useMemo(\n () => ({ size, color }),\n [size, color],\n );\n\n const body = (\n <MenuProvider size={size}>\n <DropdownMenuContentContext.Provider value={contextValue}>{children}</DropdownMenuContentContext.Provider>\n </MenuProvider>\n );\n\n return (\n <DropdownMenuPrimitive.Portal container={container} forceMount={forceMount}>\n <Theme asChild>\n <DropdownMenuPrimitive.SubContent\n data-accent-color={color}\n alignOffset={getMenuAlignOffset(scalarSize)}\n // Side offset accounts for the outer solid box-shadow\n sideOffset={1}\n collisionPadding={10}\n {...subContentProps}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'kui-PopperContent',\n 'kui-BaseMenuContent',\n 'kui-variant-soft',\n 'kui-BaseMenuSubContent',\n 'kui-DropdownMenuContent',\n 'kui-DropdownMenuSubContent',\n className,\n )}\n >\n {virtualized ? (\n <div className={classNames('kui-BaseMenuViewport', 'kui-DropdownMenuViewport', 'kui-virtualized')}>\n {body}\n </div>\n ) : (\n <ScrollArea type=\"auto\" scrollbars=\"vertical\">\n <div className={classNames('kui-BaseMenuViewport', 'kui-DropdownMenuViewport')}>{body}</div>\n </ScrollArea>\n )}\n </DropdownMenuPrimitive.SubContent>\n </Theme>\n </DropdownMenuPrimitive.Portal>\n );\n },\n);\nCascadeSubContent.displayName = 'DropdownMenu.CascadeSubContent';\n\ninterface DrillDownPanelProps extends DropdownMenuSubContentProps {\n store: NonNullable<ReturnType<typeof useDrillDownStore>>;\n sub: NonNullable<ReturnType<typeof useSubContext>>;\n}\n\n/**\n * A submenu rendered inline in drill-down mode. It mounts its children only\n * while it is on the navigation stack, and shows its own items only while it\n * is the top level; deeper panels inside it stay mounted.\n */\nconst DrillDownPanel = React.forwardRef<DropdownMenuSubContentElement, DrillDownPanelProps>(\n ({ store, sub, ...props }, forwardedRef) => {\n const position = usePanelPosition(store, sub.id);\n const entry = useStackEntry(store, sub.id);\n\n if (position === 'closed') return null;\n\n const {\n className,\n children,\n container: _container,\n forceMount: _forceMount,\n virtualized: _virtualized,\n size: _size,\n color: _color,\n ...panelProps\n } = omitPopperProps(props);\n\n const isTop = position === 'top';\n const name = entry?.name || (typeof sub.label === 'string' ? sub.label : '');\n\n return (\n <div\n role=\"group\"\n aria-label={name || undefined}\n {...panelProps}\n ref={forwardedRef}\n data-drill-down-panel={sub.id}\n data-drill-down-active={isTop ? true : undefined}\n className={classNames('kui-DropdownMenuDrillDownPanel', className)}\n >\n {isTop && (\n <>\n <DrillDownBackItem label={sub.label} name={name} />\n <DropdownMenuPrimitive.Separator className=\"kui-BaseMenuSeparator kui-DropdownMenuSeparator\" />\n </>\n )}\n <MenuGroupLabelProvider value={null}>\n <DrillDownLevelContext.Provider value={isTop}>{children}</DrillDownLevelContext.Provider>\n </MenuGroupLabelProvider>\n </div>\n );\n },\n);\nDrillDownPanel.displayName = 'DropdownMenu.DrillDownPanel';\n\ntype DropdownMenuTriggerIconElement = React.ElementRef<'svg'>;\ninterface DropdownMenuTriggerIconProps extends IconProps {}\nconst DropdownMenuTriggerIcon = React.forwardRef<\n DropdownMenuTriggerIconElement,\n DropdownMenuTriggerIconProps\n>(({ className, ...props }, forwardedRef) => (\n <ChevronDownIcon\n {...props}\n ref={forwardedRef}\n className={classNames('kui-DropdownMenuTriggerIcon', className)}\n />\n));\nDropdownMenuTriggerIcon.displayName = 'DropdownMenu.TriggerIcon';\n\nexport {\n DropdownMenuRoot as Root,\n DropdownMenuTrigger as Trigger,\n DropdownMenuTriggerIcon as TriggerIcon,\n DropdownMenuContent as Content,\n DropdownMenuLabel as Label,\n DropdownMenuItem as Item,\n DropdownMenuGroup as Group,\n DropdownMenuRadioGroup as RadioGroup,\n DropdownMenuRadioItem as RadioItem,\n DropdownMenuCheckboxItem as CheckboxItem,\n DropdownMenuSub as Sub,\n DropdownMenuSubTrigger as SubTrigger,\n DropdownMenuSubContent as SubContent,\n DropdownMenuSeparator as Separator,\n};\n\nexport type {\n DropdownMenuRootProps as RootProps,\n DropdownMenuTriggerProps as TriggerProps,\n DropdownMenuTriggerIconProps as TriggerIconProps,\n DropdownMenuContentProps as ContentProps,\n DropdownMenuLabelProps as LabelProps,\n DropdownMenuItemProps as ItemProps,\n DropdownMenuGroupProps as GroupProps,\n DropdownMenuRadioGroupProps as RadioGroupProps,\n DropdownMenuRadioItemProps as RadioItemProps,\n DropdownMenuCheckboxItemProps as CheckboxItemProps,\n DropdownMenuSubProps as SubProps,\n DropdownMenuSubTriggerProps as SubTriggerProps,\n DropdownMenuSubContentProps as SubContentProps,\n DropdownMenuSeparatorProps as SeparatorProps,\n SubmenuBehavior,\n};\n"],
5
- "mappings": ";+lBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,kBAAAE,GAAA,YAAAC,GAAA,UAAAC,GAAA,SAAAC,GAAA,UAAAC,GAAA,eAAAC,GAAA,cAAAC,GAAA,SAAAC,GAAA,cAAAC,GAAA,QAAAC,GAAA,eAAAC,GAAA,eAAAC,GAAA,YAAAC,GAAA,gBAAAC,KAEA,UAAYC,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,gBAAgBC,EAAuB,QAAAC,MAAY,WAC5D,OAAS,kBAAAC,OAAsB,oBAgD/B,IAAMC,GAAgC,gBAAc,EAAK,EAInDC,GAAqDC,GAAU,CACnE,GAAM,CAAE,KAAMC,EAAU,YAAAC,EAAc,GAAO,aAAAC,CAAa,EAAIH,EACxD,CAACI,EAAkBC,CAAmB,EAAU,WAASH,CAAW,EACpEI,EAAOL,GAAYG,EAEnBG,EAAuBC,GAAeL,CAAY,EAClDM,EAAyB,cAC5BC,GAAkB,CACjBL,EAAoBK,CAAI,EACxBH,EAAqBG,CAAI,CAC3B,EACA,CAACH,CAAoB,CACvB,EAEMI,EAAc,cAAY,IAAMF,EAAiB,EAAK,EAAG,CAACA,CAAgB,CAAC,EAEjF,OACE,g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,GAEhE8G,GACC,gCACE,gBAACzC,GAAA,CAAkB,MAAOgC,EAAI,MAAO,KAAM/B,EAAM,EACjD,gBAACzF,EAAsB,UAAtB,CAAgC,UAAU,kDAAkD,CAC/F,EAEF,gBAAC+D,EAAA,CAAuB,MAAO,MAC7B,gBAACf,EAAsB,SAAtB,CAA+B,MAAOiF,GAAQ/H,CAAS,CAC1D,CACF,CAEJ,CACF,EACA4G,GAAe,YAAc,8BAI7B,IAAMoB,GAAgC,aAGpC,CAAC,CAAE,UAAA/G,EAAW,GAAGhC,CAAM,EAAGgB,IAC1B,gBAACgI,EAAA,CACE,GAAGhJ,EACJ,IAAKgB,EACL,UAAWwC,EAAW,8BAA+BxB,CAAS,EAChE,CACD,EACD+G,GAAwB,YAAc",
6
- "names": ["dropdown_menu_exports", "__export", "DropdownMenuCheckboxItem", "DropdownMenuContent", "DropdownMenuGroup", "DropdownMenuItem", "DropdownMenuLabel", "DropdownMenuRadioGroup", "DropdownMenuRadioItem", "DropdownMenuRoot", "DropdownMenuSeparator", "DropdownMenuSub", "DropdownMenuSubContent", "DropdownMenuSubTrigger", "DropdownMenuTrigger", "DropdownMenuTriggerIcon", "React", "classNames", "DropdownMenuPrimitive", "Slot", "useCallbackRef", "DropdownMenuOpenContext", "DropdownMenuRoot", "props", "openProp", "defaultOpen", "onOpenChange", "uncontrolledOpen", "setUncontrolledOpen", "open", "handleOpenChangeProp", "useCallbackRef", "handleOpenChange", "next", "close", "MenuCloseProvider", "DropdownMenuPrimitive", "DropdownMenuTrigger", "children", "forwardedRef", "requireReactElement", "DropdownMenuContentContext", "BACK_KEYS", "FORWARD_KEYS", "isTextEntryTarget", "target", "getDirection", "element", "DropdownMenuContent", "ownProps", "useThemeSizeProps", "baseMenuContentPropDefs", "themeContext", "useThemeContext", "size", "className", "color", "container", "forceMount", "submenuBehavior", "virtualized", "onEscapeKeyDown", "onKeyDown", "contentProps", "extractProps", "resolvedColor", "behavior", "useResolvedResponsiveValue", "isDrillDown", "drillDownStore", "useCreateDrillDownStore", "handleEscapeKeyDown", "event", "handleKeyDown", "contextValue", "contentBody", "MenuProvider", "DrillDownRoot", "Theme", "classNames", "ScrollArea", "DropdownMenuLabel", "idProp", "isLevelVisible", "DrillDownLevelContext", "id", "useMenuGroupLabelId", "DropdownMenuItem", "baseMenuItemPropDefs", "shortcut", "itemProps", "toAriaKeyShortcuts", "Slot", "MenuShortcut", "DropdownMenuGroup", "ariaLabelledBy", "labelledBy", "setLabelId", "useMenuGroupLabelledBy", "MenuGroupLabelProvider", "DropdownMenuRadioGroup", "DropdownMenuRadioItem", "baseMenuRadioItemPropDefs", "ThickDotIcon", "DropdownMenuCheckboxItem", "baseMenuCheckboxItemPropDefs", "ThickCheckIcon", "DropdownMenuSub", "label", "useDrillDownStore", "subContextValue", "isOpenInDrillDown", "usePanelPosition", "isControlled", "defaultOpenRef", "wasOpenRef", "SubContext", "DropdownMenuSubTrigger", "subTriggerProps", "subContext", "useSubContext", "handleSelect", "ThickChevronRightIcon", "DropdownMenuSeparator", "DrillDownBackItem", "name", "labelText", "ariaLabel", "ThickChevronLeftIcon", "omitPopperProps", "_loop", "_onEscapeKeyDown", "_onPointerDownOutside", "_onFocusOutside", "_onInteractOutside", "_sideOffset", "_alignOffset", "_avoidCollisions", "_collisionBoundary", "_collisionPadding", "_arrowPadding", "_sticky", "_hideWhenDetached", "_updatePositionStrategy", "rest", "DropdownMenuSubContent", "DrillDownPanel", "CascadeSubContent", "parent", "_color", "subContentProps", "baseMenuSubContentPropDefs", "scalarSize", "body", "getMenuAlignOffset", "store", "sub", "position", "entry", "useStackEntry", "_container", "_forceMount", "_virtualized", "_size", "panelProps", "isTop", "DropdownMenuTriggerIcon", "ChevronDownIcon"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/components/avatar.tsx"],
4
- "sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { Avatar as AvatarPrimitive } from 'radix-ui';\n\nimport { avatarPropDefs } from './avatar.props.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { getSubtree } from '../helpers/get-subtree.js';\nimport { useThemeSizeProps } from '../helpers/theme-size.js';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\n\ninterface AvatarProps extends AvatarImplProps {}\nconst Avatar = React.forwardRef<AvatarElement, AvatarProps>((ownProps, forwardedRef) => {\n // An unset size follows the Theme, like a control. Sizes above 4 are only explicit.\n const props = useThemeSizeProps(ownProps, avatarPropDefs.size);\n const {\n asChild,\n children,\n className,\n style,\n color,\n radius,\n status,\n statusLabel,\n badge,\n // Only these reach the <img>, which Radix renders once the picture has loaded.\n fallback,\n onLoadingStatusChange,\n src,\n alt,\n srcSet,\n sizes,\n crossOrigin,\n referrerPolicy,\n loading,\n decoding,\n onLoad,\n onError,\n // Everything else (id, aria-*, data-*, handlers) goes on the root, so it is always rendered.\n ...rootProps\n } = extractProps(props, avatarPropDefs);\n const imageProps = { fallback, onLoadingStatusChange, src, alt, srcSet, sizes, crossOrigin, referrerPolicy, loading, decoding, onLoad, onError };\n\n if (process.env.NODE_ENV !== 'production') {\n if (status !== undefined && badge !== undefined) {\n console.warn('Avatar: Cannot use both `status` and `badge` props together. ' + 'The `badge` prop will be used and `status` will be ignored.');\n }\n }\n\n // Cheap boolean checks \u2014 no memoization needed\n const isDisabled = asChild && children != null && React.isValidElement(children) && ((children.props as any).disabled === true || (children.props as any)['data-disabled'] === true);\n\n const hasIndicator = badge !== undefined || status !== undefined;\n\n const indicator =\n badge !== undefined ? (\n <span className=\"kui-AvatarBadge\">{badge}</span>\n ) : status !== undefined ? (\n <span\n className=\"kui-AvatarStatus\"\n data-accent-color={status}\n role={statusLabel ? 'img' : undefined}\n aria-label={statusLabel || undefined}\n aria-hidden={statusLabel ? undefined : true}\n />\n ) : null;\n\n return (\n <AvatarPrimitive.Root\n {...(rootProps as React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>)}\n ref={forwardedRef}\n data-accent-color={color}\n data-radius={radius}\n data-disabled={isDisabled || undefined}\n data-has-indicator={hasIndicator || undefined}\n className={classNames('kui-reset', 'kui-AvatarRoot', className)}\n style={style}\n asChild={asChild}\n >\n {/* With asChild, Slot takes exactly one child, so the indicator goes inside it. */}\n {getSubtree(\n { asChild, children },\n <>\n <AvatarImpl {...imageProps} />\n {indicator}\n </>,\n )}\n </AvatarPrimitive.Root>\n );\n});\nAvatar.displayName = 'Avatar';\n\ntype AvatarElement = React.ElementRef<typeof AvatarPrimitive.Root>;\ntype AvatarOwnProps = GetPropDefTypes<typeof avatarPropDefs>;\n\ninterface AvatarImplProps extends ComponentPropsWithout<typeof AvatarPrimitive.Image, RemovedProps>, AvatarOwnProps {\n // TODO: See if we can automate making prop defs with `required: true` non nullable\n fallback: NonNullable<AvatarOwnProps['fallback']>;\n}\n\ntype AvatarImageProps = Pick<\n AvatarImplProps,\n 'fallback' | 'onLoadingStatusChange' | 'src' | 'alt' | 'srcSet' | 'sizes' | 'crossOrigin' | 'referrerPolicy' | 'loading' | 'decoding' | 'onLoad' | 'onError'\n>;\n\nconst AvatarImpl = React.memo(({ fallback, onLoadingStatusChange, ...imageProps }: AvatarImageProps) => {\n const [status, setStatus] = React.useState<'idle' | 'loading' | 'loaded' | 'error'>('idle');\n\n const handleLoadingStatusChange = React.useCallback(\n (newStatus: 'idle' | 'loading' | 'loaded' | 'error') => {\n onLoadingStatusChange?.(newStatus);\n setStatus(newStatus);\n },\n [onLoadingStatusChange],\n );\n\n return (\n <>\n {status === 'idle' || status === 'loading' ? <span className=\"kui-AvatarFallback\" /> : null}\n\n {status === 'error' ? (\n <AvatarPrimitive.Fallback\n className={classNames('kui-AvatarFallback', {\n 'kui-one-letter': typeof fallback === 'string' && fallback.length === 1,\n 'kui-two-letters': typeof fallback === 'string' && fallback.length === 2,\n })}\n // Named from alt, like the picture it stands in for. Unnamed, it is decorative.\n {...(imageProps.alt ? { role: 'img', 'aria-label': imageProps.alt } : { 'aria-hidden': true })}\n >\n {fallback}\n </AvatarPrimitive.Fallback>\n ) : null}\n\n <AvatarPrimitive.Image className=\"kui-AvatarImage\" {...imageProps} onLoadingStatusChange={handleLoadingStatusChange} />\n </>\n );\n});\n\nAvatarImpl.displayName = 'AvatarImpl';\n\nexport { Avatar };\nexport type { AvatarProps };\n"],
5
- "mappings": ";gKAEA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,UAAUC,MAAuB,WAW1C,IAAMC,EAAe,aAAuC,CAACC,EAAUC,IAAiB,CAEtF,IAAMC,EAAQC,EAAkBH,EAAUI,EAAe,IAAI,EACvD,CACJ,QAAAC,EACA,SAAAC,EACA,UAAAC,EACA,MAAAC,EACA,MAAAC,EACA,OAAAC,EACA,OAAAC,EACA,YAAAC,EACA,MAAAC,EAEA,SAAAC,EACA,sBAAAC,EACA,IAAAC,EACA,IAAAC,EACA,OAAAC,EACA,MAAAC,EACA,YAAAC,EACA,eAAAC,EACA,QAAAC,EACA,SAAAC,EACA,OAAAC,EACA,QAAAC,EAEA,GAAGC,CACL,EAAIC,EAAazB,EAAOE,CAAc,EAChCwB,EAAa,CAAE,SAAAd,EAAU,sBAAAC,EAAuB,IAAAC,EAAK,IAAAC,EAAK,OAAAC,EAAQ,MAAAC,EAAO,YAAAC,EAAa,eAAAC,EAAgB,QAAAC,EAAS,SAAAC,EAAU,OAAAC,EAAQ,QAAAC,CAAQ,EASzII,EAAaxB,GAAWC,GAAY,MAAc,iBAAeA,CAAQ,IAAOA,EAAS,MAAc,WAAa,IAASA,EAAS,MAAc,eAAe,IAAM,IAEzKwB,EAAejB,IAAU,QAAaF,IAAW,OAEjDoB,EACJlB,IAAU,OACR,gBAAC,QAAK,UAAU,mBAAmBA,CAAM,EACvCF,IAAW,OACb,gBAAC,QACC,UAAU,mBACV,oBAAmBA,EACnB,KAAMC,EAAc,MAAQ,OAC5B,aAAYA,GAAe,OAC3B,cAAaA,EAAc,OAAY,GACzC,EACE,KAEN,OACE,gBAACoB,EAAgB,KAAhB,CACE,GAAIN,EACL,IAAKzB,EACL,oBAAmBQ,EACnB,cAAaC,EACb,gBAAemB,GAAc,OAC7B,qBAAoBC,GAAgB,OACpC,UAAWG,EAAW,YAAa,iBAAkB1B,CAAS,EAC9D,MAAOC,EACP,QAASH,GAGR6B,EACC,CAAE,QAAA7B,EAAS,SAAAC,CAAS,EACpB,gCACE,gBAAC6B,EAAA,CAAY,GAAGP,EAAY,EAC3BG,CACH,CACF,CACF,CAEJ,CAAC,EACDhC,EAAO,YAAc,SAerB,IAAMoC,EAAmB,OAAK,CAAC,CAAE,SAAArB,EAAU,sBAAAC,EAAuB,GAAGa,CAAW,IAAwB,CACtG,GAAM,CAACjB,EAAQyB,CAAS,EAAU,WAAkD,MAAM,EAEpFC,EAAkC,cACrCC,GAAuD,CACtDvB,IAAwBuB,CAAS,EACjCF,EAAUE,CAAS,CACrB,EACA,CAACvB,CAAqB,CACxB,EAEA,OACE,gCACGJ,IAAW,QAAUA,IAAW,UAAY,gBAAC,QAAK,UAAU,qBAAqB,EAAK,KAEtFA,IAAW,QACV,gBAACqB,EAAgB,SAAhB,CACC,UAAWC,EAAW,qBAAsB,CAC1C,iBAAkB,OAAOnB,GAAa,UAAYA,EAAS,SAAW,EACtE,kBAAmB,OAAOA,GAAa,UAAYA,EAAS,SAAW,CACzE,CAAC,EAEA,GAAIc,EAAW,IAAM,CAAE,KAAM,MAAO,aAAcA,EAAW,GAAI,EAAI,CAAE,cAAe,EAAK,GAE3Fd,CACH,EACE,KAEJ,gBAACkB,EAAgB,MAAhB,CAAsB,UAAU,kBAAmB,GAAGJ,EAAY,sBAAuBS,EAA2B,CACvH,CAEJ,CAAC,EAEDF,EAAW,YAAc",
6
- "names": ["React", "classNames", "AvatarPrimitive", "Avatar", "ownProps", "forwardedRef", "props", "useThemeSizeProps", "avatarPropDefs", "asChild", "children", "className", "style", "color", "radius", "status", "statusLabel", "badge", "fallback", "onLoadingStatusChange", "src", "alt", "srcSet", "sizes", "crossOrigin", "referrerPolicy", "loading", "decoding", "onLoad", "onError", "rootProps", "extractProps", "imageProps", "isDisabled", "hasIndicator", "indicator", "AvatarPrimitive", "classNames", "getSubtree", "AvatarImpl", "setStatus", "handleLoadingStatusChange", "newStatus"]
7
- }
@@ -1,3 +0,0 @@
1
- "use client";
2
- import{a as p,c as x,e as O,g as E}from"./chunk-XUCR7L4G.js";import{a as b,d as l}from"./chunk-3QWGSRYC.js";import{a as C,b as S,c as R}from"./chunk-VVBSYWUA.js";import{o as I}from"./chunk-GHWEXMF6.js";import{a as v,b as y}from"./chunk-DI7RUMLO.js";import{a as g}from"./chunk-WEBNIUEX.js";import{a as h}from"./chunk-G66WDIIV.js";import*as e from"react";import re from"classnames";import{useComposedRefs as ae}from"radix-ui/internal";var ie={controlled:"open",default:"defaultOpen"},le={initial:"overlay",sm:"fixed"},T=e.forwardRef((N,M)=>{let{className:w,presentation:H=le,defaultOpen:U,open:k,onOpenChange:A,expandedSize:o=320,minSize:d=200,maxSize:c=500,resizable:m=!1,collapsible:B=!0,onExpand:V,onCollapse:L,onResize:_,onResizeStart:D,onResizeEnd:$,snapPoints:t,snapTolerance:q,collapseThreshold:s,paneId:r,persistence:a,children:F,style:W,onSizeChange:j,sizeUpdate:G,sizeUpdateMs:K=50,size:J,defaultSize:Q,inset:u,id:X,...i}=N,{table:P,attributes:Y}=R(H,"fixed"),n=C({name:"inspector",label:"Inspector",propNames:ie,id:X,controlled:p(k),defaultValue:p(U),presentationTable:P,builtIn:x,onChange:(te,se)=>A?.(te!=="closed",{reason:se}),onExpand:V,onCollapse:L,size:o});I("inspector",u),e.useEffect(()=>{(t!==void 0||s!==void 0||r!==void 0||a!==void 0)&&void 0},[t,s,r,a]);let f=e.useRef(null),Z=ae(M,n.setElement,f),ee=v({name:"inspector",elementId:n.id,elementRef:f,cssVarName:"--inspector-size",orientation:"vertical",edge:"start",growth:O,expandedSize:o,minSize:d,maxSize:c,resizable:m,collapsible:B,size:J,defaultSize:Q,onSizeChange:j,sizeUpdate:G,sizeUpdateMs:K,onResize:_,onResizeStart:D,onResizeEnd:$,snapPoints:t,snapTolerance:q,collapseThreshold:s,paneId:r,persistence:a,overlaying:n.overlaying,overlayingNow:()=>P[h()]==="overlay",requestCollapse:()=>n.setValue("closed","toggle"),requestToggle:()=>n.toggle("toggle")}),{handles:z,content:ne}=y(F,l),oe=m&&n.shown!==!1&&!n.overlaying?e.createElement(g.Provider,{value:ee},z.length>0?z:e.createElement(b,null)):null;return e.createElement("div",{...E(i),role:i.role??"complementary",id:n.id,ref:Z,className:re("kui-ShellPane","kui-ShellInspector",w),...S(n,Y),"data-inset":u||void 0,tabIndex:n.overlaying?-1:i.tabIndex,style:{...W,"--inspector-expanded-size":`${o}px`,"--inspector-min-size":`${d}px`,"--inspector-max-size":`${c}px`}},e.createElement("div",{className:"kui-ShellInspectorContent"},ne),oe)});T.displayName="Shell.Inspector";T.Handle=l;export{T as a};
3
- //# sourceMappingURL=chunk-EVCQ6TG5.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/components/_internal/shell-inspector.tsx"],
4
- "sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { useComposedRefs } from 'radix-ui/internal';\nimport { PaneResizeContext } from './shell-resize.js';\nimport { InspectorHandle, PaneHandle } from './shell-handles.js';\nimport { usePane, paneAttributes, usePresentationTable } from './shell-pane.js';\nimport { splitHandles, useResizablePane, type SizeChangeMeta } from './shell-resizable.js';\nimport { useInsetRegistration, warnOnce } from './shell-store.js';\nimport { detailRest, endAnchoredGrowth, toPaneValue, withoutRemovedPaneProps } from './shell-rest.js';\nimport { readBreakpoint } from '../../hooks/use-breakpoint.js';\nimport type { Breakpoint, CSSPropertiesWithVars, PaneBaseProps } from '../shell.types.js';\n\ntype InspectorOpenChangeMeta = { reason: 'init' | 'toggle' | 'responsive' | 'dismiss' };\ntype InspectorControlledProps = { open: boolean | Partial<Record<Breakpoint, boolean>>; onOpenChange?: (open: boolean, meta: InspectorOpenChangeMeta) => void; defaultOpen?: never };\ntype InspectorUncontrolledProps = { defaultOpen?: boolean | Partial<Record<Breakpoint, boolean>>; onOpenChange?: (open: boolean, meta: InspectorOpenChangeMeta) => void; open?: never };\ntype InspectorSizeControlledProps = { size: number | string; defaultSize?: never };\ntype InspectorSizeUncontrolledProps = { defaultSize?: number | string; size?: never };\ntype InspectorPublicProps = PaneBaseProps &\n (InspectorControlledProps | InspectorUncontrolledProps) &\n (InspectorSizeControlledProps | InspectorSizeUncontrolledProps) & {\n onSizeChange?: (size: number, meta: SizeChangeMeta) => void;\n sizeUpdate?: 'throttle' | 'debounce';\n sizeUpdateMs?: number;\n /** When true, adds margin and triggers the gray backdrop on the Shell. */\n inset?: boolean;\n };\n\ntype InspectorComponent = React.ForwardRefExoticComponent<InspectorPublicProps & React.RefAttributes<HTMLDivElement>> & { Handle: typeof InspectorHandle };\n\nconst INSPECTOR_PROP_NAMES = { controlled: 'open', default: 'defaultOpen' };\n\n/** Since 0.8.0 the Inspector is in the frame from 768px up, the boundary kookie-ui-v2 uses everywhere. It was 1280px. */\nconst INSPECTOR_DEFAULT_PRESENTATION = { initial: 'overlay', sm: 'fixed' } as const;\n\nexport const Inspector = React.forwardRef<HTMLDivElement, InspectorPublicProps>((props, ref) => {\n const {\n className,\n presentation = INSPECTOR_DEFAULT_PRESENTATION,\n defaultOpen,\n open,\n onOpenChange,\n expandedSize = 320,\n minSize = 200,\n maxSize = 500,\n resizable = false,\n collapsible = true,\n onExpand,\n onCollapse,\n onResize,\n onResizeStart,\n onResizeEnd,\n snapPoints,\n snapTolerance,\n collapseThreshold,\n paneId,\n persistence,\n children,\n style,\n onSizeChange,\n sizeUpdate,\n sizeUpdateMs = 50,\n size,\n defaultSize,\n inset,\n id,\n ...domProps\n } = props;\n\n const { table, attributes } = usePresentationTable(presentation, 'fixed');\n const pane = usePane({\n name: 'inspector',\n label: 'Inspector',\n propNames: INSPECTOR_PROP_NAMES,\n id,\n controlled: toPaneValue(open),\n defaultValue: toPaneValue(defaultOpen),\n presentationTable: table,\n builtIn: detailRest,\n onChange: (value, reason) => onOpenChange?.(value !== 'closed', { reason }),\n onExpand,\n onCollapse,\n size: expandedSize,\n });\n useInsetRegistration('inspector', inset);\n\n React.useEffect(() => {\n if (snapPoints !== undefined || collapseThreshold !== undefined || paneId !== undefined || persistence !== undefined) {\n warnOnce('Shell.Inspector: `snapPoints`, `collapseThreshold`, `paneId` and `persistence` are deprecated and are removed in 1.0. Keep the size in your own state with `size`/`onSizeChange`.');\n }\n }, [snapPoints, collapseThreshold, paneId, persistence]);\n\n const elementRef = React.useRef<HTMLElement | null>(null);\n const composedRef = useComposedRefs(ref, pane.setElement, elementRef);\n\n const resize = useResizablePane({\n name: 'inspector',\n elementId: pane.id,\n elementRef,\n cssVarName: '--inspector-size',\n orientation: 'vertical',\n edge: 'start',\n growth: endAnchoredGrowth,\n expandedSize,\n minSize,\n maxSize,\n resizable,\n collapsible,\n size,\n defaultSize,\n onSizeChange,\n sizeUpdate,\n sizeUpdateMs,\n onResize,\n onResizeStart,\n onResizeEnd,\n snapPoints,\n snapTolerance,\n collapseThreshold,\n paneId,\n persistence,\n overlaying: pane.overlaying,\n overlayingNow: () => table[readBreakpoint()] === 'overlay',\n requestCollapse: () => pane.setValue('closed', 'toggle'),\n requestToggle: () => pane.toggle('toggle'),\n });\n\n const { handles, content } = splitHandles(children, InspectorHandle);\n const handle = resizable && pane.shown !== false && !pane.overlaying ? <PaneResizeContext.Provider value={resize}>{handles.length > 0 ? handles : <PaneHandle />}</PaneResizeContext.Provider> : null;\n\n return (\n <div\n {...withoutRemovedPaneProps(domProps)}\n role={domProps.role ?? 'complementary'}\n id={pane.id}\n ref={composedRef}\n className={classNames('kui-ShellPane', 'kui-ShellInspector', className)}\n {...paneAttributes(pane, attributes)}\n data-inset={inset || undefined}\n tabIndex={pane.overlaying ? -1 : domProps.tabIndex}\n style={\n {\n ...style,\n '--inspector-expanded-size': `${expandedSize}px`,\n '--inspector-min-size': `${minSize}px`,\n '--inspector-max-size': `${maxSize}px`,\n } as CSSPropertiesWithVars\n }\n >\n <div className=\"kui-ShellInspectorContent\">{content}</div>\n {handle}\n </div>\n );\n}) as InspectorComponent;\n\nInspector.displayName = 'Shell.Inspector';\nInspector.Handle = InspectorHandle;\n\nexport type { InspectorPublicProps };\n"],
5
- "mappings": ";yUAEA,UAAYA,MAAW,QACvB,OAAOC,OAAgB,aACvB,OAAS,mBAAAC,OAAuB,oBA2BhC,IAAMC,GAAuB,CAAE,WAAY,OAAQ,QAAS,aAAc,EAGpEC,GAAiC,CAAE,QAAS,UAAW,GAAI,OAAQ,EAE5DC,EAAkB,aAAiD,CAACC,EAAOC,IAAQ,CAC9F,GAAM,CACJ,UAAAC,EACA,aAAAC,EAAeL,GACf,YAAAM,EACA,KAAAC,EACA,aAAAC,EACA,aAAAC,EAAe,IACf,QAAAC,EAAU,IACV,QAAAC,EAAU,IACV,UAAAC,EAAY,GACZ,YAAAC,EAAc,GACd,SAAAC,EACA,WAAAC,EACA,SAAAC,EACA,cAAAC,EACA,YAAAC,EACA,WAAAC,EACA,cAAAC,EACA,kBAAAC,EACA,OAAAC,EACA,YAAAC,EACA,SAAAC,EACA,MAAAC,EACA,aAAAC,EACA,WAAAC,EACA,aAAAC,EAAe,GACf,KAAAC,EACA,YAAAC,EACA,MAAAC,EACA,GAAAC,EACA,GAAGC,CACL,EAAI/B,EAEE,CAAE,MAAAgC,EAAO,WAAAC,CAAW,EAAIC,EAAqB/B,EAAc,OAAO,EAClEgC,EAAOC,EAAQ,CACnB,KAAM,YACN,MAAO,YACP,UAAWvC,GACX,GAAAiC,EACA,WAAYO,EAAYhC,CAAI,EAC5B,aAAcgC,EAAYjC,CAAW,EACrC,kBAAmB4B,EACnB,QAASM,EACT,SAAU,CAACC,GAAOC,KAAWlC,IAAeiC,KAAU,SAAU,CAAE,OAAAC,EAAO,CAAC,EAC1E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S,OACrB,SAAUM,EAAK,WAAa,GAAKJ,EAAS,SAC1C,MACE,CACE,GAAGR,EACH,4BAA6B,GAAGhB,CAAY,KAC5C,uBAAwB,GAAGC,CAAO,KAClC,uBAAwB,GAAGC,CAAO,IACpC,GAGF,gBAAC,OAAI,UAAU,6BAA6ByC,EAAQ,EACnDG,EACH,CAEJ,CAAC,EAEDtD,EAAU,YAAc,kBACxBA,EAAU,OAASqD",
6
- "names": ["React", "classNames", "useComposedRefs", "INSPECTOR_PROP_NAMES", "INSPECTOR_DEFAULT_PRESENTATION", "Inspector", "props", "ref", "className", "presentation", "defaultOpen", "open", "onOpenChange", "expandedSize", "minSize", "maxSize", "resizable", "collapsible", "onExpand", "onCollapse", "onResize", "onResizeStart", "onResizeEnd", "snapPoints", "snapTolerance", "collapseThreshold", "paneId", "persistence", "children", "style", "onSizeChange", "sizeUpdate", "sizeUpdateMs", "size", "defaultSize", "inset", "id", "domProps", "table", "attributes", "usePresentationTable", "pane", "usePane", "toPaneValue", "detailRest", "value", "reason", "useInsetRegistration", "elementRef", "composedRef", "useComposedRefs", "resize", "useResizablePane", "endAnchoredGrowth", "readBreakpoint", "handles", "content", "splitHandles", "InspectorHandle", "handle", "PaneResizeContext", "PaneHandle", "withoutRemovedPaneProps", "classNames", "paneAttributes"]
7
- }
@@ -1,3 +0,0 @@
1
- "use client";
2
- import{a as x}from"./chunk-WMZLMZHB.js";import{a as X,b as oo,c as eo,e as H,f as to,i as ro,l as no}from"./chunk-E4EMG3RC.js";import{a as k}from"./chunk-UZAS4PYM.js";import{a as Q}from"./chunk-6UZT3ZLO.js";import{g as J}from"./chunk-EAIQIW23.js";import{a as q}from"./chunk-7N2Q5WOM.js";import{b as L}from"./chunk-2IUGM657.js";import{c as Z}from"./chunk-OKQAVYW4.js";import*as o from"react";import{useLayoutEffect as C}from"radix-ui/internal";import h from"classnames";import{Toolbar as B}from"radix-ui";var M=o.createContext(null),F=o.createContext(null),D=o.createContext(!1);function ko(){return o.useContext(D)}var W=o.forwardRef((e,t)=>{let r=J(),a=L(e.size??r??void 0,x.size),s=e.orientation??x.orientation.default,{className:l,orientation:n,backdrop:i=!1,children:p,...d}=Z({...e,size:a},x,q),u=o.useMemo(()=>({size:a,orientation:s,backdrop:i}),[a,s,i]);return o.createElement(B.Root,{...d,ref:t,orientation:s,"data-backdrop":i||void 0,className:h("kui-Toolbar",l)},o.createElement(M.Provider,{value:u},p))});W.displayName="Toolbar";var so=o.forwardRef(({className:e,disabled:t=!1,children:r,...a},s)=>{let l=o.useContext(M),n=o.useContext(D),i=o.useMemo(()=>({disabled:t}),[t]);return n?o.createElement(to,{...a,ref:s,className:e},o.createElement(F.Provider,{value:i},r)):o.createElement("div",{role:"group","data-orientation":l?.orientation??"horizontal","data-disabled":t||void 0,...a,ref:s,className:h("kui-ToolbarGroup",e)},o.createElement(F.Provider,{value:i},r))});so.displayName="Toolbar.Group";function ao(e){return e===!0||e==="true"}function bo(e){return o.isValidElement(e)&&e.type==="button"}var j=o.forwardRef((e,t)=>{let r=o.useContext(M),a=o.useContext(F),s=o.useContext(D),{iconOnly:l,size:n,variant:i,emphasis:p,color:d,disabled:u,asChild:v,onKeyDown:S,...f}=e,R=u||a?.disabled||void 0;if(s)return o.createElement(lo,{id:f.id,className:f.className,style:f.style,onClick:f.onClick,"aria-label":f["aria-label"],ref:t,asChild:v,iconOnly:l,disabled:R,color:d,pressed:e["aria-pressed"]===void 0?void 0:ao(e["aria-pressed"])},f.children);let E=r?.orientation==="vertical"&&S?y=>{y.key==="ArrowDown"||y.key==="ArrowUp"||S(y)}:S,z=ao(e["aria-pressed"]),c="data-state"in e||e["aria-pressed"]===void 0?{}:{"data-state":z?"on":"off"},b={size:n??r?.size,...p!==void 0?{emphasis:p}:{variant:i??(a?"ghost":r?.backdrop?"raised":"soft")},color:d??(i||p?void 0:"gray"),...c},T={...f,...l?{iconOnly:!0}:{},...v?{asChild:!0}:{},...E?{onKeyDown:E}:{},...b};return r?v&&!bo(f.children)?o.createElement(B.Link,{asChild:!0,ref:t},o.createElement(k,{...T,disabled:R})):o.createElement(B.Button,{asChild:!0,ref:t,disabled:R},o.createElement(k,{...T})):o.createElement(k,{...T,ref:t,disabled:R})});j.displayName="Toolbar.Button";var lo=o.forwardRef(({asChild:e,iconOnly:t,disabled:r,color:a,pressed:s,children:l,"aria-label":n,...i},p)=>{let d=t?n:void 0,u={...i,...t?{}:n?{"aria-label":n}:{},disabled:r,...a?{color:a}:{}};if(e&&o.isValidElement(l)){let v=d?o.cloneElement(l,void 0,l.props.children,o.createElement("span",null,d)):l;return o.createElement(H,{...u,ref:p,asChild:!0},v)}return s!==void 0?o.createElement(ro,{...u,ref:p,checked:s},l,d):o.createElement(H,{...u,ref:p},l,d)});lo.displayName="Toolbar.OverflowItem";function To(){return o.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentcolor","aria-hidden":!0,xmlns:"http://www.w3.org/2000/svg"},o.createElement("circle",{cx:"3.25",cy:"8",r:"1.25"}),o.createElement("circle",{cx:"8",cy:"8",r:"1.25"}),o.createElement("circle",{cx:"12.75",cy:"8",r:"1.25"}))}var io=o.forwardRef(({label:e="More",className:t,children:r,...a},s)=>{let l=o.Children.toArray(r),n=l.length,i=o.useRef(null),p=o.useRef([]),d=o.useRef(0),[u,v]=o.useState(n),[S,f]=o.useState(0),[R,E]=o.useState(n);R!==n&&(E(n),v(n)),C(()=>{p.current=[]},[n]),C(()=>{let c=i.current;if(!c)return;let b=Array.from(c.children),T=Math.min(u,n);for(let m=0;m<T;m++){let P=b[m];P&&(p.current[m]=P.offsetWidth)}let y=b[T];y&&(d.current=y.offsetWidth);let I=Number.parseFloat(getComputedStyle(c).columnGap)||0,V=c.clientWidth,K=0,_=0;for(let m=0;m<n;m++){let P=p.current[m];if(P===void 0)return;P!==0&&(K+=P+(_>0?I:0),_+=1)}let O=n;if(K>V){let m=V-(d.current||c.clientHeight)-I,P=0,$=0;O=0;for(let G=0;G<n;G++){let U=p.current[G];if(U>0){let Y=U+($>0?I:0);if(P+Y>m)break;P+=Y,$+=1}O+=1}}O!==u&&v(O)},[u,n,S]),o.useEffect(()=>{let c=i.current;if(!c||typeof ResizeObserver>"u")return;let b=new ResizeObserver(()=>f(T=>T+1));b.observe(c);for(let T of Array.from(c.children))b.observe(T);return()=>b.disconnect()},[u,n]);let z=o.useCallback(c=>{i.current=c,typeof s=="function"?s(c):s&&(s.current=c)},[s]);return o.createElement("div",{...a,ref:z,className:h("kui-ToolbarOverflow",t)},l.slice(0,u).map((c,b)=>o.createElement("div",{key:b,className:"kui-ToolbarOverflowSeat"},c)),u<n?o.createElement(X,null,o.createElement(oo,null,o.createElement(j,{iconOnly:!0,"aria-label":e},o.createElement(To,null))),o.createElement(eo,{align:"end"},o.createElement(D.Provider,{value:!0},l.slice(u)))):null)});io.displayName="Toolbar.Overflow";var A=[],w=new Map,N=new Set,g=new Map;function mo(e){return N.add(e),()=>{N.delete(e)}}function Po(e,t,r){let a=w.get(e)??A,l=a.findIndex(n=>n.id===t)===-1?[...a,{id:t,node:r}]:a.map(n=>n.id===t?{id:t,node:r}:n);w.set(e,l),N.forEach(n=>n())}function vo(e,t){let r=w.get(e);if(!r)return;let a=r.filter(s=>s.id!==t);a.length===0?w.delete(e):w.set(e,a),N.forEach(s=>s())}function co({name:e="default"}){C(()=>{let r=(g.get(e)??0)+1;return g.set(e,r),r>1,()=>{let a=(g.get(e)??1)-1;a>0?g.set(e,a):g.delete(e)}},[e]);let t=o.useSyncExternalStore(mo,()=>w.get(e)??A,()=>A);return o.createElement(o.Fragment,null,t.map(r=>o.createElement(o.Fragment,{key:r.id},r.node)))}co.displayName="Toolbar.Slot";function uo({name:e="default",children:t}){let r=o.useId();return C(()=>{Po(e,r,t)},[e,r,t]),C(()=>()=>vo(e,r),[e,r]),null}uo.displayName="Toolbar.Fill";var po=o.forwardRef(({className:e,...t},r)=>{let a=o.useContext(M);return o.useContext(D)?o.createElement(no,{...t,ref:r,className:e}):a?o.createElement(B.Separator,{...t,ref:r,className:h("kui-ToolbarSeparator",e)}):o.createElement("div",{role:"separator","aria-orientation":"vertical","data-orientation":"vertical",...t,ref:r,className:h("kui-ToolbarSeparator",e)})});po.displayName="Toolbar.Separator";var Ro={1:"2",2:"3",3:"4",4:"5"},fo=o.forwardRef(({className:e,children:t,style:r,id:a},s)=>{let l=o.useContext(M),n=L(void 0,x.size),i=l?.size??n;return t==null||t===!1?null:o.createElement(Q,{ref:s,as:"span",size:Ro[i],weight:"medium",truncate:!0,id:a,style:r,className:h("kui-ToolbarTitle",e)},t)});fo.displayName="Toolbar.Title";var Bo=Object.assign(W,{Root:W,Group:so,Button:j,Separator:po,Title:fo,Overflow:io,Slot:co,Fill:uo});export{ko as a,W as b,so as c,j as d,io as e,co as f,uo as g,po as h,fo as i,Bo as j};
3
- //# sourceMappingURL=chunk-G32GSPNO.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/components/toolbar.tsx"],
4
- "sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport { useLayoutEffect } from 'radix-ui/internal';\nimport classNames from 'classnames';\nimport { Toolbar as ToolbarPrimitive } from 'radix-ui';\n\nimport { toolbarRootPropDefs } from './toolbar.props.js';\nimport { Button } from './button.js';\nimport * as DropdownMenu from './dropdown-menu.js';\nimport { Text } from './text.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSize } from '../helpers/theme-size.js';\nimport { layoutPropDefs } from '../props/layout.props.js';\nimport { usePaneBandSize } from './_internal/pane-chrome.js';\n\nimport type { ButtonProps } from './button.js';\nimport type { LayoutProps } from '../props/layout.props.js';\nimport type { TextProps } from './text.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\nimport type { ButtonRankProps } from './button.js';\n\n/*\n * Toolbar takes Kookie UI v2's contract (v2: components/toolbar), built on Radix instead of\n * Base UI. A toolbar is a row of controls with ONE tab stop: `role=\"toolbar\"`, and the arrow\n * keys move focus between its controls. That keyboard is the reason it is a component.\n *\n * Its `size` reaches every control inside it that does not state its own. The row itself paints\n * nothing; a `ToolbarGroup` draws a quiet well around controls that belong together, and a\n * `ToolbarSeparator` draws a gray hairline between clusters. Use a `Flex` to cluster controls\n * without a well: the row spaces the clusters with `space-between`.\n */\n\ntype ToolbarSize = NonNullable<GetPropDefTypes<typeof toolbarRootPropDefs>['size']>;\ntype ToolbarOrientation = NonNullable<GetPropDefTypes<typeof toolbarRootPropDefs>['orientation']>;\n\ninterface ToolbarContextValue {\n size: ToolbarSize;\n orientation: ToolbarOrientation;\n backdrop: boolean;\n}\n\nconst ToolbarContext = React.createContext<ToolbarContextValue | null>(null);\n\n/** Set by a `ToolbarGroup`: its children rest quiet, and `disabled` turns them all off. */\nconst ToolbarGroupContext = React.createContext<{ disabled: boolean } | null>(null);\n\n/**\n * True while a subtree is drawn into a `ToolbarOverflow`'s menu instead of into the row (v2\n * `InOverflow`). The parts answer it themselves: a `ToolbarButton` renders a menu item, a\n * `ToolbarGroup` a menu group, a `ToolbarSeparator` a menu separator.\n */\nconst InOverflowContext = React.createContext(false);\n\n/**\n * True while this subtree is drawn into a `ToolbarOverflow`'s \"More\" menu instead of the row.\n *\n * The toolbar's own parts handle this already. Use it in your own component inside a\n * `ToolbarOverflow` to render a different form in the menu.\n */\nfunction useToolbarOverflow(): boolean {\n return React.useContext(InOverflowContext);\n}\n\n// ============================================================================\n// Toolbar (root)\n// ============================================================================\n\ntype ToolbarOwnProps = GetPropDefTypes<typeof toolbarRootPropDefs>;\n\ninterface ToolbarProps\n extends ComponentPropsWithout<typeof ToolbarPrimitive.Root, RemovedProps | 'orientation'>,\n ToolbarOwnProps,\n LayoutProps {\n /**\n * Gives every control a surface of its own, for a row that content passes behind, such as\n * `Shell.PaneHeader float`. Buttons rest `raised` instead of `soft`, and a group's well is\n * solid and raised.\n */\n backdrop?: boolean;\n}\n\n/**\n * A row of controls with one keyboard tab stop. The arrow keys move focus between the controls.\n *\n * Give it an `aria-label` (or `aria-labelledby`) that says what the controls act on.\n *\n * @example\n * ```tsx\n * <Toolbar aria-label=\"Formatting\">\n * <ToolbarGroup>\n * <ToolbarButton iconOnly aria-label=\"Bold\" aria-pressed={bold} onClick={toggleBold}>\n * <HugeiconsIcon icon={TextBoldIcon} strokeWidth={1.75} />\n * </ToolbarButton>\n * </ToolbarGroup>\n * <ToolbarSeparator />\n * <ToolbarButton>Share</ToolbarButton>\n * </Toolbar>\n * ```\n */\nconst ToolbarRoot = React.forwardRef<HTMLDivElement, ToolbarProps>((props, forwardedRef) => {\n // Inside a Shell (a pane's header or footer, or the content area), a toolbar with no size\n // rests one step above the Shell's. A pane's scrolling list has no band.\n const band = usePaneBandSize();\n // Elsewhere it takes the nearest Theme's size.\n const size: ToolbarSize = useThemeSize(props.size ?? band ?? undefined, toolbarRootPropDefs.size);\n const orientation: ToolbarOrientation = props.orientation ?? toolbarRootPropDefs.orientation.default;\n const { className, orientation: _orientation, backdrop = false, children, ...rootProps } = extractProps(\n { ...props, size },\n toolbarRootPropDefs,\n layoutPropDefs,\n );\n\n const context = React.useMemo(() => ({ size, orientation, backdrop }), [size, orientation, backdrop]);\n\n return (\n <ToolbarPrimitive.Root\n {...rootProps}\n ref={forwardedRef}\n orientation={orientation}\n data-backdrop={backdrop || undefined}\n className={classNames('kui-Toolbar', className)}\n >\n <ToolbarContext.Provider value={context}>{children}</ToolbarContext.Provider>\n </ToolbarPrimitive.Root>\n );\n});\nToolbarRoot.displayName = 'Toolbar';\n\n// ============================================================================\n// ToolbarGroup\n// ============================================================================\n\ninterface ToolbarGroupProps extends ComponentPropsWithout<'div', RemovedProps> {\n /** Turns every control in the group off at once. */\n disabled?: boolean;\n}\n\n/**\n * Controls that belong together, drawn as one quiet well that stands level with a button\n * beside it. Buttons inside it rest as `ghost` unless they state a `variant`.\n * To cluster controls without a well, use a `Flex`.\n *\n * In a `ToolbarOverflow`'s menu it is a menu group. Outside a `Toolbar` (rendered through a\n * portal, for example) it still draws its well, as a horizontal group.\n */\nconst ToolbarGroup = React.forwardRef<HTMLDivElement, ToolbarGroupProps>(\n ({ className, disabled = false, children, ...props }, forwardedRef) => {\n const toolbar = React.useContext(ToolbarContext);\n const overflow = React.useContext(InOverflowContext);\n const group = React.useMemo(() => ({ disabled }), [disabled]);\n\n if (overflow) {\n return (\n <DropdownMenu.Group {...props} ref={forwardedRef} className={className}>\n <ToolbarGroupContext.Provider value={group}>{children}</ToolbarGroupContext.Provider>\n </DropdownMenu.Group>\n );\n }\n\n return (\n <div\n role=\"group\"\n data-orientation={toolbar?.orientation ?? 'horizontal'}\n data-disabled={disabled || undefined}\n {...props}\n ref={forwardedRef}\n className={classNames('kui-ToolbarGroup', className)}\n >\n <ToolbarGroupContext.Provider value={group}>{children}</ToolbarGroupContext.Provider>\n </div>\n );\n },\n);\nToolbarGroup.displayName = 'Toolbar.Group';\n\n// ============================================================================\n// ToolbarButton\n// ============================================================================\n\ntype ToolbarButtonBaseProps = Omit<ButtonProps, 'as' | 'variant' | 'emphasis'>;\n\n/** A labelled button: takes every `Button` prop. */\ntype ToolbarTextButtonProps = ToolbarButtonBaseProps &\n ButtonRankProps & {\n iconOnly?: false;\n};\n\n/** An icon-only button: renders `Button iconOnly`, and the type requires an `aria-label`. */\ntype ToolbarIconButtonProps = Omit<ToolbarButtonBaseProps, 'aria-label' | 'aria-labelledby' | 'fullWidth'> &\n ButtonRankProps & {\n iconOnly: true;\n /** The control's accessible name. An icon has no words of its own, so this is required. */\n 'aria-label': string;\n};\n\ntype ToolbarButtonProps = ToolbarTextButtonProps | ToolbarIconButtonProps;\n\nfunction isPressed(value: React.AriaAttributes['aria-pressed']) {\n return value === true || value === 'true';\n}\n\n/** Does an `asChild` child render a native `<button>`? Only then is it a Radix Toolbar.Button. */\nfunction isButtonElement(children: React.ReactNode) {\n return React.isValidElement(children) && children.type === 'button';\n}\n\n/**\n * A `Button` that joins the toolbar's keyboard navigation, so a row of them is one tab stop.\n *\n * Set `iconOnly` (with an `aria-label`) for a symbol-only control. Set `aria-pressed` for a\n * control that toggles; a pressed button wears Button's pressed look. Set `asChild` to render\n * your own element, such as a link: `<ToolbarButton asChild><a href=\"/docs\">Docs</a></ToolbarButton>`.\n * A link stays in the arrow-key row and gets no `type` attribute.\n *\n * It takes the toolbar's `size`, and rests as a gray `soft` button (`raised` in a toolbar with\n * `backdrop`, gray `ghost` inside a `ToolbarGroup`). A stated `size`, `variant` or `color` wins; a\n * stated `variant` without a `color` takes Button's own default colour.\n *\n * In a `ToolbarOverflow`'s menu it renders a menu item; an icon-only button uses its\n * `aria-label` as the item's text. Outside a `Toolbar` (rendered through a React portal, for\n * example) it renders a plain Button with the same rest look, as its own tab stop. Use\n * `ToolbarSlot` and `ToolbarFill` for a control that should join the row's arrow keys.\n */\nconst ToolbarButton = React.forwardRef<HTMLButtonElement, ToolbarButtonProps>((props, forwardedRef) => {\n const toolbar = React.useContext(ToolbarContext);\n const group = React.useContext(ToolbarGroupContext);\n const overflow = React.useContext(InOverflowContext);\n const { iconOnly, size, variant, emphasis, color, disabled, asChild, onKeyDown, ...rest } = props;\n const off = disabled || group?.disabled || undefined;\n\n if (overflow) {\n return (\n <ToolbarOverflowItem\n // Only what a menu row means comes across; Button's box props (size, loading,\n // tooltip, fullWidth and the rest) would land on the DOM as unknown attributes.\n id={rest.id}\n className={rest.className}\n style={rest.style}\n onClick={rest.onClick as React.MouseEventHandler<HTMLDivElement> | undefined}\n aria-label={rest['aria-label']}\n ref={forwardedRef as unknown as React.Ref<HTMLDivElement>}\n asChild={asChild}\n iconOnly={iconOnly}\n disabled={off}\n color={color}\n pressed={props['aria-pressed'] === undefined ? undefined : isPressed(props['aria-pressed'])}\n >\n {rest.children}\n </ToolbarOverflowItem>\n );\n }\n\n // In a vertical toolbar, Up and Down belong to the toolbar. A menu trigger rendering this\n // hands its open-on-arrow handler in through `onKeyDown`; those two keys skip it (v2).\n const handleKeyDown =\n toolbar?.orientation === 'vertical' && onKeyDown\n ? (event: React.KeyboardEvent<HTMLButtonElement>) => {\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') return;\n onKeyDown(event);\n }\n : onKeyDown;\n\n const pressed = isPressed(props['aria-pressed']);\n const stateProps =\n 'data-state' in props || props['aria-pressed'] === undefined ? {} : { 'data-state': pressed ? 'on' : 'off' };\n\n const shared = {\n size: size ?? toolbar?.size,\n // A caller states the look by `variant` or the rank by `emphasis`, never both.\n ...(emphasis !== undefined\n ? { emphasis }\n : { variant: variant ?? (group ? 'ghost' : toolbar?.backdrop ? 'raised' : 'soft') }),\n // The gray rest is a pair with the default variant: a caller who states a variant or an\n // emphasis gets Button's own colour for it unless they state a colour too.\n color: color ?? (variant || emphasis ? undefined : 'gray'),\n ...stateProps,\n } as const;\n\n // The text and icon-only branches share every prop but the name; one Button renders both.\n const buttonProps = {\n ...rest,\n ...(iconOnly ? { iconOnly: true } : {}),\n ...(asChild ? { asChild: true } : {}),\n ...(handleKeyDown ? { onKeyDown: handleKeyDown } : {}),\n ...shared,\n } as ButtonProps;\n\n // Outside a toolbar there is no row to join: a plain Button, not a throw.\n if (!toolbar) {\n return <Button {...buttonProps} ref={forwardedRef} disabled={off} />;\n }\n\n // A link (or any non-button child) joins the row as a Radix Toolbar.Link, which sets no\n // `type`. Toolbar.Button would stamp `type=\"button\"` on it.\n if (asChild && !isButtonElement(rest.children)) {\n return (\n <ToolbarPrimitive.Link asChild ref={forwardedRef as unknown as React.Ref<HTMLAnchorElement>}>\n <Button {...buttonProps} disabled={off} />\n </ToolbarPrimitive.Link>\n );\n }\n\n return (\n <ToolbarPrimitive.Button asChild ref={forwardedRef} disabled={off}>\n <Button {...buttonProps} />\n </ToolbarPrimitive.Button>\n );\n});\nToolbarButton.displayName = 'Toolbar.Button';\n\ninterface ToolbarOverflowItemProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'onSelect' | 'color'> {\n asChild?: boolean;\n iconOnly?: boolean;\n disabled?: boolean;\n color?: ButtonProps['color'];\n /** A toggle's pressed state. A toggle becomes a checkbox item, so the menu still says whether it is on. */\n pressed?: boolean;\n}\n\n/**\n * A ToolbarButton drawn into the overflow menu: the same element, as a menu item. An icon-only\n * button's `aria-label` becomes the item's text beside its icon, since a menu row has room for\n * words. What prices a box (size, variant, emphasis, iconOnly) does not come across.\n */\nconst ToolbarOverflowItem = React.forwardRef<HTMLDivElement, ToolbarOverflowItemProps>(\n ({ asChild, iconOnly, disabled, color, pressed, children, 'aria-label': label, ...props }, forwardedRef) => {\n const words = iconOnly ? label : undefined;\n const itemProps = {\n ...props,\n ...(iconOnly ? {} : label ? { 'aria-label': label } : {}),\n disabled,\n ...(color ? { color: color as DropdownMenu.ItemProps['color'] } : {}),\n };\n if (asChild && React.isValidElement<{ children?: React.ReactNode }>(children)) {\n const child = words\n ? React.cloneElement(children, undefined, children.props.children, <span>{words}</span>)\n : children;\n return (\n <DropdownMenu.Item {...itemProps} ref={forwardedRef} asChild>\n {child}\n </DropdownMenu.Item>\n );\n }\n if (pressed !== undefined) {\n return (\n <DropdownMenu.CheckboxItem {...itemProps} ref={forwardedRef} checked={pressed}>\n {children}\n {words}\n </DropdownMenu.CheckboxItem>\n );\n }\n return (\n <DropdownMenu.Item {...itemProps} ref={forwardedRef}>\n {children}\n {words}\n </DropdownMenu.Item>\n );\n },\n);\nToolbarOverflowItem.displayName = 'Toolbar.OverflowItem';\n\n// ============================================================================\n// ToolbarOverflow\n// ============================================================================\n\ninterface ToolbarOverflowProps extends ComponentPropsWithout<'div', RemovedProps> {\n /** The accessible name of the \"More\" button. Defaults to `More`. */\n label?: string;\n /** The controls in the cluster, in order. The ones that don't fit move into the \"More\" menu. */\n children?: React.ReactNode;\n}\n\n/** Three filled dots for the \"More\" button. Internal, so the library carries no icon set. */\nfunction MoreIcon() {\n return (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentcolor\" aria-hidden xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"3.25\" cy=\"8\" r=\"1.25\" />\n <circle cx=\"8\" cy=\"8\" r=\"1.25\" />\n <circle cx=\"12.75\" cy=\"8\" r=\"1.25\" />\n </svg>\n );\n}\n\n/**\n * A cluster of controls that collapses into a \"More\" menu when the row runs out of room.\n *\n * It takes the room the row leaves, and when its controls don't fit, they move into the menu\n * from the end of the cluster. A `ToolbarButton` shows as a menu item there, and a\n * `ToolbarGroup` as a menu group. Use `useToolbarOverflow()` in your own components to render a\n * different form in the menu.\n *\n * It measures on mount and on resize (v2 ToolbarOverflow): each control's width is cached while\n * it is in the row, since a hidden control has no width to measure.\n */\nconst ToolbarOverflow = React.forwardRef<HTMLDivElement, ToolbarOverflowProps>(\n ({ label = 'More', className, children, ...props }, forwardedRef) => {\n const items = React.Children.toArray(children);\n const count = items.length;\n\n const rootRef = React.useRef<HTMLDivElement | null>(null);\n const widths = React.useRef<number[]>([]);\n const triggerWidth = React.useRef(0);\n const [shown, setShown] = React.useState(count);\n const [tick, setTick] = React.useState(0);\n\n // A different set of children is a different set of widths: show them all and measure again.\n const [measuredCount, setMeasuredCount] = React.useState(count);\n if (measuredCount !== count) {\n setMeasuredCount(count);\n setShown(count);\n }\n useLayoutEffect(() => {\n widths.current = [];\n }, [count]);\n\n useLayoutEffect(() => {\n const root = rootRef.current;\n if (!root) return;\n\n // The root's children are one seat per visible child, then the trigger.\n const kids = Array.from(root.children) as HTMLElement[];\n const visible = Math.min(shown, count);\n for (let i = 0; i < visible; i++) {\n const el = kids[i];\n if (el) widths.current[i] = el.offsetWidth;\n }\n const trigger = kids[visible];\n if (trigger) triggerWidth.current = trigger.offsetWidth;\n\n const gap = Number.parseFloat(getComputedStyle(root).columnGap) || 0;\n const available = root.clientWidth;\n\n let total = 0;\n let counted = 0;\n for (let i = 0; i < count; i++) {\n const width = widths.current[i];\n // Never seen in the row, so there is nothing to decide with yet.\n if (width === undefined) return;\n // An empty seat leaves the layout, so it spends no gap.\n if (width === 0) continue;\n total += width + (counted > 0 ? gap : 0);\n counted += 1;\n }\n\n let next = count;\n if (total > available) {\n // Before the trigger exists, the row's height stands in for its width: an icon-only\n // button is square. The next pass, before paint, corrects it.\n const budget = available - (triggerWidth.current || root.clientHeight) - gap;\n let used = 0;\n let drawn = 0;\n next = 0;\n for (let i = 0; i < count; i++) {\n const own = widths.current[i]!;\n if (own > 0) {\n const width = own + (drawn > 0 ? gap : 0);\n if (used + width > budget) break;\n used += width;\n drawn += 1;\n }\n next += 1;\n }\n }\n if (next !== shown) setShown(next);\n }, [shown, count, tick]);\n\n // Watch the row and every seat in it: a control whose content changes (a page's actions\n // arriving after navigation) changes its width without the row's width changing.\n React.useEffect(() => {\n const root = rootRef.current;\n if (!root || typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(() => setTick((n) => n + 1));\n observer.observe(root);\n for (const seat of Array.from(root.children)) observer.observe(seat);\n return () => observer.disconnect();\n }, [shown, count]);\n\n const attach = React.useCallback(\n (node: HTMLDivElement | null) => {\n rootRef.current = node;\n if (typeof forwardedRef === 'function') forwardedRef(node);\n else if (forwardedRef) forwardedRef.current = node;\n },\n [forwardedRef],\n );\n\n return (\n <div {...props} ref={attach} className={classNames('kui-ToolbarOverflow', className)}>\n {items.slice(0, shown).map((item, i) => (\n // The seat is a position in the row, so its key is the index.\n <div key={i} className=\"kui-ToolbarOverflowSeat\">\n {item}\n </div>\n ))}\n {shown < count ? (\n <DropdownMenu.Root>\n <DropdownMenu.Trigger>\n <ToolbarButton iconOnly aria-label={label}>\n <MoreIcon />\n </ToolbarButton>\n </DropdownMenu.Trigger>\n <DropdownMenu.Content align=\"end\">\n <InOverflowContext.Provider value>{items.slice(shown)}</InOverflowContext.Provider>\n </DropdownMenu.Content>\n </DropdownMenu.Root>\n ) : null}\n </div>\n );\n },\n);\nToolbarOverflow.displayName = 'Toolbar.Overflow';\n\n// ============================================================================\n// ToolbarSlot and ToolbarFill\n// ============================================================================\n\ntype SlotEntry = { id: string; node: React.ReactNode };\n\nconst EMPTY_ENTRIES: readonly SlotEntry[] = [];\nconst slotEntries = new Map<string, readonly SlotEntry[]>();\nconst slotListeners = new Set<() => void>();\n/** How many ToolbarSlots of each name are mounted, to warn when one Fill would render twice. */\nconst mountedSlots = new Map<string, number>();\n\nfunction subscribeSlots(listener: () => void) {\n slotListeners.add(listener);\n return () => {\n slotListeners.delete(listener);\n };\n}\n\nfunction setSlotEntry(name: string, id: string, node: React.ReactNode) {\n const list = slotEntries.get(name) ?? EMPTY_ENTRIES;\n const index = list.findIndex((entry) => entry.id === id);\n const next = index === -1 ? [...list, { id, node }] : list.map((entry) => (entry.id === id ? { id, node } : entry));\n slotEntries.set(name, next);\n slotListeners.forEach((listener) => listener());\n}\n\nfunction removeSlotEntry(name: string, id: string) {\n const list = slotEntries.get(name);\n if (!list) return;\n const next = list.filter((entry) => entry.id !== id);\n if (next.length === 0) slotEntries.delete(name);\n else slotEntries.set(name, next);\n slotListeners.forEach((listener) => listener());\n}\n\ninterface ToolbarSlotProps {\n /**\n * Which `ToolbarFill` renders here. Defaults to `default`. Names are global to the page: mount one\n * slot per name, or the fill renders in each of them (development builds warn).\n */\n name?: string;\n}\n\n/**\n * A place in a toolbar that content elsewhere in the app fills, such as a page adding its own\n * actions to a header toolbar the layout owns.\n *\n * It renders whatever the `ToolbarFill` with the same `name` holds, as if it were written here:\n * the controls take the toolbar's size and join its arrow-key row. It adds no element.\n */\nfunction ToolbarSlot({ name = 'default' }: ToolbarSlotProps) {\n useLayoutEffect(() => {\n const count = (mountedSlots.get(name) ?? 0) + 1;\n mountedSlots.set(name, count);\n if (count > 1 && process.env.NODE_ENV !== 'production') {\n console.warn(`[kookie-ui] ToolbarSlot: ${count} slots named \"${name}\" are mounted. Each renders the ToolbarFill's controls, so they appear more than once. Give each slot its own name.`);\n }\n return () => {\n const left = (mountedSlots.get(name) ?? 1) - 1;\n if (left > 0) mountedSlots.set(name, left);\n else mountedSlots.delete(name);\n };\n }, [name]);\n const entries = React.useSyncExternalStore(\n subscribeSlots,\n () => slotEntries.get(name) ?? EMPTY_ENTRIES,\n () => EMPTY_ENTRIES,\n );\n return (\n <>\n {entries.map((entry) => (\n <React.Fragment key={entry.id}>{entry.node}</React.Fragment>\n ))}\n </>\n );\n}\nToolbarSlot.displayName = 'Toolbar.Slot';\n\ninterface ToolbarFillProps {\n /** The `ToolbarSlot` to render into. Defaults to `default`. */\n name?: string;\n /** The controls to show in the slot, such as `ToolbarButton`s. */\n children?: React.ReactNode;\n}\n\n/**\n * Sends its children to the `ToolbarSlot` with the same `name`, and renders nothing where it\n * is written. Use it instead of a React portal: a portal keeps the page's React tree, so a\n * ToolbarButton in it can't join the toolbar's arrow keys.\n *\n * The children render inside the toolbar, so they read the toolbar's context, not the page's.\n * They appear after the page mounts on the client, not in server-rendered HTML.\n */\nfunction ToolbarFill({ name = 'default', children }: ToolbarFillProps) {\n const id = React.useId();\n useLayoutEffect(() => {\n setSlotEntry(name, id, children);\n }, [name, id, children]);\n useLayoutEffect(() => () => removeSlotEntry(name, id), [name, id]);\n return null;\n}\nToolbarFill.displayName = 'Toolbar.Fill';\n\n// ============================================================================\n// ToolbarSeparator\n// ============================================================================\n\ntype ToolbarSeparatorProps = ComponentPropsWithout<typeof ToolbarPrimitive.Separator, RemovedProps | 'orientation'>;\n\n/**\n * A gray hairline between two clusters, announced as a separator. Its direction is always\n * opposite to the toolbar's. In a `ToolbarOverflow`'s menu it is a menu separator.\n */\nconst ToolbarSeparator = React.forwardRef<HTMLDivElement, ToolbarSeparatorProps>(\n ({ className, ...props }, forwardedRef) => {\n const toolbar = React.useContext(ToolbarContext);\n const overflow = React.useContext(InOverflowContext);\n if (overflow) return <DropdownMenu.Separator {...props} ref={forwardedRef} className={className} />;\n if (!toolbar) {\n return (\n <div\n role=\"separator\"\n aria-orientation=\"vertical\"\n data-orientation=\"vertical\"\n {...props}\n ref={forwardedRef}\n className={classNames('kui-ToolbarSeparator', className)}\n />\n );\n }\n return (\n <ToolbarPrimitive.Separator\n {...props}\n ref={forwardedRef}\n className={classNames('kui-ToolbarSeparator', className)}\n />\n );\n },\n);\nToolbarSeparator.displayName = 'Toolbar.Separator';\n\n// ============================================================================\n// ToolbarTitle\n// ============================================================================\n\n/** The title's text step: one step above the label of a button at the same size. */\nconst TITLE_SIZE = { '1': '2', '2': '3', '3': '4', '4': '5' } as const satisfies Record<ToolbarSize, TextProps['size']>;\n\ninterface ToolbarTitleProps {\n /** The title text. With none, the title renders nothing. */\n children?: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n /** The id of the title, so that the toolbar's `aria-labelledby` can point at it. */\n id?: string;\n}\n\n/**\n * What the row is about, at its leading edge. One line: it truncates rather than wrapping.\n * Its text step follows the toolbar's `size`, and it takes more air from the controls beside it\n * than they take from each other.\n */\nconst ToolbarTitle = React.forwardRef<HTMLSpanElement, ToolbarTitleProps>(\n ({ className, children, style, id }, forwardedRef) => {\n const toolbar = React.useContext(ToolbarContext);\n const themeSize = useThemeSize<ToolbarSize>(undefined, toolbarRootPropDefs.size);\n const size = toolbar?.size ?? themeSize;\n if (children === undefined || children === null || children === false) return null;\n return (\n <Text\n ref={forwardedRef}\n as=\"span\"\n size={TITLE_SIZE[size]}\n weight=\"medium\"\n truncate\n id={id}\n style={style}\n className={classNames('kui-ToolbarTitle', className)}\n >\n {children}\n </Text>\n );\n },\n);\nToolbarTitle.displayName = 'Toolbar.Title';\n\n// ============================================================================\n// Exports\n// ============================================================================\n\nconst Toolbar = Object.assign(ToolbarRoot, {\n Root: ToolbarRoot,\n Group: ToolbarGroup,\n Button: ToolbarButton,\n Separator: ToolbarSeparator,\n Title: ToolbarTitle,\n Overflow: ToolbarOverflow,\n Slot: ToolbarSlot,\n Fill: ToolbarFill,\n});\n\nexport {\n Toolbar,\n ToolbarGroup,\n ToolbarButton,\n ToolbarSeparator,\n ToolbarTitle,\n ToolbarOverflow,\n ToolbarSlot,\n ToolbarFill,\n useToolbarOverflow,\n ToolbarRoot as Root,\n ToolbarGroup as Group,\n ToolbarButton as Button,\n ToolbarSeparator as Separator,\n ToolbarTitle as Title,\n ToolbarOverflow as Overflow,\n ToolbarSlot as Slot,\n ToolbarFill as Fill,\n};\nexport type {\n ToolbarProps,\n ToolbarGroupProps,\n ToolbarButtonProps,\n ToolbarSeparatorProps,\n ToolbarTitleProps,\n ToolbarOverflowProps,\n ToolbarSlotProps,\n ToolbarFillProps,\n ToolbarProps as RootProps,\n ToolbarGroupProps as GroupProps,\n ToolbarButtonProps as ButtonProps,\n ToolbarSeparatorProps as SeparatorProps,\n ToolbarTitleProps as TitleProps,\n ToolbarOverflowProps as OverflowProps,\n ToolbarSlotProps as SlotProps,\n ToolbarFillProps as FillProps,\n};\n"],
5
- "mappings": ";+WAEA,UAAYA,MAAW,QACvB,OAAS,mBAAAC,MAAuB,oBAChC,OAAOC,MAAgB,aACvB,OAAS,WAAWC,MAAwB,WAsC5C,IAAMC,EAAuB,gBAA0C,IAAI,EAGrEC,EAA4B,gBAA4C,IAAI,EAO5EC,EAA0B,gBAAc,EAAK,EAQnD,SAASC,IAA8B,CACrC,OAAa,aAAWD,CAAiB,CAC3C,CAsCA,IAAME,EAAoB,aAAyC,CAACC,EAAOC,IAAiB,CAG1F,IAAMC,EAAOC,EAAgB,EAEvBC,EAAoBC,EAAaL,EAAM,MAAQE,GAAQ,OAAWI,EAAoB,IAAI,EAC1FC,EAAkCP,EAAM,aAAeM,EAAoB,YAAY,QACvF,CAAE,UAAAE,EAAW,YAAaC,EAAc,SAAAC,EAAW,GAAO,SAAAC,EAAU,GAAGC,CAAU,EAAIC,EACzF,CAAE,GAAGb,EAAO,KAAAI,CAAK,EACjBE,EACAQ,CACF,EAEMC,EAAgB,UAAQ,KAAO,CAAE,KAAAX,EAAM,YAAAG,EAAa,SAAAG,CAAS,GAAI,CAACN,EAAMG,EAAaG,CAAQ,CAAC,EAEpG,OACE,gBAACM,EAAiB,KAAjB,CACE,GAAGJ,EACJ,IAAKX,EACL,YAAaM,EACb,gBAAeG,GAAY,OAC3B,UAAWO,EAAW,cAAeT,CAAS,GAE9C,gBAACb,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K,EAAK,IAAK,EAAK,GAAI,EAgBtDC,GAAqB,aACzB,CAAC,CAAE,UAAApG,EAAW,SAAAG,EAAU,MAAAkG,EAAO,GAAAZ,CAAG,EAAGhG,IAAiB,CACpD,IAAMmB,EAAgB,aAAWzB,CAAc,EACzCmH,EAAYzG,EAA0B,OAAWC,EAAoB,IAAI,EACzEF,EAAOgB,GAAS,MAAQ0F,EAC9B,OAA8BnG,GAAa,MAAQA,IAAa,GAAc,KAE5E,gBAACoG,EAAA,CACC,IAAK9G,EACL,GAAG,OACH,KAAM0G,GAAWvG,CAAI,EACrB,OAAO,SACP,SAAQ,GACR,GAAI6F,EACJ,MAAOY,EACP,UAAW5F,EAAW,mBAAoBT,CAAS,GAElDG,CACH,CAEJ,CACF,EACAiG,GAAa,YAAc,gBAM3B,IAAMI,GAAU,OAAO,OAAOjH,EAAa,CACzC,KAAMA,EACN,MAAOmB,GACP,OAAQS,EACR,UAAW8E,GACX,MAAOG,GACP,SAAUzD,GACV,KAAMkD,GACN,KAAMG,EACR,CAAC",
6
- "names": ["React", "useLayoutEffect", "classNames", "ToolbarPrimitive", "ToolbarContext", "ToolbarGroupContext", "InOverflowContext", "useToolbarOverflow", "ToolbarRoot", "props", "forwardedRef", "band", "usePaneBandSize", "size", "useThemeSize", "toolbarRootPropDefs", "orientation", "className", "_orientation", "backdrop", "children", "rootProps", "extractProps", "layoutPropDefs", "context", "ToolbarPrimitive", "classNames", "ToolbarGroup", "disabled", "toolbar", "overflow", "group", "DropdownMenuGroup", "isPressed", "value", "isButtonElement", "ToolbarButton", "iconOnly", "variant", "emphasis", "color", "asChild", "onKeyDown", "rest", "off", "ToolbarOverflowItem", "handleKeyDown", "event", "pressed", "stateProps", "shared", "buttonProps", "Button", "label", "words", "itemProps", "child", "DropdownMenuItem", "DropdownMenuCheckboxItem", "MoreIcon", "ToolbarOverflow", "items", "count", "rootRef", "widths", "triggerWidth", "shown", "setShown", "tick", "setTick", "measuredCount", "setMeasuredCount", "useLayoutEffect", "root", "kids", "visible", "i", "el", "trigger", "gap", "available", "total", "counted", "width", "next", "budget", "used", "drawn", "own", "observer", "n", "seat", "attach", "node", "item", "DropdownMenuRoot", "DropdownMenuTrigger", "DropdownMenuContent", "EMPTY_ENTRIES", "slotEntries", "slotListeners", "mountedSlots", "subscribeSlots", "listener", "setSlotEntry", "name", "id", "list", "entry", "removeSlotEntry", "ToolbarSlot", "left", "entries", "ToolbarFill", "ToolbarSeparator", "DropdownMenuSeparator", "TITLE_SIZE", "ToolbarTitle", "style", "themeSize", "Text", "Toolbar"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/components/context-menu.tsx"],
4
- "sourcesContent": ["/**\n * Context Menu component that provides right-click menu functionality.\n * Requires client-side rendering due to event handling and portal usage.\n */\n'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { ContextMenu as ContextMenuPrimitive, Slot } from 'radix-ui';\nimport { useCallbackRef } from 'radix-ui/internal';\n\nimport { ScrollArea } from './scroll-area.js';\nimport {\n contextMenuContentPropDefs,\n contextMenuSubContentPropDefs,\n contextMenuItemPropDefs,\n contextMenuCheckboxItemPropDefs,\n contextMenuRadioItemPropDefs,\n} from './context-menu.props.js';\nimport { Theme, useThemeContext } from './theme.js';\nimport { ThickCheckIcon, ThickChevronRightIcon, ThickDotIcon } from './icons.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSizeProps } from '../helpers/theme-size.js';\nimport { requireReactElement } from '../helpers/require-react-element.js';\nimport {\n MenuCloseProvider,\n MenuGroupLabelProvider,\n MenuProvider,\n useMenuGroupLabelId,\n useMenuGroupLabelledBy,\n} from './_internal/menu-context.js';\nimport {\n MenuShortcut,\n getMenuAlignOffset,\n toAriaKeyShortcuts,\n useResolvedResponsiveValue,\n} from './_internal/base-menu.utils.js';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { GetPropDefTypes, Responsive } from '../props/prop-def.js';\n\ninterface ContextMenuRootProps\n extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Root> {}\nconst ContextMenuRoot: React.FC<ContextMenuRootProps> = (props) => {\n const { open: openProp, onOpenChange } = props;\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(false);\n const open = openProp ?? uncontrolledOpen;\n\n const handleOpenChangeProp = useCallbackRef(onOpenChange);\n const handleOpenChange = React.useCallback(\n (next: boolean) => {\n setUncontrolledOpen(next);\n handleOpenChangeProp(next);\n },\n [handleOpenChangeProp],\n );\n const close = React.useCallback(() => handleOpenChange(false), [handleOpenChange]);\n\n return (\n <MenuCloseProvider value={close}>\n <ContextMenuPrimitive.Root {...props} open={open} onOpenChange={handleOpenChange} />\n </MenuCloseProvider>\n );\n};\nContextMenuRoot.displayName = 'ContextMenu.Root';\n\ntype ContextMenuTriggerElement = React.ElementRef<typeof ContextMenuPrimitive.Trigger>;\ninterface ContextMenuTriggerProps\n extends ComponentPropsWithout<typeof ContextMenuPrimitive.Trigger, RemovedProps> {}\nconst ContextMenuTrigger = React.forwardRef<ContextMenuTriggerElement, ContextMenuTriggerProps>(\n ({ children, ...props }, forwardedRef) => (\n <ContextMenuPrimitive.Trigger {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </ContextMenuPrimitive.Trigger>\n ),\n);\nContextMenuTrigger.displayName = 'ContextMenu.Trigger';\n\n/** Visual props shared by Content and SubContent. */\ntype ContextMenuSurfaceProps = GetPropDefTypes<typeof contextMenuContentPropDefs>;\n\ntype ContextMenuContentContextValue = {\n size?: ContextMenuSurfaceProps['size'];\n color?: ContextMenuSurfaceProps['color'];\n};\nconst ContextMenuContentContext = React.createContext<ContextMenuContentContextValue>({});\ntype ContextMenuContentElement = React.ElementRef<typeof ContextMenuPrimitive.Content>;\ninterface ContextMenuContentProps\n extends ComponentPropsWithout<typeof ContextMenuPrimitive.Content, RemovedProps>,\n ContextMenuSurfaceProps {\n container?: React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Portal>['container'];\n /**\n * When true, skips the ScrollArea wrapper to allow VirtualMenu to handle its own scrolling.\n * Use this when rendering virtualized lists inside the context menu.\n */\n virtualized?: boolean;\n /**\n * @deprecated Has no effect. ContextMenu submenus always cascade.\n */\n submenuBehavior?: Responsive<'cascade' | 'drill-down'>;\n}\nconst ContextMenuContent = React.forwardRef<ContextMenuContentElement, ContextMenuContentProps>(\n (ownProps, forwardedRef) => {\n const props = useThemeSizeProps(ownProps, contextMenuContentPropDefs.size);\n const themeContext = useThemeContext();\n const {\n size = contextMenuContentPropDefs.size.default,\n } = props;\n const {\n className,\n children,\n color,\n container,\n forceMount,\n submenuBehavior: _submenuBehavior,\n virtualized = false,\n ...contentProps\n } = extractProps(props, contextMenuContentPropDefs);\n\n const resolvedColor = color || themeContext.accentColor;\n const scalarSize = useResolvedResponsiveValue(size, contextMenuContentPropDefs.size.default);\n\n const contextValue = React.useMemo(\n () => ({ size, color: resolvedColor }),\n [size, resolvedColor],\n );\n\n const body = (\n <MenuProvider size={size}>\n <ContextMenuContentContext.Provider value={contextValue}>{children}</ContextMenuContentContext.Provider>\n </MenuProvider>\n );\n\n return (\n <ContextMenuPrimitive.Portal container={container} forceMount={forceMount}>\n <Theme asChild>\n <ContextMenuPrimitive.Content\n data-accent-color={resolvedColor}\n alignOffset={getMenuAlignOffset(scalarSize)}\n collisionPadding={10}\n {...contentProps}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'kui-PopperContent',\n 'kui-BaseMenuContent',\n 'kui-variant-soft',\n 'kui-ContextMenuContent',\n className,\n )}\n >\n {virtualized ? (\n <div className={classNames('kui-BaseMenuViewport', 'kui-ContextMenuViewport', 'kui-virtualized')}>\n {body}\n </div>\n ) : (\n <ScrollArea type=\"auto\" scrollbars=\"vertical\">\n <div className={classNames('kui-BaseMenuViewport', 'kui-ContextMenuViewport')}>{body}</div>\n </ScrollArea>\n )}\n </ContextMenuPrimitive.Content>\n </Theme>\n </ContextMenuPrimitive.Portal>\n );\n },\n);\nContextMenuContent.displayName = 'ContextMenu.Content';\n\ntype ContextMenuLabelElement = React.ElementRef<typeof ContextMenuPrimitive.Label>;\ninterface ContextMenuLabelProps\n extends ComponentPropsWithout<typeof ContextMenuPrimitive.Label, RemovedProps> {}\nconst ContextMenuLabel = React.forwardRef<ContextMenuLabelElement, ContextMenuLabelProps>(\n ({ className, id: idProp, ...props }, forwardedRef) => {\n const id = useMenuGroupLabelId(idProp);\n return (\n <ContextMenuPrimitive.Label\n {...props}\n id={id}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-BaseMenuLabel', 'kui-ContextMenuLabel', className)}\n />\n );\n },\n);\nContextMenuLabel.displayName = 'ContextMenu.Label';\n\ntype ContextMenuItemElement = React.ElementRef<typeof ContextMenuPrimitive.Item>;\ntype ContextMenuItemOwnProps = GetPropDefTypes<typeof contextMenuItemPropDefs>;\ninterface ContextMenuItemProps\n extends ComponentPropsWithout<typeof ContextMenuPrimitive.Item, RemovedProps>,\n ContextMenuItemOwnProps {}\nconst ContextMenuItem = React.forwardRef<ContextMenuItemElement, ContextMenuItemProps>(\n (props, forwardedRef) => {\n const {\n className,\n children,\n color = contextMenuItemPropDefs.color.default,\n shortcut,\n ...itemProps\n } = props;\n return (\n <ContextMenuPrimitive.Item\n data-accent-color={color}\n aria-keyshortcuts={shortcut ? toAriaKeyShortcuts(shortcut) : undefined}\n {...itemProps}\n ref={forwardedRef}\n className={classNames('kui-reset', 'kui-BaseMenuItem', 'kui-ContextMenuItem', className)}\n >\n <Slot.Slottable>{children}</Slot.Slottable>\n {shortcut && <MenuShortcut shortcut={shortcut} className=\"kui-ContextMenuShortcut\" />}\n </ContextMenuPrimitive.Item>\n );\n },\n);\nContextMenuItem.displayName = 'ContextMenu.Item';\n\ntype ContextMenuGroupElement = React.ElementRef<typeof ContextMenuPrimitive.Group>;\ninterface ContextMenuGroupProps\n extends ComponentPropsWithout<typeof ContextMenuPrimitive.Group, RemovedProps> {}\nconst ContextMenuGroup = React.forwardRef<ContextMenuGroupElement, ContextMenuGroupProps>(\n ({ className, 'aria-labelledby': ariaLabelledBy, ...props }, forwardedRef) => {\n const [labelledBy, setLabelId] = useMenuGroupLabelledBy(ariaLabelledBy);\n return (\n <MenuGroupLabelProvider value={setLabelId}>\n <ContextMenuPrimitive.Group\n aria-labelledby={labelledBy}\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-BaseMenuGroup', 'kui-ContextMenuGroup', className)}\n />\n </MenuGroupLabelProvider>\n );\n },\n);\nContextMenuGroup.displayName = 'ContextMenu.Group';\n\ntype ContextMenuRadioGroupElement = React.ElementRef<typeof ContextMenuPrimitive.RadioGroup>;\ninterface ContextMenuRadioGroupProps\n extends ComponentPropsWithout<typeof ContextMenuPrimitive.RadioGroup, RemovedProps> {}\nconst ContextMenuRadioGroup = React.forwardRef<\n ContextMenuRadioGroupElement,\n ContextMenuRadioGroupProps\n>(({ className, 'aria-labelledby': ariaLabelledBy, ...props }, forwardedRef) => {\n const [labelledBy, setLabelId] = useMenuGroupLabelledBy(ariaLabelledBy);\n return (\n <MenuGroupLabelProvider value={setLabelId}>\n <ContextMenuPrimitive.RadioGroup\n aria-labelledby={labelledBy}\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-BaseMenuRadioGroup', 'kui-ContextMenuRadioGroup', className)}\n />\n </MenuGroupLabelProvider>\n );\n});\nContextMenuRadioGroup.displayName = 'ContextMenu.RadioGroup';\n\ntype ContextMenuRadioItemElement = React.ElementRef<typeof ContextMenuPrimitive.RadioItem>;\ntype ContextMenuRadioItemOwnProps = GetPropDefTypes<typeof contextMenuRadioItemPropDefs>;\ninterface ContextMenuRadioItemProps\n extends ComponentPropsWithout<typeof ContextMenuPrimitive.RadioItem, RemovedProps>,\n ContextMenuRadioItemOwnProps {}\nconst ContextMenuRadioItem = React.forwardRef<\n ContextMenuRadioItemElement,\n ContextMenuRadioItemProps\n>((props, forwardedRef) => {\n const {\n children,\n className,\n color = contextMenuRadioItemPropDefs.color.default,\n ...itemProps\n } = props;\n return (\n <ContextMenuPrimitive.RadioItem\n {...itemProps}\n asChild={false}\n ref={forwardedRef}\n data-accent-color={color}\n className={classNames(\n 'kui-BaseMenuItem',\n 'kui-BaseMenuRadioItem',\n 'kui-ContextMenuItem',\n 'kui-ContextMenuRadioItem',\n className,\n )}\n >\n <Slot.Slottable>{children}</Slot.Slottable>\n <ContextMenuPrimitive.ItemIndicator className=\"kui-BaseMenuItemIndicator kui-ContextMenuItemIndicator\">\n <ThickDotIcon className=\"kui-BaseMenuItemIndicatorIcon kui-ContextMenuItemIndicatorIcon\" />\n </ContextMenuPrimitive.ItemIndicator>\n </ContextMenuPrimitive.RadioItem>\n );\n});\nContextMenuRadioItem.displayName = 'ContextMenu.RadioItem';\n\ntype ContextMenuCheckboxItemElement = React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>;\ntype ContextMenuCheckboxItemOwnProps = GetPropDefTypes<typeof contextMenuCheckboxItemPropDefs>;\ninterface ContextMenuCheckboxItemProps\n extends ComponentPropsWithout<typeof ContextMenuPrimitive.CheckboxItem, RemovedProps>,\n ContextMenuCheckboxItemOwnProps {}\nconst ContextMenuCheckboxItem = React.forwardRef<\n ContextMenuCheckboxItemElement,\n ContextMenuCheckboxItemProps\n>((props, forwardedRef) => {\n const {\n children,\n className,\n shortcut,\n color = contextMenuCheckboxItemPropDefs.color.default,\n ...itemProps\n } = props;\n return (\n <ContextMenuPrimitive.CheckboxItem\n aria-keyshortcuts={shortcut ? toAriaKeyShortcuts(shortcut) : undefined}\n {...itemProps}\n asChild={false}\n ref={forwardedRef}\n data-accent-color={color}\n className={classNames(\n 'kui-BaseMenuItem',\n 'kui-BaseMenuCheckboxItem',\n 'kui-ContextMenuItem',\n 'kui-ContextMenuCheckboxItem',\n className,\n )}\n >\n <Slot.Slottable>{children}</Slot.Slottable>\n <ContextMenuPrimitive.ItemIndicator className=\"kui-BaseMenuItemIndicator kui-ContextMenuItemIndicator\">\n <ThickCheckIcon className=\"kui-BaseMenuItemIndicatorIcon kui-ContextMenuItemIndicatorIcon\" />\n </ContextMenuPrimitive.ItemIndicator>\n {shortcut && <MenuShortcut shortcut={shortcut} className=\"kui-ContextMenuShortcut\" />}\n </ContextMenuPrimitive.CheckboxItem>\n );\n});\nContextMenuCheckboxItem.displayName = 'ContextMenu.CheckboxItem';\n\ninterface ContextMenuSubProps\n extends ComponentPropsWithout<typeof ContextMenuPrimitive.Sub, RemovedProps> {}\nconst ContextMenuSub: React.FC<ContextMenuSubProps> = (props) => (\n <ContextMenuPrimitive.Sub {...props} />\n);\nContextMenuSub.displayName = 'ContextMenu.Sub';\n\ntype ContextMenuSubTriggerElement = React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>;\ninterface ContextMenuSubTriggerProps\n extends ComponentPropsWithout<typeof ContextMenuPrimitive.SubTrigger, RemovedProps> {}\nconst ContextMenuSubTrigger = React.forwardRef<\n ContextMenuSubTriggerElement,\n ContextMenuSubTriggerProps\n>((props, forwardedRef) => {\n const { className, children, ...subTriggerProps } = props;\n return (\n <ContextMenuPrimitive.SubTrigger\n {...subTriggerProps}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'kui-BaseMenuItem',\n 'kui-BaseMenuSubTrigger',\n 'kui-ContextMenuItem',\n 'kui-ContextMenuSubTrigger',\n className,\n )}\n >\n {children}\n <div className=\"kui-BaseMenuShortcut kui-ContextMenuShortcut\">\n <ThickChevronRightIcon className=\"kui-BaseMenuSubTriggerIcon kui-ContextMenuSubTriggerIcon\" />\n </div>\n </ContextMenuPrimitive.SubTrigger>\n );\n});\nContextMenuSubTrigger.displayName = 'ContextMenu.SubTrigger';\n\ntype ContextMenuSubContentElement = React.ElementRef<typeof ContextMenuPrimitive.SubContent>;\ninterface ContextMenuSubContentProps\n extends ComponentPropsWithout<typeof ContextMenuPrimitive.SubContent, RemovedProps>,\n ContextMenuSurfaceProps {\n container?: React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Portal>['container'];\n /**\n * When true, skips the ScrollArea wrapper to allow VirtualMenu to handle its own scrolling.\n */\n virtualized?: boolean;\n}\nconst ContextMenuSubContent = React.forwardRef<\n ContextMenuSubContentElement,\n ContextMenuSubContentProps\n>((props, forwardedRef) => {\n const parent = React.useContext(ContextMenuContentContext);\n\n // A submenu inherits the parent surface, and its own props win.\n const size = props.size ?? parent.size;\n const color = props.color ?? parent.color;\n\n const {\n className,\n children,\n container,\n forceMount,\n color: _color,\n virtualized = false,\n ...subContentProps\n } = extractProps({ ...props, size }, contextMenuSubContentPropDefs);\n\n const scalarSize = useResolvedResponsiveValue(size, contextMenuSubContentPropDefs.size.default);\n\n const contextValue = React.useMemo(\n () => ({ size, color }),\n [size, color],\n );\n\n const body = (\n <MenuProvider size={size}>\n <ContextMenuContentContext.Provider value={contextValue}>{children}</ContextMenuContentContext.Provider>\n </MenuProvider>\n );\n\n return (\n <ContextMenuPrimitive.Portal container={container} forceMount={forceMount}>\n <Theme asChild>\n <ContextMenuPrimitive.SubContent\n data-accent-color={color}\n alignOffset={getMenuAlignOffset(scalarSize)}\n // Side offset accounts for the outer solid box-shadow\n sideOffset={1}\n collisionPadding={10}\n {...subContentProps}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'kui-PopperContent',\n 'kui-BaseMenuContent',\n 'kui-variant-soft',\n 'kui-BaseMenuSubContent',\n 'kui-ContextMenuContent',\n 'kui-ContextMenuSubContent',\n className,\n )}\n >\n {virtualized ? (\n <div className={classNames('kui-BaseMenuViewport', 'kui-ContextMenuViewport', 'kui-virtualized')}>\n {body}\n </div>\n ) : (\n <ScrollArea type=\"auto\" scrollbars=\"vertical\">\n <div className={classNames('kui-BaseMenuViewport', 'kui-ContextMenuViewport')}>{body}</div>\n </ScrollArea>\n )}\n </ContextMenuPrimitive.SubContent>\n </Theme>\n </ContextMenuPrimitive.Portal>\n );\n});\nContextMenuSubContent.displayName = 'ContextMenu.SubContent';\n\ntype ContextMenuSeparatorElement = React.ElementRef<typeof ContextMenuPrimitive.Separator>;\ninterface ContextMenuSeparatorProps\n extends ComponentPropsWithout<typeof ContextMenuPrimitive.Separator, RemovedProps> {}\nconst ContextMenuSeparator = React.forwardRef<\n ContextMenuSeparatorElement,\n ContextMenuSeparatorProps\n>(({ className, ...props }, forwardedRef) => (\n <ContextMenuPrimitive.Separator\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-BaseMenuSeparator', 'kui-ContextMenuSeparator', className)}\n />\n));\nContextMenuSeparator.displayName = 'ContextMenu.Separator';\n\nexport {\n ContextMenuRoot as Root,\n ContextMenuTrigger as Trigger,\n ContextMenuContent as Content,\n ContextMenuLabel as Label,\n ContextMenuItem as Item,\n ContextMenuGroup as Group,\n ContextMenuRadioGroup as RadioGroup,\n ContextMenuRadioItem as RadioItem,\n ContextMenuCheckboxItem as CheckboxItem,\n ContextMenuSub as Sub,\n ContextMenuSubTrigger as SubTrigger,\n ContextMenuSubContent as SubContent,\n ContextMenuSeparator as Separator,\n};\n\nexport type {\n ContextMenuRootProps as RootProps,\n ContextMenuTriggerProps as TriggerProps,\n ContextMenuContentProps as ContentProps,\n ContextMenuLabelProps as LabelProps,\n ContextMenuItemProps as ItemProps,\n ContextMenuGroupProps as GroupProps,\n ContextMenuRadioGroupProps as RadioGroupProps,\n ContextMenuRadioItemProps as RadioItemProps,\n ContextMenuCheckboxItemProps as CheckboxItemProps,\n ContextMenuSubProps as SubProps,\n ContextMenuSubTriggerProps as SubTriggerProps,\n ContextMenuSubContentProps as SubContentProps,\n ContextMenuSeparatorProps as SeparatorProps,\n};\n"],
5
- "mappings": ";4eAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,kBAAAE,EAAA,YAAAC,EAAA,UAAAC,EAAA,SAAAC,EAAA,UAAAC,EAAA,eAAAC,EAAA,cAAAC,EAAA,SAAAC,EAAA,cAAAC,GAAA,QAAAC,EAAA,eAAAC,GAAA,eAAAC,EAAA,YAAAC,IAMA,UAAYC,MAAW,QACvB,OAAOC,MAAgB,aACv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,GACT,IAAKe,EACL,UAAW0B,EAAW,wBAAyB,2BAA4BhB,CAAS,EACtF,CACD,EACDkD,GAAqB,YAAc",
6
- "names": ["context_menu_exports", "__export", "ContextMenuCheckboxItem", "ContextMenuContent", "ContextMenuGroup", "ContextMenuItem", "ContextMenuLabel", "ContextMenuRadioGroup", "ContextMenuRadioItem", "ContextMenuRoot", "ContextMenuSeparator", "ContextMenuSub", "ContextMenuSubContent", "ContextMenuSubTrigger", "ContextMenuTrigger", "React", "classNames", "ContextMenuPrimitive", "Slot", "useCallbackRef", "ContextMenuRoot", "props", "openProp", "onOpenChange", "uncontrolledOpen", "setUncontrolledOpen", "open", "handleOpenChangeProp", "useCallbackRef", "handleOpenChange", "next", "close", "MenuCloseProvider", "ContextMenuPrimitive", "ContextMenuTrigger", "children", "forwardedRef", "requireReactElement", "ContextMenuContentContext", "ContextMenuContent", "ownProps", "useThemeSizeProps", "baseMenuSubContentPropDefs", "themeContext", "useThemeContext", "size", "className", "color", "container", "forceMount", "_submenuBehavior", "virtualized", "contentProps", "extractProps", "resolvedColor", "scalarSize", "useResolvedResponsiveValue", "contextValue", "body", "MenuProvider", "Theme", "getMenuAlignOffset", "classNames", "ScrollArea", "ContextMenuLabel", "idProp", "id", "useMenuGroupLabelId", "ContextMenuItem", "baseMenuItemPropDefs", "shortcut", "itemProps", "toAriaKeyShortcuts", "Slot", "MenuShortcut", "ContextMenuGroup", "ariaLabelledBy", "labelledBy", "setLabelId", "useMenuGroupLabelledBy", "MenuGroupLabelProvider", "ContextMenuRadioGroup", "ContextMenuRadioItem", "baseMenuRadioItemPropDefs", "ThickDotIcon", "ContextMenuCheckboxItem", "baseMenuCheckboxItemPropDefs", "ThickCheckIcon", "ContextMenuSub", "ContextMenuSubTrigger", "subTriggerProps", "ThickChevronRightIcon", "ContextMenuSubContent", "parent", "_color", "subContentProps", "ContextMenuSeparator"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/components/radio.tsx"],
4
- "sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { composeEventHandlers } from 'radix-ui/internal';\n\nimport { radioPropDefs } from './radio.props.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSizeProps } from '../helpers/theme-size.js';\n\nimport type { ComponentPropsWithout } from '../helpers/component-props.js';\nimport type { NotInputRadioAttributes } from '../helpers/input-attributes.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\n\ntype RadioElement = React.ElementRef<'input'>;\ntype RadioOwnProps = GetPropDefTypes<typeof radioPropDefs> & {\n value: string;\n onValueChange?: (value: string) => void;\n};\ntype RadioInputProps = ComponentPropsWithout<\n 'input',\n NotInputRadioAttributes | 'color' | 'defaultValue' | 'value'\n>;\ninterface RadioProps extends RadioInputProps, RadioOwnProps {}\n\nconst Radio = React.forwardRef<RadioElement, RadioProps>((ownProps, forwardedRef) => {\n const props = useThemeSizeProps(ownProps, radioPropDefs.size);\n const { className, color, onChange, onValueChange, ...radioProps } = extractProps(\n props,\n radioPropDefs,\n );\n return (\n <input\n type=\"radio\"\n data-accent-color={color}\n {...radioProps}\n onChange={composeEventHandlers(onChange, (event) =>\n onValueChange?.(event.currentTarget.value),\n )}\n ref={forwardedRef}\n className={classNames('kui-reset', 'kui-BaseRadioRoot', 'kui-RadioRoot', className)}\n />\n );\n});\nRadio.displayName = 'Radio';\n\nexport { Radio };\nexport type { RadioProps };\n"],
5
- "mappings": ";wHAEA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,wBAAAC,MAA4B,oBAqBrC,IAAMC,EAAc,aAAqC,CAACC,EAAUC,IAAiB,CACnF,IAAMC,EAAQC,EAAkBH,EAAUI,EAAc,IAAI,EACtD,CAAE,UAAAC,EAAW,MAAAC,EAAO,SAAAC,EAAU,cAAAC,EAAe,GAAGC,CAAW,EAAIC,EACnER,EACAE,CACF,EACA,OACE,gBAAC,SACC,KAAK,QACL,oBAAmBE,EAClB,GAAGG,EACJ,SAAUE,EAAqBJ,EAAWK,GACxCJ,IAAgBI,EAAM,cAAc,KAAK,CAC3C,EACA,IAAKX,EACL,UAAWY,EAAW,YAAa,oBAAqB,gBAAiBR,CAAS,EACpF,CAEJ,CAAC,EACDN,EAAM,YAAc",
6
- "names": ["React", "classNames", "composeEventHandlers", "Radio", "ownProps", "forwardedRef", "props", "useThemeSizeProps", "baseRadioPropDefs", "className", "color", "onChange", "onValueChange", "radioProps", "extractProps", "composeEventHandlers", "event", "classNames"]
7
- }
@@ -1,3 +0,0 @@
1
- "use client";
2
- import{a as F}from"./chunk-2IU5XPR2.js";import{a as O,b as U,c as q,e as y,f as $}from"./chunk-E4EMG3RC.js";import{a as T}from"./chunk-3223MHQK.js";import{a as z,b as V,c as j}from"./chunk-YNCI5PY6.js";import{b as C,c as K}from"./chunk-EAIQIW23.js";import{d as H}from"./chunk-GKDGNPBD.js";import{b as D}from"./chunk-5KMEUZWN.js";import{a as W}from"./chunk-6AMWYEM7.js";import{a as ue}from"./chunk-VQPANPMI.js";var le={};ue(le,{Group:()=>oe,GroupContent:()=>ie,GroupLabel:()=>ae,Menu:()=>Y,MenuButton:()=>B,MenuItem:()=>A,MenuSub:()=>ee,MenuSubContent:()=>re,MenuSubTrigger:()=>te,Search:()=>se,Separator:()=>Q});import*as e from"react";import d from"classnames";import*as f from"@radix-ui/react-accordion";var Q=e.forwardRef(({className:t,...r},n)=>e.createElement(F,{...r,ref:n,className:d("kui-SidebarSeparator",t)}));Q.displayName="Sidebar.Separator";var Y=e.forwardRef(({className:t,...r},n)=>e.createElement("ul",{...r,ref:n,className:d("kui-SidebarMenu",t)}));Y.displayName="Sidebar.Menu";var A=e.forwardRef(({className:t,...r},n)=>e.createElement("li",{...r,ref:n,className:d("kui-SidebarMenuItem",t)}));A.displayName="Sidebar.MenuItem";function E(t){if(typeof t=="function"){let r=t;return r.displayName||r.name}if(t&&typeof t=="object"){let r=t;return r.displayName||E(r.render)||E(r.type)}}function ce(t){return t.type==="svg"||t.props?.icon?!0:E(t.type)?.includes("Icon")??!1}function Z(t){return typeof t=="string"||typeof t=="number"}function de(t){let r=e.Children.toArray(t),n=[],o=[];for(let a of r)e.isValidElement(a)&&ce(a)?n.push(a):o.push(Z(a)?e.createElement("span",{key:o.length,className:"kui-SidebarMenuLabel"},a):a);return n.length===0&&r.length>1&&e.isValidElement(r[0])&&(n.push(r[0]),o.shift()),{icons:n,labels:o}}function pe(t){return e.Children.map(t,r=>Z(r)?e.createElement("span",{className:"kui-SidebarMenuLabel"},r):r)}function _(t){if(t.key!=="ArrowDown"&&t.key!=="ArrowUp")return;let r=t.currentTarget.closest(".kui-SidebarContent, .kui-SidebarSearchPopover"),n=r?Array.from(r.querySelectorAll(".kui-SidebarMenuButton")).filter(u=>u.offsetParent!==null):[],o=n.indexOf(t.currentTarget),a=n[o+(t.key==="ArrowDown"?1:-1)];o!==-1&&a&&(t.preventDefault(),a.focus())}var B=e.forwardRef(({asChild:t=!1,isActive:r=!1,shortcut:n,badge:o,className:a,children:u,onKeyDown:p,...s},l)=>{let c=C(),k=e.useContext(K),g=c?.size??k,h=c?.presentation==="thin",N=t?D:"button",P=i=>{p?.(i),i.defaultPrevented||_(i)},m=h?null:e.createElement(e.Fragment,null,o&&e.createElement("div",{className:"kui-SidebarMenuBadge"},typeof o=="string"?e.createElement(T,{size:g,variant:"soft"},o):e.createElement(T,{size:o.size||g,variant:o.variant||"soft",color:o.color,radius:o.radius},o.content)),n&&e.createElement("div",{className:"kui-BaseMenuShortcut kui-SidebarMenuShortcut"},e.createElement(W,{size:g},n))),M=i=>{if(h){let{icons:v,labels:w}=de(i);if(v.length>0)return e.createElement(e.Fragment,null,e.createElement("span",{className:"kui-SidebarMenuIconWrapper"},v),w)}return e.createElement(e.Fragment,null,pe(i),m)},S;return t&&e.isValidElement(u)&&e.Children.count(u)===1?S=e.cloneElement(u,void 0,M(u.props.children)):t?S=u:S=M(u),e.createElement(N,{type:t?void 0:"button",...s,ref:l,"aria-current":r?"page":void 0,className:d("kui-reset","kui-BaseMenuItem","kui-SidebarMenuButton",a),"data-active":r||void 0,onKeyDown:P},S)});B.displayName="Sidebar.MenuButton";var x=e.createContext("accordion"),ee=e.forwardRef(({defaultOpen:t=!1,children:r,...n},o)=>(C()?.presentation==="thin"?"dropdown":"accordion")==="dropdown"?e.createElement("div",{...n,ref:o},e.createElement(O,null,e.createElement(x.Provider,{value:"dropdown"},r))):e.createElement("div",{...n,ref:o},e.createElement(x.Provider,{value:"accordion"},e.createElement(f.Root,{type:"single",collapsible:!0,defaultValue:t?"item":void 0},e.createElement(f.Item,{value:"item"},r)))));ee.displayName="Sidebar.MenuSub";var te=e.forwardRef(({asChild:t=!1,className:r,children:n,onKeyDown:o,...a},u)=>e.useContext(x)==="dropdown"?e.createElement(U,null,e.createElement("button",{...a,onKeyDown:o,ref:u,type:"button","aria-haspopup":"menu",className:d("kui-reset","kui-BaseMenuItem","kui-SidebarMenuButton","kui-SidebarMenuSubTrigger",r)},n)):e.createElement(f.Header,{asChild:!0},e.createElement("div",null,e.createElement(f.Trigger,{...a,onKeyDown:s=>{_(s),o?.(s)},ref:u,asChild:t,className:d("kui-reset","kui-BaseMenuItem","kui-SidebarMenuButton","kui-SidebarMenuSubTrigger",r)},t?n:e.createElement(e.Fragment,null,n,e.createElement(H,{className:d("kui-BaseMenuSubTriggerIcon","kui-SidebarMenuSubTriggerIcon")}))))));te.displayName="Sidebar.MenuSubTrigger";function X(t,r){if(e.isValidElement(t)&&t.type===B){let{asChild:n,isActive:o,shortcut:a,badge:u,type:p,children:s,...l}=t.props,c={...l,"data-active":o||void 0,"aria-current":o?"page":void 0};return n&&e.isValidElement(s)&&e.Children.count(s)===1?e.createElement(y,{key:r,...c,asChild:!0},s):e.createElement(y,{key:r,...c},s)}return e.isValidElement(t)?e.createElement(y,{key:r,asChild:!0},t):e.createElement(y,{key:r},t)}var re=e.forwardRef(({className:t,children:r,...n},o)=>{let a=C();if(e.useContext(x)==="dropdown"){let p=e.Children.map(r,(s,l)=>{if(e.isValidElement(s)&&s.type===A){let c=e.Children.toArray(s.props.children);return X(c.length===1?c[0]:c,l)}return X(s,l)});return e.createElement(q,{...n,ref:o,size:a?.size,className:d(t)},e.createElement($,null,p))}return e.createElement(f.Content,{...n,ref:o,className:d("kui-SidebarMenuSubContent",t)},e.createElement("ul",{className:"kui-SidebarMenuSubList"},r))});re.displayName="Sidebar.MenuSubContent";var ne=e.createContext(null),oe=e.forwardRef(({className:t,...r},n)=>{let o=e.useId(),[a,u]=e.useState(null),p=e.useMemo(()=>({labelId:o,setLabelId:u}),[o]);return e.createElement(ne.Provider,{value:p},e.createElement("div",{role:a?"group":void 0,"aria-labelledby":a??void 0,...r,ref:n,className:d("kui-BaseMenuGroup","kui-SidebarGroup",t)}))});oe.displayName="Sidebar.Group";var ae=e.forwardRef(({asChild:t=!1,className:r,id:n,...o},a)=>{let u=t?D:"div",p=e.useContext(ne),s=n??p?.labelId,l=p?.setLabelId;return e.useEffect(()=>{if(!(!l||!s))return l(s),()=>l(null)},[l,s]),e.createElement(u,{...o,id:s,ref:a,className:d("kui-BaseMenuLabel","kui-SidebarGroupLabel",r)})});ae.displayName="Sidebar.GroupLabel";var ie=e.forwardRef(({className:t,...r},n)=>e.createElement("div",{...r,ref:n,className:d("kui-SidebarGroupContent",t)}));ie.displayName="Sidebar.GroupContent";var L=({className:t})=>e.createElement("svg",{className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},e.createElement("circle",{cx:"11",cy:"11",r:"8"}),e.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})),J=({className:t})=>e.createElement("svg",{className:t,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},e.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),se=e.forwardRef(({value:t,onValueChange:r,placeholder:n="Search...",children:o,className:a,...u},p)=>{let s=C(),l=s?.presentation==="thin",c=e.useRef(null),k=e.useRef(null),h=`${e.useId()}-results`,N=e.useRef(t);N.current=t;let P=e.useRef(r);P.current=r;let m=n.replace(/\.+$/,""),M=e.useCallback(i=>{i.key==="Escape"&&N.current&&(i.preventDefault(),i.stopPropagation(),P.current(""),c.current?.focus())},[]),S=e.useCallback(i=>{let v=k.current;if(!v)return;let w=v.querySelector('[role="group"]');if(!w)return;let b=Array.from(w.querySelectorAll("a, button"));if(b.length===0)return;let G=document.activeElement,I=G===c.current,R=b.indexOf(G);if(i.key.length===1&&!i.ctrlKey&&!i.metaKey&&!i.altKey&&!I&&R!==-1){c.current?.focus();return}switch(i.key){case"ArrowDown":{i.preventDefault(),I||R===-1?b[0]?.focus():R<b.length-1&&b[R+1]?.focus();break}case"ArrowUp":{i.preventDefault(),R<=0?c.current?.focus():b[R-1]?.focus();break}case"Home":{I||(i.preventDefault(),b[0]?.focus());break}case"End":{I||(i.preventDefault(),b[b.length-1]?.focus());break}}},[]);return l?e.createElement("div",{...u,ref:p,className:d("kui-SidebarSearch","kui-SidebarSearch--thin",a)},e.createElement(z,null,e.createElement(V,null,e.createElement("button",{type:"button",className:d("kui-reset","kui-BaseMenuItem","kui-SidebarMenuButton","kui-SidebarSearchTrigger"),"aria-label":m},e.createElement("span",{className:"kui-SidebarMenuIconWrapper"},e.createElement(L,null)),e.createElement("span",{className:"kui-SidebarMenuLabel"},"Search"))),e.createElement(j,{side:"right",align:"start",size:"2",width:"280px","aria-label":m},e.createElement("div",{ref:k,className:"kui-SidebarSearchPopover",role:"search",onKeyDown:S},e.createElement("div",{className:"kui-SidebarSearchInputWrapper"},e.createElement(L,{className:"kui-SidebarSearchIcon"}),e.createElement("input",{ref:c,type:"search",className:"kui-SidebarSearchInput",value:t,onChange:i=>r(i.target.value),onKeyDown:M,placeholder:n,"aria-label":m,"aria-controls":o?h:void 0,autoFocus:!0}),t&&e.createElement("button",{type:"button",className:"kui-reset kui-SidebarSearchClear",onClick:()=>{r(""),c.current?.focus()},"aria-label":"Clear search"},e.createElement(J,null))),o&&e.createElement("div",{id:h,role:"group","aria-label":"Search results"},o))))):e.createElement("div",{...u,ref:p,className:d("kui-SidebarSearch","kui-SidebarSearch--expanded","kui-ShellPaneChrome",`kui-r-size-${s?.size??"2"}`,a),role:"search"},e.createElement("div",{className:"kui-SidebarSearchInputWrapper"},e.createElement(L,{className:"kui-SidebarSearchIcon"}),e.createElement("input",{ref:c,type:"search",className:"kui-SidebarSearchInput",value:t,onChange:i=>r(i.target.value),onKeyDown:M,placeholder:n,"aria-label":m}),t&&e.createElement("button",{type:"button",className:"kui-reset kui-SidebarSearchClear",onClick:()=>{r(""),c.current?.focus()},"aria-label":"Clear search"},e.createElement(J,null))))});se.displayName="Sidebar.Search";export{Q as a,Y as b,A as c,B as d,ee as e,te as f,re as g,oe as h,ae as i,ie as j,se as k,le as l};
3
- //# sourceMappingURL=chunk-JIF77MRB.js.map