@sidebandai/sideband-react 1.4.5-rc.4 → 1.4.5
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.
|
@@ -2,11 +2,126 @@ import { buildFabTitle as e, getChoiceValue as t, isPositiveSentimentChoice as n
|
|
|
2
2
|
import { memo as a, useCallback as o, useEffect as s, useId as c, useLayoutEffect as l, useRef as u, useState as d, useSyncExternalStore as f } from "react";
|
|
3
3
|
import { createPortal as p } from "react-dom";
|
|
4
4
|
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
5
|
+
function _(e, t) {
|
|
6
|
+
let n = !1, r = null, i = null, a = null, o = Date.now(), s = () => {
|
|
7
|
+
n = !0, r?.disconnect(), r = null, i !== null && clearInterval(i), i = null, document.removeEventListener("visibilitychange", l);
|
|
8
|
+
}, c = () => a === null ? r && Date.now() - o < 1e3 ? !1 : y(e) : a;
|
|
9
|
+
function l() {
|
|
10
|
+
n || !v(e) || !c() || (s(), t());
|
|
11
|
+
}
|
|
12
|
+
return typeof IntersectionObserver < "u" && (r = new IntersectionObserver((e) => {
|
|
13
|
+
let t = e[e.length - 1];
|
|
14
|
+
t && (a = t.isIntersecting), l();
|
|
15
|
+
}), r.observe(e)), l(), n ? s : (document.addEventListener("visibilitychange", l), i = setInterval(l, 200), s);
|
|
16
|
+
}
|
|
17
|
+
function v(e) {
|
|
18
|
+
if (!e.isConnected) return !1;
|
|
19
|
+
for (let t of [e, ...T(e)]) {
|
|
20
|
+
let e = t.ownerDocument.defaultView;
|
|
21
|
+
if (!e || t.ownerDocument.visibilityState === "hidden" || !w(t, e)) return !1;
|
|
22
|
+
}
|
|
23
|
+
return !0;
|
|
24
|
+
}
|
|
25
|
+
function y(e) {
|
|
26
|
+
let t = e, n = b(e.getBoundingClientRect());
|
|
27
|
+
for (;;) {
|
|
28
|
+
if (n = x(t, n), !n) return !1;
|
|
29
|
+
let e = E(t);
|
|
30
|
+
if (!e) return !0;
|
|
31
|
+
let r = e.getBoundingClientRect();
|
|
32
|
+
if (n = C({
|
|
33
|
+
left: n.left + r.left,
|
|
34
|
+
right: n.right + r.left,
|
|
35
|
+
top: n.top + r.top,
|
|
36
|
+
bottom: n.bottom + r.top
|
|
37
|
+
}, b(r)), !n) return !1;
|
|
38
|
+
t = e;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
var b = (e) => ({
|
|
42
|
+
left: e.left,
|
|
43
|
+
top: e.top,
|
|
44
|
+
right: e.right,
|
|
45
|
+
bottom: e.bottom
|
|
46
|
+
});
|
|
47
|
+
function x(e, t) {
|
|
48
|
+
let n = e.ownerDocument.defaultView;
|
|
49
|
+
if (!n) return null;
|
|
50
|
+
let r = e.ownerDocument, i = S(n.getComputedStyle(r.documentElement)), a = !i.x && !i.y, o = n.getComputedStyle(e).position === "fixed", s = t;
|
|
51
|
+
for (let t = D(e); t && s; t = D(t)) {
|
|
52
|
+
if (t === r.documentElement || t === r.body && a) continue;
|
|
53
|
+
let e = n.getComputedStyle(t);
|
|
54
|
+
if (!o) {
|
|
55
|
+
let { x: n, y: r } = S(e);
|
|
56
|
+
if (n || r) {
|
|
57
|
+
let e = b(t.getBoundingClientRect());
|
|
58
|
+
s = C(s, {
|
|
59
|
+
left: n ? e.left : -Infinity,
|
|
60
|
+
right: n ? e.right : Infinity,
|
|
61
|
+
top: r ? e.top : -Infinity,
|
|
62
|
+
bottom: r ? e.bottom : Infinity
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
e.position === "fixed" && (o = !0);
|
|
67
|
+
}
|
|
68
|
+
if (!s) return null;
|
|
69
|
+
let c = n.innerWidth || e.ownerDocument.documentElement.clientWidth, l = n.innerHeight || e.ownerDocument.documentElement.clientHeight;
|
|
70
|
+
return C(s, {
|
|
71
|
+
left: 0,
|
|
72
|
+
top: 0,
|
|
73
|
+
right: c,
|
|
74
|
+
bottom: l
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function S(e) {
|
|
78
|
+
let t = (e) => e !== "" && e !== "visible";
|
|
79
|
+
return {
|
|
80
|
+
x: t(e.overflowX || e.overflow),
|
|
81
|
+
y: t(e.overflowY || e.overflow)
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function C(e, t) {
|
|
85
|
+
let n = {
|
|
86
|
+
left: Math.max(e.left, t.left),
|
|
87
|
+
top: Math.max(e.top, t.top),
|
|
88
|
+
right: Math.min(e.right, t.right),
|
|
89
|
+
bottom: Math.min(e.bottom, t.bottom)
|
|
90
|
+
};
|
|
91
|
+
return n.left <= n.right && n.top <= n.bottom ? n : null;
|
|
92
|
+
}
|
|
93
|
+
function w(e, t) {
|
|
94
|
+
let n = e;
|
|
95
|
+
if (typeof n.checkVisibility == "function") return n.checkVisibility({ visibilityProperty: !0 }) && e.offsetWidth > 0 && e.offsetHeight > 0;
|
|
96
|
+
if (t.getComputedStyle(e).visibility === "hidden") return !1;
|
|
97
|
+
for (let n = e; n; n = D(n)) if (t.getComputedStyle(n).display === "none") return !1;
|
|
98
|
+
return !0;
|
|
99
|
+
}
|
|
100
|
+
function T(e) {
|
|
101
|
+
let t = [];
|
|
102
|
+
for (let n = E(e); n; n = E(n)) t.push(n);
|
|
103
|
+
return t;
|
|
104
|
+
}
|
|
105
|
+
function E(e) {
|
|
106
|
+
let t = e.ownerDocument.defaultView;
|
|
107
|
+
if (!t || t.parent === t) return null;
|
|
108
|
+
try {
|
|
109
|
+
return t.frameElement;
|
|
110
|
+
} catch {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function D(e) {
|
|
115
|
+
if (e.parentElement) return e.parentElement;
|
|
116
|
+
let t = e.getRootNode();
|
|
117
|
+
return t !== e.ownerDocument && t.host ? t.host : null;
|
|
118
|
+
}
|
|
119
|
+
//#endregion
|
|
5
120
|
//#region ../design-tokens/src/index.ts
|
|
6
|
-
var
|
|
121
|
+
var O = "rgba(0, 0, 0, 0)", k = (e, t = 1) => ({
|
|
7
122
|
hex: e,
|
|
8
123
|
alpha: t
|
|
9
|
-
}),
|
|
124
|
+
}), A = (e, t) => [
|
|
10
125
|
{
|
|
11
126
|
variable: `--sb-theme-choice-${e}-background`,
|
|
12
127
|
path: [
|
|
@@ -34,7 +149,7 @@ var _ = "rgba(0, 0, 0, 0)", v = (e, t = 1) => ({
|
|
|
34
149
|
],
|
|
35
150
|
fallback: t[2]
|
|
36
151
|
}
|
|
37
|
-
],
|
|
152
|
+
], j = (e, t) => [
|
|
38
153
|
{
|
|
39
154
|
variable: `--sb-theme-button-${e}-foreground`,
|
|
40
155
|
path: [
|
|
@@ -89,219 +204,219 @@ var _ = "rgba(0, 0, 0, 0)", v = (e, t = 1) => ({
|
|
|
89
204
|
],
|
|
90
205
|
fallback: t[5]
|
|
91
206
|
}
|
|
92
|
-
],
|
|
207
|
+
], M = [
|
|
93
208
|
{
|
|
94
209
|
variable: "--sb-theme-sheet-background",
|
|
95
210
|
path: ["sheet", "background"],
|
|
96
|
-
fallback:
|
|
211
|
+
fallback: k("#FFFFFF")
|
|
97
212
|
},
|
|
98
213
|
{
|
|
99
214
|
variable: "--sb-theme-sheet-scrim",
|
|
100
215
|
path: ["sheet", "scrim"],
|
|
101
|
-
fallback:
|
|
216
|
+
fallback: k("#000000", .5)
|
|
102
217
|
},
|
|
103
218
|
{
|
|
104
219
|
variable: "--sb-theme-sheet-divider",
|
|
105
220
|
path: ["sheet", "divider"],
|
|
106
|
-
fallback:
|
|
221
|
+
fallback: k("#E5E5E5")
|
|
107
222
|
},
|
|
108
223
|
{
|
|
109
224
|
variable: "--sb-theme-sheet-progress-track",
|
|
110
225
|
path: ["sheet", "progressTrack"],
|
|
111
|
-
fallback:
|
|
226
|
+
fallback: k("#000000", .12)
|
|
112
227
|
},
|
|
113
228
|
{
|
|
114
229
|
variable: "--sb-theme-sheet-progress-fill",
|
|
115
230
|
path: ["sheet", "progressFill"],
|
|
116
|
-
fallback:
|
|
231
|
+
fallback: k("#000000")
|
|
117
232
|
},
|
|
118
233
|
{
|
|
119
234
|
variable: "--sb-theme-sheet-close-button-background",
|
|
120
235
|
path: ["sheet", "closeButtonBackground"],
|
|
121
|
-
fallback:
|
|
236
|
+
fallback: k("#000000", 0)
|
|
122
237
|
},
|
|
123
238
|
{
|
|
124
239
|
variable: "--sb-theme-sheet-close-button-foreground",
|
|
125
240
|
path: ["sheet", "closeButtonForeground"],
|
|
126
|
-
fallback:
|
|
241
|
+
fallback: k("#000000")
|
|
127
242
|
},
|
|
128
243
|
{
|
|
129
244
|
variable: "--sb-theme-content-heading",
|
|
130
245
|
path: ["content", "heading"],
|
|
131
|
-
fallback:
|
|
246
|
+
fallback: k("#000000")
|
|
132
247
|
},
|
|
133
248
|
{
|
|
134
249
|
variable: "--sb-theme-content-body",
|
|
135
250
|
path: ["content", "body"],
|
|
136
|
-
fallback:
|
|
251
|
+
fallback: k("#333030")
|
|
137
252
|
},
|
|
138
253
|
{
|
|
139
254
|
variable: "--sb-theme-content-helper",
|
|
140
255
|
path: ["content", "helper"],
|
|
141
|
-
fallback:
|
|
256
|
+
fallback: k("#5C5C5C")
|
|
142
257
|
},
|
|
143
258
|
{
|
|
144
259
|
variable: "--sb-theme-content-error",
|
|
145
260
|
path: ["content", "error"],
|
|
146
|
-
fallback:
|
|
261
|
+
fallback: k("#B42318")
|
|
147
262
|
},
|
|
148
263
|
{
|
|
149
264
|
variable: "--sb-theme-completion-outer-background",
|
|
150
265
|
path: ["completion", "outerBackground"],
|
|
151
|
-
fallback:
|
|
266
|
+
fallback: k("#E8E8E8")
|
|
152
267
|
},
|
|
153
268
|
{
|
|
154
269
|
variable: "--sb-theme-completion-inner-background",
|
|
155
270
|
path: ["completion", "innerBackground"],
|
|
156
|
-
fallback:
|
|
271
|
+
fallback: k("#000000")
|
|
157
272
|
},
|
|
158
273
|
{
|
|
159
274
|
variable: "--sb-theme-completion-glyph",
|
|
160
275
|
path: ["completion", "glyph"],
|
|
161
|
-
fallback:
|
|
276
|
+
fallback: k("#FFFFFF")
|
|
162
277
|
},
|
|
163
|
-
...
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
278
|
+
...A("default", [
|
|
279
|
+
k("#FFFFFF"),
|
|
280
|
+
k("#000000"),
|
|
281
|
+
k("#DBDBDB")
|
|
167
282
|
]),
|
|
168
|
-
...
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
283
|
+
...A("hover", [
|
|
284
|
+
k("#F5F5F5"),
|
|
285
|
+
k("#000000"),
|
|
286
|
+
k("#DBDBDB")
|
|
172
287
|
]),
|
|
173
|
-
...
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
288
|
+
...A("pressed", [
|
|
289
|
+
k("#000000"),
|
|
290
|
+
k("#FFFFFF"),
|
|
291
|
+
k("#000000")
|
|
177
292
|
]),
|
|
178
|
-
...
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
293
|
+
...A("selected", [
|
|
294
|
+
k("#000000"),
|
|
295
|
+
k("#FFFFFF"),
|
|
296
|
+
k("#000000")
|
|
182
297
|
]),
|
|
183
|
-
...
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
298
|
+
...A("disabled", [
|
|
299
|
+
k("#F2F2F2"),
|
|
300
|
+
k("#8A8A8A"),
|
|
301
|
+
k("#E5E5E5")
|
|
187
302
|
]),
|
|
188
|
-
...
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
303
|
+
...j("primary", [
|
|
304
|
+
k("#FFFFFF"),
|
|
305
|
+
k("#121212"),
|
|
306
|
+
k("#292929"),
|
|
307
|
+
k("#000000"),
|
|
308
|
+
k("#E5E5E5"),
|
|
309
|
+
k("#8A8A8A")
|
|
195
310
|
]),
|
|
196
|
-
...
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
311
|
+
...j("secondary", [
|
|
312
|
+
k("#000000"),
|
|
313
|
+
k("#F2F2F2"),
|
|
314
|
+
k("#E8E8E8"),
|
|
315
|
+
k("#DBDBDB"),
|
|
316
|
+
k("#E5E5E5"),
|
|
317
|
+
k("#8A8A8A")
|
|
203
318
|
]),
|
|
204
|
-
...
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
319
|
+
...j("tertiary", [
|
|
320
|
+
k("#000000"),
|
|
321
|
+
k("#FFFFFF"),
|
|
322
|
+
k("#F5F5F5"),
|
|
323
|
+
k("#E8E8E8"),
|
|
324
|
+
k("#E5E5E5"),
|
|
325
|
+
k("#8A8A8A")
|
|
211
326
|
]),
|
|
212
327
|
{
|
|
213
328
|
variable: "--sb-theme-input-background",
|
|
214
329
|
path: ["input", "background"],
|
|
215
|
-
fallback:
|
|
330
|
+
fallback: k("#FFFFFF")
|
|
216
331
|
},
|
|
217
332
|
{
|
|
218
333
|
variable: "--sb-theme-input-foreground",
|
|
219
334
|
path: ["input", "foreground"],
|
|
220
|
-
fallback:
|
|
335
|
+
fallback: k("#000000")
|
|
221
336
|
},
|
|
222
337
|
{
|
|
223
338
|
variable: "--sb-theme-input-placeholder",
|
|
224
339
|
path: ["input", "placeholder"],
|
|
225
|
-
fallback:
|
|
340
|
+
fallback: k("#000000", .4)
|
|
226
341
|
},
|
|
227
342
|
{
|
|
228
343
|
variable: "--sb-theme-input-border",
|
|
229
344
|
path: ["input", "border"],
|
|
230
|
-
fallback:
|
|
345
|
+
fallback: k("#000000", .18)
|
|
231
346
|
},
|
|
232
347
|
{
|
|
233
348
|
variable: "--sb-theme-input-focused-border",
|
|
234
349
|
path: ["input", "focusedBorder"],
|
|
235
|
-
fallback:
|
|
350
|
+
fallback: k("#000000", .7)
|
|
236
351
|
},
|
|
237
352
|
{
|
|
238
353
|
variable: "--sb-theme-input-error-border",
|
|
239
354
|
path: ["input", "errorBorder"],
|
|
240
|
-
fallback:
|
|
355
|
+
fallback: k("#B42318")
|
|
241
356
|
},
|
|
242
357
|
{
|
|
243
358
|
variable: "--sb-theme-input-disabled-background",
|
|
244
359
|
path: ["input", "disabledBackground"],
|
|
245
|
-
fallback:
|
|
360
|
+
fallback: k("#F2F2F2")
|
|
246
361
|
},
|
|
247
362
|
{
|
|
248
363
|
variable: "--sb-theme-input-disabled-foreground",
|
|
249
364
|
path: ["input", "disabledForeground"],
|
|
250
|
-
fallback:
|
|
365
|
+
fallback: k("#8A8A8A")
|
|
251
366
|
},
|
|
252
367
|
{
|
|
253
368
|
variable: "--sb-theme-fab-background",
|
|
254
369
|
path: ["fab", "background"],
|
|
255
|
-
fallback:
|
|
370
|
+
fallback: k("#000000")
|
|
256
371
|
},
|
|
257
372
|
{
|
|
258
373
|
variable: "--sb-theme-fab-foreground",
|
|
259
374
|
path: ["fab", "foreground"],
|
|
260
|
-
fallback:
|
|
375
|
+
fallback: k("#FFFFFF")
|
|
261
376
|
},
|
|
262
377
|
{
|
|
263
378
|
variable: "--sb-theme-fab-border",
|
|
264
379
|
path: ["fab", "border"],
|
|
265
|
-
fallback:
|
|
380
|
+
fallback: k("#FFFFFF", .15)
|
|
266
381
|
},
|
|
267
382
|
{
|
|
268
383
|
variable: "--sb-theme-fab-accent-primary",
|
|
269
384
|
path: ["fab", "accentPrimary"],
|
|
270
|
-
fallback:
|
|
385
|
+
fallback: k("#000000")
|
|
271
386
|
},
|
|
272
387
|
{
|
|
273
388
|
variable: "--sb-theme-fab-accent-secondary",
|
|
274
389
|
path: ["fab", "accentSecondary"],
|
|
275
|
-
fallback:
|
|
390
|
+
fallback: k("#FFFFFF")
|
|
276
391
|
},
|
|
277
392
|
{
|
|
278
393
|
variable: "--sb-theme-fab-timer-track",
|
|
279
394
|
path: ["fab", "timerTrack"],
|
|
280
|
-
fallback:
|
|
395
|
+
fallback: k("#000000", .16)
|
|
281
396
|
},
|
|
282
397
|
{
|
|
283
398
|
variable: "--sb-theme-fab-timer-fill",
|
|
284
399
|
path: ["fab", "timerFill"],
|
|
285
|
-
fallback:
|
|
400
|
+
fallback: k("#000000")
|
|
286
401
|
}
|
|
287
402
|
];
|
|
288
|
-
|
|
289
|
-
function
|
|
403
|
+
M.map((e) => e.variable), Object.fromEntries(M.map((e) => [e.variable, P(e.fallback)]));
|
|
404
|
+
function N(e) {
|
|
290
405
|
return e && typeof e == "object" && !Array.isArray(e) ? e : {};
|
|
291
406
|
}
|
|
292
|
-
function
|
|
407
|
+
function P(e, t = O) {
|
|
293
408
|
return !e || typeof e.hex != "string" || !/^#[0-9a-fA-F]{6}$/.test(e.hex) || !Number.isFinite(e.alpha) || e.alpha < 0 || e.alpha > 1 ? t : `rgba(${Number.parseInt(e.hex.slice(1, 3), 16)}, ${Number.parseInt(e.hex.slice(3, 5), 16)}, ${Number.parseInt(e.hex.slice(5, 7), 16)}, ${e.alpha})`;
|
|
294
409
|
}
|
|
295
|
-
function
|
|
410
|
+
function F(e, t) {
|
|
296
411
|
let n = e;
|
|
297
|
-
for (let e of t) n =
|
|
412
|
+
for (let e of t) n = N(n)[e];
|
|
298
413
|
return n;
|
|
299
414
|
}
|
|
300
|
-
function
|
|
301
|
-
return Object.fromEntries(
|
|
415
|
+
function I(e) {
|
|
416
|
+
return Object.fromEntries(M.map((t) => [t.variable, P(F(e, t.path), P(t.fallback))]));
|
|
302
417
|
}
|
|
303
|
-
function
|
|
304
|
-
return
|
|
418
|
+
function L(e, t) {
|
|
419
|
+
return k(`#${[
|
|
305
420
|
1,
|
|
306
421
|
3,
|
|
307
422
|
5
|
|
@@ -312,8 +427,8 @@ function E(e, t) {
|
|
|
312
427
|
}
|
|
313
428
|
function ee(e) {
|
|
314
429
|
let t = (t) => {
|
|
315
|
-
let n =
|
|
316
|
-
return
|
|
430
|
+
let n = M.find((e) => e.path.join(".") === t.join(".")), r = F(e, t);
|
|
431
|
+
return P(r, "") ? r : n.fallback;
|
|
317
432
|
}, n = {
|
|
318
433
|
...t(["sheet", "background"]),
|
|
319
434
|
alpha: 1
|
|
@@ -321,14 +436,14 @@ function ee(e) {
|
|
|
321
436
|
"choice",
|
|
322
437
|
"selected",
|
|
323
438
|
"background"
|
|
324
|
-
]), a =
|
|
439
|
+
]), a = L(i, n), o = [
|
|
325
440
|
1,
|
|
326
441
|
3,
|
|
327
442
|
5
|
|
328
|
-
].map((e) => Number.parseInt(n.hex.slice(e, e + 2), 16) / 255), s = o[0] * .2126 + o[1] * .7152 + o[2] * .0722 < .5, c = n.hex.toUpperCase() === (s ? "#000000" : "#FFFFFF"), l = (e, t) =>
|
|
443
|
+
].map((e) => Number.parseInt(n.hex.slice(e, e + 2), 16) / 255), s = o[0] * .2126 + o[1] * .7152 + o[2] * .0722 < .5, c = n.hex.toUpperCase() === (s ? "#000000" : "#FFFFFF"), l = (e, t) => P(L({
|
|
329
444
|
...e,
|
|
330
445
|
alpha: e.alpha * t
|
|
331
|
-
}, n)), u =
|
|
446
|
+
}, n)), u = L({
|
|
332
447
|
...r,
|
|
333
448
|
alpha: r.alpha * (s ? c ? .15 : .08 : .14)
|
|
334
449
|
}, n), d = (e) => [
|
|
@@ -341,37 +456,41 @@ function ee(e) {
|
|
|
341
456
|
.0722
|
|
342
457
|
][r], 0), f = d(u) > d(n);
|
|
343
458
|
return {
|
|
344
|
-
"--sb-snackbar-surface":
|
|
345
|
-
"--sb-snackbar-text":
|
|
346
|
-
"--sb-snackbar-border":
|
|
459
|
+
"--sb-snackbar-surface": P(n),
|
|
460
|
+
"--sb-snackbar-text": P(r),
|
|
461
|
+
"--sb-snackbar-border": P(k(s ? "#FFFFFF" : "#000000", s ? .1 : .05)),
|
|
347
462
|
"--sb-snackbar-normal": l(r, s ? c ? .2 : .14 : c ? .08 : .1),
|
|
348
463
|
"--sb-snackbar-hover": l(r, s ? c ? .24 : .18 : .04),
|
|
349
464
|
"--sb-snackbar-pressed": l(i, s ? c ? .28 : .24 : .2),
|
|
350
|
-
"--sb-snackbar-active":
|
|
351
|
-
"--sb-snackbar-on-active":
|
|
465
|
+
"--sb-snackbar-active": P(a),
|
|
466
|
+
"--sb-snackbar-on-active": P(t([
|
|
352
467
|
"choice",
|
|
353
468
|
"selected",
|
|
354
469
|
"foreground"
|
|
355
470
|
])),
|
|
356
|
-
"--sb-snackbar-ghost":
|
|
357
|
-
"--sb-snackbar-remaining":
|
|
358
|
-
"--sb-snackbar-elapsed":
|
|
471
|
+
"--sb-snackbar-ghost": P(u),
|
|
472
|
+
"--sb-snackbar-remaining": P(f ? u : n),
|
|
473
|
+
"--sb-snackbar-elapsed": P(f ? n : u)
|
|
359
474
|
};
|
|
360
475
|
}
|
|
361
|
-
var
|
|
476
|
+
var R = {
|
|
477
|
+
visible: 185.84,
|
|
362
478
|
entrance: 1969.207,
|
|
363
479
|
timerEntrance: 2169.207,
|
|
364
480
|
widen: 200,
|
|
365
481
|
expand: 450
|
|
366
|
-
},
|
|
482
|
+
}, z = {
|
|
367
483
|
delay: 400,
|
|
368
484
|
enter: 450,
|
|
369
485
|
exit: 400,
|
|
370
486
|
removal: 450,
|
|
371
487
|
reduced: 150
|
|
372
|
-
}, te =
|
|
373
|
-
function
|
|
374
|
-
|
|
488
|
+
}, te = z.delay + z.enter;
|
|
489
|
+
function ne(e, t) {
|
|
490
|
+
return t ? 0 : e ? z.delay : R.visible;
|
|
491
|
+
}
|
|
492
|
+
function re(e, t) {
|
|
493
|
+
let { viewport: n, safeArea: r = {}, compactHeight: i } = t, a = H(r.left) + 12, o = H(r.right) + 12, s = H(r.top) + 24, c = H(r.bottom) + 8, l = Math.max(0, n.width - a - o), u = Math.min(364, l), d = Math.min(376, l), f = Math.max(0, n.height - s - c), p = Math.min(t.cardHeight, f);
|
|
375
494
|
if (t.barPosition) return {
|
|
376
495
|
compactWidth: n.width,
|
|
377
496
|
compactLeft: 0,
|
|
@@ -381,11 +500,11 @@ function k(e, t) {
|
|
|
381
500
|
maxCardHeight: f,
|
|
382
501
|
cardLeft: a + (l - d) / 2,
|
|
383
502
|
cardBottom: c,
|
|
384
|
-
cardTop:
|
|
503
|
+
cardTop: H(r.top) + 12,
|
|
385
504
|
entranceOffset: 0,
|
|
386
505
|
transformOrigin: t.barPosition === "top" ? "50% 0%" : "50% 100%"
|
|
387
506
|
};
|
|
388
|
-
let m =
|
|
507
|
+
let m = G(e, {
|
|
389
508
|
viewport: n,
|
|
390
509
|
element: {
|
|
391
510
|
width: u,
|
|
@@ -401,34 +520,34 @@ function k(e, t) {
|
|
|
401
520
|
cardHeight: p,
|
|
402
521
|
maxCardHeight: f,
|
|
403
522
|
cardTop: 0,
|
|
404
|
-
entranceOffset: (u - i) *
|
|
523
|
+
entranceOffset: (u - i) * W(e?.anchor).x,
|
|
405
524
|
cardLeft: a + (l - d) / 2,
|
|
406
525
|
cardBottom: Math.max(c, Math.min(g, n.height - s - p)),
|
|
407
526
|
transformOrigin: m.transformOrigin
|
|
408
527
|
};
|
|
409
528
|
}
|
|
410
|
-
var
|
|
529
|
+
var B = {
|
|
411
530
|
x: 1,
|
|
412
531
|
y: 1
|
|
413
|
-
},
|
|
532
|
+
}, V = {
|
|
414
533
|
x: -16,
|
|
415
534
|
y: -24
|
|
416
535
|
};
|
|
417
|
-
function
|
|
536
|
+
function H(e) {
|
|
418
537
|
return typeof e == "number" && Number.isFinite(e) ? Math.max(0, e) : 0;
|
|
419
538
|
}
|
|
420
|
-
function
|
|
539
|
+
function U(e) {
|
|
421
540
|
return typeof e == "number" && Number.isFinite(e) ? e : 0;
|
|
422
541
|
}
|
|
423
|
-
function
|
|
424
|
-
let t =
|
|
542
|
+
function W(e) {
|
|
543
|
+
let t = N(e), n = typeof t.x == "number" && Number.isFinite(t.x) ? t.x : B.x, r = typeof t.y == "number" && Number.isFinite(t.y) ? t.y : B.y;
|
|
425
544
|
return {
|
|
426
545
|
x: Math.min(1, Math.max(0, n)),
|
|
427
546
|
y: Math.min(1, Math.max(0, r))
|
|
428
547
|
};
|
|
429
548
|
}
|
|
430
|
-
function
|
|
431
|
-
let n =
|
|
549
|
+
function G(e, t) {
|
|
550
|
+
let n = N(e), r = W(n.position), i = W(n.anchor), a = N(n.offset), o = e ? U(a.x) : V.x, s = e ? U(a.y) : V.y, c = t.safeArea ?? {}, l = H(c.left), u = H(c.right), d = H(c.top), f = H(c.bottom), p = Math.max(0, H(t.viewport.width) - l - u - H(t.element.width)), m = Math.max(0, H(t.viewport.height) - d - f - H(t.element.height));
|
|
432
551
|
return {
|
|
433
552
|
left: l + r.x * p + o,
|
|
434
553
|
top: d + r.y * m + s,
|
|
@@ -439,7 +558,7 @@ function F(e, t) {
|
|
|
439
558
|
transformOrigin: `${i.x * 100}% ${i.y * 100}%`
|
|
440
559
|
};
|
|
441
560
|
}
|
|
442
|
-
function
|
|
561
|
+
function K(e, t, n = "forward") {
|
|
443
562
|
let r = e === "bar" || e === "fill" ? e : "none", i = n === "reverse" ? "reverse" : "forward", a = typeof t == "number" && Number.isFinite(t) && t > 0 ? t : null;
|
|
444
563
|
return {
|
|
445
564
|
style: r,
|
|
@@ -455,8 +574,8 @@ function I(e, t, n = "forward") {
|
|
|
455
574
|
}
|
|
456
575
|
//#endregion
|
|
457
576
|
//#region src/lib/components/SurveyFab.tsx
|
|
458
|
-
function
|
|
459
|
-
let { survey: a } = t, o =
|
|
577
|
+
function ie({ session: t, fabRef: n, onClick: r, animationState: i }) {
|
|
578
|
+
let { survey: a } = t, o = K(a.fab?.timerStyle, a.fab?.expandedTimeout), s = { ...o.cssVariables }, c = a.fab?.imageUrl, [l, u] = d(null), f = !!(c && l !== c);
|
|
460
579
|
return /* @__PURE__ */ g("button", {
|
|
461
580
|
ref: n,
|
|
462
581
|
type: "button",
|
|
@@ -502,7 +621,7 @@ function L({ session: t, fabRef: n, onClick: r, animationState: i }) {
|
|
|
502
621
|
}
|
|
503
622
|
//#endregion
|
|
504
623
|
//#region src/lib/components/SurveyProgress.tsx
|
|
505
|
-
function
|
|
624
|
+
function ae({ value: e }) {
|
|
506
625
|
return /* @__PURE__ */ h("div", {
|
|
507
626
|
className: "sb-progress",
|
|
508
627
|
"aria-hidden": "true",
|
|
@@ -514,8 +633,8 @@ function R({ value: e }) {
|
|
|
514
633
|
}
|
|
515
634
|
//#endregion
|
|
516
635
|
//#region src/lib/components/SurveyQuestionView.tsx
|
|
517
|
-
var
|
|
518
|
-
function
|
|
636
|
+
var oe = [];
|
|
637
|
+
function q() {
|
|
519
638
|
return /* @__PURE__ */ h("svg", {
|
|
520
639
|
viewBox: "0 0 35.5556 35.5556",
|
|
521
640
|
"aria-hidden": "true",
|
|
@@ -525,7 +644,7 @@ function B() {
|
|
|
525
644
|
})
|
|
526
645
|
});
|
|
527
646
|
}
|
|
528
|
-
function
|
|
647
|
+
function J() {
|
|
529
648
|
return /* @__PURE__ */ h("svg", {
|
|
530
649
|
viewBox: "0 0 35.5556 35.5556",
|
|
531
650
|
"aria-hidden": "true",
|
|
@@ -535,7 +654,7 @@ function V() {
|
|
|
535
654
|
})
|
|
536
655
|
});
|
|
537
656
|
}
|
|
538
|
-
function
|
|
657
|
+
function se() {
|
|
539
658
|
return /* @__PURE__ */ h("span", {
|
|
540
659
|
className: "sb-spark-ring",
|
|
541
660
|
"aria-hidden": "true",
|
|
@@ -545,23 +664,23 @@ function H() {
|
|
|
545
664
|
}, t))
|
|
546
665
|
});
|
|
547
666
|
}
|
|
548
|
-
function
|
|
667
|
+
function ce({ question: e, store: t, isSentiment: n }) {
|
|
549
668
|
let i = t.currentDraft(), a = t.getState(), o = !!(a?.isBusy || a?.isCompleting), s = e.answers?.find((e) => e.id === i?.answer_key);
|
|
550
|
-
return s && r(s) ? /* @__PURE__ */ h(
|
|
669
|
+
return s && r(s) ? /* @__PURE__ */ h(fe, {
|
|
551
670
|
store: t,
|
|
552
671
|
disabled: o,
|
|
553
672
|
placeholder: s.label,
|
|
554
673
|
autoFocus: !0,
|
|
555
674
|
ariaLabel: "Other response",
|
|
556
675
|
isOther: !0
|
|
557
|
-
}) : n ? /* @__PURE__ */ h(
|
|
676
|
+
}) : n ? /* @__PURE__ */ h(le, {
|
|
558
677
|
store: t,
|
|
559
678
|
disabled: o || !!a?.sentimentSelectionLocked
|
|
560
|
-
}) : e.type === "yes_no" || e.type === "multiple_choice" ? /* @__PURE__ */ h(
|
|
679
|
+
}) : e.type === "yes_no" || e.type === "multiple_choice" ? /* @__PURE__ */ h(ue, {
|
|
561
680
|
question: e,
|
|
562
681
|
store: t,
|
|
563
682
|
disabled: o
|
|
564
|
-
}) : /* @__PURE__ */ h(
|
|
683
|
+
}) : /* @__PURE__ */ h(fe, {
|
|
565
684
|
store: t,
|
|
566
685
|
disabled: o,
|
|
567
686
|
placeholder: e.free_text_placeholder ?? "Please explain more... (Optional)",
|
|
@@ -569,7 +688,7 @@ function U({ question: e, store: t, isSentiment: n }) {
|
|
|
569
688
|
ariaLabel: e.prompt
|
|
570
689
|
});
|
|
571
690
|
}
|
|
572
|
-
function
|
|
691
|
+
function le({ store: e, disabled: t }) {
|
|
573
692
|
let r = e.currentDraft();
|
|
574
693
|
return /* @__PURE__ */ h("div", {
|
|
575
694
|
className: "sb-question sb-question--sentiment",
|
|
@@ -577,7 +696,7 @@ function W({ store: e, disabled: t }) {
|
|
|
577
696
|
let a = n(i), o = r?.answer_key === i.id;
|
|
578
697
|
return /* @__PURE__ */ g("span", {
|
|
579
698
|
className: "sb-sentiment-control",
|
|
580
|
-
children: [o && a ? /* @__PURE__ */ h(
|
|
699
|
+
children: [o && a ? /* @__PURE__ */ h(se, {}) : null, /* @__PURE__ */ h("button", {
|
|
581
700
|
type: "button",
|
|
582
701
|
className: `sb-yesno ${o ? "sb-yesno--selected" : ""}`,
|
|
583
702
|
"data-choice-value": i.id,
|
|
@@ -587,15 +706,15 @@ function W({ store: e, disabled: t }) {
|
|
|
587
706
|
"aria-pressed": o,
|
|
588
707
|
children: /* @__PURE__ */ h("span", {
|
|
589
708
|
className: "sb-yesno__icon",
|
|
590
|
-
children: h(a ?
|
|
709
|
+
children: h(a ? q : J, {})
|
|
591
710
|
})
|
|
592
711
|
})]
|
|
593
712
|
}, i.id);
|
|
594
713
|
})
|
|
595
714
|
});
|
|
596
715
|
}
|
|
597
|
-
function
|
|
598
|
-
let i = e.answers ??
|
|
716
|
+
function ue({ question: e, store: t, disabled: n }) {
|
|
717
|
+
let i = e.answers ?? oe, a = t.currentDraft(), o = u(null), [c, l] = d(() => i.every((e) => e.label.trim().length < 20));
|
|
599
718
|
return s(() => {
|
|
600
719
|
let e = () => {
|
|
601
720
|
let e = ((o.current?.clientWidth || 328) - 8) / 2, t = document.createElement("span");
|
|
@@ -617,7 +736,7 @@ function ne({ question: e, store: t, disabled: n }) {
|
|
|
617
736
|
className: `sb-question sb-question--choices ${c ? "sb-question--choices-grid" : "sb-question--choices-list"}`,
|
|
618
737
|
children: /* @__PURE__ */ h("div", {
|
|
619
738
|
className: `sb-options-scroll ${(c ? Math.ceil(i.length / 2) : i.length) >= 5 ? "sb-options-scroll--scrolling" : ""}`,
|
|
620
|
-
children: i.map((e) => /* @__PURE__ */ h(
|
|
739
|
+
children: i.map((e) => /* @__PURE__ */ h(de, {
|
|
621
740
|
choice: e,
|
|
622
741
|
selected: a?.answer_key === e.id,
|
|
623
742
|
disabled: n,
|
|
@@ -626,7 +745,7 @@ function ne({ question: e, store: t, disabled: n }) {
|
|
|
626
745
|
})
|
|
627
746
|
});
|
|
628
747
|
}
|
|
629
|
-
function
|
|
748
|
+
function de({ choice: e, selected: n, disabled: i, store: a }) {
|
|
630
749
|
let o = r(e);
|
|
631
750
|
return /* @__PURE__ */ h("button", {
|
|
632
751
|
type: "button",
|
|
@@ -649,7 +768,7 @@ function re({ choice: e, selected: n, disabled: i, store: a }) {
|
|
|
649
768
|
})
|
|
650
769
|
});
|
|
651
770
|
}
|
|
652
|
-
function
|
|
771
|
+
function fe({ store: e, disabled: t, placeholder: n, autoFocus: r, ariaLabel: i, isOther: a = !1 }) {
|
|
653
772
|
let o = u(null);
|
|
654
773
|
return s(() => {
|
|
655
774
|
r && !t && o.current?.focus({ preventScroll: !0 });
|
|
@@ -673,7 +792,7 @@ function G({ store: e, disabled: t, placeholder: n, autoFocus: r, ariaLabel: i,
|
|
|
673
792
|
}
|
|
674
793
|
//#endregion
|
|
675
794
|
//#region src/lib/components/SurveyThankYou.tsx
|
|
676
|
-
function
|
|
795
|
+
function pe({ completion: e, store: t, isBusy: n, headingId: r, bodyId: i }) {
|
|
677
796
|
let a = u(null), [o, c] = d(!1);
|
|
678
797
|
return s(() => {
|
|
679
798
|
let e = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1, t = setTimeout(() => c(!0), e ? 0 : 890);
|
|
@@ -726,7 +845,7 @@ function ie({ completion: e, store: t, isBusy: n, headingId: r, bodyId: i }) {
|
|
|
726
845
|
}
|
|
727
846
|
//#endregion
|
|
728
847
|
//#region src/lib/components/SurveySheet.tsx
|
|
729
|
-
var
|
|
848
|
+
var me = a(function({ session: e, store: t, modal: n, rootRef: r, interactive: i = !0 }) {
|
|
730
849
|
let a = e.currentNodeId ? e.survey.questions[e.currentNodeId] : void 0, o = !!(a && t.isSentimentStep()), l = a?.answers?.find((e) => e.id === t.currentDraft()?.answer_key), d = l?.comment?.trim() || null, f = l?.id === "system_other", p = u(null), _ = c();
|
|
731
850
|
s(() => {
|
|
732
851
|
if (!i) return;
|
|
@@ -765,7 +884,7 @@ var K = a(function({ session: e, store: t, modal: n, rootRef: r, interactive: i
|
|
|
765
884
|
"aria-labelledby": v,
|
|
766
885
|
"aria-describedby": e.completion?.body ? y : void 0,
|
|
767
886
|
"aria-busy": e.isCompleting || void 0,
|
|
768
|
-
children: e.completion ? /* @__PURE__ */ h(
|
|
887
|
+
children: e.completion ? /* @__PURE__ */ h(pe, {
|
|
769
888
|
completion: e.completion,
|
|
770
889
|
store: t,
|
|
771
890
|
isBusy: e.isBusy,
|
|
@@ -773,7 +892,7 @@ var K = a(function({ session: e, store: t, modal: n, rootRef: r, interactive: i
|
|
|
773
892
|
bodyId: y
|
|
774
893
|
}) : a ? /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ g("div", {
|
|
775
894
|
className: "sb-sheet__header",
|
|
776
|
-
children: [o ? null : /* @__PURE__ */ h(
|
|
895
|
+
children: [o ? null : /* @__PURE__ */ h(ae, { value: t.progress() }), /* @__PURE__ */ h("button", {
|
|
777
896
|
type: "button",
|
|
778
897
|
className: "sb-sheet__close",
|
|
779
898
|
onClick: () => void t.closeSurvey(),
|
|
@@ -794,7 +913,7 @@ var K = a(function({ session: e, store: t, modal: n, rootRef: r, interactive: i
|
|
|
794
913
|
"aria-live": o && d ? "polite" : void 0,
|
|
795
914
|
children: o && d ? d : a.prompt
|
|
796
915
|
})]
|
|
797
|
-
}), /* @__PURE__ */ h(
|
|
916
|
+
}), /* @__PURE__ */ h(ce, {
|
|
798
917
|
question: a,
|
|
799
918
|
store: t,
|
|
800
919
|
isSentiment: o
|
|
@@ -824,39 +943,52 @@ var K = a(function({ session: e, store: t, modal: n, rootRef: r, interactive: i
|
|
|
824
943
|
}, `${a.node_id}:${f ? "text" : "options"}`)] }) : null
|
|
825
944
|
})]
|
|
826
945
|
});
|
|
827
|
-
}),
|
|
828
|
-
function
|
|
829
|
-
|
|
946
|
+
}), he = typeof window > "u" ? s : l, Y = () => window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1;
|
|
947
|
+
function ge(e, t, n, r) {
|
|
948
|
+
t.current === r || document.visibilityState === "hidden" || (t.current = r, n.current?.(), n.current = null, e.confirmPresentation("expanded_fab", r));
|
|
949
|
+
}
|
|
950
|
+
function _e({ session: e, store: t, placement: r, modal: a, exiting: o = !1 }) {
|
|
951
|
+
let c = u(null), l = u(null), f = u(null), [p, v] = d("entering"), { presentationId: y, survey: b, snackbar: x, isOpen: S } = e, C = e.sentimentPresentation === "bar", w = C ? e.barPosition : void 0, T = o ? "exiting" : S && (p === "entering" || p === "compact") ? "widening" : p, E = b.questions[b.root_node_id], D = i(E, b.fab), O = b.fab?.timerStyle ?? "none", k = C && e.barBehavior === "dismiss" && x?.selectedKey != null, [A, j] = d(!1);
|
|
830
952
|
s(() => {
|
|
831
953
|
if (o) return;
|
|
832
|
-
let e =
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
954
|
+
let e = c.current?.querySelector(".sb-snackbar-surface"), n = () => {
|
|
955
|
+
l.current === y || f.current || !e || (f.current = _(e, () => {
|
|
956
|
+
f.current = null, l.current = y, t.confirmPresentation("expanded_fab", y);
|
|
957
|
+
}));
|
|
958
|
+
}, r = setTimeout(n, ne(C, Y())), i = setTimeout(() => {
|
|
959
|
+
v("compact"), t.confirmEntryDisplayed(y), t.confirmFabEntranceCompleted(y), n(), C && e?.matches(":hover") && window.matchMedia?.("(hover: hover)").matches && t.setBarTimerPaused(y, !0);
|
|
960
|
+
}, C ? Y() ? z.reduced : te : Y() ? 0 : O === "none" ? R.entrance : R.timerEntrance);
|
|
961
|
+
return () => {
|
|
962
|
+
clearTimeout(r), clearTimeout(i), f.current?.(), f.current = null;
|
|
963
|
+
};
|
|
836
964
|
}, [
|
|
837
|
-
|
|
965
|
+
y,
|
|
838
966
|
t,
|
|
839
|
-
|
|
840
|
-
|
|
967
|
+
O,
|
|
968
|
+
C,
|
|
841
969
|
o
|
|
842
|
-
])
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
970
|
+
]);
|
|
971
|
+
let M = () => ge(t, l, f, y), N = () => {
|
|
972
|
+
M(), t.closeSurvey();
|
|
973
|
+
};
|
|
974
|
+
s(() => {
|
|
975
|
+
if (!S || o) return;
|
|
976
|
+
let e = Y(), n = setTimeout(() => v("expanding"), e ? 0 : R.widen), r = setTimeout(() => {
|
|
977
|
+
v("ready"), t.confirmPresentation("sheet", y), t.confirmSnackbarContentReady(y), c.current?.querySelector(".sb-sheet h2")?.focus({ preventScroll: !0 });
|
|
978
|
+
}, e ? 0 : R.widen + R.expand);
|
|
847
979
|
return () => {
|
|
848
980
|
clearTimeout(n), clearTimeout(r);
|
|
849
981
|
};
|
|
850
982
|
}, [
|
|
983
|
+
S,
|
|
851
984
|
y,
|
|
852
|
-
p,
|
|
853
985
|
t,
|
|
854
986
|
o
|
|
855
|
-
]),
|
|
987
|
+
]), he(() => {
|
|
856
988
|
let e = c.current;
|
|
857
989
|
if (!e || o) return;
|
|
858
990
|
let t = () => {
|
|
859
|
-
let t = e.parentElement, n = window.visualViewport, a = r === "inline" ? t.clientWidth : n?.width || window.innerWidth, o = r === "inline" ? t.clientHeight : n?.height || window.innerHeight, s = t.querySelector(".sb-safe-area-probe"), c = s ? getComputedStyle(s) : null, l = (e) => Number.parseFloat(e ?? "") || 0, u = e.querySelector(".sb-snackbar-compact"), d = e.querySelector(".sb-sheet"), f = i(
|
|
991
|
+
let t = e.parentElement, n = window.visualViewport, a = r === "inline" ? t.clientWidth : n?.width || window.innerWidth, o = r === "inline" ? t.clientHeight : n?.height || window.innerHeight, s = t.querySelector(".sb-safe-area-probe"), c = s ? getComputedStyle(s) : null, l = (e) => Number.parseFloat(e ?? "") || 0, u = e.querySelector(".sb-snackbar-compact"), d = e.querySelector(".sb-sheet"), f = i(E, b.fab).placement, p = {
|
|
860
992
|
viewport: {
|
|
861
993
|
width: a,
|
|
862
994
|
height: o
|
|
@@ -869,31 +1001,31 @@ function oe({ session: e, store: t, placement: r, modal: a, exiting: o = !1 }) {
|
|
|
869
1001
|
},
|
|
870
1002
|
compactHeight: 64,
|
|
871
1003
|
cardHeight: d?.offsetHeight || 0,
|
|
872
|
-
barPosition:
|
|
1004
|
+
barPosition: w
|
|
873
1005
|
};
|
|
874
|
-
e.style.setProperty("--sb-snackbar-compact-width", `${
|
|
875
|
-
let m = getComputedStyle(u), h = Number.parseFloat(m.height) || u.offsetHeight || (
|
|
876
|
-
|
|
877
|
-
let
|
|
1006
|
+
e.style.setProperty("--sb-snackbar-compact-width", `${re(f, p).compactWidth}px`), k && (u.style.minHeight = "48px");
|
|
1007
|
+
let m = getComputedStyle(u), h = Number.parseFloat(m.height) || u.offsetHeight || (w ? 48 : 64), g = k ? Math.max(h, (e.querySelector(".sb-bar-acknowledgement-copy")?.scrollHeight ?? 0) + l(m.paddingTop) + l(m.paddingBottom)) : h;
|
|
1008
|
+
k && u.style.removeProperty("min-height");
|
|
1009
|
+
let _ = re(f, {
|
|
878
1010
|
...p,
|
|
879
1011
|
compactHeight: g
|
|
880
1012
|
});
|
|
881
1013
|
r === "fixed" ? (e.style.left = `${n?.offsetLeft ?? 0}px`, e.style.top = `${n?.offsetTop ?? 0}px`, e.style.width = `${a}px`, e.style.height = `${o}px`) : (e.style.left = "0px", e.style.top = "0px", e.style.width = "100%", e.style.height = "100%");
|
|
882
|
-
let
|
|
883
|
-
e.style.setProperty("--sb-bar-top", `${
|
|
884
|
-
let
|
|
885
|
-
left:
|
|
886
|
-
bottom:
|
|
887
|
-
width:
|
|
888
|
-
height:
|
|
1014
|
+
let v = T === "widening" || T === "expanding" || T === "ready";
|
|
1015
|
+
e.style.setProperty("--sb-bar-top", `${v ? _.cardTop : 0}px`);
|
|
1016
|
+
let y = T === "expanding" || T === "ready", x = {
|
|
1017
|
+
left: v ? _.cardLeft : _.compactLeft,
|
|
1018
|
+
bottom: v ? _.cardBottom : _.compactBottom,
|
|
1019
|
+
width: v ? _.cardWidth : _.compactWidth,
|
|
1020
|
+
height: y ? _.cardHeight : g,
|
|
889
1021
|
"compact-height": g,
|
|
890
|
-
"card-width":
|
|
891
|
-
"compact-width":
|
|
892
|
-
"entrance-offset":
|
|
893
|
-
"max-height":
|
|
1022
|
+
"card-width": _.cardWidth,
|
|
1023
|
+
"compact-width": _.compactWidth,
|
|
1024
|
+
"entrance-offset": _.entranceOffset,
|
|
1025
|
+
"max-height": _.maxCardHeight
|
|
894
1026
|
};
|
|
895
|
-
for (let [t, n] of Object.entries(
|
|
896
|
-
e.querySelector(".sb-snackbar-shell").style.transformOrigin =
|
|
1027
|
+
for (let [t, n] of Object.entries(x)) e.style.setProperty(`--sb-snackbar-${t}`, `${n}px`);
|
|
1028
|
+
e.querySelector(".sb-snackbar-shell").style.transformOrigin = _.transformOrigin;
|
|
897
1029
|
};
|
|
898
1030
|
t();
|
|
899
1031
|
let n = typeof ResizeObserver > "u" ? null : new ResizeObserver(t), a = e.querySelector(".sb-snackbar-compact");
|
|
@@ -904,88 +1036,91 @@ function oe({ session: e, store: t, placement: r, modal: a, exiting: o = !1 }) {
|
|
|
904
1036
|
};
|
|
905
1037
|
}, [
|
|
906
1038
|
r,
|
|
1039
|
+
T,
|
|
1040
|
+
b,
|
|
1041
|
+
E,
|
|
907
1042
|
S,
|
|
908
|
-
|
|
909
|
-
C,
|
|
910
|
-
y,
|
|
911
|
-
x,
|
|
1043
|
+
w,
|
|
912
1044
|
o,
|
|
913
|
-
|
|
1045
|
+
k
|
|
914
1046
|
]), s(() => {
|
|
915
|
-
if (
|
|
1047
|
+
if (S || o) return;
|
|
916
1048
|
let e = (e) => {
|
|
917
|
-
e.key === "Escape" && c.current?.contains(document.activeElement) && t.closeSurvey();
|
|
1049
|
+
e.key === "Escape" && c.current?.contains(document.activeElement) && (ge(t, l, f, y), t.closeSurvey());
|
|
918
1050
|
};
|
|
919
1051
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
920
1052
|
}, [
|
|
921
|
-
|
|
1053
|
+
S,
|
|
922
1054
|
t,
|
|
923
|
-
o
|
|
1055
|
+
o,
|
|
1056
|
+
y
|
|
924
1057
|
]);
|
|
925
|
-
let
|
|
926
|
-
...ee(
|
|
927
|
-
"--sb-snackbar-duration": `${
|
|
928
|
-
"--sb-snackbar-fraction":
|
|
929
|
-
},
|
|
930
|
-
className: `sb-snackbar-timer sb-snackbar-timer--${
|
|
1058
|
+
let P = x?.selectedKey, F = C && e.barBehavior === "dismiss", I = E.answers?.find((e) => e.id === P), L = I ? I.comment?.trim() || "Thanks for your feedback." : "", B = k, V = !o && e.fabEntranceCompleted && x?.phase === "question", H = x?.deadline != null || x?.pausedRemainingMs != null, U = O !== "none" && typeof b.fab?.expandedTimeout == "number" && b.fab.expandedTimeout > 0, W = {
|
|
1059
|
+
...ee(b.theme),
|
|
1060
|
+
"--sb-snackbar-duration": `${b.fab?.expandedTimeout ?? 0}ms`,
|
|
1061
|
+
"--sb-snackbar-fraction": x?.frozenFraction ?? 1
|
|
1062
|
+
}, G = O === "none" ? null : /* @__PURE__ */ h("span", {
|
|
1063
|
+
className: `sb-snackbar-timer sb-snackbar-timer--${O}`,
|
|
931
1064
|
"aria-hidden": "true",
|
|
932
1065
|
children: /* @__PURE__ */ h("span", { className: "sb-snackbar-timer-fill" })
|
|
933
|
-
}),
|
|
1066
|
+
}), K = /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ g("p", {
|
|
934
1067
|
className: "sb-snackbar-prompt",
|
|
935
|
-
children: [
|
|
1068
|
+
children: [E.prompt, O === "bar" && !C ? G : null]
|
|
936
1069
|
}), /* @__PURE__ */ h("div", {
|
|
937
1070
|
className: "sb-snackbar-answers",
|
|
938
|
-
children: (
|
|
1071
|
+
children: (E.answers ?? []).map((e) => /* @__PURE__ */ h("button", {
|
|
939
1072
|
className: "sb-snackbar-answer",
|
|
940
1073
|
type: "button",
|
|
941
1074
|
"aria-label": e.label,
|
|
942
|
-
"aria-pressed":
|
|
943
|
-
disabled: !
|
|
944
|
-
onClick: () =>
|
|
945
|
-
|
|
1075
|
+
"aria-pressed": P === e.id,
|
|
1076
|
+
disabled: !V,
|
|
1077
|
+
onClick: () => {
|
|
1078
|
+
M(), t.answerSnackbar(y, e.id);
|
|
1079
|
+
},
|
|
1080
|
+
children: n(e) ? /* @__PURE__ */ h(q, {}) : /* @__PURE__ */ h(J, {})
|
|
946
1081
|
}, e.id))
|
|
947
1082
|
})] });
|
|
948
1083
|
return /* @__PURE__ */ g("div", {
|
|
949
1084
|
ref: c,
|
|
950
1085
|
className: "sb-snackbar-root",
|
|
951
|
-
style:
|
|
1086
|
+
style: W,
|
|
952
1087
|
"data-presentation": e.sentimentPresentation,
|
|
953
|
-
"data-position":
|
|
1088
|
+
"data-position": w,
|
|
954
1089
|
"data-behavior": e.barBehavior,
|
|
955
|
-
"data-stage":
|
|
956
|
-
"data-expanded":
|
|
957
|
-
"data-counting":
|
|
958
|
-
"data-paused":
|
|
959
|
-
"data-timed":
|
|
960
|
-
"data-rated":
|
|
1090
|
+
"data-stage": T,
|
|
1091
|
+
"data-expanded": S,
|
|
1092
|
+
"data-counting": H,
|
|
1093
|
+
"data-paused": x?.pausedRemainingMs != null,
|
|
1094
|
+
"data-timed": U,
|
|
1095
|
+
"data-rated": B,
|
|
961
1096
|
"data-exiting": o,
|
|
962
|
-
"data-frozen":
|
|
1097
|
+
"data-frozen": x?.frozenFraction != null,
|
|
963
1098
|
children: [/* @__PURE__ */ h("button", {
|
|
964
1099
|
className: "sb-snackbar-overlay",
|
|
965
1100
|
type: "button",
|
|
966
1101
|
tabIndex: -1,
|
|
967
1102
|
"aria-hidden": "true",
|
|
968
|
-
disabled:
|
|
1103
|
+
disabled: T !== "ready",
|
|
969
1104
|
onClick: () => void t.closeSurvey()
|
|
970
1105
|
}), /* @__PURE__ */ g("div", {
|
|
971
1106
|
className: "sb-snackbar-shell",
|
|
972
1107
|
children: [/* @__PURE__ */ g("div", {
|
|
973
1108
|
className: "sb-snackbar-surface",
|
|
974
1109
|
onPointerEnter: (e) => {
|
|
975
|
-
|
|
1110
|
+
C && !o && e.pointerType === "mouse" && window.matchMedia?.("(hover: hover)").matches && t.setBarTimerPaused(y, !0);
|
|
976
1111
|
},
|
|
977
1112
|
onPointerLeave: () => {
|
|
978
|
-
|
|
1113
|
+
C && !o && t.setBarTimerPaused(y, !1);
|
|
979
1114
|
},
|
|
980
1115
|
children: [/* @__PURE__ */ g("div", {
|
|
981
1116
|
className: "sb-snackbar-compact",
|
|
982
1117
|
role: "group",
|
|
983
|
-
"aria-label":
|
|
984
|
-
"aria-hidden":
|
|
985
|
-
inert:
|
|
1118
|
+
"aria-label": E.prompt,
|
|
1119
|
+
"aria-hidden": S || T === "entering" || o,
|
|
1120
|
+
inert: S || T === "entering" || o,
|
|
986
1121
|
children: [
|
|
987
|
-
|
|
988
|
-
|
|
1122
|
+
O === "fill" || C && O === "bar" ? G : null,
|
|
1123
|
+
C ? null : /* @__PURE__ */ g("span", {
|
|
989
1124
|
className: "sb-snackbar-artwork",
|
|
990
1125
|
"aria-hidden": "true",
|
|
991
1126
|
children: [/* @__PURE__ */ g("span", {
|
|
@@ -997,51 +1132,51 @@ function oe({ session: e, store: t, placement: r, modal: a, exiting: o = !1 }) {
|
|
|
997
1132
|
/* @__PURE__ */ h("span", { className: "sb-fab__glyph sb-fab__glyph--mint" }),
|
|
998
1133
|
/* @__PURE__ */ h("span", { className: "sb-fab__glyph sb-fab__glyph--rose" })
|
|
999
1134
|
]
|
|
1000
|
-
}),
|
|
1001
|
-
src:
|
|
1135
|
+
}), D.imageUrl && !A ? /* @__PURE__ */ h("img", {
|
|
1136
|
+
src: D.imageUrl,
|
|
1002
1137
|
alt: "",
|
|
1003
1138
|
onError: () => j(!0)
|
|
1004
1139
|
}) : null]
|
|
1005
1140
|
}),
|
|
1006
|
-
|
|
1141
|
+
C ? /* @__PURE__ */ h("div", {
|
|
1007
1142
|
className: "sb-bar-content",
|
|
1008
|
-
inert:
|
|
1009
|
-
"aria-hidden":
|
|
1010
|
-
children:
|
|
1011
|
-
}) :
|
|
1012
|
-
|
|
1143
|
+
inert: B,
|
|
1144
|
+
"aria-hidden": B,
|
|
1145
|
+
children: K
|
|
1146
|
+
}) : K,
|
|
1147
|
+
C ? /* @__PURE__ */ h("button", {
|
|
1013
1148
|
className: "sb-bar-dismiss",
|
|
1014
1149
|
type: "button",
|
|
1015
|
-
disabled:
|
|
1016
|
-
onClick:
|
|
1150
|
+
disabled: S || B || o,
|
|
1151
|
+
onClick: N,
|
|
1017
1152
|
children: "Not Now"
|
|
1018
1153
|
}) : null,
|
|
1019
|
-
|
|
1154
|
+
F ? /* @__PURE__ */ h("span", {
|
|
1020
1155
|
className: "sb-bar-acknowledgement",
|
|
1021
1156
|
role: "status",
|
|
1022
1157
|
children: /* @__PURE__ */ h("span", {
|
|
1023
1158
|
className: "sb-bar-acknowledgement-copy",
|
|
1024
|
-
children:
|
|
1159
|
+
children: L
|
|
1025
1160
|
})
|
|
1026
1161
|
}) : null
|
|
1027
1162
|
]
|
|
1028
|
-
}),
|
|
1163
|
+
}), S ? /* @__PURE__ */ h("div", {
|
|
1029
1164
|
className: "sb-snackbar-card",
|
|
1030
|
-
inert:
|
|
1031
|
-
"aria-hidden":
|
|
1032
|
-
children: /* @__PURE__ */ h(
|
|
1165
|
+
inert: T !== "ready",
|
|
1166
|
+
"aria-hidden": T !== "ready",
|
|
1167
|
+
children: /* @__PURE__ */ h(me, {
|
|
1033
1168
|
session: e,
|
|
1034
1169
|
store: t,
|
|
1035
1170
|
modal: a,
|
|
1036
|
-
interactive:
|
|
1171
|
+
interactive: T === "ready"
|
|
1037
1172
|
})
|
|
1038
1173
|
}) : null]
|
|
1039
|
-
}),
|
|
1174
|
+
}), C ? null : /* @__PURE__ */ h("button", {
|
|
1040
1175
|
className: "sb-snackbar-close",
|
|
1041
1176
|
type: "button",
|
|
1042
1177
|
"aria-label": "Close survey",
|
|
1043
|
-
disabled:
|
|
1044
|
-
onClick:
|
|
1178
|
+
disabled: S,
|
|
1179
|
+
onClick: N,
|
|
1045
1180
|
children: /* @__PURE__ */ h("svg", {
|
|
1046
1181
|
viewBox: "0 0 24 24",
|
|
1047
1182
|
"aria-hidden": "true",
|
|
@@ -1058,44 +1193,44 @@ function oe({ session: e, store: t, placement: r, modal: a, exiting: o = !1 }) {
|
|
|
1058
1193
|
}
|
|
1059
1194
|
//#endregion
|
|
1060
1195
|
//#region src/lib/components/SurveyRenderer.tsx
|
|
1061
|
-
var
|
|
1062
|
-
function
|
|
1196
|
+
var X = typeof window > "u" ? s : l, ve = 1969.207, ye = 2169.207, be = 856.839, xe = 450;
|
|
1197
|
+
function Z(e) {
|
|
1063
1198
|
let t = Number.parseFloat(e);
|
|
1064
1199
|
return Number.isFinite(t) ? Math.max(0, t) : 0;
|
|
1065
1200
|
}
|
|
1066
|
-
function
|
|
1201
|
+
function Se(e) {
|
|
1067
1202
|
let t = 0;
|
|
1068
1203
|
for (let n of e) t += /[MW@#%&]/.test(n) ? 11 : /[ilI1.,' ]/.test(n) ? 4 : 7.5;
|
|
1069
1204
|
return Math.ceil(t);
|
|
1070
1205
|
}
|
|
1071
|
-
function
|
|
1206
|
+
function Q() {
|
|
1072
1207
|
return typeof window < "u" && (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1);
|
|
1073
1208
|
}
|
|
1074
|
-
function
|
|
1209
|
+
function $(e) {
|
|
1075
1210
|
if (!e) return null;
|
|
1076
1211
|
let { pulse_id: t, version: n, impression_id: r } = e.survey;
|
|
1077
1212
|
return typeof r == "string" ? `${t}:${n}:${r}` : `${t}:${n}`;
|
|
1078
1213
|
}
|
|
1079
|
-
function
|
|
1214
|
+
function Ce(e) {
|
|
1080
1215
|
if (!e) return;
|
|
1081
1216
|
let t = getComputedStyle(e), n = Number.parseFloat(t.width) || e.offsetWidth || 86, r = Number.parseFloat(e.style.getPropertyValue("--sb-fab-expanded-width")) || n, i = Number.parseFloat(e.style.getPropertyValue("--sb-fab-anchor-offset")) || 0, a = r === 60 ? 0 : i / (r - 60), o = e.querySelector(".sb-fab__label"), s = e.querySelector(".sb-fab__timer");
|
|
1082
1217
|
e.style.setProperty("--sb-fab-exit-width", `${n}px`), e.style.setProperty("--sb-fab-exit-offset", `${(r - n) * a}px`), e.style.setProperty("--sb-fab-exit-scale", t.getPropertyValue("scale") || "1"), e.style.setProperty("--sb-fab-exit-label-opacity", o ? getComputedStyle(o).opacity : "0"), e.style.setProperty("--sb-fab-exit-timer-opacity", s ? getComputedStyle(s).opacity : "0");
|
|
1083
1218
|
}
|
|
1084
|
-
function
|
|
1085
|
-
let [i, a] = d(e), [o, c] = d(null), l =
|
|
1086
|
-
return
|
|
1219
|
+
function we({ session: e, store: t, fabRef: n, onClick: r }) {
|
|
1220
|
+
let [i, a] = d(e), [o, c] = d(null), l = $(e), u = e?.survey.fab, f = (u?.timerStyle === "bar" || u?.timerStyle === "fill") && typeof u.expandedTimeout == "number" && Number.isFinite(u.expandedTimeout) && u.expandedTimeout > 0, p = e ?? i;
|
|
1221
|
+
return X(() => {
|
|
1087
1222
|
e && a(e);
|
|
1088
|
-
}, [e]),
|
|
1089
|
-
!e && i &&
|
|
1223
|
+
}, [e]), X(() => {
|
|
1224
|
+
!e && i && Ce(n.current);
|
|
1090
1225
|
}, [
|
|
1091
1226
|
n,
|
|
1092
1227
|
i,
|
|
1093
1228
|
e
|
|
1094
1229
|
]), s(() => {
|
|
1095
1230
|
if (!l) return;
|
|
1096
|
-
let e =
|
|
1231
|
+
let e = Q(), n = setTimeout(() => {
|
|
1097
1232
|
t.confirmPresentation("expanded_fab"), t.confirmFabEntranceCompleted();
|
|
1098
|
-
}, e ? 0 :
|
|
1233
|
+
}, e ? 0 : ve), r = setTimeout(() => c(l), e ? 0 : f ? ye : ve);
|
|
1099
1234
|
return () => {
|
|
1100
1235
|
clearTimeout(n), clearTimeout(r);
|
|
1101
1236
|
};
|
|
@@ -1105,44 +1240,44 @@ function de({ session: e, store: t, fabRef: n, onClick: r }) {
|
|
|
1105
1240
|
t
|
|
1106
1241
|
]), s(() => {
|
|
1107
1242
|
if (e || !i) return;
|
|
1108
|
-
let t = setTimeout(() => a(null),
|
|
1243
|
+
let t = setTimeout(() => a(null), Q() ? 0 : be);
|
|
1109
1244
|
return () => clearTimeout(t);
|
|
1110
|
-
}, [i, e]), p ? /* @__PURE__ */ h(
|
|
1245
|
+
}, [i, e]), p ? /* @__PURE__ */ h(ie, {
|
|
1111
1246
|
session: p,
|
|
1112
1247
|
fabRef: n,
|
|
1113
1248
|
onClick: r,
|
|
1114
1249
|
animationState: e ? o === l ? "visible" : "entering" : "exiting"
|
|
1115
1250
|
}) : null;
|
|
1116
1251
|
}
|
|
1117
|
-
function
|
|
1252
|
+
function Te({ session: e, store: t, modal: n }) {
|
|
1118
1253
|
let [r, i] = d(e), a = u(null), o = e ?? r;
|
|
1119
|
-
return
|
|
1254
|
+
return X(() => {
|
|
1120
1255
|
e && i(e);
|
|
1121
|
-
}, [e]),
|
|
1256
|
+
}, [e]), X(() => {
|
|
1122
1257
|
let t = a.current;
|
|
1123
1258
|
!t || e || (t.classList.add("sb-sheet-root--exiting"), t.setAttribute("aria-hidden", "true"), t.querySelectorAll("button").forEach((e) => {
|
|
1124
1259
|
e.disabled = !0;
|
|
1125
1260
|
}));
|
|
1126
1261
|
}, [e]), s(() => {
|
|
1127
1262
|
if (e || !r) return;
|
|
1128
|
-
let t = setTimeout(() => i(null),
|
|
1263
|
+
let t = setTimeout(() => i(null), Q() ? 0 : xe);
|
|
1129
1264
|
return () => clearTimeout(t);
|
|
1130
|
-
}, [r, e]), o ? /* @__PURE__ */ h(
|
|
1265
|
+
}, [r, e]), o ? /* @__PURE__ */ h(me, {
|
|
1131
1266
|
session: o,
|
|
1132
1267
|
store: t,
|
|
1133
1268
|
modal: n,
|
|
1134
1269
|
rootRef: a
|
|
1135
|
-
},
|
|
1270
|
+
}, $(o)) : null;
|
|
1136
1271
|
}
|
|
1137
|
-
function
|
|
1272
|
+
function Ee({ session: e, store: t, placement: n, modal: r }) {
|
|
1138
1273
|
let [i, a] = d(e), o = e ?? i;
|
|
1139
|
-
return
|
|
1274
|
+
return X(() => {
|
|
1140
1275
|
e && a(e);
|
|
1141
1276
|
}, [e]), s(() => {
|
|
1142
1277
|
if (e || !i) return;
|
|
1143
|
-
let t = i.sentimentPresentation === "bar" ?
|
|
1278
|
+
let t = i.sentimentPresentation === "bar" ? Q() ? z.reduced : z.removal : 0, n = setTimeout(() => a(null), t);
|
|
1144
1279
|
return () => clearTimeout(n);
|
|
1145
|
-
}, [e, i]), !o || !e && o.sentimentPresentation !== "bar" ? null : /* @__PURE__ */ h(
|
|
1280
|
+
}, [e, i]), !o || !e && o.sentimentPresentation !== "bar" ? null : /* @__PURE__ */ h(_e, {
|
|
1146
1281
|
session: o,
|
|
1147
1282
|
store: t,
|
|
1148
1283
|
placement: n,
|
|
@@ -1150,19 +1285,19 @@ function pe({ session: e, store: t, placement: n, modal: r }) {
|
|
|
1150
1285
|
exiting: !e
|
|
1151
1286
|
}, o.presentationId);
|
|
1152
1287
|
}
|
|
1153
|
-
function
|
|
1288
|
+
function De({ store: e, portal: t = !0, placement: n = "fixed" }) {
|
|
1154
1289
|
let r = f(o((t) => e.subscribe(t), [e]), o(() => e.getSnapshot(), [e]), o(() => e.getServerSnapshot(), [e])).state, i = u(null), a = u(null), c = u(null), l = u(null), d = r ? r.completion ? "completion" : r.isOpen ? `sheet:${r.currentNodeId}` : `fab:${r.fabState}` : "none";
|
|
1155
|
-
|
|
1290
|
+
X(() => {
|
|
1156
1291
|
if (!r || !i.current) return;
|
|
1157
|
-
let e =
|
|
1292
|
+
let e = I(r.survey.theme);
|
|
1158
1293
|
for (let [t, n] of Object.entries(e)) i.current.style.setProperty(t, n);
|
|
1159
1294
|
}, [r]), s(() => {
|
|
1160
1295
|
let t = e.getState();
|
|
1161
1296
|
if (!t) {
|
|
1162
|
-
let e = i.current?.querySelector("[data-presentation=\"bar\"][data-exiting=\"true\"]"), t = i.current?.querySelector(".sb-fab--exiting") ?
|
|
1297
|
+
let e = i.current?.querySelector("[data-presentation=\"bar\"][data-exiting=\"true\"]"), t = i.current?.querySelector(".sb-fab--exiting") ? be : xe, n = setTimeout(() => {
|
|
1163
1298
|
let e = l.current;
|
|
1164
1299
|
e?.isConnected ? e.focus() : e && i.current?.focus(), l.current = null;
|
|
1165
|
-
}, e ?
|
|
1300
|
+
}, e ? Q() ? z.reduced : z.removal : Q() ? 0 : t);
|
|
1166
1301
|
return () => clearTimeout(n);
|
|
1167
1302
|
}
|
|
1168
1303
|
if (t.isOpen || t.completion) {
|
|
@@ -1170,22 +1305,22 @@ function me({ store: e, portal: t = !0, placement: n = "fixed" }) {
|
|
|
1170
1305
|
e.confirmPresentation("sheet"), (i.current?.querySelector("textarea[data-autofocus=\"true\"]") ?? i.current?.querySelector(".sb-sheet__body h2"))?.focus({ preventScroll: !0 });
|
|
1171
1306
|
}
|
|
1172
1307
|
t.snackbar && !l.current && document.activeElement instanceof HTMLElement && (l.current = document.activeElement);
|
|
1173
|
-
}, [d, e]),
|
|
1308
|
+
}, [d, e]), X(() => {
|
|
1174
1309
|
let e = a.current, t = i.current;
|
|
1175
1310
|
if (!e || !t || !r || r.fabState !== "expanded" || r.isOpen) return;
|
|
1176
1311
|
let o = () => {
|
|
1177
1312
|
let e = a.current;
|
|
1178
1313
|
if (!e || !c.current) return;
|
|
1179
1314
|
let i = window.visualViewport, o = n === "inline" ? t.getBoundingClientRect() : null, s = n === "inline" ? t.clientWidth || o.width : i?.width && i.width > 0 ? i.width : window.innerWidth, l = n === "inline" ? t.clientHeight || o.height : i?.height && i.height > 0 ? i.height : window.innerHeight, u = e.getBoundingClientRect(), d = getComputedStyle(c.current), f = {
|
|
1180
|
-
top:
|
|
1181
|
-
right:
|
|
1182
|
-
bottom:
|
|
1183
|
-
left:
|
|
1184
|
-
}, p = Math.max(0, s - f.left - f.right), m = e.querySelector(".sb-fab__label"), h = m ? m.scrollWidth || m.getBoundingClientRect().width ||
|
|
1315
|
+
top: Z(d.paddingTop),
|
|
1316
|
+
right: Z(d.paddingRight),
|
|
1317
|
+
bottom: Z(d.paddingBottom),
|
|
1318
|
+
left: Z(d.paddingLeft)
|
|
1319
|
+
}, p = Math.max(0, s - f.left - f.right), m = e.querySelector(".sb-fab__label"), h = m ? m.scrollWidth || m.getBoundingClientRect().width || Se(m.textContent ?? "") : 0, g = Math.min(p, Math.max(86, 86 + Math.ceil(h))), _ = e.offsetHeight || u.height || 60;
|
|
1185
1320
|
e.style.setProperty("--sb-fab-expanded-width", `${g}px`), e.style.setProperty("--sb-fab-label-width", `${Math.max(0, g - 86)}px`);
|
|
1186
1321
|
let v = Math.max(0, Math.min(1, r.survey.fab?.placement?.anchor.x ?? 1));
|
|
1187
1322
|
e.style.setProperty("--sb-fab-anchor-offset", `${(g - 60) * v}px`);
|
|
1188
|
-
let y =
|
|
1323
|
+
let y = G(r.survey.fab?.placement, {
|
|
1189
1324
|
viewport: {
|
|
1190
1325
|
width: s,
|
|
1191
1326
|
height: l
|
|
@@ -1232,21 +1367,21 @@ function me({ store: e, portal: t = !0, placement: n = "fixed" }) {
|
|
|
1232
1367
|
ref: c,
|
|
1233
1368
|
className: "sb-safe-area-probe"
|
|
1234
1369
|
}),
|
|
1235
|
-
/* @__PURE__ */ h(
|
|
1370
|
+
/* @__PURE__ */ h(Ee, {
|
|
1236
1371
|
session: r?.snackbar ? r : null,
|
|
1237
1372
|
store: e,
|
|
1238
1373
|
placement: n,
|
|
1239
1374
|
modal: t
|
|
1240
1375
|
}),
|
|
1241
|
-
/* @__PURE__ */ h(
|
|
1376
|
+
/* @__PURE__ */ h(we, {
|
|
1242
1377
|
session: r && !r.snackbar && !r.isOpen && !r.completion && r.fabState === "expanded" ? r : null,
|
|
1243
1378
|
store: e,
|
|
1244
1379
|
fabRef: a,
|
|
1245
1380
|
onClick: () => {
|
|
1246
|
-
|
|
1381
|
+
Ce(a.current), l.current = a.current, e.openSurvey();
|
|
1247
1382
|
}
|
|
1248
1383
|
}),
|
|
1249
|
-
/* @__PURE__ */ h(
|
|
1384
|
+
/* @__PURE__ */ h(Te, {
|
|
1250
1385
|
session: r && !r.snackbar && (r.isOpen || r.completion) ? r : null,
|
|
1251
1386
|
store: e,
|
|
1252
1387
|
modal: t
|
|
@@ -1256,4 +1391,4 @@ function me({ store: e, portal: t = !0, placement: n = "fixed" }) {
|
|
|
1256
1391
|
return t && typeof document < "u" ? p(m, document.body) : m;
|
|
1257
1392
|
}
|
|
1258
1393
|
//#endregion
|
|
1259
|
-
export {
|
|
1394
|
+
export { De as t };
|