@yewdiel21/motion-kit 0.10.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (459) hide show
  1. package/README.md +81 -0
  2. package/bin/motion-kit.mjs +3 -3
  3. package/dist/auto/index.d.ts +56 -3
  4. package/dist/auto/index.js +107 -3
  5. package/dist/auto/index.js.map +1 -1
  6. package/dist/{chunk-XAKC2QY7.js → chunk-6IRJYXJU.js} +3 -28
  7. package/dist/chunk-6IRJYXJU.js.map +1 -0
  8. package/dist/chunk-A6QQCF6V.js +21333 -0
  9. package/dist/chunk-A6QQCF6V.js.map +1 -0
  10. package/dist/chunk-JXRS3OEA.js +3638 -0
  11. package/dist/chunk-JXRS3OEA.js.map +1 -0
  12. package/dist/chunk-QP4QJOEN.js +72 -0
  13. package/dist/chunk-QP4QJOEN.js.map +1 -0
  14. package/dist/css/components/activity-feed.css +240 -0
  15. package/dist/css/components/add-to-cart.css +72 -0
  16. package/dist/css/components/attachment.css +266 -0
  17. package/dist/css/components/bidirectional-slider.css +168 -0
  18. package/dist/css/components/breadcrumb.css +110 -0
  19. package/dist/css/components/chart-tooltip.css +168 -0
  20. package/dist/css/components/chart.css +296 -0
  21. package/dist/css/components/code-block.css +264 -0
  22. package/dist/css/components/color-area.css +82 -0
  23. package/dist/css/components/color-field.css +67 -0
  24. package/dist/css/components/color-picker.css +131 -0
  25. package/dist/css/components/color-slider.css +113 -0
  26. package/dist/css/components/command-search.css +252 -0
  27. package/dist/css/components/context-menu.css +23 -0
  28. package/dist/css/components/credit-card.css +288 -0
  29. package/dist/css/components/data-table.css +686 -0
  30. package/dist/css/components/date-range-picker.css +168 -0
  31. package/dist/css/components/date-time-picker.css +178 -0
  32. package/dist/css/components/drawer.css +58 -0
  33. package/dist/css/components/editable-table.css +201 -0
  34. package/dist/css/components/empty-state.css +61 -0
  35. package/dist/css/components/file-explorer.css +633 -0
  36. package/dist/css/components/filter-builder.css +227 -0
  37. package/dist/css/components/heatmap-chart.css +391 -0
  38. package/dist/css/components/hold-confirm.css +87 -0
  39. package/dist/css/components/hover-card.css +19 -7
  40. package/dist/css/components/image-preview.css +283 -0
  41. package/dist/css/components/json-viewer.css +304 -0
  42. package/dist/css/components/like-button.css +78 -0
  43. package/dist/css/components/link-preview.css +275 -0
  44. package/dist/css/components/loading-button.css +77 -0
  45. package/dist/css/components/multi-select.css +267 -0
  46. package/dist/css/components/nav.css +102 -102
  47. package/dist/css/components/notification-bell.css +127 -0
  48. package/dist/css/components/orbit-menu.css +130 -0
  49. package/dist/css/components/pagination.css +10 -5
  50. package/dist/css/components/password-strength.css +183 -0
  51. package/dist/css/components/pie-chart.css +390 -0
  52. package/dist/css/components/pill-button.css +135 -0
  53. package/dist/css/components/popover.css +25 -0
  54. package/dist/css/components/progress.css +140 -0
  55. package/dist/css/components/questionnaire.css +217 -0
  56. package/dist/css/components/radar-chart.css +370 -0
  57. package/dist/css/components/radial-chart.css +398 -0
  58. package/dist/css/components/range-calendar.css +186 -0
  59. package/dist/css/components/range-slider.css +192 -0
  60. package/dist/css/components/resizable-panel.css +243 -0
  61. package/dist/css/components/rich-text-editor.css +284 -0
  62. package/dist/css/components/sankey-chart.css +358 -0
  63. package/dist/css/components/scratch-card.css +75 -0
  64. package/dist/css/components/scroll-island.css +111 -0
  65. package/dist/css/components/select.css +136 -0
  66. package/dist/css/components/skeleton.css +108 -0
  67. package/dist/css/components/split-view.css +19 -0
  68. package/dist/css/components/star-rating.css +80 -0
  69. package/dist/css/components/stat-card.css +164 -0
  70. package/dist/css/components/swipe-actions.css +105 -0
  71. package/dist/css/components/tag-input.css +244 -0
  72. package/dist/css/components/time-field.css +88 -0
  73. package/dist/css/components/timeline.css +219 -0
  74. package/dist/css/components/toolbar.css +122 -0
  75. package/dist/css/components/tooltip.css +79 -0
  76. package/dist/css/components/tree-view.css +289 -0
  77. package/dist/css/components/virtual-list.css +195 -0
  78. package/dist/css/components/voice-dots.css +70 -0
  79. package/dist/css/tokens.css +185 -181
  80. package/dist/elements/index.d.ts +849 -7
  81. package/dist/elements/index.js +1642 -8
  82. package/dist/elements/index.js.map +1 -1
  83. package/dist/{engine-GDGwQnJE.d.ts → engine-5zRIssTO.d.ts} +11 -1
  84. package/dist/engine-QECQnGz1.d.ts +33 -0
  85. package/dist/index.css +10890 -311
  86. package/dist/index.d.ts +89 -5
  87. package/dist/index.js +273 -9
  88. package/dist/index.js.map +1 -1
  89. package/dist/react/index.d.ts +686 -24
  90. package/dist/react/index.js +2345 -9
  91. package/dist/react/index.js.map +1 -1
  92. package/dist/{reduced-BmBzKH94.d.ts → reduced-6X_bns60.d.ts} +9 -2
  93. package/dist/reveal-BfyKKsw4.d.ts +2474 -0
  94. package/dist/store-CA2Qcun_.d.ts +453 -0
  95. package/package.json +9 -16
  96. package/registry.json +1096 -543
  97. package/src/auto/auto-init.ts +104 -0
  98. package/src/components/activity-feed/README.md +56 -0
  99. package/src/components/activity-feed/activity-feed.css +239 -0
  100. package/src/components/activity-feed/element.ts +36 -0
  101. package/src/components/activity-feed/engine.ts +351 -0
  102. package/src/components/activity-feed/react.tsx +32 -0
  103. package/src/components/add-to-cart/README.md +34 -0
  104. package/src/components/add-to-cart/add-to-cart.css +71 -0
  105. package/src/components/add-to-cart/element.ts +20 -0
  106. package/src/components/add-to-cart/engine.ts +206 -0
  107. package/src/components/add-to-cart/react.tsx +29 -0
  108. package/src/components/attachment/README.md +27 -0
  109. package/src/components/attachment/attachment.css +265 -0
  110. package/src/components/attachment/element.ts +50 -0
  111. package/src/components/attachment/engine.ts +469 -0
  112. package/src/components/attachment/react.tsx +65 -0
  113. package/src/components/bidirectional-slider/README.md +46 -0
  114. package/src/components/bidirectional-slider/bidirectional-slider.css +167 -0
  115. package/src/components/bidirectional-slider/element.ts +42 -0
  116. package/src/components/bidirectional-slider/engine.ts +289 -0
  117. package/src/components/bidirectional-slider/react.tsx +45 -0
  118. package/src/components/breadcrumb/README.md +38 -0
  119. package/src/components/breadcrumb/breadcrumb.css +109 -0
  120. package/src/components/breadcrumb/element.ts +27 -0
  121. package/src/components/breadcrumb/engine.ts +249 -0
  122. package/src/components/breadcrumb/react.tsx +30 -0
  123. package/src/components/chart/README.md +34 -0
  124. package/src/components/chart/chart.css +295 -0
  125. package/src/components/chart/element.ts +43 -0
  126. package/src/components/chart/engine.ts +838 -0
  127. package/src/components/chart/parts.ts +237 -0
  128. package/src/components/chart/react.tsx +50 -0
  129. package/src/components/chart/use-chart.ts +55 -0
  130. package/src/components/chart-tooltip/README.md +53 -0
  131. package/src/components/chart-tooltip/chart-tooltip.css +167 -0
  132. package/src/components/chart-tooltip/element.ts +37 -0
  133. package/src/components/chart-tooltip/engine.ts +442 -0
  134. package/src/components/chart-tooltip/react.tsx +47 -0
  135. package/src/components/code-block/README.md +19 -0
  136. package/src/components/code-block/code-block.css +263 -0
  137. package/src/components/code-block/element.ts +34 -0
  138. package/src/components/code-block/engine.ts +254 -0
  139. package/src/components/code-block/highlight.ts +244 -0
  140. package/src/components/code-block/react.tsx +94 -0
  141. package/src/components/color-area/README.md +50 -0
  142. package/src/components/color-area/color-area.css +81 -0
  143. package/src/components/color-area/element.ts +26 -0
  144. package/src/components/color-area/engine.ts +246 -0
  145. package/src/components/color-area/react.tsx +42 -0
  146. package/src/components/color-field/README.md +43 -0
  147. package/src/components/color-field/color-field.css +66 -0
  148. package/src/components/color-field/element.ts +26 -0
  149. package/src/components/color-field/engine.ts +174 -0
  150. package/src/components/color-field/react.tsx +42 -0
  151. package/src/components/color-picker/README.md +45 -0
  152. package/src/components/color-picker/color-picker.css +130 -0
  153. package/src/components/color-picker/element.ts +45 -0
  154. package/src/components/color-picker/engine.ts +314 -0
  155. package/src/components/color-picker/react.tsx +47 -0
  156. package/src/components/color-slider/README.md +55 -0
  157. package/src/components/color-slider/color-slider.css +112 -0
  158. package/src/components/color-slider/element.ts +26 -0
  159. package/src/components/color-slider/engine.ts +234 -0
  160. package/src/components/color-slider/react.tsx +45 -0
  161. package/src/components/command-search/README.md +15 -0
  162. package/src/components/command-search/command-search.css +251 -0
  163. package/src/components/command-search/element.ts +36 -0
  164. package/src/components/command-search/engine.ts +356 -0
  165. package/src/components/command-search/match.ts +53 -0
  166. package/src/components/command-search/react.tsx +66 -0
  167. package/src/components/context-menu/README.md +31 -0
  168. package/src/components/context-menu/context-menu.css +22 -0
  169. package/src/components/context-menu/element.ts +40 -0
  170. package/src/components/context-menu/engine.ts +153 -0
  171. package/src/components/context-menu/react.tsx +57 -0
  172. package/src/components/credit-card/README.md +20 -0
  173. package/src/components/credit-card/card.ts +77 -0
  174. package/src/components/credit-card/credit-card.css +287 -0
  175. package/src/components/credit-card/element.ts +33 -0
  176. package/src/components/credit-card/engine.ts +410 -0
  177. package/src/components/credit-card/react.tsx +36 -0
  178. package/src/components/data-table/README.md +83 -0
  179. package/src/components/data-table/data-table.css +685 -0
  180. package/src/components/data-table/element.ts +54 -0
  181. package/src/components/data-table/engine.ts +1111 -0
  182. package/src/components/data-table/react.tsx +94 -0
  183. package/src/components/date-range-picker/README.md +51 -0
  184. package/src/components/date-range-picker/date-range-picker.css +167 -0
  185. package/src/components/date-range-picker/element.ts +52 -0
  186. package/src/components/date-range-picker/engine.ts +352 -0
  187. package/src/components/date-range-picker/react.tsx +57 -0
  188. package/src/components/date-time-picker/README.md +48 -0
  189. package/src/components/date-time-picker/date-time-picker.css +177 -0
  190. package/src/components/date-time-picker/element.ts +47 -0
  191. package/src/components/date-time-picker/engine.ts +350 -0
  192. package/src/components/date-time-picker/react.tsx +54 -0
  193. package/src/components/dialog/README.md +103 -102
  194. package/src/components/dialog/element.ts +123 -118
  195. package/src/components/dialog/engine.ts +449 -432
  196. package/src/components/drawer/README.md +28 -0
  197. package/src/components/drawer/drawer.css +57 -0
  198. package/src/components/drawer/element.ts +21 -0
  199. package/src/components/drawer/engine.ts +56 -0
  200. package/src/components/drawer/react.tsx +85 -0
  201. package/src/components/editable-table/README.md +67 -0
  202. package/src/components/editable-table/editable-table.css +200 -0
  203. package/src/components/editable-table/element.ts +45 -0
  204. package/src/components/editable-table/engine.ts +831 -0
  205. package/src/components/editable-table/react.tsx +79 -0
  206. package/src/components/empty-state/README.md +41 -0
  207. package/src/components/empty-state/element.ts +23 -0
  208. package/src/components/empty-state/empty-state.css +60 -0
  209. package/src/components/empty-state/engine.ts +232 -0
  210. package/src/components/empty-state/react.tsx +34 -0
  211. package/src/components/file-explorer/README.md +67 -0
  212. package/src/components/file-explorer/element.ts +39 -0
  213. package/src/components/file-explorer/engine.ts +1307 -0
  214. package/src/components/file-explorer/file-explorer.css +632 -0
  215. package/src/components/file-explorer/react.tsx +77 -0
  216. package/src/components/filter-builder/README.md +47 -0
  217. package/src/components/filter-builder/element.ts +34 -0
  218. package/src/components/filter-builder/engine.ts +396 -0
  219. package/src/components/filter-builder/filter-builder.css +226 -0
  220. package/src/components/filter-builder/react.tsx +36 -0
  221. package/src/components/heatmap-chart/README.md +48 -0
  222. package/src/components/heatmap-chart/element.ts +21 -0
  223. package/src/components/heatmap-chart/engine.ts +281 -0
  224. package/src/components/heatmap-chart/heatmap-chart.css +93 -0
  225. package/src/components/heatmap-chart/react.tsx +14 -0
  226. package/src/components/hold-confirm/README.md +13 -0
  227. package/src/components/hold-confirm/element.ts +24 -0
  228. package/src/components/hold-confirm/engine.ts +216 -0
  229. package/src/components/hold-confirm/hold-confirm.css +86 -0
  230. package/src/components/hold-confirm/react.tsx +28 -0
  231. package/src/components/hover-card/README.md +6 -2
  232. package/src/components/hover-card/engine.ts +98 -7
  233. package/src/components/hover-card/hover-card.css +19 -7
  234. package/src/components/image-preview/README.md +16 -0
  235. package/src/components/image-preview/element.ts +26 -0
  236. package/src/components/image-preview/engine.ts +405 -0
  237. package/src/components/image-preview/image-preview.css +282 -0
  238. package/src/components/image-preview/react.tsx +43 -0
  239. package/src/components/json-viewer/README.md +56 -0
  240. package/src/components/json-viewer/element.ts +37 -0
  241. package/src/components/json-viewer/engine.ts +449 -0
  242. package/src/components/json-viewer/json-viewer.css +303 -0
  243. package/src/components/json-viewer/react.tsx +56 -0
  244. package/src/components/like-button/README.md +13 -0
  245. package/src/components/like-button/element.ts +47 -0
  246. package/src/components/like-button/engine.ts +145 -0
  247. package/src/components/like-button/like-button.css +77 -0
  248. package/src/components/like-button/react.tsx +39 -0
  249. package/src/components/link-preview/README.md +19 -0
  250. package/src/components/link-preview/element.ts +29 -0
  251. package/src/components/link-preview/engine.ts +192 -0
  252. package/src/components/link-preview/link-preview.css +274 -0
  253. package/src/components/link-preview/react.tsx +101 -0
  254. package/src/components/loading-button/README.md +45 -0
  255. package/src/components/loading-button/element.ts +34 -0
  256. package/src/components/loading-button/engine.ts +201 -0
  257. package/src/components/loading-button/loading-button.css +76 -0
  258. package/src/components/loading-button/react.tsx +43 -0
  259. package/src/components/multi-select/README.md +48 -0
  260. package/src/components/multi-select/element.ts +28 -0
  261. package/src/components/multi-select/engine.ts +294 -0
  262. package/src/components/multi-select/multi-select.css +266 -0
  263. package/src/components/multi-select/react.tsx +39 -0
  264. package/src/components/nav/README.md +12 -10
  265. package/src/components/nav/element.ts +5 -5
  266. package/src/components/nav/engine.ts +21 -14
  267. package/src/components/nav/nav.css +102 -102
  268. package/src/components/nav/react.tsx +4 -4
  269. package/src/components/notification-bell/README.md +14 -0
  270. package/src/components/notification-bell/element.ts +48 -0
  271. package/src/components/notification-bell/engine.ts +202 -0
  272. package/src/components/notification-bell/notification-bell.css +126 -0
  273. package/src/components/notification-bell/react.tsx +57 -0
  274. package/src/components/orbit-menu/README.md +46 -0
  275. package/src/components/orbit-menu/element.ts +27 -0
  276. package/src/components/orbit-menu/engine.ts +179 -0
  277. package/src/components/orbit-menu/orbit-menu.css +129 -0
  278. package/src/components/orbit-menu/react.tsx +44 -0
  279. package/src/components/pagination/README.md +1 -1
  280. package/src/components/pagination/engine.ts +50 -4
  281. package/src/components/pagination/pagination.css +10 -5
  282. package/src/components/password-strength/README.md +17 -0
  283. package/src/components/password-strength/element.ts +22 -0
  284. package/src/components/password-strength/engine.ts +212 -0
  285. package/src/components/password-strength/password-strength.css +182 -0
  286. package/src/components/password-strength/react.tsx +36 -0
  287. package/src/components/password-strength/score.ts +62 -0
  288. package/src/components/pie-chart/README.md +48 -0
  289. package/src/components/pie-chart/element.ts +30 -0
  290. package/src/components/pie-chart/engine.ts +283 -0
  291. package/src/components/pie-chart/pie-chart.css +92 -0
  292. package/src/components/pie-chart/react.tsx +14 -0
  293. package/src/components/pill-button/README.md +46 -0
  294. package/src/components/pill-button/element.ts +16 -0
  295. package/src/components/pill-button/engine.ts +77 -0
  296. package/src/components/pill-button/pill-button.css +134 -0
  297. package/src/components/pill-button/react.tsx +32 -0
  298. package/src/components/popover/README.md +44 -0
  299. package/src/components/popover/element.ts +31 -0
  300. package/src/components/popover/engine.ts +114 -0
  301. package/src/components/popover/popover.css +24 -0
  302. package/src/components/popover/react.tsx +50 -0
  303. package/src/components/progress/README.md +17 -0
  304. package/src/components/progress/element.ts +30 -0
  305. package/src/components/progress/engine.ts +173 -0
  306. package/src/components/progress/progress.css +139 -0
  307. package/src/components/progress/react.tsx +35 -0
  308. package/src/components/questionnaire/README.md +32 -0
  309. package/src/components/questionnaire/element.ts +118 -0
  310. package/src/components/questionnaire/engine.ts +255 -0
  311. package/src/components/questionnaire/questionnaire.css +216 -0
  312. package/src/components/questionnaire/react.tsx +140 -0
  313. package/src/components/radar-chart/README.md +48 -0
  314. package/src/components/radar-chart/element.ts +30 -0
  315. package/src/components/radar-chart/engine.ts +327 -0
  316. package/src/components/radar-chart/radar-chart.css +72 -0
  317. package/src/components/radar-chart/react.tsx +14 -0
  318. package/src/components/radial-chart/README.md +48 -0
  319. package/src/components/radial-chart/element.ts +30 -0
  320. package/src/components/radial-chart/engine.ts +290 -0
  321. package/src/components/radial-chart/radial-chart.css +100 -0
  322. package/src/components/radial-chart/react.tsx +14 -0
  323. package/src/components/range-calendar/README.md +58 -0
  324. package/src/components/range-calendar/element.ts +42 -0
  325. package/src/components/range-calendar/engine.ts +390 -0
  326. package/src/components/range-calendar/range-calendar.css +185 -0
  327. package/src/components/range-calendar/react.tsx +56 -0
  328. package/src/components/range-slider/README.md +23 -0
  329. package/src/components/range-slider/element.ts +53 -0
  330. package/src/components/range-slider/engine.ts +316 -0
  331. package/src/components/range-slider/range-slider.css +191 -0
  332. package/src/components/range-slider/react.tsx +66 -0
  333. package/src/components/resizable-panel/README.md +61 -0
  334. package/src/components/resizable-panel/element.ts +36 -0
  335. package/src/components/resizable-panel/engine.ts +551 -0
  336. package/src/components/resizable-panel/react.tsx +74 -0
  337. package/src/components/resizable-panel/resizable-panel.css +242 -0
  338. package/src/components/rich-text-editor/README.md +57 -0
  339. package/src/components/rich-text-editor/element.ts +34 -0
  340. package/src/components/rich-text-editor/engine.ts +673 -0
  341. package/src/components/rich-text-editor/react.tsx +60 -0
  342. package/src/components/rich-text-editor/rich-text-editor.css +283 -0
  343. package/src/components/sankey-chart/README.md +48 -0
  344. package/src/components/sankey-chart/element.ts +31 -0
  345. package/src/components/sankey-chart/engine.ts +401 -0
  346. package/src/components/sankey-chart/react.tsx +14 -0
  347. package/src/components/sankey-chart/sankey-chart.css +60 -0
  348. package/src/components/scratch-card/README.md +15 -0
  349. package/src/components/scratch-card/element.ts +30 -0
  350. package/src/components/scratch-card/engine.ts +257 -0
  351. package/src/components/scratch-card/react.tsx +40 -0
  352. package/src/components/scratch-card/scratch-card.css +74 -0
  353. package/src/components/scroll-island/README.md +34 -0
  354. package/src/components/scroll-island/element.ts +16 -0
  355. package/src/components/scroll-island/engine.ts +252 -0
  356. package/src/components/scroll-island/react.tsx +26 -0
  357. package/src/components/scroll-island/scroll-island.css +110 -0
  358. package/src/components/select/README.md +34 -0
  359. package/src/components/select/element.ts +26 -0
  360. package/src/components/select/engine.ts +267 -0
  361. package/src/components/select/react.tsx +33 -0
  362. package/src/components/select/select.css +135 -0
  363. package/src/components/skeleton/README.md +15 -0
  364. package/src/components/skeleton/element.ts +32 -0
  365. package/src/components/skeleton/engine.ts +104 -0
  366. package/src/components/skeleton/react.tsx +41 -0
  367. package/src/components/skeleton/skeleton.css +107 -0
  368. package/src/components/split-view/README.md +50 -0
  369. package/src/components/split-view/element.ts +34 -0
  370. package/src/components/split-view/engine.ts +114 -0
  371. package/src/components/split-view/react.tsx +63 -0
  372. package/src/components/split-view/split-view.css +18 -0
  373. package/src/components/star-rating/README.md +14 -0
  374. package/src/components/star-rating/element.ts +26 -0
  375. package/src/components/star-rating/engine.ts +217 -0
  376. package/src/components/star-rating/react.tsx +33 -0
  377. package/src/components/star-rating/star-rating.css +79 -0
  378. package/src/components/stat-card/README.md +42 -0
  379. package/src/components/stat-card/element.ts +40 -0
  380. package/src/components/stat-card/engine.ts +283 -0
  381. package/src/components/stat-card/react.tsx +36 -0
  382. package/src/components/stat-card/stat-card.css +163 -0
  383. package/src/components/swipe-actions/README.md +19 -0
  384. package/src/components/swipe-actions/element.ts +26 -0
  385. package/src/components/swipe-actions/engine.ts +260 -0
  386. package/src/components/swipe-actions/react.tsx +80 -0
  387. package/src/components/swipe-actions/swipe-actions.css +104 -0
  388. package/src/components/tag-input/README.md +42 -0
  389. package/src/components/tag-input/element.ts +39 -0
  390. package/src/components/tag-input/engine.ts +313 -0
  391. package/src/components/tag-input/react.tsx +54 -0
  392. package/src/components/tag-input/tag-input.css +243 -0
  393. package/src/components/time-field/README.md +54 -0
  394. package/src/components/time-field/element.ts +38 -0
  395. package/src/components/time-field/engine.ts +110 -0
  396. package/src/components/time-field/react.tsx +45 -0
  397. package/src/components/time-field/time-field.css +87 -0
  398. package/src/components/timeline/README.md +57 -0
  399. package/src/components/timeline/element.ts +31 -0
  400. package/src/components/timeline/engine.ts +300 -0
  401. package/src/components/timeline/react.tsx +59 -0
  402. package/src/components/timeline/timeline.css +218 -0
  403. package/src/components/toolbar/README.md +46 -0
  404. package/src/components/toolbar/element.ts +30 -0
  405. package/src/components/toolbar/engine.ts +230 -0
  406. package/src/components/toolbar/react.tsx +34 -0
  407. package/src/components/toolbar/toolbar.css +121 -0
  408. package/src/components/tooltip/README.md +46 -0
  409. package/src/components/tooltip/element.ts +22 -0
  410. package/src/components/tooltip/engine.ts +288 -0
  411. package/src/components/tooltip/react.tsx +30 -0
  412. package/src/components/tooltip/tooltip.css +78 -0
  413. package/src/components/tree-view/README.md +61 -0
  414. package/src/components/tree-view/element.ts +32 -0
  415. package/src/components/tree-view/engine.ts +743 -0
  416. package/src/components/tree-view/react.tsx +82 -0
  417. package/src/components/tree-view/tree-view.css +288 -0
  418. package/src/components/virtual-list/README.md +81 -0
  419. package/src/components/virtual-list/element.ts +42 -0
  420. package/src/components/virtual-list/engine.ts +678 -0
  421. package/src/components/virtual-list/react.tsx +101 -0
  422. package/src/components/virtual-list/virtual-list.css +194 -0
  423. package/src/components/voice-dots/README.md +48 -0
  424. package/src/components/voice-dots/element.ts +45 -0
  425. package/src/components/voice-dots/engine.ts +243 -0
  426. package/src/components/voice-dots/react.tsx +52 -0
  427. package/src/components/voice-dots/voice-dots.css +69 -0
  428. package/src/core/chips.ts +196 -0
  429. package/src/core/color.ts +304 -0
  430. package/src/core/date-range.ts +67 -0
  431. package/src/core/dates.ts +11 -1
  432. package/src/core/files.ts +107 -0
  433. package/src/core/filter.ts +229 -0
  434. package/src/core/gsap.ts +80 -65
  435. package/src/core/listbox.ts +332 -0
  436. package/src/core/mark.ts +29 -0
  437. package/src/core/position.ts +89 -0
  438. package/src/core/relative-time.ts +77 -0
  439. package/src/core/segment-field.ts +373 -0
  440. package/src/core/segments.ts +153 -0
  441. package/src/core/tree.ts +116 -0
  442. package/src/core/virtual.ts +79 -0
  443. package/src/css/tokens.css +186 -182
  444. package/src/elements/index.ts +186 -0
  445. package/src/index.ts +88 -0
  446. package/src/motion/liquid.ts +14 -4
  447. package/src/motion/micro.ts +248 -0
  448. package/src/motion/sheet.ts +88 -65
  449. package/src/motion/surface.ts +9 -0
  450. package/src/react/index.ts +71 -1
  451. package/dist/chunk-IKQ5FODN.js +0 -1617
  452. package/dist/chunk-IKQ5FODN.js.map +0 -1
  453. package/dist/chunk-J6OCFNGU.js +0 -177
  454. package/dist/chunk-J6OCFNGU.js.map +0 -1
  455. package/dist/chunk-TFNRIZHU.js +0 -3977
  456. package/dist/chunk-TFNRIZHU.js.map +0 -1
  457. package/dist/chunk-XAKC2QY7.js.map +0 -1
  458. package/dist/reveal-jsX-uwUz.d.ts +0 -625
  459. package/dist/store-DYb3tTsZ.d.ts +0 -195
