@slotted/react 0.1.0-beta.41 → 0.1.0-beta.42

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 (286) hide show
  1. package/dist/{accordion-n5D6mcmS.js → accordion-xW-aFeGb.js} +1 -1
  2. package/dist/accordion.js +1 -1
  3. package/dist/{action-bar-Cq4dt4hP.js → action-bar-BSUuY6pJ.js} +1 -1
  4. package/dist/action-bar.js +1 -1
  5. package/dist/{action-sheet-dNnB26br.js → action-sheet-BouG2qh_.js} +1 -1
  6. package/dist/action-sheet.js +1 -1
  7. package/dist/{app-shell-DyPHYe4K.js → app-shell-D54YkU7E.js} +126 -110
  8. package/dist/app-shell.js +2 -2
  9. package/dist/{calendar-DRuJ7z0H.js → calendar-YQ784o4d.js} +139 -123
  10. package/dist/calendar.js +1 -1
  11. package/dist/{cascader-CivJ76VR.js → cascader-fq8fNWSr.js} +1 -1
  12. package/dist/cascader.js +1 -1
  13. package/dist/{chart-CgXbG6gZ.js → chart-vedR0BDN.js} +1 -1
  14. package/dist/chart.js +1 -1
  15. package/dist/{checkbox-D3E4gzMe.js → checkbox-DsJhlB5c.js} +3 -3
  16. package/dist/{checkbox-group-Dg5YN3fx.js → checkbox-group-pvX9R_yS.js} +2 -2
  17. package/dist/checkbox-group.js +1 -1
  18. package/dist/checkbox.js +1 -1
  19. package/dist/{collapsible-CT4_3aXm.js → collapsible-KzBs5HvA.js} +2 -2
  20. package/dist/collapsible.js +1 -1
  21. package/dist/{color-picker-CeOl4ikV.js → color-picker-i-MJ5VVs.js} +4 -4
  22. package/dist/color-picker.js +1 -1
  23. package/dist/{column-manager-CnOhzVGP.js → column-manager-D028QbfO.js} +5 -5
  24. package/dist/column-manager.js +1 -1
  25. package/dist/{combobox-C2qlkTw6.js → combobox-599heRN_.js} +1 -1
  26. package/dist/combobox.js +1 -1
  27. package/dist/{context-menu-WiKS4Zwv.js → context-menu-WM_tT9hz.js} +1 -1
  28. package/dist/context-menu.js +1 -1
  29. package/dist/{currency-field-LAawS9qo.js → currency-field-rS36pjCO.js} +1 -1
  30. package/dist/currency-field.js +1 -1
  31. package/dist/{dashboard-grid-Zzqmbzqq.js → dashboard-grid-Dh2Q3IQv.js} +2 -2
  32. package/dist/dashboard-grid.js +1 -1
  33. package/dist/{data-grid-Y5aX9njc.js → data-grid-D106baPp.js} +17 -17
  34. package/dist/data-grid.js +1 -1
  35. package/dist/{data-list-CyEq7M2D.js → data-list-BA0xrySM.js} +2 -2
  36. package/dist/data-list.js +1 -1
  37. package/dist/{date-field-CxubN_3u.js → date-field-BZ5JcvXJ.js} +1 -1
  38. package/dist/date-field.js +1 -1
  39. package/dist/{date-picker-6hj83x5D.js → date-picker-BvEbsbJC.js} +4 -4
  40. package/dist/date-picker.js +2 -2
  41. package/dist/{date-range-picker-CBWnFTgL.js → date-range-picker-uIr-yReE.js} +5 -5
  42. package/dist/date-range-picker.js +1 -1
  43. package/dist/{datetime-field-GMIqBuTa.js → datetime-field-DDs3mV9Z.js} +1 -1
  44. package/dist/datetime-field.js +1 -1
  45. package/dist/{datetime-picker-DwUYd3zF.js → datetime-picker-DDYXqrjm.js} +6 -6
  46. package/dist/datetime-picker.js +1 -1
  47. package/dist/{datetime-range-picker-CX_tBt6b.js → datetime-range-picker-CFTHW771.js} +6 -6
  48. package/dist/datetime-range-picker.js +1 -1
  49. package/dist/docs/accordion.examples.md +743 -0
  50. package/dist/docs/accordion.json +84 -28
  51. package/dist/docs/accordion.md +56 -152
  52. package/dist/docs/action-sheet.examples.md +771 -0
  53. package/dist/docs/action-sheet.json +91 -51
  54. package/dist/docs/action-sheet.md +72 -233
  55. package/dist/docs/app-shell.json +7 -0
  56. package/dist/docs/app-shell.md +1 -0
  57. package/dist/docs/breadcrumb.json +64 -16
  58. package/dist/docs/breadcrumb.md +489 -56
  59. package/dist/docs/collapsible.examples.md +575 -0
  60. package/dist/docs/collapsible.json +89 -49
  61. package/dist/docs/collapsible.md +47 -197
  62. package/dist/docs/context-menu.json +58 -18
  63. package/dist/docs/context-menu.md +442 -77
  64. package/dist/docs/field.json +15 -1
  65. package/dist/docs/field.md +3 -1
  66. package/dist/docs/floating-panel.json +56 -0
  67. package/dist/docs/floating-panel.md +329 -8
  68. package/dist/docs/hover-card.json +65 -17
  69. package/dist/docs/hover-card.md +422 -64
  70. package/dist/docs/loading-overlay.examples.md +577 -0
  71. package/dist/docs/loading-overlay.json +55 -23
  72. package/dist/docs/loading-overlay.md +49 -168
  73. package/dist/docs/menu.json +67 -0
  74. package/dist/docs/menu.md +8 -1
  75. package/dist/docs/menubar.json +55 -15
  76. package/dist/docs/menubar.md +488 -42
  77. package/dist/docs/pagination.json +89 -33
  78. package/dist/docs/pagination.md +462 -55
  79. package/dist/docs/popover.json +1 -1
  80. package/dist/docs/popover.md +1 -1
  81. package/dist/docs/select.json +55 -1
  82. package/dist/docs/select.md +7 -2
  83. package/dist/docs/toggle-group.examples.md +584 -0
  84. package/dist/docs/toggle-group.json +84 -20
  85. package/dist/docs/toggle-group.md +17 -182
  86. package/dist/docs/toggle.json +93 -37
  87. package/dist/docs/toggle.md +304 -51
  88. package/dist/{drawer-Du1aC1px.js → drawer-CQagePr_.js} +256 -256
  89. package/dist/drawer.js +1 -1
  90. package/dist/{entity-picker-BwJX0gNJ.js → entity-picker-CC4VoC3p.js} +2 -2
  91. package/dist/entity-picker.js +1 -1
  92. package/dist/{event-calendar-DzlL95E4.js → event-calendar-CjmF_e0H.js} +5 -5
  93. package/dist/event-calendar.js +1 -1
  94. package/dist/field-C-HRhke0.js +421 -0
  95. package/dist/{field-group-7zV68b3d.js → field-group-CU0PasvW.js} +1 -1
  96. package/dist/field-group.js +1 -1
  97. package/dist/field.js +1 -1
  98. package/dist/{filter-bar-DMuP5P6e.js → filter-bar-B3QJD7SZ.js} +11 -11
  99. package/dist/filter-bar.js +1 -1
  100. package/dist/{hover-card-CWCSZ5_p.js → hover-card-CTItbEfH.js} +2 -2
  101. package/dist/hover-card.js +1 -1
  102. package/dist/{import-export-center-DzAUMTq5.js → import-export-center-CW8YVZev.js} +1 -1
  103. package/dist/import-export-center.js +1 -1
  104. package/dist/index.js +132 -132
  105. package/dist/{listbox-CWU3DiEt.js → listbox-ZqiJ2yer.js} +1 -1
  106. package/dist/listbox.js +1 -1
  107. package/dist/{markdown-7wOBMXTl.js → markdown-BdskE4-L.js} +1 -1
  108. package/dist/markdown.js +1 -1
  109. package/dist/menu-parts-DXs5YuUA.js +932 -0
  110. package/dist/menu.js +1 -1
  111. package/dist/{menubar-k8Q4_p9l.js → menubar-CVoAFc6r.js} +2 -2
  112. package/dist/menubar.js +1 -1
  113. package/dist/{multi-select-DEd_92BC.js → multi-select-Dc2d6dDB.js} +1 -1
  114. package/dist/multi-select.js +1 -1
  115. package/dist/{number-field-BJKoidAE.js → number-field-BQ54hXmk.js} +1 -1
  116. package/dist/number-field.js +1 -1
  117. package/dist/{otp-input-Czz9Z6dQ.js → otp-input-DRooqa3f.js} +1 -1
  118. package/dist/otp-input.js +1 -1
  119. package/dist/{pagination-D0PUAFYm.js → pagination-BRXuyPzo.js} +1 -1
  120. package/dist/pagination.js +1 -1
  121. package/dist/{picker-frame-CT5WNEnw.js → picker-frame-B6sPCP5Y.js} +1 -1
  122. package/dist/{popover-B2t__iNO.js → popover-1DlOu95x.js} +198 -197
  123. package/dist/popover.js +1 -1
  124. package/dist/{prompt-composer-Lsfcz_i9.js → prompt-composer-tYIs39rn.js} +1 -1
  125. package/dist/prompt-composer.js +1 -1
  126. package/dist/{radio-group-_ZRUgcI5.js → radio-group-AW3xcYYh.js} +2 -2
  127. package/dist/radio-group.js +1 -1
  128. package/dist/{rating-C6AkIIUi.js → rating-h3qdHLNi.js} +1 -1
  129. package/dist/rating.js +1 -1
  130. package/dist/{saved-views-zM-DxT1F.js → saved-views-nqn0SDXn.js} +4 -4
  131. package/dist/saved-views.js +1 -1
  132. package/dist/{segmented-control-D52GeOlS.js → segmented-control-CbK7SurB.js} +2 -2
  133. package/dist/segmented-control.js +1 -1
  134. package/dist/select-d448Wkzb.js +1124 -0
  135. package/dist/select.js +1 -1
  136. package/dist/{side-navigation-CtZuP87S.js → side-navigation-CKRETc8E.js} +99 -99
  137. package/dist/side-navigation.js +1 -1
  138. package/dist/{slider-DQqQ0skr.js → slider-DQ2CnxTO.js} +1 -1
  139. package/dist/slider.js +1 -1
  140. package/dist/{split-button-BYowsA6Q.js → split-button-D4MPKSB2.js} +1 -1
  141. package/dist/split-button.js +1 -1
  142. package/dist/styles/action-bar.css +1 -1
  143. package/dist/styles/app-shell.css +1 -1
  144. package/dist/styles/cascader.css +2 -0
  145. package/dist/styles/chart.css +1 -1
  146. package/dist/styles/checkbox-group.css +2 -0
  147. package/dist/styles/checkbox.css +2 -0
  148. package/dist/styles/color-picker.css +3 -3
  149. package/dist/styles/column-manager.css +2 -2
  150. package/dist/styles/combobox.css +2 -0
  151. package/dist/styles/context-menu.css +1 -1
  152. package/dist/styles/currency-field.css +2 -0
  153. package/dist/styles/dashboard-grid.css +2 -2
  154. package/dist/styles/data-grid.css +4 -4
  155. package/dist/styles/data-list.css +3 -1
  156. package/dist/styles/date-field.css +2 -0
  157. package/dist/styles/date-picker.css +3 -1
  158. package/dist/styles/date-range-picker.css +3 -1
  159. package/dist/styles/datetime-field.css +2 -0
  160. package/dist/styles/datetime-picker.css +3 -1
  161. package/dist/styles/datetime-range-picker.css +3 -1
  162. package/dist/styles/entity-picker.css +3 -1
  163. package/dist/styles/event-calendar.css +2 -2
  164. package/dist/styles/field-group.css +2 -0
  165. package/dist/styles/field.css +2 -0
  166. package/dist/styles/filter-bar.css +4 -4
  167. package/dist/styles/floating-panel.css +1 -1
  168. package/dist/styles/hover-card.css +1 -1
  169. package/dist/styles/import-export-center.css +3 -3
  170. package/dist/styles/index.css +9 -9
  171. package/dist/styles/listbox.css +2 -0
  172. package/dist/styles/markdown.css +2 -0
  173. package/dist/styles/menu.css +1 -1
  174. package/dist/styles/menubar.css +1 -1
  175. package/dist/styles/multi-select.css +2 -0
  176. package/dist/styles/number-field.css +2 -0
  177. package/dist/styles/otp-input.css +2 -0
  178. package/dist/styles/pagination.css +1 -1
  179. package/dist/styles/popover.css +1 -1
  180. package/dist/styles/prompt-composer.css +2 -0
  181. package/dist/styles/radio-group.css +2 -0
  182. package/dist/styles/rating.css +2 -0
  183. package/dist/styles/saved-views.css +3 -3
  184. package/dist/styles/segmented-control.css +2 -0
  185. package/dist/styles/select.css +3 -1
  186. package/dist/styles/side-navigation.css +1 -1
  187. package/dist/styles/slider.css +2 -0
  188. package/dist/styles/split-button.css +1 -1
  189. package/dist/styles/switch.css +2 -0
  190. package/dist/styles/table.css +3 -3
  191. package/dist/styles/tags-input.css +2 -0
  192. package/dist/styles/text-field.css +2 -0
  193. package/dist/styles/textarea.css +2 -0
  194. package/dist/styles/time-field.css +2 -0
  195. package/dist/styles/time-picker.css +3 -1
  196. package/dist/styles/time-range-picker.css +3 -1
  197. package/dist/styles/toggle-group.css +3 -1
  198. package/dist/styles/toolbar.css +1 -1
  199. package/dist/styles/top-navigation.css +1 -1
  200. package/dist/styles/transfer.css +2 -0
  201. package/dist/styles/upload.css +2 -0
  202. package/dist/styles.css +1 -1
  203. package/dist/{switch-CcZAVLiW.js → switch-DxMukg7F.js} +1 -1
  204. package/dist/switch.js +1 -1
  205. package/dist/{table-D4oX9Gvn.js → table-BecApjeD.js} +13 -13
  206. package/dist/table.js +1 -1
  207. package/dist/{tags-input-O87zTh7h.js → tags-input-CqCeLtk-.js} +1 -1
  208. package/dist/tags-input.js +1 -1
  209. package/dist/{text-field-Cnjc7LB5.js → text-field-CMOkJ9Z6.js} +1 -1
  210. package/dist/text-field.js +1 -1
  211. package/dist/{textarea-DcA7jwOM.js → textarea-DfqPfXTr.js} +1 -1
  212. package/dist/textarea.js +1 -1
  213. package/dist/{time-field-BanhrUvf.js → time-field-GyLQsxcc.js} +1 -1
  214. package/dist/time-field.js +1 -1
  215. package/dist/{time-picker-Cu1iV039.js → time-picker-CGHPnust.js} +3 -3
  216. package/dist/time-picker.js +1 -1
  217. package/dist/{time-range-picker-sdbaFJFN.js → time-range-picker-BMRtAqPy.js} +4 -4
  218. package/dist/time-range-picker.js +1 -1
  219. package/dist/{toggle-zDTD5G3H.js → toggle-DSEEtL3Y.js} +7 -2
  220. package/dist/{toggle-group-D7GQyNQP.js → toggle-group-DZEWkVRo.js} +8 -3
  221. package/dist/toggle-group.js +1 -1
  222. package/dist/toggle.js +1 -1
  223. package/dist/{toolbar-DOV4BKY8.js → toolbar-BP7ka6lN.js} +1 -1
  224. package/dist/toolbar.js +1 -1
  225. package/dist/{top-navigation-D3rpgBV2.js → top-navigation-D8IHPOmm.js} +1 -1
  226. package/dist/top-navigation.js +1 -1
  227. package/dist/{transfer-CuLlF_nY.js → transfer-sKUvmEKe.js} +5 -5
  228. package/dist/transfer.js +1 -1
  229. package/dist/types/app-shell/app-shell-parts.d.ts +7 -0
  230. package/dist/types/app-shell/app-shell-parts.d.ts.map +1 -1
  231. package/dist/types/app-shell/index.d.ts +1 -1
  232. package/dist/types/app-shell/index.d.ts.map +1 -1
  233. package/dist/types/calendar/calendar.d.ts.map +1 -1
  234. package/dist/types/calendar/use-clock-today.d.ts +10 -0
  235. package/dist/types/calendar/use-clock-today.d.ts.map +1 -0
  236. package/dist/types/field/field-defaults.d.ts +1 -1
  237. package/dist/types/field/field-defaults.d.ts.map +1 -1
  238. package/dist/types/field/field-help-sheet.d.ts +15 -0
  239. package/dist/types/field/field-help-sheet.d.ts.map +1 -0
  240. package/dist/types/field/field-parts.d.ts +1 -1
  241. package/dist/types/field/field-parts.d.ts.map +1 -1
  242. package/dist/types/field/field.types.d.ts +11 -0
  243. package/dist/types/field/field.types.d.ts.map +1 -1
  244. package/dist/types/field/index.d.ts +1 -1
  245. package/dist/types/field/index.d.ts.map +1 -1
  246. package/dist/types/menu/index.d.ts +1 -1
  247. package/dist/types/menu/index.d.ts.map +1 -1
  248. package/dist/types/menu/menu-defaults.d.ts.map +1 -1
  249. package/dist/types/menu/menu-parts.d.ts.map +1 -1
  250. package/dist/types/menu/menu-sheet-step.d.ts +6 -0
  251. package/dist/types/menu/menu-sheet-step.d.ts.map +1 -0
  252. package/dist/types/menu/menu.d.ts +1 -1
  253. package/dist/types/menu/menu.d.ts.map +1 -1
  254. package/dist/types/menu/menu.types.d.ts +15 -0
  255. package/dist/types/menu/menu.types.d.ts.map +1 -1
  256. package/dist/types/menu/use-menu-sheet.d.ts +9 -0
  257. package/dist/types/menu/use-menu-sheet.d.ts.map +1 -0
  258. package/dist/types/pagination/pagination-parts.d.ts.map +1 -1
  259. package/dist/types/picker-panel/picker-layer.d.ts +4 -1
  260. package/dist/types/picker-panel/picker-layer.d.ts.map +1 -1
  261. package/dist/types/picker-panel/use-picker-layer.d.ts.map +1 -1
  262. package/dist/types/popover/popover-parts.d.ts.map +1 -1
  263. package/dist/types/select/index.d.ts +1 -1
  264. package/dist/types/select/index.d.ts.map +1 -1
  265. package/dist/types/select/select-defaults.d.ts.map +1 -1
  266. package/dist/types/select/select-parts.d.ts.map +1 -1
  267. package/dist/types/select/select.d.ts +6 -2
  268. package/dist/types/select/select.d.ts.map +1 -1
  269. package/dist/types/select/select.types.d.ts +9 -0
  270. package/dist/types/select/select.types.d.ts.map +1 -1
  271. package/dist/types/select/use-select-sheet.d.ts +9 -0
  272. package/dist/types/select/use-select-sheet.d.ts.map +1 -0
  273. package/dist/types/toggle/toggle.d.ts.map +1 -1
  274. package/dist/types/toggle/toggle.types.d.ts +4 -1
  275. package/dist/types/toggle/toggle.types.d.ts.map +1 -1
  276. package/dist/types/toggle-group/toggle-group-parts.d.ts.map +1 -1
  277. package/dist/types/toggle-group/toggle-group.types.d.ts +4 -1
  278. package/dist/types/toggle-group/toggle-group.types.d.ts.map +1 -1
  279. package/dist/{upload-CPl38p-S.js → upload-CuMOaPK3.js} +1 -1
  280. package/dist/upload.js +1 -1
  281. package/dist/{use-date-picker-DWV7KWS7.js → use-date-picker-DdSX3RE4.js} +2 -2
  282. package/dist/{use-picker-draft-BJlHcb6J.js → use-picker-draft-I_pxqYsc.js} +48 -35
  283. package/package.json +6 -6
  284. package/dist/field-vOVzvq5t.js +0 -368
  285. package/dist/menu-parts-DgL617_H.js +0 -814
  286. package/dist/select-BkUuIVBK.js +0 -1017
