nve-designsystem 0.2.13 → 0.3.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 (51) hide show
  1. package/chunks/chunk.2IGSSN44.js +46 -0
  2. package/chunks/chunk.3MBST6KA.js +292 -0
  3. package/chunks/chunk.4SGTRSOV.js +243 -0
  4. package/chunks/chunk.4V3LPB2X.js +192 -0
  5. package/chunks/chunk.6OYGZP33.js +325 -0
  6. package/chunks/chunk.7OLWOZOB.js +6 -0
  7. package/chunks/chunk.C2BA3SSZ.js +6 -0
  8. package/chunks/chunk.EIGIU6GJ.js +136 -0
  9. package/chunks/chunk.FWDECKQY.js +1051 -0
  10. package/chunks/chunk.FZZ6EDTG.js +92 -0
  11. package/chunks/chunk.JA7IPEW3.js +380 -0
  12. package/chunks/chunk.KKYBVPZ5.js +684 -0
  13. package/chunks/chunk.L4XM7VSU.js +334 -0
  14. package/chunks/chunk.LHI6QEL2.js +44 -37
  15. package/chunks/chunk.LXDTFLWU.js +2 -2
  16. package/chunks/chunk.MVKF2MV6.js +187 -0
  17. package/chunks/chunk.N6VGRU7O.js +496 -0
  18. package/chunks/chunk.PY3UYT6X.js +225 -0
  19. package/chunks/chunk.VVYY25KM.js +227 -0
  20. package/chunks/chunk.XGGOIW4X.js +97 -0
  21. package/chunks/query.js +4 -3
  22. package/components/nve-alert/nve-alert.component.js +32 -267
  23. package/components/nve-button/nve-button.component.js +37 -250
  24. package/components/nve-checkbox/nve-checkbox.component.js +20 -343
  25. package/components/nve-dialog/nve-dialog.component.js +24 -395
  26. package/components/nve-divider/nve-divider.component.js +16 -55
  27. package/components/nve-dropdown/nve-dropdown.component.js +55 -338
  28. package/components/nve-input/nve-input.component.js +52 -722
  29. package/components/nve-menu/nve-menu.component.d.ts +6 -0
  30. package/components/nve-menu/nve-menu.component.js +15 -106
  31. package/components/nve-menu/nve-menu.styles.js +9 -3
  32. package/components/nve-menu-item/nve-menu-item.component.d.ts +6 -14
  33. package/components/nve-menu-item/nve-menu-item.component.js +25 -517
  34. package/components/nve-menu-item/nve-menu-item.styles.js +7 -21
  35. package/components/nve-option/nve-option.component.js +19 -197
  36. package/components/nve-popup/nve-popup.component.js +10 -11
  37. package/components/nve-radio/nve-radio.component.js +16 -200
  38. package/components/nve-radio-button/nve-radio-button.component.js +17 -146
  39. package/components/nve-radio-group/nve-radio-group.component.js +63 -378
  40. package/components/nve-relative-time/nve-relative-time.component.d.ts +19 -0
  41. package/components/nve-relative-time/nve-relative-time.component.js +9011 -0
  42. package/components/nve-relative-time/nve-relative-time.styles.d.ts +2 -0
  43. package/components/nve-relative-time/nve-relative-time.styles.js +5 -0
  44. package/components/nve-select/nve-select.component.js +30 -1066
  45. package/components/nve-skeleton/nve-skeleton.component.js +15 -101
  46. package/components/nve-spinner/nve-spinner.component.js +11 -12
  47. package/components/nve-tooltip/nve-tooltip.component.js +22 -240
  48. package/custom-elements.json +167 -25
  49. package/nve-designsystem.d.ts +1 -0
  50. package/nve-designsystem.js +30 -28
  51. package/package.json +1 -1
