@agg-market/ui 0.0.6 → 2.0.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/badge.d.mts +5 -3
- package/dist/badge.d.ts +5 -3
- package/dist/badge.js +52 -12
- package/dist/badge.mjs +1 -1
- package/dist/button.d.mts +2 -2
- package/dist/button.d.ts +2 -2
- package/dist/button.js +19 -34
- package/dist/button.mjs +2 -2
- package/dist/card.d.mts +4 -2
- package/dist/card.d.ts +4 -2
- package/dist/card.js +8 -4
- package/dist/card.mjs +1 -1
- package/dist/chart.js +14 -7
- package/dist/chart.mjs +2 -2
- package/dist/{chunk-ZYREURXK.mjs → chunk-2MJY6RVY.mjs} +35 -35
- package/dist/{chunk-P23GR7NX.mjs → chunk-422MCIXV.mjs} +1 -1
- package/dist/chunk-4KMFDCAH.mjs +371 -0
- package/dist/{chunk-HM3CGN32.mjs → chunk-5GDNWQZS.mjs} +46 -46
- package/dist/{chunk-VIP7HSOU.mjs → chunk-5K7VXAYM.mjs} +4 -0
- package/dist/{chunk-BJNHDIDW.mjs → chunk-6425RRBI.mjs} +4 -4
- package/dist/{chunk-O2XH4A3G.mjs → chunk-7NISYVSJ.mjs} +22 -22
- package/dist/{chunk-MXBPDNMC.mjs → chunk-BEDUFOIG.mjs} +95 -22
- package/dist/{chunk-VC7LTPQD.mjs → chunk-BN5VVHNV.mjs} +2 -2
- package/dist/{chunk-JRS2M5GY.mjs → chunk-CTVMT3VL.mjs} +13 -6
- package/dist/{chunk-USLTNDJA.mjs → chunk-D5FTFSKL.mjs} +8 -8
- package/dist/{chunk-BLSHXIAH.mjs → chunk-D7JTOGYP.mjs} +6 -11
- package/dist/{chunk-W2DMBW4E.mjs → chunk-DL7STJQ5.mjs} +61 -33
- package/dist/chunk-ERGNR6UQ.mjs +67 -0
- package/dist/chunk-FO263M3V.mjs +10 -0
- package/dist/{chunk-3O4U3E5I.mjs → chunk-FO2QCB4Z.mjs} +8 -4
- package/dist/{chunk-OGI343OV.mjs → chunk-IGPNIM2B.mjs} +3 -2
- package/dist/chunk-K6IJ4WBM.mjs +67 -0
- package/dist/{chunk-PGSPYQOW.mjs → chunk-KAGYJ4XT.mjs} +17 -27
- package/dist/{chunk-RGZQHSNJ.mjs → chunk-KCPDVBIZ.mjs} +26 -17
- package/dist/{chunk-ZHKMDK5M.mjs → chunk-KFOATMAE.mjs} +87 -87
- package/dist/{chunk-I4YUYVJJ.mjs → chunk-LK5D3ZTK.mjs} +38 -27
- package/dist/{chunk-VUDJ3PYM.mjs → chunk-O46OFVH6.mjs} +40 -16
- package/dist/{chunk-RXACBTON.mjs → chunk-OA2IZ3VW.mjs} +16 -22
- package/dist/{chunk-F236MLT6.mjs → chunk-PZTHM6WG.mjs} +13 -10
- package/dist/{chunk-XELWY7SO.mjs → chunk-QYZKC7KG.mjs} +137 -104
- package/dist/{chunk-LWTQD345.mjs → chunk-S3H63TQ5.mjs} +57 -312
- package/dist/{chunk-MNSHWA6M.mjs → chunk-TA7LKYKP.mjs} +9 -8
- package/dist/{chunk-JH5VMNDL.mjs → chunk-V52WSZHQ.mjs} +8 -7
- package/dist/chunk-YJA5VQW6.mjs +167 -0
- package/dist/{chunk-EXF4SESB.mjs → chunk-ZFMCCBP6.mjs} +1 -1
- package/dist/connect-button.js +51 -73
- package/dist/connect-button.mjs +6 -6
- package/dist/deposit-modal.js +171 -177
- package/dist/deposit-modal.mjs +7 -7
- package/dist/event-list-item-details.js +222 -198
- package/dist/event-list-item-details.mjs +11 -11
- package/dist/event-list-item.js +172 -114
- package/dist/event-list-item.mjs +8 -8
- package/dist/event-list.js +391 -507
- package/dist/event-list.mjs +11 -11
- package/dist/event-market-page.d.mts +1 -1
- package/dist/event-market-page.d.ts +1 -1
- package/dist/event-market-page.js +826 -764
- package/dist/event-market-page.mjs +19 -19
- package/dist/hello-world.js +28 -16
- package/dist/hello-world.mjs +2 -2
- package/dist/home-page.js +395 -511
- package/dist/home-page.mjs +12 -12
- package/dist/icon.d.mts +1 -1
- package/dist/icon.d.ts +1 -1
- package/dist/icon.js +15 -17
- package/dist/icon.mjs +2 -2
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +1158 -956
- package/dist/index.mjs +34 -32
- package/dist/loading-icon.d.mts +1 -1
- package/dist/loading-icon.d.ts +1 -1
- package/dist/loading-icon.js +5 -9
- package/dist/loading-icon.mjs +2 -2
- package/dist/market-details.d.mts +2 -2
- package/dist/market-details.d.ts +2 -2
- package/dist/market-details.js +357 -551
- package/dist/market-details.mjs +13 -13
- package/dist/modal.js +4 -0
- package/dist/modal.mjs +1 -1
- package/dist/onboarding-modal.js +63 -67
- package/dist/onboarding-modal.mjs +6 -6
- package/dist/place-order.d.mts +1 -1
- package/dist/place-order.d.ts +1 -1
- package/dist/place-order.js +231 -466
- package/dist/place-order.mjs +9 -9
- package/dist/profile-modal.js +75 -77
- package/dist/profile-modal.mjs +6 -6
- package/dist/search.d.mts +2 -2
- package/dist/search.d.ts +2 -2
- package/dist/search.js +28 -34
- package/dist/search.mjs +4 -4
- package/dist/select.js +104 -99
- package/dist/select.mjs +3 -3
- package/dist/settlement.d.mts +1 -1
- package/dist/settlement.d.ts +1 -1
- package/dist/settlement.js +279 -59
- package/dist/settlement.mjs +6 -6
- package/dist/skeleton.js +15 -10
- package/dist/skeleton.mjs +2 -2
- package/dist/styles.css +1 -1
- package/dist/switch-button.js +13 -6
- package/dist/switch-button.mjs +1 -1
- package/dist/tabs.d.mts +8 -4
- package/dist/tabs.d.ts +8 -4
- package/dist/tabs.js +163 -420
- package/dist/tabs.mjs +4 -4
- package/dist/tailwind.css +1 -1
- package/dist/types-BVj9ky9P.d.mts +3 -0
- package/dist/types-BVj9ky9P.d.ts +3 -0
- package/dist/typography.d.mts +4 -2
- package/dist/typography.d.ts +4 -2
- package/dist/typography.js +49 -18
- package/dist/typography.mjs +5 -3
- package/dist/user-profile-page.d.mts +2 -2
- package/dist/user-profile-page.d.ts +2 -2
- package/dist/user-profile-page.js +200 -474
- package/dist/user-profile-page.mjs +7 -7
- package/dist/venue-logo.d.mts +2 -2
- package/dist/venue-logo.d.ts +2 -2
- package/dist/venue-logo.js +6 -11
- package/dist/venue-logo.mjs +1 -1
- package/dist/{venue-logo.types-BSAuY84j.d.ts → venue-logo.types-D8Cu2rAm.d.ts} +1 -1
- package/dist/{venue-logo.types-DACqcTvY.d.mts → venue-logo.types-HRf1yBLD.d.mts} +1 -1
- package/dist/withdraw-modal.js +72 -85
- package/dist/withdraw-modal.mjs +6 -6
- package/package.json +2 -2
- package/dist/chunk-AEMAY3MR.mjs +0 -44
- package/dist/chunk-DYEWXEEY.mjs +0 -37
- package/dist/chunk-QFQHD2V6.mjs +0 -146
- package/dist/chunk-ZDF7QP4G.mjs +0 -160
- package/dist/chunk-ZVBVGWSP.mjs +0 -15
- package/dist/types-Bed6Q0EK.d.mts +0 -3
- package/dist/types-Bed6Q0EK.d.ts +0 -3
- package/dist/{types-DkGlbmXq.d.mts → types-JBf1DZlH.d.mts} +2 -2
- package/dist/{types-DkGlbmXq.d.ts → types-JBf1DZlH.d.ts} +2 -2
package/dist/tabs.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
5
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
7
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
10
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
9
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
10
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -46,14 +44,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
46
44
|
}
|
|
47
45
|
return to;
|
|
48
46
|
};
|
|
49
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
50
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
51
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
52
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
53
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
54
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
55
|
-
mod
|
|
56
|
-
));
|
|
57
47
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
58
48
|
|
|
59
49
|
// src/primitives/tabs/index.tsx
|
|
@@ -64,10 +54,10 @@ __export(tabs_exports, {
|
|
|
64
54
|
module.exports = __toCommonJS(tabs_exports);
|
|
65
55
|
var import_react2 = require("react");
|
|
66
56
|
var import_hooks2 = require("@agg-market/hooks");
|
|
67
|
-
var DropdownMenu = __toESM(require("@radix-ui/react-dropdown-menu"));
|
|
68
57
|
|
|
69
|
-
// src/
|
|
70
|
-
var
|
|
58
|
+
// src/primitives/select/index.tsx
|
|
59
|
+
var import_react = require("react");
|
|
60
|
+
var import_hooks = require("@agg-market/hooks");
|
|
71
61
|
|
|
72
62
|
// src/shared/utils.ts
|
|
73
63
|
var cn = (...values) => values.filter(Boolean).join(" ");
|
|
@@ -141,14 +131,10 @@ var ArrowsToDotIcon = (_a) => {
|
|
|
141
131
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
142
132
|
"path",
|
|
143
133
|
{
|
|
144
|
-
d: "M8
|
|
145
|
-
|
|
146
|
-
strokeWidth: "1.25",
|
|
147
|
-
strokeLinecap: "round",
|
|
148
|
-
strokeLinejoin: "round"
|
|
134
|
+
d: "M8 6.66667C8.73667 6.66667 9.33333 7.26333 9.33333 8C9.33333 8.73667 8.73667 9.33333 8 9.33333C7.26333 9.33333 6.66667 8.73667 6.66667 8C6.66667 7.26333 7.26333 6.66667 8 6.66667ZM5.27867 7.05733L3.39267 5.17133C3.132 4.91067 2.71067 4.91067 2.45 5.17133C2.18933 5.432 2.18933 5.854 2.45 6.114L3.67467 7.33333H0.666667C0.298 7.33333 0 7.632 0 8C0 8.368 0.298 8.66667 0.666667 8.66667H3.662L2.44867 9.88667C2.18867 10.148 2.19 10.5693 2.45133 10.8293C2.71267 11.0893 3.13467 11.088 3.394 10.8267L5.27933 8.93133C5.79467 8.41467 5.79467 7.574 5.27933 7.05667L5.27867 7.05733ZM7.068 5.278C7.56133 5.79267 8.45 5.79267 8.94267 5.278L10.828 3.392C11.0887 3.13133 11.0887 2.70933 10.828 2.44933C10.5673 2.18867 10.146 2.18867 9.88533 2.44933L8.66667 3.674V0.666667C8.66667 0.298667 8.36867 0 8 0C7.63133 0 7.33333 0.298667 7.33333 0.666667V3.662L6.11333 2.44867C5.852 2.18867 5.43067 2.19 5.17067 2.45133C4.91067 2.71267 4.912 3.13467 5.17333 3.394L7.068 5.278ZM8.94267 10.7213C8.42667 10.2053 7.58533 10.2053 7.06867 10.72L5.17267 12.606C4.91133 12.866 4.91 13.2873 5.17 13.5487C5.42933 13.8093 5.85067 13.8113 6.11267 13.5513L7.33267 12.3307V15.3333C7.33267 15.702 7.63067 16 7.99933 16C8.368 16 8.666 15.702 8.666 15.3333V12.3307L9.88467 13.55C10.1453 13.8107 10.5667 13.8107 10.8273 13.55C11.088 13.2893 11.088 12.868 10.8273 12.6073L8.94267 10.7213ZM15.3333 7.33333H12.3307L13.55 6.114C13.8107 5.854 13.8107 5.432 13.55 5.17133C13.2893 4.91067 12.868 4.91067 12.6073 5.17133L10.7213 7.05733C10.2053 7.574 10.2047 8.41467 10.72 8.93133L12.606 10.8273C12.866 11.088 13.2873 11.09 13.5487 10.83C13.81 10.57 13.8113 10.1487 13.5513 9.88733L12.3307 8.66733H15.3333C15.702 8.66733 16 8.36867 16 8.00067C16 7.63267 15.702 7.334 15.3333 7.334V7.33333Z",
|
|
135
|
+
fill: "currentColor"
|
|
149
136
|
}
|
|
150
|
-
)
|
|
151
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "8", cy: "8", r: "1.5", fill: "currentColor" })
|
|
137
|
+
)
|
|
152
138
|
]
|
|
153
139
|
})
|
|
154
140
|
);
|
|
@@ -682,14 +668,9 @@ InfoIcon.displayName = "InfoIcon";
|
|
|
682
668
|
|
|
683
669
|
// src/primitives/icon/icon.constants.ts
|
|
684
670
|
var iconSizeClasses = {
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
ms: "h-5 w-5",
|
|
689
|
-
m: "h-6 w-6",
|
|
690
|
-
l: "h-8 w-8",
|
|
691
|
-
xl: "h-10 w-10",
|
|
692
|
-
xxl: "h-12 w-12"
|
|
671
|
+
small: "h-4 w-4",
|
|
672
|
+
medium: "h-6 w-6",
|
|
673
|
+
large: "h-8 w-8"
|
|
693
674
|
};
|
|
694
675
|
|
|
695
676
|
// src/primitives/icon/svg/check-badge.tsx
|
|
@@ -1395,7 +1376,7 @@ var Icon = (_a) => {
|
|
|
1395
1376
|
var _b = _a, {
|
|
1396
1377
|
name,
|
|
1397
1378
|
color,
|
|
1398
|
-
size = "
|
|
1379
|
+
size = "medium",
|
|
1399
1380
|
className = "text-agg-primary",
|
|
1400
1381
|
style
|
|
1401
1382
|
} = _b, props = __objRest(_b, [
|
|
@@ -1408,13 +1389,18 @@ var Icon = (_a) => {
|
|
|
1408
1389
|
const Component = iconRegistry[name];
|
|
1409
1390
|
const resolvedStyle = resolveIconStyle(color, style);
|
|
1410
1391
|
const resolvedClassName = cn(iconSizeClasses[size], className);
|
|
1411
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
1392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
1393
|
+
Component,
|
|
1394
|
+
__spreadValues({
|
|
1395
|
+
color,
|
|
1396
|
+
className: cn("group/agg-icon", resolvedClassName),
|
|
1397
|
+
style: resolvedStyle
|
|
1398
|
+
}, props)
|
|
1399
|
+
);
|
|
1412
1400
|
};
|
|
1413
1401
|
Icon.displayName = "Icon";
|
|
1414
1402
|
|
|
1415
1403
|
// src/primitives/select/index.tsx
|
|
1416
|
-
var import_react = require("react");
|
|
1417
|
-
var import_hooks = require("@agg-market/hooks");
|
|
1418
1404
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
1419
1405
|
var Select = ({
|
|
1420
1406
|
items,
|
|
@@ -1436,7 +1422,7 @@ var Select = ({
|
|
|
1436
1422
|
if (!isOpen)
|
|
1437
1423
|
return;
|
|
1438
1424
|
const handlePointerDown = (e) => {
|
|
1439
|
-
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
1425
|
+
if (containerRef.current && !containerRef.current.contains(e == null ? void 0 : e.target)) {
|
|
1440
1426
|
close();
|
|
1441
1427
|
}
|
|
1442
1428
|
};
|
|
@@ -1447,7 +1433,7 @@ var Select = ({
|
|
|
1447
1433
|
if (!isOpen)
|
|
1448
1434
|
return;
|
|
1449
1435
|
const handleKey = (e) => {
|
|
1450
|
-
if (e.key === "Escape")
|
|
1436
|
+
if ((e == null ? void 0 : e.key) === "Escape")
|
|
1451
1437
|
close();
|
|
1452
1438
|
};
|
|
1453
1439
|
document.addEventListener("keydown", handleKey);
|
|
@@ -1456,7 +1442,7 @@ var Select = ({
|
|
|
1456
1442
|
const isDisabled = disabled || !hasEnabledItems;
|
|
1457
1443
|
const selectedItem = items.find((item) => item.value === value);
|
|
1458
1444
|
if (!hasAnyIcon) {
|
|
1459
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: cn("relative inline-flex w-full", className), children: [
|
|
1445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: cn("group/agg-select", "relative inline-flex w-full", className), children: [
|
|
1460
1446
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
1461
1447
|
"select",
|
|
1462
1448
|
{
|
|
@@ -1465,7 +1451,7 @@ var Select = ({
|
|
|
1465
1451
|
"w-full appearance-none rounded-agg-md border border-agg-separator bg-agg-secondary px-4 py-2 pr-10 font-agg-sans text-agg-sm leading-agg-5 text-agg-foreground outline-none",
|
|
1466
1452
|
getMotionClassName(
|
|
1467
1453
|
enableAnimations,
|
|
1468
|
-
"transition-[border-color,box-shadow] duration-200 ease-out"
|
|
1454
|
+
"transition-[border-color,box-shadow] duration-200 ease-in-out"
|
|
1469
1455
|
),
|
|
1470
1456
|
"focus:border-agg-primary focus:ring-2 focus:ring-agg-primary/15",
|
|
1471
1457
|
"disabled:cursor-not-allowed disabled:opacity-60"
|
|
@@ -1476,88 +1462,95 @@ var Select = ({
|
|
|
1476
1462
|
children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("option", { value: item.value, disabled: item.disabled, children: item.label }, item.value))
|
|
1477
1463
|
}
|
|
1478
1464
|
),
|
|
1479
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "pointer-events-none absolute inset-y-0 right-3 inline-flex items-center justify-center text-agg-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Icon, { name: "chevron-down", size: "
|
|
1465
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "pointer-events-none absolute inset-y-0 right-3 inline-flex items-center justify-center text-agg-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Icon, { name: "chevron-down", size: "small", color: "currentColor" }) })
|
|
1480
1466
|
] });
|
|
1481
1467
|
}
|
|
1482
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
children: [
|
|
1503
|
-
(selectedItem == null ? void 0 : selectedItem.iconUrl) ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
1504
|
-
"img",
|
|
1505
|
-
{
|
|
1506
|
-
src: selectedItem.iconUrl,
|
|
1507
|
-
alt: "",
|
|
1508
|
-
className: "h-4 w-4 shrink-0 rounded-sm object-contain"
|
|
1509
|
-
}
|
|
1510
|
-
) : null,
|
|
1511
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "flex-1 truncate", children: (_a = selectedItem == null ? void 0 : selectedItem.label) != null ? _a : "" })
|
|
1512
|
-
]
|
|
1513
|
-
}
|
|
1514
|
-
),
|
|
1515
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "pointer-events-none absolute inset-y-0 right-3 inline-flex items-center justify-center text-agg-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Icon, { name: "chevron-down", size: "s", color: "currentColor" }) }),
|
|
1516
|
-
isOpen ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
1517
|
-
"div",
|
|
1518
|
-
{
|
|
1519
|
-
role: "listbox",
|
|
1520
|
-
"aria-label": ariaLabel != null ? ariaLabel : labels.common.selectAria,
|
|
1521
|
-
className: "absolute top-full left-0 z-50 mt-1 w-full overflow-hidden rounded-agg-md border border-agg-separator bg-agg-secondary shadow-lg",
|
|
1522
|
-
children: items.map((item) => {
|
|
1523
|
-
const isSelected = item.value === value;
|
|
1524
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
1525
|
-
"button",
|
|
1526
|
-
{
|
|
1527
|
-
type: "button",
|
|
1528
|
-
role: "option",
|
|
1529
|
-
"aria-selected": isSelected,
|
|
1530
|
-
disabled: item.disabled,
|
|
1531
|
-
className: cn(
|
|
1532
|
-
"flex w-full items-center gap-2 px-4 py-2 text-left text-agg-sm leading-agg-5 outline-none",
|
|
1533
|
-
"hover:bg-agg-secondary-hover focus-visible:bg-agg-secondary-hover",
|
|
1534
|
-
isSelected ? "font-agg-bold text-agg-primary" : "font-agg-normal text-agg-foreground",
|
|
1535
|
-
item.disabled && "cursor-not-allowed opacity-60"
|
|
1468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
1469
|
+
"div",
|
|
1470
|
+
{
|
|
1471
|
+
ref: containerRef,
|
|
1472
|
+
className: cn("group/agg-select", "relative inline-flex w-full", className),
|
|
1473
|
+
children: [
|
|
1474
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
1475
|
+
"button",
|
|
1476
|
+
{
|
|
1477
|
+
type: "button",
|
|
1478
|
+
"aria-label": ariaLabel != null ? ariaLabel : labels.common.selectAria,
|
|
1479
|
+
"aria-expanded": isOpen,
|
|
1480
|
+
"aria-haspopup": "listbox",
|
|
1481
|
+
disabled: isDisabled,
|
|
1482
|
+
className: cn(
|
|
1483
|
+
"w-full rounded-agg-md border border-agg-separator bg-agg-secondary px-4 py-2 pr-10 font-agg-sans text-agg-sm leading-agg-5 text-agg-foreground outline-none",
|
|
1484
|
+
"flex items-center gap-2 text-left",
|
|
1485
|
+
getMotionClassName(
|
|
1486
|
+
enableAnimations,
|
|
1487
|
+
"transition-[border-color,box-shadow] duration-200 ease-in-out"
|
|
1536
1488
|
),
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1489
|
+
"focus:border-agg-primary focus:ring-2 focus:ring-agg-primary/15",
|
|
1490
|
+
"disabled:cursor-not-allowed disabled:opacity-60"
|
|
1491
|
+
),
|
|
1492
|
+
onClick: () => setIsOpen((prev) => !prev),
|
|
1493
|
+
children: [
|
|
1494
|
+
(selectedItem == null ? void 0 : selectedItem.iconUrl) ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
1495
|
+
"img",
|
|
1496
|
+
{
|
|
1497
|
+
src: selectedItem.iconUrl,
|
|
1498
|
+
alt: "",
|
|
1499
|
+
className: "h-4 w-4 shrink-0 rounded-sm object-contain"
|
|
1541
1500
|
}
|
|
1542
|
-
|
|
1543
|
-
children:
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1501
|
+
) : null,
|
|
1502
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "flex-1 truncate", children: (_a = selectedItem == null ? void 0 : selectedItem.label) != null ? _a : "" })
|
|
1503
|
+
]
|
|
1504
|
+
}
|
|
1505
|
+
),
|
|
1506
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "pointer-events-none absolute inset-y-0 right-3 inline-flex items-center justify-center text-agg-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Icon, { name: "chevron-down", size: "small", color: "currentColor" }) }),
|
|
1507
|
+
isOpen ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
1508
|
+
"div",
|
|
1509
|
+
{
|
|
1510
|
+
role: "listbox",
|
|
1511
|
+
"aria-label": ariaLabel != null ? ariaLabel : labels.common.selectAria,
|
|
1512
|
+
className: "absolute top-full left-0 z-50 mt-1 w-full overflow-hidden rounded-agg-md border border-agg-separator bg-agg-secondary shadow-lg",
|
|
1513
|
+
children: items.map((item) => {
|
|
1514
|
+
const isSelected = item.value === value;
|
|
1515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
1516
|
+
"button",
|
|
1517
|
+
{
|
|
1518
|
+
type: "button",
|
|
1519
|
+
role: "option",
|
|
1520
|
+
"aria-selected": isSelected,
|
|
1521
|
+
disabled: item.disabled,
|
|
1522
|
+
className: cn(
|
|
1523
|
+
"flex w-full items-center gap-2 px-4 py-2 text-left text-agg-sm leading-agg-5 outline-none",
|
|
1524
|
+
"hover:bg-agg-secondary-hover focus-visible:bg-agg-secondary-hover",
|
|
1525
|
+
isSelected ? "font-agg-bold text-agg-primary" : "font-agg-normal text-agg-foreground",
|
|
1526
|
+
item.disabled && "cursor-not-allowed opacity-60"
|
|
1527
|
+
),
|
|
1528
|
+
onClick: () => {
|
|
1529
|
+
if (!item.disabled) {
|
|
1530
|
+
onChange(item.value);
|
|
1531
|
+
close();
|
|
1532
|
+
}
|
|
1533
|
+
},
|
|
1534
|
+
children: [
|
|
1535
|
+
item.iconUrl ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
1536
|
+
"img",
|
|
1537
|
+
{
|
|
1538
|
+
src: item.iconUrl,
|
|
1539
|
+
alt: "",
|
|
1540
|
+
className: "h-4 w-4 shrink-0 rounded-sm object-contain"
|
|
1541
|
+
}
|
|
1542
|
+
) : null,
|
|
1543
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "truncate", children: item.label })
|
|
1544
|
+
]
|
|
1545
|
+
},
|
|
1546
|
+
item.value
|
|
1547
|
+
);
|
|
1548
|
+
})
|
|
1549
|
+
}
|
|
1550
|
+
) : null
|
|
1551
|
+
]
|
|
1552
|
+
}
|
|
1553
|
+
);
|
|
1561
1554
|
};
|
|
1562
1555
|
Select.displayName = "Select";
|
|
1563
1556
|
|
|
@@ -1584,86 +1577,10 @@ var findEdgeEnabledIndex = (items, direction) => {
|
|
|
1584
1577
|
}
|
|
1585
1578
|
return -1;
|
|
1586
1579
|
};
|
|
1587
|
-
var FALLBACK_TAB_WIDTH = 112;
|
|
1588
|
-
var FALLBACK_MORE_WIDTH = 56;
|
|
1589
|
-
var sumWidths = (indices, widths) => {
|
|
1590
|
-
return [...indices].reduce((accumulator, index) => {
|
|
1591
|
-
var _a;
|
|
1592
|
-
return accumulator + ((_a = widths[index]) != null ? _a : 0);
|
|
1593
|
-
}, 0);
|
|
1594
|
-
};
|
|
1595
|
-
var resolveTabsOverflowLayout = ({
|
|
1596
|
-
items,
|
|
1597
|
-
value,
|
|
1598
|
-
containerWidth,
|
|
1599
|
-
moreButtonWidth,
|
|
1600
|
-
itemWidthByValue
|
|
1601
|
-
}) => {
|
|
1602
|
-
var _a;
|
|
1603
|
-
if (items.length === 0) {
|
|
1604
|
-
return {
|
|
1605
|
-
visibleItems: [],
|
|
1606
|
-
hiddenItems: []
|
|
1607
|
-
};
|
|
1608
|
-
}
|
|
1609
|
-
if (!Number.isFinite(containerWidth) || containerWidth <= 0) {
|
|
1610
|
-
return {
|
|
1611
|
-
visibleItems: items,
|
|
1612
|
-
hiddenItems: []
|
|
1613
|
-
};
|
|
1614
|
-
}
|
|
1615
|
-
const resolvedItemWidths = items.map((item) => {
|
|
1616
|
-
var _a2;
|
|
1617
|
-
const measuredWidth = (_a2 = itemWidthByValue.get(item.value)) != null ? _a2 : FALLBACK_TAB_WIDTH;
|
|
1618
|
-
return Math.max(1, measuredWidth);
|
|
1619
|
-
});
|
|
1620
|
-
const totalItemsWidth = resolvedItemWidths.reduce((sum, width) => {
|
|
1621
|
-
return sum + width;
|
|
1622
|
-
}, 0);
|
|
1623
|
-
if (totalItemsWidth <= containerWidth) {
|
|
1624
|
-
return {
|
|
1625
|
-
visibleItems: items,
|
|
1626
|
-
hiddenItems: []
|
|
1627
|
-
};
|
|
1628
|
-
}
|
|
1629
|
-
const reservedMoreWidth = Math.max(1, moreButtonWidth || FALLBACK_MORE_WIDTH);
|
|
1630
|
-
const visibleIndices = /* @__PURE__ */ new Set();
|
|
1631
|
-
let usedWidth = 0;
|
|
1632
|
-
for (let index = 0; index < items.length; index += 1) {
|
|
1633
|
-
const itemWidth = (_a = resolvedItemWidths[index]) != null ? _a : FALLBACK_TAB_WIDTH;
|
|
1634
|
-
const hasRemainingItems = index < items.length - 1;
|
|
1635
|
-
const requiredExtraWidth = hasRemainingItems ? reservedMoreWidth : 0;
|
|
1636
|
-
if (usedWidth + itemWidth + requiredExtraWidth > containerWidth)
|
|
1637
|
-
break;
|
|
1638
|
-
visibleIndices.add(index);
|
|
1639
|
-
usedWidth += itemWidth;
|
|
1640
|
-
}
|
|
1641
|
-
if (visibleIndices.size === 0) {
|
|
1642
|
-
visibleIndices.add(0);
|
|
1643
|
-
}
|
|
1644
|
-
const activeIndex = items.findIndex((item) => item.value === value);
|
|
1645
|
-
const isActiveHidden = activeIndex >= 0 && !visibleIndices.has(activeIndex);
|
|
1646
|
-
if (isActiveHidden && activeIndex >= 0) {
|
|
1647
|
-
visibleIndices.add(activeIndex);
|
|
1648
|
-
while (visibleIndices.size > 1) {
|
|
1649
|
-
const visibleWidth = sumWidths(visibleIndices, resolvedItemWidths);
|
|
1650
|
-
if (visibleWidth + reservedMoreWidth <= containerWidth)
|
|
1651
|
-
break;
|
|
1652
|
-
const removableIndex = [...visibleIndices].sort((left, right) => right - left).find((index) => index !== activeIndex);
|
|
1653
|
-
if (removableIndex == null)
|
|
1654
|
-
break;
|
|
1655
|
-
visibleIndices.delete(removableIndex);
|
|
1656
|
-
}
|
|
1657
|
-
}
|
|
1658
|
-
return {
|
|
1659
|
-
visibleItems: items.filter((_, index) => visibleIndices.has(index)),
|
|
1660
|
-
hiddenItems: items.filter((_, index) => !visibleIndices.has(index))
|
|
1661
|
-
};
|
|
1662
|
-
};
|
|
1663
1580
|
|
|
1664
1581
|
// src/primitives/tabs/index.tsx
|
|
1665
1582
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
1666
|
-
var mobileTabsMediaQuery = "(max-width:
|
|
1583
|
+
var mobileTabsMediaQuery = "(max-width: 512px)";
|
|
1667
1584
|
var getTabButtonClassName = ({
|
|
1668
1585
|
enableAnimations,
|
|
1669
1586
|
isBarVariant,
|
|
@@ -1675,7 +1592,11 @@ var getTabButtonClassName = ({
|
|
|
1675
1592
|
return cn(
|
|
1676
1593
|
"cursor-pointer disabled:cursor-not-allowed",
|
|
1677
1594
|
"relative inline-flex h-full shrink-0 items-center justify-center gap-2 font-agg-sans",
|
|
1678
|
-
|
|
1595
|
+
isBarVariant ? "hover:text-agg-foreground hover:bg-agg-secondary-hover" : "hover:text-agg-foreground hover:font-bold",
|
|
1596
|
+
getMotionClassName(
|
|
1597
|
+
enableAnimations,
|
|
1598
|
+
"transition-[colors] duration-300 ease-in-out motion-reduce:transition-none"
|
|
1599
|
+
),
|
|
1679
1600
|
isBarVariant ? cn(
|
|
1680
1601
|
"min-w-20 overflow-hidden border-r border-agg-separator last:border-r-0",
|
|
1681
1602
|
isSmall ? "px-3 text-agg-sm leading-agg-5" : "px-4 text-agg-base leading-agg-6"
|
|
@@ -1687,35 +1608,6 @@ var getTabButtonClassName = ({
|
|
|
1687
1608
|
isDisabled && "cursor-not-allowed opacity-60"
|
|
1688
1609
|
);
|
|
1689
1610
|
};
|
|
1690
|
-
var getMeasureTabClassName = ({
|
|
1691
|
-
isBarVariant,
|
|
1692
|
-
size
|
|
1693
|
-
}) => {
|
|
1694
|
-
const isSmall = size === "s";
|
|
1695
|
-
return cn(
|
|
1696
|
-
"relative inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap font-agg-sans",
|
|
1697
|
-
isBarVariant ? cn(
|
|
1698
|
-
"h-8 min-w-20 border-r border-agg-separator font-agg-bold",
|
|
1699
|
-
isSmall ? "px-3 text-agg-sm leading-agg-5" : "px-4 text-agg-base leading-agg-6"
|
|
1700
|
-
) : cn(
|
|
1701
|
-
"h-12 font-agg-bold",
|
|
1702
|
-
isSmall ? "px-4 text-agg-sm leading-agg-5" : "px-5 text-agg-base leading-agg-6"
|
|
1703
|
-
)
|
|
1704
|
-
);
|
|
1705
|
-
};
|
|
1706
|
-
var getMoreButtonClassName = ({
|
|
1707
|
-
enableAnimations,
|
|
1708
|
-
isBarVariant,
|
|
1709
|
-
size
|
|
1710
|
-
}) => {
|
|
1711
|
-
const isSmall = size === "s";
|
|
1712
|
-
return cn(
|
|
1713
|
-
"cursor-pointer disabled:cursor-not-allowed",
|
|
1714
|
-
"relative inline-flex shrink-0 items-center justify-center overflow-hidden font-agg-sans text-agg-foreground hover:bg-agg-secondary-hover",
|
|
1715
|
-
getMotionClassName(enableAnimations, "transition-colors motion-reduce:transition-none"),
|
|
1716
|
-
isBarVariant ? "h-8 rounded-r-agg-sm border border-agg-separator bg-agg-secondary px-2" : cn("h-12 bg-agg-secondary", isSmall ? "px-3 text-agg-sm" : "px-4 text-agg-base")
|
|
1717
|
-
);
|
|
1718
|
-
};
|
|
1719
1611
|
var Tabs = ({
|
|
1720
1612
|
items,
|
|
1721
1613
|
value,
|
|
@@ -1723,12 +1615,12 @@ var Tabs = ({
|
|
|
1723
1615
|
variant = "bar",
|
|
1724
1616
|
size = "m",
|
|
1725
1617
|
overflowBehavior,
|
|
1726
|
-
overflowMenuAriaLabel,
|
|
1727
1618
|
ariaLabel,
|
|
1728
|
-
className
|
|
1619
|
+
className,
|
|
1620
|
+
classNames
|
|
1729
1621
|
}) => {
|
|
1730
1622
|
const labels = (0, import_hooks2.useLabels)();
|
|
1731
|
-
const { enableAnimations
|
|
1623
|
+
const { enableAnimations } = (0, import_hooks2.useSdkUiConfig)();
|
|
1732
1624
|
const buttonRefs = (0, import_react2.useRef)([]);
|
|
1733
1625
|
const dragStateRef = (0, import_react2.useRef)({
|
|
1734
1626
|
isPointerDown: false,
|
|
@@ -1740,8 +1632,6 @@ var Tabs = ({
|
|
|
1740
1632
|
});
|
|
1741
1633
|
const suppressClickRef = (0, import_react2.useRef)(false);
|
|
1742
1634
|
const resolvedAriaLabel = ariaLabel != null ? ariaLabel : labels.common.tabsAria;
|
|
1743
|
-
const resolvedOverflowMenuAriaLabel = overflowMenuAriaLabel != null ? overflowMenuAriaLabel : labels.common.hiddenTabsAria;
|
|
1744
|
-
const [isMoreMenuOpen, setIsMoreMenuOpen] = (0, import_react2.useState)(false);
|
|
1745
1635
|
const [isMobileViewport, setIsMobileViewport] = (0, import_react2.useState)(false);
|
|
1746
1636
|
const [isDraggingTabs, setIsDraggingTabs] = (0, import_react2.useState)(false);
|
|
1747
1637
|
const [activeUnderlineStyle, setActiveUnderlineStyle] = (0, import_react2.useState)({
|
|
@@ -1749,39 +1639,21 @@ var Tabs = ({
|
|
|
1749
1639
|
width: 0,
|
|
1750
1640
|
opacity: 0
|
|
1751
1641
|
});
|
|
1752
|
-
const [overflowLayout, setOverflowLayout] = (0, import_react2.useState)({
|
|
1753
|
-
visibleItems: items,
|
|
1754
|
-
hiddenItems: []
|
|
1755
|
-
});
|
|
1756
1642
|
const [scrollAffordanceState, setScrollAffordanceState] = (0, import_react2.useState)({
|
|
1757
1643
|
showStart: false,
|
|
1758
1644
|
showEnd: false
|
|
1759
1645
|
});
|
|
1760
|
-
const containerRef = (0, import_react2.useRef)(null);
|
|
1761
1646
|
const tabListRef = (0, import_react2.useRef)(null);
|
|
1762
|
-
const moreButtonMeasureRef = (0, import_react2.useRef)(null);
|
|
1763
|
-
const tabMeasureRefs = (0, import_react2.useRef)(/* @__PURE__ */ new Map());
|
|
1764
1647
|
const isBarVariant = variant === "bar";
|
|
1765
1648
|
const resolvedOverflowBehavior = (0, import_react2.useMemo)(() => {
|
|
1766
1649
|
if (overflowBehavior)
|
|
1767
1650
|
return overflowBehavior;
|
|
1768
1651
|
if (!isBarVariant)
|
|
1769
1652
|
return "scroll";
|
|
1770
|
-
return isMobileViewport ? "select" : "
|
|
1653
|
+
return isMobileViewport ? "select" : "scroll";
|
|
1771
1654
|
}, [isBarVariant, isMobileViewport, overflowBehavior]);
|
|
1772
|
-
const shouldUseOverflowMenu = resolvedOverflowBehavior === "menu";
|
|
1773
1655
|
const shouldUseOverflowScroll = resolvedOverflowBehavior === "scroll";
|
|
1774
1656
|
const shouldUseOverflowSelect = resolvedOverflowBehavior === "select";
|
|
1775
|
-
const handleMeasureTabRef = (0, import_react2.useCallback)(
|
|
1776
|
-
(tabValue, tabElement) => {
|
|
1777
|
-
if (!tabElement) {
|
|
1778
|
-
tabMeasureRefs.current.delete(tabValue);
|
|
1779
|
-
return;
|
|
1780
|
-
}
|
|
1781
|
-
tabMeasureRefs.current.set(tabValue, tabElement);
|
|
1782
|
-
},
|
|
1783
|
-
[]
|
|
1784
|
-
);
|
|
1785
1657
|
(0, import_react2.useEffect)(() => {
|
|
1786
1658
|
if (typeof window === "undefined")
|
|
1787
1659
|
return;
|
|
@@ -1801,55 +1673,6 @@ var Tabs = ({
|
|
|
1801
1673
|
mediaQueryList.removeListener(handleMediaQueryChange);
|
|
1802
1674
|
};
|
|
1803
1675
|
}, []);
|
|
1804
|
-
const handleRecalculateOverflow = (0, import_react2.useCallback)(() => {
|
|
1805
|
-
var _a, _b, _c, _d;
|
|
1806
|
-
if (!shouldUseOverflowMenu) {
|
|
1807
|
-
setOverflowLayout({
|
|
1808
|
-
visibleItems: items,
|
|
1809
|
-
hiddenItems: []
|
|
1810
|
-
});
|
|
1811
|
-
return;
|
|
1812
|
-
}
|
|
1813
|
-
const containerWidth = (_b = (_a = containerRef.current) == null ? void 0 : _a.clientWidth) != null ? _b : 0;
|
|
1814
|
-
const moreButtonWidth = (_d = (_c = moreButtonMeasureRef.current) == null ? void 0 : _c.offsetWidth) != null ? _d : 0;
|
|
1815
|
-
const itemWidthByValue = new Map(
|
|
1816
|
-
items.map((item) => {
|
|
1817
|
-
var _a2, _b2;
|
|
1818
|
-
return [item.value, (_b2 = (_a2 = tabMeasureRefs.current.get(item.value)) == null ? void 0 : _a2.offsetWidth) != null ? _b2 : 0];
|
|
1819
|
-
})
|
|
1820
|
-
);
|
|
1821
|
-
setOverflowLayout(
|
|
1822
|
-
resolveTabsOverflowLayout({
|
|
1823
|
-
items,
|
|
1824
|
-
value,
|
|
1825
|
-
containerWidth,
|
|
1826
|
-
moreButtonWidth,
|
|
1827
|
-
itemWidthByValue
|
|
1828
|
-
})
|
|
1829
|
-
);
|
|
1830
|
-
}, [items, shouldUseOverflowMenu, value]);
|
|
1831
|
-
(0, import_react2.useEffect)(() => {
|
|
1832
|
-
handleRecalculateOverflow();
|
|
1833
|
-
}, [handleRecalculateOverflow]);
|
|
1834
|
-
(0, import_react2.useEffect)(() => {
|
|
1835
|
-
if (!shouldUseOverflowMenu)
|
|
1836
|
-
return;
|
|
1837
|
-
const container = containerRef.current;
|
|
1838
|
-
if (!container || typeof ResizeObserver === "undefined")
|
|
1839
|
-
return;
|
|
1840
|
-
const resizeObserver = new ResizeObserver(() => {
|
|
1841
|
-
handleRecalculateOverflow();
|
|
1842
|
-
});
|
|
1843
|
-
resizeObserver.observe(container);
|
|
1844
|
-
return () => {
|
|
1845
|
-
resizeObserver.disconnect();
|
|
1846
|
-
};
|
|
1847
|
-
}, [handleRecalculateOverflow, shouldUseOverflowMenu]);
|
|
1848
|
-
(0, import_react2.useEffect)(() => {
|
|
1849
|
-
if (overflowLayout.hiddenItems.length > 0)
|
|
1850
|
-
return;
|
|
1851
|
-
setIsMoreMenuOpen(false);
|
|
1852
|
-
}, [overflowLayout.hiddenItems.length]);
|
|
1853
1676
|
const updateScrollAffordances = (0, import_react2.useCallback)(() => {
|
|
1854
1677
|
if (!shouldUseOverflowScroll) {
|
|
1855
1678
|
setScrollAffordanceState({
|
|
@@ -1867,8 +1690,7 @@ var Tabs = ({
|
|
|
1867
1690
|
showEnd: maxScrollLeft - tabListElement.scrollLeft > 4
|
|
1868
1691
|
});
|
|
1869
1692
|
}, [shouldUseOverflowScroll]);
|
|
1870
|
-
const renderedItems =
|
|
1871
|
-
const shouldShowMoreButton = shouldUseOverflowMenu && overflowLayout.hiddenItems.length > 0;
|
|
1693
|
+
const renderedItems = items;
|
|
1872
1694
|
const selectItems = (0, import_react2.useMemo)(() => {
|
|
1873
1695
|
return items.map((item) => ({
|
|
1874
1696
|
value: item.value,
|
|
@@ -1893,24 +1715,24 @@ var Tabs = ({
|
|
|
1893
1715
|
(_a = buttonRefs.current[index]) == null ? void 0 : _a.focus();
|
|
1894
1716
|
};
|
|
1895
1717
|
const handleKeyDown = (event, index) => {
|
|
1896
|
-
switch (event.key) {
|
|
1718
|
+
switch (event == null ? void 0 : event.key) {
|
|
1897
1719
|
case "ArrowRight": {
|
|
1898
|
-
event.preventDefault();
|
|
1720
|
+
event == null ? void 0 : event.preventDefault();
|
|
1899
1721
|
handleMoveFocus(findNextEnabledIndex(renderedItems, index, 1));
|
|
1900
1722
|
return;
|
|
1901
1723
|
}
|
|
1902
1724
|
case "ArrowLeft": {
|
|
1903
|
-
event.preventDefault();
|
|
1725
|
+
event == null ? void 0 : event.preventDefault();
|
|
1904
1726
|
handleMoveFocus(findNextEnabledIndex(renderedItems, index, -1));
|
|
1905
1727
|
return;
|
|
1906
1728
|
}
|
|
1907
1729
|
case "Home": {
|
|
1908
|
-
event.preventDefault();
|
|
1730
|
+
event == null ? void 0 : event.preventDefault();
|
|
1909
1731
|
handleMoveFocus(findEdgeEnabledIndex(renderedItems, 1));
|
|
1910
1732
|
return;
|
|
1911
1733
|
}
|
|
1912
1734
|
case "End": {
|
|
1913
|
-
event.preventDefault();
|
|
1735
|
+
event == null ? void 0 : event.preventDefault();
|
|
1914
1736
|
handleMoveFocus(findEdgeEnabledIndex(renderedItems, -1));
|
|
1915
1737
|
return;
|
|
1916
1738
|
}
|
|
@@ -1918,22 +1740,16 @@ var Tabs = ({
|
|
|
1918
1740
|
return;
|
|
1919
1741
|
}
|
|
1920
1742
|
};
|
|
1921
|
-
const activeHiddenItem = (0, import_react2.useMemo)(() => {
|
|
1922
|
-
if (!shouldUseOverflowMenu)
|
|
1923
|
-
return void 0;
|
|
1924
|
-
return overflowLayout.hiddenItems.find((item) => item.value === value);
|
|
1925
|
-
}, [overflowLayout.hiddenItems, shouldUseOverflowMenu, value]);
|
|
1926
1743
|
const tabListClassName = cn(
|
|
1927
1744
|
"inline-flex items-stretch bg-agg-secondary",
|
|
1928
|
-
|
|
1745
|
+
shouldUseOverflowScroll ? cn(
|
|
1929
1746
|
"overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
1930
1747
|
getMotionClassName(enableAnimations, "scroll-smooth")
|
|
1931
1748
|
) : "overflow-x-auto",
|
|
1932
1749
|
isBarVariant ? "h-8 rounded-agg-sm border border-agg-separator" : "h-12 border-b border-agg-separator -mb-[1px]",
|
|
1933
1750
|
shouldUseOverflowScroll && "select-none",
|
|
1934
1751
|
shouldUseOverflowScroll && !isBarVariant && "snap-x snap-mandatory",
|
|
1935
|
-
shouldUseOverflowScroll && (isDraggingTabs ? "cursor-grabbing" : "cursor-grab")
|
|
1936
|
-
shouldShowMoreButton && isBarVariant && "rounded-r-none border-r-0"
|
|
1752
|
+
shouldUseOverflowScroll && (isDraggingTabs ? "cursor-grabbing" : "cursor-grab")
|
|
1937
1753
|
);
|
|
1938
1754
|
const handleTabListWheel = (event) => {
|
|
1939
1755
|
if (!shouldUseOverflowScroll)
|
|
@@ -2022,14 +1838,10 @@ var Tabs = ({
|
|
|
2022
1838
|
const handleTabListClickCapture = (event) => {
|
|
2023
1839
|
if (!suppressClickRef.current)
|
|
2024
1840
|
return;
|
|
2025
|
-
event.preventDefault();
|
|
2026
|
-
event.stopPropagation();
|
|
1841
|
+
event == null ? void 0 : event.preventDefault();
|
|
1842
|
+
event == null ? void 0 : event.stopPropagation();
|
|
2027
1843
|
suppressClickRef.current = false;
|
|
2028
1844
|
};
|
|
2029
|
-
const handleSelectHiddenItem = (nextValue) => {
|
|
2030
|
-
handleSelect(nextValue);
|
|
2031
|
-
setIsMoreMenuOpen(false);
|
|
2032
|
-
};
|
|
2033
1845
|
const updateActiveUnderline = (0, import_react2.useCallback)(() => {
|
|
2034
1846
|
if (isBarVariant) {
|
|
2035
1847
|
setActiveUnderlineStyle({
|
|
@@ -2097,18 +1909,34 @@ var Tabs = ({
|
|
|
2097
1909
|
(0, import_react2.useEffect)(() => {
|
|
2098
1910
|
if (!shouldUseOverflowScroll)
|
|
2099
1911
|
return;
|
|
1912
|
+
const tabListElement = tabListRef.current;
|
|
1913
|
+
if (!tabListElement)
|
|
1914
|
+
return;
|
|
2100
1915
|
const activeIndex = renderedItems.findIndex((item) => item.value === value);
|
|
2101
1916
|
const activeButton = activeIndex >= 0 ? buttonRefs.current[activeIndex] : null;
|
|
2102
1917
|
if (!activeButton)
|
|
2103
1918
|
return;
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
1919
|
+
if (tabListElement.scrollWidth - tabListElement.clientWidth <= 1)
|
|
1920
|
+
return;
|
|
1921
|
+
const currentScrollLeft = tabListElement.scrollLeft;
|
|
1922
|
+
const currentScrollRight = currentScrollLeft + tabListElement.clientWidth;
|
|
1923
|
+
const activeButtonLeft = activeButton.offsetLeft;
|
|
1924
|
+
const activeButtonRight = activeButtonLeft + activeButton.offsetWidth;
|
|
1925
|
+
let nextScrollLeft = currentScrollLeft;
|
|
1926
|
+
if (activeButtonLeft < currentScrollLeft) {
|
|
1927
|
+
nextScrollLeft = activeButtonLeft;
|
|
1928
|
+
} else if (activeButtonRight > currentScrollRight) {
|
|
1929
|
+
nextScrollLeft = activeButtonRight - tabListElement.clientWidth;
|
|
1930
|
+
}
|
|
1931
|
+
if (Math.abs(nextScrollLeft - currentScrollLeft) < 1)
|
|
1932
|
+
return;
|
|
1933
|
+
tabListElement.scrollTo({
|
|
1934
|
+
left: Math.max(0, nextScrollLeft),
|
|
1935
|
+
behavior: getScrollBehavior(enableAnimations)
|
|
2108
1936
|
});
|
|
2109
1937
|
}, [enableAnimations, renderedItems, shouldUseOverflowScroll, value]);
|
|
2110
1938
|
if (shouldUseOverflowSelect) {
|
|
2111
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
1939
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: cn("w-full", className, classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2112
1940
|
Select,
|
|
2113
1941
|
{
|
|
2114
1942
|
ariaLabel,
|
|
@@ -2123,10 +1951,12 @@ var Tabs = ({
|
|
|
2123
1951
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
2124
1952
|
"div",
|
|
2125
1953
|
{
|
|
2126
|
-
ref: containerRef,
|
|
2127
1954
|
className: cn(
|
|
2128
|
-
"
|
|
2129
|
-
|
|
1955
|
+
"group/agg-tabs",
|
|
1956
|
+
"relative max-w-full items-stretch font-agg-sans bg-agg-secondary",
|
|
1957
|
+
"inline-flex",
|
|
1958
|
+
className,
|
|
1959
|
+
classNames == null ? void 0 : classNames.root
|
|
2130
1960
|
),
|
|
2131
1961
|
children: [
|
|
2132
1962
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
@@ -2135,7 +1965,7 @@ var Tabs = ({
|
|
|
2135
1965
|
ref: tabListRef,
|
|
2136
1966
|
role: "tablist",
|
|
2137
1967
|
"aria-label": resolvedAriaLabel,
|
|
2138
|
-
className: cn("relative", tabListClassName),
|
|
1968
|
+
className: cn("relative", tabListClassName, classNames == null ? void 0 : classNames.tabList),
|
|
2139
1969
|
onClickCapture: handleTabListClickCapture,
|
|
2140
1970
|
onPointerCancel: handleEndTabListDrag,
|
|
2141
1971
|
onPointerDown: handleTabListPointerDown,
|
|
@@ -2157,7 +1987,11 @@ var Tabs = ({
|
|
|
2157
1987
|
"aria-selected": isActive,
|
|
2158
1988
|
"aria-label": item.label,
|
|
2159
1989
|
disabled: item.disabled,
|
|
2160
|
-
onClick: () =>
|
|
1990
|
+
onClick: (e) => {
|
|
1991
|
+
e.preventDefault();
|
|
1992
|
+
e.stopPropagation();
|
|
1993
|
+
handleSelect(item.value);
|
|
1994
|
+
},
|
|
2161
1995
|
onKeyDown: (event) => handleKeyDown(event, index),
|
|
2162
1996
|
className: cn(
|
|
2163
1997
|
getTabButtonClassName({
|
|
@@ -2199,7 +2033,7 @@ var Tabs = ({
|
|
|
2199
2033
|
"pointer-events-none absolute bottom-0 left-0 rounded-t-agg-sm bg-agg-primary",
|
|
2200
2034
|
getMotionClassName(
|
|
2201
2035
|
enableAnimations,
|
|
2202
|
-
"transition-[transform,width,opacity] duration-300 ease-
|
|
2036
|
+
"transition-[transform,width,opacity] duration-300 ease-in-out"
|
|
2203
2037
|
),
|
|
2204
2038
|
"h-[3px]"
|
|
2205
2039
|
),
|
|
@@ -2215,7 +2049,7 @@ var Tabs = ({
|
|
|
2215
2049
|
{
|
|
2216
2050
|
"aria-hidden": true,
|
|
2217
2051
|
className: cn(
|
|
2218
|
-
"pointer-events-none absolute top-0 bottom-0 left-
|
|
2052
|
+
"pointer-events-none absolute top-0 bottom-0 left-8 z-10 w-12 md:w-18 bg-linear-to-r from-agg-secondary via-agg-secondary to-transparent",
|
|
2219
2053
|
getMotionClassName(enableAnimations, "transition-opacity duration-200"),
|
|
2220
2054
|
scrollAffordanceState.showStart ? "opacity-100" : "opacity-0"
|
|
2221
2055
|
)
|
|
@@ -2226,104 +2060,13 @@ var Tabs = ({
|
|
|
2226
2060
|
{
|
|
2227
2061
|
"aria-hidden": true,
|
|
2228
2062
|
className: cn(
|
|
2229
|
-
"pointer-events-none absolute top-0 right-
|
|
2063
|
+
"pointer-events-none absolute top-0 right-8 bottom-0 z-10 w-12 md:w-18 bg-linear-to-l from-agg-secondary via-agg-secondary to-transparent",
|
|
2230
2064
|
getMotionClassName(enableAnimations, "transition-opacity duration-200"),
|
|
2231
2065
|
scrollAffordanceState.showEnd ? "opacity-100" : "opacity-0"
|
|
2232
2066
|
)
|
|
2233
2067
|
}
|
|
2234
2068
|
)
|
|
2235
|
-
] }) : null
|
|
2236
|
-
shouldShowMoreButton ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(DropdownMenu.Root, { open: isMoreMenuOpen, onOpenChange: setIsMoreMenuOpen, children: [
|
|
2237
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2238
|
-
"button",
|
|
2239
|
-
{
|
|
2240
|
-
type: "button",
|
|
2241
|
-
"aria-label": resolvedOverflowMenuAriaLabel,
|
|
2242
|
-
className: cn(
|
|
2243
|
-
getMoreButtonClassName({
|
|
2244
|
-
enableAnimations,
|
|
2245
|
-
isBarVariant,
|
|
2246
|
-
size
|
|
2247
|
-
}),
|
|
2248
|
-
activeHiddenItem ? "font-agg-bold text-agg-primary" : "font-agg-normal text-agg-foreground"
|
|
2249
|
-
),
|
|
2250
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Icon, { name: "dots-horizontal", size: isBarVariant ? "s" : "m", color: "currentColor" })
|
|
2251
|
-
}
|
|
2252
|
-
) }),
|
|
2253
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DropdownMenu.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2254
|
-
DropdownMenu.Content,
|
|
2255
|
-
{
|
|
2256
|
-
align: "end",
|
|
2257
|
-
"aria-label": resolvedOverflowMenuAriaLabel,
|
|
2258
|
-
className: cn(
|
|
2259
|
-
AGG_ROOT_CLASS_NAME,
|
|
2260
|
-
rootClassName,
|
|
2261
|
-
"z-agg-dropdown mt-2 min-w-48 overflow-hidden rounded-agg-md border border-agg-separator bg-agg-secondary shadow-agg-popover outline-none"
|
|
2262
|
-
),
|
|
2263
|
-
"data-agg-animations": enableAnimations ? "true" : "false",
|
|
2264
|
-
sideOffset: 8,
|
|
2265
|
-
children: overflowLayout.hiddenItems.map((item) => {
|
|
2266
|
-
const isSelected = item.value === value;
|
|
2267
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
2268
|
-
DropdownMenu.Item,
|
|
2269
|
-
{
|
|
2270
|
-
disabled: item.disabled,
|
|
2271
|
-
onSelect: () => handleSelectHiddenItem(item.value),
|
|
2272
|
-
className: cn(
|
|
2273
|
-
"cursor-pointer disabled:cursor-not-allowed",
|
|
2274
|
-
"flex w-full items-center gap-2 px-4 py-2 text-left text-agg-sm leading-agg-5 outline-none",
|
|
2275
|
-
getMotionClassName(enableAnimations, "transition-colors"),
|
|
2276
|
-
"focus:bg-agg-secondary-hover data-[highlighted]:bg-agg-secondary-hover",
|
|
2277
|
-
isSelected ? "font-agg-bold text-agg-primary" : "font-agg-normal text-agg-foreground",
|
|
2278
|
-
item.disabled && "cursor-not-allowed opacity-60"
|
|
2279
|
-
),
|
|
2280
|
-
children: [
|
|
2281
|
-
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "inline-flex shrink-0 items-center justify-center", children: item.icon }) : null,
|
|
2282
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "truncate whitespace-nowrap [&::first-letter]:uppercase", children: item.label })
|
|
2283
|
-
]
|
|
2284
|
-
},
|
|
2285
|
-
item.value
|
|
2286
|
-
);
|
|
2287
|
-
})
|
|
2288
|
-
}
|
|
2289
|
-
) })
|
|
2290
|
-
] }) : null,
|
|
2291
|
-
shouldUseOverflowMenu ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
2292
|
-
"div",
|
|
2293
|
-
{
|
|
2294
|
-
"aria-hidden": true,
|
|
2295
|
-
className: "pointer-events-none invisible fixed top-0 left-0 -z-10 h-0 overflow-hidden whitespace-nowrap",
|
|
2296
|
-
children: [
|
|
2297
|
-
items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
2298
|
-
"span",
|
|
2299
|
-
{
|
|
2300
|
-
ref: (tabElement) => handleMeasureTabRef(item.value, tabElement),
|
|
2301
|
-
className: getMeasureTabClassName({
|
|
2302
|
-
isBarVariant,
|
|
2303
|
-
size
|
|
2304
|
-
}),
|
|
2305
|
-
children: [
|
|
2306
|
-
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "inline-flex shrink-0 items-center justify-center", children: item.icon }) : null,
|
|
2307
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: item.label })
|
|
2308
|
-
]
|
|
2309
|
-
},
|
|
2310
|
-
`measure-${item.value}`
|
|
2311
|
-
)),
|
|
2312
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2313
|
-
"span",
|
|
2314
|
-
{
|
|
2315
|
-
ref: moreButtonMeasureRef,
|
|
2316
|
-
className: getMoreButtonClassName({
|
|
2317
|
-
enableAnimations,
|
|
2318
|
-
isBarVariant,
|
|
2319
|
-
size
|
|
2320
|
-
}),
|
|
2321
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Icon, { name: "dots-horizontal", size: isBarVariant ? "s" : "m", color: "currentColor" })
|
|
2322
|
-
}
|
|
2323
|
-
)
|
|
2324
|
-
]
|
|
2325
|
-
}
|
|
2326
|
-
) : null
|
|
2069
|
+
] }) : null
|
|
2327
2070
|
]
|
|
2328
2071
|
}
|
|
2329
2072
|
);
|