@42-central/ui-react 0.29.1 → 0.30.1

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 (592) hide show
  1. package/dist/{chunk-X6DESK37.js → chunk-2RRTT4AF.js} +17 -5
  2. package/dist/chunk-2RRTT4AF.js.map +1 -0
  3. package/dist/{chunk-TUP7WXQE.js → chunk-322I2RSV.js} +9 -6
  4. package/dist/chunk-322I2RSV.js.map +1 -0
  5. package/dist/{chunk-ISX3AM32.js → chunk-37SRSNLJ.js} +4 -4
  6. package/dist/{chunk-ISX3AM32.js.map → chunk-37SRSNLJ.js.map} +1 -1
  7. package/dist/{chunk-L5GH7LLD.js → chunk-3MFWUG5O.js} +4 -4
  8. package/dist/{chunk-L5GH7LLD.js.map → chunk-3MFWUG5O.js.map} +1 -1
  9. package/dist/{chunk-FQJNQW3G.js → chunk-3XQEOJCE.js} +8 -5
  10. package/dist/chunk-3XQEOJCE.js.map +1 -0
  11. package/dist/{chunk-JKFPRQB2.js → chunk-4LSZ5JWF.js} +3 -3
  12. package/dist/{chunk-JKFPRQB2.js.map → chunk-4LSZ5JWF.js.map} +1 -1
  13. package/dist/{chunk-V2QZG4IT.js → chunk-5HWFYYHW.js} +27 -9
  14. package/dist/chunk-5HWFYYHW.js.map +1 -0
  15. package/dist/{chunk-GEZYGBXY.js → chunk-6MVFCS46.js} +99 -42
  16. package/dist/chunk-6MVFCS46.js.map +1 -0
  17. package/dist/{chunk-NNPSBC7O.js → chunk-6WZSUS3U.js} +10 -9
  18. package/dist/chunk-6WZSUS3U.js.map +1 -0
  19. package/dist/chunk-6YRGP6PS.js +138 -0
  20. package/dist/chunk-6YRGP6PS.js.map +1 -0
  21. package/dist/{chunk-B5YHYI7E.js → chunk-ALANKV5Y.js} +23 -6
  22. package/dist/chunk-ALANKV5Y.js.map +1 -0
  23. package/dist/{chunk-IA6DCC3N.js → chunk-AUQPNDE5.js} +23 -13
  24. package/dist/chunk-AUQPNDE5.js.map +1 -0
  25. package/dist/{chunk-AKXALCUN.js → chunk-D7SW2E24.js} +4 -4
  26. package/dist/chunk-D7SW2E24.js.map +1 -0
  27. package/dist/{chunk-OXR7BXZA.js → chunk-DQIYYDFD.js} +4 -3
  28. package/dist/chunk-DQIYYDFD.js.map +1 -0
  29. package/dist/{chunk-HMNXNKDA.js → chunk-FCBYUN6F.js} +4 -4
  30. package/dist/{chunk-HMNXNKDA.js.map → chunk-FCBYUN6F.js.map} +1 -1
  31. package/dist/{chunk-2W7H43WL.js → chunk-FED6SJWM.js} +23 -14
  32. package/dist/chunk-FED6SJWM.js.map +1 -0
  33. package/dist/{chunk-7E7JNWOC.js → chunk-FEPIHXVI.js} +6 -5
  34. package/dist/chunk-FEPIHXVI.js.map +1 -0
  35. package/dist/{chunk-Y57NW6G7.js → chunk-G3YOSG3U.js} +4 -4
  36. package/dist/{chunk-Y57NW6G7.js.map → chunk-G3YOSG3U.js.map} +1 -1
  37. package/dist/chunk-GZN5CXMR.js +100 -0
  38. package/dist/chunk-GZN5CXMR.js.map +1 -0
  39. package/dist/{chunk-HCHGERDB.js → chunk-HCSZPBWV.js} +17 -115
  40. package/dist/chunk-HCSZPBWV.js.map +1 -0
  41. package/dist/{chunk-I4B3N3UX.js → chunk-HTVICHT4.js} +12 -7
  42. package/dist/chunk-HTVICHT4.js.map +1 -0
  43. package/dist/chunk-I7TC2C3I.js +163 -0
  44. package/dist/chunk-I7TC2C3I.js.map +1 -0
  45. package/dist/{chunk-7FPSQBWB.js → chunk-IBXYLO2J.js} +14 -13
  46. package/dist/chunk-IBXYLO2J.js.map +1 -0
  47. package/dist/{chunk-7KFUFAVP.js → chunk-IRYG6B5A.js} +9 -8
  48. package/dist/chunk-IRYG6B5A.js.map +1 -0
  49. package/dist/{chunk-2RQLPN4U.js → chunk-JCNEW4WJ.js} +8 -8
  50. package/dist/{chunk-2RQLPN4U.js.map → chunk-JCNEW4WJ.js.map} +1 -1
  51. package/dist/{chunk-SP6LCCTZ.js → chunk-KZDMVOL6.js} +35 -8
  52. package/dist/chunk-KZDMVOL6.js.map +1 -0
  53. package/dist/chunk-LR5U6TZZ.js +169 -0
  54. package/dist/chunk-LR5U6TZZ.js.map +1 -0
  55. package/dist/{chunk-MQHD3EJE.js → chunk-LZHZJWVM.js} +6 -4
  56. package/dist/chunk-LZHZJWVM.js.map +1 -0
  57. package/dist/{chunk-5EOMSWNO.js → chunk-MAM2X3MW.js} +5 -5
  58. package/dist/{chunk-5EOMSWNO.js.map → chunk-MAM2X3MW.js.map} +1 -1
  59. package/dist/{chunk-FSPS7TVD.js → chunk-MCMS4NMO.js} +5 -5
  60. package/dist/{chunk-FSPS7TVD.js.map → chunk-MCMS4NMO.js.map} +1 -1
  61. package/dist/{chunk-ZB5VMGKB.js → chunk-MV5DIE2T.js} +15 -4
  62. package/dist/chunk-MV5DIE2T.js.map +1 -0
  63. package/dist/chunk-NDI4HLQE.js +41 -0
  64. package/dist/chunk-NDI4HLQE.js.map +1 -0
  65. package/dist/{chunk-B4GNSSHU.js → chunk-NLJEQZQQ.js} +3 -3
  66. package/dist/{chunk-B4GNSSHU.js.map → chunk-NLJEQZQQ.js.map} +1 -1
  67. package/dist/{chunk-SBZJGFZ6.js → chunk-QHT4DCXE.js} +8 -7
  68. package/dist/chunk-QHT4DCXE.js.map +1 -0
  69. package/dist/{chunk-I4IJOLNA.js → chunk-RMUBCTEF.js} +5 -5
  70. package/dist/{chunk-I4IJOLNA.js.map → chunk-RMUBCTEF.js.map} +1 -1
  71. package/dist/{chunk-G3AD3NJG.js → chunk-RNTDM3RP.js} +9 -5
  72. package/dist/chunk-RNTDM3RP.js.map +1 -0
  73. package/dist/chunk-RPFN6ETQ.js +509 -0
  74. package/dist/chunk-RPFN6ETQ.js.map +1 -0
  75. package/dist/{chunk-HWBFRDX7.js → chunk-SI7C3W5M.js} +28 -9
  76. package/dist/chunk-SI7C3W5M.js.map +1 -0
  77. package/dist/chunk-TPOV3OCC.js +234 -0
  78. package/dist/chunk-TPOV3OCC.js.map +1 -0
  79. package/dist/{chunk-IANYMDKH.js → chunk-UBQ54W46.js} +4 -4
  80. package/dist/chunk-UBQ54W46.js.map +1 -0
  81. package/dist/{chunk-QVOBLRCM.js → chunk-UIKQ4X6W.js} +3 -3
  82. package/dist/{chunk-QVOBLRCM.js.map → chunk-UIKQ4X6W.js.map} +1 -1
  83. package/dist/chunk-UOWQH53N.js +70 -0
  84. package/dist/chunk-UOWQH53N.js.map +1 -0
  85. package/dist/{chunk-QRNQQIQM.js → chunk-WJUY6YWF.js} +52 -20
  86. package/dist/chunk-WJUY6YWF.js.map +1 -0
  87. package/dist/{chunk-3KARNPW4.js → chunk-WKIUMLRT.js} +3 -3
  88. package/dist/{chunk-3KARNPW4.js.map → chunk-WKIUMLRT.js.map} +1 -1
  89. package/dist/chunk-X6RB74JN.js +37 -0
  90. package/dist/chunk-X6RB74JN.js.map +1 -0
  91. package/dist/chunk-XQ6L2CM5.js +83 -0
  92. package/dist/chunk-XQ6L2CM5.js.map +1 -0
  93. package/dist/{chunk-RKCUXOU2.js → chunk-YUVKROMA.js} +44 -7
  94. package/dist/chunk-YUVKROMA.js.map +1 -0
  95. package/dist/components/action-icon/action-icon.d.ts +9 -2
  96. package/dist/components/action-icon/action-icon.d.ts.map +1 -1
  97. package/dist/components/action-icon/index.js +5 -1
  98. package/dist/components/alert/index.js +4 -4
  99. package/dist/components/anchor/anchor.d.ts +45 -0
  100. package/dist/components/anchor/anchor.d.ts.map +1 -0
  101. package/dist/components/anchor/index.d.ts +2 -0
  102. package/dist/components/anchor/index.d.ts.map +1 -0
  103. package/dist/components/anchor/index.js +11 -0
  104. package/dist/components/anchor/index.js.map +1 -0
  105. package/dist/components/app-shell/app-shell.d.ts +10 -6
  106. package/dist/components/app-shell/app-shell.d.ts.map +1 -1
  107. package/dist/components/app-shell/index.js +23 -24
  108. package/dist/components/app-shell/index.js.map +1 -1
  109. package/dist/components/autocomplete/autocomplete.d.ts +1 -1
  110. package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
  111. package/dist/components/autocomplete/index.js +15 -9
  112. package/dist/components/autocomplete/index.js.map +1 -1
  113. package/dist/components/avatar/index.js +1 -1
  114. package/dist/components/breadcrumb/breadcrumb.d.ts +5 -1
  115. package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -1
  116. package/dist/components/breadcrumb/index.js +12 -0
  117. package/dist/components/breadcrumb/index.js.map +1 -1
  118. package/dist/components/button/button.d.ts +15 -2
  119. package/dist/components/button/button.d.ts.map +1 -1
  120. package/dist/components/button/index.js +5 -1
  121. package/dist/components/button-multi-select/index.js +6 -4
  122. package/dist/components/button-multi-select/index.js.map +1 -1
  123. package/dist/components/button-select/button-select-control.d.ts.map +1 -1
  124. package/dist/components/button-select/button-select.d.ts +2 -2
  125. package/dist/components/button-select/button-select.d.ts.map +1 -1
  126. package/dist/components/button-select/index.js +6 -4
  127. package/dist/components/button-select/index.js.map +1 -1
  128. package/dist/components/calendar/aliases.d.ts +16 -0
  129. package/dist/components/calendar/aliases.d.ts.map +1 -0
  130. package/dist/components/calendar/calendar-body.d.ts +11 -1
  131. package/dist/components/calendar/calendar-body.d.ts.map +1 -1
  132. package/dist/components/calendar/calendar.d.ts +8 -4
  133. package/dist/components/calendar/calendar.d.ts.map +1 -1
  134. package/dist/components/calendar/index.d.ts +2 -1
  135. package/dist/components/calendar/index.d.ts.map +1 -1
  136. package/dist/components/calendar/index.js +15 -5
  137. package/dist/components/calendar/index.js.map +1 -1
  138. package/dist/components/calendar-heatmap/calendar-heatmap.d.ts.map +1 -1
  139. package/dist/components/calendar-heatmap/index.js +85 -73
  140. package/dist/components/calendar-heatmap/index.js.map +1 -1
  141. package/dist/components/camera/index.js +16 -14
  142. package/dist/components/carousel/index.js +3 -3
  143. package/dist/components/checkbox/checkbox.d.ts.map +1 -1
  144. package/dist/components/checkbox/index.js +2 -2
  145. package/dist/components/choice-card-group/index.js +2 -2
  146. package/dist/components/choice-card-group/index.js.map +1 -1
  147. package/dist/components/circular-progress/circular-progress.d.ts +22 -11
  148. package/dist/components/circular-progress/circular-progress.d.ts.map +1 -1
  149. package/dist/components/circular-progress/index.d.ts +1 -1
  150. package/dist/components/circular-progress/index.d.ts.map +1 -1
  151. package/dist/components/circular-progress/index.js +68 -49
  152. package/dist/components/circular-progress/index.js.map +1 -1
  153. package/dist/components/clipboard/index.js +7 -3
  154. package/dist/components/clipboard/index.js.map +1 -1
  155. package/dist/components/code/code.d.ts +10 -0
  156. package/dist/components/code/code.d.ts.map +1 -1
  157. package/dist/components/code/index.js +1 -0
  158. package/dist/components/code/index.js.map +1 -1
  159. package/dist/components/code-block/chrome.js +10 -6
  160. package/dist/components/code-block/index.js +10 -7
  161. package/dist/components/code-block/index.js.map +1 -1
  162. package/dist/components/combobox/combobox.d.ts +5 -3
  163. package/dist/components/combobox/combobox.d.ts.map +1 -1
  164. package/dist/components/combobox/index.js +12 -7
  165. package/dist/components/combobox-list/combobox-list.d.ts +1 -1
  166. package/dist/components/combobox-list/combobox-list.d.ts.map +1 -1
  167. package/dist/components/combobox-list/index.js +14 -9
  168. package/dist/components/compare/index.js +1 -1
  169. package/dist/components/data-list/data-list.d.ts +96 -0
  170. package/dist/components/data-list/data-list.d.ts.map +1 -0
  171. package/dist/components/data-list/index.d.ts +2 -0
  172. package/dist/components/data-list/index.d.ts.map +1 -0
  173. package/dist/components/data-list/index.js +147 -0
  174. package/dist/components/data-list/index.js.map +1 -0
  175. package/dist/components/data-table/data-table-group.d.ts.map +1 -1
  176. package/dist/components/data-table/data-table-placeholder.d.ts +12 -1
  177. package/dist/components/data-table/data-table-placeholder.d.ts.map +1 -1
  178. package/dist/components/data-table/data-table-stack.d.ts.map +1 -1
  179. package/dist/components/data-table/data-table.d.ts +5 -2
  180. package/dist/components/data-table/data-table.d.ts.map +1 -1
  181. package/dist/components/data-table/index.js +163 -168
  182. package/dist/components/data-table/index.js.map +1 -1
  183. package/dist/components/date-picker/aliases.d.ts +16 -0
  184. package/dist/components/date-picker/aliases.d.ts.map +1 -1
  185. package/dist/components/date-picker/date-picker.d.ts +22 -8
  186. package/dist/components/date-picker/date-picker.d.ts.map +1 -1
  187. package/dist/components/date-picker/index.d.ts +2 -2
  188. package/dist/components/date-picker/index.d.ts.map +1 -1
  189. package/dist/components/date-picker/index.js +34 -28
  190. package/dist/components/date-picker/index.js.map +1 -1
  191. package/dist/components/download-button/index.js +6 -2
  192. package/dist/components/drawer/drawer.d.ts +7 -4
  193. package/dist/components/drawer/drawer.d.ts.map +1 -1
  194. package/dist/components/drawer/index.js +11 -6
  195. package/dist/components/empty-state/empty-state.d.ts +57 -0
  196. package/dist/components/empty-state/empty-state.d.ts.map +1 -0
  197. package/dist/components/empty-state/index.d.ts +2 -0
  198. package/dist/components/empty-state/index.d.ts.map +1 -0
  199. package/dist/components/empty-state/index.js +8 -0
  200. package/dist/components/empty-state/index.js.map +1 -0
  201. package/dist/components/field/field.d.ts +20 -0
  202. package/dist/components/field/field.d.ts.map +1 -1
  203. package/dist/components/field/index.js +1 -1
  204. package/dist/components/fieldset/fieldset.d.ts +103 -0
  205. package/dist/components/fieldset/fieldset.d.ts.map +1 -0
  206. package/dist/components/fieldset/index.d.ts +2 -0
  207. package/dist/components/fieldset/index.d.ts.map +1 -0
  208. package/dist/components/fieldset/index.js +150 -0
  209. package/dist/components/fieldset/index.js.map +1 -0
  210. package/dist/components/file-item/index.js +10 -7
  211. package/dist/components/file-preview/file-preview.d.ts.map +1 -1
  212. package/dist/components/file-preview/index.js +10 -18
  213. package/dist/components/file-preview/index.js.map +1 -1
  214. package/dist/components/file-trigger/index.js +6 -2
  215. package/dist/components/file-upload/file-upload.d.ts.map +1 -1
  216. package/dist/components/file-upload/index.js +18 -14
  217. package/dist/components/file-upload/index.js.map +1 -1
  218. package/dist/components/gallery/index.js +3 -3
  219. package/dist/components/geodesic/a11y.d.ts +3 -3
  220. package/dist/components/geodesic/a11y.d.ts.map +1 -1
  221. package/dist/components/hover-card/hover-card.d.ts.map +1 -1
  222. package/dist/components/hover-card/index.js +10 -3
  223. package/dist/components/hover-card/index.js.map +1 -1
  224. package/dist/components/image/index.js +3 -3
  225. package/dist/components/image-cropper/index.js +9 -6
  226. package/dist/components/input/index.js +2 -2
  227. package/dist/components/input/input.d.ts.map +1 -1
  228. package/dist/components/kbd/index.js +3 -3
  229. package/dist/components/kbd/kbd.d.ts +4 -0
  230. package/dist/components/kbd/kbd.d.ts.map +1 -1
  231. package/dist/components/lightbox/index.js +13 -11
  232. package/dist/components/lightbox/index.js.map +1 -1
  233. package/dist/components/menu/index.js +9 -5
  234. package/dist/components/menu/index.js.map +1 -1
  235. package/dist/components/menu/menu.d.ts.map +1 -1
  236. package/dist/components/modal/index.js +11 -6
  237. package/dist/components/modal/modal.d.ts +10 -4
  238. package/dist/components/modal/modal.d.ts.map +1 -1
  239. package/dist/components/multi-combobox-list/index.js +13 -9
  240. package/dist/components/multi-combobox-list/multi-combobox-list.d.ts +1 -1
  241. package/dist/components/multi-combobox-list/multi-combobox-list.d.ts.map +1 -1
  242. package/dist/components/multi-select/index.js +13 -10
  243. package/dist/components/multi-select/index.js.map +1 -1
  244. package/dist/components/multi-select/multi-select.d.ts +1 -1
  245. package/dist/components/multi-select/multi-select.d.ts.map +1 -1
  246. package/dist/components/nav-link/index.js +4 -4
  247. package/dist/components/nav-link/tanstack.js +4 -4
  248. package/dist/components/notification/index.js +6 -6
  249. package/dist/components/notification/index.js.map +1 -1
  250. package/dist/components/number-input/index.js +11 -7
  251. package/dist/components/number-input/number-input.d.ts +1 -1
  252. package/dist/components/number-input/number-input.d.ts.map +1 -1
  253. package/dist/components/overlays/dialog-parts.d.ts +10 -1
  254. package/dist/components/overlays/dialog-parts.d.ts.map +1 -1
  255. package/dist/components/overlays/index.js +13 -8
  256. package/dist/components/overlays/index.js.map +1 -1
  257. package/dist/components/pagination/index.d.ts +2 -0
  258. package/dist/components/pagination/index.d.ts.map +1 -0
  259. package/dist/components/pagination/index.js +362 -0
  260. package/dist/components/pagination/index.js.map +1 -0
  261. package/dist/components/pagination/pagination.d.ts +147 -0
  262. package/dist/components/pagination/pagination.d.ts.map +1 -0
  263. package/dist/components/password-input/index.js +6 -5
  264. package/dist/components/password-input/index.js.map +1 -1
  265. package/dist/components/password-input/password-input.d.ts +1 -1
  266. package/dist/components/password-input/password-input.d.ts.map +1 -1
  267. package/dist/components/phone-input/index.js +14 -11
  268. package/dist/components/phone-input/index.js.map +1 -1
  269. package/dist/components/phone-input/phone-input.d.ts +1 -1
  270. package/dist/components/phone-input/phone-input.d.ts.map +1 -1
  271. package/dist/components/photo-capture/index.js +19 -17
  272. package/dist/components/photo-capture/index.js.map +1 -1
  273. package/dist/components/pills-input/index.js +4 -4
  274. package/dist/components/pills-input/pills-input.d.ts +1 -1
  275. package/dist/components/pills-input/pills-input.d.ts.map +1 -1
  276. package/dist/components/pin-input/index.js +6 -5
  277. package/dist/components/pin-input/index.js.map +1 -1
  278. package/dist/components/pin-input/pin-input.d.ts.map +1 -1
  279. package/dist/components/popover/index.js +7 -2
  280. package/dist/components/popover/popover.d.ts +41 -16
  281. package/dist/components/popover/popover.d.ts.map +1 -1
  282. package/dist/components/progress/index.d.ts +1 -1
  283. package/dist/components/progress/index.d.ts.map +1 -1
  284. package/dist/components/progress/index.js +4 -1
  285. package/dist/components/progress/progress.d.ts +22 -14
  286. package/dist/components/progress/progress.d.ts.map +1 -1
  287. package/dist/components/prose/index.d.ts +2 -0
  288. package/dist/components/prose/index.d.ts.map +1 -0
  289. package/dist/components/prose/index.js +17 -0
  290. package/dist/components/prose/index.js.map +1 -0
  291. package/dist/components/prose/prose.d.ts +49 -0
  292. package/dist/components/prose/prose.d.ts.map +1 -0
  293. package/dist/components/prose/styles.css +593 -0
  294. package/dist/components/radio-group/index.js +9 -3
  295. package/dist/components/radio-group/index.js.map +1 -1
  296. package/dist/components/radio-group/radio-group.d.ts.map +1 -1
  297. package/dist/components/rating/index.js +3 -2
  298. package/dist/components/rating/index.js.map +1 -1
  299. package/dist/components/rating/rating.d.ts.map +1 -1
  300. package/dist/components/schedule/index.js +10 -8
  301. package/dist/components/schedule/index.js.map +1 -1
  302. package/dist/components/scroll-area/index.d.ts +2 -0
  303. package/dist/components/scroll-area/index.d.ts.map +1 -0
  304. package/dist/components/scroll-area/index.js +10 -0
  305. package/dist/components/scroll-area/index.js.map +1 -0
  306. package/dist/components/scroll-area/scroll-area.d.ts +150 -0
  307. package/dist/components/scroll-area/scroll-area.d.ts.map +1 -0
  308. package/dist/components/segment-group/index.js +2 -2
  309. package/dist/components/segment-group/segment-group.d.ts.map +1 -1
  310. package/dist/components/select/index.js +12 -8
  311. package/dist/components/select/select.d.ts +1 -1
  312. package/dist/components/select/select.d.ts.map +1 -1
  313. package/dist/components/slider/index.js +2 -2
  314. package/dist/components/slider/slider.d.ts.map +1 -1
  315. package/dist/components/splitter/index.d.ts +2 -0
  316. package/dist/components/splitter/index.d.ts.map +1 -0
  317. package/dist/components/splitter/index.js +373 -0
  318. package/dist/components/splitter/index.js.map +1 -0
  319. package/dist/components/splitter/splitter.d.ts +159 -0
  320. package/dist/components/splitter/splitter.d.ts.map +1 -0
  321. package/dist/components/spotlight/index.js +23 -22
  322. package/dist/components/spotlight/index.js.map +1 -1
  323. package/dist/components/spotlight/spotlight.d.ts.map +1 -1
  324. package/dist/components/steps/index.d.ts +4 -0
  325. package/dist/components/steps/index.d.ts.map +1 -0
  326. package/dist/components/steps/index.js +478 -0
  327. package/dist/components/steps/index.js.map +1 -0
  328. package/dist/components/steps/steps-data.d.ts +78 -0
  329. package/dist/components/steps/steps-data.d.ts.map +1 -0
  330. package/dist/components/steps/steps.d.ts +183 -0
  331. package/dist/components/steps/steps.d.ts.map +1 -0
  332. package/dist/components/switch/index.js +4 -3
  333. package/dist/components/switch/index.js.map +1 -1
  334. package/dist/components/switch/switch.d.ts.map +1 -1
  335. package/dist/components/table-of-contents/index.d.ts +2 -0
  336. package/dist/components/table-of-contents/index.d.ts.map +1 -0
  337. package/dist/components/table-of-contents/index.js +471 -0
  338. package/dist/components/table-of-contents/index.js.map +1 -0
  339. package/dist/components/table-of-contents/table-of-contents.d.ts +173 -0
  340. package/dist/components/table-of-contents/table-of-contents.d.ts.map +1 -0
  341. package/dist/components/tags-input/index.js +12 -9
  342. package/dist/components/tags-input/index.js.map +1 -1
  343. package/dist/components/tags-input/tags-input.d.ts +1 -1
  344. package/dist/components/tags-input/tags-input.d.ts.map +1 -1
  345. package/dist/components/text-input/index.js +2 -2
  346. package/dist/components/textarea/index.js +8 -6
  347. package/dist/components/textarea/index.js.map +1 -1
  348. package/dist/components/textarea/textarea.d.ts.map +1 -1
  349. package/dist/components/time-input/index.js +11 -9
  350. package/dist/components/time-input/index.js.map +1 -1
  351. package/dist/components/tooltip/index.js +1 -1
  352. package/dist/components/tooltip/tooltip.d.ts +3 -8
  353. package/dist/components/tooltip/tooltip.d.ts.map +1 -1
  354. package/dist/components/tour/conditions.d.ts +83 -0
  355. package/dist/components/tour/conditions.d.ts.map +1 -0
  356. package/dist/components/tour/create-tours.d.ts +49 -0
  357. package/dist/components/tour/create-tours.d.ts.map +1 -0
  358. package/dist/components/tour/index.d.ts +6 -0
  359. package/dist/components/tour/index.d.ts.map +1 -0
  360. package/dist/components/tour/index.js +1449 -0
  361. package/dist/components/tour/index.js.map +1 -0
  362. package/dist/components/tour/runtime.d.ts +57 -0
  363. package/dist/components/tour/runtime.d.ts.map +1 -0
  364. package/dist/components/tour/storage.d.ts +14 -0
  365. package/dist/components/tour/storage.d.ts.map +1 -0
  366. package/dist/components/tour/store.d.ts +62 -0
  367. package/dist/components/tour/store.d.ts.map +1 -0
  368. package/dist/components/tour/tour.d.ts +77 -0
  369. package/dist/components/tour/tour.d.ts.map +1 -0
  370. package/dist/components/tour/types.d.ts +680 -0
  371. package/dist/components/tour/types.d.ts.map +1 -0
  372. package/dist/components/tree/index.d.ts +3 -0
  373. package/dist/components/tree/index.d.ts.map +1 -0
  374. package/dist/components/tree/index.js +457 -0
  375. package/dist/components/tree/index.js.map +1 -0
  376. package/dist/components/tree/tree-row.d.ts +72 -0
  377. package/dist/components/tree/tree-row.d.ts.map +1 -0
  378. package/dist/components/tree/tree.d.ts +193 -0
  379. package/dist/components/tree/tree.d.ts.map +1 -0
  380. package/dist/components/tree-multi-select/index.js +31 -54
  381. package/dist/components/tree-multi-select/index.js.map +1 -1
  382. package/dist/components/tree-multi-select/tree-multi-select.d.ts +16 -1
  383. package/dist/components/tree-multi-select/tree-multi-select.d.ts.map +1 -1
  384. package/dist/components/tree-select/index.js +30 -24
  385. package/dist/components/tree-select/index.js.map +1 -1
  386. package/dist/components/tree-select/tree-popover.d.ts +20 -31
  387. package/dist/components/tree-select/tree-popover.d.ts.map +1 -1
  388. package/dist/components/tree-select/tree-select.d.ts +1 -1
  389. package/dist/components/tree-select/tree-select.d.ts.map +1 -1
  390. package/dist/index.d.ts +2 -0
  391. package/dist/index.d.ts.map +1 -1
  392. package/dist/index.js +10 -8
  393. package/dist/index.js.map +1 -1
  394. package/dist/lib/date-predicates.d.ts +7 -5
  395. package/dist/lib/date-predicates.d.ts.map +1 -1
  396. package/dist/lib/date-value.d.ts +20 -0
  397. package/dist/lib/date-value.d.ts.map +1 -1
  398. package/dist/lib/floating-arrow.d.ts +53 -0
  399. package/dist/lib/floating-arrow.d.ts.map +1 -0
  400. package/dist/lib/focus-return.d.ts +53 -0
  401. package/dist/lib/focus-return.d.ts.map +1 -0
  402. package/dist/lib/meter.d.ts +104 -0
  403. package/dist/lib/meter.d.ts.map +1 -0
  404. package/dist/lib/overlay-layer.d.ts +26 -8
  405. package/dist/lib/overlay-layer.d.ts.map +1 -1
  406. package/dist/lib/pressed.d.ts +92 -0
  407. package/dist/lib/pressed.d.ts.map +1 -0
  408. package/dist/lib/tree-data.d.ts +18 -2
  409. package/dist/lib/tree-data.d.ts.map +1 -1
  410. package/dist/lib/use-pagination.d.ts +102 -0
  411. package/dist/lib/use-pagination.d.ts.map +1 -0
  412. package/dist/lib/use-scroll-spy.d.ts +126 -0
  413. package/dist/lib/use-scroll-spy.d.ts.map +1 -0
  414. package/dist/theme.css +39 -3
  415. package/package.json +1 -1
  416. package/src/as-child.contract.test.tsx +283 -1
  417. package/src/components/action-icon/action-icon.tsx +34 -4
  418. package/src/components/anchor/anchor.test.tsx +232 -0
  419. package/src/components/anchor/anchor.tsx +187 -0
  420. package/src/components/anchor/index.ts +12 -0
  421. package/src/components/app-shell/app-shell.test.tsx +15 -7
  422. package/src/components/app-shell/app-shell.tsx +27 -20
  423. package/src/components/autocomplete/autocomplete.tsx +11 -3
  424. package/src/components/breadcrumb/breadcrumb.test.tsx +24 -0
  425. package/src/components/breadcrumb/breadcrumb.tsx +20 -1
  426. package/src/components/button/button-pressed.test.tsx +202 -0
  427. package/src/components/button/button.tsx +48 -6
  428. package/src/components/button-select/button-select-control.tsx +2 -2
  429. package/src/components/button-select/button-select.tsx +22 -2
  430. package/src/components/calendar/aliases.tsx +28 -0
  431. package/src/components/calendar/calendar-body.tsx +310 -210
  432. package/src/components/calendar/calendar.tsx +43 -12
  433. package/src/components/calendar/index.ts +7 -1
  434. package/src/components/calendar/month-year-calendar.test.tsx +106 -0
  435. package/src/components/calendar-heatmap/calendar-heatmap.tsx +88 -73
  436. package/src/components/checkbox/checkbox.tsx +7 -2
  437. package/src/components/choice-card-group/choice-card-group.tsx +2 -2
  438. package/src/components/circular-progress/circular-progress.test.tsx +35 -0
  439. package/src/components/circular-progress/circular-progress.tsx +116 -59
  440. package/src/components/circular-progress/index.ts +1 -0
  441. package/src/components/code/code.test.tsx +16 -0
  442. package/src/components/code/code.tsx +11 -0
  443. package/src/components/combobox/combobox.tsx +63 -28
  444. package/src/components/combobox-list/combobox-list.tsx +11 -3
  445. package/src/components/data-list/data-list.test.tsx +149 -0
  446. package/src/components/data-list/data-list.tsx +268 -0
  447. package/src/components/data-list/index.ts +9 -0
  448. package/src/components/data-table/data-table-group.test.tsx +16 -0
  449. package/src/components/data-table/data-table-group.tsx +15 -2
  450. package/src/components/data-table/data-table-placeholder.tsx +28 -36
  451. package/src/components/data-table/data-table-stack.tsx +33 -39
  452. package/src/components/data-table/data-table.test.tsx +31 -0
  453. package/src/components/data-table/data-table.tsx +41 -42
  454. package/src/components/date-picker/aliases.tsx +28 -0
  455. package/src/components/date-picker/date-picker.test.tsx +29 -0
  456. package/src/components/date-picker/date-picker.tsx +164 -45
  457. package/src/components/date-picker/index.ts +5 -1
  458. package/src/components/date-picker/month-year-picker.test.tsx +362 -0
  459. package/src/components/drawer/drawer.test.tsx +41 -0
  460. package/src/components/drawer/drawer.tsx +7 -1
  461. package/src/components/empty-state/empty-state.test.tsx +109 -0
  462. package/src/components/empty-state/empty-state.tsx +180 -0
  463. package/src/components/empty-state/index.ts +9 -0
  464. package/src/components/field/field.tsx +35 -1
  465. package/src/components/fieldset/fieldset.test.tsx +352 -0
  466. package/src/components/fieldset/fieldset.tsx +268 -0
  467. package/src/components/fieldset/index.ts +11 -0
  468. package/src/components/file-preview/file-preview.test.tsx +2 -1
  469. package/src/components/file-preview/file-preview.tsx +7 -13
  470. package/src/components/file-upload/file-upload.tsx +14 -5
  471. package/src/components/hover-card/hover-card.tsx +5 -1
  472. package/src/components/input/input.tsx +12 -5
  473. package/src/components/kbd/kbd.test.tsx +13 -0
  474. package/src/components/kbd/kbd.tsx +6 -0
  475. package/src/components/menu/menu.tsx +6 -2
  476. package/src/components/modal/modal.test.tsx +41 -0
  477. package/src/components/modal/modal.tsx +17 -9
  478. package/src/components/multi-combobox-list/multi-combobox-list.tsx +11 -3
  479. package/src/components/multi-select/multi-select.tsx +11 -3
  480. package/src/components/notification/create-notifier.tsx +1 -1
  481. package/src/components/number-input/number-input.tsx +12 -3
  482. package/src/components/overlays/dialog-parts.tsx +42 -5
  483. package/src/components/pagination/index.ts +19 -0
  484. package/src/components/pagination/pagination.test.tsx +187 -0
  485. package/src/components/pagination/pagination.tsx +563 -0
  486. package/src/components/password-input/password-input.tsx +12 -3
  487. package/src/components/phone-input/phone-input.tsx +12 -3
  488. package/src/components/pills-input/pills-input.tsx +7 -2
  489. package/src/components/pin-input/pin-input.tsx +13 -4
  490. package/src/components/popover/popover.tsx +87 -17
  491. package/src/components/progress/index.ts +1 -0
  492. package/src/components/progress/progress.test.tsx +102 -0
  493. package/src/components/progress/progress.tsx +116 -62
  494. package/src/components/prose/index.ts +1 -0
  495. package/src/components/prose/prose.test.tsx +90 -0
  496. package/src/components/prose/prose.tsx +60 -0
  497. package/src/components/prose/styles.css +593 -0
  498. package/src/components/radio-group/radio-group.tsx +8 -3
  499. package/src/components/rating/rating.tsx +5 -2
  500. package/src/components/scroll-area/index.ts +18 -0
  501. package/src/components/scroll-area/scroll-area.test.tsx +184 -0
  502. package/src/components/scroll-area/scroll-area.tsx +448 -0
  503. package/src/components/segment-group/segment-group.tsx +2 -2
  504. package/src/components/select/select.tsx +37 -18
  505. package/src/components/slider/slider.tsx +2 -2
  506. package/src/components/splitter/index.ts +15 -0
  507. package/src/components/splitter/splitter.test.tsx +244 -0
  508. package/src/components/splitter/splitter.tsx +625 -0
  509. package/src/components/spotlight/spotlight.test.tsx +34 -26
  510. package/src/components/spotlight/spotlight.tsx +7 -9
  511. package/src/components/steps/index.ts +21 -0
  512. package/src/components/steps/steps-data.tsx +179 -0
  513. package/src/components/steps/steps.test.tsx +235 -0
  514. package/src/components/steps/steps.tsx +686 -0
  515. package/src/components/switch/switch.tsx +7 -2
  516. package/src/components/table-of-contents/index.ts +17 -0
  517. package/src/components/table-of-contents/table-of-contents.test.tsx +289 -0
  518. package/src/components/table-of-contents/table-of-contents.tsx +708 -0
  519. package/src/components/tags-input/tags-input.tsx +12 -3
  520. package/src/components/textarea/textarea.tsx +15 -5
  521. package/src/components/tooltip/tooltip.tsx +8 -17
  522. package/src/components/tour/conditions.test.ts +527 -0
  523. package/src/components/tour/conditions.ts +445 -0
  524. package/src/components/tour/create-tours.tsx +150 -0
  525. package/src/components/tour/index.ts +86 -0
  526. package/src/components/tour/runtime.ts +187 -0
  527. package/src/components/tour/storage.test.ts +68 -0
  528. package/src/components/tour/storage.ts +44 -0
  529. package/src/components/tour/store.test.tsx +784 -0
  530. package/src/components/tour/store.ts +661 -0
  531. package/src/components/tour/tour.test.tsx +318 -0
  532. package/src/components/tour/tour.tsx +773 -0
  533. package/src/components/tour/tour.types.test.ts +185 -0
  534. package/src/components/tour/types.ts +904 -0
  535. package/src/components/tree/index.ts +24 -0
  536. package/src/components/tree/tree-row.tsx +179 -0
  537. package/src/components/tree/tree.test.tsx +296 -0
  538. package/src/components/tree/tree.tsx +796 -0
  539. package/src/components/tree-multi-select/tree-multi-select.tsx +29 -58
  540. package/src/components/tree-select/tree-popover.tsx +26 -107
  541. package/src/components/tree-select/tree-select.tsx +24 -16
  542. package/src/icon-stroke.test.tsx +2 -0
  543. package/src/index.ts +16 -0
  544. package/src/lib/date-predicates.test.ts +46 -0
  545. package/src/lib/date-predicates.ts +44 -24
  546. package/src/lib/date-value.test.ts +24 -1
  547. package/src/lib/date-value.ts +42 -1
  548. package/src/lib/floating-arrow.tsx +73 -0
  549. package/src/lib/focus-return.test.tsx +143 -0
  550. package/src/lib/focus-return.ts +106 -0
  551. package/src/lib/meter.test.ts +40 -0
  552. package/src/lib/meter.ts +159 -0
  553. package/src/lib/overlay-layer.test.tsx +47 -1
  554. package/src/lib/overlay-layer.tsx +65 -8
  555. package/src/lib/pressed.ts +130 -0
  556. package/src/lib/tree-data.ts +42 -2
  557. package/src/lib/use-pagination.test.ts +105 -0
  558. package/src/lib/use-pagination.ts +179 -0
  559. package/src/lib/use-scroll-spy.test.tsx +238 -0
  560. package/src/lib/use-scroll-spy.ts +336 -0
  561. package/src/theme.css +39 -3
  562. package/src/theme.test.ts +29 -1
  563. package/src/visually-hidden-containment.test.tsx +9 -0
  564. package/dist/chunk-2W7H43WL.js.map +0 -1
  565. package/dist/chunk-7E7JNWOC.js.map +0 -1
  566. package/dist/chunk-7FPSQBWB.js.map +0 -1
  567. package/dist/chunk-7KFUFAVP.js.map +0 -1
  568. package/dist/chunk-AKXALCUN.js.map +0 -1
  569. package/dist/chunk-B5YHYI7E.js.map +0 -1
  570. package/dist/chunk-FQJNQW3G.js.map +0 -1
  571. package/dist/chunk-G3AD3NJG.js.map +0 -1
  572. package/dist/chunk-GEZYGBXY.js.map +0 -1
  573. package/dist/chunk-HCHGERDB.js.map +0 -1
  574. package/dist/chunk-HWBFRDX7.js.map +0 -1
  575. package/dist/chunk-I4B3N3UX.js.map +0 -1
  576. package/dist/chunk-IA6DCC3N.js.map +0 -1
  577. package/dist/chunk-IANYMDKH.js.map +0 -1
  578. package/dist/chunk-MQHD3EJE.js.map +0 -1
  579. package/dist/chunk-NNPSBC7O.js.map +0 -1
  580. package/dist/chunk-OXR7BXZA.js.map +0 -1
  581. package/dist/chunk-QKSLDQM2.js +0 -120
  582. package/dist/chunk-QKSLDQM2.js.map +0 -1
  583. package/dist/chunk-QRNQQIQM.js.map +0 -1
  584. package/dist/chunk-RKCUXOU2.js.map +0 -1
  585. package/dist/chunk-S5CQRCTF.js +0 -426
  586. package/dist/chunk-S5CQRCTF.js.map +0 -1
  587. package/dist/chunk-SBZJGFZ6.js.map +0 -1
  588. package/dist/chunk-SP6LCCTZ.js.map +0 -1
  589. package/dist/chunk-TUP7WXQE.js.map +0 -1
  590. package/dist/chunk-V2QZG4IT.js.map +0 -1
  591. package/dist/chunk-X6DESK37.js.map +0 -1
  592. package/dist/chunk-ZB5VMGKB.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"date-predicates.d.ts","sourceRoot":"","sources":["../../src/lib/date-predicates.ts"],"names":[],"mappings":"AAsBA;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,OAAO,CAAA;AAEtE;;sGAEsG;AACtG,eAAO,MAAM,WAAW,QAClB,aAE8D,CAAA;AAEpE;qBACqB;AACrB,eAAO,MAAM,aAAa,QACpB,aAE8D,CAAA;AAEpE,iCAAiC;AACjC,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AEgC,CAAA"}
