@ds-gn/ui 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/custom-elements.json +5527 -2136
- package/dist/common/controllers/OverlayDismissController.d.ts +52 -0
- package/dist/common/controllers/OverlayPositionController.d.ts +168 -0
- package/dist/common/controllers/RovingFocusController.d.ts +99 -0
- package/dist/common/controllers/SectionEntranceController.d.ts +37 -0
- package/dist/common/helpers/field-control.d.ts +35 -0
- package/dist/common/helpers/listbox-navigation.d.ts +50 -0
- package/dist/common/props/size/size.props.d.ts +11 -0
- package/dist/common/styles/overlay-panel.styles.d.ts +55 -0
- package/dist/components/Button/src/Button.d.ts +20 -0
- package/dist/components/Button/src/Button.js +28 -0
- package/dist/components/Container/src/Container.d.ts +10 -0
- package/dist/components/Container/src/Container.js +148 -23
- package/dist/components/DropdownMenu/src/DropdownMenu.d.ts +150 -0
- package/dist/components/DropdownMenu/src/DropdownMenu.js +1550 -0
- package/dist/components/DropdownMenu/src/DropdownMenu.playground.d.ts +2 -0
- package/dist/components/DropdownMenu/src/DropdownMenu.props.d.ts +47 -0
- package/dist/components/DropdownMenu/src/DropdownMenu.props.js +54 -0
- package/dist/components/DropdownMenu/src/DropdownMenu.styles.d.ts +20 -0
- package/dist/components/Field/src/Field.d.ts +39 -0
- package/dist/components/Field/src/Field.js +203 -0
- package/dist/components/Field/src/Field.playground.d.ts +2 -0
- package/dist/components/Field/src/Field.styles.d.ts +6 -0
- package/dist/components/Icon/src/Icon.d.ts +5 -0
- package/dist/components/Icon/src/Icon.js +3 -0
- package/dist/components/Icon/src/icons/arrow-down.d.ts +1 -0
- package/dist/components/Icon/src/icons/arrow-down.js +6 -0
- package/dist/components/Icon/src/icons/arrow-up.d.ts +1 -0
- package/dist/components/Icon/src/icons/arrow-up.js +6 -0
- package/dist/components/Icon/src/icons/chevrons-up-down.d.ts +1 -0
- package/dist/components/Icon/src/icons/chevrons-up-down.js +6 -0
- package/dist/components/Icon/src/icons/cookie.d.ts +1 -0
- package/dist/components/Icon/src/icons/cookie.js +6 -0
- package/dist/components/Icon/src/icons/icon-names.d.ts +1 -1
- package/dist/components/Icon/src/icons/icon-names.js +4 -0
- package/dist/components/Icon/src/icons/index.d.ts +4 -0
- package/dist/components/Icon/src/icons/index.js +4 -0
- package/dist/components/Input/src/Input.d.ts +37 -0
- package/dist/components/Input/src/Input.js +300 -143
- package/dist/components/Input/src/Input.props.d.ts +2 -1
- package/dist/components/Input/src/Input.props.js +12 -6
- package/dist/components/Input/src/Input.styles.d.ts +12 -4
- package/dist/components/Modal/src/Modal.d.ts +1 -0
- package/dist/components/Modal/src/Modal.js +1 -0
- package/dist/components/Nav/src/Nav.js +2 -1
- package/dist/components/NavLink/src/NavLink.d.ts +14 -30
- package/dist/components/NavLink/src/NavLink.js +201 -65
- package/dist/components/Select/src/Select.d.ts +157 -0
- package/dist/components/Select/src/Select.js +1766 -0
- package/dist/components/Select/src/Select.playground.d.ts +2 -0
- package/dist/components/Select/src/Select.props.d.ts +19 -0
- package/dist/components/Select/src/Select.props.js +40 -0
- package/dist/components/Select/src/Select.styles.d.ts +30 -0
- package/dist/components/Table/src/Table.d.ts +93 -0
- package/dist/components/Table/src/Table.js +1105 -0
- package/dist/components/Table/src/Table.playground.d.ts +2 -0
- package/dist/components/Table/src/Table.props.d.ts +53 -0
- package/dist/components/Table/src/Table.props.js +18 -0
- package/dist/components/Table/src/Table.styles.d.ts +33 -0
- package/dist/components/Toaster/src/Toaster.d.ts +174 -0
- package/dist/components/Toaster/src/Toaster.js +1489 -0
- package/dist/components/Toaster/src/Toaster.playground.d.ts +2 -0
- package/dist/components/Toaster/src/Toaster.props.d.ts +14 -0
- package/dist/components/Toaster/src/Toaster.props.js +81 -0
- package/dist/components/Toaster/src/Toaster.styles.d.ts +52 -0
- package/dist/components/Toaster/src/toast.d.ts +115 -0
- package/dist/components/Toaster/src/toast.js +74 -0
- package/dist/playground/types.d.ts +27 -0
- package/dist/playground-manifest.d.ts +3 -2
- package/dist/playground-manifest.js +507 -7
- package/dist/react/DropdownMenu.d.ts +8 -0
- package/dist/react/DropdownMenu.js +13 -0
- package/dist/react/Field.d.ts +6 -0
- package/dist/react/Field.js +13 -0
- package/dist/react/Select.d.ts +8 -0
- package/dist/react/Select.js +13 -0
- package/dist/react/Table.d.ts +8 -0
- package/dist/react/Table.js +13 -0
- package/dist/react/Toaster.d.ts +8 -0
- package/dist/react/Toaster.js +13 -0
- package/dist/react/index.d.ts +6 -0
- package/dist/react/index.js +6 -0
- package/package.json +52 -2
|
@@ -0,0 +1,1489 @@
|
|
|
1
|
+
var __legacyDecorateClassTS = function(decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else
|
|
6
|
+
for (var i = decorators.length - 1;i >= 0; i--)
|
|
7
|
+
if (d = decorators[i])
|
|
8
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// components/Toaster/src/Toaster.ts
|
|
13
|
+
import"../../Button/src/Button.js";
|
|
14
|
+
import { MotionController } from "@ds-gn/motion/lit";
|
|
15
|
+
import {
|
|
16
|
+
adoptStyles,
|
|
17
|
+
html as html2,
|
|
18
|
+
nothing,
|
|
19
|
+
render
|
|
20
|
+
} from "lit";
|
|
21
|
+
import { property, state } from "lit/decorators.js";
|
|
22
|
+
import { repeat } from "lit/directives/repeat.js";
|
|
23
|
+
|
|
24
|
+
// common/Base/Base.ts
|
|
25
|
+
import { html, LitElement } from "lit";
|
|
26
|
+
|
|
27
|
+
// common/helpers/define-element.ts
|
|
28
|
+
var defineElement = (tag, ctor) => {
|
|
29
|
+
if (typeof customElements === "undefined")
|
|
30
|
+
return;
|
|
31
|
+
if (!customElements.get(tag))
|
|
32
|
+
customElements.define(tag, ctor);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// common/Base/Base.css
|
|
36
|
+
import { css } from "lit";
|
|
37
|
+
var styles = css`/* Base reset in @layer base ensures it comes before utilities in Tailwind v4 cascade
|
|
38
|
+
This prevents the reset from overriding component utility classes */
|
|
39
|
+
@layer base {
|
|
40
|
+
:host {
|
|
41
|
+
display: block;
|
|
42
|
+
box-sizing: border-box;
|
|
43
|
+
line-height: 1.5;
|
|
44
|
+
-webkit-text-size-adjust: 100%;
|
|
45
|
+
tab-size: 4;
|
|
46
|
+
font-family: var(
|
|
47
|
+
--default-font-family,
|
|
48
|
+
var(--font-sans, ui-sans-serif, system-ui, sans-serif)
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
*,
|
|
53
|
+
*::before,
|
|
54
|
+
*::after {
|
|
55
|
+
box-sizing: inherit;
|
|
56
|
+
margin: 0;
|
|
57
|
+
padding: 0;
|
|
58
|
+
border: 0 solid;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
:host h1,
|
|
62
|
+
:host h2,
|
|
63
|
+
:host h3,
|
|
64
|
+
:host h4,
|
|
65
|
+
:host h5,
|
|
66
|
+
:host h6 {
|
|
67
|
+
font-size: inherit;
|
|
68
|
+
font-weight: inherit;
|
|
69
|
+
margin: 0;
|
|
70
|
+
padding: 0;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
74
|
+
var Base_default = styles;
|
|
75
|
+
|
|
76
|
+
// common/Base/Base.ts
|
|
77
|
+
class Base extends LitElement {
|
|
78
|
+
static styles = Base_default;
|
|
79
|
+
updateTheme(changedProperties, surface) {
|
|
80
|
+
if (changedProperties.has("surface")) {
|
|
81
|
+
if (surface) {
|
|
82
|
+
this.setAttribute("data-theme", surface);
|
|
83
|
+
} else {
|
|
84
|
+
this.removeAttribute("data-theme");
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
emit(name, detail, options = {}) {
|
|
89
|
+
return this.dispatchEvent(new CustomEvent(name, {
|
|
90
|
+
detail,
|
|
91
|
+
bubbles: true,
|
|
92
|
+
composed: true,
|
|
93
|
+
cancelable: options.cancelable ?? false
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
render() {
|
|
97
|
+
return html`<slot></slot>`;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
defineElement("dsgn-base", Base);
|
|
101
|
+
|
|
102
|
+
// common/helpers/enum-validator.ts
|
|
103
|
+
var enumValidator = (propName, enumSet, candidateValue) => {
|
|
104
|
+
if (!enumSet.has(candidateValue)) {
|
|
105
|
+
throw new Error(`Invalid prop ${propName} of value ${candidateValue}. Expected one of: ${Array.from(enumSet).join(", ")}`);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// common/helpers/enum-creator.ts
|
|
110
|
+
var enumCreator = (acceptableValues, propName, type, other = {}) => {
|
|
111
|
+
const acceptableValuesSet = new Set(acceptableValues);
|
|
112
|
+
return {
|
|
113
|
+
type,
|
|
114
|
+
hasChanged(newValue, oldValue) {
|
|
115
|
+
if (newValue !== oldValue) {
|
|
116
|
+
enumValidator(propName, acceptableValuesSet, newValue);
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
return false;
|
|
120
|
+
},
|
|
121
|
+
...other
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// common/props/surface/surface.props.ts
|
|
126
|
+
var surfaceValues = {
|
|
127
|
+
LIGHT: "light",
|
|
128
|
+
DARK: "dark"
|
|
129
|
+
};
|
|
130
|
+
var surfaceProps = enumCreator(Object.values(surfaceValues), "surface", String, { reflect: true });
|
|
131
|
+
|
|
132
|
+
// components/Toaster/src/Toaster.ts
|
|
133
|
+
import {
|
|
134
|
+
buttonAppearanceValues,
|
|
135
|
+
buttonIconPositionValues,
|
|
136
|
+
buttonSizeValues
|
|
137
|
+
} from "../../Button/src/Button.props.js";
|
|
138
|
+
import { Icon } from "../../Icon/src/Icon.js";
|
|
139
|
+
// components/Icon/src/icons/circle-check.ts
|
|
140
|
+
import { svg } from "lit";
|
|
141
|
+
var circleCheck = svg`<circle cx="12" cy="12" r="10" /><path d="m9 12 2 2 4-4" />`;
|
|
142
|
+
// components/Icon/src/icons/circle-x.ts
|
|
143
|
+
import { svg as svg2 } from "lit";
|
|
144
|
+
var circleX = svg2`<circle cx="12" cy="12" r="10" /><path d="m15 9-6 6" /><path d="m9 9 6 6" />`;
|
|
145
|
+
// components/Icon/src/icons/info.ts
|
|
146
|
+
import { svg as svg3 } from "lit";
|
|
147
|
+
var info = svg3`<circle cx="12" cy="12" r="10" /><path d="M12 16v-4" /><path d="M12 8h.01" />`;
|
|
148
|
+
// components/Icon/src/icons/triangle-alert.ts
|
|
149
|
+
import { svg as svg4 } from "lit";
|
|
150
|
+
var triangleAlert = svg4`<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" /><path d="M12 9v4" /><path d="M12 17h.01" />`;
|
|
151
|
+
// components/Icon/src/icons/x.ts
|
|
152
|
+
import { svg as svg5 } from "lit";
|
|
153
|
+
var x = svg5`<path d="M18 6 6 18" /><path d="m6 6 12 12" />`;
|
|
154
|
+
// components/Toaster/src/toast.ts
|
|
155
|
+
var toastVariantValues = {
|
|
156
|
+
INFO: "info",
|
|
157
|
+
SUCCESS: "success",
|
|
158
|
+
WARNING: "warning",
|
|
159
|
+
ERROR: "error"
|
|
160
|
+
};
|
|
161
|
+
var toastDismissReasonValues = {
|
|
162
|
+
TIMEOUT: "timeout",
|
|
163
|
+
CLOSE: "close",
|
|
164
|
+
ACTION: "action",
|
|
165
|
+
PROGRAMMATIC: "programmatic"
|
|
166
|
+
};
|
|
167
|
+
var toastActionAppearanceValues = {
|
|
168
|
+
PRIMARY: "primary",
|
|
169
|
+
SECONDARY: "secondary"
|
|
170
|
+
};
|
|
171
|
+
var TOAST_EVENT = "dsgn-toast";
|
|
172
|
+
var TOAST_PENDING_LIMIT = 20;
|
|
173
|
+
var TOAST_PENDING_KEY = Symbol.for("dsgn.toast.pending");
|
|
174
|
+
var TOAST_ID_KEY = Symbol.for("dsgn.toast.counter");
|
|
175
|
+
var nextToastId = () => {
|
|
176
|
+
const store = globalThis;
|
|
177
|
+
const id = (store[TOAST_ID_KEY] ?? 0) + 1;
|
|
178
|
+
store[TOAST_ID_KEY] = id;
|
|
179
|
+
return `dsgn-toast-${id}`;
|
|
180
|
+
};
|
|
181
|
+
var takePendingToasts = () => {
|
|
182
|
+
const store = globalThis;
|
|
183
|
+
const pending = store[TOAST_PENDING_KEY] ?? [];
|
|
184
|
+
store[TOAST_PENDING_KEY] = [];
|
|
185
|
+
return pending;
|
|
186
|
+
};
|
|
187
|
+
var hold = (request) => {
|
|
188
|
+
const store = globalThis;
|
|
189
|
+
const pending = store[TOAST_PENDING_KEY] ?? [];
|
|
190
|
+
if (request.type === "dismiss") {
|
|
191
|
+
store[TOAST_PENDING_KEY] = request.id === undefined ? [] : pending.filter((held) => held.type !== "show" || held.id !== request.id);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
pending.push(request);
|
|
195
|
+
store[TOAST_PENDING_KEY] = pending.slice(-TOAST_PENDING_LIMIT);
|
|
196
|
+
};
|
|
197
|
+
var send = (request) => {
|
|
198
|
+
if (typeof document === "undefined")
|
|
199
|
+
return;
|
|
200
|
+
const handled = !document.dispatchEvent(new CustomEvent(TOAST_EVENT, { detail: request, cancelable: true }));
|
|
201
|
+
if (!handled)
|
|
202
|
+
hold(request);
|
|
203
|
+
};
|
|
204
|
+
var show = (options) => {
|
|
205
|
+
const id = nextToastId();
|
|
206
|
+
send({ type: "show", id, options });
|
|
207
|
+
return id;
|
|
208
|
+
};
|
|
209
|
+
var shortcut = (variant) => (title, options = {}) => show({ ...options, title, variant });
|
|
210
|
+
var toast = Object.assign(show, {
|
|
211
|
+
info: shortcut(toastVariantValues.INFO),
|
|
212
|
+
success: shortcut(toastVariantValues.SUCCESS),
|
|
213
|
+
warning: shortcut(toastVariantValues.WARNING),
|
|
214
|
+
error: shortcut(toastVariantValues.ERROR),
|
|
215
|
+
dismiss: (id) => send({ type: "dismiss", id })
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
// components/Toaster/src/Toaster.css
|
|
219
|
+
import { css as css2 } from "lit";
|
|
220
|
+
var styles2 = css2`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
|
|
221
|
+
@layer properties;
|
|
222
|
+
@layer theme {
|
|
223
|
+
:root, :host {
|
|
224
|
+
--font-sans: ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
|
|
225
|
+
'Noto Color Emoji';
|
|
226
|
+
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
|
|
227
|
+
monospace;
|
|
228
|
+
--spacing: 0.25rem;
|
|
229
|
+
--text-sm: 0.875rem;
|
|
230
|
+
--text-sm--line-height: calc(1.25 / 0.875);
|
|
231
|
+
--font-weight-semibold: 600;
|
|
232
|
+
--radius-lg: 0.5rem;
|
|
233
|
+
--default-transition-duration: 150ms;
|
|
234
|
+
--default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
235
|
+
--duration-quick: var(--dsgn-src-duration-quick, 180ms);
|
|
236
|
+
--ease-standard: var(--dsgn-src-ease-standard, cubic-bezier(0.2, 0, 0, 1));
|
|
237
|
+
--color-error: inherit;
|
|
238
|
+
--color-error-strong: inherit;
|
|
239
|
+
--color-info: inherit;
|
|
240
|
+
--color-outline-strong: inherit;
|
|
241
|
+
--color-popover-bg: inherit;
|
|
242
|
+
--color-popover-border: inherit;
|
|
243
|
+
--color-success: inherit;
|
|
244
|
+
--color-success-strong: inherit;
|
|
245
|
+
--color-text-primary: inherit;
|
|
246
|
+
--color-text-secondary: inherit;
|
|
247
|
+
--color-warning: inherit;
|
|
248
|
+
--color-warning-strong: inherit;
|
|
249
|
+
--shadow-popover: inherit;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
@layer utilities {
|
|
253
|
+
.pointer-events-auto {
|
|
254
|
+
pointer-events: auto;
|
|
255
|
+
}
|
|
256
|
+
.pointer-events-none {
|
|
257
|
+
pointer-events: none;
|
|
258
|
+
}
|
|
259
|
+
.visible {
|
|
260
|
+
visibility: visible;
|
|
261
|
+
}
|
|
262
|
+
.sr-only {
|
|
263
|
+
position: absolute;
|
|
264
|
+
width: 1px;
|
|
265
|
+
height: 1px;
|
|
266
|
+
padding: 0;
|
|
267
|
+
margin: -1px;
|
|
268
|
+
overflow: hidden;
|
|
269
|
+
clip-path: inset(50%);
|
|
270
|
+
white-space: nowrap;
|
|
271
|
+
border-width: 0;
|
|
272
|
+
}
|
|
273
|
+
.absolute {
|
|
274
|
+
position: absolute;
|
|
275
|
+
}
|
|
276
|
+
.fixed {
|
|
277
|
+
position: fixed;
|
|
278
|
+
}
|
|
279
|
+
.relative {
|
|
280
|
+
position: relative;
|
|
281
|
+
}
|
|
282
|
+
.static {
|
|
283
|
+
position: static;
|
|
284
|
+
}
|
|
285
|
+
.inset-auto {
|
|
286
|
+
inset: auto;
|
|
287
|
+
}
|
|
288
|
+
.inset-x-0 {
|
|
289
|
+
inset-inline: calc(var(--spacing) * 0);
|
|
290
|
+
}
|
|
291
|
+
.right-6 {
|
|
292
|
+
right: calc(var(--spacing) * 6);
|
|
293
|
+
}
|
|
294
|
+
.bottom-0 {
|
|
295
|
+
bottom: calc(var(--spacing) * 0);
|
|
296
|
+
}
|
|
297
|
+
.bottom-6 {
|
|
298
|
+
bottom: calc(var(--spacing) * 6);
|
|
299
|
+
}
|
|
300
|
+
.left-0 {
|
|
301
|
+
left: calc(var(--spacing) * 0);
|
|
302
|
+
}
|
|
303
|
+
.z-50 {
|
|
304
|
+
z-index: 50;
|
|
305
|
+
}
|
|
306
|
+
.container {
|
|
307
|
+
width: 100%;
|
|
308
|
+
@media (width >= 40rem) {
|
|
309
|
+
max-width: 40rem;
|
|
310
|
+
}
|
|
311
|
+
@media (width >= 48rem) {
|
|
312
|
+
max-width: 48rem;
|
|
313
|
+
}
|
|
314
|
+
@media (width >= 64rem) {
|
|
315
|
+
max-width: 64rem;
|
|
316
|
+
}
|
|
317
|
+
@media (width >= 80rem) {
|
|
318
|
+
max-width: 80rem;
|
|
319
|
+
}
|
|
320
|
+
@media (width >= 96rem) {
|
|
321
|
+
max-width: 96rem;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
.m-0 {
|
|
325
|
+
margin: calc(var(--spacing) * 0);
|
|
326
|
+
}
|
|
327
|
+
.-mt-1\\.5 {
|
|
328
|
+
margin-top: calc(var(--spacing) * -1.5);
|
|
329
|
+
}
|
|
330
|
+
.mt-1 {
|
|
331
|
+
margin-top: calc(var(--spacing) * 1);
|
|
332
|
+
}
|
|
333
|
+
.mt-2\\.5 {
|
|
334
|
+
margin-top: calc(var(--spacing) * 2.5);
|
|
335
|
+
}
|
|
336
|
+
.mt-px {
|
|
337
|
+
margin-top: 1px;
|
|
338
|
+
}
|
|
339
|
+
.box-border {
|
|
340
|
+
box-sizing: border-box;
|
|
341
|
+
}
|
|
342
|
+
.flex {
|
|
343
|
+
display: flex;
|
|
344
|
+
}
|
|
345
|
+
.inline {
|
|
346
|
+
display: inline;
|
|
347
|
+
}
|
|
348
|
+
.size-5 {
|
|
349
|
+
width: calc(var(--spacing) * 5);
|
|
350
|
+
height: calc(var(--spacing) * 5);
|
|
351
|
+
}
|
|
352
|
+
.h-0\\.5 {
|
|
353
|
+
height: calc(var(--spacing) * 0.5);
|
|
354
|
+
}
|
|
355
|
+
.max-h-\\[calc\\(100dvh-48px\\)\\] {
|
|
356
|
+
max-height: calc(100dvh - 48px);
|
|
357
|
+
}
|
|
358
|
+
.w-\\[380px\\] {
|
|
359
|
+
width: 380px;
|
|
360
|
+
}
|
|
361
|
+
.w-full {
|
|
362
|
+
width: 100%;
|
|
363
|
+
}
|
|
364
|
+
.min-w-0 {
|
|
365
|
+
min-width: calc(var(--spacing) * 0);
|
|
366
|
+
}
|
|
367
|
+
.flex-1 {
|
|
368
|
+
flex: 1;
|
|
369
|
+
}
|
|
370
|
+
.shrink-0 {
|
|
371
|
+
flex-shrink: 0;
|
|
372
|
+
}
|
|
373
|
+
.origin-bottom {
|
|
374
|
+
transform-origin: bottom;
|
|
375
|
+
}
|
|
376
|
+
.origin-left {
|
|
377
|
+
transform-origin: 0;
|
|
378
|
+
}
|
|
379
|
+
.transform {
|
|
380
|
+
transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);
|
|
381
|
+
}
|
|
382
|
+
.list-none {
|
|
383
|
+
list-style-type: none;
|
|
384
|
+
}
|
|
385
|
+
.flex-col {
|
|
386
|
+
flex-direction: column;
|
|
387
|
+
}
|
|
388
|
+
.flex-wrap {
|
|
389
|
+
flex-wrap: wrap;
|
|
390
|
+
}
|
|
391
|
+
.items-center {
|
|
392
|
+
align-items: center;
|
|
393
|
+
}
|
|
394
|
+
.items-end {
|
|
395
|
+
align-items: flex-end;
|
|
396
|
+
}
|
|
397
|
+
.items-start {
|
|
398
|
+
align-items: flex-start;
|
|
399
|
+
}
|
|
400
|
+
.gap-0\\.5 {
|
|
401
|
+
gap: calc(var(--spacing) * 0.5);
|
|
402
|
+
}
|
|
403
|
+
.gap-2 {
|
|
404
|
+
gap: calc(var(--spacing) * 2);
|
|
405
|
+
}
|
|
406
|
+
.gap-3 {
|
|
407
|
+
gap: calc(var(--spacing) * 3);
|
|
408
|
+
}
|
|
409
|
+
.gap-x-4 {
|
|
410
|
+
column-gap: calc(var(--spacing) * 4);
|
|
411
|
+
}
|
|
412
|
+
.gap-y-1 {
|
|
413
|
+
row-gap: calc(var(--spacing) * 1);
|
|
414
|
+
}
|
|
415
|
+
.overflow-hidden {
|
|
416
|
+
overflow: hidden;
|
|
417
|
+
}
|
|
418
|
+
.overflow-visible {
|
|
419
|
+
overflow: visible;
|
|
420
|
+
}
|
|
421
|
+
.overflow-y-auto {
|
|
422
|
+
overflow-y: auto;
|
|
423
|
+
}
|
|
424
|
+
.rounded-full {
|
|
425
|
+
border-radius: calc(infinity * 1px);
|
|
426
|
+
}
|
|
427
|
+
.rounded-lg {
|
|
428
|
+
border-radius: var(--radius-lg);
|
|
429
|
+
}
|
|
430
|
+
.border {
|
|
431
|
+
border-style: var(--tw-border-style);
|
|
432
|
+
border-width: 1px;
|
|
433
|
+
}
|
|
434
|
+
.border-0 {
|
|
435
|
+
border-style: var(--tw-border-style);
|
|
436
|
+
border-width: 0px;
|
|
437
|
+
}
|
|
438
|
+
.border-popover-border {
|
|
439
|
+
border-color: var(--color-popover-border);
|
|
440
|
+
}
|
|
441
|
+
.bg-error {
|
|
442
|
+
background-color: var(--color-error);
|
|
443
|
+
}
|
|
444
|
+
.bg-info {
|
|
445
|
+
background-color: var(--color-info);
|
|
446
|
+
}
|
|
447
|
+
.bg-outline-strong {
|
|
448
|
+
background-color: var(--color-outline-strong);
|
|
449
|
+
}
|
|
450
|
+
.bg-popover-bg {
|
|
451
|
+
background-color: var(--color-popover-bg);
|
|
452
|
+
}
|
|
453
|
+
.bg-success {
|
|
454
|
+
background-color: var(--color-success);
|
|
455
|
+
}
|
|
456
|
+
.bg-transparent {
|
|
457
|
+
background-color: transparent;
|
|
458
|
+
}
|
|
459
|
+
.bg-warning {
|
|
460
|
+
background-color: var(--color-warning);
|
|
461
|
+
}
|
|
462
|
+
.fill-none {
|
|
463
|
+
fill: none;
|
|
464
|
+
}
|
|
465
|
+
.stroke-current {
|
|
466
|
+
stroke: currentcolor;
|
|
467
|
+
}
|
|
468
|
+
.stroke-\\[1\\.75\\] {
|
|
469
|
+
stroke-width: 1.75;
|
|
470
|
+
}
|
|
471
|
+
.p-0 {
|
|
472
|
+
padding: calc(var(--spacing) * 0);
|
|
473
|
+
}
|
|
474
|
+
.px-2\\.5 {
|
|
475
|
+
padding-inline: calc(var(--spacing) * 2.5);
|
|
476
|
+
}
|
|
477
|
+
.py-2\\.5 {
|
|
478
|
+
padding-block: calc(var(--spacing) * 2.5);
|
|
479
|
+
}
|
|
480
|
+
.py-3\\.5 {
|
|
481
|
+
padding-block: calc(var(--spacing) * 3.5);
|
|
482
|
+
}
|
|
483
|
+
.py-\\[3px\\] {
|
|
484
|
+
padding-block: 3px;
|
|
485
|
+
}
|
|
486
|
+
.pr-2 {
|
|
487
|
+
padding-right: calc(var(--spacing) * 2);
|
|
488
|
+
}
|
|
489
|
+
.pl-4 {
|
|
490
|
+
padding-left: calc(var(--spacing) * 4);
|
|
491
|
+
}
|
|
492
|
+
.font-mono {
|
|
493
|
+
font-family: var(--font-mono);
|
|
494
|
+
}
|
|
495
|
+
.font-sans {
|
|
496
|
+
font-family: var(--font-sans);
|
|
497
|
+
}
|
|
498
|
+
.text-sm {
|
|
499
|
+
font-size: var(--text-sm);
|
|
500
|
+
line-height: var(--tw-leading, var(--text-sm--line-height));
|
|
501
|
+
}
|
|
502
|
+
.text-\\[11px\\] {
|
|
503
|
+
font-size: 11px;
|
|
504
|
+
}
|
|
505
|
+
.leading-4 {
|
|
506
|
+
--tw-leading: calc(var(--spacing) * 4);
|
|
507
|
+
line-height: calc(var(--spacing) * 4);
|
|
508
|
+
}
|
|
509
|
+
.leading-5 {
|
|
510
|
+
--tw-leading: calc(var(--spacing) * 5);
|
|
511
|
+
line-height: calc(var(--spacing) * 5);
|
|
512
|
+
}
|
|
513
|
+
.font-semibold {
|
|
514
|
+
--tw-font-weight: var(--font-weight-semibold);
|
|
515
|
+
font-weight: var(--font-weight-semibold);
|
|
516
|
+
}
|
|
517
|
+
.tracking-\\[0\\.02em\\] {
|
|
518
|
+
--tw-tracking: 0.02em;
|
|
519
|
+
letter-spacing: 0.02em;
|
|
520
|
+
}
|
|
521
|
+
.text-error-strong {
|
|
522
|
+
color: var(--color-error-strong);
|
|
523
|
+
}
|
|
524
|
+
.text-info {
|
|
525
|
+
color: var(--color-info);
|
|
526
|
+
}
|
|
527
|
+
.text-success-strong {
|
|
528
|
+
color: var(--color-success-strong);
|
|
529
|
+
}
|
|
530
|
+
.text-text-primary {
|
|
531
|
+
color: var(--color-text-primary);
|
|
532
|
+
}
|
|
533
|
+
.text-text-secondary {
|
|
534
|
+
color: var(--color-text-secondary);
|
|
535
|
+
}
|
|
536
|
+
.text-warning-strong {
|
|
537
|
+
color: var(--color-warning-strong);
|
|
538
|
+
}
|
|
539
|
+
.shadow-popover {
|
|
540
|
+
--tw-shadow: inherit;
|
|
541
|
+
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
542
|
+
}
|
|
543
|
+
.\\[box-shadow\\:var\\(--shadow-popover\\)\\] {
|
|
544
|
+
box-shadow: var(--shadow-popover);
|
|
545
|
+
}
|
|
546
|
+
.transition-\\[scale\\,opacity\\] {
|
|
547
|
+
transition-property: scale,opacity;
|
|
548
|
+
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
549
|
+
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
550
|
+
}
|
|
551
|
+
.transition-opacity {
|
|
552
|
+
transition-property: opacity;
|
|
553
|
+
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
554
|
+
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
555
|
+
}
|
|
556
|
+
.duration-\\[var\\(--duration-quick\\)\\] {
|
|
557
|
+
--tw-duration: var(--duration-quick);
|
|
558
|
+
transition-duration: var(--duration-quick);
|
|
559
|
+
}
|
|
560
|
+
.ease-\\[var\\(--ease-standard\\)\\] {
|
|
561
|
+
--tw-ease: var(--ease-standard);
|
|
562
|
+
transition-timing-function: var(--ease-standard);
|
|
563
|
+
}
|
|
564
|
+
.outline-none {
|
|
565
|
+
--tw-outline-style: none;
|
|
566
|
+
outline-style: none;
|
|
567
|
+
}
|
|
568
|
+
.group-data-\\[behind\\]\\:opacity-0 {
|
|
569
|
+
&:is(:where(.group)[data-behind] *) {
|
|
570
|
+
opacity: 0%;
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
.data-\\[behind\\]\\:overflow-hidden {
|
|
574
|
+
&[data-behind] {
|
|
575
|
+
overflow: hidden;
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
.data-\\[buried\\]\\:pointer-events-none {
|
|
579
|
+
&[data-buried] {
|
|
580
|
+
pointer-events: none;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
.data-\\[buried\\]\\:opacity-0 {
|
|
584
|
+
&[data-buried] {
|
|
585
|
+
opacity: 0%;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
.motion-reduce\\:transition-none {
|
|
589
|
+
@media (prefers-reduced-motion: reduce) {
|
|
590
|
+
transition-property: none;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
.max-sm\\:right-4 {
|
|
594
|
+
@media (width < 40rem) {
|
|
595
|
+
right: calc(var(--spacing) * 4);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
.max-sm\\:bottom-4 {
|
|
599
|
+
@media (width < 40rem) {
|
|
600
|
+
bottom: calc(var(--spacing) * 4);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
.max-sm\\:max-h-\\[calc\\(100dvh-32px\\)\\] {
|
|
604
|
+
@media (width < 40rem) {
|
|
605
|
+
max-height: calc(100dvh - 32px);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
.max-sm\\:w-\\[calc\\(100vw-32px\\)\\] {
|
|
609
|
+
@media (width < 40rem) {
|
|
610
|
+
width: calc(100vw - 32px);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
.pointer-coarse\\:after\\:absolute {
|
|
614
|
+
@media (pointer: coarse) {
|
|
615
|
+
&::after {
|
|
616
|
+
content: var(--tw-content);
|
|
617
|
+
position: absolute;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
.pointer-coarse\\:after\\:-inset-1\\.5 {
|
|
622
|
+
@media (pointer: coarse) {
|
|
623
|
+
&::after {
|
|
624
|
+
content: var(--tw-content);
|
|
625
|
+
inset: calc(var(--spacing) * -1.5);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
.pointer-coarse\\:after\\:content-\\[\\'\\'\\] {
|
|
630
|
+
@media (pointer: coarse) {
|
|
631
|
+
&::after {
|
|
632
|
+
--tw-content: '';
|
|
633
|
+
content: var(--tw-content);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
@property --dsgn-border-sweep-angle {
|
|
639
|
+
syntax: '<angle>';
|
|
640
|
+
inherits: false;
|
|
641
|
+
initial-value: 0deg;
|
|
642
|
+
}
|
|
643
|
+
@property --tw-rotate-x {
|
|
644
|
+
syntax: "*";
|
|
645
|
+
inherits: false;
|
|
646
|
+
}
|
|
647
|
+
@property --tw-rotate-y {
|
|
648
|
+
syntax: "*";
|
|
649
|
+
inherits: false;
|
|
650
|
+
}
|
|
651
|
+
@property --tw-rotate-z {
|
|
652
|
+
syntax: "*";
|
|
653
|
+
inherits: false;
|
|
654
|
+
}
|
|
655
|
+
@property --tw-skew-x {
|
|
656
|
+
syntax: "*";
|
|
657
|
+
inherits: false;
|
|
658
|
+
}
|
|
659
|
+
@property --tw-skew-y {
|
|
660
|
+
syntax: "*";
|
|
661
|
+
inherits: false;
|
|
662
|
+
}
|
|
663
|
+
@property --tw-border-style {
|
|
664
|
+
syntax: "*";
|
|
665
|
+
inherits: false;
|
|
666
|
+
initial-value: solid;
|
|
667
|
+
}
|
|
668
|
+
@property --tw-leading {
|
|
669
|
+
syntax: "*";
|
|
670
|
+
inherits: false;
|
|
671
|
+
}
|
|
672
|
+
@property --tw-font-weight {
|
|
673
|
+
syntax: "*";
|
|
674
|
+
inherits: false;
|
|
675
|
+
}
|
|
676
|
+
@property --tw-tracking {
|
|
677
|
+
syntax: "*";
|
|
678
|
+
inherits: false;
|
|
679
|
+
}
|
|
680
|
+
@property --tw-shadow {
|
|
681
|
+
syntax: "*";
|
|
682
|
+
inherits: false;
|
|
683
|
+
initial-value: 0 0 #0000;
|
|
684
|
+
}
|
|
685
|
+
@property --tw-shadow-color {
|
|
686
|
+
syntax: "*";
|
|
687
|
+
inherits: false;
|
|
688
|
+
}
|
|
689
|
+
@property --tw-shadow-alpha {
|
|
690
|
+
syntax: "<percentage>";
|
|
691
|
+
inherits: false;
|
|
692
|
+
initial-value: 100%;
|
|
693
|
+
}
|
|
694
|
+
@property --tw-inset-shadow {
|
|
695
|
+
syntax: "*";
|
|
696
|
+
inherits: false;
|
|
697
|
+
initial-value: 0 0 #0000;
|
|
698
|
+
}
|
|
699
|
+
@property --tw-inset-shadow-color {
|
|
700
|
+
syntax: "*";
|
|
701
|
+
inherits: false;
|
|
702
|
+
}
|
|
703
|
+
@property --tw-inset-shadow-alpha {
|
|
704
|
+
syntax: "<percentage>";
|
|
705
|
+
inherits: false;
|
|
706
|
+
initial-value: 100%;
|
|
707
|
+
}
|
|
708
|
+
@property --tw-ring-color {
|
|
709
|
+
syntax: "*";
|
|
710
|
+
inherits: false;
|
|
711
|
+
}
|
|
712
|
+
@property --tw-ring-shadow {
|
|
713
|
+
syntax: "*";
|
|
714
|
+
inherits: false;
|
|
715
|
+
initial-value: 0 0 #0000;
|
|
716
|
+
}
|
|
717
|
+
@property --tw-inset-ring-color {
|
|
718
|
+
syntax: "*";
|
|
719
|
+
inherits: false;
|
|
720
|
+
}
|
|
721
|
+
@property --tw-inset-ring-shadow {
|
|
722
|
+
syntax: "*";
|
|
723
|
+
inherits: false;
|
|
724
|
+
initial-value: 0 0 #0000;
|
|
725
|
+
}
|
|
726
|
+
@property --tw-ring-inset {
|
|
727
|
+
syntax: "*";
|
|
728
|
+
inherits: false;
|
|
729
|
+
}
|
|
730
|
+
@property --tw-ring-offset-width {
|
|
731
|
+
syntax: "<length>";
|
|
732
|
+
inherits: false;
|
|
733
|
+
initial-value: 0px;
|
|
734
|
+
}
|
|
735
|
+
@property --tw-ring-offset-color {
|
|
736
|
+
syntax: "*";
|
|
737
|
+
inherits: false;
|
|
738
|
+
initial-value: #fff;
|
|
739
|
+
}
|
|
740
|
+
@property --tw-ring-offset-shadow {
|
|
741
|
+
syntax: "*";
|
|
742
|
+
inherits: false;
|
|
743
|
+
initial-value: 0 0 #0000;
|
|
744
|
+
}
|
|
745
|
+
@property --tw-duration {
|
|
746
|
+
syntax: "*";
|
|
747
|
+
inherits: false;
|
|
748
|
+
}
|
|
749
|
+
@property --tw-ease {
|
|
750
|
+
syntax: "*";
|
|
751
|
+
inherits: false;
|
|
752
|
+
}
|
|
753
|
+
@property --tw-content {
|
|
754
|
+
syntax: "*";
|
|
755
|
+
initial-value: "";
|
|
756
|
+
inherits: false;
|
|
757
|
+
}
|
|
758
|
+
@layer properties {
|
|
759
|
+
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
760
|
+
*, ::before, ::after, ::backdrop {
|
|
761
|
+
--tw-rotate-x: initial;
|
|
762
|
+
--tw-rotate-y: initial;
|
|
763
|
+
--tw-rotate-z: initial;
|
|
764
|
+
--tw-skew-x: initial;
|
|
765
|
+
--tw-skew-y: initial;
|
|
766
|
+
--tw-border-style: solid;
|
|
767
|
+
--tw-leading: initial;
|
|
768
|
+
--tw-font-weight: initial;
|
|
769
|
+
--tw-tracking: initial;
|
|
770
|
+
--tw-shadow: 0 0 #0000;
|
|
771
|
+
--tw-shadow-color: initial;
|
|
772
|
+
--tw-shadow-alpha: 100%;
|
|
773
|
+
--tw-inset-shadow: 0 0 #0000;
|
|
774
|
+
--tw-inset-shadow-color: initial;
|
|
775
|
+
--tw-inset-shadow-alpha: 100%;
|
|
776
|
+
--tw-ring-color: initial;
|
|
777
|
+
--tw-ring-shadow: 0 0 #0000;
|
|
778
|
+
--tw-inset-ring-color: initial;
|
|
779
|
+
--tw-inset-ring-shadow: 0 0 #0000;
|
|
780
|
+
--tw-ring-inset: initial;
|
|
781
|
+
--tw-ring-offset-width: 0px;
|
|
782
|
+
--tw-ring-offset-color: #fff;
|
|
783
|
+
--tw-ring-offset-shadow: 0 0 #0000;
|
|
784
|
+
--tw-duration: initial;
|
|
785
|
+
--tw-ease: initial;
|
|
786
|
+
--tw-content: "";
|
|
787
|
+
--dsgn-border-sweep-angle: 0deg;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
`;
|
|
792
|
+
var Toaster_default = styles2;
|
|
793
|
+
|
|
794
|
+
// components/Toaster/src/Toaster.props.ts
|
|
795
|
+
var TOASTER_MAX_VISIBLE = 3;
|
|
796
|
+
var toastDurations = {
|
|
797
|
+
[toastVariantValues.INFO]: 5000,
|
|
798
|
+
[toastVariantValues.SUCCESS]: 5000,
|
|
799
|
+
[toastVariantValues.WARNING]: 7000,
|
|
800
|
+
[toastVariantValues.ERROR]: 0
|
|
801
|
+
};
|
|
802
|
+
var TOAST_GAP = 8;
|
|
803
|
+
var TOAST_PEEK = 10;
|
|
804
|
+
var toastStackScales = [1, 0.94, 0.88];
|
|
805
|
+
var QUEUED_COUNT_TOKEN = "{count}";
|
|
806
|
+
|
|
807
|
+
// ../../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
808
|
+
function r(e) {
|
|
809
|
+
var t, f, n = "";
|
|
810
|
+
if (typeof e == "string" || typeof e == "number")
|
|
811
|
+
n += e;
|
|
812
|
+
else if (typeof e == "object")
|
|
813
|
+
if (Array.isArray(e)) {
|
|
814
|
+
var o = e.length;
|
|
815
|
+
for (t = 0;t < o; t++)
|
|
816
|
+
e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
817
|
+
} else
|
|
818
|
+
for (f in e)
|
|
819
|
+
e[f] && (n && (n += " "), n += f);
|
|
820
|
+
return n;
|
|
821
|
+
}
|
|
822
|
+
function clsx() {
|
|
823
|
+
for (var e, t, f = 0, n = "", o = arguments.length;f < o; f++)
|
|
824
|
+
(e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
825
|
+
return n;
|
|
826
|
+
}
|
|
827
|
+
var clsx_default = clsx;
|
|
828
|
+
|
|
829
|
+
// components/Toaster/src/Toaster.styles.ts
|
|
830
|
+
import { css as css3 } from "lit";
|
|
831
|
+
var hostStyles = css3`
|
|
832
|
+
:host {
|
|
833
|
+
display: contents;
|
|
834
|
+
}
|
|
835
|
+
`;
|
|
836
|
+
var regionClasses = (expanded) => clsx_default("fixed", "inset-auto", "z-50", "m-0", "p-0", "border-0", "bg-transparent", "overflow-visible", "bottom-6", "right-6", "w-[380px]", "max-sm:bottom-4", "max-sm:right-4", "max-sm:w-[calc(100vw-32px)]", "flex", "flex-col", "items-end", "gap-2", "font-sans", "text-text-primary", "pointer-events-none", "outline-none", expanded && [
|
|
837
|
+
"max-h-[calc(100dvh-48px)]",
|
|
838
|
+
"max-sm:max-h-[calc(100dvh-32px)]",
|
|
839
|
+
"overflow-y-auto"
|
|
840
|
+
]);
|
|
841
|
+
var liveRegionClasses = () => clsx_default("sr-only");
|
|
842
|
+
var queueClasses = () => clsx_default("shrink-0", "px-2.5", "py-[3px]", "rounded-full", "border", "border-popover-border", "bg-popover-bg", "font-mono", "text-[11px]", "leading-4", "tracking-[0.02em]", "text-text-secondary", "pointer-events-auto");
|
|
843
|
+
var listClasses = () => clsx_default("relative", "w-full", "shrink-0", "m-0", "p-0", "list-none", "pointer-events-auto");
|
|
844
|
+
var itemClasses = () => clsx_default("group", "absolute", "inset-x-0", "bottom-0", "origin-bottom", "rounded-lg", "transition-[scale,opacity]", "duration-[var(--duration-quick)]", "ease-[var(--ease-standard)]", "motion-reduce:transition-none", "data-[behind]:overflow-hidden", "data-[buried]:opacity-0", "data-[buried]:pointer-events-none");
|
|
845
|
+
var toastClasses = (compact) => clsx_default("relative", "overflow-hidden", "box-border", "flex", "gap-3", "pl-4", "pr-2", "border", "border-popover-border", "bg-popover-bg", "rounded-lg", "[box-shadow:var(--shadow-popover)]", "text-text-primary", compact ? ["items-center", "py-2.5"] : ["items-start", "py-3.5"]);
|
|
846
|
+
var behindHidden = [
|
|
847
|
+
"transition-opacity",
|
|
848
|
+
"duration-[var(--duration-quick)]",
|
|
849
|
+
"motion-reduce:transition-none",
|
|
850
|
+
"group-data-[behind]:opacity-0"
|
|
851
|
+
];
|
|
852
|
+
var iconColorClasses = {
|
|
853
|
+
[toastVariantValues.INFO]: "text-info",
|
|
854
|
+
[toastVariantValues.SUCCESS]: "text-success-strong",
|
|
855
|
+
[toastVariantValues.WARNING]: "text-warning-strong",
|
|
856
|
+
[toastVariantValues.ERROR]: "text-error-strong"
|
|
857
|
+
};
|
|
858
|
+
var iconClasses = (variant, compact) => clsx_default("size-5", "shrink-0", "fill-none", "stroke-current", "stroke-[1.75]", !compact && "mt-px", iconColorClasses[variant], behindHidden);
|
|
859
|
+
var bodyClasses = () => clsx_default("flex-1", "min-w-0", "flex", "flex-col", "gap-0.5", behindHidden);
|
|
860
|
+
var titleClasses = () => clsx_default("text-sm", "leading-5", "font-semibold", "text-text-primary");
|
|
861
|
+
var descriptionClasses = () => clsx_default("text-sm", "leading-5", "text-text-secondary");
|
|
862
|
+
var linksClasses = () => clsx_default("flex", "flex-wrap", "gap-x-4", "gap-y-1", "mt-1");
|
|
863
|
+
var actionsClasses = (inline) => clsx_default("flex", "flex-wrap", "gap-2", inline ? ["shrink-0", behindHidden] : "mt-2.5");
|
|
864
|
+
var touchTargetClasses = () => clsx_default("relative", "pointer-coarse:after:content-['']", "pointer-coarse:after:absolute", "pointer-coarse:after:-inset-1.5");
|
|
865
|
+
var dismissClasses = (compact) => clsx_default(touchTargetClasses(), "shrink-0", !compact && "-mt-1.5", behindHidden);
|
|
866
|
+
var barColorClasses = {
|
|
867
|
+
[toastVariantValues.INFO]: "bg-info",
|
|
868
|
+
[toastVariantValues.SUCCESS]: "bg-success",
|
|
869
|
+
[toastVariantValues.WARNING]: "bg-warning",
|
|
870
|
+
[toastVariantValues.ERROR]: "bg-error"
|
|
871
|
+
};
|
|
872
|
+
var progressClasses = (variant, paused) => clsx_default("absolute", "left-0", "bottom-0", "h-0.5", "w-full", "origin-left", paused ? "bg-outline-strong" : barColorClasses[variant]);
|
|
873
|
+
|
|
874
|
+
// components/Toaster/src/Toaster.ts
|
|
875
|
+
var variantIcons = {
|
|
876
|
+
[toastVariantValues.INFO]: info,
|
|
877
|
+
[toastVariantValues.SUCCESS]: circleCheck,
|
|
878
|
+
[toastVariantValues.WARNING]: triangleAlert,
|
|
879
|
+
[toastVariantValues.ERROR]: circleX
|
|
880
|
+
};
|
|
881
|
+
var supportsPopover = () => typeof HTMLElement !== "undefined" && ("popover" in HTMLElement.prototype);
|
|
882
|
+
var MAX_ANNOUNCEMENTS = 5;
|
|
883
|
+
var announcementText = ({ title, description }) => {
|
|
884
|
+
if (!description)
|
|
885
|
+
return title;
|
|
886
|
+
const stop = /[.!?…]$/.test(title.trim()) ? "" : ".";
|
|
887
|
+
return `${title.trim()}${stop} ${description}`;
|
|
888
|
+
};
|
|
889
|
+
|
|
890
|
+
class Toaster extends Base {
|
|
891
|
+
constructor() {
|
|
892
|
+
super(...arguments);
|
|
893
|
+
this.surface = surfaceValues.LIGHT;
|
|
894
|
+
this.maxVisible = TOASTER_MAX_VISIBLE;
|
|
895
|
+
this.label = "";
|
|
896
|
+
this.dismissLabel = "";
|
|
897
|
+
this.queuedLabel = "";
|
|
898
|
+
this.pausedLabel = "";
|
|
899
|
+
this._toasts = [];
|
|
900
|
+
this._hovered = false;
|
|
901
|
+
this._focused = false;
|
|
902
|
+
this._polite = [];
|
|
903
|
+
this._assertive = [];
|
|
904
|
+
this._motion = new MotionController(this);
|
|
905
|
+
this._topLayer = supportsPopover();
|
|
906
|
+
this._modals = [];
|
|
907
|
+
this._held = [];
|
|
908
|
+
this._settling = false;
|
|
909
|
+
this._settleRun = 0;
|
|
910
|
+
this._reraise = false;
|
|
911
|
+
this._entering = new Set;
|
|
912
|
+
this._handleToastEvent = (event) => {
|
|
913
|
+
if (event.defaultPrevented)
|
|
914
|
+
return;
|
|
915
|
+
const request = event.detail;
|
|
916
|
+
if (!request)
|
|
917
|
+
return;
|
|
918
|
+
event.preventDefault();
|
|
919
|
+
this._handle(request);
|
|
920
|
+
};
|
|
921
|
+
this._handleModalOpen = (event) => {
|
|
922
|
+
const modal = event.composedPath()[0];
|
|
923
|
+
this._modals = [...this._modals.filter((open) => open !== modal), modal];
|
|
924
|
+
this._reraise = true;
|
|
925
|
+
this.requestUpdate();
|
|
926
|
+
};
|
|
927
|
+
this._handleModalClose = (event) => {
|
|
928
|
+
const modal = event.composedPath()[0];
|
|
929
|
+
this._modals = this._modals.filter((open) => open !== modal);
|
|
930
|
+
this.requestUpdate();
|
|
931
|
+
};
|
|
932
|
+
}
|
|
933
|
+
static styles = [Base.styles, Toaster_default, hostStyles];
|
|
934
|
+
get _paused() {
|
|
935
|
+
return this._hovered || this._focused;
|
|
936
|
+
}
|
|
937
|
+
show(options) {
|
|
938
|
+
const id = nextToastId();
|
|
939
|
+
this._add(id, options);
|
|
940
|
+
return id;
|
|
941
|
+
}
|
|
942
|
+
dismiss(id) {
|
|
943
|
+
const records = (id === undefined ? [...this._toasts] : this._toasts.filter((record) => record.id === id)).sort((a, b) => Number(a.phase !== "queued") - Number(b.phase !== "queued"));
|
|
944
|
+
records.forEach((record) => this._dismiss(record, toastDismissReasonValues.PROGRAMMATIC));
|
|
945
|
+
}
|
|
946
|
+
connectedCallback() {
|
|
947
|
+
super.connectedCallback();
|
|
948
|
+
if (typeof document === "undefined")
|
|
949
|
+
return;
|
|
950
|
+
document.addEventListener(TOAST_EVENT, this._handleToastEvent);
|
|
951
|
+
document.addEventListener("dsgn-modal-open", this._handleModalOpen);
|
|
952
|
+
document.addEventListener("dsgn-modal-close", this._handleModalClose);
|
|
953
|
+
this._modals = [
|
|
954
|
+
...document.querySelectorAll("dsgn-modal[open]")
|
|
955
|
+
];
|
|
956
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
957
|
+
this._resize ??= new ResizeObserver(() => this._layout());
|
|
958
|
+
}
|
|
959
|
+
this._settle();
|
|
960
|
+
this._hovered = false;
|
|
961
|
+
this._focused = false;
|
|
962
|
+
this._syncTimers();
|
|
963
|
+
this.requestUpdate();
|
|
964
|
+
takePendingToasts().forEach((request) => this._handle(request));
|
|
965
|
+
}
|
|
966
|
+
disconnectedCallback() {
|
|
967
|
+
this._settleRun++;
|
|
968
|
+
document.removeEventListener(TOAST_EVENT, this._handleToastEvent);
|
|
969
|
+
document.removeEventListener("dsgn-modal-open", this._handleModalOpen);
|
|
970
|
+
document.removeEventListener("dsgn-modal-close", this._handleModalClose);
|
|
971
|
+
this._resize?.disconnect();
|
|
972
|
+
this._toasts.forEach((record) => this._stopTimer(record));
|
|
973
|
+
this._container?.remove();
|
|
974
|
+
super.disconnectedCallback();
|
|
975
|
+
}
|
|
976
|
+
willUpdate(changedProperties) {
|
|
977
|
+
if (changedProperties.has("maxVisible"))
|
|
978
|
+
this._promote();
|
|
979
|
+
}
|
|
980
|
+
updated(changedProperties) {
|
|
981
|
+
super.updated(changedProperties);
|
|
982
|
+
this.updateTheme(changedProperties, this.surface);
|
|
983
|
+
this._renderRegion();
|
|
984
|
+
}
|
|
985
|
+
render() {
|
|
986
|
+
return html2``;
|
|
987
|
+
}
|
|
988
|
+
_handle(request) {
|
|
989
|
+
if (request.type === "show") {
|
|
990
|
+
this._add(request.id, request.options);
|
|
991
|
+
} else {
|
|
992
|
+
this.dismiss(request.id);
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
_add(id, options) {
|
|
996
|
+
const variant = options.variant ?? toastVariantValues.INFO;
|
|
997
|
+
const duration = Math.max(0, options.duration ?? toastDurations[variant]);
|
|
998
|
+
this._toasts = [
|
|
999
|
+
...this._toasts,
|
|
1000
|
+
{
|
|
1001
|
+
id,
|
|
1002
|
+
options,
|
|
1003
|
+
variant,
|
|
1004
|
+
duration,
|
|
1005
|
+
phase: "queued",
|
|
1006
|
+
remaining: duration,
|
|
1007
|
+
startedAt: 0
|
|
1008
|
+
}
|
|
1009
|
+
];
|
|
1010
|
+
this._promote();
|
|
1011
|
+
}
|
|
1012
|
+
_promote() {
|
|
1013
|
+
let timedShowing = this._toasts.filter((record) => record.phase === "shown" && record.duration > 0).length;
|
|
1014
|
+
const limit = Math.max(1, this.maxVisible || TOASTER_MAX_VISIBLE);
|
|
1015
|
+
for (const record of this._toasts) {
|
|
1016
|
+
if (record.phase !== "queued")
|
|
1017
|
+
continue;
|
|
1018
|
+
if (record.duration > 0) {
|
|
1019
|
+
if (timedShowing >= limit)
|
|
1020
|
+
continue;
|
|
1021
|
+
timedShowing += 1;
|
|
1022
|
+
}
|
|
1023
|
+
this._reveal(record);
|
|
1024
|
+
}
|
|
1025
|
+
this.requestUpdate();
|
|
1026
|
+
}
|
|
1027
|
+
_reveal(record) {
|
|
1028
|
+
record.phase = "shown";
|
|
1029
|
+
this._entering.add(record.id);
|
|
1030
|
+
this._announce(record);
|
|
1031
|
+
this._startTimer(record);
|
|
1032
|
+
}
|
|
1033
|
+
_dismiss(record, reason) {
|
|
1034
|
+
if (record.phase === "leaving")
|
|
1035
|
+
return;
|
|
1036
|
+
const wasQueued = record.phase === "queued";
|
|
1037
|
+
this._stopTimer(record);
|
|
1038
|
+
record.phase = "leaving";
|
|
1039
|
+
this._withdraw(record.id);
|
|
1040
|
+
if (!wasQueued)
|
|
1041
|
+
this._moveFocusFrom(record);
|
|
1042
|
+
this.emit("dsgn-dismiss", { id: record.id, reason });
|
|
1043
|
+
record.options.onDismiss?.(reason);
|
|
1044
|
+
if (wasQueued) {
|
|
1045
|
+
this._remove(record);
|
|
1046
|
+
return;
|
|
1047
|
+
}
|
|
1048
|
+
this.requestUpdate();
|
|
1049
|
+
this.updateComplete.then(() => this._exit(record));
|
|
1050
|
+
}
|
|
1051
|
+
async _exit(record) {
|
|
1052
|
+
const card = this._cardFor(record.id);
|
|
1053
|
+
if (card)
|
|
1054
|
+
await this._motion.exit(card, "fade");
|
|
1055
|
+
this._remove(record);
|
|
1056
|
+
}
|
|
1057
|
+
_remove(record) {
|
|
1058
|
+
this._entering.delete(record.id);
|
|
1059
|
+
this._toasts = this._toasts.filter((other) => other !== record);
|
|
1060
|
+
this._promote();
|
|
1061
|
+
}
|
|
1062
|
+
_startTimer(record) {
|
|
1063
|
+
if (record.phase !== "shown" || record.duration <= 0)
|
|
1064
|
+
return;
|
|
1065
|
+
if (this._paused || record.timer)
|
|
1066
|
+
return;
|
|
1067
|
+
record.startedAt = Date.now();
|
|
1068
|
+
record.timer = setTimeout(() => {
|
|
1069
|
+
record.timer = undefined;
|
|
1070
|
+
this._dismiss(record, toastDismissReasonValues.TIMEOUT);
|
|
1071
|
+
}, record.remaining);
|
|
1072
|
+
record.bar?.play();
|
|
1073
|
+
}
|
|
1074
|
+
_stopTimer(record) {
|
|
1075
|
+
if (!record.timer)
|
|
1076
|
+
return;
|
|
1077
|
+
clearTimeout(record.timer);
|
|
1078
|
+
record.timer = undefined;
|
|
1079
|
+
record.remaining = Math.max(0, record.remaining - (Date.now() - record.startedAt));
|
|
1080
|
+
record.bar?.pause();
|
|
1081
|
+
}
|
|
1082
|
+
_syncTimers() {
|
|
1083
|
+
for (const record of this._toasts) {
|
|
1084
|
+
if (this._paused)
|
|
1085
|
+
this._stopTimer(record);
|
|
1086
|
+
else
|
|
1087
|
+
this._startTimer(record);
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
_startBar(record, bar) {
|
|
1091
|
+
if (record.bar || record.duration <= 0)
|
|
1092
|
+
return;
|
|
1093
|
+
if (typeof bar.animate !== "function")
|
|
1094
|
+
return;
|
|
1095
|
+
const from = record.remaining / record.duration;
|
|
1096
|
+
record.bar = bar.animate([{ transform: `scaleX(${from})` }, { transform: "scaleX(0)" }], { duration: record.remaining, easing: "linear", fill: "forwards" });
|
|
1097
|
+
if (!record.timer)
|
|
1098
|
+
record.bar.pause();
|
|
1099
|
+
}
|
|
1100
|
+
_handlePointerEnter() {
|
|
1101
|
+
this._hovered = true;
|
|
1102
|
+
this._syncTimers();
|
|
1103
|
+
}
|
|
1104
|
+
_handlePointerLeave() {
|
|
1105
|
+
this._hovered = false;
|
|
1106
|
+
this._syncTimers();
|
|
1107
|
+
}
|
|
1108
|
+
_handleFocusIn() {
|
|
1109
|
+
this._focused = true;
|
|
1110
|
+
this._syncTimers();
|
|
1111
|
+
}
|
|
1112
|
+
_handleFocusOut(event) {
|
|
1113
|
+
const region = event.currentTarget;
|
|
1114
|
+
const next = event.relatedTarget;
|
|
1115
|
+
if (next && region.contains(next))
|
|
1116
|
+
return;
|
|
1117
|
+
this._focused = false;
|
|
1118
|
+
this._syncTimers();
|
|
1119
|
+
}
|
|
1120
|
+
_moveFocusFrom(record) {
|
|
1121
|
+
const item = this._itemFor(record.id);
|
|
1122
|
+
const active = this._containerRoot?.activeElement;
|
|
1123
|
+
if (!item || !active || !item.contains(active))
|
|
1124
|
+
return;
|
|
1125
|
+
const others = this._stack().filter((other) => other !== record && other.phase === "shown");
|
|
1126
|
+
const index = this._stack().indexOf(record);
|
|
1127
|
+
const next = others.find((other) => this._stack().indexOf(other) > index) ?? [...others].reverse().find((other) => this._stack().indexOf(other) < index);
|
|
1128
|
+
const target = next ? this._itemFor(next.id)?.querySelector("[data-dismiss]") : this._region();
|
|
1129
|
+
(target ?? this._region())?.focus();
|
|
1130
|
+
}
|
|
1131
|
+
_announce(record) {
|
|
1132
|
+
const polite = record.variant !== toastVariantValues.ERROR;
|
|
1133
|
+
const announcement = {
|
|
1134
|
+
id: record.id,
|
|
1135
|
+
text: announcementText(record.options)
|
|
1136
|
+
};
|
|
1137
|
+
if (this._settling) {
|
|
1138
|
+
this._held.push({ polite, announcement });
|
|
1139
|
+
return;
|
|
1140
|
+
}
|
|
1141
|
+
this._write(polite, announcement);
|
|
1142
|
+
}
|
|
1143
|
+
_write(polite, announcement) {
|
|
1144
|
+
if (polite) {
|
|
1145
|
+
this._polite = [...this._polite, announcement].slice(-MAX_ANNOUNCEMENTS);
|
|
1146
|
+
} else {
|
|
1147
|
+
this._assertive = [...this._assertive, announcement].slice(-MAX_ANNOUNCEMENTS);
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
_withdraw(id) {
|
|
1151
|
+
this._held = this._held.filter(({ announcement }) => announcement.id !== id);
|
|
1152
|
+
this._polite = this._polite.filter((entry) => entry.id !== id);
|
|
1153
|
+
this._assertive = this._assertive.filter((entry) => entry.id !== id);
|
|
1154
|
+
}
|
|
1155
|
+
_settle() {
|
|
1156
|
+
this._settling = true;
|
|
1157
|
+
const run = ++this._settleRun;
|
|
1158
|
+
const release = () => {
|
|
1159
|
+
if (run !== this._settleRun || !this.isConnected)
|
|
1160
|
+
return;
|
|
1161
|
+
this._settling = false;
|
|
1162
|
+
const held = this._held;
|
|
1163
|
+
this._held = [];
|
|
1164
|
+
held.forEach(({ polite, announcement }) => this._write(polite, announcement));
|
|
1165
|
+
};
|
|
1166
|
+
this.updateComplete.then(() => setTimeout(release, 0));
|
|
1167
|
+
}
|
|
1168
|
+
_modalHome() {
|
|
1169
|
+
this._modals = this._modals.filter((modal) => modal.isConnected && modal.hasAttribute("open"));
|
|
1170
|
+
return this._modals.at(-1);
|
|
1171
|
+
}
|
|
1172
|
+
_place() {
|
|
1173
|
+
if (!this._container || !this._containerRoot) {
|
|
1174
|
+
const container2 = document.createElement("div");
|
|
1175
|
+
container2.setAttribute("data-dsgn-toaster", "");
|
|
1176
|
+
const root = container2.attachShadow({ mode: "open" });
|
|
1177
|
+
adoptStyles(root, this.constructor.elementStyles);
|
|
1178
|
+
this._container = container2;
|
|
1179
|
+
this._containerRoot = root;
|
|
1180
|
+
}
|
|
1181
|
+
const container = this._container;
|
|
1182
|
+
container.setAttribute("data-theme", this.surface);
|
|
1183
|
+
const home = this._modalHome();
|
|
1184
|
+
const parent = home ?? document.body;
|
|
1185
|
+
if (container.parentNode !== parent) {
|
|
1186
|
+
const hadRegion = container.isConnected;
|
|
1187
|
+
if (home)
|
|
1188
|
+
container.slot = "toaster";
|
|
1189
|
+
else
|
|
1190
|
+
container.removeAttribute("slot");
|
|
1191
|
+
parent.append(container);
|
|
1192
|
+
if (hadRegion)
|
|
1193
|
+
this._settle();
|
|
1194
|
+
}
|
|
1195
|
+
return this._containerRoot;
|
|
1196
|
+
}
|
|
1197
|
+
_raise() {
|
|
1198
|
+
const region = this._region();
|
|
1199
|
+
if (!this._topLayer || !region?.isConnected)
|
|
1200
|
+
return;
|
|
1201
|
+
try {
|
|
1202
|
+
if (region.matches(":popover-open")) {
|
|
1203
|
+
if (!this._reraise)
|
|
1204
|
+
return;
|
|
1205
|
+
region.hidePopover();
|
|
1206
|
+
}
|
|
1207
|
+
region.showPopover();
|
|
1208
|
+
} catch {} finally {
|
|
1209
|
+
this._reraise = false;
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
_stack() {
|
|
1213
|
+
return this._toasts.filter((record) => record.phase !== "queued").reverse();
|
|
1214
|
+
}
|
|
1215
|
+
_region() {
|
|
1216
|
+
return this._containerRoot?.querySelector('[part="region"]') ?? null;
|
|
1217
|
+
}
|
|
1218
|
+
_itemFor(id) {
|
|
1219
|
+
return this._containerRoot?.querySelector(`li[data-id="${id}"]`) ?? null;
|
|
1220
|
+
}
|
|
1221
|
+
_cardFor(id) {
|
|
1222
|
+
return this._itemFor(id)?.querySelector('[part="toast"]') ?? null;
|
|
1223
|
+
}
|
|
1224
|
+
_layout() {
|
|
1225
|
+
const list = this._containerRoot?.querySelector('[part="list"]');
|
|
1226
|
+
if (!list)
|
|
1227
|
+
return;
|
|
1228
|
+
const stack = this._stack();
|
|
1229
|
+
const items = stack.map((record) => this._itemFor(record.id));
|
|
1230
|
+
const heights = items.map((item) => item?.querySelector('[part="toast"]')?.offsetHeight ?? 0);
|
|
1231
|
+
const expanded = this._paused;
|
|
1232
|
+
const frontHeight = heights[0] ?? 0;
|
|
1233
|
+
const before = items.map((item) => item?.getBoundingClientRect().bottom);
|
|
1234
|
+
let offset = 0;
|
|
1235
|
+
items.forEach((item, index) => {
|
|
1236
|
+
if (!item)
|
|
1237
|
+
return;
|
|
1238
|
+
const depth = Math.min(index, toastStackScales.length - 1);
|
|
1239
|
+
const y = expanded ? -offset : -depth * TOAST_PEEK;
|
|
1240
|
+
const scale = expanded ? 1 : toastStackScales[depth];
|
|
1241
|
+
offset += heights[index] + TOAST_GAP;
|
|
1242
|
+
item.style.setProperty("translate", `0 ${y}px`);
|
|
1243
|
+
item.style.setProperty("scale", String(scale));
|
|
1244
|
+
item.style.setProperty("z-index", String(stack.length - index));
|
|
1245
|
+
const behind = !expanded && index > 0;
|
|
1246
|
+
item.toggleAttribute("data-behind", behind);
|
|
1247
|
+
item.toggleAttribute("data-buried", !expanded && index >= toastStackScales.length);
|
|
1248
|
+
if (behind)
|
|
1249
|
+
item.style.setProperty("height", `${frontHeight}px`);
|
|
1250
|
+
else
|
|
1251
|
+
item.style.removeProperty("height");
|
|
1252
|
+
});
|
|
1253
|
+
const peeks = Math.min(stack.length, toastStackScales.length) - 1;
|
|
1254
|
+
const height = expanded ? Math.max(0, offset - TOAST_GAP) : frontHeight + Math.max(0, peeks) * TOAST_PEEK;
|
|
1255
|
+
list.style.setProperty("height", `${height}px`);
|
|
1256
|
+
items.forEach((item, index) => {
|
|
1257
|
+
const record = stack[index];
|
|
1258
|
+
const was = before[index];
|
|
1259
|
+
if (!item || was === undefined || this._entering.has(record.id))
|
|
1260
|
+
return;
|
|
1261
|
+
const delta = was - item.getBoundingClientRect().bottom;
|
|
1262
|
+
if (Math.abs(delta) < 0.5)
|
|
1263
|
+
return;
|
|
1264
|
+
this._motion.enter(item, "slideInBottom", {
|
|
1265
|
+
y: delta,
|
|
1266
|
+
duration: "quick",
|
|
1267
|
+
easing: "standard",
|
|
1268
|
+
reducedMotion: "jump"
|
|
1269
|
+
});
|
|
1270
|
+
});
|
|
1271
|
+
}
|
|
1272
|
+
_renderRegion() {
|
|
1273
|
+
if (typeof document === "undefined" || !this.isConnected)
|
|
1274
|
+
return;
|
|
1275
|
+
const root = this._place();
|
|
1276
|
+
render(this._regionTemplate(), root, { host: this });
|
|
1277
|
+
this._raise();
|
|
1278
|
+
this._observeCards(root);
|
|
1279
|
+
this._layout();
|
|
1280
|
+
this._startEntrances();
|
|
1281
|
+
}
|
|
1282
|
+
_observeCards(root) {
|
|
1283
|
+
if (!this._resize)
|
|
1284
|
+
return;
|
|
1285
|
+
this._resize.disconnect();
|
|
1286
|
+
root.querySelectorAll('[part="toast"]').forEach((card) => this._resize.observe(card));
|
|
1287
|
+
}
|
|
1288
|
+
_startEntrances() {
|
|
1289
|
+
for (const id of this._entering) {
|
|
1290
|
+
const card = this._cardFor(id);
|
|
1291
|
+
if (!card)
|
|
1292
|
+
continue;
|
|
1293
|
+
this._entering.delete(id);
|
|
1294
|
+
this._motion.enter(card, "slideUp", { y: 8 });
|
|
1295
|
+
}
|
|
1296
|
+
for (const record of this._toasts) {
|
|
1297
|
+
const bar = this._itemFor(record.id)?.querySelector('[part="progress"]');
|
|
1298
|
+
if (bar)
|
|
1299
|
+
this._startBar(record, bar);
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
_queueText(queued) {
|
|
1303
|
+
const parts = [];
|
|
1304
|
+
if (queued > 0) {
|
|
1305
|
+
parts.push(this.queuedLabel ? this.queuedLabel.replaceAll(QUEUED_COUNT_TOKEN, String(queued)) : `+${queued}`);
|
|
1306
|
+
}
|
|
1307
|
+
if (this._paused && this.pausedLabel && this._stack().length > 0) {
|
|
1308
|
+
parts.push(this.pausedLabel);
|
|
1309
|
+
}
|
|
1310
|
+
return parts.join(" · ");
|
|
1311
|
+
}
|
|
1312
|
+
_regionTemplate() {
|
|
1313
|
+
const stack = this._stack();
|
|
1314
|
+
const queued = this._toasts.filter((record) => record.phase === "queued").length;
|
|
1315
|
+
const queueText = this._queueText(queued);
|
|
1316
|
+
return html2`
|
|
1317
|
+
<section
|
|
1318
|
+
part="region"
|
|
1319
|
+
class=${regionClasses(this._paused)}
|
|
1320
|
+
aria-label=${this.label || nothing}
|
|
1321
|
+
tabindex="-1"
|
|
1322
|
+
popover=${this._topLayer ? "manual" : nothing}
|
|
1323
|
+
@pointerenter=${this._handlePointerEnter}
|
|
1324
|
+
@pointerleave=${this._handlePointerLeave}
|
|
1325
|
+
@focusin=${this._handleFocusIn}
|
|
1326
|
+
@focusout=${this._handleFocusOut}
|
|
1327
|
+
>
|
|
1328
|
+
<div
|
|
1329
|
+
role="status"
|
|
1330
|
+
aria-live="polite"
|
|
1331
|
+
aria-atomic="false"
|
|
1332
|
+
class=${liveRegionClasses()}
|
|
1333
|
+
>
|
|
1334
|
+
${repeat(this._polite, ({ id }) => id, ({ text }) => html2`<p>${text}</p>`)}
|
|
1335
|
+
</div>
|
|
1336
|
+
<div
|
|
1337
|
+
role="alert"
|
|
1338
|
+
aria-live="assertive"
|
|
1339
|
+
aria-atomic="false"
|
|
1340
|
+
class=${liveRegionClasses()}
|
|
1341
|
+
>
|
|
1342
|
+
${repeat(this._assertive, ({ id }) => id, ({ text }) => html2`<p>${text}</p>`)}
|
|
1343
|
+
</div>
|
|
1344
|
+
${queueText ? html2`<div part="queue" class=${queueClasses()} aria-hidden="true">
|
|
1345
|
+
${queueText}
|
|
1346
|
+
</div>` : nothing}
|
|
1347
|
+
${stack.length ? html2`<ol part="list" class=${listClasses()}>
|
|
1348
|
+
${repeat([...stack].reverse(), (record) => record.id, (record) => this._toastTemplate(record))}
|
|
1349
|
+
</ol>` : nothing}
|
|
1350
|
+
</section>
|
|
1351
|
+
`;
|
|
1352
|
+
}
|
|
1353
|
+
_toastTemplate(record) {
|
|
1354
|
+
const { options, variant } = record;
|
|
1355
|
+
const actions = (options.actions ?? []).slice(0, 2);
|
|
1356
|
+
const links = options.links ?? [];
|
|
1357
|
+
const compact = !options.description && links.length === 0;
|
|
1358
|
+
const custom = options.icon ? Icon.resolve(options.icon) : undefined;
|
|
1359
|
+
const icon = custom ?? variantIcons[variant];
|
|
1360
|
+
const iconName = custom ? options.icon : variant;
|
|
1361
|
+
const leaving = record.phase === "leaving";
|
|
1362
|
+
return html2`
|
|
1363
|
+
<li
|
|
1364
|
+
class=${itemClasses()}
|
|
1365
|
+
data-id=${record.id}
|
|
1366
|
+
data-variant=${variant}
|
|
1367
|
+
?inert=${leaving}
|
|
1368
|
+
>
|
|
1369
|
+
<div part="toast" class=${toastClasses(compact)}>
|
|
1370
|
+
${this._iconTemplate(icon, iconName, variant, compact)}
|
|
1371
|
+
${this._bodyTemplate(record, actions, links, compact)}
|
|
1372
|
+
${actions.length && compact ? this._actionsTemplate(record, actions, true) : nothing}
|
|
1373
|
+
<dsgn-button
|
|
1374
|
+
part="dismiss"
|
|
1375
|
+
data-dismiss
|
|
1376
|
+
class=${dismissClasses(compact)}
|
|
1377
|
+
.surface=${this.surface}
|
|
1378
|
+
.appearance=${buttonAppearanceValues.GHOST}
|
|
1379
|
+
.size=${buttonSizeValues.SM}
|
|
1380
|
+
.icon=${x}
|
|
1381
|
+
.iconPosition=${buttonIconPositionValues.ONLY}
|
|
1382
|
+
aria-label=${this.dismissLabel || nothing}
|
|
1383
|
+
@click=${() => this._dismiss(record, toastDismissReasonValues.CLOSE)}
|
|
1384
|
+
></dsgn-button>
|
|
1385
|
+
${record.duration > 0 ? html2`<div
|
|
1386
|
+
part="progress"
|
|
1387
|
+
class=${progressClasses(variant, this._paused)}
|
|
1388
|
+
aria-hidden="true"
|
|
1389
|
+
></div>` : nothing}
|
|
1390
|
+
</div>
|
|
1391
|
+
</li>
|
|
1392
|
+
`;
|
|
1393
|
+
}
|
|
1394
|
+
_bodyTemplate(record, actions, links, compact) {
|
|
1395
|
+
const { options } = record;
|
|
1396
|
+
return html2`
|
|
1397
|
+
<div class=${bodyClasses()}>
|
|
1398
|
+
<p part="title" class=${titleClasses()}>${options.title}</p>
|
|
1399
|
+
${options.description ? html2`<p part="description" class=${descriptionClasses()}>
|
|
1400
|
+
${options.description}
|
|
1401
|
+
</p>` : nothing}
|
|
1402
|
+
${links.length ? html2`<div part="links" class=${linksClasses()}>
|
|
1403
|
+
${links.map((link) => this._linkTemplate(link))}
|
|
1404
|
+
</div>` : nothing}
|
|
1405
|
+
${actions.length && !compact ? this._actionsTemplate(record, actions, false) : nothing}
|
|
1406
|
+
</div>
|
|
1407
|
+
`;
|
|
1408
|
+
}
|
|
1409
|
+
_iconTemplate(icon, name, variant, compact) {
|
|
1410
|
+
return html2`<svg
|
|
1411
|
+
part="icon"
|
|
1412
|
+
data-icon=${name}
|
|
1413
|
+
class="${iconClasses(variant, compact)}"
|
|
1414
|
+
viewBox="0 0 24 24"
|
|
1415
|
+
stroke-linecap="round"
|
|
1416
|
+
stroke-linejoin="round"
|
|
1417
|
+
aria-hidden="true"
|
|
1418
|
+
>
|
|
1419
|
+
${icon}
|
|
1420
|
+
</svg>`;
|
|
1421
|
+
}
|
|
1422
|
+
_actionsTemplate(record, actions, inline) {
|
|
1423
|
+
return html2`<div part="actions" class=${actionsClasses(inline)}>
|
|
1424
|
+
${actions.map((action, index) => {
|
|
1425
|
+
const appearance = action.appearance ?? (actions.length > 1 && index === 0 ? toastActionAppearanceValues.PRIMARY : toastActionAppearanceValues.SECONDARY);
|
|
1426
|
+
return html2`<dsgn-button
|
|
1427
|
+
part="action"
|
|
1428
|
+
class=${touchTargetClasses()}
|
|
1429
|
+
.surface=${this.surface}
|
|
1430
|
+
.size=${buttonSizeValues.SM}
|
|
1431
|
+
.appearance=${appearance === toastActionAppearanceValues.PRIMARY ? buttonAppearanceValues.SOLID : buttonAppearanceValues.OUTLINE}
|
|
1432
|
+
@click=${() => {
|
|
1433
|
+
action.onClick?.();
|
|
1434
|
+
this._dismiss(record, toastDismissReasonValues.ACTION);
|
|
1435
|
+
}}
|
|
1436
|
+
>${action.label}</dsgn-button
|
|
1437
|
+
>`;
|
|
1438
|
+
})}
|
|
1439
|
+
</div>`;
|
|
1440
|
+
}
|
|
1441
|
+
_linkTemplate(link) {
|
|
1442
|
+
return html2`<dsgn-button
|
|
1443
|
+
class=${touchTargetClasses()}
|
|
1444
|
+
.surface=${this.surface}
|
|
1445
|
+
.size=${buttonSizeValues.SM}
|
|
1446
|
+
.appearance=${buttonAppearanceValues.INLINE}
|
|
1447
|
+
.href=${link.href ?? ""}
|
|
1448
|
+
@click=${() => link.onClick?.()}
|
|
1449
|
+
>${link.label}</dsgn-button
|
|
1450
|
+
>`;
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
__legacyDecorateClassTS([
|
|
1454
|
+
property({ ...surfaceProps })
|
|
1455
|
+
], Toaster.prototype, "surface", undefined);
|
|
1456
|
+
__legacyDecorateClassTS([
|
|
1457
|
+
property({ type: Number, attribute: "max-visible" })
|
|
1458
|
+
], Toaster.prototype, "maxVisible", undefined);
|
|
1459
|
+
__legacyDecorateClassTS([
|
|
1460
|
+
property({ type: String })
|
|
1461
|
+
], Toaster.prototype, "label", undefined);
|
|
1462
|
+
__legacyDecorateClassTS([
|
|
1463
|
+
property({ type: String, attribute: "dismiss-label" })
|
|
1464
|
+
], Toaster.prototype, "dismissLabel", undefined);
|
|
1465
|
+
__legacyDecorateClassTS([
|
|
1466
|
+
property({ type: String, attribute: "queued-label" })
|
|
1467
|
+
], Toaster.prototype, "queuedLabel", undefined);
|
|
1468
|
+
__legacyDecorateClassTS([
|
|
1469
|
+
property({ type: String, attribute: "paused-label" })
|
|
1470
|
+
], Toaster.prototype, "pausedLabel", undefined);
|
|
1471
|
+
__legacyDecorateClassTS([
|
|
1472
|
+
state()
|
|
1473
|
+
], Toaster.prototype, "_toasts", undefined);
|
|
1474
|
+
__legacyDecorateClassTS([
|
|
1475
|
+
state()
|
|
1476
|
+
], Toaster.prototype, "_hovered", undefined);
|
|
1477
|
+
__legacyDecorateClassTS([
|
|
1478
|
+
state()
|
|
1479
|
+
], Toaster.prototype, "_focused", undefined);
|
|
1480
|
+
__legacyDecorateClassTS([
|
|
1481
|
+
state()
|
|
1482
|
+
], Toaster.prototype, "_polite", undefined);
|
|
1483
|
+
__legacyDecorateClassTS([
|
|
1484
|
+
state()
|
|
1485
|
+
], Toaster.prototype, "_assertive", undefined);
|
|
1486
|
+
defineElement("dsgn-toaster", Toaster);
|
|
1487
|
+
export {
|
|
1488
|
+
Toaster
|
|
1489
|
+
};
|