@boxcustodia/library 2.0.0-alpha.12 → 2.0.0-alpha.14
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/index.cjs.js +1 -138
- package/dist/index.d.ts +1087 -720
- package/dist/index.es.js +7011 -56097
- package/dist/theme.css +1 -1
- package/package.json +34 -26
- package/src/__doc__/Examples.tsx +1 -1
- package/src/__doc__/Intro.mdx +3 -3
- package/src/__doc__/Tabs.mdx +112 -0
- package/src/__doc__/V2.mdx +1246 -0
- package/src/components/accordion/accordion.stories.tsx +143 -0
- package/src/components/accordion/accordion.tsx +135 -0
- package/src/components/accordion/index.ts +1 -0
- package/src/components/alert/alert.stories.tsx +24 -4
- package/src/components/alert/alert.tsx +17 -9
- package/src/components/alert-dialog/alert-dialog.stories.tsx +24 -0
- package/src/components/alert-dialog/alert-dialog.test.tsx +1 -1
- package/src/components/alert-dialog/alert-dialog.tsx +58 -10
- package/src/components/auto-complete/auto-complete.stories.tsx +616 -200
- package/src/components/auto-complete/auto-complete.tsx +420 -68
- package/src/components/auto-complete/index.ts +0 -1
- package/src/components/avatar/avatar.stories.tsx +162 -21
- package/src/components/avatar/avatar.tsx +79 -20
- package/src/components/button/button.stories.tsx +219 -294
- package/src/components/button/button.test.tsx +10 -17
- package/src/components/button/button.tsx +78 -19
- package/src/components/button/components/base-button.tsx +30 -53
- package/src/components/button/index.ts +0 -1
- package/src/components/calendar/calendar.stories.tsx +1 -1
- package/src/components/calendar/calendar.tsx +4 -4
- package/src/components/card/card.stories.tsx +141 -69
- package/src/components/card/card.tsx +155 -54
- package/src/components/center/center.stories.tsx +22 -39
- package/src/components/checkbox/checkbox.stories.tsx +25 -5
- package/src/components/checkbox/checkbox.tsx +76 -15
- package/src/components/checkbox-group/checkbox-group.stories.tsx +116 -28
- package/src/components/checkbox-group/checkbox-group.tsx +84 -3
- package/src/components/combobox/combobox.stories.tsx +33 -23
- package/src/components/combobox/combobox.tsx +99 -77
- package/src/components/date-picker/date-input.stories.tsx +14 -6
- package/src/components/date-picker/date-input.tsx +2 -2
- package/src/components/date-picker/date-picker.model.ts +13 -4
- package/src/components/date-picker/date-picker.stories.tsx +38 -12
- package/src/components/date-picker/date-picker.tsx +28 -14
- package/src/components/dialog/dialog.stories.tsx +18 -0
- package/src/components/dialog/dialog.test.tsx +1 -1
- package/src/components/dialog/dialog.tsx +51 -20
- package/src/components/divider/divider.stories.tsx +126 -51
- package/src/components/divider/divider.tsx +16 -16
- package/src/components/dropzone/dropzone.stories.tsx +71 -90
- package/src/components/dropzone/dropzone.tsx +383 -105
- package/src/components/dropzone/index.ts +0 -1
- package/src/components/empty/empty.stories.tsx +165 -0
- package/src/components/empty/empty.tsx +156 -0
- package/src/components/empty/index.ts +1 -0
- package/src/components/field/field.stories.tsx +227 -4
- package/src/components/field/field.tsx +77 -42
- package/src/components/form/form.stories.tsx +320 -197
- package/src/components/form/form.tsx +3 -23
- package/src/components/index.ts +2 -6
- package/src/components/input/input.stories.tsx +5 -5
- package/src/components/input/input.tsx +4 -4
- package/src/components/kbd/kbd.stories.tsx +1 -0
- package/src/components/label/label.stories.tsx +16 -0
- package/src/components/label/label.tsx +13 -2
- package/src/components/loader/loader.stories.tsx +7 -5
- package/src/components/loader/loader.tsx +8 -3
- package/src/components/menu/menu-primitives.tsx +207 -196
- package/src/components/menu/menu.stories.tsx +276 -146
- package/src/components/menu/menu.tsx +146 -54
- package/src/components/number-input/number-input.stories.tsx +27 -4
- package/src/components/number-input/number-input.test.tsx +2 -2
- package/src/components/number-input/number-input.tsx +31 -33
- package/src/components/otp/index.ts +1 -0
- package/src/components/otp/otp.stories.tsx +209 -0
- package/src/components/otp/otp.tsx +100 -0
- package/src/components/pagination/index.ts +1 -0
- package/src/components/pagination/pagination.model.ts +2 -0
- package/src/components/pagination/pagination.stories.tsx +154 -59
- package/src/components/pagination/pagination.test.tsx +122 -57
- package/src/components/pagination/pagination.tsx +575 -77
- package/src/components/password/password.stories.tsx +18 -3
- package/src/components/password/password.tsx +29 -9
- package/src/components/popover/popover.stories.tsx +26 -5
- package/src/components/popover/popover.tsx +15 -23
- package/src/components/progress/progress.stories.tsx +1 -0
- package/src/components/radio-group/index.ts +1 -0
- package/src/components/radio-group/radio-group.stories.tsx +251 -0
- package/src/components/radio-group/radio-group.tsx +212 -0
- package/src/components/scroll-area/scroll-area.stories.tsx +1 -0
- package/src/components/select/select.stories.tsx +118 -19
- package/src/components/select/select.tsx +67 -62
- package/src/components/skeleton/skeleton.stories.tsx +1 -0
- package/src/components/stack/stack.stories.tsx +179 -89
- package/src/components/stack/stack.tsx +2 -2
- package/src/components/stepper/index.ts +1 -1
- package/src/components/stepper/stepper.stories.tsx +767 -83
- package/src/components/stepper/stepper.test.tsx +18 -18
- package/src/components/stepper/stepper.tsx +554 -0
- package/src/components/switch/switch.stories.tsx +15 -1
- package/src/components/switch/switch.tsx +17 -4
- package/src/components/table/index.ts +0 -2
- package/src/components/table/table.stories.tsx +131 -18
- package/src/components/table/table.test.tsx +1 -1
- package/src/components/table/table.tsx +183 -77
- package/src/components/tabs/tabs.stories.tsx +373 -155
- package/src/components/tabs/tabs.test.tsx +12 -12
- package/src/components/tabs/tabs.tsx +72 -149
- package/src/components/tag/index.ts +0 -1
- package/src/components/tag/tag.stories.tsx +155 -120
- package/src/components/tag/tag.tsx +47 -95
- package/src/components/textarea/textarea.stories.tsx +8 -22
- package/src/components/textarea/textarea.tsx +17 -79
- package/src/components/timeline/timeline.stories.tsx +323 -42
- package/src/components/timeline/timeline.tsx +359 -132
- package/src/components/toast/toast.stories.tsx +1 -0
- package/src/components/tooltip/tooltip.tsx +11 -9
- package/src/components/tree/index.ts +0 -1
- package/src/components/tree/tree.stories.tsx +365 -408
- package/src/components/tree/tree.test.tsx +163 -0
- package/src/components/tree/tree.tsx +212 -36
- package/src/hooks/useAsync/__doc__/useAsync.stories.tsx +5 -5
- package/src/hooks/useClipboard/__doc__/useClipboard.stories.tsx +1 -3
- package/src/hooks/useDebounceCallback/__doc__/useDebouncedCallback.stories.tsx +6 -6
- package/src/hooks/useDocumentTitle/__doc__/useDocumentTitle.stories.tsx +1 -1
- package/src/hooks/useEventListener/__test__/useEventListener.test.tsx +1 -1
- package/src/hooks/useLocalStorage/__doc__/useLocalStorage.stories.tsx +1 -1
- package/src/hooks/usePagination/usePagination.tsx +36 -24
- package/src/styles/theme.css +1 -1
- package/src/utils/form.tsx +67 -37
- package/src/utils/index.ts +1 -1
- package/src/__doc__/Migration.mdx +0 -475
- package/src/components/auto-complete/auto-complete-primitives.tsx +0 -155
- package/src/components/background-image/background-image.stories.tsx +0 -21
- package/src/components/background-image/background-image.test.tsx +0 -29
- package/src/components/background-image/background-image.tsx +0 -23
- package/src/components/background-image/index.ts +0 -1
- package/src/components/button/button.variants.ts +0 -44
- package/src/components/button/components/loader-overlay.tsx +0 -21
- package/src/components/button/components/loading-icon.tsx +0 -47
- package/src/components/dropzone/upload-primitives.tsx +0 -310
- package/src/components/dropzone/use-dropzone.ts +0 -122
- package/src/components/empty-state/empty-state.stories.tsx +0 -56
- package/src/components/empty-state/empty-state.tsx +0 -39
- package/src/components/empty-state/index.ts +0 -1
- package/src/components/heading/heading.stories.tsx +0 -74
- package/src/components/heading/heading.tsx +0 -28
- package/src/components/heading/heading.variants.ts +0 -27
- package/src/components/heading/index.ts +0 -1
- package/src/components/kbd/kbd.variants.ts +0 -26
- package/src/components/menu/util/render-menu-item.tsx +0 -54
- package/src/components/multi-select/hooks/use-multi-select.ts +0 -66
- package/src/components/multi-select/index.ts +0 -1
- package/src/components/multi-select/multi-select.stories.tsx +0 -294
- package/src/components/multi-select/multi-select.tsx +0 -300
- package/src/components/multi-select/multi-select.variants.ts +0 -22
- package/src/components/pagination/components/pagination-option.tsx +0 -27
- package/src/components/show/index.ts +0 -1
- package/src/components/show/show.stories.tsx +0 -197
- package/src/components/show/show.test.tsx +0 -41
- package/src/components/show/show.tsx +0 -16
- package/src/components/stepper/Stepper.tsx +0 -190
- package/src/components/stepper/context/stepper-context.tsx +0 -11
- package/src/components/table/table-primitives.tsx +0 -122
- package/src/components/table/table.model.ts +0 -20
- package/src/components/table-pagination/index.ts +0 -2
- package/src/components/table-pagination/table-pagination.model.ts +0 -2
- package/src/components/table-pagination/table-pagination.stories.tsx +0 -23
- package/src/components/table-pagination/table-pagination.test.tsx +0 -32
- package/src/components/table-pagination/table-pagination.tsx +0 -108
- package/src/components/tabs/context/tabs-context.tsx +0 -14
- package/src/components/tag/tag.variants.ts +0 -31
- package/src/components/timeline/timeline-status.ts +0 -5
- package/src/components/tree/hooks/use-controllable-tree-state.ts +0 -80
- package/src/components/tree/tree-primitives.tsx +0 -126
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { MoreHorizontal } from "lucide-react";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { action } from "storybook/actions";
|
|
1
5
|
import {
|
|
2
6
|
Button,
|
|
3
7
|
Menu,
|
|
4
|
-
MenuContent,
|
|
5
8
|
MenuGroup,
|
|
6
9
|
MenuItem,
|
|
7
10
|
MenuLabel,
|
|
8
|
-
|
|
11
|
+
MenuPopup,
|
|
9
12
|
MenuRoot,
|
|
10
13
|
MenuSeparator,
|
|
11
14
|
MenuShortcut,
|
|
@@ -14,190 +17,317 @@ import {
|
|
|
14
17
|
MenuSubTrigger,
|
|
15
18
|
MenuTrigger,
|
|
16
19
|
} from "../../components";
|
|
17
|
-
import { createToastManager, ToastProvider } from "../toast";
|
|
18
|
-
|
|
19
|
-
const toastManager = createToastManager();
|
|
20
|
-
|
|
21
|
-
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
22
|
-
import {
|
|
23
|
-
Archive,
|
|
24
|
-
Bell,
|
|
25
|
-
Calendar,
|
|
26
|
-
CheckCircle,
|
|
27
|
-
Clipboard,
|
|
28
|
-
LogOut,
|
|
29
|
-
PlusCircle,
|
|
30
|
-
Settings,
|
|
31
|
-
Tag,
|
|
32
|
-
Trash2,
|
|
33
|
-
} from "lucide-react";
|
|
34
|
-
import { useMemo, useState } from "react";
|
|
35
|
-
import { MenuItemType } from ".";
|
|
36
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Data-driven dropdown menu. Pass an `items` array to declaratively render all
|
|
23
|
+
* supported types: `"item"`, `"checkbox"`, `"radio"`, `"radio-group"`, `"group"`,
|
|
24
|
+
* `"label"`, `"separator"`, `"submenu"`. Primitives are also exported for direct
|
|
25
|
+
* composition — see the `Primitive` story.
|
|
26
|
+
*/
|
|
37
27
|
const meta: Meta<typeof Menu> = {
|
|
38
|
-
title: "
|
|
28
|
+
title: "Components/Menu",
|
|
39
29
|
component: Menu,
|
|
30
|
+
parameters: {
|
|
31
|
+
layout: "centered",
|
|
32
|
+
},
|
|
33
|
+
args: {
|
|
34
|
+
trigger: (
|
|
35
|
+
<Button variant="ghost" size="icon">
|
|
36
|
+
<MoreHorizontal />
|
|
37
|
+
</Button>
|
|
38
|
+
),
|
|
39
|
+
},
|
|
40
|
+
argTypes: {
|
|
41
|
+
classNames: { control: false },
|
|
42
|
+
},
|
|
43
|
+
tags: ["beta"],
|
|
40
44
|
};
|
|
41
45
|
|
|
42
46
|
export default meta;
|
|
43
47
|
type Story = StoryObj<typeof Menu>;
|
|
44
48
|
|
|
49
|
+
export const Default: Story = {
|
|
50
|
+
render: (args) => (
|
|
51
|
+
<Menu
|
|
52
|
+
{...args}
|
|
53
|
+
items={[
|
|
54
|
+
{ type: "item", label: "Profile", onSelect: action("profile") },
|
|
55
|
+
{ type: "item", label: "Settings", onSelect: action("settings") },
|
|
56
|
+
{ type: "separator" },
|
|
57
|
+
{ type: "item", label: "Log out", onSelect: action("logout") },
|
|
58
|
+
]}
|
|
59
|
+
/>
|
|
60
|
+
),
|
|
61
|
+
};
|
|
62
|
+
|
|
45
63
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* ```
|
|
64
|
+
* `className` estila el popup. `classNames` expone el slot `popup` con la
|
|
65
|
+
* misma semántica — usá uno o el otro, lo que sea más cómodo.
|
|
49
66
|
*/
|
|
50
|
-
export const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
67
|
+
export const WithClassNames: Story = {
|
|
68
|
+
render: (args) => (
|
|
69
|
+
<Menu
|
|
70
|
+
{...args}
|
|
71
|
+
classNames={{ popup: "w-56" }}
|
|
72
|
+
items={[
|
|
73
|
+
{ type: "item", label: "Profile", onSelect: action("profile") },
|
|
74
|
+
{ type: "item", label: "Settings", onSelect: action("settings") },
|
|
75
|
+
]}
|
|
76
|
+
/>
|
|
77
|
+
),
|
|
78
|
+
};
|
|
60
79
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
80
|
+
/**
|
|
81
|
+
* `shortcut` is display-only — rendered as a `MenuShortcut` span with no keyboard binding.
|
|
82
|
+
*/
|
|
83
|
+
export const Shortcuts: Story = {
|
|
84
|
+
render: (args) => (
|
|
85
|
+
<Menu
|
|
86
|
+
{...args}
|
|
87
|
+
items={[
|
|
88
|
+
{
|
|
89
|
+
type: "item",
|
|
90
|
+
label: "New",
|
|
91
|
+
shortcut: "Ctrl+N",
|
|
92
|
+
onSelect: action("new"),
|
|
93
|
+
},
|
|
64
94
|
{
|
|
65
95
|
type: "item",
|
|
66
|
-
label: "
|
|
96
|
+
label: "Open",
|
|
67
97
|
shortcut: "Ctrl+O",
|
|
68
|
-
|
|
69
|
-
toastManager.add({
|
|
70
|
-
variant: "success",
|
|
71
|
-
description: "New file created successfully",
|
|
72
|
-
}),
|
|
98
|
+
onSelect: action("open"),
|
|
73
99
|
},
|
|
74
|
-
{ type: "item", label: "Open File..." },
|
|
75
|
-
{ type: "separator" },
|
|
76
100
|
{
|
|
77
|
-
type: "
|
|
78
|
-
label: "
|
|
79
|
-
|
|
80
|
-
|
|
101
|
+
type: "item",
|
|
102
|
+
label: "Save",
|
|
103
|
+
shortcut: "Ctrl+S",
|
|
104
|
+
onSelect: action("save"),
|
|
81
105
|
},
|
|
82
106
|
{ type: "separator" },
|
|
83
107
|
{
|
|
84
|
-
type: "
|
|
85
|
-
label: "
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
{ type: "item", label: "Word Document" },
|
|
89
|
-
],
|
|
108
|
+
type: "item",
|
|
109
|
+
label: "Close",
|
|
110
|
+
shortcut: "Ctrl+W",
|
|
111
|
+
onSelect: action("close"),
|
|
90
112
|
},
|
|
91
|
-
]
|
|
92
|
-
|
|
113
|
+
]}
|
|
114
|
+
/>
|
|
115
|
+
),
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Checkbox items are controlled — pass `checked` and `onCheckedChange` per item.
|
|
120
|
+
*/
|
|
121
|
+
export const Checkboxes: Story = {
|
|
122
|
+
render: (args) => {
|
|
123
|
+
const [notifications, setNotifications] = useState(true);
|
|
124
|
+
const [autosave, setAutosave] = useState(false);
|
|
125
|
+
const [spellcheck, setSpellcheck] = useState(true);
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<Menu
|
|
129
|
+
{...args}
|
|
130
|
+
items={[
|
|
131
|
+
{ type: "label", label: "Editor" },
|
|
132
|
+
{
|
|
133
|
+
type: "checkbox",
|
|
134
|
+
label: "Notifications",
|
|
135
|
+
checked: notifications,
|
|
136
|
+
onCheckedChange: setNotifications,
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
type: "checkbox",
|
|
140
|
+
label: "Autosave",
|
|
141
|
+
checked: autosave,
|
|
142
|
+
onCheckedChange: setAutosave,
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
type: "checkbox",
|
|
146
|
+
label: "Spell check",
|
|
147
|
+
checked: spellcheck,
|
|
148
|
+
onCheckedChange: setSpellcheck,
|
|
149
|
+
},
|
|
150
|
+
]}
|
|
151
|
+
/>
|
|
93
152
|
);
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Radio items must be wrapped in a `"radio-group"` entry. Controlled via `value` and
|
|
158
|
+
* `onValueChange` on the group — not per item.
|
|
159
|
+
*/
|
|
160
|
+
export const RadioGroup: Story = {
|
|
161
|
+
render: (args) => {
|
|
162
|
+
const [theme, setTheme] = useState("system");
|
|
94
163
|
|
|
95
164
|
return (
|
|
96
|
-
<Menu
|
|
165
|
+
<Menu
|
|
166
|
+
{...args}
|
|
167
|
+
items={[
|
|
168
|
+
{ type: "label", label: "Appearance" },
|
|
169
|
+
{
|
|
170
|
+
type: "radio-group",
|
|
171
|
+
value: theme,
|
|
172
|
+
onValueChange: setTheme,
|
|
173
|
+
items: [
|
|
174
|
+
{ type: "radio", label: "Light", value: "light" },
|
|
175
|
+
{ type: "radio", label: "Dark", value: "dark" },
|
|
176
|
+
{ type: "radio", label: "System", value: "system" },
|
|
177
|
+
],
|
|
178
|
+
},
|
|
179
|
+
]}
|
|
180
|
+
/>
|
|
97
181
|
);
|
|
98
182
|
},
|
|
99
183
|
};
|
|
100
184
|
|
|
101
185
|
/**
|
|
102
|
-
*
|
|
186
|
+
* `"group"` wraps related items under an optional label rendered as `MenuLabel`.
|
|
187
|
+
*/
|
|
188
|
+
export const Groups: Story = {
|
|
189
|
+
render: (args) => (
|
|
190
|
+
<Menu
|
|
191
|
+
{...args}
|
|
192
|
+
items={[
|
|
193
|
+
{
|
|
194
|
+
type: "group",
|
|
195
|
+
label: "Clipboard",
|
|
196
|
+
items: [
|
|
197
|
+
{
|
|
198
|
+
type: "item",
|
|
199
|
+
label: "Cut",
|
|
200
|
+
shortcut: "Ctrl+X",
|
|
201
|
+
onSelect: action("cut"),
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
type: "item",
|
|
205
|
+
label: "Copy",
|
|
206
|
+
shortcut: "Ctrl+C",
|
|
207
|
+
onSelect: action("copy"),
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
type: "item",
|
|
211
|
+
label: "Paste",
|
|
212
|
+
shortcut: "Ctrl+V",
|
|
213
|
+
onSelect: action("paste"),
|
|
214
|
+
},
|
|
215
|
+
],
|
|
216
|
+
},
|
|
217
|
+
{ type: "separator" },
|
|
218
|
+
{
|
|
219
|
+
type: "group",
|
|
220
|
+
label: "Selection",
|
|
221
|
+
items: [
|
|
222
|
+
{
|
|
223
|
+
type: "item",
|
|
224
|
+
label: "Select All",
|
|
225
|
+
shortcut: "Ctrl+A",
|
|
226
|
+
onSelect: action("select-all"),
|
|
227
|
+
},
|
|
228
|
+
{ type: "item", label: "Deselect", onSelect: action("deselect") },
|
|
229
|
+
],
|
|
230
|
+
},
|
|
231
|
+
]}
|
|
232
|
+
/>
|
|
233
|
+
),
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
export const Submenu: Story = {
|
|
237
|
+
render: (args) => (
|
|
238
|
+
<Menu
|
|
239
|
+
{...args}
|
|
240
|
+
items={[
|
|
241
|
+
{ type: "item", label: "Copy link", onSelect: action("copy-link") },
|
|
242
|
+
{
|
|
243
|
+
type: "submenu",
|
|
244
|
+
label: "Export as",
|
|
245
|
+
items: [
|
|
246
|
+
{ type: "item", label: "PDF", onSelect: action("export-pdf") },
|
|
247
|
+
{ type: "item", label: "CSV", onSelect: action("export-csv") },
|
|
248
|
+
{ type: "item", label: "JSON", onSelect: action("export-json") },
|
|
249
|
+
],
|
|
250
|
+
},
|
|
251
|
+
]}
|
|
252
|
+
/>
|
|
253
|
+
),
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* `variant="error"` applies destructive styling via `data-[variant=error]` on the item.
|
|
258
|
+
*/
|
|
259
|
+
export const Error: Story = {
|
|
260
|
+
render: (args) => (
|
|
261
|
+
<Menu
|
|
262
|
+
{...args}
|
|
263
|
+
items={[
|
|
264
|
+
{ type: "item", label: "Profile", onSelect: action("profile") },
|
|
265
|
+
{ type: "item", label: "Billing", onSelect: action("billing") },
|
|
266
|
+
{ type: "separator" },
|
|
267
|
+
{
|
|
268
|
+
type: "item",
|
|
269
|
+
label: "Delete account",
|
|
270
|
+
variant: "error",
|
|
271
|
+
onSelect: action("delete"),
|
|
272
|
+
},
|
|
273
|
+
]}
|
|
274
|
+
/>
|
|
275
|
+
),
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Direct primitive composition for fully custom menu layouts.
|
|
280
|
+
*
|
|
281
|
+
* ```tsx
|
|
282
|
+
* <MenuRoot>
|
|
283
|
+
* <MenuTrigger render={<Button variant="ghost" size="icon"><MoreHorizontal /></Button>} />
|
|
284
|
+
* <MenuPopup>
|
|
285
|
+
* <MenuGroup>
|
|
286
|
+
* <MenuLabel>Section</MenuLabel>
|
|
287
|
+
* <MenuItem onSelect={() => {}}>Item</MenuItem>
|
|
288
|
+
* </MenuGroup>
|
|
289
|
+
* </MenuPopup>
|
|
290
|
+
* </MenuRoot>
|
|
291
|
+
* ```
|
|
103
292
|
*/
|
|
104
293
|
export const Primitive: Story = {
|
|
105
|
-
decorators: [
|
|
106
|
-
(Story) => (
|
|
107
|
-
<ToastProvider toastManager={toastManager}>
|
|
108
|
-
<Story />
|
|
109
|
-
</ToastProvider>
|
|
110
|
-
),
|
|
111
|
-
],
|
|
112
294
|
render: () => (
|
|
113
295
|
<MenuRoot>
|
|
114
|
-
<MenuTrigger
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
296
|
+
<MenuTrigger
|
|
297
|
+
render={
|
|
298
|
+
<Button variant="ghost" size="icon">
|
|
299
|
+
<MoreHorizontal />
|
|
300
|
+
</Button>
|
|
301
|
+
}
|
|
302
|
+
/>
|
|
303
|
+
<MenuPopup className="w-56">
|
|
120
304
|
<MenuGroup>
|
|
121
|
-
<
|
|
122
|
-
<Clipboard className="mr-2 h-4 w-4" />
|
|
123
|
-
<span>All Tasks</span>
|
|
124
|
-
</MenuItem>
|
|
125
|
-
<MenuItem>
|
|
126
|
-
<CheckCircle className="mr-2 h-4 w-4" />
|
|
127
|
-
<span>Completed</span>
|
|
128
|
-
</MenuItem>
|
|
129
|
-
<MenuItem>
|
|
130
|
-
<Calendar className="mr-2 h-4 w-4" />
|
|
131
|
-
<span>Upcoming</span>
|
|
132
|
-
</MenuItem>
|
|
305
|
+
<MenuLabel>Workspace</MenuLabel>
|
|
133
306
|
</MenuGroup>
|
|
134
307
|
<MenuSeparator />
|
|
135
308
|
<MenuGroup>
|
|
136
|
-
<
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
<span>Categories</span>
|
|
140
|
-
</MenuSubTrigger>
|
|
141
|
-
<MenuPortal>
|
|
142
|
-
<MenuSubContent>
|
|
143
|
-
<MenuItem>
|
|
144
|
-
<Tag className="mr-2 h-4 w-4" />
|
|
145
|
-
<span>Work</span>
|
|
146
|
-
</MenuItem>
|
|
147
|
-
<MenuItem>
|
|
148
|
-
<Tag className="mr-2 h-4 w-4" />
|
|
149
|
-
<span>Personal</span>
|
|
150
|
-
</MenuItem>
|
|
151
|
-
<MenuItem>
|
|
152
|
-
<Tag className="mr-2 h-4 w-4" />
|
|
153
|
-
<span>Shopping</span>
|
|
154
|
-
</MenuItem>
|
|
155
|
-
<MenuItem>
|
|
156
|
-
<PlusCircle className="mr-2 h-4 w-4" />
|
|
157
|
-
<span>Create category</span>
|
|
158
|
-
</MenuItem>
|
|
159
|
-
</MenuSubContent>
|
|
160
|
-
</MenuPortal>
|
|
161
|
-
</MenuSub>
|
|
162
|
-
<MenuItem>
|
|
163
|
-
<PlusCircle className="mr-2 h-4 w-4" />
|
|
164
|
-
<span>Add Task</span>
|
|
165
|
-
<MenuShortcut
|
|
166
|
-
keys="ctrl+b"
|
|
167
|
-
handler={() =>
|
|
168
|
-
toastManager.add({
|
|
169
|
-
variant: "success",
|
|
170
|
-
description: "Creando tarea...",
|
|
171
|
-
})
|
|
172
|
-
}
|
|
173
|
-
>
|
|
174
|
-
Ctrl+B
|
|
175
|
-
</MenuShortcut>
|
|
176
|
-
</MenuItem>
|
|
309
|
+
<MenuItem onSelect={action("tasks")}>All Tasks</MenuItem>
|
|
310
|
+
<MenuItem onSelect={action("completed")}>Completed</MenuItem>
|
|
311
|
+
<MenuItem onSelect={action("upcoming")}>Upcoming</MenuItem>
|
|
177
312
|
</MenuGroup>
|
|
178
313
|
<MenuSeparator />
|
|
179
|
-
<
|
|
180
|
-
<
|
|
181
|
-
<
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
</
|
|
187
|
-
<MenuItem>
|
|
188
|
-
<Trash2 className="mr-2 h-4 w-4" />
|
|
189
|
-
<span>Trash</span>
|
|
190
|
-
</MenuItem>
|
|
191
|
-
<MenuItem disabled>
|
|
192
|
-
<Archive className="mr-2 h-4 w-4" />
|
|
193
|
-
<span>Archived</span>
|
|
194
|
-
</MenuItem>
|
|
314
|
+
<MenuSub>
|
|
315
|
+
<MenuSubTrigger>Categories</MenuSubTrigger>
|
|
316
|
+
<MenuSubContent>
|
|
317
|
+
<MenuItem onSelect={action("work")}>Work</MenuItem>
|
|
318
|
+
<MenuItem onSelect={action("personal")}>Personal</MenuItem>
|
|
319
|
+
<MenuItem onSelect={action("shopping")}>Shopping</MenuItem>
|
|
320
|
+
</MenuSubContent>
|
|
321
|
+
</MenuSub>
|
|
195
322
|
<MenuSeparator />
|
|
196
|
-
<MenuItem>
|
|
197
|
-
|
|
198
|
-
<
|
|
323
|
+
<MenuItem onSelect={action("settings")}>
|
|
324
|
+
Settings
|
|
325
|
+
<MenuShortcut>Ctrl+,</MenuShortcut>
|
|
326
|
+
</MenuItem>
|
|
327
|
+
<MenuItem disabled onSelect={action("archived")}>
|
|
328
|
+
Archived
|
|
199
329
|
</MenuItem>
|
|
200
|
-
</
|
|
330
|
+
</MenuPopup>
|
|
201
331
|
</MenuRoot>
|
|
202
332
|
),
|
|
203
333
|
};
|