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