@@ -0,0 +1,46 @@
1
+ import { i as t } from "./lit-element.js";
2
+ import { w as a } from "./chunk.2FB5TK5H.js";
3
+ import { c as i, b as r, S as o } from "./chunk.5THGRZAA.js";
4
+ import { n as l } from "./property.js";
5
+ var s = t`
6
+ :host {
7
+ --color: var(--sl-panel-border-color);
8
+ --width: var(--sl-panel-border-width);
9
+ --spacing: var(--sl-spacing-medium);
10
+ }
11
+
12
+ :host(:not([vertical])) {
13
+ display: block;
14
+ border-top: solid var(--width) var(--color);
15
+ margin: var(--spacing) 0;
16
+ }
17
+
18
+ :host([vertical]) {
19
+ display: inline-block;
20
+ height: 100%;
21
+ border-left: solid var(--width) var(--color);
22
+ margin: 0 var(--spacing);
23
+ }
24
+ `, e = class extends o {
25
+ constructor() {
26
+ super(...arguments), this.vertical = !1;
27
+ }
28
+ connectedCallback() {
29
+ super.connectedCallback(), this.setAttribute("role", "separator");
30
+ }
31
+ handleVerticalChange() {
32
+ this.setAttribute("aria-orientation", this.vertical ? "vertical" : "horizontal");
33
+ }
34
+ };
35
+ e.styles = [i, s];
36
+ r([
37
+ l({ type: Boolean, reflect: !0 })
38
+ ], e.prototype, "vertical", 2);
39
+ r([
40
+ a("vertical")
41
+ ], e.prototype, "handleVerticalChange", 1);
42
+ var v = e;
43
+ e.define("sl-divider");
44
+ export {
45
+ v as d
46
+ };
@@ -0,0 +1,292 @@
1
+ import { i as g, k as f } from "./lit-element.js";
2
+ import { g as w } from "./chunk.LXDTFLWU.js";
3
+ import { S as y } from "./chunk.62L7S2LE.js";
4
+ import { s as m, w as d, a as h, g as c, b as u } from "./chunk.LHI6QEL2.js";
5
+ import { L as v } from "./chunk.WLV3FVBR.js";
6
+ import { w as b } from "./chunk.2FB5TK5H.js";
7
+ import { c as k, b as i, S as E } from "./chunk.5THGRZAA.js";
8
+ import { R as _ } from "./class-map.js";
9
+ import { t as D } from "./if-defined.js";
10
+ import { n } from "./property.js";
11
+ import { e as p } from "./query.js";
12
+ var C = g`
13
+ :host {
14
+ display: inline-block;
15
+ }
16
+
17
+ .dropdown::part(popup) {
18
+ z-index: var(--sl-z-index-dropdown);
19
+ }
20
+
21
+ .dropdown[data-current-placement^='top']::part(popup) {
22
+ transform-origin: bottom;
23
+ }
24
+
25
+ .dropdown[data-current-placement^='bottom']::part(popup) {
26
+ transform-origin: top;
27
+ }
28
+
29
+ .dropdown[data-current-placement^='left']::part(popup) {
30
+ transform-origin: right;
31
+ }
32
+
33
+ .dropdown[data-current-placement^='right']::part(popup) {
34
+ transform-origin: left;
35
+ }
36
+
37
+ .dropdown__trigger {
38
+ display: block;
39
+ }
40
+
41
+ .dropdown__panel {
42
+ font-family: var(--sl-font-sans);
43
+ font-size: var(--sl-font-size-medium);
44
+ font-weight: var(--sl-font-weight-normal);
45
+ box-shadow: var(--sl-shadow-large);
46
+ border-radius: var(--sl-border-radius-medium);
47
+ pointer-events: none;
48
+ }
49
+
50
+ .dropdown--open .dropdown__panel {
51
+ display: block;
52
+ pointer-events: all;
53
+ }
54
+
55
+ /* When users slot a menu, make sure it conforms to the popup's auto-size */
56
+ ::slotted(sl-menu) {
57
+ max-width: var(--auto-size-available-width) !important;
58
+ max-height: var(--auto-size-available-height) !important;
59
+ }
60
+ `, s = class extends E {
61
+ constructor() {
62
+ super(...arguments), this.localize = new v(this), this.open = !1, this.placement = "bottom-start", this.disabled = !1, this.stayOpenOnSelect = !1, this.distance = 0, this.skidding = 0, this.hoist = !1, this.sync = void 0, this.handleKeyDown = (e) => {
63
+ this.open && e.key === "Escape" && (e.stopPropagation(), this.hide(), this.focusOnTrigger());
64
+ }, this.handleDocumentKeyDown = (e) => {
65
+ var t;
66
+ if (e.key === "Escape" && this.open && !this.closeWatcher) {
67
+ e.stopPropagation(), this.focusOnTrigger(), this.hide();
68
+ return;
69
+ }
70
+ if (e.key === "Tab") {
71
+ if (this.open && ((t = document.activeElement) == null ? void 0 : t.tagName.toLowerCase()) === "sl-menu-item") {
72
+ e.preventDefault(), this.hide(), this.focusOnTrigger();
73
+ return;
74
+ }
75
+ setTimeout(() => {
76
+ var o, a, r;
77
+ const l = ((o = this.containingElement) == null ? void 0 : o.getRootNode()) instanceof ShadowRoot ? (r = (a = document.activeElement) == null ? void 0 : a.shadowRoot) == null ? void 0 : r.activeElement : document.activeElement;
78
+ (!this.containingElement || (l == null ? void 0 : l.closest(this.containingElement.tagName.toLowerCase())) !== this.containingElement) && this.hide();
79
+ });
80
+ }
81
+ }, this.handleDocumentMouseDown = (e) => {
82
+ const t = e.composedPath();
83
+ this.containingElement && !t.includes(this.containingElement) && this.hide();
84
+ }, this.handlePanelSelect = (e) => {
85
+ const t = e.target;
86
+ !this.stayOpenOnSelect && t.tagName.toLowerCase() === "sl-menu" && (this.hide(), this.focusOnTrigger());
87
+ };
88
+ }
89
+ connectedCallback() {
90
+ super.connectedCallback(), this.containingElement || (this.containingElement = this);
91
+ }
92
+ firstUpdated() {
93
+ this.panel.hidden = !this.open, this.open && (this.addOpenListeners(), this.popup.active = !0);
94
+ }
95
+ disconnectedCallback() {
96
+ super.disconnectedCallback(), this.removeOpenListeners(), this.hide();
97
+ }
98
+ focusOnTrigger() {
99
+ const e = this.trigger.assignedElements({ flatten: !0 })[0];
100
+ typeof (e == null ? void 0 : e.focus) == "function" && e.focus();
101
+ }
102
+ getMenu() {
103
+ return this.panel.assignedElements({ flatten: !0 }).find((e) => e.tagName.toLowerCase() === "sl-menu");
104
+ }
105
+ handleTriggerClick() {
106
+ this.open ? this.hide() : (this.show(), this.focusOnTrigger());
107
+ }
108
+ async handleTriggerKeyDown(e) {
109
+ if ([" ", "Enter"].includes(e.key)) {
110
+ e.preventDefault(), this.handleTriggerClick();
111
+ return;
112
+ }
113
+ const t = this.getMenu();
114
+ if (t) {
115
+ const o = t.getAllItems(), a = o[0], r = o[o.length - 1];
116
+ ["ArrowDown", "ArrowUp", "Home", "End"].includes(e.key) && (e.preventDefault(), this.open || (this.show(), await this.updateComplete), o.length > 0 && this.updateComplete.then(() => {
117
+ (e.key === "ArrowDown" || e.key === "Home") && (t.setCurrentItem(a), a.focus()), (e.key === "ArrowUp" || e.key === "End") && (t.setCurrentItem(r), r.focus());
118
+ }));
119
+ }
120
+ }
121
+ handleTriggerKeyUp(e) {
122
+ e.key === " " && e.preventDefault();
123
+ }
124
+ handleTriggerSlotChange() {
125
+ this.updateAccessibleTrigger();
126
+ }
127
+ //
128
+ // Slotted triggers can be arbitrary content, but we need to link them to the dropdown panel with `aria-haspopup` and
129
+ // `aria-expanded`. These must be applied to the "accessible trigger" (the tabbable portion of the trigger element
130
+ // that gets slotted in) so screen readers will understand them. The accessible trigger could be the slotted element,
131
+ // a child of the slotted element, or an element in the slotted element's shadow root.
132
+ //
133
+ // For example, the accessible trigger of an <sl-button> is a <button> located inside its shadow root.
134
+ //
135
+ // To determine this, we assume the first tabbable element in the trigger slot is the "accessible trigger."
136
+ //
137
+ updateAccessibleTrigger() {
138
+ const t = this.trigger.assignedElements({ flatten: !0 }).find((a) => w(a).start);
139
+ let o;
140
+ if (t) {
141
+ switch (t.tagName.toLowerCase()) {
142
+ case "sl-button":
143
+ case "sl-icon-button":
144
+ o = t.button;
145
+ break;
146
+ default:
147
+ o = t;
148
+ }
149
+ o.setAttribute("aria-haspopup", "true"), o.setAttribute("aria-expanded", this.open ? "true" : "false");
150
+ }
151
+ }
152
+ /** Shows the dropdown panel. */
153
+ async show() {
154
+ if (!this.open)
155
+ return this.open = !0, d(this, "sl-after-show");
156
+ }
157
+ /** Hides the dropdown panel */
158
+ async hide() {
159
+ if (this.open)
160
+ return this.open = !1, d(this, "sl-after-hide");
161
+ }
162
+ /**
163
+ * Instructs the dropdown menu to reposition. Useful when the position or size of the trigger changes when the menu
164
+ * is activated.
165
+ */
166
+ reposition() {
167
+ this.popup.reposition();
168
+ }
169
+ addOpenListeners() {
170
+ var e;
171
+ this.panel.addEventListener("sl-select", this.handlePanelSelect), "CloseWatcher" in window ? ((e = this.closeWatcher) == null || e.destroy(), this.closeWatcher = new CloseWatcher(), this.closeWatcher.onclose = () => {
172
+ this.hide(), this.focusOnTrigger();
173
+ }) : this.panel.addEventListener("keydown", this.handleKeyDown), document.addEventListener("keydown", this.handleDocumentKeyDown), document.addEventListener("mousedown", this.handleDocumentMouseDown);
174
+ }
175
+ removeOpenListeners() {
176
+ var e;
177
+ this.panel && (this.panel.removeEventListener("sl-select", this.handlePanelSelect), this.panel.removeEventListener("keydown", this.handleKeyDown)), document.removeEventListener("keydown", this.handleDocumentKeyDown), document.removeEventListener("mousedown", this.handleDocumentMouseDown), (e = this.closeWatcher) == null || e.destroy();
178
+ }
179
+ async handleOpenChange() {
180
+ if (this.disabled) {
181
+ this.open = !1;
182
+ return;
183
+ }
184
+ if (this.updateAccessibleTrigger(), this.open) {
185
+ this.emit("sl-show"), this.addOpenListeners(), await h(this), this.panel.hidden = !1, this.popup.active = !0;
186
+ const { keyframes: e, options: t } = c(this, "dropdown.show", { dir: this.localize.dir() });
187
+ await u(this.popup.popup, e, t), this.emit("sl-after-show");
188
+ } else {
189
+ this.emit("sl-hide"), this.removeOpenListeners(), await h(this);
190
+ const { keyframes: e, options: t } = c(this, "dropdown.hide", { dir: this.localize.dir() });
191
+ await u(this.popup.popup, e, t), this.panel.hidden = !0, this.popup.active = !1, this.emit("sl-after-hide");
192
+ }
193
+ }
194
+ render() {
195
+ return f`
196
+ <sl-popup
197
+ part="base"
198
+ exportparts="popup:base__popup"
199
+ id="dropdown"
200
+ placement=${this.placement}
201
+ distance=${this.distance}
202
+ skidding=${this.skidding}
203
+ strategy=${this.hoist ? "fixed" : "absolute"}
204
+ flip
205
+ shift
206
+ auto-size="vertical"
207
+ auto-size-padding="10"
208
+ sync=${D(this.sync ? this.sync : void 0)}
209
+ class=${_({
210
+ dropdown: !0,
211
+ "dropdown--open": this.open
212
+ })}
213
+ >
214
+ <slot
215
+ name="trigger"
216
+ slot="anchor"
217
+ part="trigger"
218
+ class="dropdown__trigger"
219
+ @click=${this.handleTriggerClick}
220
+ @keydown=${this.handleTriggerKeyDown}
221
+ @keyup=${this.handleTriggerKeyUp}
222
+ @slotchange=${this.handleTriggerSlotChange}
223
+ ></slot>
224
+
225
+ <div aria-hidden=${this.open ? "false" : "true"} aria-labelledby="dropdown">
226
+ <slot part="panel" class="dropdown__panel"></slot>
227
+ </div>
228
+ </sl-popup>
229
+ `;
230
+ }
231
+ };
232
+ s.styles = [k, C];
233
+ s.dependencies = { "sl-popup": y };
234
+ i([
235
+ p(".dropdown")
236
+ ], s.prototype, "popup", 2);
237
+ i([
238
+ p(".dropdown__trigger")
239
+ ], s.prototype, "trigger", 2);
240
+ i([
241
+ p(".dropdown__panel")
242
+ ], s.prototype, "panel", 2);
243
+ i([
244
+ n({ type: Boolean, reflect: !0 })
245
+ ], s.prototype, "open", 2);
246
+ i([
247
+ n({ reflect: !0 })
248
+ ], s.prototype, "placement", 2);
249
+ i([
250
+ n({ type: Boolean, reflect: !0 })
251
+ ], s.prototype, "disabled", 2);
252
+ i([
253
+ n({ attribute: "stay-open-on-select", type: Boolean, reflect: !0 })
254
+ ], s.prototype, "stayOpenOnSelect", 2);
255
+ i([
256
+ n({ attribute: !1 })
257
+ ], s.prototype, "containingElement", 2);
258
+ i([
259
+ n({ type: Number })
260
+ ], s.prototype, "distance", 2);
261
+ i([
262
+ n({ type: Number })
263
+ ], s.prototype, "skidding", 2);
264
+ i([
265
+ n({ type: Boolean })
266
+ ], s.prototype, "hoist", 2);
267
+ i([
268
+ n({ reflect: !0 })
269
+ ], s.prototype, "sync", 2);
270
+ i([
271
+ b("open", { waitUntilFirstUpdate: !0 })
272
+ ], s.prototype, "handleOpenChange", 1);
273
+ m("dropdown.show", {
274
+ keyframes: [
275
+ { opacity: 0, scale: 0.9 },
276
+ { opacity: 1, scale: 1 }
277
+ ],
278
+ options: { duration: 100, easing: "ease" }
279
+ });
280
+ m("dropdown.hide", {
281
+ keyframes: [
282
+ { opacity: 1, scale: 1 },
283
+ { opacity: 0, scale: 0.9 }
284
+ ],
285
+ options: { duration: 100, easing: "ease" }
286
+ });
287
+ var M = s;
288
+ s.define("sl-dropdown");
289
+ export {
290
+ s as S,
291
+ M as d
292
+ };
@@ -0,0 +1,243 @@
1
+ import { S as u } from "./chunk.XJILXOW4.js";
2
+ import { s as h, a as i, g as l, b as n, w as c } from "./chunk.LHI6QEL2.js";
3
+ import { H as m } from "./chunk.NYIIDP5N.js";
4
+ import { L as f } from "./chunk.WLV3FVBR.js";
5
+ import { i as v, k as d } from "./lit-element.js";
6
+ import { w as p } from "./chunk.2FB5TK5H.js";
7
+ import { c as b, b as t, S as g } from "./chunk.5THGRZAA.js";
8
+ import { R as y } from "./class-map.js";
9
+ import { n as s } from "./property.js";
10
+ import { e as _ } from "./query.js";
11
+ var w = v`
12
+ :host {
13
+ display: contents;
14
+
15
+ /* For better DX, we'll reset the margin here so the base part can inherit it */
16
+ margin: 0;
17
+ }
18
+
19
+ .alert {
20
+ position: relative;
21
+ display: flex;
22
+ align-items: stretch;
23
+ background-color: var(--sl-panel-background-color);
24
+ border: solid var(--sl-panel-border-width) var(--sl-panel-border-color);
25
+ border-top-width: calc(var(--sl-panel-border-width) * 3);
26
+ border-radius: var(--sl-border-radius-medium);
27
+ font-family: var(--sl-font-sans);
28
+ font-size: var(--sl-font-size-small);
29
+ font-weight: var(--sl-font-weight-normal);
30
+ line-height: 1.6;
31
+ color: var(--sl-color-neutral-700);
32
+ margin: inherit;
33
+ }
34
+
35
+ .alert:not(.alert--has-icon) .alert__icon,
36
+ .alert:not(.alert--closable) .alert__close-button {
37
+ display: none;
38
+ }
39
+
40
+ .alert__icon {
41
+ flex: 0 0 auto;
42
+ display: flex;
43
+ align-items: center;
44
+ font-size: var(--sl-font-size-large);
45
+ padding-inline-start: var(--sl-spacing-large);
46
+ }
47
+
48
+ .alert--primary {
49
+ border-top-color: var(--sl-color-primary-600);
50
+ }
51
+
52
+ .alert--primary .alert__icon {
53
+ color: var(--sl-color-primary-600);
54
+ }
55
+
56
+ .alert--success {
57
+ border-top-color: var(--sl-color-success-600);
58
+ }
59
+
60
+ .alert--success .alert__icon {
61
+ color: var(--sl-color-success-600);
62
+ }
63
+
64
+ .alert--neutral {
65
+ border-top-color: var(--sl-color-neutral-600);
66
+ }
67
+
68
+ .alert--neutral .alert__icon {
69
+ color: var(--sl-color-neutral-600);
70
+ }
71
+
72
+ .alert--warning {
73
+ border-top-color: var(--sl-color-warning-600);
74
+ }
75
+
76
+ .alert--warning .alert__icon {
77
+ color: var(--sl-color-warning-600);
78
+ }
79
+
80
+ .alert--danger {
81
+ border-top-color: var(--sl-color-danger-600);
82
+ }
83
+
84
+ .alert--danger .alert__icon {
85
+ color: var(--sl-color-danger-600);
86
+ }
87
+
88
+ .alert__message {
89
+ flex: 1 1 auto;
90
+ display: block;
91
+ padding: var(--sl-spacing-large);
92
+ overflow: hidden;
93
+ }
94
+
95
+ .alert__close-button {
96
+ flex: 0 0 auto;
97
+ display: flex;
98
+ align-items: center;
99
+ font-size: var(--sl-font-size-medium);
100
+ padding-inline-end: var(--sl-spacing-medium);
101
+ }
102
+ `, a = Object.assign(document.createElement("div"), { className: "sl-toast-stack" }), e = class extends g {
103
+ constructor() {
104
+ super(...arguments), this.hasSlotController = new m(this, "icon", "suffix"), this.localize = new f(this), this.open = !1, this.closable = !1, this.variant = "primary", this.duration = 1 / 0;
105
+ }
106
+ firstUpdated() {
107
+ this.base.hidden = !this.open;
108
+ }
109
+ restartAutoHide() {
110
+ clearTimeout(this.autoHideTimeout), this.open && this.duration < 1 / 0 && (this.autoHideTimeout = window.setTimeout(() => this.hide(), this.duration));
111
+ }
112
+ handleCloseClick() {
113
+ this.hide();
114
+ }
115
+ handleMouseMove() {
116
+ this.restartAutoHide();
117
+ }
118
+ async handleOpenChange() {
119
+ if (this.open) {
120
+ this.emit("sl-show"), this.duration < 1 / 0 && this.restartAutoHide(), await i(this.base), this.base.hidden = !1;
121
+ const { keyframes: r, options: o } = l(this, "alert.show", { dir: this.localize.dir() });
122
+ await n(this.base, r, o), this.emit("sl-after-show");
123
+ } else {
124
+ this.emit("sl-hide"), clearTimeout(this.autoHideTimeout), await i(this.base);
125
+ const { keyframes: r, options: o } = l(this, "alert.hide", { dir: this.localize.dir() });
126
+ await n(this.base, r, o), this.base.hidden = !0, this.emit("sl-after-hide");
127
+ }
128
+ }
129
+ handleDurationChange() {
130
+ this.restartAutoHide();
131
+ }
132
+ /** Shows the alert. */
133
+ async show() {
134
+ if (!this.open)
135
+ return this.open = !0, c(this, "sl-after-show");
136
+ }
137
+ /** Hides the alert */
138
+ async hide() {
139
+ if (this.open)
140
+ return this.open = !1, c(this, "sl-after-hide");
141
+ }
142
+ /**
143
+ * Displays the alert as a toast notification. This will move the alert out of its position in the DOM and, when
144
+ * dismissed, it will be removed from the DOM completely. By storing a reference to the alert, you can reuse it by
145
+ * calling this method again. The returned promise will resolve after the alert is hidden.
146
+ */
147
+ async toast() {
148
+ return new Promise((r) => {
149
+ a.parentElement === null && document.body.append(a), a.appendChild(this), requestAnimationFrame(() => {
150
+ this.clientWidth, this.show();
151
+ }), this.addEventListener(
152
+ "sl-after-hide",
153
+ () => {
154
+ a.removeChild(this), r(), a.querySelector("sl-alert") === null && a.remove();
155
+ },
156
+ { once: !0 }
157
+ );
158
+ });
159
+ }
160
+ render() {
161
+ return d`
162
+ <div
163
+ part="base"
164
+ class=${y({
165
+ alert: !0,
166
+ "alert--open": this.open,
167
+ "alert--closable": this.closable,
168
+ "alert--has-icon": this.hasSlotController.test("icon"),
169
+ "alert--primary": this.variant === "primary",
170
+ "alert--success": this.variant === "success",
171
+ "alert--neutral": this.variant === "neutral",
172
+ "alert--warning": this.variant === "warning",
173
+ "alert--danger": this.variant === "danger"
174
+ })}
175
+ role="alert"
176
+ aria-hidden=${this.open ? "false" : "true"}
177
+ @mousemove=${this.handleMouseMove}
178
+ >
179
+ <div part="icon" class="alert__icon">
180
+ <slot name="icon"></slot>
181
+ </div>
182
+
183
+ <div part="message" class="alert__message" aria-live="polite">
184
+ <slot></slot>
185
+ </div>
186
+
187
+ ${this.closable ? d`
188
+ <sl-icon-button
189
+ part="close-button"
190
+ exportparts="base:close-button__base"
191
+ class="alert__close-button"
192
+ name="x-lg"
193
+ library="system"
194
+ label=${this.localize.term("close")}
195
+ @click=${this.handleCloseClick}
196
+ ></sl-icon-button>
197
+ ` : ""}
198
+ </div>
199
+ `;
200
+ }
201
+ };
202
+ e.styles = [b, w];
203
+ e.dependencies = { "sl-icon-button": u };
204
+ t([
205
+ _('[part~="base"]')
206
+ ], e.prototype, "base", 2);
207
+ t([
208
+ s({ type: Boolean, reflect: !0 })
209
+ ], e.prototype, "open", 2);
210
+ t([
211
+ s({ type: Boolean, reflect: !0 })
212
+ ], e.prototype, "closable", 2);
213
+ t([
214
+ s({ reflect: !0 })
215
+ ], e.prototype, "variant", 2);
216
+ t([
217
+ s({ type: Number })
218
+ ], e.prototype, "duration", 2);
219
+ t([
220
+ p("open", { waitUntilFirstUpdate: !0 })
221
+ ], e.prototype, "handleOpenChange", 1);
222
+ t([
223
+ p("duration")
224
+ ], e.prototype, "handleDurationChange", 1);
225
+ h("alert.show", {
226
+ keyframes: [
227
+ { opacity: 0, scale: 0.8 },
228
+ { opacity: 1, scale: 1 }
229
+ ],
230
+ options: { duration: 250, easing: "ease" }
231
+ });
232
+ h("alert.hide", {
233
+ keyframes: [
234
+ { opacity: 1, scale: 1 },
235
+ { opacity: 0, scale: 0.8 }
236
+ ],
237
+ options: { duration: 250, easing: "ease" }
238
+ });
239
+ var D = e;
240
+ e.define("sl-alert");
241
+ export {
242
+ D as a
243
+ };