@@ -55,4 +55,24 @@ export declare function toArkValues(value: Date | DateRangeValue | null | undefi
55
55
  * `end` still `null`), not an error.
56
56
  */
57
57
  export declare function fromArkValues(values: DateValue[], range: boolean, timeZone: string): Date | DateRangeValue | null;
58
+ /**
59
+ * The unit a picker's value is made of: a day (`DatePicker`, `Calendar`), a month
60
+ * (`MonthPicker`, `MonthCalendar`) or a year (`YearPicker`, `YearCalendar`). It is the machine's
61
+ * own `minView`: the lowest view the grid can reach is the one whose cell commits the value.
62
+ */
63
+ export type DateUnit = "day" | "month" | "year";
64
+ /**
65
+ * The value a `unit`-level picker holds for `value`: the first day of its month or year, as a
66
+ * time-less `CalendarDate`. A `"day"` value passes through untouched. Ark's machine already
67
+ * snaps a *picked* cell this way (`normalizeValue`); this is the same rule for the values the
68
+ * app hands in (`value`, `defaultValue`, a preset), so they come back out on the first day too.
69
+ */
70
+ export declare function snapToUnit(value: DateValue, unit: DateUnit): DateValue;
71
+ /**
72
+ * A `min` (`edge: "start"`) or `max` (`edge: "end"`) bound widened to the whole `unit` it falls
73
+ * in. Ark compares a month cell as one of its days, so a `min` of March 15th would disable March
74
+ * itself, and clamp a picked March 1st up to the 15th. Widened, a bound reads as "the month
75
+ * holding this day", which is what a month picker means by it.
76
+ */
77
+ export declare function snapBound(value: DateValue, unit: DateUnit, edge: "start" | "end"): DateValue;
58
78
  //# sourceMappingURL=date-value.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"date-value.d.ts","sourceRoot":"","sources":["../../src/lib/date-value.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAgC,MAAM,yBAAyB,CAAA;AAEtF;;;;;;;;;;GAUG;AAEH;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAAE,KAAK,EAAE,IAAI,GAAG,IAAI,CAAC;IAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CAAA;CAAE,CAAA;AAErE,uFAAuF;AACvF,wBAAgB,mBAAmB,CAAC,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ACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,IAAI,GAAG,cAAc,GAAG,IAAI,GAAG,SAAS,EAC/C,QAAQ,EAAE,MAAM,GACf,SAAS,EAAE,GAAG,SAAS,CAQzB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,SAAS,EAAE,EACnB,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,MAAM,GACf,IAAI,GAAG,cAAc,GAAG,IAAI,CAU9B;AAED;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAA;AAE/C;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,GAAG,SAAS,CAItE;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,GAAG,KAAK,GAAG,SAAS,CAK5F"}
