@eui/eds-wc 22.0.0-alpha.5 → 22.0.0-alpha.6

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 (53) hide show
  1. package/eds-alert/eds-wc-alert.d.ts +44 -21
  2. package/eds-alert/eds-wc-alert.d.ts.map +1 -1
  3. package/eds-alert/eds-wc-alert.js +137 -83
  4. package/eds-alert/eds-wc-alert.js.map +1 -1
  5. package/eds-alert/index.d.ts +1 -0
  6. package/eds-alert/index.d.ts.map +1 -1
  7. package/eds-badge/eds-wc-badge.d.ts +63 -23
  8. package/eds-badge/eds-wc-badge.d.ts.map +1 -1
  9. package/eds-badge/eds-wc-badge.js +205 -103
  10. package/eds-badge/eds-wc-badge.js.map +1 -1
  11. package/eds-badge/index.d.ts +1 -0
  12. package/eds-badge/index.d.ts.map +1 -1
  13. package/eds-chip/eds-wc-chip.d.ts +107 -18
  14. package/eds-chip/eds-wc-chip.d.ts.map +1 -1
  15. package/eds-chip/eds-wc-chip.js +332 -113
  16. package/eds-chip/eds-wc-chip.js.map +1 -1
  17. package/eds-chip/index.d.ts +2 -1
  18. package/eds-chip/index.d.ts.map +1 -1
  19. package/eds-chip/index.js +1 -1
  20. package/eds-chip/index.js.map +1 -1
  21. package/eds-icon/eds-wc-icon-image.d.ts +43 -0
  22. package/eds-icon/eds-wc-icon-image.d.ts.map +1 -0
  23. package/eds-icon/eds-wc-icon-image.js +107 -0
  24. package/eds-icon/eds-wc-icon-image.js.map +1 -0
  25. package/eds-icon/eds-wc-icon.d.ts +44 -28
  26. package/eds-icon/eds-wc-icon.d.ts.map +1 -1
  27. package/eds-icon/eds-wc-icon.js +97 -85
  28. package/eds-icon/eds-wc-icon.js.map +1 -1
  29. package/eds-icon/index.d.ts +3 -1
  30. package/eds-icon/index.d.ts.map +1 -1
  31. package/eds-icon/index.js +2 -1
  32. package/eds-icon/index.js.map +1 -1
  33. package/eds-icon-button/eds-wc-icon-button.d.ts +53 -18
  34. package/eds-icon-button/eds-wc-icon-button.d.ts.map +1 -1
  35. package/eds-icon-button/eds-wc-icon-button.js +165 -74
  36. package/eds-icon-button/eds-wc-icon-button.js.map +1 -1
  37. package/eds-icon-button/index.d.ts +2 -1
  38. package/eds-icon-button/index.d.ts.map +1 -1
  39. package/eds-icon-button/index.js +1 -1
  40. package/eds-icon-button/index.js.map +1 -1
  41. package/eds-tag/eds-wc-tag.d.ts +35 -16
  42. package/eds-tag/eds-wc-tag.d.ts.map +1 -1
  43. package/eds-tag/eds-wc-tag.js +86 -72
  44. package/eds-tag/eds-wc-tag.js.map +1 -1
  45. package/eds-tag/index.d.ts +2 -1
  46. package/eds-tag/index.d.ts.map +1 -1
  47. package/eds-tag/index.js +1 -1
  48. package/eds-tag/index.js.map +1 -1
  49. package/index.d.ts +9 -3
  50. package/index.d.ts.map +1 -1
  51. package/index.js +3 -3
  52. package/index.js.map +1 -1
  53. package/package.json +1 -1
@@ -1,10 +1,16 @@
1
1
  import { EdsBaseElement } from '../shared/eds-base.js';
