@womp/kookie-ui 0.34.0 → 0.34.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 (320) hide show
  1. package/README.md +1 -1
  2. package/components.css +15 -4
  3. package/dist/cjs/components/_internal/pane-chrome.d.ts +1 -2
  4. package/dist/cjs/components/_internal/pane-chrome.d.ts.map +1 -1
  5. package/dist/cjs/components/_internal/pane-chrome.js.map +2 -2
  6. package/dist/cjs/components/_internal/shell-bottom.js +1 -1
  7. package/dist/cjs/components/_internal/shell-bottom.js.map +3 -3
  8. package/dist/cjs/components/_internal/shell-handles.d.ts.map +1 -1
  9. package/dist/cjs/components/_internal/shell-handles.js +1 -1
  10. package/dist/cjs/components/_internal/shell-handles.js.map +3 -3
  11. package/dist/cjs/components/_internal/shell-inspector.js +1 -1
  12. package/dist/cjs/components/_internal/shell-inspector.js.map +3 -3
  13. package/dist/cjs/components/_internal/shell-resizable.d.ts.map +1 -1
  14. package/dist/cjs/components/_internal/shell-resizable.js +1 -1
  15. package/dist/cjs/components/_internal/shell-resizable.js.map +3 -3
  16. package/dist/cjs/components/_internal/shell-resize.d.ts +2 -0
  17. package/dist/cjs/components/_internal/shell-resize.d.ts.map +1 -1
  18. package/dist/cjs/components/_internal/shell-resize.js.map +2 -2
  19. package/dist/cjs/components/_internal/shell-sidebar.js +1 -1
  20. package/dist/cjs/components/_internal/shell-sidebar.js.map +3 -3
  21. package/dist/cjs/components/avatar.d.ts.map +1 -1
  22. package/dist/cjs/components/avatar.js +1 -1
  23. package/dist/cjs/components/avatar.js.map +2 -2
  24. package/dist/cjs/components/button.js +1 -1
  25. package/dist/cjs/components/button.js.map +3 -3
  26. package/dist/cjs/components/chatbar.d.ts.map +1 -1
  27. package/dist/cjs/components/chatbar.js +1 -1
  28. package/dist/cjs/components/chatbar.js.map +3 -3
  29. package/dist/cjs/components/combobox.d.ts +16 -0
  30. package/dist/cjs/components/combobox.d.ts.map +1 -1
  31. package/dist/cjs/components/combobox.js +1 -1
  32. package/dist/cjs/components/combobox.js.map +2 -2
  33. package/dist/cjs/components/index.js +2 -2
  34. package/dist/cjs/components/index.js.map +3 -3
  35. package/dist/cjs/components/message-scroller.js +1 -1
  36. package/dist/cjs/components/message-scroller.js.map +3 -3
  37. package/dist/cjs/components/navbar.d.ts.map +1 -1
  38. package/dist/cjs/components/navbar.js +1 -1
  39. package/dist/cjs/components/navbar.js.map +3 -3
  40. package/dist/cjs/components/navigator.js +1 -1
  41. package/dist/cjs/components/navigator.js.map +3 -3
  42. package/dist/cjs/components/notice.js +1 -1
  43. package/dist/cjs/components/notice.js.map +3 -3
  44. package/dist/cjs/components/schemas/base-button.schema.d.ts +7 -0
  45. package/dist/cjs/components/schemas/base-button.schema.d.ts.map +1 -1
  46. package/dist/cjs/components/schemas/base-button.schema.js +1 -1
  47. package/dist/cjs/components/schemas/base-button.schema.js.map +2 -2
  48. package/dist/cjs/components/schemas/button.schema.d.ts +14 -0
  49. package/dist/cjs/components/schemas/button.schema.d.ts.map +1 -1
  50. package/dist/cjs/components/schemas/button.schema.js +1 -1
  51. package/dist/cjs/components/schemas/button.schema.js.map +2 -2
  52. package/dist/cjs/components/schemas/index.js +1 -1
  53. package/dist/cjs/components/schemas/index.js.map +2 -2
  54. package/dist/cjs/components/schemas/shell.schema.d.ts +7 -6
  55. package/dist/cjs/components/schemas/shell.schema.d.ts.map +1 -1
  56. package/dist/cjs/components/schemas/shell.schema.js +1 -1
  57. package/dist/cjs/components/schemas/shell.schema.js.map +2 -2
  58. package/dist/cjs/components/schemas/toggle.schema.d.ts +83 -77
  59. package/dist/cjs/components/schemas/toggle.schema.d.ts.map +1 -1
  60. package/dist/cjs/components/schemas/toggle.schema.js +1 -1
  61. package/dist/cjs/components/schemas/toggle.schema.js.map +2 -2
  62. package/dist/cjs/components/segmented-control.d.ts.map +1 -1
  63. package/dist/cjs/components/segmented-control.js +1 -1
  64. package/dist/cjs/components/segmented-control.js.map +3 -3
  65. package/dist/cjs/components/select.js +1 -1
  66. package/dist/cjs/components/select.js.map +2 -2
  67. package/dist/cjs/components/sheet.d.ts +2 -2
  68. package/dist/cjs/components/sheet.js.map +1 -1
  69. package/dist/cjs/components/shell.context.js.map +1 -1
  70. package/dist/cjs/components/shell.js +1 -1
  71. package/dist/cjs/components/shell.js.map +3 -3
  72. package/dist/cjs/components/sidebar.d.ts +1 -1
  73. package/dist/cjs/components/sidebar.d.ts.map +1 -1
  74. package/dist/cjs/components/sidebar.js +1 -1
  75. package/dist/cjs/components/sidebar.js.map +3 -3
  76. package/dist/cjs/components/table.d.ts.map +1 -1
  77. package/dist/cjs/components/table.js +1 -1
  78. package/dist/cjs/components/table.js.map +3 -3
  79. package/dist/cjs/components/text-field.d.ts.map +1 -1
  80. package/dist/cjs/components/text-field.js +2 -2
  81. package/dist/cjs/components/text-field.js.map +3 -3
  82. package/dist/cjs/components/toggle.js +1 -1
  83. package/dist/cjs/components/toggle.js.map +3 -3
  84. package/dist/cjs/components/toolbar.js +1 -1
  85. package/dist/cjs/components/toolbar.js.map +3 -3
  86. package/dist/cjs/components/virtual-menu.d.ts.map +1 -1
  87. package/dist/cjs/components/virtual-menu.js +1 -1
  88. package/dist/cjs/components/virtual-menu.js.map +3 -3
  89. package/dist/cjs/helpers/index.js +3 -3
  90. package/dist/cjs/helpers/index.js.map +2 -2
  91. package/dist/cjs/helpers/map-prop-values.d.ts.map +1 -1
  92. package/dist/cjs/helpers/map-prop-values.js +1 -1
  93. package/dist/cjs/helpers/map-prop-values.js.map +2 -2
  94. package/dist/cjs/index.js +4 -4
  95. package/dist/cjs/index.js.map +3 -3
  96. package/dist/cjs/props/index.d.ts +6 -0
  97. package/dist/cjs/props/index.d.ts.map +1 -1
  98. package/dist/cjs/props/index.js +1 -1
  99. package/dist/cjs/props/index.js.map +4 -4
  100. package/dist/esm/chunk-25FNCKUM.js +2 -0
  101. package/dist/esm/chunk-25FNCKUM.js.map +7 -0
  102. package/dist/esm/{chunk-KDJM4NQQ.js → chunk-2WFN4D52.js} +2 -2
  103. package/dist/esm/chunk-4OJRLS5N.js +3 -0
  104. package/dist/esm/chunk-4OJRLS5N.js.map +7 -0
  105. package/dist/esm/chunk-4TTRPCGG.js +3 -0
  106. package/dist/esm/{chunk-QKCNGEX4.js.map → chunk-4TTRPCGG.js.map} +3 -3
  107. package/dist/esm/chunk-4X64QOAR.js +3 -0
  108. package/dist/esm/chunk-4X64QOAR.js.map +7 -0
  109. package/dist/esm/{chunk-L7PRLW6A.js → chunk-5APRBJRR.js} +2 -2
  110. package/dist/esm/{chunk-L7PRLW6A.js.map → chunk-5APRBJRR.js.map} +2 -2
  111. package/dist/esm/chunk-7HD5LS3M.js +3 -0
  112. package/dist/esm/chunk-7HD5LS3M.js.map +7 -0
  113. package/dist/esm/chunk-7ZOGH5NT.js +2 -0
  114. package/dist/esm/chunk-7ZOGH5NT.js.map +7 -0
  115. package/dist/esm/chunk-BJA75XKG.js +2 -0
  116. package/dist/esm/chunk-BJA75XKG.js.map +7 -0
  117. package/dist/esm/{chunk-NO2JCJWI.js → chunk-BJVXB3PN.js} +2 -2
  118. package/dist/esm/{chunk-BR6Z2CAE.js → chunk-C6VGCYFQ.js} +2 -2
  119. package/dist/esm/chunk-EZYXYLR2.js +2 -0
  120. package/dist/esm/chunk-EZYXYLR2.js.map +7 -0
  121. package/dist/esm/chunk-FTNZWAPB.js +3 -0
  122. package/dist/esm/{chunk-7QBNXNEN.js.map → chunk-FTNZWAPB.js.map} +3 -3
  123. package/dist/esm/{chunk-ZLGOZKB3.js → chunk-FYZXC7AL.js} +2 -2
  124. package/dist/esm/{chunk-XD676L6S.js → chunk-HQT32HQ6.js} +2 -2
  125. package/dist/esm/{chunk-XKYPJTRN.js → chunk-I5TPDYJO.js} +2 -2
  126. package/dist/esm/chunk-I77CYEBT.js +2 -0
  127. package/dist/esm/chunk-I77CYEBT.js.map +7 -0
  128. package/dist/esm/{chunk-API4DAPY.js → chunk-J7MIXG6M.js} +1 -1
  129. package/dist/esm/chunk-J7MIXG6M.js.map +7 -0
  130. package/dist/esm/{chunk-UMQOTGJC.js → chunk-M26LLCQC.js} +2 -2
  131. package/dist/esm/{chunk-WN3WMFAM.js → chunk-MLHS2GWL.js} +2 -2
  132. package/dist/esm/chunk-MPLBIPJ6.js +3 -0
  133. package/dist/esm/chunk-MPLBIPJ6.js.map +7 -0
  134. package/dist/esm/{chunk-WEBNIUEX.js → chunk-MXEOE4LA.js} +1 -1
  135. package/dist/esm/chunk-MXEOE4LA.js.map +7 -0
  136. package/dist/esm/chunk-OGVKMDO7.js +3 -0
  137. package/dist/esm/chunk-OGVKMDO7.js.map +7 -0
  138. package/dist/esm/{chunk-ODHCDJ3Y.js → chunk-PMXIQ5B4.js} +1 -1
  139. package/dist/esm/chunk-PMXIQ5B4.js.map +7 -0
  140. package/dist/esm/{chunk-LG5DPQ46.js → chunk-R4DMVTM3.js} +2 -2
  141. package/dist/esm/{chunk-LG5DPQ46.js.map → chunk-R4DMVTM3.js.map} +3 -3
  142. package/dist/esm/chunk-S6SEWECR.js +3 -0
  143. package/dist/esm/{chunk-5VYQDA5S.js.map → chunk-S6SEWECR.js.map} +3 -3
  144. package/dist/esm/{chunk-7YXHLU4C.js → chunk-TANYRHGP.js} +2 -2
  145. package/dist/esm/{chunk-INGT6DB6.js → chunk-TS4QCDSI.js} +1 -1
  146. package/dist/esm/chunk-TS4QCDSI.js.map +7 -0
  147. package/dist/esm/chunk-WYLIU3Q6.js +2 -0
  148. package/dist/esm/chunk-WYLIU3Q6.js.map +7 -0
  149. package/dist/esm/chunk-X4PWBFOT.js +3 -0
  150. package/dist/esm/chunk-X4PWBFOT.js.map +7 -0
  151. package/dist/esm/chunk-XFMAA4MD.js +3 -0
  152. package/dist/esm/chunk-XFMAA4MD.js.map +7 -0
  153. package/dist/esm/chunk-XGV7KNSE.js +3 -0
  154. package/dist/esm/chunk-XGV7KNSE.js.map +7 -0
  155. package/dist/esm/chunk-XOAOSRTH.js +3 -0
  156. package/dist/esm/chunk-XOAOSRTH.js.map +7 -0
  157. package/dist/esm/{chunk-YOTTLPJ3.js → chunk-Y5ITMKC6.js} +2 -2
  158. package/dist/esm/chunk-YLGIP3A5.js +6 -0
  159. package/dist/esm/chunk-YLGIP3A5.js.map +7 -0
  160. package/dist/esm/chunk-YLPCYCYA.js +3 -0
  161. package/dist/esm/chunk-YLPCYCYA.js.map +7 -0
  162. package/dist/esm/components/_internal/pane-chrome.d.ts +1 -2
  163. package/dist/esm/components/_internal/pane-chrome.d.ts.map +1 -1
  164. package/dist/esm/components/_internal/pane-chrome.js +1 -1
  165. package/dist/esm/components/_internal/shell-bottom.js +1 -1
  166. package/dist/esm/components/_internal/shell-handles.d.ts.map +1 -1
  167. package/dist/esm/components/_internal/shell-handles.js +1 -1
  168. package/dist/esm/components/_internal/shell-inspector.js +1 -1
  169. package/dist/esm/components/_internal/shell-resizable.d.ts.map +1 -1
  170. package/dist/esm/components/_internal/shell-resizable.js +1 -1
  171. package/dist/esm/components/_internal/shell-resize.d.ts +2 -0
  172. package/dist/esm/components/_internal/shell-resize.d.ts.map +1 -1
  173. package/dist/esm/components/_internal/shell-resize.js +1 -1
  174. package/dist/esm/components/_internal/shell-sidebar.js +1 -1
  175. package/dist/esm/components/accordion.props.js +1 -1
  176. package/dist/esm/components/accordion.props.js.map +4 -4
  177. package/dist/esm/components/avatar.d.ts.map +1 -1
  178. package/dist/esm/components/avatar.js +1 -1
  179. package/dist/esm/components/button.js +1 -1
  180. package/dist/esm/components/chatbar.d.ts.map +1 -1
  181. package/dist/esm/components/chatbar.js +1 -1
  182. package/dist/esm/components/combobox.d.ts +16 -0
  183. package/dist/esm/components/combobox.d.ts.map +1 -1
  184. package/dist/esm/components/combobox.js +1 -1
  185. package/dist/esm/components/combobox.props.js +1 -1
  186. package/dist/esm/components/combobox.props.js.map +4 -4
  187. package/dist/esm/components/image.props.js +1 -1
  188. package/dist/esm/components/image.props.js.map +4 -4
  189. package/dist/esm/components/index.js +1 -1
  190. package/dist/esm/components/message-scroller.js +1 -1
  191. package/dist/esm/components/navbar.d.ts.map +1 -1
  192. package/dist/esm/components/navbar.js +1 -1
  193. package/dist/esm/components/navbar.props.js +1 -1
  194. package/dist/esm/components/navbar.props.js.map +4 -4
  195. package/dist/esm/components/navigator.js +1 -1
  196. package/dist/esm/components/notice.js +1 -1
  197. package/dist/esm/components/schemas/base-button.schema.d.ts +7 -0
  198. package/dist/esm/components/schemas/base-button.schema.d.ts.map +1 -1
  199. package/dist/esm/components/schemas/base-button.schema.js +1 -1
  200. package/dist/esm/components/schemas/button.schema.d.ts +14 -0
  201. package/dist/esm/components/schemas/button.schema.d.ts.map +1 -1
  202. package/dist/esm/components/schemas/button.schema.js +1 -1
  203. package/dist/esm/components/schemas/index.js +1 -1
  204. package/dist/esm/components/schemas/shell.schema.d.ts +7 -6
  205. package/dist/esm/components/schemas/shell.schema.d.ts.map +1 -1
  206. package/dist/esm/components/schemas/shell.schema.js +1 -1
  207. package/dist/esm/components/schemas/toggle.schema.d.ts +83 -77
  208. package/dist/esm/components/schemas/toggle.schema.d.ts.map +1 -1
  209. package/dist/esm/components/schemas/toggle.schema.js +1 -1
  210. package/dist/esm/components/segmented-control.d.ts.map +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.d.ts +2 -2
  214. package/dist/esm/components/sheet.js +1 -1
  215. package/dist/esm/components/shell.context.js +1 -1
  216. package/dist/esm/components/shell.js +1 -1
  217. package/dist/esm/components/sidebar.d.ts +1 -1
  218. package/dist/esm/components/sidebar.d.ts.map +1 -1
  219. package/dist/esm/components/sidebar.js +1 -1
  220. package/dist/esm/components/table.d.ts.map +1 -1
  221. package/dist/esm/components/table.js +1 -1
  222. package/dist/esm/components/text-field.d.ts.map +1 -1
  223. package/dist/esm/components/text-field.js +1 -1
  224. package/dist/esm/components/toggle.js +1 -1
  225. package/dist/esm/components/toolbar.js +1 -1
  226. package/dist/esm/components/toolbar.props.js +1 -1
  227. package/dist/esm/components/toolbar.props.js.map +4 -4
  228. package/dist/esm/components/virtual-menu.d.ts.map +1 -1
  229. package/dist/esm/components/virtual-menu.js +1 -1
  230. package/dist/esm/helpers/index.js +1 -1
  231. package/dist/esm/helpers/map-prop-values.d.ts.map +1 -1
  232. package/dist/esm/helpers/map-prop-values.js +1 -1
  233. package/dist/esm/index.js +1 -1
  234. package/dist/esm/props/index.d.ts +6 -0
  235. package/dist/esm/props/index.d.ts.map +1 -1
  236. package/dist/esm/props/index.js +1 -1
  237. package/layout/utilities.css +810 -0
  238. package/layout.css +810 -0
  239. package/package.json +3 -4
  240. package/schemas/base-button.json +13 -0
  241. package/schemas/button.json +13 -0
  242. package/schemas/index.json +51 -12
  243. package/schemas/shell-bottom.json +2 -2
  244. package/schemas/shell-content.json +2 -2
  245. package/schemas/shell-header.json +4 -0
  246. package/schemas/shell-inspector.json +2 -2
  247. package/schemas/shell-panel.json +2 -2
  248. package/schemas/shell-rail.json +2 -2
  249. package/schemas/shell-sidebar.json +2 -2
  250. package/schemas/toggle.json +9 -0
  251. package/src/components/_internal/base-dialog.css +1 -1
  252. package/src/components/_internal/pane-chrome.tsx +2 -3
  253. package/src/components/_internal/shell-handles.tsx +3 -0
  254. package/src/components/_internal/shell-resizable.tsx +9 -0
  255. package/src/components/_internal/shell-resize.tsx +2 -0
  256. package/src/components/avatar.tsx +3 -1
  257. package/src/components/button.tsx +1 -1
  258. package/src/components/chatbar.tsx +2 -1
  259. package/src/components/combobox.tsx +2 -3
  260. package/src/components/navbar.tsx +3 -4
  261. package/src/components/navigator.css +4 -4
  262. package/src/components/schemas/base-button.schema.ts +7 -0
  263. package/src/components/schemas/shell.schema.ts +3 -2
  264. package/src/components/schemas/toggle.schema.ts +2 -1
  265. package/src/components/segmented-control.css +13 -0
  266. package/src/components/segmented-control.tsx +10 -2
  267. package/src/components/select.tsx +2 -2
  268. package/src/components/sheet.tsx +2 -2
  269. package/src/components/shell.context.tsx +1 -1
  270. package/src/components/sidebar.tsx +1 -1
  271. package/src/components/table.tsx +4 -1
  272. package/src/components/text-field.css +2 -2
  273. package/src/components/text-field.tsx +11 -4
  274. package/src/components/virtual-menu.tsx +8 -1
  275. package/src/helpers/map-prop-values.ts +0 -1
  276. package/src/props/index.ts +6 -0
  277. package/src/styles/utilities/inset.css +135 -0
  278. package/styles.css +825 -4
  279. package/utilities.css +810 -0
  280. package/dist/esm/chunk-3QWGSRYC.js +0 -3
  281. package/dist/esm/chunk-3QWGSRYC.js.map +0 -7
  282. package/dist/esm/chunk-5KQCG7AV.js +0 -3
  283. package/dist/esm/chunk-5KQCG7AV.js.map +0 -7
  284. package/dist/esm/chunk-5VYQDA5S.js +0 -3
  285. package/dist/esm/chunk-7QBNXNEN.js +0 -3
  286. package/dist/esm/chunk-API4DAPY.js.map +0 -7
  287. package/dist/esm/chunk-BQOFHLDP.js +0 -3
  288. package/dist/esm/chunk-BQOFHLDP.js.map +0 -7
  289. package/dist/esm/chunk-CZ24FOFS.js +0 -3
  290. package/dist/esm/chunk-CZ24FOFS.js.map +0 -7
  291. package/dist/esm/chunk-EERKYRYI.js +0 -3
  292. package/dist/esm/chunk-EERKYRYI.js.map +0 -7
  293. package/dist/esm/chunk-HZYE46V2.js +0 -2
  294. package/dist/esm/chunk-HZYE46V2.js.map +0 -7
  295. package/dist/esm/chunk-IN2WND4B.js +0 -3
  296. package/dist/esm/chunk-IN2WND4B.js.map +0 -7
  297. package/dist/esm/chunk-INGT6DB6.js.map +0 -7
  298. package/dist/esm/chunk-J6B7UCZN.js +0 -3
  299. package/dist/esm/chunk-J6B7UCZN.js.map +0 -7
  300. package/dist/esm/chunk-JQMWNI62.js +0 -3
  301. package/dist/esm/chunk-JQMWNI62.js.map +0 -7
  302. package/dist/esm/chunk-ODHCDJ3Y.js.map +0 -7
  303. package/dist/esm/chunk-QKCNGEX4.js +0 -3
  304. package/dist/esm/chunk-TMINGBSQ.js +0 -3
  305. package/dist/esm/chunk-TMINGBSQ.js.map +0 -7
  306. package/dist/esm/chunk-WEBNIUEX.js.map +0 -7
  307. package/dist/esm/chunk-XF6Z5NKE.js +0 -3
  308. package/dist/esm/chunk-XF6Z5NKE.js.map +0 -7
  309. package/dist/esm/chunk-Y44DYJA5.js +0 -6
  310. package/dist/esm/chunk-Y44DYJA5.js.map +0 -7
  311. /package/dist/esm/{chunk-KDJM4NQQ.js.map → chunk-2WFN4D52.js.map} +0 -0
  312. /package/dist/esm/{chunk-NO2JCJWI.js.map → chunk-BJVXB3PN.js.map} +0 -0
  313. /package/dist/esm/{chunk-BR6Z2CAE.js.map → chunk-C6VGCYFQ.js.map} +0 -0
  314. /package/dist/esm/{chunk-ZLGOZKB3.js.map → chunk-FYZXC7AL.js.map} +0 -0
  315. /package/dist/esm/{chunk-XD676L6S.js.map → chunk-HQT32HQ6.js.map} +0 -0
  316. /package/dist/esm/{chunk-XKYPJTRN.js.map → chunk-I5TPDYJO.js.map} +0 -0
  317. /package/dist/esm/{chunk-UMQOTGJC.js.map → chunk-M26LLCQC.js.map} +0 -0
  318. /package/dist/esm/{chunk-WN3WMFAM.js.map → chunk-MLHS2GWL.js.map} +0 -0
  319. /package/dist/esm/{chunk-7YXHLU4C.js.map → chunk-TANYRHGP.js.map} +0 -0
  320. /package/dist/esm/{chunk-YOTTLPJ3.js.map → chunk-Y5ITMKC6.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-menu.d.ts","sourceRoot":"","sources":["../../../src/components/virtual-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAMH,mDAAmD;AACnD,UAAU,0BAA0B,CAAC,CAAC;IACpC,oBAAoB;IACpB,IAAI,EAAE,CAAC,CAAC;IACR,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD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AAG,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,KAC7D,KAAK,CAAC,YAAY;kBAAoB,MAAM;;;CAgD/C,CAAC;AAEH,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,CAAC"}
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- "use strict";"use client";var Me=Object.create;var P=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var Re=Object.getOwnPropertyNames;var ge=Object.getPrototypeOf,he=Object.prototype.hasOwnProperty;var ve=(n,r)=>{for(var i in r)P(n,i,{get:r[i],enumerable:!0})},q=(n,r,i,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let c of Re(r))!he.call(n,c)&&c!==i&&P(n,c,{get:()=>r[c],enumerable:!(o=pe(r,c))||o.enumerable});return n};var z=(n,r,i)=>(i=n!=null?Me(ge(n)):{},q(r||!n||!n.__esModule?P(i,"default",{value:n,enumerable:!0}):i,n)),be=n=>q(P({},"__esModule",{value:!0}),n);var He={};ve(He,{VirtualMenu:()=>Se});module.exports=be(He);var t=z(require("react")),S=z(require("classnames")),Y=require("@tanstack/react-virtual"),N=require("radix-ui/internal");var d=z(require("react")),Ie=require("radix-ui/internal");var xe=d.createContext({isInsideMenu:!1}),ye=d.createContext(null),Ee={1:24,2:30,3:34,4:38};function D(n){return Ee[n]}function W(){return d.useContext(xe)}var _=d.createContext(void 0),Ve=_.Provider;function U(){return d.useContext(_)}var ze=ye.Provider;function J(n,r){if(n.style?.height!==r.style?.height||n.style?.transform!==r.style?.transform)return!1;let i=Object.keys(n);return i.length!==Object.keys(r).length?!1:i.every(o=>o==="style"||Object.is(n[o],r[o]))}var Te=t.memo(function({label:r,isHighlighted:i,id:o,style:c,tabIndex:p,"data-highlighted":l,"data-index":R,"aria-setsize":x,"aria-posinset":y,onMouseEnter:E,onMouseLeave:H,onClick:f,onKeyDown:T}){return t.createElement("div",{id:o,role:"menuitem",className:(0,S.default)("kui-reset","kui-BaseMenuItem","kui-VirtualMenuItem"),style:c,tabIndex:p,"data-highlighted":l,"data-index":R,"aria-setsize":x,"aria-posinset":y,onMouseEnter:E,onMouseLeave:H,onClick:f,onKeyDown:T},r)},J);function ke(n,r,i){let[o,c]=t.useState(void 0);return(0,N.useLayoutEffect)(()=>{let p=n.current;if(!r||!p)return;let l=document.createElement("div");l.className="kui-reset kui-BaseMenuItem kui-VirtualMenuItem",l.setAttribute("aria-hidden","true"),l.style.visibility="hidden",l.textContent="\xA0",p.appendChild(l);let R=l.getBoundingClientRect().height;l.remove(),c(R>0?R:void 0)},[n,r,i]),r?o:void 0}function Ce({items:n,itemLabel:r,renderItem:i,size:o,estimatedItemSize:c,overscan:p=5,onSelect:l,className:R,style:x,onKeyDown:y,onFocus:E,...H},f){let T=t.useId(),k=t.useRef(null),[L,M]=t.useState(-1),{isInsideMenu:m,size:w,itemHeight:Z}=W(),K=U(),ee=t.useCallback(e=>{k.current=e,typeof f=="function"?f(e):f&&(f.current=e)},[f]),te=ke(k,m&&o==null&&c==null,w),v=c??(o?D(o):te??Z??D(w??"2"));if(!r&&!i)throw new Error("VirtualMenu requires either itemLabel or renderItem prop");let ne=t.useMemo(()=>r?typeof r=="function"?r:e=>e[r]:null,[r]),b=t.useMemo(()=>n.length===0||L<0?-1:Math.min(L,n.length-1),[L,n.length]),re=t.useMemo(()=>typeof v=="function"?v:()=>v,[v]),g=(0,Y.useVirtualizer)({count:n.length,getScrollElement:()=>k.current,estimateSize:re,overscan:p}),ue=g.getVirtualItems();(0,N.useLayoutEffect)(()=>{g.measure()},[g,v]),t.useEffect(()=>{let e=k.current;if(!m||!e)return;let u=e.closest("[data-radix-menu-content]");if(!u)return;let a=s=>{s.target===u&&e.focus({preventScroll:!0})};return u.addEventListener("focusin",a),document.activeElement===u&&e.focus({preventScroll:!0}),()=>u.removeEventListener("focusin",a)},[m]);let O=t.useRef(y),j=t.useRef(E);O.current=y,j.current=E;let C=t.useRef(n),F=t.useRef(l),B=t.useRef(K);C.current=n,F.current=l,B.current=K;let h=t.useCallback(e=>{let u=C.current;e<0||e>=u.length||(F.current?.(u[e],e),B.current?.())},[]),I=t.useRef(g.scrollToIndex);I.current=g.scrollToIndex;let V=t.useRef(b);V.current=b;let ie=t.useCallback(e=>{let u=e.currentTarget.dataset.index;u!=null&&M(Number(u))},[]),oe=t.useCallback(e=>{let u=e.currentTarget.dataset.index;u!=null&&h(Number(u))},[h]),ae=t.useCallback(e=>{let u=Number(e.currentTarget.dataset.index);M(a=>a===u?-1:a)},[]),se=t.useCallback(e=>{if(e.key==="Enter"||e.key===" "){e.preventDefault(),e.stopPropagation();let u=e.currentTarget.dataset.index;u!=null&&h(Number(u))}},[h]),ce=t.useCallback(e=>{if(O.current?.(e),e.defaultPrevented)return;let u=C.current,a=V.current;switch(e.key){case"ArrowDown":{e.preventDefault();let s=a<u.length-1?a+1:0;M(s),I.current(s,{align:"auto"});break}case"ArrowUp":{e.preventDefault();let s=a>0?a-1:u.length-1;M(s),I.current(s,{align:"auto"});break}case"Home":{e.preventDefault(),M(0),I.current(0,{align:"start"});break}case"End":{e.preventDefault();let s=u.length-1;M(s),I.current(s,{align:"end"});break}case"Enter":case" ":{e.preventDefault(),h(a);break}case"Tab":{m&&e.preventDefault();break}case"Escape":{m||e.currentTarget.blur();break}default:m&&e.key.length===1&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.stopPropagation()}},[h,m]),le=t.useCallback(e=>{j.current?.(e),e.target===e.currentTarget&&V.current<0&&C.current.length>0&&M(0)},[]),G=t.useCallback(e=>`${T}-item-${e}`,[T]),de=t.useMemo(()=>({overflow:"auto",position:"relative",...x}),[x]),$=g.getTotalSize(),me=t.useMemo(()=>({height:`${$}px`,width:"100%",position:"relative"}),[$]);return t.createElement("div",{...H,ref:ee,role:m?"group":"menu","aria-activedescendant":b>=0?G(b):void 0,tabIndex:0,onKeyDown:ce,onFocus:le,className:(0,S.default)("kui-VirtualMenuRoot",!m&&`kui-r-size-${o??"2"}`,R),style:de},t.createElement("div",{className:"kui-VirtualMenuViewport",style:me},ue.map(e=>{let u=n[e.index],a=e.index,s=b===a,fe={height:e.size,transform:`translateY(${e.start}px)`},A={id:G(a),isHighlighted:s,style:fe,tabIndex:-1,"data-highlighted":s?!0:void 0,"data-index":a,"aria-setsize":n.length,"aria-posinset":a+1,onMouseEnter:ie,onMouseLeave:ae,onClick:oe,onKeyDown:se};return i?t.createElement(i,{key:e.key,item:u,index:a,...A}):t.createElement(Te,{key:e.key,label:ne(u),...A})})))}var Q=t.forwardRef(Ce);Q.displayName="VirtualMenu";var X=t.forwardRef(({className:n,children:r,...i},o)=>t.createElement("div",{ref:o,role:"menuitem",className:(0,S.default)("kui-reset","kui-BaseMenuItem","kui-VirtualMenuItem",n),...i},r));X.displayName="VirtualMenu.Item";var Pe=t.memo(X,J),Se=Object.assign(Q,{Item:Pe});
2
+ "use strict";"use client";var pe=Object.create;var H=Object.defineProperty;var Me=Object.getOwnPropertyDescriptor;var Re=Object.getOwnPropertyNames;var ge=Object.getPrototypeOf,he=Object.prototype.hasOwnProperty;var ve=(n,r)=>{for(var o in r)H(n,o,{get:r[o],enumerable:!0})},A=(n,r,o,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of Re(r))!he.call(n,s)&&s!==o&&H(n,s,{get:()=>r[s],enumerable:!(u=Me(r,s))||u.enumerable});return n};var z=(n,r,o)=>(o=n!=null?pe(ge(n)):{},A(r||!n||!n.__esModule?H(o,"default",{value:n,enumerable:!0}):o,n)),be=n=>A(H({},"__esModule",{value:!0}),n);var Se={};ve(Se,{VirtualMenu:()=>Pe});module.exports=be(Se);var t=z(require("react")),P=z(require("classnames")),Y=require("@tanstack/react-virtual"),w=require("radix-ui/internal");var d=z(require("react")),xe=require("radix-ui/internal");var Ie=d.createContext({isInsideMenu:!1}),ye=d.createContext(null),Ee={1:24,2:30,3:34,4:38};function D(n){return Ee[n]}function q(){return d.useContext(Ie)}var W=d.createContext(void 0),Ve=W.Provider;function U(){return d.useContext(W)}var ze=ye.Provider;function J(n,r){if(n.style?.height!==r.style?.height||n.style?.transform!==r.style?.transform)return!1;let o=Object.keys(n);return o.length!==Object.keys(r).length?!1:o.every(u=>u==="style"||Object.is(n[u],r[u]))}var Te=t.memo(function({label:r,isHighlighted:o,id:u,style:s,tabIndex:p,"data-highlighted":c,"data-index":f,"aria-setsize":I,"aria-posinset":y,onMouseEnter:E,onMouseLeave:S,onClick:M,onKeyDown:T}){return t.createElement("div",{id:u,role:"menuitem",className:(0,P.default)("kui-reset","kui-BaseMenuItem","kui-VirtualMenuItem"),style:s,tabIndex:p,"data-highlighted":c,"data-index":f,"aria-setsize":I,"aria-posinset":y,onMouseEnter:E,onMouseLeave:S,onClick:M,onKeyDown:T},r)},J);function ke(n,r,o){let[u,s]=t.useState(void 0);return(0,w.useLayoutEffect)(()=>{let p=n.current;if(!r||!p)return;let c=document.createElement("div");c.className="kui-reset kui-BaseMenuItem kui-VirtualMenuItem",c.setAttribute("aria-hidden","true"),c.style.visibility="hidden",c.textContent="\xA0",p.appendChild(c);let f=c.getBoundingClientRect().height;c.remove(),s(f>0?f:void 0)},[n,r,o]),r?u:void 0}function Ce({items:n,itemLabel:r,renderItem:o,size:u,estimatedItemSize:s,overscan:p=5,onSelect:c,className:f,style:I,onKeyDown:y,onFocus:E,...S},M){let T=t.useId(),k=t.useRef(null),[L,R]=t.useState(-1),{isInsideMenu:m,size:N,itemHeight:Z}=q(),K=U(),ee=t.useCallback(e=>{k.current=e,typeof M=="function"?M(e):M&&(M.current=e)},[M]),te=ke(k,m&&u==null&&s==null,N),v=s??(u?D(u):te??Z??D(N??"2"));if(!r&&!o)throw new Error("VirtualMenu requires either itemLabel or renderItem prop");let ne=t.useMemo(()=>r?typeof r=="function"?r:e=>e[r]:null,[r]),b=t.useMemo(()=>n.length===0||L<0?-1:Math.min(L,n.length-1),[L,n.length]),re=t.useMemo(()=>typeof v=="function"?v:()=>v,[v]),g=(0,Y.useVirtualizer)({count:n.length,getScrollElement:()=>k.current,estimateSize:re,overscan:p}),ie=g.getVirtualItems();(0,w.useLayoutEffect)(()=>{g.measure()},[g,v]),t.useEffect(()=>{let e=k.current;if(!m||!e)return;let i=e.closest("[data-radix-menu-content]");if(!i)return;let a=l=>{l.target===i&&e.focus({preventScroll:!0})};return i.addEventListener("focusin",a),document.activeElement===i&&e.focus({preventScroll:!0}),()=>i.removeEventListener("focusin",a)},[m]);let O=t.useRef(y),j=t.useRef(E);O.current=y,j.current=E;let C=t.useRef(n),F=t.useRef(c),B=t.useRef(K);C.current=n,F.current=c,B.current=K;let h=t.useCallback(e=>{let i=C.current;e<0||e>=i.length||(F.current?.(i[e],e),B.current?.())},[]),x=t.useRef(g.scrollToIndex);x.current=g.scrollToIndex;let V=t.useRef(b);V.current=b;let oe=t.useCallback(e=>{let i=e.currentTarget.dataset.index;i!=null&&R(Number(i))},[]),ue=t.useCallback(e=>{let i=e.currentTarget.dataset.index;i!=null&&h(Number(i))},[h]),ae=t.useCallback(e=>{let i=Number(e.currentTarget.dataset.index);R(a=>a===i?-1:a)},[]),se=t.useCallback(e=>{if(e.key==="Enter"||e.key===" "){e.preventDefault(),e.stopPropagation();let i=e.currentTarget.dataset.index;i!=null&&h(Number(i))}},[h]),ce=t.useCallback(e=>{if(O.current?.(e),e.defaultPrevented)return;let i=C.current,a=V.current;switch(e.key){case"ArrowDown":{e.preventDefault();let l=a<i.length-1?a+1:0;R(l),x.current(l,{align:"auto"});break}case"ArrowUp":{e.preventDefault();let l=a>0?a-1:i.length-1;R(l),x.current(l,{align:"auto"});break}case"Home":{e.preventDefault(),R(0),x.current(0,{align:"start"});break}case"End":{e.preventDefault();let l=i.length-1;R(l),x.current(l,{align:"end"});break}case"Enter":case" ":{e.preventDefault(),h(a);break}case"Tab":{m&&e.preventDefault();break}case"Escape":{m||e.currentTarget.blur();break}default:m&&e.key.length===1&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.stopPropagation()}},[h,m]),le=t.useCallback(e=>{j.current?.(e),e.target===e.currentTarget&&V.current<0&&C.current.length>0&&R(0)},[]),G=t.useCallback(e=>`${T}-item-${e}`,[T]),de=t.useMemo(()=>({overflow:"auto",position:"relative",...I}),[I]),_=g.getTotalSize(),me=t.useMemo(()=>({height:`${_}px`,width:"100%",position:"relative"}),[_]);return t.createElement("div",{...S,ref:ee,role:m?"group":"menu","aria-activedescendant":b>=0?G(b):void 0,tabIndex:0,onKeyDown:ce,onFocus:le,className:(0,P.default)("kui-VirtualMenuRoot",!m&&`kui-r-size-${u??"2"}`,f),style:de},t.createElement("div",{className:"kui-VirtualMenuViewport",style:me},ie.map(e=>{let i=n[e.index],a=e.index,l=b===a,fe={height:e.size,transform:`translateY(${e.start}px)`},$={id:G(a),isHighlighted:l,style:fe,tabIndex:-1,"data-highlighted":l?!0:void 0,"data-index":a,"aria-setsize":n.length,"aria-posinset":a+1,onMouseEnter:oe,onMouseLeave:ae,onClick:ue,onKeyDown:se};return o?t.createElement(o,{key:e.key,item:i,index:a,...$}):t.createElement(Te,{key:e.key,label:ne(i),...$})})))}var Q=t.forwardRef(Ce);Q.displayName="VirtualMenu";var X=t.forwardRef(({className:n,children:r,...o},u)=>{let{isHighlighted:s,index:p,item:c,...f}=o;return t.createElement("div",{ref:u,role:"menuitem",className:(0,P.default)("kui-reset","kui-BaseMenuItem","kui-VirtualMenuItem",n),...f},r)});X.displayName="VirtualMenu.Item";var He=t.memo(X,J),Pe=Object.assign(Q,{Item:He});
3
3
  //# sourceMappingURL=virtual-menu.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/virtual-menu.tsx", "../../../src/components/_internal/menu-context.tsx"],
