@redvars/peacock 3.10.1 → 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 (276) 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 +8615 -4726
  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 +25 -0
  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/navigation-bar-item.js +41 -0
  81. package/dist/navigation-bar-item.js.map +1 -0
  82. package/dist/navigation-bar.js +128 -0
  83. package/dist/navigation-bar.js.map +1 -0
  84. package/dist/navigation-drawer-item.js +236 -0
  85. package/dist/navigation-drawer-item.js.map +1 -0
  86. package/dist/navigation-drawer.js +293 -0
  87. package/dist/navigation-drawer.js.map +1 -0
  88. package/dist/navigation-rail.js +1 -1
  89. package/dist/number-field.js +280 -0
  90. package/dist/number-field.js.map +1 -0
  91. package/dist/pagination.js +1 -1
  92. package/dist/radio-group.js +209 -0
  93. package/dist/radio-group.js.map +1 -0
  94. package/dist/radio.js +47 -37
  95. package/dist/radio.js.map +1 -1
  96. package/dist/segmented-button-group.js +12 -0
  97. package/dist/segmented-button-group.js.map +1 -1
  98. package/dist/segmented-button.js +10 -6
  99. package/dist/segmented-button.js.map +1 -1
  100. package/dist/select.js +653 -0
  101. package/dist/select.js.map +1 -0
  102. package/dist/side-sheet.js +1 -1
  103. package/dist/sidebar-menu-item.js +273 -0
  104. package/dist/sidebar-menu-item.js.map +1 -0
  105. package/dist/sidebar-menu.js +193 -0
  106. package/dist/sidebar-menu.js.map +1 -0
  107. package/dist/sidebar-sub-menu.js +301 -0
  108. package/dist/sidebar-sub-menu.js.map +1 -0
  109. package/dist/slider.js +76 -24
  110. package/dist/slider.js.map +1 -1
  111. package/dist/snackbar.js +3 -3
  112. package/dist/snackbar.js.map +1 -1
  113. package/dist/split-button.js +2 -2
  114. package/dist/src/__internal/utils/size.d.ts +9 -0
  115. package/dist/src/button/ButtonTypes.d.ts +1 -1
  116. package/dist/src/checkbox/checkbox.d.ts +28 -22
  117. package/dist/src/chip/chip/chip.d.ts +3 -0
  118. package/dist/src/chip/tag/tag.d.ts +5 -1
  119. package/dist/src/code-editor/code-editor.d.ts +37 -10
  120. package/dist/src/color-field/color-field.d.ts +55 -0
  121. package/dist/src/color-field/index.d.ts +1 -0
  122. package/dist/src/color-picker/color-picker.d.ts +1 -1
  123. package/dist/src/date-picker/date-picker.d.ts +0 -1
  124. package/dist/src/index.d.ts +4 -3
  125. package/dist/src/input/BaseInput.d.ts +21 -3
  126. package/dist/src/input/input.d.ts +15 -7
  127. package/dist/src/navigation-bar/index.d.ts +2 -0
  128. package/dist/src/navigation-bar/navigation-bar-item.d.ts +23 -0
  129. package/dist/src/navigation-bar/navigation-bar.d.ts +44 -0
  130. package/dist/src/navigation-drawer/index.d.ts +2 -0
  131. package/dist/src/navigation-drawer/navigation-drawer-item.d.ts +48 -0
  132. package/dist/src/navigation-drawer/navigation-drawer.d.ts +70 -0
  133. package/dist/src/number-field/number-field.d.ts +0 -1
  134. package/dist/src/radio/index.d.ts +1 -0
  135. package/dist/src/radio/radio-group.d.ts +50 -0
  136. package/dist/src/radio/radio.d.ts +18 -18
  137. package/dist/src/segmented-button/segmented-button-group.d.ts +5 -0
  138. package/dist/src/segmented-button/segmented-button.d.ts +2 -1
  139. package/dist/src/select/select.d.ts +6 -0
  140. package/dist/src/slider/slider.d.ts +14 -5
  141. package/dist/src/switch/switch.d.ts +22 -26
  142. package/dist/src/tabs/tabs.d.ts +3 -0
  143. package/dist/src/textarea/textarea.d.ts +0 -1
  144. package/dist/src/time-picker/time-picker.d.ts +0 -1
  145. package/dist/src/toolbar/toolbar.d.ts +7 -4
  146. package/dist/src/url-field/url-field.d.ts +0 -1
  147. package/dist/svg.js +5 -5
  148. package/dist/switch.js +413 -0
  149. package/dist/switch.js.map +1 -0
  150. package/dist/tab.js +2 -1
  151. package/dist/tab.js.map +1 -1
  152. package/dist/tabs.js +10 -8
  153. package/dist/tabs.js.map +1 -1
  154. package/dist/tag.js +349 -0
  155. package/dist/tag.js.map +1 -0
  156. package/dist/test/code-editor.test.d.ts +1 -0
  157. package/dist/test/color-field.test.d.ts +1 -0
  158. package/dist/test/color-picker.test.d.ts +1 -0
  159. package/dist/test/field.test.d.ts +1 -0
  160. package/dist/test/form-controls.test.d.ts +1 -0
  161. package/dist/test/icon.test.d.ts +1 -1
  162. package/dist/test/input.test.d.ts +1 -0
  163. package/dist/test/navigation.test.d.ts +1 -0
  164. package/dist/test/segmented-button.test.d.ts +1 -0
  165. package/dist/test/slider.test.d.ts +1 -0
  166. package/dist/textarea.js +237 -0
  167. package/dist/textarea.js.map +1 -0
  168. package/dist/time-picker.js +241 -0
  169. package/dist/time-picker.js.map +1 -0
  170. package/dist/toolbar.js +26 -9
  171. package/dist/toolbar.js.map +1 -1
  172. package/dist/tsconfig.tsbuildinfo +1 -1
  173. package/dist/url-field.js +298 -0
  174. package/dist/url-field.js.map +1 -0
  175. package/package.json +29 -8
  176. package/readme.md +2 -2
  177. package/scss/tokens.css +175 -18
  178. package/src/__internal/utils/size.ts +23 -0
  179. package/src/app-bar/app-bar.scss +4 -16
  180. package/src/bottom-sheet/bottom-sheet.scss +1 -1
  181. package/src/button/ButtonTypes.ts +2 -0
  182. package/src/button/button/button-base.scss +84 -84
  183. package/src/button/button/button-colors.scss +14 -2
  184. package/src/button/button/button-layers.scss +71 -71
  185. package/src/button/button/button-shapes.scss +2 -2
  186. package/src/button/button/button-sizes.scss +35 -35
  187. package/src/button/button/button.scss +1 -1
  188. package/src/button/button/button.ts +1 -2
  189. package/src/button/button-group/button-group.scss +5 -5
  190. package/src/button/fab/fab-sizes.scss +15 -15
  191. package/src/button/fab/fab.scss +32 -32
  192. package/src/button/icon-button/icon-button-sizes.scss +7 -7
  193. package/src/chart-bar/chart-bar.scss +1 -1
  194. package/src/checkbox/checkbox.scss +7 -6
  195. package/src/checkbox/checkbox.ts +92 -40
  196. package/src/chip/chip/chip.ts +8 -5
  197. package/src/chip/chip-set/chip-set.ts +2 -0
  198. package/src/chip/tag/tag-colors.scss +1 -1
  199. package/src/chip/tag/tag-sizes.scss +9 -0
  200. package/src/chip/tag/tag.scss +1 -1
  201. package/src/chip/tag/tag.ts +20 -9
  202. package/src/code-editor/code-editor.scss +8 -3
  203. package/src/code-editor/code-editor.ts +148 -79
  204. package/src/code-highlighter/code-highlighter.scss +1 -1
  205. package/src/color-field/color-field.scss +48 -0
  206. package/src/color-field/color-field.ts +239 -0
  207. package/src/color-field/index.ts +1 -0
  208. package/src/color-picker/color-picker.scss +33 -15
  209. package/src/color-picker/color-picker.ts +2 -1
  210. package/src/date-picker/date-picker.ts +2 -3
  211. package/src/field/field.scss +31 -0
  212. package/src/flow/flow.scss +5 -5
  213. package/src/image/image.scss +2 -2
  214. package/src/index.ts +7 -3
  215. package/src/input/BaseInput.ts +54 -4
  216. package/src/input/input.ts +104 -79
  217. package/src/list/list-item.ts +2 -0
  218. package/src/loader.ts +28 -6
  219. package/src/markdown-editor/markdown-editor.scss +2 -2
  220. package/src/menu/menu-item/menu-item.scss +30 -30
  221. package/src/navigation-bar/index.ts +2 -0
  222. package/src/navigation-bar/navigation-bar-item.ts +25 -0
  223. package/src/navigation-bar/navigation-bar.scss +27 -0
  224. package/src/navigation-bar/navigation-bar.ts +96 -0
  225. package/src/navigation-drawer/index.ts +2 -0
  226. package/src/navigation-drawer/navigation-drawer-item.scss +82 -0
  227. package/src/navigation-drawer/navigation-drawer-item.ts +133 -0
  228. package/src/navigation-drawer/navigation-drawer.scss +99 -0
  229. package/src/navigation-drawer/navigation-drawer.ts +196 -0
  230. package/src/navigation-rail/navigation-rail.scss +1 -1
  231. package/src/number-field/number-field.ts +2 -3
  232. package/src/pagination/pagination.scss +1 -1
  233. package/src/progress/circular-progress/circular-progress.ts +2 -0
  234. package/src/progress/linear-progress/linear-progress.ts +2 -0
  235. package/src/radio/index.ts +1 -0
  236. package/src/radio/radio-group.scss +39 -0
  237. package/src/radio/radio-group.ts +167 -0
  238. package/src/radio/radio.ts +74 -31
  239. package/src/segmented-button/segmented-button-group.ts +12 -0
  240. package/src/segmented-button/segmented-button.ts +12 -6
  241. package/src/select/select.ts +21 -1
  242. package/src/side-sheet/side-sheet.scss +1 -1
  243. package/src/sidebar-menu/sidebar-menu-item.scss +1 -1
  244. package/src/sidebar-menu/sidebar-menu-item.ts +2 -0
  245. package/src/sidebar-menu/sidebar-menu.ts +2 -0
  246. package/src/sidebar-menu/sidebar-sub-menu.scss +1 -1
  247. package/src/sidebar-menu/sidebar-sub-menu.ts +2 -0
  248. package/src/slider/slider.scss +3 -3
  249. package/src/slider/slider.ts +119 -31
  250. package/src/snackbar/snackbar.ts +3 -3
  251. package/src/split-button/split-button-colors.scss +2 -2
  252. package/src/svg/svg.scss +5 -5
  253. package/src/switch/switch.scss +0 -1
  254. package/src/switch/switch.ts +82 -47
  255. package/src/tabs/tab.scss +2 -1
  256. package/src/tabs/tabs.ts +14 -8
  257. package/src/textarea/textarea.ts +2 -3
  258. package/src/time-picker/time-picker.ts +2 -3
  259. package/src/toolbar/toolbar.scss +4 -4
  260. package/src/toolbar/toolbar.ts +12 -5
  261. package/src/url-field/url-field.ts +2 -3
  262. package/dist/BaseInput-CU1zZYKc.js +0 -27
  263. package/dist/BaseInput-CU1zZYKc.js.map +0 -1
  264. package/dist/brand-loader.js +0 -358
  265. package/dist/brand-loader.js.map +0 -1
  266. package/dist/element-internals-2CMts_0M.js.map +0 -1
  267. package/dist/form-associated-BXADnjOB.js.map +0 -1
  268. package/dist/list-AdO-PUq_.js.map +0 -1
  269. package/dist/select-DkyRqUTI.js +0 -3955
  270. package/dist/select-DkyRqUTI.js.map +0 -1
  271. package/dist/src/brand-loader/brand-loader.d.ts +0 -33
  272. package/dist/src/brand-loader/index.d.ts +0 -2
  273. package/src/brand-loader/brand-loader.scss +0 -270
  274. package/src/brand-loader/brand-loader.ts +0 -115
  275. package/src/brand-loader/index.ts +0 -2
  276. /package/dist/test/{brand-loader.test.d.ts → button.test.d.ts} +0 -0
