@mond-design-system/react 3.0.3 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +906 -74
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +535 -21
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +449 -41
- package/dist/index.d.ts +449 -41
- package/dist/index.js +900 -75
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { CSSProperties, HTMLAttributes, JSX, ReactElement, ReactNode, ButtonHTMLAttributes, ElementType,
|
|
2
|
+
import { CSSProperties, HTMLAttributes, JSX, ReactElement, Ref, ReactNode, ButtonHTMLAttributes, ElementType, ComponentPropsWithRef, MouseEventHandler, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, RefObject, KeyboardEvent } from 'react';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Join class names, dropping anything falsy.
|
|
@@ -67,8 +67,10 @@ declare function Heading({ level, variant, tone, className, ...rest }: HeadingPr
|
|
|
67
67
|
interface SpinnerProps extends HTMLAttributes<HTMLSpanElement> {
|
|
68
68
|
/** Diameter in px. Default 20. */
|
|
69
69
|
size?: number;
|
|
70
|
-
/** Accessible label.
|
|
71
|
-
|
|
70
|
+
/** Accessible label. Required: the words are the app's, in the app's
|
|
71
|
+
language, and a default here is one no translation file can reach. */
|
|
72
|
+
label: string;
|
|
73
|
+
ref?: Ref<HTMLSpanElement>;
|
|
72
74
|
}
|
|
73
75
|
/**
|
|
74
76
|
* Indeterminate loading ring. Arc takes currentColor, so it matches whatever
|
|
@@ -120,15 +122,26 @@ interface IconProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
120
122
|
size?: IconSize;
|
|
121
123
|
/** Accessible name. Omitted = decorative (aria-hidden). */
|
|
122
124
|
label?: string;
|
|
125
|
+
ref?: Ref<HTMLSpanElement>;
|
|
123
126
|
}
|
|
124
127
|
/** A glyph from the app-registered set, sized on the core scale. */
|
|
125
128
|
declare function Icon({ name, size, label, className, ...rest }: IconProps): ReactElement;
|
|
126
129
|
|
|
127
130
|
type ButtonVariant = "primary" | "secondary" | "ghost" | "danger" | "warning" | "highlight";
|
|
128
131
|
type ButtonSize = "sm" | "md" | "lg";
|
|
132
|
+
type ButtonShape = "rect" | "pill";
|
|
129
133
|
interface ButtonBaseProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "type"> {
|
|
130
134
|
variant?: ButtonVariant;
|
|
131
135
|
size?: ButtonSize;
|
|
136
|
+
/** Standing on a picture, where the page's own foreground would be read
|
|
137
|
+
* against a photograph. Only the two see-through variants take it up: a
|
|
138
|
+
* filled button brings its own ground. */
|
|
139
|
+
onMedia?: boolean;
|
|
140
|
+
/** Corner shape, when the default is not the one this button wants: a
|
|
141
|
+
* rectangle where `iconOnly` would round it, or a pill around words.
|
|
142
|
+
* Unset, the shape follows from the size — rect, or a circle when
|
|
143
|
+
* `iconOnly`. */
|
|
144
|
+
shape?: ButtonShape;
|
|
132
145
|
/** Glyph slots — pass an <Icon> or any node. Agnostic of icon set; the
|
|
133
146
|
* button sizes the slot from its own size, and publishes that step as
|
|
134
147
|
* --mds-icon-slot for an icon set that can only size itself. */
|
|
@@ -160,9 +173,10 @@ type ButtonProps = ButtonBaseProps & IconOnlyEnforcement;
|
|
|
160
173
|
* <Button variant="danger" loading={deleting} onClick={remove}>Delete</Button>
|
|
161
174
|
* <Button iconOnly aria-label="Close" variant="ghost"><Icon name="close" /></Button>
|
|
162
175
|
* <Button href="/settings">Settings</Button>
|
|
176
|
+
* <Button iconOnly aria-label="Menu" shape="rect"><Icon name="menu" /></Button>
|
|
163
177
|
* ```
|
|
164
178
|
*/
|
|
165
|
-
declare function Button({ variant, size, iconLeft, iconRight, loading, disabled, fullWidth, iconOnly, type, href, as, className, children, ...rest }: ButtonProps): ReactElement;
|
|
179
|
+
declare function Button({ variant, size, shape, onMedia, iconLeft, iconRight, loading, disabled, fullWidth, iconOnly, type, href, as, className, children, ...rest }: ButtonProps): ReactElement;
|
|
166
180
|
|
|
167
181
|
type LinkVariant = "inline" | "standalone" | "plain";
|
|
168
182
|
type LinkSize = "xs" | "sm" | "base" | "lg" | "xl";
|
|
@@ -180,7 +194,7 @@ type LinkOwnProps<E extends ElementType> = {
|
|
|
180
194
|
as?: E;
|
|
181
195
|
children?: ReactNode;
|
|
182
196
|
};
|
|
183
|
-
type LinkProps<E extends ElementType = "a"> = LinkOwnProps<E> & Omit<
|
|
197
|
+
type LinkProps<E extends ElementType = "a"> = LinkOwnProps<E> & Omit<ComponentPropsWithRef<E>, keyof LinkOwnProps<E>>;
|
|
184
198
|
/**
|
|
185
199
|
* Text link. Inline links keep their underline: color alone fails WCAG 1.4.1
|
|
186
200
|
* for links inside prose.
|
|
@@ -208,6 +222,7 @@ interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
208
222
|
/** Hide from assistive tech — for avatars that repeat a name already in
|
|
209
223
|
the row's text. The name prop still drives the initials. */
|
|
210
224
|
decorative?: boolean;
|
|
225
|
+
ref?: Ref<HTMLSpanElement>;
|
|
211
226
|
}
|
|
212
227
|
/**
|
|
213
228
|
* Person marker. Image when available, initials otherwise — never an empty circle.
|
|
@@ -226,12 +241,17 @@ interface AvatarGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
226
241
|
max?: number;
|
|
227
242
|
/** Sizes the overflow chip to match the avatars. Default "md". */
|
|
228
243
|
size?: AvatarSize;
|
|
244
|
+
/** Names the "+N" chip, e.g. `(n) => `${n} more``. Required and a function:
|
|
245
|
+
the chip stands for people whose names are not on screen, and only the app
|
|
246
|
+
knows how its language counts them. */
|
|
247
|
+
overflowLabel: (hidden: number) => string;
|
|
248
|
+
ref?: Ref<HTMLDivElement>;
|
|
229
249
|
}
|
|
230
250
|
/**
|
|
231
251
|
* Overlapping stack of avatars with a "+N" chip past `max`.
|
|
232
252
|
*
|
|
233
253
|
* ```tsx
|
|
234
|
-
* <AvatarGroup max={3}>
|
|
254
|
+
* <AvatarGroup max={3} overflowLabel={(n) => `${n} more`}>
|
|
235
255
|
* <Avatar name="Ada Lovelace" />
|
|
236
256
|
* <Avatar name="Grace Hopper" />
|
|
237
257
|
* <Avatar name="Margaret Hamilton" />
|
|
@@ -239,11 +259,12 @@ interface AvatarGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
239
259
|
* </AvatarGroup>
|
|
240
260
|
* ```
|
|
241
261
|
*/
|
|
242
|
-
declare function AvatarGroup({ children, max, size, className, ...rest }: AvatarGroupProps): ReactElement;
|
|
262
|
+
declare function AvatarGroup({ children, max, size, overflowLabel, className, ...rest }: AvatarGroupProps): ReactElement;
|
|
243
263
|
|
|
244
264
|
type BadgeTone = "neutral" | "accent" | "danger" | "warning" | "success" | "highlight";
|
|
245
265
|
interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
246
266
|
tone?: BadgeTone;
|
|
267
|
+
ref?: Ref<HTMLSpanElement>;
|
|
247
268
|
}
|
|
248
269
|
/**
|
|
249
270
|
* Small status marker — counts, "new", state words. Soft fill, strong text.
|
|
@@ -268,6 +289,9 @@ interface ChipProps extends HTMLAttributes<HTMLElement> {
|
|
|
268
289
|
/** When provided, Chip renders as a `<button>`. */
|
|
269
290
|
onClick?: MouseEventHandler;
|
|
270
291
|
disabled?: boolean;
|
|
292
|
+
/** The root is a `<button>` when it has an onClick and a `<span>` otherwise,
|
|
293
|
+
so the ref is typed to what both are. */
|
|
294
|
+
ref?: Ref<HTMLElement>;
|
|
271
295
|
}
|
|
272
296
|
/**
|
|
273
297
|
* Compact pill for filters and single/multi choices. Interactive (a button,
|
|
@@ -279,7 +303,7 @@ interface ChipProps extends HTMLAttributes<HTMLElement> {
|
|
|
279
303
|
* <Chip variant="outline" icon={<Icon name="pin" />}>Nearby</Chip>
|
|
280
304
|
* ```
|
|
281
305
|
*/
|
|
282
|
-
declare function Chip({ children, variant, selected, icon, onClick, disabled, className, ...rest }: ChipProps): ReactElement;
|
|
306
|
+
declare function Chip({ children, variant, selected, icon, onClick, disabled, className, ref, ...rest }: ChipProps): ReactElement;
|
|
283
307
|
|
|
284
308
|
type ChipGroupGap = "hairline" | "tight" | "base";
|
|
285
309
|
interface ChipGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
@@ -287,6 +311,7 @@ interface ChipGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
287
311
|
children: ReactNode;
|
|
288
312
|
/** Space between items, on the gap scale. Default "tight". */
|
|
289
313
|
gap?: ChipGroupGap;
|
|
314
|
+
ref?: Ref<HTMLDivElement>;
|
|
290
315
|
}
|
|
291
316
|
/**
|
|
292
317
|
* Wrapping row of Chips for multi-select choices inside a form (pick several
|
|
@@ -315,6 +340,7 @@ interface ChipBarProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
315
340
|
bordered?: boolean;
|
|
316
341
|
/** Fade the trailing edge to hint that the row scrolls. Default true. */
|
|
317
342
|
fade?: boolean;
|
|
343
|
+
ref?: Ref<HTMLDivElement>;
|
|
318
344
|
}
|
|
319
345
|
/**
|
|
320
346
|
* Horizontally scrollable single-line row of Chips — a filter strip. Items
|
|
@@ -356,6 +382,7 @@ interface CountButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>,
|
|
|
356
382
|
loading?: boolean;
|
|
357
383
|
/** Visible text beside the icon — typically a count or a word. */
|
|
358
384
|
children?: ReactNode;
|
|
385
|
+
ref?: Ref<HTMLButtonElement>;
|
|
359
386
|
}
|
|
360
387
|
/**
|
|
361
388
|
* Inline, chrome-less pressable pairing an icon with a count or word — like,
|
|
@@ -394,7 +421,8 @@ interface DateTimePickerProps {
|
|
|
394
421
|
value?: string | undefined;
|
|
395
422
|
/** Fires with the combined ISO string when the user confirms. */
|
|
396
423
|
onChange: (iso: string) => void;
|
|
397
|
-
/** Shown on the trigger when nothing is selected.
|
|
424
|
+
/** Shown on the trigger when nothing is selected. Nothing is shown without
|
|
425
|
+
it: the component ships no words of its own. */
|
|
398
426
|
placeholder?: string | undefined;
|
|
399
427
|
/** Earliest selectable moment as an ISO string. Default: now. */
|
|
400
428
|
min?: string | undefined;
|
|
@@ -407,8 +435,10 @@ interface DateTimePickerProps {
|
|
|
407
435
|
"aria-label"?: string | undefined;
|
|
408
436
|
/** BCP 47 tag for names, week start and hour cycle. Default: runtime locale. */
|
|
409
437
|
locale?: string | undefined;
|
|
410
|
-
/**
|
|
411
|
-
|
|
438
|
+
/** Every string the picker says. Required and whole rather than a partial
|
|
439
|
+
over English defaults: a default is a word no translation file reaches,
|
|
440
|
+
and a partial makes the one nobody filled in look deliberate. */
|
|
441
|
+
labels: DateTimePickerLabels;
|
|
412
442
|
}
|
|
413
443
|
/**
|
|
414
444
|
* Mobile-first date + time picker. A trigger styled like Input opens a bottom
|
|
@@ -422,6 +452,7 @@ interface DateTimePickerProps {
|
|
|
422
452
|
* <DateTimePicker
|
|
423
453
|
* value={startsAt}
|
|
424
454
|
* onChange={setStartsAt}
|
|
455
|
+
* labels={t("picker", { returnObjects: true })}
|
|
425
456
|
* min={new Date().toISOString()}
|
|
426
457
|
* minuteStep={30}
|
|
427
458
|
* locale={i18n.language}
|
|
@@ -429,27 +460,37 @@ interface DateTimePickerProps {
|
|
|
429
460
|
* </Field>
|
|
430
461
|
* ```
|
|
431
462
|
*/
|
|
432
|
-
declare function DateTimePicker({ value, onChange, placeholder, min, minuteStep, disabled, id, "aria-label": ariaLabel, locale, labels, }: DateTimePickerProps): ReactElement;
|
|
463
|
+
declare function DateTimePicker({ value, onChange, placeholder, min, minuteStep, disabled, id, "aria-label": ariaLabel, locale, labels: text, }: DateTimePickerProps): ReactElement;
|
|
433
464
|
|
|
434
465
|
type TagTone = "neutral" | "accent";
|
|
435
|
-
|
|
466
|
+
type TagProps = HTMLAttributes<HTMLSpanElement> & {
|
|
436
467
|
children: ReactNode;
|
|
437
468
|
tone?: TagTone;
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
469
|
+
ref?: Ref<HTMLSpanElement>;
|
|
470
|
+
} & ({
|
|
471
|
+
/** Renders a ✕ button after the content. */
|
|
472
|
+
onRemove: () => void;
|
|
473
|
+
/** Names that button, e.g. "Remove Beginner". Required alongside
|
|
474
|
+
`onRemove`: the glyph says nothing, and only the app knows how its
|
|
475
|
+
language builds the sentence. */
|
|
476
|
+
removeLabel: string;
|
|
477
|
+
} | {
|
|
478
|
+
onRemove?: undefined;
|
|
479
|
+
removeLabel?: undefined;
|
|
480
|
+
});
|
|
441
481
|
/**
|
|
442
482
|
* Content label chip — categories, filters, topics.
|
|
443
483
|
*
|
|
444
484
|
* ```tsx
|
|
445
485
|
* <Tag>Design</Tag>
|
|
446
|
-
* <Tag tone="accent" onRemove={() => remove(id)}>Beginner</Tag>
|
|
486
|
+
* <Tag tone="accent" onRemove={() => remove(id)} removeLabel="Remove Beginner">Beginner</Tag>
|
|
447
487
|
* ```
|
|
448
488
|
*/
|
|
449
|
-
declare function Tag({ children, tone, onRemove, className, ...rest }: TagProps): ReactElement;
|
|
489
|
+
declare function Tag({ children, tone, onRemove, removeLabel, className, ...rest }: TagProps): ReactElement;
|
|
450
490
|
|
|
451
491
|
interface DividerProps extends HTMLAttributes<HTMLDivElement> {
|
|
452
492
|
orientation?: "horizontal" | "vertical";
|
|
493
|
+
ref?: Ref<HTMLDivElement>;
|
|
453
494
|
}
|
|
454
495
|
/**
|
|
455
496
|
* Visual separator. Semantic separator role via <hr>-equivalent div.
|
|
@@ -461,12 +502,33 @@ interface DividerProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
461
502
|
*/
|
|
462
503
|
declare function Divider({ orientation, className, ...rest }: DividerProps): ReactElement;
|
|
463
504
|
|
|
505
|
+
interface VisuallyHiddenProps extends HTMLAttributes<HTMLElement> {
|
|
506
|
+
/** Element override when the markup needs a particular tag — a page's h1, a
|
|
507
|
+
table's thead. Default "span". */
|
|
508
|
+
as?: keyof JSX.IntrinsicElements;
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Text for screen readers and not for eyes.
|
|
512
|
+
*
|
|
513
|
+
* The design does not always draw what the markup owes: a screen whose title is
|
|
514
|
+
* the tab bar underneath it still needs an h1, and a table whose columns are
|
|
515
|
+
* obvious to look at still needs a thead. Both go here rather than into a
|
|
516
|
+
* one-off class in the app.
|
|
517
|
+
*
|
|
518
|
+
* ```tsx
|
|
519
|
+
* <VisuallyHidden as="h1">Discover</VisuallyHidden>
|
|
520
|
+
* <VisuallyHidden role="status" aria-live="polite">{message}</VisuallyHidden>
|
|
521
|
+
* ```
|
|
522
|
+
*/
|
|
523
|
+
declare function VisuallyHidden({ as, className, ...rest }: VisuallyHiddenProps): ReactElement;
|
|
524
|
+
|
|
464
525
|
type SkeletonVariant = "text" | "rect" | "circle";
|
|
465
526
|
interface SkeletonProps extends HTMLAttributes<HTMLSpanElement> {
|
|
466
527
|
variant?: SkeletonVariant;
|
|
467
528
|
/** Any CSS length. Text defaults to full width, one line tall. */
|
|
468
529
|
width?: string;
|
|
469
530
|
height?: string;
|
|
531
|
+
ref?: Ref<HTMLSpanElement>;
|
|
470
532
|
}
|
|
471
533
|
/**
|
|
472
534
|
* Loading placeholder. aria-hidden — the loading announcement belongs to the
|
|
@@ -493,7 +555,11 @@ interface ProgressBarProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
493
555
|
value?: number;
|
|
494
556
|
/** Accessible name — required. A bare bar announces nothing useful. */
|
|
495
557
|
label: string;
|
|
558
|
+
/** What the bar has got through, in words — "2.1 MB of 5 MB". Read instead
|
|
559
|
+
of the percentage, which is not always what the number means. */
|
|
560
|
+
valueText?: string;
|
|
496
561
|
indeterminate?: boolean;
|
|
562
|
+
ref?: Ref<HTMLDivElement>;
|
|
497
563
|
}
|
|
498
564
|
/**
|
|
499
565
|
* Determinate or indeterminate progress track.
|
|
@@ -503,7 +569,7 @@ interface ProgressBarProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
503
569
|
* <ProgressBar label="Syncing" indeterminate />
|
|
504
570
|
* ```
|
|
505
571
|
*/
|
|
506
|
-
declare function ProgressBar({ value, label, indeterminate, className, style, ...rest }: ProgressBarProps): ReactElement;
|
|
572
|
+
declare function ProgressBar({ value, label, valueText, indeterminate, className, style, ...rest }: ProgressBarProps): ReactElement;
|
|
507
573
|
|
|
508
574
|
interface FieldContextValue {
|
|
509
575
|
/** Control id — the label points here. */
|
|
@@ -563,18 +629,25 @@ interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size">
|
|
|
563
629
|
*/
|
|
564
630
|
declare function Input({ size, invalid, iconLeft, iconRight, className, ...rest }: InputProps): ReactElement;
|
|
565
631
|
|
|
566
|
-
|
|
632
|
+
interface PasswordInputProps extends Omit<InputProps, "type"> {
|
|
633
|
+
/** Names the reveal button while the password is hidden, e.g. "Show password".
|
|
634
|
+
Required: the button carries no visible text, so this is the only thing a
|
|
635
|
+
screen reader has, and it is the app's language rather than the system's. */
|
|
636
|
+
showLabel: string;
|
|
637
|
+
/** Names the same button while the password is visible, e.g. "Hide password". */
|
|
638
|
+
hideLabel: string;
|
|
639
|
+
}
|
|
567
640
|
/**
|
|
568
641
|
* Password field with a reveal toggle. Composes Input, so inside a Field it
|
|
569
642
|
* inherits id/description/invalid the same way.
|
|
570
643
|
*
|
|
571
644
|
* ```tsx
|
|
572
645
|
* <Field label="Password" hint="At least 12 characters">
|
|
573
|
-
* <PasswordInput autoComplete="new-password" />
|
|
646
|
+
* <PasswordInput showLabel="Show password" hideLabel="Hide password" autoComplete="new-password" />
|
|
574
647
|
* </Field>
|
|
575
648
|
* ```
|
|
576
649
|
*/
|
|
577
|
-
declare function PasswordInput({ className, ...rest }: PasswordInputProps): ReactElement;
|
|
650
|
+
declare function PasswordInput({ showLabel, hideLabel, className, ...rest }: PasswordInputProps): ReactElement;
|
|
578
651
|
|
|
579
652
|
interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
580
653
|
/** Character counter under the control; pairs with native maxLength. */
|
|
@@ -684,6 +757,7 @@ interface SegmentOption<T extends string = string> {
|
|
|
684
757
|
value: T;
|
|
685
758
|
label: string;
|
|
686
759
|
}
|
|
760
|
+
type SegmentedControlSize = "sm" | "md";
|
|
687
761
|
interface SegmentedControlProps<T extends string = string> {
|
|
688
762
|
/** Accessible group name. */
|
|
689
763
|
label: string;
|
|
@@ -695,6 +769,14 @@ interface SegmentedControlProps<T extends string = string> {
|
|
|
695
769
|
/** Stretch across the container, segments sharing the width equally —
|
|
696
770
|
the usual shape when the control heads a screen-wide view switch. */
|
|
697
771
|
fullWidth?: boolean;
|
|
772
|
+
/** Control step. Default md. sm is for chrome — a switch sharing a header
|
|
773
|
+
bar with an avatar and a menu, where the medium step is the tallest
|
|
774
|
+
thing up there. */
|
|
775
|
+
size?: SegmentedControlSize;
|
|
776
|
+
/** Drop the frame: no tray, no padding around the segments. The tray is
|
|
777
|
+
what makes the group read as a form field, and in a header bar a field
|
|
778
|
+
is what it is not. The chosen segment still carries its own surface. */
|
|
779
|
+
bare?: boolean;
|
|
698
780
|
className?: string;
|
|
699
781
|
}
|
|
700
782
|
/**
|
|
@@ -713,11 +795,14 @@ interface SegmentedControlProps<T extends string = string> {
|
|
|
713
795
|
* />
|
|
714
796
|
* ```
|
|
715
797
|
*/
|
|
716
|
-
declare function SegmentedControl<T extends string = string>({ label, options, value, onChange, disabled, fullWidth, className, }: SegmentedControlProps<T>): ReactElement;
|
|
798
|
+
declare function SegmentedControl<T extends string = string>({ label, options, value, onChange, disabled, fullWidth, size, bare, className, }: SegmentedControlProps<T>): ReactElement;
|
|
717
799
|
|
|
718
800
|
interface SearchFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size" | "value" | "onChange"> {
|
|
719
801
|
/** Accessible name. */
|
|
720
802
|
label: string;
|
|
803
|
+
/** Names the clear button, e.g. "Clear search". Required: the button is a
|
|
804
|
+
glyph, so this is all a screen reader has, and the words are the app's. */
|
|
805
|
+
clearLabel: string;
|
|
721
806
|
value: string;
|
|
722
807
|
/** Receives the new text — "" when cleared. */
|
|
723
808
|
onChange: (value: string) => void;
|
|
@@ -727,15 +812,16 @@ interface SearchFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "
|
|
|
727
812
|
* Controlled search input with a clear affordance once there is text.
|
|
728
813
|
*
|
|
729
814
|
* ```tsx
|
|
730
|
-
* <SearchField label="Search sessions" value={query} onChange={setQuery} />
|
|
815
|
+
* <SearchField label="Search sessions" clearLabel="Clear search" value={query} onChange={setQuery} />
|
|
731
816
|
* ```
|
|
732
817
|
*/
|
|
733
|
-
declare function SearchField({ label, value, onChange, className, ...rest }: SearchFieldProps): ReactElement;
|
|
818
|
+
declare function SearchField({ label, clearLabel, value, onChange, className, ...rest }: SearchFieldProps): ReactElement;
|
|
734
819
|
|
|
735
820
|
interface ListGroupProps extends HTMLAttributes<HTMLUListElement> {
|
|
736
821
|
children: ReactNode;
|
|
737
822
|
/** Heading over the group. Also names the list to a screen reader. */
|
|
738
823
|
label?: ReactNode;
|
|
824
|
+
ref?: Ref<HTMLUListElement>;
|
|
739
825
|
}
|
|
740
826
|
/**
|
|
741
827
|
* Card-styled list container for ListItems.
|
|
@@ -769,6 +855,8 @@ interface ListItemProps extends Omit<HTMLAttributes<HTMLElement>, "title" | "onC
|
|
|
769
855
|
pressed?: boolean;
|
|
770
856
|
/** Makes the whole row a link. Wins over onClick. */
|
|
771
857
|
href?: string;
|
|
858
|
+
/** Element override for that link, e.g. a router's Link. */
|
|
859
|
+
as?: ElementType;
|
|
772
860
|
/** What the row paints behind itself. Inside a ListGroup the group is the
|
|
773
861
|
card, so grouped rows default to painting nothing; standalone rows
|
|
774
862
|
default to their own card. `accent` is the tinted, accent-edged prompt
|
|
@@ -776,12 +864,15 @@ interface ListItemProps extends Omit<HTMLAttributes<HTMLElement>, "title" | "onC
|
|
|
776
864
|
brings its own corner radius, which peeks past the row's in all four
|
|
777
865
|
corners. */
|
|
778
866
|
surface?: ListItemSurface;
|
|
867
|
+
/** The root is an `<li>` inside a ListGroup and a `<div>` outside one, so
|
|
868
|
+
the ref is typed to what both are. */
|
|
869
|
+
ref?: Ref<HTMLElement>;
|
|
779
870
|
}
|
|
780
871
|
/**
|
|
781
872
|
* One row. Static by default; interactive as one whole-row button/link.
|
|
782
873
|
* An `<li>` inside a ListGroup, a standalone `<div>` row anywhere else.
|
|
783
874
|
*/
|
|
784
|
-
declare function ListItem({ title, description, leading, trailing, onClick, pressed, href, surface, className, ...rest }: ListItemProps): ReactElement;
|
|
875
|
+
declare function ListItem({ title, description, leading, trailing, onClick, pressed, href, as, surface, className, ref, ...rest }: ListItemProps): ReactElement;
|
|
785
876
|
|
|
786
877
|
interface EmptyStateProps {
|
|
787
878
|
title: string;
|
|
@@ -830,26 +921,42 @@ interface TabListProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
830
921
|
/** Accessible name for the tab set. */
|
|
831
922
|
label: string;
|
|
832
923
|
children: ReactNode;
|
|
924
|
+
ref?: Ref<HTMLDivElement>;
|
|
833
925
|
}
|
|
834
926
|
declare function TabList({ label, className, children, ...rest }: TabListProps): ReactElement;
|
|
835
927
|
interface TabProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "value" | "type"> {
|
|
836
928
|
value: string;
|
|
837
929
|
children: ReactNode;
|
|
930
|
+
ref?: Ref<HTMLButtonElement>;
|
|
838
931
|
}
|
|
839
932
|
declare function Tab({ value, className, children, ...rest }: TabProps): ReactElement;
|
|
840
933
|
interface TabPanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
841
934
|
value: string;
|
|
842
935
|
children: ReactNode;
|
|
936
|
+
ref?: Ref<HTMLDivElement>;
|
|
843
937
|
}
|
|
844
938
|
declare function TabPanel({ value, className, children, ...rest }: TabPanelProps): ReactElement;
|
|
845
939
|
|
|
846
940
|
type ToastTone = "neutral" | "success" | "danger";
|
|
941
|
+
interface ToastAction {
|
|
942
|
+
/** The word on the button — localise. */
|
|
943
|
+
label: string;
|
|
944
|
+
onClick: () => void;
|
|
945
|
+
}
|
|
847
946
|
interface ToastOptions {
|
|
848
947
|
title: string;
|
|
849
948
|
description?: string | undefined;
|
|
850
949
|
tone?: ToastTone | undefined;
|
|
851
950
|
/** ms until auto-dismiss. 0 = stays until dismissed. Default 5000. */
|
|
852
951
|
duration?: number | undefined;
|
|
952
|
+
/** One thing to do about the message, beside it. A toast that asks for
|
|
953
|
+
something — "Update ready", "Add to home screen" — has nowhere else to
|
|
954
|
+
put the doing. Taking it closes the toast: the message is answered. */
|
|
955
|
+
action?: ToastAction | undefined;
|
|
956
|
+
/** Fires however the toast leaves — timeout, dismiss button, or action.
|
|
957
|
+
A nudge that must remember a refusal has one place to write it down,
|
|
958
|
+
rather than three that can disagree. */
|
|
959
|
+
onDismiss?: (() => void) | undefined;
|
|
853
960
|
}
|
|
854
961
|
interface ToastContextValue {
|
|
855
962
|
toast: (options: ToastOptions) => number;
|
|
@@ -858,19 +965,19 @@ interface ToastContextValue {
|
|
|
858
965
|
declare function useToast(): ToastContextValue;
|
|
859
966
|
interface ToastProviderProps {
|
|
860
967
|
children: ReactNode;
|
|
861
|
-
/** Accessible name of the notification region
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
*
|
|
866
|
-
dismissLabel
|
|
968
|
+
/** Accessible name of the notification region, e.g. "Notifications".
|
|
969
|
+
Required: it is read aloud, in the app's language. */
|
|
970
|
+
regionLabel: string;
|
|
971
|
+
/** Prefix of each dismiss button's accessible name. The toast's title follows
|
|
972
|
+
* it, so every dismiss control names its own toast: "Dismiss: Saved". */
|
|
973
|
+
dismissLabel: string;
|
|
867
974
|
}
|
|
868
975
|
/**
|
|
869
976
|
* Mount once near the root. Renders the notification region itself.
|
|
870
977
|
*
|
|
871
978
|
* ```tsx
|
|
872
979
|
* // App root
|
|
873
|
-
* <ToastProvider>
|
|
980
|
+
* <ToastProvider regionLabel="Notifications" dismissLabel="Dismiss">
|
|
874
981
|
* <App />
|
|
875
982
|
* </ToastProvider>
|
|
876
983
|
*
|
|
@@ -963,6 +1070,11 @@ interface CardProps extends Omit<HTMLAttributes<HTMLElement>, "onClick"> {
|
|
|
963
1070
|
onClick?: () => void;
|
|
964
1071
|
/** Makes the whole card a link. Wins over onClick. */
|
|
965
1072
|
href?: string;
|
|
1073
|
+
/** Element override for that link, e.g. a router's Link. */
|
|
1074
|
+
as?: ElementType;
|
|
1075
|
+
/** The root is an `<a>`, a `<button>` or a `<div>` depending on the props,
|
|
1076
|
+
so the ref is typed to what all three are. */
|
|
1077
|
+
ref?: Ref<HTMLElement>;
|
|
966
1078
|
}
|
|
967
1079
|
/**
|
|
968
1080
|
* Surface container. Compose with CardHeader/CardBody/CardFooter — the card
|
|
@@ -978,8 +1090,10 @@ interface CardProps extends Omit<HTMLAttributes<HTMLElement>, "onClick"> {
|
|
|
978
1090
|
* <Card href="/items/42" variant="flat">…</Card>
|
|
979
1091
|
* ```
|
|
980
1092
|
*/
|
|
981
|
-
declare function Card({ children, variant, emphasis, onClick, href, className, ...rest }: CardProps): ReactElement;
|
|
982
|
-
type CardSectionProps = HTMLAttributes<HTMLDivElement
|
|
1093
|
+
declare function Card({ children, variant, emphasis, onClick, href, as, className, ref, ...rest }: CardProps): ReactElement;
|
|
1094
|
+
type CardSectionProps = HTMLAttributes<HTMLDivElement> & {
|
|
1095
|
+
ref?: Ref<HTMLDivElement>;
|
|
1096
|
+
};
|
|
983
1097
|
/** Top slot — title row, media, tabs. */
|
|
984
1098
|
declare function CardHeader({ className, ...rest }: CardSectionProps): ReactElement;
|
|
985
1099
|
/** Main content slot. */
|
|
@@ -1084,8 +1198,9 @@ interface ConfirmDialogProps<T = void> {
|
|
|
1084
1198
|
/** Consequence explained in a sentence or two. */
|
|
1085
1199
|
description?: ReactNode;
|
|
1086
1200
|
confirmLabel: string;
|
|
1087
|
-
/**
|
|
1088
|
-
|
|
1201
|
+
/** Names the way out, e.g. "Cancel". Required: it is a button with words on
|
|
1202
|
+
it, and the words are the app's. */
|
|
1203
|
+
cancelLabel: string;
|
|
1089
1204
|
/** Styles the confirm action: danger for destructive, warning for
|
|
1090
1205
|
consequential-but-recoverable. */
|
|
1091
1206
|
tone?: ConfirmDialogTone;
|
|
@@ -1111,6 +1226,7 @@ interface ConfirmDialogProps<T = void> {
|
|
|
1111
1226
|
* title="Delete session?"
|
|
1112
1227
|
* description="This cannot be undone."
|
|
1113
1228
|
* confirmLabel="Delete"
|
|
1229
|
+
* cancelLabel="Cancel"
|
|
1114
1230
|
* tone="danger"
|
|
1115
1231
|
* />
|
|
1116
1232
|
* ```
|
|
@@ -1150,7 +1266,7 @@ interface ScreenContentProps extends HTMLAttributes<HTMLElement> {
|
|
|
1150
1266
|
/** The scrollable main region of a Screen. */
|
|
1151
1267
|
declare function ScreenContent({ children, flush, className, ref, ...rest }: ScreenContentProps): react.JSX.Element;
|
|
1152
1268
|
|
|
1153
|
-
interface AppBarProps {
|
|
1269
|
+
interface AppBarProps extends Omit<HTMLAttributes<HTMLElement>, "title"> {
|
|
1154
1270
|
/** Page heading — rendered as the h1. A node is allowed for titles that
|
|
1155
1271
|
are themselves a control (e.g. a thread title that opens the event). */
|
|
1156
1272
|
title?: ReactNode;
|
|
@@ -1161,6 +1277,7 @@ interface AppBarProps {
|
|
|
1161
1277
|
leading?: ReactNode;
|
|
1162
1278
|
/** Right slot — actions. */
|
|
1163
1279
|
trailing?: ReactNode;
|
|
1280
|
+
ref?: Ref<HTMLElement>;
|
|
1164
1281
|
}
|
|
1165
1282
|
/**
|
|
1166
1283
|
* Top app bar. Sticky, one per screen; the title is the page h1.
|
|
@@ -1176,7 +1293,7 @@ interface AppBarProps {
|
|
|
1176
1293
|
* />
|
|
1177
1294
|
* ```
|
|
1178
1295
|
*/
|
|
1179
|
-
declare function AppBar({ title, subtitle, leading, trailing }: AppBarProps): react.JSX.Element;
|
|
1296
|
+
declare function AppBar({ title, subtitle, leading, trailing, className, ref, ...rest }: AppBarProps): react.JSX.Element;
|
|
1180
1297
|
|
|
1181
1298
|
interface TabBarProps {
|
|
1182
1299
|
/** Accessible name of the navigation landmark. */
|
|
@@ -1205,8 +1322,16 @@ interface TabBarItemProps {
|
|
|
1205
1322
|
/** Attention dot on the icon — unread, pending. Boolean only: the count
|
|
1206
1323
|
lives on the destination screen, the bar just says "something's there". */
|
|
1207
1324
|
badge?: boolean | undefined;
|
|
1325
|
+
/** Element override for the link, e.g. a router's Link. A bottom bar is
|
|
1326
|
+
where a full page reload costs the most — it restarts the whole shell. */
|
|
1327
|
+
as?: ElementType;
|
|
1328
|
+
/** Take the caption off the screen and leave it in the accessible name.
|
|
1329
|
+
For a bar whose glyphs carry the meaning: four captions on the narrowest
|
|
1330
|
+
phone wrap, and a translation twice the length of the English wraps
|
|
1331
|
+
everywhere. Hidden, never dropped — the word is the item's name. */
|
|
1332
|
+
hideLabel?: boolean | undefined;
|
|
1208
1333
|
}
|
|
1209
|
-
declare function TabBarItem({ label, icon, href, onClick, active, badge }: TabBarItemProps): react.JSX.Element;
|
|
1334
|
+
declare function TabBarItem({ label, icon, href, onClick, active, badge, as, hideLabel, }: TabBarItemProps): react.JSX.Element;
|
|
1210
1335
|
interface TabBarActionProps {
|
|
1211
1336
|
/** Names the action — icon-only, so this is all a screen reader gets. */
|
|
1212
1337
|
label: string;
|
|
@@ -1217,6 +1342,289 @@ interface TabBarActionProps {
|
|
|
1217
1342
|
it is a peer child, and the bar's flex layout leaves it its own width. */
|
|
1218
1343
|
declare function TabBarAction({ label, icon, onClick }: TabBarActionProps): react.JSX.Element;
|
|
1219
1344
|
|
|
1345
|
+
interface MediaPlaceholderProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
1346
|
+
/** CSS aspect-ratio for the box, e.g. "4 / 5". Default 16 / 9. */
|
|
1347
|
+
aspect?: string;
|
|
1348
|
+
/** Picture to draw. Absent, or broken, leaves the empty surface showing. */
|
|
1349
|
+
src?: string;
|
|
1350
|
+
/** Describes the picture. Empty = decorative, which is the honest default:
|
|
1351
|
+
a file name is not a description. */
|
|
1352
|
+
alt?: string;
|
|
1353
|
+
/** Glyph for the empty surface — an <Icon> or any node. */
|
|
1354
|
+
glyph?: ReactNode;
|
|
1355
|
+
/** A few words under the glyph, or over the picture. */
|
|
1356
|
+
caption?: string;
|
|
1357
|
+
/** Obscures the media without hiding that there is media. */
|
|
1358
|
+
blurred?: boolean;
|
|
1359
|
+
/** Drawn over the surface, outside the blur — a reveal prompt, a badge, a
|
|
1360
|
+
play button. The consent vocabulary that usually goes here belongs to the
|
|
1361
|
+
app, so the system takes it as a node and asks no questions about it. */
|
|
1362
|
+
cover?: ReactNode;
|
|
1363
|
+
ref?: Ref<HTMLDivElement>;
|
|
1364
|
+
}
|
|
1365
|
+
/**
|
|
1366
|
+
* The box a picture goes in, whether or not there is one yet.
|
|
1367
|
+
*
|
|
1368
|
+
* ```tsx
|
|
1369
|
+
* <MediaPlaceholder
|
|
1370
|
+
* aspect="4 / 5"
|
|
1371
|
+
* src={post.media.src}
|
|
1372
|
+
* alt={post.media.alt}
|
|
1373
|
+
* blurred={!revealed}
|
|
1374
|
+
* cover={post.sensitive && <SensitiveMediaOverlay onReveal={reveal} />}
|
|
1375
|
+
* />
|
|
1376
|
+
* ```
|
|
1377
|
+
*/
|
|
1378
|
+
declare function MediaPlaceholder({ aspect, src, alt, glyph, caption, blurred, cover, className, style, ...rest }: MediaPlaceholderProps): ReactElement;
|
|
1379
|
+
|
|
1380
|
+
interface CarouselSlide {
|
|
1381
|
+
id: string;
|
|
1382
|
+
src?: string;
|
|
1383
|
+
alt?: string;
|
|
1384
|
+
/** CSS aspect-ratio for this frame. Default 4 / 3. */
|
|
1385
|
+
aspect?: string;
|
|
1386
|
+
caption?: string;
|
|
1387
|
+
/** Obscures the frame and takes away the way into it: a covered frame does
|
|
1388
|
+
not open larger, however it is tapped. */
|
|
1389
|
+
covered?: boolean;
|
|
1390
|
+
/** Drawn over the frame, outside the blur — whatever the app asks consent
|
|
1391
|
+
with. */
|
|
1392
|
+
cover?: ReactNode;
|
|
1393
|
+
}
|
|
1394
|
+
type CarouselPager = "thumbnails" | "dots" | "none";
|
|
1395
|
+
interface ImageCarouselLabels {
|
|
1396
|
+
/** Names the carousel landmark, e.g. "Images". */
|
|
1397
|
+
region: string;
|
|
1398
|
+
/** Read out in place of "region", e.g. "carousel". A screen reader says it
|
|
1399
|
+
aloud, so it is the app's word in the app's language. */
|
|
1400
|
+
carouselRole: string;
|
|
1401
|
+
/** The same for one frame, e.g. "slide". */
|
|
1402
|
+
slideRole: string;
|
|
1403
|
+
previous: string;
|
|
1404
|
+
next: string;
|
|
1405
|
+
/** "3 of 8" — a function, because only the app knows how its language counts. */
|
|
1406
|
+
counter: (current: number, total: number) => string;
|
|
1407
|
+
/** Names one frame's thumbnail or dot, e.g. "Image 3". */
|
|
1408
|
+
slide: (position: number) => string;
|
|
1409
|
+
/** Names the button standing for the frames no thumbnail fits. */
|
|
1410
|
+
more: (hidden: number) => string;
|
|
1411
|
+
}
|
|
1412
|
+
type ImageCarouselProps = Omit<HTMLAttributes<HTMLElement>, "children" | "onChange"> & {
|
|
1413
|
+
slides: CarouselSlide[];
|
|
1414
|
+
labels: ImageCarouselLabels;
|
|
1415
|
+
/** Held index. Unset, the carousel keeps its own. */
|
|
1416
|
+
index?: number;
|
|
1417
|
+
defaultIndex?: number;
|
|
1418
|
+
onIndexChange?: (index: number) => void;
|
|
1419
|
+
pager?: CarouselPager;
|
|
1420
|
+
maxThumbnails?: number;
|
|
1421
|
+
ref?: Ref<HTMLElement>;
|
|
1422
|
+
} & ({
|
|
1423
|
+
/** Called with the frame to open larger — by the control, or by a tap
|
|
1424
|
+
on the frame itself. */
|
|
1425
|
+
onZoom: (index: number) => void;
|
|
1426
|
+
/** Glyph for that control, from the app's icon set. */
|
|
1427
|
+
zoomIcon: ReactNode;
|
|
1428
|
+
zoomLabel: string;
|
|
1429
|
+
} | {
|
|
1430
|
+
onZoom?: undefined;
|
|
1431
|
+
zoomIcon?: undefined;
|
|
1432
|
+
zoomLabel?: undefined;
|
|
1433
|
+
});
|
|
1434
|
+
/**
|
|
1435
|
+
* A gallery of frames, one on show.
|
|
1436
|
+
*
|
|
1437
|
+
* ```tsx
|
|
1438
|
+
* <ImageCarousel
|
|
1439
|
+
* slides={post.images.map((image) => ({ ...image, covered: !revealed }))}
|
|
1440
|
+
* labels={t.gallery}
|
|
1441
|
+
* onZoom={openLightbox}
|
|
1442
|
+
* zoomIcon={<Icon name="zoom-in" />}
|
|
1443
|
+
* zoomLabel={t.viewLarger}
|
|
1444
|
+
* />
|
|
1445
|
+
* ```
|
|
1446
|
+
*/
|
|
1447
|
+
declare function ImageCarousel({ slides, labels, index, defaultIndex, onIndexChange, pager, maxThumbnails, onZoom, zoomIcon, zoomLabel, className, ...rest }: ImageCarouselProps): ReactElement | null;
|
|
1448
|
+
|
|
1449
|
+
type UploadStatus = "uploading" | "processing" | "done" | "error";
|
|
1450
|
+
interface UploadProgressLabels {
|
|
1451
|
+
/** Names the bar while bytes are moving, and the state after. */
|
|
1452
|
+
uploading: string;
|
|
1453
|
+
processing: string;
|
|
1454
|
+
done: string;
|
|
1455
|
+
/** Shown when the caller has no more specific `error` to give. */
|
|
1456
|
+
error: string;
|
|
1457
|
+
cancel: string;
|
|
1458
|
+
retry: string;
|
|
1459
|
+
remove: string;
|
|
1460
|
+
}
|
|
1461
|
+
interface UploadProgressProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
1462
|
+
/** The file, as the person who picked it would name it. */
|
|
1463
|
+
name: string;
|
|
1464
|
+
labels: UploadProgressLabels;
|
|
1465
|
+
/** Thumbnail of what is going up — an `<img>`, a `<video>`, anything. */
|
|
1466
|
+
preview?: ReactNode;
|
|
1467
|
+
/** Glyph for the state it ended in, from the app's icon set. Tinted by the
|
|
1468
|
+
status: the system says which state, the app says with what glyph. */
|
|
1469
|
+
mark?: ReactNode;
|
|
1470
|
+
/** 0–100. Ignored while processing, which reports no percentage. */
|
|
1471
|
+
value?: number;
|
|
1472
|
+
status?: UploadStatus;
|
|
1473
|
+
/** The progress in words — "2.1 MB of 5 MB". Read out instead of the
|
|
1474
|
+
percentage, and shown under the bar. */
|
|
1475
|
+
detail?: string;
|
|
1476
|
+
/** Why it failed. Falls back to `labels.error`. */
|
|
1477
|
+
error?: string;
|
|
1478
|
+
onCancel?: () => void;
|
|
1479
|
+
onRetry?: () => void;
|
|
1480
|
+
onRemove?: () => void;
|
|
1481
|
+
ref?: Ref<HTMLDivElement>;
|
|
1482
|
+
}
|
|
1483
|
+
/**
|
|
1484
|
+
* One file on its way up: what it is, how far it has got, and the way out.
|
|
1485
|
+
*
|
|
1486
|
+
* ```tsx
|
|
1487
|
+
* <UploadProgress
|
|
1488
|
+
* name={file.name}
|
|
1489
|
+
* status={upload.status}
|
|
1490
|
+
* value={upload.percent}
|
|
1491
|
+
* detail={`${sent} of ${total}`}
|
|
1492
|
+
* onCancel={upload.abort}
|
|
1493
|
+
* labels={t.upload}
|
|
1494
|
+
* />
|
|
1495
|
+
* ```
|
|
1496
|
+
*/
|
|
1497
|
+
declare function UploadProgress({ name, labels, preview, mark, value, status, detail, error, onCancel, onRetry, onRemove, className, ...rest }: UploadProgressProps): ReactElement;
|
|
1498
|
+
|
|
1499
|
+
interface LightboxLabels {
|
|
1500
|
+
/** Names the dialog itself, e.g. "Image". */
|
|
1501
|
+
dialog: string;
|
|
1502
|
+
close: string;
|
|
1503
|
+
zoomIn: string;
|
|
1504
|
+
zoomOut: string;
|
|
1505
|
+
}
|
|
1506
|
+
interface LightboxProps {
|
|
1507
|
+
open: boolean;
|
|
1508
|
+
onClose: () => void;
|
|
1509
|
+
src: string;
|
|
1510
|
+
/** Empty says the picture is decoration — rare here, where it is the point. */
|
|
1511
|
+
alt?: string;
|
|
1512
|
+
caption?: string;
|
|
1513
|
+
labels: LightboxLabels;
|
|
1514
|
+
}
|
|
1515
|
+
/**
|
|
1516
|
+
* One picture, full screen, zoomable and pannable. Escape and the focus trap
|
|
1517
|
+
* come from the overlay shell; the gestures are the component's own.
|
|
1518
|
+
*
|
|
1519
|
+
* ```tsx
|
|
1520
|
+
* <Lightbox
|
|
1521
|
+
* open={shown !== null}
|
|
1522
|
+
* onClose={() => setShown(null)}
|
|
1523
|
+
* src={shown?.src ?? ""}
|
|
1524
|
+
* alt={shown?.alt ?? ""}
|
|
1525
|
+
* labels={{ dialog: t("image"), close: t("close"), zoomIn: t("zoomIn"), zoomOut: t("zoomOut") }}
|
|
1526
|
+
* />
|
|
1527
|
+
* ```
|
|
1528
|
+
*/
|
|
1529
|
+
declare function Lightbox({ open, onClose, src, alt, caption, labels }: LightboxProps): react.JSX.Element;
|
|
1530
|
+
|
|
1531
|
+
interface VideoChapter {
|
|
1532
|
+
/** Where the chapter starts, in seconds. */
|
|
1533
|
+
at: number;
|
|
1534
|
+
label: string;
|
|
1535
|
+
}
|
|
1536
|
+
interface VideoCaptions {
|
|
1537
|
+
src: string;
|
|
1538
|
+
lang: string;
|
|
1539
|
+
/** Shown in the browser's own track menu, so it is the app's word. */
|
|
1540
|
+
label: string;
|
|
1541
|
+
defaultOn?: boolean;
|
|
1542
|
+
}
|
|
1543
|
+
interface VideoPlayerLabels {
|
|
1544
|
+
/** Names the player itself, e.g. "Hip harness, slowly". */
|
|
1545
|
+
region: string;
|
|
1546
|
+
play: string;
|
|
1547
|
+
pause: string;
|
|
1548
|
+
mute: string;
|
|
1549
|
+
unmute: string;
|
|
1550
|
+
fullscreen: string;
|
|
1551
|
+
exitFullscreen: string;
|
|
1552
|
+
seek: string;
|
|
1553
|
+
}
|
|
1554
|
+
type Chaptered = {
|
|
1555
|
+
chapters: VideoChapter[];
|
|
1556
|
+
chaptersLabel: string;
|
|
1557
|
+
onChapterSelect?: (at: number) => void;
|
|
1558
|
+
} | {
|
|
1559
|
+
chapters?: undefined;
|
|
1560
|
+
chaptersLabel?: undefined;
|
|
1561
|
+
onChapterSelect?: undefined;
|
|
1562
|
+
};
|
|
1563
|
+
type Captioned = {
|
|
1564
|
+
captions: VideoCaptions;
|
|
1565
|
+
captionsLabel: string;
|
|
1566
|
+
} | {
|
|
1567
|
+
captions?: undefined;
|
|
1568
|
+
captionsLabel?: undefined;
|
|
1569
|
+
};
|
|
1570
|
+
type VideoPlayerProps = Omit<HTMLAttributes<HTMLElement>, "children"> & {
|
|
1571
|
+
src: string;
|
|
1572
|
+
poster?: string;
|
|
1573
|
+
labels: VideoPlayerLabels;
|
|
1574
|
+
autoPlay?: boolean;
|
|
1575
|
+
/** Obscures the picture and takes away the way into it — the cover is the
|
|
1576
|
+
only way in while this is set. */
|
|
1577
|
+
covered?: boolean;
|
|
1578
|
+
/** Drawn over the picture, outside the blur: whatever asks to be let past. */
|
|
1579
|
+
cover?: ReactNode;
|
|
1580
|
+
ref?: Ref<HTMLElement>;
|
|
1581
|
+
} & Chaptered & Captioned;
|
|
1582
|
+
/**
|
|
1583
|
+
* A video with its own transport: play, seek, sound, captions, fullscreen and
|
|
1584
|
+
* chapters. The picture can be covered — `covered` obscures it and `cover`
|
|
1585
|
+
* holds whatever asks to be let past, which is the app's to write.
|
|
1586
|
+
*
|
|
1587
|
+
* ```tsx
|
|
1588
|
+
* <VideoPlayer
|
|
1589
|
+
* src={video.url}
|
|
1590
|
+
* poster={video.posterUrl}
|
|
1591
|
+
* labels={{ region: t("video.of", { title }), play: t("video.play"), … }}
|
|
1592
|
+
* chapters={chapters}
|
|
1593
|
+
* chaptersLabel={t("video.chapters")}
|
|
1594
|
+
* />
|
|
1595
|
+
* ```
|
|
1596
|
+
*/
|
|
1597
|
+
declare function VideoPlayer({ src, poster, labels, chapters, chaptersLabel, onChapterSelect, captions, captionsLabel, autoPlay, covered, cover, className, ref, ...rest }: VideoPlayerProps): ReactElement;
|
|
1598
|
+
|
|
1599
|
+
interface Crumb {
|
|
1600
|
+
label: string;
|
|
1601
|
+
/** Absent = not a link. The last step never links, wherever it points. */
|
|
1602
|
+
href?: string;
|
|
1603
|
+
}
|
|
1604
|
+
interface BreadcrumbProps extends Omit<HTMLAttributes<HTMLElement>, "children"> {
|
|
1605
|
+
/** The trail, root first. The last item is where the reader is. */
|
|
1606
|
+
items: Crumb[];
|
|
1607
|
+
/** Names the landmark, e.g. "Breadcrumb". Required: a page can hold several
|
|
1608
|
+
navigation landmarks, and the words are the app's. */
|
|
1609
|
+
label: string;
|
|
1610
|
+
/** Element the links render as, e.g. a router's Link. */
|
|
1611
|
+
linkAs?: ElementType;
|
|
1612
|
+
ref?: Ref<HTMLElement>;
|
|
1613
|
+
}
|
|
1614
|
+
/**
|
|
1615
|
+
* The trail back up. A navigation landmark holding an ordered list, with the
|
|
1616
|
+
* current page as its last, unlinked step.
|
|
1617
|
+
*
|
|
1618
|
+
* ```tsx
|
|
1619
|
+
* <Breadcrumb
|
|
1620
|
+
* label={t("nav.breadcrumb")}
|
|
1621
|
+
* linkAs={RouterLink}
|
|
1622
|
+
* items={[{ label: "Library", href: "/library" }, { label: "Kihon" }]}
|
|
1623
|
+
* />
|
|
1624
|
+
* ```
|
|
1625
|
+
*/
|
|
1626
|
+
declare function Breadcrumb({ items, label, linkAs, className, ...rest }: BreadcrumbProps): ReactElement | null;
|
|
1627
|
+
|
|
1220
1628
|
interface UseOverlayOptions {
|
|
1221
1629
|
open: boolean;
|
|
1222
1630
|
onClose: () => void;
|
|
@@ -1297,4 +1705,4 @@ interface RovingGroupOptions {
|
|
|
1297
1705
|
*/
|
|
1298
1706
|
declare function useRovingGroup(ref: RefObject<HTMLElement | null>, { selector, orientation }: RovingGroupOptions): (event: KeyboardEvent<HTMLElement>) => void;
|
|
1299
1707
|
|
|
1300
|
-
export { AppBar, type AppBarProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeTone, Button, type ButtonProps, type ButtonSize, type ButtonVariant, type CSSVars, Card, CardBody, CardFooter, CardHeader, type CardProps, type CardSectionProps, type CardVariant, Checkbox, type CheckboxProps, Chip, ChipBar, type ChipBarGap, type ChipBarProps, ChipGroup, type ChipGroupGap, type ChipGroupProps, type ChipProps, type ChipVariant, ConfirmDialog, type ConfirmDialogProps, type ConfirmDialogTone, Container, type ContainerProps, type ContainerWidth, CountButton, type CountButtonProps, type CountButtonTone, DateTimePicker, type DateTimePickerLabels, type DateTimePickerProps, Divider, type DividerProps, EmptyState, type EmptyStateProps, Field, type FieldContextValue, type FieldProps, Heading, type HeadingLevel, type HeadingProps, type HeadingTone, Icon, type IconProps, IconProvider, type IconProviderProps, type IconRender, type IconRenderProps, type IconSize, Inline, type InlineAlign, type InlineGap, type InlineJustify, type InlineProps, Input, type InputProps, type InputSize, Link, type LinkProps, type LinkVariant, ListGroup, type ListGroupProps, ListItem, type ListItemProps, Modal, ModalBody, ModalFooter, ModalHeader, type ModalProps, type OverlayHistory, OverlayHistoryContext, PasswordInput, type PasswordInputProps, type Presence, ProgressBar, type ProgressBarProps, Radio, type RadioProps, type RovingGroupOptions, Screen, ScreenContent, type ScreenContentProps, SearchField, type SearchFieldProps, type SegmentOption, SegmentedControl, type SegmentedControlProps, Select, type SelectProps, type SelectSize, Sheet, SheetBody, SheetFooter, SheetHeader, type SheetProps, Skeleton, type SkeletonProps, type SkeletonVariant, Spinner, type SpinnerProps, Stack, type StackAlign, type StackGap, type StackProps, Switch, type SwitchProps, Tab, TabBar, TabBarAction, type TabBarActionProps, TabBarItem, type TabBarItemProps, type TabBarProps, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, Tag, type TagProps, type TagTone, Text, type TextProps, type TextTone, type TextVariant, Textarea, type TextareaProps, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastTone, type UseOverlayOptions, cx, useFieldContext, useOverlay, usePresence, useRovingGroup, useToast };
|
|
1708
|
+
export { AppBar, type AppBarProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeTone, Breadcrumb, type BreadcrumbProps, Button, type ButtonProps, type ButtonShape, type ButtonSize, type ButtonVariant, type CSSVars, Card, CardBody, CardFooter, CardHeader, type CardProps, type CardSectionProps, type CardVariant, type CarouselPager, type CarouselSlide, Checkbox, type CheckboxProps, Chip, ChipBar, type ChipBarGap, type ChipBarProps, ChipGroup, type ChipGroupGap, type ChipGroupProps, type ChipProps, type ChipVariant, ConfirmDialog, type ConfirmDialogProps, type ConfirmDialogTone, Container, type ContainerProps, type ContainerWidth, CountButton, type CountButtonProps, type CountButtonTone, type Crumb, DateTimePicker, type DateTimePickerLabels, type DateTimePickerProps, Divider, type DividerProps, EmptyState, type EmptyStateProps, Field, type FieldContextValue, type FieldProps, Heading, type HeadingLevel, type HeadingProps, type HeadingTone, Icon, type IconProps, IconProvider, type IconProviderProps, type IconRender, type IconRenderProps, type IconSize, ImageCarousel, type ImageCarouselLabels, type ImageCarouselProps, Inline, type InlineAlign, type InlineGap, type InlineJustify, type InlineProps, Input, type InputProps, type InputSize, Lightbox, type LightboxLabels, type LightboxProps, Link, type LinkProps, type LinkVariant, ListGroup, type ListGroupProps, ListItem, type ListItemProps, MediaPlaceholder, type MediaPlaceholderProps, Modal, ModalBody, ModalFooter, ModalHeader, type ModalProps, type OverlayHistory, OverlayHistoryContext, PasswordInput, type PasswordInputProps, type Presence, ProgressBar, type ProgressBarProps, Radio, type RadioProps, type RovingGroupOptions, Screen, ScreenContent, type ScreenContentProps, SearchField, type SearchFieldProps, type SegmentOption, SegmentedControl, type SegmentedControlProps, type SegmentedControlSize, Select, type SelectProps, type SelectSize, Sheet, SheetBody, SheetFooter, SheetHeader, type SheetProps, Skeleton, type SkeletonProps, type SkeletonVariant, Spinner, type SpinnerProps, Stack, type StackAlign, type StackGap, type StackProps, Switch, type SwitchProps, Tab, TabBar, TabBarAction, type TabBarActionProps, TabBarItem, type TabBarItemProps, type TabBarProps, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, Tag, type TagProps, type TagTone, Text, type TextProps, type TextTone, type TextVariant, Textarea, type TextareaProps, type ToastAction, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastTone, UploadProgress, type UploadProgressLabels, type UploadProgressProps, type UploadStatus, type UseOverlayOptions, type VideoCaptions, type VideoChapter, VideoPlayer, type VideoPlayerLabels, type VideoPlayerProps, VisuallyHidden, type VisuallyHiddenProps, cx, useFieldContext, useOverlay, usePresence, useRovingGroup, useToast };
|