@viraui/react 1.0.12 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalog.json +16 -4
- package/dist/components/accordion/accordion.css +1 -1
- package/dist/components/accordion/accordion.guide.json +26 -0
- package/dist/components/annotate/annotate.css +1 -1
- package/dist/components/annotate/annotate.guide.json +46 -57
- package/dist/components/avatar/avatar.css +1 -1
- package/dist/components/avatar/avatar.guide.json +22 -10
- package/dist/components/avatar/avatar.js +0 -2
- package/dist/components/avatar-group/avatar-group.css +1 -7
- package/dist/components/avatar-group/avatar-group.guide.json +23 -16
- package/dist/components/badge/badge.css +1 -0
- package/dist/components/badge/badge.d.ts +39 -0
- package/dist/components/badge/badge.guide.json +59 -0
- package/dist/components/badge/badge.js +50 -0
- package/dist/components/badge/badge.module.js +11 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/basic-input/basic-input.css +1 -1
- package/dist/components/basic-input/field-label.css +1 -1
- package/dist/components/basic-input/field-label.js +2 -0
- package/dist/components/bleed/bleed.guide.json +9 -6
- package/dist/components/button/button-chrome.d.ts +3 -1
- package/dist/components/button/button-chrome.js +3 -2
- package/dist/components/button/button-link.guide.json +55 -1
- package/dist/components/button/button-link.js +2 -1
- package/dist/components/button/button.css +1 -1
- package/dist/components/button/button.guide.json +27 -7
- package/dist/components/button/button.js +2 -1
- package/dist/components/checkbox/checkbox.css +1 -1
- package/dist/components/checkbox/checkbox.guide.json +40 -1
- package/dist/components/checkbox/checkbox.js +2 -2
- package/dist/components/checkbox/checkbox.module.js +1 -3
- package/dist/components/chip/chip.css +1 -1
- package/dist/components/chip/chip.guide.json +23 -6
- package/dist/components/chip/chip.js +2 -1
- package/dist/components/clamp-text/clamp-text.css +1 -1
- package/dist/components/clamp-text/clamp-text.guide.json +9 -0
- package/dist/components/clamp-text/clamp-text.js +1 -1
- package/dist/components/dialog/dialog-sheet.js +1 -1
- package/dist/components/dialog/dialog.css +1 -1
- package/dist/components/dialog/dialog.guide.json +24 -0
- package/dist/components/dialog/dialog.module.js +1 -3
- package/dist/components/elevator/elevator.guide.json +23 -1
- package/dist/components/fieldset/fieldset.guide.json +16 -3
- package/dist/components/fieldset/fieldset.js +6 -6
- package/dist/components/fit-text/fit-text.css +1 -1
- package/dist/components/fit-text/fit-text.guide.json +2 -4
- package/dist/components/icon-button/icon-button-link.guide.json +52 -1
- package/dist/components/icon-button/icon-button-link.js +2 -2
- package/dist/components/icon-button/icon-button.d.ts +1 -1
- package/dist/components/icon-button/icon-button.guide.json +48 -3
- package/dist/components/icon-button/icon-button.js +2 -2
- package/dist/components/index.d.ts +2 -0
- package/dist/components/linear-progress/linear-progress.guide.json +16 -5
- package/dist/components/linear-progress/linear-progress.js +0 -1
- package/dist/components/masonry/masonry.d.ts +1 -1
- package/dist/components/masonry/masonry.guide.json +11 -9
- package/dist/components/masonry/masonry.js +1 -1
- package/dist/components/menu/index.d.ts +11 -0
- package/dist/components/menu/menu-checkbox-item.d.ts +42 -0
- package/dist/components/menu/menu-checkbox-item.js +28 -0
- package/dist/components/menu/menu-group.d.ts +12 -0
- package/dist/components/menu/menu-group.js +36 -0
- package/dist/components/menu/menu-indicator-slot.d.ts +15 -0
- package/dist/components/menu/menu-indicator-slot.js +52 -0
- package/dist/components/menu/menu-item-row.d.ts +18 -0
- package/dist/components/menu/menu-item-row.js +47 -0
- package/dist/components/menu/menu-item.d.ts +36 -0
- package/dist/components/menu/menu-item.js +23 -0
- package/dist/components/menu/menu-link-item.d.ts +36 -0
- package/dist/components/menu/menu-link-item.js +26 -0
- package/dist/components/menu/menu-popup.d.ts +17 -0
- package/dist/components/menu/menu-popup.js +28 -0
- package/dist/components/menu/menu-radio-group.d.ts +16 -0
- package/dist/components/menu/menu-radio-group.js +36 -0
- package/dist/components/menu/menu-radio-item.d.ts +42 -0
- package/dist/components/menu/menu-radio-item.js +28 -0
- package/dist/components/menu/menu-separator.d.ts +9 -0
- package/dist/components/menu/menu-separator.js +15 -0
- package/dist/components/menu/menu-submenu-trigger.d.ts +29 -0
- package/dist/components/menu/menu-submenu-trigger.js +26 -0
- package/dist/components/menu/menu.css +1 -0
- package/dist/components/menu/menu.d.ts +58 -0
- package/dist/components/menu/menu.guide.json +101 -0
- package/dist/components/menu/menu.js +36 -0
- package/dist/components/menu/menu.module.js +13 -0
- package/dist/components/meter/meter.guide.json +15 -4
- package/dist/components/meter/meter.js +0 -1
- package/dist/components/popover/popover-sheet.js +1 -1
- package/dist/components/popover/popover.guide.json +25 -1
- package/dist/components/progressive-blur/progressive-blur.css +1 -1
- package/dist/components/progressive-blur/progressive-blur.guide.json +14 -4
- package/dist/components/progressive-blur/progressive-blur.js +2 -2
- package/dist/components/radio/radio.css +1 -1
- package/dist/components/radio/radio.guide.json +34 -1
- package/dist/components/radio/radio.js +28 -31
- package/dist/components/select/select-group.js +1 -1
- package/dist/components/select/select-option.d.ts +1 -1
- package/dist/components/select/select-option.js +2 -5
- package/dist/components/select/select-separator.js +7 -4
- package/dist/components/select/select.css +1 -1
- package/dist/components/select/select.guide.json +49 -8
- package/dist/components/select/select.js +1 -1
- package/dist/components/select/select.module.js +1 -5
- package/dist/components/separator/separator.guide.json +28 -1
- package/dist/components/shimmer/shimmer.css +1 -1
- package/dist/components/shimmer/shimmer.guide.json +19 -16
- package/dist/components/skeleton/skeleton.guide.json +24 -31
- package/dist/components/slider/slider.guide.json +27 -7
- package/dist/components/spinner/spinner.guide.json +5 -4
- package/dist/components/stack/stack.guide.json +49 -47
- package/dist/components/static-noise/static-noise.guide.json +18 -2
- package/dist/components/surface/surface.css +1 -1
- package/dist/components/surface/surface.guide.json +41 -48
- package/dist/components/switch/switch.css +1 -1
- package/dist/components/switch/switch.guide.json +25 -10
- package/dist/components/tabs/tabs.guide.json +11 -0
- package/dist/components/text/text.css +1 -1
- package/dist/components/text/text.guide.json +67 -76
- package/dist/components/textarea/textarea.css +1 -1
- package/dist/components/textarea/textarea.d.ts +4 -3
- package/dist/components/textarea/textarea.guide.json +19 -7
- package/dist/components/textfield/textfield.css +1 -1
- package/dist/components/textfield/textfield.guide.json +22 -7
- package/dist/components/title/title.css +1 -1
- package/dist/components/title/title.guide.json +62 -72
- package/dist/components/title/title.js +0 -1
- package/dist/components/toast/toast.css +1 -1
- package/dist/components/toast/toast.guide.json +32 -1
- package/dist/components/toggle-button/toggle-button.css +1 -0
- package/dist/components/toggle-button/toggle-button.d.ts +7 -0
- package/dist/components/toggle-button/toggle-button.guide.json +29 -2
- package/dist/components/toggle-button/toggle-button.js +18 -3
- package/dist/components/toggle-button/toggle-button.module.js +9 -0
- package/dist/components/toggle-group/toggle-group.d.ts +2 -1
- package/dist/components/toggle-group/toggle-group.guide.json +2 -3
- package/dist/components/tooltip/tooltip.guide.json +8 -1
- package/dist/components/typewriter/typewriter.css +1 -1
- package/dist/components/typewriter/typewriter.guide.json +27 -5
- package/dist/index.js +13 -2
- package/dist/internal/chrome-icons/chrome-icons.d.ts +2 -0
- package/dist/internal/chrome-icons/chrome-icons.js +7 -1
- package/dist/preflight-surface.json +1 -1
- package/dist/preflight.css +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Stack } from "../stack/stack.js";
|
|
2
|
+
import menu_module_default from "./menu.module.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Menu } from "@base-ui/react/menu";
|
|
5
|
+
//#region src/components/menu/menu-indicator-slot.tsx
|
|
6
|
+
var indicatorStackRender = /* @__PURE__ */ jsx(Stack, {
|
|
7
|
+
"data-shrink": "false",
|
|
8
|
+
fillChildren: false,
|
|
9
|
+
hAlign: "center",
|
|
10
|
+
inline: true,
|
|
11
|
+
vAlign: "center"
|
|
12
|
+
});
|
|
13
|
+
var MenuIndicatorSlot = ({ children, kind = "spacer" }) => {
|
|
14
|
+
if (kind === "checkbox") return /* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, {
|
|
15
|
+
className: menu_module_default.Indicator,
|
|
16
|
+
"data-grow": "false",
|
|
17
|
+
keepMounted: true,
|
|
18
|
+
render: indicatorStackRender,
|
|
19
|
+
children
|
|
20
|
+
});
|
|
21
|
+
if (kind === "radio") return /* @__PURE__ */ jsx(Menu.RadioItemIndicator, {
|
|
22
|
+
className: menu_module_default.Indicator,
|
|
23
|
+
"data-grow": "false",
|
|
24
|
+
keepMounted: true,
|
|
25
|
+
render: indicatorStackRender,
|
|
26
|
+
children
|
|
27
|
+
});
|
|
28
|
+
if (kind === "chevron") return /* @__PURE__ */ jsx(Stack, {
|
|
29
|
+
"aria-hidden": true,
|
|
30
|
+
className: menu_module_default.Indicator,
|
|
31
|
+
"data-grow": "false",
|
|
32
|
+
"data-kind": "chevron",
|
|
33
|
+
"data-shrink": "false",
|
|
34
|
+
fillChildren: false,
|
|
35
|
+
hAlign: "center",
|
|
36
|
+
inline: true,
|
|
37
|
+
vAlign: "center",
|
|
38
|
+
children
|
|
39
|
+
});
|
|
40
|
+
return /* @__PURE__ */ jsx(Stack, {
|
|
41
|
+
"aria-hidden": true,
|
|
42
|
+
className: menu_module_default.Indicator,
|
|
43
|
+
"data-grow": "false",
|
|
44
|
+
"data-shrink": "false",
|
|
45
|
+
fillChildren: false,
|
|
46
|
+
hAlign: "center",
|
|
47
|
+
inline: true,
|
|
48
|
+
vAlign: "center"
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
//#endregion
|
|
52
|
+
export { MenuIndicatorSlot };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { StackProps } from '../stack';
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
export type MenuItemRowProps = {
|
|
4
|
+
addon?: React.ReactNode;
|
|
5
|
+
addonAlign?: StackProps['vAlign'];
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Optional muted note (shortcut / secondary label) at the end of the content row,
|
|
9
|
+
* immediately before any trailing indicator.
|
|
10
|
+
*/
|
|
11
|
+
note?: React.ReactNode;
|
|
12
|
+
trailing?: React.ReactNode;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Shared internal row layout for all Menu item kinds (addon + label + optional note + trailing).
|
|
16
|
+
* Not a public export.
|
|
17
|
+
*/
|
|
18
|
+
export declare const MenuItemRow: React.FC<MenuItemRowProps>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Text } from "../text/text.js";
|
|
2
|
+
import { Stack } from "../stack/stack.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/menu/menu-item-row.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Shared internal row layout for all Menu item kinds (addon + label + optional note + trailing).
|
|
7
|
+
* Not a public export.
|
|
8
|
+
*/
|
|
9
|
+
var MenuItemRow = ({ addon, addonAlign = "center", children, note, trailing }) => /* @__PURE__ */ jsxs(Stack, {
|
|
10
|
+
columnGap: "medium",
|
|
11
|
+
direction: "row",
|
|
12
|
+
fillChildren: false,
|
|
13
|
+
hPadding: "small",
|
|
14
|
+
vPadding: "small",
|
|
15
|
+
vAlign: "center",
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ jsxs(Stack, {
|
|
18
|
+
columnGap: "small",
|
|
19
|
+
"data-grow": "true",
|
|
20
|
+
"data-shrink": "true",
|
|
21
|
+
direction: "row",
|
|
22
|
+
fillChildren: false,
|
|
23
|
+
vAlign: addonAlign,
|
|
24
|
+
children: [addon && /* @__PURE__ */ jsx(Stack, {
|
|
25
|
+
"aria-hidden": "true",
|
|
26
|
+
"data-grow": "false",
|
|
27
|
+
"data-shrink": "false",
|
|
28
|
+
children: addon
|
|
29
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
30
|
+
lineHeight: "small",
|
|
31
|
+
size: "small",
|
|
32
|
+
children
|
|
33
|
+
})]
|
|
34
|
+
}),
|
|
35
|
+
note && /* @__PURE__ */ jsx(Text, {
|
|
36
|
+
whiteSpace: "nowrap",
|
|
37
|
+
"data-shrink": "false",
|
|
38
|
+
lineHeight: "small",
|
|
39
|
+
size: "x-small",
|
|
40
|
+
tone: "muted",
|
|
41
|
+
children: note
|
|
42
|
+
}),
|
|
43
|
+
trailing
|
|
44
|
+
]
|
|
45
|
+
});
|
|
46
|
+
//#endregion
|
|
47
|
+
export { MenuItemRow };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { MenuItem as MenuItemPrimitive } from '@base-ui/react/menu';
|
|
2
|
+
import { StackProps } from '../stack';
|
|
3
|
+
import type * as React from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* Public Menu.Item props.
|
|
6
|
+
*
|
|
7
|
+
* @default Base UI pass-through props keep upstream defaults.
|
|
8
|
+
*/
|
|
9
|
+
export type MenuItemProps = MenuItemPrimitive.Props & {
|
|
10
|
+
/**
|
|
11
|
+
* Decorative leading node rendered before the item label.
|
|
12
|
+
*
|
|
13
|
+
* @default No addon is rendered.
|
|
14
|
+
*/
|
|
15
|
+
addon?: React.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Vertical alignment of the addon relative to the label row.
|
|
18
|
+
*
|
|
19
|
+
* @default 'center'
|
|
20
|
+
*/
|
|
21
|
+
addonAlign?: StackProps['vAlign'];
|
|
22
|
+
/**
|
|
23
|
+
* End-aligned secondary text (e.g. keyboard shortcut). Rendered muted `x-small`
|
|
24
|
+
* at the end of the row (replaces the empty indicator spacer when set).
|
|
25
|
+
*
|
|
26
|
+
* @default No note is rendered.
|
|
27
|
+
*/
|
|
28
|
+
note?: React.ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Visual sentiment. `destructive` uses highlight-red wash + text.
|
|
31
|
+
*
|
|
32
|
+
* @default Neutral item styling.
|
|
33
|
+
*/
|
|
34
|
+
sentiment?: 'destructive';
|
|
35
|
+
};
|
|
36
|
+
export declare const MenuItem: React.FC<MenuItemProps>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { clsx } from "../../core/clsx.js";
|
|
2
|
+
import { Surface } from "../surface/surface.js";
|
|
3
|
+
import menu_module_default from "./menu.module.js";
|
|
4
|
+
import { MenuIndicatorSlot } from "./menu-indicator-slot.js";
|
|
5
|
+
import { MenuItemRow } from "./menu-item-row.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { Menu } from "@base-ui/react/menu";
|
|
8
|
+
//#region src/components/menu/menu-item.tsx
|
|
9
|
+
var MenuItem = ({ addon, addonAlign = "center", children, className, note, sentiment, ...otherProps }) => /* @__PURE__ */ jsx(Menu.Item, {
|
|
10
|
+
...otherProps,
|
|
11
|
+
className: clsx(menu_module_default.Item, className),
|
|
12
|
+
...sentiment && { "data-sentiment": sentiment },
|
|
13
|
+
render: /* @__PURE__ */ jsx(Surface, { radius: "auto" }),
|
|
14
|
+
children: /* @__PURE__ */ jsx(MenuItemRow, {
|
|
15
|
+
addon,
|
|
16
|
+
addonAlign,
|
|
17
|
+
note,
|
|
18
|
+
...!note && { trailing: /* @__PURE__ */ jsx(MenuIndicatorSlot, {}) },
|
|
19
|
+
children
|
|
20
|
+
})
|
|
21
|
+
});
|
|
22
|
+
//#endregion
|
|
23
|
+
export { MenuItem };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { MenuLinkItem as MenuLinkItemPrimitive } from '@base-ui/react/menu';
|
|
2
|
+
import { StackProps } from '../stack';
|
|
3
|
+
import type * as React from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* Public Menu.LinkItem props.
|
|
6
|
+
*
|
|
7
|
+
* @default Base UI pass-through props keep upstream defaults.
|
|
8
|
+
*/
|
|
9
|
+
export type MenuLinkItemProps = MenuLinkItemPrimitive.Props & {
|
|
10
|
+
/**
|
|
11
|
+
* Decorative leading node rendered before the item label.
|
|
12
|
+
*
|
|
13
|
+
* @default No addon is rendered.
|
|
14
|
+
*/
|
|
15
|
+
addon?: React.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Vertical alignment of the addon relative to the label row.
|
|
18
|
+
*
|
|
19
|
+
* @default 'center'
|
|
20
|
+
*/
|
|
21
|
+
addonAlign?: StackProps['vAlign'];
|
|
22
|
+
/**
|
|
23
|
+
* End-aligned secondary text (e.g. keyboard shortcut). Rendered muted `x-small`
|
|
24
|
+
* at the end of the row (replaces the empty indicator spacer when set).
|
|
25
|
+
*
|
|
26
|
+
* @default No note is rendered.
|
|
27
|
+
*/
|
|
28
|
+
note?: React.ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Visual sentiment. `destructive` uses highlight-red wash + text.
|
|
31
|
+
*
|
|
32
|
+
* @default Neutral item styling.
|
|
33
|
+
*/
|
|
34
|
+
sentiment?: 'destructive';
|
|
35
|
+
};
|
|
36
|
+
export declare const MenuLinkItem: React.FC<MenuLinkItemProps>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { clsx } from "../../core/clsx.js";
|
|
2
|
+
import { Surface } from "../surface/surface.js";
|
|
3
|
+
import menu_module_default from "./menu.module.js";
|
|
4
|
+
import { MenuIndicatorSlot } from "./menu-indicator-slot.js";
|
|
5
|
+
import { MenuItemRow } from "./menu-item-row.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { Menu } from "@base-ui/react/menu";
|
|
8
|
+
//#region src/components/menu/menu-link-item.tsx
|
|
9
|
+
var MenuLinkItem = ({ addon, addonAlign = "center", children, className, note, sentiment, ...otherProps }) => /* @__PURE__ */ jsx(Menu.LinkItem, {
|
|
10
|
+
...otherProps,
|
|
11
|
+
className: clsx(menu_module_default.Item, className),
|
|
12
|
+
...sentiment && { "data-sentiment": sentiment },
|
|
13
|
+
render: /* @__PURE__ */ jsx(Surface, {
|
|
14
|
+
radius: "auto",
|
|
15
|
+
render: /* @__PURE__ */ jsx("a", {})
|
|
16
|
+
}),
|
|
17
|
+
children: /* @__PURE__ */ jsx(MenuItemRow, {
|
|
18
|
+
addon,
|
|
19
|
+
addonAlign,
|
|
20
|
+
note,
|
|
21
|
+
...!note && { trailing: /* @__PURE__ */ jsx(MenuIndicatorSlot, {}) },
|
|
22
|
+
children
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
//#endregion
|
|
26
|
+
export { MenuLinkItem };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MenuPositioner } from '@base-ui/react/menu';
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
type MenuPopupPositionerProps = Omit<MenuPositioner.Props, 'className' | 'style' | 'render'>;
|
|
4
|
+
/**
|
|
5
|
+
* Public Menu.Popup props.
|
|
6
|
+
*
|
|
7
|
+
* Encapsulates Portal + Positioner + Popup with Elevator + Surface list chrome
|
|
8
|
+
* (Select-like). Positioning props forward to the Positioner; `sideOffset`
|
|
9
|
+
* defaults to `2`.
|
|
10
|
+
*
|
|
11
|
+
* @default `sideOffset` is `2`.
|
|
12
|
+
*/
|
|
13
|
+
export type MenuPopupProps = MenuPopupPositionerProps & {
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
};
|
|
16
|
+
export declare const MenuPopup: React.FC<MenuPopupProps>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Elevator } from "../elevator/elevator.js";
|
|
2
|
+
import { Surface } from "../surface/surface.js";
|
|
3
|
+
import menu_module_default from "./menu.module.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { Menu } from "@base-ui/react/menu";
|
|
6
|
+
//#region src/components/menu/menu-popup.tsx
|
|
7
|
+
var MenuPopup = ({ children, sideOffset = 2, ...positionerProps }) => /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
8
|
+
sideOffset,
|
|
9
|
+
...positionerProps,
|
|
10
|
+
children: /* @__PURE__ */ jsx(Elevator, {
|
|
11
|
+
resting: 1,
|
|
12
|
+
children: /* @__PURE__ */ jsx(Menu.Popup, {
|
|
13
|
+
className: menu_module_default.MenuPopup,
|
|
14
|
+
render: /* @__PURE__ */ jsx(Surface, {
|
|
15
|
+
border: "all",
|
|
16
|
+
color: 1,
|
|
17
|
+
"data-vibrant": true,
|
|
18
|
+
hPadding: "x-small",
|
|
19
|
+
overflow: "auto",
|
|
20
|
+
radius: "medium",
|
|
21
|
+
vPadding: "x-small"
|
|
22
|
+
}),
|
|
23
|
+
children
|
|
24
|
+
})
|
|
25
|
+
})
|
|
26
|
+
}) });
|
|
27
|
+
//#endregion
|
|
28
|
+
export { MenuPopup };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MenuRadioGroup as MenuRadioGroupPrimitive } from '@base-ui/react/menu';
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Public Menu.RadioGroup props.
|
|
5
|
+
*
|
|
6
|
+
* @default No label is rendered.
|
|
7
|
+
*/
|
|
8
|
+
export type MenuRadioGroupProps = MenuRadioGroupPrimitive.Props & {
|
|
9
|
+
/**
|
|
10
|
+
* Optional accessible group label rendered with `Menu.GroupLabel`.
|
|
11
|
+
*
|
|
12
|
+
* @default No label is rendered.
|
|
13
|
+
*/
|
|
14
|
+
label?: React.ReactNode;
|
|
15
|
+
};
|
|
16
|
+
export declare const MenuRadioGroup: React.FC<MenuRadioGroupProps>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { clsx } from "../../core/clsx.js";
|
|
2
|
+
import { Text } from "../text/text.js";
|
|
3
|
+
import { Stack } from "../stack/stack.js";
|
|
4
|
+
import menu_module_default from "./menu.module.js";
|
|
5
|
+
import { MenuIndicatorSlot } from "./menu-indicator-slot.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Menu } from "@base-ui/react/menu";
|
|
8
|
+
//#region src/components/menu/menu-radio-group.tsx
|
|
9
|
+
var MenuRadioGroup = ({ children, className, label, ...otherProps }) => /* @__PURE__ */ jsxs(Menu.RadioGroup, {
|
|
10
|
+
...otherProps,
|
|
11
|
+
className: clsx(menu_module_default.Group, className),
|
|
12
|
+
render: /* @__PURE__ */ jsx(Stack, {
|
|
13
|
+
direction: "column",
|
|
14
|
+
fillChildren: false,
|
|
15
|
+
rowGap: "2x-small",
|
|
16
|
+
vPadding: "2x-small"
|
|
17
|
+
}),
|
|
18
|
+
children: [label && /* @__PURE__ */ jsxs(Menu.GroupLabel, {
|
|
19
|
+
render: /* @__PURE__ */ jsx(Stack, {
|
|
20
|
+
columnGap: "small",
|
|
21
|
+
direction: "row",
|
|
22
|
+
fillChildren: false,
|
|
23
|
+
hPadding: "small",
|
|
24
|
+
vAlign: "center",
|
|
25
|
+
vPadding: ["small", "small"]
|
|
26
|
+
}),
|
|
27
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
28
|
+
size: "x-small",
|
|
29
|
+
tone: "muted",
|
|
30
|
+
weight: "semibold",
|
|
31
|
+
children: label
|
|
32
|
+
}), /* @__PURE__ */ jsx(MenuIndicatorSlot, {})]
|
|
33
|
+
}), children]
|
|
34
|
+
});
|
|
35
|
+
//#endregion
|
|
36
|
+
export { MenuRadioGroup };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { MenuRadioItem as MenuRadioItemPrimitive } from '@base-ui/react/menu';
|
|
2
|
+
import { StackProps } from '../stack';
|
|
3
|
+
import type * as React from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* Public Menu.RadioItem props.
|
|
6
|
+
*
|
|
7
|
+
* @default `closeOnClick` is `false`.
|
|
8
|
+
*/
|
|
9
|
+
export type MenuRadioItemProps = MenuRadioItemPrimitive.Props & {
|
|
10
|
+
/**
|
|
11
|
+
* Decorative leading node rendered before the item label.
|
|
12
|
+
*
|
|
13
|
+
* @default No addon is rendered.
|
|
14
|
+
*/
|
|
15
|
+
addon?: React.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Vertical alignment of the addon relative to the label row.
|
|
18
|
+
*
|
|
19
|
+
* @default 'center'
|
|
20
|
+
*/
|
|
21
|
+
addonAlign?: StackProps['vAlign'];
|
|
22
|
+
/**
|
|
23
|
+
* Custom indicator node when selected.
|
|
24
|
+
*
|
|
25
|
+
* @default Built-in Check chrome SVG at size 16
|
|
26
|
+
*/
|
|
27
|
+
indicator?: React.ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* End-aligned secondary text (e.g. keyboard shortcut) before the check indicator.
|
|
30
|
+
* Rendered muted `x-small`.
|
|
31
|
+
*
|
|
32
|
+
* @default No note is rendered.
|
|
33
|
+
*/
|
|
34
|
+
note?: React.ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* Visual sentiment. `destructive` uses highlight-red wash + text.
|
|
37
|
+
*
|
|
38
|
+
* @default Neutral item styling.
|
|
39
|
+
*/
|
|
40
|
+
sentiment?: 'destructive';
|
|
41
|
+
};
|
|
42
|
+
export declare const MenuRadioItem: React.FC<MenuRadioItemProps>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { clsx } from "../../core/clsx.js";
|
|
2
|
+
import { ChromeCheck } from "../../internal/chrome-icons/chrome-icons.js";
|
|
3
|
+
import { Surface } from "../surface/surface.js";
|
|
4
|
+
import menu_module_default from "./menu.module.js";
|
|
5
|
+
import { MenuIndicatorSlot } from "./menu-indicator-slot.js";
|
|
6
|
+
import { MenuItemRow } from "./menu-item-row.js";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
import { Menu } from "@base-ui/react/menu";
|
|
9
|
+
//#region src/components/menu/menu-radio-item.tsx
|
|
10
|
+
var MenuRadioItem = ({ addon, addonAlign = "center", children, className, closeOnClick = false, indicator, note, sentiment, ...otherProps }) => /* @__PURE__ */ jsx(Menu.RadioItem, {
|
|
11
|
+
...otherProps,
|
|
12
|
+
className: clsx(menu_module_default.Item, className),
|
|
13
|
+
closeOnClick,
|
|
14
|
+
...sentiment && { "data-sentiment": sentiment },
|
|
15
|
+
render: /* @__PURE__ */ jsx(Surface, { radius: "auto" }),
|
|
16
|
+
children: /* @__PURE__ */ jsx(MenuItemRow, {
|
|
17
|
+
addon,
|
|
18
|
+
addonAlign,
|
|
19
|
+
note,
|
|
20
|
+
trailing: /* @__PURE__ */ jsx(MenuIndicatorSlot, {
|
|
21
|
+
kind: "radio",
|
|
22
|
+
children: indicator ?? /* @__PURE__ */ jsx(ChromeCheck, { size: 16 })
|
|
23
|
+
}),
|
|
24
|
+
children
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
//#endregion
|
|
28
|
+
export { MenuRadioItem };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Menu as PrimitiveMenu } from '@base-ui/react/menu';
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Public Menu.Separator props.
|
|
5
|
+
*
|
|
6
|
+
* @default `orientation` is `'horizontal'`.
|
|
7
|
+
*/
|
|
8
|
+
export type MenuSeparatorProps = React.ComponentProps<typeof PrimitiveMenu.Separator>;
|
|
9
|
+
export declare const MenuSeparator: React.FC<MenuSeparatorProps>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Separator } from "../separator/separator.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Menu } from "@base-ui/react/menu";
|
|
4
|
+
//#region src/components/menu/menu-separator.tsx
|
|
5
|
+
var MenuSeparator = ({ className, orientation = "horizontal", ...otherProps }) => /* @__PURE__ */ jsx(Menu.Separator, {
|
|
6
|
+
render: /* @__PURE__ */ jsx(Separator, {
|
|
7
|
+
vPadding: "x-small",
|
|
8
|
+
hPadding: "x-small"
|
|
9
|
+
}),
|
|
10
|
+
...otherProps,
|
|
11
|
+
className,
|
|
12
|
+
orientation
|
|
13
|
+
});
|
|
14
|
+
//#endregion
|
|
15
|
+
export { MenuSeparator };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { MenuSubmenuTrigger as MenuSubmenuTriggerPrimitive } from '@base-ui/react/menu';
|
|
2
|
+
import { StackProps } from '../stack';
|
|
3
|
+
import type * as React from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* Public Menu.SubmenuTrigger props.
|
|
6
|
+
*
|
|
7
|
+
* @default Trailing end chevron; RTL mirror via CSS `:dir(rtl)`.
|
|
8
|
+
*/
|
|
9
|
+
export type MenuSubmenuTriggerProps = MenuSubmenuTriggerPrimitive.Props & {
|
|
10
|
+
/**
|
|
11
|
+
* Decorative leading node rendered before the item label.
|
|
12
|
+
*
|
|
13
|
+
* @default No addon is rendered.
|
|
14
|
+
*/
|
|
15
|
+
addon?: React.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Vertical alignment of the addon relative to the label row.
|
|
18
|
+
*
|
|
19
|
+
* @default 'center'
|
|
20
|
+
*/
|
|
21
|
+
addonAlign?: StackProps['vAlign'];
|
|
22
|
+
/**
|
|
23
|
+
* Visual sentiment. `destructive` uses highlight-red wash + text.
|
|
24
|
+
*
|
|
25
|
+
* @default Neutral item styling.
|
|
26
|
+
*/
|
|
27
|
+
sentiment?: 'destructive';
|
|
28
|
+
};
|
|
29
|
+
export declare const MenuSubmenuTrigger: React.FC<MenuSubmenuTriggerProps>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { clsx } from "../../core/clsx.js";
|
|
2
|
+
import { ChromeChevronEnd } from "../../internal/chrome-icons/chrome-icons.js";
|
|
3
|
+
import { Surface } from "../surface/surface.js";
|
|
4
|
+
import menu_module_default from "./menu.module.js";
|
|
5
|
+
import { MenuIndicatorSlot } from "./menu-indicator-slot.js";
|
|
6
|
+
import { MenuItemRow } from "./menu-item-row.js";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
import { Menu } from "@base-ui/react/menu";
|
|
9
|
+
//#region src/components/menu/menu-submenu-trigger.tsx
|
|
10
|
+
var MenuSubmenuTrigger = ({ addon, addonAlign = "center", children, className, sentiment, ...otherProps }) => /* @__PURE__ */ jsx(Menu.SubmenuTrigger, {
|
|
11
|
+
...otherProps,
|
|
12
|
+
className: clsx(menu_module_default.Item, className),
|
|
13
|
+
...sentiment && { "data-sentiment": sentiment },
|
|
14
|
+
render: /* @__PURE__ */ jsx(Surface, { radius: "auto" }),
|
|
15
|
+
children: /* @__PURE__ */ jsx(MenuItemRow, {
|
|
16
|
+
addon,
|
|
17
|
+
addonAlign,
|
|
18
|
+
trailing: /* @__PURE__ */ jsx(MenuIndicatorSlot, {
|
|
19
|
+
kind: "chevron",
|
|
20
|
+
children: /* @__PURE__ */ jsx(ChromeChevronEnd, { size: 16 })
|
|
21
|
+
}),
|
|
22
|
+
children
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
//#endregion
|
|
26
|
+
export { MenuSubmenuTrigger };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer viraui.preflight, viraui.components, viraui.overrides;@layer viraui.components{@property --__menu-list-appear-offset{syntax:"<length>";inherits:false;initial-value:8px}.viraui__menu-module__MenuPopup_GkrGa{min-inline-size:var(--anchor-width);max-block-size:var(--available-height);scroll-padding-block:var(--space-x-small);color:var(--global-foreground);outline:none;position:relative;overscroll-behavior:contain;transform-origin:var(--transform-origin);transition:opacity var(--duration-instant) var(--easing-entrance),scale var(--duration-instant) var(--easing-entrance),translate var(--duration-instant) var(--easing-entrance);&[data-ending-style],&[data-starting-style]{opacity:0;scale:.96}&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{translate:0 calc(var(--__menu-list-appear-offset) * -1)}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{translate:0 var(--__menu-list-appear-offset)}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style],&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{translate:var(--__menu-list-appear-offset) 0}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style],&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{translate:calc(var(--__menu-list-appear-offset) * -1) 0}&[data-instant=click],&[data-instant=dismiss]{transition:none;scale:1;translate:0;opacity:1}&:focus,&:focus-visible{outline:none}}.viraui__menu-module__Indicator_btL99{min-inline-size:var(--space-medium);min-block-size:var(--space-medium);inline-size:fit-content;block-size:fit-content;color:var(--global-primary);opacity:0;&[data-checked]{opacity:1}&[data-kind=chevron]{opacity:1;color:var(--global-foreground);&:dir(rtl){scale:-1 1}}}.viraui__menu-module__Group_Orz5Y+.viraui__menu-module__Group_Orz5Y{margin-block-start:var(--space-medium)}}@layer viraui.overrides{.viraui__menu-module__Item_9zmEO{cursor:pointer;min-block-size:var(--space-x-large);&:not([data-disabled]):hover,&:not([data-disabled])[data-highlighted]{background:var(--global-contrast);@container root not style(--vibrancy-enable: initial){background:oklab(from var(--global-contrast) l a b/12%)}}&:not([data-disabled],:hover)[data-checked]{background:light-dark(oklab(from var(--global-contrast) l a b/8%),oklab(from var(--global-contrast) l a b/5%))}&[data-disabled]{color:var(--global-disabled-foreground);cursor:not-allowed}&[data-sentiment=destructive]{color:var(--highlight-red);outline-color:var(--highlight-red);&:not([data-disabled]):hover,&:not([data-disabled])[data-highlighted]{background:oklab(from var(--highlight-red) l a b/12%)}}}}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Menu as PrimitiveMenu, MenuRoot, MenuTrigger as MenuTriggerNamespace } from '@base-ui/react/menu';
|
|
2
|
+
import { MenuCheckboxItem, MenuCheckboxItemProps } from './menu-checkbox-item';
|
|
3
|
+
import { MenuGroup, MenuGroupProps } from './menu-group';
|
|
4
|
+
import { MenuItem, MenuItemProps } from './menu-item';
|
|
5
|
+
import { MenuLinkItem, MenuLinkItemProps } from './menu-link-item';
|
|
6
|
+
import { MenuPopup, MenuPopupProps } from './menu-popup';
|
|
7
|
+
import { MenuRadioGroup, MenuRadioGroupProps } from './menu-radio-group';
|
|
8
|
+
import { MenuRadioItem, MenuRadioItemProps } from './menu-radio-item';
|
|
9
|
+
import { MenuSeparator, MenuSeparatorProps } from './menu-separator';
|
|
10
|
+
import { MenuSubmenuTrigger, MenuSubmenuTriggerProps } from './menu-submenu-trigger';
|
|
11
|
+
import type * as React from 'react';
|
|
12
|
+
/**
|
|
13
|
+
* Public Menu root props.
|
|
14
|
+
*
|
|
15
|
+
* Pass-through to Base UI `Menu.Root`. Supports `open`/`defaultOpen`/`onOpenChange`,
|
|
16
|
+
* `modal`, `triggerId` for controlled activation, and `handle` for detached/multiple
|
|
17
|
+
* triggers. `children` may be a node or a `({ payload }) => ReactNode` render function
|
|
18
|
+
* for per-trigger content.
|
|
19
|
+
*
|
|
20
|
+
* @default Base UI pass-through props keep upstream defaults.
|
|
21
|
+
*/
|
|
22
|
+
export type MenuProps = MenuRoot.Props;
|
|
23
|
+
/**
|
|
24
|
+
* Public Menu.Trigger props.
|
|
25
|
+
*
|
|
26
|
+
* Pass-through to Base UI `Menu.Trigger`. Use `render` for the visible control
|
|
27
|
+
* (`Button`, `IconButton`, or another element).
|
|
28
|
+
*
|
|
29
|
+
* @default Base UI pass-through props keep upstream defaults.
|
|
30
|
+
*/
|
|
31
|
+
export type MenuTriggerProps = MenuTriggerNamespace.Props;
|
|
32
|
+
/**
|
|
33
|
+
* Public Menu.Submenu props.
|
|
34
|
+
*
|
|
35
|
+
* Pass-through to Base UI `Menu.SubmenuRoot`. Compose `Menu.SubmenuTrigger` and
|
|
36
|
+
* nested `Menu.Popup` as children.
|
|
37
|
+
*
|
|
38
|
+
* @default Base UI pass-through props keep upstream defaults.
|
|
39
|
+
*/
|
|
40
|
+
export type MenuSubmenuProps = React.ComponentProps<typeof PrimitiveMenu.SubmenuRoot>;
|
|
41
|
+
export declare const MenuTrigger: PrimitiveMenu.Trigger;
|
|
42
|
+
export declare const MenuSubmenu: typeof PrimitiveMenu.SubmenuRoot;
|
|
43
|
+
type MenuComponent = React.FC<MenuProps> & {
|
|
44
|
+
Trigger: typeof PrimitiveMenu.Trigger;
|
|
45
|
+
Popup: React.FC<MenuPopupProps>;
|
|
46
|
+
Item: React.FC<MenuItemProps>;
|
|
47
|
+
LinkItem: React.FC<MenuLinkItemProps>;
|
|
48
|
+
CheckboxItem: React.FC<MenuCheckboxItemProps>;
|
|
49
|
+
RadioItem: React.FC<MenuRadioItemProps>;
|
|
50
|
+
RadioGroup: React.FC<MenuRadioGroupProps>;
|
|
51
|
+
Group: React.FC<MenuGroupProps>;
|
|
52
|
+
Separator: React.FC<MenuSeparatorProps>;
|
|
53
|
+
Submenu: typeof PrimitiveMenu.SubmenuRoot;
|
|
54
|
+
SubmenuTrigger: React.FC<MenuSubmenuTriggerProps>;
|
|
55
|
+
createHandle: typeof PrimitiveMenu.createHandle;
|
|
56
|
+
};
|
|
57
|
+
export declare const Menu: MenuComponent;
|
|
58
|
+
export { MenuCheckboxItem, MenuGroup, MenuItem, MenuLinkItem, MenuPopup, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSubmenuTrigger, };
|