package/src/loader.ts CHANGED
@@ -27,6 +27,7 @@ import { Textarea } from '@/textarea/textarea.js';
27
27
  import { Switch } from '@/switch/switch.js';
28
28
  import { Checkbox } from '@/checkbox/checkbox.js';
29
29
  import { Radio } from '@/radio/radio.js';
30
+ import { RadioGroup } from '@/radio/radio-group.js';
30
31
 
31
32
  import { Menu } from '@/menu/menu/menu.js';
32
33
  import { MenuItem } from '@/menu/menu-item/menu-item.js';
@@ -52,7 +53,6 @@ import { Breadcrumb, BreadcrumbItem } from '@/breadcrumb/index.js';
52
53
 
53
54
  import { Skeleton } from '@/skeleton/skeleton.js';
54
55
  import { Spinner } from '@/spinner/spinner.js';
55
- import { BrandLoader } from '@/brand-loader/brand-loader.js';
56
56
 
57
57
  import { EmptyState } from '@/empty-state/empty-state.js';
58
58
  import { Container } from '@/container/container.js';
@@ -65,6 +65,7 @@ import { Tab } from '@/tabs/tab.js';
65
65
  import { TabPanel } from '@/tabs/tab-panel.js';
66
66
  import { Slider } from '@/slider/slider.js';
