prometeo-design-system 9.3.0 → 9.4.2
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/FormField.d.ts +6 -0
- package/dist/FormField.es.js +62 -0
- package/dist/FormFieldContext-H8_osEEP.js +11 -0
- package/dist/HelperComponent.es.js +20 -20
- package/dist/SegmentedButton.es.js +153 -147
- package/dist/Select.es.js +76 -76
- package/dist/components/FormField/FormField.d.ts +4 -0
- package/dist/components/FormField/FormFieldContext.d.ts +22 -0
- package/dist/components/FormField/types.d.ts +23 -0
- package/dist/components/SegmentedButton/SegmentedButton.d.ts +9 -0
- package/dist/components/Shared/HelperComponent.d.ts +1 -0
- package/dist/exports/FormField.d.ts +4 -0
- package/dist/index.d.ts +3 -0
- package/dist/prometeo-design-system.es.js +149 -145
- package/package.json +5 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime-CqQglQKg.js";
|
|
2
|
+
import { c as p } from "./cn-B6yFEsav.js";
|
|
3
|
+
import { memo as b, useId as j } from "react";
|
|
4
|
+
import I from "./HelperComponent.es.js";
|
|
5
|
+
import { f as g } from "./fieldVariants-Ci6QYhCb.js";
|
|
6
|
+
import { F as N } from "./FormFieldContext-H8_osEEP.js";
|
|
7
|
+
import { u as E } from "./FormFieldContext-H8_osEEP.js";
|
|
8
|
+
const y = b(function(f) {
|
|
9
|
+
const {
|
|
10
|
+
label: l,
|
|
11
|
+
supportingText: o,
|
|
12
|
+
showSupportingText: u,
|
|
13
|
+
state: r = "default",
|
|
14
|
+
disabled: t = !1,
|
|
15
|
+
required: d = !1,
|
|
16
|
+
htmlFor: m,
|
|
17
|
+
children: x,
|
|
18
|
+
className: h
|
|
19
|
+
} = f, s = j(), a = l ? `${s}-label` : void 0, i = `${s}-helper`, F = m ?? `${s}-control`, c = typeof o == "function" ? o() : o, n = u ?? c != null, v = {
|
|
20
|
+
labelId: a,
|
|
21
|
+
helperId: n ? i : void 0,
|
|
22
|
+
labelledBy: a,
|
|
23
|
+
describedBy: n ? i : void 0,
|
|
24
|
+
controlId: F,
|
|
25
|
+
state: r,
|
|
26
|
+
disabled: t,
|
|
27
|
+
required: d
|
|
28
|
+
};
|
|
29
|
+
return /* @__PURE__ */ e.jsx(N.Provider, { value: v, children: /* @__PURE__ */ e.jsxs("div", { className: p("relative flex w-full flex-col gap-1", h), children: [
|
|
30
|
+
l ? /* @__PURE__ */ e.jsx(
|
|
31
|
+
"label",
|
|
32
|
+
{
|
|
33
|
+
id: a,
|
|
34
|
+
htmlFor: m,
|
|
35
|
+
className: p(
|
|
36
|
+
g({ state: r, disabled: t }),
|
|
37
|
+
"relative z-10",
|
|
38
|
+
d && "after:ml-0.5 after:content-['*']"
|
|
39
|
+
),
|
|
40
|
+
children: l
|
|
41
|
+
}
|
|
42
|
+
) : null,
|
|
43
|
+
x,
|
|
44
|
+
n ? /* @__PURE__ */ e.jsx(
|
|
45
|
+
I,
|
|
46
|
+
{
|
|
47
|
+
id: i,
|
|
48
|
+
variant: r,
|
|
49
|
+
disabled: t,
|
|
50
|
+
className: "min-h-4",
|
|
51
|
+
children: c
|
|
52
|
+
}
|
|
53
|
+
) : null
|
|
54
|
+
] }) });
|
|
55
|
+
});
|
|
56
|
+
y.displayName = "FormField";
|
|
57
|
+
export {
|
|
58
|
+
y as FormField,
|
|
59
|
+
N as FormFieldContext,
|
|
60
|
+
y as default,
|
|
61
|
+
E as useFormField
|
|
62
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { j as s } from "./jsx-runtime-CqQglQKg.js";
|
|
2
2
|
import { c as r } from "./cn-B6yFEsav.js";
|
|
3
3
|
import { c as i } from "./index-BOQuZ0gG.js";
|
|
4
|
-
import { memo as
|
|
5
|
-
import { Warning as
|
|
6
|
-
import { CheckCircle as
|
|
7
|
-
import { Error as
|
|
8
|
-
import { Info as
|
|
9
|
-
const
|
|
4
|
+
import { memo as c } from "react";
|
|
5
|
+
import { Warning as o } from "./Icon-Warning.es.js";
|
|
6
|
+
import { CheckCircle as u } from "./Icon-CheckCircle.es.js";
|
|
7
|
+
import { Error as f } from "./Icon-Error.es.js";
|
|
8
|
+
import { Info as m } from "./Icon-Info.es.js";
|
|
9
|
+
const b = i("truncate", {
|
|
10
10
|
variants: {
|
|
11
11
|
variant: {
|
|
12
12
|
default: "text-neutral-tertiary-default",
|
|
@@ -23,7 +23,7 @@ const m = i("truncate", {
|
|
|
23
23
|
variant: "default",
|
|
24
24
|
disabled: !1
|
|
25
25
|
}
|
|
26
|
-
}),
|
|
26
|
+
}), v = i("min-h-4 shrink-0", {
|
|
27
27
|
variants: {
|
|
28
28
|
variant: {
|
|
29
29
|
default: "",
|
|
@@ -50,23 +50,23 @@ const m = i("truncate", {
|
|
|
50
50
|
variant: "default",
|
|
51
51
|
disabled: !1
|
|
52
52
|
}
|
|
53
|
-
}),
|
|
53
|
+
}), x = (a, t) => {
|
|
54
54
|
const e = {
|
|
55
|
-
default:
|
|
56
|
-
error:
|
|
57
|
-
success:
|
|
58
|
-
warning:
|
|
55
|
+
default: m,
|
|
56
|
+
error: f,
|
|
57
|
+
success: u,
|
|
58
|
+
warning: o
|
|
59
59
|
}[a];
|
|
60
|
-
return /* @__PURE__ */ s.jsx(e, { size: 16, className: r(
|
|
61
|
-
},
|
|
62
|
-
const { variant: t, className: n, disabled: e } = a;
|
|
63
|
-
return /* @__PURE__ */ s.jsxs("div", { ref: a.ref, className: r("flex gap-0.5 px-3 items-center prometeo-fonts-body-small", e &&
|
|
64
|
-
a.children &&
|
|
65
|
-
typeof a.children == "string" ? /* @__PURE__ */ s.jsx("p", { title: a.children, className: r(" prometeo-fonts-body-small",
|
|
60
|
+
return /* @__PURE__ */ s.jsx(e, { size: 16, className: r(v({ variant: a, disabled: t })) });
|
|
61
|
+
}, p = "*:text-disabled-default *:icon-disabled-default", l = (a) => {
|
|
62
|
+
const { variant: t, className: n, disabled: e, id: d } = a;
|
|
63
|
+
return /* @__PURE__ */ s.jsxs("div", { id: d, ref: a.ref, className: r("flex gap-0.5 px-3 items-center prometeo-fonts-body-small", e && p, n), children: [
|
|
64
|
+
a.children && x(t, e ?? !1),
|
|
65
|
+
typeof a.children == "string" ? /* @__PURE__ */ s.jsx("p", { title: a.children, className: r(" prometeo-fonts-body-small", b({ variant: t, disabled: e })), children: a.children }) : a.children
|
|
66
66
|
] });
|
|
67
67
|
};
|
|
68
68
|
l.displayName = "HelperText";
|
|
69
|
-
const
|
|
69
|
+
const H = c(l);
|
|
70
70
|
export {
|
|
71
|
-
|
|
71
|
+
H as default
|
|
72
72
|
};
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { j as
|
|
1
|
+
import { j as u } from "./jsx-runtime-CqQglQKg.js";
|
|
2
2
|
import { c as m } from "./cn-B6yFEsav.js";
|
|
3
|
-
import { c as
|
|
4
|
-
import
|
|
5
|
-
import { useDragScroll as
|
|
6
|
-
import {
|
|
7
|
-
|
|
3
|
+
import { c as H } from "./index-BOQuZ0gG.js";
|
|
4
|
+
import X, { useSyncExternalStore as it, useId as st, useRef as f, useState as O, useLayoutEffect as V, useEffect as S } from "react";
|
|
5
|
+
import { useDragScroll as ct } from "./useDragScroll.es.js";
|
|
6
|
+
import { u as dt } from "./FormFieldContext-H8_osEEP.js";
|
|
7
|
+
import { PlainTooltip as ut } from "./PlainTooltip.es.js";
|
|
8
|
+
const Ie = "(prefers-reduced-motion: reduce)", ft = () => !1, mt = () => typeof window > "u" ? !1 : window.matchMedia(Ie).matches, pt = (a) => {
|
|
8
9
|
if (typeof window > "u") return () => {
|
|
9
10
|
};
|
|
10
|
-
const
|
|
11
|
-
return
|
|
12
|
-
},
|
|
11
|
+
const o = window.matchMedia(Ie);
|
|
12
|
+
return o.addEventListener("change", a), () => o.removeEventListener("change", a);
|
|
13
|
+
}, bt = () => it(pt, mt, ft), gt = (a, o, v) => v ? { commit: null, pending: o } : a && a.left === o.left && a.right === o.right ? { commit: null, pending: null } : { commit: o, pending: null }, ht = {
|
|
13
14
|
default: "brand",
|
|
14
15
|
danger: "error"
|
|
15
16
|
}, n = {
|
|
@@ -68,29 +69,29 @@ const Te = "(prefers-reduced-motion: reduce)", lt = () => !1, at = () => typeof
|
|
|
68
69
|
option: "px-3 py-1 min-h-7 pyrion-fonts-body-small"
|
|
69
70
|
},
|
|
70
71
|
medium: {
|
|
71
|
-
container: "py-[3px] px-[3px]",
|
|
72
|
+
container: "py-[3px] px-[3px] radius-large",
|
|
72
73
|
pill: "py-2 min-h-[34px] radius-medium",
|
|
73
74
|
option: "px-3 py-2 min-h-[34px] pyrion-fonts-body-medium"
|
|
74
75
|
},
|
|
75
76
|
large: {
|
|
76
|
-
container: "py-[3px] px-[3px]",
|
|
77
|
+
container: "py-[3px] px-[3px] radius-large",
|
|
77
78
|
pill: "py-2.5 radius-medium",
|
|
78
79
|
option: "px-4 py-2 min-h-10 pyrion-fonts-body-medium"
|
|
79
80
|
}
|
|
80
|
-
}, D = 20,
|
|
81
|
+
}, D = 20, we = 4, ve = 8, xt = { small: 280, medium: 320, large: 360 }, yt = 300, N = "cubic-bezier(0.2,0,0,1)", wt = "cubic-bezier(0.34,1.4,0.64,1)", vt = "cubic-bezier(0.3,0,0.2,1)", Te = {
|
|
81
82
|
natural: "auto-cols-[minmax(0,max-content)]",
|
|
82
83
|
equal: "auto-cols-[minmax(0,1fr)]"
|
|
83
|
-
},
|
|
84
|
+
}, Tt = "[transition:var(--sb-motion)] motion-reduce:transition-none", Rt = "[transition:var(--sb-motion-text)] motion-reduce:transition-none", It = "[transition:var(--sb-motion-weight)] motion-reduce:transition-none", Nt = "[transition:var(--sb-motion-slot)] motion-reduce:transition-none", Re = (a, o, v) => Math.min(v, Math.max(o, a)), Et = (a, o) => typeof a == "function" ? X.createElement(a, {
|
|
84
85
|
size: D,
|
|
85
|
-
className: m(
|
|
86
|
-
}) :
|
|
86
|
+
className: m(o, "shrink-0!")
|
|
87
|
+
}) : X.cloneElement(
|
|
87
88
|
a,
|
|
88
89
|
{
|
|
89
90
|
size: D,
|
|
90
|
-
className: m(
|
|
91
|
+
className: m(o, "shrink-0!")
|
|
91
92
|
}
|
|
92
|
-
),
|
|
93
|
-
"relative border inline-flex bg-neutral-default-default border-neutral-default-default
|
|
93
|
+
), Ct = H(
|
|
94
|
+
"relative border inline-flex bg-neutral-default-default border-neutral-default-default shadow-[var(--dropshadow-inset-100)]",
|
|
94
95
|
{
|
|
95
96
|
variants: {
|
|
96
97
|
size: {
|
|
@@ -120,7 +121,7 @@ const Te = "(prefers-reduced-motion: reduce)", lt = () => !1, at = () => typeof
|
|
|
120
121
|
color: "brand"
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
|
-
),
|
|
124
|
+
), Mt = H(
|
|
124
125
|
"absolute top-0 bottom-0 z-10",
|
|
125
126
|
{
|
|
126
127
|
variants: {
|
|
@@ -151,7 +152,7 @@ const Te = "(prefers-reduced-motion: reduce)", lt = () => !1, at = () => typeof
|
|
|
151
152
|
color: "brand"
|
|
152
153
|
}
|
|
153
154
|
}
|
|
154
|
-
),
|
|
155
|
+
), Bt = H("relative flex items-center justify-center", {
|
|
155
156
|
variants: {
|
|
156
157
|
size: {
|
|
157
158
|
small: h.small.option,
|
|
@@ -179,217 +180,222 @@ const Te = "(prefers-reduced-motion: reduce)", lt = () => !1, at = () => typeof
|
|
|
179
180
|
size: "medium",
|
|
180
181
|
color: "brand"
|
|
181
182
|
}
|
|
182
|
-
}),
|
|
183
|
+
}), kt = (a) => {
|
|
183
184
|
const {
|
|
184
|
-
size:
|
|
185
|
-
color:
|
|
185
|
+
size: o = "medium",
|
|
186
|
+
color: v = "default",
|
|
186
187
|
options: E,
|
|
187
|
-
value:
|
|
188
|
-
name:
|
|
189
|
-
ariaLabel:
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
188
|
+
value: Ne,
|
|
189
|
+
name: Q,
|
|
190
|
+
ariaLabel: Ee,
|
|
191
|
+
ariaLabelledBy: Ce,
|
|
192
|
+
ariaDescribedBy: Me,
|
|
193
|
+
onChange: Be,
|
|
194
|
+
icon: F,
|
|
195
|
+
allowExpand: Y,
|
|
196
|
+
equalWidth: Le,
|
|
194
197
|
overflow: C = "truncate",
|
|
195
|
-
collapseAt:
|
|
196
|
-
disableAnimation:
|
|
197
|
-
animationDuration:
|
|
198
|
-
animationIntensity:
|
|
199
|
-
disabled:
|
|
200
|
-
className:
|
|
201
|
-
pillClassName:
|
|
202
|
-
iconClassName:
|
|
203
|
-
optionClassName:
|
|
204
|
-
optionIconClassName:
|
|
205
|
-
} = a,
|
|
206
|
-
|
|
198
|
+
collapseAt: Oe,
|
|
199
|
+
disableAnimation: Se = !1,
|
|
200
|
+
animationDuration: ze,
|
|
201
|
+
animationIntensity: $e,
|
|
202
|
+
disabled: z = !1,
|
|
203
|
+
className: _e,
|
|
204
|
+
pillClassName: je,
|
|
205
|
+
iconClassName: ke,
|
|
206
|
+
optionClassName: Ae,
|
|
207
|
+
optionIconClassName: Ve
|
|
208
|
+
} = a, De = `segmented-${st()}`, P = dt(), Z = Ce ?? P?.labelledBy, Fe = Me ?? P?.describedBy, Pe = P?.required || void 0, J = f(null), ee = f(null), te = f(null), ne = f(null), $ = f([]), [q, qe] = O(null), re = f(null), T = f(!1), M = f(null), U = f(!1), [b, Ue] = O(!1), [oe, We] = O(null), [W, le] = O(!1), [K, ae] = O(!1), ie = f(0), B = f(null), Ke = bt(), s = Se || Ke, c = s ? 0 : Re(ze ?? yt, 0, 2e3), R = s ? 0 : Re($e ?? 1, 0, 2), se = Le ?? (Y === !0 ? !1 : Y === !1 ? !0 : void 0), y = se === "fill", _ = se === !0, I = C === "scroll" && !y, L = C === "collapse", Ge = C === "truncate" || C === "scroll" && y, ce = E.every((e) => !!(e.icon ?? F)), Xe = Oe ?? xt[o], G = L && ce && oe !== null && oe < Xe, w = z ? "disabled" : ht[v] ?? v, l = Math.max(E.findIndex((e) => e.value === Ne), 0), He = y ? "w-full" : "w-max max-w-full", Qe = I ? "overflow-x-auto overscroll-x-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden" : "", Ye = I && !_ ? "auto-cols-max" : y || _ ? Te.equal : Te.natural, Ze = s ? "none" : `color ${c}ms ${N}`, Je = s ? "none" : `font-weight ${c}ms ${N}`, et = s ? "none" : `width ${c}ms ${N}, opacity ${c}ms ${N}`, de = K ? Math.round(c * 0.4) : c, tt = s ? "none" : `left ${de}ms ${N}, right ${de}ms ${N}, transform ${Math.round(W ? c * 0.4 : c * 0.9)}ms ${W ? vt : wt}`, nt = ie.current * 10 * R, rt = W && R > 0 ? `translateX(${nt}px) scaleX(${1 + 0.05 * R}) scaleY(${1 - 0.05 * R})` : void 0, ue = (e) => {
|
|
209
|
+
re.current = e, qe(
|
|
207
210
|
(t) => t && t.left === e.left && t.right === e.right ? t : e
|
|
208
211
|
);
|
|
209
|
-
},
|
|
212
|
+
}, fe = () => {
|
|
210
213
|
if (!T.current) return;
|
|
211
214
|
T.current = !1;
|
|
212
215
|
const e = M.current;
|
|
213
|
-
M.current = null, e && (
|
|
216
|
+
M.current = null, e && (ae(!0), ue(e));
|
|
214
217
|
};
|
|
215
218
|
V(() => {
|
|
216
|
-
const e =
|
|
219
|
+
const e = te.current;
|
|
217
220
|
if (!L || !e) return;
|
|
218
221
|
const t = () => {
|
|
219
|
-
const
|
|
220
|
-
|
|
222
|
+
const i = e.getBoundingClientRect().width;
|
|
223
|
+
We((p) => p === i ? p : i);
|
|
221
224
|
};
|
|
222
225
|
t();
|
|
223
|
-
const
|
|
224
|
-
return
|
|
226
|
+
const r = new ResizeObserver(t);
|
|
227
|
+
return r.observe(e), () => r.disconnect();
|
|
225
228
|
}, [L]), V(() => {
|
|
226
|
-
if (
|
|
227
|
-
|
|
229
|
+
if (B.current === null) {
|
|
230
|
+
B.current = l;
|
|
228
231
|
return;
|
|
229
232
|
}
|
|
230
|
-
|
|
231
|
-
}, [l,
|
|
232
|
-
const
|
|
233
|
+
B.current !== l && (ie.current = l > B.current ? 1 : -1, B.current = l, M.current = null, T.current = !1, U.current = !s);
|
|
234
|
+
}, [l, s]);
|
|
235
|
+
const me = f(null), { bind: ot, ref: lt } = ct({
|
|
233
236
|
axis: "x",
|
|
234
237
|
cursor: { idle: "default", dragging: "grabbing" },
|
|
235
238
|
disabled: !I
|
|
236
|
-
}),
|
|
239
|
+
}), pe = (e, t) => e.icon ?? (t ? F : void 0) ? D + (e.label != null && !G ? we : 0) : 0;
|
|
237
240
|
V(() => {
|
|
238
|
-
const e =
|
|
241
|
+
const e = ee.current, t = $.current[l];
|
|
239
242
|
if (!e || !t) return;
|
|
240
|
-
const
|
|
241
|
-
(
|
|
242
|
-
) : null, p = (
|
|
243
|
+
const r = me.current, i = !y && !_ && r !== null && r !== l ? E.map(
|
|
244
|
+
(d, x) => pe(d, x === l) - pe(d, x === r)
|
|
245
|
+
) : null, p = (d = !1) => {
|
|
243
246
|
const x = e.getBoundingClientRect(), j = t.getBoundingClientRect();
|
|
244
247
|
let k = {
|
|
245
248
|
left: j.left - x.left,
|
|
246
249
|
right: x.right - j.right
|
|
247
250
|
};
|
|
248
|
-
if (
|
|
249
|
-
let
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}), k = { left: k.left +
|
|
251
|
+
if (d && i) {
|
|
252
|
+
let ge = 0, he = 0;
|
|
253
|
+
i.forEach((xe, ye) => {
|
|
254
|
+
ye < l ? ge += xe : ye > l && (he += xe);
|
|
255
|
+
}), k = { left: k.left + ge, right: k.right + he };
|
|
253
256
|
}
|
|
254
|
-
const A =
|
|
255
|
-
|
|
257
|
+
const A = gt(
|
|
258
|
+
re.current,
|
|
256
259
|
k,
|
|
257
260
|
T.current
|
|
258
261
|
);
|
|
259
|
-
A.pending && (M.current = A.pending), A.commit &&
|
|
262
|
+
A.pending && (M.current = A.pending), A.commit && ue(A.commit);
|
|
260
263
|
};
|
|
261
|
-
p(!0),
|
|
264
|
+
p(!0), me.current = l;
|
|
262
265
|
const g = new ResizeObserver(() => p());
|
|
263
|
-
return g.observe(e),
|
|
264
|
-
|
|
266
|
+
return g.observe(e), $.current.forEach((d) => {
|
|
267
|
+
d && g.observe(d);
|
|
265
268
|
}), () => g.disconnect();
|
|
266
269
|
}, [
|
|
267
270
|
l,
|
|
268
271
|
E.length,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
+
o,
|
|
273
|
+
y,
|
|
274
|
+
_,
|
|
272
275
|
C,
|
|
273
|
-
|
|
276
|
+
G
|
|
274
277
|
]), V(() => {
|
|
275
|
-
|
|
276
|
-
}, [l,
|
|
277
|
-
|
|
278
|
-
}, [
|
|
279
|
-
if (!
|
|
278
|
+
U.current && (U.current = !1, T.current = !0);
|
|
279
|
+
}, [l, s]), S(() => {
|
|
280
|
+
q && !b && Ue(!0);
|
|
281
|
+
}, [q, b]), S(() => {
|
|
282
|
+
if (!K) return;
|
|
280
283
|
const e = window.setTimeout(
|
|
281
|
-
() =>
|
|
284
|
+
() => ae(!1),
|
|
282
285
|
Math.max(80, Math.round(c * 0.4))
|
|
283
286
|
);
|
|
284
287
|
return () => window.clearTimeout(e);
|
|
285
|
-
}, [
|
|
286
|
-
const e =
|
|
288
|
+
}, [K, c]), S(() => {
|
|
289
|
+
const e = ne.current;
|
|
287
290
|
if (!e) return;
|
|
288
|
-
const t = (
|
|
289
|
-
|
|
291
|
+
const t = (r) => {
|
|
292
|
+
r.propertyName !== "left" && r.propertyName !== "right" || fe();
|
|
290
293
|
};
|
|
291
294
|
return e.addEventListener("transitionend", t), () => e.removeEventListener("transitionend", t);
|
|
292
|
-
}),
|
|
293
|
-
if (
|
|
295
|
+
}), S(() => {
|
|
296
|
+
if (s || !T.current) return;
|
|
294
297
|
let e, t;
|
|
295
|
-
return R > 0 && (
|
|
296
|
-
() =>
|
|
298
|
+
return R > 0 && (le(!0), e = window.setTimeout(
|
|
299
|
+
() => le(!1),
|
|
297
300
|
Math.max(80, Math.round(c * 0.45))
|
|
298
|
-
)), t = window.setTimeout(
|
|
301
|
+
)), t = window.setTimeout(fe, c + 80), () => {
|
|
299
302
|
e !== void 0 && window.clearTimeout(e), t !== void 0 && window.clearTimeout(t), M.current = null;
|
|
300
303
|
};
|
|
301
|
-
}, [l,
|
|
304
|
+
}, [l, s, c, R]), S(() => {
|
|
302
305
|
if (!I) return;
|
|
303
|
-
const e =
|
|
306
|
+
const e = J.current, t = $.current[l];
|
|
304
307
|
if (!e || !t) return;
|
|
305
|
-
const
|
|
306
|
-
g > 0 ? e.scrollBy({ left: g, behavior: p }) :
|
|
307
|
-
}, [I, l, b,
|
|
308
|
-
const
|
|
309
|
-
"--sb-motion": b ?
|
|
310
|
-
"--sb-motion-text": b ?
|
|
311
|
-
"--sb-motion-weight": b ?
|
|
312
|
-
"--sb-motion-slot": b ?
|
|
313
|
-
},
|
|
308
|
+
const r = e.getBoundingClientRect(), i = t.getBoundingClientRect(), p = b && !s ? "smooth" : "auto", g = i.right - r.right + ve, d = r.left - i.left + ve;
|
|
309
|
+
g > 0 ? e.scrollBy({ left: g, behavior: p }) : d > 0 && e.scrollBy({ left: -d, behavior: p });
|
|
310
|
+
}, [I, l, b, s]);
|
|
311
|
+
const at = {
|
|
312
|
+
"--sb-motion": b ? tt : "none",
|
|
313
|
+
"--sb-motion-text": b ? Ze : "none",
|
|
314
|
+
"--sb-motion-weight": b ? Je : "none",
|
|
315
|
+
"--sb-motion-slot": b ? et : "none"
|
|
316
|
+
}, be = /* @__PURE__ */ u.jsx(
|
|
314
317
|
"div",
|
|
315
318
|
{
|
|
316
319
|
ref: (e) => {
|
|
317
|
-
|
|
320
|
+
J.current = e, lt.current = e;
|
|
318
321
|
},
|
|
319
322
|
role: "radiogroup",
|
|
320
|
-
"aria-
|
|
321
|
-
"aria-
|
|
323
|
+
"aria-labelledby": Z,
|
|
324
|
+
"aria-label": Z ? void 0 : Ee ?? Q,
|
|
325
|
+
"aria-describedby": Fe,
|
|
326
|
+
"aria-required": Pe,
|
|
327
|
+
"aria-disabled": z || void 0,
|
|
322
328
|
className: m(
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
329
|
+
Ct({ size: o, color: w }),
|
|
330
|
+
He,
|
|
331
|
+
Qe,
|
|
332
|
+
_e
|
|
327
333
|
),
|
|
328
|
-
style:
|
|
329
|
-
...
|
|
330
|
-
children: /* @__PURE__ */
|
|
334
|
+
style: at,
|
|
335
|
+
...ot,
|
|
336
|
+
children: /* @__PURE__ */ u.jsxs(
|
|
331
337
|
"div",
|
|
332
338
|
{
|
|
333
|
-
ref:
|
|
339
|
+
ref: ee,
|
|
334
340
|
className: m(
|
|
335
341
|
"relative grid grid-flow-col items-stretch",
|
|
336
|
-
|
|
337
|
-
|
|
342
|
+
Ye,
|
|
343
|
+
y && "w-full",
|
|
338
344
|
I && "w-max"
|
|
339
345
|
),
|
|
340
346
|
children: [
|
|
341
|
-
/* @__PURE__ */
|
|
347
|
+
/* @__PURE__ */ u.jsx(
|
|
342
348
|
"div",
|
|
343
349
|
{
|
|
344
|
-
ref:
|
|
350
|
+
ref: ne,
|
|
345
351
|
"aria-hidden": !0,
|
|
346
352
|
className: m(
|
|
347
|
-
|
|
353
|
+
Mt({ size: o, color: w }),
|
|
348
354
|
"pointer-events-none",
|
|
349
|
-
b &&
|
|
350
|
-
|
|
355
|
+
b && Tt,
|
|
356
|
+
je
|
|
351
357
|
),
|
|
352
358
|
style: {
|
|
353
|
-
...
|
|
354
|
-
transform:
|
|
359
|
+
...q ?? {},
|
|
360
|
+
transform: rt
|
|
355
361
|
}
|
|
356
362
|
}
|
|
357
363
|
),
|
|
358
364
|
E.map((e, t) => {
|
|
359
|
-
const
|
|
365
|
+
const r = t === l, i = e.icon ?? (r ? F : void 0), p = e.label != null && !G, g = Ge || L && !ce ? "truncate" : "text-nowrap", d = r ? m(n[w].icon, ke) : m(n[w].optionIcon, Ve), x = /* @__PURE__ */ u.jsxs(
|
|
360
366
|
"label",
|
|
361
367
|
{
|
|
362
368
|
ref: (j) => {
|
|
363
|
-
|
|
369
|
+
$.current[t] = j;
|
|
364
370
|
},
|
|
365
371
|
title: e.tooltipText ? void 0 : e.label ?? e.ariaLabel,
|
|
366
372
|
className: m(
|
|
367
|
-
|
|
373
|
+
Bt({ size: o, color: w }),
|
|
368
374
|
"relative z-20 min-w-0 select-none",
|
|
369
|
-
|
|
370
|
-
|
|
375
|
+
Rt,
|
|
376
|
+
r ? n[w].pillText : n[w].option,
|
|
371
377
|
"has-[input:focus-visible]:outline-2 has-[input:focus-visible]:-outline-offset-2 has-[input:focus-visible]:outline-[color:var(--border-brand-onneutral-default)]",
|
|
372
|
-
|
|
378
|
+
Ae
|
|
373
379
|
),
|
|
374
380
|
children: [
|
|
375
|
-
/* @__PURE__ */
|
|
381
|
+
/* @__PURE__ */ u.jsx(
|
|
376
382
|
"span",
|
|
377
383
|
{
|
|
378
|
-
"aria-hidden": !
|
|
379
|
-
className: m("flex items-center overflow-hidden shrink-0",
|
|
384
|
+
"aria-hidden": !i,
|
|
385
|
+
className: m("flex items-center overflow-hidden shrink-0", Nt),
|
|
380
386
|
style: {
|
|
381
|
-
width:
|
|
382
|
-
opacity:
|
|
387
|
+
width: i ? D + (p ? we : 0) : 0,
|
|
388
|
+
opacity: i ? 1 : 0
|
|
383
389
|
},
|
|
384
|
-
children:
|
|
390
|
+
children: i ? Et(i, d) : null
|
|
385
391
|
}
|
|
386
392
|
),
|
|
387
|
-
p && /* @__PURE__ */
|
|
393
|
+
p && /* @__PURE__ */ u.jsxs(
|
|
388
394
|
"span",
|
|
389
395
|
{
|
|
390
396
|
className: "grid grid-cols-[minmax(0,1fr)] min-w-0",
|
|
391
397
|
children: [
|
|
392
|
-
/* @__PURE__ */
|
|
398
|
+
/* @__PURE__ */ u.jsx(
|
|
393
399
|
"span",
|
|
394
400
|
{
|
|
395
401
|
"aria-hidden": !0,
|
|
@@ -400,7 +406,7 @@ const Te = "(prefers-reduced-motion: reduce)", lt = () => !1, at = () => typeof
|
|
|
400
406
|
children: e.label
|
|
401
407
|
}
|
|
402
408
|
),
|
|
403
|
-
/* @__PURE__ */
|
|
409
|
+
/* @__PURE__ */ u.jsx(
|
|
404
410
|
"span",
|
|
405
411
|
{
|
|
406
412
|
className: m(
|
|
@@ -409,8 +415,8 @@ const Te = "(prefers-reduced-motion: reduce)", lt = () => !1, at = () => typeof
|
|
|
409
415
|
// `text-center` keeps the shorter regular weight centered
|
|
410
416
|
// inside the semibold reserve.
|
|
411
417
|
"col-start-1 row-start-1 min-w-0 text-center",
|
|
412
|
-
|
|
413
|
-
|
|
418
|
+
It,
|
|
419
|
+
r ? "font-semibold" : "font-normal",
|
|
414
420
|
g
|
|
415
421
|
),
|
|
416
422
|
children: e.label
|
|
@@ -419,35 +425,35 @@ const Te = "(prefers-reduced-motion: reduce)", lt = () => !1, at = () => typeof
|
|
|
419
425
|
]
|
|
420
426
|
}
|
|
421
427
|
),
|
|
422
|
-
/* @__PURE__ */
|
|
428
|
+
/* @__PURE__ */ u.jsx(
|
|
423
429
|
"input",
|
|
424
430
|
{
|
|
425
431
|
type: "radio",
|
|
426
|
-
name:
|
|
432
|
+
name: De,
|
|
427
433
|
value: String(e.value),
|
|
428
|
-
checked:
|
|
429
|
-
disabled:
|
|
430
|
-
onChange: () =>
|
|
434
|
+
checked: r,
|
|
435
|
+
disabled: z,
|
|
436
|
+
onChange: () => Be?.(Q, e.value),
|
|
431
437
|
"aria-label": e.ariaLabel ?? e.label,
|
|
432
438
|
className: m(
|
|
433
439
|
"absolute inset-0 z-30 m-0 h-full w-full opacity-0",
|
|
434
|
-
|
|
440
|
+
z ? "cursor-default" : "cursor-pointer"
|
|
435
441
|
)
|
|
436
442
|
}
|
|
437
443
|
)
|
|
438
444
|
]
|
|
439
445
|
}
|
|
440
446
|
);
|
|
441
|
-
return e.tooltipText ? /* @__PURE__ */
|
|
447
|
+
return e.tooltipText ? /* @__PURE__ */ u.jsx(ut, { title: e.tooltipText, asChild: !0, children: x }, e.value) : /* @__PURE__ */ u.jsx(X.Fragment, { children: x }, e.value);
|
|
442
448
|
})
|
|
443
449
|
]
|
|
444
450
|
}
|
|
445
451
|
)
|
|
446
452
|
}
|
|
447
453
|
);
|
|
448
|
-
return L ? /* @__PURE__ */
|
|
454
|
+
return L ? /* @__PURE__ */ u.jsx("div", { ref: te, className: "w-full min-w-0", children: be }) : be;
|
|
449
455
|
};
|
|
450
456
|
export {
|
|
451
|
-
|
|
452
|
-
|
|
457
|
+
kt as SegmentedButton,
|
|
458
|
+
kt as default
|
|
453
459
|
};
|