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.js
CHANGED
|
@@ -27,10 +27,13 @@ __export(src_exports, {
|
|
|
27
27
|
Chips: () => Chips_default,
|
|
28
28
|
Divider: () => Divider_default,
|
|
29
29
|
DropdownMenu: () => DropdownMenu_default,
|
|
30
|
+
DropdownMenuItem: () => DropdownMenuItem,
|
|
31
|
+
DropdownMenuSeparator: () => DropdownMenuSeparator,
|
|
30
32
|
DropdownMenuTrigger: () => DropdownMenuTrigger,
|
|
31
33
|
IconButton: () => IconButton_default,
|
|
32
34
|
IconRoundedButton: () => IconRoundedButton_default,
|
|
33
35
|
Input: () => Input_default,
|
|
36
|
+
Menu: () => Menu_default,
|
|
34
37
|
MenuContent: () => MenuContent,
|
|
35
38
|
MenuItem: () => MenuItem,
|
|
36
39
|
MenuLabel: () => MenuLabel,
|
|
@@ -2018,7 +2021,7 @@ var MenuContent = (0, import_react9.forwardRef)(
|
|
|
2018
2021
|
}
|
|
2019
2022
|
);
|
|
2020
2023
|
MenuContent.displayName = "MenuContent";
|
|
2021
|
-
var
|
|
2024
|
+
var DropdownMenuItem = (0, import_react9.forwardRef)(
|
|
2022
2025
|
({
|
|
2023
2026
|
className,
|
|
2024
2027
|
size = "small",
|
|
@@ -2081,8 +2084,8 @@ var MenuItem = (0, import_react9.forwardRef)(
|
|
|
2081
2084
|
);
|
|
2082
2085
|
}
|
|
2083
2086
|
);
|
|
2084
|
-
|
|
2085
|
-
var
|
|
2087
|
+
DropdownMenuItem.displayName = "DropdownMenuItem";
|
|
2088
|
+
var DropdownMenuSeparator = (0, import_react9.forwardRef)(({ className, store: _store, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2086
2089
|
"div",
|
|
2087
2090
|
{
|
|
2088
2091
|
ref,
|
|
@@ -2090,7 +2093,7 @@ var MenuSeparator = (0, import_react9.forwardRef)(({ className, store: _store, .
|
|
|
2090
2093
|
...props
|
|
2091
2094
|
}
|
|
2092
2095
|
));
|
|
2093
|
-
|
|
2096
|
+
DropdownMenuSeparator.displayName = "DropdownMenuSeparator";
|
|
2094
2097
|
var ProfileMenuTrigger = (0, import_react9.forwardRef)(({ className, onClick, store: externalStore, ...props }, ref) => {
|
|
2095
2098
|
const store = useDropdownStore(externalStore);
|
|
2096
2099
|
const open = (0, import_zustand2.useStore)(store, (s) => s.open);
|
|
@@ -2459,6 +2462,170 @@ var SelectItem = (0, import_react10.forwardRef)(
|
|
|
2459
2462
|
);
|
|
2460
2463
|
SelectItem.displayName = "SelectItem";
|
|
2461
2464
|
var Select_default = Select;
|
|
2465
|
+
|
|
2466
|
+
// src/components/Menu/Menu.tsx
|
|
2467
|
+
var import_zustand4 = require("zustand");
|
|
2468
|
+
var import_react11 = require("react");
|
|
2469
|
+
var import_phosphor_react9 = require("phosphor-react");
|
|
2470
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2471
|
+
var createMenuStore = () => (0, import_zustand4.create)((set) => ({
|
|
2472
|
+
value: "",
|
|
2473
|
+
setValue: (value) => set({ value })
|
|
2474
|
+
}));
|
|
2475
|
+
var useMenuStore = (externalStore) => {
|
|
2476
|
+
if (!externalStore) throw new Error("MenuItem must be inside Menu");
|
|
2477
|
+
return externalStore;
|
|
2478
|
+
};
|
|
2479
|
+
var VARIANT_CLASSES5 = {
|
|
2480
|
+
menu: "bg-background shadow-soft-shadow-1",
|
|
2481
|
+
menu2: "overflow-x-auto scroll-smooth",
|
|
2482
|
+
breadcrumb: ""
|
|
2483
|
+
};
|
|
2484
|
+
var Menu = (0, import_react11.forwardRef)(
|
|
2485
|
+
({
|
|
2486
|
+
className,
|
|
2487
|
+
children,
|
|
2488
|
+
defaultValue,
|
|
2489
|
+
value: propValue,
|
|
2490
|
+
variant = "menu",
|
|
2491
|
+
onValueChange,
|
|
2492
|
+
...props
|
|
2493
|
+
}, ref) => {
|
|
2494
|
+
const storeRef = (0, import_react11.useRef)(null);
|
|
2495
|
+
storeRef.current ??= createMenuStore();
|
|
2496
|
+
const store = storeRef.current;
|
|
2497
|
+
const { setValue, value } = (0, import_zustand4.useStore)(store, (s) => s);
|
|
2498
|
+
(0, import_react11.useEffect)(() => {
|
|
2499
|
+
setValue(propValue ?? defaultValue);
|
|
2500
|
+
}, [defaultValue, propValue, setValue]);
|
|
2501
|
+
(0, import_react11.useEffect)(() => {
|
|
2502
|
+
onValueChange?.(value);
|
|
2503
|
+
}, [value, onValueChange]);
|
|
2504
|
+
const baseClasses = "w-full flex flex-row items-center gap-2 py-2 px-6";
|
|
2505
|
+
const variantClasses = VARIANT_CLASSES5[variant];
|
|
2506
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2507
|
+
"ul",
|
|
2508
|
+
{
|
|
2509
|
+
ref,
|
|
2510
|
+
className: `
|
|
2511
|
+
${baseClasses}
|
|
2512
|
+
${variantClasses}
|
|
2513
|
+
${className ?? ""}
|
|
2514
|
+
`,
|
|
2515
|
+
style: variant === "menu2" ? { scrollbarWidth: "none", msOverflowStyle: "none" } : void 0,
|
|
2516
|
+
...props,
|
|
2517
|
+
children: injectStore3(children, store)
|
|
2518
|
+
}
|
|
2519
|
+
);
|
|
2520
|
+
}
|
|
2521
|
+
);
|
|
2522
|
+
Menu.displayName = "Menu";
|
|
2523
|
+
var MenuItem = (0, import_react11.forwardRef)(
|
|
2524
|
+
({
|
|
2525
|
+
className,
|
|
2526
|
+
children,
|
|
2527
|
+
value,
|
|
2528
|
+
disabled = false,
|
|
2529
|
+
store: externalStore,
|
|
2530
|
+
variant = "menu",
|
|
2531
|
+
...props
|
|
2532
|
+
}, ref) => {
|
|
2533
|
+
const store = useMenuStore(externalStore);
|
|
2534
|
+
const { value: selectedValue, setValue } = (0, import_zustand4.useStore)(store, (s) => s);
|
|
2535
|
+
const handleClick = (e) => {
|
|
2536
|
+
if (!disabled) setValue(value);
|
|
2537
|
+
props.onClick?.(e);
|
|
2538
|
+
};
|
|
2539
|
+
const commonProps = {
|
|
2540
|
+
role: "menuitem",
|
|
2541
|
+
"aria-disabled": disabled,
|
|
2542
|
+
ref,
|
|
2543
|
+
onClick: handleClick,
|
|
2544
|
+
onKeyDown: (e) => {
|
|
2545
|
+
if (["Enter", " "].includes(e.key)) handleClick(e);
|
|
2546
|
+
},
|
|
2547
|
+
tabIndex: disabled ? -1 : 0,
|
|
2548
|
+
...props
|
|
2549
|
+
};
|
|
2550
|
+
const variants = {
|
|
2551
|
+
menu: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2552
|
+
"li",
|
|
2553
|
+
{
|
|
2554
|
+
"data-variant": "menu",
|
|
2555
|
+
className: `
|
|
2556
|
+
w-full flex flex-col gap-0.5 items-center py-1 px-2 rounded-sm font-medium text-xs
|
|
2557
|
+
[&>svg]:size-6 cursor-pointer hover:bg-primary-600 hover:text-text
|
|
2558
|
+
focus:outline-none focus:border-2-indicator-info focus:border-2
|
|
2559
|
+
${selectedValue === value ? "bg-primary-50 text-primary-950" : "text-text-950"}
|
|
2560
|
+
${className ?? ""}
|
|
2561
|
+
`,
|
|
2562
|
+
...commonProps,
|
|
2563
|
+
children
|
|
2564
|
+
}
|
|
2565
|
+
),
|
|
2566
|
+
menu2: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2567
|
+
"li",
|
|
2568
|
+
{
|
|
2569
|
+
"data-variant": "menu2",
|
|
2570
|
+
className: `
|
|
2571
|
+
flex flex-row items-center p-4 gap-2 border-b-2 border-transparent text-text-950 text-sx font-bold cursor-pointer
|
|
2572
|
+
${selectedValue === value ? "border-b-primary-950" : ""}
|
|
2573
|
+
`,
|
|
2574
|
+
...commonProps,
|
|
2575
|
+
children
|
|
2576
|
+
}
|
|
2577
|
+
),
|
|
2578
|
+
breadcrumb: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2579
|
+
"li",
|
|
2580
|
+
{
|
|
2581
|
+
"data-variant": "breadcrumb",
|
|
2582
|
+
className: `
|
|
2583
|
+
p-2 rounded-lg hover:text-primary-600 cursor-pointer font-bold text-xs
|
|
2584
|
+
focus:outline-none focus:border-indicator-info focus:border-2
|
|
2585
|
+
${selectedValue === value ? "text-primary-950" : "text-text-600"}
|
|
2586
|
+
${className ?? ""}
|
|
2587
|
+
`,
|
|
2588
|
+
...commonProps,
|
|
2589
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2590
|
+
"span",
|
|
2591
|
+
{
|
|
2592
|
+
className: `
|
|
2593
|
+
border-b border-text-600 hover:border-primary-600 text-inherit
|
|
2594
|
+
${selectedValue === value ? "border-b-primary-950" : "border-b-primary-600"}
|
|
2595
|
+
`,
|
|
2596
|
+
children
|
|
2597
|
+
}
|
|
2598
|
+
)
|
|
2599
|
+
}
|
|
2600
|
+
)
|
|
2601
|
+
};
|
|
2602
|
+
return variants[variant] ?? variants["menu"];
|
|
2603
|
+
}
|
|
2604
|
+
);
|
|
2605
|
+
MenuItem.displayName = "MenuItem";
|
|
2606
|
+
var MenuSeparator = (0, import_react11.forwardRef)(
|
|
2607
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2608
|
+
"li",
|
|
2609
|
+
{
|
|
2610
|
+
ref,
|
|
2611
|
+
"aria-hidden": "true",
|
|
2612
|
+
className: `[&>svg]:w-4 [&>svg]:h-4 text-text-600 ${className ?? ""}`,
|
|
2613
|
+
...props,
|
|
2614
|
+
children: children ?? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_phosphor_react9.CaretRight, {})
|
|
2615
|
+
}
|
|
2616
|
+
)
|
|
2617
|
+
);
|
|
2618
|
+
MenuSeparator.displayName = "MenuSeparator";
|
|
2619
|
+
var injectStore3 = (children, store) => import_react11.Children.map(children, (child) => {
|
|
2620
|
+
if (!(0, import_react11.isValidElement)(child)) return child;
|
|
2621
|
+
const typedChild = child;
|
|
2622
|
+
const shouldInject = typedChild.type === MenuItem;
|
|
2623
|
+
return (0, import_react11.cloneElement)(typedChild, {
|
|
2624
|
+
...shouldInject ? { store } : {},
|
|
2625
|
+
...typedChild.props.children ? { children: injectStore3(typedChild.props.children, store) } : {}
|
|
2626
|
+
});
|
|
2627
|
+
});
|
|
2628
|
+
var Menu_default = Menu;
|
|
2462
2629
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2463
2630
|
0 && (module.exports = {
|
|
2464
2631
|
Alert,
|
|
@@ -2468,10 +2635,13 @@ var Select_default = Select;
|
|
|
2468
2635
|
Chips,
|
|
2469
2636
|
Divider,
|
|
2470
2637
|
DropdownMenu,
|
|
2638
|
+
DropdownMenuItem,
|
|
2639
|
+
DropdownMenuSeparator,
|
|
2471
2640
|
DropdownMenuTrigger,
|
|
2472
2641
|
IconButton,
|
|
2473
2642
|
IconRoundedButton,
|
|
2474
2643
|
Input,
|
|
2644
|
+
Menu,
|
|
2475
2645
|
MenuContent,
|
|
2476
2646
|
MenuItem,
|
|
2477
2647
|
MenuLabel,
|