@agg-market/ui 1.0.0 → 3.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-H4UIBDL2.mjs → chunk-LK5D3ZTK.mjs} +15 -15
- 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.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 +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1135 -944
- 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.js +231 -466
- package/dist/place-order.mjs +9 -9
- package/dist/profile-modal.js +52 -65
- 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.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/event-list.js
CHANGED
|
@@ -63,10 +63,7 @@ __export(list_exports, {
|
|
|
63
63
|
});
|
|
64
64
|
module.exports = __toCommonJS(list_exports);
|
|
65
65
|
var import_react4 = require("react");
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
// src/constants.ts
|
|
69
|
-
var AGG_ROOT_CLASS_NAME = "agg-root";
|
|
66
|
+
var import_hooks13 = require("@agg-market/hooks");
|
|
70
67
|
|
|
71
68
|
// src/shared/utils.ts
|
|
72
69
|
var cn = (...values) => values.filter(Boolean).join(" ");
|
|
@@ -150,14 +147,10 @@ var ArrowsToDotIcon = (_a) => {
|
|
|
150
147
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
151
148
|
"path",
|
|
152
149
|
{
|
|
153
|
-
d: "M8
|
|
154
|
-
|
|
155
|
-
strokeWidth: "1.25",
|
|
156
|
-
strokeLinecap: "round",
|
|
157
|
-
strokeLinejoin: "round"
|
|
150
|
+
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",
|
|
151
|
+
fill: "currentColor"
|
|
158
152
|
}
|
|
159
|
-
)
|
|
160
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "8", cy: "8", r: "1.5", fill: "currentColor" })
|
|
153
|
+
)
|
|
161
154
|
]
|
|
162
155
|
})
|
|
163
156
|
);
|
|
@@ -691,14 +684,9 @@ InfoIcon.displayName = "InfoIcon";
|
|
|
691
684
|
|
|
692
685
|
// src/primitives/icon/icon.constants.ts
|
|
693
686
|
var iconSizeClasses = {
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
ms: "h-5 w-5",
|
|
698
|
-
m: "h-6 w-6",
|
|
699
|
-
l: "h-8 w-8",
|
|
700
|
-
xl: "h-10 w-10",
|
|
701
|
-
xxl: "h-12 w-12"
|
|
687
|
+
small: "h-4 w-4",
|
|
688
|
+
medium: "h-6 w-6",
|
|
689
|
+
large: "h-8 w-8"
|
|
702
690
|
};
|
|
703
691
|
|
|
704
692
|
// src/primitives/icon/svg/check-badge.tsx
|
|
@@ -1404,7 +1392,7 @@ var Icon = (_a) => {
|
|
|
1404
1392
|
var _b = _a, {
|
|
1405
1393
|
name,
|
|
1406
1394
|
color,
|
|
1407
|
-
size = "
|
|
1395
|
+
size = "medium",
|
|
1408
1396
|
className = "text-agg-primary",
|
|
1409
1397
|
style
|
|
1410
1398
|
} = _b, props = __objRest(_b, [
|
|
@@ -1417,7 +1405,14 @@ var Icon = (_a) => {
|
|
|
1417
1405
|
const Component = iconRegistry[name];
|
|
1418
1406
|
const resolvedStyle = resolveIconStyle(color, style);
|
|
1419
1407
|
const resolvedClassName = cn(iconSizeClasses[size], className);
|
|
1420
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
1408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
1409
|
+
Component,
|
|
1410
|
+
__spreadValues({
|
|
1411
|
+
color,
|
|
1412
|
+
className: cn("group/agg-icon", resolvedClassName),
|
|
1413
|
+
style: resolvedStyle
|
|
1414
|
+
}, props)
|
|
1415
|
+
);
|
|
1421
1416
|
};
|
|
1422
1417
|
Icon.displayName = "Icon";
|
|
1423
1418
|
|
|
@@ -1450,19 +1445,23 @@ var import_hooks3 = require("@agg-market/hooks");
|
|
|
1450
1445
|
var import_hooks2 = require("@agg-market/hooks");
|
|
1451
1446
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
1452
1447
|
var Card = (_a) => {
|
|
1453
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1448
|
+
var _b = _a, { className, onClick } = _b, props = __objRest(_b, ["className", "onClick"]);
|
|
1454
1449
|
const { enableAnimations } = (0, import_hooks2.useSdkUiConfig)();
|
|
1455
1450
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
1456
1451
|
"div",
|
|
1457
|
-
__spreadValues({
|
|
1452
|
+
__spreadValues(__spreadValues({
|
|
1458
1453
|
className: cn(
|
|
1454
|
+
"group/agg-card",
|
|
1459
1455
|
"flex w-full flex-col font-agg-sans",
|
|
1460
1456
|
"rounded-agg-xl border border-agg-separator",
|
|
1461
1457
|
"bg-agg-secondary text-agg-foreground shadow-agg-card",
|
|
1462
|
-
getMotionClassName(
|
|
1458
|
+
getMotionClassName(
|
|
1459
|
+
enableAnimations,
|
|
1460
|
+
"transition-shadow hover:shadow-agg-card-hover duration-300 ease-in-out"
|
|
1461
|
+
),
|
|
1463
1462
|
className
|
|
1464
1463
|
)
|
|
1465
|
-
}, props)
|
|
1464
|
+
}, onClick ? { onClick } : {}), props)
|
|
1466
1465
|
);
|
|
1467
1466
|
};
|
|
1468
1467
|
Card.displayName = "Card";
|
|
@@ -1481,7 +1480,7 @@ var EventListItemSkeletonView = ({
|
|
|
1481
1480
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
1482
1481
|
Card,
|
|
1483
1482
|
{
|
|
1484
|
-
className: cn(baseCardClassName, className),
|
|
1483
|
+
className: cn("group/agg-skeleton", baseCardClassName, className),
|
|
1485
1484
|
role: isStandalone ? "status" : void 0,
|
|
1486
1485
|
"aria-label": isStandalone ? ariaLabel != null ? ariaLabel : labels.eventItem.loading : void 0,
|
|
1487
1486
|
"aria-busy": isStandalone || void 0,
|
|
@@ -1530,7 +1529,7 @@ var EventListSkeletonView = ({ className, ariaLabel }) => {
|
|
|
1530
1529
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
1531
1530
|
"section",
|
|
1532
1531
|
{
|
|
1533
|
-
className: cn("flex w-full flex-col gap-5", className),
|
|
1532
|
+
className: cn("group/agg-skeleton", "flex w-full flex-col gap-5", className),
|
|
1534
1533
|
role: "status",
|
|
1535
1534
|
"aria-label": ariaLabel != null ? ariaLabel : labels.eventList.loading("events"),
|
|
1536
1535
|
"aria-busy": true,
|
|
@@ -1573,7 +1572,7 @@ var EventListItemDetailsSkeletonView = ({
|
|
|
1573
1572
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
1574
1573
|
Card,
|
|
1575
1574
|
{
|
|
1576
|
-
className: cn(detailsBaseCardClassName, className),
|
|
1575
|
+
className: cn("group/agg-skeleton", detailsBaseCardClassName, className),
|
|
1577
1576
|
role: "status",
|
|
1578
1577
|
"aria-label": ariaLabel != null ? ariaLabel : labels.eventItemDetails.loading,
|
|
1579
1578
|
"aria-busy": true,
|
|
@@ -1626,7 +1625,7 @@ var MarketDetailsSkeletonView = ({
|
|
|
1626
1625
|
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
1627
1626
|
Card,
|
|
1628
1627
|
{
|
|
1629
|
-
className: cn(marketDetailsBaseCardClassName, className),
|
|
1628
|
+
className: cn("group/agg-skeleton", marketDetailsBaseCardClassName, className),
|
|
1630
1629
|
role: "status",
|
|
1631
1630
|
"aria-label": ariaLabel != null ? ariaLabel : labels.marketDetails.loading,
|
|
1632
1631
|
"aria-busy": true,
|
|
@@ -1696,7 +1695,7 @@ MarketDetailsSkeletonView.displayName = "MarketDetailsSkeletonView";
|
|
|
1696
1695
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
1697
1696
|
var placeOrderCardClassName = "overflow-hidden rounded-agg-xl border border-agg-border bg-agg-secondary shadow-none hover:shadow-none";
|
|
1698
1697
|
var ContentBody = () => {
|
|
1699
|
-
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-6 p-5", children: [
|
|
1698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: cn("flex flex-col gap-6 p-5"), children: [
|
|
1700
1699
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
1701
1700
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-start justify-between gap-5", children: [
|
|
1702
1701
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-3", children: [
|
|
@@ -1763,7 +1762,7 @@ var PlaceOrderSkeletonView = ({
|
|
|
1763
1762
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
1764
1763
|
"div",
|
|
1765
1764
|
{
|
|
1766
|
-
className: cn("w-full", className),
|
|
1765
|
+
className: cn("group/agg-skeleton", "w-full", className),
|
|
1767
1766
|
role: "status",
|
|
1768
1767
|
"aria-label": ariaLabel != null ? ariaLabel : "Loading place order",
|
|
1769
1768
|
"aria-busy": true,
|
|
@@ -1797,6 +1796,7 @@ var SettlementSkeletonView = ({
|
|
|
1797
1796
|
Card,
|
|
1798
1797
|
{
|
|
1799
1798
|
className: cn(
|
|
1799
|
+
"group/agg-skeleton",
|
|
1800
1800
|
"flex flex-col w-full gap-5 rounded-agg-xl border border-agg-separator bg-agg-secondary p-5 shadow-none hover:shadow-none",
|
|
1801
1801
|
className
|
|
1802
1802
|
),
|
|
@@ -1882,7 +1882,6 @@ Skeleton.displayName = "Skeleton";
|
|
|
1882
1882
|
// src/primitives/tabs/index.tsx
|
|
1883
1883
|
var import_react2 = require("react");
|
|
1884
1884
|
var import_hooks9 = require("@agg-market/hooks");
|
|
1885
|
-
var DropdownMenu = __toESM(require("@radix-ui/react-dropdown-menu"));
|
|
1886
1885
|
|
|
1887
1886
|
// src/primitives/select/index.tsx
|
|
1888
1887
|
var import_react = require("react");
|
|
@@ -1908,7 +1907,7 @@ var Select = ({
|
|
|
1908
1907
|
if (!isOpen)
|
|
1909
1908
|
return;
|
|
1910
1909
|
const handlePointerDown = (e) => {
|
|
1911
|
-
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
1910
|
+
if (containerRef.current && !containerRef.current.contains(e == null ? void 0 : e.target)) {
|
|
1912
1911
|
close();
|
|
1913
1912
|
}
|
|
1914
1913
|
};
|
|
@@ -1919,7 +1918,7 @@ var Select = ({
|
|
|
1919
1918
|
if (!isOpen)
|
|
1920
1919
|
return;
|
|
1921
1920
|
const handleKey = (e) => {
|
|
1922
|
-
if (e.key === "Escape")
|
|
1921
|
+
if ((e == null ? void 0 : e.key) === "Escape")
|
|
1923
1922
|
close();
|
|
1924
1923
|
};
|
|
1925
1924
|
document.addEventListener("keydown", handleKey);
|
|
@@ -1928,7 +1927,7 @@ var Select = ({
|
|
|
1928
1927
|
const isDisabled = disabled || !hasEnabledItems;
|
|
1929
1928
|
const selectedItem = items.find((item) => item.value === value);
|
|
1930
1929
|
if (!hasAnyIcon) {
|
|
1931
|
-
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: cn("relative inline-flex w-full", className), children: [
|
|
1930
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: cn("group/agg-select", "relative inline-flex w-full", className), children: [
|
|
1932
1931
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
1933
1932
|
"select",
|
|
1934
1933
|
{
|
|
@@ -1937,7 +1936,7 @@ var Select = ({
|
|
|
1937
1936
|
"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",
|
|
1938
1937
|
getMotionClassName(
|
|
1939
1938
|
enableAnimations,
|
|
1940
|
-
"transition-[border-color,box-shadow] duration-200 ease-out"
|
|
1939
|
+
"transition-[border-color,box-shadow] duration-200 ease-in-out"
|
|
1941
1940
|
),
|
|
1942
1941
|
"focus:border-agg-primary focus:ring-2 focus:ring-agg-primary/15",
|
|
1943
1942
|
"disabled:cursor-not-allowed disabled:opacity-60"
|
|
@@ -1948,88 +1947,95 @@ var Select = ({
|
|
|
1948
1947
|
children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("option", { value: item.value, disabled: item.disabled, children: item.label }, item.value))
|
|
1949
1948
|
}
|
|
1950
1949
|
),
|
|
1951
|
-
/* @__PURE__ */ (0, import_jsx_runtime52.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_runtime52.jsx)(Icon, { name: "chevron-down", size: "
|
|
1950
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.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_runtime52.jsx)(Icon, { name: "chevron-down", size: "small", color: "currentColor" }) })
|
|
1952
1951
|
] });
|
|
1953
1952
|
}
|
|
1954
|
-
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
children: [
|
|
1975
|
-
(selectedItem == null ? void 0 : selectedItem.iconUrl) ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
1976
|
-
"img",
|
|
1977
|
-
{
|
|
1978
|
-
src: selectedItem.iconUrl,
|
|
1979
|
-
alt: "",
|
|
1980
|
-
className: "h-4 w-4 shrink-0 rounded-sm object-contain"
|
|
1981
|
-
}
|
|
1982
|
-
) : null,
|
|
1983
|
-
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "flex-1 truncate", children: (_a = selectedItem == null ? void 0 : selectedItem.label) != null ? _a : "" })
|
|
1984
|
-
]
|
|
1985
|
-
}
|
|
1986
|
-
),
|
|
1987
|
-
/* @__PURE__ */ (0, import_jsx_runtime52.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_runtime52.jsx)(Icon, { name: "chevron-down", size: "s", color: "currentColor" }) }),
|
|
1988
|
-
isOpen ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
1989
|
-
"div",
|
|
1990
|
-
{
|
|
1991
|
-
role: "listbox",
|
|
1992
|
-
"aria-label": ariaLabel != null ? ariaLabel : labels.common.selectAria,
|
|
1993
|
-
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",
|
|
1994
|
-
children: items.map((item) => {
|
|
1995
|
-
const isSelected = item.value === value;
|
|
1996
|
-
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
1997
|
-
"button",
|
|
1998
|
-
{
|
|
1999
|
-
type: "button",
|
|
2000
|
-
role: "option",
|
|
2001
|
-
"aria-selected": isSelected,
|
|
2002
|
-
disabled: item.disabled,
|
|
2003
|
-
className: cn(
|
|
2004
|
-
"flex w-full items-center gap-2 px-4 py-2 text-left text-agg-sm leading-agg-5 outline-none",
|
|
2005
|
-
"hover:bg-agg-secondary-hover focus-visible:bg-agg-secondary-hover",
|
|
2006
|
-
isSelected ? "font-agg-bold text-agg-primary" : "font-agg-normal text-agg-foreground",
|
|
2007
|
-
item.disabled && "cursor-not-allowed opacity-60"
|
|
1953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
1954
|
+
"div",
|
|
1955
|
+
{
|
|
1956
|
+
ref: containerRef,
|
|
1957
|
+
className: cn("group/agg-select", "relative inline-flex w-full", className),
|
|
1958
|
+
children: [
|
|
1959
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
1960
|
+
"button",
|
|
1961
|
+
{
|
|
1962
|
+
type: "button",
|
|
1963
|
+
"aria-label": ariaLabel != null ? ariaLabel : labels.common.selectAria,
|
|
1964
|
+
"aria-expanded": isOpen,
|
|
1965
|
+
"aria-haspopup": "listbox",
|
|
1966
|
+
disabled: isDisabled,
|
|
1967
|
+
className: cn(
|
|
1968
|
+
"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",
|
|
1969
|
+
"flex items-center gap-2 text-left",
|
|
1970
|
+
getMotionClassName(
|
|
1971
|
+
enableAnimations,
|
|
1972
|
+
"transition-[border-color,box-shadow] duration-200 ease-in-out"
|
|
2008
1973
|
),
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
1974
|
+
"focus:border-agg-primary focus:ring-2 focus:ring-agg-primary/15",
|
|
1975
|
+
"disabled:cursor-not-allowed disabled:opacity-60"
|
|
1976
|
+
),
|
|
1977
|
+
onClick: () => setIsOpen((prev) => !prev),
|
|
1978
|
+
children: [
|
|
1979
|
+
(selectedItem == null ? void 0 : selectedItem.iconUrl) ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
1980
|
+
"img",
|
|
1981
|
+
{
|
|
1982
|
+
src: selectedItem.iconUrl,
|
|
1983
|
+
alt: "",
|
|
1984
|
+
className: "h-4 w-4 shrink-0 rounded-sm object-contain"
|
|
2013
1985
|
}
|
|
2014
|
-
|
|
2015
|
-
children:
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
1986
|
+
) : null,
|
|
1987
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "flex-1 truncate", children: (_a = selectedItem == null ? void 0 : selectedItem.label) != null ? _a : "" })
|
|
1988
|
+
]
|
|
1989
|
+
}
|
|
1990
|
+
),
|
|
1991
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.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_runtime52.jsx)(Icon, { name: "chevron-down", size: "small", color: "currentColor" }) }),
|
|
1992
|
+
isOpen ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
1993
|
+
"div",
|
|
1994
|
+
{
|
|
1995
|
+
role: "listbox",
|
|
1996
|
+
"aria-label": ariaLabel != null ? ariaLabel : labels.common.selectAria,
|
|
1997
|
+
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",
|
|
1998
|
+
children: items.map((item) => {
|
|
1999
|
+
const isSelected = item.value === value;
|
|
2000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
2001
|
+
"button",
|
|
2002
|
+
{
|
|
2003
|
+
type: "button",
|
|
2004
|
+
role: "option",
|
|
2005
|
+
"aria-selected": isSelected,
|
|
2006
|
+
disabled: item.disabled,
|
|
2007
|
+
className: cn(
|
|
2008
|
+
"flex w-full items-center gap-2 px-4 py-2 text-left text-agg-sm leading-agg-5 outline-none",
|
|
2009
|
+
"hover:bg-agg-secondary-hover focus-visible:bg-agg-secondary-hover",
|
|
2010
|
+
isSelected ? "font-agg-bold text-agg-primary" : "font-agg-normal text-agg-foreground",
|
|
2011
|
+
item.disabled && "cursor-not-allowed opacity-60"
|
|
2012
|
+
),
|
|
2013
|
+
onClick: () => {
|
|
2014
|
+
if (!item.disabled) {
|
|
2015
|
+
onChange(item.value);
|
|
2016
|
+
close();
|
|
2017
|
+
}
|
|
2018
|
+
},
|
|
2019
|
+
children: [
|
|
2020
|
+
item.iconUrl ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
2021
|
+
"img",
|
|
2022
|
+
{
|
|
2023
|
+
src: item.iconUrl,
|
|
2024
|
+
alt: "",
|
|
2025
|
+
className: "h-4 w-4 shrink-0 rounded-sm object-contain"
|
|
2026
|
+
}
|
|
2027
|
+
) : null,
|
|
2028
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "truncate", children: item.label })
|
|
2029
|
+
]
|
|
2030
|
+
},
|
|
2031
|
+
item.value
|
|
2032
|
+
);
|
|
2033
|
+
})
|
|
2034
|
+
}
|
|
2035
|
+
) : null
|
|
2036
|
+
]
|
|
2037
|
+
}
|
|
2038
|
+
);
|
|
2033
2039
|
};
|
|
2034
2040
|
Select.displayName = "Select";
|
|
2035
2041
|
|
|
@@ -2056,86 +2062,10 @@ var findEdgeEnabledIndex = (items, direction) => {
|
|
|
2056
2062
|
}
|
|
2057
2063
|
return -1;
|
|
2058
2064
|
};
|
|
2059
|
-
var FALLBACK_TAB_WIDTH = 112;
|
|
2060
|
-
var FALLBACK_MORE_WIDTH = 56;
|
|
2061
|
-
var sumWidths = (indices, widths) => {
|
|
2062
|
-
return [...indices].reduce((accumulator, index) => {
|
|
2063
|
-
var _a;
|
|
2064
|
-
return accumulator + ((_a = widths[index]) != null ? _a : 0);
|
|
2065
|
-
}, 0);
|
|
2066
|
-
};
|
|
2067
|
-
var resolveTabsOverflowLayout = ({
|
|
2068
|
-
items,
|
|
2069
|
-
value,
|
|
2070
|
-
containerWidth,
|
|
2071
|
-
moreButtonWidth,
|
|
2072
|
-
itemWidthByValue
|
|
2073
|
-
}) => {
|
|
2074
|
-
var _a;
|
|
2075
|
-
if (items.length === 0) {
|
|
2076
|
-
return {
|
|
2077
|
-
visibleItems: [],
|
|
2078
|
-
hiddenItems: []
|
|
2079
|
-
};
|
|
2080
|
-
}
|
|
2081
|
-
if (!Number.isFinite(containerWidth) || containerWidth <= 0) {
|
|
2082
|
-
return {
|
|
2083
|
-
visibleItems: items,
|
|
2084
|
-
hiddenItems: []
|
|
2085
|
-
};
|
|
2086
|
-
}
|
|
2087
|
-
const resolvedItemWidths = items.map((item) => {
|
|
2088
|
-
var _a2;
|
|
2089
|
-
const measuredWidth = (_a2 = itemWidthByValue.get(item.value)) != null ? _a2 : FALLBACK_TAB_WIDTH;
|
|
2090
|
-
return Math.max(1, measuredWidth);
|
|
2091
|
-
});
|
|
2092
|
-
const totalItemsWidth = resolvedItemWidths.reduce((sum, width) => {
|
|
2093
|
-
return sum + width;
|
|
2094
|
-
}, 0);
|
|
2095
|
-
if (totalItemsWidth <= containerWidth) {
|
|
2096
|
-
return {
|
|
2097
|
-
visibleItems: items,
|
|
2098
|
-
hiddenItems: []
|
|
2099
|
-
};
|
|
2100
|
-
}
|
|
2101
|
-
const reservedMoreWidth = Math.max(1, moreButtonWidth || FALLBACK_MORE_WIDTH);
|
|
2102
|
-
const visibleIndices = /* @__PURE__ */ new Set();
|
|
2103
|
-
let usedWidth = 0;
|
|
2104
|
-
for (let index = 0; index < items.length; index += 1) {
|
|
2105
|
-
const itemWidth = (_a = resolvedItemWidths[index]) != null ? _a : FALLBACK_TAB_WIDTH;
|
|
2106
|
-
const hasRemainingItems = index < items.length - 1;
|
|
2107
|
-
const requiredExtraWidth = hasRemainingItems ? reservedMoreWidth : 0;
|
|
2108
|
-
if (usedWidth + itemWidth + requiredExtraWidth > containerWidth)
|
|
2109
|
-
break;
|
|
2110
|
-
visibleIndices.add(index);
|
|
2111
|
-
usedWidth += itemWidth;
|
|
2112
|
-
}
|
|
2113
|
-
if (visibleIndices.size === 0) {
|
|
2114
|
-
visibleIndices.add(0);
|
|
2115
|
-
}
|
|
2116
|
-
const activeIndex = items.findIndex((item) => item.value === value);
|
|
2117
|
-
const isActiveHidden = activeIndex >= 0 && !visibleIndices.has(activeIndex);
|
|
2118
|
-
if (isActiveHidden && activeIndex >= 0) {
|
|
2119
|
-
visibleIndices.add(activeIndex);
|
|
2120
|
-
while (visibleIndices.size > 1) {
|
|
2121
|
-
const visibleWidth = sumWidths(visibleIndices, resolvedItemWidths);
|
|
2122
|
-
if (visibleWidth + reservedMoreWidth <= containerWidth)
|
|
2123
|
-
break;
|
|
2124
|
-
const removableIndex = [...visibleIndices].sort((left, right) => right - left).find((index) => index !== activeIndex);
|
|
2125
|
-
if (removableIndex == null)
|
|
2126
|
-
break;
|
|
2127
|
-
visibleIndices.delete(removableIndex);
|
|
2128
|
-
}
|
|
2129
|
-
}
|
|
2130
|
-
return {
|
|
2131
|
-
visibleItems: items.filter((_, index) => visibleIndices.has(index)),
|
|
2132
|
-
hiddenItems: items.filter((_, index) => !visibleIndices.has(index))
|
|
2133
|
-
};
|
|
2134
|
-
};
|
|
2135
2065
|
|
|
2136
2066
|
// src/primitives/tabs/index.tsx
|
|
2137
2067
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
2138
|
-
var mobileTabsMediaQuery = "(max-width:
|
|
2068
|
+
var mobileTabsMediaQuery = "(max-width: 512px)";
|
|
2139
2069
|
var getTabButtonClassName = ({
|
|
2140
2070
|
enableAnimations,
|
|
2141
2071
|
isBarVariant,
|
|
@@ -2147,7 +2077,11 @@ var getTabButtonClassName = ({
|
|
|
2147
2077
|
return cn(
|
|
2148
2078
|
"cursor-pointer disabled:cursor-not-allowed",
|
|
2149
2079
|
"relative inline-flex h-full shrink-0 items-center justify-center gap-2 font-agg-sans",
|
|
2150
|
-
|
|
2080
|
+
isBarVariant ? "hover:text-agg-foreground hover:bg-agg-secondary-hover" : "hover:text-agg-foreground hover:font-bold",
|
|
2081
|
+
getMotionClassName(
|
|
2082
|
+
enableAnimations,
|
|
2083
|
+
"transition-[colors] duration-300 ease-in-out motion-reduce:transition-none"
|
|
2084
|
+
),
|
|
2151
2085
|
isBarVariant ? cn(
|
|
2152
2086
|
"min-w-20 overflow-hidden border-r border-agg-separator last:border-r-0",
|
|
2153
2087
|
isSmall ? "px-3 text-agg-sm leading-agg-5" : "px-4 text-agg-base leading-agg-6"
|
|
@@ -2159,35 +2093,6 @@ var getTabButtonClassName = ({
|
|
|
2159
2093
|
isDisabled && "cursor-not-allowed opacity-60"
|
|
2160
2094
|
);
|
|
2161
2095
|
};
|
|
2162
|
-
var getMeasureTabClassName = ({
|
|
2163
|
-
isBarVariant,
|
|
2164
|
-
size
|
|
2165
|
-
}) => {
|
|
2166
|
-
const isSmall = size === "s";
|
|
2167
|
-
return cn(
|
|
2168
|
-
"relative inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap font-agg-sans",
|
|
2169
|
-
isBarVariant ? cn(
|
|
2170
|
-
"h-8 min-w-20 border-r border-agg-separator font-agg-bold",
|
|
2171
|
-
isSmall ? "px-3 text-agg-sm leading-agg-5" : "px-4 text-agg-base leading-agg-6"
|
|
2172
|
-
) : cn(
|
|
2173
|
-
"h-12 font-agg-bold",
|
|
2174
|
-
isSmall ? "px-4 text-agg-sm leading-agg-5" : "px-5 text-agg-base leading-agg-6"
|
|
2175
|
-
)
|
|
2176
|
-
);
|
|
2177
|
-
};
|
|
2178
|
-
var getMoreButtonClassName = ({
|
|
2179
|
-
enableAnimations,
|
|
2180
|
-
isBarVariant,
|
|
2181
|
-
size
|
|
2182
|
-
}) => {
|
|
2183
|
-
const isSmall = size === "s";
|
|
2184
|
-
return cn(
|
|
2185
|
-
"cursor-pointer disabled:cursor-not-allowed",
|
|
2186
|
-
"relative inline-flex shrink-0 items-center justify-center overflow-hidden font-agg-sans text-agg-foreground hover:bg-agg-secondary-hover",
|
|
2187
|
-
getMotionClassName(enableAnimations, "transition-colors motion-reduce:transition-none"),
|
|
2188
|
-
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")
|
|
2189
|
-
);
|
|
2190
|
-
};
|
|
2191
2096
|
var Tabs = ({
|
|
2192
2097
|
items,
|
|
2193
2098
|
value,
|
|
@@ -2195,12 +2100,12 @@ var Tabs = ({
|
|
|
2195
2100
|
variant = "bar",
|
|
2196
2101
|
size = "m",
|
|
2197
2102
|
overflowBehavior,
|
|
2198
|
-
overflowMenuAriaLabel,
|
|
2199
2103
|
ariaLabel,
|
|
2200
|
-
className
|
|
2104
|
+
className,
|
|
2105
|
+
classNames
|
|
2201
2106
|
}) => {
|
|
2202
2107
|
const labels = (0, import_hooks9.useLabels)();
|
|
2203
|
-
const { enableAnimations
|
|
2108
|
+
const { enableAnimations } = (0, import_hooks9.useSdkUiConfig)();
|
|
2204
2109
|
const buttonRefs = (0, import_react2.useRef)([]);
|
|
2205
2110
|
const dragStateRef = (0, import_react2.useRef)({
|
|
2206
2111
|
isPointerDown: false,
|
|
@@ -2212,8 +2117,6 @@ var Tabs = ({
|
|
|
2212
2117
|
});
|
|
2213
2118
|
const suppressClickRef = (0, import_react2.useRef)(false);
|
|
2214
2119
|
const resolvedAriaLabel = ariaLabel != null ? ariaLabel : labels.common.tabsAria;
|
|
2215
|
-
const resolvedOverflowMenuAriaLabel = overflowMenuAriaLabel != null ? overflowMenuAriaLabel : labels.common.hiddenTabsAria;
|
|
2216
|
-
const [isMoreMenuOpen, setIsMoreMenuOpen] = (0, import_react2.useState)(false);
|
|
2217
2120
|
const [isMobileViewport, setIsMobileViewport] = (0, import_react2.useState)(false);
|
|
2218
2121
|
const [isDraggingTabs, setIsDraggingTabs] = (0, import_react2.useState)(false);
|
|
2219
2122
|
const [activeUnderlineStyle, setActiveUnderlineStyle] = (0, import_react2.useState)({
|
|
@@ -2221,39 +2124,21 @@ var Tabs = ({
|
|
|
2221
2124
|
width: 0,
|
|
2222
2125
|
opacity: 0
|
|
2223
2126
|
});
|
|
2224
|
-
const [overflowLayout, setOverflowLayout] = (0, import_react2.useState)({
|
|
2225
|
-
visibleItems: items,
|
|
2226
|
-
hiddenItems: []
|
|
2227
|
-
});
|
|
2228
2127
|
const [scrollAffordanceState, setScrollAffordanceState] = (0, import_react2.useState)({
|
|
2229
2128
|
showStart: false,
|
|
2230
2129
|
showEnd: false
|
|
2231
2130
|
});
|
|
2232
|
-
const containerRef = (0, import_react2.useRef)(null);
|
|
2233
2131
|
const tabListRef = (0, import_react2.useRef)(null);
|
|
2234
|
-
const moreButtonMeasureRef = (0, import_react2.useRef)(null);
|
|
2235
|
-
const tabMeasureRefs = (0, import_react2.useRef)(/* @__PURE__ */ new Map());
|
|
2236
2132
|
const isBarVariant = variant === "bar";
|
|
2237
2133
|
const resolvedOverflowBehavior = (0, import_react2.useMemo)(() => {
|
|
2238
2134
|
if (overflowBehavior)
|
|
2239
2135
|
return overflowBehavior;
|
|
2240
2136
|
if (!isBarVariant)
|
|
2241
2137
|
return "scroll";
|
|
2242
|
-
return isMobileViewport ? "select" : "
|
|
2138
|
+
return isMobileViewport ? "select" : "scroll";
|
|
2243
2139
|
}, [isBarVariant, isMobileViewport, overflowBehavior]);
|
|
2244
|
-
const shouldUseOverflowMenu = resolvedOverflowBehavior === "menu";
|
|
2245
2140
|
const shouldUseOverflowScroll = resolvedOverflowBehavior === "scroll";
|
|
2246
2141
|
const shouldUseOverflowSelect = resolvedOverflowBehavior === "select";
|
|
2247
|
-
const handleMeasureTabRef = (0, import_react2.useCallback)(
|
|
2248
|
-
(tabValue, tabElement) => {
|
|
2249
|
-
if (!tabElement) {
|
|
2250
|
-
tabMeasureRefs.current.delete(tabValue);
|
|
2251
|
-
return;
|
|
2252
|
-
}
|
|
2253
|
-
tabMeasureRefs.current.set(tabValue, tabElement);
|
|
2254
|
-
},
|
|
2255
|
-
[]
|
|
2256
|
-
);
|
|
2257
2142
|
(0, import_react2.useEffect)(() => {
|
|
2258
2143
|
if (typeof window === "undefined")
|
|
2259
2144
|
return;
|
|
@@ -2273,55 +2158,6 @@ var Tabs = ({
|
|
|
2273
2158
|
mediaQueryList.removeListener(handleMediaQueryChange);
|
|
2274
2159
|
};
|
|
2275
2160
|
}, []);
|
|
2276
|
-
const handleRecalculateOverflow = (0, import_react2.useCallback)(() => {
|
|
2277
|
-
var _a, _b, _c, _d;
|
|
2278
|
-
if (!shouldUseOverflowMenu) {
|
|
2279
|
-
setOverflowLayout({
|
|
2280
|
-
visibleItems: items,
|
|
2281
|
-
hiddenItems: []
|
|
2282
|
-
});
|
|
2283
|
-
return;
|
|
2284
|
-
}
|
|
2285
|
-
const containerWidth = (_b = (_a = containerRef.current) == null ? void 0 : _a.clientWidth) != null ? _b : 0;
|
|
2286
|
-
const moreButtonWidth = (_d = (_c = moreButtonMeasureRef.current) == null ? void 0 : _c.offsetWidth) != null ? _d : 0;
|
|
2287
|
-
const itemWidthByValue = new Map(
|
|
2288
|
-
items.map((item) => {
|
|
2289
|
-
var _a2, _b2;
|
|
2290
|
-
return [item.value, (_b2 = (_a2 = tabMeasureRefs.current.get(item.value)) == null ? void 0 : _a2.offsetWidth) != null ? _b2 : 0];
|
|
2291
|
-
})
|
|
2292
|
-
);
|
|
2293
|
-
setOverflowLayout(
|
|
2294
|
-
resolveTabsOverflowLayout({
|
|
2295
|
-
items,
|
|
2296
|
-
value,
|
|
2297
|
-
containerWidth,
|
|
2298
|
-
moreButtonWidth,
|
|
2299
|
-
itemWidthByValue
|
|
2300
|
-
})
|
|
2301
|
-
);
|
|
2302
|
-
}, [items, shouldUseOverflowMenu, value]);
|
|
2303
|
-
(0, import_react2.useEffect)(() => {
|
|
2304
|
-
handleRecalculateOverflow();
|
|
2305
|
-
}, [handleRecalculateOverflow]);
|
|
2306
|
-
(0, import_react2.useEffect)(() => {
|
|
2307
|
-
if (!shouldUseOverflowMenu)
|
|
2308
|
-
return;
|
|
2309
|
-
const container = containerRef.current;
|
|
2310
|
-
if (!container || typeof ResizeObserver === "undefined")
|
|
2311
|
-
return;
|
|
2312
|
-
const resizeObserver = new ResizeObserver(() => {
|
|
2313
|
-
handleRecalculateOverflow();
|
|
2314
|
-
});
|
|
2315
|
-
resizeObserver.observe(container);
|
|
2316
|
-
return () => {
|
|
2317
|
-
resizeObserver.disconnect();
|
|
2318
|
-
};
|
|
2319
|
-
}, [handleRecalculateOverflow, shouldUseOverflowMenu]);
|
|
2320
|
-
(0, import_react2.useEffect)(() => {
|
|
2321
|
-
if (overflowLayout.hiddenItems.length > 0)
|
|
2322
|
-
return;
|
|
2323
|
-
setIsMoreMenuOpen(false);
|
|
2324
|
-
}, [overflowLayout.hiddenItems.length]);
|
|
2325
2161
|
const updateScrollAffordances = (0, import_react2.useCallback)(() => {
|
|
2326
2162
|
if (!shouldUseOverflowScroll) {
|
|
2327
2163
|
setScrollAffordanceState({
|
|
@@ -2339,8 +2175,7 @@ var Tabs = ({
|
|
|
2339
2175
|
showEnd: maxScrollLeft - tabListElement.scrollLeft > 4
|
|
2340
2176
|
});
|
|
2341
2177
|
}, [shouldUseOverflowScroll]);
|
|
2342
|
-
const renderedItems =
|
|
2343
|
-
const shouldShowMoreButton = shouldUseOverflowMenu && overflowLayout.hiddenItems.length > 0;
|
|
2178
|
+
const renderedItems = items;
|
|
2344
2179
|
const selectItems = (0, import_react2.useMemo)(() => {
|
|
2345
2180
|
return items.map((item) => ({
|
|
2346
2181
|
value: item.value,
|
|
@@ -2365,24 +2200,24 @@ var Tabs = ({
|
|
|
2365
2200
|
(_a = buttonRefs.current[index]) == null ? void 0 : _a.focus();
|
|
2366
2201
|
};
|
|
2367
2202
|
const handleKeyDown = (event, index) => {
|
|
2368
|
-
switch (event.key) {
|
|
2203
|
+
switch (event == null ? void 0 : event.key) {
|
|
2369
2204
|
case "ArrowRight": {
|
|
2370
|
-
event.preventDefault();
|
|
2205
|
+
event == null ? void 0 : event.preventDefault();
|
|
2371
2206
|
handleMoveFocus(findNextEnabledIndex(renderedItems, index, 1));
|
|
2372
2207
|
return;
|
|
2373
2208
|
}
|
|
2374
2209
|
case "ArrowLeft": {
|
|
2375
|
-
event.preventDefault();
|
|
2210
|
+
event == null ? void 0 : event.preventDefault();
|
|
2376
2211
|
handleMoveFocus(findNextEnabledIndex(renderedItems, index, -1));
|
|
2377
2212
|
return;
|
|
2378
2213
|
}
|
|
2379
2214
|
case "Home": {
|
|
2380
|
-
event.preventDefault();
|
|
2215
|
+
event == null ? void 0 : event.preventDefault();
|
|
2381
2216
|
handleMoveFocus(findEdgeEnabledIndex(renderedItems, 1));
|
|
2382
2217
|
return;
|
|
2383
2218
|
}
|
|
2384
2219
|
case "End": {
|
|
2385
|
-
event.preventDefault();
|
|
2220
|
+
event == null ? void 0 : event.preventDefault();
|
|
2386
2221
|
handleMoveFocus(findEdgeEnabledIndex(renderedItems, -1));
|
|
2387
2222
|
return;
|
|
2388
2223
|
}
|
|
@@ -2390,22 +2225,16 @@ var Tabs = ({
|
|
|
2390
2225
|
return;
|
|
2391
2226
|
}
|
|
2392
2227
|
};
|
|
2393
|
-
const activeHiddenItem = (0, import_react2.useMemo)(() => {
|
|
2394
|
-
if (!shouldUseOverflowMenu)
|
|
2395
|
-
return void 0;
|
|
2396
|
-
return overflowLayout.hiddenItems.find((item) => item.value === value);
|
|
2397
|
-
}, [overflowLayout.hiddenItems, shouldUseOverflowMenu, value]);
|
|
2398
2228
|
const tabListClassName = cn(
|
|
2399
2229
|
"inline-flex items-stretch bg-agg-secondary",
|
|
2400
|
-
|
|
2230
|
+
shouldUseOverflowScroll ? cn(
|
|
2401
2231
|
"overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
2402
2232
|
getMotionClassName(enableAnimations, "scroll-smooth")
|
|
2403
2233
|
) : "overflow-x-auto",
|
|
2404
2234
|
isBarVariant ? "h-8 rounded-agg-sm border border-agg-separator" : "h-12 border-b border-agg-separator -mb-[1px]",
|
|
2405
2235
|
shouldUseOverflowScroll && "select-none",
|
|
2406
2236
|
shouldUseOverflowScroll && !isBarVariant && "snap-x snap-mandatory",
|
|
2407
|
-
shouldUseOverflowScroll && (isDraggingTabs ? "cursor-grabbing" : "cursor-grab")
|
|
2408
|
-
shouldShowMoreButton && isBarVariant && "rounded-r-none border-r-0"
|
|
2237
|
+
shouldUseOverflowScroll && (isDraggingTabs ? "cursor-grabbing" : "cursor-grab")
|
|
2409
2238
|
);
|
|
2410
2239
|
const handleTabListWheel = (event) => {
|
|
2411
2240
|
if (!shouldUseOverflowScroll)
|
|
@@ -2494,14 +2323,10 @@ var Tabs = ({
|
|
|
2494
2323
|
const handleTabListClickCapture = (event) => {
|
|
2495
2324
|
if (!suppressClickRef.current)
|
|
2496
2325
|
return;
|
|
2497
|
-
event.preventDefault();
|
|
2498
|
-
event.stopPropagation();
|
|
2326
|
+
event == null ? void 0 : event.preventDefault();
|
|
2327
|
+
event == null ? void 0 : event.stopPropagation();
|
|
2499
2328
|
suppressClickRef.current = false;
|
|
2500
2329
|
};
|
|
2501
|
-
const handleSelectHiddenItem = (nextValue) => {
|
|
2502
|
-
handleSelect(nextValue);
|
|
2503
|
-
setIsMoreMenuOpen(false);
|
|
2504
|
-
};
|
|
2505
2330
|
const updateActiveUnderline = (0, import_react2.useCallback)(() => {
|
|
2506
2331
|
if (isBarVariant) {
|
|
2507
2332
|
setActiveUnderlineStyle({
|
|
@@ -2569,18 +2394,34 @@ var Tabs = ({
|
|
|
2569
2394
|
(0, import_react2.useEffect)(() => {
|
|
2570
2395
|
if (!shouldUseOverflowScroll)
|
|
2571
2396
|
return;
|
|
2397
|
+
const tabListElement = tabListRef.current;
|
|
2398
|
+
if (!tabListElement)
|
|
2399
|
+
return;
|
|
2572
2400
|
const activeIndex = renderedItems.findIndex((item) => item.value === value);
|
|
2573
2401
|
const activeButton = activeIndex >= 0 ? buttonRefs.current[activeIndex] : null;
|
|
2574
2402
|
if (!activeButton)
|
|
2575
2403
|
return;
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2404
|
+
if (tabListElement.scrollWidth - tabListElement.clientWidth <= 1)
|
|
2405
|
+
return;
|
|
2406
|
+
const currentScrollLeft = tabListElement.scrollLeft;
|
|
2407
|
+
const currentScrollRight = currentScrollLeft + tabListElement.clientWidth;
|
|
2408
|
+
const activeButtonLeft = activeButton.offsetLeft;
|
|
2409
|
+
const activeButtonRight = activeButtonLeft + activeButton.offsetWidth;
|
|
2410
|
+
let nextScrollLeft = currentScrollLeft;
|
|
2411
|
+
if (activeButtonLeft < currentScrollLeft) {
|
|
2412
|
+
nextScrollLeft = activeButtonLeft;
|
|
2413
|
+
} else if (activeButtonRight > currentScrollRight) {
|
|
2414
|
+
nextScrollLeft = activeButtonRight - tabListElement.clientWidth;
|
|
2415
|
+
}
|
|
2416
|
+
if (Math.abs(nextScrollLeft - currentScrollLeft) < 1)
|
|
2417
|
+
return;
|
|
2418
|
+
tabListElement.scrollTo({
|
|
2419
|
+
left: Math.max(0, nextScrollLeft),
|
|
2420
|
+
behavior: getScrollBehavior(enableAnimations)
|
|
2580
2421
|
});
|
|
2581
2422
|
}, [enableAnimations, renderedItems, shouldUseOverflowScroll, value]);
|
|
2582
2423
|
if (shouldUseOverflowSelect) {
|
|
2583
|
-
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: cn("w-full", className, classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2584
2425
|
Select,
|
|
2585
2426
|
{
|
|
2586
2427
|
ariaLabel,
|
|
@@ -2595,10 +2436,12 @@ var Tabs = ({
|
|
|
2595
2436
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
2596
2437
|
"div",
|
|
2597
2438
|
{
|
|
2598
|
-
ref: containerRef,
|
|
2599
2439
|
className: cn(
|
|
2600
|
-
"
|
|
2601
|
-
|
|
2440
|
+
"group/agg-tabs",
|
|
2441
|
+
"relative max-w-full items-stretch font-agg-sans bg-agg-secondary",
|
|
2442
|
+
"inline-flex",
|
|
2443
|
+
className,
|
|
2444
|
+
classNames == null ? void 0 : classNames.root
|
|
2602
2445
|
),
|
|
2603
2446
|
children: [
|
|
2604
2447
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
@@ -2607,7 +2450,7 @@ var Tabs = ({
|
|
|
2607
2450
|
ref: tabListRef,
|
|
2608
2451
|
role: "tablist",
|
|
2609
2452
|
"aria-label": resolvedAriaLabel,
|
|
2610
|
-
className: cn("relative", tabListClassName),
|
|
2453
|
+
className: cn("relative", tabListClassName, classNames == null ? void 0 : classNames.tabList),
|
|
2611
2454
|
onClickCapture: handleTabListClickCapture,
|
|
2612
2455
|
onPointerCancel: handleEndTabListDrag,
|
|
2613
2456
|
onPointerDown: handleTabListPointerDown,
|
|
@@ -2629,7 +2472,11 @@ var Tabs = ({
|
|
|
2629
2472
|
"aria-selected": isActive,
|
|
2630
2473
|
"aria-label": item.label,
|
|
2631
2474
|
disabled: item.disabled,
|
|
2632
|
-
onClick: () =>
|
|
2475
|
+
onClick: (e) => {
|
|
2476
|
+
e.preventDefault();
|
|
2477
|
+
e.stopPropagation();
|
|
2478
|
+
handleSelect(item.value);
|
|
2479
|
+
},
|
|
2633
2480
|
onKeyDown: (event) => handleKeyDown(event, index),
|
|
2634
2481
|
className: cn(
|
|
2635
2482
|
getTabButtonClassName({
|
|
@@ -2671,7 +2518,7 @@ var Tabs = ({
|
|
|
2671
2518
|
"pointer-events-none absolute bottom-0 left-0 rounded-t-agg-sm bg-agg-primary",
|
|
2672
2519
|
getMotionClassName(
|
|
2673
2520
|
enableAnimations,
|
|
2674
|
-
"transition-[transform,width,opacity] duration-300 ease-
|
|
2521
|
+
"transition-[transform,width,opacity] duration-300 ease-in-out"
|
|
2675
2522
|
),
|
|
2676
2523
|
"h-[3px]"
|
|
2677
2524
|
),
|
|
@@ -2687,7 +2534,7 @@ var Tabs = ({
|
|
|
2687
2534
|
{
|
|
2688
2535
|
"aria-hidden": true,
|
|
2689
2536
|
className: cn(
|
|
2690
|
-
"pointer-events-none absolute top-0 bottom-0 left-
|
|
2537
|
+
"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",
|
|
2691
2538
|
getMotionClassName(enableAnimations, "transition-opacity duration-200"),
|
|
2692
2539
|
scrollAffordanceState.showStart ? "opacity-100" : "opacity-0"
|
|
2693
2540
|
)
|
|
@@ -2698,104 +2545,13 @@ var Tabs = ({
|
|
|
2698
2545
|
{
|
|
2699
2546
|
"aria-hidden": true,
|
|
2700
2547
|
className: cn(
|
|
2701
|
-
"pointer-events-none absolute top-0 right-
|
|
2548
|
+
"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",
|
|
2702
2549
|
getMotionClassName(enableAnimations, "transition-opacity duration-200"),
|
|
2703
2550
|
scrollAffordanceState.showEnd ? "opacity-100" : "opacity-0"
|
|
2704
2551
|
)
|
|
2705
2552
|
}
|
|
2706
2553
|
)
|
|
2707
|
-
] }) : null
|
|
2708
|
-
shouldShowMoreButton ? /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(DropdownMenu.Root, { open: isMoreMenuOpen, onOpenChange: setIsMoreMenuOpen, children: [
|
|
2709
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2710
|
-
"button",
|
|
2711
|
-
{
|
|
2712
|
-
type: "button",
|
|
2713
|
-
"aria-label": resolvedOverflowMenuAriaLabel,
|
|
2714
|
-
className: cn(
|
|
2715
|
-
getMoreButtonClassName({
|
|
2716
|
-
enableAnimations,
|
|
2717
|
-
isBarVariant,
|
|
2718
|
-
size
|
|
2719
|
-
}),
|
|
2720
|
-
activeHiddenItem ? "font-agg-bold text-agg-primary" : "font-agg-normal text-agg-foreground"
|
|
2721
|
-
),
|
|
2722
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Icon, { name: "dots-horizontal", size: isBarVariant ? "s" : "m", color: "currentColor" })
|
|
2723
|
-
}
|
|
2724
|
-
) }),
|
|
2725
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(DropdownMenu.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2726
|
-
DropdownMenu.Content,
|
|
2727
|
-
{
|
|
2728
|
-
align: "end",
|
|
2729
|
-
"aria-label": resolvedOverflowMenuAriaLabel,
|
|
2730
|
-
className: cn(
|
|
2731
|
-
AGG_ROOT_CLASS_NAME,
|
|
2732
|
-
rootClassName,
|
|
2733
|
-
"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"
|
|
2734
|
-
),
|
|
2735
|
-
"data-agg-animations": enableAnimations ? "true" : "false",
|
|
2736
|
-
sideOffset: 8,
|
|
2737
|
-
children: overflowLayout.hiddenItems.map((item) => {
|
|
2738
|
-
const isSelected = item.value === value;
|
|
2739
|
-
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
2740
|
-
DropdownMenu.Item,
|
|
2741
|
-
{
|
|
2742
|
-
disabled: item.disabled,
|
|
2743
|
-
onSelect: () => handleSelectHiddenItem(item.value),
|
|
2744
|
-
className: cn(
|
|
2745
|
-
"cursor-pointer disabled:cursor-not-allowed",
|
|
2746
|
-
"flex w-full items-center gap-2 px-4 py-2 text-left text-agg-sm leading-agg-5 outline-none",
|
|
2747
|
-
getMotionClassName(enableAnimations, "transition-colors"),
|
|
2748
|
-
"focus:bg-agg-secondary-hover data-[highlighted]:bg-agg-secondary-hover",
|
|
2749
|
-
isSelected ? "font-agg-bold text-agg-primary" : "font-agg-normal text-agg-foreground",
|
|
2750
|
-
item.disabled && "cursor-not-allowed opacity-60"
|
|
2751
|
-
),
|
|
2752
|
-
children: [
|
|
2753
|
-
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "inline-flex shrink-0 items-center justify-center", children: item.icon }) : null,
|
|
2754
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "truncate whitespace-nowrap [&::first-letter]:uppercase", children: item.label })
|
|
2755
|
-
]
|
|
2756
|
-
},
|
|
2757
|
-
item.value
|
|
2758
|
-
);
|
|
2759
|
-
})
|
|
2760
|
-
}
|
|
2761
|
-
) })
|
|
2762
|
-
] }) : null,
|
|
2763
|
-
shouldUseOverflowMenu ? /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
2764
|
-
"div",
|
|
2765
|
-
{
|
|
2766
|
-
"aria-hidden": true,
|
|
2767
|
-
className: "pointer-events-none invisible fixed top-0 left-0 -z-10 h-0 overflow-hidden whitespace-nowrap",
|
|
2768
|
-
children: [
|
|
2769
|
-
items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
2770
|
-
"span",
|
|
2771
|
-
{
|
|
2772
|
-
ref: (tabElement) => handleMeasureTabRef(item.value, tabElement),
|
|
2773
|
-
className: getMeasureTabClassName({
|
|
2774
|
-
isBarVariant,
|
|
2775
|
-
size
|
|
2776
|
-
}),
|
|
2777
|
-
children: [
|
|
2778
|
-
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "inline-flex shrink-0 items-center justify-center", children: item.icon }) : null,
|
|
2779
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: item.label })
|
|
2780
|
-
]
|
|
2781
|
-
},
|
|
2782
|
-
`measure-${item.value}`
|
|
2783
|
-
)),
|
|
2784
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2785
|
-
"span",
|
|
2786
|
-
{
|
|
2787
|
-
ref: moreButtonMeasureRef,
|
|
2788
|
-
className: getMoreButtonClassName({
|
|
2789
|
-
enableAnimations,
|
|
2790
|
-
isBarVariant,
|
|
2791
|
-
size
|
|
2792
|
-
}),
|
|
2793
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Icon, { name: "dots-horizontal", size: isBarVariant ? "s" : "m", color: "currentColor" })
|
|
2794
|
-
}
|
|
2795
|
-
)
|
|
2796
|
-
]
|
|
2797
|
-
}
|
|
2798
|
-
) : null
|
|
2554
|
+
] }) : null
|
|
2799
2555
|
]
|
|
2800
2556
|
}
|
|
2801
2557
|
);
|
|
@@ -2803,21 +2559,22 @@ var Tabs = ({
|
|
|
2803
2559
|
Tabs.displayName = "Tabs";
|
|
2804
2560
|
|
|
2805
2561
|
// src/primitives/typography/typography.constants.ts
|
|
2806
|
-
var
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
),
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
),
|
|
2819
|
-
|
|
2820
|
-
caption: cn("
|
|
2562
|
+
var typographyVariantClasses = {
|
|
2563
|
+
display: cn("agg-type-display"),
|
|
2564
|
+
heading: cn("agg-type-heading"),
|
|
2565
|
+
title: cn("agg-type-title"),
|
|
2566
|
+
"title-strong": cn("agg-type-title-strong"),
|
|
2567
|
+
"body-large": cn("agg-type-body-large"),
|
|
2568
|
+
"body-large-strong": cn("agg-type-body-large-strong"),
|
|
2569
|
+
body: cn("agg-type-body"),
|
|
2570
|
+
"body-strong": cn("agg-type-body-strong"),
|
|
2571
|
+
label: cn("agg-type-label"),
|
|
2572
|
+
"label-strong": cn("agg-type-label-strong"),
|
|
2573
|
+
"label-caps": cn("agg-type-label-caps"),
|
|
2574
|
+
caption: cn("agg-type-caption"),
|
|
2575
|
+
"caption-strong": cn("agg-type-caption-strong"),
|
|
2576
|
+
"caption-caps": cn("agg-type-caption-caps"),
|
|
2577
|
+
overline: cn("agg-type-overline")
|
|
2821
2578
|
};
|
|
2822
2579
|
|
|
2823
2580
|
// src/primitives/typography/index.tsx
|
|
@@ -2828,7 +2585,18 @@ var Typography = ({
|
|
|
2828
2585
|
className,
|
|
2829
2586
|
children
|
|
2830
2587
|
}) => {
|
|
2831
|
-
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
2588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
2589
|
+
Component,
|
|
2590
|
+
{
|
|
2591
|
+
className: cn(
|
|
2592
|
+
"group/agg-typography",
|
|
2593
|
+
"text-agg-foreground",
|
|
2594
|
+
typographyVariantClasses[variant],
|
|
2595
|
+
className
|
|
2596
|
+
),
|
|
2597
|
+
children
|
|
2598
|
+
}
|
|
2599
|
+
);
|
|
2832
2600
|
};
|
|
2833
2601
|
Typography.displayName = "Typography";
|
|
2834
2602
|
|
|
@@ -2836,7 +2604,7 @@ Typography.displayName = "Typography";
|
|
|
2836
2604
|
var import_hooks10 = require("@agg-market/hooks");
|
|
2837
2605
|
|
|
2838
2606
|
// src/primitives/venue-logo/logo-props.ts
|
|
2839
|
-
var DEFAULT_MONOCHROME_COLOR = "
|
|
2607
|
+
var DEFAULT_MONOCHROME_COLOR = "currentColor";
|
|
2840
2608
|
var resolveLogoPrimaryColor = ({
|
|
2841
2609
|
brandColor,
|
|
2842
2610
|
isColor = true,
|
|
@@ -3034,14 +2802,9 @@ var venueLogoRegistry = {
|
|
|
3034
2802
|
};
|
|
3035
2803
|
var venueLogoNames = Object.keys(venueLogoRegistry);
|
|
3036
2804
|
var sizeClasses = {
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
ms: "h-5 w-5",
|
|
3041
|
-
m: "h-6 w-6",
|
|
3042
|
-
l: "h-8 w-8",
|
|
3043
|
-
xl: "h-10 w-10",
|
|
3044
|
-
xxl: "h-12 w-12"
|
|
2805
|
+
small: "h-4 w-4",
|
|
2806
|
+
medium: "h-6 w-6",
|
|
2807
|
+
large: "h-8 w-8"
|
|
3045
2808
|
};
|
|
3046
2809
|
|
|
3047
2810
|
// src/primitives/venue-logo/index.tsx
|
|
@@ -3051,7 +2814,7 @@ var VenueLogo = ({
|
|
|
3051
2814
|
isColor = true,
|
|
3052
2815
|
isMonochromatic = false,
|
|
3053
2816
|
color,
|
|
3054
|
-
size = "
|
|
2817
|
+
size = "medium",
|
|
3055
2818
|
className,
|
|
3056
2819
|
ariaLabel,
|
|
3057
2820
|
title
|
|
@@ -3063,7 +2826,7 @@ var VenueLogo = ({
|
|
|
3063
2826
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
3064
2827
|
Component,
|
|
3065
2828
|
{
|
|
3066
|
-
className: cn("shrink-0", sizeClass, className),
|
|
2829
|
+
className: cn("group/agg-venue-logo", "shrink-0", sizeClass, className),
|
|
3067
2830
|
isColor: resolvedIsColor,
|
|
3068
2831
|
color,
|
|
3069
2832
|
"aria-label": ariaLabel != null ? ariaLabel : labels.venues[venue],
|
|
@@ -3076,17 +2839,16 @@ VenueLogo.displayName = "VenueLogo";
|
|
|
3076
2839
|
// src/events/item/index.tsx
|
|
3077
2840
|
var import_dayjs = __toESM(require("dayjs"));
|
|
3078
2841
|
var import_react3 = require("react");
|
|
2842
|
+
var import_hooks12 = require("@agg-market/hooks");
|
|
2843
|
+
|
|
2844
|
+
// src/primitives/badge/index.tsx
|
|
3079
2845
|
var import_hooks11 = require("@agg-market/hooks");
|
|
3080
2846
|
|
|
3081
2847
|
// src/primitives/badge/badge.constants.ts
|
|
3082
2848
|
var badgeSizeClasses = {
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
m: cn("h-7 px-3 gap-1.5", "text-agg-sm leading-agg-5"),
|
|
3087
|
-
l: cn("h-8 px-3.5 gap-1.5", "text-agg-base leading-agg-6"),
|
|
3088
|
-
xl: cn("h-9 px-4 gap-2", "text-agg-lg leading-agg-7"),
|
|
3089
|
-
xxl: cn("h-10 px-5 gap-2", "text-agg-xl leading-agg-7")
|
|
2849
|
+
small: cn("py-1.5 px-4 gap-1.5", "agg-type-label"),
|
|
2850
|
+
medium: cn("py-1.5 px-4 gap-2", "agg-type-body"),
|
|
2851
|
+
large: cn("py-2.5 px-6 gap-2", "agg-type-body")
|
|
3090
2852
|
};
|
|
3091
2853
|
var baseBadgeClasses = cn(
|
|
3092
2854
|
"inline-flex items-center justify-center rounded-agg-full font-agg-sans",
|
|
@@ -3095,20 +2857,41 @@ var baseBadgeClasses = cn(
|
|
|
3095
2857
|
|
|
3096
2858
|
// src/primitives/badge/index.tsx
|
|
3097
2859
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
3098
|
-
function Badge({
|
|
2860
|
+
function Badge({
|
|
2861
|
+
text,
|
|
2862
|
+
prefix,
|
|
2863
|
+
suffix,
|
|
2864
|
+
size = "medium",
|
|
2865
|
+
classNames,
|
|
2866
|
+
onClick,
|
|
2867
|
+
isActive = false
|
|
2868
|
+
}) {
|
|
2869
|
+
const { enableAnimations } = (0, import_hooks11.useSdkUiConfig)();
|
|
3099
2870
|
const resolvedText = `${text}`;
|
|
3100
2871
|
const resolvedAriaLabel = resolvedText.length > 0 ? resolvedText : void 0;
|
|
3101
2872
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
3102
2873
|
"span",
|
|
3103
|
-
{
|
|
2874
|
+
__spreadProps(__spreadValues({
|
|
3104
2875
|
"aria-label": resolvedAriaLabel,
|
|
3105
|
-
className: cn(
|
|
2876
|
+
className: cn(
|
|
2877
|
+
"group/agg-badge",
|
|
2878
|
+
baseBadgeClasses,
|
|
2879
|
+
badgeSizeClasses[size],
|
|
2880
|
+
onClick ? "cursor-pointer hover:bg-agg-tertiary disabled:cursor-not-allowed" : "",
|
|
2881
|
+
getMotionClassName(
|
|
2882
|
+
enableAnimations,
|
|
2883
|
+
"transition-[border-color,background-color] duration-200 ease-in-out"
|
|
2884
|
+
),
|
|
2885
|
+
isActive ? "border-agg-primary bg-agg-secondary! font-agg-bold!" : "border-transparent font-agg-normal",
|
|
2886
|
+
classNames == null ? void 0 : classNames.root
|
|
2887
|
+
)
|
|
2888
|
+
}, onClick && { onClick }), {
|
|
3106
2889
|
children: [
|
|
3107
2890
|
prefix ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: classNames == null ? void 0 : classNames.prefix, children: prefix }) : null,
|
|
3108
2891
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: cn("truncate", classNames == null ? void 0 : classNames.text), children: text }),
|
|
3109
2892
|
suffix ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: classNames == null ? void 0 : classNames.suffix, children: suffix }) : null
|
|
3110
2893
|
]
|
|
3111
|
-
}
|
|
2894
|
+
})
|
|
3112
2895
|
);
|
|
3113
2896
|
}
|
|
3114
2897
|
Badge.displayName = "Badge";
|
|
@@ -3272,7 +3055,7 @@ var EventListItemLoadingState = ({
|
|
|
3272
3055
|
classNames,
|
|
3273
3056
|
ariaLabel
|
|
3274
3057
|
}) => {
|
|
3275
|
-
const labels = (0,
|
|
3058
|
+
const labels = (0, import_hooks12.useLabels)();
|
|
3276
3059
|
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
3277
3060
|
Skeleton,
|
|
3278
3061
|
{
|
|
@@ -3286,7 +3069,7 @@ var EventListItemUnavailableState = ({
|
|
|
3286
3069
|
classNames,
|
|
3287
3070
|
ariaLabel
|
|
3288
3071
|
}) => {
|
|
3289
|
-
const labels = (0,
|
|
3072
|
+
const labels = (0, import_hooks12.useLabels)();
|
|
3290
3073
|
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
3291
3074
|
Card,
|
|
3292
3075
|
{
|
|
@@ -3294,7 +3077,7 @@ var EventListItemUnavailableState = ({
|
|
|
3294
3077
|
role: "status",
|
|
3295
3078
|
"aria-label": ariaLabel != null ? ariaLabel : labels.eventItem.unavailableAria,
|
|
3296
3079
|
children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: cn("flex flex-col gap-1", classNames == null ? void 0 : classNames.header), children: [
|
|
3297
|
-
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Typography, { variant: "
|
|
3080
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Typography, { variant: "body-large-strong", className: cn("truncate", classNames == null ? void 0 : classNames.title), children: labels.eventItem.unavailableTitle }),
|
|
3298
3081
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Typography, { variant: "body", className: "text-agg-muted-foreground", children: labels.eventItem.unavailableDescription })
|
|
3299
3082
|
] })
|
|
3300
3083
|
}
|
|
@@ -3313,8 +3096,8 @@ var EventListItemContent = ({
|
|
|
3313
3096
|
ariaLabel
|
|
3314
3097
|
}) => {
|
|
3315
3098
|
var _a;
|
|
3316
|
-
const config = (0,
|
|
3317
|
-
const labels = (0,
|
|
3099
|
+
const config = (0, import_hooks12.useSdkUiConfig)();
|
|
3100
|
+
const labels = (0, import_hooks12.useLabels)();
|
|
3318
3101
|
const allVenueMarkets = (0, import_react3.useMemo)(() => {
|
|
3319
3102
|
return event.markets.flatMap((market) => market.venueMarkets);
|
|
3320
3103
|
}, [event.markets]);
|
|
@@ -3338,8 +3121,8 @@ var EventListItemContent = ({
|
|
|
3338
3121
|
const handleKeyDown = (eventToHandle) => {
|
|
3339
3122
|
if (!onClick)
|
|
3340
3123
|
return;
|
|
3341
|
-
if (eventToHandle.key === "Enter" || eventToHandle.key === " ") {
|
|
3342
|
-
eventToHandle.preventDefault();
|
|
3124
|
+
if ((eventToHandle == null ? void 0 : eventToHandle.key) === "Enter" || (eventToHandle == null ? void 0 : eventToHandle.key) === " ") {
|
|
3125
|
+
eventToHandle == null ? void 0 : eventToHandle.preventDefault();
|
|
3343
3126
|
onClick();
|
|
3344
3127
|
}
|
|
3345
3128
|
};
|
|
@@ -3348,9 +3131,17 @@ var EventListItemContent = ({
|
|
|
3348
3131
|
return null;
|
|
3349
3132
|
if (Math.abs(value) < config.arbitrageThreshold)
|
|
3350
3133
|
return null;
|
|
3351
|
-
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: cn("flex items-
|
|
3352
|
-
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Typography, { variant: "label", className: "text-agg-success", children: config.formatPercent(value) }),
|
|
3353
|
-
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
3134
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: cn("flex items-center gap-1", "text-agg-success"), children: [
|
|
3135
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Typography, { variant: "label-strong", className: "text-agg-success", children: config.formatPercent(value) }),
|
|
3136
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
3137
|
+
Icon,
|
|
3138
|
+
{
|
|
3139
|
+
name: "triangle-up",
|
|
3140
|
+
size: "small",
|
|
3141
|
+
title: labels.eventItem.arbitrage,
|
|
3142
|
+
className: "size-2!"
|
|
3143
|
+
}
|
|
3144
|
+
)
|
|
3354
3145
|
] });
|
|
3355
3146
|
};
|
|
3356
3147
|
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
@@ -3375,9 +3166,10 @@ var EventListItemContent = ({
|
|
|
3375
3166
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
3376
3167
|
Typography,
|
|
3377
3168
|
{
|
|
3378
|
-
variant: "
|
|
3169
|
+
variant: "body-strong",
|
|
3379
3170
|
className: cn(
|
|
3380
|
-
"min-w-0 text-agg-base font-agg-bold leading-agg-6
|
|
3171
|
+
"min-w-0 text-agg-base font-agg-bold leading-agg-6 ",
|
|
3172
|
+
"truncate text-wrap wrap-break-word line-clamp-2",
|
|
3381
3173
|
classNames == null ? void 0 : classNames.title
|
|
3382
3174
|
),
|
|
3383
3175
|
children: resolvedTitle
|
|
@@ -3394,7 +3186,7 @@ var EventListItemContent = ({
|
|
|
3394
3186
|
"div",
|
|
3395
3187
|
{
|
|
3396
3188
|
className: cn(
|
|
3397
|
-
"
|
|
3189
|
+
"flex flex-row gap-3 w-full items-center justify-between",
|
|
3398
3190
|
classNames == null ? void 0 : classNames.outcomeRow
|
|
3399
3191
|
),
|
|
3400
3192
|
children: [
|
|
@@ -3406,21 +3198,23 @@ var EventListItemContent = ({
|
|
|
3406
3198
|
children: formattedTitle
|
|
3407
3199
|
}
|
|
3408
3200
|
),
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3201
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex flex-row gap-3 items-center justify-end", children: [
|
|
3202
|
+
renderArbitrage(arbitragePercent),
|
|
3203
|
+
showBadge ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
3204
|
+
Badge,
|
|
3205
|
+
{
|
|
3206
|
+
text: config.formatPercent(probability),
|
|
3207
|
+
prefix: showVenueLogo ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(VenueLogo, { venue: visibleOutcome.venue, size: "small" }) : void 0,
|
|
3208
|
+
size: "large",
|
|
3209
|
+
classNames: {
|
|
3210
|
+
root: cn(
|
|
3211
|
+
"h-9 min-w-[101px] justify-center px-4 text-agg-base leading-agg-6",
|
|
3212
|
+
classNames == null ? void 0 : classNames.badge
|
|
3213
|
+
)
|
|
3214
|
+
}
|
|
3421
3215
|
}
|
|
3422
|
-
|
|
3423
|
-
)
|
|
3216
|
+
) : null
|
|
3217
|
+
] })
|
|
3424
3218
|
]
|
|
3425
3219
|
},
|
|
3426
3220
|
`${visibleOutcome.market.id}-${visibleOutcome.outcome.id}`
|
|
@@ -3435,7 +3229,7 @@ var EventListItemContent = ({
|
|
|
3435
3229
|
classNames == null ? void 0 : classNames.footer
|
|
3436
3230
|
),
|
|
3437
3231
|
children: [
|
|
3438
|
-
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: cn("flex items-center gap-
|
|
3232
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: cn("flex items-center gap-1", "text-agg-sm leading-agg-5"), children: [
|
|
3439
3233
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "truncate text-agg-muted-foreground", children: formatCountLabel(
|
|
3440
3234
|
marketCount,
|
|
3441
3235
|
labels.eventItem.marketSingular,
|
|
@@ -3443,16 +3237,33 @@ var EventListItemContent = ({
|
|
|
3443
3237
|
) }),
|
|
3444
3238
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "text-agg-muted-foreground", children: "\xD7" }),
|
|
3445
3239
|
singleVenue ? /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("span", { className: "flex items-center gap-1 truncate text-agg-muted-foreground", children: [
|
|
3446
|
-
showVenueLogo ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
3240
|
+
showVenueLogo ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
3241
|
+
VenueLogo,
|
|
3242
|
+
{
|
|
3243
|
+
venue: singleVenue,
|
|
3244
|
+
size: "small",
|
|
3245
|
+
isMonochromatic: true,
|
|
3246
|
+
className: "text-agg-muted-foreground!"
|
|
3247
|
+
}
|
|
3248
|
+
) : null,
|
|
3447
3249
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { children: venueLabel })
|
|
3448
3250
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "truncate text-agg-muted-foreground", children: formatCountLabel(
|
|
3449
3251
|
venueCount,
|
|
3450
3252
|
labels.eventItem.venueSingular,
|
|
3451
3253
|
labels.eventItem.venuePlural
|
|
3452
3254
|
) }),
|
|
3453
|
-
showVenueLogo && !singleVenue && visibleVenueLogos.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "flex items-center gap-1 overflow-hidden", children: visibleVenueLogos.map((venue) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
3255
|
+
showVenueLogo && !singleVenue && visibleVenueLogos.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "flex items-center gap-1 overflow-hidden", children: visibleVenueLogos.map((venue) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
3256
|
+
VenueLogo,
|
|
3257
|
+
{
|
|
3258
|
+
venue,
|
|
3259
|
+
size: "small",
|
|
3260
|
+
isMonochromatic: true,
|
|
3261
|
+
className: "text-agg-muted-foreground!"
|
|
3262
|
+
},
|
|
3263
|
+
venue
|
|
3264
|
+
)) }) : null
|
|
3454
3265
|
] }),
|
|
3455
|
-
volumeLabel ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Typography, { variant: "
|
|
3266
|
+
volumeLabel ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Typography, { variant: "label", className: "text-agg-sm text-agg-muted-foreground", children: volumeLabel }) : null
|
|
3456
3267
|
]
|
|
3457
3268
|
}
|
|
3458
3269
|
)
|
|
@@ -3470,7 +3281,7 @@ var EventListItemByEventId = (_a) => {
|
|
|
3470
3281
|
event: fetchedEvent,
|
|
3471
3282
|
isError,
|
|
3472
3283
|
isLoading
|
|
3473
|
-
} = (0,
|
|
3284
|
+
} = (0, import_hooks12.useEvent)(eventId, {
|
|
3474
3285
|
enabled: !!eventId
|
|
3475
3286
|
});
|
|
3476
3287
|
const resolvedEvent = (0, import_react3.useMemo)(() => {
|
|
@@ -3566,7 +3377,7 @@ var resolveTabVenus = (tab) => {
|
|
|
3566
3377
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
3567
3378
|
var renderTabIcon = (tab, isActive) => {
|
|
3568
3379
|
if (tab.venueLogo) {
|
|
3569
|
-
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(VenueLogo, { venue: tab.venueLogo, size: "
|
|
3380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(VenueLogo, { venue: tab.venueLogo, size: "small" });
|
|
3570
3381
|
}
|
|
3571
3382
|
if (!tab.iconName)
|
|
3572
3383
|
return null;
|
|
@@ -3574,11 +3385,37 @@ var renderTabIcon = (tab, isActive) => {
|
|
|
3574
3385
|
Icon,
|
|
3575
3386
|
{
|
|
3576
3387
|
name: tab.iconName,
|
|
3577
|
-
size: "
|
|
3388
|
+
size: "small",
|
|
3578
3389
|
color: isActive ? "var(--agg-color-primary)" : "var(--agg-color-foreground)"
|
|
3579
3390
|
}
|
|
3580
3391
|
);
|
|
3581
3392
|
};
|
|
3393
|
+
var TAB_MIN_WIDTH = 80;
|
|
3394
|
+
var TAB_HORIZONTAL_PADDING = 32;
|
|
3395
|
+
var TAB_ICON_AND_GAP_WIDTH = 24;
|
|
3396
|
+
var TAB_OUTER_BORDER_WIDTH = 2;
|
|
3397
|
+
var TAB_INNER_BORDER_WIDTH = 1;
|
|
3398
|
+
var measureTabLabelWidth = (label) => {
|
|
3399
|
+
if (typeof document === "undefined")
|
|
3400
|
+
return label.length * 9;
|
|
3401
|
+
const canvas = document.createElement("canvas");
|
|
3402
|
+
const context = canvas.getContext("2d");
|
|
3403
|
+
if (!context)
|
|
3404
|
+
return label.length * 9;
|
|
3405
|
+
context.font = "700 16px Inter";
|
|
3406
|
+
return context.measureText(label).width;
|
|
3407
|
+
};
|
|
3408
|
+
var estimateTabsWidth = (items) => {
|
|
3409
|
+
if (items.length === 0)
|
|
3410
|
+
return 0;
|
|
3411
|
+
const tabsWidth = items.reduce((sum, item) => {
|
|
3412
|
+
const textWidth = Math.ceil(measureTabLabelWidth(item.label));
|
|
3413
|
+
const iconWidth = item.icon ? TAB_ICON_AND_GAP_WIDTH : 0;
|
|
3414
|
+
const buttonWidth = Math.max(TAB_MIN_WIDTH, textWidth + iconWidth + TAB_HORIZONTAL_PADDING);
|
|
3415
|
+
return sum + buttonWidth;
|
|
3416
|
+
}, 0);
|
|
3417
|
+
return tabsWidth + TAB_OUTER_BORDER_WIDTH + (items.length - 1) * TAB_INNER_BORDER_WIDTH;
|
|
3418
|
+
};
|
|
3582
3419
|
var EventList = ({
|
|
3583
3420
|
title,
|
|
3584
3421
|
maxItemsPerRow = 3,
|
|
@@ -3589,13 +3426,14 @@ var EventList = ({
|
|
|
3589
3426
|
categoryIds
|
|
3590
3427
|
}) => {
|
|
3591
3428
|
var _a, _b;
|
|
3592
|
-
const labels = (0,
|
|
3429
|
+
const labels = (0, import_hooks13.useLabels)();
|
|
3593
3430
|
const defaultEventListTabs = (0, import_react4.useMemo)(() => {
|
|
3594
3431
|
return getDefaultEventListTabs(labels);
|
|
3595
3432
|
}, [labels]);
|
|
3596
3433
|
const [activeTabValue, setActiveTabValue] = (0, import_react4.useState)(
|
|
3597
3434
|
(_b = (_a = defaultEventListTabs[0]) == null ? void 0 : _a.value) != null ? _b : "matched"
|
|
3598
3435
|
);
|
|
3436
|
+
const [shouldUseSelectOverflow, setShouldUseSelectOverflow] = (0, import_react4.useState)(false);
|
|
3599
3437
|
const activeTab = (0, import_react4.useMemo)(() => {
|
|
3600
3438
|
return defaultEventListTabs.find((tab) => tab.value === activeTabValue);
|
|
3601
3439
|
}, [activeTabValue]);
|
|
@@ -3609,7 +3447,7 @@ var EventList = ({
|
|
|
3609
3447
|
}, [maxVisibleItems]);
|
|
3610
3448
|
const requestLimit = resolvedMaxVisibleItems != null ? resolvedMaxVisibleItems : limit;
|
|
3611
3449
|
const shouldPaginate = resolvedMaxVisibleItems == null;
|
|
3612
|
-
const { events, isLoading, isError, fetchNextPage, hasNextPage, isFetchingNextPage } = (0,
|
|
3450
|
+
const { events, isLoading, isError, fetchNextPage, hasNextPage, isFetchingNextPage } = (0, import_hooks13.useEvents)({
|
|
3613
3451
|
venues,
|
|
3614
3452
|
search,
|
|
3615
3453
|
categoryIds,
|
|
@@ -3635,6 +3473,46 @@ var EventList = ({
|
|
|
3635
3473
|
};
|
|
3636
3474
|
});
|
|
3637
3475
|
}, [activeTabValue]);
|
|
3476
|
+
const headerRef = (0, import_react4.useRef)(null);
|
|
3477
|
+
const titleRef = (0, import_react4.useRef)(null);
|
|
3478
|
+
const updateTabsOverflowBehavior = (0, import_react4.useCallback)(() => {
|
|
3479
|
+
if (typeof window === "undefined")
|
|
3480
|
+
return;
|
|
3481
|
+
const headerElement = headerRef.current;
|
|
3482
|
+
const titleElement = titleRef.current;
|
|
3483
|
+
if (!headerElement || !titleElement)
|
|
3484
|
+
return;
|
|
3485
|
+
const isDesktop = window.matchMedia("(min-width: 768px)").matches;
|
|
3486
|
+
if (!isDesktop) {
|
|
3487
|
+
setShouldUseSelectOverflow(false);
|
|
3488
|
+
return;
|
|
3489
|
+
}
|
|
3490
|
+
const headerStyles = window.getComputedStyle(headerElement);
|
|
3491
|
+
const rawGap = headerStyles.columnGap || headerStyles.gap || "0";
|
|
3492
|
+
const horizontalGap = Number.parseFloat(rawGap) || 0;
|
|
3493
|
+
const availableTabsWidth = headerElement.clientWidth - titleElement.getBoundingClientRect().width - horizontalGap;
|
|
3494
|
+
const estimatedTabsWidth = estimateTabsWidth(tabsItems);
|
|
3495
|
+
setShouldUseSelectOverflow(availableTabsWidth > 0 && estimatedTabsWidth > availableTabsWidth);
|
|
3496
|
+
}, [tabsItems]);
|
|
3497
|
+
(0, import_react4.useEffect)(() => {
|
|
3498
|
+
updateTabsOverflowBehavior();
|
|
3499
|
+
}, [updateTabsOverflowBehavior]);
|
|
3500
|
+
(0, import_react4.useEffect)(() => {
|
|
3501
|
+
if (typeof ResizeObserver === "undefined")
|
|
3502
|
+
return;
|
|
3503
|
+
const headerElement = headerRef.current;
|
|
3504
|
+
const titleElement = titleRef.current;
|
|
3505
|
+
if (!headerElement || !titleElement)
|
|
3506
|
+
return;
|
|
3507
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
3508
|
+
updateTabsOverflowBehavior();
|
|
3509
|
+
});
|
|
3510
|
+
resizeObserver.observe(headerElement);
|
|
3511
|
+
resizeObserver.observe(titleElement);
|
|
3512
|
+
return () => {
|
|
3513
|
+
resizeObserver.disconnect();
|
|
3514
|
+
};
|
|
3515
|
+
}, [updateTabsOverflowBehavior]);
|
|
3638
3516
|
const resolvedMaxItemsPerRow = Number.isFinite(maxItemsPerRow) ? Math.max(1, Math.floor(maxItemsPerRow)) : 1;
|
|
3639
3517
|
const loadingPlaceholderCount = isFetchingNextPage ? Math.min(resolvedMaxItemsPerRow, resolvedMaxVisibleItems != null ? resolvedMaxVisibleItems : Infinity) : 0;
|
|
3640
3518
|
const shouldRenderLoadingState = isLoading && tileEvents.length === 0;
|
|
@@ -3676,19 +3554,25 @@ var EventList = ({
|
|
|
3676
3554
|
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Skeleton, { view: "event-list", ariaLabel: labels.eventList.loading(title) });
|
|
3677
3555
|
}
|
|
3678
3556
|
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("section", { className: "flex w-full flex-col gap-5", children: [
|
|
3679
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
className: "
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3557
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
3558
|
+
"header",
|
|
3559
|
+
{
|
|
3560
|
+
ref: headerRef,
|
|
3561
|
+
className: "flex flex-col sm:flex-row w-full flex-nowrap items-start sm:items-center justify-between gap-2 sm:gap-4",
|
|
3562
|
+
children: [
|
|
3563
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { ref: titleRef, className: "min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Typography, { as: "h2", variant: "title", className: "truncate [&::first-letter]:uppercase", children: title }) }),
|
|
3564
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
3565
|
+
Tabs,
|
|
3566
|
+
{
|
|
3567
|
+
ariaLabel: labels.eventList.tabsAria(title),
|
|
3568
|
+
items: tabsItems,
|
|
3569
|
+
value: activeTabValue,
|
|
3570
|
+
onChange: setActiveTabValue
|
|
3571
|
+
}
|
|
3572
|
+
)
|
|
3573
|
+
]
|
|
3574
|
+
}
|
|
3575
|
+
),
|
|
3692
3576
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: gridClassName, style: gridStyle, children: [
|
|
3693
3577
|
tileEvents.map((event) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
3694
3578
|
EventListItem,
|