@telia/teddy 0.0.12 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/assets/{5161b177f001ea1a.svg → 4bbd022cee9b0f06.svg} +12 -9
  2. package/dist/assets/badge.css +1 -1
  3. package/dist/assets/main.css +1 -1
  4. package/dist/badge-Cnug5TzH.js +1855 -0
  5. package/dist/components/accordion/accordion.js +2 -2
  6. package/dist/components/accordion/index.js +1 -1
  7. package/dist/components/badge/badge.js +2 -2
  8. package/dist/components/badge/index.js +1 -1
  9. package/dist/components/card/card.d.ts +13 -9
  10. package/dist/components/card/card.js +2 -2
  11. package/dist/components/card/index.js +1 -1
  12. package/dist/components/field-error-text/field-error-text.js +1 -1
  13. package/dist/components/icon/icon.js +1 -1
  14. package/dist/components/icon/index.js +1 -1
  15. package/dist/components/index.js +2 -2
  16. package/dist/components/input/input.js +1 -1
  17. package/dist/components/modal/index.js +1 -1
  18. package/dist/components/modal/modal.js +2 -2
  19. package/dist/components/notification/index.js +1 -1
  20. package/dist/components/notification/notification.d.ts +36 -5
  21. package/dist/components/notification/notification.js +2 -2
  22. package/dist/components/toggle/index.js +1 -1
  23. package/dist/components/toggle/toggle.d.ts +1 -1
  24. package/dist/components/toggle/toggle.js +2 -2
  25. package/dist/icons/category.d.ts +60 -57
  26. package/dist/icons/category.js +53 -52
  27. package/dist/icons/name.d.ts +1 -1
  28. package/dist/icons/name.js +4 -3
  29. package/dist/main.js +2 -2
  30. package/dist/utils/layout/index.d.ts +3 -1
  31. package/dist/utils/layout/index.js +28 -24
  32. package/dist/utils/layout/inset.d.ts +478 -0
  33. package/dist/utils/layout/inset.js +32 -0
  34. package/dist/utils/layout/position.d.ts +64 -0
  35. package/dist/utils/layout/position.js +20 -0
  36. package/package.json +1 -1
  37. package/dist/badge-DscsRVHR.js +0 -1825
