@agg-build/ui 2.0.0 → 2.1.1

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.
Files changed (50) hide show
  1. package/dist/{chunk-RF2EPYLN.mjs → chunk-IQT4I5B4.mjs} +405 -318
  2. package/dist/{chunk-RWOF44TC.mjs → chunk-NK57KMYN.mjs} +239 -183
  3. package/dist/{chunk-HH7L3KLS.mjs → chunk-RPXRTXCY.mjs} +1 -1
  4. package/dist/{chunk-4CM4F4S6.mjs → chunk-TERG43WW.mjs} +1 -1
  5. package/dist/{chunk-2UKDQ7WP.mjs → chunk-WU2C3C6K.mjs} +94 -39
  6. package/dist/{chunk-R3U6YXSQ.mjs → chunk-XHDGSRG7.mjs} +36 -21
  7. package/dist/{chunk-2ZS3BPSF.mjs → chunk-YJO6LMRT.mjs} +906 -827
  8. package/dist/events.js +1376 -1314
  9. package/dist/events.mjs +3 -3
  10. package/dist/index.js +3701 -3408
  11. package/dist/index.mjs +13 -7
  12. package/dist/modals.js +1117 -983
  13. package/dist/modals.mjs +5 -3
  14. package/dist/pages.js +2664 -2429
  15. package/dist/pages.mjs +8 -6
  16. package/dist/primitives.js +912 -832
  17. package/dist/primitives.mjs +3 -1
  18. package/dist/styles.css +1 -1
  19. package/dist/tailwind.css +1 -1
  20. package/dist/trading.js +554 -510
  21. package/dist/trading.mjs +4 -4
  22. package/dist/types/events/list/category-sidebar.d.mts +33 -0
  23. package/dist/types/events/list/category-sidebar.d.ts +33 -0
  24. package/dist/types/events/list/event-list-tabs.d.mts +2 -0
  25. package/dist/types/events/list/event-list-tabs.d.ts +2 -0
  26. package/dist/types/events/list/index.d.mts +1 -0
  27. package/dist/types/events/list/index.d.ts +1 -0
  28. package/dist/types/pages/event-market/event-market.types.d.mts +1 -0
  29. package/dist/types/pages/event-market/event-market.types.d.ts +1 -0
  30. package/dist/types/pages/user-profile/index.d.mts +2 -1
  31. package/dist/types/pages/user-profile/index.d.ts +2 -1
  32. package/dist/types/pages/user-profile/transaction-explorer.d.mts +1 -0
  33. package/dist/types/pages/user-profile/transaction-explorer.d.ts +1 -0
  34. package/dist/types/pages/user-profile/user-profile.types.d.mts +9 -2
  35. package/dist/types/pages/user-profile/user-profile.types.d.ts +9 -2
  36. package/dist/types/primitives/icon/index.d.mts +2 -1
  37. package/dist/types/primitives/icon/index.d.ts +2 -1
  38. package/dist/types/primitives/icon/registry.d.mts +4 -0
  39. package/dist/types/primitives/icon/registry.d.ts +4 -0
  40. package/dist/types/primitives/icon/svg/paper-mode.d.mts +5 -0
  41. package/dist/types/primitives/icon/svg/paper-mode.d.ts +5 -0
  42. package/dist/types/shared/use-horizontal-scroll-state.d.mts +15 -0
  43. package/dist/types/shared/use-horizontal-scroll-state.d.ts +15 -0
  44. package/dist/types/withdraw/index.d.mts +9 -1
  45. package/dist/types/withdraw/index.d.ts +9 -1
  46. package/dist/types/withdraw/steps/withdraw-amount.d.mts +10 -1
  47. package/dist/types/withdraw/steps/withdraw-amount.d.ts +10 -1
  48. package/dist/types/withdraw/withdraw-modal.types.d.mts +8 -0
  49. package/dist/types/withdraw/withdraw-modal.types.d.ts +8 -0
  50. package/package.json +3 -3
@@ -22,12 +22,13 @@ import {
22
22
  resolveUnifiedOrderBookEntries,
23
23
  sortOutcomeSelectorOutcomes,
24
24
  useEventTradingContext
25
- } from "./chunk-4CM4F4S6.mjs";
25
+ } from "./chunk-TERG43WW.mjs";
26
26
  import {
27
27
  AutocompleteSelect,
28
28
  Badge,
29
29
  Button,
30
30
  Card,
31
+ CloseIcon,
31
32
  Icon,
32
33
  LineChart,
33
34
  MOBILE_TABS_MEDIA_QUERY,
@@ -71,7 +72,7 @@ import {
71
72
  sortCategoriesForNavigation,
72
73
  sortOutcomes,
73
74
  splitEventsByLifecycle
74
- } from "./chunk-2ZS3BPSF.mjs";
75
+ } from "./chunk-YJO6LMRT.mjs";
75
76
 
76
77
  // src/events/item/index.tsx
