@c9up/nebula 0.1.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/atoms/Avatar.d.ts +36 -9
- package/dist/atoms/Avatar.js +66 -27
- package/dist/atoms/index.d.ts +1 -1
- package/dist/atoms/index.js +1 -1
- package/dist/lib/children.d.ts +30 -0
- package/dist/lib/motion.d.ts +10 -0
- package/dist/lib/motion.js +10 -0
- package/dist/molecules/Accordion.d.ts +36 -15
- package/dist/molecules/Accordion.js +68 -45
- package/dist/molecules/Breadcrumb.d.ts +29 -11
- package/dist/molecules/Breadcrumb.js +52 -52
- package/dist/molecules/Collapsible.d.ts +18 -17
- package/dist/molecules/Collapsible.js +42 -34
- package/dist/molecules/Field.d.ts +66 -30
- package/dist/molecules/Field.js +106 -55
- package/dist/molecules/InputGroup.d.ts +39 -21
- package/dist/molecules/InputGroup.js +43 -27
- package/dist/molecules/InputOTP.d.ts +26 -3
- package/dist/molecules/InputOTP.js +109 -76
- package/dist/molecules/Message.js +5 -4
- package/dist/molecules/Pagination.d.ts +36 -11
- package/dist/molecules/Pagination.js +58 -74
- package/dist/molecules/RadioGroup.d.ts +25 -17
- package/dist/molecules/RadioGroup.js +47 -43
- package/dist/molecules/Resizable.d.ts +32 -7
- package/dist/molecules/Resizable.js +76 -49
- package/dist/molecules/Tabs.d.ts +49 -11
- package/dist/molecules/Tabs.js +107 -51
- package/dist/molecules/ToggleGroup.d.ts +16 -10
- package/dist/molecules/ToggleGroup.js +37 -21
- package/dist/molecules/index.d.ts +11 -11
- package/dist/molecules/index.js +11 -11
- package/dist/organisms/AlertDialog.d.ts +80 -28
- package/dist/organisms/AlertDialog.js +192 -67
- package/dist/organisms/Carousel.d.ts +25 -3
- package/dist/organisms/Carousel.js +75 -43
- package/dist/organisms/Combobox.d.ts +2 -1
- package/dist/organisms/Combobox.js +46 -16
- package/dist/organisms/Command.d.ts +73 -32
- package/dist/organisms/Command.js +209 -131
- package/dist/organisms/CommandDialog.js +5 -5
- package/dist/organisms/ContextMenu.d.ts +41 -19
- package/dist/organisms/ContextMenu.js +112 -71
- package/dist/organisms/DataTable.js +42 -8
- package/dist/organisms/Dialog.d.ts +97 -31
- package/dist/organisms/Dialog.js +193 -68
- package/dist/organisms/Drawer.d.ts +33 -10
- package/dist/organisms/Drawer.js +130 -52
- package/dist/organisms/DropdownMenu.d.ts +58 -11
- package/dist/organisms/DropdownMenu.js +137 -50
- package/dist/organisms/Form.js +9 -11
- package/dist/organisms/HoverCard.d.ts +39 -19
- package/dist/organisms/HoverCard.js +116 -40
- package/dist/organisms/Menubar.d.ts +55 -19
- package/dist/organisms/Menubar.js +166 -82
- package/dist/organisms/NavigationMenu.d.ts +77 -31
- package/dist/organisms/NavigationMenu.js +169 -98
- package/dist/organisms/Popover.d.ts +72 -12
- package/dist/organisms/Popover.js +132 -25
- package/dist/organisms/Questionnaire.js +5 -5
- package/dist/organisms/Select.d.ts +99 -18
- package/dist/organisms/Select.js +253 -111
- package/dist/organisms/Sheet.d.ts +57 -13
- package/dist/organisms/Sheet.js +141 -54
- package/dist/organisms/Sidebar.d.ts +146 -56
- package/dist/organisms/Sidebar.js +236 -128
- package/dist/organisms/Tooltip.d.ts +88 -14
- package/dist/organisms/Tooltip.js +210 -47
- package/dist/organisms/index.d.ts +15 -15
- package/dist/organisms/index.js +15 -15
- package/dist/primitives/floating.js +25 -0
- package/dist/primitives/floatingSurface.d.ts +11 -0
- package/dist/primitives/floatingSurface.js +8 -0
- package/dist/primitives/menu.d.ts +45 -1
- package/dist/primitives/menu.js +45 -14
- package/dist/primitives/menuParts.d.ts +113 -0
- package/dist/primitives/menuParts.js +207 -0
- package/nebula.css +1 -1
- package/package.json +5 -4
- package/registry.json +18 -6
- package/src/atoms/Avatar.ts +141 -37
- package/src/atoms/index.ts +13 -1
- package/src/lib/children.ts +31 -0
- package/src/lib/motion.ts +12 -0
- package/src/molecules/Accordion.ts +120 -60
- package/src/molecules/Breadcrumb.ts +77 -76
- package/src/molecules/Collapsible.ts +77 -41
- package/src/molecules/Field.ts +187 -72
- package/src/molecules/InputGroup.ts +88 -35
- package/src/molecules/InputOTP.ts +150 -86
- package/src/molecules/Message.ts +6 -4
- package/src/molecules/Pagination.ts +96 -101
- package/src/molecules/RadioGroup.ts +70 -59
- package/src/molecules/Resizable.ts +138 -75
- package/src/molecules/Tabs.ts +187 -74
- package/src/molecules/ToggleGroup.ts +77 -38
- package/src/molecules/index.ts +85 -8
- package/src/organisms/AlertDialog.ts +319 -82
- package/src/organisms/Carousel.ts +129 -52
- package/src/organisms/Combobox.ts +64 -19
- package/src/organisms/Command.ts +342 -159
- package/src/organisms/CommandDialog.ts +6 -6
- package/src/organisms/ContextMenu.ts +185 -83
- package/src/organisms/DataTable.ts +56 -10
- package/src/organisms/Dialog.ts +312 -102
- package/src/organisms/Drawer.ts +219 -71
- package/src/organisms/DropdownMenu.ts +219 -61
- package/src/organisms/Form.ts +48 -34
- package/src/organisms/HoverCard.ts +187 -53
- package/src/organisms/Menubar.ts +247 -87
- package/src/organisms/NavigationMenu.ts +306 -128
- package/src/organisms/Popover.ts +215 -39
- package/src/organisms/Questionnaire.ts +9 -6
- package/src/organisms/Select.ts +397 -130
- package/src/organisms/Sheet.ts +252 -83
- package/src/organisms/Sidebar.ts +438 -185
- package/src/organisms/Tooltip.ts +315 -65
- package/src/organisms/index.ts +284 -14
- package/src/primitives/floating.ts +33 -0
- package/src/primitives/floatingSurface.ts +19 -0
- package/src/primitives/menu.ts +79 -18
- package/src/primitives/menuParts.ts +371 -0
package/src/organisms/Menubar.ts
CHANGED
|
@@ -1,42 +1,82 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Menubar —
|
|
2
|
+
* Menubar — the application menu bar.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* Menubar({ children: () => html`
|
|
5
|
+
* ${MenubarMenu({ children: () => html`
|
|
6
|
+
* ${MenubarTrigger({ children: "File" })}
|
|
7
|
+
* ${MenubarContent({ children: () => html`
|
|
8
|
+
* ${MenubarItem({ children: "New", onSelect: create })}
|
|
9
|
+
* ` })}
|
|
10
|
+
* ` })}
|
|
11
|
+
* ` })
|
|
10
12
|
*
|
|
11
|
-
* One
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* One surface for the whole bar, not one per menu: only one menu is ever open,
|
|
14
|
+
* and moving between them is a change of anchor and contents rather than a
|
|
15
|
+
* close and an open. That is what makes left/right feel like walking a bar
|
|
16
|
+
* instead of dismissing and summoning.
|
|
17
|
+
*
|
|
18
|
+
* Each `MenubarMenu` claims an index as it is built, which is the order the
|
|
19
|
+
* arrows walk. The rows themselves come from `createMenuParts`, so a menu in
|
|
20
|
+
* the bar and a dropdown menu cannot drift apart.
|
|
15
21
|
*/
|
|
16
22
|
|
|
17
|
-
import {
|
|
18
|
-
|
|
23
|
+
import {
|
|
24
|
+
component,
|
|
25
|
+
createContext,
|
|
26
|
+
html,
|
|
27
|
+
inject,
|
|
28
|
+
provide,
|
|
29
|
+
signal,
|
|
30
|
+
type TemplateResult,
|
|
31
|
+
} from "@c9up/aurora";
|
|
32
|
+
import type { Child, Parts, Slot } from "../lib/children.js";
|
|
33
|
+
import { slot } from "../lib/children.js";
|
|
19
34
|
import { cn } from "../lib/cn.js";
|
|
20
35
|
import { uid } from "../lib/id.js";
|
|
36
|
+
import { slideInFromSide, zoomInOut } from "../lib/motion.js";
|
|
21
37
|
import { type Reactive, read } from "../lib/props.js";
|
|
22
38
|
import { floatingSurface } from "../primitives/floatingSurface.js";
|
|
23
|
-
import {
|
|
39
|
+
import { menuPanelClasses, wireMenu } from "../primitives/menu.js";
|
|
40
|
+
import { createMenuParts, type MenuOwner } from "../primitives/menuParts.js";
|
|
24
41
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
42
|
+
const triggerClasses =
|
|
43
|
+
"focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex items-center rounded-sm px-2 py-1 text-sm font-medium outline-hidden select-none disabled:pointer-events-none disabled:opacity-50";
|
|
44
|
+
|
|
45
|
+
interface MenuRegistration {
|
|
46
|
+
readonly triggerId: string;
|
|
47
|
+
disabled: boolean;
|
|
48
|
+
body: Child;
|
|
49
|
+
panelClass: Reactive<string> | undefined;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface MenubarApi extends MenuOwner {
|
|
53
|
+
readonly contentId: string;
|
|
54
|
+
/** Claim the next index. Registration order is the order arrows walk. */
|
|
55
|
+
claim(triggerId: string): number;
|
|
56
|
+
describe(index: number, patch: Partial<MenuRegistration>): void;
|
|
57
|
+
readonly openIndex: () => number;
|
|
58
|
+
openAt(index: number, withKeyboard: boolean): void;
|
|
59
|
+
close(): void;
|
|
60
|
+
focusTrigger(index: number): void;
|
|
29
61
|
}
|
|
30
62
|
|
|
63
|
+
const MenubarContext = createContext<MenubarApi>("Menubar");
|
|
64
|
+
|
|
65
|
+
interface MenubarMenuApi {
|
|
66
|
+
readonly index: number;
|
|
67
|
+
readonly triggerId: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const MenubarMenuContext = createContext<MenubarMenuApi>("MenubarMenu");
|
|
71
|
+
|
|
31
72
|
export interface MenubarProps {
|
|
32
|
-
menus: readonly MenubarMenu[];
|
|
33
73
|
class?: Reactive<string>;
|
|
74
|
+
children?: Parts;
|
|
34
75
|
}
|
|
35
76
|
|
|
36
77
|
export const Menubar = component<MenubarProps>((props) => {
|
|
37
78
|
const contentId = uid("menubar-content");
|
|
38
|
-
const
|
|
39
|
-
/** Index of the open menu, or `-1`. */
|
|
79
|
+
const menus: MenuRegistration[] = [];
|
|
40
80
|
const openIndex = signal(-1);
|
|
41
81
|
|
|
42
82
|
let unwire: (() => void) | null = null;
|
|
@@ -47,35 +87,74 @@ export const Menubar = component<MenubarProps>((props) => {
|
|
|
47
87
|
}
|
|
48
88
|
|
|
49
89
|
function openAt(index: number, withKeyboard: boolean): void {
|
|
50
|
-
if (
|
|
90
|
+
if (menus[index]?.disabled === true) return;
|
|
51
91
|
focusFirstOnOpen = withKeyboard;
|
|
52
92
|
openIndex(index);
|
|
53
93
|
}
|
|
54
94
|
|
|
95
|
+
function focusTrigger(index: number): void {
|
|
96
|
+
const count = menus.length;
|
|
97
|
+
if (count === 0) return;
|
|
98
|
+
const entry = menus[(index + count) % count];
|
|
99
|
+
if (entry === undefined) return;
|
|
100
|
+
document.getElementById(entry.triggerId)?.focus({ preventScroll: true });
|
|
101
|
+
}
|
|
102
|
+
|
|
55
103
|
function move(delta: number): void {
|
|
56
|
-
const count =
|
|
104
|
+
const count = menus.length;
|
|
57
105
|
if (count === 0) return;
|
|
58
106
|
const from = openIndex();
|
|
59
107
|
if (from === -1) return;
|
|
60
108
|
openAt((from + delta + count) % count, true);
|
|
61
109
|
}
|
|
62
110
|
|
|
111
|
+
function onPanelKeyDown(event: KeyboardEvent): void {
|
|
112
|
+
if (event.key === "ArrowRight") {
|
|
113
|
+
event.preventDefault();
|
|
114
|
+
move(1);
|
|
115
|
+
} else if (event.key === "ArrowLeft") {
|
|
116
|
+
event.preventDefault();
|
|
117
|
+
move(-1);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
provide<MenubarApi>(MenubarContext, {
|
|
122
|
+
contentId,
|
|
123
|
+
claim(triggerId) {
|
|
124
|
+
menus.push({
|
|
125
|
+
triggerId,
|
|
126
|
+
disabled: false,
|
|
127
|
+
body: null,
|
|
128
|
+
panelClass: undefined,
|
|
129
|
+
});
|
|
130
|
+
return menus.length - 1;
|
|
131
|
+
},
|
|
132
|
+
describe(index, patch) {
|
|
133
|
+
const entry = menus[index];
|
|
134
|
+
if (entry === undefined) return;
|
|
135
|
+
Object.assign(entry, patch);
|
|
136
|
+
},
|
|
137
|
+
openIndex: () => openIndex(),
|
|
138
|
+
openAt,
|
|
139
|
+
close,
|
|
140
|
+
focusTrigger,
|
|
141
|
+
closeAll: close,
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
const parts = props.children?.();
|
|
145
|
+
|
|
63
146
|
floatingSurface({
|
|
64
147
|
anchor: () => {
|
|
65
|
-
const
|
|
66
|
-
return
|
|
148
|
+
const entry = menus[openIndex()];
|
|
149
|
+
return entry === undefined
|
|
150
|
+
? null
|
|
151
|
+
: document.getElementById(entry.triggerId);
|
|
67
152
|
},
|
|
68
153
|
open: () => openIndex() !== -1,
|
|
69
154
|
onClose: close,
|
|
70
155
|
placement: "bottom-start",
|
|
71
156
|
offset: 4,
|
|
72
|
-
content: () =>
|
|
73
|
-
menuPanel({
|
|
74
|
-
id: contentId,
|
|
75
|
-
entries: props.menus[openIndex()]?.entries ?? [],
|
|
76
|
-
onCloseAll: close,
|
|
77
|
-
labelledBy: triggerIds[openIndex()],
|
|
78
|
-
}),
|
|
157
|
+
content: () => renderPanel(menus[openIndex()], contentId),
|
|
79
158
|
onOpened: (panel) => {
|
|
80
159
|
const enterItems = focusFirstOnOpen;
|
|
81
160
|
focusFirstOnOpen = false;
|
|
@@ -98,16 +177,6 @@ export const Menubar = component<MenubarProps>((props) => {
|
|
|
98
177
|
},
|
|
99
178
|
});
|
|
100
179
|
|
|
101
|
-
function onPanelKeyDown(event: KeyboardEvent): void {
|
|
102
|
-
if (event.key === "ArrowRight") {
|
|
103
|
-
event.preventDefault();
|
|
104
|
-
move(1);
|
|
105
|
-
} else if (event.key === "ArrowLeft") {
|
|
106
|
-
event.preventDefault();
|
|
107
|
-
move(-1);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
180
|
return html`<div
|
|
112
181
|
data-slot="menubar"
|
|
113
182
|
role="menubar"
|
|
@@ -116,52 +185,143 @@ export const Menubar = component<MenubarProps>((props) => {
|
|
|
116
185
|
"bg-background flex h-9 items-center gap-1 rounded-md border p-1 shadow-xs",
|
|
117
186
|
read(props.class),
|
|
118
187
|
)}"
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
focusTrigger(index - 1);
|
|
155
|
-
}
|
|
156
|
-
}}"
|
|
157
|
-
>${menu.label}</button>`;
|
|
188
|
+
>${parts}</div>`;
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
export interface MenubarMenuProps {
|
|
192
|
+
children?: Parts;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* One menu in the bar.
|
|
197
|
+
*
|
|
198
|
+
* Claims its index as it is built, and provides it to the trigger and the
|
|
199
|
+
* content inside — neither of which then has to be told which menu it belongs
|
|
200
|
+
* to.
|
|
201
|
+
*/
|
|
202
|
+
export const MenubarMenu = component<MenubarMenuProps>((props) => {
|
|
203
|
+
const bar = inject(MenubarContext);
|
|
204
|
+
const triggerId = uid("menubar-trigger");
|
|
205
|
+
const index = bar.claim(triggerId);
|
|
206
|
+
|
|
207
|
+
provide<MenubarMenuApi>(MenubarMenuContext, { index, triggerId });
|
|
208
|
+
|
|
209
|
+
return html`${props.children?.()}`;
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
export interface MenubarTriggerProps {
|
|
213
|
+
children?: Slot;
|
|
214
|
+
disabled?: boolean;
|
|
215
|
+
class?: Reactive<string>;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export const MenubarTrigger = component<MenubarTriggerProps>((props) => {
|
|
219
|
+
const bar = inject(MenubarContext);
|
|
220
|
+
const menu = inject(MenubarMenuContext);
|
|
221
|
+
if (props.disabled === true) {
|
|
222
|
+
bar.describe(menu.index, { disabled: true });
|
|
158
223
|
}
|
|
224
|
+
const open = (): boolean => bar.openIndex() === menu.index;
|
|
159
225
|
|
|
160
|
-
function
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
226
|
+
function onKeyDown(event: KeyboardEvent): void {
|
|
227
|
+
if (
|
|
228
|
+
event.key === "ArrowDown" ||
|
|
229
|
+
event.key === "Enter" ||
|
|
230
|
+
event.key === " "
|
|
231
|
+
) {
|
|
232
|
+
event.preventDefault();
|
|
233
|
+
bar.openAt(menu.index, true);
|
|
234
|
+
} else if (event.key === "ArrowRight") {
|
|
235
|
+
event.preventDefault();
|
|
236
|
+
bar.focusTrigger(menu.index + 1);
|
|
237
|
+
} else if (event.key === "ArrowLeft") {
|
|
238
|
+
event.preventDefault();
|
|
239
|
+
bar.focusTrigger(menu.index - 1);
|
|
240
|
+
}
|
|
166
241
|
}
|
|
242
|
+
|
|
243
|
+
return html`<button
|
|
244
|
+
type="button"
|
|
245
|
+
data-slot="menubar-trigger"
|
|
246
|
+
id="${menu.triggerId}"
|
|
247
|
+
role="menuitem"
|
|
248
|
+
aria-haspopup="menu"
|
|
249
|
+
aria-expanded="${() => (open() ? "true" : "false")}"
|
|
250
|
+
aria-controls="${() => (open() ? bar.contentId : undefined)}"
|
|
251
|
+
data-state="${() => (open() ? "open" : "closed")}"
|
|
252
|
+
?disabled="${props.disabled === true}"
|
|
253
|
+
class="${() => cn(triggerClasses, read(props.class))}"
|
|
254
|
+
@click="${() => (open() ? bar.close() : bar.openAt(menu.index, false))}"
|
|
255
|
+
@pointerenter="${() => {
|
|
256
|
+
// Hover switches menus only while one is already open — otherwise the
|
|
257
|
+
// bar would spring menus at a pointer merely passing over it.
|
|
258
|
+
if (bar.openIndex() !== -1) bar.openAt(menu.index, false);
|
|
259
|
+
}}"
|
|
260
|
+
@keydown="${onKeyDown}"
|
|
261
|
+
>${slot(props.children)}</button>`;
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
export interface MenubarContentProps {
|
|
265
|
+
children?: Parts;
|
|
266
|
+
class?: Reactive<string>;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export const MenubarContent = component<MenubarContentProps>((props) => {
|
|
270
|
+
const bar = inject(MenubarContext);
|
|
271
|
+
const menu = inject(MenubarMenuContext);
|
|
272
|
+
bar.describe(menu.index, {
|
|
273
|
+
body: props.children?.(),
|
|
274
|
+
panelClass: props.class,
|
|
275
|
+
});
|
|
276
|
+
return html``;
|
|
167
277
|
});
|
|
278
|
+
|
|
279
|
+
const parts = createMenuParts("menubar", MenubarContext);
|
|
280
|
+
|
|
281
|
+
export const MenubarGroup = parts.Group;
|
|
282
|
+
export const MenubarItem = parts.Item;
|
|
283
|
+
export const MenubarCheckboxItem = parts.CheckboxItem;
|
|
284
|
+
export const MenubarRadioGroup = parts.RadioGroup;
|
|
285
|
+
export const MenubarRadioItem = parts.RadioItem;
|
|
286
|
+
export const MenubarLabel = parts.Label;
|
|
287
|
+
export const MenubarSeparator = parts.Separator;
|
|
288
|
+
export const MenubarShortcut = parts.Shortcut;
|
|
289
|
+
export const MenubarSub = parts.Sub;
|
|
290
|
+
export const MenubarSubTrigger = parts.SubTrigger;
|
|
291
|
+
export const MenubarSubContent = parts.SubContent;
|
|
292
|
+
export const MenubarPortal = parts.Portal;
|
|
293
|
+
|
|
294
|
+
export type {
|
|
295
|
+
MenuCheckboxItemProps as MenubarCheckboxItemProps,
|
|
296
|
+
MenuGroupProps as MenubarGroupProps,
|
|
297
|
+
MenuItemProps as MenubarItemProps,
|
|
298
|
+
MenuLabelProps as MenubarLabelProps,
|
|
299
|
+
MenuPortalProps as MenubarPortalProps,
|
|
300
|
+
MenuRadioGroupProps as MenubarRadioGroupProps,
|
|
301
|
+
MenuRadioItemProps as MenubarRadioItemProps,
|
|
302
|
+
MenuSeparatorProps as MenubarSeparatorProps,
|
|
303
|
+
MenuShortcutProps as MenubarShortcutProps,
|
|
304
|
+
MenuSubContentProps as MenubarSubContentProps,
|
|
305
|
+
MenuSubProps as MenubarSubProps,
|
|
306
|
+
MenuSubTriggerProps as MenubarSubTriggerProps,
|
|
307
|
+
} from "../primitives/menuParts.js";
|
|
308
|
+
|
|
309
|
+
function renderPanel(
|
|
310
|
+
entry: MenuRegistration | undefined,
|
|
311
|
+
contentId: string,
|
|
312
|
+
): TemplateResult {
|
|
313
|
+
return html`<div
|
|
314
|
+
data-slot="menubar-content"
|
|
315
|
+
id="${contentId}"
|
|
316
|
+
role="menu"
|
|
317
|
+
aria-labelledby="${entry?.triggerId}"
|
|
318
|
+
aria-orientation="vertical"
|
|
319
|
+
tabindex="-1"
|
|
320
|
+
class="${cn(
|
|
321
|
+
menuPanelClasses,
|
|
322
|
+
zoomInOut,
|
|
323
|
+
slideInFromSide,
|
|
324
|
+
read(entry?.panelClass),
|
|
325
|
+
)}"
|
|
326
|
+
>${entry?.body}</div>`;
|
|
327
|
+
}
|