@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
package/README.md CHANGED
@@ -1,108 +1,138 @@
1
- # Web Revolution UI Library – Design System README
1
+ # @techsio/ui-kit
2
2
 
3
- Welcome to the Web Revolution UI Library! This guide explains our design system’s fundamentals, folder structure, theming, and customization rules. Follow these guidelines to keep our system consistent, flexible, and easy to maintain.
3
+ React 19 components, Zag.js interactions and Tailwind v4 design tokens.
4
+ Start with **Guide / Getting Started** in Storybook (source:
5
+ [getting-started.mdx](.storybook/getting-started.mdx)).
6
+ [AGENTS.md](AGENTS.md) is the canonical contributor rulebook, and
7
+ [component contracts](docs/component-contracts.md) define shared behavior.
4
8
 
5
- ---
9
+ ## Install and initialize
6
10
 
7
- ## 1. Overview
11
+ Use React and React DOM 19.2 or newer. The package has public subpath exports,
12
+ not a root barrel.
8
13
 
9
- Our design system is built with **Tailwind CSS v4** and React. It uses a **multi-layered design token approach** to control all colors, spacing, typography, and other visual aspects. We maintain one shared UI library, and we allow brand-specific customizations via a dedicated `brands` folder inside the library.
10
-
11
- **Key Points:**
12
-
13
- - **Multi-layered design tokens:** We separate tokens into three layers: global, semantic, and component.
14
- - **Single UI library:** All shared components live in one library (e.g. `ui`).
15
- - **Centralized CSS Variables:** All design tokens (CSS variables) are defined in one central place.
16
- - **Hybrid Structure:** Our UI library is organized into atoms, molecules, and domain-based organisms. Basic components (like buttons) are atoms or molecules; only composite, domain-specific components go into organisms.
17
- - **Clear Boundaries:** For example, a button is an atom or molecule. We never export a button from an organism.
18
-
19
- ---
20
-
21
- ## 2. Design Tokens
22
-
23
- ### Multi-Layered Tokens
24
-
25
- 1. **Global Tokens:**
26
- - These are the raw design values (like our base color palette, spacing scales, etc.).
27
- - They are defined in our central tokens files (e.g. `_colors.css`, `_spacing.css`).
28
- 2. **Semantic Tokens:**
29
- - These give meaning to global tokens by mapping them to their design role.
30
- - For example, `-color-brand-primary` maps to a global blue value.
31
- - All components will use semantic tokens rather than raw values.
32
- 3. **Component Tokens:**
33
- - These are defined for each component and act as a layer between the component and semantic tokens.
34
- - For example, a Button component uses `-button-bg` which is set to `var(--color-brand-primary)`.
35
- - **Important:** All component tokens are defined centrally, not near the component code.
36
-
37
- ---
38
-
39
- ## 3. Folder Structure
40
-
41
- Our UI library follows a hybrid approach with three main parts:
14
+ ```sh
15
+ pnpm add @techsio/ui-kit react react-dom
16
+ pnpm add -D tailwindcss @tailwindcss/postcss postcss
17
+ ```
42
18
 
43
- ### A. Basic Components (Atoms & Molecules)
19
+ Process global CSS once through Tailwind v4's PostCSS plugin:
44
20
 
45
- - **Atoms:**
46
- Small, reusable components such as buttons, inputs, icons, etc.
47
- - **Molecules:**
48
- Simple combinations of atoms like form groups or card headers.
21
+ ```js
22
+ // postcss.config.mjs
23
+ export default { plugins: { '@tailwindcss/postcss': {} } }
24
+ ```
49
25
 
50
- These live in folders such as:
26
+ Choose **one** stylesheet recipe:
51
27
 
28
+ ```css
29
+ /* App does not already import Tailwind: */
30
+ @import "@techsio/ui-kit/tokens-with-tailwind";
52
31
  ```
53
- ui/atoms/
54
- ui/molecules/
55
32
 
33
+ ```css
34
+ /* App owns its Tailwind import: */
35
+ @import "tailwindcss";
36
+ @import "@techsio/ui-kit/tokens";
56
37
  ```
57
38
 
58
- ### B. Domain-Based Organisms
59
-
60
- - **Organisms:**
61
- Larger, composite components that are specific to a business domain (e.g. cart, checkout, navigation).**Note:** Organisms should not export basic building blocks like buttons. If you need a button, use the atom or molecule from the appropriate folder.
39
+ Both entries register the shipped component JavaScript with a package-relative
40
+ `@source`. Tailwind otherwise excludes dependencies under `node_modules`; an
41
+ unprocessed CSS link or a token-variable import alone cannot generate utilities.
42
+ Do not copy component classes into app source or import both recipes together.
62
43
 