@@ -0,0 +1,53 @@
1
+ import type { ComponentType, CSSProperties, JSX, ReactNode } from "react";
2
+ import type { NoAsChild } from "./as-child";
3
+ import type { WithTestId } from "./test-id";
4
+ /**
5
+ * The kit's floating arrow: the small rotated square that points a floating
6
+ * panel (Tooltip's bubble, a Tour step's card) at its anchor.
7
+ *
8
+ * Ark gives every floating machine the same two parts, `Arrow` (a sized,
9
+ * positioned box) and `ArrowTip` (the rotated square inside it), each scoped
10
+ * to its own machine. The recipe on top is what the kit shares: the square's
11
+ * size, how far it tucks back under the panel, and the classes that hide all
12
+ * but its tip. Only the surface colour differs per component, so it is the
13
+ * one thing `createFloatingArrow` takes besides the two Ark parts.
14
+ */
15
+ /** The arrow's size, and how far it pulls back under the panel (`--arrow-offset`)
16
+ * so it reads as a pointer, not a detached diamond. Ark reads both vars. */
17
+ export declare const floatingArrowVars: CSSProperties;
18
+ /** `-z-1` tucks the square behind the panel's content. The `!` is required
19
+ * because Ark positions the tip with an inline style (`z-index: inherit`).
20
+ *
21
+ * It is not behind the panel's own fill, though: the panel is a stacking
22
+ * context, and a negative z-index child still paints over its root's
23
+ * background. So the square is clipped to the corner that pokes out. With a
24
+ * 12px square pulled back 8px, its centre sits 3px inside the panel's edge,
25
+ * 2px below a 1px border; cutting 2px short of the diagonal (2√2 ≈ 2.83px of
26
+ * the 12px sides, so 76%) ends a bordered tip's two edges on the border's
27
+ * inner line, instead of running on into the panel as two stray legs. */
28
+ export declare const floatingArrowTip = "-z-1! rounded-xxs [clip-path:polygon(0_0,76%_0,0_76%)]";
29
+ /** The props every Ark `*.Arrow` part shares that the recipe touches. */
30
+ type ArkArrowProps = {
31
+ style?: CSSProperties;
32
+ children?: ReactNode;
33
+ };
34
+ /** Props of an arrow built by `createFloatingArrow`: the Ark part's own props
35
+ * (no `asChild`: the part renders its tip inside itself), plus `testId`. */
36
+ export type FloatingArrowProps<P extends ArkArrowProps> = NoAsChild<P> & WithTestId & {
37
+ /** Classes for the tip, the visible square. */
38
+ className?: string;
39
+ };
40
+ /**
41
+ * Builds a component's arrow part from its Ark `Arrow` and `ArrowTip`.
42
+ * `surface` paints the tip to match the panel, with `!` because Ark sets the
43
+ * tip's background inline (`var(--arrow-background)`).
44
+ *
45
+ * ```tsx
46
+ * const Arrow = createFloatingArrow(ArkTooltip.Arrow, ArkTooltip.ArrowTip, "bg-brand-950! dark:bg-white!")
47
+ * ```
48
+ */
49
+ export declare function createFloatingArrow<P extends ArkArrowProps>(ArkArrow: ComponentType<P>, ArkArrowTip: ComponentType<{
50
+ className?: string;
51
+ }>, surface: string): (props: FloatingArrowProps<P>) => JSX.Element;
52
+ export {};
53
+ //# sourceMappingURL=floating-arrow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"floating-arrow.d.ts","sourceRoot":"","sources":["../../src/lib/floating-arrow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAG3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE3C;;;;;;;;;;GAUG;AAEH;6EAC6E;AAC7E,eAAO,MAAM,iBAAiB,EAGzB,aAAa,CAAA;AAElB;;;;;;;;;0EAS0E;AAC1E,eAAO,MAAM,gBAAgB,2DAA2D,CAAA;AAExF,yEAAyE;AACzE,KAAK,aAAa,GAAG;IAAE,KAAK,CAAC,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,CAAA;AAEpE;6EAC6E;AAC7E,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,aAAa,IAAI,SAAS,CAAC,CAAC,CAAC,GACpE,UAAU,GAAG;IACX,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAEH;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,aAAa,EACzD,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,WAAW,EAAE,aAAa,CAAC;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,EAClD,OAAO,EAAE,MAAM,GACd,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,OAAO,CAW/C"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Gives focus back to where it was before a layer took it.
3
+ *
4
+ * zag's Dialog and Popover do this themselves (`finalFocusEl`, `restoreFocus`),
5
+ * through their focus trap's `returnFocusOnDeactivate`. Not every machine
6
+ * does: zag's Tour traps focus with `returnFocusOnDeactivate: false`, so when a
7
+ * tour ends, focus is left on a card that no longer exists and drops to
8
+ * `<body>`. This is the same behaviour as a standalone piece, for any layer
9
+ * that has to bring it itself.
10
+ *
11
+ * Two rules, both from how the dialogs behave:
12
+ *
13
+ * - **Only reclaim focus the layer owns.** If focus has moved somewhere else
14
+ * by the time the layer closes (the user clicked into a field outside it,
15
+ * which is what closed it), it stays there. Focus is restored only when it
16
+ * sits on `<body>` (where it falls when the focused node unmounts) or
17
+ * inside the layer (`within`).
18
+ * - **Never steal it to somewhere stale.** The remembered element must still
19
+ * be connected, enabled and outside an `inert` subtree, or nothing happens.
20
+ * A tour that navigated away from its starting page leaves focus alone.
21
+ */
22
+ /** The element focus is on right now, looking through open shadow roots. */
23
+ export declare const deepActiveElement: (root?: Document | ShadowRoot) => Element | null;
24
+ /** Where focus may be taken back from: the layer's own elements. */
25
+ export type FocusReturnWithin = () => readonly (Element | null | undefined)[];
26
+ /** A captured focus position. */
27
+ export type FocusReturn = {
28
+ /** Remembers the element focus is on now. Call it when the layer opens. */
29
+ capture: () => void;
30
+ /**
31
+ * Moves focus back to the remembered element, under the rules above, and
32
+ * forgets it. Returns whether focus moved. Uses `preventScroll`: the layer
33
+ * may have scrolled the page (a tour scrolls each target into view), and
34
+ * focus coming back must not yank it again.
35
+ */
36
+ restore: () => boolean;
37
+ };
38
+ /** Remembers one focus position and restores it. Framework-free, for a layer
39
+ * driven outside React (a store, a machine's callbacks). */
40
+ export declare function createFocusReturn(within?: FocusReturnWithin): FocusReturn;
41
+ /**
42
+ * `createFocusReturn` for a React layer: captures when `open` turns true and
43
+ * restores when it turns false (or the component unmounts while open).
44
+ *
45
+ * The capture runs in a layout effect, so it sees focus as it was before
46
+ * zag's focus trap moves it into the layer (zag waits a frame). It does not
47
+ * beat a child's own `autoFocus` or layout effect, which commit first: a
48
+ * layer that grabs focus synchronously on mount should capture with
49
+ * `createFocusReturn` where it opens instead (the tour store does, when a
50
+ * run starts).
51
+ */
52
+ export declare function useFocusReturn(open: boolean, within?: FocusReturnWithin): void;
53
+ //# sourceMappingURL=focus-return.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus-return.d.ts","sourceRoot":"","sources":["../../src/lib/focus-return.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,4EAA4E;AAC5E,eAAO,MAAM,iBAAiB,UAAU,QAAQ,GAAG,UAAU,KAAc,OAAO,GAAG,IAGpF,CAAA;AAQD,oEAAoE;AACpE,MAAM,MAAM,iBAAiB,GAAG,MAAM,SAAS,CAAC,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,CAAA;AAE7E,iCAAiC;AACjC,MAAM,MAAM,WAAW,GAAG;IACxB,2EAA2E;IAC3E,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB;;;;;OAKG;IACH,OAAO,EAAE,MAAM,OAAO,CAAA;CACvB,CAAA;AAED;6DAC6D;AAC7D,wBAAgB,iBAAiB,CAAC,MAAM,GAAE,iBAA4B,GAAG,WAAW,CAqBnF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAc9E"}
@@ -0,0 +1,104 @@
1
+ import type { Unavailable } from "./available-if";
2
+ import type { Color } from "./colors";
3
+ /**
4
+ * Meter mode, shared by `Progress` and `CircularProgress`.
5
+ *
6
+ * A progress bar says "a task is advancing"; a meter says "this is how full
7
+ * something is": an XP level, disk usage, a quota, a score. Both look the same,
8
+ * so the kit draws them with the same components and flips the semantics with
9
+ * one prop, `meter`, the way HTML has `<progress>` and `<meter>` side by side.
10
+ *
11
+ * Ark's Progress machine has no meter mode (it hard-codes `role="progressbar"`
12
+ * and never writes `aria-valuetext`), but it already owns everything else a
13
+ * meter needs: the min/max/percent math, the ring geometry, the locale-aware
14
+ * `Intl.NumberFormat` (`locale` + `formatOptions`) and the `translations.value`
15
+ * override. So meter mode keeps the machine and only overrides the role and
16
+ * the value text on the element Ark stamps them on.
17
+ *
18
+ * The thresholds follow HTML `<meter>`'s `low` / `high` / `optimum` exactly,
19
+ * including its region algorithm (`meterZone` below), and map each region onto
20
+ * one of the kit's palettes (`METER_ZONE_COLORS`).
21
+ */
22
+ /** Which region of the scale the value sits in, as HTML `<meter>` defines it:
23
+ * `good` is the optimum region, `warning` the suboptimal one, `critical` the
24
+ * "even less good" one. */
25
+ export type MeterZone = "good" | "warning" | "critical";
26
+ /** The palette each zone paints with. Fixed palettes, not slot overrides, so a
27
+ * consumer's own `[data-color]` blocks restyle them like any other component. */
28
+ export declare const METER_ZONE_COLORS: Record<MeterZone, Color>;
29
+ /**
30
+ * The `meter` flag and everything it gates, as one object type.
31
+ *
32
+ * `M` is the component's own type parameter, inferred from `meter` at the JSX
33
+ * call site, and each gated prop carries its own condition on it, the same
34
+ * per-property shape as `AvailableIf`:
35
+ *
36
+ * - `meter` (`M` = `true`): `value={null}` is a type error, whose message
37
+ * carries the brand's reason.
38
+ * - no `meter` (`M` falls to the component's default, `false`): `low` / `high`
39
+ * / `optimum` are errors.
40
+ * - `M` = `boolean` (a dynamic `meter={flag}`, or a generic consumer reading
41
+ * `ProgressProps` with no argument): everything is available, and `value` is
42
+ * plain `number | null`. The runtime guard in `arkValue` covers that case.
43
+ *
44
+ * Deliberately not a union of a meter and a progressbar shape. A union reaches
45
+ * every consumer that takes the props generically (`Omit<ProgressProps, …>`
46
+ * merges its halves; a `ComponentType<Partial<P>>` helper infers `P` from it
47
+ * and sees the brand inside `value`), so the rule would leak out of the call
48
+ * site it exists for. Per-key conditionals keep the object one object.
49
+ *
50
+ * The brand is written inline, not behind an alias: the alias name would
51
+ * stand in for its reason in the error the caller reads.
52
+ */
53
+ export type MeterProps<M extends boolean> = {
54
+ /**
55
+ * Announce a measurement (`role="meter"`, like HTML `<meter>`) instead of a
56
+ * task's progress (`role="progressbar"`). For a level, a usage, a score or a
57
+ * capacity. A meter is never indeterminate, so `value={null}` is a type error.
58
+ */
59
+ meter?: M;
60
+ /**
61
+ * Controlled value in `min..max`. Pass `null` for the indeterminate state
62
+ * (never with `meter`). Leave unset (with no `defaultValue`) for an
63
+ * uncontrolled bar.
64
+ */
65
+ value?: [M] extends [true] ? number | Unavailable<"a meter is never indeterminate: pass a number, or drop `meter`"> : number | null;
66
+ /** Uncontrolled initial value. Pass `null` to start indeterminate (never with `meter`). */
67
+ defaultValue?: [M] extends [true] ? number | Unavailable<"a meter is never indeterminate: pass a number, or drop `meter`"> : number | null;
68
+ /** Fires on every value change. A meter's value is never `null`. */
69
+ onChange?: (value: [M] extends [true] ? number : number | null) => void;
70
+ /** Meter only. Upper bound of the low region. Defaults to `min`. Like `<meter low>`. */
71
+ low?: [M] extends [false] ? Unavailable<"thresholds need `meter`: a task's progress has no good or bad zone"> | undefined : number;
72
+ /** Meter only. Lower bound of the high region. Defaults to `max`. Like `<meter high>`. */
73
+ high?: [M] extends [false] ? Unavailable<"thresholds need `meter`: a task's progress has no good or bad zone"> | undefined : number;
74
+ /** Meter only. The best value: its region is `good`, the next `warning`, the
75
+ * far one `critical`. Defaults to the midpoint. Like `<meter optimum>`. */
76
+ optimum?: [M] extends [false] ? Unavailable<"thresholds need `meter`: a task's progress has no good or bad zone"> | undefined : number;
77
+ };
78
+ /** The value and threshold props as the component reads them once destructured
79
+ * (the brands are unconstructible, so only these shapes reach runtime). */
80
+ export type MeterRuntime = {
81
+ meter?: boolean;
82
+ value?: unknown;
83
+ defaultValue?: unknown;
84
+ low?: unknown;
85
+ high?: unknown;
86
+ optimum?: unknown;
87
+ };
88
+ /**
89
+ * The value to hand Ark. A meter that still receives `null` (plain JS, a cast)
90
+ * would otherwise turn indeterminate, which a meter cannot be: warn, and read
91
+ * it as `min` instead.
92
+ */
93
+ export declare const arkValue: (component: string, meter: boolean | undefined, value: unknown, min: number) => number | null | undefined;
94
+ /**
95
+ * The zone `value` falls in, or `undefined` when no threshold is set (the bar
96
+ * then keeps its `color`). This is HTML's `<meter>` algorithm as browsers ship
97
+ * it: thresholds clamp into `min..max` (and `high` to at least `low`), then
98
+ * the region holding `optimum` is `good`.
99
+ */
100
+ export declare const meterZone: (value: number | null, { min, max, ...thresholds }: MeterRuntime & {
101
+ min: number;
102
+ max: number;
103
+ }) => MeterZone | undefined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AC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GACtB,WAAW,CAAC,oEAAoE,CAAC,GAAG,SAAS,GAC7F,MAAM,CAAA;IACV;gFAC4E;IAC5E,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GACzB,WAAW,CAAC,oEAAoE,CAAC,GAAG,SAAS,GAC7F,MAAM,CAAA;CACX,CAAA;AAED;4EAC4E;AAC5E,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,QAAQ,cACR,MAAM,SACV,OAAO,GAAG,SAAS,SACnB,OAAO,OACT,MAAM,KACV,MAAM,GAAG,IAAI,GAAG,SAMlB,CAAA;AAKD;;;;;GAKG;AACH,eAAO,MAAM,SAAS,UACb,MAAM,GAAG,IAAI,+BACS,YAAY,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,KACvE,SAAS,GAAG,SAmBd,CAAA"}
@@ -36,6 +36,21 @@ export type OverlayLayers = Set<symbol>;
36
36
  /** Whether a Modal, Drawer or Lightbox is open right now. The notifier asks
37
37
  * when a toast is created, to raise it above the modal (`--toast-raised-z`). */
