@telia/teddy 0.0.10 → 0.0.12

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 (67) hide show
  1. package/dist/assets/badge.css +1 -1
  2. package/dist/assets/main.css +1 -1
  3. package/dist/assets/radio-group.css +1 -1
  4. package/dist/badge-DscsRVHR.js +1825 -0
  5. package/dist/components/accordion/accordion.js +3 -3
  6. package/dist/components/accordion/index.js +1 -1
  7. package/dist/components/badge/badge.js +3 -3
  8. package/dist/components/badge/index.js +1 -1
  9. package/dist/components/box/box.js +8 -8
  10. package/dist/components/button/button.d.ts +2 -1
  11. package/dist/components/button/button.js +59 -60
  12. package/dist/components/card/card.js +3 -3
  13. package/dist/components/card/index.js +1 -1
  14. package/dist/components/flex/flex.js +1 -1
  15. package/dist/components/grid/grid.js +6 -6
  16. package/dist/components/heading/heading.d.ts +3 -2
  17. package/dist/components/heading/heading.js +20 -21
  18. package/dist/components/index.d.ts +1 -0
  19. package/dist/components/index.js +26 -25
  20. package/dist/components/modal/index.d.ts +2 -0
  21. package/dist/components/modal/index.js +4 -0
  22. package/dist/components/modal/modal.d.ts +76 -0
  23. package/dist/components/modal/modal.js +28 -0
  24. package/dist/components/navigation-menu/index.js +1 -1
  25. package/dist/components/navigation-menu/navigation-menu.d.ts +2 -0
  26. package/dist/components/navigation-menu/navigation-menu.js +8 -1032
  27. package/dist/components/notification/index.js +1 -1
  28. package/dist/components/notification/notification.d.ts +3 -3
  29. package/dist/components/notification/notification.js +4 -4
  30. package/dist/components/radio-group/index.js +1 -1
  31. package/dist/components/radio-group/radio-group.js +1 -1
  32. package/dist/components/text-field/text-field.js +15 -15
  33. package/dist/components/toggle/index.js +1 -1
  34. package/dist/components/toggle/toggle.d.ts +2 -2
  35. package/dist/components/toggle/toggle.js +3 -3
  36. package/dist/{index-DPFZO9xk.js → index-FPIZOCcD.js} +27 -28
  37. package/dist/main.js +41 -40
  38. package/dist/navigation-menu-DKuyW8zE.js +1036 -0
  39. package/dist/{radio-group-DN1IYZdr.js → radio-group-B--zT3OL.js} +8 -8
  40. package/dist/tokens/breakpoint/variables.json.d.ts +11 -0
  41. package/dist/utils/component-props-as.d.ts +5 -0
  42. package/dist/utils/component-props-as.js +1 -0
  43. package/dist/utils/layout/align.d.ts +46 -0
  44. package/dist/utils/layout/align.js +31 -0
  45. package/dist/utils/layout/flex.d.ts +281 -10
  46. package/dist/utils/layout/flex.js +44 -8
  47. package/dist/utils/layout/gap.d.ts +340 -0
  48. package/dist/utils/layout/gap.js +21 -0
  49. package/dist/utils/layout/grid.d.ts +313 -0
  50. package/dist/utils/layout/grid.js +116 -0
  51. package/dist/utils/layout/height.d.ts +118 -0
  52. package/dist/utils/layout/height.js +50 -0
  53. package/dist/utils/layout/index.d.ts +63 -111
  54. package/dist/utils/layout/index.js +62 -147
  55. package/dist/utils/layout/justify.d.ts +39 -0
  56. package/dist/utils/layout/justify.js +16 -0
  57. package/dist/utils/layout/margin.d.ts +443 -11
  58. package/dist/utils/layout/margin.js +1 -1
  59. package/dist/utils/layout/padding.d.ts +478 -0
  60. package/dist/utils/layout/padding.js +32 -0
  61. package/dist/utils/layout/util.d.ts +78 -4
  62. package/dist/utils/layout/util.js +30 -31
  63. package/dist/utils/layout/width.d.ts +43 -7
  64. package/dist/utils/layout/width.js +6 -2
  65. package/package.json +2 -1
  66. package/dist/badge-cOFoFJw0.js +0 -798
  67. package/dist/tokens/spacing/variables.json.d.ts +0 -34
