@qw-ui/core 0.3.0-next.4 → 0.3.0-next.42

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 (415) 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 +85 -0
  26. package/dist/badge/index.d.ts +1 -0
  27. package/dist/badge/index.js +88 -0
  28. package/dist/badge/index.js.map +1 -0
  29. package/dist/button/button.d.ts +13 -0
  30. package/dist/button/index.js +3 -5
  31. package/dist/button/index.js.map +1 -1
  32. package/dist/calendar/calendar.d.ts +100 -0
  33. package/dist/calendar/index.d.ts +1 -0
  34. package/dist/calendar/index.js +2 -0
  35. package/dist/calendar-CmpK3stz.js +363 -0
  36. package/dist/calendar-CmpK3stz.js.map +1 -0
  37. package/dist/card/card.d.ts +68 -0
  38. package/dist/card/index.d.ts +2 -0
  39. package/dist/card/index.js +2 -0
  40. package/dist/card-DRtWa6Cr.js +107 -0
  41. package/dist/card-DRtWa6Cr.js.map +1 -0
  42. package/dist/cascader/cascader.d.ts +115 -0
  43. package/dist/cascader/index.d.ts +1 -0
  44. package/dist/cascader/index.js +2 -0
  45. package/dist/cascader-D-xMjs7P.js +333 -0
  46. package/dist/cascader-D-xMjs7P.js.map +1 -0
  47. package/dist/cell/cell.d.ts +41 -0
  48. package/dist/cell/index.d.ts +1 -0
  49. package/dist/cell/index.js +43 -0
  50. package/dist/cell/index.js.map +1 -0
  51. package/dist/check-list/check-list.d.ts +78 -0
  52. package/dist/check-list/index.d.ts +2 -0
  53. package/dist/check-list/index.js +2 -0
  54. package/dist/check-list-BvZHQt5w.js +60 -0
  55. package/dist/check-list-BvZHQt5w.js.map +1 -0
  56. package/dist/checkbox/checkbox.d.ts +59 -0
  57. package/dist/checkbox/index.d.ts +2 -0
  58. package/dist/checkbox/index.js +2 -0
  59. package/dist/checkbox-BlndJrz5.js +127 -0
  60. package/dist/checkbox-BlndJrz5.js.map +1 -0
  61. package/dist/checkbox-group/checkbox-group.d.ts +86 -0
  62. package/dist/checkbox-group/index.d.ts +3 -0
  63. package/dist/checkbox-group/index.js +2 -0
  64. package/dist/checkbox-group-gGfsTv-e.js +223 -0
  65. package/dist/checkbox-group-gGfsTv-e.js.map +1 -0
  66. package/dist/choice-group-C4c9m0qe.js +373 -0
  67. package/dist/choice-group-C4c9m0qe.js.map +1 -0
  68. package/dist/circle/circle.d.ts +97 -0
  69. package/dist/circle/index.d.ts +1 -0
  70. package/dist/circle/index.js +119 -0
  71. package/dist/circle/index.js.map +1 -0
  72. package/dist/collapse/collapse.d.ts +98 -0
  73. package/dist/collapse/index.d.ts +2 -0
  74. package/dist/collapse/index.js +2 -0
  75. package/dist/collapse-B969h7-H.js +226 -0
  76. package/dist/collapse-B969h7-H.js.map +1 -0
  77. package/dist/countdown/countdown.d.ts +114 -0
  78. package/dist/countdown/index.d.ts +1 -0
  79. package/dist/countdown/index.js +309 -0
  80. package/dist/countdown/index.js.map +1 -0
  81. package/dist/date-picker/date-picker.d.ts +168 -0
  82. package/dist/date-picker/index.d.ts +1 -0
  83. package/dist/date-picker/index.js +401 -0
  84. package/dist/date-picker/index.js.map +1 -0
  85. package/dist/descriptions/descriptions.d.ts +69 -0
  86. package/dist/descriptions/index.d.ts +1 -0
  87. package/dist/descriptions/index.js +86 -0
  88. package/dist/descriptions/index.js.map +1 -0
  89. package/dist/dialog/dialog.d.ts +61 -43
  90. package/dist/dialog/index.js +73 -19
  91. package/dist/dialog/index.js.map +1 -1
  92. package/dist/divider/divider.d.ts +18 -2
  93. package/dist/divider/index.js +20 -2
  94. package/dist/divider/index.js.map +1 -1
  95. package/dist/dropdown/dropdown.d.ts +172 -0
  96. package/dist/dropdown/index.d.ts +2 -0
  97. package/dist/dropdown/index.js +467 -0
  98. package/dist/dropdown/index.js.map +1 -0
  99. package/dist/ellipsis/ellipsis-layout.d.ts +34 -0
  100. package/dist/ellipsis/ellipsis.d.ts +88 -0
  101. package/dist/ellipsis/index.d.ts +2 -0
  102. package/dist/ellipsis/index.js +320 -0
  103. package/dist/ellipsis/index.js.map +1 -0
  104. package/dist/empty/empty-illustration.d.ts +3 -0
  105. package/dist/empty/empty.d.ts +43 -1
  106. package/dist/empty/index.js +2 -21
  107. package/dist/empty-CAgyvhUI.js +166 -0
  108. package/dist/empty-CAgyvhUI.js.map +1 -0
  109. package/dist/field/field.d.ts +95 -0
  110. package/dist/field/index.d.ts +2 -0
  111. package/dist/field/index.js +2 -0
  112. package/dist/field-DMHGIMZF.js +241 -0
  113. package/dist/field-DMHGIMZF.js.map +1 -0
  114. package/dist/floating-bubble/floating-bubble.d.ts +116 -0
  115. package/dist/floating-bubble/index.d.ts +1 -0
  116. package/dist/floating-bubble/index.js +333 -0
  117. package/dist/floating-bubble/index.js.map +1 -0
  118. package/dist/floating-panel/floating-panel.d.ts +80 -0
  119. package/dist/floating-panel/index.d.ts +2 -0
  120. package/dist/floating-panel/index.js +2 -0
  121. package/dist/floating-panel-Cbm5njBJ.js +363 -0
  122. package/dist/floating-panel-Cbm5njBJ.js.map +1 -0
  123. package/dist/footer/footer.d.ts +94 -0
  124. package/dist/footer/index.d.ts +1 -0
  125. package/dist/footer/index.js +154 -0
  126. package/dist/footer/index.js.map +1 -0
  127. package/dist/form/connect.d.ts +6 -0
  128. package/dist/form/form.d.ts +100 -0
  129. package/dist/form/ids.d.ts +14 -0
  130. package/dist/form/index.d.ts +13 -0
  131. package/dist/form/index.js +3 -0
  132. package/dist/form/methods.d.ts +5 -0
  133. package/dist/form/model.d.ts +24 -0
  134. package/dist/form/native.d.ts +25 -0
  135. package/dist/form/rules.d.ts +40 -0
  136. package/dist/form/ssr.d.ts +7 -0
  137. package/dist/form/types.d.ts +150 -0
  138. package/dist/form-BAGkIEMY.js +1354 -0
  139. package/dist/form-BAGkIEMY.js.map +1 -0
  140. package/dist/format-BDUY0C_c.js +89 -0
  141. package/dist/format-BDUY0C_c.js.map +1 -0
  142. package/dist/gesture-_SRHIvBm.js +30 -0
  143. package/dist/gesture-_SRHIvBm.js.map +1 -0
  144. package/dist/grid/grid-item.d.ts +22 -0
  145. package/dist/grid/grid.d.ts +42 -0
  146. package/dist/grid/index.d.ts +2 -0
  147. package/dist/grid/index.js +73 -0
  148. package/dist/grid/index.js.map +1 -0
  149. package/dist/icon/icon.d.ts +37 -1
  150. package/dist/icon/identity.d.ts +3 -0
  151. package/dist/icon/index.js +2 -20
  152. package/dist/icon-Cgdbnk1u.js +77 -0
  153. package/dist/icon-Cgdbnk1u.js.map +1 -0
  154. package/dist/image/image-load.d.ts +24 -0
  155. package/dist/image/image.d.ts +45 -8
  156. package/dist/image/index.d.ts +1 -0
  157. package/dist/image/index.js +116 -14
  158. package/dist/image/index.js.map +1 -1
  159. package/dist/image-preview/image-preview.d.ts +124 -0
  160. package/dist/image-preview/index.d.ts +1 -0
  161. package/dist/image-preview/index.js +450 -0
  162. package/dist/image-preview/index.js.map +1 -0
  163. package/dist/index-bar/index-bar.d.ts +121 -0
  164. package/dist/index-bar/index.d.ts +1 -0
  165. package/dist/index-bar/index.js +386 -0
  166. package/dist/index-bar/index.js.map +1 -0
  167. package/dist/index.d.ts +115 -10
  168. package/dist/index.js +151 -11
  169. package/dist/index.js.map +1 -0
  170. package/dist/infinite-scroll/index.d.ts +1 -0
  171. package/dist/infinite-scroll/index.js +248 -0
  172. package/dist/infinite-scroll/index.js.map +1 -0
  173. package/dist/infinite-scroll/infinite-scroll.d.ts +95 -0
  174. package/dist/input/index.js +181 -22
  175. package/dist/input/index.js.map +1 -1
  176. package/dist/input/input.d.ts +44 -1
  177. package/dist/layer-IpFrl5--.js +414 -0
  178. package/dist/layer-IpFrl5--.js.map +1 -0
  179. package/dist/layout-BRSqi4AQ.js +43 -0
  180. package/dist/layout-BRSqi4AQ.js.map +1 -0
  181. package/dist/layout.d.ts +13 -0
  182. package/dist/list/index.d.ts +2 -0
  183. package/dist/list/index.js +2 -0
  184. package/dist/list/list.d.ts +30 -0
  185. package/dist/list-6-iz-Irh.js +28 -0
  186. package/dist/list-6-iz-Irh.js.map +1 -0
  187. package/dist/loading/index.js +45 -2
  188. package/dist/loading/index.js.map +1 -1
  189. package/dist/loading/loading.d.ts +45 -2
  190. package/dist/modal-dialog-machine-CF9_z3Dm.js +487 -0
  191. package/dist/modal-dialog-machine-CF9_z3Dm.js.map +1 -0
  192. package/dist/modal-dialog-machine.d.ts +21 -0
  193. package/dist/modal-dismissable-lifetime.d.ts +21 -0
  194. package/dist/modal-registry.d.ts +24 -0
  195. package/dist/modal-render-hydration.d.ts +35 -0
  196. package/dist/modal-render-runtime.d.ts +19 -0
  197. package/dist/modal-render-scope.d.ts +63 -0
  198. package/dist/nav-bar/index.d.ts +1 -0
  199. package/dist/nav-bar/index.js +115 -0
  200. package/dist/nav-bar/index.js.map +1 -0
  201. package/dist/nav-bar/nav-bar.d.ts +76 -0
  202. package/dist/notice-bar/index.d.ts +2 -0
  203. package/dist/notice-bar/index.js +2 -0
  204. package/dist/notice-bar/notice-bar.d.ts +103 -0
  205. package/dist/notice-bar-DMpwLvRb.js +231 -0
  206. package/dist/notice-bar-DMpwLvRb.js.map +1 -0
  207. package/dist/notify/index.d.ts +1 -0
  208. package/dist/notify/index.js +251 -0
  209. package/dist/notify/index.js.map +1 -0
  210. package/dist/notify/notify.d.ts +123 -0
  211. package/dist/number-keyboard/index.d.ts +1 -0
  212. package/dist/number-keyboard/index.js +333 -0
  213. package/dist/number-keyboard/index.js.map +1 -0
  214. package/dist/number-keyboard/number-keyboard.d.ts +141 -0
  215. package/dist/overlay-panel/index.d.ts +2 -0
  216. package/dist/overlay-panel/index.js +2 -0
  217. package/dist/overlay-panel/overlay-panel.d.ts +20 -0
  218. package/dist/overlay-panel-Z_qdKeBj.js +26 -0
  219. package/dist/overlay-panel-Z_qdKeBj.js.map +1 -0
  220. package/dist/page-indicator/index.d.ts +1 -0
  221. package/dist/page-indicator/index.js +138 -0
  222. package/dist/page-indicator/index.js.map +1 -0
  223. package/dist/page-indicator/page-indicator.d.ts +93 -0
  224. package/dist/pagination/index.d.ts +1 -0
  225. package/dist/pagination/index.js +198 -0
  226. package/dist/pagination/index.js.map +1 -0
  227. package/dist/pagination/pagination.d.ts +125 -0
  228. package/dist/password-input/index.d.ts +1 -0
  229. package/dist/password-input/index.js +317 -0
  230. package/dist/password-input/index.js.map +1 -0
  231. package/dist/password-input/password-input.d.ts +144 -0
  232. package/dist/picker/index.d.ts +8 -0
  233. package/dist/picker/index.js +2 -0
  234. package/dist/picker/picker-machine.d.ts +80 -0
  235. package/dist/picker/picker.d.ts +121 -0
  236. package/dist/picker/platform.d.ts +84 -0
  237. package/dist/picker/selection-connect.d.ts +90 -0
  238. package/dist/picker/selection-model.d.ts +211 -0
  239. package/dist/picker-BykFntQN.js +1675 -0
  240. package/dist/picker-BykFntQN.js.map +1 -0
  241. package/dist/popover/index.d.ts +3 -0
  242. package/dist/popover/index.js +253 -0
  243. package/dist/popover/index.js.map +1 -0
  244. package/dist/popover/layer.d.ts +44 -0
  245. package/dist/popover/popover.d.ts +104 -0
  246. package/dist/popover/positioning.d.ts +132 -0
  247. package/dist/popup/index.d.ts +2 -0
  248. package/dist/popup/index.js +2 -0
  249. package/dist/popup/popup.d.ts +60 -0
  250. package/dist/popup-z5d8IYCt.js +576 -0
  251. package/dist/popup-z5d8IYCt.js.map +1 -0
  252. package/dist/portal-BHCNTWhg.js +78 -0
  253. package/dist/portal-BHCNTWhg.js.map +1 -0
  254. package/dist/portal.d.ts +61 -0
  255. package/dist/price/format.d.ts +19 -0
  256. package/dist/price/index.d.ts +1 -0
  257. package/dist/price/index.js +154 -0
  258. package/dist/price/index.js.map +1 -0
  259. package/dist/price/price.d.ts +88 -0
  260. package/dist/progress/index.d.ts +1 -0
  261. package/dist/progress/index.js +2 -0
  262. package/dist/progress/progress.d.ts +32 -0
  263. package/dist/progress-f3iYEfdA.js +37 -0
  264. package/dist/progress-f3iYEfdA.js.map +1 -0
  265. package/dist/pull-refresh/index.d.ts +1 -0
  266. package/dist/pull-refresh/index.js +414 -0
  267. package/dist/pull-refresh/index.js.map +1 -0
  268. package/dist/pull-refresh/pull-refresh.d.ts +118 -0
  269. package/dist/radio-group/index.d.ts +3 -0
  270. package/dist/radio-group/index.js +2 -0
  271. package/dist/radio-group/radio-group.d.ts +78 -0
  272. package/dist/radio-group-BOIMuqnS.js +230 -0
  273. package/dist/radio-group-BOIMuqnS.js.map +1 -0
  274. package/dist/rate/index.d.ts +1 -0
  275. package/dist/rate/index.js +2 -0
  276. package/dist/rate/rate-form.d.ts +28 -0
  277. package/dist/rate/rate.d.ts +144 -0
  278. package/dist/rate-5XsU2QkY.js +631 -0
  279. package/dist/rate-5XsU2QkY.js.map +1 -0
  280. package/dist/reorder/index.d.ts +1 -0
  281. package/dist/reorder/index.js +720 -0
  282. package/dist/reorder/index.js.map +1 -0
  283. package/dist/reorder/reorder.d.ts +190 -0
  284. package/dist/result/index.d.ts +1 -0
  285. package/dist/result/index.js +123 -0
  286. package/dist/result/index.js.map +1 -0
  287. package/dist/result/result.d.ts +88 -0
  288. package/dist/safe-area/index.d.ts +1 -0
  289. package/dist/safe-area/index.js +42 -0
  290. package/dist/safe-area/index.js.map +1 -0
  291. package/dist/safe-area/safe-area.d.ts +28 -0
  292. package/dist/search-bar/index.js +4 -2
  293. package/dist/search-bar/index.js.map +1 -1
  294. package/dist/search-bar/search-bar.d.ts +6 -0
  295. package/dist/segmented/index.d.ts +2 -0
  296. package/dist/segmented/index.js +2 -0
  297. package/dist/segmented/segmented.d.ts +127 -0
  298. package/dist/segmented-BaU38_L4.js +367 -0
  299. package/dist/segmented-BaU38_L4.js.map +1 -0
  300. package/dist/selection-form-BOM_odUk.js +88 -0
  301. package/dist/selection-form-BOM_odUk.js.map +1 -0
  302. package/dist/selection-form.d.ts +27 -0
  303. package/dist/selection-ivXqO1eu.js +55 -0
  304. package/dist/selection-ivXqO1eu.js.map +1 -0
  305. package/dist/selection.d.ts +29 -0
  306. package/dist/selector/choice-group.d.ts +114 -0
  307. package/dist/selector/index.d.ts +2 -0
  308. package/dist/selector/index.js +2 -0
  309. package/dist/selector/selector.d.ts +90 -0
  310. package/dist/selector-BU2MMJ4N.js +93 -0
  311. package/dist/selector-BU2MMJ4N.js.map +1 -0
  312. package/dist/share-sheet/index.d.ts +1 -0
  313. package/dist/share-sheet/index.js +138 -0
  314. package/dist/share-sheet/index.js.map +1 -0
  315. package/dist/share-sheet/share-sheet.d.ts +139 -0
  316. package/dist/side-nav/index.d.ts +1 -0
  317. package/dist/side-nav/index.js +99 -0
  318. package/dist/side-nav/index.js.map +1 -0
  319. package/dist/side-nav/side-nav.d.ts +94 -0
  320. package/dist/skeleton/index.js +51 -2
  321. package/dist/skeleton/index.js.map +1 -1
  322. package/dist/skeleton/skeleton.d.ts +34 -3
  323. package/dist/slider/index.d.ts +1 -0
  324. package/dist/slider/index.js +482 -0
  325. package/dist/slider/index.js.map +1 -0
  326. package/dist/slider/slider.d.ts +174 -0
  327. package/dist/space/index.d.ts +1 -0
  328. package/dist/space/index.js +52 -0
  329. package/dist/space/index.js.map +1 -0
  330. package/dist/space/space.d.ts +46 -0
  331. package/dist/statistic/index.d.ts +1 -0
  332. package/dist/statistic/index.js +152 -0
  333. package/dist/statistic/index.js.map +1 -0
  334. package/dist/statistic/statistic.d.ts +101 -0
  335. package/dist/stepper/index.d.ts +1 -0
  336. package/dist/stepper/index.js +172 -0
  337. package/dist/stepper/index.js.map +1 -0
  338. package/dist/stepper/stepper.d.ts +161 -0
  339. package/dist/steps/index.d.ts +1 -0
  340. package/dist/steps/index.js +72 -0
  341. package/dist/steps/index.js.map +1 -0
  342. package/dist/steps/steps.d.ts +67 -0
  343. package/dist/sticky/index.d.ts +1 -0
  344. package/dist/sticky/index.js +145 -0
  345. package/dist/sticky/index.js.map +1 -0
  346. package/dist/sticky/sticky.d.ts +70 -0
  347. package/dist/swipe-action/index.d.ts +1 -0
  348. package/dist/swipe-action/index.js +417 -0
  349. package/dist/swipe-action/index.js.map +1 -0
  350. package/dist/swipe-action/swipe-action.d.ts +148 -0
  351. package/dist/swiper/gesture.d.ts +32 -0
  352. package/dist/swiper/index.d.ts +1 -0
  353. package/dist/swiper/index.js +2 -0
  354. package/dist/swiper/swiper.d.ts +177 -0
  355. package/dist/swiper-BKivDkHp.js +550 -0
  356. package/dist/swiper-BKivDkHp.js.map +1 -0
  357. package/dist/switch/index.d.ts +1 -0
  358. package/dist/switch/index.js +168 -0
  359. package/dist/switch/index.js.map +1 -0
  360. package/dist/switch/switch.d.ts +142 -0
  361. package/dist/tabbar/index.d.ts +1 -0
  362. package/dist/tabbar/index.js +95 -0
  363. package/dist/tabbar/index.js.map +1 -0
  364. package/dist/tabbar/tabbar.d.ts +119 -0
  365. package/dist/tabs/index.js +22 -1
  366. package/dist/tabs/index.js.map +1 -1
  367. package/dist/tabs/tabs.d.ts +12 -8
  368. package/dist/tag/index.js +123 -2
  369. package/dist/tag/index.js.map +1 -1
  370. package/dist/tag/tag.d.ts +67 -1
  371. package/dist/textarea/index.d.ts +2 -0
  372. package/dist/textarea/index.js +2 -242
  373. package/dist/textarea/platform.d.ts +22 -0
  374. package/dist/textarea/textarea.d.ts +169 -46
  375. package/dist/textarea-qbnruDUG.js +775 -0
  376. package/dist/textarea-qbnruDUG.js.map +1 -0
  377. package/dist/time-picker/index.d.ts +1 -0
  378. package/dist/time-picker/index.js +228 -0
  379. package/dist/time-picker/index.js.map +1 -0
  380. package/dist/time-picker/time-picker.d.ts +83 -0
  381. package/dist/timeline/index.d.ts +1 -0
  382. package/dist/timeline/index.js +131 -0
  383. package/dist/timeline/index.js.map +1 -0
  384. package/dist/timeline/timeline.d.ts +79 -0
  385. package/dist/toast/index.js +47 -4
  386. package/dist/toast/index.js.map +1 -1
  387. package/dist/toast/toast.d.ts +26 -3
  388. package/dist/top-bar/index.js +16 -2
  389. package/dist/top-bar/index.js.map +1 -1
  390. package/dist/top-bar/top-bar.d.ts +13 -2
  391. package/dist/tree-select/index.d.ts +1 -0
  392. package/dist/tree-select/index.js +512 -0
  393. package/dist/tree-select/index.js.map +1 -0
  394. package/dist/tree-select/tree-select.d.ts +215 -0
  395. package/dist/typography/index.d.ts +1 -0
  396. package/dist/typography/index.js +82 -0
  397. package/dist/typography/index.js.map +1 -0
  398. package/dist/typography/typography.d.ts +54 -0
  399. package/dist/upload/index.d.ts +1 -0
  400. package/dist/upload/index.js +458 -0
  401. package/dist/upload/index.js.map +1 -0
  402. package/dist/upload/upload.d.ts +172 -0
  403. package/dist/virtual-list/index.d.ts +1 -0
  404. package/dist/virtual-list/index.js +445 -0
  405. package/dist/virtual-list/index.js.map +1 -0
  406. package/dist/virtual-list/virtual-list.d.ts +160 -0
  407. package/dist/visual-manifest.d.ts +27 -0
  408. package/dist/watermark/index.d.ts +1 -0
  409. package/dist/watermark/index.js +260 -0
  410. package/dist/watermark/index.js.map +1 -0
  411. package/dist/watermark/watermark.d.ts +106 -0
  412. package/package.json +417 -44
  413. package/dist/empty/index.js.map +0 -1
  414. package/dist/icon/index.js.map +0 -1
  415. package/dist/textarea/index.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"choice-group-C4c9m0qe.js","names":[],"sources":["../src/selector/choice-group.ts"],"sourcesContent":["/**\n * Private choice-group kernel shared by Selector and CheckList.\n * Value/limit rules come from `selection.ts`; native input sync, reset and\n * fieldset tracking come from `selection-form.ts`. Not exported from any root.\n */\nimport { mergeDescriptionIds } from \"../aria-description.js\";\nimport { createMachine, type Machine, type Params, type Service } from \"@zag-js/core\";\nimport { dataAttr, getComputedStyle, getEventKey, visuallyHiddenStyle } from \"@zag-js/dom-query\";\nimport type { NormalizeProps, PropTypes } from \"@zag-js/types\";\nimport { normalizeSelectionItems, normalizeSelectionValue, selectionItemKey, toggleSelectionValue, type QwSelectionItem } from \"../selection.js\";\nimport { syncSelectionInputs, trackSelectionForm } from \"../selection-form.js\";\nimport { resolveIconState, type IconState } from \"../icon/index.js\";\n\nexport interface ChoiceGroupItem extends QwSelectionItem {\n /** Item-level read-only: focusable and submitted, but cannot change. */\n readOnly?: boolean;\n /** Supporting trailing text, read after the description. */\n extra?: string;\n}\nexport interface ChoiceGroupValueChangeDetails<I extends ChoiceGroupItem = ChoiceGroupItem> {\n /** Requested ordered values (independent copy). */\n value: string[];\n /** Known items for the requested values, in value order (copies). */\n items: I[];\n}\nexport interface ChoiceGroupProps {\n id?: string;\n label: string;\n hideLabel?: boolean;\n description?: string;\n describedBy?: string;\n items: ChoiceGroupItem[];\n multiple?: boolean;\n value?: string[];\n defaultValue?: string[];\n required?: boolean;\n min?: number;\n max?: number;\n disabled?: boolean;\n readOnly?: boolean;\n invalid?: boolean;\n name?: string;\n form?: string;\n dir?: string;\n loop?: boolean;\n onValueChange?: (details: ChoiceGroupValueChangeDetails) => void;\n}\nexport interface ChoiceGroupSchema {\n props: ChoiceGroupProps & { multiple: boolean; defaultValue: string[]; loop: boolean } & Record<string, unknown>;\n context: { value: string[]; focusedValue: string | null; disabledIds: string[] };\n state: \"ready\";\n action: \"setValue\" | \"toggleValue\" | \"selectValue\" | \"setFocus\" | \"syncInputs\" | \"normalizeMode\";\n effect: \"trackForm\";\n event: { type: \"VALUE.SET\"; value: string[] } | { type: \"VALUE.TOGGLE\" | \"VALUE.SELECT\" | \"FOCUS\"; value: string };\n}\nexport type ChoiceGroupMachine = Machine<ChoiceGroupSchema>;\nexport type ChoiceGroupService = Service<ChoiceGroupSchema>;\nexport interface ChoiceGroupItemState { selected: boolean; disabled: boolean; readOnly: boolean }\n\nexport function normalizeChoiceItems<I extends ChoiceGroupItem>(items: readonly I[], family: string): I[] {\n return normalizeSelectionItems(items).map((entry) => {\n const item = entry as I;\n if (typeof item.label !== \"string\" || !item.label.trim()) throw new TypeError(`${family} item labels must be nonempty accessible text`);\n if (item.extra !== undefined && typeof item.extra !== \"string\") throw new TypeError(`${family} item extra must be text`);\n return { ...item };\n });\n}\nexport function normalizeChoiceValue(value: readonly string[] = [], multiple = false): string[] {\n const values = normalizeSelectionValue(value);\n return multiple ? values : values.slice(0, 1);\n}\nexport function createChoiceGroupProps(props: ChoiceGroupProps, family: string): ChoiceGroupSchema[\"props\"] {\n if (typeof props.label !== \"string\" || !props.label.trim()) throw new TypeError(`${family} requires a nonempty accessible group label`);\n if (props.id !== undefined && (typeof props.id !== \"string\" || !props.id.trim())) throw new TypeError(`${family} requires a nonempty instance id when provided`);\n const multiple = !!props.multiple;\n return { ...props, multiple, items: normalizeChoiceItems(props.items ?? [], family),\n value: props.value === undefined ? undefined : normalizeChoiceValue(props.value, multiple),\n defaultValue: normalizeChoiceValue(props.defaultValue, multiple), loop: props.loop ?? true };\n}\n\nconst same = (a: string[], b: string[] | undefined) => !!b && a.length === b.length && a.every((value, index) => value === b[index]);\ntype GroupParams = Pick<Params<ChoiceGroupSchema>, \"scope\" | \"context\" | \"prop\">;\n\n/** One machine per family; `family` is the data-scope and id prefix. */\nexport function createChoiceGroupMachine(family: string): ChoiceGroupMachine {\n const ids = choiceIds(family);\n const current = (params: GroupParams) => normalizeChoiceValue(params.context.get(\"value\"), params.prop(\"multiple\"));\n const isDisabled = (params: GroupParams, item: ChoiceGroupItem) => !!params.prop(\"disabled\") || !!item.disabled || params.context.get(\"disabledIds\").includes(ids.input(params.scope, item.value));\n const sync = (params: GroupParams) => {\n const values = current(params);\n syncSelectionInputs(params.scope, params.prop(\"items\").map((item) => ({ id: ids.input(params.scope, item.value), checked: values.includes(item.value) })));\n };\n const change = (params: GroupParams, value: string, selectOnly: boolean) => choiceChange(params, value, selectOnly, isDisabled, current);\n return createMachine<ChoiceGroupSchema>({\n props: ({ props }) => createChoiceGroupProps({ ...props, label: props.label ?? \"\", items: props.items ?? [] } as ChoiceGroupProps, family),\n initialState: () => \"ready\",\n context({ prop, bindable }) {\n return {\n value: bindable(() => ({ defaultValue: prop(\"defaultValue\"), value: prop(\"value\"), isEqual: same,\n onChange: (value) => prop(\"onValueChange\")?.({ value: [...value], items: value.flatMap((entry) => prop(\"items\").filter((item) => item.value === entry).map((item) => ({ ...item }))) }) })),\n focusedValue: bindable(() => ({ defaultValue: null as string | null })),\n disabledIds: bindable(() => ({ defaultValue: [] as string[], isEqual: same })),\n };\n },\n watch({ track, context, prop, action }) {\n track([() => context.hash(\"value\"), () => context.hash(\"disabledIds\")], () => action([\"syncInputs\"]));\n track([() => prop(\"multiple\")], () => action([\"normalizeMode\"]));\n },\n effects: [\"trackForm\"],\n on: { \"VALUE.SET\": { actions: [\"setValue\"] }, \"VALUE.TOGGLE\": { actions: [\"toggleValue\"] }, \"VALUE.SELECT\": { actions: [\"selectValue\"] }, FOCUS: { actions: [\"setFocus\"] } },\n states: { ready: {} },\n implementations: {\n effects: { trackForm(params) {\n return trackSelectionForm({ scope: params.scope, rootId: ids.root(params.scope), form: () => params.prop(\"form\"),\n getState: () => params.prop(\"items\").map((item) => ({ id: ids.input(params.scope, item.value), checked: current(params).includes(item.value) })),\n onReset: () => params.context.set(\"value\", normalizeChoiceValue(params.prop(\"defaultValue\"), params.prop(\"multiple\"))),\n onDisabledChange: (list) => params.context.set(\"disabledIds\", [...list]),\n }).stop;\n } },\n actions: {\n syncInputs: sync,\n normalizeMode(params) { params.context.set(\"value\", current(params)); queueMicrotask(() => sync(params)); },\n setValue(params) { if (params.event.type === \"VALUE.SET\") params.context.set(\"value\", normalizeChoiceValue(params.event.value, params.prop(\"multiple\"))); queueMicrotask(() => sync(params)); },\n toggleValue(params) { if (params.event.type === \"VALUE.TOGGLE\") { const next = change(params, params.event.value, false); if (next) params.context.set(\"value\", next); } queueMicrotask(() => sync(params)); },\n selectValue(params) { if (params.event.type === \"VALUE.SELECT\") { const next = change(params, params.event.value, true); if (next) params.context.set(\"value\", next); } queueMicrotask(() => sync(params)); },\n setFocus(params) { if (params.event.type === \"FOCUS\") params.context.set(\"focusedValue\", params.event.value); },\n },\n },\n });\n}\n\nfunction choiceIds(family: string) {\n const root = (scope: ChoiceGroupService[\"scope\"]) => `${family}:${scope.id}`;\n return { root, input: (scope: ChoiceGroupService[\"scope\"], value: string) => `${root(scope)}:input:${selectionItemKey(value)}` };\n}\nfunction choiceChange(params: GroupParams, value: string, selectOnly: boolean, isDisabled: (params: GroupParams, item: ChoiceGroupItem) => boolean, current: (params: GroupParams) => string[]): string[] | null {\n const item = params.prop(\"items\").find((entry) => entry.value === value);\n if (!item || isDisabled(params, item) || params.prop(\"readOnly\") || item.readOnly) return null;\n const values = current(params);\n if (!params.prop(\"multiple\")) {\n if (!values.includes(value)) return [value];\n return selectOnly || params.prop(\"required\") ? null : [];\n }\n const result = toggleSelectionValue(values, item, { min: params.prop(\"min\"), max: params.prop(\"max\") });\n return result.blocked ? null : result.value;\n}\n\nexport interface ChoiceGroupApi<T extends PropTypes = PropTypes> {\n value: string[];\n items: ChoiceGroupItem[];\n label: string;\n description: string;\n setValue(value: string[]): void;\n toggleValue(value: string): void;\n clearValue(): void;\n getRootProps(extra?: Record<string, unknown>): T[\"element\"];\n getLabelProps(): T[\"element\"];\n getDescriptionProps(): T[\"element\"];\n getGroupProps(part: string): T[\"element\"];\n getItemState(item: { value: string }): ChoiceGroupItemState;\n getItemProps(item: { value: string }, part: string): T[\"label\"];\n getInputProps(item: { value: string }): T[\"input\"];\n getItemPartProps(item: { value: string }, part: string): T[\"element\"];\n getTextProps(item: { value: string }, part: string): T[\"element\"];\n getItemDescriptionProps(item: { value: string }, part: string): T[\"element\"];\n getExtraProps(item: { value: string }, part: string): T[\"element\"];\n getCheckProps(item: { value: string }, part: string): T[\"element\"];\n getCheckIconState(item: { value: string }): IconState;\n}\n\n/** SSR-pure getters; client handlers use the Zag DOM scope only inside events. */\nexport function connectChoiceGroup<T extends PropTypes>(family: string, service: ChoiceGroupService, normalize: NormalizeProps<T>): ChoiceGroupApi<T> {\n const ids = choiceIds(family);\n const id = ids.root(service.scope), multiple = service.prop(\"multiple\"), items = service.prop(\"items\");\n const values = normalizeChoiceValue(service.context.get(\"value\"), multiple);\n const isDisabled = (item: ChoiceGroupItem) => !!service.prop(\"disabled\") || !!item.disabled || service.context.get(\"disabledIds\").includes(ids.input(service.scope, item.value));\n const readOnly = (item: ChoiceGroupItem) => !!service.prop(\"readOnly\") || !!item.readOnly;\n const current = (params: GroupParams) => normalizeChoiceValue(params.context.get(\"value\"), params.prop(\"multiple\"));\n const sync = () => { const now = current(service); syncSelectionInputs(service.scope, service.prop(\"items\").map((item) => ({ id: ids.input(service.scope, item.value), checked: now.includes(item.value) }))); };\n const enabled = items.filter((item) => !isDisabled(item));\n const focused = service.context.get(\"focusedValue\");\n const tabAnchor = enabled.find((item) => item.value === focused) ?? enabled.find((item) => values.includes(item.value)) ?? enabled[0];\n const requiredAnchor = service.prop(\"required\") && !enabled.some((item) => values.includes(item.value)) ? enabled[0]?.value : undefined;\n const resolve = ({ value }: { value: string }) => { const item = items.find((entry) => entry.value === value); if (!item) throw new RangeError(`${family} item is not present in items`); return item; };\n const key = (item: ChoiceGroupItem) => selectionItemKey(item.value);\n const part = (name: string) => ({ \"data-scope\": family, \"data-part\": name });\n const data = (item: ChoiceGroupItem) => ({ \"data-state\": values.includes(item.value) ? \"checked\" : \"unchecked\", \"data-disabled\": dataAttr(isDisabled(item)), \"data-readonly\": dataAttr(readOnly(item)), \"data-invalid\": dataAttr(service.prop(\"invalid\")) });\n const describedBy = (item: ChoiceGroupItem) => mergeDescriptionIds(item.description ? `${id}:description:${key(item)}` : undefined, item.extra ? `${id}:extra:${key(item)}` : undefined);\n return {\n value: [...values], items: items.map((item) => ({ ...item })), label: service.prop(\"label\"), description: service.prop(\"description\") ?? \"\",\n setValue: (value) => service.send({ type: \"VALUE.SET\", value: normalizeChoiceValue(value, multiple) }),\n toggleValue: (value) => service.send({ type: \"VALUE.TOGGLE\", value }),\n clearValue: () => service.send({ type: \"VALUE.SET\", value: [] }),\n getRootProps: (extra = {}) => normalize.element({ ...part(\"root\"), ...extra, id, role: multiple ? \"group\" : \"radiogroup\", disabled: !!service.prop(\"disabled\"), form: service.prop(\"form\"), dir: service.prop(\"dir\"),\n \"aria-labelledby\": `${id}:label`, \"aria-describedby\": mergeDescriptionIds(service.prop(\"description\") ? `${id}:description` : undefined, service.prop(\"describedBy\")),\n \"aria-required\": !multiple && service.prop(\"required\") || undefined, \"aria-readonly\": !multiple && service.prop(\"readOnly\") || undefined,\n \"aria-disabled\": service.prop(\"disabled\") || (items.length > 0 && !enabled.length) || undefined, \"aria-invalid\": service.prop(\"invalid\") || undefined,\n \"data-selection-mode\": multiple ? \"multiple\" : \"single\", \"data-disabled\": dataAttr(service.prop(\"disabled\")), \"data-readonly\": dataAttr(service.prop(\"readOnly\")), \"data-invalid\": dataAttr(service.prop(\"invalid\")) }),\n getLabelProps: () => normalize.element({ ...part(\"label\"), id: `${id}:label`, style: service.prop(\"hideLabel\") ? visuallyHiddenStyle : undefined }),\n getDescriptionProps: () => normalize.element({ ...part(\"description\"), id: `${id}:description`, hidden: !service.prop(\"description\") }),\n getGroupProps: (name) => normalize.element(part(name)),\n getItemState: (props) => { const item = resolve(props); return { selected: values.includes(item.value), disabled: isDisabled(item), readOnly: readOnly(item) }; },\n getItemProps: (props, name) => { const item = resolve(props); return normalize.label({ ...part(name), ...data(item), htmlFor: ids.input(service.scope, item.value) }); },\n getInputProps(props) {\n const item = resolve(props), disabled = isDisabled(item), selected = values.includes(item.value);\n return normalize.input({ ...part(\"input\"), ...data(item), id: ids.input(service.scope, item.value), type: multiple ? \"checkbox\" : \"radio\", value: item.value,\n checked: selected, disabled: !!service.prop(\"disabled\") || !!item.disabled, readOnly: readOnly(item),\n name: disabled ? undefined : service.prop(\"name\") || (multiple ? undefined : service.scope.id), form: service.prop(\"form\"),\n required: multiple ? requiredAnchor === item.value : !!service.prop(\"required\") && !disabled, tabIndex: multiple ? 0 : (tabAnchor?.value === item.value ? 0 : -1),\n \"aria-checked\": selected, \"aria-readonly\": multiple && readOnly(item) || undefined, \"aria-invalid\": service.prop(\"invalid\") || undefined,\n \"aria-labelledby\": `${id}:text:${key(item)}`, \"aria-describedby\": describedBy(item),\n style: visuallyHiddenStyle, onChange() {},\n onFocus() { service.send({ type: \"FOCUS\", value: item.value }); },\n onClick(event) {\n if (event.defaultPrevented) return;\n if (!choiceChange(service, item.value, false, (_, entry) => isDisabled(entry), current)) event.preventDefault();\n service.send({ type: \"VALUE.TOGGLE\", value: item.value }); queueMicrotask(sync);\n },\n onKeyDown(event) {\n if (event.defaultPrevented || event.ctrlKey || event.altKey || event.metaKey) return;\n if (event.key === \" \" || event.key === \"Enter\") { event.preventDefault(); if (!event.repeat) service.send({ type: \"VALUE.TOGGLE\", value: item.value }); queueMicrotask(sync); return; }\n if (![\"ArrowLeft\", \"ArrowRight\", \"ArrowUp\", \"ArrowDown\", \"Home\", \"End\"].includes(event.key)) return;\n event.preventDefault();\n const candidates = service.prop(\"items\").filter((entry) => !isDisabled(entry));\n if (!candidates.length || isDisabled(item)) return;\n const direction = service.prop(\"dir\");\n const dir = direction === \"rtl\" || direction === \"ltr\" ? direction : getComputedStyle(event.currentTarget).direction === \"rtl\" ? \"rtl\" : \"ltr\";\n const pressed = getEventKey(event, { dir }), index = candidates.findIndex((entry) => entry.value === item.value);\n let target = pressed === \"Home\" ? 0 : pressed === \"End\" ? candidates.length - 1 : index + (pressed === \"ArrowRight\" || pressed === \"ArrowDown\" ? 1 : -1);\n if (service.prop(\"loop\")) target = (target + candidates.length) % candidates.length;\n const next = candidates[target]; if (!next) return;\n service.scope.getById<HTMLInputElement>(ids.input(service.scope, next.value))?.focus();\n service.send({ type: \"FOCUS\", value: next.value });\n if (!multiple) service.send({ type: \"VALUE.SELECT\", value: next.value });\n },\n });\n },\n getItemPartProps: (props, name) => normalize.element({ ...part(name), ...data(resolve(props)) }),\n getTextProps: (props, name) => normalize.element({ ...part(name), id: `${id}:text:${key(resolve(props))}` }),\n getItemDescriptionProps: (props, name) => { const item = resolve(props); return normalize.element({ ...part(name), id: `${id}:description:${key(item)}`, hidden: !item.description }); },\n getExtraProps: (props, name) => { const item = resolve(props); return normalize.element({ ...part(name), id: `${id}:extra:${key(item)}`, hidden: !item.extra }); },\n getCheckProps: (props, name) => { const item = resolve(props); return normalize.element({ ...part(name), ...data(item), \"aria-hidden\": true, hidden: !values.includes(item.value) }); },\n getCheckIconState: (props) => resolveIconState({ id: `${id}:check:${key(resolve(props))}`, name: \"check\" }),\n };\n}\n"],"mappings":";;;;;;;;;;;;AA2DA,SAAgB,qBAAgD,OAAqB,QAAqB;CACxG,OAAO,wBAAwB,KAAK,CAAC,CAAC,KAAK,UAAU;EACnD,MAAM,OAAO;EACb,IAAI,OAAO,KAAK,UAAU,YAAY,CAAC,KAAK,MAAM,KAAK,GAAG,MAAM,IAAI,UAAU,GAAG,OAAO,8CAA8C;EACtI,IAAI,KAAK,UAAU,KAAA,KAAa,OAAO,KAAK,UAAU,UAAU,MAAM,IAAI,UAAU,GAAG,OAAO,yBAAyB;EACvH,OAAO,EAAE,GAAG,KAAK;CACnB,CAAC;AAC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,KAAK,IAAI;IAAG,IAAI,GAAG,GAAG,eAAe,IAAI,IAAI;IAAK,QAAQ,CAAC,KAAK;GAAY,CAAC;EAAG;EACvL,gBAAgB,OAAO,SAAS;GAAE,MAAM,OAAO,QAAQ,KAAK;GAAG,OAAO,UAAU,QAAQ;IAAE,GAAG,KAAK,IAAI;IAAG,IAAI,GAAG,GAAG,SAAS,IAAI,IAAI;IAAK,QAAQ,CAAC,KAAK;GAAM,CAAC;EAAG;EACjK,gBAAgB,OAAO,SAAS;GAAE,MAAM,OAAO,QAAQ,KAAK;GAAG,OAAO,UAAU,QAAQ;IAAE,GAAG,KAAK,IAAI;IAAG,GAAG,KAAK,IAAI;IAAG,eAAe;IAAM,QAAQ,CAAC,OAAO,SAAS,KAAK,KAAK;GAAE,CAAC;EAAG;EACtL,oBAAoB,UAAU,iBAAiB;GAAE,IAAI,GAAG,GAAG,SAAS,IAAI,QAAQ,KAAK,CAAC;GAAK,MAAM;EAAQ,CAAC;CAC5G;AACF"}
