@techsio/ui-kit 0.56.1 → 0.58.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 (346) hide show
  1. package/README.md +128 -133
  2. package/dist/atoms/action-icon.js +9 -8
  3. package/dist/atoms/button.js +78 -18
  4. package/dist/atoms/checkbox.js +77 -17
  5. package/dist/atoms/hotkeys.js +26 -7
  6. package/dist/atoms/icon.js +5 -5
  7. package/dist/atoms/image.js +107 -2
  8. package/dist/atoms/input.js +57 -9
  9. package/dist/atoms/label.js +13 -4
  10. package/dist/atoms/link-button.js +14 -12
  11. package/dist/atoms/link.js +18 -4
  12. package/dist/atoms/numeric-input.js +293 -76
  13. package/dist/atoms/rating.js +306 -73
  14. package/dist/atoms/skeleton.js +18 -14
  15. package/dist/atoms/status-text.js +31 -18
  16. package/dist/atoms/textarea.js +59 -12
  17. package/dist/atoms/tooltip.js +64 -43
  18. package/dist/hotkeys.js +1 -0
  19. package/dist/internal/choice-control.js +173 -0
  20. package/dist/internal/combobox-query-sync.js +11 -0
  21. package/dist/internal/date-picker-coordinator.js +56 -40
  22. package/dist/internal/date-picker-dom.js +44 -0
  23. package/dist/internal/date-picker-input.js +30 -0
  24. package/dist/internal/described-by.js +23 -18
  25. package/dist/internal/form-control-lifecycle.js +122 -0
  26. package/dist/internal/molecules/command.context.js +1 -0
  27. package/dist/internal/molecules/drawer.context.js +1 -0
  28. package/dist/internal/molecules/vertical-navigation.context.js +1 -0
  29. package/dist/internal/molecules/vertical-navigation.styles.js +9 -2
  30. package/dist/internal/numeric-input-editing.js +87 -0
  31. package/dist/internal/organisms/sidebar.context.js +1 -0
  32. package/dist/internal/organisms/sidebar.focus.js +1 -0
  33. package/dist/internal/overlay-portal.js +72 -0
  34. package/dist/internal/reduced-motion.js +1 -0
  35. package/dist/internal/use-effective-disabled.js +8 -0
  36. package/dist/molecules/accordion.js +44 -30
  37. package/dist/molecules/availability-status.js +1 -0
  38. package/dist/molecules/breadcrumb.js +11 -11
  39. package/dist/molecules/carousel.js +279 -97
  40. package/dist/molecules/cascade-select.js +327 -81
  41. package/dist/molecules/chart.js +276 -38
  42. package/dist/molecules/color-select.js +181 -62
  43. package/dist/molecules/combobox.js +535 -182
  44. package/dist/molecules/command.js +2 -1
  45. package/dist/molecules/date-picker.js +571 -119
  46. package/dist/molecules/dialog.js +81 -47
  47. package/dist/molecules/drawer.js +54 -5
  48. package/dist/molecules/file-upload.js +373 -37
  49. package/dist/molecules/form-checkbox.js +65 -22
  50. package/dist/molecules/form-error-summary.js +29 -5
  51. package/dist/molecules/form-input.js +26 -30
  52. package/dist/molecules/form-numeric-input.js +11 -9
  53. package/dist/molecules/form-textarea.js +26 -23
  54. package/dist/molecules/menu.js +170 -47
  55. package/dist/molecules/pagination.js +100 -28
  56. package/dist/molecules/phone-input.js +172 -37
  57. package/dist/molecules/popover.js +53 -26
  58. package/dist/molecules/price-block.js +1 -0
  59. package/dist/molecules/product-card.js +23 -18
  60. package/dist/molecules/quantity-field.js +4 -2
  61. package/dist/molecules/radio-card.js +102 -30
  62. package/dist/molecules/radio-group.js +108 -31
  63. package/dist/molecules/search-form.js +116 -13
  64. package/dist/molecules/select.js +226 -81
  65. package/dist/molecules/slider.js +141 -30
  66. package/dist/molecules/steps.js +181 -50
  67. package/dist/molecules/switch.js +85 -20
  68. package/dist/molecules/tabs.js +227 -31
  69. package/dist/molecules/toast.js +146 -51
  70. package/dist/molecules/totals-summary.js +2 -1
  71. package/dist/molecules/tour.js +9 -5
  72. package/dist/molecules/tree-view.js +255 -109
  73. package/dist/molecules/vertical-navigation.js +8 -4
  74. package/dist/organisms/data-table.fields.js +25 -5
  75. package/dist/organisms/data-table.helpers.js +6 -2
  76. package/dist/organisms/data-table.js +580 -151
  77. package/dist/organisms/footer.js +18 -11
  78. package/dist/organisms/gallery.js +61 -24
  79. package/dist/organisms/header.js +106 -32
  80. package/dist/organisms/line-item.js +1 -0
  81. package/dist/organisms/sidebar.js +1 -0
  82. package/dist/organisms/table.js +22 -7
  83. package/dist/src/atoms/action-icon.d.ts +10 -10
  84. package/dist/src/atoms/action-icon.d.ts.map +1 -1
  85. package/dist/src/atoms/badge.d.ts +3 -3
  86. package/dist/src/atoms/badge.d.ts.map +1 -1
  87. package/dist/src/atoms/button.d.ts +35 -24
  88. package/dist/src/atoms/button.d.ts.map +1 -1
  89. package/dist/src/atoms/checkbox.d.ts +6 -5
  90. package/dist/src/atoms/checkbox.d.ts.map +1 -1
  91. package/dist/src/atoms/hotkeys.d.ts +3 -2
  92. package/dist/src/atoms/hotkeys.d.ts.map +1 -1
  93. package/dist/src/atoms/icon.d.ts +18 -17
  94. package/dist/src/atoms/icon.d.ts.map +1 -1
  95. package/dist/src/atoms/image.d.ts +14 -6
  96. package/dist/src/atoms/image.d.ts.map +1 -1
  97. package/dist/src/atoms/input.d.ts +23 -14
  98. package/dist/src/atoms/input.d.ts.map +1 -1
  99. package/dist/src/atoms/label.d.ts +4 -4
  100. package/dist/src/atoms/label.d.ts.map +1 -1
  101. package/dist/src/atoms/link-button.d.ts +54 -31
  102. package/dist/src/atoms/link-button.d.ts.map +1 -1
  103. package/dist/src/atoms/link.d.ts +30 -9
  104. package/dist/src/atoms/link.d.ts.map +1 -1
  105. package/dist/src/atoms/numeric-input.d.ts +23 -19
  106. package/dist/src/atoms/numeric-input.d.ts.map +1 -1
  107. package/dist/src/atoms/rating.d.ts +54 -26
  108. package/dist/src/atoms/rating.d.ts.map +1 -1
  109. package/dist/src/atoms/skeleton.d.ts +9 -9
  110. package/dist/src/atoms/skeleton.d.ts.map +1 -1
  111. package/dist/src/atoms/status-text.d.ts +21 -13
  112. package/dist/src/atoms/status-text.d.ts.map +1 -1
  113. package/dist/src/atoms/textarea.d.ts +22 -20
  114. package/dist/src/atoms/textarea.d.ts.map +1 -1
  115. package/dist/src/atoms/tooltip.d.ts +5 -5
  116. package/dist/src/atoms/tooltip.d.ts.map +1 -1
  117. package/dist/src/hotkeys.d.ts +1 -1
  118. package/dist/src/hotkeys.d.ts.map +1 -1
  119. package/dist/src/internal/choice-control.d.ts +18 -0
  120. package/dist/src/internal/choice-control.d.ts.map +1 -0
  121. package/dist/src/internal/combobox-query-sync.d.ts +4 -0
  122. package/dist/src/internal/combobox-query-sync.d.ts.map +1 -0
  123. package/dist/src/internal/date-picker-coordinator.d.ts +7 -1
  124. package/dist/src/internal/date-picker-coordinator.d.ts.map +1 -1
  125. package/dist/src/internal/date-picker-dom.d.ts +10 -0
  126. package/dist/src/internal/date-picker-dom.d.ts.map +1 -0
  127. package/dist/src/internal/date-picker-input.d.ts +7 -0
  128. package/dist/src/internal/date-picker-input.d.ts.map +1 -0
  129. package/dist/src/internal/described-by.d.ts +7 -1
  130. package/dist/src/internal/described-by.d.ts.map +1 -1
  131. package/dist/src/internal/form-control-lifecycle.d.ts +22 -0
  132. package/dist/src/internal/form-control-lifecycle.d.ts.map +1 -0
  133. package/dist/src/internal/molecules/vertical-navigation.context.d.ts +1 -1
  134. package/dist/src/internal/molecules/vertical-navigation.context.d.ts.map +1 -1
  135. package/dist/src/internal/molecules/vertical-navigation.styles.d.ts +21 -0
  136. package/dist/src/internal/molecules/vertical-navigation.styles.d.ts.map +1 -1
  137. package/dist/src/internal/numeric-input-editing.d.ts +13 -0
  138. package/dist/src/internal/numeric-input-editing.d.ts.map +1 -0
  139. package/dist/src/internal/overlay-portal.d.ts +18 -0
  140. package/dist/src/internal/overlay-portal.d.ts.map +1 -0
  141. package/dist/src/internal/use-effective-disabled.d.ts +4 -0
  142. package/dist/src/internal/use-effective-disabled.d.ts.map +1 -0
  143. package/dist/src/molecules/accordion.d.ts +25 -19
  144. package/dist/src/molecules/accordion.d.ts.map +1 -1
  145. package/dist/src/molecules/availability-status.d.ts +4 -1
  146. package/dist/src/molecules/availability-status.d.ts.map +1 -1
  147. package/dist/src/molecules/breadcrumb.d.ts +2 -2
  148. package/dist/src/molecules/breadcrumb.d.ts.map +1 -1
  149. package/dist/src/molecules/carousel.d.ts +51 -52
  150. package/dist/src/molecules/carousel.d.ts.map +1 -1
  151. package/dist/src/molecules/cascade-select.d.ts +23 -8
  152. package/dist/src/molecules/cascade-select.d.ts.map +1 -1
  153. package/dist/src/molecules/chart.d.ts +7 -1
  154. package/dist/src/molecules/chart.d.ts.map +1 -1
  155. package/dist/src/molecules/color-select.d.ts +19 -3
  156. package/dist/src/molecules/color-select.d.ts.map +1 -1
  157. package/dist/src/molecules/combobox.d.ts +23 -5
  158. package/dist/src/molecules/combobox.d.ts.map +1 -1
  159. package/dist/src/molecules/command.d.ts +1 -1
  160. package/dist/src/molecules/date-picker.d.ts +7 -3
  161. package/dist/src/molecules/date-picker.d.ts.map +1 -1
  162. package/dist/src/molecules/dialog.d.ts +7 -3
  163. package/dist/src/molecules/dialog.d.ts.map +1 -1
  164. package/dist/src/molecules/drawer.d.ts +4 -4
  165. package/dist/src/molecules/drawer.d.ts.map +1 -1
  166. package/dist/src/molecules/file-upload.d.ts +11 -6
  167. package/dist/src/molecules/file-upload.d.ts.map +1 -1
  168. package/dist/src/molecules/form-checkbox.d.ts +7 -2
  169. package/dist/src/molecules/form-checkbox.d.ts.map +1 -1
  170. package/dist/src/molecules/form-error-summary.d.ts +4 -3
  171. package/dist/src/molecules/form-error-summary.d.ts.map +1 -1
  172. package/dist/src/molecules/form-input.d.ts +5 -6
  173. package/dist/src/molecules/form-input.d.ts.map +1 -1
  174. package/dist/src/molecules/form-numeric-input.d.ts +5 -5
  175. package/dist/src/molecules/form-numeric-input.d.ts.map +1 -1
  176. package/dist/src/molecules/form-textarea.d.ts +5 -6
  177. package/dist/src/molecules/form-textarea.d.ts.map +1 -1
  178. package/dist/src/molecules/menu.d.ts +17 -3
  179. package/dist/src/molecules/menu.d.ts.map +1 -1
  180. package/dist/src/molecules/pagination.d.ts +1 -1
  181. package/dist/src/molecules/pagination.d.ts.map +1 -1
  182. package/dist/src/molecules/phone-input.d.ts +4 -1
  183. package/dist/src/molecules/phone-input.d.ts.map +1 -1
  184. package/dist/src/molecules/popover.d.ts +7 -1
  185. package/dist/src/molecules/popover.d.ts.map +1 -1
  186. package/dist/src/molecules/price-block.d.ts +1 -1
  187. package/dist/src/molecules/price-block.d.ts.map +1 -1
  188. package/dist/src/molecules/product-card.d.ts +20 -25
  189. package/dist/src/molecules/product-card.d.ts.map +1 -1
  190. package/dist/src/molecules/quantity-field.d.ts +1 -1
  191. package/dist/src/molecules/quantity-field.d.ts.map +1 -1
  192. package/dist/src/molecules/radio-card.d.ts +10 -3
  193. package/dist/src/molecules/radio-card.d.ts.map +1 -1
  194. package/dist/src/molecules/radio-group.d.ts +15 -6
  195. package/dist/src/molecules/radio-group.d.ts.map +1 -1
  196. package/dist/src/molecules/search-form.d.ts +37 -12
  197. package/dist/src/molecules/search-form.d.ts.map +1 -1
  198. package/dist/src/molecules/select.d.ts +34 -29
  199. package/dist/src/molecules/select.d.ts.map +1 -1
  200. package/dist/src/molecules/slider.d.ts +23 -2
  201. package/dist/src/molecules/slider.d.ts.map +1 -1
  202. package/dist/src/molecules/steps.d.ts +30 -10
  203. package/dist/src/molecules/steps.d.ts.map +1 -1
  204. package/dist/src/molecules/switch.d.ts +54 -33
  205. package/dist/src/molecules/switch.d.ts.map +1 -1
  206. package/dist/src/molecules/tabs.d.ts +11 -11
  207. package/dist/src/molecules/tabs.d.ts.map +1 -1
  208. package/dist/src/molecules/toast.d.ts +25 -13
  209. package/dist/src/molecules/toast.d.ts.map +1 -1
  210. package/dist/src/molecules/totals-summary.d.ts +1 -1
  211. package/dist/src/molecules/totals-summary.d.ts.map +1 -1
  212. package/dist/src/molecules/tour.d.ts +1 -1
  213. package/dist/src/molecules/tour.d.ts.map +1 -1
  214. package/dist/src/molecules/tree-view.d.ts +16 -20
  215. package/dist/src/molecules/tree-view.d.ts.map +1 -1
  216. package/dist/src/molecules/vertical-navigation.d.ts +2 -2
  217. package/dist/src/molecules/vertical-navigation.d.ts.map +1 -1
  218. package/dist/src/organisms/data-table.d.ts +24 -3
  219. package/dist/src/organisms/data-table.d.ts.map +1 -1
  220. package/dist/src/organisms/data-table.fields.d.ts +4 -1
  221. package/dist/src/organisms/data-table.fields.d.ts.map +1 -1
  222. package/dist/src/organisms/data-table.helpers.d.ts +5 -12
  223. package/dist/src/organisms/data-table.helpers.d.ts.map +1 -1
  224. package/dist/src/organisms/footer.d.ts +5 -5
  225. package/dist/src/organisms/footer.d.ts.map +1 -1
  226. package/dist/src/organisms/gallery.d.ts +11 -9
  227. package/dist/src/organisms/gallery.d.ts.map +1 -1
  228. package/dist/src/organisms/header.d.ts +24 -22
  229. package/dist/src/organisms/header.d.ts.map +1 -1
  230. package/dist/src/organisms/table.d.ts +14 -14
  231. package/dist/src/organisms/table.d.ts.map +1 -1
  232. package/dist/src/templates/accordion.d.ts +8 -6
  233. package/dist/src/templates/accordion.d.ts.map +1 -1
  234. package/dist/src/templates/breadcrumb.d.ts +1 -1
  235. package/dist/src/templates/breadcrumb.d.ts.map +1 -1
  236. package/dist/src/templates/carousel.d.ts +3 -3
  237. package/dist/src/templates/carousel.d.ts.map +1 -1
  238. package/dist/src/templates/facet-filter-panel.d.ts +9 -3
  239. package/dist/src/templates/facet-filter-panel.d.ts.map +1 -1
  240. package/dist/src/templates/gallery.d.ts +2 -2
  241. package/dist/src/templates/gallery.d.ts.map +1 -1
  242. package/dist/src/templates/numeric-input.d.ts +1 -1
  243. package/dist/src/templates/numeric-input.d.ts.map +1 -1
  244. package/dist/src/templates/popover.d.ts +4 -2
  245. package/dist/src/templates/popover.d.ts.map +1 -1
  246. package/dist/src/templates/product-card.d.ts +12 -4
  247. package/dist/src/templates/product-card.d.ts.map +1 -1
  248. package/dist/src/templates/search-suggestions.d.ts +1 -1
  249. package/dist/src/templates/select.d.ts +7 -2
  250. package/dist/src/templates/select.d.ts.map +1 -1
  251. package/dist/src/templates/tabs.d.ts +8 -7
  252. package/dist/src/templates/tabs.d.ts.map +1 -1
  253. package/dist/src/theme/theme-config.d.ts +9 -16
  254. package/dist/src/theme/theme-config.d.ts.map +1 -1
  255. package/dist/src/theme/theme-provider.d.ts +16 -21
  256. package/dist/src/theme/theme-provider.d.ts.map +1 -1
  257. package/dist/src/theme/theme-toggle.d.ts.map +1 -1
  258. package/dist/src/utils.d.ts.map +1 -1
  259. package/dist/templates/accordion.js +3 -1
  260. package/dist/templates/breadcrumb.js +11 -4
  261. package/dist/templates/carousel.js +3 -6
  262. package/dist/templates/facet-filter-panel.js +121 -52
  263. package/dist/templates/gallery.js +6 -2
  264. package/dist/templates/numeric-input.js +6 -1
  265. package/dist/templates/popover.js +6 -1
  266. package/dist/templates/product-card.js +52 -26
  267. package/dist/templates/select.js +6 -1
  268. package/dist/templates/tabs.js +4 -2
  269. package/dist/theme/theme-config.js +8 -16
  270. package/dist/theme/theme-provider.js +89 -63
  271. package/dist/theme/theme-toggle.js +17 -9
  272. package/dist/utils.js +11 -1
  273. package/package.json +9 -5
  274. package/src/tokens/_base.css +4 -3
  275. package/src/tokens/_business-atoms.css +103 -0
  276. package/src/tokens/_foundation-overrides.css +251 -0
  277. package/src/tokens/_reset.css +10 -10
  278. package/src/tokens/_scheme-scopes.css +4144 -0
  279. package/src/tokens/_semantic.css +1 -23
  280. package/src/tokens/_tokens-base.css +36 -32
  281. package/src/tokens/_typography.css +2 -1
  282. package/src/tokens/components/_form-control.css +149 -6
  283. package/src/tokens/components/_popup-surface.css +15 -29
  284. package/src/tokens/components/atoms/_action-icon.css +49 -0
  285. package/src/tokens/components/atoms/_button.css +67 -0
  286. package/src/tokens/components/atoms/_checkbox.css +47 -4
  287. package/src/tokens/components/atoms/_hotkeys.css +2 -0
  288. package/src/tokens/components/atoms/_icon.css +60 -7
  289. package/src/tokens/components/atoms/_image.css +18 -0
  290. package/src/tokens/components/atoms/_input.css +20 -0
  291. package/src/tokens/components/atoms/_label.css +3 -7
  292. package/src/tokens/components/atoms/_link.css +47 -5
  293. package/src/tokens/components/atoms/_numeric-input.css +111 -2
  294. package/src/tokens/components/atoms/_rating.css +55 -6
  295. package/src/tokens/components/atoms/_skeleton.css +12 -2
  296. package/src/tokens/components/atoms/_status-text.css +35 -5
  297. package/src/tokens/components/atoms/_textarea.css +32 -3
  298. package/src/tokens/components/atoms/_tooltip.css +25 -0
  299. package/src/tokens/components/molecules/_accordion.css +46 -5
  300. package/src/tokens/components/molecules/_breadcrumb.css +15 -4
  301. package/src/tokens/components/molecules/_carousel.css +67 -0
  302. package/src/tokens/components/molecules/_cascade-select.css +104 -0
  303. package/src/tokens/components/molecules/_chart.css +12 -14
  304. package/src/tokens/components/molecules/_color-select.css +21 -0
  305. package/src/tokens/components/molecules/_combobox.css +81 -0
  306. package/src/tokens/components/molecules/_command.css +1 -0
  307. package/src/tokens/components/molecules/_date-picker.css +66 -10
  308. package/src/tokens/components/molecules/_dialog.css +36 -4
  309. package/src/tokens/components/molecules/_drawer.css +39 -3
  310. package/src/tokens/components/molecules/_file-upload.css +16 -1
  311. package/src/tokens/components/molecules/_menu.css +17 -0
  312. package/src/tokens/components/molecules/_pagination.css +19 -0
  313. package/src/tokens/components/molecules/_phone-input.css +20 -5
  314. package/src/tokens/components/molecules/_popover.css +34 -0
  315. package/src/tokens/components/molecules/_product-card.css +49 -0
  316. package/src/tokens/components/molecules/_radio-card.css +35 -0
  317. package/src/tokens/components/molecules/_radio-group.css +8 -0
  318. package/src/tokens/components/molecules/_select.css +33 -0
  319. package/src/tokens/components/molecules/_slider.css +5 -0
  320. package/src/tokens/components/molecules/_steps.css +52 -0
  321. package/src/tokens/components/molecules/_switch.css +59 -10
  322. package/src/tokens/components/molecules/_tabs.css +61 -3
  323. package/src/tokens/components/molecules/_toast.css +60 -0
  324. package/src/tokens/components/molecules/_totals-summary.css +22 -22
  325. package/src/tokens/components/molecules/_tour.css +16 -1
  326. package/src/tokens/components/molecules/_tree-view.css +27 -3
  327. package/src/tokens/components/molecules/_vertical-navigation.css +21 -3
  328. package/src/tokens/components/organisms/_data-table.css +97 -0
  329. package/src/tokens/components/organisms/_footer.css +9 -0
  330. package/src/tokens/components/organisms/_gallery.css +11 -0
  331. package/src/tokens/components/organisms/_header.css +22 -0
  332. package/src/tokens/components/organisms/_sidebar.css +1 -1
  333. package/src/tokens/components/organisms/_table.css +31 -0
  334. package/src/tokens/components/templates/_facet-filter-panel.css +11 -1
  335. package/src/tokens/figma/akros/variables.css +6 -6
  336. package/src/tokens/figma/brand-overrides.css +162 -57
  337. package/src/tokens/figma/business/variables.css +6 -6
  338. package/src/tokens/figma/cyber/variables.css +115 -38
  339. package/src/tokens/figma/cyber-dark/variables.css +115 -38
  340. package/src/tokens/figma/dark/variables.css +4 -4
  341. package/src/tokens/figma/light/variables.css +43 -40
  342. package/src/tokens/figma/{neo → n1}/variables.css +114 -114
  343. package/src/tokens/figma/variables.css +639 -240
  344. package/src/tokens/theme.css +24 -4
  345. package/src/tokens/_colors.css +0 -5
  346. package/src/tokens/figma/neo-dark/variables.css +0 -457
