analytica-frontend-lib 1.0.44 → 1.0.45
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/Calendar/index.js +12 -12
- package/dist/Calendar/index.js.map +1 -1
- package/dist/Calendar/index.mjs +18 -13
- package/dist/Calendar/index.mjs.map +1 -1
- package/dist/DropdownMenu/index.d.mts +1 -1
- package/dist/DropdownMenu/index.d.ts +1 -1
- package/dist/DropdownMenu/index.js +16 -12
- package/dist/DropdownMenu/index.js.map +1 -1
- package/dist/DropdownMenu/index.mjs +16 -12
- package/dist/DropdownMenu/index.mjs.map +1 -1
- package/dist/Select/index.js +15 -8
- package/dist/Select/index.js.map +1 -1
- package/dist/Select/index.mjs +15 -8
- package/dist/Select/index.mjs.map +1 -1
- package/dist/index.css +96 -6
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +66 -2
- package/dist/index.d.ts +66 -2
- package/dist/index.js +224 -115
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +195 -82
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +96 -6
- package/dist/styles.css.map +1 -1
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -2042,7 +2042,12 @@ var ProgressCircle = ({
|
|
|
2042
2042
|
var ProgressCircle_default = ProgressCircle;
|
|
2043
2043
|
|
|
2044
2044
|
// src/components/Calendar/Calendar.tsx
|
|
2045
|
-
import {
|
|
2045
|
+
import {
|
|
2046
|
+
useState as useState5,
|
|
2047
|
+
useMemo as useMemo2,
|
|
2048
|
+
useEffect,
|
|
2049
|
+
useRef
|
|
2050
|
+
} from "react";
|
|
2046
2051
|
import { jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2047
2052
|
var WEEK_DAYS = ["SEG", "TER", "QUA", "QUI", "SEX", "S\xC1B", "DOM"];
|
|
2048
2053
|
var WEEK_DAYS_SHORT = ["S", "T", "Q", "Q", "S", "S", "D"];
|
|
@@ -2112,7 +2117,7 @@ var getDayStyles = (day, variant, showActivities) => {
|
|
|
2112
2117
|
dayStyle = "bg-primary-800";
|
|
2113
2118
|
textStyle = "text-white";
|
|
2114
2119
|
} else if (day.isToday) {
|
|
2115
|
-
textStyle = "text-
|
|
2120
|
+
textStyle = "text-primary-800";
|
|
2116
2121
|
} else if (variant === "navigation" && showActivities && day.activities?.length) {
|
|
2117
2122
|
const primaryActivity = day.activities[0];
|
|
2118
2123
|
if (primaryActivity.status === "near-deadline") {
|
|
@@ -2348,7 +2353,7 @@ var Calendar = ({
|
|
|
2348
2353
|
);
|
|
2349
2354
|
let spanClass = "";
|
|
2350
2355
|
if (day.isSelected && day.isToday) {
|
|
2351
|
-
spanClass = "h-6 w-6 rounded-full bg-
|
|
2356
|
+
spanClass = "h-6 w-6 rounded-full bg-primary-800 text-text";
|
|
2352
2357
|
} else if (day.isSelected) {
|
|
2353
2358
|
spanClass = "h-6 w-6 rounded-full bg-primary-950 text-text";
|
|
2354
2359
|
}
|
|
@@ -2360,12 +2365,12 @@ var Calendar = ({
|
|
|
2360
2365
|
"button",
|
|
2361
2366
|
{
|
|
2362
2367
|
className: `
|
|
2363
|
-
w-9 h-9
|
|
2364
|
-
flex items-center justify-center
|
|
2365
|
-
text-md font-normal
|
|
2366
|
-
cursor-pointer
|
|
2368
|
+
w-9 h-9
|
|
2369
|
+
flex items-center justify-center
|
|
2370
|
+
text-md font-normal
|
|
2371
|
+
cursor-pointer
|
|
2367
2372
|
rounded-full
|
|
2368
|
-
${dayStyle}
|
|
2373
|
+
${dayStyle}
|
|
2369
2374
|
${textStyle}
|
|
2370
2375
|
`,
|
|
2371
2376
|
onClick: () => handleDateSelect(day),
|
|
@@ -2514,13 +2519,13 @@ var Calendar = ({
|
|
|
2514
2519
|
"button",
|
|
2515
2520
|
{
|
|
2516
2521
|
className: `
|
|
2517
|
-
w-10 h-10
|
|
2518
|
-
flex items-center justify-center
|
|
2519
|
-
text-xl font-normal
|
|
2520
|
-
cursor-pointer
|
|
2522
|
+
w-10 h-10
|
|
2523
|
+
flex items-center justify-center
|
|
2524
|
+
text-xl font-normal
|
|
2525
|
+
cursor-pointer
|
|
2521
2526
|
rounded-full
|
|
2522
2527
|
focus:outline-none focus:ring-2 focus:ring-primary-600 focus:ring-offset-1
|
|
2523
|
-
${dayStyle}
|
|
2528
|
+
${dayStyle}
|
|
2524
2529
|
${textStyle}
|
|
2525
2530
|
`,
|
|
2526
2531
|
onClick: () => handleDateSelect(day),
|
|
@@ -2538,11 +2543,107 @@ var Calendar = ({
|
|
|
2538
2543
|
};
|
|
2539
2544
|
var Calendar_default = Calendar;
|
|
2540
2545
|
|
|
2546
|
+
// src/components/Modal/Modal.tsx
|
|
2547
|
+
import { useEffect as useEffect2 } from "react";
|
|
2548
|
+
import { X as X2 } from "phosphor-react";
|
|
2549
|
+
import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2550
|
+
var SIZE_CLASSES9 = {
|
|
2551
|
+
xs: "max-w-[360px]",
|
|
2552
|
+
sm: "max-w-[420px]",
|
|
2553
|
+
md: "max-w-[510px]",
|
|
2554
|
+
lg: "max-w-[640px]",
|
|
2555
|
+
xl: "max-w-[970px]"
|
|
2556
|
+
};
|
|
2557
|
+
var Modal = ({
|
|
2558
|
+
isOpen,
|
|
2559
|
+
onClose,
|
|
2560
|
+
title,
|
|
2561
|
+
children,
|
|
2562
|
+
size = "md",
|
|
2563
|
+
className = "",
|
|
2564
|
+
closeOnBackdropClick = true,
|
|
2565
|
+
closeOnEscape = true,
|
|
2566
|
+
footer,
|
|
2567
|
+
hideCloseButton = false
|
|
2568
|
+
}) => {
|
|
2569
|
+
useEffect2(() => {
|
|
2570
|
+
if (!isOpen || !closeOnEscape) return;
|
|
2571
|
+
const handleEscape = (event) => {
|
|
2572
|
+
if (event.key === "Escape") {
|
|
2573
|
+
onClose();
|
|
2574
|
+
}
|
|
2575
|
+
};
|
|
2576
|
+
document.addEventListener("keydown", handleEscape);
|
|
2577
|
+
return () => document.removeEventListener("keydown", handleEscape);
|
|
2578
|
+
}, [isOpen, closeOnEscape, onClose]);
|
|
2579
|
+
useEffect2(() => {
|
|
2580
|
+
const originalOverflow = document.body.style.overflow;
|
|
2581
|
+
if (isOpen) {
|
|
2582
|
+
document.body.style.overflow = "hidden";
|
|
2583
|
+
} else {
|
|
2584
|
+
document.body.style.overflow = originalOverflow;
|
|
2585
|
+
}
|
|
2586
|
+
return () => {
|
|
2587
|
+
document.body.style.overflow = originalOverflow;
|
|
2588
|
+
};
|
|
2589
|
+
}, [isOpen]);
|
|
2590
|
+
const handleBackdropClick = (event) => {
|
|
2591
|
+
if (closeOnBackdropClick && event.target === event.currentTarget) {
|
|
2592
|
+
onClose();
|
|
2593
|
+
}
|
|
2594
|
+
};
|
|
2595
|
+
const handleBackdropKeyDown = (event) => {
|
|
2596
|
+
if (closeOnBackdropClick && (event.key === "Enter" || event.key === " ")) {
|
|
2597
|
+
onClose();
|
|
2598
|
+
}
|
|
2599
|
+
};
|
|
2600
|
+
if (!isOpen) return null;
|
|
2601
|
+
const sizeClasses = SIZE_CLASSES9[size];
|
|
2602
|
+
const baseClasses = "bg-background rounded-3xl shadow-hard-shadow-2 border border-border-100 w-full mx-4";
|
|
2603
|
+
const modalClasses = `${baseClasses} ${sizeClasses} ${className}`;
|
|
2604
|
+
return /* @__PURE__ */ jsx21(
|
|
2605
|
+
"div",
|
|
2606
|
+
{
|
|
2607
|
+
className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-xs",
|
|
2608
|
+
onClick: handleBackdropClick,
|
|
2609
|
+
onKeyDown: handleBackdropKeyDown,
|
|
2610
|
+
role: "none",
|
|
2611
|
+
"aria-hidden": "true",
|
|
2612
|
+
children: /* @__PURE__ */ jsxs16(
|
|
2613
|
+
"div",
|
|
2614
|
+
{
|
|
2615
|
+
className: modalClasses,
|
|
2616
|
+
role: "dialog",
|
|
2617
|
+
"aria-modal": "true",
|
|
2618
|
+
"aria-labelledby": "modal-title",
|
|
2619
|
+
children: [
|
|
2620
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center justify-between px-6 py-6", children: [
|
|
2621
|
+
/* @__PURE__ */ jsx21("h2", { id: "modal-title", className: "text-lg font-semibold text-text-950", children: title }),
|
|
2622
|
+
!hideCloseButton && /* @__PURE__ */ jsx21(
|
|
2623
|
+
"button",
|
|
2624
|
+
{
|
|
2625
|
+
onClick: onClose,
|
|
2626
|
+
className: "p-1 text-text-500 hover:text-text-700 hover:bg-background-50 rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-indicator-info focus:ring-offset-2",
|
|
2627
|
+
"aria-label": "Fechar modal",
|
|
2628
|
+
children: /* @__PURE__ */ jsx21(X2, { size: 18 })
|
|
2629
|
+
}
|
|
2630
|
+
)
|
|
2631
|
+
] }),
|
|
2632
|
+
/* @__PURE__ */ jsx21("div", { className: "px-6 pb-6", children: /* @__PURE__ */ jsx21("div", { className: "text-text-500 font-normal text-sm leading-6", children }) }),
|
|
2633
|
+
footer && /* @__PURE__ */ jsx21("div", { className: "flex justify-end gap-3 px-6 pb-6", children: footer })
|
|
2634
|
+
]
|
|
2635
|
+
}
|
|
2636
|
+
)
|
|
2637
|
+
}
|
|
2638
|
+
);
|
|
2639
|
+
};
|
|
2640
|
+
var Modal_default = Modal;
|
|
2641
|
+
|
|
2541
2642
|
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
2542
2643
|
import { SignOut, User } from "phosphor-react";
|
|
2543
2644
|
import {
|
|
2544
2645
|
forwardRef as forwardRef9,
|
|
2545
|
-
useEffect as
|
|
2646
|
+
useEffect as useEffect3,
|
|
2546
2647
|
useRef as useRef2,
|
|
2547
2648
|
isValidElement,
|
|
2548
2649
|
Children,
|
|
@@ -2550,7 +2651,7 @@ import {
|
|
|
2550
2651
|
useState as useState6
|
|
2551
2652
|
} from "react";
|
|
2552
2653
|
import { create as create2, useStore } from "zustand";
|
|
2553
|
-
import { jsx as
|
|
2654
|
+
import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2554
2655
|
function createDropdownStore() {
|
|
2555
2656
|
return create2((set) => ({
|
|
2556
2657
|
open: false,
|
|
@@ -2580,16 +2681,17 @@ var injectStore = (children, store) => {
|
|
|
2580
2681
|
return child;
|
|
2581
2682
|
});
|
|
2582
2683
|
};
|
|
2583
|
-
var DropdownMenu = ({
|
|
2684
|
+
var DropdownMenu = ({
|
|
2685
|
+
children,
|
|
2686
|
+
open: propOpen,
|
|
2687
|
+
onOpenChange
|
|
2688
|
+
}) => {
|
|
2584
2689
|
const storeRef = useRef2(null);
|
|
2585
2690
|
storeRef.current ??= createDropdownStore();
|
|
2586
2691
|
const store = storeRef.current;
|
|
2587
|
-
const
|
|
2588
|
-
const uncontrolledOpen = useStore(store, (s) => s.open);
|
|
2589
|
-
const currentOpen = isControlled ? open : uncontrolledOpen;
|
|
2692
|
+
const { open, setOpen: storeSetOpen } = useStore(store, (s) => s);
|
|
2590
2693
|
const setOpen = (newOpen) => {
|
|
2591
|
-
|
|
2592
|
-
if (!isControlled) store.setState({ open: newOpen });
|
|
2694
|
+
storeSetOpen(newOpen);
|
|
2593
2695
|
};
|
|
2594
2696
|
const menuRef = useRef2(null);
|
|
2595
2697
|
const handleArrowDownOrArrowUp = (event) => {
|
|
@@ -2625,9 +2727,8 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
|
2625
2727
|
setOpen(false);
|
|
2626
2728
|
}
|
|
2627
2729
|
};
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
if (currentOpen) {
|
|
2730
|
+
useEffect3(() => {
|
|
2731
|
+
if (open) {
|
|
2631
2732
|
document.addEventListener("mousedown", handleClickOutside);
|
|
2632
2733
|
document.addEventListener("keydown", handleDownkey);
|
|
2633
2734
|
}
|
|
@@ -2635,13 +2736,17 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
|
2635
2736
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
2636
2737
|
document.removeEventListener("keydown", handleDownkey);
|
|
2637
2738
|
};
|
|
2638
|
-
}, [
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2739
|
+
}, [open]);
|
|
2740
|
+
useEffect3(() => {
|
|
2741
|
+
setOpen(open);
|
|
2742
|
+
onOpenChange?.(open);
|
|
2743
|
+
}, [open, onOpenChange]);
|
|
2744
|
+
useEffect3(() => {
|
|
2745
|
+
if (propOpen) {
|
|
2746
|
+
setOpen(propOpen);
|
|
2642
2747
|
}
|
|
2643
|
-
}, []);
|
|
2644
|
-
return /* @__PURE__ */
|
|
2748
|
+
}, [propOpen]);
|
|
2749
|
+
return /* @__PURE__ */ jsx22("div", { className: "relative", ref: menuRef, children: injectStore(children, store) });
|
|
2645
2750
|
};
|
|
2646
2751
|
var DropdownMenuTrigger = ({
|
|
2647
2752
|
className,
|
|
@@ -2653,7 +2758,7 @@ var DropdownMenuTrigger = ({
|
|
|
2653
2758
|
const store = useDropdownStore(externalStore);
|
|
2654
2759
|
const open = useStore(store, (s) => s.open);
|
|
2655
2760
|
const toggleOpen = () => store.setState({ open: !open });
|
|
2656
|
-
return /* @__PURE__ */
|
|
2761
|
+
return /* @__PURE__ */ jsx22(
|
|
2657
2762
|
Button_default,
|
|
2658
2763
|
{
|
|
2659
2764
|
variant: "outline",
|
|
@@ -2690,7 +2795,7 @@ var MENUCONTENT_VARIANT_CLASSES = {
|
|
|
2690
2795
|
profile: "p-6"
|
|
2691
2796
|
};
|
|
2692
2797
|
var MenuLabel = forwardRef9(({ className, inset, store: _store, ...props }, ref) => {
|
|
2693
|
-
return /* @__PURE__ */
|
|
2798
|
+
return /* @__PURE__ */ jsx22(
|
|
2694
2799
|
"div",
|
|
2695
2800
|
{
|
|
2696
2801
|
ref,
|
|
@@ -2714,7 +2819,7 @@ var MenuContent = forwardRef9(
|
|
|
2714
2819
|
const store = useDropdownStore(externalStore);
|
|
2715
2820
|
const open = useStore(store, (s) => s.open);
|
|
2716
2821
|
const [isVisible, setIsVisible] = useState6(open);
|
|
2717
|
-
|
|
2822
|
+
useEffect3(() => {
|
|
2718
2823
|
if (open) {
|
|
2719
2824
|
setIsVisible(true);
|
|
2720
2825
|
} else {
|
|
@@ -2729,7 +2834,7 @@ var MenuContent = forwardRef9(
|
|
|
2729
2834
|
return `absolute ${vertical} ${horizontal}`;
|
|
2730
2835
|
};
|
|
2731
2836
|
const variantClasses = MENUCONTENT_VARIANT_CLASSES[variant];
|
|
2732
|
-
return /* @__PURE__ */
|
|
2837
|
+
return /* @__PURE__ */ jsx22(
|
|
2733
2838
|
"div",
|
|
2734
2839
|
{
|
|
2735
2840
|
ref,
|
|
@@ -2788,7 +2893,7 @@ var DropdownMenuItem = forwardRef9(
|
|
|
2788
2893
|
const getVariantProps = () => {
|
|
2789
2894
|
return variant === "profile" ? { "data-variant": "profile" } : {};
|
|
2790
2895
|
};
|
|
2791
|
-
return /* @__PURE__ */
|
|
2896
|
+
return /* @__PURE__ */ jsxs17(
|
|
2792
2897
|
"div",
|
|
2793
2898
|
{
|
|
2794
2899
|
ref,
|
|
@@ -2810,7 +2915,7 @@ var DropdownMenuItem = forwardRef9(
|
|
|
2810
2915
|
...props,
|
|
2811
2916
|
children: [
|
|
2812
2917
|
iconLeft,
|
|
2813
|
-
/* @__PURE__ */
|
|
2918
|
+
/* @__PURE__ */ jsx22("span", { className: "w-full text-md", children }),
|
|
2814
2919
|
iconRight
|
|
2815
2920
|
]
|
|
2816
2921
|
}
|
|
@@ -2818,7 +2923,7 @@ var DropdownMenuItem = forwardRef9(
|
|
|
2818
2923
|
}
|
|
2819
2924
|
);
|
|
2820
2925
|
DropdownMenuItem.displayName = "DropdownMenuItem";
|
|
2821
|
-
var DropdownMenuSeparator = forwardRef9(({ className, store: _store, ...props }, ref) => /* @__PURE__ */
|
|
2926
|
+
var DropdownMenuSeparator = forwardRef9(({ className, store: _store, ...props }, ref) => /* @__PURE__ */ jsx22(
|
|
2822
2927
|
"div",
|
|
2823
2928
|
{
|
|
2824
2929
|
ref,
|
|
@@ -2831,7 +2936,7 @@ var ProfileMenuTrigger = forwardRef9(({ className, onClick, store: externalStore
|
|
|
2831
2936
|
const store = useDropdownStore(externalStore);
|
|
2832
2937
|
const open = useStore(store, (s) => s.open);
|
|
2833
2938
|
const toggleOpen = () => store.setState({ open: !open });
|
|
2834
|
-
return /* @__PURE__ */
|
|
2939
|
+
return /* @__PURE__ */ jsx22(
|
|
2835
2940
|
"button",
|
|
2836
2941
|
{
|
|
2837
2942
|
ref,
|
|
@@ -2843,13 +2948,13 @@ var ProfileMenuTrigger = forwardRef9(({ className, onClick, store: externalStore
|
|
|
2843
2948
|
},
|
|
2844
2949
|
"aria-expanded": open,
|
|
2845
2950
|
...props,
|
|
2846
|
-
children: /* @__PURE__ */
|
|
2951
|
+
children: /* @__PURE__ */ jsx22("span", { className: "size-6 rounded-full bg-background-100 flex items-center justify-center", children: /* @__PURE__ */ jsx22(User, { className: "text-background-950", size: 18 }) })
|
|
2847
2952
|
}
|
|
2848
2953
|
);
|
|
2849
2954
|
});
|
|
2850
2955
|
ProfileMenuTrigger.displayName = "ProfileMenuTrigger";
|
|
2851
2956
|
var ProfileMenuHeader = forwardRef9(({ className, name, email, store: _store, ...props }, ref) => {
|
|
2852
|
-
return /* @__PURE__ */
|
|
2957
|
+
return /* @__PURE__ */ jsxs17(
|
|
2853
2958
|
"div",
|
|
2854
2959
|
{
|
|
2855
2960
|
ref,
|
|
@@ -2860,10 +2965,10 @@ var ProfileMenuHeader = forwardRef9(({ className, name, email, store: _store, ..
|
|
|
2860
2965
|
`,
|
|
2861
2966
|
...props,
|
|
2862
2967
|
children: [
|
|
2863
|
-
/* @__PURE__ */
|
|
2864
|
-
/* @__PURE__ */
|
|
2865
|
-
/* @__PURE__ */
|
|
2866
|
-
/* @__PURE__ */
|
|
2968
|
+
/* @__PURE__ */ jsx22("span", { className: "size-16 bg-background-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ jsx22(User, { size: 34, className: "text-background-950" }) }),
|
|
2969
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex flex-col ", children: [
|
|
2970
|
+
/* @__PURE__ */ jsx22("p", { className: "text-xl font-bold text-text-950", children: name }),
|
|
2971
|
+
/* @__PURE__ */ jsx22("p", { className: "text-md text-text-600", children: email })
|
|
2867
2972
|
] })
|
|
2868
2973
|
]
|
|
2869
2974
|
}
|
|
@@ -2871,7 +2976,7 @@ var ProfileMenuHeader = forwardRef9(({ className, name, email, store: _store, ..
|
|
|
2871
2976
|
});
|
|
2872
2977
|
ProfileMenuHeader.displayName = "ProfileMenuHeader";
|
|
2873
2978
|
var ProfileMenuSection = forwardRef9(({ className, children, store: _store, ...props }, ref) => {
|
|
2874
|
-
return /* @__PURE__ */
|
|
2979
|
+
return /* @__PURE__ */ jsx22(
|
|
2875
2980
|
"div",
|
|
2876
2981
|
{
|
|
2877
2982
|
ref,
|
|
@@ -2894,7 +2999,7 @@ var ProfileMenuFooter = ({
|
|
|
2894
2999
|
}) => {
|
|
2895
3000
|
const store = useDropdownStore(externalStore);
|
|
2896
3001
|
const setOpen = useStore(store, (s) => s.setOpen);
|
|
2897
|
-
return /* @__PURE__ */
|
|
3002
|
+
return /* @__PURE__ */ jsxs17(
|
|
2898
3003
|
Button_default,
|
|
2899
3004
|
{
|
|
2900
3005
|
variant: "outline",
|
|
@@ -2906,8 +3011,8 @@ var ProfileMenuFooter = ({
|
|
|
2906
3011
|
},
|
|
2907
3012
|
...props,
|
|
2908
3013
|
children: [
|
|
2909
|
-
/* @__PURE__ */
|
|
2910
|
-
/* @__PURE__ */
|
|
3014
|
+
/* @__PURE__ */ jsx22("span", { className: "mr-2 flex items-center", children: /* @__PURE__ */ jsx22(SignOut, {}) }),
|
|
3015
|
+
/* @__PURE__ */ jsx22("span", { children: "Sair" })
|
|
2911
3016
|
]
|
|
2912
3017
|
}
|
|
2913
3018
|
);
|
|
@@ -2918,7 +3023,7 @@ var DropdownMenu_default = DropdownMenu;
|
|
|
2918
3023
|
// src/components/Select/Select.tsx
|
|
2919
3024
|
import { create as create3, useStore as useStore2 } from "zustand";
|
|
2920
3025
|
import {
|
|
2921
|
-
useEffect as
|
|
3026
|
+
useEffect as useEffect4,
|
|
2922
3027
|
useRef as useRef3,
|
|
2923
3028
|
forwardRef as forwardRef10,
|
|
2924
3029
|
isValidElement as isValidElement2,
|
|
@@ -2926,13 +3031,13 @@ import {
|
|
|
2926
3031
|
cloneElement as cloneElement2
|
|
2927
3032
|
} from "react";
|
|
2928
3033
|
import { CaretDown, Check as Check3 } from "phosphor-react";
|
|
2929
|
-
import { Fragment as Fragment3, jsx as
|
|
3034
|
+
import { Fragment as Fragment3, jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2930
3035
|
var VARIANT_CLASSES4 = {
|
|
2931
3036
|
outlined: "border-2 rounded-sm focus:border-primary-950",
|
|
2932
3037
|
underlined: "border-b-2 focus:border-primary-950",
|
|
2933
3038
|
rounded: "border-2 rounded-4xl focus:border-primary-950"
|
|
2934
3039
|
};
|
|
2935
|
-
var
|
|
3040
|
+
var SIZE_CLASSES10 = {
|
|
2936
3041
|
small: "text-sm",
|
|
2937
3042
|
medium: "text-md",
|
|
2938
3043
|
large: "text-lg"
|
|
@@ -2972,7 +3077,7 @@ function getLabelAsNode(children) {
|
|
|
2972
3077
|
}
|
|
2973
3078
|
const flattened = Children2.toArray(children);
|
|
2974
3079
|
if (flattened.length === 1) return flattened[0];
|
|
2975
|
-
return /* @__PURE__ */
|
|
3080
|
+
return /* @__PURE__ */ jsx23(Fragment3, { children: flattened });
|
|
2976
3081
|
}
|
|
2977
3082
|
var injectStore2 = (children, store) => {
|
|
2978
3083
|
return Children2.map(children, (child) => {
|
|
@@ -3004,8 +3109,6 @@ var Select = ({
|
|
|
3004
3109
|
store,
|
|
3005
3110
|
(s) => s
|
|
3006
3111
|
);
|
|
3007
|
-
const isControlled = propValue !== void 0;
|
|
3008
|
-
const currentValue = isControlled ? propValue : value;
|
|
3009
3112
|
const findLabelForValue = (children2, targetValue) => {
|
|
3010
3113
|
let found = null;
|
|
3011
3114
|
const search = (nodes) => {
|
|
@@ -3023,14 +3126,13 @@ var Select = ({
|
|
|
3023
3126
|
search(children2);
|
|
3024
3127
|
return found;
|
|
3025
3128
|
};
|
|
3026
|
-
|
|
3129
|
+
useEffect4(() => {
|
|
3027
3130
|
if (!selectedLabel && defaultValue) {
|
|
3028
3131
|
const label = findLabelForValue(children, defaultValue);
|
|
3029
3132
|
if (label) store.setState({ selectedLabel: label });
|
|
3030
3133
|
}
|
|
3031
3134
|
}, [children, defaultValue, selectedLabel]);
|
|
3032
|
-
|
|
3033
|
-
setValue(currentValue);
|
|
3135
|
+
useEffect4(() => {
|
|
3034
3136
|
const handleClickOutside = (event) => {
|
|
3035
3137
|
if (selectRef.current && !selectRef.current.contains(event.target)) {
|
|
3036
3138
|
setOpen(false);
|
|
@@ -3065,13 +3167,19 @@ var Select = ({
|
|
|
3065
3167
|
document.removeEventListener("keydown", handleArrowKeys);
|
|
3066
3168
|
};
|
|
3067
3169
|
}, [open]);
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3170
|
+
useEffect4(() => {
|
|
3171
|
+
setValue(value);
|
|
3172
|
+
onValueChange?.(value);
|
|
3173
|
+
}, [value, onValueChange]);
|
|
3174
|
+
useEffect4(() => {
|
|
3175
|
+
if (propValue) {
|
|
3176
|
+
setValue(propValue);
|
|
3177
|
+
const label = findLabelForValue(children, propValue);
|
|
3178
|
+
if (label) store.setState({ selectedLabel: label });
|
|
3071
3179
|
}
|
|
3072
|
-
}, [
|
|
3073
|
-
const sizeClasses =
|
|
3074
|
-
return /* @__PURE__ */
|
|
3180
|
+
}, [propValue]);
|
|
3181
|
+
const sizeClasses = SIZE_CLASSES10[size];
|
|
3182
|
+
return /* @__PURE__ */ jsx23("div", { className: `relative ${sizeClasses} w-[288px]`, ref: selectRef, children: injectStore2(children, store) });
|
|
3075
3183
|
};
|
|
3076
3184
|
var SelectValue = ({
|
|
3077
3185
|
placeholder,
|
|
@@ -3080,7 +3188,7 @@ var SelectValue = ({
|
|
|
3080
3188
|
const store = useSelectStore(externalStore);
|
|
3081
3189
|
const selectedLabel = useStore2(store, (s) => s.selectedLabel);
|
|
3082
3190
|
const value = useStore2(store, (s) => s.value);
|
|
3083
|
-
return /* @__PURE__ */
|
|
3191
|
+
return /* @__PURE__ */ jsx23("span", { className: "text-inherit", children: selectedLabel || placeholder || value });
|
|
3084
3192
|
};
|
|
3085
3193
|
var SelectTrigger = forwardRef10(
|
|
3086
3194
|
({
|
|
@@ -3095,7 +3203,7 @@ var SelectTrigger = forwardRef10(
|
|
|
3095
3203
|
const open = useStore2(store, (s) => s.open);
|
|
3096
3204
|
const toggleOpen = () => store.setState({ open: !open });
|
|
3097
3205
|
const variantClasses = VARIANT_CLASSES4[variant];
|
|
3098
|
-
return /* @__PURE__ */
|
|
3206
|
+
return /* @__PURE__ */ jsxs18(
|
|
3099
3207
|
"button",
|
|
3100
3208
|
{
|
|
3101
3209
|
ref,
|
|
@@ -3114,7 +3222,7 @@ var SelectTrigger = forwardRef10(
|
|
|
3114
3222
|
...props,
|
|
3115
3223
|
children: [
|
|
3116
3224
|
props.children,
|
|
3117
|
-
/* @__PURE__ */
|
|
3225
|
+
/* @__PURE__ */ jsx23(
|
|
3118
3226
|
CaretDown,
|
|
3119
3227
|
{
|
|
3120
3228
|
className: `h-[1em] w-[1em] opacity-50 transition-transform ${open ? "rotate-180" : ""}`
|
|
@@ -3139,7 +3247,7 @@ var SelectContent = forwardRef10(
|
|
|
3139
3247
|
const open = useStore2(store, (s) => s.open);
|
|
3140
3248
|
if (!open) return null;
|
|
3141
3249
|
const getPositionClasses = () => `w-full min-w-full absolute ${SIDE_CLASSES2[side]} ${ALIGN_CLASSES2[align]}`;
|
|
3142
|
-
return /* @__PURE__ */
|
|
3250
|
+
return /* @__PURE__ */ jsx23(
|
|
3143
3251
|
"div",
|
|
3144
3252
|
{
|
|
3145
3253
|
role: "menu",
|
|
@@ -3162,8 +3270,12 @@ var SelectItem = forwardRef10(
|
|
|
3162
3270
|
...props
|
|
3163
3271
|
}, ref) => {
|
|
3164
3272
|
const store = useSelectStore(externalStore);
|
|
3165
|
-
const
|
|
3166
|
-
|
|
3273
|
+
const {
|
|
3274
|
+
value: selectedValue,
|
|
3275
|
+
setValue,
|
|
3276
|
+
setOpen,
|
|
3277
|
+
setSelectedLabel
|
|
3278
|
+
} = useStore2(store, (s) => s);
|
|
3167
3279
|
const handleClick = (e) => {
|
|
3168
3280
|
const labelNode = getLabelAsNode(children);
|
|
3169
3281
|
if (!disabled) {
|
|
@@ -3173,7 +3285,7 @@ var SelectItem = forwardRef10(
|
|
|
3173
3285
|
}
|
|
3174
3286
|
props.onClick?.(e);
|
|
3175
3287
|
};
|
|
3176
|
-
return /* @__PURE__ */
|
|
3288
|
+
return /* @__PURE__ */ jsxs18(
|
|
3177
3289
|
"div",
|
|
3178
3290
|
{
|
|
3179
3291
|
role: "menuitem",
|
|
@@ -3193,7 +3305,7 @@ var SelectItem = forwardRef10(
|
|
|
3193
3305
|
tabIndex: disabled ? -1 : 0,
|
|
3194
3306
|
...props,
|
|
3195
3307
|
children: [
|
|
3196
|
-
/* @__PURE__ */
|
|
3308
|
+
/* @__PURE__ */ jsx23("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: selectedValue === value && /* @__PURE__ */ jsx23(Check3, { className: "" }) }),
|
|
3197
3309
|
children
|
|
3198
3310
|
]
|
|
3199
3311
|
}
|
|
@@ -3206,7 +3318,7 @@ var Select_default = Select;
|
|
|
3206
3318
|
// src/components/Menu/Menu.tsx
|
|
3207
3319
|
import { create as create4, useStore as useStore3 } from "zustand";
|
|
3208
3320
|
import {
|
|
3209
|
-
useEffect as
|
|
3321
|
+
useEffect as useEffect5,
|
|
3210
3322
|
useRef as useRef4,
|
|
3211
3323
|
forwardRef as forwardRef11,
|
|
3212
3324
|
isValidElement as isValidElement3,
|
|
@@ -3215,7 +3327,7 @@ import {
|
|
|
3215
3327
|
useState as useState7
|
|
3216
3328
|
} from "react";
|
|
3217
3329
|
import { CaretLeft, CaretRight } from "phosphor-react";
|
|
3218
|
-
import { jsx as
|
|
3330
|
+
import { jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3219
3331
|
var createMenuStore = () => create4((set) => ({
|
|
3220
3332
|
value: "",
|
|
3221
3333
|
setValue: (value) => set({ value })
|
|
@@ -3243,15 +3355,15 @@ var Menu = forwardRef11(
|
|
|
3243
3355
|
storeRef.current ??= createMenuStore();
|
|
3244
3356
|
const store = storeRef.current;
|
|
3245
3357
|
const { setValue, value } = useStore3(store, (s) => s);
|
|
3246
|
-
|
|
3358
|
+
useEffect5(() => {
|
|
3247
3359
|
setValue(propValue ?? defaultValue);
|
|
3248
3360
|
}, [defaultValue, propValue, setValue]);
|
|
3249
|
-
|
|
3361
|
+
useEffect5(() => {
|
|
3250
3362
|
onValueChange?.(value);
|
|
3251
3363
|
}, [value, onValueChange]);
|
|
3252
3364
|
const baseClasses = "w-full flex flex-row items-center gap-2 py-2 px-6";
|
|
3253
3365
|
const variantClasses = VARIANT_CLASSES5[variant];
|
|
3254
|
-
return /* @__PURE__ */
|
|
3366
|
+
return /* @__PURE__ */ jsx24(
|
|
3255
3367
|
"ul",
|
|
3256
3368
|
{
|
|
3257
3369
|
ref,
|
|
@@ -3296,7 +3408,7 @@ var MenuItem = forwardRef11(
|
|
|
3296
3408
|
...props
|
|
3297
3409
|
};
|
|
3298
3410
|
const variants = {
|
|
3299
|
-
menu: /* @__PURE__ */
|
|
3411
|
+
menu: /* @__PURE__ */ jsx24(
|
|
3300
3412
|
"li",
|
|
3301
3413
|
{
|
|
3302
3414
|
"data-variant": "menu",
|
|
@@ -3311,7 +3423,7 @@ var MenuItem = forwardRef11(
|
|
|
3311
3423
|
children
|
|
3312
3424
|
}
|
|
3313
3425
|
),
|
|
3314
|
-
menu2: /* @__PURE__ */
|
|
3426
|
+
menu2: /* @__PURE__ */ jsx24(
|
|
3315
3427
|
"li",
|
|
3316
3428
|
{
|
|
3317
3429
|
"data-variant": "menu2",
|
|
@@ -3323,7 +3435,7 @@ var MenuItem = forwardRef11(
|
|
|
3323
3435
|
children
|
|
3324
3436
|
}
|
|
3325
3437
|
),
|
|
3326
|
-
breadcrumb: /* @__PURE__ */
|
|
3438
|
+
breadcrumb: /* @__PURE__ */ jsx24(
|
|
3327
3439
|
"li",
|
|
3328
3440
|
{
|
|
3329
3441
|
"data-variant": "breadcrumb",
|
|
@@ -3334,7 +3446,7 @@ var MenuItem = forwardRef11(
|
|
|
3334
3446
|
${className ?? ""}
|
|
3335
3447
|
`,
|
|
3336
3448
|
...commonProps,
|
|
3337
|
-
children: /* @__PURE__ */
|
|
3449
|
+
children: /* @__PURE__ */ jsx24(
|
|
3338
3450
|
"span",
|
|
3339
3451
|
{
|
|
3340
3452
|
className: `
|
|
@@ -3352,14 +3464,14 @@ var MenuItem = forwardRef11(
|
|
|
3352
3464
|
);
|
|
3353
3465
|
MenuItem.displayName = "MenuItem";
|
|
3354
3466
|
var MenuSeparator = forwardRef11(
|
|
3355
|
-
({ className, children, ...props }, ref) => /* @__PURE__ */
|
|
3467
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
3356
3468
|
"li",
|
|
3357
3469
|
{
|
|
3358
3470
|
ref,
|
|
3359
3471
|
"aria-hidden": "true",
|
|
3360
3472
|
className: `[&>svg]:w-4 [&>svg]:h-4 text-text-600 ${className ?? ""}`,
|
|
3361
3473
|
...props,
|
|
3362
|
-
children: children ?? /* @__PURE__ */
|
|
3474
|
+
children: children ?? /* @__PURE__ */ jsx24(CaretRight, {})
|
|
3363
3475
|
}
|
|
3364
3476
|
)
|
|
3365
3477
|
);
|
|
@@ -3394,6 +3506,7 @@ export {
|
|
|
3394
3506
|
MenuItem,
|
|
3395
3507
|
MenuLabel,
|
|
3396
3508
|
MenuSeparator,
|
|
3509
|
+
Modal_default as Modal,
|
|
3397
3510
|
NavButton_default as NavButton,
|
|
3398
3511
|
ProfileMenuFooter,
|
|
3399
3512
|
ProfileMenuHeader,
|