@rovula/ui 0.1.20 → 0.1.21
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 +141 -17
- package/dist/cjs/bundle.js +3 -3
- package/dist/cjs/bundle.js.map +1 -1
- package/dist/cjs/types/components/DropdownMenu/DropdownMenu.stories.d.ts +29 -30
- package/dist/cjs/types/components/Form/Form.d.ts +2 -1
- package/dist/cjs/types/components/Form/Form.stories.d.ts +4 -0
- package/dist/cjs/types/components/ScrollArea/ScrollArea.d.ts +38 -0
- package/dist/cjs/types/components/ScrollArea/ScrollArea.stories.d.ts +301 -0
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/components/DropdownMenu/DropdownMenu.js +7 -9
- package/dist/components/DropdownMenu/DropdownMenu.stories.js +79 -91
- package/dist/components/Form/Form.js +11 -4
- package/dist/components/Form/Form.stories.js +27 -0
- package/dist/components/ScrollArea/ScrollArea.js +50 -0
- package/dist/components/ScrollArea/ScrollArea.stories.js +56 -0
- package/dist/esm/bundle.css +141 -17
- package/dist/esm/bundle.js +3 -3
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/types/components/DropdownMenu/DropdownMenu.stories.d.ts +29 -30
- package/dist/esm/types/components/Form/Form.d.ts +2 -1
- package/dist/esm/types/components/Form/Form.stories.d.ts +4 -0
- package/dist/esm/types/components/ScrollArea/ScrollArea.d.ts +38 -0
- package/dist/esm/types/components/ScrollArea/ScrollArea.stories.d.ts +301 -0
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/index.d.ts +41 -2
- package/dist/index.js +1 -0
- package/dist/src/theme/global.css +196 -20
- package/package.json +1 -1
- package/src/components/DropdownMenu/DropdownMenu.stories.tsx +482 -297
- package/src/components/DropdownMenu/DropdownMenu.tsx +7 -8
- package/src/components/Form/Form.stories.tsx +70 -0
- package/src/components/Form/Form.tsx +23 -0
- package/src/components/ScrollArea/ScrollArea.stories.tsx +229 -0
- package/src/components/ScrollArea/ScrollArea.tsx +72 -0
- package/src/index.ts +1 -0
- package/src/theme/global.css +84 -11
- package/src/theme/themes/xspector/baseline.css +1 -0
- package/src/theme/themes/xspector/components/dropdown-menu.css +2 -2
- package/src/theme/themes/xspector/components/scrollbar.css +12 -0
- package/src/theme/tokens/baseline.css +2 -1
- package/src/theme/tokens/components/dropdown-menu.css +1 -1
- package/src/theme/tokens/components/scrollbar.css +18 -0
|
@@ -1,116 +1,104 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
2
3
|
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, } from "./DropdownMenu";
|
|
3
4
|
import Button from "../Button/Button";
|
|
4
|
-
import Icon from "../Icon/Icon";
|
|
5
5
|
import ActionButton from "../ActionButton/ActionButton";
|
|
6
|
+
import Icon from "../Icon/Icon";
|
|
7
|
+
import { Input } from "../Input/Input";
|
|
6
8
|
const meta = {
|
|
7
9
|
title: "Components/DropdownMenu",
|
|
8
10
|
component: DropdownMenu,
|
|
9
|
-
// tags: ["autodocs"],
|
|
10
11
|
parameters: {
|
|
11
12
|
layout: "fullscreen",
|
|
12
13
|
},
|
|
13
14
|
decorators: [
|
|
14
|
-
(Story) => (_jsx("div", { className: "p-
|
|
15
|
+
(Story) => (_jsx("div", { className: "p-10 flex gap-8 flex-wrap bg-workspace-surface min-h-screen", children: _jsx(Story, {}) })),
|
|
15
16
|
],
|
|
16
17
|
};
|
|
17
18
|
export default meta;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
render: (
|
|
25
|
-
console.log("args ", args);
|
|
26
|
-
const props = Object.assign({}, args);
|
|
27
|
-
return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsx("div", { className: "flex flex-1 justify-center items-center space-x-2", children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { children: "Open" }), _jsxs(DropdownMenuContent, { children: [_jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { disabled: true, children: "Option Description" }), _jsxs(DropdownMenuItem, { children: [_jsx(Icon, { type: "heroicons", name: "check", className: "size-4" }), "Option Description"] }), _jsx(DropdownMenuItem, { children: "Option Description" })] })] }) }) }));
|
|
28
|
-
},
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
// Figma: Normal dropdown / action menu
|
|
21
|
+
// Shows all item states: Default, Hover (focus), Selected, Disabled, Selected+Disabled
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
export const AllStates = {
|
|
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, { open: true, 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(DropdownMenuCheckboxItem, { checked: true, children: "Option Description" }), _jsx(DropdownMenuItem, { 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(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuCheckboxItem, { checked: true, children: "Option Description" }), _jsx(DropdownMenuItem, { disabled: true, children: "Option Description" }), _jsx(DropdownMenuCheckboxItem, { checked: true, disabled: true, children: "Option Description" })] })] })] })] })),
|
|
29
26
|
};
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
// Figma: Have icon
|
|
29
|
+
// Items with leading icon
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
30
31
|
export const WithIcon = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// value: "Lorem Ipsum",
|
|
34
|
-
// fullwidth: true,
|
|
35
|
-
},
|
|
36
|
-
render: (args) => {
|
|
37
|
-
console.log("args ", args);
|
|
38
|
-
const props = Object.assign({}, args);
|
|
39
|
-
return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsx("div", { className: "flex flex-1 justify-center items-center space-x-2", children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Open" }) }), _jsxs(DropdownMenuContent, { children: [_jsxs(DropdownMenuItem, { children: [_jsx(Icon, { type: "heroicons", name: "rocket-launch", className: "size-4" }), _jsx("span", { children: "Option Description" })] }), _jsxs(DropdownMenuItem, { children: [_jsx(Icon, { type: "heroicons", name: "rocket-launch", className: "size-4" }), _jsx("span", { children: "Option Description" })] }), _jsxs(DropdownMenuItem, { disabled: true, children: [_jsx(Icon, { type: "heroicons", name: "rocket-launch", className: "size-4" }), _jsx("span", { children: "Option Description" })] })] })] }) }) }));
|
|
40
|
-
},
|
|
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, { open: true, 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: [_jsx(Icon, { type: "heroicons", name: "rocket-launch", className: "size-4 shrink-0" }), "Option Description"] }), _jsxs(DropdownMenuItem, { className: "!bg-[var(--dropdown-menu-hover-bg)]", children: [_jsx(Icon, { type: "heroicons", name: "rocket-launch", className: "size-4 shrink-0" }), "Option Description (Hover)"] }), _jsxs(DropdownMenuCheckboxItem, { checked: true, children: [_jsx(Icon, { type: "heroicons", name: "rocket-launch", className: "size-4 shrink-0" }), "Option Description"] }), _jsxs(DropdownMenuItem, { disabled: true, children: [_jsx(Icon, { type: "heroicons", name: "rocket-launch", className: "size-4 shrink-0" }), "Option Description"] }), _jsxs(DropdownMenuCheckboxItem, { checked: true, disabled: true, children: [_jsx(Icon, { type: "heroicons", name: "rocket-launch", className: "size-4 shrink-0" }), "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: [_jsxs(DropdownMenuItem, { children: [_jsx(Icon, { type: "heroicons", name: "rocket-launch", className: "size-4 shrink-0" }), "Option Description"] }), _jsxs(DropdownMenuItem, { children: [_jsx(Icon, { type: "heroicons", name: "pencil", className: "size-4 shrink-0" }), "Option Description"] }), _jsxs(DropdownMenuItem, { children: [_jsx(Icon, { type: "heroicons", name: "trash", className: "size-4 shrink-0" }), "Option Description"] }), _jsxs(DropdownMenuItem, { disabled: true, children: [_jsx(Icon, { type: "heroicons", name: "arrow-path", className: "size-4 shrink-0" }), "Option Description"] })] })] })] })] })),
|
|
41
34
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
return (
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
// Figma: Checkbox items (Have icon=No, Checkbox=Yes)
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
export const WithCheckbox = {
|
|
39
|
+
name: "With Checkbox",
|
|
40
|
+
render: () => {
|
|
41
|
+
const [checked1, setChecked1] = useState(false);
|
|
42
|
+
const [checked2, setChecked2] = useState(true);
|
|
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, { open: true, 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" })] })] })] })] }));
|
|
52
45
|
},
|
|
53
46
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
-
render: (args) => {
|
|
61
|
-
console.log("args ", args);
|
|
62
|
-
const props = Object.assign({}, args);
|
|
63
|
-
return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsx("div", { className: "flex flex-1 justify-center items-center space-x-2", children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Open" }) }), _jsxs(DropdownMenuContent, { children: [_jsx(DropdownMenuCheckboxItem, { children: "Option Description" }), _jsx(DropdownMenuCheckboxItem, { checked: true, children: "Option Description" }), _jsx(DropdownMenuCheckboxItem, { disabled: true, children: "Option Description" }), _jsx(DropdownMenuCheckboxItem, { checked: true, disabled: true, children: "Option Description" }), _jsxs(DropdownMenuCheckboxItem, { children: [_jsx(Icon, { type: "heroicons", name: "rocket-launch", className: "size-4" }), _jsx("span", { children: "Option Description" })] }), _jsxs(DropdownMenuCheckboxItem, { checked: true, children: [_jsx(Icon, { type: "heroicons", name: "rocket-launch", className: "size-4" }), _jsx("span", { children: "Option Description" })] }), _jsxs(DropdownMenuCheckboxItem, { disabled: true, children: [_jsx(Icon, { type: "heroicons", name: "rocket-launch", className: "size-4" }), _jsx("span", { children: "Option Description" })] }), _jsxs(DropdownMenuCheckboxItem, { checked: true, disabled: true, children: [_jsx(Icon, { type: "heroicons", name: "rocket-launch", className: "size-4" }), _jsx("span", { children: "Option Description" })] })] })] }) }) }));
|
|
64
|
-
},
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
// Figma: Have section (DropdownMenuLabel as section header)
|
|
49
|
+
// ---------------------------------------------------------------------------
|
|
50
|
+
export const WithSection = {
|
|
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, { open: true, 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" })] })] })] })] })),
|
|
65
53
|
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
render: (
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
// Figma: Have search
|
|
56
|
+
// Dropdown with search input at the top
|
|
57
|
+
// ---------------------------------------------------------------------------
|
|
58
|
+
export const WithSearch = {
|
|
59
|
+
name: "Have Search",
|
|
60
|
+
render: () => {
|
|
61
|
+
const [query, setQuery] = useState("");
|
|
62
|
+
const allOptions = [
|
|
63
|
+
"Option Description",
|
|
64
|
+
"Project Alpha",
|
|
65
|
+
"Project Beta",
|
|
66
|
+
"Project Gamma",
|
|
67
|
+
"Project Delta",
|
|
68
|
+
"Project Epsilon",
|
|
69
|
+
"Project Zeta",
|
|
70
|
+
"Project Eta",
|
|
71
|
+
"Project Theta",
|
|
72
|
+
];
|
|
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, { open: true, 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" })] })] })] })] }));
|
|
76
75
|
},
|
|
77
76
|
};
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
},
|
|
84
|
-
render: (args) => {
|
|
85
|
-
console.log("args ", args);
|
|
86
|
-
const props = Object.assign({}, args);
|
|
87
|
-
return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsx("div", { className: "flex flex-1 justify-center items-center space-x-2", children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { 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" }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" })] })] }) }) }));
|
|
88
|
-
},
|
|
77
|
+
// ---------------------------------------------------------------------------
|
|
78
|
+
// Figma: Can scroll — long list, overflow-y scrollable
|
|
79
|
+
// ---------------------------------------------------------------------------
|
|
80
|
+
export const CanScroll = {
|
|
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, { open: true, 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))) })] })] })] })),
|
|
89
83
|
};
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
},
|
|
96
|
-
render: (args) => {
|
|
97
|
-
console.log("args ", args);
|
|
98
|
-
const props = Object.assign({}, args);
|
|
99
|
-
return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsx("div", { className: "flex flex-1 justify-center items-center space-x-2", children: _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" }), _jsx(DropdownMenuItem, { children: "Option Description" }), _jsx(DropdownMenuItem, { children: "Option Description" })] })] }) }) }));
|
|
100
|
-
},
|
|
84
|
+
// ---------------------------------------------------------------------------
|
|
85
|
+
// Figma: Double scroll — two separate scrollable sections with section headers
|
|
86
|
+
// ---------------------------------------------------------------------------
|
|
87
|
+
export const DoubleScroll = {
|
|
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, { open: true, 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))) })] })] })] })] })),
|
|
101
90
|
};
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
},
|
|
91
|
+
// ---------------------------------------------------------------------------
|
|
92
|
+
// Figma: Sub menu (existing, preserved)
|
|
93
|
+
// ---------------------------------------------------------------------------
|
|
94
|
+
export const SubMenu = {
|
|
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" })] })] })] })),
|
|
97
|
+
};
|
|
98
|
+
// ---------------------------------------------------------------------------
|
|
99
|
+
// Trigger variants (on icon button, etc.)
|
|
100
|
+
// ---------------------------------------------------------------------------
|
|
101
|
+
export const TriggerVariants = {
|
|
102
|
+
name: "Trigger Variants",
|
|
103
|
+
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"] })] })] })] })] })),
|
|
116
104
|
};
|
|
@@ -9,9 +9,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import React from "react";
|
|
14
|
-
import { FormProvider, useForm, } from "react-hook-form";
|
|
14
|
+
import { FormProvider, useForm, useFormContext, } from "react-hook-form";
|
|
15
15
|
import { yupResolver } from "@hookform/resolvers/yup";
|
|
16
16
|
export const createYupResolver = (schema) => yupResolver(schema);
|
|
17
17
|
export const createControlledForm = ({ methods, defaultValues, controllerRef, }) => {
|
|
@@ -52,8 +52,15 @@ export const useControlledForm = ({ defaultValues, controllerRef, resolver, vali
|
|
|
52
52
|
FormRoot: stableRef.current.FormRoot,
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
|
+
const FormStateObserver = ({ onFormStateChange, }) => {
|
|
56
|
+
const { formState } = useFormContext();
|
|
57
|
+
React.useEffect(() => {
|
|
58
|
+
onFormStateChange(formState);
|
|
59
|
+
}, [formState, onFormStateChange]);
|
|
60
|
+
return null;
|
|
61
|
+
};
|
|
55
62
|
const FormInner = (_a, ref) => {
|
|
56
|
-
var { children, defaultValues, methods: externalMethods, controllerRef, onSubmit, onInvalidSubmit, resolver, validationSchema, mode = "onSubmit", reValidateMode = "onChange", noValidate = true } = _a, formProps = __rest(_a, ["children", "defaultValues", "methods", "controllerRef", "onSubmit", "onInvalidSubmit", "resolver", "validationSchema", "mode", "reValidateMode", "noValidate"]);
|
|
63
|
+
var { children, defaultValues, methods: externalMethods, controllerRef, onSubmit, onInvalidSubmit, onFormStateChange, resolver, validationSchema, mode = "onSubmit", reValidateMode = "onChange", noValidate = true } = _a, formProps = __rest(_a, ["children", "defaultValues", "methods", "controllerRef", "onSubmit", "onInvalidSubmit", "onFormStateChange", "resolver", "validationSchema", "mode", "reValidateMode", "noValidate"]);
|
|
57
64
|
const resolvedResolver = resolver !== null && resolver !== void 0 ? resolver : (validationSchema
|
|
58
65
|
? createYupResolver(validationSchema)
|
|
59
66
|
: undefined);
|
|
@@ -82,7 +89,7 @@ const FormInner = (_a, ref) => {
|
|
|
82
89
|
controllerRef.current = null;
|
|
83
90
|
};
|
|
84
91
|
}, [controllerRef, controller]);
|
|
85
|
-
return (_jsx(FormProvider, Object.assign({}, methods, { children:
|
|
92
|
+
return (_jsx(FormProvider, Object.assign({}, methods, { children: _jsxs("form", Object.assign({}, formProps, { noValidate: noValidate, onSubmit: methods.handleSubmit(onSubmit, onInvalidSubmit), children: [onFormStateChange && (_jsx(FormStateObserver, { onFormStateChange: onFormStateChange })), typeof children === "function" ? children(methods) : children] })) })));
|
|
86
93
|
};
|
|
87
94
|
export const Form = React.forwardRef(FormInner);
|
|
88
95
|
export default Form;
|
|
@@ -162,6 +162,33 @@ export const RenderPropsCodeControl = {
|
|
|
162
162
|
} }), _jsx("div", { className: "flex gap-2", children: _jsx(Button, { type: "submit", disabled: !formState.isValid || formState.isSubmitting, isLoading: formState.isSubmitting, children: "Submit with code" }) })] })) }));
|
|
163
163
|
},
|
|
164
164
|
};
|
|
165
|
+
export const FormStateChangeCallback = {
|
|
166
|
+
args: {},
|
|
167
|
+
render: () => {
|
|
168
|
+
const [isFormValid, setIsFormValid] = useState(false);
|
|
169
|
+
const [isDirty, setIsDirty] = useState(false);
|
|
170
|
+
const [submitCount, setSubmitCount] = useState(0);
|
|
171
|
+
const schema = yup.object({
|
|
172
|
+
title: yup.string().required("Title is required"),
|
|
173
|
+
description: yup
|
|
174
|
+
.string()
|
|
175
|
+
.required("Description is required")
|
|
176
|
+
.min(10, "Description must be at least 10 characters"),
|
|
177
|
+
});
|
|
178
|
+
return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsxs("div", { className: "rounded-md border border-bg-stroke1 bg-bg-bg2 p-3 text-xs text-text-g-contrast-medium space-y-1", children: [_jsxs("div", { children: ["Validity:", " ", _jsx("span", { className: isFormValid ? "text-state-success-default" : "text-state-error-default", children: isFormValid ? "valid" : "invalid" })] }), _jsxs("div", { children: ["Dirty: ", isDirty ? "yes" : "no"] }), _jsxs("div", { children: ["Submit count: ", submitCount] })] }), _jsxs(Form, { className: "flex flex-col gap-3", defaultValues: { title: "", description: "" }, mode: "onTouched", reValidateMode: "onChange", validationSchema: schema, onSubmit: (values) => {
|
|
179
|
+
setSubmitCount((prev) => prev + 1);
|
|
180
|
+
// eslint-disable-next-line no-console
|
|
181
|
+
console.log("Submitted:", values);
|
|
182
|
+
}, onFormStateChange: (formState) => {
|
|
183
|
+
setIsFormValid(formState.isValid);
|
|
184
|
+
setIsDirty(formState.isDirty);
|
|
185
|
+
}, children: [_jsx(Field, { name: "title", component: TextInput, componentProps: { label: "Title", required: true } }), _jsx(Field, { name: "description", component: TextInput, componentProps: {
|
|
186
|
+
label: "Description",
|
|
187
|
+
helperText: "At least 10 characters",
|
|
188
|
+
required: true,
|
|
189
|
+
} }), _jsx(Button, { type: "submit", disabled: !isFormValid, children: "Submit" })] })] }));
|
|
190
|
+
},
|
|
191
|
+
};
|
|
165
192
|
export const HigherLayerCodeControl = {
|
|
166
193
|
args: {},
|
|
167
194
|
render: () => {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import * as React from "react";
|
|
14
|
+
import { cn } from "@/utils/cn";
|
|
15
|
+
const sizeClass = {
|
|
16
|
+
m: "ui-scrollbar ui-scrollbar-m",
|
|
17
|
+
s: "ui-scrollbar ui-scrollbar-s",
|
|
18
|
+
xs: "ui-scrollbar ui-scrollbar-xs",
|
|
19
|
+
};
|
|
20
|
+
const directionClass = {
|
|
21
|
+
vertical: "overflow-y-auto overflow-x-hidden",
|
|
22
|
+
horizontal: "overflow-x-auto overflow-y-hidden",
|
|
23
|
+
both: "overflow-auto",
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* ScrollArea
|
|
27
|
+
*
|
|
28
|
+
* A thin wrapper that applies the design-system scrollbar style to any
|
|
29
|
+
* scrollable container. Use `scrollbarSize` to pick the Figma size variant
|
|
30
|
+
* and `direction` to control which axis scrolls.
|
|
31
|
+
*
|
|
32
|
+
* **Client usage:**
|
|
33
|
+
* ```tsx
|
|
34
|
+
* <ScrollArea className="max-h-[270px]">
|
|
35
|
+
* {items.map(item => <div key={item.id}>{item.label}</div>)}
|
|
36
|
+
* </ScrollArea>
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* For a double-scroll layout (two independent sections inside one dropdown),
|
|
40
|
+
* wrap each section individually:
|
|
41
|
+
* ```tsx
|
|
42
|
+
* <ScrollArea className="max-h-[160px]">...section A items...</ScrollArea>
|
|
43
|
+
* <ScrollArea className="max-h-[160px]">...section B items...</ScrollArea>
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export const ScrollArea = React.forwardRef((_a, ref) => {
|
|
47
|
+
var { className, scrollbarSize = "s", direction = "vertical", children } = _a, props = __rest(_a, ["className", "scrollbarSize", "direction", "children"]);
|
|
48
|
+
return (_jsx("div", Object.assign({ ref: ref, className: cn(directionClass[direction], sizeClass[scrollbarSize], className) }, props, { children: children })));
|
|
49
|
+
});
|
|
50
|
+
ScrollArea.displayName = "ScrollArea";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ScrollArea } from "./ScrollArea";
|
|
3
|
+
const meta = {
|
|
4
|
+
title: "Components/ScrollArea",
|
|
5
|
+
component: ScrollArea,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: "fullscreen",
|
|
8
|
+
},
|
|
9
|
+
decorators: [
|
|
10
|
+
(Story) => (_jsx("div", { className: "p-10 flex gap-8 flex-wrap bg-workspace-surface min-h-screen", children: _jsx(Story, {}) })),
|
|
11
|
+
],
|
|
12
|
+
};
|
|
13
|
+
export default meta;
|
|
14
|
+
const ITEMS = Array.from({ length: 12 }, (_, i) => `Option Description ${i + 1}`);
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
// Size variants (Figma: Size=M / S / XS)
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
export const Sizes = {
|
|
19
|
+
name: "Size Variants",
|
|
20
|
+
render: () => (_jsx("div", { className: "flex gap-10 items-start", children: ["m", "s", "xs"].map((size) => (_jsxs("div", { children: [_jsxs("p", { className: "typography-small4 text-text-g-contrast-medium mb-2 uppercase", children: ["Size ", size] }), _jsx(ScrollArea, { scrollbarSize: size, className: "max-h-[270px] w-[200px] rounded-lg bg-modal-surface", children: ITEMS.map((label) => (_jsx("div", { className: "px-4 py-3 typography-subtitle4 text-text-g-contrast-high", children: label }, label))) })] }, size))) })),
|
|
21
|
+
};
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
// Vertical scroll (Figma: Can Scroll)
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
export const VerticalScroll = {
|
|
26
|
+
name: "Vertical Scroll",
|
|
27
|
+
render: () => (_jsxs("div", { children: [_jsxs("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: ["Single scrollable list \u2014 use", " ", _jsx("code", { className: "text-xs", children: "<ScrollArea className=\"max-h-[...]\">" })] }), _jsx(ScrollArea, { className: "max-h-[270px] w-[230px] rounded-lg bg-modal-surface", children: ITEMS.map((label) => (_jsx("div", { className: "px-4 py-3 typography-subtitle4 text-text-g-contrast-high", children: label }, label))) })] })),
|
|
28
|
+
};
|
|
29
|
+
// ---------------------------------------------------------------------------
|
|
30
|
+
// Horizontal scroll (Figma: Horizontal=Yes)
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
export const HorizontalScroll = {
|
|
33
|
+
name: "Horizontal Scroll",
|
|
34
|
+
render: () => (_jsxs("div", { children: [_jsxs("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: ["Horizontal \u2014 pass", " ", _jsx("code", { className: "text-xs", children: "direction=\"horizontal\"" })] }), _jsx(ScrollArea, { direction: "horizontal", className: "max-w-[300px] rounded-lg bg-modal-surface", children: _jsx("div", { className: "flex", children: ITEMS.map((label) => (_jsx("div", { className: "shrink-0 w-[140px] px-4 py-3 typography-subtitle4 text-text-g-contrast-high border-r border-[var(--dropdown-menu-seperator-bg)]", children: label }, label))) }) })] })),
|
|
35
|
+
};
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
// Double scroll (Figma: Double Scroll — two independent sections)
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
export const DoubleScroll = {
|
|
40
|
+
name: "Double Scroll",
|
|
41
|
+
render: () => (_jsxs("div", { children: [_jsxs("p", { className: "typography-small4 text-text-g-contrast-medium mb-4", children: ["Two independent scrollable sections inside one container.", _jsx("br", {}), "Wrap each section in its own", " ", _jsx("code", { className: "text-xs", children: "<ScrollArea>" }), "."] }), _jsxs("div", { className: "w-[230px] rounded-lg bg-modal-surface overflow-hidden", children: [_jsx("div", { className: "px-3 pt-4 pb-2 typography-small4 text-text-g-contrast-high", children: "Section A" }), _jsx(ScrollArea, { className: "max-h-[160px]", children: ITEMS.slice(0, 8).map((label) => (_jsx("div", { className: "px-4 py-3 typography-subtitle4 text-text-g-contrast-high", children: label }, label))) }), _jsx("div", { className: "h-px bg-[var(--dropdown-menu-seperator-bg)] my-2" }), _jsx("div", { className: "px-3 pt-2 pb-2 typography-small4 text-text-g-contrast-high", children: "Section B" }), _jsx(ScrollArea, { className: "max-h-[160px]", children: ITEMS.slice(0, 8).map((label) => (_jsx("div", { className: "px-4 py-3 typography-subtitle4 text-text-g-contrast-high", children: label }, label))) })] })] })),
|
|
42
|
+
};
|
|
43
|
+
// ---------------------------------------------------------------------------
|
|
44
|
+
// Usage with DropdownMenu (Figma: Can Scroll / Double Scroll in dropdown)
|
|
45
|
+
// ---------------------------------------------------------------------------
|
|
46
|
+
export const WithDropdownMenu = {
|
|
47
|
+
name: "Usage with DropdownMenu",
|
|
48
|
+
render: () => {
|
|
49
|
+
// Inline-import to avoid circular storybook deps — client should import from "@core/ui"
|
|
50
|
+
const { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger,
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
52
|
+
} = require("../DropdownMenu/DropdownMenu");
|
|
53
|
+
const Button = require("../Button/Button").default;
|
|
54
|
+
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: "Can Scroll" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Open Menu" }) }), _jsx(DropdownMenuContent, { children: _jsx(ScrollArea, { className: "max-h-[270px]", children: ITEMS.map((label) => (_jsx(DropdownMenuItem, { children: label }, label))) }) })] })] }), _jsxs("div", { children: [_jsx("p", { className: "typography-small4 text-text-g-contrast-medium mb-2", children: "Double Scroll" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Open Menu" }) }), _jsxs(DropdownMenuContent, { children: [_jsx(DropdownMenuLabel, { children: "Section A" }), _jsx(ScrollArea, { className: "max-h-[160px]", children: ITEMS.slice(0, 8).map((label) => (_jsx(DropdownMenuItem, { children: label }, label))) }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuLabel, { children: "Section B" }), _jsx(ScrollArea, { className: "max-h-[160px]", children: ITEMS.slice(0, 8).map((label) => (_jsx(DropdownMenuItem, { children: label }, label))) })] })] })] })] }));
|
|
55
|
+
},
|
|
56
|
+
};
|