@@ -247,14 +247,14 @@
247
247
  {
248
248
  "name": "onClick, onFocus, onBlur, on each item",
249
249
  "payload": "the element’s own events",
250
- "when": "Whenever that item’s button fires them. The family composes with a consumer’s handler rather than replacing it: the consumer’s runs first, and always runs. Calling preventDefault() in onClick stops the toggle as well."
250
+ "when": "Whenever that item’s button fires them. ToggleGroupItem composes with the application’s handler rather than replacing it: the application’s runs first, and always runs. Calling preventDefault() in onClick stops the toggle as well."
251
251
  }
252
252
  ],
253
253
  "accessibility": [
254
254
  "There is no APG pattern called “toggle group”. The container is a group, each item is the Button pattern’s toggle button (w3.org/WAI/ARIA/apg/patterns/button/), and the movement between them is the Toolbar pattern’s roving tabindex (w3.org/WAI/ARIA/apg/patterns/toolbar/). Citing one and implying the other is how a family ends up with half a keyboard.",
255
- "So the arrows move focus and never toggle, which is the one place this family and segmented-control genuinely differ and the one a reader feels. Space and Enter turn the focused item on or off; Home and End reach the ends; a horizontal group ignores the cross axis so the page keeps scrolling with focus inside it.",
255
+ "So the arrows move focus and never toggle, which is the one place toggle group and segmented-control genuinely differ and the one a reader feels. Space and Enter turn the focused item on or off; Home and End reach the ends; a horizontal group ignores the cross axis so the page keeps scrolling with focus inside it.",
256
256
  "aria-pressed is written in both states, so an item is announced as a toggle rather than as a button that happens to be pressed — and the label never changes with the state, which the Button pattern calls critical. An item with only a mark takes its name from an aria-label the consumer writes.",
257
- "Inside a toolbar the group gives its keyboard up: a bar is already one tab stop with arrow navigation across every control it holds. The bar is found in the DOM by its public identifier rather than through an imported context, so neither family depends on the other; rovingFocus states it outright for a bar this library did not write.",
257
+ "Inside a toolbar the group gives its keyboard up: a bar is already one tab stop with arrow navigation across every control it holds. The bar is found in the DOM by its public identifier rather than through an imported context, so neither depends on the other; rovingFocus states it outright for a bar this library did not write.",
258
258
  "disabled is the native attribute, because that is also what makes the browser refuse focus and what makes the ring skip the item. The group is not a form control: a set of choices a form submits is checkbox-group for many and segmented-control for one.",
259
259
  "The target is the item itself, never narrower than it is tall, so the WCAG 2.2 minimum of 24 by 24 holds at the smallest step and the tightest density — and the theme grows every control to 44 under a coarse pointer."
260
260
  ]
