@vellira-ui/react 2.59.3 → 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.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 { orientation: i, variant: a } = Yr(), o = n ?? !1;
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": i,
3836
- "data-variant": a,
3837
- "data-scrollable": o ? "" : void 0,
3838
- className: U(ti.list, i === "vertical" && ti.vertical, a === "line" && ti.line, a === "pills" && ti.pills, a === "segmented" && ti.segmented, o && ti.scrollable, t),
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, variant: c = "line", color: l = "primary", size: u = "md", keepMounted: f = !1, lazyMount: p = !1, disabled: m = !1, className: h, ...g }) => {
3918
- let _ = S(), v = t !== void 0, { value: b, setValue: C } = Ue({
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
- }), w = T(b), D = T(void 0), O = T(void 0), [k, A] = E(b), { version: j, triggersRef: M, contentsRef: N, registerTrigger: P, registerContent: F } = ai(), I = y((e, t, n = !1) => {
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 = w.current, n = M.current, r = n.findIndex((t) => t.value === e);
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
- D.current = i?.value ?? a?.value, !v && D.current && (C(D.current), A(D.current), D.current = void 0);
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
- P(e, t, m || n);
3930
+ F(e, t, h || n);
3931
3931
  }, [
3932
- m,
3933
- v,
3934
- P,
3935
- A,
3936
- C,
3937
- M
3938
- ]), { onKeyDown: L } = oi({
3939
- focusedValue: k,
3940
- setValue: C,
3941
- setFocusedValue: A,
3942
- getTabs: () => M.current,
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
- }), R = {
3948
- value: b,
3949
- focusedValue: k,
3950
- collectionVersion: j,
3951
- setValue: C,
3952
- setFocusedValue: A,
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: c,
3958
- color: l,
3959
- size: u,
3960
- keepMounted: f,
3961
- lazyMount: p,
3962
- disabled: m,
3963
- registerTrigger: I,
3964
- registerContent: F,
3965
- onTriggerKeyDown: L,
3966
- getTriggerId: y((e) => `${_}-trigger-${e}`, [_]),
3967
- getContentId: y((e) => `${_}-content-${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
- w.current = b;
3971
- }, [b]), x(() => {
3972
- let e = M.current.filter((e) => !e.disabled), t = e.find((e) => e.value === b), n = M.current.some((e) => e.value === b), r = D.current ?? e[0]?.value;
3973
- if (D.current = void 0, v) {
3974
- process.env.NODE_ENV !== "production" && b && !n && M.current.length > 0 && console.warn(`Tabs: value "${b}" does not match any Tabs.Trigger.`), !t && !k && e[0] && A(e[0].value);
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 (!b || !n) {
3978
- r ? (C(r), A(r)) : A(void 0);
3978
+ if (!C || !n) {
3979
+ r ? (w(r), j(r)) : j(void 0);
3979
3980
  return;
3980
3981
  }
3981
- t && O.current !== b && (A(b), O.current = b);
3982
+ t && k.current !== C && (j(C), k.current = C);
3982
3983
  }, [
3983
- k,
3984
- v,
3985
- C,
3986
- M,
3984
+ A,
3987
3985
  b,
3988
- j
3986
+ w,
3987
+ N,
3988
+ C,
3989
+ M
3989
3990
  ]), x(() => {
3990
- if (process.env.NODE_ENV === "production") return;
3991
- let e = M.current.map((e) => e.value), t = N.current.map((e) => e.value), n = e.find((t, n) => e.indexOf(t) !== n);
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: R,
4002
+ value: z,
4001
4003
  children: /* @__PURE__ */ d("div", {
4002
- ...g,
4003
- className: U(si.tabs, i === "vertical" && si.vertical, h),
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": c,
4007
- "data-color": l,
4008
- "data-size": u,
4009
- "data-disabled": m ? "" : void 0,
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: "_trigger_uc2y5_1",
4017
- iconOnly: "_iconOnly_uc2y5_49",
4018
- icon: "_icon_uc2y5_49",
4019
- body: "_body_uc2y5_69",
4020
- label: "_label_uc2y5_77",
4021
- description: "_description_uc2y5_84",
4022
- badge: "_badge_uc2y5_90",
4023
- sm: "_sm_uc2y5_105",
4024
- md: "_md_uc2y5_123",
4025
- lg: "_lg_uc2y5_127",
4026
- segmented: "_segmented_uc2y5_149",
4027
- line: "_line_uc2y5_194",
4028
- pills: "_pills_uc2y5_209",
4029
- vertical: "_vertical_uc2y5_235"
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, icon: i, badge: a, description: o, onClick: s, onKeyDown: c, ...l }, u) => {
4046
- let { value: m, focusedValue: h, setValue: g, setFocusedValue: _, orientation: b, variant: x, size: S, disabled: C, registerTrigger: w, onTriggerKeyDown: T, getTriggerId: E, getContentId: D } = Yr(), O = C || r, k = m === e, A = h === e || !h && k, j = p.toArray(t), M = j.some((e) => v(e) && e.type.displayName === "Tabs.Icon"), N = !!i, P = (N || M) && t == null;
4047
- process.env.NODE_ENV !== "production" && N && M && console.warn(`Tabs.Trigger value "${e}" received both icon and Tabs.Icon. Tabs.Icon takes precedence.`);
4048
- let F = y((t) => {
4049
- w(e, t, O), typeof u == "function" ? u(t) : u && (u.current = t);
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
- ]), I = N && !M || a || o, L = j.every((e) => typeof e == "string" || typeof e == "number");
4056
- return /* @__PURE__ */ f("button", {
4057
- ...l,
4058
- ref: F,
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: E(e),
4062
- "aria-selected": k,
4063
- "aria-controls": D(e),
4064
- disabled: O,
4065
- tabIndex: A ? 0 : -1,
4066
- "data-state": k ? "active" : "inactive",
4067
- "data-orientation": b,
4068
- "data-disabled": O ? "" : void 0,
4069
- className: U(li.trigger, li[x], li[S], b === "vertical" && li.vertical, N && li.withIcon, P && li.iconOnly, n),
4070
- onClick: (t) => {
4071
- s?.(t), !(t.defaultPrevented || O) && (_(e), g(e));
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
- c?.(e), !e.defaultPrevented && T(e);
4128
+ l?.(e), !e.defaultPrevented && re(e);
4075
4129
  },
4076
4130
  children: [
4077
- N && !M && /* @__PURE__ */ d("span", {
4131
+ z && !R && /* @__PURE__ */ d("span", {
4078
4132
  className: li.icon,
4079
4133
  "aria-hidden": "true",
4080
- children: i
4134
+ children: a
4081
4135
  }),
4082
- t != null && (I ? /* @__PURE__ */ f("span", {
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: t
4087
- }), o != null && /* @__PURE__ */ d("span", {
4140
+ children: I
4141
+ }), s != null && /* @__PURE__ */ d("span", {
4088
4142
  className: li.description,
4089
- children: o
4143
+ children: s
4090
4144
  })]
4091
- }) : L ? /* @__PURE__ */ d("span", {
4145
+ }) : H ? /* @__PURE__ */ d("span", {
4092
4146
  className: li.label,
4093
- children: t
4094
- }) : t),
4095
- a != null && /* @__PURE__ */ d("span", {
4147
+ children: I
4148
+ }) : I),
4149
+ o != null && /* @__PURE__ */ d("span", {
4096
4150
  className: li.badge,
4097
- children: a
4151
+ children: o
4098
4152
  })
4099
4153
  ]
4100
- });
4154
+ }));
4101
4155
  });
4102
4156
  fi.displayName = "Tabs.Trigger";
4103
4157
  //#endregion