@c9up/nebula 0.1.9 → 0.2.1
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/configure.d.ts +6 -0
- package/dist/configure.js +4 -22
- package/dist/lib/children.d.ts +30 -0
- package/dist/lib/id.d.ts +13 -29
- package/dist/lib/id.js +13 -39
- 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/dist/stubs.d.ts +13 -0
- package/dist/stubs.js +14 -0
- package/nebula.css +1 -1
- package/package.json +4 -3
- package/registry.json +18 -6
- package/src/atoms/Avatar.ts +141 -37
- package/src/atoms/index.ts +13 -1
- package/src/configure.ts +10 -23
- package/src/lib/children.ts +31 -0
- package/src/lib/id.ts +11 -39
- 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/stubs.ts +16 -0
- package/stubs/config/nebula.stub +21 -0
package/src/organisms/index.ts
CHANGED
|
@@ -13,7 +13,26 @@
|
|
|
13
13
|
* restoration, hiding the page from assistive technology) exist once.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
export {
|
|
16
|
+
export {
|
|
17
|
+
AlertDialog,
|
|
18
|
+
AlertDialogAction,
|
|
19
|
+
type AlertDialogButtonProps,
|
|
20
|
+
AlertDialogCancel,
|
|
21
|
+
AlertDialogContent,
|
|
22
|
+
type AlertDialogContentProps,
|
|
23
|
+
AlertDialogDescription,
|
|
24
|
+
AlertDialogFooter,
|
|
25
|
+
AlertDialogHeader,
|
|
26
|
+
AlertDialogMedia,
|
|
27
|
+
AlertDialogOverlay,
|
|
28
|
+
AlertDialogPortal,
|
|
29
|
+
type AlertDialogPortalProps,
|
|
30
|
+
type AlertDialogProps,
|
|
31
|
+
type AlertDialogSectionProps,
|
|
32
|
+
AlertDialogTitle,
|
|
33
|
+
AlertDialogTrigger,
|
|
34
|
+
type AlertDialogTriggerProps,
|
|
35
|
+
} from "./AlertDialog.js";
|
|
17
36
|
export {
|
|
18
37
|
addDays,
|
|
19
38
|
addMonths,
|
|
@@ -24,7 +43,17 @@ export {
|
|
|
24
43
|
monthGrid,
|
|
25
44
|
startOfDay,
|
|
26
45
|
} from "./Calendar.js";
|
|
27
|
-
export {
|
|
46
|
+
export {
|
|
47
|
+
Carousel,
|
|
48
|
+
type CarouselButtonProps,
|
|
49
|
+
CarouselContent,
|
|
50
|
+
type CarouselContentProps,
|
|
51
|
+
CarouselItem,
|
|
52
|
+
type CarouselItemProps,
|
|
53
|
+
CarouselNext,
|
|
54
|
+
CarouselPrevious,
|
|
55
|
+
type CarouselProps,
|
|
56
|
+
} from "./Carousel.js";
|
|
28
57
|
export {
|
|
29
58
|
Chart,
|
|
30
59
|
type ChartDatum,
|
|
@@ -39,12 +68,57 @@ export {
|
|
|
39
68
|
} from "./Combobox.js";
|
|
40
69
|
export {
|
|
41
70
|
Command,
|
|
42
|
-
type
|
|
71
|
+
type CommandCandidate,
|
|
72
|
+
CommandEmpty,
|
|
73
|
+
type CommandEmptyProps,
|
|
74
|
+
CommandGroup,
|
|
75
|
+
type CommandGroupProps,
|
|
76
|
+
CommandInput,
|
|
77
|
+
type CommandInputProps,
|
|
78
|
+
CommandItem,
|
|
79
|
+
type CommandItemProps,
|
|
80
|
+
CommandList,
|
|
81
|
+
type CommandListProps,
|
|
43
82
|
type CommandProps,
|
|
83
|
+
CommandSeparator,
|
|
84
|
+
type CommandSeparatorProps,
|
|
85
|
+
CommandShortcut,
|
|
86
|
+
type CommandShortcutProps,
|
|
44
87
|
defaultFilter,
|
|
45
88
|
} from "./Command.js";
|
|
46
89
|
export { CommandDialog, type CommandDialogProps } from "./CommandDialog.js";
|
|
47
|
-
export {
|
|
90
|
+
export {
|
|
91
|
+
ContextMenu,
|
|
92
|
+
ContextMenuCheckboxItem,
|
|
93
|
+
type ContextMenuCheckboxItemProps,
|
|
94
|
+
ContextMenuContent,
|
|
95
|
+
type ContextMenuContentProps,
|
|
96
|
+
ContextMenuGroup,
|
|
97
|
+
type ContextMenuGroupProps,
|
|
98
|
+
ContextMenuItem,
|
|
99
|
+
type ContextMenuItemProps,
|
|
100
|
+
ContextMenuLabel,
|
|
101
|
+
type ContextMenuLabelProps,
|
|
102
|
+
ContextMenuPortal,
|
|
103
|
+
type ContextMenuPortalProps,
|
|
104
|
+
type ContextMenuProps,
|
|
105
|
+
ContextMenuRadioGroup,
|
|
106
|
+
type ContextMenuRadioGroupProps,
|
|
107
|
+
ContextMenuRadioItem,
|
|
108
|
+
type ContextMenuRadioItemProps,
|
|
109
|
+
ContextMenuSeparator,
|
|
110
|
+
type ContextMenuSeparatorProps,
|
|
111
|
+
ContextMenuShortcut,
|
|
112
|
+
type ContextMenuShortcutProps,
|
|
113
|
+
ContextMenuSub,
|
|
114
|
+
ContextMenuSubContent,
|
|
115
|
+
type ContextMenuSubContentProps,
|
|
116
|
+
type ContextMenuSubProps,
|
|
117
|
+
ContextMenuSubTrigger,
|
|
118
|
+
type ContextMenuSubTriggerProps,
|
|
119
|
+
ContextMenuTrigger,
|
|
120
|
+
type ContextMenuTriggerProps,
|
|
121
|
+
} from "./ContextMenu.js";
|
|
48
122
|
export { type Column, DataTable, type DataTableProps } from "./DataTable.js";
|
|
49
123
|
export { DatePicker, type DatePickerProps, toISODate } from "./DatePicker.js";
|
|
50
124
|
export {
|
|
@@ -53,13 +127,77 @@ export {
|
|
|
53
127
|
} from "./DateRangePicker.js";
|
|
54
128
|
export {
|
|
55
129
|
Dialog,
|
|
130
|
+
DialogClose,
|
|
131
|
+
type DialogCloseProps,
|
|
132
|
+
DialogContent,
|
|
133
|
+
type DialogContentProps,
|
|
134
|
+
DialogDescription,
|
|
135
|
+
DialogFooter,
|
|
136
|
+
type DialogFooterProps,
|
|
137
|
+
DialogHeader,
|
|
138
|
+
DialogOverlay,
|
|
139
|
+
type DialogOverlayProps,
|
|
140
|
+
DialogPortal,
|
|
141
|
+
type DialogPortalProps,
|
|
56
142
|
type DialogProps,
|
|
143
|
+
type DialogSectionProps,
|
|
144
|
+
DialogTitle,
|
|
145
|
+
type DialogTitleProps,
|
|
146
|
+
DialogTrigger,
|
|
147
|
+
type DialogTriggerProps,
|
|
57
148
|
dialogBackdropClasses,
|
|
58
149
|
dialogPanelClasses,
|
|
59
150
|
useDialog,
|
|
60
151
|
} from "./Dialog.js";
|
|
61
|
-
export {
|
|
62
|
-
|
|
152
|
+
export {
|
|
153
|
+
Drawer,
|
|
154
|
+
DrawerClose,
|
|
155
|
+
type DrawerCloseProps,
|
|
156
|
+
DrawerContent,
|
|
157
|
+
type DrawerContentProps,
|
|
158
|
+
DrawerDescription,
|
|
159
|
+
DrawerFooter,
|
|
160
|
+
DrawerHeader,
|
|
161
|
+
DrawerOverlay,
|
|
162
|
+
type DrawerOverlayProps,
|
|
163
|
+
type DrawerProps,
|
|
164
|
+
type DrawerSectionProps,
|
|
165
|
+
DrawerTitle,
|
|
166
|
+
DrawerTrigger,
|
|
167
|
+
type DrawerTriggerProps,
|
|
168
|
+
} from "./Drawer.js";
|
|
169
|
+
export {
|
|
170
|
+
DropdownMenu,
|
|
171
|
+
DropdownMenuCheckboxItem,
|
|
172
|
+
type DropdownMenuCheckboxItemProps,
|
|
173
|
+
DropdownMenuContent,
|
|
174
|
+
type DropdownMenuContentProps,
|
|
175
|
+
DropdownMenuGroup,
|
|
176
|
+
type DropdownMenuGroupProps,
|
|
177
|
+
DropdownMenuItem,
|
|
178
|
+
type DropdownMenuItemProps,
|
|
179
|
+
DropdownMenuLabel,
|
|
180
|
+
type DropdownMenuLabelProps,
|
|
181
|
+
DropdownMenuPortal,
|
|
182
|
+
type DropdownMenuPortalProps,
|
|
183
|
+
type DropdownMenuProps,
|
|
184
|
+
DropdownMenuRadioGroup,
|
|
185
|
+
type DropdownMenuRadioGroupProps,
|
|
186
|
+
DropdownMenuRadioItem,
|
|
187
|
+
type DropdownMenuRadioItemProps,
|
|
188
|
+
DropdownMenuSeparator,
|
|
189
|
+
type DropdownMenuSeparatorProps,
|
|
190
|
+
DropdownMenuShortcut,
|
|
191
|
+
type DropdownMenuShortcutProps,
|
|
192
|
+
DropdownMenuSub,
|
|
193
|
+
DropdownMenuSubContent,
|
|
194
|
+
type DropdownMenuSubContentProps,
|
|
195
|
+
type DropdownMenuSubProps,
|
|
196
|
+
DropdownMenuSubTrigger,
|
|
197
|
+
type DropdownMenuSubTriggerProps,
|
|
198
|
+
DropdownMenuTrigger,
|
|
199
|
+
type DropdownMenuTriggerProps,
|
|
200
|
+
} from "./DropdownMenu.js";
|
|
63
201
|
export {
|
|
64
202
|
bind,
|
|
65
203
|
type FieldBinding,
|
|
@@ -72,21 +210,84 @@ export {
|
|
|
72
210
|
TextField,
|
|
73
211
|
type TextFieldProps,
|
|
74
212
|
} from "./Form.js";
|
|
75
|
-
export {
|
|
76
|
-
|
|
213
|
+
export {
|
|
214
|
+
HoverCard,
|
|
215
|
+
HoverCardContent,
|
|
216
|
+
type HoverCardContentProps,
|
|
217
|
+
type HoverCardProps,
|
|
218
|
+
HoverCardTrigger,
|
|
219
|
+
type HoverCardTriggerProps,
|
|
220
|
+
} from "./HoverCard.js";
|
|
221
|
+
export {
|
|
222
|
+
Menubar,
|
|
223
|
+
MenubarCheckboxItem,
|
|
224
|
+
type MenubarCheckboxItemProps,
|
|
225
|
+
MenubarContent,
|
|
226
|
+
type MenubarContentProps,
|
|
227
|
+
MenubarGroup,
|
|
228
|
+
type MenubarGroupProps,
|
|
229
|
+
MenubarItem,
|
|
230
|
+
type MenubarItemProps,
|
|
231
|
+
MenubarLabel,
|
|
232
|
+
type MenubarLabelProps,
|
|
233
|
+
MenubarMenu,
|
|
234
|
+
type MenubarMenuProps,
|
|
235
|
+
MenubarPortal,
|
|
236
|
+
type MenubarPortalProps,
|
|
237
|
+
type MenubarProps,
|
|
238
|
+
MenubarRadioGroup,
|
|
239
|
+
type MenubarRadioGroupProps,
|
|
240
|
+
MenubarRadioItem,
|
|
241
|
+
type MenubarRadioItemProps,
|
|
242
|
+
MenubarSeparator,
|
|
243
|
+
type MenubarSeparatorProps,
|
|
244
|
+
MenubarShortcut,
|
|
245
|
+
type MenubarShortcutProps,
|
|
246
|
+
MenubarSub,
|
|
247
|
+
MenubarSubContent,
|
|
248
|
+
type MenubarSubContentProps,
|
|
249
|
+
type MenubarSubProps,
|
|
250
|
+
MenubarSubTrigger,
|
|
251
|
+
type MenubarSubTriggerProps,
|
|
252
|
+
MenubarTrigger,
|
|
253
|
+
type MenubarTriggerProps,
|
|
254
|
+
} from "./Menubar.js";
|
|
77
255
|
export {
|
|
78
256
|
MessageScroller,
|
|
79
257
|
type MessageScrollerProps,
|
|
80
258
|
} from "./MessageScroller.js";
|
|
81
259
|
export {
|
|
82
|
-
type NavigationItem,
|
|
83
|
-
type NavigationLink,
|
|
84
260
|
NavigationMenu,
|
|
261
|
+
NavigationMenuContent,
|
|
262
|
+
type NavigationMenuContentProps,
|
|
263
|
+
NavigationMenuIndicator,
|
|
264
|
+
type NavigationMenuIndicatorProps,
|
|
265
|
+
NavigationMenuItem,
|
|
266
|
+
type NavigationMenuItemProps,
|
|
267
|
+
NavigationMenuLink,
|
|
268
|
+
type NavigationMenuLinkProps,
|
|
269
|
+
NavigationMenuList,
|
|
270
|
+
type NavigationMenuListProps,
|
|
85
271
|
type NavigationMenuProps,
|
|
272
|
+
NavigationMenuTrigger,
|
|
273
|
+
type NavigationMenuTriggerProps,
|
|
274
|
+
NavigationMenuViewport,
|
|
275
|
+
type NavigationMenuViewportProps,
|
|
276
|
+
triggerClasses,
|
|
86
277
|
} from "./NavigationMenu.js";
|
|
87
278
|
export {
|
|
88
279
|
Popover,
|
|
280
|
+
PopoverAnchor,
|
|
281
|
+
type PopoverAnchorProps,
|
|
282
|
+
PopoverContent,
|
|
283
|
+
type PopoverContentProps,
|
|
284
|
+
PopoverDescription,
|
|
285
|
+
PopoverHeader,
|
|
89
286
|
type PopoverProps,
|
|
287
|
+
type PopoverSectionProps,
|
|
288
|
+
PopoverTitle,
|
|
289
|
+
PopoverTrigger,
|
|
290
|
+
type PopoverTriggerProps,
|
|
90
291
|
popoverContentClasses,
|
|
91
292
|
} from "./Popover.js";
|
|
92
293
|
export {
|
|
@@ -103,26 +304,86 @@ export {
|
|
|
103
304
|
} from "./Questionnaire.js";
|
|
104
305
|
export {
|
|
105
306
|
Select,
|
|
106
|
-
|
|
307
|
+
SelectContent,
|
|
308
|
+
type SelectContentProps,
|
|
309
|
+
SelectGroup,
|
|
310
|
+
type SelectGroupProps,
|
|
311
|
+
SelectItem,
|
|
312
|
+
type SelectItemProps,
|
|
313
|
+
SelectLabel,
|
|
314
|
+
type SelectLabelProps,
|
|
107
315
|
type SelectProps,
|
|
316
|
+
type SelectScrollButtonProps,
|
|
317
|
+
SelectScrollDownButton,
|
|
318
|
+
SelectScrollUpButton,
|
|
319
|
+
SelectSeparator,
|
|
320
|
+
type SelectSeparatorProps,
|
|
321
|
+
SelectTrigger,
|
|
322
|
+
type SelectTriggerProps,
|
|
323
|
+
SelectValue,
|
|
324
|
+
type SelectValueProps,
|
|
325
|
+
selectContentClasses,
|
|
108
326
|
selectTriggerClasses,
|
|
109
327
|
} from "./Select.js";
|
|
110
|
-
export {
|
|
328
|
+
export {
|
|
329
|
+
Sheet,
|
|
330
|
+
SheetClose,
|
|
331
|
+
type SheetCloseProps,
|
|
332
|
+
SheetContent,
|
|
333
|
+
type SheetContentProps,
|
|
334
|
+
SheetDescription,
|
|
335
|
+
SheetFooter,
|
|
336
|
+
SheetHeader,
|
|
337
|
+
SheetOverlay,
|
|
338
|
+
type SheetOverlayProps,
|
|
339
|
+
type SheetProps,
|
|
340
|
+
type SheetSectionProps,
|
|
341
|
+
SheetTitle,
|
|
342
|
+
type SheetTitleProps,
|
|
343
|
+
SheetTrigger,
|
|
344
|
+
type SheetTriggerProps,
|
|
345
|
+
} from "./Sheet.js";
|
|
111
346
|
export {
|
|
112
347
|
Sidebar,
|
|
348
|
+
type SidebarActionProps,
|
|
349
|
+
type SidebarApi,
|
|
350
|
+
SidebarContent,
|
|
351
|
+
SidebarFooter,
|
|
113
352
|
SidebarGroup,
|
|
353
|
+
SidebarGroupAction,
|
|
354
|
+
SidebarGroupContent,
|
|
114
355
|
SidebarGroupLabel,
|
|
356
|
+
SidebarHeader,
|
|
357
|
+
SidebarInput,
|
|
358
|
+
type SidebarInputProps,
|
|
359
|
+
SidebarInset,
|
|
360
|
+
type SidebarInsetProps,
|
|
115
361
|
SidebarMenu,
|
|
116
362
|
SidebarMenuAction,
|
|
363
|
+
SidebarMenuBadge,
|
|
364
|
+
SidebarMenuButton,
|
|
365
|
+
type SidebarMenuButtonProps,
|
|
366
|
+
type SidebarMenuButtonVariants,
|
|
117
367
|
SidebarMenuItem,
|
|
118
|
-
|
|
368
|
+
SidebarMenuSkeleton,
|
|
369
|
+
type SidebarMenuSkeletonProps,
|
|
119
370
|
SidebarMenuSub,
|
|
371
|
+
SidebarMenuSubButton,
|
|
372
|
+
type SidebarMenuSubButtonProps,
|
|
120
373
|
SidebarMenuSubItem,
|
|
121
374
|
type SidebarProps,
|
|
375
|
+
SidebarProvider,
|
|
376
|
+
type SidebarProviderProps,
|
|
377
|
+
SidebarRail,
|
|
378
|
+
type SidebarRailProps,
|
|
379
|
+
SidebarSeparator,
|
|
380
|
+
type SidebarSeparatorProps,
|
|
122
381
|
SidebarTrigger,
|
|
123
382
|
type SidebarTriggerProps,
|
|
124
383
|
sidebarCollapsed,
|
|
384
|
+
sidebarMenuButtonVariants,
|
|
125
385
|
sidebarState,
|
|
386
|
+
useSidebar,
|
|
126
387
|
} from "./Sidebar.js";
|
|
127
388
|
export {
|
|
128
389
|
Toaster,
|
|
@@ -131,4 +392,13 @@ export {
|
|
|
131
392
|
type ToastVariant,
|
|
132
393
|
toast,
|
|
133
394
|
} from "./Toaster.js";
|
|
134
|
-
export {
|
|
395
|
+
export {
|
|
396
|
+
Tooltip,
|
|
397
|
+
TooltipContent,
|
|
398
|
+
type TooltipContentProps,
|
|
399
|
+
type TooltipProps,
|
|
400
|
+
TooltipProvider,
|
|
401
|
+
type TooltipProviderProps,
|
|
402
|
+
TooltipTrigger,
|
|
403
|
+
type TooltipTriggerProps,
|
|
404
|
+
} from "./Tooltip.js";
|
|
@@ -289,6 +289,30 @@ function bestSide(
|
|
|
289
289
|
return there > here ? other : requested;
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
+
/**
|
|
293
|
+
* `transform-origin` for a surface anchored on `side`.
|
|
294
|
+
*
|
|
295
|
+
* Along the main axis it is the edge facing the anchor: a surface placed above
|
|
296
|
+
* grows downward out of its own bottom edge. Along the cross axis it is the
|
|
297
|
+
* anchor's centre, clamped to the surface, which keeps the origin pointing at
|
|
298
|
+
* the control even after `shift` has slid a wide menu sideways — the same
|
|
299
|
+
* reason the arrow tracks the anchor rather than the surface.
|
|
300
|
+
*/
|
|
301
|
+
function transformOrigin(
|
|
302
|
+
position: Position,
|
|
303
|
+
anchor: Rect,
|
|
304
|
+
floating: Rect,
|
|
305
|
+
): string {
|
|
306
|
+
if (position.side === "top" || position.side === "bottom") {
|
|
307
|
+
const centre = anchor.x + anchor.width / 2 - position.x;
|
|
308
|
+
const x = Math.round(clamp(centre, 0, floating.width));
|
|
309
|
+
return `${x}px ${position.side === "bottom" ? 0 : Math.round(floating.height)}px`;
|
|
310
|
+
}
|
|
311
|
+
const centre = anchor.y + anchor.height / 2 - position.y;
|
|
312
|
+
const y = Math.round(clamp(centre, 0, floating.height));
|
|
313
|
+
return `${position.side === "right" ? 0 : Math.round(floating.width)}px ${y}px`;
|
|
314
|
+
}
|
|
315
|
+
|
|
292
316
|
/**
|
|
293
317
|
* Centre the arrow on the anchor, then pull it back off the corners.
|
|
294
318
|
*
|
|
@@ -388,6 +412,15 @@ export function autoPosition(
|
|
|
388
412
|
"--nebula-anchor-width",
|
|
389
413
|
`${Math.round(anchorRect.width)}px`,
|
|
390
414
|
);
|
|
415
|
+
// The point the surface grows FROM, so `zoom-in-95` expands out of the
|
|
416
|
+
// control that opened it rather than out of its own middle. Radix
|
|
417
|
+
// publishes the same thing as `--radix-popper-transform-origin` and
|
|
418
|
+
// shadcn's surfaces read it through `origin-(…)`; ours are all anchored,
|
|
419
|
+
// so it is written here once instead of per component.
|
|
420
|
+
floating.style.setProperty(
|
|
421
|
+
"--nebula-transform-origin",
|
|
422
|
+
transformOrigin(position, anchorRect, floatingRect),
|
|
423
|
+
);
|
|
391
424
|
floating.setAttribute("data-side", position.side);
|
|
392
425
|
floating.setAttribute("data-align", position.align);
|
|
393
426
|
|
|
@@ -44,6 +44,17 @@ export interface FloatingSurfaceOptions {
|
|
|
44
44
|
offset?: number;
|
|
45
45
|
/** Size the surface to the anchor. Select and Combobox want this. */
|
|
46
46
|
matchWidth?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* The arrow inside the surface, looked up once the content exists.
|
|
49
|
+
*
|
|
50
|
+
* Positioned along the CROSS axis only — centred on the anchor and pulled
|
|
51
|
+
* off the corners — so a surface that `shift` slid sideways still points at
|
|
52
|
+
* its trigger. Which edge it sits on is left to CSS, because that is where
|
|
53
|
+
* the surface's own padding and radius are known.
|
|
54
|
+
*/
|
|
55
|
+
arrow?: (content: HTMLElement) => Element | null;
|
|
56
|
+
/** The arrow's width in pixels. Required for `arrow` to be positioned. */
|
|
57
|
+
arrowSize?: number;
|
|
47
58
|
|
|
48
59
|
/** Keep keyboard focus inside while open. */
|
|
49
60
|
trapFocus?: boolean;
|
|
@@ -126,6 +137,14 @@ export function floatingSurface(options: FloatingSurfaceOptions): void {
|
|
|
126
137
|
placement: options.placement,
|
|
127
138
|
offset: options.offset,
|
|
128
139
|
matchWidth: options.matchWidth,
|
|
140
|
+
arrowSize: options.arrowSize,
|
|
141
|
+
arrow: () => {
|
|
142
|
+
// Narrowed rather than asserted: `querySelector` answers `Element`,
|
|
143
|
+
// and an arrow that turned out to be an SVG node has no `style` to
|
|
144
|
+
// position.
|
|
145
|
+
const found = options.arrow?.(element) ?? null;
|
|
146
|
+
return found instanceof HTMLElement ? found : null;
|
|
147
|
+
},
|
|
129
148
|
});
|
|
130
149
|
|
|
131
150
|
const layer = dismissable({
|
package/src/primitives/menu.ts
CHANGED
|
@@ -91,16 +91,51 @@ export type MenuEntry =
|
|
|
91
91
|
|
|
92
92
|
// ─── classes ─────────────────────────────────────────────────────────
|
|
93
93
|
|
|
94
|
+
/**
|
|
95
|
+
* Upstream's class strings, shared by the three menus built on this module.
|
|
96
|
+
*
|
|
97
|
+
* shadcn repeats them in `dropdown-menu.tsx`, `context-menu.tsx` and
|
|
98
|
+
* `menubar.tsx` because each file is copied on its own. Here all three already
|
|
99
|
+
* depend on this module, and the registry copies it with them, so repeating
|
|
100
|
+
* the strings would only be three places to update when one of them changes.
|
|
101
|
+
*
|
|
102
|
+
* `--nebula-available-height` and `--nebula-transform-origin` stand in for
|
|
103
|
+
* Radix's per-component custom properties; `autoPosition` writes both.
|
|
104
|
+
*/
|
|
94
105
|
export const menuPanelClasses =
|
|
95
|
-
"bg-popover text-popover-foreground z-50 min-w-[8rem]
|
|
106
|
+
"bg-popover text-popover-foreground z-50 max-h-(--nebula-available-height) min-w-[8rem] origin-(--nebula-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md outline-none";
|
|
107
|
+
|
|
108
|
+
/** A submenu panel: no height cap, a deeper shadow. */
|
|
109
|
+
export const menuSubPanelClasses =
|
|
110
|
+
"bg-popover text-popover-foreground z-50 min-w-[8rem] origin-(--nebula-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg outline-none";
|
|
111
|
+
|
|
112
|
+
export const menuItemClasses =
|
|
113
|
+
"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!";
|
|
114
|
+
|
|
115
|
+
/** Checkbox and radio rows: the same, indented to leave room for the mark. */
|
|
116
|
+
export const menuCheckItemClasses =
|
|
117
|
+
"relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4";
|
|
118
|
+
|
|
119
|
+
export const menuIndicatorClasses =
|
|
120
|
+
"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center";
|
|
121
|
+
|
|
122
|
+
export const menuLabelClasses =
|
|
123
|
+
"px-2 py-1.5 text-sm font-medium data-[inset]:pl-8";
|
|
124
|
+
|
|
125
|
+
export const menuSeparatorClasses = "bg-border -mx-1 my-1 h-px";
|
|
126
|
+
|
|
127
|
+
export const menuShortcutClasses =
|
|
128
|
+
"text-muted-foreground ml-auto text-xs tracking-widest";
|
|
96
129
|
|
|
97
|
-
const
|
|
98
|
-
"
|
|
130
|
+
export const menuSubTriggerClasses =
|
|
131
|
+
"flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground";
|
|
132
|
+
|
|
133
|
+
const itemClasses = menuItemClasses;
|
|
99
134
|
|
|
100
135
|
const destructiveClasses =
|
|
101
136
|
"text-destructive focus:bg-destructive/10 focus:text-destructive [&_svg]:text-destructive";
|
|
102
137
|
|
|
103
|
-
const indentedItemClasses =
|
|
138
|
+
const indentedItemClasses = menuCheckItemClasses;
|
|
104
139
|
|
|
105
140
|
// ─── rendering ───────────────────────────────────────────────────────
|
|
106
141
|
|
|
@@ -138,7 +173,7 @@ function renderEntry(entry: MenuEntry, closeAll: () => void): Child {
|
|
|
138
173
|
}
|
|
139
174
|
if (isCheckbox(entry)) return renderCheckbox(entry, closeAll);
|
|
140
175
|
if (isRadioGroup(entry)) return renderRadioGroup(entry, closeAll);
|
|
141
|
-
if (isSubmenu(entry)) return renderSubmenuTrigger(entry);
|
|
176
|
+
if (isSubmenu(entry)) return renderSubmenuTrigger(entry, closeAll);
|
|
142
177
|
return renderAction(entry, closeAll);
|
|
143
178
|
}
|
|
144
179
|
|
|
@@ -220,9 +255,24 @@ function renderRadioGroup(entry: MenuRadioGroup, closeAll: () => void): Child {
|
|
|
220
255
|
* those into the DOM is not possible. `wireMenu` reads them back when the row
|
|
221
256
|
* is opened.
|
|
222
257
|
*/
|
|
223
|
-
const
|
|
258
|
+
const submenuPanels = new WeakMap<Element, SubmenuPanel>();
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* How a submenu's panel is produced when the row is opened.
|
|
262
|
+
*
|
|
263
|
+
* A factory rather than the panel itself, because a submenu is built fresh on
|
|
264
|
+
* each open: a panel kept from a previous open would carry the DOM state
|
|
265
|
+
* `wireMenu` left on it, and reusing a node that has already been torn down is
|
|
266
|
+
* how a menu ends up showing the previous row's entries.
|
|
267
|
+
*
|
|
268
|
+
* The entries-based API supplies one that calls `menuPanel`; the composed
|
|
269
|
+
* parts supply one that returns the markup they were given. `wireMenu` cannot
|
|
270
|
+
* tell the two apart, which is the point — the keyboard model works on the
|
|
271
|
+
* rendered DOM, never on the description that produced it.
|
|
272
|
+
*/
|
|
273
|
+
export type SubmenuPanel = (options: { id: string }) => TemplateResult;
|
|
224
274
|
|
|
225
|
-
function renderSubmenuTrigger(entry: MenuSubmenu): Child {
|
|
275
|
+
function renderSubmenuTrigger(entry: MenuSubmenu, closeAll: () => void): Child {
|
|
226
276
|
const id = uid("menu-sub-trigger");
|
|
227
277
|
const row = html`<div
|
|
228
278
|
role="menuitem"
|
|
@@ -239,7 +289,10 @@ function renderSubmenuTrigger(entry: MenuSubmenu): Child {
|
|
|
239
289
|
${ChevronRightIcon({ class: "ml-auto size-4" })}
|
|
240
290
|
</div>`;
|
|
241
291
|
|
|
242
|
-
|
|
292
|
+
const entries = entry.entries;
|
|
293
|
+
pendingSubmenus.set(id, ({ id: panelId }) =>
|
|
294
|
+
menuPanel({ id: panelId, entries, onCloseAll: closeAll }),
|
|
295
|
+
);
|
|
243
296
|
return row;
|
|
244
297
|
}
|
|
245
298
|
|
|
@@ -251,7 +304,7 @@ function renderSubmenuTrigger(entry: MenuSubmenu): Child {
|
|
|
251
304
|
* each set from here onto the real element and clears the id, so nothing is
|
|
252
305
|
* retained after the menu closes.
|
|
253
306
|
*/
|
|
254
|
-
const pendingSubmenus = new Map<string,
|
|
307
|
+
const pendingSubmenus = new Map<string, SubmenuPanel>();
|
|
255
308
|
|
|
256
309
|
function activate(
|
|
257
310
|
disabled: boolean | undefined,
|
|
@@ -323,14 +376,12 @@ export function wireMenu(
|
|
|
323
376
|
});
|
|
324
377
|
|
|
325
378
|
function openSubmenu(trigger: HTMLElement): void {
|
|
326
|
-
const
|
|
327
|
-
if (
|
|
379
|
+
const build = submenuPanels.get(trigger);
|
|
380
|
+
if (build === undefined) return;
|
|
328
381
|
closeSubmenusFrom(0);
|
|
329
382
|
|
|
330
383
|
const panelId = uid("menu-sub");
|
|
331
|
-
const mount = portal(
|
|
332
|
-
menuPanel({ id: panelId, entries, onCloseAll: options.onCloseAll }),
|
|
333
|
-
);
|
|
384
|
+
const mount = portal(build({ id: panelId }));
|
|
334
385
|
const element = mount.host.firstElementChild;
|
|
335
386
|
if (!(element instanceof HTMLElement)) {
|
|
336
387
|
mount.close();
|
|
@@ -452,18 +503,28 @@ export function wireMenu(
|
|
|
452
503
|
};
|
|
453
504
|
}
|
|
454
505
|
|
|
455
|
-
/** Move each submenu's
|
|
506
|
+
/** Move each submenu's panel factory from the build-time map onto its element. */
|
|
456
507
|
function claimSubmenuEntries(panel: HTMLElement): void {
|
|
457
508
|
for (const node of panel.querySelectorAll("[data-submenu]")) {
|
|
458
509
|
const id = node.getAttribute("data-submenu");
|
|
459
510
|
if (id === null) continue;
|
|
460
|
-
const
|
|
461
|
-
if (
|
|
462
|
-
|
|
511
|
+
const build = pendingSubmenus.get(id);
|
|
512
|
+
if (build === undefined) continue;
|
|
513
|
+
submenuPanels.set(node, build);
|
|
463
514
|
pendingSubmenus.delete(id);
|
|
464
515
|
}
|
|
465
516
|
}
|
|
466
517
|
|
|
518
|
+
/**
|
|
519
|
+
* Register a composed submenu panel against a trigger id.
|
|
520
|
+
*
|
|
521
|
+
* The parts in `DropdownMenu` and friends build their own markup, so they hand
|
|
522
|
+
* the factory over directly instead of going through `MenuEntry`.
|
|
523
|
+
*/
|
|
524
|
+
export function registerSubmenu(id: string, build: SubmenuPanel): void {
|
|
525
|
+
pendingSubmenus.set(id, build);
|
|
526
|
+
}
|
|
527
|
+
|
|
467
528
|
// ─── entry guards ────────────────────────────────────────────────────
|
|
468
529
|
//
|
|
469
530
|
// Discriminating on an optional `type` needs real guards: `entry.type ===
|