@@ -0,0 +1,97 @@
1
+ import { getProgressRootProps, type ProgressTone, type QwProgressProps } from "../progress/progress.js";
2
+ /** Start angle of the indicator arc. */
3
+ export declare const CIRCLE_START_POSITIONS: readonly ["top", "right", "bottom", "left"];
4
+ export declare const CIRCLE_LINE_CAPS: readonly ["round", "butt"];
5
+ /** Stable DOM parts shared by every adapter. */
6
+ export declare const CIRCLE_PARTS: readonly ["root", "svg", "track", "indicator", "content"];
7
+ /** SVG user-space edge; stroke width is expressed in these units and scales with size. */
8
+ export declare const CIRCLE_VIEWBOX = 100;
9
+ export declare const CIRCLE_DEFAULT_STROKE_WIDTH = 8;
10
+ /** Visible arc fraction while progress is unknown. */
11
+ export declare const CIRCLE_INDETERMINATE_ARC = 0.25;
12
+ export type CircleStartPosition = (typeof CIRCLE_START_POSITIONS)[number];
13
+ export type CircleLineCap = (typeof CIRCLE_LINE_CAPS)[number];
14
+ export type CirclePart = (typeof CIRCLE_PARTS)[number];
15
+ export interface QwCircleProps extends QwProgressProps {
16
+ /** Accessible aria-valuetext, e.g. "3 of 4 tasks". */
17
+ valueText?: string;
18
+ /** Rendered edge length in CSS px; omitted/invalid uses the styles-core default. */
19
+ size?: number;
20
+ /** Ring thickness in viewBox units (1–20, default 8). */
21
+ strokeWidth?: number;
22
+ startPosition?: CircleStartPosition;
23
+ /** Direction of growth; defaults true. Not auto-mirrored in RTL (clock-like graphic). */
24
+ clockwise?: boolean;
25
+ /** Show the default percentage when no custom content is supplied; defaults true. */
26
+ showText?: boolean;
27
+ lineCap?: CircleLineCap;
28
+ }
29
+ export interface ResolvedCircleState {
30
+ label: string;
31
+ value: number;
32
+ max: number;
33
+ percent: number;
34
+ indeterminate: boolean;
35
+ tone: ProgressTone;
36
+ valueText?: string;
37
+ size?: number;
38
+ strokeWidth: number;
39
+ radius: number;
40
+ circumference: number;
41
+ dashArray: string;
42
+ dashOffset: string;
43
+ transform: string;
44
+ startPosition: CircleStartPosition;
45
+ clockwise: boolean;
46
+ lineCap: CircleLineCap;
47
+ /** Default center text, empty when indeterminate or showText is false. */
48
+ percentText: string;
49
+ }
50
+ /** Progress normalization plus ring geometry. Pure and SSR-safe. */
51
+ export declare function resolveCircleState(props: QwCircleProps): ResolvedCircleState;
52
+ export type CircleRootProps = Omit<ReturnType<typeof getProgressRootProps>, "data-scope"> & {
53
+ "data-scope": "circle";
54
+ "aria-valuetext"?: string;
55
+ "data-start-position": CircleStartPosition;
56
+ "data-clockwise"?: "true";
57
+ style?: {
58
+ inlineSize: string;
59
+ blockSize: string;
60
+ };
61
+ };
62
+ /** Same progressbar semantics as Progress, re-scoped for circle styling. */
63
+ export declare function getCircleRootProps(state: ResolvedCircleState): CircleRootProps;
64
+ export interface CircleSvgProps {
65
+ "data-scope": "circle";
66
+ "data-part": "svg";
67
+ viewBox: string;
68
+ "aria-hidden": "true";
69
+ focusable: "false";
70
+ }
71
+ export declare function getCircleSvgProps(): CircleSvgProps;
72
+ export interface CircleRingStyle {
73
+ strokeWidth: string;
74
+ strokeDasharray?: string;
75
+ strokeDashoffset?: string;
76
+ strokeLinecap?: CircleLineCap;
77
+ transform?: string;
78
+ transformOrigin?: string;
79
+ transformBox?: "fill-box";
80
+ }
81
+ export interface CircleRingProps {
82
+ "data-scope": "circle";
83
+ "data-part": "track" | "indicator";
84
+ cx: string;
85
+ cy: string;
86
+ r: string;
87
+ fill: "none";
88
+ /** Stroke geometry travels as camelCase inline style so React, Vue and WC need no attribute renaming. */
89
+ style: CircleRingStyle;
90
+ }
91
+ export declare function getCircleTrackProps(state: ResolvedCircleState): CircleRingProps;
92
+ export declare function getCircleIndicatorProps(state: ResolvedCircleState): CircleRingProps;
93
+ export interface CircleContentProps {
94
+ "data-scope": "circle";
95
+ "data-part": "content";
96
+ }
97
+ export declare function getCircleContentProps(): CircleContentProps;
@@ -0,0 +1 @@
1
+ export * from "./circle.js";
@@ -0,0 +1,119 @@
1
+ import { n as getProgressRootProps, r as resolveProgressState } from "../progress-f3iYEfdA.js";
2
+ //#region src/circle/circle.ts
3
+ /** Start angle of the indicator arc. */
4
+ const CIRCLE_START_POSITIONS = [
5
+ "top",
6
+ "right",
7
+ "bottom",
8
+ "left"
9
+ ];
10
+ const CIRCLE_LINE_CAPS = ["round", "butt"];
11
+ /** Stable DOM parts shared by every adapter. */
12
+ const CIRCLE_PARTS = [
13
+ "root",
14
+ "svg",
15
+ "track",
16
+ "indicator",
17
+ "content"
18
+ ];
19
+ /** SVG user-space edge; stroke width is expressed in these units and scales with size. */
20
+ const CIRCLE_VIEWBOX = 100;
21
+ const CIRCLE_DEFAULT_STROKE_WIDTH = 8;
22
+ /** Visible arc fraction while progress is unknown. */
23
+ const CIRCLE_INDETERMINATE_ARC = .25;
24
+ const ROTATION = {
25
+ top: -90,
26
+ right: 0,
27
+ bottom: 90,
28
+ left: 180
29
+ };
30
+ const pick = (list, value, fallback) => list.includes(value) ? value : fallback;
31
+ /** Fixed decimals keep SSR and client attribute strings identical. */
32
+ const fixed = (value) => String(Math.round(value * 1e3) / 1e3);
33
+ /** Progress normalization plus ring geometry. Pure and SSR-safe. */
34
+ function resolveCircleState(props) {
35
+ const progress = resolveProgressState(props);
36
+ const strokeWidth = typeof props.strokeWidth === "number" && Number.isFinite(props.strokeWidth) ? Math.min(20, Math.max(1, props.strokeWidth)) : 8;
37
+ const radius = (100 - strokeWidth) / 2;
38
+ const circumference = 2 * Math.PI * radius;
39
+ const shown = progress.indeterminate ? CIRCLE_INDETERMINATE_ARC : progress.percent / 100;
40
+ const startPosition = pick(CIRCLE_START_POSITIONS, props.startPosition, "top");
41
+ const clockwise = props.clockwise ?? true;
42
+ const transform = `rotate(${ROTATION[startPosition]}deg)${clockwise ? "" : " scaleY(-1)"}`;
43
+ const size = typeof props.size === "number" && Number.isFinite(props.size) && props.size > 0 ? props.size : void 0;
44
+ return {
45
+ ...progress,
46
+ valueText: props.valueText?.trim() || void 0,
47
+ size,
48
+ strokeWidth,
49
+ radius,
50
+ circumference,
51
+ dashArray: fixed(circumference),
52
+ dashOffset: fixed(circumference * (1 - shown)),
53
+ transform,
54
+ startPosition,
55
+ clockwise,
56
+ lineCap: pick(CIRCLE_LINE_CAPS, props.lineCap, "round"),
57
+ percentText: progress.indeterminate || props.showText === false ? "" : `${Math.round(progress.percent)}%`
58
+ };
59
+ }
60
+ /** Same progressbar semantics as Progress, re-scoped for circle styling. */
61
+ function getCircleRootProps(state) {
62
+ return {
63
+ ...getProgressRootProps(state),
64
+ "data-scope": "circle",
65
+ ...state.valueText && !state.indeterminate ? { "aria-valuetext": state.valueText } : {},
66
+ "data-start-position": state.startPosition,
67
+ ...state.clockwise ? { "data-clockwise": "true" } : {},
68
+ ...state.size ? { style: {
69
+ inlineSize: `${state.size}px`,
70
+ blockSize: `${state.size}px`
71
+ } } : {}
72
+ };
73
+ }
74
+ function getCircleSvgProps() {
75
+ return {
76
+ "data-scope": "circle",
77
+ "data-part": "svg",
78
+ viewBox: `0 0 100 100`,
79
+ "aria-hidden": "true",
80
+ focusable: "false"
81
+ };
82
+ }
83
+ function getCircleTrackProps(state) {
84
+ const c = String(100 / 2);
85
+ return {
86
+ "data-scope": "circle",
87
+ "data-part": "track",
88
+ cx: c,
89
+ cy: c,
90
+ r: fixed(state.radius),
91
+ fill: "none",
92
+ style: { strokeWidth: String(state.strokeWidth) }
93
+ };
94
+ }
95
+ function getCircleIndicatorProps(state) {
96
+ return {
97
+ ...getCircleTrackProps(state),
98
+ "data-part": "indicator",
99
+ style: {
100
+ strokeWidth: String(state.strokeWidth),
101
+ strokeDasharray: state.dashArray,
102
+ strokeDashoffset: state.dashOffset,
103
+ strokeLinecap: state.lineCap,
104
+ transform: state.transform,
105
+ transformOrigin: "50% 50%",
106
+ transformBox: "fill-box"
107
+ }
108
+ };
109
+ }
110
+ function getCircleContentProps() {
111
+ return {
112
+ "data-scope": "circle",
113
+ "data-part": "content"
114
+ };
115
+ }
116
+ //#endregion
117
+ export { CIRCLE_DEFAULT_STROKE_WIDTH, CIRCLE_INDETERMINATE_ARC, CIRCLE_LINE_CAPS, CIRCLE_PARTS, CIRCLE_START_POSITIONS, CIRCLE_VIEWBOX, getCircleContentProps, getCircleIndicatorProps, getCircleRootProps, getCircleSvgProps, getCircleTrackProps, resolveCircleState };
118
+
119
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/circle/circle.ts"],"sourcesContent":["import { getProgressRootProps, resolveProgressState, type ProgressTone, type QwProgressProps } from \"../progress/progress.js\";\n\n/** Start angle of the indicator arc. */\nexport const CIRCLE_START_POSITIONS = [\"top\", \"right\", \"bottom\", \"left\"] as const;\nexport const CIRCLE_LINE_CAPS = [\"round\", \"butt\"] as const;\n/** Stable DOM parts shared by every adapter. */\nexport const CIRCLE_PARTS = [\"root\", \"svg\", \"track\", \"indicator\", \"content\"] as const;\n/** SVG user-space edge; stroke width is expressed in these units and scales with size. */\nexport const CIRCLE_VIEWBOX = 100;\nexport const CIRCLE_DEFAULT_STROKE_WIDTH = 8;\n/** Visible arc fraction while progress is unknown. */\nexport const CIRCLE_INDETERMINATE_ARC = 0.25;\n\nexport type CircleStartPosition = (typeof CIRCLE_START_POSITIONS)[number];\nexport type CircleLineCap = (typeof CIRCLE_LINE_CAPS)[number];\nexport type CirclePart = (typeof CIRCLE_PARTS)[number];\n\nexport interface QwCircleProps extends QwProgressProps {\n /** Accessible aria-valuetext, e.g. \"3 of 4 tasks\". */\n valueText?: string;\n /** Rendered edge length in CSS px; omitted/invalid uses the styles-core default. */\n size?: number;\n /** Ring thickness in viewBox units (1–20, default 8). */\n strokeWidth?: number;\n startPosition?: CircleStartPosition;\n /** Direction of growth; defaults true. Not auto-mirrored in RTL (clock-like graphic). */\n clockwise?: boolean;\n /** Show the default percentage when no custom content is supplied; defaults true. */\n showText?: boolean;\n lineCap?: CircleLineCap;\n}\n\nexport interface ResolvedCircleState {\n label: string;\n value: number;\n max: number;\n percent: number;\n indeterminate: boolean;\n tone: ProgressTone;\n valueText?: string;\n size?: number;\n strokeWidth: number;\n radius: number;\n circumference: number;\n dashArray: string;\n dashOffset: string;\n transform: string;\n startPosition: CircleStartPosition;\n clockwise: boolean;\n lineCap: CircleLineCap;\n /** Default center text, empty when indeterminate or showText is false. */\n percentText: string;\n}\n\nconst ROTATION: Record<CircleStartPosition, number> = { top: -90, right: 0, bottom: 90, left: 180 };\nconst pick = <T extends string>(list: readonly T[], value: unknown, fallback: T): T => (list as readonly unknown[]).includes(value) ? value as T : fallback;\n/** Fixed decimals keep SSR and client attribute strings identical. */\nconst fixed = (value: number) => String(Math.round(value * 1000) / 1000);\n\n/** Progress normalization plus ring geometry. Pure and SSR-safe. */\nexport function resolveCircleState(props: QwCircleProps): ResolvedCircleState {\n const progress = resolveProgressState(props);\n const strokeWidth = typeof props.strokeWidth === \"number\" && Number.isFinite(props.strokeWidth) ? Math.min(20, Math.max(1, props.strokeWidth)) : CIRCLE_DEFAULT_STROKE_WIDTH;\n const radius = (CIRCLE_VIEWBOX - strokeWidth) / 2;\n const circumference = 2 * Math.PI * radius;\n const shown = progress.indeterminate ? CIRCLE_INDETERMINATE_ARC : progress.percent / 100;\n const startPosition = pick(CIRCLE_START_POSITIONS, props.startPosition, \"top\");\n const clockwise = props.clockwise ?? true;\n // CSS transform about the ring center: mirror across the start axis (scaleY(-1)) first, then rotate to the start angle.\n const transform = `rotate(${ROTATION[startPosition]}deg)${clockwise ? \"\" : \" scaleY(-1)\"}`;\n const size = typeof props.size === \"number\" && Number.isFinite(props.size) && props.size > 0 ? props.size : undefined;\n return {\n ...progress, valueText: props.valueText?.trim() || undefined, size, strokeWidth, radius, circumference,\n dashArray: fixed(circumference), dashOffset: fixed(circumference * (1 - shown)), transform, startPosition, clockwise,\n lineCap: pick(CIRCLE_LINE_CAPS, props.lineCap, \"round\"),\n percentText: progress.indeterminate || props.showText === false ? \"\" : `${Math.round(progress.percent)}%`,\n };\n}\n\nexport type CircleRootProps = Omit<ReturnType<typeof getProgressRootProps>, \"data-scope\"> & {\n \"data-scope\": \"circle\";\n \"aria-valuetext\"?: string;\n \"data-start-position\": CircleStartPosition;\n \"data-clockwise\"?: \"true\";\n style?: { inlineSize: string; blockSize: string };\n};\n/** Same progressbar semantics as Progress, re-scoped for circle styling. */\nexport function getCircleRootProps(state: ResolvedCircleState): CircleRootProps {\n const progress = getProgressRootProps(state);\n return {\n ...progress, \"data-scope\": \"circle\",\n ...(state.valueText && !state.indeterminate ? { \"aria-valuetext\": state.valueText } : {}),\n \"data-start-position\": state.startPosition, ...(state.clockwise ? { \"data-clockwise\": \"true\" as const } : {}),\n ...(state.size ? { style: { inlineSize: `${state.size}px`, blockSize: `${state.size}px` } } : {}),\n };\n}\n\nexport interface CircleSvgProps { \"data-scope\": \"circle\"; \"data-part\": \"svg\"; viewBox: string; \"aria-hidden\": \"true\"; focusable: \"false\" }\nexport function getCircleSvgProps(): CircleSvgProps {\n return { \"data-scope\": \"circle\", \"data-part\": \"svg\", viewBox: `0 0 ${CIRCLE_VIEWBOX} ${CIRCLE_VIEWBOX}`, \"aria-hidden\": \"true\", focusable: \"false\" };\n}\nexport interface CircleRingStyle {\n strokeWidth: string;\n strokeDasharray?: string;\n strokeDashoffset?: string;\n strokeLinecap?: CircleLineCap;\n transform?: string;\n transformOrigin?: string;\n transformBox?: \"fill-box\";\n}\nexport interface CircleRingProps {\n \"data-scope\": \"circle\";\n \"data-part\": \"track\" | \"indicator\";\n cx: string; cy: string; r: string; fill: \"none\";\n /** Stroke geometry travels as camelCase inline style so React, Vue and WC need no attribute renaming. */\n style: CircleRingStyle;\n}\nexport function getCircleTrackProps(state: ResolvedCircleState): CircleRingProps {\n const c = String(CIRCLE_VIEWBOX / 2);\n return { \"data-scope\": \"circle\", \"data-part\": \"track\", cx: c, cy: c, r: fixed(state.radius), fill: \"none\", style: { strokeWidth: String(state.strokeWidth) } };\n}\nexport function getCircleIndicatorProps(state: ResolvedCircleState): CircleRingProps {\n return { ...getCircleTrackProps(state), \"data-part\": \"indicator\", style: { strokeWidth: String(state.strokeWidth), strokeDasharray: state.dashArray,\n strokeDashoffset: state.dashOffset, strokeLinecap: state.lineCap, transform: state.transform, transformOrigin: \"50% 50%\", transformBox: \"fill-box\" } };\n}\nexport interface CircleContentProps { \"data-scope\": \"circle\"; \"data-part\": \"content\" }\nexport function getCircleContentProps(): CircleContentProps {\n return { \"data-scope\": \"circle\", \"data-part\": \"content\" };\n}\n"],"mappings":";;;AAGA,MAAa,yBAAyB;CAAC;CAAO;CAAS;CAAU;AAAM;AACvE,MAAa,mBAAmB,CAAC,SAAS,MAAM;;AAEhD,MAAa,eAAe;CAAC;CAAQ;CAAO;CAAS;CAAa;AAAS;;AAE3E,MAAa,iBAAiB;AAC9B,MAAa,8BAA8B;;AAE3C,MAAa,2BAA2B;AA2CxC,MAAM,WAAgD;CAAE,KAAK;CAAK,OAAO;CAAG,QAAQ;CAAI,MAAM;AAAI;AAClG,MAAM,QAA0B,MAAoB,OAAgB,aAAoB,KAA4B,SAAS,KAAK,IAAI,QAAa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,EAAE,OAAO;GAAE,YAAY,GAAG,MAAM,KAAK;GAAK,WAAW,GAAG,MAAM,KAAK;EAAI,EAAE,IAAI,CAAC;CACjG;AACF;AAGA,SAAgB,oBAAoC;CAClD,OAAO;EAAE,cAAc;EAAU,aAAa;EAAO,SAAS;EAA2C,eAAe;EAAQ,WAAW;CAAQ;AACrJ;AAiBA,SAAgB,oBAAoB,OAA6C;CAC/E,MAAM,IAAI,OAAA,MAAwB,CAAC;CACnC,OAAO;EAAE,cAAc;EAAU,aAAa;EAAS,IAAI;EAAG,IAAI;EAAG,GAAG,MAAM,MAAM,MAAM;EAAG,MAAM;EAAQ,OAAO,EAAE,aAAa,OAAO,MAAM,WAAW,EAAE;CAAE;AAC/J;AACA,SAAgB,wBAAwB,OAA6C;CACnF,OAAO;EAAE,GAAG,oBAAoB,KAAK;EAAG,aAAa;EAAa,OAAO;GAAE,aAAa,OAAO,MAAM,WAAW;GAAG,iBAAiB,MAAM;GACxI,kBAAkB,MAAM;GAAY,eAAe,MAAM;GAAS,WAAW,MAAM;GAAW,iBAAiB;GAAW,cAAc;EAAW;CAAE;AACzJ;AAEA,SAAgB,wBAA4C;CAC1D,OAAO;EAAE,cAAc;EAAU,aAAa;CAAU;AAC1D"}
@@ -0,0 +1,98 @@
1
+ import { type Machine, type Service } from "@zag-js/core";
2
+ import type { NormalizeProps, PropTypes } from "@zag-js/types";
3
+ import { type IconState } from "../icon/index.js";
4
+ /** Stable DOM parts shared by every adapter. */
5
+ export declare const COLLAPSE_PARTS: readonly ["root", "item", "heading", "trigger", "title", "arrow", "content", "body"];
6
+ /** Allowed heading levels for panel headers; default 3. */
7
+ export declare const COLLAPSE_HEADING_LEVELS: readonly [2, 3, 4, 5, 6];
8
+ export type CollapsePart = (typeof COLLAPSE_PARTS)[number];
9
+ export type CollapseHeadingLevel = (typeof COLLAPSE_HEADING_LEVELS)[number];
10
+ /** One disclosure panel. `title` is the header button's accessible name. */
11
+ export interface QwCollapseItem {
12
+ key: string;
13
+ title: string;
14
+ /** Plain text body; adapters may project rich content instead. */
15
+ content?: string;
16
+ disabled?: boolean;
17
+ }
18
+ export interface CollapseValueChangeDetails {
19
+ value: string[];
20
+ }
21
+ export interface QwCollapseProps {
22
+ id?: string;
23
+ items: QwCollapseItem[];
24
+ /** At most one open panel; opening another closes the previous one. */
25
+ accordion?: boolean;
26
+ /** Controlled open keys (including []). User toggles only request changes. */
27
+ value?: string[];
28
+ /** Initial open keys. Defaults []. */
29
+ defaultValue?: string[];
30
+ /** Disable every header. Open panels stay open. */
31
+ disabled?: boolean;
32
+ /** Heading level wrapping each header button; 2–6, default 3. */
33
+ headingLevel?: number;
34
+ /** ArrowUp/ArrowDown wrap between headers; defaults true. */
35
+ loop?: boolean;
36
+ onValueChange?: (details: CollapseValueChangeDetails) => void;
37
+ }
38
+ export interface QwCollapseSchema {
39
+ props: QwCollapseProps & {
40
+ accordion: boolean;
41
+ defaultValue: string[];
42
+ headingLevel: CollapseHeadingLevel;
43
+ loop: boolean;
44
+ };
45
+ context: {
46
+ value: string[];
47
+ };
48
+ state: "ready";
49
+ action: "toggle" | "setValue" | "normalizeMode";
50
+ event: {
51
+ type: "VALUE.TOGGLE";
52
+ value: string;
53
+ } | {
54
+ type: "VALUE.SET";
55
+ value: string[];
56
+ };
57
+ }
58
+ export type QwCollapseMachine = Machine<QwCollapseSchema>;
59
+ export type QwCollapseService = Service<QwCollapseSchema>;
60
+ export interface QwCollapseItemProps {
61
+ key: string;
62
+ }
63
+ export interface QwCollapseItemState {
64
+ open: boolean;
65
+ disabled: boolean;
66
+ }
67
+ export declare function normalizeCollapseItems(items: readonly QwCollapseItem[]): QwCollapseItem[];
68
+ /** Ordered unique keys; accordion keeps the first. Unknown keys are retained. */
69
+ export declare function normalizeCollapseValue(value?: readonly string[], accordion?: boolean): string[];
70
+ export declare function resolveCollapseHeadingLevel(level: unknown): CollapseHeadingLevel;
71
+ export declare function createCollapseProps(props: QwCollapseProps): QwCollapseSchema["props"];
72
+ /** Pure toggle rule used by the machine. Returns null when blocked. */
73
+ export declare function toggleCollapseValue(value: readonly string[], item: QwCollapseItem, options?: {
74
+ accordion?: boolean;
75
+ disabled?: boolean;
76
+ }): string[] | null;
77
+ /** One Zag bindable lifecycle; Core owns toggling, accordion exclusivity and header focus moves. */
78
+ export declare const collapseMachine: QwCollapseMachine;
79
+ export interface QwCollapseApi<T extends PropTypes = PropTypes> {
80
+ value: string[];
81
+ items: QwCollapseItem[];
82
+ /** Tag name adapters render for each header wrapper, e.g. "h3". */
83
+ headingTag: `h${CollapseHeadingLevel}`;
84
+ setValue(value: string[]): void;
85
+ toggle(key: string): void;
86
+ getRootProps(): T["element"];
87
+ getItemState(item: QwCollapseItemProps): QwCollapseItemState;
88
+ getItemProps(item: QwCollapseItemProps): T["element"];
89
+ getHeadingProps(item: QwCollapseItemProps): T["element"];
90
+ getTriggerProps(item: QwCollapseItemProps): T["button"];
91
+ getTitleProps(item: QwCollapseItemProps): T["element"];
92
+ getArrowProps(item: QwCollapseItemProps): T["element"];
93
+ getArrowIconState(item: QwCollapseItemProps): IconState;
94
+ getContentProps(item: QwCollapseItemProps): T["element"];
95
+ getBodyProps(item: QwCollapseItemProps): T["element"];
96
+ }
97
+ /** SSR-pure getters; focus moves use the Zag DOM scope only inside key events. */
98
+ export declare function connectCollapse<T extends PropTypes>(service: QwCollapseService, normalize: NormalizeProps<T>): QwCollapseApi<T>;
@@ -0,0 +1,2 @@
1
+ export { COLLAPSE_PARTS, COLLAPSE_HEADING_LEVELS, normalizeCollapseItems, normalizeCollapseValue, resolveCollapseHeadingLevel, createCollapseProps, toggleCollapseValue, collapseMachine, connectCollapse } from "./collapse.js";
2
+ export type { CollapsePart, CollapseHeadingLevel, QwCollapseItem, CollapseValueChangeDetails, QwCollapseProps, QwCollapseSchema, QwCollapseMachine, QwCollapseService, QwCollapseItemProps, QwCollapseItemState, QwCollapseApi } from "./collapse.js";
@@ -0,0 +1,2 @@
1
+ import { a as createCollapseProps, c as resolveCollapseHeadingLevel, i as connectCollapse, l as toggleCollapseValue, n as COLLAPSE_PARTS, o as normalizeCollapseItems, r as collapseMachine, s as normalizeCollapseValue, t as COLLAPSE_HEADING_LEVELS } from "../collapse-B969h7-H.js";
2
+ export { COLLAPSE_HEADING_LEVELS, COLLAPSE_PARTS, collapseMachine, connectCollapse, createCollapseProps, normalizeCollapseItems, normalizeCollapseValue, resolveCollapseHeadingLevel, toggleCollapseValue };
@@ -0,0 +1,226 @@
1
+ import { o as resolveIconState } from "./icon-Cgdbnk1u.js";
2
+ import { r as selectionItemKey } from "./selection-ivXqO1eu.js";
3
+ import { createMachine } from "@zag-js/core";
4
+ import { dataAttr } from "@zag-js/dom-query";
5
+ //#region src/collapse/collapse.ts
6
+ /** Stable DOM parts shared by every adapter. */
7
+ const COLLAPSE_PARTS = [
8
+ "root",
9
+ "item",
10
+ "heading",
11
+ "trigger",
12
+ "title",
13
+ "arrow",
14
+ "content",
15
+ "body"
16
+ ];
17
+ /** Allowed heading levels for panel headers; default 3. */
18
+ const COLLAPSE_HEADING_LEVELS = [
19
+ 2,
20
+ 3,
21
+ 4,
22
+ 5,
23
+ 6
24
+ ];
25
+ function normalizeCollapseItems(items) {
26
+ const seen = /* @__PURE__ */ new Set();
27
+ return items.map((item) => {
28
+ if (typeof item.key !== "string" || !item.key.length) throw new TypeError("Collapse item keys must be nonempty strings");
29
+ if (seen.has(item.key)) throw new TypeError("Collapse item keys must be unique");
30
+ if (typeof item.title !== "string" || !item.title.trim()) throw new TypeError("Collapse item titles must be nonempty accessible text");
31
+ seen.add(item.key);
32
+ return { ...item };
33
+ });
34
+ }
35
+ /** Ordered unique keys; accordion keeps the first. Unknown keys are retained. */
36
+ function normalizeCollapseValue(value = [], accordion = false) {
37
+ if (value.some((key) => typeof key !== "string" || !key.length)) throw new TypeError("Collapse values must be nonempty strings");
38
+ const keys = [...new Set(value)];
39
+ return accordion ? keys.slice(0, 1) : keys;
40
+ }
41
+ function resolveCollapseHeadingLevel(level) {
42
+ return COLLAPSE_HEADING_LEVELS.includes(level) ? level : 3;
43
+ }
44
+ function createCollapseProps(props) {
45
+ if (props.id !== void 0 && (typeof props.id !== "string" || !props.id.trim())) throw new TypeError("Collapse requires a nonempty instance id when provided");
46
+ const accordion = !!props.accordion;
47
+ return {
48
+ ...props,
49
+ accordion,
50
+ items: normalizeCollapseItems(props.items ?? []),
51
+ value: props.value === void 0 ? void 0 : normalizeCollapseValue(props.value, accordion),
52
+ defaultValue: normalizeCollapseValue(props.defaultValue, accordion),
53
+ headingLevel: resolveCollapseHeadingLevel(props.headingLevel),
54
+ loop: props.loop ?? true
55
+ };
56
+ }
57
+ /** Pure toggle rule used by the machine. Returns null when blocked. */
58
+ function toggleCollapseValue(value, item, options = {}) {
59
+ if (options.disabled || item.disabled) return null;
60
+ const keys = normalizeCollapseValue(value, options.accordion);
61
+ if (keys.includes(item.key)) return keys.filter((key) => key !== item.key);
62
+ return options.accordion ? [item.key] : [...keys, item.key];
63
+ }
64
+ const same = (a, b) => !!b && a.length === b.length && a.every((value, index) => value === b[index]);
65
+ const rootId = (service) => `collapse:${service.scope.id}`;
66
+ const partId = (service, part, key) => `${rootId(service)}:${part}:${selectionItemKey(key)}`;
67
+ /** One Zag bindable lifecycle; Core owns toggling, accordion exclusivity and header focus moves. */
68
+ const collapseMachine = createMachine({
69
+ props: ({ props }) => createCollapseProps({
70
+ ...props,
71
+ items: props.items ?? []
72
+ }),
73
+ initialState: () => "ready",
74
+ context({ prop, bindable }) {
75
+ return { value: bindable(() => ({
76
+ defaultValue: prop("defaultValue"),
77
+ value: prop("value"),
78
+ isEqual: same,
79
+ onChange: (value) => prop("onValueChange")?.({ value: [...value] })
80
+ })) };
81
+ },
82
+ watch({ track, prop, action }) {
83
+ track([() => prop("accordion")], () => action(["normalizeMode"]));
84
+ },
85
+ on: {
86
+ "VALUE.TOGGLE": { actions: ["toggle"] },
87
+ "VALUE.SET": { actions: ["setValue"] }
88
+ },
89
+ states: { ready: {} },
90
+ implementations: { actions: {
91
+ toggle({ event, prop, context }) {
92
+ if (event.type !== "VALUE.TOGGLE") return;
93
+ const item = prop("items").find((entry) => entry.key === event.value);
94
+ const next = item && toggleCollapseValue(context.get("value"), item, {
95
+ accordion: prop("accordion"),
96
+ disabled: prop("disabled")
97
+ });
98
+ if (next) context.set("value", next);
99
+ },
100
+ setValue({ event, prop, context }) {
101
+ if (event.type === "VALUE.SET") context.set("value", normalizeCollapseValue(event.value, prop("accordion")));
102
+ },
103
+ normalizeMode({ prop, context }) {
104
+ context.set("value", normalizeCollapseValue(context.get("value"), prop("accordion")));
105
+ }
106
+ } }
107
+ });
108
+ /** SSR-pure getters; focus moves use the Zag DOM scope only inside key events. */
109
+ function connectCollapse(service, normalize) {
110
+ const id = rootId(service), items = service.prop("items"), accordion = service.prop("accordion");
111
+ const value = normalizeCollapseValue(service.context.get("value"), accordion);
112
+ const resolve = ({ key }) => {
113
+ const item = items.find((entry) => entry.key === key);
114
+ if (!item) throw new RangeError("Collapse item is not present in items");
115
+ return item;
116
+ };
117
+ const disabled = (item) => !!service.prop("disabled") || !!item.disabled;
118
+ const part = (name) => ({
119
+ "data-scope": "collapse",
120
+ "data-part": name
121
+ });
122
+ const data = (item) => ({
123
+ "data-state": value.includes(item.key) ? "open" : "closed",
124
+ "data-disabled": dataAttr(disabled(item))
125
+ });
126
+ return {
127
+ value: [...value],
128
+ items: items.map((item) => ({ ...item })),
129
+ headingTag: `h${service.prop("headingLevel")}`,
130
+ setValue: (next) => service.send({
131
+ type: "VALUE.SET",
132
+ value: normalizeCollapseValue(next, accordion)
133
+ }),
134
+ toggle: (key) => service.send({
135
+ type: "VALUE.TOGGLE",
136
+ value: key
137
+ }),
138
+ getRootProps: () => normalize.element({
139
+ ...part("root"),
140
+ id,
141
+ "data-accordion": dataAttr(accordion),
142
+ "data-disabled": dataAttr(service.prop("disabled"))
143
+ }),
144
+ getItemState: (props) => {
145
+ const item = resolve(props);
146
+ return {
147
+ open: value.includes(item.key),
148
+ disabled: disabled(item)
149
+ };
150
+ },
151
+ getItemProps: (props) => normalize.element({
152
+ ...part("item"),
153
+ ...data(resolve(props))
154
+ }),
155
+ getHeadingProps: (props) => normalize.element({
156
+ ...part("heading"),
157
+ ...data(resolve(props))
158
+ }),
159
+ getTriggerProps(props) {
160
+ const item = resolve(props);
161
+ return normalize.button({
162
+ ...part("trigger"),
163
+ ...data(item),
164
+ type: "button",
165
+ id: partId(service, "trigger", item.key),
166
+ disabled: disabled(item),
167
+ "aria-expanded": value.includes(item.key),
168
+ "aria-controls": partId(service, "content", item.key),
169
+ onClick(event) {
170
+ if (!event.defaultPrevented) service.send({
171
+ type: "VALUE.TOGGLE",
172
+ value: item.key
173
+ });
174
+ },
175
+ onKeyDown(event) {
176
+ if (event.defaultPrevented || event.ctrlKey || event.altKey || event.metaKey || ![
177
+ "ArrowUp",
178
+ "ArrowDown",
179
+ "Home",
180
+ "End"
181
+ ].includes(event.key)) return;
182
+ const enabled = service.prop("items").filter((entry) => !disabled(entry));
183
+ const index = enabled.findIndex((entry) => entry.key === item.key);
184
+ if (index < 0) return;
185
+ event.preventDefault();
186
+ let target = event.key === "Home" ? 0 : event.key === "End" ? enabled.length - 1 : index + (event.key === "ArrowDown" ? 1 : -1);
187
+ if (service.prop("loop")) target = (target + enabled.length) % enabled.length;
188
+ const next = enabled[target];
189
+ if (next) service.scope.getById(partId(service, "trigger", next.key))?.focus();
190
+ }
191
+ });
192
+ },
193
+ getTitleProps: (props) => normalize.element({
194
+ ...part("title"),
195
+ id: partId(service, "title", resolve(props).key)
196
+ }),
197
+ getArrowProps: (props) => normalize.element({
198
+ ...part("arrow"),
199
+ ...data(resolve(props)),
200
+ "aria-hidden": true
201
+ }),
202
+ getArrowIconState: (props) => resolveIconState({
203
+ id: partId(service, "arrow", resolve(props).key),
204
+ name: "down"
205
+ }),
206
+ getContentProps(props) {
207
+ const item = resolve(props);
208
+ return normalize.element({
209
+ ...part("content"),
210
+ ...data(item),
211
+ id: partId(service, "content", item.key),
212
+ role: "region",
213
+ "aria-labelledby": partId(service, "trigger", item.key),
214
+ hidden: !value.includes(item.key)
215
+ });
216
+ },
217
+ getBodyProps: (props) => normalize.element({
218
+ ...part("body"),
219
+ ...data(resolve(props))
220
+ })
221
+ };
222
+ }
223
+ //#endregion
224
+ export { createCollapseProps as a, resolveCollapseHeadingLevel as c, connectCollapse as i, toggleCollapseValue as l, COLLAPSE_PARTS as n, normalizeCollapseItems as o, collapseMachine as r, normalizeCollapseValue as s, COLLAPSE_HEADING_LEVELS as t };
225
+
226
+ //# sourceMappingURL=collapse-B969h7-H.js.map