@redvars/peacock 3.10.1 → 3.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (325) hide show
  1. package/dist/BaseInput-CV0pZgSb.js +58 -0
  2. package/dist/BaseInput-CV0pZgSb.js.map +1 -0
  3. package/dist/app-bar.js +16 -16
  4. package/dist/assets/styles.css +1 -1
  5. package/dist/assets/styles.css.map +1 -1
  6. package/dist/assets/theme.d.ts +66 -0
  7. package/dist/assets/theme.js +134 -0
  8. package/dist/assets/tokens.css +1 -1
  9. package/dist/assets/tokens.css.map +1 -1
  10. package/dist/base-progress-CLZTRveO.js +33 -0
  11. package/dist/base-progress-CLZTRveO.js.map +1 -0
  12. package/dist/bottom-sheet.js +1 -1
  13. package/dist/button-group.js +9 -7
  14. package/dist/button-group.js.map +1 -1
  15. package/dist/button.js +225 -187
  16. package/dist/button.js.map +1 -1
  17. package/dist/cb-divider.js +7 -6
  18. package/dist/cb-divider.js.map +1 -1
  19. package/dist/cb-group-base-D9gv7SDY.js +114 -0
  20. package/dist/cb-group-base-D9gv7SDY.js.map +1 -0
  21. package/dist/cb-group-base-DsX_2aFl.js +325 -0
  22. package/dist/cb-group-base-DsX_2aFl.js.map +1 -0
  23. package/dist/cb-group.js +96 -0
  24. package/dist/cb-group.js.map +1 -0
  25. package/dist/cb-rule.js +212 -0
  26. package/dist/cb-rule.js.map +1 -0
  27. package/dist/{chart-bar-CapLbc2e.js → chart-bar-D5dGFJfK.js} +2 -2
  28. package/dist/{chart-bar-CapLbc2e.js.map → chart-bar-D5dGFJfK.js.map} +1 -1
  29. package/dist/chart-bar.js +1 -1
  30. package/dist/chart-stacked-bar.js +1 -1
  31. package/dist/checkbox.js +78 -53
  32. package/dist/checkbox.js.map +1 -1
  33. package/dist/chip-set.js +52 -0
  34. package/dist/chip-set.js.map +1 -0
  35. package/dist/chip.js +8 -6
  36. package/dist/chip.js.map +1 -1
  37. package/dist/circular-progress.js +177 -0
  38. package/dist/circular-progress.js.map +1 -0
  39. package/dist/code-editor.js +129 -72
  40. package/dist/code-editor.js.map +1 -1
  41. package/dist/code-highlighter.js +2 -38
  42. package/dist/code-highlighter.js.map +1 -1
  43. package/dist/color-field.js +309 -0
  44. package/dist/color-field.js.map +1 -0
  45. package/dist/color-picker.js +26 -15
  46. package/dist/color-picker.js.map +1 -1
  47. package/dist/condition-builder.js +90 -35
  48. package/dist/condition-builder.js.map +1 -1
  49. package/dist/copy-to-clipboard-upGx-Ueo.js +39 -0
  50. package/dist/copy-to-clipboard-upGx-Ueo.js.map +1 -0
  51. package/dist/custom-elements-jsdocs.json +1140 -398
  52. package/dist/custom-elements.json +9065 -3989
  53. package/dist/date-picker.js +241 -0
  54. package/dist/date-picker.js.map +1 -0
  55. package/dist/{element-internals-2CMts_0M.js → delegate-py-Ets8N.js} +2 -43
  56. package/dist/delegate-py-Ets8N.js.map +1 -0
  57. package/dist/element-internals-QME0yEz4.js +43 -0
  58. package/dist/element-internals-QME0yEz4.js.map +1 -0
  59. package/dist/fab.js +51 -49
  60. package/dist/fab.js.map +1 -1
  61. package/dist/field.js +27 -0
  62. package/dist/field.js.map +1 -1
  63. package/dist/flow.js +5 -5
  64. package/dist/form-associated-Bhwwr6dT.js +162 -0
  65. package/dist/form-associated-Bhwwr6dT.js.map +1 -0
  66. package/dist/{form-associated-BXADnjOB.js → form-submitter-DPI4L6gj.js} +3 -159
  67. package/dist/form-submitter-DPI4L6gj.js.map +1 -0
  68. package/dist/html-editor.js +3 -1
  69. package/dist/html-editor.js.map +1 -1
  70. package/dist/icon-button.js +195 -156
  71. package/dist/icon-button.js.map +1 -1
  72. package/dist/image.js +2 -2
  73. package/dist/index.js +36 -11
  74. package/dist/index.js.map +1 -1
  75. package/dist/input.js +259 -0
  76. package/dist/input.js.map +1 -0
  77. package/dist/item.js +2 -1
  78. package/dist/item.js.map +1 -1
  79. package/dist/linear-progress.js +192 -0
  80. package/dist/linear-progress.js.map +1 -0
  81. package/dist/{list-AdO-PUq_.js → list-item.js} +12 -222
  82. package/dist/list-item.js.map +1 -0
  83. package/dist/list.js +225 -6
  84. package/dist/list.js.map +1 -1
  85. package/dist/loader-full.js +31 -8
  86. package/dist/loader-full.js.map +1 -1
  87. package/dist/loader.js +58 -25
  88. package/dist/loader.js.map +1 -1
  89. package/dist/markdown-editor.js +5 -3
  90. package/dist/markdown-editor.js.map +1 -1
  91. package/dist/menu-item.js +30 -30
  92. package/dist/navigation-bar-item.js +41 -0
  93. package/dist/navigation-bar-item.js.map +1 -0
  94. package/dist/navigation-bar.js +128 -0
  95. package/dist/navigation-bar.js.map +1 -0
  96. package/dist/navigation-drawer-item.js +236 -0
  97. package/dist/navigation-drawer-item.js.map +1 -0
  98. package/dist/navigation-drawer.js +293 -0
  99. package/dist/navigation-drawer.js.map +1 -0
  100. package/dist/navigation-rail.js +1 -1
  101. package/dist/number-field.js +280 -0
  102. package/dist/number-field.js.map +1 -0
  103. package/dist/pagination.js +1 -1
  104. package/dist/radio-group.js +209 -0
  105. package/dist/radio-group.js.map +1 -0
  106. package/dist/radio.js +47 -37
  107. package/dist/radio.js.map +1 -1
  108. package/dist/segmented-button-group.js +12 -0
  109. package/dist/segmented-button-group.js.map +1 -1
  110. package/dist/segmented-button.js +10 -6
  111. package/dist/segmented-button.js.map +1 -1
  112. package/dist/select.js +653 -0
  113. package/dist/select.js.map +1 -0
  114. package/dist/side-sheet.js +1 -1
  115. package/dist/sidebar-menu-item.js +273 -0
  116. package/dist/sidebar-menu-item.js.map +1 -0
  117. package/dist/sidebar-menu.js +193 -0
  118. package/dist/sidebar-menu.js.map +1 -0
  119. package/dist/sidebar-sub-menu.js +301 -0
  120. package/dist/sidebar-sub-menu.js.map +1 -0
  121. package/dist/slider.js +76 -24
  122. package/dist/slider.js.map +1 -1
  123. package/dist/snackbar.js +3 -3
  124. package/dist/snackbar.js.map +1 -1
  125. package/dist/split-button.js +2 -2
  126. package/dist/src/__internal/utils/size.d.ts +9 -0
  127. package/dist/src/button/ButtonTypes.d.ts +1 -1
  128. package/dist/src/checkbox/checkbox.d.ts +28 -22
  129. package/dist/src/chip/chip/chip.d.ts +3 -0
  130. package/dist/src/chip/tag/tag.d.ts +5 -1
  131. package/dist/src/code-editor/code-editor.d.ts +37 -10
  132. package/dist/src/color-field/color-field.d.ts +55 -0
  133. package/dist/src/color-field/index.d.ts +1 -0
  134. package/dist/src/color-picker/color-picker.d.ts +1 -1
  135. package/dist/src/condition-builder/cb-divider.d.ts +3 -1
  136. package/dist/src/condition-builder/cb-drag.d.ts +10 -0
  137. package/dist/src/condition-builder/cb-group-base.d.ts +59 -0
  138. package/dist/src/condition-builder/cb-group.d.ts +34 -0
  139. package/dist/src/condition-builder/cb-rule.d.ts +32 -0
  140. package/dist/src/condition-builder/cb-types.d.ts +13 -0
  141. package/dist/src/condition-builder/condition-builder.d.ts +35 -14
  142. package/dist/src/condition-builder/index.d.ts +3 -3
  143. package/dist/src/date-picker/date-picker.d.ts +0 -1
  144. package/dist/src/index.d.ts +6 -4
  145. package/dist/src/input/BaseInput.d.ts +21 -3
  146. package/dist/src/input/input.d.ts +15 -7
  147. package/dist/src/navigation-bar/index.d.ts +2 -0
  148. package/dist/src/navigation-bar/navigation-bar-item.d.ts +23 -0
  149. package/dist/src/navigation-bar/navigation-bar.d.ts +44 -0
  150. package/dist/src/navigation-drawer/index.d.ts +2 -0
  151. package/dist/src/navigation-drawer/navigation-drawer-item.d.ts +48 -0
  152. package/dist/src/navigation-drawer/navigation-drawer.d.ts +70 -0
  153. package/dist/src/number-field/number-field.d.ts +0 -1
  154. package/dist/src/radio/index.d.ts +1 -0
  155. package/dist/src/radio/radio-group.d.ts +50 -0
  156. package/dist/src/radio/radio.d.ts +18 -18
  157. package/dist/src/segmented-button/segmented-button-group.d.ts +5 -0
  158. package/dist/src/segmented-button/segmented-button.d.ts +2 -1
  159. package/dist/src/select/select.d.ts +6 -0
  160. package/dist/src/slider/slider.d.ts +14 -5
  161. package/dist/src/switch/switch.d.ts +22 -26
  162. package/dist/src/tabs/tabs.d.ts +3 -0
  163. package/dist/src/textarea/textarea.d.ts +0 -1
  164. package/dist/src/time-picker/time-picker.d.ts +0 -1
  165. package/dist/src/toolbar/toolbar.d.ts +7 -4
  166. package/dist/src/url-field/url-field.d.ts +0 -1
  167. package/dist/svg.js +5 -5
  168. package/dist/switch.js +413 -0
  169. package/dist/switch.js.map +1 -0
  170. package/dist/tab.js +2 -1
  171. package/dist/tab.js.map +1 -1
  172. package/dist/tabs.js +10 -8
  173. package/dist/tabs.js.map +1 -1
  174. package/dist/tag.js +349 -0
  175. package/dist/tag.js.map +1 -0
  176. package/dist/test/code-editor.test.d.ts +1 -0
  177. package/dist/test/color-field.test.d.ts +1 -0
  178. package/dist/test/color-picker.test.d.ts +1 -0
  179. package/dist/test/condition-builder.test.d.ts +1 -0
  180. package/dist/test/field.test.d.ts +1 -0
  181. package/dist/test/form-controls.test.d.ts +1 -0
  182. package/dist/test/icon.test.d.ts +1 -1
  183. package/dist/test/input.test.d.ts +1 -0
  184. package/dist/test/navigation.test.d.ts +1 -0
  185. package/dist/test/segmented-button.test.d.ts +1 -0
  186. package/dist/test/slider.test.d.ts +1 -0
  187. package/dist/textarea.js +237 -0
  188. package/dist/textarea.js.map +1 -0
  189. package/dist/time-picker.js +241 -0
  190. package/dist/time-picker.js.map +1 -0
  191. package/dist/toolbar.js +26 -9
  192. package/dist/toolbar.js.map +1 -1
  193. package/dist/tsconfig.tsbuildinfo +1 -1
  194. package/dist/url-field.js +298 -0
  195. package/dist/url-field.js.map +1 -0
  196. package/package.json +29 -8
  197. package/readme.md +2 -2
  198. package/scss/tokens.css +175 -18
  199. package/src/__internal/utils/size.ts +23 -0
  200. package/src/app-bar/app-bar.scss +4 -16
  201. package/src/bottom-sheet/bottom-sheet.scss +1 -1
  202. package/src/button/ButtonTypes.ts +2 -0
  203. package/src/button/button/button-base.scss +84 -84
  204. package/src/button/button/button-colors.scss +14 -2
  205. package/src/button/button/button-layers.scss +71 -71
  206. package/src/button/button/button-shapes.scss +2 -2
  207. package/src/button/button/button-sizes.scss +35 -35
  208. package/src/button/button/button.scss +1 -1
  209. package/src/button/button/button.ts +1 -2
  210. package/src/button/button-group/button-group.scss +5 -5
  211. package/src/button/fab/fab-sizes.scss +15 -15
  212. package/src/button/fab/fab.scss +32 -32
  213. package/src/button/icon-button/icon-button-sizes.scss +7 -7
  214. package/src/chart-bar/chart-bar.scss +1 -1
  215. package/src/checkbox/checkbox.scss +7 -6
  216. package/src/checkbox/checkbox.ts +92 -40
  217. package/src/chip/chip/chip.ts +8 -5
  218. package/src/chip/chip-set/chip-set.ts +2 -0
  219. package/src/chip/tag/tag-colors.scss +1 -1
  220. package/src/chip/tag/tag-sizes.scss +9 -0
  221. package/src/chip/tag/tag.scss +1 -1
  222. package/src/chip/tag/tag.ts +20 -9
  223. package/src/code-editor/code-editor.scss +8 -3
  224. package/src/code-editor/code-editor.ts +148 -79
  225. package/src/code-highlighter/code-highlighter.scss +1 -1
  226. package/src/color-field/color-field.scss +48 -0
  227. package/src/color-field/color-field.ts +239 -0
  228. package/src/color-field/index.ts +1 -0
  229. package/src/color-picker/color-picker.scss +33 -15
  230. package/src/color-picker/color-picker.ts +2 -1
  231. package/src/condition-builder/cb-divider.scss +4 -5
  232. package/src/condition-builder/cb-divider.ts +3 -1
  233. package/src/condition-builder/cb-drag.ts +35 -0
  234. package/src/condition-builder/cb-group-base.scss +97 -0
  235. package/src/condition-builder/cb-group-base.ts +335 -0
  236. package/src/condition-builder/cb-group.scss +21 -0
  237. package/src/condition-builder/cb-group.ts +72 -0
  238. package/src/condition-builder/cb-rule.scss +90 -0
  239. package/src/condition-builder/cb-rule.ts +129 -0
  240. package/src/condition-builder/cb-types.ts +16 -0
  241. package/src/condition-builder/condition-builder.scss +12 -9
  242. package/src/condition-builder/condition-builder.ts +77 -17
  243. package/src/condition-builder/index.ts +7 -3
  244. package/src/date-picker/date-picker.ts +2 -3
  245. package/src/field/field.scss +34 -0
  246. package/src/flow/flow.scss +5 -5
  247. package/src/image/image.scss +2 -2
  248. package/src/index.ts +14 -6
  249. package/src/input/BaseInput.ts +54 -4
  250. package/src/input/input.ts +104 -79
  251. package/src/list/list-item.ts +2 -0
  252. package/src/loader.ts +34 -19
  253. package/src/markdown-editor/markdown-editor.scss +2 -2
  254. package/src/menu/menu-item/menu-item.scss +30 -30
  255. package/src/navigation-bar/index.ts +2 -0
  256. package/src/navigation-bar/navigation-bar-item.ts +25 -0
  257. package/src/navigation-bar/navigation-bar.scss +27 -0
  258. package/src/navigation-bar/navigation-bar.ts +96 -0
  259. package/src/navigation-drawer/index.ts +2 -0
  260. package/src/navigation-drawer/navigation-drawer-item.scss +82 -0
  261. package/src/navigation-drawer/navigation-drawer-item.ts +133 -0
  262. package/src/navigation-drawer/navigation-drawer.scss +99 -0
  263. package/src/navigation-drawer/navigation-drawer.ts +196 -0
  264. package/src/navigation-rail/navigation-rail.scss +1 -1
  265. package/src/number-field/number-field.ts +2 -3
  266. package/src/pagination/pagination.scss +1 -1
  267. package/src/progress/circular-progress/circular-progress.ts +2 -0
  268. package/src/progress/linear-progress/linear-progress.ts +2 -0
  269. package/src/radio/index.ts +1 -0
  270. package/src/radio/radio-group.scss +39 -0
  271. package/src/radio/radio-group.ts +167 -0
  272. package/src/radio/radio.ts +74 -31
  273. package/src/segmented-button/segmented-button-group.ts +12 -0
  274. package/src/segmented-button/segmented-button.ts +12 -6
  275. package/src/select/select.ts +21 -1
  276. package/src/side-sheet/side-sheet.scss +1 -1
  277. package/src/sidebar-menu/sidebar-menu-item.scss +1 -1
  278. package/src/sidebar-menu/sidebar-menu-item.ts +2 -0
  279. package/src/sidebar-menu/sidebar-menu.ts +2 -0
  280. package/src/sidebar-menu/sidebar-sub-menu.scss +1 -1
  281. package/src/sidebar-menu/sidebar-sub-menu.ts +2 -0
  282. package/src/slider/slider.scss +3 -3
  283. package/src/slider/slider.ts +119 -31
  284. package/src/snackbar/snackbar.ts +3 -3
  285. package/src/split-button/split-button-colors.scss +2 -2
  286. package/src/svg/svg.scss +5 -5
  287. package/src/switch/switch.scss +0 -1
  288. package/src/switch/switch.ts +82 -47
  289. package/src/tabs/tab.scss +2 -1
  290. package/src/tabs/tabs.ts +14 -8
  291. package/src/textarea/textarea.ts +2 -3
  292. package/src/time-picker/time-picker.ts +2 -3
  293. package/src/toolbar/toolbar.scss +4 -4
  294. package/src/toolbar/toolbar.ts +12 -5
  295. package/src/url-field/url-field.ts +2 -3
  296. package/dist/BaseInput-CU1zZYKc.js +0 -27
  297. package/dist/BaseInput-CU1zZYKc.js.map +0 -1
  298. package/dist/brand-loader.js +0 -358
  299. package/dist/brand-loader.js.map +0 -1
  300. package/dist/cb-compound-expression.js +0 -133
  301. package/dist/cb-compound-expression.js.map +0 -1
  302. package/dist/cb-expression.js +0 -78
  303. package/dist/cb-expression.js.map +0 -1
  304. package/dist/cb-predicate.js +0 -141
  305. package/dist/cb-predicate.js.map +0 -1
  306. package/dist/element-internals-2CMts_0M.js.map +0 -1
  307. package/dist/form-associated-BXADnjOB.js.map +0 -1
  308. package/dist/list-AdO-PUq_.js.map +0 -1
  309. package/dist/select-DkyRqUTI.js +0 -3955
  310. package/dist/select-DkyRqUTI.js.map +0 -1
  311. package/dist/src/brand-loader/brand-loader.d.ts +0 -33
  312. package/dist/src/brand-loader/index.d.ts +0 -2
  313. package/dist/src/condition-builder/cb-compound-expression.d.ts +0 -30
  314. package/dist/src/condition-builder/cb-expression.d.ts +0 -30
  315. package/dist/src/condition-builder/cb-predicate.d.ts +0 -29
  316. package/src/brand-loader/brand-loader.scss +0 -270
  317. package/src/brand-loader/brand-loader.ts +0 -115
  318. package/src/brand-loader/index.ts +0 -2
  319. package/src/condition-builder/cb-compound-expression.scss +0 -41
  320. package/src/condition-builder/cb-compound-expression.ts +0 -79
  321. package/src/condition-builder/cb-expression.scss +0 -13
  322. package/src/condition-builder/cb-expression.ts +0 -48
  323. package/src/condition-builder/cb-predicate.scss +0 -35
  324. package/src/condition-builder/cb-predicate.ts +0 -101
  325. /package/dist/test/{brand-loader.test.d.ts → button.test.d.ts} +0 -0