63
- Organisms are organized by domain:
64
-
65
- ```
66
- ui/organisms/cart/
67
- ui/organisms/checkout/
68
- ui/organisms/navigation/
44
+ ```tsx
45
+ import { Button } from '@techsio/ui-kit/atoms/button'
69
46
 
47
+ export function CheckoutAction() {
48
+ return <Button>Continue to checkout</Button>
49
+ }
70
50
  ```
71
51
 
72
- ### C. Brand Customizations
52
+ ## Brands and modes
73
53
 
74
- - **Brands Folder:**
75
- Custom, brand-specific overrides live in a dedicated folder. For example, if a brand needs a special Header, its custom component will live under:
76
- This keeps the shared UI library clean while allowing brands to override only what they need.
54
+ Brand selection uses `data-theme` on `html`; mode uses one `.light` or `.dark`
55
+ class. Every brand sets `data-theme`; Business is the default. The
56
+ attribute-less `:root` / `@theme` layer is the shared token foundation the
57
+ brands override, not a brand. The source registry is
58
+ [src/theme/theme-config.ts](src/theme/theme-config.ts).
77
59
 
78
- ```
79
- ui/brands/customer-a/
60
+ | Brand | Root attribute | Modes |
61
+ | --- | --- | --- |
62
+ | business (default) | `data-theme="business"` | light only |
63
+ | akros | `data-theme="akros"` | light only |
64
+ | n1 | `data-theme="n1"` | light only |
80
65
 
81
- ```
66
+ For a fixed Akros app, use `<html lang="en" class="light" data-theme="akros">`.
67
+ No provider is needed for a fixed theme. Do not create an Akros dark scheme.
82
68
 
69
+ For optional persisted switching, create an app client wrapper:
83
70
 
84
- > Note: Always use kebab-case for folder and component filenames. For example, use customer-a instead of customerA.
85
- >
71
+ ```tsx
72
+ 'use client'
86
73
 
87
- ---
74
+ import type { PropsWithChildren } from 'react'
75
+ import { AppThemeProvider, BrandThemeScript } from '@techsio/ui-kit/theme/theme-provider'
88
76
 