@@ -2,9 +2,8 @@
2
2
  import {
3
3
  ANIMATIONS,
4
4
  animate,
5
- confetti,
6
5
  leave
7
- } from "../chunk-J6OCFNGU.js";
6
+ } from "../chunk-QP4QJOEN.js";
8
7
  import {
9
8
  captureLayout,
10
9
  createActionButton,
@@ -56,38 +55,117 @@ import {
56
55
  pileLayers,
57
56
  pileStyle,
58
57
  reflowLayout
59
- } from "../chunk-XAKC2QY7.js";
58
+ } from "../chunk-6IRJYXJU.js";
60
59
  import {
61
60
  ICON_PATHS,
62
61
  NAV_STYLES,
62
+ NAV_STYLE_ALIASES,
63
63
  PENDING_ID,
64
+ PILL_ARROW,
64
65
  capturePending,
65
66
  clearToasts,
67
+ createBidirectionalSlider,
66
68
  createChat,
67
- createChatBackground,
68
69
  createCursor,
70
+ createHeatmapChart,
69
71
  createIsland,
70
- createSteps,
72
+ createOrbitMenu,
73
+ createPieChart,
74
+ createPillButton,
75
+ createRadarChart,
76
+ createRadialChart,
77
+ createSankeyChart,
71
78
  createThemePicker,
72
79
  createToaster,
80
+ createToolbar,
81
+ createVoiceDots,
73
82
  dismissToast,
74
83
  morphPendingToReply,
75
84
  revealShell,
85
+ toNavStyle,
76
86
  toast
77
- } from "../chunk-IKQ5FODN.js";
87
+ } from "../chunk-JXRS3OEA.js";
78
88
  import {
89
+ confetti,
90
+ createActivityFeed,
91
+ createAddToCart,
92
+ createAttachment,
93
+ createBreadcrumb,
79
94
  createCalendar,
95
+ createChart,
96
+ createChartTooltip,
97
+ createChatBackground,
98
+ createCodeBlock,
99
+ createColorArea,
100
+ createColorField,
101
+ createColorPicker,
102
+ createColorSlider,
103
+ createCommandSearch,
104
+ createContextMenu,
105
+ createCreditCard,
106
+ createDataTable,
107
+ createDateRangePicker,
108
+ createDateTimePicker,
80
109
  createDialog,
110
+ createDrawer,
111
+ createEditableTable,
112
+ createEmptyState,
113
+ createFileExplorer,
114
+ createFilterBuilder,
115
+ createHoldConfirm,
81
116
  createHoverCard,
117
+ createImagePreview,
82
118
  createInputOtp,
119
+ createJsonViewer,
120
+ createLikeButton,
121
+ createLoadingButton,
83
122
  createMenu,
123
+ createMultiSelect,
124
+ createNotificationBell,
84
125
  createPagination,
126
+ createPasswordStrength,
127
+ createPopover,
128
+ createProgress,
85
129
  createQuantity,
130
+ createQuestionnaire,
131
+ createRangeCalendar,
132
+ createRangeSlider,
133
+ createResizablePanel,
134
+ createRichTextEditor,
135
+ createScratchCard,
136
+ createScrollIsland,
137
+ createSelect,
138
+ createSkeleton,
86
139
  createSlotPicker,
140
+ createSplitView,
141
+ createStarRating,
142
+ createStatCard,
143
+ createSteps,
87
144
  createStudioDock,
145
+ createSwipeActions,
146
+ createTagInput,
147
+ createTimeField,
148
+ createTimeline,
149
+ createTooltip,
88
150
  createTrailer,
151
+ createTreeView,
152
+ createVirtualList,
153
+ dateTimeKey,
154
+ flowLines,
155
+ languageFamily,
156
+ linkDomain,
157
+ rangeKeys,
158
+ safeHref,
159
+ safeImage,
160
+ skeletonBones,
161
+ toDateTimeValue,
162
+ toHex,
163
+ toHsva,
164
+ toRange,
165
+ tokenLines,
166
+ tokenize,
89
167
  tweenNumber
90
- } from "../chunk-TFNRIZHU.js";
168
+ } from "../chunk-A6QQCF6V.js";
91
169
  import {
92
170
  DEFAULT_THEME,
93
171
  MK_THEME_HEAD_SCRIPT,
@@ -725,7 +803,7 @@ function Nav({
725
803
  items,
726
804
  active,
727
805
  onSelect,
728
- navStyle = "bonita",
806
+ navStyle = "pills",
729
807
  accent = false,
730
808
  reveal = false,
731
809
  first,
@@ -739,7 +817,7 @@ function Nav({
739
817
  const handle = revealShell(ref.current);
740
818
  return () => handle?.cancel();
741
819
  }, []);
742
- const classes = ["mk-nav", `mk-nav--${navStyle}`, accent && "mk-nav--accent", className].filter(Boolean).join(" ");
820
+ const classes = ["mk-nav", `mk-nav--${toNavStyle(navStyle) ?? "pills"}`, accent && "mk-nav--accent", className].filter(Boolean).join(" ");
743
821
  return /* @__PURE__ */ jsxs3("nav", { ref, "aria-label": "Principal", ...props, className: classes, children: [
744
822
  first,
745
823
  /* @__PURE__ */ jsx11("div", { className: "mk-nav__buttons", children: items.map((item) => {
@@ -1214,36 +1292,2292 @@ var useScrollDock = (ref, options, deps) => useRecipe(ref, createScrollDock, opt
1214
1292
 
1215
1293
  // src/react/use-local-clock.ts
1216
1294
  var useLocalClock = (ref, options, deps) => useRecipe(ref, createLocalClock, options, deps);
1295
+
1296
+ // src/components/attachment/react.tsx
1297
+ import { useRef as useRef22 } from "react";
1298
+ import { jsx as jsx24 } from "react/jsx-runtime";
1299
+ function Attachment({ accept, multiple, maxFiles, maxSize, disabled, name, initialFiles, hint, labels, onFiles, onRemove, onReject, uploads, instanceRef, className, ...props }) {
1300
+ const ref = useRef22(null);
1301
+ const instance = useRef22(null);
1302
+ const kept = useRef22(void 0);
1303
+ const files = useLatest(onFiles);
1304
+ const removed = useLatest(onRemove);
1305
+ const rejected = useLatest(onReject);
1306
+ const latestUploads = useLatest(uploads);
1307
+ const seed = useLatest(initialFiles);
1308
+ const labelKey = JSON.stringify(labels ?? {});
1309
+ useIsomorphicLayoutEffect(() => {
1310
+ const created = createAttachment(ref.current, {
1311
+ accept,
1312
+ multiple,
1313
+ maxFiles,
1314
+ maxSize,
1315
+ disabled,
1316
+ name,
1317
+ hint,
1318
+ labels,
1319
+ initialFiles: kept.current ?? seed.current,
1320
+ onFiles: (added, all) => files.current?.(added, all),
1321
+ onRemove: (file, all) => removed.current?.(file, all),
1322
+ onReject: (list) => rejected.current?.(list)
1323
+ });
1324
+ for (const [id, upload] of Object.entries(latestUploads.current ?? {})) created.setProgress(id, upload.progress, upload.status);
1325
+ instance.current = created;
1326
+ if (instanceRef) instanceRef.current = created;
1327
+ return () => {
1328
+ kept.current = created.files;
1329
+ created.destroy();
1330
+ instance.current = null;
1331
+ if (instanceRef) instanceRef.current = null;
1332
+ };
1333
+ }, [accept, multiple, maxFiles, maxSize, disabled, name, hint, labelKey]);
1334
+ const uploadKey = JSON.stringify(uploads ?? {});
1335
+ useIsomorphicLayoutEffect(() => {
1336
+ for (const [id, upload] of Object.entries(uploads ?? {})) instance.current?.setProgress(id, upload.progress, upload.status);
1337
+ }, [uploadKey]);
1338
+ return /* @__PURE__ */ jsx24("div", { ...props, ref, className: ["mk-attachment", className].filter(Boolean).join(" ") });
1339
+ }
1340
+
1341
+ // src/components/skeleton/react.tsx
1342
+ import { useRef as useRef23 } from "react";
1343
+ import { jsx as jsx25, jsxs as jsxs12 } from "react/jsx-runtime";
1344
+ function Skeleton({ loading = true, animation, shape = "text", lines, label, placeholder, children, className, ...props }) {
1345
+ const ref = useRef23(null);
1346
+ const instance = useRef23(null);
1347
+ const current = useRef23(loading);
1348
+ current.current = loading;
1349
+ useIsomorphicLayoutEffect(() => {
1350
+ const created = createSkeleton(ref.current, { loading: current.current, animation, shape, lines, label });
1351
+ instance.current = created;
1352
+ return () => {
1353
+ created.destroy();
1354
+ instance.current = null;
1355
+ };
1356
+ }, [animation, shape, lines, label]);
1357
+ useIsomorphicLayoutEffect(() => {
1358
+ instance.current?.setLoading(loading);
1359
+ }, [loading]);
1360
+ return /* @__PURE__ */ jsxs12("div", { ...props, ref, className: ["mk-skeleton", className].filter(Boolean).join(" "), "data-mk-ssr-loading": loading ? "" : void 0, children: [
1361
+ /* @__PURE__ */ jsx25("div", { "data-mk-skeleton-placeholder": "", "data-mk-shape": shape, children: placeholder ?? skeletonBones(shape, lines).map((bone, i) => /* @__PURE__ */ jsx25("span", { "data-mk-bone": bone }, i)) }),
1362
+ /* @__PURE__ */ jsx25("div", { "data-mk-skeleton-content": "", children })
1363
+ ] });
1364
+ }
1365
+
1366
+ // src/components/questionnaire/react.tsx
1367
+ import { useRef as useRef24, useState as useState5 } from "react";
1368
+ import { jsx as jsx26, jsxs as jsxs13 } from "react/jsx-runtime";
1369
+ var optionOf = (option) => typeof option === "string" ? { value: option, label: option } : option;
1370
+ function Questionnaire({ questions, defaultAnswers = {}, labels = {}, onChange, onComplete, complete, instanceRef, className, ...props }) {
1371
+ const ref = useRef24(null);
1372
+ const [answers, setAnswers] = useState5(null);
1373
+ const change = useLatest(onChange);
1374
+ const completed = useLatest(onComplete);
1375
+ const key = JSON.stringify(questions.map(({ id, type, required: required2, options }) => [id, type, required2, options]));
1376
+ const { required, choice } = labels;
1377
+ useIsomorphicLayoutEffect(() => {
1378
+ const created = createQuestionnaire(ref.current, {
1379
+ labels: { required, choice },
1380
+ onChange: (index, current) => change.current?.(index, current),
1381
+ onComplete: (current) => {
1382
+ setAnswers(current);
1383
+ completed.current?.(current);
1384
+ }
1385
+ });
1386
+ if (instanceRef) instanceRef.current = created;
1387
+ return () => {
1388
+ created.destroy();
1389
+ if (instanceRef) instanceRef.current = null;
1390
+ };
1391
+ }, [key, required, choice]);
1392
+ const count = questions.length;
1393
+ const defaults = (id) => defaultAnswers[id];
1394
+ return /* @__PURE__ */ jsxs13("form", { ...props, ref, noValidate: true, className: ["mk-questionnaire", className].filter(Boolean).join(" "), onReset: () => setAnswers(null), children: [
1395
+ /* @__PURE__ */ jsx26("div", { "data-mk-question-progress": "", "aria-hidden": "true", children: /* @__PURE__ */ jsx26("span", { "data-mk-question-bar": "" }) }),
1396
+ questions.map((question, i) => {
1397
+ const titleId = `${question.id}-title`;
1398
+ const describedBy = question.description ? `${question.id}-description` : void 0;
1399
+ const value = defaults(question.id);
1400
+ return /* @__PURE__ */ jsxs13("section", { "data-mk-question": "", "data-mk-step": "", hidden: i !== 0, "aria-labelledby": titleId, children: [
1401
+ /* @__PURE__ */ jsx26("p", { "data-mk-question-step": "", children: labels.step ? labels.step(i, count) : `Pregunta ${i + 1} de ${count}` }),
1402
+ /* @__PURE__ */ jsxs13("h3", { id: titleId, "data-mk-step-title": "", "data-mk-flow-item": "", children: [
1403
+ question.label,
1404
+ question.required ? /* @__PURE__ */ jsx26("span", { "data-mk-question-required": "", "aria-hidden": "true", children: " *" }) : null
1405
+ ] }),
1406
+ question.description && /* @__PURE__ */ jsx26("p", { id: describedBy, "data-mk-question-description": "", "data-mk-flow-item": "", children: question.description }),
1407
+ /* @__PURE__ */ jsxs13("div", { "data-mk-question-field": "", "data-mk-flow-item": "", children: [
1408
+ question.type === "text" && /* @__PURE__ */ jsx26("input", { name: question.id, type: "text", required: question.required, "aria-labelledby": titleId, "aria-describedby": describedBy, placeholder: question.placeholder, defaultValue: typeof value === "string" ? value : "" }),
1409
+ question.type === "textarea" && /* @__PURE__ */ jsx26("textarea", { name: question.id, rows: 4, required: question.required, "aria-labelledby": titleId, "aria-describedby": describedBy, placeholder: question.placeholder, defaultValue: typeof value === "string" ? value : "" }),
1410
+ (question.type === "single" || question.type === "multiple") && /* @__PURE__ */ jsx26("div", { role: question.type === "single" ? "radiogroup" : "group", "aria-labelledby": titleId, "aria-describedby": describedBy, "data-mk-question-options": "", children: (question.options ?? []).map(optionOf).map((option) => /* @__PURE__ */ jsxs13("label", { "data-mk-question-option": "", children: [
1411
+ /* @__PURE__ */ jsx26(
1412
+ "input",
1413
+ {
1414
+ type: question.type === "single" ? "radio" : "checkbox",
1415
+ name: question.id,
1416
+ value: option.value,
1417
+ required: question.required,
1418
+ defaultChecked: Array.isArray(value) ? value.includes(option.value) : value === option.value
1419
+ }
1420
+ ),
1421
+ /* @__PURE__ */ jsx26("span", { children: option.label })
1422
+ ] }, option.value)) })
1423
+ ] }),
1424
+ /* @__PURE__ */ jsxs13("div", { "data-mk-question-actions": "", "data-mk-flow-item": "", children: [
1425
+ i > 0 && /* @__PURE__ */ jsx26("button", { type: "button", className: "mk-button mk-button--text", "data-mk-question-prev": "", children: labels.prev ?? "Anterior" }),
1426
+ i < count - 1 ? /* @__PURE__ */ jsx26("button", { type: "button", className: "mk-button", "data-mk-question-next": "", children: labels.next ?? "Siguiente" }) : /* @__PURE__ */ jsx26("button", { type: "submit", className: "mk-button", children: labels.finish ?? "Finalizar" })
1427
+ ] })
1428
+ ] }, question.id);
1429
+ }),
1430
+ /* @__PURE__ */ jsx26("p", { "data-mk-question-error": "", role: "alert" }),
1431
+ /* @__PURE__ */ jsxs13("div", { "data-mk-question-complete": "", hidden: true, children: [
1432
+ answers && (typeof complete === "function" ? complete(answers) : complete),
1433
+ /* @__PURE__ */ jsx26("button", { type: "reset", className: "mk-button mk-button--tonal", children: labels.restart ?? "Empezar de nuevo" })
1434
+ ] })
1435
+ ] });
1436
+ }
1437
+
1438
+ // src/components/code-block/react.tsx
1439
+ import { Fragment as Fragment3, useMemo as useMemo3, useRef as useRef25 } from "react";
1440
+ import { jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
1441
+ function CodeBlock({ code, language, title, lineNumbers, highlight, highlightLines, copyLabel = "Copiar", copiedLabel, errorLabel, onCopy, className, ...props }) {
1442
+ const ref = useRef25(null);
1443
+ const instance = useRef25(null);
1444
+ const copied = useLatest(onCopy);
1445
+ const latest = useLatest(code);
1446
+ useIsomorphicLayoutEffect(() => {
1447
+ const created = createCodeBlock(ref.current, { copyLabel, copiedLabel, errorLabel, onCopy: (ok) => copied.current?.(ok) });
1448
+ created.setCode(latest.current);
1449
+ instance.current = created;
1450
+ return () => {
1451
+ created.destroy();
1452
+ instance.current = null;
1453
+ };
1454
+ }, [copyLabel, copiedLabel, errorLabel]);
1455
+ useIsomorphicLayoutEffect(() => {
1456
+ instance.current?.setCode(code);
1457
+ }, [code]);
1458
+ const first = useRef25(true);
1459
+ useIsomorphicLayoutEffect(() => {
1460
+ if (first.current) {
1461
+ first.current = false;
1462
+ return;
1463
+ }
1464
+ const animation = flowLines(ref.current?.querySelector("code") ?? null);
1465
+ return () => {
1466
+ animation?.progress(1).kill();
1467
+ };
1468
+ }, [code, language]);
1469
+ const colour = highlight ?? languageFamily(language) !== "plain";
1470
+ const lines = useMemo3(() => tokenLines(tokenize(code, colour ? language : void 0)), [code, language, colour]);
1471
+ const trailing = lines.length > 1 && !lines[lines.length - 1].length;
1472
+ const shown = trailing ? lines.slice(0, -1) : lines;
1473
+ const marked = new Set(highlightLines ?? []);
1474
+ return /* @__PURE__ */ jsxs14("div", { ...props, ref, className: ["mk-code-block", className].filter(Boolean).join(" "), "data-mk-language": language, "data-mk-line-numbers": lineNumbers ? "" : void 0, children: [
1475
+ /* @__PURE__ */ jsxs14("div", { "data-mk-code-header": "", children: [
1476
+ /* @__PURE__ */ jsxs14("span", { "data-mk-code-dots": "", "aria-hidden": "true", children: [
1477
+ /* @__PURE__ */ jsx27("i", {}),
1478
+ /* @__PURE__ */ jsx27("i", {}),
1479
+ /* @__PURE__ */ jsx27("i", {})
1480
+ ] }),
1481
+ /* @__PURE__ */ jsx27("span", { "data-mk-code-title": "", children: title }),
1482
+ language && /* @__PURE__ */ jsx27("span", { "data-mk-code-language": "", children: language }),
1483
+ /* @__PURE__ */ jsxs14("button", { type: "button", "data-mk-code-copy": "", children: [
1484
+ /* @__PURE__ */ jsxs14("svg", { "aria-hidden": "true", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: [
1485
+ /* @__PURE__ */ jsx27("rect", { x: "9", y: "9", width: "11", height: "11", rx: "2.5" }),
1486
+ /* @__PURE__ */ jsx27("path", { d: "M5 15V6a2 2 0 0 1 2-2h8" })
1487
+ ] }),
1488
+ /* @__PURE__ */ jsx27("span", { "data-mk-code-copy-text": "", children: copyLabel })
1489
+ ] })
1490
+ ] }),
1491
+ /* @__PURE__ */ jsx27("pre", { tabIndex: 0, children: /* @__PURE__ */ jsxs14("code", { children: [
1492
+ shown.map((line, i) => /* @__PURE__ */ jsxs14(Fragment3, { children: [
1493
+ i ? "\n" : null,
1494
+ /* @__PURE__ */ jsx27("span", { "data-mk-code-line": "", "data-mk-highlight": marked.has(i + 1) ? "" : void 0, children: line.map(
1495
+ (token, k) => token.type === "plain" ? /* @__PURE__ */ jsx27(Fragment3, { children: token.text }, k) : /* @__PURE__ */ jsx27("span", { "data-mk-token": token.type, children: token.text }, k)
1496
+ ) })
1497
+ ] }, i)),
1498
+ trailing ? "\n" : null
1499
+ ] }) }),
1500
+ /* @__PURE__ */ jsx27("span", { "data-mk-code-status": "", className: "mk-sr-only", role: "status" })
1501
+ ] });
1502
+ }
1503
+
1504
+ // src/components/context-menu/react.tsx
1505
+ import { useRef as useRef26 } from "react";
1506
+ import { jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
1507
+ function Root5({ menu, label = "Acciones", onSelect, onOpenChange, closeOnSelect = true, overrideEditable, longPress, variant, instanceRef, className, children, ...props }) {
1508
+ const ref = useRef26(null);
1509
+ const select = useLatest(onSelect);
1510
+ const change = useLatest(onOpenChange);
1511
+ useIsomorphicLayoutEffect(() => {
1512
+ const created = createContextMenu(ref.current, {
1513
+ closeOnSelect,
1514
+ overrideEditable,
1515
+ longPress,
1516
+ variant,
1517
+ onSelect: (value, item) => select.current?.(value, item),
1518
+ onOpenChange: (open) => change.current?.(open)
1519
+ });
1520
+ if (instanceRef) instanceRef.current = created;
1521
+ return () => {
1522
+ created.destroy();
1523
+ if (instanceRef) instanceRef.current = null;
1524
+ };
1525
+ }, [closeOnSelect, overrideEditable, longPress, variant]);
1526
+ return /* @__PURE__ */ jsxs15("div", { ...props, ref, className: ["mk-context-menu", className].filter(Boolean).join(" "), "data-mk-context-trigger": "", children: [
1527
+ children,
1528
+ /* @__PURE__ */ jsx28("dialog", { "data-mk-context-menu": "", className: "mk-dialog mk-menu", "aria-label": label, children: menu })
1529
+ ] });
1530
+ }
1531
+ var ContextMenu = Object.assign(Root5, { Item: Menu.Item, Separator: Menu.Separator });
1532
+
1533
+ // src/components/drawer/react.tsx
1534
+ import { createContext as createContext6, useContext as useContext6, useMemo as useMemo4 } from "react";
1535
+ import { jsx as jsx29 } from "react/jsx-runtime";
1536
+ var DrawerContext = createContext6(null);
1537
+ function useDrawerContext(part) {
1538
+ const value = useContext6(DrawerContext);
1539
+ if (!value) throw new Error(`<Drawer.${part}> must be inside <Drawer.Root>`);
1540
+ return value;
1541
+ }
1542
+ function Root6({ side = "right", children, ...props }) {
1543
+ const surface = useSurfaceRoot(props);
1544
+ return /* @__PURE__ */ jsx29(DrawerContext.Provider, { value: { ...surface, side }, children });
1545
+ }
1546
+ function Trigger3({ onClick, children, ...props }) {
1547
+ const context = useDrawerContext("Trigger");
1548
+ return /* @__PURE__ */ jsx29(
1549
+ "button",
1550
+ {
1551
+ type: "button",
1552
+ "aria-haspopup": "dialog",
1553
+ "aria-expanded": context.open,
1554
+ ...props,
1555
+ onClick: (event) => {
1556
+ onClick?.(event);
1557
+ if (event.defaultPrevented) return;
1558
+ context.origin.current = event.currentTarget;
1559
+ context.setOpen(!context.open);
1560
+ },
1561
+ children
1562
+ }
1563
+ );
1564
+ }
1565
+ function Content3({ className, children, ...props }) {
1566
+ const context = useDrawerContext("Content");
1567
+ const options = useMemo4(() => ({ ...context.options, side: context.side }), [context.options, context.side]);
1568
+ const ref = useSurfaceEngine({ ...context, options }, (dialog, engineOptions) => createDrawer(dialog, engineOptions));
1569
+ return /* @__PURE__ */ jsx29("dialog", { ref, className: ["mk-dialog mk-drawer", className].filter(Boolean).join(" "), ...props, children });
1570
+ }
1571
+ var Drawer = {
1572
+ Root: Root6,
1573
+ Trigger: Trigger3,
1574
+ Content: Content3,
1575
+ Header: Dialog.Header,
1576
+ Title: Dialog.Title,
1577
+ Description: Dialog.Description,
1578
+ Actions: Dialog.Actions,
1579
+ Body: Dialog.Body,
1580
+ Footer: Dialog.Footer,
1581
+ Close: Dialog.Close
1582
+ };
1583
+ function useDrawer() {
1584
+ const context = useDrawerContext("useDrawer");
1585
+ return { open: context.open, setOpen: context.setOpen, side: context.side, instance: context.instance };
1586
+ }
1587
+
1588
+ // src/components/link-preview/react.tsx
1589
+ import { useEffect as useEffect3, useId, useRef as useRef27, useState as useState6 } from "react";
1590
+ import { Fragment as Fragment4, jsx as jsx30, jsxs as jsxs16 } from "react/jsx-runtime";
1591
+ function Card({ url, title, description, image, imageAlt, siteName, target }) {
1592
+ const id = useId();
1593
+ const href = safeHref(url);
1594
+ const domain = linkDomain(href);
1595
+ const source = safeImage(image);
1596
+ const [failed, setFailed] = useState6(false);
1597
+ useEffect3(() => setFailed(false), [source]);
1598
+ const site = [siteName, domain].filter(Boolean).filter((value, i, all) => all.indexOf(value) === i).join(" \xB7 ");
1599
+ const content = /* @__PURE__ */ jsxs16(Fragment4, { children: [
1600
+ /* @__PURE__ */ jsxs16("span", { "data-mk-part": "media", children: [
1601
+ /* @__PURE__ */ jsx30("span", { "data-mk-part": "fallback", "aria-hidden": "true", children: (siteName || domain || title || "?").trim().charAt(0).toUpperCase() }),
1602
+ source && !failed ? /* @__PURE__ */ jsx30("img", { "data-mk-link-image": "", src: source, alt: imageAlt ?? "", loading: "lazy", decoding: "async", onError: () => setFailed(true) }) : null
1603
+ ] }),
1604
+ /* @__PURE__ */ jsxs16("span", { "data-mk-part": "text", children: [
1605
+ site && /* @__PURE__ */ jsxs16("span", { "data-mk-part": "meta", children: [
1606
+ /* @__PURE__ */ jsx30("span", { "data-mk-part": "favicon", "aria-hidden": "true", children: (siteName || domain).trim().charAt(0).toUpperCase() }),
1607
+ /* @__PURE__ */ jsx30("span", { "data-mk-part": "site", children: site })
1608
+ ] }),
1609
+ /* @__PURE__ */ jsx30("span", { "data-mk-part": "title", id: `${id}-title`, children: title || domain || href }),
1610
+ description && /* @__PURE__ */ jsx30("span", { "data-mk-part": "description", id: `${id}-description`, children: description })
1611
+ ] }),
1612
+ /* @__PURE__ */ jsx30("span", { "data-mk-part": "go", "aria-hidden": "true", children: /* @__PURE__ */ jsx30("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx30("path", { d: "M7 17L17 7M9 7h8v8" }) }) })
1613
+ ] });
1614
+ const labelled = { "aria-labelledby": `${id}-title`, "aria-describedby": description ? `${id}-description` : void 0 };
1615
+ return href ? /* @__PURE__ */ jsx30("a", { "data-mk-link-card": "", href, target, rel: target === "_blank" ? "noopener noreferrer" : void 0, ...labelled, children: content }) : /* @__PURE__ */ jsx30("span", { "data-mk-link-card": "", ...labelled, children: content });
1616
+ }
1617
+ function LinkPreview({ url, title, description, image, imageAlt, siteName, variant = "card", label, target, openDelay, closeDelay, placement, onOpenChange, className, ...props }) {
1618
+ const ref = useRef27(null);
1619
+ const change = useLatest(onOpenChange);
1620
+ const href = safeHref(url);
1621
+ const hover = variant === "hover";
1622
+ useIsomorphicLayoutEffect(() => {
1623
+ if (!hover) return;
1624
+ const instance = createHoverCard(ref.current, { openDelay, closeDelay, placement, onOpenChange: (open) => change.current?.(open) });
1625
+ return () => instance.destroy();
1626
+ }, [hover, openDelay, closeDelay, placement]);
1627
+ const card = /* @__PURE__ */ jsx30(Card, { url, title, description, image, imageAlt, siteName, target });
1628
+ if (!hover) {
1629
+ return /* @__PURE__ */ jsx30("div", { ...props, className: ["mk-link-preview", className].filter(Boolean).join(" "), "data-mk-link-variant": variant === "row" ? "row" : "card", children: card });
1630
+ }
1631
+ const text = label || title || linkDomain(href) || href;
1632
+ return /* @__PURE__ */ jsxs16("span", { ...props, ref, className: ["mk-link-preview mk-hover-card", className].filter(Boolean).join(" "), "data-mk-link-variant": "hover", children: [
1633
+ href ? /* @__PURE__ */ jsx30("a", { "data-mk-hover-trigger": "", href, target, rel: target === "_blank" ? "noopener noreferrer" : void 0, children: text }) : /* @__PURE__ */ jsx30("span", { "data-mk-hover-trigger": "", tabIndex: 0, children: text }),
1634
+ /* @__PURE__ */ jsx30("span", { "data-mk-hover-panel": "", role: "region", "aria-label": `Vista previa: ${title || linkDomain(href)}`, hidden: true, children: card })
1635
+ ] });
1636
+ }
1637
+
1638
+ // src/components/progress/react.tsx
1639
+ import { useRef as useRef28 } from "react";
1640
+ import { jsx as jsx31 } from "react/jsx-runtime";
1641
+ function Progress({ value, min, max, label, variant, showValue, formatValue, className, ...props }) {
1642
+ const ref = useRef28(null);
1643
+ const instance = useRef28(null);
1644
+ const current = useLatest(value);
1645
+ const format = useLatest(formatValue);
1646
+ const formatted = formatValue !== void 0;
1647
+ useIsomorphicLayoutEffect(() => {
1648
+ const created = createProgress(ref.current, {
1649
+ value: current.current,
1650
+ min,
1651
+ max,
1652
+ label,
1653
+ variant,
1654
+ showValue,
1655
+ formatValue: formatted ? (n, ratio) => format.current?.(n, ratio) ?? "" : void 0
1656
+ });
1657
+ instance.current = created;
1658
+ return () => {
1659
+ created.destroy();
1660
+ instance.current = null;
1661
+ };
1662
+ }, [min, max, label, variant, showValue, formatted]);
1663
+ useIsomorphicLayoutEffect(() => {
1664
+ instance.current?.setValue(value === void 0 ? min ?? 0 : value);
1665
+ }, [value]);
1666
+ return /* @__PURE__ */ jsx31("div", { ...props, ref, className: ["mk-progress", className].filter(Boolean).join(" ") });
1667
+ }
1668
+
1669
+ // src/components/range-slider/react.tsx
1670
+ import { useRef as useRef29 } from "react";
1671
+ import { jsx as jsx32, jsxs as jsxs17 } from "react/jsx-runtime";
1672
+ function RangeSlider({ min, max, step, value, defaultValue, disabled, name, label, formatValue, onInput, onChange, showOutput = true, className, ...props }) {
1673
+ const ref = useRef29(null);
1674
+ const instance = useRef29(null);
1675
+ const edited = useRef29(void 0);
1676
+ const input = useLatest(onInput);
1677
+ const change = useLatest(onChange);
1678
+ const format = useLatest(formatValue);
1679
+ const formatted = formatValue !== void 0;
1680
+ const start = value ?? defaultValue;
1681
+ const count = Array.isArray(start) ? 2 : 1;
1682
+ const current = useLatest(value);
1683
+ useIsomorphicLayoutEffect(() => {
1684
+ const created = createRangeSlider(ref.current, {
1685
+ min,
1686
+ max,
1687
+ step,
1688
+ disabled,
1689
+ name,
1690
+ label,
1691
+ value: current.current ?? edited.current ?? start,
1692
+ formatValue: formatted ? (n) => format.current?.(n) ?? String(n) : void 0,
1693
+ onInput: (next) => input.current?.(next),
1694
+ onChange: (next) => change.current?.(next)
1695
+ });
1696
+ instance.current = created;
1697
+ return () => {
1698
+ edited.current = created.value;
1699
+ created.destroy();
1700
+ instance.current = null;
1701
+ };
1702
+ }, [min, max, step, disabled, name, label, formatted, count]);
1703
+ const valueKey = JSON.stringify(value);
1704
+ useIsomorphicLayoutEffect(() => {
1705
+ if (value !== void 0) instance.current?.setValue(value, false);
1706
+ }, [valueKey]);
1707
+ const initial = Array.isArray(start) ? start : [start ?? min ?? 0];
1708
+ return /* @__PURE__ */ jsxs17("div", { ...props, ref, className: ["mk-range-slider", className].filter(Boolean).join(" "), children: [
1709
+ /* @__PURE__ */ jsx32("div", { "data-mk-range-track": "", children: initial.map((n, i) => /* @__PURE__ */ jsx32("input", { type: "range", "data-mk-range-input": "", defaultValue: n }, i)) }),
1710
+ showOutput && /* @__PURE__ */ jsx32("output", { "data-mk-range-output": "" })
1711
+ ] });
1712
+ }
1713
+
1714
+ // src/components/chart/react.tsx
1715
+ import { useRef as useRef30 } from "react";
1716
+ import { jsx as jsx33 } from "react/jsx-runtime";
1717
+ function Chart({ type, labels, series, points, stacked, formatValue, label, height, emptyLabel, legend, tooltip, axis, endLabel, onSelect, instanceRef, className, ...props }) {
1718
+ const ref = useRef30(null);
1719
+ const instance = useRef30(null);
1720
+ const format = useLatest(formatValue);
1721
+ const select = useLatest(onSelect);
1722
+ const formatted = formatValue !== void 0;
1723
+ const data = { type, labels, series, points, stacked, label, height, emptyLabel, legend, tooltip, axis, endLabel };
1724
+ const key = JSON.stringify(data);
1725
+ const latest = useLatest(data);
1726
+ const options = () => ({
1727
+ ...latest.current,
1728
+ formatValue: formatted ? (value) => format.current?.(value) ?? String(value) : void 0,
1729
+ onSelect: (index) => select.current?.(index)
1730
+ });
1731
+ useIsomorphicLayoutEffect(() => {
1732
+ const created = createChart(ref.current, options());
1733
+ instance.current = created;
1734
+ if (instanceRef) instanceRef.current = created;
1735
+ return () => {
1736
+ created.destroy();
1737
+ instance.current = null;
1738
+ if (instanceRef) instanceRef.current = null;
1739
+ };
1740
+ }, []);
1741
+ const first = useRef30(true);
1742
+ useIsomorphicLayoutEffect(() => {
1743
+ if (first.current) {
1744
+ first.current = false;
1745
+ return;
1746
+ }
1747
+ instance.current?.update(options());
1748
+ }, [key, formatted]);
1749
+ return /* @__PURE__ */ jsx33("div", { ...props, ref, className: ["mk-chart", className].filter(Boolean).join(" ") });
1750
+ }
1751
+
1752
+ // src/components/credit-card/react.tsx
1753
+ import { useRef as useRef31 } from "react";
1754
+ import { jsx as jsx34 } from "react/jsx-runtime";
1755
+ function CreditCard({ labels, names, tilt, onChange, onComplete, instanceRef, className, ...props }) {
1756
+ const ref = useRef31(null);
1757
+ const change = useLatest(onChange);
1758
+ const complete = useLatest(onComplete);
1759
+ const key = JSON.stringify([labels ?? {}, names ?? {}]);
1760
+ useIsomorphicLayoutEffect(() => {
1761
+ const created = createCreditCard(ref.current, {
1762
+ labels,
1763
+ names,
1764
+ tilt,
1765
+ onChange: (state) => change.current?.(state),
1766
+ onComplete: () => complete.current?.()
1767
+ });
1768
+ if (instanceRef) instanceRef.current = created;
1769
+ return () => {
1770
+ created.destroy();
1771
+ if (instanceRef) instanceRef.current = null;
1772
+ };
1773
+ }, [key, tilt]);
1774
+ return /* @__PURE__ */ jsx34("div", { ...props, ref, className: ["mk-credit-card", className].filter(Boolean).join(" ") });
1775
+ }
1776
+
1777
+ // src/components/command-search/react.tsx
1778
+ import { useRef as useRef32 } from "react";
1779
+ import { Fragment as Fragment5, jsx as jsx35, jsxs as jsxs18 } from "react/jsx-runtime";
1780
+ function CommandSearch({ items, placeholder, emptyLabel, label, shortcut, limit, trigger, onSelect, onOpenChange, instanceRef, className, ...props }) {
1781
+ const ref = useRef32(null);
1782
+ const instance = useRef32(null);
1783
+ const select = useLatest(onSelect);
1784
+ const change = useLatest(onOpenChange);
1785
+ const latest = useLatest(items);
1786
+ useIsomorphicLayoutEffect(() => {
1787
+ const created = createCommandSearch(ref.current, {
1788
+ items: latest.current,
1789
+ placeholder,
1790
+ emptyLabel,
1791
+ label,
1792
+ shortcut,
1793
+ limit,
1794
+ onSelect: (item) => select.current?.(item),
1795
+ onOpenChange: (open) => change.current?.(open)
1796
+ });
1797
+ instance.current = created;
1798
+ if (instanceRef) instanceRef.current = created;
1799
+ return () => {
1800
+ created.destroy();
1801
+ instance.current = null;
1802
+ if (instanceRef) instanceRef.current = null;
1803
+ };
1804
+ }, [placeholder, emptyLabel, label, shortcut, limit]);
1805
+ const key = JSON.stringify(items);
1806
+ useIsomorphicLayoutEffect(() => {
1807
+ instance.current?.setItems(latest.current);
1808
+ }, [key]);
1809
+ return /* @__PURE__ */ jsx35("span", { ...props, ref, className: ["mk-command-search", className].filter(Boolean).join(" "), children: trigger === null ? null : /* @__PURE__ */ jsx35("button", { type: "button", "data-mk-command-open": "", "aria-haspopup": "dialog", children: trigger ?? /* @__PURE__ */ jsxs18(Fragment5, { children: [
1810
+ /* @__PURE__ */ jsx35("span", { children: "Buscar\u2026" }),
1811
+ /* @__PURE__ */ jsx35("kbd", { "aria-hidden": "true", children: "\u2318K" })
1812
+ ] }) }) });
1813
+ }
1814
+
1815
+ // src/components/hold-confirm/react.tsx
1816
+ import { useRef as useRef33 } from "react";
1817
+ import { jsx as jsx36 } from "react/jsx-runtime";
1818
+ function HoldConfirm({ duration, resetAfter, holdingLabel, doneLabel, hint, disabled, onConfirm, className, children, ...props }) {
1819
+ const ref = useRef33(null);
1820
+ const confirm = useLatest(onConfirm);
1821
+ useIsomorphicLayoutEffect(() => {
1822
+ const instance = createHoldConfirm(ref.current, { duration, resetAfter, holdingLabel, doneLabel, hint, disabled, onConfirm: () => confirm.current?.() });
1823
+ return () => instance.destroy();
1824
+ }, [duration, resetAfter, holdingLabel, doneLabel, hint, disabled]);
1825
+ return /* @__PURE__ */ jsx36("span", { ref, className: ["mk-hold-confirm", className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsx36("button", { type: "button", ...props, children: /* @__PURE__ */ jsx36("span", { "data-mk-hold-text": "", children }) }) });
1826
+ }
1827
+
1828
+ // src/components/image-preview/react.tsx
1829
+ import { useRef as useRef34 } from "react";
1830
+ import { jsx as jsx37 } from "react/jsx-runtime";
1831
+ function ImagePreview({ images, labels, loop, strip, onChange, onOpenChange, instanceRef, className, ...props }) {
1832
+ const ref = useRef34(null);
1833
+ const change = useLatest(onChange);
1834
+ const openChange = useLatest(onOpenChange);
1835
+ const key = JSON.stringify(labels ?? {});
1836
+ useIsomorphicLayoutEffect(() => {
1837
+ const created = createImagePreview(ref.current, { labels, loop, strip, onChange: (i) => change.current?.(i), onOpenChange: (open) => openChange.current?.(open) });
1838
+ if (instanceRef) instanceRef.current = created;
1839
+ return () => {
1840
+ created.destroy();
1841
+ if (instanceRef) instanceRef.current = null;
1842
+ };
1843
+ }, [key, loop, strip]);
1844
+ return /* @__PURE__ */ jsx37("div", { ...props, ref, className: ["mk-image-preview", className].filter(Boolean).join(" "), children: images.map((image, i) => /* @__PURE__ */ jsx37("button", { type: "button", "data-mk-image": "", "data-mk-src": image.src, "data-mk-caption": image.caption, "aria-label": `Ver ${image.alt}`, children: /* @__PURE__ */ jsx37("img", { src: image.thumb ?? image.src, alt: image.alt, loading: "lazy", decoding: "async" }) }, `${image.src}-${i}`)) });
1845
+ }
1846
+
1847
+ // src/components/like-button/react.tsx
1848
+ import { useRef as useRef35 } from "react";
1849
+ import { jsx as jsx38 } from "react/jsx-runtime";
1850
+ function LikeButton({ liked, defaultLiked, count = 0, label, hideCount, onChange, className, ...props }) {
1851
+ const ref = useRef35(null);
1852
+ const instance = useRef35(null);
1853
+ const change = useLatest(onChange);
1854
+ const start = useRef35({ liked: liked ?? defaultLiked ?? false, count });
1855
+ useIsomorphicLayoutEffect(() => {
1856
+ const created = createLikeButton(ref.current, { ...start.current, label, hideCount, onChange: (next, total) => change.current?.(next, total) });
1857
+ instance.current = created;
1858
+ return () => {
1859
+ start.current = { liked: created.liked, count: created.count };
1860
+ created.destroy();
1861
+ instance.current = null;
1862
+ };
1863
+ }, [label, hideCount]);
1864
+ useIsomorphicLayoutEffect(() => {
1865
+ if (liked !== void 0 && instance.current && instance.current.liked !== liked) instance.current.setLiked(liked, false);
1866
+ }, [liked]);
1867
+ useIsomorphicLayoutEffect(() => {
1868
+ if (instance.current && instance.current.count !== count) instance.current.setCount(count);
1869
+ }, [count]);
1870
+ return /* @__PURE__ */ jsx38("button", { type: "button", ...props, ref, className: ["mk-like-button", className].filter(Boolean).join(" ") });
1871
+ }
1872
+
1873
+ // src/components/notification-bell/react.tsx
1874
+ import { useRef as useRef36 } from "react";
1875
+ import { jsx as jsx39 } from "react/jsx-runtime";
1876
+ function NotificationBell({ count = 0, message, label, messageDuration, max, onOpen, instanceRef, className, ...props }) {
1877
+ const ref = useRef36(null);
1878
+ const instance = useRef36(null);
1879
+ const open = useLatest(onOpen);
1880
+ const initial = useRef36(count);
1881
+ useIsomorphicLayoutEffect(() => {
1882
+ const created = createNotificationBell(ref.current, { count: initial.current, label, messageDuration, max, onOpen: () => open.current?.() });
1883
+ instance.current = created;
1884
+ if (instanceRef) instanceRef.current = created;
1885
+ return () => {
1886
+ initial.current = created.count;
1887
+ created.destroy();
1888
+ instance.current = null;
1889
+ if (instanceRef) instanceRef.current = null;
1890
+ };
1891
+ }, [label, messageDuration, max]);
1892
+ const seen = useRef36({ count, message });
1893
+ useIsomorphicLayoutEffect(() => {
1894
+ const bell = instance.current;
1895
+ if (!bell) return;
1896
+ const before = seen.current;
1897
+ seen.current = { count, message };
1898
+ const fresh = message !== void 0 && message !== before.message;
1899
+ if (count > bell.count) {
1900
+ bell.setCount(count - 1);
1901
+ bell.notify(fresh ? message : void 0);
1902
+ } else {
1903
+ bell.setCount(count);
1904
+ if (fresh && message) bell.notify(message);
1905
+ }
1906
+ }, [count, message]);
1907
+ return /* @__PURE__ */ jsx39("span", { ref, className: ["mk-notification-bell", className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsx39("button", { type: "button", ...props }) });
1908
+ }
1909
+
1910
+ // src/components/password-strength/react.tsx
1911
+ import { useRef as useRef37 } from "react";
1912
+ import { jsx as jsx40 } from "react/jsx-runtime";
1913
+ function PasswordStrength({ minLength, score, requireScore, labels, onStrength, onValueChange, className, ...props }) {
1914
+ const ref = useRef37(null);
1915
+ const strength = useLatest(onStrength);
1916
+ const value = useLatest(onValueChange);
1917
+ const scorer = useLatest(score);
1918
+ const custom = score !== void 0;
1919
+ const key = JSON.stringify(labels ?? {});
1920
+ useIsomorphicLayoutEffect(() => {
1921
+ const instance = createPasswordStrength(ref.current, {
1922
+ minLength,
1923
+ requireScore,
1924
+ labels,
1925
+ score: custom ? (text) => scorer.current(text) : void 0,
1926
+ onChange: (result) => strength.current?.(result)
1927
+ });
1928
+ return () => instance.destroy();
1929
+ }, [minLength, requireScore, key, custom]);
1930
+ return /* @__PURE__ */ jsx40("div", { ref, className: ["mk-password-strength", className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsx40("input", { autoComplete: "new-password", "aria-label": "Contrase\xF1a", ...props, type: "password", onInput: (event) => value.current?.(event.currentTarget.value) }) });
1931
+ }
1932
+
1933
+ // src/components/scratch-card/react.tsx
1934
+ import { useRef as useRef38 } from "react";
1935
+ import { jsx as jsx41 } from "react/jsx-runtime";
1936
+ function ScratchCard({ threshold, brush, coverLabel, revealLabel, revealedLabel, celebrate, onProgress, onReveal, instanceRef, className, children, ...props }) {
1937
+ const ref = useRef38(null);
1938
+ const progress = useLatest(onProgress);
1939
+ const reveal = useLatest(onReveal);
1940
+ useIsomorphicLayoutEffect(() => {
1941
+ const created = createScratchCard(ref.current, {
1942
+ threshold,
1943
+ brush,
1944
+ coverLabel,
1945
+ revealLabel,
1946
+ revealedLabel,
1947
+ celebrate,
1948
+ onProgress: (value) => progress.current?.(value),
1949
+ onReveal: () => reveal.current?.()
1950
+ });
1951
+ if (instanceRef) instanceRef.current = created;
1952
+ return () => {
1953
+ created.destroy();
1954
+ if (instanceRef) instanceRef.current = null;
1955
+ };
1956
+ }, [threshold, brush, coverLabel, revealLabel, revealedLabel, celebrate]);
1957
+ return /* @__PURE__ */ jsx41("div", { ...props, ref, className: ["mk-scratch-card", className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsx41("div", { "data-mk-scratch-content": "", children }) });
1958
+ }
1959
+
1960
+ // src/components/star-rating/react.tsx
1961
+ import { useRef as useRef39 } from "react";
1962
+ import { jsx as jsx42 } from "react/jsx-runtime";
1963
+ function StarRating({ value, defaultValue, max, name, label, labels, readonly, allowClear, disabled, onChange, className, ...props }) {
1964
+ const ref = useRef39(null);
1965
+ const instance = useRef39(null);
1966
+ const change = useLatest(onChange);
1967
+ const start = useRef39(value ?? defaultValue ?? 0);
1968
+ const key = JSON.stringify(labels ?? null);
1969
+ useIsomorphicLayoutEffect(() => {
1970
+ const created = createStarRating(ref.current, { value: value ?? start.current, max, name, label, labels, readonly, allowClear, disabled, onChange: (next) => change.current?.(next) });
1971
+ instance.current = created;
1972
+ return () => {
1973
+ start.current = created.value;
1974
+ created.destroy();
1975
+ instance.current = null;
1976
+ };
1977
+ }, [max, name, label, key, readonly, allowClear, disabled]);
1978
+ useIsomorphicLayoutEffect(() => {
1979
+ if (value !== void 0 && instance.current && instance.current.value !== value) instance.current.setValue(value);
1980
+ }, [value]);
1981
+ return /* @__PURE__ */ jsx42("div", { ...props, ref, className: ["mk-star-rating", className].filter(Boolean).join(" ") });
1982
+ }
1983
+
1984
+ // src/components/swipe-actions/react.tsx
1985
+ import { useRef as useRef40 } from "react";
1986
+ import { jsx as jsx43, jsxs as jsxs19 } from "react/jsx-runtime";
1987
+ function Actions({ side, actions }) {
1988
+ return /* @__PURE__ */ jsx43("div", { "data-mk-swipe-actions": side, children: actions.map((action) => /* @__PURE__ */ jsx43(
1989
+ "button",
1990
+ {
1991
+ type: "button",
1992
+ "data-mk-swipe-action": action.id,
1993
+ "data-mk-tone": action.tone,
1994
+ "data-mk-swipe-remove": action.remove ? "" : void 0,
1995
+ "data-mk-swipe-primary": action.primary ? "" : void 0,
1996
+ "aria-label": action.label,
1997
+ children: action.icon ?? action.label
1998
+ },
1999
+ action.id
2000
+ )) });
2001
+ }
2002
+ function Row({ left, right, children, ...props }) {
2003
+ return /* @__PURE__ */ jsxs19("li", { ...props, "data-mk-swipe-row": "", children: [
2004
+ left?.length ? /* @__PURE__ */ jsx43(Actions, { side: "left", actions: left }) : null,
2005
+ /* @__PURE__ */ jsx43("div", { "data-mk-swipe-content": "", children }),
2006
+ right?.length ? /* @__PURE__ */ jsx43(Actions, { side: "right", actions: right }) : null
2007
+ ] });
2008
+ }
2009
+ function Root7({ fullSwipe, onAction, className, children, ...props }) {
2010
+ const ref = useRef40(null);
2011
+ const action = useLatest(onAction);
2012
+ useIsomorphicLayoutEffect(() => {
2013
+ const instance = createSwipeActions(ref.current, { fullSwipe, onAction: (id, row) => action.current?.(id, row) });
2014
+ return () => instance.destroy();
2015
+ }, [fullSwipe]);
2016
+ return /* @__PURE__ */ jsx43("ul", { ...props, ref, className: ["mk-swipe-actions", className].filter(Boolean).join(" "), children });
2017
+ }
2018
+ var SwipeActions = Object.assign(Root7, { Row });
2019
+
2020
+ // src/components/color-slider/react.tsx
2021
+ import { useRef as useRef41 } from "react";
2022
+ import { jsx as jsx44 } from "react/jsx-runtime";
2023
+ function ColorSlider({ value, defaultValue, channel, label, orientation, step, showValue, name, disabled, onInput, onChange, className, ...props }) {
2024
+ const ref = useRef41(null);
2025
+ const instance = useRef41(null);
2026
+ const input = useLatest(onInput);
2027
+ const change = useLatest(onChange);
2028
+ const start = useRef41(value ?? defaultValue);
2029
+ useIsomorphicLayoutEffect(() => {
2030
+ const created = createColorSlider(ref.current, {
2031
+ value: value ?? start.current,
2032
+ channel,
2033
+ label,
2034
+ orientation,
2035
+ step,
2036
+ showValue,
2037
+ name,
2038
+ disabled,
2039
+ onInput: (hex, color) => input.current?.(hex, color),
2040
+ onChange: (hex, color) => change.current?.(hex, color)
2041
+ });
2042
+ instance.current = created;
2043
+ return () => {
2044
+ start.current = created.value;
2045
+ created.destroy();
2046
+ instance.current = null;
2047
+ };
2048
+ }, [channel, label, orientation, step, showValue, name, disabled]);
2049
+ useIsomorphicLayoutEffect(() => {
2050
+ if (value !== void 0 && instance.current && instance.current.value !== toHex(toHsva(value))) instance.current.setColor(value, false);
2051
+ }, [value]);
2052
+ return /* @__PURE__ */ jsx44("div", { ...props, ref, className: ["mk-color-slider", className].filter(Boolean).join(" ") });
2053
+ }
2054
+
2055
+ // src/components/color-area/react.tsx
2056
+ import { useRef as useRef42 } from "react";
2057
+ import { jsx as jsx45 } from "react/jsx-runtime";
2058
+ function ColorArea({ value, defaultValue, label, step, name, disabled, onInput, onChange, className, ...props }) {
2059
+ const ref = useRef42(null);
2060
+ const instance = useRef42(null);
2061
+ const input = useLatest(onInput);
2062
+ const change = useLatest(onChange);
2063
+ const start = useRef42(value ?? defaultValue);
2064
+ useIsomorphicLayoutEffect(() => {
2065
+ const created = createColorArea(ref.current, {
2066
+ value: value ?? start.current,
2067
+ label,
2068
+ step,
2069
+ name,
2070
+ disabled,
2071
+ onInput: (hex, color) => input.current?.(hex, color),
2072
+ onChange: (hex, color) => change.current?.(hex, color)
2073
+ });
2074
+ instance.current = created;
2075
+ return () => {
2076
+ start.current = created.value;
2077
+ created.destroy();
2078
+ instance.current = null;
2079
+ };
2080
+ }, [label, step, name, disabled]);
2081
+ useIsomorphicLayoutEffect(() => {
2082
+ if (value !== void 0 && instance.current && instance.current.value !== toHex(toHsva(value))) instance.current.setColor(value, false);
2083
+ }, [value]);
2084
+ return /* @__PURE__ */ jsx45("div", { ...props, ref, className: ["mk-color-area", className].filter(Boolean).join(" ") });
2085
+ }
2086
+
2087
+ // src/components/color-field/react.tsx
2088
+ import { useRef as useRef43 } from "react";
2089
+ import { jsx as jsx46 } from "react/jsx-runtime";
2090
+ function ColorField({ value, defaultValue, format, alpha, label, name, disabled, readOnly, onChange, className, ...props }) {
2091
+ const ref = useRef43(null);
2092
+ const instance = useRef43(null);
2093
+ const change = useLatest(onChange);
2094
+ const start = useRef43(value ?? defaultValue);
2095
+ useIsomorphicLayoutEffect(() => {
2096
+ const created = createColorField(ref.current, {
2097
+ value: value ?? start.current,
2098
+ format,
2099
+ alpha,
2100
+ label,
2101
+ name,
2102
+ disabled,
2103
+ readOnly,
2104
+ onChange: (hex, color) => change.current?.(hex, color)
2105
+ });
2106
+ instance.current = created;
2107
+ return () => {
2108
+ start.current = created.value;
2109
+ created.destroy();
2110
+ instance.current = null;
2111
+ };
2112
+ }, [format, alpha, label, name, disabled, readOnly]);
2113
+ useIsomorphicLayoutEffect(() => {
2114
+ if (value !== void 0 && instance.current && instance.current.value !== toHex(toHsva(value))) instance.current.setColor(value, false);
2115
+ }, [value]);
2116
+ return /* @__PURE__ */ jsx46("div", { ...props, ref, className: ["mk-color-field", className].filter(Boolean).join(" ") });
2117
+ }
2118
+
2119
+ // src/components/color-picker/react.tsx
2120
+ import { useRef as useRef44 } from "react";
2121
+ import { jsx as jsx47 } from "react/jsx-runtime";
2122
+ function ColorPicker({ value, defaultValue, alpha, format, swatches, label, name, disabled, inline, eyedropper, onInput, onChange, className, ...props }) {
2123
+ const ref = useRef44(null);
2124
+ const instance = useRef44(null);
2125
+ const input = useLatest(onInput);
2126
+ const change = useLatest(onChange);
2127
+ const start = useRef44(value ?? defaultValue);
2128
+ const key = JSON.stringify(swatches ?? null);
2129
+ useIsomorphicLayoutEffect(() => {
2130
+ const created = createColorPicker(ref.current, {
2131
+ value: value ?? start.current,
2132
+ alpha,
2133
+ format,
2134
+ swatches,
2135
+ label,
2136
+ name,
2137
+ disabled,
2138
+ inline,
2139
+ eyedropper,
2140
+ onInput: (hex, color) => input.current?.(hex, color),
2141
+ onChange: (hex, color) => change.current?.(hex, color)
2142
+ });
2143
+ instance.current = created;
2144
+ return () => {
2145
+ start.current = created.value;
2146
+ created.destroy();
2147
+ instance.current = null;
2148
+ };
2149
+ }, [alpha, format, key, label, name, disabled, inline, eyedropper]);
2150
+ useIsomorphicLayoutEffect(() => {
2151
+ if (value !== void 0 && instance.current && instance.current.value !== toHex(toHsva(value))) instance.current.setColor(value, false);
2152
+ }, [value]);
2153
+ return /* @__PURE__ */ jsx47("div", { ...props, ref, className: ["mk-color-picker", className].filter(Boolean).join(" ") });
2154
+ }
2155
+
2156
+ // src/components/time-field/react.tsx
2157
+ import { useRef as useRef45 } from "react";
2158
+ import { jsx as jsx48 } from "react/jsx-runtime";
2159
+ function TimeField({ value, defaultValue, locale, hourCycle, seconds, minuteStep, min, max, label, name, disabled, readOnly, onChange, className, ...props }) {
2160
+ const ref = useRef45(null);
2161
+ const instance = useRef45(null);
2162
+ const change = useLatest(onChange);
2163
+ const start = useRef45(value !== void 0 ? value : defaultValue ?? null);
2164
+ useIsomorphicLayoutEffect(() => {
2165
+ const created = createTimeField(ref.current, {
2166
+ value: value !== void 0 ? value : start.current,
2167
+ locale,
2168
+ hourCycle,
2169
+ seconds,
2170
+ minuteStep,
2171
+ min,
2172
+ max,
2173
+ label,
2174
+ name,
2175
+ disabled,
2176
+ readOnly,
2177
+ onChange: (next) => change.current?.(next)
2178
+ });
2179
+ instance.current = created;
2180
+ return () => {
2181
+ start.current = created.value;
2182
+ created.destroy();
2183
+ instance.current = null;
2184
+ };
2185
+ }, [locale, hourCycle, seconds, minuteStep, min, max, label, name, disabled, readOnly]);
2186
+ useIsomorphicLayoutEffect(() => {
2187
+ if (value !== void 0 && instance.current && instance.current.value !== value) instance.current.setValue(value);
2188
+ }, [value]);
2189
+ return /* @__PURE__ */ jsx48("div", { ...props, ref, className: ["mk-time-field", className].filter(Boolean).join(" ") });
2190
+ }
2191
+
2192
+ // src/components/range-calendar/react.tsx
2193
+ import { useRef as useRef46 } from "react";
2194
+ import { jsx as jsx49 } from "react/jsx-runtime";
2195
+ var keyOf = (value) => {
2196
+ const range = toRange(value);
2197
+ return range ? JSON.stringify(rangeKeys(range)) : "null";
2198
+ };
2199
+ function RangeCalendar({ value, defaultValue, month, visibleMonths, firstDay, min, max, unavailable, locale, today, labels, onChange, className, ...props }) {
2200
+ const ref = useRef46(null);
2201
+ const instance = useRef46(null);
2202
+ const change = useLatest(onChange);
2203
+ const test = useLatest(unavailable);
2204
+ const start = useRef46(value !== void 0 ? value : defaultValue ?? null);
2205
+ const rules = typeof unavailable === "function" ? "function" : JSON.stringify(unavailable ?? null);
2206
+ useIsomorphicLayoutEffect(() => {
2207
+ const created = createRangeCalendar(ref.current, {
2208
+ value: value !== void 0 ? value : start.current,
2209
+ month,
2210
+ visibleMonths,
2211
+ firstDay,
2212
+ min,
2213
+ max,
2214
+ // A function is read through a ref so a new closure each render does not rebuild the calendar.
2215
+ unavailable: typeof unavailable === "function" ? (day) => typeof test.current === "function" ? test.current(day) : false : unavailable,
2216
+ locale,
2217
+ today,
2218
+ labels,
2219
+ onChange: (range) => change.current?.(range)
2220
+ });
2221
+ instance.current = created;
2222
+ return () => {
2223
+ start.current = created.value;
2224
+ created.destroy();
2225
+ instance.current = null;
2226
+ };
2227
+ }, [String(month ?? ""), visibleMonths, firstDay, String(min ?? ""), String(max ?? ""), rules, locale, String(today ?? "")]);
2228
+ useIsomorphicLayoutEffect(() => {
2229
+ if (value !== void 0 && instance.current && keyOf(value) !== keyOf(instance.current.value)) instance.current.setValue(value);
2230
+ }, [keyOf(value)]);
2231
+ return /* @__PURE__ */ jsx49("div", { ...props, ref, className: ["mk-range-calendar", className].filter(Boolean).join(" ") });
2232
+ }
2233
+
2234
+ // src/components/date-range-picker/react.tsx
2235
+ import { useRef as useRef47 } from "react";
2236
+ import { jsx as jsx50 } from "react/jsx-runtime";
2237
+ var keyOf2 = (value) => {
2238
+ const range = toRange(value);
2239
+ return range ? JSON.stringify(rangeKeys(range)) : "null";
2240
+ };
2241
+ function DateRangePicker({ value, defaultValue, min, max, unavailable, firstDay, locale, today, label, name, presets, disabled, onChange, className, ...props }) {
2242
+ const ref = useRef47(null);
2243
+ const instance = useRef47(null);
2244
+ const change = useLatest(onChange);
2245
+ const test = useLatest(unavailable);
2246
+ const start = useRef47(value !== void 0 ? value : defaultValue ?? null);
2247
+ const rules = typeof unavailable === "function" ? "function" : JSON.stringify(unavailable ?? null);
2248
+ const presetKey = JSON.stringify(presets ?? null);
2249
+ useIsomorphicLayoutEffect(() => {
2250
+ const created = createDateRangePicker(ref.current, {
2251
+ value: value !== void 0 ? value : start.current,
2252
+ min,
2253
+ max,
2254
+ unavailable: typeof unavailable === "function" ? (day) => typeof test.current === "function" ? test.current(day) : false : unavailable,
2255
+ firstDay,
2256
+ locale,
2257
+ today,
2258
+ label,
2259
+ name,
2260
+ presets,
2261
+ disabled,
2262
+ onChange: (range) => change.current?.(range)
2263
+ });
2264
+ instance.current = created;
2265
+ return () => {
2266
+ start.current = created.value;
2267
+ created.destroy();
2268
+ instance.current = null;
2269
+ };
2270
+ }, [String(min ?? ""), String(max ?? ""), rules, firstDay, locale, String(today ?? ""), label, name, presetKey, disabled]);
2271
+ useIsomorphicLayoutEffect(() => {
2272
+ if (value !== void 0 && instance.current && keyOf2(value) !== keyOf2(instance.current.value)) instance.current.setValue(value);
2273
+ }, [keyOf2(value)]);
2274
+ return /* @__PURE__ */ jsx50("div", { ...props, ref, className: ["mk-date-range-picker", className].filter(Boolean).join(" ") });
2275
+ }
2276
+
2277
+ // src/components/tooltip/react.tsx
2278
+ import { useRef as useRef48 } from "react";
2279
+ import { jsx as jsx51 } from "react/jsx-runtime";
2280
+ function Tooltip({ content, placement, openDelay, closeDelay, interactive, arrow, onOpenChange, className, children, ...props }) {
2281
+ const ref = useRef48(null);
2282
+ const instance = useRef48(null);
2283
+ const change = useLatest(onOpenChange);
2284
+ useIsomorphicLayoutEffect(() => {
2285
+ const created = createTooltip(ref.current, { content, placement, openDelay, closeDelay, interactive, arrow, onOpenChange: (open) => change.current?.(open) });
2286
+ instance.current = created;
2287
+ return () => {
2288
+ created.destroy();
2289
+ instance.current = null;
2290
+ };
2291
+ }, [placement, openDelay, closeDelay, interactive, arrow]);
2292
+ useIsomorphicLayoutEffect(() => {
2293
+ instance.current?.setContent(content ?? "");
2294
+ }, [content]);
2295
+ return /* @__PURE__ */ jsx51("span", { ...props, ref, className: ["mk-tooltip", className].filter(Boolean).join(" "), children });
2296
+ }
2297
+
2298
+ // src/components/popover/react.tsx
2299
+ import { forwardRef, useImperativeHandle, useRef as useRef49 } from "react";
2300
+ import { jsx as jsx52, jsxs as jsxs20 } from "react/jsx-runtime";
2301
+ var Popover = forwardRef(function Popover2({ trigger, open, label, onOpenChange, panelClassName, className, children, ...props }, handle) {
2302
+ const ref = useRef49(null);
2303
+ const instance = useRef49(null);
2304
+ const change = useLatest(onOpenChange);
2305
+ useImperativeHandle(handle, () => ({ open: () => instance.current?.open(), close: () => instance.current?.close() }), []);
2306
+ useIsomorphicLayoutEffect(() => {
2307
+ const created = createPopover(ref.current, { label, onOpenChange: (value) => change.current?.(value) });
2308
+ instance.current = created;
2309
+ return () => {
2310
+ created.destroy();
2311
+ instance.current = null;
2312
+ };
2313
+ }, [label]);
2314
+ useIsomorphicLayoutEffect(() => {
2315
+ if (open === void 0 || !instance.current || instance.current.isOpen === open) return;
2316
+ if (open) instance.current.open();
2317
+ else instance.current.close();
2318
+ }, [open]);
2319
+ return /* @__PURE__ */ jsxs20("div", { ...props, ref, className: ["mk-popover", className].filter(Boolean).join(" "), children: [
2320
+ /* @__PURE__ */ jsx52("span", { "data-mk-popover-trigger-slot": "", style: { display: "contents" }, children: trigger }),
2321
+ /* @__PURE__ */ jsx52("dialog", { "data-mk-popover-panel": "", className: panelClassName, children })
2322
+ ] });
2323
+ });
2324
+
2325
+ // src/components/loading-button/react.tsx
2326
+ import { useRef as useRef50 } from "react";
2327
+ import { jsx as jsx53 } from "react/jsx-runtime";
2328
+ function LoadingButton({ action, state, labels, compact, resetAfter, onStateChange, className, children, type = "button", ...props }) {
2329
+ const ref = useRef50(null);
2330
+ const instance = useRef50(null);
2331
+ const run = useLatest(action);
2332
+ const change = useLatest(onStateChange);
2333
+ const key = JSON.stringify(labels ?? null);
2334
+ useIsomorphicLayoutEffect(() => {
2335
+ const created = createLoadingButton(ref.current, {
2336
+ labels,
2337
+ compact,
2338
+ resetAfter,
2339
+ action: action ? () => run.current?.() : void 0,
2340
+ onStateChange: (next) => change.current?.(next)
2341
+ });
2342
+ instance.current = created;
2343
+ return () => {
2344
+ created.destroy();
2345
+ instance.current = null;
2346
+ };
2347
+ }, [key, compact, resetAfter, Boolean(action)]);
2348
+ useIsomorphicLayoutEffect(() => {
2349
+ if (state && instance.current && instance.current.state !== state) instance.current.setState(state);
2350
+ }, [state]);
2351
+ return /* @__PURE__ */ jsx53("button", { ...props, type, ref, className: ["mk-loading-button", className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsx53("span", { "data-mk-loading-label": "", children }) });
2352
+ }
2353
+
2354
+ // src/components/breadcrumb/react.tsx
2355
+ import { useRef as useRef51 } from "react";
2356
+ import { jsx as jsx54 } from "react/jsx-runtime";
2357
+ function Breadcrumb({ items, label, maxItems, onNavigate, className, ...props }) {
2358
+ const ref = useRef51(null);
2359
+ const instance = useRef51(null);
2360
+ const navigate = useLatest(onNavigate);
2361
+ const key = JSON.stringify(items);
2362
+ useIsomorphicLayoutEffect(() => {
2363
+ const created = createBreadcrumb(ref.current, { items, label, maxItems, onNavigate: (item, index, event) => navigate.current?.(item, index, event) });
2364
+ instance.current = created;
2365
+ return () => {
2366
+ created.destroy();
2367
+ instance.current = null;
2368
+ };
2369
+ }, [label, maxItems]);
2370
+ useIsomorphicLayoutEffect(() => {
2371
+ if (instance.current && JSON.stringify(instance.current.items) !== key) instance.current.setItems(items);
2372
+ }, [key]);
2373
+ return /* @__PURE__ */ jsx54("div", { ...props, ref, className: ["mk-breadcrumb", className].filter(Boolean).join(" ") });
2374
+ }
2375
+
2376
+ // src/components/empty-state/react.tsx
2377
+ import { useRef as useRef52 } from "react";
2378
+ import { jsx as jsx55 } from "react/jsx-runtime";
2379
+ function EmptyState({ illustration, title, description, actions, loop, onAction, className, ...props }) {
2380
+ const ref = useRef52(null);
2381
+ const instance = useRef52(null);
2382
+ const action = useLatest(onAction);
2383
+ const content = { illustration, title, description, actions };
2384
+ const key = JSON.stringify(content);
2385
+ useIsomorphicLayoutEffect(() => {
2386
+ const created = createEmptyState(ref.current, { ...content, loop, onAction: (id, event) => action.current?.(id, event) });
2387
+ instance.current = created;
2388
+ return () => {
2389
+ created.destroy();
2390
+ instance.current = null;
2391
+ };
2392
+ }, [loop]);
2393
+ const first = useRef52(true);
2394
+ useIsomorphicLayoutEffect(() => {
2395
+ if (first.current) {
2396
+ first.current = false;
2397
+ return;
2398
+ }
2399
+ instance.current?.update(content);
2400
+ }, [key]);
2401
+ return /* @__PURE__ */ jsx55("div", { ...props, ref, className: ["mk-empty-state", className].filter(Boolean).join(" ") });
2402
+ }
2403
+
2404
+ // src/components/stat-card/react.tsx
2405
+ import { useRef as useRef53 } from "react";
2406
+ import { jsx as jsx56 } from "react/jsx-runtime";
2407
+ function StatCard({ label, value, previous, format, locale, positive, comparison, series, target, countOnView, className, ...props }) {
2408
+ const ref = useRef53(null);
2409
+ const instance = useRef53(null);
2410
+ const formatter = useLatest(format);
2411
+ const custom = typeof format === "function";
2412
+ const data = { label, value, previous, positive, comparison, series, target, format: custom ? void 0 : format };
2413
+ const key = JSON.stringify(data);
2414
+ const options = () => ({ ...data, format: custom ? (n) => formatter.current(n) : data.format });
2415
+ useIsomorphicLayoutEffect(() => {
2416
+ const created = createStatCard(ref.current, { ...options(), locale, countOnView });
2417
+ instance.current = created;
2418
+ return () => {
2419
+ created.destroy();
2420
+ instance.current = null;
2421
+ };
2422
+ }, [locale, countOnView]);
2423
+ const first = useRef53(true);
2424
+ useIsomorphicLayoutEffect(() => {
2425
+ if (first.current) {
2426
+ first.current = false;
2427
+ return;
2428
+ }
2429
+ instance.current?.update(options());
2430
+ }, [key, custom]);
2431
+ return /* @__PURE__ */ jsx56("div", { ...props, ref, className: ["mk-stat-card", className].filter(Boolean).join(" ") });
2432
+ }
2433
+
2434
+ // src/components/chart-tooltip/react.tsx
2435
+ import { useRef as useRef54 } from "react";
2436
+ import { jsx as jsx57 } from "react/jsx-runtime";
2437
+ function ChartTooltip({ labels, series, align, inset, min, max, formatValue, delta, share, total, sort, pin, label, onIndexChange, className, children, ...props }) {
2438
+ const ref = useRef54(null);
2439
+ const instance = useRef54(null);
2440
+ const format = useLatest(formatValue);
2441
+ const change = useLatest(onIndexChange);
2442
+ const data = { labels, series, align, inset, min, max, delta, share, total, sort, pin, label };
2443
+ const key = JSON.stringify(data);
2444
+ const options = () => ({
2445
+ ...data,
2446
+ formatValue: formatValue ? (value) => format.current?.(value) ?? String(value) : void 0,
2447
+ onIndexChange: (index) => change.current?.(index)
2448
+ });
2449
+ useIsomorphicLayoutEffect(() => {
2450
+ const created = createChartTooltip(ref.current, options());
2451
+ instance.current = created;
2452
+ return () => {
2453
+ created.destroy();
2454
+ instance.current = null;
2455
+ };
2456
+ }, []);
2457
+ const first = useRef54(true);
2458
+ useIsomorphicLayoutEffect(() => {
2459
+ if (first.current) {
2460
+ first.current = false;
2461
+ return;
2462
+ }
2463
+ instance.current?.update(options());
2464
+ }, [key, Boolean(formatValue)]);
2465
+ return /* @__PURE__ */ jsx57("div", { ...props, ref, className: ["mk-chart-tooltip", className].filter(Boolean).join(" "), children });
2466
+ }
2467
+
2468
+ // src/components/multi-select/react.tsx
2469
+ import { useRef as useRef55 } from "react";
2470
+ import { jsx as jsx58 } from "react/jsx-runtime";
2471
+ function MultiSelect({ options, value, defaultValue, placeholder, label, name, max, closeOnSelect, disabled, onChange, className, ...props }) {
2472
+ const ref = useRef55(null);
2473
+ const instance = useRef55(null);
2474
+ const change = useLatest(onChange);
2475
+ const start = useRef55(value ?? defaultValue ?? []);
2476
+ const optionsKey = JSON.stringify(options ?? null);
2477
+ useIsomorphicLayoutEffect(() => {
2478
+ const created = createMultiSelect(ref.current, { options, value: value ?? start.current, placeholder, label, name, max, closeOnSelect, disabled, onChange: (next) => change.current?.(next) });
2479
+ instance.current = created;
2480
+ return () => {
2481
+ start.current = created.value;
2482
+ created.destroy();
2483
+ instance.current = null;
2484
+ };
2485
+ }, [placeholder, label, name, max, closeOnSelect, disabled]);
2486
+ useIsomorphicLayoutEffect(() => {
2487
+ if (options && instance.current) instance.current.setOptions(options);
2488
+ }, [optionsKey]);
2489
+ const valueKey = JSON.stringify(value ?? null);
2490
+ useIsomorphicLayoutEffect(() => {
2491
+ if (value && instance.current && JSON.stringify(instance.current.value) !== valueKey) instance.current.setValue(value);
2492
+ }, [valueKey]);
2493
+ return /* @__PURE__ */ jsx58("div", { ...props, ref, className: ["mk-multi-select", className].filter(Boolean).join(" ") });
2494
+ }
2495
+
2496
+ // src/components/tag-input/react.tsx
2497
+ import { useRef as useRef56 } from "react";
2498
+ import { jsx as jsx59 } from "react/jsx-runtime";
2499
+ function TagInput({ value, defaultValue, suggestions, placeholder, label, name, max, restrict, allowDuplicates, validate, transform, disabled, onChange, className, ...props }) {
2500
+ const ref = useRef56(null);
2501
+ const instance = useRef56(null);
2502
+ const change = useLatest(onChange);
2503
+ const check = useLatest(validate);
2504
+ const shape = useLatest(transform);
2505
+ const start = useRef56(value ?? defaultValue ?? []);
2506
+ useIsomorphicLayoutEffect(() => {
2507
+ const created = createTagInput(ref.current, {
2508
+ value: value ?? start.current,
2509
+ suggestions,
2510
+ placeholder,
2511
+ label,
2512
+ name,
2513
+ max,
2514
+ restrict,
2515
+ allowDuplicates,
2516
+ disabled,
2517
+ validate: validate ? (tag, tags) => check.current?.(tag, tags) : void 0,
2518
+ transform: transform ? (tag) => shape.current?.(tag) ?? tag : void 0,
2519
+ onChange: (next) => change.current?.(next)
2520
+ });
2521
+ instance.current = created;
2522
+ return () => {
2523
+ start.current = created.value;
2524
+ created.destroy();
2525
+ instance.current = null;
2526
+ };
2527
+ }, [placeholder, label, name, max, restrict, allowDuplicates, disabled, Boolean(validate), Boolean(transform)]);
2528
+ const suggestionsKey = JSON.stringify(suggestions ?? null);
2529
+ useIsomorphicLayoutEffect(() => {
2530
+ if (suggestions) instance.current?.setSuggestions(suggestions);
2531
+ }, [suggestionsKey]);
2532
+ const valueKey = JSON.stringify(value ?? null);
2533
+ useIsomorphicLayoutEffect(() => {
2534
+ if (value && instance.current && JSON.stringify(instance.current.value) !== valueKey) instance.current.setValue(value);
2535
+ }, [valueKey]);
2536
+ return /* @__PURE__ */ jsx59("div", { ...props, ref, className: ["mk-tag-input", className].filter(Boolean).join(" ") });
2537
+ }
2538
+
2539
+ // src/components/date-time-picker/react.tsx
2540
+ import { useRef as useRef57 } from "react";
2541
+ import { jsx as jsx60 } from "react/jsx-runtime";
2542
+ var keyOf3 = (value) => {
2543
+ const date = toDateTimeValue(value);
2544
+ return date ? dateTimeKey(date) : "null";
2545
+ };
2546
+ function DateTimePicker({ value, defaultValue, min, max, locale, hourCycle, minuteStep, firstDay, unavailable, today, label, name, disabled, onChange, className, ...props }) {
2547
+ const ref = useRef57(null);
2548
+ const instance = useRef57(null);
2549
+ const change = useLatest(onChange);
2550
+ const test = useLatest(unavailable);
2551
+ const start = useRef57(value !== void 0 ? value : defaultValue ?? null);
2552
+ const rules = typeof unavailable === "function" ? "function" : JSON.stringify(unavailable ?? null);
2553
+ useIsomorphicLayoutEffect(() => {
2554
+ const created = createDateTimePicker(ref.current, {
2555
+ value: value !== void 0 ? value : start.current,
2556
+ min,
2557
+ max,
2558
+ locale,
2559
+ hourCycle,
2560
+ minuteStep,
2561
+ firstDay,
2562
+ unavailable: typeof unavailable === "function" ? (day) => typeof test.current === "function" ? test.current(day) : false : unavailable,
2563
+ today,
2564
+ label,
2565
+ name,
2566
+ disabled,
2567
+ onChange: (next) => change.current?.(next)
2568
+ });
2569
+ instance.current = created;
2570
+ return () => {
2571
+ start.current = created.value;
2572
+ created.destroy();
2573
+ instance.current = null;
2574
+ };
2575
+ }, [String(min ?? ""), String(max ?? ""), locale, hourCycle, minuteStep, firstDay, rules, String(today ?? ""), label, name, disabled]);
2576
+ useIsomorphicLayoutEffect(() => {
2577
+ if (value !== void 0 && instance.current && keyOf3(value) !== keyOf3(instance.current.value)) instance.current.setValue(value);
2578
+ }, [keyOf3(value)]);
2579
+ return /* @__PURE__ */ jsx60("div", { ...props, ref, className: ["mk-date-time-picker", className].filter(Boolean).join(" ") });
2580
+ }
2581
+
2582
+ // src/components/filter-builder/react.tsx
2583
+ import { useRef as useRef58 } from "react";
2584
+ import { jsx as jsx61 } from "react/jsx-runtime";
2585
+ function FilterBuilder({ fields, value, defaultValue, maxDepth, label, summary, onChange, className, ...props }) {
2586
+ const ref = useRef58(null);
2587
+ const instance = useRef58(null);
2588
+ const change = useLatest(onChange);
2589
+ const start = useRef58(value ?? defaultValue);
2590
+ const fieldsKey = JSON.stringify(fields);
2591
+ useIsomorphicLayoutEffect(() => {
2592
+ const created = createFilterBuilder(ref.current, { fields, value: value ?? start.current, maxDepth, label, summary, onChange: (next) => change.current?.(next) });
2593
+ instance.current = created;
2594
+ return () => {
2595
+ start.current = created.value;
2596
+ created.destroy();
2597
+ instance.current = null;
2598
+ };
2599
+ }, [fieldsKey, maxDepth, label, summary]);
2600
+ const valueKey = JSON.stringify(value ?? null);
2601
+ useIsomorphicLayoutEffect(() => {
2602
+ if (value && instance.current && JSON.stringify(instance.current.value) !== valueKey) instance.current.setValue(value);
2603
+ }, [valueKey]);
2604
+ return /* @__PURE__ */ jsx61("div", { ...props, ref, className: ["mk-filter-builder", className].filter(Boolean).join(" ") });
2605
+ }
2606
+
2607
+ // src/components/timeline/react.tsx
2608
+ import { useRef as useRef59 } from "react";
2609
+ import { jsx as jsx62 } from "react/jsx-runtime";
2610
+ function Timeline({ events, layout, group, relative, locale, label, className, ...props }) {
2611
+ const ref = useRef59(null);
2612
+ const instance = useRef59(null);
2613
+ const shown = useRef59(events);
2614
+ useIsomorphicLayoutEffect(() => {
2615
+ const created = createTimeline(ref.current, { events: shown.current, layout, group, relative, locale, label });
2616
+ instance.current = created;
2617
+ return () => {
2618
+ created.destroy();
2619
+ instance.current = null;
2620
+ };
2621
+ }, [layout, group, relative, locale, label]);
2622
+ const key = JSON.stringify(events);
2623
+ useIsomorphicLayoutEffect(() => {
2624
+ const timeline = instance.current;
2625
+ const before = shown.current;
2626
+ shown.current = events;
2627
+ if (!timeline || JSON.stringify(timeline.events) === key) return;
2628
+ const ids = new Set(before.map((event) => event.id));
2629
+ const fresh = events.filter((event) => !ids.has(event.id));
2630
+ const kept = events.filter((event) => ids.has(event.id));
2631
+ const gone = before.filter((old) => !events.some((event) => event.id === old.id));
2632
+ const stayed = before.filter((old) => !gone.includes(old));
2633
+ const sameOrder = kept.every((event, i) => stayed[i]?.id === event.id);
2634
+ const patch = () => {
2635
+ for (const event of kept) {
2636
+ const old = before.find((entry) => entry.id === event.id);
2637
+ if (old && JSON.stringify(old) !== JSON.stringify(event)) timeline.update(event.id, { ...Object.fromEntries(Object.keys(old).map((name) => [name, void 0])), ...event });
2638
+ }
2639
+ };
2640
+ const first = events[0]?.id;
2641
+ const last = events[events.length - 1]?.id;
2642
+ if (sameOrder && !gone.length && fresh.length === 1 && (fresh[0].id === first || fresh[0].id === last)) {
2643
+ patch();
2644
+ timeline.add(fresh[0], fresh[0].id === first ? "start" : "end");
2645
+ } else if (sameOrder && !fresh.length && gone.length <= 1) {
2646
+ patch();
2647
+ if (gone[0]) timeline.remove(gone[0].id);
2648
+ } else timeline.setEvents(events);
2649
+ }, [key]);
2650
+ return /* @__PURE__ */ jsx62("div", { ...props, ref, className: ["mk-timeline", className].filter(Boolean).join(" ") });
2651
+ }
2652
+
2653
+ // src/components/activity-feed/react.tsx
2654
+ import { forwardRef as forwardRef2, useImperativeHandle as useImperativeHandle2, useRef as useRef60 } from "react";
2655
+ import { jsx as jsx63 } from "react/jsx-runtime";
2656
+ var ActivityFeed = forwardRef2(function ActivityFeed2({ items, locale, label, emptyLabel, onLoadMore, className, ...props }, handle) {
2657
+ const ref = useRef60(null);
2658
+ const instance = useRef60(null);
2659
+ const load = useLatest(onLoadMore);
2660
+ useImperativeHandle2(handle, () => ({ prepend: (next) => instance.current?.prepend(next), append: (next) => instance.current?.append(next) }), []);
2661
+ useIsomorphicLayoutEffect(() => {
2662
+ const created = createActivityFeed(ref.current, { items, locale, label, emptyLabel, onLoadMore: onLoadMore ? () => load.current?.() ?? [] : void 0 });
2663
+ instance.current = created;
2664
+ return () => {
2665
+ created.destroy();
2666
+ instance.current = null;
2667
+ };
2668
+ }, [locale, label, emptyLabel, Boolean(onLoadMore)]);
2669
+ return /* @__PURE__ */ jsx63("div", { ...props, ref, className: ["mk-activity-feed", className].filter(Boolean).join(" ") });
2670
+ });
2671
+
2672
+ // src/components/tree-view/react.tsx
2673
+ import { forwardRef as forwardRef3, useImperativeHandle as useImperativeHandle3, useRef as useRef61 } from "react";
2674
+ import { jsx as jsx64 } from "react/jsx-runtime";
2675
+ var TreeView = forwardRef3(function TreeView2({ nodes, checkable, checked, expanded, selected, search, label, loadChildren, renderLabel, searchText, icons, draggable, onSelect, onCheck, onExpand, onMove, className, ...props }, handle) {
2676
+ const ref = useRef61(null);
2677
+ const instance = useRef61(null);
2678
+ const select = useLatest(onSelect);
2679
+ const check = useLatest(onCheck);
2680
+ const expand = useLatest(onExpand);
2681
+ const load = useLatest(loadChildren);
2682
+ const draw = useLatest(renderLabel);
2683
+ const text = useLatest(searchText);
2684
+ const moved = useLatest(onMove);
2685
+ useImperativeHandle3(
2686
+ handle,
2687
+ () => ({
2688
+ expand: (id, animate2) => instance.current?.expand(id, animate2),
2689
+ collapse: (id, animate2) => instance.current?.collapse(id, animate2),
2690
+ expandAll: () => instance.current?.expandAll(),
2691
+ collapseAll: () => instance.current?.collapseAll(),
2692
+ reveal: (id) => instance.current?.reveal(id),
2693
+ filter: (query) => instance.current?.filter(query)
2694
+ }),
2695
+ []
2696
+ );
2697
+ const nodesKey = JSON.stringify(nodes);
2698
+ useIsomorphicLayoutEffect(() => {
2699
+ const created = createTreeView(ref.current, {
2700
+ nodes: JSON.parse(nodesKey),
2701
+ checkable,
2702
+ checked,
2703
+ expanded,
2704
+ selected,
2705
+ search,
2706
+ label,
2707
+ loadChildren: loadChildren ? (node) => load.current?.(node) ?? [] : void 0,
2708
+ renderLabel: renderLabel ? (node, element, query) => draw.current?.(node, element, query) : void 0,
2709
+ searchText: searchText ? (node) => text.current?.(node) ?? node.label : void 0,
2710
+ onSelect: (node) => select.current?.(node),
2711
+ onCheck: (ids) => check.current?.(ids),
2712
+ onExpand: (node, open) => expand.current?.(node, open),
2713
+ icons,
2714
+ draggable,
2715
+ onMove: (node, into) => moved.current?.(node, into)
2716
+ });
2717
+ instance.current = created;
2718
+ return () => {
2719
+ created.destroy();
2720
+ instance.current = null;
2721
+ };
2722
+ }, [checkable, String(search), label, Boolean(loadChildren), Boolean(renderLabel), Boolean(searchText), icons, draggable]);
2723
+ const first = useRef61(true);
2724
+ useIsomorphicLayoutEffect(() => {
2725
+ if (first.current) {
2726
+ first.current = false;
2727
+ return;
2728
+ }
2729
+ instance.current?.setNodes(JSON.parse(nodesKey));
2730
+ }, [nodesKey]);
2731
+ const checkedKey = JSON.stringify(checked ?? null);
2732
+ useIsomorphicLayoutEffect(() => {
2733
+ if (checked && instance.current && JSON.stringify([...instance.current.checked].sort()) !== JSON.stringify([...checked].sort())) instance.current.setChecked(checked);
2734
+ }, [checkedKey]);
2735
+ useIsomorphicLayoutEffect(() => {
2736
+ if (selected !== void 0 && instance.current && instance.current.selected !== selected) instance.current.select(selected);
2737
+ }, [selected]);
2738
+ return /* @__PURE__ */ jsx64("div", { ...props, ref, className: ["mk-tree-view", className].filter(Boolean).join(" ") });
2739
+ });
2740
+
2741
+ // src/components/file-explorer/react.tsx
2742
+ import { forwardRef as forwardRef4, useImperativeHandle as useImperativeHandle4, useRef as useRef62 } from "react";
2743
+ import { jsx as jsx65 } from "react/jsx-runtime";
2744
+ var FileExplorer = forwardRef4(function FileExplorer2({ files, rootLabel, folder, view, tree, readOnly, locale, label, onOpen, onNavigate, onSelectionChange, onViewChange, onChange, className, ...props }, handle) {
2745
+ const ref = useRef62(null);
2746
+ const instance = useRef62(null);
2747
+ const open = useLatest(onOpen);
2748
+ const navigate = useLatest(onNavigate);
2749
+ const select = useLatest(onSelectionChange);
2750
+ const switchView = useLatest(onViewChange);
2751
+ const change = useLatest(onChange);
2752
+ useImperativeHandle4(
2753
+ handle,
2754
+ () => ({
2755
+ open: (id) => instance.current?.open(id),
2756
+ up: () => instance.current?.up(),
2757
+ setView: (next) => instance.current?.setView(next),
2758
+ select: (ids) => instance.current?.select(ids),
2759
+ createFolder: (name) => instance.current?.createFolder(name) ?? null,
2760
+ rename: (id, name) => instance.current?.rename(id, name),
2761
+ remove: (ids) => instance.current?.remove(ids),
2762
+ move: (ids, to) => instance.current?.move(ids, to)
2763
+ }),
2764
+ []
2765
+ );
2766
+ const filesKey = JSON.stringify(files);
2767
+ useIsomorphicLayoutEffect(() => {
2768
+ const created = createFileExplorer(ref.current, {
2769
+ files: JSON.parse(filesKey),
2770
+ rootLabel,
2771
+ folder,
2772
+ view,
2773
+ tree,
2774
+ readOnly,
2775
+ locale,
2776
+ label,
2777
+ onOpen: (entry) => open.current?.(entry),
2778
+ onNavigate: (entry) => navigate.current?.(entry),
2779
+ onSelectionChange: (ids) => select.current?.(ids),
2780
+ onViewChange: (next) => switchView.current?.(next),
2781
+ onChange: (next, detail) => change.current?.(next, detail)
2782
+ });
2783
+ instance.current = created;
2784
+ return () => {
2785
+ created.destroy();
2786
+ instance.current = null;
2787
+ };
2788
+ }, [rootLabel, tree, readOnly, locale, label]);
2789
+ useIsomorphicLayoutEffect(() => {
2790
+ const explorer = instance.current;
2791
+ if (explorer && JSON.stringify(explorer.files) !== filesKey) explorer.setFiles(JSON.parse(filesKey));
2792
+ }, [filesKey]);
2793
+ useIsomorphicLayoutEffect(() => {
2794
+ if (view && instance.current && instance.current.view !== view) instance.current.setView(view);
2795
+ }, [view]);
2796
+ useIsomorphicLayoutEffect(() => {
2797
+ if (folder && instance.current && instance.current.folder !== folder) instance.current.open(folder);
2798
+ }, [folder]);
2799
+ return /* @__PURE__ */ jsx65("div", { ...props, ref, className: ["mk-file-explorer", className].filter(Boolean).join(" ") });
2800
+ });
2801
+
2802
+ // src/components/json-viewer/react.tsx
2803
+ import { forwardRef as forwardRef5, useImperativeHandle as useImperativeHandle5, useRef as useRef63 } from "react";
2804
+ import { jsx as jsx66 } from "react/jsx-runtime";
2805
+ var JsonViewer = forwardRef5(function JsonViewer2({ data, expandDepth, rootName, search, toolbar, sortKeys, label, onSelect, onCopy, className, ...props }, handle) {
2806
+ const ref = useRef63(null);
2807
+ const instance = useRef63(null);
2808
+ const select = useLatest(onSelect);
2809
+ const copied = useLatest(onCopy);
2810
+ const shown = useRef63(data);
2811
+ useImperativeHandle5(
2812
+ handle,
2813
+ () => ({
2814
+ expandAll: () => instance.current?.expandAll(),
2815
+ collapseAll: () => instance.current?.collapseAll(),
2816
+ reveal: (path) => instance.current?.reveal(path),
2817
+ filter: (query) => instance.current?.filter(query),
2818
+ copy: (path) => instance.current?.copy(path) ?? Promise.resolve(false)
2819
+ }),
2820
+ []
2821
+ );
2822
+ useIsomorphicLayoutEffect(() => {
2823
+ const created = createJsonViewer(ref.current, {
2824
+ data: shown.current,
2825
+ expandDepth,
2826
+ rootName,
2827
+ search,
2828
+ toolbar,
2829
+ sortKeys,
2830
+ label,
2831
+ onSelect: (path, value) => select.current?.(path, value),
2832
+ onCopy: (text, path) => copied.current?.(text, path)
2833
+ });
2834
+ instance.current = created;
2835
+ return () => {
2836
+ created.destroy();
2837
+ instance.current = null;
2838
+ };
2839
+ }, [expandDepth, rootName, String(search), toolbar, sortKeys, label]);
2840
+ useIsomorphicLayoutEffect(() => {
2841
+ if (shown.current === data) return;
2842
+ shown.current = data;
2843
+ instance.current?.setData(data);
2844
+ }, [data]);
2845
+ return /* @__PURE__ */ jsx66("div", { ...props, ref, className: ["mk-json-viewer", className].filter(Boolean).join(" ") });
2846
+ });
2847
+
2848
+ // src/components/virtual-list/react.tsx
2849
+ import { forwardRef as forwardRef6, useImperativeHandle as useImperativeHandle6, useRef as useRef64, useState as useState7 } from "react";
2850
+ import { jsx as jsx67 } from "react/jsx-runtime";
2851
+ var keyFor = (getKey, item, index) => {
2852
+ if (getKey) return getKey(item, index);
2853
+ const id = item && typeof item === "object" ? item.id : void 0;
2854
+ return typeof id === "string" || typeof id === "number" ? id : index;
2855
+ };
2856
+ function VirtualListInner({ items, renderItem, itemHeight, estimatedHeight, overscan, itemText, getKey, selectable, selected, label, emptyLabel, locale, onSelect, onActivate, onEndReached, className, ...props }, handle) {
2857
+ const ref = useRef64(null);
2858
+ const instance = useRef64(null);
2859
+ const [range, setRange] = useState7({ start: 0, end: 0 });
2860
+ const shown = useRef64(items);
2861
+ const select = useLatest(onSelect);
2862
+ const activate = useLatest(onActivate);
2863
+ const more = useLatest(onEndReached);
2864
+ const text = useLatest(itemText);
2865
+ const key = useLatest(getKey);
2866
+ useImperativeHandle6(handle, () => ({ scrollToIndex: (index, options) => instance.current?.scrollToIndex(index, options) }), []);
2867
+ const custom = Boolean(renderItem);
2868
+ useIsomorphicLayoutEffect(() => {
2869
+ const created = createVirtualList(ref.current, {
2870
+ items: shown.current,
2871
+ itemHeight,
2872
+ estimatedHeight,
2873
+ overscan,
2874
+ selectable,
2875
+ selected,
2876
+ label,
2877
+ emptyLabel,
2878
+ locale,
2879
+ itemText: itemText ? (item) => text.current?.(item) ?? "" : void 0,
2880
+ getKey: (item, index) => keyFor(key.current, item, index),
2881
+ onSelect: (keys, chosen) => select.current?.(keys, chosen),
2882
+ onActivate: (item, index) => activate.current?.(item, index),
2883
+ onEndReached: onEndReached ? () => more.current?.() : void 0,
2884
+ onRange: custom ? setRange : void 0
2885
+ });
2886
+ instance.current = created;
2887
+ return () => {
2888
+ created.destroy();
2889
+ instance.current = null;
2890
+ };
2891
+ }, [itemHeight, estimatedHeight, overscan, String(selectable), label, emptyLabel, locale, custom, Boolean(onEndReached), Boolean(itemText)]);
2892
+ useIsomorphicLayoutEffect(() => {
2893
+ if (shown.current === items) return;
2894
+ shown.current = items;
2895
+ instance.current?.setItems(items);
2896
+ }, [items]);
2897
+ const selectedKey = JSON.stringify(selected ?? null);
2898
+ useIsomorphicLayoutEffect(() => {
2899
+ if (selected && instance.current && JSON.stringify(instance.current.selected) !== JSON.stringify(selected)) instance.current.select(selected);
2900
+ }, [selectedKey]);
2901
+ useIsomorphicLayoutEffect(() => {
2902
+ if (custom) instance.current?.refresh();
2903
+ });
2904
+ return /* @__PURE__ */ jsx67("div", { ...props, ref, className: ["mk-virtual-list", className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsx67("div", { "data-mk-vl-viewport": "", children: /* @__PURE__ */ jsx67("div", { "data-mk-vl-spacer": "", children: renderItem ? items.slice(range.start, Math.min(range.end, items.length)).map((item, i) => {
2905
+ const index = range.start + i;
2906
+ return /* @__PURE__ */ jsx67("div", { "data-mk-vl-item": "", "data-index": index, children: renderItem(item, index) }, keyFor(getKey, item, index));
2907
+ }) : null }) }) });
2908
+ }
2909
+ var VirtualList = forwardRef6(VirtualListInner);
2910
+
2911
+ // src/components/resizable-panel/react.tsx
2912
+ import { Children as Children2, forwardRef as forwardRef7, useImperativeHandle as useImperativeHandle7, useRef as useRef65 } from "react";
2913
+ import { jsx as jsx68 } from "react/jsx-runtime";
2914
+ var ResizablePanel = forwardRef7(function ResizablePanel2({ orientation, sizes, min, max, collapsible, collapsed, step, storageKey, handleButtons, labels, onResize, onResizeEnd, onCollapse, className, children, ...props }, handle) {
2915
+ const ref = useRef65(null);
2916
+ const instance = useRef65(null);
2917
+ const resize = useLatest(onResize);
2918
+ const resizeEnd = useLatest(onResizeEnd);
2919
+ const collapse = useLatest(onCollapse);
2920
+ const shown = useRef65(sizes);
2921
+ useImperativeHandle7(
2922
+ handle,
2923
+ () => ({
2924
+ setSizes: (next, animate2) => instance.current?.setSizes(next, animate2),
2925
+ collapse: (index) => instance.current?.collapse(index),
2926
+ expand: (index) => instance.current?.expand(index),
2927
+ toggle: (index) => instance.current?.toggle(index),
2928
+ reset: () => instance.current?.reset()
2929
+ }),
2930
+ []
2931
+ );
2932
+ const count = Children2.count(children);
2933
+ useIsomorphicLayoutEffect(() => {
2934
+ const created = createResizablePanel(ref.current, {
2935
+ orientation,
2936
+ sizes: shown.current,
2937
+ min,
2938
+ max,
2939
+ collapsible,
2940
+ collapsed,
2941
+ step,
2942
+ storageKey,
2943
+ handleButtons,
2944
+ labels,
2945
+ onResize: (next) => resize.current?.(next),
2946
+ onResizeEnd: (next) => resizeEnd.current?.(next),
2947
+ onCollapse: (index, shut) => collapse.current?.(index, shut)
2948
+ });
2949
+ instance.current = created;
2950
+ return () => {
2951
+ created.destroy();
2952
+ instance.current = null;
2953
+ };
2954
+ }, [count, min, max, String(collapsible), step, storageKey, handleButtons, String(labels)]);
2955
+ useIsomorphicLayoutEffect(() => {
2956
+ if (orientation) instance.current?.setOrientation(orientation);
2957
+ }, [orientation]);
2958
+ const sizesKey = JSON.stringify(sizes ?? null);
2959
+ useIsomorphicLayoutEffect(() => {
2960
+ if (!sizes || JSON.stringify(shown.current ?? null) === sizesKey) return;
2961
+ shown.current = sizes;
2962
+ instance.current?.setSizes(sizes);
2963
+ }, [sizesKey]);
2964
+ return /* @__PURE__ */ jsx68("div", { ...props, ref, className: ["mk-resizable-panel", className].filter(Boolean).join(" "), children });
2965
+ });
2966
+
2967
+ // src/components/split-view/react.tsx
2968
+ import { forwardRef as forwardRef8, useImperativeHandle as useImperativeHandle8, useRef as useRef66 } from "react";
2969
+ import { jsxs as jsxs21 } from "react/jsx-runtime";
2970
+ var SplitView = forwardRef8(function SplitView2({ orientation, ratio, min, collapsible, stackBelow, storageKey, labels, onChange, onCollapse, className, children, ...props }, handle) {
2971
+ const ref = useRef66(null);
2972
+ const instance = useRef66(null);
2973
+ const change = useLatest(onChange);
2974
+ const collapse = useLatest(onCollapse);
2975
+ const shown = useRef66(ratio);
2976
+ useImperativeHandle8(
2977
+ handle,
2978
+ () => ({
2979
+ setRatio: (next, animate2) => instance.current?.setRatio(next, animate2),
2980
+ collapse: (side) => instance.current?.collapse(side),
2981
+ expand: () => instance.current?.expand(),
2982
+ toggle: (side) => instance.current?.toggle(side)
2983
+ }),
2984
+ []
2985
+ );
2986
+ useIsomorphicLayoutEffect(() => {
2987
+ const created = createSplitView(ref.current, {
2988
+ orientation,
2989
+ ratio: shown.current,
2990
+ min,
2991
+ collapsible,
2992
+ stackBelow,
2993
+ storageKey,
2994
+ labels,
2995
+ onChange: (next) => change.current?.(next),
2996
+ onCollapse: (side) => collapse.current?.(side)
2997
+ });
2998
+ instance.current = created;
2999
+ return () => {
3000
+ created.destroy();
3001
+ instance.current = null;
3002
+ };
3003
+ }, [orientation, min, String(collapsible), stackBelow, storageKey, String(labels)]);
3004
+ useIsomorphicLayoutEffect(() => {
3005
+ if (ratio === void 0 || ratio === shown.current) return;
3006
+ shown.current = ratio;
3007
+ instance.current?.setRatio(ratio);
3008
+ }, [ratio]);
3009
+ return /* @__PURE__ */ jsxs21("div", { ...props, ref, className: ["mk-split-view", className].filter(Boolean).join(" "), children: [
3010
+ children[0],
3011
+ children[1]
3012
+ ] });
3013
+ });
3014
+
3015
+ // src/components/data-table/react.tsx
3016
+ import { forwardRef as forwardRef9, useImperativeHandle as useImperativeHandle9, useRef as useRef67 } from "react";
3017
+ import { jsx as jsx69 } from "react/jsx-runtime";
3018
+ function DataTableInner({
3019
+ columns,
3020
+ rows,
3021
+ rowKey,
3022
+ caption,
3023
+ pageSize,
3024
+ pageSizes,
3025
+ selectable,
3026
+ search,
3027
+ filters,
3028
+ filter,
3029
+ columnsMenu,
3030
+ actions,
3031
+ bulkActions,
3032
+ sort,
3033
+ loading,
3034
+ emptyTitle,
3035
+ emptyDescription,
3036
+ locale,
3037
+ onSortChange,
3038
+ onSelectionChange,
3039
+ onAction,
3040
+ onBulkAction,
3041
+ onPageChange,
3042
+ onFilterChange,
3043
+ onRender,
3044
+ className,
3045
+ ...props
3046
+ }, handle) {
3047
+ const ref = useRef67(null);
3048
+ const instance = useRef67(null);
3049
+ const shown = useRef67(rows);
3050
+ const callbacks = useLatest({ onSortChange, onSelectionChange, onAction, onBulkAction, onPageChange, onFilterChange, onRender });
3051
+ useImperativeHandle9(
3052
+ handle,
3053
+ () => ({
3054
+ sortBy: (key, direction) => instance.current?.sortBy(key, direction),
3055
+ setPage: (page) => instance.current?.setPage(page),
3056
+ setPageSize: (size) => instance.current?.setPageSize(size),
3057
+ setQuery: (query) => instance.current?.setQuery(query),
3058
+ setFilter: (next) => instance.current?.setFilter(next),
3059
+ setColumnVisible: (key, visible) => instance.current?.setColumnVisible(key, visible),
3060
+ select: (ids) => instance.current?.select(ids),
3061
+ removeRows: (ids) => instance.current?.removeRows(ids),
3062
+ updateRow: (id, patch) => instance.current?.updateRow(id, patch)
3063
+ }),
3064
+ []
3065
+ );
3066
+ const columnsKey = JSON.stringify((columns ?? []).map(({ key, label, type, hidden, sortable, filterable, align, width, options: choices }) => [key, label, type, hidden, sortable, filterable, align, width, choices]));
3067
+ const setupKey = JSON.stringify([columnsKey, rowKey, caption, pageSize, pageSizes, selectable, search, filters, columnsMenu, actions, bulkActions, emptyTitle, emptyDescription, locale]);
3068
+ useIsomorphicLayoutEffect(() => {
3069
+ const created = createDataTable(ref.current, {
3070
+ columns,
3071
+ rows: shown.current,
3072
+ rowKey,
3073
+ caption,
3074
+ pageSize,
3075
+ pageSizes,
3076
+ selectable,
3077
+ search,
3078
+ filters,
3079
+ filter,
3080
+ columnsMenu,
3081
+ actions,
3082
+ bulkActions,
3083
+ sort,
3084
+ loading,
3085
+ emptyTitle,
3086
+ emptyDescription,
3087
+ locale,
3088
+ onSortChange: (next) => callbacks.current.onSortChange?.(next),
3089
+ onSelectionChange: (ids, chosen) => callbacks.current.onSelectionChange?.(ids, chosen),
3090
+ onAction: (action, row) => callbacks.current.onAction?.(action, row),
3091
+ onBulkAction: (action, chosen) => callbacks.current.onBulkAction?.(action, chosen),
3092
+ onPageChange: (page) => callbacks.current.onPageChange?.(page),
3093
+ onFilterChange: (next, query) => callbacks.current.onFilterChange?.(next, query),
3094
+ onRender: (body) => callbacks.current.onRender?.(body)
3095
+ });
3096
+ instance.current = created;
3097
+ return () => {
3098
+ created.destroy();
3099
+ instance.current = null;
3100
+ };
3101
+ }, [setupKey]);
3102
+ useIsomorphicLayoutEffect(() => {
3103
+ if (shown.current === rows) return;
3104
+ shown.current = rows;
3105
+ instance.current?.setRows(rows);
3106
+ }, [rows]);
3107
+ useIsomorphicLayoutEffect(() => {
3108
+ instance.current?.setLoading(Boolean(loading));
3109
+ }, [loading]);
3110
+ return /* @__PURE__ */ jsx69("div", { ...props, ref, className: ["mk-data-table", className].filter(Boolean).join(" ") });
3111
+ }
3112
+ var DataTable = forwardRef9(DataTableInner);
3113
+
3114
+ // src/components/editable-table/react.tsx
3115
+ import { forwardRef as forwardRef10, useImperativeHandle as useImperativeHandle10, useRef as useRef68 } from "react";
3116
+ import { jsx as jsx70 } from "react/jsx-runtime";
3117
+ function EditableTableInner({ columns, rows, rowKey, caption, pageSize, pageSizes, selectable, search, filters, columnsMenu, actions, bulkActions, sort, emptyTitle, emptyDescription, locale, onSave, onChange, newRow, onAction, onBulkAction, onSelectionChange, className, ...props }, handle) {
3118
+ const ref = useRef68(null);
3119
+ const instance = useRef68(null);
3120
+ const shown = useRef68(rows);
3121
+ const callbacks = useLatest({ onSave, onChange, newRow, onAction, onBulkAction, onSelectionChange });
3122
+ useImperativeHandle10(
3123
+ handle,
3124
+ () => ({
3125
+ edit: (id, key) => instance.current?.edit(id, key),
3126
+ setValue: (id, key, value) => instance.current?.setValue(id, key, value) ?? false,
3127
+ addRow: (values) => instance.current?.addRow(values) ?? "",
3128
+ removeRows: (ids) => instance.current?.removeRows(ids),
3129
+ save: () => instance.current?.save() ?? Promise.resolve(false),
3130
+ discard: () => instance.current?.discard()
3131
+ }),
3132
+ []
3133
+ );
3134
+ const columnsKey = JSON.stringify((columns ?? []).map(({ key, label, type, editable, editor, required, min, max, hidden, options: choices }) => [key, label, type, editable, editor, required, min, max, hidden, choices]));
3135
+ const setupKey = JSON.stringify([columnsKey, rowKey, caption, pageSize, pageSizes, selectable, search, filters, columnsMenu, actions, bulkActions, emptyTitle, emptyDescription, locale, Boolean(newRow)]);
3136
+ useIsomorphicLayoutEffect(() => {
3137
+ const created = createEditableTable(ref.current, {
3138
+ columns,
3139
+ rows: shown.current,
3140
+ rowKey,
3141
+ caption,
3142
+ pageSize,
3143
+ pageSizes,
3144
+ selectable,
3145
+ search,
3146
+ filters,
3147
+ columnsMenu,
3148
+ actions,
3149
+ bulkActions,
3150
+ sort,
3151
+ emptyTitle,
3152
+ emptyDescription,
3153
+ locale,
3154
+ onSave: (changes, next) => callbacks.current.onSave?.(changes, next),
3155
+ onChange: (changes) => callbacks.current.onChange?.(changes),
3156
+ newRow: newRow ? () => callbacks.current.newRow?.() ?? {} : void 0,
3157
+ onAction: (action, row) => callbacks.current.onAction?.(action, row),
3158
+ onBulkAction: (action, chosen) => callbacks.current.onBulkAction?.(action, chosen),
3159
+ onSelectionChange: (ids, chosen) => callbacks.current.onSelectionChange?.(ids, chosen)
3160
+ });
3161
+ instance.current = created;
3162
+ return () => {
3163
+ created.destroy();
3164
+ instance.current = null;
3165
+ };
3166
+ }, [setupKey]);
3167
+ useIsomorphicLayoutEffect(() => {
3168
+ if (shown.current === rows) return;
3169
+ shown.current = rows;
3170
+ instance.current?.setRows(rows);
3171
+ }, [rows]);
3172
+ return /* @__PURE__ */ jsx70("div", { ...props, ref, className: ["mk-data-table", "mk-editable-table", className].filter(Boolean).join(" ") });
3173
+ }
3174
+ var EditableTable = forwardRef10(EditableTableInner);
3175
+
3176
+ // src/components/rich-text-editor/react.tsx
3177
+ import { forwardRef as forwardRef11, useImperativeHandle as useImperativeHandle11, useRef as useRef69 } from "react";
3178
+ import { jsx as jsx71 } from "react/jsx-runtime";
3179
+ var RichTextEditor = forwardRef11(function RichTextEditor2({ value, placeholder, toolbar, maxLength, counter, name, label, readOnly, markdown, onChange, className, ...props }, handle) {
3180
+ const ref = useRef69(null);
3181
+ const instance = useRef69(null);
3182
+ const change = useLatest(onChange);
3183
+ const shown = useRef69(value);
3184
+ useImperativeHandle11(
3185
+ handle,
3186
+ () => ({
3187
+ focus: () => instance.current?.focus(),
3188
+ exec: (command, argument) => instance.current?.exec(command, argument),
3189
+ setValue: (html) => instance.current?.setValue(html)
3190
+ }),
3191
+ []
3192
+ );
3193
+ useIsomorphicLayoutEffect(() => {
3194
+ const created = createRichTextEditor(ref.current, {
3195
+ value: shown.current,
3196
+ placeholder,
3197
+ toolbar,
3198
+ maxLength,
3199
+ counter,
3200
+ name,
3201
+ label,
3202
+ readOnly,
3203
+ markdown,
3204
+ onChange: (html, text) => {
3205
+ shown.current = html;
3206
+ change.current?.(html, text);
3207
+ }
3208
+ });
3209
+ instance.current = created;
3210
+ return () => {
3211
+ created.destroy();
3212
+ instance.current = null;
3213
+ };
3214
+ }, [placeholder, String(toolbar), maxLength, String(counter), name, label, readOnly, markdown]);
3215
+ useIsomorphicLayoutEffect(() => {
3216
+ if (value === void 0 || value === shown.current) return;
3217
+ shown.current = value;
3218
+ instance.current?.setValue(value);
3219
+ }, [value]);
3220
+ return /* @__PURE__ */ jsx71("div", { ...props, ref, className: ["mk-rich-text-editor", className].filter(Boolean).join(" ") });
3221
+ });
3222
+
3223
+ // src/components/select/react.tsx
3224
+ import { useRef as useRef70 } from "react";
3225
+ import { jsx as jsx72 } from "react/jsx-runtime";
3226
+ function Select({ options, value, defaultValue, name, label, placeholder, disabled, onChange, className, ...props }) {
3227
+ const ref = useRef70(null);
3228
+ const instance = useRef70(null);
3229
+ const change = useLatest(onChange);
3230
+ const start = useRef70(value ?? defaultValue);
3231
+ const key = JSON.stringify(options ?? null);
3232
+ useIsomorphicLayoutEffect(() => {
3233
+ const created = createSelect(ref.current, { options, value: value ?? start.current, name, label, placeholder, disabled, onChange: (next) => change.current?.(next) });
3234
+ instance.current = created;
3235
+ return () => {
3236
+ start.current = created.value;
3237
+ created.destroy();
3238
+ instance.current = null;
3239
+ };
3240
+ }, [key, name, label, placeholder, disabled]);
3241
+ useIsomorphicLayoutEffect(() => {
3242
+ if (value !== void 0 && instance.current && instance.current.value !== value) instance.current.setValue(value, false);
3243
+ }, [value]);
3244
+ return /* @__PURE__ */ jsx72("div", { ...props, ref, className: ["mk-select", className].filter(Boolean).join(" ") });
3245
+ }
3246
+
3247
+ // src/components/add-to-cart/react.tsx
3248
+ import { useRef as useRef71 } from "react";
3249
+ import { jsx as jsx73 } from "react/jsx-runtime";
3250
+ function AddToCart({ target, image, quantity, count, label, onAdd, onLand, instanceRef, className, children, ...props }) {
3251
+ const ref = useRef71(null);
3252
+ const add = useLatest(onAdd);
3253
+ const landed = useLatest(onLand);
3254
+ useIsomorphicLayoutEffect(() => {
3255
+ const created = createAddToCart(ref.current, { target, image, quantity, count, label, onAdd: (n) => add.current?.(n), onLand: (n) => landed.current?.(n) });
3256
+ if (instanceRef) instanceRef.current = created;
3257
+ return () => {
3258
+ created.destroy();
3259
+ if (instanceRef) instanceRef.current = null;
3260
+ };
3261
+ }, [typeof target === "string" ? target : null, typeof image === "string" ? image : null, quantity, label]);
3262
+ return /* @__PURE__ */ jsx73("div", { ...props, ref, className: ["mk-add-to-cart", className].filter(Boolean).join(" "), children });
3263
+ }
3264
+
3265
+ // src/components/scroll-island/react.tsx
3266
+ import { useRef as useRef72 } from "react";
3267
+ import { jsx as jsx74 } from "react/jsx-runtime";
3268
+ function ScrollIsland({ sections, reach, idle, page, onSection, className, children, ...props }) {
3269
+ const ref = useRef72(null);
3270
+ const section = useLatest(onSection);
3271
+ useIsomorphicLayoutEffect(() => {
3272
+ const created = createScrollIsland(page ? document.documentElement : ref.current, { sections, reach, idle, page, onSection: (name) => section.current?.(name) });
3273
+ return () => created.destroy();
3274
+ }, [sections, reach, idle, page]);
3275
+ if (page) return null;
3276
+ return /* @__PURE__ */ jsx74("div", { ...props, ref, className: ["mk-scroll-island", className].filter(Boolean).join(" "), children });
3277
+ }
3278
+
3279
+ // src/components/pill-button/react.tsx
3280
+ import { useRef as useRef73 } from "react";
3281
+ import { jsx as jsx75, jsxs as jsxs22 } from "react/jsx-runtime";
3282
+ function PillButton({ expand, icon, className, children, type = "button", ...props }) {
3283
+ const ref = useRef73(null);
3284
+ useIsomorphicLayoutEffect(() => {
3285
+ const instance = createPillButton(ref.current, { expand });
3286
+ return () => instance.destroy();
3287
+ }, [expand]);
3288
+ return /* @__PURE__ */ jsxs22("button", { ...props, type, ref, className: ["mk-pill-button", className].filter(Boolean).join(" "), children: [
3289
+ /* @__PURE__ */ jsx75("span", { "data-mk-pill-label": "", children }),
3290
+ icon ? /* @__PURE__ */ jsx75("span", { "data-mk-pill-icon": "", "aria-hidden": "true", children: icon }) : /* @__PURE__ */ jsx75("span", { "data-mk-pill-icon": "", "aria-hidden": "true", dangerouslySetInnerHTML: { __html: PILL_ARROW } })
3291
+ ] });
3292
+ }
3293
+
3294
+ // src/components/toolbar/react.tsx
3295
+ import { useRef as useRef74 } from "react";
3296
+ import { jsx as jsx76 } from "react/jsx-runtime";
3297
+ function Toolbar({ value, orientation, tips, onChange, instanceRef, className, children, ...props }) {
3298
+ const ref = useRef74(null);
3299
+ const changed = useLatest(onChange);
3300
+ const instance = useRef74(null);
3301
+ useIsomorphicLayoutEffect(() => {
3302
+ const created = createToolbar(ref.current, { value, orientation, tips, onChange: (next) => changed.current?.(next) });
3303
+ instance.current = created;
3304
+ if (instanceRef) instanceRef.current = created;
3305
+ return () => {
3306
+ created.destroy();
3307
+ instance.current = null;
3308
+ if (instanceRef) instanceRef.current = null;
3309
+ };
3310
+ }, [orientation, tips]);
3311
+ useIsomorphicLayoutEffect(() => {
3312
+ if (value !== void 0 && instance.current && instance.current.value !== value) instance.current.setValue(value);
3313
+ }, [value]);
3314
+ return /* @__PURE__ */ jsx76("div", { ...props, ref, className: ["mk-toolbar", className].filter(Boolean).join(" "), children });
3315
+ }
3316
+
3317
+ // src/components/bidirectional-slider/react.tsx
3318
+ import { useRef as useRef75 } from "react";
3319
+ import { jsx as jsx77 } from "react/jsx-runtime";
3320
+ function BidirectionalSlider({ min, max, origin, step, value, disabled, name, label, icons, formatValue, onInput, onChange, instanceRef, className, ...props }) {
3321
+ const ref = useRef75(null);
3322
+ const input = useLatest(onInput);
3323
+ const change = useLatest(onChange);
3324
+ const format = useLatest(formatValue);
3325
+ const instance = useRef75(null);
3326
+ useIsomorphicLayoutEffect(() => {
3327
+ const created = createBidirectionalSlider(ref.current, {
3328
+ min,
3329
+ max,
3330
+ origin,
3331
+ step,
3332
+ value,
3333
+ disabled,
3334
+ name,
3335
+ label,
3336
+ icons,
3337
+ formatValue: formatValue ? (n) => format.current(n) : void 0,
3338
+ onInput: (n) => input.current?.(n),
3339
+ onChange: (n) => change.current?.(n)
3340
+ });
3341
+ instance.current = created;
3342
+ if (instanceRef) instanceRef.current = created;
3343
+ return () => {
3344
+ created.destroy();
3345
+ instance.current = null;
3346
+ if (instanceRef) instanceRef.current = null;
3347
+ };
3348
+ }, [min, max, origin, step, disabled, name, label, icons]);
3349
+ useIsomorphicLayoutEffect(() => {
3350
+ if (value !== void 0 && instance.current && instance.current.value !== value) instance.current.setValue(value);
3351
+ }, [value]);
3352
+ return /* @__PURE__ */ jsx77("div", { ...props, ref, className: ["mk-bidirectional-slider", className].filter(Boolean).join(" ") });
3353
+ }
3354
+
3355
+ // src/components/voice-dots/react.tsx
3356
+ import { useRef as useRef76 } from "react";
3357
+ import { jsx as jsx78 } from "react/jsx-runtime";
3358
+ function VoiceDots({ state = "idle", count, colorful, size, labels, source, level, instanceRef, className, ...props }) {
3359
+ const ref = useRef76(null);
3360
+ const instance = useRef76(null);
3361
+ useIsomorphicLayoutEffect(() => {
3362
+ const created = createVoiceDots(ref.current, { state, count, colorful, size, labels });
3363
+ instance.current = created;
3364
+ if (instanceRef) instanceRef.current = created;
3365
+ return () => {
3366
+ created.destroy();
3367
+ instance.current = null;
3368
+ if (instanceRef) instanceRef.current = null;
3369
+ };
3370
+ }, [count, colorful, size]);
3371
+ useIsomorphicLayoutEffect(() => {
3372
+ if (instance.current && instance.current.state !== state) instance.current.setState(state);
3373
+ }, [state]);
3374
+ useIsomorphicLayoutEffect(() => {
3375
+ const dots = instance.current;
3376
+ if (!dots || !source) return;
3377
+ let stop = null;
3378
+ let gone = false;
3379
+ void dots.listen(source).then((done) => {
3380
+ if (gone) done();
3381
+ else stop = done;
3382
+ }).catch((error) => {
3383
+ if (!gone) ref.current?.dispatchEvent(new CustomEvent("mk:error", { bubbles: true, detail: { error } }));
3384
+ });
3385
+ return () => {
3386
+ gone = true;
3387
+ stop?.();
3388
+ };
3389
+ }, [source, count, colorful, size]);
3390
+ useIsomorphicLayoutEffect(() => {
3391
+ if (level !== void 0) instance.current?.setLevel(level);
3392
+ }, [level]);
3393
+ return /* @__PURE__ */ jsx78("div", { ...props, ref, className: ["mk-voice-dots", className].filter(Boolean).join(" ") });
3394
+ }
3395
+
3396
+ // src/components/chart/use-chart.ts
3397
+ import { useRef as useRef77 } from "react";
3398
+ function useChart(create, data, callbacks, instanceRef) {
3399
+ const ref = useRef77(null);
3400
+ const instance = useRef77(null);
3401
+ const format = useLatest(callbacks.formatValue);
3402
+ const select = useLatest(callbacks.onSelect);
3403
+ const formatted = callbacks.formatValue !== void 0;
3404
+ const key = JSON.stringify(data);
3405
+ const latest = useLatest(data);
3406
+ const options = () => ({
3407
+ ...latest.current,
3408
+ formatValue: formatted ? (value) => format.current?.(value) ?? String(value) : void 0,
3409
+ onSelect: (...args) => select.current?.(...args)
3410
+ });
3411
+ useIsomorphicLayoutEffect(() => {
3412
+ const created = create(ref.current, options());
3413
+ instance.current = created;
3414
+ if (instanceRef) instanceRef.current = created;
3415
+ return () => {
3416
+ created.destroy();
3417
+ instance.current = null;
3418
+ if (instanceRef) instanceRef.current = null;
3419
+ };
3420
+ }, []);
3421
+ const first = useRef77(true);
3422
+ useIsomorphicLayoutEffect(() => {
3423
+ if (first.current) {
3424
+ first.current = false;
3425
+ return;
3426
+ }
3427
+ instance.current?.update(options());
3428
+ }, [key, formatted]);
3429
+ return ref;
3430
+ }
3431
+
3432
+ // src/components/pie-chart/react.tsx
3433
+ import { jsx as jsx79 } from "react/jsx-runtime";
3434
+ function PieChart({ data, donut, gap, size, label, totalLabel, legend, emptyLabel, formatValue, onSelect, instanceRef, className, ...props }) {
3435
+ const ref = useChart(createPieChart, { data, donut, gap, size, label, totalLabel, legend, emptyLabel }, { formatValue, onSelect }, instanceRef);
3436
+ return /* @__PURE__ */ jsx79("div", { ...props, ref, className: ["mk-chart mk-pie-chart", className].filter(Boolean).join(" ") });
3437
+ }
3438
+
3439
+ // src/components/radar-chart/react.tsx
3440
+ import { jsx as jsx80 } from "react/jsx-runtime";
3441
+ function RadarChart({ axes, series, max, levels, grid, size, label, legend, emptyLabel, formatValue, onSelect, instanceRef, className, ...props }) {
3442
+ const ref = useChart(createRadarChart, { axes, series, max, levels, grid, size, label, legend, emptyLabel }, { formatValue, onSelect }, instanceRef);
3443
+ return /* @__PURE__ */ jsx80("div", { ...props, ref, className: ["mk-chart mk-radar-chart", className].filter(Boolean).join(" ") });
3444
+ }
3445
+
3446
+ // src/components/radial-chart/react.tsx
3447
+ import { jsx as jsx81 } from "react/jsx-runtime";
3448
+ function RadialChart({ data, max, sweep, size, thickness, label, totalLabel, legend, emptyLabel, formatValue, onSelect, instanceRef, className, ...props }) {
3449
+ const ref = useChart(createRadialChart, { data, max, sweep, size, thickness, label, totalLabel, legend, emptyLabel }, { formatValue, onSelect }, instanceRef);
3450
+ return /* @__PURE__ */ jsx81("div", { ...props, ref, className: ["mk-chart mk-radial-chart", className].filter(Boolean).join(" ") });
3451
+ }
3452
+
3453
+ // src/components/sankey-chart/react.tsx
3454
+ import { jsx as jsx82 } from "react/jsx-runtime";
3455
+ function SankeyChart({ nodes, links, height, nodeWidth, nodePadding, label, emptyLabel, formatValue, onSelect, instanceRef, className, ...props }) {
3456
+ const ref = useChart(createSankeyChart, { nodes, links, height, nodeWidth, nodePadding, label, emptyLabel }, { formatValue, onSelect }, instanceRef);
3457
+ return /* @__PURE__ */ jsx82("div", { ...props, ref, className: ["mk-chart mk-sankey-chart", className].filter(Boolean).join(" ") });
3458
+ }
3459
+
3460
+ // src/components/heatmap-chart/react.tsx
3461
+ import { jsx as jsx83 } from "react/jsx-runtime";
3462
+ function HeatmapChart({ data, end, weeks, firstDay, locale, levels, color, unit, label, legend, formatValue, emptyLabel, onSelect, instanceRef, className, ...props }) {
3463
+ const ref = useChart(createHeatmapChart, { data, end, weeks, firstDay, locale, levels, color, unit, label, legend, emptyLabel }, { formatValue, onSelect }, instanceRef);
3464
+ return /* @__PURE__ */ jsx83("div", { ...props, ref, className: ["mk-heatmap-chart", className].filter(Boolean).join(" ") });
3465
+ }
3466
+
3467
+ // src/components/orbit-menu/react.tsx
3468
+ import { useRef as useRef78 } from "react";
3469
+ import { jsx as jsx84, jsxs as jsxs23 } from "react/jsx-runtime";
3470
+ function OrbitMenu({ items, label = "Men\xFA", radius, start, closeOnSelect, onToggle, onSelect, instanceRef, className, ...props }) {
3471
+ const ref = useRef78(null);
3472
+ const toggled = useLatest(onToggle);
3473
+ const selected = useLatest(onSelect);
3474
+ const keys = items.map((item) => item.value).join("\0");
3475
+ useIsomorphicLayoutEffect(() => {
3476
+ const created = createOrbitMenu(ref.current, { radius, start, closeOnSelect, onToggle: (open) => toggled.current?.(open), onSelect: (value) => selected.current?.(value) });
3477
+ if (instanceRef) instanceRef.current = created;
3478
+ return () => {
3479
+ created.destroy();
3480
+ if (instanceRef) instanceRef.current = null;
3481
+ };
3482
+ }, [keys, radius, start, closeOnSelect]);
3483
+ return /* @__PURE__ */ jsxs23("div", { ...props, ref, className: ["mk-orbit-menu", className].filter(Boolean).join(" "), children: [
3484
+ /* @__PURE__ */ jsx84("button", { type: "button", "data-mk-orbit-toggle": "", "aria-label": label }),
3485
+ items.map((item) => /* @__PURE__ */ jsx84("button", { type: "button", "data-mk-orbit-item": "", "data-mk-value": item.value, "aria-label": item.label, children: item.icon }, item.value))
3486
+ ] });
3487
+ }
1217
3488
  export {
1218
3489
  ANIMATIONS,
3490
+ ActivityFeed,
3491
+ AddToCart,
1219
3492
  AnimatedNumber,
3493
+ Attachment,
3494
+ BidirectionalSlider,
3495
+ Breadcrumb,
1220
3496
  Calendar,
3497
+ Chart,
3498
+ ChartTooltip,
1221
3499
  Chat,
1222
3500
  ChatBackground,
3501
+ CodeBlock,
3502
+ ColorArea,
3503
+ ColorField,
3504
+ ColorPicker,
3505
+ ColorSlider,
3506
+ CommandSearch,
3507
+ ContextMenu,
3508
+ CreditCard,
1223
3509
  Cursor,
3510
+ DataTable,
3511
+ DateRangePicker,
3512
+ DateTimePicker,
1224
3513
  Dialog,
3514
+ Drawer,
3515
+ EditableTable,
3516
+ EmptyState,
3517
+ FileExplorer,
3518
+ FilterBuilder,
1225
3519
  FlipGroup,
1226
3520
  Frost,
3521
+ HeatmapChart,
3522
+ HoldConfirm,
1227
3523
  HoverCard,
3524
+ ImagePreview,
1228
3525
  InputOtp,
1229
3526
  Island,
1230
3527
  IslandDots,
3528
+ JsonViewer,
3529
+ LikeButton,
3530
+ LinkPreview,
3531
+ LoadingButton,
1231
3532
  MK_HEAD_SCRIPT,
1232
3533
  MK_THEME_HEAD_SCRIPT,
1233
3534
  Menu,
1234
3535
  MkIcon,
3536
+ MultiSelect,
1235
3537
  NAV_STYLES,
3538
+ NAV_STYLE_ALIASES,
1236
3539
  Nav,
3540
+ NotificationBell,
3541
+ OrbitMenu,
1237
3542
  Pagination,
3543
+ PasswordStrength,
3544
+ PieChart,
3545
+ PillButton,
3546
+ Popover,
3547
+ Progress,
1238
3548
  Quantity,
3549
+ Questionnaire,
3550
+ RadarChart,
3551
+ RadialChart,
3552
+ RangeCalendar,
3553
+ RangeSlider,
3554
+ ResizablePanel,
3555
+ RichTextEditor,
3556
+ SankeyChart,
3557
+ ScratchCard,
3558
+ ScrollIsland,
3559
+ Select,
3560
+ Skeleton,
1239
3561
  SlotPicker,
1240
3562
  SlotText,
3563
+ SplitView,
3564
+ StarRating,
3565
+ StatCard,
1241
3566
  Steps,
1242
3567
  StudioDock,
3568
+ SwipeActions,
3569
+ TagInput,
1243
3570
  ThemePicker,
1244
3571
  ThemeProvider,
3572
+ TimeField,
3573
+ Timeline,
1245
3574
  Toaster,
3575
+ Toolbar,
3576
+ Tooltip,
1246
3577
  Trailer,
3578
+ TreeView,
3579
+ VirtualList,
3580
+ VoiceDots,
1247
3581
  animate,
1248
3582
  clearToasts,
1249
3583
  confetti,
@@ -1253,6 +3587,7 @@ export {
1253
3587
  pileLayers,
1254
3588
  pileStyle,
1255
3589
  themeHeadScript,
3590
+ toNavStyle,
1256
3591
  toast,
1257
3592
  useActionButton,
1258
3593
  useCardDock,
@@ -1266,6 +3601,7 @@ export {
1266
3601
  useDialog,
1267
3602
  useDockPill,
1268
3603
  useDragRuler,
3604
+ useDrawer,
1269
3605
  useEditorialReveal,
1270
3606
  useFillText,
1271
3607
  useFilmHero,