aeon-ui-engine 1.0.2 → 1.1.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 (545) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/CONSUMER.md +83 -0
  3. package/INTEGRATION.md +2 -0
  4. package/README.md +56 -14
  5. package/package.json +24 -1
  6. package/packages/cli/README.md +17 -0
  7. package/packages/cli/dist/bin.d.ts +1 -0
  8. package/packages/cli/dist/bin.js +35 -0
  9. package/packages/cli/dist/chunk-IW5NT2Z2.js +103 -0
  10. package/packages/cli/dist/index.d.ts +10 -0
  11. package/packages/cli/dist/index.js +6 -0
  12. package/packages/cli/node_modules/.bin/esbuild +21 -0
  13. package/packages/cli/node_modules/.bin/jiti +21 -0
  14. package/packages/cli/node_modules/.bin/tsc +21 -0
  15. package/packages/cli/node_modules/.bin/tsserver +21 -0
  16. package/packages/cli/node_modules/.bin/tsup +21 -0
  17. package/packages/cli/node_modules/.bin/tsup-node +21 -0
  18. package/packages/cli/node_modules/.bin/tsx +21 -0
  19. package/packages/cli/node_modules/.bin/vite +21 -0
  20. package/packages/cli/node_modules/.bin/vitest +21 -0
  21. package/packages/cli/package.json +50 -0
  22. package/packages/cli/src/bin.ts +34 -0
  23. package/packages/cli/src/index.ts +1 -0
  24. package/packages/cli/src/init.ts +107 -0
  25. package/packages/cli/tsconfig.json +10 -0
  26. package/packages/core/README.md +7 -1
  27. package/packages/core/dist/index.d.ts +425 -0
  28. package/packages/core/dist/index.js +635 -0
  29. package/packages/core/node_modules/.bin/esbuild +21 -0
  30. package/packages/core/node_modules/.bin/jiti +21 -0
  31. package/packages/core/node_modules/.bin/tsc +21 -0
  32. package/packages/core/node_modules/.bin/tsserver +21 -0
  33. package/packages/core/node_modules/.bin/tsup +21 -0
  34. package/packages/core/node_modules/.bin/tsup-node +21 -0
  35. package/packages/core/node_modules/.bin/tsx +21 -0
  36. package/packages/core/node_modules/.bin/vite +21 -0
  37. package/packages/core/node_modules/.bin/vitest +21 -0
  38. package/packages/core/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
  39. package/packages/core/package.json +17 -5
  40. package/packages/core/src/anatomy.ts +196 -5
  41. package/packages/core/src/machine.test.ts +62 -1
  42. package/packages/core/src/machine.ts +93 -0
  43. package/packages/core/src/theme.ts +105 -0
  44. package/packages/geometry/dist/index.d.ts +50 -0
  45. package/packages/geometry/dist/index.js +88 -0
  46. package/packages/geometry/node_modules/.bin/esbuild +21 -0
  47. package/packages/geometry/node_modules/.bin/jiti +21 -0
  48. package/packages/geometry/node_modules/.bin/tsc +21 -0
  49. package/packages/geometry/node_modules/.bin/tsserver +21 -0
  50. package/packages/geometry/node_modules/.bin/tsup +21 -0
  51. package/packages/geometry/node_modules/.bin/tsup-node +21 -0
  52. package/packages/geometry/node_modules/.bin/tsx +21 -0
  53. package/packages/panda/aeon.css +7 -0
  54. package/packages/panda/package.json +1 -1
  55. package/packages/panda/panda.config.ts +58 -1
  56. package/packages/panda/src/recipes/app-shell.ts +137 -0
  57. package/packages/panda/src/recipes/avatar.ts +131 -0
  58. package/packages/panda/src/recipes/bar.ts +206 -0
  59. package/packages/panda/src/recipes/button-group.ts +12 -4
  60. package/packages/panda/src/recipes/button.ts +1 -0
  61. package/packages/panda/src/recipes/combobox.ts +2 -1
  62. package/packages/panda/src/recipes/composer.ts +81 -0
  63. package/packages/panda/src/recipes/content.ts +104 -0
  64. package/packages/panda/src/recipes/conversation.ts +106 -0
  65. package/packages/panda/src/recipes/entry.ts +217 -0
  66. package/packages/panda/src/recipes/field.ts +12 -2
  67. package/packages/panda/src/recipes/floating.ts +26 -13
  68. package/packages/panda/src/recipes/identity.ts +73 -0
  69. package/packages/panda/src/recipes/index.ts +15 -0
  70. package/packages/panda/src/recipes/list-row.ts +109 -0
  71. package/packages/panda/src/recipes/metric-strip.ts +80 -0
  72. package/packages/panda/src/recipes/nav.ts +155 -0
  73. package/packages/panda/src/recipes/panel.ts +156 -0
  74. package/packages/panda/src/recipes/pin-input.ts +3 -2
  75. package/packages/panda/src/recipes/profile-header.ts +120 -0
  76. package/packages/panda/src/recipes/select.ts +2 -1
  77. package/packages/panda/src/recipes/slider.ts +6 -4
  78. package/packages/panda/src/recipes/theme-switcher.ts +110 -0
  79. package/packages/panda/src/recipes/thread.ts +88 -0
  80. package/packages/panda/src/theme/catalog-types.ts +2 -0
  81. package/packages/panda/src/theme/catalog.ts +23 -0
  82. package/packages/panda/src/theme/chrome.css +2 -1
  83. package/packages/panda/src/theme/global-theme-css.ts +9 -0
  84. package/packages/panda/src/theme/omarchy.themes.ts +607 -0
  85. package/packages/panda/src/theme/palette.ts +3 -0
  86. package/packages/panda/src/theme/scrollbars.css +58 -21
  87. package/packages/panda/src/theme/themes.config.ts +39 -1
  88. package/packages/panda/styled-system/css/conditions.mjs +1 -1
  89. package/packages/panda/styled-system/css/css.mjs +1 -1
  90. package/packages/panda/styled-system/css/sva.mjs +9 -4
  91. package/packages/panda/styled-system/helpers.mjs +11 -22
  92. package/packages/panda/styled-system/jsx/create-style-context.d.ts +54 -0
  93. package/packages/panda/styled-system/jsx/create-style-context.mjs +121 -0
  94. package/packages/panda/styled-system/jsx/factory.mjs +14 -5
  95. package/packages/panda/styled-system/jsx/index.d.ts +1 -0
  96. package/packages/panda/styled-system/jsx/index.mjs +1 -0
  97. package/packages/panda/styled-system/jsx/is-valid-prop.mjs +2 -2
  98. package/packages/panda/styled-system/patterns/aspect-ratio.d.ts +0 -1
  99. package/packages/panda/styled-system/patterns/bleed.d.ts +0 -1
  100. package/packages/panda/styled-system/patterns/box.d.ts +0 -1
  101. package/packages/panda/styled-system/patterns/center.d.ts +0 -1
  102. package/packages/panda/styled-system/patterns/circle.d.ts +0 -1
  103. package/packages/panda/styled-system/patterns/container.d.ts +0 -1
  104. package/packages/panda/styled-system/patterns/cq.d.ts +0 -1
  105. package/packages/panda/styled-system/patterns/divider.d.ts +0 -1
  106. package/packages/panda/styled-system/patterns/flex.d.ts +0 -1
  107. package/packages/panda/styled-system/patterns/float.d.ts +0 -1
  108. package/packages/panda/styled-system/patterns/grid-item.d.ts +0 -1
  109. package/packages/panda/styled-system/patterns/grid.d.ts +0 -1
  110. package/packages/panda/styled-system/patterns/grid.mjs +1 -1
  111. package/packages/panda/styled-system/patterns/hstack.d.ts +0 -1
  112. package/packages/panda/styled-system/patterns/hstack.mjs +1 -1
  113. package/packages/panda/styled-system/patterns/link-overlay.d.ts +0 -1
  114. package/packages/panda/styled-system/patterns/spacer.d.ts +0 -1
  115. package/packages/panda/styled-system/patterns/spacer.mjs +6 -2
  116. package/packages/panda/styled-system/patterns/square.d.ts +0 -1
  117. package/packages/panda/styled-system/patterns/stack.d.ts +0 -1
  118. package/packages/panda/styled-system/patterns/stack.mjs +1 -1
  119. package/packages/panda/styled-system/patterns/visually-hidden.d.ts +0 -1
  120. package/packages/panda/styled-system/patterns/vstack.d.ts +0 -1
  121. package/packages/panda/styled-system/patterns/vstack.mjs +1 -1
  122. package/packages/panda/styled-system/patterns/wrap.d.ts +0 -1
  123. package/packages/panda/styled-system/patterns/wrap.mjs +1 -1
  124. package/packages/panda/styled-system/recipes/aeon-accordion.d.ts +4 -3
  125. package/packages/panda/styled-system/recipes/aeon-accordion.mjs +1 -0
  126. package/packages/panda/styled-system/recipes/aeon-app-shell.d.ts +34 -0
  127. package/packages/panda/styled-system/recipes/aeon-app-shell.mjs +70 -0
  128. package/packages/panda/styled-system/recipes/aeon-async.d.ts +4 -3
  129. package/packages/panda/styled-system/recipes/aeon-async.mjs +1 -0
  130. package/packages/panda/styled-system/recipes/aeon-avatar.d.ts +36 -0
  131. package/packages/panda/styled-system/recipes/aeon-avatar.mjs +57 -0
  132. package/packages/panda/styled-system/recipes/aeon-badge.d.ts +3 -0
  133. package/packages/panda/styled-system/recipes/aeon-bar.d.ts +40 -0
  134. package/packages/panda/styled-system/recipes/aeon-bar.mjs +77 -0
  135. package/packages/panda/styled-system/recipes/aeon-button-group.d.ts +3 -2
  136. package/packages/panda/styled-system/recipes/aeon-button.d.ts +3 -2
  137. package/packages/panda/styled-system/recipes/aeon-checkbox.d.ts +4 -1
  138. package/packages/panda/styled-system/recipes/aeon-checkbox.mjs +1 -0
  139. package/packages/panda/styled-system/recipes/aeon-combobox.d.ts +4 -3
  140. package/packages/panda/styled-system/recipes/aeon-combobox.mjs +1 -0
  141. package/packages/panda/styled-system/recipes/aeon-composer.d.ts +31 -0
  142. package/packages/panda/styled-system/recipes/aeon-composer.mjs +45 -0
  143. package/packages/panda/styled-system/recipes/aeon-content.d.ts +34 -0
  144. package/packages/panda/styled-system/recipes/aeon-content.mjs +70 -0
  145. package/packages/panda/styled-system/recipes/aeon-conversation.d.ts +31 -0
  146. package/packages/panda/styled-system/recipes/aeon-conversation.mjs +61 -0
  147. package/packages/panda/styled-system/recipes/aeon-dialog.d.ts +4 -1
  148. package/packages/panda/styled-system/recipes/aeon-dialog.mjs +1 -0
  149. package/packages/panda/styled-system/recipes/aeon-entry.d.ts +38 -0
  150. package/packages/panda/styled-system/recipes/aeon-entry.mjs +100 -0
  151. package/packages/panda/styled-system/recipes/aeon-field.d.ts +4 -3
  152. package/packages/panda/styled-system/recipes/aeon-field.mjs +1 -0
  153. package/packages/panda/styled-system/recipes/aeon-identity.d.ts +36 -0
  154. package/packages/panda/styled-system/recipes/aeon-identity.mjs +63 -0
  155. package/packages/panda/styled-system/recipes/aeon-list-row.d.ts +33 -0
  156. package/packages/panda/styled-system/recipes/aeon-list-row.mjs +49 -0
  157. package/packages/panda/styled-system/recipes/aeon-menu.d.ts +4 -1
  158. package/packages/panda/styled-system/recipes/aeon-menu.mjs +1 -0
  159. package/packages/panda/styled-system/recipes/aeon-metric-strip.d.ts +36 -0
  160. package/packages/panda/styled-system/recipes/aeon-metric-strip.mjs +54 -0
  161. package/packages/panda/styled-system/recipes/aeon-nav.d.ts +38 -0
  162. package/packages/panda/styled-system/recipes/aeon-nav.mjs +69 -0
  163. package/packages/panda/styled-system/recipes/aeon-panel.d.ts +34 -0
  164. package/packages/panda/styled-system/recipes/aeon-panel.mjs +58 -0
  165. package/packages/panda/styled-system/recipes/aeon-pin-input.d.ts +4 -1
  166. package/packages/panda/styled-system/recipes/aeon-pin-input.mjs +1 -0
  167. package/packages/panda/styled-system/recipes/aeon-popover.d.ts +4 -1
  168. package/packages/panda/styled-system/recipes/aeon-popover.mjs +1 -0
  169. package/packages/panda/styled-system/recipes/aeon-profile-header.d.ts +36 -0
  170. package/packages/panda/styled-system/recipes/aeon-profile-header.mjs +62 -0
  171. package/packages/panda/styled-system/recipes/aeon-progress.d.ts +4 -1
  172. package/packages/panda/styled-system/recipes/aeon-progress.mjs +1 -0
  173. package/packages/panda/styled-system/recipes/aeon-radio-group.d.ts +4 -1
  174. package/packages/panda/styled-system/recipes/aeon-radio-group.mjs +1 -0
  175. package/packages/panda/styled-system/recipes/aeon-scroll.d.ts +4 -3
  176. package/packages/panda/styled-system/recipes/aeon-scroll.mjs +1 -0
  177. package/packages/panda/styled-system/recipes/aeon-select.d.ts +4 -3
  178. package/packages/panda/styled-system/recipes/aeon-select.mjs +1 -0
  179. package/packages/panda/styled-system/recipes/aeon-separator.d.ts +4 -1
  180. package/packages/panda/styled-system/recipes/aeon-separator.mjs +1 -0
  181. package/packages/panda/styled-system/recipes/aeon-slider.d.ts +4 -1
  182. package/packages/panda/styled-system/recipes/aeon-slider.mjs +1 -0
  183. package/packages/panda/styled-system/recipes/aeon-switch.d.ts +4 -1
  184. package/packages/panda/styled-system/recipes/aeon-switch.mjs +1 -0
  185. package/packages/panda/styled-system/recipes/aeon-tabs.d.ts +4 -1
  186. package/packages/panda/styled-system/recipes/aeon-tabs.mjs +1 -0
  187. package/packages/panda/styled-system/recipes/aeon-theme-switcher.d.ts +34 -0
  188. package/packages/panda/styled-system/recipes/aeon-theme-switcher.mjs +59 -0
  189. package/packages/panda/styled-system/recipes/aeon-thread.d.ts +31 -0
  190. package/packages/panda/styled-system/recipes/aeon-thread.mjs +53 -0
  191. package/packages/panda/styled-system/recipes/aeon-toast.d.ts +4 -1
  192. package/packages/panda/styled-system/recipes/aeon-toast.mjs +1 -0
  193. package/packages/panda/styled-system/recipes/aeon-tooltip.d.ts +4 -1
  194. package/packages/panda/styled-system/recipes/aeon-tooltip.mjs +1 -0
  195. package/packages/panda/styled-system/recipes/index.d.ts +16 -1
  196. package/packages/panda/styled-system/recipes/index.mjs +16 -1
  197. package/packages/panda/styled-system/styles.css +2317 -450
  198. package/packages/panda/styled-system/tokens/index.mjs +43 -7
  199. package/packages/panda/styled-system/tokens/tokens.d.ts +5 -5
  200. package/packages/panda/styled-system/types/composition.d.ts +86 -23
  201. package/packages/panda/styled-system/types/conditions.d.ts +34 -10
  202. package/packages/panda/styled-system/types/csstype.d.ts +6405 -5133
  203. package/packages/panda/styled-system/types/jsx.d.ts +27 -10
  204. package/packages/panda/styled-system/types/pattern.d.ts +4 -4
  205. package/packages/panda/styled-system/types/prop-type.d.ts +11 -1
  206. package/packages/panda/styled-system/types/style-props.d.ts +2763 -2165
  207. package/packages/panda/styled-system/types/system-types.d.ts +38 -80
  208. package/packages/panda/theme-runtime.css +945 -0
  209. package/packages/primitives/dist/chunk-5S4DIRL4.js +42 -0
  210. package/packages/primitives/dist/chunk-H4KOEPYC.js +52 -0
  211. package/packages/primitives/dist/chunk-HONROWUG.js +41 -0
  212. package/packages/primitives/dist/chunk-J6JHKMVM.js +90 -0
  213. package/packages/primitives/dist/chunk-JBAG5E6W.js +46 -0
  214. package/packages/primitives/dist/chunk-LVNCD5F2.js +43 -0
  215. package/packages/primitives/dist/chunk-PB3LFHXU.js +72 -0
  216. package/packages/primitives/dist/chunk-R25CUHNF.js +46 -0
  217. package/packages/primitives/dist/chunk-RO2DMFN5.js +89 -0
  218. package/packages/primitives/dist/chunk-SZV6KGXN.js +49 -0
  219. package/packages/primitives/dist/chunk-V5D7LS4J.js +61 -0
  220. package/packages/primitives/dist/chunk-WVICCOQH.js +56 -0
  221. package/packages/primitives/dist/chunk-YBPNI2LI.js +70 -0
  222. package/packages/primitives/dist/chunk-ZMGRX64G.js +74 -0
  223. package/packages/primitives/dist/index.d.ts +15 -0
  224. package/packages/primitives/dist/index.js +82 -0
  225. package/packages/primitives/dist/machines/accordion.d.ts +34 -0
  226. package/packages/primitives/dist/machines/accordion.js +6 -0
  227. package/packages/primitives/dist/machines/app-shell.d.ts +57 -0
  228. package/packages/primitives/dist/machines/app-shell.js +8 -0
  229. package/packages/primitives/dist/machines/async.d.ts +111 -0
  230. package/packages/primitives/dist/machines/async.js +12 -0
  231. package/packages/primitives/dist/machines/button.d.ts +45 -0
  232. package/packages/primitives/dist/machines/button.js +8 -0
  233. package/packages/primitives/dist/machines/content-region.d.ts +72 -0
  234. package/packages/primitives/dist/machines/content-region.js +8 -0
  235. package/packages/primitives/dist/machines/dialog.d.ts +57 -0
  236. package/packages/primitives/dist/machines/dialog.js +6 -0
  237. package/packages/primitives/dist/machines/field.d.ts +72 -0
  238. package/packages/primitives/dist/machines/field.js +12 -0
  239. package/packages/primitives/dist/machines/panel.d.ts +50 -0
  240. package/packages/primitives/dist/machines/panel.js +6 -0
  241. package/packages/primitives/dist/machines/popover.d.ts +54 -0
  242. package/packages/primitives/dist/machines/popover.js +6 -0
  243. package/packages/primitives/dist/machines/slider.d.ts +71 -0
  244. package/packages/primitives/dist/machines/slider.js +10 -0
  245. package/packages/primitives/dist/machines/sticky-bar.d.ts +62 -0
  246. package/packages/primitives/dist/machines/sticky-bar.js +8 -0
  247. package/packages/primitives/dist/machines/tabs.d.ts +39 -0
  248. package/packages/primitives/dist/machines/tabs.js +6 -0
  249. package/packages/primitives/dist/machines/toast.d.ts +31 -0
  250. package/packages/primitives/dist/machines/toast.js +6 -0
  251. package/packages/primitives/dist/machines/toggle.d.ts +54 -0
  252. package/packages/primitives/dist/machines/toggle.js +6 -0
  253. package/packages/primitives/node_modules/.bin/esbuild +21 -0
  254. package/packages/primitives/node_modules/.bin/jiti +21 -0
  255. package/packages/primitives/node_modules/.bin/tsc +21 -0
  256. package/packages/primitives/node_modules/.bin/tsserver +21 -0
  257. package/packages/primitives/node_modules/.bin/tsup +21 -0
  258. package/packages/primitives/node_modules/.bin/tsup-node +21 -0
  259. package/packages/primitives/node_modules/.bin/tsx +21 -0
  260. package/packages/primitives/node_modules/.bin/vite +21 -0
  261. package/packages/primitives/node_modules/.bin/vitest +21 -0
  262. package/packages/primitives/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
  263. package/packages/primitives/package.json +15 -5
  264. package/packages/primitives/scripts/xstate-introspect.mjs +35 -0
  265. package/packages/primitives/src/index.ts +4 -0
  266. package/packages/primitives/src/machines/app-shell.ts +63 -0
  267. package/packages/primitives/src/machines/content-region.ts +107 -0
  268. package/packages/primitives/src/machines/panel.ts +71 -0
  269. package/packages/primitives/src/machines/sticky-bar.ts +89 -0
  270. package/packages/react/dist/index.d.ts +951 -0
  271. package/packages/react/dist/index.js +4739 -0
  272. package/packages/react/node_modules/.bin/esbuild +21 -0
  273. package/packages/react/node_modules/.bin/jiti +21 -0
  274. package/packages/react/node_modules/.bin/tsc +21 -0
  275. package/packages/react/node_modules/.bin/tsserver +21 -0
  276. package/packages/react/node_modules/.bin/tsup +21 -0
  277. package/packages/react/node_modules/.bin/tsup-node +21 -0
  278. package/packages/react/node_modules/.bin/tsx +21 -0
  279. package/packages/react/node_modules/.bin/vite +21 -0
  280. package/packages/react/node_modules/.bin/vitest +21 -0
  281. package/packages/react/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
  282. package/packages/react/package.json +18 -7
  283. package/packages/react/src/app-shell/index.tsx +154 -0
  284. package/packages/react/src/async/index.tsx +6 -1
  285. package/packages/react/src/async/map-content-state.ts +18 -0
  286. package/packages/react/src/avatar/index.tsx +19 -0
  287. package/packages/react/src/bar/index.tsx +101 -0
  288. package/packages/react/src/button/index.tsx +4 -2
  289. package/packages/react/src/composer/index.tsx +75 -0
  290. package/packages/react/src/content/index.tsx +149 -0
  291. package/packages/react/src/conversation/index.tsx +78 -0
  292. package/packages/react/src/entry/index.tsx +85 -0
  293. package/packages/react/src/field/index.tsx +31 -18
  294. package/packages/react/src/identity/index.tsx +110 -0
  295. package/packages/react/src/index.ts +15 -0
  296. package/packages/react/src/list-row/index.tsx +80 -0
  297. package/packages/react/src/metric-strip/index.tsx +88 -0
  298. package/packages/react/src/nav/index.tsx +155 -0
  299. package/packages/react/src/panel/index.tsx +267 -0
  300. package/packages/react/src/profile-header/index.tsx +91 -0
  301. package/packages/react/src/radio-group/index.tsx +19 -7
  302. package/packages/react/src/slider/index.tsx +3 -1
  303. package/packages/react/src/sticky-bar/index.tsx +135 -0
  304. package/packages/react/src/switch/index.tsx +7 -1
  305. package/packages/react/src/theme-switcher/index.tsx +227 -0
  306. package/packages/react/src/thread/index.tsx +95 -0
  307. package/packages/react/src/toast/primitives.tsx +2 -2
  308. package/packages/react/src/tooltip/tooltip.test.tsx +9 -1
  309. package/packages/react/tsconfig.json +2 -1
  310. package/packages/react-scene/dist/index.d.ts +121 -0
  311. package/packages/react-scene/dist/index.js +430 -0
  312. package/packages/react-scene/node_modules/.bin/jiti +21 -0
  313. package/packages/react-scene/node_modules/.bin/tsc +21 -0
  314. package/packages/react-scene/node_modules/.bin/tsserver +21 -0
  315. package/packages/react-scene/node_modules/.bin/tsup +21 -0
  316. package/packages/react-scene/node_modules/.bin/tsup-node +21 -0
  317. package/packages/react-scene/node_modules/.bin/tsx +21 -0
  318. package/packages/scene/dist/index.d.ts +46 -0
  319. package/packages/scene/dist/index.js +54 -0
  320. package/packages/scene/node_modules/.bin/jiti +21 -0
  321. package/packages/scene/node_modules/.bin/tsc +21 -0
  322. package/packages/scene/node_modules/.bin/tsserver +21 -0
  323. package/packages/scene/node_modules/.bin/tsup +21 -0
  324. package/packages/scene/node_modules/.bin/tsup-node +21 -0
  325. package/packages/scene/node_modules/.bin/tsx +21 -0
  326. package/packages/schemas/README.md +52 -0
  327. package/packages/schemas/dist/index.d.ts +287 -0
  328. package/packages/schemas/dist/index.js +701 -0
  329. package/packages/schemas/json/accordion.json +132 -0
  330. package/packages/schemas/json/async.json +161 -0
  331. package/packages/schemas/json/button.json +170 -0
  332. package/packages/schemas/json/catalog.json +2299 -0
  333. package/packages/schemas/json/checkbox.json +136 -0
  334. package/packages/schemas/json/combobox.json +130 -0
  335. package/packages/schemas/json/dialog.json +154 -0
  336. package/packages/schemas/json/field.json +171 -0
  337. package/packages/schemas/json/menu.json +138 -0
  338. package/packages/schemas/json/popover.json +133 -0
  339. package/packages/schemas/json/progress.json +137 -0
  340. package/packages/schemas/json/scroll.json +129 -0
  341. package/packages/schemas/json/select.json +140 -0
  342. package/packages/schemas/json/switch.json +136 -0
  343. package/packages/schemas/json/tabs.json +135 -0
  344. package/packages/schemas/json/toast.json +141 -0
  345. package/packages/schemas/json/tooltip.json +123 -0
  346. package/packages/schemas/node_modules/.bin/esbuild +21 -0
  347. package/packages/schemas/node_modules/.bin/jiti +21 -0
  348. package/packages/schemas/node_modules/.bin/tsc +21 -0
  349. package/packages/schemas/node_modules/.bin/tsserver +21 -0
  350. package/packages/schemas/node_modules/.bin/tsup +21 -0
  351. package/packages/schemas/node_modules/.bin/tsup-node +21 -0
  352. package/packages/schemas/node_modules/.bin/tsx +21 -0
  353. package/packages/schemas/node_modules/.bin/vite +21 -0
  354. package/packages/schemas/node_modules/.bin/vitest +21 -0
  355. package/packages/schemas/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
  356. package/packages/schemas/package.json +56 -0
  357. package/packages/schemas/prompts/cursorrules.md +64 -0
  358. package/packages/schemas/prompts/statecharts.md +31 -0
  359. package/packages/schemas/prompts/system.md +30 -0
  360. package/packages/schemas/registry/catalog.json +54 -0
  361. package/packages/schemas/registry/components/accordion.json +132 -0
  362. package/packages/schemas/registry/components/async.json +161 -0
  363. package/packages/schemas/registry/components/button.json +170 -0
  364. package/packages/schemas/registry/components/checkbox.json +136 -0
  365. package/packages/schemas/registry/components/combobox.json +130 -0
  366. package/packages/schemas/registry/components/dialog.json +154 -0
  367. package/packages/schemas/registry/components/field.json +171 -0
  368. package/packages/schemas/registry/components/menu.json +138 -0
  369. package/packages/schemas/registry/components/popover.json +133 -0
  370. package/packages/schemas/registry/components/progress.json +137 -0
  371. package/packages/schemas/registry/components/scroll.json +129 -0
  372. package/packages/schemas/registry/components/select.json +140 -0
  373. package/packages/schemas/registry/components/switch.json +136 -0
  374. package/packages/schemas/registry/components/tabs.json +135 -0
  375. package/packages/schemas/registry/components/toast.json +141 -0
  376. package/packages/schemas/registry/components/tooltip.json +123 -0
  377. package/packages/schemas/registry/machines/async.json +219 -0
  378. package/packages/schemas/registry/machines/buttonLifecycle.json +224 -0
  379. package/packages/schemas/registry/machines/dialog.json +143 -0
  380. package/packages/schemas/registry/machines/field.json +275 -0
  381. package/packages/schemas/scripts/emit.ts +61 -0
  382. package/packages/schemas/src/aeon-to-schema.test.ts +70 -0
  383. package/packages/schemas/src/aeon-to-schema.ts +206 -0
  384. package/packages/schemas/src/agent-bridge.ts +82 -0
  385. package/packages/schemas/src/components.ts +307 -0
  386. package/packages/schemas/src/index.test.ts +25 -0
  387. package/packages/schemas/src/index.ts +25 -0
  388. package/packages/schemas/src/prompts.ts +121 -0
  389. package/packages/schemas/src/registry.ts +73 -0
  390. package/packages/schemas/src/schema-builder.ts +87 -0
  391. package/packages/schemas/tsconfig.json +9 -0
  392. package/packages/signal/dist/index.d.ts +54 -0
  393. package/packages/signal/dist/index.js +169 -0
  394. package/packages/signal/node_modules/.bin/jiti +21 -0
  395. package/packages/signal/node_modules/.bin/tsc +21 -0
  396. package/packages/signal/node_modules/.bin/tsserver +21 -0
  397. package/packages/signal/node_modules/.bin/tsup +21 -0
  398. package/packages/signal/node_modules/.bin/tsup-node +21 -0
  399. package/packages/signal/node_modules/.bin/tsx +21 -0
  400. package/packages/site/dist/index.d.ts +31 -0
  401. package/packages/site/dist/index.js +62 -0
  402. package/packages/site/node_modules/.bin/jiti +21 -0
  403. package/packages/site/node_modules/.bin/tsc +21 -0
  404. package/packages/site/node_modules/.bin/tsserver +21 -0
  405. package/packages/site/node_modules/.bin/tsup +21 -0
  406. package/packages/site/node_modules/.bin/tsup-node +21 -0
  407. package/packages/site/node_modules/.bin/tsx +21 -0
  408. package/packages/solid/dist/index.d.ts +30 -0
  409. package/packages/solid/dist/index.js +174 -0
  410. package/packages/solid/node_modules/.bin/jiti +21 -0
  411. package/packages/solid/node_modules/.bin/tsc +21 -0
  412. package/packages/solid/node_modules/.bin/tsserver +21 -0
  413. package/packages/solid/node_modules/.bin/tsup +21 -0
  414. package/packages/solid/node_modules/.bin/tsup-node +21 -0
  415. package/packages/solid/node_modules/.bin/tsx +21 -0
  416. package/packages/solid/package.json +2 -2
  417. package/packages/surface/dist/index.d.ts +8 -0
  418. package/packages/surface/dist/index.js +14 -0
  419. package/packages/surface/node_modules/.bin/jiti +21 -0
  420. package/packages/surface/node_modules/.bin/tsc +21 -0
  421. package/packages/surface/node_modules/.bin/tsserver +21 -0
  422. package/packages/surface/node_modules/.bin/tsup +21 -0
  423. package/packages/surface/node_modules/.bin/tsup-node +21 -0
  424. package/packages/surface/node_modules/.bin/tsx +21 -0
  425. package/packages/svelte/dist/index.d.ts +12 -0
  426. package/packages/svelte/dist/index.js +15 -0
  427. package/packages/svelte/node_modules/.bin/acorn +21 -0
  428. package/packages/svelte/node_modules/.bin/esbuild +21 -0
  429. package/packages/svelte/node_modules/.bin/jiti +21 -0
  430. package/packages/svelte/node_modules/.bin/svelte-check +21 -0
  431. package/packages/svelte/node_modules/.bin/tsc +21 -0
  432. package/packages/svelte/node_modules/.bin/tsserver +21 -0
  433. package/packages/svelte/node_modules/.bin/tsup +21 -0
  434. package/packages/svelte/node_modules/.bin/tsup-node +21 -0
  435. package/packages/svelte/node_modules/.bin/tsx +21 -0
  436. package/packages/svelte/node_modules/.bin/vite +21 -0
  437. package/packages/svelte/package.json +15 -5
  438. package/packages/ui/README.md +19 -6
  439. package/packages/ui/dist/index.d.ts +445 -0
  440. package/packages/ui/dist/index.js +980 -0
  441. package/packages/ui/node_modules/.bin/jiti +21 -0
  442. package/packages/ui/node_modules/.bin/tsc +21 -0
  443. package/packages/ui/node_modules/.bin/tsserver +21 -0
  444. package/packages/ui/node_modules/.bin/tsup +21 -0
  445. package/packages/ui/node_modules/.bin/tsup-node +21 -0
  446. package/packages/ui/node_modules/.bin/tsx +21 -0
  447. package/packages/ui/src/app-shell.tsx +44 -0
  448. package/packages/ui/src/async.tsx +2 -1
  449. package/packages/ui/src/avatar.tsx +35 -0
  450. package/packages/ui/src/bar.tsx +34 -0
  451. package/packages/ui/src/composer.tsx +27 -0
  452. package/packages/ui/src/content.tsx +43 -0
  453. package/packages/ui/src/conversation.tsx +43 -0
  454. package/packages/ui/src/entry.tsx +76 -0
  455. package/packages/ui/src/field.tsx +5 -0
  456. package/packages/ui/src/identity.tsx +35 -0
  457. package/packages/ui/src/index.ts +16 -0
  458. package/packages/ui/src/list-row.tsx +30 -0
  459. package/packages/ui/src/metric-strip.tsx +29 -0
  460. package/packages/ui/src/nav.tsx +46 -0
  461. package/packages/ui/src/panel.tsx +39 -0
  462. package/packages/ui/src/profile-header.tsx +35 -0
  463. package/packages/ui/src/sticky-bar.tsx +42 -0
  464. package/packages/ui/src/switch.tsx +17 -4
  465. package/packages/ui/src/theme-switcher.tsx +41 -0
  466. package/packages/ui/src/thread.tsx +35 -0
  467. package/packages/vue/dist/index.d.ts +71 -0
  468. package/packages/vue/dist/index.js +193 -0
  469. package/packages/vue/node_modules/.bin/jiti +21 -0
  470. package/packages/vue/node_modules/.bin/tsc +21 -0
  471. package/packages/vue/node_modules/.bin/tsserver +21 -0
  472. package/packages/vue/node_modules/.bin/tsup +21 -0
  473. package/packages/vue/node_modules/.bin/tsup-node +21 -0
  474. package/packages/vue/node_modules/.bin/tsx +21 -0
  475. package/packages/vue/package.json +3 -3
  476. package/scripts/vite-aliases.mjs +179 -0
  477. package/scripts/xstate-introspect.mjs +68 -0
  478. package/.changeset/README.md +0 -23
  479. package/.changeset/combobox-and-changesets.md +0 -9
  480. package/.changeset/config.json +0 -31
  481. package/.changeset/framework-adapters.md +0 -12
  482. package/.changeset/scene-3d.md +0 -6
  483. package/.changeset/scene-plane.md +0 -8
  484. package/.changeset/site-og.md +0 -5
  485. package/.cursor/rules/aeon-ui.mdc +0 -22
  486. package/ACCESSIBILITY.md +0 -32
  487. package/AGENTS.md +0 -226
  488. package/COMPONENTS.md +0 -41
  489. package/FRAMEWORKS.md +0 -57
  490. package/PHILOSOPHY.md +0 -71
  491. package/PUBLISHING.md +0 -105
  492. package/SCENE.md +0 -113
  493. package/STATES.md +0 -243
  494. package/apps/demo/index.html +0 -31
  495. package/apps/demo/og.config.mjs +0 -20
  496. package/apps/demo/package.json +0 -41
  497. package/apps/demo/public/favicon.svg +0 -16
  498. package/apps/demo/public/og-aeon-ui-engine.png +0 -0
  499. package/apps/demo/public/og.svg +0 -35
  500. package/apps/demo/scripts/generate-og-png.mjs +0 -62
  501. package/apps/demo/src/App.tsx +0 -31
  502. package/apps/demo/src/aeonDiagrams.ts +0 -42
  503. package/apps/demo/src/app.css +0 -16
  504. package/apps/demo/src/components/ActionCluster.tsx +0 -20
  505. package/apps/demo/src/components/AsyncMachineDemo.tsx +0 -97
  506. package/apps/demo/src/components/ButtonLifecycleDemo.tsx +0 -63
  507. package/apps/demo/src/components/CodeExample.tsx +0 -7
  508. package/apps/demo/src/components/ComboboxDemo.tsx +0 -30
  509. package/apps/demo/src/components/DiagramsSection.tsx +0 -37
  510. package/apps/demo/src/components/FieldStateDemo.tsx +0 -51
  511. package/apps/demo/src/components/GridMesh.tsx +0 -8
  512. package/apps/demo/src/components/HeroInstall.tsx +0 -13
  513. package/apps/demo/src/components/LandingFaq.tsx +0 -29
  514. package/apps/demo/src/components/LandingFooter.tsx +0 -30
  515. package/apps/demo/src/components/LandingHeader.tsx +0 -62
  516. package/apps/demo/src/components/LandingHero.tsx +0 -55
  517. package/apps/demo/src/components/LayersSection.tsx +0 -47
  518. package/apps/demo/src/components/MermaidDiagram.tsx +0 -86
  519. package/apps/demo/src/components/PhilosophySection.tsx +0 -31
  520. package/apps/demo/src/components/PlaygroundBlock.tsx +0 -18
  521. package/apps/demo/src/components/PlaygroundControlsDemo.tsx +0 -63
  522. package/apps/demo/src/components/PlaygroundSection.tsx +0 -120
  523. package/apps/demo/src/components/ScrollRegionDemo.tsx +0 -74
  524. package/apps/demo/src/components/ThemeSwitcher.tsx +0 -79
  525. package/apps/demo/src/demo-layout.css +0 -293
  526. package/apps/demo/src/landing.css +0 -1143
  527. package/apps/demo/src/main.tsx +0 -14
  528. package/apps/demo/src/nav.ts +0 -9
  529. package/apps/demo/src/site.ts +0 -218
  530. package/apps/demo/tsconfig.json +0 -17
  531. package/apps/demo/vite-plugins/og-meta.ts +0 -30
  532. package/apps/demo/vite.config.ts +0 -69
  533. package/docs/API_PATTERNS.md +0 -234
  534. package/docs/ARCHITECTURE.md +0 -125
  535. package/docs/COMPONENT_CHECKLIST.md +0 -103
  536. package/docs/FILE_MAP.md +0 -122
  537. package/docs/GLOSSARY.md +0 -125
  538. package/docs/INDEX.md +0 -53
  539. package/docs/LAYOUT_COORDINATES.md +0 -178
  540. package/docs/MACHINES.md +0 -171
  541. package/docs/MIGRATION_FROM_ARK.md +0 -295
  542. package/docs/VITE_CONSUMER.md +0 -114
  543. package/packages/react/src/async/legacy-region.tsx +0 -38
  544. package/pnpm-workspace.yaml +0 -3
  545. package/vercel.json +0 -12