38
38
  export declare const isModalOpen: () => boolean;
39
+ /** Calls `listener` whenever a Modal, Drawer, Lightbox or tour opens or
40
+ * closes. Returns the unsubscribe. */
41
+ export declare const subscribeLayers: (listener: () => void) => () => void;
42
+ /** Whether a tour is showing right now. */
43
+ export declare const isTourOpen: () => boolean;
44
+ /**
45
+ * For a floating panel (Popover, Menu, HoverCard, Select, Combobox,
46
+ * DatePicker): whether it must be lifted above a running tour. A panel
47
+ * opened from the element a tour highlights would otherwise paint under the
48
+ * tour's backdrop. Spread the result as `data-raised` on the content part;
49
+ * `theme.css` moves a raised panel into the `--tour-z` band, above the
50
+ * tour's card. False while the panel is closed, so a closed panel never
51
+ * re-renders when a tour starts or ends.
52
+ */
53
+ export declare const useTourRaised: (open: boolean) => boolean;
39
54
  /** For a parent layer. Spread `onPointerDownOutside` onto the Ark root
40
55
  * (composed with the caller's own) and wrap the children that may open nested
41
56
  * layers in `OverlayLayerProvider`. A ref'd set, not state: it's read synchronously while
@@ -48,21 +63,24 @@ export declare const OverlayLayerProvider: ({ value, children, }: {
48
63
  value: OverlayLayers;
49
64
  children?: ReactNode;
50
65
  }) => import("react").JSX.Element;
66
+ /** What kind of layer registers, beyond counting in its parent's set. */
67
+ export type NestedLayerOptions = {
68
+ /** A Modal, Drawer or Lightbox, which `isModalOpen` counts. */
69
+ modal?: boolean;
70
+ /** A tour, which `isTourOpen` counts and `useTourRaised` answers to. */
71
+ tour?: boolean;
72
+ };
51
73
  /** For a child layer: registers with the nearest parent (the page's set when
52
74
  * none encloses it) while `open`. Keyed on
53
75
  * `open`, not presence, so a panel playing its exit animation no longer holds
54
76
  * the parent's next click. A layout effect so the registration is in place
55
- * before the browser can deliver the next pointerdown. `modal` marks a
56
- * Modal, Drawer or Lightbox, which `isModalOpen` counts. */
57
- export declare const useNestedLayer: (open: boolean, { modal }?: {
58
- modal?: boolean;
59
- }) => void;
77
+ * before the browser can deliver the next pointerdown. */
78
+ export declare const useNestedLayer: (open: boolean, { modal, tour }?: NestedLayerOptions) => void;
60
79
  /** `useNestedLayer` as an element, for call sites that only have the machine's
61
80
  * `open` inside a render prop (`<Ark.Context>{(api) => …}</Ark.Context>`). */
