@redvars/peacock 3.10.0 → 3.11.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 (284) 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/{chart-bar-CapLbc2e.js → chart-bar-D5dGFJfK.js} +2 -2
  18. package/dist/{chart-bar-CapLbc2e.js.map → chart-bar-D5dGFJfK.js.map} +1 -1
  19. package/dist/chart-bar.js +1 -1
  20. package/dist/chart-stacked-bar.js +1 -1
  21. package/dist/checkbox.js +78 -53
  22. package/dist/checkbox.js.map +1 -1
  23. package/dist/chip-set.js +52 -0
  24. package/dist/chip-set.js.map +1 -0
  25. package/dist/chip.js +8 -6
  26. package/dist/chip.js.map +1 -1
  27. package/dist/circular-progress.js +177 -0
  28. package/dist/circular-progress.js.map +1 -0
  29. package/dist/code-editor.js +129 -72
  30. package/dist/code-editor.js.map +1 -1
  31. package/dist/code-highlighter.js +2 -38
  32. package/dist/code-highlighter.js.map +1 -1
  33. package/dist/color-field.js +309 -0
  34. package/dist/color-field.js.map +1 -0
  35. package/dist/color-picker.js +26 -15
  36. package/dist/color-picker.js.map +1 -1
  37. package/dist/copy-to-clipboard-upGx-Ueo.js +39 -0
  38. package/dist/copy-to-clipboard-upGx-Ueo.js.map +1 -0
  39. package/dist/custom-elements-jsdocs.json +1044 -382
  40. package/dist/custom-elements.json +8620 -4714
  41. package/dist/date-picker.js +241 -0
  42. package/dist/date-picker.js.map +1 -0
  43. package/dist/{element-internals-2CMts_0M.js → delegate-py-Ets8N.js} +2 -43
  44. package/dist/delegate-py-Ets8N.js.map +1 -0
  45. package/dist/element-internals-QME0yEz4.js +43 -0
  46. package/dist/element-internals-QME0yEz4.js.map +1 -0
  47. package/dist/fab.js +51 -49
  48. package/dist/fab.js.map +1 -1
  49. package/dist/field.js +34 -4
  50. package/dist/field.js.map +1 -1
  51. package/dist/flow.js +5 -5
  52. package/dist/form-associated-Bhwwr6dT.js +162 -0
  53. package/dist/form-associated-Bhwwr6dT.js.map +1 -0
  54. package/dist/{form-associated-BXADnjOB.js → form-submitter-DPI4L6gj.js} +3 -159
  55. package/dist/form-submitter-DPI4L6gj.js.map +1 -0
  56. package/dist/html-editor.js +3 -1
  57. package/dist/html-editor.js.map +1 -1
  58. package/dist/icon-button.js +195 -156
  59. package/dist/icon-button.js.map +1 -1
  60. package/dist/image.js +2 -2
  61. package/dist/index.js +32 -8
  62. package/dist/index.js.map +1 -1
  63. package/dist/input.js +259 -0
  64. package/dist/input.js.map +1 -0
  65. package/dist/item.js +2 -1
  66. package/dist/item.js.map +1 -1
  67. package/dist/linear-progress.js +192 -0
  68. package/dist/linear-progress.js.map +1 -0
  69. package/dist/{list-AdO-PUq_.js → list-item.js} +12 -222
  70. package/dist/list-item.js.map +1 -0
  71. package/dist/list.js +225 -6
  72. package/dist/list.js.map +1 -1
  73. package/dist/loader-full.js +31 -8
  74. package/dist/loader-full.js.map +1 -1
  75. package/dist/loader.js +52 -12
  76. package/dist/loader.js.map +1 -1
  77. package/dist/markdown-editor.js +5 -3
  78. package/dist/markdown-editor.js.map +1 -1
  79. package/dist/menu-item.js +30 -30
  80. package/dist/menu.js +1 -1
  81. package/dist/navigation-bar-item.js +41 -0
  82. package/dist/navigation-bar-item.js.map +1 -0
  83. package/dist/navigation-bar.js +128 -0
  84. package/dist/navigation-bar.js.map +1 -0
  85. package/dist/navigation-drawer-item.js +236 -0
  86. package/dist/navigation-drawer-item.js.map +1 -0
  87. package/dist/navigation-drawer.js +293 -0
  88. package/dist/navigation-drawer.js.map +1 -0
  89. package/dist/navigation-rail.js +1 -1
  90. package/dist/number-field.js +280 -0
  91. package/dist/number-field.js.map +1 -0
  92. package/dist/option.js +17 -0
  93. package/dist/option.js.map +1 -1
  94. package/dist/pagination.js +1 -1
  95. package/dist/radio-group.js +209 -0
  96. package/dist/radio-group.js.map +1 -0
  97. package/dist/radio.js +47 -37
  98. package/dist/radio.js.map +1 -1
  99. package/dist/segmented-button-group.js +12 -0
  100. package/dist/segmented-button-group.js.map +1 -1
  101. package/dist/segmented-button.js +10 -6
  102. package/dist/segmented-button.js.map +1 -1
  103. package/dist/select.js +653 -0
  104. package/dist/select.js.map +1 -0
  105. package/dist/side-sheet.js +1 -1
  106. package/dist/sidebar-menu-item.js +273 -0
  107. package/dist/sidebar-menu-item.js.map +1 -0
  108. package/dist/sidebar-menu.js +193 -0
  109. package/dist/sidebar-menu.js.map +1 -0
  110. package/dist/sidebar-sub-menu.js +301 -0
  111. package/dist/sidebar-sub-menu.js.map +1 -0
  112. package/dist/slider.js +76 -24
  113. package/dist/slider.js.map +1 -1
  114. package/dist/snackbar.js +3 -3
  115. package/dist/snackbar.js.map +1 -1
  116. package/dist/split-button.js +2 -2
  117. package/dist/src/__internal/utils/size.d.ts +9 -0
  118. package/dist/src/button/ButtonTypes.d.ts +1 -1
  119. package/dist/src/checkbox/checkbox.d.ts +28 -22
  120. package/dist/src/chip/chip/chip.d.ts +3 -0
  121. package/dist/src/chip/tag/tag.d.ts +5 -1
  122. package/dist/src/code-editor/code-editor.d.ts +37 -10
  123. package/dist/src/color-field/color-field.d.ts +55 -0
  124. package/dist/src/color-field/index.d.ts +1 -0
  125. package/dist/src/color-picker/color-picker.d.ts +1 -1
  126. package/dist/src/date-picker/date-picker.d.ts +0 -1
  127. package/dist/src/field/field.d.ts +2 -0
  128. package/dist/src/index.d.ts +4 -3
  129. package/dist/src/input/BaseInput.d.ts +21 -3
  130. package/dist/src/input/input.d.ts +15 -7
  131. package/dist/src/navigation-bar/index.d.ts +2 -0
  132. package/dist/src/navigation-bar/navigation-bar-item.d.ts +23 -0
  133. package/dist/src/navigation-bar/navigation-bar.d.ts +44 -0
  134. package/dist/src/navigation-drawer/index.d.ts +2 -0
  135. package/dist/src/navigation-drawer/navigation-drawer-item.d.ts +48 -0
  136. package/dist/src/navigation-drawer/navigation-drawer.d.ts +70 -0
  137. package/dist/src/number-field/number-field.d.ts +0 -1
  138. package/dist/src/radio/index.d.ts +1 -0
  139. package/dist/src/radio/radio-group.d.ts +50 -0
  140. package/dist/src/radio/radio.d.ts +18 -18
  141. package/dist/src/segmented-button/segmented-button-group.d.ts +5 -0
  142. package/dist/src/segmented-button/segmented-button.d.ts +2 -1
  143. package/dist/src/select/select.d.ts +7 -0
  144. package/dist/src/slider/slider.d.ts +14 -5
  145. package/dist/src/switch/switch.d.ts +22 -26
  146. package/dist/src/tabs/tabs.d.ts +3 -0
  147. package/dist/src/textarea/textarea.d.ts +0 -1
  148. package/dist/src/time-picker/time-picker.d.ts +0 -1
  149. package/dist/src/toolbar/toolbar.d.ts +7 -4
  150. package/dist/src/url-field/url-field.d.ts +0 -1
  151. package/dist/svg.js +5 -5
  152. package/dist/switch.js +413 -0
  153. package/dist/switch.js.map +1 -0
  154. package/dist/tab.js +2 -1
  155. package/dist/tab.js.map +1 -1
  156. package/dist/tabs.js +10 -8
  157. package/dist/tabs.js.map +1 -1
  158. package/dist/tag.js +349 -0
  159. package/dist/tag.js.map +1 -0
  160. package/dist/test/code-editor.test.d.ts +1 -0
  161. package/dist/test/color-field.test.d.ts +1 -0
  162. package/dist/test/color-picker.test.d.ts +1 -0
  163. package/dist/test/field.test.d.ts +1 -0
  164. package/dist/test/form-controls.test.d.ts +1 -0
  165. package/dist/test/icon.test.d.ts +1 -1
  166. package/dist/test/input.test.d.ts +1 -0
  167. package/dist/test/navigation.test.d.ts +1 -0
  168. package/dist/test/segmented-button.test.d.ts +1 -0
  169. package/dist/test/select.test.d.ts +1 -0
  170. package/dist/test/slider.test.d.ts +1 -0
  171. package/dist/textarea.js +237 -0
  172. package/dist/textarea.js.map +1 -0
  173. package/dist/time-picker.js +241 -0
  174. package/dist/time-picker.js.map +1 -0
  175. package/dist/toolbar.js +26 -9
  176. package/dist/toolbar.js.map +1 -1
  177. package/dist/tsconfig.tsbuildinfo +1 -1
  178. package/dist/url-field.js +298 -0
  179. package/dist/url-field.js.map +1 -0
  180. package/package.json +29 -8
  181. package/readme.md +2 -2
  182. package/scss/tokens.css +175 -18
  183. package/src/__internal/utils/size.ts +23 -0
  184. package/src/app-bar/app-bar.scss +4 -16
  185. package/src/bottom-sheet/bottom-sheet.scss +1 -1
  186. package/src/button/ButtonTypes.ts +2 -0
  187. package/src/button/button/button-base.scss +84 -84
  188. package/src/button/button/button-colors.scss +14 -2
  189. package/src/button/button/button-layers.scss +71 -71
  190. package/src/button/button/button-shapes.scss +2 -2
  191. package/src/button/button/button-sizes.scss +35 -35
  192. package/src/button/button/button.scss +1 -1
  193. package/src/button/button/button.ts +1 -2
  194. package/src/button/button-group/button-group.scss +5 -5
  195. package/src/button/fab/fab-sizes.scss +15 -15
  196. package/src/button/fab/fab.scss +32 -32
  197. package/src/button/icon-button/icon-button-sizes.scss +7 -7
  198. package/src/chart-bar/chart-bar.scss +1 -1
  199. package/src/checkbox/checkbox.scss +7 -6
  200. package/src/checkbox/checkbox.ts +92 -40
  201. package/src/chip/chip/chip.ts +8 -5
  202. package/src/chip/chip-set/chip-set.ts +2 -0
  203. package/src/chip/tag/tag-colors.scss +1 -1
  204. package/src/chip/tag/tag-sizes.scss +9 -0
  205. package/src/chip/tag/tag.scss +1 -1
  206. package/src/chip/tag/tag.ts +20 -9
  207. package/src/code-editor/code-editor.scss +8 -3
  208. package/src/code-editor/code-editor.ts +148 -79
  209. package/src/code-highlighter/code-highlighter.scss +1 -1
  210. package/src/color-field/color-field.scss +48 -0
  211. package/src/color-field/color-field.ts +239 -0
  212. package/src/color-field/index.ts +1 -0
  213. package/src/color-picker/color-picker.scss +33 -15
  214. package/src/color-picker/color-picker.ts +2 -1
  215. package/src/date-picker/date-picker.ts +2 -3
  216. package/src/field/field.scss +31 -0
  217. package/src/field/field.ts +5 -1
  218. package/src/flow/flow.scss +5 -5
  219. package/src/image/image.scss +2 -2
  220. package/src/index.ts +7 -3
  221. package/src/input/BaseInput.ts +54 -4
  222. package/src/input/input.ts +104 -79
  223. package/src/list/list-item.ts +2 -0
  224. package/src/loader.ts +28 -6
  225. package/src/markdown-editor/markdown-editor.scss +2 -2
  226. package/src/menu/menu/menu.scss +1 -1
  227. package/src/menu/menu-item/menu-item.scss +30 -30
  228. package/src/navigation-bar/index.ts +2 -0
  229. package/src/navigation-bar/navigation-bar-item.ts +25 -0
  230. package/src/navigation-bar/navigation-bar.scss +27 -0
  231. package/src/navigation-bar/navigation-bar.ts +96 -0
  232. package/src/navigation-drawer/index.ts +2 -0
  233. package/src/navigation-drawer/navigation-drawer-item.scss +82 -0
  234. package/src/navigation-drawer/navigation-drawer-item.ts +133 -0
  235. package/src/navigation-drawer/navigation-drawer.scss +99 -0
  236. package/src/navigation-drawer/navigation-drawer.ts +196 -0
  237. package/src/navigation-rail/navigation-rail.scss +1 -1
  238. package/src/number-field/number-field.ts +2 -3
  239. package/src/pagination/pagination.scss +1 -1
  240. package/src/progress/circular-progress/circular-progress.ts +2 -0
  241. package/src/progress/linear-progress/linear-progress.ts +2 -0
  242. package/src/radio/index.ts +1 -0
  243. package/src/radio/radio-group.scss +39 -0
  244. package/src/radio/radio-group.ts +167 -0
  245. package/src/radio/radio.ts +74 -31
  246. package/src/segmented-button/segmented-button-group.ts +12 -0
  247. package/src/segmented-button/segmented-button.ts +12 -6
  248. package/src/select/option.ts +17 -0
  249. package/src/select/select.ts +33 -8
  250. package/src/side-sheet/side-sheet.scss +1 -1
  251. package/src/sidebar-menu/sidebar-menu-item.scss +1 -1
  252. package/src/sidebar-menu/sidebar-menu-item.ts +2 -0
  253. package/src/sidebar-menu/sidebar-menu.ts +2 -0
  254. package/src/sidebar-menu/sidebar-sub-menu.scss +1 -1
  255. package/src/sidebar-menu/sidebar-sub-menu.ts +2 -0
  256. package/src/slider/slider.scss +3 -3
  257. package/src/slider/slider.ts +119 -31
  258. package/src/snackbar/snackbar.ts +3 -3
  259. package/src/split-button/split-button-colors.scss +2 -2
  260. package/src/svg/svg.scss +5 -5
  261. package/src/switch/switch.scss +0 -1
  262. package/src/switch/switch.ts +82 -47
  263. package/src/tabs/tab.scss +2 -1
  264. package/src/tabs/tabs.ts +14 -8
  265. package/src/textarea/textarea.ts +2 -3
  266. package/src/time-picker/time-picker.ts +2 -3
  267. package/src/toolbar/toolbar.scss +4 -4
  268. package/src/toolbar/toolbar.ts +12 -5
  269. package/src/url-field/url-field.ts +2 -3
  270. package/dist/BaseInput-CU1zZYKc.js +0 -27
  271. package/dist/BaseInput-CU1zZYKc.js.map +0 -1
  272. package/dist/brand-loader.js +0 -358
  273. package/dist/brand-loader.js.map +0 -1
  274. package/dist/element-internals-2CMts_0M.js.map +0 -1
  275. package/dist/form-associated-BXADnjOB.js.map +0 -1
  276. package/dist/list-AdO-PUq_.js.map +0 -1
  277. package/dist/select-CnnPbvpQ.js +0 -3955
  278. package/dist/select-CnnPbvpQ.js.map +0 -1
  279. package/dist/src/brand-loader/brand-loader.d.ts +0 -33
  280. package/dist/src/brand-loader/index.d.ts +0 -2
  281. package/src/brand-loader/brand-loader.scss +0 -270
  282. package/src/brand-loader/brand-loader.ts +0 -115
  283. package/src/brand-loader/index.ts +0 -2
  284. /package/dist/test/{brand-loader.test.d.ts → button.test.d.ts} +0 -0
