@luxfi/ui 7.3.0 → 7.3.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.
- package/dist/accordion.d.cts +74 -0
- package/dist/accordion.d.ts +74 -0
- package/dist/alert.d.cts +30 -0
- package/dist/alert.d.ts +30 -0
- package/dist/avatar.d.cts +25 -0
- package/dist/avatar.d.ts +25 -0
- package/dist/badge.d.cts +19 -0
- package/dist/badge.d.ts +19 -0
- package/dist/bank.d.cts +76 -0
- package/dist/bank.d.ts +76 -0
- package/dist/button.d.cts +55 -0
- package/dist/button.d.ts +55 -0
- package/dist/checkbox.d.cts +31 -0
- package/dist/checkbox.d.ts +31 -0
- package/dist/close-button.d.cts +9 -0
- package/dist/close-button.d.ts +9 -0
- package/dist/collapsible.d.cts +23 -0
- package/dist/collapsible.d.ts +23 -0
- package/dist/color-mode.d.cts +25 -0
- package/dist/color-mode.d.ts +25 -0
- package/dist/dialog.d.cts +65 -0
- package/dist/dialog.d.ts +65 -0
- package/dist/drawer.d.cts +36 -0
- package/dist/drawer.d.ts +36 -0
- package/dist/empty-state.d.cts +13 -0
- package/dist/empty-state.d.ts +13 -0
- package/dist/expiration-selector.d.cts +16 -0
- package/dist/expiration-selector.d.ts +16 -0
- package/dist/field.d.cts +24 -0
- package/dist/field.d.ts +24 -0
- package/dist/greeks-display.d.cts +14 -0
- package/dist/greeks-display.d.ts +14 -0
- package/dist/heading.d.cts +10 -0
- package/dist/heading.d.ts +10 -0
- package/dist/icon-button.d.cts +33 -0
- package/dist/icon-button.d.ts +33 -0
- package/dist/image.d.cts +57 -0
- package/dist/image.d.ts +57 -0
- package/dist/index.cjs +278 -275
- package/dist/index.d.cts +56 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.js +278 -275
- package/dist/input-group.d.cts +17 -0
- package/dist/input-group.d.ts +17 -0
- package/dist/input.d.cts +11 -0
- package/dist/input.d.ts +11 -0
- package/dist/link.d.cts +37 -0
- package/dist/link.d.ts +37 -0
- package/dist/menu.d.cts +84 -0
- package/dist/menu.d.ts +84 -0
- package/dist/option-chain.d.cts +37 -0
- package/dist/option-chain.d.ts +37 -0
- package/dist/option-position.d.cts +29 -0
- package/dist/option-position.d.ts +29 -0
- package/dist/pin-input.d.cts +25 -0
- package/dist/pin-input.d.ts +25 -0
- package/dist/pnl-diagram.d.cts +11 -0
- package/dist/pnl-diagram.d.ts +11 -0
- package/dist/popover.d.cts +73 -0
- package/dist/popover.d.ts +73 -0
- package/dist/progress-circle.d.cts +47 -0
- package/dist/progress-circle.d.ts +47 -0
- package/dist/progress.d.cts +28 -0
- package/dist/progress.d.ts +28 -0
- package/dist/provider.cjs +9 -1
- package/dist/provider.d.cts +12 -0
- package/dist/provider.d.ts +12 -0
- package/dist/provider.js +5 -1
- package/dist/radio.d.cts +53 -0
- package/dist/radio.d.ts +53 -0
- package/dist/rating.d.cts +14 -0
- package/dist/rating.d.ts +14 -0
- package/dist/select.d.cts +130 -0
- package/dist/select.d.ts +130 -0
- package/dist/separator.d.cts +13 -0
- package/dist/separator.d.ts +13 -0
- package/dist/skeleton.d.cts +60 -0
- package/dist/skeleton.d.ts +60 -0
- package/dist/slider.d.cts +24 -0
- package/dist/slider.d.ts +24 -0
- package/dist/strategy-builder.d.cts +26 -0
- package/dist/strategy-builder.d.ts +26 -0
- package/dist/switch.d.cts +27 -0
- package/dist/switch.d.ts +27 -0
- package/dist/table.d.cts +107 -0
- package/dist/table.d.ts +107 -0
- package/dist/tabs.d.cts +78 -0
- package/dist/tabs.d.ts +78 -0
- package/dist/tag.d.cts +21 -0
- package/dist/tag.d.ts +21 -0
- package/dist/textarea.d.cts +11 -0
- package/dist/textarea.d.ts +11 -0
- package/dist/toaster.d.cts +29 -0
- package/dist/toaster.d.ts +29 -0
- package/dist/tooltip.d.cts +38 -0
- package/dist/tooltip.d.ts +38 -0
- package/dist/utils.d.cts +5 -0
- package/dist/utils.d.ts +5 -0
- package/package.json +1 -1
- package/src/index.ts +0 -2
- package/src/provider.tsx +3 -2
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { styled, View, Text, createGui } from '@hanzogui/core';
|
|
3
3
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
4
|
+
import * as React30 from 'react';
|
|
5
|
+
import React30__default from 'react';
|
|
4
6
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
7
|
import { clsx } from 'clsx';
|
|
6
8
|
import { twMerge } from 'tailwind-merge';
|
|
7
9
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
8
|
-
import * as React29 from 'react';
|
|
9
|
-
import React29__default from 'react';
|
|
10
10
|
import * as RadixAvatar from '@radix-ui/react-avatar';
|
|
11
11
|
import { TooltipGroup, Tooltip as Tooltip$1 } from '@hanzogui/tooltip';
|
|
12
12
|
import { useClickAway, useDebounce } from '@uidotdev/usehooks';
|
|
@@ -31,21 +31,24 @@ import { toast, Toaster as Toaster$1 } from 'sonner';
|
|
|
31
31
|
var _guiInitialized = false;
|
|
32
32
|
function ensureGui() {
|
|
33
33
|
if (_guiInitialized) return;
|
|
34
|
+
if (typeof window === "undefined") return;
|
|
34
35
|
createGui({ settings: { autocompleteSpecificTokens: "except-special" } });
|
|
35
36
|
_guiInitialized = true;
|
|
36
37
|
}
|
|
37
|
-
ensureGui();
|
|
38
38
|
var defaultQueryClient = new QueryClient({
|
|
39
39
|
defaultOptions: { queries: { refetchOnWindowFocus: false, retry: 1, staleTime: 3e4 } }
|
|
40
40
|
});
|
|
41
41
|
var AppProvider = ({ children, queryClient }) => {
|
|
42
|
+
React30__default.useEffect(() => {
|
|
43
|
+
ensureGui();
|
|
44
|
+
}, []);
|
|
42
45
|
return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient ?? defaultQueryClient, children });
|
|
43
46
|
};
|
|
44
47
|
function cn(...inputs) {
|
|
45
48
|
return twMerge(clsx(inputs));
|
|
46
49
|
}
|
|
47
50
|
var IndicatorIcon = ({ className }) => /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M7.5 15L12.5 10L7.5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
48
|
-
var AccordionRoot =
|
|
51
|
+
var AccordionRoot = React30.forwardRef(
|
|
49
52
|
function AccordionRoot2(props, ref) {
|
|
50
53
|
const {
|
|
51
54
|
multiple: _multiple,
|
|
@@ -64,7 +67,7 @@ var AccordionRoot = React29.forwardRef(
|
|
|
64
67
|
borderRadius: _borderRadius,
|
|
65
68
|
...rest
|
|
66
69
|
} = props;
|
|
67
|
-
const handleValueChange =
|
|
70
|
+
const handleValueChange = React30.useCallback(
|
|
68
71
|
(next) => {
|
|
69
72
|
onValueChange?.({ value: next });
|
|
70
73
|
},
|
|
@@ -92,7 +95,7 @@ var AccordionRoot = React29.forwardRef(
|
|
|
92
95
|
);
|
|
93
96
|
}
|
|
94
97
|
);
|
|
95
|
-
var AccordionItem =
|
|
98
|
+
var AccordionItem = React30.forwardRef(
|
|
96
99
|
function AccordionItem2(props, ref) {
|
|
97
100
|
const { className, as: _as, _first, _last, display: _display, ...rest } = props;
|
|
98
101
|
return /* @__PURE__ */ jsx(
|
|
@@ -108,7 +111,7 @@ var AccordionItem = React29.forwardRef(
|
|
|
108
111
|
);
|
|
109
112
|
}
|
|
110
113
|
);
|
|
111
|
-
var AccordionItemTrigger =
|
|
114
|
+
var AccordionItemTrigger = React30.forwardRef(function AccordionItemTrigger2(props, ref) {
|
|
112
115
|
const {
|
|
113
116
|
children,
|
|
114
117
|
indicatorPlacement: indicatorPlacementProp,
|
|
@@ -173,7 +176,7 @@ var AccordionItemTrigger = React29.forwardRef(function AccordionItemTrigger2(pro
|
|
|
173
176
|
}
|
|
174
177
|
) }) });
|
|
175
178
|
});
|
|
176
|
-
var AccordionItemContent =
|
|
179
|
+
var AccordionItemContent = React30.forwardRef(function AccordionItemContent2(props, ref) {
|
|
177
180
|
const { className, children, pb: _pb, pr: _pr, pl: _pl, w: _w, display: _display, flexDir: _flexDir, rowGap: _rowGap, ...rest } = props;
|
|
178
181
|
return /* @__PURE__ */ jsx(
|
|
179
182
|
AccordionPrimitive.Content,
|
|
@@ -191,11 +194,11 @@ var AccordionItemContent = React29.forwardRef(function AccordionItemContent2(pro
|
|
|
191
194
|
);
|
|
192
195
|
});
|
|
193
196
|
function useAccordion(items) {
|
|
194
|
-
const [value, setValue] =
|
|
195
|
-
const onValueChange =
|
|
197
|
+
const [value, setValue] = React30.useState([]);
|
|
198
|
+
const onValueChange = React30.useCallback(({ value: value2 }) => {
|
|
196
199
|
setValue(value2);
|
|
197
200
|
}, []);
|
|
198
|
-
const scrollToItemFromUrl =
|
|
201
|
+
const scrollToItemFromUrl = React30.useCallback(() => {
|
|
199
202
|
const hash = window.location.hash.replace("#", "");
|
|
200
203
|
if (!hash) {
|
|
201
204
|
return;
|
|
@@ -209,7 +212,7 @@ function useAccordion(items) {
|
|
|
209
212
|
setValue([itemToScroll.id]);
|
|
210
213
|
}
|
|
211
214
|
}, [items]);
|
|
212
|
-
return
|
|
215
|
+
return React30.useMemo(() => {
|
|
213
216
|
return {
|
|
214
217
|
value,
|
|
215
218
|
onValueChange,
|
|
@@ -252,7 +255,7 @@ var CLOSE_BUTTON_CLASSES = [
|
|
|
252
255
|
"hover:text-[var(--hover-color,currentColor)]",
|
|
253
256
|
"disabled:opacity-40"
|
|
254
257
|
].join(" ");
|
|
255
|
-
var CloseButton =
|
|
258
|
+
var CloseButton = React30.forwardRef(function CloseButton2(props, ref) {
|
|
256
259
|
const { variant: _variant, size: _size, className, children, ...rest } = props;
|
|
257
260
|
return /* @__PURE__ */ jsx(
|
|
258
261
|
CloseButtonFrame,
|
|
@@ -399,7 +402,7 @@ var SKELETON_CLASSES = [
|
|
|
399
402
|
"bg-[length:200%_100%]"
|
|
400
403
|
].join(" ");
|
|
401
404
|
var HIDE_BELOW_MAP = { lg: "lg:hidden", md: "md:hidden", sm: "sm:hidden" };
|
|
402
|
-
var Skeleton =
|
|
405
|
+
var Skeleton = React30.forwardRef(
|
|
403
406
|
function Skeleton2(props, ref) {
|
|
404
407
|
const { loading = false, asChild, className, children, style: styleProp, as: Component = "div", ...allRest } = props;
|
|
405
408
|
const shimStyle = shimToStyle(props);
|
|
@@ -408,10 +411,10 @@ var Skeleton = React29.forwardRef(
|
|
|
408
411
|
const cls = hideBelowClass ? cn(className, hideBelowClass) : className;
|
|
409
412
|
const htmlRest = stripShims(allRest);
|
|
410
413
|
if (!loading) {
|
|
411
|
-
if (asChild &&
|
|
414
|
+
if (asChild && React30.isValidElement(children)) return children;
|
|
412
415
|
return /* @__PURE__ */ jsx(Component, { ref, className: cls, style: mergedStyle, ...htmlRest, children });
|
|
413
416
|
}
|
|
414
|
-
if (asChild &&
|
|
417
|
+
if (asChild && React30.isValidElement(children)) {
|
|
415
418
|
return /* @__PURE__ */ jsx(
|
|
416
419
|
Component,
|
|
417
420
|
{
|
|
@@ -437,7 +440,7 @@ var Skeleton = React29.forwardRef(
|
|
|
437
440
|
);
|
|
438
441
|
}
|
|
439
442
|
);
|
|
440
|
-
var SkeletonCircle =
|
|
443
|
+
var SkeletonCircle = React30.forwardRef(
|
|
441
444
|
function SkeletonCircle2(props, ref) {
|
|
442
445
|
const { size = 40, loading = true, className, ...rest } = props;
|
|
443
446
|
const dimension = typeof size === "number" ? `${size}px` : size;
|
|
@@ -453,7 +456,7 @@ var SkeletonCircle = React29.forwardRef(
|
|
|
453
456
|
);
|
|
454
457
|
}
|
|
455
458
|
);
|
|
456
|
-
var SkeletonText =
|
|
459
|
+
var SkeletonText = React30.forwardRef(
|
|
457
460
|
function SkeletonText2(props, ref) {
|
|
458
461
|
const { noOfLines = 3, loading = true, className, ...rest } = props;
|
|
459
462
|
return /* @__PURE__ */ jsx("div", { ref, className: cn("flex w-full flex-col gap-2", className), ...rest, children: Array.from({ length: noOfLines }).map((_, index) => /* @__PURE__ */ jsx(
|
|
@@ -483,7 +486,7 @@ var INDICATOR_SIZE_CLASSES = {
|
|
|
483
486
|
sm: "w-5 h-5 my-0",
|
|
484
487
|
md: "w-5 h-5 my-[2px]"
|
|
485
488
|
};
|
|
486
|
-
var Alert =
|
|
489
|
+
var Alert = React30.forwardRef(
|
|
487
490
|
function Alert2(props, ref) {
|
|
488
491
|
const {
|
|
489
492
|
title,
|
|
@@ -508,7 +511,7 @@ var Alert = React29.forwardRef(
|
|
|
508
511
|
if (_mb !== void 0) shimStyle.marginBottom = typeof _mb === "number" ? `${_mb * 4}px` : _mb;
|
|
509
512
|
if (_mt !== void 0) shimStyle.marginTop = typeof _mt === "number" ? `${_mt * 4}px` : _mt;
|
|
510
513
|
const alertStyle = Object.keys(shimStyle).length > 0 ? shimStyle : void 0;
|
|
511
|
-
const [isOpen, setIsOpen] =
|
|
514
|
+
const [isOpen, setIsOpen] = React30.useState(true);
|
|
512
515
|
const resolvedSize = size ?? "md";
|
|
513
516
|
const defaultIcon = /* @__PURE__ */ jsx(IndicatorIcon2, { className: "w-5 h-5" });
|
|
514
517
|
const iconElement = (() => {
|
|
@@ -523,7 +526,7 @@ var Alert = React29.forwardRef(
|
|
|
523
526
|
INDICATOR_SIZE_CLASSES[resolvedSize]
|
|
524
527
|
), children: icon || defaultIcon });
|
|
525
528
|
})();
|
|
526
|
-
const handleClose =
|
|
529
|
+
const handleClose = React30.useCallback(() => {
|
|
527
530
|
setIsOpen(false);
|
|
528
531
|
onClose?.();
|
|
529
532
|
}, [onClose]);
|
|
@@ -599,11 +602,11 @@ var VARIANT_CLASSES = {
|
|
|
599
602
|
};
|
|
600
603
|
var DEFAULT_SIZE = "md";
|
|
601
604
|
var DEFAULT_VARIANT = "subtle";
|
|
602
|
-
var AvatarGroupContext =
|
|
605
|
+
var AvatarGroupContext = React30.createContext({});
|
|
603
606
|
function useAvatarGroupContext() {
|
|
604
|
-
return
|
|
607
|
+
return React30.useContext(AvatarGroupContext);
|
|
605
608
|
}
|
|
606
|
-
var Avatar =
|
|
609
|
+
var Avatar = React30.forwardRef(
|
|
607
610
|
function Avatar2(props, ref) {
|
|
608
611
|
const group = useAvatarGroupContext();
|
|
609
612
|
const {
|
|
@@ -653,7 +656,7 @@ var Avatar = React29.forwardRef(
|
|
|
653
656
|
);
|
|
654
657
|
}
|
|
655
658
|
);
|
|
656
|
-
var AvatarFallback =
|
|
659
|
+
var AvatarFallback = React30.forwardRef(
|
|
657
660
|
function AvatarFallback2(props, ref) {
|
|
658
661
|
const { name, icon, children, className, ...rest } = props;
|
|
659
662
|
return /* @__PURE__ */ jsxs(
|
|
@@ -680,10 +683,10 @@ function getInitials(name) {
|
|
|
680
683
|
const lastName = names.length > 1 ? names[names.length - 1] : "";
|
|
681
684
|
return firstName && lastName ? `${firstName.charAt(0)}${lastName.charAt(0)}` : firstName.charAt(0);
|
|
682
685
|
}
|
|
683
|
-
var AvatarGroup =
|
|
686
|
+
var AvatarGroup = React30.forwardRef(
|
|
684
687
|
function AvatarGroup2(props, ref) {
|
|
685
688
|
const { size, variant, borderless, className, ...rest } = props;
|
|
686
|
-
const contextValue =
|
|
689
|
+
const contextValue = React30.useMemo(
|
|
687
690
|
() => ({ size, variant, borderless }),
|
|
688
691
|
[size, variant, borderless]
|
|
689
692
|
);
|
|
@@ -699,11 +702,11 @@ var AvatarGroup = React29.forwardRef(
|
|
|
699
702
|
);
|
|
700
703
|
var LG_BREAKPOINT = 1024;
|
|
701
704
|
function useIsMobile() {
|
|
702
|
-
const [isMobile, setIsMobile] =
|
|
705
|
+
const [isMobile, setIsMobile] = React30.useState(() => {
|
|
703
706
|
if (typeof window === "undefined") return false;
|
|
704
707
|
return window.innerWidth < LG_BREAKPOINT;
|
|
705
708
|
});
|
|
706
|
-
|
|
709
|
+
React30.useEffect(() => {
|
|
707
710
|
const mql = window.matchMedia(`(max-width: ${LG_BREAKPOINT - 1}px)`);
|
|
708
711
|
const handler = (e) => setIsMobile(e.matches);
|
|
709
712
|
setIsMobile(mql.matches);
|
|
@@ -716,7 +719,7 @@ function mapPlacement(p) {
|
|
|
716
719
|
if (!p) return void 0;
|
|
717
720
|
return p;
|
|
718
721
|
}
|
|
719
|
-
var Tooltip =
|
|
722
|
+
var Tooltip = React30.forwardRef(
|
|
720
723
|
function Tooltip2(props, ref) {
|
|
721
724
|
const {
|
|
722
725
|
showArrow: showArrowProp,
|
|
@@ -735,28 +738,28 @@ var Tooltip = React29.forwardRef(
|
|
|
735
738
|
interactive,
|
|
736
739
|
positioning
|
|
737
740
|
} = props;
|
|
738
|
-
const [open, setOpen] =
|
|
739
|
-
const timeoutRef =
|
|
741
|
+
const [open, setOpen] = React30.useState(defaultOpen);
|
|
742
|
+
const timeoutRef = React30.useRef(null);
|
|
740
743
|
const isMobile = useIsMobile();
|
|
741
|
-
const handleOpenChange =
|
|
744
|
+
const handleOpenChange = React30.useCallback((nextOpen) => {
|
|
742
745
|
setOpen(nextOpen);
|
|
743
746
|
onOpenChange?.({ open: nextOpen });
|
|
744
747
|
}, [onOpenChange]);
|
|
745
|
-
const handleOpenChangeManual =
|
|
748
|
+
const handleOpenChangeManual = React30.useCallback((nextOpen) => {
|
|
746
749
|
timeoutRef.current && window.clearTimeout(timeoutRef.current);
|
|
747
750
|
timeoutRef.current = window.setTimeout(() => {
|
|
748
751
|
setOpen(nextOpen);
|
|
749
752
|
onOpenChange?.({ open: nextOpen });
|
|
750
753
|
}, nextOpen ? openDelay : closeDelay);
|
|
751
754
|
}, [closeDelay, openDelay, onOpenChange]);
|
|
752
|
-
const handleClickAway =
|
|
755
|
+
const handleClickAway = React30.useCallback(() => {
|
|
753
756
|
handleOpenChangeManual(false);
|
|
754
757
|
}, [handleOpenChangeManual]);
|
|
755
758
|
const triggerRef = useClickAway(handleClickAway);
|
|
756
|
-
const handleTriggerClick =
|
|
759
|
+
const handleTriggerClick = React30.useCallback(() => {
|
|
757
760
|
handleOpenChangeManual(!open);
|
|
758
761
|
}, [handleOpenChangeManual, open]);
|
|
759
|
-
const handleContentClick =
|
|
762
|
+
const handleContentClick = React30.useCallback((event) => {
|
|
760
763
|
event.stopPropagation();
|
|
761
764
|
if (interactive) {
|
|
762
765
|
const closestLink = event.target?.closest("a");
|
|
@@ -765,7 +768,7 @@ var Tooltip = React29.forwardRef(
|
|
|
765
768
|
}
|
|
766
769
|
}
|
|
767
770
|
}, [interactive, handleOpenChangeManual]);
|
|
768
|
-
|
|
771
|
+
React30.useEffect(() => {
|
|
769
772
|
return () => {
|
|
770
773
|
if (timeoutRef.current) {
|
|
771
774
|
clearTimeout(timeoutRef.current);
|
|
@@ -867,7 +870,7 @@ var COLOR_PALETTE_CLASSES = {
|
|
|
867
870
|
bright_pink: "bg-badge-bright-pink-bg text-badge-bright-pink-fg"
|
|
868
871
|
};
|
|
869
872
|
var S2 = 4;
|
|
870
|
-
var Badge =
|
|
873
|
+
var Badge = React30__default.forwardRef(
|
|
871
874
|
function Badge2(props, ref) {
|
|
872
875
|
const {
|
|
873
876
|
loading,
|
|
@@ -1116,7 +1119,7 @@ function buildShimStyle(props) {
|
|
|
1116
1119
|
if (props.borderTopRightRadius !== void 0) s.borderTopRightRadius = typeof props.borderTopRightRadius === "number" ? `${props.borderTopRightRadius}px` : props.borderTopRightRadius;
|
|
1117
1120
|
return Object.keys(s).length > 0 ? s : void 0;
|
|
1118
1121
|
}
|
|
1119
|
-
var Button =
|
|
1122
|
+
var Button = React30.forwardRef(
|
|
1120
1123
|
function Button2(props, ref) {
|
|
1121
1124
|
const {
|
|
1122
1125
|
className,
|
|
@@ -1218,7 +1221,7 @@ function buttonVariants(opts) {
|
|
|
1218
1221
|
const s = opts?.size ?? "md";
|
|
1219
1222
|
return [BASE_CLASSES2, VARIANT_CLASSES2[v] ?? "", SIZE_CLASSES4[s] ?? ""].filter(Boolean).join(" ");
|
|
1220
1223
|
}
|
|
1221
|
-
var ButtonGroup =
|
|
1224
|
+
var ButtonGroup = React30.forwardRef(
|
|
1222
1225
|
function ButtonGroup2(props, ref) {
|
|
1223
1226
|
const { className, ...rest } = props;
|
|
1224
1227
|
return /* @__PURE__ */ jsx(
|
|
@@ -1232,7 +1235,7 @@ var ButtonGroup = React29.forwardRef(
|
|
|
1232
1235
|
);
|
|
1233
1236
|
}
|
|
1234
1237
|
);
|
|
1235
|
-
var ButtonGroupRadio =
|
|
1238
|
+
var ButtonGroupRadio = React30.forwardRef(
|
|
1236
1239
|
function ButtonGroupRadio2(props, ref) {
|
|
1237
1240
|
const {
|
|
1238
1241
|
children,
|
|
@@ -1244,24 +1247,24 @@ var ButtonGroupRadio = React29.forwardRef(
|
|
|
1244
1247
|
className,
|
|
1245
1248
|
...rest
|
|
1246
1249
|
} = props;
|
|
1247
|
-
const firstChildValue =
|
|
1250
|
+
const firstChildValue = React30.useMemo(() => {
|
|
1248
1251
|
const firstChild = Array.isArray(children) ? children[0] : void 0;
|
|
1249
1252
|
return typeof firstChild?.props.value === "string" ? firstChild.props.value : void 0;
|
|
1250
1253
|
}, [children]);
|
|
1251
|
-
const [value, setValue] =
|
|
1252
|
-
const handleItemClick =
|
|
1254
|
+
const [value, setValue] = React30.useState(defaultValue ?? firstChildValue);
|
|
1255
|
+
const handleItemClick = React30.useCallback((event) => {
|
|
1253
1256
|
const v = event.currentTarget.value;
|
|
1254
1257
|
setValue(v);
|
|
1255
1258
|
onChange?.(v);
|
|
1256
1259
|
}, [onChange]);
|
|
1257
|
-
const clonedChildren =
|
|
1258
|
-
return
|
|
1260
|
+
const clonedChildren = React30.Children.map(children, (child) => {
|
|
1261
|
+
return React30.cloneElement(child, {
|
|
1259
1262
|
onClick: handleItemClick,
|
|
1260
1263
|
selected: value === child.props.value,
|
|
1261
1264
|
variant
|
|
1262
1265
|
});
|
|
1263
1266
|
});
|
|
1264
|
-
const childrenLength =
|
|
1267
|
+
const childrenLength = React30.Children.count(children);
|
|
1265
1268
|
return /* @__PURE__ */ jsx(Skeleton, { loading, children: /* @__PURE__ */ jsx(
|
|
1266
1269
|
"div",
|
|
1267
1270
|
{
|
|
@@ -1281,11 +1284,11 @@ var ButtonGroupRadio = React29.forwardRef(
|
|
|
1281
1284
|
);
|
|
1282
1285
|
var NOOP = () => {
|
|
1283
1286
|
};
|
|
1284
|
-
var CheckboxGroupContext =
|
|
1287
|
+
var CheckboxGroupContext = React30.createContext(null);
|
|
1285
1288
|
function useCheckboxGroupContext() {
|
|
1286
|
-
return
|
|
1289
|
+
return React30.useContext(CheckboxGroupContext);
|
|
1287
1290
|
}
|
|
1288
|
-
var CheckboxGroupBase =
|
|
1291
|
+
var CheckboxGroupBase = React30.forwardRef(
|
|
1289
1292
|
function CheckboxGroup(props, ref) {
|
|
1290
1293
|
const {
|
|
1291
1294
|
children,
|
|
@@ -1297,10 +1300,10 @@ var CheckboxGroupBase = React29.forwardRef(
|
|
|
1297
1300
|
className,
|
|
1298
1301
|
...rest
|
|
1299
1302
|
} = props;
|
|
1300
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
1303
|
+
const [uncontrolledValue, setUncontrolledValue] = React30.useState(defaultValue ?? []);
|
|
1301
1304
|
const isControlled = controlledValue !== void 0;
|
|
1302
1305
|
const value = isControlled ? controlledValue : uncontrolledValue;
|
|
1303
|
-
const toggle =
|
|
1306
|
+
const toggle = React30.useCallback(
|
|
1304
1307
|
(itemValue) => {
|
|
1305
1308
|
const next = value.includes(itemValue) ? value.filter((v) => v !== itemValue) : [...value, itemValue];
|
|
1306
1309
|
if (!isControlled) {
|
|
@@ -1310,12 +1313,12 @@ var CheckboxGroupBase = React29.forwardRef(
|
|
|
1310
1313
|
},
|
|
1311
1314
|
[value, isControlled, onValueChange]
|
|
1312
1315
|
);
|
|
1313
|
-
|
|
1316
|
+
React30.useEffect(() => {
|
|
1314
1317
|
if (isControlled) {
|
|
1315
1318
|
setUncontrolledValue(controlledValue);
|
|
1316
1319
|
}
|
|
1317
1320
|
}, [isControlled, controlledValue]);
|
|
1318
|
-
const ctx =
|
|
1321
|
+
const ctx = React30.useMemo(() => ({ value, toggle }), [value, toggle]);
|
|
1319
1322
|
return /* @__PURE__ */ jsx(CheckboxGroupContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
|
|
1320
1323
|
"div",
|
|
1321
1324
|
{
|
|
@@ -1373,7 +1376,7 @@ var IndeterminateIcon = ({ className }) => /* @__PURE__ */ jsx(
|
|
|
1373
1376
|
children: /* @__PURE__ */ jsx("path", { d: "M0 0H12V2H0V0Z", fill: "currentColor" })
|
|
1374
1377
|
}
|
|
1375
1378
|
);
|
|
1376
|
-
var CheckboxBase =
|
|
1379
|
+
var CheckboxBase = React30.forwardRef(
|
|
1377
1380
|
function Checkbox(props, ref) {
|
|
1378
1381
|
const {
|
|
1379
1382
|
icon,
|
|
@@ -1394,8 +1397,8 @@ var CheckboxBase = React29.forwardRef(
|
|
|
1394
1397
|
...rest
|
|
1395
1398
|
} = props;
|
|
1396
1399
|
const group = useCheckboxGroupContext();
|
|
1397
|
-
const hiddenInputRef =
|
|
1398
|
-
const setHiddenInputRef =
|
|
1400
|
+
const hiddenInputRef = React30.useRef(null);
|
|
1401
|
+
const setHiddenInputRef = React30.useCallback(
|
|
1399
1402
|
(node) => {
|
|
1400
1403
|
hiddenInputRef.current = node;
|
|
1401
1404
|
if (typeof ref === "function") {
|
|
@@ -1408,7 +1411,7 @@ var CheckboxBase = React29.forwardRef(
|
|
|
1408
1411
|
);
|
|
1409
1412
|
const isInGroup = group !== null && value !== void 0;
|
|
1410
1413
|
const groupChecked = isInGroup ? group.value.includes(value) : void 0;
|
|
1411
|
-
const [internalChecked, setInternalChecked] =
|
|
1414
|
+
const [internalChecked, setInternalChecked] = React30.useState(
|
|
1412
1415
|
defaultChecked ?? false
|
|
1413
1416
|
);
|
|
1414
1417
|
const isControlled = checkedProp !== void 0 || isInGroup;
|
|
@@ -1420,7 +1423,7 @@ var CheckboxBase = React29.forwardRef(
|
|
|
1420
1423
|
} else {
|
|
1421
1424
|
checkedState = internalChecked;
|
|
1422
1425
|
}
|
|
1423
|
-
const handleCheckedChange =
|
|
1426
|
+
const handleCheckedChange = React30.useCallback(
|
|
1424
1427
|
(nextChecked) => {
|
|
1425
1428
|
if (readOnly) return;
|
|
1426
1429
|
if (!isControlled) {
|
|
@@ -1584,7 +1587,7 @@ function resolveSpacing(v) {
|
|
|
1584
1587
|
}
|
|
1585
1588
|
return void 0;
|
|
1586
1589
|
}
|
|
1587
|
-
var Link =
|
|
1590
|
+
var Link = React30__default.forwardRef(
|
|
1588
1591
|
function Link2(props, ref) {
|
|
1589
1592
|
const {
|
|
1590
1593
|
external,
|
|
@@ -1673,7 +1676,7 @@ var Link = React29__default.forwardRef(
|
|
|
1673
1676
|
) });
|
|
1674
1677
|
}
|
|
1675
1678
|
);
|
|
1676
|
-
var LinkBox =
|
|
1679
|
+
var LinkBox = React30__default.forwardRef(
|
|
1677
1680
|
function LinkBox2(props, ref) {
|
|
1678
1681
|
const { className, ...rest } = props;
|
|
1679
1682
|
return /* @__PURE__ */ jsx(
|
|
@@ -1686,7 +1689,7 @@ var LinkBox = React29__default.forwardRef(
|
|
|
1686
1689
|
);
|
|
1687
1690
|
}
|
|
1688
1691
|
);
|
|
1689
|
-
var LinkOverlay =
|
|
1692
|
+
var LinkOverlay = React30__default.forwardRef(
|
|
1690
1693
|
function LinkOverlay2(props, ref) {
|
|
1691
1694
|
const {
|
|
1692
1695
|
children,
|
|
@@ -1767,8 +1770,8 @@ var LinkOverlay = React29__default.forwardRef(
|
|
|
1767
1770
|
}
|
|
1768
1771
|
);
|
|
1769
1772
|
function useUpdateEffect(effect, deps) {
|
|
1770
|
-
const isFirstMount =
|
|
1771
|
-
|
|
1773
|
+
const isFirstMount = React30__default.useRef(true);
|
|
1774
|
+
React30__default.useEffect(() => {
|
|
1772
1775
|
if (isFirstMount.current) {
|
|
1773
1776
|
isFirstMount.current = false;
|
|
1774
1777
|
return;
|
|
@@ -1785,8 +1788,8 @@ function scrollToElement(id) {
|
|
|
1785
1788
|
var CUT_ID = "CollapsibleDetails";
|
|
1786
1789
|
var CollapsibleDetails = (props) => {
|
|
1787
1790
|
const { children, id = CUT_ID, onClick, isExpanded: isExpandedProp = false, text: textProp, loading, noScroll, ...rest } = props;
|
|
1788
|
-
const [isExpanded, setIsExpanded] =
|
|
1789
|
-
const handleClick =
|
|
1791
|
+
const [isExpanded, setIsExpanded] = React30__default.useState(isExpandedProp);
|
|
1792
|
+
const handleClick = React30__default.useCallback((event) => {
|
|
1790
1793
|
setIsExpanded((flag) => !flag);
|
|
1791
1794
|
if (!noScroll) {
|
|
1792
1795
|
scrollToElement(id);
|
|
@@ -1817,11 +1820,11 @@ var CollapsibleDetails = (props) => {
|
|
|
1817
1820
|
var CollapsibleList = (props) => {
|
|
1818
1821
|
const CUT_LENGTH = 3;
|
|
1819
1822
|
const { items, renderItem, triggerProps, cutLength = CUT_LENGTH, text: textProp, defaultExpanded = false, className, ...rest } = props;
|
|
1820
|
-
const [isExpanded, setIsExpanded] =
|
|
1821
|
-
|
|
1823
|
+
const [isExpanded, setIsExpanded] = React30__default.useState(defaultExpanded);
|
|
1824
|
+
React30__default.useEffect(() => {
|
|
1822
1825
|
setIsExpanded(defaultExpanded);
|
|
1823
1826
|
}, [defaultExpanded]);
|
|
1824
|
-
const handleToggle =
|
|
1827
|
+
const handleToggle = React30__default.useCallback(() => {
|
|
1825
1828
|
setIsExpanded((flag) => !flag);
|
|
1826
1829
|
}, []);
|
|
1827
1830
|
const text = isExpanded ? textProp?.[1] ?? "Hide" : textProp?.[0] ?? "Show all";
|
|
@@ -1838,10 +1841,10 @@ var CollapsibleList = (props) => {
|
|
|
1838
1841
|
) })
|
|
1839
1842
|
] }) });
|
|
1840
1843
|
};
|
|
1841
|
-
var ColorModeContext =
|
|
1844
|
+
var ColorModeContext = React30.createContext(void 0);
|
|
1842
1845
|
function ColorModeProvider(props) {
|
|
1843
1846
|
const { children, defaultTheme = "light", value: controlledValue, onValueChange } = props;
|
|
1844
|
-
const [internalMode, setInternalMode] =
|
|
1847
|
+
const [internalMode, setInternalMode] = React30.useState(() => {
|
|
1845
1848
|
if (controlledValue === "dark" || controlledValue === "light") {
|
|
1846
1849
|
return controlledValue;
|
|
1847
1850
|
}
|
|
@@ -1851,7 +1854,7 @@ function ColorModeProvider(props) {
|
|
|
1851
1854
|
return defaultTheme === "dark" ? "dark" : "light";
|
|
1852
1855
|
});
|
|
1853
1856
|
const colorMode = controlledValue === "dark" || controlledValue === "light" ? controlledValue : internalMode;
|
|
1854
|
-
const setColorMode =
|
|
1857
|
+
const setColorMode = React30.useCallback((mode) => {
|
|
1855
1858
|
const resolved = mode === "dark" ? "dark" : "light";
|
|
1856
1859
|
setInternalMode(resolved);
|
|
1857
1860
|
onValueChange?.(resolved);
|
|
@@ -1860,19 +1863,19 @@ function ColorModeProvider(props) {
|
|
|
1860
1863
|
document.documentElement.classList.toggle("light", resolved === "light");
|
|
1861
1864
|
}
|
|
1862
1865
|
}, [onValueChange]);
|
|
1863
|
-
const toggleColorMode =
|
|
1866
|
+
const toggleColorMode = React30.useCallback(() => {
|
|
1864
1867
|
setColorMode(colorMode === "dark" ? "light" : "dark");
|
|
1865
1868
|
}, [colorMode, setColorMode]);
|
|
1866
|
-
const ctx =
|
|
1869
|
+
const ctx = React30.useMemo(
|
|
1867
1870
|
() => ({ colorMode, setColorMode, toggleColorMode }),
|
|
1868
1871
|
[colorMode, setColorMode, toggleColorMode]
|
|
1869
1872
|
);
|
|
1870
1873
|
return /* @__PURE__ */ jsx(ColorModeContext.Provider, { value: ctx, children });
|
|
1871
1874
|
}
|
|
1872
1875
|
function useColorMode() {
|
|
1873
|
-
const ctx =
|
|
1876
|
+
const ctx = React30.useContext(ColorModeContext);
|
|
1874
1877
|
if (!ctx) {
|
|
1875
|
-
const [mode, setMode] =
|
|
1878
|
+
const [mode, setMode] = React30.useState(() => {
|
|
1876
1879
|
if (typeof document !== "undefined" && document.documentElement.classList.contains("dark")) {
|
|
1877
1880
|
return "dark";
|
|
1878
1881
|
}
|
|
@@ -1916,9 +1919,9 @@ function BackToButton({ onClick }) {
|
|
|
1916
1919
|
}
|
|
1917
1920
|
);
|
|
1918
1921
|
}
|
|
1919
|
-
var DialogSizeContext =
|
|
1922
|
+
var DialogSizeContext = React30.createContext({ size: "md" });
|
|
1920
1923
|
function useDialogSizeContext() {
|
|
1921
|
-
return
|
|
1924
|
+
return React30.useContext(DialogSizeContext);
|
|
1922
1925
|
}
|
|
1923
1926
|
var CONTENT_SIZE_MAP = {
|
|
1924
1927
|
sm: "max-w-[400px]",
|
|
@@ -1950,13 +1953,13 @@ var DialogRoot = ({
|
|
|
1950
1953
|
modal = true
|
|
1951
1954
|
// motionPreset is intentionally unused -- kept for API compat
|
|
1952
1955
|
}) => {
|
|
1953
|
-
const handleOpenChange =
|
|
1956
|
+
const handleOpenChange = React30.useCallback(
|
|
1954
1957
|
(nextOpen) => {
|
|
1955
1958
|
onOpenChange?.({ open: nextOpen });
|
|
1956
1959
|
},
|
|
1957
1960
|
[onOpenChange]
|
|
1958
1961
|
);
|
|
1959
|
-
const ctx =
|
|
1962
|
+
const ctx = React30.useMemo(() => ({ size }), [size]);
|
|
1960
1963
|
return /* @__PURE__ */ jsx(DialogSizeContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
|
|
1961
1964
|
Dialog,
|
|
1962
1965
|
{
|
|
@@ -1968,7 +1971,7 @@ var DialogRoot = ({
|
|
|
1968
1971
|
}
|
|
1969
1972
|
) });
|
|
1970
1973
|
};
|
|
1971
|
-
var DialogContent =
|
|
1974
|
+
var DialogContent = React30.forwardRef(function DialogContent2(props, ref) {
|
|
1972
1975
|
const {
|
|
1973
1976
|
children,
|
|
1974
1977
|
portalled: _portalled = true,
|
|
@@ -2025,11 +2028,11 @@ var DialogContent = React29.forwardRef(function DialogContent2(props, ref) {
|
|
|
2025
2028
|
)
|
|
2026
2029
|
] });
|
|
2027
2030
|
});
|
|
2028
|
-
var DialogCloseTrigger =
|
|
2031
|
+
var DialogCloseTrigger = React30.forwardRef(function DialogCloseTrigger2(props, ref) {
|
|
2029
2032
|
const { className, ...rest } = props;
|
|
2030
2033
|
return /* @__PURE__ */ jsx(Dialog.Close, { asChild: true, children: /* @__PURE__ */ jsx(CloseButton, { ref, className, ...rest, children: props.children }) });
|
|
2031
2034
|
});
|
|
2032
|
-
var DialogHeader =
|
|
2035
|
+
var DialogHeader = React30.forwardRef(function DialogHeader2(props, ref) {
|
|
2033
2036
|
const { startElement: startElementProp, onBackToClick, className, children, ...rest } = props;
|
|
2034
2037
|
const startElement = startElementProp ?? (onBackToClick ? /* @__PURE__ */ jsx(BackToButton, { onClick: onBackToClick }) : void 0);
|
|
2035
2038
|
return /* @__PURE__ */ jsxs(
|
|
@@ -2059,7 +2062,7 @@ var DialogHeader = React29.forwardRef(function DialogHeader2(props, ref) {
|
|
|
2059
2062
|
}
|
|
2060
2063
|
);
|
|
2061
2064
|
});
|
|
2062
|
-
var DialogBody =
|
|
2065
|
+
var DialogBody = React30.forwardRef(function DialogBody2({ className, pt, display, flexDir, style: styleProp, ...props }, ref) {
|
|
2063
2066
|
const bodyStyle = {
|
|
2064
2067
|
...styleProp,
|
|
2065
2068
|
...pt !== void 0 ? { paddingTop: typeof pt === "number" ? `${pt * 4}px` : pt } : {},
|
|
@@ -2076,7 +2079,7 @@ var DialogBody = React29.forwardRef(function DialogBody2({ className, pt, displa
|
|
|
2076
2079
|
}
|
|
2077
2080
|
);
|
|
2078
2081
|
});
|
|
2079
|
-
var DialogFooter =
|
|
2082
|
+
var DialogFooter = React30.forwardRef(function DialogFooter2({ className, ...props }, ref) {
|
|
2080
2083
|
return /* @__PURE__ */ jsx(
|
|
2081
2084
|
"div",
|
|
2082
2085
|
{
|
|
@@ -2091,8 +2094,8 @@ var DialogTitle = Dialog.Title;
|
|
|
2091
2094
|
var DialogDescription = Dialog.Description;
|
|
2092
2095
|
var DialogTrigger = Dialog.Trigger;
|
|
2093
2096
|
var DialogActionTrigger = Dialog.Close;
|
|
2094
|
-
var DrawerPlacementContext =
|
|
2095
|
-
var DrawerSizeContext =
|
|
2097
|
+
var DrawerPlacementContext = React30.createContext("right");
|
|
2098
|
+
var DrawerSizeContext = React30.createContext("md");
|
|
2096
2099
|
var DrawerRoot = (props) => {
|
|
2097
2100
|
const {
|
|
2098
2101
|
children,
|
|
@@ -2103,7 +2106,7 @@ var DrawerRoot = (props) => {
|
|
|
2103
2106
|
modal = true,
|
|
2104
2107
|
size = "md"
|
|
2105
2108
|
} = props;
|
|
2106
|
-
const handleOpenChange =
|
|
2109
|
+
const handleOpenChange = React30.useCallback((nextOpen) => {
|
|
2107
2110
|
onOpenChange?.({ open: nextOpen });
|
|
2108
2111
|
}, [onOpenChange]);
|
|
2109
2112
|
return /* @__PURE__ */ jsx(DrawerPlacementContext.Provider, { value: placement, children: /* @__PURE__ */ jsx(DrawerSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx(
|
|
@@ -2145,11 +2148,11 @@ var SIZE_CLASSES6 = {
|
|
|
2145
2148
|
top: { xs: "h-40", sm: "h-60", md: "h-80", lg: "h-96", xl: "h-[480px]", full: "h-screen" },
|
|
2146
2149
|
bottom: { xs: "h-40", sm: "h-60", md: "h-80", lg: "h-96", xl: "h-[480px]", full: "h-screen" }
|
|
2147
2150
|
};
|
|
2148
|
-
var DrawerContent =
|
|
2151
|
+
var DrawerContent = React30.forwardRef(
|
|
2149
2152
|
function DrawerContent2(props, ref) {
|
|
2150
2153
|
const { children, portalled = true, portalRef, offset: _offset, backdrop = true, className, ...rest } = props;
|
|
2151
|
-
const placement =
|
|
2152
|
-
const size =
|
|
2154
|
+
const placement = React30.useContext(DrawerPlacementContext);
|
|
2155
|
+
const size = React30.useContext(DrawerSizeContext);
|
|
2153
2156
|
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2154
2157
|
backdrop && /* @__PURE__ */ jsx(
|
|
2155
2158
|
RadixDialog.Overlay,
|
|
@@ -2182,7 +2185,7 @@ var DrawerContent = React29.forwardRef(
|
|
|
2182
2185
|
return content;
|
|
2183
2186
|
}
|
|
2184
2187
|
);
|
|
2185
|
-
var DrawerCloseTrigger =
|
|
2188
|
+
var DrawerCloseTrigger = React30.forwardRef(function DrawerCloseTrigger2(props, ref) {
|
|
2186
2189
|
return /* @__PURE__ */ jsx(RadixDialog.Close, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
2187
2190
|
CloseButton,
|
|
2188
2191
|
{
|
|
@@ -2196,17 +2199,17 @@ var DrawerTrigger = (props) => {
|
|
|
2196
2199
|
const { asChild = true, ...rest } = props;
|
|
2197
2200
|
return /* @__PURE__ */ jsx(RadixDialog.Trigger, { asChild, ...rest });
|
|
2198
2201
|
};
|
|
2199
|
-
var DrawerHeader =
|
|
2202
|
+
var DrawerHeader = React30.forwardRef(
|
|
2200
2203
|
function DrawerHeader2({ className, ...props }, ref) {
|
|
2201
2204
|
return /* @__PURE__ */ jsx("div", { ref, className: cn("flex flex-col gap-1.5 p-6 pb-0", className), ...props });
|
|
2202
2205
|
}
|
|
2203
2206
|
);
|
|
2204
|
-
var DrawerBody =
|
|
2207
|
+
var DrawerBody = React30.forwardRef(
|
|
2205
2208
|
function DrawerBody2({ className, ...props }, ref) {
|
|
2206
2209
|
return /* @__PURE__ */ jsx("div", { ref, className: cn("flex-1 overflow-auto p-6", className), ...props });
|
|
2207
2210
|
}
|
|
2208
2211
|
);
|
|
2209
|
-
var DrawerFooter =
|
|
2212
|
+
var DrawerFooter = React30.forwardRef(
|
|
2210
2213
|
function DrawerFooter2({ className, ...props }, ref) {
|
|
2211
2214
|
return /* @__PURE__ */ jsx("div", { ref, className: cn("flex items-center justify-end gap-2 p-6 pt-0", className), ...props });
|
|
2212
2215
|
}
|
|
@@ -2219,7 +2222,7 @@ function upperFirst(str) {
|
|
|
2219
2222
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
2220
2223
|
}
|
|
2221
2224
|
var ICONS = {};
|
|
2222
|
-
var EmptyState =
|
|
2225
|
+
var EmptyState = React30.forwardRef(
|
|
2223
2226
|
function EmptyState2(props, ref) {
|
|
2224
2227
|
const { title, description, term, type = "query", icon, children, className, ...rest } = props;
|
|
2225
2228
|
const titleContent = (() => {
|
|
@@ -2279,7 +2282,7 @@ function getComponentDisplayName(type) {
|
|
|
2279
2282
|
if ("displayName" in type) return type.displayName;
|
|
2280
2283
|
return void 0;
|
|
2281
2284
|
}
|
|
2282
|
-
var Field =
|
|
2285
|
+
var Field = React30.forwardRef(
|
|
2283
2286
|
function Field2(props, ref) {
|
|
2284
2287
|
const {
|
|
2285
2288
|
label,
|
|
@@ -2331,14 +2334,14 @@ var Field = React29.forwardRef(
|
|
|
2331
2334
|
}
|
|
2332
2335
|
);
|
|
2333
2336
|
const helperTextElement = helperText ? /* @__PURE__ */ jsx("p", { className: "mt-1.5 text-xs text-[var(--color-text-secondary,theme(colors.gray.400))]", children: helperText }) : null;
|
|
2334
|
-
const child2 =
|
|
2337
|
+
const child2 = React30.Children.only(children);
|
|
2335
2338
|
const isInputGroup = getComponentDisplayName(child2.type) === "InputGroup";
|
|
2336
2339
|
if (isInputGroup) {
|
|
2337
|
-
const inputElement2 =
|
|
2338
|
-
|
|
2340
|
+
const inputElement2 = React30.cloneElement(
|
|
2341
|
+
React30.Children.only(child2.props.children),
|
|
2339
2342
|
injectedProps2
|
|
2340
2343
|
);
|
|
2341
|
-
const groupInputElement =
|
|
2344
|
+
const groupInputElement = React30.cloneElement(
|
|
2342
2345
|
child2,
|
|
2343
2346
|
{},
|
|
2344
2347
|
inputElement2,
|
|
@@ -2361,7 +2364,7 @@ var Field = React29.forwardRef(
|
|
|
2361
2364
|
}
|
|
2362
2365
|
);
|
|
2363
2366
|
}
|
|
2364
|
-
const inputElement =
|
|
2367
|
+
const inputElement = React30.cloneElement(child2, injectedProps2);
|
|
2365
2368
|
return /* @__PURE__ */ jsxs(
|
|
2366
2369
|
"div",
|
|
2367
2370
|
{
|
|
@@ -2383,8 +2386,8 @@ var Field = React29.forwardRef(
|
|
|
2383
2386
|
const injectedProps = {
|
|
2384
2387
|
size
|
|
2385
2388
|
};
|
|
2386
|
-
const child =
|
|
2387
|
-
const clonedChild =
|
|
2389
|
+
const child = React30.Children.only(children);
|
|
2390
|
+
const clonedChild = React30.cloneElement(child, injectedProps);
|
|
2388
2391
|
return /* @__PURE__ */ jsxs(
|
|
2389
2392
|
"div",
|
|
2390
2393
|
{
|
|
@@ -2427,7 +2430,7 @@ var LEVEL_CLASSES = {
|
|
|
2427
2430
|
"3": "text-[14px] leading-[20px] font-semibold lg:text-[18px] lg:leading-[24px] lg:font-medium"
|
|
2428
2431
|
};
|
|
2429
2432
|
var BASE_CLASSES4 = "font-heading text-heading";
|
|
2430
|
-
var Heading =
|
|
2433
|
+
var Heading = React30__default.forwardRef(
|
|
2431
2434
|
function Heading2({ level, className, mb, size: _size, style: styleProp, ...rest }, ref) {
|
|
2432
2435
|
const Tag3 = level ? LEVEL_TAG[level] : "h2";
|
|
2433
2436
|
const levelClasses = level ? LEVEL_CLASSES[level] : void 0;
|
|
@@ -2513,7 +2516,7 @@ var ICON_SIZE_CLASSES = {
|
|
|
2513
2516
|
md: "[&_svg]:size-5"
|
|
2514
2517
|
};
|
|
2515
2518
|
var SP2 = 4;
|
|
2516
|
-
var IconButton =
|
|
2519
|
+
var IconButton = React30.forwardRef(
|
|
2517
2520
|
function IconButton2(props, ref) {
|
|
2518
2521
|
const {
|
|
2519
2522
|
size,
|
|
@@ -2564,7 +2567,7 @@ var IconButton = React29.forwardRef(
|
|
|
2564
2567
|
ref,
|
|
2565
2568
|
size,
|
|
2566
2569
|
disabled: !loadingSkeleton && (loading || disabled) || void 0,
|
|
2567
|
-
render: _as ?
|
|
2570
|
+
render: _as ? React30.createElement(_as) : void 0,
|
|
2568
2571
|
className: combinedClassName,
|
|
2569
2572
|
style: mergedStyle,
|
|
2570
2573
|
...expanded ? { "data-expanded": true } : {},
|
|
@@ -2735,31 +2738,31 @@ function extractStyleProps(props) {
|
|
|
2735
2738
|
}
|
|
2736
2739
|
return { styleProps, rest };
|
|
2737
2740
|
}
|
|
2738
|
-
var Image2 =
|
|
2741
|
+
var Image2 = React30__default.forwardRef(
|
|
2739
2742
|
function Image3(props, ref) {
|
|
2740
2743
|
const { fallback, src, onLoad, onError, skeletonWidth, skeletonHeight, alt, className, style: styleProp, ...allRest } = props;
|
|
2741
2744
|
const { styleProps, rest: extraProps } = extractStyleProps(allRest);
|
|
2742
|
-
const [loading, setLoading] =
|
|
2743
|
-
const [error, setError] =
|
|
2744
|
-
const handleLoadError =
|
|
2745
|
+
const [loading, setLoading] = React30__default.useState(true);
|
|
2746
|
+
const [error, setError] = React30__default.useState(false);
|
|
2747
|
+
const handleLoadError = React30__default.useCallback((event) => {
|
|
2745
2748
|
setError(true);
|
|
2746
2749
|
setLoading(false);
|
|
2747
2750
|
onError?.(event);
|
|
2748
2751
|
}, [onError]);
|
|
2749
|
-
const handleLoadSuccess =
|
|
2752
|
+
const handleLoadSuccess = React30__default.useCallback((event) => {
|
|
2750
2753
|
setLoading(false);
|
|
2751
2754
|
onLoad?.(event);
|
|
2752
2755
|
}, [onLoad]);
|
|
2753
2756
|
const passthroughProps = allRest;
|
|
2754
2757
|
if (!src && fallback) {
|
|
2755
|
-
if (
|
|
2756
|
-
return
|
|
2758
|
+
if (React30__default.isValidElement(fallback)) {
|
|
2759
|
+
return React30__default.cloneElement(fallback, passthroughProps);
|
|
2757
2760
|
}
|
|
2758
2761
|
return fallback;
|
|
2759
2762
|
}
|
|
2760
2763
|
if (error) {
|
|
2761
|
-
if (
|
|
2762
|
-
return
|
|
2764
|
+
if (React30__default.isValidElement(fallback)) {
|
|
2765
|
+
return React30__default.cloneElement(fallback, passthroughProps);
|
|
2763
2766
|
}
|
|
2764
2767
|
return fallback;
|
|
2765
2768
|
}
|
|
@@ -2815,7 +2818,7 @@ var INPUT_VARIANT_CLASSES = {
|
|
|
2815
2818
|
filled: "border-0 bg-[var(--color-input-filled-bg,theme(colors.gray.100))]",
|
|
2816
2819
|
unstyled: "border-0 bg-transparent p-0 h-auto"
|
|
2817
2820
|
};
|
|
2818
|
-
var Input =
|
|
2821
|
+
var Input = React30__default.forwardRef(
|
|
2819
2822
|
({ size = "md", variant = "outline", className, ...rest }, ref) => {
|
|
2820
2823
|
return /* @__PURE__ */ jsx(
|
|
2821
2824
|
"input",
|
|
@@ -2833,7 +2836,7 @@ function getComponentDisplayName2(type) {
|
|
|
2833
2836
|
if ("displayName" in type) return type.displayName;
|
|
2834
2837
|
return void 0;
|
|
2835
2838
|
}
|
|
2836
|
-
var InputGroup =
|
|
2839
|
+
var InputGroup = React30.forwardRef(
|
|
2837
2840
|
function InputGroup2(props, ref) {
|
|
2838
2841
|
const {
|
|
2839
2842
|
startElement,
|
|
@@ -2846,11 +2849,11 @@ var InputGroup = React29.forwardRef(
|
|
|
2846
2849
|
className,
|
|
2847
2850
|
...rest
|
|
2848
2851
|
} = props;
|
|
2849
|
-
const startElementRef =
|
|
2850
|
-
const endElementRef =
|
|
2851
|
-
const groupRef =
|
|
2852
|
-
const [inlinePaddings, setInlinePaddings] =
|
|
2853
|
-
const calculateInlinePaddings =
|
|
2852
|
+
const startElementRef = React30.useRef(null);
|
|
2853
|
+
const endElementRef = React30.useRef(null);
|
|
2854
|
+
const groupRef = React30.useRef(null);
|
|
2855
|
+
const [inlinePaddings, setInlinePaddings] = React30.useState();
|
|
2856
|
+
const calculateInlinePaddings = React30.useCallback(() => {
|
|
2854
2857
|
const startWidth = startElementRef.current?.getBoundingClientRect().width ?? 0;
|
|
2855
2858
|
const endWidth = endElementRef.current?.getBoundingClientRect().width ?? 0;
|
|
2856
2859
|
setInlinePaddings({
|
|
@@ -2858,7 +2861,7 @@ var InputGroup = React29.forwardRef(
|
|
|
2858
2861
|
end: endWidth
|
|
2859
2862
|
});
|
|
2860
2863
|
}, []);
|
|
2861
|
-
|
|
2864
|
+
React30.useEffect(() => {
|
|
2862
2865
|
if (!groupRef.current) return;
|
|
2863
2866
|
let timeoutId;
|
|
2864
2867
|
const intersectionObserver = new IntersectionObserver(
|
|
@@ -2878,7 +2881,7 @@ var InputGroup = React29.forwardRef(
|
|
|
2878
2881
|
}
|
|
2879
2882
|
};
|
|
2880
2883
|
}, [calculateInlinePaddings]);
|
|
2881
|
-
|
|
2884
|
+
React30.useEffect(() => {
|
|
2882
2885
|
calculateInlinePaddings();
|
|
2883
2886
|
const resizeHandler = debounce(calculateInlinePaddings, 300);
|
|
2884
2887
|
const resizeObserver = new ResizeObserver(resizeHandler);
|
|
@@ -2889,7 +2892,7 @@ var InputGroup = React29.forwardRef(
|
|
|
2889
2892
|
resizeObserver.disconnect();
|
|
2890
2893
|
};
|
|
2891
2894
|
}, [calculateInlinePaddings]);
|
|
2892
|
-
const combinedRef =
|
|
2895
|
+
const combinedRef = React30.useCallback((node) => {
|
|
2893
2896
|
groupRef.current = node;
|
|
2894
2897
|
if (typeof ref === "function") {
|
|
2895
2898
|
ref(node);
|
|
@@ -2918,11 +2921,11 @@ var InputGroup = React29.forwardRef(
|
|
|
2918
2921
|
children: startElement
|
|
2919
2922
|
}
|
|
2920
2923
|
),
|
|
2921
|
-
|
|
2924
|
+
React30.Children.map(children, (child) => {
|
|
2922
2925
|
if (getComponentDisplayName2(child.type) !== "FieldInput") {
|
|
2923
2926
|
return child;
|
|
2924
2927
|
}
|
|
2925
|
-
return
|
|
2928
|
+
return React30.cloneElement(child, {
|
|
2926
2929
|
...startElement && { ps: startOffset ?? (inlinePaddings?.start ? `${inlinePaddings.start}px` : void 0) },
|
|
2927
2930
|
...endElement && { pe: endOffset ?? (inlinePaddings?.end ? `${inlinePaddings.end}px` : void 0) },
|
|
2928
2931
|
// hide input value and placeholder for the first render
|
|
@@ -2963,7 +2966,7 @@ function parsePlacement(placement) {
|
|
|
2963
2966
|
}
|
|
2964
2967
|
return { side, align };
|
|
2965
2968
|
}
|
|
2966
|
-
var PositioningContext =
|
|
2969
|
+
var PositioningContext = React30.createContext({
|
|
2967
2970
|
side: "bottom",
|
|
2968
2971
|
align: "start",
|
|
2969
2972
|
sideOffset: 4,
|
|
@@ -2993,13 +2996,13 @@ var MenuRoot = (props) => {
|
|
|
2993
2996
|
}
|
|
2994
2997
|
};
|
|
2995
2998
|
const { side, align } = parsePlacement(mergedPositioning.placement);
|
|
2996
|
-
const positioningValue =
|
|
2999
|
+
const positioningValue = React30.useMemo(() => ({
|
|
2997
3000
|
side,
|
|
2998
3001
|
align,
|
|
2999
3002
|
sideOffset: mergedPositioning.offset?.mainAxis ?? 4,
|
|
3000
3003
|
alignOffset: mergedPositioning.offset?.crossAxis ?? 0
|
|
3001
3004
|
}), [side, align, mergedPositioning.offset?.mainAxis, mergedPositioning.offset?.crossAxis]);
|
|
3002
|
-
const handleOpenChange =
|
|
3005
|
+
const handleOpenChange = React30.useCallback((isOpen) => {
|
|
3003
3006
|
onOpenChange?.({ open: isOpen });
|
|
3004
3007
|
}, [onOpenChange]);
|
|
3005
3008
|
return /* @__PURE__ */ jsx(PositioningContext.Provider, { value: positioningValue, children: /* @__PURE__ */ jsx(
|
|
@@ -3013,13 +3016,13 @@ var MenuRoot = (props) => {
|
|
|
3013
3016
|
}
|
|
3014
3017
|
) });
|
|
3015
3018
|
};
|
|
3016
|
-
var MenuTrigger =
|
|
3019
|
+
var MenuTrigger = React30.forwardRef(function MenuTrigger2(props, ref) {
|
|
3017
3020
|
const { asChild = false, ...rest } = props;
|
|
3018
3021
|
return /* @__PURE__ */ jsx(DropdownMenu.Trigger, { asChild, ref, ...rest });
|
|
3019
3022
|
});
|
|
3020
|
-
var MenuContent =
|
|
3023
|
+
var MenuContent = React30.forwardRef(function MenuContent2(props, ref) {
|
|
3021
3024
|
const { portalled = true, portalRef, className, zIndex, minW, style, ...rest } = props;
|
|
3022
|
-
const positioning =
|
|
3025
|
+
const positioning = React30.useContext(PositioningContext);
|
|
3023
3026
|
const mergedStyle = {
|
|
3024
3027
|
...style,
|
|
3025
3028
|
...zIndex !== void 0 ? { zIndex: typeof zIndex === "string" ? `var(--z-index-${zIndex}, ${zIndex})` : zIndex } : {},
|
|
@@ -3054,7 +3057,7 @@ var MenuContent = React29.forwardRef(function MenuContent2(props, ref) {
|
|
|
3054
3057
|
}
|
|
3055
3058
|
return /* @__PURE__ */ jsx(DropdownMenu.Portal, { container: portalRef?.current ?? void 0, children: content });
|
|
3056
3059
|
});
|
|
3057
|
-
var MenuItem =
|
|
3060
|
+
var MenuItem = React30.forwardRef(function MenuItem2(props, ref) {
|
|
3058
3061
|
const { className, value: _value, asChild, closeOnSelect: _closeOnSelect, disabled, children, onClick, ...rest } = props;
|
|
3059
3062
|
return /* @__PURE__ */ jsx(
|
|
3060
3063
|
DropdownMenu.Item,
|
|
@@ -3076,11 +3079,11 @@ var MenuItem = React29.forwardRef(function MenuItem2(props, ref) {
|
|
|
3076
3079
|
}
|
|
3077
3080
|
);
|
|
3078
3081
|
});
|
|
3079
|
-
var MenuItemText =
|
|
3082
|
+
var MenuItemText = React30.forwardRef(function MenuItemText2(props, ref) {
|
|
3080
3083
|
const { className, ...rest } = props;
|
|
3081
3084
|
return /* @__PURE__ */ jsx("span", { ref, className: cn("flex-1", className), ...rest });
|
|
3082
3085
|
});
|
|
3083
|
-
|
|
3086
|
+
React30.forwardRef(function MenuItemCommand2(props, ref) {
|
|
3084
3087
|
const { className, ...rest } = props;
|
|
3085
3088
|
return /* @__PURE__ */ jsx(
|
|
3086
3089
|
"span",
|
|
@@ -3091,7 +3094,7 @@ React29.forwardRef(function MenuItemCommand2(props, ref) {
|
|
|
3091
3094
|
}
|
|
3092
3095
|
);
|
|
3093
3096
|
});
|
|
3094
|
-
var MenuSeparator =
|
|
3097
|
+
var MenuSeparator = React30.forwardRef(function MenuSeparator2(props, ref) {
|
|
3095
3098
|
const { className, ...rest } = props;
|
|
3096
3099
|
return /* @__PURE__ */ jsx(
|
|
3097
3100
|
DropdownMenu.Separator,
|
|
@@ -3102,14 +3105,14 @@ var MenuSeparator = React29.forwardRef(function MenuSeparator2(props, ref) {
|
|
|
3102
3105
|
}
|
|
3103
3106
|
);
|
|
3104
3107
|
});
|
|
3105
|
-
var MenuItemGroup =
|
|
3108
|
+
var MenuItemGroup = React30.forwardRef(function MenuItemGroup2(props, ref) {
|
|
3106
3109
|
const { title, children, className, ...rest } = props;
|
|
3107
3110
|
return /* @__PURE__ */ jsxs(DropdownMenu.Group, { ref, className, ...rest, children: [
|
|
3108
3111
|
title && /* @__PURE__ */ jsx(DropdownMenu.Label, { className: "px-2 py-1.5 text-xs font-semibold select-none opacity-60", children: title }),
|
|
3109
3112
|
children
|
|
3110
3113
|
] });
|
|
3111
3114
|
});
|
|
3112
|
-
var MenuArrow =
|
|
3115
|
+
var MenuArrow = React30.forwardRef(function MenuArrow2(props, ref) {
|
|
3113
3116
|
const { className, ...rest } = props;
|
|
3114
3117
|
return /* @__PURE__ */ jsx(
|
|
3115
3118
|
DropdownMenu.Arrow,
|
|
@@ -3120,7 +3123,7 @@ var MenuArrow = React29.forwardRef(function MenuArrow2(props, ref) {
|
|
|
3120
3123
|
}
|
|
3121
3124
|
);
|
|
3122
3125
|
});
|
|
3123
|
-
var MenuCheckboxItem =
|
|
3126
|
+
var MenuCheckboxItem = React30.forwardRef(function MenuCheckboxItem2(props, ref) {
|
|
3124
3127
|
const { className, children, checked, onCheckedChange, onClick, ...rest } = props;
|
|
3125
3128
|
return /* @__PURE__ */ jsxs(
|
|
3126
3129
|
DropdownMenu.CheckboxItem,
|
|
@@ -3144,7 +3147,7 @@ var MenuCheckboxItem = React29.forwardRef(function MenuCheckboxItem2(props, ref)
|
|
|
3144
3147
|
}
|
|
3145
3148
|
);
|
|
3146
3149
|
});
|
|
3147
|
-
var MenuRadioItemGroup =
|
|
3150
|
+
var MenuRadioItemGroup = React30.forwardRef(function MenuRadioItemGroup2(props, ref) {
|
|
3148
3151
|
const { value, onValueChange, ...rest } = props;
|
|
3149
3152
|
return /* @__PURE__ */ jsx(
|
|
3150
3153
|
DropdownMenu.RadioGroup,
|
|
@@ -3156,7 +3159,7 @@ var MenuRadioItemGroup = React29.forwardRef(function MenuRadioItemGroup2(props,
|
|
|
3156
3159
|
}
|
|
3157
3160
|
);
|
|
3158
3161
|
});
|
|
3159
|
-
var MenuRadioItem =
|
|
3162
|
+
var MenuRadioItem = React30.forwardRef(function MenuRadioItem2(props, ref) {
|
|
3160
3163
|
const { className, children, value, onClick, ...rest } = props;
|
|
3161
3164
|
const { value: _v, ...radixRest } = rest;
|
|
3162
3165
|
return /* @__PURE__ */ jsxs(
|
|
@@ -3179,11 +3182,11 @@ var MenuRadioItem = React29.forwardRef(function MenuRadioItem2(props, ref) {
|
|
|
3179
3182
|
}
|
|
3180
3183
|
);
|
|
3181
3184
|
});
|
|
3182
|
-
|
|
3185
|
+
React30.forwardRef(function MenuContextTrigger2(props, ref) {
|
|
3183
3186
|
const { asChild: _asChild, ...rest } = props;
|
|
3184
3187
|
return /* @__PURE__ */ jsx("span", { ref, ...rest });
|
|
3185
3188
|
});
|
|
3186
|
-
var MenuTriggerItem =
|
|
3189
|
+
var MenuTriggerItem = React30.forwardRef(function MenuTriggerItem2(props, ref) {
|
|
3187
3190
|
const { startIcon, children, className, ...rest } = props;
|
|
3188
3191
|
return /* @__PURE__ */ jsx(DropdownMenu.Sub, { children: /* @__PURE__ */ jsxs(
|
|
3189
3192
|
DropdownMenu.SubTrigger,
|
|
@@ -3218,7 +3221,7 @@ var INPUT_BASE2 = [
|
|
|
3218
3221
|
].join(" ");
|
|
3219
3222
|
var INPUT_FILLED = "border-[var(--color-input-border)]";
|
|
3220
3223
|
var INPUT_INVALID = "border-[var(--color-border-error)] hover:border-[var(--color-border-error)]";
|
|
3221
|
-
var PinInput =
|
|
3224
|
+
var PinInput = React30.forwardRef(
|
|
3222
3225
|
function PinInput2(props, ref) {
|
|
3223
3226
|
const {
|
|
3224
3227
|
count = 6,
|
|
@@ -3236,12 +3239,12 @@ var PinInput = React29.forwardRef(
|
|
|
3236
3239
|
bgColor,
|
|
3237
3240
|
className
|
|
3238
3241
|
} = props;
|
|
3239
|
-
const inputRefs =
|
|
3240
|
-
const values =
|
|
3242
|
+
const inputRefs = React30.useRef([]);
|
|
3243
|
+
const values = React30.useMemo(
|
|
3241
3244
|
() => controlledValue ?? Array.from({ length: count }).fill(""),
|
|
3242
3245
|
[controlledValue, count]
|
|
3243
3246
|
);
|
|
3244
|
-
const updateValue =
|
|
3247
|
+
const updateValue = React30.useCallback((index, char) => {
|
|
3245
3248
|
const next = [...values];
|
|
3246
3249
|
next[index] = char;
|
|
3247
3250
|
onValueChange?.({ value: next });
|
|
@@ -3249,11 +3252,11 @@ var PinInput = React29.forwardRef(
|
|
|
3249
3252
|
onValueComplete?.({ value: next });
|
|
3250
3253
|
}
|
|
3251
3254
|
}, [values, onValueChange, onValueComplete]);
|
|
3252
|
-
const focusInput =
|
|
3255
|
+
const focusInput = React30.useCallback((index) => {
|
|
3253
3256
|
const clamped = Math.max(0, Math.min(index, count - 1));
|
|
3254
3257
|
inputRefs.current[clamped]?.focus();
|
|
3255
3258
|
}, [count]);
|
|
3256
|
-
const handleInput =
|
|
3259
|
+
const handleInput = React30.useCallback((index, e) => {
|
|
3257
3260
|
const target = e.currentTarget;
|
|
3258
3261
|
const char = target.value.slice(-1);
|
|
3259
3262
|
updateValue(index, char);
|
|
@@ -3261,7 +3264,7 @@ var PinInput = React29.forwardRef(
|
|
|
3261
3264
|
focusInput(index + 1);
|
|
3262
3265
|
}
|
|
3263
3266
|
}, [count, updateValue, focusInput]);
|
|
3264
|
-
const handleKeyDown =
|
|
3267
|
+
const handleKeyDown = React30.useCallback((index, e) => {
|
|
3265
3268
|
if (e.key === "Backspace") {
|
|
3266
3269
|
if (values[index]) {
|
|
3267
3270
|
updateValue(index, "");
|
|
@@ -3278,7 +3281,7 @@ var PinInput = React29.forwardRef(
|
|
|
3278
3281
|
e.preventDefault();
|
|
3279
3282
|
}
|
|
3280
3283
|
}, [count, values, updateValue, focusInput]);
|
|
3281
|
-
const handlePaste =
|
|
3284
|
+
const handlePaste = React30.useCallback((e) => {
|
|
3282
3285
|
e.preventDefault();
|
|
3283
3286
|
const pasted = e.clipboardData.getData("text/plain").trim();
|
|
3284
3287
|
if (!pasted) {
|
|
@@ -3295,18 +3298,18 @@ var PinInput = React29.forwardRef(
|
|
|
3295
3298
|
}
|
|
3296
3299
|
focusInput(Math.min(chars.length, count - 1));
|
|
3297
3300
|
}, [count, values, onValueChange, onValueComplete, focusInput]);
|
|
3298
|
-
const handleFocus =
|
|
3301
|
+
const handleFocus = React30.useCallback((e) => {
|
|
3299
3302
|
e.currentTarget.select();
|
|
3300
3303
|
}, []);
|
|
3301
|
-
const handleNoop =
|
|
3304
|
+
const handleNoop = React30.useCallback(() => {
|
|
3302
3305
|
}, []);
|
|
3303
|
-
const setInputRef =
|
|
3306
|
+
const setInputRef = React30.useCallback((index) => (el) => {
|
|
3304
3307
|
inputRefs.current[index] = el;
|
|
3305
3308
|
}, []);
|
|
3306
|
-
const onInputAtIndex =
|
|
3309
|
+
const onInputAtIndex = React30.useCallback((index) => (e) => {
|
|
3307
3310
|
handleInput(index, e);
|
|
3308
3311
|
}, [handleInput]);
|
|
3309
|
-
const onKeyDownAtIndex =
|
|
3312
|
+
const onKeyDownAtIndex = React30.useCallback((index) => (e) => {
|
|
3310
3313
|
handleKeyDown(index, e);
|
|
3311
3314
|
}, [handleKeyDown]);
|
|
3312
3315
|
const bgStyle = bgColor ? { backgroundColor: `var(--color-${bgColor.replace(/\./g, "-")})` } : void 0;
|
|
@@ -3367,7 +3370,7 @@ function parsePlacement2(placement) {
|
|
|
3367
3370
|
}
|
|
3368
3371
|
return { side, align };
|
|
3369
3372
|
}
|
|
3370
|
-
var PositioningContext2 =
|
|
3373
|
+
var PositioningContext2 = React30.createContext({
|
|
3371
3374
|
side: "bottom",
|
|
3372
3375
|
align: "start",
|
|
3373
3376
|
sideOffset: 4,
|
|
@@ -3401,7 +3404,7 @@ var PopoverRoot = (props) => {
|
|
|
3401
3404
|
}
|
|
3402
3405
|
};
|
|
3403
3406
|
const { side, align } = parsePlacement2(mergedPositioning.placement);
|
|
3404
|
-
const positioningValue =
|
|
3407
|
+
const positioningValue = React30.useMemo(() => ({
|
|
3405
3408
|
side,
|
|
3406
3409
|
align,
|
|
3407
3410
|
sideOffset: mergedPositioning.offset?.mainAxis ?? 4,
|
|
@@ -3418,7 +3421,7 @@ var PopoverRoot = (props) => {
|
|
|
3418
3421
|
autoFocus,
|
|
3419
3422
|
closeOnInteractOutside
|
|
3420
3423
|
]);
|
|
3421
|
-
const handleOpenChange =
|
|
3424
|
+
const handleOpenChange = React30.useCallback((isOpen) => {
|
|
3422
3425
|
onOpenChange?.({ open: isOpen });
|
|
3423
3426
|
}, [onOpenChange]);
|
|
3424
3427
|
const placement = mergedPositioning.placement ?? "bottom-start";
|
|
@@ -3436,11 +3439,11 @@ var PopoverRoot = (props) => {
|
|
|
3436
3439
|
}
|
|
3437
3440
|
) });
|
|
3438
3441
|
};
|
|
3439
|
-
var PopoverTrigger =
|
|
3442
|
+
var PopoverTrigger = React30.forwardRef(function PopoverTrigger2(props, ref) {
|
|
3440
3443
|
const { asChild = true, ...rest } = props;
|
|
3441
3444
|
return /* @__PURE__ */ jsx(Popover.Trigger, { asChild: asChild ? "except-style" : void 0, ref, ...rest });
|
|
3442
3445
|
});
|
|
3443
|
-
var PopoverContent =
|
|
3446
|
+
var PopoverContent = React30.forwardRef(function PopoverContent2(props, ref) {
|
|
3444
3447
|
const { portalled = true, portalRef: _portalRef, className, w, minW, maxW, paddingTop, style: styleProp, ...rest } = props;
|
|
3445
3448
|
const resolvedW = typeof w === "object" ? w.base ?? w.lg : w;
|
|
3446
3449
|
const contentStyle = {
|
|
@@ -3471,7 +3474,7 @@ var PopoverContent = React29.forwardRef(function PopoverContent2(props, ref) {
|
|
|
3471
3474
|
}
|
|
3472
3475
|
);
|
|
3473
3476
|
});
|
|
3474
|
-
var PopoverArrow =
|
|
3477
|
+
var PopoverArrow = React30.forwardRef(function PopoverArrow2(props, ref) {
|
|
3475
3478
|
const { className, ...rest } = props;
|
|
3476
3479
|
return /* @__PURE__ */ jsx(
|
|
3477
3480
|
Popover.Arrow,
|
|
@@ -3483,7 +3486,7 @@ var PopoverArrow = React29.forwardRef(function PopoverArrow2(props, ref) {
|
|
|
3483
3486
|
}
|
|
3484
3487
|
);
|
|
3485
3488
|
});
|
|
3486
|
-
var PopoverCloseTrigger =
|
|
3489
|
+
var PopoverCloseTrigger = React30.forwardRef(function PopoverCloseTrigger2(props, ref) {
|
|
3487
3490
|
const { className, ...rest } = props;
|
|
3488
3491
|
return /* @__PURE__ */ jsx(
|
|
3489
3492
|
Popover.Close,
|
|
@@ -3497,14 +3500,14 @@ var PopoverCloseTrigger = React29.forwardRef(function PopoverCloseTrigger2(props
|
|
|
3497
3500
|
}
|
|
3498
3501
|
);
|
|
3499
3502
|
});
|
|
3500
|
-
var PopoverCloseTriggerWrapper =
|
|
3503
|
+
var PopoverCloseTriggerWrapper = React30.forwardRef(function PopoverCloseTriggerWrapper2(props, ref) {
|
|
3501
3504
|
const { disabled, children, ...rest } = props;
|
|
3502
3505
|
if (disabled) {
|
|
3503
3506
|
return children;
|
|
3504
3507
|
}
|
|
3505
3508
|
return /* @__PURE__ */ jsx(Popover.Close, { ref, ...rest, asChild: true, children });
|
|
3506
3509
|
});
|
|
3507
|
-
var PopoverBody =
|
|
3510
|
+
var PopoverBody = React30.forwardRef(function PopoverBody2(props, ref) {
|
|
3508
3511
|
const {
|
|
3509
3512
|
className,
|
|
3510
3513
|
style: styleProp,
|
|
@@ -3542,7 +3545,7 @@ var PopoverBody = React29.forwardRef(function PopoverBody2(props, ref) {
|
|
|
3542
3545
|
}
|
|
3543
3546
|
);
|
|
3544
3547
|
});
|
|
3545
|
-
var PopoverHeader =
|
|
3548
|
+
var PopoverHeader = React30.forwardRef(function PopoverHeader2(props, ref) {
|
|
3546
3549
|
const { className, ...rest } = props;
|
|
3547
3550
|
return /* @__PURE__ */ jsx(
|
|
3548
3551
|
"div",
|
|
@@ -3553,7 +3556,7 @@ var PopoverHeader = React29.forwardRef(function PopoverHeader2(props, ref) {
|
|
|
3553
3556
|
}
|
|
3554
3557
|
);
|
|
3555
3558
|
});
|
|
3556
|
-
var PopoverFooter =
|
|
3559
|
+
var PopoverFooter = React30.forwardRef(function PopoverFooter2(props, ref) {
|
|
3557
3560
|
const { className, ...rest } = props;
|
|
3558
3561
|
return /* @__PURE__ */ jsx(
|
|
3559
3562
|
"div",
|
|
@@ -3564,7 +3567,7 @@ var PopoverFooter = React29.forwardRef(function PopoverFooter2(props, ref) {
|
|
|
3564
3567
|
}
|
|
3565
3568
|
);
|
|
3566
3569
|
});
|
|
3567
|
-
var PopoverTitle =
|
|
3570
|
+
var PopoverTitle = React30.forwardRef(function PopoverTitle2(props, ref) {
|
|
3568
3571
|
const { className, ...rest } = props;
|
|
3569
3572
|
return /* @__PURE__ */ jsx(
|
|
3570
3573
|
"h3",
|
|
@@ -3575,7 +3578,7 @@ var PopoverTitle = React29.forwardRef(function PopoverTitle2(props, ref) {
|
|
|
3575
3578
|
}
|
|
3576
3579
|
);
|
|
3577
3580
|
});
|
|
3578
|
-
var PopoverDescription =
|
|
3581
|
+
var PopoverDescription = React30.forwardRef(function PopoverDescription2(props, ref) {
|
|
3579
3582
|
const { className, ...rest } = props;
|
|
3580
3583
|
return /* @__PURE__ */ jsx(
|
|
3581
3584
|
"p",
|
|
@@ -3597,7 +3600,7 @@ function normalizeValue(value, min, max) {
|
|
|
3597
3600
|
if (max <= min) return 0;
|
|
3598
3601
|
return Math.round((value - min) / (max - min) * 100);
|
|
3599
3602
|
}
|
|
3600
|
-
var Progress =
|
|
3603
|
+
var Progress = React30.forwardRef(
|
|
3601
3604
|
function Progress2(props, ref) {
|
|
3602
3605
|
const {
|
|
3603
3606
|
value,
|
|
@@ -3674,12 +3677,12 @@ var SIZE_MAP = {
|
|
|
3674
3677
|
lg: { size: 48, thickness: 7, textClass: "text-sm" },
|
|
3675
3678
|
xl: { size: 64, thickness: 8, textClass: "text-sm" }
|
|
3676
3679
|
};
|
|
3677
|
-
var Ctx =
|
|
3680
|
+
var Ctx = React30.createContext({
|
|
3678
3681
|
value: 0,
|
|
3679
3682
|
size: "md",
|
|
3680
3683
|
colorPalette: "blue"
|
|
3681
3684
|
});
|
|
3682
|
-
var ProgressCircleRoot =
|
|
3685
|
+
var ProgressCircleRoot = React30.forwardRef(function ProgressCircleRoot2(props, ref) {
|
|
3683
3686
|
const {
|
|
3684
3687
|
value = 0,
|
|
3685
3688
|
size = "md",
|
|
@@ -3688,7 +3691,7 @@ var ProgressCircleRoot = React29.forwardRef(function ProgressCircleRoot2(props,
|
|
|
3688
3691
|
children,
|
|
3689
3692
|
...rest
|
|
3690
3693
|
} = props;
|
|
3691
|
-
const ctx =
|
|
3694
|
+
const ctx = React30.useMemo(
|
|
3692
3695
|
() => ({ value: value ?? null, size, colorPalette }),
|
|
3693
3696
|
[value, size, colorPalette]
|
|
3694
3697
|
);
|
|
@@ -3706,9 +3709,9 @@ var ProgressCircleRoot = React29.forwardRef(function ProgressCircleRoot2(props,
|
|
|
3706
3709
|
}
|
|
3707
3710
|
) });
|
|
3708
3711
|
});
|
|
3709
|
-
var ProgressCircleRing =
|
|
3712
|
+
var ProgressCircleRing = React30.forwardRef(function ProgressCircleRing2(props, ref) {
|
|
3710
3713
|
const { trackColor, cap, color, className, ...rest } = props;
|
|
3711
|
-
const { value, size: sizeKey } =
|
|
3714
|
+
const { value, size: sizeKey } = React30.useContext(Ctx);
|
|
3712
3715
|
const { size, thickness } = SIZE_MAP[sizeKey];
|
|
3713
3716
|
const radius = size / 2 - thickness / 2;
|
|
3714
3717
|
const circumference = 2 * Math.PI * radius;
|
|
@@ -3763,9 +3766,9 @@ var ProgressCircleRing = React29.forwardRef(function ProgressCircleRing2(props,
|
|
|
3763
3766
|
}
|
|
3764
3767
|
);
|
|
3765
3768
|
});
|
|
3766
|
-
var ProgressCircleValueText =
|
|
3769
|
+
var ProgressCircleValueText = React30.forwardRef(function ProgressCircleValueText2(props, ref) {
|
|
3767
3770
|
const { className, children, ...rest } = props;
|
|
3768
|
-
const { value, size: sizeKey } =
|
|
3771
|
+
const { value, size: sizeKey } = React30.useContext(Ctx);
|
|
3769
3772
|
const { textClass } = SIZE_MAP[sizeKey];
|
|
3770
3773
|
return /* @__PURE__ */ jsx(
|
|
3771
3774
|
"div",
|
|
@@ -3809,8 +3812,8 @@ var SIZE_CLASSES8 = {
|
|
|
3809
3812
|
label: "text-base"
|
|
3810
3813
|
}
|
|
3811
3814
|
};
|
|
3812
|
-
var RadioSizeContext =
|
|
3813
|
-
var RadioGroupBase =
|
|
3815
|
+
var RadioSizeContext = React30.createContext("md");
|
|
3816
|
+
var RadioGroupBase = React30.forwardRef(
|
|
3814
3817
|
function RadioGroup2(props, ref) {
|
|
3815
3818
|
const {
|
|
3816
3819
|
children,
|
|
@@ -3827,7 +3830,7 @@ var RadioGroupBase = React29.forwardRef(
|
|
|
3827
3830
|
className,
|
|
3828
3831
|
...rest
|
|
3829
3832
|
} = props;
|
|
3830
|
-
const handleValueChange =
|
|
3833
|
+
const handleValueChange = React30.useCallback(
|
|
3831
3834
|
(nextValue) => {
|
|
3832
3835
|
if (readOnly) return;
|
|
3833
3836
|
onValueChange?.({ value: nextValue });
|
|
@@ -3860,10 +3863,10 @@ var RadioGroupBase = React29.forwardRef(
|
|
|
3860
3863
|
var RadioGroup3 = RadioGroupBase;
|
|
3861
3864
|
var NOOP2 = () => {
|
|
3862
3865
|
};
|
|
3863
|
-
var RadioBase =
|
|
3866
|
+
var RadioBase = React30.forwardRef(
|
|
3864
3867
|
function Radio(props, ref) {
|
|
3865
3868
|
const { children, inputProps, rootRef, value, disabled, className, ...rest } = props;
|
|
3866
|
-
const size =
|
|
3869
|
+
const size = React30.useContext(RadioSizeContext);
|
|
3867
3870
|
const sizeClasses2 = SIZE_CLASSES8[size];
|
|
3868
3871
|
return /* @__PURE__ */ jsxs(
|
|
3869
3872
|
"label",
|
|
@@ -3925,23 +3928,23 @@ var RadioBase = React29.forwardRef(
|
|
|
3925
3928
|
var Radio2 = RadioBase;
|
|
3926
3929
|
var StarFilledIcon = ({ className }) => /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 20 20", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" }) });
|
|
3927
3930
|
var StarOutlineIcon = ({ className }) => /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z", strokeWidth: "1.5" }) });
|
|
3928
|
-
var Rating =
|
|
3931
|
+
var Rating = React30.forwardRef(
|
|
3929
3932
|
function Rating2(props, ref) {
|
|
3930
3933
|
const { count = 5, label: labelProp, defaultValue = 0, onValueChange, readOnly, className, ...rest } = props;
|
|
3931
|
-
const [value, setValue] =
|
|
3932
|
-
const [hoveredIndex, setHoveredIndex] =
|
|
3934
|
+
const [value, setValue] = React30.useState(defaultValue);
|
|
3935
|
+
const [hoveredIndex, setHoveredIndex] = React30.useState(-1);
|
|
3933
3936
|
const highlightedIndex = hoveredIndex >= 0 && !readOnly ? hoveredIndex + 1 : value;
|
|
3934
3937
|
const label = Array.isArray(labelProp) ? labelProp[highlightedIndex - 1] : labelProp;
|
|
3935
|
-
const handleClick =
|
|
3938
|
+
const handleClick = React30.useCallback((index) => () => {
|
|
3936
3939
|
if (readOnly) return;
|
|
3937
3940
|
setValue(index);
|
|
3938
3941
|
onValueChange?.({ value: index });
|
|
3939
3942
|
}, [readOnly, onValueChange]);
|
|
3940
|
-
const handleMouseEnter =
|
|
3943
|
+
const handleMouseEnter = React30.useCallback((index) => () => {
|
|
3941
3944
|
if (readOnly) return;
|
|
3942
3945
|
setHoveredIndex(index);
|
|
3943
3946
|
}, [readOnly]);
|
|
3944
|
-
const handleMouseLeave =
|
|
3947
|
+
const handleMouseLeave = React30.useCallback(() => {
|
|
3945
3948
|
setHoveredIndex(-1);
|
|
3946
3949
|
}, []);
|
|
3947
3950
|
return /* @__PURE__ */ jsxs("div", { ref, className: cn("inline-flex items-center gap-1", className), ...rest, children: [
|
|
@@ -3975,8 +3978,8 @@ function createListCollection(config) {
|
|
|
3975
3978
|
var ArrowIcon2 = ({ className }) => /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M7.5 15L12.5 10L7.5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
3976
3979
|
var CheckIcon2 = ({ className }) => /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M16.667 5L7.5 14.167 3.333 10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
3977
3980
|
function FilterInput({ placeholder, initialValue = "", onChange }) {
|
|
3978
|
-
const [value, setValue] =
|
|
3979
|
-
const handleChange =
|
|
3981
|
+
const [value, setValue] = React30.useState(initialValue);
|
|
3982
|
+
const handleChange = React30.useCallback((e) => {
|
|
3980
3983
|
setValue(e.target.value);
|
|
3981
3984
|
onChange?.(e.target.value);
|
|
3982
3985
|
}, [onChange]);
|
|
@@ -3995,15 +3998,15 @@ function FilterInput({ placeholder, initialValue = "", onChange }) {
|
|
|
3995
3998
|
}
|
|
3996
3999
|
);
|
|
3997
4000
|
}
|
|
3998
|
-
var SelectInternalContext =
|
|
4001
|
+
var SelectInternalContext = React30.createContext(null);
|
|
3999
4002
|
function useSelectInternalContext() {
|
|
4000
|
-
const ctx =
|
|
4003
|
+
const ctx = React30.useContext(SelectInternalContext);
|
|
4001
4004
|
if (!ctx) {
|
|
4002
4005
|
throw new Error("Select compound components must be rendered inside <SelectRoot>");
|
|
4003
4006
|
}
|
|
4004
4007
|
return ctx;
|
|
4005
4008
|
}
|
|
4006
|
-
var SelectRoot =
|
|
4009
|
+
var SelectRoot = React30.forwardRef(
|
|
4007
4010
|
function SelectRoot2(props, ref) {
|
|
4008
4011
|
const {
|
|
4009
4012
|
children,
|
|
@@ -4034,21 +4037,21 @@ var SelectRoot = React29.forwardRef(
|
|
|
4034
4037
|
hideFrom: _hideFrom
|
|
4035
4038
|
} = props;
|
|
4036
4039
|
const collection = collectionProp ?? createListCollection({ items: [] });
|
|
4037
|
-
const [internalValue, setInternalValue] =
|
|
4040
|
+
const [internalValue, setInternalValue] = React30.useState(defaultValueArr ?? []);
|
|
4038
4041
|
const currentValue = valueProp ?? internalValue;
|
|
4039
|
-
const selectedItems =
|
|
4042
|
+
const selectedItems = React30.useMemo(() => {
|
|
4040
4043
|
return currentValue.map((v) => collection.items.find((item) => item.value === v)).filter(Boolean);
|
|
4041
4044
|
}, [currentValue, collection.items]);
|
|
4042
|
-
const [open, setOpen] =
|
|
4045
|
+
const [open, setOpen] = React30.useState(defaultOpen ?? false);
|
|
4043
4046
|
const isOpen = openProp ?? open;
|
|
4044
|
-
const handleOpenChange =
|
|
4047
|
+
const handleOpenChange = React30.useCallback((nextOpen) => {
|
|
4045
4048
|
setOpen(nextOpen);
|
|
4046
4049
|
onOpenChange?.(nextOpen);
|
|
4047
4050
|
if (!nextOpen) {
|
|
4048
4051
|
onInteractOutside?.();
|
|
4049
4052
|
}
|
|
4050
4053
|
}, [onOpenChange, onInteractOutside]);
|
|
4051
|
-
const handleRadixValueChange =
|
|
4054
|
+
const handleRadixValueChange = React30.useCallback((radixValue) => {
|
|
4052
4055
|
const nextArr = [radixValue];
|
|
4053
4056
|
if (!valueProp) {
|
|
4054
4057
|
setInternalValue(nextArr);
|
|
@@ -4056,7 +4059,7 @@ var SelectRoot = React29.forwardRef(
|
|
|
4056
4059
|
const items = collection.items.filter((item) => nextArr.includes(item.value));
|
|
4057
4060
|
onValueChangeProp?.({ value: nextArr, items });
|
|
4058
4061
|
}, [valueProp, collection.items, onValueChangeProp]);
|
|
4059
|
-
const ctxValue =
|
|
4062
|
+
const ctxValue = React30.useMemo(() => ({
|
|
4060
4063
|
value: currentValue,
|
|
4061
4064
|
selectedItems,
|
|
4062
4065
|
collection,
|
|
@@ -4076,7 +4079,7 @@ var SelectRoot = React29.forwardRef(
|
|
|
4076
4079
|
if (typeof v === "string") return v;
|
|
4077
4080
|
return v.base ?? v.lg ?? Object.values(v)[0];
|
|
4078
4081
|
};
|
|
4079
|
-
const inlineStyle =
|
|
4082
|
+
const inlineStyle = React30.useMemo(() => {
|
|
4080
4083
|
const s = { ...style };
|
|
4081
4084
|
const rw = resolveVal(w);
|
|
4082
4085
|
if (rw) s.width = rw;
|
|
@@ -4114,7 +4117,7 @@ var SelectRoot = React29.forwardRef(
|
|
|
4114
4117
|
) });
|
|
4115
4118
|
}
|
|
4116
4119
|
);
|
|
4117
|
-
var SelectControl =
|
|
4120
|
+
var SelectControl = React30.forwardRef(
|
|
4118
4121
|
function SelectControl2(props, ref) {
|
|
4119
4122
|
const { children, noIndicator, triggerProps, loading, defaultValue } = props;
|
|
4120
4123
|
const ctx = useSelectInternalContext();
|
|
@@ -4151,11 +4154,11 @@ var SelectControl = React29.forwardRef(
|
|
|
4151
4154
|
return trigger;
|
|
4152
4155
|
}
|
|
4153
4156
|
);
|
|
4154
|
-
var SelectClearTrigger =
|
|
4157
|
+
var SelectClearTrigger = React30.forwardRef(
|
|
4155
4158
|
function SelectClearTrigger2(props, ref) {
|
|
4156
4159
|
const { className, ...rest } = props;
|
|
4157
4160
|
const ctx = useSelectInternalContext();
|
|
4158
|
-
const handleClick =
|
|
4161
|
+
const handleClick = React30.useCallback(() => {
|
|
4159
4162
|
ctx.onValueChange({ value: [], items: [] });
|
|
4160
4163
|
}, [ctx]);
|
|
4161
4164
|
return /* @__PURE__ */ jsx(
|
|
@@ -4172,7 +4175,7 @@ var SelectClearTrigger = React29.forwardRef(
|
|
|
4172
4175
|
);
|
|
4173
4176
|
}
|
|
4174
4177
|
);
|
|
4175
|
-
var SelectContent =
|
|
4178
|
+
var SelectContent = React30.forwardRef(
|
|
4176
4179
|
function SelectContent2(props, ref) {
|
|
4177
4180
|
const { portalled = true, portalRef, children, className, ...rest } = props;
|
|
4178
4181
|
const content = /* @__PURE__ */ jsx(
|
|
@@ -4199,7 +4202,7 @@ var SelectContent = React29.forwardRef(
|
|
|
4199
4202
|
return content;
|
|
4200
4203
|
}
|
|
4201
4204
|
);
|
|
4202
|
-
var SelectItem =
|
|
4205
|
+
var SelectItem = React30.forwardRef(
|
|
4203
4206
|
function SelectItem2(props, ref) {
|
|
4204
4207
|
const { item, children, className, ...rest } = props;
|
|
4205
4208
|
return /* @__PURE__ */ jsxs(
|
|
@@ -4227,7 +4230,7 @@ var SelectItem = React29.forwardRef(
|
|
|
4227
4230
|
);
|
|
4228
4231
|
}
|
|
4229
4232
|
);
|
|
4230
|
-
var SelectValueText =
|
|
4233
|
+
var SelectValueText = React30.forwardRef(
|
|
4231
4234
|
function SelectValueText2(props, ref) {
|
|
4232
4235
|
const { children, size, required, invalid, errorText, mode, className, style, placeholder: placeholderProp, ...rest } = props;
|
|
4233
4236
|
const ctx = useSelectInternalContext();
|
|
@@ -4283,7 +4286,7 @@ var SelectValueText = React29.forwardRef(
|
|
|
4283
4286
|
);
|
|
4284
4287
|
}
|
|
4285
4288
|
);
|
|
4286
|
-
var SelectItemGroup =
|
|
4289
|
+
var SelectItemGroup = React30.forwardRef(
|
|
4287
4290
|
function SelectItemGroup2(props, ref) {
|
|
4288
4291
|
const { children, label, className, ...rest } = props;
|
|
4289
4292
|
return /* @__PURE__ */ jsxs(RadixSelect.Group, { ref, className: cn("py-1", className), ...rest, children: [
|
|
@@ -4294,7 +4297,7 @@ var SelectItemGroup = React29.forwardRef(
|
|
|
4294
4297
|
);
|
|
4295
4298
|
var SelectLabel = RadixSelect.Label;
|
|
4296
4299
|
var SelectItemText = RadixSelect.ItemText;
|
|
4297
|
-
var Select =
|
|
4300
|
+
var Select = React30.forwardRef((props, ref) => {
|
|
4298
4301
|
const { collection, placeholder, portalled = true, loading, errorText, contentProps, contentHeader, itemFilter, mode, ...rest } = props;
|
|
4299
4302
|
return /* @__PURE__ */ jsxs(
|
|
4300
4303
|
SelectRoot,
|
|
@@ -4316,7 +4319,7 @@ var Select = React29.forwardRef((props, ref) => {
|
|
|
4316
4319
|
) }),
|
|
4317
4320
|
/* @__PURE__ */ jsxs(SelectContent, { portalled, ...contentProps, children: [
|
|
4318
4321
|
contentHeader,
|
|
4319
|
-
collection.items.filter(itemFilter ?? (() => true)).map((item) => /* @__PURE__ */ jsxs(
|
|
4322
|
+
collection.items.filter(itemFilter ?? (() => true)).map((item) => /* @__PURE__ */ jsxs(React30.Fragment, { children: [
|
|
4320
4323
|
/* @__PURE__ */ jsx(SelectItem, { item, children: item.renderLabel ? item.renderLabel("item") : item.label }),
|
|
4321
4324
|
item.afterElement
|
|
4322
4325
|
] }, item.value))
|
|
@@ -4325,19 +4328,19 @@ var Select = React29.forwardRef((props, ref) => {
|
|
|
4325
4328
|
}
|
|
4326
4329
|
);
|
|
4327
4330
|
});
|
|
4328
|
-
var SelectAsync =
|
|
4331
|
+
var SelectAsync = React30.forwardRef((props, ref) => {
|
|
4329
4332
|
const { placeholder, portalled = true, loading, loadOptions, extraControls, onValueChange, errorText, mode, contentHeader, ...rest } = props;
|
|
4330
|
-
const [collection, setCollection] =
|
|
4331
|
-
const [inputValue, setInputValue] =
|
|
4332
|
-
const [value, setValue] =
|
|
4333
|
+
const [collection, setCollection] = React30.useState(createListCollection({ items: [] }));
|
|
4334
|
+
const [inputValue, setInputValue] = React30.useState("");
|
|
4335
|
+
const [value, setValue] = React30.useState([]);
|
|
4333
4336
|
const debouncedInputValue = useDebounce(inputValue, 300);
|
|
4334
|
-
|
|
4337
|
+
React30.useEffect(() => {
|
|
4335
4338
|
loadOptions(debouncedInputValue, value).then(setCollection);
|
|
4336
4339
|
}, [debouncedInputValue, loadOptions, value]);
|
|
4337
|
-
const handleFilterChange =
|
|
4340
|
+
const handleFilterChange = React30.useCallback((val) => {
|
|
4338
4341
|
setInputValue(val);
|
|
4339
4342
|
}, []);
|
|
4340
|
-
const handleValueChange =
|
|
4343
|
+
const handleValueChange = React30.useCallback(({ value: v, items }) => {
|
|
4341
4344
|
setValue(v);
|
|
4342
4345
|
onValueChange?.({ value: v, items });
|
|
4343
4346
|
}, [onValueChange]);
|
|
@@ -4396,7 +4399,7 @@ var VERTICAL_SIZE_CLASSES = {
|
|
|
4396
4399
|
md: "border-l-2",
|
|
4397
4400
|
lg: "border-l-[3px]"
|
|
4398
4401
|
};
|
|
4399
|
-
var Separator2 =
|
|
4402
|
+
var Separator2 = React30__default.forwardRef(
|
|
4400
4403
|
function Separator3({ orientation = "horizontal", variant = "solid", size = "sm", className, ...rest }, ref) {
|
|
4401
4404
|
const isVertical = orientation === "vertical";
|
|
4402
4405
|
return /* @__PURE__ */ jsx(
|
|
@@ -4420,7 +4423,7 @@ var Separator2 = React29__default.forwardRef(
|
|
|
4420
4423
|
);
|
|
4421
4424
|
var THUMB_SIZE = 20;
|
|
4422
4425
|
var TRACK_HEIGHT = 6;
|
|
4423
|
-
var Slider =
|
|
4426
|
+
var Slider = React30.forwardRef(
|
|
4424
4427
|
function Slider2(props, ref) {
|
|
4425
4428
|
const {
|
|
4426
4429
|
marks: marksProp,
|
|
@@ -4539,7 +4542,7 @@ var SIZE_CLASSES9 = {
|
|
|
4539
4542
|
label: "text-base"
|
|
4540
4543
|
}
|
|
4541
4544
|
};
|
|
4542
|
-
var SwitchBase =
|
|
4545
|
+
var SwitchBase = React30.forwardRef(
|
|
4543
4546
|
function Switch(props, ref) {
|
|
4544
4547
|
const {
|
|
4545
4548
|
inputProps,
|
|
@@ -4558,10 +4561,10 @@ var SwitchBase = React29.forwardRef(
|
|
|
4558
4561
|
className,
|
|
4559
4562
|
...rest
|
|
4560
4563
|
} = props;
|
|
4561
|
-
const [internalChecked, setInternalChecked] =
|
|
4564
|
+
const [internalChecked, setInternalChecked] = React30.useState(defaultChecked ?? false);
|
|
4562
4565
|
const isControlled = checkedProp !== void 0;
|
|
4563
4566
|
const checkedState = isControlled ? checkedProp : internalChecked;
|
|
4564
|
-
const handleCheckedChange =
|
|
4567
|
+
const handleCheckedChange = React30.useCallback(
|
|
4565
4568
|
(nextChecked) => {
|
|
4566
4569
|
if (!isControlled) {
|
|
4567
4570
|
setInternalChecked(nextChecked);
|
|
@@ -4826,7 +4829,7 @@ function resolveResponsive(value) {
|
|
|
4826
4829
|
}
|
|
4827
4830
|
return void 0;
|
|
4828
4831
|
}
|
|
4829
|
-
var TableRoot =
|
|
4832
|
+
var TableRoot = React30.forwardRef(
|
|
4830
4833
|
function TableRoot2(props, ref) {
|
|
4831
4834
|
const { className, style: styleProp, children, ...other } = props;
|
|
4832
4835
|
const rawMinW = other.minWidth ?? other.minW;
|
|
@@ -4849,7 +4852,7 @@ var TableRoot = React29.forwardRef(
|
|
|
4849
4852
|
);
|
|
4850
4853
|
}
|
|
4851
4854
|
);
|
|
4852
|
-
var TableHeader =
|
|
4855
|
+
var TableHeader = React30.forwardRef(
|
|
4853
4856
|
function TableHeader2(props, ref) {
|
|
4854
4857
|
const { className, style: styleProp, children, ...other } = props;
|
|
4855
4858
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -4866,7 +4869,7 @@ var TableHeader = React29.forwardRef(
|
|
|
4866
4869
|
);
|
|
4867
4870
|
}
|
|
4868
4871
|
);
|
|
4869
|
-
var TableBody =
|
|
4872
|
+
var TableBody = React30.forwardRef(
|
|
4870
4873
|
function TableBody2(props, ref) {
|
|
4871
4874
|
const { className, style: styleProp, children, ...other } = props;
|
|
4872
4875
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -4883,7 +4886,7 @@ var TableBody = React29.forwardRef(
|
|
|
4883
4886
|
);
|
|
4884
4887
|
}
|
|
4885
4888
|
);
|
|
4886
|
-
var TableRow =
|
|
4889
|
+
var TableRow = React30.forwardRef(
|
|
4887
4890
|
function TableRow2(props, ref) {
|
|
4888
4891
|
const { className, style: styleProp, children, ...other } = props;
|
|
4889
4892
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -4900,7 +4903,7 @@ var TableRow = React29.forwardRef(
|
|
|
4900
4903
|
);
|
|
4901
4904
|
}
|
|
4902
4905
|
);
|
|
4903
|
-
var TableCell =
|
|
4906
|
+
var TableCell = React30.forwardRef(
|
|
4904
4907
|
function TableCell2(props, ref) {
|
|
4905
4908
|
const { isNumeric, className, style: styleProp, children, ...other } = props;
|
|
4906
4909
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -4921,7 +4924,7 @@ var TableCell = React29.forwardRef(
|
|
|
4921
4924
|
);
|
|
4922
4925
|
}
|
|
4923
4926
|
);
|
|
4924
|
-
var TableColumnHeader =
|
|
4927
|
+
var TableColumnHeader = React30.forwardRef(
|
|
4925
4928
|
function TableColumnHeader2(props, ref) {
|
|
4926
4929
|
const { isNumeric, className, style: styleProp, children, ...other } = props;
|
|
4927
4930
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -4948,7 +4951,7 @@ var TableColumnHeader = React29.forwardRef(
|
|
|
4948
4951
|
);
|
|
4949
4952
|
var TableColumnHeaderSortable = (props) => {
|
|
4950
4953
|
const { sortField, sortValue, onSortToggle, children, disabled, indicatorPosition = "left", contentAfter, ...rest } = props;
|
|
4951
|
-
const handleSortToggle =
|
|
4954
|
+
const handleSortToggle = React30.useCallback(() => {
|
|
4952
4955
|
onSortToggle(sortField);
|
|
4953
4956
|
}, [onSortToggle, sortField]);
|
|
4954
4957
|
const isActive = sortValue.includes(sortField);
|
|
@@ -4974,16 +4977,16 @@ var TableColumnHeaderSortable = (props) => {
|
|
|
4974
4977
|
var ACTION_BAR_SHADOW = "0 4px 4px -4px rgb(0 0 0 / 10%), 0 2px 4px -4px rgb(0 0 0 / 6%)";
|
|
4975
4978
|
var TableHeaderSticky = (props) => {
|
|
4976
4979
|
const { top, children, className, style: styleProp, ...rest } = props;
|
|
4977
|
-
const ref =
|
|
4978
|
-
const [isStuck, setIsStuck] =
|
|
4979
|
-
const handleScroll =
|
|
4980
|
+
const ref = React30.useRef(null);
|
|
4981
|
+
const [isStuck, setIsStuck] = React30.useState(false);
|
|
4982
|
+
const handleScroll = React30.useCallback(() => {
|
|
4980
4983
|
if (Number(ref.current?.getBoundingClientRect().y) <= (Number(top) || 0)) {
|
|
4981
4984
|
setIsStuck(true);
|
|
4982
4985
|
} else {
|
|
4983
4986
|
setIsStuck(false);
|
|
4984
4987
|
}
|
|
4985
4988
|
}, [top]);
|
|
4986
|
-
|
|
4989
|
+
React30.useEffect(() => {
|
|
4987
4990
|
const throttledHandleScroll = throttle(handleScroll, 300);
|
|
4988
4991
|
window.addEventListener("scroll", throttledHandleScroll);
|
|
4989
4992
|
return () => {
|
|
@@ -5005,7 +5008,7 @@ var TableHeaderSticky = (props) => {
|
|
|
5005
5008
|
}
|
|
5006
5009
|
);
|
|
5007
5010
|
};
|
|
5008
|
-
var TableCaption =
|
|
5011
|
+
var TableCaption = React30.forwardRef(
|
|
5009
5012
|
function TableCaption2(props, ref) {
|
|
5010
5013
|
const { className, style: styleProp, children, ...other } = props;
|
|
5011
5014
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -5022,7 +5025,7 @@ var TableCaption = React29.forwardRef(
|
|
|
5022
5025
|
);
|
|
5023
5026
|
}
|
|
5024
5027
|
);
|
|
5025
|
-
var TableFooter =
|
|
5028
|
+
var TableFooter = React30.forwardRef(
|
|
5026
5029
|
function TableFooter2(props, ref) {
|
|
5027
5030
|
const { className, style: styleProp, children, ...other } = props;
|
|
5028
5031
|
const { style: extracted, rest } = extractStyles(other);
|
|
@@ -5039,7 +5042,7 @@ var TableFooter = React29.forwardRef(
|
|
|
5039
5042
|
);
|
|
5040
5043
|
}
|
|
5041
5044
|
);
|
|
5042
|
-
var TableScrollWrapper =
|
|
5045
|
+
var TableScrollWrapper = React30.forwardRef(
|
|
5043
5046
|
function TableScrollWrapper2(props, ref) {
|
|
5044
5047
|
const { className, children, ...rest } = props;
|
|
5045
5048
|
return /* @__PURE__ */ jsx(
|
|
@@ -5058,7 +5061,7 @@ var ROOT_SIZE_CLASSES = {
|
|
|
5058
5061
|
md: "[--tabs-height:2.5rem] [--tabs-content-padding:1.5rem]",
|
|
5059
5062
|
free: ""
|
|
5060
5063
|
};
|
|
5061
|
-
var TabsRoot =
|
|
5064
|
+
var TabsRoot = React30.forwardRef(
|
|
5062
5065
|
function TabsRoot2(props, ref) {
|
|
5063
5066
|
const {
|
|
5064
5067
|
variant = "solid",
|
|
@@ -5070,7 +5073,7 @@ var TabsRoot = React29.forwardRef(
|
|
|
5070
5073
|
className,
|
|
5071
5074
|
...rest
|
|
5072
5075
|
} = props;
|
|
5073
|
-
const handleValueChange =
|
|
5076
|
+
const handleValueChange = React30.useCallback(
|
|
5074
5077
|
(value) => {
|
|
5075
5078
|
if (!onValueChange) return;
|
|
5076
5079
|
onValueChange({ value });
|
|
@@ -5095,7 +5098,7 @@ var TabsRoot = React29.forwardRef(
|
|
|
5095
5098
|
);
|
|
5096
5099
|
}
|
|
5097
5100
|
);
|
|
5098
|
-
var TabsList =
|
|
5101
|
+
var TabsList = React30.forwardRef(
|
|
5099
5102
|
function TabsList2(props, ref) {
|
|
5100
5103
|
const {
|
|
5101
5104
|
className,
|
|
@@ -5149,7 +5152,7 @@ var TRIGGER_VARIANT_CLASSES = {
|
|
|
5149
5152
|
segmented: "bg-transparent text-text-primary border-2 border-solid border-selected-control-bg hover:text-hover data-[state=active]:text-selected-control-text data-[state=active]:bg-selected-control-bg data-[state=active]:border-selected-control-bg data-[state=active]:hover:text-selected-control-text",
|
|
5150
5153
|
unstyled: ""
|
|
5151
5154
|
};
|
|
5152
|
-
var TabsTrigger =
|
|
5155
|
+
var TabsTrigger = React30.forwardRef(
|
|
5153
5156
|
function TabsTrigger2(props, ref) {
|
|
5154
5157
|
const {
|
|
5155
5158
|
className,
|
|
@@ -5169,7 +5172,7 @@ var TabsTrigger = React29.forwardRef(
|
|
|
5169
5172
|
visibility: _visibility,
|
|
5170
5173
|
...rest
|
|
5171
5174
|
} = props;
|
|
5172
|
-
const internalRef =
|
|
5175
|
+
const internalRef = React30.useRef(null);
|
|
5173
5176
|
const mergedRef = useMergedRef(ref, internalRef);
|
|
5174
5177
|
const { variant, size, fitted } = useTabsContext(internalRef);
|
|
5175
5178
|
return /* @__PURE__ */ jsx(
|
|
@@ -5189,7 +5192,7 @@ var TabsTrigger = React29.forwardRef(
|
|
|
5189
5192
|
);
|
|
5190
5193
|
}
|
|
5191
5194
|
);
|
|
5192
|
-
var TabsContent =
|
|
5195
|
+
var TabsContent = React30.forwardRef(
|
|
5193
5196
|
function TabsContent2(props, ref) {
|
|
5194
5197
|
const { className, padding: _padding, ...rest } = props;
|
|
5195
5198
|
return /* @__PURE__ */ jsx(
|
|
@@ -5223,8 +5226,8 @@ var TabsCounter = ({ count }) => {
|
|
|
5223
5226
|
);
|
|
5224
5227
|
};
|
|
5225
5228
|
function useTabsContext(triggerRef) {
|
|
5226
|
-
const [ctx, setCtx] =
|
|
5227
|
-
|
|
5229
|
+
const [ctx, setCtx] = React30.useState({ variant: "solid", size: "md", fitted: false });
|
|
5230
|
+
React30.useEffect(() => {
|
|
5228
5231
|
const el = triggerRef.current;
|
|
5229
5232
|
if (!el) return;
|
|
5230
5233
|
const root = el.closest("[data-variant]");
|
|
@@ -5238,7 +5241,7 @@ function useTabsContext(triggerRef) {
|
|
|
5238
5241
|
return ctx;
|
|
5239
5242
|
}
|
|
5240
5243
|
function useMergedRef(...refs) {
|
|
5241
|
-
return
|
|
5244
|
+
return React30.useCallback(
|
|
5242
5245
|
(instance) => {
|
|
5243
5246
|
for (const ref of refs) {
|
|
5244
5247
|
if (!ref) continue;
|
|
@@ -5276,7 +5279,7 @@ var TAG_SELECTED_CLASSES = [
|
|
|
5276
5279
|
"hover:opacity-76"
|
|
5277
5280
|
].join(" ");
|
|
5278
5281
|
var TAG_DISABLED_CLASSES = "opacity-40 pointer-events-none cursor-not-allowed";
|
|
5279
|
-
var Tag =
|
|
5282
|
+
var Tag = React30.forwardRef(
|
|
5280
5283
|
function Tag2(props, ref) {
|
|
5281
5284
|
const {
|
|
5282
5285
|
variant,
|
|
@@ -5363,7 +5366,7 @@ var TEXTAREA_VARIANT_CLASSES = {
|
|
|
5363
5366
|
filled: "border-0 bg-[var(--color-input-filled-bg,theme(colors.gray.100))]",
|
|
5364
5367
|
unstyled: "border-0 bg-transparent p-0"
|
|
5365
5368
|
};
|
|
5366
|
-
var Textarea =
|
|
5369
|
+
var Textarea = React30__default.forwardRef(
|
|
5367
5370
|
({ size = "md", variant = "outline", className, ...rest }, ref) => {
|
|
5368
5371
|
return /* @__PURE__ */ jsx(
|
|
5369
5372
|
"textarea",
|
|
@@ -5499,7 +5502,7 @@ function QuoteCell({ value, highlight, align = "right", onClick, className }) {
|
|
|
5499
5502
|
}
|
|
5500
5503
|
var CALL_HEADERS = ["Bid", "Ask", "Last", "Vol", "OI", "IV", "Delta"];
|
|
5501
5504
|
var PUT_HEADERS = ["Delta", "IV", "OI", "Vol", "Last", "Ask", "Bid"];
|
|
5502
|
-
var OptionChain =
|
|
5505
|
+
var OptionChain = React30.forwardRef(
|
|
5503
5506
|
function OptionChain2(props, ref) {
|
|
5504
5507
|
const {
|
|
5505
5508
|
symbol: _symbol,
|
|
@@ -5510,7 +5513,7 @@ var OptionChain = React29.forwardRef(
|
|
|
5510
5513
|
className,
|
|
5511
5514
|
...rest
|
|
5512
5515
|
} = props;
|
|
5513
|
-
const handleClick =
|
|
5516
|
+
const handleClick = React30.useCallback(
|
|
5514
5517
|
(quote, type, strike) => {
|
|
5515
5518
|
if (!quote || !onSelectContract) return;
|
|
5516
5519
|
onSelectContract({
|
|
@@ -5690,7 +5693,7 @@ function GreekItem({ def, value, compact }) {
|
|
|
5690
5693
|
}
|
|
5691
5694
|
);
|
|
5692
5695
|
}
|
|
5693
|
-
var GreeksDisplay =
|
|
5696
|
+
var GreeksDisplay = React30.forwardRef(
|
|
5694
5697
|
function GreeksDisplay2(props, ref) {
|
|
5695
5698
|
const {
|
|
5696
5699
|
delta,
|
|
@@ -5921,7 +5924,7 @@ function LegRow({ leg, index, strikes, expirations, removable, onChange, onRemov
|
|
|
5921
5924
|
)
|
|
5922
5925
|
] });
|
|
5923
5926
|
}
|
|
5924
|
-
var StrategyBuilder =
|
|
5927
|
+
var StrategyBuilder = React30.forwardRef(
|
|
5925
5928
|
function StrategyBuilder2(props, ref) {
|
|
5926
5929
|
const {
|
|
5927
5930
|
underlying,
|
|
@@ -5933,12 +5936,12 @@ var StrategyBuilder = React29.forwardRef(
|
|
|
5933
5936
|
...rest
|
|
5934
5937
|
} = props;
|
|
5935
5938
|
const defaultExp = expirations[0] ?? "";
|
|
5936
|
-
const [strategyType, setStrategyType] =
|
|
5937
|
-
const [legs, setLegs] =
|
|
5939
|
+
const [strategyType, setStrategyType] = React30.useState("bull_call_spread");
|
|
5940
|
+
const [legs, setLegs] = React30.useState(() => {
|
|
5938
5941
|
const preset = STRATEGY_PRESETS.find((p) => p.value === "bull_call_spread");
|
|
5939
5942
|
return preset ? preset.buildLegs(strikes, spotPrice, defaultExp) : [];
|
|
5940
5943
|
});
|
|
5941
|
-
const handleStrategyChange =
|
|
5944
|
+
const handleStrategyChange = React30.useCallback(
|
|
5942
5945
|
(e) => {
|
|
5943
5946
|
const type = e.target.value;
|
|
5944
5947
|
setStrategyType(type);
|
|
@@ -5949,7 +5952,7 @@ var StrategyBuilder = React29.forwardRef(
|
|
|
5949
5952
|
},
|
|
5950
5953
|
[strikes, spotPrice, defaultExp]
|
|
5951
5954
|
);
|
|
5952
|
-
const handleLegChange =
|
|
5955
|
+
const handleLegChange = React30.useCallback(
|
|
5953
5956
|
(index, leg) => {
|
|
5954
5957
|
setLegs((prev) => {
|
|
5955
5958
|
const next = [...prev];
|
|
@@ -5959,13 +5962,13 @@ var StrategyBuilder = React29.forwardRef(
|
|
|
5959
5962
|
},
|
|
5960
5963
|
[]
|
|
5961
5964
|
);
|
|
5962
|
-
const handleLegRemove =
|
|
5965
|
+
const handleLegRemove = React30.useCallback(
|
|
5963
5966
|
(index) => {
|
|
5964
5967
|
setLegs((prev) => prev.filter((_, i) => i !== index));
|
|
5965
5968
|
},
|
|
5966
5969
|
[]
|
|
5967
5970
|
);
|
|
5968
|
-
const handleAddLeg =
|
|
5971
|
+
const handleAddLeg = React30.useCallback(() => {
|
|
5969
5972
|
if (legs.length >= 4) return;
|
|
5970
5973
|
const atm = findATM(strikes, spotPrice);
|
|
5971
5974
|
setLegs((prev) => [
|
|
@@ -5973,14 +5976,14 @@ var StrategyBuilder = React29.forwardRef(
|
|
|
5973
5976
|
{ action: "buy", type: "call", strike: atm, expiration: defaultExp, quantity: 1 }
|
|
5974
5977
|
]);
|
|
5975
5978
|
}, [legs.length, strikes, spotPrice, defaultExp]);
|
|
5976
|
-
const netPremium =
|
|
5979
|
+
const netPremium = React30.useMemo(() => {
|
|
5977
5980
|
return legs.reduce((sum, leg) => {
|
|
5978
5981
|
if (leg.premium === void 0) return sum;
|
|
5979
5982
|
const sign = leg.action === "buy" ? -1 : 1;
|
|
5980
5983
|
return sum + sign * leg.premium * leg.quantity;
|
|
5981
5984
|
}, 0);
|
|
5982
5985
|
}, [legs]);
|
|
5983
|
-
const handleSubmit =
|
|
5986
|
+
const handleSubmit = React30.useCallback(() => {
|
|
5984
5987
|
if (!onSubmit || legs.length === 0) return;
|
|
5985
5988
|
onSubmit({
|
|
5986
5989
|
type: strategyType,
|
|
@@ -6101,7 +6104,7 @@ function buildPath(points, vb, width, height) {
|
|
|
6101
6104
|
return parts.join(" ");
|
|
6102
6105
|
}
|
|
6103
6106
|
var LEG_COLORS = ["#6366f1", "#f59e0b", "#ec4899", "#06b6d4"];
|
|
6104
|
-
var PnlDiagram =
|
|
6107
|
+
var PnlDiagram = React30.forwardRef(
|
|
6105
6108
|
function PnlDiagram2(props, ref) {
|
|
6106
6109
|
const {
|
|
6107
6110
|
legs,
|
|
@@ -6110,10 +6113,10 @@ var PnlDiagram = React29.forwardRef(
|
|
|
6110
6113
|
className,
|
|
6111
6114
|
...rest
|
|
6112
6115
|
} = props;
|
|
6113
|
-
const containerRef =
|
|
6114
|
-
const [hoverX, setHoverX] =
|
|
6115
|
-
const [dims, setDims] =
|
|
6116
|
-
|
|
6116
|
+
const containerRef = React30.useRef(null);
|
|
6117
|
+
const [hoverX, setHoverX] = React30.useState(null);
|
|
6118
|
+
const [dims, setDims] = React30.useState({ width: 600, height: 240 });
|
|
6119
|
+
React30.useEffect(() => {
|
|
6117
6120
|
const el = containerRef.current;
|
|
6118
6121
|
if (!el) return;
|
|
6119
6122
|
const observer = new ResizeObserver((entries) => {
|
|
@@ -6136,7 +6139,7 @@ var PnlDiagram = React29.forwardRef(
|
|
|
6136
6139
|
const xMax = maxStrike + range * 0.3;
|
|
6137
6140
|
const SAMPLES = 200;
|
|
6138
6141
|
const step = (xMax - xMin) / SAMPLES;
|
|
6139
|
-
const combinedPoints =
|
|
6142
|
+
const combinedPoints = React30.useMemo(() => {
|
|
6140
6143
|
const pts = [];
|
|
6141
6144
|
for (let i = 0; i <= SAMPLES; i++) {
|
|
6142
6145
|
const price = xMin + i * step;
|
|
@@ -6144,7 +6147,7 @@ var PnlDiagram = React29.forwardRef(
|
|
|
6144
6147
|
}
|
|
6145
6148
|
return pts;
|
|
6146
6149
|
}, [legs, multiplier, xMin, step]);
|
|
6147
|
-
const legPointSets =
|
|
6150
|
+
const legPointSets = React30.useMemo(() => {
|
|
6148
6151
|
return legs.map((leg) => {
|
|
6149
6152
|
const pts = [];
|
|
6150
6153
|
for (let i = 0; i <= SAMPLES; i++) {
|
|
@@ -6165,7 +6168,7 @@ var PnlDiagram = React29.forwardRef(
|
|
|
6165
6168
|
const chartH = height - PADDING.top - PADDING.bottom;
|
|
6166
6169
|
const scaleX = (x) => PADDING.left + (x - vb.xMin) / (vb.xMax - vb.xMin) * chartW;
|
|
6167
6170
|
const scaleY = (y) => PADDING.top + chartH - (y - vb.yMin) / (vb.yMax - vb.yMin) * chartH;
|
|
6168
|
-
const breakevens =
|
|
6171
|
+
const breakevens = React30.useMemo(() => {
|
|
6169
6172
|
const pts = [];
|
|
6170
6173
|
for (let i = 1; i < combinedPoints.length; i++) {
|
|
6171
6174
|
const prev = combinedPoints[i - 1];
|
|
@@ -6182,7 +6185,7 @@ var PnlDiagram = React29.forwardRef(
|
|
|
6182
6185
|
const maxGainPoint = combinedPoints.find((p) => p.y === maxGain);
|
|
6183
6186
|
const maxLossPoint = combinedPoints.find((p) => p.y === maxLoss);
|
|
6184
6187
|
const zeroY = scaleY(0);
|
|
6185
|
-
const handleMouseMove =
|
|
6188
|
+
const handleMouseMove = React30.useCallback(
|
|
6186
6189
|
(e) => {
|
|
6187
6190
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
6188
6191
|
const mouseX = e.clientX - rect.left;
|
|
@@ -6195,7 +6198,7 @@ var PnlDiagram = React29.forwardRef(
|
|
|
6195
6198
|
},
|
|
6196
6199
|
[vb.xMin, vb.xMax, chartW]
|
|
6197
6200
|
);
|
|
6198
|
-
const handleMouseLeave =
|
|
6201
|
+
const handleMouseLeave = React30.useCallback(() => setHoverX(null), []);
|
|
6199
6202
|
const hoverPnl = hoverX !== null ? calcTotalPnl(legs, hoverX, multiplier) : null;
|
|
6200
6203
|
buildPath(
|
|
6201
6204
|
combinedPoints.map((p) => ({ x: scaleX(p.x), y: scaleY(p.y) })).map((p) => ({ x: p.x - PADDING.left, y: p.y - PADDING.top })),
|
|
@@ -6499,7 +6502,7 @@ function formatDate(date) {
|
|
|
6499
6502
|
const d = new Date(date);
|
|
6500
6503
|
return d.toLocaleDateString("en-US", { month: "short", day: "numeric" });
|
|
6501
6504
|
}
|
|
6502
|
-
var OptionPositionCard =
|
|
6505
|
+
var OptionPositionCard = React30.forwardRef(
|
|
6503
6506
|
function OptionPositionCard2(props, ref) {
|
|
6504
6507
|
const {
|
|
6505
6508
|
position,
|
|
@@ -6661,7 +6664,7 @@ function ExpirationPill({ exp, isSelected, onClick }) {
|
|
|
6661
6664
|
}
|
|
6662
6665
|
);
|
|
6663
6666
|
}
|
|
6664
|
-
var ExpirationSelector =
|
|
6667
|
+
var ExpirationSelector = React30.forwardRef(
|
|
6665
6668
|
function ExpirationSelector2(props, ref) {
|
|
6666
6669
|
const {
|
|
6667
6670
|
expirations,
|
|
@@ -6671,8 +6674,8 @@ var ExpirationSelector = React29.forwardRef(
|
|
|
6671
6674
|
className,
|
|
6672
6675
|
...rest
|
|
6673
6676
|
} = props;
|
|
6674
|
-
const scrollRef =
|
|
6675
|
-
|
|
6677
|
+
const scrollRef = React30.useRef(null);
|
|
6678
|
+
React30.useEffect(() => {
|
|
6676
6679
|
const container = scrollRef.current;
|
|
6677
6680
|
if (!container) return;
|
|
6678
6681
|
const selectedEl = container.querySelector('[data-selected="true"]');
|