62
- export declare const NestedLayer: ({ open, modal }: {
81
+ export declare const NestedLayer: ({ open, modal, tour }: {
63
82
  open: boolean;
64
- modal?: boolean;
65
- }) => null;
83
+ } & NestedLayerOptions) => null;
66
84
  /** Whether a layer is open above the component calling this, right now: a
67
85
  * Modal, Drawer, Popover or picker that opened from the same layer (from the
68
86
  * page, for a component outside every overlay). Returns a reader, not a
@@ -1 +1 @@
1
- {"version":3,"file":"overlay-layer.d.ts","sourceRoot":"","sources":["../../src/lib/overlay-layer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,SAAS,EAAmC,MAAM,OAAO,CAAA;AAGtF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC,MAAM,CAAC,CAAA;AAevC;iFACiF;AACjF,eAAO,MAAM,WAAW,eAA6B,CAAA;AAWrD;;;4EAG4E;AAC5E,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,KAAK,yBAAyB,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI;;kCAG5E,CAAC;CAOZ,CAAA;AAED,eAAO,MAAM,oBAAoB,yBAG9B;IACD,KAAK,EAAE,aAAa,CAAA;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,gCAA0F,CAAA;AAE3F;;;;;6DAK6D;AAC7D,eAAO,MAAM,cAAc,SAAU,OAAO,cAAqB;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,SAYnF,CAAA;AAED;+EAC+E;AAC/E,eAAO,MAAM,WAAW,oBAAqB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,SAG9E,CAAA;AAED;;;;mCAImC;AACnC,eAAO,MAAM,eAAe,QAAO,CAAC,MAAM,OAAO,CAGhD,CAAA"}
1
+ {"version":3,"file":"overlay-layer.d.ts","sourceRoot":"","sources":["../../src/lib/overlay-layer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,SAAS,EAKf,MAAM,OAAO,CAAA;AAGd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC,MAAM,CAAC,CAAA;AAevC;iFACiF;AACjF,eAAO,MAAM,WAAW,eAA6B,CAAA;AAarD;uCACuC;AACvC,eAAO,MAAM,eAAe,aAAc,MAAM,IAAI,eAKnD,CAAA;AAED,2CAA2C;AAC3C,eAAO,MAAM,UAAU,eAA4B,CAAA;AAEnD;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,SAAU,OAAO,KAAG,OAG7C,CAAA;AAWD;;;4EAG4E;AAC5E,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,KAAK,yBAAyB,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI;;kCAG5E,CAAC;CAOZ,CAAA;AAED,eAAO,MAAM,oBAAoB,yBAG9B;IACD,KAAK,EAAE,aAAa,CAAA;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,gCAA0F,CAAA;AAE3F,yEAAyE;AACzE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,+DAA+D;IAC/D,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,wEAAwE;IACxE,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED;;;;2DAI2D;AAC3D,eAAO,MAAM,cAAc,SACnB,OAAO,oBACoB,kBAAkB,SAgBpD,CAAA;AAED;+EAC+E;AAC/E,eAAO,MAAM,WAAW,0BAA2B;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,kBAAkB,SAGxF,CAAA;AAED;;;;mCAImC;AACnC,eAAO,MAAM,eAAe,QAAO,CAAC,MAAM,OAAO,CAGhD,CAAA"}
@@ -0,0 +1,92 @@
1
+ import { type MouseEvent, type MouseEventHandler, type ReactNode } from "react";
2
+ import type { Unavailable } from "./available-if";
3
+ /**
4
+ * The toggle (pressed) state shared by `Button` and `ActionIcon`.
5
+ *
6
+ * Passing `pressed`, `defaultPressed` or `onPressedChange` turns the control
7
+ * into a toggle button: it renders `aria-pressed`, a click flips the state,
8
+ * and its look swaps from `variant` to `pressedVariant`, the same swap
9
+ * `ButtonSelect` makes with `selectedVariant`. Without any of the three the
10
+ * control renders exactly as before: no `aria-pressed`, no extra click work.
11
+ *
12
+ * Built on `useUncontrolled` rather than Ark's `toggle` machine. The machine
13
+ * holds one boolean and flips it on click, but its root props bring their own
14
+ * `type="button"`, `disabled` and an `onClick` that knows nothing of
15
+ * `loading`, all of which `Button` already owns (and gets right under
16
+ * `asChild`, where `disabled` does nothing). Every Button would also start a
17
+ * zag service it mostly never uses, since a hook can't be called
18
+ * conditionally. The state is the only part worth sharing, and this is it.
19
+ */
20
+ export type PressedProps<Variant extends string> = {
21
+ /**
22
+ * Controlled pressed state. Passing it (or `defaultPressed`, or
23
+ * `onPressedChange`) makes the control a toggle: it renders `aria-pressed`
24
+ * and a click flips the state.
25
+ */
26
+ pressed?: boolean;
27
+ /** Uncontrolled initial pressed state. */
28
+ defaultPressed?: boolean;
29
+ /** Fires with the next pressed state when a click flips it. */
30
+ onPressedChange?: (pressed: boolean) => void;
31
+ /**
32
+ * Treatment while pressed, the toggle's counterpart of `ButtonSelect`'s
33
+ * `selectedVariant`. A toggle's `variant` (its unpressed look) defaults to
34
+ * `light` and this to `filled`, the same pair as `ButtonSelect`, so a lone
35
+ * toggle and one in a group look alike.
36
+ */
37
+ pressedVariant?: Variant;
38
+ };
39
+ /**
40
+ * Why a toggle can't be a link, printed verbatim in the compile error and
41
+ * the dev warning.
42
+ */
43
+ export type PressedLinkReason = "aria-pressed has no meaning on a link: a toggle must render a <button>, not an <a>";
44
+ /**
45
+ * `href` forbidden on `Button` and `ActionIcon`, carrying the reason.
46
+ *
47
+ * Both render a `<button>`, which has no `href`, and the only way to make one
48
+ * a link is `asChild` around an `<a>` or a router `Link`. TypeScript can't see
49
+ * through that (every JSX child is a plain `JSX.Element`), so the runtime
50
+ * guard in `usePressed` covers it. What the type *can* catch is an `href`
51
+ * forwarded in a prop bag — `<Button pressed {...linkProps} />` — which would
52
+ * otherwise land silently on the `<button>`. Omitting the key wouldn't: excess
53
+ * property checks skip JSX spreads. See `available-if.ts` for the brand.
54
+ */
55
+ export type ForbidHref = {
56
+ /** Unavailable: a Button renders a `<button>`. For a link, use `asChild`
57
+ * around an `<a>`, without the pressed props. */
58
+ href?: Unavailable<PressedLinkReason> | undefined;
59
+ };
60
+ /**
61
+ * A link child under `asChild`: an `<a>`, or any element carrying an `href`
62
+ * (Next's `Link`) or a `to` (TanStack Router's and React Router's `Link`).
63
+ */
64
+ export declare const isLinkElement: (child: ReactNode) => boolean;
65
+ type UsePressedOptions = Pick<PressedProps<string>, "pressed" | "defaultPressed" | "onPressedChange"> & {
66
+ /** Native `disabled` or `loading`: a click never flips the state. Needed
67
+ * for an `asChild` element, where native `disabled` doesn't stop clicks. */
68
+ disabled: boolean;
69
+ /** The consumer's own `onClick`, run first. Calling `preventDefault` in it
70
+ * keeps the state as it is. */
71
+ onClick: MouseEventHandler<HTMLButtonElement> | undefined;
72
+ /** Whether the `asChild` child is a link (`isLinkElement`). */
73
+ link: boolean;
74
+ /** Component name, for the dev warning. */
75
+ component: string;
76
+ };
77
+ /**
78
+ * Resolves a control's toggle state. `toggle` is false unless one of the
79
+ * pressed props is passed (and the control isn't a link), and then `onClick`
80
+ * is the consumer's own, untouched.
81
+ */
82
+ export declare const usePressed: ({ pressed: pressedProp, defaultPressed, onPressedChange, disabled, onClick, link, component, }: UsePressedOptions) => {
83
+ toggle: false;
84
+ pressed: boolean;
85
+ onClick: MouseEventHandler<HTMLButtonElement> | undefined;
86
+ } | {
87
+ toggle: true;
88
+ pressed: boolean;
89
+ onClick: (event: MouseEvent<HTMLButtonElement>) => void;
90
+ };
91
+ export {};
92
+ //# sourceMappingURL=pressed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pressed.d.ts","sourceRoot":"","sources":["../../src/lib/pressed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAC/F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAIjD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,YAAY,CAAC,OAAO,SAAS,MAAM,IAAI;IACjD;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,0CAA0C;IAC1C,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,+DAA+D;IAC/D,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IAC5C;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAC3B,oFAAoF,CAAA;AAKtF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB;sDACkD;IAClD,IAAI,CAAC,EAAE,WAAW,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAAA;CAClD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,UAAW,SAAS,KAAG,OAE2B,CAAA;AAE5E,KAAK,iBAAiB,GAAG,IAAI,CAC3B,YAAY,CAAC,MAAM,CAAC,EACpB,SAAS,GAAG,gBAAgB,GAAG,iBAAiB,CACjD,GAAG;IACF;iFAC6E;IAC7E,QAAQ,EAAE,OAAO,CAAA;IACjB;oCACgC;IAChC,OAAO,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAAA;IACzD,+DAA+D;IAC/D,IAAI,EAAE,OAAO,CAAA;IACb,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU,mGAQpB,iBAAiB;;;;;;;qBAiBC,UAAU,CAAC,iBAAiB,CAAC;CAMjD,CAAA"}
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Shared tree model + pure helpers for the hierarchical pickers (TreeSelect,
3
- * TreeMultiSelect). `data` is a tree of `{ value, label, disabled?, children? }`;
2
+ * Shared tree model + pure helpers for the hierarchical components (Tree,
3
+ * TreeSelect, TreeMultiSelect). `data` is a tree of `{ value, label, disabled?, children? }`;
4
4
  * a node with `children` is a *branch*, one without is a *leaf*. These helpers