@@ -0,0 +1,99 @@
1
+ @use '../../scss/mixin';
2
+
3
+ @include mixin.base-styles;
4
+
5
+ :host {
6
+ display: block;
7
+ --_width: var(--navigation-drawer-width, 22.5rem); // 360dp
8
+ --_container-color: var(
9
+ --navigation-drawer-container-color,
10
+ var(--color-surface-container-low)
11
+ );
12
+ }
13
+
14
+ :host([variant='standard']) {
15
+ height: 100%;
16
+ }
17
+
18
+ :host([variant='standard']:not([open])) {
19
+ display: none;
20
+ }
21
+
22
+ .drawer {
23
+ box-sizing: border-box;
24
+ background-color: var(--_container-color);
25
+ color: var(--color-on-surface-variant);
26
+ }
27
+
28
+ .standard {
29
+ width: var(--_width);
30
+ height: 100%;
31
+ overflow-y: auto;
32
+ }
33
+
34
+ .modal {
35
+ position: fixed;
36
+ inset-block: 0;
37
+ inset-inline-start: 0;
38
+ inset-inline-end: auto;
39
+ width: min(var(--_width), calc(100vw - 3.5rem));
40
+ max-width: none;
41
+ height: 100dvh;
42
+ max-height: none;
43
+ margin: 0;
44
+ padding: 0;
45
+ border: none;
46
+ border-start-end-radius: var(--shape-corner-large);
47
+ border-end-end-radius: var(--shape-corner-large);
48
+ box-shadow: var(--elevation-level1);
49
+ overflow-y: auto;
50
+
51
+ &[open] {
52
+ animation: slide-in var(--duration-medium2, 300ms)
53
+ var(--easing-emphasized-decelerate, ease-out);
54
+ }
55
+
56
+ &::backdrop {
57
+ background: color-mix(in srgb, var(--color-scrim, black) 32%, transparent);
58
+ }
59
+ }
60
+
61
+ @keyframes slide-in {
62
+ from {
63
+ transform: translateX(-100%);
64
+ }
65
+ }
66
+
67
+ :host(:dir(rtl)) .modal[open] {
68
+ animation-name: slide-in-rtl;
69
+ }
70
+
71
+ @keyframes slide-in-rtl {
72
+ from {
73
+ transform: translateX(100%);
74
+ }
75
+ }
76
+
77
+ .container {
78
+ display: flex;
79
+ flex-direction: column;
80
+ min-height: 100%;
81
+ padding: var(--spacing-150);
82
+ }
83
+
84
+ .headline {
85
+ @include mixin.get-typography(title-small);
86
+ color: var(--color-on-surface-variant);
87
+ padding: var(--spacing-200) var(--spacing-200) var(--spacing-150);
88
+ }
89
+
90
+ .items {
91
+ display: flex;
92
+ flex-direction: column;
93
+ }
94
+
95
+ @media (prefers-reduced-motion: reduce) {
96
+ .modal[open] {
97
+ animation: none;
98
+ }
99
+ }
@@ -0,0 +1,196 @@
1
+ import { html, LitElement, nothing, PropertyValues } from 'lit';
2
+ import { property, query } from 'lit/decorators.js';
3
+ import IndividualComponent from '@/IndividualComponent.js';
4
+ import { NavigationDrawerItem } from './navigation-drawer-item.js';
5
+ import styles from './navigation-drawer.scss';
6
+
7
+ /**
8
+ * @label Navigation Drawer
9
+ * @tag wc-navigation-drawer
10
+ * @rawTag navigation-drawer
11
+ *
12
+ * @summary A side panel listing an app's destinations.
13
+ * @overview
14
+ * <p>Navigation drawer holds <code>wc-navigation-drawer-item</code> destinations. Clicking an item makes
15
+ * it the active one and fires <code>change</code>.</p>
16
+ * <ul>
17
+ * <li><code>variant="standard"</code> (default) sits in the page layout, next to the content.</li>
18
+ * <li><code>variant="modal"</code> opens over the page with a scrim. It traps focus, closes on Escape,
19
+ * on a scrim click and after an item is chosen.</li>
20
+ * </ul>
21
+ * <p>Both variants show only while <code>open</code> is set.</p>
22
+ *
23
+ * @slot - The drawer items. Other content, such as `wc-divider` or section titles, works too.
24
+ * @slot header - Content above the items, after the headline.
25
+ *
26
+ * @fires {CustomEvent<{value: string | undefined, index: number, item: NavigationDrawerItem}>} change - Dispatched when the user activates an item.
27
+ * @fires {CustomEvent} open - Dispatched when the drawer opens.
28
+ * @fires {CustomEvent} close - Dispatched when the drawer closes.
29
+ *
30
+ * @cssprop --navigation-drawer-width - Width of the drawer. Defaults to 22.5rem (360dp).
31
+ * @cssprop --navigation-drawer-container-color - Background of the drawer. Defaults to `--color-surface-container-low`.
32
+ *
33
+ * @example
34
+ * ```html
35
+ * <wc-navigation-drawer open headline="Mail">
36
+ * <wc-navigation-drawer-item active badge="24">
37
+ * <wc-icon slot="icon" name="inbox"></wc-icon>
38
+ * Inbox
39
+ * </wc-navigation-drawer-item>
40
+ * <wc-navigation-drawer-item>
41
+ * <wc-icon slot="icon" name="send"></wc-icon>
42
+ * Sent
43
+ * </wc-navigation-drawer-item>
44
+ * </wc-navigation-drawer>
45
+ * ```
46
+ * @tags navigation
47
+ */
48
+ @IndividualComponent
49
+ export class NavigationDrawer extends LitElement {
50
+ // ── Static ───────────────────────────────────────────────────────────────
51
+
52
+ static styles = [styles];
53
+
54
+ static Item = NavigationDrawerItem;
55
+
56
+ // ── Properties ───────────────────────────────────────────────────────────
57
+
58
+ /** Whether the drawer is shown. */
59
+ @property({ type: Boolean, reflect: true }) open = false;
60
+
61
+ /** `"standard"` sits in the layout; `"modal"` opens over the page with a scrim. */
62
+ @property({ reflect: true }) variant: 'standard' | 'modal' = 'standard';
63
+
64
+ /** Title shown at the top of the drawer. */
65
+ @property() headline = '';
66
+
67
+ // ── Queries ──────────────────────────────────────────────────────────────
68
+
69
+ @query('dialog') private dialogElement?: HTMLDialogElement;
70
+
71
+ // ── Lifecycle ────────────────────────────────────────────────────────────
72
+
73
+ override connectedCallback() {
74
+ super.connectedCallback();
75
+ this.addEventListener('click', this.handleItemClick);
76
+ }
77
+
78
+ override disconnectedCallback() {
79
+ this.removeEventListener('click', this.handleItemClick);
80
+ super.disconnectedCallback();
81
+ }
82
+
83
+ protected override updated(changed: PropertyValues<this>) {
84
+ if (changed.has('open') || changed.has('variant')) {
85
+ this.syncDialog();
86
+ }
87
+ // Skip the first render: `open` set in markup is not a user action.
88
+ if (changed.has('open') && changed.get('open') !== undefined) {
89
+ this.dispatchEvent(
90
+ new CustomEvent(this.open ? 'open' : 'close', {
91
+ bubbles: true,
92
+ composed: true,
93
+ }),
94
+ );
95
+ }
96
+ }
97
+
98
+ // ── Public methods ───────────────────────────────────────────────────────
99
+
100
+ /** Opens the drawer. */
101
+ show() {
102
+ this.open = true;
103
+ }
104
+
105
+ /** Closes the drawer. */
106
+ close() {
107
+ this.open = false;
108
+ }
109
+
110
+ // ── Private methods ──────────────────────────────────────────────────────
111
+
112
+ private getItems(): NavigationDrawerItem[] {
113
+ return Array.from(
114
+ this.querySelectorAll<NavigationDrawerItem>('wc-navigation-drawer-item'),
115
+ );
116
+ }
117
+
118
+ private syncDialog() {
119
+ const dialog = this.dialogElement;
120
+ if (!dialog) return;
121
+ if (this.open && !dialog.open) {
122
+ dialog.showModal();
123
+ const items = this.getItems();
124
+ (items.find(item => item.active) ?? items[0])?.focus();
125
+ } else if (!this.open && dialog.open) {
126
+ dialog.close();
127
+ }
128
+ }
129
+
130
+ private handleItemClick = (event: Event) => {
131
+ const item = (event.target as Element).closest?.(
132
+ 'wc-navigation-drawer-item',
133
+ ) as NavigationDrawerItem | null;
134
+ if (!item || item.disabled) return;
135
+
136
+ const items = this.getItems();
137
+ for (const drawerItem of items) {
138
+ drawerItem.active = drawerItem === item;
139
+ }
140
+
141
+ this.dispatchEvent(
142
+ new CustomEvent('change', {
143
+ detail: { value: item.value, index: items.indexOf(item), item },
144
+ bubbles: true,
145
+ composed: true,
146
+ }),
147
+ );
148
+
149
+ if (this.variant === 'modal') this.close();
150
+ };
151
+
152
+ /** Escape: close through `open` so the property stays the source of truth. */
153
+ private handleCancel(event: Event) {
154
+ event.preventDefault();
155
+ this.close();
156
+ }
157
+
158
+ /** A click that lands on the dialog itself, not its content, is a scrim click. */
159
+ private handleDialogClick(event: MouseEvent) {
160
+ if (event.target === this.dialogElement) this.close();
161
+ }
162
+
163
+ // ── Render helpers ───────────────────────────────────────────────────────
164
+
165
+ private renderContent() {
166
+ return html`
167
+ <div class="container" part="container">
168
+ ${this.headline
169
+ ? html`<div class="headline">${this.headline}</div>`
170
+ : nothing}
171
+ <slot name="header"></slot>
172
+ <nav class="items" aria-label=${this.headline || 'Navigation'}>
173
+ <slot></slot>
174
+ </nav>
175
+ </div>
176
+ `;
177
+ }
178
+
179
+ // ── Render ───────────────────────────────────────────────────────────────
180
+
181
+ render() {
182
+ if (this.variant === 'modal') {
183
+ return html`<dialog
184
+ class="drawer modal"
185
+ @cancel=${this.handleCancel}
186
+ @click=${this.handleDialogClick}
187
+ >
188
+ ${this.renderContent()}
189
+ </dialog>`;
190
+ }
191
+
192
+ return html`<div class="drawer standard" ?hidden=${!this.open}>
193
+ ${this.renderContent()}
194
+ </div>`;
195
+ }
196
+ }
@@ -10,7 +10,7 @@
10
10
  overflow-x: hidden;
