@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
@@ -0,0 +1,27 @@
1
+ @use '../../scss/mixin';
2
+
3
+ @include mixin.base-styles;
4
+
5
+ :host {
6
+ display: block;
7
+ width: 100%;
8
+ }
9
+
10
+ .bar {
11
+ display: flex;
12
+ align-items: center;
13
+ height: var(--navigation-bar-height, 5rem);
14
+ padding-inline: var(--spacing-100);
15
+ background-color: var(
16
+ --navigation-bar-container-color,
17
+ var(--color-surface-container)
18
+ );
19
+ box-shadow: var(--navigation-bar-elevation, var(--elevation-level2));
20
+
21
+ ::slotted(wc-navigation-bar-item) {
22
+ flex: 1 1 0;
23
+ min-width: 0;
24
+ // M3 bar indicator is wider than the rail's (64dp × 32dp).
25
+ --nav-rail-indicator-width: 4rem;
26
+ }
27
+ }
@@ -0,0 +1,96 @@
1
+ import { html, LitElement } from 'lit';
2
+ import IndividualComponent from '@/IndividualComponent.js';
3
+ import { NavigationBarItem } from './navigation-bar-item.js';
4
+ import styles from './navigation-bar.scss';
5
+
6
+ /**
7
+ * @label Navigation Bar
8
+ * @tag wc-navigation-bar
9
+ * @rawTag navigation-bar
10
+ *
11
+ * @summary A bottom bar with three to five primary destinations, for small screens.
12
+ * @overview
13
+ * <p>Navigation bar lays its <code>wc-navigation-bar-item</code> children out in a row of equal
14
+ * widths. Clicking an item makes it the active one and fires <code>change</code>.</p>
15
+ * <p>The bar does not position itself: place it at the bottom of your layout, or give it
16
+ * <code>position: fixed; inset-inline: 0; bottom: 0</code>.</p>
17
+ *
18
+ * @fires {CustomEvent<{value: string | undefined, index: number, item: NavigationBarItem}>} change - Dispatched when the user activates an item.
19
+ *
20
+ * @cssprop --navigation-bar-container-color - Background of the bar. Defaults to `--color-surface-container`.
21
+ * @cssprop --navigation-bar-height - Height of the bar. Defaults to 5rem (80dp).
22
+ * @cssprop --navigation-bar-elevation - Shadow of the bar. Defaults to `--elevation-level2`.
23
+ *
24
+ * @example
25
+ * ```html
26
+ * <wc-navigation-bar>
27
+ * <wc-navigation-bar-item active value="home">
28
+ * <wc-icon slot="icon" name="home"></wc-icon>
29
+ * Home
30
+ * </wc-navigation-bar-item>
31
+ * <wc-navigation-bar-item value="search">
32
+ * <wc-icon slot="icon" name="search"></wc-icon>
33
+ * Search
34
+ * </wc-navigation-bar-item>
35
+ * </wc-navigation-bar>
36
+ * ```
37
+ * @tags navigation
38
+ */
39
+ @IndividualComponent
40
+ export class NavigationBar extends LitElement {
41
+ // ── Static ───────────────────────────────────────────────────────────────
42
+
43
+ static styles = [styles];
44
+
45
+ static Item = NavigationBarItem;
46
+
47
+ // ── Lifecycle ────────────────────────────────────────────────────────────
48
+
49
+ override connectedCallback() {
50
+ super.connectedCallback();
51
+ this.addEventListener('click', this.handleItemClick);
52
+ this.setAttribute('role', 'navigation');
53
+ if (!this.hasAttribute('aria-label')) {
54
+ this.setAttribute('aria-label', 'Main navigation');
55
+ }
56
+ }
57
+
58
+ override disconnectedCallback() {
59
+ this.removeEventListener('click', this.handleItemClick);
60
+ super.disconnectedCallback();
61
+ }
62
+
63
+ // ── Private methods ──────────────────────────────────────────────────────
64
+
65
+ private getItems(): NavigationBarItem[] {
66
+ return Array.from(
67
+ this.querySelectorAll<NavigationBarItem>('wc-navigation-bar-item'),
68
+ );
69
+ }
70
+
71
+ private handleItemClick = (event: Event) => {
72
+ const item = (event.target as Element).closest?.(
73
+ 'wc-navigation-bar-item',
74
+ ) as NavigationBarItem | null;
75
+ if (!item || item.disabled) return;
76
+
77
+ const items = this.getItems();
78
+ for (const barItem of items) {
79
+ barItem.active = barItem === item;
80
+ }
81
+
82
+ this.dispatchEvent(
83
+ new CustomEvent('change', {
84
+ detail: { value: item.value, index: items.indexOf(item), item },
85
+ bubbles: true,
86
+ composed: true,
87
+ }),
88
+ );
89
+ };
90
+
91
+ // ── Render ───────────────────────────────────────────────────────────────
92
+
93
+ render() {
94
+ return html`<div class="bar"><slot></slot></div>`;
95
+ }
96
+ }
@@ -0,0 +1,2 @@
1
+ export { NavigationDrawer } from './navigation-drawer.js';
2
+ export { NavigationDrawerItem } from './navigation-drawer-item.js';
@@ -0,0 +1,82 @@
1
+ @use '../../scss/mixin';
2
+
3
+ @include mixin.base-styles;
4
+
5
+ :host {
6
+ display: block;
7
+ // Set on the host: the link reset makes the item inherit its color.
8
+ color: var(--color-on-surface-variant);
9
+ }
10
+
11
+ .item {
12
+ @include mixin.reset-button-styles;
13
+ @include mixin.reset-link-styles;
14
+
15
+ position: relative;
16
+ display: flex;
17
+ align-items: center;
18
+ gap: var(--spacing-150);
19
+ width: 100%;
20
+ height: 3.5rem; // 56dp
21
+ padding-inline: var(--spacing-200) var(--spacing-300);
22
+ border-radius: var(--shape-corner-full);
23
+ color: inherit;
24
+ cursor: pointer;
25
+ text-decoration: none;
26
+ box-sizing: border-box;
27
+
28
+ --icon-size: 1.5rem;
29
+ --icon-color: currentColor;
30
+
31
+ .focus-ring {
32
+ --focus-ring-container-shape-start-start: var(--shape-corner-full);
33
+ --focus-ring-container-shape-start-end: var(--shape-corner-full);
34
+ --focus-ring-container-shape-end-start: var(--shape-corner-full);
35
+ --focus-ring-container-shape-end-end: var(--shape-corner-full);
36
+ }
37
+
38
+ .ripple {
39
+ border-radius: inherit;
40
+ --ripple-pressed-color: currentColor;
41
+ }
42
+
43
+ .icon {
44
+ display: none;
45
+ }
46
+
47
+ &.has-icon .icon {
48
+ display: inline-flex;
49
+ }
50
+
51
+ .label {
52
+ flex: 1;
53
+ min-width: 0;
54
+ overflow: hidden;
55
+ text-overflow: ellipsis;
56
+ white-space: nowrap;
57
+ @include mixin.get-typography(label-large);
58
+ }
59
+
60
+ .badge {
61
+ @include mixin.get-typography(label-large);
62
+ }
63
+
64
+ &.active {
65
+ background-color: var(--color-secondary-container);
66
+ color: var(--color-on-secondary-container);
67
+
68
+ .label {
69
+ font-weight: var(--font-weight-bold) !important;
70
+ }
71
+ }
72
+
73
+ &.disabled {
74
+ cursor: not-allowed;
75
+ color: var(--color-on-surface);
76
+ opacity: var(--state-disabled-content-opacity, 0.38);
77
+
78
+ .ripple {
79
+ display: none;
80
+ }
81
+ }
82
+ }
@@ -0,0 +1,133 @@
1
+ import { html, LitElement, nothing } from 'lit';
2
+ import { property, query, state } from 'lit/decorators.js';
3
+ import { classMap } from 'lit/directives/class-map.js';
4
+ import IndividualComponent from '@/IndividualComponent.js';
5
+ import styles from './navigation-drawer-item.scss';
6
+
7
+ /**
8
+ * @label Navigation Drawer Item
9
+ * @tag wc-navigation-drawer-item
10
+ * @rawTag navigation-drawer-item
11
+ *
12
+ * @summary A destination in a navigation drawer.
13
+ * @overview
14
+ * <p>A full-width row with an optional icon, a label and an optional badge. The active item gets
15
+ * the pill-shaped active indicator. With <code>href</code> it renders a link, otherwise a button.</p>
16
+ *
17
+ * @slot - The label.
18
+ * @slot icon - Leading icon.
19
+ * @slot badge - Trailing content, such as a count. Overrides the `badge` attribute.
20
+ *
21
+ * @example
22
+ * ```html
23
+ * <wc-navigation-drawer-item active badge="24">
24
+ * <wc-icon slot="icon" name="inbox"></wc-icon>
25
+ * Inbox
26
+ * </wc-navigation-drawer-item>
27
+ * ```
28
+ * @tags navigation
29
+ */
30
+ @IndividualComponent
31
+ export class NavigationDrawerItem extends LitElement {
32
+ // ── Static ───────────────────────────────────────────────────────────────
33
+
34
+ static override shadowRootOptions: ShadowRootInit = {
35
+ ...LitElement.shadowRootOptions,
36
+ delegatesFocus: true,
37
+ };
38
+
39
+ static styles = [styles];
40
+
41
+ // ── Properties ───────────────────────────────────────────────────────────
42
+
43
+ /** Whether this item is the current destination. */
44
+ @property({ type: Boolean, reflect: true }) active = false;
45
+
46
+ /** Whether this item is disabled. */
47
+ @property({ type: Boolean, reflect: true }) disabled = false;
48
+
49
+ /** If provided, the item renders as a link. */
50
+ @property({ reflect: true }) href?: string;
51
+
52
+ /** Link target. */
53
+ @property() target: string = '_self';
54
+
55
+ /** Identifies the item in the drawer's `change` event. */
56
+ @property({ reflect: true }) value?: string;
57
+
58
+ /** Short trailing text, such as an unread count. */
59
+ @property() badge?: string;
60
+
61
+ // ── State ────────────────────────────────────────────────────────────────
62
+
63
+ /** True when the `icon` slot has content. */
64
+ @state() private hasIcon = false;
65
+
66
+ // ── Queries ──────────────────────────────────────────────────────────────
67
+
68
+ @query('.item') readonly itemElement!: HTMLElement | null;
69
+
70
+ // ── Public methods ───────────────────────────────────────────────────────
71
+
72
+ override focus() {
73
+ this.itemElement?.focus();
74
+ }
75
+
76
+ override blur() {
77
+ this.itemElement?.blur();
78
+ }
79
+
80
+ // ── Private methods ──────────────────────────────────────────────────────
81
+
82
+ private handleIconSlotChange(event: Event) {
83
+ this.hasIcon =
84
+ (event.target as HTMLSlotElement).assignedElements().length > 0;
85
+ }
86
+
87
+ // ── Render helpers ───────────────────────────────────────────────────────
88
+
89
+ private renderContent() {
90
+ return html`
91
+ <wc-focus-ring class="focus-ring" for="item"></wc-focus-ring>
92
+ <wc-ripple class="ripple" for="item"></wc-ripple>
93
+ <span class="icon"
94
+ ><slot name="icon" @slotchange=${this.handleIconSlotChange}></slot
95
+ ></span>
96
+ <span class="label"><slot></slot></span>
97
+ <span class="badge"
98
+ ><slot name="badge">${this.badge ?? nothing}</slot></span
99
+ >
100
+ `;
101
+ }
102
+
103
+ // ── Render ───────────────────────────────────────────────────────────────
104
+
105
+ render() {
106
+ const classes = classMap({
107
+ item: true,
108
+ active: this.active,
109
+ disabled: this.disabled,
110
+ 'has-icon': this.hasIcon,
111
+ });
112
+
113
+ if (this.href && !this.disabled) {
114
+ return html`<a
115
+ id="item"
116
+ class=${classes}
117
+ href=${this.href}
118
+ target=${this.target}
119
+ aria-current=${this.active ? 'page' : nothing}
120
+ >${this.renderContent()}</a
121
+ >`;
122
+ }
123
+
124
+ return html`<button
125
+ id="item"
126
+ class=${classes}
127
+ ?disabled=${this.disabled}
128
+ aria-current=${this.active ? 'page' : nothing}
129
+ >
130
+ ${this.renderContent()}
131
+ </button>`;
132
+ }
133
+ }
@@ -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];