@@ -1,798 +0,0 @@
1
- import './assets/badge.css';
2
- import { jsx as s, Fragment as be, jsxs as J } from "react/jsx-runtime";
3
- import { c as _ } from "./clsx-DB4S2d7J.js";
4
- import c, { forwardRef as S, createElement as v, useCallback as et, useState as _e, useRef as E, useEffect as ue } from "react";
5
- import { _ as m, b as Q, a as $e, $ as tt } from "./index-DpfSJps6.js";
6
- import { a as Z, c as D, f as pe, e as ee, h as ot, g as nt, i as at, $ as rt, b as ct } from "./index-DPFZO9xk.js";
7
- import { $ as P } from "./index-DM5e-Whg.js";
8
- import { $ as dt } from "./radio-group-DN1IYZdr.js";
9
- import "./components/box/box.js";
10
- import "./components/flex/flex.js";
11
- import "./components/grid/grid.js";
12
- import "./components/navigation-menu/navigation-menu.js";
13
- import "./assets/5161b177f001ea1a.svg";
14
- import { Icon as q } from "./components/icon/icon.js";
15
- import { Link as st } from "./components/link/link.js";
16
- import { Button as me } from "./components/button/button.js";
17
- import "./components/field-error-text/field-error-text.js";
18
- import "./components/helper-text/helper-text.js";
19
- import "./components/input/input.js";
20
- import { Label as it } from "./components/label/label.js";
21
- import "./components/spinner/spinner.js";
22
- import { Text as lt } from "./components/text/text.js";
23
- import "./components/text-field/text-field.js";
24
- import { Heading as V } from "./components/heading/heading.js";
25
- import "./components/visually-hidden/visually-hidden.js";
26
- import { TextSpacing as ft } from "./components/text-spacing/text-spacing.js";
27
- import { composeRefs as ge } from "./utils/composeRefs.js";
28
- import { composeEventHandlers as bt } from "./utils/composeEventHandlers.js";
29
- const T = {
30
- "teddy-notification": "_teddy-notification_q80ka_3",
31
- "teddy-notification__dismiss": "_teddy-notification__dismiss_q80ka_14",
32
- "teddy-notification--success": "_teddy-notification--success_q80ka_18",
33
- "teddy-notification--warning": "_teddy-notification--warning_q80ka_23",
34
- "teddy-notification--error": "_teddy-notification--error_q80ka_28",
35
- "teddy-notification--information": "_teddy-notification--information_q80ka_33",
36
- "teddy-notification__heading": "_teddy-notification__heading_q80ka_38",
37
- "teddy-notification__icon": "_teddy-notification__icon_q80ka_43"
38
- }, ye = "Collapsible", [_t, he] = Z(ye), [ut, te] = _t(ye), $t = /* @__PURE__ */ S((e, n) => {
39
- const { __scopeCollapsible: t, open: a, defaultOpen: o, disabled: r, onOpenChange: d, ...i } = e, [l = !1, f] = D({
40
- prop: a,
41
- defaultProp: o,
42
- onChange: d
43
- });
44
- return /* @__PURE__ */ v(ut, {
45
- scope: t,
46
- disabled: r,
47
- contentId: pe(),
48
- open: l,
49
- onOpenToggle: et(
50
- () => f(
51
- (u) => !u
52
- ),
53
- [
54
- f
55
- ]
56
- )
57
- }, /* @__PURE__ */ v(P.div, m({
58
- "data-state": oe(l),
59
- "data-disabled": r ? "" : void 0
60
- }, i, {
61
- ref: n
62
- })));
63
- }), pt = "CollapsibleTrigger", mt = /* @__PURE__ */ S((e, n) => {
64
- const { __scopeCollapsible: t, ...a } = e, o = te(pt, t);
65
- return /* @__PURE__ */ v(P.button, m({
66
- type: "button",
67
- "aria-controls": o.contentId,
68
- "aria-expanded": o.open || !1,
69
- "data-state": oe(o.open),
70
- "data-disabled": o.disabled ? "" : void 0,
71
- disabled: o.disabled
72
- }, a, {
73
- ref: n,
74
- onClick: ee(e.onClick, o.onOpenToggle)
75
- }));
76
- }), Ce = "CollapsibleContent", gt = /* @__PURE__ */ S((e, n) => {
77
- const { forceMount: t, ...a } = e, o = te(Ce, e.__scopeCollapsible);
78
- return /* @__PURE__ */ v(
79
- ot,
80
- {
81
- present: t || o.open
82
- },
83
- ({ present: r }) => /* @__PURE__ */ v(yt, m({}, a, {
84
- ref: n,
85
- present: r
86
- }))
87
- );
88
- }), yt = /* @__PURE__ */ S((e, n) => {
89
- const { __scopeCollapsible: t, present: a, children: o, ...r } = e, d = te(Ce, t), [i, l] = _e(a), f = E(null), u = Q(n, f), b = E(0), x = b.current, N = E(0), w = N.current, A = d.open || i, h = E(A), C = E();
90
- return ue(() => {
91
- const $ = requestAnimationFrame(
92
- () => h.current = !1
93
- );
94
- return () => cancelAnimationFrame($);
95
- }, []), nt(() => {
96
- const $ = f.current;
97
- if ($) {
98
- C.current = C.current || {
99
- transitionDuration: $.style.transitionDuration,
100
- animationName: $.style.animationName
101
- }, $.style.transitionDuration = "0s", $.style.animationName = "none";
102
- const g = $.getBoundingClientRect();
103
- b.current = g.height, N.current = g.width, h.current || ($.style.transitionDuration = C.current.transitionDuration, $.style.animationName = C.current.animationName), l(a);
104
- }
105
- }, [
106
- d.open,
107
- a
108
- ]), /* @__PURE__ */ v(P.div, m({
109
- "data-state": oe(d.open),
110
- "data-disabled": d.disabled ? "" : void 0,
111
- id: d.contentId,
112
- hidden: !A
113
- }, r, {
114
- ref: u,
115
- style: {
116
- "--radix-collapsible-content-height": x ? `${x}px` : void 0,
117
- "--radix-collapsible-content-width": w ? `${w}px` : void 0,
118
- ...e.style
119
- }
120
- }), A && o);
121
- });
122
- function oe(e) {
123
- return e ? "open" : "closed";
124
- }
125
- const ve = $t, xe = mt, we = gt, O = "teddy-notification", Ne = c.createContext(void 0), ke = c.forwardRef(
126
- ({ className: e, open: n, defaultOpen: t, onOpenChange: a, variant: o, ...r }, d) => {
127
- const i = _([T[`${O}`]], T[`${O}--${o}`], e), [l = !0, f] = D({
128
- prop: n,
129
- defaultProp: t,
130
- onChange: a
131
- });
132
- return /* @__PURE__ */ s(Ne.Provider, { value: { variant: o }, children: /* @__PURE__ */ s(ve, { open: l, onOpenChange: f, asChild: !0, children: /* @__PURE__ */ s(we, { asChild: !0, children: /* @__PURE__ */ s(wt, { variant: "white", bordered: !0, ...r, ref: d, className: i }) }) }) });
133
- }
134
- );
135
- ke.displayName = "Notification";
136
- function ht(e) {
137
- switch (e) {
138
- case "success":
139
- return "check-circle-filled";
140
- case "error":
141
- return "error-filled";
142
- case "warning":
143
- return "alert-filled";
144
- case "information":
145
- return "info-filled";
146
- }
147
- }
148
- const Re = c.forwardRef(
149
- ({ className: e, ...n }, t) => {
150
- const a = _([T[`${O}__icon`]], e), o = c.useContext(Ne), r = n.name || ht(o == null ? void 0 : o.variant);
151
- return r ? /* @__PURE__ */ s(q, { size: "md", ...n, name: r, ref: t, className: a }) : null;
152
- }
153
- );
154
- Re.displayName = "Notification.Icon";
155
- const Ae = c.forwardRef(
156
- ({ className: e, ...n }, t) => {
157
- const a = _([T[`${O}__heading`]], e);
158
- return /* @__PURE__ */ s(V, { ...n, variant: "subsection-100", asChild: !1, ref: t, className: a });
159
- }
160
- );
161
- Ae.displayName = "Notification.Heading";
162
- const Ie = c.forwardRef(
163
- ({ className: e, ...n }, t) => {
164
- const a = _([T[`${O}__text`]], e);
165
- return /* @__PURE__ */ s(lt, { ...n, ref: t, className: a });
166
- }
167
- );
168
- Ie.displayName = "Notification.Text";
169
- const Ee = c.forwardRef(
170
- ({ className: e, children: n, ...t }, a) => {
171
- const o = _([T[`${O}__dismiss`]], e);
172
- return /* @__PURE__ */ s(xe, { asChild: !0, children: /* @__PURE__ */ s(
173
- me,
174
- {
175
- iconOnly: !0,
176
- "aria-label": "Lukk",
177
- variant: "tertiary-purple",
178
- ...t,
179
- ref: a,
180
- className: o,
181
- children: n || /* @__PURE__ */ s(q, { name: "close" })
182
- }
183
- ) });
184
- }
185
- );
186
- Ee.displayName = "Notification.Dismiss";
187
- const Oo = Object.assign(ke, {
188
- Text: Ie,
189
- Heading: Ae,
190
- Icon: Re,
191
- Dismiss: Ee
192
- }), p = {
193
- "teddy-card": "_teddy-card_18dt8_3",
194
- "teddy-card__action": "_teddy-card__action_18dt8_30",
195
- "teddy-card__action--disabled": "_teddy-card__action--disabled_18dt8_30",
196
- "teddy-card--border": "_teddy-card--border_18dt8_51",
197
- "teddy-card--purple-light": "_teddy-card--purple-light_18dt8_54",
198
- "teddy-card--purple-dark": "_teddy-card--purple-dark_18dt8_70",
199
- "teddy-card--white": "_teddy-card--white_18dt8_91",
200
- "teddy-card--gray": "_teddy-card--gray_18dt8_107",
201
- "teddy-card--beige": "_teddy-card--beige_18dt8_123",
202
- "teddy-card__image--as-background": "_teddy-card__image--as-background_18dt8_139",
203
- "teddy-card__heading": "_teddy-card__heading_18dt8_142",
204
- "teddy-card--background-image": "_teddy-card--background-image_18dt8_145",
205
- "teddy-card__image": "_teddy-card__image_18dt8_139",
206
- "teddy-card__image--inset-top": "_teddy-card__image--inset-top_18dt8_160",
207
- "teddy-card__image--inset-bottom": "_teddy-card__image--inset-bottom_18dt8_163",
208
- "teddy-card__image--inset-left": "_teddy-card__image--inset-left_18dt8_166",
209
- "teddy-card__image--inset-right": "_teddy-card__image--inset-right_18dt8_169"
210
- }, y = "teddy-card", X = `${y}__action`, Ct = ["purple-light", "purple-dark", "gray", "white", "beige"], ne = c.createContext(void 0), Pe = c.forwardRef(
211
- ({ className: e, children: n, backgroundImageSrc: t, variant: a, bordered: o, ...r }, d) => {
212
- const i = c.useRef(null), l = c.useRef(null), f = _(
213
- [p[`${y}`]],
214
- {
215
- [p[`${y}--${a}`]]: a,
216
- [p[`${y}--border`]]: o,
217
- [p[`${y}--background-image`]]: t
218
- },
219
- e
220
- );
221
- return /* @__PURE__ */ s(
222
- ft,
223
- {
224
- ...r,
225
- style: t ? { background: `url(${t})`, ...r.style } : r.style,
226
- onClick: bt(r.onClick, (u) => {
227
- var b;
228
- if (!u.isDefaultPrevented()) {
229
- if (l.current)
230
- return l.current.click();
231
- (b = i.current) == null || b.click();
232
- }
233
- }),
234
- ref: d,
235
- className: f,
236
- children: /* @__PURE__ */ s(ne.Provider, { value: { buttonRef: i, linkRef: l, variant: a }, children: n })
237
- }
238
- );
239
- }
240
- );
241
- Pe.displayName = "Card";
242
- const Te = c.forwardRef(
243
- ({ className: e, variant: n = "title-200", as: t = "h2", ...a }, o) => {
244
- const r = _([p[`${y}__heading`]], e);
245
- return /* @__PURE__ */ s(
246
- V,
247
- {
248
- ...a,
249
- ...a.asChild ? { as: void 0, asChild: !0 } : { as: t, asChild: !1 },
250
- variant: n,
251
- ref: o,
252
- className: r
253
- }
254
- );
255
- }
256
- );
257
- Te.displayName = "Card.Heading";
258
- const Oe = c.forwardRef(({ className: e, ...n }, t) => {
259
- const a = _([p[`${y}__content`]], e);
260
- return /* @__PURE__ */ s("div", { ...n, ref: t, className: a });
261
- });
262
- Oe.displayName = "Card.Content";
263
- const vt = [
264
- "top",
265
- "bottom",
266
- "left",
267
- "right",
268
- "all",
269
- "top-right-left",
270
- "bottom-left-right",
271
- "top-left",
272
- "top-right",
273
- "bottom-left",
274
- "bottom-right",
275
- "top-bottom",
276
- "left-right"
277
- ], Se = c.forwardRef(({ className: e, ...n }, t) => {
278
- var o, r, d, i, l, f, u, b;
279
- const a = _(
280
- [p[`${y}__image`]],
281
- {
282
- [p[`${y}__image--inset-top`]]: ((o = n.inset) == null ? void 0 : o.includes("top")) || ((r = n.inset) == null ? void 0 : r.includes("all")),
283
- [p[`${y}__image--inset-bottom`]]: ((d = n.inset) == null ? void 0 : d.includes("bottom")) || ((i = n.inset) == null ? void 0 : i.includes("all")),
284
- [p[`${y}__image--inset-left`]]: ((l = n.inset) == null ? void 0 : l.includes("left")) || ((f = n.inset) == null ? void 0 : f.includes("all")),
285
- [p[`${y}__image--inset-right`]]: ((u = n.inset) == null ? void 0 : u.includes("right")) || ((b = n.inset) == null ? void 0 : b.includes("all"))
286
- },
287
- e
288
- );
289
- return /* @__PURE__ */ s("img", { ...n, ref: t, className: a });
290
- });
291
- Se.displayName = "Card.Image";
292
- function xt(e) {
293
- switch (e) {
294
- case "purple-dark":
295
- return "primary-negative";
296
- default:
297
- return "primary";
298
- }
299
- }
300
- const De = c.forwardRef(
301
- ({ className: e, iconOnly: n = !1, ...t }, a) => {
302
- const o = c.useContext(ne), r = _(
303
- [p[`${y}__button`]],
304
- p[X],
305
- {
306
- [p[`${X}--disabled`]]: t.disabled
307
- },
308
- e
309
- ), d = ge(o == null ? void 0 : o.buttonRef, a);
310
- return /* @__PURE__ */ s(be, { children: /* @__PURE__ */ s(
311
- me,
312
- {
313
- ...!n || !t["aria-label"] ? { iconOnly: !1, "aria-label": void 0 } : { iconOnly: !0, "aria-label": t["aria-label"] },
314
- ...t,
315
- ref: d,
316
- variant: xt(o == null ? void 0 : o.variant),
317
- className: r
318
- }
319
- ) });
320
- }
321
- );
322
- De.displayName = "Card.Button";
323
- const qe = c.forwardRef(
324
- ({ className: e, ...n }, t) => {
325
- const a = c.useContext(ne), o = _([p[`${y}__link`]], p[X], e), r = ge(a == null ? void 0 : a.linkRef, t);
326
- return /* @__PURE__ */ s(st, { ...n, ref: r, className: o });
327
- }
328
- );
329
- qe.displayName = "Card.Link";
330
- const wt = Object.assign(Pe, {
331
- Heading: Te,
332
- Content: Oe,
333
- Image: Se,
334
- Button: De,
335
- Link: qe,
336
- variantOptions: Ct,
337
- insetOptions: vt
338
- }), Me = "Switch", [Nt, So] = Z(Me), [kt, Rt] = Nt(Me), At = /* @__PURE__ */ S((e, n) => {
339
- const { __scopeSwitch: t, name: a, checked: o, defaultChecked: r, required: d, disabled: i, value: l = "on", onCheckedChange: f, ...u } = e, [b, x] = _e(null), N = Q(
340
- n,
341
- ($) => x($)
342
- ), w = E(!1), A = b ? !!b.closest("form") : !0, [h = !1, C] = D({
343
- prop: o,
344
- defaultProp: r,
345
- onChange: f
346
- });
347
- return /* @__PURE__ */ v(kt, {
348
- scope: t,
349
- checked: h,
350
- disabled: i
351
- }, /* @__PURE__ */ v(P.button, m({
352
- type: "button",
353
- role: "switch",
354
- "aria-checked": h,
355
- "aria-required": d,
356
- "data-state": He(h),
357
- "data-disabled": i ? "" : void 0,
358
- disabled: i,
359
- value: l
360
- }, u, {
361
- ref: N,
362
- onClick: ee(e.onClick, ($) => {
363
- C(
364
- (g) => !g
365
- ), A && (w.current = $.isPropagationStopped(), w.current || $.stopPropagation());
366
- })
367
- })), A && /* @__PURE__ */ v(Pt, {
368
- control: b,
369
- bubbles: !w.current,
370
- name: a,
371
- value: l,
372
- checked: h,
373
- required: d,
374
- disabled: i,
375
- style: {
376
- transform: "translateX(-100%)"
377
- }
378
- }));
379
- }), It = "SwitchThumb", Et = /* @__PURE__ */ S((e, n) => {
380
- const { __scopeSwitch: t, ...a } = e, o = Rt(It, t);
381
- return /* @__PURE__ */ v(P.span, m({
382
- "data-state": He(o.checked),
383
- "data-disabled": o.disabled ? "" : void 0
384
- }, a, {
385
- ref: n
386
- }));
387
- }), Pt = (e) => {
388
- const { control: n, checked: t, bubbles: a = !0, ...o } = e, r = E(null), d = at(t), i = dt(n);
389
- return ue(() => {
390
- const l = r.current, f = window.HTMLInputElement.prototype, b = Object.getOwnPropertyDescriptor(f, "checked").set;
391
- if (d !== t && b) {
392
- const x = new Event("click", {
393
- bubbles: a
394
- });
395
- b.call(l, t), l.dispatchEvent(x);
396
- }
397
- }, [
398
- d,
399
- t,
400
- a
401
- ]), /* @__PURE__ */ v("input", m({
402
- type: "checkbox",
403
- "aria-hidden": !0,
404
- defaultChecked: t
405
- }, o, {
406
- tabIndex: -1,
407
- ref: r,
408
- style: {
409
- ...e.style,
410
- ...i,
411
- position: "absolute",
412
- pointerEvents: "none",
413
- opacity: 0,
414
- margin: 0
415
- }
416
- }));
417
- };
418
- function He(e) {
419
- return e ? "checked" : "unchecked";
420
- }
421
- const Tt = At, Ot = Et, M = {
422
- "teddy-toggle": "_teddy-toggle_1rp8d_3",
423
- "teddy-toggle__input": "_teddy-toggle__input_1rp8d_10",
424
- "teddy-toggle__thumb": "_teddy-toggle__thumb_1rp8d_78",
425
- "teddy-toggle__indicator": "_teddy-toggle__indicator_1rp8d_104"
426
- }, H = "teddy-toggle", ae = c.createContext(void 0), Ve = c.forwardRef(
427
- ({ className: e, id: n, children: t, ...a }, o) => {
428
- const r = _([M[`${H}`]], e), d = c.useId(), [i, l] = c.useState(!1), [f, u] = c.useState(!1);
429
- return /* @__PURE__ */ s("div", { ...a, ref: o, className: r, children: /* @__PURE__ */ s(ae.Provider, { value: { id: n ?? d, isDisabled: i, setIsDisabled: l, isRequired: f, setIsRequired: u }, children: t }) });
430
- }
431
- );
432
- Ve.displayName = "Toggle";
433
- const Le = c.forwardRef(
434
- ({ className: e, ...n }, t) => {
435
- const a = _([M[`${H}__label`]], e), o = c.useContext(ae);
436
- return /* @__PURE__ */ s(
437
- it,
438
- {
439
- ...n,
440
- htmlFor: o == null ? void 0 : o.id,
441
- isRequired: o == null ? void 0 : o.isRequired,
442
- disabled: o == null ? void 0 : o.isDisabled,
443
- ref: t,
444
- className: a
445
- }
446
- );
447
- }
448
- );
449
- Le.displayName = "Toggle.Label";
450
- const Be = c.forwardRef(
451
- ({ className: e, children: n, ...t }, a) => {
452
- const o = _([M[`${H}__input`]], e), r = c.useContext(ae);
453
- return c.useEffect(() => {
454
- r && r.setIsDisabled(t.disabled === !0);
455
- }, [r, t.disabled]), c.useEffect(() => {
456
- r && r.setIsRequired(t.required === !0);
457
- }, [r, t.required]), /* @__PURE__ */ s(Tt, { ...t, id: r == null ? void 0 : r.id, ref: a, className: o, children: n || /* @__PURE__ */ J(be, { children: [
458
- /* @__PURE__ */ s(L, {}),
459
- /* @__PURE__ */ s(je, {})
460
- ] }) });
461
- }
462
- );
463
- Be.displayName = "Toggle.Input";
464
- const L = c.forwardRef(
465
- ({ className: e, ...n }, t) => {
466
- const a = _([M[`${H}__thumb`]], e);
467
- return /* @__PURE__ */ s(Ot, { ...n, ref: t, className: a });
468
- }
469
- );
470
- L.displayName = "Toggle.Thumb";
471
- const je = c.forwardRef(
472
- ({ className: e, ...n }, t) => {
473
- const a = _([M[`${H}__indicator`]], e);
474
- return /* @__PURE__ */ s(q, { name: "checkmark-bold", size: "xxs", ...n, ref: t, className: a });
475
- }
476
- );
477
- L.displayName = "Toggle.Indicator";
478
- const Do = Object.assign(Ve, {
479
- Label: Le,
480
- Input: Be,
481
- Thumb: L,
482
- Indicator: je
483
- }), St = "_slideDown_fs2mc_1", Dt = "_slideUp_fs2mc_1", k = {
484
- "teddy-accordion--indented": "_teddy-accordion--indented_fs2mc_3",
485
- "teddy-accordion__trigger": "_teddy-accordion__trigger_fs2mc_3",
486
- "teddy-accordion__content": "_teddy-accordion__content_fs2mc_4",
487
- "teddy-accordion--negative": "_teddy-accordion--negative_fs2mc_13",
488
- "teddy-accordion__header": "_teddy-accordion__header_fs2mc_13",
489
- "teddy-accordion__title": "_teddy-accordion__title_fs2mc_17",
490
- "teddy-accordion__item": "_teddy-accordion__item_fs2mc_28",
491
- "teddy-accordion": "_teddy-accordion_fs2mc_3",
492
- "teddy-accordion__indicator": "_teddy-accordion__indicator_fs2mc_107",
493
- slideDown: St,
494
- slideUp: Dt
495
- }, I = "Accordion", qt = [
496
- "Home",
497
- "End",
498
- "ArrowDown",
499
- "ArrowUp",
500
- "ArrowLeft",
501
- "ArrowRight"
502
- ], [re, Mt, Ht] = rt(I), [B, qo] = Z(I, [
503
- Ht,
504
- he
505
- ]), ce = he(), Fe = /* @__PURE__ */ c.forwardRef((e, n) => {
506
- const { type: t, ...a } = e, o = a, r = a;
507
- return /* @__PURE__ */ c.createElement(re.Provider, {
508
- scope: e.__scopeAccordion
509
- }, t === "multiple" ? /* @__PURE__ */ c.createElement(jt, m({}, r, {
510
- ref: n
511
- })) : /* @__PURE__ */ c.createElement(Bt, m({}, o, {
512
- ref: n
513
- })));
514
- });
515
- Fe.propTypes = {
516
- type(e) {
517
- const n = e.value || e.defaultValue;
518
- return e.type && ![
519
- "single",
520
- "multiple"
521
- ].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;
522
- }
523
- };
524
- const [Ue, Vt] = B(I), [ze, Lt] = B(I, {
525
- collapsible: !1
526
- }), Bt = /* @__PURE__ */ c.forwardRef((e, n) => {
527
- const { value: t, defaultValue: a, onValueChange: o = () => {
528
- }, collapsible: r = !1, ...d } = e, [i, l] = D({
529
- prop: t,
530
- defaultProp: a,
531
- onChange: o
532
- });
533
- return /* @__PURE__ */ c.createElement(Ue, {
534
- scope: e.__scopeAccordion,
535
- value: i ? [
536
- i
537
- ] : [],
538
- onItemOpen: l,
539
- onItemClose: c.useCallback(
540
- () => r && l(""),
541
- [
542
- r,
543
- l
544
- ]
545
- )
546
- }, /* @__PURE__ */ c.createElement(ze, {
547
- scope: e.__scopeAccordion,
548
- collapsible: r
549
- }, /* @__PURE__ */ c.createElement(Ge, m({}, d, {
550
- ref: n
551
- }))));
552
- }), jt = /* @__PURE__ */ c.forwardRef((e, n) => {
553
- const { value: t, defaultValue: a, onValueChange: o = () => {
554
- }, ...r } = e, [d = [], i] = D({
555
- prop: t,
556
- defaultProp: a,
557
- onChange: o
558
- }), l = c.useCallback(
559
- (u) => i(
560
- (b = []) => [
561
- ...b,
562
- u
563
- ]
564
- ),
565
- [
566
- i
567
- ]
568
- ), f = c.useCallback(
569
- (u) => i(
570
- (b = []) => b.filter(
571
- (x) => x !== u
572
- )
573
- ),
574
- [
575
- i
576
- ]
577
- );
578
- return /* @__PURE__ */ c.createElement(Ue, {
579
- scope: e.__scopeAccordion,
580
- value: d,
581
- onItemOpen: l,
582
- onItemClose: f
583
- }, /* @__PURE__ */ c.createElement(ze, {
584
- scope: e.__scopeAccordion,
585
- collapsible: !0
586
- }, /* @__PURE__ */ c.createElement(Ge, m({}, r, {
587
- ref: n
588
- }))));
589
- }), [Ft, j] = B(I), Ge = /* @__PURE__ */ c.forwardRef((e, n) => {
590
- const { __scopeAccordion: t, disabled: a, dir: o, orientation: r = "vertical", ...d } = e, i = c.useRef(null), l = Q(i, n), f = Mt(t), b = ct(o) === "ltr", x = ee(e.onKeyDown, (N) => {
591
- var w;
592
- if (!qt.includes(N.key))
593
- return;
594
- const A = N.target, h = f().filter((K) => {
595
- var W;
596
- return !((W = K.ref.current) !== null && W !== void 0 && W.disabled);
597
- }), C = h.findIndex(
598
- (K) => K.ref.current === A
599
- ), $ = h.length;
600
- if (C === -1)
601
- return;
602
- N.preventDefault();
603
- let g = C;
604
- const F = 0, U = $ - 1, z = () => {
605
- g = C + 1, g > U && (g = F);
606
- }, G = () => {
607
- g = C - 1, g < F && (g = U);
608
- };
609
- switch (N.key) {
610
- case "Home":
611
- g = F;
612
- break;
613
- case "End":
614
- g = U;
615
- break;
616
- case "ArrowRight":
617
- r === "horizontal" && (b ? z() : G());
618
- break;
619
- case "ArrowDown":
620
- r === "vertical" && z();
621
- break;
622
- case "ArrowLeft":
623
- r === "horizontal" && (b ? G() : z());
624
- break;
625
- case "ArrowUp":
626
- r === "vertical" && G();
627
- break;
628
- }
629
- const Ze = g % $;
630
- (w = h[Ze].ref.current) === null || w === void 0 || w.focus();
631
- });
632
- return /* @__PURE__ */ c.createElement(Ft, {
633
- scope: t,
634
- disabled: a,
635
- direction: o,
636
- orientation: r
637
- }, /* @__PURE__ */ c.createElement(re.Slot, {
638
- scope: t
639
- }, /* @__PURE__ */ c.createElement(P.div, m({}, d, {
640
- "data-orientation": r,
641
- ref: l,
642
- onKeyDown: a ? void 0 : x
643
- }))));
644
- }), Y = "AccordionItem", [Ut, de] = B(Y), zt = /* @__PURE__ */ c.forwardRef((e, n) => {
645
- const { __scopeAccordion: t, value: a, ...o } = e, r = j(Y, t), d = Vt(Y, t), i = ce(t), l = pe(), f = a && d.value.includes(a) || !1, u = r.disabled || e.disabled;
646
- return /* @__PURE__ */ c.createElement(Ut, {
647
- scope: t,
648
- open: f,
649
- disabled: u,
650
- triggerId: l
651
- }, /* @__PURE__ */ c.createElement(ve, m({
652
- "data-orientation": r.orientation,
653
- "data-state": Ke(f)
654
- }, i, o, {
655
- ref: n,
656
- disabled: u,
657
- open: f,
658
- onOpenChange: (b) => {
659
- b ? d.onItemOpen(a) : d.onItemClose(a);
660
- }
661
- })));
662
- }), Gt = "AccordionHeader", Kt = /* @__PURE__ */ c.forwardRef((e, n) => {
663
- const { __scopeAccordion: t, ...a } = e, o = j(I, t), r = de(Gt, t);
664
- return /* @__PURE__ */ c.createElement(P.h3, m({
665
- "data-orientation": o.orientation,
666
- "data-state": Ke(r.open),
667
- "data-disabled": r.disabled ? "" : void 0
668
- }, a, {
669
- ref: n
670
- }));
671
- }), ie = "AccordionTrigger", Wt = /* @__PURE__ */ c.forwardRef((e, n) => {
672
- const { __scopeAccordion: t, ...a } = e, o = j(I, t), r = de(ie, t), d = Lt(ie, t), i = ce(t);
673
- return /* @__PURE__ */ c.createElement(re.ItemSlot, {
674
- scope: t
675
- }, /* @__PURE__ */ c.createElement(xe, m({
676
- "aria-disabled": r.open && !d.collapsible || void 0,
677
- "data-orientation": o.orientation,
678
- id: r.triggerId
679
- }, i, a, {
680
- ref: n
681
- })));
682
- }), Xt = "AccordionContent", Yt = /* @__PURE__ */ c.forwardRef((e, n) => {
683
- const { __scopeAccordion: t, ...a } = e, o = j(I, t), r = de(Xt, t), d = ce(t);
684
- return /* @__PURE__ */ c.createElement(we, m({
685
- role: "region",
686
- "aria-labelledby": r.triggerId,
687
- "data-orientation": o.orientation
688
- }, d, a, {
689
- ref: n,
690
- style: {
691
- "--radix-accordion-content-height": "var(--radix-collapsible-content-height)",
692
- "--radix-accordion-content-width": "var(--radix-collapsible-content-width)",
693
- ...e.style
694
- }
695
- }));
696
- });
697
- function Ke(e) {
698
- return e ? "open" : "closed";
699
- }
700
- const Jt = Fe, Qt = zt, Zt = Kt, eo = Wt, to = Yt, R = "teddy-accordion", We = c.forwardRef(
701
- ({ className: e, variant: n = "default", children: t, indented: a = !1, ...o }, r) => {
702
- const d = _(
703
- k[R],
704
- k[`${R}--${n}`],
705
- {
706
- [k[`${R}--indented`]]: a
707
- },
708
- e
709
- );
710
- return /* @__PURE__ */ s(Jt, { ...o, ref: r, className: d, children: t });
711
- }
712
- );
713
- We.displayName = "Accordion";
714
- const oo = c.forwardRef(
715
- ({ className: e, children: n, ...t }, a) => {
716
- const o = _([k[`${R}__item`]], e);
717
- return /* @__PURE__ */ s(Qt, { ...t, ref: a, className: o, children: n });
718
- }
719
- ), Xe = c.forwardRef(
720
- ({ className: e, children: n, ...t }, a) => {
721
- const o = _([k[`${R}__header`]], e);
722
- return /* @__PURE__ */ s(Zt, { ...t, ref: a, asChild: !0, className: o, children: /* @__PURE__ */ s(V, { variant: "title-100", ...t.asChild ? { asChild: !0 } : { as: "h3" }, children: n }) });
723
- }
724
- );
725
- Xe.displayName = "Accordion.Header";
726
- const Ye = c.forwardRef(
727
- ({ className: e, children: n, hideIndicator: t, ...a }, o) => {
728
- const r = _([k[`${R}__trigger`]], e);
729
- return /* @__PURE__ */ J(eo, { ...a, ref: o, className: r, children: [
730
- /* @__PURE__ */ s($e, { children: n }),
731
- !t && /* @__PURE__ */ s(se, {})
732
- ] });
733
- }
734
- );
735
- Ye.displayName = "Accordion.Trigger";
736
- const se = c.forwardRef(
737
- ({ className: e, children: n, ...t }, a) => {
738
- const o = _([k[`${R}__indicator`]], e);
739
- return /* @__PURE__ */ s(q, { "aria-hidden": !0, name: "chevron-down", ...t, ref: a, className: o, children: n });
740
- }
741
- );
742
- se.displayName = "Accordion.Indicator";
743
- const Je = c.forwardRef(
744
- ({ className: e, children: n, ...t }, a) => {
745
- const o = _([k[`${R}__content`]], e);
746
- return /* @__PURE__ */ s(to, { ...t, ref: a, className: o, children: n });
747
- }
748
- );
749
- Je.displayName = "Accordion.Content";
750
- const Qe = c.forwardRef(
751
- ({ className: e, children: n, variant: t = "title-300", ...a }, o) => {
752
- const r = _([k[`${R}__title`]], e);
753
- return /* @__PURE__ */ s(V, { ...a, variant: t, ref: o, className: r, children: n });
754
- }
755
- );
756
- Qe.displayName = "Accordion.Title";
757
- const Mo = Object.assign(We, {
758
- Trigger: Ye,
759
- Content: Je,
760
- Header: Xe,
761
- Item: oo,
762
- Indicator: se,
763
- Title: Qe
764
- }), le = {
765
- "teddy-badge": "_teddy-badge_sg6ab_1",
766
- "teddy-badge--attention": "_teddy-badge--attention_sg6ab_13",
767
- "teddy-badge--special": "_teddy-badge--special_sg6ab_17",
768
- "teddy-badge--neutral": "_teddy-badge--neutral_sg6ab_21",
769
- "teddy-badge--information": "_teddy-badge--information_sg6ab_25",
770
- "teddy-badge--success": "_teddy-badge--success_sg6ab_29",
771
- "teddy-badge--warning": "_teddy-badge--warning_sg6ab_33",
772
- "teddy-badge--error": "_teddy-badge--error_sg6ab_37"
773
- }, fe = "teddy-badge";
774
- function no(e) {
775
- if (e === "success")
776
- return "check-circle";
777
- if (e === "warning")
778
- return "alert";
779
- if (e === "error")
780
- return "error";
781
- }
782
- const ao = c.forwardRef(
783
- ({ className: e, variant: n, asChild: t, children: a, ...o }, r) => {
784
- const d = _([le[`${fe}`]], [le[`${fe}--${n}`]], e), i = t ? tt : "span", l = no(n);
785
- return /* @__PURE__ */ J(i, { ...o, ref: r, className: d, children: [
786
- !o.hideIcon && l && /* @__PURE__ */ s(q, { name: l }),
787
- /* @__PURE__ */ s($e, { children: a })
788
- ] });
789
- }
790
- );
791
- ao.displayName = "Badge";
792
- export {
793
- Mo as A,
794
- ao as B,
795
- wt as C,
796
- Oo as N,
797
- Do as T
798
- };