@alfadocs/ui-kit 1.41.1 → 1.43.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/_chunks/{calendar-workspace-Bx8xxvic.js → calendar-workspace-DhXqqu-D.js} +1981 -1968
- package/dist/_chunks/control-room-rail-Cv7GpMqX.js +354 -0
- package/dist/_chunks/{marketplace-app-shell-D_g9BaDI.js → marketplace-app-shell-DdwPj03y.js} +3 -3
- package/dist/_chunks/{notes-panel-Daq5T_cS.js → notes-panel-CRAovkjx.js} +84 -68
- package/dist/_chunks/{sidebar-ClTY9lLI.js → sidebar-DbZXLl8h.js} +2 -2
- package/dist/_chunks/tab-bar-Cw9UK18Z.js +228 -0
- package/dist/_chunks/{tool-rail-D89USYE6.js → tool-rail-CCFqDfAn.js} +282 -276
- package/dist/_chunks/use-edge-resize-BHesP0kg.js +149 -0
- package/dist/_chunks/use-scroll-overflow-UbLrUfBo.js +72 -0
- package/dist/agent-catalog.json +1 -1
- package/dist/components/control-room-rail/control-room-rail.d.ts +9 -0
- package/dist/components/control-room-rail/index.js +1 -1
- package/dist/components/notes-panel/index.js +1 -1
- package/dist/components/notes-panel/notes-panel.d.ts +32 -0
- package/dist/components/sidebar/index.js +1 -1
- package/dist/components/tab-bar/index.js +1 -1
- package/dist/components/tool-rail/index.js +1 -1
- package/dist/components/tool-rail/tool-rail.d.ts +16 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +35 -32
- package/dist/hooks/use-edge-resize.d.ts +13 -1
- package/dist/index.js +6 -6
- package/dist/patterns/calendar/calendar.journey.d.ts +11 -0
- package/dist/patterns/calendar/calendar.sheets.d.ts +20 -0
- package/dist/patterns/calendar/index.js +1 -1
- package/dist/patterns/marketplace-app-shell/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/control-room-rail-CnNZusR5.js +0 -337
- package/dist/_chunks/tab-bar-rDkLiaA6.js +0 -268
- package/dist/_chunks/use-edge-resize-ZnGG7gyO.js +0 -139
- package/dist/_chunks/use-overflow-collapse-BIOzKbni.js +0 -32
package/package.json
CHANGED
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
import { jsx as h, jsxs as D, Fragment as lo } from "react/jsx-runtime";
|
|
2
|
-
import { useState as _, useCallback as g, useMemo as T, useRef as B, useContext as H, useId as io, useEffect as ao, createContext as co, forwardRef as uo } from "react";
|
|
3
|
-
import { useTranslation as po } from "react-i18next";
|
|
4
|
-
import { I as G } from "./icon-button-CehAeZoP.js";
|
|
5
|
-
import { a as fo } from "./panel-header-D_mTdhUp.js";
|
|
6
|
-
import { T as mo } from "./tool-rail-D89USYE6.js";
|
|
7
|
-
import { u as go } from "./use-persistent-state-nZwZAnE9.js";
|
|
8
|
-
import { S as Ro } from "./star-Bf9L2Uot.js";
|
|
9
|
-
import { X as vo } from "./x-B5YnXwCz.js";
|
|
10
|
-
const ho = {
|
|
11
|
-
id: "control-room-rail",
|
|
12
|
-
capabilities: ["open", "close", "select_single"],
|
|
13
|
-
state: {
|
|
14
|
-
activeToolId: {
|
|
15
|
-
type: "string | null",
|
|
16
|
-
descriptionKey: "ui.toolRail.agent.state.activeToolId",
|
|
17
|
-
description: "Id of the tool whose panel is currently open, or null when the rail is collapsed to its strip. No panel content is ever exposed.",
|
|
18
|
-
read: (t) => t.getActiveToolId()
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
actions: {
|
|
22
|
-
open: {
|
|
23
|
-
// Pure ephemeral panel state (open) — no data loss, no external effect.
|
|
24
|
-
safety: "read",
|
|
25
|
-
argsType: "{ id: string }",
|
|
26
|
-
argsSchema: {
|
|
27
|
-
type: "object",
|
|
28
|
-
properties: { id: { type: "string" } },
|
|
29
|
-
required: ["id"]
|
|
30
|
-
},
|
|
31
|
-
idempotent: !0,
|
|
32
|
-
descriptionKey: "ui.toolRail.agent.actions.open",
|
|
33
|
-
description: "Open the given tool's panel.",
|
|
34
|
-
examples: [{ args: { id: "inbox" }, note: "Open the inbox tool panel." }],
|
|
35
|
-
invoke: (t, n) => {
|
|
36
|
-
t.open(n.id);
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
close: {
|
|
40
|
-
safety: "read",
|
|
41
|
-
idempotent: !0,
|
|
42
|
-
descriptionKey: "ui.toolRail.agent.actions.close",
|
|
43
|
-
description: "Collapse the rail to its strip (no active tool).",
|
|
44
|
-
invoke: (t) => {
|
|
45
|
-
t.close();
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
select_tool: {
|
|
49
|
-
safety: "read",
|
|
50
|
-
argsType: "{ id: string | null }",
|
|
51
|
-
argsSchema: {
|
|
52
|
-
type: "object",
|
|
53
|
-
properties: { id: { type: ["string", "null"] } },
|
|
54
|
-
required: ["id"]
|
|
55
|
-
},
|
|
56
|
-
idempotent: !0,
|
|
57
|
-
descriptionKey: "ui.toolRail.agent.actions.selectTool",
|
|
58
|
-
description: "Set the active tool by id (opens its panel), or pass null to collapse.",
|
|
59
|
-
invoke: (t, n) => {
|
|
60
|
-
t.setActiveTool(n.id);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
domHooks: {
|
|
65
|
-
root: {
|
|
66
|
-
attr: "data-component",
|
|
67
|
-
value: "control-room-rail",
|
|
68
|
-
description: "Marks the ControlRoomRail wrapper."
|
|
69
|
-
},
|
|
70
|
-
instanceId: {
|
|
71
|
-
attr: "data-component-id",
|
|
72
|
-
sourceProp: "id",
|
|
73
|
-
description: "Sourced from the id prop. Required to address a specific rail from the agent."
|
|
74
|
-
},
|
|
75
|
-
item: {
|
|
76
|
-
attr: "data-tool-id",
|
|
77
|
-
description: "Stable tool id emitted on each strip IconButton. The active icon also carries data-active set to its id."
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}, S = co(null);
|
|
81
|
-
function jo({
|
|
82
|
-
globalTools: t = [],
|
|
83
|
-
children: n
|
|
84
|
-
}) {
|
|
85
|
-
const [u, s] = _(
|
|
86
|
-
() => /* @__PURE__ */ new Map()
|
|
87
|
-
), p = g(
|
|
88
|
-
(i, l) => {
|
|
89
|
-
s((a) => {
|
|
90
|
-
const M = new Map(a);
|
|
91
|
-
return M.set(i, l), M;
|
|
92
|
-
});
|
|
93
|
-
},
|
|
94
|
-
[]
|
|
95
|
-
), P = g((i) => {
|
|
96
|
-
s((l) => {
|
|
97
|
-
if (!l.has(i)) return l;
|
|
98
|
-
const a = new Map(l);
|
|
99
|
-
return a.delete(i), a;
|
|
100
|
-
});
|
|
101
|
-
}, []), f = T(
|
|
102
|
-
() => Array.from(u.values()).flat(),
|
|
103
|
-
[u]
|
|
104
|
-
), v = B(null), k = g((i) => {
|
|
105
|
-
v.current = i;
|
|
106
|
-
}, []), m = g((i) => {
|
|
107
|
-
var l;
|
|
108
|
-
(l = v.current) == null || l.setActiveTool(i);
|
|
109
|
-
}, []), b = g(() => {
|
|
110
|
-
var i;
|
|
111
|
-
(i = v.current) == null || i.setActiveTool(null);
|
|
112
|
-
}, []), y = T(
|
|
113
|
-
() => ({
|
|
114
|
-
globalTools: t,
|
|
115
|
-
contextualTools: f,
|
|
116
|
-
registerContextualTools: p,
|
|
117
|
-
unregisterContextualTools: P,
|
|
118
|
-
registerRail: k,
|
|
119
|
-
openTool: m,
|
|
120
|
-
closeTool: b
|
|
121
|
-
}),
|
|
122
|
-
[
|
|
123
|
-
t,
|
|
124
|
-
f,
|
|
125
|
-
p,
|
|
126
|
-
P,
|
|
127
|
-
k,
|
|
128
|
-
m,
|
|
129
|
-
b
|
|
130
|
-
]
|
|
131
|
-
);
|
|
132
|
-
return /* @__PURE__ */ h(S.Provider, { value: y, children: n });
|
|
133
|
-
}
|
|
134
|
-
function Ho(t) {
|
|
135
|
-
const n = H(S), u = n == null ? void 0 : n.registerContextualTools, s = n == null ? void 0 : n.unregisterContextualTools, p = io();
|
|
136
|
-
ao(() => {
|
|
137
|
-
if (!(!u || !s))
|
|
138
|
-
return u(p, t), () => s(p);
|
|
139
|
-
}, [u, s, p, t]);
|
|
140
|
-
}
|
|
141
|
-
function To() {
|
|
142
|
-
const t = H(S);
|
|
143
|
-
return T(() => {
|
|
144
|
-
if (!t) return [];
|
|
145
|
-
const n = t.contextualTools.map((s) => ({
|
|
146
|
-
...s,
|
|
147
|
-
scope: "contextual"
|
|
148
|
-
})), u = t.globalTools.map((s) => ({
|
|
149
|
-
...s,
|
|
150
|
-
scope: "global"
|
|
151
|
-
}));
|
|
152
|
-
return [...n, ...u];
|
|
153
|
-
}, [t]);
|
|
154
|
-
}
|
|
155
|
-
function Ko() {
|
|
156
|
-
const t = H(S), n = g(() => {
|
|
157
|
-
}, []);
|
|
158
|
-
return {
|
|
159
|
-
openTool: (t == null ? void 0 : t.openTool) ?? n,
|
|
160
|
-
closeTool: (t == null ? void 0 : t.closeTool) ?? n
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
function yo() {
|
|
164
|
-
const t = H(S), n = g((u) => {
|
|
165
|
-
}, []);
|
|
166
|
-
return (t == null ? void 0 : t.registerRail) ?? n;
|
|
167
|
-
}
|
|
168
|
-
const qo = uo(function({
|
|
169
|
-
tools: n,
|
|
170
|
-
railLabel: u,
|
|
171
|
-
reorderable: s = !0,
|
|
172
|
-
favoriteIds: p,
|
|
173
|
-
defaultFavoriteIds: P,
|
|
174
|
-
pinnedFavoriteIds: f,
|
|
175
|
-
onFavoriteIdsChange: v,
|
|
176
|
-
persistFavoritesKey: k = "ui.controlRoom.favorites",
|
|
177
|
-
activeToolId: m,
|
|
178
|
-
defaultActiveToolId: b = null,
|
|
179
|
-
onActiveToolChange: y,
|
|
180
|
-
...i
|
|
181
|
-
}, l) {
|
|
182
|
-
const { t: a } = po(), [M, J] = _(
|
|
183
|
-
m ?? b ?? null
|
|
184
|
-
), L = m !== void 0 ? m : M, Q = g(
|
|
185
|
-
(o) => {
|
|
186
|
-
m === void 0 && J(o), y == null || y(o);
|
|
187
|
-
},
|
|
188
|
-
[m, y]
|
|
189
|
-
), U = To(), C = n ?? U, K = p !== void 0, [W, Y] = go(
|
|
190
|
-
k,
|
|
191
|
-
() => P ?? C.filter((o) => o.scope === "global").map((o) => o.id),
|
|
192
|
-
{ disabled: K }
|
|
193
|
-
), q = K ? p : W, A = T(() => f != null && f.length ? [
|
|
194
|
-
...f,
|
|
195
|
-
...q.filter((o) => !f.includes(o))
|
|
196
|
-
] : q, [f, q]), d = T(() => {
|
|
197
|
-
const o = /* @__PURE__ */ new Map();
|
|
198
|
-
for (const r of C) o.set(r.id, r);
|
|
199
|
-
return o;
|
|
200
|
-
}, [C]), w = T(
|
|
201
|
-
() => new Set(A.filter((o) => d.has(o))),
|
|
202
|
-
[A, d]
|
|
203
|
-
), O = (o) => {
|
|
204
|
-
const r = o(A.filter((e) => d.has(e)));
|
|
205
|
-
K || Y((e) => o(e.filter((c) => d.has(c)))), v == null || v(r);
|
|
206
|
-
}, E = T(() => {
|
|
207
|
-
if (!s) return C;
|
|
208
|
-
const o = A.filter((e) => d.has(e)).map((e) => ({
|
|
209
|
-
...d.get(e),
|
|
210
|
-
scope: "global",
|
|
211
|
-
reorderable: !0
|
|
212
|
-
})), r = C.filter((e) => !w.has(e.id)).map((e) => ({
|
|
213
|
-
...e,
|
|
214
|
-
scope: "contextual",
|
|
215
|
-
reorderable: !0
|
|
216
|
-
}));
|
|
217
|
-
return [...o, ...r];
|
|
218
|
-
}, [s, C, A, d, w]), [Z, F] = _(""), z = B(!1), I = (o, r) => {
|
|
219
|
-
const e = r ? a("controlRoom.pinnedAnnounce", {
|
|
220
|
-
tool: o,
|
|
221
|
-
defaultValue: "Pinned {{tool}} to favourites"
|
|
222
|
-
}) : a("controlRoom.unpinnedAnnounce", {
|
|
223
|
-
tool: o,
|
|
224
|
-
defaultValue: "Removed {{tool}} from favourites"
|
|
225
|
-
});
|
|
226
|
-
z.current = !z.current, F(z.current ? e : `${e}`);
|
|
227
|
-
}, oo = (o) => {
|
|
228
|
-
var r;
|
|
229
|
-
I(((r = d.get(o)) == null ? void 0 : r.label) ?? o, !w.has(o)), O(
|
|
230
|
-
(e) => e.includes(o) ? e.filter((c) => c !== o) : [...e, o]
|
|
231
|
-
);
|
|
232
|
-
}, to = (o, r) => {
|
|
233
|
-
var c;
|
|
234
|
-
const e = (c = E[o]) == null ? void 0 : c.id;
|
|
235
|
-
e !== void 0 && O((x) => {
|
|
236
|
-
const V = x.filter((R) => d.has(R)), j = V.length;
|
|
237
|
-
if (o < j) {
|
|
238
|
-
if (r >= j) return V.filter((so) => so !== e);
|
|
239
|
-
const R = V.slice();
|
|
240
|
-
return R.splice(o, 1), R.splice(r, 0, e), R;
|
|
241
|
-
}
|
|
242
|
-
if (r <= j) {
|
|
243
|
-
const R = V.slice();
|
|
244
|
-
return R.splice(Math.min(r, j), 0, e), R;
|
|
245
|
-
}
|
|
246
|
-
return x;
|
|
247
|
-
});
|
|
248
|
-
}, eo = ({
|
|
249
|
-
tool: o,
|
|
250
|
-
from: r,
|
|
251
|
-
to: e
|
|
252
|
-
}) => {
|
|
253
|
-
const c = w.size, x = r < c;
|
|
254
|
-
return x && e >= c ? a("controlRoom.unpinnedAnnounce", {
|
|
255
|
-
tool: o.label,
|
|
256
|
-
defaultValue: "Removed {{tool}} from favourites"
|
|
257
|
-
}) : !x && e <= c ? a("controlRoom.pinnedAnnounce", {
|
|
258
|
-
tool: o.label,
|
|
259
|
-
defaultValue: "Pinned {{tool}} to favourites"
|
|
260
|
-
}) : x && e < c ? a("controlRoom.reorderAnnounce", {
|
|
261
|
-
tool: o.label,
|
|
262
|
-
to: e + 1,
|
|
263
|
-
total: c,
|
|
264
|
-
defaultValue: "{{tool}} moved to position {{to}} of {{total}}"
|
|
265
|
-
}) : "";
|
|
266
|
-
}, X = B(null), $ = yo(), no = g(
|
|
267
|
-
(o) => {
|
|
268
|
-
X.current = o, $(o), typeof l == "function" ? l(o) : l && (l.current = o);
|
|
269
|
-
},
|
|
270
|
-
[$, l]
|
|
271
|
-
), N = L != null ? d.get(L) ?? null : null, ro = N ? /* @__PURE__ */ D(lo, { children: [
|
|
272
|
-
s ? (() => {
|
|
273
|
-
const o = w.has(N.id);
|
|
274
|
-
return /* @__PURE__ */ h(
|
|
275
|
-
G,
|
|
276
|
-
{
|
|
277
|
-
icon: /* @__PURE__ */ h(
|
|
278
|
-
Ro,
|
|
279
|
-
{
|
|
280
|
-
"aria-hidden": "true",
|
|
281
|
-
fill: o ? "currentColor" : "none",
|
|
282
|
-
className: o ? "ds:text-[color:var(--accent)]" : void 0
|
|
283
|
-
}
|
|
284
|
-
),
|
|
285
|
-
intent: "ghost",
|
|
286
|
-
size: "sm",
|
|
287
|
-
"aria-pressed": o,
|
|
288
|
-
"aria-label": a("controlRoom.favorite", {
|
|
289
|
-
defaultValue: "Favourite"
|
|
290
|
-
}),
|
|
291
|
-
onClick: () => oo(N.id)
|
|
292
|
-
}
|
|
293
|
-
);
|
|
294
|
-
})() : null,
|
|
295
|
-
/* @__PURE__ */ h(
|
|
296
|
-
G,
|
|
297
|
-
{
|
|
298
|
-
icon: /* @__PURE__ */ h(vo, { "aria-hidden": "true" }),
|
|
299
|
-
intent: "ghost",
|
|
300
|
-
size: "sm",
|
|
301
|
-
"aria-label": a("controlRoom.close", { defaultValue: "Close" }),
|
|
302
|
-
onClick: () => {
|
|
303
|
-
var o;
|
|
304
|
-
return (o = X.current) == null ? void 0 : o.close();
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
)
|
|
308
|
-
] }) : null;
|
|
309
|
-
return /* @__PURE__ */ D(fo, { actions: ro, children: [
|
|
310
|
-
/* @__PURE__ */ h(
|
|
311
|
-
mo,
|
|
312
|
-
{
|
|
313
|
-
ref: no,
|
|
314
|
-
dataComponent: "control-room-rail",
|
|
315
|
-
agentAdapter: ho,
|
|
316
|
-
tools: E,
|
|
317
|
-
activeToolId: m,
|
|
318
|
-
defaultActiveToolId: b,
|
|
319
|
-
onActiveToolChange: Q,
|
|
320
|
-
railLabel: u ?? a("controlRoom.railLabel", { defaultValue: "Control room" }),
|
|
321
|
-
onReorder: s ? to : void 0,
|
|
322
|
-
formatReorderAnnouncement: s ? eo : void 0,
|
|
323
|
-
...i
|
|
324
|
-
}
|
|
325
|
-
),
|
|
326
|
-
s ? /* @__PURE__ */ h("span", { role: "status", "aria-live": "polite", className: "ds:sr-only", children: Z }) : null
|
|
327
|
-
] });
|
|
328
|
-
});
|
|
329
|
-
export {
|
|
330
|
-
jo as C,
|
|
331
|
-
qo as a,
|
|
332
|
-
To as b,
|
|
333
|
-
ho as c,
|
|
334
|
-
Ho as d,
|
|
335
|
-
Ko as u
|
|
336
|
-
};
|
|
337
|
-
//# sourceMappingURL=control-room-rail-CnNZusR5.js.map
|
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
import { jsx as a, jsxs as v, Fragment as S } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as V, useState as F, useCallback as O, forwardRef as D, Fragment as M } from "react";
|
|
3
|
-
import { c as C } from "./index-D2ZczOXr.js";
|
|
4
|
-
import { useTranslation as L } from "react-i18next";
|
|
5
|
-
import { B as W } from "./badge-BudgzTe_.js";
|
|
6
|
-
import { D as b } from "./dropdown-menu-DU-Hrf33.js";
|
|
7
|
-
import { u as P } from "./use-media-query-CcAx5SMM.js";
|
|
8
|
-
import { u as I } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
|
|
9
|
-
import { u as Q } from "./use-overflow-collapse-BIOzKbni.js";
|
|
10
|
-
import { C as q } from "./chevron-down-DWE7GSq9.js";
|
|
11
|
-
import { C as G } from "./check-DrFSN__t.js";
|
|
12
|
-
import { C as H } from "./chevron-left-B8cOyH-V.js";
|
|
13
|
-
import { C as J } from "./chevron-right-I9AeSxH2.js";
|
|
14
|
-
function K(d = !0) {
|
|
15
|
-
const c = V(null), [u, o] = F({ start: !1, end: !1 });
|
|
16
|
-
I(() => {
|
|
17
|
-
const r = c.current;
|
|
18
|
-
if (!r || !d) {
|
|
19
|
-
o(
|
|
20
|
-
(t) => t.start || t.end ? { start: !1, end: !1 } : t
|
|
21
|
-
);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
const e = () => {
|
|
25
|
-
const t = Math.abs(r.scrollLeft), f = r.scrollWidth - r.clientWidth, i = t > 1, m = f - t > 1;
|
|
26
|
-
o(
|
|
27
|
-
(p) => p.start === i && p.end === m ? p : { start: i, end: m }
|
|
28
|
-
);
|
|
29
|
-
};
|
|
30
|
-
e(), r.addEventListener("scroll", e, { passive: !0 });
|
|
31
|
-
let n;
|
|
32
|
-
return typeof ResizeObserver < "u" && (n = new ResizeObserver(e), n.observe(r), r.firstElementChild && n.observe(r.firstElementChild)), () => {
|
|
33
|
-
r.removeEventListener("scroll", e), n == null || n.disconnect();
|
|
34
|
-
};
|
|
35
|
-
}, [d]);
|
|
36
|
-
const g = O((r) => {
|
|
37
|
-
var i;
|
|
38
|
-
const e = c.current;
|
|
39
|
-
if (!e || typeof window > "u") return;
|
|
40
|
-
const n = window.getComputedStyle(e).direction === "rtl", t = (i = window.matchMedia) == null ? void 0 : i.call(
|
|
41
|
-
window,
|
|
42
|
-
"(prefers-reduced-motion: reduce)"
|
|
43
|
-
).matches, f = e.clientWidth * 0.85 * r * (n ? -1 : 1);
|
|
44
|
-
e.scrollBy({ left: f, behavior: t ? "auto" : "smooth" });
|
|
45
|
-
}, []);
|
|
46
|
-
return {
|
|
47
|
-
ref: c,
|
|
48
|
-
canScrollStart: u.start,
|
|
49
|
-
canScrollEnd: u.end,
|
|
50
|
-
scrollByPage: g
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function U(d) {
|
|
54
|
-
return d > 99 ? "99+" : String(d);
|
|
55
|
-
}
|
|
56
|
-
const X = C("ds:shrink-0", {
|
|
57
|
-
variants: {
|
|
58
|
-
position: {
|
|
59
|
-
top: "ds:pt-[var(--spacing-md)]",
|
|
60
|
-
bottom: "ds:pb-[var(--spacing-md)]"
|
|
61
|
-
},
|
|
62
|
-
fill: {
|
|
63
|
-
false: "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
|
|
64
|
-
true: ""
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
defaultVariants: { position: "top", fill: !1 }
|
|
68
|
-
}), Y = "ds:rounded-[var(--radius-lg)] ds:border ds:border-[color:var(--card-border)] ds:bg-[var(--card)]/80 ds:backdrop-blur-md ds:shadow-[var(--shadow-md)]", Z = [
|
|
69
|
-
"ds:flex ds:[justify-content:safe_center] ds:overflow-x-auto ds:py-[var(--spacing-xs)]",
|
|
70
|
-
"ds:[--tabbar-mask-start:black] ds:[--tabbar-mask-end:black]",
|
|
71
|
-
"ds:ltr:data-[fade-start=true]:[--tabbar-mask-start:transparent]",
|
|
72
|
-
"ds:ltr:data-[fade-end=true]:[--tabbar-mask-end:transparent]",
|
|
73
|
-
"ds:rtl:data-[fade-start=true]:[--tabbar-mask-end:transparent]",
|
|
74
|
-
"ds:rtl:data-[fade-end=true]:[--tabbar-mask-start:transparent]",
|
|
75
|
-
"ds:[mask-image:linear-gradient(to_right,var(--tabbar-mask-start)_0,black_var(--tabbar-fade-distance,var(--spacing-lg)),black_calc(100%-var(--tabbar-fade-distance,var(--spacing-lg))),var(--tabbar-mask-end)_100%)]",
|
|
76
|
-
"ds:motion-reduce:[mask-image:none]",
|
|
77
|
-
"ds:[.theme-accessible_&]:[mask-image:none]",
|
|
78
|
-
"ds:forced-colors:[mask-image:none]"
|
|
79
|
-
].join(" "), ss = C(
|
|
80
|
-
"ds:flex ds:items-stretch ds:gap-[var(--spacing-xs)] ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
|
|
81
|
-
{
|
|
82
|
-
variants: {
|
|
83
|
-
fill: { false: "ds:shrink-0", true: "ds:w-full" }
|
|
84
|
-
},
|
|
85
|
-
defaultVariants: { fill: !1 }
|
|
86
|
-
}
|
|
87
|
-
), R = C(
|
|
88
|
-
"ds:group ds:flex ds:items-center ds:justify-center ds:gap-[var(--spacing-xs)] ds:min-h-[var(--min-target-size)] ds:rounded-[var(--radius-sm)] ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)] ds:py-[var(--spacing-xs)] ds:whitespace-nowrap ds:cursor-pointer ds:appearance-none ds:border-0 ds:bg-transparent ds:text-[length:var(--font-size-sm)] ds:font-[var(--font-weight-regular)] ds:text-[color:var(--foreground)] ds:no-underline ds:hover:bg-[var(--muted)]/20 ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)] ds:forced-colors:focus-visible:outline-[CanvasText]",
|
|
89
|
-
{
|
|
90
|
-
variants: {
|
|
91
|
-
fill: {
|
|
92
|
-
// Responsive: label under the icon below `sm`, beside it at `sm`+.
|
|
93
|
-
false: "ds:flex-col ds:sm:flex-row ds:sm:gap-[var(--spacing-sm)]",
|
|
94
|
-
// Fill the bar, always icon-over-label. No `min-w-0`, so a tab never
|
|
95
|
-
// shrinks below its label (labels never overlap); if the full set can't
|
|
96
|
-
// fit, the pill scrolls instead.
|
|
97
|
-
true: "ds:flex-1 ds:basis-0 ds:flex-col"
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
defaultVariants: { fill: !1 }
|
|
101
|
-
}
|
|
102
|
-
), E = "ds:inline-flex ds:items-center ds:text-[color:var(--accent)] ds:[&>svg]:size-4", as = "ds:group-aria-[current=page]:underline ds:group-aria-[current=page]:decoration-2 ds:group-aria-[current=page]:decoration-[color:var(--accent)] ds:group-aria-[current=page]:underline-offset-[var(--spacing-xs)]", rs = "ds:flex ds:w-full ds:items-center ds:gap-[var(--spacing-sm)] ds:min-h-[var(--min-target-size)] ds:rounded-[var(--radius-sm)] ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)] ds:py-[var(--spacing-xs)] ds:cursor-pointer ds:appearance-none ds:border-0 ds:bg-transparent ds:text-[length:var(--font-size-sm)] ds:font-[var(--font-weight-regular)] ds:text-[color:var(--foreground)] ds:hover:bg-[var(--muted)]/20 ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)] ds:forced-colors:focus-visible:outline-[CanvasText]", T = "ds:absolute ds:top-px ds:bottom-px ds:z-10 ds:flex ds:min-w-[var(--min-target-size)] ds:items-center ds:cursor-pointer ds:appearance-none ds:border-0 ds:bg-transparent ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)] ds:forced-colors:focus-visible:outline-[CanvasText]", es = "ds:start-px ds:justify-start ds:ps-[var(--spacing-xs)]", ns = "ds:end-px ds:justify-end ds:pe-[var(--spacing-xs)]", $ = "ds:size-4 ds:shrink-0 ds:text-[color:var(--accent)] ds:rtl:-scale-x-100", ts = D(
|
|
103
|
-
({
|
|
104
|
-
items: d,
|
|
105
|
-
id: c,
|
|
106
|
-
ariaLabel: u,
|
|
107
|
-
onSelect: o,
|
|
108
|
-
renderLink: g,
|
|
109
|
-
fill: r = !1,
|
|
110
|
-
position: e = "top",
|
|
111
|
-
collapseToMenu: n = !1,
|
|
112
|
-
className: t
|
|
113
|
-
}, f) => {
|
|
114
|
-
const { t: i } = L(), m = P("(max-width: 640px)"), { containerRef: p, contentRef: j, isOverflowing: A } = Q(n), w = n && (m || A), {
|
|
115
|
-
ref: _,
|
|
116
|
-
canScrollStart: k,
|
|
117
|
-
canScrollEnd: N,
|
|
118
|
-
scrollByPage: y
|
|
119
|
-
} = K(!w), l = d.find((s) => s.isActive) ?? d[0];
|
|
120
|
-
return /* @__PURE__ */ a(
|
|
121
|
-
"div",
|
|
122
|
-
{
|
|
123
|
-
ref: f,
|
|
124
|
-
"data-component": "tab-bar",
|
|
125
|
-
"data-component-id": c,
|
|
126
|
-
className: `${X({ position: e, fill: r })}${t ? ` ${t}` : ""}`,
|
|
127
|
-
children: /* @__PURE__ */ v("div", { className: "ds:relative", children: [
|
|
128
|
-
/* @__PURE__ */ a("div", { ref: p, className: Y, children: w ? /* @__PURE__ */ a("nav", { "aria-label": u, className: "ds:w-full", children: /* @__PURE__ */ v(b.Root, { children: [
|
|
129
|
-
/* @__PURE__ */ v(b.Trigger, { className: rs, children: [
|
|
130
|
-
l != null && l.icon ? /* @__PURE__ */ a("span", { "aria-hidden": "true", className: E, children: l.icon }) : null,
|
|
131
|
-
/* @__PURE__ */ a("span", { className: "ds:flex-1 ds:truncate ds:text-start", children: l == null ? void 0 : l.label }),
|
|
132
|
-
/* @__PURE__ */ a(
|
|
133
|
-
q,
|
|
134
|
-
{
|
|
135
|
-
"aria-hidden": "true",
|
|
136
|
-
className: "ds:size-4 ds:shrink-0 ds:text-[color:var(--muted-foreground)]"
|
|
137
|
-
}
|
|
138
|
-
)
|
|
139
|
-
] }),
|
|
140
|
-
/* @__PURE__ */ a(
|
|
141
|
-
b.Content,
|
|
142
|
-
{
|
|
143
|
-
align: "start",
|
|
144
|
-
className: "ds:min-w-[12rem]",
|
|
145
|
-
children: d.map((s) => /* @__PURE__ */ a(
|
|
146
|
-
b.Item,
|
|
147
|
-
{
|
|
148
|
-
"data-tab-id": s.id,
|
|
149
|
-
startIcon: s.icon,
|
|
150
|
-
endIcon: s.isActive ? /* @__PURE__ */ a(
|
|
151
|
-
G,
|
|
152
|
-
{
|
|
153
|
-
"aria-hidden": "true",
|
|
154
|
-
className: "ds:text-[color:var(--accent)]"
|
|
155
|
-
}
|
|
156
|
-
) : void 0,
|
|
157
|
-
"aria-current": s.isActive ? "page" : void 0,
|
|
158
|
-
onSelect: () => {
|
|
159
|
-
s.href ? window.location.assign(s.href) : o == null || o(s.id);
|
|
160
|
-
},
|
|
161
|
-
children: s.label
|
|
162
|
-
},
|
|
163
|
-
s.id
|
|
164
|
-
))
|
|
165
|
-
}
|
|
166
|
-
)
|
|
167
|
-
] }) }) : /* @__PURE__ */ a(
|
|
168
|
-
"div",
|
|
169
|
-
{
|
|
170
|
-
ref: _,
|
|
171
|
-
"data-fade-start": k ? "true" : void 0,
|
|
172
|
-
"data-fade-end": N ? "true" : void 0,
|
|
173
|
-
className: Z,
|
|
174
|
-
children: /* @__PURE__ */ a(
|
|
175
|
-
"nav",
|
|
176
|
-
{
|
|
177
|
-
ref: j,
|
|
178
|
-
"aria-label": u,
|
|
179
|
-
className: ss({ fill: r }),
|
|
180
|
-
children: d.map((s) => {
|
|
181
|
-
const z = typeof s.badgeCount == "number" && s.badgeCount > 0 ? s.badgeCount : void 0, h = s.isActive ? "page" : void 0, x = /* @__PURE__ */ v(S, { children: [
|
|
182
|
-
s.icon ? /* @__PURE__ */ a("span", { "aria-hidden": "true", className: E, children: s.icon }) : null,
|
|
183
|
-
/* @__PURE__ */ v("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
|
|
184
|
-
/* @__PURE__ */ a("span", { className: as, children: s.label }),
|
|
185
|
-
z !== void 0 ? /* @__PURE__ */ a(W, { variant: "neutral", children: U(z) }) : null
|
|
186
|
-
] })
|
|
187
|
-
] });
|
|
188
|
-
if (s.href !== void 0) {
|
|
189
|
-
const B = R({ fill: r });
|
|
190
|
-
return g ? /* @__PURE__ */ a(M, { children: g({
|
|
191
|
-
href: s.href,
|
|
192
|
-
className: B,
|
|
193
|
-
children: x,
|
|
194
|
-
"aria-current": h,
|
|
195
|
-
"data-tab-id": s.id,
|
|
196
|
-
onClick: s.onClick
|
|
197
|
-
}) }, s.id) : /* @__PURE__ */ a(
|
|
198
|
-
"a",
|
|
199
|
-
{
|
|
200
|
-
href: s.href,
|
|
201
|
-
"data-tab-id": s.id,
|
|
202
|
-
"aria-current": h,
|
|
203
|
-
className: B,
|
|
204
|
-
...s.onClick ? { onClick: s.onClick } : {},
|
|
205
|
-
children: x
|
|
206
|
-
},
|
|
207
|
-
s.id
|
|
208
|
-
);
|
|
209
|
-
}
|
|
210
|
-
return /* @__PURE__ */ a(
|
|
211
|
-
"button",
|
|
212
|
-
{
|
|
213
|
-
type: "button",
|
|
214
|
-
"data-tab-id": s.id,
|
|
215
|
-
"aria-current": h,
|
|
216
|
-
className: R({ fill: r }),
|
|
217
|
-
onClick: () => o == null ? void 0 : o(s.id),
|
|
218
|
-
children: x
|
|
219
|
-
},
|
|
220
|
-
s.id
|
|
221
|
-
);
|
|
222
|
-
})
|
|
223
|
-
}
|
|
224
|
-
)
|
|
225
|
-
}
|
|
226
|
-
) }),
|
|
227
|
-
k ? /* @__PURE__ */ a(
|
|
228
|
-
"button",
|
|
229
|
-
{
|
|
230
|
-
type: "button",
|
|
231
|
-
"aria-label": i("navigation.tabBar.scrollBack"),
|
|
232
|
-
onClick: () => y(-1),
|
|
233
|
-
className: `${T} ${es}`,
|
|
234
|
-
children: /* @__PURE__ */ a(
|
|
235
|
-
H,
|
|
236
|
-
{
|
|
237
|
-
"aria-hidden": "true",
|
|
238
|
-
className: $
|
|
239
|
-
}
|
|
240
|
-
)
|
|
241
|
-
}
|
|
242
|
-
) : null,
|
|
243
|
-
N ? /* @__PURE__ */ a(
|
|
244
|
-
"button",
|
|
245
|
-
{
|
|
246
|
-
type: "button",
|
|
247
|
-
"aria-label": i("navigation.tabBar.scrollForward"),
|
|
248
|
-
onClick: () => y(1),
|
|
249
|
-
className: `${T} ${ns}`,
|
|
250
|
-
children: /* @__PURE__ */ a(
|
|
251
|
-
J,
|
|
252
|
-
{
|
|
253
|
-
"aria-hidden": "true",
|
|
254
|
-
className: $
|
|
255
|
-
}
|
|
256
|
-
)
|
|
257
|
-
}
|
|
258
|
-
) : null
|
|
259
|
-
] })
|
|
260
|
-
}
|
|
261
|
-
);
|
|
262
|
-
}
|
|
263
|
-
);
|
|
264
|
-
ts.displayName = "TabBar";
|
|
265
|
-
export {
|
|
266
|
-
ts as T
|
|
267
|
-
};
|
|
268
|
-
//# sourceMappingURL=tab-bar-rDkLiaA6.js.map
|