prometeo-design-system 7.7.4 → 7.7.5
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/Avatar.es.js +2 -2
- package/dist/{AvatarAndSubavatar-BuZi4MrC.js → AvatarAndSubavatar-06yOUIKk.js} +2 -2
- package/dist/{AvatarBase-DiSd8Z2B.js → AvatarBase-Yi_3zqle.js} +10 -10
- package/dist/Chip.es.js +1 -1
- package/dist/Input.es.js +22 -23
- package/dist/ListItem.es.js +1 -1
- package/dist/SegmentedButton.es.js +180 -128
- package/dist/TabSwitch.es.js +1 -1
- package/dist/UserSidebarItem.es.js +2 -2
- package/dist/components/SegmentedButton/SegmentedButton.d.ts +30 -2
- package/dist/exports/SegmentedButton.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/prometeo-design-system.es.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/styles/intellisense.css +1 -0
- package/src/styles/utilities/fonts.css +7 -0
- package/src/styles/utilities.css +7 -0
package/dist/Avatar.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { j as m } from "./jsx-runtime-GkKLlHH4.js";
|
|
2
|
-
import { A as u } from "./AvatarAndSubavatar-
|
|
3
|
-
import { A as d } from "./AvatarBase-
|
|
2
|
+
import { A as u } from "./AvatarAndSubavatar-06yOUIKk.js";
|
|
3
|
+
import { A as d } from "./AvatarBase-Yi_3zqle.js";
|
|
4
4
|
const g = "[Pyrion Avatar]", o = /* @__PURE__ */ new Set(), e = (a, r) => {
|
|
5
5
|
o.has(a) || (o.add(a), console.warn(`${g} ${r}`));
|
|
6
6
|
}, f = {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { j as r } from "./jsx-runtime-GkKLlHH4.js";
|
|
2
2
|
import { c as m } from "./index-BOQuZ0gG.js";
|
|
3
3
|
import { memo as l, useState as d, useEffect as n } from "react";
|
|
4
|
-
import { A as x } from "./AvatarBase-
|
|
4
|
+
import { A as x } from "./AvatarBase-Yi_3zqle.js";
|
|
5
5
|
const c = m(
|
|
6
|
-
"bg-brand-secondary-default border-neutral-default-default border
|
|
6
|
+
"bg-brand-secondary-default border-neutral-default-default border rounded-full text-brand-secondary-default grid place-items-center overflow-hidden object-cover object-center absolute ",
|
|
7
7
|
{
|
|
8
8
|
variants: {
|
|
9
9
|
size: {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-GkKLlHH4.js";
|
|
2
2
|
import { c as t } from "./cn-B6yFEsav.js";
|
|
3
3
|
import { c } from "./index-BOQuZ0gG.js";
|
|
4
|
-
import { useState as
|
|
5
|
-
import
|
|
6
|
-
import { UserAvatar as
|
|
4
|
+
import { useState as x, useEffect as b } from "react";
|
|
5
|
+
import g from "./Skeleton.es.js";
|
|
6
|
+
import { UserAvatar as h } from "./Icon-UserAvatar.es.js";
|
|
7
7
|
const o = c(
|
|
8
|
-
"bg-brand-secondary-default rounded-full text-brand-secondary-default grid place-items-center overflow-hidden object-cover object-center select-none shrink-0",
|
|
8
|
+
"bg-brand-secondary-default rounded-full text-brand-secondary-default grid place-items-center overflow-hidden object-cover object-center select-none shrink-0 border border-neutral-default-default",
|
|
9
9
|
{
|
|
10
10
|
variants: {
|
|
11
11
|
size: {
|
|
@@ -39,19 +39,19 @@ function I({
|
|
|
39
39
|
name: n,
|
|
40
40
|
fallbackType: d = "initials"
|
|
41
41
|
}) {
|
|
42
|
-
const [f, i] =
|
|
43
|
-
if (
|
|
42
|
+
const [f, i] = x(!1);
|
|
43
|
+
if (b(() => {
|
|
44
44
|
i(!1);
|
|
45
45
|
}, [a]), m)
|
|
46
46
|
return /* @__PURE__ */ e.jsx("div", { ref: r, className: t("inline-flex", l), children: /* @__PURE__ */ e.jsx(
|
|
47
|
-
|
|
47
|
+
g,
|
|
48
48
|
{
|
|
49
49
|
shape: "circle",
|
|
50
50
|
className: t(o({ size: s }), "border-0")
|
|
51
51
|
}
|
|
52
52
|
) });
|
|
53
|
-
const
|
|
54
|
-
return /* @__PURE__ */ e.jsx("div", { ref: r, className: t(o({ size: s }), l), children:
|
|
53
|
+
const u = d === "initials" && n, p = !!a && !f;
|
|
54
|
+
return /* @__PURE__ */ e.jsx("div", { ref: r, className: t(o({ size: s }), l), children: p ? /* @__PURE__ */ e.jsx(
|
|
55
55
|
"img",
|
|
56
56
|
{
|
|
57
57
|
src: a,
|
|
@@ -60,7 +60,7 @@ function I({
|
|
|
60
60
|
draggable: !1,
|
|
61
61
|
onError: () => i(!0)
|
|
62
62
|
}
|
|
63
|
-
) :
|
|
63
|
+
) : u ? /* @__PURE__ */ e.jsx("p", { className: j({ size: s }), children: v(n) }) : /* @__PURE__ */ e.jsx(h, { className: "size-full rounded-full" }) });
|
|
64
64
|
}
|
|
65
65
|
export {
|
|
66
66
|
I as A
|
package/dist/Chip.es.js
CHANGED
|
@@ -4,7 +4,7 @@ import { c as m } from "./index-BOQuZ0gG.js";
|
|
|
4
4
|
import { c as h } from "./cn-B6yFEsav.js";
|
|
5
5
|
import { i as V } from "./iconUtils-rTOfKDxE.js";
|
|
6
6
|
import { Close as q } from "./Icon-Close.es.js";
|
|
7
|
-
import { A as Q } from "./AvatarBase-
|
|
7
|
+
import { A as Q } from "./AvatarBase-Yi_3zqle.js";
|
|
8
8
|
const Z = {
|
|
9
9
|
small: "h-5 px-2 text-xs prometeo-fonts-body-small",
|
|
10
10
|
medium: "h-8 px-3 text-sm prometeo-fonts-body-medium",
|
package/dist/Input.es.js
CHANGED
|
@@ -81,13 +81,13 @@ const me = c("relative w-full bg-inherit flex flex-col gap-1", {
|
|
|
81
81
|
{ size: "small", className: "border py-1" },
|
|
82
82
|
{ size: "medium", className: "border py-2" },
|
|
83
83
|
{ size: "large", className: "border-b border-t-0! border-x-0! py-2 outline-none has-focus:border-b-2 has-focus:pb-[7px]" },
|
|
84
|
-
{ disabled: !1, state: "default", className: "border-neutral-primary-default hover:border-brand-secondary-default outline-(--border-brand-secondary-default)
|
|
84
|
+
{ disabled: !1, state: "default", className: "border-neutral-primary-default hover:border-brand-secondary-default outline-(--border-brand-secondary-default) has-focus:border-brand-secondary-default focus-active:bg-red-400! [&:has(:is(:autofill,:-webkit-autofill))]:border-brand-secondary-default [&:has(:is(:autofill,:-webkit-autofill))]:bg-brand-overlay-default" },
|
|
85
85
|
{ disabled: !1, state: "success", className: "border-success-onneutral-default hover:border-success-onneutral-hover outline-(--border-success-onneutral-hover) active:border-success-onneutral-hover has-focus:border-success-onneutral-hover" },
|
|
86
86
|
{ disabled: !1, state: "error", className: "border-error-onneutral-default hover:border-error-onneutral-hover outline-(--border-error-onneutral-hover) active:border-error-onneutral-hover has-focus:border-error-onneutral-hover" },
|
|
87
87
|
{ disabled: !1, state: "warning", className: "border-warning-onneutral-default hover:border-warning-onneutral-hover outline-(--border-warning-onneutral-hover) active:border-warning-onneutral-hover has-focus:border-warning-onneutral-hover" }
|
|
88
88
|
]
|
|
89
89
|
}), he = c(
|
|
90
|
-
"w-full flex-1 min-h-0 bg-transparent appearance-none transition-all duration-200 ease-in-out focus:outline-none text-neutral-primary-default placeholder:text-neutral-tertiary-default",
|
|
90
|
+
"w-full flex-1 min-h-0 bg-transparent appearance-none transition-all duration-200 ease-in-out focus:outline-none text-neutral-primary-default placeholder:text-neutral-tertiary-default [&:is(:autofill,:-webkit-autofill)]:[-webkit-text-fill-color:var(--text-brand-overlay-default)] [&:is(:autofill,:-webkit-autofill)]:[transition:background-color_5000s]",
|
|
91
91
|
{
|
|
92
92
|
variants: {
|
|
93
93
|
size: {
|
|
@@ -164,27 +164,27 @@ const me = c("relative w-full bg-inherit flex flex-col gap-1", {
|
|
|
164
164
|
required: g = !1,
|
|
165
165
|
label: N,
|
|
166
166
|
supportingText: x,
|
|
167
|
-
showSupportingText:
|
|
167
|
+
showSupportingText: _,
|
|
168
168
|
leadingIcon: f,
|
|
169
169
|
renderValue: u,
|
|
170
170
|
slotActions: m,
|
|
171
|
-
hideClearButton:
|
|
172
|
-
onClear:
|
|
171
|
+
hideClearButton: q = !1,
|
|
172
|
+
onClear: w,
|
|
173
173
|
flexibleHeight: V = !1,
|
|
174
174
|
cardBackground: j,
|
|
175
175
|
onFocus: G,
|
|
176
176
|
onBlur: J,
|
|
177
177
|
onKeyDown: Q,
|
|
178
178
|
onKeyUp: W,
|
|
179
|
-
defaultValue:
|
|
180
|
-
...
|
|
181
|
-
} = B,
|
|
179
|
+
defaultValue: k,
|
|
180
|
+
...T
|
|
181
|
+
} = B, y = ne(null), S = I(
|
|
182
182
|
(a) => {
|
|
183
|
-
|
|
183
|
+
y.current = a, typeof e == "function" ? e(a) : e && (e.current = a);
|
|
184
184
|
},
|
|
185
185
|
[e]
|
|
186
186
|
), i = H, o = L, C = O ?? b, l = h !== void 0, [X, E] = re(
|
|
187
|
-
() =>
|
|
187
|
+
() => k ?? ""
|
|
188
188
|
), p = l ? h : X, U = d(
|
|
189
189
|
he({
|
|
190
190
|
size: i,
|
|
@@ -197,17 +197,17 @@ const me = c("relative w-full bg-inherit flex flex-col gap-1", {
|
|
|
197
197
|
},
|
|
198
198
|
[l, z]
|
|
199
199
|
), A = I(() => {
|
|
200
|
-
if (
|
|
201
|
-
|
|
200
|
+
if (w) {
|
|
201
|
+
w();
|
|
202
202
|
return;
|
|
203
203
|
}
|
|
204
|
-
const a =
|
|
204
|
+
const a = y.current;
|
|
205
205
|
if (!a) return;
|
|
206
206
|
Object.getOwnPropertyDescriptor(
|
|
207
207
|
window.HTMLInputElement.prototype,
|
|
208
208
|
"value"
|
|
209
209
|
)?.set?.call(a, ""), a.dispatchEvent(new Event("input", { bubbles: !0 })), a.dispatchEvent(new Event("change", { bubbles: !0 })), l || E(""), a.focus();
|
|
210
|
-
}, [
|
|
210
|
+
}, [w, l]), Y = !q && !r && p !== void 0 && p !== "", Z = {
|
|
211
211
|
state: o,
|
|
212
212
|
disabled: !!r,
|
|
213
213
|
size: i,
|
|
@@ -257,7 +257,7 @@ const me = c("relative w-full bg-inherit flex flex-col gap-1", {
|
|
|
257
257
|
V && (i === "medium" || i === "large") && "h-auto min-h-12"
|
|
258
258
|
),
|
|
259
259
|
onClick: () => {
|
|
260
|
-
u ||
|
|
260
|
+
u || y.current?.focus();
|
|
261
261
|
},
|
|
262
262
|
children: [
|
|
263
263
|
j && /* @__PURE__ */ n.jsx(
|
|
@@ -289,7 +289,7 @@ const me = c("relative w-full bg-inherit flex flex-col gap-1", {
|
|
|
289
289
|
disabled: r,
|
|
290
290
|
readOnly: v,
|
|
291
291
|
onChange: F,
|
|
292
|
-
...
|
|
292
|
+
...T
|
|
293
293
|
}
|
|
294
294
|
),
|
|
295
295
|
/* @__PURE__ */ n.jsx(
|
|
@@ -316,11 +316,10 @@ const me = c("relative w-full bg-inherit flex flex-col gap-1", {
|
|
|
316
316
|
name: b,
|
|
317
317
|
type: R,
|
|
318
318
|
value: l ? h : void 0,
|
|
319
|
-
defaultValue: l ? void 0 :
|
|
319
|
+
defaultValue: l ? void 0 : k,
|
|
320
320
|
placeholder: D,
|
|
321
321
|
className: d(
|
|
322
322
|
U,
|
|
323
|
-
"prometeo-input-autofill",
|
|
324
323
|
f && "pl-0"
|
|
325
324
|
),
|
|
326
325
|
disabled: r,
|
|
@@ -332,7 +331,7 @@ const me = c("relative w-full bg-inherit flex flex-col gap-1", {
|
|
|
332
331
|
onKeyDown: Q,
|
|
333
332
|
onKeyUp: W,
|
|
334
333
|
"data-state": o,
|
|
335
|
-
...
|
|
334
|
+
...T
|
|
336
335
|
}
|
|
337
336
|
),
|
|
338
337
|
/* @__PURE__ */ n.jsxs("div", { className: "flex items-center gap-0.5", children: [
|
|
@@ -358,13 +357,13 @@ const me = c("relative w-full bg-inherit flex flex-col gap-1", {
|
|
|
358
357
|
]
|
|
359
358
|
}
|
|
360
359
|
),
|
|
361
|
-
|
|
360
|
+
_ && /* @__PURE__ */ n.jsx(de, { variant: o, disabled: r, className: "min-h-4", children: typeof x == "function" ? x() : x })
|
|
362
361
|
]
|
|
363
362
|
}
|
|
364
363
|
);
|
|
365
364
|
}
|
|
366
|
-
),
|
|
367
|
-
|
|
365
|
+
), we = te(xe);
|
|
366
|
+
we.displayName = "Input";
|
|
368
367
|
export {
|
|
369
|
-
|
|
368
|
+
we as default
|
|
370
369
|
};
|
package/dist/ListItem.es.js
CHANGED
|
@@ -8,7 +8,7 @@ import M from "./Divider.es.js";
|
|
|
8
8
|
import Z from "./RadioButton.es.js";
|
|
9
9
|
import q from "./Check.es.js";
|
|
10
10
|
import { ChevronDown as G } from "./Icon-ChevronDown.es.js";
|
|
11
|
-
import { A as H } from "./AvatarBase-
|
|
11
|
+
import { A as H } from "./AvatarBase-Yi_3zqle.js";
|
|
12
12
|
const J = {
|
|
13
13
|
size: "small",
|
|
14
14
|
name: "A B"
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { c as
|
|
3
|
-
import { c as
|
|
4
|
-
import
|
|
5
|
-
|
|
1
|
+
import { j as n } from "./jsx-runtime-GkKLlHH4.js";
|
|
2
|
+
import { c as m } from "./cn-B6yFEsav.js";
|
|
3
|
+
import { c as B } from "./index-BOQuZ0gG.js";
|
|
4
|
+
import _, { useRef as O, useState as V, useLayoutEffect as le, useEffect as K, useMemo as T } from "react";
|
|
5
|
+
import re from "./PlainTooltip.es.js";
|
|
6
|
+
const se = {
|
|
6
7
|
default: "brand",
|
|
7
8
|
danger: "error"
|
|
8
9
|
}, a = {
|
|
@@ -10,39 +11,45 @@ const Q = {
|
|
|
10
11
|
pill: "bg-brand-secondary-default text-neutral-onbrandsecondary-default",
|
|
11
12
|
container: "border-neutral-default-default",
|
|
12
13
|
option: "text-neutral-secondary-default",
|
|
13
|
-
icon: "icon-neutral-onbrandsecondary-default"
|
|
14
|
+
icon: "icon-neutral-onbrandsecondary-default",
|
|
15
|
+
optionIcon: "icon-neutral-secondary-default"
|
|
14
16
|
},
|
|
15
17
|
neutral: {
|
|
16
18
|
pill: "bg-neutral-tertiary-default text-neutral-default-default",
|
|
17
19
|
container: "border-neutral-default-default",
|
|
18
20
|
option: "text-neutral-secondary-default",
|
|
19
|
-
icon: "icon-neutral-default-default"
|
|
21
|
+
icon: "icon-neutral-default-default",
|
|
22
|
+
optionIcon: "icon-neutral-secondary-default"
|
|
20
23
|
},
|
|
21
24
|
error: {
|
|
22
25
|
pill: "bg-error-secondary-default text-semantic-error-secondary-default",
|
|
23
26
|
container: "border-neutral-default-default",
|
|
24
27
|
option: "text-neutral-secondary-default",
|
|
25
|
-
icon: "icon-semantic-error-secondary-default"
|
|
28
|
+
icon: "icon-semantic-error-secondary-default",
|
|
29
|
+
optionIcon: "icon-neutral-secondary-default"
|
|
26
30
|
},
|
|
27
31
|
success: {
|
|
28
32
|
pill: "bg-success-secondary-default text-semantic-success-secondary-default",
|
|
29
33
|
container: "border-neutral-default-default",
|
|
30
34
|
option: "text-neutral-secondary-default",
|
|
31
|
-
icon: "icon-semantic-success-secondary-default"
|
|
35
|
+
icon: "icon-semantic-success-secondary-default",
|
|
36
|
+
optionIcon: "icon-neutral-secondary-default"
|
|
32
37
|
},
|
|
33
38
|
warning: {
|
|
34
39
|
pill: "bg-warning-secondary-default text-semantic-warning-secondary-default",
|
|
35
40
|
container: "border-neutral-default-default",
|
|
36
41
|
option: "text-neutral-secondary-default",
|
|
37
|
-
icon: "icon-semantic-warning-secondary-default"
|
|
42
|
+
icon: "icon-semantic-warning-secondary-default",
|
|
43
|
+
optionIcon: "icon-neutral-secondary-default"
|
|
38
44
|
},
|
|
39
45
|
disabled: {
|
|
40
46
|
pill: "bg-disabled-default text-disabled-ondisabled",
|
|
41
47
|
container: "border-neutral-default-default opacity-80",
|
|
42
48
|
option: "text-disabled-default",
|
|
43
|
-
icon: "icon-disabled-ondisabled"
|
|
49
|
+
icon: "icon-disabled-ondisabled",
|
|
50
|
+
optionIcon: "icon-disabled-default"
|
|
44
51
|
}
|
|
45
|
-
},
|
|
52
|
+
}, f = {
|
|
46
53
|
small: {
|
|
47
54
|
container: "py-[3px] px-[3px] radius-medium",
|
|
48
55
|
pill: "px-3 py-1 gap-0.5 radius-small pyrion-fonts-label-medium",
|
|
@@ -58,23 +65,39 @@ const Q = {
|
|
|
58
65
|
pill: "px-4 py-2.5 gap-0.5 radius-medium pyrion-fonts-label-large",
|
|
59
66
|
option: "px-4 py-2 gap-[2px] pyrion-fonts-body-medium"
|
|
60
67
|
}
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
}, I = 20, Z = (i, c) => i ? typeof i == "function" ? _.createElement(i, {
|
|
69
|
+
size: I,
|
|
70
|
+
className: m(c, "shrink-0!")
|
|
71
|
+
}) : _.cloneElement(
|
|
72
|
+
i,
|
|
73
|
+
{
|
|
74
|
+
size: I,
|
|
75
|
+
className: m(c, "shrink-0!")
|
|
76
|
+
}
|
|
77
|
+
) : /* @__PURE__ */ n.jsx(
|
|
78
|
+
"span",
|
|
79
|
+
{
|
|
80
|
+
className: "inline-block shrink-0",
|
|
81
|
+
style: { width: 0, height: I },
|
|
82
|
+
"aria-hidden": !0
|
|
83
|
+
}
|
|
84
|
+
), D = (i, c) => {
|
|
85
|
+
const w = i.reduce((v, h) => v + h, 0);
|
|
86
|
+
if (w <= 0) return i;
|
|
87
|
+
let l = c;
|
|
88
|
+
return i.map((v, h) => {
|
|
89
|
+
if (h === i.length - 1) return l;
|
|
90
|
+
const N = Math.round(v * c / w);
|
|
91
|
+
return l -= N, N;
|
|
69
92
|
});
|
|
70
|
-
},
|
|
93
|
+
}, oe = B(
|
|
71
94
|
"relative border inline-flex bg-neutral-default-default border-neutral-default-default radius-large w-max max-w-full ",
|
|
72
95
|
{
|
|
73
96
|
variants: {
|
|
74
97
|
size: {
|
|
75
|
-
small:
|
|
76
|
-
medium:
|
|
77
|
-
large:
|
|
98
|
+
small: f.small.container,
|
|
99
|
+
medium: f.medium.container,
|
|
100
|
+
large: f.large.container
|
|
78
101
|
},
|
|
79
102
|
color: {
|
|
80
103
|
brand: "",
|
|
@@ -98,12 +121,12 @@ const Q = {
|
|
|
98
121
|
color: "brand"
|
|
99
122
|
}
|
|
100
123
|
}
|
|
101
|
-
),
|
|
124
|
+
), ie = "transition-[left,right] duration-300 ease-[cubic-bezier(0.175,0.885,0.32,1.075)]", ce = "transition-[width] duration-500 ease-out", de = B("absolute top-1/2 -translate-y-1/2 h-max z-30 flex items-center justify-center", {
|
|
102
125
|
variants: {
|
|
103
126
|
size: {
|
|
104
|
-
small:
|
|
105
|
-
medium:
|
|
106
|
-
large:
|
|
127
|
+
small: f.small.pill,
|
|
128
|
+
medium: f.medium.pill,
|
|
129
|
+
large: f.large.pill
|
|
107
130
|
},
|
|
108
131
|
color: {
|
|
109
132
|
brand: "",
|
|
@@ -126,14 +149,14 @@ const Q = {
|
|
|
126
149
|
size: "medium",
|
|
127
150
|
color: "brand"
|
|
128
151
|
}
|
|
129
|
-
}),
|
|
152
|
+
}), ue = B(
|
|
130
153
|
"z-20 h-full min-h-5 flex items-center justify-center select-none text-nowrap shrink-0",
|
|
131
154
|
{
|
|
132
155
|
variants: {
|
|
133
156
|
size: {
|
|
134
|
-
small:
|
|
135
|
-
medium:
|
|
136
|
-
large:
|
|
157
|
+
small: f.small.option,
|
|
158
|
+
medium: f.medium.option,
|
|
159
|
+
large: f.large.option
|
|
137
160
|
},
|
|
138
161
|
color: {
|
|
139
162
|
brand: "",
|
|
@@ -157,133 +180,162 @@ const Q = {
|
|
|
157
180
|
color: "brand"
|
|
158
181
|
}
|
|
159
182
|
}
|
|
160
|
-
),
|
|
183
|
+
), xe = (i) => {
|
|
161
184
|
const {
|
|
162
|
-
size:
|
|
163
|
-
color:
|
|
164
|
-
options:
|
|
165
|
-
value:
|
|
166
|
-
name:
|
|
167
|
-
onChange:
|
|
168
|
-
icon:
|
|
169
|
-
allowExpand:
|
|
170
|
-
equalWidth:
|
|
171
|
-
disabled:
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
185
|
+
size: c = "medium",
|
|
186
|
+
color: w = "default",
|
|
187
|
+
options: l,
|
|
188
|
+
value: v,
|
|
189
|
+
name: h,
|
|
190
|
+
onChange: N,
|
|
191
|
+
icon: F,
|
|
192
|
+
allowExpand: L,
|
|
193
|
+
equalWidth: G,
|
|
194
|
+
disabled: j = !1,
|
|
195
|
+
className: H,
|
|
196
|
+
pillClassName: J,
|
|
197
|
+
iconClassName: Q,
|
|
198
|
+
optionClassName: M,
|
|
199
|
+
optionIconClassName: U
|
|
200
|
+
} = i, x = O([]), X = O(null), R = O(null), [d, Y] = V(!1), [z, ee] = V(!1), [u, S] = V([]), A = G ?? (L === !0 ? !1 : L === !1 ? !0 : void 0), o = A === "fill", C = A === !0, y = j ? "disabled" : se[w] ?? w, b = Math.max(l.findIndex((e) => e.value === v), 0), E = l[b] ?? l[0], q = l.map((e) => `${e.label ?? ""}${e.icon ? "1" : "0"}`).join("\0"), P = !!F || l.some((e) => !!e.icon), te = E?.icon ?? F;
|
|
201
|
+
le(() => {
|
|
202
|
+
const e = l.map((r, p) => {
|
|
203
|
+
const t = x.current[p];
|
|
204
|
+
return Math.ceil(t?.getBoundingClientRect().width ?? 0);
|
|
177
205
|
});
|
|
178
|
-
if (e.some((
|
|
179
|
-
let
|
|
180
|
-
if (
|
|
181
|
-
const
|
|
182
|
-
if (
|
|
183
|
-
|
|
184
|
-
} else
|
|
185
|
-
|
|
186
|
-
}, [
|
|
206
|
+
if (e.some((r) => r <= 0)) return;
|
|
207
|
+
let s;
|
|
208
|
+
if (o) {
|
|
209
|
+
const r = R.current?.offsetWidth ?? 0;
|
|
210
|
+
if (r <= 0) return;
|
|
211
|
+
s = D(e, r);
|
|
212
|
+
} else C ? s = l.map(() => Math.max(...e)) : s = e;
|
|
213
|
+
S(s), Y(!0);
|
|
214
|
+
}, [l.length, q, c, P, j, o, C, y, M]), K(() => {
|
|
187
215
|
document.fonts.status !== "loaded" && document.fonts.ready.then(() => {
|
|
188
|
-
|
|
216
|
+
const e = x.current.map(
|
|
217
|
+
(t) => t ? {
|
|
218
|
+
width: t.style.width,
|
|
219
|
+
minWidth: t.style.minWidth,
|
|
220
|
+
maxWidth: t.style.maxWidth
|
|
221
|
+
} : null
|
|
222
|
+
), s = () => {
|
|
223
|
+
x.current.forEach((t, W) => {
|
|
224
|
+
const g = e[W];
|
|
225
|
+
!t || !g || (t.style.width = g.width, t.style.minWidth = g.minWidth, t.style.maxWidth = g.maxWidth);
|
|
226
|
+
});
|
|
227
|
+
};
|
|
228
|
+
x.current.forEach((t) => {
|
|
189
229
|
t && (t.style.width = "", t.style.minWidth = "", t.style.maxWidth = "");
|
|
190
230
|
});
|
|
191
|
-
const
|
|
192
|
-
const
|
|
193
|
-
return Math.ceil(
|
|
231
|
+
const r = l.map((t, W) => {
|
|
232
|
+
const g = x.current[W];
|
|
233
|
+
return Math.ceil(g?.getBoundingClientRect().width ?? 0);
|
|
194
234
|
});
|
|
195
|
-
if (
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
235
|
+
if (r.some((t) => t <= 0)) {
|
|
236
|
+
s();
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
let p;
|
|
240
|
+
if (C)
|
|
241
|
+
p = l.map(() => Math.max(...r));
|
|
242
|
+
else if (o) {
|
|
243
|
+
const t = R.current?.offsetWidth ?? 0;
|
|
244
|
+
p = t > 0 ? D(r, t) : r;
|
|
202
245
|
} else
|
|
203
|
-
|
|
204
|
-
|
|
246
|
+
p = r;
|
|
247
|
+
s(), S(p);
|
|
205
248
|
});
|
|
206
|
-
}, [
|
|
207
|
-
d && !
|
|
208
|
-
}, [d,
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
{
|
|
218
|
-
size: j,
|
|
219
|
-
className: u(a[m].icon, "shrink-0!")
|
|
220
|
-
}
|
|
221
|
-
) : /* @__PURE__ */ r.jsx("span", { className: "inline-block shrink-0", style: { width: 0, height: j }, "aria-hidden": !0 });
|
|
222
|
-
return /* @__PURE__ */ r.jsx(
|
|
249
|
+
}, [l.length, q, c, P, o, C, M]), K(() => {
|
|
250
|
+
d && !z && ee(!0);
|
|
251
|
+
}, [d, z]);
|
|
252
|
+
const k = T(() => !d || u.length === 0 ? 0 : u.slice(0, b).reduce((e, s) => e + s, 0), [d, u, b]), $ = T(
|
|
253
|
+
() => u.reduce((e, s) => e + s, 0),
|
|
254
|
+
[u]
|
|
255
|
+
), ne = T(() => !d || u.length === 0 ? 0 : $ - k - (u[b] ?? 0), [d, u, $, k, b]), ae = () => {
|
|
256
|
+
const e = b === l.length - 1 ? l[0] : l[b + 1];
|
|
257
|
+
N?.(h, e.value);
|
|
258
|
+
};
|
|
259
|
+
return /* @__PURE__ */ n.jsx(
|
|
223
260
|
"button",
|
|
224
261
|
{
|
|
225
|
-
ref:
|
|
226
|
-
name:
|
|
262
|
+
ref: X,
|
|
263
|
+
name: h,
|
|
227
264
|
type: "button",
|
|
228
|
-
disabled:
|
|
229
|
-
className:
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
!
|
|
265
|
+
disabled: j,
|
|
266
|
+
className: m(
|
|
267
|
+
oe({ size: c, color: y }),
|
|
268
|
+
o && "w-full",
|
|
269
|
+
!j && "cursor-pointer",
|
|
270
|
+
H
|
|
233
271
|
),
|
|
234
|
-
children: /* @__PURE__ */
|
|
235
|
-
/* @__PURE__ */
|
|
272
|
+
children: /* @__PURE__ */ n.jsxs("div", { ref: R, className: m("flex items-center relative w-max max-w-full", o && "w-full"), children: [
|
|
273
|
+
/* @__PURE__ */ n.jsxs(
|
|
236
274
|
"div",
|
|
237
275
|
{
|
|
238
|
-
style: { left:
|
|
239
|
-
className:
|
|
240
|
-
|
|
241
|
-
|
|
276
|
+
style: d ? { left: k, right: ne } : { left: k },
|
|
277
|
+
className: m(
|
|
278
|
+
de({ size: c, color: y }),
|
|
279
|
+
z && ie,
|
|
242
280
|
"overflow-hidden",
|
|
243
|
-
|
|
281
|
+
o && "justify-center",
|
|
282
|
+
J
|
|
244
283
|
),
|
|
245
|
-
onClick:
|
|
284
|
+
onClick: ae,
|
|
246
285
|
children: [
|
|
247
|
-
|
|
248
|
-
/* @__PURE__ */
|
|
286
|
+
Z(te, m(a[y].icon, Q)),
|
|
287
|
+
E.label != null && /* @__PURE__ */ n.jsx("span", { className: m("select-none", o ? "truncate min-w-0" : "text-nowrap"), children: E.label })
|
|
249
288
|
]
|
|
250
289
|
}
|
|
251
290
|
),
|
|
252
|
-
|
|
253
|
-
const
|
|
254
|
-
return /* @__PURE__ */ r.jsxs(
|
|
291
|
+
l.map((e, s) => {
|
|
292
|
+
const r = u[s], p = !!e.icon, t = /* @__PURE__ */ n.jsx(
|
|
255
293
|
"span",
|
|
256
294
|
{
|
|
257
|
-
ref: (
|
|
258
|
-
|
|
295
|
+
ref: (W) => {
|
|
296
|
+
x.current[s] = W;
|
|
259
297
|
},
|
|
260
|
-
onClick: () =>
|
|
261
|
-
style: d ? { width:
|
|
262
|
-
className:
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
!
|
|
298
|
+
onClick: () => N?.(h, e.value),
|
|
299
|
+
style: d ? { width: r, minWidth: r, maxWidth: r } : void 0,
|
|
300
|
+
className: m(
|
|
301
|
+
ue({ size: c, color: y }),
|
|
302
|
+
o ? "min-w-0 shrink-0" : "w-max shrink",
|
|
303
|
+
z && ce,
|
|
304
|
+
!j && "cursor-pointer",
|
|
267
305
|
"flex gap-0.5 relative",
|
|
268
|
-
|
|
306
|
+
o && d && "justify-center overflow-hidden",
|
|
307
|
+
M
|
|
269
308
|
),
|
|
270
|
-
"aria-label": e.label,
|
|
271
|
-
children: [
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
309
|
+
"aria-label": e.ariaLabel ?? e.label,
|
|
310
|
+
children: p ? /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
|
|
311
|
+
Z(
|
|
312
|
+
e.icon,
|
|
313
|
+
m(a[y].optionIcon, U)
|
|
314
|
+
),
|
|
315
|
+
e.label != null && (o && d ? /* @__PURE__ */ n.jsx("span", { className: "truncate min-w-0", children: e.label }) : /* @__PURE__ */ n.jsx("span", { className: "text-nowrap", children: e.label }))
|
|
316
|
+
] }) : /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
|
|
317
|
+
/* @__PURE__ */ n.jsx(
|
|
318
|
+
"span",
|
|
319
|
+
{
|
|
320
|
+
className: "inline-block shrink-0",
|
|
321
|
+
style: { width: I, height: I },
|
|
322
|
+
"aria-hidden": !0
|
|
323
|
+
}
|
|
324
|
+
),
|
|
325
|
+
o && d ? /* @__PURE__ */ n.jsx("span", { className: "truncate min-w-0", children: e.label }) : /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
|
|
326
|
+
/* @__PURE__ */ n.jsx("p", { className: "invisible", children: e.label }),
|
|
327
|
+
/* @__PURE__ */ n.jsx("p", { className: "absolute left-1/2 -translate-x-1/2 truncate!", children: e.label })
|
|
276
328
|
] })
|
|
277
|
-
]
|
|
278
|
-
}
|
|
279
|
-
e.value
|
|
329
|
+
] })
|
|
330
|
+
}
|
|
280
331
|
);
|
|
332
|
+
return e.tooltipText ? /* @__PURE__ */ n.jsx(re, { title: e.tooltipText, asChild: !0, children: t }, e.value) : /* @__PURE__ */ n.jsx(_.Fragment, { children: t }, e.value);
|
|
281
333
|
})
|
|
282
334
|
] })
|
|
283
335
|
}
|
|
284
336
|
);
|
|
285
337
|
};
|
|
286
338
|
export {
|
|
287
|
-
|
|
288
|
-
|
|
339
|
+
xe as SegmentedButton,
|
|
340
|
+
xe as default
|
|
289
341
|
};
|
package/dist/TabSwitch.es.js
CHANGED
|
@@ -286,7 +286,7 @@ const pe = (e, t) => e.path === t || e.relatedPaths?.some((n) => n === "/" ? t =
|
|
|
286
286
|
open: !g,
|
|
287
287
|
onOpenChange: (f) => S(!f),
|
|
288
288
|
disabled: A,
|
|
289
|
-
children: /* @__PURE__ */ i.jsxs("div", { className: "flex flex-col gap-
|
|
289
|
+
children: /* @__PURE__ */ i.jsxs("div", { className: "flex flex-col gap-0", id: l, children: [
|
|
290
290
|
_,
|
|
291
291
|
/* @__PURE__ */ i.jsx("div", { className: A || p ? "hidden" : "contents", children: T() })
|
|
292
292
|
] })
|