@redvars/peacock 3.4.0 → 3.5.1

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 (258) hide show
  1. package/dist/BaseButton-DuASuVth.js +219 -0
  2. package/dist/BaseButton-DuASuVth.js.map +1 -0
  3. package/dist/BaseHyperlinkMixin-BNuwbiEf.js +65 -0
  4. package/dist/BaseHyperlinkMixin-BNuwbiEf.js.map +1 -0
  5. package/dist/assets/components.css +1 -1
  6. package/dist/assets/components.css.map +1 -1
  7. package/dist/assets/styles.css +1 -1
  8. package/dist/assets/styles.css.map +1 -1
  9. package/dist/banner.js +187 -0
  10. package/dist/banner.js.map +1 -0
  11. package/dist/bottom-sheet.js +2 -2
  12. package/dist/{button-COYCtuA8.js → button-DouvOfEU.js} +92 -283
  13. package/dist/button-DouvOfEU.js.map +1 -0
  14. package/dist/{button-group-DsXquZQn.js → button-group-CEdMwvJJ.js} +72 -48
  15. package/dist/button-group-CEdMwvJJ.js.map +1 -0
  16. package/dist/button-group.js +8 -5
  17. package/dist/button-group.js.map +1 -1
  18. package/dist/button.js +7 -4
  19. package/dist/button.js.map +1 -1
  20. package/dist/card.js +29 -74
  21. package/dist/card.js.map +1 -1
  22. package/dist/chart-bar.js +2 -2
  23. package/dist/chart-bar.js.map +1 -1
  24. package/dist/chart-doughnut.js +2 -2
  25. package/dist/chart-doughnut.js.map +1 -1
  26. package/dist/chart-pie.js +2 -2
  27. package/dist/chart-pie.js.map +1 -1
  28. package/dist/chart-stacked-bar.js +2 -2
  29. package/dist/chart-stacked-bar.js.map +1 -1
  30. package/dist/{class-map-3TAnCMAX.js → class-map-YU7g0o3B.js} +2 -2
  31. package/dist/{class-map-3TAnCMAX.js.map → class-map-YU7g0o3B.js.map} +1 -1
  32. package/dist/clock.js.map +1 -1
  33. package/dist/code-editor.js +4 -4
  34. package/dist/code-editor.js.map +1 -1
  35. package/dist/code-highlighter.js +5 -4
  36. package/dist/code-highlighter.js.map +1 -1
  37. package/dist/custom-elements-jsdocs.json +6627 -3477
  38. package/dist/custom-elements.json +10954 -7810
  39. package/dist/directive-ZPhl09Yt.js +9 -0
  40. package/dist/directive-ZPhl09Yt.js.map +1 -0
  41. package/dist/dispatch-event-utils-CuEqjlPT.js +127 -0
  42. package/dist/dispatch-event-utils-CuEqjlPT.js.map +1 -0
  43. package/dist/fab.js +423 -0
  44. package/dist/fab.js.map +1 -0
  45. package/dist/index.js +17 -9
  46. package/dist/index.js.map +1 -1
  47. package/dist/{observe-theme-change-DKAIv5BB.js → is-dark-mode-DicqGkCJ.js} +6 -2
  48. package/dist/is-dark-mode-DicqGkCJ.js.map +1 -0
  49. package/dist/{select-C3XAzenC.js → navigation-rail-Lxetd5-Z.js} +2426 -898
  50. package/dist/navigation-rail-Lxetd5-Z.js.map +1 -0
  51. package/dist/notification.js +418 -0
  52. package/dist/notification.js.map +1 -0
  53. package/dist/number-counter.js +2 -2
  54. package/dist/number-counter.js.map +1 -1
  55. package/dist/observe-slot-change-BGJfgg2E.js +31 -0
  56. package/dist/observe-slot-change-BGJfgg2E.js.map +1 -0
  57. package/dist/peacock-loader.js +48 -13
  58. package/dist/peacock-loader.js.map +1 -1
  59. package/dist/search.js +456 -0
  60. package/dist/search.js.map +1 -0
  61. package/dist/side-sheet.js +2 -2
  62. package/dist/src/__mixins/BaseButtonMixin.d.ts +20 -0
  63. package/dist/src/__mixins/BaseHyperlinkMixin.d.ts +18 -0
  64. package/dist/src/__mixins/MixinConstructor.d.ts +1 -0
  65. package/dist/src/__utils/cache-fetch.d.ts +1 -0
  66. package/dist/src/__utils/is-dark-mode.d.ts +1 -0
  67. package/dist/src/__utils/is-in-viewport.d.ts +1 -0
  68. package/dist/src/__utils/observe-slot-change.d.ts +1 -0
  69. package/dist/src/__utils/sanitize-svg.d.ts +1 -0
  70. package/dist/src/__utils/throttle.d.ts +4 -0
  71. package/dist/src/accordion/accordion-item.d.ts +33 -9
  72. package/dist/src/accordion/accordion.d.ts +21 -5
  73. package/dist/src/banner/banner.d.ts +43 -0
  74. package/dist/src/banner/index.d.ts +1 -0
  75. package/dist/src/button/BaseButton.d.ts +7 -57
  76. package/dist/src/button/button/button.d.ts +32 -3
  77. package/dist/src/button/button-group/button-group.d.ts +4 -4
  78. package/dist/src/button/icon-button/icon-button.d.ts +33 -8
  79. package/dist/src/card/card.d.ts +4 -15
  80. package/dist/src/empty-state/empty-state.d.ts +1 -1
  81. package/dist/src/fab/fab.d.ts +80 -0
  82. package/dist/src/fab/index.d.ts +1 -0
  83. package/dist/src/focus-ring/focus-ring.d.ts +11 -5
  84. package/dist/src/index.d.ts +8 -1
  85. package/dist/src/link/link.d.ts +3 -10
  86. package/dist/src/menu/menu/menu.d.ts +3 -2
  87. package/dist/src/menu/sub-menu/sub-menu.d.ts +1 -0
  88. package/dist/src/navigation-rail/index.d.ts +2 -0
  89. package/dist/src/navigation-rail/navigation-rail-item.d.ts +55 -0
  90. package/dist/src/navigation-rail/navigation-rail.d.ts +71 -0
  91. package/dist/src/notification/index.d.ts +1 -0
  92. package/dist/src/notification/notification.d.ts +69 -0
  93. package/dist/src/pagination/pagination.d.ts +8 -1
  94. package/dist/src/search/index.d.ts +1 -0
  95. package/dist/src/search/search.d.ts +76 -0
  96. package/dist/src/select/select.d.ts +3 -5
  97. package/dist/src/sidebar-menu/index.d.ts +3 -0
  98. package/dist/src/sidebar-menu/sidebar-menu-item.d.ts +58 -0
  99. package/dist/src/sidebar-menu/sidebar-menu.d.ts +38 -0
  100. package/dist/src/sidebar-menu/sidebar-sub-menu.d.ts +35 -0
  101. package/dist/src/slider/slider.d.ts +4 -0
  102. package/dist/src/snackbar/snackbar.d.ts +14 -1
  103. package/dist/src/toolbar/index.d.ts +1 -0
  104. package/dist/src/toolbar/toolbar.d.ts +86 -0
  105. package/dist/src/tooltip/tooltip.d.ts +3 -0
  106. package/dist/src/url-field/index.d.ts +1 -0
  107. package/dist/src/url-field/url-field.d.ts +48 -0
  108. package/dist/{style-map-CRFEoCEg.js → style-map-DVmWOuYy.js} +2 -2
  109. package/dist/{style-map-CRFEoCEg.js.map → style-map-DVmWOuYy.js.map} +1 -1
  110. package/dist/test/banner.test.d.ts +1 -0
  111. package/dist/test/search.test.d.ts +1 -0
  112. package/dist/test/sidebar-menu.test.d.ts +1 -0
  113. package/dist/test/toolbar.test.d.ts +1 -0
  114. package/dist/toolbar.js +306 -0
  115. package/dist/toolbar.js.map +1 -0
  116. package/dist/tsconfig.tsbuildinfo +1 -1
  117. package/dist/{unsafe-html-D3GHRaGQ.js → unsafe-html-BsGUjx94.js} +2 -2
  118. package/dist/{unsafe-html-D3GHRaGQ.js.map → unsafe-html-BsGUjx94.js.map} +1 -1
  119. package/package.json +1 -1
  120. package/readme.md +73 -65
  121. package/scss/mixin.scss +16 -0
  122. package/scss/styles.scss +4 -0
  123. package/src/__mixins/BaseButtonMixin.ts +83 -0
  124. package/src/__mixins/BaseHyperlinkMixin.ts +68 -0
  125. package/src/__mixins/MixinConstructor.ts +1 -0
  126. package/src/__mixins/README.md +19 -0
  127. package/src/__utils/cache-fetch.ts +65 -0
  128. package/src/__utils/is-dark-mode.ts +3 -0
  129. package/src/__utils/is-in-viewport.ts +6 -0
  130. package/src/__utils/observe-slot-change.ts +38 -0
  131. package/src/__utils/sanitize-svg.ts +27 -0
  132. package/src/__utils/throttle.ts +27 -0
  133. package/src/accordion/accordion-item.scss +136 -65
  134. package/src/accordion/accordion-item.ts +117 -44
  135. package/src/accordion/accordion.scss +24 -5
  136. package/src/accordion/accordion.ts +29 -23
  137. package/src/accordion/demo/index.html +74 -35
  138. package/src/banner/banner.scss +83 -0
  139. package/src/banner/banner.ts +101 -0
  140. package/src/banner/index.ts +1 -0
  141. package/src/button/BaseButton.ts +13 -115
  142. package/src/button/button/button-colors.scss +14 -14
  143. package/src/button/button/button-sizes.scss +4 -2
  144. package/src/button/button/button.ts +80 -26
  145. package/src/button/button-group/button-group.ts +5 -5
  146. package/src/button/icon-button/icon-button.ts +79 -44
  147. package/src/card/card.ts +50 -100
  148. package/src/chart-bar/chart-bar.ts +10 -15
  149. package/src/chart-bar/chart-stacked-bar.ts +15 -19
  150. package/src/chart-doughnut/chart-doughnut.ts +24 -28
  151. package/src/chart-pie/chart-pie.ts +20 -24
  152. package/src/checkbox/checkbox.scss +17 -34
  153. package/src/checkbox/checkbox.ts +4 -2
  154. package/src/clock/clock.ts +1 -1
  155. package/src/code-editor/code-editor.ts +4 -4
  156. package/src/code-highlighter/code-highlighter.scss +1 -0
  157. package/src/code-highlighter/code-highlighter.ts +3 -3
  158. package/src/date-picker/date-picker.ts +6 -3
  159. package/src/divider/divider.ts +3 -1
  160. package/src/elevation/elevation.scss +5 -5
  161. package/src/empty-state/empty-state.scss +7 -9
  162. package/src/empty-state/empty-state.ts +1 -1
  163. package/src/fab/fab-colors.scss +49 -0
  164. package/src/fab/fab-sizes.scss +47 -0
  165. package/src/fab/fab.scss +137 -0
  166. package/src/fab/fab.ts +214 -0
  167. package/src/fab/index.ts +1 -0
  168. package/src/field/field.ts +3 -1
  169. package/src/focus-ring/focus-ring.ts +47 -40
  170. package/src/icon/datasource.ts +1 -1
  171. package/src/icon/icon.ts +3 -1
  172. package/src/image/image.ts +3 -2
  173. package/src/index.ts +8 -1
  174. package/src/input/input.ts +8 -3
  175. package/src/link/link.ts +2 -15
  176. package/src/menu/menu/menu.scss +7 -0
  177. package/src/menu/menu/menu.ts +7 -4
  178. package/src/menu/menu-item/menu-item.ts +3 -1
  179. package/src/menu/sub-menu/sub-menu.ts +1 -0
  180. package/src/navigation-rail/index.ts +2 -0
  181. package/src/navigation-rail/navigation-rail-item.scss +216 -0
  182. package/src/navigation-rail/navigation-rail-item.ts +223 -0
  183. package/src/navigation-rail/navigation-rail.scss +72 -0
  184. package/src/navigation-rail/navigation-rail.ts +149 -0
  185. package/src/notification/index.ts +1 -0
  186. package/src/notification/notification.scss +201 -0
  187. package/src/notification/notification.ts +207 -0
  188. package/src/number-counter/number-counter.ts +3 -1
  189. package/src/number-field/number-field.ts +10 -6
  190. package/src/pagination/pagination.scss +33 -24
  191. package/src/pagination/pagination.ts +115 -60
  192. package/src/peacock-loader.ts +42 -5
  193. package/src/radio/radio.ts +3 -1
  194. package/src/search/index.ts +1 -0
  195. package/src/search/search-colors.scss +14 -0
  196. package/src/search/search.scss +204 -0
  197. package/src/search/search.ts +244 -0
  198. package/src/select/option.ts +1 -1
  199. package/src/select/select.scss +5 -0
  200. package/src/select/select.ts +71 -37
  201. package/src/sidebar-menu/demo/index.html +68 -0
  202. package/src/sidebar-menu/index.ts +3 -0
  203. package/src/sidebar-menu/sidebar-menu-item.scss +102 -0
  204. package/src/sidebar-menu/sidebar-menu-item.ts +151 -0
  205. package/src/{tree-view/tree-view.scss → sidebar-menu/sidebar-menu.scss} +1 -1
  206. package/src/sidebar-menu/sidebar-menu.ts +182 -0
  207. package/src/sidebar-menu/sidebar-sub-menu.scss +130 -0
  208. package/src/sidebar-menu/sidebar-sub-menu.ts +160 -0
  209. package/src/skeleton/skeleton.scss +18 -24
  210. package/src/slider/slider.scss +19 -0
  211. package/src/slider/slider.ts +30 -19
  212. package/src/snackbar/snackbar.scss +62 -31
  213. package/src/snackbar/snackbar.ts +91 -11
  214. package/src/switch/switch.ts +3 -1
  215. package/src/table/table.ts +3 -1
  216. package/src/tabs/tab.ts +10 -6
  217. package/src/text/text.css-component.scss +7 -1
  218. package/src/textarea/textarea.ts +4 -2
  219. package/src/time-picker/time-picker.ts +5 -3
  220. package/src/toolbar/index.ts +1 -0
  221. package/src/toolbar/toolbar-colors.scss +16 -0
  222. package/src/toolbar/toolbar.scss +165 -0
  223. package/src/toolbar/toolbar.ts +137 -0
  224. package/src/tooltip/tooltip.ts +24 -0
  225. package/src/url-field/index.ts +1 -0
  226. package/src/url-field/url-field.scss +50 -0
  227. package/src/url-field/url-field.ts +239 -0
  228. package/dist/button-COYCtuA8.js.map +0 -1
  229. package/dist/button-group-DsXquZQn.js.map +0 -1
  230. package/dist/directive-Cuw6h7YA.js +0 -9
  231. package/dist/directive-Cuw6h7YA.js.map +0 -1
  232. package/dist/dispatch-event-utils-B4odODQf.js +0 -277
  233. package/dist/dispatch-event-utils-B4odODQf.js.map +0 -1
  234. package/dist/observe-theme-change-DKAIv5BB.js.map +0 -1
  235. package/dist/select-C3XAzenC.js.map +0 -1
  236. package/dist/src/styleMixins.css.d.ts +0 -9
  237. package/dist/src/tree-view/index.d.ts +0 -2
  238. package/dist/src/tree-view/tree-node.d.ts +0 -69
  239. package/dist/src/tree-view/tree-view.d.ts +0 -40
  240. package/dist/src/tree-view/wc-tree-view.d.ts +0 -6
  241. package/dist/src/utils.d.ts +0 -9
  242. package/dist/test/tree-view.test.d.ts +0 -1
  243. package/src/styleMixins.css.ts +0 -55
  244. package/src/tree-view/demo/index.html +0 -57
  245. package/src/tree-view/index.ts +0 -2
  246. package/src/tree-view/tree-node.scss +0 -101
  247. package/src/tree-view/tree-node.ts +0 -268
  248. package/src/tree-view/tree-view.ts +0 -182
  249. package/src/tree-view/wc-tree-view.ts +0 -9
  250. package/src/utils.ts +0 -193
  251. /package/dist/src/{spread.d.ts → __directive/spread.d.ts} +0 -0
  252. /package/dist/src/{utils → __utils}/copy-to-clipboard.d.ts +0 -0
  253. /package/dist/src/{utils → __utils}/dispatch-event-utils.d.ts +0 -0
  254. /package/dist/src/{utils → __utils}/observe-theme-change.d.ts +0 -0
  255. /package/src/{spread.ts → __directive/spread.ts} +0 -0
  256. /package/src/{utils → __utils}/copy-to-clipboard.ts +0 -0
  257. /package/src/{utils → __utils}/dispatch-event-utils.ts +0 -0
  258. /package/src/{utils → __utils}/observe-theme-change.ts +0 -0