@@ -338,8 +338,8 @@
338
338
  "title": "One at a time, several at once, or none",
339
339
  "note": "The value is an array in both modes: multiple caps it at every item rather than at one. Press the item that is already on — the set empties, unless deselectable says it may not.",
340
340
  "language": "tsx",
341
- "source": "<ToggleGroup aria-label=\"Text style\" defaultValue={['bold', 'italic']} multiple>\n <ToggleGroupItem value=\"bold\">Bold</ToggleGroupItem>\n <ToggleGroupItem value=\"italic\">Italic</ToggleGroupItem>\n</ToggleGroup>;\n\n<ToggleGroup aria-label=\"Period\" defaultValue={['week']} deselectable={false}>\n <ToggleGroupItem value=\"week\">Week</ToggleGroupItem>\n <ToggleGroupItem value=\"month\">Month</ToggleGroupItem>\n</ToggleGroup>;\n",
342
- "verdict": "excerpt"
341
+ "source": "import { Stack } from '@slotted/react/stack';\nimport { ToggleGroup, ToggleGroupItem } from '@slotted/react/toggle-group';\nimport { Text } from '@slotted/react/typography';\n\nexport default function ToggleGroupSelection() {\n return (\n <Stack gap={5}>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n One at a time, and none when the active item is pressed again\n </Text>\n <ToggleGroup aria-label=\"Shipping speed\" defaultValue={['standard']}>\n <ToggleGroupItem value=\"standard\">Standard</ToggleGroupItem>\n <ToggleGroupItem value=\"express\">Express</ToggleGroupItem>\n <ToggleGroupItem value=\"overnight\">Overnight</ToggleGroupItem>\n </ToggleGroup>\n </Stack>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n Several at once\n </Text>\n <ToggleGroup aria-label=\"Order channels\" defaultValue={['web', 'retail']} multiple>\n <ToggleGroupItem value=\"web\">Web</ToggleGroupItem>\n <ToggleGroupItem value=\"retail\">Retail</ToggleGroupItem>\n <ToggleGroupItem value=\"wholesale\">Wholesale</ToggleGroupItem>\n </ToggleGroup>\n </Stack>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n One at a time, always one\n </Text>\n <ToggleGroup aria-label=\"Reporting currency\" defaultValue={['usd']} deselectable={false}>\n <ToggleGroupItem value=\"usd\">USD</ToggleGroupItem>\n <ToggleGroupItem value=\"eur\">EUR</ToggleGroupItem>\n <ToggleGroupItem value=\"gbp\">GBP</ToggleGroupItem>\n </ToggleGroup>\n </Stack>\n </Stack>\n );\n}\n",
342
+ "verdict": "example"
343
343
  },