5
5
  * are selection-agnostic — the single / multi cascade logic lives in each
6
6
  * component (mirrors `lib/select-data.ts` for the flat pickers).
@@ -24,6 +24,12 @@ export type TreeNodeData<P = unknown> = {
24
24
  * there's no free `data-part` / `data-value` here — `testId` is the row's
25
25
  * only stable selector. */
26
26
  testId?: string;
27
+ /** `Tree` only: a branch whose children aren't in `data` yet. Expanding it calls the tree's
28
+ * `loadChildren` once, then shows what it returns. The pickers ignore it. */
29
+ hasChildren?: boolean;
30
+ /** `Tree` only: this node's icon, in place of the default folder / file. `null` draws none.
31
+ * The pickers ignore it. */
32
+ icon?: ReactNode;
27
33
  };
28
34
  /**
29
35
  * A tree picker's `data` shape. Not generic over the node payload here (a
@@ -100,5 +106,15 @@ export declare const flattenTree: (nodes: ReadonlyArray<TreeNodeData>, inherited
100
106
  * because this is a plain function: accents and case fold away, Turkish keeps its i's apart.
101
107
  */
102
108
  export declare const filterTree: <P>(nodes: ReadonlyArray<TreeNodeData<P>>, query: string, matches: LabelSearch["matches"]) => TreeNodeData<P>[];
