@primer/react-brand 0.81.0 → 0.81.1-rc.019987d3

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 (477) hide show
  1. package/docs/forms/ToggleSwitch/index.md +53 -19
  2. package/docs/index.md +2 -2
  3. package/esm/forms/FormControl/FormControl.d.ts.map +1 -1
  4. package/esm/forms/FormControl/FormControl.js +8 -8
  5. package/esm/forms/FormControl/FormControl.js.map +1 -1
  6. package/esm/forms/FormControl/FormControl.module-B7McDwHm.css +1 -0
  7. package/esm/forms/FormControl/FormControl.module.js +5 -4
  8. package/esm/forms/FormControl/FormControl.module.js.map +1 -1
  9. package/esm/forms/ToggleSwitch/ToggleSwitch.d.ts +10 -0
  10. package/esm/forms/ToggleSwitch/ToggleSwitch.d.ts.map +1 -1
  11. package/esm/forms/ToggleSwitch/ToggleSwitch.js +101 -52
  12. package/esm/forms/ToggleSwitch/ToggleSwitch.js.map +1 -1
  13. package/esm/forms/ToggleSwitch/ToggleSwitch.module-PKy9cLy8.css +1 -0
  14. package/esm/forms/ToggleSwitch/ToggleSwitch.module.js +7 -1
  15. package/esm/forms/ToggleSwitch/ToggleSwitch.module.js.map +1 -1
  16. package/esm/packages/design-tokens/lib/design-tokens/css/tokens/functional/components/toggle-switch/colors-with-modes-QUNsZVCZ.css +1 -0
  17. package/lib/css/main.css +194 -94
  18. package/lib/design-tokens/css/tokens/base/colors/color-scales-with-modes.css +1 -1
  19. package/lib/design-tokens/css/tokens/base/colors/light.css +1 -1
  20. package/lib/design-tokens/css/tokens/base/size/size.css +1 -1
  21. package/lib/design-tokens/css/tokens/base/typography/typography.css +1 -1
  22. package/lib/design-tokens/css/tokens/functional/animation/base.css +1 -1
  23. package/lib/design-tokens/css/tokens/functional/colors/global-with-modes.css +1 -1
  24. package/lib/design-tokens/css/tokens/functional/colors/global.css +1 -1
  25. package/lib/design-tokens/css/tokens/functional/components/accordion/colors-with-modes.css +1 -1
  26. package/lib/design-tokens/css/tokens/functional/components/action-menu/colors-with-modes.css +1 -1
  27. package/lib/design-tokens/css/tokens/functional/components/anchor-nav/colors-with-modes.css +1 -1
  28. package/lib/design-tokens/css/tokens/functional/components/bento/base.css +1 -1
  29. package/lib/design-tokens/css/tokens/functional/components/blinking-cursor/colors-with-modes.css +1 -1
  30. package/lib/design-tokens/css/tokens/functional/components/breadcrumbs/colors-with-modes.css +1 -1
  31. package/lib/design-tokens/css/tokens/functional/components/button/base.css +1 -1
  32. package/lib/design-tokens/css/tokens/functional/components/button/colors-with-modes.css +1 -1
  33. package/lib/design-tokens/css/tokens/functional/components/card/base.css +1 -1
  34. package/lib/design-tokens/css/tokens/functional/components/card/colors-with-modes.css +1 -1
  35. package/lib/design-tokens/css/tokens/functional/components/card/colors.css +1 -1
  36. package/lib/design-tokens/css/tokens/functional/components/carousel-pagination/colors-with-modes.css +1 -1
  37. package/lib/design-tokens/css/tokens/functional/components/carousel-pagination/colors.css +1 -1
  38. package/lib/design-tokens/css/tokens/functional/components/comparison-table/colors-with-modes.css +1 -1
  39. package/lib/design-tokens/css/tokens/functional/components/comparison-table/comparison-table.css +1 -1
  40. package/lib/design-tokens/css/tokens/functional/components/control/colors-with-modes.css +1 -1
  41. package/lib/design-tokens/css/tokens/functional/components/cta-banner/colors-with-modes.css +1 -1
  42. package/lib/design-tokens/css/tokens/functional/components/eyebrow-banner/colors-with-modes.css +1 -1
  43. package/lib/design-tokens/css/tokens/functional/components/eyebrow-banner/eyebrow-banner.css +1 -1
  44. package/lib/design-tokens/css/tokens/functional/components/faq/base.css +1 -1
  45. package/lib/design-tokens/css/tokens/functional/components/faq/colors-with-modes.css +1 -1
  46. package/lib/design-tokens/css/tokens/functional/components/faq/colors.css +1 -1
  47. package/lib/design-tokens/css/tokens/functional/components/faq/faq.css +1 -1
  48. package/lib/design-tokens/css/tokens/functional/components/feature-comparison-table/base.css +1 -1
  49. package/lib/design-tokens/css/tokens/functional/components/feature-comparison-table/colors-with-modes.css +1 -1
  50. package/lib/design-tokens/css/tokens/functional/components/footer/base.css +1 -1
  51. package/lib/design-tokens/css/tokens/functional/components/footer/colors-with-modes.css +1 -1
  52. package/lib/design-tokens/css/tokens/functional/components/footer/colors.css +1 -1
  53. package/lib/design-tokens/css/tokens/functional/components/frosted-glass-vfx/base.css +1 -1
  54. package/lib/design-tokens/css/tokens/functional/components/frosted-glass-vfx/colors-with-modes.css +1 -1
  55. package/lib/design-tokens/css/tokens/functional/components/grid/colors-with-modes.css +1 -1
  56. package/lib/design-tokens/css/tokens/functional/components/grid/colors.css +1 -1
  57. package/lib/design-tokens/css/tokens/functional/components/grid/grid.css +1 -1
  58. package/lib/design-tokens/css/tokens/functional/components/hero/base.css +1 -1
  59. package/lib/design-tokens/css/tokens/functional/components/icon/colors-with-modes.css +1 -1
  60. package/lib/design-tokens/css/tokens/functional/components/icon/colors.css +1 -1
  61. package/lib/design-tokens/css/tokens/functional/components/icon-button/base.css +1 -1
  62. package/lib/design-tokens/css/tokens/functional/components/icon-button/colors-with-modes.css +1 -1
  63. package/lib/design-tokens/css/tokens/functional/components/icon-button/colors.css +1 -1
  64. package/lib/design-tokens/css/tokens/functional/components/ide/base.css +1 -1
  65. package/lib/design-tokens/css/tokens/functional/components/ide/colors-with-modes.css +1 -1
  66. package/lib/design-tokens/css/tokens/functional/components/image/base.css +1 -1
  67. package/lib/design-tokens/css/tokens/functional/components/inline-code/colors-with-modes.css +1 -1
  68. package/lib/design-tokens/css/tokens/functional/components/inline-code/colors.css +1 -1
  69. package/lib/design-tokens/css/tokens/functional/components/inline-link/base.css +1 -1
  70. package/lib/design-tokens/css/tokens/functional/components/inline-link/colors-with-modes.css +1 -1
  71. package/lib/design-tokens/css/tokens/functional/components/inline-link/colors.css +1 -1
  72. package/lib/design-tokens/css/tokens/functional/components/label/colors-with-modes.css +1 -1
  73. package/lib/design-tokens/css/tokens/functional/components/label/colors.css +1 -1
  74. package/lib/design-tokens/css/tokens/functional/components/link/colors-with-modes.css +1 -1
  75. package/lib/design-tokens/css/tokens/functional/components/link/colors.css +1 -1
  76. package/lib/design-tokens/css/tokens/functional/components/logosuite/base.css +1 -1
  77. package/lib/design-tokens/css/tokens/functional/components/logosuite/colors-with-modes.css +1 -1
  78. package/lib/design-tokens/css/tokens/functional/components/logosuite/colors.css +1 -1
  79. package/lib/design-tokens/css/tokens/functional/components/media-playlist/colors-with-modes.css +1 -1
  80. package/lib/design-tokens/css/tokens/functional/components/media-playlist/colors.css +1 -1
  81. package/lib/design-tokens/css/tokens/functional/components/nav-list/colors-with-modes.css +1 -1
  82. package/lib/design-tokens/css/tokens/functional/components/pricing-options/colors-with-modes.css +1 -1
  83. package/lib/design-tokens/css/tokens/functional/components/pricing-options/colors.css +1 -1
  84. package/lib/design-tokens/css/tokens/functional/components/pricing-options/pricing-options.css +1 -1
  85. package/lib/design-tokens/css/tokens/functional/components/prose/base.css +1 -1
  86. package/lib/design-tokens/css/tokens/functional/components/prose/colors-with-modes.css +1 -1
  87. package/lib/design-tokens/css/tokens/functional/components/river/base.css +1 -1
  88. package/lib/design-tokens/css/tokens/functional/components/river/river.css +1 -1
  89. package/lib/design-tokens/css/tokens/functional/components/river-story-scroll/colors-with-modes.css +1 -1
  90. package/lib/design-tokens/css/tokens/functional/components/section/section.css +1 -1
  91. package/lib/design-tokens/css/tokens/functional/components/spinner/base.css +1 -1
  92. package/lib/design-tokens/css/tokens/functional/components/spinner/colors-with-modes.css +1 -1
  93. package/lib/design-tokens/css/tokens/functional/components/spinner/colors.css +1 -1
  94. package/lib/design-tokens/css/tokens/functional/components/statistic/base.css +1 -1
  95. package/lib/design-tokens/css/tokens/functional/components/sub-nav/base.css +1 -1
  96. package/lib/design-tokens/css/tokens/functional/components/sub-nav/colors-with-modes.css +1 -1
  97. package/lib/design-tokens/css/tokens/functional/components/subdomain-nav-bar/colors-with-modes.css +1 -1
  98. package/lib/design-tokens/css/tokens/functional/components/tabs/base.css +1 -1
  99. package/lib/design-tokens/css/tokens/functional/components/tabs/colors-with-modes.css +1 -1
  100. package/lib/design-tokens/css/tokens/functional/components/tabs/colors.css +1 -1
  101. package/lib/design-tokens/css/tokens/functional/components/testimonial/base.css +1 -1
  102. package/lib/design-tokens/css/tokens/functional/components/testimonial/colors-with-modes.css +1 -1
  103. package/lib/design-tokens/css/tokens/functional/components/testimonial/colors.css +1 -1
  104. package/lib/design-tokens/css/tokens/functional/components/testimonial-group/base.css +1 -1
  105. package/lib/design-tokens/css/tokens/functional/components/text-cursor-animation/base.css +1 -1
  106. package/lib/design-tokens/css/tokens/functional/components/text-cursor-animation/colors-with-modes.css +1 -1
  107. package/lib/design-tokens/css/tokens/functional/components/text-cursor-animation/colors.css +1 -1
  108. package/lib/design-tokens/css/tokens/functional/components/tiles/base.css +1 -1
  109. package/lib/design-tokens/css/tokens/functional/components/tiles/colors-with-modes.css +1 -1
  110. package/lib/design-tokens/css/tokens/functional/components/timeline/base.css +1 -1
  111. package/lib/design-tokens/css/tokens/functional/components/timeline/colors-with-modes.css +1 -1
  112. package/lib/design-tokens/css/tokens/functional/components/timeline/colors.css +1 -1
  113. package/lib/design-tokens/css/tokens/functional/components/toggle-switch/base.css +1 -1
  114. package/lib/design-tokens/css/tokens/functional/components/toggle-switch/colors-with-modes.css +12 -12
  115. package/lib/design-tokens/css/tokens/functional/components/toggle-switch/colors.css +4 -4
  116. package/lib/design-tokens/css/tokens/functional/components/token/colors-with-modes.css +1 -1
  117. package/lib/design-tokens/css/tokens/functional/components/token/colors.css +1 -1
  118. package/lib/design-tokens/css/tokens/functional/components/tooltip/colors-with-modes.css +1 -1
  119. package/lib/design-tokens/css/tokens/functional/components/tooltip/colors.css +1 -1
  120. package/lib/design-tokens/css/tokens/functional/components/video-player/base.css +1 -1
  121. package/lib/design-tokens/css/tokens/functional/components/video-player/colors-with-modes.css +1 -1
  122. package/lib/design-tokens/css/tokens/functional/size/border.css +1 -1
  123. package/lib/design-tokens/css/tokens/functional/size/breakpoints.css +1 -1
  124. package/lib/design-tokens/css/tokens/functional/size/size-coarse.css +1 -1
  125. package/lib/design-tokens/css/tokens/functional/size/size-fine.css +1 -1
  126. package/lib/design-tokens/css/tokens/functional/size/size.css +1 -1
  127. package/lib/design-tokens/css/tokens/functional/size/viewport.css +1 -1
  128. package/lib/design-tokens/css/tokens/functional/typography/typography-responsive.css +1 -1
  129. package/lib/design-tokens/css/tokens/functional/typography/typography.css +1 -1
  130. package/lib/design-tokens/js/module/tokens/base/colors/light.js +1 -1
  131. package/lib/design-tokens/js/module/tokens/base/size/size.js +1 -1
  132. package/lib/design-tokens/js/module/tokens/base/typography/typography.js +1 -1
  133. package/lib/design-tokens/js/module/tokens/functional/animation/base.js +1 -1
  134. package/lib/design-tokens/js/module/tokens/functional/colors/global.js +1 -1
  135. package/lib/design-tokens/js/module/tokens/functional/components/bento/base.js +1 -1
  136. package/lib/design-tokens/js/module/tokens/functional/components/button/base.js +1 -1
  137. package/lib/design-tokens/js/module/tokens/functional/components/card/base.js +1 -1
  138. package/lib/design-tokens/js/module/tokens/functional/components/card/colors.js +1 -1
  139. package/lib/design-tokens/js/module/tokens/functional/components/carousel-pagination/colors.js +1 -1
  140. package/lib/design-tokens/js/module/tokens/functional/components/comparison-table/comparison-table.js +1 -1
  141. package/lib/design-tokens/js/module/tokens/functional/components/eyebrow-banner/eyebrow-banner.js +1 -1
  142. package/lib/design-tokens/js/module/tokens/functional/components/faq/base.js +1 -1
  143. package/lib/design-tokens/js/module/tokens/functional/components/faq/colors.js +1 -1
  144. package/lib/design-tokens/js/module/tokens/functional/components/faq/faq.js +1 -1
  145. package/lib/design-tokens/js/module/tokens/functional/components/feature-comparison-table/base.js +1 -1
  146. package/lib/design-tokens/js/module/tokens/functional/components/footer/base.js +1 -1
  147. package/lib/design-tokens/js/module/tokens/functional/components/footer/colors.js +1 -1
  148. package/lib/design-tokens/js/module/tokens/functional/components/frosted-glass-vfx/base.js +1 -1
  149. package/lib/design-tokens/js/module/tokens/functional/components/grid/colors.js +1 -1
  150. package/lib/design-tokens/js/module/tokens/functional/components/grid/grid.js +1 -1
  151. package/lib/design-tokens/js/module/tokens/functional/components/hero/base.js +1 -1
  152. package/lib/design-tokens/js/module/tokens/functional/components/icon/colors.js +1 -1
  153. package/lib/design-tokens/js/module/tokens/functional/components/icon-button/base.js +1 -1
  154. package/lib/design-tokens/js/module/tokens/functional/components/icon-button/colors.js +1 -1
  155. package/lib/design-tokens/js/module/tokens/functional/components/ide/base.js +1 -1
  156. package/lib/design-tokens/js/module/tokens/functional/components/image/base.js +1 -1
  157. package/lib/design-tokens/js/module/tokens/functional/components/inline-code/colors.js +1 -1
  158. package/lib/design-tokens/js/module/tokens/functional/components/inline-link/base.js +1 -1
  159. package/lib/design-tokens/js/module/tokens/functional/components/inline-link/colors.js +1 -1
  160. package/lib/design-tokens/js/module/tokens/functional/components/label/colors.js +1 -1
  161. package/lib/design-tokens/js/module/tokens/functional/components/link/colors.js +1 -1
  162. package/lib/design-tokens/js/module/tokens/functional/components/logosuite/base.js +1 -1
  163. package/lib/design-tokens/js/module/tokens/functional/components/logosuite/colors.js +1 -1
  164. package/lib/design-tokens/js/module/tokens/functional/components/media-playlist/colors.js +1 -1
  165. package/lib/design-tokens/js/module/tokens/functional/components/pricing-options/colors.js +1 -1
  166. package/lib/design-tokens/js/module/tokens/functional/components/pricing-options/pricing-options.js +1 -1
  167. package/lib/design-tokens/js/module/tokens/functional/components/prose/base.js +1 -1
  168. package/lib/design-tokens/js/module/tokens/functional/components/river/base.js +1 -1
  169. package/lib/design-tokens/js/module/tokens/functional/components/river/river.js +1 -1
  170. package/lib/design-tokens/js/module/tokens/functional/components/section/section.js +1 -1
  171. package/lib/design-tokens/js/module/tokens/functional/components/spinner/base.js +1 -1
  172. package/lib/design-tokens/js/module/tokens/functional/components/spinner/colors.js +1 -1
  173. package/lib/design-tokens/js/module/tokens/functional/components/statistic/base.js +1 -1
  174. package/lib/design-tokens/js/module/tokens/functional/components/sub-nav/base.js +1 -1
  175. package/lib/design-tokens/js/module/tokens/functional/components/tabs/base.js +1 -1
  176. package/lib/design-tokens/js/module/tokens/functional/components/tabs/colors.js +1 -1
  177. package/lib/design-tokens/js/module/tokens/functional/components/testimonial/base.js +1 -1
  178. package/lib/design-tokens/js/module/tokens/functional/components/testimonial/colors.js +1 -1
  179. package/lib/design-tokens/js/module/tokens/functional/components/testimonial-group/base.js +1 -1
  180. package/lib/design-tokens/js/module/tokens/functional/components/text-cursor-animation/base.js +1 -1
  181. package/lib/design-tokens/js/module/tokens/functional/components/text-cursor-animation/colors.js +1 -1
  182. package/lib/design-tokens/js/module/tokens/functional/components/tiles/base.js +1 -1
  183. package/lib/design-tokens/js/module/tokens/functional/components/timeline/base.js +1 -1
  184. package/lib/design-tokens/js/module/tokens/functional/components/timeline/colors.js +1 -1
  185. package/lib/design-tokens/js/module/tokens/functional/components/toggle-switch/base.js +1 -1
  186. package/lib/design-tokens/js/module/tokens/functional/components/toggle-switch/colors.js +8 -8
  187. package/lib/design-tokens/js/module/tokens/functional/components/token/colors.js +1 -1
  188. package/lib/design-tokens/js/module/tokens/functional/components/tooltip/colors.js +1 -1
  189. package/lib/design-tokens/js/module/tokens/functional/components/video-player/base.js +1 -1
  190. package/lib/design-tokens/js/module/tokens/functional/size/border.js +1 -1
  191. package/lib/design-tokens/js/module/tokens/functional/size/breakpoints.js +1 -1
  192. package/lib/design-tokens/js/module/tokens/functional/size/size-coarse.js +1 -1
  193. package/lib/design-tokens/js/module/tokens/functional/size/size-fine.js +1 -1
  194. package/lib/design-tokens/js/module/tokens/functional/size/size.js +1 -1
  195. package/lib/design-tokens/js/module/tokens/functional/size/viewport.js +1 -1
  196. package/lib/design-tokens/js/module/tokens/functional/typography/typography-responsive.js +1 -1
  197. package/lib/design-tokens/js/module/tokens/functional/typography/typography.js +1 -1
  198. package/lib/design-tokens/js/tokens/base/colors/light.js +1 -1
  199. package/lib/design-tokens/js/tokens/base/size/size.js +1 -1
  200. package/lib/design-tokens/js/tokens/base/typography/typography.js +1 -1
  201. package/lib/design-tokens/js/tokens/functional/animation/base.js +1 -1
  202. package/lib/design-tokens/js/tokens/functional/colors/global.js +1 -1
  203. package/lib/design-tokens/js/tokens/functional/components/bento/base.js +1 -1
  204. package/lib/design-tokens/js/tokens/functional/components/button/base.js +1 -1
  205. package/lib/design-tokens/js/tokens/functional/components/card/base.js +1 -1
  206. package/lib/design-tokens/js/tokens/functional/components/card/colors.js +1 -1
  207. package/lib/design-tokens/js/tokens/functional/components/carousel-pagination/colors.js +1 -1
  208. package/lib/design-tokens/js/tokens/functional/components/comparison-table/comparison-table.js +1 -1
  209. package/lib/design-tokens/js/tokens/functional/components/eyebrow-banner/eyebrow-banner.js +1 -1
  210. package/lib/design-tokens/js/tokens/functional/components/faq/base.js +1 -1
  211. package/lib/design-tokens/js/tokens/functional/components/faq/colors.js +1 -1
  212. package/lib/design-tokens/js/tokens/functional/components/faq/faq.js +1 -1
  213. package/lib/design-tokens/js/tokens/functional/components/feature-comparison-table/base.js +1 -1
  214. package/lib/design-tokens/js/tokens/functional/components/footer/base.js +1 -1
  215. package/lib/design-tokens/js/tokens/functional/components/footer/colors.js +1 -1
  216. package/lib/design-tokens/js/tokens/functional/components/frosted-glass-vfx/base.js +1 -1
  217. package/lib/design-tokens/js/tokens/functional/components/grid/colors.js +1 -1
  218. package/lib/design-tokens/js/tokens/functional/components/grid/grid.js +1 -1
  219. package/lib/design-tokens/js/tokens/functional/components/hero/base.js +1 -1
  220. package/lib/design-tokens/js/tokens/functional/components/icon/colors.js +1 -1
  221. package/lib/design-tokens/js/tokens/functional/components/icon-button/base.js +1 -1
  222. package/lib/design-tokens/js/tokens/functional/components/icon-button/colors.js +1 -1
  223. package/lib/design-tokens/js/tokens/functional/components/ide/base.js +1 -1
  224. package/lib/design-tokens/js/tokens/functional/components/image/base.js +1 -1
  225. package/lib/design-tokens/js/tokens/functional/components/inline-code/colors.js +1 -1
  226. package/lib/design-tokens/js/tokens/functional/components/inline-link/base.js +1 -1
  227. package/lib/design-tokens/js/tokens/functional/components/inline-link/colors.js +1 -1
  228. package/lib/design-tokens/js/tokens/functional/components/label/colors.js +1 -1
  229. package/lib/design-tokens/js/tokens/functional/components/link/colors.js +1 -1
  230. package/lib/design-tokens/js/tokens/functional/components/logosuite/base.js +1 -1
  231. package/lib/design-tokens/js/tokens/functional/components/logosuite/colors.js +1 -1
  232. package/lib/design-tokens/js/tokens/functional/components/media-playlist/colors.js +1 -1
  233. package/lib/design-tokens/js/tokens/functional/components/pricing-options/colors.js +1 -1
  234. package/lib/design-tokens/js/tokens/functional/components/pricing-options/pricing-options.js +1 -1
  235. package/lib/design-tokens/js/tokens/functional/components/prose/base.js +1 -1
  236. package/lib/design-tokens/js/tokens/functional/components/river/base.js +1 -1
  237. package/lib/design-tokens/js/tokens/functional/components/river/river.js +1 -1
  238. package/lib/design-tokens/js/tokens/functional/components/section/section.js +1 -1
  239. package/lib/design-tokens/js/tokens/functional/components/spinner/base.js +1 -1
  240. package/lib/design-tokens/js/tokens/functional/components/spinner/colors.js +1 -1
  241. package/lib/design-tokens/js/tokens/functional/components/statistic/base.js +1 -1
  242. package/lib/design-tokens/js/tokens/functional/components/sub-nav/base.js +1 -1
  243. package/lib/design-tokens/js/tokens/functional/components/tabs/base.js +1 -1
  244. package/lib/design-tokens/js/tokens/functional/components/tabs/colors.js +1 -1
  245. package/lib/design-tokens/js/tokens/functional/components/testimonial/base.js +1 -1
  246. package/lib/design-tokens/js/tokens/functional/components/testimonial/colors.js +1 -1
  247. package/lib/design-tokens/js/tokens/functional/components/testimonial-group/base.js +1 -1
  248. package/lib/design-tokens/js/tokens/functional/components/text-cursor-animation/base.js +1 -1
  249. package/lib/design-tokens/js/tokens/functional/components/text-cursor-animation/colors.js +1 -1
  250. package/lib/design-tokens/js/tokens/functional/components/tiles/base.js +1 -1
  251. package/lib/design-tokens/js/tokens/functional/components/timeline/base.js +1 -1
  252. package/lib/design-tokens/js/tokens/functional/components/timeline/colors.js +1 -1
  253. package/lib/design-tokens/js/tokens/functional/components/toggle-switch/base.js +1 -1
  254. package/lib/design-tokens/js/tokens/functional/components/toggle-switch/colors.js +4 -4
  255. package/lib/design-tokens/js/tokens/functional/components/token/colors.js +1 -1
  256. package/lib/design-tokens/js/tokens/functional/components/tooltip/colors.js +1 -1
  257. package/lib/design-tokens/js/tokens/functional/components/video-player/base.js +1 -1
  258. package/lib/design-tokens/js/tokens/functional/size/border.js +1 -1
  259. package/lib/design-tokens/js/tokens/functional/size/breakpoints.js +1 -1
  260. package/lib/design-tokens/js/tokens/functional/size/size-coarse.js +1 -1
  261. package/lib/design-tokens/js/tokens/functional/size/size-fine.js +1 -1
  262. package/lib/design-tokens/js/tokens/functional/size/size.js +1 -1
  263. package/lib/design-tokens/js/tokens/functional/size/viewport.js +1 -1
  264. package/lib/design-tokens/js/tokens/functional/typography/typography-responsive.js +1 -1
  265. package/lib/design-tokens/js/tokens/functional/typography/typography.js +1 -1
  266. package/lib/design-tokens/json/colors.json +3 -3
  267. package/lib/design-tokens/scss/tokens/base/colors/light.scss +1 -1
  268. package/lib/design-tokens/scss/tokens/base/size/size.scss +1 -1
  269. package/lib/design-tokens/scss/tokens/base/typography/typography.scss +1 -1
  270. package/lib/design-tokens/scss/tokens/functional/animation/base.scss +1 -1
  271. package/lib/design-tokens/scss/tokens/functional/colors/global.scss +1 -1
  272. package/lib/design-tokens/scss/tokens/functional/components/bento/base.scss +1 -1
  273. package/lib/design-tokens/scss/tokens/functional/components/button/base.scss +1 -1
  274. package/lib/design-tokens/scss/tokens/functional/components/card/base.scss +1 -1
  275. package/lib/design-tokens/scss/tokens/functional/components/card/colors.scss +1 -1
  276. package/lib/design-tokens/scss/tokens/functional/components/carousel-pagination/colors.scss +1 -1
  277. package/lib/design-tokens/scss/tokens/functional/components/comparison-table/comparison-table.scss +1 -1
  278. package/lib/design-tokens/scss/tokens/functional/components/eyebrow-banner/eyebrow-banner.scss +1 -1
  279. package/lib/design-tokens/scss/tokens/functional/components/faq/base.scss +1 -1
  280. package/lib/design-tokens/scss/tokens/functional/components/faq/colors.scss +1 -1
  281. package/lib/design-tokens/scss/tokens/functional/components/faq/faq.scss +1 -1
  282. package/lib/design-tokens/scss/tokens/functional/components/feature-comparison-table/base.scss +1 -1
  283. package/lib/design-tokens/scss/tokens/functional/components/footer/base.scss +1 -1
  284. package/lib/design-tokens/scss/tokens/functional/components/footer/colors.scss +1 -1
  285. package/lib/design-tokens/scss/tokens/functional/components/frosted-glass-vfx/base.scss +1 -1
  286. package/lib/design-tokens/scss/tokens/functional/components/grid/colors.scss +1 -1
  287. package/lib/design-tokens/scss/tokens/functional/components/grid/grid.scss +1 -1
  288. package/lib/design-tokens/scss/tokens/functional/components/hero/base.scss +1 -1
  289. package/lib/design-tokens/scss/tokens/functional/components/icon/colors.scss +1 -1
  290. package/lib/design-tokens/scss/tokens/functional/components/icon-button/base.scss +1 -1
  291. package/lib/design-tokens/scss/tokens/functional/components/icon-button/colors.scss +1 -1
  292. package/lib/design-tokens/scss/tokens/functional/components/ide/base.scss +1 -1
  293. package/lib/design-tokens/scss/tokens/functional/components/image/base.scss +1 -1
  294. package/lib/design-tokens/scss/tokens/functional/components/inline-code/colors.scss +1 -1
  295. package/lib/design-tokens/scss/tokens/functional/components/inline-link/base.scss +1 -1
  296. package/lib/design-tokens/scss/tokens/functional/components/inline-link/colors.scss +1 -1
  297. package/lib/design-tokens/scss/tokens/functional/components/label/colors.scss +1 -1
  298. package/lib/design-tokens/scss/tokens/functional/components/link/colors.scss +1 -1
  299. package/lib/design-tokens/scss/tokens/functional/components/logosuite/base.scss +1 -1
  300. package/lib/design-tokens/scss/tokens/functional/components/logosuite/colors.scss +1 -1
  301. package/lib/design-tokens/scss/tokens/functional/components/media-playlist/colors.scss +1 -1
  302. package/lib/design-tokens/scss/tokens/functional/components/pricing-options/colors.scss +1 -1
  303. package/lib/design-tokens/scss/tokens/functional/components/pricing-options/pricing-options.scss +1 -1
  304. package/lib/design-tokens/scss/tokens/functional/components/prose/base.scss +1 -1
  305. package/lib/design-tokens/scss/tokens/functional/components/river/base.scss +1 -1
  306. package/lib/design-tokens/scss/tokens/functional/components/river/river.scss +1 -1
  307. package/lib/design-tokens/scss/tokens/functional/components/section/section.scss +1 -1
  308. package/lib/design-tokens/scss/tokens/functional/components/spinner/base.scss +1 -1
  309. package/lib/design-tokens/scss/tokens/functional/components/spinner/colors.scss +1 -1
  310. package/lib/design-tokens/scss/tokens/functional/components/statistic/base.scss +1 -1
  311. package/lib/design-tokens/scss/tokens/functional/components/sub-nav/base.scss +1 -1
  312. package/lib/design-tokens/scss/tokens/functional/components/tabs/base.scss +1 -1
  313. package/lib/design-tokens/scss/tokens/functional/components/tabs/colors.scss +1 -1
  314. package/lib/design-tokens/scss/tokens/functional/components/testimonial/base.scss +1 -1
  315. package/lib/design-tokens/scss/tokens/functional/components/testimonial/colors.scss +1 -1
  316. package/lib/design-tokens/scss/tokens/functional/components/testimonial-group/base.scss +1 -1
  317. package/lib/design-tokens/scss/tokens/functional/components/text-cursor-animation/base.scss +1 -1
  318. package/lib/design-tokens/scss/tokens/functional/components/text-cursor-animation/colors.scss +1 -1
  319. package/lib/design-tokens/scss/tokens/functional/components/tiles/base.scss +1 -1
  320. package/lib/design-tokens/scss/tokens/functional/components/timeline/base.scss +1 -1
  321. package/lib/design-tokens/scss/tokens/functional/components/timeline/colors.scss +1 -1
  322. package/lib/design-tokens/scss/tokens/functional/components/toggle-switch/base.scss +1 -1
  323. package/lib/design-tokens/scss/tokens/functional/components/toggle-switch/colors.scss +4 -4
  324. package/lib/design-tokens/scss/tokens/functional/components/token/colors.scss +1 -1
  325. package/lib/design-tokens/scss/tokens/functional/components/tooltip/colors.scss +1 -1
  326. package/lib/design-tokens/scss/tokens/functional/components/video-player/base.scss +1 -1
  327. package/lib/design-tokens/scss/tokens/functional/size/border.scss +1 -1
  328. package/lib/design-tokens/scss/tokens/functional/size/breakpoints.scss +1 -1
  329. package/lib/design-tokens/scss/tokens/functional/size/size-coarse.scss +1 -1
  330. package/lib/design-tokens/scss/tokens/functional/size/size-fine.scss +1 -1
  331. package/lib/design-tokens/scss/tokens/functional/size/size.scss +1 -1
  332. package/lib/design-tokens/scss/tokens/functional/size/viewport.scss +1 -1
  333. package/lib/design-tokens/scss/tokens/functional/typography/typography-responsive.scss +1 -1
  334. package/lib/design-tokens/scss/tokens/functional/typography/typography.scss +1 -1
  335. package/lib/design-tokens/ts/tokens/base/colors/light.d.ts +1 -1
  336. package/lib/design-tokens/ts/tokens/base/colors/light.js +1 -1
  337. package/lib/design-tokens/ts/tokens/base/size/size.d.ts +1 -1
  338. package/lib/design-tokens/ts/tokens/base/size/size.js +1 -1
  339. package/lib/design-tokens/ts/tokens/base/typography/typography.d.ts +1 -1
  340. package/lib/design-tokens/ts/tokens/base/typography/typography.js +1 -1
  341. package/lib/design-tokens/ts/tokens/functional/animation/base.d.ts +1 -1
  342. package/lib/design-tokens/ts/tokens/functional/animation/base.js +1 -1
  343. package/lib/design-tokens/ts/tokens/functional/colors/global.d.ts +1 -1
  344. package/lib/design-tokens/ts/tokens/functional/colors/global.js +1 -1
  345. package/lib/design-tokens/ts/tokens/functional/components/bento/base.d.ts +1 -1
  346. package/lib/design-tokens/ts/tokens/functional/components/bento/base.js +1 -1
  347. package/lib/design-tokens/ts/tokens/functional/components/button/base.d.ts +1 -1
  348. package/lib/design-tokens/ts/tokens/functional/components/button/base.js +1 -1
  349. package/lib/design-tokens/ts/tokens/functional/components/card/base.d.ts +1 -1
  350. package/lib/design-tokens/ts/tokens/functional/components/card/base.js +1 -1
  351. package/lib/design-tokens/ts/tokens/functional/components/card/colors.d.ts +1 -1
  352. package/lib/design-tokens/ts/tokens/functional/components/card/colors.js +1 -1
  353. package/lib/design-tokens/ts/tokens/functional/components/carousel-pagination/colors.d.ts +1 -1
  354. package/lib/design-tokens/ts/tokens/functional/components/carousel-pagination/colors.js +1 -1
  355. package/lib/design-tokens/ts/tokens/functional/components/comparison-table/comparison-table.d.ts +1 -1
  356. package/lib/design-tokens/ts/tokens/functional/components/comparison-table/comparison-table.js +1 -1
  357. package/lib/design-tokens/ts/tokens/functional/components/eyebrow-banner/eyebrow-banner.d.ts +1 -1
  358. package/lib/design-tokens/ts/tokens/functional/components/eyebrow-banner/eyebrow-banner.js +1 -1
  359. package/lib/design-tokens/ts/tokens/functional/components/faq/base.d.ts +1 -1
  360. package/lib/design-tokens/ts/tokens/functional/components/faq/base.js +1 -1
  361. package/lib/design-tokens/ts/tokens/functional/components/faq/colors.d.ts +1 -1
  362. package/lib/design-tokens/ts/tokens/functional/components/faq/colors.js +1 -1
  363. package/lib/design-tokens/ts/tokens/functional/components/faq/faq.d.ts +1 -1
  364. package/lib/design-tokens/ts/tokens/functional/components/faq/faq.js +1 -1
  365. package/lib/design-tokens/ts/tokens/functional/components/feature-comparison-table/base.d.ts +1 -1
  366. package/lib/design-tokens/ts/tokens/functional/components/feature-comparison-table/base.js +1 -1
  367. package/lib/design-tokens/ts/tokens/functional/components/footer/base.d.ts +1 -1
  368. package/lib/design-tokens/ts/tokens/functional/components/footer/base.js +1 -1
  369. package/lib/design-tokens/ts/tokens/functional/components/footer/colors.d.ts +1 -1
  370. package/lib/design-tokens/ts/tokens/functional/components/footer/colors.js +1 -1
  371. package/lib/design-tokens/ts/tokens/functional/components/frosted-glass-vfx/base.d.ts +1 -1
  372. package/lib/design-tokens/ts/tokens/functional/components/frosted-glass-vfx/base.js +1 -1
  373. package/lib/design-tokens/ts/tokens/functional/components/grid/colors.d.ts +1 -1
  374. package/lib/design-tokens/ts/tokens/functional/components/grid/colors.js +1 -1
  375. package/lib/design-tokens/ts/tokens/functional/components/grid/grid.d.ts +1 -1
  376. package/lib/design-tokens/ts/tokens/functional/components/grid/grid.js +1 -1
  377. package/lib/design-tokens/ts/tokens/functional/components/hero/base.d.ts +1 -1
  378. package/lib/design-tokens/ts/tokens/functional/components/hero/base.js +1 -1
  379. package/lib/design-tokens/ts/tokens/functional/components/icon/colors.d.ts +1 -1
  380. package/lib/design-tokens/ts/tokens/functional/components/icon/colors.js +1 -1
  381. package/lib/design-tokens/ts/tokens/functional/components/icon-button/base.d.ts +1 -1
  382. package/lib/design-tokens/ts/tokens/functional/components/icon-button/base.js +1 -1
  383. package/lib/design-tokens/ts/tokens/functional/components/icon-button/colors.d.ts +1 -1
  384. package/lib/design-tokens/ts/tokens/functional/components/icon-button/colors.js +1 -1
  385. package/lib/design-tokens/ts/tokens/functional/components/ide/base.d.ts +1 -1
  386. package/lib/design-tokens/ts/tokens/functional/components/ide/base.js +1 -1
  387. package/lib/design-tokens/ts/tokens/functional/components/image/base.d.ts +1 -1
  388. package/lib/design-tokens/ts/tokens/functional/components/image/base.js +1 -1
  389. package/lib/design-tokens/ts/tokens/functional/components/inline-code/colors.d.ts +1 -1
  390. package/lib/design-tokens/ts/tokens/functional/components/inline-code/colors.js +1 -1
  391. package/lib/design-tokens/ts/tokens/functional/components/inline-link/base.d.ts +1 -1
  392. package/lib/design-tokens/ts/tokens/functional/components/inline-link/base.js +1 -1
  393. package/lib/design-tokens/ts/tokens/functional/components/inline-link/colors.d.ts +1 -1
  394. package/lib/design-tokens/ts/tokens/functional/components/inline-link/colors.js +1 -1
  395. package/lib/design-tokens/ts/tokens/functional/components/label/colors.d.ts +1 -1
  396. package/lib/design-tokens/ts/tokens/functional/components/label/colors.js +1 -1
  397. package/lib/design-tokens/ts/tokens/functional/components/link/colors.d.ts +1 -1
  398. package/lib/design-tokens/ts/tokens/functional/components/link/colors.js +1 -1
  399. package/lib/design-tokens/ts/tokens/functional/components/logosuite/base.d.ts +1 -1
  400. package/lib/design-tokens/ts/tokens/functional/components/logosuite/base.js +1 -1
  401. package/lib/design-tokens/ts/tokens/functional/components/logosuite/colors.d.ts +1 -1
  402. package/lib/design-tokens/ts/tokens/functional/components/logosuite/colors.js +1 -1
  403. package/lib/design-tokens/ts/tokens/functional/components/media-playlist/colors.d.ts +1 -1
  404. package/lib/design-tokens/ts/tokens/functional/components/media-playlist/colors.js +1 -1
  405. package/lib/design-tokens/ts/tokens/functional/components/pricing-options/colors.d.ts +1 -1
  406. package/lib/design-tokens/ts/tokens/functional/components/pricing-options/colors.js +1 -1
  407. package/lib/design-tokens/ts/tokens/functional/components/pricing-options/pricing-options.d.ts +1 -1
  408. package/lib/design-tokens/ts/tokens/functional/components/pricing-options/pricing-options.js +1 -1
  409. package/lib/design-tokens/ts/tokens/functional/components/prose/base.d.ts +1 -1
  410. package/lib/design-tokens/ts/tokens/functional/components/prose/base.js +1 -1
  411. package/lib/design-tokens/ts/tokens/functional/components/river/base.d.ts +1 -1
  412. package/lib/design-tokens/ts/tokens/functional/components/river/base.js +1 -1
  413. package/lib/design-tokens/ts/tokens/functional/components/river/river.d.ts +1 -1
  414. package/lib/design-tokens/ts/tokens/functional/components/river/river.js +1 -1
  415. package/lib/design-tokens/ts/tokens/functional/components/section/section.d.ts +1 -1
  416. package/lib/design-tokens/ts/tokens/functional/components/section/section.js +1 -1
  417. package/lib/design-tokens/ts/tokens/functional/components/spinner/base.d.ts +1 -1
  418. package/lib/design-tokens/ts/tokens/functional/components/spinner/base.js +1 -1
  419. package/lib/design-tokens/ts/tokens/functional/components/spinner/colors.d.ts +1 -1
  420. package/lib/design-tokens/ts/tokens/functional/components/spinner/colors.js +1 -1
  421. package/lib/design-tokens/ts/tokens/functional/components/statistic/base.d.ts +1 -1
  422. package/lib/design-tokens/ts/tokens/functional/components/statistic/base.js +1 -1
  423. package/lib/design-tokens/ts/tokens/functional/components/sub-nav/base.d.ts +1 -1
  424. package/lib/design-tokens/ts/tokens/functional/components/sub-nav/base.js +1 -1
  425. package/lib/design-tokens/ts/tokens/functional/components/tabs/base.d.ts +1 -1
  426. package/lib/design-tokens/ts/tokens/functional/components/tabs/base.js +1 -1
  427. package/lib/design-tokens/ts/tokens/functional/components/tabs/colors.d.ts +1 -1
  428. package/lib/design-tokens/ts/tokens/functional/components/tabs/colors.js +1 -1
  429. package/lib/design-tokens/ts/tokens/functional/components/testimonial/base.d.ts +1 -1
  430. package/lib/design-tokens/ts/tokens/functional/components/testimonial/base.js +1 -1
  431. package/lib/design-tokens/ts/tokens/functional/components/testimonial/colors.d.ts +1 -1
  432. package/lib/design-tokens/ts/tokens/functional/components/testimonial/colors.js +1 -1
  433. package/lib/design-tokens/ts/tokens/functional/components/testimonial-group/base.d.ts +1 -1
  434. package/lib/design-tokens/ts/tokens/functional/components/testimonial-group/base.js +1 -1
  435. package/lib/design-tokens/ts/tokens/functional/components/text-cursor-animation/base.d.ts +1 -1
  436. package/lib/design-tokens/ts/tokens/functional/components/text-cursor-animation/base.js +1 -1
  437. package/lib/design-tokens/ts/tokens/functional/components/text-cursor-animation/colors.d.ts +1 -1
  438. package/lib/design-tokens/ts/tokens/functional/components/text-cursor-animation/colors.js +1 -1
  439. package/lib/design-tokens/ts/tokens/functional/components/tiles/base.d.ts +1 -1
  440. package/lib/design-tokens/ts/tokens/functional/components/tiles/base.js +1 -1
  441. package/lib/design-tokens/ts/tokens/functional/components/timeline/base.d.ts +1 -1
  442. package/lib/design-tokens/ts/tokens/functional/components/timeline/base.js +1 -1
  443. package/lib/design-tokens/ts/tokens/functional/components/timeline/colors.d.ts +1 -1
  444. package/lib/design-tokens/ts/tokens/functional/components/timeline/colors.js +1 -1
  445. package/lib/design-tokens/ts/tokens/functional/components/toggle-switch/base.d.ts +1 -1
  446. package/lib/design-tokens/ts/tokens/functional/components/toggle-switch/base.js +1 -1
  447. package/lib/design-tokens/ts/tokens/functional/components/toggle-switch/colors.d.ts +1 -1
  448. package/lib/design-tokens/ts/tokens/functional/components/toggle-switch/colors.js +4 -4
  449. package/lib/design-tokens/ts/tokens/functional/components/token/colors.d.ts +1 -1
  450. package/lib/design-tokens/ts/tokens/functional/components/token/colors.js +1 -1
  451. package/lib/design-tokens/ts/tokens/functional/components/tooltip/colors.d.ts +1 -1
  452. package/lib/design-tokens/ts/tokens/functional/components/tooltip/colors.js +1 -1
  453. package/lib/design-tokens/ts/tokens/functional/components/video-player/base.d.ts +1 -1
  454. package/lib/design-tokens/ts/tokens/functional/components/video-player/base.js +1 -1
  455. package/lib/design-tokens/ts/tokens/functional/size/border.d.ts +1 -1
  456. package/lib/design-tokens/ts/tokens/functional/size/border.js +1 -1
  457. package/lib/design-tokens/ts/tokens/functional/size/breakpoints.d.ts +1 -1
  458. package/lib/design-tokens/ts/tokens/functional/size/breakpoints.js +1 -1
  459. package/lib/design-tokens/ts/tokens/functional/size/size-coarse.d.ts +1 -1
  460. package/lib/design-tokens/ts/tokens/functional/size/size-coarse.js +1 -1
  461. package/lib/design-tokens/ts/tokens/functional/size/size-fine.d.ts +1 -1
  462. package/lib/design-tokens/ts/tokens/functional/size/size-fine.js +1 -1
  463. package/lib/design-tokens/ts/tokens/functional/size/size.d.ts +1 -1
  464. package/lib/design-tokens/ts/tokens/functional/size/size.js +1 -1
  465. package/lib/design-tokens/ts/tokens/functional/size/viewport.d.ts +1 -1
  466. package/lib/design-tokens/ts/tokens/functional/size/viewport.js +1 -1
  467. package/lib/design-tokens/ts/tokens/functional/typography/typography-responsive.d.ts +1 -1
  468. package/lib/design-tokens/ts/tokens/functional/typography/typography-responsive.js +1 -1
  469. package/lib/design-tokens/ts/tokens/functional/typography/typography.d.ts +1 -1
  470. package/lib/design-tokens/ts/tokens/functional/typography/typography.js +1 -1
  471. package/lib/forms/ToggleSwitch/ToggleSwitch.d.ts +10 -0
  472. package/lib/index.js +1 -1
  473. package/llms.txt +2 -2
  474. package/package.json +1 -1
  475. package/esm/forms/FormControl/FormControl.module-NDvIk_Aq.css +0 -1
  476. package/esm/forms/ToggleSwitch/ToggleSwitch.module-C_gXnHNW.css +0 -1
  477. package/esm/packages/design-tokens/lib/design-tokens/css/tokens/functional/components/toggle-switch/colors-with-modes-Byi9AmE8.css +0 -1
