@alea-design/ui 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +72 -0
- package/dist/index.js +7439 -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/inert.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,176 @@
|
|
|
1
|
+
import { type ReactNode, type CSSProperties } from 'react';
|
|
2
|
+
export interface SkipLinkProps {
|
|
3
|
+
/** The id of the main content, without #. Default "main". */
|
|
4
|
+
target?: string;
|
|
5
|
+
/** The link text. Default "Skip to content". */
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/** The first link on the page: hidden until focused, it jumps past the navigation to the content. */
|
|
9
|
+
export declare function SkipLink({ target, children }: SkipLinkProps): import("react").JSX.Element;
|
|
10
|
+
export interface VisuallyHiddenProps {
|
|
11
|
+
/** Text only screen readers should hear. */
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
/** Render as another element. Default span. */
|
|
14
|
+
as?: 'span' | 'div' | 'p' | 'h1' | 'h2' | 'h3';
|
|
15
|
+
}
|
|
16
|
+
/** Content for screen readers only: still read, never shown. */
|
|
17
|
+
export declare function VisuallyHidden({ children, as: Tag }: VisuallyHiddenProps): import("react").JSX.Element;
|
|
18
|
+
export interface CollapsibleProps {
|
|
19
|
+
/** The always-visible trigger text. */
|
|
20
|
+
title: ReactNode;
|
|
21
|
+
/** The content that opens and closes. */
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
/** Open (controlled). */
|
|
24
|
+
isExpanded?: boolean;
|
|
25
|
+
/** Open to start with. */
|
|
26
|
+
defaultExpanded?: boolean;
|
|
27
|
+
/** Called when it opens or closes. */
|
|
28
|
+
onExpandedChange?: (open: boolean) => void;
|
|
29
|
+
className?: string;
|
|
30
|
+
}
|
|
31
|
+
/** One section that opens and closes, without the card look of an accordion. */
|
|
32
|
+
export declare function Collapsible({ title, children, isExpanded, defaultExpanded, onExpandedChange, className }: CollapsibleProps): import("react").JSX.Element;
|
|
33
|
+
export interface EditableProps {
|
|
34
|
+
/** The text (controlled). */
|
|
35
|
+
value?: string;
|
|
36
|
+
/** The text to start with. */
|
|
37
|
+
defaultValue?: string;
|
|
38
|
+
/** Called with the new text when it is saved. Return false to refuse it (stays editing, marked invalid). */
|
|
39
|
+
onSave?: (value: string) => boolean | void;
|
|
40
|
+
/** What the text is, for screen readers ("Project name"). */
|
|
41
|
+
label: string;
|
|
42
|
+
/** Shown while empty. */
|
|
43
|
+
placeholder?: string;
|
|
44
|
+
/** A text area instead of one line. */
|
|
45
|
+
multiline?: boolean;
|
|
46
|
+
className?: string;
|
|
47
|
+
}
|
|
48
|
+
/** Text that turns into a field when clicked: rename in place. Enter saves, Escape cancels. */
|
|
49
|
+
export declare function Editable({ value, defaultValue, onSave, label, placeholder, multiline, className }: EditableProps): import("react").JSX.Element;
|
|
50
|
+
export interface FormattedNumberProps {
|
|
51
|
+
/** The number to format. */
|
|
52
|
+
value: number;
|
|
53
|
+
/** Intl.NumberFormat options: { style: 'currency', currency: 'USD' }, { notation: 'compact' }, { style: 'percent' }. */
|
|
54
|
+
format?: Intl.NumberFormatOptions;
|
|
55
|
+
/** A BCP 47 locale. Default the browser's. */
|
|
56
|
+
locale?: string;
|
|
57
|
+
}
|
|
58
|
+
/** A number formatted for the reader's locale: currency, percent, compact. */
|
|
59
|
+
export declare function FormattedNumber({ value, format, locale }: FormattedNumberProps): import("react").JSX.Element;
|
|
60
|
+
export interface CountdownProps {
|
|
61
|
+
/** When it ends: a Date or a timestamp in ms. */
|
|
62
|
+
to: Date | number;
|
|
63
|
+
/** What it counts down to, read before the time ("Sale ends in"). */
|
|
64
|
+
label: ReactNode;
|
|
65
|
+
/** Called once when it reaches zero. */
|
|
66
|
+
onEnd?: () => void;
|
|
67
|
+
/** Show days. Default true when there is more than a day left. */
|
|
68
|
+
showDays?: boolean;
|
|
69
|
+
className?: string;
|
|
70
|
+
}
|
|
71
|
+
/** Time left until a moment, updating every second. Screen readers hear it once a minute, not every second. */
|
|
72
|
+
export declare function Countdown({ to, label, onEnd, showDays, className }: CountdownProps): import("react").JSX.Element;
|
|
73
|
+
export interface StatusProps {
|
|
74
|
+
/** The state: success (online, live), warning (degraded), danger (down), neutral (offline), info. */
|
|
75
|
+
tone?: 'success' | 'warning' | 'danger' | 'neutral' | 'info' | 'accent';
|
|
76
|
+
/** The words: the color is never the only signal. */
|
|
77
|
+
children: ReactNode;
|
|
78
|
+
/** Breathe, for live states (pulse pattern; stops with reduced motion). */
|
|
79
|
+
pulse?: boolean;
|
|
80
|
+
className?: string;
|
|
81
|
+
}
|
|
82
|
+
/** A colored dot with a label: service health, presence, deploy state. */
|
|
83
|
+
export declare function Status({ tone, children, pulse, className }: StatusProps): import("react").JSX.Element;
|
|
84
|
+
export interface ColorSwatchProps {
|
|
85
|
+
/** Any CSS color, or a token: var(--alea-accent). */
|
|
86
|
+
color: string;
|
|
87
|
+
/** Name for screen readers ("Orchid, purple 400"). */
|
|
88
|
+
label: string;
|
|
89
|
+
/** Size in px. Default 28. */
|
|
90
|
+
size?: number;
|
|
91
|
+
/** circle (default) or square. */
|
|
92
|
+
shape?: 'circle' | 'square';
|
|
93
|
+
/** Shows the name and the value under the swatch. */
|
|
94
|
+
showValue?: boolean;
|
|
95
|
+
className?: string;
|
|
96
|
+
style?: CSSProperties;
|
|
97
|
+
}
|
|
98
|
+
/** A color sample, with a checkerboard under transparent colors. */
|
|
99
|
+
export declare function ColorSwatch({ color, label, size, shape, showValue, className, style }: ColorSwatchProps): import("react").JSX.Element;
|
|
100
|
+
export interface LoadingOverlayProps {
|
|
101
|
+
/** Shows the overlay and marks the content busy. */
|
|
102
|
+
isLoading: boolean;
|
|
103
|
+
/** The content it covers. */
|
|
104
|
+
children: ReactNode;
|
|
105
|
+
/** What is loading, for screen readers. Default "Loading". */
|
|
106
|
+
label?: string;
|
|
107
|
+
/** Blur the content under it. Default true. */
|
|
108
|
+
blur?: boolean;
|
|
109
|
+
className?: string;
|
|
110
|
+
}
|
|
111
|
+
/** Covers a region while it loads, keeps it in place and tells screen readers it is busy. */
|
|
112
|
+
export declare function LoadingOverlay({ isLoading, children, label, blur, className }: LoadingOverlayProps): import("react").JSX.Element;
|
|
113
|
+
export interface ProgressSegmentsProps {
|
|
114
|
+
/** The parts: label, value and an optional color (defaults to the chart colors). */
|
|
115
|
+
segments: Array<{
|
|
116
|
+
label: string;
|
|
117
|
+
value: number;
|
|
118
|
+
color?: string;
|
|
119
|
+
}>;
|
|
120
|
+
/** The whole. Default the sum of the values. */
|
|
121
|
+
total?: number;
|
|
122
|
+
/** Name of the bar ("Storage"). */
|
|
123
|
+
label: ReactNode;
|
|
124
|
+
/** Formats each value in the legend, e.g. v => `${v} GB`. */
|
|
125
|
+
valueFormat?: (v: number) => string;
|
|
126
|
+
/** Shows the legend under the bar. Default true. */
|
|
127
|
+
showLegend?: boolean;
|
|
128
|
+
className?: string;
|
|
129
|
+
}
|
|
130
|
+
/** One bar split into parts: storage by type, budget by team. */
|
|
131
|
+
export declare function ProgressSegments({ segments, total, label, valueFormat, showLegend, className }: ProgressSegmentsProps): import("react").JSX.Element;
|
|
132
|
+
export interface BlockquoteProps {
|
|
133
|
+
children: ReactNode;
|
|
134
|
+
/** Who said it. */
|
|
135
|
+
cite?: ReactNode;
|
|
136
|
+
/** The source URL (sets cite on the quote). */
|
|
137
|
+
source?: string;
|
|
138
|
+
className?: string;
|
|
139
|
+
}
|
|
140
|
+
/** A quotation with its author. */
|
|
141
|
+
export declare function Blockquote({ children, cite, source, className }: BlockquoteProps): import("react").JSX.Element;
|
|
142
|
+
export interface ListProps {
|
|
143
|
+
/** The items. */
|
|
144
|
+
items: ReactNode[];
|
|
145
|
+
/** bullet (default), number, check or none. */
|
|
146
|
+
marker?: 'bullet' | 'number' | 'check' | 'none';
|
|
147
|
+
/** Space between items: sm or md (default). */
|
|
148
|
+
spacing?: 'sm' | 'md';
|
|
149
|
+
className?: string;
|
|
150
|
+
}
|
|
151
|
+
/** A styled list with bullets, numbers or checks. */
|
|
152
|
+
export declare function List({ items, marker, spacing, className }: ListProps): import("react").JSX.Element;
|
|
153
|
+
export interface ProseProps {
|
|
154
|
+
/** Rich content: headings, paragraphs, lists, links, quotes, code, images, tables (from Markdown or a CMS). */
|
|
155
|
+
children: ReactNode;
|
|
156
|
+
/** sm (14 px) or base (16 px, default) text. */
|
|
157
|
+
size?: 'sm' | 'base';
|
|
158
|
+
className?: string;
|
|
159
|
+
}
|
|
160
|
+
/** Styles long-form content you don't control element by element: articles, docs, CMS HTML. */
|
|
161
|
+
export declare function Prose({ children, size, className }: ProseProps): import("react").JSX.Element;
|
|
162
|
+
export interface BannerProps {
|
|
163
|
+
/** The message. Keep it to one line on desktop. */
|
|
164
|
+
children: ReactNode;
|
|
165
|
+
/** accent (default, gradient), info, warning or danger. */
|
|
166
|
+
tone?: 'accent' | 'info' | 'warning' | 'danger';
|
|
167
|
+
/** A link or button after the message. */
|
|
168
|
+
action?: ReactNode;
|
|
169
|
+
/** Shows a close button; called when closed. */
|
|
170
|
+
onDismiss?: () => void;
|
|
171
|
+
/** Name of the region. Default "Announcement"; give each banner its own when there are several. */
|
|
172
|
+
'aria-label'?: string;
|
|
173
|
+
className?: string;
|
|
174
|
+
}
|
|
175
|
+
/** A site-wide announcement bar above the header: launches, sales, outages. */
|
|
176
|
+
export declare function Banner({ children, tone, action, onDismiss, className, 'aria-label': label }: BannerProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
+
import { type NavigationMenuProps } from './Navigation2';
|
|
3
|
+
export interface NavbarProps {
|
|
4
|
+
/** The logo or name, usually a link home. */
|
|
5
|
+
brand: ReactNode;
|
|
6
|
+
/** The links: the same items as NavigationMenu (links, or groups with panels). */
|
|
7
|
+
items: NavigationMenuProps['items'];
|
|
8
|
+
/** The href of the current page. */
|
|
9
|
+
current?: string;
|
|
10
|
+
/** Things on the right: theme toggle, sign in, a call to action. Also shown in the drawer on small screens. */
|
|
11
|
+
actions?: ReactNode;
|
|
12
|
+
/** Below this width the links move into a drawer behind a burger. Default md (768 px). */
|
|
13
|
+
collapseBelow?: 'sm' | 'md' | 'lg';
|
|
14
|
+
/** Stick to the top while scrolling, with a blurred background. Default true. */
|
|
15
|
+
sticky?: boolean;
|
|
16
|
+
/** Name of the navigation. Default "Main". */
|
|
17
|
+
'aria-label'?: string;
|
|
18
|
+
className?: string;
|
|
19
|
+
/** Inline styles for the root, e.g. a radius when it floats as a pill (the glass then follows the corners). */
|
|
20
|
+
style?: CSSProperties;
|
|
21
|
+
}
|
|
22
|
+
/** A site header: brand, links with optional mega menus, actions; on small screens the links move into a drawer. */
|
|
23
|
+
export declare function Navbar({ brand, items, current, actions, collapseBelow, sticky, className, style, 'aria-label': label }: NavbarProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type BreadcrumbsProps as RACBreadcrumbsProps, type BreadcrumbProps as RACBreadcrumbProps, type Key } from 'react-aria-components';
|
|
3
|
+
export interface BreadcrumbsProps<T extends object> extends RACBreadcrumbsProps<T> {
|
|
4
|
+
/** Character or icon between items. Default a chevron. */
|
|
5
|
+
separator?: ReactNode;
|
|
6
|
+
/** With Breadcrumb children: show at most this many; the middle ones fold into a … menu (first and last stay). */
|
|
7
|
+
maxItems?: number;
|
|
8
|
+
/** sm (13 px) or md (14 px, default). */
|
|
9
|
+
size?: 'sm' | 'md';
|
|
10
|
+
}
|
|
11
|
+
/** Where the page sits: a trail of links, the last one is the current page. Long trails fold their middle into a menu. */
|
|
12
|
+
export declare function Breadcrumbs<T extends object>({ separator, maxItems, size, className, children, ...props }: BreadcrumbsProps<T>): import("react").JSX.Element;
|
|
13
|
+
export interface BreadcrumbProps extends RACBreadcrumbProps {
|
|
14
|
+
/** Link target. Leave it out on the current page. */
|
|
15
|
+
href?: string;
|
|
16
|
+
/** An icon before the text (a home icon on the first crumb). */
|
|
17
|
+
icon?: ReactNode;
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
/** One step of the trail. */
|
|
21
|
+
export declare function Breadcrumb({ href, icon, children, className, ...props }: BreadcrumbProps): import("react").JSX.Element;
|
|
22
|
+
export interface PaginationProps {
|
|
23
|
+
/** Current page, from 1. */
|
|
24
|
+
page: number;
|
|
25
|
+
/** Total pages. */
|
|
26
|
+
total: number;
|
|
27
|
+
/** Called with the new page number. */
|
|
28
|
+
onChange: (page: number) => void;
|
|
29
|
+
/** Pages shown on each side of the current one. Default 1. */
|
|
30
|
+
siblings?: number;
|
|
31
|
+
/** compact shows "3 of 12" between the arrows instead of page numbers. */
|
|
32
|
+
appearance?: 'pages' | 'compact';
|
|
33
|
+
/** sm (28 px), md (36 px, default) or lg (44 px) buttons. */
|
|
34
|
+
size?: 'sm' | 'md' | 'lg';
|
|
35
|
+
/** Adds first and last page buttons. */
|
|
36
|
+
showFirstLast?: boolean;
|
|
37
|
+
/** Rows per page, to show a page size select with onPageSizeChange. */
|
|
38
|
+
pageSize?: number;
|
|
39
|
+
/** The page sizes to offer. Default 10, 25, 50, 100. */
|
|
40
|
+
pageSizeOptions?: number[];
|
|
41
|
+
/** Called with the new page size. */
|
|
42
|
+
onPageSizeChange?: (size: number) => void;
|
|
43
|
+
/** All the items, to show "1-10 of 248" (needs pageSize). */
|
|
44
|
+
totalItems?: number;
|
|
45
|
+
/** A field to jump to a page. */
|
|
46
|
+
showJumper?: boolean;
|
|
47
|
+
/** Name for screen readers. Default "Pagination". */
|
|
48
|
+
'aria-label'?: string;
|
|
49
|
+
/** Extra class names for the root element. */
|
|
50
|
+
className?: string;
|
|
51
|
+
}
|
|
52
|
+
/** Move through pages of results. The current page is marked for screen readers. */
|
|
53
|
+
export declare function Pagination({ page, total, onChange, siblings, appearance, size, showFirstLast, pageSize, pageSizeOptions, onPageSizeChange, totalItems, showJumper, className, 'aria-label': label }: PaginationProps): import("react").JSX.Element;
|
|
54
|
+
export interface Step {
|
|
55
|
+
id: Key;
|
|
56
|
+
title: ReactNode;
|
|
57
|
+
description?: ReactNode;
|
|
58
|
+
/** Overrides the status from current: error (something to fix) or warning. */
|
|
59
|
+
status?: 'error' | 'warning';
|
|
60
|
+
/** An icon instead of the number (with variant="icons"). */
|
|
61
|
+
icon?: ReactNode;
|
|
62
|
+
/** Marks the step as optional. */
|
|
63
|
+
isOptional?: boolean;
|
|
64
|
+
}
|
|
65
|
+
export interface StepsProps {
|
|
66
|
+
/** The steps: id, title, optional description. */
|
|
67
|
+
steps: Step[];
|
|
68
|
+
/** The step in progress (by id). Earlier steps show as done. */
|
|
69
|
+
current: Key;
|
|
70
|
+
/** horizontal (default) or vertical. */
|
|
71
|
+
orientation?: 'horizontal' | 'vertical';
|
|
72
|
+
/** Lets people jump back to finished steps. */
|
|
73
|
+
onStepPress?: (id: Key) => void;
|
|
74
|
+
/** Name of the list. Default "Progress". */
|
|
75
|
+
'aria-label'?: string;
|
|
76
|
+
/** Extra class names for the root element. */
|
|
77
|
+
className?: string;
|
|
78
|
+
/** Horizontal steps turn vertical on phones (below 640 px). Default true. */
|
|
79
|
+
responsive?: boolean;
|
|
80
|
+
/** sm (24 px markers) or md (32 px, default). */
|
|
81
|
+
size?: 'sm' | 'md';
|
|
82
|
+
/** numbers (default), dots (small markers, for compact flows) or icons (each step's icon). */
|
|
83
|
+
variant?: 'numbers' | 'dots' | 'icons';
|
|
84
|
+
/** Horizontal only: the text beside the marker (end, default) or below it (centered). */
|
|
85
|
+
labelPlacement?: 'end' | 'below';
|
|
86
|
+
}
|
|
87
|
+
/** Progress through a known sequence: done, current and upcoming steps. */
|
|
88
|
+
export declare function Steps({ steps, current, orientation, responsive, onStepPress, size, variant, labelPlacement, className, 'aria-label': label }: StepsProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { type MouseEvent, type ReactNode } from 'react';
|
|
2
|
+
import { type Key } from 'react-aria-components';
|
|
3
|
+
import { type MotionProp } from '@alea-design/motion';
|
|
4
|
+
/** One item of a menu built from data: an action, or a separator. */
|
|
5
|
+
export type MenuEntry = {
|
|
6
|
+
id: Key;
|
|
7
|
+
label: string;
|
|
8
|
+
icon?: ReactNode;
|
|
9
|
+
shortcut?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
tone?: 'default' | 'danger';
|
|
12
|
+
isDisabled?: boolean;
|
|
13
|
+
} | {
|
|
14
|
+
separator: true;
|
|
15
|
+
};
|
|
16
|
+
export interface ContextMenuProps {
|
|
17
|
+
/** The area people right-click (or long-press, or Shift+F10 when focused). */
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
/** The menu entries: id, label, icon, shortcut, tone, or { separator: true }. */
|
|
20
|
+
items: MenuEntry[];
|
|
21
|
+
/** Called with the id of the entry picked. */
|
|
22
|
+
onAction?: (id: Key) => void;
|
|
23
|
+
/** Name of the menu. Default "Context menu". */
|
|
24
|
+
'aria-label'?: string;
|
|
25
|
+
/** Name of the area, so people know it has a menu ("File preview"). */
|
|
26
|
+
areaLabel: string;
|
|
27
|
+
/** Extra class names for the root element. */
|
|
28
|
+
className?: string;
|
|
29
|
+
/** How the popup enters and leaves: a preset (fade, scale, pop, slide-down, blur...), false for none, or options. */
|
|
30
|
+
motion?: MotionProp;
|
|
31
|
+
}
|
|
32
|
+
/** A menu that opens where people right-click; Shift+F10 or the Menu key opens it from the keyboard. */
|
|
33
|
+
export declare function ContextMenu({ motion, children, items, onAction, className, areaLabel, 'aria-label': label }: ContextMenuProps): import("react").JSX.Element;
|
|
34
|
+
export interface MenubarProps {
|
|
35
|
+
/** Name of the menu bar ("Editor"). */
|
|
36
|
+
'aria-label': string;
|
|
37
|
+
/** The menus, left to right: a label and its items. */
|
|
38
|
+
menus: Array<{
|
|
39
|
+
id: string;
|
|
40
|
+
label: string;
|
|
41
|
+
items: MenuEntry[];
|
|
42
|
+
}>;
|
|
43
|
+
/** Called with the menu id and the item id. */
|
|
44
|
+
onAction?: (menu: string, item: Key) => void;
|
|
45
|
+
/** Extra class names for the root element. */
|
|
46
|
+
className?: string;
|
|
47
|
+
/** How the popup enters and leaves: a preset (fade, scale, pop, slide-down, blur...), false for none, or options. */
|
|
48
|
+
motion?: MotionProp;
|
|
49
|
+
}
|
|
50
|
+
/** A desktop-app menu bar (File, Edit, View): arrows move between menus, Enter or Down opens one (WAI-ARIA menubar). */
|
|
51
|
+
export declare function Menubar({ motion, menus, onAction, className, 'aria-label': label }: MenubarProps): import("react").JSX.Element;
|
|
52
|
+
export interface HoverCardProps {
|
|
53
|
+
/** The link or element people hover or focus. */
|
|
54
|
+
trigger: ReactNode;
|
|
55
|
+
/** The card: a preview of a profile, a page, a definition. Keep it supplementary: the same information must be reachable another way. */
|
|
56
|
+
children: ReactNode;
|
|
57
|
+
/** ms before it opens. Default 500. */
|
|
58
|
+
openDelay?: number;
|
|
59
|
+
/** ms before it closes after the pointer leaves. Default 200. */
|
|
60
|
+
closeDelay?: number;
|
|
61
|
+
/** top, bottom (default), start or end. */
|
|
62
|
+
placement?: 'top' | 'bottom' | 'start' | 'end';
|
|
63
|
+
/** How the popup enters and leaves: a preset (fade, scale, pop, slide-down, blur...), false for none, or options. */
|
|
64
|
+
motion?: MotionProp;
|
|
65
|
+
}
|
|
66
|
+
/** A rich preview on hover or keyboard focus, which people can move into. */
|
|
67
|
+
export declare function HoverCard({ motion, trigger, children, openDelay, closeDelay, placement }: HoverCardProps): import("react").JSX.Element;
|
|
68
|
+
/** A link in a NavigationMenu. */
|
|
69
|
+
export interface NavLinkItem {
|
|
70
|
+
label: string;
|
|
71
|
+
href: string;
|
|
72
|
+
description?: string;
|
|
73
|
+
icon?: ReactNode;
|
|
74
|
+
badge?: ReactNode;
|
|
75
|
+
isDisabled?: boolean;
|
|
76
|
+
}
|
|
77
|
+
/** A group of links that opens: a panel (horizontal) or a nested list or flyout (vertical). Groups can nest in vertical menus. */
|
|
78
|
+
export interface NavGroupItem {
|
|
79
|
+
label: string;
|
|
80
|
+
items: NavItem[];
|
|
81
|
+
icon?: ReactNode;
|
|
82
|
+
badge?: ReactNode;
|
|
83
|
+
footer?: ReactNode;
|
|
84
|
+
}
|
|
85
|
+
/** Anything in a NavigationMenu: a link, a group, a section title or a divider. */
|
|
86
|
+
export type NavItem = NavLinkItem | NavGroupItem | {
|
|
87
|
+
section: string;
|
|
88
|
+
} | {
|
|
89
|
+
divider: true;
|
|
90
|
+
};
|
|
91
|
+
export interface NavigationMenuProps {
|
|
92
|
+
/** Name of the navigation. Default "Main". */
|
|
93
|
+
'aria-label'?: string;
|
|
94
|
+
/** Links, groups (nested in vertical menus), section titles ({ section: 'Workspace' }) and dividers ({ divider: true }). */
|
|
95
|
+
items: NavItem[];
|
|
96
|
+
/** The href of the current page (gets aria-current; its groups open). */
|
|
97
|
+
current?: string;
|
|
98
|
+
/** horizontal (a header bar with dropdown panels, default) or vertical (a sidebar with nested groups). */
|
|
99
|
+
orientation?: 'horizontal' | 'vertical';
|
|
100
|
+
/** Vertical only: an icon rail; labels show as tooltips and groups open as flyouts to the side. */
|
|
101
|
+
collapsed?: boolean;
|
|
102
|
+
/** With collapsed: short labels under the icons (a navigation rail) instead of tooltips. */
|
|
103
|
+
railLabels?: boolean;
|
|
104
|
+
/** Vertical only: opening a group closes its open siblings. */
|
|
105
|
+
accordion?: boolean;
|
|
106
|
+
/** Vertical only: sm (32 px rows), md (36 px, default) or lg (44 px). */
|
|
107
|
+
size?: 'sm' | 'md' | 'lg';
|
|
108
|
+
/** Called when a link is chosen, with its href: use it for client side routing (call preventDefault on the event). */
|
|
109
|
+
onNavigate?: (href: string, event: MouseEvent<HTMLAnchorElement>) => void;
|
|
110
|
+
/** Extra class names for the root element. */
|
|
111
|
+
className?: string;
|
|
112
|
+
}
|
|
113
|
+
/** A site header navigation with dropdown panels (mega menus), using the disclosure pattern: buttons open panels of links. */
|
|
114
|
+
export declare function NavigationMenu(props: NavigationMenuProps): import("react").JSX.Element;
|
|
115
|
+
export interface BottomNavigationProps {
|
|
116
|
+
/** Name of the navigation. Default "Main". */
|
|
117
|
+
'aria-label'?: string;
|
|
118
|
+
/** Three to five destinations: id, label, icon, and an href (links) or none (buttons with onChange). */
|
|
119
|
+
items: Array<{
|
|
120
|
+
id: string;
|
|
121
|
+
label: string;
|
|
122
|
+
icon: ReactNode;
|
|
123
|
+
href?: string;
|
|
124
|
+
badge?: number;
|
|
125
|
+
}>;
|
|
126
|
+
/** The current destination. */
|
|
127
|
+
value: string;
|
|
128
|
+
/** Called with the id of the destination picked. */
|
|
129
|
+
onChange?: (id: string) => void;
|
|
130
|
+
/** Stick to the bottom of the screen. Default true. */
|
|
131
|
+
fixed?: boolean;
|
|
132
|
+
/** Extra class names for the root element. */
|
|
133
|
+
className?: string;
|
|
134
|
+
}
|
|
135
|
+
/** The tab bar of a mobile app: three to five destinations with icons and labels. */
|
|
136
|
+
export declare function BottomNavigation({ items, value, onChange, fixed, className, 'aria-label': label }: BottomNavigationProps): import("react").JSX.Element;
|
|
137
|
+
export interface BurgerProps {
|
|
138
|
+
/** Whether the menu it controls is open. */
|
|
139
|
+
isOpen: boolean;
|
|
140
|
+
/** Called with the new open state. */
|
|
141
|
+
onChange: (open: boolean) => void;
|
|
142
|
+
/** The id of the menu it opens. */
|
|
143
|
+
'aria-controls'?: string;
|
|
144
|
+
/** Name. Default "Menu". */
|
|
145
|
+
'aria-label'?: string;
|
|
146
|
+
/** sm (32 px) or md (40 px, default). */
|
|
147
|
+
size?: 'sm' | 'md';
|
|
148
|
+
/** Extra class names for the root element. */
|
|
149
|
+
className?: string;
|
|
150
|
+
}
|
|
151
|
+
/** The three-line menu button that morphs into a close icon. */
|
|
152
|
+
export declare function Burger({ isOpen, onChange, size, className, 'aria-controls': controls, 'aria-label': label }: BurgerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { DialogTrigger, type ModalOverlayProps } from 'react-aria-components';
|
|
3
|
+
import { type MotionProp } from '@alea-design/motion';
|
|
4
|
+
import { type DialogProps, type PopoverProps } from './Overlay';
|
|
5
|
+
export interface DrawerProps extends Omit<ModalOverlayProps, 'children'> {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/** Side it slides in from. Default end (right in left-to-right). */
|
|
8
|
+
placement?: 'start' | 'end' | 'bottom';
|
|
9
|
+
/** Width (start/end) or height (bottom). Default 420 px. */
|
|
10
|
+
size?: number | string;
|
|
11
|
+
/** How it enters and leaves (default: from its edge): a preset, false, or options. */
|
|
12
|
+
motion?: MotionProp;
|
|
13
|
+
}
|
|
14
|
+
/** A panel that slides in from the side: filters, details, navigation on mobile. Focus is trapped, Escape closes. */
|
|
15
|
+
export declare function Drawer({ children, placement, size, className, isDismissable, motion, ...props }: DrawerProps): import("react").JSX.Element;
|
|
16
|
+
/** The content of a Drawer: title, body and footer, like Dialog. */
|
|
17
|
+
export declare function DrawerContent(props: DialogProps): import("react").JSX.Element;
|
|
18
|
+
export { DialogTrigger as DrawerTrigger };
|
|
19
|
+
export interface PopconfirmProps {
|
|
20
|
+
/** The button that asks. */
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
/** The question. */
|
|
23
|
+
title: ReactNode;
|
|
24
|
+
/** More context under the question. */
|
|
25
|
+
description?: ReactNode;
|
|
26
|
+
/** Default "Yes". */
|
|
27
|
+
confirmLabel?: ReactNode;
|
|
28
|
+
/** Default "Cancel". */
|
|
29
|
+
cancelLabel?: ReactNode;
|
|
30
|
+
/** danger turns the confirm button red. */
|
|
31
|
+
tone?: 'default' | 'danger';
|
|
32
|
+
/** Called when the person confirms. */
|
|
33
|
+
onConfirm: () => unknown;
|
|
34
|
+
/** Where it opens relative to its trigger. */
|
|
35
|
+
placement?: PopoverProps['placement'];
|
|
36
|
+
/** How the popup enters and leaves: a preset (fade, scale, pop, slide-down, blur...), false for none, or options. */
|
|
37
|
+
motion?: MotionProp;
|
|
38
|
+
}
|
|
39
|
+
/** A small confirm next to its trigger, for quick, reversible-ish actions. */
|
|
40
|
+
export declare function Popconfirm({ motion, children, title, description, confirmLabel, cancelLabel, tone, onConfirm, placement }: PopconfirmProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type ModalOverlayProps } from 'react-aria-components';
|
|
3
|
+
import { type MotionProp } from '@alea-design/motion';
|
|
4
|
+
type Render = ReactNode | ((opts: {
|
|
5
|
+
close: () => void;
|
|
6
|
+
}) => ReactNode);
|
|
7
|
+
export interface ModalProps extends Omit<ModalOverlayProps, 'children' | 'className' | 'style'> {
|
|
8
|
+
/** Anything: a form, a gallery, a video, a wizard, a whole page. A function gets close. */
|
|
9
|
+
children: Render;
|
|
10
|
+
/** The button (or any pressable) that opens it. Leave it out and control isOpen yourself. */
|
|
11
|
+
trigger?: ReactNode;
|
|
12
|
+
/** A title in the header, read when it opens. Without one, give the modal an aria-label. */
|
|
13
|
+
title?: ReactNode;
|
|
14
|
+
/** Name for screen readers when there is no title. */
|
|
15
|
+
'aria-label'?: string;
|
|
16
|
+
/** Your own header instead of the title row (it still gets the close button). */
|
|
17
|
+
header?: ReactNode;
|
|
18
|
+
/** Content pinned at the bottom: actions, a summary. A function gets close. */
|
|
19
|
+
footer?: Render;
|
|
20
|
+
/** xs 320, sm 400, md 560 (default), lg 760, xl 960, full (the whole window less a margin), or auto (as wide as its content). */
|
|
21
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full' | 'auto';
|
|
22
|
+
/** center (default) or top (stays put while its content grows, good for search and long forms). */
|
|
23
|
+
placement?: 'center' | 'top';
|
|
24
|
+
/** inside: the header and footer stay, the body scrolls (default). outside: the whole modal scrolls with the page, for long reading. */
|
|
25
|
+
scrollBehavior?: 'inside' | 'outside';
|
|
26
|
+
/** normal (default) or none, for media that should touch the edges (an image, a video, a map). */
|
|
27
|
+
padding?: 'normal' | 'none';
|
|
28
|
+
/** What is behind it: dim (default), blur (dim and blur) or transparent (only for modals that already stand out). */
|
|
29
|
+
backdrop?: 'dim' | 'blur' | 'transparent';
|
|
30
|
+
/** Shows the close button. Default true. */
|
|
31
|
+
showClose?: boolean;
|
|
32
|
+
/** Takes the whole screen below this breakpoint (phones): sm (640 px) or md (768 px). */
|
|
33
|
+
fullscreenBelow?: 'sm' | 'md';
|
|
34
|
+
/** How it enters and leaves (default rise): a preset, false, or options. */
|
|
35
|
+
motion?: MotionProp;
|
|
36
|
+
/** Extra class names for the modal surface. */
|
|
37
|
+
className?: string;
|
|
38
|
+
}
|
|
39
|
+
/** A modal with any content: a header and footer if you want them, seven sizes, centered or at the top, the body or the whole modal scrolling, edge-to-edge media, three backdrops. Traps focus, closes on Escape and outside click, and returns focus to what opened it. For a title, text and two buttons, Dialog is quicker; to confirm something destructive, AlertDialog. */
|
|
40
|
+
export declare function Modal({ children, trigger, title, 'aria-label': label, header, footer, size, placement, scrollBehavior, padding, backdrop, showClose, fullscreenBelow, motion, className, isDismissable, isOpen, defaultOpen, onOpenChange, ...props }: ModalProps): import("react").JSX.Element;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { DialogTrigger, type PopoverProps as RACPopoverProps, type TooltipProps as RACTooltipProps, type TooltipTriggerComponentProps, type DialogProps as RACDialogProps, type ModalOverlayProps } from 'react-aria-components';
|
|
3
|
+
import { type MotionProp } from '@alea-design/motion';
|
|
4
|
+
export { DialogTrigger };
|
|
5
|
+
export interface PopoverProps extends Omit<RACPopoverProps, 'children'> {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/** Shows the little arrow pointing at the trigger. */
|
|
8
|
+
showArrow?: boolean;
|
|
9
|
+
/** How it enters and leaves: a preset (fade, scale, pop, rise, slide-up, blur...), false for none, or { enter, exit, duration, easing, delay }. */
|
|
10
|
+
motion?: MotionProp;
|
|
11
|
+
/** Width: sm (240 px), md (320 px) or lg (420 px). Default: as wide as its content. */
|
|
12
|
+
size?: 'sm' | 'md' | 'lg';
|
|
13
|
+
}
|
|
14
|
+
/** A floating panel attached to a trigger; closes on Escape or outside click. Three widths, an optional arrow. */
|
|
15
|
+
export declare function Popover({ children, showArrow, className, offset, motion, style, size, ...props }: PopoverProps): import("react").JSX.Element;
|
|
16
|
+
export interface PopoverDialogProps extends RACDialogProps {
|
|
17
|
+
/** Optional title at the top. */
|
|
18
|
+
title?: ReactNode;
|
|
19
|
+
/** A line under the title. */
|
|
20
|
+
description?: ReactNode;
|
|
21
|
+
/** Buttons at the bottom, e.g. Cancel and Apply. A function gets close. */
|
|
22
|
+
footer?: ReactNode | ((close: () => void) => ReactNode);
|
|
23
|
+
/** Adds a close button in the corner (Escape and an outside click close it anyway). */
|
|
24
|
+
showClose?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/** The content of a Popover that holds interactive things (forms, filters, settings): a title, a description, a footer and a close button. */
|
|
27
|
+
export declare function PopoverDialog({ title, description, footer, showClose, children, className, ...props }: PopoverDialogProps): import("react").JSX.Element;
|
|
28
|
+
export interface TooltipProps extends Omit<RACTooltipProps, 'children'> {
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
/** A bold first line: a rich tooltip with a title and a sentence. Keep it non-interactive; for links use Toggletip. */
|
|
31
|
+
title?: ReactNode;
|
|
32
|
+
/** A keyboard shortcut shown at the end, like ⌘K. */
|
|
33
|
+
shortcut?: ReactNode;
|
|
34
|
+
/** Hides the arrow. */
|
|
35
|
+
hideArrow?: boolean;
|
|
36
|
+
/** How it enters and leaves: a preset (fade, scale, pop, rise, slide-up, blur...), false for none, or { enter, exit, duration, easing, delay }. */
|
|
37
|
+
motion?: MotionProp;
|
|
38
|
+
}
|
|
39
|
+
/** A short hint on hover or keyboard focus, with an optional title and shortcut. Not for anything the user must read to act. */
|
|
40
|
+
export declare function Tooltip({ children, title, shortcut, hideArrow, className, offset, motion, style, ...props }: TooltipProps): import("react").JSX.Element;
|
|
41
|
+
export interface TooltipTriggerProps extends TooltipTriggerComponentProps {
|
|
42
|
+
}
|
|
43
|
+
/** Wraps a focusable trigger and its Tooltip. Default delay 600 ms, 0 when moving between tooltips. */
|
|
44
|
+
export declare function TooltipTrigger({ delay, closeDelay, ...props }: TooltipTriggerProps): import("react").JSX.Element;
|
|
45
|
+
export interface DialogProps extends Omit<RACDialogProps, 'children'> {
|
|
46
|
+
/** The title (required for screen readers unless aria-label is set). */
|
|
47
|
+
title?: ReactNode;
|
|
48
|
+
/** Text under the title. */
|
|
49
|
+
description?: ReactNode;
|
|
50
|
+
children?: ReactNode | ((opts: {
|
|
51
|
+
close: () => void;
|
|
52
|
+
}) => ReactNode);
|
|
53
|
+
/** Buttons at the bottom, e.g. Cancel and Save. Receives close. */
|
|
54
|
+
footer?: ReactNode | ((opts: {
|
|
55
|
+
close: () => void;
|
|
56
|
+
}) => ReactNode);
|
|
57
|
+
/** Hides the X button. */
|
|
58
|
+
hideClose?: boolean;
|
|
59
|
+
}
|
|
60
|
+
/** The dialog content: title, text, body and footer. Put it inside DialogModal. */
|
|
61
|
+
export declare function Dialog({ title, description, children, footer, hideClose, className, ...props }: DialogProps): import("react").JSX.Element;
|
|
62
|
+
export interface DialogModalProps extends Omit<ModalOverlayProps, 'children'> {
|
|
63
|
+
children: ReactNode;
|
|
64
|
+
/** sm 400, md 520, lg 720, full. */
|
|
65
|
+
size?: 'sm' | 'md' | 'lg' | 'full';
|
|
66
|
+
/** Takes the whole screen below this breakpoint (phones): sm (640 px) or md (768 px). */
|
|
67
|
+
fullscreenBelow?: 'sm' | 'md';
|
|
68
|
+
/** How the dialog enters and leaves (default rise): a preset, false, or options. */
|
|
69
|
+
motion?: MotionProp;
|
|
70
|
+
}
|
|
71
|
+
/** The modal layer: dims the page, traps focus, closes on Escape (and outside click when isDismissable). Four sizes, full screen on phones when you want. */
|
|
72
|
+
export declare function DialogModal({ children, size, fullscreenBelow, className, isDismissable, motion, ...props }: DialogModalProps): import("react").JSX.Element;
|
|
73
|
+
export interface AlertDialogProps {
|
|
74
|
+
/** The question, e.g. "Delete this file?". */
|
|
75
|
+
title: ReactNode;
|
|
76
|
+
children?: ReactNode;
|
|
77
|
+
/** The confirm button text. */
|
|
78
|
+
confirmLabel?: ReactNode;
|
|
79
|
+
/** The cancel button text. Default "Cancel". */
|
|
80
|
+
cancelLabel?: ReactNode;
|
|
81
|
+
/** danger turns the confirm button red. */
|
|
82
|
+
tone?: 'default' | 'danger';
|
|
83
|
+
/** Runs on confirm; the dialog closes after it (awaits a promise). */
|
|
84
|
+
onConfirm?: () => unknown;
|
|
85
|
+
/** Open state (controlled). */
|
|
86
|
+
isOpen?: boolean;
|
|
87
|
+
/** Open on first render (uncontrolled). */
|
|
88
|
+
defaultOpen?: boolean;
|
|
89
|
+
/** Called when it opens or closes. */
|
|
90
|
+
onOpenChange?: (open: boolean) => void;
|
|
91
|
+
/** How the dialog enters and leaves (default rise). */
|
|
92
|
+
motion?: MotionProp;
|
|
93
|
+
}
|
|
94
|
+
/** A confirm dialog (role alertdialog): Escape and outside click don't dismiss it by accident. */
|
|
95
|
+
export declare function AlertDialog({ motion, title, children, confirmLabel, cancelLabel, tone, onConfirm, isOpen, defaultOpen, onOpenChange }: AlertDialogProps): import("react").JSX.Element;
|