@accelint/design-toolkit 9.13.0 → 10.1.0

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 (317) hide show
  1. package/catalog-info.yaml +1 -1
  2. package/dist/components/accordion/group.d.ts +2 -2
  3. package/dist/components/accordion/index.d.ts +2 -2
  4. package/dist/components/accordion/panel.d.ts +2 -2
  5. package/dist/components/accordion/trigger.d.ts +2 -2
  6. package/dist/components/action-bar/index.d.ts +2 -2
  7. package/dist/components/audio/index.d.ts +2 -2
  8. package/dist/components/avatar/context.d.ts +2 -2
  9. package/dist/components/avatar/index.d.ts +2 -2
  10. package/dist/components/badge/context.d.ts +4 -4
  11. package/dist/components/breadcrumbs/index.d.ts +2 -2
  12. package/dist/components/breadcrumbs/item.d.ts +2 -2
  13. package/dist/components/button/context.d.ts +8 -8
  14. package/dist/components/button/index.d.ts +2 -2
  15. package/dist/components/button/link.d.ts +2 -2
  16. package/dist/components/button/toggle.d.ts +2 -2
  17. package/dist/components/carousel/context.d.ts +4 -4
  18. package/dist/components/carousel/gallery.d.ts +2 -2
  19. package/dist/components/carousel/index.d.ts +2 -2
  20. package/dist/components/carousel/navigation.d.ts +3 -3
  21. package/dist/components/carousel/position.d.ts +2 -2
  22. package/dist/components/carousel/select.d.ts +2 -2
  23. package/dist/components/carousel/viewer.d.ts +2 -2
  24. package/dist/components/checkbox/context.d.ts +3 -3
  25. package/dist/components/checkbox/group.d.ts +2 -2
  26. package/dist/components/checkbox/index.d.ts +2 -2
  27. package/dist/components/chip/context.d.ts +4 -4
  28. package/dist/components/chip/deletable.d.ts +2 -2
  29. package/dist/components/chip/index.d.ts +2 -2
  30. package/dist/components/chip/list.d.ts +4 -4
  31. package/dist/components/chip/selectable.d.ts +2 -2
  32. package/dist/components/classification-badge/context.d.ts +4 -4
  33. package/dist/components/classification-badge/index.d.ts +2 -2
  34. package/dist/components/classification-banner/context.d.ts +4 -4
  35. package/dist/components/classification-banner/index.d.ts +2 -2
  36. package/dist/components/clock/index.d.ts +2 -2
  37. package/dist/components/color-picker/index.d.ts +2 -2
  38. package/dist/components/combobox-field/context.d.ts +4 -4
  39. package/dist/components/combobox-field/index.d.ts +2 -2
  40. package/dist/components/coordinate-field/context.d.ts +6 -6
  41. package/dist/components/coordinate-field/index.d.ts +2 -2
  42. package/dist/components/coordinate-field/segment.d.ts +2 -2
  43. package/dist/components/date-field/index.d.ts +2 -2
  44. package/dist/components/date-field/index.js.map +1 -1
  45. package/dist/components/deferred-collection/index.d.ts +2 -2
  46. package/dist/components/details-list/context.d.ts +4 -4
  47. package/dist/components/details-list/index.d.ts +2 -2
  48. package/dist/components/details-list/label.d.ts +2 -2
  49. package/dist/components/details-list/value.d.ts +2 -2
  50. package/dist/components/dialog/content.d.ts +2 -2
  51. package/dist/components/dialog/context.d.ts +2 -2
  52. package/dist/components/dialog/footer.d.ts +2 -2
  53. package/dist/components/dialog/index.d.ts +2 -2
  54. package/dist/components/dialog/title.d.ts +2 -2
  55. package/dist/components/divider/context.d.ts +4 -4
  56. package/dist/components/divider/index.d.ts +2 -2
  57. package/dist/components/drawer/back.d.ts +2 -2
  58. package/dist/components/drawer/close.d.ts +2 -2
  59. package/dist/components/drawer/content.d.ts +2 -2
  60. package/dist/components/drawer/context.d.ts +2 -2
  61. package/dist/components/drawer/footer.d.ts +2 -2
  62. package/dist/components/drawer/header-title.d.ts +2 -2
  63. package/dist/components/drawer/header.d.ts +2 -2
  64. package/dist/components/drawer/index.d.ts +2 -2
  65. package/dist/components/drawer/layout-main.d.ts +2 -2
  66. package/dist/components/drawer/layout.d.ts +2 -2
  67. package/dist/components/drawer/menu-item.d.ts +2 -2
  68. package/dist/components/drawer/menu.d.ts +2 -2
  69. package/dist/components/drawer/panel.d.ts +2 -2
  70. package/dist/components/drawer/trigger.d.ts +2 -2
  71. package/dist/components/drawer/view.d.ts +2 -2
  72. package/dist/components/flashcard/index.d.ts +9 -9
  73. package/dist/components/floating-card/constants.d.ts +26 -0
  74. package/dist/components/floating-card/constants.js +40 -0
  75. package/dist/components/floating-card/constants.js.map +1 -0
  76. package/dist/components/floating-card/context.d.ts +38 -6
  77. package/dist/components/floating-card/context.js +24 -3
  78. package/dist/components/floating-card/context.js.map +1 -1
  79. package/dist/components/floating-card/hooks/use-card-layout.d.ts +36 -0
  80. package/dist/components/floating-card/hooks/use-card-layout.js +106 -0
  81. package/dist/components/floating-card/hooks/use-card-layout.js.map +1 -0
  82. package/dist/components/floating-card/hooks/use-drag.d.ts +62 -0
  83. package/dist/components/floating-card/hooks/use-drag.js +100 -0
  84. package/dist/components/floating-card/hooks/use-drag.js.map +1 -0
  85. package/dist/components/floating-card/hooks/use-mouse-interaction.d.ts +58 -0
  86. package/dist/components/floating-card/hooks/use-mouse-interaction.js +91 -0
  87. package/dist/components/floating-card/hooks/use-mouse-interaction.js.map +1 -0
  88. package/dist/components/floating-card/hooks/use-resize.d.ts +56 -0
  89. package/dist/components/floating-card/hooks/use-resize.js +98 -0
  90. package/dist/components/floating-card/hooks/use-resize.js.map +1 -0
  91. package/dist/components/floating-card/index.d.ts +6 -2
  92. package/dist/components/floating-card/index.js +24 -32
  93. package/dist/components/floating-card/index.js.map +1 -1
  94. package/dist/components/floating-card/panel.d.ts +69 -0
  95. package/dist/components/floating-card/panel.js +111 -0
  96. package/dist/components/floating-card/panel.js.map +1 -0
  97. package/dist/components/floating-card/provider.d.ts +10 -6
  98. package/dist/components/floating-card/provider.js +159 -153
  99. package/dist/components/floating-card/provider.js.map +1 -1
  100. package/dist/components/floating-card/styles.module.css +93 -39
  101. package/dist/components/floating-card/types.d.ts +51 -10
  102. package/dist/components/floating-card/utils.d.ts +8 -85
  103. package/dist/components/floating-card/utils.js +12 -38
  104. package/dist/components/floating-card/utils.js.map +1 -1
  105. package/dist/components/gantt/components/base-elements/range.d.ts +2 -2
  106. package/dist/components/gantt/components/containers/external/gantt-content-container/index.d.ts +2 -2
  107. package/dist/components/gantt/components/containers/external/gantt-panel-container/index.d.ts +2 -2
  108. package/dist/components/gantt/components/containers/internal/index.d.ts +2 -2
  109. package/dist/components/gantt/components/containers/internal/layout-container/index.d.ts +2 -2
  110. package/dist/components/gantt/components/containers/internal/virtualized-content-height-container/index.d.ts +2 -2
  111. package/dist/components/gantt/components/content-row/block.d.ts +2 -2
  112. package/dist/components/gantt/components/content-row/bracket.d.ts +3 -3
  113. package/dist/components/gantt/components/content-row/icon-marker.d.ts +2 -2
  114. package/dist/components/gantt/components/content-row/index.d.ts +2 -2
  115. package/dist/components/gantt/components/content-row/marker.d.ts +2 -2
  116. package/dist/components/gantt/components/content-row/spacer.d.ts +2 -2
  117. package/dist/components/gantt/components/current-time/index.d.ts +2 -2
  118. package/dist/components/gantt/components/header/index.d.ts +3 -3
  119. package/dist/components/gantt/components/panel-row/index.d.ts +2 -2
  120. package/dist/components/gantt/components/rows-virtualizer/index.d.ts +3 -3
  121. package/dist/components/gantt/components/timeline/index.d.ts +2 -2
  122. package/dist/components/gantt/components/timeline-chunk/index.d.ts +3 -3
  123. package/dist/components/gantt/context/index.d.ts +4 -4
  124. package/dist/components/gantt/context/store/index.d.ts +4 -4
  125. package/dist/components/gantt/context/temporal-data/index.d.ts +4 -4
  126. package/dist/components/gantt/hooks/use-layout-subscription/index.js +8 -8
  127. package/dist/components/gantt/hooks/use-layout-subscription/index.js.map +1 -1
  128. package/dist/components/hero/context.d.ts +2 -2
  129. package/dist/components/hero/index.d.ts +2 -2
  130. package/dist/components/hero/subtitle.d.ts +3 -3
  131. package/dist/components/hero/title.d.ts +2 -2
  132. package/dist/components/hotkey/context.d.ts +4 -4
  133. package/dist/components/hotkey/index.d.ts +2 -2
  134. package/dist/components/hotkey/set.d.ts +2 -2
  135. package/dist/components/icon/context.d.ts +4 -4
  136. package/dist/components/icon/index.d.ts +2 -2
  137. package/dist/components/input/index.d.ts +2 -2
  138. package/dist/components/kanban/card-body.d.ts +2 -2
  139. package/dist/components/kanban/card-header-actions.d.ts +2 -2
  140. package/dist/components/kanban/card-header-title.d.ts +2 -2
  141. package/dist/components/kanban/card-header.d.ts +2 -2
  142. package/dist/components/kanban/card.d.ts +2 -2
  143. package/dist/components/kanban/column-actions.d.ts +2 -2
  144. package/dist/components/kanban/column-container.d.ts +2 -2
  145. package/dist/components/kanban/column-content.d.ts +2 -2
  146. package/dist/components/kanban/column-header-actions.d.ts +2 -2
  147. package/dist/components/kanban/column-header-drag-handle.d.ts +2 -2
  148. package/dist/components/kanban/column-header-title.d.ts +2 -2
  149. package/dist/components/kanban/column-header.d.ts +2 -2
  150. package/dist/components/kanban/column.d.ts +2 -2
  151. package/dist/components/kanban/context.d.ts +2 -2
  152. package/dist/components/kanban/header-actions.d.ts +2 -2
  153. package/dist/components/kanban/header-search.d.ts +2 -2
  154. package/dist/components/kanban/header-title.d.ts +2 -2
  155. package/dist/components/kanban/header.d.ts +2 -2
  156. package/dist/components/kanban/kanban.d.ts +2 -2
  157. package/dist/components/label/context.d.ts +4 -4
  158. package/dist/components/label/index.d.ts +2 -2
  159. package/dist/components/lines/index.d.ts +2 -2
  160. package/dist/components/link/context.d.ts +2 -2
  161. package/dist/components/link/index.d.ts +2 -2
  162. package/dist/components/list/context.d.ts +2 -2
  163. package/dist/components/list/index.d.ts +2 -2
  164. package/dist/components/list/item-content.d.ts +2 -2
  165. package/dist/components/list/item-description.d.ts +2 -2
  166. package/dist/components/list/item-title.d.ts +2 -2
  167. package/dist/components/list/item.d.ts +2 -2
  168. package/dist/components/media-controls/context.d.ts +4 -4
  169. package/dist/components/media-controls/fullscreen-button.d.ts +2 -2
  170. package/dist/components/media-controls/index.d.ts +2 -2
  171. package/dist/components/media-controls/mute-button.d.ts +2 -2
  172. package/dist/components/media-controls/play-button.d.ts +2 -2
  173. package/dist/components/media-controls/playback-rate.d.ts +2 -2
  174. package/dist/components/media-controls/seek-button.d.ts +2 -2
  175. package/dist/components/media-controls/time-display.d.ts +2 -2
  176. package/dist/components/media-controls/time-range.d.ts +2 -2
  177. package/dist/components/media-controls/volume-slider.d.ts +2 -2
  178. package/dist/components/menu/context.d.ts +2 -2
  179. package/dist/components/menu/index.d.ts +2 -2
  180. package/dist/components/menu/item-description.d.ts +2 -2
  181. package/dist/components/menu/item-label.d.ts +2 -2
  182. package/dist/components/menu/item.d.ts +2 -2
  183. package/dist/components/menu/section.d.ts +2 -2
  184. package/dist/components/menu/separator.d.ts +2 -2
  185. package/dist/components/menu/submenu.d.ts +2 -2
  186. package/dist/components/notice/index.d.ts +2 -2
  187. package/dist/components/notice/list.d.ts +2 -2
  188. package/dist/components/notice/notice-icon.d.ts +2 -2
  189. package/dist/components/options/context.d.ts +2 -2
  190. package/dist/components/options/index.d.ts +2 -2
  191. package/dist/components/options/item-content.d.ts +2 -2
  192. package/dist/components/options/item-description.d.ts +2 -2
  193. package/dist/components/options/item-label.d.ts +2 -2
  194. package/dist/components/options/item.d.ts +2 -2
  195. package/dist/components/options/section.d.ts +2 -2
  196. package/dist/components/pagination/context.d.ts +2 -2
  197. package/dist/components/pagination/index.d.ts +2 -2
  198. package/dist/components/pagination/next.d.ts +2 -2
  199. package/dist/components/pagination/pages.d.ts +2 -2
  200. package/dist/components/pagination/prev.d.ts +2 -2
  201. package/dist/components/popover/content.d.ts +2 -2
  202. package/dist/components/popover/footer.d.ts +2 -2
  203. package/dist/components/popover/index.d.ts +2 -2
  204. package/dist/components/popover/title.d.ts +2 -2
  205. package/dist/components/popover/trigger.d.ts +2 -2
  206. package/dist/components/query-builder/action-element.d.ts +2 -2
  207. package/dist/components/query-builder/combinator-selector.d.ts +2 -2
  208. package/dist/components/query-builder/index.d.ts +2 -2
  209. package/dist/components/query-builder/rule-group.d.ts +4 -4
  210. package/dist/components/query-builder/rule.d.ts +2 -2
  211. package/dist/components/query-builder/value-editor.d.ts +2 -2
  212. package/dist/components/query-builder/value-selector.d.ts +2 -2
  213. package/dist/components/radio/context.d.ts +3 -3
  214. package/dist/components/radio/group.d.ts +2 -2
  215. package/dist/components/radio/index.d.ts +2 -2
  216. package/dist/components/search-field/context.d.ts +2 -2
  217. package/dist/components/search-field/index.d.ts +2 -2
  218. package/dist/components/select-field/context.d.ts +4 -4
  219. package/dist/components/select-field/index.d.ts +2 -2
  220. package/dist/components/sidenav/avatar.d.ts +2 -2
  221. package/dist/components/sidenav/content.d.ts +2 -2
  222. package/dist/components/sidenav/context.d.ts +2 -2
  223. package/dist/components/sidenav/footer.d.ts +2 -2
  224. package/dist/components/sidenav/header.d.ts +2 -2
  225. package/dist/components/sidenav/index.d.ts +2 -2
  226. package/dist/components/sidenav/item.d.ts +2 -2
  227. package/dist/components/sidenav/link.d.ts +2 -2
  228. package/dist/components/sidenav/menu-item.d.ts +2 -2
  229. package/dist/components/sidenav/menu.d.ts +2 -2
  230. package/dist/components/sidenav/trigger.d.ts +2 -2
  231. package/dist/components/skeleton/index.d.ts +2 -2
  232. package/dist/components/slider/index.d.ts +2 -2
  233. package/dist/components/status-indicator/index.d.ts +2 -2
  234. package/dist/components/stepper/back.d.ts +71 -0
  235. package/dist/components/stepper/back.js +82 -0
  236. package/dist/components/stepper/back.js.map +1 -0
  237. package/dist/components/stepper/context.d.ts +49 -0
  238. package/dist/components/stepper/context.js +56 -0
  239. package/dist/components/stepper/context.js.map +1 -0
  240. package/dist/components/stepper/index.d.ts +22 -0
  241. package/dist/components/stepper/index.js +23 -0
  242. package/dist/components/stepper/list.d.ts +65 -0
  243. package/dist/components/stepper/list.js +121 -0
  244. package/dist/components/stepper/list.js.map +1 -0
  245. package/dist/components/stepper/next.d.ts +80 -0
  246. package/dist/components/stepper/next.js +91 -0
  247. package/dist/components/stepper/next.js.map +1 -0
  248. package/dist/components/stepper/panel.d.ts +66 -0
  249. package/dist/components/stepper/panel.js +77 -0
  250. package/dist/components/stepper/panel.js.map +1 -0
  251. package/dist/components/stepper/step.d.ts +49 -0
  252. package/dist/components/stepper/step.js +89 -0
  253. package/dist/components/stepper/step.js.map +1 -0
  254. package/dist/components/stepper/stepper.d.ts +130 -0
  255. package/dist/components/stepper/stepper.js +154 -0
  256. package/dist/components/stepper/stepper.js.map +1 -0
  257. package/dist/components/stepper/styles.module.css +126 -0
  258. package/dist/components/stepper/types.d.ts +205 -0
  259. package/dist/components/stepper/types.js +12 -0
  260. package/dist/components/stepper/use-stepper-state.d.ts +175 -0
  261. package/dist/components/stepper/use-stepper-state.js +225 -0
  262. package/dist/components/stepper/use-stepper-state.js.map +1 -0
  263. package/dist/components/switch/context.d.ts +4 -4
  264. package/dist/components/switch/index.d.ts +2 -2
  265. package/dist/components/table/body.d.ts +4 -3
  266. package/dist/components/table/body.js.map +1 -1
  267. package/dist/components/table/cell.d.ts +4 -3
  268. package/dist/components/table/cell.js.map +1 -1
  269. package/dist/components/table/context.d.ts +2 -2
  270. package/dist/components/table/features.d.ts +80 -0
  271. package/dist/components/table/features.js +61 -0
  272. package/dist/components/table/features.js.map +1 -0
  273. package/dist/components/table/header-cell.d.ts +4 -3
  274. package/dist/components/table/header-cell.js.map +1 -1
  275. package/dist/components/table/header.d.ts +4 -3
  276. package/dist/components/table/header.js.map +1 -1
  277. package/dist/components/table/index.d.ts +2 -2
  278. package/dist/components/table/index.js +40 -49
  279. package/dist/components/table/index.js.map +1 -1
  280. package/dist/components/table/row-ordering-feature.d.ts +88 -0
  281. package/dist/components/table/row-ordering-feature.js +115 -0
  282. package/dist/components/table/row-ordering-feature.js.map +1 -0
  283. package/dist/components/table/row.d.ts +4 -3
  284. package/dist/components/table/row.js.map +1 -1
  285. package/dist/components/table/types.d.ts +15 -13
  286. package/dist/components/tabs/context.d.ts +6 -6
  287. package/dist/components/tabs/index.d.ts +2 -2
  288. package/dist/components/tabs/list.d.ts +2 -2
  289. package/dist/components/tabs/panel.d.ts +2 -2
  290. package/dist/components/tabs/tab.d.ts +2 -2
  291. package/dist/components/text-area-field/context.d.ts +4 -4
  292. package/dist/components/text-area-field/index.d.ts +2 -2
  293. package/dist/components/text-field/context.d.ts +4 -4
  294. package/dist/components/text-field/index.d.ts +2 -2
  295. package/dist/components/time-field/index.d.ts +2 -2
  296. package/dist/components/tooltip/context.d.ts +2 -2
  297. package/dist/components/tooltip/index.d.ts +2 -2
  298. package/dist/components/tooltip/trigger.d.ts +2 -2
  299. package/dist/components/tree/context.d.ts +3 -3
  300. package/dist/components/tree/index.d.ts +2 -2
  301. package/dist/components/tree/item-actions.d.ts +2 -2
  302. package/dist/components/tree/item-content.d.ts +2 -2
  303. package/dist/components/tree/item-description.d.ts +2 -2
  304. package/dist/components/tree/item-label.d.ts +2 -2
  305. package/dist/components/tree/item-prefix-icon.d.ts +2 -2
  306. package/dist/components/tree/item.d.ts +2 -2
  307. package/dist/components/tree/lines.d.ts +2 -2
  308. package/dist/components/video/index.d.ts +2 -2
  309. package/dist/components/view-stack/context.d.ts +2 -2
  310. package/dist/components/view-stack/index.d.ts +2 -2
  311. package/dist/components/view-stack/trigger.d.ts +2 -2
  312. package/dist/components/view-stack/view.d.ts +2 -2
  313. package/dist/index.d.ts +13 -2
  314. package/dist/index.js +11 -1
  315. package/dist/providers/portal.d.ts +2 -2
  316. package/dist/providers/theme-provider.d.ts +2 -2
  317. package/package.json +28 -12