@@ -0,0 +1,72 @@
1
+ @use '../../scss/mixin';
2
+
3
+ @include mixin.base-styles;
4
+
5
+ :host {
6
+ display: block;
7
+ height: 100%;
8
+ width: var(--nav-rail-width, 5rem); /* 80dp */
9
+ overflow: hidden;
10
+ }
11
+
12
+ .rail {
13
+ display: flex;
14
+ flex-direction: column;
15
+ align-items: center;
16
+ height: 100%;
17
+ width: 100%;
18
+ border-radius: inherit;
19
+ background-color: var(--nav-rail-container-color, var(--color-surface));
20
+ padding-block: var(--nav-rail-padding-block, 0.75rem); /* 12dp */
21
+ box-sizing: border-box;
22
+
23
+ .header {
24
+ display: flex;
25
+ flex-direction: column;
26
+ align-items: center;
27
+ width: 100%;
28
+ flex-shrink: 0;
29
+
30
+ &:empty {
31
+ display: none;
32
+ }
33
+ }
34
+
35
+ wc-divider {
36
+ width: calc(100% - 1rem);
37
+ margin-block: 0.5rem;
38
+ flex-shrink: 0;
39
+ }
40
+
41
+ .items {
42
+ display: flex;
43
+ flex-direction: column;
44
+ align-items: center;
45
+ width: 100%;
46
+ gap: 0.75rem; /* 12dp between items */
47
+ flex: 1;
48
+
49
+ ::slotted(wc-navigation-rail-item) {
50
+ width: 100%;
51
+ }
52
+ }
53
+
54
+ /* Alignment variants */
55
+ &.align-top {
56
+ .items {
57
+ justify-content: flex-start;
58
+ }
59
+ }
60
+
61
+ &.align-center {
62
+ .items {
63
+ justify-content: center;
64
+ }
65
+ }
66
+
67
+ &.align-bottom {
68
+ .items {
69
+ justify-content: flex-end;
70
+ }
71
+ }
72
+ }
@@ -0,0 +1,149 @@
1
+ import { html, LitElement, PropertyValues } from 'lit';
2
+ import { property } from 'lit/decorators.js';
3
+ import { classMap } from 'lit/directives/class-map.js';
4
+ import styles from './navigation-rail.scss';
5
+ import { NavigationRailItem } from './navigation-rail-item.js';
6
+
7
+ /**
8
+ * @label Navigation Rail
9
+ * @tag wc-navigation-rail
10
+ * @rawTag navigation-rail
11
+ *
12
+ * @summary A vertical side navigation for medium-sized screens, following Material Design 3 specs.
13
+ * @overview
14
+ * <p>Navigation rail provides access to primary destinations in an app using icons—with or without labels—on a vertical rail.</p>
15
+ * <p>Use navigation rail on medium-sized screens (tablets) with 3–7 destinations.</p>
16
+ *
17
+ * @cssprop --nav-rail-width - Width of the rail container. Defaults to 5rem (80dp).
18
+ * @cssprop --nav-rail-container-color - Background color of the rail. Defaults to surface color.
19
+ * @cssprop --nav-rail-indicator-color - Color of the active indicator. Defaults to secondary-container.
20
+ * @cssprop --nav-rail-indicator-shape - Shape (border-radius) of the active indicator. Defaults to full (pill).
21
+ * @cssprop --nav-rail-indicator-width - Width of the active indicator. Defaults to 3.5rem (56dp).
22
+ * @cssprop --nav-rail-indicator-height - Height of the active indicator. Defaults to 2rem (32dp).
23
+ * @cssprop --nav-rail-inactive-icon-color - Color of inactive icons. Defaults to on-surface-variant.
24
+ * @cssprop --nav-rail-active-icon-color - Color of active icons. Defaults to on-secondary-container.
25
+ * @cssprop --nav-rail-inactive-label-color - Color of inactive labels. Defaults to on-surface-variant.
26
+ * @cssprop --nav-rail-active-label-color - Color of active labels. Defaults to on-surface.
27
+ *
28
+ * @example
29
+ * ```html
30
+ * <wc-navigation-rail>
31
+ * <wc-navigation-rail-item active>
32
+ * <wc-icon slot="icon">home</wc-icon>
33
+ * Home
34
+ * </wc-navigation-rail-item>
35
+ * <wc-navigation-rail-item>
36
+ * <wc-icon slot="icon">search</wc-icon>
37
+ * Search
38
+ * </wc-navigation-rail-item>
39
+ * <wc-navigation-rail-item>
40
+ * <wc-icon slot="icon">settings</wc-icon>
41
+ * Settings
42
+ * </wc-navigation-rail-item>
43
+ * </wc-navigation-rail>
44
+ * ```
45
+ * @tags navigation
46
+ */
47
+ export class NavigationRail extends LitElement {
48
+ static styles = [styles];
49
+
50
+ static Item = NavigationRailItem;
51
+
52
+ /**
53
+ * Vertical alignment of items within the rail.
54
+ * - `"top"`: Items align to the top.
55
+ * - `"center"`: Items are centered (default).
56
+ * - `"bottom"`: Items align to the bottom.
57
+ */
58
+ @property({ reflect: true }) alignment: 'top' | 'center' | 'bottom' = 'center';
59
+
60
+ /**
61
+ * Display mode of the navigation rail.
62
+ * - `"expanded"`: shows labels.
63
+ * - `"collapsed"`: hides labels.
64
+ */
65
+ @property({ reflect: true }) mode: 'expanded' | 'collapsed' = 'expanded';
66
+
67
+ /**
68
+ * Whether to show a divider between the header and items sections.
69
+ */
70
+ @property({ type: Boolean, attribute: 'show-divider' }) showDivider = false;
71
+
72
+ connectedCallback() {
73
+ super.connectedCallback();
74
+ this.addEventListener('click', this._handleItemClick);
75
+ this.setAttribute('role', 'navigation');
76
+ this.setAttribute('aria-label', this.getAttribute('aria-label') ?? 'Main navigation');
77
+ }
78
+
79
+ disconnectedCallback() {
80
+ this.removeEventListener('click', this._handleItemClick);
81
+ super.disconnectedCallback();
82
+ }
83
+
84
+ protected override firstUpdated() {
85
+ this._syncItemMode();
86
+ }
87
+
88
+ protected override updated(changedProperties: PropertyValues<this>) {
89
+ if (changedProperties.has('mode')) {
90
+ this._syncItemMode();
91
+ }
92
+ }
93
+
94
+ private _handleItemClick = (event: Event) => {
95
+ const target = event.target as HTMLElement;
96
+ const item = target.closest('wc-navigation-rail-item') as NavigationRailItem | null;
97
+
98
+ if (!item || item.disabled) return;
99
+
100
+ // Deactivate all items and activate the clicked one
101
+ for (const railItem of this._getItems()) {
102
+ railItem.active = railItem === item;
103
+ }
104
+
105
+ this.dispatchEvent(
106
+ new CustomEvent('nav-change', {
107
+ detail: {
108
+ value: item.value,
109
+ item,
110
+ },
111
+ bubbles: true,
112
+ composed: true,
113
+ }),
114
+ );
115
+ };
116
+
117
+ private _getItems(): NavigationRailItem[] {
118
+ return Array.from(
119
+ this.querySelectorAll('wc-navigation-rail-item'),
120
+ ) as NavigationRailItem[];
121
+ }
122
+
123
+ private _syncItemMode = () => {
124
+ const isCollapsed = this.mode === 'collapsed';
125
+ for (const railItem of this._getItems()) {
126
+ railItem.collapsed = isCollapsed;
127
+ }
128
+ };
129
+
130
+ render() {
131
+ const cssClasses = {
132
+ rail: true,
133
+ [`align-${this.alignment}`]: true,
134
+ [`mode-${this.mode}`]: true,
135
+ };
136
+
137
+ return html`
138
+ <div class=${classMap(cssClasses)}>
139
+ <div class="header">
140
+ <slot name="header"></slot>
141
+ </div>
142
+ ${this.showDivider ? html`<wc-divider></wc-divider>` : ''}
143
+ <nav class="items" role="presentation">
144
+ <slot @slotchange=${this._syncItemMode}></slot>
145
+ </nav>
146
+ </div>
147
+ `;
148
+ }
149
+ }
@@ -0,0 +1 @@
1
+ export { Notification } from './notification.js';
@@ -0,0 +1,201 @@
1
+ @use '../../scss/mixin';
2
+
3
+ @include mixin.base-styles;
4
+
5
+ :host {
6
+ --notification-container-color: var(--color-primary-container);
7
+ --notification-text-color: var(--color-on-primary-container);
8
+ --notification-leading-icon-color: var(--color-on-primary-container);
9
+ --notification-accent-color: var(--color-primary);
10
+ --notification-border-radius: var(--shape-corner-medium);
11
+
12
+ display: block;
13
+ }
14
+
15
+ :host(:not([inline])) {
16
+ width: min(100%, 28rem);
17
+ }
18
+
19
+ .notification {
20
+ align-items: flex-start;
21
+ background: var(--notification-container-color);
22
+ border-inline-start: 4px solid var(--notification-accent-color);
23
+ border-radius: var(--notification-border-radius);
24
+ color: var(--notification-text-color);
25
+ display: grid;
26
+ gap: var(--spacing-100);
27
+ grid-template-columns: auto 1fr auto;
28
+ padding: var(--spacing-150) var(--spacing-100) var(--spacing-150) var(--spacing-150);
29
+ }
30
+
31
+ .state-icon {
32
+ align-items: center;
33
+ color: var(--notification-leading-icon-color);
34
+ display: inline-flex;
35
+ justify-content: center;
36
+ min-height: 2rem;
37
+
38
+ --icon-size: 1.25rem;
39
+ --icon-color: var(--notification-leading-icon-color);
40
+ }
41
+
42
+ .content {
43
+ display: flex;
44
+ flex-direction: column;
45
+ gap: var(--spacing-100);
46
+ min-width: 0;
47
+ }
48
+
49
+ .content-text {
50
+ display: flex;
51
+ flex-direction: column;
52
+ gap: var(--spacing-025);
53
+ min-width: 0;
54
+ }
55
+
56
+ .title {
57
+ @include mixin.get-typography(label-large);
58
+ color: var(--notification-text-color);
59
+ overflow-wrap: anywhere;
60
+ }
61
+
62
+ .subtitle {
63
+ @include mixin.get-typography(body-medium);
64
+ color: var(--notification-text-color);
65
+ opacity: 0.88;
66
+ overflow-wrap: anywhere;
67
+ }
68
+
69
+ .title ::slotted(*),
70
+ .subtitle ::slotted(*) {
71
+ margin: 0;
72
+ }
73
+
74
+ .actions {
75
+ display: inline-flex;
76
+ gap: var(--spacing-100);
77
+ }
78
+
79
+ .action {
80
+ --outlined-button-label-text-color: var(--notification-text-color);
81
+ --outlined-button-outline-color: color-mix(in srgb, var(--notification-text-color) 40%, transparent);
82
+ --text-button-label-text-color: var(--notification-text-color);
83
+ }
84
+
85
+ .close-button-container {
86
+ display: inline-flex;
87
+ }
88
+
89
+ .close-button {
90
+ --text-button-label-text-color: var(--notification-text-color);
91
+ }
92
+
93
+ .notification.inline {
94
+ align-items: center;
95
+ }
96
+
97
+ .notification.inline .content {
98
+ align-items: center;
99
+ display: flex;
100
+ flex-direction: row;
101
+ gap: var(--spacing-150);
102
+ }
103
+
104
+ .notification.inline .content-text {
105
+ display: inline;
106
+ flex: 1;
107
+ }
108
+
109
+ .notification.inline .title,
110
+ .notification.inline .subtitle,
111
+ .notification.inline .title ::slotted(*),
112
+ .notification.inline .subtitle ::slotted(*) {
113
+ display: inline;
114
+ }
115
+
116
+ .notification:not(.has-subtitle) {
117
+ align-items: center;
118
+ }
119
+
120
+ .notification:not(.has-subtitle) .content {
121
+ gap: 0;
122
+ }
123
+
124
+ .notification.variant-info {
125
+ --notification-container-color: var(--color-primary-container);
126
+ --notification-text-color: var(--color-on-primary-container);
127
+ --notification-leading-icon-color: var(--color-on-primary-container);
128
+ --notification-accent-color: var(--color-primary);
129
+ }
130
+
131
+ .notification.variant-success {
132
+ --notification-container-color: var(--color-success-container);
133
+ --notification-text-color: var(--color-on-success-container);
134
+ --notification-leading-icon-color: var(--color-on-success-container);
135
+ --notification-accent-color: var(--color-success);
136
+ }
137
+
138
+ .notification.variant-warning {
139
+ --notification-container-color: var(--color-warning-container);
140
+ --notification-text-color: var(--color-on-warning-container);
141
+ --notification-leading-icon-color: var(--color-on-warning-container);
142
+ --notification-accent-color: var(--color-warning);
143
+ }
144
+
145
+ .notification.variant-error {
146
+ --notification-container-color: var(--color-error-container);
147
+ --notification-text-color: var(--color-on-error-container);
148
+ --notification-leading-icon-color: var(--color-on-error-container);
149
+ --notification-accent-color: var(--color-error);
150
+ }
151
+
152
+ .notification.high-contrast {
153
+ --notification-container-color: var(--color-inverse-surface);
154
+ --notification-text-color: var(--color-inverse-on-surface);
155
+ --notification-leading-icon-color: var(--color-inverse-on-surface);
156
+ }
157
+
158
+ .notification.high-contrast.variant-info {
159
+ --notification-accent-color: var(--color-primary);
160
+ }
161
+
162
+ .notification.high-contrast.variant-success {
163
+ --notification-accent-color: var(--color-success);
164
+ }
165
+
166
+ .notification.high-contrast.variant-warning {
167
+ --notification-accent-color: var(--color-warning);
168
+ }
169
+
170
+ .notification.high-contrast.variant-error {
171
+ --notification-accent-color: var(--color-error);
172
+ }
173
+
174
+ @media (max-width: 640px) {
175
+ :host(:not([inline])) {
176
+ width: 100%;
177
+ }
178
+
179
+ .notification.inline {
180
+ align-items: flex-start;
181
+ }
182
+
183
+ .notification.inline .content {
184
+ align-items: flex-start;
185
+ flex-direction: column;
186
+ gap: var(--spacing-100);
187
+ }
188
+
189
+ .notification.inline .content-text {
190
+ display: flex;
191
+ flex-direction: column;
192
+ gap: var(--spacing-025);
193
+ }
194
+
195
+ .notification.inline .title,
196
+ .notification.inline .subtitle,
197
+ .notification.inline .title ::slotted(*),
198
+ .notification.inline .subtitle ::slotted(*) {
199
+ display: initial;
200
+ }
201
+ }
@@ -0,0 +1,207 @@
1
+ import { LitElement, html, nothing } from 'lit';
2
+ import { property, state } from 'lit/decorators.js';
3
+ import { classMap } from 'lit/directives/class-map.js';
4
+
5
+ import IndividualComponent from '@/IndividualComponent.js';
6
+ import styles from './notification.scss';
7
+
8
+ type NotificationVariant = 'success' | 'error' | 'info' | 'warning';
9
+
10
+ const VARIANT_LABELS: Record<NotificationVariant, string> = {
11
+ success: 'Success',
12
+ error: 'Error',
13
+ info: 'Information',
14
+ warning: 'Warning',
15
+ };
16
+
17
+ const VARIANT_ICONS: Record<NotificationVariant, string> = {
18
+ success: 'check_circle',
19
+ error: 'error',
20
+ info: 'info',
21
+ warning: 'warning',
22
+ };
23
+
24
+ /**
25
+ * @label Notification
26
+ * @tag wc-notification
27
+ * @rawTag notification
28
+ * @summary Notifications communicate contextual status, errors, warnings, and success messages.
29
+ *
30
+ * @cssprop --notification-container-color - Surface color for the notification container.
31
+ * @cssprop --notification-text-color - Label and supporting text color.
32
+ * @cssprop --notification-leading-icon-color - Leading state icon color.
33
+ * @cssprop --notification-accent-color - Start border color for status emphasis.
34
+ * @cssprop --notification-border-radius - Border radius of the notification container.
35
+ *
36
+ * @fires {CustomEvent} notification-dismiss - Fired when the notification is dismissed.
37
+ * @fires {CustomEvent} notification-action-click - Fired when the action button is clicked.
38
+ *
39
+ * @example
40
+ * ```html
41
+ * <wc-notification variant="success" action="Undo" dismissible>
42
+ * <span slot="title">Record saved</span>
43
+ * </wc-notification>
44
+ * ```
45
+ * @tags display, feedback
46
+ */
47
+ @IndividualComponent
48
+ export class Notification extends LitElement {
49
+ static styles = [styles];
50
+
51
+ /**
52
+ * If true, content and actions are laid out in a single row.
53
+ */
54
+ @property({ type: Boolean, reflect: true }) inline = false;
55
+
56
+ /**
57
+ * The visual variant of the notification.
58
+ */
59
+ @property({ type: String, reflect: true })
60
+ variant: NotificationVariant = 'info';
61
+
62
+ /**
63
+ * Enables a high contrast appearance.
64
+ */
65
+ @property({ type: Boolean, reflect: true, attribute: 'high-contrast' })
66
+ highContrast = false;
67
+
68
+ /**
69
+ * If true, renders a dismiss icon button.
70
+ */
71
+ @property({ type: Boolean, reflect: true }) dismissible = false;
72
+
73
+ /**
74
+ * Action label text. When provided, an action button is shown.
75
+ */
76
+ @property({ type: String }) action = '';
77
+
78
+ /**
79
+ * If true, the host controls visibility when dismissed.
80
+ */
81
+ @property({ type: Boolean, reflect: true }) managed = false;
82
+
83
+ @state() private isHidden = false;
84
+
85
+ @state() private hasSubtitle = false;
86
+
87
+ /**
88
+ * Programmatically reveals the notification.
89
+ */
90
+ show() {
91
+ this.isHidden = false;
92
+ }
93
+
94
+ /**
95
+ * Programmatically dismisses the notification.
96
+ */
97
+ dismiss() {
98
+ this.hideAndEmitDismiss('programmatic');
99
+ }
100
+
101
+ private get variantIcon() {
102
+ return VARIANT_ICONS[this.variant];
103
+ }
104
+
105
+ private get variantLabel() {
106
+ return VARIANT_LABELS[this.variant];
107
+ }
108
+
109
+ private emitActionClick() {
110
+ this.dispatchEvent(
111
+ new CustomEvent('notification-action-click', {
112
+ bubbles: true,
113
+ composed: true,
114
+ }),
115
+ );
116
+ }
117
+
118
+ private hideAndEmitDismiss(reason: 'dismiss' | 'programmatic') {
119
+ if (!this.managed) {
120
+ this.isHidden = true;
121
+ }
122
+
123
+ this.dispatchEvent(
124
+ new CustomEvent('notification-dismiss', {
125
+ detail: { reason },
126
+ bubbles: true,
127
+ composed: true,
128
+ }),
129
+ );
130
+ }
131
+
132
+ private handleSubtitleSlotChange(event: Event) {
133
+ const slot = event.target as HTMLSlotElement;
134
+ this.hasSubtitle = slot
135
+ .assignedNodes({ flatten: true })
136
+ .some(node => node.textContent?.trim());
137
+ }
138
+
139
+ render() {
140
+ if (this.isHidden) {
141
+ return nothing;
142
+ }
143
+
144
+ return html`
145
+ <div
146
+ class=${classMap({
147
+ notification: true,
148
+ inline: this.inline,
149
+ 'high-contrast': this.highContrast,
150
+ 'has-subtitle': this.hasSubtitle,
151
+ [`variant-${this.variant}`]: true,
152
+ })}
153
+ role="alert"
154
+ aria-live="polite"
155
+ aria-label=${this.variantLabel}
156
+ >
157
+ <div class="state-icon" aria-hidden="true">
158
+ <slot name="icon">
159
+ <wc-icon name=${this.variantIcon}></wc-icon>
160
+ </slot>
161
+ </div>
162
+
163
+ <div class="content">
164
+ <div class="content-text">
165
+ <div class="title">
166
+ <slot name="title"></slot>
167
+ <slot></slot>
168
+ </div>
169
+
170
+ <div class="subtitle">
171
+ <slot name="subtitle" @slotchange=${this.handleSubtitleSlotChange}></slot>
172
+ </div>
173
+ </div>
174
+
175
+ ${this.action
176
+ ? html`<div class="actions">
177
+ <wc-button
178
+ class="action"
179
+ size="sm"
180
+ variant=${this.inline ? 'text' : 'outlined'}
181
+ @click=${this.emitActionClick}
182
+ >
183
+ ${this.action}
184
+ </wc-button>
185
+ </div>`
186
+ : nothing}
187
+ </div>
188
+
189
+ ${this.dismissible
190
+ ? html`<div class="close-button-container">
191
+ <wc-icon-button
192
+ class="close-button"
193
+ variant="text"
194
+ size="sm"
195
+ aria-label="Close notification"
196
+ @click=${() => {
197
+ this.hideAndEmitDismiss('dismiss');
198
+ }}
199
+ >
200
+ <wc-icon name="close"></wc-icon>
201
+ </wc-icon-button>
202
+ </div>`
203
+ : nothing}
204
+ </div>
205
+ `;
206
+ }
207
+ }
@@ -1,7 +1,9 @@
1
1
  import { html, LitElement, nothing } from 'lit';