344
344
  {
345
345
  "id": "variant",
@@ -354,8 +354,8 @@
354
354
  "title": "The three control steps",
355
355
  "note": "Each step reads the control scale, so a bar is exactly as tall as the text field and the button beside it at every size and at every density.",
356
356
  "language": "tsx",
357
- "source": "<ToggleGroup aria-label=\"Sorting\" defaultValue={['newest']} size=\"sm\">\n <ToggleGroupItem value=\"newest\">Newest</ToggleGroupItem>\n <ToggleGroupItem value=\"oldest\">Oldest</ToggleGroupItem>\n</ToggleGroup>;\n",
358
- "verdict": "excerpt"
357
+ "source": "import { Stack } from '@slotted/react/stack';\nimport { ToggleGroup, ToggleGroupItem } from '@slotted/react/toggle-group';\nimport { Text } from '@slotted/react/typography';\n\nexport default function ToggleGroupSizes() {\n return (\n <Stack gap={5}>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n sm\n </Text>\n <ToggleGroup aria-label=\"Order sorting, small\" defaultValue={['newest']} size=\"sm\">\n <ToggleGroupItem value=\"newest\">Newest</ToggleGroupItem>\n <ToggleGroupItem value=\"oldest\">Oldest</ToggleGroupItem>\n <ToggleGroupItem value=\"largest\">Largest</ToggleGroupItem>\n </ToggleGroup>\n </Stack>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n md\n </Text>\n <ToggleGroup aria-label=\"Order sorting, medium\" defaultValue={['newest']} size=\"md\">\n <ToggleGroupItem value=\"newest\">Newest</ToggleGroupItem>\n <ToggleGroupItem value=\"oldest\">Oldest</ToggleGroupItem>\n <ToggleGroupItem value=\"largest\">Largest</ToggleGroupItem>\n </ToggleGroup>\n </Stack>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n lg\n </Text>\n <ToggleGroup aria-label=\"Order sorting, large\" defaultValue={['newest']} size=\"lg\">\n <ToggleGroupItem value=\"newest\">Newest</ToggleGroupItem>\n <ToggleGroupItem value=\"oldest\">Oldest</ToggleGroupItem>\n <ToggleGroupItem value=\"largest\">Largest</ToggleGroupItem>\n </ToggleGroup>\n </Stack>\n </Stack>\n );\n}\n",
358
+ "verdict": "example"
359
359
  },
360
360
  {
361
361
  "id": "orientation",
@@ -370,23 +370,23 @@
370
370
  "title": "Joined, or spaced apart",
371
371
  "note": "A joined bar overlaps its items by one border so the shared column holds one line rather than two — which is what keeps the edge even at 110%, 150% and 175% zoom.",
372
372
  "language": "tsx",
373
- "source": "<ToggleGroup aria-label=\"Camadas\" attached={false} defaultValue={['roads']} multiple>\n <ToggleGroupItem value=\"roads\">Ruas</ToggleGroupItem>\n <ToggleGroupItem value=\"terrain\">Relevo</ToggleGroupItem>\n</ToggleGroup>;\n",
373
+ "source": "<ToggleGroup aria-label=\"Map layers\" attached={false} defaultValue={['roads']} multiple>\n <ToggleGroupItem value=\"roads\">Roads</ToggleGroupItem>\n <ToggleGroupItem value=\"terrain\">Terrain</ToggleGroupItem>\n</ToggleGroup>;\n",
374
374
  "verdict": "excerpt"
375
375
  },
376
376
  {
377
377
  "id": "states",
378
- "title": "Every state the contract declares",
378
+ "title": "Every state",
379
379
  "note": "Hover, focus, press, on, unavailable, and unavailable while on — that last one keeps both facts, because the state a reader cannot change is still one they have to be able to read.",
380
380
  "language": "tsx",
381
- "source": "<ToggleGroup aria-label=\"Formato\" defaultValue={['pdf']}>\n <ToggleGroupItem value=\"csv\">CSV</ToggleGroupItem>\n <ToggleGroupItem disabled value=\"xlsx\">\n XLSX\n </ToggleGroupItem>\n <ToggleGroupItem disabled value=\"pdf\">\n PDF\n </ToggleGroupItem>\n</ToggleGroup>;\n",
382
- "verdict": "excerpt"
381
+ "source": "import { Stack } from '@slotted/react/stack';\nimport { ToggleGroup, ToggleGroupItem } from '@slotted/react/toggle-group';\nimport { Text } from '@slotted/react/typography';\n\nexport default function ToggleGroupStates() {\n return (\n <Stack gap={5}>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n One item unavailable\n </Text>\n <ToggleGroup aria-label=\"Export format\" defaultValue={['csv']}>\n <ToggleGroupItem value=\"csv\">CSV</ToggleGroupItem>\n <ToggleGroupItem disabled value=\"xlsx\">\n XLSX\n </ToggleGroupItem>\n <ToggleGroupItem value=\"pdf\">PDF</ToggleGroupItem>\n </ToggleGroup>\n </Stack>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n Unavailable while on\n </Text>\n <ToggleGroup aria-label=\"Invoice status\" defaultValue={['approved']}>\n <ToggleGroupItem value=\"draft\">Draft</ToggleGroupItem>\n <ToggleGroupItem disabled value=\"approved\">\n Approved\n </ToggleGroupItem>\n <ToggleGroupItem value=\"paid\">Paid</ToggleGroupItem>\n </ToggleGroup>\n </Stack>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n Whole group unavailable\n </Text>\n <ToggleGroup aria-label=\"Payment terms\" defaultValue={['net30']} disabled>\n <ToggleGroupItem value=\"net15\">Net 15</ToggleGroupItem>\n <ToggleGroupItem value=\"net30\">Net 30</ToggleGroupItem>\n <ToggleGroupItem value=\"net60\">Net 60</ToggleGroupItem>\n </ToggleGroup>\n </Stack>\n </Stack>\n );\n}\n",
382
+ "verdict": "example"
383
383
  },
