@qw-ui/core 0.3.0-next.40 → 0.3.0-next.43

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 (402) hide show
  1. package/README.md +21 -37
  2. package/dist/action-sheet/action-sheet.d.ts +110 -0
  3. package/dist/action-sheet/index.d.ts +2 -0
  4. package/dist/action-sheet/index.js +2 -0
  5. package/dist/action-sheet-Cvcr1S_m.js +183 -0
  6. package/dist/action-sheet-Cvcr1S_m.js.map +1 -0
  7. package/dist/area-picker/area-picker.d.ts +113 -0
  8. package/dist/area-picker/index.d.ts +1 -0
  9. package/dist/area-picker/index.js +348 -0
  10. package/dist/area-picker/index.js.map +1 -0
  11. package/dist/aria-description-CimD2M_C.js +13 -0
  12. package/dist/aria-description-CimD2M_C.js.map +1 -0
  13. package/dist/aria-description.d.ts +2 -0
  14. package/dist/avatar/avatar-load.d.ts +76 -0
  15. package/dist/avatar/avatar.d.ts +22 -5
  16. package/dist/avatar/index.d.ts +1 -0
  17. package/dist/avatar/index.js +57 -18
  18. package/dist/avatar/index.js.map +1 -1
  19. package/dist/avatar-load-w9dq05oV.js +139 -0
  20. package/dist/avatar-load-w9dq05oV.js.map +1 -0
  21. package/dist/back-top/back-top.d.ts +77 -0
  22. package/dist/back-top/index.d.ts +1 -0
  23. package/dist/back-top/index.js +189 -0
  24. package/dist/back-top/index.js.map +1 -0
  25. package/dist/badge/badge.d.ts +9 -0
  26. package/dist/badge/index.js +14 -1
  27. package/dist/badge/index.js.map +1 -1
  28. package/dist/button/button.d.ts +13 -0
  29. package/dist/button/index.js +3 -5
  30. package/dist/button/index.js.map +1 -1
  31. package/dist/calendar/calendar.d.ts +100 -0
  32. package/dist/calendar/index.d.ts +1 -0
  33. package/dist/calendar/index.js +2 -0
  34. package/dist/calendar-CmpK3stz.js +363 -0
  35. package/dist/calendar-CmpK3stz.js.map +1 -0
  36. package/dist/card/card.d.ts +68 -0
  37. package/dist/card/index.d.ts +2 -0
  38. package/dist/card/index.js +2 -0
  39. package/dist/card-DRtWa6Cr.js +107 -0
  40. package/dist/card-DRtWa6Cr.js.map +1 -0
  41. package/dist/cascader/cascader.d.ts +115 -0
  42. package/dist/cascader/index.d.ts +1 -0
  43. package/dist/cascader/index.js +2 -0
  44. package/dist/cascader-D-xMjs7P.js +333 -0
  45. package/dist/cascader-D-xMjs7P.js.map +1 -0
  46. package/dist/cell/cell.d.ts +41 -0
  47. package/dist/cell/index.d.ts +1 -0
  48. package/dist/cell/index.js +43 -0
  49. package/dist/cell/index.js.map +1 -0
  50. package/dist/check-list/check-list.d.ts +78 -0
  51. package/dist/check-list/index.d.ts +2 -0
  52. package/dist/check-list/index.js +2 -0
  53. package/dist/check-list-BvZHQt5w.js +60 -0
  54. package/dist/check-list-BvZHQt5w.js.map +1 -0
  55. package/dist/checkbox/checkbox.d.ts +59 -0
  56. package/dist/checkbox/index.d.ts +2 -0
  57. package/dist/checkbox/index.js +2 -0
  58. package/dist/checkbox-BlndJrz5.js +127 -0
  59. package/dist/checkbox-BlndJrz5.js.map +1 -0
  60. package/dist/checkbox-group/checkbox-group.d.ts +86 -0
  61. package/dist/checkbox-group/index.d.ts +3 -0
  62. package/dist/checkbox-group/index.js +2 -0
  63. package/dist/checkbox-group-gGfsTv-e.js +223 -0
  64. package/dist/checkbox-group-gGfsTv-e.js.map +1 -0
  65. package/dist/choice-group-C4c9m0qe.js +373 -0
  66. package/dist/choice-group-C4c9m0qe.js.map +1 -0
  67. package/dist/circle/circle.d.ts +97 -0
  68. package/dist/circle/index.d.ts +1 -0
  69. package/dist/circle/index.js +119 -0
  70. package/dist/circle/index.js.map +1 -0
  71. package/dist/collapse/collapse.d.ts +98 -0
  72. package/dist/collapse/index.d.ts +2 -0
  73. package/dist/collapse/index.js +2 -0
  74. package/dist/collapse-B969h7-H.js +226 -0
  75. package/dist/collapse-B969h7-H.js.map +1 -0
  76. package/dist/countdown/countdown.d.ts +114 -0
  77. package/dist/countdown/index.d.ts +1 -0
  78. package/dist/countdown/index.js +309 -0
  79. package/dist/countdown/index.js.map +1 -0
  80. package/dist/date-picker/date-picker.d.ts +168 -0
  81. package/dist/date-picker/index.d.ts +1 -0
  82. package/dist/date-picker/index.js +401 -0
  83. package/dist/date-picker/index.js.map +1 -0
  84. package/dist/descriptions/descriptions.d.ts +69 -0
  85. package/dist/descriptions/index.d.ts +1 -0
  86. package/dist/descriptions/index.js +86 -0
  87. package/dist/descriptions/index.js.map +1 -0
  88. package/dist/dialog/dialog.d.ts +32 -3
  89. package/dist/dialog/index.js +58 -3
  90. package/dist/dialog/index.js.map +1 -1
  91. package/dist/divider/divider.d.ts +18 -2
  92. package/dist/divider/index.js +20 -2
  93. package/dist/divider/index.js.map +1 -1
  94. package/dist/dropdown/dropdown.d.ts +172 -0
  95. package/dist/dropdown/index.d.ts +2 -0
  96. package/dist/dropdown/index.js +467 -0
  97. package/dist/dropdown/index.js.map +1 -0
  98. package/dist/ellipsis/ellipsis-layout.d.ts +34 -0
  99. package/dist/ellipsis/ellipsis.d.ts +88 -0
  100. package/dist/ellipsis/index.d.ts +2 -0
  101. package/dist/ellipsis/index.js +320 -0
  102. package/dist/ellipsis/index.js.map +1 -0
  103. package/dist/empty/empty-illustration.d.ts +3 -0
  104. package/dist/empty/empty.d.ts +43 -1
  105. package/dist/empty/index.js +2 -21
  106. package/dist/empty-CAgyvhUI.js +166 -0
  107. package/dist/empty-CAgyvhUI.js.map +1 -0
  108. package/dist/field/field.d.ts +95 -0
  109. package/dist/field/index.d.ts +2 -0
  110. package/dist/field/index.js +2 -0
  111. package/dist/field-DMHGIMZF.js +241 -0
  112. package/dist/field-DMHGIMZF.js.map +1 -0
  113. package/dist/floating-bubble/floating-bubble.d.ts +116 -0
  114. package/dist/floating-bubble/index.d.ts +1 -0
  115. package/dist/floating-bubble/index.js +333 -0
  116. package/dist/floating-bubble/index.js.map +1 -0
  117. package/dist/floating-panel/floating-panel.d.ts +80 -0
  118. package/dist/floating-panel/index.d.ts +2 -0
  119. package/dist/floating-panel/index.js +2 -0
  120. package/dist/floating-panel-Cbm5njBJ.js +363 -0
  121. package/dist/floating-panel-Cbm5njBJ.js.map +1 -0
  122. package/dist/footer/footer.d.ts +94 -0
  123. package/dist/footer/index.d.ts +1 -0
  124. package/dist/footer/index.js +154 -0
  125. package/dist/footer/index.js.map +1 -0
  126. package/dist/form/connect.d.ts +6 -0
  127. package/dist/form/form.d.ts +100 -0
  128. package/dist/form/ids.d.ts +14 -0
  129. package/dist/form/index.d.ts +13 -0
  130. package/dist/form/index.js +3 -0
  131. package/dist/form/methods.d.ts +5 -0
  132. package/dist/form/model.d.ts +24 -0
  133. package/dist/form/native.d.ts +25 -0
  134. package/dist/form/rules.d.ts +40 -0
  135. package/dist/form/ssr.d.ts +7 -0
  136. package/dist/form/types.d.ts +150 -0
  137. package/dist/form-BAGkIEMY.js +1354 -0
  138. package/dist/form-BAGkIEMY.js.map +1 -0
  139. package/dist/format-BDUY0C_c.js +89 -0
  140. package/dist/format-BDUY0C_c.js.map +1 -0
  141. package/dist/gesture-_SRHIvBm.js +30 -0
  142. package/dist/gesture-_SRHIvBm.js.map +1 -0
  143. package/dist/grid/grid-item.d.ts +22 -0
  144. package/dist/grid/grid.d.ts +42 -0
  145. package/dist/grid/index.d.ts +2 -0
  146. package/dist/grid/index.js +73 -0
  147. package/dist/grid/index.js.map +1 -0
  148. package/dist/icon/icon.d.ts +37 -1
  149. package/dist/icon/identity.d.ts +3 -0
  150. package/dist/icon/index.js +2 -20
  151. package/dist/icon-Cgdbnk1u.js +77 -0
  152. package/dist/icon-Cgdbnk1u.js.map +1 -0
  153. package/dist/image/image-load.d.ts +24 -0
  154. package/dist/image/image.d.ts +45 -8
  155. package/dist/image/index.d.ts +1 -0
  156. package/dist/image/index.js +116 -14
  157. package/dist/image/index.js.map +1 -1
  158. package/dist/image-preview/image-preview.d.ts +124 -0
  159. package/dist/image-preview/index.d.ts +1 -0
  160. package/dist/image-preview/index.js +450 -0
  161. package/dist/image-preview/index.js.map +1 -0
  162. package/dist/index-bar/index-bar.d.ts +121 -0
  163. package/dist/index-bar/index.d.ts +1 -0
  164. package/dist/index-bar/index.js +386 -0
  165. package/dist/index-bar/index.js.map +1 -0
  166. package/dist/index.d.ts +107 -14
  167. package/dist/index.js +148 -14
  168. package/dist/index.js.map +1 -0
  169. package/dist/infinite-scroll/index.d.ts +1 -0
  170. package/dist/infinite-scroll/index.js +248 -0
  171. package/dist/infinite-scroll/index.js.map +1 -0
  172. package/dist/infinite-scroll/infinite-scroll.d.ts +95 -0
  173. package/dist/input/index.js +181 -22
  174. package/dist/input/index.js.map +1 -1
  175. package/dist/input/input.d.ts +44 -1
  176. package/dist/layer-IpFrl5--.js +414 -0
  177. package/dist/layer-IpFrl5--.js.map +1 -0
  178. package/dist/layout-BRSqi4AQ.js +43 -0
  179. package/dist/layout-BRSqi4AQ.js.map +1 -0
  180. package/dist/layout.d.ts +13 -0
  181. package/dist/list/index.d.ts +2 -0
  182. package/dist/list/index.js +2 -0
  183. package/dist/list/list.d.ts +30 -0
  184. package/dist/list-6-iz-Irh.js +28 -0
  185. package/dist/list-6-iz-Irh.js.map +1 -0
  186. package/dist/loading/index.js +45 -2
  187. package/dist/loading/index.js.map +1 -1
  188. package/dist/loading/loading.d.ts +45 -2
  189. package/dist/modal-dialog-machine-CF9_z3Dm.js +487 -0
  190. package/dist/modal-dialog-machine-CF9_z3Dm.js.map +1 -0
  191. package/dist/modal-dialog-machine.d.ts +21 -0
  192. package/dist/modal-dismissable-lifetime.d.ts +21 -0
  193. package/dist/modal-registry.d.ts +24 -0
  194. package/dist/modal-render-hydration.d.ts +35 -0
  195. package/dist/modal-render-runtime.d.ts +19 -0
  196. package/dist/modal-render-scope.d.ts +63 -0
  197. package/dist/nav-bar/index.d.ts +1 -0
  198. package/dist/nav-bar/index.js +115 -0
  199. package/dist/nav-bar/index.js.map +1 -0
  200. package/dist/nav-bar/nav-bar.d.ts +76 -0
  201. package/dist/notice-bar/index.d.ts +2 -0
  202. package/dist/notice-bar/index.js +2 -0
  203. package/dist/notice-bar/notice-bar.d.ts +103 -0
  204. package/dist/notice-bar-DMpwLvRb.js +231 -0
  205. package/dist/notice-bar-DMpwLvRb.js.map +1 -0
  206. package/dist/notify/index.d.ts +1 -0
  207. package/dist/notify/index.js +251 -0
  208. package/dist/notify/index.js.map +1 -0
  209. package/dist/notify/notify.d.ts +123 -0
  210. package/dist/number-keyboard/index.d.ts +1 -0
  211. package/dist/number-keyboard/index.js +333 -0
  212. package/dist/number-keyboard/index.js.map +1 -0
  213. package/dist/number-keyboard/number-keyboard.d.ts +141 -0
  214. package/dist/page-indicator/index.d.ts +1 -0
  215. package/dist/page-indicator/index.js +138 -0
  216. package/dist/page-indicator/index.js.map +1 -0
  217. package/dist/page-indicator/page-indicator.d.ts +93 -0
  218. package/dist/pagination/index.d.ts +1 -0
  219. package/dist/pagination/index.js +198 -0
  220. package/dist/pagination/index.js.map +1 -0
  221. package/dist/pagination/pagination.d.ts +125 -0
  222. package/dist/password-input/index.d.ts +1 -0
  223. package/dist/password-input/index.js +317 -0
  224. package/dist/password-input/index.js.map +1 -0
  225. package/dist/password-input/password-input.d.ts +144 -0
  226. package/dist/picker/index.d.ts +8 -0
  227. package/dist/picker/index.js +2 -0
  228. package/dist/picker/picker-machine.d.ts +80 -0
  229. package/dist/picker/picker.d.ts +121 -0
  230. package/dist/picker/platform.d.ts +84 -0
  231. package/dist/picker/selection-connect.d.ts +90 -0
  232. package/dist/picker/selection-model.d.ts +211 -0
  233. package/dist/picker-BykFntQN.js +1675 -0
  234. package/dist/picker-BykFntQN.js.map +1 -0
  235. package/dist/popover/index.d.ts +3 -0
  236. package/dist/popover/index.js +253 -0
  237. package/dist/popover/index.js.map +1 -0
  238. package/dist/popover/layer.d.ts +44 -0
  239. package/dist/popover/popover.d.ts +104 -0
  240. package/dist/popover/positioning.d.ts +132 -0
  241. package/dist/popup/index.d.ts +2 -0
  242. package/dist/popup/index.js +2 -0
  243. package/dist/popup/popup.d.ts +60 -0
  244. package/dist/popup-z5d8IYCt.js +576 -0
  245. package/dist/popup-z5d8IYCt.js.map +1 -0
  246. package/dist/portal-BHCNTWhg.js +78 -0
  247. package/dist/portal-BHCNTWhg.js.map +1 -0
  248. package/dist/portal.d.ts +61 -0
  249. package/dist/price/format.d.ts +19 -0
  250. package/dist/price/index.d.ts +1 -0
  251. package/dist/price/index.js +154 -0
  252. package/dist/price/index.js.map +1 -0
  253. package/dist/price/price.d.ts +88 -0
  254. package/dist/progress/index.d.ts +1 -0
  255. package/dist/progress/index.js +2 -0
  256. package/dist/progress/progress.d.ts +32 -0
  257. package/dist/progress-f3iYEfdA.js +37 -0
  258. package/dist/progress-f3iYEfdA.js.map +1 -0
  259. package/dist/pull-refresh/index.d.ts +1 -0
  260. package/dist/pull-refresh/index.js +414 -0
  261. package/dist/pull-refresh/index.js.map +1 -0
  262. package/dist/pull-refresh/pull-refresh.d.ts +118 -0
  263. package/dist/radio-group/index.d.ts +3 -0
  264. package/dist/radio-group/index.js +2 -0
  265. package/dist/radio-group/radio-group.d.ts +78 -0
  266. package/dist/radio-group-BOIMuqnS.js +230 -0
  267. package/dist/radio-group-BOIMuqnS.js.map +1 -0
  268. package/dist/rate/index.d.ts +1 -0
  269. package/dist/rate/index.js +2 -0
  270. package/dist/rate/rate-form.d.ts +28 -0
  271. package/dist/rate/rate.d.ts +144 -0
  272. package/dist/rate-5XsU2QkY.js +631 -0
  273. package/dist/rate-5XsU2QkY.js.map +1 -0
  274. package/dist/reorder/index.d.ts +1 -0
  275. package/dist/reorder/index.js +720 -0
  276. package/dist/reorder/index.js.map +1 -0
  277. package/dist/reorder/reorder.d.ts +190 -0
  278. package/dist/result/index.d.ts +1 -0
  279. package/dist/result/index.js +123 -0
  280. package/dist/result/index.js.map +1 -0
  281. package/dist/result/result.d.ts +88 -0
  282. package/dist/safe-area/index.d.ts +1 -0
  283. package/dist/safe-area/index.js +42 -0
  284. package/dist/safe-area/index.js.map +1 -0
  285. package/dist/safe-area/safe-area.d.ts +28 -0
  286. package/dist/search-bar/index.js +3 -1
  287. package/dist/search-bar/index.js.map +1 -1
  288. package/dist/search-bar/search-bar.d.ts +4 -0
  289. package/dist/segmented/index.d.ts +2 -0
  290. package/dist/segmented/index.js +2 -0
  291. package/dist/segmented/segmented.d.ts +127 -0
  292. package/dist/segmented-BaU38_L4.js +367 -0
  293. package/dist/segmented-BaU38_L4.js.map +1 -0
  294. package/dist/selection-form-BOM_odUk.js +88 -0
  295. package/dist/selection-form-BOM_odUk.js.map +1 -0
  296. package/dist/selection-form.d.ts +27 -0
  297. package/dist/selection-ivXqO1eu.js +55 -0
  298. package/dist/selection-ivXqO1eu.js.map +1 -0
  299. package/dist/selection.d.ts +29 -0
  300. package/dist/selector/choice-group.d.ts +114 -0
  301. package/dist/selector/index.d.ts +2 -0
  302. package/dist/selector/index.js +2 -0
  303. package/dist/selector/selector.d.ts +90 -0
  304. package/dist/selector-BU2MMJ4N.js +93 -0
  305. package/dist/selector-BU2MMJ4N.js.map +1 -0
  306. package/dist/share-sheet/index.d.ts +1 -0
  307. package/dist/share-sheet/index.js +138 -0
  308. package/dist/share-sheet/index.js.map +1 -0
  309. package/dist/share-sheet/share-sheet.d.ts +139 -0
  310. package/dist/skeleton/index.js +51 -2
  311. package/dist/skeleton/index.js.map +1 -1
  312. package/dist/skeleton/skeleton.d.ts +34 -3
  313. package/dist/slider/index.d.ts +1 -0
  314. package/dist/slider/index.js +482 -0
  315. package/dist/slider/index.js.map +1 -0
  316. package/dist/slider/slider.d.ts +174 -0
  317. package/dist/space/index.d.ts +1 -0
  318. package/dist/space/index.js +52 -0
  319. package/dist/space/index.js.map +1 -0
  320. package/dist/space/space.d.ts +46 -0
  321. package/dist/statistic/index.d.ts +1 -0
  322. package/dist/statistic/index.js +152 -0
  323. package/dist/statistic/index.js.map +1 -0
  324. package/dist/statistic/statistic.d.ts +101 -0
  325. package/dist/stepper/index.js +62 -3
  326. package/dist/stepper/index.js.map +1 -1
  327. package/dist/stepper/stepper.d.ts +44 -4
  328. package/dist/steps/index.d.ts +1 -0
  329. package/dist/steps/index.js +72 -0
  330. package/dist/steps/index.js.map +1 -0
  331. package/dist/steps/steps.d.ts +67 -0
  332. package/dist/sticky/index.d.ts +1 -0
  333. package/dist/sticky/index.js +145 -0
  334. package/dist/sticky/index.js.map +1 -0
  335. package/dist/sticky/sticky.d.ts +70 -0
  336. package/dist/swipe-action/index.d.ts +1 -0
  337. package/dist/swipe-action/index.js +417 -0
  338. package/dist/swipe-action/index.js.map +1 -0
  339. package/dist/swipe-action/swipe-action.d.ts +148 -0
  340. package/dist/swiper/gesture.d.ts +32 -0
  341. package/dist/swiper/index.d.ts +1 -0
  342. package/dist/swiper/index.js +2 -0
  343. package/dist/swiper/swiper.d.ts +177 -0
  344. package/dist/swiper-BKivDkHp.js +550 -0
  345. package/dist/swiper-BKivDkHp.js.map +1 -0
  346. package/dist/switch/index.js +135 -10
  347. package/dist/switch/index.js.map +1 -1
  348. package/dist/switch/switch.d.ts +93 -6
  349. package/dist/tabbar/index.js +46 -1
  350. package/dist/tabbar/index.js.map +1 -1
  351. package/dist/tabbar/tabbar.d.ts +50 -0
  352. package/dist/tabs/index.js +22 -1
  353. package/dist/tabs/index.js.map +1 -1
  354. package/dist/tabs/tabs.d.ts +12 -8
  355. package/dist/tag/index.js +123 -2
  356. package/dist/tag/index.js.map +1 -1
  357. package/dist/tag/tag.d.ts +67 -1
  358. package/dist/textarea/index.d.ts +2 -0
  359. package/dist/textarea/index.js +2 -242
  360. package/dist/textarea/platform.d.ts +22 -0
  361. package/dist/textarea/textarea.d.ts +165 -46
  362. package/dist/textarea-qbnruDUG.js +775 -0
  363. package/dist/textarea-qbnruDUG.js.map +1 -0
  364. package/dist/time-picker/index.d.ts +1 -0
  365. package/dist/time-picker/index.js +228 -0
  366. package/dist/time-picker/index.js.map +1 -0
  367. package/dist/time-picker/time-picker.d.ts +83 -0
  368. package/dist/timeline/index.d.ts +1 -0
  369. package/dist/timeline/index.js +131 -0
  370. package/dist/timeline/index.js.map +1 -0
  371. package/dist/timeline/timeline.d.ts +79 -0
  372. package/dist/toast/index.js +47 -4
  373. package/dist/toast/index.js.map +1 -1
  374. package/dist/toast/toast.d.ts +26 -3
  375. package/dist/top-bar/index.js +16 -2
  376. package/dist/top-bar/index.js.map +1 -1
  377. package/dist/top-bar/top-bar.d.ts +13 -2
  378. package/dist/tree-select/index.d.ts +1 -0
  379. package/dist/tree-select/index.js +512 -0
  380. package/dist/tree-select/index.js.map +1 -0
  381. package/dist/tree-select/tree-select.d.ts +215 -0
  382. package/dist/typography/index.d.ts +1 -0
  383. package/dist/typography/index.js +82 -0
  384. package/dist/typography/index.js.map +1 -0
  385. package/dist/typography/typography.d.ts +54 -0
  386. package/dist/upload/index.d.ts +1 -0
  387. package/dist/upload/index.js +458 -0
  388. package/dist/upload/index.js.map +1 -0
  389. package/dist/upload/upload.d.ts +172 -0
  390. package/dist/virtual-list/index.d.ts +1 -0
  391. package/dist/virtual-list/index.js +445 -0
  392. package/dist/virtual-list/index.js.map +1 -0
  393. package/dist/virtual-list/virtual-list.d.ts +160 -0
  394. package/dist/visual-manifest.d.ts +6 -0
  395. package/dist/watermark/index.d.ts +1 -0
  396. package/dist/watermark/index.js +260 -0
  397. package/dist/watermark/index.js.map +1 -0
  398. package/dist/watermark/watermark.d.ts +106 -0
  399. package/package.json +399 -50
  400. package/dist/empty/index.js.map +0 -1
  401. package/dist/icon/index.js.map +0 -1
  402. package/dist/textarea/index.js.map +0 -1
