@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,172 @@
1
+ import { type Machine, type Service } from "@zag-js/core";
2
+ import type { NormalizeProps, PropTypes } from "@zag-js/types";
3
+ import { type FloatingAlign, type FloatingLayout, type FloatingPlacement, type FloatingSide } from "../popover/positioning.js";
4
+ import { type FloatingCloseRequest } from "../popover/layer.js";
5
+ /** Stable DOM parts shared by every adapter. */
6
+ export declare const DROPDOWN_PARTS: readonly ["trigger", "positioner", "content", "item"];
7
+ export type DropdownPlacement = FloatingPlacement;
8
+ export declare const DROPDOWN_DEFAULT_PLACEMENT: DropdownPlacement;
9
+ /** Main-axis gap between the trigger and the menu in CSS px. */
10
+ export declare const DROPDOWN_DEFAULT_OFFSET = 4;
11
+ /** Characters typed within this many milliseconds extend the typeahead query. */
12
+ export declare const DROPDOWN_TYPEAHEAD_TIMEOUT = 500;
13
+ export declare const DROPDOWN_MOVES: readonly ["first", "last", "next", "prev"];
14
+ export type DropdownMove = (typeof DROPDOWN_MOVES)[number];
15
+ /** One text menu item. value is the exact selection notification; label is the visible and typeahead text. */
16
+ export interface QwDropdownItem {
17
+ value: string;
18
+ label: string;
19
+ /** Visible and announced (aria-disabled) but skipped by roving focus and never selected. */
20
+ disabled?: boolean;
21
+ /** Destructive styling only; there is no second confirmation. */
22
+ danger?: boolean;
23
+ }
24
+ export interface QwResolvedDropdownItem {
25
+ readonly source: QwDropdownItem;
26
+ /** Position in the caller's items array; part of the item id. */
27
+ readonly index: number;
28
+ readonly value: string;
29
+ readonly label: string;
30
+ /** Disabled by the caller, or a later duplicate of an earlier value. */
31
+ readonly disabled: boolean;
32
+ readonly danger: boolean;
33
+ readonly duplicate: boolean;
34
+ }
35
+ /** keyboard: ArrowDown/ArrowUp on the trigger; tab / focus-outside: focus left the menu; select: an item was chosen. */
36
+ export type DropdownOpenChangeReason = "trigger" | "keyboard" | "escape" | "outside" | "focus-outside" | "tab" | "select" | "api";
37
+ export interface DropdownOpenChangeDetails {
38
+ open: boolean;
39
+ reason: DropdownOpenChangeReason;
40
+ }
41
+ export interface DropdownSelectDetails {
42
+ value: string;
43
+ }
44
+ export interface QwDropdownProps {
45
+ /** Page-unique instance identity; adapters generate one when omitted. */
46
+ id?: string;
47
+ /** Caller-owned menu items, never mutated; default []. */
48
+ items?: readonly QwDropdownItem[];
49
+ /** Controlled open state; undefined lets Core own it. */
50
+ open?: boolean;
51
+ /** Initial open state when uncontrolled. */
52
+ defaultOpen?: boolean;
53
+ /** Every open/close request, controlled or not; controlled owners accept by updating open, or refuse by keeping it. */
54
+ onOpenChange?: (details: DropdownOpenChangeDetails) => void;
55
+ /** An enabled item was activated (click, Enter or Space); a close request (reason select) follows. */
56
+ onSelect?: (details: DropdownSelectDetails) => void;
57
+ /** Preferred placement (default bottom-start; unknown values use it); positioning is Popover's Core module. */
58
+ placement?: DropdownPlacement;
59
+ /** Main-axis gap in CSS px; default 4. */
60
+ offset?: number;
61
+ /** Accessible name of the menu; omitted names it by the trigger (aria-labelledby). */
62
+ label?: string;
63
+ }
64
+ export interface ResolvedDropdownState {
65
+ placement: DropdownPlacement;
66
+ offset: number;
67
+ label: string | undefined;
68
+ }
69
+ export declare function resolveDropdownState(props?: QwDropdownProps): ResolvedDropdownState;
70
+ /** Keeps every item in order; a repeated value only keeps its first item enabled (a disabled first item does not promote a later one). */
71
+ export declare function resolveDropdownItems(items: readonly QwDropdownItem[] | undefined): readonly QwResolvedDropdownItem[];
72
+ /** Source index of the enabled item a move lands on, or -1 when nothing is enabled. next/prev wrap; from no highlight they start at the ends. */
73
+ export declare function getDropdownMoveTarget(items: readonly QwResolvedDropdownItem[], current: string | null, move: DropdownMove): number;
74
+ /**
75
+ * Explicit text match: the first enabled item, searching forward and wrapping, whose trimmed label starts
76
+ * with the query (locale lower case). A single or repeated character starts after the current item (so
77
+ * repeating it cycles); a longer query keeps the current item while it still matches. -1 when none matches.
78
+ */
79
+ export declare function getDropdownTypeaheadTarget(items: readonly QwResolvedDropdownItem[], current: string | null, query: string): number;
80
+ export declare function createDropdownProps(props?: QwDropdownProps): QwDropdownProps;
81
+ type FocusIntent = "first" | "last";
82
+ export interface QwDropdownSchema {
83
+ props: QwDropdownProps;
84
+ context: {
85
+ dismissReady: boolean;
86
+ layout: FloatingLayout | null;
87
+ highlighted: string | null;
88
+ };
89
+ refs: {
90
+ request: FloatingCloseRequest | null;
91
+ focus: FocusIntent | null;
92
+ typeahead: {
93
+ query: string;
94
+ at: number;
95
+ };
96
+ cancelFocus: (() => void) | null;
97
+ };
98
+ state: "open" | "closed";
99
+ guard: "isControlled";
100
+ action: "notifyOpen" | "notifyClose" | "restoreFocus" | "setLayout" | "dismissReady" | "clearLayout" | "syncControlled" | "highlight" | "move" | "typeahead" | "select" | "reconcile";
101
+ effect: "trackLayout" | "trackDismiss";
102
+ event: {
103
+ type: "DISMISS.READY";
104
+ } | {
105
+ type: "OPEN" | "TOGGLE";
106
+ reason?: DropdownOpenChangeReason;
107
+ focus?: FocusIntent;
108
+ } | {
109
+ type: "CLOSE";
110
+ reason?: DropdownOpenChangeReason;
111
+ focusable?: boolean;
112
+ } | {
113
+ type: "CONTROLLED.OPEN" | "CONTROLLED.CLOSE";
114
+ } | {
115
+ type: "LAYOUT";
116
+ layout: FloatingLayout;
117
+ } | {
118
+ type: "HIGHLIGHT";
119
+ value: string;
120
+ } | {
121
+ type: "MOVE";
122
+ to: DropdownMove;
123
+ } | {
124
+ type: "TYPEAHEAD";
125
+ key: string;
126
+ } | {
127
+ type: "SELECT";
128
+ index: number;
129
+ value: string;
130
+ };
131
+ }
132
+ export type QwDropdownMachine = Machine<QwDropdownSchema>;
133
+ export type QwDropdownService = Service<QwDropdownSchema>;
134
+ /**
135
+ * Core owns the menu: open/close with controlled refusal, Popover's positioning module while open, the
136
+ * shared non-modal layer (Escape, outside pointer, focus leaving), roving focus, typeahead, selection and
137
+ * focus return to the original trigger.
138
+ */
139
+ export declare const dropdownMachine: QwDropdownMachine;
140
+ /** Minimal event surfaces shared by React, Vue and native events. */
141
+ export interface DropdownDomEvent {
142
+ readonly defaultPrevented: boolean;
143
+ preventDefault(): void;
144
+ }
145
+ export interface DropdownKeyboardEvent extends DropdownDomEvent {
146
+ readonly key: string;
147
+ readonly shiftKey?: boolean;
148
+ readonly altKey?: boolean;
149
+ readonly ctrlKey?: boolean;
150
+ readonly metaKey?: boolean;
151
+ readonly isComposing?: boolean;
152
+ }
153
+ export interface QwDropdownApi<T extends PropTypes = PropTypes> {
154
+ open: boolean;
155
+ /** The measured placement while open (after flipping), otherwise the preferred one. */
156
+ placement: DropdownPlacement;
157
+ side: FloatingSide;
158
+ align: FloatingAlign;
159
+ positioned: boolean;
160
+ items: readonly QwResolvedDropdownItem[];
161
+ /** Value of the item holding roving focus. */
162
+ highlighted: string | null;
163
+ /** Request a state; controlled owners decide through onOpenChange (reason api). */
164
+ setOpen(open: boolean): void;
165
+ /** Merge onto the caller's own trigger node (click toggles; ArrowDown/ArrowUp open on the first/last item); preventDefault() in its handlers skips Core. */
166
+ getTriggerProps(): T["element"];
167
+ getPositionerProps(): T["element"];
168
+ getContentProps(): T["element"];
169
+ getItemProps(item: QwResolvedDropdownItem): T["element"];
170
+ }
171
+ export declare function connectDropdown<T extends PropTypes>(service: QwDropdownService, normalize: NormalizeProps<T>): QwDropdownApi<T>;
172
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from "./dropdown.js";
2
+ export type { FloatingAlign, FloatingLayout, FloatingPlacement, FloatingSide } from "../popover/positioning.js";
@@ -0,0 +1,467 @@
1
+ import { d as resolveFloatingPlacement, f as sameFloatingLayout, l as getFloatingPositionerStyle, m as trackFloatingLayout, n as restoreFloatingFocus, p as splitFloatingPlacement, r as trackFloatingDismiss, t as focusWhenReady } from "../layer-IpFrl5--.js";
2
+ import { createMachine } from "@zag-js/core";
3
+ //#region src/dropdown/dropdown.ts
4
+ /** Stable DOM parts shared by every adapter. */
5
+ const DROPDOWN_PARTS = [
6
+ "trigger",
7
+ "positioner",
8
+ "content",
9
+ "item"
10
+ ];
11
+ const DROPDOWN_DEFAULT_PLACEMENT = "bottom-start";
12
+ /** Main-axis gap between the trigger and the menu in CSS px. */
13
+ const DROPDOWN_DEFAULT_OFFSET = 4;
14
+ /** Characters typed within this many milliseconds extend the typeahead query. */
15
+ const DROPDOWN_TYPEAHEAD_TIMEOUT = 500;
16
+ const DROPDOWN_MOVES = [
17
+ "first",
18
+ "last",
19
+ "next",
20
+ "prev"
21
+ ];
22
+ const text = (value) => typeof value === "string" && value.trim() ? value.trim() : void 0;
23
+ function resolveDropdownState(props = {}) {
24
+ return {
25
+ placement: resolveFloatingPlacement(props.placement, DROPDOWN_DEFAULT_PLACEMENT),
26
+ offset: typeof props.offset === "number" && Number.isFinite(props.offset) ? props.offset : 4,
27
+ label: text(props.label)
28
+ };
29
+ }
30
+ /** Keeps every item in order; a repeated value only keeps its first item enabled (a disabled first item does not promote a later one). */
31
+ function resolveDropdownItems(items) {
32
+ const seen = /* @__PURE__ */ new Set();
33
+ return (Array.isArray(items) ? items : []).map((source, index) => {
34
+ const value = String(source?.value ?? ""), duplicate = seen.has(value);
35
+ seen.add(value);
36
+ return {
37
+ source,
38
+ index,
39
+ value,
40
+ label: String(source?.label ?? ""),
41
+ disabled: source?.disabled === true || duplicate,
42
+ danger: source?.danger === true,
43
+ duplicate
44
+ };
45
+ });
46
+ }
47
+ /** Source index of the enabled item a move lands on, or -1 when nothing is enabled. next/prev wrap; from no highlight they start at the ends. */
48
+ function getDropdownMoveTarget(items, current, move) {
49
+ const enabled = items.filter((item) => !item.disabled);
50
+ if (!enabled.length) return -1;
51
+ const at = enabled.findIndex((item) => item.value === current), last = enabled.length - 1;
52
+ return enabled[move === "first" ? 0 : move === "last" ? last : move === "next" ? at < 0 || at === last ? 0 : at + 1 : at <= 0 ? last : at - 1].index;
53
+ }
54
+ /**
55
+ * Explicit text match: the first enabled item, searching forward and wrapping, whose trimmed label starts
56
+ * with the query (locale lower case). A single or repeated character starts after the current item (so
57
+ * repeating it cycles); a longer query keeps the current item while it still matches. -1 when none matches.
58
+ */
59
+ function getDropdownTypeaheadTarget(items, current, query) {
60
+ const search = query.toLocaleLowerCase();
61
+ if (!search) return -1;
62
+ const repeated = [...search].every((char) => char === search[0]), needle = repeated ? search[0] : search;
63
+ const enabled = items.filter((item) => !item.disabled);
64
+ const at = enabled.findIndex((item) => item.value === current), start = at < 0 ? 0 : repeated ? at + 1 : at;
65
+ for (let step = 0; step < enabled.length; step += 1) {
66
+ const item = enabled[(start + step) % enabled.length];
67
+ if (item.label.trim().toLocaleLowerCase().startsWith(needle)) return item.index;
68
+ }
69
+ return -1;
70
+ }
71
+ function createDropdownProps(props = {}) {
72
+ if (props.id !== void 0 && (typeof props.id !== "string" || !props.id.trim())) throw new TypeError("Dropdown requires a nonempty instance id when provided");
73
+ return { ...props };
74
+ }
75
+ const ids = (scope) => {
76
+ const base = `dropdown:${scope.id}`;
77
+ return {
78
+ trigger: `${base}:trigger`,
79
+ positioner: `${base}:positioner`,
80
+ content: `${base}:content`,
81
+ item: (index) => `${base}:item:${index}`
82
+ };
83
+ };
84
+ const live = (prop) => resolveDropdownState({
85
+ placement: prop("placement"),
86
+ offset: prop("offset"),
87
+ label: prop("label")
88
+ });
89
+ const reasonOf = (event) => typeof event.reason === "string" ? event.reason : "api";
90
+ /** Primitive signature for zag's tracker: value, order and enabled state of every item. */
91
+ const signature = (items) => resolveDropdownItems(items).map((item) => `${item.disabled ? 0 : 1}${item.value}`).join("\0");
92
+ /** Roving focus: real DOM focus on the item (scrolled into the menu's view), or the menu itself when nothing is enabled. */
93
+ function focusItem(scope, context, items, index) {
94
+ const id = ids(scope), item = items[index];
95
+ if (!item) {
96
+ scope.getById(id.content)?.focus({ preventScroll: true });
97
+ return;
98
+ }
99
+ context.set("highlighted", item.value);
100
+ const node = scope.getById(id.item(index));
101
+ node?.focus({ preventScroll: true });
102
+ node?.scrollIntoView?.({ block: "nearest" });
103
+ }
104
+ /**
105
+ * Core owns the menu: open/close with controlled refusal, Popover's positioning module while open, the
106
+ * shared non-modal layer (Escape, outside pointer, focus leaving), roving focus, typeahead, selection and
107
+ * focus return to the original trigger.
108
+ */
109
+ const dropdownMachine = createMachine({
110
+ props: ({ props }) => createDropdownProps(props),
111
+ initialState: ({ prop }) => prop("open") ?? prop("defaultOpen") ? "open" : "closed",
112
+ context: ({ bindable }) => ({
113
+ dismissReady: bindable(() => ({ defaultValue: false })),
114
+ layout: bindable(() => ({
115
+ defaultValue: null,
116
+ isEqual: sameFloatingLayout
117
+ })),
118
+ highlighted: bindable(() => ({ defaultValue: null }))
119
+ }),
120
+ refs: () => ({
121
+ request: null,
122
+ focus: null,
123
+ typeahead: {
124
+ query: "",
125
+ at: 0
126
+ },
127
+ cancelFocus: null
128
+ }),
129
+ watch({ track, prop, action }) {
130
+ track([() => prop("open")], () => action(["syncControlled"]));
131
+ track([() => signature(prop("items"))], () => action(["reconcile"]));
132
+ },
133
+ states: {
134
+ closed: { on: {
135
+ "CONTROLLED.OPEN": { target: "open" },
136
+ OPEN: [{
137
+ guard: "isControlled",
138
+ actions: ["notifyOpen"]
139
+ }, {
140
+ target: "open",
141
+ actions: ["notifyOpen"]
142
+ }],
143
+ TOGGLE: [{
144
+ guard: "isControlled",
145
+ actions: ["notifyOpen"]
146
+ }, {
147
+ target: "open",
148
+ actions: ["notifyOpen"]
149
+ }]
150
+ } },
151
+ open: {
152
+ effects: ["trackLayout", "trackDismiss"],
153
+ exit: ["clearLayout"],
154
+ on: {
155
+ "CONTROLLED.CLOSE": {
156
+ target: "closed",
157
+ actions: ["restoreFocus"]
158
+ },
159
+ CLOSE: [{
160
+ guard: "isControlled",
161
+ actions: ["notifyClose"]
162
+ }, {
163
+ target: "closed",
164
+ actions: ["notifyClose", "restoreFocus"]
165
+ }],
166
+ TOGGLE: [{
167
+ guard: "isControlled",
168
+ actions: ["notifyClose"]
169
+ }, {
170
+ target: "closed",
171
+ actions: ["notifyClose", "restoreFocus"]
172
+ }],
173
+ LAYOUT: { actions: ["setLayout"] },
174
+ "DISMISS.READY": { actions: ["dismissReady"] },
175
+ HIGHLIGHT: { actions: ["highlight"] },
176
+ MOVE: { actions: ["move"] },
177
+ TYPEAHEAD: { actions: ["typeahead"] },
178
+ SELECT: { actions: ["select"] }
179
+ }
180
+ }
181
+ },
182
+ implementations: {
183
+ guards: { isControlled: ({ prop }) => prop("open") !== void 0 },
184
+ actions: {
185
+ notifyOpen({ prop, event, refs }) {
186
+ refs.set("request", null);
187
+ refs.set("focus", event.focus === "last" ? "last" : event.focus === "first" ? "first" : null);
188
+ prop("onOpenChange")?.({
189
+ open: true,
190
+ reason: reasonOf(event)
191
+ });
192
+ },
193
+ notifyClose({ prop, event, refs }) {
194
+ const reason = reasonOf(event);
195
+ refs.set("request", {
196
+ reason,
197
+ focusable: event.focusable === true
198
+ });
199
+ prop("onOpenChange")?.({
200
+ open: false,
201
+ reason
202
+ });
203
+ },
204
+ restoreFocus({ scope, refs }) {
205
+ const request = refs.get("request") ?? {
206
+ reason: "api",
207
+ focusable: false
208
+ }, id = ids(scope);
209
+ refs.set("request", null);
210
+ refs.set("focus", null);
211
+ restoreFloatingFocus(scope.getDoc(), scope.getById(id.trigger), scope.getById(id.content), request);
212
+ },
213
+ setLayout({ context, event, refs, scope, prop }) {
214
+ if (event.type !== "LAYOUT") return;
215
+ context.set("layout", event.layout);
216
+ const intent = refs.get("focus");
217
+ if (!intent) return;
218
+ refs.set("focus", null);
219
+ const items = resolveDropdownItems(prop("items")), index = getDropdownMoveTarget(items, null, intent), id = ids(scope);
220
+ if (index >= 0) context.set("highlighted", items[index].value);
221
+ refs.get("cancelFocus")?.();
222
+ refs.set("cancelFocus", focusWhenReady(scope.getDoc(), () => scope.getById(index >= 0 ? id.item(index) : id.content)));
223
+ },
224
+ dismissReady({ context }) {
225
+ context.set("dismissReady", true);
226
+ },
227
+ clearLayout({ context, refs }) {
228
+ context.set("dismissReady", false);
229
+ refs.get("cancelFocus")?.();
230
+ refs.set("cancelFocus", null);
231
+ refs.set("typeahead", {
232
+ query: "",
233
+ at: 0
234
+ });
235
+ context.set("layout", null);
236
+ context.set("highlighted", null);
237
+ },
238
+ syncControlled({ prop, send }) {
239
+ const open = prop("open");
240
+ if (open !== void 0) send({ type: open ? "CONTROLLED.OPEN" : "CONTROLLED.CLOSE" });
241
+ },
242
+ highlight({ context, event, prop }) {
243
+ if (event.type !== "HIGHLIGHT") return;
244
+ const item = resolveDropdownItems(prop("items")).find((entry) => entry.value === event.value && !entry.disabled);
245
+ if (item && context.get("highlighted") !== item.value) context.set("highlighted", item.value);
246
+ },
247
+ move({ context, event, prop, scope }) {
248
+ if (event.type !== "MOVE") return;
249
+ const items = resolveDropdownItems(prop("items"));
250
+ focusItem(scope, context, items, getDropdownMoveTarget(items, context.get("highlighted"), event.to));
251
+ },
252
+ typeahead({ context, event, prop, refs, scope }) {
253
+ if (event.type !== "TYPEAHEAD") return;
254
+ const now = Date.now(), previous = refs.get("typeahead");
255
+ const query = now - previous.at > 500 ? event.key : previous.query + event.key;
256
+ refs.set("typeahead", {
257
+ query,
258
+ at: now
259
+ });
260
+ const items = resolveDropdownItems(prop("items")), index = getDropdownTypeaheadTarget(items, context.get("highlighted"), query);
261
+ if (index >= 0) focusItem(scope, context, items, index);
262
+ },
263
+ select({ event, prop, send }) {
264
+ if (event.type !== "SELECT") return;
265
+ const item = resolveDropdownItems(prop("items"))[event.index];
266
+ if (!item || item.disabled || item.value !== event.value) return;
267
+ prop("onSelect")?.({ value: item.value });
268
+ send({
269
+ type: "CLOSE",
270
+ reason: "select"
271
+ });
272
+ },
273
+ reconcile({ context, prop, scope, state }) {
274
+ const value = context.get("highlighted");
275
+ if (!state.matches("open") || value === null) return;
276
+ if (resolveDropdownItems(prop("items")).some((item) => item.value === value && !item.disabled)) return;
277
+ context.set("highlighted", null);
278
+ const doc = scope.getDoc(), id = ids(scope);
279
+ const keep = () => {
280
+ const content = scope.getById(id.content), active = doc.activeElement;
281
+ if (content && (!active || active === doc.body || active.getAttribute("aria-disabled") === "true")) content.focus({ preventScroll: true });
282
+ };
283
+ const win = doc.defaultView;
284
+ if (win) win.requestAnimationFrame(keep);
285
+ else keep();
286
+ }
287
+ },
288
+ effects: {
289
+ trackLayout({ scope, prop, send }) {
290
+ const id = ids(scope);
291
+ return trackFloatingLayout(scope.getDoc(), {
292
+ anchor: () => scope.getById(id.trigger),
293
+ positioner: () => scope.getById(id.positioner),
294
+ content: () => scope.getById(id.content),
295
+ arrow: () => null,
296
+ placement: () => live(prop).placement,
297
+ offset: () => live(prop).offset,
298
+ fallback: DROPDOWN_DEFAULT_PLACEMENT,
299
+ onLayout: (layout) => send({
300
+ type: "LAYOUT",
301
+ layout
302
+ })
303
+ });
304
+ },
305
+ trackDismiss({ scope, send }) {
306
+ const id = ids(scope);
307
+ return trackFloatingDismiss(scope.getDoc(), {
308
+ onReady: () => send({ type: "DISMISS.READY" }),
309
+ type: "menu",
310
+ content: () => scope.getById(id.content),
311
+ trigger: () => scope.getById(id.trigger),
312
+ closeOnEscape: () => true,
313
+ closeOnOutside: () => true,
314
+ closeOnFocusOutside: () => true,
315
+ onDismiss: (request) => send({
316
+ type: "CLOSE",
317
+ reason: request.reason,
318
+ focusable: request.focusable
319
+ })
320
+ });
321
+ }
322
+ }
323
+ }
324
+ });
325
+ const CONTENT_MOVES = {
326
+ ArrowDown: "next",
327
+ ArrowUp: "prev",
328
+ Home: "first",
329
+ End: "last"
330
+ };
331
+ function connectDropdown(service, normalize) {
332
+ const state = live(service.prop), id = ids(service.scope), open = service.state.matches("open");
333
+ const layout = open && service.context.get("dismissReady") ? service.context.get("layout") : null, highlighted = open ? service.context.get("highlighted") : null;
334
+ const items = resolveDropdownItems(service.prop("items"));
335
+ const placement = layout?.placement ?? state.placement, { side, align } = layout ?? splitFloatingPlacement(state.placement);
336
+ const part = (name) => ({
337
+ "data-scope": "dropdown",
338
+ "data-part": name
339
+ });
340
+ const select = (item) => service.send({
341
+ type: "SELECT",
342
+ index: item.index,
343
+ value: item.value
344
+ });
345
+ return {
346
+ open,
347
+ placement,
348
+ side,
349
+ align,
350
+ positioned: !!layout,
351
+ items,
352
+ highlighted,
353
+ setOpen(next) {
354
+ if (next !== open) service.send({
355
+ type: next ? "OPEN" : "CLOSE",
356
+ reason: "api"
357
+ });
358
+ },
359
+ getTriggerProps: () => normalize.element({
360
+ ...part("trigger"),
361
+ id: id.trigger,
362
+ "aria-haspopup": "menu",
363
+ "aria-expanded": open,
364
+ "aria-controls": id.content,
365
+ "data-state": open ? "open" : "closed",
366
+ onClick(event) {
367
+ if (!event.defaultPrevented) service.send({
368
+ type: "TOGGLE",
369
+ reason: "trigger",
370
+ focus: "first"
371
+ });
372
+ },
373
+ onKeyDown(event) {
374
+ const focus = event.key === "ArrowDown" ? "first" : event.key === "ArrowUp" ? "last" : null;
375
+ if (event.defaultPrevented || !focus) return;
376
+ event.preventDefault();
377
+ if (open) service.send({
378
+ type: "MOVE",
379
+ to: focus
380
+ });
381
+ else service.send({
382
+ type: "OPEN",
383
+ reason: "keyboard",
384
+ focus
385
+ });
386
+ }
387
+ }),
388
+ getPositionerProps: () => normalize.element({
389
+ ...part("positioner"),
390
+ id: id.positioner,
391
+ "data-placement": placement,
392
+ "data-side": side,
393
+ "data-align": align,
394
+ "data-positioned": layout ? "" : void 0,
395
+ style: getFloatingPositionerStyle(layout)
396
+ }),
397
+ getContentProps: () => normalize.element({
398
+ ...part("content"),
399
+ id: id.content,
400
+ role: "menu",
401
+ tabIndex: -1,
402
+ "aria-label": state.label,
403
+ "aria-labelledby": state.label ? void 0 : id.trigger,
404
+ "data-state": open ? "open" : "closed",
405
+ "data-side": side,
406
+ "data-empty": items.length ? void 0 : "",
407
+ onKeyDown(event) {
408
+ if (event.defaultPrevented || event.isComposing) return;
409
+ const key = event.key, move = CONTENT_MOVES[key];
410
+ if (move) {
411
+ event.preventDefault();
412
+ service.send({
413
+ type: "MOVE",
414
+ to: move
415
+ });
416
+ return;
417
+ }
418
+ if (key === "Enter" || key === " ") {
419
+ event.preventDefault();
420
+ const current = service.context.get("highlighted"), item = items.find((entry) => entry.value === current && !entry.disabled);
421
+ if (item) select(item);
422
+ return;
423
+ }
424
+ if (key === "Tab") {
425
+ service.scope.getById(id.trigger)?.focus({ preventScroll: true });
426
+ if (event.shiftKey) event.preventDefault();
427
+ service.send({
428
+ type: "CLOSE",
429
+ reason: "tab"
430
+ });
431
+ return;
432
+ }
433
+ if (key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
434
+ event.preventDefault();
435
+ service.send({
436
+ type: "TYPEAHEAD",
437
+ key
438
+ });
439
+ }
440
+ }
441
+ }),
442
+ getItemProps: (item) => normalize.element({
443
+ ...part("item"),
444
+ id: id.item(item.index),
445
+ role: "menuitem",
446
+ tabIndex: item.disabled ? void 0 : -1,
447
+ "aria-disabled": item.disabled ? "true" : void 0,
448
+ "data-value": item.value,
449
+ "data-disabled": item.disabled ? "" : void 0,
450
+ "data-danger": item.danger ? "" : void 0,
451
+ "data-highlighted": !item.disabled && highlighted === item.value ? "" : void 0,
452
+ onClick(event) {
453
+ if (!event.defaultPrevented && !item.disabled) select(item);
454
+ },
455
+ onFocus() {
456
+ if (!item.disabled) service.send({
457
+ type: "HIGHLIGHT",
458
+ value: item.value
459
+ });
460
+ }
461
+ })
462
+ };
463
+ }
464
+ //#endregion
465
+ export { DROPDOWN_DEFAULT_OFFSET, DROPDOWN_DEFAULT_PLACEMENT, DROPDOWN_MOVES, DROPDOWN_PARTS, DROPDOWN_TYPEAHEAD_TIMEOUT, connectDropdown, createDropdownProps, dropdownMachine, getDropdownMoveTarget, getDropdownTypeaheadTarget, resolveDropdownItems, resolveDropdownState };
466
+
467
+ //# sourceMappingURL=index.js.map