384
384
  {
385
385
  "id": "iconOnly",
386
386
  "title": "Marks without words",
387
- "note": "An item with only a mark draws square and takes its accessible name from aria-label, which is the one thing the family cannot supply for a consumer’s own artwork.",
387
+ "note": "An item with only a mark draws square and takes its accessible name from aria-label, which is the one thing toggle group cannot supply for a mark it did not draw.",
388
388
  "language": "tsx",
389
- "source": "<ToggleGroup aria-label=\"Text style\" defaultValue={['bold']} multiple>\n <ToggleGroupItem aria-label=\"Bold\" icon={<BoldIcon />} value=\"bold\" />\n <ToggleGroupItem aria-label=\"Italic\" icon={<ItalicIcon />} value=\"italic\" />\n</ToggleGroup>;\n",
389
+ "source": "<ToggleGroup aria-label=\"Order flags\" defaultValue={['starred']} multiple>\n <ToggleGroupItem aria-label=\"Starred\" icon={<Glyph name=\"star\" />} value=\"starred\" />\n <ToggleGroupItem aria-label=\"Pinned\" icon={<Glyph name=\"pin\" />} value=\"pinned\" />\n</ToggleGroup>;\n",
390
390
  "verdict": "excerpt"
391
391
  },
392
392
  {
@@ -402,13 +402,13 @@
402
402
  "title": "Inside a toolbar, the bar owns the keyboard",
403
403
  "note": "A toolbar is already one tab stop with arrow navigation across every control it holds, so the group stands down rather than putting a second stop inside the first. Nothing has to be passed.",
404
404
  "language": "tsx",
405
- "source": "<Toolbar aria-label=\"Formatting\">\n <ToggleGroup aria-label=\"Text style\" defaultValue={['bold']} multiple variant=\"ghost\">\n <ToggleGroupItem aria-label=\"Bold\" icon={<BoldIcon />} value=\"bold\" />\n <ToggleGroupItem aria-label=\"Italic\" icon={<ItalicIcon />} value=\"italic\" />\n </ToggleGroup>\n <ToolbarSeparator />\n <Button size=\"sm\" tone=\"secondary\" variant=\"ghost\">\n Publicar\n </Button>\n</Toolbar>;\n",
406
- "verdict": "excerpt"
405
+ "source": "import { Button } from '@slotted/react/button';\nimport { ToggleGroup, ToggleGroupItem } from '@slotted/react/toggle-group';\nimport { Toolbar, ToolbarSeparator } from '@slotted/react/toolbar';\n\nexport default function ToggleGroupToolbar() {\n return (\n <Toolbar aria-label=\"Sales report\">\n <ToggleGroup aria-label=\"Chart type\" defaultValue={['bars']} variant=\"ghost\">\n <ToggleGroupItem value=\"bars\">Bars</ToggleGroupItem>\n <ToggleGroupItem value=\"lines\">Lines</ToggleGroupItem>\n </ToggleGroup>\n <ToolbarSeparator />\n <ToggleGroup aria-label=\"Overlays\" defaultValue={['forecast']} multiple variant=\"ghost\">\n <ToggleGroupItem value=\"forecast\">Forecast</ToggleGroupItem>\n <ToggleGroupItem value=\"prior-year\">Prior year</ToggleGroupItem>\n </ToggleGroup>\n <ToolbarSeparator />\n <Button size=\"sm\" tone=\"secondary\" variant=\"ghost\">\n Export\n </Button>\n </Toolbar>\n );\n}\n",
406
+ "verdict": "example"
407
407
  },
408
408
  {
409
409
  "id": "content",
410
- "title": "Content the family did not choose",
411
- "note": "A label nine words long, one unbroken token, and a right-to-left string inside a left-to-right page. Each clips at the ellipsis and keeps its whole text in the DOM.",
410
+ "title": "Labels longer than their item",
411
+ "note": "A label wider than its item clips at the ellipsis and keeps its whole text in the DOM, so a bar never grows a second line.",
412
412
  "language": "tsx",
413
413
  "source": "<ToggleGroup aria-label=\"Frequency\" defaultValue={['now']} fullWidth>\n <ToggleGroupItem value=\"now\">Immediately</ToggleGroupItem>\n <ToggleGroupItem value=\"digest\">Once a day, in the evening digest</ToggleGroupItem>\n</ToggleGroup>;\n",
414
414
  "verdict": "excerpt"
@@ -418,7 +418,7 @@
418
418
  "title": "Substituting an element, and setting the defaults once",
419
419
  "note": "render hands either root every attribute it was going to write, so a bar can be a real ul with each item an li; the provider states the axes once for a whole application.",
420
420
  "language": "tsx",
421
- "source": "<ToggleGroupDefaultsProvider size=\"sm\" variant=\"ghost\">\n <ToggleGroup aria-label=\"Camadas\" render={(props) => <nav {...props} />}>\n <ToggleGroupItem value=\"roads\">Ruas</ToggleGroupItem>\n </ToggleGroup>\n</ToggleGroupDefaultsProvider>;\n",
421
+ "source": "<ToggleGroupDefaultsProvider size=\"sm\" variant=\"ghost\">\n <ToggleGroup aria-label=\"Map layers\" render={(props) => <nav {...props} />}>\n <ToggleGroupItem value=\"roads\">Roads</ToggleGroupItem>\n </ToggleGroup>\n</ToggleGroupDefaultsProvider>;\n",
422
422
  "verdict": "excerpt"
423
423
  },