89
- ## 4. Theming and CSS Variables
77
+ export function ThemeSetup({ children }: PropsWithChildren) {
78
+ return (
79
+ <>
80
+ <BrandThemeScript defaultBrand="akros" />
81
+ <AppThemeProvider defaultBrand="akros" defaultMode="light">
82
+ {children}
83
+ </AppThemeProvider>
84
+ </>
85
+ )
86
+ }
87
+ ```
90
88
 
91
- ### Centralized Tokens
89
+ Render the script before visible body content. The provider applies mode
90
+ initialization and locks light-only brands to light. Defaults are fallbacks to
91
+ persisted preferences, not forced-brand configuration. `useAppTheme()` from the
92
+ same subpath exposes selection, allowed modes and `mounted`; gate
93
+ preference-dependent markup on `mounted` during SSR. Next App Router layouts
94
+ place the wrapper in `body` and use `suppressHydrationWarning` on `html` because
95
+ pre-hydration scripts update its attributes.
96
+
97
+ Hook/context/event-owning published entrypoints are client boundaries. Compose
98
+ compound static members such as `Dialog.Trigger` inside an app client wrapper;
99
+ do not access those members on a client reference from a server page. Callbacks
100
+ and render functions belong in client code. Ordinary SSR and RSC are separate
101
+ integration contracts.
102
+
103
+ ## Source layout and token ownership
104
+
105
+ ```text
106
+ libs/ui/
107
+ src/{atoms,molecules,organisms,templates}/ component modules (flat files)
108
+ src/theme/ registry, provider, togglers
109
+ src/tokens/ primitive and semantic layers
110
+ src/tokens/components/{atoms,molecules}/ component reference/derived aliases
111
+ src/tokens/figma/ generated exports; do not hand-edit
112
+ stories/{atoms,molecules,organisms,templates,pages}/
113
+ .storybook/ catalog and consumer onboarding
114
+ ```
92
115
 
93
- - **All CSS Variables:**
94
- We define all our design tokens in one central set of CSS files (e.g. in the `tokens/` directory). Do not scatter token definitions next to component code.
95
- - **Optional Default Theme:**
96
- We support a “default theme” file that you can import if you want to start with predefined values. However, the core system is theme-agnostic: our self-referencing palette contains only semantic tokens. If you want the default look, import the default theme; otherwise, you can define your own theme based on the semantic tokens.
97
- - **Using Tailwind’s `@theme`:**
98
- Our CSS token files use Tailwind’s `@theme` block to generate CSS variables, ensuring consistency with our Tailwind utilities.
116
+ Public imports use `@techsio/ui-kit/<category>/<component>`, not these source
117
+ paths. Built-in brands come from the registry and generated theme mappings;
118
+ there is no library `brands/customer-a` directory. Product-specific composites
119
+ and app-only overrides stay in the consuming app.
99
120
 
100
- ### How Overrides Work
121
+ Token flow is primitive → semantic → component reference → derived utility.
122
+ Components use component token classes in `tv()`; stories can use semantic
123
+ layout tokens. Keep changes general rather than adding brand-specific component
124
+ branches. App-owned CSS loads **after** the kit and overrides the active root
125
+ selector or a descendant scope with adequate specificity:
101
126
 
102
- - Brand-specific override files (e.g. `ui/brands/customer-a/theme.css`) can override any semantic token.
103
- - In your app’s main CSS, import the global tokens first, then the brand override file. This cascade ensures that the brand’s values override the defaults.
127
+ ```css
128
+ .order-form {
129
+ --font-weight-button: var(--font-weight-bold);
130
+ }
131
+ ```
104
132
 
105
- ---
133
+ Do not edit generated Figma CSS or copy all kit variables into app overrides.
134
+ See [app token initialization](skills/app-token-initialization/SKILL.md) and
135
+ [framework integration](skills/framework-consumer-integration/SKILL.md).
106
136
 
107
137
  ### Component font-weight overrides
108
138
 
@@ -134,52 +164,8 @@ When Figma exports the aliases, transfer ownership through the export pipeline
134
164
  and remove the duplicate bridge declarations. Do not edit generated
135
165
  `tokens/figma/variables.css` by hand.
136
166
 
137
- ## 5. Development Guidelines
138
-
139
- ### Component Development
140
-
141
- - **Use Tokens Exclusively:**
142
- Always use component tokens (e.g. `-button-bg`) in your styles. Do not use semantic tokens directly in component code.
143
- - **Keep It Simple:**
144
- Build your atoms and molecules first. Organisms are domain-specific composites and should use the shared atoms/molecules.
145
- - **Export Only Where Appropriate:**
146
- For example, if a component is basic (like a Button), it belongs in atoms or molecules. Never export a Button from an organism.
147
-
148
- ### Brand Customizations
149
-
150
- - **Custom Components:**
151
- If a customer needs a completely custom component, add it to the `brands/` folder. Do not modify the core shared components.
152
- - **Override Process:**
153
- When overriding, create a file in the brand folder and map the semantic tokens to the custom values. This way, the core remains untouched.
154
-
155
- ### Documentation
156
-
157
- - We use **Storybook** for our component documentation and previews (for now). We may add other documentation tools later.
158
- - Our documentation explains all tokens, component usage, and override guidelines. Please refer to Storybook for live examples and further details.
159
167
 
160
- ---
161
-
162
- ## 6. Quick Reference
163
-
164
- - **Design Tokens:**
165
- - Global Tokens: Defined in `tokens/_*.css` files.
166
- - Semantic Tokens: Map global tokens to design roles (e.g. `-color-brand-primary`).
167
- - Component Tokens: Defined centrally; used in component styling (e.g. `-button-bg`).
168
- - **Folder Organization:**
169
- - **Atoms/Molecules:** `ui/atoms/` and `ui/molecules/`
170
- - **Organisms:** Domain-based (e.g. `ui/organisms/cart/`)
171
- - **Brands:** Overrides and customizations (e.g. `ui/brands/customer-a/`)
172
- - **Theming:**
173
-
174
- Import tokens first, then any default or brand-specific theme overrides in your main CSS file.
175
-
176
- - **Guidelines:**
177
- - Always use the token system.
178
- - Never mix token definitions with component code.
179
- - Keep overrides in dedicated brand folders.
180
- - Basic components (e.g., Button) belong only in atoms/molecules.
181
-
182
- ## 7. Visual Regression Tests (Playwright + Docker)
168
+ ## Visual regression tests (Playwright + Docker)
183
169
 
184
170
  To keep screenshots stable across machines, run component tests inside Docker.
185
171
 
@@ -211,16 +197,16 @@ Optional environment overrides:
211
197
  - `TEST_BASE_URL` (default: `http://127.0.0.1:6006` inside the container)