@@ -0,0 +1,205 @@
1
+ /*
2
+ * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at https://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+ import { ButtonProps } from "../button/types.js";
14
+ import { PropsWithChildren, ReactNode, RefAttributes } from "react";
15
+ import { Key } from "@react-types/shared";
16
+
17
+ //#region src/components/stepper/types.d.ts
18
+ /**
19
+ * Orientation of the stepper layout.
20
+ */
21
+ type Orientation = 'horizontal' | 'vertical';
22
+ /**
23
+ * Props for the root Stepper component.
24
+ *
25
+ * Supports controlled and uncontrolled navigation, completed-step tracking,
26
+ * disabled-step constraints, and horizontal or vertical layouts.
27
+ */
28
+ type StepperProps = PropsWithChildren<RefAttributes<HTMLDivElement> & {
29
+ /**
30
+ * CSS class for the stepper container.
31
+ */
32
+ className?: string;
33
+ /**
34
+ * Controlled current step key.
35
+ */
36
+ currentStep?: Key;
37
+ /**
38
+ * Default step key for uncontrolled mode.
39
+ */
40
+ defaultStep?: Key;
41
+ /**
42
+ * Callback invoked when the current step changes.
43
+ */
44
+ onStepChange?: (key: Key) => void;
45
+ /**
46
+ * Validation callback invoked before step change.
47
+ * Return false to block navigation.
48
+ *
49
+ * @param fromKey - The current step key
50
+ * @param toKey - The target step key
51
+ * @returns true to allow navigation, false to block
52
+ */
53
+ onBeforeStepChange?: (fromKey: Key, toKey: Key) => boolean;
54
+ /**
55
+ * Layout orientation of the stepper.
56
+ *
57
+ * @default 'horizontal'
58
+ */
59
+ orientation?: Orientation;
60
+ /**
61
+ * Controlled set of completed step keys.
62
+ */
63
+ completedSteps?: Set<Key>;
64
+ /**
65
+ * Default set of completed step keys for uncontrolled mode.
66
+ */
67
+ defaultCompletedSteps?: Set<Key>;
68
+ /**
69
+ * Set of disabled step keys that block navigation.
70
+ */
71
+ disabledKeys?: Set<Key>;
72
+ }>;
73
+ /**
74
+ * Render state describing the current stepper status.
75
+ */
76
+ type StepperRenderState = {
77
+ /**
78
+ * Current step key.
79
+ */
80
+ currentStep: Key | undefined;
81
+ /**
82
+ * Orientation of the stepper.
83
+ */
84
+ orientation: Orientation;
85
+ /**
86
+ * Whether the current step is the first step.
87
+ */
88
+ isFirstStep: boolean;
89
+ /**
90
+ * Whether the current step is the last step.
91
+ */
92
+ isLastStep: boolean;
93
+ };
94
+ /**
95
+ * Props for the StepperList component.
96
+ *
97
+ * Applied to the navigation container that owns keyboard step navigation.
98
+ */
99
+ type StepperListProps = PropsWithChildren<RefAttributes<HTMLDivElement> & {
100
+ /**
101
+ * CSS class for the list container.
102
+ */
103
+ className?: string;
104
+ }>;
105
+ /**
106
+ * Render state describing the current StepperList navigation status.
107
+ */
108
+ type StepperListRenderState = {
109
+ /**
110
+ * Current step key.
111
+ */
112
+ currentStep: Key | undefined;
113
+ /**
114
+ * Orientation of the stepper.
115
+ */
116
+ orientation: Orientation;
117
+ };
118
+ /**
119
+ * Render state describing an individual step button.
120
+ */
121
+ type StepperStepRenderState = {
122
+ /**
123
+ * Whether this step is the current active step.
124
+ */
125
+ isCurrent: boolean;
126
+ /**
127
+ * Whether this step has been completed.
128
+ */
129
+ isCompleted: boolean;
130
+ /**
131
+ * Whether this step is disabled.
132
+ */
133
+ isDisabled: boolean;
134
+ /**
135
+ * The numeric position of this step (1-indexed).
136
+ */
137
+ stepNumber: number;
138
+ /**
139
+ * Total number of steps.
140
+ */
141
+ totalSteps: number;
142
+ };
143
+ /**
144
+ * Props for the StepperStep component.
145
+ *
146
+ * Each step must provide an `id` that matches the corresponding
147
+ * {@link StepperPanelProps.id} so the step button and panel stay in sync.
148
+ */
149
+ type StepperStepProps = PropsWithChildren<RefAttributes<HTMLButtonElement> & {
150
+ /**
151
+ * Unique identifier for the step. Must match corresponding StepperPanel id.
152
+ */
153
+ id: Key;
154
+ /**
155
+ * CSS class for the step button.
156
+ */
157
+ className?: string;
158
+ /**
159
+ * Whether this step is disabled and blocks navigation.
160
+ */
161
+ isDisabled?: boolean;
162
+ }>;
163
+ /**
164
+ * Props for the StepperPanel component.
165
+ *
166
+ * The panel renders only when its `id` matches the current step.
167
+ */
168
+ type StepperPanelProps = RefAttributes<HTMLDivElement> & {
169
+ /**
170
+ * Unique identifier for the panel. Must match corresponding StepperStep id.
171
+ */
172
+ id: Key;
173
+ /**
174
+ * Child content to display when this panel is active.
175
+ */
176
+ children?: ReactNode;
177
+ /**
178
+ * CSS class for the panel container.
179
+ */
180
+ className?: string;
181
+ };
182
+ /**
183
+ * Render state describing whether a panel is currently active.
184
+ */
185
+ type StepperPanelRenderState = {
186
+ /**
187
+ * Whether this panel is currently active.
188
+ */
189
+ isCurrent: boolean;
190
+ };
191
+ /**
192
+ * Props for the StepperBack component.
193
+ *
194
+ * Inherits all button props and adds no stepper-specific fields.
195
+ */
196
+ type StepperBackProps = ButtonProps;
197
+ /**
198
+ * Props for the StepperNext component.
199
+ *
200
+ * Inherits all button props and adds no stepper-specific fields.
201
+ */
202
+ type StepperNextProps = ButtonProps;
203
+ //#endregion
204
+ export { Orientation, StepperBackProps, StepperListProps, StepperListRenderState, StepperNextProps, StepperPanelProps, StepperPanelRenderState, StepperProps, StepperRenderState, StepperStepProps, StepperStepRenderState };
205
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,12 @@
1
+ /*
2
+ * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at https://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
@@ -0,0 +1,175 @@
1
+ /*
2
+ * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at https://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+ import { Orientation as Orientation$1 } from "./types.js";
14
+ import { Key } from "@react-types/shared";
15
+
16
+ //#region src/components/stepper/use-stepper-state.d.ts
17
+ /**
18
+ * Configuration options for {@link useStepperState}.
19
+ *
20
+ * Supports controlled and uncontrolled current-step state, completed-step
21
+ * tracking, disabled-step constraints, and orientation metadata consumed by
22
+ * stepper UI components.
23
+ */
24
+ type UseStepperStateProps = {
25
+ /**
26
+ * Controlled current step key.
27
+ */
28
+ currentStep?: Key;
29
+ /**
30
+ * Default step key for uncontrolled mode.
31
+ */
32
+ defaultStep?: Key;
33
+ /**
34
+ * Callback invoked when the current step changes.
35
+ */
36
+ onStepChange?: (key: Key) => void;
37
+ /**
38
+ * Validation callback invoked before step change.
39
+ * Return false to block navigation.
40
+ */
41
+ onBeforeStepChange?: (fromKey: Key, toKey: Key) => boolean;
42
+ /**
43
+ * Controlled set of completed step keys.
44
+ */
45
+ completedSteps?: Set<Key>;
46
+ /**
47
+ * Default set of completed step keys for uncontrolled mode.
48
+ */
49
+ defaultCompletedSteps?: Set<Key>;
50
+ /**
51
+ * Set of disabled step keys that block navigation.
52
+ */
53
+ disabledKeys?: Set<Key>;
54
+ /**
55
+ * Layout orientation of the stepper.
56
+ */
57
+ orientation?: Orientation$1;
58
+ };
59
+ /**
60
+ * State and navigation helpers returned by {@link useStepperState}.
61
+ *
62
+ * This shape is shared through {@link StepperContext} and consumed by the
63
+ * stepper component family.
64
+ */
65
+ type StepperState = {
66
+ /**
67
+ * Current active step key.
68
+ * `undefined` when no steps have been registered yet or no default/controlled value provided.
69
+ */
70
+ currentStep: Key | undefined;
71
+ /**
72
+ * Set of completed step keys.
73
+ */
74
+ completedSteps: Set<Key>;
75
+ /**
76
+ * Set of disabled step keys.
77
+ */
78
+ disabledKeys: Set<Key>;
79
+ /**
80
+ * Orientation of the stepper.
81
+ */
82
+ orientation: Orientation$1;
83
+ /**
84
+ * Array of registered step keys in order.
85
+ */
86
+ steps: Key[];
87
+ /**
88
+ * Registers a step key in navigation order.
89
+ * Duplicate registrations are ignored.
90
+ */
91
+ register: (key: Key) => void;
92
+ /**
93
+ * Removes a step key from the registered navigation order.
94
+ * Missing keys are ignored.
95
+ */
96
+ unregister: (key: Key) => void;
97
+ /**
98
+ * Attempts to navigate to the provided step key.
99
+ * Does nothing when the target step is disabled, unregistered, or blocked by validation.
100
+ */
101
+ goToStep: (key: Key) => void;
102
+ /**
103
+ * Navigate to the next step.
104
+ */
105
+ next: () => void;
106
+ /**
107
+ * Navigate to the previous step.
108
+ */
109
+ previous: () => void;
110
+ /**
111
+ * Check if a step is disabled.
112
+ */
113
+ isDisabled: (key: Key) => boolean;
114
+ /**
115
+ * Whether current step is the first step.
116
+ */
117
+ isFirstStep: boolean;
118
+ /**
119
+ * Whether the current step is the last step.
120
+ */
121
+ isLastStep: boolean;
122
+ /**
123
+ * Get the index of a step in the registered steps array.
124
+ */
125
+ getStepIndex: (key: Key) => number;
126
+ };
127
+ /**
128
+ * Manages state for the stepper component family.
129
+ *
130
+ * Tracks registered steps, resolves controlled versus uncontrolled state,
131
+ * updates completed-step bookkeeping, and exposes navigation helpers used by
132
+ * the stepper UI components.
133
+ *
134
+ * @param props - The stepper state configuration.
135
+ * @param props.currentStep - Controlled active step key.
136
+ * @param props.defaultStep - Initial active step key for uncontrolled usage.
137
+ * @param props.onStepChange - Called after navigation changes the active step.
138
+ * @param props.onBeforeStepChange - Called before navigation; return `false` to block it.
139
+ * @param props.completedSteps - Controlled set of completed step keys.
140
+ * @param props.defaultCompletedSteps - Initial completed step keys for uncontrolled usage.
141
+ * @param props.disabledKeys - Step keys that cannot be navigated to.
142
+ * @param props.orientation - Layout orientation metadata for the consuming UI.
143
+ * @returns State and navigation helpers for the registered step sequence.
144
+ *
145
+ * @remarks
146
+ * Steps register on mount and unregister on unmount. Moving forward marks the
147
+ * previous step as completed, while moving backward clears completed state from
148
+ * the destination step onward in uncontrolled mode.
149
+ *
150
+ * @example
151
+ * ```tsx
152
+ * const state = useStepperState({
153
+ * defaultStep: 'account',
154
+ * orientation: 'horizontal',
155
+ * });
156
+ * ```
157
+ *
158
+ * @example
159
+ * ```tsx
160
+ * const [currentStep, setCurrentStep] = useState<Key>('account');
161
+ *
162
+ * const state = useStepperState({
163
+ * currentStep,
164
+ * onStepChange: setCurrentStep,
165
+ * onBeforeStepChange: (fromKey, toKey) => {
166
+ * return validateStep(fromKey, toKey);
167
+ * },
168
+ * disabledKeys: new Set<Key>(['review']),
169
+ * });
170
+ * ```
171
+ */
172
+ declare function useStepperState(props?: UseStepperStateProps): StepperState;
173
+ //#endregion
174
+ export { StepperState, UseStepperStateProps, useStepperState };
175
+ //# sourceMappingURL=use-stepper-state.d.ts.map
@@ -0,0 +1,225 @@
1
+ /*
2
+ * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at https://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+
14
+ import { useCallback, useMemo, useRef, useState } from "react";
15
+ import { useControlledState } from "react-stately/useControlledState";
16
+
17
+ //#region src/components/stepper/use-stepper-state.ts
18
+ /**
19
+ * Empty Set constant for stable default reference.
20
+ */
21
+ const EMPTY_SET = /* @__PURE__ */ new Set();
22
+ /**
23
+ * Manages state for the stepper component family.
24
+ *
25
+ * Tracks registered steps, resolves controlled versus uncontrolled state,
26
+ * updates completed-step bookkeeping, and exposes navigation helpers used by
27
+ * the stepper UI components.
28
+ *
29
+ * @param props - The stepper state configuration.
30
+ * @param props.currentStep - Controlled active step key.
31
+ * @param props.defaultStep - Initial active step key for uncontrolled usage.
32
+ * @param props.onStepChange - Called after navigation changes the active step.
33
+ * @param props.onBeforeStepChange - Called before navigation; return `false` to block it.
34
+ * @param props.completedSteps - Controlled set of completed step keys.
35
+ * @param props.defaultCompletedSteps - Initial completed step keys for uncontrolled usage.
36
+ * @param props.disabledKeys - Step keys that cannot be navigated to.
37
+ * @param props.orientation - Layout orientation metadata for the consuming UI.
38
+ * @returns State and navigation helpers for the registered step sequence.
39
+ *
40
+ * @remarks
41
+ * Steps register on mount and unregister on unmount. Moving forward marks the
42
+ * previous step as completed, while moving backward clears completed state from
43
+ * the destination step onward in uncontrolled mode.
44
+ *
45
+ * @example
46
+ * ```tsx
47
+ * const state = useStepperState({
48
+ * defaultStep: 'account',
49
+ * orientation: 'horizontal',
50
+ * });
51
+ * ```
52
+ *
53
+ * @example
54
+ * ```tsx
55
+ * const [currentStep, setCurrentStep] = useState<Key>('account');
56
+ *
57
+ * const state = useStepperState({
58
+ * currentStep,
59
+ * onStepChange: setCurrentStep,
60
+ * onBeforeStepChange: (fromKey, toKey) => {
61
+ * return validateStep(fromKey, toKey);
62
+ * },
63
+ * disabledKeys: new Set<Key>(['review']),
64
+ * });
65
+ * ```
66
+ */
67
+ function useStepperState(props = {}) {
68
+ const { currentStep: currentStepProp, defaultStep, onStepChange, onBeforeStepChange, completedSteps: completedStepsProp, defaultCompletedSteps, disabledKeys = EMPTY_SET, orientation = "horizontal" } = props;
69
+ const [currentStep, setCurrentStep] = useControlledState(currentStepProp, defaultStep ?? void 0, onStepChange);
70
+ const [completedSteps, setCompletedSteps] = useControlledState(completedStepsProp, defaultCompletedSteps ?? EMPTY_SET);
71
+ const [steps, setSteps] = useState([]);
72
+ const stepsRegistry = useRef(/* @__PURE__ */ new Set());
73
+ const orderedSteps = useRef([]);
74
+ /**
75
+ * Register a step.
76
+ */
77
+ const register = useCallback((key) => {
78
+ if (stepsRegistry.current.has(key)) return;
79
+ stepsRegistry.current.add(key);
80
+ orderedSteps.current.push(key);
81
+ setSteps(orderedSteps.current.slice());
82
+ }, []);
83
+ /**
84
+ * Unregister a step.
85
+ */
86
+ const unregister = useCallback((key) => {
87
+ if (!stepsRegistry.current.has(key)) return;
88
+ stepsRegistry.current.delete(key);
89
+ const keyIndex = orderedSteps.current.indexOf(key);
90
+ if (keyIndex === -1) return;
91
+ orderedSteps.current.splice(keyIndex, 1);
92
+ setSteps(orderedSteps.current.slice());
93
+ }, []);
94
+ /**
95
+ * Memoized step-key lookup table used to avoid repeated linear scans of `steps`
96
+ * during navigation and derived state checks.
97
+ */
98
+ const stepIndexByKey = useMemo(() => {
99
+ const nextStepIndexByKey = /* @__PURE__ */ new Map();
100
+ for (let index = 0; index < steps.length; index++) {
101
+ const step = steps[index];
102
+ if (step !== void 0) nextStepIndexByKey.set(step, index);
103
+ }
104
+ return nextStepIndexByKey;
105
+ }, [steps]);
106
+ const getStepIndex = useCallback((key) => {
107
+ return stepIndexByKey.get(key) ?? -1;
108
+ }, [stepIndexByKey]);
109
+ /**
110
+ * Check if a step is disabled.
111
+ */
112
+ const isDisabled = useCallback((key) => {
113
+ return disabledKeys.has(key);
114
+ }, [disabledKeys]);
115
+ const currentStepIndex = useMemo(() => {
116
+ if (currentStep === void 0) return -1;
117
+ return stepIndexByKey.get(currentStep) ?? -1;
118
+ }, [currentStep, stepIndexByKey]);
119
+ /**
120
+ * Check if the current step is the first step.
121
+ */
122
+ const isFirstStep = currentStepIndex === 0;
123
+ /**
124
+ * Check if the current step is the last step.
125
+ */
126
+ const isLastStep = currentStepIndex !== -1 && currentStepIndex === steps.length - 1;
127
+ /**
128
+ * Check if navigation to target step is blocked.
129
+ */
130
+ const isNavigationBlocked = useCallback((targetKey) => {
131
+ if (isDisabled(targetKey)) return true;
132
+ if (!stepsRegistry.current.has(targetKey)) return true;
133
+ if (currentStep === targetKey) return true;
134
+ return false;
135
+ }, [isDisabled, currentStep]);
136
+ /**
137
+ * Run validation callback if provided.
138
+ */
139
+ const runValidation = useCallback((fromKey, toKey) => {
140
+ if (!onBeforeStepChange || fromKey === void 0) return true;
141
+ return onBeforeStepChange(fromKey, toKey);
142
+ }, [onBeforeStepChange]);
143
+ /**
144
+ * Update completed steps based on navigation direction.
145
+ * Moving forward: mark the step we're leaving as completed.
146
+ * Moving backward: remove completed state from all steps at or after the destination.
147
+ */
148
+ const updateCompletedSteps = useCallback((fromKey, toKey) => {
149
+ if (fromKey === void 0) return;
150
+ const fromIndex = getStepIndex(fromKey);
151
+ const toIndex = getStepIndex(toKey);
152
+ const isForward = toIndex > fromIndex;
153
+ setCompletedSteps((previousCompletedSteps) => {
154
+ const nextCompletedSteps = new Set(previousCompletedSteps);
155
+ if (isForward) {
156
+ nextCompletedSteps.add(fromKey);
157
+ nextCompletedSteps.delete(toKey);
158
+ return nextCompletedSteps;
159
+ }
160
+ for (let index = toIndex; index < steps.length; index++) {
161
+ const step = steps[index];
162
+ if (step !== void 0) nextCompletedSteps.delete(step);
163
+ }
164
+ return nextCompletedSteps;
165
+ });
166
+ }, [
167
+ setCompletedSteps,
168
+ getStepIndex,
169
+ steps
170
+ ]);
171
+ /**
172
+ * Navigate to a specific step.
173
+ * Respects disabled keys and validation callbacks.
174
+ */
175
+ const goToStep = useCallback((targetKey) => {
176
+ if (isNavigationBlocked(targetKey)) return;
177
+ if (!runValidation(currentStep, targetKey)) return;
178
+ updateCompletedSteps(currentStep, targetKey);
179
+ setCurrentStep(targetKey);
180
+ }, [
181
+ currentStep,
182
+ isNavigationBlocked,
183
+ runValidation,
184
+ updateCompletedSteps,
185
+ setCurrentStep
186
+ ]);
187
+ return {
188
+ currentStep,
189
+ completedSteps,
190
+ disabledKeys,
191
+ orientation,
192
+ steps,
193
+ register,
194
+ unregister,
195
+ goToStep,
196
+ next: useCallback(() => {
197
+ if (currentStepIndex === -1 || currentStepIndex >= steps.length - 1) return;
198
+ const nextKey = steps[currentStepIndex + 1];
199
+ if (nextKey === void 0) return;
200
+ goToStep(nextKey);
201
+ }, [
202
+ currentStepIndex,
203
+ steps,
204
+ goToStep
205
+ ]),
206
+ previous: useCallback(() => {
207
+ if (currentStepIndex <= 0) return;
208
+ const previousKey = steps[currentStepIndex - 1];
209
+ if (previousKey === void 0) return;
210
+ goToStep(previousKey);
211
+ }, [
212
+ currentStepIndex,
213
+ steps,
214
+ goToStep
215
+ ]),
216
+ isDisabled,
217
+ isFirstStep,
218
+ isLastStep,
219
+ getStepIndex
220
+ };
221
+ }
222
+
223
+ //#endregion
224
+ export { useStepperState };
225
+ //# sourceMappingURL=use-stepper-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-stepper-state.js","names":[],"sources":["../../../src/components/stepper/use-stepper-state.ts"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { useCallback, useMemo, useRef, useState } from 'react';\nimport { useControlledState } from 'react-stately/useControlledState';\nimport type { Key } from '@react-types/shared';\nimport type { Orientation } from './types';\n\n/**\n * Empty Set constant for stable default reference.\n */\nconst EMPTY_SET = new Set<Key>();\n\n/**\n * Configuration options for {@link useStepperState}.\n *\n * Supports controlled and uncontrolled current-step state, completed-step\n * tracking, disabled-step constraints, and orientation metadata consumed by\n * stepper UI components.\n */\nexport type UseStepperStateProps = {\n /**\n * Controlled current step key.\n */\n currentStep?: Key;\n\n /**\n * Default step key for uncontrolled mode.\n */\n defaultStep?: Key;\n\n /**\n * Callback invoked when the current step changes.\n */\n onStepChange?: (key: Key) => void;\n\n /**\n * Validation callback invoked before step change.\n * Return false to block navigation.\n */\n onBeforeStepChange?: (fromKey: Key, toKey: Key) => boolean;\n\n /**\n * Controlled set of completed step keys.\n */\n completedSteps?: Set<Key>;\n\n /**\n * Default set of completed step keys for uncontrolled mode.\n */\n defaultCompletedSteps?: Set<Key>;\n\n /**\n * Set of disabled step keys that block navigation.\n */\n disabledKeys?: Set<Key>;\n\n /**\n * Layout orientation of the stepper.\n */\n orientation?: Orientation;\n};\n\n/**\n * State and navigation helpers returned by {@link useStepperState}.\n *\n * This shape is shared through {@link StepperContext} and consumed by the\n * stepper component family.\n */\nexport type StepperState = {\n /**\n * Current active step key.\n * `undefined` when no steps have been registered yet or no default/controlled value provided.\n */\n currentStep: Key | undefined;\n\n /**\n * Set of completed step keys.\n */\n completedSteps: Set<Key>;\n\n /**\n * Set of disabled step keys.\n */\n disabledKeys: Set<Key>;\n\n /**\n * Orientation of the stepper.\n */\n orientation: Orientation;\n\n /**\n * Array of registered step keys in order.\n */\n steps: Key[];\n\n /**\n * Registers a step key in navigation order.\n * Duplicate registrations are ignored.\n */\n register: (key: Key) => void;\n\n /**\n * Removes a step key from the registered navigation order.\n * Missing keys are ignored.\n */\n unregister: (key: Key) => void;\n\n /**\n * Attempts to navigate to the provided step key.\n * Does nothing when the target step is disabled, unregistered, or blocked by validation.\n */\n goToStep: (key: Key) => void;\n\n /**\n * Navigate to the next step.\n */\n next: () => void;\n\n /**\n * Navigate to the previous step.\n */\n previous: () => void;\n\n /**\n * Check if a step is disabled.\n */\n isDisabled: (key: Key) => boolean;\n\n /**\n * Whether current step is the first step.\n */\n isFirstStep: boolean;\n\n /**\n * Whether the current step is the last step.\n */\n isLastStep: boolean;\n\n /**\n * Get the index of a step in the registered steps array.\n */\n getStepIndex: (key: Key) => number;\n};\n\n/**\n * Manages state for the stepper component family.\n *\n * Tracks registered steps, resolves controlled versus uncontrolled state,\n * updates completed-step bookkeeping, and exposes navigation helpers used by\n * the stepper UI components.\n *\n * @param props - The stepper state configuration.\n * @param props.currentStep - Controlled active step key.\n * @param props.defaultStep - Initial active step key for uncontrolled usage.\n * @param props.onStepChange - Called after navigation changes the active step.\n * @param props.onBeforeStepChange - Called before navigation; return `false` to block it.\n * @param props.completedSteps - Controlled set of completed step keys.\n * @param props.defaultCompletedSteps - Initial completed step keys for uncontrolled usage.\n * @param props.disabledKeys - Step keys that cannot be navigated to.\n * @param props.orientation - Layout orientation metadata for the consuming UI.\n * @returns State and navigation helpers for the registered step sequence.\n *\n * @remarks\n * Steps register on mount and unregister on unmount. Moving forward marks the\n * previous step as completed, while moving backward clears completed state from\n * the destination step onward in uncontrolled mode.\n *\n * @example\n * ```tsx\n * const state = useStepperState({\n * defaultStep: 'account',\n * orientation: 'horizontal',\n * });\n * ```\n *\n * @example\n * ```tsx\n * const [currentStep, setCurrentStep] = useState<Key>('account');\n *\n * const state = useStepperState({\n * currentStep,\n * onStepChange: setCurrentStep,\n * onBeforeStepChange: (fromKey, toKey) => {\n * return validateStep(fromKey, toKey);\n * },\n * disabledKeys: new Set<Key>(['review']),\n * });\n * ```\n */\nexport function useStepperState(\n props: UseStepperStateProps = {},\n): StepperState {\n const {\n currentStep: currentStepProp,\n defaultStep,\n onStepChange,\n onBeforeStepChange,\n completedSteps: completedStepsProp,\n defaultCompletedSteps,\n disabledKeys = EMPTY_SET,\n orientation = 'horizontal',\n } = props;\n\n // Controlled/uncontrolled state for current step using react-stately.\n // Pass undefined as the fallback to handle the case where no default is provided.\n // Cast through unknown to satisfy TypeScript when defaultStep is undefined.\n const [currentStep, setCurrentStep] = useControlledState(\n currentStepProp,\n defaultStep ?? (undefined as unknown as Key),\n onStepChange,\n );\n\n // Controlled/uncontrolled state for completed steps using react-stately.\n // This works with useControlledState because we always provide a default (empty Set).\n const [completedSteps, setCompletedSteps] = useControlledState<Set<Key>>(\n completedStepsProp,\n defaultCompletedSteps ?? EMPTY_SET,\n );\n\n const [steps, setSteps] = useState<Key[]>([]);\n\n // Registry of registered step keys for membership checks.\n const stepsRegistry = useRef(new Set<Key>());\n\n // Ordered registered step keys used to preserve navigation sequence\n // and publish React state snapshots efficiently.\n const orderedSteps = useRef<Key[]>([]);\n\n /**\n * Register a step.\n */\n const register = useCallback((key: Key): void => {\n if (stepsRegistry.current.has(key)) {\n return;\n }\n\n stepsRegistry.current.add(key);\n orderedSteps.current.push(key);\n setSteps(orderedSteps.current.slice());\n }, []);\n\n /**\n * Unregister a step.\n */\n const unregister = useCallback((key: Key): void => {\n if (!stepsRegistry.current.has(key)) {\n return;\n }\n\n stepsRegistry.current.delete(key);\n\n const keyIndex = orderedSteps.current.indexOf(key);\n if (keyIndex === -1) {\n return;\n }\n\n orderedSteps.current.splice(keyIndex, 1);\n setSteps(orderedSteps.current.slice());\n }, []);\n\n /**\n * Memoized step-key lookup table used to avoid repeated linear scans of `steps`\n * during navigation and derived state checks.\n */\n const stepIndexByKey = useMemo((): Map<Key, number> => {\n const nextStepIndexByKey = new Map<Key, number>();\n\n for (let index = 0; index < steps.length; index++) {\n const step = steps[index];\n if (step !== undefined) {\n nextStepIndexByKey.set(step, index);\n }\n }\n\n return nextStepIndexByKey;\n }, [steps]);\n\n const getStepIndex = useCallback(\n (key: Key): number => {\n return stepIndexByKey.get(key) ?? -1;\n },\n [stepIndexByKey],\n );\n\n /**\n * Check if a step is disabled.\n */\n const isDisabled = useCallback(\n (key: Key): boolean => {\n return disabledKeys.has(key);\n },\n [disabledKeys],\n );\n\n const currentStepIndex = useMemo((): number => {\n if (currentStep === undefined) {\n return -1;\n }\n\n return stepIndexByKey.get(currentStep) ?? -1;\n }, [currentStep, stepIndexByKey]);\n\n /**\n * Check if the current step is the first step.\n */\n const isFirstStep = currentStepIndex === 0;\n\n /**\n * Check if the current step is the last step.\n */\n const isLastStep =\n currentStepIndex !== -1 && currentStepIndex === steps.length - 1;\n\n /**\n * Check if navigation to target step is blocked.\n */\n const isNavigationBlocked = useCallback(\n (targetKey: Key): boolean => {\n if (isDisabled(targetKey)) {\n return true;\n }\n if (!stepsRegistry.current.has(targetKey)) {\n return true;\n }\n if (currentStep === targetKey) {\n return true;\n }\n return false;\n },\n [isDisabled, currentStep],\n );\n\n /**\n * Run validation callback if provided.\n */\n const runValidation = useCallback(\n (fromKey: Key | undefined, toKey: Key): boolean => {\n if (!onBeforeStepChange || fromKey === undefined) {\n return true;\n }\n return onBeforeStepChange(fromKey, toKey);\n },\n [onBeforeStepChange],\n );\n\n /**\n * Update completed steps based on navigation direction.\n * Moving forward: mark the step we're leaving as completed.\n * Moving backward: remove completed state from all steps at or after the destination.\n */\n const updateCompletedSteps = useCallback(\n (fromKey: Key | undefined, toKey: Key): void => {\n if (fromKey === undefined) {\n return;\n }\n\n const fromIndex = getStepIndex(fromKey);\n const toIndex = getStepIndex(toKey);\n const isForward = toIndex > fromIndex;\n\n setCompletedSteps((previousCompletedSteps) => {\n const nextCompletedSteps = new Set(previousCompletedSteps);\n if (isForward) {\n nextCompletedSteps.add(fromKey);\n // The active destination step is not considered completed.\n nextCompletedSteps.delete(toKey);\n return nextCompletedSteps;\n }\n\n for (let index = toIndex; index < steps.length; index++) {\n const step = steps[index];\n if (step !== undefined) {\n nextCompletedSteps.delete(step);\n }\n }\n return nextCompletedSteps;\n });\n },\n [setCompletedSteps, getStepIndex, steps],\n );\n\n /**\n * Navigate to a specific step.\n * Respects disabled keys and validation callbacks.\n */\n const goToStep = useCallback(\n (targetKey: Key): void => {\n if (isNavigationBlocked(targetKey)) {\n return;\n }\n\n const allowed = runValidation(currentStep, targetKey);\n if (!allowed) {\n return;\n }\n\n updateCompletedSteps(currentStep, targetKey);\n\n // useControlledState handles both controlled and uncontrolled modes,\n // and calls onStepChange callback automatically\n setCurrentStep(targetKey);\n },\n [\n currentStep,\n isNavigationBlocked,\n runValidation,\n updateCompletedSteps,\n setCurrentStep,\n ],\n );\n\n /**\n * Navigate to the next step in sequence.\n */\n const next = useCallback((): void => {\n if (currentStepIndex === -1 || currentStepIndex >= steps.length - 1) {\n return;\n }\n\n const nextKey = steps[currentStepIndex + 1];\n if (nextKey === undefined) {\n return;\n }\n\n goToStep(nextKey);\n }, [currentStepIndex, steps, goToStep]);\n\n /**\n * Navigate to the previous step in sequence.\n */\n const previous = useCallback((): void => {\n if (currentStepIndex <= 0) {\n return;\n }\n\n const previousKey = steps[currentStepIndex - 1];\n if (previousKey === undefined) {\n return;\n }\n\n goToStep(previousKey);\n }, [currentStepIndex, steps, goToStep]);\n\n return {\n currentStep,\n completedSteps,\n disabledKeys,\n orientation,\n steps,\n register,\n unregister,\n goToStep,\n next,\n previous,\n isDisabled,\n isFirstStep,\n isLastStep,\n getStepIndex,\n };\n}\n"],"mappings":"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"}
@@ -13,13 +13,13 @@
13
13
  import { ProviderProps } from "../../lib/types.js";