4
- "sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { useVirtualizer } from '@tanstack/react-virtual';\nimport { useLayoutEffect } from 'radix-ui/internal';\nimport { useMenuContext, useMenuClose, getMenuItemHeight } from './_internal/menu-context.js';\n\nimport type { MenuSize } from './_internal/menu-context.js';\n\n/**\n * VirtualMenu - A virtualized menu component for rendering large lists efficiently.\n *\n * Uses TanStack Virtual to render only visible items.\n * Works inside any container (DropdownMenu.Content, Popover.Content, etc.)\n *\n * @example\n * // Simple usage with itemLabel\n * <VirtualMenu\n * items={items}\n * itemLabel={(item) => item.name}\n * onSelect={handleSelect}\n * />\n *\n * @example\n * // Custom rendering with renderItem\n * const UserItem = React.memo(({ item, ...props }) => (\n * <VirtualMenu.Item {...props}>\n * <Avatar src={item.avatar} />\n * {item.name}\n * </VirtualMenu.Item>\n * ));\n *\n * <VirtualMenu items={users} renderItem={UserItem} onSelect={handleSelect} />\n */\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/** Props passed to custom renderItem components */\ninterface VirtualMenuRenderItemProps<T> {\n /** The item data */\n item: T;\n /** Index in the items array */\n index: number;\n /** Whether this item is currently highlighted */\n isHighlighted: boolean;\n /** Unique ID for accessibility */\n id: string;\n /** Positioning styles - must be applied */\n style: React.CSSProperties;\n /** Tab index for focus management */\n tabIndex: number;\n /** Data attribute for CSS styling */\n 'data-highlighted': true | undefined;\n /** Data attribute for event delegation */\n 'data-index': number;\n /** Number of items in the whole list, since only some rows are mounted */\n 'aria-setsize': number;\n /** Position of this row in the whole list, from 1 */\n 'aria-posinset': number;\n /** Mouse enter handler */\n onMouseEnter: (e: React.MouseEvent<HTMLElement>) => void;\n /** Mouse leave handler */\n onMouseLeave: (e: React.MouseEvent<HTMLElement>) => void;\n /** Click handler */\n onClick: (e: React.MouseEvent<HTMLElement>) => void;\n /** Keyboard handler for Enter/Space activation */\n onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;\n}\n\n/** How rows are drawn: one of `itemLabel` or `renderItem` is required. */\ntype VirtualMenuRowProps<T> =\n | {\n /**\n * Simple label accessor for basic text items.\n * Can be a property key or a function.\n * @example\n * itemLabel=\"name\"\n * itemLabel={(item) => item.name}\n */\n itemLabel: keyof T | ((item: T) => React.ReactNode);\n renderItem?: undefined;\n }\n | {\n itemLabel?: undefined;\n /**\n * Custom component for rendering items.\n * Must be memoized (React.memo) for optimal performance.\n * @example\n * const MyItem = React.memo(({ item, ...props }) => (\n * <VirtualMenu.Item {...props}>{item.name}</VirtualMenu.Item>\n * ));\n * <VirtualMenu items={items} renderItem={MyItem} />\n */\n renderItem: React.ComponentType<VirtualMenuRenderItemProps<T>>;\n };\n\n/** Attributes of the list element that pass through, such as `id`, `aria-labelledby` or `data-*`. */\ntype VirtualMenuDivProps = Omit<\n React.ComponentPropsWithoutRef<'div'>,\n 'children' | 'onSelect' | 'role' | 'tabIndex' | 'aria-activedescendant'\n>;\n\ntype VirtualMenuProps<T> = VirtualMenuDivProps & VirtualMenuRowProps<T> & VirtualMenuOwnProps<T>;\n\ninterface VirtualMenuOwnProps<T> {\n /** Array of items to render */\n items: T[];\n /**\n * Menu size - controls item height.\n * Automatically inherited from parent DropdownMenu.Content/ContextMenu.Content.\n * Only set manually when using VirtualMenu outside of a menu context.\n * @default '2' (or inherited from context)\n */\n size?: MenuSize;\n /**\n * Estimated height of each item in pixels.\n * Can be a number (same for all) or a function (per-item).\n * Usually not needed - height is automatically derived from size prop/context.\n * Use this only for custom item heights (e.g., variable height items).\n */\n estimatedItemSize?: number | ((index: number) => number);\n /** Number of items to render outside visible area */\n overscan?: number;\n /** Callback when an item is selected */\n onSelect?: (item: T, index: number) => void;\n}\n\n// ============================================================================\n// Internal Memoized Item Component\n// ============================================================================\n\n/**\n * Rows get a new style object every render, so style is compared by the two values the\n * list sets. Every other prop is compared shallowly, so aria-*, data-* and handlers update.\n */\nfunction areRowPropsEqual<P extends { style?: React.CSSProperties }>(prev: P, next: P) {\n if (prev.style?.height !== next.style?.height) return false;\n if (prev.style?.transform !== next.style?.transform) return false;\n const prevKeys = Object.keys(prev) as (keyof P)[];\n if (prevKeys.length !== Object.keys(next).length) return false;\n return prevKeys.every((key) => key === 'style' || Object.is(prev[key], next[key]));\n}\n\ninterface SimpleItemProps {\n label: React.ReactNode;\n isHighlighted: boolean;\n id: string;\n style: React.CSSProperties;\n tabIndex: number;\n 'data-highlighted': true | undefined;\n 'data-index': number;\n 'aria-setsize': number;\n 'aria-posinset': number;\n onMouseEnter: (e: React.MouseEvent<HTMLElement>) => void;\n onMouseLeave: (e: React.MouseEvent<HTMLElement>) => void;\n onClick: (e: React.MouseEvent<HTMLElement>) => void;\n onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;\n}\n\nconst SimpleItem = React.memo(\n function SimpleItem({\n label,\n isHighlighted: _isHighlighted,\n id,\n style,\n tabIndex,\n 'data-highlighted': dataHighlighted,\n 'data-index': dataIndex,\n 'aria-setsize': setSize,\n 'aria-posinset': posInSet,\n onMouseEnter,\n onMouseLeave,\n onClick,\n onKeyDown,\n }: SimpleItemProps) {\n return (\n <div\n id={id}\n role=\"menuitem\"\n className={classNames('kui-reset', 'kui-BaseMenuItem', 'kui-VirtualMenuItem')}\n style={style}\n tabIndex={tabIndex}\n data-highlighted={dataHighlighted}\n data-index={dataIndex}\n aria-setsize={setSize}\n aria-posinset={posInSet}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onClick={onClick}\n onKeyDown={onKeyDown}\n >\n {label}\n </div>\n );\n },\n areRowPropsEqual,\n);\n\n// ============================================================================\n// VirtualMenu Component\n// ============================================================================\n\n/**\n * Measures the row height the menu's CSS draws (--base-menu-item-height), so rows follow\n * the theme scale instead of the fixed 100% table. Returns undefined until measured.\n */\nfunction useMeasuredRowHeight(\n rootRef: React.RefObject<HTMLDivElement | null>,\n enabled: boolean,\n size: MenuSize | undefined,\n) {\n const [height, setHeight] = React.useState<number | undefined>(undefined);\n useLayoutEffect(() => {\n const root = rootRef.current;\n if (!enabled || !root) return;\n const probe = document.createElement('div');\n probe.className = 'kui-reset kui-BaseMenuItem kui-VirtualMenuItem';\n probe.setAttribute('aria-hidden', 'true');\n probe.style.visibility = 'hidden';\n probe.textContent = '\\u00a0';\n root.appendChild(probe);\n const measured = probe.getBoundingClientRect().height;\n probe.remove();\n setHeight(measured > 0 ? measured : undefined);\n }, [rootRef, enabled, size]);\n return enabled ? height : undefined;\n}\n\nfunction VirtualMenuRootInner<T>(\n {\n items,\n itemLabel,\n renderItem: RenderItem,\n size: sizeProp,\n estimatedItemSize: estimatedItemSizeProp,\n overscan = 5,\n onSelect,\n className,\n style,\n onKeyDown,\n onFocus,\n ...rootProps\n }: VirtualMenuProps<T>,\n forwardedRef: React.ForwardedRef<HTMLDivElement>,\n) {\n const menuId = React.useId();\n const parentRef = React.useRef<HTMLDivElement>(null);\n const [highlightedIndex, setHighlightedIndex] = React.useState<number>(-1);\n const { isInsideMenu, size: contextSize, itemHeight: contextItemHeight } = useMenuContext();\n const closeMenu = useMenuClose();\n\n const setRootRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n parentRef.current = node;\n if (typeof forwardedRef === 'function') forwardedRef(node);\n else if (forwardedRef) forwardedRef.current = node;\n },\n [forwardedRef],\n );\n\n // Inside a menu, the CSS row height is measured so it tracks the theme scale.\n const measuredItemHeight = useMeasuredRowHeight(\n parentRef,\n isInsideMenu && sizeProp == null && estimatedItemSizeProp == null,\n contextSize,\n );\n\n // Resolve item height: explicit prop > own size > measured CSS row > parent menu > default size '2'.\n const estimatedItemSize =\n estimatedItemSizeProp ??\n (sizeProp\n ? getMenuItemHeight(sizeProp)\n : (measuredItemHeight ?? contextItemHeight ?? getMenuItemHeight(contextSize ?? '2')));\n\n // Validate props\n if (!itemLabel && !RenderItem) {\n throw new Error('VirtualMenu requires either itemLabel or renderItem prop');\n }\n\n // Normalize itemLabel to a function\n const getLabel = React.useMemo(() => {\n if (!itemLabel) return null;\n if (typeof itemLabel === 'function') return itemLabel;\n return (item: T) => item[itemLabel] as React.ReactNode;\n }, [itemLabel]);\n\n // Derive safe highlighted index\n const safeHighlightedIndex = React.useMemo(() => {\n if (items.length === 0) return -1;\n if (highlightedIndex < 0) return -1;\n return Math.min(highlightedIndex, items.length - 1);\n }, [highlightedIndex, items.length]);\n\n // Normalize estimatedItemSize to a function\n const getItemSize = React.useMemo(\n () =>\n typeof estimatedItemSize === 'function'\n ? estimatedItemSize\n : () => estimatedItemSize,\n [estimatedItemSize],\n );\n\n const virtualizer = useVirtualizer({\n count: items.length,\n getScrollElement: () => parentRef.current,\n estimateSize: getItemSize,\n overscan,\n });\n\n const virtualItems = virtualizer.getVirtualItems();\n\n // Re-measure cached rows when the resolved row height changes.\n useLayoutEffect(() => {\n virtualizer.measure();\n }, [virtualizer, estimatedItemSize]);\n\n // Inside a menu, the menu focuses its own content on open (and a submenu on keyboard\n // open). Hand that focus to the list so arrow keys reach the rows.\n React.useEffect(() => {\n const root = parentRef.current;\n if (!isInsideMenu || !root) return;\n const content = root.closest<HTMLElement>('[data-radix-menu-content]');\n if (!content) return;\n const handleFocusIn = (event: FocusEvent) => {\n if (event.target === content) root.focus({ preventScroll: true });\n };\n content.addEventListener('focusin', handleFocusIn);\n if (document.activeElement === content) root.focus({ preventScroll: true });\n return () => content.removeEventListener('focusin', handleFocusIn);\n }, [isInsideMenu]);\n\n // Refs for stable handler references\n const onKeyDownRef = React.useRef(onKeyDown);\n const onFocusRef = React.useRef(onFocus);\n onKeyDownRef.current = onKeyDown;\n onFocusRef.current = onFocus;\n const itemsRef = React.useRef(items);\n const onSelectRef = React.useRef(onSelect);\n const closeMenuRef = React.useRef(closeMenu);\n itemsRef.current = items;\n onSelectRef.current = onSelect;\n closeMenuRef.current = closeMenu;\n\n // Choosing a row calls onSelect, then closes the parent menu like a menu item does.\n const selectIndex = React.useCallback((idx: number) => {\n const currentItems = itemsRef.current;\n if (idx < 0 || idx >= currentItems.length) return;\n onSelectRef.current?.(currentItems[idx], idx);\n closeMenuRef.current?.();\n }, []);\n\n const scrollToIndexRef = React.useRef(virtualizer.scrollToIndex);\n scrollToIndexRef.current = virtualizer.scrollToIndex;\n\n const highlightedIndexRef = React.useRef(safeHighlightedIndex);\n highlightedIndexRef.current = safeHighlightedIndex;\n\n // Stable event handlers\n const handleItemMouseEnter = React.useCallback((e: React.MouseEvent<HTMLElement>) => {\n const index = e.currentTarget.dataset.index;\n if (index != null) {\n setHighlightedIndex(Number(index));\n }\n }, []);\n\n const handleItemClick = React.useCallback((e: React.MouseEvent<HTMLElement>) => {\n const index = e.currentTarget.dataset.index;\n if (index != null) selectIndex(Number(index));\n }, [selectIndex]);\n\n // Leaving a row clears its highlight, as a Radix item does on pointer leave.\n const handleItemMouseLeave = React.useCallback((e: React.MouseEvent<HTMLElement>) => {\n const index = Number(e.currentTarget.dataset.index);\n setHighlightedIndex((current) => (current === index ? -1 : current));\n }, []);\n\n // Item-level keyboard handler for Enter/Space activation (satisfies a11y lint rule)\n const handleItemKeyDown = React.useCallback((e: React.KeyboardEvent<HTMLElement>) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n e.stopPropagation();\n const index = e.currentTarget.dataset.index;\n if (index != null) selectIndex(Number(index));\n }\n }, [selectIndex]);\n\n // Keyboard navigation\n const handleKeyDown = React.useCallback((e: React.KeyboardEvent<HTMLDivElement>) => {\n onKeyDownRef.current?.(e);\n if (e.defaultPrevented) return;\n const currentItems = itemsRef.current;\n const currentHighlightedIndex = highlightedIndexRef.current;\n\n switch (e.key) {\n case 'ArrowDown': {\n e.preventDefault();\n const nextIndex =\n currentHighlightedIndex < currentItems.length - 1 ? currentHighlightedIndex + 1 : 0;\n setHighlightedIndex(nextIndex);\n scrollToIndexRef.current(nextIndex, { align: 'auto' });\n break;\n }\n case 'ArrowUp': {\n e.preventDefault();\n const prevIndex =\n currentHighlightedIndex > 0 ? currentHighlightedIndex - 1 : currentItems.length - 1;\n setHighlightedIndex(prevIndex);\n scrollToIndexRef.current(prevIndex, { align: 'auto' });\n break;\n }\n case 'Home': {\n e.preventDefault();\n setHighlightedIndex(0);\n scrollToIndexRef.current(0, { align: 'start' });\n break;\n }\n case 'End': {\n e.preventDefault();\n const lastIndex = currentItems.length - 1;\n setHighlightedIndex(lastIndex);\n scrollToIndexRef.current(lastIndex, { align: 'end' });\n break;\n }\n case 'Enter':\n case ' ': {\n e.preventDefault();\n selectIndex(currentHighlightedIndex);\n break;\n }\n case 'Tab': {\n // Inside a menu, Tab does not leave it. On its own, the list is one tab stop.\n if (isInsideMenu) e.preventDefault();\n break;\n }\n case 'Escape': {\n // Inside a menu, the menu handles Escape and returns focus to its trigger.\n if (!isInsideMenu) e.currentTarget.blur();\n break;\n }\n default: {\n // The parent menu's typeahead would move focus off the list onto one of its items.\n if (isInsideMenu && e.key.length === 1 && !e.ctrlKey && !e.altKey && !e.metaKey) {\n e.stopPropagation();\n }\n }\n }\n }, [selectIndex, isInsideMenu]);\n\n // Keyboard focus on the list highlights the first row when none is highlighted.\n const handleFocus = React.useCallback((e: React.FocusEvent<HTMLDivElement>) => {\n onFocusRef.current?.(e);\n if (e.target !== e.currentTarget) return;\n if (highlightedIndexRef.current < 0 && itemsRef.current.length > 0) setHighlightedIndex(0);\n }, []);\n\n // Item ID generator\n const getItemId = React.useCallback(\n (index: number) => `${menuId}-item-${index}`,\n [menuId],\n );\n\n // Memoize styles\n const rootStyle = React.useMemo(\n () => ({\n overflow: 'auto' as const,\n position: 'relative' as const,\n ...style,\n }),\n [style],\n );\n\n const totalSize = virtualizer.getTotalSize();\n const viewportStyle = React.useMemo(\n () => ({\n height: `${totalSize}px`,\n width: '100%' as const,\n position: 'relative' as const,\n }),\n [totalSize],\n );\n\n return (\n <div\n {...rootProps}\n ref={setRootRef}\n role={isInsideMenu ? 'group' : 'menu'}\n aria-activedescendant={safeHighlightedIndex >= 0 ? getItemId(safeHighlightedIndex) : undefined}\n tabIndex={0}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n className={classNames(\n 'kui-VirtualMenuRoot',\n // On its own, the list draws menu rows at its own size (virtual-menu.css).\n !isInsideMenu && `kui-r-size-${sizeProp ?? '2'}`,\n className,\n )}\n style={rootStyle}\n >\n <div className=\"kui-VirtualMenuViewport\" style={viewportStyle}>\n {virtualItems.map((virtualRow) => {\n const item = items[virtualRow.index];\n const index = virtualRow.index;\n const isHighlighted = safeHighlightedIndex === index;\n\n const itemStyle: React.CSSProperties = {\n height: virtualRow.size,\n transform: `translateY(${virtualRow.start}px)`,\n };\n\n const commonProps = {\n id: getItemId(index),\n isHighlighted,\n style: itemStyle,\n // The list holds focus and points aria-activedescendant at the row, so it is the only tab stop.\n tabIndex: -1,\n 'data-highlighted': isHighlighted ? true as const : undefined,\n 'data-index': index,\n 'aria-setsize': items.length,\n 'aria-posinset': index + 1,\n onMouseEnter: handleItemMouseEnter,\n onMouseLeave: handleItemMouseLeave,\n onClick: handleItemClick,\n onKeyDown: handleItemKeyDown,\n };\n\n // Use renderItem if provided, otherwise use SimpleItem with itemLabel\n if (RenderItem) {\n return (\n <RenderItem\n key={virtualRow.key}\n item={item}\n index={index}\n {...commonProps}\n />\n );\n }\n\n return (\n <SimpleItem\n key={virtualRow.key}\n label={getLabel!(item)}\n {...commonProps}\n />\n );\n })}\n </div>\n </div>\n );\n}\n\nconst VirtualMenuRoot = React.forwardRef(VirtualMenuRootInner) as (<T>(\n props: VirtualMenuProps<T> & React.RefAttributes<HTMLDivElement>,\n) => React.ReactElement) & { displayName?: string };\nVirtualMenuRoot.displayName = 'VirtualMenu';\n\n// ============================================================================\n// VirtualMenu.Item Component (for custom renderItem usage)\n// ============================================================================\n\ninterface VirtualMenuItemProps extends React.ComponentPropsWithoutRef<'div'> {\n children: React.ReactNode;\n /** Data attribute for highlight styling */\n 'data-highlighted'?: true | undefined;\n /** Data attribute for event delegation */\n 'data-index'?: number;\n}\n\nconst VirtualMenuItemInner = React.forwardRef<HTMLDivElement, VirtualMenuItemProps>(\n ({ className, children, ...props }, forwardedRef) => {\n return (\n <div\n ref={forwardedRef}\n role=\"menuitem\"\n className={classNames('kui-reset', 'kui-BaseMenuItem', 'kui-VirtualMenuItem', className)}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nVirtualMenuItemInner.displayName = 'VirtualMenu.Item';\n\n// Style is compared by height and transform; every other prop shallowly.\nconst VirtualMenuItem = React.memo(VirtualMenuItemInner, areRowPropsEqual);\n\n// ============================================================================\n// Exports\n// ============================================================================\n\nconst VirtualMenu = Object.assign(VirtualMenuRoot, {\n Item: VirtualMenuItem,\n});\n\nexport { VirtualMenu };\nexport type { VirtualMenuProps, VirtualMenuItemProps, VirtualMenuRenderItemProps };\n", "'use client';\n\nimport * as React from 'react';\nimport { useLayoutEffect } from 'radix-ui/internal';\n\nimport { useResolvedResponsiveValue } from './base-menu.utils.js';\n\nimport type { Responsive } from '../../props/prop-def.js';\n\n/**\n * Context to detect if a component is rendered inside a menu (DropdownMenu, ContextMenu, etc.)\n * Used by VirtualMenu to adjust its behavior:\n * - Skip role=\"menu\" when inside a parent menu (parent owns the role)\n * - Delegate certain keyboard handling to parent\n * - Use the correct item height based on menu size\n */\n\nexport type MenuSize = '1' | '2' | '3' | '4';\n\ninterface MenuContextValue {\n /** Whether we're inside a menu that owns the menu role */\n isInsideMenu: boolean;\n /** Menu size for the current breakpoint */\n size?: MenuSize;\n /** Item height in px for the current size and theme scaling */\n itemHeight?: number;\n}\n\nconst MenuContext = React.createContext<MenuContextValue>({ isInsideMenu: false });\n\n/** The register function of the menu Group a Label sits in (see useMenuGroupLabelId). */\nconst MenuGroupLabelContext = React.createContext<((id: string | null) => void) | null>(null);\n\ninterface MenuProviderProps {\n children: React.ReactNode;\n /** Menu size passed from parent (DropdownMenu.Content, ContextMenu.Content, etc.) */\n size?: Responsive<MenuSize>;\n}\n\n/**\n * Menu row height in pixels per size: the line height plus --row-inset-N above and below\n * (base-menu.css), never under the 24px target floor.\n */\nexport const menuSizeToItemHeight: Record<MenuSize, number> = {\n '1': 24,\n '2': 30,\n '3': 34,\n '4': 38,\n};\n\nexport function getMenuItemHeight(size: MenuSize): number {\n return menuSizeToItemHeight[size];\n}\n\nexport function MenuProvider({ children, size }: MenuProviderProps) {\n const resolvedSize = useResolvedResponsiveValue<MenuSize | undefined>(size, undefined);\n const itemHeight = resolvedSize ? getMenuItemHeight(resolvedSize) : undefined;\n const value = React.useMemo(\n () => ({ isInsideMenu: true, size: resolvedSize, itemHeight }),\n [resolvedSize, itemHeight],\n );\n // A submenu is its own surface, so its labels never name a group of the parent menu.\n return (\n <MenuContext.Provider value={value}>\n <MenuGroupLabelContext.Provider value={null}>{children}</MenuGroupLabelContext.Provider>\n </MenuContext.Provider>\n );\n}\n\nexport function useMenuContext() {\n return React.useContext(MenuContext);\n}\n\n/**\n * Closes the whole menu from inside it. DropdownMenu.Root and ContextMenu.Root provide it,\n * so a VirtualMenu row can close the menu on select the way a menu item does.\n */\nconst MenuCloseContext = React.createContext<(() => void) | undefined>(undefined);\nexport const MenuCloseProvider = MenuCloseContext.Provider;\n\nexport function useMenuClose() {\n return React.useContext(MenuCloseContext);\n}\n\n/**\n * Names a menu group by its label, the way v2's MenuGroup does. A Group holds the id of\n * the Label inside it and points aria-labelledby at it, so a screen reader announces the\n * section name when focus enters the group.\n */\nexport const MenuGroupLabelProvider = MenuGroupLabelContext.Provider;\n\n/** For a Group: the id its aria-labelledby points to, and the setter a nested Label calls. */\nexport function useMenuGroupLabelledBy(ariaLabelledBy: string | undefined) {\n const [labelId, setLabelId] = React.useState<string | null>(null);\n return [ariaLabelledBy ?? labelId ?? undefined, setLabelId] as const;\n}\n\n/** For a Label: its id, registered with the Group it sits in while the label is rendered. */\nexport function useMenuGroupLabelId(idProp: string | undefined, rendered = true) {\n const register = React.useContext(MenuGroupLabelContext);\n const generatedId = React.useId();\n const id = idProp ?? generatedId;\n useLayoutEffect(() => {\n if (!register || !rendered) return;\n register(id);\n return () => register(null);\n }, [register, id, rendered]);\n return register ? id : idProp;\n}\n"],
5
- "mappings": ";mlBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,iBAAAE,KAAA,eAAAC,GAAAH,IAEA,IAAAI,EAAuB,oBACvBC,EAAuB,yBACvBC,EAA+B,mCAC/BC,EAAgC,6BCHhC,IAAAC,EAAuB,oBACv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C,EAA6B,aACjC,CAAC,CAAE,UAAA3D,EAAW,SAAA4D,EAAU,GAAGC,CAAM,EAAG1D,IAEhC,gBAAC,OACC,IAAKA,EACL,KAAK,WACL,aAAW,EAAArB,SAAW,YAAa,mBAAoB,sBAAuBkB,CAAS,EACtF,GAAG6D,GAEHD,CACH,CAGN,EAEAD,EAAqB,YAAc,mBAGnC,IAAMG,GAAwB,OAAKH,EAAsBhG,CAAgB,EAMnEoG,GAAc,OAAO,OAAOL,EAAiB,CACjD,KAAMI,EACR,CAAC",
6
- "names": ["virtual_menu_exports", "__export", "VirtualMenu", "__toCommonJS", "React", "import_classnames", "import_react_virtual", "import_internal", "React", "import_internal", "MenuContext", "MenuGroupLabelContext", "menuSizeToItemHeight", "getMenuItemHeight", "size", "useMenuContext", "MenuContext", "MenuCloseContext", "MenuCloseProvider", "useMenuClose", "MenuGroupLabelProvider", "MenuGroupLabelContext", "areRowPropsEqual", "prev", "next", "prevKeys", "key", "SimpleItem", "label", "_isHighlighted", "id", "style", "tabIndex", "dataHighlighted", "dataIndex", "setSize", "posInSet", "onMouseEnter", "onMouseLeave", "onClick", "onKeyDown", "classNames", "useMeasuredRowHeight", "rootRef", "enabled", "size", "height", "setHeight", "root", "probe", "measured", "VirtualMenuRootInner", "items", "itemLabel", "RenderItem", "sizeProp", "estimatedItemSizeProp", "overscan", "onSelect", "className", "onFocus", "rootProps", "forwardedRef", "menuId", "parentRef", "highlightedIndex", "setHighlightedIndex", "isInsideMenu", "contextSize", "contextItemHeight", "useMenuContext", "closeMenu", "useMenuClose", "setRootRef", "node", "measuredItemHeight", "estimatedItemSize", "getMenuItemHeight", "getLabel", "item", "safeHighlightedIndex", "getItemSize", "virtualizer", "virtualItems", "content", "handleFocusIn", "event", "onKeyDownRef", "onFocusRef", "itemsRef", "onSelectRef", "closeMenuRef", "selectIndex", "idx", "currentItems", "scrollToIndexRef", "highlightedIndexRef", "handleItemMouseEnter", "index", "handleItemClick", "handleItemMouseLeave", "current", "handleItemKeyDown", "handleKeyDown", "currentHighlightedIndex", "nextIndex", "prevIndex", "lastIndex", "handleFocus", "getItemId", "rootStyle", "totalSize", "viewportStyle", "virtualRow", "isHighlighted", "itemStyle", "commonProps", "VirtualMenuRoot", "VirtualMenuItemInner", "children", "props", "VirtualMenuItem", "VirtualMenu"]
4
+ "sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { useVirtualizer } from '@tanstack/react-virtual';\nimport { useLayoutEffect } from 'radix-ui/internal';\nimport { useMenuContext, useMenuClose, getMenuItemHeight } from './_internal/menu-context.js';\n\nimport type { MenuSize } from './_internal/menu-context.js';\n\n/**\n * VirtualMenu - A virtualized menu component for rendering large lists efficiently.\n *\n * Uses TanStack Virtual to render only visible items.\n * Works inside any container (DropdownMenu.Content, Popover.Content, etc.)\n *\n * @example\n * // Simple usage with itemLabel\n * <VirtualMenu\n * items={items}\n * itemLabel={(item) => item.name}\n * onSelect={handleSelect}\n * />\n *\n * @example\n * // Custom rendering with renderItem\n * const UserItem = React.memo(({ item, ...props }) => (\n * <VirtualMenu.Item {...props}>\n * <Avatar src={item.avatar} />\n * {item.name}\n * </VirtualMenu.Item>\n * ));\n *\n * <VirtualMenu items={users} renderItem={UserItem} onSelect={handleSelect} />\n */\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/** Props passed to custom renderItem components */\ninterface VirtualMenuRenderItemProps<T> {\n /** The item data */\n item: T;\n /** Index in the items array */\n index: number;\n /** Whether this item is currently highlighted */\n isHighlighted: boolean;\n /** Unique ID for accessibility */\n id: string;\n /** Positioning styles - must be applied */\n style: React.CSSProperties;\n /** Tab index for focus management */\n tabIndex: number;\n /** Data attribute for CSS styling */\n 'data-highlighted': true | undefined;\n /** Data attribute for event delegation */\n 'data-index': number;\n /** Number of items in the whole list, since only some rows are mounted */\n 'aria-setsize': number;\n /** Position of this row in the whole list, from 1 */\n 'aria-posinset': number;\n /** Mouse enter handler */\n onMouseEnter: (e: React.MouseEvent<HTMLElement>) => void;\n /** Mouse leave handler */\n onMouseLeave: (e: React.MouseEvent<HTMLElement>) => void;\n /** Click handler */\n onClick: (e: React.MouseEvent<HTMLElement>) => void;\n /** Keyboard handler for Enter/Space activation */\n onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;\n}\n\n/** How rows are drawn: one of `itemLabel` or `renderItem` is required. */\ntype VirtualMenuRowProps<T> =\n | {\n /**\n * Simple label accessor for basic text items.\n * Can be a property key or a function.\n * @example\n * itemLabel=\"name\"\n * itemLabel={(item) => item.name}\n */\n itemLabel: keyof T | ((item: T) => React.ReactNode);\n renderItem?: undefined;\n }\n | {\n itemLabel?: undefined;\n /**\n * Custom component for rendering items.\n * Must be memoized (React.memo) for optimal performance.\n * @example\n * const MyItem = React.memo(({ item, ...props }) => (\n * <VirtualMenu.Item {...props}>{item.name}</VirtualMenu.Item>\n * ));\n * <VirtualMenu items={items} renderItem={MyItem} />\n */\n renderItem: React.ComponentType<VirtualMenuRenderItemProps<T>>;\n };\n\n/** Attributes of the list element that pass through, such as `id`, `aria-labelledby` or `data-*`. */\ntype VirtualMenuDivProps = Omit<\n React.ComponentPropsWithoutRef<'div'>,\n 'children' | 'onSelect' | 'role' | 'tabIndex' | 'aria-activedescendant'\n>;\n\ntype VirtualMenuProps<T> = VirtualMenuDivProps & VirtualMenuRowProps<T> & VirtualMenuOwnProps<T>;\n\ninterface VirtualMenuOwnProps<T> {\n /** Array of items to render */\n items: T[];\n /**\n * Menu size - controls item height.\n * Automatically inherited from parent DropdownMenu.Content/ContextMenu.Content.\n * Only set manually when using VirtualMenu outside of a menu context.\n * @default '2' (or inherited from context)\n */\n size?: MenuSize;\n /**\n * Estimated height of each item in pixels.\n * Can be a number (same for all) or a function (per-item).\n * Usually not needed - height is automatically derived from size prop/context.\n * Use this only for custom item heights (e.g., variable height items).\n */\n estimatedItemSize?: number | ((index: number) => number);\n /** Number of items to render outside visible area */\n overscan?: number;\n /** Callback when an item is selected */\n onSelect?: (item: T, index: number) => void;\n}\n\n// ============================================================================\n// Internal Memoized Item Component\n// ============================================================================\n\n/**\n * Rows get a new style object every render, so style is compared by the two values the\n * list sets. Every other prop is compared shallowly, so aria-*, data-* and handlers update.\n */\nfunction areRowPropsEqual<P extends { style?: React.CSSProperties }>(prev: P, next: P) {\n if (prev.style?.height !== next.style?.height) return false;\n if (prev.style?.transform !== next.style?.transform) return false;\n const prevKeys = Object.keys(prev) as (keyof P)[];\n if (prevKeys.length !== Object.keys(next).length) return false;\n return prevKeys.every((key) => key === 'style' || Object.is(prev[key], next[key]));\n}\n\ninterface SimpleItemProps {\n label: React.ReactNode;\n isHighlighted: boolean;\n id: string;\n style: React.CSSProperties;\n tabIndex: number;\n 'data-highlighted': true | undefined;\n 'data-index': number;\n 'aria-setsize': number;\n 'aria-posinset': number;\n onMouseEnter: (e: React.MouseEvent<HTMLElement>) => void;\n onMouseLeave: (e: React.MouseEvent<HTMLElement>) => void;\n onClick: (e: React.MouseEvent<HTMLElement>) => void;\n onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;\n}\n\nconst SimpleItem = React.memo(\n function SimpleItem({\n label,\n isHighlighted: _isHighlighted,\n id,\n style,\n tabIndex,\n 'data-highlighted': dataHighlighted,\n 'data-index': dataIndex,\n 'aria-setsize': setSize,\n 'aria-posinset': posInSet,\n onMouseEnter,\n onMouseLeave,\n onClick,\n onKeyDown,\n }: SimpleItemProps) {\n return (\n <div\n id={id}\n role=\"menuitem\"\n className={classNames('kui-reset', 'kui-BaseMenuItem', 'kui-VirtualMenuItem')}\n style={style}\n tabIndex={tabIndex}\n data-highlighted={dataHighlighted}\n data-index={dataIndex}\n aria-setsize={setSize}\n aria-posinset={posInSet}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onClick={onClick}\n onKeyDown={onKeyDown}\n >\n {label}\n </div>\n );\n },\n areRowPropsEqual,\n);\n\n// ============================================================================\n// VirtualMenu Component\n// ============================================================================\n\n/**\n * Measures the row height the menu's CSS draws (--base-menu-item-height), so rows follow\n * the theme scale instead of the fixed 100% table. Returns undefined until measured.\n */\nfunction useMeasuredRowHeight(\n rootRef: React.RefObject<HTMLDivElement | null>,\n enabled: boolean,\n size: MenuSize | undefined,\n) {\n const [height, setHeight] = React.useState<number | undefined>(undefined);\n useLayoutEffect(() => {\n const root = rootRef.current;\n if (!enabled || !root) return;\n const probe = document.createElement('div');\n probe.className = 'kui-reset kui-BaseMenuItem kui-VirtualMenuItem';\n probe.setAttribute('aria-hidden', 'true');\n probe.style.visibility = 'hidden';\n probe.textContent = '\\u00a0';\n root.appendChild(probe);\n const measured = probe.getBoundingClientRect().height;\n probe.remove();\n setHeight(measured > 0 ? measured : undefined);\n }, [rootRef, enabled, size]);\n return enabled ? height : undefined;\n}\n\nfunction VirtualMenuRootInner<T>(\n {\n items,\n itemLabel,\n renderItem: RenderItem,\n size: sizeProp,\n estimatedItemSize: estimatedItemSizeProp,\n overscan = 5,\n onSelect,\n className,\n style,\n onKeyDown,\n onFocus,\n ...rootProps\n }: VirtualMenuProps<T>,\n forwardedRef: React.ForwardedRef<HTMLDivElement>,\n) {\n const menuId = React.useId();\n const parentRef = React.useRef<HTMLDivElement>(null);\n const [highlightedIndex, setHighlightedIndex] = React.useState<number>(-1);\n const { isInsideMenu, size: contextSize, itemHeight: contextItemHeight } = useMenuContext();\n const closeMenu = useMenuClose();\n\n const setRootRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n parentRef.current = node;\n if (typeof forwardedRef === 'function') forwardedRef(node);\n else if (forwardedRef) forwardedRef.current = node;\n },\n [forwardedRef],\n );\n\n // Inside a menu, the CSS row height is measured so it tracks the theme scale.\n const measuredItemHeight = useMeasuredRowHeight(\n parentRef,\n isInsideMenu && sizeProp == null && estimatedItemSizeProp == null,\n contextSize,\n );\n\n // Resolve item height: explicit prop > own size > measured CSS row > parent menu > default size '2'.\n const estimatedItemSize =\n estimatedItemSizeProp ??\n (sizeProp\n ? getMenuItemHeight(sizeProp)\n : (measuredItemHeight ?? contextItemHeight ?? getMenuItemHeight(contextSize ?? '2')));\n\n // Validate props\n if (!itemLabel && !RenderItem) {\n throw new Error('VirtualMenu requires either itemLabel or renderItem prop');\n }\n\n // Normalize itemLabel to a function\n const getLabel = React.useMemo(() => {\n if (!itemLabel) return null;\n if (typeof itemLabel === 'function') return itemLabel;\n return (item: T) => item[itemLabel] as React.ReactNode;\n }, [itemLabel]);\n\n // Derive safe highlighted index\n const safeHighlightedIndex = React.useMemo(() => {\n if (items.length === 0) return -1;\n if (highlightedIndex < 0) return -1;\n return Math.min(highlightedIndex, items.length - 1);\n }, [highlightedIndex, items.length]);\n\n // Normalize estimatedItemSize to a function\n const getItemSize = React.useMemo(\n () =>\n typeof estimatedItemSize === 'function'\n ? estimatedItemSize\n : () => estimatedItemSize,\n [estimatedItemSize],\n );\n\n const virtualizer = useVirtualizer({\n count: items.length,\n getScrollElement: () => parentRef.current,\n estimateSize: getItemSize,\n overscan,\n });\n\n const virtualItems = virtualizer.getVirtualItems();\n\n // Re-measure cached rows when the resolved row height changes.\n useLayoutEffect(() => {\n virtualizer.measure();\n }, [virtualizer, estimatedItemSize]);\n\n // Inside a menu, the menu focuses its own content on open (and a submenu on keyboard\n // open). Hand that focus to the list so arrow keys reach the rows.\n React.useEffect(() => {\n const root = parentRef.current;\n if (!isInsideMenu || !root) return;\n const content = root.closest<HTMLElement>('[data-radix-menu-content]');\n if (!content) return;\n const handleFocusIn = (event: FocusEvent) => {\n if (event.target === content) root.focus({ preventScroll: true });\n };\n content.addEventListener('focusin', handleFocusIn);\n if (document.activeElement === content) root.focus({ preventScroll: true });\n return () => content.removeEventListener('focusin', handleFocusIn);\n }, [isInsideMenu]);\n\n // Refs for stable handler references\n const onKeyDownRef = React.useRef(onKeyDown);\n const onFocusRef = React.useRef(onFocus);\n onKeyDownRef.current = onKeyDown;\n onFocusRef.current = onFocus;\n const itemsRef = React.useRef(items);\n const onSelectRef = React.useRef(onSelect);\n const closeMenuRef = React.useRef(closeMenu);\n itemsRef.current = items;\n onSelectRef.current = onSelect;\n closeMenuRef.current = closeMenu;\n\n // Choosing a row calls onSelect, then closes the parent menu like a menu item does.\n const selectIndex = React.useCallback((idx: number) => {\n const currentItems = itemsRef.current;\n if (idx < 0 || idx >= currentItems.length) return;\n onSelectRef.current?.(currentItems[idx], idx);\n closeMenuRef.current?.();\n }, []);\n\n const scrollToIndexRef = React.useRef(virtualizer.scrollToIndex);\n scrollToIndexRef.current = virtualizer.scrollToIndex;\n\n const highlightedIndexRef = React.useRef(safeHighlightedIndex);\n highlightedIndexRef.current = safeHighlightedIndex;\n\n // Stable event handlers\n const handleItemMouseEnter = React.useCallback((e: React.MouseEvent<HTMLElement>) => {\n const index = e.currentTarget.dataset.index;\n if (index != null) {\n setHighlightedIndex(Number(index));\n }\n }, []);\n\n const handleItemClick = React.useCallback((e: React.MouseEvent<HTMLElement>) => {\n const index = e.currentTarget.dataset.index;\n if (index != null) selectIndex(Number(index));\n }, [selectIndex]);\n\n // Leaving a row clears its highlight, as a Radix item does on pointer leave.\n const handleItemMouseLeave = React.useCallback((e: React.MouseEvent<HTMLElement>) => {\n const index = Number(e.currentTarget.dataset.index);\n setHighlightedIndex((current) => (current === index ? -1 : current));\n }, []);\n\n // Item-level keyboard handler for Enter/Space activation (satisfies a11y lint rule)\n const handleItemKeyDown = React.useCallback((e: React.KeyboardEvent<HTMLElement>) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n e.stopPropagation();\n const index = e.currentTarget.dataset.index;\n if (index != null) selectIndex(Number(index));\n }\n }, [selectIndex]);\n\n // Keyboard navigation\n const handleKeyDown = React.useCallback((e: React.KeyboardEvent<HTMLDivElement>) => {\n onKeyDownRef.current?.(e);\n if (e.defaultPrevented) return;\n const currentItems = itemsRef.current;\n const currentHighlightedIndex = highlightedIndexRef.current;\n\n switch (e.key) {\n case 'ArrowDown': {\n e.preventDefault();\n const nextIndex =\n currentHighlightedIndex < currentItems.length - 1 ? currentHighlightedIndex + 1 : 0;\n setHighlightedIndex(nextIndex);\n scrollToIndexRef.current(nextIndex, { align: 'auto' });\n break;\n }\n case 'ArrowUp': {\n e.preventDefault();\n const prevIndex =\n currentHighlightedIndex > 0 ? currentHighlightedIndex - 1 : currentItems.length - 1;\n setHighlightedIndex(prevIndex);\n scrollToIndexRef.current(prevIndex, { align: 'auto' });\n break;\n }\n case 'Home': {\n e.preventDefault();\n setHighlightedIndex(0);\n scrollToIndexRef.current(0, { align: 'start' });\n break;\n }\n case 'End': {\n e.preventDefault();\n const lastIndex = currentItems.length - 1;\n setHighlightedIndex(lastIndex);\n scrollToIndexRef.current(lastIndex, { align: 'end' });\n break;\n }\n case 'Enter':\n case ' ': {\n e.preventDefault();\n selectIndex(currentHighlightedIndex);\n break;\n }\n case 'Tab': {\n // Inside a menu, Tab does not leave it. On its own, the list is one tab stop.\n if (isInsideMenu) e.preventDefault();\n break;\n }\n case 'Escape': {\n // Inside a menu, the menu handles Escape and returns focus to its trigger.\n if (!isInsideMenu) e.currentTarget.blur();\n break;\n }\n default: {\n // The parent menu's typeahead would move focus off the list onto one of its items.\n if (isInsideMenu && e.key.length === 1 && !e.ctrlKey && !e.altKey && !e.metaKey) {\n e.stopPropagation();\n }\n }\n }\n }, [selectIndex, isInsideMenu]);\n\n // Keyboard focus on the list highlights the first row when none is highlighted.\n const handleFocus = React.useCallback((e: React.FocusEvent<HTMLDivElement>) => {\n onFocusRef.current?.(e);\n if (e.target !== e.currentTarget) return;\n if (highlightedIndexRef.current < 0 && itemsRef.current.length > 0) setHighlightedIndex(0);\n }, []);\n\n // Item ID generator\n const getItemId = React.useCallback(\n (index: number) => `${menuId}-item-${index}`,\n [menuId],\n );\n\n // Memoize styles\n const rootStyle = React.useMemo(\n () => ({\n overflow: 'auto' as const,\n position: 'relative' as const,\n ...style,\n }),\n [style],\n );\n\n const totalSize = virtualizer.getTotalSize();\n const viewportStyle = React.useMemo(\n () => ({\n height: `${totalSize}px`,\n width: '100%' as const,\n position: 'relative' as const,\n }),\n [totalSize],\n );\n\n return (\n <div\n {...rootProps}\n ref={setRootRef}\n role={isInsideMenu ? 'group' : 'menu'}\n aria-activedescendant={safeHighlightedIndex >= 0 ? getItemId(safeHighlightedIndex) : undefined}\n tabIndex={0}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n className={classNames(\n 'kui-VirtualMenuRoot',\n // On its own, the list draws menu rows at its own size (virtual-menu.css).\n !isInsideMenu && `kui-r-size-${sizeProp ?? '2'}`,\n className,\n )}\n style={rootStyle}\n >\n <div className=\"kui-VirtualMenuViewport\" style={viewportStyle}>\n {virtualItems.map((virtualRow) => {\n const item = items[virtualRow.index];\n const index = virtualRow.index;\n const isHighlighted = safeHighlightedIndex === index;\n\n const itemStyle: React.CSSProperties = {\n height: virtualRow.size,\n transform: `translateY(${virtualRow.start}px)`,\n };\n\n const commonProps = {\n id: getItemId(index),\n isHighlighted,\n style: itemStyle,\n // The list holds focus and points aria-activedescendant at the row, so it is the only tab stop.\n tabIndex: -1,\n 'data-highlighted': isHighlighted ? true as const : undefined,\n 'data-index': index,\n 'aria-setsize': items.length,\n 'aria-posinset': index + 1,\n onMouseEnter: handleItemMouseEnter,\n onMouseLeave: handleItemMouseLeave,\n onClick: handleItemClick,\n onKeyDown: handleItemKeyDown,\n };\n\n // Use renderItem if provided, otherwise use SimpleItem with itemLabel\n if (RenderItem) {\n return (\n <RenderItem\n key={virtualRow.key}\n item={item}\n index={index}\n {...commonProps}\n />\n );\n }\n\n return (\n <SimpleItem\n key={virtualRow.key}\n label={getLabel!(item)}\n {...commonProps}\n />\n );\n })}\n </div>\n </div>\n );\n}\n\nconst VirtualMenuRoot = React.forwardRef(VirtualMenuRootInner) as (<T>(\n props: VirtualMenuProps<T> & React.RefAttributes<HTMLDivElement>,\n) => React.ReactElement) & { displayName?: string };\nVirtualMenuRoot.displayName = 'VirtualMenu';\n\n// ============================================================================\n// VirtualMenu.Item Component (for custom renderItem usage)\n// ============================================================================\n\ninterface VirtualMenuItemProps extends React.ComponentPropsWithoutRef<'div'> {\n children: React.ReactNode;\n /** Data attribute for highlight styling */\n 'data-highlighted'?: true | undefined;\n /** Data attribute for event delegation */\n 'data-index'?: number;\n}\n\nconst VirtualMenuItemInner = React.forwardRef<HTMLDivElement, VirtualMenuItemProps>(\n ({ className, children, ...allProps }, forwardedRef) => {\n // A `renderItem` component usually spreads everything it is given onto this row. These three\n // are for the component, not the element, so they stop here.\n const { isHighlighted: _isHighlighted, index: _index, item: _item, ...props } = allProps as typeof allProps & {\n isHighlighted?: boolean;\n index?: number;\n item?: unknown;\n };\n return (\n <div\n ref={forwardedRef}\n role=\"menuitem\"\n className={classNames('kui-reset', 'kui-BaseMenuItem', 'kui-VirtualMenuItem', className)}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nVirtualMenuItemInner.displayName = 'VirtualMenu.Item';\n\n// Style is compared by height and transform; every other prop shallowly.\nconst VirtualMenuItem = React.memo(VirtualMenuItemInner, areRowPropsEqual);\n\n// ============================================================================\n// Exports\n// ============================================================================\n\nconst VirtualMenu = Object.assign(VirtualMenuRoot, {\n Item: VirtualMenuItem,\n});\n\nexport { VirtualMenu };\nexport type { VirtualMenuProps, VirtualMenuItemProps, VirtualMenuRenderItemProps };\n", "'use client';\n\nimport * as React from 'react';\nimport { useLayoutEffect } from 'radix-ui/internal';\n\nimport { useResolvedResponsiveValue } from './base-menu.utils.js';\n\nimport type { Responsive } from '../../props/prop-def.js';\n\n/**\n * Context to detect if a component is rendered inside a menu (DropdownMenu, ContextMenu, etc.)\n * Used by VirtualMenu to adjust its behavior:\n * - Skip role=\"menu\" when inside a parent menu (parent owns the role)\n * - Delegate certain keyboard handling to parent\n * - Use the correct item height based on menu size\n */\n\nexport type MenuSize = '1' | '2' | '3' | '4';\n\ninterface MenuContextValue {\n /** Whether we're inside a menu that owns the menu role */\n isInsideMenu: boolean;\n /** Menu size for the current breakpoint */\n size?: MenuSize;\n /** Item height in px for the current size and theme scaling */\n itemHeight?: number;\n}\n\nconst MenuContext = React.createContext<MenuContextValue>({ isInsideMenu: false });\n\n/** The register function of the menu Group a Label sits in (see useMenuGroupLabelId). */\nconst MenuGroupLabelContext = React.createContext<((id: string | null) => void) | null>(null);\n\ninterface MenuProviderProps {\n children: React.ReactNode;\n /** Menu size passed from parent (DropdownMenu.Content, ContextMenu.Content, etc.) */\n size?: Responsive<MenuSize>;\n}\n\n/**\n * Menu row height in pixels per size: the line height plus --row-inset-N above and below\n * (base-menu.css), never under the 24px target floor.\n */\nexport const menuSizeToItemHeight: Record<MenuSize, number> = {\n '1': 24,\n '2': 30,\n '3': 34,\n '4': 38,\n};\n\nexport function getMenuItemHeight(size: MenuSize): number {\n return menuSizeToItemHeight[size];\n}\n\nexport function MenuProvider({ children, size }: MenuProviderProps) {\n const resolvedSize = useResolvedResponsiveValue<MenuSize | undefined>(size, undefined);\n const itemHeight = resolvedSize ? getMenuItemHeight(resolvedSize) : undefined;\n const value = React.useMemo(\n () => ({ isInsideMenu: true, size: resolvedSize, itemHeight }),\n [resolvedSize, itemHeight],\n );\n // A submenu is its own surface, so its labels never name a group of the parent menu.\n return (\n <MenuContext.Provider value={value}>\n <MenuGroupLabelContext.Provider value={null}>{children}</MenuGroupLabelContext.Provider>\n </MenuContext.Provider>\n );\n}\n\nexport function useMenuContext() {\n return React.useContext(MenuContext);\n}\n\n/**\n * Closes the whole menu from inside it. DropdownMenu.Root and ContextMenu.Root provide it,\n * so a VirtualMenu row can close the menu on select the way a menu item does.\n */\nconst MenuCloseContext = React.createContext<(() => void) | undefined>(undefined);\nexport const MenuCloseProvider = MenuCloseContext.Provider;\n\nexport function useMenuClose() {\n return React.useContext(MenuCloseContext);\n}\n\n/**\n * Names a menu group by its label, the way v2's MenuGroup does. A Group holds the id of\n * the Label inside it and points aria-labelledby at it, so a screen reader announces the\n * section name when focus enters the group.\n */\nexport const MenuGroupLabelProvider = MenuGroupLabelContext.Provider;\n\n/** For a Group: the id its aria-labelledby points to, and the setter a nested Label calls. */\nexport function useMenuGroupLabelledBy(ariaLabelledBy: string | undefined) {\n const [labelId, setLabelId] = React.useState<string | null>(null);\n return [ariaLabelledBy ?? labelId ?? undefined, setLabelId] as const;\n}\n\n/** For a Label: its id, registered with the Group it sits in while the label is rendered. */\nexport function useMenuGroupLabelId(idProp: string | undefined, rendered = true) {\n const register = React.useContext(MenuGroupLabelContext);\n const generatedId = React.useId();\n const id = idProp ?? generatedId;\n useLayoutEffect(() => {\n if (!register || !rendered) return;\n register(id);\n return () => register(null);\n }, [register, id, rendered]);\n return register ? id : idProp;\n}\n"],
5
+ "mappings": ";mlBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,iBAAAE,KAAA,eAAAC,GAAAH,IAEA,IAAAI,EAAuB,oBACvBC,EAAuB,yBACvBC,EAA+B,mCAC/BC,EAAgC,6BCHhC,IAAAC,EAAuB,oBACvBC,GAAgC,6BAyBhC,IAAMC,GAAoB,gBAAgC,CAAE,aAAc,EAAM,CAAC,EAG3EC,GAA8B,gBAAoD,IAAI,EAY/EC,GAAiD,CAC5D,EAAK,GACL,EAAK,GACL,EAAK,GACL,EAAK,EACP,EAEO,SAASC,EAAkBC,EAAwB,CACxD,OAAOF,GAAqBE,CAAI,CAClC,CAiBO,SAASC,GAAiB,CAC/B,OAAa,aAAWC,EAAW,CACrC,CAMA,IAAMC,EAAyB,gBAAwC,MAAS,EACnEC,GAAoBD,EAAiB,SAE3C,SAASE,GAAe,CAC7B,OAAa,aAAWF,CAAgB,CAC1C,CAOO,IAAMG,GAAyBC,GAAsB,SDiD5D,SAASC,EAA4DC,EAASC,EAAS,CAErF,GADID,EAAK,OAAO,SAAWC,EAAK,OAAO,QACnCD,EAAK,OAAO,YAAcC,EAAK,OAAO,UAAW,MAAO,GAC5D,IAAMC,EAAW,OAAO,KAAKF,CAAI,EACjC,OAAIE,EAAS,SAAW,OAAO,KAAKD,CAAI,EAAE,OAAe,GAClDC,EAAS,MAAOC,GAAQA,IAAQ,SAAW,OAAO,GAAGH,EAAKG,CAAG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EAAW,KAAK,KAC3C,EAEMG,EAAc,CAClB,GAAIP,EAAUX,CAAK,EACnB,cAAAgB,EACA,MAAOC,GAEP,SAAU,GACV,mBAAoBD,EAAgB,GAAgB,OACpD,aAAchB,EACd,eAAgB9C,EAAM,OACtB,gBAAiB8C,EAAQ,EACzB,aAAcD,GACd,aAAcG,GACd,QAASD,GACT,UAAWG,EACb,EAGA,OAAIhD,EAEA,gBAACA,EAAA,CACC,IAAK2D,EAAW,IAChB,KAAMlC,EACN,MAAOmB,EACN,GAAGkB,EACN,EAKF,gBAACzF,GAAA,CACC,IAAKsF,EAAW,IAChB,MAAOnC,GAAUC,CAAI,EACpB,GAAGqC,EACN,CAEJ,CAAC,CACH,CACF,CAEJ,CAEA,IAAMC,EAAwB,aAAWlE,EAAoB,EAG7DkE,EAAgB,YAAc,cAc9B,IAAMC,EAA6B,aACjC,CAAC,CAAE,UAAA3D,EAAW,SAAA4D,EAAU,GAAGC,CAAS,EAAG1D,IAAiB,CAGtD,GAAM,CAAE,cAAejC,EAAgB,MAAO4F,EAAQ,KAAMC,EAAO,GAAGC,CAAM,EAAIH,EAKhF,OACE,gBAAC,OACC,IAAK1D,EACL,KAAK,WACL,aAAW,EAAArB,SAAW,YAAa,mBAAoB,sBAAuBkB,CAAS,EACtF,GAAGgE,GAEHJ,CACH,CAEJ,CACF,EAEAD,EAAqB,YAAc,mBAGnC,IAAMM,GAAwB,OAAKN,EAAsBhG,CAAgB,EAMnEuG,GAAc,OAAO,OAAOR,EAAiB,CACjD,KAAMO,EACR,CAAC",
6
+ "names": ["virtual_menu_exports", "__export", "VirtualMenu", "__toCommonJS", "React", "import_classnames", "import_react_virtual", "import_internal", "React", "import_internal", "MenuContext", "MenuGroupLabelContext", "menuSizeToItemHeight", "getMenuItemHeight", "size", "useMenuContext", "MenuContext", "MenuCloseContext", "MenuCloseProvider", "useMenuClose", "MenuGroupLabelProvider", "MenuGroupLabelContext", "areRowPropsEqual", "prev", "next", "prevKeys", "key", "SimpleItem", "label", "_isHighlighted", "id", "style", "tabIndex", "dataHighlighted", "dataIndex", "setSize", "posInSet", "onMouseEnter", "onMouseLeave", "onClick", "onKeyDown", "classNames", "useMeasuredRowHeight", "rootRef", "enabled", "size", "height", "setHeight", "root", "probe", "measured", "VirtualMenuRootInner", "items", "itemLabel", "RenderItem", "sizeProp", "estimatedItemSizeProp", "overscan", "onSelect", "className", "onFocus", "rootProps", "forwardedRef", "menuId", "parentRef", "highlightedIndex", "setHighlightedIndex", "isInsideMenu", "contextSize", "contextItemHeight", "useMenuContext", "closeMenu", "useMenuClose", "setRootRef", "node", "measuredItemHeight", "estimatedItemSize", "getMenuItemHeight", "getLabel", "item", "safeHighlightedIndex", "getItemSize", "virtualizer", "virtualItems", "content", "handleFocusIn", "event", "onKeyDownRef", "onFocusRef", "itemsRef", "onSelectRef", "closeMenuRef", "selectIndex", "idx", "currentItems", "scrollToIndexRef", "highlightedIndexRef", "handleItemMouseEnter", "index", "handleItemClick", "handleItemMouseLeave", "current", "handleItemKeyDown", "handleKeyDown", "currentHighlightedIndex", "nextIndex", "prevIndex", "lastIndex", "handleFocus", "getItemId", "rootStyle", "totalSize", "viewportStyle", "virtualRow", "isHighlighted", "itemStyle", "commonProps", "VirtualMenuRoot", "VirtualMenuItemInner", "children", "allProps", "_index", "_item", "props", "VirtualMenuItem", "VirtualMenu"]
7
7
  }