212
198
  - `PLAYWRIGHT_STORYBOOK_REBUILD` (default: `1`, rebuilds `storybook-static`; set to `0` to reuse an existing build)
213
199
  - `VISUAL_STORYBOOK_STATIC_DIR` (absolute path to another Storybook build, e.g. one built from `master`, to test against the committed baselines; skips the rebuild)
214
- - `VISUAL_BRANDS` (default: `base,neo,business`; also supports `akros`)
200
+ - `VISUAL_BRANDS` (default: `business,akros,n1`; focused development only)
215
201
  - `TEST_STORIES` (comma-separated Storybook story ids to run, e.g. `atoms-button--states,molecules-productcard--layout-variants`)
216
202
  - `PLAYWRIGHT_WORKERS` (override worker count for parallel runs)
217
203
  - `VISUAL_ASSET_HAR_PATH` (absolute path to an alternative HAR; its directory and attachments mount read-only)
218
- - `PLAYWRIGHT_DOCKER_IMAGE` (default: `new-engine-ui-playwright`)
204
+ - `PLAYWRIGHT_DOCKER_IMAGE` (default: `new-engine-ui-playwright:<Playwright version>-<Dockerfile hash>`)
219
205
  - `PLAYWRIGHT_DOCKER_SHM_SIZE` (default: `2g`, improves Playwright stability in Docker)
220
206
  - `PLAYWRIGHT_DOCKER_IPC` (default: `host`, improves Playwright stability in Docker)
221
207
  - `PLAYWRIGHT_DOCKER_SEQUENTIAL` (default: `0`, runs projects in parallel; set to `1` to run one project at a time and reduce memory spikes)
222
208
 
223
- Extra arguments are passed to `playwright test`, e.g. `pnpm -C libs/ui test:components -- --project=neo-mobile-dark`.
209
+ Extra arguments are passed to `playwright test`, e.g. `pnpm -C libs/ui test:components -- --project=n1-mobile-light`.
224
210
  Tests always run as `linux/amd64`, matching the committed baselines. A full run must cover every story in every visual project; component behavior specs (`test/*.spec.ts`) run once in the `desktop` and `mobile` projects.
225
211
 
226
212
  ### Recommendation for `PLAYWRIGHT_WORKERS` and parallelism
@@ -238,18 +224,27 @@ Example with parallel workers:
238
224
  TEST_BASE_URL=http://127.0.0.1:6006 PLAYWRIGHT_WORKERS=6 pnpm -C libs/ui test:components