109
+ /** Every *enabled* leaf value under `node` (the node itself when it's a leaf). */
110
+ export declare const getLeafValues: (node: TreeNodeData, acc?: string[]) => string[];
111
+ /** A checkbox tree's tri-state per node. */
112
+ export type TreeCheckState = "checked" | "indeterminate" | "unchecked";
113
+ /** Tri-state of a node, derived from the set of checked leaf values: a branch is checked when
114
+ * all its enabled leaves are, indeterminate when some are. */
115
+ export declare const getCheckState: (node: TreeNodeData, checked: ReadonlySet<string>) => TreeCheckState;
116
+ /** Toggle a node in a leaf selection: a fully checked node clears its leaves, any other selects
117
+ * them all. Disabled leaves keep their state. */
118
+ export declare const toggleChecked: (node: TreeNodeData, current: readonly string[]) => string[];
103
119
  export {};
104
120
  //# sourceMappingURL=tree-data.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":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eAAO,MAAM,MAAM,SAAU,YAAY,KAAG,OAAuD,CAAA;AAEnG,iGAAiG;AACjG,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;;;CAYjE,CAAA;AAED,qFAAqF;AACrF,eAAO,MAAM,WAAW,UACf,aAAa,CAAC,YAAY,CAAC,qBACf,OAAO,QACrB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,EAAE,KAC1C;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,EAOtC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,SACnB,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAC9B,MAAM,WACJ,WAAW,CAAC,SAAS,CAAC,KAC9B,YAAY,CAAC,CAAC,CAAC,EAkBjB,CAAA;AAED,kFAAkF;AAClF,eAAO,MAAM,aAAa,SAAU,YAAY,QAAO,MAAM,EAAE,KAAQ,MAAM,EAO5E,CAAA;AAED,4CAA4C;AAC5C,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,eAAe,GAAG,WAAW,CAAA;AAEtE;+DAC+D;AAC/D,eAAO,MAAM,aAAa,SAAU,YAAY,WAAW,WAAW,CAAC,MAAM,CAAC,KAAG,cAMhF,CAAA;AAED;kDACkD;AAClD,eAAO,MAAM,aAAa,SAAU,YAAY,WAAW,SAAS,MAAM,EAAE,KAAG,MAAM,EAOpF,CAAA"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * One slot of a pagination bar: a page number, or an ellipsis standing in for