@@ -1,6 +1,6 @@
1
- "use strict";var G=Object.create;var S=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var I=(t,e)=>{for(var n in e)S(t,n,{get:e[n],enumerable:!0})},V=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of B(e))!q.call(t,s)&&s!==n&&S(t,s,{get:()=>e[s],enumerable:!(o=K(e,s))||o.enumerable});return t};var C=(t,e,n)=>(n=t!=null?G(L(t)):{},V(e||!t||!t.__esModule?S(n,"default",{value:t,enumerable:!0}):n,t)),H=t=>V(S({},"__esModule",{value:!0}),t);var de={};I(de,{FONT_ROLE_VARIABLES:()=>m,FONT_STACKS:()=>ee,FONT_STACK_VARIABLES:()=>d,THEME_SIZE_DEFAULT:()=>qe,ThemeSizeContext:()=>P.ThemeSizeContext,applyFontConfig:()=>te,clampSize:()=>ce,extractMarginProps:()=>z,extractProps:()=>X,generateFontCSS:()=>ne,getCurrentFontConfig:()=>oe,getMarginStyles:()=>ae,getMatchingGrayColor:()=>pe,getResponsiveClassNames:()=>h,getResponsiveCustomProperties:()=>O,getResponsiveStyles:()=>R,getSubtree:()=>ue,hasOwnProperty:()=>b,isResponsiveObject:()=>c,mapResponsiveProp:()=>le,mergeStyles:()=>y,normalizeToPx:()=>me,requireReactElement:()=>fe,resetFonts:()=>se,useThemeSize:()=>P.useThemeSize,useThemeSizeProps:()=>P.useThemeSizeProps});module.exports=H(de);function z(t){let{m:e,mx:n,my:o,mt:s,mr:r,mb:a,ml:u,...p}=t;return{m:e,mx:n,my:o,mt:s,mr:r,mb:a,ml:u,rest:p}}var j=C(require("classnames"));var U=[],W=new Set;function _(t){let e=Object.assign({},...t),n=[],o=[],s=new Set;for(let r in e){let a=e[r],u=a.values??U,p={key:r,type:a.type,default:a.default,hasDefault:a.default!==void 0,responsive:"responsive"in a,className:a.className,customProperties:a.customProperties,parseValue:a.parseValue,values:u,valueSet:u.length>0?new Set(u):W,enumValueSet:a.type==="enum"?new Set([a.default,...u]):void 0};a.className?(n.push(p),s.add(r)):(p.hasDefault||a.type==="enum")&&o.push(p)}return{styling:n,passthrough:o,stylingKeys:s}}var Y={children:new WeakMap};function E(t){let e=Y;for(let n=0;n<t.length;n++){let o=t[n],s=e.children.get(o);s===void 0&&(s={children:new WeakMap},e.children.set(o,s)),e=s}return e.compiled??(e.compiled=_(t))}var J=["initial","xs","sm","md","lg","xl"],N=new Set(J);function b(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var Z=new Set(["initial","xs","sm","md","lg","xl"]);function c(t){if(typeof t!="object"||t===null)return!1;for(let e in t)if(Z.has(e))return!0;return!1}function D(t,e,n){return e!==void 0?e.has(n):t.includes(n)}function R({className:t,customProperties:e,...n}){let o=h({allowArbitraryValues:!0,className:t,...n}),s=O({customProperties:e,...n});return[o,s]}function h({allowArbitraryValues:t,value:e,className:n,propValues:o,propValueSet:s,parseValue:r=a=>a}){if(e){if(typeof e=="string")return D(o,s,e)?M(n,e,r):t?n:void 0;if(c(e)){let a=e,u=[];for(let p in a){if(!b(a,p)||!N.has(p))continue;let i=a[p];if(i!==void 0){if(D(o,s,i)){let l=M(n,i,r),f=p==="initial"?l:`${p}:${l}`;u.push(f)}else if(t){let l=p==="initial"?n:`${p}:${n}`;u.push(l)}}}return u.length>0?u.join(" "):""}if(t)return n}}function M(t,e,n){let o=t?"-":"",s=n(e),r=s?.startsWith("-"),a=r?"-":"",u=r?s?.substring(1):s;return`${a}${t}${o}${u}`}function O({customProperties:t,value:e,propValues:n,propValueSet:o,parseValue:s=r=>r}){if(!e||typeof e=="string"&&D(n,o,e))return;let r;if(typeof e=="string"){let a=s(e);r={};for(let u of t)r[u]=a;return r}if(c(e)){let a=e;for(let u in a){if(!b(a,u)||!N.has(u))continue;let p=a[u];if(p===void 0||D(n,o,p))continue;let i=s(p);r??(r={});for(let l of t){let f=u==="initial"?l:`${l}-${u}`;r[f]=i}}}return r??{}}function y(...t){let e;for(let n of t)n&&(e===void 0&&(e={}),Object.assign(e,n));return e}function Q(t,e){let n=t.initial,o=!1;return e.hasDefault&&n===void 0&&(n=e.default,o=!0),e.enumValueSet!==void 0&&!e.enumValueSet.has(n)&&(n=e.default,o=!0),o?{...t,initial:n}:t}function X(t,...e){let{styling:n,passthrough:o,stylingKeys:s}=E(e),r={};for(let p in t)s.has(p)||(r[p]=t[p]);for(let p=0;p<o.length;p++){let i=o[p],l=r[i.key];if(l===void 0){i.hasDefault&&(r[i.key]=i.default);continue}i.enumValueSet!==void 0&&!i.enumValueSet.has(l)&&!c(l)&&(r[i.key]=i.default)}let a,u=[];for(let p=0;p<n.length;p++){let i=n[p],l=t[i.key];if(l===void 0&&i.hasDefault&&(l=i.default),i.enumValueSet!==void 0&&!i.enumValueSet.has(l)&&!c(l)&&(l=i.default),!!l){if(c(l)){if(!i.responsive)continue;l=Q(l,i)}if(i.type==="enum"){let f=h({allowArbitraryValues:!1,value:l,className:i.className,propValues:i.values,propValueSet:i.valueSet,parseValue:i.parseValue});f&&u.push(f);continue}if(i.type==="string"||i.type==="enum | string"){let[f,k]=R({className:i.className,customProperties:i.customProperties,propValues:i.type==="string"?[]:i.values,propValueSet:i.type==="string"?void 0:i.valueSet,parseValue:i.parseValue,value:l});k&&(a=y(a,k)),f&&u.push(f);continue}if(i.type==="boolean"){u.push(i.className);continue}}}return r.className=(0,j.default)(u.length>0?u.join(" "):void 0,t.className),r.style=y(a,t.style),r}var d={sans:"--font-sans",mono:"--font-mono",serif:"--font-serif"},m={body:"--font-body",heading:"--font-heading",code:"--font-code",strong:"--font-strong",em:"--font-em",quote:"--font-quote"},ee={system:"-apple-system, BlinkMacSystemFont, 'Segoe UI (Custom)', Roboto, 'Helvetica Neue', system-ui, sans-serif",inter:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI (Custom)', Roboto, system-ui, sans-serif",poppins:"'Poppins', -apple-system, BlinkMacSystemFont, system-ui, sans-serif",openSans:"'Open Sans (Custom)', -apple-system, BlinkMacSystemFont, system-ui, sans-serif",systemMono:"'Menlo', 'Consolas (Custom)', 'Bitstream Vera Sans Mono', monospace",jetbrainsMono:"'JetBrains Mono', 'Menlo', 'Consolas (Custom)', monospace",firaCode:"'Fira Code', 'Menlo', 'Consolas (Custom)', monospace",sourceCodePro:"'Source Code Pro', 'Menlo', 'Consolas (Custom)', monospace",systemSerif:"'Times New Roman', 'Times', 'Georgia', 'Cambria', serif",playfair:"'Playfair Display', 'Times New Roman', 'Georgia', serif",georgia:"'Georgia', 'Times New Roman', 'Times', serif",lora:"'Lora', 'Georgia', 'Times New Roman', serif"};function F(t,e,n){for(let o of Object.keys(e)){let s=n[o];s&&t.style.setProperty(e[o],s)}}function w(t,e){for(let n of Object.values(e))t.style.removeProperty(n)}function te(t,{root:e=document.documentElement,themeElement:n=document.querySelector(".kui-theme")}={}){t.stacks&&F(e,d,t.stacks),t.roles&&n&&F(n,m,t.roles)}function ne(t){let e=[],n=Object.entries(t.stacks??{}).filter(([,s])=>s);n.length&&e.push([":root {",...n.map(([s,r])=>` ${d[s]}: ${r};`),"}"].join(`
2
- `));let o=Object.entries(t.roles??{}).filter(([,s])=>s);return o.length&&e.push([".kui-theme {",...o.map(([s,r])=>` ${m[s]}: ${r};`),"}"].join(`
1
+ "use strict";var G=Object.create;var S=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var I=(t,e)=>{for(var n in e)S(t,n,{get:e[n],enumerable:!0})},V=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of B(e))!q.call(t,s)&&s!==n&&S(t,s,{get:()=>e[s],enumerable:!(r=K(e,s))||r.enumerable});return t};var C=(t,e,n)=>(n=t!=null?G(L(t)):{},V(e||!t||!t.__esModule?S(n,"default",{value:t,enumerable:!0}):n,t)),H=t=>V(S({},"__esModule",{value:!0}),t);var de={};I(de,{FONT_ROLE_VARIABLES:()=>m,FONT_STACKS:()=>ee,FONT_STACK_VARIABLES:()=>d,THEME_SIZE_DEFAULT:()=>qe,ThemeSizeContext:()=>P.ThemeSizeContext,applyFontConfig:()=>te,clampSize:()=>ce,extractMarginProps:()=>z,extractProps:()=>X,generateFontCSS:()=>ne,getCurrentFontConfig:()=>re,getMarginStyles:()=>ae,getMatchingGrayColor:()=>pe,getResponsiveClassNames:()=>h,getResponsiveCustomProperties:()=>O,getResponsiveStyles:()=>R,getSubtree:()=>ue,hasOwnProperty:()=>b,isResponsiveObject:()=>c,mapResponsiveProp:()=>le,mergeStyles:()=>y,normalizeToPx:()=>me,requireReactElement:()=>fe,resetFonts:()=>se,useThemeSize:()=>P.useThemeSize,useThemeSizeProps:()=>P.useThemeSizeProps});module.exports=H(de);function z(t){let{m:e,mx:n,my:r,mt:s,mr:o,mb:a,ml:u,...p}=t;return{m:e,mx:n,my:r,mt:s,mr:o,mb:a,ml:u,rest:p}}var j=C(require("classnames"));var U=[],W=new Set;function _(t){let e=Object.assign({},...t),n=[],r=[],s=new Set;for(let o in e){let a=e[o],u=a.values??U,p={key:o,type:a.type,default:a.default,hasDefault:a.default!==void 0,responsive:"responsive"in a,className:a.className,customProperties:a.customProperties,parseValue:a.parseValue,values:u,valueSet:u.length>0?new Set(u):W,enumValueSet:a.type==="enum"?new Set([a.default,...u]):void 0};a.className?(n.push(p),s.add(o)):(p.hasDefault||a.type==="enum")&&r.push(p)}return{styling:n,passthrough:r,stylingKeys:s}}var Y={children:new WeakMap};function E(t){let e=Y;for(let n=0;n<t.length;n++){let r=t[n],s=e.children.get(r);s===void 0&&(s={children:new WeakMap},e.children.set(r,s)),e=s}return e.compiled??(e.compiled=_(t))}var J=["initial","xs","sm","md","lg","xl"],N=new Set(J);function b(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var Z=new Set(["initial","xs","sm","md","lg","xl"]);function c(t){if(typeof t!="object"||t===null)return!1;for(let e in t)if(Z.has(e))return!0;return!1}function D(t,e,n){return e!==void 0?e.has(n):t.includes(n)}function R({className:t,customProperties:e,...n}){let r=h({allowArbitraryValues:!0,className:t,...n}),s=O({customProperties:e,...n});return[r,s]}function h({allowArbitraryValues:t,value:e,className:n,propValues:r,propValueSet:s,parseValue:o=a=>a}){if(e){if(typeof e=="string")return D(r,s,e)?M(n,e,o):t?n:void 0;if(c(e)){let a=e,u=[];for(let p in a){if(!b(a,p)||!N.has(p))continue;let i=a[p];if(i!==void 0){if(D(r,s,i)){let l=M(n,i,o),f=p==="initial"?l:`${p}:${l}`;u.push(f)}else if(t){let l=p==="initial"?n:`${p}:${n}`;u.push(l)}}}return u.length>0?u.join(" "):""}if(t)return n}}function M(t,e,n){let r=t?"-":"",s=n(e),o=s?.startsWith("-"),a=o?"-":"",u=o?s?.substring(1):s;return`${a}${t}${r}${u}`}function O({customProperties:t,value:e,propValues:n,propValueSet:r,parseValue:s=o=>o}){if(!e||typeof e=="string"&&D(n,r,e))return;let o;if(typeof e=="string"){let a=s(e);o={};for(let u of t)o[u]=a;return o}if(c(e)){let a=e;for(let u in a){if(!b(a,u)||!N.has(u))continue;let p=a[u];if(p===void 0||D(n,r,p))continue;let i=s(p);o??(o={});for(let l of t){let f=u==="initial"?l:`${l}-${u}`;o[f]=i}}}return o??{}}function y(...t){let e;for(let n of t)n&&(e===void 0&&(e={}),Object.assign(e,n));return e}function Q(t,e){let n=t.initial,r=!1;return e.hasDefault&&n===void 0&&(n=e.default,r=!0),e.enumValueSet!==void 0&&!e.enumValueSet.has(n)&&(n=e.default,r=!0),r?{...t,initial:n}:t}function X(t,...e){let{styling:n,passthrough:r,stylingKeys:s}=E(e),o={};for(let p in t)s.has(p)||(o[p]=t[p]);for(let p=0;p<r.length;p++){let i=r[p],l=o[i.key];if(l===void 0){i.hasDefault&&(o[i.key]=i.default);continue}i.enumValueSet!==void 0&&!i.enumValueSet.has(l)&&!c(l)&&(o[i.key]=i.default)}let a,u=[];for(let p=0;p<n.length;p++){let i=n[p],l=t[i.key];if(l===void 0&&i.hasDefault&&(l=i.default),i.enumValueSet!==void 0&&!i.enumValueSet.has(l)&&!c(l)&&(l=i.default),!!l){if(c(l)){if(!i.responsive)continue;l=Q(l,i)}if(i.type==="enum"){let f=h({allowArbitraryValues:!1,value:l,className:i.className,propValues:i.values,propValueSet:i.valueSet,parseValue:i.parseValue});f&&u.push(f);continue}if(i.type==="string"||i.type==="enum | string"){let[f,k]=R({className:i.className,customProperties:i.customProperties,propValues:i.type==="string"?[]:i.values,propValueSet:i.type==="string"?void 0:i.valueSet,parseValue:i.parseValue,value:l});k&&(a=y(a,k)),f&&u.push(f);continue}if(i.type==="boolean"){u.push(i.className);continue}}}return o.className=(0,j.default)(u.length>0?u.join(" "):void 0,t.className),o.style=y(a,t.style),o}var d={sans:"--font-sans",mono:"--font-mono",serif:"--font-serif"},m={body:"--font-body",heading:"--font-heading",code:"--font-code",strong:"--font-strong",em:"--font-em",quote:"--font-quote"},ee={system:"-apple-system, BlinkMacSystemFont, 'Segoe UI (Custom)', Roboto, 'Helvetica Neue', system-ui, sans-serif",inter:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI (Custom)', Roboto, system-ui, sans-serif",poppins:"'Poppins', -apple-system, BlinkMacSystemFont, system-ui, sans-serif",openSans:"'Open Sans (Custom)', -apple-system, BlinkMacSystemFont, system-ui, sans-serif",systemMono:"'Menlo', 'Consolas (Custom)', 'Bitstream Vera Sans Mono', monospace",jetbrainsMono:"'JetBrains Mono', 'Menlo', 'Consolas (Custom)', monospace",firaCode:"'Fira Code', 'Menlo', 'Consolas (Custom)', monospace",sourceCodePro:"'Source Code Pro', 'Menlo', 'Consolas (Custom)', monospace",systemSerif:"'Times New Roman', 'Times', 'Georgia', 'Cambria', serif",playfair:"'Playfair Display', 'Times New Roman', 'Georgia', serif",georgia:"'Georgia', 'Times New Roman', 'Times', serif",lora:"'Lora', 'Georgia', 'Times New Roman', serif"};function F(t,e,n){for(let r of Object.keys(e)){let s=n[r];s&&t.style.setProperty(e[r],s)}}function w(t,e){for(let n of Object.values(e))t.style.removeProperty(n)}function te(t,{root:e=document.documentElement,themeElement:n=document.querySelector(".kui-theme")}={}){t.stacks&&F(e,d,t.stacks),t.roles&&n&&F(n,m,t.roles)}function ne(t){let e=[],n=Object.entries(t.stacks??{}).filter(([,s])=>s);n.length&&e.push([":root {",...n.map(([s,o])=>` ${d[s]}: ${o};`),"}"].join(`
2
+ `));let r=Object.entries(t.roles??{}).filter(([,s])=>s);return r.length&&e.push([".kui-theme {",...r.map(([s,o])=>` ${m[s]}: ${o};`),"}"].join(`
3
3
  `)),e.join(`
4
4
 
5
- `)}function se({root:t=document.documentElement,themeElement:e=document.querySelector(".kui-theme")}={}){w(t,d),e&&w(e,m)}function oe({themeElement:t=document.querySelector(".kui-theme")}={}){let e=getComputedStyle(t??document.documentElement),n=o=>e.getPropertyValue(o).trim()||void 0;return{stacks:{sans:n(d.sans),mono:n(d.mono),serif:n(d.serif)},roles:{body:n(m.body),heading:n(m.heading),code:n(m.code),strong:n(m.strong),em:n(m.em),quote:n(m.quote)}}}var g=["0","1","2","3","4","5","6","7","8","9","10","11","12","-1","-2","-3","-4","-5","-6","-7","-8","-9","-10","-11","-12","bleed"],v={m:{type:"enum | string",values:g,responsive:!0,className:"kui-r-m",customProperties:["--m"]},mx:{type:"enum | string",values:g,responsive:!0,className:"kui-r-mx",customProperties:["--ml","--mr"]},my:{type:"enum | string",values:g,responsive:!0,className:"kui-r-my",customProperties:["--mt","--mb"]},mt:{type:"enum | string",values:g,responsive:!0,className:"kui-r-mt",customProperties:["--mt"]},mr:{type:"enum | string",values:g,responsive:!0,className:"kui-r-mr",customProperties:["--mr"]},mb:{type:"enum | string",values:g,responsive:!0,className:"kui-r-mb",customProperties:["--mb"]},ml:{type:"enum | string",values:g,responsive:!0,className:"kui-r-ml",customProperties:["--ml"]}};var A=v.m.values,re=new Set(A),ie=["m","mx","my","mt","mr","mb","ml"],$=ie.map(t=>({key:t,className:v[t].className,customProperties:[...v[t].customProperties]}));function ae(t){let e,n;for(let o=0;o<$.length;o++){let{key:s,className:r,customProperties:a}=$[o],u=t[s];if(u===void 0)continue;let[p,i]=R({className:r,customProperties:a,propValues:A,propValueSet:re,value:u});p&&(e??(e=[])).push(p),i&&(n=y(n,i))}return[e!==void 0?e.join(" "):"",n]}function pe(t){switch(t){case"tomato":case"red":case"ruby":case"crimson":case"pink":case"plum":case"purple":case"violet":return"mauve";case"iris":case"indigo":case"blue":case"sky":case"cyan":return"slate";case"teal":case"jade":case"mint":case"green":return"sage";case"grass":case"lime":return"olive";case"yellow":case"amber":case"orange":case"brown":case"gold":case"bronze":return"sand";case"gray":return"gray"}}var T=C(require("react"));function ue(t,e){let{asChild:n,children:o}=t;if(!n)return typeof e=="function"?e(o):e;let s=T.Children.only(o);return T.cloneElement(s,{children:typeof e=="function"?e(s.props.children):e})}function le(t,e){if(t!==void 0)return typeof t=="string"?e(t):Object.fromEntries(Object.entries(t).map(([n,o])=>[n,e(o)]))}function me(t,e="horizontal"){if(t==null)return;if(typeof t=="number"&&Number.isFinite(t))return t;let n=String(t).trim();if(!n)return;if(n.endsWith("px"))return Number.parseFloat(n);if(n.endsWith("rem")){let s=Number.parseFloat(getComputedStyle(document.documentElement).fontSize||"16")||16;return Number.parseFloat(n)*s}if(n.endsWith("%")){let s=Number.parseFloat(n),r=e==="horizontal"?document.documentElement.clientWidth||window.innerWidth||0:document.documentElement.clientHeight||window.innerHeight||0;return s/100*r}let o=Number.parseFloat(n);return Number.isFinite(o)?o:void 0}var x=C(require("react")),fe=t=>{if(!x.isValidElement(t))throw Error(`Expected a single React Element child, but got: ${x.Children.toArray(t).map(n=>typeof n=="object"&&"type"in n&&typeof n.type=="string"?n.type:typeof n).join(", ")}`);return t};var qe="2";function ce(t,e){if(e.includes(t))return t;let n=Number(t),o=e[0],s=1/0;for(let r=0;r<e.length;r++){let a=Math.abs(Number(e[r])-n);a<s&&(s=a,o=e[r])}return o}var P=require("../hooks/theme-size.js");
5
+ `)}function se({root:t=document.documentElement,themeElement:e=document.querySelector(".kui-theme")}={}){w(t,d),e&&w(e,m)}function re({themeElement:t=document.querySelector(".kui-theme")}={}){let e=getComputedStyle(t??document.documentElement),n=r=>e.getPropertyValue(r).trim()||void 0;return{stacks:{sans:n(d.sans),mono:n(d.mono),serif:n(d.serif)},roles:{body:n(m.body),heading:n(m.heading),code:n(m.code),strong:n(m.strong),em:n(m.em),quote:n(m.quote)}}}var g=["0","1","2","3","4","5","6","7","8","9","10","11","12","-1","-2","-3","-4","-5","-6","-7","-8","-9","-10","-11","-12","bleed"],v={m:{type:"enum | string",values:g,responsive:!0,className:"kui-r-m",customProperties:["--m"]},mx:{type:"enum | string",values:g,responsive:!0,className:"kui-r-mx",customProperties:["--ml","--mr"]},my:{type:"enum | string",values:g,responsive:!0,className:"kui-r-my",customProperties:["--mt","--mb"]},mt:{type:"enum | string",values:g,responsive:!0,className:"kui-r-mt",customProperties:["--mt"]},mr:{type:"enum | string",values:g,responsive:!0,className:"kui-r-mr",customProperties:["--mr"]},mb:{type:"enum | string",values:g,responsive:!0,className:"kui-r-mb",customProperties:["--mb"]},ml:{type:"enum | string",values:g,responsive:!0,className:"kui-r-ml",customProperties:["--ml"]}};var A=v.m.values,oe=new Set(A),ie=["m","mx","my","mt","mr","mb","ml"],$=ie.map(t=>({key:t,className:v[t].className,customProperties:[...v[t].customProperties]}));function ae(t){let e,n;for(let r=0;r<$.length;r++){let{key:s,className:o,customProperties:a}=$[r],u=t[s];if(u===void 0)continue;let[p,i]=R({className:o,customProperties:a,propValues:A,propValueSet:oe,value:u});p&&(e??(e=[])).push(p),i&&(n=y(n,i))}return[e!==void 0?e.join(" "):"",n]}function pe(t){switch(t){case"tomato":case"red":case"ruby":case"crimson":case"pink":case"plum":case"purple":case"violet":return"mauve";case"iris":case"indigo":case"blue":case"sky":case"cyan":return"slate";case"teal":case"jade":case"mint":case"green":return"sage";case"grass":case"lime":return"olive";case"yellow":case"amber":case"orange":case"brown":case"gold":case"bronze":return"sand";case"gray":return"gray"}}var T=C(require("react"));function ue(t,e){let{asChild:n,children:r}=t;if(!n)return typeof e=="function"?e(r):e;let s=T.Children.only(r);return T.cloneElement(s,{children:typeof e=="function"?e(s.props.children):e})}function le(t,e){if(t!==void 0)return typeof t=="string"?e(t):Object.fromEntries(Object.entries(t).map(([n,r])=>[n,e(r)]))}function me(t,e="horizontal"){if(t==null)return;if(typeof t=="number"&&Number.isFinite(t))return t;let n=String(t).trim();if(!n)return;if(n.endsWith("px"))return Number.parseFloat(n);if(n.endsWith("rem")){let s=Number.parseFloat(getComputedStyle(document.documentElement).fontSize||"16")||16;return Number.parseFloat(n)*s}if(n.endsWith("%")){let s=Number.parseFloat(n),o=e==="horizontal"?document.documentElement.clientWidth||window.innerWidth||0:document.documentElement.clientHeight||window.innerHeight||0;return s/100*o}let r=Number.parseFloat(n);return Number.isFinite(r)?r:void 0}var x=C(require("react")),fe=t=>{if(!x.isValidElement(t))throw Error(`Expected a single React Element child, but got: ${x.Children.toArray(t).map(n=>typeof n=="object"&&"type"in n&&typeof n.type=="string"?n.type:typeof n).join(", ")}`);return t};var qe="2";function ce(t,e){if(e.includes(t))return t;let n=Number(t),r=e[0],s=1/0;for(let o=0;o<e.length;o++){let a=Math.abs(Number(e[o])-n);a<s&&(s=a,r=e[o])}return r}var P=require("../hooks/theme-size.js");
6
6
  //# sourceMappingURL=index.js.map