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