@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.
- package/eds-alert/eds-wc-alert.d.ts +44 -21
- package/eds-alert/eds-wc-alert.d.ts.map +1 -1
- package/eds-alert/eds-wc-alert.js +137 -83
- package/eds-alert/eds-wc-alert.js.map +1 -1
- package/eds-alert/index.d.ts +1 -0
- package/eds-alert/index.d.ts.map +1 -1
- package/eds-badge/eds-wc-badge.d.ts +63 -23
- package/eds-badge/eds-wc-badge.d.ts.map +1 -1
- package/eds-badge/eds-wc-badge.js +205 -103
- package/eds-badge/eds-wc-badge.js.map +1 -1
- package/eds-badge/index.d.ts +1 -0
- package/eds-badge/index.d.ts.map +1 -1
- package/eds-chip/eds-wc-chip.d.ts +107 -18
- package/eds-chip/eds-wc-chip.d.ts.map +1 -1
- package/eds-chip/eds-wc-chip.js +332 -113
- package/eds-chip/eds-wc-chip.js.map +1 -1
- package/eds-chip/index.d.ts +2 -1
- package/eds-chip/index.d.ts.map +1 -1
- package/eds-chip/index.js +1 -1
- package/eds-chip/index.js.map +1 -1
- package/eds-icon/eds-wc-icon-image.d.ts +43 -0
- package/eds-icon/eds-wc-icon-image.d.ts.map +1 -0
- package/eds-icon/eds-wc-icon-image.js +107 -0
- package/eds-icon/eds-wc-icon-image.js.map +1 -0
- package/eds-icon/eds-wc-icon.d.ts +44 -28
- package/eds-icon/eds-wc-icon.d.ts.map +1 -1
- package/eds-icon/eds-wc-icon.js +97 -85
- package/eds-icon/eds-wc-icon.js.map +1 -1
- package/eds-icon/index.d.ts +3 -1
- package/eds-icon/index.d.ts.map +1 -1
- package/eds-icon/index.js +2 -1
- package/eds-icon/index.js.map +1 -1
- package/eds-icon-button/eds-wc-icon-button.d.ts +53 -18
- package/eds-icon-button/eds-wc-icon-button.d.ts.map +1 -1
- package/eds-icon-button/eds-wc-icon-button.js +165 -74
- package/eds-icon-button/eds-wc-icon-button.js.map +1 -1
- package/eds-icon-button/index.d.ts +2 -1
- package/eds-icon-button/index.d.ts.map +1 -1
- package/eds-icon-button/index.js +1 -1
- package/eds-icon-button/index.js.map +1 -1
- package/eds-tag/eds-wc-tag.d.ts +35 -16
- package/eds-tag/eds-wc-tag.d.ts.map +1 -1
- package/eds-tag/eds-wc-tag.js +86 -72
- package/eds-tag/eds-wc-tag.js.map +1 -1
- package/eds-tag/index.d.ts +2 -1
- package/eds-tag/index.d.ts.map +1 -1
- package/eds-tag/index.js +1 -1
- package/eds-tag/index.js.map +1 -1
- package/index.d.ts +9 -3
- package/index.d.ts.map +1 -1
- package/index.js +3 -3
- package/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,144 +5,249 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { html, css } from 'lit';
|
|
8
|
-
import { customElement, property, state } from 'lit/decorators.js';
|
|
8
|
+
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
9
9
|
import { EdsBaseElement } from '../shared/eds-base.js';
|
|
10
|
-
import { ColorMixin } from '../shared/color-mixin.js';
|
|
11
|
-
import { SizeMixin } from '../shared/size-mixin.js';
|
|
12
10
|
/**
|
|
13
11
|
* `<eds-wc-badge>` — EDS Badge Web Component.
|
|
14
12
|
*
|
|
15
|
-
* A
|
|
16
|
-
*
|
|
17
|
-
*
|
|
13
|
+
* A badge that displays text, numbers, or a dot indicator with semantic color, size,
|
|
14
|
+
* and variant styling. Supports content truncation via `max-char-count`, an automatic
|
|
15
|
+
* empty state (dot), and an icon-only mode. 1:1 projection of the Angular `eds-badge`.
|
|
18
16
|
*
|
|
19
17
|
* @example
|
|
20
18
|
* ```html
|
|
21
|
-
* <eds-wc-badge
|
|
22
|
-
* <eds-wc-badge color="success"
|
|
23
|
-
* <eds-wc-badge color="info"
|
|
19
|
+
* <eds-wc-badge>99</eds-wc-badge>
|
|
20
|
+
* <eds-wc-badge color="success">Active</eds-wc-badge>
|
|
21
|
+
* <eds-wc-badge color="info" variant="outline">New</eds-wc-badge>
|
|
22
|
+
* <eds-wc-badge max-char-count="2" char-replacement="99+">150</eds-wc-badge>
|
|
23
|
+
* <eds-wc-badge icon-only color="critical"></eds-wc-badge>
|
|
24
24
|
* ```
|
|
25
25
|
*
|
|
26
|
-
* @slot - Badge content (text, number
|
|
26
|
+
* @slot - Badge content (text, number). Empty content renders a dot indicator.
|
|
27
27
|
*/
|
|
28
|
-
let EdsWcBadge = class EdsWcBadge extends
|
|
28
|
+
let EdsWcBadge = class EdsWcBadge extends EdsBaseElement {
|
|
29
29
|
constructor() {
|
|
30
30
|
super(...arguments);
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
32
|
+
* Semantic color of the badge.
|
|
33
|
+
* @default 'neutral'
|
|
34
|
+
*/
|
|
35
|
+
this.color = 'neutral';
|
|
36
|
+
/**
|
|
37
|
+
* Visual variant. `filled` uses a solid semantic surface; `outline` uses a
|
|
38
|
+
* transparent surface with a stronger border.
|
|
39
|
+
* @default 'filled'
|
|
40
|
+
*/
|
|
41
|
+
this.variant = 'filled';
|
|
42
|
+
/**
|
|
43
|
+
* Size of the badge.
|
|
44
|
+
* @default 'm'
|
|
45
|
+
*/
|
|
46
|
+
this.size = 'm';
|
|
47
|
+
/**
|
|
48
|
+
* Whether the badge is a small dot indicator with no text content.
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
this.iconOnly = false;
|
|
52
|
+
/**
|
|
53
|
+
* Maximum number of characters to display before truncating. When the content
|
|
54
|
+
* exceeds this limit it is replaced with `charReplacement`. `0` disables truncation.
|
|
55
|
+
* @default 0
|
|
34
56
|
*/
|
|
35
57
|
this.maxCharCount = 0;
|
|
36
58
|
/**
|
|
37
|
-
*
|
|
38
|
-
* @default '
|
|
59
|
+
* Text shown when the content is truncated by `maxCharCount`. Falls back to `'99+'`.
|
|
60
|
+
* @default ''
|
|
39
61
|
*/
|
|
40
62
|
this.charReplacement = '';
|
|
41
|
-
/**
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Data attribute for e2e testing.
|
|
65
|
+
* @default 'eds-badge'
|
|
66
|
+
*/
|
|
67
|
+
this.e2eAttr = 'eds-badge';
|
|
68
|
+
/**
|
|
69
|
+
* ARIA label for accessibility. When `null`, the visible content serves as the
|
|
70
|
+
* accessible name.
|
|
71
|
+
* @default 'badge'
|
|
72
|
+
*/
|
|
73
|
+
this.ariaLabel = 'badge';
|
|
74
|
+
/** Whether the projected content is empty (drives the dot/empty state). Reflected → `:host([empty])`. */
|
|
75
|
+
this.empty = false;
|
|
76
|
+
/** Whether the content was truncated by `maxCharCount`. */
|
|
49
77
|
this._isTruncated = false;
|
|
50
78
|
}
|
|
51
79
|
static { this.styles = css `
|
|
52
|
-
:host {
|
|
53
|
-
|
|
54
|
-
border-radius: var(--eds-br-full);
|
|
55
|
-
|
|
56
|
-
--_border-width: var(--eds-bw-none);
|
|
80
|
+
:host, *, *::before, *::after {
|
|
81
|
+
box-sizing: border-box;
|
|
57
82
|
}
|
|
58
83
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
:host([outline][color="info"]) { --_surface: var(--eds-c-surface-info-subtle); --_on-surface: var(--eds-c-on-surface-info-subtle); }
|
|
69
|
-
:host([outline][color="success"]) { --_surface: var(--eds-c-surface-success-subtle); --_on-surface: var(--eds-c-on-surface-success-subtle); }
|
|
70
|
-
:host([outline][color="warning"]) { --_surface: var(--eds-c-surface-warning-subtle); --_on-surface: var(--eds-c-on-surface-warning-subtle); }
|
|
71
|
-
:host([outline][color="critical"]) { --_surface: var(--eds-c-surface-critical-subtle); --_on-surface: var(--eds-c-on-surface-critical-subtle); }
|
|
72
|
-
|
|
73
|
-
/* Size × empty state */
|
|
74
|
-
:host([size="xs"]) { --_min-height: var(--eds-si-s); --_min-width: var(--eds-si-s); --_font: var(--eds-f-microcopy-2xs); --_padding: var(--eds-sp-5xs) var(--eds-sp-4xs); }
|
|
75
|
-
:host([size="s"]) { --_font: var(--eds-f-microcopy-xs); --_padding: var(--eds-sp-none) var(--eds-sp-3xs); }
|
|
76
|
-
:host([size="m"]) { --_min-height: var(--eds-si-l); --_min-width: var(--eds-si-l); --_font: var(--eds-f-microcopy-xs); --_padding: var(--eds-sp-4xs) var(--eds-sp-3xs); }
|
|
77
|
-
:host([size="l"]) { --_min-height: var(--eds-si-xl); --_min-width: var(--eds-si-xl); --_font: var(--eds-f-paragraph-s-semi-bold); --_padding: var(--eds-sp-4xs) var(--eds-sp-2xs); }
|
|
84
|
+
:host {
|
|
85
|
+
/* Common defaults */
|
|
86
|
+
--_eds-badge-padding: 0 var(--eds-sp-3xs);
|
|
87
|
+
--_eds-badge-border-radius: var(--eds-br-full);
|
|
88
|
+
--_eds-badge-border-width: var(--eds-bw-xs);
|
|
89
|
+
--_eds-badge-font: var(--eds-f-microcopy-xs);
|
|
90
|
+
--_eds-badge-height: calc(var(--eds-sp-m) + var(--eds-sp-3xs));
|
|
91
|
+
--_eds-badge-min-width: calc(var(--eds-sp-m) + var(--eds-sp-3xs));
|
|
92
|
+
--_eds-badge-empty-size: var(--eds-sp-s);
|
|
78
93
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
:host(.eds-badge--empty[size="m"]) { --_min-height: var(--eds-si-m); --_min-width: var(--eds-si-m); --_padding: 0; }
|
|
84
|
-
:host(.eds-badge--empty[size="l"]) { --_min-height: var(--eds-si-l); --_min-width: var(--eds-si-l); --_padding: 0; }
|
|
94
|
+
/* Default color (neutral) */
|
|
95
|
+
--_eds-badge-surface: var(--eds-c-surface-neutral);
|
|
96
|
+
--_eds-badge-on-surface: var(--eds-c-on-surface-neutral);
|
|
97
|
+
--_eds-badge-border-color: var(--eds-c-border-neutral-subtle);
|
|
85
98
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
:host([icon-only][size="m"]) { --_icon-size: var(--eds-is-s); }
|
|
92
|
-
:host([icon-only][size="l"]) { --_icon-size: var(--eds-is-m); }
|
|
99
|
+
display: inline-flex;
|
|
100
|
+
border: var(--_eds-badge-border-width) solid var(--_eds-badge-border-color);
|
|
101
|
+
border-radius: var(--_eds-badge-border-radius);
|
|
102
|
+
background-color: var(--_eds-badge-surface);
|
|
103
|
+
}
|
|
93
104
|
|
|
94
|
-
.eds-
|
|
105
|
+
.eds-badge__wrapper {
|
|
95
106
|
display: inline-flex;
|
|
96
|
-
border-radius: var(--eds-br-full);
|
|
97
|
-
border: var(--_border-width) solid var(--eds-c-border-inverted);
|
|
98
107
|
align-items: center;
|
|
99
|
-
min-height: var(--_min-height);
|
|
100
|
-
min-width: var(--_min-width);
|
|
101
|
-
padding: var(--_padding);
|
|
102
108
|
justify-content: center;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
109
|
+
color: var(--_eds-badge-on-surface);
|
|
110
|
+
height: var(--_eds-badge-height);
|
|
111
|
+
min-width: var(--_eds-badge-min-width);
|
|
112
|
+
padding: var(--_eds-badge-padding);
|
|
113
|
+
font: var(--_eds-badge-font);
|
|
114
|
+
/* base.eds-ellipsis() inlined */
|
|
106
115
|
overflow: hidden;
|
|
107
116
|
text-overflow: ellipsis;
|
|
108
117
|
white-space: nowrap;
|
|
109
118
|
}
|
|
119
|
+
|
|
120
|
+
/* COLOR — filled (default) surface / foreground / border */
|
|
121
|
+
:host([color="primary"]) {
|
|
122
|
+
--_eds-badge-surface: var(--eds-c-surface-primary);
|
|
123
|
+
--_eds-badge-on-surface: var(--eds-c-on-surface-primary);
|
|
124
|
+
--_eds-badge-border-color: var(--eds-c-border-primary-subtle);
|
|
125
|
+
}
|
|
126
|
+
:host([color="neutral"]) {
|
|
127
|
+
--_eds-badge-surface: var(--eds-c-surface-neutral);
|
|
128
|
+
--_eds-badge-on-surface: var(--eds-c-on-surface-neutral);
|
|
129
|
+
--_eds-badge-border-color: var(--eds-c-border-neutral-subtle);
|
|
130
|
+
}
|
|
131
|
+
:host([color="success"]) {
|
|
132
|
+
--_eds-badge-surface: var(--eds-c-surface-success);
|
|
133
|
+
--_eds-badge-on-surface: var(--eds-c-on-surface-success);
|
|
134
|
+
--_eds-badge-border-color: var(--eds-c-border-success-subtle);
|
|
135
|
+
}
|
|
136
|
+
:host([color="info"]) {
|
|
137
|
+
--_eds-badge-surface: var(--eds-c-surface-info);
|
|
138
|
+
--_eds-badge-on-surface: var(--eds-c-on-surface-info);
|
|
139
|
+
--_eds-badge-border-color: var(--eds-c-border-info-subtle);
|
|
140
|
+
}
|
|
141
|
+
:host([color="warning"]) {
|
|
142
|
+
--_eds-badge-surface: var(--eds-c-surface-warning);
|
|
143
|
+
--_eds-badge-on-surface: var(--eds-c-on-surface-warning);
|
|
144
|
+
--_eds-badge-border-color: var(--eds-c-border-warning-subtle);
|
|
145
|
+
}
|
|
146
|
+
:host([color="critical"]) {
|
|
147
|
+
--_eds-badge-surface: var(--eds-c-surface-critical);
|
|
148
|
+
--_eds-badge-on-surface: var(--eds-c-on-surface-critical);
|
|
149
|
+
--_eds-badge-border-color: var(--eds-c-border-critical-subtle);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* VARIANT — outline: transparent surface, subtler foreground, stronger border */
|
|
153
|
+
:host([variant="outline"]) {
|
|
154
|
+
--_eds-badge-surface: transparent;
|
|
155
|
+
}
|
|
156
|
+
:host([variant="outline"][color="primary"]) {
|
|
157
|
+
--_eds-badge-on-surface: var(--eds-c-on-surface-primary-subtler);
|
|
158
|
+
--_eds-badge-border-color: var(--eds-c-border-primary);
|
|
159
|
+
}
|
|
160
|
+
:host([variant="outline"][color="neutral"]) {
|
|
161
|
+
--_eds-badge-on-surface: var(--eds-c-on-surface-neutral-subtler);
|
|
162
|
+
--_eds-badge-border-color: var(--eds-c-border-neutral);
|
|
163
|
+
}
|
|
164
|
+
:host([variant="outline"][color="success"]) {
|
|
165
|
+
--_eds-badge-on-surface: var(--eds-c-on-surface-success-subtler);
|
|
166
|
+
--_eds-badge-border-color: var(--eds-c-border-success);
|
|
167
|
+
}
|
|
168
|
+
:host([variant="outline"][color="info"]) {
|
|
169
|
+
--_eds-badge-on-surface: var(--eds-c-on-surface-info-subtler);
|
|
170
|
+
--_eds-badge-border-color: var(--eds-c-border-info);
|
|
171
|
+
}
|
|
172
|
+
:host([variant="outline"][color="warning"]) {
|
|
173
|
+
--_eds-badge-on-surface: var(--eds-c-on-surface-warning-subtler);
|
|
174
|
+
--_eds-badge-border-color: var(--eds-c-border-warning);
|
|
175
|
+
}
|
|
176
|
+
:host([variant="outline"][color="critical"]) {
|
|
177
|
+
--_eds-badge-on-surface: var(--eds-c-on-surface-critical-subtler);
|
|
178
|
+
--_eds-badge-border-color: var(--eds-c-border-critical);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/* SIZE */
|
|
182
|
+
:host([size="s"]) {
|
|
183
|
+
--_eds-badge-height: var(--eds-sp-m);
|
|
184
|
+
--_eds-badge-min-width: var(--eds-sp-m);
|
|
185
|
+
--_eds-badge-font: var(--eds-f-microcopy-2xs);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/* EMPTY — dot badge, no content in wrapper */
|
|
189
|
+
:host([empty]) {
|
|
190
|
+
width: var(--_eds-badge-empty-size);
|
|
191
|
+
height: var(--_eds-badge-empty-size);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/* ICON-ONLY — dot indicator, no wrapper padding */
|
|
195
|
+
:host([icon-only]) .eds-badge__wrapper {
|
|
196
|
+
padding: 0;
|
|
197
|
+
}
|
|
110
198
|
`; }
|
|
111
199
|
render() {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
return html `<span class="eds-badge-wrapper"><slot @slotchange="${this._onSlotChange}"></slot></span>`;
|
|
200
|
+
// The <slot> is ALWAYS mounted (never toggled) to avoid the slotchange render loop.
|
|
201
|
+
// When truncated, the slot is hidden and the replacement text is shown beside it.
|
|
202
|
+
return html `<span class="eds-badge__wrapper">${this._isTruncated ? html `<span>${this.charReplacement || '99+'}</span>` : ''}<slot @slotchange="${this._onSlotChange}" style="${this._isTruncated ? 'display:none' : ''}"></slot></span>`;
|
|
116
203
|
}
|
|
117
204
|
updated() {
|
|
118
205
|
this.setAttribute('role', 'status');
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
else {
|
|
125
|
-
this.classList.remove('eds-badge--empty');
|
|
126
|
-
}
|
|
206
|
+
}
|
|
207
|
+
firstUpdated() {
|
|
208
|
+
// A badge that never receives a `slotchange` (e.g. icon-only / content-less) must
|
|
209
|
+
// still get `empty` evaluated on first render. Runs the same guarded computation.
|
|
210
|
+
this._evaluate(this._slot);
|
|
127
211
|
}
|
|
128
212
|
_onSlotChange(e) {
|
|
129
|
-
|
|
213
|
+
this._evaluate(e.target);
|
|
214
|
+
}
|
|
215
|
+
/** Guarded computation of `empty` + `_isTruncated` from the slot's assigned content. */
|
|
216
|
+
_evaluate(slot) {
|
|
217
|
+
if (!slot) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
130
220
|
const nodes = slot.assignedNodes({ flatten: true });
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
221
|
+
// Empty = no meaningful content: no element nodes AND no non-whitespace text.
|
|
222
|
+
const nextEmpty = nodes.every(n => n.nodeType === Node.TEXT_NODE ? !(n.textContent ?? '').trim() : false);
|
|
223
|
+
if (this.empty !== nextEmpty) {
|
|
224
|
+
this.empty = nextEmpty;
|
|
225
|
+
}
|
|
226
|
+
const nextTruncated = this._computeTruncated(nextEmpty, nodes);
|
|
227
|
+
if (this._isTruncated !== nextTruncated) {
|
|
228
|
+
this._isTruncated = nextTruncated;
|
|
134
229
|
}
|
|
135
230
|
}
|
|
136
|
-
|
|
137
|
-
if (this.maxCharCount
|
|
138
|
-
|
|
139
|
-
if (text.length > this.maxCharCount) {
|
|
140
|
-
this._isTruncated = true;
|
|
141
|
-
this._truncatedContent = this.charReplacement || '99+';
|
|
142
|
-
}
|
|
231
|
+
_computeTruncated(isEmpty, nodes) {
|
|
232
|
+
if (isEmpty || this.maxCharCount === 0) {
|
|
233
|
+
return false;
|
|
143
234
|
}
|
|
235
|
+
const text = nodes.map(n => n.textContent ?? '').join('').trim();
|
|
236
|
+
return !!text && text.length > this.maxCharCount;
|
|
144
237
|
}
|
|
145
238
|
};
|
|
239
|
+
__decorate([
|
|
240
|
+
property({ type: String, reflect: true })
|
|
241
|
+
], EdsWcBadge.prototype, "color", void 0);
|
|
242
|
+
__decorate([
|
|
243
|
+
property({ type: String, reflect: true })
|
|
244
|
+
], EdsWcBadge.prototype, "variant", void 0);
|
|
245
|
+
__decorate([
|
|
246
|
+
property({ type: String, reflect: true })
|
|
247
|
+
], EdsWcBadge.prototype, "size", void 0);
|
|
248
|
+
__decorate([
|
|
249
|
+
property({ type: Boolean, reflect: true, attribute: 'icon-only' })
|
|
250
|
+
], EdsWcBadge.prototype, "iconOnly", void 0);
|
|
146
251
|
__decorate([
|
|
147
252
|
property({ type: Number, attribute: 'max-char-count' })
|
|
148
253
|
], EdsWcBadge.prototype, "maxCharCount", void 0);
|
|
@@ -150,23 +255,20 @@ __decorate([
|
|
|
150
255
|
property({ type: String, attribute: 'char-replacement' })
|
|
151
256
|
], EdsWcBadge.prototype, "charReplacement", void 0);
|
|
152
257
|
__decorate([
|
|
153
|
-
property({ type:
|
|
154
|
-
], EdsWcBadge.prototype, "
|
|
258
|
+
property({ type: String, reflect: true, attribute: 'data-e2e' })
|
|
259
|
+
], EdsWcBadge.prototype, "e2eAttr", void 0);
|
|
155
260
|
__decorate([
|
|
156
|
-
property({ type:
|
|
157
|
-
], EdsWcBadge.prototype, "
|
|
261
|
+
property({ type: String, reflect: true, attribute: 'aria-label' })
|
|
262
|
+
], EdsWcBadge.prototype, "ariaLabel", void 0);
|
|
158
263
|
__decorate([
|
|
159
264
|
property({ type: Boolean, reflect: true })
|
|
160
|
-
], EdsWcBadge.prototype, "
|
|
161
|
-
__decorate([
|
|
162
|
-
state()
|
|
163
|
-
], EdsWcBadge.prototype, "_isEmpty", void 0);
|
|
164
|
-
__decorate([
|
|
165
|
-
state()
|
|
166
|
-
], EdsWcBadge.prototype, "_truncatedContent", void 0);
|
|
265
|
+
], EdsWcBadge.prototype, "empty", void 0);
|
|
167
266
|
__decorate([
|
|
168
267
|
state()
|
|
169
268
|
], EdsWcBadge.prototype, "_isTruncated", void 0);
|
|
269
|
+
__decorate([
|
|
270
|
+
query('slot')
|
|
271
|
+
], EdsWcBadge.prototype, "_slot", void 0);
|
|
170
272
|
EdsWcBadge = __decorate([
|
|
171
273
|
customElement('eds-wc-badge')
|
|
172
274
|
], EdsWcBadge);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eds-wc-badge.js","sourceRoot":"","sources":["../../src/eds-badge/eds-wc-badge.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"eds-wc-badge.js","sourceRoot":"","sources":["../../src/eds-badge/eds-wc-badge.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAUvD;;;;;;;;;;;;;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../src/eds-badge/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/eds-badge/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,43 +1,132 @@
|
|
|
1
1
|
import { EdsBaseElement } from '../shared/eds-base.js';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Local narrowed color union — the chip's color contract. Copied verbatim from the
|
|
4
|
+
* Angular `eds-chip` exported `EdsChipColor` union. No shared-token import.
|
|
5
|
+
*/
|
|
6
|
+
export type EdsWcChipColor = 'neutral' | 'info' | 'success' | 'warning' | 'critical';
|
|
7
|
+
/**
|
|
8
|
+
* Local narrowed size union — the chip's size contract. Copied verbatim from the
|
|
9
|
+
* Angular `eds-chip` exported `EdsChipSize` union.
|
|
10
|
+
*/
|
|
11
|
+
export type EdsWcChipSize = 's' | 'm' | 'l';
|
|
12
|
+
/**
|
|
13
|
+
* Payload emitted by chip events and passed via the `data` property.
|
|
14
|
+
* Mirrors the Angular `EdsChipData` model.
|
|
15
|
+
*/
|
|
16
|
+
export interface EdsWcChipData {
|
|
17
|
+
id?: string | number;
|
|
18
|
+
tooltip?: {
|
|
19
|
+
tooltipMessage?: string;
|
|
20
|
+
position?: 'above' | 'below' | 'left' | 'right' | 'before' | 'after';
|
|
21
|
+
contentAlignment?: 'center' | 'left' | 'right' | 'justify' | null;
|
|
22
|
+
delay?: number;
|
|
23
|
+
color?: string;
|
|
24
|
+
};
|
|
25
|
+
/** Internal event reference, present when triggered via keyboard. */
|
|
26
|
+
_event?: Event;
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
}
|
|
3
29
|
/**
|
|
4
30
|
* `<eds-wc-chip>` — EDS Chip Web Component.
|
|
5
31
|
*
|
|
6
|
-
* An interactive
|
|
7
|
-
*
|
|
8
|
-
*
|
|
32
|
+
* An interactive chip that displays projected content with a semantic color and size.
|
|
33
|
+
* The host element itself is the interactive control (`role="button"`, or `role="listitem"`
|
|
34
|
+
* when nested inside an `<eds-wc-chip-list>`): clicking or pressing Enter/Space either removes
|
|
35
|
+
* the chip (when `removable`) or emits a click; Delete/Backspace removes it (WAI-ARIA APG
|
|
36
|
+
* convention). When `removable`, an `x` icon is rendered as the remove affordance.
|
|
37
|
+
* 1:1 projection of the Angular `eds-chip`.
|
|
9
38
|
*
|
|
10
39
|
* @example
|
|
11
40
|
* ```html
|
|
12
|
-
* <eds-wc-chip color="
|
|
13
|
-
* <eds-wc-chip color="info" removable>
|
|
14
|
-
* <eds-wc-chip active
|
|
41
|
+
* <eds-wc-chip color="success">Active</eds-wc-chip>
|
|
42
|
+
* <eds-wc-chip color="info" size="s" removable>Filter</eds-wc-chip>
|
|
43
|
+
* <eds-wc-chip active>Selected</eds-wc-chip>
|
|
44
|
+
* <eds-wc-chip disabled>Disabled</eds-wc-chip>
|
|
15
45
|
* ```
|
|
16
46
|
*
|
|
17
|
-
* @slot - Chip content (text
|
|
47
|
+
* @slot - Chip content (text).
|
|
18
48
|
*
|
|
19
|
-
* @fires chip-
|
|
20
|
-
*
|
|
49
|
+
* @fires chip-remove - Fired when the chip is removed (click/Enter on a removable chip, or
|
|
50
|
+
* Delete/Backspace). `detail` is the `EdsWcChipData` payload.
|
|
51
|
+
* @fires chip-click - Fired when a non-removable chip is activated (click/Enter/Space).
|
|
52
|
+
* `detail` is the `EdsWcChipData` payload.
|
|
21
53
|
*/
|
|
22
|
-
export declare class EdsWcChip extends
|
|
23
|
-
/**
|
|
54
|
+
export declare class EdsWcChip extends EdsBaseElement {
|
|
55
|
+
/**
|
|
56
|
+
* Semantic color of the chip.
|
|
57
|
+
* @default 'neutral'
|
|
58
|
+
*/
|
|
59
|
+
color: EdsWcChipColor;
|
|
60
|
+
/**
|
|
61
|
+
* Size of the chip.
|
|
62
|
+
* @default 'm'
|
|
63
|
+
*/
|
|
64
|
+
size: EdsWcChipSize;
|
|
65
|
+
/**
|
|
66
|
+
* Whether the chip can be removed.
|
|
67
|
+
* @default false
|
|
68
|
+
*/
|
|
24
69
|
removable: boolean;
|
|
25
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* Whether the chip is in active/pressed state.
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
26
74
|
active: boolean;
|
|
27
|
-
/**
|
|
75
|
+
/**
|
|
76
|
+
* Controls the disabled state of the chip.
|
|
77
|
+
* When true, prevents interaction and applies disabled styling.
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
28
80
|
disabled: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Sets the `aria-label` attribute for the host element.
|
|
83
|
+
* When not set, assistive technology will use the text content of the chip.
|
|
84
|
+
* @default null
|
|
85
|
+
*/
|
|
86
|
+
ariaLabel: string | null;
|
|
87
|
+
/**
|
|
88
|
+
* Data attribute for e2e testing.
|
|
89
|
+
* @default 'eds-chip'
|
|
90
|
+
*/
|
|
91
|
+
e2eAttr: string;
|
|
92
|
+
/**
|
|
93
|
+
* Internal id of the chip.
|
|
94
|
+
* @default ''
|
|
95
|
+
*/
|
|
96
|
+
edsInternalId: string;
|
|
97
|
+
/**
|
|
98
|
+
* Label of the tooltip to display on hover.
|
|
99
|
+
* @default ''
|
|
100
|
+
*/
|
|
101
|
+
tooltipMessage: string;
|
|
102
|
+
/**
|
|
103
|
+
* Id of the chip.
|
|
104
|
+
* @default ''
|
|
105
|
+
*/
|
|
106
|
+
id: string;
|
|
107
|
+
/**
|
|
108
|
+
* Data payload of the chip (e.g. tooltip configuration). Emitted with chip events.
|
|
109
|
+
*/
|
|
110
|
+
data: EdsWcChipData;
|
|
111
|
+
/** Resolved inner remove-icon size, derived from the chip size. */
|
|
112
|
+
private get iconSize();
|
|
113
|
+
/** Resolved role — 'listitem' when inside an eds-wc-chip-list, 'button' otherwise. */
|
|
114
|
+
private get hostRole();
|
|
29
115
|
static styles: import("lit").CSSResult;
|
|
30
116
|
connectedCallback(): void;
|
|
31
117
|
disconnectedCallback(): void;
|
|
32
|
-
|
|
33
|
-
|
|
118
|
+
private _onHostClick;
|
|
119
|
+
private _onKeyDown;
|
|
120
|
+
private _onKeyRemove;
|
|
121
|
+
private _onRemove;
|
|
34
122
|
private _onClick;
|
|
35
|
-
private
|
|
123
|
+
private _emitRemove;
|
|
124
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
125
|
+
protected updated(): void;
|
|
36
126
|
}
|
|
37
127
|
declare global {
|
|
38
128
|
interface HTMLElementTagNameMap {
|
|
39
129
|
'eds-wc-chip': EdsWcChip;
|
|
40
130
|
}
|
|
41
131
|
}
|
|
42
|
-
export {};
|
|
43
132
|
//# sourceMappingURL=eds-wc-chip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eds-wc-chip.d.ts","sourceRoot":"","sources":["../../src/eds-chip/eds-wc-chip.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC
|
|
1
|
+
{"version":3,"file":"eds-wc-chip.d.ts","sourceRoot":"","sources":["../../src/eds-chip/eds-wc-chip.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;AAErF;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAE5C;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC1B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE;QACN,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,QAAQ,CA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