3
+ * the pages it hides. `index` is the slot's position in `items`, a stable key.
4
+ */
5
+ export type PaginationItem = {
6
+ type: "page";
7
+ value: number;
8
+ } | {
9
+ type: "ellipsis";
10
+ index: number;
11
+ };
12
+ /**
13
+ * How many pages there are. Either the item total and the page size (the
14
+ * usual case: the server tells you how many rows match), or the page count
15
+ * itself (a CMS that already knows it has 12 pages).
16
+ */
17
+ export type PaginationTotal = {
18
+ /** How many items there are in all. With `pageSize`, sets the page count. */
19
+ count: number;
20
+ /** How many items one page holds. @default 10 */
21
+ pageSize?: number;
22
+ pages?: never;
23
+ } | {
24
+ /** How many pages there are, when you know it directly. */
25
+ pages: number;
26
+ count?: never;
27
+ pageSize?: never;
28
+ };
29
+ export type UsePaginationOptions = PaginationTotal & {
30
+ /** The current page, 1-based, when you control it. */
31
+ page?: number;
32
+ /** The page to start on when uncontrolled. @default 1 */
33
+ defaultPage?: number;
34
+ /** Called with the next page (1-based) when it changes. */
35
+ onPageChange?: (page: number) => void;
36
+ /** How many pages stay visible on each side of the current one. @default 1 */
37
+ siblings?: number;
38
+ /** How many pages stay visible at each end of the bar. @default 1 */
39
+ boundaries?: number;
40
+ };
41
+ export type UsePaginationReturnValue = {
42
+ /** The current page, 1-based, clamped to `[1, totalPages]`. `1` when there are no pages. */
43
+ page: number;
44
+ /** How many pages there are. `0` when there is nothing to page through. */
45
+ totalPages: number;
46
+ /** The pages to draw, with an ellipsis wherever pages are hidden. The length
47
+ * holds steady as the page moves (`2 × siblings + 2 × boundaries + 3` once
48
+ * there are more pages than that), so the bar never shifts under the pointer. */
49
+ items: PaginationItem[];
50
+ /** The items on the current page, 1-based and inclusive (`{ from: 21, to: 30 }`):
51
+ * what a "21–30 of 95" line prints, and `data.slice(from - 1, to)` for a
52
+ * list paged on the client. `null` when the total was given as `pages`. */
53
+ range: {
54
+ from: number;
55
+ to: number;
56
+ } | null;
57
+ /** Whether there is a page before this one. */
58
+ canPrevious: boolean;
59
+ /** Whether there is a page after this one. */
60
+ canNext: boolean;
61
+ /** Moves to `page`, clamped to the existing pages. Does nothing for the current page. */
62
+ setPage: (page: number) => void;
63
+ /** Moves to the previous page, if any. */
64
+ previous: () => void;
65
+ /** Moves to the next page, if any. */
66
+ next: () => void;
67
+ /** Moves to the first page. */
68
+ first: () => void;
69
+ /** Moves to the last page. */
70
+ last: () => void;
71
+ };
72
+ declare const ELLIPSIS: "ellipsis";
73
+ /**
74
+ * The page numbers to draw around `page`, with `"ellipsis"` for each run of
75
+ * hidden pages. Always the first and last `boundaries` pages, `siblings` on
76
+ * each side of `page`, and a constant slot count once the pages outnumber
77
+ * the slots: an ellipsis that would hide a single page shows that page
78
+ * instead, so the bar keeps its width as you page through it.
79
+ */
80
+ export declare const paginationRange: ({ page, totalPages, siblings, boundaries, }: {
81
+ page: number;
82
+ totalPages: number;
83
+ siblings?: number;
84
+ boundaries?: number;
85
+ }) => (number | typeof ELLIPSIS)[];
86
+ /**
87
+ * The page math behind a pagination bar, without the bar: the current page
88
+ * (controlled or not), the page count, the items to draw with their
89
+ * ellipses, the range of items on the page, and the moves between pages.
90
+ * `Pagination` is built on it. Reach for it to draw a pager of your own, or
91
+ * to page a list on the client:
92
+ *
93
+ * ```tsx
94
+ * const { items, range, setPage } = usePagination({ count: rows.length, pageSize: 20 })
95
+ * const visible = rows.slice(range.from - 1, range.to)
96
+ * ```
97
+ *
98
+ * Pages are 1-based throughout, as they are printed.
99
+ */
100
+ export declare function usePagination(options: UsePaginationOptions): UsePaginationReturnValue;
101
+ export {};
102
+ //# sourceMappingURL=use-pagination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-pagination.d.ts","sourceRoot":"","sources":["../../src/lib/use-pagination.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAElG;;;;GAIG;AACH,MAAM,MAAM,eAAe,GACvB;IACE,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAA;IACb,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,KAAK,CAAA;C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