2
- declare const EdsWcAlert_base: (new (...args: any[]) => import("../shared/color-mixin.js").ColorMixinInterface) & typeof EdsBaseElement;
2
+ /**
3
+ * Local narrowed color union — the alert's color contract. Copied verbatim from the
4
+ * Angular `eds-alert` exported `EdsAlertColor` union. No shared-token import.
5
+ */
6
+ export type EdsWcAlertColor = 'info' | 'success' | 'warning' | 'critical';
3
7
  /**
4
8
  * `<eds-wc-alert>` — EDS Alert Web Component.
5
9
  *
6
- * An alert banner with color-coded left border, status icon, title slot,
7
- * default content slot, and optional close button.
10
+ * 1:1 projection of the Angular `eds-alert`. An alert banner with a color-coded left
11
+ * border, a semantic status icon, a title slot, a default content slot, and an optional
12
+ * close button. The host carries `role="alert"`; visibility is controlled via the
13
+ * reflected `hidden` attribute (matching the Angular `[attr.hidden]` host binding).
8
14
  *
9
15
  * @example
10
16
  * ```html
@@ -13,45 +19,62 @@ declare const EdsWcAlert_base: (new (...args: any[]) => import("../shared/color-
13
19
  * This is an informational message.
14
20
  * </eds-wc-alert>
15
21
  *
16
- * <eds-wc-alert color="warning" closeable close-aria-label="Dismiss">
22
+ * <eds-wc-alert color="warning" is-closeable close-aria-label="Dismiss">
17
23
  * Something needs your attention.
18
24
  * </eds-wc-alert>
19
25
  * ```
20
26
  *
21
- * @slot title - Alert title (rendered in semi-bold)
22
- * @slot - Default slot for alert body content
27
+ * @slot title - Alert title (rendered in semi-bold), mirrors `<ng-content select="eds-alert-title">`.
28
+ * @slot - Default slot for the alert body content.
23
29
  *
24
- * @fires close - Dispatched when the close button is clicked. The alert hides itself.
30
+ * @fires close-alert - Dispatched when the close button is clicked; the alert hides itself. `detail: { visible: false }`.
25
31
  *
26
- * @csspart icon - The status icon container
27
- * @csspart content - The content area (title + body)
28
- * @csspart close-button - The close button (when closeable)
32
+ * @csspart icon - The status icon container.
33
+ * @csspart content - The content area (title + body).
34
+ * @csspart close-button - The close button (only rendered when `is-closeable`).
29
35
  */