@@ -0,0 +1,4739 @@
1
+ // src/button/index.tsx
2
+ import { buttonAnatomy, partAttrs } from "@aeon-ui/core";
3
+ import { forwardRef } from "react";
4
+
5
+ // src/utils/merge-props.ts
6
+ function mergeProps(...parts) {
7
+ const result = {};
8
+ for (const props of parts) {
9
+ if (!props) continue;
10
+ for (const [key, value] of Object.entries(props)) {
11
+ if (key === "className") {
12
+ result.className = [result.className, value].filter(Boolean).join(" ");
13
+ } else if (key.startsWith("on") && typeof value === "function" && typeof result[key] === "function") {
14
+ const prev = result[key];
15
+ result[key] = (...args) => {
16
+ prev(...args);
17
+ value(...args);
18
+ };
19
+ } else {
20
+ result[key] = value;
21
+ }
22
+ }
23
+ }
24
+ return result;
25
+ }
26
+
27
+ // src/button/index.tsx
28
+ import { jsx } from "react/jsx-runtime";
29
+ var Root = forwardRef(function ButtonRoot({ variant = "solid", size = "md", disabled, status = "idle", children, className, ...rest }, ref) {
30
+ const resolvedStatus = disabled ? "disabled" : status;
31
+ const isBusy = resolvedStatus === "pending";
32
+ const isLocked = resolvedStatus === "success";
33
+ return /* @__PURE__ */ jsx(
34
+ "button",
35
+ {
36
+ ref,
37
+ type: "button",
38
+ disabled: disabled || isBusy || isLocked || resolvedStatus === "disabled",
39
+ "aria-busy": isBusy || void 0,
40
+ className,
41
+ "data-aeon-variant": variant,
42
+ "data-aeon-size": size,
43
+ ...mergeProps(
44
+ partAttrs(buttonAnatomy.scope, buttonAnatomy.root, {
45
+ state: resolvedStatus,
46
+ disabled: Boolean(disabled || resolvedStatus === "disabled" || isLocked)
47
+ }),
48
+ rest
49
+ ),
50
+ children
51
+ }
52
+ );
53
+ });
54
+ var Label = forwardRef(function ButtonLabel(props, ref) {
55
+ return /* @__PURE__ */ jsx("span", { ref, ...partAttrs(buttonAnatomy.scope, buttonAnatomy.label), ...props });
56
+ });
57
+ var Icon = forwardRef(function ButtonIcon(props, ref) {
58
+ return /* @__PURE__ */ jsx("span", { ref, ...partAttrs(buttonAnatomy.scope, buttonAnatomy.icon), ...props });
59
+ });
60
+ var Group = forwardRef(function ButtonGroup({ children, ...rest }, ref) {
61
+ return /* @__PURE__ */ jsx("div", { ref, ...partAttrs(buttonAnatomy.scope, buttonAnatomy.group), ...rest, children });
62
+ });
63
+ var Button = { Root, Label, Icon, Group };
64
+
65
+ // src/switch/index.tsx
66
+ import { partAttrs as partAttrs2, switchAnatomy } from "@aeon-ui/core";
67
+ import { toggleMachine } from "@aeon-ui/primitives";
68
+ import {
69
+ createContext,
70
+ forwardRef as forwardRef2,
71
+ useContext,
72
+ useEffect,
73
+ useMemo
74
+ } from "react";
75
+
76
+ // src/hooks/use-aeon-machine.ts
77
+ import { useMachine } from "@xstate/react";
78
+ function useAeonMachine(machine, options) {
79
+ return useMachine(machine, options);
80
+ }
81
+
82
+ // src/switch/index.tsx
83
+ import { Fragment, jsx as jsx2 } from "react/jsx-runtime";
84
+ var SwitchCtx = createContext(null);
85
+ function useSwitchCtx() {
86
+ const ctx = useContext(SwitchCtx);
87
+ if (!ctx) throw new Error("Switch parts must be used within Switch.Root");
88
+ return ctx;
89
+ }
90
+ var Root2 = forwardRef2(function SwitchRoot({ checked, defaultChecked = false, disabled = false, onCheckedChange, children, className, ...rest }, ref) {
91
+ const [snapshot, send] = useAeonMachine(toggleMachine, {
92
+ input: { checked: defaultChecked, disabled }
93
+ });
94
+ const controlled = checked !== void 0;
95
+ const resolvedChecked = checked ?? snapshot.context.checked;
96
+ const pressState = snapshot.matches({ interaction: "pressed" }) ? "pressed" : "idle";
97
+ useEffect(() => {
98
+ if (checked === void 0) onCheckedChange?.(resolvedChecked);
99
+ }, [resolvedChecked, onCheckedChange, checked]);
100
+ useEffect(() => {
101
+ if (checked !== void 0) send({ type: "SET_CHECKED", checked });
102
+ }, [checked, send]);
103
+ const value = useMemo(
104
+ () => ({
105
+ checked: resolvedChecked,
106
+ disabled,
107
+ controlled,
108
+ onCheckedChange,
109
+ send,
110
+ pressState
111
+ }),
112
+ [resolvedChecked, disabled, controlled, onCheckedChange, send, pressState]
113
+ );
114
+ const toggle = () => {
115
+ if (disabled) return;
116
+ const next = !resolvedChecked;
117
+ if (controlled) onCheckedChange?.(next);
118
+ else send({ type: "TOGGLE" });
119
+ };
120
+ return /* @__PURE__ */ jsx2(SwitchCtx.Provider, { value, children: /* @__PURE__ */ jsx2(
121
+ "label",
122
+ {
123
+ ref,
124
+ className,
125
+ ...mergeProps(
126
+ partAttrs2(switchAnatomy.scope, switchAnatomy.root, {
127
+ state: `${resolvedChecked ? "checked" : "unchecked"} ${pressState}`,
128
+ disabled
129
+ }),
130
+ {
131
+ onClick: (e) => {
132
+ const target = e.target;
133
+ if (target.closest(`[data-aeon-part="${switchAnatomy.control}"]`)) return;
134
+ toggle();
135
+ }
136
+ },
137
+ rest
138
+ ),
139
+ children: children ?? /* @__PURE__ */ jsx2(Fragment, { children: /* @__PURE__ */ jsx2(Control, { children: /* @__PURE__ */ jsx2(Thumb, {}) }) })
140
+ }
141
+ ) });
142
+ });
143
+ var Control = forwardRef2(function SwitchControl({ className, onClick, onPointerDown, onPointerUp, onPointerLeave, ...rest }, ref) {
144
+ const { checked, disabled, controlled, onCheckedChange, send, pressState } = useSwitchCtx();
145
+ const toggle = () => {
146
+ if (disabled) return;
147
+ const next = !checked;
148
+ if (controlled) onCheckedChange?.(next);
149
+ else send({ type: "TOGGLE" });
150
+ };
151
+ return /* @__PURE__ */ jsx2(
152
+ "span",
153
+ {
154
+ ref,
155
+ role: "switch",
156
+ "aria-checked": checked,
157
+ tabIndex: disabled ? -1 : 0,
158
+ className,
159
+ ...mergeProps(
160
+ partAttrs2(switchAnatomy.scope, switchAnatomy.control, {
161
+ state: `${checked ? "checked" : "unchecked"} ${pressState}`,
162
+ disabled
163
+ }),
164
+ {
165
+ onClick: (e) => {
166
+ onClick?.(e);
167
+ toggle();
168
+ e.stopPropagation();
169
+ },
170
+ onPointerDown: (e) => {
171
+ onPointerDown?.(e);
172
+ if (!disabled) send({ type: "POINTER_DOWN" });
173
+ },
174
+ onPointerUp: (e) => {
175
+ onPointerUp?.(e);
176
+ send({ type: "POINTER_UP" });
177
+ },
178
+ onPointerLeave: (e) => {
179
+ onPointerLeave?.(e);
180
+ send({ type: "POINTER_LEAVE" });
181
+ },
182
+ onKeyDown: (e) => {
183
+ if (e.key === " " || e.key === "Enter") {
184
+ e.preventDefault();
185
+ toggle();
186
+ }
187
+ }
188
+ },
189
+ rest
190
+ )
191
+ }
192
+ );
193
+ });
194
+ var Thumb = forwardRef2(function SwitchThumb({ className, ...rest }, ref) {
195
+ const { checked, pressState } = useSwitchCtx();
196
+ return /* @__PURE__ */ jsx2(
197
+ "span",
198
+ {
199
+ ref,
200
+ className,
201
+ ...mergeProps(
202
+ partAttrs2(switchAnatomy.scope, switchAnatomy.thumb, {
203
+ state: `${checked ? "checked" : "unchecked"} ${pressState}`
204
+ }),
205
+ rest
206
+ )
207
+ }
208
+ );
209
+ });
210
+ var Label2 = forwardRef2(function SwitchLabel(props, ref) {
211
+ return /* @__PURE__ */ jsx2(
212
+ "span",
213
+ {
214
+ ref,
215
+ ...mergeProps(partAttrs2(switchAnatomy.scope, switchAnatomy.label), props)
216
+ }
217
+ );
218
+ });
219
+ var HiddenInput = forwardRef2(function SwitchHiddenInput(props, ref) {
220
+ const { checked } = useSwitchCtx();
221
+ return /* @__PURE__ */ jsx2(
222
+ "input",
223
+ {
224
+ ref,
225
+ type: "checkbox",
226
+ checked,
227
+ readOnly: true,
228
+ tabIndex: -1,
229
+ "aria-hidden": true,
230
+ ...mergeProps(partAttrs2(switchAnatomy.scope, switchAnatomy.hiddenInput), props)
231
+ }
232
+ );
233
+ });
234
+ var Switch = { Root: Root2, Control, Thumb, Label: Label2, HiddenInput };
235
+
236
+ // src/checkbox/index.tsx
237
+ import { checkboxAnatomy, partAttrs as partAttrs3 } from "@aeon-ui/core";
238
+ import { toggleMachine as toggleMachine2 } from "@aeon-ui/primitives";
239
+ import {
240
+ createContext as createContext2,
241
+ forwardRef as forwardRef3,
242
+ useContext as useContext2,
243
+ useEffect as useEffect2,
244
+ useMemo as useMemo2
245
+ } from "react";
246
+ import { jsx as jsx3 } from "react/jsx-runtime";
247
+ var CheckboxCtx = createContext2(null);
248
+ function useCheckboxCtx() {
249
+ const ctx = useContext2(CheckboxCtx);
250
+ if (!ctx) throw new Error("Checkbox parts must be used within Checkbox.Root");
251
+ return ctx;
252
+ }
253
+ var Root3 = forwardRef3(function CheckboxRoot({ checked, defaultChecked = false, disabled = false, onCheckedChange, children, className, ...rest }, ref) {
254
+ const [snapshot, send] = useAeonMachine(toggleMachine2, {
255
+ input: { checked: defaultChecked, disabled }
256
+ });
257
+ const resolvedChecked = checked ?? snapshot.context.checked;
258
+ useEffect2(() => {
259
+ if (checked === void 0) onCheckedChange?.(resolvedChecked);
260
+ }, [resolvedChecked, onCheckedChange, checked]);
261
+ useEffect2(() => {
262
+ if (checked !== void 0) send({ type: "SET_CHECKED", checked });
263
+ }, [checked, send]);
264
+ const value = useMemo2(
265
+ () => ({
266
+ checked: resolvedChecked,
267
+ disabled,
268
+ controlled: checked !== void 0,
269
+ onCheckedChange,
270
+ send
271
+ }),
272
+ [resolvedChecked, disabled, checked, onCheckedChange, send]
273
+ );
274
+ const toggle = () => {
275
+ if (disabled) return;
276
+ const next = !resolvedChecked;
277
+ if (checked !== void 0) onCheckedChange?.(next);
278
+ else send({ type: "TOGGLE" });
279
+ };
280
+ return /* @__PURE__ */ jsx3(CheckboxCtx.Provider, { value, children: /* @__PURE__ */ jsx3(
281
+ "label",
282
+ {
283
+ ref,
284
+ className,
285
+ ...mergeProps(
286
+ partAttrs3(checkboxAnatomy.scope, checkboxAnatomy.root, {
287
+ state: resolvedChecked ? "checked" : "unchecked",
288
+ disabled
289
+ }),
290
+ {
291
+ onClick: (e) => {
292
+ const target = e.target;
293
+ if (target.closest(`[data-aeon-part="${checkboxAnatomy.control}"]`)) return;
294
+ toggle();
295
+ }
296
+ },
297
+ rest
298
+ ),
299
+ children
300
+ }
301
+ ) });
302
+ });
303
+ var Control2 = forwardRef3(function CheckboxControl({ className, onClick, ...rest }, ref) {
304
+ const { checked, disabled, controlled, onCheckedChange, send } = useCheckboxCtx();
305
+ return /* @__PURE__ */ jsx3(
306
+ "span",
307
+ {
308
+ ref,
309
+ role: "checkbox",
310
+ "aria-checked": checked,
311
+ "aria-disabled": disabled || void 0,
312
+ tabIndex: disabled ? -1 : 0,
313
+ className,
314
+ ...mergeProps(
315
+ partAttrs3(checkboxAnatomy.scope, checkboxAnatomy.control, {
316
+ state: checked ? "checked" : "unchecked",
317
+ disabled
318
+ }),
319
+ {
320
+ onClick: (e) => {
321
+ onClick?.(e);
322
+ if (!disabled) {
323
+ const next = !checked;
324
+ if (controlled) onCheckedChange?.(next);
325
+ else send({ type: "TOGGLE" });
326
+ }
327
+ },
328
+ onKeyDown: (e) => {
329
+ if (e.key === " " || e.key === "Enter") {
330
+ e.preventDefault();
331
+ if (!disabled) {
332
+ const next = !checked;
333
+ if (controlled) onCheckedChange?.(next);
334
+ else send({ type: "TOGGLE" });
335
+ }
336
+ }
337
+ }
338
+ },
339
+ rest
340
+ )
341
+ }
342
+ );
343
+ });
344
+ var Indicator = forwardRef3(function CheckboxIndicator(props, ref) {
345
+ const { checked } = useCheckboxCtx();
346
+ if (!checked) return null;
347
+ return /* @__PURE__ */ jsx3(
348
+ "span",
349
+ {
350
+ ref,
351
+ ...mergeProps(
352
+ partAttrs3(checkboxAnatomy.scope, checkboxAnatomy.indicator, { state: "checked" }),
353
+ props
354
+ )
355
+ }
356
+ );
357
+ });
358
+ var Label3 = forwardRef3(function CheckboxLabel(props, ref) {
359
+ return /* @__PURE__ */ jsx3("span", { ref, ...mergeProps(partAttrs3(checkboxAnatomy.scope, checkboxAnatomy.label), props) });
360
+ });
361
+ var HiddenInput2 = forwardRef3(function CheckboxHiddenInput(props, ref) {
362
+ const { checked } = useCheckboxCtx();
363
+ return /* @__PURE__ */ jsx3(
364
+ "input",
365
+ {
366
+ ref,
367
+ type: "checkbox",
368
+ checked,
369
+ readOnly: true,
370
+ tabIndex: -1,
371
+ "aria-hidden": true,
372
+ ...mergeProps(partAttrs3(checkboxAnatomy.scope, checkboxAnatomy.hiddenInput), props)
373
+ }
374
+ );
375
+ });
376
+ var Checkbox = { Root: Root3, Control: Control2, Indicator, Label: Label3, HiddenInput: HiddenInput2 };
377
+
378
+ // src/dialog/index.tsx
379
+ import { dialogAnatomy, partAttrs as partAttrs4 } from "@aeon-ui/core";
380
+ import { dialogMachine } from "@aeon-ui/primitives";
381
+ import {
382
+ createContext as createContext3,
383
+ forwardRef as forwardRef4,
384
+ useContext as useContext3,
385
+ useEffect as useEffect6,
386
+ useId,
387
+ useMemo as useMemo3,
388
+ useRef
389
+ } from "react";
390
+
391
+ // src/hooks/use-focus-trap.ts
392
+ import { useEffect as useEffect3 } from "react";
393
+ var FOCUSABLE = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
394
+ function getFocusable(container) {
395
+ return Array.from(container.querySelectorAll(FOCUSABLE)).filter(
396
+ (el) => !el.hasAttribute("disabled") && el.tabIndex !== -1
397
+ );
398
+ }
399
+ function useFocusTrap(containerRef, active) {
400
+ useEffect3(() => {
401
+ if (!active || !containerRef.current) return;
402
+ const container = containerRef.current;
403
+ const previous = document.activeElement;
404
+ const focusables = getFocusable(container);
405
+ focusables[0]?.focus();
406
+ const onKeyDown = (e) => {
407
+ if (e.key !== "Tab") return;
408
+ const nodes = getFocusable(container);
409
+ if (nodes.length === 0) return;
410
+ const first = nodes[0];
411
+ const last = nodes[nodes.length - 1];
412
+ const current = document.activeElement;
413
+ if (e.shiftKey) {
414
+ if (current === first || !container.contains(current)) {
415
+ e.preventDefault();
416
+ last.focus();
417
+ }
418
+ } else if (current === last || !container.contains(current)) {
419
+ e.preventDefault();
420
+ first.focus();
421
+ }
422
+ };
423
+ document.addEventListener("keydown", onKeyDown);
424
+ return () => {
425
+ document.removeEventListener("keydown", onKeyDown);
426
+ if (previous instanceof HTMLElement && document.contains(previous)) {
427
+ previous.focus();
428
+ }
429
+ };
430
+ }, [active, containerRef]);
431
+ }
432
+
433
+ // src/hooks/use-portalled.ts
434
+ import { useEffect as useEffect4, useState } from "react";
435
+ import { createPortal } from "react-dom";
436
+ function usePortalledMount() {
437
+ const [mounted, setMounted] = useState(false);
438
+ useEffect4(() => {
439
+ setMounted(true);
440
+ }, []);
441
+ return mounted;
442
+ }
443
+ function renderPortalled(node, portalled, mounted) {
444
+ if (!portalled || !mounted) return node;
445
+ return createPortal(node, document.body);
446
+ }
447
+
448
+ // src/hooks/use-scroll-lock.ts
449
+ import { useEffect as useEffect5 } from "react";
450
+ function useScrollLock(active) {
451
+ useEffect5(() => {
452
+ if (!active) return;
453
+ const prev = document.body.style.overflow;
454
+ document.body.style.overflow = "hidden";
455
+ return () => {
456
+ document.body.style.overflow = prev;
457
+ };
458
+ }, [active]);
459
+ }
460
+
461
+ // src/dialog/index.tsx
462
+ import { jsx as jsx4 } from "react/jsx-runtime";
463
+ var DialogCtx = createContext3(null);
464
+ function useDialogCtx() {
465
+ const ctx = useContext3(DialogCtx);
466
+ if (!ctx) throw new Error("Dialog parts must be used within Dialog.Root");
467
+ return ctx;
468
+ }
469
+ var Root4 = forwardRef4(function DialogRoot({ open, defaultOpen = false, onOpenChange, children, className, ...rest }, ref) {
470
+ const [snapshot, send] = useAeonMachine(dialogMachine, {
471
+ input: { open: defaultOpen }
472
+ });
473
+ const resolvedOpen = open ?? snapshot.context.open;
474
+ const contentRef = useRef(null);
475
+ useEffect6(() => {
476
+ onOpenChange?.(resolvedOpen);
477
+ }, [resolvedOpen, onOpenChange]);
478
+ useEffect6(() => {
479
+ if (open !== void 0) {
480
+ send({ type: "SET_OPEN", open });
481
+ }
482
+ }, [open, send]);
483
+ const titleId = useId();
484
+ const descriptionId = useId();
485
+ const value = useMemo3(
486
+ () => ({ open: resolvedOpen, send, titleId, descriptionId, contentRef }),
487
+ [resolvedOpen, send, titleId, descriptionId]
488
+ );
489
+ return /* @__PURE__ */ jsx4(DialogCtx.Provider, { value, children: /* @__PURE__ */ jsx4(
490
+ "div",
491
+ {
492
+ ref,
493
+ className,
494
+ ...mergeProps(
495
+ partAttrs4(dialogAnatomy.scope, dialogAnatomy.root, {
496
+ state: resolvedOpen ? "open" : "closed"
497
+ }),
498
+ rest
499
+ ),
500
+ children
501
+ }
502
+ ) });
503
+ });
504
+ var Trigger = forwardRef4(function DialogTrigger({ onClick, ...rest }, ref) {
505
+ const { send } = useDialogCtx();
506
+ return /* @__PURE__ */ jsx4(
507
+ "button",
508
+ {
509
+ ref,
510
+ type: "button",
511
+ ...mergeProps(
512
+ partAttrs4(dialogAnatomy.scope, dialogAnatomy.trigger),
513
+ {
514
+ onClick: (e) => {
515
+ onClick?.(e);
516
+ send({ type: "OPEN" });
517
+ }
518
+ },
519
+ rest
520
+ )
521
+ }
522
+ );
523
+ });
524
+ var Portal = forwardRef4(function DialogPortal({ portalled = true, children, className, ...rest }, ref) {
525
+ const { open } = useDialogCtx();
526
+ const mounted = usePortalledMount();
527
+ useScrollLock(open);
528
+ if (!open) return null;
529
+ const node = /* @__PURE__ */ jsx4(
530
+ "div",
531
+ {
532
+ ref,
533
+ className,
534
+ ...mergeProps(partAttrs4(dialogAnatomy.scope, dialogAnatomy.portal, { state: "open" }), rest),
535
+ children
536
+ }
537
+ );
538
+ return renderPortalled(node, portalled, mounted);
539
+ });
540
+ var Backdrop = forwardRef4(function DialogBackdrop(props, ref) {
541
+ const { open, send } = useDialogCtx();
542
+ if (!open) return null;
543
+ return /* @__PURE__ */ jsx4(
544
+ "div",
545
+ {
546
+ ref,
547
+ ...mergeProps(
548
+ partAttrs4(dialogAnatomy.scope, dialogAnatomy.backdrop, { state: "open" }),
549
+ {
550
+ onClick: () => send({ type: "POINTER_DOWN_OUTSIDE" })
551
+ },
552
+ props
553
+ )
554
+ }
555
+ );
556
+ });
557
+ var Positioner = forwardRef4(function DialogPositioner(props, ref) {
558
+ const { open } = useDialogCtx();
559
+ if (!open) return null;
560
+ return /* @__PURE__ */ jsx4(
561
+ "div",
562
+ {
563
+ ref,
564
+ ...mergeProps(partAttrs4(dialogAnatomy.scope, dialogAnatomy.positioner, { state: "open" }), props)
565
+ }
566
+ );
567
+ });
568
+ var Content = forwardRef4(function DialogContent({ onKeyDown, ...rest }, ref) {
569
+ const { open, send, titleId, descriptionId, contentRef } = useDialogCtx();
570
+ useFocusTrap(contentRef, open);
571
+ useEffect6(() => {
572
+ if (open) contentRef.current?.focus();
573
+ }, [open, contentRef]);
574
+ if (!open) return null;
575
+ return /* @__PURE__ */ jsx4(
576
+ "div",
577
+ {
578
+ ref: (node) => {
579
+ contentRef.current = node;
580
+ if (typeof ref === "function") ref(node);
581
+ else if (ref) ref.current = node;
582
+ },
583
+ role: "dialog",
584
+ "aria-modal": "true",
585
+ "aria-labelledby": titleId,
586
+ "aria-describedby": descriptionId,
587
+ tabIndex: -1,
588
+ ...mergeProps(
589
+ partAttrs4(dialogAnatomy.scope, dialogAnatomy.content, { state: "open" }),
590
+ {
591
+ onKeyDown: (e) => {
592
+ onKeyDown?.(e);
593
+ if (e.key === "Escape") send({ type: "ESCAPE" });
594
+ }
595
+ },
596
+ rest
597
+ )
598
+ }
599
+ );
600
+ });
601
+ var Title = forwardRef4(function DialogTitle(props, ref) {
602
+ const { titleId } = useDialogCtx();
603
+ return /* @__PURE__ */ jsx4("h2", { ref, id: titleId, ...mergeProps(partAttrs4(dialogAnatomy.scope, dialogAnatomy.title), props) });
604
+ });
605
+ var Description = forwardRef4(
606
+ function DialogDescription(props, ref) {
607
+ const { descriptionId } = useDialogCtx();
608
+ return /* @__PURE__ */ jsx4(
609
+ "p",
610
+ {
611
+ ref,
612
+ id: descriptionId,
613
+ ...mergeProps(partAttrs4(dialogAnatomy.scope, dialogAnatomy.description), props)
614
+ }
615
+ );
616
+ }
617
+ );
618
+ var CloseTrigger = forwardRef4(
619
+ function DialogCloseTrigger({ onClick, ...rest }, ref) {
620
+ const { send } = useDialogCtx();
621
+ return /* @__PURE__ */ jsx4(
622
+ "button",
623
+ {
624
+ ref,
625
+ type: "button",
626
+ ...mergeProps(
627
+ partAttrs4(dialogAnatomy.scope, dialogAnatomy.closeTrigger),
628
+ {
629
+ "aria-label": "Close dialog",
630
+ onClick: (e) => {
631
+ onClick?.(e);
632
+ send({ type: "CLOSE" });
633
+ }
634
+ },
635
+ rest
636
+ )
637
+ }
638
+ );
639
+ }
640
+ );
641
+ var Dialog = {
642
+ Root: Root4,
643
+ Trigger,
644
+ Portal,
645
+ Backdrop,
646
+ Positioner,
647
+ Content,
648
+ Title,
649
+ Description,
650
+ CloseTrigger
651
+ };
652
+
653
+ // src/tabs/index.tsx
654
+ import { partAttrs as partAttrs5, tabsAnatomy } from "@aeon-ui/core";
655
+ import { tabsMachine } from "@aeon-ui/primitives";
656
+ import {
657
+ createContext as createContext4,
658
+ forwardRef as forwardRef5,
659
+ useContext as useContext4,
660
+ useEffect as useEffect7,
661
+ useMemo as useMemo4
662
+ } from "react";
663
+ import { jsx as jsx5 } from "react/jsx-runtime";
664
+ var TabsCtx = createContext4(null);
665
+ function useTabsCtx() {
666
+ const ctx = useContext4(TabsCtx);
667
+ if (!ctx) throw new Error("Tabs parts must be used within Tabs.Root");
668
+ return ctx;
669
+ }
670
+ var Root5 = forwardRef5(function TabsRoot({ value, defaultValue = "", onValueChange, children, className, ...rest }, ref) {
671
+ const [snapshot, send] = useAeonMachine(tabsMachine, {
672
+ input: { value: defaultValue, disabled: false }
673
+ });
674
+ const resolvedValue = value ?? snapshot.context.value;
675
+ useEffect7(() => {
676
+ onValueChange?.(resolvedValue);
677
+ }, [resolvedValue, onValueChange]);
678
+ useEffect7(() => {
679
+ if (value !== void 0) send({ type: "SET_VALUE", value });
680
+ }, [value, send]);
681
+ const ctx = useMemo4(() => ({ value: resolvedValue, send }), [resolvedValue, send]);
682
+ return /* @__PURE__ */ jsx5(TabsCtx.Provider, { value: ctx, children: /* @__PURE__ */ jsx5(
683
+ "div",
684
+ {
685
+ ref,
686
+ className,
687
+ ...mergeProps(partAttrs5(tabsAnatomy.scope, tabsAnatomy.root), rest),
688
+ children
689
+ }
690
+ ) });
691
+ });
692
+ var List = forwardRef5(function TabsList(props, ref) {
693
+ return /* @__PURE__ */ jsx5("div", { ref, role: "tablist", ...mergeProps(partAttrs5(tabsAnatomy.scope, tabsAnatomy.list), props) });
694
+ });
695
+ var Trigger2 = forwardRef5(function TabsTrigger({ value: triggerValue, onClick, ...rest }, ref) {
696
+ const { value, send } = useTabsCtx();
697
+ const selected = value === triggerValue;
698
+ return /* @__PURE__ */ jsx5(
699
+ "button",
700
+ {
701
+ ref,
702
+ type: "button",
703
+ role: "tab",
704
+ "aria-selected": selected,
705
+ "data-selected": selected ? "" : void 0,
706
+ ...mergeProps(
707
+ partAttrs5(tabsAnatomy.scope, tabsAnatomy.trigger, {
708
+ state: selected ? "selected" : "unselected",
709
+ highlighted: selected
710
+ }),
711
+ {
712
+ onClick: (e) => {
713
+ onClick?.(e);
714
+ send({ type: "SELECT", value: triggerValue });
715
+ }
716
+ },
717
+ rest
718
+ )
719
+ }
720
+ );
721
+ });
722
+ var Content2 = forwardRef5(function TabsContent({ value: contentValue, ...rest }, ref) {
723
+ const { value } = useTabsCtx();
724
+ if (value !== contentValue) return null;
725
+ return /* @__PURE__ */ jsx5(
726
+ "div",
727
+ {
728
+ ref,
729
+ role: "tabpanel",
730
+ ...mergeProps(
731
+ partAttrs5(tabsAnatomy.scope, tabsAnatomy.content, { state: "active" }),
732
+ rest
733
+ )
734
+ }
735
+ );
736
+ });
737
+ var Indicator2 = forwardRef5(function TabsIndicator(props, ref) {
738
+ return /* @__PURE__ */ jsx5("div", { ref, ...mergeProps(partAttrs5(tabsAnatomy.scope, tabsAnatomy.indicator), props) });
739
+ });
740
+ var Tabs = { Root: Root5, List, Trigger: Trigger2, Content: Content2, Indicator: Indicator2 };
741
+
742
+ // src/separator/index.tsx
743
+ import { partAttrs as partAttrs6, separatorAnatomy } from "@aeon-ui/core";
744
+ import { forwardRef as forwardRef6 } from "react";
745
+ import { jsx as jsx6 } from "react/jsx-runtime";
746
+ var Root6 = forwardRef6(function SeparatorRoot({ orientation = "horizontal", ...rest }, ref) {
747
+ return /* @__PURE__ */ jsx6(
748
+ "div",
749
+ {
750
+ ref,
751
+ role: "separator",
752
+ "aria-orientation": orientation,
753
+ ...mergeProps(partAttrs6(separatorAnatomy.scope, separatorAnatomy.root), rest)
754
+ }
755
+ );
756
+ });
757
+ var Separator = { Root: Root6 };
758
+
759
+ // src/progress/index.tsx
760
+ import { partAttrs as partAttrs7, partOnlyAttrs, progressAnatomy } from "@aeon-ui/core";
761
+ import {
762
+ createContext as createContext5,
763
+ forwardRef as forwardRef7,
764
+ useContext as useContext5,
765
+ useMemo as useMemo5
766
+ } from "react";
767
+ import { jsx as jsx7 } from "react/jsx-runtime";
768
+ var ProgressCtx = createContext5(null);
769
+ function useProgressCtx() {
770
+ const ctx = useContext5(ProgressCtx);
771
+ if (!ctx) throw new Error("Progress parts must be used within Progress.Root");
772
+ return ctx;
773
+ }
774
+ function resolveProgressState(value, max, indeterminate) {
775
+ if (indeterminate) return "loading";
776
+ if (value >= max) return "complete";
777
+ return "idle";
778
+ }
779
+ var Root7 = forwardRef7(function ProgressRoot({ value = 0, max = 100, indeterminate = false, children, className, ...rest }, ref) {
780
+ const clampedValue = Math.min(Math.max(value, 0), max);
781
+ const state = resolveProgressState(clampedValue, max, indeterminate);
782
+ const ctx = useMemo5(
783
+ () => ({ value: clampedValue, max, indeterminate, state }),
784
+ [clampedValue, max, indeterminate, state]
785
+ );
786
+ return /* @__PURE__ */ jsx7(ProgressCtx.Provider, { value: ctx, children: /* @__PURE__ */ jsx7(
787
+ "div",
788
+ {
789
+ ref,
790
+ className,
791
+ role: "progressbar",
792
+ "aria-valuemin": 0,
793
+ "aria-valuemax": max,
794
+ "aria-valuenow": indeterminate ? void 0 : clampedValue,
795
+ "aria-busy": indeterminate || void 0,
796
+ ...mergeProps(
797
+ partAttrs7(progressAnatomy.scope, progressAnatomy.root, { state }),
798
+ rest
799
+ ),
800
+ children
801
+ }
802
+ ) });
803
+ });
804
+ var Track = forwardRef7(function ProgressTrack(props, ref) {
805
+ return /* @__PURE__ */ jsx7("div", { ref, ...mergeProps(partOnlyAttrs(progressAnatomy.track), props) });
806
+ });
807
+ var Range = forwardRef7(function ProgressRange({ style, ...rest }, ref) {
808
+ const { value, max, indeterminate } = useProgressCtx();
809
+ const width = indeterminate ? void 0 : `${value / max * 100}%`;
810
+ return /* @__PURE__ */ jsx7(
811
+ "div",
812
+ {
813
+ ref,
814
+ ...mergeProps(partOnlyAttrs(progressAnatomy.range), rest, {
815
+ style: { ...style, width }
816
+ })
817
+ }
818
+ );
819
+ });
820
+ var Label4 = forwardRef7(function ProgressLabel(props, ref) {
821
+ return /* @__PURE__ */ jsx7("span", { ref, ...mergeProps(partOnlyAttrs(progressAnatomy.label), props) });
822
+ });
823
+ var Progress = { Root: Root7, Track, Range, Label: Label4 };
824
+
825
+ // src/radio-group/index.tsx
826
+ import { partAttrs as partAttrs8, partOnlyAttrs as partOnlyAttrs2, radioGroupAnatomy } from "@aeon-ui/core";
827
+ import { tabsMachine as tabsMachine2 } from "@aeon-ui/primitives";
828
+ import {
829
+ createContext as createContext6,
830
+ forwardRef as forwardRef8,
831
+ useCallback,
832
+ useContext as useContext6,
833
+ useEffect as useEffect8,
834
+ useMemo as useMemo6
835
+ } from "react";
836
+ import { jsx as jsx8 } from "react/jsx-runtime";
837
+ var RadioGroupCtx = createContext6(null);
838
+ function useRadioGroupCtx() {
839
+ const ctx = useContext6(RadioGroupCtx);
840
+ if (!ctx) throw new Error("RadioGroup parts must be used within RadioGroup.Root");
841
+ return ctx;
842
+ }
843
+ var RadioGroupItemCtx = createContext6(null);
844
+ function useRadioGroupItemCtx() {
845
+ const ctx = useContext6(RadioGroupItemCtx);
846
+ if (!ctx) throw new Error("RadioGroup item parts must be used within RadioGroup.Item");
847
+ return ctx;
848
+ }
849
+ var Root8 = forwardRef8(function RadioGroupRoot({ value, defaultValue = "", onValueChange, children, className, ...rest }, ref) {
850
+ const [snapshot, send] = useAeonMachine(tabsMachine2, {
851
+ input: { value: defaultValue, disabled: false }
852
+ });
853
+ const resolvedValue = value ?? snapshot.context.value;
854
+ const controlled = value !== void 0;
855
+ const selectValue = useCallback(
856
+ (next) => {
857
+ if (controlled) onValueChange?.(next);
858
+ else send({ type: "SELECT", value: next });
859
+ },
860
+ [controlled, onValueChange, send]
861
+ );
862
+ useEffect8(() => {
863
+ if (controlled) return;
864
+ onValueChange?.(snapshot.context.value);
865
+ }, [snapshot.context.value, controlled, onValueChange]);
866
+ useEffect8(() => {
867
+ if (value !== void 0) send({ type: "SET_VALUE", value });
868
+ }, [value, send]);
869
+ const ctx = useMemo6(() => ({ value: resolvedValue, send, selectValue }), [resolvedValue, send, selectValue]);
870
+ return /* @__PURE__ */ jsx8(RadioGroupCtx.Provider, { value: ctx, children: /* @__PURE__ */ jsx8(
871
+ "div",
872
+ {
873
+ ref,
874
+ role: "radiogroup",
875
+ className,
876
+ ...mergeProps(
877
+ partAttrs8(radioGroupAnatomy.scope, radioGroupAnatomy.root),
878
+ rest
879
+ ),
880
+ children
881
+ }
882
+ ) });
883
+ });
884
+ var Item = forwardRef8(function RadioGroupItem({ value: itemValue, children, ...rest }, ref) {
885
+ const { value } = useRadioGroupCtx();
886
+ const selected = value === itemValue;
887
+ const itemCtx = useMemo6(() => ({ value: itemValue, selected }), [itemValue, selected]);
888
+ return /* @__PURE__ */ jsx8(RadioGroupItemCtx.Provider, { value: itemCtx, children: /* @__PURE__ */ jsx8(
889
+ "div",
890
+ {
891
+ ref,
892
+ ...mergeProps(
893
+ partOnlyAttrs2(radioGroupAnatomy.item, {
894
+ state: selected ? "selected" : "unselected"
895
+ }),
896
+ rest
897
+ ),
898
+ children
899
+ }
900
+ ) });
901
+ });
902
+ var ItemControl = forwardRef8(function RadioGroupItemControl({ onClick, onKeyDown, ...rest }, ref) {
903
+ const { selectValue } = useRadioGroupCtx();
904
+ const { value: itemValue, selected } = useRadioGroupItemCtx();
905
+ const select = () => selectValue(itemValue);
906
+ return /* @__PURE__ */ jsx8(
907
+ "span",
908
+ {
909
+ ref,
910
+ role: "radio",
911
+ "aria-checked": selected,
912
+ tabIndex: selected ? 0 : -1,
913
+ ...mergeProps(
914
+ partOnlyAttrs2(radioGroupAnatomy.itemControl, {
915
+ state: selected ? "selected" : "unselected",
916
+ highlighted: selected
917
+ }),
918
+ {
919
+ onClick: (e) => {
920
+ onClick?.(e);
921
+ select();
922
+ },
923
+ onKeyDown: (e) => {
924
+ onKeyDown?.(e);
925
+ if (e.key === " " || e.key === "Enter") {
926
+ e.preventDefault();
927
+ select();
928
+ }
929
+ }
930
+ },
931
+ rest
932
+ )
933
+ }
934
+ );
935
+ });
936
+ var ItemIndicator = forwardRef8(function RadioGroupItemIndicator(props, ref) {
937
+ const { selected } = useRadioGroupItemCtx();
938
+ if (!selected) return null;
939
+ return /* @__PURE__ */ jsx8(
940
+ "span",
941
+ {
942
+ ref,
943
+ ...mergeProps(
944
+ partOnlyAttrs2(radioGroupAnatomy.itemIndicator, { state: "selected" }),
945
+ props
946
+ )
947
+ }
948
+ );
949
+ });
950
+ var ItemLabel = forwardRef8(function RadioGroupItemLabel({ onClick, ...rest }, ref) {
951
+ const { selectValue } = useRadioGroupCtx();
952
+ const { value: itemValue } = useRadioGroupItemCtx();
953
+ return /* @__PURE__ */ jsx8(
954
+ "span",
955
+ {
956
+ ref,
957
+ ...mergeProps(
958
+ partOnlyAttrs2(radioGroupAnatomy.itemLabel),
959
+ {
960
+ onClick: (e) => {
961
+ onClick?.(e);
962
+ selectValue(itemValue);
963
+ }
964
+ },
965
+ rest
966
+ )
967
+ }
968
+ );
969
+ });
970
+ var RadioGroup = { Root: Root8, Item, ItemControl, ItemIndicator, ItemLabel };
971
+
972
+ // src/slider/index.tsx
973
+ import { partAttrs as partAttrs9, partOnlyAttrs as partOnlyAttrs3, sliderAnatomy } from "@aeon-ui/core";
974
+ import { sliderMachine, snapSliderValue } from "@aeon-ui/primitives";
975
+ import {
976
+ createContext as createContext7,
977
+ forwardRef as forwardRef9,
978
+ useCallback as useCallback2,
979
+ useContext as useContext7,
980
+ useEffect as useEffect9,
981
+ useMemo as useMemo7,
982
+ useRef as useRef2
983
+ } from "react";
984
+ import { jsx as jsx9 } from "react/jsx-runtime";
985
+ var SliderCtx = createContext7(null);
986
+ function useSliderCtx() {
987
+ const ctx = useContext7(SliderCtx);
988
+ if (!ctx) throw new Error("Slider parts must be used within Slider.Root");
989
+ return ctx;
990
+ }
991
+ function percent(value, min, max) {
992
+ if (max <= min) return 0;
993
+ return (value - min) / (max - min) * 100;
994
+ }
995
+ var Root9 = forwardRef9(function SliderRoot({
996
+ value,
997
+ defaultValue,
998
+ min = 0,
999
+ max = 100,
1000
+ step = 1,
1001
+ disabled = false,
1002
+ onValueChange,
1003
+ children,
1004
+ className,
1005
+ ...rest
1006
+ }, ref) {
1007
+ const trackRef = useRef2(null);
1008
+ const [snapshot, send] = useAeonMachine(sliderMachine, {
1009
+ input: {
1010
+ value: defaultValue ?? min,
1011
+ min,
1012
+ max,
1013
+ step,
1014
+ disabled
1015
+ }
1016
+ });
1017
+ const resolvedValue = value ?? snapshot.context.value;
1018
+ const dragging = snapshot.matches({ interaction: "dragging" });
1019
+ useEffect9(() => {
1020
+ onValueChange?.(resolvedValue);
1021
+ }, [resolvedValue, onValueChange]);
1022
+ useEffect9(() => {
1023
+ if (value !== void 0) send({ type: "SET_VALUE", value });
1024
+ }, [value, send]);
1025
+ const setValueFromClientX = useCallback2(
1026
+ (clientX) => {
1027
+ const track = trackRef.current;
1028
+ if (!track || disabled) return;
1029
+ const rect = track.getBoundingClientRect();
1030
+ if (rect.width <= 0) return;
1031
+ const ratio = Math.min(1, Math.max(0, (clientX - rect.left) / rect.width));
1032
+ const next = snapSliderValue(min + ratio * (max - min), min, max, step);
1033
+ send({ type: "SET_VALUE", value: next });
1034
+ if (value === void 0) onValueChange?.(next);
1035
+ },
1036
+ [disabled, min, max, step, send, value, onValueChange]
1037
+ );
1038
+ useEffect9(() => {
1039
+ if (!dragging) return;
1040
+ const onMove = (e) => setValueFromClientX(e.clientX);
1041
+ const onUp = () => send({ type: "POINTER_UP" });
1042
+ window.addEventListener("pointermove", onMove);
1043
+ window.addEventListener("pointerup", onUp);
1044
+ return () => {
1045
+ window.removeEventListener("pointermove", onMove);
1046
+ window.removeEventListener("pointerup", onUp);
1047
+ };
1048
+ }, [dragging, setValueFromClientX, send]);
1049
+ const ctx = useMemo7(
1050
+ () => ({
1051
+ value: resolvedValue,
1052
+ min,
1053
+ max,
1054
+ step,
1055
+ disabled,
1056
+ dragging,
1057
+ send,
1058
+ onValueChange,
1059
+ setValueFromClientX,
1060
+ trackRef
1061
+ }),
1062
+ [resolvedValue, min, max, step, disabled, dragging, send, onValueChange, setValueFromClientX]
1063
+ );
1064
+ return /* @__PURE__ */ jsx9(SliderCtx.Provider, { value: ctx, children: /* @__PURE__ */ jsx9(
1065
+ "div",
1066
+ {
1067
+ ref,
1068
+ className,
1069
+ ...mergeProps(
1070
+ partAttrs9(sliderAnatomy.scope, sliderAnatomy.root, {
1071
+ state: dragging ? "dragging" : "idle",
1072
+ disabled
1073
+ }),
1074
+ rest
1075
+ ),
1076
+ children
1077
+ }
1078
+ ) });
1079
+ });
1080
+ var Track2 = forwardRef9(function SliderTrack({ onPointerDown, ...rest }, ref) {
1081
+ const { disabled, send, setValueFromClientX, trackRef } = useSliderCtx();
1082
+ return /* @__PURE__ */ jsx9(
1083
+ "div",
1084
+ {
1085
+ ref: (node) => {
1086
+ trackRef.current = node;
1087
+ if (typeof ref === "function") ref(node);
1088
+ else if (ref) ref.current = node;
1089
+ },
1090
+ ...mergeProps(
1091
+ partOnlyAttrs3(sliderAnatomy.track),
1092
+ {
1093
+ onPointerDown: (e) => {
1094
+ onPointerDown?.(e);
1095
+ if (disabled || e.button !== 0) return;
1096
+ e.currentTarget.setPointerCapture(e.pointerId);
1097
+ send({ type: "POINTER_DOWN" });
1098
+ setValueFromClientX(e.clientX);
1099
+ }
1100
+ },
1101
+ rest
1102
+ )
1103
+ }
1104
+ );
1105
+ });
1106
+ var Range2 = forwardRef9(function SliderRange({ style, ...rest }, ref) {
1107
+ const { value, min, max } = useSliderCtx();
1108
+ return /* @__PURE__ */ jsx9(
1109
+ "div",
1110
+ {
1111
+ ref,
1112
+ ...mergeProps(partOnlyAttrs3(sliderAnatomy.range), rest, {
1113
+ style: { ...style, width: `${percent(value, min, max)}%` }
1114
+ })
1115
+ }
1116
+ );
1117
+ });
1118
+ var Thumb2 = forwardRef9(function SliderThumb({ onKeyDown, onPointerDown, style, ...rest }, ref) {
1119
+ const { value, min, max, step, disabled, dragging, send, setValueFromClientX } = useSliderCtx();
1120
+ return /* @__PURE__ */ jsx9(
1121
+ "span",
1122
+ {
1123
+ ref,
1124
+ role: "slider",
1125
+ tabIndex: disabled ? -1 : 0,
1126
+ "aria-valuemin": min,
1127
+ "aria-valuemax": max,
1128
+ "aria-valuenow": value,
1129
+ "aria-disabled": disabled || void 0,
1130
+ ...mergeProps(
1131
+ partOnlyAttrs3(sliderAnatomy.thumb, { state: dragging ? "dragging" : disabled ? "disabled" : "idle" }),
1132
+ {
1133
+ style: { ...style, left: `${percent(value, min, max)}%` },
1134
+ onPointerDown: (e) => {
1135
+ onPointerDown?.(e);
1136
+ if (disabled || e.button !== 0) return;
1137
+ e.stopPropagation();
1138
+ e.currentTarget.setPointerCapture(e.pointerId);
1139
+ send({ type: "POINTER_DOWN" });
1140
+ setValueFromClientX(e.clientX);
1141
+ },
1142
+ onKeyDown: (e) => {
1143
+ onKeyDown?.(e);
1144
+ if (disabled || e.defaultPrevented) return;
1145
+ if (e.key === "ArrowRight" || e.key === "ArrowUp") {
1146
+ e.preventDefault();
1147
+ send({ type: "STEP", delta: step });
1148
+ }
1149
+ if (e.key === "ArrowLeft" || e.key === "ArrowDown") {
1150
+ e.preventDefault();
1151
+ send({ type: "STEP", delta: -step });
1152
+ }
1153
+ if (e.key === "Home") {
1154
+ e.preventDefault();
1155
+ send({ type: "HOME" });
1156
+ }
1157
+ if (e.key === "End") {
1158
+ e.preventDefault();
1159
+ send({ type: "END" });
1160
+ }
1161
+ }
1162
+ },
1163
+ rest
1164
+ )
1165
+ }
1166
+ );
1167
+ });
1168
+ var ValueText = forwardRef9(function SliderValueText(props, ref) {
1169
+ const { value } = useSliderCtx();
1170
+ return /* @__PURE__ */ jsx9("span", { ref, ...mergeProps(partOnlyAttrs3(sliderAnatomy.valueText), props), children: props.children ?? value });
1171
+ });
1172
+ var Slider = { Root: Root9, Track: Track2, Range: Range2, Thumb: Thumb2, ValueText };
1173
+
1174
+ // src/pin-input/index.tsx
1175
+ import { partAttrs as partAttrs10, partOnlyAttrs as partOnlyAttrs4, pinInputAnatomy } from "@aeon-ui/core";
1176
+ import {
1177
+ createContext as createContext8,
1178
+ forwardRef as forwardRef10,
1179
+ useCallback as useCallback3,
1180
+ useContext as useContext8,
1181
+ useEffect as useEffect10,
1182
+ useMemo as useMemo8,
1183
+ useRef as useRef3,
1184
+ useState as useState2
1185
+ } from "react";
1186
+ import { jsx as jsx10 } from "react/jsx-runtime";
1187
+ var PinInputCtx = createContext8(null);
1188
+ function usePinInputCtx() {
1189
+ const ctx = useContext8(PinInputCtx);
1190
+ if (!ctx) throw new Error("PinInput parts must be used within PinInput.Root");
1191
+ return ctx;
1192
+ }
1193
+ function normalizePinValue(raw, length) {
1194
+ return raw.replace(/\s/g, "").slice(0, length).split("");
1195
+ }
1196
+ var Root10 = forwardRef10(function PinInputRoot({
1197
+ length = 4,
1198
+ value,
1199
+ defaultValue = "",
1200
+ disabled = false,
1201
+ onValueChange,
1202
+ onComplete,
1203
+ type = "numeric",
1204
+ children,
1205
+ className,
1206
+ ...rest
1207
+ }, ref) {
1208
+ const [uncontrolled, setUncontrolled] = useState2(() => normalizePinValue(defaultValue, length));
1209
+ const inputRefs = useRef3([]);
1210
+ const controlled = value !== void 0;
1211
+ const chars = controlled ? normalizePinValue(value, length) : uncontrolled;
1212
+ while (chars.length < length) chars.push("");
1213
+ const resolved = chars.slice(0, length).join("");
1214
+ useEffect10(() => {
1215
+ onValueChange?.(resolved);
1216
+ if (resolved.length === length && !resolved.includes("")) onComplete?.(resolved);
1217
+ }, [resolved, length, onValueChange, onComplete]);
1218
+ const setChars = useCallback3(
1219
+ (next) => {
1220
+ const joined = next.slice(0, length).join("");
1221
+ if (!controlled) setUncontrolled(next.slice(0, length));
1222
+ onValueChange?.(joined);
1223
+ if (joined.length === length && !joined.includes("")) onComplete?.(joined);
1224
+ },
1225
+ [controlled, length, onValueChange, onComplete]
1226
+ );
1227
+ const setChar = useCallback3(
1228
+ (index, char) => {
1229
+ const next = [...chars.slice(0, length)];
1230
+ while (next.length < length) next.push("");
1231
+ next[index] = char;
1232
+ setChars(next);
1233
+ },
1234
+ [chars, length, setChars]
1235
+ );
1236
+ const focusInput = useCallback3((index) => {
1237
+ const el = inputRefs.current[index];
1238
+ el?.focus();
1239
+ el?.select();
1240
+ }, []);
1241
+ const registerInput = useCallback3((index, el) => {
1242
+ inputRefs.current[index] = el;
1243
+ }, []);
1244
+ const ctx = useMemo8(
1245
+ () => ({ length, values: chars.slice(0, length), disabled, type, setChar, focusInput, registerInput }),
1246
+ [length, chars, disabled, type, setChar, focusInput, registerInput]
1247
+ );
1248
+ return /* @__PURE__ */ jsx10(PinInputCtx.Provider, { value: ctx, children: /* @__PURE__ */ jsx10(
1249
+ "div",
1250
+ {
1251
+ ref,
1252
+ className,
1253
+ ...mergeProps(
1254
+ partAttrs10(pinInputAnatomy.scope, pinInputAnatomy.root, {
1255
+ state: resolved.length === length && !resolved.includes("") ? "complete" : "idle",
1256
+ disabled
1257
+ }),
1258
+ rest
1259
+ ),
1260
+ children
1261
+ }
1262
+ ) });
1263
+ });
1264
+ var Input = forwardRef10(function PinInputInput({ index, onKeyDown, onChange, onPaste, ...rest }, ref) {
1265
+ const { length, values, disabled, type, setChar, focusInput, registerInput } = usePinInputCtx();
1266
+ const value = values[index] ?? "";
1267
+ const pattern = type === "numeric" ? /^[0-9]$/ : /^[0-9a-zA-Z]$/;
1268
+ const acceptChar = (raw) => {
1269
+ if (!raw) return "";
1270
+ const char = raw.slice(-1);
1271
+ return pattern.test(char) ? char : "";
1272
+ };
1273
+ return /* @__PURE__ */ jsx10(
1274
+ "input",
1275
+ {
1276
+ ref: (node) => {
1277
+ registerInput(index, node);
1278
+ if (typeof ref === "function") ref(node);
1279
+ else if (ref) ref.current = node;
1280
+ },
1281
+ type: "text",
1282
+ inputMode: type === "numeric" ? "numeric" : "text",
1283
+ autoComplete: rest.autoComplete ?? "one-time-code",
1284
+ maxLength: 1,
1285
+ value,
1286
+ disabled,
1287
+ "aria-label": `Character ${index + 1} of ${length}`,
1288
+ ...mergeProps(partOnlyAttrs4(pinInputAnatomy.input, { state: value ? "filled" : "empty" }), rest, {
1289
+ onChange: (e) => {
1290
+ onChange?.(e);
1291
+ const char = acceptChar(e.target.value);
1292
+ setChar(index, char);
1293
+ if (char && index < length - 1) focusInput(index + 1);
1294
+ },
1295
+ onKeyDown: (e) => {
1296
+ onKeyDown?.(e);
1297
+ if (e.key === "Backspace" && !value && index > 0) {
1298
+ e.preventDefault();
1299
+ setChar(index - 1, "");
1300
+ focusInput(index - 1);
1301
+ }
1302
+ if (e.key === "ArrowLeft" && index > 0) {
1303
+ e.preventDefault();
1304
+ focusInput(index - 1);
1305
+ }
1306
+ if (e.key === "ArrowRight" && index < length - 1) {
1307
+ e.preventDefault();
1308
+ focusInput(index + 1);
1309
+ }
1310
+ },
1311
+ onPaste: (e) => {
1312
+ onPaste?.(e);
1313
+ e.preventDefault();
1314
+ const text = e.clipboardData.getData("text").replace(/\s/g, "").slice(0, length - index);
1315
+ if (!text) return;
1316
+ for (let i = 0; i < text.length && index + i < length; i++) {
1317
+ const char = acceptChar(text[i]);
1318
+ if (char) setChar(index + i, char);
1319
+ }
1320
+ focusInput(Math.min(index + text.length, length - 1));
1321
+ }
1322
+ })
1323
+ }
1324
+ );
1325
+ });
1326
+ var Group2 = forwardRef10(
1327
+ function PinInputGroup({ inputClassName, className, ...rest }, ref) {
1328
+ const { length } = usePinInputCtx();
1329
+ return /* @__PURE__ */ jsx10("div", { ref, className, ...rest, children: Array.from({ length }, (_, index) => /* @__PURE__ */ jsx10(Input, { index, className: inputClassName }, index)) });
1330
+ }
1331
+ );
1332
+ var PinInput = { Root: Root10, Input, Group: Group2 };
1333
+
1334
+ // src/accordion/index.tsx
1335
+ import { accordionAnatomy, partOnlyAttrs as partOnlyAttrs5, scopeAttrs } from "@aeon-ui/core";
1336
+ import { accordionMachine } from "@aeon-ui/primitives";
1337
+ import {
1338
+ createContext as createContext9,
1339
+ forwardRef as forwardRef11,
1340
+ useContext as useContext9,
1341
+ useEffect as useEffect11,
1342
+ useMemo as useMemo9
1343
+ } from "react";
1344
+ import { jsx as jsx11 } from "react/jsx-runtime";
1345
+ var AccordionCtx = createContext9(null);
1346
+ function useAccordionCtx() {
1347
+ const ctx = useContext9(AccordionCtx);
1348
+ if (!ctx) throw new Error("Accordion parts must be used within Accordion.Root");
1349
+ return ctx;
1350
+ }
1351
+ var Root11 = forwardRef11(function AccordionRoot({
1352
+ value,
1353
+ defaultValue = [],
1354
+ multiple = false,
1355
+ collapsible = true,
1356
+ onValueChange,
1357
+ children,
1358
+ className,
1359
+ ...rest
1360
+ }, ref) {
1361
+ const [snapshot, send] = useAeonMachine(accordionMachine, {
1362
+ input: { value: defaultValue, multiple, collapsible }
1363
+ });
1364
+ const resolvedValue = value ?? snapshot.context.value;
1365
+ useEffect11(() => {
1366
+ onValueChange?.(resolvedValue);
1367
+ }, [resolvedValue, onValueChange]);
1368
+ useEffect11(() => {
1369
+ if (value !== void 0) send({ type: "SET_VALUE", value });
1370
+ }, [value, send]);
1371
+ const ctx = useMemo9(() => ({ value: resolvedValue, send }), [resolvedValue, send]);
1372
+ return /* @__PURE__ */ jsx11(AccordionCtx.Provider, { value: ctx, children: /* @__PURE__ */ jsx11(
1373
+ "div",
1374
+ {
1375
+ ref,
1376
+ className,
1377
+ ...mergeProps(
1378
+ scopeAttrs(accordionAnatomy.scope, accordionAnatomy.root),
1379
+ rest
1380
+ ),
1381
+ children
1382
+ }
1383
+ ) });
1384
+ });
1385
+ var Item2 = forwardRef11(function AccordionItem({ value: itemValue, children, ...rest }, ref) {
1386
+ const { value } = useAccordionCtx();
1387
+ const open = value.includes(itemValue);
1388
+ return /* @__PURE__ */ jsx11(
1389
+ "div",
1390
+ {
1391
+ ref,
1392
+ ...mergeProps(
1393
+ partOnlyAttrs5(accordionAnatomy.item, {
1394
+ state: open ? "open" : "closed"
1395
+ }),
1396
+ rest
1397
+ ),
1398
+ children
1399
+ }
1400
+ );
1401
+ });
1402
+ var ItemTrigger = forwardRef11(function AccordionItemTrigger({ value: itemValue, onClick, ...rest }, ref) {
1403
+ const { value, send } = useAccordionCtx();
1404
+ const open = value.includes(itemValue);
1405
+ return /* @__PURE__ */ jsx11(
1406
+ "button",
1407
+ {
1408
+ ref,
1409
+ type: "button",
1410
+ "aria-expanded": open,
1411
+ ...mergeProps(
1412
+ partOnlyAttrs5(accordionAnatomy.itemTrigger, {
1413
+ state: open ? "open" : "closed"
1414
+ }),
1415
+ {
1416
+ onClick: (e) => {
1417
+ onClick?.(e);
1418
+ send({ type: "TOGGLE", item: itemValue });
1419
+ }
1420
+ },
1421
+ rest
1422
+ )
1423
+ }
1424
+ );
1425
+ });
1426
+ var ItemContent = forwardRef11(function AccordionItemContent({ value: itemValue, children, ...rest }, ref) {
1427
+ const { value } = useAccordionCtx();
1428
+ if (!value.includes(itemValue)) return null;
1429
+ return /* @__PURE__ */ jsx11(
1430
+ "div",
1431
+ {
1432
+ ref,
1433
+ ...mergeProps(
1434
+ partOnlyAttrs5(accordionAnatomy.itemContent, { state: "open" }),
1435
+ rest
1436
+ ),
1437
+ children
1438
+ }
1439
+ );
1440
+ });
1441
+ var ItemIndicator2 = forwardRef11(function AccordionItemIndicator(props, ref) {
1442
+ return /* @__PURE__ */ jsx11(
1443
+ "span",
1444
+ {
1445
+ ref,
1446
+ ...mergeProps(partOnlyAttrs5(accordionAnatomy.itemIndicator), props)
1447
+ }
1448
+ );
1449
+ });
1450
+ var Accordion = { Root: Root11, Item: Item2, ItemTrigger, ItemContent, ItemIndicator: ItemIndicator2 };
1451
+
1452
+ // src/async/actions.tsx
1453
+ import { asyncAnatomy, partOnlyAttrs as partOnlyAttrs6 } from "@aeon-ui/core";
1454
+ import { forwardRef as forwardRef12 } from "react";
1455
+ import { jsx as jsx12 } from "react/jsx-runtime";
1456
+ var AsyncActions = forwardRef12(function AsyncActions2({ children, className, ...rest }, ref) {
1457
+ return /* @__PURE__ */ jsx12(
1458
+ "div",
1459
+ {
1460
+ ref,
1461
+ className,
1462
+ ...mergeProps(partOnlyAttrs6(asyncAnatomy.actions), rest),
1463
+ children
1464
+ }
1465
+ );
1466
+ });
1467
+
1468
+ // src/async/context.tsx
1469
+ import { createAsyncMachine } from "@aeon-ui/primitives";
1470
+ import { createContext as createContext10, useContext as useContext10, useMemo as useMemo10 } from "react";
1471
+ import { jsx as jsx13 } from "react/jsx-runtime";
1472
+ var defaultMachine = createAsyncMachine();
1473
+ var AsyncCtx = createContext10(null);
1474
+ function useAsyncContext() {
1475
+ const ctx = useContext10(AsyncCtx);
1476
+ if (!ctx) {
1477
+ throw new Error("Async compound components must be used within <Async.Root>");
1478
+ }
1479
+ return ctx;
1480
+ }
1481
+ function AsyncProvider({ children, machine }) {
1482
+ const resolvedMachine = machine ?? defaultMachine;
1483
+ const [snapshot, send] = useAeonMachine(resolvedMachine);
1484
+ const status = String(snapshot.value);
1485
+ const { data, error, stale } = snapshot.context;
1486
+ const stateAttr = stale && status === "success" ? `${status} stale` : status;
1487
+ const value = useMemo10(
1488
+ () => ({
1489
+ send,
1490
+ status,
1491
+ data,
1492
+ error,
1493
+ stale: Boolean(stale),
1494
+ stateAttr
1495
+ }),
1496
+ [send, status, data, error, stale, stateAttr]
1497
+ );
1498
+ return /* @__PURE__ */ jsx13(AsyncCtx.Provider, { value, children });
1499
+ }
1500
+
1501
+ // src/async/readout.tsx
1502
+ import { asyncAnatomy as asyncAnatomy2, partAttrs as partAttrs11, partOnlyAttrs as partOnlyAttrs7 } from "@aeon-ui/core";
1503
+ import { forwardRef as forwardRef13 } from "react";
1504
+ import { jsx as jsx14, jsxs } from "react/jsx-runtime";
1505
+ var AsyncReadout = forwardRef13(function AsyncReadout2({ children, className, ...rest }, ref) {
1506
+ const { stateAttr } = useAsyncContext();
1507
+ return /* @__PURE__ */ jsxs(
1508
+ "div",
1509
+ {
1510
+ ref,
1511
+ role: "status",
1512
+ "aria-live": "polite",
1513
+ className,
1514
+ ...mergeProps(partAttrs11(asyncAnatomy2.scope, asyncAnatomy2.readout, { state: stateAttr }), rest),
1515
+ children: [
1516
+ /* @__PURE__ */ jsx14(
1517
+ "span",
1518
+ {
1519
+ className: "aeon-async-readout__rail",
1520
+ "aria-hidden": true,
1521
+ ...partOnlyAttrs7(asyncAnatomy2.readoutRail)
1522
+ }
1523
+ ),
1524
+ /* @__PURE__ */ jsx14("div", { className: "aeon-async-readout__body", ...partOnlyAttrs7(asyncAnatomy2.readoutBody), children })
1525
+ ]
1526
+ }
1527
+ );
1528
+ });
1529
+
1530
+ // src/async/root.tsx
1531
+ import { asyncAnatomy as asyncAnatomy3, partAttrs as partAttrs12 } from "@aeon-ui/core";
1532
+ import { forwardRef as forwardRef14 } from "react";
1533
+ import { jsx as jsx15 } from "react/jsx-runtime";
1534
+ var AsyncRootInner = forwardRef14(function AsyncRootInner2({ children, className, ...rest }, ref) {
1535
+ const { stateAttr } = useAsyncContext();
1536
+ return /* @__PURE__ */ jsx15(
1537
+ "div",
1538
+ {
1539
+ ref,
1540
+ className,
1541
+ ...mergeProps(partAttrs12(asyncAnatomy3.scope, asyncAnatomy3.root, { state: stateAttr }), rest),
1542
+ children
1543
+ }
1544
+ );
1545
+ });
1546
+ var AsyncRoot = forwardRef14(function AsyncRoot2({ children, className, ...rest }, ref) {
1547
+ return /* @__PURE__ */ jsx15(AsyncProvider, { children: /* @__PURE__ */ jsx15(AsyncRootInner, { ref, className, ...rest, children }) });
1548
+ });
1549
+
1550
+ // src/async/track.tsx
1551
+ import { asyncAnatomy as asyncAnatomy4, partOnlyAttrs as partOnlyAttrs8 } from "@aeon-ui/core";
1552
+ import { ASYNC_LIFECYCLE_STATES } from "@aeon-ui/primitives";
1553
+ import { forwardRef as forwardRef15 } from "react";
1554
+ import { jsx as jsx16 } from "react/jsx-runtime";
1555
+ function segmentPhase(index, activeIndex) {
1556
+ if (activeIndex === -1) return "future";
1557
+ if (index === activeIndex) return "active";
1558
+ if (index < activeIndex) return "past";
1559
+ return "future";
1560
+ }
1561
+ var AsyncTrack = forwardRef15(function AsyncTrack2({ states = ASYNC_LIFECYCLE_STATES, className, ...rest }, ref) {
1562
+ const { status } = useAsyncContext();
1563
+ const activeIndex = states.indexOf(status);
1564
+ const { style, ...restWithoutStyle } = rest;
1565
+ return /* @__PURE__ */ jsx16(
1566
+ "div",
1567
+ {
1568
+ ref,
1569
+ role: "list",
1570
+ "aria-label": "Async lifecycle states",
1571
+ className,
1572
+ style: {
1573
+ ...style,
1574
+ ["--aeon-state-track-count"]: states.length
1575
+ },
1576
+ ...mergeProps(partOnlyAttrs8(asyncAnatomy4.track), restWithoutStyle),
1577
+ children: states.map((id, index) => {
1578
+ const phase = segmentPhase(index, activeIndex);
1579
+ return /* @__PURE__ */ jsx16(
1580
+ "span",
1581
+ {
1582
+ role: "listitem",
1583
+ "aria-current": phase === "active" ? "step" : void 0,
1584
+ title: id,
1585
+ className: `state-track__seg state-track__seg--${id} state-track__seg--${phase}`,
1586
+ ...partOnlyAttrs8(asyncAnatomy4.segment, { state: `${id} ${phase}` }),
1587
+ children: id
1588
+ },
1589
+ id
1590
+ );
1591
+ })
1592
+ }
1593
+ );
1594
+ });
1595
+
1596
+ // src/async/map-content-state.ts
1597
+ function asyncStatusToContentState(status) {
1598
+ switch (status) {
1599
+ case "loading":
1600
+ return "pending";
1601
+ case "empty":
1602
+ return "empty";
1603
+ case "failure":
1604
+ return "error";
1605
+ case "success":
1606
+ return "success";
1607
+ case "idle":
1608
+ default:
1609
+ return "idle";
1610
+ }
1611
+ }
1612
+
1613
+ // src/async/index.tsx
1614
+ import { createAsyncMachine as createAsyncMachine2 } from "@aeon-ui/primitives";
1615
+ var Async = {
1616
+ Root: AsyncRoot,
1617
+ Provider: AsyncProvider,
1618
+ Track: AsyncTrack,
1619
+ Readout: AsyncReadout,
1620
+ Actions: AsyncActions
1621
+ };
1622
+
1623
+ // src/field/index.tsx
1624
+ import { fieldAnatomy, fieldFace, fieldRegions, partAttrs as partAttrs13, partOnlyAttrs as partOnlyAttrs9 } from "@aeon-ui/core";
1625
+ import { fieldMachine } from "@aeon-ui/primitives";
1626
+ import {
1627
+ createContext as createContext11,
1628
+ forwardRef as forwardRef16,
1629
+ useContext as useContext11,
1630
+ useMemo as useMemo11
1631
+ } from "react";
1632
+ import { jsx as jsx17 } from "react/jsx-runtime";
1633
+ var FieldCtx = createContext11(null);
1634
+ function useFieldContext() {
1635
+ const ctx = useContext11(FieldCtx);
1636
+ if (!ctx) throw new Error("Field parts must be used within <Field.Root>");
1637
+ return ctx;
1638
+ }
1639
+ var Root12 = forwardRef16(function FieldRoot({ children, className, id }, ref) {
1640
+ const [snapshot, send] = useAeonMachine(fieldMachine);
1641
+ const face = fieldFace(snapshot.value);
1642
+ const regions = fieldRegions(snapshot.value);
1643
+ const invalid = regions.validation === "invalid";
1644
+ const pending = regions.submission === "pending";
1645
+ const value = useMemo11(
1646
+ () => ({
1647
+ face,
1648
+ stateAttr: face,
1649
+ interaction: regions.interaction,
1650
+ validation: regions.validation,
1651
+ submission: regions.submission,
1652
+ send,
1653
+ invalid,
1654
+ pending
1655
+ }),
1656
+ [face, regions.interaction, regions.validation, regions.submission, send, invalid, pending]
1657
+ );
1658
+ return /* @__PURE__ */ jsx17(FieldCtx.Provider, { value, children: /* @__PURE__ */ jsx17(
1659
+ "div",
1660
+ {
1661
+ ref,
1662
+ id,
1663
+ className,
1664
+ "data-aeon-interaction": regions.interaction,
1665
+ "data-aeon-validation": regions.validation,
1666
+ "data-aeon-submission": regions.submission,
1667
+ ...partAttrs13(fieldAnatomy.scope, fieldAnatomy.root, { state: face }),
1668
+ children
1669
+ }
1670
+ ) });
1671
+ });
1672
+ var Label5 = forwardRef16(function FieldLabel(props, ref) {
1673
+ return /* @__PURE__ */ jsx17("label", { ref, ...partOnlyAttrs9(fieldAnatomy.label), ...props });
1674
+ });
1675
+ var Control3 = forwardRef16(function FieldControl({ validate, onChange, onBlur, ...rest }, ref) {
1676
+ const { send, invalid } = useFieldContext();
1677
+ return /* @__PURE__ */ jsx17(
1678
+ "input",
1679
+ {
1680
+ ref,
1681
+ "aria-invalid": invalid || void 0,
1682
+ ...partOnlyAttrs9(fieldAnatomy.control),
1683
+ ...mergeProps(
1684
+ {
1685
+ onChange: (e) => {
1686
+ send({ type: "INPUT" });
1687
+ const ok = validate?.(e.target.value) ?? true;
1688
+ send({ type: "VALIDATE", valid: ok });
1689
+ onChange?.(e);
1690
+ },
1691
+ onBlur: (e) => {
1692
+ send({ type: "BLUR" });
1693
+ onBlur?.(e);
1694
+ }
1695
+ },
1696
+ rest
1697
+ )
1698
+ }
1699
+ );
1700
+ });
1701
+ var Textarea = forwardRef16(function FieldTextarea({ validate, onChange, onBlur, ...rest }, ref) {
1702
+ const { send, invalid } = useFieldContext();
1703
+ return /* @__PURE__ */ jsx17(
1704
+ "textarea",
1705
+ {
1706
+ ref,
1707
+ "aria-invalid": invalid || void 0,
1708
+ ...partOnlyAttrs9(fieldAnatomy.textarea),
1709
+ ...mergeProps(
1710
+ {
1711
+ onChange: (e) => {
1712
+ send({ type: "INPUT" });
1713
+ const ok = validate?.(e.target.value) ?? true;
1714
+ send({ type: "VALIDATE", valid: ok });
1715
+ onChange?.(e);
1716
+ },
1717
+ onBlur: (e) => {
1718
+ send({ type: "BLUR" });
1719
+ onBlur?.(e);
1720
+ }
1721
+ },
1722
+ rest
1723
+ )
1724
+ }
1725
+ );
1726
+ });
1727
+ var Message = forwardRef16(
1728
+ function FieldMessage({ children, ...props }, ref) {
1729
+ const { invalid } = useFieldContext();
1730
+ if (!invalid) return null;
1731
+ return /* @__PURE__ */ jsx17(
1732
+ "p",
1733
+ {
1734
+ ref,
1735
+ role: "alert",
1736
+ ...partOnlyAttrs9(fieldAnatomy.message, { state: "invalid" }),
1737
+ ...props,
1738
+ children: children ?? "Check this field."
1739
+ }
1740
+ );
1741
+ }
1742
+ );
1743
+ var Hint = forwardRef16(
1744
+ function FieldHint(props, ref) {
1745
+ return /* @__PURE__ */ jsx17("p", { ref, ...partOnlyAttrs9(fieldAnatomy.hint), ...props });
1746
+ }
1747
+ );
1748
+ var Field = { Root: Root12, Label: Label5, Control: Control3, Input: Control3, Textarea, Message, Hint };
1749
+
1750
+ // src/scroll/index.tsx
1751
+ import { scrollAnatomy, partAttrs as partAttrs14, partOnlyAttrs as partOnlyAttrs10 } from "@aeon-ui/core";
1752
+ import {
1753
+ createContext as createContext12,
1754
+ forwardRef as forwardRef17,
1755
+ useContext as useContext12,
1756
+ useMemo as useMemo12,
1757
+ useRef as useRef4
1758
+ } from "react";
1759
+
1760
+ // src/scroll/use-scroll-state.ts
1761
+ import { getScrollSnapshot } from "@aeon-ui/core";
1762
+ import { useLayoutEffect, useState as useState3 } from "react";
1763
+ function useScrollState(ref) {
1764
+ const [stateAttr, setStateAttr] = useState3("idle");
1765
+ useLayoutEffect(() => {
1766
+ const el = ref.current;
1767
+ if (!el) return;
1768
+ const update = () => {
1769
+ setStateAttr(getScrollSnapshot(el).stateAttr);
1770
+ };
1771
+ update();
1772
+ el.addEventListener("scroll", update, { passive: true });
1773
+ const ro = new ResizeObserver(update);
1774
+ ro.observe(el);
1775
+ const content = el.firstElementChild;
1776
+ if (content instanceof HTMLElement) ro.observe(content);
1777
+ return () => {
1778
+ el.removeEventListener("scroll", update);
1779
+ ro.disconnect();
1780
+ };
1781
+ }, [ref]);
1782
+ return stateAttr;
1783
+ }
1784
+
1785
+ // src/scroll/index.tsx
1786
+ import { jsx as jsx18 } from "react/jsx-runtime";
1787
+ var ScrollCtx = createContext12(null);
1788
+ function useScrollContext() {
1789
+ const ctx = useContext12(ScrollCtx);
1790
+ if (!ctx) throw new Error("Scroll parts must be used within <Scroll.Root>");
1791
+ return ctx;
1792
+ }
1793
+ var Root13 = forwardRef17(function ScrollRoot({ children, className, ...rest }, ref) {
1794
+ const viewportRef = useRef4(null);
1795
+ const stateAttr = useScrollState(viewportRef);
1796
+ const value = useMemo12(() => ({ stateAttr }), [stateAttr]);
1797
+ return /* @__PURE__ */ jsx18(ScrollCtx.Provider, { value, children: /* @__PURE__ */ jsx18(
1798
+ "div",
1799
+ {
1800
+ ref,
1801
+ className,
1802
+ ...partAttrs14(scrollAnatomy.scope, scrollAnatomy.root),
1803
+ ...rest,
1804
+ children: /* @__PURE__ */ jsx18(ScrollViewportRefContext.Provider, { value: viewportRef, children })
1805
+ }
1806
+ ) });
1807
+ });
1808
+ var ScrollViewportRefContext = createContext12(
1809
+ null
1810
+ );
1811
+ var Viewport = forwardRef17(function ScrollViewport({ children, className, ...rest }, forwardedRef) {
1812
+ const ctxRef = useContext12(ScrollViewportRefContext);
1813
+ const { stateAttr } = useScrollContext();
1814
+ return /* @__PURE__ */ jsx18(
1815
+ "div",
1816
+ {
1817
+ ref: (node) => {
1818
+ if (ctxRef) ctxRef.current = node;
1819
+ if (typeof forwardedRef === "function") forwardedRef(node);
1820
+ else if (forwardedRef) forwardedRef.current = node;
1821
+ },
1822
+ className,
1823
+ "data-aeon-scroll": "",
1824
+ ...partAttrs14(scrollAnatomy.scope, scrollAnatomy.viewport, { state: stateAttr }),
1825
+ ...rest,
1826
+ children
1827
+ }
1828
+ );
1829
+ });
1830
+ var Content3 = forwardRef17(function ScrollContent(props, ref) {
1831
+ return /* @__PURE__ */ jsx18("div", { ref, ...partOnlyAttrs10(scrollAnatomy.content), ...props });
1832
+ });
1833
+ var Scroll = {
1834
+ Root: Root13,
1835
+ Viewport,
1836
+ Content: Content3
1837
+ };
1838
+
1839
+ // src/select/index.tsx
1840
+ import { selectAnatomy, partAttrs as partAttrs16, partOnlyAttrs as partOnlyAttrs11 } from "@aeon-ui/core";
1841
+ import { popoverMachine } from "@aeon-ui/primitives";
1842
+ import {
1843
+ createContext as createContext13,
1844
+ forwardRef as forwardRef19,
1845
+ useCallback as useCallback4,
1846
+ useContext as useContext13,
1847
+ useId as useId2,
1848
+ useMemo as useMemo13,
1849
+ useRef as useRef5,
1850
+ useState as useState4
1851
+ } from "react";
1852
+
1853
+ // src/floating/FloatingPositioner.tsx
1854
+ import { partAttrs as partAttrs15 } from "@aeon-ui/core";
1855
+ import { forwardRef as forwardRef18 } from "react";
1856
+
1857
+ // src/hooks/use-anchor-position.ts
1858
+ import { useEffect as useEffect12 } from "react";
1859
+ function useAnchorPosition(anchorRef, floatingRef, active, placement = "bottom-start", options = {}) {
1860
+ const { matchWidth = false } = options;
1861
+ useEffect12(() => {
1862
+ if (!active || !anchorRef.current || !floatingRef.current) return;
1863
+ const update = () => {
1864
+ const anchor = anchorRef.current;
1865
+ const floating = floatingRef.current;
1866
+ if (!anchor || !floating) return;
1867
+ const rect = anchor.getBoundingClientRect();
1868
+ floating.style.position = "fixed";
1869
+ floating.style.left = `${rect.left}px`;
1870
+ floating.style.bottom = "";
1871
+ floating.style.right = "";
1872
+ floating.style.zIndex = "50";
1873
+ if (matchWidth) {
1874
+ floating.style.width = `${rect.width}px`;
1875
+ floating.style.minWidth = `${rect.width}px`;
1876
+ } else {
1877
+ floating.style.width = "";
1878
+ floating.style.minWidth = "";
1879
+ }
1880
+ if (placement === "top-start") {
1881
+ const height = floating.offsetHeight || floating.getBoundingClientRect().height;
1882
+ floating.style.top = `${rect.top - height - 4}px`;
1883
+ } else {
1884
+ floating.style.top = `${rect.bottom + 4}px`;
1885
+ }
1886
+ };
1887
+ update();
1888
+ requestAnimationFrame(update);
1889
+ window.addEventListener("resize", update);
1890
+ window.addEventListener("scroll", update, true);
1891
+ return () => {
1892
+ window.removeEventListener("resize", update);
1893
+ window.removeEventListener("scroll", update, true);
1894
+ };
1895
+ }, [active, anchorRef, floatingRef, placement, matchWidth]);
1896
+ }
1897
+
1898
+ // src/floating/FloatingPositioner.tsx
1899
+ import { jsx as jsx19 } from "react/jsx-runtime";
1900
+ var FloatingPositioner = forwardRef18(
1901
+ function FloatingPositioner2({
1902
+ open,
1903
+ scope,
1904
+ part,
1905
+ triggerRef,
1906
+ positionerRef,
1907
+ portalled = true,
1908
+ placement = "bottom-start",
1909
+ matchAnchorWidth = false,
1910
+ children,
1911
+ className,
1912
+ ...rest
1913
+ }, ref) {
1914
+ const mounted = usePortalledMount();
1915
+ useAnchorPosition(triggerRef, positionerRef, open && portalled, placement, {
1916
+ matchWidth: matchAnchorWidth
1917
+ });
1918
+ if (!open) return null;
1919
+ const node = /* @__PURE__ */ jsx19(
1920
+ "div",
1921
+ {
1922
+ ref: (el) => {
1923
+ positionerRef.current = el;
1924
+ if (typeof ref === "function") ref(el);
1925
+ else if (ref) ref.current = el;
1926
+ },
1927
+ className,
1928
+ ...mergeProps(partAttrs15(scope, part, { state: "open" }), rest),
1929
+ children
1930
+ }
1931
+ );
1932
+ return renderPortalled(node, portalled, mounted);
1933
+ }
1934
+ );
1935
+
1936
+ // src/hooks/use-outside-click.ts
1937
+ import { useEffect as useEffect13 } from "react";
1938
+ function useOutsideClick(refs, enabled, onOutside) {
1939
+ useEffect13(() => {
1940
+ if (!enabled) return;
1941
+ const onDown = (e) => {
1942
+ const target = e.target;
1943
+ if (refs.some((r) => r.current?.contains(target))) return;
1944
+ onOutside();
1945
+ };
1946
+ document.addEventListener("mousedown", onDown);
1947
+ return () => document.removeEventListener("mousedown", onDown);
1948
+ }, [refs, enabled, onOutside]);
1949
+ }
1950
+
1951
+ // src/select/index.tsx
1952
+ import { jsx as jsx20, jsxs as jsxs2 } from "react/jsx-runtime";
1953
+ var SelectCtx = createContext13(null);
1954
+ var SelectPositionerCtx = createContext13(false);
1955
+ function useSelectCtx() {
1956
+ const ctx = useContext13(SelectCtx);
1957
+ if (!ctx) throw new Error("Select parts must be used within <Select.Root>");
1958
+ return ctx;
1959
+ }
1960
+ function optionValuesFromDom(listboxId, content) {
1961
+ if (!content) return [];
1962
+ const prefix = `${listboxId}-option-`;
1963
+ return Array.from(content.querySelectorAll('button[role="option"]:not(:disabled)')).map((el) => el.id.startsWith(prefix) ? el.id.slice(prefix.length) : "").filter(Boolean);
1964
+ }
1965
+ var Root14 = forwardRef19(function SelectRoot({ value, onValueChange, children, className, disabled }, ref) {
1966
+ const [snapshot, send] = useAeonMachine(popoverMachine, { input: { open: false } });
1967
+ const [highlightedValue, setHighlightedValue] = useState4(null);
1968
+ const triggerRef = useRef5(null);
1969
+ const positionerRef = useRef5(null);
1970
+ const contentRef = useRef5(null);
1971
+ const rootRef = useRef5(null);
1972
+ const listboxId = useId2();
1973
+ const open = disabled ? false : snapshot.matches("open");
1974
+ const close = useCallback4(() => {
1975
+ send({ type: "CLOSE" });
1976
+ setHighlightedValue(null);
1977
+ }, [send]);
1978
+ useOutsideClick([rootRef, positionerRef], open, () => send({ type: "POINTER_DOWN_OUTSIDE" }));
1979
+ const getOptionValues = useCallback4(
1980
+ () => optionValuesFromDom(listboxId, contentRef.current),
1981
+ [listboxId, open]
1982
+ );
1983
+ const selectValue = useCallback4(
1984
+ (next) => {
1985
+ onValueChange?.(next);
1986
+ close();
1987
+ },
1988
+ [onValueChange, close]
1989
+ );
1990
+ const highlightValue = useCallback4((next) => {
1991
+ setHighlightedValue(next);
1992
+ }, []);
1993
+ const moveHighlight = useCallback4(
1994
+ (delta) => {
1995
+ const options = getOptionValues();
1996
+ if (options.length === 0) {
1997
+ setHighlightedValue(null);
1998
+ return;
1999
+ }
2000
+ const idx = highlightedValue ? options.indexOf(highlightedValue) : -1;
2001
+ let next = idx + delta;
2002
+ if (next < 0) next = options.length - 1;
2003
+ if (next >= options.length) next = 0;
2004
+ setHighlightedValue(options[next]);
2005
+ },
2006
+ [getOptionValues, highlightedValue]
2007
+ );
2008
+ const onListboxKeyDown = useCallback4(
2009
+ (e) => {
2010
+ if (e.defaultPrevented) return;
2011
+ if ((e.key === "Enter" || e.key === " ") && !open) {
2012
+ e.preventDefault();
2013
+ send({ type: "OPEN" });
2014
+ return;
2015
+ }
2016
+ if (e.key === "ArrowDown") {
2017
+ e.preventDefault();
2018
+ if (!open) send({ type: "OPEN" });
2019
+ else moveHighlight(1);
2020
+ return;
2021
+ }
2022
+ if (e.key === "ArrowUp") {
2023
+ e.preventDefault();
2024
+ if (!open) send({ type: "OPEN" });
2025
+ else moveHighlight(-1);
2026
+ return;
2027
+ }
2028
+ if (e.key === "Home" && open) {
2029
+ e.preventDefault();
2030
+ const first = getOptionValues()[0];
2031
+ if (first) highlightValue(first);
2032
+ return;
2033
+ }
2034
+ if (e.key === "End" && open) {
2035
+ e.preventDefault();
2036
+ const options = getOptionValues();
2037
+ const last = options[options.length - 1];
2038
+ if (last) highlightValue(last);
2039
+ return;
2040
+ }
2041
+ if ((e.key === "Enter" || e.key === " ") && open) {
2042
+ e.preventDefault();
2043
+ const pick = highlightedValue ?? getOptionValues()[0];
2044
+ if (pick) selectValue(pick);
2045
+ return;
2046
+ }
2047
+ if (e.key === "Escape") send({ type: "ESCAPE" });
2048
+ },
2049
+ [open, send, moveHighlight, getOptionValues, highlightValue, highlightedValue, selectValue]
2050
+ );
2051
+ const ctx = useMemo13(
2052
+ () => ({
2053
+ value,
2054
+ open,
2055
+ listboxId,
2056
+ highlightedValue,
2057
+ send,
2058
+ triggerRef,
2059
+ positionerRef,
2060
+ contentRef,
2061
+ onValueChange,
2062
+ moveHighlight,
2063
+ highlightValue,
2064
+ selectValue,
2065
+ onListboxKeyDown
2066
+ }),
2067
+ [
2068
+ value,
2069
+ open,
2070
+ listboxId,
2071
+ highlightedValue,
2072
+ send,
2073
+ onValueChange,
2074
+ moveHighlight,
2075
+ highlightValue,
2076
+ selectValue,
2077
+ onListboxKeyDown
2078
+ ]
2079
+ );
2080
+ return /* @__PURE__ */ jsx20(SelectCtx.Provider, { value: ctx, children: /* @__PURE__ */ jsx20(
2081
+ "div",
2082
+ {
2083
+ ref: (node) => {
2084
+ rootRef.current = node;
2085
+ if (typeof ref === "function") ref(node);
2086
+ else if (ref) ref.current = node;
2087
+ },
2088
+ className,
2089
+ ...partAttrs16(selectAnatomy.scope, selectAnatomy.root, {
2090
+ state: open ? "open" : "closed"
2091
+ }),
2092
+ children
2093
+ }
2094
+ ) });
2095
+ });
2096
+ var ValueText2 = forwardRef19(function SelectValueText(props, ref) {
2097
+ return /* @__PURE__ */ jsx20("span", { ref, ...partOnlyAttrs11(selectAnatomy.value), ...props });
2098
+ });
2099
+ var Trigger3 = forwardRef19(function SelectTrigger({ children, onClick, onKeyDown, ...rest }, ref) {
2100
+ const { open, send, listboxId, triggerRef, onListboxKeyDown } = useSelectCtx();
2101
+ return /* @__PURE__ */ jsxs2(
2102
+ "button",
2103
+ {
2104
+ ref: (node) => {
2105
+ triggerRef.current = node;
2106
+ if (typeof ref === "function") ref(node);
2107
+ else if (ref) ref.current = node;
2108
+ },
2109
+ type: "button",
2110
+ "aria-haspopup": "listbox",
2111
+ "aria-expanded": open,
2112
+ "aria-controls": open ? listboxId : void 0,
2113
+ ...partAttrs16(selectAnatomy.scope, selectAnatomy.trigger, { state: open ? "open" : "closed" }),
2114
+ ...mergeProps(rest, {
2115
+ onClick: (e) => {
2116
+ onClick?.(e);
2117
+ if (!e.defaultPrevented) send({ type: "TOGGLE" });
2118
+ },
2119
+ onKeyDown: (e) => {
2120
+ onKeyDown?.(e);
2121
+ onListboxKeyDown(e);
2122
+ }
2123
+ }),
2124
+ children: [
2125
+ children,
2126
+ /* @__PURE__ */ jsx20("span", { ...partOnlyAttrs11(selectAnatomy.icon), "aria-hidden": true })
2127
+ ]
2128
+ }
2129
+ );
2130
+ });
2131
+ var Positioner2 = forwardRef19(function SelectPositioner({ portalled = true, children, className, ...rest }, ref) {
2132
+ const { open, triggerRef, positionerRef } = useSelectCtx();
2133
+ return /* @__PURE__ */ jsx20(SelectPositionerCtx.Provider, { value: true, children: /* @__PURE__ */ jsx20(
2134
+ FloatingPositioner,
2135
+ {
2136
+ ref,
2137
+ open,
2138
+ scope: selectAnatomy.scope,
2139
+ part: selectAnatomy.positioner,
2140
+ triggerRef,
2141
+ positionerRef,
2142
+ portalled,
2143
+ matchAnchorWidth: true,
2144
+ className,
2145
+ ...rest,
2146
+ children
2147
+ }
2148
+ ) });
2149
+ });
2150
+ var Content4 = forwardRef19(function SelectContent({ portalled = true, onKeyDown, children, className, ...rest }, ref) {
2151
+ const inPositioner = useContext13(SelectPositionerCtx);
2152
+ const { open, listboxId, contentRef, highlightedValue, onListboxKeyDown, triggerRef, positionerRef } = useSelectCtx();
2153
+ if (!open) return null;
2154
+ const activeId = highlightedValue && open ? `${listboxId}-option-${highlightedValue}` : void 0;
2155
+ const listbox = /* @__PURE__ */ jsx20(
2156
+ "div",
2157
+ {
2158
+ ref: (node) => {
2159
+ contentRef.current = node;
2160
+ if (typeof ref === "function") ref(node);
2161
+ else if (ref) ref.current = node;
2162
+ },
2163
+ id: listboxId,
2164
+ role: "listbox",
2165
+ "aria-activedescendant": activeId,
2166
+ className,
2167
+ "data-aeon-scroll": "",
2168
+ ...partAttrs16(selectAnatomy.scope, selectAnatomy.content, { state: "open" }),
2169
+ ...mergeProps(rest, {
2170
+ onKeyDown: (e) => {
2171
+ onKeyDown?.(e);
2172
+ onListboxKeyDown(e);
2173
+ }
2174
+ }),
2175
+ children
2176
+ }
2177
+ );
2178
+ if (inPositioner) return listbox;
2179
+ return /* @__PURE__ */ jsx20(
2180
+ FloatingPositioner,
2181
+ {
2182
+ open,
2183
+ scope: selectAnatomy.scope,
2184
+ part: selectAnatomy.positioner,
2185
+ triggerRef,
2186
+ positionerRef,
2187
+ portalled,
2188
+ matchAnchorWidth: true,
2189
+ children: listbox
2190
+ }
2191
+ );
2192
+ });
2193
+ var Item3 = forwardRef19(function SelectItem({ value, disabled = false, children, onClick, ...rest }, ref) {
2194
+ const { value: selected, listboxId, highlightedValue, selectValue } = useSelectCtx();
2195
+ const selectedState = value === selected;
2196
+ const highlighted = value === highlightedValue;
2197
+ return /* @__PURE__ */ jsx20(
2198
+ "button",
2199
+ {
2200
+ ref,
2201
+ type: "button",
2202
+ role: "option",
2203
+ id: `${listboxId}-option-${value}`,
2204
+ "aria-selected": selectedState,
2205
+ disabled,
2206
+ ...partAttrs16(selectAnatomy.scope, selectAnatomy.item, {
2207
+ state: selectedState ? "selected" : highlighted ? "highlighted" : "idle",
2208
+ highlighted
2209
+ }),
2210
+ ...mergeProps(rest, {
2211
+ onClick: (e) => {
2212
+ onClick?.(e);
2213
+ if (!e.defaultPrevented && !disabled) selectValue(value);
2214
+ }
2215
+ }),
2216
+ children
2217
+ }
2218
+ );
2219
+ });
2220
+ var Select = {
2221
+ Root: Root14,
2222
+ Trigger: Trigger3,
2223
+ ValueText: ValueText2,
2224
+ Positioner: Positioner2,
2225
+ Content: Content4,
2226
+ Item: Item3
2227
+ };
2228
+
2229
+ // src/combobox/index.tsx
2230
+ import { comboboxAnatomy, partAttrs as partAttrs17, partOnlyAttrs as partOnlyAttrs12 } from "@aeon-ui/core";
2231
+ import {
2232
+ createContext as createContext14,
2233
+ forwardRef as forwardRef20,
2234
+ useCallback as useCallback5,
2235
+ useContext as useContext14,
2236
+ useEffect as useEffect14,
2237
+ useId as useId3,
2238
+ useMemo as useMemo14,
2239
+ useRef as useRef6,
2240
+ useState as useState5
2241
+ } from "react";
2242
+ import { Fragment as Fragment2, jsx as jsx21, jsxs as jsxs3 } from "react/jsx-runtime";
2243
+ var ComboboxCtx = createContext14(null);
2244
+ function useComboboxCtx() {
2245
+ const ctx = useContext14(ComboboxCtx);
2246
+ if (!ctx) throw new Error("Combobox parts must be used within <Combobox.Root>");
2247
+ return ctx;
2248
+ }
2249
+ function normalizeLabel(label, children) {
2250
+ if (label) return label;
2251
+ if (typeof children === "string") return children;
2252
+ return "";
2253
+ }
2254
+ function matchesQuery(label, query) {
2255
+ const q = query.trim().toLowerCase();
2256
+ if (!q) return true;
2257
+ return label.toLowerCase().includes(q);
2258
+ }
2259
+ var Root15 = forwardRef20(function ComboboxRoot({ value, onValueChange, children, className, disabled }, ref) {
2260
+ const [open, setOpenState] = useState5(false);
2261
+ const [query, setQuery] = useState5("");
2262
+ const [highlightedValue, setHighlightedValue] = useState5(null);
2263
+ const [itemsVersion, setItemsVersion] = useState5(0);
2264
+ const itemsRef = useRef6([]);
2265
+ const listboxId = useId3();
2266
+ const setOpen = useCallback5(
2267
+ (next) => {
2268
+ if (disabled) return;
2269
+ setOpenState(next);
2270
+ if (!next) {
2271
+ setQuery("");
2272
+ setHighlightedValue(null);
2273
+ }
2274
+ },
2275
+ [disabled]
2276
+ );
2277
+ const registerItem = useCallback5((item) => {
2278
+ itemsRef.current = [...itemsRef.current.filter((i) => i.value !== item.value), item];
2279
+ setItemsVersion((v) => v + 1);
2280
+ }, []);
2281
+ const unregisterItem = useCallback5((valueKey) => {
2282
+ itemsRef.current = itemsRef.current.filter((i) => i.value !== valueKey);
2283
+ setItemsVersion((v) => v + 1);
2284
+ }, []);
2285
+ const getItems = useCallback5(() => itemsRef.current, []);
2286
+ const ctx = useMemo14(
2287
+ () => ({
2288
+ value,
2289
+ open: disabled ? false : open,
2290
+ query,
2291
+ listboxId,
2292
+ highlightedValue,
2293
+ itemsVersion,
2294
+ setOpen,
2295
+ setQuery,
2296
+ setHighlightedValue,
2297
+ onValueChange,
2298
+ registerItem,
2299
+ unregisterItem,
2300
+ getItems
2301
+ }),
2302
+ [
2303
+ value,
2304
+ open,
2305
+ query,
2306
+ listboxId,
2307
+ highlightedValue,
2308
+ itemsVersion,
2309
+ setOpen,
2310
+ onValueChange,
2311
+ registerItem,
2312
+ unregisterItem,
2313
+ getItems,
2314
+ disabled
2315
+ ]
2316
+ );
2317
+ return /* @__PURE__ */ jsx21(ComboboxCtx.Provider, { value: ctx, children: /* @__PURE__ */ jsx21(
2318
+ "div",
2319
+ {
2320
+ ref,
2321
+ className,
2322
+ ...partAttrs17(comboboxAnatomy.scope, comboboxAnatomy.root, {
2323
+ state: open ? "open" : "closed"
2324
+ }),
2325
+ children
2326
+ }
2327
+ ) });
2328
+ });
2329
+ function useVisibleItems() {
2330
+ const { query, getItems, itemsVersion } = useComboboxCtx();
2331
+ return useMemo14(() => {
2332
+ void itemsVersion;
2333
+ return getItems().filter((i) => matchesQuery(i.label, query));
2334
+ }, [query, getItems, itemsVersion]);
2335
+ }
2336
+ var Input2 = forwardRef20(function ComboboxInput({ onChange, onKeyDown, onFocus, onClick, value: valueProp, ...rest }, ref) {
2337
+ const {
2338
+ value: selected,
2339
+ open,
2340
+ query,
2341
+ listboxId,
2342
+ highlightedValue,
2343
+ itemsVersion,
2344
+ setOpen,
2345
+ setQuery,
2346
+ setHighlightedValue,
2347
+ onValueChange,
2348
+ getItems
2349
+ } = useComboboxCtx();
2350
+ const inputRef = useRef6(null);
2351
+ const visible = useVisibleItems();
2352
+ const selectedLabel = useMemo14(() => {
2353
+ void itemsVersion;
2354
+ return getItems().find((i) => i.value === selected)?.label ?? "";
2355
+ }, [getItems, selected, itemsVersion]);
2356
+ const displayValue = open ? query : selectedLabel;
2357
+ const selectValue = useCallback5(
2358
+ (next) => {
2359
+ onValueChange?.(next);
2360
+ setOpen(false);
2361
+ setQuery("");
2362
+ setHighlightedValue(null);
2363
+ },
2364
+ [onValueChange, setOpen, setQuery, setHighlightedValue]
2365
+ );
2366
+ const moveHighlight = useCallback5(
2367
+ (delta) => {
2368
+ if (visible.length === 0) {
2369
+ setHighlightedValue(null);
2370
+ return;
2371
+ }
2372
+ const idx = highlightedValue ? visible.findIndex((i) => i.value === highlightedValue) : -1;
2373
+ let next = idx + delta;
2374
+ if (next < 0) next = visible.length - 1;
2375
+ if (next >= visible.length) next = 0;
2376
+ setHighlightedValue(visible[next].value);
2377
+ },
2378
+ [visible, highlightedValue, setHighlightedValue]
2379
+ );
2380
+ const setRefs = useCallback5(
2381
+ (node) => {
2382
+ inputRef.current = node;
2383
+ if (typeof ref === "function") ref(node);
2384
+ else if (ref) ref.current = node;
2385
+ },
2386
+ [ref]
2387
+ );
2388
+ useEffect14(() => {
2389
+ if (!open) return;
2390
+ const onPointerDown = (e) => {
2391
+ const root = inputRef.current?.closest('[data-aeon-scope="combobox"]');
2392
+ if (root && !root.contains(e.target)) setOpen(false);
2393
+ };
2394
+ const onKey = (e) => {
2395
+ if (e.key === "Escape") setOpen(false);
2396
+ };
2397
+ document.addEventListener("pointerdown", onPointerDown);
2398
+ document.addEventListener("keydown", onKey);
2399
+ return () => {
2400
+ document.removeEventListener("pointerdown", onPointerDown);
2401
+ document.removeEventListener("keydown", onKey);
2402
+ };
2403
+ }, [open, setOpen]);
2404
+ const activeDescendant = highlightedValue && open ? `${listboxId}-option-${highlightedValue}` : void 0;
2405
+ return /* @__PURE__ */ jsxs3(Fragment2, { children: [
2406
+ /* @__PURE__ */ jsx21(
2407
+ "input",
2408
+ {
2409
+ ref: setRefs,
2410
+ type: "text",
2411
+ role: "combobox",
2412
+ "aria-autocomplete": "list",
2413
+ "aria-expanded": open,
2414
+ "aria-controls": open ? listboxId : void 0,
2415
+ "aria-activedescendant": activeDescendant,
2416
+ autoComplete: "off",
2417
+ value: valueProp ?? displayValue,
2418
+ ...partAttrs17(comboboxAnatomy.scope, comboboxAnatomy.input, { state: open ? "open" : "closed" }),
2419
+ ...mergeProps(rest, {
2420
+ onFocus: (e) => {
2421
+ onFocus?.(e);
2422
+ setOpen(true);
2423
+ },
2424
+ onClick: (e) => {
2425
+ onClick?.(e);
2426
+ setOpen(true);
2427
+ },
2428
+ onChange: (e) => {
2429
+ onChange?.(e);
2430
+ if (!e.defaultPrevented) {
2431
+ setOpen(true);
2432
+ setQuery(e.target.value);
2433
+ setHighlightedValue(null);
2434
+ }
2435
+ },
2436
+ onKeyDown: (e) => {
2437
+ onKeyDown?.(e);
2438
+ if (e.defaultPrevented) return;
2439
+ if (e.key === "ArrowDown") {
2440
+ e.preventDefault();
2441
+ if (!open) setOpen(true);
2442
+ else moveHighlight(1);
2443
+ }
2444
+ if (e.key === "ArrowUp") {
2445
+ e.preventDefault();
2446
+ if (!open) setOpen(true);
2447
+ else moveHighlight(-1);
2448
+ }
2449
+ if (e.key === "Home" && open) {
2450
+ e.preventDefault();
2451
+ if (visible[0]) setHighlightedValue(visible[0].value);
2452
+ }
2453
+ if (e.key === "End" && open) {
2454
+ e.preventDefault();
2455
+ if (visible[visible.length - 1]) setHighlightedValue(visible[visible.length - 1].value);
2456
+ }
2457
+ if (e.key === "Enter") {
2458
+ e.preventDefault();
2459
+ const pick = highlightedValue ?? visible[0]?.value;
2460
+ if (pick) selectValue(pick);
2461
+ }
2462
+ if (e.key === "Escape") setOpen(false);
2463
+ }
2464
+ })
2465
+ }
2466
+ ),
2467
+ /* @__PURE__ */ jsx21(
2468
+ "span",
2469
+ {
2470
+ ...partOnlyAttrs12(comboboxAnatomy.icon, { state: open ? "open" : "closed" }),
2471
+ "aria-hidden": true,
2472
+ style: open ? { transform: "rotate(-135deg) translateY(2px)" } : void 0
2473
+ }
2474
+ )
2475
+ ] });
2476
+ });
2477
+ var Content5 = forwardRef20(function ComboboxContent({ children, className, ...rest }, ref) {
2478
+ const { open, listboxId } = useComboboxCtx();
2479
+ if (!open) return null;
2480
+ return /* @__PURE__ */ jsx21(
2481
+ "div",
2482
+ {
2483
+ ref,
2484
+ id: listboxId,
2485
+ role: "listbox",
2486
+ className,
2487
+ "data-aeon-scroll": "",
2488
+ ...partAttrs17(comboboxAnatomy.scope, comboboxAnatomy.content),
2489
+ ...rest,
2490
+ children
2491
+ }
2492
+ );
2493
+ });
2494
+ var Item4 = forwardRef20(function ComboboxItem({ value, textValue, children, onClick, ...rest }, ref) {
2495
+ const {
2496
+ value: selected,
2497
+ query,
2498
+ highlightedValue,
2499
+ listboxId,
2500
+ onValueChange,
2501
+ setOpen,
2502
+ setHighlightedValue,
2503
+ registerItem,
2504
+ unregisterItem
2505
+ } = useComboboxCtx();
2506
+ const label = normalizeLabel(textValue, children);
2507
+ const resolvedOptionId = `${listboxId}-option-${value}`;
2508
+ useEffect14(() => {
2509
+ registerItem({ value, label });
2510
+ return () => unregisterItem(value);
2511
+ }, [value, label, registerItem, unregisterItem]);
2512
+ if (!matchesQuery(label, query)) return null;
2513
+ const selectedState = value === selected;
2514
+ const highlighted = value === highlightedValue;
2515
+ return /* @__PURE__ */ jsx21(
2516
+ "button",
2517
+ {
2518
+ ref,
2519
+ type: "button",
2520
+ role: "option",
2521
+ id: resolvedOptionId,
2522
+ "aria-selected": selectedState,
2523
+ "data-highlighted": highlighted ? "" : void 0,
2524
+ ...partAttrs17(comboboxAnatomy.scope, comboboxAnatomy.item, {
2525
+ state: selectedState ? "selected" : "idle",
2526
+ highlighted
2527
+ }),
2528
+ ...mergeProps(rest, {
2529
+ onClick: (e) => {
2530
+ onClick?.(e);
2531
+ if (!e.defaultPrevented) {
2532
+ onValueChange?.(value);
2533
+ setOpen(false);
2534
+ }
2535
+ },
2536
+ onMouseEnter: () => setHighlightedValue(value)
2537
+ }),
2538
+ children
2539
+ }
2540
+ );
2541
+ });
2542
+ var Empty = forwardRef20(function ComboboxEmpty({ children, className, ...rest }, ref) {
2543
+ const { open, query } = useComboboxCtx();
2544
+ const visible = useVisibleItems();
2545
+ if (!open || !query.trim() || visible.length > 0) return null;
2546
+ return /* @__PURE__ */ jsx21(
2547
+ "div",
2548
+ {
2549
+ ref,
2550
+ className,
2551
+ ...partAttrs17(comboboxAnatomy.scope, comboboxAnatomy.empty),
2552
+ ...rest,
2553
+ children: children ?? "No results"
2554
+ }
2555
+ );
2556
+ });
2557
+ var Combobox = {
2558
+ Root: Root15,
2559
+ Input: Input2,
2560
+ Content: Content5,
2561
+ Item: Item4,
2562
+ Empty
2563
+ };
2564
+
2565
+ // src/popover/index.tsx
2566
+ import { popoverAnatomy, partAttrs as partAttrs18 } from "@aeon-ui/core";
2567
+ import { popoverMachine as popoverMachine2 } from "@aeon-ui/primitives";
2568
+ import {
2569
+ createContext as createContext15,
2570
+ forwardRef as forwardRef21,
2571
+ useCallback as useCallback6,
2572
+ useContext as useContext15,
2573
+ useEffect as useEffect15,
2574
+ useId as useId4,
2575
+ useMemo as useMemo15,
2576
+ useRef as useRef7
2577
+ } from "react";
2578
+ import { jsx as jsx22 } from "react/jsx-runtime";
2579
+ var PopoverCtx = createContext15(null);
2580
+ function usePopoverCtx() {
2581
+ const ctx = useContext15(PopoverCtx);
2582
+ if (!ctx) throw new Error("Popover parts must be used within Popover.Root");
2583
+ return ctx;
2584
+ }
2585
+ var Root16 = forwardRef21(function PopoverRoot({ open, defaultOpen = false, onOpenChange, children, className, ...rest }, ref) {
2586
+ const [snapshot, send] = useAeonMachine(popoverMachine2, {
2587
+ input: { open: defaultOpen }
2588
+ });
2589
+ const resolvedOpen = open ?? snapshot.context.open;
2590
+ const rootRef = useRef7(null);
2591
+ const triggerRef = useRef7(null);
2592
+ const positionerRef = useRef7(null);
2593
+ const triggerId = useId4();
2594
+ const contentId = useId4();
2595
+ useEffect15(() => {
2596
+ onOpenChange?.(resolvedOpen);
2597
+ }, [resolvedOpen, onOpenChange]);
2598
+ useEffect15(() => {
2599
+ if (open !== void 0) send({ type: "SET_OPEN", open });
2600
+ }, [open, send]);
2601
+ const close = useCallback6(() => send({ type: "CLOSE" }), [send]);
2602
+ useOutsideClick([rootRef, positionerRef], resolvedOpen, close);
2603
+ const value = useMemo15(
2604
+ () => ({ open: resolvedOpen, send, triggerId, contentId, triggerRef, positionerRef }),
2605
+ [resolvedOpen, send, triggerId, contentId]
2606
+ );
2607
+ return /* @__PURE__ */ jsx22(PopoverCtx.Provider, { value, children: /* @__PURE__ */ jsx22(
2608
+ "div",
2609
+ {
2610
+ ref: (node) => {
2611
+ rootRef.current = node;
2612
+ if (typeof ref === "function") ref(node);
2613
+ else if (ref) ref.current = node;
2614
+ },
2615
+ className,
2616
+ ...mergeProps(
2617
+ partAttrs18(popoverAnatomy.scope, popoverAnatomy.root, {
2618
+ state: resolvedOpen ? "open" : "closed"
2619
+ }),
2620
+ rest
2621
+ ),
2622
+ children
2623
+ }
2624
+ ) });
2625
+ });
2626
+ var Trigger4 = forwardRef21(function PopoverTrigger({ onClick, ...rest }, ref) {
2627
+ const { open, send, triggerId, contentId, triggerRef } = usePopoverCtx();
2628
+ return /* @__PURE__ */ jsx22(
2629
+ "button",
2630
+ {
2631
+ ref: (node) => {
2632
+ triggerRef.current = node;
2633
+ if (typeof ref === "function") ref(node);
2634
+ else if (ref) ref.current = node;
2635
+ },
2636
+ type: "button",
2637
+ id: triggerId,
2638
+ "aria-expanded": open,
2639
+ "aria-controls": open ? contentId : void 0,
2640
+ ...mergeProps(
2641
+ partAttrs18(popoverAnatomy.scope, popoverAnatomy.trigger, { state: open ? "open" : "closed" }),
2642
+ {
2643
+ onClick: (e) => {
2644
+ onClick?.(e);
2645
+ if (!e.defaultPrevented) send({ type: "TOGGLE" });
2646
+ }
2647
+ },
2648
+ rest
2649
+ )
2650
+ }
2651
+ );
2652
+ });
2653
+ var Positioner3 = forwardRef21(function PopoverPositioner({ portalled = true, placement = "bottom-start", children, className, ...rest }, ref) {
2654
+ const { open, triggerRef, positionerRef } = usePopoverCtx();
2655
+ return /* @__PURE__ */ jsx22(
2656
+ FloatingPositioner,
2657
+ {
2658
+ ref,
2659
+ open,
2660
+ scope: popoverAnatomy.scope,
2661
+ part: popoverAnatomy.positioner,
2662
+ triggerRef,
2663
+ positionerRef,
2664
+ portalled,
2665
+ placement,
2666
+ className,
2667
+ ...rest,
2668
+ children
2669
+ }
2670
+ );
2671
+ });
2672
+ var Content6 = forwardRef21(function PopoverContent({ onKeyDown, ...rest }, ref) {
2673
+ const { open, send, triggerId, contentId } = usePopoverCtx();
2674
+ if (!open) return null;
2675
+ return /* @__PURE__ */ jsx22(
2676
+ "div",
2677
+ {
2678
+ ref,
2679
+ id: contentId,
2680
+ role: "dialog",
2681
+ "aria-modal": false,
2682
+ "aria-labelledby": triggerId,
2683
+ ...mergeProps(
2684
+ partAttrs18(popoverAnatomy.scope, popoverAnatomy.content, { state: "open" }),
2685
+ {
2686
+ onKeyDown: (e) => {
2687
+ onKeyDown?.(e);
2688
+ if (e.key === "Escape") send({ type: "ESCAPE" });
2689
+ }
2690
+ },
2691
+ rest
2692
+ )
2693
+ }
2694
+ );
2695
+ });
2696
+ var Arrow = forwardRef21(function PopoverArrow(props, ref) {
2697
+ const { open } = usePopoverCtx();
2698
+ if (!open) return null;
2699
+ return /* @__PURE__ */ jsx22("div", { ref, ...mergeProps(partAttrs18(popoverAnatomy.scope, popoverAnatomy.arrow), props) });
2700
+ });
2701
+ var CloseTrigger2 = forwardRef21(
2702
+ function PopoverCloseTrigger({ onClick, ...rest }, ref) {
2703
+ const { send } = usePopoverCtx();
2704
+ return /* @__PURE__ */ jsx22(
2705
+ "button",
2706
+ {
2707
+ ref,
2708
+ type: "button",
2709
+ "aria-label": "Close",
2710
+ ...mergeProps(
2711
+ partAttrs18(popoverAnatomy.scope, popoverAnatomy.closeTrigger),
2712
+ {
2713
+ onClick: (e) => {
2714
+ onClick?.(e);
2715
+ send({ type: "CLOSE" });
2716
+ }
2717
+ },
2718
+ rest
2719
+ )
2720
+ }
2721
+ );
2722
+ }
2723
+ );
2724
+ var Popover = { Root: Root16, Trigger: Trigger4, Positioner: Positioner3, Content: Content6, Arrow, CloseTrigger: CloseTrigger2 };
2725
+
2726
+ // src/menu/index.tsx
2727
+ import { menuAnatomy, partAttrs as partAttrs19 } from "@aeon-ui/core";
2728
+ import { popoverMachine as popoverMachine3 } from "@aeon-ui/primitives";
2729
+ import {
2730
+ createContext as createContext16,
2731
+ forwardRef as forwardRef22,
2732
+ useCallback as useCallback7,
2733
+ useContext as useContext16,
2734
+ useEffect as useEffect16,
2735
+ useId as useId5,
2736
+ useMemo as useMemo16,
2737
+ useRef as useRef8
2738
+ } from "react";
2739
+ import { jsx as jsx23 } from "react/jsx-runtime";
2740
+ var MenuCtx = createContext16(null);
2741
+ function useMenuCtx() {
2742
+ const ctx = useContext16(MenuCtx);
2743
+ if (!ctx) throw new Error("Menu parts must be used within Menu.Root");
2744
+ return ctx;
2745
+ }
2746
+ var Root17 = forwardRef22(function MenuRoot({ open, defaultOpen = false, onOpenChange, children, className, ...rest }, ref) {
2747
+ const [snapshot, send] = useAeonMachine(popoverMachine3, { input: { open: defaultOpen } });
2748
+ const resolvedOpen = open ?? snapshot.context.open;
2749
+ const rootRef = useRef8(null);
2750
+ const triggerRef = useRef8(null);
2751
+ const positionerRef = useRef8(null);
2752
+ const triggerId = useId5();
2753
+ const menuId = useId5();
2754
+ useEffect16(() => {
2755
+ onOpenChange?.(resolvedOpen);
2756
+ }, [resolvedOpen, onOpenChange]);
2757
+ useEffect16(() => {
2758
+ if (open !== void 0) send({ type: "SET_OPEN", open });
2759
+ }, [open, send]);
2760
+ const close = useCallback7(() => send({ type: "CLOSE" }), [send]);
2761
+ useOutsideClick([rootRef, positionerRef], resolvedOpen, close);
2762
+ const value = useMemo16(
2763
+ () => ({ open: resolvedOpen, send, triggerId, menuId, triggerRef, positionerRef }),
2764
+ [resolvedOpen, send, triggerId, menuId]
2765
+ );
2766
+ return /* @__PURE__ */ jsx23(MenuCtx.Provider, { value, children: /* @__PURE__ */ jsx23(
2767
+ "div",
2768
+ {
2769
+ ref: (node) => {
2770
+ rootRef.current = node;
2771
+ if (typeof ref === "function") ref(node);
2772
+ else if (ref) ref.current = node;
2773
+ },
2774
+ className,
2775
+ ...mergeProps(
2776
+ partAttrs19(menuAnatomy.scope, menuAnatomy.root, { state: resolvedOpen ? "open" : "closed" }),
2777
+ rest
2778
+ ),
2779
+ children
2780
+ }
2781
+ ) });
2782
+ });
2783
+ var Trigger5 = forwardRef22(function MenuTrigger({ onClick, ...rest }, ref) {
2784
+ const { open, send, triggerId, menuId, triggerRef } = useMenuCtx();
2785
+ return /* @__PURE__ */ jsx23(
2786
+ "button",
2787
+ {
2788
+ ref: (node) => {
2789
+ triggerRef.current = node;
2790
+ if (typeof ref === "function") ref(node);
2791
+ else if (ref) ref.current = node;
2792
+ },
2793
+ type: "button",
2794
+ id: triggerId,
2795
+ "aria-haspopup": "menu",
2796
+ "aria-expanded": open,
2797
+ "aria-controls": open ? menuId : void 0,
2798
+ ...mergeProps(
2799
+ partAttrs19(menuAnatomy.scope, menuAnatomy.trigger, { state: open ? "open" : "closed" }),
2800
+ {
2801
+ onClick: (e) => {
2802
+ onClick?.(e);
2803
+ if (!e.defaultPrevented) send({ type: "TOGGLE" });
2804
+ }
2805
+ },
2806
+ rest
2807
+ )
2808
+ }
2809
+ );
2810
+ });
2811
+ var Positioner4 = forwardRef22(function MenuPositioner({ portalled = true, placement = "bottom-start", children, className, ...rest }, ref) {
2812
+ const { open, triggerRef, positionerRef } = useMenuCtx();
2813
+ return /* @__PURE__ */ jsx23(
2814
+ FloatingPositioner,
2815
+ {
2816
+ ref,
2817
+ open,
2818
+ scope: menuAnatomy.scope,
2819
+ part: menuAnatomy.positioner,
2820
+ triggerRef,
2821
+ positionerRef,
2822
+ portalled,
2823
+ placement,
2824
+ className,
2825
+ ...rest,
2826
+ children
2827
+ }
2828
+ );
2829
+ });
2830
+ var Content7 = forwardRef22(function MenuContent({ onKeyDown, ...rest }, ref) {
2831
+ const { open, send, menuId } = useMenuCtx();
2832
+ if (!open) return null;
2833
+ return /* @__PURE__ */ jsx23(
2834
+ "div",
2835
+ {
2836
+ ref,
2837
+ id: menuId,
2838
+ role: "menu",
2839
+ ...mergeProps(
2840
+ partAttrs19(menuAnatomy.scope, menuAnatomy.content, { state: "open" }),
2841
+ {
2842
+ onKeyDown: (e) => {
2843
+ onKeyDown?.(e);
2844
+ if (e.key === "Escape") send({ type: "ESCAPE" });
2845
+ }
2846
+ },
2847
+ rest
2848
+ )
2849
+ }
2850
+ );
2851
+ });
2852
+ var Item5 = forwardRef22(function MenuItem({ closeOnSelect = true, onClick, ...rest }, ref) {
2853
+ const { send } = useMenuCtx();
2854
+ return /* @__PURE__ */ jsx23(
2855
+ "button",
2856
+ {
2857
+ ref,
2858
+ type: "button",
2859
+ role: "menuitem",
2860
+ ...mergeProps(
2861
+ partAttrs19(menuAnatomy.scope, menuAnatomy.item),
2862
+ {
2863
+ onClick: (e) => {
2864
+ onClick?.(e);
2865
+ if (closeOnSelect && !e.defaultPrevented) send({ type: "CLOSE" });
2866
+ }
2867
+ },
2868
+ rest
2869
+ )
2870
+ }
2871
+ );
2872
+ });
2873
+ var Separator2 = forwardRef22(function MenuSeparator(props, ref) {
2874
+ return /* @__PURE__ */ jsx23("div", { ref, role: "separator", ...mergeProps(partAttrs19(menuAnatomy.scope, menuAnatomy.separator), props) });
2875
+ });
2876
+ var Menu = { Root: Root17, Trigger: Trigger5, Positioner: Positioner4, Content: Content7, Item: Item5, Separator: Separator2 };
2877
+
2878
+ // src/tooltip/index.tsx
2879
+ import { tooltipAnatomy, partAttrs as partAttrs20 } from "@aeon-ui/core";
2880
+ import {
2881
+ createContext as createContext17,
2882
+ forwardRef as forwardRef23,
2883
+ useContext as useContext17,
2884
+ useEffect as useEffect18,
2885
+ useId as useId6,
2886
+ useMemo as useMemo17,
2887
+ useRef as useRef9,
2888
+ useState as useState7
2889
+ } from "react";
2890
+
2891
+ // src/hooks/use-prefers-hover.ts
2892
+ import { useEffect as useEffect17, useState as useState6 } from "react";
2893
+ function usePrefersHover() {
2894
+ const [prefersHover, setPrefersHover] = useState6(true);
2895
+ useEffect17(() => {
2896
+ const mq = window.matchMedia("(hover: hover) and (pointer: fine)");
2897
+ const update = () => setPrefersHover(mq.matches);
2898
+ update();
2899
+ mq.addEventListener("change", update);
2900
+ return () => mq.removeEventListener("change", update);
2901
+ }, []);
2902
+ return prefersHover;
2903
+ }
2904
+
2905
+ // src/tooltip/index.tsx
2906
+ import { jsx as jsx24 } from "react/jsx-runtime";
2907
+ var TooltipCtx = createContext17(null);
2908
+ function useTooltipCtx() {
2909
+ const ctx = useContext17(TooltipCtx);
2910
+ if (!ctx) throw new Error("Tooltip parts must be used within Tooltip.Root");
2911
+ return ctx;
2912
+ }
2913
+ var Root18 = forwardRef23(function TooltipRoot({
2914
+ open,
2915
+ defaultOpen = false,
2916
+ onOpenChange,
2917
+ openDelay = 400,
2918
+ closeDelay = 100,
2919
+ touchDurationMs = 5e3,
2920
+ touchOutsideGraceMs = 400,
2921
+ showOnFocus = true,
2922
+ children,
2923
+ className,
2924
+ ...rest
2925
+ }, ref) {
2926
+ const [uncontrolled, setUncontrolled] = useState7(defaultOpen);
2927
+ const resolvedOpen = open ?? uncontrolled;
2928
+ const showTimer = useRef9(void 0);
2929
+ const hideTimer = useRef9(void 0);
2930
+ const triggerRef = useRef9(null);
2931
+ const positionerRef = useRef9(null);
2932
+ const triggerId = useId6();
2933
+ const contentId = useId6();
2934
+ const prefersHover = usePrefersHover();
2935
+ const [outsideClickEnabled, setOutsideClickEnabled] = useState7(false);
2936
+ useEffect18(() => {
2937
+ if (!resolvedOpen || prefersHover) {
2938
+ setOutsideClickEnabled(false);
2939
+ return;
2940
+ }
2941
+ setOutsideClickEnabled(false);
2942
+ const id = window.setTimeout(() => setOutsideClickEnabled(true), touchOutsideGraceMs);
2943
+ return () => window.clearTimeout(id);
2944
+ }, [resolvedOpen, prefersHover, touchOutsideGraceMs]);
2945
+ const setOpen = (next) => {
2946
+ if (open === void 0) setUncontrolled(next);
2947
+ onOpenChange?.(next);
2948
+ };
2949
+ useEffect18(() => {
2950
+ onOpenChange?.(resolvedOpen);
2951
+ }, [resolvedOpen, onOpenChange]);
2952
+ const hideNow = () => {
2953
+ if (showTimer.current !== void 0) clearTimeout(showTimer.current);
2954
+ if (hideTimer.current !== void 0) clearTimeout(hideTimer.current);
2955
+ setOpen(false);
2956
+ };
2957
+ const showImmediately = () => {
2958
+ if (showTimer.current !== void 0) clearTimeout(showTimer.current);
2959
+ if (hideTimer.current !== void 0) clearTimeout(hideTimer.current);
2960
+ setOpen(true);
2961
+ if (!prefersHover) {
2962
+ if (touchDurationMs > 0) {
2963
+ hideTimer.current = setTimeout(() => hideNow(), touchDurationMs);
2964
+ }
2965
+ }
2966
+ };
2967
+ const scheduleShow = () => {
2968
+ if (hideTimer.current !== void 0) clearTimeout(hideTimer.current);
2969
+ showTimer.current = setTimeout(() => setOpen(true), openDelay);
2970
+ };
2971
+ const scheduleHide = () => {
2972
+ if (showTimer.current !== void 0) clearTimeout(showTimer.current);
2973
+ if (closeDelay <= 0) {
2974
+ setOpen(false);
2975
+ return;
2976
+ }
2977
+ hideTimer.current = setTimeout(() => setOpen(false), closeDelay);
2978
+ };
2979
+ const toggleTouch = () => {
2980
+ if (resolvedOpen) hideNow();
2981
+ else showImmediately();
2982
+ };
2983
+ useOutsideClick([triggerRef, positionerRef], resolvedOpen && !prefersHover && outsideClickEnabled, hideNow);
2984
+ const value = useMemo17(
2985
+ () => ({
2986
+ open: resolvedOpen,
2987
+ setOpen,
2988
+ triggerId,
2989
+ contentId,
2990
+ triggerRef,
2991
+ positionerRef,
2992
+ scheduleShow,
2993
+ scheduleHide,
2994
+ showImmediately,
2995
+ hideNow,
2996
+ toggleTouch,
2997
+ showOnFocus,
2998
+ prefersHover
2999
+ }),
3000
+ [resolvedOpen, triggerId, contentId, openDelay, closeDelay, touchDurationMs, touchOutsideGraceMs, showOnFocus, prefersHover]
3001
+ );
3002
+ return /* @__PURE__ */ jsx24(TooltipCtx.Provider, { value, children: /* @__PURE__ */ jsx24(
3003
+ "div",
3004
+ {
3005
+ ref,
3006
+ className,
3007
+ ...mergeProps(
3008
+ partAttrs20(tooltipAnatomy.scope, tooltipAnatomy.root, {
3009
+ state: resolvedOpen ? "open" : "closed"
3010
+ }),
3011
+ rest
3012
+ ),
3013
+ children
3014
+ }
3015
+ ) });
3016
+ });
3017
+ var Trigger6 = forwardRef23(function TooltipTrigger({ onClick, onMouseEnter, onMouseLeave, onFocus, onBlur, onPointerDown, ...rest }, ref) {
3018
+ const {
3019
+ open,
3020
+ triggerId,
3021
+ contentId,
3022
+ triggerRef,
3023
+ scheduleShow,
3024
+ scheduleHide,
3025
+ hideNow,
3026
+ toggleTouch,
3027
+ showOnFocus,
3028
+ prefersHover
3029
+ } = useTooltipCtx();
3030
+ return /* @__PURE__ */ jsx24(
3031
+ "span",
3032
+ {
3033
+ ref: (node) => {
3034
+ triggerRef.current = node;
3035
+ if (typeof ref === "function") ref(node);
3036
+ else if (ref) ref.current = node;
3037
+ },
3038
+ id: triggerId,
3039
+ tabIndex: 0,
3040
+ "aria-describedby": open ? contentId : void 0,
3041
+ ...mergeProps(
3042
+ partAttrs20(tooltipAnatomy.scope, tooltipAnatomy.trigger, { state: open ? "open" : "closed" }),
3043
+ {
3044
+ onMouseEnter: (e) => {
3045
+ onMouseEnter?.(e);
3046
+ if (prefersHover) scheduleShow();
3047
+ },
3048
+ onMouseLeave: (e) => {
3049
+ onMouseLeave?.(e);
3050
+ if (prefersHover) scheduleHide();
3051
+ },
3052
+ onFocus: (e) => {
3053
+ onFocus?.(e);
3054
+ if (showOnFocus && prefersHover) scheduleShow();
3055
+ },
3056
+ onBlur: (e) => {
3057
+ onBlur?.(e);
3058
+ if (showOnFocus && prefersHover) scheduleHide();
3059
+ },
3060
+ onClick: (e) => {
3061
+ onClick?.(e);
3062
+ if (!e.defaultPrevented && !prefersHover) toggleTouch();
3063
+ },
3064
+ onPointerDown: (e) => {
3065
+ onPointerDown?.(e);
3066
+ if (showOnFocus && prefersHover && e.pointerType === "mouse") hideNow();
3067
+ }
3068
+ },
3069
+ rest
3070
+ )
3071
+ }
3072
+ );
3073
+ });
3074
+ var Positioner5 = forwardRef23(function TooltipPositioner({ portalled = true, placement = "top-start", children, className, ...rest }, ref) {
3075
+ const { open, triggerRef, positionerRef } = useTooltipCtx();
3076
+ return /* @__PURE__ */ jsx24(
3077
+ FloatingPositioner,
3078
+ {
3079
+ ref,
3080
+ open,
3081
+ scope: tooltipAnatomy.scope,
3082
+ part: tooltipAnatomy.positioner,
3083
+ triggerRef,
3084
+ positionerRef,
3085
+ portalled,
3086
+ placement,
3087
+ className,
3088
+ ...rest,
3089
+ children
3090
+ }
3091
+ );
3092
+ });
3093
+ var Content8 = forwardRef23(function TooltipContent(props, ref) {
3094
+ const { open, contentId } = useTooltipCtx();
3095
+ if (!open) return null;
3096
+ return /* @__PURE__ */ jsx24(
3097
+ "div",
3098
+ {
3099
+ ref,
3100
+ id: contentId,
3101
+ role: "tooltip",
3102
+ ...mergeProps(partAttrs20(tooltipAnatomy.scope, tooltipAnatomy.content, { state: "open" }), props)
3103
+ }
3104
+ );
3105
+ });
3106
+ var Arrow2 = forwardRef23(function TooltipArrow(props, ref) {
3107
+ const { open } = useTooltipCtx();
3108
+ if (!open) return null;
3109
+ return /* @__PURE__ */ jsx24("div", { ref, ...mergeProps(partAttrs20(tooltipAnatomy.scope, tooltipAnatomy.arrow), props) });
3110
+ });
3111
+ var Tooltip = { Root: Root18, Trigger: Trigger6, Positioner: Positioner5, Content: Content8, Arrow: Arrow2 };
3112
+
3113
+ // src/toast/primitives.tsx
3114
+ import { toastAnatomy, partAttrs as partAttrs21 } from "@aeon-ui/core";
3115
+ import { toastMachine } from "@aeon-ui/primitives";
3116
+ import {
3117
+ createContext as createContext18,
3118
+ forwardRef as forwardRef24,
3119
+ useContext as useContext18,
3120
+ useEffect as useEffect19,
3121
+ useId as useId7,
3122
+ useMemo as useMemo18,
3123
+ useRef as useRef10
3124
+ } from "react";
3125
+ import { jsx as jsx25 } from "react/jsx-runtime";
3126
+ var ToastCtx = createContext18(null);
3127
+ function useToastCtx() {
3128
+ const ctx = useContext18(ToastCtx);
3129
+ if (!ctx) throw new Error("Toast parts must be used within Toast.Root");
3130
+ return ctx;
3131
+ }
3132
+ var Root19 = forwardRef24(function ToastRoot({ durationMs = 5e3, defaultVisible = false, onVisibleChange, children, className, ...rest }, ref) {
3133
+ const [snapshot, send] = useAeonMachine(toastMachine, { input: { durationMs } });
3134
+ const visible = snapshot.matches("visible");
3135
+ const titleId = useId7();
3136
+ const hasBeenVisible = useRef10(false);
3137
+ useEffect19(() => {
3138
+ if (defaultVisible) send({ type: "SHOW" });
3139
+ }, [defaultVisible, send]);
3140
+ useEffect19(() => {
3141
+ if (visible) {
3142
+ hasBeenVisible.current = true;
3143
+ onVisibleChange?.(true);
3144
+ return;
3145
+ }
3146
+ if (hasBeenVisible.current) onVisibleChange?.(false);
3147
+ }, [visible, onVisibleChange]);
3148
+ const value = useMemo18(() => ({ visible, send, titleId }), [visible, send, titleId]);
3149
+ return /* @__PURE__ */ jsx25(ToastCtx.Provider, { value, children: /* @__PURE__ */ jsx25(
3150
+ "div",
3151
+ {
3152
+ ref,
3153
+ role: "status",
3154
+ "aria-live": "polite",
3155
+ "aria-atomic": "true",
3156
+ ...mergeProps(
3157
+ partAttrs21(toastAnatomy.scope, toastAnatomy.root, { state: visible ? "visible" : "hidden" }),
3158
+ rest
3159
+ ),
3160
+ className,
3161
+ hidden: !visible,
3162
+ children: visible ? children : null
3163
+ }
3164
+ ) });
3165
+ });
3166
+ var Title2 = forwardRef24(function ToastTitle(props, ref) {
3167
+ const { titleId } = useToastCtx();
3168
+ return /* @__PURE__ */ jsx25("p", { ref, id: titleId, ...mergeProps(partAttrs21(toastAnatomy.scope, toastAnatomy.title), props) });
3169
+ });
3170
+ var Description2 = forwardRef24(
3171
+ function ToastDescription(props, ref) {
3172
+ return /* @__PURE__ */ jsx25("p", { ref, ...mergeProps(partAttrs21(toastAnatomy.scope, toastAnatomy.description), props) });
3173
+ }
3174
+ );
3175
+ var CloseTrigger3 = forwardRef24(
3176
+ function ToastCloseTrigger({ onClick, children, ...rest }, ref) {
3177
+ const { send } = useToastCtx();
3178
+ return /* @__PURE__ */ jsx25(
3179
+ "button",
3180
+ {
3181
+ ref,
3182
+ type: "button",
3183
+ "aria-label": "Dismiss",
3184
+ ...mergeProps(
3185
+ partAttrs21(toastAnatomy.scope, toastAnatomy.closeTrigger),
3186
+ {
3187
+ onClick: (e) => {
3188
+ onClick?.(e);
3189
+ send({ type: "DISMISS" });
3190
+ }
3191
+ },
3192
+ rest
3193
+ ),
3194
+ children: children ?? "\xD7"
3195
+ }
3196
+ );
3197
+ }
3198
+ );
3199
+ function Show({ durationMs }) {
3200
+ const { send } = useToastCtx();
3201
+ useEffect19(() => {
3202
+ send({ type: "SHOW" });
3203
+ if (durationMs !== void 0) {
3204
+ return () => send({ type: "DISMISS" });
3205
+ }
3206
+ }, [send, durationMs]);
3207
+ return null;
3208
+ }
3209
+
3210
+ // src/toast/provider.tsx
3211
+ import { toastAnatomy as toastAnatomy2, partAttrs as partAttrs22 } from "@aeon-ui/core";
3212
+ import {
3213
+ useCallback as useCallback8,
3214
+ useEffect as useEffect20,
3215
+ useMemo as useMemo19,
3216
+ useState as useState8
3217
+ } from "react";
3218
+ import { createPortal as createPortal2 } from "react-dom";
3219
+
3220
+ // src/toast/context.tsx
3221
+ import { createContext as createContext19, useContext as useContext19 } from "react";
3222
+ var ToastStoreCtx = createContext19(null);
3223
+ function useToastStore() {
3224
+ const ctx = useContext19(ToastStoreCtx);
3225
+ if (!ctx) {
3226
+ throw new Error("useToast must be used within Toast.Provider");
3227
+ }
3228
+ return ctx;
3229
+ }
3230
+
3231
+ // src/toast/toast-item.tsx
3232
+ import { forwardRef as forwardRef25 } from "react";
3233
+ import { jsx as jsx26, jsxs as jsxs4 } from "react/jsx-runtime";
3234
+ var ToastItem = forwardRef25(function ToastItem2({ item, onExited, className, ...rest }, ref) {
3235
+ const { id, title, description, durationMs } = item;
3236
+ return /* @__PURE__ */ jsxs4(
3237
+ Root19,
3238
+ {
3239
+ ref,
3240
+ className,
3241
+ defaultVisible: true,
3242
+ durationMs: durationMs ?? 5e3,
3243
+ onVisibleChange: (visible) => {
3244
+ if (!visible) onExited(id);
3245
+ },
3246
+ ...rest,
3247
+ children: [
3248
+ title ? /* @__PURE__ */ jsx26(Title2, { children: title }) : null,
3249
+ description ? /* @__PURE__ */ jsx26(Description2, { children: description }) : null,
3250
+ /* @__PURE__ */ jsx26(CloseTrigger3, {})
3251
+ ]
3252
+ }
3253
+ );
3254
+ });
3255
+
3256
+ // src/toast/provider.tsx
3257
+ import { jsx as jsx27 } from "react/jsx-runtime";
3258
+ var PLACEMENT_ATTR = {
3259
+ "top-start": "top-start",
3260
+ "top-end": "top-end",
3261
+ "bottom-start": "bottom-start",
3262
+ "bottom-end": "bottom-end"
3263
+ };
3264
+ function nextToastId() {
3265
+ return `toast-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
3266
+ }
3267
+ function ToastProvider({ children, limit = 5 }) {
3268
+ const [items, setItems] = useState8([]);
3269
+ const dismiss = useCallback8((id) => {
3270
+ setItems((prev) => prev.filter((t) => t.id !== id));
3271
+ }, []);
3272
+ const dismissAll = useCallback8(() => {
3273
+ setItems([]);
3274
+ }, []);
3275
+ const publish = useCallback8(
3276
+ (options) => {
3277
+ const id = options.id ?? nextToastId();
3278
+ const record = { ...options, id };
3279
+ setItems((prev) => {
3280
+ const without = prev.filter((t) => t.id !== id);
3281
+ const next = [...without, record];
3282
+ return next.length > limit ? next.slice(-limit) : next;
3283
+ });
3284
+ return id;
3285
+ },
3286
+ [limit]
3287
+ );
3288
+ const value = useMemo19(
3289
+ () => ({ items, publish, dismiss, dismissAll }),
3290
+ [items, publish, dismiss, dismissAll]
3291
+ );
3292
+ return /* @__PURE__ */ jsx27(ToastStoreCtx.Provider, { value, children });
3293
+ }
3294
+ function ToastViewport({ placement = "bottom-end", className, ...rest }) {
3295
+ const { items, dismiss } = useToastStore();
3296
+ const [mounted, setMounted] = useState8(false);
3297
+ useEffect20(() => {
3298
+ setMounted(true);
3299
+ }, []);
3300
+ if (!mounted) return null;
3301
+ return createPortal2(
3302
+ /* @__PURE__ */ jsx27(
3303
+ "div",
3304
+ {
3305
+ ...mergeProps(
3306
+ partAttrs22(toastAnatomy2.scope, toastAnatomy2.viewport, {
3307
+ state: items.length > 0 ? "active" : "idle"
3308
+ }),
3309
+ {
3310
+ "data-placement": PLACEMENT_ATTR[placement]
3311
+ },
3312
+ rest
3313
+ ),
3314
+ className,
3315
+ children: items.map((item) => /* @__PURE__ */ jsx27(ToastItem, { item, onExited: dismiss }, item.id))
3316
+ }
3317
+ ),
3318
+ document.body
3319
+ );
3320
+ }
3321
+ function useToast() {
3322
+ const { publish, dismiss, dismissAll } = useToastStore();
3323
+ return { publish, dismiss, dismissAll };
3324
+ }
3325
+
3326
+ // src/toast/index.tsx
3327
+ var Toast = {
3328
+ Provider: ToastProvider,
3329
+ Viewport: ToastViewport,
3330
+ Root: Root19,
3331
+ Title: Title2,
3332
+ Description: Description2,
3333
+ CloseTrigger: CloseTrigger3,
3334
+ Show
3335
+ };
3336
+
3337
+ // src/theme-switcher/index.tsx
3338
+ import { partAttrs as partAttrs23, scopeAttrs as scopeAttrs2, themeSwitcherAnatomy } from "@aeon-ui/core";
3339
+ import {
3340
+ applyAeonTheme,
3341
+ initAeonTheme
3342
+ } from "@aeon-ui/core";
3343
+ import {
3344
+ createContext as createContext20,
3345
+ forwardRef as forwardRef26,
3346
+ useContext as useContext20,
3347
+ useLayoutEffect as useLayoutEffect2,
3348
+ useState as useState9
3349
+ } from "react";
3350
+ import { jsx as jsx28 } from "react/jsx-runtime";
3351
+ var Root20 = forwardRef26(
3352
+ function ThemeSwitcherRoot({ defaultTheme, defaultMode, onThemeChange, children, ...rest }, ref) {
3353
+ const [themeId, setThemeId] = useState9(defaultTheme ?? "default");
3354
+ const [mode, setMode] = useState9(defaultMode ?? "dark");
3355
+ useLayoutEffect2(() => {
3356
+ const { themeId: t, mode: m } = initAeonTheme();
3357
+ setThemeId(t);
3358
+ setMode(m);
3359
+ }, []);
3360
+ const handleThemeChange = (next) => {
3361
+ setThemeId(next);
3362
+ applyAeonTheme(next, mode);
3363
+ onThemeChange?.(next, mode);
3364
+ };
3365
+ const handleModeChange = (next) => {
3366
+ setMode(next);
3367
+ applyAeonTheme(themeId, next);
3368
+ onThemeChange?.(themeId, next);
3369
+ };
3370
+ return /* @__PURE__ */ jsx28(
3371
+ "div",
3372
+ {
3373
+ ref,
3374
+ ...mergeProps(
3375
+ scopeAttrs2(themeSwitcherAnatomy.scope, themeSwitcherAnatomy.root),
3376
+ rest
3377
+ ),
3378
+ children: /* @__PURE__ */ jsx28(
3379
+ ThemeSwitcherContext.Provider,
3380
+ {
3381
+ value: { themeId, mode, handleThemeChange, handleModeChange },
3382
+ children
3383
+ }
3384
+ )
3385
+ }
3386
+ );
3387
+ }
3388
+ );
3389
+ var ThemeSwitcherContext = createContext20(null);
3390
+ function useThemeSwitcher() {
3391
+ const ctx = useContext20(ThemeSwitcherContext);
3392
+ if (!ctx) throw new Error("ThemeSwitcher parts must be used inside <ThemeSwitcher.Root>");
3393
+ return ctx;
3394
+ }
3395
+ var Modes = forwardRef26(
3396
+ function ThemeSwitcherModes(props, ref) {
3397
+ return /* @__PURE__ */ jsx28(
3398
+ "div",
3399
+ {
3400
+ ref,
3401
+ role: "group",
3402
+ "aria-label": "Color mode",
3403
+ ...mergeProps(
3404
+ partAttrs23(themeSwitcherAnatomy.scope, themeSwitcherAnatomy.modes),
3405
+ props
3406
+ )
3407
+ }
3408
+ );
3409
+ }
3410
+ );
3411
+ var ModeBtn = forwardRef26(
3412
+ function ThemeSwitcherModeBtn({ mode, active, ...rest }, ref) {
3413
+ const { handleModeChange } = useThemeSwitcher();
3414
+ return /* @__PURE__ */ jsx28(
3415
+ "button",
3416
+ {
3417
+ ref,
3418
+ type: "button",
3419
+ "aria-pressed": active,
3420
+ "data-active": active ? "true" : void 0,
3421
+ ...mergeProps(
3422
+ partAttrs23(themeSwitcherAnatomy.scope, themeSwitcherAnatomy.modeBtn),
3423
+ rest
3424
+ ),
3425
+ onClick: (e) => {
3426
+ handleModeChange(mode);
3427
+ rest.onClick?.(e);
3428
+ },
3429
+ children: rest.children ?? (mode === "light" ? "Light" : "Dark")
3430
+ }
3431
+ );
3432
+ }
3433
+ );
3434
+ var ThemeSelect = forwardRef26(
3435
+ function ThemeSwitcherThemeSelect({ children, ...rest }, ref) {
3436
+ return /* @__PURE__ */ jsx28(
3437
+ "div",
3438
+ {
3439
+ ref,
3440
+ ...mergeProps(
3441
+ partAttrs23(themeSwitcherAnatomy.scope, themeSwitcherAnatomy.themeSelect),
3442
+ rest
3443
+ ),
3444
+ children
3445
+ }
3446
+ );
3447
+ }
3448
+ );
3449
+ var ThemeTrigger = forwardRef26(
3450
+ function ThemeSwitcherThemeTrigger(props, ref) {
3451
+ const { themeId } = useThemeSwitcher();
3452
+ return /* @__PURE__ */ jsx28(
3453
+ "button",
3454
+ {
3455
+ ref,
3456
+ type: "button",
3457
+ "aria-label": `Theme preset: ${themeId}`,
3458
+ ...mergeProps(
3459
+ partAttrs23(themeSwitcherAnatomy.scope, themeSwitcherAnatomy.themeTrigger),
3460
+ props
3461
+ ),
3462
+ children: props.children ?? themeId
3463
+ }
3464
+ );
3465
+ }
3466
+ );
3467
+ var ThemeSwitcher = {
3468
+ Root: Root20,
3469
+ Modes,
3470
+ ModeBtn,
3471
+ ThemeSelect,
3472
+ ThemeTrigger
3473
+ };
3474
+
3475
+ // src/avatar/index.tsx
3476
+ import { avatarAnatomy, partAttrs as partAttrs24 } from "@aeon-ui/core";
3477
+ import {
3478
+ createContext as createContext21,
3479
+ forwardRef as forwardRef27,
3480
+ useCallback as useCallback9,
3481
+ useContext as useContext21,
3482
+ useEffect as useEffect21,
3483
+ useMemo as useMemo20,
3484
+ useState as useState10
3485
+ } from "react";
3486
+ import { jsx as jsx29 } from "react/jsx-runtime";
3487
+ var AvatarCtx = createContext21(null);
3488
+ function useAvatarCtx() {
3489
+ const ctx = useContext21(AvatarCtx);
3490
+ if (!ctx) throw new Error("Avatar parts must be used within Avatar.Root");
3491
+ return ctx;
3492
+ }
3493
+ var Root21 = forwardRef27(function AvatarRoot({ children, className, ...rest }, ref) {
3494
+ const [status, setStatus] = useState10("idle");
3495
+ const value = useMemo20(() => ({ status, setStatus }), [status]);
3496
+ return /* @__PURE__ */ jsx29(AvatarCtx.Provider, { value, children: /* @__PURE__ */ jsx29(
3497
+ "span",
3498
+ {
3499
+ ref,
3500
+ className,
3501
+ ...mergeProps(
3502
+ partAttrs24(avatarAnatomy.scope, avatarAnatomy.root, { state: status }),
3503
+ rest
3504
+ ),
3505
+ children
3506
+ }
3507
+ ) });
3508
+ });
3509
+ var Image = forwardRef27(function AvatarImage({ src, alt, onLoad, onError, className, ...rest }, ref) {
3510
+ const { status, setStatus } = useAvatarCtx();
3511
+ useEffect21(() => {
3512
+ if (!src) setStatus("idle");
3513
+ else setStatus("loading");
3514
+ }, [src, setStatus]);
3515
+ const handleLoad = useCallback9(
3516
+ (e) => {
3517
+ onLoad?.(e);
3518
+ setStatus("loaded");
3519
+ },
3520
+ [onLoad, setStatus]
3521
+ );
3522
+ const handleError = useCallback9(
3523
+ (e) => {
3524
+ onError?.(e);
3525
+ setStatus("error");
3526
+ },
3527
+ [onError, setStatus]
3528
+ );
3529
+ return /* @__PURE__ */ jsx29(
3530
+ "img",
3531
+ {
3532
+ ref,
3533
+ src,
3534
+ alt,
3535
+ hidden: status !== "loaded",
3536
+ ...partAttrs24(avatarAnatomy.scope, avatarAnatomy.image, { state: status }),
3537
+ className,
3538
+ ...mergeProps(rest, { onLoad: handleLoad, onError: handleError })
3539
+ }
3540
+ );
3541
+ });
3542
+ var Fallback = forwardRef27(function AvatarFallback({ className, ...rest }, ref) {
3543
+ const { status } = useAvatarCtx();
3544
+ const show = status !== "loaded";
3545
+ return /* @__PURE__ */ jsx29(
3546
+ "span",
3547
+ {
3548
+ ref,
3549
+ hidden: !show,
3550
+ ...partAttrs24(avatarAnatomy.scope, avatarAnatomy.fallback, { state: status }),
3551
+ className,
3552
+ ...rest
3553
+ }
3554
+ );
3555
+ });
3556
+ var Badge = forwardRef27(function AvatarBadge({ presence = "idle", className, ...rest }, ref) {
3557
+ useAvatarCtx();
3558
+ return /* @__PURE__ */ jsx29(
3559
+ "span",
3560
+ {
3561
+ ref,
3562
+ "data-aeon-presence": presence,
3563
+ ...partAttrs24(avatarAnatomy.scope, avatarAnatomy.badge, { state: presence }),
3564
+ className,
3565
+ ...rest
3566
+ }
3567
+ );
3568
+ });
3569
+ var Avatar = {
3570
+ Root: Root21,
3571
+ Image,
3572
+ Fallback,
3573
+ Badge
3574
+ };
3575
+
3576
+ // src/identity/index.tsx
3577
+ import { identityAnatomy, partAttrs as partAttrs25, scopeAttrs as scopeAttrs3 } from "@aeon-ui/core";
3578
+ import { createContext as createContext22, forwardRef as forwardRef28, useContext as useContext22 } from "react";
3579
+ import { jsx as jsx30 } from "react/jsx-runtime";
3580
+ var IdentityCtx = createContext22(null);
3581
+ function useIdentityCtx() {
3582
+ const ctx = useContext22(IdentityCtx);
3583
+ if (!ctx) throw new Error("Identity parts must be used within Identity.Root");
3584
+ return ctx;
3585
+ }
3586
+ var Root22 = forwardRef28(function IdentityRoot({ as: Tag = "div", size = "md", children, ...rest }, ref) {
3587
+ return /* @__PURE__ */ jsx30(IdentityCtx.Provider, { value: { size }, children: /* @__PURE__ */ jsx30(
3588
+ Tag,
3589
+ {
3590
+ ref,
3591
+ "data-aeon-size": size,
3592
+ ...mergeProps(scopeAttrs3(identityAnatomy.scope, identityAnatomy.root), rest),
3593
+ children
3594
+ }
3595
+ ) });
3596
+ });
3597
+ var AvatarSlot = forwardRef28(
3598
+ function IdentityAvatar(props, ref) {
3599
+ useIdentityCtx();
3600
+ return /* @__PURE__ */ jsx30(
3601
+ "span",
3602
+ {
3603
+ ref,
3604
+ ...mergeProps(partAttrs25(identityAnatomy.scope, identityAnatomy.avatar), props)
3605
+ }
3606
+ );
3607
+ }
3608
+ );
3609
+ var Title3 = forwardRef28(function IdentityTitle(props, ref) {
3610
+ useIdentityCtx();
3611
+ return /* @__PURE__ */ jsx30(
3612
+ "span",
3613
+ {
3614
+ ref,
3615
+ ...mergeProps(partAttrs25(identityAnatomy.scope, identityAnatomy.title), props)
3616
+ }
3617
+ );
3618
+ });
3619
+ var Subtitle = forwardRef28(
3620
+ function IdentitySubtitle(props, ref) {
3621
+ useIdentityCtx();
3622
+ return /* @__PURE__ */ jsx30(
3623
+ "span",
3624
+ {
3625
+ ref,
3626
+ ...mergeProps(partAttrs25(identityAnatomy.scope, identityAnatomy.subtitle), props)
3627
+ }
3628
+ );
3629
+ }
3630
+ );
3631
+ var Meta = forwardRef28(function IdentityMeta(props, ref) {
3632
+ useIdentityCtx();
3633
+ return /* @__PURE__ */ jsx30("span", { ref, ...mergeProps(partAttrs25(identityAnatomy.scope, identityAnatomy.meta), props) });
3634
+ });
3635
+ var Trailing = forwardRef28(
3636
+ function IdentityTrailing(props, ref) {
3637
+ useIdentityCtx();
3638
+ return /* @__PURE__ */ jsx30(
3639
+ "span",
3640
+ {
3641
+ ref,
3642
+ ...mergeProps(partAttrs25(identityAnatomy.scope, identityAnatomy.trailing), props)
3643
+ }
3644
+ );
3645
+ }
3646
+ );
3647
+ var Identity = {
3648
+ Root: Root22,
3649
+ Avatar: AvatarSlot,
3650
+ Title: Title3,
3651
+ Subtitle,
3652
+ Meta,
3653
+ Trailing
3654
+ };
3655
+
3656
+ // src/metric-strip/index.tsx
3657
+ import { metricStripAnatomy, partAttrs as partAttrs26, scopeAttrs as scopeAttrs4 } from "@aeon-ui/core";
3658
+ import { createContext as createContext23, forwardRef as forwardRef29, useContext as useContext23 } from "react";
3659
+ import { jsx as jsx31 } from "react/jsx-runtime";
3660
+ var MetricCtx = createContext23(null);
3661
+ function useMetricCtx() {
3662
+ const ctx = useContext23(MetricCtx);
3663
+ if (!ctx) throw new Error("MetricStrip parts must be used within MetricStrip.Root");
3664
+ return ctx;
3665
+ }
3666
+ var Root23 = forwardRef29(function MetricStripRoot({ density = "cluster", children, ...rest }, ref) {
3667
+ return /* @__PURE__ */ jsx31(MetricCtx.Provider, { value: { density }, children: /* @__PURE__ */ jsx31(
3668
+ "div",
3669
+ {
3670
+ ref,
3671
+ "data-aeon-density": density,
3672
+ role: "group",
3673
+ ...mergeProps(scopeAttrs4(metricStripAnatomy.scope, metricStripAnatomy.root), rest),
3674
+ children
3675
+ }
3676
+ ) });
3677
+ });
3678
+ var Chip = forwardRef29(function MetricChip(props, ref) {
3679
+ useMetricCtx();
3680
+ return /* @__PURE__ */ jsx31(
3681
+ "span",
3682
+ {
3683
+ ref,
3684
+ ...mergeProps(partAttrs26(metricStripAnatomy.scope, metricStripAnatomy.chip), props)
3685
+ }
3686
+ );
3687
+ });
3688
+ var Value = forwardRef29(function MetricValue(props, ref) {
3689
+ useMetricCtx();
3690
+ return /* @__PURE__ */ jsx31(
3691
+ "span",
3692
+ {
3693
+ ref,
3694
+ ...mergeProps(partAttrs26(metricStripAnatomy.scope, metricStripAnatomy.value), props)
3695
+ }
3696
+ );
3697
+ });
3698
+ var Label6 = forwardRef29(function MetricLabel(props, ref) {
3699
+ useMetricCtx();
3700
+ return /* @__PURE__ */ jsx31(
3701
+ "span",
3702
+ {
3703
+ ref,
3704
+ ...mergeProps(partAttrs26(metricStripAnatomy.scope, metricStripAnatomy.label), props)
3705
+ }
3706
+ );
3707
+ });
3708
+ var MetricStrip = {
3709
+ Root: Root23,
3710
+ Chip,
3711
+ Value,
3712
+ Label: Label6
3713
+ };
3714
+
3715
+ // src/list-row/index.tsx
3716
+ import { listRowAnatomy, partAttrs as partAttrs27, scopeAttrs as scopeAttrs5 } from "@aeon-ui/core";
3717
+ import { forwardRef as forwardRef30 } from "react";
3718
+ import { jsx as jsx32 } from "react/jsx-runtime";
3719
+ var Root24 = forwardRef30(function ListRowRoot({ as: Tag = "button", type, children, ...rest }, ref) {
3720
+ const buttonType = Tag === "button" ? type ?? "button" : void 0;
3721
+ return /* @__PURE__ */ jsx32(
3722
+ Tag,
3723
+ {
3724
+ ref,
3725
+ type: buttonType,
3726
+ ...mergeProps(scopeAttrs5(listRowAnatomy.scope, listRowAnatomy.root), rest),
3727
+ children
3728
+ }
3729
+ );
3730
+ });
3731
+ var Leading = forwardRef30(function ListRowLeading(props, ref) {
3732
+ return /* @__PURE__ */ jsx32(
3733
+ "span",
3734
+ {
3735
+ ref,
3736
+ ...mergeProps(partAttrs27(listRowAnatomy.scope, listRowAnatomy.leading), props)
3737
+ }
3738
+ );
3739
+ });
3740
+ var Label7 = forwardRef30(function ListRowLabel(props, ref) {
3741
+ return /* @__PURE__ */ jsx32("span", { ref, ...mergeProps(partAttrs27(listRowAnatomy.scope, listRowAnatomy.label), props) });
3742
+ });
3743
+ var Description3 = forwardRef30(
3744
+ function ListRowDescription(props, ref) {
3745
+ return /* @__PURE__ */ jsx32(
3746
+ "span",
3747
+ {
3748
+ ref,
3749
+ ...mergeProps(partAttrs27(listRowAnatomy.scope, listRowAnatomy.description), props)
3750
+ }
3751
+ );
3752
+ }
3753
+ );
3754
+ var Trailing2 = forwardRef30(
3755
+ function ListRowTrailing(props, ref) {
3756
+ return /* @__PURE__ */ jsx32(
3757
+ "span",
3758
+ {
3759
+ ref,
3760
+ ...mergeProps(partAttrs27(listRowAnatomy.scope, listRowAnatomy.trailing), props)
3761
+ }
3762
+ );
3763
+ }
3764
+ );
3765
+ var ListRow = {
3766
+ Root: Root24,
3767
+ Leading,
3768
+ Label: Label7,
3769
+ Description: Description3,
3770
+ Trailing: Trailing2
3771
+ };
3772
+
3773
+ // src/entry/index.tsx
3774
+ import { entryAnatomy, partAttrs as partAttrs28, scopeAttrs as scopeAttrs6 } from "@aeon-ui/core";
3775
+ import { forwardRef as forwardRef31 } from "react";
3776
+ import { jsx as jsx33 } from "react/jsx-runtime";
3777
+ var List2 = forwardRef31(function EntryList({ children, ...rest }, ref) {
3778
+ return /* @__PURE__ */ jsx33(
3779
+ "div",
3780
+ {
3781
+ ref,
3782
+ ...mergeProps(scopeAttrs6(entryAnatomy.scope, entryAnatomy.list), rest),
3783
+ children
3784
+ }
3785
+ );
3786
+ });
3787
+ var Root25 = forwardRef31(function EntryRoot({ as: Tag = "article", state = "idle", children, ...rest }, ref) {
3788
+ return /* @__PURE__ */ jsx33(
3789
+ Tag,
3790
+ {
3791
+ ref,
3792
+ ...mergeProps(scopeAttrs6(entryAnatomy.scope, entryAnatomy.root, { state }), rest),
3793
+ children
3794
+ }
3795
+ );
3796
+ });
3797
+ function Part(part, displayName, defaultTag = "div") {
3798
+ const Comp = forwardRef31(
3799
+ function EntryPart({ as: Tag = defaultTag, ...props }, ref) {
3800
+ return /* @__PURE__ */ jsx33(
3801
+ Tag,
3802
+ {
3803
+ ref,
3804
+ ...mergeProps(partAttrs28(entryAnatomy.scope, part), props)
3805
+ }
3806
+ );
3807
+ }
3808
+ );
3809
+ Comp.displayName = displayName;
3810
+ return Comp;
3811
+ }
3812
+ var Entry = {
3813
+ List: List2,
3814
+ Root: Root25,
3815
+ Header: Part(entryAnatomy.header, "Entry.Header", "header"),
3816
+ Leading: Part(entryAnatomy.leading, "Entry.Leading", "div"),
3817
+ Heading: Part(entryAnatomy.heading, "Entry.Heading", "div"),
3818
+ Title: Part(entryAnatomy.title, "Entry.Title", "div"),
3819
+ Subtitle: Part(entryAnatomy.subtitle, "Entry.Subtitle", "div"),
3820
+ Meta: Part(entryAnatomy.meta, "Entry.Meta", "span"),
3821
+ Media: Part(entryAnatomy.media, "Entry.Media", "div"),
3822
+ Body: Part(entryAnatomy.body, "Entry.Body", "div"),
3823
+ Values: Part(entryAnatomy.values, "Entry.Values", "div"),
3824
+ Value: Part(entryAnatomy.value, "Entry.Value", "span"),
3825
+ Actions: Part(entryAnatomy.actions, "Entry.Actions", "div"),
3826
+ Footer: Part(entryAnatomy.footer, "Entry.Footer", "footer")
3827
+ };
3828
+
3829
+ // src/conversation/index.tsx
3830
+ import { conversationAnatomy, partAttrs as partAttrs29, scopeAttrs as scopeAttrs7 } from "@aeon-ui/core";
3831
+ import { forwardRef as forwardRef32 } from "react";
3832
+ import { jsx as jsx34 } from "react/jsx-runtime";
3833
+ var Root26 = forwardRef32(function ConversationRoot({ children, ...rest }, ref) {
3834
+ return /* @__PURE__ */ jsx34(
3835
+ "div",
3836
+ {
3837
+ ref,
3838
+ ...mergeProps(scopeAttrs7(conversationAnatomy.scope, conversationAnatomy.root), rest),
3839
+ children
3840
+ }
3841
+ );
3842
+ });
3843
+ var Item6 = forwardRef32(function ConversationItem({ state = "idle", as: Tag = "button", type, children, ...rest }, ref) {
3844
+ const buttonType = Tag === "button" ? type ?? "button" : void 0;
3845
+ return /* @__PURE__ */ jsx34(
3846
+ Tag,
3847
+ {
3848
+ ref,
3849
+ type: buttonType,
3850
+ ...mergeProps(
3851
+ partAttrs29(conversationAnatomy.scope, conversationAnatomy.item, { state }),
3852
+ rest
3853
+ ),
3854
+ children
3855
+ }
3856
+ );
3857
+ });
3858
+ function Part2(part, displayName) {
3859
+ const Comp = forwardRef32(function ConversationPart(props, ref) {
3860
+ return /* @__PURE__ */ jsx34(
3861
+ "span",
3862
+ {
3863
+ ref,
3864
+ ...mergeProps(partAttrs29(conversationAnatomy.scope, part), props)
3865
+ }
3866
+ );
3867
+ });
3868
+ Comp.displayName = displayName;
3869
+ return Comp;
3870
+ }
3871
+ var Conversation = {
3872
+ Root: Root26,
3873
+ Item: Item6,
3874
+ Leading: Part2(conversationAnatomy.leading, "Conversation.Leading"),
3875
+ Body: Part2(conversationAnatomy.body, "Conversation.Body"),
3876
+ Title: Part2(conversationAnatomy.title, "Conversation.Title"),
3877
+ Preview: Part2(conversationAnatomy.preview, "Conversation.Preview"),
3878
+ Meta: Part2(conversationAnatomy.meta, "Conversation.Meta"),
3879
+ Badge: Part2(conversationAnatomy.badge, "Conversation.Badge")
3880
+ };
3881
+
3882
+ // src/thread/index.tsx
3883
+ import { partAttrs as partAttrs30, scopeAttrs as scopeAttrs8, threadAnatomy } from "@aeon-ui/core";
3884
+ import { forwardRef as forwardRef33 } from "react";
3885
+ import { jsx as jsx35 } from "react/jsx-runtime";
3886
+ var Root27 = forwardRef33(function ThreadRoot({ children, ...rest }, ref) {
3887
+ return /* @__PURE__ */ jsx35(
3888
+ "div",
3889
+ {
3890
+ ref,
3891
+ ...mergeProps(scopeAttrs8(threadAnatomy.scope, threadAnatomy.root), rest),
3892
+ children
3893
+ }
3894
+ );
3895
+ });
3896
+ var List3 = forwardRef33(function ThreadList(props, ref) {
3897
+ return /* @__PURE__ */ jsx35(
3898
+ "div",
3899
+ {
3900
+ ref,
3901
+ role: "log",
3902
+ "aria-live": "polite",
3903
+ ...mergeProps(partAttrs30(threadAnatomy.scope, threadAnatomy.list), props)
3904
+ }
3905
+ );
3906
+ });
3907
+ var Item7 = forwardRef33(function ThreadItem({ state = "theirs", ...rest }, ref) {
3908
+ return /* @__PURE__ */ jsx35(
3909
+ "div",
3910
+ {
3911
+ ref,
3912
+ ...mergeProps(partAttrs30(threadAnatomy.scope, threadAnatomy.item, { state }), rest)
3913
+ }
3914
+ );
3915
+ });
3916
+ var Bubble = forwardRef33(function ThreadBubble(props, ref) {
3917
+ return /* @__PURE__ */ jsx35(
3918
+ "div",
3919
+ {
3920
+ ref,
3921
+ ...mergeProps(partAttrs30(threadAnatomy.scope, threadAnatomy.bubble), props)
3922
+ }
3923
+ );
3924
+ });
3925
+ var Meta2 = forwardRef33(function ThreadMeta(props, ref) {
3926
+ return /* @__PURE__ */ jsx35("span", { ref, ...mergeProps(partAttrs30(threadAnatomy.scope, threadAnatomy.meta), props) });
3927
+ });
3928
+ var Day = forwardRef33(function ThreadDay(props, ref) {
3929
+ return /* @__PURE__ */ jsx35("div", { ref, ...mergeProps(partAttrs30(threadAnatomy.scope, threadAnatomy.day), props) });
3930
+ });
3931
+ var Thread = {
3932
+ Root: Root27,
3933
+ List: List3,
3934
+ Item: Item7,
3935
+ Bubble,
3936
+ Meta: Meta2,
3937
+ Day
3938
+ };
3939
+
3940
+ // src/composer/index.tsx
3941
+ import { composerAnatomy, partAttrs as partAttrs31, scopeAttrs as scopeAttrs9 } from "@aeon-ui/core";
3942
+ import {
3943
+ forwardRef as forwardRef34
3944
+ } from "react";
3945
+ import { jsx as jsx36 } from "react/jsx-runtime";
3946
+ var Root28 = forwardRef34(function ComposerRoot({ state = "idle", children, ...rest }, ref) {
3947
+ return /* @__PURE__ */ jsx36(
3948
+ "form",
3949
+ {
3950
+ ref,
3951
+ ...mergeProps(scopeAttrs9(composerAnatomy.scope, composerAnatomy.root, { state }), rest),
3952
+ children
3953
+ }
3954
+ );
3955
+ });
3956
+ var Input3 = forwardRef34(
3957
+ function ComposerInput(props, ref) {
3958
+ return /* @__PURE__ */ jsx36(
3959
+ "textarea",
3960
+ {
3961
+ ref,
3962
+ rows: 1,
3963
+ ...mergeProps(partAttrs31(composerAnatomy.scope, composerAnatomy.input), props)
3964
+ }
3965
+ );
3966
+ }
3967
+ );
3968
+ var Actions = forwardRef34(
3969
+ function ComposerActions(props, ref) {
3970
+ return /* @__PURE__ */ jsx36(
3971
+ "div",
3972
+ {
3973
+ ref,
3974
+ ...mergeProps(partAttrs31(composerAnatomy.scope, composerAnatomy.actions), props)
3975
+ }
3976
+ );
3977
+ }
3978
+ );
3979
+ var Send = forwardRef34(
3980
+ function ComposerSend(props, ref) {
3981
+ return /* @__PURE__ */ jsx36(
3982
+ "span",
3983
+ {
3984
+ ref,
3985
+ ...mergeProps(partAttrs31(composerAnatomy.scope, composerAnatomy.send), props)
3986
+ }
3987
+ );
3988
+ }
3989
+ );
3990
+ var Composer = {
3991
+ Root: Root28,
3992
+ Input: Input3,
3993
+ Actions,
3994
+ Send
3995
+ };
3996
+
3997
+ // src/profile-header/index.tsx
3998
+ import { profileHeaderAnatomy, partAttrs as partAttrs32, scopeAttrs as scopeAttrs10 } from "@aeon-ui/core";
3999
+ import { forwardRef as forwardRef35 } from "react";
4000
+ import { jsx as jsx37 } from "react/jsx-runtime";
4001
+ var Root29 = forwardRef35(function ProfileHeaderRoot({ children, ...rest }, ref) {
4002
+ return /* @__PURE__ */ jsx37(
4003
+ "header",
4004
+ {
4005
+ ref,
4006
+ ...mergeProps(scopeAttrs10(profileHeaderAnatomy.scope, profileHeaderAnatomy.root), rest),
4007
+ children
4008
+ }
4009
+ );
4010
+ });
4011
+ var Media = forwardRef35(function ProfileHeaderMedia(props, ref) {
4012
+ return /* @__PURE__ */ jsx37(
4013
+ "div",
4014
+ {
4015
+ ref,
4016
+ ...mergeProps(partAttrs32(profileHeaderAnatomy.scope, profileHeaderAnatomy.media), props)
4017
+ }
4018
+ );
4019
+ });
4020
+ var IdentitySlot = forwardRef35(
4021
+ function ProfileHeaderIdentity(props, ref) {
4022
+ return /* @__PURE__ */ jsx37(
4023
+ "div",
4024
+ {
4025
+ ref,
4026
+ ...mergeProps(partAttrs32(profileHeaderAnatomy.scope, profileHeaderAnatomy.identity), props)
4027
+ }
4028
+ );
4029
+ }
4030
+ );
4031
+ var Metrics = forwardRef35(
4032
+ function ProfileHeaderMetrics(props, ref) {
4033
+ return /* @__PURE__ */ jsx37(
4034
+ "div",
4035
+ {
4036
+ ref,
4037
+ ...mergeProps(partAttrs32(profileHeaderAnatomy.scope, profileHeaderAnatomy.metrics), props)
4038
+ }
4039
+ );
4040
+ }
4041
+ );
4042
+ var Actions2 = forwardRef35(
4043
+ function ProfileHeaderActions(props, ref) {
4044
+ return /* @__PURE__ */ jsx37(
4045
+ "div",
4046
+ {
4047
+ ref,
4048
+ ...mergeProps(partAttrs32(profileHeaderAnatomy.scope, profileHeaderAnatomy.actions), props)
4049
+ }
4050
+ );
4051
+ }
4052
+ );
4053
+ var Body = forwardRef35(function ProfileHeaderBody(props, ref) {
4054
+ return /* @__PURE__ */ jsx37(
4055
+ "div",
4056
+ {
4057
+ ref,
4058
+ ...mergeProps(partAttrs32(profileHeaderAnatomy.scope, profileHeaderAnatomy.body), props)
4059
+ }
4060
+ );
4061
+ });
4062
+ var ProfileHeader = {
4063
+ Root: Root29,
4064
+ Media,
4065
+ Identity: IdentitySlot,
4066
+ Metrics,
4067
+ Actions: Actions2,
4068
+ Body
4069
+ };
4070
+
4071
+ // src/bar/index.tsx
4072
+ import { barAnatomy, partAttrs as partAttrs33, scopeAttrs as scopeAttrs11 } from "@aeon-ui/core";
4073
+ import { createContext as createContext24, forwardRef as forwardRef36 } from "react";
4074
+ import { jsx as jsx38 } from "react/jsx-runtime";
4075
+ var BarContext = createContext24({});
4076
+ var Root30 = forwardRef36(function BarRoot({ as: Tag = "header", gap, children, ...rest }, ref) {
4077
+ return /* @__PURE__ */ jsx38(BarContext.Provider, { value: { gap }, children: /* @__PURE__ */ jsx38(
4078
+ Tag,
4079
+ {
4080
+ ref,
4081
+ ...mergeProps(scopeAttrs11(barAnatomy.scope, barAnatomy.root), rest),
4082
+ children
4083
+ }
4084
+ ) });
4085
+ });
4086
+ var Zone = forwardRef36(function BarZone({ zone, children, ...rest }, ref) {
4087
+ return /* @__PURE__ */ jsx38(
4088
+ "div",
4089
+ {
4090
+ ref,
4091
+ ...mergeProps(partAttrs33(barAnatomy.scope, zone), rest),
4092
+ children
4093
+ }
4094
+ );
4095
+ });
4096
+ var Bar = {
4097
+ Root: Root30,
4098
+ Leading: forwardRef36(
4099
+ function BarLeading(props, ref) {
4100
+ return /* @__PURE__ */ jsx38(Zone, { ref, zone: "leading", ...props });
4101
+ }
4102
+ ),
4103
+ Center: forwardRef36(
4104
+ function BarCenter(props, ref) {
4105
+ return /* @__PURE__ */ jsx38(Zone, { ref, zone: "center", ...props });
4106
+ }
4107
+ ),
4108
+ Trailing: forwardRef36(
4109
+ function BarTrailing(props, ref) {
4110
+ return /* @__PURE__ */ jsx38(Zone, { ref, zone: "trailing", ...props });
4111
+ }
4112
+ )
4113
+ };
4114
+
4115
+ // src/panel/index.tsx
4116
+ import { panelAnatomy, partAttrs as partAttrs34, scopeAttrs as scopeAttrs12 } from "@aeon-ui/core";
4117
+ import { panelMachine } from "@aeon-ui/primitives";
4118
+ import {
4119
+ createContext as createContext25,
4120
+ forwardRef as forwardRef37,
4121
+ useContext as useContext24,
4122
+ useEffect as useEffect22,
4123
+ useId as useId8,
4124
+ useMemo as useMemo21
4125
+ } from "react";
4126
+ import { jsx as jsx39 } from "react/jsx-runtime";
4127
+ var PanelCtx = createContext25(null);
4128
+ function usePanelCtx() {
4129
+ const ctx = useContext24(PanelCtx);
4130
+ if (!ctx) throw new Error("Panel parts must be used within Panel.Root");
4131
+ return ctx;
4132
+ }
4133
+ var Group3 = forwardRef37(function PanelGroup({ orientation = "horizontal", children, className, ...rest }, ref) {
4134
+ return /* @__PURE__ */ jsx39(
4135
+ "div",
4136
+ {
4137
+ ref,
4138
+ className,
4139
+ "data-aeon-orientation": orientation,
4140
+ ...mergeProps(partAttrs34(panelAnatomy.scope, panelAnatomy.group), rest),
4141
+ children
4142
+ }
4143
+ );
4144
+ });
4145
+ var Root31 = forwardRef37(function PanelRoot({
4146
+ label,
4147
+ defaultExpanded = true,
4148
+ expanded: expandedProp,
4149
+ collapsible = true,
4150
+ onExpandedChange,
4151
+ children,
4152
+ className,
4153
+ ...rest
4154
+ }, ref) {
4155
+ const contentId = useId8().replace(/:/g, "");
4156
+ const [snapshot, send] = useAeonMachine(panelMachine, {
4157
+ input: { expanded: defaultExpanded }
4158
+ });
4159
+ const machineExpanded = snapshot.value === "expanded";
4160
+ const expanded = expandedProp ?? machineExpanded;
4161
+ const state = expanded ? "expanded" : "collapsed";
4162
+ useEffect22(() => {
4163
+ onExpandedChange?.(expanded);
4164
+ }, [expanded, onExpandedChange]);
4165
+ useEffect22(() => {
4166
+ if (expandedProp === void 0) return;
4167
+ send({ type: "SET_EXPANDED", expanded: expandedProp });
4168
+ }, [expandedProp, send]);
4169
+ const ctx = useMemo21(
4170
+ () => ({
4171
+ state,
4172
+ expanded,
4173
+ collapsible,
4174
+ label,
4175
+ contentId: `aeon-panel-${contentId}`,
4176
+ send
4177
+ }),
4178
+ [state, expanded, collapsible, label, contentId, send]
4179
+ );
4180
+ return /* @__PURE__ */ jsx39(PanelCtx.Provider, { value: ctx, children: /* @__PURE__ */ jsx39(
4181
+ "div",
4182
+ {
4183
+ ref,
4184
+ className,
4185
+ ...mergeProps(
4186
+ scopeAttrs12(panelAnatomy.scope, panelAnatomy.root, { state }),
4187
+ {
4188
+ "data-aeon-collapsible": collapsible ? "true" : void 0
4189
+ },
4190
+ rest
4191
+ ),
4192
+ children
4193
+ }
4194
+ ) });
4195
+ });
4196
+ var Trigger7 = forwardRef37(function PanelTrigger({ children, onClick, ...rest }, ref) {
4197
+ const { expanded, collapsible, contentId, send, label } = usePanelCtx();
4198
+ return /* @__PURE__ */ jsx39(
4199
+ "button",
4200
+ {
4201
+ ref,
4202
+ type: "button",
4203
+ "aria-expanded": expanded,
4204
+ "aria-controls": contentId,
4205
+ disabled: !collapsible,
4206
+ ...mergeProps(
4207
+ partAttrs34(panelAnatomy.scope, panelAnatomy.trigger, {
4208
+ state: expanded ? "expanded" : "collapsed"
4209
+ }),
4210
+ rest
4211
+ ),
4212
+ onClick: (e) => {
4213
+ onClick?.(e);
4214
+ if (!e.defaultPrevented && collapsible) send({ type: "TOGGLE" });
4215
+ },
4216
+ children: children ?? (expanded ? "Collapse" : `Expand ${label}`)
4217
+ }
4218
+ );
4219
+ });
4220
+ var Label8 = forwardRef37(function PanelLabel({ children, onClick, ...rest }, ref) {
4221
+ const { label, state, collapsible, send, expanded, contentId } = usePanelCtx();
4222
+ const text = typeof children === "string" || children == null ? String(children ?? label) : null;
4223
+ return /* @__PURE__ */ jsx39(
4224
+ "span",
4225
+ {
4226
+ ref,
4227
+ role: collapsible ? "button" : void 0,
4228
+ tabIndex: collapsible ? 0 : void 0,
4229
+ "aria-expanded": collapsible ? expanded : void 0,
4230
+ "aria-controls": collapsible ? contentId : void 0,
4231
+ ...mergeProps(partAttrs34(panelAnatomy.scope, panelAnatomy.label, { state }), rest),
4232
+ onClick: (e) => {
4233
+ onClick?.(e);
4234
+ if (!e.defaultPrevented && collapsible) send({ type: "TOGGLE" });
4235
+ },
4236
+ onKeyDown: (e) => {
4237
+ if (!collapsible) return;
4238
+ if (e.key === "Enter" || e.key === " ") {
4239
+ e.preventDefault();
4240
+ send({ type: "TOGGLE" });
4241
+ }
4242
+ },
4243
+ children: text != null ? state === "collapsed" ? text.split("").map(
4244
+ (ch, i) => ch === " " ? /* @__PURE__ */ jsx39("span", { "data-aeon-part": "label-gap", "aria-hidden": true, children: " " }, `sp-${i}`) : /* @__PURE__ */ jsx39("span", { "data-aeon-part": "label-char", children: ch }, `${ch}-${i}`)
4245
+ ) : text : children
4246
+ }
4247
+ );
4248
+ });
4249
+ var Content9 = forwardRef37(function PanelContent({ children, ...rest }, ref) {
4250
+ const { expanded, contentId, state } = usePanelCtx();
4251
+ return /* @__PURE__ */ jsx39(
4252
+ "div",
4253
+ {
4254
+ ref,
4255
+ id: contentId,
4256
+ hidden: !expanded,
4257
+ ...mergeProps(partAttrs34(panelAnatomy.scope, panelAnatomy.content, { state }), rest),
4258
+ children
4259
+ }
4260
+ );
4261
+ });
4262
+ var Panel = {
4263
+ Group: Group3,
4264
+ Root: Root31,
4265
+ Trigger: Trigger7,
4266
+ Label: Label8,
4267
+ Content: Content9
4268
+ };
4269
+
4270
+ // src/app-shell/index.tsx
4271
+ import { appShellAnatomy, partAttrs as partAttrs35, scopeAttrs as scopeAttrs13 } from "@aeon-ui/core";
4272
+ import { appShellMachine } from "@aeon-ui/primitives";
4273
+ import {
4274
+ createContext as createContext26,
4275
+ forwardRef as forwardRef38,
4276
+ useContext as useContext25,
4277
+ useEffect as useEffect23,
4278
+ useMemo as useMemo22
4279
+ } from "react";
4280
+ import { jsx as jsx40 } from "react/jsx-runtime";
4281
+ var AppShellCtx = createContext26(null);
4282
+ function useAppShellContext() {
4283
+ const ctx = useContext25(AppShellCtx);
4284
+ if (!ctx) throw new Error("AppShell parts must be used within AppShell.Root");
4285
+ return ctx;
4286
+ }
4287
+ var Root32 = forwardRef38(function AppShellRoot({ defaultDockVisible = true, dockVisible: dockVisibleProp, children, ...rest }, ref) {
4288
+ const [snapshot, send] = useAeonMachine(appShellMachine, {
4289
+ input: { dockVisible: dockVisibleProp ?? defaultDockVisible }
4290
+ });
4291
+ const chrome = snapshot.value;
4292
+ const dockVisible = dockVisibleProp ?? snapshot.context.dockVisible;
4293
+ useEffect23(() => {
4294
+ if (dockVisibleProp === void 0) return;
4295
+ if (snapshot.context.dockVisible !== dockVisibleProp) {
4296
+ send({ type: "SET_DOCK", visible: dockVisibleProp });
4297
+ }
4298
+ }, [dockVisibleProp, snapshot.context.dockVisible, send]);
4299
+ const value = useMemo22(
4300
+ () => ({
4301
+ chrome,
4302
+ dockVisible,
4303
+ overlayOpen: chrome === "overlayOpen",
4304
+ send
4305
+ }),
4306
+ [chrome, dockVisible, send]
4307
+ );
4308
+ return /* @__PURE__ */ jsx40(AppShellCtx.Provider, { value, children: /* @__PURE__ */ jsx40(
4309
+ "div",
4310
+ {
4311
+ ref,
4312
+ "data-aeon-dock": dockVisible ? "visible" : "hidden",
4313
+ ...mergeProps(
4314
+ scopeAttrs13(appShellAnatomy.scope, appShellAnatomy.root, { state: chrome }),
4315
+ rest
4316
+ ),
4317
+ children
4318
+ }
4319
+ ) });
4320
+ });
4321
+ function ShellPart(part, displayName, defaultTag = "div") {
4322
+ const Comp = forwardRef38(
4323
+ function AeonShellPart({ as: Tag = defaultTag, ...rest }, ref) {
4324
+ const { chrome } = useAppShellContext();
4325
+ return /* @__PURE__ */ jsx40(
4326
+ Tag,
4327
+ {
4328
+ ref,
4329
+ ...mergeProps(partAttrs35(appShellAnatomy.scope, part, { state: chrome }), rest)
4330
+ }
4331
+ );
4332
+ }
4333
+ );
4334
+ Comp.displayName = displayName;
4335
+ return Comp;
4336
+ }
4337
+ var Header = ShellPart(appShellAnatomy.header, "AppShell.Header", "header");
4338
+ var Subheader = ShellPart(appShellAnatomy.subheader, "AppShell.Subheader");
4339
+ var Content10 = ShellPart(appShellAnatomy.content, "AppShell.Content", "main");
4340
+ var Aside = ShellPart(appShellAnatomy.aside, "AppShell.Aside", "aside");
4341
+ var Footer = ShellPart(appShellAnatomy.footer, "AppShell.Footer", "footer");
4342
+ var Dock = forwardRef38(function AppShellDock({ hidden, ...rest }, ref) {
4343
+ const { chrome, dockVisible } = useAppShellContext();
4344
+ if (!dockVisible) return null;
4345
+ return /* @__PURE__ */ jsx40(
4346
+ "div",
4347
+ {
4348
+ ref,
4349
+ hidden,
4350
+ ...mergeProps(partAttrs35(appShellAnatomy.scope, appShellAnatomy.dock, { state: chrome }), rest)
4351
+ }
4352
+ );
4353
+ });
4354
+ var Scrim = forwardRef38(function AppShellScrim(props, ref) {
4355
+ const { chrome, overlayOpen, send } = useAppShellContext();
4356
+ if (!overlayOpen) return null;
4357
+ return /* @__PURE__ */ jsx40(
4358
+ "div",
4359
+ {
4360
+ ref,
4361
+ role: "presentation",
4362
+ onClick: () => send({ type: "CLOSE_OVERLAY" }),
4363
+ ...mergeProps(partAttrs35(appShellAnatomy.scope, appShellAnatomy.scrim, { state: chrome }), props)
4364
+ }
4365
+ );
4366
+ });
4367
+ var AppShell = {
4368
+ Root: Root32,
4369
+ Header,
4370
+ Subheader,
4371
+ Content: Content10,
4372
+ Aside,
4373
+ Footer,
4374
+ Dock,
4375
+ Scrim
4376
+ };
4377
+
4378
+ // src/content/index.tsx
4379
+ import { contentAnatomy, partAttrs as partAttrs36, scopeAttrs as scopeAttrs14 } from "@aeon-ui/core";
4380
+ import { contentRegionMachine } from "@aeon-ui/primitives";
4381
+ import {
4382
+ createContext as createContext27,
4383
+ forwardRef as forwardRef39,
4384
+ useContext as useContext26,
4385
+ useMemo as useMemo23
4386
+ } from "react";
4387
+ import { jsx as jsx41 } from "react/jsx-runtime";
4388
+ var ContentCtx = createContext27(null);
4389
+ function useContentContext() {
4390
+ const ctx = useContext26(ContentCtx);
4391
+ if (!ctx) throw new Error("Content parts must be used within Content.Root");
4392
+ return ctx;
4393
+ }
4394
+ var Root33 = forwardRef39(function ContentRoot({ state: stateProp, children, ...rest }, ref) {
4395
+ const [snapshot, send] = useAeonMachine(contentRegionMachine);
4396
+ const machineState = snapshot.value;
4397
+ const state = stateProp ?? machineState;
4398
+ const value = useMemo23(
4399
+ () => ({ state, error: snapshot.context.error, send }),
4400
+ [state, snapshot.context.error, send]
4401
+ );
4402
+ return /* @__PURE__ */ jsx41(ContentCtx.Provider, { value, children: /* @__PURE__ */ jsx41(
4403
+ "div",
4404
+ {
4405
+ ref,
4406
+ ...mergeProps(scopeAttrs14(contentAnatomy.scope, contentAnatomy.root, { state }), rest),
4407
+ children
4408
+ }
4409
+ ) });
4410
+ });
4411
+ var Toolbar = forwardRef39(function ContentToolbar(props, ref) {
4412
+ const { state } = useContentContext();
4413
+ return /* @__PURE__ */ jsx41(
4414
+ "div",
4415
+ {
4416
+ ref,
4417
+ ...mergeProps(partAttrs36(contentAnatomy.scope, contentAnatomy.toolbar, { state }), props)
4418
+ }
4419
+ );
4420
+ });
4421
+ var Body2 = forwardRef39(function ContentBody({ hidden, ...rest }, ref) {
4422
+ const { state } = useContentContext();
4423
+ const show = state === "ready" || state === "loadingMore" || state === "success" || state === "idle";
4424
+ if (!show) return null;
4425
+ return /* @__PURE__ */ jsx41(
4426
+ "div",
4427
+ {
4428
+ ref,
4429
+ hidden,
4430
+ ...mergeProps(partAttrs36(contentAnatomy.scope, contentAnatomy.body, { state }), rest)
4431
+ }
4432
+ );
4433
+ });
4434
+ function StatusSlot(part, match, displayName) {
4435
+ const matches = Array.isArray(match) ? match : [match];
4436
+ const Comp = forwardRef39(function ContentStatusSlot(props, ref) {
4437
+ const { state } = useContentContext();
4438
+ if (!matches.includes(state)) return null;
4439
+ return /* @__PURE__ */ jsx41(
4440
+ "div",
4441
+ {
4442
+ ref,
4443
+ role: "status",
4444
+ ...mergeProps(partAttrs36(contentAnatomy.scope, part, { state }), props)
4445
+ }
4446
+ );
4447
+ });
4448
+ Comp.displayName = displayName;
4449
+ return Comp;
4450
+ }
4451
+ var Pending = StatusSlot(contentAnatomy.pending, "pending", "Content.Pending");
4452
+ var Empty2 = StatusSlot(contentAnatomy.empty, "empty", "Content.Empty");
4453
+ var ErrorSlot = StatusSlot(contentAnatomy.error, "error", "Content.Error");
4454
+ var Success = StatusSlot(contentAnatomy.success, "success", "Content.Success");
4455
+ var Sentinel = forwardRef39(function ContentSentinel(props, ref) {
4456
+ const { state } = useContentContext();
4457
+ if (state !== "ready" && state !== "loadingMore") return null;
4458
+ return /* @__PURE__ */ jsx41(
4459
+ "div",
4460
+ {
4461
+ ref,
4462
+ ...mergeProps(partAttrs36(contentAnatomy.scope, contentAnatomy.sentinel, { state }), props)
4463
+ }
4464
+ );
4465
+ });
4466
+ var Content11 = {
4467
+ Root: Root33,
4468
+ Toolbar,
4469
+ Body: Body2,
4470
+ Pending,
4471
+ Empty: Empty2,
4472
+ Error: ErrorSlot,
4473
+ Success,
4474
+ Sentinel
4475
+ };
4476
+
4477
+ // src/nav/index.tsx
4478
+ import { navAnatomy, partAttrs as partAttrs37, scopeAttrs as scopeAttrs15 } from "@aeon-ui/core";
4479
+ import { tabsMachine as tabsMachine3 } from "@aeon-ui/primitives";
4480
+ import {
4481
+ createContext as createContext28,
4482
+ forwardRef as forwardRef40,
4483
+ useContext as useContext27,
4484
+ useEffect as useEffect24,
4485
+ useMemo as useMemo24
4486
+ } from "react";
4487
+ import { jsx as jsx42 } from "react/jsx-runtime";
4488
+ var NavCtx = createContext28(null);
4489
+ function useNavCtx() {
4490
+ const ctx = useContext27(NavCtx);
4491
+ if (!ctx) throw new Error("Nav parts must be used within Nav.Root");
4492
+ return ctx;
4493
+ }
4494
+ var Root34 = forwardRef40(function NavRoot({
4495
+ defaultValue = "",
4496
+ value,
4497
+ onValueChange,
4498
+ as: Tag = "nav",
4499
+ orientation = "horizontal",
4500
+ children,
4501
+ ...rest
4502
+ }, ref) {
4503
+ const [snapshot, send] = useAeonMachine(tabsMachine3, {
4504
+ input: { value: defaultValue, disabled: false }
4505
+ });
4506
+ const resolvedValue = value ?? snapshot.context.value;
4507
+ useEffect24(() => {
4508
+ if (value !== void 0) send({ type: "SET_VALUE", value });
4509
+ }, [value, send]);
4510
+ const ctx = useMemo24(
4511
+ () => ({ value: resolvedValue, send, onValueChange }),
4512
+ [resolvedValue, send, onValueChange]
4513
+ );
4514
+ return /* @__PURE__ */ jsx42(NavCtx.Provider, { value: ctx, children: /* @__PURE__ */ jsx42(
4515
+ Tag,
4516
+ {
4517
+ ref,
4518
+ "data-aeon-orientation": orientation,
4519
+ ...mergeProps(scopeAttrs15(navAnatomy.scope, navAnatomy.root), rest),
4520
+ children
4521
+ }
4522
+ ) });
4523
+ });
4524
+ var Item8 = forwardRef40(function NavItem({ value, disabled, onClick, children, ...rest }, ref) {
4525
+ const { value: selected, send, onValueChange } = useNavCtx();
4526
+ const active = selected === value;
4527
+ const state = disabled ? "disabled" : active ? "active" : "inactive";
4528
+ return /* @__PURE__ */ jsx42(
4529
+ "button",
4530
+ {
4531
+ ref,
4532
+ type: "button",
4533
+ disabled,
4534
+ "aria-current": active ? "page" : void 0,
4535
+ "data-aeon-value": value,
4536
+ onClick: (e) => {
4537
+ onClick?.(e);
4538
+ if (disabled || e.defaultPrevented) return;
4539
+ send({ type: "SELECT", value });
4540
+ onValueChange?.(value);
4541
+ },
4542
+ ...mergeProps(partAttrs37(navAnatomy.scope, navAnatomy.item, { state, disabled }), rest),
4543
+ children
4544
+ }
4545
+ );
4546
+ });
4547
+ var Indicator3 = forwardRef40(function NavIndicator(props, ref) {
4548
+ return /* @__PURE__ */ jsx42(
4549
+ "span",
4550
+ {
4551
+ ref,
4552
+ "aria-hidden": true,
4553
+ ...mergeProps(partAttrs37(navAnatomy.scope, navAnatomy.indicator), props)
4554
+ }
4555
+ );
4556
+ });
4557
+ var Label9 = forwardRef40(function NavLabel(props, ref) {
4558
+ return /* @__PURE__ */ jsx42("span", { ref, ...mergeProps(partAttrs37(navAnatomy.scope, navAnatomy.label), props) });
4559
+ });
4560
+ var Icon2 = forwardRef40(function NavIcon(props, ref) {
4561
+ return /* @__PURE__ */ jsx42("span", { ref, ...mergeProps(partAttrs37(navAnatomy.scope, navAnatomy.icon), props) });
4562
+ });
4563
+ var Badge2 = forwardRef40(function NavBadge(props, ref) {
4564
+ return /* @__PURE__ */ jsx42("span", { ref, ...mergeProps(partAttrs37(navAnatomy.scope, navAnatomy.badge), props) });
4565
+ });
4566
+ var Nav = {
4567
+ Root: Root34,
4568
+ Item: Item8,
4569
+ Indicator: Indicator3,
4570
+ Label: Label9,
4571
+ Icon: Icon2,
4572
+ Badge: Badge2
4573
+ };
4574
+
4575
+ // src/sticky-bar/index.tsx
4576
+ import { barAnatomy as barAnatomy2, partAttrs as partAttrs38, scopeAttrs as scopeAttrs16 } from "@aeon-ui/core";
4577
+ import { stickyBarMachine } from "@aeon-ui/primitives";
4578
+ import {
4579
+ createContext as createContext29,
4580
+ forwardRef as forwardRef41,
4581
+ useContext as useContext28,
4582
+ useMemo as useMemo25
4583
+ } from "react";
4584
+ import { jsx as jsx43 } from "react/jsx-runtime";
4585
+ var StickyBarCtx = createContext29(null);
4586
+ function useStickyBarContext() {
4587
+ const ctx = useContext28(StickyBarCtx);
4588
+ if (!ctx) throw new Error("StickyBar parts must be used within StickyBar.Root");
4589
+ return ctx;
4590
+ }
4591
+ var Root35 = forwardRef41(function StickyBarRoot({
4592
+ /* Default div — AppShell.Header is already the landmark; nested <header> is invalid
4593
+ HTML and browsers auto-close the outer header (0-height), so the bar covers content. */
4594
+ as: Tag = "div",
4595
+ placement = "top",
4596
+ defaultState = "floating",
4597
+ children,
4598
+ style,
4599
+ ...rest
4600
+ }, ref) {
4601
+ const [snapshot, send] = useAeonMachine(stickyBarMachine, {
4602
+ input: { initial: defaultState }
4603
+ });
4604
+ const state = snapshot.value;
4605
+ const offsetPx = snapshot.context.offsetPx;
4606
+ const value = useMemo25(() => ({ state, offsetPx, send }), [state, offsetPx, send]);
4607
+ if (state === "hidden") return null;
4608
+ const stickyStyle = {
4609
+ ...typeof style === "object" && style ? style : {},
4610
+ ...offsetPx > 0 ? { ["--aeon-bar-offset"]: `${offsetPx}px` } : {}
4611
+ };
4612
+ return /* @__PURE__ */ jsx43(StickyBarCtx.Provider, { value, children: /* @__PURE__ */ jsx43(
4613
+ Tag,
4614
+ {
4615
+ ref,
4616
+ "data-aeon-placement": placement,
4617
+ style: stickyStyle,
4618
+ ...mergeProps(scopeAttrs16(barAnatomy2.scope, barAnatomy2.root, { state }), rest),
4619
+ children
4620
+ }
4621
+ ) });
4622
+ });
4623
+ var Zone2 = forwardRef41(function StickyBarZone({ zone, ...rest }, ref) {
4624
+ const { state } = useStickyBarContext();
4625
+ return /* @__PURE__ */ jsx43(
4626
+ "div",
4627
+ {
4628
+ ref,
4629
+ ...mergeProps(partAttrs38(barAnatomy2.scope, zone, { state }), rest)
4630
+ }
4631
+ );
4632
+ });
4633
+ var Leading2 = forwardRef41(
4634
+ function StickyBarLeading(props, ref) {
4635
+ return /* @__PURE__ */ jsx43(Zone2, { ref, zone: "leading", ...props });
4636
+ }
4637
+ );
4638
+ var Center = forwardRef41(
4639
+ function StickyBarCenter(props, ref) {
4640
+ return /* @__PURE__ */ jsx43(Zone2, { ref, zone: "center", ...props });
4641
+ }
4642
+ );
4643
+ var Trailing3 = forwardRef41(
4644
+ function StickyBarTrailing(props, ref) {
4645
+ return /* @__PURE__ */ jsx43(Zone2, { ref, zone: "trailing", ...props });
4646
+ }
4647
+ );
4648
+ var Seam = forwardRef41(function StickyBarSeam(props, ref) {
4649
+ const { state } = useStickyBarContext();
4650
+ return /* @__PURE__ */ jsx43(
4651
+ "div",
4652
+ {
4653
+ ref,
4654
+ "aria-hidden": true,
4655
+ ...mergeProps(partAttrs38(barAnatomy2.scope, barAnatomy2.seam, { state }), props)
4656
+ }
4657
+ );
4658
+ });
4659
+ var StickyBar = {
4660
+ Root: Root35,
4661
+ Leading: Leading2,
4662
+ Center,
4663
+ Trailing: Trailing3,
4664
+ Seam
4665
+ };
4666
+
4667
+ // src/hooks/use-layout-mode.ts
4668
+ import { getCompactMq, layoutCompositionForMode, matchLayoutMode } from "@aeon-ui/core";
4669
+ import { useEffect as useEffect25, useMemo as useMemo26, useState as useState11 } from "react";
4670
+ function useLayoutMode(spec) {
4671
+ const mq = useMemo26(() => getCompactMq(spec), [spec.compactMq]);
4672
+ const [mode, setMode] = useState11(() => matchLayoutMode(spec, mq));
4673
+ useEffect25(() => {
4674
+ const sync = () => setMode(matchLayoutMode(spec, mq));
4675
+ sync();
4676
+ mq.addEventListener("change", sync);
4677
+ return () => mq.removeEventListener("change", sync);
4678
+ }, [spec, mq]);
4679
+ const composition = useMemo26(() => layoutCompositionForMode(spec, mode), [spec, mode]);
4680
+ return { mode, composition };
4681
+ }
4682
+ export {
4683
+ Accordion,
4684
+ AppShell,
4685
+ Async,
4686
+ AsyncActions,
4687
+ AsyncProvider,
4688
+ AsyncReadout,
4689
+ AsyncRoot,
4690
+ AsyncTrack,
4691
+ Avatar,
4692
+ Bar,
4693
+ Button,
4694
+ Checkbox,
4695
+ Combobox,
4696
+ Composer,
4697
+ Content11 as Content,
4698
+ Conversation,
4699
+ Dialog,
4700
+ Entry,
4701
+ Field,
4702
+ Identity,
4703
+ ListRow,
4704
+ Menu,
4705
+ MetricStrip,
4706
+ Nav,
4707
+ Panel,
4708
+ PinInput,
4709
+ Popover,
4710
+ ProfileHeader,
4711
+ Progress,
4712
+ RadioGroup,
4713
+ Scroll,
4714
+ Select,
4715
+ Separator,
4716
+ Slider,
4717
+ StickyBar,
4718
+ Switch,
4719
+ Tabs,
4720
+ ThemeSwitcher,
4721
+ Thread,
4722
+ Toast,
4723
+ ToastItem,
4724
+ Tooltip,
4725
+ asyncStatusToContentState,
4726
+ createAsyncMachine2 as createAsyncMachine,
4727
+ fieldMachine,
4728
+ useAeonMachine,
4729
+ useAppShellContext,
4730
+ useAsyncContext,
4731
+ useContentContext,
4732
+ useFieldContext,
4733
+ useLayoutMode,
4734
+ useScrollContext,
4735
+ useScrollState,
4736
+ useStickyBarContext,
4737
+ useToast,
4738
+ useToastStore
4739
+ };