analytica-frontend-lib 1.0.39 → 1.0.40
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/DropdownMenu/index.d.mts +3 -3
- package/dist/DropdownMenu/index.d.ts +3 -3
- package/dist/DropdownMenu/index.js +8 -8
- package/dist/DropdownMenu/index.js.map +1 -1
- package/dist/DropdownMenu/index.mjs +6 -6
- package/dist/DropdownMenu/index.mjs.map +1 -1
- package/dist/Menu/index.d.mts +41 -0
- package/dist/Menu/index.d.ts +41 -0
- package/dist/Menu/index.js +307 -0
- package/dist/Menu/index.js.map +1 -0
- package/dist/Menu/index.mjs +283 -0
- package/dist/Menu/index.mjs.map +1 -0
- package/dist/index.css +84 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +174 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +179 -4
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +84 -0
- package/dist/styles.css.map +1 -1
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -1983,7 +1983,7 @@ var MenuContent = forwardRef9(
|
|
|
1983
1983
|
}
|
|
1984
1984
|
);
|
|
1985
1985
|
MenuContent.displayName = "MenuContent";
|
|
1986
|
-
var
|
|
1986
|
+
var DropdownMenuItem = forwardRef9(
|
|
1987
1987
|
({
|
|
1988
1988
|
className,
|
|
1989
1989
|
size = "small",
|
|
@@ -2046,8 +2046,8 @@ var MenuItem = forwardRef9(
|
|
|
2046
2046
|
);
|
|
2047
2047
|
}
|
|
2048
2048
|
);
|
|
2049
|
-
|
|
2050
|
-
var
|
|
2049
|
+
DropdownMenuItem.displayName = "DropdownMenuItem";
|
|
2050
|
+
var DropdownMenuSeparator = forwardRef9(({ className, store: _store, ...props }, ref) => /* @__PURE__ */ jsx20(
|
|
2051
2051
|
"div",
|
|
2052
2052
|
{
|
|
2053
2053
|
ref,
|
|
@@ -2055,7 +2055,7 @@ var MenuSeparator = forwardRef9(({ className, store: _store, ...props }, ref) =>
|
|
|
2055
2055
|
...props
|
|
2056
2056
|
}
|
|
2057
2057
|
));
|
|
2058
|
-
|
|
2058
|
+
DropdownMenuSeparator.displayName = "DropdownMenuSeparator";
|
|
2059
2059
|
var ProfileMenuTrigger = forwardRef9(({ className, onClick, store: externalStore, ...props }, ref) => {
|
|
2060
2060
|
const store = useDropdownStore(externalStore);
|
|
2061
2061
|
const open = useStore(store, (s) => s.open);
|
|
@@ -2431,6 +2431,178 @@ var SelectItem = forwardRef10(
|
|
|
2431
2431
|
);
|
|
2432
2432
|
SelectItem.displayName = "SelectItem";
|
|
2433
2433
|
var Select_default = Select;
|
|
2434
|
+
|
|
2435
|
+
// src/components/Menu/Menu.tsx
|
|
2436
|
+
import { create as create4, useStore as useStore3 } from "zustand";
|
|
2437
|
+
import {
|
|
2438
|
+
useEffect as useEffect3,
|
|
2439
|
+
useRef as useRef3,
|
|
2440
|
+
forwardRef as forwardRef11,
|
|
2441
|
+
isValidElement as isValidElement3,
|
|
2442
|
+
Children as Children3,
|
|
2443
|
+
cloneElement as cloneElement3,
|
|
2444
|
+
useState as useState6
|
|
2445
|
+
} from "react";
|
|
2446
|
+
import { CaretLeft, CaretRight } from "phosphor-react";
|
|
2447
|
+
import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2448
|
+
var createMenuStore = () => create4((set) => ({
|
|
2449
|
+
value: "",
|
|
2450
|
+
setValue: (value) => set({ value })
|
|
2451
|
+
}));
|
|
2452
|
+
var useMenuStore = (externalStore) => {
|
|
2453
|
+
if (!externalStore) throw new Error("MenuItem must be inside Menu");
|
|
2454
|
+
return externalStore;
|
|
2455
|
+
};
|
|
2456
|
+
var VARIANT_CLASSES5 = {
|
|
2457
|
+
menu: "bg-background shadow-soft-shadow-1",
|
|
2458
|
+
menu2: "overflow-x-auto scroll-smooth",
|
|
2459
|
+
breadcrumb: ""
|
|
2460
|
+
};
|
|
2461
|
+
var Menu = forwardRef11(
|
|
2462
|
+
({
|
|
2463
|
+
className,
|
|
2464
|
+
children,
|
|
2465
|
+
defaultValue,
|
|
2466
|
+
value: propValue,
|
|
2467
|
+
variant = "menu",
|
|
2468
|
+
onValueChange,
|
|
2469
|
+
...props
|
|
2470
|
+
}, ref) => {
|
|
2471
|
+
const storeRef = useRef3(null);
|
|
2472
|
+
storeRef.current ??= createMenuStore();
|
|
2473
|
+
const store = storeRef.current;
|
|
2474
|
+
const { setValue, value } = useStore3(store, (s) => s);
|
|
2475
|
+
useEffect3(() => {
|
|
2476
|
+
setValue(propValue ?? defaultValue);
|
|
2477
|
+
}, [defaultValue, propValue, setValue]);
|
|
2478
|
+
useEffect3(() => {
|
|
2479
|
+
onValueChange?.(value);
|
|
2480
|
+
}, [value, onValueChange]);
|
|
2481
|
+
const baseClasses = "w-full flex flex-row items-center gap-2 py-2 px-6";
|
|
2482
|
+
const variantClasses = VARIANT_CLASSES5[variant];
|
|
2483
|
+
return /* @__PURE__ */ jsx22(
|
|
2484
|
+
"ul",
|
|
2485
|
+
{
|
|
2486
|
+
ref,
|
|
2487
|
+
className: `
|
|
2488
|
+
${baseClasses}
|
|
2489
|
+
${variantClasses}
|
|
2490
|
+
${className ?? ""}
|
|
2491
|
+
`,
|
|
2492
|
+
style: variant === "menu2" ? { scrollbarWidth: "none", msOverflowStyle: "none" } : void 0,
|
|
2493
|
+
...props,
|
|
2494
|
+
children: injectStore3(children, store)
|
|
2495
|
+
}
|
|
2496
|
+
);
|
|
2497
|
+
}
|
|
2498
|
+
);
|
|
2499
|
+
Menu.displayName = "Menu";
|
|
2500
|
+
var MenuItem = forwardRef11(
|
|
2501
|
+
({
|
|
2502
|
+
className,
|
|
2503
|
+
children,
|
|
2504
|
+
value,
|
|
2505
|
+
disabled = false,
|
|
2506
|
+
store: externalStore,
|
|
2507
|
+
variant = "menu",
|
|
2508
|
+
...props
|
|
2509
|
+
}, ref) => {
|
|
2510
|
+
const store = useMenuStore(externalStore);
|
|
2511
|
+
const { value: selectedValue, setValue } = useStore3(store, (s) => s);
|
|
2512
|
+
const handleClick = (e) => {
|
|
2513
|
+
if (!disabled) setValue(value);
|
|
2514
|
+
props.onClick?.(e);
|
|
2515
|
+
};
|
|
2516
|
+
const commonProps = {
|
|
2517
|
+
role: "menuitem",
|
|
2518
|
+
"aria-disabled": disabled,
|
|
2519
|
+
ref,
|
|
2520
|
+
onClick: handleClick,
|
|
2521
|
+
onKeyDown: (e) => {
|
|
2522
|
+
if (["Enter", " "].includes(e.key)) handleClick(e);
|
|
2523
|
+
},
|
|
2524
|
+
tabIndex: disabled ? -1 : 0,
|
|
2525
|
+
...props
|
|
2526
|
+
};
|
|
2527
|
+
const variants = {
|
|
2528
|
+
menu: /* @__PURE__ */ jsx22(
|
|
2529
|
+
"li",
|
|
2530
|
+
{
|
|
2531
|
+
"data-variant": "menu",
|
|
2532
|
+
className: `
|
|
2533
|
+
w-full flex flex-col gap-0.5 items-center py-1 px-2 rounded-sm font-medium text-xs
|
|
2534
|
+
[&>svg]:size-6 cursor-pointer hover:bg-primary-600 hover:text-text
|
|
2535
|
+
focus:outline-none focus:border-2-indicator-info focus:border-2
|
|
2536
|
+
${selectedValue === value ? "bg-primary-50 text-primary-950" : "text-text-950"}
|
|
2537
|
+
${className ?? ""}
|
|
2538
|
+
`,
|
|
2539
|
+
...commonProps,
|
|
2540
|
+
children
|
|
2541
|
+
}
|
|
2542
|
+
),
|
|
2543
|
+
menu2: /* @__PURE__ */ jsx22(
|
|
2544
|
+
"li",
|
|
2545
|
+
{
|
|
2546
|
+
"data-variant": "menu2",
|
|
2547
|
+
className: `
|
|
2548
|
+
flex flex-row items-center p-4 gap-2 border-b-2 border-transparent text-text-950 text-sx font-bold cursor-pointer
|
|
2549
|
+
${selectedValue === value ? "border-b-primary-950" : ""}
|
|
2550
|
+
`,
|
|
2551
|
+
...commonProps,
|
|
2552
|
+
children
|
|
2553
|
+
}
|
|
2554
|
+
),
|
|
2555
|
+
breadcrumb: /* @__PURE__ */ jsx22(
|
|
2556
|
+
"li",
|
|
2557
|
+
{
|
|
2558
|
+
"data-variant": "breadcrumb",
|
|
2559
|
+
className: `
|
|
2560
|
+
p-2 rounded-lg hover:text-primary-600 cursor-pointer font-bold text-xs
|
|
2561
|
+
focus:outline-none focus:border-indicator-info focus:border-2
|
|
2562
|
+
${selectedValue === value ? "text-primary-950" : "text-text-600"}
|
|
2563
|
+
${className ?? ""}
|
|
2564
|
+
`,
|
|
2565
|
+
...commonProps,
|
|
2566
|
+
children: /* @__PURE__ */ jsx22(
|
|
2567
|
+
"span",
|
|
2568
|
+
{
|
|
2569
|
+
className: `
|
|
2570
|
+
border-b border-text-600 hover:border-primary-600 text-inherit
|
|
2571
|
+
${selectedValue === value ? "border-b-primary-950" : "border-b-primary-600"}
|
|
2572
|
+
`,
|
|
2573
|
+
children
|
|
2574
|
+
}
|
|
2575
|
+
)
|
|
2576
|
+
}
|
|
2577
|
+
)
|
|
2578
|
+
};
|
|
2579
|
+
return variants[variant] ?? variants["menu"];
|
|
2580
|
+
}
|
|
2581
|
+
);
|
|
2582
|
+
MenuItem.displayName = "MenuItem";
|
|
2583
|
+
var MenuSeparator = forwardRef11(
|
|
2584
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsx22(
|
|
2585
|
+
"li",
|
|
2586
|
+
{
|
|
2587
|
+
ref,
|
|
2588
|
+
"aria-hidden": "true",
|
|
2589
|
+
className: `[&>svg]:w-4 [&>svg]:h-4 text-text-600 ${className ?? ""}`,
|
|
2590
|
+
...props,
|
|
2591
|
+
children: children ?? /* @__PURE__ */ jsx22(CaretRight, {})
|
|
2592
|
+
}
|
|
2593
|
+
)
|
|
2594
|
+
);
|
|
2595
|
+
MenuSeparator.displayName = "MenuSeparator";
|
|
2596
|
+
var injectStore3 = (children, store) => Children3.map(children, (child) => {
|
|
2597
|
+
if (!isValidElement3(child)) return child;
|
|
2598
|
+
const typedChild = child;
|
|
2599
|
+
const shouldInject = typedChild.type === MenuItem;
|
|
2600
|
+
return cloneElement3(typedChild, {
|
|
2601
|
+
...shouldInject ? { store } : {},
|
|
2602
|
+
...typedChild.props.children ? { children: injectStore3(typedChild.props.children, store) } : {}
|
|
2603
|
+
});
|
|
2604
|
+
});
|
|
2605
|
+
var Menu_default = Menu;
|
|
2434
2606
|
export {
|
|
2435
2607
|
Alert_default as Alert,
|
|
2436
2608
|
Badge_default as Badge,
|
|
@@ -2439,10 +2611,13 @@ export {
|
|
|
2439
2611
|
Chips_default as Chips,
|
|
2440
2612
|
Divider_default as Divider,
|
|
2441
2613
|
DropdownMenu_default as DropdownMenu,
|
|
2614
|
+
DropdownMenuItem,
|
|
2615
|
+
DropdownMenuSeparator,
|
|
2442
2616
|
DropdownMenuTrigger,
|
|
2443
2617
|
IconButton_default as IconButton,
|
|
2444
2618
|
IconRoundedButton_default as IconRoundedButton,
|
|
2445
2619
|
Input_default as Input,
|
|
2620
|
+
Menu_default as Menu,
|
|
2446
2621
|
MenuContent,
|
|
2447
2622
|
MenuItem,
|
|
2448
2623
|
MenuLabel,
|