@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
@@ -0,0 +1,904 @@
1
+ import type { ReactNode, RefObject } from "react"
2
+ import type { Unavailable } from "../../lib/available-if"
3
+ import type { Brand } from "../../lib/brand"
4
+ import type { Color } from "../../lib/colors"
5
+ import type { IconMap } from "../../lib/icons"
6
+ import type { LogicalPosition, Placement } from "../../lib/placement"
7
+
8
+ /**
9
+ * Public types for the tour manager: `createTours`, `defineTour`, the
10
+ * condition helpers and everything they hand to the app.
11
+ *
12
+ * Typing works like `createOverlays`' registry, without module augmentation:
13
+ * `defineTour` infers each tour's step ids, the gate keys and signal names its
14
+ * conditions wait on, and carries its params and app shape as phantom types.
15
+ * `createTours({ registry })` reads them back, so `start`, `goto`, `from`,
16
+ * `signal` and `useTourGate` are checked against the tours that exist.
17
+ */
18
+
19
+ /* -------------------------------------------------------------------------- */
20
+ /* Phantom brands */
21
+ /* -------------------------------------------------------------------------- */
22
+
23
+ /** Carries a tour's types. Never exists at runtime, and not exported, so only
24
+ * `defineTour` can make a `TourDefinition`. */
25
+ declare const tourTypes: unique symbol
26
+ /** Carries a condition's types. Same rules as `tourTypes`. */
27
+ declare const conditionTypes: unique symbol
28
+
29
+ /** The id of one run of a tour. Branded so it can't be confused with a step id
30
+ * or another manager's id. Minted by `createTours`. */
31
+ export type TourRunId = Brand<string, "TourRunId">
32
+
33
+ /* -------------------------------------------------------------------------- */
34
+ /* Params, answers, targets */
35
+ /* -------------------------------------------------------------------------- */
36
+
37
+ /** What a tour receives from `tours.start(key, { params })`. */
38
+ export type TourParams = Record<string, unknown>
39
+
40
+ /** The params of a tour that declares none: `start` takes no `params`, and
41
+ * passing some is an error. */
42
+ export type NoTourParams = Record<string, never>
43
+
44
+ /** The answers given to `choices` steps so far, by step id. */
45
+ export type TourAnswers<Id extends string = string> = Partial<Record<Id, string>>
46
+
47
+ /**
48
+ * The element a step highlights: a CSS selector (re-resolved until it
49
+ * matches, so a target that mounts late still works), a ref, or a function
50
+ * called on every position update.
51
+ */
52
+ export type TourTarget = string | RefObject<HTMLElement | null> | (() => HTMLElement | null)
53
+
54
+ /* -------------------------------------------------------------------------- */
55
+ /* Step context */
56
+ /* -------------------------------------------------------------------------- */
57
+
58
+ /**
59
+ * What a condition, a step's `when` and a tour's `when` can do to the running
60
+ * tour. Reading, plus `goto` for branching. Conditions report state and let
61
+ * the step decide; they don't move the tour themselves.
62
+ */
63
+ export type TourContextTours<Id extends string = string> = {
64
+ /** The running tour, or `null` between tours. */
65
+ readonly active: TourSnapshot | null
66
+ /** Jumps to a step of this tour. */
67
+ goto: (step: Id) => void
68
+ }
69
+
70
+ /**
71
+ * The context every condition and `when` receives. `App` is the object passed
72
+ * to `createTours({ app })`, `Params` the tour's params, `Id` its step ids.
73
+ */
74
+ export type TourContext<App = unknown, Params = unknown, Id extends string = string> = {
75
+ /** The step's target element, or `null` (dialog steps, a tour's `when`). */
76
+ target: HTMLElement | null
77
+ /** The params `tours.start` was called with. */
78
+ params: Params
79
+ /** The answers given to `choices` steps so far. */
80
+ answers: TourAnswers<Id>
81
+ /** The current pathname, read through the `location` adapter. */
82
+ location: string
83
+ /** Whether a media query matches right now. */
84
+ media: (query: string) => boolean
85
+ /** The object passed to `createTours({ app })`, typed. */
86
+ app: App
87
+ /** Fires when the step is left. Pass it to `fetch`, or check `aborted`
88
+ * before reporting. */
89
+ signal: AbortSignal
90
+ /** The tour controller, for reading and for `goto`. */
91
+ tours: TourContextTours<Id>
92
+ }
93
+
94
+ /* -------------------------------------------------------------------------- */
95
+ /* Conditions */
96
+ /* -------------------------------------------------------------------------- */
97
+
98
+ /**
99
+ * The state a condition reports, and the card follows:
100
+ * - `"pending"`: not done yet (the starting state). Next is disabled and its
101
+ * tooltip says what to do; no message.
102
+ * - `{ invalid }`: the user tried and it's wrong. The hint shows and is
103
+ * announced politely to screen readers.
104
+ * - `"valid"`: done. A short tick shows, then the step advances (see
105
+ * `TourAdvance`).
106
+ */
107
+ export type ConditionState = "pending" | "valid" | { invalid: string }
108
+
109
+ /** Reports a condition's state. Call it synchronously in setup when the state
110
+ * is known, and again on every change. */
111
+ export type ConditionReport = (state: ConditionState) => void
112
+
113
+ /** Stops listening. The tour calls it when the step is left. */
114
+ export type ConditionCleanup = () => void
115
+
116
+ /**
117
+ * A condition's body: report the state now, subscribe to whatever can change
118
+ * it, and return the unsubscribe. Runs when the step appears and again on
119
+ * every re-entry (Back, `resume`, `from`). Returning nothing is allowed for a
120
+ * condition with nothing to unsubscribe; in development the kit warns when
121
+ * setup returns nothing *and* never reported.
122
+ */
123
+ export type ConditionSetup<App = unknown, Params = unknown> = (
124
+ ctx: TourContext<App, Params>,
125
+ report: ConditionReport,
126
+ ) => ConditionCleanup | undefined
127
+
128
+ /**
129
+ * Whether a step moves on by itself once its condition is valid. `"auto"`
130
+ * advances after the tick; `"manual"` shows the tick and waits for Next.
131
+ * Defaults (D5): auto for actions (`click`, `submit`, `route`, `element`,
132
+ * `signal`, `check`, `gate`, `condition`), manual for `value` and `all`.
133
+ */
134
+ export type TourAdvance = "auto" | "manual"
135
+
136
+ /** Options every condition helper takes. */
137
+ export type ConditionOptions = {
138
+ /** Its line in an `all()` checklist. Defaults to the key it has there. */
139
+ label?: string
140
+ /** Overrides the helper's default `advance`. A step's own `advance` wins. */
141
+ advance?: TourAdvance
142
+ }
143
+
144
+ /**
145
+ * A gate a step waits on: the value `until` takes. Built by `condition()` or
146
+ * one of the helpers, never by hand.
147
+ *
148
+ * The type parameters are phantoms the tour reads back: the `App` and
149
+ * `Params` the condition needs (a tour must provide at least those), and the
150
+ * gate keys and signal names it waits on (they become the registry's typed
151
+ * keys for `useTourGate` and `tours.signal`).
152
+ */
153
+ export type Condition<
154
+ App = unknown,
155
+ Params = unknown,
156
+ Gate extends string = never,
157
+ Signal extends string = never,
158
+ > = {
159
+ readonly [conditionTypes]: {
160
+ readonly app: (app: App) => void
161
+ readonly params: (params: Params) => void
162
+ readonly gate: Gate
163
+ readonly signal: Signal
164
+ }
165
+ /** The default `advance` this condition was built with. */
166
+ readonly advance: TourAdvance
167
+ /** Its line in an `all()` checklist. */
168
+ readonly label?: string
169
+ }
170
+
171
+ /** Any condition, whatever it needs and waits on. */
172
+ // biome-ignore lint/suspicious/noExplicitAny: the widest condition, for constraints
173
+ export type AnyCondition = Condition<any, any, string, string>
174
+
175
+ /** The conditions in a record or a tuple. */
176
+ type Members<C> = C extends readonly unknown[] ? C[number] : C[keyof C]
177
+
178
+ /** Each member's phantom types, as a union. */
179
+ type PhantomOf<M> = M extends { readonly [conditionTypes]: infer T } ? T : never
180
+
181
+ /**
182
+ * What `all()` and `any()` return: every member's `App` and `Params` together
183
+ * (an intersection, read through the contravariant phantoms), and every gate
184
+ * key and signal name they wait on.
185
+ */
186
+ export type CombinedCondition<C extends Record<string, AnyCondition> | readonly AnyCondition[]> =
187
+ Condition<
188
+ PhantomOf<Members<C>>["app"] extends (app: infer A) => void ? A : never,
189
+ PhantomOf<Members<C>>["params"] extends (params: infer P) => void ? P : never,
190
+ PhantomOf<Members<C>>["gate"],
191
+ PhantomOf<Members<C>>["signal"]
192
+ >
193
+
194
+ /** Options of `value()`. */
195
+ export type ValueOptions = ConditionOptions & {
196
+ /** The field to read. Defaults to the step's target, or the first field
197
+ * inside it. */
198
+ target?: TourTarget
199
+ /** Shown (and announced) when the check fails, after the field loses focus
200
+ * or the user pauses typing. */
201
+ hint?: string
202
+ }
203
+
204
+ /** Options of `click()` and `submit()`. */
205
+ export type ActionOptions = ConditionOptions & {
206
+ /** The element to watch. Defaults to the step's target (for `submit`, the
207
+ * form it is or sits in). */
208
+ target?: TourTarget
209
+ }
210
+
211
+ /** Options of `element()`. */
212
+ export type ElementOptions = ConditionOptions & {
213
+ /** Wait for the element to be visible (the default) or gone. */
214
+ state?: "visible" | "hidden"
215
+ }
216
+
217
+ /** Options of `check()`. */
218
+ export type CheckOptions = ConditionOptions & {
219
+ /** Runs the check again every this many ms until it passes. Runs once when
220
+ * unset. */
221
+ interval?: number
222
+ }
223
+
224
+ /** What a `check()` function resolves with: `true` is `"valid"`, `false` is
225
+ * `"pending"`, or any `ConditionState`. */
226
+ export type CheckResult = boolean | ConditionState
227
+
228
+ /** A route pattern (`"/projects/:id"`) or a predicate on the pathname. */
229
+ export type RouteMatch = string | ((pathname: string) => boolean)
230
+
231
+ /* -------------------------------------------------------------------------- */
232
+ /* Steps */
233
+ /* -------------------------------------------------------------------------- */
234
+
235
+ /** One answer offered by a `choices` step. */
236
+ export type TourChoice<Id extends string = string> = {
237
+ /** The button's label. */
238
+ label: ReactNode
239
+ /** Stored in `answers[stepId]` and in the result. */
240
+ value: string
241
+ /** The step to go to next. Defaults to the following step. */
242
+ goto?: Id
243
+ }
244
+
245
+ /** Help for a user who is stuck on a step. */
246
+ export type TourHelp = {
247
+ /** Ms without progress before the help shows. */
248
+ after: number
249
+ /** The hint shown in the card (and announced politely). */
250
+ hint?: string
251
+ /** Pulses the target. */
252
+ pulse?: boolean
253
+ }
254
+
255
+ /** What to do while a step's target is missing (D3). */
256
+ export type TourWait = {
257
+ /** Ms before Skip step and Close appear next to the spinner.
258
+ * @default 5000 */
259
+ timeout?: number
260
+ }
261
+
262
+ /** What a card button does. */
263
+ export type TourActionType = "next" | "back" | "skip" | "dismiss"
264
+
265
+ /** A button in the card. */
266
+ export type TourAction = {
267
+ /** The button's label. */
268
+ label: ReactNode
269
+ /** A built-in move, or a function. */
270
+ action: TourActionType | (() => void)
271
+ }
272
+
273
+ /** Fields every step has, whatever its type. */
274
+ type StepCore<
275
+ Id extends string,
276
+ Ids extends string,
277
+ Params,
278
+ App,
279
+ Gate extends string,
280
+ Signal extends string,
281
+ > = {
282
+ /** The step's id, unique within the tour. `goto`, `from` and the events use it. */
283
+ id: Id
284
+ /** The gate the user must meet to move on. */
285
+ until?: Condition<App, Params, Gate, Signal>
286
+ /** Overrides the condition's default `advance`. */
287
+ advance?: TourAdvance
288
+ /** Help when the user is stuck. */
289
+ help?: TourHelp
290
+ /** Shows the step only when this returns true. Checked when the tour starts
291
+ * and again before the step shows. */
292
+ when?: (ctx: TourContext<App, Params, Ids>) => boolean
293
+ /** What to do while the target is missing. */
294
+ wait?: TourWait
295
+ }
296
+
297
+ /** Fields of a step that shows a card. */
298
+ type CardFields<Ids extends string> = {
299
+ /** The card's title. */
300
+ title?: ReactNode
301
+ /** The card's body. */
302
+ description?: ReactNode
303
+ /** Hides Skip (D6). Close and Esc still end the tour. */
304
+ required?: boolean
305
+ /** Branches on an answer: one button per choice. */
306
+ choices?: readonly TourChoice<Ids>[]
307
+ /** Replaces the default Back / Next / Done buttons. */
308
+ actions?: readonly TourAction[]
309
+ /** Dims the page behind the step. @default true */
310
+ withBackdrop?: boolean
311
+ }
312
+
313
+ /** Fields of a step anchored to an element. */
314
+ type AnchorFields = {
315
+ /** Where the card sits, RTL-aware. @default "bottom" */
316
+ position?: LogicalPosition<Placement>
317
+ /** Whether the highlighted element stays clickable (D2). Always true on a
318
+ * gated step. @default true */
319
+ interactive?: boolean
320
+ /** Draws the arrow from the card to the target. @default true */
321
+ withArrow?: boolean
322
+ }
323
+
324
+ /**
325
+ * One step of a tour. `type` picks the shape:
326
+ * - `"tooltip"` (the default): a card anchored to `target`.
327
+ * - `"floating"`: a card placed on the viewport, with an optional target.
328
+ * - `"dialog"`: a centred card, no target.
329
+ * - `"wait"`: no card; waits on `until` (required) before moving on.
330
+ */
331
+ export type TourStep<
332
+ Id extends string = string,
333
+ Ids extends string = string,
334
+ Params = unknown,
335
+ App = unknown,
336
+ Gate extends string = never,
337
+ Signal extends string = never,
338
+ > =
339
+ | (StepCore<Id, Ids, Params, App, Gate, Signal> &
340
+ CardFields<Ids> &
341
+ AnchorFields & {
342
+ type?: "tooltip"
343
+ /** The element the step highlights. */
344
+ target: TourTarget
345
+ })
346
+ | (StepCore<Id, Ids, Params, App, Gate, Signal> &
347
+ CardFields<Ids> &
348
+ AnchorFields & {
349
+ type: "floating"
350
+ /** The element the step highlights, if any. */
351
+ target?: TourTarget
352
+ })
353
+ | (StepCore<Id, Ids, Params, App, Gate, Signal> &
354
+ CardFields<Ids> & {
355
+ type: "dialog"
356
+ target?: never
357
+ })
358
+ | (StepCore<Id, Ids, Params, App, Gate, Signal> & {
359
+ type: "wait"
360
+ /** An element to watch, for `click()` and the like. Not highlighted. */
361
+ target?: TourTarget
362
+ /** What the step waits for. */
363
+ until: Condition<App, Params, Gate, Signal>
364
+ })
365
+
366
+ /** The step types. */
367
+ export type TourStepType = NonNullable<TourStep["type"]>
368
+
369
+ /* -------------------------------------------------------------------------- */
370
+ /* Tour definitions and the registry */
371
+ /* -------------------------------------------------------------------------- */
372
+
373
+ /** What `defineTour` takes. */
374
+ export type TourInput<
375
+ Id extends string,
376
+ Params,
377
+ App,
378
+ Gate extends string,
379
+ Signal extends string,
380
+ > = {
381
+ /** Bump it to show the tour again to people who completed, skipped or
382
+ * dismissed an older version (`startOnce`). @default 1 */
383
+ version?: number
384
+ /** Entry rule for the whole tour: it doesn't start when this returns false. */
385
+ when?: (ctx: TourContext<App, Params, NoInfer<Id>>) => boolean
386
+ /** The steps, in order. */
387
+ steps: readonly TourStep<Id, NoInfer<Id>, Params, App, Gate, Signal>[]
388
+ }
389
+
390
+ /**
391
+ * A tour, built by `defineTour` and registered in `createTours({ registry })`.
392
+ * Its type carries the step ids, params, app shape, gate keys and signal names
393
+ * the registry reads back.
394
+ */
395
+ export type TourDefinition<
396
+ Id extends string = string,
397
+ Params = NoTourParams,
398
+ App = unknown,
399
+ Gate extends string = never,
400
+ Signal extends string = never,
401
+ > = {
402
+ readonly [tourTypes]: {
403
+ readonly id: Id
404
+ readonly params: (params: Params) => void
405
+ readonly app: (app: App) => void
406
+ readonly gate: Gate
407
+ readonly signal: Signal
408
+ }
409
+ /** The tour's version. */
410
+ readonly version: number
411
+ /** The entry rule. */
412
+ readonly when?: (ctx: TourContext<App, Params, Id>) => boolean
413
+ /** The steps, in order. */
414
+ readonly steps: readonly TourStep<Id, Id, Params, App, Gate, Signal>[]
415
+ }
416
+
417
+ /** Any tour, whatever its types. */
418
+ // biome-ignore lint/suspicious/noExplicitAny: the widest tour, for the registry constraint
419
+ export type AnyTourDefinition = TourDefinition<string, any, any, string, string>
420
+
421
+ /** The tours an app registers, by key. */
422
+ export type TourRegistry = Record<string, AnyTourDefinition>
423
+
424
+ /** A registered tour's key. */
425
+ export type TourKey<R extends TourRegistry> = keyof R & string
426
+
427
+ /** The step ids of one registered tour, or of every tour when `K` is omitted. */
428
+ export type StepIdOf<
429
+ R extends TourRegistry,
430
+ K extends TourKey<R> = TourKey<R>,
431
+ > = R[K][typeof tourTypes]["id"]
432
+
433
+ /** The params a registered tour expects. */
434
+ export type TourParamsOf<
435
+ R extends TourRegistry,
436
+ K extends TourKey<R>,
437
+ > = R[K][typeof tourTypes]["params"] extends (params: infer P) => void ? P : never
438
+
439
+ /** Every gate key the registry's tours wait on: what `useTourGate` accepts. */
440
+ export type GateKeyOf<R extends TourRegistry> = R[TourKey<R>][typeof tourTypes]["gate"]
441
+
442
+ /** Every signal name the registry's tours wait on: what `tours.signal` accepts. */
443
+ export type SignalOf<R extends TourRegistry> = R[TourKey<R>][typeof tourTypes]["signal"]
444
+
445
+ /** The `app` object the registry's tours need, all of them together. */
446
+ export type TourAppOf<R extends TourRegistry> = R[TourKey<R>][typeof tourTypes]["app"] extends (
447
+ app: infer A,
448
+ ) => void
449
+ ? A
450
+ : never
451
+
452
+ /* -------------------------------------------------------------------------- */
453
+ /* Results and snapshots */
454
+ /* -------------------------------------------------------------------------- */
455
+
456
+ /**
457
+ * How a tour ended:
458
+ * - `"completed"`: Done on the last step.
459
+ * - `"skipped"`: Skip, which ends the whole tour, or skipping the last step
460
+ * (Next on an unmet gate, Skip step on a missing target).
461
+ * - `"dismissed"`: Close, Esc, an outside click, or `tours.dismiss()`.
462
+ * - `"not-found"`: nothing to show: the tour's `when` was false, or every
463
+ * step was filtered out.
464
+ */
465
+ export type TourEndStatus = "completed" | "skipped" | "dismissed" | "not-found"
466
+
467
+ /** What `tours.start` resolves with when the tour ends. */
468
+ export type TourResult<Id extends string = string> = {
469
+ /** How the tour ended. */
470
+ status: TourEndStatus
471
+ /** The step it ended on, or `null` when no step showed. */
472
+ stepId: Id | null
473
+ /** The answers given to `choices` steps. */
474
+ answers: TourAnswers<Id>
475
+ }
476
+
477
+ /**
478
+ * Where the active step is:
479
+ * - `"loading"`: its target isn't on the page yet; the card shows a spinner.
480
+ * - `"timeout"`: still missing after `wait.timeout`; Skip step and Close show.
481
+ * - `"shown"`: the step is showing.
482
+ */
483
+ export type TourStepState = "loading" | "timeout" | "shown"
484
+
485
+ /** A snapshot of the running tour, for one registered key. */
486
+ export type TourSnapshotOf<Key extends string, Id extends string> = {
487
+ /** This run's id. */
488
+ run: TourRunId
489
+ /** The tour's key in the registry. */
490
+ key: Key
491
+ /** The tour's version. */
492
+ version: number
493
+ /** The active step. */
494
+ stepId: Id
495
+ /** The active step's index among the steps that show. */
496
+ index: number
497
+ /** How many steps show. */
498
+ total: number
499
+ /** Where the active step is. */
500
+ state: TourStepState
501
+ /** The step's gate, or `null` when it has none. */
502
+ gate: ConditionState | null
503
+ /** One line per condition of an `all()` gate, or `null`. */
504
+ checklist: readonly TourChecklistItem[] | null
505
+ /** A `check()` is running: the card shows a loading state. */
506
+ checking: boolean
507
+ /** The step's `help`, once the user has been stuck for `help.after`. */
508
+ help: { hint: string | undefined; pulse: boolean } | null
509
+ /** The active step, with `tours.update` patches applied. */
510
+ step: TourStep<Id, Id>
511
+ /** The answers given so far. */
512
+ answers: TourAnswers<Id>
513
+ }
514
+
515
+ /** One line of an `all()` checklist. */
516
+ export type TourChecklistItem = {
517
+ /** The condition's key in `all({ … })`. */
518
+ key: string
519
+ /** Its `label`, or the key. */
520
+ label: string
521
+ /** Its state. */
522
+ state: ConditionState
523
+ }
524
+
525
+ /** A snapshot of the running tour, discriminated by `key`. */
526
+ export type TourSnapshot<R extends TourRegistry = TourRegistry> = {
527
+ [K in TourKey<R>]: TourSnapshotOf<K, StepIdOf<R, K>>
528
+ }[TourKey<R>]
529
+
530
+ /* -------------------------------------------------------------------------- */
531
+ /* Events */
532
+ /* -------------------------------------------------------------------------- */
533
+
534
+ /** Fields every event carries. */
535
+ type EventBase<Key extends string, Id extends string> = {
536
+ /** The tour's key in the registry. */
537
+ key: Key
538
+ /** The tour's version. */
539
+ version: number
540
+ /** This run's id, to group a run's events. */
541
+ run: TourRunId
542
+ /** The step the event is about. */
543
+ stepId: Id
544
+ /** That step's index among the steps that show. */
545
+ index: number
546
+ }
547
+
548
+ /** The events of one registered tour. */
549
+ export type TourEventOf<Key extends string, Id extends string> =
550
+ | (Omit<EventBase<Key, Id>, "stepId"> & {
551
+ type: "tour:start"
552
+ /** The first step, or `null` when nothing shows. */
553
+ stepId: Id | null
554
+ /** Started with `resume`. */
555
+ resumed: boolean
556
+ })
557
+ | (EventBase<Key, Id> & { type: "step:show" })
558
+ | (EventBase<Key, Id> & {
559
+ type: "step:invalid"
560
+ /** The hint the condition reported. */
561
+ message: string
562
+ /** How many times the step was invalid so far. */
563
+ attempts: number
564
+ })
565
+ | (EventBase<Key, Id> & {
566
+ type: "step:hint"
567
+ /** The help hint that showed. */
568
+ hint: string | undefined
569
+ })
570
+ | (EventBase<Key, Id> & {
571
+ type: "step:complete"
572
+ /** Ms spent on the step. */
573
+ duration: number
574
+ /** How many times the step was invalid before it passed. */
575
+ attempts: number
576
+ })
577
+ | (EventBase<Key, Id> & { type: "step:skip" })
578
+ | (EventBase<Key, Id> & { type: "step:waiting" })
579
+ | (EventBase<Key, Id> & {
580
+ type: "step:timeout"
581
+ /** Ms waited for the target. */
582
+ timeout: number
583
+ })
584
+ | (Omit<EventBase<Key, Id>, "stepId"> & {
585
+ type: "tour:end"
586
+ /** The step it ended on, or `null` when nothing showed. */
587
+ stepId: Id | null
588
+ /** How the tour ended. */
589
+ status: TourEndStatus
590
+ })
591
+
592
+ /** Everything sent to `onEvent`, discriminated by `type` and by `key`. */
593
+ export type TourEvent<R extends TourRegistry = TourRegistry> = {
594
+ [K in TourKey<R>]: TourEventOf<K, StepIdOf<R, K>>
595
+ }[TourKey<R>]
596
+
597
+ /** An event's `type`. */
598
+ export type TourEventType = TourEventOf<string, string>["type"]
599
+
600
+ /* -------------------------------------------------------------------------- */
601
+ /* Storage */
602
+ /* -------------------------------------------------------------------------- */
603
+
604
+ /** What storage keeps about one tour. */
605
+ export type TourRecord = {
606
+ /** The version the record is about. A record for an older version counts
607
+ * as never seen. */
608
+ version: number
609
+ /** `"active"` while it runs; how it ended after that. Any end status
610
+ * (completed, skipped, dismissed) marks this version as seen. */
611
+ status: "active" | Exclude<TourEndStatus, "not-found">
612
+ /** The last step shown, for `resume`. */
613
+ stepId: string | null
614
+ /** The answers given so far. */
615
+ answers: TourAnswers
616
+ /** When the record was written, in ms since the epoch. */
617
+ updatedAt: number
618
+ }
619
+
620
+ /**
621
+ * Where `startOnce` and `resume` keep progress. The kit ships
622
+ * `localStorageTours()`; an app can store it on the server with the same
623
+ * shape. Every method may be sync or async.
624
+ */
625
+ export type TourStorage = {
626
+ /** Reads a tour's record, or `null` when there is none. */
627
+ get: (key: string) => TourRecord | null | Promise<TourRecord | null>
628
+ /** Writes a tour's record. */
629
+ set: (key: string, record: TourRecord) => void | Promise<void>
630
+ /** Forgets a tour's record. */
631
+ remove: (key: string) => void | Promise<void>
632
+ }
633
+
634
+ /* -------------------------------------------------------------------------- */
635
+ /* Controller */
636
+ /* -------------------------------------------------------------------------- */
637
+
638
+ /** Whether a tour's params can be left out: true when none is required. */
639
+ type ParamsOptional<Params> = NoTourParams extends Params ? true : false
640
+
641
+ /** Options of `tours.start`, `startOnce` and `resume`. */
642
+ export type TourStartOptions<Params, Id extends string> = {
643
+ /** Starts at this step, for QA and "show me again" links. */
644
+ from?: Id
645
+ } & (ParamsOptional<Params> extends true
646
+ ? {
647
+ /** The tour's params. */
648
+ params?: Params
649
+ }
650
+ : {
651
+ /** The tour's params. */
652
+ params: Params
653
+ })
654
+
655
+ /** `start`'s arguments after the key: the options are required when the tour
656
+ * has required params. */
657
+ export type TourStartArgs<Params, Id extends string> =
658
+ ParamsOptional<Params> extends true
659
+ ? [options?: TourStartOptions<Params, Id>]
660
+ : [options: TourStartOptions<Params, Id>]
661
+
662
+ /** What `tours.update` can patch on the step that shows. */
663
+ export type TourStepPatch = {
664
+ /** The card's title. */
665
+ title?: ReactNode
666
+ /** The card's body. */
667
+ description?: ReactNode
668
+ /** The card's buttons. */
669
+ actions?: readonly TourAction[]
670
+ }
671
+
672
+ /** The key a `start` call accepts. Written as a conditional so an unknown key
673
+ * is reported against the list of registered keys, instead of failing the
674
+ * arguments after it. */
675
+ type KeyArg<R extends TourRegistry, K extends string> = K extends TourKey<R> ? K : TourKey<R>
676
+
677
+ /** The arguments after the key, for a registered key. */
678
+ type StartArgsOf<R extends TourRegistry, K extends string> =
679
+ K extends TourKey<R> ? TourStartArgs<TourParamsOf<R, K>, StepIdOf<R, K>> : [options?: never]
680
+
681
+ /** Why a storage method is missing. */
682
+ type NeedsStorage = Unavailable<"needs `storage` in createTours">
683
+
684
+ /**
685
+ * The tours controller: callable from anywhere (a button, a route loader, a
686
+ * first-login effect). Typed against the registry.
687
+ */
688
+ export type TourController<
689
+ R extends TourRegistry = TourRegistry,
690
+ Stored extends boolean = boolean,
691
+ > = {
692
+ /**
693
+ * Starts a tour and resolves when it ends. Queued while another tour runs
694
+ * or a modal is open (D7).
695
+ */
696
+ start: <const K extends string>(
697
+ key: KeyArg<R, K>,
698
+ ...args: StartArgsOf<R, K>
699
+ ) => Promise<TourResult<StepIdOf<R, K & TourKey<R>>>>
700
+ /**
701
+ * Starts only if this version of the tour was never seen: not completed,
702
+ * skipped or dismissed. Resolves `null` when it didn't start. Bumping the
703
+ * tour's `version`, or `tours.reset(key)`, shows it again.
704
+ */
705
+ startOnce: Stored extends true
706
+ ? <const K extends string>(
707
+ key: KeyArg<R, K>,
708
+ ...args: StartArgsOf<R, K>
709
+ ) => Promise<TourResult<StepIdOf<R, K & TourKey<R>>> | null>
710
+ : NeedsStorage
711
+ /**
712
+ * Continues from the saved step, or starts from the first one when nothing
713
+ * is saved. Takes the same options as `start`: params aren't stored.
714
+ */
715
+ resume: Stored extends true
716
+ ? <const K extends string>(
717
+ key: KeyArg<R, K>,
718
+ ...args: StartArgsOf<R, K>
719
+ ) => Promise<TourResult<StepIdOf<R, K & TourKey<R>>>>
720
+ : NeedsStorage
721
+ /** Forgets a tour's stored progress, for a "Replay the tour" menu item. */
722
+ reset: Stored extends true ? (key: TourKey<R>) => Promise<void> : NeedsStorage
723
+ /**
724
+ * Moves to the next step. Counts as completing the step (`step:complete`)
725
+ * when its gate is valid or it has none, and as skipping it (`step:skip`)
726
+ * otherwise: Skip step on a missing target is `next()`. On the last step it
727
+ * ends the tour, `"completed"` or `"skipped"` accordingly.
728
+ */
729
+ next: () => void
730
+ /** Moves to the previous step. */
731
+ back: () => void
732
+ /** Jumps to a step of the running tour. */
733
+ goto: (step: StepIdOf<R>) => void
734
+ /** Answers a `choices` step: records the value in `answers` and moves to
735
+ * the choice's `goto`, or the next step. */
736
+ choose: (value: string) => void
737
+ /** Ends the tour with `"skipped"`. */
738
+ skip: () => void
739
+ /** Ends the tour with `"dismissed"`. */
740
+ dismiss: () => void
741
+ /** Tells the running tour that a business event happened. A step waiting on
742
+ * it passes; if none waits yet, the run remembers it for a later step.
743
+ * Dropped when no tour runs. */
744
+ signal: (name: SignalOf<R>, payload?: unknown) => void
745
+ /** Patches the step that shows. */
746
+ update: (patch: TourStepPatch) => void
747
+ /** The running tour, or `null`. */
748
+ readonly active: TourSnapshot<R> | null
749
+ }
750
+
751
+ /** `useTours()`'s return: `[active, tours]`, like `useOverlays()`. */
752
+ export type UseToursReturn<
753
+ R extends TourRegistry = TourRegistry,
754
+ Stored extends boolean = boolean,
755
+ > = readonly [TourSnapshot<R> | null, TourController<R, Stored>]
756
+
757
+ /**
758
+ * Reports a gate's state from the component that owns it. Writes on each
759
+ * render where the state changes; does nothing while no step waits on `key`.
760
+ */
761
+ export type UseTourGate<R extends TourRegistry = TourRegistry> = (
762
+ key: GateKeyOf<R>,
763
+ state: ConditionState,
764
+ ) => void
765
+
766
+ /* -------------------------------------------------------------------------- */
767
+ /* Rendering */
768
+ /* -------------------------------------------------------------------------- */
769
+
770
+ /** The card's strings. They also become the triggers' `aria-label`s. */
771
+ export type TourTranslations = {
772
+ /** "2 of 5". `current` counts from 1. */
773
+ progressText?: (details: { current: number; total: number }) => string
774
+ /** The Next button. */
775
+ next?: string
776
+ /** The Back button. */
777
+ back?: string
778
+ /** The Done button on the last step. */
779
+ done?: string
780
+ /** The Skip button, which ends the tour. */
781
+ skip?: string
782
+ /** The Skip step button, shown when a target is missing. */
783
+ skipStep?: string
784
+ /** The close button. */
785
+ close?: string
786
+ /** Shown while a step's target is missing. */
787
+ loading?: string
788
+ /** Announced when a gate passes, beside the tick. */
789
+ valid?: string
790
+ /** Next's tooltip while the step's gate isn't met and has no hint. */
791
+ blocked?: string
792
+ }
793
+
794
+ /** The card's styleable parts. */
795
+ export type TourSlot =
796
+ | "backdrop"
797
+ | "spotlight"
798
+ | "positioner"
799
+ | "content"
800
+ | "arrow"
801
+ | "title"
802
+ | "description"
803
+ | "progress"
804
+ | "checklist"
805
+ | "hint"
806
+ | "actions"
807
+ | "close"
808
+
809
+ /** A class per part. */
810
+ export type TourClassNames = Partial<Record<TourSlot, string>>
811
+
812
+ /** The card's replaceable icons. */
813
+ export type TourIconSlot = "close" | "check"
814
+
815
+ /** `icons` for the card. */
816
+ export type TourIcons = IconMap<TourIconSlot>
817
+
818
+ /** What a custom `render` receives. */
819
+ export type TourRenderProps<R extends TourRegistry = TourRegistry> = {
820
+ /** The running tour. */
821
+ active: TourSnapshot<R>
822
+ /** The step that shows, with `tours.update` patches applied. */
823
+ step: TourStep<StepIdOf<R>, StepIdOf<R>>
824
+ /** The tour controller. */
825
+ tours: TourController<R>
826
+ /** The step is waiting for its target (D3). */
827
+ loading: boolean
828
+ /** The merged translations. */
829
+ translations: Required<TourTranslations>
830
+ }
831
+
832
+ /** Props of the `<Tours />` renderer. */
833
+ export type ToursProps = {
834
+ /** The card's accent. Never `gray`: use `neutral`. */
835
+ color?: Color
836
+ /** A class per part. */
837
+ classNames?: TourClassNames
838
+ /** The card's icons. */
839
+ icons?: TourIcons
840
+ /** Draws the arrow on anchored steps. A step's own `withArrow` wins. @default true */
841
+ withArrow?: boolean
842
+ /** Dims the page. A step's own `withBackdrop` wins. @default true */
843
+ withBackdrop?: boolean
844
+ /** Shows the close button. @default true */
845
+ withCloseButton?: boolean
846
+ /** `data-testid` on the content; each part gets `${testId}-${part}`. */
847
+ testId?: string
848
+ }
849
+
850
+ /* -------------------------------------------------------------------------- */
851
+ /* createTours */
852
+ /* -------------------------------------------------------------------------- */
853
+
854
+ /** Reads the current pathname and says when it changes, for `route()`. */
855
+ export type TourLocation = {
856
+ /** The current pathname. */
857
+ get: () => string
858
+ /** Calls `listener` on every navigation; returns the unsubscribe. */
859
+ subscribe: (listener: () => void) => () => void
860
+ }
861
+
862
+ /** `createTours`' `app`: required when a registered tour needs one. */
863
+ type AppField<App> = unknown extends App
864
+ ? {
865
+ /** Handed to every condition as `ctx.app`. */
866
+ app?: App
867
+ }
868
+ : {
869
+ /** Handed to every condition as `ctx.app`. A registered tour needs it. */
870
+ app: App
871
+ }
872
+
873
+ /** What `createTours` takes. */
874
+ export type CreateToursConfig<
875
+ R extends TourRegistry = TourRegistry,
876
+ Storage extends TourStorage | undefined = TourStorage | undefined,
877
+ > = AppField<TourAppOf<R>> & {
878
+ /** The tours, by key, each built with `defineTour`. */
879
+ registry: R
880
+ /** Where `route()` reads the pathname. Defaults to `window.location`,
881
+ * updated on `popstate` (and the Navigation API where available). */
882
+ location?: TourLocation
883
+ /** Enables `startOnce`, `resume` and `reset`. */
884
+ storage?: Storage
885
+ /** One typed stream of everything that happens, for analytics. */
886
+ onEvent?: (event: TourEvent<R>) => void
887
+ /** The card's strings. */
888
+ translations?: TourTranslations
889
+ /** Replaces the default card. Rendered inside `Tour.Root`, so the compound
890
+ * parts work. */
891
+ render?: (props: TourRenderProps<R>) => ReactNode
892
+ }
893
+
894
+ /** What `createTours` returns. */
895
+ export type ToursHandle<R extends TourRegistry = TourRegistry, Stored extends boolean = boolean> = {
896
+ /** The controller, callable from anywhere. */
897
+ tours: TourController<R, Stored>
898
+ /** The renderer. Mount it once, near the app root. */
899
+ Tours: (props: ToursProps) => React.JSX.Element | null
900
+ /** `[active, tours]`, reactive. */
901
+ useTours: () => UseToursReturn<R, Stored>
902
+ /** Reports a gate from the component that owns its state. */
903
+ useTourGate: UseTourGate<R>
904
+ }