@@ -64,6 +64,29 @@ render(Example)
64
64
  </Stack>
65
65
  ```
66
66
 
67
+ ### Status label
68
+
69
+ Enable `hasStatusLabel` when space permits to make the current state easier to understand. The text appears before the track by default. Use `statusLabelPosition` to move it after the track, and `labels` to localize or reword it. The status text increases the control width.
70
+
71
+ Custom status text supplements the setting label; it does not replace it. The switch exposes its state as on or off to assistive technology, so the setting label must make sense with on and off. For example, use "Make repository public" rather than "Repository visibility" with "Public" and "Private" status text.
72
+
73
+ ```jsx
74
+ <Stack>
75
+ <FormControl>
76
+ <FormControl.Label>Status label at end</FormControl.Label>
77
+ <ToggleSwitch hasStatusLabel statusLabelPosition="end" defaultChecked />
78
+ </FormControl>
79
+ <FormControl>
80
+ <FormControl.Label>Custom status labels</FormControl.Label>
81
+ <ToggleSwitch hasStatusLabel labels={{on: 'Enabled', off: 'Disabled'}} />
82
+ </FormControl>
83
+ <FormControl>
84
+ <FormControl.Label>Without status label</FormControl.Label>
85
+ <ToggleSwitch />
86
+ </FormControl>
87
+ </Stack>
88
+ ```
89
+
67
90
  ### Disabled
68
91
 
69
92
  ```jsx