424
424
  {
@@ -426,8 +426,72 @@
426
426
  "title": "The keyboard, key by key",
427
427
  "note": "Tab reaches the group once; the arrows move focus and never toggle; Home and End reach the ends; Space and Enter turn the focused item on and off. An item is a button, and that is why.",
428
428
  "language": "tsx",
429
- "source": "<ToggleGroup aria-label=\"Period\" defaultValue={['week']} loop={false}>\n <ToggleGroupItem value=\"day\">Day</ToggleGroupItem>\n <ToggleGroupItem value=\"week\">Week</ToggleGroupItem>\n</ToggleGroup>;\n",
430
- "verdict": "excerpt"
429
+ "source": "import { Stack } from '@slotted/react/stack';\nimport { ToggleGroup, ToggleGroupItem } from '@slotted/react/toggle-group';\nimport { Text } from '@slotted/react/typography';\n\nexport default function ToggleGroupKeyboard() {\n return (\n <Stack gap={5}>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n Arrows wrap at the ends\n </Text>\n <ToggleGroup aria-label=\"Pick window\" defaultValue={['morning']}>\n <ToggleGroupItem value=\"morning\">Morning</ToggleGroupItem>\n <ToggleGroupItem value=\"afternoon\">Afternoon</ToggleGroupItem>\n <ToggleGroupItem value=\"night\">Night</ToggleGroupItem>\n </ToggleGroup>\n </Stack>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n Arrows stop at the ends\n </Text>\n <ToggleGroup aria-label=\"Dock shift\" defaultValue={['early']} loop={false}>\n <ToggleGroupItem value=\"early\">Early</ToggleGroupItem>\n <ToggleGroupItem value=\"late\">Late</ToggleGroupItem>\n <ToggleGroupItem value=\"overnight\">Overnight</ToggleGroupItem>\n </ToggleGroup>\n </Stack>\n </Stack>\n );\n}\n",
430
+ "verdict": "example"
431
+ },
432
+ {
433
+ "id": "basic",
434
+ "title": "basic.tsx",
435
+ "note": null,
436
+ "language": "tsx",
437
+ "source": "import { ToggleGroup, ToggleGroupItem } from '@slotted/react/toggle-group';\n\nexport default function ToggleGroupBasic() {\n return (\n <ToggleGroup aria-label=\"Revenue period\" defaultValue={['week']}>\n <ToggleGroupItem value=\"day\">Day</ToggleGroupItem>\n <ToggleGroupItem value=\"week\">Week</ToggleGroupItem>\n <ToggleGroupItem value=\"month\">Month</ToggleGroupItem>\n <ToggleGroupItem value=\"quarter\">Quarter</ToggleGroupItem>\n </ToggleGroup>\n );\n}\n",
438
+ "verdict": "example"
439
+ },
440
+ {
441
+ "id": "controlled",
442
+ "title": "controlled.tsx",
443
+ "note": null,
444
+ "language": "tsx",
445
+ "source": "import { useState } from 'react';\n\nimport { Stack } from '@slotted/react/stack';\nimport { ToggleGroup, ToggleGroupItem } from '@slotted/react/toggle-group';\nimport { Text } from '@slotted/react/typography';\n\nconst LIMIT = 3;\n\nexport default function ToggleGroupControlled() {\n const [columns, setColumns] = useState<readonly string[]>(['sku', 'quantity']);\n\n return (\n <Stack gap={3}>\n <ToggleGroup\n aria-label=\"Visible columns\"\n multiple\n onValueChange={(value, request) => {\n if (value.length > LIMIT) request.cancel();\n else setColumns(value);\n }}\n value={columns}\n >\n <ToggleGroupItem value=\"sku\">SKU</ToggleGroupItem>\n <ToggleGroupItem value=\"quantity\">Quantity</ToggleGroupItem>\n <ToggleGroupItem value=\"location\">Location</ToggleGroupItem>\n <ToggleGroupItem value=\"supplier\">Supplier</ToggleGroupItem>\n </ToggleGroup>\n <Text size=\"sm\" tone=\"muted\">\n {columns.length} of {LIMIT} columns: {columns.join(', ') || 'none'}\n </Text>\n </Stack>\n );\n}\n",
446
+ "verdict": "example"
447
+ },
448
+ {
449
+ "id": "defaults",
450
+ "title": "defaults.tsx",
451
+ "note": null,
452
+ "language": "tsx",
453
+ "source": "import { Stack } from '@slotted/react/stack';\nimport {\n ToggleGroup,\n ToggleGroupDefaultsProvider,\n ToggleGroupItem,\n} from '@slotted/react/toggle-group';\nimport { Text } from '@slotted/react/typography';\n\nexport default function ToggleGroupDefaults() {\n return (\n <ToggleGroupDefaultsProvider size=\"sm\" variant=\"ghost\" deselectable={false}>\n <Stack gap={5}>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n Inherits the provider\n </Text>\n <ToggleGroup aria-label=\"Table density\" defaultValue={['compact']}>\n <ToggleGroupItem value=\"comfortable\">Comfortable</ToggleGroupItem>\n <ToggleGroupItem value=\"compact\">Compact</ToggleGroupItem>\n </ToggleGroup>\n </Stack>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n States its own variant\n </Text>\n <ToggleGroup aria-label=\"Row height\" defaultValue={['compact']} variant=\"outline\">\n <ToggleGroupItem value=\"comfortable\">Comfortable</ToggleGroupItem>\n <ToggleGroupItem value=\"compact\">Compact</ToggleGroupItem>\n </ToggleGroup>\n </Stack>\n </Stack>\n </ToggleGroupDefaultsProvider>\n );\n}\n",
454
+ "verdict": "example"
455
+ },
456
+ {
457
+ "id": "field",
458
+ "title": "field.tsx",
459
+ "note": null,
460
+ "language": "tsx",
461
+ "source": "import { Field, FieldDescription, FieldLabel } from '@slotted/react/field';\nimport { ToggleGroup, ToggleGroupItem } from '@slotted/react/toggle-group';\n\nexport default function ToggleGroupField() {\n return (\n <Field>\n <FieldLabel>Delivery window</FieldLabel>\n <ToggleGroup defaultValue={['afternoon']}>\n <ToggleGroupItem value=\"morning\">Morning</ToggleGroupItem>\n <ToggleGroupItem value=\"afternoon\">Afternoon</ToggleGroupItem>\n <ToggleGroupItem value=\"evening\">Evening</ToggleGroupItem>\n </ToggleGroup>\n <FieldDescription>The carrier confirms the slot the day before.</FieldDescription>\n </Field>\n );\n}\n",
462
+ "verdict": "example"
463
+ },
464
+ {
465
+ "id": "icon-only",
466
+ "title": "icon-only.tsx",
467
+ "note": null,
468
+ "language": "tsx",
469
+ "source": "import { Glyph } from '@slotted/react/icon';\nimport { ToggleGroup, ToggleGroupItem } from '@slotted/react/toggle-group';\n\nexport default function ToggleGroupIconOnly() {\n return (\n <ToggleGroup aria-label=\"Order flags\" defaultValue={['starred']} multiple>\n <ToggleGroupItem aria-label=\"Starred\" icon={<Glyph name=\"star\" />} value=\"starred\" />\n <ToggleGroupItem aria-label=\"Pinned\" icon={<Glyph name=\"pin\" />} value=\"pinned\" />\n <ToggleGroupItem aria-label=\"Watching\" icon={<Glyph name=\"bell\" />} value=\"watching\" />\n </ToggleGroup>\n );\n}\n",
470
+ "verdict": "example"
471
+ },
472
+ {
473
+ "id": "icons",
474
+ "title": "icons.tsx",
475
+ "note": null,
476
+ "language": "tsx",
477
+ "source": "import { Glyph } from '@slotted/react/icon';\nimport { ToggleGroup, ToggleGroupItem } from '@slotted/react/toggle-group';\n\nexport default function ToggleGroupIcons() {\n return (\n <ToggleGroup aria-label=\"Listing visibility\" defaultValue={['shown']}>\n <ToggleGroupItem icon={<Glyph name=\"eye\" />} value=\"shown\">\n Shown\n </ToggleGroupItem>\n <ToggleGroupItem icon={<Glyph name=\"eye-off\" />} value=\"hidden\">\n Hidden\n </ToggleGroupItem>\n </ToggleGroup>\n );\n}\n",
478
+ "verdict": "example"
479
+ },
480
+ {
481
+ "id": "layout",
482
+ "title": "layout.tsx",
483
+ "note": null,
484
+ "language": "tsx",
485
+ "source": "import { Stack } from '@slotted/react/stack';\nimport { ToggleGroup, ToggleGroupItem } from '@slotted/react/toggle-group';\nimport { Text } from '@slotted/react/typography';\n\nexport default function ToggleGroupLayout() {\n return (\n <Stack gap={5}>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n fullWidth\n </Text>\n <ToggleGroup aria-label=\"Billing cycle\" defaultValue={['monthly']} fullWidth>\n <ToggleGroupItem value=\"monthly\">Monthly</ToggleGroupItem>\n <ToggleGroupItem value=\"yearly\">Yearly</ToggleGroupItem>\n </ToggleGroup>\n </Stack>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n attached off\n </Text>\n <ToggleGroup\n aria-label=\"Order status filter\"\n attached={false}\n defaultValue={['open']}\n multiple\n >\n <ToggleGroupItem value=\"open\">Open</ToggleGroupItem>\n <ToggleGroupItem value=\"packed\">Packed</ToggleGroupItem>\n <ToggleGroupItem value=\"shipped\">Shipped</ToggleGroupItem>\n </ToggleGroup>\n </Stack>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n vertical\n </Text>\n <ToggleGroup aria-label=\"Warehouse zone\" defaultValue={['storage']} orientation=\"vertical\">\n <ToggleGroupItem value=\"receiving\">Receiving</ToggleGroupItem>\n <ToggleGroupItem value=\"storage\">Storage</ToggleGroupItem>\n <ToggleGroupItem value=\"dispatch\">Dispatch</ToggleGroupItem>\n </ToggleGroup>\n </Stack>\n </Stack>\n );\n}\n",
486
+ "verdict": "example"
487
+ },
488
+ {
489
+ "id": "variants",
490
+ "title": "variants.tsx",
491
+ "note": null,
492
+ "language": "tsx",
493
+ "source": "import { Stack } from '@slotted/react/stack';\nimport { ToggleGroup, ToggleGroupItem } from '@slotted/react/toggle-group';\nimport { Text } from '@slotted/react/typography';\n\nexport default function ToggleGroupVariants() {\n return (\n <Stack gap={5}>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n outline\n </Text>\n <ToggleGroup aria-label=\"Table density\" defaultValue={['compact']} variant=\"outline\">\n <ToggleGroupItem value=\"comfortable\">Comfortable</ToggleGroupItem>\n <ToggleGroupItem value=\"compact\">Compact</ToggleGroupItem>\n </ToggleGroup>\n </Stack>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n ghost\n </Text>\n <ToggleGroup aria-label=\"Row height\" defaultValue={['compact']} variant=\"ghost\">\n <ToggleGroupItem value=\"comfortable\">Comfortable</ToggleGroupItem>\n <ToggleGroupItem value=\"compact\">Compact</ToggleGroupItem>\n </ToggleGroup>\n </Stack>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n chips\n </Text>\n <ToggleGroup\n aria-label=\"Product categories\"\n defaultValue={['packaging', 'pallets']}\n multiple\n variant=\"chips\"\n >\n <ToggleGroupItem value=\"hardware\">Hardware</ToggleGroupItem>\n <ToggleGroupItem value=\"packaging\">Packaging</ToggleGroupItem>\n <ToggleGroupItem value=\"pallets\">Pallets</ToggleGroupItem>\n <ToggleGroupItem value=\"labels\">Labels</ToggleGroupItem>\n <ToggleGroupItem value=\"safety\">Safety gear</ToggleGroupItem>\n <ToggleGroupItem value=\"cleaning\">Cleaning</ToggleGroupItem>\n </ToggleGroup>\n </Stack>\n </Stack>\n );\n}\n",
494
+ "verdict": "example"
431
495
  }