11
11
  --nav-rail-padding-block: 1.5rem;
12
12
 
13
- --nav-rail-container-color: var(--container-surface);
13
+ --nav-rail-container-color: var(--color-surface);
14
14
  --nav-rail-label-text-color: var(--color-on-surface);
15
15
  }
16
16
 
@@ -5,6 +5,7 @@ import { classMap } from 'lit/directives/class-map.js';
5
5
  import { redispatchEvent } from '@/__internal/utils/dispatch-event-utils.js';
6
6
  import { spread } from '@/__internal/directive/spread.js';
7
7
 
8
+ import IndividualComponent from '@/IndividualComponent.js';
8
9
  import BaseInput from '../input/BaseInput.js';
9
10
  import styles from './number-field.scss';
10
11
 
@@ -20,6 +21,7 @@ import styles from './number-field.scss';
20
21
  * <wc-number-field label="Age" placeholder="Enter your age"></wc-number-field>
21
22
  * ```
22
23
  */
24
+ @IndividualComponent
23
25
  export class NumberField extends BaseInput {
24
26
  static styles = [styles];
25
27
 
@@ -28,9 +30,6 @@ export class NumberField extends BaseInput {
28
30
  @property({ type: Number })
29
31
  value?: number;
30
32
 
31
- @property({ type: String })
32
- name: string = '';
33
-
34
33
  @property({ type: String })
35
34
  placeholder = '';
36
35
 
@@ -68,6 +68,6 @@
68
68
  }
69
69
 
70
70
  .nav-button {
71
- --button-container-shape: 999px;
71
+ --button-container-shape: var(--shape-corner-full);
72
72
  }
73
73
  }
@@ -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 './circular-progress.scss';
@@ -16,6 +17,7 @@ import { BaseProgress } from '../base-progress.js';
16
17
  * <wc-circular-progress value="30"></wc-circular-progress>
17
18
  * ```
18
19
  */
20
+ @IndividualComponent
19
21
  export class CircularProgress extends BaseProgress {
20
22
  // Lit components use static styles for better performance
21
23
  static styles = [styles];
@@ -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
+ }