@alea-design/ui 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +17 -2
- package/dist/components/accordion/Accordion.d.ts +29 -0
- package/dist/components/ai/AI.d.ts +157 -0
- package/dist/components/app/AppParts.d.ts +105 -0
- package/dist/components/button/Button.d.ts +95 -0
- package/dist/components/button/Groups.d.ts +91 -0
- package/dist/components/card/Card.d.ts +61 -0
- package/dist/components/chat/Chat.d.ts +191 -0
- package/dist/components/choice/Choice.d.ts +87 -0
- package/dist/components/color/Color.d.ts +77 -0
- package/dist/components/combobox/Autocomplete.d.ts +76 -0
- package/dist/components/combobox/ComboBox.d.ts +81 -0
- package/dist/components/combobox/Highlight.d.ts +27 -0
- package/dist/components/command/CommandPalette.d.ts +35 -0
- package/dist/components/content/Content.d.ts +120 -0
- package/dist/components/data/Data.d.ts +85 -0
- package/dist/components/date/Date.d.ts +48 -0
- package/dist/components/display/Display.d.ts +114 -0
- package/dist/components/display/Display2.d.ts +54 -0
- package/dist/components/emoji/EmojiPicker.d.ts +16 -0
- package/dist/components/emoji/emoji-data.d.ts +12 -0
- package/dist/components/extras/CodeSteps.d.ts +24 -0
- package/dist/components/extras/Extras.d.ts +84 -0
- package/dist/components/feedback/Feedback.d.ts +136 -0
- package/dist/components/feedback/Spinner.d.ts +12 -0
- package/dist/components/feedback/Status.d.ts +45 -0
- package/dist/components/field/Field.d.ts +130 -0
- package/dist/components/field/FieldLoading.d.ts +7 -0
- package/dist/components/filter/FilterBar.d.ts +48 -0
- package/dist/components/form/Form.d.ts +32 -0
- package/dist/components/icon/Icon.d.ts +47 -0
- package/dist/components/icon/icon-cells.d.ts +23 -0
- package/dist/components/icon/icon-contexts.d.ts +19 -0
- package/dist/components/icon/icon-names.d.ts +8 -0
- package/dist/components/layout/Bento.d.ts +42 -0
- package/dist/components/layout/Layout.d.ts +76 -0
- package/dist/components/layout/Layout2.d.ts +120 -0
- package/dist/components/layout/Layout3.d.ts +65 -0
- package/dist/components/layout/Responsive.d.ts +21 -0
- package/dist/components/list/List.d.ts +41 -0
- package/dist/components/list/Lists2.d.ts +79 -0
- package/dist/components/media/Media.d.ts +133 -0
- package/dist/components/menu/Menu.d.ts +87 -0
- package/dist/components/more/More.d.ts +176 -0
- package/dist/components/navigation/Navbar.d.ts +23 -0
- package/dist/components/navigation/Navigation.d.ts +88 -0
- package/dist/components/navigation/Navigation2.d.ts +152 -0
- package/dist/components/overlay/Drawer.d.ts +40 -0
- package/dist/components/overlay/Modal.d.ts +41 -0
- package/dist/components/overlay/Overlay.d.ts +95 -0
- package/dist/components/overlay/Sheet.d.ts +55 -0
- package/dist/components/page/Page.d.ts +91 -0
- package/dist/components/page/PageParts.d.ts +94 -0
- package/dist/components/picker/Picker.d.ts +136 -0
- package/dist/components/picker/Wheel.d.ts +63 -0
- package/dist/components/rating/Rating.d.ts +35 -0
- package/dist/components/select/Select.d.ts +116 -0
- package/dist/components/shell/AppShell.d.ts +52 -0
- package/dist/components/shell/AppSidebar.d.ts +55 -0
- package/dist/components/slider/Slider.d.ts +27 -0
- package/dist/components/table/Table.d.ts +45 -0
- package/dist/components/tabs/Tabs.d.ts +59 -0
- package/dist/components/theme/Theme.d.ts +94 -0
- package/dist/components/theme/lens.d.ts +18 -0
- package/dist/components/tree/Tree.d.ts +125 -0
- package/dist/components/typography/Typography.d.ts +59 -0
- package/dist/components/upload/Upload.d.ts +63 -0
- package/dist/components/work/Ops.d.ts +29 -0
- package/dist/components/work/Work.d.ts +216 -0
- package/dist/i18n/strings.d.ts +429 -0
- package/dist/index.d.ts +71 -0
- package/dist/index.js +7434 -0
- package/dist/styles.css +1 -0
- package/dist/utils/Blueprint.d.ts +12 -0
- package/dist/utils/DotField.d.ts +6 -0
- package/dist/utils/attr.d.ts +2 -0
- package/dist/utils/blueprintScene.d.ts +81 -0
- package/dist/utils/controlled.d.ts +2 -0
- package/dist/utils/cx.d.ts +2 -0
- package/dist/utils/responsive.d.ts +9 -0
- package/dist/utils/scrollEdges.d.ts +9 -0
- package/dist/utils/space.d.ts +2 -0
- package/package.json +68 -4
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type SheetTriggerProps } from 'react-aria-components';
|
|
3
|
+
export interface SheetProps {
|
|
4
|
+
/** Where the sheet comes from: bottom (default, phones), top, start, end or center. */
|
|
5
|
+
position?: 'bottom' | 'top' | 'start' | 'end' | 'center';
|
|
6
|
+
/** Heights it rests at, as fractions of the screen or CSS lengths: [0.5, 1] opens half way and can be dragged to full. */
|
|
7
|
+
snapPoints?: Array<number | string>;
|
|
8
|
+
/** Swiping and tapping outside do not close it (for unsaved work). */
|
|
9
|
+
preventDismissal?: boolean;
|
|
10
|
+
/** The title, read when the sheet opens. */
|
|
11
|
+
title?: ReactNode;
|
|
12
|
+
/** A line under the title. */
|
|
13
|
+
description?: ReactNode;
|
|
14
|
+
/** Content pinned at the bottom: actions. */
|
|
15
|
+
footer?: ReactNode;
|
|
16
|
+
/** Hides the drag handle (it shows for bottom and top sheets). */
|
|
17
|
+
hideHandle?: boolean;
|
|
18
|
+
/** Name for screen readers when there is no title. */
|
|
19
|
+
'aria-label'?: string;
|
|
20
|
+
/** The content. */
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
/** Extra class names for the sheet. */
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
/** A panel that slides in from an edge and follows the finger: swipe it away, or drag it between snap points. Built for phones; on desktop it works like a drawer. */
|
|
26
|
+
export declare function Sheet({ position, snapPoints, preventDismissal, title, description, footer, hideHandle, children, className, 'aria-label': label }: SheetProps): import("react").JSX.Element;
|
|
27
|
+
/** Opens a Sheet: put the trigger (a Button) first, then the Sheet. */
|
|
28
|
+
export declare function SheetTrigger(props: SheetTriggerProps): import("react").JSX.Element;
|
|
29
|
+
export interface ActionSheetAction {
|
|
30
|
+
id: string;
|
|
31
|
+
label: ReactNode;
|
|
32
|
+
icon?: ReactNode;
|
|
33
|
+
description?: ReactNode;
|
|
34
|
+
tone?: 'default' | 'danger';
|
|
35
|
+
isDisabled?: boolean;
|
|
36
|
+
onAction?: () => void;
|
|
37
|
+
}
|
|
38
|
+
export interface ActionSheetProps {
|
|
39
|
+
/** The button that opens it. */
|
|
40
|
+
trigger: ReactNode;
|
|
41
|
+
/** A short title over the actions. */
|
|
42
|
+
title?: ReactNode;
|
|
43
|
+
/** A line under the title. */
|
|
44
|
+
description?: ReactNode;
|
|
45
|
+
/** The actions, top to bottom. Each one closes the sheet. */
|
|
46
|
+
actions: ActionSheetAction[];
|
|
47
|
+
/** The text of the cancel button. Default "Cancel". */
|
|
48
|
+
cancelLabel?: ReactNode;
|
|
49
|
+
/** Open state (controlled). */
|
|
50
|
+
isOpen?: boolean;
|
|
51
|
+
/** Called when it opens or closes. */
|
|
52
|
+
onOpenChange?: (open: boolean) => void;
|
|
53
|
+
}
|
|
54
|
+
/** A list of actions in a bottom sheet, with Cancel apart: Share, Duplicate, Delete. The phone way to show a short menu. */
|
|
55
|
+
export declare function ActionSheet({ trigger, title, description, actions, cancelLabel, isOpen, onOpenChange }: ActionSheetProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
+
export interface SplitterProps {
|
|
3
|
+
/** The two panes. */
|
|
4
|
+
children: [ReactNode, ReactNode];
|
|
5
|
+
/** horizontal: side by side (default); vertical: stacked. */
|
|
6
|
+
orientation?: 'horizontal' | 'vertical';
|
|
7
|
+
/** Size of the first pane in percent (controlled). */
|
|
8
|
+
size?: number;
|
|
9
|
+
/** Starting size of the first pane in percent. Default 50. */
|
|
10
|
+
defaultSize?: number;
|
|
11
|
+
/** Called with the first panel's size in %. */
|
|
12
|
+
onSizeChange?: (size: number) => void;
|
|
13
|
+
/** Smallest and largest first pane, in percent. Default 15 and 85. */
|
|
14
|
+
min?: number;
|
|
15
|
+
/** Largest size of the first panel, in %. Default 85. */
|
|
16
|
+
max?: number;
|
|
17
|
+
/** Name of the handle for screen readers. Default "Resize". */
|
|
18
|
+
'aria-label'?: string;
|
|
19
|
+
/** Extra class names for the root element. */
|
|
20
|
+
className?: string;
|
|
21
|
+
/** Inline styles for the root element. */
|
|
22
|
+
style?: CSSProperties;
|
|
23
|
+
}
|
|
24
|
+
/** Two panes with a handle between them: drag it, or focus it and use the arrow keys. */
|
|
25
|
+
export declare function Splitter({ children, orientation, size, defaultSize, onSizeChange, min, max, className, style, 'aria-label': label }: SplitterProps): import("react").JSX.Element;
|
|
26
|
+
export interface AffixProps {
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
/** Distance from the top while stuck, in px. Default 0. */
|
|
29
|
+
offsetTop?: number;
|
|
30
|
+
/** Called when it sticks or unsticks (to change its look). */
|
|
31
|
+
onChange?: (stuck: boolean) => void;
|
|
32
|
+
/** Extra class names for the root element. */
|
|
33
|
+
className?: string;
|
|
34
|
+
}
|
|
35
|
+
/** Sticks to the top once it scrolls there, and tells you when (data-stuck for styling). */
|
|
36
|
+
export declare function Affix({ children, offsetTop, onChange, className }: AffixProps): import("react").JSX.Element;
|
|
37
|
+
export interface FloatButtonProps {
|
|
38
|
+
/** The icon. */
|
|
39
|
+
icon: ReactNode;
|
|
40
|
+
/** What it does; also the tooltip. */
|
|
41
|
+
'aria-label': string;
|
|
42
|
+
/** Called when the main button is pressed (when there are no actions). */
|
|
43
|
+
onPress?: () => void;
|
|
44
|
+
/** Corner it sits in. Default bottom-end. */
|
|
45
|
+
placement?: 'bottom-end' | 'bottom-start';
|
|
46
|
+
/** primary: the dark gradient; secondary: the chip. */
|
|
47
|
+
variant?: 'primary' | 'secondary';
|
|
48
|
+
/** fixed to the viewport (default), or absolute inside a positioned parent. */
|
|
49
|
+
position?: 'fixed' | 'absolute';
|
|
50
|
+
/** Extra buttons that fan out above it on press. */
|
|
51
|
+
actions?: Array<{
|
|
52
|
+
icon: ReactNode;
|
|
53
|
+
label: string;
|
|
54
|
+
onPress: () => void;
|
|
55
|
+
}>;
|
|
56
|
+
/** Visible text next to the icon: an extended floating button ("New message"). */
|
|
57
|
+
label?: ReactNode;
|
|
58
|
+
/** With label: shrinks to the icon while scrolling down and grows back when scrolling up. */
|
|
59
|
+
collapseOnScroll?: boolean;
|
|
60
|
+
/** circle (default) or rounded (a rounded square). */
|
|
61
|
+
shape?: 'circle' | 'rounded';
|
|
62
|
+
/** md (56 px, default) or sm (44 px). */
|
|
63
|
+
size?: 'sm' | 'md';
|
|
64
|
+
}
|
|
65
|
+
/** A round button floating over the page for one frequent action, or a few. */
|
|
66
|
+
export declare function FloatButton({ icon, onPress, placement, variant, position, actions, label: text, collapseOnScroll, shape, size, 'aria-label': label }: FloatButtonProps): import("react").JSX.Element;
|
|
67
|
+
/** A FloatButton that appears after scrolling down and takes you back to the top. */
|
|
68
|
+
export interface BackToTopProps {
|
|
69
|
+
/** Scroll distance before it shows, in px. Default 400. */
|
|
70
|
+
threshold?: number;
|
|
71
|
+
/** fixed to the window (default) or absolute inside a positioned parent. */
|
|
72
|
+
position?: 'fixed' | 'absolute';
|
|
73
|
+
}
|
|
74
|
+
/** A button that appears after scrolling down and takes people back to the top. */
|
|
75
|
+
export declare function BackToTop({ threshold, position }: BackToTopProps): import("react").JSX.Element | null;
|
|
76
|
+
export interface AnchorProps {
|
|
77
|
+
/** The sections: id of the heading or section, and the link text. Nest with level 2 or 3. */
|
|
78
|
+
items: Array<{
|
|
79
|
+
id: string;
|
|
80
|
+
label: ReactNode;
|
|
81
|
+
level?: 2 | 3;
|
|
82
|
+
}>;
|
|
83
|
+
/** Space taken by a sticky header, so the active section is right. Default 80. */
|
|
84
|
+
offset?: number;
|
|
85
|
+
/** Title above the links. Default "On this page". */
|
|
86
|
+
title?: ReactNode;
|
|
87
|
+
/** Extra class names for the root element. */
|
|
88
|
+
className?: string;
|
|
89
|
+
}
|
|
90
|
+
/** On-page navigation that follows the section you are reading. */
|
|
91
|
+
export declare function Anchor({ items, offset, title, className }: AnchorProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { Key } from 'react-aria-components';
|
|
3
|
+
/** An action for a page header, a save bar or page actions. */
|
|
4
|
+
export interface PageAction {
|
|
5
|
+
id: Key;
|
|
6
|
+
label: string;
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
onAction?: () => void;
|
|
9
|
+
href?: string;
|
|
10
|
+
isDisabled?: boolean;
|
|
11
|
+
tone?: 'default' | 'danger';
|
|
12
|
+
}
|
|
13
|
+
export interface PageHeaderProps {
|
|
14
|
+
/** The page title (an h1 by default). */
|
|
15
|
+
title: ReactNode;
|
|
16
|
+
/** A line under the title. */
|
|
17
|
+
subtitle?: ReactNode;
|
|
18
|
+
/** Where Back goes: an href, or a function. Shows an arrow button before the title. */
|
|
19
|
+
back?: string | (() => void);
|
|
20
|
+
/** The label of the back button. Default "Back". */
|
|
21
|
+
backLabel?: string;
|
|
22
|
+
/** The trail above the title. */
|
|
23
|
+
breadcrumbs?: Array<{
|
|
24
|
+
label: ReactNode;
|
|
25
|
+
href?: string;
|
|
26
|
+
}>;
|
|
27
|
+
/** An avatar, icon or thumbnail before the title. */
|
|
28
|
+
media?: ReactNode;
|
|
29
|
+
/** Badges and facts next to the title: status, dates, owner. */
|
|
30
|
+
meta?: ReactNode;
|
|
31
|
+
/** The main actions (usually one primary button). They stay visible on phones. */
|
|
32
|
+
actions?: ReactNode;
|
|
33
|
+
/** More actions: shown as buttons from 768 px up, folded into a More menu on phones. */
|
|
34
|
+
secondaryActions?: PageAction[];
|
|
35
|
+
/** Tabs or a segmented control under the header. */
|
|
36
|
+
tabs?: ReactNode;
|
|
37
|
+
/** Heading level. Default 1. */
|
|
38
|
+
headingLevel?: 1 | 2 | 3;
|
|
39
|
+
/** Sticks to the top while scrolling, and gets a border once stuck. */
|
|
40
|
+
sticky?: boolean;
|
|
41
|
+
/** Tighter spacing and a smaller title, for dense apps. */
|
|
42
|
+
compact?: boolean;
|
|
43
|
+
/** Extra class names. */
|
|
44
|
+
className?: string;
|
|
45
|
+
}
|
|
46
|
+
/** The top of a page: breadcrumbs or back, title, subtitle, meta, actions and tabs. Secondary actions fold into a menu on phones. */
|
|
47
|
+
export declare function PageHeader({ title, subtitle, back, backLabel, breadcrumbs, media, meta, actions, secondaryActions, tabs, headingLevel, sticky, compact, className }: PageHeaderProps): import("react").JSX.Element;
|
|
48
|
+
export interface SaveBarProps {
|
|
49
|
+
/** Show it while there are unsaved changes. */
|
|
50
|
+
isVisible: boolean;
|
|
51
|
+
/** The message. Default "Unsaved changes". */
|
|
52
|
+
message?: ReactNode;
|
|
53
|
+
/** Saves the changes. */
|
|
54
|
+
onSave: () => void;
|
|
55
|
+
/** Throws the changes away. */
|
|
56
|
+
onDiscard?: () => void;
|
|
57
|
+
/** Shows a spinner on Save while it works. */
|
|
58
|
+
isSaving?: boolean;
|
|
59
|
+
/** Label of the save button. Default "Save". */
|
|
60
|
+
saveLabel?: ReactNode;
|
|
61
|
+
/** Label of the discard button. Default "Discard". */
|
|
62
|
+
discardLabel?: ReactNode;
|
|
63
|
+
/** Where it shows: top (over the header, default) or bottom. */
|
|
64
|
+
position?: 'top' | 'bottom';
|
|
65
|
+
/** ⌘S / Ctrl+S saves while it is visible. Default true. */
|
|
66
|
+
saveShortcut?: boolean;
|
|
67
|
+
}
|
|
68
|
+
/** A bar that appears while a form has unsaved changes, with Save and Discard. Announced to screen readers when it appears; ⌘S saves. */
|
|
69
|
+
export declare function SaveBar({ isVisible, message, onSave, onDiscard, isSaving, saveLabel, discardLabel, position, saveShortcut }: SaveBarProps): import("react").JSX.Element;
|
|
70
|
+
export interface TopLoadingBarProps {
|
|
71
|
+
/** Shows the bar while a page or a big request loads. */
|
|
72
|
+
isLoading: boolean;
|
|
73
|
+
/** A known progress from 0 to 100; without it the bar creeps forward on its own. */
|
|
74
|
+
value?: number;
|
|
75
|
+
/** Name for screen readers. Default "Loading". */
|
|
76
|
+
'aria-label'?: string;
|
|
77
|
+
}
|
|
78
|
+
/** A thin bar at the very top of the window while a page loads: it creeps forward, then completes and fades. */
|
|
79
|
+
export declare function TopLoadingBar({ isLoading, value, 'aria-label': label }: TopLoadingBarProps): import("react").JSX.Element | null;
|
|
80
|
+
/** A quiet line at the end of a page that points to help: "Learn more about payouts". */
|
|
81
|
+
export declare function FooterHelp({ children, className }: {
|
|
82
|
+
children: ReactNode;
|
|
83
|
+
className?: string;
|
|
84
|
+
}): import("react").JSX.Element;
|
|
85
|
+
export interface PageActionsProps {
|
|
86
|
+
/** The main action, on the right. */
|
|
87
|
+
primary?: ReactNode;
|
|
88
|
+
/** Other actions, on the left (Delete, Archive). */
|
|
89
|
+
secondary?: ReactNode;
|
|
90
|
+
/** Extra class names. */
|
|
91
|
+
className?: string;
|
|
92
|
+
}
|
|
93
|
+
/** The row of actions at the end of a form page: primary on the right, secondary on the left. Full width and stacked on phones. */
|
|
94
|
+
export declare function PageActions({ primary, secondary, className }: PageActionsProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type Key } from 'react-aria-components';
|
|
3
|
+
import type { MotionProp } from '@alea-design/motion';
|
|
4
|
+
export interface OTPFieldProps {
|
|
5
|
+
/** Number of characters. Default 6. */
|
|
6
|
+
length?: number;
|
|
7
|
+
/** The visible label ("Verification code"). */
|
|
8
|
+
label?: ReactNode;
|
|
9
|
+
/** The code (controlled). */
|
|
10
|
+
value?: string;
|
|
11
|
+
/** The code to start with. */
|
|
12
|
+
defaultValue?: string;
|
|
13
|
+
/** Called with the code as it is typed. */
|
|
14
|
+
onChange?: (value: string) => void;
|
|
15
|
+
/** Called when every box is filled. */
|
|
16
|
+
onComplete?: (value: string) => void;
|
|
17
|
+
/** numeric (default) or alphanumeric. */
|
|
18
|
+
type?: 'numeric' | 'alphanumeric';
|
|
19
|
+
/** Hide the characters (PINs). */
|
|
20
|
+
mask?: boolean;
|
|
21
|
+
/** Marks it invalid and shows errorMessage. */
|
|
22
|
+
isInvalid?: boolean;
|
|
23
|
+
/** The error shown when it is invalid. */
|
|
24
|
+
errorMessage?: ReactNode;
|
|
25
|
+
/** Disables every part of it. */
|
|
26
|
+
isDisabled?: boolean;
|
|
27
|
+
/** Form field name for the joined value. */
|
|
28
|
+
name?: string;
|
|
29
|
+
}
|
|
30
|
+
/** One-time codes in separate boxes: paste the whole code, arrows and Backspace move between boxes. */
|
|
31
|
+
export declare function OTPField({ length, label, value, defaultValue, onChange, onComplete, type, mask, isInvalid, errorMessage, isDisabled, name }: OTPFieldProps): import("react").JSX.Element;
|
|
32
|
+
export interface CascaderOption {
|
|
33
|
+
id: Key;
|
|
34
|
+
label: string;
|
|
35
|
+
children?: CascaderOption[];
|
|
36
|
+
isDisabled?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface CascaderProps {
|
|
39
|
+
/** The visible label. */
|
|
40
|
+
label?: ReactNode;
|
|
41
|
+
/** The tree of options: id, label, children. */
|
|
42
|
+
options: CascaderOption[];
|
|
43
|
+
/** The picked path of ids (controlled). */
|
|
44
|
+
value?: Key[];
|
|
45
|
+
/** The path of ids to start with. */
|
|
46
|
+
defaultValue?: Key[];
|
|
47
|
+
/** Called with the path of ids. */
|
|
48
|
+
onChange?: (path: Key[], options: CascaderOption[]) => void;
|
|
49
|
+
/** Shown while there is no value. */
|
|
50
|
+
placeholder?: string;
|
|
51
|
+
/** Lets people pick a parent too, not only the last level. */
|
|
52
|
+
allowsParentSelection?: boolean;
|
|
53
|
+
/** Help text shown under the field. */
|
|
54
|
+
description?: ReactNode;
|
|
55
|
+
/** Disables every part of it. */
|
|
56
|
+
isDisabled?: boolean;
|
|
57
|
+
/** How the popup enters and leaves: a preset (fade, scale, pop, slide-down, blur...), false for none, or options. */
|
|
58
|
+
motion?: MotionProp;
|
|
59
|
+
}
|
|
60
|
+
/** Pick from nested options column by column: country, then city. */
|
|
61
|
+
export declare function Cascader({ motion, label, options, value, defaultValue, onChange, placeholder, allowsParentSelection, description, isDisabled }: CascaderProps): import("react").JSX.Element;
|
|
62
|
+
export interface TreeSelectNode {
|
|
63
|
+
id: Key;
|
|
64
|
+
label: string;
|
|
65
|
+
children?: TreeSelectNode[];
|
|
66
|
+
}
|
|
67
|
+
export interface TreeSelectProps {
|
|
68
|
+
/** The visible label. */
|
|
69
|
+
label?: ReactNode;
|
|
70
|
+
/** The tree: id, label, children. */
|
|
71
|
+
nodes: TreeSelectNode[];
|
|
72
|
+
/** single (default) or multiple. */
|
|
73
|
+
selectionMode?: 'single' | 'multiple';
|
|
74
|
+
/** The selected id (controlled). */
|
|
75
|
+
value?: Key[];
|
|
76
|
+
/** The selected id to start with. */
|
|
77
|
+
defaultValue?: Key[];
|
|
78
|
+
/** Called with the selected id. */
|
|
79
|
+
onChange?: (keys: Key[]) => void;
|
|
80
|
+
/** Shown while there is no value. */
|
|
81
|
+
placeholder?: string;
|
|
82
|
+
/** Disables every part of it. */
|
|
83
|
+
isDisabled?: boolean;
|
|
84
|
+
/** How the popup enters and leaves: a preset (fade, scale, pop, slide-down, blur...), false for none, or options. */
|
|
85
|
+
motion?: MotionProp;
|
|
86
|
+
}
|
|
87
|
+
/** A select whose options are a tree: categories, folders, org charts. */
|
|
88
|
+
export declare function TreeSelect({ motion, label, nodes, selectionMode, value, defaultValue, onChange, placeholder, isDisabled }: TreeSelectProps): import("react").JSX.Element;
|
|
89
|
+
export interface TransferItem {
|
|
90
|
+
id: Key;
|
|
91
|
+
label: string;
|
|
92
|
+
description?: string;
|
|
93
|
+
isDisabled?: boolean;
|
|
94
|
+
}
|
|
95
|
+
export interface TransferProps {
|
|
96
|
+
/** All the items: id and label. */
|
|
97
|
+
items: TransferItem[];
|
|
98
|
+
/** Ids on the right side (controlled). */
|
|
99
|
+
value?: Key[];
|
|
100
|
+
/** The ids on the right to start with. */
|
|
101
|
+
defaultValue?: Key[];
|
|
102
|
+
/** Called with the ids on the right. */
|
|
103
|
+
onChange?: (keys: Key[]) => void;
|
|
104
|
+
/** Titles of the two lists. */
|
|
105
|
+
titles?: [string, string];
|
|
106
|
+
/** Adds a search field to each list. */
|
|
107
|
+
searchable?: boolean;
|
|
108
|
+
}
|
|
109
|
+
/** Move items between two lists: available and chosen. */
|
|
110
|
+
export declare function Transfer({ items, value, defaultValue, onChange, titles, searchable }: TransferProps): import("react").JSX.Element;
|
|
111
|
+
export interface MentionsProps {
|
|
112
|
+
/** The visible label. */
|
|
113
|
+
label?: ReactNode;
|
|
114
|
+
/** People or things to mention. */
|
|
115
|
+
options: Array<{
|
|
116
|
+
id: string;
|
|
117
|
+
label: string;
|
|
118
|
+
description?: string;
|
|
119
|
+
}>;
|
|
120
|
+
/** The text (controlled). */
|
|
121
|
+
value?: string;
|
|
122
|
+
/** The text to start with. */
|
|
123
|
+
defaultValue?: string;
|
|
124
|
+
/** Called with the text. */
|
|
125
|
+
onChange?: (value: string) => void;
|
|
126
|
+
/** Character that starts a mention. Default @. */
|
|
127
|
+
trigger?: string;
|
|
128
|
+
/** Shown while there is no value. */
|
|
129
|
+
placeholder?: string;
|
|
130
|
+
/** Rows of the text area. Default 3. */
|
|
131
|
+
rows?: number;
|
|
132
|
+
/** Help text shown under the field. */
|
|
133
|
+
description?: ReactNode;
|
|
134
|
+
}
|
|
135
|
+
/** A text area where @ suggests people to mention; arrows pick, Enter inserts. */
|
|
136
|
+
export declare function Mentions({ label, options, value, defaultValue, onChange, trigger, placeholder, rows, description }: MentionsProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export interface WheelColumn<V extends string | number = string | number> {
|
|
3
|
+
/** The column's id, the key in value. */
|
|
4
|
+
id: string;
|
|
5
|
+
/** Name for screen readers ("Hour", "Size"). */
|
|
6
|
+
label: string;
|
|
7
|
+
/** The choices, top to bottom. */
|
|
8
|
+
items: Array<{
|
|
9
|
+
value: V;
|
|
10
|
+
label: ReactNode;
|
|
11
|
+
textValue?: string;
|
|
12
|
+
}>;
|
|
13
|
+
/** Wraps around: after the last comes the first (hours, minutes). */
|
|
14
|
+
loop?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface WheelPickerProps {
|
|
17
|
+
/** One or more columns side by side. */
|
|
18
|
+
columns: WheelColumn[];
|
|
19
|
+
/** The picked value of each column, by column id (controlled). */
|
|
20
|
+
value?: Record<string, string | number>;
|
|
21
|
+
/** The picked values at first. Default the first item of each column. */
|
|
22
|
+
defaultValue?: Record<string, string | number>;
|
|
23
|
+
/** Called with every column's value when one changes. */
|
|
24
|
+
onChange?: (value: Record<string, string | number>) => void;
|
|
25
|
+
/** How many rows show. Odd numbers center the pick. Default 5. */
|
|
26
|
+
visibleRows?: number;
|
|
27
|
+
/** Row height in px. Default 40 (44 on touch screens). */
|
|
28
|
+
rowHeight?: number;
|
|
29
|
+
/** Name of the whole picker. */
|
|
30
|
+
'aria-label'?: string;
|
|
31
|
+
/** Extra class names. */
|
|
32
|
+
className?: string;
|
|
33
|
+
}
|
|
34
|
+
/** Scrolling wheels to pick from, like a phone's picker: one or several columns (hours and minutes, size and color). Swipe, scroll, click a row, or use the arrow keys. */
|
|
35
|
+
export declare function WheelPicker({ columns, value, defaultValue, onChange, visibleRows, rowHeight, className, 'aria-label': label }: WheelPickerProps): import("react").JSX.Element;
|
|
36
|
+
export interface TimeValue24 {
|
|
37
|
+
hour: number;
|
|
38
|
+
minute: number;
|
|
39
|
+
}
|
|
40
|
+
export interface TimePickerProps {
|
|
41
|
+
/** The visible label. */
|
|
42
|
+
label?: ReactNode;
|
|
43
|
+
/** The time (controlled), 24 h. */
|
|
44
|
+
value?: TimeValue24 | null;
|
|
45
|
+
/** The time at first. */
|
|
46
|
+
defaultValue?: TimeValue24 | null;
|
|
47
|
+
/** Called with the new time. */
|
|
48
|
+
onChange?: (value: TimeValue24) => void;
|
|
49
|
+
/** 12 h with AM and PM (default for the locale's convention when left out) or 24 h. */
|
|
50
|
+
hourCycle?: 12 | 24;
|
|
51
|
+
/** Minutes step on the dial. Default 5. */
|
|
52
|
+
minuteStep?: number;
|
|
53
|
+
/** How to pick: a clock dial (default) or wheels. */
|
|
54
|
+
input?: 'dial' | 'wheel';
|
|
55
|
+
/** Help text under the field. */
|
|
56
|
+
description?: ReactNode;
|
|
57
|
+
/** Disables it. */
|
|
58
|
+
isDisabled?: boolean;
|
|
59
|
+
/** Extra class names. */
|
|
60
|
+
className?: string;
|
|
61
|
+
}
|
|
62
|
+
/** A time field with a clock dial (or wheels) in a popover: pick the hour, then the minutes, then AM or PM. Every number on the dial is a button, so it works with the keyboard and screen readers. */
|
|
63
|
+
export declare function TimePicker({ label, value, defaultValue, onChange, hourCycle, minuteStep, input, description, isDisabled, className }: TimePickerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export interface RatingProps {
|
|
3
|
+
/** Name of the rating ("Rate this plugin"). */
|
|
4
|
+
label?: ReactNode;
|
|
5
|
+
/** The rating (controlled), 0 for none. Halves with allowHalf. */
|
|
6
|
+
value?: number;
|
|
7
|
+
/** The rating to start with. */
|
|
8
|
+
defaultValue?: number;
|
|
9
|
+
/** Called with the new rating. */
|
|
10
|
+
onChange?: (value: number) => void;
|
|
11
|
+
/** Number of icons. Default 5. */
|
|
12
|
+
max?: number;
|
|
13
|
+
/** Lets people pick halves (3.5). Shown values can always be halves. */
|
|
14
|
+
allowHalf?: boolean;
|
|
15
|
+
/** Pressing the current value again clears it to 0. Default true. */
|
|
16
|
+
allowClear?: boolean;
|
|
17
|
+
/** The icon: a star by default, or any icon (a heart, a flame). */
|
|
18
|
+
icon?: ReactNode;
|
|
19
|
+
/** The color of the filled icons: warning (amber, default), accent, danger or success. */
|
|
20
|
+
tone?: 'warning' | 'accent' | 'danger' | 'success';
|
|
21
|
+
/** Shows the number after the icons ("4.5"), or the value's words with "label". */
|
|
22
|
+
showValue?: boolean | 'label';
|
|
23
|
+
/** Shows the value without letting people change it. */
|
|
24
|
+
isReadOnly?: boolean;
|
|
25
|
+
/** Disables every part of it. */
|
|
26
|
+
isDisabled?: boolean;
|
|
27
|
+
/** sm, md (default) or lg. */
|
|
28
|
+
size?: 'sm' | 'md' | 'lg';
|
|
29
|
+
/** Words for each value, read by screen readers ("1 star" by default), and shown with showValue="label". */
|
|
30
|
+
getValueLabel?: (n: number) => string;
|
|
31
|
+
/** Extra class names for the root element. */
|
|
32
|
+
className?: string;
|
|
33
|
+
}
|
|
34
|
+
/** Icons to rate something: stars or your own icon, halves, clear by pressing again, the value shown, four tones. Arrows move, like radios. */
|
|
35
|
+
export declare function Rating({ label, value, defaultValue, onChange, max, allowHalf, allowClear, icon, tone, showValue, isReadOnly, isDisabled, size, getValueLabel, className }: RatingProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type SelectProps as RACSelectProps, type ListBoxProps as RACListBoxProps, type ListBoxItemProps, type ValidationResult, type Key } from 'react-aria-components';
|
|
3
|
+
import type { MotionProp } from '@alea-design/motion';
|
|
4
|
+
import { type FieldSize, type FieldVariant } from '../field/Field';
|
|
5
|
+
import type { Responsive } from '../../utils/responsive';
|
|
6
|
+
import { type MatchStyle } from '../combobox/Highlight';
|
|
7
|
+
export interface SelectOption {
|
|
8
|
+
id: Key;
|
|
9
|
+
label: ReactNode;
|
|
10
|
+
description?: ReactNode;
|
|
11
|
+
icon?: ReactNode;
|
|
12
|
+
isDisabled?: boolean;
|
|
13
|
+
textValue?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface SelectProps<T extends object = SelectOption> extends Omit<RACSelectProps<T, 'single' | 'multiple'>, 'children'> {
|
|
16
|
+
/** The visible label. */
|
|
17
|
+
label?: ReactNode;
|
|
18
|
+
/** Help text under the field. */
|
|
19
|
+
description?: ReactNode;
|
|
20
|
+
/** Error text, shown when invalid. */
|
|
21
|
+
errorMessage?: ReactNode | ((v: ValidationResult) => ReactNode);
|
|
22
|
+
/** A warning that does not block, shown under the field in amber. */
|
|
23
|
+
warningMessage?: ReactNode;
|
|
24
|
+
/** Shows "(optional)" after the label. */
|
|
25
|
+
showOptional?: boolean;
|
|
26
|
+
/** The options. For sections, nest SelectSection and SelectItem as children instead. */
|
|
27
|
+
items?: Iterable<T>;
|
|
28
|
+
children?: ReactNode | ((item: T) => ReactNode);
|
|
29
|
+
/** xs 28 px, sm 32 px, md 44 px (default), lg 48 px, xl 56 px. Can change per breakpoint. */
|
|
30
|
+
size?: Responsive<FieldSize>;
|
|
31
|
+
/** outline (default), filled, underline or borderless, like TextField. */
|
|
32
|
+
variant?: FieldVariant;
|
|
33
|
+
/** top (default) or side (from 640 px up). */
|
|
34
|
+
labelPosition?: 'top' | 'side';
|
|
35
|
+
/** An icon or text inside the trigger, before the value. */
|
|
36
|
+
prefix?: ReactNode;
|
|
37
|
+
/** Shows a clear button while something is selected. */
|
|
38
|
+
isClearable?: boolean;
|
|
39
|
+
/** A search box at the top of the list that filters the options. */
|
|
40
|
+
searchable?: boolean;
|
|
41
|
+
/** With searchable: marks the part of each option that matches what was typed, with a mark element. */
|
|
42
|
+
highlightMatch?: boolean;
|
|
43
|
+
/** How the match looks: tint (default), bold or underline. */
|
|
44
|
+
matchStyle?: MatchStyle;
|
|
45
|
+
/** Shows a spinner instead of the chevron (same size, so nothing moves), for options that are still loading. Screen readers hear the select as busy. */
|
|
46
|
+
isLoading?: boolean;
|
|
47
|
+
/** What the list says when there are no options or no matches. Default "No results". */
|
|
48
|
+
emptyText?: ReactNode;
|
|
49
|
+
/** Content under the list inside the popover, like an "Add option" button. */
|
|
50
|
+
footer?: ReactNode;
|
|
51
|
+
/** Where the selected check shows: end (default) or start. */
|
|
52
|
+
checkPosition?: 'start' | 'end';
|
|
53
|
+
/** With selectionMode="multiple": how many tags show in the trigger before "+N". Default 2. */
|
|
54
|
+
maxTags?: number;
|
|
55
|
+
/** Your own content for the trigger, from the selected items. */
|
|
56
|
+
renderValue?: (items: T[]) => ReactNode;
|
|
57
|
+
/** Renders only the visible options: pass the row height (40). For lists of thousands. */
|
|
58
|
+
virtualized?: number;
|
|
59
|
+
/** How the popup enters and leaves: a preset (fade, scale, pop, slide-down, blur...), false for none, or options. */
|
|
60
|
+
motion?: MotionProp;
|
|
61
|
+
}
|
|
62
|
+
/** Pick one or several options from a list in a popover; type to jump, arrows to move. Search, clear, tags, groups, a footer and virtualization when you need them. */
|
|
63
|
+
export declare function Select<T extends object = SelectOption>({ motion, label, description, errorMessage, warningMessage, showOptional, items, children, size, variant, labelPosition, prefix, isClearable, searchable, highlightMatch, matchStyle, isLoading, emptyText, footer, checkPosition, maxTags, renderValue, virtualized, className, placeholder, ...props }: SelectProps<T>): import("react").JSX.Element;
|
|
64
|
+
export interface SelectItemProps extends Omit<ListBoxItemProps, 'children'> {
|
|
65
|
+
children: ReactNode;
|
|
66
|
+
/** A second line under the option. */
|
|
67
|
+
description?: ReactNode;
|
|
68
|
+
/** An icon before the option. */
|
|
69
|
+
icon?: ReactNode;
|
|
70
|
+
/** Text to mark in the label and the description, like what was typed to filter. A ComboBox or a searchable Select with highlightMatch sets it for you; set it yourself when you filter the options. */
|
|
71
|
+
matchQuery?: string;
|
|
72
|
+
/** How the match looks: tint (default), bold or underline. */
|
|
73
|
+
matchStyle?: MatchStyle;
|
|
74
|
+
}
|
|
75
|
+
/** An option in a Select (or any listbox). Marks the part that matches matchQuery, with a mark element. */
|
|
76
|
+
export declare function SelectItem({ children, description, icon, matchQuery, matchStyle, className, textValue, ...props }: SelectItemProps): import("react").JSX.Element;
|
|
77
|
+
export interface SelectSectionProps {
|
|
78
|
+
/** The section heading. */
|
|
79
|
+
title: ReactNode;
|
|
80
|
+
children: ReactNode;
|
|
81
|
+
}
|
|
82
|
+
/** A titled group of options. */
|
|
83
|
+
export declare function SelectSection({ title, children }: SelectSectionProps): import("react").JSX.Element;
|
|
84
|
+
export interface ListBoxProps<T extends object = SelectOption> extends Omit<RACListBoxProps<T>, 'children'> {
|
|
85
|
+
/** The options as data, or SelectItem and SelectSection children. */
|
|
86
|
+
items?: Iterable<T>;
|
|
87
|
+
children?: ReactNode | ((item: T) => ReactNode);
|
|
88
|
+
/** What shows when the list is empty. */
|
|
89
|
+
emptyText?: ReactNode;
|
|
90
|
+
/** Where the selected check shows: end (default) or start. */
|
|
91
|
+
checkPosition?: 'start' | 'end';
|
|
92
|
+
/** Draws the list as a card with a border (default), or plain inside your own container. */
|
|
93
|
+
variant?: 'card' | 'plain';
|
|
94
|
+
/** Scrolls inside this height. */
|
|
95
|
+
maxHeight?: number | string;
|
|
96
|
+
}
|
|
97
|
+
/** A list of options people pick from, on its own (not in a popup): settings, filters, side lists. Single or multiple selection, sections, descriptions and icons, type to jump. */
|
|
98
|
+
export declare function ListBox<T extends object = SelectOption>({ items, children, emptyText, checkPosition, variant, maxHeight, className, style, ...props }: ListBoxProps<T>): import("react").JSX.Element;
|
|
99
|
+
export type Period = '24h' | '7d' | '30d' | '90d' | '6m' | '12m' | 'ytd' | 'all';
|
|
100
|
+
export interface PeriodSelectProps {
|
|
101
|
+
/** The periods to offer, in order. Default 24h, 7d, 30d, 12m. */
|
|
102
|
+
periods?: Period[];
|
|
103
|
+
/** The chosen period (controlled). */
|
|
104
|
+
value?: Period;
|
|
105
|
+
/** The period at first. Default 30d. */
|
|
106
|
+
defaultValue?: Period;
|
|
107
|
+
/** Called with the new period. */
|
|
108
|
+
onChange?: (period: Period) => void;
|
|
109
|
+
/** A visible label. Without it the field is named "Period" (translated) for screen readers. */
|
|
110
|
+
label?: ReactNode;
|
|
111
|
+
/** sm for a toolbar or a card header. */
|
|
112
|
+
size?: SelectProps['size'];
|
|
113
|
+
className?: string;
|
|
114
|
+
}
|
|
115
|
+
/** The time range of a dashboard or a report: Last 7 days, Last 30 days, Year to date, in the people's language. */
|
|
116
|
+
export declare function PeriodSelect({ periods, value, defaultValue, onChange, label, size, className }: PeriodSelectProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type LinkProps } from 'react-aria-components';
|
|
3
|
+
export interface AppShellProps {
|
|
4
|
+
/** Logo or product name, top left. */
|
|
5
|
+
brand?: ReactNode;
|
|
6
|
+
/** Things on the right of the header: search, theme toggle, avatar. */
|
|
7
|
+
headerEnd?: ReactNode;
|
|
8
|
+
/** The side navigation (a SidebarNav). On small screens it moves into a drawer. */
|
|
9
|
+
sidebar?: ReactNode;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
/** Sidebar width. Default 248 px. */
|
|
12
|
+
sidebarWidth?: number;
|
|
13
|
+
/** Below this width the sidebar goes into a drawer. Default 900 px. */
|
|
14
|
+
collapseBelow?: number;
|
|
15
|
+
/** The content element: main (default), or div when the shell sits inside a page that already has a main (demos, embeds). */
|
|
16
|
+
mainAs?: 'main' | 'div';
|
|
17
|
+
/** header (default): a bar across the top, the sidebar under it. sidebar: a web app layout, the sidebar full height
|
|
18
|
+
* (put the brand in it, e.g. with AppSidebar and WorkspaceSwitcher) and the page in an inset panel whose top bar holds headerEnd. */
|
|
19
|
+
layout?: 'header' | 'sidebar';
|
|
20
|
+
/** Extra class names for the root element. */
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
/** The app frame: sticky header, sidebar, scrollable content and a skip link. */
|
|
24
|
+
export declare function AppShell({ brand, headerEnd, sidebar, children, sidebarWidth, collapseBelow, mainAs, layout, className }: AppShellProps): import("react").JSX.Element;
|
|
25
|
+
export interface SidebarNavProps {
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
/** Name of the navigation. Default "Sidebar". */
|
|
28
|
+
'aria-label'?: string;
|
|
29
|
+
/** Extra class names for the root element. */
|
|
30
|
+
className?: string;
|
|
31
|
+
}
|
|
32
|
+
/** Vertical navigation with groups; the current page is marked. */
|
|
33
|
+
export declare function SidebarNav({ children, className, 'aria-label': label }: SidebarNavProps): import("react").JSX.Element;
|
|
34
|
+
/** A titled group of nav links. */
|
|
35
|
+
export interface SidebarGroupProps {
|
|
36
|
+
/** Small uppercase title of the group. */
|
|
37
|
+
title?: ReactNode;
|
|
38
|
+
/** The SidebarLinks. */
|
|
39
|
+
children: ReactNode;
|
|
40
|
+
}
|
|
41
|
+
/** A group of sidebar links under a title. */
|
|
42
|
+
export declare function SidebarGroup({ title, children }: SidebarGroupProps): import("react").JSX.Element;
|
|
43
|
+
export interface SidebarLinkProps extends LinkProps {
|
|
44
|
+
/** Marks the current page (aria-current). */
|
|
45
|
+
isCurrent?: boolean;
|
|
46
|
+
/** An icon before the label. */
|
|
47
|
+
icon?: ReactNode;
|
|
48
|
+
/** A count or badge on the right. */
|
|
49
|
+
end?: ReactNode;
|
|
50
|
+
}
|
|
51
|
+
/** A link in the side navigation. */
|
|
52
|
+
export declare function SidebarLink({ isCurrent, icon, end, children, className, ...props }: SidebarLinkProps): import("react").JSX.Element;
|