432
496
  ]
433
497
  }
@@ -11,14 +11,21 @@ import { ToggleGroup, ToggleGroupDefaultsProvider, ToggleGroupItem } from '@slot
11
11
 
12
12
  ## Minimal example
13
13
 
14
- Excerpt — not a complete module
14
+ Example
15
15
 
16
16
  ```tsx
17
- <ToggleGroup aria-label="Chart period" defaultValue={['week']}>
18
- <ToggleGroupItem value="day">Day</ToggleGroupItem>
19
- <ToggleGroupItem value="week">Week</ToggleGroupItem>
20
- <ToggleGroupItem value="month">Month</ToggleGroupItem>
21
- </ToggleGroup>;
17
+ import { ToggleGroup, ToggleGroupItem } from '@slotted/react/toggle-group';
18
+
19
+ export default function ToggleGroupBasic() {
20
+ return (
21
+ <ToggleGroup aria-label="Revenue period" defaultValue={['week']}>
22
+ <ToggleGroupItem value="day">Day</ToggleGroupItem>
23
+ <ToggleGroupItem value="week">Week</ToggleGroupItem>
24
+ <ToggleGroupItem value="month">Month</ToggleGroupItem>
25
+ <ToggleGroupItem value="quarter">Quarter</ToggleGroupItem>
26
+ </ToggleGroup>
27
+ );
28
+ }
22
29
  ```
23
30
 
24
31
  ## Anatomy
@@ -60,7 +67,7 @@ Excerpt — not a complete module
60
67
  | Name | Payload | When |
61
68
  | --- | --- | --- |
62
69
  | `onValueChange` | `(value: readonly string[], request: ChangeRequest<readonly string[]>)` | Before the value moves. The request carries the new array, the array it replaces, the reason — pointer or keyboard — the originating event, and cancel(), which refuses the move before anything commits. Nothing is emitted for a value equal to the one the group already holds. |
63
- | `onClick, onFocus, onBlur, on each item` | `the element’s own events` | Whenever that item’s button fires them. The family composes with a consumer’s handler rather than replacing it: the consumer’s runs first, and always runs. Calling preventDefault() in onClick stops the toggle as well. |
70
+ | `onClick, onFocus, onBlur, on each item` | `the element’s own events` | Whenever that item’s button fires them. ToggleGroupItem composes with the application’s handler rather than replacing it: the application’s runs first, and always runs. Calling preventDefault() in onClick stops the toggle as well. |
64
71
 
65
72
  ## Axes and defaults
66
73
 
@@ -73,9 +80,9 @@ Excerpt — not a complete module
73
80
  ## Rules
74
81
 
75
82
  - There is no APG pattern called “toggle group”. The container is a group, each item is the Button pattern’s toggle button (w3.org/WAI/ARIA/apg/patterns/button/), and the movement between them is the Toolbar pattern’s roving tabindex (w3.org/WAI/ARIA/apg/patterns/toolbar/). Citing one and implying the other is how a family ends up with half a keyboard.
76
- - So the arrows move focus and never toggle, which is the one place this family and segmented-control genuinely differ and the one a reader feels. Space and Enter turn the focused item on or off; Home and End reach the ends; a horizontal group ignores the cross axis so the page keeps scrolling with focus inside it.
83
+ - So the arrows move focus and never toggle, which is the one place toggle group and segmented-control genuinely differ and the one a reader feels. Space and Enter turn the focused item on or off; Home and End reach the ends; a horizontal group ignores the cross axis so the page keeps scrolling with focus inside it.
77
84
  - aria-pressed is written in both states, so an item is announced as a toggle rather than as a button that happens to be pressed — and the label never changes with the state, which the Button pattern calls critical. An item with only a mark takes its name from an aria-label the consumer writes.
78
- - Inside a toolbar the group gives its keyboard up: a bar is already one tab stop with arrow navigation across every control it holds. The bar is found in the DOM by its public identifier rather than through an imported context, so neither family depends on the other; rovingFocus states it outright for a bar this library did not write.
85
+ - Inside a toolbar the group gives its keyboard up: a bar is already one tab stop with arrow navigation across every control it holds. The bar is found in the DOM by its public identifier rather than through an imported context, so neither depends on the other; rovingFocus states it outright for a bar this library did not write.
79
86
  - disabled is the native attribute, because that is also what makes the browser refuse focus and what makes the ring skip the item. The group is not a form control: a set of choices a form submits is checkbox-group for many and segmented-control for one.
80
87
  - The target is the item itself, never narrower than it is tall, so the WCAG 2.2 minimum of 24 by 24 holds at the smallest step and the tightest density — and the theme grows every control to 44 under a coarse pointer.
81
88
 
@@ -85,176 +92,4 @@ Excerpt — not a complete module
85
92
 
86
93
  ## Examples
87
94
 
