@mortenbrudvik/waveui 0.14.0 → 0.15.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/README.md +142 -32
- package/dist/components/data-display/InfoButton.cjs +1 -1
- package/dist/components/data-display/InfoButton.cjs.map +1 -1
- package/dist/components/data-display/InfoButton.mjs +90 -82
- package/dist/components/data-display/InfoButton.mjs.map +1 -1
- package/dist/components/data-display/InfoLabel.cjs +1 -1
- package/dist/components/data-display/InfoLabel.cjs.map +1 -1
- package/dist/components/data-display/InfoLabel.mjs +19 -18
- package/dist/components/data-display/InfoLabel.mjs.map +1 -1
- package/dist/components/feedback/MessageBarGroup.cjs +2 -0
- package/dist/components/feedback/MessageBarGroup.cjs.map +1 -0
- package/dist/components/feedback/MessageBarGroup.mjs +63 -0
- package/dist/components/feedback/MessageBarGroup.mjs.map +1 -0
- package/dist/components/feedback/ProgressBar.cjs +1 -1
- package/dist/components/feedback/ProgressBar.cjs.map +1 -1
- package/dist/components/feedback/ProgressBar.mjs +41 -39
- package/dist/components/feedback/ProgressBar.mjs.map +1 -1
- package/dist/components/feedback/Toaster.cjs +1 -1
- package/dist/components/feedback/Toaster.cjs.map +1 -1
- package/dist/components/feedback/Toaster.mjs +222 -216
- package/dist/components/feedback/Toaster.mjs.map +1 -1
- package/dist/components/layout/Accordion.cjs +1 -1
- package/dist/components/layout/Accordion.cjs.map +1 -1
- package/dist/components/layout/Accordion.mjs +124 -109
- package/dist/components/layout/Accordion.mjs.map +1 -1
- package/dist/components/layout/Carousel.cjs +1 -1
- package/dist/components/layout/Carousel.cjs.map +1 -1
- package/dist/components/layout/Carousel.mjs +207 -193
- package/dist/components/layout/Carousel.mjs.map +1 -1
- package/dist/components/layout/TabList.cjs +1 -1
- package/dist/components/layout/TabList.cjs.map +1 -1
- package/dist/components/layout/TabList.mjs +149 -108
- package/dist/components/layout/TabList.mjs.map +1 -1
- package/dist/components/layout/Tree.cjs.map +1 -1
- package/dist/components/layout/Tree.context.cjs +1 -1
- package/dist/components/layout/Tree.context.cjs.map +1 -1
- package/dist/components/layout/Tree.context.mjs +2 -1
- package/dist/components/layout/Tree.context.mjs.map +1 -1
- package/dist/components/layout/Tree.core.cjs +1 -1
- package/dist/components/layout/Tree.core.cjs.map +1 -1
- package/dist/components/layout/Tree.core.mjs +178 -165
- package/dist/components/layout/Tree.core.mjs.map +1 -1
- package/dist/components/layout/Tree.mjs.map +1 -1
- package/dist/components/navigation/Menu.popover.cjs +1 -1
- package/dist/components/navigation/Menu.popover.cjs.map +1 -1
- package/dist/components/navigation/Menu.popover.mjs +154 -168
- package/dist/components/navigation/Menu.popover.mjs.map +1 -1
- package/dist/components/navigation/Nav.cjs +1 -1
- package/dist/components/navigation/Nav.cjs.map +1 -1
- package/dist/components/navigation/Nav.mjs +156 -136
- package/dist/components/navigation/Nav.mjs.map +1 -1
- package/dist/components/navigation/NavDrawer.cjs +1 -1
- package/dist/components/navigation/NavDrawer.cjs.map +1 -1
- package/dist/components/navigation/NavDrawer.mjs +48 -45
- package/dist/components/navigation/NavDrawer.mjs.map +1 -1
- package/dist/components/overlays/Dialog.cjs +1 -1
- package/dist/components/overlays/Dialog.cjs.map +1 -1
- package/dist/components/overlays/Dialog.mjs +128 -122
- package/dist/components/overlays/Dialog.mjs.map +1 -1
- package/dist/components/overlays/Dialog.slots.cjs +1 -1
- package/dist/components/overlays/Dialog.slots.cjs.map +1 -1
- package/dist/components/overlays/Dialog.slots.mjs +12 -12
- package/dist/components/overlays/Dialog.slots.mjs.map +1 -1
- package/dist/components/overlays/Drawer.cjs.map +1 -1
- package/dist/components/overlays/Drawer.mjs.map +1 -1
- package/dist/components/overlays/Drawer.panel.cjs +1 -1
- package/dist/components/overlays/Drawer.panel.cjs.map +1 -1
- package/dist/components/overlays/Drawer.panel.mjs +97 -81
- package/dist/components/overlays/Drawer.panel.mjs.map +1 -1
- package/dist/components/overlays/Drawer.root.cjs +1 -1
- package/dist/components/overlays/Drawer.root.cjs.map +1 -1
- package/dist/components/overlays/Drawer.root.mjs +34 -31
- package/dist/components/overlays/Drawer.root.mjs.map +1 -1
- package/dist/components/overlays/Popover.cjs +1 -1
- package/dist/components/overlays/Popover.cjs.map +1 -1
- package/dist/components/overlays/Popover.mjs +231 -216
- package/dist/components/overlays/Popover.mjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.cjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.mjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.parts.cjs +1 -1
- package/dist/components/overlays/TeachingPopover.parts.cjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.parts.mjs +202 -173
- package/dist/components/overlays/TeachingPopover.parts.mjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.root.cjs +1 -1
- package/dist/components/overlays/TeachingPopover.root.cjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.root.mjs +108 -99
- package/dist/components/overlays/TeachingPopover.root.mjs.map +1 -1
- package/dist/components/overlays/Tooltip.cjs +1 -1
- package/dist/components/overlays/Tooltip.cjs.map +1 -1
- package/dist/components/overlays/Tooltip.mjs +66 -61
- package/dist/components/overlays/Tooltip.mjs.map +1 -1
- package/dist/components/provider/WaveProvider.cjs +1 -1
- package/dist/components/provider/WaveProvider.cjs.map +1 -1
- package/dist/components/provider/WaveProvider.mjs +26 -23
- package/dist/components/provider/WaveProvider.mjs.map +1 -1
- package/dist/hooks/useCollapsePresence.cjs +2 -0
- package/dist/hooks/useCollapsePresence.cjs.map +1 -0
- package/dist/hooks/useCollapsePresence.mjs +21 -0
- package/dist/hooks/useCollapsePresence.mjs.map +1 -0
- package/dist/hooks/useFocusBeforeClose.cjs +2 -0
- package/dist/hooks/useFocusBeforeClose.cjs.map +1 -0
- package/dist/hooks/useFocusBeforeClose.mjs +33 -0
- package/dist/hooks/useFocusBeforeClose.mjs.map +1 -0
- package/dist/hooks/useMotion.cjs +2 -0
- package/dist/hooks/useMotion.cjs.map +1 -0
- package/dist/hooks/useMotion.mjs +14 -0
- package/dist/hooks/useMotion.mjs.map +1 -0
- package/dist/hooks/usePresenceGroup.cjs +2 -0
- package/dist/hooks/usePresenceGroup.cjs.map +1 -0
- package/dist/hooks/usePresenceGroup.mjs +68 -0
- package/dist/hooks/usePresenceGroup.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +721 -131
- package/dist/index.d.ts +721 -131
- package/dist/index.mjs +136 -135
- package/dist/lib/classNames.cjs +1 -1
- package/dist/lib/classNames.cjs.map +1 -1
- package/dist/lib/classNames.mjs +101 -90
- package/dist/lib/classNames.mjs.map +1 -1
- package/dist/lib/motion.cjs +2 -0
- package/dist/lib/motion.cjs.map +1 -0
- package/dist/lib/motion.mjs +43 -0
- package/dist/lib/motion.mjs.map +1 -0
- package/dist/styles.css +1 -1
- package/package.json +2 -1
|
@@ -10,15 +10,18 @@ import { useControllable as h } from "../../hooks/useControllable.mjs";
|
|
|
10
10
|
import { useId as g } from "../../hooks/useId.mjs";
|
|
11
11
|
import { useRovingTabIndex as _ } from "../../hooks/useRovingTabIndex.mjs";
|
|
12
12
|
import { useMergedRefs as v } from "../../hooks/useMergedRefs.mjs";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
13
|
+
import { usePrefersReducedMotion as ee } from "../../hooks/usePrefersReducedMotion.mjs";
|
|
14
|
+
import { disabledStyles as te, focusRing as y, focusRingInset as b, forcedColors as x } from "../../lib/styles.mjs";
|
|
15
|
+
import { tabIndicatorMotion as S } from "../../lib/motion.mjs";
|
|
16
|
+
import { useMotionClasses as C } from "../../hooks/useMotion.mjs";
|
|
17
|
+
import { getPartId as w } from "./disclosureIds.mjs";
|
|
18
|
+
import * as T from "react";
|
|
19
|
+
import { jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
17
20
|
//#region src/components/layout/TabList.tsx
|
|
18
|
-
function
|
|
21
|
+
function O(e) {
|
|
19
22
|
o(`TabList:duplicate:${e}`, `TabList: several tabs share the value "${e}". Tab values must be unique within a TabList; tabs with the same value share one id and are selected (and tab stops) together.`);
|
|
20
23
|
}
|
|
21
|
-
function
|
|
24
|
+
function k() {
|
|
22
25
|
let e = {
|
|
23
26
|
tab: /* @__PURE__ */ new Map(),
|
|
24
27
|
panel: /* @__PURE__ */ new Map()
|
|
@@ -28,7 +31,7 @@ function O() {
|
|
|
28
31
|
return {
|
|
29
32
|
register(t, n, i) {
|
|
30
33
|
let a = e[t], o = a.get(n) ?? [];
|
|
31
|
-
return t === "tab" && o.length > 0 &&
|
|
34
|
+
return t === "tab" && o.length > 0 && O(n), a.set(n, [...o, i]), r(), () => {
|
|
32
35
|
let e = [...a.get(n) ?? []], t = e.indexOf(i);
|
|
33
36
|
t !== -1 && e.splice(t, 1), e.length > 0 ? a.set(n, e) : a.delete(n), r();
|
|
34
37
|
};
|
|
@@ -44,12 +47,12 @@ function O() {
|
|
|
44
47
|
}
|
|
45
48
|
};
|
|
46
49
|
}
|
|
47
|
-
var
|
|
50
|
+
var A = {
|
|
48
51
|
register: () => () => {},
|
|
49
52
|
get: () => void 0,
|
|
50
53
|
markReady: () => {},
|
|
51
54
|
subscribe: () => () => {}
|
|
52
|
-
},
|
|
55
|
+
}, j = T.createContext(null), M = {
|
|
53
56
|
orientation: "horizontal",
|
|
54
57
|
appearance: "transparent",
|
|
55
58
|
size: "medium",
|
|
@@ -59,83 +62,113 @@ var k = {
|
|
|
59
62
|
getGeneratedId: (e, t) => `wave-tablist-inert-${e}-${t}`,
|
|
60
63
|
getStaticTabId: (e) => `wave-tablist-inert-tab-${e}`,
|
|
61
64
|
getStaticPanelId: () => void 0,
|
|
62
|
-
registry:
|
|
65
|
+
registry: A,
|
|
66
|
+
indicator: null,
|
|
67
|
+
indicatorMotion: ""
|
|
63
68
|
};
|
|
64
|
-
function M(e) {
|
|
65
|
-
return w.useContext(A) || (r(e, "<TabList>"), j);
|
|
66
|
-
}
|
|
67
69
|
function N(e) {
|
|
70
|
+
return T.useContext(j) || (r(e, "<TabList>"), M);
|
|
71
|
+
}
|
|
72
|
+
function P(e) {
|
|
68
73
|
let t = e["aria-disabled"];
|
|
69
74
|
return e.disabled === !0 || t === !0 || t === "true";
|
|
70
75
|
}
|
|
71
|
-
function
|
|
76
|
+
function F(e) {
|
|
72
77
|
return typeof e == "string" && e !== "" ? e : null;
|
|
73
78
|
}
|
|
74
|
-
function
|
|
75
|
-
if (Array.isArray(e)) return e.forEach((e) =>
|
|
76
|
-
if (!
|
|
79
|
+
function I(e, t) {
|
|
80
|
+
if (Array.isArray(e)) return e.forEach((e) => I(e, t)), t;
|
|
81
|
+
if (!T.isValidElement(e)) return t;
|
|
77
82
|
let { props: r } = e, i = n(e, { suspend: !1 }), a = typeof r.value == "string" ? r.value : void 0;
|
|
78
83
|
if (i === W) {
|
|
79
84
|
if (a !== void 0) {
|
|
80
|
-
t.firstEnabled === void 0 && !
|
|
81
|
-
let e =
|
|
85
|
+
t.firstEnabled === void 0 && !P(r) && (t.firstEnabled = a);
|
|
86
|
+
let e = F(r.id);
|
|
82
87
|
e !== null && t.tabIds.push([a, e]);
|
|
83
88
|
}
|
|
84
89
|
return t;
|
|
85
90
|
}
|
|
86
|
-
return i === G ? (a !== void 0 && t.panels.push([a,
|
|
91
|
+
return i === G ? (a !== void 0 && t.panels.push([a, F(r.id)]), t) : i === B ? t : I(r.children, t);
|
|
87
92
|
}
|
|
88
|
-
function
|
|
89
|
-
if (Array.isArray(e)) return e.some((e) =>
|
|
90
|
-
if (!
|
|
93
|
+
function L(e, t) {
|
|
94
|
+
if (Array.isArray(e)) return e.some((e) => L(e, t));
|
|
95
|
+
if (!T.isValidElement(e)) return !1;
|
|
91
96
|
let r = n(e, { suspend: !1 });
|
|
92
|
-
return r === W ? t === "tab" : r === G || r === K ? t === "panel" : r !==
|
|
97
|
+
return r === W ? t === "tab" : r === G || r === K ? t === "panel" : r !== B && L(e.props.children, t);
|
|
93
98
|
}
|
|
94
|
-
function
|
|
95
|
-
return
|
|
99
|
+
function ne(e) {
|
|
100
|
+
return L(e, "panel") && !L(e, "tab");
|
|
96
101
|
}
|
|
97
|
-
var
|
|
98
|
-
let
|
|
102
|
+
var R = T.createContext(null), z = "TabList.Panel was rendered inside the role=\"tablist\" element, where only tabs belong (axe aria-required-children). The TabList moves a Panel after the tablist when it is its child, or in a wrapper that holds no Tab, but it cannot see a Panel that a component renders itself, or separate a wrapper's Panels from its Tabs. Place such panels inside TabList.Panels, which renders after the tablist.", B = ({ value: n, defaultValue: r, onValueChange: o, orientation: s, appearance: c = "transparent", size: d = "medium", selectTabOnFocus: f = !0, motion: p, selectedValue: te, defaultSelectedValue: y, onTabSelect: b, vertical: x, className: O, children: A, onKeyDown: M, onFocus: N, ref: P, ...F }) => {
|
|
103
|
+
let L = i("TabList", n, te, "selectedValue", "value"), z = i("TabList", r, y, "defaultSelectedValue", "defaultValue"), B = i("TabList", s, x === void 0 ? void 0 : x ? "vertical" : "horizontal", "vertical", "orientation") ?? "horizontal";
|
|
99
104
|
b && a("TabList", "onTabSelect", "onValueChange", "`onValueChange` is called only when the selected tab changes.");
|
|
100
|
-
let [
|
|
105
|
+
let [V, re, ie] = h(L, z ?? "", o), H = JSON.stringify(I(A, {
|
|
101
106
|
tabIds: [],
|
|
102
107
|
panels: []
|
|
103
|
-
})), U =
|
|
108
|
+
})), U = T.useMemo(() => {
|
|
104
109
|
let e = JSON.parse(H);
|
|
105
110
|
return {
|
|
106
111
|
firstEnabled: e.firstEnabled,
|
|
107
112
|
tabIds: new Map(e.tabIds),
|
|
108
113
|
panels: new Map(e.panels)
|
|
109
114
|
};
|
|
110
|
-
}, [H]), W = !
|
|
111
|
-
activeValue: W ? U.firstEnabled ?? null :
|
|
112
|
-
orientation:
|
|
115
|
+
}, [H]), W = !ie && V === "", { containerProps: G, getTabIndex: K } = _({
|
|
116
|
+
activeValue: W ? U.firstEnabled ?? null : V,
|
|
117
|
+
orientation: B,
|
|
113
118
|
loop: !0,
|
|
114
119
|
onFocusMove: f ? (e) => J(e) : void 0
|
|
115
|
-
}), q =
|
|
120
|
+
}), q = T.useCallback((e) => W ? K(e) === 0 : V === e, [
|
|
116
121
|
W,
|
|
117
122
|
K,
|
|
118
|
-
|
|
123
|
+
V
|
|
119
124
|
]), J = m((e) => {
|
|
120
|
-
b?.(e), q(e) ||
|
|
121
|
-
}), Y = g("tablist"), [X] =
|
|
122
|
-
|
|
123
|
-
let
|
|
124
|
-
|
|
125
|
+
b?.(e), q(e) || re(e);
|
|
126
|
+
}), Y = g("tablist"), [X] = T.useState(k);
|
|
127
|
+
T.useLayoutEffect(() => X.markReady(), [X]);
|
|
128
|
+
let Z = B === "vertical", Q = C(p, S), ae = ee(), oe = c === "transparent" && Q !== "" && !ae, [$, se] = T.useState(null), ce = T.useRef(null), le = T.useRef(null);
|
|
129
|
+
T.useLayoutEffect(() => {
|
|
130
|
+
let e = ce.current;
|
|
131
|
+
if (!e) return;
|
|
132
|
+
let t = Array.from(e.querySelectorAll("[role=\"tab\"]")), n = (e) => e.getAttribute("data-roving-value"), r = t.find((e) => {
|
|
133
|
+
let t = n(e);
|
|
134
|
+
return t !== null && q(t);
|
|
135
|
+
}), i = r ? n(r) : null, a = le.current;
|
|
136
|
+
if (le.current = i, !oe || !r || i === null || a === null || i === a) return;
|
|
137
|
+
let o = t.find((e) => n(e) === a);
|
|
138
|
+
if (!o) return;
|
|
139
|
+
let s = o.getBoundingClientRect(), c = r.getBoundingClientRect(), l = Z ? c.height : c.width;
|
|
140
|
+
l !== 0 && se({
|
|
141
|
+
value: i,
|
|
142
|
+
offset: Z ? s.top - c.top : s.left - c.left,
|
|
143
|
+
scale: (Z ? s.height : s.width) / l
|
|
144
|
+
});
|
|
145
|
+
}, [
|
|
146
|
+
q,
|
|
147
|
+
oe,
|
|
148
|
+
Z
|
|
149
|
+
]), T.useEffect(() => {
|
|
150
|
+
if (!$) return;
|
|
151
|
+
let e = requestAnimationFrame(() => se(null));
|
|
152
|
+
return () => cancelAnimationFrame(e);
|
|
153
|
+
}, [$]);
|
|
154
|
+
let ue = T.useMemo(() => ({
|
|
155
|
+
orientation: B,
|
|
125
156
|
appearance: c,
|
|
126
157
|
size: d,
|
|
127
158
|
isSelected: q,
|
|
128
159
|
select: J,
|
|
129
160
|
getTabIndex: K,
|
|
130
|
-
getGeneratedId: (e, t) =>
|
|
131
|
-
getStaticTabId: (e) => U.tabIds.get(e) ??
|
|
161
|
+
getGeneratedId: (e, t) => w(Y, e, t),
|
|
162
|
+
getStaticTabId: (e) => U.tabIds.get(e) ?? w(Y, "tab", e),
|
|
132
163
|
getStaticPanelId: (e) => {
|
|
133
164
|
let t = U.panels.get(e);
|
|
134
|
-
if (t !== void 0) return t ??
|
|
165
|
+
if (t !== void 0) return t ?? w(Y, "panel", e);
|
|
135
166
|
},
|
|
136
|
-
registry: X
|
|
167
|
+
registry: X,
|
|
168
|
+
indicator: $,
|
|
169
|
+
indicatorMotion: Q
|
|
137
170
|
}), [
|
|
138
|
-
|
|
171
|
+
B,
|
|
139
172
|
c,
|
|
140
173
|
d,
|
|
141
174
|
q,
|
|
@@ -143,115 +176,123 @@ var L = w.createContext(null), R = "TabList.Panel was rendered inside the role=\
|
|
|
143
176
|
K,
|
|
144
177
|
Y,
|
|
145
178
|
U,
|
|
146
|
-
X
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
value:
|
|
155
|
-
children: /* @__PURE__ */
|
|
156
|
-
className: e(
|
|
157
|
-
children: [/* @__PURE__ */
|
|
179
|
+
X,
|
|
180
|
+
$,
|
|
181
|
+
Q
|
|
182
|
+
]), de = v(P, G.ref, ce), fe = [], pe = [];
|
|
183
|
+
return t(A).forEach(({ key: e, node: t }) => {
|
|
184
|
+
let n = /* @__PURE__ */ E(T.Fragment, { children: t }, e);
|
|
185
|
+
(ne(t) ? pe : fe).push(n);
|
|
186
|
+
}), /* @__PURE__ */ E(j.Provider, {
|
|
187
|
+
value: ue,
|
|
188
|
+
children: /* @__PURE__ */ D("div", {
|
|
189
|
+
className: e(Z && "flex"),
|
|
190
|
+
children: [/* @__PURE__ */ E("div", {
|
|
158
191
|
role: "tablist",
|
|
159
|
-
"aria-orientation":
|
|
192
|
+
"aria-orientation": B,
|
|
160
193
|
"data-appearance": c,
|
|
161
194
|
"data-size": d,
|
|
162
|
-
"data-orientation":
|
|
163
|
-
className: e(u.root,
|
|
164
|
-
...
|
|
195
|
+
"data-orientation": B,
|
|
196
|
+
className: e(u.root, Z ? "flex w-40 flex-col" : "flex", c === "transparent" ? Z ? "border-e border-border" : "border-b border-border" : "gap-1", O),
|
|
197
|
+
...F,
|
|
165
198
|
"data-roving-container": "",
|
|
166
|
-
onKeyDown: l(
|
|
167
|
-
onFocus: l(
|
|
168
|
-
ref:
|
|
169
|
-
children: /* @__PURE__ */
|
|
199
|
+
onKeyDown: l(M, G.onKeyDown),
|
|
200
|
+
onFocus: l(N, G.onFocus, { checkDefaultPrevented: !1 }),
|
|
201
|
+
ref: de,
|
|
202
|
+
children: /* @__PURE__ */ E(R.Provider, {
|
|
170
203
|
value: "tabs",
|
|
171
|
-
children:
|
|
204
|
+
children: fe
|
|
172
205
|
})
|
|
173
|
-
}), /* @__PURE__ */
|
|
206
|
+
}), /* @__PURE__ */ E(R.Provider, {
|
|
174
207
|
value: "panels",
|
|
175
|
-
children:
|
|
208
|
+
children: pe
|
|
176
209
|
})]
|
|
177
210
|
})
|
|
178
211
|
});
|
|
179
212
|
};
|
|
180
|
-
|
|
181
|
-
var
|
|
213
|
+
B.displayName = "TabList";
|
|
214
|
+
var V = {
|
|
182
215
|
small: "px-3 py-1.5",
|
|
183
216
|
medium: "px-4 py-2",
|
|
184
217
|
large: "px-5 py-3"
|
|
185
|
-
},
|
|
218
|
+
}, re = {
|
|
186
219
|
small: "p-1.5",
|
|
187
220
|
medium: "p-2",
|
|
188
221
|
large: "p-3"
|
|
189
|
-
},
|
|
222
|
+
}, ie = {
|
|
190
223
|
small: "text-caption-1",
|
|
191
224
|
medium: "text-body-1",
|
|
192
225
|
large: "text-body-2"
|
|
226
|
+
}, H = {
|
|
227
|
+
horizontal: "relative border-b-2 border-b-transparent after:absolute after:inset-x-0 after:-bottom-0.5 after:border-b-2 after:border-b-primary after:origin-left after:translate-x-[var(--wave-tab-indicator-offset,0px)] after:scale-x-[var(--wave-tab-indicator-scale,1)] forced-colors:after:border-[Highlight]",
|
|
228
|
+
vertical: "relative border-s-2 border-s-transparent after:absolute after:inset-y-0 after:-start-0.5 after:border-s-2 after:border-s-primary after:origin-top after:translate-y-[var(--wave-tab-indicator-offset,0px)] after:scale-y-[var(--wave-tab-indicator-scale,1)] forced-colors:after:border-[Highlight]"
|
|
193
229
|
};
|
|
194
230
|
function U(t, n, r) {
|
|
195
231
|
switch (t) {
|
|
196
232
|
case "subtle":
|
|
197
233
|
case "subtle-circular": {
|
|
198
234
|
let r = t === "subtle" ? "rounded-md" : "rounded-full";
|
|
199
|
-
return n ? e(r, "bg-subtle-selected text-foreground",
|
|
235
|
+
return n ? e(r, "bg-subtle-selected text-foreground", x.selectedContainer) : e(r, "text-muted-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover not-disabled:not-aria-disabled:hover:text-foreground not-disabled:not-aria-disabled:active:bg-subtle-pressed");
|
|
200
236
|
}
|
|
201
|
-
case "filled-circular": return n ? e("rounded-full bg-primary text-primary-foreground not-disabled:not-aria-disabled:hover:bg-primary-hover not-disabled:not-aria-disabled:active:bg-primary-pressed",
|
|
202
|
-
default: return
|
|
237
|
+
case "filled-circular": return n ? e("rounded-full bg-primary text-primary-foreground not-disabled:not-aria-disabled:hover:bg-primary-hover not-disabled:not-aria-disabled:active:bg-primary-pressed", x.selectedContainer) : "rounded-full bg-muted text-muted-foreground not-disabled:not-aria-disabled:hover:bg-muted-hover not-disabled:not-aria-disabled:hover:text-foreground not-disabled:not-aria-disabled:active:bg-muted-pressed";
|
|
238
|
+
default: return e("border-transparent forced-colors:border-[Canvas]", n ? e("text-primary", H[r ? "vertical" : "horizontal"]) : "text-muted-foreground not-disabled:not-aria-disabled:hover:text-foreground");
|
|
203
239
|
}
|
|
204
240
|
}
|
|
205
|
-
var W = ({ value: t, id: n, icon: r, className: i,
|
|
206
|
-
let
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
241
|
+
var W = ({ value: t, id: n, icon: r, className: i, style: a, children: u, onClick: d, ref: f, ...m }) => {
|
|
242
|
+
let h = N("TabList.Tab"), g = h.isSelected(t), _ = h.orientation === "vertical", v = g && h.indicator?.value === t ? h.indicator : null, ee = g && h.appearance === "transparent" && !v ? h.indicatorMotion : void 0, y = v ? {
|
|
243
|
+
...a,
|
|
244
|
+
"--wave-tab-indicator-offset": `${v.offset}px`,
|
|
245
|
+
"--wave-tab-indicator-scale": String(v.scale)
|
|
246
|
+
} : a, x = P(m), S = !!r && c(r), C = S && !c(u), w = m["aria-label"], E = m["aria-labelledby"], O = typeof w == "string" && w.trim() !== "" || typeof E == "string" && E.trim() !== "";
|
|
247
|
+
T.useEffect(() => {
|
|
248
|
+
C && !O && o("TabList.Tab:icon-only-name", "TabList.Tab: a tab with an icon and no text has no accessible name. Pass `aria-label` (or `aria-labelledby`).");
|
|
249
|
+
}, [C, O]);
|
|
250
|
+
let { registry: k } = h, A = F(n) ?? h.getGeneratedId("tab", t);
|
|
251
|
+
T.useLayoutEffect(() => k.register("tab", t, A), [
|
|
252
|
+
k,
|
|
213
253
|
t,
|
|
214
|
-
|
|
254
|
+
A
|
|
215
255
|
]);
|
|
216
|
-
let
|
|
217
|
-
return /* @__PURE__ */
|
|
256
|
+
let j = T.useSyncExternalStore(k.subscribe, () => k.get("panel", t), () => void 0), M = j === void 0 ? h.getStaticPanelId(t) : j ?? void 0;
|
|
257
|
+
return /* @__PURE__ */ D("button", {
|
|
218
258
|
type: "button",
|
|
219
259
|
role: "tab",
|
|
220
|
-
className: e(p.root, "font-semibold transition-colors motion-reduce:transition-none",
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
"aria-
|
|
225
|
-
|
|
260
|
+
className: e(p.root, "font-semibold transition-colors motion-reduce:transition-none", C ? re[h.size] : V[h.size], ie[h.size], S && "inline-flex items-center justify-center gap-2", _ && "text-start", U(h.appearance, g, _), te, b, ee, i),
|
|
261
|
+
style: y,
|
|
262
|
+
...m,
|
|
263
|
+
id: A,
|
|
264
|
+
"aria-selected": g,
|
|
265
|
+
"aria-controls": g ? M : void 0,
|
|
266
|
+
tabIndex: h.getTabIndex(t),
|
|
226
267
|
"data-roving-value": t,
|
|
227
|
-
"data-selected":
|
|
228
|
-
"data-icon-only":
|
|
229
|
-
onClick: l(
|
|
230
|
-
|
|
268
|
+
"data-selected": g ? "" : void 0,
|
|
269
|
+
"data-icon-only": C ? "" : void 0,
|
|
270
|
+
onClick: l(d, () => {
|
|
271
|
+
x || h.select(t);
|
|
231
272
|
}),
|
|
232
|
-
ref:
|
|
233
|
-
children: [
|
|
273
|
+
ref: f,
|
|
274
|
+
children: [S && s(r, "span", p.icon, { "aria-hidden": !0 }), u]
|
|
234
275
|
});
|
|
235
276
|
};
|
|
236
277
|
W.displayName = "Tab";
|
|
237
278
|
var G = ({ value: t, id: n, children: r, className: i, ref: a, ...s }) => {
|
|
238
|
-
let c =
|
|
239
|
-
|
|
240
|
-
l && o("TabList.Panel:inside-tablist",
|
|
279
|
+
let c = N("TabList.Panel"), l = T.useContext(R) === "tabs";
|
|
280
|
+
T.useEffect(() => {
|
|
281
|
+
l && o("TabList.Panel:inside-tablist", z);
|
|
241
282
|
}, [l]);
|
|
242
|
-
let { registry: u } = c, f =
|
|
243
|
-
|
|
283
|
+
let { registry: u } = c, f = F(n) ?? c.getGeneratedId("panel", t);
|
|
284
|
+
T.useLayoutEffect(() => u.register("panel", t, f), [
|
|
244
285
|
u,
|
|
245
286
|
t,
|
|
246
287
|
f
|
|
247
288
|
]);
|
|
248
|
-
let p =
|
|
289
|
+
let p = T.useSyncExternalStore(u.subscribe, () => u.get("tab", t), () => void 0);
|
|
249
290
|
if (!c.isSelected(t)) return null;
|
|
250
291
|
let m = p === void 0 ? c.getStaticTabId(t) : p ?? void 0;
|
|
251
|
-
return /* @__PURE__ */
|
|
292
|
+
return /* @__PURE__ */ E("div", {
|
|
252
293
|
role: "tabpanel",
|
|
253
294
|
tabIndex: 0,
|
|
254
|
-
className: e(d.root, "p-4",
|
|
295
|
+
className: e(d.root, "p-4", y, i),
|
|
255
296
|
...s,
|
|
256
297
|
id: f,
|
|
257
298
|
"aria-labelledby": m,
|
|
@@ -260,14 +301,14 @@ var G = ({ value: t, id: n, children: r, className: i, ref: a, ...s }) => {
|
|
|
260
301
|
});
|
|
261
302
|
};
|
|
262
303
|
G.displayName = "TabPanel";
|
|
263
|
-
var K = ({ className: t, children: n, ref: r, ...i }) => /* @__PURE__ */
|
|
304
|
+
var K = ({ className: t, children: n, ref: r, ...i }) => /* @__PURE__ */ E("div", {
|
|
264
305
|
ref: r,
|
|
265
306
|
className: e(f.root, "min-w-0 flex-1", t),
|
|
266
307
|
...i,
|
|
267
308
|
children: n
|
|
268
309
|
});
|
|
269
310
|
K.displayName = "TabPanels";
|
|
270
|
-
var q = /* @__PURE__ */ Object.assign(
|
|
311
|
+
var q = /* @__PURE__ */ Object.assign(B, {
|
|
271
312
|
Tab: W,
|
|
272
313
|
Panel: G,
|
|
273
314
|
Panels: K
|