@@ -1,33 +1,36 @@
1
+ "use client";
1
2
  import { Fragment, jsx } from "react/jsx-runtime";
2
3
  import { mergeProps, normalizeProps, useMachine } from "@zag-js/react";
3
- import { connect, machine } from "@zag-js/steps";
4
- import { createContext, useContext, useEffect, useId, useState } from "react";
4
+ import { connect, machine, splitProps } from "@zag-js/steps";
5
+ import { createContext, useContext, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
6
+ import { flushSync } from "react-dom";
5
7
  import { Button } from "../atoms/button.js";
6
8
  import { Icon } from "../atoms/icon.js";
7
9
  import { tv } from "../utils.js";
8
10
  const stepsVariants = tv({
9
11
  slots: {
10
12
  root: [
11
- "flex w-full flex-col gap-steps-root",
13
+ "flex w-full min-w-0 max-w-full flex-col gap-steps-root",
12
14
  "text-steps-fg",
13
- "data-[orientation=vertical]:flex-row data-[orientation=vertical]:items-start"
15
+ "sm:data-[orientation=vertical]:flex-row sm:data-[orientation=vertical]:items-start"
14
16
  ],
15
17
  list: [
16
- "flex w-full gap-steps-list",
18
+ "flex w-full min-w-0 max-w-full gap-steps-list",
17
19
  "data-[orientation=horizontal]:items-start",
18
- "data-[orientation=vertical]:w-auto data-[orientation=vertical]:min-w-steps-list-vertical data-[orientation=vertical]:flex-col"
20
+ "data-[orientation=vertical]:flex-col sm:data-[orientation=vertical]:w-auto sm:data-[orientation=vertical]:min-w-steps-list-vertical"
19
21
  ],
20
22
  panels: [
21
- "flex w-full flex-col gap-steps-panels",
23
+ "flex w-full min-w-0 max-w-full flex-col gap-steps-panels",
22
24
  "data-[orientation=vertical]:min-w-0 data-[orientation=vertical]:flex-1"
23
25
  ],
24
26
  item: [
25
- "relative flex min-w-0 gap-steps-item",
27
+ "steps-indicator-connectors relative flex min-w-0 gap-steps-item",
26
28
  "data-[orientation=horizontal]:flex-1 data-[orientation=horizontal]:items-center",
27
29
  "data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-start"
28
30
  ],
29
31
  trigger: [
30
- "group relative flex min-w-0 items-center justify-start gap-steps-trigger",
32
+ "group relative flex min-w-0 max-w-full items-center justify-start gap-steps-trigger",
33
+ "data-[orientation=horizontal]:flex-col sm:data-[orientation=horizontal]:flex-row",
31
34
  "text-start",
32
35
  "focus-visible:outline-(style:--default-ring-style) focus-visible:outline-(length:--default-ring-width)",
33
36
  "focus-visible:outline-steps-ring",
@@ -37,7 +40,7 @@ const stepsVariants = tv({
37
40
  "transition-colors duration-200 motion-reduce:transition-none"
38
41
  ],
39
42
  itemText: [
40
- "inline-flex min-w-0 flex-col gap-steps-text",
43
+ "inline-flex min-w-0 max-w-full flex-col gap-steps-text",
41
44
  "data-[orientation=vertical]:items-start"
42
45
  ],
43
46
  indicator: [
@@ -54,13 +57,13 @@ const stepsVariants = tv({
54
57
  "font-steps-number leading-none"
55
58
  ],
56
59
  title: [
57
- "truncate font-steps-title text-steps-title text-steps-title-fg",
60
+ "break-words font-steps-title text-steps-title text-steps-title-fg",
58
61
  "data-current:text-steps-title-fg-current",
59
62
  "data-complete:text-steps-title-fg-complete",
60
63
  "transition-colors duration-200 motion-reduce:transition-none"
61
64
  ],
62
65
  description: [
63
- "text-steps-description text-steps-description-fg",
66
+ "break-words text-steps-description text-steps-description-fg",
64
67
  "data-current:text-steps-description-fg-current",
65
68
  "data-complete:text-steps-description-fg-complete",
66
69
  "transition-colors duration-200 motion-reduce:transition-none"
@@ -77,10 +80,11 @@ const stepsVariants = tv({
77
80
  progress: [
78
81
  "relative min-w-0 overflow-clip rounded-steps-progress bg-steps-progress-bg",
79
82
  "data-[orientation=horizontal]:h-steps-progress data-[orientation=horizontal]:w-full",
80
- "data-[orientation=vertical]:w-steps-progress data-[orientation=vertical]:self-stretch"
83
+ "data-[orientation=vertical]:h-steps-progress data-[orientation=vertical]:w-full data-[orientation=vertical]:self-stretch",
84
+ "sm:data-[orientation=vertical]:h-auto sm:data-[orientation=vertical]:w-steps-progress"
81
85
  ],
82
86
  progressRange: [
83
- "absolute rounded-steps-progress bg-steps-progress-range-bg",
87
+ "steps-progress-range absolute rounded-steps-progress bg-steps-progress-range-bg",
84
88
  "transition-[width,height] duration-200 motion-reduce:transition-none",
85
89
  "data-[orientation=horizontal]:inset-s-0 data-[orientation=horizontal]:inset-y-0",
86
90
  "data-[orientation=vertical]:inset-x-0 data-[orientation=vertical]:top-0"
@@ -109,8 +113,11 @@ const stepsVariants = tv({
109
113
  },
110
114
  variants: {
111
115
  variant: {
112
- subtle: {},
116
+ subtle: {
117
+ item: "steps-connector-subtle"
118
+ },
113
119
  solid: {
120
+ item: "steps-connector-solid",
114
121
  trigger: [
115
122
  "rounded-steps-trigger px-steps-trigger-x py-steps-trigger-y",
116
123
  "hover:bg-steps-trigger-bg-hover",
@@ -128,6 +135,7 @@ const stepsVariants = tv({
128
135
  },
129
136
  size: {
130
137
  sm: {
138
+ item: "steps-connector-sm",
131
139
  indicator: "size-steps-indicator-sm",
132
140
  indicatorIcon: "text-steps-icon-sm",
133
141
  number: "text-steps-number-sm",
@@ -137,6 +145,7 @@ const stepsVariants = tv({
137
145
  completedContent: "p-steps-content-padding-sm text-steps-content-sm"
138
146
  },
139
147
  md: {
148
+ item: "steps-connector-md",
140
149
  indicator: "size-steps-indicator-md",
141
150
  indicatorIcon: "text-steps-icon-md",
142
151
  number: "text-steps-number-md",
@@ -146,6 +155,7 @@ const stepsVariants = tv({
146
155
  completedContent: "p-steps-content-padding-md text-steps-content-md"
147
156
  },
148
157
  lg: {
158
+ item: "steps-connector-lg",
149
159
  indicator: "size-steps-indicator-lg",
150
160
  indicatorIcon: "text-steps-icon-lg",
151
161
  number: "text-steps-number-lg",
@@ -210,31 +220,139 @@ function getControlSize(size) {
210
220
  if ("lg" === size) return "lg";
211
221
  return "md";
212
222
  }
213
- function useSteps({ id, ...props }) {
223
+ function useSteps({ id, count = 1, step, defaultStep = 0, onStepChange, ...props }) {
214
224
  const generatedId = useId();
225
+ const safeCount = Number.isFinite(count) ? Math.max(0, Math.floor(count)) : 0;
226
+ const [local, setLocal] = useState({
227
+ value: defaultStep,
228
+ completed: defaultStep === safeCount
229
+ });
230
+ const rawStep = step ?? local.value;
231
+ const previous = useRef({
232
+ count: safeCount,
233
+ value: rawStep,
234
+ completed: rawStep === safeCount
235
+ });
236
+ const correction = useRef(null);
237
+ let completed = local.completed;
238
+ if (void 0 !== step) completed = previous.current.value === rawStep ? previous.current.completed : rawStep === safeCount;
239
+ const effectiveStep = 0 === safeCount || completed ? safeCount : Math.min(Math.max(0, Number.isFinite(rawStep) ? Math.floor(rawStep) : 0), safeCount - 1);
240
+ useEffect(()=>{
241
+ previous.current = {
242
+ count: safeCount,
243
+ value: rawStep,
244
+ completed
245
+ };
246
+ if (rawStep === effectiveStep) {
247
+ correction.current = null;
248
+ return;
249
+ }
250
+ if (void 0 === step) setLocal({
251
+ value: effectiveStep,
252
+ completed
253
+ });
254
+ const key = `${rawStep}:${effectiveStep}:${safeCount}`;
255
+ if (correction.current !== key) {
256
+ correction.current = key;
257
+ onStepChange?.({
258
+ step: effectiveStep
259
+ });
260
+ }
261
+ }, [
262
+ completed,
263
+ effectiveStep,
264
+ onStepChange,
265
+ rawStep,
266
+ safeCount,
267
+ step
268
+ ]);
215
269
  const service = useMachine(machine, {
270
+ ...props,
216
271
  id: id ?? generatedId,
217
- ...props
272
+ count: safeCount,
273
+ step: effectiveStep,
274
+ onStepChange: (details)=>{
275
+ if (void 0 === step) setLocal({
276
+ value: details.step,
277
+ completed: details.step === safeCount
278
+ });
279
+ onStepChange?.(details);
280
+ }
218
281
  });
219
- return connect(service, normalizeProps);
282
+ const api = connect(service, normalizeProps);
283
+ const percent = 0 === safeCount ? 100 : Math.min(100, Math.max(0, effectiveStep / safeCount * 100));
284
+ return {
285
+ ...api,
286
+ linear: props.linear ?? false,
287
+ percent,
288
+ getRootProps: ()=>({
289
+ ...api.getRootProps(),
290
+ style: {
291
+ ...api.getRootProps().style,
292
+ "--percent": `${percent}%`
293
+ }
294
+ }),
295
+ getProgressProps: ()=>({
296
+ ...api.getProgressProps(),
297
+ "aria-valuemin": 0,
298
+ "aria-valuemax": 100,
299
+ "aria-valuenow": percent,
300
+ "aria-valuetext": `${Math.round(percent)}%`
301
+ })
302
+ };
220
303
  }
221
- function Steps({ id, count = 1, defaultStep, dir = "ltr", linear = false, onStepChange, onStepComplete, orientation = "horizontal", size, step, variant, children, className, ref, ...props }) {
304
+ function useNavigationFocus(api) {
305
+ const pending = useRef(null);
306
+ const [, commitNavigation] = useState(0);
307
+ useLayoutEffect(()=>{
308
+ const request = pending.current;
309
+ if (!request || request.value === api.value) return;
310
+ pending.current = null;
311
+ const root = request.source.closest('[data-scope="steps"][data-part="root"]');
312
+ const active = request.source.ownerDocument.activeElement;
313
+ if (active !== request.source && active !== request.source.ownerDocument.body) return;
314
+ root?.querySelector('[data-part="content"]:not([hidden]), [data-part="completed-content"]:not([hidden])')?.focus();
315
+ }, [
316
+ api.value
317
+ ]);
318
+ return (source, navigate)=>{
319
+ const request = {
320
+ source,
321
+ value: api.value
322
+ };
323
+ pending.current = request;
324
+ try {
325
+ navigate();
326
+ } catch (error) {
327
+ pending.current = null;
328
+ throw error;
329
+ }
330
+ queueMicrotask(()=>{
331
+ if (pending.current !== request) return;
332
+ try {
333
+ flushSync(()=>commitNavigation((value)=>value + 1));
334
+ } finally{
335
+ if (pending.current === request) pending.current = null;
336
+ }
337
+ });
338
+ };
339
+ }
340
+ function Steps({ size, variant, children, className, ref, ...props }) {
341
+ const [machineProps, elementProps] = splitProps(props);
222
342
  const api = useSteps({
223
- count,
224
- defaultStep,
225
- dir,
226
- id,
227
- linear,
228
- onStepChange,
229
- onStepComplete,
230
- orientation,
231
- step
343
+ count: 1,
344
+ dir: "ltr",
345
+ linear: false,
346
+ orientation: "horizontal",
347
+ ...machineProps
232
348
  });
349
+ const orientation = machineProps.orientation ?? "horizontal";
350
+ const requestNavigationFocus = useNavigationFocus(api);
233
351
  const styles = stepsVariants({
234
352
  size,
235
353
  variant
236
354
  });
237
- const rootProps = mergeProps(props, api.getRootProps());
355
+ const rootProps = mergeProps(elementProps, api.getRootProps());
238
356
  const contentRegistry = useStepsContentRegistry();
239
357
  return /*#__PURE__*/ jsx(StepsContext.Provider, {
240
358
  value: {
@@ -242,6 +360,7 @@ function Steps({ id, count = 1, defaultStep, dir = "ltr", linear = false, onStep
242
360
  orientation,
243
361
  size,
244
362
  styles,
363
+ requestNavigationFocus,
245
364
  ...contentRegistry
246
365
  },
247
366
  children: /*#__PURE__*/ jsx("div", {
@@ -259,12 +378,14 @@ Steps.RootProvider = function({ value, size, variant, children, className, ref,
259
378
  size,
260
379
  variant
261
380
  });
381
+ const requestNavigationFocus = useNavigationFocus(value);
262
382
  const resolvedOrientation = getOrientationFromApi(value);
263
383
  const rootProps = mergeProps(props, value.getRootProps());
264
384
  const contentRegistry = useStepsContentRegistry();
265
385
  return /*#__PURE__*/ jsx(StepsContext.Provider, {
266
386
  value: {
267
387
  api: value,
388
+ requestNavigationFocus,
268
389
  orientation: resolvedOrientation,
269
390
  size,
270
391
  styles,
@@ -282,8 +403,11 @@ Steps.RootProvider = function({ value, size, variant, children, className, ref,
282
403
  };
283
404
  Steps.List = function({ children, className, ref, ...props }) {
284
405
  const { api, styles } = useStepsContext();
285
- const listProps = mergeProps(props, api.getListProps());
286
- return /*#__PURE__*/ jsx("div", {
406
+ const { role: _tablistRole, "aria-owns": _owns, "aria-orientation": _orientation, ...machineListProps } = api.getListProps();
407
+ const listProps = mergeProps(props, machineListProps, {
408
+ role: "list"
409
+ });
410
+ return /*#__PURE__*/ jsx("ol", {
287
411
  className: styles.list({
288
412
  className
289
413
  }),
@@ -330,13 +454,13 @@ Steps.Item = function({ index, children, className, ref, ...props }) {
330
454
  index,
331
455
  state
332
456
  },
333
- children: /*#__PURE__*/ jsx("div", {
457
+ children: /*#__PURE__*/ jsx("li", {
334
458
  className: styles.item({
335
459
  className
336
460
  }),
337
461
  ref: ref,
338
462
  ...itemProps,
339
- role: props.role ?? "presentation",
463
+ role: props.role ?? "listitem",
340
464
  children: children
341
465
  })
342
466
  });
@@ -347,10 +471,10 @@ Steps.Trigger = function({ children, className, disabled, ref, ...props }) {
347
471
  const triggerProps = api.getTriggerProps({
348
472
  index
349
473
  });
350
- const { onClick: onTriggerClick, disabled: machineDisabled, ...restTriggerProps } = triggerProps;
474
+ const { onClick: onTriggerClick, disabled: machineDisabled, role: _tabRole, "aria-selected": _selected, ...restTriggerProps } = triggerProps;
351
475
  const { onClick, ...restProps } = props;
352
476
  const buttonProps = mergeProps(restProps, restTriggerProps);
353
- const isDisabled = Boolean(machineDisabled || disabled);
477
+ const isDisabled = Boolean(machineDisabled || disabled || api.linear);
354
478
  return /*#__PURE__*/ jsx(Button, {
355
479
  className: styles.trigger({
356
480
  className
@@ -368,6 +492,7 @@ Steps.Trigger = function({ children, className, disabled, ref, ...props }) {
368
492
  onClick?.(event);
369
493
  if (!event.defaultPrevented) onTriggerClick?.(event);
370
494
  },
495
+ tabIndex: isDisabled ? -1 : 0,
371
496
  children: children
372
497
  });
373
498
  };
@@ -474,27 +599,25 @@ Steps.Separator = function({ className, ref, ...props }) {
474
599
  };
475
600
  Steps.Content = function({ index, children, className, ref, ...props }) {
476
601
  const { api, styles } = useStepsContext();
477
- const contentProps = mergeProps(props, api.getContentProps({
602
+ const { role: _tabpanelRole, ...machineContentProps } = api.getContentProps({
478
603
  index
479
- }));
604
+ });
605
+ const contentProps = mergeProps(machineContentProps, props);
480
606
  useRegisterStepsContent(index);
481
607
  return /*#__PURE__*/ jsx("div", {
482
608
  className: styles.content({
483
609
  className
484
610
  }),
485
611
  ref: ref,
612
+ role: "group",
486
613
  ...contentProps,
614
+ tabIndex: -1,
487
615
  children: children
488
616
  });
489
617
  };
490
618
  Steps.Progress = function({ "aria-label": ariaLabel = "Step progress", className, ref, style, ...props }) {
491
619
  const { api, orientation, styles } = useStepsContext();
492
620
  const progressProps = mergeProps(props, api.getProgressProps());
493
- const progressRangeStyle = "horizontal" === orientation ? {
494
- width: "var(--percent)"
495
- } : {
496
- height: "var(--percent)"
497
- };
498
621
  return /*#__PURE__*/ jsx("div", {
499
622
  className: styles.progress({
500
623
  className
@@ -508,28 +631,32 @@ Steps.Progress = function({ "aria-label": ariaLabel = "Step progress", className
508
631
  children: /*#__PURE__*/ jsx("span", {
509
632
  "aria-hidden": "true",
510
633
  className: styles.progressRange(),
511
- "data-orientation": orientation,
512
- style: progressRangeStyle
634
+ "data-orientation": orientation
513
635
  })
514
636
  });
515
637
  };
516
638
  Steps.CompletedContent = function({ children, className, ref, ...props }) {
517
639
  const { api, styles } = useStepsContext();
518
- const contentProps = mergeProps(props, api.getContentProps({
640
+ const { "aria-labelledby": _triggerLabel, role: _tabPanelRole, ...machineContentProps } = api.getContentProps({
519
641
  index: api.count
520
- }));
642
+ });
643
+ const contentProps = mergeProps(machineContentProps, props);
521
644
  return /*#__PURE__*/ jsx("div", {
522
645
  className: styles.completedContent({
523
646
  className
524
647
  }),
525
648
  ref: ref,
649
+ role: "group",
526
650
  ...contentProps,
651
+ "aria-label": props["aria-label"] ?? (props["aria-labelledby"] ? void 0 : "Workflow complete"),
527
652
  "data-complete": api.isCompleted || void 0,
653
+ "data-part": "completed-content",
654
+ tabIndex: -1,
528
655
  children: children
529
656
  });
530
657
  };
531
658
  Steps.PrevTrigger = function({ className, ref, size, theme = "outlined", variant = "secondary", ...props }) {
532
- const { api, styles, size: rootSize } = useStepsContext();
659
+ const { api, styles, size: rootSize, requestNavigationFocus } = useStepsContext();
533
660
  const { onClick: onPrevTriggerClick, disabled: prevTriggerDisabled, ...restPrevTriggerProps } = api.getPrevTriggerProps();
534
661
  const { onClick, disabled, ...restProps } = props;
535
662
  const buttonProps = mergeProps(restProps, restPrevTriggerProps);
@@ -546,12 +673,14 @@ Steps.PrevTrigger = function({ className, ref, size, theme = "outlined", variant
546
673
  disabled: isDisabled,
547
674
  onClick: (event)=>{
548
675
  onClick?.(event);
549
- if (!event.defaultPrevented) onPrevTriggerClick?.(event);
676
+ if (!event.defaultPrevented) requestNavigationFocus(event.currentTarget, ()=>{
677
+ onPrevTriggerClick?.(event);
678
+ });
550
679
  }
551
680
  });
552
681
  };
553
682
  Steps.NextTrigger = function({ className, ref, size, theme = "solid", variant = "primary", ...props }) {
554
- const { api, styles, size: rootSize } = useStepsContext();
683
+ const { api, styles, size: rootSize, requestNavigationFocus } = useStepsContext();
555
684
  const { onClick: onNextTriggerClick, disabled: nextTriggerDisabled, ...restNextTriggerProps } = api.getNextTriggerProps();
556
685
  const { onClick, disabled, ...restProps } = props;
557
686
  const buttonProps = mergeProps(restProps, restNextTriggerProps);
@@ -568,7 +697,9 @@ Steps.NextTrigger = function({ className, ref, size, theme = "solid", variant =
568
697
  disabled: isDisabled,
569
698
  onClick: (event)=>{
570
699
  onClick?.(event);
571
- if (!event.defaultPrevented) onNextTriggerClick?.(event);
700
+ if (!event.defaultPrevented) requestNavigationFocus(event.currentTarget, ()=>{
701
+ onNextTriggerClick?.(event);
702
+ });
572
703
  }
573
704
  });
574
705
  };
@@ -1,19 +1,40 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { normalizeProps, useMachine } from "@zag-js/react";
4
+ import { connect, machine } from "@zag-js/switch";
3
5
  import { useId } from "react";
4
6
  import { Label } from "../atoms/label.js";
5
7
  import { StatusText } from "../atoms/status-text.js";
8
+ import { getControlledChoiceInputProps, isSilentChoiceReset, mergeChoiceInputProps, runSilentChoiceReset, trackChoiceFormControl, useChoiceInputRef } from "../internal/choice-control.js";
9
+ import { joinDescribedBy } from "../internal/described-by.js";
6
10
  import { tv } from "../utils.js";
7
- import * as __rspack_external__zag_js_switch_171a0128 from "@zag-js/switch";
11
+ const switchChoiceMachine = {
12
+ ...machine,
13
+ implementations: {
14
+ ...machine.implementations,
15
+ effects: {
16
+ ...machine.implementations?.effects,
17
+ trackFormControlState ({ scope, context, prop, action }) {
18
+ const root = scope.getById(scope.ids?.root ?? `switch:${scope.id}`);
19
+ return trackChoiceFormControl(root, ()=>{
20
+ if (void 0 === prop("checked")) runSilentChoiceReset(context, ()=>context.set("checked", context.initial("checked")));
21
+ else action([
22
+ "syncInputElement"
23
+ ]);
24
+ }, (disabled)=>context.set("fieldsetDisabled", disabled));
25
+ }
26
+ }
27
+ }
28
+ };
8
29
  const switchVariants = tv({
9
30
  slots: {
10
31
  root: [
11
- "cursor-pointer",
32
+ "cursor-pointer data-readonly:not-data-disabled:cursor-default",
12
33
  "data-[disabled]:cursor-not-allowed",
13
34
  "flex items-center"
14
35
  ],
15
36
  control: [
16
- "me-switch p-switch-control",
37
+ "form-control-readonly form-control-disabled me-switch p-switch-control",
17
38
  "relative inline-flex shrink-0 items-center justify-start",
18
39
  "bg-switch-bg-base hover:bg-switch-bg-hover",
19
40
  "h-switch-track-height w-switch-track-width",
@@ -25,35 +46,63 @@ const switchVariants = tv({
25
46
  "data-[disabled]:bg-switch-bg-disabled",
26
47
  "data-[disabled]:border-switch-border-disabled",
27
48
  "data-[disabled]:data-[state=checked]:bg-switch-bg-disabled",
28
- "data-[focus]:outline-(style:--default-ring-style) data-[focus]:outline-(length:--default-ring-width)",
29
- "data-[focus]:outline-switch-ring",
30
- "data-[focus]:outline-offset-(length:--default-ring-offset)",
49
+ "data-[focus-visible]:outline-(style:--default-ring-style) data-[focus-visible]:outline-(length:--default-ring-width)",
50
+ "data-[focus-visible]:outline-switch-ring",
51
+ "data-[focus-visible]:outline-offset-(length:--default-ring-offset)",
31
52
  "data-[invalid]:bg-switch-bg-invalid data-[invalid]:outline-switch-ring-invalid",
32
53
  "data-[invalid]:outline-(style:--default-ring-style) data-[invalid]:outline-(length:--default-ring-width)",
33
54
  "data-[invalid]:outline-offset-(length:--default-ring-offset)"
34
55
  ],
35
56
  thumb: [
36
57
  "block aspect-square h-switch-thumb-height rounded-full bg-switch-thumb-bg",
58
+ "data-[state=unchecked]:bg-switch-thumb-bg-unchecked",
59
+ "switch-thumb-boundary data-invalid:not-data-readonly:not-data-disabled:data-[state=unchecked]:bg-switch-thumb-bg-invalid",
37
60
  "transform transition-transform duration-200 motion-reduce:transition-none",
38
- "data-[disabled]:bg-switch-thumb-bg-disabled",
39
- "data-[state=checked]:translate-x-switch-translate-track"
61
+ "data-[disabled]:bg-switch-thumb-bg-unavailable",
62
+ "data-[state=checked]:translate-x-switch-translate-track",
63
+ "rtl:data-[state=checked]:-translate-x-switch-translate-track",
64
+ "data-readonly:not-data-disabled:bg-switch-thumb-bg-readonly"
40
65
  ],
41
66
  label: [
42
- "select-none",
67
+ "wrap-anywhere min-w-0 flex-1 select-none data-readonly:select-text",
43
68
  "text-switch-label-fg",
44
69
  "data-[disabled]:text-switch-label-fg-disabled"
45
70
  ],
46
71
  hiddenInput: "sr-only"
72
+ },
73
+ variants: {
74
+ size: {
75
+ sm: {
76
+ control: "switch-size-sm",
77
+ label: "text-label-sm"
78
+ },
79
+ md: {
80
+ control: "switch-size-md",
81
+ label: "text-label-md"
82
+ },
83
+ lg: {
84
+ control: "switch-size-lg",
85
+ label: "text-label-lg"
86
+ }
87
+ }
88
+ },
89
+ defaultVariants: {
90
+ size: "md"
47
91
  }
48
92
  });
49
- function Switch({ id, name, value, checked, defaultChecked, disabled = false, readOnly = false, required = false, dir = "ltr", children, className, onCheckedChange, validateStatus, helpText, showHelpTextIcon = true }) {
93
+ function Switch({ ref, inputProps: nativeInputProps = {}, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, id, "aria-describedby": ariaDescribedBy, size = "md", name, value, checked, defaultChecked, disabled = false, readOnly = false, required = false, dir = "ltr", children, className, onCheckedChange, validateStatus = "default", helpText, showHelpTextIcon = true }) {
50
94
  const generatedId = useId();
51
95
  const uniqueId = id || generatedId;
52
- const helpTextId = `${uniqueId}-help`;
53
- const service = useMachine(__rspack_external__zag_js_switch_171a0128.machine, {
96
+ const helpTextId = useId();
97
+ const invalid = "error" === validateStatus;
98
+ const service = useMachine(switchChoiceMachine, {
54
99
  id: uniqueId,
100
+ ids: id ? {
101
+ hiddenInput: id
102
+ } : void 0,
55
103
  name,
56
104
  value,
105
+ form: nativeInputProps.form,
57
106
  checked,
58
107
  defaultChecked,
59
108
  dir,
@@ -61,11 +110,15 @@ function Switch({ id, name, value, checked, defaultChecked, disabled = false, re
61
110
  invalid: "error" === validateStatus,
62
111
  readOnly,
63
112
  required,
64
- onCheckedChange: ({ checked })=>onCheckedChange?.(checked)
113
+ onCheckedChange: ({ checked: nextChecked })=>{
114
+ if (!(readOnly || disabled || isSilentChoiceReset(service.context))) onCheckedChange?.(nextChecked);
115
+ }
65
116
  });
66
- const api = __rspack_external__zag_js_switch_171a0128.connect(service, normalizeProps);
117
+ const api = connect(service, normalizeProps);
118
+ const inputProps = getControlledChoiceInputProps(mergeChoiceInputProps(nativeInputProps, api.getHiddenInputProps()), api.checked);
119
+ const inputRef = useChoiceInputRef(ref);
67
120
  const { root, control, thumb, label, hiddenInput } = switchVariants({
68
- className
121
+ size
69
122
  });
70
123
  return /*#__PURE__*/ jsxs("div", {
71
124
  className: className,
@@ -73,12 +126,24 @@ function Switch({ id, name, value, checked, defaultChecked, disabled = false, re
73
126
  /*#__PURE__*/ jsxs(Label, {
74
127
  className: root(),
75
128
  required: required,
129
+ size: size,
76
130
  ...api.getRootProps(),
77
131
  children: [
78
132
  /*#__PURE__*/ jsx("input", {
79
- className: hiddenInput(),
80
- ...api.getHiddenInputProps(),
81
- "aria-describedby": helpText ? helpTextId : void 0
133
+ ...inputProps,
134
+ "aria-checked": api.checked,
135
+ "aria-describedby": joinDescribedBy(ariaDescribedBy, nativeInputProps["aria-describedby"], helpText ? helpTextId : void 0),
136
+ "aria-errormessage": invalid && helpText ? helpTextId : void 0,
137
+ "aria-invalid": invalid || void 0,
138
+ "aria-label": nativeInputProps["aria-label"] ?? ariaLabel,
139
+ "aria-labelledby": nativeInputProps["aria-labelledby"] ?? ariaLabelledBy ?? ((nativeInputProps["aria-label"] ?? ariaLabel) || !children ? void 0 : inputProps["aria-labelledby"]),
140
+ "aria-readonly": readOnly && !disabled || void 0,
141
+ className: hiddenInput({
142
+ className: nativeInputProps.className
143
+ }),
144
+ readOnly: readOnly,
145
+ ref: inputRef,
146
+ role: "switch"
82
147
  }),
83
148
  /*#__PURE__*/ jsx("span", {
84
149
  className: control(),
@@ -97,8 +162,8 @@ function Switch({ id, name, value, checked, defaultChecked, disabled = false, re
97
162
  }),
98
163
  helpText && /*#__PURE__*/ jsx(StatusText, {
99
164
  id: helpTextId,
100
- showIcon: showHelpTextIcon,
101
- size: "sm",
165
+ showIcon: "default" !== validateStatus || showHelpTextIcon,
166
+ size: size,
102
167
  status: validateStatus,
103
168
  children: helpText
104
169
  })