239
225
  ```
240
226
 
241
- ## 8. Publishing and releases
227
+ ### Release coverage versus focused development
228
+
229
+ `pnpm -C libs/ui test:components:release` requires all stories across all 6
230
+ visual projects: business/Akros/N1 light, desktop+mobile.
231
+ It rejects brand overrides, story/project filters and snapshot updates, then
232
+ checks unique successful story/project identities. Focused `test:components`
233
+ runs remain available but are not release-readiness evidence. Review new or
234
+ changed baselines; never update them in the validation gate.
235
+
236
+ During a shared-browser overhaul, follow the assigned browser rules instead of
237
+ starting any local server, build or browser. Use the approved shared `ds-page`
238
+ and serial Docker wrapper, never concurrent ad hoc browser launches.
239
+
240
+ ## Publishing and releases
242
241
 
243
242
  - Build: `pnpm -C libs/ui build` creates the package without release-only validation.
244
- - Package output checks: `pnpm -C libs/ui check:package` builds, runs publint against package structure and exports, and runs AreTheTypesWrong across TypeScript module-resolution modes. CI and the release workflow run this command automatically.
243
+ - Package output checks: `pnpm -C libs/ui check:package` builds, runs publint against package structure and exports, and runs AreTheTypesWrong across TypeScript module-resolution modes, verifies emitted client boundaries/compound declarations, and checks CSS generation, SSR and public callback types from a packed installation. CI and the release workflow run this command automatically.
245
244
  - Exports only, no barrel: import from explicit subpaths (e.g. `@techsio/ui-kit/atoms/button`, `@techsio/ui-kit/templates/accordion`, `@techsio/ui-kit/utils`). The package root is intentionally not exported.
246
245
  - Automated releases: `libs/ui/release.config.mjs` uses semantic-release (tag format `ui-kit-v<version>`) to publish to npm and create GitHub releases without pushing generated version/changelog commits back to the protected branch. While we are <1.0.0, `BREAKING CHANGE` commits are forced to “minor” bumps to stay in 0.x; remove that release rule when stabilizing for 1.0.0+ to restore SemVer majors.
247
246
  - Security posture: releases are restricted to GitHub Actions (`GITHUB_ACTIONS` required), npm publishes use trusted publishing through GitHub OIDC (`id-token: write`) and do not require an npm token.
248
- - CI workflow: `.github/workflows/ui-release.yml` builds `libs/ui` and runs semantic-release on `master`/`main` with the workflow `GITHUB_TOKEN`. Use the manual `force_release` dispatch to publish missed UI changes after a skipped release.
249
- - Local dry run: `pnpm -C libs/ui semantic-release --dry-run`.
247
+ - CI and release share `.github/workflows/ui-quality.yml`: both TypeScript projects, unit/SSR/tooling tests, token/package checks, full Docker component visuals, and enforced three-theme accessibility. Publication depends on successful validation of the exact checked-out SHA. Manual `force_release` changes affected detection only; it cannot bypass quality checks.
248
+ - Local semantic-release (including `--dry-run`) is intentionally unsupported. Use `pnpm -C libs/ui typecheck`, `test`, and `check:package` locally; never set `GITHUB_ACTIONS=true` to impersonate CI.
250
249
  - Commit format: follow Conventional Commits (`feat:`, `fix:`, `chore:`, `BREAKING CHANGE:`) so semantic-release can infer the correct version bump.
251
250
  - Required CI secrets: none for npm publishing; npm trusted publishing must be configured on npmjs.com for this repository and workflow path.
252
-
253
- ## 9. Conclusion
254
-
255
- This README serves as the single source of truth for building and maintaining our design system. By adhering to these guidelines, you ensure that our UI remains consistent, flexible, and scalable across multiple brands. If you have any questions or suggestions, please reach out to the design system team.
@@ -4,7 +4,7 @@ import { Icon } from "./icon.js";
4
4
  const actionIconVariants = tv({
5
5
  base: [
6
6
  "inline-flex shrink-0 cursor-pointer items-center justify-center",
7
- "rounded-icon-control text-icon-control-fg",
7
+ "action-icon-surface rounded-icon-control text-icon-control-fg",
8
8
  "transition-colors duration-200 motion-reduce:transition-none",
9
9
  "focus-visible:outline-(style:--default-ring-style) focus-visible:outline-(length:--default-ring-width)",
10
10
  "focus-visible:outline-offset-(length:--default-ring-offset) focus-visible:outline-icon-control-ring",
@@ -12,18 +12,19 @@ const actionIconVariants = tv({
12
12
  ],
13
13
  variants: {
14
14
  size: {
15
- sm: "size-icon-control-sm text-icon-control-sm",
16
- md: "size-icon-control-md text-icon-control-md",
17
- lg: "size-icon-control-lg text-icon-control-lg"
15
+ sm: "size-icon-control-sm text-action-icon-sm",
16
+ md: "size-icon-control-md text-action-icon-md",
17
+ lg: "size-action-icon-lg text-action-icon-lg"
18
18
  },
19
19
  tone: {
20
20
  neutral: [
21
- "hover:bg-icon-control-bg-hover",
22
- "active:bg-icon-control-bg-active"
21
+ "not-disabled:hover:bg-icon-control-bg-hover",
22
+ "not-disabled:active:bg-icon-control-bg-active"
23
23
  ],
24
24
  danger: [
25
- "hover:bg-icon-control-bg-danger-hover hover:text-icon-control-fg-danger-hover",
26
- "active:bg-icon-control-bg-danger-active"
25
+ "text-action-icon-fg-danger",
26
+ "not-disabled:hover:bg-icon-control-bg-danger-hover not-disabled:hover:text-icon-control-fg-danger-hover",
27
+ "not-disabled:active:bg-action-icon-bg-danger-active not-disabled:active:text-action-icon-fg-danger-active"
27
28
  ]
28
29
  }
29
30
  },
@@ -1,19 +1,27 @@
1
+ "use client";
1
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useImperativeHandle, useRef } from "react";
2
4
  import { tv } from "../utils.js";
3
5
  import { Icon } from "./icon.js";
4
6
  const buttonVariants = tv({
5
7
  base: [
6
- "relative",
8
+ "button-disabled relative",
7
9
  "inline-flex cursor-pointer items-center justify-center",
8
- "font-button",
9
10
  "transition duration-200 motion-reduce:transition-none",
10
- "motion-safe:not-disabled:active:scale-97",
11
11
  "focus-visible:outline-(style:--default-ring-style) focus-visible:outline-(length:--default-ring-width)",
12
12
  "focus-visible:outline-button-ring",
13
13
  "focus-visible:outline-offset-(length:--default-ring-offset)",
14
- "disabled:cursor-not-allowed disabled:text-button-fg-disabled"
14
+ "disabled:cursor-not-allowed disabled:text-button-fg-disabled",
15
+ "not-disabled:data-loading:cursor-progress"
15
16
  ],
16
17
  variants: {
18
+ composition: {
19
+ true: "",
20
+ false: [
21
+ "font-button",
22
+ "motion-safe:not-disabled:not-data-disabled:not-data-loading:active:scale-97"
23
+ ]
24
+ },
17
25
  variant: {
18
26
  primary: "",
19
27
  secondary: "",
@@ -24,18 +32,18 @@ const buttonVariants = tv({
24
32
  theme: {
25
33
  solid: "disabled:bg-button-bg-disabled",
26
34
  light: "disabled:bg-button-bg-disabled",
27
- borderless: "bg-button-bg-borderless-base hover:bg-button-bg-borderless-hover active:bg-button-bg-borderless-active disabled:hover:bg-button-bg-borderless-base",
28
- outlined: "border bg-button-bg-outlined disabled:border-0 disabled:bg-button-bg-disabled disabled:hover:bg-button-bg-disabled",
35
+ borderless: "button-disabled-borderless bg-button-bg-borderless-base hover:bg-button-bg-borderless-hover hover:text-button-fg-interacting active:bg-button-bg-borderless-active active:text-button-fg-interacting",
36
+ outlined: "button-disabled-outlined border bg-button-bg-outlined",
29
37
  unstyled: ""
30
38
  },
31
39
  uppercase: {
32
40
  true: "uppercase"
33
41
  },
34
42
  size: {
35
- sm: "h-form-control-sm gap-button-sm rounded-button-sm p-button-sm text-button-sm",
36
- md: "h-form-control-md gap-button-md rounded-button-md p-button-md text-button-md",
37
- lg: "h-form-control-lg gap-button-lg rounded-button-lg p-button-lg text-button-lg",
38
- current: "gap-button-md text-inherit"
43
+ sm: "button-size-sm min-w-0 gap-button-sm rounded-button-sm p-button-sm text-button-sm",
44
+ md: "button-size-md min-w-0 gap-button-md rounded-button-md p-button-md text-button-md",
45
+ lg: "button-size-lg min-w-0 gap-button-lg rounded-button-lg p-button-lg text-button-lg",
46
+ current: "button-current-size gap-button-md"
39
47
  },
40
48
  block: {
41
49
  true: "w-full"
@@ -217,7 +225,7 @@ const buttonVariants = tv({
217
225
  variant: "warning",
218
226
  theme: "borderless",
219
227
  className: [
220
- "text-button-fg-warning-borderless"
228
+ "text-button-fg-warning-readable"
221
229
  ]
222
230
  },
223
231
  {
@@ -244,43 +252,95 @@ const buttonVariants = tv({
244
252
  }
245
253
  ],
246
254
  defaultVariants: {
255
+ composition: false,
247
256
  variant: "primary",
248
257
  theme: "solid",
249
258
  size: "md",
250
259
  light: false
251
260
  }
252
261
  });
253
- function Button({ variant, theme, size, block, isLoading, loadingText, icon, iconPosition = "left", iconSize, uppercase = false, children, className, disabled: disabledProp, ...props }) {
254
- const disabled = isLoading || disabledProp;
262
+ const buttonIconVariants = tv({
263
+ variants: {
264
+ size: {
265
+ sm: "text-button-icon-sm",
266
+ md: "text-button-icon-md",
267
+ lg: "text-button-icon-lg",
268
+ current: ""
269
+ }
270
+ },
271
+ defaultVariants: {
272
+ size: "md"
273
+ }
274
+ });
275
+ function Button({ variant, theme, size, block, isLoading, loadingText, icon, iconPosition = "left", iconSize, uppercase = false, children, className, disabled, composition, ref, onClick, type = "button", ...props }) {
276
+ const buttonRef = useRef(null);
277
+ useImperativeHandle(ref, ()=>buttonRef.current, []);
278
+ useEffect(()=>{
279
+ const button = buttonRef.current;
280
+ const form = button?.form;
281
+ if (!(isLoading && "submit" === type && form)) return;
282
+ function preventPendingSubmit(event) {
283
+ if (!event.submitter || event.submitter === button) {
284
+ event.preventDefault();
285
+ event.stopImmediatePropagation();
286
+ }
287
+ }
288
+ form.addEventListener("submit", preventPendingSubmit, true);
289
+ return ()=>form.removeEventListener("submit", preventPendingSubmit, true);
290
+ }, [
291
+ isLoading,
292
+ type,
293
+ props.form
294
+ ]);
295
+ const iconClassName = buttonIconVariants({
296
+ size
297
+ });
255
298
  return /*#__PURE__*/ jsx("button", {
299
+ ...props,
300
+ "aria-busy": isLoading || void 0,
301
+ "aria-disabled": disabled || isLoading || props["aria-disabled"] || void 0,
256
302
  className: buttonVariants({
257
303
  variant,
258
304
  theme,
259
305
  size,
260
306
  block,
261
307
  uppercase,
308
+ composition,
262
309
  className
263
310
  }),
311
+ "data-loading": isLoading ? "" : void 0,
264
312
  disabled: disabled,
265
- ...props,
313
+ onClick: (event)=>{
314
+ if (isLoading) {
315
+ event.preventDefault();
316
+ event.stopPropagation();
317
+ return;
318
+ }
319
+ onClick?.(event);
320
+ },
321
+ ref: buttonRef,
322
+ type: type,
266
323
  children: isLoading ? /*#__PURE__*/ jsxs(Fragment, {
267
324
  children: [
268
325
  /*#__PURE__*/ jsx(Icon, {
269
- className: "me-2",
270
- icon: "token-icon-button-spinner"
326
+ className: iconClassName,
327
+ icon: "token-icon-button-spinner",
328
+ size: "current"
271
329
  }),
272
330
  loadingText || children
273
331
  ]
274
332
  }) : /*#__PURE__*/ jsxs(Fragment, {
275
333
  children: [
276
334
  icon && "left" === iconPosition && /*#__PURE__*/ jsx(Icon, {
335
+ className: iconSize ? void 0 : iconClassName,
277
336
  icon: icon,
278
- size: iconSize
337
+ size: iconSize ?? "current"
279
338
  }),
280
339
  children,
281
340
  icon && "right" === iconPosition && /*#__PURE__*/ jsx(Icon, {
341
+ className: iconSize ? void 0 : iconClassName,
282
342
  icon: icon,
283
- size: iconSize
343
+ size: iconSize ?? "current"
284
344
  })
285
345
  ]
286
346
  })
@@ -1,19 +1,25 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
3
+ import { useLayoutEffect, useMemo, useRef } from "react";
4
+ import { useChoiceInputRef } from "../internal/choice-control.js";
5
+ import { subscribeOwnerFormReset, syncReactFormControl } from "../internal/form-control-lifecycle.js";
2
6
  import { tv } from "../utils.js";
3
7
  const checkboxVariants = tv({
4
8
  base: [
5
- "relative shrink-0 cursor-pointer appearance-none",
6
- "size-checkbox",
7
- "border-(length:--border-width-checkbox) rounded-checkbox border-checkbox-border-base",
9
+ "form-control-readonly relative shrink-0 cursor-pointer appearance-none",
10
+ "data-readonly:checked:text-checkbox-fg-readonly",
11
+ "data-readonly:indeterminate:after:bg-checkbox-fg-readonly",
12
+ "border-(length:--border-width-checkbox) rounded-checkbox-control border-checkbox-border-base",
8
13
  "bg-checkbox-bg-base",
9
14
  "after:-translate-1/2 after:absolute after:top-1/2 after:left-1/2",
10
15
  "checked:bg-checkbox-bg-checked",
11
16
  "checked:border-checkbox-border-checked",
12
- "checked:after:token-icon-checkbox",
17
+ "checked:not-indeterminate:after:token-icon-checkbox",
13
18
  "checked:text-checkbox-fg-checked",
14
19
  "indeterminate:bg-checkbox-bg-indeterminate",
15
20
  "indeterminate:border-checkbox-border-indeterminate",
16
- "indeterminate:after:size-checkbox-indeterminate-icon",
21
+ "indeterminate:after:w-checkbox-indeterminate-icon",
22
+ "indeterminate:after:h-checkbox-indeterminate-stroke",
17
23
  "indeterminate:after:rounded-full",
18
24
  "indeterminate:after:bg-checkbox-fg-indeterminate",
19
25
  "disabled:cursor-not-allowed",
@@ -23,29 +29,83 @@ const checkboxVariants = tv({
23
29
  "disabled:checked:bg-checkbox-bg-disabled",
24
30
  "disabled:checked:text-checkbox-fg-disabled",
25
31
  "disabled:checked:border-checkbox-border-disabled",
32
+ "disabled:indeterminate:bg-checkbox-bg-disabled",
33
+ "disabled:indeterminate:border-checkbox-border-disabled",
34
+ "disabled:indeterminate:after:bg-checkbox-fg-disabled",
26
35
  "transition duration-200 motion-reduce:transition-none",
27
- "focus-visible:outline-(style:--default-ring-style) focus-visible:outline-(length:--default-ring-width)",
28
- "focus-visible:outline-checkbox-ring-focus",
29
- "focus-visible:outline-offset-(length:--default-ring-offset)",
36
+ "focus-visible:checkbox-focus-outline",
30
37
  "data-invalid:border-(length:--border-width-validation)",
31
38
  "data-invalid:border-checkbox-border-error"
32
- ]
39
+ ],
40
+ variants: {
41
+ size: {
42
+ sm: "size-form-checkbox-control-sm text-checkbox-icon-sm",
43
+ md: "size-form-checkbox-control-md text-checkbox-icon-md",
44
+ lg: "size-form-checkbox-control-lg text-checkbox-icon-lg"
45
+ }
46
+ },
47
+ defaultVariants: {
48
+ size: "md"
49
+ }
33
50
  });
34
- function Checkbox({ className, indeterminate, invalid, ref, ...props }) {
35
- const setIndeterminate = (node)=>{
36
- if (node) node.indeterminate = indeterminate ?? false;
37
- if ("function" == typeof ref) return ref(node);
38
- if (ref) ref.current = node;
39
- };
51
+ function Checkbox({ className, size = "md", indeterminate, invalid, ref, readOnly = false, onClick, onChange, onKeyDown, ...props }) {
52
+ const inputRef = useRef(null);
53
+ const currentValue = useRef({
54
+ checked: props.checked,
55
+ indeterminate
56
+ });
57
+ useLayoutEffect(()=>{
58
+ currentValue.current = {
59
+ checked: props.checked,
60
+ indeterminate
61
+ };
62
+ });
63
+ const choiceRef = useChoiceInputRef(ref, indeterminate ?? false);
64
+ const setInputRef = useMemo(()=>(node)=>{
65
+ inputRef.current = node;
66
+ const cleanup = choiceRef(node);
67
+ return ()=>{
68
+ inputRef.current = null;
69
+ cleanup();
70
+ };
71
+ }, [
72
+ choiceRef
73
+ ]);
74
+ useLayoutEffect(()=>{
75
+ const input = inputRef.current;
76
+ if (!input) return;
77
+ return subscribeOwnerFormReset(input, ()=>{
78
+ syncReactFormControl(input, currentValue.current.checked ?? input.checked);
79
+ input.indeterminate = currentValue.current.indeterminate ?? false;
80
+ });
81
+ }, []);
40
82
  return /*#__PURE__*/ jsx("input", {
41
83
  "aria-invalid": invalid || void 0,
42
84
  className: checkboxVariants({
85
+ size,
43
86
  className
44
87
  }),
45
88
  "data-invalid": invalid || void 0,
46
- ref: setIndeterminate,
89
+ ref: setInputRef,
47
90
  type: "checkbox",
48
- ...props
91
+ ...props,
92
+ "aria-readonly": readOnly && !props.disabled || void 0,
93
+ "data-readonly": readOnly && !props.disabled ? "" : void 0,
94
+ onChange: (event)=>{
95
+ if (!(readOnly || props.disabled)) {
96
+ onChange?.(event);
97
+ event.currentTarget.indeterminate = indeterminate ?? false;
98
+ }
99
+ },
100
+ onClick: (event)=>{
101
+ if (readOnly) return void event.preventDefault();
102
+ onClick?.(event);
103
+ },
104
+ onKeyDown: (event)=>{
105
+ if (readOnly && " " === event.key) return void event.preventDefault();
106
+ onKeyDown?.(event);
107
+ },
108
+ readOnly: readOnly
49
109
  });
50
110
  }
51
111
  Checkbox.displayName = "Checkbox";