panelui-web 0.4.0 → 0.5.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/button/index.d.ts +111 -0
- package/dist/components/button/index.js +45 -0
- package/dist/components/input/index.d.ts +55 -0
- package/dist/components/input/index.js +89 -0
- package/dist/components/menu/index.d.ts +202 -0
- package/dist/components/menu/index.js +188 -0
- package/dist/components/planet/index.js +4 -1
- package/dist/components/prompt/index.d.ts +414 -0
- package/dist/components/prompt/index.js +779 -0
- package/dist/components/select/index.d.ts +134 -0
- package/dist/components/select/index.js +164 -0
- package/dist/components/sheet/index.js +46 -5
- package/dist/components/textarea/index.d.ts +43 -0
- package/dist/components/textarea/index.js +101 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Button — something to press, in the weight its action deserves.
|
|
3
|
+
*
|
|
4
|
+
* ```tsx
|
|
5
|
+
* <Button>Save</Button>
|
|
6
|
+
* <Button variant="outline" size="sm">Cancel</Button>
|
|
7
|
+
* <Button variant="ghost" size="icon" aria-label="Close"><XIcon /></Button>
|
|
8
|
+
* <Button loading>Saving</Button>
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* ## Weight
|
|
12
|
+
*
|
|
13
|
+
* `default` is the one action a view is for, and there should be one of it.
|
|
14
|
+
* `secondary` and `outline` are the actions beside it, `ghost` the ones that
|
|
15
|
+
* should not draw the eye until they are looked for, and `destructive` the
|
|
16
|
+
* one that cannot be taken back.
|
|
17
|
+
*
|
|
18
|
+
* ## Loading
|
|
19
|
+
*
|
|
20
|
+
* `loading` sets a spinner over the label and stops presses. The label stays
|
|
21
|
+
* in place, hidden, so the width does not change: a button that resizes as it
|
|
22
|
+
* is pressed moves whatever sits beside it.
|
|
23
|
+
*/
|
|
24
|
+
import type { ComponentProps } from 'react';
|
|
25
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
26
|
+
export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
27
|
+
variant: {
|
|
28
|
+
default: string;
|
|
29
|
+
secondary: string;
|
|
30
|
+
outline: string;
|
|
31
|
+
ghost: string;
|
|
32
|
+
destructive: string;
|
|
33
|
+
link: string;
|
|
34
|
+
};
|
|
35
|
+
size: {
|
|
36
|
+
sm: string;
|
|
37
|
+
md: string;
|
|
38
|
+
lg: string;
|
|
39
|
+
'icon-sm': string;
|
|
40
|
+
icon: string;
|
|
41
|
+
'icon-lg': string;
|
|
42
|
+
};
|
|
43
|
+
/** `pill` rounds the ends fully, whatever the size. */
|
|
44
|
+
shape: {
|
|
45
|
+
default: string;
|
|
46
|
+
pill: string;
|
|
47
|
+
};
|
|
48
|
+
}, undefined, string[], {
|
|
49
|
+
variant: {
|
|
50
|
+
default: string;
|
|
51
|
+
secondary: string;
|
|
52
|
+
outline: string;
|
|
53
|
+
ghost: string;
|
|
54
|
+
destructive: string;
|
|
55
|
+
link: string;
|
|
56
|
+
};
|
|
57
|
+
size: {
|
|
58
|
+
sm: string;
|
|
59
|
+
md: string;
|
|
60
|
+
lg: string;
|
|
61
|
+
'icon-sm': string;
|
|
62
|
+
icon: string;
|
|
63
|
+
'icon-lg': string;
|
|
64
|
+
};
|
|
65
|
+
/** `pill` rounds the ends fully, whatever the size. */
|
|
66
|
+
shape: {
|
|
67
|
+
default: string;
|
|
68
|
+
pill: string;
|
|
69
|
+
};
|
|
70
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
71
|
+
variant: {
|
|
72
|
+
default: string;
|
|
73
|
+
secondary: string;
|
|
74
|
+
outline: string;
|
|
75
|
+
ghost: string;
|
|
76
|
+
destructive: string;
|
|
77
|
+
link: string;
|
|
78
|
+
};
|
|
79
|
+
size: {
|
|
80
|
+
sm: string;
|
|
81
|
+
md: string;
|
|
82
|
+
lg: string;
|
|
83
|
+
'icon-sm': string;
|
|
84
|
+
icon: string;
|
|
85
|
+
'icon-lg': string;
|
|
86
|
+
};
|
|
87
|
+
/** `pill` rounds the ends fully, whatever the size. */
|
|
88
|
+
shape: {
|
|
89
|
+
default: string;
|
|
90
|
+
pill: string;
|
|
91
|
+
};
|
|
92
|
+
}, undefined, string[], unknown, unknown, undefined>>;
|
|
93
|
+
export type ButtonVariant = NonNullable<VariantProps<typeof buttonVariants>['variant']>;
|
|
94
|
+
export type ButtonSize = NonNullable<VariantProps<typeof buttonVariants>['size']>;
|
|
95
|
+
export interface ButtonProps extends ComponentProps<'button'> {
|
|
96
|
+
/** How much the button asks to be pressed. Default `default`. */
|
|
97
|
+
variant?: ButtonVariant;
|
|
98
|
+
/** Its height and padding. The `icon` sizes are square, for a button that holds only an icon. Default `md`. */
|
|
99
|
+
size?: ButtonSize;
|
|
100
|
+
/** `pill` rounds the ends fully. Default `default`. */
|
|
101
|
+
shape?: 'default' | 'pill';
|
|
102
|
+
/** Shows a spinner over the label, sets `aria-busy` and stops presses, keeping the width. */
|
|
103
|
+
loading?: boolean;
|
|
104
|
+
}
|
|
105
|
+
/** A button. Every attribute of `<button>` passes through. */
|
|
106
|
+
declare function ButtonRoot({ variant, size, shape, loading, disabled, type, className, children, ...props }: ButtonProps): import("react").JSX.Element;
|
|
107
|
+
declare namespace ButtonRoot {
|
|
108
|
+
var displayName: string;
|
|
109
|
+
}
|
|
110
|
+
export declare const Button: typeof ButtonRoot;
|
|
111
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { tv } from 'tailwind-variants';
|
|
3
|
+
export const buttonVariants = tv({
|
|
4
|
+
base: [
|
|
5
|
+
'relative inline-flex shrink-0 cursor-pointer select-none items-center justify-center gap-2 whitespace-nowrap font-medium outline-none',
|
|
6
|
+
'transition-[background-color,color,border-color,box-shadow,scale] duration-150',
|
|
7
|
+
'focus-visible:ring-[3px] focus-visible:ring-ring/40',
|
|
8
|
+
'active:not-disabled:scale-[0.97] motion-reduce:active:scale-100',
|
|
9
|
+
'disabled:cursor-default disabled:opacity-50 aria-busy:cursor-progress',
|
|
10
|
+
'[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4',
|
|
11
|
+
],
|
|
12
|
+
variants: {
|
|
13
|
+
variant: {
|
|
14
|
+
default: 'bg-primary text-primary-foreground shadow-xs inset-shadow-[0_1px_0_rgb(255_255_255/0.12)] hover:not-disabled:bg-primary/90',
|
|
15
|
+
secondary: 'bg-secondary text-secondary-foreground hover:not-disabled:bg-secondary/80',
|
|
16
|
+
outline: 'border bg-background text-foreground shadow-xs hover:not-disabled:bg-accent hover:not-disabled:text-accent-foreground dark:bg-input/30',
|
|
17
|
+
ghost: 'text-foreground hover:not-disabled:bg-accent hover:not-disabled:text-accent-foreground',
|
|
18
|
+
destructive: 'bg-destructive text-white shadow-xs hover:not-disabled:bg-destructive/90 focus-visible:ring-destructive/40',
|
|
19
|
+
link: 'text-foreground underline-offset-4 hover:underline',
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
sm: 'h-8 rounded-md px-3 text-[0.8125rem]',
|
|
23
|
+
md: 'h-9 rounded-lg px-4 text-sm',
|
|
24
|
+
lg: 'h-11 rounded-xl px-5 text-[0.9375rem]',
|
|
25
|
+
'icon-sm': 'size-8 rounded-md',
|
|
26
|
+
icon: 'size-9 rounded-lg',
|
|
27
|
+
'icon-lg': 'size-11 rounded-xl [&_svg:not([class*=size-])]:size-5',
|
|
28
|
+
},
|
|
29
|
+
/** `pill` rounds the ends fully, whatever the size. */
|
|
30
|
+
shape: {
|
|
31
|
+
default: '',
|
|
32
|
+
pill: 'rounded-full',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
defaultVariants: { variant: 'default', size: 'md', shape: 'default' },
|
|
36
|
+
});
|
|
37
|
+
function Spinner() {
|
|
38
|
+
return (_jsx("svg", { "aria-hidden": "true", "data-slot": "button-spinner", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", className: "absolute inset-0 m-auto animate-spin motion-reduce:animate-none", children: _jsx("path", { d: "M21 12a9 9 0 1 1-6.22-8.56" }) }));
|
|
39
|
+
}
|
|
40
|
+
/** A button. Every attribute of `<button>` passes through. */
|
|
41
|
+
function ButtonRoot({ variant, size, shape, loading = false, disabled, type = 'button', className, children, ...props }) {
|
|
42
|
+
return (_jsxs("button", { type: type, "data-slot": "button", "data-variant": variant ?? 'default', "aria-busy": loading || undefined, disabled: disabled || loading, className: buttonVariants({ variant, size, shape, className }), ...props, children: [loading ? _jsx(Spinner, {}) : null, _jsx("span", { className: loading ? 'invisible contents' : 'contents', children: children })] }));
|
|
43
|
+
}
|
|
44
|
+
ButtonRoot.displayName = 'Button';
|
|
45
|
+
export const Button = ButtonRoot;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input — a single line to type into.
|
|
3
|
+
*
|
|
4
|
+
* ```tsx
|
|
5
|
+
* <Input placeholder="you@example.com" type="email" />
|
|
6
|
+
*
|
|
7
|
+
* <Input.Group>
|
|
8
|
+
* <Input.Addon><SearchIcon /></Input.Addon>
|
|
9
|
+
* <Input placeholder="Search" />
|
|
10
|
+
* <Input.Addon align="end"><kbd>⌘K</kbd></Input.Addon>
|
|
11
|
+
* </Input.Group>
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* ## The group owns the box
|
|
15
|
+
*
|
|
16
|
+
* On its own, the input draws its border, background and focus ring. Inside
|
|
17
|
+
* `Input.Group`, it drops all three and the group draws them around the input
|
|
18
|
+
* and its addons together, so an icon or a unit reads as part of the field and
|
|
19
|
+
* the ring goes round the whole of it. Pressing an addon that is not a button
|
|
20
|
+
* moves focus into the input.
|
|
21
|
+
*/
|
|
22
|
+
import type { ComponentProps } from 'react';
|
|
23
|
+
export type InputSize = 'sm' | 'md' | 'lg';
|
|
24
|
+
export interface InputProps extends Omit<ComponentProps<'input'>, 'size'> {
|
|
25
|
+
/** Its height and text size. Inside a group, set it on the group instead. Default `md`. */
|
|
26
|
+
size?: InputSize;
|
|
27
|
+
}
|
|
28
|
+
/** A single-line field. Every attribute of `<input>` passes through. */
|
|
29
|
+
declare function InputRoot({ size, className, type, ...props }: InputProps): import("react").JSX.Element;
|
|
30
|
+
declare namespace InputRoot {
|
|
31
|
+
var displayName: string;
|
|
32
|
+
}
|
|
33
|
+
export interface InputGroupProps extends ComponentProps<'div'> {
|
|
34
|
+
/** The height of the input and its addons together. Default `md`. */
|
|
35
|
+
size?: InputSize;
|
|
36
|
+
}
|
|
37
|
+
/** Draws one box round an input and its addons. */
|
|
38
|
+
declare function InputGroup({ size, className, ...props }: InputGroupProps): import("react").JSX.Element;
|
|
39
|
+
declare namespace InputGroup {
|
|
40
|
+
var displayName: string;
|
|
41
|
+
}
|
|
42
|
+
export interface InputAddonProps extends ComponentProps<'div'> {
|
|
43
|
+
/** Which side of the input it sits on, whatever its place in the markup. Default `start`. */
|
|
44
|
+
align?: 'start' | 'end';
|
|
45
|
+
}
|
|
46
|
+
/** An icon, unit, shortcut or button beside the input, inside its box. */
|
|
47
|
+
declare function InputAddon({ align, className, onMouseDown, ...props }: InputAddonProps): import("react").JSX.Element;
|
|
48
|
+
declare namespace InputAddon {
|
|
49
|
+
var displayName: string;
|
|
50
|
+
}
|
|
51
|
+
export declare const Input: typeof InputRoot & {
|
|
52
|
+
Group: typeof InputGroup;
|
|
53
|
+
Addon: typeof InputAddon;
|
|
54
|
+
};
|
|
55
|
+
export { InputGroup, InputAddon };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { tv } from 'tailwind-variants';
|
|
4
|
+
const inputVariants = tv({
|
|
5
|
+
slots: {
|
|
6
|
+
input: [
|
|
7
|
+
'w-full min-w-0 bg-transparent text-foreground outline-none',
|
|
8
|
+
'placeholder:text-muted-foreground/80 selection:bg-primary selection:text-primary-foreground',
|
|
9
|
+
'file:me-3 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground',
|
|
10
|
+
'disabled:cursor-not-allowed disabled:opacity-50',
|
|
11
|
+
// Alone, it is the box. In a group, the group is.
|
|
12
|
+
'not-in-data-[slot=input-group]:rounded-lg not-in-data-[slot=input-group]:border not-in-data-[slot=input-group]:border-input',
|
|
13
|
+
'not-in-data-[slot=input-group]:bg-background not-in-data-[slot=input-group]:shadow-xs dark:not-in-data-[slot=input-group]:bg-input/30',
|
|
14
|
+
'not-in-data-[slot=input-group]:transition-[border-color,box-shadow]',
|
|
15
|
+
'not-in-data-[slot=input-group]:focus-visible:border-ring not-in-data-[slot=input-group]:focus-visible:ring-[3px] not-in-data-[slot=input-group]:focus-visible:ring-ring/30',
|
|
16
|
+
'aria-invalid:not-in-data-[slot=input-group]:border-destructive aria-invalid:not-in-data-[slot=input-group]:ring-destructive/20',
|
|
17
|
+
],
|
|
18
|
+
group: [
|
|
19
|
+
'group/input flex w-full min-w-0 items-center rounded-lg border border-input bg-background shadow-xs transition-[border-color,box-shadow] dark:bg-input/30',
|
|
20
|
+
'has-[input:focus-visible]:border-ring has-[input:focus-visible]:ring-[3px] has-[input:focus-visible]:ring-ring/30',
|
|
21
|
+
'has-[input[aria-invalid=true]]:border-destructive has-[input[aria-invalid=true]]:ring-destructive/20',
|
|
22
|
+
'has-[input:disabled]:opacity-50',
|
|
23
|
+
],
|
|
24
|
+
addon: [
|
|
25
|
+
'flex shrink-0 cursor-text items-center gap-1.5 text-sm text-muted-foreground select-none',
|
|
26
|
+
'[&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4',
|
|
27
|
+
'[&_kbd]:rounded [&_kbd]:border [&_kbd]:bg-muted [&_kbd]:px-1.5 [&_kbd]:font-sans [&_kbd]:text-xs',
|
|
28
|
+
// Padded to the group's size, read from the group so it is set once.
|
|
29
|
+
'px-3 group-data-[size=sm]/input:px-2.5 group-data-[size=lg]/input:px-3.5',
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
variants: {
|
|
33
|
+
size: {
|
|
34
|
+
sm: { input: 'h-8 px-2.5 text-[0.8125rem]', group: 'h-8' },
|
|
35
|
+
md: { input: 'h-9 px-3 text-sm', group: 'h-9' },
|
|
36
|
+
lg: { input: 'h-11 px-3.5 text-[0.9375rem]', group: 'h-11 rounded-xl' },
|
|
37
|
+
},
|
|
38
|
+
align: {
|
|
39
|
+
// An addon sits closer to the text it belongs to than to the edge.
|
|
40
|
+
start: { addon: 'order-first -me-1.5' },
|
|
41
|
+
end: { addon: 'order-last -ms-1.5' },
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
compoundVariants: [
|
|
45
|
+
// In a group the input's own height is the group's, minus its border.
|
|
46
|
+
// Its text and padding follow the group's size too, so the size is set once.
|
|
47
|
+
{
|
|
48
|
+
size: ['sm', 'md', 'lg'],
|
|
49
|
+
className: {
|
|
50
|
+
input: 'in-data-[slot=input-group]:h-full group-data-[size=sm]/input:px-2.5 group-data-[size=sm]/input:text-[0.8125rem] group-data-[size=lg]/input:px-3.5 group-data-[size=lg]/input:text-[0.9375rem]',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
defaultVariants: { size: 'md', align: 'start' },
|
|
55
|
+
});
|
|
56
|
+
/** A single-line field. Every attribute of `<input>` passes through. */
|
|
57
|
+
function InputRoot({ size, className, type = 'text', ...props }) {
|
|
58
|
+
return (_jsx("input", { type: type, "data-slot": "input", className: inputVariants({ size }).input({ className }), ...props }));
|
|
59
|
+
}
|
|
60
|
+
InputRoot.displayName = 'Input';
|
|
61
|
+
/** Draws one box round an input and its addons. */
|
|
62
|
+
function InputGroup({ size, className, ...props }) {
|
|
63
|
+
return (_jsx("div", { role: "group", "data-slot": "input-group", "data-size": size ?? 'md', className: inputVariants({ size }).group({ className }), ...props }));
|
|
64
|
+
}
|
|
65
|
+
InputGroup.displayName = 'Input.Group';
|
|
66
|
+
/** An icon, unit, shortcut or button beside the input, inside its box. */
|
|
67
|
+
function InputAddon({ align, className, onMouseDown, ...props }) {
|
|
68
|
+
// A press on the addon's own surface is a press on the field. A button or
|
|
69
|
+
// link inside it is left to do what it does.
|
|
70
|
+
const focusField = (event) => {
|
|
71
|
+
onMouseDown?.(event);
|
|
72
|
+
if (event.defaultPrevented)
|
|
73
|
+
return;
|
|
74
|
+
if (event.target.closest('button, a, input, select, textarea'))
|
|
75
|
+
return;
|
|
76
|
+
const input = event.currentTarget.parentElement?.querySelector('input');
|
|
77
|
+
if (!input)
|
|
78
|
+
return;
|
|
79
|
+
event.preventDefault();
|
|
80
|
+
input.focus();
|
|
81
|
+
};
|
|
82
|
+
return (_jsx("div", { "data-slot": "input-addon", "data-align": align ?? 'start', className: inputVariants({ align }).addon({ className }), onMouseDown: focusField, ...props }));
|
|
83
|
+
}
|
|
84
|
+
InputAddon.displayName = 'Input.Addon';
|
|
85
|
+
export const Input = Object.assign(InputRoot, {
|
|
86
|
+
Group: InputGroup,
|
|
87
|
+
Addon: InputAddon,
|
|
88
|
+
});
|
|
89
|
+
export { InputGroup, InputAddon };
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Menu — a list of actions that opens from a button.
|
|
3
|
+
*
|
|
4
|
+
* ```tsx
|
|
5
|
+
* <Menu>
|
|
6
|
+
* <Menu.Trigger render={<Button variant="outline" />}>Options</Menu.Trigger>
|
|
7
|
+
* <Menu.Content>
|
|
8
|
+
* <Menu.Item onClick={rename}>
|
|
9
|
+
* <PencilIcon /> Rename <Menu.Shortcut>⌘R</Menu.Shortcut>
|
|
10
|
+
* </Menu.Item>
|
|
11
|
+
* <Menu.Sub>
|
|
12
|
+
* <Menu.SubTrigger><ShareIcon /> Share</Menu.SubTrigger>
|
|
13
|
+
* <Menu.SubContent>
|
|
14
|
+
* <Menu.Item>Copy link</Menu.Item>
|
|
15
|
+
* </Menu.SubContent>
|
|
16
|
+
* </Menu.Sub>
|
|
17
|
+
* <Menu.Separator />
|
|
18
|
+
* <Menu.CheckboxItem checked={pinned} onCheckedChange={setPinned}>Pinned</Menu.CheckboxItem>
|
|
19
|
+
* <Menu.Item variant="destructive">Delete</Menu.Item>
|
|
20
|
+
* </Menu.Content>
|
|
21
|
+
* </Menu>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* ## One row shape
|
|
25
|
+
*
|
|
26
|
+
* Every row is the same: an icon, the label, and whatever belongs at the end
|
|
27
|
+
* of it, a shortcut, a badge, a check or the chevron of a submenu. Icons are
|
|
28
|
+
* written as the row's first child and sized by the row, so rows with and
|
|
29
|
+
* without them still line up when every row in a group has one.
|
|
30
|
+
*
|
|
31
|
+
* ## Submenus
|
|
32
|
+
*
|
|
33
|
+
* A submenu opens to the side when its row is hovered or pressed, or with
|
|
34
|
+
* the right arrow key, and closes with the left one. The pointer can cross
|
|
35
|
+
* diagonally to it without closing it on the way.
|
|
36
|
+
*
|
|
37
|
+
* ## Items that stay open
|
|
38
|
+
*
|
|
39
|
+
* Pressing an item closes the menu. A check item or a radio item keeps it
|
|
40
|
+
* open, so several can be switched in a row; pass `closeOnClick` to change
|
|
41
|
+
* either.
|
|
42
|
+
*/
|
|
43
|
+
import { Menu as BaseMenu } from '@base-ui/react/menu';
|
|
44
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
45
|
+
export interface MenuProps extends BaseMenu.Root.Props {
|
|
46
|
+
}
|
|
47
|
+
/** Holds whether the menu is open. Takes `open`/`onOpenChange`, `defaultOpen` and `modal`. */
|
|
48
|
+
declare function MenuRoot(props: MenuProps): import("react").JSX.Element;
|
|
49
|
+
declare namespace MenuRoot {
|
|
50
|
+
var displayName: string;
|
|
51
|
+
}
|
|
52
|
+
export interface MenuTriggerProps extends BaseMenu.Trigger.Props {
|
|
53
|
+
}
|
|
54
|
+
/** The button that opens the menu. `render` draws it as another element, such as a `Button`. */
|
|
55
|
+
declare function MenuTrigger(props: MenuTriggerProps): import("react").JSX.Element;
|
|
56
|
+
declare namespace MenuTrigger {
|
|
57
|
+
var displayName: string;
|
|
58
|
+
}
|
|
59
|
+
interface PlacementProps {
|
|
60
|
+
/** Which side of the trigger it opens on. Default `bottom`; a submenu opens to the side. */
|
|
61
|
+
side?: BaseMenu.Positioner.Props['side'];
|
|
62
|
+
/** How it lines up with the trigger along that side. Default `start`. */
|
|
63
|
+
align?: BaseMenu.Positioner.Props['align'];
|
|
64
|
+
/** The gap between the trigger and the menu, in pixels. Default `6`. */
|
|
65
|
+
sideOffset?: number;
|
|
66
|
+
/** Moves it along the side, in pixels. */
|
|
67
|
+
alignOffset?: number;
|
|
68
|
+
}
|
|
69
|
+
export interface MenuContentProps extends BaseMenu.Popup.Props, PlacementProps {
|
|
70
|
+
/** Where in the document the menu is put. Default `document.body`. */
|
|
71
|
+
container?: BaseMenu.Portal.Props['container'];
|
|
72
|
+
/** What it is placed against instead of the trigger: an element or a ref to one. */
|
|
73
|
+
anchor?: BaseMenu.Positioner.Props['anchor'];
|
|
74
|
+
className?: string;
|
|
75
|
+
}
|
|
76
|
+
/** The list, opened in a layer over the page. It moves to the other side when there is no room. */
|
|
77
|
+
declare function MenuContent({ side, align, sideOffset, alignOffset, container, anchor, className, ...props }: MenuContentProps): import("react").JSX.Element;
|
|
78
|
+
declare namespace MenuContent {
|
|
79
|
+
var displayName: string;
|
|
80
|
+
}
|
|
81
|
+
export interface MenuItemProps extends BaseMenu.Item.Props {
|
|
82
|
+
/** `destructive` draws it in the destructive colour, for an action that cannot be undone. Default `default`. */
|
|
83
|
+
variant?: 'default' | 'destructive';
|
|
84
|
+
className?: string;
|
|
85
|
+
}
|
|
86
|
+
/** One action. Put an icon first, then the label, then a `Menu.Shortcut` or `Menu.Badge` if it has one. */
|
|
87
|
+
declare function MenuItem({ variant, className, ...props }: MenuItemProps): import("react").JSX.Element;
|
|
88
|
+
declare namespace MenuItem {
|
|
89
|
+
var displayName: string;
|
|
90
|
+
}
|
|
91
|
+
export interface MenuCheckboxItemProps extends BaseMenu.CheckboxItem.Props {
|
|
92
|
+
className?: string;
|
|
93
|
+
}
|
|
94
|
+
/** An item that is switched on and off, with a check at its end while on. The menu stays open. */
|
|
95
|
+
declare function MenuCheckboxItem({ className, children, ...props }: MenuCheckboxItemProps): import("react").JSX.Element;
|
|
96
|
+
declare namespace MenuCheckboxItem {
|
|
97
|
+
var displayName: string;
|
|
98
|
+
}
|
|
99
|
+
export interface MenuRadioGroupProps extends BaseMenu.RadioGroup.Props {
|
|
100
|
+
className?: string;
|
|
101
|
+
}
|
|
102
|
+
/** Radio items of which one is chosen. Takes `value` and `onValueChange`. */
|
|
103
|
+
declare function MenuRadioGroup({ className, ...props }: MenuRadioGroupProps): import("react").JSX.Element;
|
|
104
|
+
declare namespace MenuRadioGroup {
|
|
105
|
+
var displayName: string;
|
|
106
|
+
}
|
|
107
|
+
export interface MenuRadioItemProps extends BaseMenu.RadioItem.Props {
|
|
108
|
+
className?: string;
|
|
109
|
+
}
|
|
110
|
+
/** One choice in a radio group, with a check at its end while chosen. */
|
|
111
|
+
declare function MenuRadioItem({ className, children, ...props }: MenuRadioItemProps): import("react").JSX.Element;
|
|
112
|
+
declare namespace MenuRadioItem {
|
|
113
|
+
var displayName: string;
|
|
114
|
+
}
|
|
115
|
+
export interface MenuSubProps extends BaseMenu.SubmenuRoot.Props {
|
|
116
|
+
}
|
|
117
|
+
/** A submenu: a `Menu.SubTrigger` row and the `Menu.SubContent` it opens. */
|
|
118
|
+
declare function MenuSub(props: MenuSubProps): import("react").JSX.Element;
|
|
119
|
+
declare namespace MenuSub {
|
|
120
|
+
var displayName: string;
|
|
121
|
+
}
|
|
122
|
+
export interface MenuSubTriggerProps extends BaseMenu.SubmenuTrigger.Props {
|
|
123
|
+
className?: string;
|
|
124
|
+
/** Something before the chevron, such as a `Menu.Badge`. */
|
|
125
|
+
end?: ReactNode;
|
|
126
|
+
}
|
|
127
|
+
/** The row that opens a submenu, with a chevron at its end. It opens on hover as well as on press. */
|
|
128
|
+
declare function MenuSubTrigger({ className, children, end, openOnHover, delay, ...props }: MenuSubTriggerProps): import("react").JSX.Element;
|
|
129
|
+
declare namespace MenuSubTrigger {
|
|
130
|
+
var displayName: string;
|
|
131
|
+
}
|
|
132
|
+
export interface MenuSubContentProps extends Omit<MenuContentProps, 'side'> {
|
|
133
|
+
/** Default `inline-end`: to the right in a left-to-right page. */
|
|
134
|
+
side?: BaseMenu.Positioner.Props['side'];
|
|
135
|
+
}
|
|
136
|
+
/** The submenu's list, opened beside its row with the first item level with it. */
|
|
137
|
+
declare function MenuSubContent({ side, align, sideOffset, alignOffset, ...props }: MenuSubContentProps): import("react").JSX.Element;
|
|
138
|
+
declare namespace MenuSubContent {
|
|
139
|
+
var displayName: string;
|
|
140
|
+
}
|
|
141
|
+
export interface MenuGroupProps extends BaseMenu.Group.Props {
|
|
142
|
+
className?: string;
|
|
143
|
+
}
|
|
144
|
+
/** Items that belong together, under a `Menu.GroupLabel`. */
|
|
145
|
+
declare function MenuGroup({ className, ...props }: MenuGroupProps): import("react").JSX.Element;
|
|
146
|
+
declare namespace MenuGroup {
|
|
147
|
+
var displayName: string;
|
|
148
|
+
}
|
|
149
|
+
export interface MenuGroupLabelProps extends BaseMenu.GroupLabel.Props {
|
|
150
|
+
className?: string;
|
|
151
|
+
}
|
|
152
|
+
/** The heading of a group. Screen readers announce the group by it. */
|
|
153
|
+
declare function MenuGroupLabel({ className, ...props }: MenuGroupLabelProps): import("react").JSX.Element;
|
|
154
|
+
declare namespace MenuGroupLabel {
|
|
155
|
+
var displayName: string;
|
|
156
|
+
}
|
|
157
|
+
export interface MenuSeparatorProps extends ComponentProps<'div'> {
|
|
158
|
+
}
|
|
159
|
+
/** A rule between groups of items. */
|
|
160
|
+
declare function MenuSeparator({ className, ...props }: MenuSeparatorProps): import("react").JSX.Element;
|
|
161
|
+
declare namespace MenuSeparator {
|
|
162
|
+
var displayName: string;
|
|
163
|
+
}
|
|
164
|
+
export interface MenuDescriptionProps extends ComponentProps<'span'> {
|
|
165
|
+
}
|
|
166
|
+
/** What an item does, in quieter words after its label. */
|
|
167
|
+
declare function MenuDescription({ className, ...props }: MenuDescriptionProps): import("react").JSX.Element;
|
|
168
|
+
declare namespace MenuDescription {
|
|
169
|
+
var displayName: string;
|
|
170
|
+
}
|
|
171
|
+
export interface MenuShortcutProps extends ComponentProps<'kbd'> {
|
|
172
|
+
}
|
|
173
|
+
/** The keys for an item, at its end. It only shows them: wire the keys up where the action lives. */
|
|
174
|
+
declare function MenuShortcut({ className, ...props }: MenuShortcutProps): import("react").JSX.Element;
|
|
175
|
+
declare namespace MenuShortcut {
|
|
176
|
+
var displayName: string;
|
|
177
|
+
}
|
|
178
|
+
export interface MenuBadgeProps extends ComponentProps<'span'> {
|
|
179
|
+
}
|
|
180
|
+
/** A small count or flag at an item's end: how many need attention, or that something is new. */
|
|
181
|
+
declare function MenuBadge({ className, ...props }: MenuBadgeProps): import("react").JSX.Element;
|
|
182
|
+
declare namespace MenuBadge {
|
|
183
|
+
var displayName: string;
|
|
184
|
+
}
|
|
185
|
+
export declare const Menu: typeof MenuRoot & {
|
|
186
|
+
Trigger: typeof MenuTrigger;
|
|
187
|
+
Content: typeof MenuContent;
|
|
188
|
+
Item: typeof MenuItem;
|
|
189
|
+
CheckboxItem: typeof MenuCheckboxItem;
|
|
190
|
+
RadioGroup: typeof MenuRadioGroup;
|
|
191
|
+
RadioItem: typeof MenuRadioItem;
|
|
192
|
+
Sub: typeof MenuSub;
|
|
193
|
+
SubTrigger: typeof MenuSubTrigger;
|
|
194
|
+
SubContent: typeof MenuSubContent;
|
|
195
|
+
Group: typeof MenuGroup;
|
|
196
|
+
GroupLabel: typeof MenuGroupLabel;
|
|
197
|
+
Separator: typeof MenuSeparator;
|
|
198
|
+
Description: typeof MenuDescription;
|
|
199
|
+
Shortcut: typeof MenuShortcut;
|
|
200
|
+
Badge: typeof MenuBadge;
|
|
201
|
+
};
|
|
202
|
+
export { MenuTrigger, MenuContent, MenuItem, MenuCheckboxItem, MenuRadioGroup, MenuRadioItem, MenuSub, MenuSubTrigger, MenuSubContent, MenuGroup, MenuGroupLabel, MenuSeparator, MenuDescription, MenuShortcut, MenuBadge, };
|