@toteat-eng/ds-react 2026.6.11 → 2026.6.18

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.es.js CHANGED
@@ -3023,52 +3023,61 @@ function Yi({ variant: e = "default", children: t, "data-testid": n }) {
3023
3023
  });
3024
3024
  }
3025
3025
  var Xi = {
3026
- tabs: "_tabs_zujvo_2",
3027
- tabList: "_tabList_zujvo_8",
3028
- tab: "_tab_zujvo_2",
3029
- panel: "_panel_zujvo_58"
3026
+ tabs: "_tabs_16jix_2",
3027
+ tabList: "_tabList_16jix_8",
3028
+ tab: "_tab_16jix_2",
3029
+ panel: "_panel_16jix_66"
3030
3030
  };
3031
3031
  //#endregion
3032
3032
  //#region src/components/Tabs/Tabs.tsx
3033
- function Zi({ items: e, defaultTab: t, activeTab: n, "aria-label": r, onChange: i, "data-testid": a }) {
3034
- let [o, s] = l(t ?? e[0]?.id ?? ""), u = n !== void 0, p = u ? n : o, m = c(/* @__PURE__ */ new Map()), h = c(u);
3035
- process.env.NODE_ENV !== "production" && h.current !== u && console.error("Tabs: `activeTab` prop changed from %s to %s. A component cannot switch between controlled and uncontrolled modes.", h.current ? "controlled" : "uncontrolled", u ? "controlled" : "uncontrolled");
3036
- let g = (e) => {
3037
- u || s(e), i?.(e);
3038
- }, _ = (t, n) => {
3033
+ function Zi({ items: e, defaultTab: t, activeTab: n, "aria-label": r, onChange: a, "data-testid": o }) {
3034
+ let [s, u] = l(t ?? e[0]?.id ?? ""), p = n !== void 0, m = p ? n : s, h = c(/* @__PURE__ */ new Map()), g = c(p), _ = c(!1);
3035
+ process.env.NODE_ENV !== "production" && g.current !== p && console.error("Tabs: `activeTab` prop changed from %s to %s. A component cannot switch between controlled and uncontrolled modes.", g.current ? "controlled" : "uncontrolled", p ? "controlled" : "uncontrolled");
3036
+ let v = (e) => {
3037
+ p || u(e), a?.(e);
3038
+ }, y = (t, n) => {
3039
3039
  let r = e.filter((e) => !e.disabled).map((e) => e.id), i = r.indexOf(e[n]?.id ?? ""), a;
3040
- t.key === "ArrowRight" ? (t.preventDefault(), a = r[(i + 1) % r.length]) : t.key === "ArrowLeft" ? (t.preventDefault(), a = r[(i - 1 + r.length) % r.length]) : t.key === "Home" ? (t.preventDefault(), a = r[0]) : t.key === "End" && (t.preventDefault(), a = r[r.length - 1]), a && (g(a), m.current.get(a)?.focus());
3041
- }, v = e.find((e) => e.id === p)?.content;
3042
- return /* @__PURE__ */ f("div", {
3040
+ t.key === "ArrowRight" ? (t.preventDefault(), a = r[(i + 1) % r.length]) : t.key === "ArrowLeft" ? (t.preventDefault(), a = r[(i - 1 + r.length) % r.length]) : t.key === "Home" ? (t.preventDefault(), a = r[0]) : t.key === "End" && (t.preventDefault(), a = r[r.length - 1]), a && (v(a), h.current.get(a)?.focus());
3041
+ }, b = e.find((e) => e.id === m)?.content;
3042
+ return i(() => {
3043
+ if (!_.current) {
3044
+ _.current = !0;
3045
+ return;
3046
+ }
3047
+ h.current.get(m)?.scrollIntoView({
3048
+ inline: "nearest",
3049
+ block: "nearest"
3050
+ });
3051
+ }, [m]), /* @__PURE__ */ f("div", {
3043
3052
  className: Xi.tabs,
3044
- "data-testid": a,
3053
+ "data-testid": o,
3045
3054
  children: [/* @__PURE__ */ d("div", {
3046
3055
  className: Xi.tabList,
3047
3056
  role: "tablist",
3048
3057
  "aria-label": r,
3049
3058
  children: e.map((e, t) => /* @__PURE__ */ d("button", {
3050
3059
  ref: (t) => {
3051
- t ? m.current.set(e.id, t) : m.current.delete(e.id);
3060
+ t ? h.current.set(e.id, t) : h.current.delete(e.id);
3052
3061
  },
3053
3062
  type: "button",
3054
3063
  role: "tab",
3055
- "aria-selected": e.id === p,
3056
- "aria-controls": v == null ? void 0 : `panel-${p}`,
3064
+ "aria-selected": e.id === m,
3065
+ "aria-controls": b == null ? void 0 : `panel-${m}`,
3057
3066
  id: `tab-${e.id}`,
3058
3067
  className: Xi.tab,
3059
- "data-active": e.id === p || void 0,
3068
+ "data-active": e.id === m || void 0,
3060
3069
  disabled: e.disabled,
3061
- tabIndex: e.id === p ? 0 : -1,
3062
- onClick: () => !e.disabled && g(e.id),
3063
- onKeyDown: (e) => _(e, t),
3070
+ tabIndex: e.id === m ? 0 : -1,
3071
+ onClick: () => !e.disabled && v(e.id),
3072
+ onKeyDown: (e) => y(e, t),
3064
3073
  children: e.label
3065
3074
  }, e.id))
3066
- }), v != null && /* @__PURE__ */ d("div", {
3075
+ }), b != null && /* @__PURE__ */ d("div", {
3067
3076
  role: "tabpanel",
3068
- id: `panel-${p}`,
3069
- "aria-labelledby": `tab-${p}`,
3077
+ id: `panel-${m}`,
3078
+ "aria-labelledby": `tab-${m}`,
3070
3079
  className: Xi.panel,
3071
- children: v
3080
+ children: b
3072
3081
  })]
3073
3082
  });
3074
3083
  }