@vellira-ui/react 2.59.4 → 2.60.0
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/index.cjs +1 -1
- package/dist/index.js +168 -114
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3827,15 +3827,15 @@ ni.displayName = "Tabs.Indicator";
|
|
|
3827
3827
|
//#endregion
|
|
3828
3828
|
//#region src/components/Tabs/List/TabsList.tsx
|
|
3829
3829
|
var ri = ({ children: e, className: t, scrollable: n, ...r }) => {
|
|
3830
|
-
let {
|
|
3830
|
+
let { mode: i, orientation: a, variant: o } = Yr(), s = n ?? !1;
|
|
3831
3831
|
return /* @__PURE__ */ d("div", {
|
|
3832
3832
|
...r,
|
|
3833
|
-
role: "tablist",
|
|
3834
|
-
"aria-orientation": i,
|
|
3835
|
-
"data-orientation":
|
|
3836
|
-
"data-variant":
|
|
3837
|
-
"data-scrollable":
|
|
3838
|
-
className: U(ti.list,
|
|
3833
|
+
role: i === "tabs" ? "tablist" : void 0,
|
|
3834
|
+
"aria-orientation": i === "tabs" ? a : void 0,
|
|
3835
|
+
"data-orientation": a,
|
|
3836
|
+
"data-variant": o,
|
|
3837
|
+
"data-scrollable": s ? "" : void 0,
|
|
3838
|
+
className: U(ti.list, a === "vertical" && ti.vertical, o === "line" && ti.line, o === "pills" && ti.pills, o === "segmented" && ti.segmented, s && ti.scrollable, t),
|
|
3839
3839
|
children: e
|
|
3840
3840
|
});
|
|
3841
3841
|
};
|
|
@@ -3914,119 +3914,122 @@ var ii = (e) => [...e].sort((e, t) => {
|
|
|
3914
3914
|
} }), si = {
|
|
3915
3915
|
tabs: "_tabs_1hj56_1",
|
|
3916
3916
|
vertical: "_vertical_1hj56_30"
|
|
3917
|
-
}, ci = ({ children: e, value: t, defaultValue: n, onValueChange: r, orientation: i = "horizontal", activationMode: a = "automatic", dir: o = "ltr", loop: s = !0,
|
|
3918
|
-
let
|
|
3917
|
+
}, ci = ({ children: e, value: t, defaultValue: n, onValueChange: r, orientation: i = "horizontal", activationMode: a = "automatic", dir: o = "ltr", loop: s = !0, mode: c = "tabs", variant: l = "line", color: u = "primary", size: f = "md", keepMounted: p = !1, lazyMount: m = !1, disabled: h = !1, className: g, ..._ }) => {
|
|
3918
|
+
let v = S(), b = t !== void 0, { value: C, setValue: w } = Ue({
|
|
3919
3919
|
value: t,
|
|
3920
3920
|
defaultValue: n,
|
|
3921
3921
|
onValueChange: r
|
|
3922
|
-
}),
|
|
3922
|
+
}), D = T(C), O = T(void 0), k = T(void 0), [A, j] = E(C), { version: M, triggersRef: N, contentsRef: P, registerTrigger: F, registerContent: I } = ai(), L = y((e, t, n = !1) => {
|
|
3923
3923
|
if (!t) {
|
|
3924
|
-
let t =
|
|
3924
|
+
let t = D.current, n = N.current, r = n.findIndex((t) => t.value === e);
|
|
3925
3925
|
if (t === e && r >= 0) {
|
|
3926
3926
|
let t = n.filter((t) => !t.disabled && t.value !== e), i = t.find((e) => n.findIndex((t) => t.value === e.value) > r), a = [...t].reverse().find((e) => n.findIndex((t) => t.value === e.value) < r);
|
|
3927
|
-
|
|
3927
|
+
O.current = i?.value ?? a?.value, !b && O.current && (w(O.current), j(O.current), O.current = void 0);
|
|
3928
3928
|
}
|
|
3929
3929
|
}
|
|
3930
|
-
|
|
3930
|
+
F(e, t, h || n);
|
|
3931
3931
|
}, [
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
]), { onKeyDown:
|
|
3939
|
-
focusedValue:
|
|
3940
|
-
setValue:
|
|
3941
|
-
setFocusedValue:
|
|
3942
|
-
getTabs: () =>
|
|
3932
|
+
h,
|
|
3933
|
+
b,
|
|
3934
|
+
F,
|
|
3935
|
+
j,
|
|
3936
|
+
w,
|
|
3937
|
+
N
|
|
3938
|
+
]), { onKeyDown: R } = oi({
|
|
3939
|
+
focusedValue: A,
|
|
3940
|
+
setValue: w,
|
|
3941
|
+
setFocusedValue: j,
|
|
3942
|
+
getTabs: () => N.current,
|
|
3943
3943
|
orientation: i,
|
|
3944
3944
|
activationMode: a,
|
|
3945
3945
|
dir: o,
|
|
3946
3946
|
loop: s
|
|
3947
|
-
}),
|
|
3948
|
-
value:
|
|
3949
|
-
focusedValue:
|
|
3950
|
-
collectionVersion:
|
|
3951
|
-
setValue:
|
|
3952
|
-
setFocusedValue:
|
|
3947
|
+
}), z = {
|
|
3948
|
+
value: C,
|
|
3949
|
+
focusedValue: A,
|
|
3950
|
+
collectionVersion: M,
|
|
3951
|
+
setValue: w,
|
|
3952
|
+
setFocusedValue: j,
|
|
3953
|
+
mode: c,
|
|
3953
3954
|
orientation: i,
|
|
3954
3955
|
activationMode: a,
|
|
3955
3956
|
dir: o,
|
|
3956
3957
|
loop: s,
|
|
3957
|
-
variant:
|
|
3958
|
-
color:
|
|
3959
|
-
size:
|
|
3960
|
-
keepMounted:
|
|
3961
|
-
lazyMount:
|
|
3962
|
-
disabled:
|
|
3963
|
-
registerTrigger:
|
|
3964
|
-
registerContent:
|
|
3965
|
-
onTriggerKeyDown:
|
|
3966
|
-
getTriggerId: y((e) => `${
|
|
3967
|
-
getContentId: y((e) => `${
|
|
3958
|
+
variant: l,
|
|
3959
|
+
color: u,
|
|
3960
|
+
size: f,
|
|
3961
|
+
keepMounted: p,
|
|
3962
|
+
lazyMount: m,
|
|
3963
|
+
disabled: h,
|
|
3964
|
+
registerTrigger: L,
|
|
3965
|
+
registerContent: I,
|
|
3966
|
+
onTriggerKeyDown: R,
|
|
3967
|
+
getTriggerId: y((e) => `${v}-trigger-${e}`, [v]),
|
|
3968
|
+
getContentId: y((e) => `${v}-content-${e}`, [v])
|
|
3968
3969
|
};
|
|
3969
3970
|
return x(() => {
|
|
3970
|
-
|
|
3971
|
-
}, [
|
|
3972
|
-
let e =
|
|
3973
|
-
if (
|
|
3974
|
-
process.env.NODE_ENV !== "production" &&
|
|
3971
|
+
D.current = C;
|
|
3972
|
+
}, [C]), x(() => {
|
|
3973
|
+
let e = N.current.filter((e) => !e.disabled), t = e.find((e) => e.value === C), n = N.current.some((e) => e.value === C), r = O.current ?? e[0]?.value;
|
|
3974
|
+
if (O.current = void 0, b) {
|
|
3975
|
+
process.env.NODE_ENV !== "production" && C && !n && N.current.length > 0 && console.warn(`Tabs: value "${C}" does not match any Tabs.Trigger.`), !t && !A && e[0] && j(e[0].value);
|
|
3975
3976
|
return;
|
|
3976
3977
|
}
|
|
3977
|
-
if (!
|
|
3978
|
-
r ? (
|
|
3978
|
+
if (!C || !n) {
|
|
3979
|
+
r ? (w(r), j(r)) : j(void 0);
|
|
3979
3980
|
return;
|
|
3980
3981
|
}
|
|
3981
|
-
t &&
|
|
3982
|
+
t && k.current !== C && (j(C), k.current = C);
|
|
3982
3983
|
}, [
|
|
3983
|
-
|
|
3984
|
-
v,
|
|
3985
|
-
C,
|
|
3986
|
-
M,
|
|
3984
|
+
A,
|
|
3987
3985
|
b,
|
|
3988
|
-
|
|
3986
|
+
w,
|
|
3987
|
+
N,
|
|
3988
|
+
C,
|
|
3989
|
+
M
|
|
3989
3990
|
]), x(() => {
|
|
3990
|
-
if (process.env.NODE_ENV === "production") return;
|
|
3991
|
-
let e =
|
|
3991
|
+
if (process.env.NODE_ENV === "production" || c === "navigation") return;
|
|
3992
|
+
let e = N.current.map((e) => e.value), t = P.current.map((e) => e.value), n = e.find((t, n) => e.indexOf(t) !== n);
|
|
3992
3993
|
n && console.warn(`Tabs.Trigger values must be unique. Duplicate value: "${n}".`);
|
|
3993
3994
|
for (let n of e) t.includes(n) || console.warn(`Tabs.Trigger value "${n}" does not match any Tabs.Content.`);
|
|
3994
3995
|
for (let n of t) e.includes(n) || console.warn(`Tabs.Content value "${n}" does not match any Tabs.Trigger.`);
|
|
3995
3996
|
}, [
|
|
3997
|
+
P,
|
|
3998
|
+
c,
|
|
3996
3999
|
N,
|
|
3997
|
-
M
|
|
3998
|
-
j
|
|
4000
|
+
M
|
|
3999
4001
|
]), /* @__PURE__ */ d(Jr.Provider, {
|
|
4000
|
-
value:
|
|
4002
|
+
value: z,
|
|
4001
4003
|
children: /* @__PURE__ */ d("div", {
|
|
4002
|
-
...
|
|
4003
|
-
className: U(si.tabs, i === "vertical" && si.vertical,
|
|
4004
|
+
..._,
|
|
4005
|
+
className: U(si.tabs, i === "vertical" && si.vertical, g),
|
|
4006
|
+
"data-mode": c,
|
|
4004
4007
|
"data-orientation": i,
|
|
4005
4008
|
dir: o,
|
|
4006
|
-
"data-variant":
|
|
4007
|
-
"data-color":
|
|
4008
|
-
"data-size":
|
|
4009
|
-
"data-disabled":
|
|
4009
|
+
"data-variant": l,
|
|
4010
|
+
"data-color": u,
|
|
4011
|
+
"data-size": f,
|
|
4012
|
+
"data-disabled": h ? "" : void 0,
|
|
4010
4013
|
children: e
|
|
4011
4014
|
})
|
|
4012
4015
|
});
|
|
4013
4016
|
};
|
|
4014
4017
|
ci.displayName = "Tabs";
|
|
4015
4018
|
var li = {
|
|
4016
|
-
trigger: "
|
|
4017
|
-
iconOnly: "
|
|
4018
|
-
icon: "
|
|
4019
|
-
body: "
|
|
4020
|
-
label: "
|
|
4021
|
-
description: "
|
|
4022
|
-
badge: "
|
|
4023
|
-
sm: "
|
|
4024
|
-
md: "
|
|
4025
|
-
lg: "
|
|
4026
|
-
segmented: "
|
|
4027
|
-
line: "
|
|
4028
|
-
pills: "
|
|
4029
|
-
vertical: "
|
|
4019
|
+
trigger: "_trigger_mt0se_1",
|
|
4020
|
+
iconOnly: "_iconOnly_mt0se_49",
|
|
4021
|
+
icon: "_icon_mt0se_49",
|
|
4022
|
+
body: "_body_mt0se_69",
|
|
4023
|
+
label: "_label_mt0se_77",
|
|
4024
|
+
description: "_description_mt0se_84",
|
|
4025
|
+
badge: "_badge_mt0se_90",
|
|
4026
|
+
sm: "_sm_mt0se_105",
|
|
4027
|
+
md: "_md_mt0se_123",
|
|
4028
|
+
lg: "_lg_mt0se_127",
|
|
4029
|
+
segmented: "_segmented_mt0se_149",
|
|
4030
|
+
line: "_line_mt0se_196",
|
|
4031
|
+
pills: "_pills_mt0se_211",
|
|
4032
|
+
vertical: "_vertical_mt0se_239"
|
|
4030
4033
|
}, ui = ({ children: e, className: t }) => /* @__PURE__ */ d("span", {
|
|
4031
4034
|
className: U(li.badge, t),
|
|
4032
4035
|
children: e
|
|
@@ -4042,62 +4045,113 @@ var di = ({ children: e, className: t }) => /* @__PURE__ */ d("span", {
|
|
|
4042
4045
|
di.displayName = "Tabs.Icon";
|
|
4043
4046
|
//#endregion
|
|
4044
4047
|
//#region src/components/Tabs/Trigger/TabsTrigger.tsx
|
|
4045
|
-
var fi = _(({ value: e, children: t, className: n, disabled: r = !1,
|
|
4046
|
-
let { value:
|
|
4047
|
-
process.env.NODE_ENV !== "production" &&
|
|
4048
|
-
let
|
|
4049
|
-
|
|
4048
|
+
var fi = _(({ value: e, children: t, className: n, disabled: r = !1, asChild: i = !1, icon: a, badge: o, description: s, onClick: c, onKeyDown: l, ...m }, g) => {
|
|
4049
|
+
let { value: _, focusedValue: b, setValue: x, setFocusedValue: S, mode: C, orientation: w, variant: T, size: E, disabled: D, registerTrigger: O, onTriggerKeyDown: k, getTriggerId: A, getContentId: j } = Yr(), M = D || r, N = _ === e, P = b === e || !b && N, F = i && v(t) ? t : void 0, I = F ? F.props.children : t, L = p.toArray(I), R = L.some((e) => v(e) && e.type.displayName === "Tabs.Icon"), z = !!a, B = (z || R) && I == null;
|
|
4050
|
+
process.env.NODE_ENV !== "production" && z && R && console.warn(`Tabs.Trigger value "${e}" received both icon and Tabs.Icon. Tabs.Icon takes precedence.`);
|
|
4051
|
+
let ee = y((t) => {
|
|
4052
|
+
O(e, t, M), typeof g == "function" ? g(t) : g && (g.current = t);
|
|
4050
4053
|
}, [
|
|
4054
|
+
M,
|
|
4055
|
+
g,
|
|
4051
4056
|
O,
|
|
4052
|
-
u,
|
|
4053
|
-
w,
|
|
4054
4057
|
e
|
|
4055
|
-
]),
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4058
|
+
]), V = z && !R || o || s, H = L.every((e) => typeof e == "string" || typeof e == "number"), te = U(li.trigger, li[T], li[E], w === "vertical" && li.vertical, z && li.withIcon, B && li.iconOnly, n), ne = (t) => {
|
|
4059
|
+
if (M) {
|
|
4060
|
+
t.preventDefault();
|
|
4061
|
+
return;
|
|
4062
|
+
}
|
|
4063
|
+
S(e), x(e);
|
|
4064
|
+
}, re = (e) => {
|
|
4065
|
+
e.defaultPrevented || k(e);
|
|
4066
|
+
};
|
|
4067
|
+
return C === "navigation" && F ? h(F, {
|
|
4068
|
+
...m,
|
|
4069
|
+
ref: ee,
|
|
4070
|
+
id: A(e),
|
|
4071
|
+
className: U(F.props.className, te),
|
|
4072
|
+
"aria-current": N ? "page" : void 0,
|
|
4073
|
+
"aria-disabled": M || void 0,
|
|
4074
|
+
"data-state": N ? "active" : "inactive",
|
|
4075
|
+
tabIndex: M ? -1 : F.props.tabIndex,
|
|
4076
|
+
onClick: (e) => {
|
|
4077
|
+
if (F.props.onClick?.(e), M) {
|
|
4078
|
+
e.preventDefault();
|
|
4079
|
+
return;
|
|
4080
|
+
}
|
|
4081
|
+
ne(e);
|
|
4082
|
+
},
|
|
4083
|
+
onKeyDown: (e) => {
|
|
4084
|
+
F.props.onKeyDown?.(e), !e.defaultPrevented && re(e);
|
|
4085
|
+
},
|
|
4086
|
+
children: /* @__PURE__ */ f(u, { children: [
|
|
4087
|
+
z && !R && /* @__PURE__ */ d("span", {
|
|
4088
|
+
className: li.icon,
|
|
4089
|
+
"aria-hidden": "true",
|
|
4090
|
+
children: a
|
|
4091
|
+
}),
|
|
4092
|
+
I != null && (V ? /* @__PURE__ */ f("span", {
|
|
4093
|
+
className: li.body,
|
|
4094
|
+
children: [/* @__PURE__ */ d("span", {
|
|
4095
|
+
className: li.label,
|
|
4096
|
+
children: I
|
|
4097
|
+
}), s != null && /* @__PURE__ */ d("span", {
|
|
4098
|
+
className: li.description,
|
|
4099
|
+
children: s
|
|
4100
|
+
})]
|
|
4101
|
+
}) : H ? /* @__PURE__ */ d("span", {
|
|
4102
|
+
className: li.label,
|
|
4103
|
+
children: I
|
|
4104
|
+
}) : I),
|
|
4105
|
+
o != null && /* @__PURE__ */ d("span", {
|
|
4106
|
+
className: li.badge,
|
|
4107
|
+
children: o
|
|
4108
|
+
})
|
|
4109
|
+
] })
|
|
4110
|
+
}) : (process.env.NODE_ENV !== "production" && C === "tabs" && i && console.warn("Tabs.Trigger: asChild is only supported when Tabs mode=\"navigation\"."), process.env.NODE_ENV !== "production" && C === "navigation" && i && !F && console.warn("Tabs.Trigger: asChild requires a single valid React element child."), /* @__PURE__ */ f("button", {
|
|
4111
|
+
...m,
|
|
4112
|
+
ref: ee,
|
|
4059
4113
|
type: "button",
|
|
4060
4114
|
role: "tab",
|
|
4061
|
-
id:
|
|
4062
|
-
"aria-selected":
|
|
4063
|
-
"aria-controls":
|
|
4064
|
-
disabled:
|
|
4065
|
-
tabIndex:
|
|
4066
|
-
"data-state":
|
|
4067
|
-
"data-orientation":
|
|
4068
|
-
"data-disabled":
|
|
4069
|
-
className:
|
|
4070
|
-
onClick: (
|
|
4071
|
-
|
|
4115
|
+
id: A(e),
|
|
4116
|
+
"aria-selected": N,
|
|
4117
|
+
"aria-controls": j(e),
|
|
4118
|
+
disabled: M,
|
|
4119
|
+
tabIndex: P ? 0 : -1,
|
|
4120
|
+
"data-state": N ? "active" : "inactive",
|
|
4121
|
+
"data-orientation": w,
|
|
4122
|
+
"data-disabled": M ? "" : void 0,
|
|
4123
|
+
className: te,
|
|
4124
|
+
onClick: (e) => {
|
|
4125
|
+
c?.(e), !e.defaultPrevented && ne(e);
|
|
4072
4126
|
},
|
|
4073
4127
|
onKeyDown: (e) => {
|
|
4074
|
-
|
|
4128
|
+
l?.(e), !e.defaultPrevented && re(e);
|
|
4075
4129
|
},
|
|
4076
4130
|
children: [
|
|
4077
|
-
|
|
4131
|
+
z && !R && /* @__PURE__ */ d("span", {
|
|
4078
4132
|
className: li.icon,
|
|
4079
4133
|
"aria-hidden": "true",
|
|
4080
|
-
children:
|
|
4134
|
+
children: a
|
|
4081
4135
|
}),
|
|
4082
|
-
|
|
4136
|
+
I != null && (V ? /* @__PURE__ */ f("span", {
|
|
4083
4137
|
className: li.body,
|
|
4084
4138
|
children: [/* @__PURE__ */ d("span", {
|
|
4085
4139
|
className: li.label,
|
|
4086
|
-
children:
|
|
4087
|
-
}),
|
|
4140
|
+
children: I
|
|
4141
|
+
}), s != null && /* @__PURE__ */ d("span", {
|
|
4088
4142
|
className: li.description,
|
|
4089
|
-
children:
|
|
4143
|
+
children: s
|
|
4090
4144
|
})]
|
|
4091
|
-
}) :
|
|
4145
|
+
}) : H ? /* @__PURE__ */ d("span", {
|
|
4092
4146
|
className: li.label,
|
|
4093
|
-
children:
|
|
4094
|
-
}) :
|
|
4095
|
-
|
|
4147
|
+
children: I
|
|
4148
|
+
}) : I),
|
|
4149
|
+
o != null && /* @__PURE__ */ d("span", {
|
|
4096
4150
|
className: li.badge,
|
|
4097
|
-
children:
|
|
4151
|
+
children: o
|
|
4098
4152
|
})
|
|
4099
4153
|
]
|
|
4100
|
-
});
|
|
4154
|
+
}));
|
|
4101
4155
|
});
|
|
4102
4156
|
fi.displayName = "Tabs.Trigger";
|
|
4103
4157
|
//#endregion
|