@@ -1,4 +1,5 @@
1
1
  import { html } from 'lit';
2
+ import IndividualComponent from '@/IndividualComponent.js';
2
3
  import { classMap } from 'lit/directives/class-map.js';
3
4
  import { styleMap } from 'lit/directives/style-map.js';
4
5
  import styles from './linear-progress.scss';
@@ -16,6 +17,7 @@ import { BaseProgress } from '../base-progress.js';
16
17
  * <wc-linear-progress value="30" style="width:10rem"></wc-linear-progress>
17
18
  * ```
18
19
  */
20
+ @IndividualComponent
19
21
  export class LinearProgress extends BaseProgress {
20
22
  // Lit components use static styles for better performance
21
23
  static styles = [styles];
@@ -1 +1,2 @@
1
1
  export { Radio } from './radio.js';
2
+ export { RadioGroup } from './radio-group.js';
@@ -0,0 +1,39 @@
1
+ @use '../../scss/mixin';
2
+
3
+ @include mixin.base-styles;
4
+
5
+ :host {
6
+ display: block;
7
+ }
8
+
9
+ .radio-group {
10
+ display: flex;
11
+ flex-direction: column;
12
+ gap: var(--spacing-100);
13
+
14
+ .label {
15
+ @include mixin.get-typography(body-small);
16
+ color: var(--color-on-surface-variant);
17
+
18
+ .required {
19
+ color: var(--color-error);
20
+ padding-inline-start: var(--spacing-025);
21
+ }
22
+ }
23
+
24
+ .radios {
25
+ display: flex;
26
+ flex-direction: column;
27
+ gap: var(--radio-group-gap, var(--spacing-100));
28
+ }
29
+
30
+ &.orientation-horizontal .radios {
31
+ flex-direction: row;
32
+ flex-wrap: wrap;
33
+ gap: var(--radio-group-gap, var(--spacing-300));
34
+ }
35
+
36
+ &.disabled .label {
37
+ opacity: 0.38;
38
+ }
39
+ }
@@ -0,0 +1,167 @@
1
+ import { html, LitElement, nothing, PropertyValues } from 'lit';
2
+ import { property } from 'lit/decorators.js';
3
+ import { classMap } from 'lit/directives/class-map.js';
4
+ import IndividualComponent from '@/IndividualComponent.js';
5
+ import type { Radio } from './radio.js';
6
+ import styles from './radio-group.scss';
7
+
8
+ let radioGroupCount = 0;
9
+
10
+ /**
11
+ * @label Radio Group
12
+ * @tag wc-radio-group
13
+ * @rawTag radio-group
14
+ * @summary Groups radios under one label, one name and one value.
15
+ * @overview
16
+ * <p>Radio group gives its <code>wc-radio</code> children a shared <code>name</code> (its own, or a
17
+ * generated one), so only one can be checked. Its <code>value</code> is the value of the checked radio,
18
+ * and setting it checks the matching radio.</p>
19
+ * <p>The radios stay form-associated, so the group submits once, through the checked radio.</p>
20
+ *
21
+ * @fires {CustomEvent<{value: string}>} change - Dispatched when the user checks a different radio. The group swallows the radios' own `change` events.
22
+ *
23
+ * @cssprop --radio-group-gap - Space between radios. Defaults to `--spacing-100`.
24
+ *
25
+ * @example
26
+ * ```html
27
+ * <wc-radio-group label="Size" name="size" value="md">
28
+ * <wc-radio value="sm" label="Small"></wc-radio>
29
+ * <wc-radio value="md" label="Medium"></wc-radio>
30
+ * <wc-radio value="lg" label="Large"></wc-radio>
31
+ * </wc-radio-group>
32
+ * ```
33
+ * @tags input, form
34
+ */
35
+ @IndividualComponent
36
+ export class RadioGroup extends LitElement {
37
+ // ── Static ───────────────────────────────────────────────────────────────
38
+
39
+ static styles = [styles];
40
+
41
+ // ── Properties ───────────────────────────────────────────────────────────
42
+
43
+ /** Name given to every radio in the group, and submitted with forms. Generated when empty. */
44
+ @property({ type: String, reflect: true })
45
+ name: string = '';
46
+
47
+ /** Value of the checked radio. Setting it checks the radio with that value. */
48
+ @property({ type: String })
49
+ value: string = '';
50
+
51
+ /** Group label, shown above the radios and used as the accessible name. */
52
+ @property({ type: String })
53
+ label: string = '';
54
+
55
+ /** Lays the radios out in a column (default) or a row. */
56
+ @property({ type: String, reflect: true })
57
+ orientation: 'vertical' | 'horizontal' = 'vertical';
58
+
59
+ /** Disables every radio in the group. */
60
+ @property({ type: Boolean, reflect: true })
61
+ disabled: boolean = false;
62
+
63
+ /** Marks the group as required. */
64
+ @property({ type: Boolean, reflect: true })
65
+ required: boolean = false;
66
+
67
+ // ── Private fields ───────────────────────────────────────────────────────
68
+
69
+ private readonly generatedName = `wc-radio-group-${(radioGroupCount += 1)}`;
70
+
71
+ // ── Lifecycle ────────────────────────────────────────────────────────────
72
+
73
+ override connectedCallback() {
74
+ super.connectedCallback();
75
+ this.addEventListener('change', this.handleRadioChange, { capture: true });
76
+ }
77
+
78
+ override disconnectedCallback() {
79
+ this.removeEventListener('change', this.handleRadioChange, {
80
+ capture: true,
81
+ });
82
+ super.disconnectedCallback();
83
+ }
84
+
85
+ protected override updated(changed: PropertyValues<this>) {
86
+ if (
87
+ changed.has('name') ||
88
+ changed.has('value') ||
89
+ changed.has('disabled')
90
+ ) {
91
+ this.syncRadios();
92
+ }
93
+ }
94
+
95
+ // ── Private methods ──────────────────────────────────────────────────────
96
+
97
+ private getRadios(): Radio[] {
98
+ return Array.from(this.querySelectorAll<Radio>('wc-radio'));
99
+ }
100
+
101
+ /** Pushes the group's name, value and disabled state down to its radios. */
102
+ private syncRadios = () => {
103
+ const radios = this.getRadios();
104
+ const name = this.name || this.generatedName;
105
+
106
+ for (const radio of radios) {
107
+ if (radio.name !== name) radio.name = name;
108
+ if (this.disabled) radio.disabled = true;
109
+ }
110
+
111
+ if (this.value) {
112
+ for (const radio of radios) radio.checked = radio.value === this.value;
113
+ } else {
114
+ // No value set: adopt the radio that was checked in markup.
115
+ this.value = radios.find(radio => radio.checked)?.value ?? '';
116
+ }
117
+ };
118
+
119
+ private handleRadioChange = (event: Event) => {
120
+ if (event.target === this) return;
121
+ const radio = (event.target as Element).closest?.(
122
+ 'wc-radio',
123
+ ) as Radio | null;
124
+ if (!radio) return;
125
+
126
+ // Capture phase: swallow the radio's `change` so listeners on the group and above see one
127
+ // `change`, the group's.
128
+ event.stopPropagation();
129
+ this.value = radio.value;
130
+ this.dispatchEvent(
131
+ new CustomEvent('change', {
132
+ detail: { value: this.value },
133
+ bubbles: true,
134
+ composed: true,
135
+ }),
136
+ );
137
+ };
138
+
139
+ // ── Render ───────────────────────────────────────────────────────────────
140
+
141
+ render() {
142
+ return html`
143
+ <div
144
+ class=${classMap({
145
+ 'radio-group': true,
146
+ [`orientation-${this.orientation}`]: true,
147
+ disabled: this.disabled,
148
+ })}
149
+ role="radiogroup"
150
+ aria-label=${this.label || nothing}
151
+ aria-required=${this.required ? 'true' : nothing}
152
+ aria-disabled=${this.disabled ? 'true' : nothing}
153
+ >
154
+ ${this.label
155
+ ? html`<div class="label" aria-hidden="true">
156
+ ${this.label}${this.required
157
+ ? html`<span class="required">*</span>`
158
+ : nothing}
159
+ </div>`
160
+ : nothing}
161
+ <div class="radios">
162
+ <slot @slotchange=${this.syncRadios}></slot>
163
+ </div>
164
+ </div>
165
+ `;
166
+ }
167
+ }
@@ -3,6 +3,14 @@ import { property, query, state } from 'lit/decorators.js';
3
3
  import { classMap } from 'lit/directives/class-map.js';
4
4
 
5
5
  import { spread } from '@/__internal/directive/spread.js';
6
+ import { mixinElementInternals } from '@/__internal/mixins/element-internals.js';
7
+ import {
8
+ type FormRestoreState,
9
+ type FormValue,
10
+ getFormState,
11
+ getFormValue,
12
+ mixinFormAssociated,
13
+ } from '@/__internal/mixins/form-associated.js';
6
14
 
7
15
  import styles from './radio.scss';
8
16
  import IndividualComponent from '@/IndividualComponent.js';
@@ -14,6 +22,9 @@ import IndividualComponent from '@/IndividualComponent.js';
14
22
  * @summary Allows selection of a single option from a set.
15
23
  * @overview
16
24
  * <p>Radio buttons follow the specifications with clear focus, hover, and selected states.</p>
25
+ * <p>Radios that share a <code>name</code> form a group. Wrap them in <code>wc-radio-group</code> to get a
26
+ * group label and a single <code>change</code> event for the whole set.</p>
27
+ * <p>The radio is form-associated: the checked radio submits its <code>value</code> under its <code>name</code>.</p>
17
28
  *
18
29
  * @cssprop --radio-size: Size of the outer radio circle.
19
30
  * @cssprop --radio-dot-size: Size of the inner dot when selected.
@@ -35,17 +46,19 @@ import IndividualComponent from '@/IndividualComponent.js';
35
46
  type RadioDirection = 1 | -1;
36
47
 
37
48
  @IndividualComponent
38
- export class Radio extends LitElement {
49
+ export class Radio extends mixinFormAssociated(
50
+ mixinElementInternals(LitElement),
51
+ ) {
52
+ // ── Static ───────────────────────────────────────────────────────────────
53
+
39
54
  private static readonly DIRECTION_NEXT: RadioDirection = 1;
55
+
40
56
  private static readonly DIRECTION_PREVIOUS: RadioDirection = -1;
41
57
 
42
58
  static styles = [styles];
43
59
 
44
- /**
45
- * The input field name for grouping radios.
46
- */
47
- @property({ type: String })
48
- name: string = '';
60
+ // ── Properties ───────────────────────────────────────────────────────────
61
+ // `name` (which groups radios) and `disabled` come from mixinFormAssociated.
49
62
 
50
63
  /**
51
64
  * The submitted value when this radio is selected.
@@ -77,18 +90,14 @@ export class Radio extends LitElement {
77
90
  @property({ type: Boolean, reflect: true })
78
91
  readonly: boolean = false;
79
92
 
80
- /**
81
- * If true, the user cannot interact with the radio. Defaults to `false`.
82
- */
83
- @property({ type: Boolean, reflect: true })
84
- disabled: boolean = false;
85
-
86
93
  /**
87
94
  * Configuration object for aria attributes.
88
95
  */
89
96
  @property({ type: Object })
90
97
  configAria: Record<string, string> = {};
91
98
 
99
+ // ── State ────────────────────────────────────────────────────────────────
100
+
92
101
  /** True while the radio container has keyboard focus. */
93
102
  @state()
94
103
  private hasFocus = false;
@@ -105,19 +114,24 @@ export class Radio extends LitElement {
105
114
  @state()
106
115
  private isGroupFocusTarget = false;
107
116
 
117
+ // ── Queries ──────────────────────────────────────────────────────────────
118
+
108
119
  @query('.container')
109
120
  private containerElement?: HTMLElement;
110
121
 
111
- @query('.input-native')
112
- private nativeElement?: HTMLInputElement;
113
-
114
- // ── Private fields ────────────────────────────────────────────────────────
122
+ // ── Private fields ───────────────────────────────────────────────────────
115
123
 
116
124
  /** Captured `tabindex` attribute value forwarded to the inner container. */
117
125
  private tabindex?: number;
118
126
 
127
+ /** `checked` when first connected; `form.reset()` returns to it. */
128
+ private defaultChecked?: boolean;
129
+
130
+ // ── Lifecycle ────────────────────────────────────────────────────────────
131
+
119
132
  connectedCallback() {
120
133
  super.connectedCallback();
134
+ this.defaultChecked ??= this.checked;
121
135
  this.handleInitialAttributes();
122
136
  window.addEventListener('mouseup', this.windowMouseUp);
123
137
  window.addEventListener('keyup', this.windowKeyUp);
@@ -148,6 +162,42 @@ export class Radio extends LitElement {
148
162
  }
149
163
  }
150
164
 
165
+ // ── Public methods ───────────────────────────────────────────────────────
166
+
167
+ /**
168
+ * Sets focus on the radio.
169
+ */
170
+ focus() {
171
+ this.containerElement?.focus();
172
+ }
173
+
174
+ /**
175
+ * Removes focus from the radio.
176
+ */
177
+ blur() {
178
+ this.containerElement?.blur();
179
+ }
180
+
181
+ // ── Form association ─────────────────────────────────────────────────────
182
+
183
+ override [getFormValue](): FormValue | null {
184
+ return this.checked ? this.value || 'on' : null;
185
+ }
186
+
187
+ override [getFormState](): FormValue | null {
188
+ return String(this.checked);
189
+ }
190
+
191
+ formResetCallback() {
192
+ this.checked = this.defaultChecked ?? false;
193
+ }
194
+
195
+ formStateRestoreCallback(state: FormRestoreState | null) {
196
+ this.checked = state === 'true';
197
+ }
198
+
199
+ // ── Private methods ──────────────────────────────────────────────────────
200
+
151
201
  private handleInitialAttributes() {
152
202
  if (this.hasAttribute('tabindex')) {
153
203
  const attrValue = this.getAttribute('tabindex');
@@ -256,9 +306,14 @@ export class Radio extends LitElement {
256
306
 
257
307
  private getGroupRadios(): Radio[] {
258
308
  if (!this.name) return [this];
259
- const scopeRoot = this.closest('form') ?? document;
309
+ // A radio group or form scopes the name; otherwise the radio's own tree (document or the
310
+ // shadow root it was rendered into).
311
+ const scopeRoot = (this.closest('wc-radio-group, form') ??
312
+ this.getRootNode()) as ParentNode;
260
313
  return Array.from(
261
- scopeRoot.querySelectorAll<Radio>(`wc-radio[name="${this.name}"]`),
314
+ scopeRoot.querySelectorAll<Radio>(
315
+ `wc-radio[name="${CSS.escape(this.name)}"]`,
316
+ ),
262
317
  );
263
318
  }
264
319
 
@@ -300,19 +355,7 @@ export class Radio extends LitElement {
300
355
  target.containerElement?.focus();
301
356
  }
302
357
 
303
- /**
304
- * Sets focus on the radio.
305
- */
306
- focus() {
307
- this.containerElement?.focus();
308
- }
309
-
310
- /**
311
- * Removes focus from the radio.
312
- */
313
- blur() {
314
- this.containerElement?.blur();
315
- }
358
+ // ── Render ───────────────────────────────────────────────────────────────
316
359
 
317
360
  render() {
318
361
  const cssClasses = {
@@ -55,6 +55,7 @@ export class SegmentedButtonGroup extends LitElement {
55
55
  'segmented-button--change',
56
56
  this._onSegmentChange as EventListener,
57
57
  );
58
+ this.addEventListener('change', this._stopSegmentChange, { capture: true });
58
59
  }
59
60
 
60
61
  disconnectedCallback() {
@@ -63,8 +64,19 @@ export class SegmentedButtonGroup extends LitElement {
63
64
  'segmented-button--change',
64
65
  this._onSegmentChange as EventListener,
65
66
  );
67
+ this.removeEventListener('change', this._stopSegmentChange, {
68
+ capture: true,
69
+ });
66
70
  }
67
71
 
72
+ /**
73
+ * Swallows a segment's own `change` on the way down (capture phase), so listeners on the group
74
+ * and above see only the group's `change`, one per selection.
75
+ */
76
+ private _stopSegmentChange = (ev: Event) => {
77
+ if (ev.target !== this) ev.stopPropagation();
78
+ };
79
+
68
80
  private _getSegments(): SegmentedButton[] {
69
81
  return Array.from(
70
82
  this.querySelectorAll<SegmentedButton>('wc-segmented-button'),
@@ -19,7 +19,8 @@ import IndividualComponent from '@/IndividualComponent.js';
19
19
  * @cssprop --segmented-button-outline-color: Outline / border color.
20
20
  * @cssprop --segmented-button-disabled-opacity: Opacity when the segment is disabled.
21
21
  *
22
- * @fires {CustomEvent} segmented-button--change - Dispatched when the selected state changes.
22
+ * @fires {CustomEvent} change - Dispatched when the segment is activated. Detail: `{ value, selected, originalEvent }`, where `selected` is the requested state. Inside a `wc-segmented-button-group` the group swallows it and fires its own `change` instead.
23
+ * @fires {CustomEvent} segmented-button--change - Deprecated alias of `change`, fired alongside it.
23
24
  *
24
25
  * @example
25
26
  * ```html
