@agg-build/ui 2.0.0 → 2.1.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/{chunk-2UKDQ7WP.mjs → chunk-3OI2ZLLT.mjs} +94 -39
- package/dist/{chunk-4CM4F4S6.mjs → chunk-C5M2OOM3.mjs} +1 -1
- package/dist/{chunk-2ZS3BPSF.mjs → chunk-DXF2LMNN.mjs} +132 -81
- package/dist/{chunk-RWOF44TC.mjs → chunk-R6FBYAY5.mjs} +239 -183
- package/dist/{chunk-RF2EPYLN.mjs → chunk-Y6PVXAUQ.mjs} +27 -77
- package/dist/{chunk-R3U6YXSQ.mjs → chunk-YAEA6EDG.mjs} +31 -18
- package/dist/{chunk-HH7L3KLS.mjs → chunk-YMVD6Q2A.mjs} +1 -1
- package/dist/events.js +497 -462
- package/dist/events.mjs +3 -3
- package/dist/index.js +2116 -1990
- package/dist/index.mjs +9 -7
- package/dist/modals.js +278 -171
- package/dist/modals.mjs +5 -3
- package/dist/pages.js +1557 -1487
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +137 -86
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +28 -15
- package/dist/trading.mjs +4 -4
- package/dist/types/events/list/category-sidebar.d.mts +33 -0
- package/dist/types/events/list/category-sidebar.d.ts +33 -0
- package/dist/types/events/list/event-list-tabs.d.mts +2 -0
- package/dist/types/events/list/event-list-tabs.d.ts +2 -0
- package/dist/types/events/list/index.d.mts +1 -0
- package/dist/types/events/list/index.d.ts +1 -0
- package/dist/types/pages/event-market/event-market.types.d.mts +1 -0
- package/dist/types/pages/event-market/event-market.types.d.ts +1 -0
- package/dist/types/pages/user-profile/index.d.mts +1 -1
- package/dist/types/pages/user-profile/index.d.ts +1 -1
- package/dist/types/pages/user-profile/user-profile.types.d.mts +1 -0
- package/dist/types/pages/user-profile/user-profile.types.d.ts +1 -0
- package/dist/types/shared/use-horizontal-scroll-state.d.mts +15 -0
- package/dist/types/shared/use-horizontal-scroll-state.d.ts +15 -0
- package/dist/types/withdraw/index.d.mts +9 -1
- package/dist/types/withdraw/index.d.ts +9 -1
- package/dist/types/withdraw/steps/withdraw-amount.d.mts +10 -1
- package/dist/types/withdraw/steps/withdraw-amount.d.ts +10 -1
- package/dist/types/withdraw/withdraw-modal.types.d.mts +8 -0
- package/dist/types/withdraw/withdraw-modal.types.d.ts +8 -0
- package/package.json +3 -3
package/dist/pages.mjs
CHANGED
|
@@ -7,17 +7,17 @@ import {
|
|
|
7
7
|
USER_PROFILE_TAB_POSITIONS,
|
|
8
8
|
UserProfilePage,
|
|
9
9
|
useHomePageModals
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-Y6PVXAUQ.mjs";
|
|
11
|
+
import "./chunk-R6FBYAY5.mjs";
|
|
12
12
|
import {
|
|
13
13
|
DEPOSIT_MODAL_OPEN_EVENT,
|
|
14
14
|
WITHDRAW_MODAL_OPEN_EVENT,
|
|
15
15
|
requestAggDepositModalOpen,
|
|
16
16
|
requestAggWithdrawModalOpen
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-YAEA6EDG.mjs";
|
|
18
|
+
import "./chunk-C5M2OOM3.mjs";
|
|
19
|
+
import "./chunk-YMVD6Q2A.mjs";
|
|
20
|
+
import "./chunk-DXF2LMNN.mjs";
|
|
21
21
|
export {
|
|
22
22
|
DEPOSIT_MODAL_OPEN_EVENT,
|
|
23
23
|
EventMarketPage,
|
package/dist/primitives.js
CHANGED
|
@@ -5002,7 +5002,7 @@ var Footer = ({
|
|
|
5002
5002
|
"div",
|
|
5003
5003
|
{
|
|
5004
5004
|
className: cn(
|
|
5005
|
-
"agg-footer-inner mx-auto flex h-10 w-full max-w-[
|
|
5005
|
+
"agg-footer-inner mx-auto flex h-10 w-full max-w-[1440px] px-6 lg:px-10 items-center justify-between",
|
|
5006
5006
|
classNames == null ? void 0 : classNames.inner
|
|
5007
5007
|
),
|
|
5008
5008
|
children: [
|
|
@@ -7403,7 +7403,7 @@ var Header = ({
|
|
|
7403
7403
|
"div",
|
|
7404
7404
|
{
|
|
7405
7405
|
className: cn(
|
|
7406
|
-
"agg-header-inner mx-auto flex h-auto w-full max-w-[
|
|
7406
|
+
"agg-header-inner mx-auto flex h-auto w-full max-w-[1440px] px-6 lg:px-10 items-center gap-2 md:gap-4 py-5",
|
|
7407
7407
|
classNames == null ? void 0 : classNames.inner
|
|
7408
7408
|
),
|
|
7409
7409
|
children: [
|
|
@@ -8445,7 +8445,37 @@ StateMessage.displayName = "StateMessage";
|
|
|
8445
8445
|
|
|
8446
8446
|
// src/primitives/tabs/index.tsx
|
|
8447
8447
|
var import_hooks34 = require("@agg-build/hooks");
|
|
8448
|
+
var import_react14 = require("react");
|
|
8449
|
+
|
|
8450
|
+
// src/shared/use-horizontal-scroll-state.ts
|
|
8448
8451
|
var import_react13 = require("react");
|
|
8452
|
+
var useHorizontalScrollState = () => {
|
|
8453
|
+
const containerRef = (0, import_react13.useRef)(null);
|
|
8454
|
+
const [canScrollLeft, setCanScrollLeft] = (0, import_react13.useState)(false);
|
|
8455
|
+
const [canScrollRight, setCanScrollRight] = (0, import_react13.useState)(false);
|
|
8456
|
+
const update = (0, import_react13.useCallback)(() => {
|
|
8457
|
+
const el = containerRef.current;
|
|
8458
|
+
if (!el) return;
|
|
8459
|
+
const maxScroll = el.scrollWidth - el.clientWidth;
|
|
8460
|
+
setCanScrollLeft(el.scrollLeft > 4);
|
|
8461
|
+
setCanScrollRight(maxScroll - el.scrollLeft > 4);
|
|
8462
|
+
}, []);
|
|
8463
|
+
(0, import_react13.useEffect)(() => {
|
|
8464
|
+
const el = containerRef.current;
|
|
8465
|
+
if (!el) return;
|
|
8466
|
+
el.addEventListener("scroll", update, { passive: true });
|
|
8467
|
+
return () => el.removeEventListener("scroll", update);
|
|
8468
|
+
}, [update]);
|
|
8469
|
+
(0, import_react13.useEffect)(() => {
|
|
8470
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
8471
|
+
const el = containerRef.current;
|
|
8472
|
+
if (!el) return;
|
|
8473
|
+
const ro = new ResizeObserver(() => update());
|
|
8474
|
+
ro.observe(el);
|
|
8475
|
+
return () => ro.disconnect();
|
|
8476
|
+
}, [update]);
|
|
8477
|
+
return { containerRef, canScrollLeft, canScrollRight, update };
|
|
8478
|
+
};
|
|
8449
8479
|
|
|
8450
8480
|
// src/primitives/tabs/tabs.constants.ts
|
|
8451
8481
|
var MOBILE_TABS_MEDIA_QUERY = "(max-width: 736px)";
|
|
@@ -8519,8 +8549,8 @@ var Tabs = ({
|
|
|
8519
8549
|
const {
|
|
8520
8550
|
features: { enableAnimations }
|
|
8521
8551
|
} = (0, import_hooks34.useSdkUiConfig)();
|
|
8522
|
-
const buttonRefs = (0,
|
|
8523
|
-
const dragStateRef = (0,
|
|
8552
|
+
const buttonRefs = (0, import_react14.useRef)([]);
|
|
8553
|
+
const dragStateRef = (0, import_react14.useRef)({
|
|
8524
8554
|
isPointerDown: false,
|
|
8525
8555
|
isDragging: false,
|
|
8526
8556
|
pointerId: null,
|
|
@@ -8528,29 +8558,30 @@ var Tabs = ({
|
|
|
8528
8558
|
startClientY: 0,
|
|
8529
8559
|
startScrollLeft: 0
|
|
8530
8560
|
});
|
|
8531
|
-
const suppressClickRef = (0,
|
|
8561
|
+
const suppressClickRef = (0, import_react14.useRef)(false);
|
|
8532
8562
|
const resolvedAriaLabel = ariaLabel != null ? ariaLabel : labels.common.tabsAria;
|
|
8533
|
-
const [isMobileViewport, setIsMobileViewport] = (0,
|
|
8534
|
-
const [isDraggingTabs, setIsDraggingTabs] = (0,
|
|
8535
|
-
const [activeUnderlineStyle, setActiveUnderlineStyle] = (0,
|
|
8563
|
+
const [isMobileViewport, setIsMobileViewport] = (0, import_react14.useState)(false);
|
|
8564
|
+
const [isDraggingTabs, setIsDraggingTabs] = (0, import_react14.useState)(false);
|
|
8565
|
+
const [activeUnderlineStyle, setActiveUnderlineStyle] = (0, import_react14.useState)({
|
|
8536
8566
|
transform: "translateX(0px)",
|
|
8537
8567
|
width: 0,
|
|
8538
8568
|
opacity: 0
|
|
8539
8569
|
});
|
|
8540
|
-
const
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
|
|
8544
|
-
|
|
8570
|
+
const {
|
|
8571
|
+
containerRef: tabListRef,
|
|
8572
|
+
canScrollLeft,
|
|
8573
|
+
canScrollRight,
|
|
8574
|
+
update: updateScrollState
|
|
8575
|
+
} = useHorizontalScrollState();
|
|
8545
8576
|
const isBarVariant = variant === "bar";
|
|
8546
|
-
const resolvedOverflowBehavior = (0,
|
|
8577
|
+
const resolvedOverflowBehavior = (0, import_react14.useMemo)(() => {
|
|
8547
8578
|
if (overflowBehavior) return overflowBehavior;
|
|
8548
8579
|
if (!isBarVariant) return "scroll";
|
|
8549
8580
|
return isMobileViewport ? "select" : "scroll";
|
|
8550
8581
|
}, [isBarVariant, isMobileViewport, overflowBehavior]);
|
|
8551
8582
|
const shouldUseOverflowScroll = resolvedOverflowBehavior === "scroll";
|
|
8552
8583
|
const shouldUseOverflowSelect = resolvedOverflowBehavior === "select";
|
|
8553
|
-
(0,
|
|
8584
|
+
(0, import_react14.useEffect)(() => {
|
|
8554
8585
|
if (typeof window === "undefined") return;
|
|
8555
8586
|
const mediaQueryList = window.matchMedia(MOBILE_TABS_MEDIA_QUERY);
|
|
8556
8587
|
const handleMediaQueryChange = (event) => {
|
|
@@ -8568,28 +8599,12 @@ var Tabs = ({
|
|
|
8568
8599
|
mediaQueryList.removeListener(handleMediaQueryChange);
|
|
8569
8600
|
};
|
|
8570
8601
|
}, []);
|
|
8571
|
-
const
|
|
8572
|
-
if (!shouldUseOverflowScroll) {
|
|
8573
|
-
setScrollAffordanceState({
|
|
8574
|
-
showStart: false,
|
|
8575
|
-
showEnd: false
|
|
8576
|
-
});
|
|
8577
|
-
return;
|
|
8578
|
-
}
|
|
8579
|
-
const tabListElement = tabListRef.current;
|
|
8580
|
-
if (!tabListElement) return;
|
|
8581
|
-
const maxScrollLeft = tabListElement.scrollWidth - tabListElement.clientWidth;
|
|
8582
|
-
setScrollAffordanceState({
|
|
8583
|
-
showStart: tabListElement.scrollLeft > 4,
|
|
8584
|
-
showEnd: maxScrollLeft - tabListElement.scrollLeft > 4
|
|
8585
|
-
});
|
|
8586
|
-
}, [shouldUseOverflowScroll]);
|
|
8587
|
-
const renderedItems = (0, import_react13.useMemo)(() => {
|
|
8602
|
+
const renderedItems = (0, import_react14.useMemo)(() => {
|
|
8588
8603
|
return items.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
8589
8604
|
disabled: item.disabled || item.isComingSoon
|
|
8590
8605
|
}));
|
|
8591
8606
|
}, [items]);
|
|
8592
|
-
const selectItems = (0,
|
|
8607
|
+
const selectItems = (0, import_react14.useMemo)(() => {
|
|
8593
8608
|
return renderedItems.map((item) => ({
|
|
8594
8609
|
value: item.value,
|
|
8595
8610
|
label: item.isComingSoon ? `${item.label} (soon)` : item.label,
|
|
@@ -8722,7 +8737,7 @@ var Tabs = ({
|
|
|
8722
8737
|
event == null ? void 0 : event.stopPropagation();
|
|
8723
8738
|
suppressClickRef.current = false;
|
|
8724
8739
|
};
|
|
8725
|
-
const updateActiveUnderline = (0,
|
|
8740
|
+
const updateActiveUnderline = (0, import_react14.useCallback)(() => {
|
|
8726
8741
|
if (isBarVariant) {
|
|
8727
8742
|
setActiveUnderlineStyle({
|
|
8728
8743
|
transform: "translateX(0px)",
|
|
@@ -8745,42 +8760,39 @@ var Tabs = ({
|
|
|
8745
8760
|
opacity: 1
|
|
8746
8761
|
});
|
|
8747
8762
|
}, [isBarVariant, renderedItems, value]);
|
|
8748
|
-
(0,
|
|
8763
|
+
(0, import_react14.useLayoutEffect)(() => {
|
|
8749
8764
|
updateActiveUnderline();
|
|
8750
8765
|
}, [updateActiveUnderline]);
|
|
8751
|
-
(0,
|
|
8766
|
+
(0, import_react14.useEffect)(() => {
|
|
8752
8767
|
if (isBarVariant || !shouldUseOverflowScroll) return;
|
|
8753
8768
|
const tabListElement = tabListRef.current;
|
|
8754
8769
|
if (!tabListElement) return;
|
|
8755
8770
|
const handleScroll = () => {
|
|
8756
8771
|
updateActiveUnderline();
|
|
8757
|
-
updateScrollAffordances();
|
|
8758
8772
|
};
|
|
8759
8773
|
tabListElement.addEventListener("scroll", handleScroll, { passive: true });
|
|
8760
|
-
updateScrollAffordances();
|
|
8761
8774
|
return () => {
|
|
8762
8775
|
tabListElement.removeEventListener("scroll", handleScroll);
|
|
8763
8776
|
};
|
|
8764
|
-
}, [isBarVariant, shouldUseOverflowScroll,
|
|
8765
|
-
(0,
|
|
8777
|
+
}, [isBarVariant, shouldUseOverflowScroll, tabListRef, updateActiveUnderline]);
|
|
8778
|
+
(0, import_react14.useEffect)(() => {
|
|
8766
8779
|
if (!shouldUseOverflowScroll) return;
|
|
8767
|
-
|
|
8768
|
-
}, [renderedItems, shouldUseOverflowScroll,
|
|
8769
|
-
(0,
|
|
8770
|
-
if (isBarVariant
|
|
8780
|
+
updateScrollState();
|
|
8781
|
+
}, [renderedItems, shouldUseOverflowScroll, updateScrollState, value]);
|
|
8782
|
+
(0, import_react14.useEffect)(() => {
|
|
8783
|
+
if (isBarVariant || !shouldUseOverflowScroll) return;
|
|
8771
8784
|
if (typeof ResizeObserver === "undefined") return;
|
|
8772
8785
|
const tabListElement = tabListRef.current;
|
|
8773
8786
|
if (!tabListElement) return;
|
|
8774
8787
|
const resizeObserver = new ResizeObserver(() => {
|
|
8775
8788
|
updateActiveUnderline();
|
|
8776
|
-
updateScrollAffordances();
|
|
8777
8789
|
});
|
|
8778
8790
|
resizeObserver.observe(tabListElement);
|
|
8779
8791
|
return () => {
|
|
8780
8792
|
resizeObserver.disconnect();
|
|
8781
8793
|
};
|
|
8782
|
-
}, [isBarVariant, shouldUseOverflowScroll,
|
|
8783
|
-
(0,
|
|
8794
|
+
}, [isBarVariant, shouldUseOverflowScroll, tabListRef, updateActiveUnderline]);
|
|
8795
|
+
(0, import_react14.useEffect)(() => {
|
|
8784
8796
|
if (!shouldUseOverflowScroll) return;
|
|
8785
8797
|
const tabListElement = tabListRef.current;
|
|
8786
8798
|
if (!tabListElement) return;
|
|
@@ -8927,7 +8939,7 @@ var Tabs = ({
|
|
|
8927
8939
|
"agg-tab-scroll-start",
|
|
8928
8940
|
"pointer-events-none absolute top-0 bottom-0 left-0 z-10 w-12 md:w-18 bg-linear-to-r from-agg-secondary via-agg-secondary to-transparent",
|
|
8929
8941
|
getMotionClassName(enableAnimations, "transition-opacity duration-200"),
|
|
8930
|
-
|
|
8942
|
+
canScrollLeft ? "opacity-100" : "opacity-0"
|
|
8931
8943
|
)
|
|
8932
8944
|
}
|
|
8933
8945
|
),
|
|
@@ -8939,24 +8951,63 @@ var Tabs = ({
|
|
|
8939
8951
|
"agg-tab-scroll-end",
|
|
8940
8952
|
"pointer-events-none absolute top-0 right-0 bottom-0 z-10 w-12 md:w-18 bg-linear-to-l from-agg-secondary via-agg-secondary to-transparent",
|
|
8941
8953
|
getMotionClassName(enableAnimations, "transition-opacity duration-200"),
|
|
8942
|
-
|
|
8954
|
+
canScrollRight ? "opacity-100" : "opacity-0"
|
|
8943
8955
|
)
|
|
8944
8956
|
}
|
|
8945
8957
|
)
|
|
8946
8958
|
] }) : null,
|
|
8947
|
-
shouldUseOverflowScroll && isBarVariant ? /* @__PURE__ */ (0, import_jsx_runtime127.
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
|
|
8952
|
-
"
|
|
8953
|
-
|
|
8954
|
-
|
|
8955
|
-
|
|
8956
|
-
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
|
|
8959
|
+
shouldUseOverflowScroll && isBarVariant ? /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(import_jsx_runtime127.Fragment, { children: [
|
|
8960
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
|
|
8961
|
+
"button",
|
|
8962
|
+
{
|
|
8963
|
+
type: "button",
|
|
8964
|
+
"aria-label": labels.common.scrollTabsLeft,
|
|
8965
|
+
tabIndex: -1,
|
|
8966
|
+
className: cn(
|
|
8967
|
+
"agg-tab-scroll-start",
|
|
8968
|
+
"absolute top-0 bottom-0 left-0 z-10 w-20 rounded-l-agg-lg",
|
|
8969
|
+
"inline-flex items-center justify-start pl-2",
|
|
8970
|
+
"bg-linear-to-r from-agg-secondary from-[25%] via-agg-secondary/80 to-transparent",
|
|
8971
|
+
"cursor-pointer",
|
|
8972
|
+
getMotionClassName(enableAnimations, "transition-opacity duration-200"),
|
|
8973
|
+
canScrollLeft ? "opacity-100" : "opacity-0 pointer-events-none"
|
|
8974
|
+
),
|
|
8975
|
+
onClick: () => {
|
|
8976
|
+
var _a;
|
|
8977
|
+
(_a = tabListRef.current) == null ? void 0 : _a.scrollBy({
|
|
8978
|
+
left: -200,
|
|
8979
|
+
behavior: getScrollBehavior(enableAnimations)
|
|
8980
|
+
});
|
|
8981
|
+
},
|
|
8982
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(Icon, { name: "chevron-left", size: "small", color: "currentColor" })
|
|
8983
|
+
}
|
|
8984
|
+
),
|
|
8985
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
|
|
8986
|
+
"button",
|
|
8987
|
+
{
|
|
8988
|
+
type: "button",
|
|
8989
|
+
"aria-label": labels.common.scrollTabsRight,
|
|
8990
|
+
tabIndex: -1,
|
|
8991
|
+
className: cn(
|
|
8992
|
+
"agg-tab-scroll-end",
|
|
8993
|
+
"absolute top-0 right-0 bottom-0 z-10 w-20 rounded-r-agg-lg",
|
|
8994
|
+
"inline-flex items-center justify-end pr-2",
|
|
8995
|
+
"bg-linear-to-l from-agg-secondary from-[25%] via-agg-secondary/80 to-transparent",
|
|
8996
|
+
"cursor-pointer",
|
|
8997
|
+
getMotionClassName(enableAnimations, "transition-opacity duration-200"),
|
|
8998
|
+
canScrollRight ? "opacity-100" : "opacity-0 pointer-events-none"
|
|
8999
|
+
),
|
|
9000
|
+
onClick: () => {
|
|
9001
|
+
var _a;
|
|
9002
|
+
(_a = tabListRef.current) == null ? void 0 : _a.scrollBy({
|
|
9003
|
+
left: 200,
|
|
9004
|
+
behavior: getScrollBehavior(enableAnimations)
|
|
9005
|
+
});
|
|
9006
|
+
},
|
|
9007
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(Icon, { name: "chevron-right", size: "small", color: "currentColor" })
|
|
9008
|
+
}
|
|
9009
|
+
)
|
|
9010
|
+
] }) : null
|
|
8960
9011
|
]
|
|
8961
9012
|
}
|
|
8962
9013
|
);
|
|
@@ -8965,7 +9016,7 @@ Tabs.displayName = "Tabs";
|
|
|
8965
9016
|
|
|
8966
9017
|
// src/primitives/toast/index.tsx
|
|
8967
9018
|
var RadixToast = __toESM(require("@radix-ui/react-toast"));
|
|
8968
|
-
var
|
|
9019
|
+
var import_react15 = require("react");
|
|
8969
9020
|
var import_jsx_runtime128 = require("react/jsx-runtime");
|
|
8970
9021
|
var DEFAULT_DURATION_MS = 5e3;
|
|
8971
9022
|
var EXIT_ANIMATION_MS = 350;
|
|
@@ -8981,7 +9032,7 @@ var TONE_ICON_NAME = {
|
|
|
8981
9032
|
warning: "warning-filled",
|
|
8982
9033
|
error: "error-filled"
|
|
8983
9034
|
};
|
|
8984
|
-
var ToastContext = (0,
|
|
9035
|
+
var ToastContext = (0, import_react15.createContext)(null);
|
|
8985
9036
|
function ToastProvider({
|
|
8986
9037
|
children,
|
|
8987
9038
|
defaultDurationMs = DEFAULT_DURATION_MS,
|
|
@@ -8989,12 +9040,12 @@ function ToastProvider({
|
|
|
8989
9040
|
swipeThreshold = 50,
|
|
8990
9041
|
viewportClassName
|
|
8991
9042
|
}) {
|
|
8992
|
-
const [toasts, setToasts] = (0,
|
|
8993
|
-
const idRef = (0,
|
|
8994
|
-
const dismiss = (0,
|
|
9043
|
+
const [toasts, setToasts] = (0, import_react15.useState)([]);
|
|
9044
|
+
const idRef = (0, import_react15.useRef)(0);
|
|
9045
|
+
const dismiss = (0, import_react15.useCallback)((id) => {
|
|
8995
9046
|
setToasts((current) => current.filter((entry) => entry.id !== id));
|
|
8996
9047
|
}, []);
|
|
8997
|
-
const toast = (0,
|
|
9048
|
+
const toast = (0, import_react15.useCallback)(
|
|
8998
9049
|
(message, options) => {
|
|
8999
9050
|
const id = ++idRef.current;
|
|
9000
9051
|
setToasts((current) => {
|
|
@@ -9039,31 +9090,31 @@ function ToastProvider({
|
|
|
9039
9090
|
] }) });
|
|
9040
9091
|
}
|
|
9041
9092
|
function ToastRow({ entry, onOpenChange }) {
|
|
9042
|
-
const [isOpen, setIsOpen] = (0,
|
|
9093
|
+
const [isOpen, setIsOpen] = (0, import_react15.useState)(true);
|
|
9043
9094
|
const hasAutoDismiss = entry.durationMs > 0 && Number.isFinite(entry.durationMs);
|
|
9044
9095
|
const duration = hasAutoDismiss ? entry.durationMs : Number.POSITIVE_INFINITY;
|
|
9045
|
-
const timeoutRef = (0,
|
|
9046
|
-
const closeTimeoutRef = (0,
|
|
9047
|
-
const remainingMsRef = (0,
|
|
9048
|
-
const timerStartedAtRef = (0,
|
|
9049
|
-
const onOpenChangeRef = (0,
|
|
9096
|
+
const timeoutRef = (0, import_react15.useRef)(null);
|
|
9097
|
+
const closeTimeoutRef = (0, import_react15.useRef)(null);
|
|
9098
|
+
const remainingMsRef = (0, import_react15.useRef)(duration);
|
|
9099
|
+
const timerStartedAtRef = (0, import_react15.useRef)(null);
|
|
9100
|
+
const onOpenChangeRef = (0, import_react15.useRef)(onOpenChange);
|
|
9050
9101
|
const rootStyle = {
|
|
9051
9102
|
"--agg-toast-duration": `${duration}ms`
|
|
9052
9103
|
};
|
|
9053
|
-
(0,
|
|
9104
|
+
(0, import_react15.useEffect)(() => {
|
|
9054
9105
|
onOpenChangeRef.current = onOpenChange;
|
|
9055
9106
|
}, [onOpenChange]);
|
|
9056
|
-
const clearDismissTimer = (0,
|
|
9107
|
+
const clearDismissTimer = (0, import_react15.useCallback)(() => {
|
|
9057
9108
|
if (!timeoutRef.current) return;
|
|
9058
9109
|
clearTimeout(timeoutRef.current);
|
|
9059
9110
|
timeoutRef.current = null;
|
|
9060
9111
|
}, []);
|
|
9061
|
-
const clearCloseTimer = (0,
|
|
9112
|
+
const clearCloseTimer = (0, import_react15.useCallback)(() => {
|
|
9062
9113
|
if (!closeTimeoutRef.current) return;
|
|
9063
9114
|
clearTimeout(closeTimeoutRef.current);
|
|
9064
9115
|
closeTimeoutRef.current = null;
|
|
9065
9116
|
}, []);
|
|
9066
|
-
const handleOpenChange = (0,
|
|
9117
|
+
const handleOpenChange = (0, import_react15.useCallback)(
|
|
9067
9118
|
(open) => {
|
|
9068
9119
|
if (open) {
|
|
9069
9120
|
clearCloseTimer();
|
|
@@ -9080,7 +9131,7 @@ function ToastRow({ entry, onOpenChange }) {
|
|
|
9080
9131
|
},
|
|
9081
9132
|
[clearCloseTimer, clearDismissTimer]
|
|
9082
9133
|
);
|
|
9083
|
-
const startDismissTimer = (0,
|
|
9134
|
+
const startDismissTimer = (0, import_react15.useCallback)(() => {
|
|
9084
9135
|
if (!hasAutoDismiss) return;
|
|
9085
9136
|
clearDismissTimer();
|
|
9086
9137
|
timerStartedAtRef.current = Date.now();
|
|
@@ -9088,18 +9139,18 @@ function ToastRow({ entry, onOpenChange }) {
|
|
|
9088
9139
|
handleOpenChange(false);
|
|
9089
9140
|
}, remainingMsRef.current);
|
|
9090
9141
|
}, [clearDismissTimer, handleOpenChange, hasAutoDismiss]);
|
|
9091
|
-
const handlePauseDismissTimer = (0,
|
|
9142
|
+
const handlePauseDismissTimer = (0, import_react15.useCallback)(() => {
|
|
9092
9143
|
if (!hasAutoDismiss || timerStartedAtRef.current === null) return;
|
|
9093
9144
|
const elapsedMs = Date.now() - timerStartedAtRef.current;
|
|
9094
9145
|
remainingMsRef.current = Math.max(0, remainingMsRef.current - elapsedMs);
|
|
9095
9146
|
timerStartedAtRef.current = null;
|
|
9096
9147
|
clearDismissTimer();
|
|
9097
9148
|
}, [clearDismissTimer, hasAutoDismiss]);
|
|
9098
|
-
const handleResumeDismissTimer = (0,
|
|
9149
|
+
const handleResumeDismissTimer = (0, import_react15.useCallback)(() => {
|
|
9099
9150
|
if (!hasAutoDismiss || timerStartedAtRef.current !== null) return;
|
|
9100
9151
|
startDismissTimer();
|
|
9101
9152
|
}, [hasAutoDismiss, startDismissTimer]);
|
|
9102
|
-
(0,
|
|
9153
|
+
(0, import_react15.useEffect)(() => {
|
|
9103
9154
|
remainingMsRef.current = duration;
|
|
9104
9155
|
startDismissTimer();
|
|
9105
9156
|
return () => {
|
|
@@ -9171,20 +9222,20 @@ function ToastRow({ entry, onOpenChange }) {
|
|
|
9171
9222
|
);
|
|
9172
9223
|
}
|
|
9173
9224
|
function useToast() {
|
|
9174
|
-
const ctx = (0,
|
|
9225
|
+
const ctx = (0, import_react15.useContext)(ToastContext);
|
|
9175
9226
|
if (!ctx) {
|
|
9176
9227
|
throw new Error("useToast must be used within a <ToastProvider>");
|
|
9177
9228
|
}
|
|
9178
9229
|
return ctx;
|
|
9179
9230
|
}
|
|
9180
9231
|
function useOptionalToast() {
|
|
9181
|
-
return (0,
|
|
9232
|
+
return (0, import_react15.useContext)(ToastContext);
|
|
9182
9233
|
}
|
|
9183
9234
|
|
|
9184
9235
|
// src/primitives/tooltip/index.tsx
|
|
9185
9236
|
var import_hooks35 = require("@agg-build/hooks");
|
|
9186
9237
|
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"));
|
|
9187
|
-
var
|
|
9238
|
+
var import_react16 = require("react");
|
|
9188
9239
|
|
|
9189
9240
|
// src/primitives/tooltip/tooltip.constants.ts
|
|
9190
9241
|
var tooltipSizeClasses = {
|
|
@@ -9232,7 +9283,7 @@ var Tooltip = ({
|
|
|
9232
9283
|
general: { rootClassName },
|
|
9233
9284
|
features: { enableAnimations }
|
|
9234
9285
|
} = (0, import_hooks35.useSdkUiConfig)();
|
|
9235
|
-
const trigger = (0,
|
|
9286
|
+
const trigger = (0, import_react16.useMemo)(() => {
|
|
9236
9287
|
if (children) return children;
|
|
9237
9288
|
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
9238
9289
|
"button",
|