@med-o/ui 0.0.0-stage → 0.3.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 +38 -2
- package/dist/index.d.ts +2237 -0
- package/dist/index.js +5119 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +1 -0
- package/package.json +77 -4
- package/src/accordion/accordion.css +184 -0
- package/src/alert/alert.css +147 -0
- package/src/avatar/avatar.css +221 -0
- package/src/badge/badge.css +153 -0
- package/src/bottom-sheet/bottom-sheet.css +202 -0
- package/src/breadcrumbs/breadcrumbs.css +147 -0
- package/src/bulk-action-bar/bulk-action-bar.css +98 -0
- package/src/button/button.css +319 -0
- package/src/card/card.css +217 -0
- package/src/checkbox/choice.css +196 -0
- package/src/combobox/combobox.css +125 -0
- package/src/date-time/date-time.css +474 -0
- package/src/dialog/dialog.css +319 -0
- package/src/drawer/drawer.css +156 -0
- package/src/empty-state/empty-state.css +161 -0
- package/src/field/field.css +115 -0
- package/src/link/link.css +103 -0
- package/src/list/list.css +172 -0
- package/src/list-view/list-view.css +473 -0
- package/src/listbox/listbox.css +203 -0
- package/src/media/media.css +298 -0
- package/src/menu/menu.css +183 -0
- package/src/navigation/navigation.css +625 -0
- package/src/pagination/pagination.css +132 -0
- package/src/popover/popover.css +166 -0
- package/src/progress/progress.css +225 -0
- package/src/search/search.css +309 -0
- package/src/select/select.css +229 -0
- package/src/slider/slider.css +212 -0
- package/src/styles.css +48 -0
- package/src/switch/switch.css +160 -0
- package/src/table/table.css +286 -0
- package/src/tabs/tabs.css +211 -0
- package/src/tag/tag.css +225 -0
- package/src/text-field/input.css +206 -0
- package/src/toast/toast.css +184 -0
- package/src/toggle-button/toggle-button.css +143 -0
- package/src/tooltip/tooltip.css +66 -0
- package/src/upload/upload.css +380 -0
- package/src/utils/utilities.css +14 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2237 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode, CSSProperties, HTMLAttributes, ImgHTMLAttributes } from 'react';
|
|
3
|
+
import { ButtonProps as ButtonProps$1, TextFieldProps as TextFieldProps$1, CheckboxFieldProps, CheckboxGroupProps as CheckboxGroupProps$1, RadioFieldProps, RadioGroupProps as RadioGroupProps$1, SwitchFieldProps, ValidationResult, TagProps as TagProps$1, TagGroupProps as TagGroupProps$1, TagListProps, TooltipProps as TooltipProps$1, TooltipTriggerComponentProps, ProgressBarProps as ProgressBarProps$1, ToggleButtonProps as ToggleButtonProps$1, ToggleButtonGroupProps as ToggleButtonGroupProps$1, ToolbarProps as ToolbarProps$1, ListBoxProps as ListBoxProps$1, ListBoxItemProps, SelectProps as SelectProps$1, Key, ModalOverlayProps, MenuProps as MenuProps$1, MenuItemProps as MenuItemProps$1, MenuTriggerProps as MenuTriggerProps$1, ComboBoxProps, TabProps as TabProps$1, TabListProps as TabListProps$1, TabPanelProps as TabPanelProps$1, TabsProps as TabsProps$1, PopoverProps as PopoverProps$1, DialogTrigger, PressEvent, LinkProps as LinkProps$1, GridListItemProps, GridListProps, SearchFieldProps as SearchFieldProps$1, DisclosureGroupProps, SliderProps as SliderProps$1, NumberFieldProps as NumberFieldProps$1, CellProps as CellProps$1, ColumnProps as ColumnProps$1, RowProps, TableProps as TableProps$1, TableBodyProps, TableHeaderProps, DateValue, CalendarProps as CalendarProps$1, RangeCalendarProps as RangeCalendarProps$1, DateFieldProps as DateFieldProps$1, TimeFieldProps as TimeFieldProps$1, TimeValue, DatePickerProps as DatePickerProps$1, DateRangePickerProps as DateRangePickerProps$1 } from 'react-aria-components';
|
|
4
|
+
export { DateValue, DialogTrigger, TimeValue } from 'react-aria-components';
|
|
5
|
+
export { CalendarDate, CalendarDateTime, Time, ZonedDateTime, getLocalTimeZone, isToday, isWeekend, now, parseDate, parseDateTime, parseTime, parseZonedDateTime, today } from '@internationalized/date';
|
|
6
|
+
|
|
7
|
+
type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger' | 'text' | 'ghost-danger';
|
|
8
|
+
type ButtonSize = 'sm' | 'md' | 'lg';
|
|
9
|
+
interface ButtonProps extends Omit<ButtonProps$1, 'children' | 'className' | 'style'> {
|
|
10
|
+
/** Visual weight. One primary button per area. */
|
|
11
|
+
variant?: ButtonVariant;
|
|
12
|
+
/** sm 32 px · md 40 px · lg 48 px (touch). */
|
|
13
|
+
size?: ButtonSize;
|
|
14
|
+
/** Icon before the label (decorative, hidden from screen readers). */
|
|
15
|
+
startIcon?: ReactNode;
|
|
16
|
+
/** Icon after the label (decorative, hidden from screen readers). */
|
|
17
|
+
endIcon?: ReactNode;
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
className?: string;
|
|
20
|
+
style?: CSSProperties;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Button – triggers an action. Built on React Aria: consistent press,
|
|
24
|
+
* hover and focus behaviour on mouse, touch, keyboard and screen readers.
|
|
25
|
+
* Use onPress instead of onClick and isDisabled instead of disabled.
|
|
26
|
+
* While saving, set isPending and change the label (“Saving…”): the button keeps its look and size.
|
|
27
|
+
*/
|
|
28
|
+
declare function Button({ variant, size, startIcon, endIcon, className, children, ...props }: ButtonProps): react.JSX.Element;
|
|
29
|
+
interface ButtonGroupProps {
|
|
30
|
+
/** footer: right, primary last · header: right, next to a title · content: left, primary first. */
|
|
31
|
+
context?: 'footer' | 'header' | 'content';
|
|
32
|
+
/** Buttons in reading order (footer: Cancel, Save · content: Get started, Learn more). */
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
/** Footer only: a destructive action, placed on the far left and separated. */
|
|
35
|
+
destructive?: ReactNode;
|
|
36
|
+
/** Name of the group for screen readers, when it is not obvious from the context. */
|
|
37
|
+
'aria-label'?: string;
|
|
38
|
+
className?: string;
|
|
39
|
+
}
|
|
40
|
+
/** Button group – spacing, alignment and mobile stacking for related buttons. */
|
|
41
|
+
declare function ButtonGroup({ context, children, destructive, className, ...props }: ButtonGroupProps): react.JSX.Element;
|
|
42
|
+
|
|
43
|
+
interface IconButtonProps extends Omit<ButtonProps$1, 'children' | 'className' | 'style'> {
|
|
44
|
+
/** Required: describes the action (“Delete file”), because there is no visible label. */
|
|
45
|
+
'aria-label': string;
|
|
46
|
+
icon: ReactNode;
|
|
47
|
+
/**
|
|
48
|
+
* ghost (default for toolbars) · secondary · primary · danger.
|
|
49
|
+
* On images and video: media – round overlay/media fill for busy images ·
|
|
50
|
+
* media-ghost – no fill, on a gradient bar (video controls).
|
|
51
|
+
*/
|
|
52
|
+
variant?: 'ghost' | 'secondary' | 'primary' | 'danger' | 'media' | 'media-ghost';
|
|
53
|
+
/** sm 32 · md 40 · lg 48 px with 16 / 20 / 24 px icons. Media variants: sm 28 with a 44 px hit area. */
|
|
54
|
+
size?: 'sm' | 'md' | 'lg';
|
|
55
|
+
/**
|
|
56
|
+
* Tooltip text. Default: the aria-label, so sighted users see the same name.
|
|
57
|
+
* Pass false to turn it off (e.g. when a visible label is next to the button).
|
|
58
|
+
*/
|
|
59
|
+
tooltip?: ReactNode | false;
|
|
60
|
+
/** Keyboard shortcut in aria-keyshortcuts syntax (e.g. “Control+C”). Exposed to screen readers and shown in the tooltip. */
|
|
61
|
+
shortcut?: string;
|
|
62
|
+
/** Visible form of the shortcut. Default: “Control+C” → “Ctrl C”, “Meta+C” → “⌘ C”. */
|
|
63
|
+
shortcutLabel?: string;
|
|
64
|
+
className?: string;
|
|
65
|
+
style?: CSSProperties;
|
|
66
|
+
}
|
|
67
|
+
/** Square icon-only action. Shares the Button styles. Shows its label as a tooltip. */
|
|
68
|
+
declare function IconButton({ icon, variant, size, tooltip, shortcut, shortcutLabel, className, ...props }: IconButtonProps): react.JSX.Element;
|
|
69
|
+
|
|
70
|
+
type InputSize = 'sm' | 'md' | 'lg';
|
|
71
|
+
interface TextFieldProps extends Omit<TextFieldProps$1, 'children' | 'className' | 'style'> {
|
|
72
|
+
/**
|
|
73
|
+
* Visible label. Always set one – a placeholder is no label. Without it set `aria-label` – only where the
|
|
74
|
+
* context names the field (a table row, a filter bar), like Select and NumberField.
|
|
75
|
+
*/
|
|
76
|
+
label?: ReactNode;
|
|
77
|
+
/** Helper text below the field. Replaced by the error message when invalid. */
|
|
78
|
+
description?: ReactNode;
|
|
79
|
+
/** Error text shown when the field is invalid (isInvalid or failed validation). */
|
|
80
|
+
errorMessage?: ReactNode;
|
|
81
|
+
placeholder?: string;
|
|
82
|
+
/** sm 32 · md 40 · lg 48 px. Use lg on mobile and touch. Textareas: md or lg. */
|
|
83
|
+
size?: InputSize;
|
|
84
|
+
/** Decorative icon before the text (hidden from screen readers). */
|
|
85
|
+
leadingIcon?: ReactNode;
|
|
86
|
+
/** Trailing action, e.g. `<InputAction aria-label="Show password" />`. */
|
|
87
|
+
trailing?: ReactNode;
|
|
88
|
+
/** Multi-line text (Textarea): min 3 rows, grows up to 8 rows. */
|
|
89
|
+
multiline?: boolean;
|
|
90
|
+
/** Soft limit: typing beyond is allowed, the counter turns red. Validate on submit. */
|
|
91
|
+
characterLimit?: number;
|
|
92
|
+
className?: string;
|
|
93
|
+
}
|
|
94
|
+
/** Text input with label, helper and error text (Field + Input / Textarea). */
|
|
95
|
+
declare function TextField({ label, description, errorMessage, placeholder, size, leadingIcon, trailing, multiline, characterLimit, className, onChange, ...props }: TextFieldProps): react.JSX.Element;
|
|
96
|
+
interface InputActionProps extends Omit<ButtonProps$1, 'className' | 'children'> {
|
|
97
|
+
/** Required: icon-only buttons need an accessible name. */
|
|
98
|
+
'aria-label': string;
|
|
99
|
+
icon: ReactNode;
|
|
100
|
+
}
|
|
101
|
+
/** Icon button inside an input, e.g. clear or show password. */
|
|
102
|
+
declare function InputAction({ icon, ...props }: InputActionProps): react.JSX.Element;
|
|
103
|
+
|
|
104
|
+
type ChoiceSize = 'md' | 'lg';
|
|
105
|
+
interface CheckboxProps extends Omit<CheckboxFieldProps, 'children' | 'className' | 'style'> {
|
|
106
|
+
/** Label. Clicking it toggles the checkbox. */
|
|
107
|
+
children?: ReactNode;
|
|
108
|
+
/** Second line below the label. */
|
|
109
|
+
description?: ReactNode;
|
|
110
|
+
/** md (16 px box, 14 px text) · lg (20 px box, 16 px text, mobile). Inherits from a group. */
|
|
111
|
+
size?: ChoiceSize;
|
|
112
|
+
className?: string;
|
|
113
|
+
}
|
|
114
|
+
/** Checkbox – on its own or inside a CheckboxGroup. */
|
|
115
|
+
declare function Checkbox({ children, description, size, className, ...props }: CheckboxProps): react.JSX.Element;
|
|
116
|
+
interface CheckboxGroupProps extends Omit<CheckboxGroupProps$1, 'children' | 'className' | 'style'> {
|
|
117
|
+
/** Group label (rendered like a legend). Without it set `aria-label` – only where the context names the group (e.g. an Accordion title). */
|
|
118
|
+
label?: ReactNode;
|
|
119
|
+
description?: ReactNode;
|
|
120
|
+
errorMessage?: ReactNode;
|
|
121
|
+
size?: ChoiceSize;
|
|
122
|
+
/** vertical (default) or horizontal for 2–3 short options. */
|
|
123
|
+
orientation?: 'vertical' | 'horizontal';
|
|
124
|
+
children: ReactNode;
|
|
125
|
+
className?: string;
|
|
126
|
+
}
|
|
127
|
+
/** Several checkboxes with one label, helper and error text. */
|
|
128
|
+
declare function CheckboxGroup({ label, description, errorMessage, size, orientation, children, className, ...props }: CheckboxGroupProps): react.JSX.Element;
|
|
129
|
+
|
|
130
|
+
interface RadioProps extends Omit<RadioFieldProps, 'children' | 'className' | 'style'> {
|
|
131
|
+
children?: ReactNode;
|
|
132
|
+
description?: ReactNode;
|
|
133
|
+
size?: ChoiceSize;
|
|
134
|
+
className?: string;
|
|
135
|
+
}
|
|
136
|
+
/** One option of a RadioGroup. */
|
|
137
|
+
declare function Radio({ children, description, size, className, ...props }: RadioProps): react.JSX.Element;
|
|
138
|
+
interface RadioGroupProps extends Omit<RadioGroupProps$1, 'children' | 'className' | 'style'> {
|
|
139
|
+
/** Group label (rendered like a legend). Without it set `aria-label` – only where the context names the group (e.g. an Accordion title). */
|
|
140
|
+
label?: ReactNode;
|
|
141
|
+
description?: ReactNode;
|
|
142
|
+
errorMessage?: ReactNode;
|
|
143
|
+
size?: ChoiceSize;
|
|
144
|
+
children: ReactNode;
|
|
145
|
+
className?: string;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Pick exactly one of 2–4 visible options (5 or more: use a Select).
|
|
149
|
+
* Arrow keys move and select; a choice cannot be removed again.
|
|
150
|
+
*/
|
|
151
|
+
declare function RadioGroup({ label, description, errorMessage, size, children, className, ...props }: RadioGroupProps): react.JSX.Element;
|
|
152
|
+
|
|
153
|
+
interface SwitchProps extends Omit<SwitchFieldProps, 'children' | 'className' | 'style'> {
|
|
154
|
+
/** Label. Describes the setting, never the state (“Notifications”, not “On”). */
|
|
155
|
+
children: ReactNode;
|
|
156
|
+
description?: ReactNode;
|
|
157
|
+
/** md (36 × 20) · lg (44 × 24, mobile). */
|
|
158
|
+
size?: 'md' | 'lg';
|
|
159
|
+
/** start: label first, switch at the end (settings lists). end: switch first (forms). */
|
|
160
|
+
labelPosition?: 'start' | 'end';
|
|
161
|
+
/** While the change is being saved. The switch cannot be toggled meanwhile. */
|
|
162
|
+
isLoading?: boolean;
|
|
163
|
+
className?: string;
|
|
164
|
+
}
|
|
165
|
+
/** Switch – on / off with immediate effect. */
|
|
166
|
+
declare function Switch({ children, description, size, labelPosition, isLoading, isReadOnly, className, ...props }: SwitchProps): react.JSX.Element;
|
|
167
|
+
|
|
168
|
+
/** Label with the visual required marker. The field itself is announced as required. */
|
|
169
|
+
declare function FieldLabel({ children, isRequired }: {
|
|
170
|
+
children: ReactNode;
|
|
171
|
+
isRequired?: boolean;
|
|
172
|
+
}): react.JSX.Element;
|
|
173
|
+
/** Helper text and error message. The error replaces the helper text when the field is invalid. */
|
|
174
|
+
declare function FieldFooter({ description, errorMessage, children, }: {
|
|
175
|
+
description?: ReactNode;
|
|
176
|
+
/** A function gets the validation details (rangeUnderflow, badInput …) to name the rule. */
|
|
177
|
+
errorMessage?: ReactNode | ((validation: ValidationResult) => ReactNode);
|
|
178
|
+
children?: ReactNode;
|
|
179
|
+
}): react.JSX.Element;
|
|
180
|
+
|
|
181
|
+
type BadgeTone = 'neutral' | 'brand' | 'success' | 'warning' | 'danger' | 'info';
|
|
182
|
+
interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
183
|
+
/** Meaning: success, warning, danger, info. Brand for “New”, neutral for everything else. */
|
|
184
|
+
tone?: BadgeTone;
|
|
185
|
+
/** sm 20 px · md 24 px. */
|
|
186
|
+
size?: 'sm' | 'md';
|
|
187
|
+
/** Leading dot in the text colour, so the status does not rely on colour alone. */
|
|
188
|
+
dot?: boolean;
|
|
189
|
+
/** Leading icon (12 px, decorative). Ignored when `dot` is set. */
|
|
190
|
+
icon?: ReactNode;
|
|
191
|
+
/** 1–2 words, sentence case. */
|
|
192
|
+
children: ReactNode;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Badge – short, non-interactive status label.
|
|
196
|
+
* Plain text: never clickable. For a badge that changes live, pass role="status".
|
|
197
|
+
*/
|
|
198
|
+
declare function Badge({ tone, size, dot, icon, className, children, ...props }: BadgeProps): react.JSX.Element;
|
|
199
|
+
interface BadgeCountProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
|
|
200
|
+
count: number;
|
|
201
|
+
/** Above this number the badge shows “99+”. */
|
|
202
|
+
max?: number;
|
|
203
|
+
tone?: 'danger' | 'brand' | 'neutral';
|
|
204
|
+
/** sm 16 px · md 20 px. */
|
|
205
|
+
size?: 'sm' | 'md';
|
|
206
|
+
/**
|
|
207
|
+
* Text for screen readers, e.g. “3 unread messages”.
|
|
208
|
+
* Without it the number is hidden: then the parent names it (“Notifications, 3 unread”).
|
|
209
|
+
*/
|
|
210
|
+
label?: string;
|
|
211
|
+
}
|
|
212
|
+
/** Count for notifications. Hidden at 0. */
|
|
213
|
+
declare function BadgeCount({ count, max, tone, size, label, className, ...props }: BadgeCountProps): react.JSX.Element | null;
|
|
214
|
+
interface BadgeDotProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
|
|
215
|
+
tone?: BadgeTone;
|
|
216
|
+
/** Text for screen readers (“Unread”, “Online”). Without it the dot is decorative. */
|
|
217
|
+
label?: string;
|
|
218
|
+
}
|
|
219
|
+
/** Dot for unread or presence. Always pair it with text or a label. */
|
|
220
|
+
declare function BadgeDot({ tone, label, className, ...props }: BadgeDotProps): react.JSX.Element;
|
|
221
|
+
|
|
222
|
+
type TagSize = 'sm' | 'md';
|
|
223
|
+
interface TagGroupProps<T> extends Omit<TagGroupProps$1, 'children' | 'className' | 'style'> {
|
|
224
|
+
/** Visible label. Without it, set aria-label. */
|
|
225
|
+
label?: ReactNode;
|
|
226
|
+
/** Helper text below the tags. */
|
|
227
|
+
description?: ReactNode;
|
|
228
|
+
/** sm 24 px · md 32 px. Follows the field size (Select sm/md → sm, lg/mobile → md). */
|
|
229
|
+
size?: TagSize;
|
|
230
|
+
/** Tags, or a render function together with `items`. */
|
|
231
|
+
children: TagListProps<T>['children'];
|
|
232
|
+
items?: Iterable<T>;
|
|
233
|
+
/** Shown when there are no tags. */
|
|
234
|
+
renderEmptyState?: () => ReactNode;
|
|
235
|
+
/** Text announced after a removal. Default: “{label} removed”. */
|
|
236
|
+
removedMessage?: (labels: string[]) => string;
|
|
237
|
+
className?: string;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Tag group – a labelled list of tags. Built on React Aria TagGroup:
|
|
241
|
+
* arrow keys move between tags, Backspace/Delete removes, Space/Enter toggles a filter.
|
|
242
|
+
*
|
|
243
|
+
* Two roles, never mixed in one group:
|
|
244
|
+
* - removable values: pass `onRemove`
|
|
245
|
+
* - filters: pass `selectionMode="multiple"` (or "single"). Click again to deselect.
|
|
246
|
+
*/
|
|
247
|
+
declare function TagGroup<T extends object>({ label, description, size, children, items, renderEmptyState, onRemove, removedMessage: removedMessageProp, className, ...props }: TagGroupProps<T>): react.JSX.Element;
|
|
248
|
+
interface TagProps extends Omit<TagProps$1, 'children' | 'className'> {
|
|
249
|
+
/** Short label; long text is truncated at 200 px. */
|
|
250
|
+
children: ReactNode;
|
|
251
|
+
/** Leading icon (decorative). A selected filter shows a check instead. */
|
|
252
|
+
icon?: ReactNode;
|
|
253
|
+
className?: string;
|
|
254
|
+
}
|
|
255
|
+
/** A single tag inside a TagGroup. */
|
|
256
|
+
declare function Tag({ children, icon, textValue, className, ...props }: TagProps): react.JSX.Element;
|
|
257
|
+
|
|
258
|
+
type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
259
|
+
type AvatarStatus = 'online' | 'away' | 'busy' | 'offline';
|
|
260
|
+
/** First letters of first and last name; one word: first two letters. */
|
|
261
|
+
declare function initialsOf(name: string): string;
|
|
262
|
+
interface AvatarProps {
|
|
263
|
+
/** Person or organization name. Used for alt text, initials and (without `colorKey`) the tone. */
|
|
264
|
+
name?: string;
|
|
265
|
+
/** Photo URL. Falls back to initials if it is missing or fails to load. */
|
|
266
|
+
src?: string;
|
|
267
|
+
/** xs 20 · sm 24 · md 32 · lg 40 · xl 56 · 2xl 80 px. */
|
|
268
|
+
size?: AvatarSize;
|
|
269
|
+
/** circle = person · square = organization, team, workspace. */
|
|
270
|
+
shape?: 'circle' | 'square';
|
|
271
|
+
/** Stable id (user id) for the initials colour, so it survives name changes. */
|
|
272
|
+
colorKey?: string;
|
|
273
|
+
/** Presence dot. Also added to the accessible name (“Lea M., online”). */
|
|
274
|
+
status?: AvatarStatus;
|
|
275
|
+
/** Words for the status in the accessible name. */
|
|
276
|
+
statusLabels?: Partial<Record<AvatarStatus, string>>;
|
|
277
|
+
/** Next to a visible name the avatar is decorative and hidden from screen readers. */
|
|
278
|
+
decorative?: boolean;
|
|
279
|
+
/** Accessible name when the name is unknown (guest, deleted account). */
|
|
280
|
+
unknownLabel?: string;
|
|
281
|
+
className?: string;
|
|
282
|
+
style?: CSSProperties;
|
|
283
|
+
}
|
|
284
|
+
/** Avatar – picture of a person or organization with fallback image → initials → icon. */
|
|
285
|
+
declare function Avatar({ name, src, size, shape, colorKey, status, statusLabels, decorative, unknownLabel, className, style, }: AvatarProps): react.JSX.Element;
|
|
286
|
+
interface AvatarGroupProps {
|
|
287
|
+
/** Avatars, most relevant first (owner, you). */
|
|
288
|
+
children: ReactNode;
|
|
289
|
+
/** Visible avatars before “+N”. */
|
|
290
|
+
max?: number;
|
|
291
|
+
/** xs · sm · md · lg. */
|
|
292
|
+
size?: Exclude<AvatarSize, 'xl' | '2xl'>;
|
|
293
|
+
/** Name of the group, e.g. “Assignees”. */
|
|
294
|
+
'aria-label': string;
|
|
295
|
+
/** Opens the full list (e.g. a popover). Without it “+N” is plain text. */
|
|
296
|
+
onMorePress?: () => void;
|
|
297
|
+
/** Accessible name of “+N”. Default: “N more”. */
|
|
298
|
+
moreLabel?: (count: number) => string;
|
|
299
|
+
className?: string;
|
|
300
|
+
}
|
|
301
|
+
/** Overlapping avatars, max 4 + “+N”. */
|
|
302
|
+
declare function AvatarGroup({ children, max, size, onMorePress, moreLabel: moreLabelProp, className, ...props }: AvatarGroupProps): react.JSX.Element;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Wraps a focusable trigger (e.g. Button, IconButton) and its Tooltip.
|
|
306
|
+
* Timing: 500 ms delay on hover, 100 ms close delay, instant on keyboard focus.
|
|
307
|
+
* React Aria handles warm-up between neighbours, Escape and touch (no tooltip on touch).
|
|
308
|
+
*/
|
|
309
|
+
declare function TooltipTrigger({ delay, closeDelay, ...props }: TooltipTriggerComponentProps): react.JSX.Element;
|
|
310
|
+
interface TooltipProps extends Omit<TooltipProps$1, 'children' | 'className'> {
|
|
311
|
+
/** A few words, at most one sentence. No links or buttons. */
|
|
312
|
+
children: ReactNode;
|
|
313
|
+
/** Keyboard shortcut, shown dimmed after the text (e.g. “⌘C”). */
|
|
314
|
+
shortcut?: string;
|
|
315
|
+
className?: string;
|
|
316
|
+
}
|
|
317
|
+
/** Tooltip – short label on hover or focus. Top, 8 px offset, flips if needed. */
|
|
318
|
+
declare function Tooltip({ children, shortcut, placement, offset, className, ...props }: TooltipProps): react.JSX.Element;
|
|
319
|
+
|
|
320
|
+
interface SpinnerProps {
|
|
321
|
+
/** sm 16 · md 20 · lg 24 · xl 40 px. */
|
|
322
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
323
|
+
/** current = text colour of the parent (default, fits every button) · brand · neutral · on-brand. */
|
|
324
|
+
tone?: 'current' | 'brand' | 'neutral' | 'on-brand';
|
|
325
|
+
/** Name for screen readers. */
|
|
326
|
+
'aria-label'?: string;
|
|
327
|
+
/** Inside a control that already says what happens (“Saving…”): hide the spinner from screen readers. */
|
|
328
|
+
decorative?: boolean;
|
|
329
|
+
className?: string;
|
|
330
|
+
style?: CSSProperties;
|
|
331
|
+
}
|
|
332
|
+
/** Spinner – short wait of unknown length. */
|
|
333
|
+
declare function Spinner({ size, tone, decorative, className, style, ...props }: SpinnerProps): react.JSX.Element;
|
|
334
|
+
interface ProgressBarProps extends Omit<ProgressBarProps$1, 'children' | 'className' | 'style'> {
|
|
335
|
+
/** Visible label (“Uploading 3 files”). Without it, set aria-label. */
|
|
336
|
+
label?: ReactNode;
|
|
337
|
+
/** Helper below the bar: files, time left, or what to do after an error. */
|
|
338
|
+
description?: ReactNode;
|
|
339
|
+
/** md 8 px in content · sm 4 px in dense rows (file list). */
|
|
340
|
+
size?: 'sm' | 'md';
|
|
341
|
+
/** success when done, error when it failed. Announced politely. */
|
|
342
|
+
status?: 'default' | 'success' | 'error';
|
|
343
|
+
/** Show the value (“64 %”) next to the label. Hidden when indeterminate. */
|
|
344
|
+
showValue?: boolean;
|
|
345
|
+
className?: string;
|
|
346
|
+
style?: CSSProperties;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Progress bar – measurable or long work. Built on React Aria ProgressBar:
|
|
350
|
+
* role progressbar with value and value text. Use `valueLabel` for words (“64 %, 2 of 3 files”).
|
|
351
|
+
*/
|
|
352
|
+
declare function ProgressBar({ label, description, size, status, showValue, className, style, ...props }: ProgressBarProps): react.JSX.Element;
|
|
353
|
+
interface SkeletonProps {
|
|
354
|
+
/** text: 12 px line · circle: avatar · rect: image or card. */
|
|
355
|
+
shape?: 'text' | 'circle' | 'rect';
|
|
356
|
+
/** Number of text lines; the last one is shorter. */
|
|
357
|
+
lines?: number;
|
|
358
|
+
/** Any CSS length, e.g. "60%", 160. Match the real content. */
|
|
359
|
+
width?: CSSProperties['inlineSize'];
|
|
360
|
+
height?: CSSProperties['blockSize'];
|
|
361
|
+
className?: string;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Skeleton – placeholder in the shape of the content.
|
|
365
|
+
* Hidden from screen readers; mark the loading region with aria-busy="true".
|
|
366
|
+
*/
|
|
367
|
+
declare function Skeleton({ shape, lines, width, height, className }: SkeletonProps): react.JSX.Element;
|
|
368
|
+
|
|
369
|
+
type ToggleSize = 'sm' | 'md' | 'lg';
|
|
370
|
+
interface ToggleButtonProps extends Omit<ToggleButtonProps$1, 'children' | 'className' | 'style'> {
|
|
371
|
+
/** Visible label. It never changes with the state (“Bold” stays “Bold”). Leave out for icon only. */
|
|
372
|
+
children?: ReactNode;
|
|
373
|
+
/** Leading icon; alone it makes an icon-only toggle (then aria-label is required). */
|
|
374
|
+
icon?: ReactNode;
|
|
375
|
+
/** sm 32 · md 40 · lg 48 px, like Button. Inside a group the group sets it. */
|
|
376
|
+
size?: ToggleSize;
|
|
377
|
+
/** Icon only: tooltip text. Default: the aria-label. false turns it off. */
|
|
378
|
+
tooltip?: ReactNode | false;
|
|
379
|
+
/** Keyboard shortcut in aria-keyshortcuts syntax (e.g. “Control+B”), shown in the tooltip. */
|
|
380
|
+
shortcut?: string;
|
|
381
|
+
className?: string;
|
|
382
|
+
style?: CSSProperties;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Toggle Button – a button that stays pressed.
|
|
386
|
+
* Built on React Aria ToggleButton: announced as pressed / not pressed (aria-pressed).
|
|
387
|
+
* For an immediate, local effect (bold, mute, favourite). Saved settings use Switch, navigation uses Tabs.
|
|
388
|
+
*/
|
|
389
|
+
declare function ToggleButton({ children, icon, size, tooltip, shortcut, className, ...props }: ToggleButtonProps): react.JSX.Element;
|
|
390
|
+
interface ToggleButtonGroupProps extends Omit<ToggleButtonGroupProps$1, 'children' | 'className' | 'style'> {
|
|
391
|
+
/**
|
|
392
|
+
* segmented: switch between 2–5 views, exactly one on, shared container.
|
|
393
|
+
* toolbar: formatting options, any combination (or selectionMode="single", e.g. text alignment), no container.
|
|
394
|
+
*/
|
|
395
|
+
variant?: 'segmented' | 'toolbar';
|
|
396
|
+
/** Height of the group: md 40 · lg 48 (segmented items are one size smaller). */
|
|
397
|
+
size?: 'md' | 'lg';
|
|
398
|
+
/** Segmented only: full width, items share the space (mobile). */
|
|
399
|
+
fullWidth?: boolean;
|
|
400
|
+
/** Required when there is no visible label: names the group (“View”). */
|
|
401
|
+
'aria-label'?: string;
|
|
402
|
+
children: ReactNode;
|
|
403
|
+
className?: string;
|
|
404
|
+
style?: CSSProperties;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Toggle button group. Built on React Aria ToggleButtonGroup:
|
|
408
|
+
* Tab enters once on the selected item, arrow keys move between items.
|
|
409
|
+
*/
|
|
410
|
+
declare function ToggleButtonGroup({ variant, size, fullWidth, selectionMode, disallowEmptySelection, children, className, ...props }: ToggleButtonGroupProps): react.JSX.Element;
|
|
411
|
+
interface ToolbarProps extends Omit<ToolbarProps$1, 'className' | 'style'> {
|
|
412
|
+
/** Required: names the toolbar (“Text formatting”). */
|
|
413
|
+
'aria-label': string;
|
|
414
|
+
className?: string;
|
|
415
|
+
style?: CSSProperties;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Toolbar – several toggle groups (and buttons) in one row.
|
|
419
|
+
* Built on React Aria Toolbar: one Tab stop for the whole toolbar, arrow keys move across all groups.
|
|
420
|
+
*/
|
|
421
|
+
declare function Toolbar({ className, ...props }: ToolbarProps): react.JSX.Element;
|
|
422
|
+
/** Divider between groups in a Toolbar (1 px border/default, 24 px high). */
|
|
423
|
+
declare function ToolbarSeparator(): react.JSX.Element;
|
|
424
|
+
|
|
425
|
+
type ListBoxSize = 'md' | 'lg';
|
|
426
|
+
interface ListBoxProps<T> extends Omit<ListBoxProps$1<T>, 'className' | 'style'> {
|
|
427
|
+
/** md on desktop · lg on mobile and in the Bottom Sheet. */
|
|
428
|
+
size?: ListBoxSize;
|
|
429
|
+
className?: string;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Listbox – the list behind Select, Combobox and Bottom Sheet.
|
|
433
|
+
* Built on React Aria ListBox: arrow keys, type-ahead, Home/End; sections and separators.
|
|
434
|
+
*/
|
|
435
|
+
declare function ListBox<T extends object>({ size, className, ...props }: ListBoxProps<T>): react.JSX.Element;
|
|
436
|
+
interface OptionProps extends Omit<ListBoxItemProps, 'children' | 'className' | 'style'> {
|
|
437
|
+
/** Label. Long labels wrap; keep them short and put details into the description. */
|
|
438
|
+
children: ReactNode;
|
|
439
|
+
/** Second line in text/secondary. */
|
|
440
|
+
description?: ReactNode;
|
|
441
|
+
/** Decorative leading icon. */
|
|
442
|
+
icon?: ReactNode;
|
|
443
|
+
}
|
|
444
|
+
/** Option – one row in a Listbox. Single: check on the right. Multi: checkbox on the left. */
|
|
445
|
+
declare function Option({ children, description, icon, textValue, ...props }: OptionProps): react.JSX.Element;
|
|
446
|
+
interface ListBoxSectionProps<T> {
|
|
447
|
+
/** Group heading (overline). Use headings only with two or more groups. Without a title, set aria-label. */
|
|
448
|
+
title?: ReactNode;
|
|
449
|
+
'aria-label'?: string;
|
|
450
|
+
children: ReactNode | ((item: T) => ReactNode);
|
|
451
|
+
items?: Iterable<T>;
|
|
452
|
+
id?: string;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* A group of options with a heading (announced as the name of the group).
|
|
456
|
+
* Groups are divided by a line automatically (a separator element is not allowed inside a listbox).
|
|
457
|
+
*/
|
|
458
|
+
declare function ListBoxSection<T extends object>({ title, children, items, id, ...props }: ListBoxSectionProps<T>): react.JSX.Element;
|
|
459
|
+
/** Message row for empty and loading states – never an empty popup. Announced as status. */
|
|
460
|
+
declare function ListBoxMessage({ children }: {
|
|
461
|
+
children: ReactNode;
|
|
462
|
+
}): react.JSX.Element;
|
|
463
|
+
|
|
464
|
+
type SelectMode = 'single' | 'multiple';
|
|
465
|
+
type ValueOf<M extends SelectMode> = M extends 'multiple' ? Key[] : Key | null;
|
|
466
|
+
/** Where the options open. auto: popover on desktop; below 640 px native picker (single) or Bottom Sheet (multi). */
|
|
467
|
+
type SelectOverlay = 'auto' | 'popover' | 'sheet' | 'native';
|
|
468
|
+
interface SelectProps<T extends object, M extends SelectMode = 'single'> extends Omit<SelectProps$1<T, M>, 'children' | 'className' | 'style' | 'placeholder'> {
|
|
469
|
+
/** Visible label. Without it set `aria-label` – only where the context names the field (filter bars, toolbars). */
|
|
470
|
+
label?: ReactNode;
|
|
471
|
+
/** Helper text below the field. Replaced by the error message when invalid. */
|
|
472
|
+
description?: ReactNode;
|
|
473
|
+
/** Error text shown when the field is invalid. Validate on submit or blur, not while open. */
|
|
474
|
+
errorMessage?: ReactNode;
|
|
475
|
+
/** A hint like “Select…”. Never required information. */
|
|
476
|
+
placeholder?: string;
|
|
477
|
+
/** sm 32 · md 40 · lg 48 px. lg on mobile (opens the lg list). */
|
|
478
|
+
size?: InputSize;
|
|
479
|
+
/** Decorative icon before the value. */
|
|
480
|
+
leadingIcon?: ReactNode;
|
|
481
|
+
/** Single only: shows a clear button for optional fields. Multi always has clear-all. */
|
|
482
|
+
clearable?: boolean;
|
|
483
|
+
/** Value can be read and copied but not changed. Not the same as disabled. */
|
|
484
|
+
isReadOnly?: boolean;
|
|
485
|
+
/** Options as data; then pass a render function as children. */
|
|
486
|
+
items?: Iterable<T>;
|
|
487
|
+
/** Option and ListBoxSection elements, or a render function with items. */
|
|
488
|
+
children: ReactNode | ((item: T) => ReactNode);
|
|
489
|
+
/** auto (default) · popover · sheet (Bottom Sheet) · native (system picker, single only). */
|
|
490
|
+
overlay?: SelectOverlay;
|
|
491
|
+
/**
|
|
492
|
+
* Multi: what happens with the selection. live (forms): it is the value, nothing else happens.
|
|
493
|
+
* onClose (filters, reloads): `onApply` runs once when the list closes – any way – and only if the selection changed.
|
|
494
|
+
*/
|
|
495
|
+
commit?: 'live' | 'onClose';
|
|
496
|
+
/** commit="onClose": apply the selection (load results, write the URL …). */
|
|
497
|
+
onApply?: (value: ValueOf<M>) => void;
|
|
498
|
+
/** commit="onClose": label of the primary sheet button, ideally with the live result count (“Show 128 results”). */
|
|
499
|
+
resultLabel?: (value: ValueOf<M>) => ReactNode;
|
|
500
|
+
className?: string;
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Select – choose one or several values from a list.
|
|
504
|
+
* Built on React Aria Select with a hidden native select: forms, autofill and validation keep working.
|
|
505
|
+
* 2–4 options: Radio. 5–10: Select. More, or users know what to type: Combobox.
|
|
506
|
+
*/
|
|
507
|
+
declare function Select<T extends object, M extends SelectMode = 'single'>({ label, description, errorMessage, placeholder: placeholderProp, size, leadingIcon, clearable, isReadOnly, items, children, overlay, commit, onApply, resultLabel: resultLabelProp, className, selectionMode, ...props }: SelectProps<T, M>): react.JSX.Element;
|
|
508
|
+
|
|
509
|
+
interface BottomSheetProps extends Omit<ModalOverlayProps, 'children' | 'className' | 'style'> {
|
|
510
|
+
/** Required: names the dialog (for a Select sheet: the field label). */
|
|
511
|
+
title: ReactNode;
|
|
512
|
+
/** Content; scrolls when taller than the sheet. */
|
|
513
|
+
children: ReactNode;
|
|
514
|
+
/** Sticky footer, e.g. a full-width primary action. A function gets `close`. */
|
|
515
|
+
footer?: ReactNode | ((close: () => void) => ReactNode);
|
|
516
|
+
/** content: height of the content, max 90 % · full: fixed 90 % (with search, so it does not jump). */
|
|
517
|
+
height?: 'content' | 'full';
|
|
518
|
+
/** Accessible name of the close button. */
|
|
519
|
+
closeLabel?: string;
|
|
520
|
+
/** Shows a back button before the title (second view, e.g. a submenu). */
|
|
521
|
+
onBack?: () => void;
|
|
522
|
+
/** Accessible name of the back button. */
|
|
523
|
+
backLabel?: string;
|
|
524
|
+
className?: string;
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Bottom Sheet – a modal layer from the bottom on small screens.
|
|
528
|
+
* Built on React Aria ModalOverlay + Modal + Dialog: focus stays inside and returns to the trigger,
|
|
529
|
+
* page scroll is locked, Esc and a tap on the scrim close it. Swipe down on the handle or header closes it,
|
|
530
|
+
* the close button is the non-drag alternative (WCAG 2.5.7). Use inside a DialogTrigger or with isOpen.
|
|
531
|
+
*/
|
|
532
|
+
declare function BottomSheet({ title, children, footer, height, closeLabel, onBack, backLabel, isDismissable, className, ...props }: BottomSheetProps): react.JSX.Element;
|
|
533
|
+
|
|
534
|
+
interface MenuTriggerProps extends Omit<MenuTriggerProps$1, 'children'> {
|
|
535
|
+
/** The trigger (default: an ellipsis Icon Button) and the Menu. Without a trigger, pass `label`. */
|
|
536
|
+
children: ReactNode;
|
|
537
|
+
}
|
|
538
|
+
/** Opens a Menu from a trigger (React Aria MenuTrigger). Focus returns to the trigger. */
|
|
539
|
+
declare function MenuTrigger(props: MenuTriggerProps): react.JSX.Element;
|
|
540
|
+
/**
|
|
541
|
+
* Default trigger: ghost Icon Button with an ellipsis. The name includes the object
|
|
542
|
+
* (“More actions for Q3-Report.pdf”); it looks pressed while the menu is open.
|
|
543
|
+
*/
|
|
544
|
+
declare function MenuButton({ 'aria-label': label, size }: {
|
|
545
|
+
'aria-label': string;
|
|
546
|
+
size?: 'sm' | 'md' | 'lg';
|
|
547
|
+
}): react.JSX.Element;
|
|
548
|
+
interface MenuProps<T> extends Omit<MenuProps$1<T>, 'className' | 'style'> {
|
|
549
|
+
/** Mobile sheet title: the object the actions apply to (“Q3-Report.pdf”). */
|
|
550
|
+
title?: ReactNode;
|
|
551
|
+
/** auto: popover on desktop, Bottom Sheet below 640 px · popover · sheet. */
|
|
552
|
+
overlay?: 'auto' | 'popover' | 'sheet';
|
|
553
|
+
className?: string;
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Menu – a list of actions. Built on React Aria Menu: arrow keys, Enter runs the item,
|
|
557
|
+
* Esc closes, type to jump, Home/End. Every item has an icon, labels start with a verb; danger items last.
|
|
558
|
+
* Not for values (Select) or site navigation (disclosure pattern).
|
|
559
|
+
*/
|
|
560
|
+
declare function Menu<T extends object>({ title, overlay, className, ...props }: MenuProps<T>): react.JSX.Element;
|
|
561
|
+
interface MenuItemProps extends Omit<MenuItemProps$1, 'children' | 'className' | 'style'> {
|
|
562
|
+
/** Label, starting with a verb (“Duplicate”). “…” only when a dialog or second step follows. */
|
|
563
|
+
children: string;
|
|
564
|
+
/** Required: shows the action. Decorative for screen readers – the label carries the meaning. */
|
|
565
|
+
icon: ReactNode;
|
|
566
|
+
/** Keyboard shortcut in aria-keyshortcuts syntax; “Mod” = ⌘ on Apple, Ctrl elsewhere. Desktop only. It must also work without the menu. */
|
|
567
|
+
shortcut?: string;
|
|
568
|
+
/** Destructive action: red, last in its own group. Irreversible actions open a confirmation dialog. */
|
|
569
|
+
variant?: 'default' | 'danger';
|
|
570
|
+
}
|
|
571
|
+
/** One action in a Menu. */
|
|
572
|
+
declare function MenuItem({ children, icon, shortcut, variant, textValue, ...props }: MenuItemProps): react.JSX.Element;
|
|
573
|
+
interface SubmenuProps {
|
|
574
|
+
/** Label of the parent item. */
|
|
575
|
+
label: string;
|
|
576
|
+
icon: ReactNode;
|
|
577
|
+
/** The submenu's items (one level only). */
|
|
578
|
+
children: ReactNode;
|
|
579
|
+
isDisabled?: boolean;
|
|
580
|
+
}
|
|
581
|
+
/** Submenu (one level). Desktop: opens to the side. Mobile: second view in the sheet with a back button. */
|
|
582
|
+
declare function Submenu({ label, icon, children, isDisabled }: SubmenuProps): react.JSX.Element;
|
|
583
|
+
interface MenuSectionProps {
|
|
584
|
+
/** Optional overline heading. Without a title the group is only divided by a line; then set aria-label if it helps. */
|
|
585
|
+
title?: ReactNode;
|
|
586
|
+
'aria-label'?: string;
|
|
587
|
+
children: ReactNode;
|
|
588
|
+
}
|
|
589
|
+
/** A group of related actions. Groups are divided by a line; the danger group comes last. */
|
|
590
|
+
declare function MenuSection({ title, children, ...props }: MenuSectionProps): react.JSX.Element;
|
|
591
|
+
|
|
592
|
+
interface DialogAction {
|
|
593
|
+
/** Verb that says what happens (“Send invite”, “Delete”). Never “OK”, “Yes” or “Confirm”. */
|
|
594
|
+
label: string;
|
|
595
|
+
/**
|
|
596
|
+
* Runs on press, then the dialog closes. Return a promise to show the pending state until it
|
|
597
|
+
* resolves; when it rejects, the dialog stays open (show the error inside the dialog).
|
|
598
|
+
*/
|
|
599
|
+
onAction?: () => void | Promise<unknown>;
|
|
600
|
+
/** Id of a form in the dialog: the button submits it. The form's onSubmit saves and calls `close`. */
|
|
601
|
+
form?: string;
|
|
602
|
+
/** Dialog only: danger for a destructive main action. */
|
|
603
|
+
variant?: 'primary' | 'danger';
|
|
604
|
+
isDisabled?: boolean;
|
|
605
|
+
/** Controlled pending state (e.g. while a submitted form saves). */
|
|
606
|
+
isPending?: boolean;
|
|
607
|
+
}
|
|
608
|
+
interface OpenProps {
|
|
609
|
+
/** Controlled open state. Inside a DialogTrigger the trigger controls it. */
|
|
610
|
+
isOpen?: boolean;
|
|
611
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
612
|
+
}
|
|
613
|
+
interface DirtyGuardProps extends OpenProps {
|
|
614
|
+
isDirty?: boolean;
|
|
615
|
+
discardText?: Partial<DialogDiscardText>;
|
|
616
|
+
}
|
|
617
|
+
interface DialogDiscardText {
|
|
618
|
+
title: string;
|
|
619
|
+
description: string;
|
|
620
|
+
actionLabel: string;
|
|
621
|
+
cancelLabel: string;
|
|
622
|
+
}
|
|
623
|
+
interface DialogProps extends OpenProps {
|
|
624
|
+
/** Required. Names the task (“Invite member”). Screen readers announce it when the dialog opens. */
|
|
625
|
+
title: ReactNode;
|
|
626
|
+
/** One or two sentences under the title. */
|
|
627
|
+
description?: ReactNode;
|
|
628
|
+
/** Content or form. A function gets `close`: closes without asking – call it after saving (X, Cancel and Esc still ask when isDirty). */
|
|
629
|
+
children?: ReactNode | ((close: () => void) => ReactNode);
|
|
630
|
+
/** sm 400 (one or two fields) · md 560 · lg 720 (tables, two-column forms). */
|
|
631
|
+
size?: 'sm' | 'md' | 'lg';
|
|
632
|
+
/** Main action at the end of the footer, next to Cancel. On mobile fullscreen it moves to the header. Without it, no footer. */
|
|
633
|
+
primaryAction?: DialogAction;
|
|
634
|
+
cancelLabel?: string;
|
|
635
|
+
/** Accessible name of the X (and the label of the mobile close button without a main action). */
|
|
636
|
+
closeLabel?: string;
|
|
637
|
+
/** Shows the X in the header. */
|
|
638
|
+
showClose?: boolean;
|
|
639
|
+
/**
|
|
640
|
+
* Unsaved input. While true, a click on the scrim no longer closes, and X, Esc and Cancel
|
|
641
|
+
* first ask “Discard changes?” (Alert dialog).
|
|
642
|
+
*/
|
|
643
|
+
isDirty?: boolean;
|
|
644
|
+
/** Text of the “Discard changes?” Alert dialog. */
|
|
645
|
+
discardText?: Partial<DialogDiscardText>;
|
|
646
|
+
/** auto: dialog on desktop, `mobile` below 640 px · dialog · fullscreen · sheet. */
|
|
647
|
+
overlay?: 'auto' | 'dialog' | 'fullscreen' | 'sheet';
|
|
648
|
+
/** Pattern below 640 px: fullscreen for forms (keyboard needs space), sheet for short content. */
|
|
649
|
+
mobile?: 'fullscreen' | 'sheet';
|
|
650
|
+
className?: string;
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Dialog – a modal window for a focused task. Built on React Aria ModalOverlay,
|
|
654
|
+
* Modal and Dialog: role dialog with aria-modal, the title names it, focus starts in the first field,
|
|
655
|
+
* stays inside and returns to the trigger; the page behind does not scroll. Use inside a DialogTrigger or with isOpen.
|
|
656
|
+
*/
|
|
657
|
+
declare function Dialog({ title, description, children, size, primaryAction, cancelLabel: cancelLabelProp, closeLabel: closeLabelProp, showClose, isDirty, discardText, overlay, mobile, className, ...openProps }: DialogProps): react.JSX.Element;
|
|
658
|
+
type AlertDialogTone = 'danger' | 'warning' | 'info';
|
|
659
|
+
interface AlertDialogProps extends OpenProps {
|
|
660
|
+
/** danger: irreversible or destructive · warning: risk of data loss · info: must be acknowledged. */
|
|
661
|
+
tone?: AlertDialogTone;
|
|
662
|
+
/** Required. A question (“Delete Q3-Report.pdf?”). */
|
|
663
|
+
title: ReactNode;
|
|
664
|
+
/** The consequence (“This cannot be undone.”). */
|
|
665
|
+
children?: ReactNode;
|
|
666
|
+
/** Verb of the action (“Delete”). Danger tone: danger button, else primary. */
|
|
667
|
+
actionLabel: string;
|
|
668
|
+
/** Runs, then the dialog closes. A promise shows the pending state until it resolves. */
|
|
669
|
+
onAction?: () => void | Promise<unknown>;
|
|
670
|
+
cancelLabel?: string;
|
|
671
|
+
className?: string;
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* Alert dialog – a decision that needs an answer before the user can go on.
|
|
675
|
+
* role alertdialog, no X, a click on the scrim never closes, Esc = Cancel. Focus starts on Cancel,
|
|
676
|
+
* so an accidental Enter never deletes. Below 640 px: icon on top, buttons stacked (lg).
|
|
677
|
+
*/
|
|
678
|
+
declare function AlertDialog({ tone, title, children, actionLabel, onAction, cancelLabel: cancelLabelProp, className, ...openProps }: AlertDialogProps): react.JSX.Element;
|
|
679
|
+
|
|
680
|
+
type ComboMode = 'single' | 'multiple';
|
|
681
|
+
interface ComboboxProps<T extends object, M extends ComboMode = 'single'> extends Omit<ComboBoxProps<T, M>, 'children' | 'className' | 'style' | 'placeholder' | 'menuTrigger'> {
|
|
682
|
+
/** Visible label. Always set one. */
|
|
683
|
+
label: ReactNode;
|
|
684
|
+
/** Helper text below the field. Replaced by the error message when invalid. */
|
|
685
|
+
description?: ReactNode;
|
|
686
|
+
/** Error text shown when the field is invalid. */
|
|
687
|
+
errorMessage?: ReactNode;
|
|
688
|
+
/** A hint like “Search…”. */
|
|
689
|
+
placeholder?: string;
|
|
690
|
+
/** sm 32 · md 40 · lg 48 px. lg on mobile. */
|
|
691
|
+
size?: InputSize;
|
|
692
|
+
/** Decorative icon before the text, e.g. a search icon. */
|
|
693
|
+
leadingIcon?: ReactNode;
|
|
694
|
+
/** Server search: shows a loading row (previous results stay) and marks the list busy. */
|
|
695
|
+
isLoading?: boolean;
|
|
696
|
+
/** Empty list text. Default: “No results for “…””. */
|
|
697
|
+
noResultsMessage?: (inputValue: string) => ReactNode;
|
|
698
|
+
/** Multi only: shows an “Add …” row for text without an exact match. Return the key of the new item to select it. */
|
|
699
|
+
onCreate?: (text: string) => Key | void;
|
|
700
|
+
/** Option and ListBoxSection elements, or a render function with items / defaultItems. */
|
|
701
|
+
children: ReactNode | ((item: T) => ReactNode);
|
|
702
|
+
/** auto (default): popover on desktop, Bottom Sheet with search below 640 px · popover · sheet. */
|
|
703
|
+
overlay?: 'auto' | 'popover' | 'sheet';
|
|
704
|
+
/** Multi in the sheet: live (forms, footer “Done”) · onClose (filters: onApply once when the sheet closes, if changed). */
|
|
705
|
+
commit?: 'live' | 'onClose';
|
|
706
|
+
/** commit="onClose": apply the selection (load results, write the URL …). */
|
|
707
|
+
onApply?: (value: Key[]) => void;
|
|
708
|
+
/** commit="onClose": label of the primary sheet button, ideally with the live result count. */
|
|
709
|
+
resultLabel?: (value: Key[]) => ReactNode;
|
|
710
|
+
className?: string;
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Combobox – a Select you can type into; typing filters the list.
|
|
714
|
+
* Built on React Aria ComboBox: opens on typing, arrow down or the chevron – never on focus.
|
|
715
|
+
* Contains-match, case and accent insensitive; the first match is highlighted, Enter picks it.
|
|
716
|
+
* Leaving without a selection restores the last valid value.
|
|
717
|
+
* Local data: `defaultItems` (filtered here). Server data: `items` + `inputValue` / `onInputChange` + `isLoading`.
|
|
718
|
+
*/
|
|
719
|
+
declare function Combobox<T extends object, M extends ComboMode = 'single'>({ label, description, errorMessage, placeholder: placeholderProp, size, leadingIcon, isLoading, noResultsMessage: noResultsProp, onCreate, children, overlay, commit, onApply, resultLabel: resultLabelProp, className, selectionMode, value: valueProp, defaultValue, onChange, onInputChange, ...props }: ComboboxProps<T, M>): react.JSX.Element;
|
|
720
|
+
|
|
721
|
+
interface ToastAction {
|
|
722
|
+
/** “Undo”, “View” or “Retry”. It must also be reachable elsewhere in the app. */
|
|
723
|
+
label: string;
|
|
724
|
+
onAction: () => void;
|
|
725
|
+
}
|
|
726
|
+
interface ToastOptions {
|
|
727
|
+
/** Max one action. Pressing it runs the action and closes the toast. */
|
|
728
|
+
action?: ToastAction;
|
|
729
|
+
/** Errors (“Could not save”): stays until closed. Otherwise 5 s, with an action 8 s. */
|
|
730
|
+
persistent?: boolean;
|
|
731
|
+
/** Called when the toast closes (timeout, close button, Esc or action). */
|
|
732
|
+
onClose?: () => void;
|
|
733
|
+
}
|
|
734
|
+
/**
|
|
735
|
+
* Shows a toast: short, temporary feedback after an action.
|
|
736
|
+
* Write the result, not the process (“Q3-Report.pdf deleted”), one line, max about 50 characters.
|
|
737
|
+
* Returns the key for `toast.close(key)`. The same message is never shown twice at once.
|
|
738
|
+
*/
|
|
739
|
+
declare function toast(message: string, { action, persistent, onClose }?: ToastOptions): string;
|
|
740
|
+
declare namespace toast {
|
|
741
|
+
var close: (key: string) => void;
|
|
742
|
+
var clear: () => void;
|
|
743
|
+
}
|
|
744
|
+
interface ToastRegionProps {
|
|
745
|
+
/** Accessible name of the landmark. Default: “Notifications” (localized by React Aria). */
|
|
746
|
+
'aria-label'?: string;
|
|
747
|
+
/** Accessible name of the close buttons. Default: “Close” (localized by React Aria). */
|
|
748
|
+
closeLabel?: string;
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* The place where toasts appear – render it once at the root of the app.
|
|
752
|
+
* A landmark: F6 moves focus into it, new toasts are announced. Desktop bottom right,
|
|
753
|
+
* mobile full width (set `--medo-toast-offset` to the height of a bottom navigation).
|
|
754
|
+
* Hover, focus and a hidden window pause the timers (WCAG 2.2.1).
|
|
755
|
+
*/
|
|
756
|
+
declare function ToastRegion({ closeLabel, ...props }: ToastRegionProps): react.JSX.Element | null;
|
|
757
|
+
|
|
758
|
+
interface TabsProps extends Omit<TabsProps$1, 'className' | 'style' | 'orientation'> {
|
|
759
|
+
/** md: tab 32 / track 40 · lg: 40 / 48. Below 640 px tabs are always lg. */
|
|
760
|
+
size?: 'md' | 'lg';
|
|
761
|
+
/** The tabs share the full width. Below 640 px automatic: up to 3 tabs fill, more scroll. */
|
|
762
|
+
fullWidth?: boolean;
|
|
763
|
+
className?: string;
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* Tabs – switch between views of the same context, one panel visible at a time.
|
|
767
|
+
* Built on React Aria Tabs: tablist / tab / tabpanel, only the selected tab is in the Tab order,
|
|
768
|
+
* ← → move and select, Home / End. `keyboardActivation="manual"` for slow panels (select with Enter).
|
|
769
|
+
* Keep the selected tab in the URL with `selectedKey` + `onSelectionChange`.
|
|
770
|
+
*/
|
|
771
|
+
declare function Tabs({ size, fullWidth, className, ...props }: TabsProps): react.JSX.Element;
|
|
772
|
+
interface TabListProps<T> extends Omit<TabListProps$1<T>, 'className' | 'style'> {
|
|
773
|
+
/** Names the tabs when there is no visible heading (“Project”). */
|
|
774
|
+
'aria-label'?: string;
|
|
775
|
+
className?: string;
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* The track with the tabs. 2 to 6 tabs. Scrolls horizontally when it does not fit
|
|
779
|
+
* (with a fade at the edge that still has tabs) – tabs never wrap.
|
|
780
|
+
*/
|
|
781
|
+
declare function TabList<T extends object>({ className, ...props }: TabListProps<T>): react.JSX.Element;
|
|
782
|
+
interface TabProps extends Omit<TabProps$1, 'className' | 'style' | 'children'> {
|
|
783
|
+
/** Required. 1–2 words, a noun (“Activity”). */
|
|
784
|
+
children: string;
|
|
785
|
+
/** Optional, then on all tabs. Decorative – the label carries the meaning. */
|
|
786
|
+
icon?: ReactNode;
|
|
787
|
+
/** Items waiting in the tab (Badge count, neutral). Hidden at 0. */
|
|
788
|
+
count?: number;
|
|
789
|
+
/** Screen-reader text of the count (“3 new”). Without it the number is read as part of the name. */
|
|
790
|
+
countLabel?: string;
|
|
791
|
+
}
|
|
792
|
+
/** One tab. The selected tab is a raised thumb that slides to the new tab with a snappy spring (no slide with reduced motion). */
|
|
793
|
+
declare function Tab({ children, icon, count, countLabel, ...props }: TabProps): react.JSX.Element;
|
|
794
|
+
interface TabPanelProps extends Omit<TabPanelProps$1, 'className' | 'style' | 'shouldForceMount'> {
|
|
795
|
+
/**
|
|
796
|
+
* Keeps the panel (hidden) while another tab is selected, so input is never lost.
|
|
797
|
+
* Set false for heavy panels (large tables, charts) to unmount them.
|
|
798
|
+
*/
|
|
799
|
+
keepMounted?: boolean;
|
|
800
|
+
className?: string;
|
|
801
|
+
}
|
|
802
|
+
/** The content of one tab, directly below the tab list. It is focusable when nothing inside is. */
|
|
803
|
+
declare function TabPanel({ keepMounted, className, ...props }: TabPanelProps): react.JSX.Element;
|
|
804
|
+
|
|
805
|
+
/** Opens a Popover from a trigger on click (React Aria DialogTrigger). The trigger is pressed and aria-expanded while open. */
|
|
806
|
+
declare const PopoverTrigger: typeof DialogTrigger;
|
|
807
|
+
interface PopoverProps {
|
|
808
|
+
/** Header with title and close button. Use it when the content needs a title or holds a form. */
|
|
809
|
+
title?: ReactNode;
|
|
810
|
+
/** Required without a title: names the popover. */
|
|
811
|
+
'aria-label'?: string;
|
|
812
|
+
/** Interactive content. A function gets `close`. */
|
|
813
|
+
children: ReactNode | ((close: () => void) => ReactNode);
|
|
814
|
+
/** sm 240 · md 320 · lg 400 · auto: hugs content without padding (e.g. a calendar). */
|
|
815
|
+
size?: 'sm' | 'md' | 'lg' | 'auto';
|
|
816
|
+
/** Footer, only when changes must be confirmed – otherwise apply them live. Cancel + main action (Button sm). */
|
|
817
|
+
primaryAction?: DialogAction;
|
|
818
|
+
cancelLabel?: string;
|
|
819
|
+
/** Accessible name of the close button. */
|
|
820
|
+
closeLabel?: string;
|
|
821
|
+
/** auto: popover on desktop, Bottom Sheet below 640 px · popover · sheet. */
|
|
822
|
+
overlay?: 'auto' | 'popover' | 'sheet';
|
|
823
|
+
/** Default bottom start; flips when there is no space. */
|
|
824
|
+
placement?: PopoverProps$1['placement'];
|
|
825
|
+
className?: string;
|
|
826
|
+
}
|
|
827
|
+
/**
|
|
828
|
+
* Popover – a small floating panel with interactive content, anchored to its trigger.
|
|
829
|
+
* Opens on click, never on hover. Non-modal: the page stays usable; focus moves in, Esc or a click
|
|
830
|
+
* outside closes it and focus returns to the trigger. One topic per popover, one popover at a time.
|
|
831
|
+
*/
|
|
832
|
+
declare function Popover({ title, 'aria-label': ariaLabel, children, size, primaryAction, cancelLabel: cancelLabelProp, closeLabel: closeLabelProp, overlay, placement, className, }: PopoverProps): react.JSX.Element;
|
|
833
|
+
interface ToggletipProps {
|
|
834
|
+
/** Required. Names the info button and the toggletip after the topic (“About billing email”). */
|
|
835
|
+
'aria-label': string;
|
|
836
|
+
/** One or two short sentences. Text only. */
|
|
837
|
+
children: ReactNode;
|
|
838
|
+
/** Optional link to more help. */
|
|
839
|
+
link?: {
|
|
840
|
+
label: string;
|
|
841
|
+
href: string;
|
|
842
|
+
external?: boolean;
|
|
843
|
+
};
|
|
844
|
+
className?: string;
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
* Toggletip – a short explanation behind an info button, next to a label or value.
|
|
848
|
+
* Opens on click, so it works with touch, keyboard and screen readers – unlike a tooltip.
|
|
849
|
+
* Esc or a click outside closes it. Stays a popover on mobile (full width minus 16 px).
|
|
850
|
+
*/
|
|
851
|
+
declare function Toggletip({ 'aria-label': label, children, link, className }: ToggletipProps): react.JSX.Element;
|
|
852
|
+
|
|
853
|
+
type NavVariant = 'header' | 'sidebar' | 'rail' | 'sheet';
|
|
854
|
+
interface NavItemProps extends Omit<LinkProps$1, 'children' | 'className' | 'style'> {
|
|
855
|
+
/** Required. 1–2 words, a noun – the same name in header, sidebar, tab bar and page title. */
|
|
856
|
+
children: string;
|
|
857
|
+
/** Sidebar, rail and sheet: icon before the label (decorative). Header items have no icon. */
|
|
858
|
+
icon?: ReactNode;
|
|
859
|
+
/** The current page (exactly one). Marked with aria-current="page" and action/selected. */
|
|
860
|
+
isCurrent?: boolean;
|
|
861
|
+
/** Number in the item (Badge count, neutral). */
|
|
862
|
+
count?: number;
|
|
863
|
+
/** Screen-reader text of the count (“3 unread”, “12 projects”). */
|
|
864
|
+
countLabel?: string;
|
|
865
|
+
/** The count is new or unread: in the rail it turns into a dot. Plain totals (“12 projects”) are hidden there. */
|
|
866
|
+
unread?: boolean;
|
|
867
|
+
}
|
|
868
|
+
/**
|
|
869
|
+
* One navigation link. Built on React Aria Link, so client-side routing works
|
|
870
|
+
* with any router through RouterProvider. The container decides the form (header, sidebar, rail, sheet).
|
|
871
|
+
*/
|
|
872
|
+
declare function NavItem({ children, icon, isCurrent, count, countLabel, unread, ...props }: NavItemProps): react.JSX.Element;
|
|
873
|
+
interface NavGroupProps {
|
|
874
|
+
/** Label of the group button. */
|
|
875
|
+
label: string;
|
|
876
|
+
/** Sidebar, rail and sheet: icon before the label. */
|
|
877
|
+
icon?: ReactNode;
|
|
878
|
+
/** NavItems – one level only. */
|
|
879
|
+
children: ReactNode;
|
|
880
|
+
/** Open at start. Default: open when it contains the current page (sidebar, sheet). */
|
|
881
|
+
defaultOpen?: boolean;
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* A group of links behind a disclosure button (aria-expanded) – never a menu.
|
|
885
|
+
* Header: a dropdown panel on the popover surface; Tab moves through the links, Esc or a click outside closes.
|
|
886
|
+
* Sidebar and sheet: opens in place, one level. The parent shows “current” only while it is closed.
|
|
887
|
+
*/
|
|
888
|
+
declare function NavGroup({ label, icon, children, defaultOpen }: NavGroupProps): react.JSX.Element;
|
|
889
|
+
interface NavListProps {
|
|
890
|
+
/** Form of the items: header (row) · sidebar · rail · sheet. */
|
|
891
|
+
variant?: NavVariant;
|
|
892
|
+
/** Name of the navigation region (“Footer”, “Account”). */
|
|
893
|
+
'aria-label': string;
|
|
894
|
+
children: ReactNode;
|
|
895
|
+
className?: string;
|
|
896
|
+
}
|
|
897
|
+
/** A named navigation region with items of one form – for navigation outside the ready-made headers and bars. */
|
|
898
|
+
declare function NavList({ variant, 'aria-label': label, children, className }: NavListProps): react.JSX.Element;
|
|
899
|
+
interface NavSectionProps {
|
|
900
|
+
/** Overline heading (“Workspace”). In the rail the section is divided by a line. */
|
|
901
|
+
title: string;
|
|
902
|
+
children: ReactNode;
|
|
903
|
+
}
|
|
904
|
+
/** A titled section of the side navigation. */
|
|
905
|
+
declare function NavSection({ title, children }: NavSectionProps): react.JSX.Element;
|
|
906
|
+
interface SkipLinkProps {
|
|
907
|
+
/** Id target of the main content. */
|
|
908
|
+
href?: string;
|
|
909
|
+
children?: string;
|
|
910
|
+
}
|
|
911
|
+
/** “Skip to content” – the first focusable element on every page (WCAG 2.4.1). Visible on focus only. */
|
|
912
|
+
declare function SkipLink({ href, children }: SkipLinkProps): react.JSX.Element;
|
|
913
|
+
interface NavAction {
|
|
914
|
+
label: string;
|
|
915
|
+
/** Usually a link (“Log in”, “Get started”). */
|
|
916
|
+
href?: string;
|
|
917
|
+
onPress?: (e: PressEvent) => void;
|
|
918
|
+
/** primary: max one · secondary · ghost. */
|
|
919
|
+
variant?: 'primary' | 'secondary' | 'ghost';
|
|
920
|
+
}
|
|
921
|
+
interface SiteHeaderProps {
|
|
922
|
+
/** Logo link with a name (“med.o home”). */
|
|
923
|
+
logo: ReactNode;
|
|
924
|
+
/** NavItems and NavGroups – max 5 links; more go into a group. */
|
|
925
|
+
children: ReactNode;
|
|
926
|
+
/** Max 2 actions, at most one primary (last). In the mobile menu they are pinned at the bottom (lg). */
|
|
927
|
+
actions?: NavAction[];
|
|
928
|
+
/** Name of the navigation region. */
|
|
929
|
+
'aria-label'?: string;
|
|
930
|
+
/** Mobile: label of the menu button and title of the fullscreen menu. */
|
|
931
|
+
menuLabel?: string;
|
|
932
|
+
closeLabel?: string;
|
|
933
|
+
/** auto: menu button below 768 px · desktop · mobile (forced, e.g. for previews). */
|
|
934
|
+
layout?: 'auto' | 'desktop' | 'mobile';
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* Website header: logo, links, actions. Sticky, with a divider once the page scrolls.
|
|
938
|
+
* Below 768 px only the logo, the primary action and a menu button remain; the menu opens fullscreen.
|
|
939
|
+
*/
|
|
940
|
+
declare function SiteHeader({ logo, children, actions, 'aria-label': labelProp, menuLabel: menuLabelProp, closeLabel: closeLabelProp, layout }: SiteHeaderProps): react.JSX.Element;
|
|
941
|
+
interface AppHeaderProps {
|
|
942
|
+
/** Page title – the same name as the current nav item. */
|
|
943
|
+
title: ReactNode;
|
|
944
|
+
/** Heading level of the title (default 1: the page title). */
|
|
945
|
+
headingLevel?: 1 | 2 | 3;
|
|
946
|
+
/** Mobile only: logo mark before the title (the side navigation is hidden there). */
|
|
947
|
+
logo?: ReactNode;
|
|
948
|
+
/** Search field (desktop). */
|
|
949
|
+
search?: ReactNode;
|
|
950
|
+
/** Notifications, account … */
|
|
951
|
+
actions?: ReactNode;
|
|
952
|
+
}
|
|
953
|
+
/** App header: page title, search and actions. Navigation lives in the side navigation. */
|
|
954
|
+
declare function AppHeader({ title, headingLevel, logo, search, actions }: AppHeaderProps): react.JSX.Element;
|
|
955
|
+
interface SideNavUser {
|
|
956
|
+
name: string;
|
|
957
|
+
email?: string;
|
|
958
|
+
src?: string;
|
|
959
|
+
}
|
|
960
|
+
interface SideNavProps {
|
|
961
|
+
/** Full logo (expanded). */
|
|
962
|
+
logo: ReactNode;
|
|
963
|
+
/** Logo mark (collapsed, 32 px). */
|
|
964
|
+
logoMark: ReactNode;
|
|
965
|
+
/** NavItems, NavSections and NavGroups. Most used first. */
|
|
966
|
+
children: ReactNode;
|
|
967
|
+
/** Signed-in user at the bottom. */
|
|
968
|
+
user?: SideNavUser;
|
|
969
|
+
/** Collapsed to the 64 px rail (controlled). Remember it per user via onCollapsedChange. */
|
|
970
|
+
isCollapsed?: boolean;
|
|
971
|
+
defaultCollapsed?: boolean;
|
|
972
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
973
|
+
/** Name of the navigation region. */
|
|
974
|
+
'aria-label'?: string;
|
|
975
|
+
collapseLabel?: string;
|
|
976
|
+
expandLabel?: string;
|
|
977
|
+
/** Close button of the tablet drawer. */
|
|
978
|
+
closeLabel?: string;
|
|
979
|
+
}
|
|
980
|
+
/**
|
|
981
|
+
* Side navigation for apps: 256 px with icons, counts, sections and groups;
|
|
982
|
+
* collapses to a 64 px rail with tooltips. 640–1023 px: always a rail; expanding opens the full navigation
|
|
983
|
+
* as a Drawer on the left. Below 640 px it is hidden – use the BottomTabBar there.
|
|
984
|
+
*/
|
|
985
|
+
declare function SideNav({ logo, logoMark, children, user, isCollapsed, defaultCollapsed, onCollapsedChange, 'aria-label': labelProp, collapseLabel: collapseLabelProp, expandLabel: expandLabelProp, closeLabel: closeLabelProp, }: SideNavProps): react.JSX.Element;
|
|
986
|
+
interface BottomTabBarProps {
|
|
987
|
+
/** 3–5 TabBarItems; the last can be TabBarMore. */
|
|
988
|
+
children: ReactNode;
|
|
989
|
+
'aria-label'?: string;
|
|
990
|
+
/** mobile: only below 640 px (default) · always (e.g. in a native-like web app). */
|
|
991
|
+
display?: 'mobile' | 'always';
|
|
992
|
+
}
|
|
993
|
+
/**
|
|
994
|
+
* Bottom tab bar: the main destinations of an app on phones, in thumb reach.
|
|
995
|
+
* Max 4 destinations + “More”. Fixed to the bottom with the safe area; set `--medo-toast-offset` so toasts stay above it.
|
|
996
|
+
*/
|
|
997
|
+
declare function BottomTabBar({ children, 'aria-label': labelProp, display }: BottomTabBarProps): react.JSX.Element;
|
|
998
|
+
interface TabBarItemProps extends Omit<LinkProps$1, 'children' | 'className' | 'style'> {
|
|
999
|
+
/** Always visible – icons alone are ambiguous. */
|
|
1000
|
+
children: string;
|
|
1001
|
+
icon: ReactNode;
|
|
1002
|
+
isCurrent?: boolean;
|
|
1003
|
+
/** Something new (dot). Name it for screen readers with dotLabel. */
|
|
1004
|
+
dot?: boolean;
|
|
1005
|
+
dotLabel?: string;
|
|
1006
|
+
}
|
|
1007
|
+
/** One destination of the bottom tab bar: icon in a pill indicator, label below. */
|
|
1008
|
+
declare function TabBarItem({ children, icon, isCurrent, dot, dotLabel, ...props }: TabBarItemProps): react.JSX.Element;
|
|
1009
|
+
interface TabBarMoreProps {
|
|
1010
|
+
/** Label of the button and title of the sheet. */
|
|
1011
|
+
label?: string;
|
|
1012
|
+
/** NavItems for the remaining destinations (rendered large in the Nav sheet). */
|
|
1013
|
+
children: ReactNode;
|
|
1014
|
+
closeLabel?: string;
|
|
1015
|
+
}
|
|
1016
|
+
/** “More”: opens the remaining destinations in the Nav sheet (Bottom Sheet). Shows “current” when one of them is. */
|
|
1017
|
+
declare function TabBarMore({ label: labelProp, children, closeLabel }: TabBarMoreProps): react.JSX.Element;
|
|
1018
|
+
|
|
1019
|
+
interface DrawerProps extends DirtyGuardProps {
|
|
1020
|
+
/** Says what it is (“Account”, “Filter”, “Invoice #1042”). Can be a logo for a navigation drawer – then set aria-label. */
|
|
1021
|
+
title: ReactNode;
|
|
1022
|
+
/** Name of the drawer when the title is not text (e.g. a logo). */
|
|
1023
|
+
'aria-label'?: string;
|
|
1024
|
+
/** Content; scrolls between header and footer. A function gets `close`: closes without asking – call it after saving. */
|
|
1025
|
+
children: ReactNode | ((close: () => void) => ReactNode);
|
|
1026
|
+
/**
|
|
1027
|
+
* Only for decisions (Apply, Save) – usually a ButtonGroup. Links and switches act immediately.
|
|
1028
|
+
* A function gets `close` (after applying or saving, never asks) and `cancel` (asks “Discard changes?” when isDirty).
|
|
1029
|
+
*/
|
|
1030
|
+
footer?: ReactNode | ((close: () => void, cancel: () => void) => ReactNode);
|
|
1031
|
+
/** right: account, filters, details (default) · left: navigation only. */
|
|
1032
|
+
side?: 'left' | 'right';
|
|
1033
|
+
/** sm 320 (links) · md 400 (filters) · lg 560 (details, forms). */
|
|
1034
|
+
size?: 'sm' | 'md' | 'lg';
|
|
1035
|
+
/** Accessible name of the close button. */
|
|
1036
|
+
closeLabel?: string;
|
|
1037
|
+
className?: string;
|
|
1038
|
+
}
|
|
1039
|
+
/**
|
|
1040
|
+
* Drawer – a modal panel that slides in from the side. Same building blocks and behaviour
|
|
1041
|
+
* as the Dialog (React Aria ModalOverlay + Modal + Dialog): scrim, focus trap, no page scroll, Esc and the close
|
|
1042
|
+
* button close it, focus returns to the trigger; `isDirty` asks “Discard changes?”. Below 640 px it keeps its side,
|
|
1043
|
+
* viewport − 56 px wide; a swipe towards the edge closes it. Use inside a DialogTrigger or with isOpen.
|
|
1044
|
+
*/
|
|
1045
|
+
declare function Drawer({ title, 'aria-label': ariaLabel, children, footer, side, size, closeLabel, isDirty, discardText, className, ...openProps }: DrawerProps): react.JSX.Element;
|
|
1046
|
+
|
|
1047
|
+
type ListType = 'bullet' | 'number' | 'check';
|
|
1048
|
+
interface ListProps extends Omit<HTMLAttributes<HTMLUListElement | HTMLOListElement>, 'children'> {
|
|
1049
|
+
/** bullet: unordered points (ul) · number: order matters (ol) · check: features, included first (ul). */
|
|
1050
|
+
type?: ListType;
|
|
1051
|
+
/** Without it the list takes the size of the surrounding text. sm body/sm · md body/md · lg body/lg. */
|
|
1052
|
+
size?: 'sm' | 'md' | 'lg';
|
|
1053
|
+
/** Number list: first number (e.g. a list that continues after a paragraph). */
|
|
1054
|
+
start?: number;
|
|
1055
|
+
/** 2–7 ListItems. A nested List inside an item is level 2 (max 2 levels). */
|
|
1056
|
+
children: ReactNode;
|
|
1057
|
+
}
|
|
1058
|
+
/**
|
|
1059
|
+
* List – a real list in running text: bullets, numbers or a feature list.
|
|
1060
|
+
* Plain markup, no library needed. Markers are neutral (text/secondary) in their own column; long items
|
|
1061
|
+
* wrap flush with their first line. Level 2 (a List inside a ListItem) switches the marker: ring, “a.”.
|
|
1062
|
+
*/
|
|
1063
|
+
declare function List({ type, size, start, className, style, children, ...props }: ListProps): react.JSX.Element;
|
|
1064
|
+
interface ListItemProps extends Omit<HTMLAttributes<HTMLLIElement>, 'children'> {
|
|
1065
|
+
children: ReactNode;
|
|
1066
|
+
/** Feature list: not included – cross, muted text and a hidden “Not included:” for screen readers. */
|
|
1067
|
+
excluded?: boolean;
|
|
1068
|
+
/** Hidden prefix of excluded items. */
|
|
1069
|
+
excludedLabel?: string;
|
|
1070
|
+
}
|
|
1071
|
+
/** One item of a List. */
|
|
1072
|
+
declare function ListItem({ children, excluded, excludedLabel, className, ...props }: ListItemProps): react.JSX.Element;
|
|
1073
|
+
interface DescriptionListProps extends HTMLAttributes<HTMLDListElement> {
|
|
1074
|
+
/** auto: stacked as soon as the list itself is narrower than 22.5 rem (360 px) (phone, Drawer, narrow column) · horizontal · stacked. */
|
|
1075
|
+
layout?: 'auto' | 'horizontal' | 'stacked';
|
|
1076
|
+
/** DescriptionItems. */
|
|
1077
|
+
children: ReactNode;
|
|
1078
|
+
}
|
|
1079
|
+
/** Description list – term–value pairs for details of a record, an order or a profile. */
|
|
1080
|
+
declare function DescriptionList({ layout, className, children, ...props }: DescriptionListProps): react.JSX.Element;
|
|
1081
|
+
interface DescriptionItemProps {
|
|
1082
|
+
/** The term (“Status”). */
|
|
1083
|
+
term: ReactNode;
|
|
1084
|
+
/** The value (“Active”). */
|
|
1085
|
+
children: ReactNode;
|
|
1086
|
+
}
|
|
1087
|
+
/** One term–value pair (a div grouping dt and dd – valid inside dl). */
|
|
1088
|
+
declare function DescriptionItem({ term, children }: DescriptionItemProps): react.JSX.Element;
|
|
1089
|
+
|
|
1090
|
+
interface ListViewProps<T> extends Omit<GridListProps<T>, 'className' | 'style' | 'layout' | 'keyboardNavigationBehavior'> {
|
|
1091
|
+
/** Required: names the list (“Inbox”). */
|
|
1092
|
+
'aria-label'?: string;
|
|
1093
|
+
/** plain: full-page lists (inbox) · card: inside settings or dashboards (border, radius/lg) · cards: records on mobile (Table cards, use ListCard). */
|
|
1094
|
+
variant?: 'plain' | 'card' | 'cards';
|
|
1095
|
+
/** Shows 3 skeleton rows instead of the items (aria-busy). */
|
|
1096
|
+
isLoading?: boolean;
|
|
1097
|
+
/** Shown when there are no rows: an EmptyState with `size="inline"`. */
|
|
1098
|
+
emptyState?: ReactNode;
|
|
1099
|
+
className?: string;
|
|
1100
|
+
}
|
|
1101
|
+
/**
|
|
1102
|
+
* List view – an interactive list of objects in apps: inbox, people, files, notifications, settings
|
|
1103
|
+
*. Built on React Aria GridList: ↑ ↓ move between rows, Enter opens a row, Tab reaches
|
|
1104
|
+
* the controls inside a row (menu, switch, buttons). `selectionMode="multiple"` shows a checkbox per row and a click
|
|
1105
|
+
* toggles the row – use it without `onAction` (React Aria would run the action on click instead).
|
|
1106
|
+
* Rows can have swipe actions on touch (`swipeActions`) – the same actions always sit in the row's “…” menu.
|
|
1107
|
+
*/
|
|
1108
|
+
declare function ListView<T extends object>({ variant, isLoading, emptyState, className, children, items, ...props }: ListViewProps<T>): react.JSX.Element;
|
|
1109
|
+
interface ListRowProps extends Omit<GridListItemProps, 'children' | 'className' | 'style' | 'textValue'> {
|
|
1110
|
+
/** Required. One line, most important word first. Also the row's accessible name. */
|
|
1111
|
+
title: string;
|
|
1112
|
+
/** One line (2-line row) or two lines (`lines={3}`). */
|
|
1113
|
+
description?: ReactNode;
|
|
1114
|
+
/** 3: description up to two lines (row 88). Default: 1 without, 2 with a description. */
|
|
1115
|
+
lines?: 2 | 3;
|
|
1116
|
+
/** Avatar (sized automatically: sm in 1-line rows, lg otherwise), an icon tile (ListRowIcon) or a 40 px thumbnail. */
|
|
1117
|
+
leading?: ReactNode;
|
|
1118
|
+
/** Meta text (time, size) in caption. */
|
|
1119
|
+
meta?: ReactNode;
|
|
1120
|
+
/** One trailing type per list: Badge, Menu (“…”), Switch or max 2 Button sm. With buttons the row has no action. */
|
|
1121
|
+
trailing?: ReactNode;
|
|
1122
|
+
/** The row navigates (href) – shows a chevron. */
|
|
1123
|
+
chevron?: boolean;
|
|
1124
|
+
/** New or unread: title and excerpt strong, meta in brand, dot below the meta, “Unread” for screen readers. */
|
|
1125
|
+
unread?: boolean;
|
|
1126
|
+
/** Screen-reader word for unread rows. */
|
|
1127
|
+
unreadLabel?: string;
|
|
1128
|
+
/**
|
|
1129
|
+
* Touch only: end = swipe toward the start (left in LTR, e.g. Delete) · start = swipe toward the end (a safe action,
|
|
1130
|
+
* e.g. Archive). Always put the same actions into the row's “…” menu – swipe is a shortcut, never the only way.
|
|
1131
|
+
*/
|
|
1132
|
+
swipeActions?: {
|
|
1133
|
+
start?: SwipeAction;
|
|
1134
|
+
end?: SwipeAction;
|
|
1135
|
+
};
|
|
1136
|
+
}
|
|
1137
|
+
interface SwipeAction {
|
|
1138
|
+
/** Short verb (“Delete”, “Archive”). */
|
|
1139
|
+
label: string;
|
|
1140
|
+
icon: ReactNode;
|
|
1141
|
+
/** Runs on a full swipe or a tap on the revealed action. Delete: remove at once and offer “Undo” in a Toast. */
|
|
1142
|
+
onAction: () => void;
|
|
1143
|
+
/** danger: feedback/danger/solid (Delete) · primary: action/primary (Archive). */
|
|
1144
|
+
tone?: 'danger' | 'primary';
|
|
1145
|
+
}
|
|
1146
|
+
/** One row of a List view: leading – content – trailing. Height 48, 64 or 88 by lines. */
|
|
1147
|
+
declare function ListRow({ title, description, lines, leading, meta, trailing, chevron, unread, unreadLabel, swipeActions, ...props }: ListRowProps): react.JSX.Element;
|
|
1148
|
+
/** Leading icon in a 40 px tile (settings rows). Decorative – the title carries the meaning. */
|
|
1149
|
+
declare function ListRowIcon({ children }: {
|
|
1150
|
+
children: ReactNode;
|
|
1151
|
+
}): react.JSX.Element;
|
|
1152
|
+
interface ListCardProps extends Omit<GridListItemProps, 'children' | 'className' | 'style' | 'textValue'> {
|
|
1153
|
+
/** Required. The record (“INV-2026-0140”). Also the card's accessible name. */
|
|
1154
|
+
title: string;
|
|
1155
|
+
/** Key number on the right of the title (amount, count) – strong, never truncated. */
|
|
1156
|
+
amount?: ReactNode;
|
|
1157
|
+
/** Second line, e.g. the owner with an Avatar (sized xs automatically). */
|
|
1158
|
+
description?: ReactNode;
|
|
1159
|
+
/** Bottom left: date or other meta in caption. */
|
|
1160
|
+
meta?: ReactNode;
|
|
1161
|
+
/** Bottom right: status as Badge sm with dot. */
|
|
1162
|
+
status?: ReactNode;
|
|
1163
|
+
}
|
|
1164
|
+
/**
|
|
1165
|
+
* List card – a record as a card, the mobile form of a table row. Use inside
|
|
1166
|
+
* `<ListView variant="cards">`: the whole card opens the record (`href` or `onAction`); in selection mode
|
|
1167
|
+
* a checkbox lg shows and a tap toggles the card.
|
|
1168
|
+
*/
|
|
1169
|
+
declare function ListCard({ title, amount, description, meta, status, ...props }: ListCardProps): react.JSX.Element;
|
|
1170
|
+
|
|
1171
|
+
interface BulkAction {
|
|
1172
|
+
/** Verb (“Export”, “Archive”, “Delete”). */
|
|
1173
|
+
label: string;
|
|
1174
|
+
onAction: () => void;
|
|
1175
|
+
/** danger: destructive – confirm it (Alert dialog) or offer Undo (Toast). Mobile: ghost danger. */
|
|
1176
|
+
variant?: 'default' | 'danger';
|
|
1177
|
+
/** Icon for the “…” menu (actions that do not fit in the bar). */
|
|
1178
|
+
icon?: ReactNode;
|
|
1179
|
+
}
|
|
1180
|
+
interface BulkActionBarProps {
|
|
1181
|
+
/** Number of selected items. 0 hides the bar. */
|
|
1182
|
+
count: number;
|
|
1183
|
+
/** Desktop shows 3, mobile 2 (with more: 1 and “…”); the rest go into the “…” menu. Most important first, destructive last. */
|
|
1184
|
+
actions: BulkAction[];
|
|
1185
|
+
/** Clears the selection (× and Esc). */
|
|
1186
|
+
onClear: () => void;
|
|
1187
|
+
/** auto: floating dark bar on desktop, full-width bar at the bottom below 640 px · desktop · mobile. */
|
|
1188
|
+
variant?: 'auto' | 'desktop' | 'mobile';
|
|
1189
|
+
/** Texts (localize). */
|
|
1190
|
+
countLabel?: (count: number) => string;
|
|
1191
|
+
clearLabel?: string;
|
|
1192
|
+
moreLabel?: string;
|
|
1193
|
+
'aria-label'?: string;
|
|
1194
|
+
className?: string;
|
|
1195
|
+
}
|
|
1196
|
+
/**
|
|
1197
|
+
* Bulk action bar – actions for the selected rows of a Table or List view.
|
|
1198
|
+
* Appears with ≥ 1 selected item and floats, so selecting never shifts the layout. A toolbar: the count is
|
|
1199
|
+
* announced, Esc or × clears the selection. Render it right after the list, so Tab reaches it next.
|
|
1200
|
+
*/
|
|
1201
|
+
declare function BulkActionBar({ count, actions, onClear, variant, countLabel: countLabelProp, clearLabel: clearLabelProp, moreLabel: moreLabelProp, 'aria-label': ariaLabelProp, className, }: BulkActionBarProps): react.JSX.Element;
|
|
1202
|
+
|
|
1203
|
+
type EmptyStateType = 'first-use' | 'no-results' | 'error' | 'no-access' | 'all-done';
|
|
1204
|
+
type EmptyStateSize = 'page' | 'section' | 'inline';
|
|
1205
|
+
interface EmptyStateAction {
|
|
1206
|
+
/** Verb that says what happens (“Create project”, “Clear filters”, “Try again”). */
|
|
1207
|
+
label: string;
|
|
1208
|
+
/** Runs the action. */
|
|
1209
|
+
onPress?: () => void;
|
|
1210
|
+
/** Second action only: navigates – rendered as a Link (“Learn more”, “View archive”). */
|
|
1211
|
+
href?: string;
|
|
1212
|
+
isDisabled?: boolean;
|
|
1213
|
+
}
|
|
1214
|
+
interface EmptyStateProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
|
|
1215
|
+
/** Sets the default icon, its tone and the look of the main action. */
|
|
1216
|
+
type?: EmptyStateType;
|
|
1217
|
+
/** page: a whole view · section: a card or panel · inline: inside a list or table (header stays). */
|
|
1218
|
+
size?: EmptyStateSize;
|
|
1219
|
+
/** Required. The situation in plain words – never “No data”. */
|
|
1220
|
+
title: ReactNode;
|
|
1221
|
+
/** Why it is empty or what comes next, in one or two sentences. */
|
|
1222
|
+
description?: ReactNode;
|
|
1223
|
+
/** Main action: primary for first use, secondary for all other types. “All done” needs none. */
|
|
1224
|
+
action?: EmptyStateAction;
|
|
1225
|
+
/** Second action as a text button, or a Link with `href`. */
|
|
1226
|
+
secondaryAction?: EmptyStateAction;
|
|
1227
|
+
/** Replaces the type's default icon (Lucide). */
|
|
1228
|
+
icon?: ReactNode;
|
|
1229
|
+
/** Illustration instead of the icon – only from the shared illustration style. Decorative. */
|
|
1230
|
+
illustration?: ReactNode;
|
|
1231
|
+
/** Heading level of the title (page and section). Match the page outline. Default: page h2, section h3. */
|
|
1232
|
+
headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
1233
|
+
}
|
|
1234
|
+
/**
|
|
1235
|
+
* Empty state – what users see when there is nothing to show, and what they can do next.
|
|
1236
|
+
* Page and section render a `<section>` named by its heading; inline renders a plain block, so it does not add
|
|
1237
|
+
* a landmark inside a list or table. “No results” puts its text in a polite status region; focus stays where it was.
|
|
1238
|
+
*/
|
|
1239
|
+
declare function EmptyState({ type, size, title, description, action, secondaryAction, icon, illustration, headingLevel, className, ...props }: EmptyStateProps): react.JSX.Element;
|
|
1240
|
+
|
|
1241
|
+
interface PaginationProps {
|
|
1242
|
+
/** Current page (1-based, controlled). */
|
|
1243
|
+
page?: number;
|
|
1244
|
+
/** Start page when uncontrolled. */
|
|
1245
|
+
defaultPage?: number;
|
|
1246
|
+
/** Called with the new page (apps). Not needed with `getPageHref`. */
|
|
1247
|
+
onChange?: (page: number) => void;
|
|
1248
|
+
/** Websites: every page becomes a real link (“?page=5”) – shareable, back button works. Works with RouterProvider. */
|
|
1249
|
+
getPageHref?: (page: number) => string;
|
|
1250
|
+
/** Number of pages. Default: totalItems / pageSize. With 1 page nothing is shown. */
|
|
1251
|
+
totalPages?: number;
|
|
1252
|
+
/** Total count: shows the summary (“81–100 of 380”). */
|
|
1253
|
+
totalItems?: number;
|
|
1254
|
+
/** Rows per page. */
|
|
1255
|
+
pageSize?: number;
|
|
1256
|
+
/** Shows “Rows per page” (Select sm). */
|
|
1257
|
+
onPageSizeChange?: (pageSize: number) => void;
|
|
1258
|
+
pageSizeOptions?: number[];
|
|
1259
|
+
/** auto: compact below 640 px · full: summary, rows per page and pages · compact: ‹ Page 5 of 19 › (narrow panels). */
|
|
1260
|
+
variant?: 'auto' | 'full' | 'compact';
|
|
1261
|
+
/** Full only: md 40 · lg 48 (touch). Compact is always lg. */
|
|
1262
|
+
size?: 'md' | 'lg';
|
|
1263
|
+
/** Name of the navigation region. */
|
|
1264
|
+
'aria-label'?: string;
|
|
1265
|
+
/** Texts (localize). */
|
|
1266
|
+
summary?: (from: number, to: number, total: number) => string;
|
|
1267
|
+
pageSizeLabel?: string;
|
|
1268
|
+
previousLabel?: string;
|
|
1269
|
+
nextLabel?: string;
|
|
1270
|
+
/** Accessible name of a page item and the compact text. */
|
|
1271
|
+
pageLabel?: (page: number) => string;
|
|
1272
|
+
compactLabel?: (page: number, totalPages: number) => string;
|
|
1273
|
+
className?: string;
|
|
1274
|
+
}
|
|
1275
|
+
/**
|
|
1276
|
+
* Pagination – move through long lists page by page. A navigation region:
|
|
1277
|
+
* buttons for apps (`onChange`) or real links for websites (`getPageHref`). Full on desktop, compact below 640 px.
|
|
1278
|
+
* After a change the app scrolls to the top of the list and focuses its heading. “Load more” is a Button, not a variant.
|
|
1279
|
+
*/
|
|
1280
|
+
declare function Pagination({ page: pageProp, defaultPage, onChange, getPageHref, totalPages: totalPagesProp, totalItems, pageSize, onPageSizeChange, pageSizeOptions, variant, size, 'aria-label': ariaLabelProp, summary: summaryProp, pageSizeLabel: pageSizeLabelProp, previousLabel: previousLabelProp, nextLabel: nextLabelProp, pageLabel: pageLabelProp, compactLabel: compactLabelProp, className, }: PaginationProps): react.JSX.Element | null;
|
|
1281
|
+
|
|
1282
|
+
interface SearchFieldProps extends Omit<SearchFieldProps$1, 'children' | 'className' | 'style'> {
|
|
1283
|
+
/** Visible label. Without it set `aria-label` (e.g. in a table toolbar or the header). */
|
|
1284
|
+
label?: ReactNode;
|
|
1285
|
+
/** Helper text below the field. */
|
|
1286
|
+
description?: ReactNode;
|
|
1287
|
+
/** A hint like “Search invoices”. Never the only label. */
|
|
1288
|
+
placeholder?: string;
|
|
1289
|
+
/** sm 32 (toolbars) · md 40 · lg 48 (search page, Quick search, mobile). */
|
|
1290
|
+
size?: InputSize;
|
|
1291
|
+
/** Accessible name of the clear button. */
|
|
1292
|
+
clearLabel?: string;
|
|
1293
|
+
className?: string;
|
|
1294
|
+
}
|
|
1295
|
+
/**
|
|
1296
|
+
* Search field – a text field for a search term. Built on React Aria
|
|
1297
|
+
* SearchField: Enter submits (`onSubmit`), Esc or × clears. Put it in a `<search>` element (search landmark);
|
|
1298
|
+
* keep the term in the field after searching.
|
|
1299
|
+
*/
|
|
1300
|
+
declare function SearchField({ label, description, placeholder, size, clearLabel, className, ...props }: SearchFieldProps): react.JSX.Element;
|
|
1301
|
+
|
|
1302
|
+
type SearchResultType = 'page' | 'document' | 'person' | 'media';
|
|
1303
|
+
interface SearchResultProps {
|
|
1304
|
+
/** Sets the default leading icon: page (globe), document (file). Person and media take `leading`. */
|
|
1305
|
+
type?: SearchResultType;
|
|
1306
|
+
/** base: divider between hits, title in brand colour · aesthetic: no divider, larger title, rounded hover surface. */
|
|
1307
|
+
variant?: 'base' | 'aesthetic';
|
|
1308
|
+
/** Required. The hit's title – a link to the result. */
|
|
1309
|
+
title: string;
|
|
1310
|
+
href: string;
|
|
1311
|
+
/** Search term: shown in bold in title and snippet (every match), never by colour alone. */
|
|
1312
|
+
query?: string;
|
|
1313
|
+
/** Where it lives (“Help center › Billing”). */
|
|
1314
|
+
path?: ReactNode;
|
|
1315
|
+
/** Text around the match, max 2 lines. A string gets the highlight. */
|
|
1316
|
+
snippet?: ReactNode;
|
|
1317
|
+
/** Type label as Badge sm (“Page”, “PDF”, “Video”). */
|
|
1318
|
+
badge?: string;
|
|
1319
|
+
/** Meta text next to the badge (“Updated 3 days ago”). */
|
|
1320
|
+
meta?: ReactNode;
|
|
1321
|
+
/** Person: Avatar (sized lg automatically). Media: an image (4:3; 128 wide, 160 in aesthetic). Overrides the type icon. */
|
|
1322
|
+
leading?: ReactNode;
|
|
1323
|
+
/** Heading level of the title. Match the page outline (default h3 below the results heading). */
|
|
1324
|
+
headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
1325
|
+
/** Router options or target for the link. */
|
|
1326
|
+
linkProps?: Omit<LinkProps$1, 'href' | 'children' | 'className'>;
|
|
1327
|
+
className?: string;
|
|
1328
|
+
}
|
|
1329
|
+
/**
|
|
1330
|
+
* Search result – one hit: path, title with the search term in bold, snippet,
|
|
1331
|
+
* meta row with type badge. The whole result is one link (the title), so it is one tab stop.
|
|
1332
|
+
* Put results into `<ul role="list" className="medo-search-results">` with one `<li>` per hit.
|
|
1333
|
+
*/
|
|
1334
|
+
declare function SearchResult({ type, variant, title, href, query, path, snippet, badge, meta, leading, headingLevel, linkProps, className, }: SearchResultProps): react.JSX.Element;
|
|
1335
|
+
|
|
1336
|
+
interface QuickSearchProps<T extends object> {
|
|
1337
|
+
isOpen?: boolean;
|
|
1338
|
+
defaultOpen?: boolean;
|
|
1339
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
1340
|
+
/** Opens with Cmd / Ctrl + K (ignored while the user types in another field). */
|
|
1341
|
+
shortcut?: boolean;
|
|
1342
|
+
/** The search term (controlled) – e.g. to load suggestions from the server. */
|
|
1343
|
+
inputValue?: string;
|
|
1344
|
+
onInputChange?: (value: string) => void;
|
|
1345
|
+
/** Filters the options on the client (contains, case insensitive). Off when the server filters. */
|
|
1346
|
+
clientFilter?: boolean;
|
|
1347
|
+
/** Empty field: Recent and Suggested. While typing: hits grouped by type (ListBoxSection), max 5 per group. */
|
|
1348
|
+
children: ReactNode | ((item: T) => ReactNode);
|
|
1349
|
+
items?: Iterable<T>;
|
|
1350
|
+
/** Opens the highlighted hit (Enter or click). */
|
|
1351
|
+
onAction?: (key: React.Key) => void;
|
|
1352
|
+
/** “All results”: the search page with the same term. */
|
|
1353
|
+
allResultsHref?: (query: string) => string;
|
|
1354
|
+
/** Enter without a highlighted hit, and “Search all content” when nothing matches. */
|
|
1355
|
+
onSearch?: (query: string) => void;
|
|
1356
|
+
/** Texts (localize). */
|
|
1357
|
+
'aria-label'?: string;
|
|
1358
|
+
placeholder?: string;
|
|
1359
|
+
cancelLabel?: string;
|
|
1360
|
+
suggestionsLabel?: string;
|
|
1361
|
+
allResultsLabel?: (query: string) => string;
|
|
1362
|
+
noResultsLabel?: (query: string) => string;
|
|
1363
|
+
searchAllLabel?: (query: string) => string;
|
|
1364
|
+
hints?: {
|
|
1365
|
+
navigate: string;
|
|
1366
|
+
open: string;
|
|
1367
|
+
close: string;
|
|
1368
|
+
};
|
|
1369
|
+
}
|
|
1370
|
+
/**
|
|
1371
|
+
* Quick search – find and open pages, files and people from anywhere. A modal with
|
|
1372
|
+
* React Aria Autocomplete: focus stays in the field while ↑ ↓ move through the suggestions, Enter opens the
|
|
1373
|
+
* highlighted hit, Esc closes and focus returns to the trigger. Desktop: overlay 640 wide · mobile: full screen with Cancel.
|
|
1374
|
+
*/
|
|
1375
|
+
declare function QuickSearch<T extends object>({ isOpen, defaultOpen, onOpenChange, shortcut, inputValue, onInputChange, clientFilter, children, items, onAction, allResultsHref, onSearch, 'aria-label': ariaLabelProp, placeholder: placeholderProp, cancelLabel: cancelLabelProp, suggestionsLabel: suggestionsLabelProp, allResultsLabel: allResultsLabelProp, noResultsLabel: noResultsLabelProp, searchAllLabel: searchAllLabelProp, hints: hintsProp, }: QuickSearchProps<T>): react.JSX.Element;
|
|
1376
|
+
|
|
1377
|
+
/** Shows the matching parts of a text in bold (`className` on each match). Visual only; screen readers read plain text. */
|
|
1378
|
+
declare function Highlight({ text, query, all, as: Tag, className, }: {
|
|
1379
|
+
text: string;
|
|
1380
|
+
query?: string;
|
|
1381
|
+
all?: boolean;
|
|
1382
|
+
as?: 'mark' | 'span';
|
|
1383
|
+
className?: string;
|
|
1384
|
+
}): ReactNode;
|
|
1385
|
+
|
|
1386
|
+
interface BreadcrumbItem {
|
|
1387
|
+
/** The page name – the same words as its title. */
|
|
1388
|
+
label: string;
|
|
1389
|
+
/** Link to the page. The last item is the current page and needs none. */
|
|
1390
|
+
href?: string;
|
|
1391
|
+
}
|
|
1392
|
+
interface BreadcrumbsProps {
|
|
1393
|
+
/** The path from the top: first the start page, last the current page (not a link). */
|
|
1394
|
+
items: BreadcrumbItem[];
|
|
1395
|
+
/** sm: dense apps (caption, 24) · md: websites (body/sm, 28). */
|
|
1396
|
+
size?: 'sm' | 'md';
|
|
1397
|
+
/** The first item shows a house icon; its label stays the accessible name (“Home”). */
|
|
1398
|
+
homeIcon?: boolean;
|
|
1399
|
+
/** auto: full path, below 640 px only a link to the parent page · full · back. From 5 levels the middle collapses into “…”. */
|
|
1400
|
+
layout?: 'auto' | 'full' | 'back';
|
|
1401
|
+
/** Texts (localize). */
|
|
1402
|
+
'aria-label'?: string;
|
|
1403
|
+
moreLabel?: (count: number) => string;
|
|
1404
|
+
className?: string;
|
|
1405
|
+
}
|
|
1406
|
+
/**
|
|
1407
|
+
* Breadcrumbs – where a page sits in the hierarchy, with links to the levels above.
|
|
1408
|
+
* Built on React Aria Breadcrumbs: a navigation region with an ordered list, the current page last with
|
|
1409
|
+
* aria-current="page". Not on the start page; place it above the page title.
|
|
1410
|
+
*/
|
|
1411
|
+
declare function Breadcrumbs({ items, size, homeIcon, layout, 'aria-label': ariaLabelProp, moreLabel: moreLabelProp, className, }: BreadcrumbsProps): react.JSX.Element | null;
|
|
1412
|
+
|
|
1413
|
+
type AccordionSize = 'md' | 'lg';
|
|
1414
|
+
interface AccordionProps extends Omit<DisclosureGroupProps, 'className' | 'style' | 'children'> {
|
|
1415
|
+
/** md: apps and settings · lg: websites and FAQs. */
|
|
1416
|
+
size?: AccordionSize;
|
|
1417
|
+
/** Heading level of the item titles (h2–h4), matching the page outline. */
|
|
1418
|
+
headingLevel?: 2 | 3 | 4;
|
|
1419
|
+
/** Several sections open at once (default). false: one at a time – only for short, mutually exclusive steps. */
|
|
1420
|
+
allowsMultipleExpanded?: boolean;
|
|
1421
|
+
/** “Expand all” / “Collapse all” above groups with more than 6 sections (multiple only). */
|
|
1422
|
+
expandAll?: boolean;
|
|
1423
|
+
expandAllLabel?: string;
|
|
1424
|
+
collapseAllLabel?: string;
|
|
1425
|
+
/** AccordionItems. */
|
|
1426
|
+
children: ReactNode;
|
|
1427
|
+
className?: string;
|
|
1428
|
+
}
|
|
1429
|
+
/**
|
|
1430
|
+
* Accordion – sections that open and close in place. Built on React Aria DisclosureGroup:
|
|
1431
|
+
* each header is a button inside a real heading (aria-expanded, aria-controls); closed panels stay findable by
|
|
1432
|
+
* the browser search (hidden="until-found"). Several open by default. A link to an item's id (#billing) opens it.
|
|
1433
|
+
*/
|
|
1434
|
+
declare function Accordion({ size, headingLevel, allowsMultipleExpanded, expandAll, expandAllLabel, collapseAllLabel, expandedKeys: expandedProp, defaultExpandedKeys, onExpandedChange, children, className, ...props }: AccordionProps): react.JSX.Element;
|
|
1435
|
+
interface AccordionItemProps {
|
|
1436
|
+
/** Required: key in expandedKeys and the anchor for links (#billing). */
|
|
1437
|
+
id: string;
|
|
1438
|
+
/** Short and scannable: nouns for settings, real questions for FAQs. */
|
|
1439
|
+
title: ReactNode;
|
|
1440
|
+
/** Second line in the header. Announced as the button's description. */
|
|
1441
|
+
description?: ReactNode;
|
|
1442
|
+
/** Decorative icon before the title (20 md / 24 lg). */
|
|
1443
|
+
icon?: ReactNode;
|
|
1444
|
+
/** Badge sm – part of the button name (“Billing, Payment failed”). */
|
|
1445
|
+
badge?: ReactNode;
|
|
1446
|
+
isDisabled?: boolean;
|
|
1447
|
+
/** Panel content – text, a form or a list. No accordion inside. */
|
|
1448
|
+
children: ReactNode;
|
|
1449
|
+
}
|
|
1450
|
+
/** One section of an Accordion: a header button inside a heading and its panel. */
|
|
1451
|
+
declare function AccordionItem({ id, title, description, icon, badge, isDisabled, children }: AccordionItemProps): react.JSX.Element;
|
|
1452
|
+
|
|
1453
|
+
type Value = number | number[];
|
|
1454
|
+
interface SliderProps<T extends Value = number> extends Omit<SliderProps$1<T>, 'children' | 'className' | 'style'> {
|
|
1455
|
+
/** Visible label. Without it set `aria-label`. */
|
|
1456
|
+
label?: ReactNode;
|
|
1457
|
+
/** Range: a name per thumb (“Minimum price”, “Maximum price”). Default: “Minimum” / “Maximum” + label. */
|
|
1458
|
+
thumbLabels?: [string, string];
|
|
1459
|
+
/** Tick marks for few fixed steps (≤ 10) – the thumb snaps to them. */
|
|
1460
|
+
showTicks?: boolean;
|
|
1461
|
+
/** Min and max below the track, when the range is not obvious from the label. */
|
|
1462
|
+
showMinMax?: boolean;
|
|
1463
|
+
/** The value label above the track (always visible by default). */
|
|
1464
|
+
showValue?: boolean;
|
|
1465
|
+
className?: string;
|
|
1466
|
+
}
|
|
1467
|
+
/**
|
|
1468
|
+
* Slider – pick an approximate value or a range by dragging. Built on React Aria Slider:
|
|
1469
|
+
* arrow keys (step), Page Up/Down (10 %), Home/End, a click on the track moves the nearest thumb; range thumbs
|
|
1470
|
+
* never cross. The value is always shown next to the label and read out in the same format (`formatOptions`).
|
|
1471
|
+
* While dragging, a tooltip repeats it above the thumb. For exact values use SliderField.
|
|
1472
|
+
*/
|
|
1473
|
+
declare function Slider<T extends Value = number>({ label, thumbLabels, showTicks, showMinMax, showValue, minValue, maxValue, step, formatOptions, className, ...props }: SliderProps<T>): react.JSX.Element;
|
|
1474
|
+
interface SliderFieldProps<T extends Value = number> extends Omit<SliderProps<T>, 'value' | 'defaultValue' | 'onChange' | 'showValue'> {
|
|
1475
|
+
value: T;
|
|
1476
|
+
onChange: (value: T) => void;
|
|
1477
|
+
/** Accessible names of the number inputs. Default: the label (single) or the thumb labels (range). */
|
|
1478
|
+
inputLabels?: [string, string];
|
|
1479
|
+
}
|
|
1480
|
+
/**
|
|
1481
|
+
* Slider field – a Slider plus number inputs for exact values. Single: input on the
|
|
1482
|
+
* right (88). Range: two inputs below (min – max). Slider and inputs stay in sync; the inputs clamp on blur.
|
|
1483
|
+
*/
|
|
1484
|
+
declare function SliderField<T extends Value = number>({ value, onChange, inputLabels, ...props }: SliderFieldProps<T>): react.JSX.Element;
|
|
1485
|
+
|
|
1486
|
+
interface NumberFieldProps extends Omit<NumberFieldProps$1, 'children' | 'className' | 'style'> {
|
|
1487
|
+
/** Visible label. Without it set `aria-label` – only where the context names the field (e.g. next to a Slider). */
|
|
1488
|
+
label?: ReactNode;
|
|
1489
|
+
description?: ReactNode;
|
|
1490
|
+
errorMessage?: ReactNode;
|
|
1491
|
+
placeholder?: string;
|
|
1492
|
+
/** sm 32 · md 40 · lg 48 px. lg on mobile and touch. */
|
|
1493
|
+
size?: InputSize;
|
|
1494
|
+
className?: string;
|
|
1495
|
+
}
|
|
1496
|
+
/**
|
|
1497
|
+
* Number field – a number with format and limits. Built on React Aria
|
|
1498
|
+
* NumberField: formats with Intl (`formatOptions`: currency, percent, unit), clamps to min/max and rounds to the
|
|
1499
|
+
* step when the field is left, ↑ ↓ change by one step. Tabular figures.
|
|
1500
|
+
*/
|
|
1501
|
+
declare function NumberField({ label, description, errorMessage, placeholder, size, className, ...props }: NumberFieldProps): react.JSX.Element;
|
|
1502
|
+
|
|
1503
|
+
interface LinkProps extends Omit<LinkProps$1, 'children' | 'className'> {
|
|
1504
|
+
/** The text says where it goes (“Privacy policy”, not “click here”). */
|
|
1505
|
+
children: ReactNode;
|
|
1506
|
+
/** inline: inside running text, always underlined · standalone: own line, underline on hover. */
|
|
1507
|
+
variant?: 'inline' | 'standalone';
|
|
1508
|
+
/** Standalone only: sm (label/sm) · md (label/md). Inline links take the size of the surrounding text. */
|
|
1509
|
+
size?: 'sm' | 'md';
|
|
1510
|
+
/** Another website: shows the external icon. With target="_blank" screen readers also hear “opens in a new tab”. */
|
|
1511
|
+
external?: boolean;
|
|
1512
|
+
/** Standalone only: arrow after the text (“View all →”). */
|
|
1513
|
+
arrow?: boolean;
|
|
1514
|
+
/** Hidden text for links that open a new tab. */
|
|
1515
|
+
newTabLabel?: string;
|
|
1516
|
+
className?: string;
|
|
1517
|
+
}
|
|
1518
|
+
/**
|
|
1519
|
+
* Link – navigates to a page, place or file. Built on React Aria Link:
|
|
1520
|
+
* a real `<a href>`, works with client-side routers through RouterProvider. For actions use Button.
|
|
1521
|
+
*/
|
|
1522
|
+
declare function Link({ children, variant, size, external, arrow, newTabLabel, className, ...props }: LinkProps): react.JSX.Element;
|
|
1523
|
+
|
|
1524
|
+
type AlertTone = 'info' | 'success' | 'warning' | 'danger';
|
|
1525
|
+
interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
1526
|
+
/** danger: failed or blocks · warning: risk ahead · success: done · info: good to know. */
|
|
1527
|
+
tone?: AlertTone;
|
|
1528
|
+
/** inline: in the content · banner: full width above the header, for app-wide states. */
|
|
1529
|
+
variant?: 'inline' | 'banner';
|
|
1530
|
+
/** Required. Says what happened (“Your trial ends in 3 days”). */
|
|
1531
|
+
title: ReactNode;
|
|
1532
|
+
/** What to do next. */
|
|
1533
|
+
children?: ReactNode;
|
|
1534
|
+
/** Max two text buttons (Button variant="text" size="sm"), the main one first. */
|
|
1535
|
+
actions?: ReactNode;
|
|
1536
|
+
/** Shows the close button. Only when it is safe to hide the message. */
|
|
1537
|
+
onDismiss?: () => void;
|
|
1538
|
+
dismissLabel?: string;
|
|
1539
|
+
/**
|
|
1540
|
+
* Set when the alert appears after the page has loaded: danger and warning are announced
|
|
1541
|
+
* immediately (role="alert"), info and success politely (role="status").
|
|
1542
|
+
*/
|
|
1543
|
+
announce?: boolean;
|
|
1544
|
+
}
|
|
1545
|
+
/** Alert – persistent message inside the page. Plain markup, no library needed. */
|
|
1546
|
+
declare function Alert({ tone, variant, title, children, actions, onDismiss, dismissLabel, announce, className, ...props }: AlertProps): react.JSX.Element;
|
|
1547
|
+
|
|
1548
|
+
interface CardProps {
|
|
1549
|
+
/** Required: every card has a heading, so it can be scanned and announced. */
|
|
1550
|
+
title: ReactNode;
|
|
1551
|
+
subtitle?: ReactNode;
|
|
1552
|
+
/** Heading level of the title. Match the page outline (default h3). */
|
|
1553
|
+
headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
1554
|
+
/** outlined (default) · elevated (needs attention, draggable) · filled (inside white areas) · brand (one per view) · plain (editorial). */
|
|
1555
|
+
variant?: 'outlined' | 'elevated' | 'filled' | 'brand' | 'plain';
|
|
1556
|
+
/** standard 24 px · compact 16 px (dense layouts and mobile). */
|
|
1557
|
+
density?: 'standard' | 'compact';
|
|
1558
|
+
/** vertical (media on top, 16:9) · horizontal (media 180 px left, for lists). */
|
|
1559
|
+
layout?: 'vertical' | 'horizontal';
|
|
1560
|
+
/** Image or video. Decorative images use alt="". */
|
|
1561
|
+
media?: ReactNode;
|
|
1562
|
+
/** Actions for the whole card, next to the title (ButtonGroup context="header"). */
|
|
1563
|
+
headerActions?: ReactNode;
|
|
1564
|
+
/** Actions that finish a task in the card (ButtonGroup context="footer"). */
|
|
1565
|
+
footer?: ReactNode;
|
|
1566
|
+
/** Makes the whole card open something: the title becomes one link stretched over the card. */
|
|
1567
|
+
href?: LinkProps$1['href'];
|
|
1568
|
+
/** Link props such as target or routerOptions. */
|
|
1569
|
+
linkProps?: Omit<LinkProps$1, 'href' | 'children' | 'className'>;
|
|
1570
|
+
children?: ReactNode;
|
|
1571
|
+
className?: string;
|
|
1572
|
+
style?: CSSProperties;
|
|
1573
|
+
}
|
|
1574
|
+
/** Card – a container for one topic. Rendered as an article with a heading. */
|
|
1575
|
+
declare function Card({ title, subtitle, headingLevel, variant, density, layout, media, headerActions, footer, href, linkProps, children, className, style, }: CardProps): react.JSX.Element;
|
|
1576
|
+
|
|
1577
|
+
type Density = 'standard' | 'compact';
|
|
1578
|
+
interface StaticTableProps {
|
|
1579
|
+
/** thead / tbody / tr / th / td as usual. Use <th scope="row"> for row headers. */
|
|
1580
|
+
children: ReactNode;
|
|
1581
|
+
/** Visible caption or, with captionHidden, a name for screen readers. */
|
|
1582
|
+
caption?: ReactNode;
|
|
1583
|
+
captionHidden?: boolean;
|
|
1584
|
+
density?: Density;
|
|
1585
|
+
striped?: boolean;
|
|
1586
|
+
/** Without the border and radius, e.g. inside a card or documentation. */
|
|
1587
|
+
plain?: boolean;
|
|
1588
|
+
className?: string;
|
|
1589
|
+
style?: CSSProperties;
|
|
1590
|
+
}
|
|
1591
|
+
/**
|
|
1592
|
+
* Static table – a native, non-interactive table with the Table look.
|
|
1593
|
+
* For content and simple data. Numbers: add className="medo-table__cell--number".
|
|
1594
|
+
* When it is wider than its container it scrolls sideways; the container then takes the keyboard focus
|
|
1595
|
+
* (arrow keys scroll) and is announced as a region named by the caption.
|
|
1596
|
+
*/
|
|
1597
|
+
declare function StaticTable({ children, caption, captionHidden, density, striped, plain, className, style }: StaticTableProps): react.JSX.Element;
|
|
1598
|
+
interface TableProps extends Omit<TableProps$1, 'className' | 'style'> {
|
|
1599
|
+
density?: Density;
|
|
1600
|
+
/** Bar above the header: search (Input sm 240), filter, ColumnsMenu, primary action on the right (Buttons sm). */
|
|
1601
|
+
toolbar?: ReactNode;
|
|
1602
|
+
/** Bar below the rows, usually Pagination. */
|
|
1603
|
+
footer?: ReactNode;
|
|
1604
|
+
striped?: boolean;
|
|
1605
|
+
plain?: boolean;
|
|
1606
|
+
className?: string;
|
|
1607
|
+
style?: CSSProperties;
|
|
1608
|
+
}
|
|
1609
|
+
/**
|
|
1610
|
+
* Table – interactive data table. Built on React Aria Table:
|
|
1611
|
+
* arrow keys move between cells, Space selects, Enter opens, sortable headers announce the order.
|
|
1612
|
+
* Data logic (sorting, filtering, paging) stays in your code or a headless table library.
|
|
1613
|
+
*/
|
|
1614
|
+
declare function Table({ density, striped, plain, toolbar, footer, className, style, ...props }: TableProps): react.JSX.Element;
|
|
1615
|
+
declare function TableHeader<T extends object>({ columns, children, ...props }: Omit<TableHeaderProps<T>, 'className'>): react.JSX.Element;
|
|
1616
|
+
interface ColumnProps extends Omit<ColumnProps$1, 'className' | 'children'> {
|
|
1617
|
+
children: ReactNode;
|
|
1618
|
+
/** end: numbers, amounts, dates – right-aligned with tabular figures. */
|
|
1619
|
+
align?: 'start' | 'end';
|
|
1620
|
+
}
|
|
1621
|
+
/** Header cell. With allowsSorting it is a button: ascending → descending → ascending. */
|
|
1622
|
+
declare function Column({ children, align, ...props }: ColumnProps): react.JSX.Element;
|
|
1623
|
+
declare function TableBody<T extends object>(props: Omit<TableBodyProps<T>, 'className'>): react.JSX.Element;
|
|
1624
|
+
declare function Row<T extends object>({ id, columns, children, ...props }: Omit<RowProps<T>, 'className'>): react.JSX.Element;
|
|
1625
|
+
interface CellProps extends Omit<CellProps$1, 'className'> {
|
|
1626
|
+
align?: 'start' | 'end';
|
|
1627
|
+
}
|
|
1628
|
+
declare function Cell({ align, ...props }: CellProps): react.JSX.Element;
|
|
1629
|
+
|
|
1630
|
+
interface ColumnOption {
|
|
1631
|
+
id: string;
|
|
1632
|
+
label: string;
|
|
1633
|
+
/** Can't be hidden: the first column (row header) and actions. */
|
|
1634
|
+
isLocked?: boolean;
|
|
1635
|
+
}
|
|
1636
|
+
interface ColumnsMenuProps {
|
|
1637
|
+
/** All columns that can be shown, in table order. */
|
|
1638
|
+
columns: ColumnOption[];
|
|
1639
|
+
/** Ids of the visible columns. */
|
|
1640
|
+
visibleColumns: string[];
|
|
1641
|
+
onVisibleColumnsChange: (ids: string[]) => void;
|
|
1642
|
+
/** Button label. */
|
|
1643
|
+
label?: string;
|
|
1644
|
+
/** Title of the list. */
|
|
1645
|
+
title?: string;
|
|
1646
|
+
}
|
|
1647
|
+
/**
|
|
1648
|
+
* Columns menu – shows or hides table columns. A ghost button sm in the
|
|
1649
|
+
* table toolbar opens a Popover sm with checkboxes; locked columns stay visible. Render only the visible columns.
|
|
1650
|
+
*/
|
|
1651
|
+
declare function ColumnsMenu({ columns, visibleColumns, onVisibleColumnsChange, label: labelProp, title: titleProp }: ColumnsMenuProps): react.JSX.Element;
|
|
1652
|
+
|
|
1653
|
+
/** “2.4 MB”, “860 kB” – decimal units like the operating systems' file dialogs. */
|
|
1654
|
+
declare function formatBytes(bytes: number, locale?: string): string;
|
|
1655
|
+
interface UploadFile {
|
|
1656
|
+
/** Stable id (e.g. crypto.randomUUID() when the file is added). */
|
|
1657
|
+
id: string;
|
|
1658
|
+
name: string;
|
|
1659
|
+
/** Size in bytes. */
|
|
1660
|
+
size: number;
|
|
1661
|
+
/** MIME type. image/* with a `previewUrl` shows a thumbnail, everything else a type icon. */
|
|
1662
|
+
type?: string;
|
|
1663
|
+
status: 'uploading' | 'done' | 'error';
|
|
1664
|
+
/** Uploaded bytes (ProgressEvent.loaded). Without it the bar is indeterminate. */
|
|
1665
|
+
loaded?: number;
|
|
1666
|
+
/** What happened and how to fix it (“Upload interrupted. Check your connection and retry.”). No error codes. */
|
|
1667
|
+
error?: string;
|
|
1668
|
+
/** Thumbnail (URL.createObjectURL(file) or the server URL). */
|
|
1669
|
+
previewUrl?: string;
|
|
1670
|
+
/** false hides “Retry” (e.g. the server rejected the file). Default true. */
|
|
1671
|
+
canRetry?: boolean;
|
|
1672
|
+
}
|
|
1673
|
+
interface UploadTexts {
|
|
1674
|
+
/** Dropzone and trigger. */
|
|
1675
|
+
title: string;
|
|
1676
|
+
dropTitle: string;
|
|
1677
|
+
chooseFiles: string;
|
|
1678
|
+
chooseFile: string;
|
|
1679
|
+
listLabel: string;
|
|
1680
|
+
/** File actions – always name the file. */
|
|
1681
|
+
cancel: (name: string) => string;
|
|
1682
|
+
remove: (name: string) => string;
|
|
1683
|
+
retry: (name: string) => string;
|
|
1684
|
+
retryShort: string;
|
|
1685
|
+
/** Name of the progress bar. */
|
|
1686
|
+
uploading: (name: string) => string;
|
|
1687
|
+
/** “1.6 of 2.4 MB · 64 %” */
|
|
1688
|
+
progress: (loaded: string, total: string, percent: number) => string;
|
|
1689
|
+
/** Validation. */
|
|
1690
|
+
typeNotAllowed: (names: string, types: string) => string;
|
|
1691
|
+
tooLarge: (size: string, max: string) => string;
|
|
1692
|
+
tooMany: (max: number) => string;
|
|
1693
|
+
/** Polite announcements. */
|
|
1694
|
+
uploaded: (name: string) => string;
|
|
1695
|
+
failed: (name: string, error: string) => string;
|
|
1696
|
+
}
|
|
1697
|
+
/** English defaults. The components use the texts of the current language (see i18n). */
|
|
1698
|
+
declare const defaultUploadTexts: UploadTexts;
|
|
1699
|
+
interface ItemActions {
|
|
1700
|
+
onRemove: (id: string) => void;
|
|
1701
|
+
onCancel?: (id: string) => void;
|
|
1702
|
+
onRetry?: (id: string) => void;
|
|
1703
|
+
texts?: Partial<UploadTexts>;
|
|
1704
|
+
}
|
|
1705
|
+
interface FileItemProps extends ItemActions {
|
|
1706
|
+
file: UploadFile;
|
|
1707
|
+
className?: string;
|
|
1708
|
+
}
|
|
1709
|
+
/**
|
|
1710
|
+
* File item – one file in the upload list. Uploading: progress + cancel · Done: size +
|
|
1711
|
+
* remove · Error: the reason + retry + remove. Images show a 40 px thumbnail, other files a type icon.
|
|
1712
|
+
*/
|
|
1713
|
+
declare function FileItem({ file, onRemove, onCancel, onRetry, texts: own, className }: FileItemProps): react.JSX.Element;
|
|
1714
|
+
interface FileTileProps extends ItemActions {
|
|
1715
|
+
file: UploadFile;
|
|
1716
|
+
className?: string;
|
|
1717
|
+
}
|
|
1718
|
+
/**
|
|
1719
|
+
* File tile – an image in the grid view. Uploading: dark overlay with % and bar ·
|
|
1720
|
+
* Done: remove top right · Error: danger border, the overlay retries, the caption names the problem.
|
|
1721
|
+
*/
|
|
1722
|
+
declare function FileTile({ file, onRemove, onCancel, onRetry, texts: own, className }: FileTileProps): react.JSX.Element;
|
|
1723
|
+
interface PickerProps {
|
|
1724
|
+
/** Accepted types as for <input accept>: [“.pdf”, “image/*”]. Checked again before upload. */
|
|
1725
|
+
acceptedFileTypes?: string[];
|
|
1726
|
+
/** Several files at once. Default true. */
|
|
1727
|
+
allowsMultiple?: boolean;
|
|
1728
|
+
/** Mobile: open the camera first (“environment” = back camera). */
|
|
1729
|
+
defaultCamera?: 'user' | 'environment';
|
|
1730
|
+
isDisabled?: boolean;
|
|
1731
|
+
/** Types, size and count – shown before the user picks a file. */
|
|
1732
|
+
hint?: ReactNode;
|
|
1733
|
+
/** Validation or required message. Never only by color. */
|
|
1734
|
+
errorMessage?: ReactNode;
|
|
1735
|
+
onSelect: (files: File[]) => void;
|
|
1736
|
+
texts?: Partial<UploadTexts>;
|
|
1737
|
+
className?: string;
|
|
1738
|
+
}
|
|
1739
|
+
interface DropzoneProps extends PickerProps {
|
|
1740
|
+
/** Ids of elements that also name the zone (the field label). */
|
|
1741
|
+
'aria-labelledby'?: string;
|
|
1742
|
+
}
|
|
1743
|
+
/**
|
|
1744
|
+
* Dropzone – drag and drop files or choose them. Built on React Aria DropZone +
|
|
1745
|
+
* FileTrigger: the button always opens the system picker (drag and drop is only a shortcut, WCAG 2.5.7),
|
|
1746
|
+
* the zone is focusable for paste (Ctrl+V). Below 640 px use the FileTrigger instead.
|
|
1747
|
+
*/
|
|
1748
|
+
declare function Dropzone({ acceptedFileTypes, allowsMultiple, defaultCamera, isDisabled, hint, errorMessage, onSelect, texts: own, className, ...props }: DropzoneProps): react.JSX.Element;
|
|
1749
|
+
interface FileTriggerProps extends PickerProps {
|
|
1750
|
+
label?: ReactNode;
|
|
1751
|
+
/** Visual marker; check “at least one file” on submit and pass `errorMessage`. */
|
|
1752
|
+
isRequired?: boolean;
|
|
1753
|
+
}
|
|
1754
|
+
/**
|
|
1755
|
+
* File trigger – compact upload for forms and mobile: label, Button secondary with
|
|
1756
|
+
* upload icon, hint, error. The system picker offers camera, photos and files on touch devices.
|
|
1757
|
+
*/
|
|
1758
|
+
declare function FileTrigger({ label, isRequired, acceptedFileTypes, allowsMultiple, defaultCamera, isDisabled, hint, errorMessage, onSelect, texts: own, className, }: FileTriggerProps): react.JSX.Element;
|
|
1759
|
+
interface UploadFieldProps extends Omit<ItemActions, 'texts'> {
|
|
1760
|
+
/** Visible label. Without it set `aria-label`. */
|
|
1761
|
+
label?: ReactNode;
|
|
1762
|
+
'aria-label'?: string;
|
|
1763
|
+
/** The files – controlled. The app uploads them (fetch, S3, tus …) and updates status and `loaded`. */
|
|
1764
|
+
files: UploadFile[];
|
|
1765
|
+
/** Files that passed type, size and count. Start the upload right away. */
|
|
1766
|
+
onAdd: (files: File[]) => void;
|
|
1767
|
+
/**
|
|
1768
|
+
* auto: Dropzone + list, below 640 px the File trigger (default) · list · compact (File trigger + list, forms) ·
|
|
1769
|
+
* grid (images only: tiles; below 640 px with the File trigger).
|
|
1770
|
+
*/
|
|
1771
|
+
layout?: 'auto' | 'list' | 'compact' | 'grid';
|
|
1772
|
+
acceptedFileTypes?: string[];
|
|
1773
|
+
/** Readable form of the types for hint and message (“PDF, JPG or PNG”). */
|
|
1774
|
+
typesLabel?: string;
|
|
1775
|
+
/** Max size per file in bytes. */
|
|
1776
|
+
maxSize?: number;
|
|
1777
|
+
/** Max number of files. 1 = single file picker. */
|
|
1778
|
+
maxFiles?: number;
|
|
1779
|
+
defaultCamera?: 'user' | 'environment';
|
|
1780
|
+
/** Default: “{typesLabel} · max. {maxSize} each”. */
|
|
1781
|
+
hint?: ReactNode;
|
|
1782
|
+
/** Field error from the app (e.g. required on submit). Wins over the built-in validation message. */
|
|
1783
|
+
errorMessage?: ReactNode;
|
|
1784
|
+
isRequired?: boolean;
|
|
1785
|
+
isDisabled?: boolean;
|
|
1786
|
+
texts?: Partial<UploadTexts>;
|
|
1787
|
+
className?: string;
|
|
1788
|
+
}
|
|
1789
|
+
/**
|
|
1790
|
+
* Upload field – ready composition. Checks type, size and count in the browser
|
|
1791
|
+
* before anything is uploaded (check again on the server). Rejected types and too many files show at the
|
|
1792
|
+
* picker, too large files as an error row – removable. Results are announced in a polite live region.
|
|
1793
|
+
*/
|
|
1794
|
+
declare function UploadField({ label, 'aria-label': ariaLabel, files, onAdd, onRemove, onCancel, onRetry, layout, acceptedFileTypes, typesLabel, maxSize, maxFiles, defaultCamera, hint, errorMessage, isRequired, isDisabled, texts: own, className, }: UploadFieldProps): react.JSX.Element;
|
|
1795
|
+
|
|
1796
|
+
interface CalendarTexts {
|
|
1797
|
+
previousMonth: string;
|
|
1798
|
+
nextMonth: string;
|
|
1799
|
+
previousYear: string;
|
|
1800
|
+
nextYear: string;
|
|
1801
|
+
previousYears: string;
|
|
1802
|
+
nextYears: string;
|
|
1803
|
+
/** Name of the month-and-year button: “October 2026 – choose month and year”. */
|
|
1804
|
+
chooseMonth: (title: string) => string;
|
|
1805
|
+
chooseYear: (year: string) => string;
|
|
1806
|
+
weekNumber: string;
|
|
1807
|
+
}
|
|
1808
|
+
/** English defaults. The components use the texts of the current language (see i18n). */
|
|
1809
|
+
declare const defaultCalendarTexts: CalendarTexts;
|
|
1810
|
+
interface SharedProps {
|
|
1811
|
+
/** md: 40 px days for desktop popovers · lg: 48 px for touch (Bottom Sheet). */
|
|
1812
|
+
size?: 'md' | 'lg';
|
|
1813
|
+
/** ISO week numbers (KW) before each row. */
|
|
1814
|
+
showWeekNumbers?: boolean;
|
|
1815
|
+
texts?: Partial<CalendarTexts>;
|
|
1816
|
+
className?: string;
|
|
1817
|
+
}
|
|
1818
|
+
interface CalendarProps<T extends DateValue> extends Omit<CalendarProps$1<T>, 'children' | 'className' | 'style' | 'visibleDuration'>, SharedProps {
|
|
1819
|
+
}
|
|
1820
|
+
/**
|
|
1821
|
+
* Calendar – pick a day. React Aria Calendar: a grid with arrow keys (day/week),
|
|
1822
|
+
* Page Up/Down (month), Shift + Page Up/Down (year), Home/End. The month-and-year button switches to a month
|
|
1823
|
+
* grid, then a year grid – far dates in three clicks. Weekdays and the first day of the week from the locale.
|
|
1824
|
+
*/
|
|
1825
|
+
declare function Calendar<T extends DateValue>({ size, showWeekNumbers, texts, className, ...props }: CalendarProps<T>): react.JSX.Element;
|
|
1826
|
+
interface RangeCalendarProps<T extends DateValue> extends Omit<RangeCalendarProps$1<T>, 'children' | 'className' | 'style' | 'visibleDuration'>, SharedProps {
|
|
1827
|
+
/** auto: two months on desktop, one below 640 px. */
|
|
1828
|
+
visibleMonths?: 'auto' | 1 | 2;
|
|
1829
|
+
}
|
|
1830
|
+
/**
|
|
1831
|
+
* Range calendar – pick a start and an end day. The first click sets the
|
|
1832
|
+
* start, the second the end; hovering previews the range. Two months side by side on desktop, one on mobile.
|
|
1833
|
+
*/
|
|
1834
|
+
declare function RangeCalendar<T extends DateValue>({ size, showWeekNumbers, visibleMonths, texts, className, ...props }: RangeCalendarProps<T>): react.JSX.Element;
|
|
1835
|
+
|
|
1836
|
+
interface FieldBase {
|
|
1837
|
+
/** Visible label. Without it set `aria-label`. */
|
|
1838
|
+
label?: ReactNode;
|
|
1839
|
+
description?: ReactNode;
|
|
1840
|
+
/** A function gets the validation details (rangeUnderflow, rangeOverflow, badInput) – name the rule. */
|
|
1841
|
+
errorMessage?: ReactNode | ((validation: ValidationResult) => ReactNode);
|
|
1842
|
+
/** md 40 (desktop) · lg 48 (touch, below 640 px). */
|
|
1843
|
+
size?: 'md' | 'lg';
|
|
1844
|
+
className?: string;
|
|
1845
|
+
}
|
|
1846
|
+
interface DateFieldProps<T extends DateValue> extends Omit<DateFieldProps$1<T>, 'children' | 'className' | 'style'>, FieldBase {
|
|
1847
|
+
}
|
|
1848
|
+
/**
|
|
1849
|
+
* Date field – type a date without a calendar. React Aria DateField: every segment is a
|
|
1850
|
+
* spinbutton (“day”, “month”, “year”), ↑ ↓ change it, ← → move, Backspace clears, a pasted date fills all.
|
|
1851
|
+
* `granularity="minute"` adds the time. For a calendar use DatePicker.
|
|
1852
|
+
*/
|
|
1853
|
+
declare function DateField<T extends DateValue>({ label, description, errorMessage, size, className, ...props }: DateFieldProps<T>): react.JSX.Element;
|
|
1854
|
+
interface TimeSlot {
|
|
1855
|
+
value: TimeValue;
|
|
1856
|
+
/** Booked slots stay visible, disabled, with the reason (“Booked”). */
|
|
1857
|
+
isDisabled?: boolean;
|
|
1858
|
+
reason?: string;
|
|
1859
|
+
}
|
|
1860
|
+
interface TimeFieldProps extends Omit<TimeFieldProps$1<TimeValue>, 'children' | 'className' | 'style'>, FieldBase {
|
|
1861
|
+
/** Optional fixed times (e.g. every 15 min). Adds a clock button that opens them. No clock faces. */
|
|
1862
|
+
slots?: TimeSlot[];
|
|
1863
|
+
/** Name of the clock button and the list. */
|
|
1864
|
+
slotsLabel?: string;
|
|
1865
|
+
}
|
|
1866
|
+
/**
|
|
1867
|
+
* Time field – type a time. HH:MM, 24 h in de – from the locale. Typing only;
|
|
1868
|
+
* with `slots` a clock button opens a list of fixed times (bookings), booked ones disabled with a reason.
|
|
1869
|
+
*/
|
|
1870
|
+
declare function TimeField({ label, description, errorMessage, size, slots, slotsLabel: slotsLabelProp, className, defaultValue, onChange, ...props }: TimeFieldProps): react.JSX.Element;
|
|
1871
|
+
|
|
1872
|
+
/**
|
|
1873
|
+
* Built-in texts of the components: button labels, screen-reader names, announcements, validation messages.
|
|
1874
|
+
* One object per language (en.ts, de.ts). TypeScript checks that every language has every text with the
|
|
1875
|
+
* right parameters. A component prop (e.g. `closeLabel`) always wins over these defaults.
|
|
1876
|
+
*/
|
|
1877
|
+
interface Messages {
|
|
1878
|
+
common: {
|
|
1879
|
+
close: string;
|
|
1880
|
+
cancel: string;
|
|
1881
|
+
back: string;
|
|
1882
|
+
more: string;
|
|
1883
|
+
done: string;
|
|
1884
|
+
search: string;
|
|
1885
|
+
showResults: string;
|
|
1886
|
+
loading: string;
|
|
1887
|
+
clear: string;
|
|
1888
|
+
clearAll: string;
|
|
1889
|
+
noResults: string;
|
|
1890
|
+
noResultsFor: (query: string) => string;
|
|
1891
|
+
/** Name of a chosen value list: “Assignee: selected”. */
|
|
1892
|
+
selected: (name: string) => string;
|
|
1893
|
+
/** Announcement after removing values: “Design removed”. */
|
|
1894
|
+
removed: (labels: string[]) => string;
|
|
1895
|
+
/** Combobox: row that creates a new value. */
|
|
1896
|
+
add: (text: string) => string;
|
|
1897
|
+
create: string;
|
|
1898
|
+
reset: string;
|
|
1899
|
+
/** Sheet footer: “3 selected”. */
|
|
1900
|
+
countSelected: (count: number) => string;
|
|
1901
|
+
/** Fallback name of chosen values without a text label. */
|
|
1902
|
+
selectedValues: string;
|
|
1903
|
+
};
|
|
1904
|
+
/** Key names in shortcuts (⌘, ⇧ and Alt are the same everywhere). */
|
|
1905
|
+
keys: {
|
|
1906
|
+
control: string;
|
|
1907
|
+
};
|
|
1908
|
+
accordion: {
|
|
1909
|
+
expandAll: string;
|
|
1910
|
+
collapseAll: string;
|
|
1911
|
+
};
|
|
1912
|
+
alert: {
|
|
1913
|
+
dismiss: string;
|
|
1914
|
+
};
|
|
1915
|
+
avatar: {
|
|
1916
|
+
status: Record<'online' | 'away' | 'busy' | 'offline', string>;
|
|
1917
|
+
unknownPerson: string;
|
|
1918
|
+
unknownOrganization: string;
|
|
1919
|
+
more: (count: number) => string;
|
|
1920
|
+
};
|
|
1921
|
+
breadcrumbs: {
|
|
1922
|
+
label: string;
|
|
1923
|
+
more: (count: number) => string;
|
|
1924
|
+
};
|
|
1925
|
+
bulkActionBar: {
|
|
1926
|
+
label: string;
|
|
1927
|
+
count: (count: number) => string;
|
|
1928
|
+
clear: string;
|
|
1929
|
+
more: string;
|
|
1930
|
+
};
|
|
1931
|
+
calendar: {
|
|
1932
|
+
previousMonth: string;
|
|
1933
|
+
nextMonth: string;
|
|
1934
|
+
previousYear: string;
|
|
1935
|
+
nextYear: string;
|
|
1936
|
+
previousYears: string;
|
|
1937
|
+
nextYears: string;
|
|
1938
|
+
chooseMonth: (title: string) => string;
|
|
1939
|
+
chooseYear: (year: string) => string;
|
|
1940
|
+
weekNumber: string;
|
|
1941
|
+
};
|
|
1942
|
+
datePicker: {
|
|
1943
|
+
openCalendar: string;
|
|
1944
|
+
time: string;
|
|
1945
|
+
presets: string;
|
|
1946
|
+
beforeMin: (date: string) => string;
|
|
1947
|
+
afterMax: (date: string) => string;
|
|
1948
|
+
unavailable: string;
|
|
1949
|
+
reversed: string;
|
|
1950
|
+
today: string;
|
|
1951
|
+
yesterday: string;
|
|
1952
|
+
last7Days: string;
|
|
1953
|
+
last14Days: string;
|
|
1954
|
+
last30Days: string;
|
|
1955
|
+
thisMonth: string;
|
|
1956
|
+
lastMonth: string;
|
|
1957
|
+
availableTimes: string;
|
|
1958
|
+
};
|
|
1959
|
+
dialog: {
|
|
1960
|
+
discardTitle: string;
|
|
1961
|
+
discardDescription: string;
|
|
1962
|
+
discardAction: string;
|
|
1963
|
+
discardCancel: string;
|
|
1964
|
+
};
|
|
1965
|
+
embed: {
|
|
1966
|
+
video: EmbedMessages;
|
|
1967
|
+
map: EmbedMessages;
|
|
1968
|
+
generic: EmbedMessages;
|
|
1969
|
+
privacy: string;
|
|
1970
|
+
};
|
|
1971
|
+
list: {
|
|
1972
|
+
notIncluded: string;
|
|
1973
|
+
};
|
|
1974
|
+
listView: {
|
|
1975
|
+
unread: string;
|
|
1976
|
+
};
|
|
1977
|
+
navigation: {
|
|
1978
|
+
skipToContent: string;
|
|
1979
|
+
main: string;
|
|
1980
|
+
app: string;
|
|
1981
|
+
menu: string;
|
|
1982
|
+
collapse: string;
|
|
1983
|
+
expand: string;
|
|
1984
|
+
};
|
|
1985
|
+
pagination: {
|
|
1986
|
+
label: string;
|
|
1987
|
+
summary: (from: number, to: number, total: number) => string;
|
|
1988
|
+
pageSize: string;
|
|
1989
|
+
previous: string;
|
|
1990
|
+
next: string;
|
|
1991
|
+
page: (page: number) => string;
|
|
1992
|
+
pageOf: (page: number, total: number) => string;
|
|
1993
|
+
};
|
|
1994
|
+
quickSearch: {
|
|
1995
|
+
placeholder: string;
|
|
1996
|
+
suggestions: string;
|
|
1997
|
+
allResults: (query: string) => string;
|
|
1998
|
+
noResults: (query: string) => string;
|
|
1999
|
+
searchAll: (query: string) => string;
|
|
2000
|
+
navigate: string;
|
|
2001
|
+
open: string;
|
|
2002
|
+
};
|
|
2003
|
+
searchField: {
|
|
2004
|
+
clear: string;
|
|
2005
|
+
};
|
|
2006
|
+
select: {
|
|
2007
|
+
placeholder: string;
|
|
2008
|
+
clearSelection: string;
|
|
2009
|
+
};
|
|
2010
|
+
combobox: {
|
|
2011
|
+
placeholder: string;
|
|
2012
|
+
};
|
|
2013
|
+
slider: {
|
|
2014
|
+
minimum: (label: string) => string;
|
|
2015
|
+
maximum: (label: string) => string;
|
|
2016
|
+
};
|
|
2017
|
+
/** scrollRegion: name of a table that scrolls sideways and has no caption. */
|
|
2018
|
+
table: {
|
|
2019
|
+
columns: string;
|
|
2020
|
+
showColumns: string;
|
|
2021
|
+
scrollRegion: string;
|
|
2022
|
+
};
|
|
2023
|
+
textField: {
|
|
2024
|
+
counter: (count: number, limit: number) => string;
|
|
2025
|
+
tooMany: (over: number) => string;
|
|
2026
|
+
/** Announcement after a pause. */
|
|
2027
|
+
charactersLeft: (left: number) => string;
|
|
2028
|
+
charactersTooMany: (over: number) => string;
|
|
2029
|
+
};
|
|
2030
|
+
upload: {
|
|
2031
|
+
title: string;
|
|
2032
|
+
dropTitle: string;
|
|
2033
|
+
chooseFiles: string;
|
|
2034
|
+
chooseFile: string;
|
|
2035
|
+
listLabel: string;
|
|
2036
|
+
cancel: (name: string) => string;
|
|
2037
|
+
remove: (name: string) => string;
|
|
2038
|
+
retry: (name: string) => string;
|
|
2039
|
+
retryShort: string;
|
|
2040
|
+
uploading: (name: string) => string;
|
|
2041
|
+
progress: (loaded: string, total: string, percent: number) => string;
|
|
2042
|
+
typeNotAllowed: (names: string, types: string) => string;
|
|
2043
|
+
tooLarge: (size: string, max: string) => string;
|
|
2044
|
+
tooMany: (max: number) => string;
|
|
2045
|
+
uploaded: (name: string) => string;
|
|
2046
|
+
failed: (name: string, error: string) => string;
|
|
2047
|
+
};
|
|
2048
|
+
}
|
|
2049
|
+
/** Texts of the Embed consent for one type. provider: the service (“Example Video”), to: who receives the data (“Example Inc.”). */
|
|
2050
|
+
interface EmbedMessages {
|
|
2051
|
+
title: string;
|
|
2052
|
+
body: (provider: string | undefined, to: string | undefined) => string;
|
|
2053
|
+
bodyCompact: (provider: string | undefined, company: string | undefined, to: string | undefined) => string;
|
|
2054
|
+
load: string;
|
|
2055
|
+
remember: (provider: string | undefined) => string;
|
|
2056
|
+
}
|
|
2057
|
+
|
|
2058
|
+
declare const de: Messages;
|
|
2059
|
+
|
|
2060
|
+
/** English (default and fallback). */
|
|
2061
|
+
declare const en: Messages;
|
|
2062
|
+
|
|
2063
|
+
/**
|
|
2064
|
+
* Own texts for all components below, e.g. another language or a different tone:
|
|
2065
|
+
* <MessagesProvider messages={{ ...enMessages, common: { ...enMessages.common, close: 'Fermer' } }}>
|
|
2066
|
+
* Wins over the built-in languages. Props of a single component still win over both.
|
|
2067
|
+
*/
|
|
2068
|
+
declare function MessagesProvider({ messages, children }: {
|
|
2069
|
+
messages: Messages;
|
|
2070
|
+
children: ReactNode;
|
|
2071
|
+
}): react.JSX.Element;
|
|
2072
|
+
/** The built-in texts for the current language. */
|
|
2073
|
+
declare function useMessages(): Messages;
|
|
2074
|
+
|
|
2075
|
+
interface DatePickerTexts extends CalendarTexts {
|
|
2076
|
+
openCalendar: string;
|
|
2077
|
+
done: string;
|
|
2078
|
+
time: string;
|
|
2079
|
+
presets: string;
|
|
2080
|
+
/** Validation – name the rule, never just “invalid date”. */
|
|
2081
|
+
beforeMin: (date: string) => string;
|
|
2082
|
+
afterMax: (date: string) => string;
|
|
2083
|
+
unavailable: string;
|
|
2084
|
+
reversed: string;
|
|
2085
|
+
}
|
|
2086
|
+
/** English defaults. The components use the texts of the current language (see i18n). */
|
|
2087
|
+
declare const defaultDatePickerTexts: Omit<DatePickerTexts, keyof CalendarTexts>;
|
|
2088
|
+
interface PickerBase {
|
|
2089
|
+
label?: ReactNode;
|
|
2090
|
+
description?: ReactNode;
|
|
2091
|
+
/** Own message or a function of the validation details. Default: the built-in messages (min, max, unavailable, reversed). */
|
|
2092
|
+
errorMessage?: ReactNode | ((validation: ValidationResult) => ReactNode);
|
|
2093
|
+
/** md 40 (desktop) · lg 48 (touch). */
|
|
2094
|
+
size?: 'md' | 'lg';
|
|
2095
|
+
/** auto: popover on desktop, Bottom Sheet with a lg calendar below 640 px · popover · sheet. */
|
|
2096
|
+
overlay?: 'auto' | 'popover' | 'sheet';
|
|
2097
|
+
/** ISO week numbers in the calendar. */
|
|
2098
|
+
showWeekNumbers?: boolean;
|
|
2099
|
+
texts?: Partial<DatePickerTexts>;
|
|
2100
|
+
className?: string;
|
|
2101
|
+
}
|
|
2102
|
+
interface DatePickerProps<T extends DateValue> extends Omit<DatePickerProps$1<T>, 'children' | 'className' | 'style'>, PickerBase {
|
|
2103
|
+
}
|
|
2104
|
+
/**
|
|
2105
|
+
* Date picker – type a date or pick it. The field is the main input, the calendar is a
|
|
2106
|
+
* helper: the button “Open calendar” (or Alt + ↓) opens it, picking a day closes it and focus returns to the
|
|
2107
|
+
* field. `granularity="minute"` makes it a date + time picker with a time field in the panel.
|
|
2108
|
+
*/
|
|
2109
|
+
declare function DatePicker<T extends DateValue>({ label, description, errorMessage, size, overlay, showWeekNumbers, texts, className, ...props }: DatePickerProps<T>): react.JSX.Element;
|
|
2110
|
+
interface DateRangePreset {
|
|
2111
|
+
label: string;
|
|
2112
|
+
value: {
|
|
2113
|
+
start: DateValue;
|
|
2114
|
+
end: DateValue;
|
|
2115
|
+
};
|
|
2116
|
+
}
|
|
2117
|
+
/**
|
|
2118
|
+
* The default presets (Today … Last month), relative to today in the local time zone.
|
|
2119
|
+
* Labels: own ones win, else those of `messages` (default English; the DateRangePicker passes the current language).
|
|
2120
|
+
*/
|
|
2121
|
+
declare function defaultDatePresets(labels?: Partial<Record<'today' | 'yesterday' | 'last7' | 'last14' | 'last30' | 'thisMonth' | 'lastMonth', string>>, messages?: Messages): DateRangePreset[];
|
|
2122
|
+
interface DateRangePickerProps<T extends DateValue> extends Omit<DateRangePickerProps$1<T>, 'children' | 'className' | 'style'>, PickerBase {
|
|
2123
|
+
/** true: the default presets (Today … Last month) · own list · none. Fits dashboards and filters. */
|
|
2124
|
+
presets?: boolean | DateRangePreset[];
|
|
2125
|
+
}
|
|
2126
|
+
/**
|
|
2127
|
+
* Date range picker – start and end in one field. Two months side by side on desktop,
|
|
2128
|
+
* one on mobile; the first click sets the start, the second the end, hovering previews the range. Optional presets.
|
|
2129
|
+
*/
|
|
2130
|
+
declare function DateRangePicker<T extends DateValue>({ label, description, errorMessage, size, overlay, showWeekNumbers, presets, texts, className, ...props }: DateRangePickerProps<T>): react.JSX.Element;
|
|
2131
|
+
|
|
2132
|
+
type ImageRatio = '1:1' | '3:4' | '4:3' | '3:2' | '16:9' | '21:9' | 'original';
|
|
2133
|
+
interface MediaPlayButtonProps {
|
|
2134
|
+
/** md 48 (cards, lists) · lg 64 (hero, player). */
|
|
2135
|
+
size?: 'md' | 'lg';
|
|
2136
|
+
className?: string;
|
|
2137
|
+
}
|
|
2138
|
+
/**
|
|
2139
|
+
* Media play button – marks video on a thumbnail. Visual only: the whole
|
|
2140
|
+
* thumbnail is the hit area (a link or button around it); hover, pressed and focus come from there.
|
|
2141
|
+
*/
|
|
2142
|
+
declare function MediaPlayButton({ size, className }: MediaPlayButtonProps): react.JSX.Element;
|
|
2143
|
+
interface ImageProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, 'alt' | 'src' | 'placeholder' | 'children' | 'className' | 'style'> {
|
|
2144
|
+
/** Without src the image stays in its loading state (e.g. while the URL is resolved). */
|
|
2145
|
+
src?: string;
|
|
2146
|
+
/** Required. Describe the purpose, not the pixels. Decorative images: alt="" on purpose. */
|
|
2147
|
+
alt: string;
|
|
2148
|
+
/** Reserves the space before the file arrives. original: from width/height (fallback 3:2 while loading). */
|
|
2149
|
+
ratio?: ImageRatio;
|
|
2150
|
+
/** cover: photos (fills, crops) · contain: logos, screenshots, product shots, charts (shows everything). */
|
|
2151
|
+
fit?: 'cover' | 'contain';
|
|
2152
|
+
/** Default radius/md; in cards the image takes the card's radius (none). */
|
|
2153
|
+
radius?: 'none' | 'sm' | 'md' | 'lg';
|
|
2154
|
+
/** 1 px border/media inside – for images on a similar background. */
|
|
2155
|
+
bordered?: boolean;
|
|
2156
|
+
/** Tiny preview (≈ 20 px, data URI) for blur-up. Without it a Skeleton shows. */
|
|
2157
|
+
placeholder?: string;
|
|
2158
|
+
/** Hero / largest image at the top: loads first (eager, fetchpriority high). Everything else loads lazily. */
|
|
2159
|
+
priority?: boolean;
|
|
2160
|
+
/** Text on a gradient – translatable, searchable, read by screen readers. Never bake text into images. */
|
|
2161
|
+
overlay?: {
|
|
2162
|
+
title: ReactNode;
|
|
2163
|
+
meta?: ReactNode;
|
|
2164
|
+
position?: 'bottom' | 'top';
|
|
2165
|
+
};
|
|
2166
|
+
/** One Badge (sm), top left. */
|
|
2167
|
+
badge?: ReactNode;
|
|
2168
|
+
/** Marks video. */
|
|
2169
|
+
play?: 'md' | 'lg';
|
|
2170
|
+
className?: string;
|
|
2171
|
+
style?: CSSProperties;
|
|
2172
|
+
}
|
|
2173
|
+
/**
|
|
2174
|
+
* Image – an image with reserved space and calm loading states. Loading: blur-up preview or
|
|
2175
|
+
* Skeleton; the image fades in (250 ms; 100 ms with reduced motion). Error keeps the space and shows image-off;
|
|
2176
|
+
* the alt text stays available. Overlays (text, badge, play) only on the loaded image.
|
|
2177
|
+
*/
|
|
2178
|
+
declare function Image({ src, alt, ratio, fit, radius, bordered, placeholder, priority, overlay, badge, play, className, style, onLoad, onError, ...props }: ImageProps): react.JSX.Element;
|
|
2179
|
+
interface FigureProps {
|
|
2180
|
+
/** The Image. */
|
|
2181
|
+
children: ReactNode;
|
|
2182
|
+
/** Describes what matters (adds to the image – never repeat the alt text). */
|
|
2183
|
+
caption?: ReactNode;
|
|
2184
|
+
/** Names the source (“© Photographer”). */
|
|
2185
|
+
credit?: ReactNode;
|
|
2186
|
+
className?: string;
|
|
2187
|
+
}
|
|
2188
|
+
/** Figure – image with caption and credit. A real figure + figcaption. */
|
|
2189
|
+
declare function Figure({ children, caption, credit, className }: FigureProps): react.JSX.Element;
|
|
2190
|
+
|
|
2191
|
+
type EmbedType = 'video' | 'map' | 'generic';
|
|
2192
|
+
interface EmbedTexts {
|
|
2193
|
+
title: string;
|
|
2194
|
+
/** Default size: who provides it and what is sent. */
|
|
2195
|
+
body: string;
|
|
2196
|
+
/** Compact size (< 480 px). */
|
|
2197
|
+
bodyCompact: string;
|
|
2198
|
+
load: string;
|
|
2199
|
+
remember: string;
|
|
2200
|
+
privacy: string;
|
|
2201
|
+
}
|
|
2202
|
+
/**
|
|
2203
|
+
* Texts per type. provider: the service (“Example Video”) · company: who runs it, when it differs (“Example Inc.”).
|
|
2204
|
+
* `messages`: the language (default English); the component passes the current one.
|
|
2205
|
+
*/
|
|
2206
|
+
declare function defaultEmbedTexts(type: EmbedType, provider?: string, company?: string, messages?: Messages): EmbedTexts;
|
|
2207
|
+
interface EmbedConsentProps {
|
|
2208
|
+
type?: EmbedType;
|
|
2209
|
+
/** Name of the service that provides the content (“Example Video”). */
|
|
2210
|
+
provider?: string;
|
|
2211
|
+
/** Who receives the data, when it differs from the service (“Example Inc.”). */
|
|
2212
|
+
company?: string;
|
|
2213
|
+
/** The embed URL – requested only after consent. Prefer the privacy-friendly embed URL of the service, if it offers one. */
|
|
2214
|
+
src: string;
|
|
2215
|
+
/** Required: names the iframe (“Video: Product tour”). */
|
|
2216
|
+
title: string;
|
|
2217
|
+
/** Ratio of the final embed. The placeholder may grow so text never clips. */
|
|
2218
|
+
ratio?: Exclude<ImageRatio, 'original'>;
|
|
2219
|
+
/** The provider's privacy policy (or your own). */
|
|
2220
|
+
privacyHref: string;
|
|
2221
|
+
/** Stored consent from the consent manager – loads at once. */
|
|
2222
|
+
isConsented?: boolean;
|
|
2223
|
+
/** The user clicked “Load”; `remember` = “Always load …” checked – store it per provider in the consent manager. */
|
|
2224
|
+
onConsent?: (remember: boolean) => void;
|
|
2225
|
+
/** iframe permissions, e.g. “autoplay; encrypted-media; picture-in-picture; fullscreen”. */
|
|
2226
|
+
allow?: string;
|
|
2227
|
+
texts?: Partial<EmbedTexts>;
|
|
2228
|
+
className?: string;
|
|
2229
|
+
}
|
|
2230
|
+
/**
|
|
2231
|
+
* Embed consent – two-click placeholder for third-party embeds.
|
|
2232
|
+
* Nothing loads from the provider – not even a thumbnail – until the user clicks. Then the iframe replaces the
|
|
2233
|
+
* placeholder in place and takes the focus. Compact below 480 px width (measured on the component).
|
|
2234
|
+
*/
|
|
2235
|
+
declare function EmbedConsent({ type, provider, company, src, title, ratio, privacyHref, isConsented, onConsent, allow, texts, className, }: EmbedConsentProps): react.JSX.Element;
|
|
2236
|
+
|
|
2237
|
+
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, Alert, AlertDialog, type AlertDialogProps, type AlertDialogTone, type AlertProps, type AlertTone, AppHeader, type AppHeaderProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarSize, type AvatarStatus, Badge, BadgeCount, type BadgeCountProps, BadgeDot, type BadgeDotProps, type BadgeProps, type BadgeTone, BottomSheet, type BottomSheetProps, BottomTabBar, type BottomTabBarProps, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, type BulkAction, BulkActionBar, type BulkActionBarProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, type ButtonSize, type ButtonVariant, Calendar, type CalendarProps, type CalendarTexts, Card, type CardProps, Cell, type CellProps, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, type ChoiceSize, Column, type ColumnOption, type ColumnProps, ColumnsMenu, type ColumnsMenuProps, Combobox, type ComboboxProps, DateField, type DateFieldProps, DatePicker, type DatePickerProps, type DatePickerTexts, DateRangePicker, type DateRangePickerProps, type DateRangePreset, DescriptionItem, type DescriptionItemProps, DescriptionList, type DescriptionListProps, Dialog, type DialogAction, type DialogDiscardText, type DialogProps, Drawer, type DrawerProps, Dropzone, type DropzoneProps, EmbedConsent, type EmbedConsentProps, type EmbedMessages, type EmbedTexts, type EmbedType, EmptyState, type EmptyStateAction, type EmptyStateProps, type EmptyStateSize, type EmptyStateType, FieldFooter, FieldLabel, Figure, type FigureProps, FileItem, type FileItemProps, FileTile, type FileTileProps, FileTrigger, type FileTriggerProps, Highlight, IconButton, type IconButtonProps, Image, type ImageProps, type ImageRatio, InputAction, type InputActionProps, type InputSize, Link, type LinkProps, List, ListBox, ListBoxMessage, type ListBoxProps, ListBoxSection, type ListBoxSectionProps, type ListBoxSize, ListCard, type ListCardProps, ListItem, type ListItemProps, type ListProps, ListRow, ListRowIcon, type ListRowProps, type ListType, ListView, type ListViewProps, MediaPlayButton, type MediaPlayButtonProps, Menu, MenuButton, MenuItem, type MenuItemProps, type MenuProps, MenuSection, type MenuSectionProps, MenuTrigger, type MenuTriggerProps, type Messages, MessagesProvider, type NavAction, NavGroup, type NavGroupProps, NavItem, type NavItemProps, NavList, type NavListProps, NavSection, type NavSectionProps, type NavVariant, NumberField, type NumberFieldProps, Option, type OptionProps, Pagination, type PaginationProps, Popover, type PopoverProps, PopoverTrigger, ProgressBar, type ProgressBarProps, QuickSearch, type QuickSearchProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, RangeCalendar, type RangeCalendarProps, Row, SearchField, type SearchFieldProps, SearchResult, type SearchResultProps, type SearchResultType, Select, type SelectOverlay, type SelectProps, SideNav, type SideNavProps, type SideNavUser, SiteHeader, type SiteHeaderProps, Skeleton, type SkeletonProps, SkipLink, type SkipLinkProps, Slider, SliderField, type SliderFieldProps, type SliderProps, Spinner, type SpinnerProps, StaticTable, type StaticTableProps, Submenu, type SubmenuProps, Switch, type SwitchProps, Tab, TabBarItem, type TabBarItemProps, TabBarMore, type TabBarMoreProps, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Table, TableBody, TableHeader, type TableProps, Tabs, type TabsProps, Tag, TagGroup, type TagGroupProps, type TagProps, TextField, type TextFieldProps, TimeField, type TimeFieldProps, type TimeSlot, type ToastAction, type ToastOptions, ToastRegion, type ToastRegionProps, ToggleButton, ToggleButtonGroup, type ToggleButtonGroupProps, type ToggleButtonProps, Toggletip, type ToggletipProps, Toolbar, type ToolbarProps, ToolbarSeparator, Tooltip, type TooltipProps, TooltipTrigger, UploadField, type UploadFieldProps, type UploadFile, type UploadTexts, de as deMessages, defaultCalendarTexts, defaultDatePickerTexts, defaultDatePresets, defaultEmbedTexts, defaultUploadTexts, en as enMessages, formatBytes, initialsOf, toast, useMessages };
|