@@ -0,0 +1,78 @@
1
+ import { connect as zagConnect, type Machine as ZagMachine } from "@zag-js/radio-group";
2
+ import type { Machine, Service } from "@zag-js/core";
3
+ import type { NormalizeProps, PropTypes } from "@zag-js/types";
4
+ import { type QwSelectionItem } from "../selection.js";
5
+ export interface QwRadioGroupProps {
6
+ /** Stable instance id; adapters generate an SSR-safe id when omitted. */
7
+ id?: string;
8
+ /** Accessible group name rendered as the native fieldset legend. */
9
+ label: string;
10
+ /** Supporting text associated with the group. */
11
+ description?: string;
12
+ /** External Field help/error references, merged with the control-owned description. */
13
+ describedBy?: string;
14
+ /** Ordered options with unique non-empty values. */
15
+ items: QwSelectionItem[];
16
+ /** Controlled value; explicit null means no selection. Unknown strings are retained. */
17
+ value?: string | null;
18
+ /** Initial selection and form reset target; defaults to null. */
19
+ defaultValue?: string | null;
20
+ /** Disable the group and exclude its inputs from native submission. */
21
+ disabled?: boolean;
22
+ /** Prevent user changes while retaining focus and submission. */
23
+ readOnly?: boolean;
24
+ /** Require one enabled rendered choice through native radio validation. */
25
+ required?: boolean;
26
+ /** Expose error semantics; the owner supplies error text. */
27
+ invalid?: boolean;
28
+ /** Native group field name; defaults to the instance id. Use a unique explicit name for forms. */
29
+ name?: string;
30
+ /** Associate every input with an external form id. */
31
+ form?: string;
32
+ /** Visual layout; defaults to vertical. Native arrows work in either layout. */
33
+ orientation?: "vertical" | "horizontal";
34
+ /** Layout direction; omitted direction inherits from the native input. */
35
+ dir?: "ltr" | "rtl";
36
+ /** Allow native arrow navigation to wrap around; defaults to true. */
37
+ loop?: boolean;
38
+ /** Value update request, including reset to the declared default. */
39
+ onValueChange?: (details: {
40
+ value: string | null;
41
+ }) => void;
42
+ }
43
+ type ZagSchema = ZagMachine extends Machine<infer S> ? S : never;
44
+ export interface QwRadioGroupSchema extends ZagSchema {
45
+ props: ZagSchema["props"] & {
46
+ label?: string;
47
+ description?: string;
48
+ describedBy?: string;
49
+ items: QwSelectionItem[];
50
+ loop: boolean;
51
+ };
52
+ context: ZagSchema["context"] & {
53
+ disabledIds: string[];
54
+ };
55
+ }
56
+ export type QwRadioGroupMachine = Machine<QwRadioGroupSchema>;
57
+ export type QwRadioGroupService = Service<QwRadioGroupSchema>;
58
+ export interface QwRadioGroupItemProps {
59
+ value: string;
60
+ }
61
+ export declare function createRadioGroupProps(props: QwRadioGroupProps): Partial<QwRadioGroupSchema["props"]>;
62
+ /** Upstream focus/pointer state with one shared native selection/form lifecycle. */
63
+ export declare const radioGroupMachine: QwRadioGroupMachine;
64
+ export interface QwRadioGroupApi<T extends PropTypes = PropTypes> extends Omit<ReturnType<typeof zagConnect<T>>, "setValue" | "getItemState" | "getItemProps" | "getItemTextProps" | "getItemControlProps" | "getItemHiddenInputProps"> {
65
+ label: string;
66
+ description: string;
67
+ items: QwSelectionItem[];
68
+ setValue(value: string | null): void;
69
+ getItemState(item: QwRadioGroupItemProps): ReturnType<ReturnType<typeof zagConnect<T>>["getItemState"]>;
70
+ getItemProps(item: QwRadioGroupItemProps): T["label"];
71
+ getItemTextProps(item: QwRadioGroupItemProps): T["element"];
72
+ getItemControlProps(item: QwRadioGroupItemProps): T["element"];
73
+ getItemHiddenInputProps(item: QwRadioGroupItemProps): T["input"];
74
+ getDescriptionProps(): T["element"];
75
+ getItemDescriptionProps(item: QwRadioGroupItemProps): T["element"];
76
+ }
77
+ export declare function connect<T extends PropTypes>(service: QwRadioGroupService, normalize: NormalizeProps<T>): QwRadioGroupApi<T>;
78
+ export {};
@@ -0,0 +1,230 @@
1
+ import { r as selectionItemKey, t as normalizeSelectionItems } from "./selection-ivXqO1eu.js";
2
+ import { t as mergeDescriptionIds } from "./aria-description-CimD2M_C.js";
3
+ import { n as trackSelectionForm, t as syncSelectionInputs } from "./selection-form-BOM_odUk.js";
4
+ import { getComputedStyle } from "@zag-js/dom-query";
5
+ import { connect, machine } from "@zag-js/radio-group";
6
+ //#region src/radio-group/radio-group.ts
7
+ const normalizeValue = (value) => {
8
+ if (value == null) return null;
9
+ if (typeof value !== "string" || !value.length) throw new TypeError("RadioGroup values must be non-empty strings or null");
10
+ return value;
11
+ };
12
+ function createRadioGroupProps(props) {
13
+ return {
14
+ ...props,
15
+ items: normalizeSelectionItems(props.items),
16
+ defaultValue: normalizeValue(props.defaultValue),
17
+ value: props.value === void 0 ? void 0 : normalizeValue(props.value),
18
+ loop: props.loop ?? true
19
+ };
20
+ }
21
+ const rootId = (scope) => scope.ids?.root ?? `radio-group:${scope.id}`;
22
+ const inputId = (scope, value) => `${rootId(scope)}:radio:input:${selectionItemKey(value)}`;
23
+ function selectionScope(scope) {
24
+ const id = rootId(scope);
25
+ const part = (name) => (value) => `${id}:radio:${name}:${selectionItemKey(value)}`;
26
+ return {
27
+ ...scope,
28
+ ids: {
29
+ root: id,
30
+ label: `${id}:label`,
31
+ indicator: `${id}:indicator`,
32
+ item: part("item"),
33
+ itemLabel: part("label"),
34
+ itemControl: part("control"),
35
+ itemHiddenInput: part("input")
36
+ }
37
+ };
38
+ }
39
+ function sync(params) {
40
+ syncSelectionInputs(params.scope, params.prop("items").map((item) => ({
41
+ id: inputId(params.scope, item.value),
42
+ checked: params.context.get("value") === item.value
43
+ })));
44
+ }
45
+ const base = machine;
46
+ /** Upstream focus/pointer state with one shared native selection/form lifecycle. */
47
+ const radioGroupMachine = {
48
+ ...base,
49
+ props(params) {
50
+ const props = base.props(params);
51
+ return {
52
+ ...props,
53
+ items: normalizeSelectionItems(props.items ?? []),
54
+ defaultValue: normalizeValue(props.defaultValue),
55
+ value: props.value === void 0 ? void 0 : normalizeValue(props.value),
56
+ loop: props.loop ?? true
57
+ };
58
+ },
59
+ context(params) {
60
+ return {
61
+ ...base.context(params),
62
+ disabledIds: params.bindable(() => ({ defaultValue: [] }))
63
+ };
64
+ },
65
+ implementations: {
66
+ ...base.implementations,
67
+ effects: {
68
+ ...base.implementations?.effects,
69
+ trackFormControlState(params) {
70
+ return trackSelectionForm({
71
+ scope: params.scope,
72
+ rootId: rootId(params.scope),
73
+ form: () => params.prop("form"),
74
+ getState: () => params.prop("items").map((item) => ({
75
+ id: inputId(params.scope, item.value),
76
+ checked: params.context.get("value") === item.value
77
+ })),
78
+ onReset: () => params.context.set("value", normalizeValue(params.prop("defaultValue"))),
79
+ onDisabledChange: (ids) => {
80
+ params.context.set("disabledIds", [...ids]);
81
+ params.context.set("fieldsetDisabled", params.prop("items").length > 0 && params.prop("items").every((item) => ids.includes(inputId(params.scope, item.value))));
82
+ }
83
+ }).stop;
84
+ }
85
+ },
86
+ actions: {
87
+ ...base.implementations?.actions,
88
+ syncInputElements: sync,
89
+ syncIndicatorRect(params) {
90
+ base.implementations?.actions?.syncIndicatorRect?.({
91
+ ...params,
92
+ scope: selectionScope(params.scope)
93
+ });
94
+ },
95
+ setValue(params) {
96
+ const item = params.prop("items").find((item) => item.value === params.event.value);
97
+ const blocked = params.prop("readOnly") || params.computed("isDisabled") || item?.disabled || params.context.get("disabledIds").includes(inputId(params.scope, params.event.value ?? ""));
98
+ if (!params.event.isTrusted || !blocked) params.context.set("value", normalizeValue(params.event.value));
99
+ queueMicrotask(() => sync(params));
100
+ },
101
+ dispatchChangeEvent(params) {
102
+ queueMicrotask(() => sync(params));
103
+ }
104
+ }
105
+ }
106
+ };
107
+ function connect$1(service, normalize) {
108
+ const api = connect({
109
+ ...service,
110
+ scope: selectionScope(service.scope)
111
+ }, normalize);
112
+ const id = rootId(service.scope);
113
+ const resolve = ({ value }) => {
114
+ const item = service.prop("items").find((item) => item.value === value);
115
+ if (!item) throw new RangeError("RadioGroup item value is not present in items");
116
+ return item;
117
+ };
118
+ const disabled = (item) => !!service.prop("disabled") || !!item.disabled || service.context.get("disabledIds").includes(inputId(service.scope, item.value));
119
+ const itemProps = (props) => {
120
+ const item = resolve(props);
121
+ return {
122
+ ...item,
123
+ disabled: disabled(item)
124
+ };
125
+ };
126
+ const stable = { "data-ssr": void 0 };
127
+ const describe = (item) => `${id}:description:${selectionItemKey(item.value)}`;
128
+ return {
129
+ ...api,
130
+ label: service.prop("label") ?? "",
131
+ description: service.prop("description") ?? "",
132
+ items: service.prop("items").map((item) => ({ ...item })),
133
+ setValue(value) {
134
+ service.send({
135
+ type: "SET_VALUE",
136
+ value: normalizeValue(value),
137
+ isTrusted: false
138
+ });
139
+ },
140
+ getRootProps: () => ({
141
+ ...api.getRootProps(),
142
+ ...normalize.element({
143
+ disabled: !!service.prop("disabled"),
144
+ form: service.prop("form"),
145
+ "aria-describedby": mergeDescriptionIds(service.prop("description") ? `${id}:description` : void 0, service.prop("describedBy")),
146
+ "aria-invalid": service.prop("invalid") || void 0
147
+ })
148
+ }),
149
+ getDescriptionProps: () => normalize.element({
150
+ id: `${id}:description`,
151
+ "data-scope": "radio-group",
152
+ "data-part": "description"
153
+ }),
154
+ getItemDescriptionProps: (props) => normalize.element({
155
+ id: describe(resolve(props)),
156
+ "data-scope": "radio-group",
157
+ "data-part": "item-description"
158
+ }),
159
+ getItemState: (props) => api.getItemState(itemProps(props)),
160
+ getItemProps: (props) => ({
161
+ ...api.getItemProps(itemProps(props)),
162
+ ...normalize.label(stable)
163
+ }),
164
+ getItemTextProps: (props) => ({
165
+ ...api.getItemTextProps(itemProps(props)),
166
+ ...normalize.element(stable)
167
+ }),
168
+ getItemControlProps: (props) => ({
169
+ ...api.getItemControlProps(itemProps(props)),
170
+ ...normalize.element(stable)
171
+ }),
172
+ getItemHiddenInputProps(props) {
173
+ const item = resolve(props);
174
+ const input = { ...api.getItemHiddenInputProps(itemProps(props)) };
175
+ delete input.defaultChecked;
176
+ const originalKeyDown = input.onKeyDown;
177
+ return {
178
+ ...input,
179
+ ...normalize.input({
180
+ checked: service.context.get("value") === item.value,
181
+ disabled: !!service.prop("disabled") || !!item.disabled,
182
+ name: disabled(item) ? void 0 : service.prop("name") || service.scope.id,
183
+ readOnly: !!service.prop("readOnly"),
184
+ "data-scope": "radio-group",
185
+ "data-part": "input",
186
+ "aria-checked": service.context.get("value") === item.value,
187
+ "aria-describedby": item.description ? describe(item) : void 0,
188
+ onChange() {},
189
+ onClick(event) {
190
+ if (disabled(item) || service.prop("readOnly")) event.preventDefault();
191
+ else service.send({
192
+ type: "SET_VALUE",
193
+ value: item.value,
194
+ isTrusted: true
195
+ });
196
+ queueMicrotask(() => sync(service));
197
+ },
198
+ onKeyDown(event) {
199
+ if (event.defaultPrevented) return;
200
+ const arrow = [
201
+ "ArrowLeft",
202
+ "ArrowRight",
203
+ "ArrowUp",
204
+ "ArrowDown"
205
+ ].includes(event.key);
206
+ if ((disabled(item) || service.prop("readOnly")) && (arrow || event.key === " ")) {
207
+ event.preventDefault();
208
+ return;
209
+ }
210
+ if (arrow && !service.prop("loop")) {
211
+ const rtl = (service.prop("dir") ?? getComputedStyle(event.currentTarget).direction) === "rtl";
212
+ const delta = event.key === "ArrowDown" ? 1 : event.key === "ArrowUp" ? -1 : event.key === "ArrowRight" ? rtl ? -1 : 1 : rtl ? 1 : -1;
213
+ const enabled = service.prop("items").filter((item) => !disabled(item));
214
+ const index = enabled.findIndex((entry) => entry.value === item.value);
215
+ if (index + delta < 0 || index + delta >= enabled.length) {
216
+ event.preventDefault();
217
+ return;
218
+ }
219
+ }
220
+ originalKeyDown?.(event);
221
+ }
222
+ })
223
+ };
224
+ }
225
+ };
226
+ }
227
+ //#endregion
228
+ export { createRadioGroupProps as n, radioGroupMachine as r, connect$1 as t };
229
+
230
+ //# sourceMappingURL=radio-group-BOIMuqnS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radio-group-BOIMuqnS.js","names":["zagMachine","connect","zagConnect"],"sources":["../src/radio-group/radio-group.ts"],"sourcesContent":["import { mergeDescriptionIds } from \"../aria-description.js\";\nimport { machine as zagMachine, connect as zagConnect, type Machine as ZagMachine } from \"@zag-js/radio-group\";\nimport type { Machine, Params, Service } from \"@zag-js/core\";\nimport { getComputedStyle } from \"@zag-js/dom-query\";\nimport type { NormalizeProps, PropTypes } from \"@zag-js/types\";\nimport { normalizeSelectionItems, selectionItemKey, type QwSelectionItem } from \"../selection.js\";\nimport { syncSelectionInputs, trackSelectionForm } from \"../selection-form.js\";\n\nexport interface QwRadioGroupProps {\n /** Stable instance id; adapters generate an SSR-safe id when omitted. */\n id?: string;\n /** Accessible group name rendered as the native fieldset legend. */\n label: string;\n /** Supporting text associated with the group. */\n description?: string;\n /** External Field help/error references, merged with the control-owned description. */\n describedBy?: string;\n /** Ordered options with unique non-empty values. */\n items: QwSelectionItem[];\n /** Controlled value; explicit null means no selection. Unknown strings are retained. */\n value?: string | null;\n /** Initial selection and form reset target; defaults to null. */\n defaultValue?: string | null;\n /** Disable the group and exclude its inputs from native submission. */\n disabled?: boolean;\n /** Prevent user changes while retaining focus and submission. */\n readOnly?: boolean;\n /** Require one enabled rendered choice through native radio validation. */\n required?: boolean;\n /** Expose error semantics; the owner supplies error text. */\n invalid?: boolean;\n /** Native group field name; defaults to the instance id. Use a unique explicit name for forms. */\n name?: string;\n /** Associate every input with an external form id. */\n form?: string;\n /** Visual layout; defaults to vertical. Native arrows work in either layout. */\n orientation?: \"vertical\" | \"horizontal\";\n /** Layout direction; omitted direction inherits from the native input. */\n dir?: \"ltr\" | \"rtl\";\n /** Allow native arrow navigation to wrap around; defaults to true. */\n loop?: boolean;\n /** Value update request, including reset to the declared default. */\n onValueChange?: (details: { value: string | null }) => void;\n}\ntype ZagSchema = ZagMachine extends Machine<infer S> ? S : never;\nexport interface QwRadioGroupSchema extends ZagSchema {\n props: ZagSchema[\"props\"] & { label?: string; description?: string; describedBy?: string; items: QwSelectionItem[]; loop: boolean };\n context: ZagSchema[\"context\"] & { disabledIds: string[] };\n}\nexport type QwRadioGroupMachine = Machine<QwRadioGroupSchema>;\nexport type QwRadioGroupService = Service<QwRadioGroupSchema>;\nexport interface QwRadioGroupItemProps { value: string }\nconst normalizeValue = (value: string | null | undefined): string | null => {\n if (value == null) return null;\n if (typeof value !== \"string\" || !value.length) throw new TypeError(\"RadioGroup values must be non-empty strings or null\");\n return value;\n};\nexport function createRadioGroupProps(props: QwRadioGroupProps): Partial<QwRadioGroupSchema[\"props\"]> {\n return { ...props, items: normalizeSelectionItems(props.items), defaultValue: normalizeValue(props.defaultValue), value: props.value === undefined ? undefined : normalizeValue(props.value), loop: props.loop ?? true };\n}\nconst rootId = (scope: QwRadioGroupService[\"scope\"]) => scope.ids?.root ?? `radio-group:${scope.id}`;\nconst inputId = (scope: QwRadioGroupService[\"scope\"], value: string) => `${rootId(scope)}:radio:input:${selectionItemKey(value)}`;\nfunction selectionScope(scope: QwRadioGroupService[\"scope\"]): QwRadioGroupService[\"scope\"] {\n const id = rootId(scope);\n const part = (name: string) => (value: string) => `${id}:radio:${name}:${selectionItemKey(value)}`;\n return { ...scope, ids: { root: id, label: `${id}:label`, indicator: `${id}:indicator`, item: part(\"item\"), itemLabel: part(\"label\"), itemControl: part(\"control\"), itemHiddenInput: part(\"input\") } };\n}\ntype GroupParams = Pick<Params<QwRadioGroupSchema>, \"scope\" | \"context\" | \"prop\">;\nfunction sync(params: GroupParams) {\n syncSelectionInputs(params.scope, params.prop(\"items\").map(item => ({ id: inputId(params.scope, item.value), checked: params.context.get(\"value\") === item.value })));\n}\n// The wrapper preserves every upstream field and adds Core selection metadata.\nconst base = zagMachine as unknown as QwRadioGroupMachine;\n/** Upstream focus/pointer state with one shared native selection/form lifecycle. */\nexport const radioGroupMachine: QwRadioGroupMachine = {\n ...base,\n props(params) {\n const props = base.props!(params);\n return { ...props, items: normalizeSelectionItems(props.items ?? []), defaultValue: normalizeValue(props.defaultValue), value: props.value === undefined ? undefined : normalizeValue(props.value), loop: props.loop ?? true,\n };\n },\n context(params) { return { ...base.context!(params), disabledIds: params.bindable<string[]>(() => ({ defaultValue: [] })) }; },\n implementations: {\n ...base.implementations,\n effects: { ...base.implementations?.effects,\n trackFormControlState(params) {\n const tracker = trackSelectionForm({ scope: params.scope, rootId: rootId(params.scope), form: () => params.prop(\"form\"),\n getState: () => params.prop(\"items\").map(item => ({ id: inputId(params.scope, item.value), checked: params.context.get(\"value\") === item.value })),\n onReset: () => params.context.set(\"value\", normalizeValue(params.prop(\"defaultValue\"))),\n onDisabledChange: ids => { params.context.set(\"disabledIds\", [...ids]); params.context.set(\"fieldsetDisabled\", params.prop(\"items\").length > 0 && params.prop(\"items\").every(item => ids.includes(inputId(params.scope, item.value)))); },\n }); return tracker.stop;\n },\n },\n actions: { ...base.implementations?.actions, syncInputElements: sync,\n syncIndicatorRect(params) { base.implementations?.actions?.syncIndicatorRect?.({ ...params, scope: selectionScope(params.scope) }); },\n setValue(params) {\n const item = params.prop(\"items\").find(item => item.value === params.event.value);\n const blocked = params.prop(\"readOnly\") || params.computed(\"isDisabled\") || item?.disabled || params.context.get(\"disabledIds\").includes(inputId(params.scope, params.event.value ?? \"\"));\n if (!params.event.isTrusted || !blocked) params.context.set(\"value\", normalizeValue(params.event.value));\n queueMicrotask(() => sync(params));\n },\n // The final property sync owns native state; programmatic updates do not reenter click handlers.\n dispatchChangeEvent(params) { queueMicrotask(() => sync(params)); },\n },\n },\n};\nexport interface QwRadioGroupApi<T extends PropTypes = PropTypes> extends Omit<ReturnType<typeof zagConnect<T>>, \"setValue\" | \"getItemState\" | \"getItemProps\" | \"getItemTextProps\" | \"getItemControlProps\" | \"getItemHiddenInputProps\"> {\n label: string; description: string; items: QwSelectionItem[];\n setValue(value: string | null): void;\n getItemState(item: QwRadioGroupItemProps): ReturnType<ReturnType<typeof zagConnect<T>>[\"getItemState\"]>;\n getItemProps(item: QwRadioGroupItemProps): T[\"label\"];\n getItemTextProps(item: QwRadioGroupItemProps): T[\"element\"];\n getItemControlProps(item: QwRadioGroupItemProps): T[\"element\"];\n getItemHiddenInputProps(item: QwRadioGroupItemProps): T[\"input\"];\n getDescriptionProps(): T[\"element\"];\n getItemDescriptionProps(item: QwRadioGroupItemProps): T[\"element\"];\n}\nexport function connect<T extends PropTypes>(service: QwRadioGroupService, normalize: NormalizeProps<T>): QwRadioGroupApi<T> {\n const zagService = { ...service, scope: selectionScope(service.scope) } as unknown as Service<ZagSchema>;\n const api = zagConnect(zagService, normalize);\n const id = rootId(service.scope);\n const resolve = ({ value }: QwRadioGroupItemProps) => { const item = service.prop(\"items\").find(item => item.value === value); if (!item) throw new RangeError(\"RadioGroup item value is not present in items\"); return item; };\n const disabled = (item: QwSelectionItem) => !!service.prop(\"disabled\") || !!item.disabled || service.context.get(\"disabledIds\").includes(inputId(service.scope, item.value));\n const itemProps = (props: QwRadioGroupItemProps) => { const item = resolve(props); return { ...item, disabled: disabled(item) }; };\n const stable = { \"data-ssr\": undefined };\n const describe = (item: QwSelectionItem) => `${id}:description:${selectionItemKey(item.value)}`;\n return { ...api, label: service.prop(\"label\") ?? \"\", description: service.prop(\"description\") ?? \"\", items: service.prop(\"items\").map(item => ({ ...item })),\n setValue(value) { service.send({ type: \"SET_VALUE\", value: normalizeValue(value), isTrusted: false }); },\n getRootProps: () => ({ ...api.getRootProps(), ...normalize.element({ disabled: !!service.prop(\"disabled\"), form: service.prop(\"form\"), \"aria-describedby\": mergeDescriptionIds(service.prop(\"description\") ? `${id}:description` : undefined, service.prop(\"describedBy\")), \"aria-invalid\": service.prop(\"invalid\") || undefined }) }),\n getDescriptionProps: () => normalize.element({ id: `${id}:description`, \"data-scope\": \"radio-group\", \"data-part\": \"description\" }),\n getItemDescriptionProps: props => normalize.element({ id: describe(resolve(props)), \"data-scope\": \"radio-group\", \"data-part\": \"item-description\" }),\n getItemState: props => api.getItemState(itemProps(props)),\n getItemProps: props => ({ ...api.getItemProps(itemProps(props)), ...normalize.label(stable) }),\n getItemTextProps: props => ({ ...api.getItemTextProps(itemProps(props)), ...normalize.element(stable) }),\n getItemControlProps: props => ({ ...api.getItemControlProps(itemProps(props)), ...normalize.element(stable) }),\n getItemHiddenInputProps(props) {\n const item = resolve(props); const input = { ...api.getItemHiddenInputProps(itemProps(props)) }; delete input.defaultChecked;\n const originalKeyDown = input.onKeyDown;\n return { ...input, ...normalize.input({ checked: service.context.get(\"value\") === item.value, disabled: !!service.prop(\"disabled\") || !!item.disabled,\n // Disabled selected radios must not satisfy required for the enabled group.\n name: disabled(item) ? undefined : service.prop(\"name\") || service.scope.id, readOnly: !!service.prop(\"readOnly\"),\n \"data-scope\": \"radio-group\", \"data-part\": \"input\", \"aria-checked\": service.context.get(\"value\") === item.value,\n \"aria-describedby\": item.description ? describe(item) : undefined, onChange() {},\n onClick(event) {\n if (disabled(item) || service.prop(\"readOnly\")) event.preventDefault();\n else service.send({ type: \"SET_VALUE\", value: item.value, isTrusted: true });\n queueMicrotask(() => sync(service));\n },\n onKeyDown(event) {\n if (event.defaultPrevented) return;\n const arrow = [\"ArrowLeft\", \"ArrowRight\", \"ArrowUp\", \"ArrowDown\"].includes(event.key);\n if ((disabled(item) || service.prop(\"readOnly\")) && (arrow || event.key === \" \")) { event.preventDefault(); return; }\n if (arrow && !service.prop(\"loop\")) {\n const rtl = (service.prop(\"dir\") ?? getComputedStyle(event.currentTarget).direction) === \"rtl\";\n const delta = event.key === \"ArrowDown\" ? 1 : event.key === \"ArrowUp\" ? -1 : event.key === \"ArrowRight\" ? (rtl ? -1 : 1) : (rtl ? 1 : -1);\n const enabled = service.prop(\"items\").filter(item => !disabled(item)); const index = enabled.findIndex(entry => entry.value === item.value);\n if (index + delta < 0 || index + delta >= enabled.length) { event.preventDefault(); return; }\n }\n originalKeyDown?.(event);\n },\n }) };\n },\n };\n}\n"],"mappings":";;;;;;AAoDA,MAAM,kBAAkB,UAAoD;CAC1E,IAAI,SAAS,MAAM,OAAO;CAC1B,IAAI,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,MAAM,IAAI,UAAU,qDAAqD;CACzH,OAAO;AACT;AACA,SAAgB,sBAAsB,OAAgE;CACpG,OAAO;EAAE,GAAG;EAAO,OAAO,wBAAwB,MAAM,KAAK;EAAG,cAAc,eAAe,MAAM,YAAY;EAAG,OAAO,MAAM,UAAU,KAAA,IAAY,KAAA,IAAY,eAAe,MAAM,KAAK;EAAG,MAAM,MAAM,QAAQ;CAAK;AACzN;AACA,MAAM,UAAU,UAAwC,MAAM,KAAK,QAAQ,eAAe,MAAM;AAChG,MAAM,WAAW,OAAqC,UAAkB,GAAG,OAAO,KAAK,EAAE,eAAe,iBAAiB,KAAK;AAC9H,SAAS,eAAe,OAAmE;CACzF,MAAM,KAAK,OAAO,KAAK;CACvB,MAAM,QAAQ,UAAkB,UAAkB,GAAG,GAAG,SAAS,KAAK,GAAG,iBAAiB,KAAK;CAC/F,OAAO;EAAE,GAAG;EAAO,KAAK;GAAE,MAAM;GAAI,OAA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MAC5B,MAAM,QAAQ;OAAC;OAAa;OAAc;OAAW;MAAW,CAAC,CAAC,SAAS,MAAM,GAAG;MACpF,KAAK,SAAS,IAAI,KAAK,QAAQ,KAAK,UAAU,OAAO,SAAS,MAAM,QAAQ,MAAM;OAAE,MAAM,eAAe;OAAG;MAAQ;MACpH,IAAI,SAAS,CAAC,QAAQ,KAAK,MAAM,GAAG;OAClC,MAAM,OAAO,QAAQ,KAAK,KAAK,KAAK,iBAAiB,MAAM,aAAa,CAAC,CAAC,eAAe;OACzF,MAAM,QAAQ,MAAM,QAAQ,cAAc,IAAI,MAAM,QAAQ,YAAY,KAAK,MAAM,QAAQ,eAAgB,MAAM,KAAK,IAAM,MAAM,IAAI;OACtI,MAAM,UAAU,QAAQ,KAAK,OAAO,CAAC,CAAC,QAAO,SAAQ,CAAC,SAAS,IAAI,CAAC;OAAG,MAAM,QAAQ,QAAQ,WAAU,UAAS,MAAM,UAAU,KAAK,KAAK;OAC1I,IAAI,QAAQ,QAAQ,KAAK,QAAQ,SAAS,QAAQ,QAAQ;QAAE,MAAM,eAAe;QAAG;OAAQ;MAC9F;MACA,kBAAkB,KAAK;KACzB;IACF,CAAC;GAAE;EACL;CACF;AACF"}
@@ -0,0 +1 @@
1
+ export * from "./rate.js";
@@ -0,0 +1,2 @@
1
+ import { a as getRatePointValue, c as rateMachine, i as createRateProps, l as rateTouchCoverageForGlyphFill, n as RATE_SIZES, o as normalizeRateCount, r as connect, s as normalizeRateValue, t as RATE_PARTS } from "../rate-5XsU2QkY.js";
2
+ export { RATE_PARTS, RATE_SIZES, connect, createRateProps, getRatePointValue, normalizeRateCount, normalizeRateValue, rateMachine, rateTouchCoverageForGlyphFill };
@@ -0,0 +1,28 @@
1
+ import type { SelectionFormScope } from "../selection-form.js";
2
+ export interface RateProxyConstraints {
3
+ required: boolean;
4
+ /** Authoritative disabled prop only. Fieldset disabling stays a native :disabled match. */
5
+ disabled: boolean;
6
+ min: string;
7
+ max: string;
8
+ step: string;
9
+ }
10
+ export interface RateFormOptions {
11
+ scope: SelectionFormScope;
12
+ inputId: string;
13
+ rootId: string;
14
+ current(): string;
15
+ initial(): string;
16
+ constraints(): RateProxyConstraints;
17
+ onReset(): void;
18
+ onDisabledChange(disabled: boolean): void;
19
+ }
20
+ /**
21
+ * The value content attribute and the value property are the same effective form string.
22
+ * HTML reset reads that attribute, so defaultValue must not be a different initial string.
23
+ * A connected reset still requests the declared default through onReset, then syncs again.
24
+ * Read-only is intentionally not copied onto the proxy.
25
+ */
26
+ export declare function syncRateInput(options: Pick<RateFormOptions, "scope" | "inputId" | "current" | "initial" | "constraints">): void;
27
+ /** Actual form ownership, cancellation and native fieldset disabled rules are tracked in Core. */
28
+ export declare function trackRateForm(options: RateFormOptions): () => void;
@@ -0,0 +1,144 @@
1
+ import { type Machine, type Service } from "@zag-js/core";
2
+ import type { NormalizeProps, PropTypes } from "@zag-js/types";
3
+ import { type IconNameInput, type IconState } from "../icon/index.js";
4
+ export declare const RATE_SIZES: readonly ["sm", "md", "lg"];
5
+ export declare const RATE_PARTS: readonly ["root", "label", "description", "control", "item", "empty-icon", "filled-icon", "input", "clear", "content"];
6
+ export type RateSize = (typeof RATE_SIZES)[number];
7
+ export type RatePart = (typeof RATE_PARTS)[number];
8
+ export interface RateValueChangeDetails {
9
+ value: number;
10
+ }
11
+ export interface RatePreviewChangeDetails {
12
+ value: number | null;
13
+ }
14
+ export interface QwRateProps {
15
+ id?: string;
16
+ /** Nonempty visible accessible rating label. */
17
+ label: string;
18
+ description?: string;
19
+ /** Defined raw finite model is controlled; effective display/submission is derived. */
20
+ value?: number;
21
+ /** Initial/reset raw model; defaults zero. */
22
+ defaultValue?: number;
23
+ /** Positive safe integer 1–1000; invalid values use five. */
24
+ count?: number;
25
+ allowHalf?: boolean;
26
+ /** Repeated pointer tap/explicit clear only; slider Home remains zero. */
27
+ allowClear?: boolean;
28
+ disabled?: boolean;
29
+ readOnly?: boolean;
30
+ required?: boolean;
31
+ invalid?: boolean;
32
+ name?: string;
33
+ form?: string;
34
+ dir?: string;
35
+ touchable?: boolean;
36
+ size?: RateSize;
37
+ iconName?: IconNameInput;
38
+ emptyIconName?: IconNameInput;
39
+ /** Scalar glyph text instead of system icons; never clones caller DOM nodes. */
40
+ character?: string;
41
+ /** Explicit accessible scale text, using {value}/{count}. */
42
+ valueTextTemplate?: string;
43
+ clearLabel?: string;
44
+ onValueChange?: (details: RateValueChangeDetails) => void;
45
+ onPreviewChange?: (details: RatePreviewChangeDetails) => void;
46
+ }
47
+ export declare function normalizeRateCount(count: number | undefined): number;
48
+ export declare function normalizeRateValue(value: number | undefined, count?: number, allowHalf?: boolean, readOnly?: boolean): number;
49
+ export interface RateItemRect {
50
+ left: number;
51
+ right: number;
52
+ }
53
+ /** Logical item geometry includes gaps; midpoint and gap ties prefer the preceding half/item. */
54
+ export declare function getRatePointValue(x: number, rects: readonly RateItemRect[], allowHalf: boolean, dir: "ltr" | "rtl"): number | null;
55
+ /**
56
+ * Width of the touch target, measured from its inline start, that reaches `fill` of a centered glyph.
57
+ * Half often matches by centering; other fractions do not. Rendering must clip the glyph box instead.
58
+ */
59
+ export declare function rateTouchCoverageForGlyphFill(fill: number, touch: number, glyph: number): number;
60
+ export interface QwRateSchema {
61
+ props: QwRateProps & {
62
+ count: number;
63
+ defaultValue: number;
64
+ allowHalf: boolean;
65
+ allowClear: boolean;
66
+ touchable: boolean;
67
+ size: RateSize;
68
+ valueTextTemplate: string;
69
+ clearLabel: string;
70
+ };
71
+ context: {
72
+ value: number;
73
+ previewValue: number | null;
74
+ focused: boolean;
75
+ pointerId: number | null;
76
+ startX: number;
77
+ startY: number;
78
+ moved: boolean;
79
+ inheritedDisabled: boolean;
80
+ validationError: boolean;
81
+ };
82
+ state: "ready" | "dragging";
83
+ guard: "canInteract";
84
+ action: "setValue" | "setPreview" | "startPointer" | "movePointer" | "commitPointer" | "cancelPointer" | "setFocus" | "setDisabled" | "resetForm" | "markInvalid" | "syncInput";
85
+ effect: "trackForm" | "capturePointer";
86
+ event: {
87
+ type: "VALUE.SET";
88
+ value: number;
89
+ } | {
90
+ type: "PREVIEW.SET";
91
+ value: number | null;
92
+ } | {
93
+ type: "POINTER.START" | "POINTER.MOVE" | "POINTER.END";
94
+ pointerId: number;
95
+ x: number;
96
+ y: number;
97
+ value: number;
98
+ touch: boolean;
99
+ } | {
100
+ type: "POINTER.CANCEL";
101
+ pointerId?: number;
102
+ captureLost?: boolean;
103
+ } | {
104
+ type: "DOMAIN.CHANGED" | "FORM.RESET" | "INVALID";
105
+ } | {
106
+ type: "FOCUS.SET" | "DISABLED.SET";
107
+ value: boolean;
108
+ };
109
+ }
110
+ export type QwRateMachine = Machine<QwRateSchema>;
111
+ export type QwRateService = Service<QwRateSchema>;
112
+ export declare function createRateProps(props: QwRateProps): Partial<QwRateSchema["props"]>;
113
+ /** One bindable owns raw models; mode/domain changes derive values without fake change callbacks. */
114
+ export declare const rateMachine: QwRateMachine;
115
+ export interface RateItem {
116
+ index: number;
117
+ fill: number;
118
+ state: "empty" | "half" | "full";
119
+ }
120
+ export interface QwRateApi<T extends PropTypes = PropTypes> {
121
+ value: number;
122
+ effectiveValue: number;
123
+ previewValue: number | null;
124
+ displayValue: number;
125
+ label: string;
126
+ description: string;
127
+ clearLabel: string;
128
+ character?: string;
129
+ items: RateItem[];
130
+ setValue(value: number): void;
131
+ setPreviewValue(value: number | null): void;
132
+ getRootProps(): T["element"];
133
+ getLabelProps(): T["element"];
134
+ getDescriptionProps(): T["element"];
135
+ getControlProps(): T["element"];
136
+ getItemProps(item: Pick<RateItem, "index">): T["element"];
137
+ getEmptyIconProps(item: Pick<RateItem, "index">): T["element"];
138
+ getFilledIconProps(item: Pick<RateItem, "index">): T["element"];
139
+ getItemIconState(item: Pick<RateItem, "index">, filled: boolean): IconState;
140
+ getInputProps(): T["input"];
141
+ getClearProps(): T["button"];
142
+ getContentProps(): T["element"];
143
+ }
144
+ export declare function connect<T extends PropTypes>(service: QwRateService, normalize: NormalizeProps<T>): QwRateApi<T>;