@karakuri-ui/react 0.2.3 → 0.2.4
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/README.md +0 -1
- package/dist/components/ui/accordion.d.mts +49 -0
- package/dist/components/ui/accordion.d.ts +49 -0
- package/dist/components/ui/accordion.js +220 -0
- package/dist/components/ui/accordion.js.map +1 -0
- package/dist/components/ui/accordion.mjs +181 -0
- package/dist/components/ui/accordion.mjs.map +1 -0
- package/dist/components/ui/alert.d.mts +47 -0
- package/dist/components/ui/alert.d.ts +47 -0
- package/dist/components/ui/alert.js +223 -0
- package/dist/components/ui/alert.js.map +1 -0
- package/dist/components/ui/alert.mjs +185 -0
- package/dist/components/ui/alert.mjs.map +1 -0
- package/dist/components/ui/avatar.d.mts +232 -0
- package/dist/components/ui/avatar.d.ts +232 -0
- package/dist/components/ui/avatar.js +250 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/avatar.mjs +209 -0
- package/dist/components/ui/avatar.mjs.map +1 -0
- package/dist/components/ui/badge.d.mts +31 -0
- package/dist/components/ui/badge.d.ts +31 -0
- package/dist/components/ui/badge.js +205 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/badge.mjs +170 -0
- package/dist/components/ui/badge.mjs.map +1 -0
- package/dist/components/ui/breadcrumb.d.mts +57 -0
- package/dist/components/ui/breadcrumb.d.ts +57 -0
- package/dist/components/ui/breadcrumb.js +209 -0
- package/dist/components/ui/breadcrumb.js.map +1 -0
- package/dist/components/ui/breadcrumb.mjs +168 -0
- package/dist/components/ui/breadcrumb.mjs.map +1 -0
- package/dist/components/ui/button-group.d.mts +22 -0
- package/dist/components/ui/button-group.d.ts +22 -0
- package/dist/components/ui/button-group.js +107 -0
- package/dist/components/ui/button-group.js.map +1 -0
- package/dist/components/ui/button-group.mjs +72 -0
- package/dist/components/ui/button-group.mjs.map +1 -0
- package/dist/components/ui/button.d.mts +31 -0
- package/dist/components/ui/button.d.ts +31 -0
- package/dist/components/ui/button.js +176 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/button.mjs +141 -0
- package/dist/components/ui/button.mjs.map +1 -0
- package/dist/components/ui/card.d.mts +77 -0
- package/dist/components/ui/card.d.ts +77 -0
- package/dist/components/ui/card.js +370 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/card.mjs +328 -0
- package/dist/components/ui/card.mjs.map +1 -0
- package/dist/{chart.js → components/ui/chart.js} +29 -39
- package/dist/components/ui/chart.js.map +1 -0
- package/dist/{chart.mjs → components/ui/chart.mjs} +21 -31
- package/dist/components/ui/chart.mjs.map +1 -0
- package/dist/components/ui/checkbox.d.mts +24 -0
- package/dist/components/ui/checkbox.d.ts +24 -0
- package/dist/components/ui/checkbox.js +173 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/checkbox.mjs +138 -0
- package/dist/components/ui/checkbox.mjs.map +1 -0
- package/dist/components/ui/divider.d.mts +27 -0
- package/dist/components/ui/divider.d.ts +27 -0
- package/dist/components/ui/divider.js +147 -0
- package/dist/components/ui/divider.js.map +1 -0
- package/dist/components/ui/divider.mjs +112 -0
- package/dist/components/ui/divider.mjs.map +1 -0
- package/dist/components/ui/drawer.d.mts +51 -0
- package/dist/components/ui/drawer.d.ts +51 -0
- package/dist/components/ui/drawer.js +225 -0
- package/dist/components/ui/drawer.js.map +1 -0
- package/dist/components/ui/drawer.mjs +178 -0
- package/dist/components/ui/drawer.mjs.map +1 -0
- package/dist/components/ui/dropdown.d.mts +59 -0
- package/dist/components/ui/dropdown.d.ts +59 -0
- package/dist/components/ui/dropdown.js +310 -0
- package/dist/components/ui/dropdown.js.map +1 -0
- package/dist/components/ui/dropdown.mjs +263 -0
- package/dist/components/ui/dropdown.mjs.map +1 -0
- package/dist/components/ui/field.d.mts +33 -0
- package/dist/components/ui/field.d.ts +33 -0
- package/dist/components/ui/field.js +146 -0
- package/dist/components/ui/field.js.map +1 -0
- package/dist/components/ui/field.mjs +108 -0
- package/dist/components/ui/field.mjs.map +1 -0
- package/dist/components/ui/icon-button.d.mts +20 -0
- package/dist/components/ui/icon-button.d.ts +20 -0
- package/dist/components/ui/icon-button.js +147 -0
- package/dist/components/ui/icon-button.js.map +1 -0
- package/dist/components/ui/icon-button.mjs +112 -0
- package/dist/components/ui/icon-button.mjs.map +1 -0
- package/dist/components/ui/index.d.mts +55 -0
- package/dist/components/ui/index.d.ts +55 -0
- package/dist/components/ui/index.js +476 -0
- package/dist/components/ui/index.js.map +1 -0
- package/dist/components/ui/index.mjs +246 -0
- package/dist/components/ui/index.mjs.map +1 -0
- package/dist/components/ui/input.d.mts +20 -0
- package/dist/components/ui/input.d.ts +20 -0
- package/dist/components/ui/input.js +250 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/input.mjs +215 -0
- package/dist/components/ui/input.mjs.map +1 -0
- package/dist/components/ui/metric-card.d.mts +53 -0
- package/dist/components/ui/metric-card.d.ts +53 -0
- package/dist/components/ui/metric-card.js +258 -0
- package/dist/components/ui/metric-card.js.map +1 -0
- package/dist/components/ui/metric-card.mjs +217 -0
- package/dist/components/ui/metric-card.mjs.map +1 -0
- package/dist/components/ui/modal.d.mts +77 -0
- package/dist/components/ui/modal.d.ts +77 -0
- package/dist/components/ui/modal.js +396 -0
- package/dist/components/ui/modal.js.map +1 -0
- package/dist/components/ui/modal.mjs +338 -0
- package/dist/components/ui/modal.mjs.map +1 -0
- package/dist/components/ui/navigation-menu.d.mts +139 -0
- package/dist/components/ui/navigation-menu.d.ts +139 -0
- package/dist/components/ui/navigation-menu.js +531 -0
- package/dist/components/ui/navigation-menu.js.map +1 -0
- package/dist/components/ui/navigation-menu.mjs +488 -0
- package/dist/components/ui/navigation-menu.mjs.map +1 -0
- package/dist/components/ui/pagination.d.mts +130 -0
- package/dist/components/ui/pagination.d.ts +130 -0
- package/dist/components/ui/pagination.js +495 -0
- package/dist/components/ui/pagination.js.map +1 -0
- package/dist/components/ui/pagination.mjs +449 -0
- package/dist/components/ui/pagination.mjs.map +1 -0
- package/dist/components/ui/popover.d.mts +41 -0
- package/dist/components/ui/popover.d.ts +41 -0
- package/dist/components/ui/popover.js +175 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/popover.mjs +133 -0
- package/dist/components/ui/popover.mjs.map +1 -0
- package/dist/components/ui/progress.d.mts +35 -0
- package/dist/components/ui/progress.d.ts +35 -0
- package/dist/components/ui/progress.js +194 -0
- package/dist/components/ui/progress.js.map +1 -0
- package/dist/components/ui/progress.mjs +159 -0
- package/dist/components/ui/progress.mjs.map +1 -0
- package/dist/components/ui/radio-group.d.mts +40 -0
- package/dist/components/ui/radio-group.d.ts +40 -0
- package/dist/components/ui/radio-group.js +177 -0
- package/dist/components/ui/radio-group.js.map +1 -0
- package/dist/components/ui/radio-group.mjs +140 -0
- package/dist/components/ui/radio-group.mjs.map +1 -0
- package/dist/components/ui/segmented.d.mts +30 -0
- package/dist/components/ui/segmented.d.ts +30 -0
- package/dist/components/ui/segmented.js +241 -0
- package/dist/components/ui/segmented.js.map +1 -0
- package/dist/components/ui/segmented.mjs +204 -0
- package/dist/components/ui/segmented.mjs.map +1 -0
- package/dist/components/ui/select.d.mts +31 -0
- package/dist/components/ui/select.d.ts +31 -0
- package/dist/components/ui/select.js +317 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/select.mjs +276 -0
- package/dist/components/ui/select.mjs.map +1 -0
- package/dist/components/ui/skeleton.d.mts +26 -0
- package/dist/components/ui/skeleton.d.ts +26 -0
- package/dist/components/ui/skeleton.js +144 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/components/ui/skeleton.mjs +109 -0
- package/dist/components/ui/skeleton.mjs.map +1 -0
- package/dist/components/ui/slider.d.mts +38 -0
- package/dist/components/ui/slider.d.ts +38 -0
- package/dist/components/ui/slider.js +180 -0
- package/dist/components/ui/slider.js.map +1 -0
- package/dist/components/ui/slider.mjs +145 -0
- package/dist/components/ui/slider.mjs.map +1 -0
- package/dist/components/ui/spinner.d.mts +23 -0
- package/dist/components/ui/spinner.d.ts +23 -0
- package/dist/components/ui/spinner.js +471 -0
- package/dist/components/ui/spinner.js.map +1 -0
- package/dist/components/ui/spinner.mjs +436 -0
- package/dist/components/ui/spinner.mjs.map +1 -0
- package/dist/components/ui/switch.d.mts +22 -0
- package/dist/components/ui/switch.d.ts +22 -0
- package/dist/components/ui/switch.js +173 -0
- package/dist/components/ui/switch.js.map +1 -0
- package/dist/components/ui/switch.mjs +138 -0
- package/dist/components/ui/switch.mjs.map +1 -0
- package/dist/components/ui/table.d.mts +74 -0
- package/dist/components/ui/table.d.ts +74 -0
- package/dist/components/ui/table.js +240 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/components/ui/table.mjs +199 -0
- package/dist/components/ui/table.mjs.map +1 -0
- package/dist/components/ui/tabs.d.mts +40 -0
- package/dist/components/ui/tabs.d.ts +40 -0
- package/dist/components/ui/tabs.js +238 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/tabs.mjs +199 -0
- package/dist/components/ui/tabs.mjs.map +1 -0
- package/dist/components/ui/textarea.d.mts +19 -0
- package/dist/components/ui/textarea.d.ts +19 -0
- package/dist/components/ui/textarea.js +181 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/components/ui/textarea.mjs +146 -0
- package/dist/components/ui/textarea.mjs.map +1 -0
- package/dist/components/ui/toast.d.mts +93 -0
- package/dist/components/ui/toast.d.ts +93 -0
- package/dist/components/ui/toast.js +429 -0
- package/dist/components/ui/toast.js.map +1 -0
- package/dist/components/ui/toast.mjs +393 -0
- package/dist/components/ui/toast.mjs.map +1 -0
- package/dist/components/ui/toggle-group.d.mts +47 -0
- package/dist/components/ui/toggle-group.d.ts +47 -0
- package/dist/components/ui/toggle-group.js +186 -0
- package/dist/components/ui/toggle-group.js.map +1 -0
- package/dist/components/ui/toggle-group.mjs +149 -0
- package/dist/components/ui/toggle-group.mjs.map +1 -0
- package/dist/components/ui/toggle.d.mts +19 -0
- package/dist/components/ui/toggle.d.ts +19 -0
- package/dist/components/ui/toggle.js +194 -0
- package/dist/components/ui/toggle.js.map +1 -0
- package/dist/components/ui/toggle.mjs +159 -0
- package/dist/components/ui/toggle.mjs.map +1 -0
- package/dist/components/ui/tooltip.d.mts +37 -0
- package/dist/components/ui/tooltip.d.ts +37 -0
- package/dist/components/ui/tooltip.js +137 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/components/ui/tooltip.mjs +96 -0
- package/dist/components/ui/tooltip.mjs.map +1 -0
- package/dist/lib/utils.d.mts +10 -0
- package/dist/lib/utils.d.ts +10 -0
- package/dist/lib/utils.js +33 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/utils.mjs +9 -0
- package/dist/lib/utils.mjs.map +1 -0
- package/package.json +11 -11
- package/dist/chart.js.map +0 -1
- package/dist/chart.mjs.map +0 -1
- package/dist/index.d.mts +0 -1636
- package/dist/index.d.ts +0 -1636
- package/dist/index.js +0 -7291
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -7048
- package/dist/index.mjs.map +0 -1
- /package/dist/{chart.d.mts → components/ui/chart.d.mts} +0 -0
- /package/dist/{chart.d.ts → components/ui/chart.d.ts} +0 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type NavigationMenuRadius = 'sm' | 'md' | 'lg' | 'xl';
|
|
4
|
+
declare const navigationMenuSizeMap: {
|
|
5
|
+
readonly sm: {
|
|
6
|
+
readonly trigger: "h-8 text-sm px-3 gap-2";
|
|
7
|
+
readonly link: "h-8 text-sm px-3 gap-2";
|
|
8
|
+
readonly icon: "icon-xs";
|
|
9
|
+
readonly collapsedSquare: "size-8";
|
|
10
|
+
readonly collapsedWidth: 56;
|
|
11
|
+
readonly dropdownLink: "px-3 py-1.5 text-sm gap-2";
|
|
12
|
+
readonly subLink: "h-8 text-sm pl-8 pr-3 gap-2";
|
|
13
|
+
readonly groupLabel: "text-2xs px-3 mb-1";
|
|
14
|
+
readonly groupMargin: "mt-4 first:mt-0";
|
|
15
|
+
};
|
|
16
|
+
readonly md: {
|
|
17
|
+
readonly trigger: "h-9 text-md px-3.5 gap-2";
|
|
18
|
+
readonly link: "h-9 text-md px-3.5 gap-2";
|
|
19
|
+
readonly icon: "icon-sm";
|
|
20
|
+
readonly collapsedSquare: "size-9";
|
|
21
|
+
readonly collapsedWidth: 60;
|
|
22
|
+
readonly dropdownLink: "px-3 py-1.5 text-md gap-2";
|
|
23
|
+
readonly subLink: "h-9 text-md pl-9 pr-3.5 gap-2";
|
|
24
|
+
readonly groupLabel: "text-xs px-3.5 mb-1";
|
|
25
|
+
readonly groupMargin: "mt-4 first:mt-0";
|
|
26
|
+
};
|
|
27
|
+
readonly default: {
|
|
28
|
+
readonly trigger: "h-10 text-md px-4 gap-2";
|
|
29
|
+
readonly link: "h-10 text-md px-4 gap-2";
|
|
30
|
+
readonly icon: "icon-sm";
|
|
31
|
+
readonly collapsedSquare: "size-10";
|
|
32
|
+
readonly collapsedWidth: 64;
|
|
33
|
+
readonly dropdownLink: "px-3 py-2 text-md gap-2";
|
|
34
|
+
readonly subLink: "h-10 text-md pl-10 pr-4 gap-2";
|
|
35
|
+
readonly groupLabel: "text-xs px-4 mb-1.5";
|
|
36
|
+
readonly groupMargin: "mt-5 first:mt-0";
|
|
37
|
+
};
|
|
38
|
+
readonly lg: {
|
|
39
|
+
readonly trigger: "h-12 text-base px-6 gap-2";
|
|
40
|
+
readonly link: "h-12 text-base px-6 gap-2";
|
|
41
|
+
readonly icon: "icon-sm";
|
|
42
|
+
readonly collapsedSquare: "size-12";
|
|
43
|
+
readonly collapsedWidth: 72;
|
|
44
|
+
readonly dropdownLink: "px-3 py-2.5 text-base gap-2";
|
|
45
|
+
readonly subLink: "h-12 text-base pl-12 pr-6 gap-2";
|
|
46
|
+
readonly groupLabel: "text-xs px-4 mb-2";
|
|
47
|
+
readonly groupMargin: "mt-6 first:mt-0";
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
interface NavigationMenuProps extends React.HTMLAttributes<HTMLElement> {
|
|
51
|
+
/** Layout orientation */
|
|
52
|
+
orientation?: 'horizontal' | 'vertical';
|
|
53
|
+
/** Size of the menu items */
|
|
54
|
+
size?: 'sm' | 'md' | 'default' | 'lg';
|
|
55
|
+
/** Vertical only: show icons only (collapsed sidebar) */
|
|
56
|
+
collapsed?: boolean;
|
|
57
|
+
/** Vertical only: sidebar width (default: 256px / 16rem) */
|
|
58
|
+
width?: number | string;
|
|
59
|
+
/** Vertical only: collapsed sidebar width (default: 64px / 4rem) */
|
|
60
|
+
collapsedWidth?: number | string;
|
|
61
|
+
/** Border radius for dropdown content and items */
|
|
62
|
+
radius?: NavigationMenuRadius;
|
|
63
|
+
/** Font weight for menu items (default: normal, active items always use semibold) */
|
|
64
|
+
fontWeight?: 'normal' | 'semibold';
|
|
65
|
+
/** Horizontal only: delay before hover opens in ms */
|
|
66
|
+
delayDuration?: number;
|
|
67
|
+
/** Horizontal only: skip delay when moving between triggers */
|
|
68
|
+
skipDelayDuration?: number;
|
|
69
|
+
/** Controlled active menu item value */
|
|
70
|
+
value?: string;
|
|
71
|
+
/** Default active menu item value (uncontrolled) */
|
|
72
|
+
defaultValue?: string;
|
|
73
|
+
/** Callback when active item changes */
|
|
74
|
+
onValueChange?: (value: string) => void;
|
|
75
|
+
}
|
|
76
|
+
interface NavigationMenuListProps extends React.HTMLAttributes<HTMLUListElement> {
|
|
77
|
+
}
|
|
78
|
+
declare const NavigationMenuList: React.ForwardRefExoticComponent<NavigationMenuListProps & React.RefAttributes<HTMLUListElement>>;
|
|
79
|
+
interface NavigationMenuItemProps extends React.HTMLAttributes<HTMLLIElement> {
|
|
80
|
+
/** Value identifier for Radix (horizontal mode) */
|
|
81
|
+
value?: string;
|
|
82
|
+
/** Vertical only: default open state for sub-menu */
|
|
83
|
+
defaultOpen?: boolean;
|
|
84
|
+
}
|
|
85
|
+
declare const NavigationMenuItem: React.ForwardRefExoticComponent<NavigationMenuItemProps & React.RefAttributes<HTMLLIElement>>;
|
|
86
|
+
interface NavigationMenuTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
87
|
+
/** Icon displayed before the label */
|
|
88
|
+
icon?: React.ReactNode;
|
|
89
|
+
/** Custom chevron icon (default: built-in ChevronDown for horizontal, ChevronRight for vertical) */
|
|
90
|
+
chevronIcon?: React.ReactNode;
|
|
91
|
+
}
|
|
92
|
+
declare const NavigationMenuTrigger: React.ForwardRefExoticComponent<NavigationMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
93
|
+
interface NavigationMenuContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
94
|
+
}
|
|
95
|
+
declare const NavigationMenuContent: React.ForwardRefExoticComponent<NavigationMenuContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
96
|
+
interface NavigationMenuLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
97
|
+
/** Whether the link represents the current page */
|
|
98
|
+
active?: boolean;
|
|
99
|
+
/** Compose with custom link component (Radix Slot) */
|
|
100
|
+
asChild?: boolean;
|
|
101
|
+
/** Icon displayed before the label */
|
|
102
|
+
icon?: React.ReactNode;
|
|
103
|
+
}
|
|
104
|
+
declare const NavigationMenuLink: React.ForwardRefExoticComponent<NavigationMenuLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
105
|
+
interface NavigationMenuGroupProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
106
|
+
/** Group header label */
|
|
107
|
+
label?: string;
|
|
108
|
+
}
|
|
109
|
+
declare const NavigationMenuGroup: React.ForwardRefExoticComponent<NavigationMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
110
|
+
interface NavigationMenuIndicatorProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
111
|
+
/** Active indicator dot color (default: dark/foreground, primary: brand color) */
|
|
112
|
+
color?: 'default' | 'primary';
|
|
113
|
+
}
|
|
114
|
+
declare const NavigationMenuIndicator: React.ForwardRefExoticComponent<NavigationMenuIndicatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
115
|
+
interface NavigationMenuViewportProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
116
|
+
}
|
|
117
|
+
declare const NavigationMenuViewport: React.ForwardRefExoticComponent<NavigationMenuViewportProps & React.RefAttributes<HTMLDivElement>>;
|
|
118
|
+
declare const NavigationMenu: React.ForwardRefExoticComponent<NavigationMenuProps & React.RefAttributes<HTMLElement>> & {
|
|
119
|
+
List: React.ForwardRefExoticComponent<NavigationMenuListProps & React.RefAttributes<HTMLUListElement>>;
|
|
120
|
+
Item: React.ForwardRefExoticComponent<NavigationMenuItemProps & React.RefAttributes<HTMLLIElement>>;
|
|
121
|
+
Trigger: React.ForwardRefExoticComponent<NavigationMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
122
|
+
Content: React.ForwardRefExoticComponent<NavigationMenuContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
123
|
+
Link: React.ForwardRefExoticComponent<NavigationMenuLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
124
|
+
Group: React.ForwardRefExoticComponent<NavigationMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
125
|
+
Indicator: React.ForwardRefExoticComponent<NavigationMenuIndicatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
126
|
+
Viewport: React.ForwardRefExoticComponent<NavigationMenuViewportProps & React.RefAttributes<HTMLDivElement>>;
|
|
127
|
+
};
|
|
128
|
+
declare namespace NavigationMenu {
|
|
129
|
+
type ListProps = NavigationMenuListProps;
|
|
130
|
+
type ItemProps = NavigationMenuItemProps;
|
|
131
|
+
type TriggerProps = NavigationMenuTriggerProps;
|
|
132
|
+
type ContentProps = NavigationMenuContentProps;
|
|
133
|
+
type LinkProps = NavigationMenuLinkProps;
|
|
134
|
+
type GroupProps = NavigationMenuGroupProps;
|
|
135
|
+
type IndicatorProps = NavigationMenuIndicatorProps;
|
|
136
|
+
type ViewportProps = NavigationMenuViewportProps;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export { NavigationMenu, NavigationMenuContent, type NavigationMenuContentProps, NavigationMenuGroup, type NavigationMenuGroupProps, NavigationMenuIndicator, type NavigationMenuIndicatorProps, NavigationMenuItem, type NavigationMenuItemProps, NavigationMenuLink, type NavigationMenuLinkProps, NavigationMenuList, type NavigationMenuListProps, type NavigationMenuProps, type NavigationMenuRadius, NavigationMenuTrigger, type NavigationMenuTriggerProps, NavigationMenuViewport, type NavigationMenuViewportProps, navigationMenuSizeMap };
|
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var navigation_menu_exports = {};
|
|
31
|
+
__export(navigation_menu_exports, {
|
|
32
|
+
NavigationMenu: () => NavigationMenu,
|
|
33
|
+
NavigationMenuContent: () => NavigationMenuContent,
|
|
34
|
+
NavigationMenuGroup: () => NavigationMenuGroup,
|
|
35
|
+
NavigationMenuIndicator: () => NavigationMenuIndicator,
|
|
36
|
+
NavigationMenuItem: () => NavigationMenuItem,
|
|
37
|
+
NavigationMenuLink: () => NavigationMenuLink,
|
|
38
|
+
NavigationMenuList: () => NavigationMenuList,
|
|
39
|
+
NavigationMenuTrigger: () => NavigationMenuTrigger,
|
|
40
|
+
NavigationMenuViewport: () => NavigationMenuViewport,
|
|
41
|
+
navigationMenuSizeMap: () => navigationMenuSizeMap
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(navigation_menu_exports);
|
|
44
|
+
var React = __toESM(require("react"));
|
|
45
|
+
var NavigationMenuPrimitive = __toESM(require("@radix-ui/react-navigation-menu"));
|
|
46
|
+
var CollapsiblePrimitive = __toESM(require("@radix-ui/react-collapsible"));
|
|
47
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
48
|
+
var import_utils = require("../../lib/utils");
|
|
49
|
+
function ChevronDownIcon({ className }) {
|
|
50
|
+
return /* @__PURE__ */ React.createElement("svg", { className, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, "aria-hidden": "true" }, /* @__PURE__ */ React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }));
|
|
51
|
+
}
|
|
52
|
+
function ChevronRightIcon({ className }) {
|
|
53
|
+
return /* @__PURE__ */ React.createElement("svg", { className, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, "aria-hidden": "true" }, /* @__PURE__ */ React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 5l7 7-7 7" }));
|
|
54
|
+
}
|
|
55
|
+
const contentRadiusMap = {
|
|
56
|
+
sm: "rounded",
|
|
57
|
+
// 4px
|
|
58
|
+
md: "rounded-md",
|
|
59
|
+
// 6px
|
|
60
|
+
lg: "rounded-lg",
|
|
61
|
+
// 8px
|
|
62
|
+
xl: "rounded-xl"
|
|
63
|
+
// 12px
|
|
64
|
+
};
|
|
65
|
+
const itemRadiusMap = {
|
|
66
|
+
sm: "rounded-sm",
|
|
67
|
+
// 2px
|
|
68
|
+
md: "rounded",
|
|
69
|
+
// 4px
|
|
70
|
+
lg: "rounded-md",
|
|
71
|
+
// 6px
|
|
72
|
+
xl: "rounded-lg"
|
|
73
|
+
// 8px
|
|
74
|
+
};
|
|
75
|
+
const NavigationMenuContext = React.createContext({
|
|
76
|
+
orientation: "horizontal",
|
|
77
|
+
size: "default",
|
|
78
|
+
collapsed: false,
|
|
79
|
+
radius: "lg",
|
|
80
|
+
fontWeight: "normal"
|
|
81
|
+
});
|
|
82
|
+
const useNavigationMenuContext = () => React.useContext(NavigationMenuContext);
|
|
83
|
+
const ContentLevelContext = React.createContext(false);
|
|
84
|
+
const navigationMenuSizeMap = {
|
|
85
|
+
sm: {
|
|
86
|
+
trigger: "h-8 text-sm px-3 gap-2",
|
|
87
|
+
link: "h-8 text-sm px-3 gap-2",
|
|
88
|
+
icon: "icon-xs",
|
|
89
|
+
collapsedSquare: "size-8",
|
|
90
|
+
collapsedWidth: 56,
|
|
91
|
+
dropdownLink: "px-3 py-1.5 text-sm gap-2",
|
|
92
|
+
subLink: "h-8 text-sm pl-8 pr-3 gap-2",
|
|
93
|
+
groupLabel: "text-2xs px-3 mb-1",
|
|
94
|
+
groupMargin: "mt-4 first:mt-0"
|
|
95
|
+
},
|
|
96
|
+
md: {
|
|
97
|
+
trigger: "h-9 text-md px-3.5 gap-2",
|
|
98
|
+
link: "h-9 text-md px-3.5 gap-2",
|
|
99
|
+
icon: "icon-sm",
|
|
100
|
+
collapsedSquare: "size-9",
|
|
101
|
+
collapsedWidth: 60,
|
|
102
|
+
dropdownLink: "px-3 py-1.5 text-md gap-2",
|
|
103
|
+
subLink: "h-9 text-md pl-9 pr-3.5 gap-2",
|
|
104
|
+
groupLabel: "text-xs px-3.5 mb-1",
|
|
105
|
+
groupMargin: "mt-4 first:mt-0"
|
|
106
|
+
},
|
|
107
|
+
default: {
|
|
108
|
+
trigger: "h-10 text-md px-4 gap-2",
|
|
109
|
+
link: "h-10 text-md px-4 gap-2",
|
|
110
|
+
icon: "icon-sm",
|
|
111
|
+
collapsedSquare: "size-10",
|
|
112
|
+
collapsedWidth: 64,
|
|
113
|
+
dropdownLink: "px-3 py-2 text-md gap-2",
|
|
114
|
+
subLink: "h-10 text-md pl-10 pr-4 gap-2",
|
|
115
|
+
groupLabel: "text-xs px-4 mb-1.5",
|
|
116
|
+
groupMargin: "mt-5 first:mt-0"
|
|
117
|
+
},
|
|
118
|
+
lg: {
|
|
119
|
+
trigger: "h-12 text-base px-6 gap-2",
|
|
120
|
+
link: "h-12 text-base px-6 gap-2",
|
|
121
|
+
icon: "icon-sm",
|
|
122
|
+
collapsedSquare: "size-12",
|
|
123
|
+
collapsedWidth: 72,
|
|
124
|
+
dropdownLink: "px-3 py-2.5 text-base gap-2",
|
|
125
|
+
subLink: "h-12 text-base pl-12 pr-6 gap-2",
|
|
126
|
+
groupLabel: "text-xs px-4 mb-2",
|
|
127
|
+
groupMargin: "mt-6 first:mt-0"
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
const NavigationMenuRoot = React.forwardRef(
|
|
131
|
+
({
|
|
132
|
+
className,
|
|
133
|
+
orientation = "horizontal",
|
|
134
|
+
size = "default",
|
|
135
|
+
collapsed = false,
|
|
136
|
+
width,
|
|
137
|
+
collapsedWidth,
|
|
138
|
+
radius = "lg",
|
|
139
|
+
fontWeight = "normal",
|
|
140
|
+
delayDuration = 200,
|
|
141
|
+
skipDelayDuration = 300,
|
|
142
|
+
value,
|
|
143
|
+
defaultValue,
|
|
144
|
+
onValueChange,
|
|
145
|
+
children,
|
|
146
|
+
style,
|
|
147
|
+
...props
|
|
148
|
+
}, ref) => {
|
|
149
|
+
const contextValue = React.useMemo(
|
|
150
|
+
() => ({ orientation, size, collapsed: orientation === "vertical" ? collapsed : false, radius, fontWeight }),
|
|
151
|
+
[orientation, size, collapsed, radius, fontWeight]
|
|
152
|
+
);
|
|
153
|
+
if (orientation === "horizontal") {
|
|
154
|
+
return /* @__PURE__ */ React.createElement(NavigationMenuContext.Provider, { value: contextValue }, /* @__PURE__ */ React.createElement(
|
|
155
|
+
NavigationMenuPrimitive.Root,
|
|
156
|
+
{
|
|
157
|
+
ref,
|
|
158
|
+
className: (0, import_utils.cn)("relative", className),
|
|
159
|
+
delayDuration,
|
|
160
|
+
skipDelayDuration,
|
|
161
|
+
value,
|
|
162
|
+
defaultValue: defaultValue ?? "",
|
|
163
|
+
onValueChange
|
|
164
|
+
},
|
|
165
|
+
children
|
|
166
|
+
));
|
|
167
|
+
}
|
|
168
|
+
const resolvedWidth = collapsed ? collapsedWidth ?? navigationMenuSizeMap[size].collapsedWidth : width ?? 256;
|
|
169
|
+
const widthValue = typeof resolvedWidth === "number" ? `${resolvedWidth}px` : resolvedWidth;
|
|
170
|
+
return /* @__PURE__ */ React.createElement(NavigationMenuContext.Provider, { value: contextValue }, /* @__PURE__ */ React.createElement(
|
|
171
|
+
"nav",
|
|
172
|
+
{
|
|
173
|
+
ref,
|
|
174
|
+
"aria-label": "navigation",
|
|
175
|
+
className: (0, import_utils.cn)(
|
|
176
|
+
"flex flex-col",
|
|
177
|
+
"transition-[width] duration-normal ease-out",
|
|
178
|
+
className
|
|
179
|
+
),
|
|
180
|
+
style: { width: widthValue, ...style },
|
|
181
|
+
...props
|
|
182
|
+
},
|
|
183
|
+
children
|
|
184
|
+
));
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
NavigationMenuRoot.displayName = "NavigationMenu";
|
|
188
|
+
const NavigationMenuList = React.forwardRef(
|
|
189
|
+
({ className, children, ...props }, ref) => {
|
|
190
|
+
const { orientation } = useNavigationMenuContext();
|
|
191
|
+
if (orientation === "horizontal") {
|
|
192
|
+
return /* @__PURE__ */ React.createElement(
|
|
193
|
+
NavigationMenuPrimitive.List,
|
|
194
|
+
{
|
|
195
|
+
ref,
|
|
196
|
+
className: (0, import_utils.cn)("flex items-center gap-1", className),
|
|
197
|
+
...props
|
|
198
|
+
},
|
|
199
|
+
children
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
return /* @__PURE__ */ React.createElement(
|
|
203
|
+
"ul",
|
|
204
|
+
{
|
|
205
|
+
ref,
|
|
206
|
+
className: (0, import_utils.cn)("flex flex-col gap-0.5", className),
|
|
207
|
+
...props
|
|
208
|
+
},
|
|
209
|
+
children
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
);
|
|
213
|
+
NavigationMenuList.displayName = "NavigationMenuList";
|
|
214
|
+
const NavigationMenuItem = React.forwardRef(
|
|
215
|
+
({ className, value, defaultOpen = false, children, ...props }, ref) => {
|
|
216
|
+
const { orientation, collapsed } = useNavigationMenuContext();
|
|
217
|
+
const [open, setOpen] = React.useState(defaultOpen);
|
|
218
|
+
React.useEffect(() => {
|
|
219
|
+
if (collapsed) setOpen(false);
|
|
220
|
+
}, [collapsed]);
|
|
221
|
+
if (orientation === "horizontal") {
|
|
222
|
+
return /* @__PURE__ */ React.createElement(
|
|
223
|
+
NavigationMenuPrimitive.Item,
|
|
224
|
+
{
|
|
225
|
+
ref,
|
|
226
|
+
className: (0, import_utils.cn)("relative", className),
|
|
227
|
+
value,
|
|
228
|
+
...props
|
|
229
|
+
},
|
|
230
|
+
children
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
return /* @__PURE__ */ React.createElement(
|
|
234
|
+
CollapsiblePrimitive.Root,
|
|
235
|
+
{
|
|
236
|
+
open: collapsed ? false : open,
|
|
237
|
+
onOpenChange: collapsed ? void 0 : setOpen,
|
|
238
|
+
asChild: true
|
|
239
|
+
},
|
|
240
|
+
/* @__PURE__ */ React.createElement("li", { ref, className: (0, import_utils.cn)("", className), ...props }, children)
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
);
|
|
244
|
+
NavigationMenuItem.displayName = "NavigationMenuItem";
|
|
245
|
+
const NavigationMenuTrigger = React.forwardRef(
|
|
246
|
+
({ className, children, icon, chevronIcon, ...props }, ref) => {
|
|
247
|
+
const { orientation, size, collapsed, radius, fontWeight: fw } = useNavigationMenuContext();
|
|
248
|
+
const s = navigationMenuSizeMap[size];
|
|
249
|
+
const fwClass = fw === "semibold" ? "font-semibold" : "font-normal";
|
|
250
|
+
if (orientation === "horizontal") {
|
|
251
|
+
return /* @__PURE__ */ React.createElement(
|
|
252
|
+
NavigationMenuPrimitive.Trigger,
|
|
253
|
+
{
|
|
254
|
+
ref,
|
|
255
|
+
className: (0, import_utils.cn)(
|
|
256
|
+
"group inline-flex items-center justify-center",
|
|
257
|
+
s.trigger,
|
|
258
|
+
"gap-0",
|
|
259
|
+
fwClass,
|
|
260
|
+
"text-text-muted",
|
|
261
|
+
"transition-colors duration-fast",
|
|
262
|
+
"hover:text-foreground",
|
|
263
|
+
"data-[state=open]:text-foreground",
|
|
264
|
+
"focus-visible:focus-ring",
|
|
265
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
266
|
+
className
|
|
267
|
+
),
|
|
268
|
+
...props
|
|
269
|
+
},
|
|
270
|
+
icon && /* @__PURE__ */ React.createElement("span", { className: (0, import_utils.cn)("shrink-0 mr-2", s.icon) }, icon),
|
|
271
|
+
children,
|
|
272
|
+
/* @__PURE__ */ React.createElement("span", { className: (0, import_utils.cn)("shrink-0 ml-1 text-text-subtle transition-transform duration-fast group-data-[state=open]:rotate-180", s.icon) }, chevronIcon ?? /* @__PURE__ */ React.createElement(ChevronDownIcon, { className: "size-full" }))
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
return /* @__PURE__ */ React.createElement(
|
|
276
|
+
CollapsiblePrimitive.Trigger,
|
|
277
|
+
{
|
|
278
|
+
ref,
|
|
279
|
+
className: (0, import_utils.cn)(
|
|
280
|
+
"group flex items-center cursor-pointer",
|
|
281
|
+
contentRadiusMap[radius],
|
|
282
|
+
collapsed ? [s.collapsedSquare, "justify-center mx-auto"] : ["w-full", s.trigger],
|
|
283
|
+
fwClass,
|
|
284
|
+
"text-text-muted transition-colors duration-fast",
|
|
285
|
+
"hover:text-foreground hover:bg-background-muted",
|
|
286
|
+
!collapsed && "data-[state=open]:text-foreground",
|
|
287
|
+
"focus-visible:focus-ring",
|
|
288
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
289
|
+
className
|
|
290
|
+
),
|
|
291
|
+
...collapsed && typeof children === "string" ? { title: children } : {},
|
|
292
|
+
...props
|
|
293
|
+
},
|
|
294
|
+
icon && /* @__PURE__ */ React.createElement("span", { className: (0, import_utils.cn)("shrink-0", s.icon) }, icon),
|
|
295
|
+
!collapsed && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", { className: "flex-1 text-left truncate" }, children), /* @__PURE__ */ React.createElement(
|
|
296
|
+
"span",
|
|
297
|
+
{
|
|
298
|
+
className: (0, import_utils.cn)(
|
|
299
|
+
"shrink-0 text-text-subtle transition-transform duration-normal",
|
|
300
|
+
s.icon,
|
|
301
|
+
"group-data-[state=open]:rotate-90"
|
|
302
|
+
)
|
|
303
|
+
},
|
|
304
|
+
chevronIcon ?? /* @__PURE__ */ React.createElement(ChevronRightIcon, { className: "size-full" })
|
|
305
|
+
))
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
);
|
|
309
|
+
NavigationMenuTrigger.displayName = "NavigationMenuTrigger";
|
|
310
|
+
const NavigationMenuContent = React.forwardRef(
|
|
311
|
+
({ className, children, ...props }, ref) => {
|
|
312
|
+
const { orientation, size, collapsed, radius } = useNavigationMenuContext();
|
|
313
|
+
const s = navigationMenuSizeMap[size];
|
|
314
|
+
if (orientation === "horizontal") {
|
|
315
|
+
return /* @__PURE__ */ React.createElement(ContentLevelContext.Provider, { value: true }, /* @__PURE__ */ React.createElement(
|
|
316
|
+
NavigationMenuPrimitive.Content,
|
|
317
|
+
{
|
|
318
|
+
ref,
|
|
319
|
+
className: (0, import_utils.cn)(
|
|
320
|
+
"absolute left-0 top-full z-dropdown pt-1",
|
|
321
|
+
"data-[state=open]:animate-fade-in data-[state=closed]:animate-fade-out",
|
|
322
|
+
className
|
|
323
|
+
),
|
|
324
|
+
...props
|
|
325
|
+
},
|
|
326
|
+
/* @__PURE__ */ React.createElement("div", { className: (0, import_utils.cn)("min-w-[180px] border border-border bg-background shadow-lg p-1.5 grid gap-0.5", contentRadiusMap[radius]) }, children)
|
|
327
|
+
));
|
|
328
|
+
}
|
|
329
|
+
if (collapsed) return null;
|
|
330
|
+
return /* @__PURE__ */ React.createElement(ContentLevelContext.Provider, { value: true }, /* @__PURE__ */ React.createElement(
|
|
331
|
+
CollapsiblePrimitive.Content,
|
|
332
|
+
{
|
|
333
|
+
ref,
|
|
334
|
+
className: (0, import_utils.cn)(
|
|
335
|
+
"overflow-hidden",
|
|
336
|
+
"data-[state=open]:animate-collapsible-down data-[state=closed]:animate-collapsible-up"
|
|
337
|
+
),
|
|
338
|
+
...props
|
|
339
|
+
},
|
|
340
|
+
/* @__PURE__ */ React.createElement("div", { className: (0, import_utils.cn)(
|
|
341
|
+
"flex flex-col gap-0.5 py-1",
|
|
342
|
+
className
|
|
343
|
+
) }, children)
|
|
344
|
+
));
|
|
345
|
+
}
|
|
346
|
+
);
|
|
347
|
+
NavigationMenuContent.displayName = "NavigationMenuContent";
|
|
348
|
+
const NavigationMenuLink = React.forwardRef(
|
|
349
|
+
({ className, active, asChild, icon, children, ...props }, ref) => {
|
|
350
|
+
const { orientation, size, collapsed, radius, fontWeight: fw } = useNavigationMenuContext();
|
|
351
|
+
const s = navigationMenuSizeMap[size];
|
|
352
|
+
const fwClass = fw === "semibold" ? "font-semibold" : "font-normal";
|
|
353
|
+
const inContent = React.useContext(ContentLevelContext);
|
|
354
|
+
if (orientation === "horizontal") {
|
|
355
|
+
const { onSelect, ...radixSafeProps } = props;
|
|
356
|
+
if (inContent) {
|
|
357
|
+
return /* @__PURE__ */ React.createElement(
|
|
358
|
+
NavigationMenuPrimitive.Link,
|
|
359
|
+
{
|
|
360
|
+
ref,
|
|
361
|
+
className: (0, import_utils.cn)(
|
|
362
|
+
"flex items-center w-full",
|
|
363
|
+
s.dropdownLink,
|
|
364
|
+
itemRadiusMap[radius],
|
|
365
|
+
"text-text-muted transition-colors duration-fast",
|
|
366
|
+
"hover:text-foreground hover:bg-background-muted",
|
|
367
|
+
active && "text-foreground bg-background-muted font-semibold",
|
|
368
|
+
"focus-visible:focus-ring",
|
|
369
|
+
className
|
|
370
|
+
),
|
|
371
|
+
active,
|
|
372
|
+
asChild,
|
|
373
|
+
onSelect,
|
|
374
|
+
...radixSafeProps
|
|
375
|
+
},
|
|
376
|
+
asChild ? children : /* @__PURE__ */ React.createElement(React.Fragment, null, icon && /* @__PURE__ */ React.createElement("span", { className: (0, import_utils.cn)("shrink-0", s.icon) }, icon), children)
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
return /* @__PURE__ */ React.createElement(
|
|
380
|
+
NavigationMenuPrimitive.Link,
|
|
381
|
+
{
|
|
382
|
+
ref,
|
|
383
|
+
className: (0, import_utils.cn)(
|
|
384
|
+
"inline-flex items-center justify-center",
|
|
385
|
+
s.link,
|
|
386
|
+
fwClass,
|
|
387
|
+
"text-text-muted",
|
|
388
|
+
"transition-colors duration-fast",
|
|
389
|
+
"hover:text-foreground",
|
|
390
|
+
active && "text-foreground font-semibold",
|
|
391
|
+
"focus-visible:focus-ring",
|
|
392
|
+
className
|
|
393
|
+
),
|
|
394
|
+
active,
|
|
395
|
+
asChild,
|
|
396
|
+
onSelect,
|
|
397
|
+
...radixSafeProps
|
|
398
|
+
},
|
|
399
|
+
asChild ? children : /* @__PURE__ */ React.createElement(React.Fragment, null, icon && /* @__PURE__ */ React.createElement("span", { className: (0, import_utils.cn)("shrink-0", s.icon) }, icon), children)
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
const Comp = asChild ? import_react_slot.Slot : "a";
|
|
403
|
+
if (inContent) {
|
|
404
|
+
return /* @__PURE__ */ React.createElement(
|
|
405
|
+
Comp,
|
|
406
|
+
{
|
|
407
|
+
ref,
|
|
408
|
+
className: (0, import_utils.cn)(
|
|
409
|
+
"flex items-center w-full cursor-pointer",
|
|
410
|
+
contentRadiusMap[radius],
|
|
411
|
+
s.subLink,
|
|
412
|
+
"text-text-muted transition-colors duration-fast",
|
|
413
|
+
"hover:text-foreground hover:bg-background-muted",
|
|
414
|
+
active && "text-foreground bg-background-muted font-semibold",
|
|
415
|
+
"focus-visible:focus-ring",
|
|
416
|
+
className
|
|
417
|
+
),
|
|
418
|
+
...active ? { "aria-current": "page" } : {},
|
|
419
|
+
...props
|
|
420
|
+
},
|
|
421
|
+
icon && /* @__PURE__ */ React.createElement("span", { className: (0, import_utils.cn)("shrink-0", s.icon) }, icon),
|
|
422
|
+
!collapsed && children
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
return /* @__PURE__ */ React.createElement(
|
|
426
|
+
Comp,
|
|
427
|
+
{
|
|
428
|
+
ref,
|
|
429
|
+
className: (0, import_utils.cn)(
|
|
430
|
+
"relative flex items-center cursor-pointer",
|
|
431
|
+
contentRadiusMap[radius],
|
|
432
|
+
collapsed ? [s.collapsedSquare, "justify-center mx-auto"] : ["w-full", s.link],
|
|
433
|
+
"text-text-muted transition-colors duration-fast",
|
|
434
|
+
"hover:text-foreground hover:bg-background-muted",
|
|
435
|
+
active && "text-foreground bg-background-muted font-semibold",
|
|
436
|
+
"focus-visible:focus-ring",
|
|
437
|
+
className
|
|
438
|
+
),
|
|
439
|
+
...active ? { "aria-current": "page" } : {},
|
|
440
|
+
...collapsed && typeof children === "string" ? { title: children } : {},
|
|
441
|
+
...props
|
|
442
|
+
},
|
|
443
|
+
icon && /* @__PURE__ */ React.createElement("span", { className: (0, import_utils.cn)("shrink-0", s.icon) }, icon),
|
|
444
|
+
!collapsed && /* @__PURE__ */ React.createElement("span", { className: "truncate" }, children)
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
);
|
|
448
|
+
NavigationMenuLink.displayName = "NavigationMenuLink";
|
|
449
|
+
const NavigationMenuGroup = React.forwardRef(
|
|
450
|
+
({ className, label, children, ...props }, ref) => {
|
|
451
|
+
const { size, collapsed } = useNavigationMenuContext();
|
|
452
|
+
const s = navigationMenuSizeMap[size];
|
|
453
|
+
return /* @__PURE__ */ React.createElement("div", { ref, role: "group", className: (0, import_utils.cn)(label && !collapsed && s.groupMargin, className), ...props }, label && !collapsed && /* @__PURE__ */ React.createElement("div", { className: (0, import_utils.cn)(
|
|
454
|
+
"font-semibold text-text-subtle uppercase tracking-wider select-none",
|
|
455
|
+
s.groupLabel
|
|
456
|
+
) }, label), /* @__PURE__ */ React.createElement("ul", { className: "flex flex-col gap-0.5" }, children));
|
|
457
|
+
}
|
|
458
|
+
);
|
|
459
|
+
NavigationMenuGroup.displayName = "NavigationMenuGroup";
|
|
460
|
+
const NavigationMenuIndicator = React.forwardRef(
|
|
461
|
+
({ className, color = "default", ...props }, ref) => {
|
|
462
|
+
const { orientation } = useNavigationMenuContext();
|
|
463
|
+
if (orientation === "vertical") return null;
|
|
464
|
+
return /* @__PURE__ */ React.createElement(
|
|
465
|
+
NavigationMenuPrimitive.Indicator,
|
|
466
|
+
{
|
|
467
|
+
ref,
|
|
468
|
+
className: (0, import_utils.cn)(
|
|
469
|
+
"z-10 flex h-[3px] items-end justify-center overflow-hidden",
|
|
470
|
+
"transition-[width,transform] duration-normal ease-out",
|
|
471
|
+
"data-[state=visible]:animate-fade-in data-[state=hidden]:animate-fade-out",
|
|
472
|
+
className
|
|
473
|
+
),
|
|
474
|
+
...props
|
|
475
|
+
},
|
|
476
|
+
/* @__PURE__ */ React.createElement("div", { className: (0, import_utils.cn)(
|
|
477
|
+
"relative h-full w-full rounded-full",
|
|
478
|
+
color === "default" ? "bg-foreground" : "bg-primary"
|
|
479
|
+
) })
|
|
480
|
+
);
|
|
481
|
+
}
|
|
482
|
+
);
|
|
483
|
+
NavigationMenuIndicator.displayName = "NavigationMenuIndicator";
|
|
484
|
+
const NavigationMenuViewport = React.forwardRef(
|
|
485
|
+
({ className, ...props }, ref) => {
|
|
486
|
+
const { orientation } = useNavigationMenuContext();
|
|
487
|
+
if (orientation === "vertical") return null;
|
|
488
|
+
return /* @__PURE__ */ React.createElement("div", { className: "absolute left-0 top-full z-dropdown w-auto pt-1" }, /* @__PURE__ */ React.createElement(
|
|
489
|
+
NavigationMenuPrimitive.Viewport,
|
|
490
|
+
{
|
|
491
|
+
ref,
|
|
492
|
+
className: (0, import_utils.cn)(
|
|
493
|
+
"relative overflow-hidden",
|
|
494
|
+
"border border-border bg-background rounded-xl shadow-lg",
|
|
495
|
+
"h-[var(--radix-navigation-menu-viewport-height)]",
|
|
496
|
+
"w-[var(--radix-navigation-menu-viewport-width)]",
|
|
497
|
+
"transition-[width,height] duration-fast ease-out",
|
|
498
|
+
"data-[state=open]:animate-nav-viewport-enter",
|
|
499
|
+
"data-[state=closed]:animate-nav-viewport-exit",
|
|
500
|
+
className
|
|
501
|
+
),
|
|
502
|
+
...props
|
|
503
|
+
}
|
|
504
|
+
));
|
|
505
|
+
}
|
|
506
|
+
);
|
|
507
|
+
NavigationMenuViewport.displayName = "NavigationMenuViewport";
|
|
508
|
+
const NavigationMenu = Object.assign(NavigationMenuRoot, {
|
|
509
|
+
List: NavigationMenuList,
|
|
510
|
+
Item: NavigationMenuItem,
|
|
511
|
+
Trigger: NavigationMenuTrigger,
|
|
512
|
+
Content: NavigationMenuContent,
|
|
513
|
+
Link: NavigationMenuLink,
|
|
514
|
+
Group: NavigationMenuGroup,
|
|
515
|
+
Indicator: NavigationMenuIndicator,
|
|
516
|
+
Viewport: NavigationMenuViewport
|
|
517
|
+
});
|
|
518
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
519
|
+
0 && (module.exports = {
|
|
520
|
+
NavigationMenu,
|
|
521
|
+
NavigationMenuContent,
|
|
522
|
+
NavigationMenuGroup,
|
|
523
|
+
NavigationMenuIndicator,
|
|
524
|
+
NavigationMenuItem,
|
|
525
|
+
NavigationMenuLink,
|
|
526
|
+
NavigationMenuList,
|
|
527
|
+
NavigationMenuTrigger,
|
|
528
|
+
NavigationMenuViewport,
|
|
529
|
+
navigationMenuSizeMap
|
|
530
|
+
});
|
|
531
|
+
//# sourceMappingURL=navigation-menu.js.map
|