@spear-ai/spectral 1.4.23 → 1.4.25

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.
@@ -17,5 +17,11 @@ export type RadioButtonGroupItemProps = AsChildProp & {
17
17
  onSelect?: (value: string) => void;
18
18
  };
19
19
  export declare const RadioButtonGroupBase: ({ value, onValueChange, children, className, isKeptActive, expanded }: RadioButtonGroupProps) => import("react/jsx-runtime").JSX.Element;
20
- export declare const RadioButtonGroupItem: ({ value, children, className, disabled, asChild, onSelect }: RadioButtonGroupItemProps) => import("react/jsx-runtime").JSX.Element;
20
+ export declare const RadioButtonGroupItem: import('react').ForwardRefExoticComponent<AsChildProp & {
21
+ value: string;
22
+ children: ReactNode;
23
+ className?: string;
24
+ disabled?: boolean;
25
+ onSelect?: (value: string) => void;
26
+ } & import('react').RefAttributes<HTMLButtonElement>>;
21
27
  //# sourceMappingURL=RadioButtonGroupBase.d.ts.map
@@ -1,37 +1,38 @@
1
1
  "use client";
2
2
  import "../styles/main.css";
3
3
  import { jsx as a } from "react/jsx-runtime";
4
- import { Slot as x } from "../primitives/slot.js";
5
- import { cn as c } from "../utils/twUtils.js";
6
- import { createContext as h, useContext as w } from "react";
7
- const u = h(null), R = ({ value: t, onValueChange: n, children: i, className: o, isKeptActive: r = !1, expanded: e = !1 }) => /* @__PURE__ */ a(u.Provider, { value: { value: t, onValueChange: n, isKeptActive: r, expanded: e }, children: /* @__PURE__ */ a("div", { role: "radiogroup", "data-testid": "spectral-radio-button-group", "data-expanded": e, className: c("flex h-fit w-fit items-center rounded-md [&_button:first-of-type]:rounded-l-md [&_button:last-of-type]:rounded-r-md", "data-[expanded=true]:w-full", o), children: i }) }), _ = ({ value: t, children: n, className: i, disabled: o = !1, asChild: r = !1, onSelect: e }) => {
8
- const s = w(u);
4
+ import { Slot as h } from "../primitives/slot.js";
5
+ import { cn as u } from "../utils/twUtils.js";
6
+ import { createContext as w, forwardRef as B, useContext as R } from "react";
7
+ const c = w(null), z = ({ value: t, onValueChange: n, children: i, className: o, isKeptActive: r = !1, expanded: e = !1 }) => /* @__PURE__ */ a(c.Provider, { value: { value: t, onValueChange: n, isKeptActive: r, expanded: e }, children: /* @__PURE__ */ a("div", { role: "radiogroup", "data-testid": "spectral-radio-button-group", "data-expanded": e, className: u("flex h-fit w-fit items-center rounded-md [&_button:first-of-type]:rounded-l-md [&_button:last-of-type]:rounded-r-md", "data-[expanded=true]:w-full", o), children: i }) }), y = B(({ value: t, children: n, className: i, disabled: o = !1, asChild: r = !1, onSelect: e }, g) => {
8
+ const s = R(c);
9
9
  if (!s)
10
10
  throw new Error("RadioButtonGroupItem must be used within a RadioButtonGroup");
11
- const { value: g, onValueChange: d, isKeptActive: b, expanded: f } = s, l = g === t, p = () => {
11
+ const { value: f, onValueChange: d, isKeptActive: b, expanded: p } = s, l = f === t, v = () => {
12
12
  o || (d && d(t), e && e(t));
13
- }, v = r ? x : "button", m = {
13
+ }, m = r ? h : "button", x = {
14
14
  role: "radio",
15
15
  "aria-checked": l,
16
16
  "data-state": l ? "on" : "off",
17
17
  "data-testid": "spectral-radio-button-group-item",
18
18
  disabled: o,
19
- onClick: p,
20
- className: c(
19
+ onClick: v,
20
+ className: u(
21
21
  `bg-toggle-bg inline-flex items-center justify-center gap-2 border text-sm font-medium disabled:pointer-events-none disabled:opacity-50
22
22
  disabled:cursor-not-allowed hover:cursor-pointer text-toggle-text hover:bg-toggle-bg--hover hover:text-toggle-text--hover transition-[colors]
23
23
  [&_svg]:pointer-events-none [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] focus:outline-none
24
24
  outline-none border-toggle-border hover:border-toggle-border--hover h-9 px-3 min-w-9 [&_svg:not([class*='size-']):not([width]):not([height])]:size-4
25
25
  rounded-none shadow-none focus:z-10 focus-visible:z-10 [&:not(:first-child)]:border-l-0 active:bg-toggle-bg--active active:text-toggle-text--active
26
26
  active:border-toggle-border--active`,
27
- f && "w-full",
27
+ p && "w-full",
28
28
  b && "data-[state=on]:bg-toggle-bg--active data-[state=on]:text-toggle-text--active data-[state=on]:border-toggle-border--active",
29
29
  i
30
30
  )
31
31
  };
32
- return /* @__PURE__ */ a(v, { ...!r && { type: "button" }, ...m, children: n });
33
- };
32
+ return /* @__PURE__ */ a(m, { ref: g, ...!r && { type: "button" }, ...x, children: n });
33
+ });
34
+ y.displayName = "RadioButtonGroupItem";
34
35
  export {
35
- R as RadioButtonGroupBase,
36
- _ as RadioButtonGroupItem
36
+ z as RadioButtonGroupBase,
37
+ y as RadioButtonGroupItem
37
38
  };
@@ -3,5 +3,11 @@ import { ComponentProps } from 'react';
3
3
  export type RadioButtonGroupProps = ComponentProps<typeof RadioButtonGroupBase>;
4
4
  export type RadioButtonGroupItemProps = RadioButtonGroupItemPropsBase;
5
5
  export declare const RadioButtonGroup: ({ className, children, ...props }: RadioButtonGroupProps) => import("react/jsx-runtime").JSX.Element;
6
- export declare const RadioButtonGroupItem: ({ value, children, className, disabled, asChild, onSelect }: RadioButtonGroupItemPropsBase) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const RadioButtonGroupItem: import('react').ForwardRefExoticComponent<import('../../primitives/slot').AsChildProp & {
7
+ value: string;
8
+ children: import('react').ReactNode;
9
+ className?: string;
10
+ disabled?: boolean;
11
+ onSelect?: (value: string) => void;
12
+ } & import('react').RefAttributes<HTMLButtonElement>>;
7
13
  //# sourceMappingURL=RadioButtonGroup.d.ts.map
@@ -1,11 +1,12 @@
1
1
  import { ComponentPropsWithoutRef, ReactNode } from 'react';
2
2
  export interface TabsContextValue {
3
- onValueChange: (value: string) => void;
4
3
  activationMode: 'automatic' | 'manual';
5
4
  baseId: string;
6
5
  dir: 'ltr' | 'rtl';
7
6
  disabled: boolean;
7
+ onValueChange: (value: string) => void;
8
8
  orientation: 'horizontal' | 'vertical';
9
+ rightSlot?: ReactNode | undefined;
9
10
  value: string;
10
11
  }
11
12
  export declare const TabsContext: import('react').Context<TabsContextValue | null>;
@@ -18,11 +19,14 @@ export interface TabsBaseProps extends Omit<ComponentPropsWithoutRef<'div'>, 'di
18
19
  dir?: 'ltr' | 'rtl';
19
20
  disabled?: boolean;
20
21
  orientation?: 'horizontal' | 'vertical';
22
+ rightSlot?: ReactNode | undefined;
21
23
  value?: string;
22
24
  }
23
25
  export declare const TabsBase: import('react').ForwardRefExoticComponent<TabsBaseProps & import('react').RefAttributes<HTMLElement>>;
24
- export interface TabsListProps extends ComponentPropsWithoutRef<'div'> {
26
+ export interface TabsListProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
27
+ children?: ReactNode;
25
28
  loop?: boolean;
29
+ rightSlot?: ReactNode | undefined;
26
30
  }
27
31
  export declare const TabsList: import('react').ForwardRefExoticComponent<TabsListProps & import('react').RefAttributes<HTMLElement>>;
28
32
  export interface TabsTriggerProps extends ComponentPropsWithoutRef<'button'> {
@@ -30,6 +34,11 @@ export interface TabsTriggerProps extends ComponentPropsWithoutRef<'button'> {
30
34
  disabled?: boolean;
31
35
  }
32
36
  export declare const TabsTrigger: import('react').ForwardRefExoticComponent<TabsTriggerProps & import('react').RefAttributes<HTMLElement>>;
37
+ export interface TabsContentContainerProps {
38
+ children: ReactNode;
39
+ className?: string;
40
+ }
41
+ export declare const TabsContentContainer: import('react').ForwardRefExoticComponent<TabsContentContainerProps & import('react').RefAttributes<HTMLDivElement>>;
33
42
  export interface TabsContentProps extends ComponentPropsWithoutRef<'div'> {
34
43
  value: string;
35
44
  forceMount?: boolean;
@@ -1,164 +1,215 @@
1
1
  "use client";
2
2
  import "../styles/main.css";
3
- import { jsx as x, jsxs as R } from "react/jsx-runtime";
4
- import { generateId as $, prefersReducedMotion as _, debounce as L, getIndicatorPosition as S, calculateIndicatorStyle as K } from "./tabsUtils.js";
3
+ import { jsx as m, jsxs as E } from "react/jsx-runtime";
4
+ import { generateId as M, prefersReducedMotion as $, debounce as K, getIndicatorPosition as P, calculateIndicatorStyle as S } from "./tabsUtils.js";
5
5
  import { cn as y } from "../utils/twUtils.js";
6
- import { createContext as M, forwardRef as z, useState as D, useId as N, useCallback as w, useRef as k, useEffect as O, useContext as P } from "react";
7
- const E = M(null), C = (I = "Tabs") => {
8
- const u = P(E);
9
- if (u === null)
10
- throw new Error(`${I} components must be used within a Tabs.Root`);
11
- return u;
12
- }, B = z(function({ activationMode: u = "automatic", children: e, defaultValue: h, dir: b = "ltr", disabled: l = !1, onValueChange: f, orientation: o = "horizontal", value: v, ...s }, c) {
13
- const [m, g] = D(h ?? ""), d = N() ?? $("tabs"), a = v !== void 0, t = a ? v : m, n = w(
14
- (p) => {
15
- l || (a || g(p), f?.(p));
6
+ import { createContext as j, forwardRef as I, useState as N, useId as k, useCallback as T, useRef as O, useEffect as U, useContext as F } from "react";
7
+ import { j as q, m as R, A as B } from "../index-BvRlXSJj.js";
8
+ const _ = j(null), D = (x = "Tabs") => {
9
+ const l = F(_);
10
+ if (l === null)
11
+ throw new Error(`${x} components must be used within a Tabs.Root`);
12
+ return l;
13
+ }, X = I(function({ activationMode: l = "automatic", children: a, defaultValue: r, dir: d = "ltr", disabled: u = !1, onValueChange: f, orientation: o = "horizontal", rightSlot: v, value: t, ...b }, p) {
14
+ const [g, w] = N(r ?? ""), C = k() ?? M("tabs"), i = t !== void 0, e = i ? t : g, n = T(
15
+ (s) => {
16
+ u || (i || w(s), f?.(s));
16
17
  },
17
- [a, f, l]
18
- ), r = {
19
- value: t,
18
+ [i, f, u]
19
+ ), c = {
20
+ activationMode: l,
21
+ baseId: C,
22
+ dir: d,
23
+ disabled: u,
20
24
  onValueChange: n,
21
25
  orientation: o,
22
- activationMode: u,
23
- dir: b,
24
- disabled: l,
25
- baseId: d
26
+ rightSlot: v,
27
+ value: e
26
28
  };
27
- return /* @__PURE__ */ x(E.Provider, { value: r, children: /* @__PURE__ */ x("div", { ref: c, "data-testid": "spectral-tabs", "data-orientation": o, "data-disabled": l ? "" : void 0, dir: b, ...s, children: e }) });
28
- }), H = z(function({ className: u, loop: e = !0, ...h }, b) {
29
- const { orientation: l, disabled: f } = C("TabsList"), [o, v] = D(() => ({
30
- left: 0,
31
- top: 0,
32
- width: 0,
29
+ return /* @__PURE__ */ m(_.Provider, { value: c, children: /* @__PURE__ */ m("div", { ref: p, "data-testid": "spectral-tabs", "data-orientation": o, "data-disabled": u ? "" : void 0, dir: d, ...b, children: a }) });
30
+ }), Y = I(function({ children: l, className: a, loop: r = !0, rightSlot: d, ...u }, f) {
31
+ const { orientation: o, disabled: v } = D("TabsList"), [t, b] = N(() => ({
33
32
  height: 0,
33
+ isEnclosed: !1,
34
+ left: 0,
34
35
  orientation: "horizontal",
35
- isEnclosed: !1
36
- })), s = k(null), c = _(), m = w(
37
- L(() => {
38
- const d = K(s);
39
- v(d);
36
+ top: 0,
37
+ width: 0
38
+ })), p = O(null), g = $(), w = T(
39
+ K(() => {
40
+ const i = S(p);
41
+ b(i);
40
42
  }, 16),
41
43
  // ~60fps
42
44
  []
43
45
  );
44
- O(() => {
45
- m();
46
- const d = new ResizeObserver(m), a = new MutationObserver(m), t = s.current;
47
- return t && (d.observe(t), a.observe(t, {
46
+ U(() => {
47
+ w();
48
+ const i = new ResizeObserver(w), e = new MutationObserver(w), n = p.current;
49
+ return n && (i.observe(n), e.observe(n, {
48
50
  attributes: !0,
49
51
  childList: !0,
50
52
  subtree: !0
51
53
  })), () => {
52
- d.disconnect(), a.disconnect();
54
+ i.disconnect(), e.disconnect();
53
55
  };
54
- }, [m]);
55
- const g = w(
56
- (d) => {
57
- if (f) return;
58
- const a = Array.from(s.current?.querySelectorAll("[role='tab']:not([disabled]):not([aria-disabled='true'])") ?? []);
59
- if (a.length === 0) return;
60
- const t = a.findIndex((T) => T === document.activeElement);
61
- if (t === -1) return;
62
- let n = null;
63
- const { key: r, ctrlKey: p, metaKey: A } = d, i = p || A;
64
- l === "horizontal" ? r === "ArrowLeft" || r === "ArrowUp" && i ? n = t > 0 ? t - 1 : e ? a.length - 1 : t : (r === "ArrowRight" || r === "ArrowDown" && i) && (n = t < a.length - 1 ? t + 1 : e ? 0 : t) : r === "ArrowUp" || r === "ArrowLeft" && i ? n = t > 0 ? t - 1 : e ? a.length - 1 : t : (r === "ArrowDown" || r === "ArrowRight" && i) && (n = t < a.length - 1 ? t + 1 : e ? 0 : t), r === "Home" ? n = 0 : r === "End" && (n = a.length - 1), n !== null && n !== t && (d.preventDefault(), d.stopPropagation(), a[n]?.focus());
56
+ }, [w]);
57
+ const C = T(
58
+ (i) => {
59
+ if (v) return;
60
+ const e = Array.from(p.current?.querySelectorAll("[role='tab']:not([disabled]):not([aria-disabled='true'])") ?? []);
61
+ if (e.length === 0) return;
62
+ const n = e.findIndex((L) => L === document.activeElement);
63
+ if (n === -1) return;
64
+ let c = null;
65
+ const { key: s, ctrlKey: h, metaKey: z } = i, A = h || z;
66
+ o === "horizontal" ? s === "ArrowLeft" || s === "ArrowUp" && A ? c = n > 0 ? n - 1 : r ? e.length - 1 : n : (s === "ArrowRight" || s === "ArrowDown" && A) && (c = n < e.length - 1 ? n + 1 : r ? 0 : n) : s === "ArrowUp" || s === "ArrowLeft" && A ? c = n > 0 ? n - 1 : r ? e.length - 1 : n : (s === "ArrowDown" || s === "ArrowRight" && A) && (c = n < e.length - 1 ? n + 1 : r ? 0 : n), s === "Home" ? c = 0 : s === "End" && (c = e.length - 1), c !== null && c !== n && (i.preventDefault(), i.stopPropagation(), e[c]?.focus());
65
67
  },
66
- [f, l, e]
68
+ [v, o, r]
67
69
  );
68
- return /* @__PURE__ */ R("div", { className: "relative", ref: s, children: [
69
- /* @__PURE__ */ x("div", { ref: b, role: "tablist", "data-testid": "spectral-tabs-list", "aria-orientation": l, "aria-disabled": f, className: y("tabs-list", u), onKeyDown: g, ...h }),
70
- /* @__PURE__ */ x(
70
+ return /* @__PURE__ */ E("div", { className: "relative", ref: p, children: [
71
+ /* @__PURE__ */ E(
72
+ "div",
73
+ {
74
+ ref: f,
75
+ role: "tablist",
76
+ "data-testid": "spectral-tabs-list",
77
+ "aria-orientation": o,
78
+ "aria-disabled": v,
79
+ className: y("tabs-list flex", o === "horizontal" && "items-center justify-between", o === "vertical" && "flex-col", a),
80
+ onKeyDown: C,
81
+ ...u,
82
+ children: [
83
+ /* @__PURE__ */ m("div", { className: y("flex", o === "horizontal" && "items-center", o === "vertical" && "flex-col"), children: l }),
84
+ d && /* @__PURE__ */ m("div", { className: "flex items-center z-10", children: d })
85
+ ]
86
+ }
87
+ ),
88
+ /* @__PURE__ */ m(
71
89
  "div",
72
90
  {
73
91
  className: y(
74
92
  "absolute pointer-events-none select-none",
75
- !c && "transition-all duration-300 ease-out",
76
- o.orientation === "horizontal" && !o.isEnclosed && ["bottom-[1px] after:content-[''] after:absolute after:bottom-0 after:left-0 after:w-full", "after:border-b-[0.3rem] after:border-tabs-indicator after:rounded-t-[0.3rem] z-10"],
77
- o.orientation === "vertical" && !o.isEnclosed && [
93
+ !g && "transition-all duration-300 ease-out",
94
+ t.orientation === "horizontal" && !t.isEnclosed && ["bottom-[1px] after:content-[''] after:absolute after:bottom-0 after:left-0 after:w-full", "after:border-b-[0.3rem] after:border-tabs-indicator after:rounded-t-[0.3rem] z-10"],
95
+ t.orientation === "vertical" && !t.isEnclosed && [
78
96
  "right-[1px]",
79
- !c && "transition-[top_300ms_ease,height_300ms_ease]",
97
+ !g && "transition-[top_300ms_ease,height_300ms_ease]",
80
98
  "after:content-[''] after:absolute after:right-0 after:top-0 after:h-full after:w-1",
81
99
  "after:border-r-[0.3rem] after:border-tabs-indicator after:rounded-l-[0.3rem] z-10"
82
100
  ],
83
- o.orientation === "horizontal" && o.isEnclosed && ["bg-tabs-enclosed-indicator rounded-lg shadow-lg top-[10%] bottom-[10%] z-0", !c && "transition-[left_300ms_ease,width_300ms_ease]"],
84
- o.orientation === "vertical" && o.isEnclosed && ["bg-tabs-enclosed-indicator rounded-lg shadow-lg left-1 right-1 z-0 max-h-10 w-auto"]
101
+ t.orientation === "horizontal" && t.isEnclosed && ["bg-tabs-enclosed-indicator rounded-lg shadow-lg top-[10%] bottom-[10%] z-0", !g && "transition-[left_300ms_ease,width_300ms_ease]"],
102
+ t.orientation === "vertical" && t.isEnclosed && ["bg-tabs-enclosed-indicator rounded-lg shadow-lg left-1 right-1 z-0 max-h-10 w-auto"]
85
103
  ),
86
104
  style: {
87
- ...S(o),
88
- ...o.isEnclosed && o.orientation === "vertical" ? { height: "40px" } : {}
105
+ ...P(t),
106
+ ...t.isEnclosed && t.orientation === "vertical" ? { height: "40px" } : {}
89
107
  },
90
108
  "aria-hidden": "true"
91
109
  }
92
110
  )
93
111
  ] });
94
- }), G = z(function({ className: u, value: e, onClick: h, onKeyDown: b, disabled: l = !1, ...f }, o) {
95
- const { value: v, onValueChange: s, activationMode: c, disabled: m, baseId: g } = C("TabsTrigger"), d = `${g}-trigger-${e}`, a = `${g}-content-${e}`, t = v === e, n = m || l, r = w(
96
- (i) => {
97
- if (n) {
98
- i.preventDefault();
112
+ }), Z = I(function({ className: l, value: a, onClick: r, onKeyDown: d, disabled: u = !1, ...f }, o) {
113
+ const { value: v, onValueChange: t, activationMode: b, disabled: p, baseId: g } = D("TabsTrigger"), w = `${g}-trigger-${a}`, C = `${g}-content-${a}`, i = v === a, e = p || u, n = T(
114
+ (h) => {
115
+ if (e) {
116
+ h.preventDefault();
99
117
  return;
100
118
  }
101
- s(e), h?.(i);
119
+ t(a), r?.(h);
102
120
  },
103
- [e, s, h, n]
104
- ), p = w(
105
- (i) => {
106
- if (n) {
107
- i.preventDefault();
121
+ [a, t, r, e]
122
+ ), c = T(
123
+ (h) => {
124
+ if (e) {
125
+ h.preventDefault();
108
126
  return;
109
127
  }
110
- const { key: T } = i;
111
- (T === "Enter" || T === " ") && (i.preventDefault(), i.stopPropagation(), s(e)), b?.(i);
128
+ const { key: z } = h;
129
+ (z === "Enter" || z === " ") && (h.preventDefault(), h.stopPropagation(), t(a)), d?.(h);
112
130
  },
113
- [e, s, b, n]
114
- ), A = w(() => {
115
- n || c === "automatic" && s(e);
116
- }, [c, s, e, n]);
117
- return /* @__PURE__ */ x(
131
+ [a, t, d, e]
132
+ ), s = T(() => {
133
+ e || b === "automatic" && t(a);
134
+ }, [b, t, a, e]);
135
+ return /* @__PURE__ */ m(
118
136
  "button",
119
137
  {
120
- "aria-controls": a,
121
- "aria-disabled": n,
122
- "aria-selected": t,
123
- className: y("tabs-trigger z-10 focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600", u),
124
- "data-disabled": n ? "" : void 0,
125
- "data-state": t ? "active" : "inactive",
138
+ "aria-controls": C,
139
+ "aria-disabled": e,
140
+ "aria-selected": i,
141
+ className: y("tabs-trigger z-10 focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600", l),
142
+ "data-disabled": e ? "" : void 0,
143
+ "data-state": i ? "active" : "inactive",
126
144
  "data-testid": "spectral-tabs-trigger",
127
- disabled: n,
128
- id: d,
129
- onClick: r,
130
- onFocus: A,
131
- onKeyDown: p,
145
+ disabled: e,
146
+ id: w,
147
+ onClick: n,
148
+ onFocus: s,
149
+ onKeyDown: c,
132
150
  ref: o,
133
151
  role: "tab",
134
- tabIndex: t ? 0 : -1,
152
+ tabIndex: i ? 0 : -1,
135
153
  type: "button",
136
154
  ...f
137
155
  }
138
156
  );
139
- }), J = z(function({ className: u, value: e, forceMount: h = !1, ...b }, l) {
140
- const { value: f, baseId: o } = C("TabsContent"), v = `${o}-content-${e}`, s = `${o}-trigger-${e}`, c = f === e;
141
- return !h && !c ? null : /* @__PURE__ */ x(
157
+ }), V = I(function({ children: l, className: a }, r) {
158
+ const { value: d } = D("TabsContentContainer"), [u, f] = q(), o = $();
159
+ return /* @__PURE__ */ m(
160
+ R.div,
161
+ {
162
+ ref: r,
163
+ className: y("overflow-hidden", a),
164
+ "data-testid": "spectral-tabs-content-container",
165
+ animate: {
166
+ height: f.height || "auto"
167
+ },
168
+ transition: o ? { duration: 0 } : {
169
+ duration: 0.3,
170
+ ease: [0.25, 1, 0.5, 1]
171
+ },
172
+ children: /* @__PURE__ */ m(B, { mode: "wait", initial: !1, children: /* @__PURE__ */ m(
173
+ R.div,
174
+ {
175
+ ref: u,
176
+ initial: o ? !1 : { opacity: 0, y: 8 },
177
+ animate: { opacity: 1, y: 0 },
178
+ exit: o ? void 0 : { opacity: 0, y: -8 },
179
+ transition: o ? { duration: 0 } : {
180
+ duration: 0.2,
181
+ ease: [0.25, 1, 0.5, 1]
182
+ },
183
+ children: l
184
+ },
185
+ d
186
+ ) })
187
+ }
188
+ );
189
+ }), tt = I(function({ className: l, value: a, forceMount: r = !1, ...d }, u) {
190
+ const { value: f, baseId: o } = D("TabsContent"), v = `${o}-content-${a}`, t = `${o}-trigger-${a}`, b = f === a;
191
+ return !r && !b ? null : /* @__PURE__ */ m(
142
192
  "div",
143
193
  {
144
- "aria-labelledby": s,
145
- className: y("tabs-content focus:outline-none focus-visible:outline-none", u),
146
- "data-state": c ? "active" : "inactive",
194
+ "aria-labelledby": t,
195
+ className: y("tabs-content focus:outline-none focus-visible:outline-none", l),
196
+ "data-state": b ? "active" : "inactive",
147
197
  "data-testid": "spectral-tabs-content",
148
- hidden: !c,
198
+ hidden: !b,
149
199
  id: v,
150
- ref: l,
200
+ ref: u,
151
201
  role: "tabpanel",
152
202
  tabIndex: 0,
153
- ...b
203
+ ...d
154
204
  }
155
205
  );
156
206
  });
157
207
  export {
158
- B as TabsBase,
159
- J as TabsContent,
160
- E as TabsContext,
161
- H as TabsList,
162
- G as TabsTrigger,
163
- C as useTabsContext
208
+ X as TabsBase,
209
+ tt as TabsContent,
210
+ V as TabsContentContainer,
211
+ _ as TabsContext,
212
+ Y as TabsList,
213
+ Z as TabsTrigger,
214
+ D as useTabsContext
164
215
  };
package/dist/Tabs.d.ts CHANGED
@@ -1,26 +1,28 @@
1
- import { TabsBase, TabsContent, TabsList, TabsTrigger, TabsBaseProps } from './TabsBase';
2
- import { ReactEventHandler, ReactNode } from 'react';
1
+ import { TabsBase, TabsContent, TabsContentContainer, TabsList, TabsTrigger, TabsBaseProps } from './TabsBase';
2
+ import { ReactNode } from 'react';
3
3
  export interface TabValue {
4
- key: string | undefined;
5
- label: ReactNode;
6
4
  children: ReactNode;
7
5
  disabled?: boolean | undefined;
6
+ key: string | undefined;
7
+ label: ReactNode;
8
8
  'aria-label'?: string | undefined;
9
9
  'aria-describedby'?: string | undefined;
10
10
  }
11
11
  export interface TabsProps extends Omit<TabsBaseProps, 'children' | 'defaultValue' | 'onError' | 'disabled'> {
12
- onBeforeChange?: (newValue: string, oldValue: string) => boolean | Promise<boolean> | undefined;
13
- onError?: (error: Error) => void | ReactEventHandler<HTMLDivElement> | undefined;
12
+ activationMode?: 'automatic' | 'manual' | undefined;
14
13
  ariaLabel?: string | undefined;
15
14
  className?: string | undefined;
15
+ onBeforeChange?: (newValue: string, oldValue: string) => boolean | Promise<boolean> | undefined;
16
+ onError?: ((error: Error) => void) | undefined;
17
+ loading?: boolean | undefined;
16
18
  openOnLoad?: string | undefined;
19
+ rightSlot?: ReactNode | undefined;
17
20
  tabValues: TabValue[] | undefined;
18
21
  variant?: 'enclosed' | 'default';
19
- loading?: boolean | undefined;
20
22
  }
21
- export declare const Tabs: ({ ariaLabel, className, openOnLoad, orientation, tabValues, variant, activationMode, loading, onError, onBeforeChange, onValueChange, ...props }: TabsProps) => import("react/jsx-runtime").JSX.Element;
22
- export { TabsContent, TabsList, TabsBase as TabsRoot, TabsTrigger };
23
- export type { TabsBaseProps, TabsContentProps, TabsListProps, TabsTriggerProps } from './TabsBase';
23
+ export declare const Tabs: ({ activationMode, ariaLabel, className, loading, onBeforeChange, onError, onValueChange, openOnLoad, orientation, rightSlot, tabValues, variant, ...props }: TabsProps) => import("react/jsx-runtime").JSX.Element;
24
+ export { TabsContent, TabsContentContainer, TabsList, TabsBase as TabsRoot, TabsTrigger };
25
+ export type { TabsBaseProps, TabsContentContainerProps, TabsContentProps, TabsListProps, TabsTriggerProps } from './TabsBase';
24
26
  export type TabKeys<T extends TabValue[]> = T[number]['key'];
25
27
  export type TabValueWithKey<TKey extends string> = TabValue & {
26
28
  key: TKey;