67
67
  import { ColorPicker } from '@/color-picker/color-picker.js';
68
+ import { ColorField } from '@/color-field/color-field.js';
68
69
  import { Table } from '@/table/table.js';
69
70
  import { Pagination } from '@/pagination/pagination.js';
70
71
  import { SidebarMenu } from '@/sidebar-menu/sidebar-menu.js';
@@ -86,13 +87,19 @@ import { Toolbar } from '@/toolbar/toolbar.js';
86
87
  import { AppBar } from '@/app-bar/app-bar.js';
87
88
  import { NavigationRail } from '@/navigation-rail/navigation-rail.js';
88
89
  import { NavigationRailItem } from '@/navigation-rail/navigation-rail-item.js';
90
+ import { NavigationBar } from '@/navigation-bar/navigation-bar.js';
91
+ import { NavigationBarItem } from '@/navigation-bar/navigation-bar-item.js';
92
+ import { NavigationDrawer } from '@/navigation-drawer/navigation-drawer.js';
93
+ import { NavigationDrawerItem } from '@/navigation-drawer/navigation-drawer-item.js';
89
94
 
90
- const distDirectory = `${import.meta.url}/..`;
95
+ // Resolve the folder this script was served from. `new URL('.', …)` drops the file name and any
96
+ // query string, so `loader.js?styles` still yields `…/dist` (no trailing slash).
97
+ const distDirectory = new URL('.', import.meta.url).href.replace(/\/$/, '');
91
98
 
