@forte-ui/react 1.0.0-alpha.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/README.md +240 -0
- package/dist/Accordion-9JunkjgY.js +111 -0
- package/dist/Alert-Cn_WUF3L.js +183 -0
- package/dist/AspectRatio-gSjpTVk-.js +39 -0
- package/dist/Avatar-BuitDluH.js +87 -0
- package/dist/Badge-sArNWMre.js +33 -0
- package/dist/Breadcrumb-Cq7tFtMX.js +170 -0
- package/dist/Button-AiyKnx5I.js +42 -0
- package/dist/ButtonGroup-C-CrwPXP.js +54 -0
- package/dist/Calendar-D7Q-QJ_e.js +503 -0
- package/dist/Checkbox-DfNbmOed.js +56 -0
- package/dist/Collapsible-D8UKiGip.js +86 -0
- package/dist/ColorPicker-B-eCI31W.js +612 -0
- package/dist/Combobox-D-BN-Tvp.js +302 -0
- package/dist/ContextMenu-D81uDaMG.js +44 -0
- package/dist/DatePicker-CfkMsaI-.js +192 -0
- package/dist/Dialog-_n8FpFs5.js +432 -0
- package/dist/Drawer-DKQF3OO7.js +158 -0
- package/dist/Field-FLFEO70D.js +58 -0
- package/dist/Fieldset-CYhh71Qt.js +28 -0
- package/dist/Form-DVPmW9XV.js +17 -0
- package/dist/Input-BgGWhO2q.js +18 -0
- package/dist/InputGroup-DsZyDXNn.js +89 -0
- package/dist/Menu-CKu9xE2h.js +261 -0
- package/dist/Menubar-Dax027Db.js +19 -0
- package/dist/NavList-DGvcIoJm.js +176 -0
- package/dist/NavigationMenu-BayQkUUb.js +209 -0
- package/dist/NumberField-P55SA8T7.js +191 -0
- package/dist/OTPField-CjHvBNSN.js +55 -0
- package/dist/Popover-BXhn2Wwt.js +142 -0
- package/dist/PreviewCard-Dnitrky0.js +99 -0
- package/dist/Progress-BlomDp-X.js +81 -0
- package/dist/ProgressCircle-j6XBl0fk.js +112 -0
- package/dist/Radio-BIcX4INJ.js +37 -0
- package/dist/Resizable-7nJJM97e.js +609 -0
- package/dist/ScrollArea-CBMGJ6hh.js +83 -0
- package/dist/Select-BP-zvdXm.js +237 -0
- package/dist/Separator-DewJBzaJ.js +21 -0
- package/dist/Skeleton-zr6ObCCq.js +79 -0
- package/dist/Slider-Bh8_cti1.js +104 -0
- package/dist/Spinner-BF0uD4hR.js +53 -0
- package/dist/Switch-OBewMMvM.js +39 -0
- package/dist/Tabs-LgkSbPSF.js +132 -0
- package/dist/Textarea-CqZJL41e.js +51 -0
- package/dist/Toast-BWayxAcd.js +304 -0
- package/dist/Toggle-BrhMnkF5.js +45 -0
- package/dist/Toolbar-OmOVCk3i.js +88 -0
- package/dist/Tooltip-CI4chsRw.js +101 -0
- package/dist/clsx-By2n9mTe.js +16 -0
- package/dist/cn.d.ts +8 -0
- package/dist/cn.js +11 -0
- package/dist/components/accordion/Accordion.d.ts +117 -0
- package/dist/components/accordion/Accordion.js +3 -0
- package/dist/components/accordion/index.d.ts +2 -0
- package/dist/components/accordion/index.js +2 -0
- package/dist/components/alert/Alert.d.ts +167 -0
- package/dist/components/alert/Alert.js +3 -0
- package/dist/components/alert/index.d.ts +2 -0
- package/dist/components/alert/index.js +2 -0
- package/dist/components/aspect-ratio/AspectRatio.d.ts +128 -0
- package/dist/components/aspect-ratio/AspectRatio.js +3 -0
- package/dist/components/aspect-ratio/index.d.ts +2 -0
- package/dist/components/aspect-ratio/index.js +2 -0
- package/dist/components/avatar/Avatar.d.ts +176 -0
- package/dist/components/avatar/Avatar.js +3 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/avatar/index.js +2 -0
- package/dist/components/badge/Badge.d.ts +117 -0
- package/dist/components/badge/Badge.js +3 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/badge/index.js +2 -0
- package/dist/components/breadcrumb/Breadcrumb.d.ts +244 -0
- package/dist/components/breadcrumb/Breadcrumb.js +3 -0
- package/dist/components/breadcrumb/index.d.ts +2 -0
- package/dist/components/breadcrumb/index.js +2 -0
- package/dist/components/button/Button.d.ts +73 -0
- package/dist/components/button/Button.js +3 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button/index.js +2 -0
- package/dist/components/button-group/ButtonGroup.d.ts +113 -0
- package/dist/components/button-group/ButtonGroup.js +3 -0
- package/dist/components/button-group/index.d.ts +2 -0
- package/dist/components/button-group/index.js +2 -0
- package/dist/components/calendar/Calendar.d.ts +201 -0
- package/dist/components/calendar/Calendar.js +3 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/calendar/index.js +2 -0
- package/dist/components/checkbox/Checkbox.d.ts +130 -0
- package/dist/components/checkbox/Checkbox.js +3 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/checkbox/index.js +2 -0
- package/dist/components/collapsible/Collapsible.d.ts +91 -0
- package/dist/components/collapsible/Collapsible.js +3 -0
- package/dist/components/collapsible/index.d.ts +2 -0
- package/dist/components/collapsible/index.js +2 -0
- package/dist/components/color-picker/ColorPicker.d.ts +553 -0
- package/dist/components/color-picker/ColorPicker.js +4 -0
- package/dist/components/color-picker/color.d.ts +102 -0
- package/dist/components/color-picker/color.js +249 -0
- package/dist/components/color-picker/index.d.ts +2 -0
- package/dist/components/color-picker/index.js +3 -0
- package/dist/components/combobox/Combobox.d.ts +553 -0
- package/dist/components/combobox/Combobox.js +3 -0
- package/dist/components/combobox/index.d.ts +2 -0
- package/dist/components/combobox/index.js +2 -0
- package/dist/components/context-menu/ContextMenu.d.ts +103 -0
- package/dist/components/context-menu/ContextMenu.js +3 -0
- package/dist/components/context-menu/index.d.ts +3 -0
- package/dist/components/context-menu/index.js +2 -0
- package/dist/components/date-picker/DatePicker.d.ts +268 -0
- package/dist/components/date-picker/DatePicker.js +3 -0
- package/dist/components/date-picker/index.d.ts +2 -0
- package/dist/components/date-picker/index.js +2 -0
- package/dist/components/dialog/Dialog.d.ts +567 -0
- package/dist/components/dialog/Dialog.js +3 -0
- package/dist/components/dialog/index.d.ts +2 -0
- package/dist/components/dialog/index.js +2 -0
- package/dist/components/drawer/Drawer.d.ts +351 -0
- package/dist/components/drawer/Drawer.js +3 -0
- package/dist/components/drawer/index.d.ts +2 -0
- package/dist/components/drawer/index.js +2 -0
- package/dist/components/field/Field.d.ts +170 -0
- package/dist/components/field/Field.js +3 -0
- package/dist/components/field/index.d.ts +2 -0
- package/dist/components/field/index.js +2 -0
- package/dist/components/fieldset/Fieldset.d.ts +60 -0
- package/dist/components/fieldset/Fieldset.js +3 -0
- package/dist/components/fieldset/index.d.ts +2 -0
- package/dist/components/fieldset/index.js +2 -0
- package/dist/components/form/Form.d.ts +76 -0
- package/dist/components/form/Form.js +3 -0
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/index.js +2 -0
- package/dist/components/input/Input.d.ts +67 -0
- package/dist/components/input/Input.js +3 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/index.js +2 -0
- package/dist/components/input-group/InputGroup.d.ts +214 -0
- package/dist/components/input-group/InputGroup.js +3 -0
- package/dist/components/input-group/index.d.ts +2 -0
- package/dist/components/input-group/index.js +2 -0
- package/dist/components/menu/Menu.d.ts +587 -0
- package/dist/components/menu/Menu.js +3 -0
- package/dist/components/menu/index.d.ts +2 -0
- package/dist/components/menu/index.js +2 -0
- package/dist/components/menubar/Menubar.d.ts +104 -0
- package/dist/components/menubar/Menubar.js +3 -0
- package/dist/components/menubar/index.d.ts +2 -0
- package/dist/components/menubar/index.js +2 -0
- package/dist/components/nav-list/NavList.d.ts +290 -0
- package/dist/components/nav-list/NavList.js +3 -0
- package/dist/components/nav-list/index.d.ts +2 -0
- package/dist/components/nav-list/index.js +2 -0
- package/dist/components/navigation-menu/NavigationMenu.d.ts +483 -0
- package/dist/components/navigation-menu/NavigationMenu.js +3 -0
- package/dist/components/navigation-menu/index.d.ts +2 -0
- package/dist/components/navigation-menu/index.js +2 -0
- package/dist/components/number-field/NumberField.d.ts +303 -0
- package/dist/components/number-field/NumberField.js +3 -0
- package/dist/components/number-field/index.d.ts +2 -0
- package/dist/components/number-field/index.js +2 -0
- package/dist/components/otp-field/OTPField.d.ts +206 -0
- package/dist/components/otp-field/OTPField.js +3 -0
- package/dist/components/otp-field/index.d.ts +2 -0
- package/dist/components/otp-field/index.js +2 -0
- package/dist/components/popover/Popover.d.ts +394 -0
- package/dist/components/popover/Popover.js +3 -0
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/popover/index.js +2 -0
- package/dist/components/preview-card/PreviewCard.d.ts +307 -0
- package/dist/components/preview-card/PreviewCard.js +3 -0
- package/dist/components/preview-card/index.d.ts +2 -0
- package/dist/components/preview-card/index.js +2 -0
- package/dist/components/progress/Progress.d.ts +156 -0
- package/dist/components/progress/Progress.js +3 -0
- package/dist/components/progress/ProgressCircle.d.ts +166 -0
- package/dist/components/progress/ProgressCircle.js +3 -0
- package/dist/components/progress/index.d.ts +4 -0
- package/dist/components/progress/index.js +3 -0
- package/dist/components/radio/Radio.d.ts +144 -0
- package/dist/components/radio/Radio.js +3 -0
- package/dist/components/radio/index.d.ts +2 -0
- package/dist/components/radio/index.js +2 -0
- package/dist/components/resizable/Resizable.d.ts +211 -0
- package/dist/components/resizable/Resizable.js +3 -0
- package/dist/components/resizable/index.d.ts +2 -0
- package/dist/components/resizable/index.js +2 -0
- package/dist/components/scroll-area/ScrollArea.d.ts +113 -0
- package/dist/components/scroll-area/ScrollArea.js +3 -0
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/index.js +2 -0
- package/dist/components/select/Select.d.ts +345 -0
- package/dist/components/select/Select.js +3 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.js +2 -0
- package/dist/components/separator/Separator.d.ts +75 -0
- package/dist/components/separator/Separator.js +3 -0
- package/dist/components/separator/index.d.ts +2 -0
- package/dist/components/separator/index.js +2 -0
- package/dist/components/skeleton/Skeleton.d.ts +169 -0
- package/dist/components/skeleton/Skeleton.js +3 -0
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/skeleton/index.js +2 -0
- package/dist/components/slider/Slider.d.ts +208 -0
- package/dist/components/slider/Slider.js +3 -0
- package/dist/components/slider/index.d.ts +2 -0
- package/dist/components/slider/index.js +2 -0
- package/dist/components/spinner/Spinner.d.ts +92 -0
- package/dist/components/spinner/Spinner.js +3 -0
- package/dist/components/spinner/index.d.ts +2 -0
- package/dist/components/spinner/index.js +2 -0
- package/dist/components/switch/Switch.d.ts +80 -0
- package/dist/components/switch/Switch.js +3 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/index.js +2 -0
- package/dist/components/tabs/Tabs.d.ts +125 -0
- package/dist/components/tabs/Tabs.js +3 -0
- package/dist/components/tabs/index.d.ts +2 -0
- package/dist/components/tabs/index.js +2 -0
- package/dist/components/textarea/Textarea.d.ts +119 -0
- package/dist/components/textarea/Textarea.js +3 -0
- package/dist/components/textarea/index.d.ts +2 -0
- package/dist/components/textarea/index.js +2 -0
- package/dist/components/toast/Toast.d.ts +517 -0
- package/dist/components/toast/Toast.js +3 -0
- package/dist/components/toast/index.d.ts +2 -0
- package/dist/components/toast/index.js +2 -0
- package/dist/components/toggle/Toggle.d.ts +171 -0
- package/dist/components/toggle/Toggle.js +3 -0
- package/dist/components/toggle/index.d.ts +2 -0
- package/dist/components/toggle/index.js +2 -0
- package/dist/components/toolbar/Toolbar.d.ts +318 -0
- package/dist/components/toolbar/Toolbar.js +3 -0
- package/dist/components/toolbar/index.d.ts +2 -0
- package/dist/components/toolbar/index.js +2 -0
- package/dist/components/tooltip/Tooltip.d.ts +361 -0
- package/dist/components/tooltip/Tooltip.js +3 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/index.js +2 -0
- package/dist/index.d.ts +92 -0
- package/dist/index.js +86 -0
- package/dist/styles/Accordion.css +1 -0
- package/dist/styles/Alert.css +1 -0
- package/dist/styles/AspectRatio.css +1 -0
- package/dist/styles/Avatar.css +1 -0
- package/dist/styles/Badge.css +1 -0
- package/dist/styles/Breadcrumb.css +1 -0
- package/dist/styles/Button.css +1 -0
- package/dist/styles/ButtonGroup.css +1 -0
- package/dist/styles/Calendar.css +1 -0
- package/dist/styles/Checkbox.css +1 -0
- package/dist/styles/Collapsible.css +1 -0
- package/dist/styles/ColorPicker.css +1 -0
- package/dist/styles/Combobox.css +1 -0
- package/dist/styles/ContextMenu.css +1 -0
- package/dist/styles/DatePicker.css +1 -0
- package/dist/styles/Dialog.css +1 -0
- package/dist/styles/Drawer.css +1 -0
- package/dist/styles/Field.css +1 -0
- package/dist/styles/Fieldset.css +1 -0
- package/dist/styles/Form.css +1 -0
- package/dist/styles/Input.css +1 -0
- package/dist/styles/InputGroup.css +1 -0
- package/dist/styles/Menu.css +1 -0
- package/dist/styles/Menubar.css +1 -0
- package/dist/styles/NavList.css +1 -0
- package/dist/styles/NavigationMenu.css +1 -0
- package/dist/styles/NumberField.css +1 -0
- package/dist/styles/OTPField.css +1 -0
- package/dist/styles/Popover.css +1 -0
- package/dist/styles/PreviewCard.css +1 -0
- package/dist/styles/Progress.css +1 -0
- package/dist/styles/ProgressCircle.css +1 -0
- package/dist/styles/Radio.css +1 -0
- package/dist/styles/Resizable.css +1 -0
- package/dist/styles/ScrollArea.css +1 -0
- package/dist/styles/Select.css +1 -0
- package/dist/styles/Separator.css +1 -0
- package/dist/styles/Skeleton.css +1 -0
- package/dist/styles/Slider.css +1 -0
- package/dist/styles/Spinner.css +1 -0
- package/dist/styles/Switch.css +1 -0
- package/dist/styles/Tabs.css +1 -0
- package/dist/styles/Textarea.css +1 -0
- package/dist/styles/Toast.css +1 -0
- package/dist/styles/Toggle.css +1 -0
- package/dist/styles/Toolbar.css +1 -0
- package/dist/styles/Tooltip.css +1 -0
- package/dist/styles/a11y.css +119 -0
- package/dist/styles/layers.css +39 -0
- package/dist/styles/motion.css +194 -0
- package/dist/styles/patterns.css +236 -0
- package/dist/styles/properties.css +62 -0
- package/dist/styles/reset.css +11 -0
- package/dist/styles/tailwind.css +281 -0
- package/dist/styles/theme.css +57 -0
- package/dist/styles/tokens.color.css +223 -0
- package/dist/styles/tokens.css +460 -0
- package/dist/tailwind-merge.d.ts +52 -0
- package/dist/tailwind-merge.js +52 -0
- package/docs-data/props.json +8047 -0
- package/docs-data/theming.json +9600 -0
- package/docs-data/tokens.json +4070 -0
- package/package.json +78 -0
|
@@ -0,0 +1,587 @@
|
|
|
1
|
+
import { Menu as BaseMenu } from '@base-ui/react/menu';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type MenuItemTone = "neutral" | "danger";
|
|
4
|
+
/**
|
|
5
|
+
* What opened the popup, which is what decides its placement defaults.
|
|
6
|
+
*
|
|
7
|
+
* Internal: the three providers are `Menu.Root`, `Menu.SubmenuRoot` and
|
|
8
|
+
* `ContextMenu.Root`, and nothing else may set it.
|
|
9
|
+
*/
|
|
10
|
+
export type MenuPlacementKind = "menu" | "submenu" | "context-menu";
|
|
11
|
+
/** @internal — see `MenuPlacementKind`. Not exported from the package. */
|
|
12
|
+
export declare const MenuPlacementContext: React.Context<MenuPlacementKind>;
|
|
13
|
+
/**
|
|
14
|
+
* Props for {@link MenuRoot}. A re-export of Base UI's own root props, kept
|
|
15
|
+
* generic so `<Menu.Root<Payload>>` still types the render-function form of
|
|
16
|
+
* `children` and the `payload` a trigger hands over.
|
|
17
|
+
*/
|
|
18
|
+
export type MenuRootProps<Payload = unknown> = BaseMenu.Root.Props<Payload>;
|
|
19
|
+
/**
|
|
20
|
+
* Groups every part of the menu and owns its open state. Renders no DOM
|
|
21
|
+
* element of its own, so it accepts neither `className` nor `ref`.
|
|
22
|
+
*
|
|
23
|
+
* Forwards Base UI's root props unchanged — `open`, `defaultOpen`,
|
|
24
|
+
* `onOpenChange`, `modal`, `orientation`, `loopFocus`, `highlightItemOnHover`,
|
|
25
|
+
* `disabled` and the `handle` / `triggerId` pair that lets a detached trigger
|
|
26
|
+
* drive it.
|
|
27
|
+
*/
|
|
28
|
+
export declare function MenuRoot<Payload = unknown>(props: MenuRootProps<Payload>): React.JSX.Element;
|
|
29
|
+
export interface MenuTriggerProps<Payload = unknown> extends Omit<BaseMenu.Trigger.Props<Payload>, "className"> {
|
|
30
|
+
/**
|
|
31
|
+
* Also open the menu when the trigger is hovered. Off by default, and worth
|
|
32
|
+
* leaving off for a standalone menu: a menu that opens on hover is a menu
|
|
33
|
+
* that opens by accident on the way to somewhere else.
|
|
34
|
+
*
|
|
35
|
+
* Inside a `<Menubar>` it turns itself on, but only once a sibling menu in
|
|
36
|
+
* the same bar is already open — which is what makes the row behave as one
|
|
37
|
+
* strip after the first click without any of its triggers firing at a
|
|
38
|
+
* passing pointer. Pass it explicitly to override that either way.
|
|
39
|
+
* @default false, or true inside a `Menubar` with a menu already open
|
|
40
|
+
*/
|
|
41
|
+
openOnHover?: BaseMenu.Trigger.Props<Payload>["openOnHover"];
|
|
42
|
+
/**
|
|
43
|
+
* How long the pointer must rest on the trigger before the menu opens, in
|
|
44
|
+
* milliseconds. Requires `openOnHover`.
|
|
45
|
+
* @default 100
|
|
46
|
+
*/
|
|
47
|
+
delay?: BaseMenu.Trigger.Props<Payload>["delay"];
|
|
48
|
+
/**
|
|
49
|
+
* How long the menu lingers after the pointer leaves, in milliseconds.
|
|
50
|
+
* Requires `openOnHover`.
|
|
51
|
+
* @default 0
|
|
52
|
+
*/
|
|
53
|
+
closeDelay?: BaseMenu.Trigger.Props<Payload>["closeDelay"];
|
|
54
|
+
/**
|
|
55
|
+
* Whether the rendered element is a real `<button>`. Set it to `false` when
|
|
56
|
+
* `render` replaces the button with something else (a `<div>`, a table
|
|
57
|
+
* row), so Base UI supplies the keyboard and role behaviour the element
|
|
58
|
+
* does not have natively.
|
|
59
|
+
* @default true
|
|
60
|
+
*/
|
|
61
|
+
nativeButton?: BaseMenu.Trigger.Props<Payload>["nativeButton"];
|
|
62
|
+
/**
|
|
63
|
+
* Associates a detached trigger with the `Menu.Root` carrying the same
|
|
64
|
+
* handle, created once outside render with `Menu.createHandle()`.
|
|
65
|
+
*/
|
|
66
|
+
handle?: BaseMenu.Trigger.Props<Payload>["handle"];
|
|
67
|
+
/**
|
|
68
|
+
* Data handed to the menu when this trigger opens it, so one popup can
|
|
69
|
+
* render different items per trigger. Read it from the render-function form
|
|
70
|
+
* of `Menu.Root`'s children.
|
|
71
|
+
*/
|
|
72
|
+
payload?: BaseMenu.Trigger.Props<Payload>["payload"];
|
|
73
|
+
/**
|
|
74
|
+
* Replaces the rendered `<button>` with another element or component —
|
|
75
|
+
* `render={<Button variant="outline" />}` is the common case. The trigger's
|
|
76
|
+
* own neutral styling steps aside when this is present, so the two never
|
|
77
|
+
* fight over the cascade.
|
|
78
|
+
*/
|
|
79
|
+
render?: BaseMenu.Trigger.Props<Payload>["render"];
|
|
80
|
+
/**
|
|
81
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
82
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
83
|
+
*/
|
|
84
|
+
className?: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Generic-preserving component type. `React.forwardRef` erases the type
|
|
88
|
+
* parameter, so the cast below restores it — otherwise `payload` would widen
|
|
89
|
+
* to `unknown` at every call site.
|
|
90
|
+
*/
|
|
91
|
+
interface MenuTriggerComponent {
|
|
92
|
+
<Payload>(props: MenuTriggerProps<Payload> & React.RefAttributes<HTMLButtonElement>): React.JSX.Element;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The button that opens the menu. Renders a `<button>`.
|
|
96
|
+
*
|
|
97
|
+
* Base UI wires it to the popup with `aria-haspopup="menu"`, `aria-expanded`
|
|
98
|
+
* and `aria-controls`, so it needs no `aria-label` describing the menu itself.
|
|
99
|
+
* An icon-only trigger still needs a name of its own, as any icon-only button
|
|
100
|
+
* does.
|
|
101
|
+
*/
|
|
102
|
+
export declare const MenuTrigger: MenuTriggerComponent;
|
|
103
|
+
type PositionerProps = BaseMenu.Positioner.Props;
|
|
104
|
+
type BasePopupProps = BaseMenu.Popup.Props;
|
|
105
|
+
type BasePortalProps = BaseMenu.Portal.Props;
|
|
106
|
+
export interface MenuPopupProps extends Omit<BasePopupProps, "className"> {
|
|
107
|
+
/**
|
|
108
|
+
* The items, groups and separators to render.
|
|
109
|
+
*/
|
|
110
|
+
children?: React.ReactNode;
|
|
111
|
+
/**
|
|
112
|
+
* Which side of the trigger the popup opens on. Flips automatically to
|
|
113
|
+
* avoid collisions.
|
|
114
|
+
*
|
|
115
|
+
* `"inline-start"` / `"inline-end"` follow writing direction, but Base UI
|
|
116
|
+
* takes that direction from its own `DirectionProvider` context and not from
|
|
117
|
+
* the `dir` attribute — with no provider mounted it is `"ltr"`, so the two
|
|
118
|
+
* resolve to left and right whatever `dir` says. An RTL app has to mount
|
|
119
|
+
* `<DirectionProvider direction="rtl">` for them to mirror. The library's own
|
|
120
|
+
* CSS reads the attribute, so everything else here flips without it.
|
|
121
|
+
* @default "bottom"; "inline-end" inside a `Menu.SubmenuRoot`; the popup is
|
|
122
|
+
* anchored to the pointer instead inside a `ContextMenu.Root`
|
|
123
|
+
*/
|
|
124
|
+
side?: PositionerProps["side"];
|
|
125
|
+
/**
|
|
126
|
+
* How the popup aligns along the chosen side. Menus align to the trigger's
|
|
127
|
+
* start edge rather than its centre, which is Base UI's own default — a
|
|
128
|
+
* centred menu drifts left of a wide trigger and right of a narrow one, and
|
|
129
|
+
* the reading edge is what a list of commands should line up on.
|
|
130
|
+
* @default "start"
|
|
131
|
+
*/
|
|
132
|
+
align?: PositionerProps["align"];
|
|
133
|
+
/**
|
|
134
|
+
* Gap in pixels between the trigger and the popup.
|
|
135
|
+
* @default 4; -4 inside a `Menu.SubmenuRoot`; -5 inside a `ContextMenu.Root`
|
|
136
|
+
*/
|
|
137
|
+
sideOffset?: PositionerProps["sideOffset"];
|
|
138
|
+
/**
|
|
139
|
+
* Extra offset in pixels along the alignment axis.
|
|
140
|
+
* @default 0; -4 inside a `Menu.SubmenuRoot`; 2 inside a `ContextMenu.Root`
|
|
141
|
+
*/
|
|
142
|
+
alignOffset?: PositionerProps["alignOffset"];
|
|
143
|
+
/**
|
|
144
|
+
* Space to keep between the popup and the edge of its collision boundary.
|
|
145
|
+
* @default 5
|
|
146
|
+
*/
|
|
147
|
+
collisionPadding?: PositionerProps["collisionPadding"];
|
|
148
|
+
/**
|
|
149
|
+
* An element to position the popup against instead of the trigger.
|
|
150
|
+
*/
|
|
151
|
+
anchor?: PositionerProps["anchor"];
|
|
152
|
+
/**
|
|
153
|
+
* Render the popup into a different container instead of `<body>`.
|
|
154
|
+
*/
|
|
155
|
+
container?: BasePortalProps["container"];
|
|
156
|
+
/**
|
|
157
|
+
* Render a dimming layer behind the popup. Off by default — a menu is a
|
|
158
|
+
* short-lived list, not a mode — but useful on small screens where the
|
|
159
|
+
* popup covers most of the page.
|
|
160
|
+
* @default false
|
|
161
|
+
*/
|
|
162
|
+
backdrop?: boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Where focus goes when the menu closes. There is no `initialFocus`
|
|
165
|
+
* counterpart: Base UI moves focus into the popup on open, to the first
|
|
166
|
+
* item for a keyboard open and to the popup itself for a pointer one.
|
|
167
|
+
* @default the trigger
|
|
168
|
+
*/
|
|
169
|
+
finalFocus?: BasePopupProps["finalFocus"];
|
|
170
|
+
/**
|
|
171
|
+
* Additional class name(s) for the popup surface. Applied after the
|
|
172
|
+
* internal styles so consumer utilities win without needing `!important`.
|
|
173
|
+
*/
|
|
174
|
+
className?: string;
|
|
175
|
+
/**
|
|
176
|
+
* Additional class name(s) for the positioner — the absolutely positioned
|
|
177
|
+
* wrapper around the popup. This is the only way to reach
|
|
178
|
+
* `--forte-menu-z-index`, the one property declared there.
|
|
179
|
+
*/
|
|
180
|
+
positionerClassName?: string;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* The floating surface holding the items. Renders a `<div>` with
|
|
184
|
+
* `role="menu"`.
|
|
185
|
+
*
|
|
186
|
+
* This one part renders the whole floating half of Base UI's anatomy —
|
|
187
|
+
* `Portal` → (`Backdrop`) → `Positioner` → `Popup` — because those elements
|
|
188
|
+
* are meaningless apart and each has a job the styles depend on: the
|
|
189
|
+
* positioner owns `--available-height` and `--transform-origin`, and the popup
|
|
190
|
+
* owns the surface and the scrolling.
|
|
191
|
+
*
|
|
192
|
+
* Inside a `<Menu.SubmenuRoot>` the placement defaults change: the popup opens
|
|
193
|
+
* off the inline end of the row rather than below it, and two negative offsets
|
|
194
|
+
* tuck it against the parent so the first submenu item lines up with the
|
|
195
|
+
* trigger row. Inside a `<ContextMenu.Root>` they change again — the popup is
|
|
196
|
+
* anchored to the point the pointer was at rather than to any element, and
|
|
197
|
+
* Base UI supplies the offsets that land its corner on the cursor. Pass any of
|
|
198
|
+
* `side`, `align`, `sideOffset` or `alignOffset` explicitly to override that.
|
|
199
|
+
*/
|
|
200
|
+
export declare const MenuPopup: React.ForwardRefExoticComponent<Omit<MenuPopupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
201
|
+
export interface MenuItemProps extends Omit<BaseMenu.Item.Props, "className"> {
|
|
202
|
+
/**
|
|
203
|
+
* The item's label, plus anything else the row shows — a leading icon, a
|
|
204
|
+
* trailing `<Menu.Shortcut>`.
|
|
205
|
+
*/
|
|
206
|
+
children?: React.ReactNode;
|
|
207
|
+
/**
|
|
208
|
+
* Which semantic colour set the row draws from. `danger` is for an action
|
|
209
|
+
* that destroys something, and is the only alternative offered: the
|
|
210
|
+
* highlight already paints `--forte-color-primary-soft`, so a primary-toned
|
|
211
|
+
* row would be indistinguishable from the row the user is currently on.
|
|
212
|
+
* @default "neutral"
|
|
213
|
+
*/
|
|
214
|
+
tone?: MenuItemTone;
|
|
215
|
+
/**
|
|
216
|
+
* Whether the item ignores user interaction. A disabled item stays in the
|
|
217
|
+
* list, stays announced, and is still reached by the arrow keys and by
|
|
218
|
+
* typeahead — so the command remains discoverable; it just cannot be run.
|
|
219
|
+
* @default false
|
|
220
|
+
*/
|
|
221
|
+
disabled?: BaseMenu.Item.Props["disabled"];
|
|
222
|
+
/**
|
|
223
|
+
* Plain-text label used for typeahead when `children` is not a string.
|
|
224
|
+
*/
|
|
225
|
+
label?: BaseMenu.Item.Props["label"];
|
|
226
|
+
/**
|
|
227
|
+
* Whether choosing the item closes the menu. Leave it on for a command;
|
|
228
|
+
* turn it off for a row that only changes something on screen.
|
|
229
|
+
* @default true
|
|
230
|
+
*/
|
|
231
|
+
closeOnClick?: BaseMenu.Item.Props["closeOnClick"];
|
|
232
|
+
/**
|
|
233
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
234
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
235
|
+
*/
|
|
236
|
+
className?: string;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* One command in the menu. Renders a `<div>` with `role="menuitem"`.
|
|
240
|
+
*
|
|
241
|
+
* `data-highlighted` is the focus analogue here: Base UI moves real DOM focus
|
|
242
|
+
* between rows with a roving tabindex, and (with `highlightItemOnHover`, on by
|
|
243
|
+
* default) pointer hover sets the same attribute. Because the popup scrolls,
|
|
244
|
+
* and a scroll container clips, the focus ring is applied inset via
|
|
245
|
+
* `data-focus-inset` so `overflow` cannot crop it.
|
|
246
|
+
*/
|
|
247
|
+
export declare const MenuItem: React.ForwardRefExoticComponent<Omit<MenuItemProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
248
|
+
export interface MenuLinkItemProps extends Omit<BaseMenu.LinkItem.Props, "className"> {
|
|
249
|
+
/**
|
|
250
|
+
* The link's label, plus anything else the row shows.
|
|
251
|
+
*/
|
|
252
|
+
children?: React.ReactNode;
|
|
253
|
+
/**
|
|
254
|
+
* Where the link goes.
|
|
255
|
+
*/
|
|
256
|
+
href?: string;
|
|
257
|
+
/**
|
|
258
|
+
* Plain-text label used for typeahead when `children` is not a string.
|
|
259
|
+
*/
|
|
260
|
+
label?: BaseMenu.LinkItem.Props["label"];
|
|
261
|
+
/**
|
|
262
|
+
* Whether following the link closes the menu. Base UI leaves this off
|
|
263
|
+
* because a link that opens in a new tab leaves the menu's own page
|
|
264
|
+
* standing — turn it on for a same-tab navigation.
|
|
265
|
+
* @default false
|
|
266
|
+
*/
|
|
267
|
+
closeOnClick?: BaseMenu.LinkItem.Props["closeOnClick"];
|
|
268
|
+
/**
|
|
269
|
+
* Replaces the rendered `<a>` with another element or component —
|
|
270
|
+
* `render={<Link href="/settings" />}` is how a framework's router link goes
|
|
271
|
+
* in without losing the menu's keyboard behaviour.
|
|
272
|
+
*/
|
|
273
|
+
render?: BaseMenu.LinkItem.Props["render"];
|
|
274
|
+
/**
|
|
275
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
276
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
277
|
+
*/
|
|
278
|
+
className?: string;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* A row that navigates rather than acting. Renders an `<a>` with
|
|
282
|
+
* `role="menuitem"`, so it keeps the menu's arrow-key navigation and typeahead
|
|
283
|
+
* while still being a real link — middle-click, ⌘-click and "copy link
|
|
284
|
+
* address" all work, which they do not on an item with an `onClick` that calls
|
|
285
|
+
* `router.push`.
|
|
286
|
+
*/
|
|
287
|
+
export declare const MenuLinkItem: React.ForwardRefExoticComponent<Omit<MenuLinkItemProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
288
|
+
export interface MenuCheckboxItemProps extends Omit<BaseMenu.CheckboxItem.Props, "className"> {
|
|
289
|
+
/**
|
|
290
|
+
* The item's label.
|
|
291
|
+
*/
|
|
292
|
+
children?: React.ReactNode;
|
|
293
|
+
/**
|
|
294
|
+
* Whether the item is ticked. Pass it to control the item; use
|
|
295
|
+
* `defaultChecked` for the uncontrolled form.
|
|
296
|
+
*/
|
|
297
|
+
checked?: BaseMenu.CheckboxItem.Props["checked"];
|
|
298
|
+
/**
|
|
299
|
+
* Whether the item starts out ticked.
|
|
300
|
+
* @default false
|
|
301
|
+
*/
|
|
302
|
+
defaultChecked?: BaseMenu.CheckboxItem.Props["defaultChecked"];
|
|
303
|
+
/**
|
|
304
|
+
* Called when the item is ticked or unticked.
|
|
305
|
+
*/
|
|
306
|
+
onCheckedChange?: BaseMenu.CheckboxItem.Props["onCheckedChange"];
|
|
307
|
+
/**
|
|
308
|
+
* Whether choosing the item closes the menu. Off by default, which is what
|
|
309
|
+
* lets a run of toggles be set in one visit.
|
|
310
|
+
* @default false
|
|
311
|
+
*/
|
|
312
|
+
closeOnClick?: BaseMenu.CheckboxItem.Props["closeOnClick"];
|
|
313
|
+
/**
|
|
314
|
+
* What marks the item as ticked. Rendered inside the indicator, which only
|
|
315
|
+
* mounts while the item is checked.
|
|
316
|
+
* @default <CheckIcon />
|
|
317
|
+
*/
|
|
318
|
+
indicator?: React.ReactNode;
|
|
319
|
+
/**
|
|
320
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
321
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
322
|
+
*/
|
|
323
|
+
className?: string;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* A row that toggles a setting. Renders a `<div>` with
|
|
327
|
+
* `role="menuitemcheckbox"` and `aria-checked`.
|
|
328
|
+
*
|
|
329
|
+
* Rendering one of these anywhere in a popup indents every other row in that
|
|
330
|
+
* popup to match, so labels stay in one column instead of stepping in and out
|
|
331
|
+
* around the tick marks — see `.popup:has(...)` in the stylesheet.
|
|
332
|
+
*/
|
|
333
|
+
export declare const MenuCheckboxItem: React.ForwardRefExoticComponent<Omit<MenuCheckboxItemProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
334
|
+
export interface MenuRadioGroupProps extends Omit<BaseMenu.RadioGroup.Props, "className"> {
|
|
335
|
+
/**
|
|
336
|
+
* The radio items, and any group label above them.
|
|
337
|
+
*/
|
|
338
|
+
children?: React.ReactNode;
|
|
339
|
+
/**
|
|
340
|
+
* The selected value. Pass it to control the group; use `defaultValue` for
|
|
341
|
+
* the uncontrolled form.
|
|
342
|
+
*/
|
|
343
|
+
value?: BaseMenu.RadioGroup.Props["value"];
|
|
344
|
+
/**
|
|
345
|
+
* The value selected on first render.
|
|
346
|
+
*/
|
|
347
|
+
defaultValue?: BaseMenu.RadioGroup.Props["defaultValue"];
|
|
348
|
+
/**
|
|
349
|
+
* Called when the selection changes.
|
|
350
|
+
*/
|
|
351
|
+
onValueChange?: BaseMenu.RadioGroup.Props["onValueChange"];
|
|
352
|
+
/**
|
|
353
|
+
* Whether the whole group ignores user interaction.
|
|
354
|
+
* @default false
|
|
355
|
+
*/
|
|
356
|
+
disabled?: BaseMenu.RadioGroup.Props["disabled"];
|
|
357
|
+
/**
|
|
358
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
359
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
360
|
+
*/
|
|
361
|
+
className?: string;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* A set of rows where exactly one is chosen. Renders a `<div>` with
|
|
365
|
+
* `role="group"`; it owns the value, so the items inside it carry only their
|
|
366
|
+
* own `value`.
|
|
367
|
+
*
|
|
368
|
+
* Put a `<Menu.GroupLabel>` inside it to name the set — Base UI associates the
|
|
369
|
+
* two the same way it does for `<Menu.Group>`.
|
|
370
|
+
*/
|
|
371
|
+
export declare const MenuRadioGroup: React.ForwardRefExoticComponent<Omit<MenuRadioGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
372
|
+
export interface MenuRadioItemProps extends Omit<BaseMenu.RadioItem.Props, "className"> {
|
|
373
|
+
/**
|
|
374
|
+
* The item's label.
|
|
375
|
+
*/
|
|
376
|
+
children?: React.ReactNode;
|
|
377
|
+
/**
|
|
378
|
+
* The value this row selects in its `<Menu.RadioGroup>`.
|
|
379
|
+
*/
|
|
380
|
+
value: BaseMenu.RadioItem.Props["value"];
|
|
381
|
+
/**
|
|
382
|
+
* Whether choosing the item closes the menu. Off by default, matching
|
|
383
|
+
* `Menu.CheckboxItem`.
|
|
384
|
+
* @default false
|
|
385
|
+
*/
|
|
386
|
+
closeOnClick?: BaseMenu.RadioItem.Props["closeOnClick"];
|
|
387
|
+
/**
|
|
388
|
+
* What marks the row as selected. Rendered inside the indicator, which only
|
|
389
|
+
* mounts while the item is the chosen one.
|
|
390
|
+
* @default <DotIcon />
|
|
391
|
+
*/
|
|
392
|
+
indicator?: React.ReactNode;
|
|
393
|
+
/**
|
|
394
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
395
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
396
|
+
*/
|
|
397
|
+
className?: string;
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* One choice in a `<Menu.RadioGroup>`. Renders a `<div>` with
|
|
401
|
+
* `role="menuitemradio"` and `aria-checked`.
|
|
402
|
+
*
|
|
403
|
+
* The default marker is a dot rather than a tick — the same distinction the
|
|
404
|
+
* platform menus draw, and the only cue separating "one of these" from "any of
|
|
405
|
+
* these" once both kinds of row share a popup.
|
|
406
|
+
*/
|
|
407
|
+
export declare const MenuRadioItem: React.ForwardRefExoticComponent<Omit<MenuRadioItemProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
408
|
+
export interface MenuGroupProps extends Omit<BaseMenu.Group.Props, "className"> {
|
|
409
|
+
/**
|
|
410
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
411
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
412
|
+
*/
|
|
413
|
+
className?: string;
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Groups related items under a heading. Renders a `<div>` with
|
|
417
|
+
* `role="group"`; Base UI associates it with the `<Menu.GroupLabel>` inside it
|
|
418
|
+
* automatically, so the heading is announced with its members.
|
|
419
|
+
*/
|
|
420
|
+
export declare const MenuGroup: React.ForwardRefExoticComponent<Omit<MenuGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
421
|
+
export interface MenuGroupLabelProps extends Omit<BaseMenu.GroupLabel.Props, "className"> {
|
|
422
|
+
/**
|
|
423
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
424
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
425
|
+
*/
|
|
426
|
+
className?: string;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* The heading for a `<Menu.Group>` or a `<Menu.RadioGroup>`. Renders a
|
|
430
|
+
* `<div>`, indented to the same column as the item labels below it.
|
|
431
|
+
*
|
|
432
|
+
* It must be inside one of those two — the association is what makes it a
|
|
433
|
+
* heading rather than a line of text, and Base UI throws rather than render an
|
|
434
|
+
* unassociated one. For a caption that names the whole menu, use a separator
|
|
435
|
+
* and an ordinary `<Menu.Group>` around the rows it introduces.
|
|
436
|
+
*/
|
|
437
|
+
export declare const MenuGroupLabel: React.ForwardRefExoticComponent<Omit<MenuGroupLabelProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
438
|
+
type BaseSeparatorProps = React.ComponentPropsWithoutRef<typeof BaseMenu.Separator>;
|
|
439
|
+
export interface MenuSeparatorProps extends Omit<BaseSeparatorProps, "className"> {
|
|
440
|
+
/**
|
|
441
|
+
* Orientation of the rule. A menu is a vertical list, so the divider
|
|
442
|
+
* between two runs of items is horizontal.
|
|
443
|
+
* @default "horizontal"
|
|
444
|
+
*/
|
|
445
|
+
orientation?: BaseSeparatorProps["orientation"];
|
|
446
|
+
/**
|
|
447
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
448
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
449
|
+
*/
|
|
450
|
+
className?: string;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* A divider between runs of items. Renders a `<div>` with `role="separator"`,
|
|
454
|
+
* so the grouping it draws is exposed to assistive technology rather than
|
|
455
|
+
* being a purely visual line.
|
|
456
|
+
*/
|
|
457
|
+
export declare const MenuSeparator: React.ForwardRefExoticComponent<MenuSeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
458
|
+
export interface MenuSubmenuRootProps extends BaseMenu.SubmenuRoot.Props {
|
|
459
|
+
/**
|
|
460
|
+
* The submenu's `<Menu.SubmenuTrigger>` and its `<Menu.Popup>`.
|
|
461
|
+
*/
|
|
462
|
+
children?: React.ReactNode;
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Groups a submenu's trigger and popup. Renders no DOM element of its own, so
|
|
466
|
+
* it accepts neither `className` nor `ref`.
|
|
467
|
+
*
|
|
468
|
+
* It goes *inside* the parent `<Menu.Popup>`, where its trigger takes the
|
|
469
|
+
* place of an item. Everything below it opens sideways rather than downward —
|
|
470
|
+
* `<Menu.Popup>` reads that from here, so a submenu needs no positioning props
|
|
471
|
+
* of its own.
|
|
472
|
+
*/
|
|
473
|
+
export declare function MenuSubmenuRoot({ children, ...props }: MenuSubmenuRootProps): React.JSX.Element;
|
|
474
|
+
export interface MenuSubmenuTriggerProps extends Omit<BaseMenu.SubmenuTrigger.Props, "className"> {
|
|
475
|
+
/**
|
|
476
|
+
* The row's label.
|
|
477
|
+
*/
|
|
478
|
+
children?: React.ReactNode;
|
|
479
|
+
/**
|
|
480
|
+
* The affordance at the end of the row. Defaults to a chevron, which is
|
|
481
|
+
* mirrored in RTL so it keeps pointing at the side the submenu opens on.
|
|
482
|
+
* @default <ChevronIcon />
|
|
483
|
+
*/
|
|
484
|
+
icon?: React.ReactNode;
|
|
485
|
+
/**
|
|
486
|
+
* Whether the row ignores user interaction.
|
|
487
|
+
* @default false
|
|
488
|
+
*/
|
|
489
|
+
disabled?: BaseMenu.SubmenuTrigger.Props["disabled"];
|
|
490
|
+
/**
|
|
491
|
+
* Plain-text label used for typeahead when `children` is not a string.
|
|
492
|
+
*/
|
|
493
|
+
label?: BaseMenu.SubmenuTrigger.Props["label"];
|
|
494
|
+
/**
|
|
495
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
496
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
497
|
+
*/
|
|
498
|
+
className?: string;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* The row that opens a submenu. Renders a `<div>` with `role="menuitem"` and
|
|
502
|
+
* `aria-haspopup="menu"`.
|
|
503
|
+
*
|
|
504
|
+
* It behaves as an item in every other way — it is highlighted, it answers
|
|
505
|
+
* typeahead, and it opens on hover as well as on press, with Base UI's safe
|
|
506
|
+
* triangle keeping the submenu up while the pointer travels diagonally toward
|
|
507
|
+
* it.
|
|
508
|
+
*/
|
|
509
|
+
export declare const MenuSubmenuTrigger: React.ForwardRefExoticComponent<Omit<MenuSubmenuTriggerProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
510
|
+
export interface MenuShortcutProps extends Omit<React.ComponentPropsWithoutRef<"span">, "className"> {
|
|
511
|
+
/**
|
|
512
|
+
* The keys, written the way they are printed — `⌘K`, `Ctrl+K`, `⇧⌘P`.
|
|
513
|
+
*/
|
|
514
|
+
children?: React.ReactNode;
|
|
515
|
+
/**
|
|
516
|
+
* Additional class name(s). Applied after the internal styles so consumer
|
|
517
|
+
* utilities (e.g. Tailwind) win without needing `!important`.
|
|
518
|
+
*/
|
|
519
|
+
className?: string;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* The keyboard shortcut printed at the end of a row. Renders a `<span>`, and
|
|
523
|
+
* is not a Base UI part — it is here for the same reason `Dialog.Footer` is:
|
|
524
|
+
* every second menu grows one, and left to each consumer it is re-invented
|
|
525
|
+
* with a different colour and a different gap each time.
|
|
526
|
+
*
|
|
527
|
+
* It is `aria-hidden`, deliberately. The glyphs menus print are read out as
|
|
528
|
+
* "place of interest sign K" or "up arrowhead command P" — worse than silence.
|
|
529
|
+
* Put the shortcut on the item instead, where assistive technology expects to
|
|
530
|
+
* find it and where it is spelled in words:
|
|
531
|
+
*
|
|
532
|
+
* ```tsx
|
|
533
|
+
* <Menu.Item aria-keyshortcuts="Meta+K">
|
|
534
|
+
* Search
|
|
535
|
+
* <Menu.Shortcut>⌘K</Menu.Shortcut>
|
|
536
|
+
* </Menu.Item>
|
|
537
|
+
* ```
|
|
538
|
+
*/
|
|
539
|
+
export declare const MenuShortcut: React.ForwardRefExoticComponent<MenuShortcutProps & React.RefAttributes<HTMLSpanElement>>;
|
|
540
|
+
/**
|
|
541
|
+
* A dropdown menu built on Base UI's unstyled `Menu` primitives.
|
|
542
|
+
*
|
|
543
|
+
* ```tsx
|
|
544
|
+
* <Menu.Root>
|
|
545
|
+
* <Menu.Trigger>Actions</Menu.Trigger>
|
|
546
|
+
* <Menu.Popup>
|
|
547
|
+
* <Menu.Item onClick={duplicate}>Duplicate</Menu.Item>
|
|
548
|
+
* <Menu.Separator />
|
|
549
|
+
* <Menu.Item tone="danger" onClick={remove}>Delete</Menu.Item>
|
|
550
|
+
* </Menu.Popup>
|
|
551
|
+
* </Menu.Root>
|
|
552
|
+
* ```
|
|
553
|
+
*
|
|
554
|
+
* Styling is driven entirely by `data-*` attributes and `--forte-menu-*` custom
|
|
555
|
+
* properties, so it can be re-skinned from plain CSS or targeted with Tailwind
|
|
556
|
+
* arbitrary variants (`data-[highlighted]:...`) without wrapping. Each part
|
|
557
|
+
* declares its own knobs, so an ancestor's value is only inherited and loses —
|
|
558
|
+
* set them on the part itself via `className`. The popup is portalled to
|
|
559
|
+
* `<body>` as well, so an ancestor of the trigger could not reach it in any
|
|
560
|
+
* case; `positionerClassName` reaches `--forte-menu-z-index`, the only property
|
|
561
|
+
* declared on the positioner. The global `--forte-color-*` / `--forte-control-*` /
|
|
562
|
+
* `--forte-radius-*` / `--forte-space-*` tokens these resolve to ARE inherited, so
|
|
563
|
+
* re-pointing those from `:root` or a theme scope moves every menu at once.
|
|
564
|
+
*/
|
|
565
|
+
export declare const Menu: {
|
|
566
|
+
Root: typeof MenuRoot;
|
|
567
|
+
Trigger: MenuTriggerComponent;
|
|
568
|
+
Popup: React.ForwardRefExoticComponent<Omit<MenuPopupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
569
|
+
Item: React.ForwardRefExoticComponent<Omit<MenuItemProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
570
|
+
LinkItem: React.ForwardRefExoticComponent<Omit<MenuLinkItemProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
571
|
+
CheckboxItem: React.ForwardRefExoticComponent<Omit<MenuCheckboxItemProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
572
|
+
RadioGroup: React.ForwardRefExoticComponent<Omit<MenuRadioGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
573
|
+
RadioItem: React.ForwardRefExoticComponent<Omit<MenuRadioItemProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
574
|
+
Group: React.ForwardRefExoticComponent<Omit<MenuGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
575
|
+
GroupLabel: React.ForwardRefExoticComponent<Omit<MenuGroupLabelProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
576
|
+
Separator: React.ForwardRefExoticComponent<MenuSeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
577
|
+
SubmenuRoot: typeof MenuSubmenuRoot;
|
|
578
|
+
SubmenuTrigger: React.ForwardRefExoticComponent<Omit<MenuSubmenuTriggerProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
579
|
+
Shortcut: React.ForwardRefExoticComponent<MenuShortcutProps & React.RefAttributes<HTMLSpanElement>>;
|
|
580
|
+
/**
|
|
581
|
+
* Creates a handle that lets a trigger rendered outside `Menu.Root` open it
|
|
582
|
+
* — a toolbar button and its menu living in different parts of the tree.
|
|
583
|
+
* Call it once, outside render, and pass the result to both.
|
|
584
|
+
*/
|
|
585
|
+
createHandle: typeof BaseMenu.createHandle;
|
|
586
|
+
};
|
|
587
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { a as e, c as t, d as n, f as r, g as i, h as a, i as o, l as s, m as c, n as l, o as u, p as d, r as f, s as p, t as m, u as h } from "../../Menu-CKu9xE2h.js";
|
|
3
|
+
export { m as Menu, l as MenuCheckboxItem, f as MenuGroup, o as MenuGroupLabel, e as MenuItem, u as MenuLinkItem, p as MenuPlacementContext, t as MenuPopup, s as MenuRadioGroup, h as MenuRadioItem, n as MenuRoot, r as MenuSeparator, d as MenuShortcut, c as MenuSubmenuRoot, a as MenuSubmenuTrigger, i as MenuTrigger };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { Menu } from './Menu';
|
|
2
|
+
export type { MenuItemTone, MenuRootProps, MenuTriggerProps, MenuPopupProps, MenuItemProps, MenuLinkItemProps, MenuCheckboxItemProps, MenuRadioGroupProps, MenuRadioItemProps, MenuGroupProps, MenuGroupLabelProps, MenuSeparatorProps, MenuSubmenuRootProps, MenuSubmenuTriggerProps, MenuShortcutProps, } from './Menu';
|