@@ -99,27 +122,38 @@ render(Example)
99
122
  </Stack>
100
123
  ```
101
124
 
125
+ ## Accessibility
126
+
127
+ `ToggleSwitch` exposes its state with `role="switch"` and `aria-checked`. Give it a descriptive setting label with `FormControl.Label` or `aria-labelledby`. The label describes the setting; status text does not replace it or change the switch's accessible name. The thumb position also communicates state, beyond color.
128
+
129
+ Enable `hasStatusLabel` when space permits. The visible On/Off text is part of the switch's click target and stays visible in both sizes, light and dark modes, and forced-colors mode. Default On/Off text is hidden from assistive technology because `aria-checked` already exposes the state. With `hasStatusLabel`, custom `labels.on` and `labels.off` text becomes the accessible description. Immediate activation changes politely announce custom text; later controlled updates change the description without an announcement. Translated labels can repeat the state. Both labels reserve the same width to prevent layout shifts. In narrow containers, `FormControl` places the setting label above the switch so longer labels can wrap without horizontal scrolling.
130
+
131
+ The default track border and enabled thumb each meet 3:1 contrast against adjacent colors in light and dark modes. ToggleSwitch uses existing Brand palette colors. Recheck contrast if you override its colors or place it on a custom background.
132
+
102
133
  ## Component Props
103
134
 
104
- | Name | Type | Default | Description |
105
- | ------------------- | -------------------------------------------- | ----------- | ------------------------------------------------------------------------------------- |
106
- | `checked` | `boolean` | | Controlled on/off value. |
107
- | `defaultChecked` | `boolean` | `false` | Initial uncontrolled value. |
108
- | `onChange` | `(checked: boolean) => void` | | Called once per accepted activation with the next value. |
109
- | `onClick` | `React.MouseEventHandler<HTMLButtonElement>` | | Activation callback receiving the button event. |
110
- | `disabled` | `boolean` | `false` | Blocks activation while retaining keyboard focusability. |
111
- | `loading` | `boolean` | `false` | Displays pending feedback and exposes `aria-busy` without blocking interaction. |
112
- | `size` | `'small' \| 'medium'` | `'medium'` | Alternative sizes. |
113
- | `loadingLabel` | `string` | `'Loading'` | Localized loading announcement. |
114
- | `loadingLabelDelay` | `number` | `2000` | Announcement delay in milliseconds. |
115
- | `spinnerPosition` | `'start' \| 'end'` | `'end'` | Indicator placement beside the switch when no visible FormControl label is available. |
116
- | `aria-label` | `string` | | Explicit accessible name matching equivalent visible labeling. |
117
- | `aria-labelledby` | `string` | | IDs of visible labeling elements. |
118
- | `aria-describedby` | `string` | | Description IDs, combined with FormControl and loading descriptions. |
119
- | `aria-invalid` | React ARIA attribute | | Validation state of the switch button. |
120
- | `ref` | `React.Ref<HTMLButtonElement>` | | Ref for the focusable button. |
121
- | `className` | `string` | | Class applied to the component wrapper. |
122
- | `data-testid` | `string` | | Test ID applied to the component wrapper. |
135
+ | Name | Type | Default | Description |
136
+ | --------------------- | -------------------------------------------- | ------------ | ------------------------------------------------------------------------------------- |
137
+ | `checked` | `boolean` | | Controlled on/off value. |
138
+ | `defaultChecked` | `boolean` | `false` | Initial uncontrolled value. |
139
+ | `onChange` | `(checked: boolean) => void` | | Called once per accepted activation with the next value. |
140
+ | `onClick` | `React.MouseEventHandler<HTMLButtonElement>` | | Activation callback receiving the button event. |
141
+ | `disabled` | `boolean` | `false` | Blocks activation while retaining keyboard focusability. |
142
+ | `loading` | `boolean` | `false` | Displays pending feedback and exposes `aria-busy` without blocking interaction. |
143
+ | `size` | `'small' \| 'medium'` | `'medium'` | Alternative sizes. |
144
+ | `loadingLabel` | `string` | `'Loading'` | Localized loading announcement. |
145
+ | `loadingLabelDelay` | `number` | `2000` | Announcement delay in milliseconds. |
146
+ | `spinnerPosition` | `'start' \| 'end'` | `'end'` | Indicator placement beside the switch when no visible FormControl label is available. |
147
+ | `hasStatusLabel` | `boolean` | `false` | Shows visible On/Off status text beside the track. |
148
+ | `statusLabelPosition` | `'start' \| 'end'` | `'start'` | Status text placement relative to the track. |
149
+ | `labels` | `{on?: string; off?: string}` | `On` / `Off` | Visible status text for each state. Custom text describes the switch when shown. |
150
+ | `aria-label` | `string` | | Explicit accessible name matching equivalent visible labeling. |
151
+ | `aria-labelledby` | `string` | | IDs of visible labeling elements. |
152
+ | `aria-describedby` | `string` | | Description IDs, combined with status, FormControl, and loading descriptions. |
153
+ | `aria-invalid` | React ARIA attribute | | Validation state of the switch button. |
154
+ | `ref` | `React.Ref<HTMLButtonElement>` | | Ref for the focusable button. |
155
+ | `className` | `string` | | Class applied to the component wrapper. |
156
+ | `data-testid` | `string` | | Test ID applied to the component wrapper. |
123
157
 
124
158
  Other standard button attributes, including `aria-controls`, `tabIndex`, keyboard handlers, and `style`, apply to the switch button.
125
159
 
package/docs/index.md CHANGED
@@ -1,6 +1,6 @@
1
- # Primer Brand docs (v0.81.0)
1
+ # Primer Brand docs (v0.81.1-rc.019987d3)
2
2
 
3
- These docs are bundled with `@primer/react-brand@0.81.0` and match your installed version.
3
+ These docs are bundled with `@primer/react-brand@0.81.1-rc.019987d3` and match your installed version.
4
4
 
5
5
  New here? Start with [Getting started](getting-started/index.md) for installation, global
6
6
  stylesheet and font setup. Component directories are named after their import (e.g.
@@ -1 +1 @@
1
- {"version":3,"file":"FormControl.d.ts","sourceRoot":"","sources":["../../../src/forms/FormControl/FormControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,iBAAiB,EAAC,MAAM,OAAO,CAAA;AAK9C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,yBAAyB,CAAA;AACtD,OAAO,KAAK,EAAC,oBAAoB,EAAE,cAAc,E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E,CAAA"}
@@ -17,10 +17,10 @@ import m from "react";
17
17
  import { jsx as h, jsxs as g } from "react/jsx-runtime";
18
18
  //#region src/forms/FormControl/FormControl.tsx
19
19
  var _ = ({ children: n, className: i, hasBorder: a, fullWidth: g, id: _, required: x, size: S = "medium", validationStatus: C, ...w }) => {
20
- let T = t(_), E = m.Children.toArray(n), D = E.some((e) => m.isValidElement(e) && (e.type === o || e.type === u)), O = E.find((e) => m.isValidElement(e) && e.type === f), k = !!O, A = [E.some((e) => m.isValidElement(e) && e.type === b) && `${T}-hint`, E.some((e) => m.isValidElement(e) && e.type === y) && `${T}-validation`].filter(Boolean).join(" ") || void 0;
20
+ let T = t(_), E = m.Children.toArray(n), D = E.some((e) => m.isValidElement(e) && (e.type === o || e.type === u)), O = E.find((e) => m.isValidElement(e) && e.type === f), k = !!O, A = !!O?.props.hasStatusLabel, j = [E.some((e) => m.isValidElement(e) && e.type === b) && `${T}-hint`, E.some((e) => m.isValidElement(e) && e.type === y) && `${T}-validation`].filter(Boolean).join(" ") || void 0;
21
21
  return /* @__PURE__ */ h("section", {
22
22
  id: `FormControl--${T}`,
23
- className: e(p.FormControl, g && p["FormControl--fullWidth"], D && p["FormControl--checkbox"], k && p["FormControl--toggle-switch"], a && p["FormControl--border"], i),
23
+ className: e(p.FormControl, g && p["FormControl--fullWidth"], D && p["FormControl--checkbox"], k && p["FormControl--toggle-switch"], A && p["FormControl--toggle-switch-with-status-label"], a && p["FormControl--border"], i),
24
24
  ...w,
25
25
  children: m.Children.map(n, (t) => {
26
26
  if (!m.isValidElement(t)) return t;
@@ -34,7 +34,7 @@ var _ = ({ children: n, className: i, hasBorder: a, fullWidth: g, id: _, require
34
34
  validationStatus: n.props.validationStatus || C,
35
35
  fullWidth: g,
36
36
  size: S,
37
- "aria-describedby": A
37
+ "aria-describedby": j
38
38
  });
39
39
  }
40
40
  if (t.type === s) {
@@ -47,7 +47,7 @@ var _ = ({ children: n, className: i, hasBorder: a, fullWidth: g, id: _, require
47
47
  validationStatus: n.props.validationStatus || C,
48
48
  fullWidth: g,
49
49
  size: S,
50
- "aria-describedby": A
50
+ "aria-describedby": j
51
51
  });
52
52
  }
53
53
  if (t.type === l) {
@@ -60,7 +60,7 @@ var _ = ({ children: n, className: i, hasBorder: a, fullWidth: g, id: _, require
60
60
  validationStatus: n.props.validationStatus || C,
61
61
  fullWidth: g,
62
62
  size: S,
63
- "aria-describedby": A
63
+ "aria-describedby": j
64
64
  });
65
65
  }
66
66
  if (t.type === o) {
@@ -71,7 +71,7 @@ var _ = ({ children: n, className: i, hasBorder: a, fullWidth: g, id: _, require
71
71
  name: n.props.name || T,
72
72
  required: n.props.required || x,
73
73
  validationStatus: n.props.validationStatus || C,
74
- "aria-describedby": A
74
+ "aria-describedby": j
75
75
  });
76
76
  }
77
77
  if (t.type === u) {
@@ -81,11 +81,11 @@ var _ = ({ children: n, className: i, hasBorder: a, fullWidth: g, id: _, require
81
81
  id: T,
82
82
  name: n.props.name,
83
83
  required: n.props.required || x,
84
- "aria-describedby": A
84
+ "aria-describedby": j
85
85
  });
86
86
  }
87
87
  if (t.type === f) {
88
- let n = t, r = [n.props["aria-describedby"], A].filter(Boolean).join(" ");
88
+ let n = t, r = [n.props["aria-describedby"], j].filter(Boolean).join(" ");
89
89
  return m.cloneElement(n, {
90
90
  className: e(p["FormControl-control--toggle-switch"], n.props.className),
91
91
  id: T,
@@ -1 +1 @@
1
- {"version":3,"file":"FormControl.js","names":[],"sources":["../../../src/forms/FormControl/FormControl.tsx"],"sourcesContent":["import React, {PropsWithChildren} from 'react'\nimport {useId} from '../../hooks/useId'\nimport {clsx} from 'clsx'\nimport {AlertFillIcon, CheckCircleFillIcon} from '@primer/octicons-react'\n\nimport type {BaseProps} from '../../component-helpers'\nimport type {FormValidationStatus, FormInputSizes} from '../'\n\nimport {Checkbox} from '../Checkbox'\nimport {Select} from '../Select'\nimport {TextInput} from '../TextInput'\nimport {Textarea} from '../Textarea'\nimport {Radio} from '../Radio'\nimport {ToggleSwitch} from '../ToggleSwitch'\nimport type {ToggleSwitchInternalProps} from '../ToggleSwitch/ToggleSwitch'\nimport {Spinner} from '../../Spinner/Spinner'\nimport {Text} from '../../Text'\n\nimport '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/components/control/colors-with-modes.css'\nimport styles from './FormControl.module.css'\nimport toggleSwitchStyles from '../ToggleSwitch/ToggleSwitch.module.css'\n\nexport type FormControlProps = BaseProps<HTMLElement> & {\n /**\n * Apply a decorative border to the form control.\n */\n hasBorder?: boolean\n /**\n * Applies full width styling.\n */\n fullWidth?: boolean\n /**\n * A unique identifier for the form control.\n * This is used to associate the form control with its associated label.\n * If an id is not provided, a unique id will be generated.\n */\n id?: string\n /**\n * Applies required styling to the label and input.\n */\n required?: boolean\n /**\n * Alternative sizes for inputs and labels.\n */\n size?: FormInputSizes\n /**\n * Provides contextual validation feedback to all children, showing relevant messaging where applicable.\n */\n validationStatus?: FormValidationStatus\n}\n\n/**\n * The Checkbox and the Radio components both use the trick of using a <label> to render the visual control,\n * and visually hiding the <input>. This means that, when you add a FormControl.Label alongside your\n * Checkbox/Radio, the <input> technically has two <label> elements associated with it.\n * That doesn't appear to be a problem (it's valid HTML and NVDA announces it correctly) but it does annoy\n * our Storybook Axe tests because they only seem to look at one of the labels.\n * To fix this, we recommend that the FormControl.Label always appears before the Checkbox/Radio in the DOM,\n * even though it visually appears after the Checkbox/Radio, as this keeps Storybook Axe happy.\n */\n\nconst Root = ({\n children,\n className,\n hasBorder,\n fullWidth,\n id,\n required,\n size = 'medium',\n validationStatus,\n ...rest\n}: PropsWithChildren<FormControlProps>) => {\n const uniqueId = useId(id)\n const childrenArr = React.Children.toArray(children)\n\n const isCheckboxOrRadio = childrenArr.some(\n child => React.isValidElement(child) && (child.type === Checkbox || child.type === Radio),\n )\n const toggleSwitchElement = childrenArr.find(child => React.isValidElement(child) && child.type === ToggleSwitch) as\n | React.ReactElement<ToggleSwitchInternalProps>\n | undefined\n const isToggleSwitch = Boolean(toggleSwitchElement)\n const describedBy =\n [\n childrenArr.some(child => React.isValidElement(child) && child.type === FormControlHint) && `${uniqueId}-hint`,\n childrenArr.some(child => React.isValidElement(child) && child.type === FormControlValidation) &&\n `${uniqueId}-validation`,\n ]\n .filter(Boolean)\n .join(' ') || undefined\n\n return (\n <section\n id={`FormControl--${uniqueId}`}\n className={clsx(\n styles.FormControl,\n fullWidth && styles[`FormControl--fullWidth`],\n isCheckboxOrRadio && styles['FormControl--checkbox'],\n isToggleSwitch && styles['FormControl--toggle-switch'],\n hasBorder && styles['FormControl--border'],\n className,\n )}\n {...rest}\n >\n {React.Children.map(children, child => {\n if (!React.isValidElement(child)) return child\n\n if (child.type === TextInput) {\n const element = child as React.ReactElement<React.ComponentProps<typeof TextInput>>\n return React.cloneElement(element, {\n className: clsx(element.props.className),\n id: uniqueId,\n name: element.props.name || uniqueId,\n required: element.props.required || required,\n validationStatus: element.props.validationStatus || validationStatus,\n fullWidth,\n size,\n 'aria-describedby': describedBy,\n })\n }\n\n if (child.type === Textarea) {\n const element = child as React.ReactElement<React.ComponentProps<typeof Textarea>>\n return React.cloneElement(element, {\n className: clsx(element.props.className),\n id: uniqueId,\n name: element.props.name || uniqueId,\n required: element.props.required || required,\n validationStatus: element.props.validationStatus || validationStatus,\n fullWidth,\n size,\n 'aria-describedby': describedBy,\n })\n }\n\n if (child.type === Select) {\n const element = child as React.ReactElement<React.ComponentProps<typeof Select>>\n return React.cloneElement(element, {\n className: clsx(element.props.className),\n id: uniqueId,\n name: element.props.name || uniqueId,\n required: element.props.required || required,\n validationStatus: element.props.validationStatus || validationStatus,\n fullWidth,\n size,\n 'aria-describedby': describedBy,\n })\n }\n\n if (child.type === Checkbox) {\n const element = child as React.ReactElement<React.ComponentProps<typeof Checkbox>>\n return React.cloneElement(element, {\n className: clsx(element.props.className, styles['FormControl-control--checkbox']),\n id: uniqueId,\n name: element.props.name || uniqueId,\n required: element.props.required || required,\n validationStatus: element.props.validationStatus || validationStatus,\n 'aria-describedby': describedBy,\n })\n }\n\n if (child.type === Radio) {\n const element = child as React.ReactElement<React.ComponentProps<typeof Radio>>\n return React.cloneElement(element, {\n className: clsx(isCheckboxOrRadio && styles['FormControl-control--radio'], element.props.className),\n id: uniqueId,\n name: element.props.name,\n required: element.props.required || required,\n 'aria-describedby': describedBy,\n })\n }\n\n if (child.type === ToggleSwitch) {\n const element = child as React.ReactElement<ToggleSwitchInternalProps>\n const descriptions = [element.props['aria-describedby'], describedBy].filter(Boolean).join(' ')\n return React.cloneElement(element, {\n className: clsx(styles['FormControl-control--toggle-switch'], element.props.className),\n id: uniqueId,\n toggleSwitchSpinnerInLabel: childrenArr.some(\n labelChild =>\n React.isValidElement<React.ComponentProps<typeof FormControlLabel>>(labelChild) &&\n labelChild.type === FormControlLabel &&\n !labelChild.props.visuallyHidden,\n ),\n 'aria-describedby': descriptions ? [...new Set(descriptions.split(/\\s+/))].join(' ') : undefined,\n 'aria-invalid': element.props['aria-invalid'] ?? (validationStatus === 'error' ? true : undefined),\n })\n }\n\n if (child.type === FormControlLabel) {\n const element = child as React.ReactElement<React.ComponentProps<typeof FormControlLabel>>\n return React.cloneElement(element, {\n className: clsx(\n isCheckboxOrRadio && styles['FormControl-label--checkbox'],\n isToggleSwitch && styles['FormControl-label--toggle-switch'],\n element.props.className,\n ),\n htmlFor: uniqueId,\n children:\n toggleSwitchElement?.props.loading && !element.props.visuallyHidden\n ? [\n ...React.Children.toArray(element.props.children),\n <span\n key=\"toggleSwitch-spinner\"\n aria-hidden=\"true\"\n className={styles['FormControl-toggleSwitch-spinnerSlot']}\n >\n <Spinner\n size=\"small\"\n accessibleLabel={null}\n className={toggleSwitchStyles['ToggleSwitch-spinner']}\n data-testid={ToggleSwitch.testIds.spinner}\n />\n </span>,\n ]\n : element.props.children,\n required: isToggleSwitch ? false : required,\n validationStatus,\n size,\n showRequiredIndicator: isCheckboxOrRadio ? false : element.props.showRequiredIndicator,\n })\n }\n\n if (child.type === FormControlValidation) {\n const element = child as React.ReactElement<React.ComponentProps<typeof FormControlValidation>>\n return React.cloneElement(element, {\n validationStatus,\n id: `${uniqueId}-validation`,\n })\n }\n\n if (child.type === FormControlHint) {\n const element = child as React.ReactElement<React.ComponentProps<typeof FormControlHint>>\n return React.cloneElement(element, {\n id: `${uniqueId}-hint`,\n })\n }\n\n return child\n })}\n </section>\n )\n}\n\ntype FormControlLabelProps = {\n htmlFor?: string\n required?: boolean\n showRequiredIndicator?: boolean\n size?: FormInputSizes\n validationStatus?: FormValidationStatus\n visuallyHidden?: boolean\n} & BaseProps<HTMLLabelElement>\n\nconst FormControlLabel = ({\n children,\n className,\n htmlFor,\n required,\n showRequiredIndicator = true,\n size = 'medium',\n validationStatus,\n visuallyHidden,\n ...rest\n}: PropsWithChildren<FormControlLabelProps>) => {\n return (\n <label\n htmlFor={htmlFor}\n className={clsx(\n styles['FormControl-label'],\n validationStatus && styles[`FormControl-label--${validationStatus}`],\n styles[`FormControl-label--${size}`],\n visuallyHidden && styles['FormControl-label--visually-hidden'],\n className,\n )}\n {...rest}\n >\n {React.Children.map(children, child => {\n if (React.isValidElement<FormControlHintProps>(child) && child.type === FormControlHint) {\n return React.cloneElement(child, {\n className: clsx(styles['FormControl--visible'], child.props.className),\n })\n }\n return child\n })}\n\n {required && showRequiredIndicator && (\n <span className={styles['FormControl-label-required']} aria-hidden>\n {' '}\n *\n </span>\n )}\n </label>\n )\n}\n\ntype FormControlValidationProps = {\n children: string\n validationStatus?: FormValidationStatus\n} & BaseProps<HTMLSpanElement>\n\nconst FormControlValidation = ({children, validationStatus, className, ...props}: FormControlValidationProps) => {\n return (\n <Text\n as=\"span\"\n size=\"100\"\n className={clsx(\n styles['FormControl-validation'],\n validationStatus && styles['FormControl-validation--animate-in'],\n validationStatus && styles[`FormControl-validation--${validationStatus}`],\n className,\n )}\n {...props}\n >\n {validationStatus === 'error' && (\n <span className={styles['FormControl-validation-error-icon']}>\n <AlertFillIcon />\n </span>\n )}\n {validationStatus === 'success' && (\n <span className={styles['FormControl-validation-success-icon']}>\n <CheckCircleFillIcon />\n </span>\n )}\n {children}\n </Text>\n )\n}\n\ntype FormControlHintProps = PropsWithChildren<BaseProps<HTMLSpanElement>>\n\nconst FormControlHint = ({className, ...rest}: FormControlHintProps) => {\n return <Text as=\"span\" size=\"100\" variant=\"muted\" className={clsx(styles['FormControl-hint'], className)} {...rest} />\n}\n\n/**\n * FormControl\n * {@link https://primer.style/brand/components/FormControl/ See usage examples}.\n */\nexport const FormControl = Object.assign(Root, {\n Label: FormControlLabel,\n Validation: FormControlValidation,\n Hint: FormControlHint,\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;AA6DA,IAAM,KAAQ,EACZ,aACA,cACA,cACA,cACA,OACA,aACA,UAAO,UACP,qBACA,GAAG,QACsC;CACzC,IAAM,IAAW,EAAM,CAAE,GACnB,IAAc,EAAM,SAAS,QAAQ,CAAQ,GAE7C,IAAoB,EAAY,MACpC,MAAS,EAAM,eAAe,CAAK,MAAM,EAAM,SAAS,KAAY,EAAM,SAAS,EACrF,GACM,IAAsB,EAAY,MAAK,MAAS,EAAM,eAAe,CAAK,KAAK,EAAM,SAAS,CAAY,GAG1G,IAAiB,EAAQ,GACzB,IACJ,CACE,EAAY,MAAK,MAAS,EAAM,eAAe,CAAK,KAAK,EAAM,SAAS,CAAe,KAAK,GAAG,EAAS,QACxG,EAAY,MAAK,MAAS,EAAM,eAAe,CAAK,KAAK,EAAM,SAAS,CAAqB,KAC3F,GAAG,EAAS,YAChB,CAAC,CACE,OAAO,OAAO,CAAC,CACf,KAAK,GAAG,KAAK,KAAA;CAElB,OACE,kBAAC,WAAD;EACE,IAAI,gBAAgB;EACpB,WAAW,EACT,EAAO,aACP,KAAa,EAAO,2BACpB,KAAqB,EAAO,0BAC5B,KAAkB,EAAO,+BACzB,KAAa,EAAO,wBACpB,CACF;EACA,GAAI;YAEH,EAAM,SAAS,IAAI,IAAU,MAAS;GACrC,IAAI,CAAC,EAAM,eAAe,CAAK,GAAG,OAAO;GAEz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AAA,GAO1G,IAAc,OAAO,OAAO,GAAM;CAC7C,OAAO;CACP,YAAY;CACZ,MAAM;AACR,CAAC"}
1
+ {"version":3,"file":"FormControl.js","names":[],"sources":["../../../src/forms/FormControl/FormControl.tsx"],"sourcesContent":["import React, {PropsWithChildren} from 'react'\nimport {useId} from '../../hooks/useId'\nimport {clsx} from 'clsx'\nimport {AlertFillIcon, CheckCircleFillIcon} from '@primer/octicons-react'\n\nimport type {BaseProps} from '../../component-helpers'\nimport type {FormValidationStatus, FormInputSizes} from '../'\n\nimport {Checkbox} from '../Checkbox'\nimport {Select} from '../Select'\nimport {TextInput} from '../TextInput'\nimport {Textarea} from '../Textarea'\nimport {Radio} from '../Radio'\nimport {ToggleSwitch} from '../ToggleSwitch'\nimport type {ToggleSwitchInternalProps} from '../ToggleSwitch/ToggleSwitch'\nimport {Spinner} from '../../Spinner/Spinner'\nimport {Text} from '../../Text'\n\nimport '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/components/control/colors-with-modes.css'\nimport styles from './FormControl.module.css'\nimport toggleSwitchStyles from '../ToggleSwitch/ToggleSwitch.module.css'\n\nexport type FormControlProps = BaseProps<HTMLElement> & {\n /**\n * Apply a decorative border to the form control.\n */\n hasBorder?: boolean\n /**\n * Applies full width styling.\n */\n fullWidth?: boolean\n /**\n * A unique identifier for the form control.\n * This is used to associate the form control with its associated label.\n * If an id is not provided, a unique id will be generated.\n */\n id?: string\n /**\n * Applies required styling to the label and input.\n */\n required?: boolean\n /**\n * Alternative sizes for inputs and labels.\n */\n size?: FormInputSizes\n /**\n * Provides contextual validation feedback to all children, showing relevant messaging where applicable.\n */\n validationStatus?: FormValidationStatus\n}\n\n/**\n * The Checkbox and the Radio components both use the trick of using a <label> to render the visual control,\n * and visually hiding the <input>. This means that, when you add a FormControl.Label alongside your\n * Checkbox/Radio, the <input> technically has two <label> elements associated with it.\n * That doesn't appear to be a problem (it's valid HTML and NVDA announces it correctly) but it does annoy\n * our Storybook Axe tests because they only seem to look at one of the labels.\n * To fix this, we recommend that the FormControl.Label always appears before the Checkbox/Radio in the DOM,\n * even though it visually appears after the Checkbox/Radio, as this keeps Storybook Axe happy.\n */\n\nconst Root = ({\n children,\n className,\n hasBorder,\n fullWidth,\n id,\n required,\n size = 'medium',\n validationStatus,\n ...rest\n}: PropsWithChildren<FormControlProps>) => {\n const uniqueId = useId(id)\n const childrenArr = React.Children.toArray(children)\n\n const isCheckboxOrRadio = childrenArr.some(\n child => React.isValidElement(child) && (child.type === Checkbox || child.type === Radio),\n )\n const toggleSwitchElement = childrenArr.find(child => React.isValidElement(child) && child.type === ToggleSwitch) as\n | React.ReactElement<ToggleSwitchInternalProps>\n | undefined\n const isToggleSwitch = Boolean(toggleSwitchElement)\n const hasToggleSwitchStatusLabel = Boolean(toggleSwitchElement?.props.hasStatusLabel)\n const describedBy =\n [\n childrenArr.some(child => React.isValidElement(child) && child.type === FormControlHint) && `${uniqueId}-hint`,\n childrenArr.some(child => React.isValidElement(child) && child.type === FormControlValidation) &&\n `${uniqueId}-validation`,\n ]\n .filter(Boolean)\n .join(' ') || undefined\n\n return (\n <section\n id={`FormControl--${uniqueId}`}\n className={clsx(\n styles.FormControl,\n fullWidth && styles[`FormControl--fullWidth`],\n isCheckboxOrRadio && styles['FormControl--checkbox'],\n isToggleSwitch && styles['FormControl--toggle-switch'],\n hasToggleSwitchStatusLabel && styles['FormControl--toggle-switch-with-status-label'],\n hasBorder && styles['FormControl--border'],\n className,\n )}\n {...rest}\n >\n {React.Children.map(children, child => {\n if (!React.isValidElement(child)) return child\n\n if (child.type === TextInput) {\n const element = child as React.ReactElement<React.ComponentProps<typeof TextInput>>\n return React.cloneElement(element, {\n className: clsx(element.props.className),\n id: uniqueId,\n name: element.props.name || uniqueId,\n required: element.props.required || required,\n validationStatus: element.props.validationStatus || validationStatus,\n fullWidth,\n size,\n 'aria-describedby': describedBy,\n })\n }\n\n if (child.type === Textarea) {\n const element = child as React.ReactElement<React.ComponentProps<typeof Textarea>>\n return React.cloneElement(element, {\n className: clsx(element.props.className),\n id: uniqueId,\n name: element.props.name || uniqueId,\n required: element.props.required || required,\n validationStatus: element.props.validationStatus || validationStatus,\n fullWidth,\n size,\n 'aria-describedby': describedBy,\n })\n }\n\n if (child.type === Select) {\n const element = child as React.ReactElement<React.ComponentProps<typeof Select>>\n return React.cloneElement(element, {\n className: clsx(element.props.className),\n id: uniqueId,\n name: element.props.name || uniqueId,\n required: element.props.required || required,\n validationStatus: element.props.validationStatus || validationStatus,\n fullWidth,\n size,\n 'aria-describedby': describedBy,\n })\n }\n\n if (child.type === Checkbox) {\n const element = child as React.ReactElement<React.ComponentProps<typeof Checkbox>>\n return React.cloneElement(element, {\n className: clsx(element.props.className, styles['FormControl-control--checkbox']),\n id: uniqueId,\n name: element.props.name || uniqueId,\n required: element.props.required || required,\n validationStatus: element.props.validationStatus || validationStatus,\n 'aria-describedby': describedBy,\n })\n }\n\n if (child.type === Radio) {\n const element = child as React.ReactElement<React.ComponentProps<typeof Radio>>\n return React.cloneElement(element, {\n className: clsx(isCheckboxOrRadio && styles['FormControl-control--radio'], element.props.className),\n id: uniqueId,\n name: element.props.name,\n required: element.props.required || required,\n 'aria-describedby': describedBy,\n })\n }\n\n if (child.type === ToggleSwitch) {\n const element = child as React.ReactElement<ToggleSwitchInternalProps>\n const descriptions = [element.props['aria-describedby'], describedBy].filter(Boolean).join(' ')\n return React.cloneElement(element, {\n className: clsx(styles['FormControl-control--toggle-switch'], element.props.className),\n id: uniqueId,\n toggleSwitchSpinnerInLabel: childrenArr.some(\n labelChild =>\n React.isValidElement<React.ComponentProps<typeof FormControlLabel>>(labelChild) &&\n labelChild.type === FormControlLabel &&\n !labelChild.props.visuallyHidden,\n ),\n 'aria-describedby': descriptions ? [...new Set(descriptions.split(/\\s+/))].join(' ') : undefined,\n 'aria-invalid': element.props['aria-invalid'] ?? (validationStatus === 'error' ? true : undefined),\n })\n }\n\n if (child.type === FormControlLabel) {\n const element = child as React.ReactElement<React.ComponentProps<typeof FormControlLabel>>\n return React.cloneElement(element, {\n className: clsx(\n isCheckboxOrRadio && styles['FormControl-label--checkbox'],\n isToggleSwitch && styles['FormControl-label--toggle-switch'],\n element.props.className,\n ),\n htmlFor: uniqueId,\n children:\n toggleSwitchElement?.props.loading && !element.props.visuallyHidden\n ? [\n ...React.Children.toArray(element.props.children),\n <span\n key=\"toggleSwitch-spinner\"\n aria-hidden=\"true\"\n className={styles['FormControl-toggleSwitch-spinnerSlot']}\n >\n <Spinner\n size=\"small\"\n accessibleLabel={null}\n className={toggleSwitchStyles['ToggleSwitch-spinner']}\n data-testid={ToggleSwitch.testIds.spinner}\n />\n </span>,\n ]\n : element.props.children,\n required: isToggleSwitch ? false : required,\n validationStatus,\n size,\n showRequiredIndicator: isCheckboxOrRadio ? false : element.props.showRequiredIndicator,\n })\n }\n\n if (child.type === FormControlValidation) {\n const element = child as React.ReactElement<React.ComponentProps<typeof FormControlValidation>>\n return React.cloneElement(element, {\n validationStatus,\n id: `${uniqueId}-validation`,\n })\n }\n\n if (child.type === FormControlHint) {\n const element = child as React.ReactElement<React.ComponentProps<typeof FormControlHint>>\n return React.cloneElement(element, {\n id: `${uniqueId}-hint`,\n })\n }\n\n return child\n })}\n </section>\n )\n}\n\ntype FormControlLabelProps = {\n htmlFor?: string\n required?: boolean\n showRequiredIndicator?: boolean\n size?: FormInputSizes\n validationStatus?: FormValidationStatus\n visuallyHidden?: boolean\n} & BaseProps<HTMLLabelElement>\n\nconst FormControlLabel = ({\n children,\n className,\n htmlFor,\n required,\n showRequiredIndicator = true,\n size = 'medium',\n validationStatus,\n visuallyHidden,\n ...rest\n}: PropsWithChildren<FormControlLabelProps>) => {\n return (\n <label\n htmlFor={htmlFor}\n className={clsx(\n styles['FormControl-label'],\n validationStatus && styles[`FormControl-label--${validationStatus}`],\n styles[`FormControl-label--${size}`],\n visuallyHidden && styles['FormControl-label--visually-hidden'],\n className,\n )}\n {...rest}\n >\n {React.Children.map(children, child => {\n if (React.isValidElement<FormControlHintProps>(child) && child.type === FormControlHint) {\n return React.cloneElement(child, {\n className: clsx(styles['FormControl--visible'], child.props.className),\n })\n }\n return child\n })}\n\n {required && showRequiredIndicator && (\n <span className={styles['FormControl-label-required']} aria-hidden>\n {' '}\n *\n </span>\n )}\n </label>\n )\n}\n\ntype FormControlValidationProps = {\n children: string\n validationStatus?: FormValidationStatus\n} & BaseProps<HTMLSpanElement>\n\nconst FormControlValidation = ({children, validationStatus, className, ...props}: FormControlValidationProps) => {\n return (\n <Text\n as=\"span\"\n size=\"100\"\n className={clsx(\n styles['FormControl-validation'],\n validationStatus && styles['FormControl-validation--animate-in'],\n validationStatus && styles[`FormControl-validation--${validationStatus}`],\n className,\n )}\n {...props}\n >\n {validationStatus === 'error' && (\n <span className={styles['FormControl-validation-error-icon']}>\n <AlertFillIcon />\n </span>\n )}\n {validationStatus === 'success' && (\n <span className={styles['FormControl-validation-success-icon']}>\n <CheckCircleFillIcon />\n </span>\n )}\n {children}\n </Text>\n )\n}\n\ntype FormControlHintProps = PropsWithChildren<BaseProps<HTMLSpanElement>>\n\nconst FormControlHint = ({className, ...rest}: FormControlHintProps) => {\n return <Text as=\"span\" size=\"100\" variant=\"muted\" className={clsx(styles['FormControl-hint'], className)} {...rest} />\n}\n\n/**\n * FormControl\n * {@link https://primer.style/brand/components/FormControl/ See usage examples}.\n */\nexport const FormControl = Object.assign(Root, {\n Label: FormControlLabel,\n Validation: FormControlValidation,\n Hint: FormControlHint,\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;AA6DA,IAAM,KAAQ,EACZ,aACA,cACA,cACA,cACA,OACA,aACA,UAAO,UACP,qBACA,GAAG,QACsC;CACzC,IAAM,IAAW,EAAM,CAAE,GACnB,IAAc,EAAM,SAAS,QAAQ,CAAQ,GAE7C,IAAoB,EAAY,MACpC,MAAS,EAAM,eAAe,CAAK,MAAM,EAAM,SAAS,KAAY,EAAM,SAAS,EACrF,GACM,IAAsB,EAAY,MAAK,MAAS,EAAM,eAAe,CAA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AAC,QAAD;EAAM,WAAW,EAAO;EAA+B,eAAA;YAAvD,CACG,KAAI,GAED;GAEH;IASL,KAAyB,EAAC,aAAU,qBAAkB,cAAW,GAAG,QAEtE,kBAAC,GAAD;CACE,IAAG;CACH,MAAK;CACL,WAAW,EACT,EAAO,2BACP,KAAoB,EAAO,uCAC3B,KAAoB,EAAO,2BAA2B,MACtD,CACF;CACA,GAAI;WATN;EAWG,MAAqB,WACpB,kBAAC,QAAD;GAAM,WAAW,EAAO;aACtB,kBAAC,GAAD,CAAgB,CAAA;EACZ,CAAA;EAEP,MAAqB,aACpB,kBAAC,QAAD;GAAM,WAAW,EAAO;aACtB,kBAAC,GAAD,CAAsB,CAAA;EAClB,CAAA;EAEP;CACG;IAMJ,KAAmB,EAAC,cAAW,GAAG,QAC/B,kBAAC,GAAD;CAAM,IAAG;CAAO,MAAK;CAAM,SAAQ;CAAQ,WAAW,EAAK,EAAO,qBAAqB,CAAS;CAAG,GAAI;AAAO,CAAA,GAO1G,IAAc,OAAO,OAAO,GAAM;CAC7C,OAAO;CACP,YAAY;CACZ,MAAM;AACR,CAAC"}
@@ -0,0 +1 @@
1
+ .Primer_Brand__FormControl-module__FormControl___xyCI6{font-family:var(--brand-body-fontFamily);gap:var(--base-size-8);flex-direction:column;display:inline-flex}.Primer_Brand__FormControl-module__FormControl--fullWidth____kgvY{width:100%}.Primer_Brand__FormControl-module__FormControl--checkbox___bF4ig{grid-template-columns:auto 1fr;display:grid}.Primer_Brand__FormControl-module__FormControl--toggle-switch___HomKh{grid-column-gap:var(--brand-ToggleSwitch-label-gap);-moz-column-gap:var(--brand-ToggleSwitch-label-gap);column-gap:var(--brand-ToggleSwitch-label-gap);grid-template-columns:auto minmax(0,1fr);align-items:center;display:grid}.Primer_Brand__FormControl-module__FormControl-control--toggle-switch___pwbrT{grid-area:1/1;align-self:start}.Primer_Brand__FormControl-module__FormControl-label--toggle-switch____nCka{cursor:pointer;word-wrap:anywhere;grid-area:1/2;min-width:0}.Primer_Brand__FormControl-module__FormControl--toggle-switch-with-status-label___dZbot{flex-flow:row-reverse wrap;justify-content:flex-end;display:flex}.Primer_Brand__FormControl-module__FormControl--toggle-switch-with-status-label___dZbot .Primer_Brand__FormControl-module__FormControl-label--toggle-switch____nCka:not(.Primer_Brand__FormControl-module__FormControl-label--visually-hidden___1ZVMo){min-inline-size:min(100%, var(--base-size-96));flex:1 1 0;order:0}.Primer_Brand__FormControl-module__FormControl--toggle-switch-with-status-label___dZbot .Primer_Brand__FormControl-module__FormControl-control--toggle-switch___pwbrT{flex:0 auto;order:1;min-inline-size:0;max-inline-size:100%}.Primer_Brand__FormControl-module__FormControl--toggle-switch-with-status-label___dZbot .Primer_Brand__FormControl-module__FormControl-hint___DmKlt,.Primer_Brand__FormControl-module__FormControl--toggle-switch-with-status-label___dZbot .Primer_Brand__FormControl-module__FormControl-validation___GOPld{flex-basis:100%;order:2}.Primer_Brand__FormControl-module__FormControl-label--medium___bj84g.Primer_Brand__FormControl-module__FormControl-label--toggle-switch____nCka{font-size:var(--brand-ToggleSwitch-label-fontSize);line-height:max(var(--brand-ToggleSwitch-label-lineHeight), var(--brand-ToggleSwitch-target-minHeight))}.Primer_Brand__FormControl-module__FormControl-toggleSwitch-spinnerSlot___WwrPk{width:var(--brand-ToggleSwitch-loading-size);height:var(--brand-ToggleSwitch-loading-size);vertical-align:middle;pointer-events:none;justify-content:center;align-items:center;margin-inline-start:var(--brand-ToggleSwitch-loading-gap);display:inline-flex}.Primer_Brand__FormControl-module__FormControl--border___JkgNP{border:1px solid var(--brand-control-color-border-default);border-radius:var(--brand-borderRadius-medium);padding:var(--base-size-12)}.Primer_Brand__FormControl-module__FormControl-label____oJE0{color:var(--brand-color-text-default);font-weight:var(--base-text-weight-medium);font-family:var(--brand-body-fontFamily)}.Primer_Brand__FormControl-module__FormControl-label--visually-hidden___1ZVMo{clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.Primer_Brand__FormControl-module__FormControl-label--medium___bj84g{letter-spacing:var(--brand-text-letterSpacing-100);font-size:var(--brand-text-size-100);line-height:var(--brand-text-lineHeight-100)}.Primer_Brand__FormControl-module__FormControl-label--large___o1TMW{letter-spacing:var(--brand-text-letterSpacing-300);font-size:var(--brand-text-size-300);line-height:var(--brand-text-lineHeight-300)}.Primer_Brand__FormControl-module__FormControl-label--checkbox___xZxFK{cursor:pointer;font-size:var(--brand-text-size-100);font-weight:var(--base-text-weight-medium);line-height:var(--base-size-24);width:100%;position:relative;top:1px}.Primer_Brand__FormControl-module__FormControl-control--radio___ml5zt{margin:2px 0 0}.Primer_Brand__FormControl-module__FormControl-hint___DmKlt{grid-column:1/3;display:block}.Primer_Brand__FormControl-module__FormControl-validation___GOPld{gap:var(--base-size-4);grid-column:1/3;align-items:center;display:flex}.Primer_Brand__FormControl-module__FormControl-validation--success___kOKNY{color:var(--brand-color-success-fg)}.Primer_Brand__FormControl-module__FormControl-validation--error___T5KVh{color:var(--brand-control-color-validation-error)}.Primer_Brand__FormControl-module__FormControl-validation-success-icon___zPbVN,.Primer_Brand__FormControl-module__FormControl-validation-error-icon___hijkD{display:flex}.Primer_Brand__FormControl-module__FormControl-validation--animate-in___bQToQ{animation:.17s cubic-bezier(.44,.74,.36,1) Primer_Brand__FormControl-module__FormControlValidationFadeIn___tj0TP}@media screen and (width<=47.99rem){.Primer_Brand__FormControl-module__FormControl--toggle-switch-with-status-label___dZbot{flex-direction:column;align-items:stretch}.Primer_Brand__FormControl-module__FormControl--toggle-switch-with-status-label___dZbot .Primer_Brand__FormControl-module__FormControl-label--toggle-switch____nCka:not(.Primer_Brand__FormControl-module__FormControl-label--visually-hidden___1ZVMo){flex:initial;min-inline-size:0}.Primer_Brand__FormControl-module__FormControl--toggle-switch-with-status-label___dZbot .Primer_Brand__FormControl-module__FormControl-control--toggle-switch___pwbrT,.Primer_Brand__FormControl-module__FormControl--toggle-switch-with-status-label___dZbot .Primer_Brand__FormControl-module__FormControl-hint___DmKlt,.Primer_Brand__FormControl-module__FormControl--toggle-switch-with-status-label___dZbot .Primer_Brand__FormControl-module__FormControl-validation___GOPld{flex:initial}}@keyframes Primer_Brand__FormControl-module__FormControlValidationFadeIn___tj0TP{0%{opacity:0;transform:translateY(-100%)}to{opacity:1;transform:translateY(0)}}
@@ -1,4 +1,4 @@
1
- import './FormControl.module-NDvIk_Aq.css';//#region src/forms/FormControl/FormControl.module.css
1
+ import './FormControl.module-B7McDwHm.css';//#region src/forms/FormControl/FormControl.module.css
2
2
  var e = "Primer_Brand__FormControl-module__FormControl___xyCI6", t = "Primer_Brand__FormControl-module__FormControlValidationFadeIn___tj0TP", n = {
3
3
  FormControl: e,
4
4
  "FormControl--fullWidth": "Primer_Brand__FormControl-module__FormControl--fullWidth____kgvY",
@@ -6,16 +6,17 @@ var e = "Primer_Brand__FormControl-module__FormControl___xyCI6", t = "Primer_Bra
6
6
  "FormControl--toggle-switch": "Primer_Brand__FormControl-module__FormControl--toggle-switch___HomKh",
7
7
  "FormControl-control--toggle-switch": "Primer_Brand__FormControl-module__FormControl-control--toggle-switch___pwbrT",
8
8
  "FormControl-label--toggle-switch": "Primer_Brand__FormControl-module__FormControl-label--toggle-switch____nCka",
9
+ "FormControl--toggle-switch-with-status-label": "Primer_Brand__FormControl-module__FormControl--toggle-switch-with-status-label___dZbot",
10
+ "FormControl-label--visually-hidden": "Primer_Brand__FormControl-module__FormControl-label--visually-hidden___1ZVMo",
11
+ "FormControl-hint": "Primer_Brand__FormControl-module__FormControl-hint___DmKlt",
12
+ "FormControl-validation": "Primer_Brand__FormControl-module__FormControl-validation___GOPld",
9
13
  "FormControl-label--medium": "Primer_Brand__FormControl-module__FormControl-label--medium___bj84g",
10
14
  "FormControl-toggleSwitch-spinnerSlot": "Primer_Brand__FormControl-module__FormControl-toggleSwitch-spinnerSlot___WwrPk",
11
15
  "FormControl--border": "Primer_Brand__FormControl-module__FormControl--border___JkgNP",
12
16
  "FormControl-label": "Primer_Brand__FormControl-module__FormControl-label____oJE0",
13
- "FormControl-label--visually-hidden": "Primer_Brand__FormControl-module__FormControl-label--visually-hidden___1ZVMo",
14
17
  "FormControl-label--large": "Primer_Brand__FormControl-module__FormControl-label--large___o1TMW",
15
18
  "FormControl-label--checkbox": "Primer_Brand__FormControl-module__FormControl-label--checkbox___xZxFK",
16
19
  "FormControl-control--radio": "Primer_Brand__FormControl-module__FormControl-control--radio___ml5zt",
17
- "FormControl-hint": "Primer_Brand__FormControl-module__FormControl-hint___DmKlt",
18
- "FormControl-validation": "Primer_Brand__FormControl-module__FormControl-validation___GOPld",
19
20
  "FormControl-validation--success": "Primer_Brand__FormControl-module__FormControl-validation--success___kOKNY",
20
21
  "FormControl-validation--error": "Primer_Brand__FormControl-module__FormControl-validation--error___T5KVh",
21
22
  "FormControl-validation-success-icon": "Primer_Brand__FormControl-module__FormControl-validation-success-icon___zPbVN",
@@ -1 +1 @@
1
- {"version":3,"file":"FormControl.module.js","names":[],"sources":["../../../src/forms/FormControl/FormControl.module.css"],"sourcesContent":[".FormControl {\n display: inline-flex;\n font-family: var(--brand-body-fontFamily);\n flex-direction: column;\n gap: var(--base-size-8);\n}\n\n.FormControl--fullWidth {\n width: 100%;\n}\n\n.FormControl--checkbox {\n display: grid;\n grid-template-columns: auto 1fr;\n}\n\n.FormControl--toggle-switch {\n display: grid;\n grid-template-columns: auto minmax(0, 1fr);\n column-gap: var(--brand-ToggleSwitch-label-gap);\n align-items: center;\n}\n\n.FormControl-control--toggle-switch {\n grid-column: 1;\n grid-row: 1;\n align-self: start;\n}\n\n.FormControl-label--toggle-switch {\n grid-column: 2;\n grid-row: 1;\n min-width: 0;\n cursor: pointer;\n overflow-wrap: anywhere;\n}\n\n.FormControl-label--medium.FormControl-label--toggle-switch {\n font-size: var(--brand-ToggleSwitch-label-fontSize);\n line-height: max(var(--brand-ToggleSwitch-label-lineHeight), var(--brand-ToggleSwitch-target-minHeight));\n}\n\n.FormControl-toggleSwitch-spinnerSlot {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: var(--brand-ToggleSwitch-loading-size);\n height: var(--brand-ToggleSwitch-loading-size);\n margin-inline-start: var(--brand-ToggleSwitch-loading-gap);\n vertical-align: middle;\n pointer-events: none;\n}\n\n.FormControl--border {\n border: 1px solid var(--brand-control-color-border-default);\n border-radius: var(--brand-borderRadius-medium);\n padding: var(--base-size-12);\n}\n\n.FormControl-label {\n color: var(--brand-color-text-default);\n font-weight: var(--base-text-weight-medium);\n font-family: var(--brand-body-fontFamily);\n}\n\n.FormControl-label--visually-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n.FormControl-label--medium {\n letter-spacing: var(--brand-text-letterSpacing-100);\n font-size: var(--brand-text-size-100);\n line-height: var(--brand-text-lineHeight-100);\n}\n\n.FormControl-label--large {\n letter-spacing: var(--brand-text-letterSpacing-300);\n font-size: var(--brand-text-size-300);\n line-height: var(--brand-text-lineHeight-300);\n}\n\n.FormControl-label--checkbox {\n cursor: pointer;\n font-size: var(--brand-text-size-100);\n font-weight: var(--base-text-weight-medium);\n line-height: var(--base-size-24);\n width: 100%;\n position: relative;\n top: 1px;\n}\n\n.FormControl-control--radio {\n margin: 2px 0 0;\n}\n\n.FormControl-hint {\n grid-column: 1 / 3;\n display: block;\n}\n\n/*Validation*/\n.FormControl-validation {\n grid-column: 1 / 3;\n display: flex;\n gap: var(--base-size-4);\n align-items: center;\n}\n\n.FormControl-validation--success {\n color: var(--brand-color-success-fg);\n}\n\n.FormControl-validation--error {\n color: var(--brand-control-color-validation-error);\n}\n\n.FormControl-validation-success-icon {\n display: flex;\n}\n\n.FormControl-validation-error-icon {\n display: flex;\n}\n\n.FormControl-validation--animate-in {\n animation: 170ms FormControlValidationFadeIn cubic-bezier(0.44, 0.74, 0.36, 1);\n}\n\n@keyframes FormControlValidationFadeIn {\n 0% {\n opacity: 0;\n transform: translateY(-100%);\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n}\n"],"mappings":""}
1
+ {"version":3,"file":"FormControl.module.js","names":[],"sources":["../../../src/forms/FormControl/FormControl.module.css"],"sourcesContent":[".FormControl {\n display: inline-flex;\n font-family: var(--brand-body-fontFamily);\n flex-direction: column;\n gap: var(--base-size-8);\n}\n\n.FormControl--fullWidth {\n width: 100%;\n}\n\n.FormControl--checkbox {\n display: grid;\n grid-template-columns: auto 1fr;\n}\n\n.FormControl--toggle-switch {\n display: grid;\n grid-template-columns: auto minmax(0, 1fr);\n column-gap: var(--brand-ToggleSwitch-label-gap);\n align-items: center;\n}\n\n.FormControl-control--toggle-switch {\n grid-column: 1;\n grid-row: 1;\n align-self: start;\n}\n\n.FormControl-label--toggle-switch {\n grid-column: 2;\n grid-row: 1;\n min-width: 0;\n cursor: pointer;\n overflow-wrap: anywhere;\n}\n\n.FormControl--toggle-switch-with-status-label {\n display: flex;\n flex-flow: row-reverse wrap;\n justify-content: flex-end;\n}\n\n.FormControl--toggle-switch-with-status-label\n .FormControl-label--toggle-switch:not(.FormControl-label--visually-hidden) {\n flex: 1 1 0;\n min-inline-size: min(100%, var(--base-size-96));\n order: 0;\n}\n\n.FormControl--toggle-switch-with-status-label .FormControl-control--toggle-switch {\n flex: 0 1 auto;\n min-inline-size: 0;\n max-inline-size: 100%;\n order: 1;\n}\n\n.FormControl--toggle-switch-with-status-label .FormControl-hint,\n.FormControl--toggle-switch-with-status-label .FormControl-validation {\n flex-basis: 100%;\n order: 2;\n}\n\n.FormControl-label--medium.FormControl-label--toggle-switch {\n font-size: var(--brand-ToggleSwitch-label-fontSize);\n line-height: max(var(--brand-ToggleSwitch-label-lineHeight), var(--brand-ToggleSwitch-target-minHeight));\n}\n\n.FormControl-toggleSwitch-spinnerSlot {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: var(--brand-ToggleSwitch-loading-size);\n height: var(--brand-ToggleSwitch-loading-size);\n margin-inline-start: var(--brand-ToggleSwitch-loading-gap);\n vertical-align: middle;\n pointer-events: none;\n}\n\n.FormControl--border {\n border: 1px solid var(--brand-control-color-border-default);\n border-radius: var(--brand-borderRadius-medium);\n padding: var(--base-size-12);\n}\n\n.FormControl-label {\n color: var(--brand-color-text-default);\n font-weight: var(--base-text-weight-medium);\n font-family: var(--brand-body-fontFamily);\n}\n\n.FormControl-label--visually-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n.FormControl-label--medium {\n letter-spacing: var(--brand-text-letterSpacing-100);\n font-size: var(--brand-text-size-100);\n line-height: var(--brand-text-lineHeight-100);\n}\n\n.FormControl-label--large {\n letter-spacing: var(--brand-text-letterSpacing-300);\n font-size: var(--brand-text-size-300);\n line-height: var(--brand-text-lineHeight-300);\n}\n\n.FormControl-label--checkbox {\n cursor: pointer;\n font-size: var(--brand-text-size-100);\n font-weight: var(--base-text-weight-medium);\n line-height: var(--base-size-24);\n width: 100%;\n position: relative;\n top: 1px;\n}\n\n.FormControl-control--radio {\n margin: 2px 0 0;\n}\n\n.FormControl-hint {\n grid-column: 1 / 3;\n display: block;\n}\n\n/*Validation*/\n.FormControl-validation {\n grid-column: 1 / 3;\n display: flex;\n gap: var(--base-size-4);\n align-items: center;\n}\n\n.FormControl-validation--success {\n color: var(--brand-color-success-fg);\n}\n\n.FormControl-validation--error {\n color: var(--brand-control-color-validation-error);\n}\n\n.FormControl-validation-success-icon {\n display: flex;\n}\n\n.FormControl-validation-error-icon {\n display: flex;\n}\n\n.FormControl-validation--animate-in {\n animation: 170ms FormControlValidationFadeIn cubic-bezier(0.44, 0.74, 0.36, 1);\n}\n\n@media screen and (max-width: 47.99rem) {\n .FormControl--toggle-switch-with-status-label {\n flex-direction: column;\n align-items: stretch;\n }\n\n .FormControl--toggle-switch-with-status-label\n .FormControl-label--toggle-switch:not(.FormControl-label--visually-hidden) {\n flex: initial;\n min-inline-size: 0;\n }\n\n .FormControl--toggle-switch-with-status-label .FormControl-control--toggle-switch {\n flex: initial;\n }\n\n .FormControl--toggle-switch-with-status-label .FormControl-hint,\n .FormControl--toggle-switch-with-status-label .FormControl-validation {\n flex: initial;\n }\n}\n\n@keyframes FormControlValidationFadeIn {\n 0% {\n opacity: 0;\n transform: translateY(-100%);\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n}\n"],"mappings":""}
@@ -3,6 +3,11 @@ import '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/compone
3
3
  import '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/components/toggle-switch/colors-with-modes.css';
4
4
  type ToggleSwitchSize = 'small' | 'medium';
5
5
  type ToggleSwitchSpinnerPosition = 'start' | 'end';
6
+ type ToggleSwitchStatusLabelPosition = 'start' | 'end';
7
+ type ToggleSwitchLabels = {
8
+ on?: string;
9
+ off?: string;
10
+ };
6
11
  type ToggleSwitchButtonPropKeysToOmit = 'aria-busy' | 'aria-checked' | 'aria-disabled' | 'children' | 'onChange' | 'role' | 'type';
7
12
  export type ToggleSwitchProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, ToggleSwitchButtonPropKeysToOmit> & {
8
13
  'data-testid'?: string;
@@ -14,6 +19,9 @@ export type ToggleSwitchProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, To
14
19
  loadingLabel?: string;
15
20
  loadingLabelDelay?: number;
16
21
  spinnerPosition?: ToggleSwitchSpinnerPosition;
22
+ hasStatusLabel?: boolean;
23
+ statusLabelPosition?: ToggleSwitchStatusLabelPosition;
24
+ labels?: ToggleSwitchLabels;
17
25
  };
18
26
  export type ToggleSwitchInternalProps = ToggleSwitchProps & {
19
27
  toggleSwitchSpinnerInLabel?: boolean;
@@ -28,6 +36,8 @@ export declare const ToggleSwitch: ToggleSwitchComponent & {
28
36
  root: string;
29
37
  spinner: string;
30
38
  loadingAnnouncement: string;
39
+ statusAnnouncement: string;
40
+ statusLabel: string;
31
41
  };
32
42
  };
33
43
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"ToggleSwitch.d.ts","sourceRoot":"","sources":["../../../src/forms/ToggleSwitch/ToggleSwitch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAkC,KAAK,oBAAoB,EAAyB,MAAM,OAAO,CAAA;AAK/G,OAAO,oGAAoG,CAAA;AAC3G,OAAO,iHAAiH,CAAA;AAGxH,KAAK,gBAAgB,GAAG,OAAO,GAAG,QAAQ,CAAA;AAC1C,KAAK,2BAA2B,GAAG,OAAO,GAAG,KAAK,CAAA;AAElD,KAAK,gCAAgC,GACjC,WAAW,GACX,cAAc,GACd,eAAe,GACf,UAAU,GACV,UAAU,GACV,MAAM,GACN,MAAM,CAAA;AAEV,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,gCAAgC,CAAC,GAAG;IAChH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,CAAC,EAAE,gBAAgB,CAAA;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,eAAe,CAAC,EAAE,2BAA2B,CAAA;CAC9C,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,GAAG;IAC1D,0BAA0B,CAAC,EAAE,OAAO,CAAA;CACrC,CAAA;AAQD,KAAK,qBAAqB,GAAG,KAAK,CAAC,yBAAyB,CAAC,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC,CAAA;AAqHxH;;;GAGG;AACH,eAAO,MAAM,YAAY;;;;;;CAAiC,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B,GAAG;IAC1D,0BAA0B,CAAC,EAAE,OAAO,CAAA;CACrC,CAAA;AAUD,KAAK,qBAAqB,GAAG,KAAK,CAAC,yBAAyB,CAAC,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC,CAAA;AA2MxH;;;GAGG;AACH,eAAO,MAAM,YAAY;;;;;;;;CAAiC,CAAA"}
@@ -1,81 +1,130 @@
1
1
  import { clsx as e } from "../../node_modules/clsx/dist/clsx.js";
2
2
  import { useId as t } from "../../hooks/useId.js";
3
- import { Spinner as n } from "../../Spinner/Spinner.js";
4
- import '../../packages/design-tokens/lib/design-tokens/css/tokens/functional/components/toggle-switch/colors-with-modes-Byi9AmE8.css';import '../../packages/design-tokens/lib/design-tokens/css/tokens/functional/components/toggle-switch/base-CWVI8qLT.css';/* empty css */
3
+ import { Text as n } from "../../Text/Text.js";
4
+ import { Spinner as r } from "../../Spinner/Spinner.js";
5
+ import '../../packages/design-tokens/lib/design-tokens/css/tokens/functional/components/toggle-switch/colors-with-modes-QUNsZVCZ.css';import '../../packages/design-tokens/lib/design-tokens/css/tokens/functional/components/toggle-switch/base-CWVI8qLT.css';/* empty css */
5
6
  /* empty css */
6
- import r from "./ToggleSwitch.module.js";
7
- import { forwardRef as i, useEffect as a, useState as o } from "react";
8
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
7
+ import i from "./ToggleSwitch.module.js";
8
+ import { forwardRef as a, useEffect as o, useRef as s, useState as c } from "react";
9
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
9
10
  //#region src/forms/ToggleSwitch/ToggleSwitch.tsx
10
- var l = {
11
+ var d = {
11
12
  root: "ToggleSwitch",
12
13
  spinner: "ToggleSwitch-spinner",
13
- loadingAnnouncement: "ToggleSwitch-loading-announcement"
14
- }, u = i(function({ checked: i, defaultChecked: u = !1, onChange: d, onClick: f, disabled: p = !1, loading: m = !1, size: h = "medium", loadingLabel: g = "Loading", loadingLabelDelay: _ = 2e3, spinnerPosition: v = "end", toggleSwitchSpinnerInLabel: y = !1, id: b, className: x, "aria-label": S, "aria-labelledby": C, "aria-describedby": w, "aria-invalid": T, "data-testid": E, ...D }, O) {
15
- let k = t(b), A = `${k}-loading`, [j, M] = o(u), [N, P] = o(!1), F = i ?? j;
16
- a(() => {
17
- if (P(!1), !m) return;
18
- let e = setTimeout(() => P(!0), Math.max(0, _));
14
+ loadingAnnouncement: "ToggleSwitch-loading-announcement",
15
+ statusAnnouncement: "ToggleSwitch-status-announcement",
16
+ statusLabel: "ToggleSwitch-status-label"
17
+ }, f = a(function({ checked: a, defaultChecked: f = !1, onChange: p, onClick: m, disabled: h = !1, loading: g = !1, size: _ = "medium", loadingLabel: v = "Loading", loadingLabelDelay: y = 2e3, spinnerPosition: b = "end", hasStatusLabel: x = !1, statusLabelPosition: S = "start", labels: { on: C = "On", off: w = "Off" } = {}, toggleSwitchSpinnerInLabel: T = !1, id: E, className: D, "aria-label": O, "aria-labelledby": k, "aria-describedby": A, "aria-invalid": j, "data-testid": M, ...ee }, te) {
18
+ let N = t(E), P = t(), F = `${N}-loading`, [I, L] = c(f), [R, z] = c(!1), [B, V] = c(""), [H, U] = c(null), W = a ?? I, G = W ? C : w, K = W ? "On" : "Off", q = C !== "On" || w !== "Off", J = x && G !== K, Y = s(W);
19
+ o(() => {
20
+ let e = Y.current !== W;
21
+ Y.current = W, V(e ? H === W && J ? G : "" : (e) => J && e === G ? e : ""), H !== null && U(null);
22
+ }, [
23
+ G,
24
+ J,
25
+ W,
26
+ H
27
+ ]), o(() => {
28
+ if (z(!1), !g) return;
29
+ let e = setTimeout(() => z(!0), Math.max(0, y));
19
30
  return () => clearTimeout(e);
20
- }, [m, _]);
21
- let I = [w, m && N && g && A].filter(Boolean).join(" ") || void 0, L = (e) => {
22
- if (p) {
31
+ }, [g, y]);
32
+ let X = [
33
+ J && P,
34
+ A,
35
+ g && R && v && F
36
+ ].filter(Boolean).join(" ") || void 0, Z = (e) => {
37
+ if (h) {
23
38
  e.preventDefault(), e.stopPropagation();
24
39
  return;
25
40
  }
26
- if (f?.(e), e.defaultPrevented) return;
27
- let t = !F;
28
- i === void 0 && M(t), d?.(t);
29
- }, R = !y && m ? /* @__PURE__ */ s("span", {
30
- className: r["ToggleSwitch-spinnerSlot"],
41
+ if (m?.(e), e.defaultPrevented) return;
42
+ let t = !W;
43
+ x && q && U(t), a === void 0 && L(t), p?.(t);
44
+ }, Q = !T && g ? /* @__PURE__ */ l("span", {
45
+ className: i["ToggleSwitch-spinnerSlot"],
31
46
  "aria-hidden": "true",
32
- children: /* @__PURE__ */ s(n, {
47
+ children: /* @__PURE__ */ l(r, {
33
48
  size: "small",
34
49
  accessibleLabel: null,
35
- className: r["ToggleSwitch-spinner"],
36
- "data-testid": l.spinner
50
+ className: i["ToggleSwitch-spinner"],
51
+ "data-testid": d.spinner
37
52
  })
53
+ }) : null, $ = x ? /* @__PURE__ */ u("span", {
54
+ className: e(i["ToggleSwitch-statusLabel"], i[`ToggleSwitch-statusLabel--${S}`]),
55
+ "aria-hidden": "true",
56
+ "data-testid": d.statusLabel,
57
+ children: [/* @__PURE__ */ l(n, {
58
+ as: "span",
59
+ size: "100",
60
+ variant: "muted",
61
+ className: e(i["ToggleSwitch-statusLabelText"], !W && i["ToggleSwitch-statusLabelText--hidden"]),
62
+ children: C
63
+ }), /* @__PURE__ */ l(n, {
64
+ as: "span",
65
+ size: "100",
66
+ variant: "muted",
67
+ className: e(i["ToggleSwitch-statusLabelText"], W && i["ToggleSwitch-statusLabelText--hidden"]),
68
+ children: w
69
+ })]
38
70
  }) : null;
39
- return /* @__PURE__ */ c("div", {
40
- className: e(r.ToggleSwitch, r[`ToggleSwitch--${h}`], x),
41
- "data-testid": E || l.root,
71
+ return /* @__PURE__ */ u("div", {
72
+ className: e(i.ToggleSwitch, i[`ToggleSwitch--${_}`], x && i["ToggleSwitch--withStatusLabel"], D),
73
+ "data-testid": M || d.root,
42
74
  children: [
43
- v === "start" && R,
44
- /* @__PURE__ */ s("button", {
45
- ...D,
46
- id: k,
47
- ref: O,
75
+ b === "start" && Q,
76
+ /* @__PURE__ */ u("button", {
77
+ ...ee,
78
+ id: N,
79
+ ref: te,
48
80
  type: "button",
49
81
  role: "switch",
50
- "aria-checked": F,
51
- "aria-disabled": p || void 0,
52
- "aria-busy": m || void 0,
53
- "aria-label": S,
54
- "aria-labelledby": C,
55
- "aria-describedby": I,
56
- "aria-invalid": T,
57
- className: e(r["ToggleSwitch-button"], p && r["ToggleSwitch-button--unavailable"]),
58
- onClick: L,
59
- children: /* @__PURE__ */ s("span", {
60
- className: r["ToggleSwitch-track"],
61
- "aria-hidden": "true",
62
- children: /* @__PURE__ */ s("span", { className: e(r["ToggleSwitch-thumb"], F && r["ToggleSwitch-thumb--checked"], p && r["ToggleSwitch-thumb--disabled"]) })
63
- })
82
+ "aria-checked": W,
83
+ "aria-disabled": h || void 0,
84
+ "aria-busy": g || void 0,
85
+ "aria-label": O,
86
+ "aria-labelledby": k,
87
+ "aria-describedby": X,
88
+ "aria-invalid": j,
89
+ className: e(i["ToggleSwitch-button"], h && i["ToggleSwitch-button--unavailable"]),
90
+ onClick: Z,
91
+ children: [
92
+ S === "start" && $,
93
+ /* @__PURE__ */ l("span", {
94
+ className: i["ToggleSwitch-track"],
95
+ "aria-hidden": "true",
96
+ children: /* @__PURE__ */ l("span", { className: e(i["ToggleSwitch-thumb"], W && i["ToggleSwitch-thumb--checked"], h && i["ToggleSwitch-thumb--disabled"]) })
97
+ }),
98
+ S === "end" && $
99
+ ]
64
100
  }),
65
- v === "end" && R,
66
- /* @__PURE__ */ s("span", {
67
- id: A,
101
+ b === "end" && Q,
102
+ J ? /* @__PURE__ */ l("span", {
103
+ id: P,
104
+ className: "visually-hidden",
105
+ children: G
106
+ }) : null,
107
+ x && q ? /* @__PURE__ */ l("span", {
108
+ role: "status",
109
+ "aria-live": "polite",
110
+ "aria-atomic": "true",
111
+ className: "visually-hidden",
112
+ "data-testid": d.statusAnnouncement,
113
+ children: B
114
+ }) : null,
115
+ /* @__PURE__ */ l("span", {
116
+ id: F,
68
117
  role: "status",
69
118
  "aria-live": "polite",
70
119
  "aria-atomic": "true",
71
120
  className: "visually-hidden",
72
- "data-testid": l.loadingAnnouncement,
73
- children: m && N ? g : null
121
+ "data-testid": d.loadingAnnouncement,
122
+ children: g && R ? v : null
74
123
  })
75
124
  ]
76
125
  });
77
- }), d = Object.assign(u, { testIds: l });
126
+ }), p = Object.assign(f, { testIds: d });
78
127
  //#endregion
79
- export { d as ToggleSwitch };
128
+ export { p as ToggleSwitch };
80
129
 
81
130
  //# sourceMappingURL=ToggleSwitch.js.map