@rovula/ui 0.1.21 → 0.1.22
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/cjs/bundle.css +175 -26
- package/dist/cjs/bundle.js +675 -675
- package/dist/cjs/bundle.js.map +1 -1
- package/dist/cjs/types/components/Badge/Badge.d.ts +40 -0
- package/dist/cjs/types/components/Badge/Badge.stories.d.ts +295 -0
- package/dist/cjs/types/components/Badge/Badge.styles.d.ts +7 -0
- package/dist/cjs/types/components/Badge/index.d.ts +2 -0
- package/dist/cjs/types/components/Dropdown/Dropdown.d.ts +4 -8
- package/dist/cjs/types/components/Dropdown/Dropdown.stories.d.ts +1 -6
- package/dist/cjs/types/components/DropdownMenu/DropdownMenu.d.ts +5 -1
- package/dist/cjs/types/components/DropdownMenu/DropdownMenu.stories.d.ts +16 -0
- package/dist/cjs/types/index.d.ts +3 -1
- package/dist/cjs/types/patterns/menu/Menu.d.ts +70 -0
- package/dist/cjs/types/{components/Menu → patterns/menu}/Menu.stories.d.ts +17 -10
- package/dist/cjs/types/utils/mergeRefs.d.ts +20 -0
- package/dist/components/Avatar/Avatar.styles.js +2 -2
- package/dist/components/Badge/Badge.js +36 -0
- package/dist/components/Badge/Badge.stories.js +51 -0
- package/dist/components/Badge/Badge.styles.js +62 -0
- package/dist/components/Badge/index.js +2 -0
- package/dist/components/Dropdown/Dropdown.js +54 -163
- package/dist/components/Dropdown/Dropdown.stories.js +29 -0
- package/dist/components/DropdownMenu/DropdownMenu.js +22 -9
- package/dist/components/DropdownMenu/DropdownMenu.stories.js +54 -10
- package/dist/components/TextInput/TextInput.js +6 -3
- package/dist/esm/bundle.css +175 -26
- package/dist/esm/bundle.js +1545 -1545
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/types/components/Badge/Badge.d.ts +40 -0
- package/dist/esm/types/components/Badge/Badge.stories.d.ts +295 -0
- package/dist/esm/types/components/Badge/Badge.styles.d.ts +7 -0
- package/dist/esm/types/components/Badge/index.d.ts +2 -0
- package/dist/esm/types/components/Dropdown/Dropdown.d.ts +4 -8
- package/dist/esm/types/components/Dropdown/Dropdown.stories.d.ts +1 -6
- package/dist/esm/types/components/DropdownMenu/DropdownMenu.d.ts +5 -1
- package/dist/esm/types/components/DropdownMenu/DropdownMenu.stories.d.ts +16 -0
- package/dist/esm/types/index.d.ts +3 -1
- package/dist/esm/types/patterns/menu/Menu.d.ts +70 -0
- package/dist/esm/types/{components/Menu → patterns/menu}/Menu.stories.d.ts +17 -10
- package/dist/esm/types/utils/mergeRefs.d.ts +20 -0
- package/dist/index.d.ts +116 -73
- package/dist/index.js +2 -1
- package/dist/patterns/menu/Menu.js +95 -0
- package/dist/patterns/menu/Menu.stories.js +611 -0
- package/dist/src/theme/global.css +289 -37
- package/dist/utils/mergeRefs.js +42 -0
- package/package.json +1 -1
- package/src/components/Avatar/Avatar.styles.ts +2 -2
- package/src/components/Badge/Badge.stories.tsx +128 -0
- package/src/components/Badge/Badge.styles.ts +70 -0
- package/src/components/Badge/Badge.tsx +103 -0
- package/src/components/Badge/index.ts +3 -0
- package/src/components/Dropdown/Dropdown.stories.tsx +170 -1
- package/src/components/Dropdown/Dropdown.tsx +186 -276
- package/src/components/DropdownMenu/DropdownMenu.stories.tsx +1050 -113
- package/src/components/DropdownMenu/DropdownMenu.tsx +116 -52
- package/src/components/TextInput/TextInput.tsx +6 -3
- package/src/index.ts +3 -1
- package/src/patterns/menu/Menu.stories.tsx +1100 -0
- package/src/patterns/menu/Menu.tsx +282 -0
- package/src/theme/themes/xspector/baseline.css +0 -1
- package/src/theme/tokens/baseline.css +2 -1
- package/src/theme/tokens/components/badge.css +54 -0
- package/src/theme/tokens/components/dropdown-menu.css +15 -4
- package/src/utils/mergeRefs.ts +46 -0
- package/dist/cjs/types/components/Menu/Menu.d.ts +0 -65
- package/dist/cjs/types/components/Menu/helpers.d.ts +0 -19
- package/dist/cjs/types/components/Menu/index.d.ts +0 -4
- package/dist/components/Menu/Menu.js +0 -64
- package/dist/components/Menu/Menu.stories.js +0 -406
- package/dist/components/Menu/helpers.js +0 -28
- package/dist/components/Menu/index.js +0 -3
- package/dist/esm/types/components/Menu/Menu.d.ts +0 -65
- package/dist/esm/types/components/Menu/helpers.d.ts +0 -19
- package/dist/esm/types/components/Menu/index.d.ts +0 -4
- package/src/components/Menu/Menu.stories.tsx +0 -586
- package/src/components/Menu/Menu.tsx +0 -235
- package/src/components/Menu/helpers.ts +0 -45
- package/src/components/Menu/index.ts +0 -7
- package/src/theme/themes/xspector/components/dropdown-menu.css +0 -28
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
|
-
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, } from "./DropdownMenu";
|
|
3
|
+
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, } from "./DropdownMenu";
|
|
4
4
|
import Button from "../Button/Button";
|
|
5
5
|
import ActionButton from "../ActionButton/ActionButton";
|
|
6
6
|
import Icon from "../Icon/Icon";
|
|
@@ -18,11 +18,11 @@ const meta = {
|
|
|
18
18
|
export default meta;
|
|
19
19
|
// ---------------------------------------------------------------------------
|
|
20
20
|
// Figma: Normal dropdown / action menu
|
|
21
|
-
// Shows all item states: Default, Hover
|
|
21
|
+
// Shows all item states: Default, Hover, Selected, Disabled, Selected+Disabled
|
|
22
22
|
// ---------------------------------------------------------------------------
|
|
23
23
|
export const AllStates = {
|
|
24
24
|
name: "All States (Normal)",
|
|
25
|
-
render: () => (_jsxs("div", { className: "flex gap-8 items-start flex-wrap", children: [_jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "All States" }), _jsxs(DropdownMenu, {
|
|
25
|
+
render: () => (_jsxs("div", { className: "flex gap-8 items-start flex-wrap", children: [_jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "All States" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(ActionButton, { variant: "icon", children: _jsx(Icon, { type: "heroicons", name: "ellipsis-vertical" }) }) }), _jsxs(DropdownMenuContent, { className: "relative", style: { position: "static", transform: "none" }, children: [_jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { className: "!bg-[var(--dropdown-menu-hover-bg)]", children: "Option Description (Hover)" }), _jsx(DropdownMenuItem, { selected: true, children: "Option Description" }), _jsx(DropdownMenuItem, { disabled: true, children: "Option Description" }), _jsx(DropdownMenuItem, { selected: true, disabled: true, children: "Option Description" })] })] })] }), _jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "Interactive" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Open Menu" }) }), _jsxs(DropdownMenuContent, { children: [_jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { selected: true, children: "Option Description" }), _jsx(DropdownMenuItem, { disabled: true, children: "Option Description" }), _jsx(DropdownMenuItem, { selected: true, disabled: true, children: "Option Description" })] })] })] })] })),
|
|
26
26
|
};
|
|
27
27
|
// ---------------------------------------------------------------------------
|
|
28
28
|
// Figma: Have icon
|
|
@@ -30,7 +30,7 @@ export const AllStates = {
|
|
|
30
30
|
// ---------------------------------------------------------------------------
|
|
31
31
|
export const WithIcon = {
|
|
32
32
|
name: "With Icon",
|
|
33
|
-
render: () => (_jsxs("div", { className: "flex gap-8 items-start flex-wrap", children: [_jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "All States \u2014 With Icon" }), _jsxs(DropdownMenu, {
|
|
33
|
+
render: () => (_jsxs("div", { className: "flex gap-8 items-start flex-wrap", children: [_jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "All States \u2014 With Icon" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(ActionButton, { variant: "icon", children: _jsx(Icon, { type: "heroicons", name: "ellipsis-vertical" }) }) }), _jsxs(DropdownMenuContent, { className: "relative", style: { position: "static", transform: "none" }, children: [_jsx(DropdownMenuItem, { icon: _jsx(Icon, { type: "heroicons", name: "rocket-launch", className: "size-4 shrink-0" }), children: "Option Description" }), _jsx(DropdownMenuItem, { className: "!bg-[var(--dropdown-menu-hover-bg)]", icon: _jsx(Icon, { type: "heroicons", name: "rocket-launch", className: "size-4 shrink-0" }), children: "Option Description (Hover)" }), _jsx(DropdownMenuItem, { selected: true, icon: _jsx(Icon, { type: "heroicons", name: "rocket-launch", className: "size-4 shrink-0" }), children: "Option Description (Selected)" }), _jsx(DropdownMenuItem, { disabled: true, icon: _jsx(Icon, { type: "heroicons", name: "rocket-launch", className: "size-4 shrink-0" }), children: "Option Description (Disabled)" }), _jsx(DropdownMenuItem, { selected: true, disabled: true, icon: _jsx(Icon, { type: "heroicons", name: "rocket-launch", className: "size-4 shrink-0" }), children: "Option Description (Selected + Disabled)" })] })] })] }), _jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "Interactive" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Open Menu" }) }), _jsxs(DropdownMenuContent, { children: [_jsx(DropdownMenuItem, { icon: _jsx(Icon, { type: "heroicons", name: "rocket-launch", className: "size-4 shrink-0" }), children: "Launch" }), _jsx(DropdownMenuItem, { icon: _jsx(Icon, { type: "heroicons", name: "pencil", className: "size-4 shrink-0" }), children: "Edit" }), _jsx(DropdownMenuItem, { icon: _jsx(Icon, { type: "heroicons", name: "document-duplicate", className: "size-4 shrink-0" }), children: "Duplicate" }), _jsx(DropdownMenuItem, { disabled: true, icon: _jsx(Icon, { type: "heroicons", name: "trash", className: "size-4 shrink-0" }), children: "Delete" })] })] })] })] })),
|
|
34
34
|
};
|
|
35
35
|
// ---------------------------------------------------------------------------
|
|
36
36
|
// Figma: Checkbox items (Have icon=No, Checkbox=Yes)
|
|
@@ -41,7 +41,7 @@ export const WithCheckbox = {
|
|
|
41
41
|
const [checked1, setChecked1] = useState(false);
|
|
42
42
|
const [checked2, setChecked2] = useState(true);
|
|
43
43
|
const [checked3, setChecked3] = useState(false);
|
|
44
|
-
return (_jsxs("div", { className: "flex gap-8 items-start flex-wrap", children: [_jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "All States \u2014 Checkbox" }), _jsxs(DropdownMenu, {
|
|
44
|
+
return (_jsxs("div", { className: "flex gap-8 items-start flex-wrap", children: [_jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "All States \u2014 Checkbox" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(ActionButton, { variant: "icon", children: _jsx(Icon, { type: "heroicons", name: "ellipsis-vertical" }) }) }), _jsxs(DropdownMenuContent, { className: "relative", style: { position: "static", transform: "none" }, children: [_jsx(DropdownMenuCheckboxItem, { children: "Option Description" }), _jsx(DropdownMenuCheckboxItem, { className: "!bg-[var(--dropdown-menu-hover-bg)]", children: "Option Description (Hover)" }), _jsx(DropdownMenuCheckboxItem, { checked: true, children: "Option Description" }), _jsx(DropdownMenuCheckboxItem, { disabled: true, children: "Option Description" }), _jsx(DropdownMenuCheckboxItem, { checked: true, disabled: true, children: "Option Description" })] })] })] }), _jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "Interactive" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Open Menu" }) }), _jsxs(DropdownMenuContent, { children: [_jsx(DropdownMenuCheckboxItem, { checked: checked1, onCheckedChange: setChecked1, children: "Option Description" }), _jsx(DropdownMenuCheckboxItem, { checked: checked2, onCheckedChange: setChecked2, children: "Option Description" }), _jsx(DropdownMenuCheckboxItem, { checked: checked3, onCheckedChange: setChecked3, children: "Option Description" }), _jsx(DropdownMenuCheckboxItem, { disabled: true, children: "Option Description" })] })] })] })] }));
|
|
45
45
|
},
|
|
46
46
|
};
|
|
47
47
|
// ---------------------------------------------------------------------------
|
|
@@ -49,7 +49,7 @@ export const WithCheckbox = {
|
|
|
49
49
|
// ---------------------------------------------------------------------------
|
|
50
50
|
export const WithSection = {
|
|
51
51
|
name: "Have Section",
|
|
52
|
-
render: () => (_jsxs("div", { className: "flex gap-8 items-start flex-wrap", children: [_jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "With Section Header" }), _jsxs(DropdownMenu, {
|
|
52
|
+
render: () => (_jsxs("div", { className: "flex gap-8 items-start flex-wrap", children: [_jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "With Section Header" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(ActionButton, { variant: "icon", children: _jsx(Icon, { type: "heroicons", name: "ellipsis-vertical" }) }) }), _jsxs(DropdownMenuContent, { className: "relative", style: { position: "static", transform: "none" }, children: [_jsx(DropdownMenuLabel, { children: "Section Name" }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuLabel, { children: "Section Name" }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" })] })] })] }), _jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "Interactive" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Open Menu" }) }), _jsxs(DropdownMenuContent, { children: [_jsx(DropdownMenuLabel, { children: "Section Name" }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuLabel, { children: "Section Name" }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" })] })] })] })] })),
|
|
53
53
|
};
|
|
54
54
|
// ---------------------------------------------------------------------------
|
|
55
55
|
// Figma: Have search
|
|
@@ -71,7 +71,7 @@ export const WithSearch = {
|
|
|
71
71
|
"Project Theta",
|
|
72
72
|
];
|
|
73
73
|
const filtered = allOptions.filter((o) => o.toLowerCase().includes(query.toLowerCase()));
|
|
74
|
-
return (_jsxs("div", { className: "flex gap-8 items-start flex-wrap", children: [_jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "With Search Field" }), _jsxs(DropdownMenu, {
|
|
74
|
+
return (_jsxs("div", { className: "flex gap-8 items-start flex-wrap", children: [_jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "With Search Field" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(ActionButton, { variant: "icon", children: _jsx(Icon, { type: "heroicons", name: "ellipsis-vertical" }) }) }), _jsxs(DropdownMenuContent, { className: "relative w-[230px]", style: { position: "static", transform: "none" }, onInteractOutside: (e) => e.preventDefault(), children: [_jsxs("div", { className: "flex items-center px-4 py-2 border-b border-[var(--dropdown-menu-seperator-bg)]", children: [_jsx(Icon, { type: "heroicons", name: "magnifying-glass", className: "size-[14px] shrink-0 text-text-g-contrast-medium mr-1" }), _jsx(Input, { variant: "flat", size: "sm", className: "flex-1 !p-0 !ring-0 typography-small1 placeholder:text-text-g-contrast-medium", placeholder: "Search", value: query, onChange: (e) => setQuery(e.target.value) })] }), filtered.map((label) => (_jsx(DropdownMenuItem, { children: label }, label))), filtered.length === 0 && (_jsx("div", { className: "px-4 py-3 typography-subtitle4 text-text-g-contrast-medium", children: "No results found" }))] })] })] }), _jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "Interactive" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Open Menu" }) }), _jsxs(DropdownMenuContent, { className: "w-[230px]", children: [_jsxs("div", { className: "flex items-center px-4 py-2 border-b border-[var(--dropdown-menu-seperator-bg)]", children: [_jsx(Icon, { type: "heroicons", name: "magnifying-glass", className: "size-[14px] shrink-0 text-text-g-contrast-medium mr-1" }), _jsx(Input, { variant: "flat", size: "sm", className: "flex-1 !p-0 !ring-0 typography-small1 placeholder:text-text-g-contrast-medium", placeholder: "Search" })] }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" })] })] })] })] }));
|
|
75
75
|
},
|
|
76
76
|
};
|
|
77
77
|
// ---------------------------------------------------------------------------
|
|
@@ -79,21 +79,49 @@ export const WithSearch = {
|
|
|
79
79
|
// ---------------------------------------------------------------------------
|
|
80
80
|
export const CanScroll = {
|
|
81
81
|
name: "Can Scroll",
|
|
82
|
-
render: () => (_jsxs("div", { className: "flex gap-8 items-start flex-wrap", children: [_jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "Scrollable List" }), _jsxs(DropdownMenu, {
|
|
82
|
+
render: () => (_jsxs("div", { className: "flex gap-8 items-start flex-wrap", children: [_jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "Scrollable List" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(ActionButton, { variant: "icon", children: _jsx(Icon, { type: "heroicons", name: "ellipsis-vertical" }) }) }), _jsx(DropdownMenuContent, { className: "relative max-h-[270px] overflow-y-auto", style: { position: "static", transform: "none" }, children: Array.from({ length: 10 }, (_, i) => (_jsxs(DropdownMenuItem, { children: ["Option Description ", i + 1] }, i))) })] })] }), _jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "Interactive" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Open Menu" }) }), _jsx(DropdownMenuContent, { className: "max-h-[270px] overflow-y-auto", children: Array.from({ length: 10 }, (_, i) => (_jsxs(DropdownMenuItem, { children: ["Option Description ", i + 1] }, i))) })] })] })] })),
|
|
83
83
|
};
|
|
84
84
|
// ---------------------------------------------------------------------------
|
|
85
85
|
// Figma: Double scroll — two separate scrollable sections with section headers
|
|
86
86
|
// ---------------------------------------------------------------------------
|
|
87
87
|
export const DoubleScroll = {
|
|
88
88
|
name: "Double Scroll",
|
|
89
|
-
render: () => (_jsxs("div", { className: "flex gap-8 items-start flex-wrap", children: [_jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "Two Scrollable Sections" }), _jsxs(DropdownMenu, {
|
|
89
|
+
render: () => (_jsxs("div", { className: "flex gap-8 items-start flex-wrap", children: [_jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "Two Scrollable Sections" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(ActionButton, { variant: "icon", children: _jsx(Icon, { type: "heroicons", name: "ellipsis-vertical" }) }) }), _jsxs(DropdownMenuContent, { className: "relative", style: { position: "static", transform: "none" }, children: [_jsx(DropdownMenuLabel, { children: "Section A" }), _jsx("div", { className: "max-h-[270px] overflow-y-auto", children: Array.from({ length: 5 }, (_, i) => (_jsxs(DropdownMenuItem, { children: ["Option Description ", i + 1] }, i))) }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuLabel, { children: "Section B" }), _jsx("div", { className: "max-h-[216px] overflow-y-auto", children: Array.from({ length: 4 }, (_, i) => (_jsxs(DropdownMenuItem, { children: ["Option Description ", i + 1] }, i))) })] })] })] }), _jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "Interactive" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Open Menu" }) }), _jsxs(DropdownMenuContent, { children: [_jsx(DropdownMenuLabel, { children: "Section A" }), _jsx("div", { className: "max-h-[270px] overflow-y-auto", children: Array.from({ length: 5 }, (_, i) => (_jsxs(DropdownMenuItem, { children: ["Option Description ", i + 1] }, i))) }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuLabel, { children: "Section B" }), _jsx("div", { className: "max-h-[216px] overflow-y-auto", children: Array.from({ length: 4 }, (_, i) => (_jsxs(DropdownMenuItem, { children: ["Option Description ", i + 1] }, i))) })] })] })] })] })),
|
|
90
90
|
};
|
|
91
91
|
// ---------------------------------------------------------------------------
|
|
92
92
|
// Figma: Sub menu (existing, preserved)
|
|
93
93
|
// ---------------------------------------------------------------------------
|
|
94
94
|
export const SubMenu = {
|
|
95
95
|
name: "Sub Menu",
|
|
96
|
-
render: () => (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Open Menu" }) }), _jsxs(DropdownMenuContent, { children: [_jsx(DropdownMenuLabel, { children: "My Account" }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { children: "Profile" }), _jsx(DropdownMenuItem, { children: "Billing" }), _jsx(DropdownMenuItem, { children: "Team" }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuGroup, { children: [_jsxs(DropdownMenuSub, { children: [_jsxs(DropdownMenuSubTrigger, { children: [_jsx(Icon, { type: "heroicons", name: "user-group", className: "size-4 shrink-0" }), "Invite users"] }), _jsx(DropdownMenuPortal, { children: _jsxs(DropdownMenuSubContent, { children: [_jsx(DropdownMenuItem, { children: "Email" }), _jsx(DropdownMenuItem, { children: "Message" }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { children: "More..." })] }) })] }), _jsx(DropdownMenuCheckboxItem, { children: "Panel" })] })] })] })),
|
|
96
|
+
render: () => (_jsx("div", { className: "flex gap-8 items-center flex-wrap", children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Open Menu" }) }), _jsxs(DropdownMenuContent, { children: [_jsx(DropdownMenuLabel, { children: "My Account" }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { children: "Profile" }), _jsx(DropdownMenuItem, { children: "Billing" }), _jsx(DropdownMenuItem, { children: "Team" }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuGroup, { children: [_jsxs(DropdownMenuSub, { children: [_jsxs(DropdownMenuSubTrigger, { children: [_jsx(Icon, { type: "heroicons", name: "user-group", className: "size-4 shrink-0" }), "Invite users"] }), _jsx(DropdownMenuPortal, { children: _jsxs(DropdownMenuSubContent, { children: [_jsx(DropdownMenuItem, { children: "Email" }), _jsx(DropdownMenuItem, { children: "Message" }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { children: "More..." })] }) })] }), _jsx(DropdownMenuCheckboxItem, { children: "Panel" })] })] })] }) })),
|
|
97
|
+
};
|
|
98
|
+
// ---------------------------------------------------------------------------
|
|
99
|
+
// Figma: Radio items — single select via DropdownMenuRadioGroup
|
|
100
|
+
// ---------------------------------------------------------------------------
|
|
101
|
+
export const WithRadio = {
|
|
102
|
+
name: "With Radio",
|
|
103
|
+
render: () => {
|
|
104
|
+
const [theme, setTheme] = useState("light");
|
|
105
|
+
const [position, setPosition] = useState("top");
|
|
106
|
+
return (_jsxs("div", { className: "flex gap-8 items-start flex-wrap", children: [_jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "All States \u2014 Radio" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(ActionButton, { variant: "icon", children: _jsx(Icon, { type: "heroicons", name: "ellipsis-vertical" }) }) }), _jsx(DropdownMenuContent, { className: "relative", style: { position: "static", transform: "none" }, children: _jsxs(DropdownMenuRadioGroup, { value: "light", children: [_jsx(DropdownMenuRadioItem, { value: "unselected", children: "Option Description" }), _jsx(DropdownMenuRadioItem, { value: "unselected2", className: "!bg-[var(--dropdown-menu-hover-bg)]", children: "Option Description (Hover)" }), _jsx(DropdownMenuRadioItem, { value: "light", children: "Option Description (Selected)" }), _jsx(DropdownMenuRadioItem, { value: "dis", disabled: true, children: "Option Description (Disabled)" }), _jsx(DropdownMenuRadioItem, { value: "light", disabled: true, children: "Option Description (Selected + Disabled)" })] }) })] })] }), _jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "Interactive \u2014 Theme" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", children: ["Theme: ", theme] }) }), _jsxs(DropdownMenuContent, { children: [_jsx(DropdownMenuLabel, { children: "Theme" }), _jsxs(DropdownMenuRadioGroup, { value: theme, onValueChange: setTheme, children: [_jsx(DropdownMenuRadioItem, { value: "light", children: "Light" }), _jsx(DropdownMenuRadioItem, { value: "dark", children: "Dark" }), _jsx(DropdownMenuRadioItem, { value: "system", children: "System" })] })] })] })] }), _jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "Interactive \u2014 Multiple Groups" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Open Menu" }) }), _jsxs(DropdownMenuContent, { children: [_jsx(DropdownMenuLabel, { children: "Theme" }), _jsxs(DropdownMenuRadioGroup, { value: theme, onValueChange: setTheme, children: [_jsx(DropdownMenuRadioItem, { value: "light", children: "Light" }), _jsx(DropdownMenuRadioItem, { value: "dark", children: "Dark" }), _jsx(DropdownMenuRadioItem, { value: "system", children: "System" })] }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuLabel, { children: "Position" }), _jsxs(DropdownMenuRadioGroup, { value: position, onValueChange: setPosition, children: [_jsx(DropdownMenuRadioItem, { value: "top", children: "Top" }), _jsx(DropdownMenuRadioItem, { value: "bottom", children: "Bottom" }), _jsx(DropdownMenuRadioItem, { value: "right", children: "Right" })] })] })] })] })] }));
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
// ---------------------------------------------------------------------------
|
|
110
|
+
// Radio with Icon — single select with leading icon via icon prop
|
|
111
|
+
// ---------------------------------------------------------------------------
|
|
112
|
+
export const WithRadioAndIcon = {
|
|
113
|
+
name: "With Radio + Icon",
|
|
114
|
+
render: () => {
|
|
115
|
+
const [theme, setTheme] = useState("dark");
|
|
116
|
+
return (_jsxs("div", { className: "flex gap-8 items-start flex-wrap", children: [_jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "All States \u2014 Radio + Icon" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(ActionButton, { variant: "icon", children: _jsx(Icon, { type: "heroicons", name: "ellipsis-vertical" }) }) }), _jsx(DropdownMenuContent, { className: "relative", style: { position: "static", transform: "none" }, children: _jsxs(DropdownMenuRadioGroup, { value: "dark", children: [_jsx(DropdownMenuRadioItem, { value: "light", icon: _jsx(Icon, { type: "heroicons", name: "sun", className: "size-4 shrink-0" }), children: "Light" }), _jsx(DropdownMenuRadioItem, { value: "system", className: "!bg-[var(--dropdown-menu-hover-bg)]", icon: _jsx(Icon, { type: "heroicons", name: "computer-desktop", className: "size-4 shrink-0" }), children: "System (Hover)" }), _jsx(DropdownMenuRadioItem, { value: "dark", icon: _jsx(Icon, { type: "heroicons", name: "moon", className: "size-4 shrink-0" }), children: "Dark (Selected)" }), _jsx(DropdownMenuRadioItem, { value: "custom", disabled: true, icon: _jsx(Icon, { type: "heroicons", name: "paint-brush", className: "size-4 shrink-0" }), children: "Custom (Disabled)" }), _jsx(DropdownMenuRadioItem, { value: "dark", disabled: true, icon: _jsx(Icon, { type: "heroicons", name: "moon", className: "size-4 shrink-0" }), children: "Dark (Selected + Disabled)" })] }) })] })] }), _jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "Interactive" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", children: ["Theme: ", theme] }) }), _jsxs(DropdownMenuContent, { children: [_jsx(DropdownMenuLabel, { children: "Theme" }), _jsxs(DropdownMenuRadioGroup, { value: theme, onValueChange: setTheme, children: [_jsx(DropdownMenuRadioItem, { value: "light", icon: _jsx(Icon, { type: "heroicons", name: "sun", className: "size-4 shrink-0" }), children: "Light" }), _jsx(DropdownMenuRadioItem, { value: "dark", icon: _jsx(Icon, { type: "heroicons", name: "moon", className: "size-4 shrink-0" }), children: "Dark" }), _jsx(DropdownMenuRadioItem, { value: "system", icon: _jsx(Icon, { type: "heroicons", name: "computer-desktop", className: "size-4 shrink-0" }), children: "System" }), _jsx(DropdownMenuRadioItem, { value: "custom", disabled: true, icon: _jsx(Icon, { type: "heroicons", name: "paint-brush", className: "size-4" }), children: "Custom" })] })] })] })] })] }));
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
// ---------------------------------------------------------------------------
|
|
120
|
+
// DropdownMenuShortcut — keyboard shortcut label on the right side of item
|
|
121
|
+
// ---------------------------------------------------------------------------
|
|
122
|
+
export const WithShortcut = {
|
|
123
|
+
name: "With Shortcut",
|
|
124
|
+
render: () => (_jsxs("div", { className: "flex gap-8 items-start flex-wrap", children: [_jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "All States \u2014 Shortcut" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(ActionButton, { variant: "icon", children: _jsx(Icon, { type: "heroicons", name: "ellipsis-vertical" }) }) }), _jsxs(DropdownMenuContent, { className: "relative", style: { position: "static", transform: "none" }, children: [_jsxs(DropdownMenuItem, { children: ["New Tab", _jsx(DropdownMenuShortcut, { children: "\u2318T" })] }), _jsxs(DropdownMenuItem, { className: "!bg-[var(--dropdown-menu-hover-bg)]", children: ["New Window (Hover)", _jsx(DropdownMenuShortcut, { children: "\u2318N" })] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { children: [_jsx(Icon, { type: "heroicons", name: "pencil", className: "size-4 shrink-0" }), "Edit", _jsx(DropdownMenuShortcut, { children: "\u2318E" })] }), _jsxs(DropdownMenuItem, { children: [_jsx(Icon, { type: "heroicons", name: "document-duplicate", className: "size-4 shrink-0" }), "Duplicate", _jsx(DropdownMenuShortcut, { children: "\u2318D" })] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { disabled: true, children: [_jsx(Icon, { type: "heroicons", name: "trash", className: "size-4 shrink-0" }), "Delete", _jsx(DropdownMenuShortcut, { children: "\u232B" })] })] })] })] }), _jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "Interactive" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Open Menu" }) }), _jsxs(DropdownMenuContent, { className: "w-52", children: [_jsx(DropdownMenuLabel, { children: "Actions" }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { children: ["New Tab", _jsx(DropdownMenuShortcut, { children: "\u2318T" })] }), _jsxs(DropdownMenuItem, { children: ["New Window", _jsx(DropdownMenuShortcut, { children: "\u2318N" })] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { children: [_jsx(Icon, { type: "heroicons", name: "pencil", className: "size-4 shrink-0" }), "Edit", _jsx(DropdownMenuShortcut, { children: "\u2318E" })] }), _jsxs(DropdownMenuItem, { children: [_jsx(Icon, { type: "heroicons", name: "document-duplicate", className: "size-4 shrink-0" }), "Duplicate", _jsx(DropdownMenuShortcut, { children: "\u2318D" })] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { disabled: true, children: [_jsx(Icon, { type: "heroicons", name: "trash", className: "size-4 shrink-0" }), "Delete", _jsx(DropdownMenuShortcut, { children: "\u232B" })] })] })] })] })] })),
|
|
97
125
|
};
|
|
98
126
|
// ---------------------------------------------------------------------------
|
|
99
127
|
// Trigger variants (on icon button, etc.)
|
|
@@ -102,3 +130,19 @@ export const TriggerVariants = {
|
|
|
102
130
|
name: "Trigger Variants",
|
|
103
131
|
render: () => (_jsxs("div", { className: "flex gap-8 items-center flex-wrap", children: [_jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "Text Trigger" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { children: "Open" }), _jsxs(DropdownMenuContent, { children: [_jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" })] })] })] }), _jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "Button Trigger" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Open Menu" }) }), _jsxs(DropdownMenuContent, { children: [_jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" })] })] })] }), _jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "Icon Button Trigger" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(ActionButton, { variant: "icon", children: _jsx(Icon, { type: "heroicons", name: "ellipsis-vertical" }) }) }), _jsxs(DropdownMenuContent, { children: [_jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" })] })] })] }), _jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "Horizontal dots" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(ActionButton, { variant: "icon", children: _jsx(Icon, { type: "heroicons", name: "ellipsis-horizontal" }) }) }), _jsxs(DropdownMenuContent, { children: [_jsxs(DropdownMenuItem, { children: [_jsx(Icon, { type: "heroicons", name: "pencil", className: "size-4 shrink-0" }), "Edit"] }), _jsxs(DropdownMenuItem, { children: [_jsx(Icon, { type: "heroicons", name: "document-duplicate", className: "size-4 shrink-0" }), "Duplicate"] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { disabled: true, children: [_jsx(Icon, { type: "heroicons", name: "trash", className: "size-4 shrink-0" }), "Delete"] })] })] })] })] })),
|
|
104
132
|
};
|
|
133
|
+
// ---------------------------------------------------------------------------
|
|
134
|
+
// Complex showcase — real-world patterns combining all item types
|
|
135
|
+
// ---------------------------------------------------------------------------
|
|
136
|
+
export const ComplexShowcase = {
|
|
137
|
+
name: "Complex Showcase",
|
|
138
|
+
render: () => {
|
|
139
|
+
const [theme, setTheme] = useState("dark");
|
|
140
|
+
const [density, setDensity] = useState("comfortable");
|
|
141
|
+
const [sortBy, setSortBy] = useState("name");
|
|
142
|
+
const [sortDir, setSortDir] = useState("asc");
|
|
143
|
+
const [showHidden, setShowHidden] = useState(false);
|
|
144
|
+
const [showExtensions, setShowExtensions] = useState(true);
|
|
145
|
+
const [showPreview, setShowPreview] = useState(true);
|
|
146
|
+
return (_jsxs("div", { className: "flex gap-8 items-start flex-wrap", children: [_jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "File Manager Actions" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(ActionButton, { variant: "icon", children: _jsx(Icon, { type: "heroicons", name: "ellipsis-vertical" }) }) }), _jsxs(DropdownMenuContent, { className: "relative w-[220px]", style: { position: "static", transform: "none" }, children: [_jsx(DropdownMenuItem, { icon: _jsx(Icon, { type: "heroicons", name: "pencil", className: "size-4 shrink-0" }), children: "Rename" }), _jsx(DropdownMenuItem, { icon: _jsx(Icon, { type: "heroicons", name: "document-duplicate", className: "size-4 shrink-0" }), children: "Duplicate" }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuLabel, { children: "Sort By" }), _jsxs(DropdownMenuRadioGroup, { value: "name", children: [_jsx(DropdownMenuRadioItem, { value: "name", children: "Name" }), _jsx(DropdownMenuRadioItem, { value: "date", children: "Date Modified" }), _jsx(DropdownMenuRadioItem, { value: "size", children: "Size" })] }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuLabel, { children: "Show" }), _jsx(DropdownMenuCheckboxItem, { children: "Hidden Files" }), _jsx(DropdownMenuCheckboxItem, { checked: true, children: "File Extensions" }), _jsx(DropdownMenuCheckboxItem, { checked: true, children: "Preview Panel" }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { disabled: true, icon: _jsx(Icon, { type: "heroicons", name: "trash", className: "size-4 shrink-0" }), children: "Delete" })] })] })] }), _jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "Editor Settings (Multiple RadioGroups)" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(ActionButton, { variant: "icon", children: _jsx(Icon, { type: "heroicons", name: "cog-6-tooth" }) }) }), _jsxs(DropdownMenuContent, { className: "relative w-[220px]", style: { position: "static", transform: "none" }, children: [_jsx(DropdownMenuLabel, { children: "Theme" }), _jsxs(DropdownMenuRadioGroup, { value: "dark", children: [_jsx(DropdownMenuRadioItem, { value: "light", icon: _jsx(Icon, { type: "heroicons", name: "sun", className: "size-4 shrink-0" }), children: "Light" }), _jsx(DropdownMenuRadioItem, { value: "dark", icon: _jsx(Icon, { type: "heroicons", name: "moon", className: "size-4 shrink-0" }), children: "Dark" }), _jsx(DropdownMenuRadioItem, { value: "system", icon: _jsx(Icon, { type: "heroicons", name: "computer-desktop", className: "size-4 shrink-0" }), children: "System" })] }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuLabel, { children: "Density" }), _jsxs(DropdownMenuRadioGroup, { value: "comfortable", children: [_jsx(DropdownMenuRadioItem, { value: "compact", children: "Compact" }), _jsx(DropdownMenuRadioItem, { value: "comfortable", children: "Comfortable" }), _jsx(DropdownMenuRadioItem, { value: "spacious", children: "Spacious" })] }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuLabel, { children: "Sort Direction" }), _jsxs(DropdownMenuRadioGroup, { value: "asc", children: [_jsx(DropdownMenuRadioItem, { value: "asc", icon: _jsx(Icon, { type: "heroicons", name: "bars-arrow-up", className: "size-4 shrink-0" }), children: "Ascending" }), _jsx(DropdownMenuRadioItem, { value: "desc", icon: _jsx(Icon, { type: "heroicons", name: "bars-arrow-down", className: "size-4 shrink-0" }), children: "Descending" })] })] })] })] }), _jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "Interactive \u2014 File Manager" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Options" }) }), _jsxs(DropdownMenuContent, { className: "w-[220px]", children: [_jsx(DropdownMenuItem, { icon: _jsx(Icon, { type: "heroicons", name: "pencil", className: "size-4 shrink-0" }), children: "Rename" }), _jsx(DropdownMenuItem, { icon: _jsx(Icon, { type: "heroicons", name: "document-duplicate", className: "size-4 shrink-0" }), children: "Duplicate" }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuLabel, { children: "Sort By" }), _jsxs(DropdownMenuRadioGroup, { value: sortBy, onValueChange: setSortBy, children: [_jsx(DropdownMenuRadioItem, { value: "name", children: "Name" }), _jsx(DropdownMenuRadioItem, { value: "date", children: "Date Modified" }), _jsx(DropdownMenuRadioItem, { value: "size", children: "Size" })] }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuLabel, { children: "Show" }), _jsx(DropdownMenuCheckboxItem, { checked: showHidden, onCheckedChange: setShowHidden, onSelect: (e) => e.preventDefault(), children: "Hidden Files" }), _jsx(DropdownMenuCheckboxItem, { checked: showExtensions, onCheckedChange: setShowExtensions, onSelect: (e) => e.preventDefault(), children: "File Extensions" }), _jsx(DropdownMenuCheckboxItem, { checked: showPreview, onCheckedChange: setShowPreview, onSelect: (e) => e.preventDefault(), children: "Preview Panel" }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { disabled: true, icon: _jsx(Icon, { type: "heroicons", name: "trash", className: "size-4 shrink-0" }), children: "Delete" })] })] })] }), _jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "Interactive \u2014 Editor Settings" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Settings" }) }), _jsxs(DropdownMenuContent, { className: "w-[220px]", children: [_jsx(DropdownMenuLabel, { children: "Theme" }), _jsxs(DropdownMenuRadioGroup, { value: theme, onValueChange: setTheme, children: [_jsx(DropdownMenuRadioItem, { value: "light", icon: _jsx(Icon, { type: "heroicons", name: "sun", className: "size-4 shrink-0" }), children: "Light" }), _jsx(DropdownMenuRadioItem, { value: "dark", icon: _jsx(Icon, { type: "heroicons", name: "moon", className: "size-4 shrink-0" }), children: "Dark" }), _jsx(DropdownMenuRadioItem, { value: "system", icon: _jsx(Icon, { type: "heroicons", name: "computer-desktop", className: "size-4 shrink-0" }), children: "System" })] }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuLabel, { children: "Density" }), _jsxs(DropdownMenuRadioGroup, { value: density, onValueChange: setDensity, children: [_jsx(DropdownMenuRadioItem, { value: "compact", children: "Compact" }), _jsx(DropdownMenuRadioItem, { value: "comfortable", children: "Comfortable" }), _jsx(DropdownMenuRadioItem, { value: "spacious", children: "Spacious" })] }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuLabel, { children: "Sort Direction" }), _jsxs(DropdownMenuRadioGroup, { value: sortDir, onValueChange: setSortDir, children: [_jsx(DropdownMenuRadioItem, { value: "asc", icon: _jsx(Icon, { type: "heroicons", name: "bars-arrow-up", className: "size-4 shrink-0" }), children: "Ascending" }), _jsx(DropdownMenuRadioItem, { value: "desc", icon: _jsx(Icon, { type: "heroicons", name: "bars-arrow-down", className: "size-4 shrink-0" }), children: "Descending" })] })] })] })] })] }));
|
|
147
|
+
},
|
|
148
|
+
};
|
|
@@ -10,7 +10,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { forwardRef, useCallback,
|
|
13
|
+
import { forwardRef, useCallback, useMemo, useRef, } from "react";
|
|
14
|
+
import { useStableMergedRef } from "@/utils/mergeRefs";
|
|
14
15
|
import { helperTextVariant, iconActionVariant, inlineEndIconWrapperVariant, inlineStartIconWrapperVariant, inputVariant, labelVariant, searchIconVariant, segmentedIconWrapperVariant, } from "./TextInput.styles";
|
|
15
16
|
import { CircleAlert, CircleX, Search, } from "lucide-react";
|
|
16
17
|
import { cn } from "@/utils/cn";
|
|
@@ -18,6 +19,9 @@ export const TextInput = forwardRef((_a, ref) => {
|
|
|
18
19
|
var { id, label, size = "md", rounded = "normal", variant = "outline", type = "text", iconMode = "solid", helperText, errorMessage, warningMessage, status, fullwidth = true, disabled = false, error = false, warning = false, required = true, isFloatingLabel = true, keepCloseIconOnValue = false, keepFooterSpace = true, hasClearIcon = true, hasSearchIcon = false, startIcon, endIcon, labelClassName, onClickStartIcon, onClickEndIcon, renderStartIcon, renderEndIcon, classes, normalize, format, trimOnCommit, normalizeOnCommit } = _a, props = __rest(_a, ["id", "label", "size", "rounded", "variant", "type", "iconMode", "helperText", "errorMessage", "warningMessage", "status", "fullwidth", "disabled", "error", "warning", "required", "isFloatingLabel", "keepCloseIconOnValue", "keepFooterSpace", "hasClearIcon", "hasSearchIcon", "startIcon", "endIcon", "labelClassName", "onClickStartIcon", "onClickEndIcon", "renderStartIcon", "renderEndIcon", "classes", "normalize", "format", "trimOnCommit", "normalizeOnCommit"]);
|
|
19
20
|
const inputRef = useRef(null);
|
|
20
21
|
const _id = id || `${type}-${label}-input`;
|
|
22
|
+
// Stable merged ref — identity never changes so Headless UI (or any library
|
|
23
|
+
// that watches refs) won't trigger detach/re-attach loops.
|
|
24
|
+
const stableRef = useStableMergedRef(ref, inputRef);
|
|
21
25
|
const hasLeftSectionIcon = !!startIcon || !!renderStartIcon;
|
|
22
26
|
const hasRightSectionIcon = !!endIcon || !!renderEndIcon;
|
|
23
27
|
const feedbackStatus = status ||
|
|
@@ -81,7 +85,6 @@ export const TextInput = forwardRef((_a, ref) => {
|
|
|
81
85
|
warning: isWarning,
|
|
82
86
|
position: "end",
|
|
83
87
|
});
|
|
84
|
-
useImperativeHandle(ref, () => inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
|
|
85
88
|
const handleChange = useCallback((e) => {
|
|
86
89
|
var _a;
|
|
87
90
|
if (normalize) {
|
|
@@ -183,7 +186,7 @@ export const TextInput = forwardRef((_a, ref) => {
|
|
|
183
186
|
renderEndIcon,
|
|
184
187
|
handleOnClickRightSectionIcon,
|
|
185
188
|
]);
|
|
186
|
-
return (_jsxs("div", { className: `inline-flex flex-col ${fullwidth ? "w-full" : ""}`, children: [_jsxs("div", { className: "relative", children: [_jsx("input", Object.assign({}, props, { placeholder: " ", ref:
|
|
189
|
+
return (_jsxs("div", { className: `inline-flex flex-col ${fullwidth ? "w-full" : ""}`, children: [_jsxs("div", { className: "relative", children: [_jsx("input", Object.assign({}, props, { placeholder: " ", ref: stableRef, type: type, id: _id, disabled: disabled, value: displayValue, className: cn(inputClassname, props.className), onChange: normalize ? handleChange : props.onChange, onBlur: trimOnCommit || normalizeOnCommit ? handleBlur : props.onBlur, onKeyDown: trimOnCommit || normalizeOnCommit ? handleKeyDown : props.onKeyDown })), hasSearchIcon && !hasLeftSectionIcon && (_jsx("div", { className: cn(inlineStartIconWrapperClassname, classes === null || classes === void 0 ? void 0 : classes.iconSearchWrapper), children: _jsx(Search, { className: cn(searchIconClassname, classes === null || classes === void 0 ? void 0 : classes.icon) }) })), startIconElement, hasClearIcon && !hasRightSectionIcon && (_jsx("div", { className: cn(inlineEndIconWrapperClassname, classes === null || classes === void 0 ? void 0 : classes.iconWrapper), style: {
|
|
187
190
|
display: keepCloseIconOnValue && props.value ? "flex" : undefined,
|
|
188
191
|
}, children: _jsx(CircleX, { className: cn(iconActionClassname,
|
|
189
192
|
// 'fill-none stroke-current',
|