14
14
  import { SwitchProps } from "./types.js";
15
15
  import "client-only";
16
- import * as react32 from "react";
17
- import * as react_jsx_runtime108 from "react/jsx-runtime";
16
+ import * as react50 from "react";
17
+ import * as react_jsx_runtime216 from "react/jsx-runtime";
18
18
  import { ContextValue } from "react-aria-components/slots";
19
19
 
20
20
  //#region src/components/switch/context.d.ts
21
21
  /** Context for sharing props across Switch components */
22
- declare const SwitchContext: react32.Context<ContextValue<SwitchProps, HTMLLabelElement>>;
22
+ declare const SwitchContext: react50.Context<ContextValue<SwitchProps, HTMLLabelElement>>;
23
23
  /**
24
24
  * Sets default props for all Switch components within.
25
25
  *
@@ -38,7 +38,7 @@ declare const SwitchContext: react32.Context<ContextValue<SwitchProps, HTMLLabel
38
38
  declare function SwitchProvider({
39
39
  children,
40
40
  ...props
41
- }: ProviderProps<SwitchProps>): react_jsx_runtime108.JSX.Element;
41
+ }: ProviderProps<SwitchProps>): react_jsx_runtime216.JSX.Element;
42
42
  //#endregion
43
43
  export { SwitchContext, SwitchProvider };
44
44
  //# sourceMappingURL=context.d.ts.map