@raydenui/ui 0.9.7 → 0.10.0
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/Table-DCNSxua1.d.cts +31 -0
- package/dist/Table-DCNSxua1.d.ts +31 -0
- package/dist/blocks/ApplicationShellBlock.cjs +157 -0
- package/dist/blocks/ApplicationShellBlock.js +154 -0
- package/dist/blocks/CheckoutReviewBlock.cjs +16 -0
- package/dist/blocks/CheckoutReviewBlock.js +13 -0
- package/dist/blocks/CommandPaletteBlock.cjs +334 -0
- package/dist/blocks/CommandPaletteBlock.js +331 -0
- package/dist/blocks/CreateAccountBlock.cjs +147 -0
- package/dist/blocks/CreateAccountBlock.js +143 -0
- package/dist/blocks/EmptyStateBlock.cjs +19 -0
- package/dist/blocks/EmptyStateBlock.js +16 -0
- package/dist/blocks/FeatureOverviewBlock.cjs +54 -0
- package/dist/blocks/FeatureOverviewBlock.js +51 -0
- package/dist/blocks/HeaderBlock.cjs +230 -0
- package/dist/blocks/HeaderBlock.js +227 -0
- package/dist/blocks/KpiOverviewBlock.cjs +63 -0
- package/dist/blocks/KpiOverviewBlock.js +60 -0
- package/dist/blocks/LoginBlock.cjs +66 -0
- package/dist/blocks/LoginBlock.js +63 -0
- package/dist/blocks/NotificationsBlock.cjs +17 -0
- package/dist/blocks/NotificationsBlock.js +14 -0
- package/dist/blocks/PageHeaderBlock.cjs +121 -0
- package/dist/blocks/PageHeaderBlock.js +118 -0
- package/dist/blocks/PricingPlansBlock.cjs +146 -0
- package/dist/blocks/PricingPlansBlock.js +143 -0
- package/dist/blocks/ProductCollectionBlock.cjs +37 -0
- package/dist/blocks/ProductCollectionBlock.js +34 -0
- package/dist/blocks/ProductDetailBlock.cjs +30 -0
- package/dist/blocks/ProductDetailBlock.js +27 -0
- package/dist/blocks/ProductHeroBlock.cjs +83 -0
- package/dist/blocks/ProductHeroBlock.js +80 -0
- package/dist/blocks/ProfileSettingsBlock.cjs +130 -0
- package/dist/blocks/ProfileSettingsBlock.js +126 -0
- package/dist/blocks/QuickSendBlock.cjs +11 -0
- package/dist/blocks/QuickSendBlock.js +8 -0
- package/dist/blocks/RecentTransactionsBlock.cjs +13 -0
- package/dist/blocks/RecentTransactionsBlock.js +10 -0
- package/dist/blocks/SearchableTableBlock.cjs +91 -0
- package/dist/blocks/SearchableTableBlock.js +88 -0
- package/dist/blocks/ShoppingCartBlock.cjs +16 -0
- package/dist/blocks/ShoppingCartBlock.js +13 -0
- package/dist/blocks/SiteFooterBlock.cjs +69 -0
- package/dist/blocks/SiteFooterBlock.js +66 -0
- package/dist/blocks/TableBlock.cjs +20 -0
- package/dist/blocks/TableBlock.js +17 -0
- package/dist/blocks/TaskListBlock.cjs +198 -0
- package/dist/blocks/TaskListBlock.js +195 -0
- package/dist/blocks/WorkspaceSwitcherBlock.cjs +291 -0
- package/dist/blocks/WorkspaceSwitcherBlock.js +288 -0
- package/dist/blocks/commerce.cjs +44 -0
- package/dist/blocks/commerce.js +35 -0
- package/dist/blocks/index.cjs +53 -0
- package/dist/blocks/index.js +24 -0
- package/dist/blocks.d.cts +1820 -0
- package/dist/blocks.d.ts +1820 -0
- package/dist/chart.cjs +13 -0
- package/dist/chart.d.cts +59 -0
- package/dist/chart.d.ts +59 -0
- package/dist/chart.js +5 -0
- package/dist/components/Accordion/Accordion.cjs +94 -0
- package/dist/components/Accordion/Accordion.js +91 -0
- package/dist/components/Accordion/index.cjs +8 -0
- package/dist/components/Accordion/index.js +1 -0
- package/dist/components/ActivityFeed/ActivityContent.cjs +40 -0
- package/dist/components/ActivityFeed/ActivityContent.js +37 -0
- package/dist/components/ActivityFeed/ActivityItem.cjs +19 -0
- package/dist/components/ActivityFeed/ActivityItem.js +16 -0
- package/dist/components/ActivityFeed/index.cjs +7 -0
- package/dist/components/ActivityFeed/index.js +2 -0
- package/dist/components/Alert/Alert.cjs +42 -0
- package/dist/components/Alert/Alert.js +39 -0
- package/dist/components/Alert/index.cjs +5 -0
- package/dist/components/Alert/index.js +1 -0
- package/dist/components/Avatar/Avatar.cjs +101 -0
- package/dist/components/Avatar/Avatar.js +98 -0
- package/dist/components/Avatar/index.cjs +6 -0
- package/dist/components/Avatar/index.js +1 -0
- package/dist/components/Badge/Badge.cjs +53 -0
- package/dist/components/Badge/Badge.js +50 -0
- package/dist/components/Badge/index.cjs +5 -0
- package/dist/components/Badge/index.js +1 -0
- package/dist/components/Banner/Banner.cjs +83 -0
- package/dist/components/Banner/Banner.js +80 -0
- package/dist/components/Banner/index.cjs +5 -0
- package/dist/components/Banner/index.js +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.cjs +31 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +28 -0
- package/dist/components/Breadcrumb/index.cjs +5 -0
- package/dist/components/Breadcrumb/index.js +1 -0
- package/dist/components/Button/Button.cjs +88 -0
- package/dist/components/Button/Button.js +85 -0
- package/dist/components/Button/index.cjs +5 -0
- package/dist/components/Button/index.js +1 -0
- package/dist/components/ButtonGroup/ButtonGroup.cjs +8 -0
- package/dist/components/ButtonGroup/ButtonGroup.js +5 -0
- package/dist/components/ButtonGroup/ButtonGroupItem.cjs +15 -0
- package/dist/components/ButtonGroup/ButtonGroupItem.js +12 -0
- package/dist/components/ButtonGroup/index.cjs +7 -0
- package/dist/components/ButtonGroup/index.js +2 -0
- package/dist/components/Card/Card.cjs +94 -0
- package/dist/components/Card/Card.js +91 -0
- package/dist/components/Card/index.cjs +9 -0
- package/dist/components/Card/index.js +1 -0
- package/dist/components/Chart/Chart.cjs +160 -0
- package/dist/components/Chart/Chart.js +153 -0
- package/dist/components/Chart/index.cjs +10 -0
- package/dist/components/Chart/index.js +2 -0
- package/dist/components/Chart/theme.cjs +67 -0
- package/dist/components/Chart/theme.js +62 -0
- package/dist/components/Chip/Chip.cjs +18 -0
- package/dist/components/Chip/Chip.js +15 -0
- package/dist/components/Chip/index.cjs +5 -0
- package/dist/components/Chip/index.js +1 -0
- package/dist/components/Counter/Counter.cjs +74 -0
- package/dist/components/Counter/Counter.js +71 -0
- package/dist/components/Counter/index.cjs +6 -0
- package/dist/components/Counter/index.js +1 -0
- package/dist/components/DatePicker/DatePicker.cjs +343 -0
- package/dist/components/DatePicker/DatePicker.js +340 -0
- package/dist/components/DatePicker/index.cjs +5 -0
- package/dist/components/DatePicker/index.js +1 -0
- package/dist/components/Divider/Divider.cjs +31 -0
- package/dist/components/Divider/Divider.js +28 -0
- package/dist/components/Divider/index.cjs +5 -0
- package/dist/components/Divider/index.js +1 -0
- package/dist/components/DropdownMenu/DropdownMenu.cjs +108 -0
- package/dist/components/DropdownMenu/DropdownMenu.js +105 -0
- package/dist/components/DropdownMenu/index.cjs +11 -0
- package/dist/components/DropdownMenu/index.js +1 -0
- package/dist/components/EmptyStateIllustration/EmptyStateIllustration.cjs +42 -0
- package/dist/components/EmptyStateIllustration/EmptyStateIllustration.js +39 -0
- package/dist/components/EmptyStateIllustration/illustrations.cjs +3322 -0
- package/dist/components/EmptyStateIllustration/illustrations.js +3319 -0
- package/dist/components/EmptyStateIllustration/index.cjs +7 -0
- package/dist/components/EmptyStateIllustration/index.js +2 -0
- package/dist/components/FileUpload/FileUpload.cjs +116 -0
- package/dist/components/FileUpload/FileUpload.js +113 -0
- package/dist/components/FileUpload/FileUploadDropZone.cjs +58 -0
- package/dist/components/FileUpload/FileUploadDropZone.js +55 -0
- package/dist/components/FileUpload/FileUploadIcons.cjs +55 -0
- package/dist/components/FileUpload/FileUploadIcons.js +50 -0
- package/dist/components/FileUpload/FileUploadItem.cjs +34 -0
- package/dist/components/FileUpload/FileUploadItem.js +31 -0
- package/dist/components/FileUpload/index.cjs +9 -0
- package/dist/components/FileUpload/index.js +3 -0
- package/dist/components/FormControl/Checkbox.cjs +27 -0
- package/dist/components/FormControl/Checkbox.js +24 -0
- package/dist/components/FormControl/Radio.cjs +15 -0
- package/dist/components/FormControl/Radio.js +12 -0
- package/dist/components/FormControl/Toggle.cjs +15 -0
- package/dist/components/FormControl/Toggle.js +12 -0
- package/dist/components/FormControl/index.cjs +9 -0
- package/dist/components/FormControl/index.js +3 -0
- package/dist/components/Icon/Icon.cjs +70 -0
- package/dist/components/Icon/Icon.js +34 -0
- package/dist/components/Icon/catalog.cjs +1672 -0
- package/dist/components/Icon/catalog.js +1669 -0
- package/dist/components/Icon/icons.cjs +5621 -0
- package/dist/components/Icon/icons.js +5610 -0
- package/dist/components/Icon/index.cjs +8 -0
- package/dist/components/Icon/index.js +2 -0
- package/dist/components/Input/Input.cjs +64 -0
- package/dist/components/Input/Input.js +61 -0
- package/dist/components/Input/index.cjs +5 -0
- package/dist/components/Input/index.js +1 -0
- package/dist/components/MetricsCard/MetricsCard.cjs +107 -0
- package/dist/components/MetricsCard/MetricsCard.js +104 -0
- package/dist/components/MetricsCard/index.cjs +5 -0
- package/dist/components/MetricsCard/index.js +1 -0
- package/dist/components/Modal/Modal.cjs +126 -0
- package/dist/components/Modal/Modal.js +123 -0
- package/dist/components/Modal/index.cjs +5 -0
- package/dist/components/Modal/index.js +1 -0
- package/dist/components/Pagination/Pagination.cjs +42 -0
- package/dist/components/Pagination/Pagination.js +39 -0
- package/dist/components/Pagination/index.cjs +5 -0
- package/dist/components/Pagination/index.js +1 -0
- package/dist/components/ProgressBar/ProgressBar.cjs +34 -0
- package/dist/components/ProgressBar/ProgressBar.js +31 -0
- package/dist/components/ProgressBar/index.cjs +5 -0
- package/dist/components/ProgressBar/index.js +1 -0
- package/dist/components/ProgressCircle/ProgressCircle.cjs +34 -0
- package/dist/components/ProgressCircle/ProgressCircle.js +31 -0
- package/dist/components/ProgressCircle/index.cjs +5 -0
- package/dist/components/ProgressCircle/index.js +1 -0
- package/dist/components/Select/Select.cjs +84 -0
- package/dist/components/Select/Select.js +80 -0
- package/dist/components/Select/SelectOption.cjs +26 -0
- package/dist/components/Select/SelectOption.js +23 -0
- package/dist/components/Select/index.cjs +7 -0
- package/dist/components/Select/index.js +2 -0
- package/dist/components/SidebarMenu/SidebarMenu.cjs +85 -0
- package/dist/components/SidebarMenu/SidebarMenu.js +81 -0
- package/dist/components/SidebarMenu/SidebarMenuItem.cjs +126 -0
- package/dist/components/SidebarMenu/SidebarMenuItem.js +122 -0
- package/dist/components/SidebarMenu/SidebarMenuSection.cjs +14 -0
- package/dist/components/SidebarMenu/SidebarMenuSection.js +11 -0
- package/dist/components/SidebarMenu/index.cjs +12 -0
- package/dist/components/SidebarMenu/index.js +4 -0
- package/dist/components/Slider/Slider.cjs +161 -0
- package/dist/components/Slider/Slider.js +158 -0
- package/dist/components/Slider/index.cjs +6 -0
- package/dist/components/Slider/index.js +1 -0
- package/dist/components/Spinner/Spinner.cjs +93 -0
- package/dist/components/Spinner/Spinner.js +90 -0
- package/dist/components/Spinner/index.cjs +5 -0
- package/dist/components/Spinner/index.js +1 -0
- package/dist/components/Stepper/Stepper.cjs +82 -0
- package/dist/components/Stepper/Stepper.js +79 -0
- package/dist/components/Stepper/index.cjs +7 -0
- package/dist/components/Stepper/index.js +1 -0
- package/dist/components/Table/Table.cjs +25 -0
- package/dist/components/Table/Table.js +22 -0
- package/dist/components/Table/index.cjs +10 -0
- package/dist/components/Table/index.js +1 -0
- package/dist/components/Table/useTableSelection.cjs +60 -0
- package/dist/components/Table/useTableSelection.js +57 -0
- package/dist/components/Tabs/Tab.cjs +70 -0
- package/dist/components/Tabs/Tab.js +67 -0
- package/dist/components/Tabs/Tabs.cjs +133 -0
- package/dist/components/Tabs/Tabs.js +129 -0
- package/dist/components/Tabs/index.cjs +7 -0
- package/dist/components/Tabs/index.js +2 -0
- package/dist/components/Tooltip/Tooltip.cjs +101 -0
- package/dist/components/Tooltip/Tooltip.js +98 -0
- package/dist/components/Tooltip/index.cjs +5 -0
- package/dist/components/Tooltip/index.js +1 -0
- package/dist/context/ThemeContext.cjs +97 -0
- package/dist/context/ThemeContext.js +92 -0
- package/dist/fonts/README.md +13 -0
- package/dist/fonts/hanken-grotesk-cyrillic-ext-italic.woff2 +0 -0
- package/dist/fonts/hanken-grotesk-cyrillic-ext-normal.woff2 +0 -0
- package/dist/fonts/hanken-grotesk-latin-ext-italic.woff2 +0 -0
- package/dist/fonts/hanken-grotesk-latin-ext-normal.woff2 +0 -0
- package/dist/fonts/hanken-grotesk-latin-italic.woff2 +0 -0
- package/dist/fonts/hanken-grotesk-latin-normal.woff2 +0 -0
- package/dist/fonts/hanken-grotesk-vietnamese-italic.woff2 +0 -0
- package/dist/fonts/hanken-grotesk-vietnamese-normal.woff2 +0 -0
- package/dist/fonts/hankengrotesk-LICENSE.txt +94 -0
- package/dist/fonts/manrope-LICENSE.txt +93 -0
- package/dist/fonts/manrope-cyrillic-ext-normal.woff2 +0 -0
- package/dist/fonts/manrope-cyrillic-normal.woff2 +0 -0
- package/dist/fonts/manrope-greek-normal.woff2 +0 -0
- package/dist/fonts/manrope-latin-ext-normal.woff2 +0 -0
- package/dist/fonts/manrope-latin-normal.woff2 +0 -0
- package/dist/fonts/manrope-vietnamese-normal.woff2 +0 -0
- package/dist/fonts.css +148 -0
- package/dist/hooks/form/index.cjs +11 -0
- package/dist/hooks/form/index.js +3 -0
- package/dist/hooks/form/useRaydenFormControl.cjs +81 -0
- package/dist/hooks/form/useRaydenFormControl.js +76 -0
- package/dist/hooks/form/useRaydenInput.cjs +38 -0
- package/dist/hooks/form/useRaydenInput.js +35 -0
- package/dist/hooks/form/useRaydenSelect.cjs +45 -0
- package/dist/hooks/form/useRaydenSelect.js +42 -0
- package/dist/hooks/index.cjs +17 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useBodyScrollLock.cjs +24 -0
- package/dist/hooks/useBodyScrollLock.js +21 -0
- package/dist/hooks/useCollisionAwareSide.cjs +72 -0
- package/dist/hooks/useCollisionAwareSide.js +69 -0
- package/dist/hooks/useControllableValue.cjs +16 -0
- package/dist/hooks/useControllableValue.js +13 -0
- package/dist/hooks/useDismissableLayer.cjs +100 -0
- package/dist/hooks/useDismissableLayer.js +97 -0
- package/dist/hooks/usePopupList.cjs +101 -0
- package/dist/hooks/usePopupList.js +98 -0
- package/dist/icons-8yD7I5jO.d.cts +430 -0
- package/dist/icons-8yD7I5jO.d.ts +430 -0
- package/dist/icons.cjs +2111 -418
- package/dist/icons.d.cts +1256 -429
- package/dist/icons.d.ts +1256 -429
- package/dist/icons.js +2089 -1
- package/dist/index.cjs +128 -15046
- package/dist/index.d.cts +697 -662
- package/dist/index.d.ts +697 -662
- package/dist/index.js +43 -14962
- package/dist/motion/Collapse.cjs +28 -0
- package/dist/motion/Collapse.js +25 -0
- package/dist/motion/MotionProvider.cjs +43 -0
- package/dist/motion/MotionProvider.js +38 -0
- package/dist/motion/Pressable.cjs +46 -0
- package/dist/motion/Pressable.js +43 -0
- package/dist/motion/Reveal.cjs +19 -0
- package/dist/motion/Reveal.js +16 -0
- package/dist/motion/SharedLayout.cjs +46 -0
- package/dist/motion/SharedLayout.js +43 -0
- package/dist/motion/index.cjs +19 -0
- package/dist/motion/index.js +6 -0
- package/dist/motion/presence.cjs +58 -0
- package/dist/motion/presence.js +55 -0
- package/dist/motion/presets.cjs +88 -0
- package/dist/motion/presets.js +84 -0
- package/dist/motion.d.cts +51 -0
- package/dist/motion.d.ts +51 -0
- package/dist/preset.cjs +356 -195
- package/dist/preset.d.cts +111 -32
- package/dist/preset.d.ts +111 -32
- package/dist/preset.js +353 -187
- package/dist/presets-Ba5QndHg.d.cts +144 -0
- package/dist/presets-Ba5QndHg.d.ts +144 -0
- package/dist/styles.css +1 -1
- package/dist/utils/cn.cjs +38 -0
- package/dist/utils/cn.js +35 -0
- package/dist/utils/resolveIcon.cjs +18 -0
- package/dist/utils/resolveIcon.js +15 -0
- package/package.json +79 -21
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useRef, forwardRef, } from "react";
|
|
3
|
+
import { useControllableValue } from "../../hooks/useControllableValue.js";
|
|
4
|
+
import { usePopupList } from "../../hooks/usePopupList.js";
|
|
5
|
+
import { cn } from "../../utils/cn.js";
|
|
6
|
+
import { useCollisionAwareSide } from "../../hooks/useCollisionAwareSide.js";
|
|
7
|
+
import { resolveIcon } from "../../utils/resolveIcon.js";
|
|
8
|
+
const DropdownMenuContext = createContext(null);
|
|
9
|
+
function useDropdownMenuContext() {
|
|
10
|
+
const ctx = useContext(DropdownMenuContext);
|
|
11
|
+
if (!ctx)
|
|
12
|
+
throw new Error("DropdownMenu compound components must be used within <DropdownMenu>");
|
|
13
|
+
return ctx;
|
|
14
|
+
}
|
|
15
|
+
export const DropdownMenu = forwardRef(({ open: controlledOpen, defaultOpen = false, onOpenChange, children, className, ...rest }, ref) => {
|
|
16
|
+
const [open, setOpen] = useControllableValue(controlledOpen, defaultOpen, onOpenChange);
|
|
17
|
+
const containerRef = useRef(null);
|
|
18
|
+
const triggerRef = useRef(null);
|
|
19
|
+
const contentRef = useRef(null);
|
|
20
|
+
const { close, onTriggerKeyDown, onListKeyDown } = usePopupList({
|
|
21
|
+
open,
|
|
22
|
+
setOpen,
|
|
23
|
+
containerRef,
|
|
24
|
+
triggerRef,
|
|
25
|
+
listRef: contentRef,
|
|
26
|
+
role: "menuitem",
|
|
27
|
+
});
|
|
28
|
+
return (_jsx(DropdownMenuContext.Provider, { value: {
|
|
29
|
+
open,
|
|
30
|
+
setOpen,
|
|
31
|
+
triggerRef,
|
|
32
|
+
contentRef,
|
|
33
|
+
close,
|
|
34
|
+
onTriggerKeyDown,
|
|
35
|
+
onListKeyDown,
|
|
36
|
+
}, children: _jsx("div", { ref: (node) => {
|
|
37
|
+
containerRef.current = node;
|
|
38
|
+
if (typeof ref === "function")
|
|
39
|
+
ref(node);
|
|
40
|
+
else if (ref)
|
|
41
|
+
ref.current = node;
|
|
42
|
+
}, ...rest, className: cn("relative inline-flex", className), children: children }) }));
|
|
43
|
+
});
|
|
44
|
+
DropdownMenu.displayName = "DropdownMenu";
|
|
45
|
+
export const DropdownMenuTrigger = forwardRef(({ onClick, onKeyDown, children, className, ...rest }, ref) => {
|
|
46
|
+
const { open, setOpen, triggerRef, onTriggerKeyDown } = useDropdownMenuContext();
|
|
47
|
+
return (_jsx("button", { ref: (node) => {
|
|
48
|
+
triggerRef.current = node;
|
|
49
|
+
if (typeof ref === "function")
|
|
50
|
+
ref(node);
|
|
51
|
+
else if (ref)
|
|
52
|
+
ref.current = node;
|
|
53
|
+
}, type: "button", "aria-expanded": open, "aria-haspopup": "menu", onKeyDown: (event) => {
|
|
54
|
+
onKeyDown?.(event);
|
|
55
|
+
onTriggerKeyDown(event);
|
|
56
|
+
}, onClick: (e) => {
|
|
57
|
+
onClick?.(e);
|
|
58
|
+
if (!e.defaultPrevented)
|
|
59
|
+
setOpen(!open);
|
|
60
|
+
}, className: className, ...rest, children: children }));
|
|
61
|
+
});
|
|
62
|
+
DropdownMenuTrigger.displayName = "DropdownMenuTrigger";
|
|
63
|
+
export const DropdownMenuContent = forwardRef(({ align = "end", sideOffset = 4, children, className, onKeyDown, ...rest }, ref) => {
|
|
64
|
+
const { open, triggerRef, contentRef, onListKeyDown } = useDropdownMenuContext();
|
|
65
|
+
// The menu always opened downward, so near the bottom edge it ran off-screen.
|
|
66
|
+
const menuSide = useCollisionAwareSide("bottom", open, triggerRef, contentRef);
|
|
67
|
+
if (!open)
|
|
68
|
+
return null;
|
|
69
|
+
return (_jsx("div", { ref: (node) => {
|
|
70
|
+
contentRef.current = node;
|
|
71
|
+
if (typeof ref === "function")
|
|
72
|
+
ref(node);
|
|
73
|
+
else if (ref)
|
|
74
|
+
ref.current = node;
|
|
75
|
+
}, role: "menu", "aria-orientation": "vertical", onKeyDown: (event) => {
|
|
76
|
+
onKeyDown?.(event);
|
|
77
|
+
onListKeyDown(event);
|
|
78
|
+
}, className: cn("absolute z-50 min-w-[200px] overflow-hidden rounded-lg bg-surface py-1", "shadow-lg ring-1 ring-black/5", "animate-in fade-in-0 zoom-in-95", menuSide === "top" ? "bottom-full" : "top-full", align === "end" ? "right-0" : "left-0", className), style: menuSide === "top" ? { marginBottom: sideOffset } : { marginTop: sideOffset }, ...rest, children: children }));
|
|
79
|
+
});
|
|
80
|
+
DropdownMenuContent.displayName = "DropdownMenuContent";
|
|
81
|
+
export const DropdownMenuGroup = forwardRef(({ className, ...rest }, ref) => (_jsx("div", { ref: ref, role: "group", className: cn("py-1", className), ...rest })));
|
|
82
|
+
DropdownMenuGroup.displayName = "DropdownMenuGroup";
|
|
83
|
+
export const DropdownMenuLabel = forwardRef(({ description, children, className, ...rest }, ref) => (_jsxs("div", { ref: ref, className: cn("px-4 py-2", className), ...rest, children: [_jsx("p", { className: "text-body-sm font-semibold text-on-surface", children: children }), description && _jsx("p", { className: "text-body-sm text-on-surface-muted", children: description })] })));
|
|
84
|
+
DropdownMenuLabel.displayName = "DropdownMenuLabel";
|
|
85
|
+
export const DropdownMenuItem = forwardRef(({ icon, shortcut, selected = false, disabled = false, destructive = false, onSelect, onClick, children, className, ...rest }, ref) => {
|
|
86
|
+
const { close } = useDropdownMenuContext();
|
|
87
|
+
const handleClick = (e) => {
|
|
88
|
+
if (disabled)
|
|
89
|
+
return;
|
|
90
|
+
onClick?.(e);
|
|
91
|
+
if (e.defaultPrevented)
|
|
92
|
+
return;
|
|
93
|
+
close(true);
|
|
94
|
+
onSelect?.();
|
|
95
|
+
};
|
|
96
|
+
const resolvedIcon = resolveIcon(icon, "md");
|
|
97
|
+
return (_jsxs("button", { ref: ref, type: "button", role: "menuitem", tabIndex: -1, disabled: disabled, onClick: handleClick, className: cn("flex w-full items-center gap-1 px-4 py-2 text-left text-body-sm outline-none transition-colors", disabled
|
|
98
|
+
? "bg-grey-100 text-grey-500 cursor-not-allowed"
|
|
99
|
+
: destructive
|
|
100
|
+
? "text-error-500 hover:bg-error-50 focus:bg-error-100"
|
|
101
|
+
: "text-on-surface hover:bg-grey-50 focus:bg-grey-100", className), ...rest, children: [_jsxs("div", { className: "flex flex-1 items-center gap-3", children: [resolvedIcon && (_jsx("span", { className: cn("shrink-0 size-5", disabled && "opacity-50"), children: resolvedIcon })), _jsx("span", { className: "flex-1", children: children })] }), shortcut && (_jsx("kbd", { className: "ml-2 shrink-0 rounded bg-grey-50 border border-grey-100 px-1 text-body-sm text-grey-600", children: shortcut })), selected && (_jsx("span", { className: "ml-2 shrink-0", children: _jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", className: "text-[#1671D9]", children: [_jsx("circle", { cx: "8", cy: "8", r: "8", fill: "currentColor" }), _jsx("path", { d: "M11.5 5.5L6.5 10.5L4.5 8.5", stroke: "white", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round" })] }) }))] }));
|
|
102
|
+
});
|
|
103
|
+
DropdownMenuItem.displayName = "DropdownMenuItem";
|
|
104
|
+
export const DropdownMenuSeparator = forwardRef(({ className, ...rest }, ref) => (_jsx("div", { ref: ref, role: "separator", className: cn("my-1 h-px bg-grey-100", className), ...rest })));
|
|
105
|
+
DropdownMenuSeparator.displayName = "DropdownMenuSeparator";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DropdownMenuSeparator = exports.DropdownMenuItem = exports.DropdownMenuLabel = exports.DropdownMenuGroup = exports.DropdownMenuContent = exports.DropdownMenuTrigger = exports.DropdownMenu = void 0;
|
|
4
|
+
var DropdownMenu_1 = require("./DropdownMenu.cjs");
|
|
5
|
+
Object.defineProperty(exports, "DropdownMenu", { enumerable: true, get: function () { return DropdownMenu_1.DropdownMenu; } });
|
|
6
|
+
Object.defineProperty(exports, "DropdownMenuTrigger", { enumerable: true, get: function () { return DropdownMenu_1.DropdownMenuTrigger; } });
|
|
7
|
+
Object.defineProperty(exports, "DropdownMenuContent", { enumerable: true, get: function () { return DropdownMenu_1.DropdownMenuContent; } });
|
|
8
|
+
Object.defineProperty(exports, "DropdownMenuGroup", { enumerable: true, get: function () { return DropdownMenu_1.DropdownMenuGroup; } });
|
|
9
|
+
Object.defineProperty(exports, "DropdownMenuLabel", { enumerable: true, get: function () { return DropdownMenu_1.DropdownMenuLabel; } });
|
|
10
|
+
Object.defineProperty(exports, "DropdownMenuItem", { enumerable: true, get: function () { return DropdownMenu_1.DropdownMenuItem; } });
|
|
11
|
+
Object.defineProperty(exports, "DropdownMenuSeparator", { enumerable: true, get: function () { return DropdownMenu_1.DropdownMenuSeparator; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuSeparator, } from "./DropdownMenu.js";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EmptyStateIllustration = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const cn_1 = require("../../utils/cn.cjs");
|
|
7
|
+
const illustrations_1 = require("./illustrations.cjs");
|
|
8
|
+
// ─── Default primary palette used in colored SVGs ──────────────────
|
|
9
|
+
const DEFAULT_PALETTE = [
|
|
10
|
+
"#FFECE5", // primary-50
|
|
11
|
+
"#FCD2C2", // primary-75
|
|
12
|
+
"#FCB59A", // primary-100
|
|
13
|
+
"#FA9874", // primary-150
|
|
14
|
+
"#F77A4A", // primary-200
|
|
15
|
+
"#F56630", // primary-400
|
|
16
|
+
"#EB5017", // primary-500
|
|
17
|
+
"#CC400C", // primary-600
|
|
18
|
+
"#AD3307", // primary-700
|
|
19
|
+
"#8F2802", // primary-800
|
|
20
|
+
"#711E00", // primary-900
|
|
21
|
+
];
|
|
22
|
+
// ─── Component ─────────────────────────────────────────────────────
|
|
23
|
+
exports.EmptyStateIllustration = (0, react_1.forwardRef)(({ name, colored = true, palette, size = 150, className, ...rest }, ref) => {
|
|
24
|
+
const rawSvg = colored ? illustrations_1.coloredIllustrations[name] : illustrations_1.greyIllustrations[name];
|
|
25
|
+
// Apply custom palette via string replacement
|
|
26
|
+
const svgContent = (0, react_1.useMemo)(() => {
|
|
27
|
+
if (!colored || !palette || palette.length === 0)
|
|
28
|
+
return rawSvg;
|
|
29
|
+
let result = rawSvg;
|
|
30
|
+
const len = Math.min(palette.length, DEFAULT_PALETTE.length);
|
|
31
|
+
for (let i = 0; i < len; i++) {
|
|
32
|
+
const from = DEFAULT_PALETTE[i];
|
|
33
|
+
const to = palette[i];
|
|
34
|
+
if (from !== to) {
|
|
35
|
+
result = result.split(from).join(to.toUpperCase());
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return result;
|
|
39
|
+
}, [rawSvg, colored, palette]);
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: ref, className: (0, cn_1.cn)("inline-flex shrink-0 items-center justify-center", className), ...rest, children: (0, jsx_runtime_1.jsx)("svg", { width: size, height: size, viewBox: "0 0 150 150", fill: "none", xmlns: "http://www.w3.org/2000/svg", dangerouslySetInnerHTML: { __html: svgContent } }) }));
|
|
41
|
+
});
|
|
42
|
+
exports.EmptyStateIllustration.displayName = "EmptyStateIllustration";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useMemo } from "react";
|
|
3
|
+
import { cn } from "../../utils/cn.js";
|
|
4
|
+
import { coloredIllustrations, greyIllustrations } from "./illustrations.js";
|
|
5
|
+
// ─── Default primary palette used in colored SVGs ──────────────────
|
|
6
|
+
const DEFAULT_PALETTE = [
|
|
7
|
+
"#FFECE5", // primary-50
|
|
8
|
+
"#FCD2C2", // primary-75
|
|
9
|
+
"#FCB59A", // primary-100
|
|
10
|
+
"#FA9874", // primary-150
|
|
11
|
+
"#F77A4A", // primary-200
|
|
12
|
+
"#F56630", // primary-400
|
|
13
|
+
"#EB5017", // primary-500
|
|
14
|
+
"#CC400C", // primary-600
|
|
15
|
+
"#AD3307", // primary-700
|
|
16
|
+
"#8F2802", // primary-800
|
|
17
|
+
"#711E00", // primary-900
|
|
18
|
+
];
|
|
19
|
+
// ─── Component ─────────────────────────────────────────────────────
|
|
20
|
+
export const EmptyStateIllustration = forwardRef(({ name, colored = true, palette, size = 150, className, ...rest }, ref) => {
|
|
21
|
+
const rawSvg = colored ? coloredIllustrations[name] : greyIllustrations[name];
|
|
22
|
+
// Apply custom palette via string replacement
|
|
23
|
+
const svgContent = useMemo(() => {
|
|
24
|
+
if (!colored || !palette || palette.length === 0)
|
|
25
|
+
return rawSvg;
|
|
26
|
+
let result = rawSvg;
|
|
27
|
+
const len = Math.min(palette.length, DEFAULT_PALETTE.length);
|
|
28
|
+
for (let i = 0; i < len; i++) {
|
|
29
|
+
const from = DEFAULT_PALETTE[i];
|
|
30
|
+
const to = palette[i];
|
|
31
|
+
if (from !== to) {
|
|
32
|
+
result = result.split(from).join(to.toUpperCase());
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}, [rawSvg, colored, palette]);
|
|
37
|
+
return (_jsx("div", { ref: ref, className: cn("inline-flex shrink-0 items-center justify-center", className), ...rest, children: _jsx("svg", { width: size, height: size, viewBox: "0 0 150 150", fill: "none", xmlns: "http://www.w3.org/2000/svg", dangerouslySetInnerHTML: { __html: svgContent } }) }));
|
|
38
|
+
});
|
|
39
|
+
EmptyStateIllustration.displayName = "EmptyStateIllustration";
|