88
- ### One at a time, several at once, or none
89
-
90
- The value is an array in both modes: multiple caps it at every item rather than at one. Press the item that is already on — the set empties, unless deselectable says it may not.
91
-
92
- Excerpt — not a complete module
93
-
94
- ```tsx
95
- <ToggleGroup aria-label="Text style" defaultValue={['bold', 'italic']} multiple>
96
- <ToggleGroupItem value="bold">Bold</ToggleGroupItem>
97
- <ToggleGroupItem value="italic">Italic</ToggleGroupItem>
98
- </ToggleGroup>;
99
-
100
- <ToggleGroup aria-label="Period" defaultValue={['week']} deselectable={false}>
101
- <ToggleGroupItem value="week">Week</ToggleGroupItem>
102
- <ToggleGroupItem value="month">Month</ToggleGroupItem>
103
- </ToggleGroup>;
104
- ```
105
-
106
- ### Framed, or bare
107
-
108
- outline draws the bar’s own edge; ghost draws none, for a bar that sits inside something already framed — a toolbar, a card header. The color of an item that is on is the same in both.
109
-
110
- Excerpt — not a complete module
111
-
112
- ```tsx
113
- <ToggleGroup aria-label="Density" defaultValue={['compact']} variant="ghost">
114
- <ToggleGroupItem value="comfortable">Comfortable</ToggleGroupItem>
115
- <ToggleGroupItem value="compact">Compact</ToggleGroupItem>
116
- </ToggleGroup>;
117
- ```
118
-
119
- ### The three control steps
120
-
121
- Each step reads the control scale, so a bar is exactly as tall as the text field and the button beside it at every size and at every density.
122
-
123
- Excerpt — not a complete module
124
-
125
- ```tsx
126
- <ToggleGroup aria-label="Sorting" defaultValue={['newest']} size="sm">
127
- <ToggleGroupItem value="newest">Newest</ToggleGroupItem>
128
- <ToggleGroupItem value="oldest">Oldest</ToggleGroupItem>
129
- </ToggleGroup>;
130
- ```
131
-
132
- ### Along the line, or down the page
133
-
134
- A vertical bar moves with ArrowUp and ArrowDown and writes aria-orientation; a horizontal one leaves the cross axis to the page, so scrolling still works with focus inside the group.
135
-
136
- Excerpt — not a complete module
137
-
138
- ```tsx
139
- <ToggleGroup aria-label="Alignment" defaultValue={['center']} orientation="vertical">
140
- <ToggleGroupItem value="start">Start</ToggleGroupItem>
141
- <ToggleGroupItem value="center">Center</ToggleGroupItem>
142
- <ToggleGroupItem value="end">End</ToggleGroupItem>
143
- </ToggleGroup>;
144
- ```
145
-
146
- ### Joined, or spaced apart
147
-
148
- A joined bar overlaps its items by one border so the shared column holds one line rather than two — which is what keeps the edge even at 110%, 150% and 175% zoom.
149
-
150
- Excerpt — not a complete module
151
-
152
- ```tsx
153
- <ToggleGroup aria-label="Camadas" attached={false} defaultValue={['roads']} multiple>
154
- <ToggleGroupItem value="roads">Ruas</ToggleGroupItem>
155
- <ToggleGroupItem value="terrain">Relevo</ToggleGroupItem>
156
- </ToggleGroup>;
157
- ```
158
-
159
- ### Every state the contract declares
160
-
161
- Hover, focus, press, on, unavailable, and unavailable while on — that last one keeps both facts, because the state a reader cannot change is still one they have to be able to read.
162
-
163
- Excerpt — not a complete module
164
-
165
- ```tsx
166
- <ToggleGroup aria-label="Formato" defaultValue={['pdf']}>
167
- <ToggleGroupItem value="csv">CSV</ToggleGroupItem>
168
- <ToggleGroupItem disabled value="xlsx">
169
- XLSX
170
- </ToggleGroupItem>
171
- <ToggleGroupItem disabled value="pdf">
172
- PDF
173
- </ToggleGroupItem>
174
- </ToggleGroup>;
175
- ```
176
-
177
- ### Marks without words
178
-
179
- An item with only a mark draws square and takes its accessible name from aria-label, which is the one thing the family cannot supply for a consumer’s own artwork.
180
-
181
- Excerpt — not a complete module
182
-
183
- ```tsx
184
- <ToggleGroup aria-label="Text style" defaultValue={['bold']} multiple>
185
- <ToggleGroupItem aria-label="Bold" icon={<BoldIcon />} value="bold" />
186
- <ToggleGroupItem aria-label="Italic" icon={<ItalicIcon />} value="italic" />
187
- </ToggleGroup>;
188
- ```
189
-
190
- ### Content width, or the whole line
191
-
192
- Left alone the bar is as wide as its labels; fullWidth makes the items share the line. Either way an item gives way rather than pushing the layout, and its label clips at the ellipsis.
193
-
194
- Excerpt — not a complete module
195
-
196
- ```tsx
197
- <ToggleGroup aria-label="Billing" defaultValue={['monthly']} fullWidth>
198
- <ToggleGroupItem value="monthly">Monthly</ToggleGroupItem>
199
- <ToggleGroupItem value="yearly">Yearly</ToggleGroupItem>
200
- </ToggleGroup>;
201
- ```
202
-
203
- ### Inside a toolbar, the bar owns the keyboard
204
-
205
- A toolbar is already one tab stop with arrow navigation across every control it holds, so the group stands down rather than putting a second stop inside the first. Nothing has to be passed.
206
-
207
- Excerpt — not a complete module
208
-
209
- ```tsx
210
- <Toolbar aria-label="Formatting">
211
- <ToggleGroup aria-label="Text style" defaultValue={['bold']} multiple variant="ghost">
212
- <ToggleGroupItem aria-label="Bold" icon={<BoldIcon />} value="bold" />
213
- <ToggleGroupItem aria-label="Italic" icon={<ItalicIcon />} value="italic" />
214
- </ToggleGroup>
215
- <ToolbarSeparator />
216
- <Button size="sm" tone="secondary" variant="ghost">
217
- Publicar
218
- </Button>
219
- </Toolbar>;
220
- ```
221
-
222
- ### Content the family did not choose
223
-
224
- A label nine words long, one unbroken token, and a right-to-left string inside a left-to-right page. Each clips at the ellipsis and keeps its whole text in the DOM.
225
-
226
- Excerpt — not a complete module
227
-
228
- ```tsx
229
- <ToggleGroup aria-label="Frequency" defaultValue={['now']} fullWidth>
230
- <ToggleGroupItem value="now">Immediately</ToggleGroupItem>
231
- <ToggleGroupItem value="digest">Once a day, in the evening digest</ToggleGroupItem>
232
- </ToggleGroup>;
233
- ```
234
-
235
- ### Substituting an element, and setting the defaults once
236
-
237
- render hands either root every attribute it was going to write, so a bar can be a real ul with each item an li; the provider states the axes once for a whole application.
238
-
239
- Excerpt — not a complete module
240
-
241
- ```tsx
242
- <ToggleGroupDefaultsProvider size="sm" variant="ghost">
243
- <ToggleGroup aria-label="Camadas" render={(props) => <nav {...props} />}>
244
- <ToggleGroupItem value="roads">Ruas</ToggleGroupItem>
245
- </ToggleGroup>
246
- </ToggleGroupDefaultsProvider>;
247
- ```
248
-
249
- ### The keyboard, key by key
250
-
251
- Tab reaches the group once; the arrows move focus and never toggle; Home and End reach the ends; Space and Enter turn the focused item on and off. An item is a button, and that is why.
252
-
253
- Excerpt — not a complete module
254
-
255
- ```tsx
256
- <ToggleGroup aria-label="Period" defaultValue={['week']} loop={false}>
257
- <ToggleGroupItem value="day">Day</ToggleGroupItem>
258
- <ToggleGroupItem value="week">Week</ToggleGroupItem>
259
- </ToggleGroup>;
260
- ```
95
+ See [toggle-group.examples.md](./toggle-group.examples.md).