77
78
  import {
@@ -4692,11 +4693,128 @@ import {
4692
4693
  } from "@agg-build/hooks";
4693
4694
  import { VENUES } from "@agg-build/sdk";
4694
4695
  import * as Dialog from "@radix-ui/react-dialog";
4695
- import { useEffect as useEffect6, useMemo as useMemo8, useRef as useRef7, useState as useState6 } from "react";
4696
+ import { useEffect as useEffect6, useMemo as useMemo9, useRef as useRef7, useState as useState6 } from "react";
4697
+
4698
+ // src/events/list/category-sidebar.tsx
4699
+ import { useMemo as useMemo7 } from "react";
4700
+ import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
4701
+ var rowBase = cn(
4702
+ "flex min-h-11 w-full items-center gap-3 rounded-[6px] px-3 py-3",
4703
+ "text-left text-agg-sm font-agg-normal leading-agg-5",
4704
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-1 focus-visible:ring-offset-agg-secondary"
4705
+ );
4706
+ var idleRowClassName = cn(
4707
+ rowBase,
4708
+ "cursor-pointer text-agg-foreground hover:bg-agg-secondary-hover"
4709
+ );
4710
+ var selectedRowClassName = cn(rowBase, "cursor-pointer bg-agg-primary/10 text-agg-primary");
4711
+ var CategorySidebar = ({
4712
+ baseCategoryId,
4713
+ childrenByParentId,
4714
+ categoryPath,
4715
+ collapsedCategoryIds,
4716
+ totalEventCount,
4717
+ labels,
4718
+ onSelectAll,
4719
+ onToggleCategory
4720
+ }) => {
4721
+ const isDrilledIn = categoryPath.length > 0;
4722
+ const sortedBaseChildren = useMemo7(() => {
4723
+ var _a;
4724
+ if (!baseCategoryId) return [];
4725
+ const children = [...(_a = childrenByParentId.get(baseCategoryId)) != null ? _a : []];
4726
+ return children.sort((a, b) => {
4727
+ var _a2, _b, _c, _d;
4728
+ const aHasChildren = ((_b = (_a2 = childrenByParentId.get(a.id)) == null ? void 0 : _a2.length) != null ? _b : 0) > 0;
4729
+ const bHasChildren = ((_d = (_c = childrenByParentId.get(b.id)) == null ? void 0 : _c.length) != null ? _d : 0) > 0;
4730
+ if (aHasChildren === bHasChildren) return 0;
4731
+ return aHasChildren ? -1 : 1;
4732
+ });
4733
+ }, [baseCategoryId, childrenByParentId]);
4734
+ const renderRow = ({
4735
+ entry,
4736
+ isExpanded,
4737
+ isSelected,
4738
+ onClick
4739
+ }) => {
4740
+ var _a, _b;
4741
+ const hasKnownChildren = ((_b = (_a = childrenByParentId.get(entry.id)) == null ? void 0 : _a.length) != null ? _b : 0) > 0;
4742
+ return /* @__PURE__ */ jsxs8(
4743
+ "button",
4744
+ {
4745
+ type: "button",
4746
+ "aria-current": isSelected ? "true" : void 0,
4747
+ className: isSelected ? selectedRowClassName : idleRowClassName,
4748
+ onClick,
4749
+ children: [
4750
+ /* @__PURE__ */ jsx10("span", { className: "min-w-0 flex-1 truncate first-letter:uppercase", children: entry.label }),
4751
+ hasKnownChildren ? /* @__PURE__ */ jsx10(
4752
+ Icon,
4753
+ {
4754
+ name: isExpanded ? "chevron-up" : "chevron-down",
4755
+ size: "small",
4756
+ color: "currentColor",
4757
+ className: "shrink-0 text-agg-muted-foreground"
4758
+ }
4759
+ ) : /* @__PURE__ */ jsx10("span", { className: "shrink-0 text-agg-muted-foreground", children: entry.eventCount })
4760
+ ]
4761
+ },
4762
+ entry.id
4763
+ );
4764
+ };
4765
+ const renderBranch = (category, depth) => {
4766
+ var _a, _b, _c, _d, _e;
4767
+ const label = (_a = category.displayName) != null ? _a : category.name;
4768
+ const entry = {
4769
+ id: category.id,
4770
+ label,
4771
+ eventCount: (_b = category.eventCount) != null ? _b : 0
4772
+ };
4773
+ const childCategories = (_c = childrenByParentId.get(category.id)) != null ? _c : [];
4774
+ const hasKnownChildren = childCategories.length > 0;
4775
+ const isExpanded = ((_d = categoryPath[depth]) == null ? void 0 : _d.id) === category.id && !collapsedCategoryIds.has(category.id);
4776
+ const isSelected = ((_e = categoryPath[depth]) == null ? void 0 : _e.id) === category.id && categoryPath.length === depth + 1;
4777
+ return /* @__PURE__ */ jsxs8("div", { className: "flex w-full flex-col", children: [
4778
+ renderRow({
4779
+ entry,
4780
+ isExpanded,
4781
+ isSelected,
4782
+ onClick: () => onToggleCategory({ entry, depth, hasKnownChildren, isExpanded, isSelected })
4783
+ }),
4784
+ /* @__PURE__ */ jsx10(
4785
+ "div",
4786
+ {
4787
+ className: cn(
4788
+ "grid transition-[grid-template-rows] duration-150 ease-in-out motion-reduce:transition-none",
4789
+ isExpanded ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
4790
+ ),
4791
+ children: /* @__PURE__ */ jsx10("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsx10("div", { className: "flex w-full flex-col gap-1 pl-4 pt-1", children: childCategories.map((child) => renderBranch(child, depth + 1)) }) })
4792
+ }
4793
+ )
4794
+ ] }, category.id);
4795
+ };
4796
+ return /* @__PURE__ */ jsxs8("div", { className: "flex w-full flex-col gap-1", children: [
4797
+ /* @__PURE__ */ jsxs8(
4798
+ "button",
4799
+ {
4800
+ type: "button",
4801
+ "aria-current": !isDrilledIn ? "true" : void 0,
4802
+ className: !isDrilledIn ? selectedRowClassName : idleRowClassName,
4803
+ onClick: onSelectAll,
4804
+ children: [
4805
+ /* @__PURE__ */ jsx10("span", { className: "min-w-0 flex-1 truncate", children: labels.subcategoriesAll }),
4806
+ /* @__PURE__ */ jsx10("span", { className: "shrink-0 text-agg-muted-foreground", children: totalEventCount })
4807
+ ]
4808
+ }
4809
+ ),
4810
+ sortedBaseChildren.map((category) => renderBranch(category, 0))
4811
+ ] });
4812
+ };
4813
+ CategorySidebar.displayName = "CategorySidebar";
4696
4814
 
4697
4815
  // src/events/list/event-list-tabs.tsx
4698
4816
  import { getVenueAvailabilityState, useAppConfig, useGeoBlock, useLabels as useLabels7 } from "@agg-build/hooks";
4699
- import { useCallback as useCallback3, useEffect as useEffect5, useMemo as useMemo7, useRef as useRef6, useState as useState5 } from "react";
4817
+ import { useCallback as useCallback3, useEffect as useEffect5, useMemo as useMemo8, useRef as useRef6, useState as useState5 } from "react";
4700
4818
 
4701
4819
  // src/events/list/event-list.constants.ts
4702
4820
  import { MatchStatus, Venue as Venue2 } from "@agg-build/sdk";
@@ -4763,16 +4881,16 @@ var getDefaultEventListTabs = (labels) => {
4763
4881
  };
4764
4882
 
4765
4883
  // src/events/list/event-list-tabs.tsx
4766
- import { jsx as jsx10 } from "react/jsx-runtime";
4884
+ import { jsx as jsx11 } from "react/jsx-runtime";
4767
4885
  var renderTabIcon = (tab, isActive) => {
4768
4886
  if (tab.iconName === "warning-filled") {
4769
- return /* @__PURE__ */ jsx10(Icon, { name: "warning-filled", size: "small", color: "currentColor" });
4887
+ return /* @__PURE__ */ jsx11(Icon, { name: "warning-filled", size: "small", color: "currentColor" });
4770
4888
  }
4771
4889
  if (tab.venueLogo) {
4772
- return /* @__PURE__ */ jsx10(VenueLogo, { venue: tab.venueLogo, size: "small" });
4890
+ return /* @__PURE__ */ jsx11(VenueLogo, { venue: tab.venueLogo, size: "small" });
4773
4891
  }
4774
4892
  if (!tab.iconName) return null;
4775
- return /* @__PURE__ */ jsx10(
4893
+ return /* @__PURE__ */ jsx11(
4776
4894
  Icon,
4777
4895
  {
4778
4896
  name: tab.iconName,
@@ -4785,7 +4903,7 @@ var useEventListTabs = (tabs) => {
4785
4903
  const labels = useLabels7();
4786
4904
  const { disabledVenues } = useAppConfig();
4787
4905
  const { isLocationBlocked } = useGeoBlock();
4788
- return useMemo7(() => {
4906
+ return useMemo8(() => {
4789
4907
  const baseTabs = tabs != null ? tabs : getDefaultEventListTabs(labels);
4790
4908
  return baseTabs.flatMap((tab) => {
4791
4909
  if (!tab.venueLogo) return [tab];
@@ -4820,7 +4938,7 @@ var EventListTabs = ({
4820
4938
  if (resolvedTabs.some((tab) => tab.value === activeTab && !tab.disabled)) return;
4821
4939
  onTabChange(fallbackTab.value);
4822
4940
  }, [activeTab, onTabChange, resolvedTabs]);
4823
- const items = useMemo7(() => {
4941
+ const items = useMemo8(() => {
4824
4942
  return resolvedTabs.map((tab) => {
4825
4943
  const isActive = tab.value === activeTab;
4826
4944
  return {
@@ -4832,7 +4950,7 @@ var EventListTabs = ({
4832
4950
  };
4833
4951
  });
4834
4952
  }, [activeTab, resolvedTabs]);
4835
- return /* @__PURE__ */ jsx10(
4953
+ return /* @__PURE__ */ jsx11(
4836
4954
  Tabs,
4837
4955
  {
4838
4956
  ariaLabel,
@@ -4918,20 +5036,7 @@ var useEventListTabsHeaderOverflow = (recomputeOn, options) => {
4918
5036
  };
4919
5037
 
4920
5038
  // src/events/list/index.tsx
4921
- import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
4922
- var subcategoryMenuRowClassName = cn(
4923
- "flex min-h-11 w-full items-center justify-between rounded-[6px] px-3 py-3",
4924
- "text-left text-agg-sm font-agg-normal leading-agg-5",
4925
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-1 focus-visible:ring-offset-agg-secondary"
4926
- );
4927
- var subcategoryMenuIdleRowClassName = cn(
4928
- subcategoryMenuRowClassName,
4929
- "cursor-pointer text-agg-foreground hover:bg-agg-secondary-hover"
4930
- );
4931
- var subcategoryMenuSelectedRowClassName = cn(
4932
- subcategoryMenuRowClassName,
4933
- "cursor-pointer bg-agg-primary/10 text-agg-primary"
4934
- );
5039
+ import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
4935
5040
  var SORT_ICON_BY_VALUE = {
4936
5041
  volume24hr: "sort-volume-24hr",
4937
5042
  topArbitrage: "sort-top-arbitrage",
@@ -4968,7 +5073,7 @@ var EventList = ({
4968
5073
  initialLoadedPageCount,
4969
5074
  stateRef
4970
5075
  }) => {
4971
- var _a, _b, _c;
5076
+ var _a, _b, _c, _d, _e;
4972
5077
  const labels = useLabels8();
4973
5078
  const { disabledVenues } = useAppConfig2();
4974
5079
  const {
@@ -4976,7 +5081,7 @@ var EventList = ({
4976
5081
  } = useSdkUiConfig4();
4977
5082
  const isDiscoveryFiltersEnabled = enableVenueEventDiscoveryFilters && !search;
4978
5083
  const resolvedTabs = useEventListTabs();
4979
- const visibleVenues = useMemo8(
5084
+ const visibleVenues = useMemo9(
4980
5085
  () => disabledVenues.length === 0 ? void 0 : getVisibleVenueIdsByConfig(VENUES, disabledVenues),
4981
5086
  [disabledVenues]
4982
5087
  );
@@ -4987,28 +5092,27 @@ var EventList = ({
4987
5092
  const [isSubcategoriesModalOpen, setIsSubcategoriesModalOpen] = useState6(false);
4988
5093
  const [categoryPath, setCategoryPath] = useState6([]);
4989
5094
  const [collapsedCategoryIds, setCollapsedCategoryIds] = useState6(() => /* @__PURE__ */ new Set());
4990
- const { headerRef, titleRef, shouldUseSelectOverflow } = useEventListTabsHeaderOverflow(resolvedTabs, { minTabsInlineWidthForSelect: 400, preferSelectOnOverflow: false });
4991
- const sortItems = useMemo8(() => {
5095
+ const sortItems = useMemo9(() => {
4992
5096
  return [
4993
5097
  {
4994
5098
  value: "volume24hr",
4995
5099
  label: labels.eventList.sortBy24hVolume,
4996
- icon: /* @__PURE__ */ jsx11(Icon, { name: SORT_ICON_BY_VALUE.volume24hr, size: "small", color: "currentColor" })
5100
+ icon: /* @__PURE__ */ jsx12(Icon, { name: SORT_ICON_BY_VALUE.volume24hr, size: "small", color: "currentColor" })
4997
5101
  },
4998
5102
  {
4999
5103
  value: "topArbitrage",
5000
5104
  label: labels.eventList.sortByTopArbitrage,
5001
- icon: /* @__PURE__ */ jsx11(Icon, { name: SORT_ICON_BY_VALUE.topArbitrage, size: "small", color: "currentColor" })
5105
+ icon: /* @__PURE__ */ jsx12(Icon, { name: SORT_ICON_BY_VALUE.topArbitrage, size: "small", color: "currentColor" })
5002
5106
  },
5003
5107
  {
5004
5108
  value: "volume",
5005
5109
  label: labels.eventList.sortByTotalVolume,
5006
- icon: /* @__PURE__ */ jsx11(Icon, { name: SORT_ICON_BY_VALUE.volume, size: "small", color: "currentColor" })
5110
+ icon: /* @__PURE__ */ jsx12(Icon, { name: SORT_ICON_BY_VALUE.volume, size: "small", color: "currentColor" })
5007
5111
  },
5008
5112
  {
5009
5113
  value: "endDate",
5010
5114
  label: labels.eventList.sortByEndingSoon,
5011
- icon: /* @__PURE__ */ jsx11(Icon, { name: SORT_ICON_BY_VALUE.endDate, size: "small", color: "currentColor" })
5115
+ icon: /* @__PURE__ */ jsx12(Icon, { name: SORT_ICON_BY_VALUE.endDate, size: "small", color: "currentColor" })
5012
5116
  }
5013
5117
  ];
5014
5118
  }, [
@@ -5020,12 +5124,7 @@ var EventList = ({
5020
5124
  const baseCategoryId = (_c = categoryIds == null ? void 0 : categoryIds[0]) != null ? _c : null;
5021
5125
  useEffect6(() => {
5022
5126
  if (!isDiscoveryFiltersEnabled) return;
5023
- if (!baseCategoryId) {
5024
- setCategoryPath([]);
5025
- setCollapsedCategoryIds(/* @__PURE__ */ new Set());
5026
- return;
5027
- }
5028
- setCategoryPath([{ id: baseCategoryId, label: baseCategoryId, eventCount: 0 }]);
5127
+ setCategoryPath([]);
5029
5128
  setCollapsedCategoryIds(/* @__PURE__ */ new Set());
5030
5129
  }, [baseCategoryId, isDiscoveryFiltersEnabled]);
5031
5130
  const { categories: topLevelCategories } = useCategories({
@@ -5033,10 +5132,10 @@ var EventList = ({
5033
5132
  enabled: isDiscoveryFiltersEnabled,
5034
5133
  limit: 100
5035
5134
  });
5036
- const sortedTopLevelCategories = useMemo8(() => {
5135
+ const sortedTopLevelCategories = useMemo9(() => {
5037
5136
  return sortCategoriesForNavigation(topLevelCategories);
5038
5137
  }, [topLevelCategories]);
5039
- const baseCategoryChildPrefetchIds = useMemo8(() => {
5138
+ const baseCategoryChildPrefetchIds = useMemo9(() => {
5040
5139
  return Array.from(
5041
5140
  /* @__PURE__ */ new Set([
5042
5141
  ...sortedTopLevelCategories.map((category) => category.id),
@@ -5050,23 +5149,28 @@ var EventList = ({
5050
5149
  parentIds: baseCategoryChildPrefetchIds,
5051
5150
  limit: 100
5052
5151
  });
5053
- const visibleChildPrefetchIds = useMemo8(() => {
5054
- var _a2;
5152
+ const visibleChildPrefetchIds = useMemo9(() => {
5153
+ var _a2, _b2;
5055
5154
  const ids = /* @__PURE__ */ new Set();
5155
+ if (baseCategoryId) {
5156
+ for (const child of (_a2 = baseChildrenByParentId.get(baseCategoryId)) != null ? _a2 : []) {
5157
+ ids.add(child.id);
5158
+ }
5159
+ }
5056
5160
  for (const expandedCategory of categoryPath) {
5057
- for (const childCategory of (_a2 = baseChildrenByParentId.get(expandedCategory.id)) != null ? _a2 : []) {
5161
+ for (const childCategory of (_b2 = baseChildrenByParentId.get(expandedCategory.id)) != null ? _b2 : []) {
5058
5162
  ids.add(childCategory.id);
5059
5163
  }
5060
5164
  }
5061
5165
  return Array.from(ids);
5062
- }, [baseChildrenByParentId, categoryPath]);
5166
+ }, [baseCategoryId, baseChildrenByParentId, categoryPath]);
5063
5167
  const { childrenByParentId: visibleChildrenByParentId } = useCategoryChildren({
5064
5168
  queryKeyScope: "event-list-category-children",
5065
5169
  enabled: isDiscoveryFiltersEnabled,
5066
5170
  parentIds: visibleChildPrefetchIds,
5067
5171
  limit: 100
5068
5172
  });
5069
- const visibleGrandchildPrefetchIds = useMemo8(() => {
5173
+ const visibleGrandchildPrefetchIds = useMemo9(() => {
5070
5174
  var _a2;
5071
5175
  const ids = /* @__PURE__ */ new Set();
5072
5176
  for (const expandedCategory of categoryPath) {
@@ -5082,43 +5186,41 @@ var EventList = ({
5082
5186
  parentIds: visibleGrandchildPrefetchIds,
5083
5187
  limit: 100
5084
5188
  });
5085
- const childrenByParentId = useMemo8(() => {
5189
+ const childrenByParentId = useMemo9(() => {
5086
5190
  return new Map([
5087
5191
  ...baseChildrenByParentId,
5088
5192
  ...visibleChildrenByParentId,
5089
5193
  ...visibleGrandchildrenByParentId
5090
5194
  ]);
5091
5195
  }, [baseChildrenByParentId, visibleChildrenByParentId, visibleGrandchildrenByParentId]);
5092
- const shouldRenderSubcategoryFilters = isDiscoveryFiltersEnabled && (sortedTopLevelCategories.length > 0 || categoryPath.length > 0);
5093
- const totalTopLevelEventCount = useMemo8(() => {
5094
- return sortedTopLevelCategories.reduce((accumulator, category) => {
5095
- var _a2;
5096
- return accumulator + ((_a2 = category.eventCount) != null ? _a2 : 0);
5097
- }, 0);
5098
- }, [sortedTopLevelCategories]);
5099
- const resolvedCategoryIds = useMemo8(() => {
5196
+ const shouldRenderSubcategoryFilters = isDiscoveryFiltersEnabled && baseCategoryId !== null && (((_e = (_d = childrenByParentId.get(baseCategoryId)) == null ? void 0 : _d.length) != null ? _e : 0) > 0 || categoryPath.length > 0);
5197
+ const baseCategoryEventCount = useMemo9(() => {
5198
+ var _a2, _b2;
5199
+ return (_b2 = (_a2 = sortedTopLevelCategories.find((c) => c.id === baseCategoryId)) == null ? void 0 : _a2.eventCount) != null ? _b2 : 0;
5200
+ }, [baseCategoryId, sortedTopLevelCategories]);
5201
+ const resolvedCategoryIds = useMemo9(() => {
5100
5202
  if (!isDiscoveryFiltersEnabled) return categoryIds;
5101
- return resolveCategoryIdsFromPath(categoryPath, void 0);
5102
- }, [categoryIds, categoryPath, isDiscoveryFiltersEnabled]);
5103
- const sortQueryParams = useMemo8(() => {
5203
+ return resolveCategoryIdsFromPath(categoryPath, baseCategoryId ? [baseCategoryId] : void 0);
5204
+ }, [baseCategoryId, categoryIds, categoryPath, isDiscoveryFiltersEnabled]);
5205
+ const sortQueryParams = useMemo9(() => {
5104
5206
  return resolveSortQueryParams(selectedSort);
5105
5207
  }, [selectedSort]);
5106
- const activeTab = useMemo8(() => {
5208
+ const activeTab = useMemo9(() => {
5107
5209
  return resolvedTabs.find((tab) => tab.value === activeTabValue);
5108
5210
  }, [activeTabValue, resolvedTabs]);
5109
- const venues = useMemo8(() => {
5211
+ const venues = useMemo9(() => {
5110
5212
  return resolveTabVenus(activeTab, visibleVenues);
5111
5213
  }, [activeTab, visibleVenues]);
5112
- const matchStatus = useMemo8(() => {
5214
+ const matchStatus = useMemo9(() => {
5113
5215
  return activeTabValue === "matched" ? activeTab == null ? void 0 : activeTab.matchStatus : void 0;
5114
5216
  }, [activeTabValue, activeTab]);
5115
- const resolvedMaxVisibleItems = useMemo8(() => {
5217
+ const resolvedMaxVisibleItems = useMemo9(() => {
5116
5218
  if (!Number.isFinite(maxVisibleItems)) return void 0;
5117
5219
  return Math.max(1, Math.floor(maxVisibleItems));
5118
5220
  }, [maxVisibleItems]);
5119
5221
  const requestLimit = resolvedMaxVisibleItems != null ? resolvedMaxVisibleItems : limit;
5120
5222
  const shouldPaginate = resolvedMaxVisibleItems == null;
5121
- const endDateFrom = useMemo8(() => {
5223
+ const endDateFrom = useMemo9(() => {
5122
5224
  if (search) return void 0;
5123
5225
  const BUCKET_MINUTES = 5;
5124
5226
  const bucket = /* @__PURE__ */ new Date();
@@ -5152,16 +5254,16 @@ var EventList = ({
5152
5254
  stateRef.current = { venueTab: activeTabValue, loadedPageCount };
5153
5255
  }
5154
5256
  }, [stateRef, activeTabValue, loadedPageCount]);
5155
- const filteredEvents = useMemo8(() => {
5257
+ const filteredEvents = useMemo9(() => {
5156
5258
  return filterEventsByTabValue(events, activeTabValue);
5157
5259
  }, [events, activeTabValue]);
5158
- const groupedEvents = useMemo8(() => {
5260
+ const groupedEvents = useMemo9(() => {
5159
5261
  return splitEventsByLifecycle(filteredEvents);
5160
5262
  }, [filteredEvents]);
5161
- const orderedEvents = useMemo8(() => {
5263
+ const orderedEvents = useMemo9(() => {
5162
5264
  return groupedEvents.open;
5163
5265
  }, [groupedEvents.open]);
5164
- const tileEvents = useMemo8(() => {
5266
+ const tileEvents = useMemo9(() => {
5165
5267
  const normalizedEvents = orderedEvents.map((event) => mapEventToEventListItemEvent(event)).filter((event) => event != null);
5166
5268
  if (resolvedMaxVisibleItems == null) return normalizedEvents;
5167
5269
  return normalizedEvents.slice(0, resolvedMaxVisibleItems);
@@ -5195,11 +5297,10 @@ var EventList = ({
5195
5297
  const gridClassName = cn(
5196
5298
  "grid grid-cols-[repeat(auto-fill,minmax(240px,1fr))] md:grid-cols-[repeat(auto-fill,minmax(360px,1fr))] gap-4"
5197
5299
  );
5198
- const isDrilledIn = categoryPath.length > 0;
5199
5300
  const handleSelectAllCategories = () => {
5200
5301
  setCategoryPath([]);
5201
5302
  setCollapsedCategoryIds(/* @__PURE__ */ new Set());
5202
- onCategoryRootChange == null ? void 0 : onCategoryRootChange(void 0);
5303
+ onCategoryRootChange == null ? void 0 : onCategoryRootChange(baseCategoryId != null ? baseCategoryId : void 0);
5203
5304
  setIsSubcategoriesModalOpen(false);
5204
5305
  };
5205
5306
  const handleToggleSubcategory = ({
@@ -5209,7 +5310,6 @@ var EventList = ({
5209
5310
  isExpanded,
5210
5311
  isSelected
5211
5312
  }) => {
5212
- var _a2;
5213
5313
  setCategoryPath((prev) => [...prev.slice(0, depth), entry]);
5214
5314
  setCollapsedCategoryIds((prev) => {
5215
5315
  const next = new Set(prev);
@@ -5220,122 +5320,41 @@ var EventList = ({
5220
5320
  next.delete(entry.id);
5221
5321
  return next;
5222
5322
  });
5223
- onCategoryRootChange == null ? void 0 : onCategoryRootChange(depth === 0 ? entry.id : (_a2 = categoryPath[0]) == null ? void 0 : _a2.id);
5224
- };
5225
- const renderSubcategoryTreeRow = ({
5226
- entry,
5227
- isExpanded,
5228
- isSelected,
5229
- onClick
5230
- }) => {
5231
- var _a2, _b2;
5232
- const hasKnownChildren = ((_b2 = (_a2 = childrenByParentId.get(entry.id)) == null ? void 0 : _a2.length) != null ? _b2 : 0) > 0;
5233
- return /* @__PURE__ */ jsxs8(
5234
- "button",
5235
- {
5236
- type: "button",
5237
- "aria-current": isSelected ? "true" : void 0,
5238
- className: isSelected ? subcategoryMenuSelectedRowClassName : subcategoryMenuIdleRowClassName,
5239
- onClick,
5240
- children: [
5241
- /* @__PURE__ */ jsx11("span", { className: "min-w-0 truncate first-letter:uppercase", children: entry.label }),
5242
- hasKnownChildren ? /* @__PURE__ */ jsx11(
5243
- Icon,
5244
- {
5245
- name: isExpanded ? "chevron-up" : "chevron-down",
5246
- size: "small",
5247
- color: "currentColor",
5248
- className: "shrink-0 text-agg-muted-foreground"
5249
- }
5250
- ) : /* @__PURE__ */ jsx11("span", { className: "shrink-0 text-agg-muted-foreground", children: entry.eventCount })
5251
- ]
5252
- },
5253
- entry.id
5254
- );
5255
- };
5256
- const renderSubcategoryBranch = (category, depth) => {
5257
- var _a2, _b2, _c2, _d, _e;
5258
- const label = (_a2 = category.displayName) != null ? _a2 : category.name;
5259
- const entry = {
5260
- id: category.id,
5261
- label,
5262
- eventCount: (_b2 = category.eventCount) != null ? _b2 : 0
5263
- };
5264
- const childCategories = (_c2 = childrenByParentId.get(category.id)) != null ? _c2 : [];
5265
- const hasKnownChildren = childCategories.length > 0;
5266
- const isExpanded = ((_d = categoryPath[depth]) == null ? void 0 : _d.id) === category.id && !collapsedCategoryIds.has(category.id);
5267
- const isSelected = ((_e = categoryPath[depth]) == null ? void 0 : _e.id) === category.id && categoryPath.length === depth + 1;
5268
- return /* @__PURE__ */ jsxs8("div", { className: "flex w-full flex-col gap-1", children: [
5269
- renderSubcategoryTreeRow({
5270
- entry,
5271
- isExpanded,
5272
- isSelected,
5273
- onClick: () => handleToggleSubcategory({
5274
- entry,
5275
- depth,
5276
- hasKnownChildren,
5277
- isExpanded,
5278
- isSelected
5279
- })
5280
- }),
5281
- isExpanded ? /* @__PURE__ */ jsx11("div", { className: "flex w-full flex-col gap-1 pl-4", children: childCategories.map(
5282
- (childCategory) => renderSubcategoryBranch(childCategory, depth + 1)
5283
- ) }) : null
5284
- ] }, category.id);
5323
+ onCategoryRootChange == null ? void 0 : onCategoryRootChange(baseCategoryId != null ? baseCategoryId : void 0);
5285
5324
  };
5286
- const subcategoriesListContent = /* @__PURE__ */ jsxs8(Fragment3, { children: [
5287
- /* @__PURE__ */ jsxs8(
5288
- "button",
5289
- {
5290
- type: "button",
5291
- "aria-current": !isDrilledIn ? "true" : void 0,
5292
- className: !isDrilledIn ? subcategoryMenuSelectedRowClassName : subcategoryMenuIdleRowClassName,
5293
- onClick: handleSelectAllCategories,
5294
- children: [
5295
- /* @__PURE__ */ jsx11("span", { className: "min-w-0 truncate", children: labels.eventList.subcategoriesAll }),
5296
- /* @__PURE__ */ jsx11("span", { className: "text-agg-muted-foreground", children: totalTopLevelEventCount })
5297
- ]
5298
- }
5299
- ),
5300
- sortedTopLevelCategories.map((category) => renderSubcategoryBranch(category, 0))
5301
- ] });
5302
5325
  if (shouldRenderLoadingState) {
5303
- return /* @__PURE__ */ jsx11(
5326
+ return /* @__PURE__ */ jsx12(
5304
5327
  Skeleton,
5305
5328
  {
5306
5329
  view: "event-list",
5307
5330
  ariaLabel: labels.eventList.loading(title),
5308
- withSidebar: isDiscoveryFiltersEnabled
5331
+ withSidebar: shouldRenderSubcategoryFilters
5309
5332
  }
5310
5333
  );
5311
5334
  }
5312
- return /* @__PURE__ */ jsxs8("section", { className: "agg-event-list flex w-full flex-col gap-2 md:gap-5 t", children: [
5313
- /* @__PURE__ */ jsxs8(
5335
+ return /* @__PURE__ */ jsxs9("section", { className: "agg-event-list flex w-full flex-col gap-2 md:gap-5 t", children: [
5336
+ /* @__PURE__ */ jsxs9(
5314
5337
  "header",
5315
5338
  {
5316
- ref: headerRef,
5317
5339
  className: cn(
5318
5340
  "agg-event-list-header",
5319
5341
  "flex flex-col w-full items-start justify-between",
5320
5342
  "gap-2 sm:flex-row sm:items-center sm:gap-4"
5321
5343
  ),
5322
5344
  children: [
5323
- /* @__PURE__ */ jsx11("div", { ref: titleRef, className: "agg-event-list-title min-w-32", children: /* @__PURE__ */ jsx11(Typography, { as: "h2", variant: "title", className: "truncate first-letter:uppercase", children: title }) }),
5324
- /* @__PURE__ */ jsxs8("div", { className: "hidden min-w-0 max-w-full items-center gap-3 md:flex", children: [
5325
- /* @__PURE__ */ jsx11(
5345
+ /* @__PURE__ */ jsx12("div", { className: "agg-event-list-title min-w-32", children: /* @__PURE__ */ jsx12(Typography, { as: "h2", variant: "title", className: "truncate first-letter:uppercase", children: title }) }),
5346
+ /* @__PURE__ */ jsxs9("div", { className: "hidden min-w-0 max-w-full items-center gap-3 md:flex", children: [
5347
+ /* @__PURE__ */ jsx12(
5326
5348
  EventListTabs,
5327
5349
  {
5328
5350
  ariaLabel: labels.eventList.tabsAria(title),
5329
- className: cn(
5330
- "agg-event-list-tabs w-fit max-w-full flex-1",
5331
- shouldUseSelectOverflow ? "min-w-[220px]" : "min-w-[400px]"
5332
- ),
5351
+ className: "agg-event-list-tabs min-w-0 flex-1 max-w-[600px]!",
5333
5352
  activeTab: activeTabValue,
5334
5353
  onTabChange: setActiveTabValue,
5335
- overflowBehavior: shouldUseSelectOverflow ? "select" : "scroll"
5354
+ overflowBehavior: "scroll"
5336
5355
  }
5337
5356
  ),
5338
- /* @__PURE__ */ jsx11(
5357
+ /* @__PURE__ */ jsx12(
5339
5358
  Select,
5340
5359
  {
5341
5360
  ariaLabel: labels.eventList.sortByLabel,
@@ -5351,8 +5370,8 @@ var EventList = ({
5351
5370
  ]
5352
5371
  }
5353
5372
  ),
5354
- /* @__PURE__ */ jsxs8("div", { className: "flex w-full gap-2 md:hidden mb-3", children: [
5355
- /* @__PURE__ */ jsx11(
5373
+ /* @__PURE__ */ jsxs9("div", { className: "flex w-full gap-2 md:hidden mb-3", children: [
5374
+ /* @__PURE__ */ jsx12(
5356
5375
  EventListTabs,
5357
5376
  {
5358
5377
  ariaLabel: labels.eventList.tabsAria(title),
@@ -5362,7 +5381,7 @@ var EventList = ({
5362
5381
  overflowBehavior: "select"
5363
5382
  }
5364
5383
  ),
5365
- /* @__PURE__ */ jsx11(
5384
+ /* @__PURE__ */ jsx12(
5366
5385
  Select,
5367
5386
  {
5368
5387
  ariaLabel: labels.eventList.sortByLabel,
@@ -5373,24 +5392,36 @@ var EventList = ({
5373
5392
  contentClassName: "rounded-[12px] py-2 shadow-[0_8px_16px_rgba(0,0,0,0.1)]"
5374
5393
  }
5375
5394
  ),
5376
- shouldRenderSubcategoryFilters ? /* @__PURE__ */ jsx11(
5395
+ shouldRenderSubcategoryFilters ? /* @__PURE__ */ jsx12(
5377
5396
  "button",
5378
5397
  {
5379
5398
  type: "button",
5380
5399
  className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-[8px] border-2 border-agg-primary bg-agg-secondary text-agg-foreground cursor-pointer",
5381
5400
  "aria-label": labels.eventList.subcategoriesOpenAria,
5382
5401
  onClick: () => setIsSubcategoriesModalOpen(true),
5383
- children: /* @__PURE__ */ jsx11(Icon, { name: "apps", size: "small", color: "currentColor" })
5402
+ children: /* @__PURE__ */ jsx12(Icon, { name: "apps", size: "small", color: "currentColor" })
5384
5403
  }
5385
5404
  ) : null
5386
5405
  ] }),
5387
- /* @__PURE__ */ jsxs8(
5406
+ /* @__PURE__ */ jsxs9(
5388
5407
  "div",
5389
5408
  {
5390
5409
  className: cn("flex w-full gap-6", shouldRenderSubcategoryFilters ? "md:items-start" : ""),
5391
5410
  children: [
5392
- shouldRenderSubcategoryFilters ? /* @__PURE__ */ jsx11("aside", { className: "hidden w-[200px] shrink-0 md:block", children: /* @__PURE__ */ jsx11("div", { className: "flex w-full flex-col gap-1 rounded-[8px] border border-agg-separator bg-agg-secondary p-2", children: subcategoriesListContent }) }) : null,
5393
- /* @__PURE__ */ jsxs8(
5411
+ shouldRenderSubcategoryFilters ? /* @__PURE__ */ jsx12("aside", { className: "hidden w-[200px] shrink-0 md:block self-start sticky top-4", children: /* @__PURE__ */ jsx12("div", { className: "agg-sidebar max-h-[calc(100vh-19rem)] overflow-y-auto rounded-[8px] border border-agg-separator bg-agg-secondary p-2", children: /* @__PURE__ */ jsx12(
5412
+ CategorySidebar,
5413
+ {
5414
+ baseCategoryId,
5415
+ childrenByParentId,
5416
+ categoryPath,
5417
+ collapsedCategoryIds,
5418
+ totalEventCount: baseCategoryEventCount,
5419
+ labels: { subcategoriesAll: labels.eventList.subcategoriesAll },
5420
+ onSelectAll: handleSelectAllCategories,
5421
+ onToggleCategory: handleToggleSubcategory
5422
+ }
5423
+ ) }) }) : null,
5424
+ /* @__PURE__ */ jsxs9(
5394
5425
  "div",
5395
5426
  {
5396
5427
  className: cn(
@@ -5401,7 +5432,7 @@ var EventList = ({
5401
5432
  gridClassName
5402
5433
  ),
5403
5434
  children: [
5404
- tileEvents.map((event) => /* @__PURE__ */ jsx11(
5435
+ tileEvents.map((event) => /* @__PURE__ */ jsx12(
5405
5436
  EventListItem,
5406
5437
  {
5407
5438
  event,
@@ -5416,7 +5447,7 @@ var EventList = ({
5416
5447
  },
5417
5448
  event.id
5418
5449
  )),
5419
- shouldRenderPaginationLoadingItems ? Array.from({ length: 6 }).map((_, index) => /* @__PURE__ */ jsx11(
5450
+ shouldRenderPaginationLoadingItems ? Array.from({ length: 6 }).map((_, index) => /* @__PURE__ */ jsx12(
5420
5451
  EventListItem,
5421
5452
  {
5422
5453
  isLoading: true,
@@ -5426,20 +5457,20 @@ var EventList = ({
5426
5457
  },
5427
5458
  `loading-${index}`
5428
5459
  )) : null,
5429
- shouldRenderEmptyState ? /* @__PURE__ */ jsx11("div", { className: "col-span-full w-full", children: /* @__PURE__ */ jsx11(
5460
+ shouldRenderEmptyState ? /* @__PURE__ */ jsx12("div", { className: "col-span-full w-full", children: /* @__PURE__ */ jsx12(
5430
5461
  StateMessage,
5431
5462
  {
5432
5463
  title: labels.eventList.emptyTitle,
5433
5464
  description: labels.eventList.emptyDescription,
5434
- icon: /* @__PURE__ */ jsx11(Icon, { name: "search-empty" })
5465
+ icon: /* @__PURE__ */ jsx12(Icon, { name: "search-empty" })
5435
5466
  }
5436
5467
  ) }) : null,
5437
- isError ? /* @__PURE__ */ jsx11("div", { className: "col-span-full w-full", children: /* @__PURE__ */ jsx11(
5468
+ isError ? /* @__PURE__ */ jsx12("div", { className: "col-span-full w-full", children: /* @__PURE__ */ jsx12(
5438
5469
  StateMessage,
5439
5470
  {
5440
5471
  title: labels.eventList.errorTitle,
5441
5472
  description: labels.eventList.errorDescription,
5442
- icon: /* @__PURE__ */ jsx11(Icon, { name: "warning" })
5473
+ icon: /* @__PURE__ */ jsx12(Icon, { name: "warning" })
5443
5474
  }
5444
5475
  ) }) : null
5445
5476
  ]
@@ -5448,20 +5479,45 @@ var EventList = ({
5448
5479
  ]
5449
5480
  }
5450
5481
  ),
5451
- shouldRenderSubcategoryFilters ? /* @__PURE__ */ jsx11(Modal, { open: isSubcategoriesModalOpen, onOpenChange: setIsSubcategoriesModalOpen, children: /* @__PURE__ */ jsxs8(
5482
+ shouldRenderSubcategoryFilters ? /* @__PURE__ */ jsx12(Modal, { open: isSubcategoriesModalOpen, onOpenChange: setIsSubcategoriesModalOpen, children: /* @__PURE__ */ jsx12(
5452
5483
  Modal.Container,
5453
5484
  {
5454
5485
  classNames: {
5455
- content: "items-end p-0",
5486
+ // pointer-events-none lets clicks on the empty area above the panel pass through
5487
+ // to Dialog.Overlay, which triggers Radix's outside-click dismiss.
5488
+ content: "items-end p-0 pointer-events-none",
5456
5489
  container: "w-full max-w-none border-0 bg-transparent shadow-none"
5457
5490
  },
5458
- children: [
5459
- /* @__PURE__ */ jsx11(Dialog.Title, { className: "sr-only", children: labels.eventList.subcategoriesLabel }),
5460
- /* @__PURE__ */ jsx11("div", { className: "w-full rounded-t-[12px] border border-agg-separator bg-agg-secondary p-4", children: /* @__PURE__ */ jsx11("div", { className: "flex flex-col gap-1", children: subcategoriesListContent }) })
5461
- ]
5491
+ children: /* @__PURE__ */ jsxs9("div", { className: "pointer-events-auto w-full rounded-t-[12px] border border-agg-separator bg-agg-secondary", children: [
5492
+ /* @__PURE__ */ jsx12("div", { className: "flex justify-center pb-1 pt-3", "aria-hidden": "true", children: /* @__PURE__ */ jsx12("div", { className: "h-1 w-10 rounded-full bg-agg-muted-foreground/30" }) }),
5493
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between px-4 pb-2 pt-1", children: [
5494
+ /* @__PURE__ */ jsx12(Dialog.Title, { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.eventList.subcategoriesLabel }),
5495
+ /* @__PURE__ */ jsx12(
5496
+ Dialog.Close,
5497
+ {
5498
+ className: "flex cursor-pointer items-center justify-center rounded-full p-1 text-agg-muted-foreground hover:bg-agg-secondary-hover",
5499
+ "aria-label": labels.common.close,
5500
+ children: /* @__PURE__ */ jsx12(CloseIcon, { className: "h-5 w-5" })
5501
+ }
5502
+ )
5503
+ ] }),
5504
+ /* @__PURE__ */ jsx12("div", { className: "flex flex-col gap-1 px-4 pb-4", children: /* @__PURE__ */ jsx12(
5505
+ CategorySidebar,
5506
+ {
5507
+ baseCategoryId,
5508
+ childrenByParentId,
5509
+ categoryPath,
5510
+ collapsedCategoryIds,
5511
+ totalEventCount: baseCategoryEventCount,
5512
+ labels: { subcategoriesAll: labels.eventList.subcategoriesAll },
5513
+ onSelectAll: handleSelectAllCategories,
5514
+ onToggleCategory: handleToggleSubcategory
5515
+ }
5516
+ ) })
5517
+ ] })
5462
5518
  }
5463
5519
  ) }) : null,
5464
- shouldPaginate && hasNextPage ? /* @__PURE__ */ jsx11("div", { ref: loadMoreRef, className: "agg-event-list-sentinel h-px w-full", "aria-hidden": true }) : null
5520
+ shouldPaginate && hasNextPage ? /* @__PURE__ */ jsx12("div", { ref: loadMoreRef, className: "agg-event-list-sentinel h-px w-full", "aria-hidden": true }) : null
5465
5521
  ] });
5466
5522
  };
5467
5523
  EventList.displayName = "EventList";