@@ -102,13 +103,18 @@ export class SegmentedButton extends LitElement {
102
103
 
103
104
  private _toggle(ev: MouseEvent | KeyboardEvent) {
104
105
  if (this.disabled) return;
106
+ const detail = {
107
+ value: this.value || this.textContent?.trim(),
108
+ selected: !this.selected,
109
+ originalEvent: ev,
110
+ };
111
+ this.dispatchEvent(
112
+ new CustomEvent('change', { detail, bubbles: true, composed: true }),
113
+ );
114
+ // Deprecated name, still what wc-segmented-button-group listens for.
105
115
  this.dispatchEvent(
106
116
  new CustomEvent('segmented-button--change', {
107
- detail: {
108
- value: this.value || this.textContent?.trim(),
109
- selected: !this.selected,
110
- originalEvent: ev,
111
- },
117
+ detail,
112
118
  bubbles: true,
113
119
  composed: true,
114
120
  }),
@@ -1,6 +1,11 @@
1
1
  import { html, nothing } from 'lit';
2
2
  import { property, query, state } from 'lit/decorators.js';
3
3
  import { classMap } from 'lit/directives/class-map.js';
4
+ import {
5
+ type FormValue,
6
+ getFormValue,
7
+ } from '@/__internal/mixins/form-associated.js';
8
+ import IndividualComponent from '@/IndividualComponent.js';
4
9
  import BaseInput from '../input/BaseInput.js';
5
10
  import styles from './select.scss';
6
11
  import type { Field } from '../field/field.js';
@@ -26,6 +31,10 @@ export interface SelectOption {
26
31
  * - Client-side typeahead with `search="contains"`
27
32
  * - Server-side typeahead with `search="managed"`
28
33
  * - Multi-select chips display
34
+ * - Form-associated: submits the value under `name` (one entry per value with `multiple`)
35
+ *
36
+ * @fires {CustomEvent<{value: string}>} change - Dispatched when the selection changes.
37
+ * @fires {CustomEvent<{value: string}>} select-search - Dispatched as the user types when `search="managed"`.
29
38
  *
30
39
  * @example
31
40
  * ```html
@@ -36,6 +45,7 @@ export interface SelectOption {
36
45
  * ```
37
46
  * @tags form
38
47
  */
48
+ @IndividualComponent
39
49
  export class Select extends BaseInput {
40
50
  static styles = [styles];
41
51
 
@@ -138,6 +148,16 @@ export class Select extends BaseInput {
138
148
  this._triggerEl?.blur();
139
149
  }
140
150
 
151
+ // ── Form association ──────────────────────────────────────────────────────
152
+
153
+ override [getFormValue](): FormValue | null {
154
+ if (!this.multiple) return this.value;
155
+ // One entry per selected value, like a native <select multiple>.
156
+ const data = new FormData();
157
+ for (const value of this._selectedValues) data.append(this.name, value);
158
+ return data;
159
+ }
160
+
141
161
  // ── Lifecycle ─────────────────────────────────────────────────────────────
142
162
 
143
163
  protected override updated(changedProperties: Map<string, unknown>) {
@@ -441,7 +461,7 @@ export class Select extends BaseInput {
441
461
  <wc-chip
442
462
  dismissible
443
463
  value=${val}
444
- @tag--dismiss=${(e: CustomEvent) =>
464
+ @dismiss=${(e: CustomEvent) =>
445
465
  this._handleChipDismiss(e, val)}
446
466
  >${this._getLabelForValue(val)}</wc-chip
447
467
  >
@@ -6,7 +6,7 @@
6
6
  display: contents;
7
7
 
8
8
  --side-sheet-container-color: var(--color-surface-container-low, #f7f2fa);
9
- --side-sheet-scrim-color: rgba(0, 0, 0, 0.32);
9
+ --side-sheet-scrim-color: color-mix(in srgb, var(--color-scrim) 32%, transparent);
10
10
  --side-sheet-shape: var(--shape-corner-extra-large, 28px);
11
11
  --side-sheet-width: 360px;
12
12
  --side-sheet-transition-duration: var(--duration-medium2, 300ms);
@@ -8,7 +8,7 @@
8
8
  // M3 sidebar menu item sizing
9
9
  --sidebar-menu-item-height: 3rem;
10
10
  --sidebar-menu-item-icon-size: 1.25rem;
11
- --sidebar-menu-item-border-radius: var(--global-shape-corner-full, 9999px);
11
+ --sidebar-menu-item-border-radius: var(--shape-corner-full, 9999px);
12
12
 
13
13
  // M3 color tokens
14
14
  --sidebar-menu-item-label-color: var(--color-on-surface);
@@ -1,4 +1,5 @@
1
1
  import { html, LitElement } from 'lit';
2
+ import IndividualComponent from '@/IndividualComponent.js';
2
3
  import { property, query } from 'lit/decorators.js';
3
4
  import { classMap } from 'lit/directives/class-map.js';
4
5
  import styles from './sidebar-menu-item.scss';
@@ -19,6 +20,7 @@ import styles from './sidebar-menu-item.scss';
19
20
  * ```
20
21
  * @tags navigation
21
22
  */
23
+ @IndividualComponent
22
24
  export class SidebarMenuItem extends LitElement {
23
25
  static styles = [styles];
24
26
 
@@ -1,4 +1,5 @@
1
1
  import { html, LitElement } from 'lit';
2
+ import IndividualComponent from '@/IndividualComponent.js';
2
3
  import { property } from 'lit/decorators.js';
3
4
  import styles from './sidebar-menu.scss';
4
5
  import { SidebarMenuItem } from './sidebar-menu-item.js';
@@ -23,6 +24,7 @@ type SidebarNode = SidebarMenuItem | SidebarSubMenu;
23
24
  * ```
24
25
  * @tags navigation
25
26
  */
27
+ @IndividualComponent
26
28
  export class SidebarMenu extends LitElement {
27
29
  static styles = [styles];
28
30
 
@@ -6,7 +6,7 @@
6
6
  display: block;
7
7
 
8
8
  --sidebar-menu-item-height: 3rem;
9
- --sidebar-menu-item-border-radius: var(--global-shape-corner-full, 9999px);
9
+ --sidebar-menu-item-border-radius: var(--shape-corner-full, 9999px);
10
10
  --sidebar-menu-item-label-color: var(--color-on-surface);
11
11
  --sidebar-menu-item-icon-color: var(--color-on-surface-variant);
12
12
  --sidebar-menu-item-selected-background: var(--color-secondary-container);
@@ -1,4 +1,5 @@
1
1
  import { html, LitElement } from 'lit';
2
+ import IndividualComponent from '@/IndividualComponent.js';
2
3
  import { property, query } from 'lit/decorators.js';
3
4
  import { classMap } from 'lit/directives/class-map.js';
4
5
  import { styleMap } from 'lit/directives/style-map.js';
@@ -18,6 +19,7 @@ import styles from './sidebar-sub-menu.scss';
18
19
  * ```
19
20
  * @tags navigation
20
21
  */
22
+ @IndividualComponent
21
23
  export class SidebarSubMenu extends LitElement {
22
24
  static styles = [styles];
23
25
 
@@ -73,7 +73,7 @@
73
73
  height: var(--_thumb-size);
74
74
  background-color: var(--_thumb-color);
75
75
  border-radius: 50%;
76
- box-shadow: var(--md-sys-elevation-1);
76
+ box-shadow: var(--elevation-level1);
77
77
  outline: none;
78
78
  cursor: grab;
79
79
  transition: left 0.05s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.2s ease;
@@ -103,7 +103,7 @@
103
103
  &:focus-visible::before { opacity: 0.12; }
104
104
  &:active {
105
105
  cursor: grabbing;
106
- box-shadow: var(--md-sys-elevation-5);
106
+ box-shadow: var(--elevation-level5);
107
107
  }
108
108
 
109
109
  // Disable transition while dragging
@@ -120,7 +120,7 @@
120
120
  padding: 4px 8px;
121
121
  background-color: var(--_label-color);
122
122
  color: var(--_label-text-color);
123
- border-radius: 4px;
123
+ border-radius: var(--shape-corner-extra-small);
124
124
  font-size: 12px;
125
125
  white-space: nowrap;
126
126
  opacity: 0;