92
99
  const url = new URL(import.meta.url);
93
100
  const params = url.searchParams;
94
101
 
95
- // Example: accessing app.js?theme=dark&user=123
102
+ // Example: loader.js?styles also loads dist/assets/styles.css
96
103
  const includeStyles = params.has('styles');
97
104
 
98
105
  if (includeStyles) {
@@ -287,12 +294,12 @@ const loaderConfig: LoaderConfig = {
287
294
  'wc-radio': {
288
295
  CustomElementClass: Radio,
289
296
  },
297
+ 'wc-radio-group': {
298
+ CustomElementClass: RadioGroup,
299
+ },
290
300
  'wc-spinner': {
291
301
  CustomElementClass: Spinner,
292
302
  },
293
- 'wc-brand-loader': {
294
- CustomElementClass: BrandLoader,
295
- },
296
303
  'wc-empty-state': {
297
304
  CustomElementClass: EmptyState,
298
305
  },
@@ -335,6 +342,9 @@ const loaderConfig: LoaderConfig = {
335
342
  'wc-color-picker': {
336
343
  CustomElementClass: ColorPicker,
337
344
  },
345
+ 'wc-color-field': {
346
+ CustomElementClass: ColorField,
347
+ },
338
348
  'wc-table': {
339
349
  CustomElementClass: Table,
340
350
  },
@@ -383,6 +393,18 @@ const loaderConfig: LoaderConfig = {
383
393
  'wc-navigation-rail-item': {
384
394
  CustomElementClass: NavigationRailItem,
385
395
  },
396
+ 'wc-navigation-bar': {
397
+ CustomElementClass: NavigationBar,
398
+ },
399
+ 'wc-navigation-bar-item': {
400
+ CustomElementClass: NavigationBarItem,
401
+ },
402
+ 'wc-navigation-drawer': {
403
+ CustomElementClass: NavigationDrawer,
404
+ },
405
+ 'wc-navigation-drawer-item': {
406
+ CustomElementClass: NavigationDrawerItem,
407
+ },
386
408
  'wc-calendar': {
387
409
  importPath: `${distDirectory}/calendar.js`,
388
410
  dependencies: ['wc-calendar-column-view', 'wc-calendar-month-view'],
@@ -104,7 +104,7 @@
104
104
  color: var(--color-on-surface, #1c1b1f);
105
105
  padding: 0.75rem 1rem;
106
106
  border-radius: var(--shape-corner-small, 0.5rem);
107
- font-family: var(--typography-code-font-family, monospace);
107
+ font-family: var(--font-family-monospace, monospace);
108
108
  font-size: 0.85rem;
109
109
  line-height: 1.5;
110
110
  overflow-x: auto;
@@ -112,7 +112,7 @@
112
112
  }
113
113
 
114
114
  code {
115
- font-family: var(--typography-code-font-family, monospace);
115
+ font-family: var(--font-family-monospace, monospace);
116
116
  font-size: 0.85em;
117
117
  background: color-mix(
118
118
  in srgb,
@@ -100,36 +100,36 @@
100
100
  --item-label-line-height: var(--typography-label-large-line-height);
101
101
  --item-label-letter-spacing: var(--typography-label-large-letter-spacing);
102
102
 
103
- --item-label-text-color: var(--private-item-label-text-color);
104
- --item-leading-trailing-color: var(--private-item-label-text-color);
105
- --item-supporting-text-color: var(--private-item-label-text-color);
106
- --item-icon-size: var(--menu-item-icon-size, var(--private-item-icon-size));
103
+ --item-label-text-color: var(--_item-label-text-color);
104
+ --item-leading-trailing-color: var(--_item-label-text-color);
105
+ --item-supporting-text-color: var(--_item-label-text-color);
106
+ --item-icon-size: var(--menu-item-icon-size, var(--_item-icon-size));
107
107
 
108
108
  .background {
109
- background-color: var(--private-item-container-color);
109
+ background-color: var(--_item-container-color);
110
110
  opacity: var(--_container-opacity, 1);
111
111
  border-radius: var(--shape-corner-medium);
112
112
 
113
113
  border-start-start-radius: var(
114
- --private-item-container-shape-start-start
114
+ --_item-container-shape-start-start
115
115
  );
116
- border-start-end-radius: var(--private-item-container-shape-start-end);
117
- border-end-start-radius: var(--private-item-container-shape-end-start);
118
- border-end-end-radius: var(--private-item-container-shape-end-end);
116
+ border-start-end-radius: var(--_item-container-shape-start-end);
117
+ border-end-start-radius: var(--_item-container-shape-end-start);
118
+ border-end-end-radius: var(--_item-container-shape-end-end);
119
119
  }
120
120
 
121
121
  .focus-ring {
122
122
  --focus-ring-container-shape-start-start: var(
123
- --private-item-container-shape-start-start
123
+ --_item-container-shape-start-start
124
124
  );
125
125
  --focus-ring-container-shape-start-end: var(
126
- --private-item-container-shape-start-start
126
+ --_item-container-shape-start-start
127
127
  );
128
128
  --focus-ring-container-shape-end-start: var(
129
- --private-item-container-shape-start-start
129
+ --_item-container-shape-start-start
130
130
  );
131
131
  --focus-ring-container-shape-end-end: var(
132
- --private-item-container-shape-start-start
132
+ --_item-container-shape-start-start
133
133
  );
134
134
  z-index: 2;
135
135
  --focus-ring-inset: 0px;
@@ -145,43 +145,43 @@
145
145
  z-index: 2;
146
146
 
147
147
  --skeleton-container-shape-start-start: var(
148
- --private-item-container-shape-start-start
148
+ --_item-container-shape-start-start
149
149
  );
150
150
  --skeleton-container-shape-start-end: var(
151
- --private-item-container-shape-start-end
151
+ --_item-container-shape-start-end
152
152
  );
153
153
  --skeleton-container-shape-end-start: var(
154
- --private-item-container-shape-end-start
154
+ --_item-container-shape-end-start
155
155
  );
156
156
  --skeleton-container-shape-end-end: var(
157
- --private-item-container-shape-end-end
157
+ --_item-container-shape-end-end
158
158
  );
159
159
  }
160
160
  }
161
161
  }
162
162
 
163
163
  :host {
164
- --private-item-container-color: var(--menu-item-container-color);
165
- --private-item-label-text-color: var(--menu-item-label-color);
166
- --private-item-container-shape-start-start: var(--shape-corner-medium);
167
- --private-item-container-shape-start-end: var(--shape-corner-medium);
168
- --private-item-container-shape-end-start: var(--shape-corner-medium);
169
- --private-item-container-shape-end-end: var(--shape-corner-medium);
164
+ --_item-container-color: var(--menu-item-container-color);
165
+ --_item-label-text-color: var(--menu-item-label-color);
166
+ --_item-container-shape-start-start: var(--shape-corner-medium);
167
+ --_item-container-shape-start-end: var(--shape-corner-medium);
168
+ --_item-container-shape-end-start: var(--shape-corner-medium);
169
+ --_item-container-shape-end-end: var(--shape-corner-medium);
170
170
  }
171
171
 
172
172
  :host([selected]) {
173
- --private-item-container-color: var(--menu-item-container-selected-color);
174
- --private-item-label-text-color: var(--menu-item-label-selected-color);
175
- --private-item-container-shape-start-start: var(--shape-corner-large);
176
- --private-item-container-shape-start-end: var(--shape-corner-large);
177
- --private-item-container-shape-end-start: var(--shape-corner-large);
178
- --private-item-container-shape-end-end: var(--shape-corner-large);
173
+ --_item-container-color: var(--menu-item-container-selected-color);
174
+ --_item-label-text-color: var(--menu-item-label-selected-color);
175
+ --_item-container-shape-start-start: var(--shape-corner-large);
176
+ --_item-container-shape-start-end: var(--shape-corner-large);
177
+ --_item-container-shape-end-start: var(--shape-corner-large);
178
+ --_item-container-shape-end-end: var(--shape-corner-large);
179
179
  }
180
180
 
181
181
  :host([disabled]),
182
182
  :host([soft-disabled]) {
183
183
  cursor: not-allowed;
184
- --private-item-label-text-color: var(--color-on-surface);
184
+ --_item-label-text-color: var(--color-on-surface);
185
185
  --_container-opacity: 0.12;
186
186
 
187
187
  .ripple {
@@ -0,0 +1,2 @@
1
+ export { NavigationBar } from './navigation-bar.js';
2
+ export { NavigationBarItem } from './navigation-bar-item.js';
@@ -0,0 +1,25 @@
1
+ import IndividualComponent from '@/IndividualComponent.js';
2
+ import { NavigationRailItem } from '../navigation-rail/navigation-rail-item.js';
3
+
4
+ /**
5
+ * @label Navigation Bar Item
6
+ * @tag wc-navigation-bar-item
7
+ * @rawTag navigation-bar-item
8
+ *
9
+ * @summary A destination in a navigation bar.
10
+ * @overview
11
+ * <p>Shows an icon inside the active-indicator pill with a label below. It has the same API as
12
+ * <code>wc-navigation-rail-item</code>: <code>active</code>, <code>disabled</code>, <code>href</code>,
13
+ * <code>value</code>, and the <code>icon</code> and <code>active-icon</code> slots.</p>
14
+ *
15
+ * @example
16
+ * ```html
17
+ * <wc-navigation-bar-item active>
18
+ * <wc-icon slot="icon" name="home"></wc-icon>
19
+ * Home
20
+ * </wc-navigation-bar-item>
21
+ * ```
22
+ * @tags navigation
23
+ */
24
+ @IndividualComponent
25
+ export class NavigationBarItem extends NavigationRailItem {}
@@ -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
+ }