@arcfusionz/arc-primitive-ui 0.1.0 → 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/components/AILoader/AILoader.d.ts +32 -0
- package/dist/components/AILoader/AILoader.js +157 -0
- package/dist/components/AILoader/index.d.ts +2 -0
- package/dist/components/AILoader/index.js +2 -0
- package/dist/components/Accordion/Accordion.d.ts +96 -0
- package/dist/components/Accordion/Accordion.js +149 -0
- package/dist/components/Accordion/index.d.ts +2 -0
- package/dist/components/Accordion/index.js +2 -0
- package/dist/components/Avatar/Avatar.d.ts +152 -0
- package/dist/components/Avatar/Avatar.js +216 -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 +87 -0
- package/dist/components/Badge/Badge.js +118 -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 +109 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +182 -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 +57 -0
- package/dist/components/Button/Button.js +177 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Button/index.js +2 -0
- package/dist/components/Calendar/Calendar.d.ts +140 -0
- package/dist/components/Calendar/Calendar.js +468 -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 +60 -0
- package/dist/components/Checkbox/Checkbox.js +129 -0
- package/dist/components/Checkbox/index.d.ts +2 -0
- package/dist/components/Checkbox/index.js +2 -0
- package/dist/components/Combobox/Combobox.d.ts +251 -0
- package/dist/components/Combobox/Combobox.js +354 -0
- package/dist/components/Combobox/index.d.ts +2 -0
- package/dist/components/Combobox/index.js +2 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts +129 -0
- package/dist/components/ContextMenu/ContextMenu.js +93 -0
- package/dist/components/ContextMenu/index.d.ts +2 -0
- package/dist/components/ContextMenu/index.js +2 -0
- package/dist/components/DatePicker/DatePicker.d.ts +109 -0
- package/dist/components/DatePicker/DatePicker.js +145 -0
- package/dist/components/DatePicker/index.d.ts +2 -0
- package/dist/components/DatePicker/index.js +2 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +107 -0
- package/dist/components/DateRangePicker/DateRangePicker.js +161 -0
- package/dist/components/DateRangePicker/index.d.ts +2 -0
- package/dist/components/DateRangePicker/index.js +2 -0
- package/dist/components/Dialog/Dialog.d.ts +112 -0
- package/dist/components/Dialog/Dialog.js +141 -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 +188 -0
- package/dist/components/Drawer/Drawer.js +268 -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 +123 -0
- package/dist/components/Field/Field.js +241 -0
- package/dist/components/Field/FieldContext.d.ts +43 -0
- package/dist/components/Field/FieldContext.js +28 -0
- package/dist/components/Field/index.d.ts +3 -0
- package/dist/components/Field/index.js +3 -0
- package/dist/components/Fieldset/Fieldset.d.ts +43 -0
- package/dist/components/Fieldset/Fieldset.js +48 -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 +54 -0
- package/dist/components/Form/Form.js +57 -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 +64 -0
- package/dist/components/Input/Input.js +111 -0
- package/dist/components/Input/index.d.ts +2 -0
- package/dist/components/Input/index.js +2 -0
- package/dist/components/Menu/Menu.d.ts +212 -0
- package/dist/components/Menu/Menu.js +255 -0
- package/dist/components/Menu/index.d.ts +2 -0
- package/dist/components/Menu/index.js +2 -0
- package/dist/components/Popover/Popover.d.ts +122 -0
- package/dist/components/Popover/Popover.js +116 -0
- package/dist/components/Popover/index.d.ts +2 -0
- package/dist/components/Popover/index.js +2 -0
- package/dist/components/Progress/Progress.d.ts +87 -0
- package/dist/components/Progress/Progress.js +73 -0
- package/dist/components/Progress/index.d.ts +2 -0
- package/dist/components/Progress/index.js +2 -0
- package/dist/components/Radio/Radio.d.ts +65 -0
- package/dist/components/Radio/Radio.js +93 -0
- package/dist/components/Radio/index.d.ts +2 -0
- package/dist/components/Radio/index.js +2 -0
- package/dist/components/Select/Select.d.ts +136 -0
- package/dist/components/Select/Select.js +219 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/Select/index.js +2 -0
- package/dist/components/Skeleton/Skeleton.d.ts +39 -0
- package/dist/components/Skeleton/Skeleton.js +44 -0
- package/dist/components/Skeleton/index.d.ts +2 -0
- package/dist/components/Skeleton/index.js +2 -0
- package/dist/components/Stepper/Stepper.d.ts +161 -0
- package/dist/components/Stepper/Stepper.js +344 -0
- package/dist/components/Stepper/index.d.ts +2 -0
- package/dist/components/Stepper/index.js +2 -0
- package/dist/components/Switch/Switch.d.ts +56 -0
- package/dist/components/Switch/Switch.js +87 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/Switch/index.js +2 -0
- package/dist/components/Table/Table.d.ts +116 -0
- package/dist/components/Table/Table.js +143 -0
- package/dist/components/Table/index.d.ts +2 -0
- package/dist/components/Table/index.js +2 -0
- package/dist/components/Tabs/Tabs.d.ts +116 -0
- package/dist/components/Tabs/Tabs.js +158 -0
- package/dist/components/Tabs/index.d.ts +2 -0
- package/dist/components/Tabs/index.js +2 -0
- package/dist/components/Timeline/Timeline.d.ts +137 -0
- package/dist/components/Timeline/Timeline.js +243 -0
- package/dist/components/Timeline/index.d.ts +2 -0
- package/dist/components/Timeline/index.js +2 -0
- package/dist/components/Toast/Toast.d.ts +135 -0
- package/dist/components/Toast/Toast.js +314 -0
- package/dist/components/Toast/index.d.ts +2 -0
- package/dist/components/Toast/index.js +2 -0
- package/dist/components/Tooltip/Tooltip.d.ts +104 -0
- package/dist/components/Tooltip/Tooltip.js +95 -0
- package/dist/components/Tooltip/index.d.ts +2 -0
- package/dist/components/Tooltip/index.js +2 -0
- package/dist/components/Typography/Typography.d.ts +38 -0
- package/dist/components/Typography/Typography.js +53 -0
- package/dist/components/Typography/index.d.ts +2 -0
- package/dist/components/Typography/index.js +2 -0
- package/dist/index.d.ts +66 -3398
- package/dist/index.js +34 -5343
- package/dist/lib/cn.d.ts +6 -0
- package/dist/lib/cn.js +9 -0
- package/package.json +6 -2
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, HTMLAttributes } from "react";
|
|
2
|
+
import { Menu } from "@base-ui/react/menu";
|
|
3
|
+
//#region src/components/Menu/Menu.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Groups the menu parts and owns the open state. A menu lists **actions**
|
|
6
|
+
* (role `menu`); to pick a value that a field keeps showing, use Select.
|
|
7
|
+
* This is Base UI's `Menu.Root` re-exported unchanged, so every root feature
|
|
8
|
+
* is available: `open`/`defaultOpen`/`onOpenChange(open, details)`,
|
|
9
|
+
* `modal` (defaults `true` — page scroll locks while open), `disabled`,
|
|
10
|
+
* `loopFocus`, `orientation`, `highlightItemOnHover`, and
|
|
11
|
+
* `handle`/`triggerId` for detached triggers.
|
|
12
|
+
*/
|
|
13
|
+
declare const Menu$1: <Payload>(props: Menu.Root.Props<Payload>) => import("react").JSX.Element;
|
|
14
|
+
type MenuProps = ComponentPropsWithoutRef<typeof Menu.Root>;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a handle that links `Menu` with `MenuTrigger`s rendered elsewhere
|
|
17
|
+
* in the tree (toolbars, table rows). Triggers may attach a `payload`, which
|
|
18
|
+
* the `Menu` children render function receives.
|
|
19
|
+
*/
|
|
20
|
+
declare const createMenuHandle: typeof Menu.createHandle;
|
|
21
|
+
type MenuHandle<Payload = unknown> = Menu.Handle<Payload>;
|
|
22
|
+
interface MenuTriggerProps extends Omit<ComponentPropsWithoutRef<typeof Menu.Trigger>, "className"> {
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The button that opens the menu. Ships unstyled so the visual comes from
|
|
27
|
+
* composition — render the design system's Button:
|
|
28
|
+
*
|
|
29
|
+
* <MenuTrigger render={<Button variant="outline" />}>Options</MenuTrigger>
|
|
30
|
+
*
|
|
31
|
+
* For the kebab/ellipsis pattern, Button's icon-only form already enforces
|
|
32
|
+
* the accessible name:
|
|
33
|
+
*
|
|
34
|
+
* <MenuTrigger render={<Button variant="ghost" iconOnly aria-label="Row actions" />}>
|
|
35
|
+
* <EllipsisIcon />
|
|
36
|
+
* </MenuTrigger>
|
|
37
|
+
*
|
|
38
|
+
* While its menu is open the element carries `data-popup-open`, the hook for
|
|
39
|
+
* a pressed look (e.g. `className="data-popup-open:bg-muted"`). `openOnHover`
|
|
40
|
+
* with `delay`/`closeDelay` (100/0ms defaults) is available but click-to-open
|
|
41
|
+
* is the reliable default for action menus — hover menus misfire on the way
|
|
42
|
+
* to other targets.
|
|
43
|
+
*/
|
|
44
|
+
declare const MenuTrigger: import("react").ForwardRefExoticComponent<MenuTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
45
|
+
type BasePositionerProps = ComponentPropsWithoutRef<typeof Menu.Positioner>;
|
|
46
|
+
type MenuSide = NonNullable<BasePositionerProps["side"]>;
|
|
47
|
+
type MenuAlign = NonNullable<BasePositionerProps["align"]>;
|
|
48
|
+
interface MenuPopupProps extends Omit<ComponentPropsWithoutRef<typeof Menu.Popup>, "className"> {
|
|
49
|
+
/**
|
|
50
|
+
* Side of the anchor to place the popup on; flips automatically when there
|
|
51
|
+
* is no room. When omitted, Base UI picks the menu default: `bottom` for a
|
|
52
|
+
* top-level menu, the inline end (submenu convention) inside a
|
|
53
|
+
* `MenuSubmenuRoot` — so leave it unset unless the layout demands a side.
|
|
54
|
+
*/
|
|
55
|
+
side?: MenuSide;
|
|
56
|
+
/**
|
|
57
|
+
* How the popup lines up along the chosen side. When omitted, top-level
|
|
58
|
+
* menus center on the trigger and submenus align `start` so their panel
|
|
59
|
+
* tracks the trigger row.
|
|
60
|
+
*/
|
|
61
|
+
align?: MenuAlign;
|
|
62
|
+
/**
|
|
63
|
+
* Gap between anchor and popup in pixels. Defaults adapt to the resolved
|
|
64
|
+
* side: 4px below/above a trigger, and a 4px *overlap* for submenus so the
|
|
65
|
+
* pointer never crosses a dead zone between panels.
|
|
66
|
+
*/
|
|
67
|
+
sideOffset?: BasePositionerProps["sideOffset"];
|
|
68
|
+
/**
|
|
69
|
+
* Additional shift along the alignment axis in pixels. Defaults adapt: 0
|
|
70
|
+
* for top-level menus, -4px for submenus so the first item lines up with
|
|
71
|
+
* the submenu trigger's row.
|
|
72
|
+
*/
|
|
73
|
+
alignOffset?: BasePositionerProps["alignOffset"];
|
|
74
|
+
/** Minimum space kept from the viewport (or collision boundary) edges when repositioning. */
|
|
75
|
+
collisionPadding?: BasePositionerProps["collisionPadding"];
|
|
76
|
+
/** Position against this element instead of the trigger (e.g. the whole toolbar while a button opens the menu). */
|
|
77
|
+
anchor?: BasePositionerProps["anchor"];
|
|
78
|
+
/** Keep the popup in the DOM while closed — for SEO or measuring; closed popups normally unmount. */
|
|
79
|
+
keepMounted?: boolean;
|
|
80
|
+
/** Portal destination. Defaults to `document.body`. */
|
|
81
|
+
container?: ComponentPropsWithoutRef<typeof Menu.Portal>["container"];
|
|
82
|
+
/**
|
|
83
|
+
* Applied to the popup panel. Width hooks: the panel is content-sized from
|
|
84
|
+
* 8rem up — set `w-*`/`max-w-*` for a fixed width or
|
|
85
|
+
* `min-w-[var(--anchor-width)]` to never be narrower than the trigger.
|
|
86
|
+
* Long menus scroll inside the panel; cap them earlier with `max-h-*`.
|
|
87
|
+
*/
|
|
88
|
+
className?: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The floating list of menu items, with the portal and positioning plumbing
|
|
92
|
+
* folded in. Anchored to its trigger by default; opens with a motion-safe
|
|
93
|
+
* scale/fade from the anchor-facing corner. The same component nests inside
|
|
94
|
+
* `MenuSubmenuRoot`, where its placement defaults switch to the submenu
|
|
95
|
+
* conventions (inline-end side, overlapped edge, trigger-row alignment).
|
|
96
|
+
*/
|
|
97
|
+
declare const MenuPopup: import("react").ForwardRefExoticComponent<MenuPopupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
98
|
+
type MenuItemVariant = "default" | "destructive";
|
|
99
|
+
interface MenuItemVariantsOptions {
|
|
100
|
+
variant?: MenuItemVariant;
|
|
101
|
+
inset?: boolean;
|
|
102
|
+
className?: string;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Class list for an element styled as a menu item — for menu-shaped rows
|
|
106
|
+
* that don't come from Base UI (command palettes, custom listboxes) so every
|
|
107
|
+
* item row in the product shares one look.
|
|
108
|
+
*/
|
|
109
|
+
declare function menuItemVariants({ variant, inset, className }?: MenuItemVariantsOptions): string;
|
|
110
|
+
interface MenuItemProps extends Omit<ComponentPropsWithoutRef<typeof Menu.Item>, "className"> {
|
|
111
|
+
/** Visual tone: `destructive` marks irreversible actions (delete, revoke) in the error hue. */
|
|
112
|
+
variant?: MenuItemVariant;
|
|
113
|
+
/** Indent the label into the indicator column so it aligns with checkbox/radio items in the same menu. */
|
|
114
|
+
inset?: boolean;
|
|
115
|
+
className?: string;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* One action in the menu. Children are free-form — a leading `<svg>` icon is
|
|
119
|
+
* sized and muted automatically. Set `label` when children aren't plain text
|
|
120
|
+
* so keyboard typeahead still matches, `disabled` for unavailable actions
|
|
121
|
+
* (keep them visible so users can see what exists), and `closeOnClick={false}`
|
|
122
|
+
* to keep the menu open after the action runs.
|
|
123
|
+
*/
|
|
124
|
+
declare const MenuItem: import("react").ForwardRefExoticComponent<MenuItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
125
|
+
interface MenuLinkItemProps extends Omit<ComponentPropsWithoutRef<typeof Menu.LinkItem>, "className"> {
|
|
126
|
+
/** Indent the label into the indicator column so it aligns with checkbox/radio items in the same menu. */
|
|
127
|
+
inset?: boolean;
|
|
128
|
+
className?: string;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* A navigation entry that keeps link semantics — it renders a real `<a>`
|
|
132
|
+
* (never a button styled as one), so it supports open-in-new-tab, copy link,
|
|
133
|
+
* and middle-click. Pass `href` directly, or compose a client-side router
|
|
134
|
+
* link via `render={<Link to="…" />}`.
|
|
135
|
+
*/
|
|
136
|
+
declare const MenuLinkItem: import("react").ForwardRefExoticComponent<MenuLinkItemProps & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
137
|
+
type MenuShortcutProps = HTMLAttributes<HTMLSpanElement>;
|
|
138
|
+
/**
|
|
139
|
+
* Right-aligned keyboard hint inside an item (`⌘N`, `Ctrl+D`). Purely
|
|
140
|
+
* visual — it does not register the shortcut; wire the actual key handling
|
|
141
|
+
* in the app. Helper text mirrors Typography caption.
|
|
142
|
+
*/
|
|
143
|
+
declare const MenuShortcut: import("react").ForwardRefExoticComponent<MenuShortcutProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
144
|
+
interface MenuGroupProps extends Omit<ComponentPropsWithoutRef<typeof Menu.Group>, "className"> {
|
|
145
|
+
className?: string;
|
|
146
|
+
}
|
|
147
|
+
/** Groups related items under a `MenuGroupLabel`, announced together by assistive technology. */
|
|
148
|
+
declare const MenuGroup: import("react").ForwardRefExoticComponent<MenuGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
149
|
+
interface MenuGroupLabelProps extends Omit<ComponentPropsWithoutRef<typeof Menu.GroupLabel>, "className"> {
|
|
150
|
+
/** Indent the label into the indicator column so it aligns with checkbox/radio items in the same menu. */
|
|
151
|
+
inset?: boolean;
|
|
152
|
+
className?: string;
|
|
153
|
+
}
|
|
154
|
+
/** Heading for a `MenuGroup` (or `MenuRadioGroup`) — visually a meta caption, wired to the group via `aria-labelledby`. */
|
|
155
|
+
declare const MenuGroupLabel: import("react").ForwardRefExoticComponent<MenuGroupLabelProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
156
|
+
interface MenuSeparatorProps extends Omit<ComponentPropsWithoutRef<typeof Menu.Separator>, "className"> {
|
|
157
|
+
className?: string;
|
|
158
|
+
}
|
|
159
|
+
/** Divider between item groups, exposed to screen readers as a separator. */
|
|
160
|
+
declare const MenuSeparator: import("react").ForwardRefExoticComponent<MenuSeparatorProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
161
|
+
interface MenuCheckboxItemProps extends Omit<ComponentPropsWithoutRef<typeof Menu.CheckboxItem>, "className"> {
|
|
162
|
+
className?: string;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* An item that toggles a setting on or off — a check mark fills the leading
|
|
166
|
+
* indicator column while `checked`. Control it with
|
|
167
|
+
* `checked`/`defaultChecked`/`onCheckedChange`. It keeps the menu open on
|
|
168
|
+
* click by default (Base UI's `closeOnClick={false}`) so several settings
|
|
169
|
+
* can be flipped in one visit.
|
|
170
|
+
*/
|
|
171
|
+
declare const MenuCheckboxItem: import("react").ForwardRefExoticComponent<MenuCheckboxItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
172
|
+
interface MenuRadioGroupProps extends Omit<ComponentPropsWithoutRef<typeof Menu.RadioGroup>, "className"> {
|
|
173
|
+
className?: string;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Groups `MenuRadioItem`s into a single-choice set and owns its value:
|
|
177
|
+
* `value`/`defaultValue`/`onValueChange(value, details)`. Label the set with
|
|
178
|
+
* a `MenuGroupLabel` inside the group.
|
|
179
|
+
*/
|
|
180
|
+
declare const MenuRadioGroup: import("react").ForwardRefExoticComponent<MenuRadioGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
181
|
+
interface MenuRadioItemProps extends Omit<ComponentPropsWithoutRef<typeof Menu.RadioItem>, "className"> {
|
|
182
|
+
className?: string;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* One option of a `MenuRadioGroup` — a dot fills the leading indicator
|
|
186
|
+
* column while selected. `value` is required; the menu stays open on click
|
|
187
|
+
* by default so the choice can be reconsidered without reopening.
|
|
188
|
+
*/
|
|
189
|
+
declare const MenuRadioItem: import("react").ForwardRefExoticComponent<MenuRadioItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
190
|
+
/**
|
|
191
|
+
* Groups the parts of a nested menu; renders no HTML. Place it among the
|
|
192
|
+
* parent's items with a `MenuSubmenuTrigger` and a nested `MenuPopup`
|
|
193
|
+
* inside. Keep nesting to one level — deeper trees are hard to steer
|
|
194
|
+
* (and to reach on touch screens). Accepts Base UI's SubmenuRoot props
|
|
195
|
+
* (`open`/`defaultOpen`/`onOpenChange`, `disabled`, `closeParentOnEsc`).
|
|
196
|
+
*/
|
|
197
|
+
declare const MenuSubmenuRoot: typeof Menu.SubmenuRoot;
|
|
198
|
+
type MenuSubmenuRootProps = ComponentPropsWithoutRef<typeof Menu.SubmenuRoot>;
|
|
199
|
+
interface MenuSubmenuTriggerProps extends Omit<ComponentPropsWithoutRef<typeof Menu.SubmenuTrigger>, "className"> {
|
|
200
|
+
/** Indent the label into the indicator column so it aligns with checkbox/radio items in the same menu. */
|
|
201
|
+
inset?: boolean;
|
|
202
|
+
className?: string;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* The item that opens a submenu — a trailing chevron is appended
|
|
206
|
+
* automatically, and the row stays tinted (`data-popup-open`) while its
|
|
207
|
+
* submenu is open. Opens on hover after a short delay, on click, and with
|
|
208
|
+
* the right arrow key.
|
|
209
|
+
*/
|
|
210
|
+
declare const MenuSubmenuTrigger: import("react").ForwardRefExoticComponent<MenuSubmenuTriggerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
211
|
+
//#endregion
|
|
212
|
+
export { Menu$1 as Menu, MenuAlign, MenuCheckboxItem, MenuCheckboxItemProps, MenuGroup, MenuGroupLabel, MenuGroupLabelProps, MenuGroupProps, MenuHandle, MenuItem, MenuItemProps, MenuItemVariant, MenuItemVariantsOptions, MenuLinkItem, MenuLinkItemProps, MenuPopup, MenuPopupProps, MenuProps, MenuRadioGroup, MenuRadioGroupProps, MenuRadioItem, MenuRadioItemProps, MenuSeparator, MenuSeparatorProps, MenuShortcut, MenuShortcutProps, MenuSide, MenuSubmenuRoot, MenuSubmenuRootProps, MenuSubmenuTrigger, MenuSubmenuTriggerProps, MenuTrigger, MenuTriggerProps, createMenuHandle, menuItemVariants };
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Menu } from "@base-ui/react/menu";
|
|
5
|
+
//#region src/components/Menu/Menu.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Groups the menu parts and owns the open state. A menu lists **actions**
|
|
8
|
+
* (role `menu`); to pick a value that a field keeps showing, use Select.
|
|
9
|
+
* This is Base UI's `Menu.Root` re-exported unchanged, so every root feature
|
|
10
|
+
* is available: `open`/`defaultOpen`/`onOpenChange(open, details)`,
|
|
11
|
+
* `modal` (defaults `true` — page scroll locks while open), `disabled`,
|
|
12
|
+
* `loopFocus`, `orientation`, `highlightItemOnHover`, and
|
|
13
|
+
* `handle`/`triggerId` for detached triggers.
|
|
14
|
+
*/
|
|
15
|
+
const Menu$1 = Menu.Root;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a handle that links `Menu` with `MenuTrigger`s rendered elsewhere
|
|
18
|
+
* in the tree (toolbars, table rows). Triggers may attach a `payload`, which
|
|
19
|
+
* the `Menu` children render function receives.
|
|
20
|
+
*/
|
|
21
|
+
const createMenuHandle = Menu.createHandle;
|
|
22
|
+
function CheckIcon(props) {
|
|
23
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
24
|
+
viewBox: "0 0 24 24",
|
|
25
|
+
fill: "none",
|
|
26
|
+
stroke: "currentColor",
|
|
27
|
+
strokeWidth: 2,
|
|
28
|
+
strokeLinecap: "round",
|
|
29
|
+
strokeLinejoin: "round",
|
|
30
|
+
"aria-hidden": "true",
|
|
31
|
+
...props,
|
|
32
|
+
children: /* @__PURE__ */ jsx("path", { d: "m5 13 4 4L19 7" })
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function CircleIcon(props) {
|
|
36
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
37
|
+
viewBox: "0 0 24 24",
|
|
38
|
+
fill: "currentColor",
|
|
39
|
+
"aria-hidden": "true",
|
|
40
|
+
...props,
|
|
41
|
+
children: /* @__PURE__ */ jsx("circle", {
|
|
42
|
+
cx: "12",
|
|
43
|
+
cy: "12",
|
|
44
|
+
r: "6"
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function ChevronRightIcon(props) {
|
|
49
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
50
|
+
viewBox: "0 0 24 24",
|
|
51
|
+
fill: "none",
|
|
52
|
+
stroke: "currentColor",
|
|
53
|
+
strokeWidth: 2,
|
|
54
|
+
strokeLinecap: "round",
|
|
55
|
+
strokeLinejoin: "round",
|
|
56
|
+
"aria-hidden": "true",
|
|
57
|
+
...props,
|
|
58
|
+
children: /* @__PURE__ */ jsx("path", { d: "m9 18 6-6-6-6" })
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The button that opens the menu. Ships unstyled so the visual comes from
|
|
63
|
+
* composition — render the design system's Button:
|
|
64
|
+
*
|
|
65
|
+
* <MenuTrigger render={<Button variant="outline" />}>Options</MenuTrigger>
|
|
66
|
+
*
|
|
67
|
+
* For the kebab/ellipsis pattern, Button's icon-only form already enforces
|
|
68
|
+
* the accessible name:
|
|
69
|
+
*
|
|
70
|
+
* <MenuTrigger render={<Button variant="ghost" iconOnly aria-label="Row actions" />}>
|
|
71
|
+
* <EllipsisIcon />
|
|
72
|
+
* </MenuTrigger>
|
|
73
|
+
*
|
|
74
|
+
* While its menu is open the element carries `data-popup-open`, the hook for
|
|
75
|
+
* a pressed look (e.g. `className="data-popup-open:bg-muted"`). `openOnHover`
|
|
76
|
+
* with `delay`/`closeDelay` (100/0ms defaults) is available but click-to-open
|
|
77
|
+
* is the reliable default for action menus — hover menus misfire on the way
|
|
78
|
+
* to other targets.
|
|
79
|
+
*/
|
|
80
|
+
const MenuTrigger = forwardRef(({ className, ...rest }, ref) => /* @__PURE__ */ jsx(Menu.Trigger, {
|
|
81
|
+
ref,
|
|
82
|
+
className,
|
|
83
|
+
...rest
|
|
84
|
+
}));
|
|
85
|
+
MenuTrigger.displayName = "MenuTrigger";
|
|
86
|
+
const popupSurfaceClasses = "rounded-md border border-border bg-background p-1 font-sans text-sm text-foreground shadow-md outline-none";
|
|
87
|
+
const popupBehaviorClasses = "min-w-32 max-h-[var(--available-height)] max-w-[var(--available-width)] overflow-y-auto scroll-py-1 origin-[var(--transform-origin)] motion-safe:transition-[scale,opacity] motion-safe:duration-150 motion-safe:ease-out data-starting-style:scale-95 data-starting-style:opacity-0 data-ending-style:scale-95 data-ending-style:opacity-0 data-instant:transition-none!";
|
|
88
|
+
const adaptiveSideOffset = ({ side }) => side === "top" || side === "bottom" ? 4 : -4;
|
|
89
|
+
const adaptiveAlignOffset = ({ side }) => side === "top" || side === "bottom" ? 0 : -4;
|
|
90
|
+
/**
|
|
91
|
+
* The floating list of menu items, with the portal and positioning plumbing
|
|
92
|
+
* folded in. Anchored to its trigger by default; opens with a motion-safe
|
|
93
|
+
* scale/fade from the anchor-facing corner. The same component nests inside
|
|
94
|
+
* `MenuSubmenuRoot`, where its placement defaults switch to the submenu
|
|
95
|
+
* conventions (inline-end side, overlapped edge, trigger-row alignment).
|
|
96
|
+
*/
|
|
97
|
+
const MenuPopup = forwardRef(({ side, align, sideOffset = side === void 0 ? adaptiveSideOffset : 4, alignOffset = side === void 0 ? adaptiveAlignOffset : 0, collisionPadding, anchor, keepMounted = false, container, className, children, ...rest }, ref) => /* @__PURE__ */ jsx(Menu.Portal, {
|
|
98
|
+
container,
|
|
99
|
+
keepMounted,
|
|
100
|
+
children: /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
101
|
+
side,
|
|
102
|
+
align,
|
|
103
|
+
sideOffset,
|
|
104
|
+
alignOffset,
|
|
105
|
+
collisionPadding,
|
|
106
|
+
anchor,
|
|
107
|
+
className: "z-50 select-none outline-none",
|
|
108
|
+
children: /* @__PURE__ */ jsx(Menu.Popup, {
|
|
109
|
+
ref,
|
|
110
|
+
className: cn(popupSurfaceClasses, popupBehaviorClasses, className),
|
|
111
|
+
...rest,
|
|
112
|
+
children
|
|
113
|
+
})
|
|
114
|
+
})
|
|
115
|
+
}));
|
|
116
|
+
MenuPopup.displayName = "MenuPopup";
|
|
117
|
+
const itemBaseClasses = "relative flex cursor-default items-center gap-2 rounded-md px-2 py-1.5 font-sans text-sm outline-none select-none scroll-my-1 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4";
|
|
118
|
+
const itemVariantClasses = {
|
|
119
|
+
default: "text-foreground data-highlighted:bg-primary-50 [&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
120
|
+
destructive: "text-error-700 data-highlighted:bg-error-50"
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Class list for an element styled as a menu item — for menu-shaped rows
|
|
124
|
+
* that don't come from Base UI (command palettes, custom listboxes) so every
|
|
125
|
+
* item row in the product shares one look.
|
|
126
|
+
*/
|
|
127
|
+
function menuItemVariants({ variant = "default", inset = false, className } = {}) {
|
|
128
|
+
return cn(itemBaseClasses, itemVariantClasses[variant], inset && "pl-8", className);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* One action in the menu. Children are free-form — a leading `<svg>` icon is
|
|
132
|
+
* sized and muted automatically. Set `label` when children aren't plain text
|
|
133
|
+
* so keyboard typeahead still matches, `disabled` for unavailable actions
|
|
134
|
+
* (keep them visible so users can see what exists), and `closeOnClick={false}`
|
|
135
|
+
* to keep the menu open after the action runs.
|
|
136
|
+
*/
|
|
137
|
+
const MenuItem = forwardRef(({ variant = "default", inset = false, className, ...rest }, ref) => /* @__PURE__ */ jsx(Menu.Item, {
|
|
138
|
+
ref,
|
|
139
|
+
className: cn(menuItemVariants({
|
|
140
|
+
variant,
|
|
141
|
+
inset
|
|
142
|
+
}), className),
|
|
143
|
+
...rest
|
|
144
|
+
}));
|
|
145
|
+
MenuItem.displayName = "MenuItem";
|
|
146
|
+
/**
|
|
147
|
+
* A navigation entry that keeps link semantics — it renders a real `<a>`
|
|
148
|
+
* (never a button styled as one), so it supports open-in-new-tab, copy link,
|
|
149
|
+
* and middle-click. Pass `href` directly, or compose a client-side router
|
|
150
|
+
* link via `render={<Link to="…" />}`.
|
|
151
|
+
*/
|
|
152
|
+
const MenuLinkItem = forwardRef(({ inset = false, className, ...rest }, ref) => /* @__PURE__ */ jsx(Menu.LinkItem, {
|
|
153
|
+
ref,
|
|
154
|
+
className: cn(menuItemVariants({ inset }), className),
|
|
155
|
+
...rest
|
|
156
|
+
}));
|
|
157
|
+
MenuLinkItem.displayName = "MenuLinkItem";
|
|
158
|
+
/**
|
|
159
|
+
* Right-aligned keyboard hint inside an item (`⌘N`, `Ctrl+D`). Purely
|
|
160
|
+
* visual — it does not register the shortcut; wire the actual key handling
|
|
161
|
+
* in the app. Helper text mirrors Typography caption.
|
|
162
|
+
*/
|
|
163
|
+
const MenuShortcut = forwardRef(({ className, ...rest }, ref) => /* @__PURE__ */ jsx("span", {
|
|
164
|
+
ref,
|
|
165
|
+
className: cn("ml-auto pl-4 font-sans text-xs tracking-widest text-muted-foreground", className),
|
|
166
|
+
...rest
|
|
167
|
+
}));
|
|
168
|
+
MenuShortcut.displayName = "MenuShortcut";
|
|
169
|
+
/** Groups related items under a `MenuGroupLabel`, announced together by assistive technology. */
|
|
170
|
+
const MenuGroup = forwardRef(({ className, ...rest }, ref) => /* @__PURE__ */ jsx(Menu.Group, {
|
|
171
|
+
ref,
|
|
172
|
+
className,
|
|
173
|
+
...rest
|
|
174
|
+
}));
|
|
175
|
+
MenuGroup.displayName = "MenuGroup";
|
|
176
|
+
/** Heading for a `MenuGroup` (or `MenuRadioGroup`) — visually a meta caption, wired to the group via `aria-labelledby`. */
|
|
177
|
+
const MenuGroupLabel = forwardRef(({ inset = false, className, ...rest }, ref) => /* @__PURE__ */ jsx(Menu.GroupLabel, {
|
|
178
|
+
ref,
|
|
179
|
+
className: cn("px-2 py-1.5 font-sans text-xs font-medium text-muted-foreground", inset && "pl-8", className),
|
|
180
|
+
...rest
|
|
181
|
+
}));
|
|
182
|
+
MenuGroupLabel.displayName = "MenuGroupLabel";
|
|
183
|
+
/** Divider between item groups, exposed to screen readers as a separator. */
|
|
184
|
+
const MenuSeparator = forwardRef(({ className, ...rest }, ref) => /* @__PURE__ */ jsx(Menu.Separator, {
|
|
185
|
+
ref,
|
|
186
|
+
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
187
|
+
...rest
|
|
188
|
+
}));
|
|
189
|
+
MenuSeparator.displayName = "MenuSeparator";
|
|
190
|
+
/**
|
|
191
|
+
* An item that toggles a setting on or off — a check mark fills the leading
|
|
192
|
+
* indicator column while `checked`. Control it with
|
|
193
|
+
* `checked`/`defaultChecked`/`onCheckedChange`. It keeps the menu open on
|
|
194
|
+
* click by default (Base UI's `closeOnClick={false}`) so several settings
|
|
195
|
+
* can be flipped in one visit.
|
|
196
|
+
*/
|
|
197
|
+
const MenuCheckboxItem = forwardRef(({ className, children, ...rest }, ref) => /* @__PURE__ */ jsxs(Menu.CheckboxItem, {
|
|
198
|
+
ref,
|
|
199
|
+
className: cn(itemBaseClasses, itemVariantClasses.default, "pl-8", className),
|
|
200
|
+
...rest,
|
|
201
|
+
children: [/* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, {
|
|
202
|
+
className: "absolute left-2 flex size-4 items-center justify-center text-primary",
|
|
203
|
+
children: /* @__PURE__ */ jsx(CheckIcon, {})
|
|
204
|
+
}), children]
|
|
205
|
+
}));
|
|
206
|
+
MenuCheckboxItem.displayName = "MenuCheckboxItem";
|
|
207
|
+
/**
|
|
208
|
+
* Groups `MenuRadioItem`s into a single-choice set and owns its value:
|
|
209
|
+
* `value`/`defaultValue`/`onValueChange(value, details)`. Label the set with
|
|
210
|
+
* a `MenuGroupLabel` inside the group.
|
|
211
|
+
*/
|
|
212
|
+
const MenuRadioGroup = forwardRef(({ className, ...rest }, ref) => /* @__PURE__ */ jsx(Menu.RadioGroup, {
|
|
213
|
+
ref,
|
|
214
|
+
className,
|
|
215
|
+
...rest
|
|
216
|
+
}));
|
|
217
|
+
MenuRadioGroup.displayName = "MenuRadioGroup";
|
|
218
|
+
/**
|
|
219
|
+
* One option of a `MenuRadioGroup` — a dot fills the leading indicator
|
|
220
|
+
* column while selected. `value` is required; the menu stays open on click
|
|
221
|
+
* by default so the choice can be reconsidered without reopening.
|
|
222
|
+
*/
|
|
223
|
+
const MenuRadioItem = forwardRef(({ className, children, ...rest }, ref) => /* @__PURE__ */ jsxs(Menu.RadioItem, {
|
|
224
|
+
ref,
|
|
225
|
+
className: cn(itemBaseClasses, itemVariantClasses.default, "pl-8", className),
|
|
226
|
+
...rest,
|
|
227
|
+
children: [/* @__PURE__ */ jsx(Menu.RadioItemIndicator, {
|
|
228
|
+
className: "absolute left-2 flex size-4 items-center justify-center text-primary",
|
|
229
|
+
children: /* @__PURE__ */ jsx(CircleIcon, { className: "size-2" })
|
|
230
|
+
}), children]
|
|
231
|
+
}));
|
|
232
|
+
MenuRadioItem.displayName = "MenuRadioItem";
|
|
233
|
+
/**
|
|
234
|
+
* Groups the parts of a nested menu; renders no HTML. Place it among the
|
|
235
|
+
* parent's items with a `MenuSubmenuTrigger` and a nested `MenuPopup`
|
|
236
|
+
* inside. Keep nesting to one level — deeper trees are hard to steer
|
|
237
|
+
* (and to reach on touch screens). Accepts Base UI's SubmenuRoot props
|
|
238
|
+
* (`open`/`defaultOpen`/`onOpenChange`, `disabled`, `closeParentOnEsc`).
|
|
239
|
+
*/
|
|
240
|
+
const MenuSubmenuRoot = Menu.SubmenuRoot;
|
|
241
|
+
/**
|
|
242
|
+
* The item that opens a submenu — a trailing chevron is appended
|
|
243
|
+
* automatically, and the row stays tinted (`data-popup-open`) while its
|
|
244
|
+
* submenu is open. Opens on hover after a short delay, on click, and with
|
|
245
|
+
* the right arrow key.
|
|
246
|
+
*/
|
|
247
|
+
const MenuSubmenuTrigger = forwardRef(({ inset = false, className, children, ...rest }, ref) => /* @__PURE__ */ jsxs(Menu.SubmenuTrigger, {
|
|
248
|
+
ref,
|
|
249
|
+
className: cn(menuItemVariants({ inset }), "data-popup-open:bg-primary-50", className),
|
|
250
|
+
...rest,
|
|
251
|
+
children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto size-4 text-muted-foreground" })]
|
|
252
|
+
}));
|
|
253
|
+
MenuSubmenuTrigger.displayName = "MenuSubmenuTrigger";
|
|
254
|
+
//#endregion
|
|
255
|
+
export { Menu$1 as Menu, MenuCheckboxItem, MenuGroup, MenuGroupLabel, MenuItem, MenuLinkItem, MenuPopup, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuShortcut, MenuSubmenuRoot, MenuSubmenuTrigger, MenuTrigger, createMenuHandle, menuItemVariants, popupBehaviorClasses, popupSurfaceClasses };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { Menu, MenuAlign, MenuCheckboxItem, MenuCheckboxItemProps, MenuGroup, MenuGroupLabel, MenuGroupLabelProps, MenuGroupProps, MenuHandle, MenuItem, MenuItemProps, MenuItemVariant, MenuItemVariantsOptions, MenuLinkItem, MenuLinkItemProps, MenuPopup, MenuPopupProps, MenuProps, MenuRadioGroup, MenuRadioGroupProps, MenuRadioItem, MenuRadioItemProps, MenuSeparator, MenuSeparatorProps, MenuShortcut, MenuShortcutProps, MenuSide, MenuSubmenuRoot, MenuSubmenuRootProps, MenuSubmenuTrigger, MenuSubmenuTriggerProps, MenuTrigger, MenuTriggerProps, createMenuHandle, menuItemVariants } from "./Menu.js";
|
|
2
|
+
export { Menu, type MenuAlign, MenuCheckboxItem, type MenuCheckboxItemProps, MenuGroup, MenuGroupLabel, type MenuGroupLabelProps, type MenuGroupProps, type MenuHandle, MenuItem, type MenuItemProps, type MenuItemVariant, type MenuItemVariantsOptions, MenuLinkItem, type MenuLinkItemProps, MenuPopup, type MenuPopupProps, type MenuProps, MenuRadioGroup, type MenuRadioGroupProps, MenuRadioItem, type MenuRadioItemProps, MenuSeparator, type MenuSeparatorProps, MenuShortcut, type MenuShortcutProps, type MenuSide, MenuSubmenuRoot, type MenuSubmenuRootProps, MenuSubmenuTrigger, type MenuSubmenuTriggerProps, MenuTrigger, type MenuTriggerProps, createMenuHandle, menuItemVariants };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { Menu, MenuCheckboxItem, MenuGroup, MenuGroupLabel, MenuItem, MenuLinkItem, MenuPopup, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuShortcut, MenuSubmenuRoot, MenuSubmenuTrigger, MenuTrigger, createMenuHandle, menuItemVariants } from "./Menu.js";
|
|
2
|
+
export { Menu, MenuCheckboxItem, MenuGroup, MenuGroupLabel, MenuItem, MenuLinkItem, MenuPopup, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuShortcut, MenuSubmenuRoot, MenuSubmenuTrigger, MenuTrigger, createMenuHandle, menuItemVariants };
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import { Popover } from "@base-ui/react/popover";
|
|
3
|
+
//#region src/components/Popover/Popover.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Groups the popover parts and owns the open state. Accepts Base UI's Root
|
|
6
|
+
* props: `open`/`defaultOpen`/`onOpenChange` for control, `modal` to lock
|
|
7
|
+
* scroll or trap focus, and `handle`/`triggerId` for detached triggers.
|
|
8
|
+
*/
|
|
9
|
+
declare const Popover$1: typeof Popover.Root;
|
|
10
|
+
type PopoverProps = ComponentPropsWithoutRef<typeof Popover.Root>;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a handle that links `Popover` with `PopoverTrigger`s rendered
|
|
13
|
+
* elsewhere in the tree (toolbars, table rows). Triggers may attach a
|
|
14
|
+
* `payload`, which the `Popover` children render function receives.
|
|
15
|
+
*/
|
|
16
|
+
declare const createPopoverHandle: typeof Popover.createHandle;
|
|
17
|
+
type PopoverHandle<Payload = unknown> = Popover.Handle<Payload>;
|
|
18
|
+
interface PopoverTriggerProps extends Omit<ComponentPropsWithoutRef<typeof Popover.Trigger>, "className"> {
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The button that opens the popover. Ships unstyled so the visual comes from
|
|
23
|
+
* composition — render the design system's Button:
|
|
24
|
+
*
|
|
25
|
+
* <PopoverTrigger render={<Button variant="outline" />}>Filters</PopoverTrigger>
|
|
26
|
+
*
|
|
27
|
+
* While its popup is open the element carries `data-popup-open`, the hook for
|
|
28
|
+
* a pressed look (e.g. `className="data-popup-open:bg-muted"`). Hover-card
|
|
29
|
+
* behavior comes from `openOnHover` with its `delay`/`closeDelay` (300/0ms
|
|
30
|
+
* defaults) — reserve it for previews; interactive content should open on
|
|
31
|
+
* click so it can't vanish mid-interaction.
|
|
32
|
+
*/
|
|
33
|
+
declare const PopoverTrigger: import("react").ForwardRefExoticComponent<PopoverTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
34
|
+
type BasePositionerProps = ComponentPropsWithoutRef<typeof Popover.Positioner>;
|
|
35
|
+
type PopoverSide = NonNullable<BasePositionerProps["side"]>;
|
|
36
|
+
type PopoverAlign = NonNullable<BasePositionerProps["align"]>;
|
|
37
|
+
interface PopoverPopupVariantsOptions {
|
|
38
|
+
className?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Class list for an element styled as the popover panel — for floating
|
|
42
|
+
* surfaces that don't come from Base UI (static previews, custom
|
|
43
|
+
* floating-ui popups) so every popup in the product shares one look.
|
|
44
|
+
*/
|
|
45
|
+
declare function popoverPopupVariants({ className }?: PopoverPopupVariantsOptions): string;
|
|
46
|
+
interface PopoverPopupProps extends Omit<ComponentPropsWithoutRef<typeof Popover.Popup>, "className"> {
|
|
47
|
+
/** Side of the anchor to place the popup on; flips automatically when there is no room. */
|
|
48
|
+
side?: PopoverSide;
|
|
49
|
+
/** How the popup lines up along the chosen side. */
|
|
50
|
+
align?: PopoverAlign;
|
|
51
|
+
/** Gap between anchor and popup in pixels. The default 8px leaves room for the `arrow`. */
|
|
52
|
+
sideOffset?: BasePositionerProps["sideOffset"];
|
|
53
|
+
/** Additional shift along the alignment axis in pixels. */
|
|
54
|
+
alignOffset?: BasePositionerProps["alignOffset"];
|
|
55
|
+
/** Minimum space kept from the viewport (or collision boundary) edges when repositioning. */
|
|
56
|
+
collisionPadding?: BasePositionerProps["collisionPadding"];
|
|
57
|
+
/** Position against this element instead of the trigger (e.g. an input while a toolbar button opens the popup). */
|
|
58
|
+
anchor?: BasePositionerProps["anchor"];
|
|
59
|
+
/** Keep the popup in the DOM while closed — for SEO or measuring; closed popups normally unmount. */
|
|
60
|
+
keepMounted?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Portal destination. Defaults to `document.body`. When the popover renders
|
|
63
|
+
* open on first paint (`defaultOpen`) and the container mounts in the same
|
|
64
|
+
* commit, pass the element via callback-ref state — a `RefObject` to an
|
|
65
|
+
* ancestor is not attached yet when the portal first resolves, and it would
|
|
66
|
+
* silently fall back to `document.body`.
|
|
67
|
+
*/
|
|
68
|
+
container?: ComponentPropsWithoutRef<typeof Popover.Portal>["container"];
|
|
69
|
+
/** Show a caret pointing at the anchor. */
|
|
70
|
+
arrow?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Applied to the popup panel. Sizing hooks: the panel is content-sized up
|
|
73
|
+
* to 20rem — set `w-*`/`max-w-*` to change that, `w-[var(--anchor-width)]`
|
|
74
|
+
* to match the trigger width, or an inner `max-h-* overflow-y-auto`
|
|
75
|
+
* wrapper for scrollable content (the panel itself must not clip — the
|
|
76
|
+
* arrow hangs outside it).
|
|
77
|
+
*/
|
|
78
|
+
className?: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The floating panel, with the portal and positioning plumbing folded in.
|
|
82
|
+
* Anchored to its trigger by default; opens with a motion-safe scale/fade
|
|
83
|
+
* from the anchor-facing corner. When the popover holds no `PopoverTitle`,
|
|
84
|
+
* name the panel for assistive tech with `aria-label`.
|
|
85
|
+
*/
|
|
86
|
+
declare const PopoverPopup: import("react").ForwardRefExoticComponent<PopoverPopupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
87
|
+
interface PopoverTitleProps extends Omit<ComponentPropsWithoutRef<typeof Popover.Title>, "className"> {
|
|
88
|
+
className?: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Heading that names the popup — Base UI wires it to the panel via
|
|
92
|
+
* `aria-labelledby` automatically. An `<h2>` by default; pick the level from
|
|
93
|
+
* the surrounding outline with `render`, e.g. `render={<h3 />}`.
|
|
94
|
+
*/
|
|
95
|
+
declare const PopoverTitle: import("react").ForwardRefExoticComponent<PopoverTitleProps & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
96
|
+
interface PopoverDescriptionProps extends Omit<ComponentPropsWithoutRef<typeof Popover.Description>, "className"> {
|
|
97
|
+
className?: string;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Supporting copy announced with the popup — Base UI wires it via
|
|
101
|
+
* `aria-describedby` automatically.
|
|
102
|
+
*/
|
|
103
|
+
declare const PopoverDescription: import("react").ForwardRefExoticComponent<PopoverDescriptionProps & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
104
|
+
interface PopoverCloseProps extends Omit<ComponentPropsWithoutRef<typeof Popover.Close>, "className"> {
|
|
105
|
+
className?: string;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* A button that closes the popup. Unstyled, like the trigger — compose the
|
|
109
|
+
* design system's Button for footer actions:
|
|
110
|
+
*
|
|
111
|
+
* <PopoverClose render={<Button size="sm" variant="outline" />}>Done</PopoverClose>
|
|
112
|
+
*
|
|
113
|
+
* or borrow its classes for a corner icon dismiss, which needs an accessible
|
|
114
|
+
* name:
|
|
115
|
+
*
|
|
116
|
+
* <PopoverClose aria-label="Close" className={buttonVariants({ variant: "ghost", size: "sm", iconOnly: true })}>
|
|
117
|
+
* <XIcon />
|
|
118
|
+
* </PopoverClose>
|
|
119
|
+
*/
|
|
120
|
+
declare const PopoverClose: import("react").ForwardRefExoticComponent<PopoverCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
121
|
+
//#endregion
|
|
122
|
+
export { Popover$1 as Popover, PopoverAlign, PopoverClose, PopoverCloseProps, PopoverDescription, PopoverDescriptionProps, PopoverHandle, PopoverPopup, PopoverPopupProps, PopoverPopupVariantsOptions, PopoverProps, PopoverSide, PopoverTitle, PopoverTitleProps, PopoverTrigger, PopoverTriggerProps, createPopoverHandle, popoverPopupVariants };
|