@@ -1,1825 +0,0 @@
1
- import './assets/badge.css';
2
- import { jsx as l, Fragment as ft, jsxs as Oe } from "react/jsx-runtime";
3
- import { c as w } from "./clsx-DB4S2d7J.js";
4
- import * as _ from "react";
5
- import s, { forwardRef as A, useState as pe, useRef as S, useEffect as W, useCallback as De, createElement as y, Fragment as hn, Children as yn } from "react";
6
- import { b as U, _ as x, $ as Me, a as bt } from "./index-DpfSJps6.js";
7
- import { d as ze, a as me, h as ge, e as V, c as ee, f as ne, g as Cn, i as wn, $ as xn, b as En } from "./index-FPIZOCcD.js";
8
- import { $ as Rn } from "./navigation-menu-DKuyW8zE.js";
9
- import { $ as T } from "./index-DM5e-Whg.js";
10
- import Nn from "react-dom";
11
- import { $ as An } from "./radio-group-B--zT3OL.js";
12
- import "./components/box/box.js";
13
- import { Flex as Ie } from "./components/flex/flex.js";
14
- import "./components/grid/grid.js";
15
- import "./assets/5161b177f001ea1a.svg";
16
- import { Icon as te } from "./components/icon/icon.js";
17
- import { Link as In } from "./components/link/link.js";
18
- import { Button as Fe } from "./components/button/button.js";
19
- import "./components/field-error-text/field-error-text.js";
20
- import "./components/helper-text/helper-text.js";
21
- import "./components/input/input.js";
22
- import { Label as Sn } from "./components/label/label.js";
23
- import "./components/spinner/spinner.js";
24
- import { Text as pt } from "./components/text/text.js";
25
- import "./components/text-field/text-field.js";
26
- import { Heading as re } from "./components/heading/heading.js";
27
- import "./components/visually-hidden/visually-hidden.js";
28
- import { TextSpacing as kn } from "./components/text-spacing/text-spacing.js";
29
- import { composeRefs as Le } from "./utils/composeRefs.js";
30
- import { composeEventHandlers as Tn } from "./utils/composeEventHandlers.js";
31
- const Ce = "focusScope.autoFocusOnMount", we = "focusScope.autoFocusOnUnmount", Ze = {
32
- bubbles: !1,
33
- cancelable: !0
34
- }, Pn = /* @__PURE__ */ A((e, n) => {
35
- const { loop: t = !1, trapped: o = !1, onMountAutoFocus: r, onUnmountAutoFocus: a, ...i } = e, [c, u] = pe(null), b = ze(r), p = ze(a), f = S(null), v = U(
36
- n,
37
- (d) => u(d)
38
- ), C = S({
39
- paused: !1,
40
- pause() {
41
- this.paused = !0;
42
- },
43
- resume() {
44
- this.paused = !1;
45
- }
46
- }).current;
47
- W(() => {
48
- if (o) {
49
- let d = function($) {
50
- if (C.paused || !c)
51
- return;
52
- const E = $.target;
53
- c.contains(E) ? f.current = E : H(f.current, {
54
- select: !0
55
- });
56
- }, m = function($) {
57
- if (C.paused || !c)
58
- return;
59
- const E = $.relatedTarget;
60
- E !== null && (c.contains(E) || H(f.current, {
61
- select: !0
62
- }));
63
- }, g = function($) {
64
- if (document.activeElement === document.body)
65
- for (const N of $)
66
- N.removedNodes.length > 0 && H(c);
67
- };
68
- document.addEventListener("focusin", d), document.addEventListener("focusout", m);
69
- const h = new MutationObserver(g);
70
- return c && h.observe(c, {
71
- childList: !0,
72
- subtree: !0
73
- }), () => {
74
- document.removeEventListener("focusin", d), document.removeEventListener("focusout", m), h.disconnect();
75
- };
76
- }
77
- }, [
78
- o,
79
- c,
80
- C.paused
81
- ]), W(() => {
82
- if (c) {
83
- Je.add(C);
84
- const d = document.activeElement;
85
- if (!c.contains(d)) {
86
- const g = new CustomEvent(Ce, Ze);
87
- c.addEventListener(Ce, b), c.dispatchEvent(g), g.defaultPrevented || (On(Bn(mt(c)), {
88
- select: !0
89
- }), document.activeElement === d && H(c));
90
- }
91
- return () => {
92
- c.removeEventListener(Ce, b), setTimeout(() => {
93
- const g = new CustomEvent(we, Ze);
94
- c.addEventListener(we, p), c.dispatchEvent(g), g.defaultPrevented || H(d ?? document.body, {
95
- select: !0
96
- }), c.removeEventListener(we, p), Je.remove(C);
97
- }, 0);
98
- };
99
- }
100
- }, [
101
- c,
102
- b,
103
- p,
104
- C
105
- ]);
106
- const R = De((d) => {
107
- if (!t && !o || C.paused)
108
- return;
109
- const m = d.key === "Tab" && !d.altKey && !d.ctrlKey && !d.metaKey, g = document.activeElement;
110
- if (m && g) {
111
- const h = d.currentTarget, [$, E] = Dn(h);
112
- $ && E ? !d.shiftKey && g === E ? (d.preventDefault(), t && H($, {
113
- select: !0
114
- })) : d.shiftKey && g === $ && (d.preventDefault(), t && H(E, {
115
- select: !0
116
- })) : g === h && d.preventDefault();
117
- }
118
- }, [
119
- t,
120
- o,
121
- C.paused
122
- ]);
123
- return /* @__PURE__ */ y(T.div, x({
124
- tabIndex: -1
125
- }, i, {
126
- ref: v,
127
- onKeyDown: R
128
- }));
129
- });
130
- function On(e, { select: n = !1 } = {}) {
131
- const t = document.activeElement;
132
- for (const o of e)
133
- if (H(o, {
134
- select: n
135
- }), document.activeElement !== t)
136
- return;
137
- }
138
- function Dn(e) {
139
- const n = mt(e), t = Qe(n, e), o = Qe(n.reverse(), e);
140
- return [
141
- t,
142
- o
143
- ];
144
- }
145
- function mt(e) {
146
- const n = [], t = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
147
- acceptNode: (o) => {
148
- const r = o.tagName === "INPUT" && o.type === "hidden";
149
- return o.disabled || o.hidden || r ? NodeFilter.FILTER_SKIP : o.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
150
- }
151
- });
152
- for (; t.nextNode(); )
153
- n.push(t.currentNode);
154
- return n;
155
- }
156
- function Qe(e, n) {
157
- for (const t of e)
158
- if (!Mn(t, {
159
- upTo: n
160
- }))
161
- return t;
162
- }
163
- function Mn(e, { upTo: n }) {
164
- if (getComputedStyle(e).visibility === "hidden")
165
- return !0;
166
- for (; e; ) {
167
- if (n !== void 0 && e === n)
168
- return !1;
169
- if (getComputedStyle(e).display === "none")
170
- return !0;
171
- e = e.parentElement;
172
- }
173
- return !1;
174
- }
175
- function Fn(e) {
176
- return e instanceof HTMLInputElement && "select" in e;
177
- }
178
- function H(e, { select: n = !1 } = {}) {
179
- if (e && e.focus) {
180
- const t = document.activeElement;
181
- e.focus({
182
- preventScroll: !0
183
- }), e !== t && Fn(e) && n && e.select();
184
- }
185
- }
186
- const Je = Ln();
187
- function Ln() {
188
- let e = [];
189
- return {
190
- add(n) {
191
- const t = e[0];
192
- n !== t && (t == null || t.pause()), e = et(e, n), e.unshift(n);
193
- },
194
- remove(n) {
195
- var t;
196
- e = et(e, n), (t = e[0]) === null || t === void 0 || t.resume();
197
- }
198
- };
199
- }
200
- function et(e, n) {
201
- const t = [
202
- ...e
203
- ], o = t.indexOf(n);
204
- return o !== -1 && t.splice(o, 1), t;
205
- }
206
- function Bn(e) {
207
- return e.filter(
208
- (n) => n.tagName !== "A"
209
- );
210
- }
211
- const Hn = /* @__PURE__ */ A((e, n) => {
212
- var t;
213
- const { container: o = globalThis == null || (t = globalThis.document) === null || t === void 0 ? void 0 : t.body, ...r } = e;
214
- return o ? /* @__PURE__ */ Nn.createPortal(/* @__PURE__ */ y(T.div, x({}, r, {
215
- ref: n
216
- })), o) : null;
217
- });
218
- let xe = 0;
219
- function Vn() {
220
- W(() => {
221
- var e, n;
222
- const t = document.querySelectorAll("[data-radix-focus-guard]");
223
- return document.body.insertAdjacentElement("afterbegin", (e = t[0]) !== null && e !== void 0 ? e : tt()), document.body.insertAdjacentElement("beforeend", (n = t[1]) !== null && n !== void 0 ? n : tt()), xe++, () => {
224
- xe === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach(
225
- (o) => o.remove()
226
- ), xe--;
227
- };
228
- }, []);
229
- }
230
- function tt() {
231
- const e = document.createElement("span");
232
- return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.cssText = "outline: none; opacity: 0; position: fixed; pointer-events: none", e;
233
- }
234
- var O = function() {
235
- return O = Object.assign || function(n) {
236
- for (var t, o = 1, r = arguments.length; o < r; o++) {
237
- t = arguments[o];
238
- for (var a in t)
239
- Object.prototype.hasOwnProperty.call(t, a) && (n[a] = t[a]);
240
- }
241
- return n;
242
- }, O.apply(this, arguments);
243
- };
244
- function gt(e, n) {
245
- var t = {};
246
- for (var o in e)
247
- Object.prototype.hasOwnProperty.call(e, o) && n.indexOf(o) < 0 && (t[o] = e[o]);
248
- if (e != null && typeof Object.getOwnPropertySymbols == "function")
249
- for (var r = 0, o = Object.getOwnPropertySymbols(e); r < o.length; r++)
250
- n.indexOf(o[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[r]) && (t[o[r]] = e[o[r]]);
251
- return t;
252
- }
253
- function Wn(e, n, t) {
254
- if (t || arguments.length === 2)
255
- for (var o = 0, r = n.length, a; o < r; o++)
256
- (a || !(o in n)) && (a || (a = Array.prototype.slice.call(n, 0, o)), a[o] = n[o]);
257
- return e.concat(a || Array.prototype.slice.call(n));
258
- }
259
- var fe = "right-scroll-bar-position", be = "width-before-scroll-bar", jn = "with-scroll-bars-hidden", qn = "--removed-body-scroll-bar-size";
260
- function Ee(e, n) {
261
- return typeof e == "function" ? e(n) : e && (e.current = n), e;
262
- }
263
- function Un(e, n) {
264
- var t = pe(function() {
265
- return {
266
- // value
267
- value: e,
268
- // last callback
269
- callback: n,
270
- // "memoized" public interface
271
- facade: {
272
- get current() {
273
- return t.value;
274
- },
275
- set current(o) {
276
- var r = t.value;
277
- r !== o && (t.value = o, t.callback(o, r));
278
- }
279
- }
280
- };
281
- })[0];
282
- return t.callback = n, t.facade;
283
- }
284
- var Gn = typeof window < "u" ? _.useLayoutEffect : _.useEffect, nt = /* @__PURE__ */ new WeakMap();
285
- function Kn(e, n) {
286
- var t = Un(n || null, function(o) {
287
- return e.forEach(function(r) {
288
- return Ee(r, o);
289
- });
290
- });
291
- return Gn(function() {
292
- var o = nt.get(t);
293
- if (o) {
294
- var r = new Set(o), a = new Set(e), i = t.current;
295
- r.forEach(function(c) {
296
- a.has(c) || Ee(c, null);
297
- }), a.forEach(function(c) {
298
- r.has(c) || Ee(c, i);
299
- });
300
- }
301
- nt.set(t, e);
302
- }, [e]), t;
303
- }
304
- function Xn(e) {
305
- return e;
306
- }
307
- function Yn(e, n) {
308
- n === void 0 && (n = Xn);
309
- var t = [], o = !1, r = {
310
- read: function() {
311
- if (o)
312
- throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
313
- return t.length ? t[t.length - 1] : e;
314
- },
315
- useMedium: function(a) {
316
- var i = n(a, o);
317
- return t.push(i), function() {
318
- t = t.filter(function(c) {
319
- return c !== i;
320
- });
321
- };
322
- },
323
- assignSyncMedium: function(a) {
324
- for (o = !0; t.length; ) {
325
- var i = t;
326
- t = [], i.forEach(a);
327
- }
328
- t = {
329
- push: function(c) {
330
- return a(c);
331
- },
332
- filter: function() {
333
- return t;
334
- }
335
- };
336
- },
337
- assignMedium: function(a) {
338
- o = !0;
339
- var i = [];
340
- if (t.length) {
341
- var c = t;
342
- t = [], c.forEach(a), i = t;
343
- }
344
- var u = function() {
345
- var p = i;
346
- i = [], p.forEach(a);
347
- }, b = function() {
348
- return Promise.resolve().then(u);
349
- };
350
- b(), t = {
351
- push: function(p) {
352
- i.push(p), b();
353
- },
354
- filter: function(p) {
355
- return i = i.filter(p), t;
356
- }
357
- };
358
- }
359
- };
360
- return r;
361
- }
362
- function zn(e) {
363
- e === void 0 && (e = {});
364
- var n = Yn(null);
365
- return n.options = O({ async: !0, ssr: !1 }, e), n;
366
- }
367
- var _t = function(e) {
368
- var n = e.sideCar, t = gt(e, ["sideCar"]);
369
- if (!n)
370
- throw new Error("Sidecar: please provide `sideCar` property to import the right car");
371
- var o = n.read();
372
- if (!o)
373
- throw new Error("Sidecar medium not found");
374
- return _.createElement(o, O({}, t));
375
- };
376
- _t.isSideCarExport = !0;
377
- function Zn(e, n) {
378
- return e.useMedium(n), _t;
379
- }
380
- var vt = zn(), Re = function() {
381
- }, _e = _.forwardRef(function(e, n) {
382
- var t = _.useRef(null), o = _.useState({
383
- onScrollCapture: Re,
384
- onWheelCapture: Re,
385
- onTouchMoveCapture: Re
386
- }), r = o[0], a = o[1], i = e.forwardProps, c = e.children, u = e.className, b = e.removeScrollBar, p = e.enabled, f = e.shards, v = e.sideCar, C = e.noIsolation, R = e.inert, d = e.allowPinchZoom, m = e.as, g = m === void 0 ? "div" : m, h = gt(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as"]), $ = v, E = Kn([t, n]), N = O(O({}, h), r);
387
- return _.createElement(
388
- _.Fragment,
389
- null,
390
- p && _.createElement($, { sideCar: vt, removeScrollBar: b, shards: f, noIsolation: C, inert: R, setCallbacks: a, allowPinchZoom: !!d, lockRef: t }),
391
- i ? _.cloneElement(_.Children.only(c), O(O({}, N), { ref: E })) : _.createElement(g, O({}, N, { className: u, ref: E }), c)
392
- );
393
- });
394
- _e.defaultProps = {
395
- enabled: !0,
396
- removeScrollBar: !0,
397
- inert: !1
398
- };
399
- _e.classNames = {
400
- fullWidth: be,
401
- zeroRight: fe
402
- };
403
- var Qn = function() {
404
- if (typeof __webpack_nonce__ < "u")
405
- return __webpack_nonce__;
406
- };
407
- function Jn() {
408
- if (!document)
409
- return null;
410
- var e = document.createElement("style");
411
- e.type = "text/css";
412
- var n = Qn();
413
- return n && e.setAttribute("nonce", n), e;
414
- }
415
- function eo(e, n) {
416
- e.styleSheet ? e.styleSheet.cssText = n : e.appendChild(document.createTextNode(n));
417
- }
418
- function to(e) {
419
- var n = document.head || document.getElementsByTagName("head")[0];
420
- n.appendChild(e);
421
- }
422
- var no = function() {
423
- var e = 0, n = null;
424
- return {
425
- add: function(t) {
426
- e == 0 && (n = Jn()) && (eo(n, t), to(n)), e++;
427
- },
428
- remove: function() {
429
- e--, !e && n && (n.parentNode && n.parentNode.removeChild(n), n = null);
430
- }
431
- };
432
- }, oo = function() {
433
- var e = no();
434
- return function(n, t) {
435
- _.useEffect(function() {
436
- return e.add(n), function() {
437
- e.remove();
438
- };
439
- }, [n && t]);
440
- };
441
- }, $t = function() {
442
- var e = oo(), n = function(t) {
443
- var o = t.styles, r = t.dynamic;
444
- return e(o, r), null;
445
- };
446
- return n;
447
- }, ro = {
448
- left: 0,
449
- top: 0,
450
- right: 0,
451
- gap: 0
452
- }, Ne = function(e) {
453
- return parseInt(e || "", 10) || 0;
454
- }, ao = function(e) {
455
- var n = window.getComputedStyle(document.body), t = n[e === "padding" ? "paddingLeft" : "marginLeft"], o = n[e === "padding" ? "paddingTop" : "marginTop"], r = n[e === "padding" ? "paddingRight" : "marginRight"];
456
- return [Ne(t), Ne(o), Ne(r)];
457
- }, co = function(e) {
458
- if (e === void 0 && (e = "margin"), typeof window > "u")
459
- return ro;
460
- var n = ao(e), t = document.documentElement.clientWidth, o = window.innerWidth;
461
- return {
462
- left: n[0],
463
- top: n[1],
464
- right: n[2],
465
- gap: Math.max(0, o - t + n[2] - n[0])
466
- };
467
- }, io = $t(), Z = "data-scroll-locked", so = function(e, n, t, o) {
468
- var r = e.left, a = e.top, i = e.right, c = e.gap;
469
- return t === void 0 && (t = "margin"), `
470
- .`.concat(jn, ` {
471
- overflow: hidden `).concat(o, `;
472
- padding-right: `).concat(c, "px ").concat(o, `;
473
- }
474
- body[`).concat(Z, `] {
475
- overflow: hidden `).concat(o, `;
476
- overscroll-behavior: contain;
477
- `).concat([
478
- n && "position: relative ".concat(o, ";"),
479
- t === "margin" && `
480
- padding-left: `.concat(r, `px;
481
- padding-top: `).concat(a, `px;
482
- padding-right: `).concat(i, `px;
483
- margin-left:0;
484
- margin-top:0;
485
- margin-right: `).concat(c, "px ").concat(o, `;
486
- `),
487
- t === "padding" && "padding-right: ".concat(c, "px ").concat(o, ";")
488
- ].filter(Boolean).join(""), `
489
- }
490
-
491
- .`).concat(fe, ` {
492
- right: `).concat(c, "px ").concat(o, `;
493
- }
494
-
495
- .`).concat(be, ` {
496
- margin-right: `).concat(c, "px ").concat(o, `;
497
- }
498
-
499
- .`).concat(fe, " .").concat(fe, ` {
500
- right: 0 `).concat(o, `;
501
- }
502
-
503
- .`).concat(be, " .").concat(be, ` {
504
- margin-right: 0 `).concat(o, `;
505
- }
506
-
507
- body[`).concat(Z, `] {
508
- `).concat(qn, ": ").concat(c, `px;
509
- }
510
- `);
511
- }, ot = function() {
512
- var e = parseInt(document.body.getAttribute(Z) || "0", 10);
513
- return isFinite(e) ? e : 0;
514
- }, lo = function() {
515
- _.useEffect(function() {
516
- return document.body.setAttribute(Z, (ot() + 1).toString()), function() {
517
- var e = ot() - 1;
518
- e <= 0 ? document.body.removeAttribute(Z) : document.body.setAttribute(Z, e.toString());
519
- };
520
- }, []);
521
- }, uo = function(e) {
522
- var n = e.noRelative, t = e.noImportant, o = e.gapMode, r = o === void 0 ? "margin" : o;
523
- lo();
524
- var a = _.useMemo(function() {
525
- return co(r);
526
- }, [r]);
527
- return _.createElement(io, { styles: so(a, !n, r, t ? "" : "!important") });
528
- }, Se = !1;
529
- if (typeof window < "u")
530
- try {
531
- var se = Object.defineProperty({}, "passive", {
532
- get: function() {
533
- return Se = !0, !0;
534
- }
535
- });
536
- window.addEventListener("test", se, se), window.removeEventListener("test", se, se);
537
- } catch {
538
- Se = !1;
539
- }
540
- var X = Se ? { passive: !1 } : !1, fo = function(e) {
541
- return e.tagName === "TEXTAREA";
542
- }, ht = function(e, n) {
543
- var t = window.getComputedStyle(e);
544
- return (
545
- // not-not-scrollable
546
- t[n] !== "hidden" && // contains scroll inside self
547
- !(t.overflowY === t.overflowX && !fo(e) && t[n] === "visible")
548
- );
549
- }, bo = function(e) {
550
- return ht(e, "overflowY");
551
- }, po = function(e) {
552
- return ht(e, "overflowX");
553
- }, rt = function(e, n) {
554
- var t = n;
555
- do {
556
- typeof ShadowRoot < "u" && t instanceof ShadowRoot && (t = t.host);
557
- var o = yt(e, t);
558
- if (o) {
559
- var r = Ct(e, t), a = r[1], i = r[2];
560
- if (a > i)
561
- return !0;
562
- }
563
- t = t.parentNode;
564
- } while (t && t !== document.body);
565
- return !1;
566
- }, mo = function(e) {
567
- var n = e.scrollTop, t = e.scrollHeight, o = e.clientHeight;
568
- return [
569
- n,
570
- t,
571
- o
572
- ];
573
- }, go = function(e) {
574
- var n = e.scrollLeft, t = e.scrollWidth, o = e.clientWidth;
575
- return [
576
- n,
577
- t,
578
- o
579
- ];
580
- }, yt = function(e, n) {
581
- return e === "v" ? bo(n) : po(n);
582
- }, Ct = function(e, n) {
583
- return e === "v" ? mo(n) : go(n);
584
- }, _o = function(e, n) {
585
- return e === "h" && n === "rtl" ? -1 : 1;
586
- }, vo = function(e, n, t, o, r) {
587
- var a = _o(e, window.getComputedStyle(n).direction), i = a * o, c = t.target, u = n.contains(c), b = !1, p = i > 0, f = 0, v = 0;
588
- do {
589
- var C = Ct(e, c), R = C[0], d = C[1], m = C[2], g = d - m - a * R;
590
- (R || g) && yt(e, c) && (f += g, v += R), c = c.parentNode;
591
- } while (
592
- // portaled content
593
- !u && c !== document.body || // self content
594
- u && (n.contains(c) || n === c)
595
- );
596
- return (p && (r && f === 0 || !r && i > f) || !p && (r && v === 0 || !r && -i > v)) && (b = !0), b;
597
- }, de = function(e) {
598
- return "changedTouches" in e ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [0, 0];
599
- }, at = function(e) {
600
- return [e.deltaX, e.deltaY];
601
- }, ct = function(e) {
602
- return e && "current" in e ? e.current : e;
603
- }, $o = function(e, n) {
604
- return e[0] === n[0] && e[1] === n[1];
605
- }, ho = function(e) {
606
- return `
607
- .block-interactivity-`.concat(e, ` {pointer-events: none;}
608
- .allow-interactivity-`).concat(e, ` {pointer-events: all;}
609
- `);
610
- }, yo = 0, Y = [];
611
- function Co(e) {
612
- var n = _.useRef([]), t = _.useRef([0, 0]), o = _.useRef(), r = _.useState(yo++)[0], a = _.useState(function() {
613
- return $t();
614
- })[0], i = _.useRef(e);
615
- _.useEffect(function() {
616
- i.current = e;
617
- }, [e]), _.useEffect(function() {
618
- if (e.inert) {
619
- document.body.classList.add("block-interactivity-".concat(r));
620
- var d = Wn([e.lockRef.current], (e.shards || []).map(ct), !0).filter(Boolean);
621
- return d.forEach(function(m) {
622
- return m.classList.add("allow-interactivity-".concat(r));
623
- }), function() {
624
- document.body.classList.remove("block-interactivity-".concat(r)), d.forEach(function(m) {
625
- return m.classList.remove("allow-interactivity-".concat(r));
626
- });
627
- };
628
- }
629
- }, [e.inert, e.lockRef.current, e.shards]);
630
- var c = _.useCallback(function(d, m) {
631
- if ("touches" in d && d.touches.length === 2)
632
- return !i.current.allowPinchZoom;
633
- var g = de(d), h = t.current, $ = "deltaX" in d ? d.deltaX : h[0] - g[0], E = "deltaY" in d ? d.deltaY : h[1] - g[1], N, q = d.target, F = Math.abs($) > Math.abs(E) ? "h" : "v";
634
- if ("touches" in d && F === "h" && q.type === "range")
635
- return !1;
636
- var G = rt(F, q);
637
- if (!G)
638
- return !0;
639
- if (G ? N = F : (N = F === "v" ? "h" : "v", G = rt(F, q)), !G)
640
- return !1;
641
- if (!o.current && "changedTouches" in d && ($ || E) && (o.current = N), !N)
642
- return !0;
643
- var K = o.current || N;
644
- return vo(K, m, d, K === "h" ? $ : E, !0);
645
- }, []), u = _.useCallback(function(d) {
646
- var m = d;
647
- if (!(!Y.length || Y[Y.length - 1] !== a)) {
648
- var g = "deltaY" in m ? at(m) : de(m), h = n.current.filter(function(N) {
649
- return N.name === m.type && N.target === m.target && $o(N.delta, g);
650
- })[0];
651
- if (h && h.should) {
652
- m.cancelable && m.preventDefault();
653
- return;
654
- }
655
- if (!h) {
656
- var $ = (i.current.shards || []).map(ct).filter(Boolean).filter(function(N) {
657
- return N.contains(m.target);
658
- }), E = $.length > 0 ? c(m, $[0]) : !i.current.noIsolation;
659
- E && m.cancelable && m.preventDefault();
660
- }
661
- }
662
- }, []), b = _.useCallback(function(d, m, g, h) {
663
- var $ = { name: d, delta: m, target: g, should: h };
664
- n.current.push($), setTimeout(function() {
665
- n.current = n.current.filter(function(E) {
666
- return E !== $;
667
- });
668
- }, 1);
669
- }, []), p = _.useCallback(function(d) {
670
- t.current = de(d), o.current = void 0;
671
- }, []), f = _.useCallback(function(d) {
672
- b(d.type, at(d), d.target, c(d, e.lockRef.current));
673
- }, []), v = _.useCallback(function(d) {
674
- b(d.type, de(d), d.target, c(d, e.lockRef.current));
675
- }, []);
676
- _.useEffect(function() {
677
- return Y.push(a), e.setCallbacks({
678
- onScrollCapture: f,
679
- onWheelCapture: f,
680
- onTouchMoveCapture: v
681
- }), document.addEventListener("wheel", u, X), document.addEventListener("touchmove", u, X), document.addEventListener("touchstart", p, X), function() {
682
- Y = Y.filter(function(d) {
683
- return d !== a;
684
- }), document.removeEventListener("wheel", u, X), document.removeEventListener("touchmove", u, X), document.removeEventListener("touchstart", p, X);
685
- };
686
- }, []);
687
- var C = e.removeScrollBar, R = e.inert;
688
- return _.createElement(
689
- _.Fragment,
690
- null,
691
- R ? _.createElement(a, { styles: ho(r) }) : null,
692
- C ? _.createElement(uo, { gapMode: "margin" }) : null
693
- );
694
- }
695
- const wo = Zn(vt, Co);
696
- var wt = _.forwardRef(function(e, n) {
697
- return _.createElement(_e, O({}, e, { ref: n, sideCar: wo }));
698
- });
699
- wt.classNames = _e.classNames;
700
- const xo = wt;
701
- var Eo = function(e) {
702
- if (typeof document > "u")
703
- return null;
704
- var n = Array.isArray(e) ? e[0] : e;
705
- return n.ownerDocument.body;
706
- }, z = /* @__PURE__ */ new WeakMap(), le = /* @__PURE__ */ new WeakMap(), ue = {}, Ae = 0, xt = function(e) {
707
- return e && (e.host || xt(e.parentNode));
708
- }, Ro = function(e, n) {
709
- return n.map(function(t) {
710
- if (e.contains(t))
711
- return t;
712
- var o = xt(t);
713
- return o && e.contains(o) ? o : (console.error("aria-hidden", t, "in not contained inside", e, ". Doing nothing"), null);
714
- }).filter(function(t) {
715
- return !!t;
716
- });
717
- }, No = function(e, n, t, o) {
718
- var r = Ro(n, Array.isArray(e) ? e : [e]);
719
- ue[t] || (ue[t] = /* @__PURE__ */ new WeakMap());
720
- var a = ue[t], i = [], c = /* @__PURE__ */ new Set(), u = new Set(r), b = function(f) {
721
- !f || c.has(f) || (c.add(f), b(f.parentNode));
722
- };
723
- r.forEach(b);
724
- var p = function(f) {
725
- !f || u.has(f) || Array.prototype.forEach.call(f.children, function(v) {
726
- if (c.has(v))
727
- p(v);
728
- else
729
- try {
730
- var C = v.getAttribute(o), R = C !== null && C !== "false", d = (z.get(v) || 0) + 1, m = (a.get(v) || 0) + 1;
731
- z.set(v, d), a.set(v, m), i.push(v), d === 1 && R && le.set(v, !0), m === 1 && v.setAttribute(t, "true"), R || v.setAttribute(o, "true");
732
- } catch (g) {
733
- console.error("aria-hidden: cannot operate on ", v, g);
734
- }
735
- });
736
- };
737
- return p(n), c.clear(), Ae++, function() {
738
- i.forEach(function(f) {
739
- var v = z.get(f) - 1, C = a.get(f) - 1;
740
- z.set(f, v), a.set(f, C), v || (le.has(f) || f.removeAttribute(o), le.delete(f)), C || f.removeAttribute(t);
741
- }), Ae--, Ae || (z = /* @__PURE__ */ new WeakMap(), z = /* @__PURE__ */ new WeakMap(), le = /* @__PURE__ */ new WeakMap(), ue = {});
742
- };
743
- }, Ao = function(e, n, t) {
744
- t === void 0 && (t = "data-aria-hidden");
745
- var o = Array.from(Array.isArray(e) ? e : [e]), r = n || Eo(e);
746
- return r ? (o.push.apply(o, Array.from(r.querySelectorAll("[aria-live]"))), No(o, r, t, "aria-hidden")) : function() {
747
- return null;
748
- };
749
- };
750
- const Et = "Dialog", [Rt, ha] = me(Et), [Io, P] = Rt(Et), So = (e) => {
751
- const { __scopeDialog: n, children: t, open: o, defaultOpen: r, onOpenChange: a, modal: i = !0 } = e, c = S(null), u = S(null), [b = !1, p] = ee({
752
- prop: o,
753
- defaultProp: r,
754
- onChange: a
755
- });
756
- return /* @__PURE__ */ y(Io, {
757
- scope: n,
758
- triggerRef: c,
759
- contentRef: u,
760
- contentId: ne(),
761
- titleId: ne(),
762
- descriptionId: ne(),
763
- open: b,
764
- onOpenChange: p,
765
- onOpenToggle: De(
766
- () => p(
767
- (f) => !f
768
- ),
769
- [
770
- p
771
- ]
772
- ),
773
- modal: i
774
- }, t);
775
- }, ko = "DialogTrigger", To = /* @__PURE__ */ A((e, n) => {
776
- const { __scopeDialog: t, ...o } = e, r = P(ko, t), a = U(n, r.triggerRef);
777
- return /* @__PURE__ */ y(T.button, x({
778
- type: "button",
779
- "aria-haspopup": "dialog",
780
- "aria-expanded": r.open,
781
- "aria-controls": r.contentId,
782
- "data-state": Be(r.open)
783
- }, o, {
784
- ref: a,
785
- onClick: V(e.onClick, r.onOpenToggle)
786
- }));
787
- }), Nt = "DialogPortal", [Po, At] = Rt(Nt, {
788
- forceMount: void 0
789
- }), Oo = (e) => {
790
- const { __scopeDialog: n, forceMount: t, children: o, container: r } = e, a = P(Nt, n);
791
- return /* @__PURE__ */ y(Po, {
792
- scope: n,
793
- forceMount: t
794
- }, yn.map(
795
- o,
796
- (i) => /* @__PURE__ */ y(ge, {
797
- present: t || a.open
798
- }, /* @__PURE__ */ y(Hn, {
799
- asChild: !0,
800
- container: r
801
- }, i))
802
- ));
803
- }, ke = "DialogOverlay", Do = /* @__PURE__ */ A((e, n) => {
804
- const t = At(ke, e.__scopeDialog), { forceMount: o = t.forceMount, ...r } = e, a = P(ke, e.__scopeDialog);
805
- return a.modal ? /* @__PURE__ */ y(ge, {
806
- present: o || a.open
807
- }, /* @__PURE__ */ y(Mo, x({}, r, {
808
- ref: n
809
- }))) : null;
810
- }), Mo = /* @__PURE__ */ A((e, n) => {
811
- const { __scopeDialog: t, ...o } = e, r = P(ke, t);
812
- return (
813
- // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
814
- // ie. when `Overlay` and `Content` are siblings
815
- /* @__PURE__ */ y(xo, {
816
- as: Me,
817
- allowPinchZoom: !0,
818
- shards: [
819
- r.contentRef
820
- ]
821
- }, /* @__PURE__ */ y(T.div, x({
822
- "data-state": Be(r.open)
823
- }, o, {
824
- ref: n,
825
- style: {
826
- pointerEvents: "auto",
827
- ...o.style
828
- }
829
- })))
830
- );
831
- }), oe = "DialogContent", Fo = /* @__PURE__ */ A((e, n) => {
832
- const t = At(oe, e.__scopeDialog), { forceMount: o = t.forceMount, ...r } = e, a = P(oe, e.__scopeDialog);
833
- return /* @__PURE__ */ y(ge, {
834
- present: o || a.open
835
- }, a.modal ? /* @__PURE__ */ y(Lo, x({}, r, {
836
- ref: n
837
- })) : /* @__PURE__ */ y(Bo, x({}, r, {
838
- ref: n
839
- })));
840
- }), Lo = /* @__PURE__ */ A((e, n) => {
841
- const t = P(oe, e.__scopeDialog), o = S(null), r = U(n, t.contentRef, o);
842
- return W(() => {
843
- const a = o.current;
844
- if (a)
845
- return Ao(a);
846
- }, []), /* @__PURE__ */ y(It, x({}, e, {
847
- ref: r,
848
- trapFocus: t.open,
849
- disableOutsidePointerEvents: !0,
850
- onCloseAutoFocus: V(e.onCloseAutoFocus, (a) => {
851
- var i;
852
- a.preventDefault(), (i = t.triggerRef.current) === null || i === void 0 || i.focus();
853
- }),
854
- onPointerDownOutside: V(e.onPointerDownOutside, (a) => {
855
- const i = a.detail.originalEvent, c = i.button === 0 && i.ctrlKey === !0;
856
- (i.button === 2 || c) && a.preventDefault();
857
- }),
858
- onFocusOutside: V(
859
- e.onFocusOutside,
860
- (a) => a.preventDefault()
861
- )
862
- }));
863
- }), Bo = /* @__PURE__ */ A((e, n) => {
864
- const t = P(oe, e.__scopeDialog), o = S(!1), r = S(!1);
865
- return /* @__PURE__ */ y(It, x({}, e, {
866
- ref: n,
867
- trapFocus: !1,
868
- disableOutsidePointerEvents: !1,
869
- onCloseAutoFocus: (a) => {
870
- var i;
871
- if ((i = e.onCloseAutoFocus) === null || i === void 0 || i.call(e, a), !a.defaultPrevented) {
872
- var c;
873
- o.current || (c = t.triggerRef.current) === null || c === void 0 || c.focus(), a.preventDefault();
874
- }
875
- o.current = !1, r.current = !1;
876
- },
877
- onInteractOutside: (a) => {
878
- var i, c;
879
- (i = e.onInteractOutside) === null || i === void 0 || i.call(e, a), a.defaultPrevented || (o.current = !0, a.detail.originalEvent.type === "pointerdown" && (r.current = !0));
880
- const u = a.target;
881
- ((c = t.triggerRef.current) === null || c === void 0 ? void 0 : c.contains(u)) && a.preventDefault(), a.detail.originalEvent.type === "focusin" && r.current && a.preventDefault();
882
- }
883
- }));
884
- }), It = /* @__PURE__ */ A((e, n) => {
885
- const { __scopeDialog: t, trapFocus: o, onOpenAutoFocus: r, onCloseAutoFocus: a, ...i } = e, c = P(oe, t), u = S(null), b = U(n, u);
886
- return Vn(), /* @__PURE__ */ y(hn, null, /* @__PURE__ */ y(Pn, {
887
- asChild: !0,
888
- loop: !0,
889
- trapped: o,
890
- onMountAutoFocus: r,
891
- onUnmountAutoFocus: a
892
- }, /* @__PURE__ */ y(Rn, x({
893
- role: "dialog",
894
- id: c.contentId,
895
- "aria-describedby": c.descriptionId,
896
- "aria-labelledby": c.titleId,
897
- "data-state": Be(c.open)
898
- }, i, {
899
- ref: b,
900
- onDismiss: () => c.onOpenChange(!1)
901
- }))), !1);
902
- }), Ho = "DialogTitle", Vo = /* @__PURE__ */ A((e, n) => {
903
- const { __scopeDialog: t, ...o } = e, r = P(Ho, t);
904
- return /* @__PURE__ */ y(T.h2, x({
905
- id: r.titleId
906
- }, o, {
907
- ref: n
908
- }));
909
- }), Wo = "DialogDescription", jo = /* @__PURE__ */ A((e, n) => {
910
- const { __scopeDialog: t, ...o } = e, r = P(Wo, t);
911
- return /* @__PURE__ */ y(T.p, x({
912
- id: r.descriptionId
913
- }, o, {
914
- ref: n
915
- }));
916
- }), qo = "DialogClose", Uo = /* @__PURE__ */ A((e, n) => {
917
- const { __scopeDialog: t, ...o } = e, r = P(qo, t);
918
- return /* @__PURE__ */ y(T.button, x({
919
- type: "button"
920
- }, o, {
921
- ref: n,
922
- onClick: V(
923
- e.onClick,
924
- () => r.onOpenChange(!1)
925
- )
926
- }));
927
- });
928
- function Be(e) {
929
- return e ? "open" : "closed";
930
- }
931
- const Go = So, Ko = To, Xo = Oo, Yo = Do, zo = Fo, Zo = Vo, Qo = jo, Jo = Uo, D = {
932
- "teddy-modal__overlay": "_teddy-modal__overlay_vfo5b_17",
933
- "teddy-modal__content": "_teddy-modal__content_vfo5b_29",
934
- "teddy-modal__scroll": "_teddy-modal__scroll_vfo5b_47",
935
- "teddy-modal__image": "_teddy-modal__image_vfo5b_51",
936
- "teddy-modal__close--floating": "_teddy-modal__close--floating_vfo5b_61",
937
- "teddy-modal__group": "_teddy-modal__group_vfo5b_66",
938
- "teddy-modal__group--title": "_teddy-modal__group--title_vfo5b_70",
939
- "teddy-modal__group--scroll": "_teddy-modal__group--scroll_vfo5b_76",
940
- "teddy-modal__group--action": "_teddy-modal__group--action_vfo5b_85",
941
- "modal-overlay-no-op": "_modal-overlay-no-op_vfo5b_1",
942
- "teddy-fade-in": "_teddy-fade-in_vfo5b_1",
943
- "teddy-fade-out": "_teddy-fade-out_vfo5b_1",
944
- "modal-content-show": "_modal-content-show_vfo5b_1",
945
- "modal-content-hide": "_modal-content-hide_vfo5b_1"
946
- }, M = "teddy-modal", ae = s.createContext({
947
- imageRef: null,
948
- actionGroupRef: null,
949
- scrollRef: null
950
- }), St = (e) => {
951
- const n = s.useRef(null), t = s.useRef(null), o = s.useRef(null);
952
- return /* @__PURE__ */ l(ae.Provider, { value: { imageRef: n, actionGroupRef: t, scrollRef: o }, children: /* @__PURE__ */ l(Go, { ...e, modal: !0 }) });
953
- };
954
- St.displayName = "Dialog.Root";
955
- const kt = s.forwardRef(
956
- ({ children: e, ...n }, t) => /* @__PURE__ */ l(Ko, { ...n, ref: t, asChild: !0, children: e })
957
- );
958
- kt.displayName = "Dialog.Trigger";
959
- const Tt = s.createContext(!1), He = s.forwardRef(
960
- ({ className: e, forceMount: n, container: t, ...o }, r) => {
961
- const a = w([D[`${M}__overlay`]], e);
962
- return /* @__PURE__ */ l(Tt.Provider, { value: !0, children: /* @__PURE__ */ l(Xo, { container: t, forceMount: n, children: /* @__PURE__ */ l(Yo, { className: a, ref: r, ...o }) }) });
963
- }
964
- );
965
- He.displayName = "Dialog.Content";
966
- const it = s.forwardRef(
967
- function({ asChild: n, children: t, className: o, ...r }, a) {
968
- const i = w([D[`${M}__scroll`]], o), c = s.useContext(ae);
969
- return /* @__PURE__ */ l(
970
- zo,
971
- {
972
- ...r,
973
- ref: a,
974
- className: w([D[`${M}__content`]]),
975
- asChild: !0,
976
- children: /* @__PURE__ */ l(Ie, { children: /* @__PURE__ */ l(
977
- Ie,
978
- {
979
- ...n ? { as: void 0, asChild: n } : {},
980
- direction: "column",
981
- align: "start",
982
- maxWidth: { md: "600px" },
983
- className: i,
984
- ref: c.scrollRef,
985
- children: t
986
- }
987
- ) })
988
- }
989
- );
990
- }
991
- ), Pt = s.forwardRef(
992
- ({ forceMount: e, ...n }, t) => s.useContext(Tt) ? /* @__PURE__ */ l(it, { ref: t, ...n }) : /* @__PURE__ */ l(He, { forceMount: e, children: /* @__PURE__ */ l(it, { ref: t, ...n }) })
993
- );
994
- Pt.displayName = "Dialog.Content";
995
- const Ot = s.createContext(!1), Ve = s.forwardRef(
996
- ({ className: e, variant: n, ...t }, o) => {
997
- const r = s.useContext(ae).scrollRef, [a, i] = s.useState(!1);
998
- W(() => {
999
- if (r != null && r.current) {
1000
- const u = r.current.scrollHeight > r.current.clientHeight;
1001
- i(u);
1002
- }
1003
- }, [r]);
1004
- const c = w(
1005
- [D[`${M}__group`]],
1006
- {
1007
- [D[`${M}__group--action`]]: n === "action",
1008
- [D[`${M}__group--title`]]: n === "title",
1009
- [D[`${M}__group--scroll`]]: a
1010
- },
1011
- e
1012
- );
1013
- return /* @__PURE__ */ l(Ot.Provider, { value: !0, children: /* @__PURE__ */ l(
1014
- Ie,
1015
- {
1016
- ...n === "action" ? {
1017
- gap: "200",
1018
- justify: { md: "end" },
1019
- align: { sm: "stretch", md: "end" },
1020
- direction: { sm: "column-reverse", md: "row" }
1021
- } : { direction: "column" },
1022
- ref: o,
1023
- ...t,
1024
- className: c
1025
- }
1026
- ) });
1027
- }
1028
- );
1029
- Ve.displayName = "Dialog.Group";
1030
- const st = s.forwardRef(
1031
- function(n, t) {
1032
- return /* @__PURE__ */ l(Zo, { asChild: !0, children: /* @__PURE__ */ l(re, { variant: "title-200", as: "h2", ...n, asChild: !1, ref: t }) });
1033
- }
1034
- ), Dt = s.forwardRef((e, n) => s.useContext(Ot) ? /* @__PURE__ */ l(st, { ...e, ref: n }) : /* @__PURE__ */ l(Ve, { variant: "title", children: /* @__PURE__ */ l(st, { ...e, ref: n }) }));
1035
- Dt.displayName = "Dialog.Title";
1036
- const Mt = s.forwardRef((e, n) => /* @__PURE__ */ l(Qo, { asChild: !0, children: /* @__PURE__ */ l(pt, { as: "p", variant: "paragraph-100", ...e, asChild: !1, ref: n }) }));
1037
- Mt.displayName = "Dialog.Description";
1038
- const Ft = s.forwardRef(({ asChild: e, ...n }, t) => {
1039
- const o = w([D[`${M}__image`]], n.className), r = s.useContext(ae);
1040
- return /* @__PURE__ */ l(e ? Me : "img", { ...n, className: o, ref: Le(r.imageRef, t) });
1041
- });
1042
- Ft.displayName = "Dialog.Image";
1043
- const Lt = s.forwardRef(
1044
- ({ className: e, ...n }, t) => {
1045
- const o = w([D[`${M}__close`]], {
1046
- [D[`${M}__close--floating`]]: n.slot === "floating",
1047
- className: e
1048
- }), r = s.useContext(ae).imageRef, [a, i] = s.useState(!1);
1049
- return W(() => {
1050
- r != null && r.current && i(!0);
1051
- }, [r]), /* @__PURE__ */ l(Jo, { ...n, className: o, ref: t, asChild: !0, children: n.children || /* @__PURE__ */ l(Fe, { variant: a ? "primary-negative" : "tertiary-purple", iconOnly: !0, "aria-label": n["aria-label"], children: /* @__PURE__ */ l(te, { name: "close" }) }) });
1052
- }
1053
- );
1054
- Lt.displayName = "Dialog.Close";
1055
- const ya = Object.assign(St, { Trigger: kt, Content: Pt, Title: Dt, Overlay: He, Description: Mt, Close: Lt, Image: Ft, Group: Ve }), Q = {
1056
- "teddy-notification": "_teddy-notification_q80ka_3",
1057
- "teddy-notification__dismiss": "_teddy-notification__dismiss_q80ka_14",
1058
- "teddy-notification--success": "_teddy-notification--success_q80ka_18",
1059
- "teddy-notification--warning": "_teddy-notification--warning_q80ka_23",
1060
- "teddy-notification--error": "_teddy-notification--error_q80ka_28",
1061
- "teddy-notification--information": "_teddy-notification--information_q80ka_33",
1062
- "teddy-notification__heading": "_teddy-notification__heading_q80ka_38",
1063
- "teddy-notification__icon": "_teddy-notification__icon_q80ka_43"
1064
- }, Bt = "Collapsible", [er, Ht] = me(Bt), [tr, We] = er(Bt), nr = /* @__PURE__ */ A((e, n) => {
1065
- const { __scopeCollapsible: t, open: o, defaultOpen: r, disabled: a, onOpenChange: i, ...c } = e, [u = !1, b] = ee({
1066
- prop: o,
1067
- defaultProp: r,
1068
- onChange: i
1069
- });
1070
- return /* @__PURE__ */ y(tr, {
1071
- scope: t,
1072
- disabled: a,
1073
- contentId: ne(),
1074
- open: u,
1075
- onOpenToggle: De(
1076
- () => b(
1077
- (p) => !p
1078
- ),
1079
- [
1080
- b
1081
- ]
1082
- )
1083
- }, /* @__PURE__ */ y(T.div, x({
1084
- "data-state": je(u),
1085
- "data-disabled": a ? "" : void 0
1086
- }, c, {
1087
- ref: n
1088
- })));
1089
- }), or = "CollapsibleTrigger", rr = /* @__PURE__ */ A((e, n) => {
1090
- const { __scopeCollapsible: t, ...o } = e, r = We(or, t);
1091
- return /* @__PURE__ */ y(T.button, x({
1092
- type: "button",
1093
- "aria-controls": r.contentId,
1094
- "aria-expanded": r.open || !1,
1095
- "data-state": je(r.open),
1096
- "data-disabled": r.disabled ? "" : void 0,
1097
- disabled: r.disabled
1098
- }, o, {
1099
- ref: n,
1100
- onClick: V(e.onClick, r.onOpenToggle)
1101
- }));
1102
- }), Vt = "CollapsibleContent", ar = /* @__PURE__ */ A((e, n) => {
1103
- const { forceMount: t, ...o } = e, r = We(Vt, e.__scopeCollapsible);
1104
- return /* @__PURE__ */ y(
1105
- ge,
1106
- {
1107
- present: t || r.open
1108
- },
1109
- ({ present: a }) => /* @__PURE__ */ y(cr, x({}, o, {
1110
- ref: n,
1111
- present: a
1112
- }))
1113
- );
1114
- }), cr = /* @__PURE__ */ A((e, n) => {
1115
- const { __scopeCollapsible: t, present: o, children: r, ...a } = e, i = We(Vt, t), [c, u] = pe(o), b = S(null), p = U(n, b), f = S(0), v = f.current, C = S(0), R = C.current, d = i.open || c, m = S(d), g = S();
1116
- return W(() => {
1117
- const h = requestAnimationFrame(
1118
- () => m.current = !1
1119
- );
1120
- return () => cancelAnimationFrame(h);
1121
- }, []), Cn(() => {
1122
- const h = b.current;
1123
- if (h) {
1124
- g.current = g.current || {
1125
- transitionDuration: h.style.transitionDuration,
1126
- animationName: h.style.animationName
1127
- }, h.style.transitionDuration = "0s", h.style.animationName = "none";
1128
- const $ = h.getBoundingClientRect();
1129
- f.current = $.height, C.current = $.width, m.current || (h.style.transitionDuration = g.current.transitionDuration, h.style.animationName = g.current.animationName), u(o);
1130
- }
1131
- }, [
1132
- i.open,
1133
- o
1134
- ]), /* @__PURE__ */ y(T.div, x({
1135
- "data-state": je(i.open),
1136
- "data-disabled": i.disabled ? "" : void 0,
1137
- id: i.contentId,
1138
- hidden: !d
1139
- }, a, {
1140
- ref: p,
1141
- style: {
1142
- "--radix-collapsible-content-height": v ? `${v}px` : void 0,
1143
- "--radix-collapsible-content-width": R ? `${R}px` : void 0,
1144
- ...e.style
1145
- }
1146
- }), d && r);
1147
- });
1148
- function je(e) {
1149
- return e ? "open" : "closed";
1150
- }
1151
- const Wt = nr, jt = rr, qt = ar, J = "teddy-notification", Ut = s.createContext(void 0), Gt = s.forwardRef(
1152
- ({ className: e, open: n, defaultOpen: t, onOpenChange: o, variant: r, ...a }, i) => {
1153
- const c = w([Q[`${J}`]], Q[`${J}--${r}`], e), [u = !0, b] = ee({
1154
- prop: n,
1155
- defaultProp: t,
1156
- onChange: o
1157
- });
1158
- return /* @__PURE__ */ l(Ut.Provider, { value: { variant: r }, children: /* @__PURE__ */ l(Wt, { open: u, onOpenChange: b, asChild: !0, children: /* @__PURE__ */ l(qt, { asChild: !0, children: /* @__PURE__ */ l(ur, { variant: "white", bordered: !0, ...a, ref: i, className: c }) }) }) });
1159
- }
1160
- );
1161
- Gt.displayName = "Notification";
1162
- function ir(e) {
1163
- switch (e) {
1164
- case "success":
1165
- return "check-circle-filled";
1166
- case "error":
1167
- return "error-filled";
1168
- case "warning":
1169
- return "alert-filled";
1170
- case "information":
1171
- return "info-filled";
1172
- }
1173
- }
1174
- const Kt = s.forwardRef(
1175
- ({ className: e, ...n }, t) => {
1176
- const o = w([Q[`${J}__icon`]], e), r = s.useContext(Ut), a = n.name || ir(r == null ? void 0 : r.variant);
1177
- return a ? /* @__PURE__ */ l(te, { size: "md", ...n, name: a, ref: t, className: o }) : null;
1178
- }
1179
- );
1180
- Kt.displayName = "Notification.Icon";
1181
- const Xt = s.forwardRef(
1182
- ({ className: e, ...n }, t) => {
1183
- const o = w([Q[`${J}__heading`]], e);
1184
- return /* @__PURE__ */ l(re, { ...n, variant: "subsection-100", asChild: !1, ref: t, className: o });
1185
- }
1186
- );
1187
- Xt.displayName = "Notification.Heading";
1188
- const Yt = s.forwardRef(
1189
- ({ className: e, ...n }, t) => {
1190
- const o = w([Q[`${J}__text`]], e);
1191
- return /* @__PURE__ */ l(pt, { ...n, ref: t, className: o });
1192
- }
1193
- );
1194
- Yt.displayName = "Notification.Text";
1195
- const zt = s.forwardRef(
1196
- ({ className: e, children: n, ...t }, o) => {
1197
- const r = w([Q[`${J}__dismiss`]], e);
1198
- return /* @__PURE__ */ l(jt, { asChild: !0, children: /* @__PURE__ */ l(
1199
- Fe,
1200
- {
1201
- iconOnly: !0,
1202
- "aria-label": "Lukk",
1203
- variant: "tertiary-purple",
1204
- ...t,
1205
- ref: o,
1206
- className: r,
1207
- children: n || /* @__PURE__ */ l(te, { name: "close" })
1208
- }
1209
- ) });
1210
- }
1211
- );
1212
- zt.displayName = "Notification.Dismiss";
1213
- const Ca = Object.assign(Gt, {
1214
- Text: Yt,
1215
- Heading: Xt,
1216
- Icon: Kt,
1217
- Dismiss: zt
1218
- }), I = {
1219
- "teddy-card": "_teddy-card_18dt8_3",
1220
- "teddy-card__action": "_teddy-card__action_18dt8_30",
1221
- "teddy-card__action--disabled": "_teddy-card__action--disabled_18dt8_30",
1222
- "teddy-card--border": "_teddy-card--border_18dt8_51",
1223
- "teddy-card--purple-light": "_teddy-card--purple-light_18dt8_54",
1224
- "teddy-card--purple-dark": "_teddy-card--purple-dark_18dt8_70",
1225
- "teddy-card--white": "_teddy-card--white_18dt8_91",
1226
- "teddy-card--gray": "_teddy-card--gray_18dt8_107",
1227
- "teddy-card--beige": "_teddy-card--beige_18dt8_123",
1228
- "teddy-card__image--as-background": "_teddy-card__image--as-background_18dt8_139",
1229
- "teddy-card__heading": "_teddy-card__heading_18dt8_142",
1230
- "teddy-card--background-image": "_teddy-card--background-image_18dt8_145",
1231
- "teddy-card__image": "_teddy-card__image_18dt8_139",
1232
- "teddy-card__image--inset-top": "_teddy-card__image--inset-top_18dt8_160",
1233
- "teddy-card__image--inset-bottom": "_teddy-card__image--inset-bottom_18dt8_163",
1234
- "teddy-card__image--inset-left": "_teddy-card__image--inset-left_18dt8_166",
1235
- "teddy-card__image--inset-right": "_teddy-card__image--inset-right_18dt8_169"
1236
- }, k = "teddy-card", Te = `${k}__action`, sr = ["purple-light", "purple-dark", "gray", "white", "beige"], qe = s.createContext(void 0), Zt = s.forwardRef(
1237
- ({ className: e, children: n, backgroundImageSrc: t, variant: o, bordered: r, ...a }, i) => {
1238
- const c = s.useRef(null), u = s.useRef(null), b = w(
1239
- [I[`${k}`]],
1240
- {
1241
- [I[`${k}--${o}`]]: o,
1242
- [I[`${k}--border`]]: r,
1243
- [I[`${k}--background-image`]]: t
1244
- },
1245
- e
1246
- );
1247
- return /* @__PURE__ */ l(
1248
- kn,
1249
- {
1250
- ...a,
1251
- style: t ? { background: `url(${t})`, ...a.style } : a.style,
1252
- onClick: Tn(a.onClick, (p) => {
1253
- var f;
1254
- if (!p.isDefaultPrevented()) {
1255
- if (u.current)
1256
- return u.current.click();
1257
- (f = c.current) == null || f.click();
1258
- }
1259
- }),
1260
- ref: i,
1261
- className: b,
1262
- children: /* @__PURE__ */ l(qe.Provider, { value: { buttonRef: c, linkRef: u, variant: o }, children: n })
1263
- }
1264
- );
1265
- }
1266
- );
1267
- Zt.displayName = "Card";
1268
- const Qt = s.forwardRef(
1269
- ({ className: e, variant: n = "title-200", as: t = "h2", ...o }, r) => {
1270
- const a = w([I[`${k}__heading`]], e);
1271
- return /* @__PURE__ */ l(
1272
- re,
1273
- {
1274
- ...o,
1275
- ...o.asChild ? { as: void 0, asChild: !0 } : { as: t, asChild: !1 },
1276
- variant: n,
1277
- ref: r,
1278
- className: a
1279
- }
1280
- );
1281
- }
1282
- );
1283
- Qt.displayName = "Card.Heading";
1284
- const Jt = s.forwardRef(({ className: e, ...n }, t) => {
1285
- const o = w([I[`${k}__content`]], e);
1286
- return /* @__PURE__ */ l("div", { ...n, ref: t, className: o });
1287
- });
1288
- Jt.displayName = "Card.Content";
1289
- const dr = [
1290
- "top",
1291
- "bottom",
1292
- "left",
1293
- "right",
1294
- "all",
1295
- "top-right-left",
1296
- "bottom-left-right",
1297
- "top-left",
1298
- "top-right",
1299
- "bottom-left",
1300
- "bottom-right",
1301
- "top-bottom",
1302
- "left-right"
1303
- ], en = s.forwardRef(({ className: e, ...n }, t) => {
1304
- var r, a, i, c, u, b, p, f;
1305
- const o = w(
1306
- [I[`${k}__image`]],
1307
- {
1308
- [I[`${k}__image--inset-top`]]: ((r = n.inset) == null ? void 0 : r.includes("top")) || ((a = n.inset) == null ? void 0 : a.includes("all")),
1309
- [I[`${k}__image--inset-bottom`]]: ((i = n.inset) == null ? void 0 : i.includes("bottom")) || ((c = n.inset) == null ? void 0 : c.includes("all")),
1310
- [I[`${k}__image--inset-left`]]: ((u = n.inset) == null ? void 0 : u.includes("left")) || ((b = n.inset) == null ? void 0 : b.includes("all")),
1311
- [I[`${k}__image--inset-right`]]: ((p = n.inset) == null ? void 0 : p.includes("right")) || ((f = n.inset) == null ? void 0 : f.includes("all"))
1312
- },
1313
- e
1314
- );
1315
- return /* @__PURE__ */ l("img", { ...n, ref: t, className: o });
1316
- });
1317
- en.displayName = "Card.Image";
1318
- function lr(e) {
1319
- switch (e) {
1320
- case "purple-dark":
1321
- return "primary-negative";
1322
- default:
1323
- return "primary";
1324
- }
1325
- }
1326
- const tn = s.forwardRef(
1327
- ({ className: e, iconOnly: n = !1, ...t }, o) => {
1328
- const r = s.useContext(qe), a = w(
1329
- [I[`${k}__button`]],
1330
- I[Te],
1331
- {
1332
- [I[`${Te}--disabled`]]: t.disabled
1333
- },
1334
- e
1335
- ), i = Le(r == null ? void 0 : r.buttonRef, o);
1336
- return /* @__PURE__ */ l(ft, { children: /* @__PURE__ */ l(
1337
- Fe,
1338
- {
1339
- ...!n || !t["aria-label"] ? { iconOnly: !1, "aria-label": void 0 } : { iconOnly: !0, "aria-label": t["aria-label"] },
1340
- ...t,
1341
- ref: i,
1342
- variant: lr(r == null ? void 0 : r.variant),
1343
- className: a
1344
- }
1345
- ) });
1346
- }
1347
- );
1348
- tn.displayName = "Card.Button";
1349
- const nn = s.forwardRef(
1350
- ({ className: e, ...n }, t) => {
1351
- const o = s.useContext(qe), r = w([I[`${k}__link`]], I[Te], e), a = Le(o == null ? void 0 : o.linkRef, t);
1352
- return /* @__PURE__ */ l(In, { ...n, ref: a, className: r });
1353
- }
1354
- );
1355
- nn.displayName = "Card.Link";
1356
- const ur = Object.assign(Zt, {
1357
- Heading: Qt,
1358
- Content: Jt,
1359
- Image: en,
1360
- Button: tn,
1361
- Link: nn,
1362
- variantOptions: sr,
1363
- insetOptions: dr
1364
- }), on = "Switch", [fr, wa] = me(on), [br, pr] = fr(on), mr = /* @__PURE__ */ A((e, n) => {
1365
- const { __scopeSwitch: t, name: o, checked: r, defaultChecked: a, required: i, disabled: c, value: u = "on", onCheckedChange: b, ...p } = e, [f, v] = pe(null), C = U(
1366
- n,
1367
- (h) => v(h)
1368
- ), R = S(!1), d = f ? !!f.closest("form") : !0, [m = !1, g] = ee({
1369
- prop: r,
1370
- defaultProp: a,
1371
- onChange: b
1372
- });
1373
- return /* @__PURE__ */ y(br, {
1374
- scope: t,
1375
- checked: m,
1376
- disabled: c
1377
- }, /* @__PURE__ */ y(T.button, x({
1378
- type: "button",
1379
- role: "switch",
1380
- "aria-checked": m,
1381
- "aria-required": i,
1382
- "data-state": rn(m),
1383
- "data-disabled": c ? "" : void 0,
1384
- disabled: c,
1385
- value: u
1386
- }, p, {
1387
- ref: C,
1388
- onClick: V(e.onClick, (h) => {
1389
- g(
1390
- ($) => !$
1391
- ), d && (R.current = h.isPropagationStopped(), R.current || h.stopPropagation());
1392
- })
1393
- })), d && /* @__PURE__ */ y(vr, {
1394
- control: f,
1395
- bubbles: !R.current,
1396
- name: o,
1397
- value: u,
1398
- checked: m,
1399
- required: i,
1400
- disabled: c,
1401
- style: {
1402
- transform: "translateX(-100%)"
1403
- }
1404
- }));
1405
- }), gr = "SwitchThumb", _r = /* @__PURE__ */ A((e, n) => {
1406
- const { __scopeSwitch: t, ...o } = e, r = pr(gr, t);
1407
- return /* @__PURE__ */ y(T.span, x({
1408
- "data-state": rn(r.checked),
1409
- "data-disabled": r.disabled ? "" : void 0
1410
- }, o, {
1411
- ref: n
1412
- }));
1413
- }), vr = (e) => {
1414
- const { control: n, checked: t, bubbles: o = !0, ...r } = e, a = S(null), i = wn(t), c = An(n);
1415
- return W(() => {
1416
- const u = a.current, b = window.HTMLInputElement.prototype, f = Object.getOwnPropertyDescriptor(b, "checked").set;
1417
- if (i !== t && f) {
1418
- const v = new Event("click", {
1419
- bubbles: o
1420
- });
1421
- f.call(u, t), u.dispatchEvent(v);
1422
- }
1423
- }, [
1424
- i,
1425
- t,
1426
- o
1427
- ]), /* @__PURE__ */ y("input", x({
1428
- type: "checkbox",
1429
- "aria-hidden": !0,
1430
- defaultChecked: t
1431
- }, r, {
1432
- tabIndex: -1,
1433
- ref: a,
1434
- style: {
1435
- ...e.style,
1436
- ...c,
1437
- position: "absolute",
1438
- pointerEvents: "none",
1439
- opacity: 0,
1440
- margin: 0
1441
- }
1442
- }));
1443
- };
1444
- function rn(e) {
1445
- return e ? "checked" : "unchecked";
1446
- }
1447
- const $r = mr, hr = _r, ce = {
1448
- "teddy-toggle": "_teddy-toggle_1rp8d_3",
1449
- "teddy-toggle__input": "_teddy-toggle__input_1rp8d_10",
1450
- "teddy-toggle__thumb": "_teddy-toggle__thumb_1rp8d_78",
1451
- "teddy-toggle__indicator": "_teddy-toggle__indicator_1rp8d_104"
1452
- }, ie = "teddy-toggle", Ue = s.createContext(void 0), an = s.forwardRef(
1453
- ({ className: e, id: n, children: t, ...o }, r) => {
1454
- const a = w([ce[`${ie}`]], e), i = s.useId(), [c, u] = s.useState(!1), [b, p] = s.useState(!1);
1455
- return /* @__PURE__ */ l("div", { ...o, ref: r, className: a, children: /* @__PURE__ */ l(Ue.Provider, { value: { id: n ?? i, isDisabled: c, setIsDisabled: u, isRequired: b, setIsRequired: p }, children: t }) });
1456
- }
1457
- );
1458
- an.displayName = "Toggle";
1459
- const cn = s.forwardRef(
1460
- ({ className: e, ...n }, t) => {
1461
- const o = w([ce[`${ie}__label`]], e), r = s.useContext(Ue);
1462
- return /* @__PURE__ */ l(
1463
- Sn,
1464
- {
1465
- ...n,
1466
- htmlFor: r == null ? void 0 : r.id,
1467
- isRequired: r == null ? void 0 : r.isRequired,
1468
- disabled: r == null ? void 0 : r.isDisabled,
1469
- ref: t,
1470
- className: o
1471
- }
1472
- );
1473
- }
1474
- );
1475
- cn.displayName = "Toggle.Label";
1476
- const sn = s.forwardRef(
1477
- ({ className: e, children: n, ...t }, o) => {
1478
- const r = w([ce[`${ie}__input`]], e), a = s.useContext(Ue);
1479
- return s.useEffect(() => {
1480
- a && a.setIsDisabled(t.disabled === !0);
1481
- }, [a, t.disabled]), s.useEffect(() => {
1482
- a && a.setIsRequired(t.required === !0);
1483
- }, [a, t.required]), /* @__PURE__ */ l($r, { ...t, id: a == null ? void 0 : a.id, ref: o, className: r, children: n || /* @__PURE__ */ Oe(ft, { children: [
1484
- /* @__PURE__ */ l(ve, {}),
1485
- /* @__PURE__ */ l(dn, {})
1486
- ] }) });
1487
- }
1488
- );
1489
- sn.displayName = "Toggle.Input";
1490
- const ve = s.forwardRef(
1491
- ({ className: e, ...n }, t) => {
1492
- const o = w([ce[`${ie}__thumb`]], e);
1493
- return /* @__PURE__ */ l(hr, { ...n, ref: t, className: o });
1494
- }
1495
- );
1496
- ve.displayName = "Toggle.Thumb";
1497
- const dn = s.forwardRef(
1498
- ({ className: e, ...n }, t) => {
1499
- const o = w([ce[`${ie}__indicator`]], e);
1500
- return /* @__PURE__ */ l(te, { name: "checkmark-bold", size: "xxs", ...n, ref: t, className: o });
1501
- }
1502
- );
1503
- ve.displayName = "Toggle.Indicator";
1504
- const xa = Object.assign(an, {
1505
- Label: cn,
1506
- Input: sn,
1507
- Thumb: ve,
1508
- Indicator: dn
1509
- }), yr = "_slideDown_fs2mc_1", Cr = "_slideUp_fs2mc_1", L = {
1510
- "teddy-accordion--indented": "_teddy-accordion--indented_fs2mc_3",
1511
- "teddy-accordion__trigger": "_teddy-accordion__trigger_fs2mc_3",
1512
- "teddy-accordion__content": "_teddy-accordion__content_fs2mc_4",
1513
- "teddy-accordion--negative": "_teddy-accordion--negative_fs2mc_13",
1514
- "teddy-accordion__header": "_teddy-accordion__header_fs2mc_13",
1515
- "teddy-accordion__title": "_teddy-accordion__title_fs2mc_17",
1516
- "teddy-accordion__item": "_teddy-accordion__item_fs2mc_28",
1517
- "teddy-accordion": "_teddy-accordion_fs2mc_3",
1518
- "teddy-accordion__indicator": "_teddy-accordion__indicator_fs2mc_107",
1519
- slideDown: yr,
1520
- slideUp: Cr
1521
- }, j = "Accordion", wr = [
1522
- "Home",
1523
- "End",
1524
- "ArrowDown",
1525
- "ArrowUp",
1526
- "ArrowLeft",
1527
- "ArrowRight"
1528
- ], [Ge, xr, Er] = xn(j), [$e, Ea] = me(j, [
1529
- Er,
1530
- Ht
1531
- ]), Ke = Ht(), ln = /* @__PURE__ */ s.forwardRef((e, n) => {
1532
- const { type: t, ...o } = e, r = o, a = o;
1533
- return /* @__PURE__ */ s.createElement(Ge.Provider, {
1534
- scope: e.__scopeAccordion
1535
- }, t === "multiple" ? /* @__PURE__ */ s.createElement(Ir, x({}, a, {
1536
- ref: n
1537
- })) : /* @__PURE__ */ s.createElement(Ar, x({}, r, {
1538
- ref: n
1539
- })));
1540
- });
1541
- ln.propTypes = {
1542
- type(e) {
1543
- const n = e.value || e.defaultValue;
1544
- return e.type && ![
1545
- "single",
1546
- "multiple"
1547
- ].includes(e.type) ? new Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`.") : e.type === "multiple" && typeof n == "string" ? new Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`.") : e.type === "single" && Array.isArray(n) ? new Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`.") : null;
1548
- }
1549
- };
1550
- const [un, Rr] = $e(j), [fn, Nr] = $e(j, {
1551
- collapsible: !1
1552
- }), Ar = /* @__PURE__ */ s.forwardRef((e, n) => {
1553
- const { value: t, defaultValue: o, onValueChange: r = () => {
1554
- }, collapsible: a = !1, ...i } = e, [c, u] = ee({
1555
- prop: t,
1556
- defaultProp: o,
1557
- onChange: r
1558
- });
1559
- return /* @__PURE__ */ s.createElement(un, {
1560
- scope: e.__scopeAccordion,
1561
- value: c ? [
1562
- c
1563
- ] : [],
1564
- onItemOpen: u,
1565
- onItemClose: s.useCallback(
1566
- () => a && u(""),
1567
- [
1568
- a,
1569
- u
1570
- ]
1571
- )
1572
- }, /* @__PURE__ */ s.createElement(fn, {
1573
- scope: e.__scopeAccordion,
1574
- collapsible: a
1575
- }, /* @__PURE__ */ s.createElement(bn, x({}, i, {
1576
- ref: n
1577
- }))));
1578
- }), Ir = /* @__PURE__ */ s.forwardRef((e, n) => {
1579
- const { value: t, defaultValue: o, onValueChange: r = () => {
1580
- }, ...a } = e, [i = [], c] = ee({
1581
- prop: t,
1582
- defaultProp: o,
1583
- onChange: r
1584
- }), u = s.useCallback(
1585
- (p) => c(
1586
- (f = []) => [
1587
- ...f,
1588
- p
1589
- ]
1590
- ),
1591
- [
1592
- c
1593
- ]
1594
- ), b = s.useCallback(
1595
- (p) => c(
1596
- (f = []) => f.filter(
1597
- (v) => v !== p
1598
- )
1599
- ),
1600
- [
1601
- c
1602
- ]
1603
- );
1604
- return /* @__PURE__ */ s.createElement(un, {
1605
- scope: e.__scopeAccordion,
1606
- value: i,
1607
- onItemOpen: u,
1608
- onItemClose: b
1609
- }, /* @__PURE__ */ s.createElement(fn, {
1610
- scope: e.__scopeAccordion,
1611
- collapsible: !0
1612
- }, /* @__PURE__ */ s.createElement(bn, x({}, a, {
1613
- ref: n
1614
- }))));
1615
- }), [Sr, he] = $e(j), bn = /* @__PURE__ */ s.forwardRef((e, n) => {
1616
- const { __scopeAccordion: t, disabled: o, dir: r, orientation: a = "vertical", ...i } = e, c = s.useRef(null), u = U(c, n), b = xr(t), f = En(r) === "ltr", v = V(e.onKeyDown, (C) => {
1617
- var R;
1618
- if (!wr.includes(C.key))
1619
- return;
1620
- const d = C.target, m = b().filter((K) => {
1621
- var ye;
1622
- return !((ye = K.ref.current) !== null && ye !== void 0 && ye.disabled);
1623
- }), g = m.findIndex(
1624
- (K) => K.ref.current === d
1625
- ), h = m.length;
1626
- if (g === -1)
1627
- return;
1628
- C.preventDefault();
1629
- let $ = g;
1630
- const E = 0, N = h - 1, q = () => {
1631
- $ = g + 1, $ > N && ($ = E);
1632
- }, F = () => {
1633
- $ = g - 1, $ < E && ($ = N);
1634
- };
1635
- switch (C.key) {
1636
- case "Home":
1637
- $ = E;
1638
- break;
1639
- case "End":
1640
- $ = N;
1641
- break;
1642
- case "ArrowRight":
1643
- a === "horizontal" && (f ? q() : F());
1644
- break;
1645
- case "ArrowDown":
1646
- a === "vertical" && q();
1647
- break;
1648
- case "ArrowLeft":
1649
- a === "horizontal" && (f ? F() : q());
1650
- break;
1651
- case "ArrowUp":
1652
- a === "vertical" && F();
1653
- break;
1654
- }
1655
- const G = $ % h;
1656
- (R = m[G].ref.current) === null || R === void 0 || R.focus();
1657
- });
1658
- return /* @__PURE__ */ s.createElement(Sr, {
1659
- scope: t,
1660
- disabled: o,
1661
- direction: r,
1662
- orientation: a
1663
- }, /* @__PURE__ */ s.createElement(Ge.Slot, {
1664
- scope: t
1665
- }, /* @__PURE__ */ s.createElement(T.div, x({}, i, {
1666
- "data-orientation": a,
1667
- ref: u,
1668
- onKeyDown: o ? void 0 : v
1669
- }))));
1670
- }), Pe = "AccordionItem", [kr, Xe] = $e(Pe), Tr = /* @__PURE__ */ s.forwardRef((e, n) => {
1671
- const { __scopeAccordion: t, value: o, ...r } = e, a = he(Pe, t), i = Rr(Pe, t), c = Ke(t), u = ne(), b = o && i.value.includes(o) || !1, p = a.disabled || e.disabled;
1672
- return /* @__PURE__ */ s.createElement(kr, {
1673
- scope: t,
1674
- open: b,
1675
- disabled: p,
1676
- triggerId: u
1677
- }, /* @__PURE__ */ s.createElement(Wt, x({
1678
- "data-orientation": a.orientation,
1679
- "data-state": pn(b)
1680
- }, c, r, {
1681
- ref: n,
1682
- disabled: p,
1683
- open: b,
1684
- onOpenChange: (f) => {
1685
- f ? i.onItemOpen(o) : i.onItemClose(o);
1686
- }
1687
- })));
1688
- }), Pr = "AccordionHeader", Or = /* @__PURE__ */ s.forwardRef((e, n) => {
1689
- const { __scopeAccordion: t, ...o } = e, r = he(j, t), a = Xe(Pr, t);
1690
- return /* @__PURE__ */ s.createElement(T.h3, x({
1691
- "data-orientation": r.orientation,
1692
- "data-state": pn(a.open),
1693
- "data-disabled": a.disabled ? "" : void 0
1694
- }, o, {
1695
- ref: n
1696
- }));
1697
- }), dt = "AccordionTrigger", Dr = /* @__PURE__ */ s.forwardRef((e, n) => {
1698
- const { __scopeAccordion: t, ...o } = e, r = he(j, t), a = Xe(dt, t), i = Nr(dt, t), c = Ke(t);
1699
- return /* @__PURE__ */ s.createElement(Ge.ItemSlot, {
1700
- scope: t
1701
- }, /* @__PURE__ */ s.createElement(jt, x({
1702
- "aria-disabled": a.open && !i.collapsible || void 0,
1703
- "data-orientation": r.orientation,
1704
- id: a.triggerId
1705
- }, c, o, {
1706
- ref: n
1707
- })));
1708
- }), Mr = "AccordionContent", Fr = /* @__PURE__ */ s.forwardRef((e, n) => {
1709
- const { __scopeAccordion: t, ...o } = e, r = he(j, t), a = Xe(Mr, t), i = Ke(t);
1710
- return /* @__PURE__ */ s.createElement(qt, x({
1711
- role: "region",
1712
- "aria-labelledby": a.triggerId,
1713
- "data-orientation": r.orientation
1714
- }, i, o, {
1715
- ref: n,
1716
- style: {
1717
- "--radix-accordion-content-height": "var(--radix-collapsible-content-height)",
1718
- "--radix-accordion-content-width": "var(--radix-collapsible-content-width)",
1719
- ...e.style
1720
- }
1721
- }));
1722
- });
1723
- function pn(e) {
1724
- return e ? "open" : "closed";
1725
- }
1726
- const Lr = ln, Br = Tr, Hr = Or, Vr = Dr, Wr = Fr, B = "teddy-accordion", mn = s.forwardRef(
1727
- ({ className: e, variant: n = "default", children: t, indented: o = !1, ...r }, a) => {
1728
- const i = w(
1729
- L[B],
1730
- L[`${B}--${n}`],
1731
- {
1732
- [L[`${B}--indented`]]: o
1733
- },
1734
- e
1735
- );
1736
- return /* @__PURE__ */ l(Lr, { ...r, ref: a, className: i, children: t });
1737
- }
1738
- );
1739
- mn.displayName = "Accordion";
1740
- const jr = s.forwardRef(
1741
- ({ className: e, children: n, ...t }, o) => {
1742
- const r = w([L[`${B}__item`]], e);
1743
- return /* @__PURE__ */ l(Br, { ...t, ref: o, className: r, children: n });
1744
- }
1745
- ), gn = s.forwardRef(
1746
- ({ className: e, children: n, ...t }, o) => {
1747
- const r = w([L[`${B}__header`]], e);
1748
- return /* @__PURE__ */ l(Hr, { ...t, ref: o, asChild: !0, className: r, children: /* @__PURE__ */ l(re, { variant: "title-100", ...t.asChild ? { asChild: !0 } : { as: "h3" }, children: n }) });
1749
- }
1750
- );
1751
- gn.displayName = "Accordion.Header";
1752
- const _n = s.forwardRef(
1753
- ({ className: e, children: n, hideIndicator: t, ...o }, r) => {
1754
- const a = w([L[`${B}__trigger`]], e);
1755
- return /* @__PURE__ */ Oe(Vr, { ...o, ref: r, className: a, children: [
1756
- /* @__PURE__ */ l(bt, { children: n }),
1757
- !t && /* @__PURE__ */ l(Ye, {})
1758
- ] });
1759
- }
1760
- );
1761
- _n.displayName = "Accordion.Trigger";
1762
- const Ye = s.forwardRef(
1763
- ({ className: e, children: n, ...t }, o) => {
1764
- const r = w([L[`${B}__indicator`]], e);
1765
- return /* @__PURE__ */ l(te, { "aria-hidden": !0, name: "chevron-down", ...t, ref: o, className: r, children: n });
1766
- }
1767
- );
1768
- Ye.displayName = "Accordion.Indicator";
1769
- const vn = s.forwardRef(
1770
- ({ className: e, children: n, ...t }, o) => {
1771
- const r = w([L[`${B}__content`]], e);
1772
- return /* @__PURE__ */ l(Wr, { ...t, ref: o, className: r, children: n });
1773
- }
1774
- );
1775
- vn.displayName = "Accordion.Content";
1776
- const $n = s.forwardRef(
1777
- ({ className: e, children: n, variant: t = "title-400", ...o }, r) => {
1778
- const a = w([L[`${B}__title`]], e);
1779
- return /* @__PURE__ */ l(re, { ...o, variant: t, ref: r, className: a, children: n });
1780
- }
1781
- );
1782
- $n.displayName = "Accordion.Title";
1783
- const Ra = Object.assign(mn, {
1784
- Trigger: _n,
1785
- Content: vn,
1786
- Header: gn,
1787
- Item: jr,
1788
- Indicator: Ye,
1789
- Title: $n
1790
- }), lt = {
1791
- "teddy-badge": "_teddy-badge_sg6ab_1",
1792
- "teddy-badge--attention": "_teddy-badge--attention_sg6ab_13",
1793
- "teddy-badge--special": "_teddy-badge--special_sg6ab_17",
1794
- "teddy-badge--neutral": "_teddy-badge--neutral_sg6ab_21",
1795
- "teddy-badge--information": "_teddy-badge--information_sg6ab_25",
1796
- "teddy-badge--success": "_teddy-badge--success_sg6ab_29",
1797
- "teddy-badge--warning": "_teddy-badge--warning_sg6ab_33",
1798
- "teddy-badge--error": "_teddy-badge--error_sg6ab_37"
1799
- }, ut = "teddy-badge";
1800
- function qr(e) {
1801
- if (e === "success")
1802
- return "check-circle";
1803
- if (e === "warning")
1804
- return "alert";
1805
- if (e === "error")
1806
- return "error";
1807
- }
1808
- const Ur = s.forwardRef(
1809
- ({ className: e, variant: n, asChild: t, children: o, ...r }, a) => {
1810
- const i = w([lt[`${ut}`]], [lt[`${ut}--${n}`]], e), c = t ? Me : "span", u = qr(n);
1811
- return /* @__PURE__ */ Oe(c, { ...r, ref: a, className: i, children: [
1812
- !r.hideIcon && u && /* @__PURE__ */ l(te, { name: u }),
1813
- /* @__PURE__ */ l(bt, { children: o })
1814
- ] });
1815
- }
1816
- );
1817
- Ur.displayName = "Badge";
1818
- export {
1819
- Ra as A,
1820
- Ur as B,
1821
- ur as C,
1822
- ya as M,
1823
- Ca as N,
1824
- xa as T
1825
- };