30
- export declare class EdsWcAlert extends EdsWcAlert_base {
36
+ export declare class EdsWcAlert extends EdsBaseElement {
37
+ /**
38
+ * Semantic color of the alert.
39
+ * @default 'info'
40
+ */
41
+ color: EdsWcAlertColor;
31
42
  /**
32
- * Whether a close button is shown.
33
- * When clicked, the alert hides and dispatches a `close` event.
43
+ * Enables a close button allowing users to dismiss the alert.
44
+ * When set, displays a close icon button that hides the alert and dispatches `close-alert`.
45
+ * @default false
34
46
  */
35
- closeable: boolean;
47
+ isCloseable: boolean;
36
48
  /**
37
- * Controls visibility. Set to `false` to hide the alert.
38
- * Also set automatically when the close button is clicked.
49
+ * Controls the visibility state of the alert. When `false`, the host reflects the
50
+ * `hidden` attribute (matching the Angular `[attr.hidden]` binding) and is not rendered.
51
+ * @default true
39
52
  */
40
- visible: boolean;
53
+ isVisible: boolean;
41
54
  /**
42
- * ARIA label for the close button.
55
+ * ARIA label for the close button, allowing localization.
43
56
  * @default 'Close alert'
44
57
  */
45
58
  closeAriaLabel: string;
59
+ /**
60
+ * Data attribute value for end-to-end testing identification.
61
+ * Applied as the `data-e2e` attribute on the host element.
62
+ * @default 'eds-alert'
63
+ */
64
+ e2eAttr: string;
46
65
  static styles: import("lit").CSSResult;
47
66
  protected render(): import("lit-html").TemplateResult<1>;
48
- protected updated(): void;
49
- private _onClose;
67
+ protected updated(changed: Map<string, unknown>): void;
68
+ connectedCallback(): void;
69
+ /**
70
+ * Hides the alert and dispatches the `close-alert` event when the close button is clicked.
71
+ * Mirrors the Angular `onCloseClick()` which sets `isVisible=false` and emits `closeAlert(false)`.
72
+ */
73
+ private _onCloseClick;
50
74
  }
51
75
  declare global {
52
76
  interface HTMLElementTagNameMap {
53
77
  'eds-wc-alert': EdsWcAlert;
54
78
  }
55
79
  }
56
- export {};
57
80
  //# sourceMappingURL=eds-wc-alert.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"eds-wc-alert.d.ts","sourceRoot":"","sources":["../../src/eds-alert/eds-wc-alert.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;;AAWvD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBACa,UAAW,SAAQ,eAA0B;IACtD;;;OAGG;IAEH,SAAS,UAAS;IAElB;;;OAGG;IAEH,OAAO,UAAQ;IAEf;;;OAGG;IAEH,cAAc,SAAiB;IAE/B,OAAgB,MAAM,0BAkGpB;cAEiB,MAAM;cAoCN,OAAO,IAAI,IAAI;IAIlC,OAAO,CAAC,QAAQ;CAQnB;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,cAAc,EAAE,UAAU,CAAC;KAC9B;CACJ"}
1
+ {"version":3,"file":"eds-wc-alert.d.ts","sourceRoot":"","sources":["../../src/eds-alert/eds-wc-alert.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;AAkB1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBACa,UAAW,SAAQ,cAAc;IAC1C;;;OAGG;IAEH,KAAK,EAAE,eAAe,CAAU;IAEhC;;;;OAIG;IAEH,WAAW,UAAS;IAEpB;;;;OAIG;IAEH,SAAS,UAAQ;IAEjB;;;OAGG;IAEH,cAAc,SAAiB;IAE/B;;;;OAIG;IAEH,OAAO,SAAe;IAEtB,OAAgB,MAAM,0BAwHpB;cAEiB,MAAM;cAoCN,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAOtD,iBAAiB,IAAI,IAAI;IAMlC;;;OAGG;IACH,OAAO,CAAC,aAAa;CAQxB;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,cAAc,EAAE,UAAU,CAAC;KAC9B;CACJ"}
@@ -7,19 +7,19 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { html, css, nothing } from 'lit';
8
8
  import { customElement, property } from 'lit/decorators.js';
9
9
  import { EdsBaseElement } from '../shared/eds-base.js';
10
- import { ColorMixin } from '../shared/color-mixin.js';
11
- /** Map from alert color to its corresponding semantic icon name. */
12
10
  const ALERT_ICON_MAP = {
13
- info: 'info',
14
- success: 'check-circle',
15
- warning: 'warning',
16
- critical: 'warning-circle',
11
+ info: { name: 'info', ariaLabel: 'EDS info icon' },
12
+ success: { name: 'check-circle', ariaLabel: 'EDS success icon' },
13
+ warning: { name: 'warning', ariaLabel: 'EDS warning icon' },
14
+ critical: { name: 'warning-circle', ariaLabel: 'EDS danger icon' },
17
15
  };
18
16
  /**
19
17
  * `<eds-wc-alert>` — EDS Alert Web Component.
20
18
  *
21
- * An alert banner with color-coded left border, status icon, title slot,
22
- * default content slot, and optional close button.
19
+ * 1:1 projection of the Angular `eds-alert`. An alert banner with a color-coded left
20
+ * border, a semantic status icon, a title slot, a default content slot, and an optional
21
+ * close button. The host carries `role="alert"`; visibility is controlled via the
22
+ * reflected `hidden` attribute (matching the Angular `[attr.hidden]` host binding).
23
23
  *
24
24
  * @example
25
25
  * ```html
@@ -28,95 +28,99 @@ const ALERT_ICON_MAP = {
28
28
  * This is an informational message.
29
29
  * </eds-wc-alert>
30
30
  *
31
- * <eds-wc-alert color="warning" closeable close-aria-label="Dismiss">
31
+ * <eds-wc-alert color="warning" is-closeable close-aria-label="Dismiss">
32
32
  * Something needs your attention.
33
33
  * </eds-wc-alert>
34
34
  * ```
35
35
  *
36
- * @slot title - Alert title (rendered in semi-bold)
37
- * @slot - Default slot for alert body content
36
+ * @slot title - Alert title (rendered in semi-bold), mirrors `<ng-content select="eds-alert-title">`.
37
+ * @slot - Default slot for the alert body content.
38
38
  *
39
- * @fires close - Dispatched when the close button is clicked. The alert hides itself.
39
+ * @fires close-alert - Dispatched when the close button is clicked; the alert hides itself. `detail: { visible: false }`.
40
40
  *
41
- * @csspart icon - The status icon container
42
- * @csspart content - The content area (title + body)
43
- * @csspart close-button - The close button (when closeable)
41
+ * @csspart icon - The status icon container.
42
+ * @csspart content - The content area (title + body).
43
+ * @csspart close-button - The close button (only rendered when `is-closeable`).
44
44
  */
45
- let EdsWcAlert = class EdsWcAlert extends ColorMixin(EdsBaseElement) {
45
+ let EdsWcAlert = class EdsWcAlert extends EdsBaseElement {
46
46
  constructor() {
47
47
  super(...arguments);
48
48
  /**
49
- * Whether a close button is shown.
50
- * When clicked, the alert hides and dispatches a `close` event.
49
+ * Semantic color of the alert.
50
+ * @default 'info'
51
51
  */
52
- this.closeable = false;
52
+ this.color = 'info';
53
53
  /**
54
- * Controls visibility. Set to `false` to hide the alert.
55
- * Also set automatically when the close button is clicked.
54
+ * Enables a close button allowing users to dismiss the alert.
55
+ * When set, displays a close icon button that hides the alert and dispatches `close-alert`.
56
+ * @default false
56
57
  */
57
- this.visible = true;
58
+ this.isCloseable = false;
58
59
  /**
59
- * ARIA label for the close button.
60
+ * Controls the visibility state of the alert. When `false`, the host reflects the
61
+ * `hidden` attribute (matching the Angular `[attr.hidden]` binding) and is not rendered.
62
+ * @default true
63
+ */
64
+ this.isVisible = true;
65
+ /**
66
+ * ARIA label for the close button, allowing localization.
60
67
  * @default 'Close alert'
61
68
  */
62
69
  this.closeAriaLabel = 'Close alert';
70
+ /**
71
+ * Data attribute value for end-to-end testing identification.
72
+ * Applied as the `data-e2e` attribute on the host element.
73
+ * @default 'eds-alert'
74
+ */
75
+ this.e2eAttr = 'eds-alert';
63
76
  }
64
77
  static { this.styles = css `
78
+ :host, *, *::before, *::after {
79
+ box-sizing: border-box;
80
+ }
81
+
65
82
  :host {
83
+ /* default color = info */
84
+ --_eds-alert-surface: var(--eds-c-surface-info-subtler);
85
+ --_eds-alert-on-surface: var(--eds-c-on-surface-info-subtler);
86
+ --_eds-alert-border-color: var(--eds-c-border-info);
87
+
66
88
  display: flex;
67
89
  width: 100%;
90
+ background-color: var(--_eds-alert-surface);
68
91
  padding: var(--eds-sp-s);
69
92
  border-radius: var(--eds-br-s);
70
- border-left: var(--eds-bw-m) solid var(--_border-color);
71
- background-color: var(--_surface);
93
+ border-left: var(--eds-bw-m) solid var(--_eds-alert-border-color);
72
94
  }
73
95
 
74
- :host([visible="false"]),
75
- :host(:not([visible])) {
96
+ :host([hidden]) {
76
97
  display: none;
77
98
  }
78
99
 
79
- /* Ensure visible=true shows */
80
- :host([visible]) {
100
+ .eds-alert__icon {
101
+ flex-shrink: 0;
81
102
  display: flex;
82
103
  }
83
104
 
84
- /* Color variants */
85
- :host([color="info"]) {
86
- --_surface: var(--eds-c-surface-info-subtler);
87
- --_on-surface: var(--eds-c-on-surface-info-subtler);
88
- --_border-color: var(--eds-c-border-info);
89
- --_icon-color: var(--eds-c-foreground-info);
90
- }
91
- :host([color="success"]) {
92
- --_surface: var(--eds-c-surface-success-subtler);
93
- --_on-surface: var(--eds-c-on-surface-success-subtler);
94
- --_border-color: var(--eds-c-border-success);
95
- --_icon-color: var(--eds-c-foreground-success);
105
+ .eds-alert__icon svg {
106
+ width: var(--eds-is-m);
107
+ height: var(--eds-is-m);
96
108
  }
97
- :host([color="warning"]) {
98
- --_surface: var(--eds-c-surface-warning-subtler);
99
- --_on-surface: var(--eds-c-on-surface-warning-subtler);
100
- --_border-color: var(--eds-c-border-warning);
101
- --_icon-color: var(--eds-c-foreground-warning);
109
+
110
+ :host([color="info"]) .eds-alert__icon svg {
111
+ fill: var(--eds-c-foreground-info);
102
112
  }
103
- :host([color="critical"]) {
104
- --_surface: var(--eds-c-surface-critical-subtler);
105
- --_on-surface: var(--eds-c-on-surface-critical-subtler);
106
- --_border-color: var(--eds-c-border-critical);
107
- --_icon-color: var(--eds-c-foreground-critical);
113
+
114
+ :host([color="success"]) .eds-alert__icon svg {
115
+ fill: var(--eds-c-foreground-success);
108
116
  }
109
117
 
110
- .eds-alert__icon {
111
- flex-shrink: 0;
112
- display: inline-flex;
113
- color: var(--_icon-color);
118
+ :host([color="warning"]) .eds-alert__icon svg {
119
+ fill: var(--eds-c-foreground-warning);
114
120
  }
115
121
 
116
- .eds-alert__icon svg {
117
- width: var(--eds-is-m);
118
- height: var(--eds-is-m);
119
- fill: var(--_icon-color);
122
+ :host([color="critical"]) .eds-alert__icon svg {
123
+ fill: var(--eds-c-foreground-critical);
120
124
  }
121
125
 
122
126
  .eds-alert__content {
@@ -125,7 +129,6 @@ let EdsWcAlert = class EdsWcAlert extends ColorMixin(EdsBaseElement) {
125
129
  flex-direction: column;
126
130
  padding: 0 var(--eds-sp-xs);
127
131
  font: var(--eds-f-paragraph-m);
128
- color: var(--_on-surface);
129
132
  }
130
133
 
131
134
  ::slotted([slot="title"]) {
@@ -136,22 +139,22 @@ let EdsWcAlert = class EdsWcAlert extends ColorMixin(EdsBaseElement) {
136
139
  margin-left: auto;
137
140
  display: flex;
138
141
  align-self: baseline;
142
+ padding: var(--eds-sp-3xs);
139
143
  background: none;
140
144
  border: none;
145
+ border-radius: var(--eds-br-full);
141
146
  cursor: pointer;
142
- padding: var(--eds-sp-3xs);
143
- border-radius: var(--eds-br-s);
144
- color: var(--_on-surface);
147
+ color: var(--eds-c-on-surface-neutral-subtler);
145
148
  line-height: 0;
146
149
  }
147
150
 
148
151
  .eds-alert__close:hover {
149
- background-color: color-mix(in srgb, var(--_on-surface) 10%, transparent);
152
+ background-color: var(--eds-c-surface-neutral-subtler);
150
153
  }
151
154
 
152
155
  .eds-alert__close:focus-visible {
153
- outline: 2px solid var(--eds-c-border-focus);
154
- outline-offset: 2px;
156
+ outline: var(--eds-bw-s) solid var(--eds-c-border-focus);
157
+ outline-offset: var(--eds-sp-4xs);
155
158
  }
156
159
 
157
160
  .eds-alert__close svg {
@@ -159,16 +162,49 @@ let EdsWcAlert = class EdsWcAlert extends ColorMixin(EdsBaseElement) {
159
162
  height: var(--eds-is-s);
160
163
  fill: currentColor;
161
164
  }
165
+
166
+ /* COLOR VARIANTS */
167
+ :host([color="info"]) {
168
+ --_eds-alert-surface: var(--eds-c-surface-info-subtler);
169
+ --_eds-alert-on-surface: var(--eds-c-on-surface-info-subtler);
170
+ --_eds-alert-border-color: var(--eds-c-border-info);
171
+ }
172
+
173
+ :host([color="success"]) {
174
+ --_eds-alert-surface: var(--eds-c-surface-success-subtler);
175
+ --_eds-alert-on-surface: var(--eds-c-on-surface-success-subtler);
176
+ --_eds-alert-border-color: var(--eds-c-border-success);
177
+ }
178
+
179
+ :host([color="warning"]) {
180
+ --_eds-alert-surface: var(--eds-c-surface-warning-subtler);
181
+ --_eds-alert-on-surface: var(--eds-c-on-surface-warning-subtler);
182
+ --_eds-alert-border-color: var(--eds-c-border-warning);
183
+ }
184
+
185
+ :host([color="critical"]) {
186
+ --_eds-alert-surface: var(--eds-c-surface-critical-subtler);
187
+ --_eds-alert-on-surface: var(--eds-c-on-surface-critical-subtler);
188
+ --_eds-alert-border-color: var(--eds-c-border-critical);
189
+ }
190
+
191
+ /* MOBILE BREAKPOINT (< 768px) */
192
+ @media (max-width: 767px) {
193
+ .eds-alert__content {
194
+ font: var(--eds-f-paragraph-s);
195
+ }
196
+ }
162
197
  `; }
163
198
  render() {
164
- const resolvedColor = this.color || 'info';
165
- const iconName = ALERT_ICON_MAP[resolvedColor] || 'info';
199
+ const resolvedColor = ALERT_ICON_MAP[this.color] ? this.color : 'info';
200
+ const icon = ALERT_ICON_MAP[resolvedColor];
166
201
  const baseUrl = EdsBaseElement.assetsBaseUrl;
167
- const spriteHref = `${baseUrl}/eds/icons/sprites/regular.svg#${iconName}`;
202
+ const iconHref = `${baseUrl}/eds/icons/sprites/core.svg#${icon.name}`;
203
+ const closeHref = `${baseUrl}/eds/icons/sprites/core.svg#x`;
168
204
  return html `
169
- <span class="eds-alert__icon" part="icon" aria-hidden="true">
170
- <svg aria-hidden="true">
171
- <use href="${spriteHref}"></use>
205
+ <span class="eds-alert__icon" part="icon">
206
+ <svg role="img" aria-label="${icon.ariaLabel}">
207
+ <use href="${iconHref}"></use>
172
208
  </svg>
173
209
  </span>
174
210
 
@@ -177,28 +213,40 @@ let EdsWcAlert = class EdsWcAlert extends ColorMixin(EdsBaseElement) {
177
213
  <slot></slot>
178
214
  </div>
179
215
 
180
- ${this.closeable
216
+ ${this.isCloseable
181
217
  ? html `
182
218
  <button
183
219
  type="button"
184
220
  class="eds-alert__close"
185
221
  part="close-button"
186
222
  aria-label="${this.closeAriaLabel}"
187
- @click="${this._onClose}">
223
+ @click="${this._onCloseClick}">
188
224
  <svg aria-hidden="true">
189
- <use href="${baseUrl}/eds/icons/sprites/core.svg#x"></use>
225
+ <use href="${closeHref}"></use>
190
226
  </svg>
191
227
  </button>
192
228
  `
193
229
  : nothing}
194
230
  `;
195
231
  }
196
- updated() {
232
+ updated(changed) {
233
+ if (changed.has('isVisible')) {
234
+ // Mirror the Angular `[attr.hidden]='!isVisible() || null'` host binding.
235
+ this.toggleAttribute('hidden', !this.isVisible);
236
+ }
237
+ }
238
+ connectedCallback() {
239
+ super.connectedCallback();
197
240
  this.setAttribute('role', 'alert');
241
+ this.toggleAttribute('hidden', !this.isVisible);
198
242
  }
199
- _onClose() {
200
- this.visible = false;
201
- this.dispatchEvent(new CustomEvent('close', {
243
+ /**
244
+ * Hides the alert and dispatches the `close-alert` event when the close button is clicked.
245
+ * Mirrors the Angular `onCloseClick()` which sets `isVisible=false` and emits `closeAlert(false)`.
246
+ */
247
+ _onCloseClick() {
248
+ this.isVisible = false;
249
+ this.dispatchEvent(new CustomEvent('close-alert', {
202
250
  bubbles: true,
203
251
  composed: true,
204
252
  detail: { visible: false },
@@ -206,14 +254,20 @@ let EdsWcAlert = class EdsWcAlert extends ColorMixin(EdsBaseElement) {
206
254
  }
207
255
  };
208
256
  __decorate([
209
- property({ type: Boolean, reflect: true })
210
- ], EdsWcAlert.prototype, "closeable", void 0);
257
+ property({ type: String, reflect: true })
258
+ ], EdsWcAlert.prototype, "color", void 0);
211
259
  __decorate([
212
- property({ type: Boolean, reflect: true })
213
- ], EdsWcAlert.prototype, "visible", void 0);
260
+ property({ type: Boolean, reflect: true, attribute: 'is-closeable' })
261
+ ], EdsWcAlert.prototype, "isCloseable", void 0);
262
+ __decorate([
263
+ property({ type: Boolean, attribute: 'is-visible' })
264
+ ], EdsWcAlert.prototype, "isVisible", void 0);
214
265
  __decorate([
215
266
  property({ type: String, attribute: 'close-aria-label' })
216
267
  ], EdsWcAlert.prototype, "closeAriaLabel", void 0);
268
+ __decorate([
269
+ property({ type: String, reflect: true, attribute: 'data-e2e' })
270
+ ], EdsWcAlert.prototype, "e2eAttr", void 0);
217
271
  EdsWcAlert = __decorate([
218
272
  customElement('eds-wc-alert')
219
273
  ], EdsWcAlert);
@@ -1 +1 @@
1
- {"version":3,"file":"eds-wc-alert.js","sourceRoot":"","sources":["../../src/eds-alert/eds-wc-alert.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,QAAQ,E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GACjB,UAAU,CA8NtB"}
@@ -1,2 +1,3 @@
1
1
  export { EdsWcAlert } from './eds-wc-alert.js';
2
+ export type { EdsWcAlertColor } from './eds-wc-alert.js';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/eds-alert/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/eds-alert/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,51 +1,91 @@
1
1
  import { EdsBaseElement } from '../shared/eds-base.js';
2
- declare const EdsWcBadge_base: (new (...args: any[]) => import("../shared/size-mixin.js").SizeMixinInterface) & (new (...args: any[]) => import("../shared/color-mixin.js").ColorMixinInterface) & typeof EdsBaseElement;
2
+ /**
3
+ * Local narrowed unions — the badge's variant contract. Copied verbatim from the
4
+ * Angular `eds-badge` exported unions. No shared-token import.
5
+ */
6
+ export type EdsWcBadgeColor = 'primary' | 'neutral' | 'success' | 'info' | 'warning' | 'critical';
7
+ export type EdsWcBadgeVariant = 'filled' | 'outline';
8
+ export type EdsWcBadgeSize = 's' | 'm';
3
9
  /**
4
10
  * `<eds-wc-badge>` — EDS Badge Web Component.
5
11
  *
6
- * A small status indicator supporting color variants, sizes,
7
- * outline, dotted, and icon-only modes. Can truncate numeric
8
- * content via `max-char-count`.
12
+ * A badge that displays text, numbers, or a dot indicator with semantic color, size,
13
+ * and variant styling. Supports content truncation via `max-char-count`, an automatic
14
+ * empty state (dot), and an icon-only mode. 1:1 projection of the Angular `eds-badge`.
9
15
  *
10
16
  * @example
11
17
  * ```html
12
- * <eds-wc-badge color="critical" size="m">5</eds-wc-badge>
13
- * <eds-wc-badge color="success" size="xs" dotted></eds-wc-badge>
14
- * <eds-wc-badge color="info" max-char-count="2" char-replacement="99+">128</eds-wc-badge>
18
+ * <eds-wc-badge>99</eds-wc-badge>
19
+ * <eds-wc-badge color="success">Active</eds-wc-badge>
20
+ * <eds-wc-badge color="info" variant="outline">New</eds-wc-badge>
21
+ * <eds-wc-badge max-char-count="2" char-replacement="99+">150</eds-wc-badge>
22
+ * <eds-wc-badge icon-only color="critical"></eds-wc-badge>
15
23
  * ```
16
24
  *
17
- * @slot - Badge content (text, number, or icon)
25
+ * @slot - Badge content (text, number). Empty content renders a dot indicator.
18
26
  */
19
- export declare class EdsWcBadge extends EdsWcBadge_base {
27
+ export declare class EdsWcBadge extends EdsBaseElement {
28
+ /**
29
+ * Semantic color of the badge.
30
+ * @default 'neutral'
31
+ */
32
+ color: EdsWcBadgeColor;
33
+ /**
34
+ * Visual variant. `filled` uses a solid semantic surface; `outline` uses a
35
+ * transparent surface with a stronger border.
36
+ * @default 'filled'
37
+ */
38
+ variant: EdsWcBadgeVariant;
39
+ /**
40
+ * Size of the badge.
41
+ * @default 'm'
42
+ */
43
+ size: EdsWcBadgeSize;
20
44
  /**
21
- * Maximum number of characters before truncating with `charReplacement`.
22
- * Set to 0 to disable truncation.
45
+ * Whether the badge is a small dot indicator with no text content.
46
+ * @default false
47
+ */
48
+ iconOnly: boolean;
49
+ /**
50
+ * Maximum number of characters to display before truncating. When the content
51
+ * exceeds this limit it is replaced with `charReplacement`. `0` disables truncation.
52
+ * @default 0
23
53
  */
24
54
  maxCharCount: number;
25
55
  /**
26
- * Replacement text shown when content exceeds `maxCharCount`.
27
- * @default '99+'
56
+ * Text shown when the content is truncated by `maxCharCount`. Falls back to `'99+'`.
57
+ * @default ''
28
58
  */
29
59
  charReplacement: string;
30
- /** Whether the badge is in icon-only mode (small dot indicator). */
31
- iconOnly: boolean;
32
- /** Whether to display the badge with dotted styling. */
33
- dotted: boolean;
34
- /** Whether to use outline styling. */
35
- outline: boolean;
36
- private _isEmpty;
37
- private _truncatedContent;
60
+ /**
61
+ * Data attribute for e2e testing.
62
+ * @default 'eds-badge'
63
+ */
64
+ e2eAttr: string;
65
+ /**
66
+ * ARIA label for accessibility. When `null`, the visible content serves as the
67
+ * accessible name.
68
+ * @default 'badge'
69
+ */
70
+ ariaLabel: string | null;
71
+ /** Whether the projected content is empty (drives the dot/empty state). Reflected → `:host([empty])`. */
72
+ empty: boolean;
73
+ /** Whether the content was truncated by `maxCharCount`. */
38
74
  private _isTruncated;
75
+ /** The always-mounted content slot; queried so first render can evaluate empty/truncation. */
76
+ private _slot;
39
77
  static styles: import("lit").CSSResult;
40
78
  protected render(): import("lit-html").TemplateResult<1>;
41
79
  protected updated(): void;
80
+ protected firstUpdated(): void;
42
81
  private _onSlotChange;
43
- private _checkContent;
82
+ /** Guarded computation of `empty` + `_isTruncated` from the slot's assigned content. */
83
+ private _evaluate;
84
+ private _computeTruncated;
44
85
  }
45
86
  declare global {
46
87
  interface HTMLElementTagNameMap {
47
88
  'eds-wc-badge': EdsWcBadge;
48
89
  }
49
90
  }
50
- export {};
51
91
  //# sourceMappingURL=eds-wc-badge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"eds-wc-badge.d.ts","sourceRoot":"","sources":["../../src/eds-badge/eds-wc-badge.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;;AAIvD;;;;;;;;;;;;;;;GAeG;AACH,qBACa,UAAW,SAAQ,eAAqC;IACjE;;;OAGG;IAEH,YAAY,SAAK;IAEjB;;;OAGG;IAEH,eAAe,SAAM;IAErB,oEAAoE;IAEpE,QAAQ,UAAS;IAEjB,wDAAwD;IAExD,MAAM,UAAS;IAEf,sCAAsC;IAEtC,OAAO,UAAS;IAGhB,OAAO,CAAC,QAAQ,CAAS;IAGzB,OAAO,CAAC,iBAAiB,CAAM;IAG/B,OAAO,CAAC,YAAY,CAAS;IAE7B,OAAgB,MAAM,0BA2DpB;cAEiB,MAAM;cAON,OAAO,I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