2
2
  import { property } from 'lit/decorators.js';
3
3
  import { styleMap } from 'lit/directives/style-map.js';
4
- import IndividualComponent from 'src/IndividualComponent.js';
4
+
5
+ import IndividualComponent from '@/IndividualComponent.js';
6
+
5
7
  import styles from './number-counter.scss';
6
8
 
7
9
  /**
@@ -1,10 +1,12 @@
1
1
  import { html, nothing } from 'lit';
2
2
  import { property, query, state } from 'lit/decorators.js';
3
3
  import { classMap } from 'lit/directives/class-map.js';
4
- import { redispatchEvent } from 'src/utils/dispatch-event-utils.js';
4
+
5
+ import { redispatchEvent } from '@/__utils/dispatch-event-utils.js';
6
+ import { spread } from '@/__directive/spread.js';
7
+
5
8
  import BaseInput from '../input/BaseInput.js';
6
9
  import styles from './number-field.scss';
7
- import { spread } from '../spread.js';
8
10
 
9
11
  /**
10
12
  * @label Number Field
@@ -168,11 +170,12 @@ export class NumberField extends BaseInput {
168
170
  ${this.stepper && !this.disabled
169
171
  ? html`<wc-icon-button
170
172
  class="stepper"
171
- name="remove"
172
173
  variant="text"
173
174
  slot="field-start"
174
175
  @click=${this.stepDown}
175
- ></wc-icon-button>`
176
+ >
177
+ <wc-icon name="remove"></wc-icon>
178
+ </wc-icon-button>`
176
179
  : nothing}
177
180
 
178
181
  <slot name="start" slot="field-start"></slot>
@@ -204,10 +207,11 @@ export class NumberField extends BaseInput {
204
207
  ? html`<wc-icon-button
205
208
  class="stepper"
206
209
  variant="text"
207
- name="add"
208
210
  slot="field-end"
209
211
  @click=${this.stepUp}
210
- ></wc-icon-button>`
212
+ >
213
+ <wc-icon name="add"></wc-icon>
214
+ </wc-icon-button>`
211
215
  : nothing}
212
216
  </wc-field>
213
217
  `;