@aurora-ds/components 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -1
- package/dist/cjs/index.js +4855 -1558
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +4878 -1606
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +1336 -16
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ComponentType, SVGProps, ButtonHTMLAttributes, Ref, FC, AnchorHTMLAttributes, ReactNode, HTMLAttributes, CSSProperties, TdHTMLAttributes, ThHTMLAttributes, AriaAttributes, ErrorInfo, Component, FormEvent, InputHTMLAttributes, MouseEvent, AriaRole } from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
4
|
|
|
3
5
|
declare const lightPalette: {
|
|
4
6
|
surfaceBackground: string;
|
|
@@ -28,6 +30,7 @@ declare const lightPalette: {
|
|
|
28
30
|
borderSubtle: string;
|
|
29
31
|
borderMain: string;
|
|
30
32
|
borderStrong: string;
|
|
33
|
+
focusRing: string;
|
|
31
34
|
disabledMain: string;
|
|
32
35
|
disabledText: string;
|
|
33
36
|
successMain: string;
|
|
@@ -302,6 +305,63 @@ type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
|
302
305
|
*/
|
|
303
306
|
declare const Button: FC<ButtonProps>;
|
|
304
307
|
|
|
308
|
+
/** Semantic color intent of the FAB. */
|
|
309
|
+
type FabColor = ButtonColor;
|
|
310
|
+
/** SVG icon component used by the FAB. */
|
|
311
|
+
type FabIcon = ButtonIcon;
|
|
312
|
+
/** Size token controlling dimensions of the FAB. */
|
|
313
|
+
type FabSize = 'sm' | 'md' | 'lg';
|
|
314
|
+
/** Screen corner where the FAB is anchored when `position` is fixed. */
|
|
315
|
+
type FabPlacement = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
316
|
+
|
|
317
|
+
type FabProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'aria-label'> & {
|
|
318
|
+
/** Ref forwarded to the underlying button element. */
|
|
319
|
+
ref?: Ref<HTMLButtonElement>;
|
|
320
|
+
/**
|
|
321
|
+
* Accessible label — required since the FAB may contain only an icon.
|
|
322
|
+
* @a11y Required — the button's only accessible name when no label is visible. Describe the action (e.g. "Add item").
|
|
323
|
+
*/
|
|
324
|
+
ariaLabel: string;
|
|
325
|
+
/** SVG icon component rendered inside the FAB. */
|
|
326
|
+
icon: FabIcon;
|
|
327
|
+
/**
|
|
328
|
+
* Optional text label displayed next to the icon (extended FAB).
|
|
329
|
+
* When provided the FAB adopts a pill shape.
|
|
330
|
+
*/
|
|
331
|
+
label?: string;
|
|
332
|
+
/** Semantic color intent. @default 'primary' */
|
|
333
|
+
color?: FabColor;
|
|
334
|
+
/** Size token controlling width, height and icon scale. @default 'md' */
|
|
335
|
+
size?: FabSize;
|
|
336
|
+
/**
|
|
337
|
+
* Screen corner where the FAB is anchored with `position: fixed`.
|
|
338
|
+
* Set to `undefined` to opt out of fixed positioning (useful for inline placement).
|
|
339
|
+
* @default 'bottom-right'
|
|
340
|
+
*/
|
|
341
|
+
placement?: FabPlacement | null;
|
|
342
|
+
/** Horizontal offset from the placement edge. @default '1.5rem' */
|
|
343
|
+
offsetX?: string;
|
|
344
|
+
/** Vertical offset from the placement edge. @default '1.5rem' */
|
|
345
|
+
offsetY?: string;
|
|
346
|
+
/** Show a spinner and disable interaction. */
|
|
347
|
+
isLoading?: boolean;
|
|
348
|
+
/** Native button type. @default 'button' */
|
|
349
|
+
type?: 'button' | 'submit' | 'reset';
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Floating Action Button (FAB).
|
|
354
|
+
*
|
|
355
|
+
* A circular elevated button intended for the primary action of a screen.
|
|
356
|
+
* Pass a `label` to get an extended (pill-shaped) FAB.
|
|
357
|
+
*
|
|
358
|
+
* @example <Fab icon={AddIcon} ariaLabel="Add item" />
|
|
359
|
+
* @example <Fab icon={AddIcon} ariaLabel="Add item" label="Add" color="success" />
|
|
360
|
+
* @example <Fab icon={EditIcon} ariaLabel="Edit" placement="bottom-left" />
|
|
361
|
+
* @example <Fab icon={AddIcon} ariaLabel="Add" placement={null} /> // inline, no fixed positioning
|
|
362
|
+
*/
|
|
363
|
+
declare const Fab: FC<FabProps>;
|
|
364
|
+
|
|
305
365
|
type IconButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'aria-label'> & {
|
|
306
366
|
/** Ref forwarded to the underlying button element. */
|
|
307
367
|
ref?: Ref<HTMLButtonElement>;
|
|
@@ -395,6 +455,371 @@ type LinkProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
|
395
455
|
*/
|
|
396
456
|
declare const Link: FC<LinkProps>;
|
|
397
457
|
|
|
458
|
+
/** Visual style available for toggle buttons. Intentionally restricted to 2 variants. */
|
|
459
|
+
type ToggleButtonVariant = 'outlined' | 'text';
|
|
460
|
+
|
|
461
|
+
type ToggleButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> & {
|
|
462
|
+
/** Ref forwarded to the underlying button element. */
|
|
463
|
+
ref?: Ref<HTMLButtonElement>;
|
|
464
|
+
/**
|
|
465
|
+
* Text label displayed inside the button.
|
|
466
|
+
* @a11y Recommended — provides the button's accessible name.
|
|
467
|
+
*/
|
|
468
|
+
label?: string;
|
|
469
|
+
/** Visual style. @default 'outlined' */
|
|
470
|
+
variant?: ToggleButtonVariant;
|
|
471
|
+
/** Semantic color. @default 'primary' */
|
|
472
|
+
color?: ButtonColor;
|
|
473
|
+
/** Size token controlling height, padding and font size. @default 'md' */
|
|
474
|
+
size?: ButtonSize;
|
|
475
|
+
/** Explicit width for the button. Accepts numbers (px) or any CSS width value. */
|
|
476
|
+
width?: number | string;
|
|
477
|
+
/** Flex grow factor applied to the button container. */
|
|
478
|
+
flexGrow?: number;
|
|
479
|
+
/** Flex shrink factor applied to the button container. */
|
|
480
|
+
flexShrink?: number;
|
|
481
|
+
/**
|
|
482
|
+
* Controlled active (pressed) state.
|
|
483
|
+
* When provided the component is in controlled mode.
|
|
484
|
+
*/
|
|
485
|
+
active?: boolean;
|
|
486
|
+
/**
|
|
487
|
+
* Initial active state for uncontrolled mode.
|
|
488
|
+
* @default false
|
|
489
|
+
*/
|
|
490
|
+
defaultActive?: boolean;
|
|
491
|
+
/** Called when the active state changes. */
|
|
492
|
+
onActiveChange?: (active: boolean) => void;
|
|
493
|
+
/**
|
|
494
|
+
* Identifier used by `ToggleGroup` to track which toggle is selected.
|
|
495
|
+
* Required when used inside a `ToggleGroup`.
|
|
496
|
+
*/
|
|
497
|
+
value?: string;
|
|
498
|
+
/** SVG icon component rendered before the label. */
|
|
499
|
+
startIcon?: ButtonIcon;
|
|
500
|
+
/** SVG icon component rendered after the label. */
|
|
501
|
+
endIcon?: ButtonIcon;
|
|
502
|
+
/** Show a spinner and disable interaction. */
|
|
503
|
+
isLoading?: boolean;
|
|
504
|
+
/** Native button type. @default 'button' */
|
|
505
|
+
type?: 'button' | 'submit' | 'reset';
|
|
506
|
+
};
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* A toggle button that can be pressed/unpressed (`aria-pressed`).
|
|
510
|
+
* Supports both **controlled** (`active` + `onActiveChange`) and **uncontrolled**
|
|
511
|
+
* (`defaultActive`) modes.
|
|
512
|
+
*
|
|
513
|
+
* When placed inside a `ToggleGroup`, the group manages mutual exclusivity:
|
|
514
|
+
* the `value` prop identifies this button within the group.
|
|
515
|
+
*
|
|
516
|
+
* @example
|
|
517
|
+
* // Standalone, uncontrolled
|
|
518
|
+
* <ToggleButton label="Bold" defaultActive={false} onActiveChange={setBold} />
|
|
519
|
+
*
|
|
520
|
+
* @example
|
|
521
|
+
* // Standalone, controlled
|
|
522
|
+
* <ToggleButton label="Bold" active={isBold} onActiveChange={setIsBold} />
|
|
523
|
+
*
|
|
524
|
+
* @example
|
|
525
|
+
* // Inside a ToggleGroup
|
|
526
|
+
* <ToggleGroup defaultValue="md" ariaLabel="Text size">
|
|
527
|
+
* <ToggleButton value="sm" label="Small" />
|
|
528
|
+
* <ToggleButton value="md" label="Medium" />
|
|
529
|
+
* </ToggleGroup>
|
|
530
|
+
*/
|
|
531
|
+
declare const ToggleButton: FC<ToggleButtonProps>;
|
|
532
|
+
|
|
533
|
+
type ToggleIconButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'aria-label'> & {
|
|
534
|
+
/** Ref forwarded to the underlying button element. */
|
|
535
|
+
ref?: Ref<HTMLButtonElement>;
|
|
536
|
+
/** SVG icon component to render inside the button. */
|
|
537
|
+
icon: ButtonIcon;
|
|
538
|
+
/**
|
|
539
|
+
* Accessible label — required since there is no visible text.
|
|
540
|
+
* @a11y Required — the button's only accessible name. Describe the action, not the icon.
|
|
541
|
+
*/
|
|
542
|
+
ariaLabel: string;
|
|
543
|
+
/** Visual style. @default 'outlined' */
|
|
544
|
+
variant?: ToggleButtonVariant;
|
|
545
|
+
/** Semantic color. @default 'primary' */
|
|
546
|
+
color?: ButtonColor;
|
|
547
|
+
/** Size token controlling width, height and padding. @default 'md' */
|
|
548
|
+
size?: ButtonSize;
|
|
549
|
+
/** Show a spinner and disable interaction. */
|
|
550
|
+
isLoading?: boolean;
|
|
551
|
+
/** Native button type. @default 'button' */
|
|
552
|
+
type?: 'button' | 'submit' | 'reset';
|
|
553
|
+
/**
|
|
554
|
+
* Controlled active (pressed) state.
|
|
555
|
+
* When provided the component is in controlled mode.
|
|
556
|
+
*/
|
|
557
|
+
active?: boolean;
|
|
558
|
+
/**
|
|
559
|
+
* Initial active state for uncontrolled mode.
|
|
560
|
+
* @default false
|
|
561
|
+
*/
|
|
562
|
+
defaultActive?: boolean;
|
|
563
|
+
/** Called when the active state changes. */
|
|
564
|
+
onActiveChange?: (active: boolean) => void;
|
|
565
|
+
/**
|
|
566
|
+
* Identifier used by `ToggleGroup` to track which toggle is selected.
|
|
567
|
+
* Required when used inside a `ToggleGroup`.
|
|
568
|
+
*/
|
|
569
|
+
value?: string;
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* A square icon-only toggle button that can be pressed/unpressed (`aria-pressed`).
|
|
574
|
+
* `ariaLabel` is mandatory since there is no visible text.
|
|
575
|
+
*
|
|
576
|
+
* Supports both **controlled** (`active` + `onActiveChange`) and **uncontrolled**
|
|
577
|
+
* (`defaultActive`) modes.
|
|
578
|
+
*
|
|
579
|
+
* When placed inside a `ToggleGroup`, the group manages mutual exclusivity:
|
|
580
|
+
* the `value` prop identifies this button within the group.
|
|
581
|
+
*
|
|
582
|
+
* @example
|
|
583
|
+
* // Standalone, controlled
|
|
584
|
+
* <ToggleIconButton icon={BoldIcon} ariaLabel="Toggle bold" active={isBold} onActiveChange={setIsBold} />
|
|
585
|
+
*
|
|
586
|
+
* @example
|
|
587
|
+
* // Inside a ToggleGroup (alignment segmented control)
|
|
588
|
+
* <ToggleGroup value={align} onChange={setAlign} ariaLabel="Text alignment" joined>
|
|
589
|
+
* <ToggleIconButton value="left" icon={AlignLeftIcon} ariaLabel="Align left" />
|
|
590
|
+
* <ToggleIconButton value="center" icon={AlignCenterIcon} ariaLabel="Align center" />
|
|
591
|
+
* <ToggleIconButton value="right" icon={AlignRightIcon} ariaLabel="Align right" />
|
|
592
|
+
* </ToggleGroup>
|
|
593
|
+
*/
|
|
594
|
+
declare const ToggleIconButton: FC<ToggleIconButtonProps>;
|
|
595
|
+
|
|
596
|
+
type ToggleGroupProps = {
|
|
597
|
+
/** Toggle buttons to render inside the group. */
|
|
598
|
+
children: ReactNode;
|
|
599
|
+
/**
|
|
600
|
+
* Controlled selected value.
|
|
601
|
+
* When provided the component is in controlled mode.
|
|
602
|
+
* Pass `null` to express "nothing selected".
|
|
603
|
+
*/
|
|
604
|
+
value?: string | null;
|
|
605
|
+
/**
|
|
606
|
+
* Initial selected value for uncontrolled mode.
|
|
607
|
+
* @default null
|
|
608
|
+
*/
|
|
609
|
+
defaultValue?: string | null;
|
|
610
|
+
/** Called when the selected value changes. */
|
|
611
|
+
onChange?: (value: string | null) => void;
|
|
612
|
+
/**
|
|
613
|
+
* Accessible label for the group.
|
|
614
|
+
* @a11y Either `ariaLabel` or `ariaLabelledBy` is required.
|
|
615
|
+
*/
|
|
616
|
+
ariaLabel?: string;
|
|
617
|
+
/**
|
|
618
|
+
* ID of an element that labels this group.
|
|
619
|
+
* @a11y Alternative to `ariaLabel`.
|
|
620
|
+
*/
|
|
621
|
+
ariaLabelledBy?: string;
|
|
622
|
+
/**
|
|
623
|
+
* Layout direction.
|
|
624
|
+
* @default 'horizontal'
|
|
625
|
+
*/
|
|
626
|
+
orientation?: 'horizontal' | 'vertical';
|
|
627
|
+
/**
|
|
628
|
+
* Visually join the toggle buttons into a single segmented control
|
|
629
|
+
* (shared borders, no gap, rounded ends only).
|
|
630
|
+
* @default false
|
|
631
|
+
*/
|
|
632
|
+
joined?: boolean;
|
|
633
|
+
/**
|
|
634
|
+
* Variant applied to all child toggles (overrides their own `variant` prop).
|
|
635
|
+
*/
|
|
636
|
+
variant?: ToggleButtonVariant;
|
|
637
|
+
/**
|
|
638
|
+
* Color applied to all child toggles (overrides their own `color` prop).
|
|
639
|
+
*/
|
|
640
|
+
color?: ButtonColor;
|
|
641
|
+
/**
|
|
642
|
+
* Size applied to all child toggles (overrides their own `size` prop).
|
|
643
|
+
*/
|
|
644
|
+
size?: ButtonSize;
|
|
645
|
+
/**
|
|
646
|
+
* Whether clicking the currently active toggle deselects it (value becomes null).
|
|
647
|
+
* @default true
|
|
648
|
+
*/
|
|
649
|
+
allowDeselect?: boolean;
|
|
650
|
+
};
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* Groups multiple `ToggleButton` or `ToggleIconButton` components so that only
|
|
654
|
+
* one can be active at a time (mutual exclusivity).
|
|
655
|
+
*
|
|
656
|
+
* Supports both **controlled** (`value` + `onChange`) and **uncontrolled**
|
|
657
|
+
* (`defaultValue`) modes. Set `allowDeselect={false}` to always keep one
|
|
658
|
+
* option selected.
|
|
659
|
+
*
|
|
660
|
+
* @example
|
|
661
|
+
* // Uncontrolled
|
|
662
|
+
* <ToggleGroup defaultValue="md" ariaLabel="Text size">
|
|
663
|
+
* <ToggleButton value="sm" label="Small" />
|
|
664
|
+
* <ToggleButton value="md" label="Medium" />
|
|
665
|
+
* <ToggleButton value="lg" label="Large" />
|
|
666
|
+
* </ToggleGroup>
|
|
667
|
+
*
|
|
668
|
+
* @example
|
|
669
|
+
* // Controlled
|
|
670
|
+
* const [align, setAlign] = useState<string | null>('left')
|
|
671
|
+
* <ToggleGroup value={align} onChange={setAlign} ariaLabel="Text alignment" joined>
|
|
672
|
+
* <ToggleIconButton value="left" icon={AlignLeftIcon} ariaLabel="Align left" />
|
|
673
|
+
* <ToggleIconButton value="center" icon={AlignCenterIcon} ariaLabel="Align center" />
|
|
674
|
+
* <ToggleIconButton value="right" icon={AlignRightIcon} ariaLabel="Align right" />
|
|
675
|
+
* </ToggleGroup>
|
|
676
|
+
*/
|
|
677
|
+
declare const ToggleGroup: FC<ToggleGroupProps>;
|
|
678
|
+
|
|
679
|
+
/** Avatar size token controlling the avatar's width and height. */
|
|
680
|
+
type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
681
|
+
/** Avatar shape – circle (default) or rounded square. */
|
|
682
|
+
type AvatarShape = 'circle' | 'square';
|
|
683
|
+
/**
|
|
684
|
+
* Semantic color intent used for the fallback background
|
|
685
|
+
* (shown when no image is provided).
|
|
686
|
+
*/
|
|
687
|
+
type AvatarColor = 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info' | 'orange' | 'pink' | 'violet';
|
|
688
|
+
/** Overlap density between avatars inside an AvatarGroup. */
|
|
689
|
+
type AvatarGroupOverlap = 'sm' | 'md' | 'lg';
|
|
690
|
+
|
|
691
|
+
type AvatarProps = {
|
|
692
|
+
/**
|
|
693
|
+
* URL of the image to display.
|
|
694
|
+
* Falls back to `initials` (or first letters of `name`) if the image fails to load.
|
|
695
|
+
*/
|
|
696
|
+
src?: string;
|
|
697
|
+
/**
|
|
698
|
+
* Full name of the person/entity.
|
|
699
|
+
* Automatically extracts 1–2 initials when no `src` is provided.
|
|
700
|
+
* Also used as `aria-label` when no explicit `ariaLabel` is given.
|
|
701
|
+
*/
|
|
702
|
+
name?: string;
|
|
703
|
+
/**
|
|
704
|
+
* Explicit initials to display when no image is available.
|
|
705
|
+
* Takes precedence over initials derived from `name`.
|
|
706
|
+
* Keep to 1–2 characters.
|
|
707
|
+
*/
|
|
708
|
+
initials?: string;
|
|
709
|
+
/** Size token controlling width and height. @default 'md' */
|
|
710
|
+
size?: AvatarSize;
|
|
711
|
+
/** Shape of the avatar. @default 'circle' */
|
|
712
|
+
shape?: AvatarShape;
|
|
713
|
+
/**
|
|
714
|
+
* Background color token used for the fallback (initials/empty) state.
|
|
715
|
+
* @default 'primary'
|
|
716
|
+
*/
|
|
717
|
+
color?: AvatarColor;
|
|
718
|
+
/**
|
|
719
|
+
* Makes the avatar interactive (adds `role="button"` and keyboard support).
|
|
720
|
+
* Called when the user clicks or presses Enter/Space.
|
|
721
|
+
*/
|
|
722
|
+
onClick?: () => void;
|
|
723
|
+
/** Accessible label. Defaults to `name` when set, otherwise `'Avatar'`. */
|
|
724
|
+
ariaLabel?: string;
|
|
725
|
+
};
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* Displays a user's profile picture, falling back gracefully to initials
|
|
729
|
+
* and then to a blank coloured circle when no image is available.
|
|
730
|
+
*
|
|
731
|
+
* **Display priority:**
|
|
732
|
+
* 1. `src` image (hides on load error)
|
|
733
|
+
* 2. `initials` (explicit) or letters derived from `name`
|
|
734
|
+
* 3. Empty coloured circle
|
|
735
|
+
*
|
|
736
|
+
* **Accessibility:**
|
|
737
|
+
* - Static avatar → `role="img"` + `aria-label`
|
|
738
|
+
* - Interactive avatar (has `onClick`) → `role="button"` + keyboard support
|
|
739
|
+
*
|
|
740
|
+
* @example
|
|
741
|
+
* ```tsx
|
|
742
|
+
* // Image avatar:
|
|
743
|
+
* <Avatar src="/users/alice.jpg" name="Alice Dupont" size="md" />
|
|
744
|
+
*
|
|
745
|
+
* // Initials fallback:
|
|
746
|
+
* <Avatar name="Bob Martin" color="info" size="lg" />
|
|
747
|
+
*
|
|
748
|
+
* // Interactive:
|
|
749
|
+
* <Avatar src="/me.jpg" name="Me" onClick={() => openProfile()} ariaLabel="Open profile" />
|
|
750
|
+
* ```
|
|
751
|
+
*/
|
|
752
|
+
declare const Avatar: FC<AvatarProps>;
|
|
753
|
+
|
|
754
|
+
type AvatarGroupProps = {
|
|
755
|
+
/** Avatar components to render inside the group. */
|
|
756
|
+
children: ReactNode;
|
|
757
|
+
/**
|
|
758
|
+
* Maximum number of avatars to display.
|
|
759
|
+
* When exceeded, a surplus counter (+N) avatar is shown at the end.
|
|
760
|
+
*/
|
|
761
|
+
max?: number;
|
|
762
|
+
/**
|
|
763
|
+
* Size passed down to all Avatar children and to the surplus avatar.
|
|
764
|
+
* Individual Avatar size props are overridden by this value when set.
|
|
765
|
+
*/
|
|
766
|
+
size?: AvatarSize;
|
|
767
|
+
/**
|
|
768
|
+
* Shape passed down to all Avatar children **and to the surplus avatar**.
|
|
769
|
+
* Ensures visual consistency — e.g. `shape="square"` makes the +N tile
|
|
770
|
+
* square as well.
|
|
771
|
+
* Individual Avatar shape props are overridden by this value when set.
|
|
772
|
+
*/
|
|
773
|
+
shape?: AvatarShape;
|
|
774
|
+
/**
|
|
775
|
+
* Controls the horizontal overlap between adjacent avatars.
|
|
776
|
+
* - `sm` — tight (most overlap)
|
|
777
|
+
* - `md` — moderate overlap (default)
|
|
778
|
+
* - `lg` — loose (least overlap)
|
|
779
|
+
* @default 'md'
|
|
780
|
+
*/
|
|
781
|
+
overlap?: AvatarGroupOverlap;
|
|
782
|
+
/**
|
|
783
|
+
* Background color of the surplus counter avatar (+N).
|
|
784
|
+
* @default 'default'
|
|
785
|
+
*/
|
|
786
|
+
surplusColor?: AvatarColor;
|
|
787
|
+
/**
|
|
788
|
+
* Accessible label for the group (`aria-label` on `role="list"`).
|
|
789
|
+
*
|
|
790
|
+
* **Auto-computed when omitted** — built from the `name` props of child
|
|
791
|
+
* Avatars (e.g. *"Alice Dupont, Bob Martin et 3 autres"*).
|
|
792
|
+
* Pass an explicit value to override this behaviour.
|
|
793
|
+
*/
|
|
794
|
+
ariaLabel?: string;
|
|
795
|
+
};
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* Renders a horizontally overlapping stack of `Avatar` components.
|
|
799
|
+
*
|
|
800
|
+
* When the number of children exceeds `max`, the remaining count is shown
|
|
801
|
+
* as a **surplus avatar** (`+N`) at the end of the row.
|
|
802
|
+
*
|
|
803
|
+
* **Accessibility:**
|
|
804
|
+
* - Root element uses `role="list"` so screen readers announce the item count.
|
|
805
|
+
* - Each slot uses `role="listitem"`.
|
|
806
|
+
* - The `aria-label` on the root is auto-built from children `name` props
|
|
807
|
+
* (e.g. *"Alice Dupont, Bob Martin et 3 autres"*) unless overridden.
|
|
808
|
+
*
|
|
809
|
+
* @example
|
|
810
|
+
* ```tsx
|
|
811
|
+
* <AvatarGroup max={4} size="md" overlap="md">
|
|
812
|
+
* <Avatar name="Alice Dupont" color="primary" />
|
|
813
|
+
* <Avatar name="Bob Martin" color="info" />
|
|
814
|
+
* <Avatar src="/carol.jpg" name="Carol" />
|
|
815
|
+
* <Avatar name="Dan Lee" color="success" />
|
|
816
|
+
* <Avatar name="Eve Chen" color="warning" />
|
|
817
|
+
* </AvatarGroup>
|
|
818
|
+
* // → shows 4 avatars + "+1"
|
|
819
|
+
* ```
|
|
820
|
+
*/
|
|
821
|
+
declare const AvatarGroup: FC<AvatarGroupProps>;
|
|
822
|
+
|
|
398
823
|
/** SVG icon component used by badge icon slots. */
|
|
399
824
|
type BadgeIcon = ComponentType<SVGProps<SVGSVGElement>>;
|
|
400
825
|
/** Visual style of the badge surface. */
|
|
@@ -521,6 +946,245 @@ interface InfoBubbleProps {
|
|
|
521
946
|
*/
|
|
522
947
|
declare const InfoBubble: FC<InfoBubbleProps>;
|
|
523
948
|
|
|
949
|
+
/** Horizontal alignment of a cell's content. */
|
|
950
|
+
type TableAlign = 'left' | 'center' | 'right';
|
|
951
|
+
/** Strategy used to size the table columns. `'fixed'` honors `columns` widths strictly. */
|
|
952
|
+
type TableLayout = 'auto' | 'fixed';
|
|
953
|
+
/**
|
|
954
|
+
* Declarative column definition — the single source of truth for column widths.
|
|
955
|
+
*
|
|
956
|
+
* Widths are applied through a native `<colgroup>`, which (combined with
|
|
957
|
+
* `layout="fixed"`) is the simplest and most reliable way to control column
|
|
958
|
+
* sizing: declare it once at the root and every cell follows.
|
|
959
|
+
*/
|
|
960
|
+
type TableColumn = {
|
|
961
|
+
/** Column width — any CSS width (e.g. `'40%'`, `120`, `'12rem'`, `'auto'`). */
|
|
962
|
+
width?: CSSProperties['width'];
|
|
963
|
+
/** Minimum width applied to the column. */
|
|
964
|
+
minWidth?: CSSProperties['minWidth'];
|
|
965
|
+
/** Maximum width applied to the column. */
|
|
966
|
+
maxWidth?: CSSProperties['maxWidth'];
|
|
967
|
+
/** Default horizontal alignment for the column's loading/empty cells. @default 'left' */
|
|
968
|
+
align?: TableAlign;
|
|
969
|
+
};
|
|
970
|
+
|
|
971
|
+
type TableProps = {
|
|
972
|
+
/**
|
|
973
|
+
* Compound children — typically a `Table.Head` and a `Table.Body`.
|
|
974
|
+
* Can be omitted when `loading` or `isEmpty` is `true` — the body placeholder
|
|
975
|
+
* is rendered by the context without requiring children.
|
|
976
|
+
*/
|
|
977
|
+
children?: ReactNode;
|
|
978
|
+
/**
|
|
979
|
+
* Column definitions — the single source of truth for column widths.
|
|
980
|
+
* Rendered as a native `<colgroup>` and also used to size loading/empty rows.
|
|
981
|
+
* @example columns={[{ width: '40%' }, { width: 120 }, { width: 'auto' }]}
|
|
982
|
+
*/
|
|
983
|
+
columns?: TableColumn[];
|
|
984
|
+
/** Column sizing strategy. `'fixed'` enforces `columns` widths strictly. @default 'fixed' */
|
|
985
|
+
layout?: TableLayout;
|
|
986
|
+
/** Alternate background color on even body rows. @default false */
|
|
987
|
+
striped?: boolean;
|
|
988
|
+
/** Highlight body rows on hover. @default false */
|
|
989
|
+
hoverable?: boolean;
|
|
990
|
+
/** Wrap the table in a bordered, rounded container. @default false */
|
|
991
|
+
bordered?: boolean;
|
|
992
|
+
/**
|
|
993
|
+
* Keep the header visible while the body scrolls vertically. @default false
|
|
994
|
+
* @remarks Requires `maxHeight` so the table's own container becomes the scroller.
|
|
995
|
+
*/
|
|
996
|
+
stickyHeader?: boolean;
|
|
997
|
+
/**
|
|
998
|
+
* Constrain the table height and turn its container into the vertical scroller.
|
|
999
|
+
* Required for `stickyHeader` to take effect.
|
|
1000
|
+
*/
|
|
1001
|
+
maxHeight?: CSSProperties['maxHeight'];
|
|
1002
|
+
/**
|
|
1003
|
+
* Render a skeleton placeholder body instead of the children.
|
|
1004
|
+
* Each skeleton cell fills the width of its column. @default false
|
|
1005
|
+
* @a11y Sets `aria-busy="true"` on the table while loading.
|
|
1006
|
+
*/
|
|
1007
|
+
loading?: boolean;
|
|
1008
|
+
/** Number of skeleton rows rendered while `loading`. @default 3 */
|
|
1009
|
+
loadingRows?: number;
|
|
1010
|
+
/** Render the empty placeholder instead of the children (ignored while loading). @default false */
|
|
1011
|
+
isEmpty?: boolean;
|
|
1012
|
+
/** Content displayed when `isEmpty` is true. @default 'No data available' */
|
|
1013
|
+
emptyContent?: ReactNode;
|
|
1014
|
+
/**
|
|
1015
|
+
* Accessible name for the table.
|
|
1016
|
+
* @a11y Recommended — gives the table a name describing its content for assistive tech.
|
|
1017
|
+
*/
|
|
1018
|
+
ariaLabel?: string;
|
|
1019
|
+
/** Id of an external element labelling the table. */
|
|
1020
|
+
ariaLabelledBy?: string;
|
|
1021
|
+
/** Optional id forwarded to the `<table>` element. */
|
|
1022
|
+
id?: string;
|
|
1023
|
+
};
|
|
1024
|
+
|
|
1025
|
+
type TableBodyProps = {
|
|
1026
|
+
/**
|
|
1027
|
+
* The data rows (`Table.Row`). Ignored while the parent `Table` is
|
|
1028
|
+
* `loading` (skeleton rows are shown) or `isEmpty` (placeholder is shown).
|
|
1029
|
+
*/
|
|
1030
|
+
children?: ReactNode;
|
|
1031
|
+
};
|
|
1032
|
+
|
|
1033
|
+
type TableCellProps = TdHTMLAttributes<HTMLTableCellElement> & {
|
|
1034
|
+
ref?: Ref<HTMLTableCellElement>;
|
|
1035
|
+
/** Cell content. */
|
|
1036
|
+
children?: ReactNode;
|
|
1037
|
+
/** Horizontal alignment of the content. @default 'left' */
|
|
1038
|
+
align?: TableAlign;
|
|
1039
|
+
};
|
|
1040
|
+
|
|
1041
|
+
type TableFootProps = {
|
|
1042
|
+
/** One or more `Table.Row` rendered inside the `<tfoot>`. */
|
|
1043
|
+
children: ReactNode;
|
|
1044
|
+
};
|
|
1045
|
+
|
|
1046
|
+
type TableHeadProps = {
|
|
1047
|
+
/** One or more `Table.Row` containing `Table.HeaderCell`s. */
|
|
1048
|
+
children: ReactNode;
|
|
1049
|
+
};
|
|
1050
|
+
|
|
1051
|
+
type TableHeaderCellProps = ThHTMLAttributes<HTMLTableCellElement> & {
|
|
1052
|
+
ref?: Ref<HTMLTableCellElement>;
|
|
1053
|
+
/** Header content. */
|
|
1054
|
+
children?: ReactNode;
|
|
1055
|
+
/** Horizontal alignment of the content. @default 'left' */
|
|
1056
|
+
align?: TableAlign;
|
|
1057
|
+
/**
|
|
1058
|
+
* Scope of the header, mapped to the native `scope` attribute. @default 'col'
|
|
1059
|
+
* @a11y Required — associates the header with its column (`'col'`) or row (`'row'`).
|
|
1060
|
+
*/
|
|
1061
|
+
scope?: 'col' | 'row' | 'colgroup' | 'rowgroup';
|
|
1062
|
+
/**
|
|
1063
|
+
* Current sort direction, mapped to `aria-sort`.
|
|
1064
|
+
* @a11y Recommended on sortable columns so assistive tech announces the order.
|
|
1065
|
+
*/
|
|
1066
|
+
sortDirection?: AriaAttributes['aria-sort'];
|
|
1067
|
+
};
|
|
1068
|
+
|
|
1069
|
+
type TableRowProps = HTMLAttributes<HTMLTableRowElement> & {
|
|
1070
|
+
ref?: Ref<HTMLTableRowElement>;
|
|
1071
|
+
/** Cells of the row — `Table.HeaderCell` and/or `Table.Cell`. */
|
|
1072
|
+
children: ReactNode;
|
|
1073
|
+
/**
|
|
1074
|
+
* Marks the row as selected — sets `aria-selected="true"` and a highlighted background.
|
|
1075
|
+
* @a11y When rows are interactive, also provide keyboard handling and a focusable target.
|
|
1076
|
+
*/
|
|
1077
|
+
selected?: boolean;
|
|
1078
|
+
};
|
|
1079
|
+
|
|
1080
|
+
/** Compound component type — `Table` plus its statically attached sub-components. */
|
|
1081
|
+
type TableComponent = FC<TableProps> & {
|
|
1082
|
+
Head: FC<TableHeadProps>;
|
|
1083
|
+
Body: FC<TableBodyProps>;
|
|
1084
|
+
Foot: FC<TableFootProps>;
|
|
1085
|
+
Row: FC<TableRowProps>;
|
|
1086
|
+
HeaderCell: FC<TableHeaderCellProps>;
|
|
1087
|
+
Cell: FC<TableCellProps>;
|
|
1088
|
+
};
|
|
1089
|
+
declare const Table: TableComponent;
|
|
1090
|
+
|
|
1091
|
+
type ErrorBoundaryFallbackRenderProps = {
|
|
1092
|
+
error: Error;
|
|
1093
|
+
reset: () => void;
|
|
1094
|
+
};
|
|
1095
|
+
type ErrorBoundaryProps = {
|
|
1096
|
+
/**
|
|
1097
|
+
* Custom fallback. Receives the caught error and a `reset()` callback that
|
|
1098
|
+
* clears the error state so the children can attempt to re-mount.
|
|
1099
|
+
* If omitted, `DefaultErrorFallback` is used.
|
|
1100
|
+
*/
|
|
1101
|
+
fallback?: (props: ErrorBoundaryFallbackRenderProps) => ReactNode;
|
|
1102
|
+
/**
|
|
1103
|
+
* Side-effect hook for monitoring (Sentry, Datadog, custom logger…).
|
|
1104
|
+
* Pure UI consumers should not rely on this for state updates.
|
|
1105
|
+
*/
|
|
1106
|
+
onError?: (error: Error, info: ErrorInfo) => void;
|
|
1107
|
+
children: ReactNode;
|
|
1108
|
+
};
|
|
1109
|
+
type ErrorBoundaryState = {
|
|
1110
|
+
error: Error | null;
|
|
1111
|
+
};
|
|
1112
|
+
|
|
1113
|
+
/**
|
|
1114
|
+
* Generic React error boundary.
|
|
1115
|
+
* Catches synchronous render-time errors thrown by descendant components
|
|
1116
|
+
* and renders a recoverable fallback UI instead of crashing the whole app.
|
|
1117
|
+
*
|
|
1118
|
+
* Note: error boundaries do NOT catch:
|
|
1119
|
+
* - errors in event handlers (use try/catch + setState),
|
|
1120
|
+
* - errors in async code (promises, setTimeout),
|
|
1121
|
+
* - errors during SSR,
|
|
1122
|
+
* - errors thrown in the boundary itself.
|
|
1123
|
+
*
|
|
1124
|
+
* For routing errors thrown by loaders/actions, use `RouteErrorBoundary`
|
|
1125
|
+
* (powered by `useRouteError`) directly on a `RouteObject.errorElement`.
|
|
1126
|
+
*
|
|
1127
|
+
* Class component is mandatory: hooks cannot replace `componentDidCatch`
|
|
1128
|
+
* / `getDerivedStateFromError` as of React 19.
|
|
1129
|
+
*/
|
|
1130
|
+
declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
1131
|
+
static displayName: string;
|
|
1132
|
+
state: ErrorBoundaryState;
|
|
1133
|
+
static getDerivedStateFromError: (error: Error) => ErrorBoundaryState;
|
|
1134
|
+
componentDidCatch(error: Error, info: ErrorInfo): void;
|
|
1135
|
+
private reset;
|
|
1136
|
+
render(): string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
type DefaultErrorFallbackProps = {
|
|
1140
|
+
/** Caught error passed by `ErrorBoundary`. */
|
|
1141
|
+
error: Error;
|
|
1142
|
+
/** Callback to clear the error state and re-mount children. */
|
|
1143
|
+
onRetry: () => void;
|
|
1144
|
+
/**
|
|
1145
|
+
* Heading displayed above the message.
|
|
1146
|
+
* @default 'Something went wrong'
|
|
1147
|
+
*/
|
|
1148
|
+
title?: string;
|
|
1149
|
+
/**
|
|
1150
|
+
* Descriptive message shown below the title.
|
|
1151
|
+
* @default 'An unexpected error occurred. Please try again.'
|
|
1152
|
+
*/
|
|
1153
|
+
message?: string;
|
|
1154
|
+
/**
|
|
1155
|
+
* Label of the retry button.
|
|
1156
|
+
* @default 'Try again'
|
|
1157
|
+
*/
|
|
1158
|
+
retryLabel?: string;
|
|
1159
|
+
};
|
|
1160
|
+
|
|
1161
|
+
/**
|
|
1162
|
+
* Default fallback UI rendered by `ErrorBoundary` when no custom
|
|
1163
|
+
* `fallback` prop is provided.
|
|
1164
|
+
*
|
|
1165
|
+
* Displays a centred error message with a collapsible technical detail
|
|
1166
|
+
* section and a retry button that resets the boundary state.
|
|
1167
|
+
*
|
|
1168
|
+
* @example
|
|
1169
|
+
* ```tsx
|
|
1170
|
+
* // Used automatically by ErrorBoundary:
|
|
1171
|
+
* <ErrorBoundary>
|
|
1172
|
+
* <MyFeature />
|
|
1173
|
+
* </ErrorBoundary>
|
|
1174
|
+
*
|
|
1175
|
+
* // Or rendered directly with mocked data (e.g. in Storybook):
|
|
1176
|
+
* <DefaultErrorFallback
|
|
1177
|
+
* error={new Error('Network request failed')}
|
|
1178
|
+
* onRetry={() => refetch()}
|
|
1179
|
+
* title="Failed to load data"
|
|
1180
|
+
* />
|
|
1181
|
+
* ```
|
|
1182
|
+
*/
|
|
1183
|
+
declare const DefaultErrorFallback: {
|
|
1184
|
+
({ error, onRetry, title, message, retryLabel, }: DefaultErrorFallbackProps): react_jsx_runtime.JSX.Element;
|
|
1185
|
+
displayName: string;
|
|
1186
|
+
};
|
|
1187
|
+
|
|
524
1188
|
type IconProps = HTMLAttributes<HTMLDivElement> & {
|
|
525
1189
|
ref?: Ref<HTMLDivElement>;
|
|
526
1190
|
/**
|
|
@@ -551,12 +1215,94 @@ type IconStyleParams = {
|
|
|
551
1215
|
};
|
|
552
1216
|
|
|
553
1217
|
/**
|
|
554
|
-
* Renders an SVG icon inside a theme-aware wrapper.
|
|
1218
|
+
* Renders an SVG icon inside a theme-aware wrapper.
|
|
1219
|
+
*
|
|
1220
|
+
* @example <Icon icon={MenuIcon} size='md' strokeColor='primaryMain' />
|
|
1221
|
+
* @example <Icon icon={CloseIcon} strokeColor='textInverse' backgroundColor='primaryMain' padding='sm' borderRadius='full' />
|
|
1222
|
+
*/
|
|
1223
|
+
declare const Icon: FC<IconProps>;
|
|
1224
|
+
|
|
1225
|
+
type ImageProps = {
|
|
1226
|
+
/** URL source of the image */
|
|
1227
|
+
src: string;
|
|
1228
|
+
/**
|
|
1229
|
+
* Accessible alternative text.
|
|
1230
|
+
* - Provide a meaningful description for meaningful images.
|
|
1231
|
+
* - Pass an empty string `""` for purely decorative images.
|
|
1232
|
+
*/
|
|
1233
|
+
alt: string;
|
|
1234
|
+
/** Width of the image — any valid CSS value (e.g. '200px', '50%', 200) */
|
|
1235
|
+
width?: CSSProperties['width'];
|
|
1236
|
+
/** Height of the image — any valid CSS value (e.g. '150px', 'auto', 150) */
|
|
1237
|
+
height?: CSSProperties['height'];
|
|
1238
|
+
/** Max-width constraint — useful for responsive layouts */
|
|
1239
|
+
maxWidth?: CSSProperties['maxWidth'];
|
|
1240
|
+
/** Max-height constraint */
|
|
1241
|
+
maxHeight?: CSSProperties['maxHeight'];
|
|
1242
|
+
/** CSS object-fit value controlling how the image fills its container */
|
|
1243
|
+
objectFit?: CSSProperties['objectFit'];
|
|
1244
|
+
/** Lazy-load the image to improve performance. Defaults to 'lazy' */
|
|
1245
|
+
loading?: 'lazy' | 'eager';
|
|
1246
|
+
/** Border radius using theme tokens */
|
|
1247
|
+
borderRadius?: keyof Theme['radius'];
|
|
1248
|
+
/** ID of element that describes this image */
|
|
1249
|
+
ariaDescribedBy?: string;
|
|
1250
|
+
};
|
|
1251
|
+
|
|
1252
|
+
/**
|
|
1253
|
+
* Renders a standard HTML image (`<img>`) with sizing, object-fit, border radius,
|
|
1254
|
+
* and accessibility support.
|
|
1255
|
+
*
|
|
1256
|
+
* **Features:**
|
|
1257
|
+
* - Free sizing via `width` / `height` (e.g. `'200px'`, `'50%'`, `200`)
|
|
1258
|
+
* - Responsive constraint via `maxWidth` / `maxHeight`
|
|
1259
|
+
* - `objectFit` to control how the image fills its container
|
|
1260
|
+
* - `borderRadius` using theme tokens (e.g. `'md'`, `'full'`)
|
|
1261
|
+
* - Native lazy-loading via `loading` prop (defaults to `'lazy'`)
|
|
1262
|
+
* - Accessibility: `alt` is required — pass `""` for decorative images
|
|
1263
|
+
*
|
|
1264
|
+
* @example
|
|
1265
|
+
* ```tsx
|
|
1266
|
+
* // Decorative image (empty alt):
|
|
1267
|
+
* <Image src="/bg.jpg" alt="" width="100%" height={200} objectFit="cover" />
|
|
1268
|
+
*
|
|
1269
|
+
* // Meaningful image:
|
|
1270
|
+
* <Image
|
|
1271
|
+
* src="/avatar.png"
|
|
1272
|
+
* alt="Profile picture of Jane Doe"
|
|
1273
|
+
* width={64}
|
|
1274
|
+
* height={64}
|
|
1275
|
+
* borderRadius="full"
|
|
1276
|
+
* objectFit="cover"
|
|
1277
|
+
* />
|
|
1278
|
+
* ```
|
|
1279
|
+
*/
|
|
1280
|
+
declare const Image: FC<ImageProps>;
|
|
1281
|
+
|
|
1282
|
+
type LoaderScreenProps = {
|
|
1283
|
+
/**
|
|
1284
|
+
* Accessible label announced to screen readers while loading.
|
|
1285
|
+
* @default 'Loading…'
|
|
1286
|
+
*/
|
|
1287
|
+
label?: string;
|
|
1288
|
+
};
|
|
1289
|
+
|
|
1290
|
+
/**
|
|
1291
|
+
* Full-screen loading placeholder shown while data is being fetched.
|
|
555
1292
|
*
|
|
556
|
-
*
|
|
557
|
-
*
|
|
1293
|
+
* Renders a centred spinner over a full-viewport surface.
|
|
1294
|
+
* The spinner rotation is suppressed when the user prefers reduced motion.
|
|
1295
|
+
*
|
|
1296
|
+
* @example
|
|
1297
|
+
* ```tsx
|
|
1298
|
+
* // Swap with real content once data is ready:
|
|
1299
|
+
* {isLoading ? <LoaderScreen /> : <AppContent />}
|
|
1300
|
+
*
|
|
1301
|
+
* // With a custom label for screen readers:
|
|
1302
|
+
* <LoaderScreen label="Loading your dashboard…" />
|
|
1303
|
+
* ```
|
|
558
1304
|
*/
|
|
559
|
-
declare const
|
|
1305
|
+
declare const LoaderScreen: FC<LoaderScreenProps>;
|
|
560
1306
|
|
|
561
1307
|
/** Shape variant of the Skeleton placeholder. */
|
|
562
1308
|
type SkeletonVariant = 'text' | 'circular' | 'rectangular' | 'rounded';
|
|
@@ -599,6 +1345,53 @@ type SkeletonProps = HTMLAttributes<HTMLSpanElement> & {
|
|
|
599
1345
|
*/
|
|
600
1346
|
declare const Skeleton: FC<SkeletonProps>;
|
|
601
1347
|
|
|
1348
|
+
type SvgImageProps = {
|
|
1349
|
+
/** SVG image component to render (from ImagesRegistry) */
|
|
1350
|
+
image: ComponentType<SVGProps<SVGSVGElement>>;
|
|
1351
|
+
/** Width of the image — any valid CSS value (e.g. '200px', '50%', 200) */
|
|
1352
|
+
width?: CSSProperties['width'];
|
|
1353
|
+
/** Height of the image — any valid CSS value (e.g. '150px', 'auto', 150) */
|
|
1354
|
+
height?: CSSProperties['height'];
|
|
1355
|
+
/** Max width constraint — useful for responsive layouts */
|
|
1356
|
+
maxWidth?: CSSProperties['maxWidth'];
|
|
1357
|
+
/** Max height constraint */
|
|
1358
|
+
maxHeight?: CSSProperties['maxHeight'];
|
|
1359
|
+
/** Accessibility label for screen readers (marks the image as meaningful) */
|
|
1360
|
+
ariaLabel?: string;
|
|
1361
|
+
/** ID of element that labels this image */
|
|
1362
|
+
ariaLabelledBy?: string;
|
|
1363
|
+
/** ID of element that describes this image */
|
|
1364
|
+
ariaDescribedBy?: string;
|
|
1365
|
+
};
|
|
1366
|
+
|
|
1367
|
+
/**
|
|
1368
|
+
* Renders an SVG illustration with free-form sizing.
|
|
1369
|
+
*
|
|
1370
|
+
* Unlike `Icon` (constrained to theme font sizes), `SvgImage` accepts any
|
|
1371
|
+
* valid CSS value for `width` and `height`.
|
|
1372
|
+
*
|
|
1373
|
+
* **Features:**
|
|
1374
|
+
* - Free sizing via `width` / `height` (e.g. `'200px'`, `'50%'`, `200`)
|
|
1375
|
+
* - Responsive constraint via `maxWidth` / `maxHeight`
|
|
1376
|
+
* - Accessibility: `ariaLabel`, `ariaLabelledBy`, `ariaDescribedBy`
|
|
1377
|
+
* - No label → `aria-hidden` (decorative illustration)
|
|
1378
|
+
*
|
|
1379
|
+
* @example
|
|
1380
|
+
* ```tsx
|
|
1381
|
+
* // Decorative illustration (no accessible label needed):
|
|
1382
|
+
* <SvgImage image={ImagesRegistry.WelcomeIllustration} width={320} />
|
|
1383
|
+
*
|
|
1384
|
+
* // Meaningful illustration (must have a label):
|
|
1385
|
+
* <SvgImage
|
|
1386
|
+
* image={ImagesRegistry.EmptyStateIllustration}
|
|
1387
|
+
* width={'50%'}
|
|
1388
|
+
* maxWidth={400}
|
|
1389
|
+
* ariaLabel="No results found illustration"
|
|
1390
|
+
* />
|
|
1391
|
+
* ```
|
|
1392
|
+
*/
|
|
1393
|
+
declare const SvgImage: FC<SvgImageProps>;
|
|
1394
|
+
|
|
602
1395
|
type TextVariants = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'label' | 'strong';
|
|
603
1396
|
type TextVariantStyle = {
|
|
604
1397
|
/** HTML tag to render. */
|
|
@@ -719,6 +1512,95 @@ type FormProps = {
|
|
|
719
1512
|
*/
|
|
720
1513
|
declare const Form: FC<FormProps>;
|
|
721
1514
|
|
|
1515
|
+
/** Size variant of the RadioButton. */
|
|
1516
|
+
type RadioButtonSize = 'sm' | 'md' | 'lg';
|
|
1517
|
+
/** Semantic status of the RadioButton, affecting border and helper text color. */
|
|
1518
|
+
type RadioButtonStatus = 'default' | 'error' | 'success' | 'warning';
|
|
1519
|
+
|
|
1520
|
+
type RadioButtonProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'size'> & {
|
|
1521
|
+
ref?: Ref<HTMLInputElement>;
|
|
1522
|
+
/**
|
|
1523
|
+
* Visible label rendered next to the radio button.
|
|
1524
|
+
* @a11y Recommended — provides the radio button's accessible name (clickable to select it).
|
|
1525
|
+
*/
|
|
1526
|
+
label?: ReactNode;
|
|
1527
|
+
/**
|
|
1528
|
+
* Helper text or validation message rendered below the radio button row.
|
|
1529
|
+
* @a11y Recommended — linked to the input via `aria-describedby`.
|
|
1530
|
+
*/
|
|
1531
|
+
helperText?: string;
|
|
1532
|
+
/** Size variant controlling radio button size and text scale. @default 'md' */
|
|
1533
|
+
size?: RadioButtonSize;
|
|
1534
|
+
/**
|
|
1535
|
+
* Semantic status affecting border and helper text color. @default 'default'
|
|
1536
|
+
* @a11y Recommended — `status='error'` sets `aria-invalid` on the input.
|
|
1537
|
+
*/
|
|
1538
|
+
status?: RadioButtonStatus;
|
|
1539
|
+
/** @deprecated Use `status='error'` instead. Kept for backward compatibility. */
|
|
1540
|
+
error?: boolean;
|
|
1541
|
+
};
|
|
1542
|
+
|
|
1543
|
+
declare const RadioButton: FC<RadioButtonProps>;
|
|
1544
|
+
|
|
1545
|
+
/** Orientation of the RadioGroup. */
|
|
1546
|
+
type RadioGroupOrientation = 'vertical' | 'horizontal';
|
|
1547
|
+
|
|
1548
|
+
type RadioGroupProps = {
|
|
1549
|
+
/** The radio options to render inside the group. Should be `RadioButton` components. */
|
|
1550
|
+
children: ReactNode;
|
|
1551
|
+
/**
|
|
1552
|
+
* The `name` attribute shared by all radio inputs in the group.
|
|
1553
|
+
* If omitted, a unique id is auto-generated.
|
|
1554
|
+
*/
|
|
1555
|
+
name?: string;
|
|
1556
|
+
/** Controlled selected value. */
|
|
1557
|
+
value?: string;
|
|
1558
|
+
/** Default selected value for uncontrolled usage. */
|
|
1559
|
+
defaultValue?: string;
|
|
1560
|
+
/** Callback fired when the selected value changes. */
|
|
1561
|
+
onChange?: (value: string) => void;
|
|
1562
|
+
/**
|
|
1563
|
+
* Layout direction of the radio options.
|
|
1564
|
+
* @default 'vertical'
|
|
1565
|
+
*/
|
|
1566
|
+
orientation?: RadioGroupOrientation;
|
|
1567
|
+
/** Disables all radio buttons in the group. */
|
|
1568
|
+
disabled?: boolean;
|
|
1569
|
+
/**
|
|
1570
|
+
* Legend text rendered as an accessible `<legend>` above the group.
|
|
1571
|
+
* @a11y Recommended — labels the entire radio group for screen readers.
|
|
1572
|
+
*/
|
|
1573
|
+
legend?: ReactNode;
|
|
1574
|
+
/** Size applied to all radio buttons in the group unless individually overridden. @default 'md' */
|
|
1575
|
+
size?: RadioButtonSize;
|
|
1576
|
+
/**
|
|
1577
|
+
* Status applied to all radio buttons in the group unless individually overridden.
|
|
1578
|
+
* @default 'default'
|
|
1579
|
+
*/
|
|
1580
|
+
status?: RadioButtonStatus;
|
|
1581
|
+
/**
|
|
1582
|
+
* Marks the radio group as required.
|
|
1583
|
+
* @a11y Sets `aria-required` on the group element — indicates that at least one option must be selected.
|
|
1584
|
+
*/
|
|
1585
|
+
required?: boolean;
|
|
1586
|
+
/** @deprecated Use `status='error'` instead. Kept for backward compatibility. */
|
|
1587
|
+
error?: boolean;
|
|
1588
|
+
};
|
|
1589
|
+
|
|
1590
|
+
/**
|
|
1591
|
+
* Accessible radio group wrapping multiple `RadioButton` components inside a `<fieldset>`.
|
|
1592
|
+
*
|
|
1593
|
+
* Supports controlled (`value` + `onChange`) and uncontrolled (`defaultValue`) modes.
|
|
1594
|
+
* Propagates `name`, `value`, `disabled`, `size`, and `status` to all child `RadioButton` elements via context.
|
|
1595
|
+
*
|
|
1596
|
+
* @example
|
|
1597
|
+
* <RadioGroup legend="Preferred contact" defaultValue="email" onChange={setValue}>
|
|
1598
|
+
* <RadioButton value="email" label="Email" />
|
|
1599
|
+
* <RadioButton value="phone" label="Phone" />
|
|
1600
|
+
* </RadioGroup>
|
|
1601
|
+
*/
|
|
1602
|
+
declare const RadioGroup: FC<RadioGroupProps>;
|
|
1603
|
+
|
|
722
1604
|
type SwitchSize = 'sm' | 'md' | 'lg';
|
|
723
1605
|
type SwitchColor = 'primary' | 'success' | 'error' | 'warning' | 'info' | 'neutral';
|
|
724
1606
|
|
|
@@ -799,6 +1681,11 @@ type SelectOption = {
|
|
|
799
1681
|
label: string;
|
|
800
1682
|
/** Optional icon rendered before the label in the menu item. */
|
|
801
1683
|
icon?: ComponentType<SVGProps<SVGSVGElement>>;
|
|
1684
|
+
/**
|
|
1685
|
+
* Color applied to the icon's stroke. Uses theme color tokens.
|
|
1686
|
+
* When omitted, the icon inherits the default item color behaviour (primaryMain when selected, textSecondary otherwise).
|
|
1687
|
+
*/
|
|
1688
|
+
iconColor?: keyof Theme['colors'];
|
|
802
1689
|
/** Whether the option cannot be selected. */
|
|
803
1690
|
disabled?: boolean;
|
|
804
1691
|
/**
|
|
@@ -882,6 +1769,81 @@ type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'size'
|
|
|
882
1769
|
|
|
883
1770
|
declare const Checkbox: FC<CheckboxProps>;
|
|
884
1771
|
|
|
1772
|
+
/** Size variant of the DatePicker — aligned with the other form fields. */
|
|
1773
|
+
type DatePickerSize = TextFieldSize;
|
|
1774
|
+
/** Semantic status of the DatePicker — aligned with the other form fields. */
|
|
1775
|
+
type DatePickerStatus = TextFieldStatus;
|
|
1776
|
+
/** First day of the week shown in the calendar. `0` = Sunday … `6` = Saturday. */
|
|
1777
|
+
type WeekStart = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
1778
|
+
|
|
1779
|
+
type DatePickerProps = {
|
|
1780
|
+
/** Ref forwarded to the underlying text input. */
|
|
1781
|
+
ref?: Ref<HTMLInputElement>;
|
|
1782
|
+
/** Selected date (controlled mode). Pass `null` for an empty value. */
|
|
1783
|
+
value?: Date | null;
|
|
1784
|
+
/** Initial date for uncontrolled mode. @default null */
|
|
1785
|
+
defaultValue?: Date | null;
|
|
1786
|
+
/** Called with the new `Date` (or `null` when cleared) whenever the selection changes. */
|
|
1787
|
+
onChange?: (date: Date | null) => void;
|
|
1788
|
+
/** Earliest selectable date (inclusive). Dates before it are disabled. */
|
|
1789
|
+
minDate?: Date;
|
|
1790
|
+
/** Latest selectable date (inclusive). Dates after it are disabled. */
|
|
1791
|
+
maxDate?: Date;
|
|
1792
|
+
/**
|
|
1793
|
+
* Label rendered above the field.
|
|
1794
|
+
* @a11y Recommended — provides the field's accessible name (linked via `htmlFor`/`id`).
|
|
1795
|
+
*/
|
|
1796
|
+
label?: string;
|
|
1797
|
+
/**
|
|
1798
|
+
* Helper text or validation message rendered below the field.
|
|
1799
|
+
* @a11y Recommended — linked to the input via `aria-describedby` (and `aria-errormessage` when `status='error'`).
|
|
1800
|
+
*/
|
|
1801
|
+
helperText?: string;
|
|
1802
|
+
/** Placeholder shown when no date is selected. Defaults to the display format in uppercase (e.g. `DD/MM/YYYY`). */
|
|
1803
|
+
placeholder?: string;
|
|
1804
|
+
/** Size variant. @default 'md' */
|
|
1805
|
+
size?: DatePickerSize;
|
|
1806
|
+
/**
|
|
1807
|
+
* Semantic status affecting border and helper text color. @default 'default'
|
|
1808
|
+
* @a11y Recommended — `status='error'` sets `aria-invalid` and links the error message.
|
|
1809
|
+
*/
|
|
1810
|
+
status?: DatePickerStatus;
|
|
1811
|
+
/** Whether the field is disabled. */
|
|
1812
|
+
disabled?: boolean;
|
|
1813
|
+
/**
|
|
1814
|
+
* Whether the field is required.
|
|
1815
|
+
* @a11y Recommended — sets `aria-required` on the input and shows the visual asterisk on the label.
|
|
1816
|
+
*/
|
|
1817
|
+
required?: boolean;
|
|
1818
|
+
/** Allow typing the date directly in the input. When `false` the input is read-only. @default true */
|
|
1819
|
+
editable?: boolean;
|
|
1820
|
+
/**
|
|
1821
|
+
* Token format used to display and parse the typed value. Supports `dd`, `MM`, `yyyy`.
|
|
1822
|
+
* When omitted, the format is derived from `locale` (field order and separators).
|
|
1823
|
+
*/
|
|
1824
|
+
displayFormat?: string;
|
|
1825
|
+
/** BCP 47 locale used for month/weekday labels in the calendar. @default 'en-US' */
|
|
1826
|
+
locale?: string;
|
|
1827
|
+
/** First day of the week shown in the calendar. @default 1 (Monday) */
|
|
1828
|
+
weekStartsOn?: WeekStart;
|
|
1829
|
+
/** Fixed width for the field. Defaults to 100% of its container. */
|
|
1830
|
+
width?: string | number;
|
|
1831
|
+
/** HTML id for the input. */
|
|
1832
|
+
id?: string;
|
|
1833
|
+
};
|
|
1834
|
+
|
|
1835
|
+
/**
|
|
1836
|
+
* Accessible date field combining a text input trigger and a calendar popover.
|
|
1837
|
+
*
|
|
1838
|
+
* The input round-trips the value with `displayFormat` (typing is allowed unless
|
|
1839
|
+
* `editable={false}`), while the trailing icon button opens a focus-trapped
|
|
1840
|
+
* `role="dialog"` calendar following the WAI-ARIA date-grid pattern.
|
|
1841
|
+
*
|
|
1842
|
+
* @example <DatePicker label="Birth date" />
|
|
1843
|
+
* @example <DatePicker label="Start" minDate={new Date()} required helperText="Pick a future date." />
|
|
1844
|
+
*/
|
|
1845
|
+
declare const DatePicker: FC<DatePickerProps>;
|
|
1846
|
+
|
|
885
1847
|
type BoxProps = HTMLAttributes<HTMLDivElement> & BoxStyleProps & {
|
|
886
1848
|
ref?: Ref<HTMLDivElement>;
|
|
887
1849
|
};
|
|
@@ -953,6 +1915,54 @@ type BoxStyleProps = {
|
|
|
953
1915
|
opacity?: CSSProperties['opacity'];
|
|
954
1916
|
};
|
|
955
1917
|
|
|
1918
|
+
/**
|
|
1919
|
+
* Common props type for semantic HTML layout elements enriched with Box style props.
|
|
1920
|
+
*
|
|
1921
|
+
* Use this as the base type for semantic layout components (Article, Aside,
|
|
1922
|
+
* Footer, Header, Main, Nav, Section…) so they all expose the same token-aware
|
|
1923
|
+
* style props as `Box`.
|
|
1924
|
+
*
|
|
1925
|
+
* @template T - The underlying HTML element type (e.g. `HTMLElement`, `HTMLDivElement`).
|
|
1926
|
+
*/
|
|
1927
|
+
type SemanticBoxProps<T extends HTMLElement = HTMLElement> = HTMLAttributes<T> & BoxStyleProps & {
|
|
1928
|
+
/** Ref forwarded to the underlying HTML element. */
|
|
1929
|
+
ref?: Ref<T>;
|
|
1930
|
+
};
|
|
1931
|
+
|
|
1932
|
+
/**
|
|
1933
|
+
* Props for the Article component.
|
|
1934
|
+
* Accepts all style tokens from Box, forwarded to a native `<article>` element.
|
|
1935
|
+
*/
|
|
1936
|
+
type ArticleProps = SemanticBoxProps<HTMLElement>;
|
|
1937
|
+
|
|
1938
|
+
/**
|
|
1939
|
+
* Semantic `<article>` enriched with the same token-aware style props as `Box`.
|
|
1940
|
+
*
|
|
1941
|
+
* Use `Article` for self-contained content that could stand alone and be
|
|
1942
|
+
* re-distributed independently (blog posts, news articles, forum posts, cards).
|
|
1943
|
+
* Each `Article` should ideally have a heading.
|
|
1944
|
+
*
|
|
1945
|
+
* @example <Article padding="lg" borderRadius="md" backgroundColor="surfacePaper">…</Article>
|
|
1946
|
+
*/
|
|
1947
|
+
declare const Article: FC<ArticleProps>;
|
|
1948
|
+
|
|
1949
|
+
/**
|
|
1950
|
+
* Props for the Aside component.
|
|
1951
|
+
* Accepts all style tokens from Box, forwarded to a native `<aside>` element.
|
|
1952
|
+
*/
|
|
1953
|
+
type AsideProps = SemanticBoxProps<HTMLElement>;
|
|
1954
|
+
|
|
1955
|
+
/**
|
|
1956
|
+
* Semantic `<aside>` enriched with the same token-aware style props as `Box`.
|
|
1957
|
+
*
|
|
1958
|
+
* Use `Aside` for supplemental content that is tangentially related to the
|
|
1959
|
+
* surrounding content (sidebars, pull-quotes, ads, related links).
|
|
1960
|
+
* Screen-readers expose it as the `complementary` landmark.
|
|
1961
|
+
*
|
|
1962
|
+
* @example <Aside aria-label="Related articles" width="280px" padding="md">…</Aside>
|
|
1963
|
+
*/
|
|
1964
|
+
declare const Aside: FC<AsideProps>;
|
|
1965
|
+
|
|
956
1966
|
/**
|
|
957
1967
|
* A plain `div` enriched with convenient, token-aware style props.
|
|
958
1968
|
*
|
|
@@ -1005,6 +2015,23 @@ type CardComponent = FC<CardProps> & {
|
|
|
1005
2015
|
|
|
1006
2016
|
declare const Card: CardComponent;
|
|
1007
2017
|
|
|
2018
|
+
/**
|
|
2019
|
+
* Props for the Footer component.
|
|
2020
|
+
* Accepts all style tokens from Box, forwarded to a native `<footer>` element.
|
|
2021
|
+
*/
|
|
2022
|
+
type FooterProps = SemanticBoxProps<HTMLElement>;
|
|
2023
|
+
|
|
2024
|
+
/**
|
|
2025
|
+
* Semantic `<footer>` enriched with the same token-aware style props as `Box`.
|
|
2026
|
+
*
|
|
2027
|
+
* Use `Footer` for the closing content of a page or a section
|
|
2028
|
+
* (copyright, links, contact info). Screen-readers expose it as the
|
|
2029
|
+
* `contentinfo` landmark when it is a direct child of `<body>`.
|
|
2030
|
+
*
|
|
2031
|
+
* @example <Footer py="md" display="flex" justifyContent="space-between">…</Footer>
|
|
2032
|
+
*/
|
|
2033
|
+
declare const Footer: FC<FooterProps>;
|
|
2034
|
+
|
|
1008
2035
|
/**
|
|
1009
2036
|
* Extra CSS Grid props not covered by BoxProps.
|
|
1010
2037
|
* `columns` and `rows` are convenience shorthands:
|
|
@@ -1042,6 +2069,134 @@ type GridProps = Omit<BoxProps, 'display'> & GridStyleProps & {
|
|
|
1042
2069
|
*/
|
|
1043
2070
|
declare const Grid: FC<GridProps>;
|
|
1044
2071
|
|
|
2072
|
+
/**
|
|
2073
|
+
* Props for the Header component.
|
|
2074
|
+
* Accepts all style tokens from Box, forwarded to a native `<header>` element.
|
|
2075
|
+
*/
|
|
2076
|
+
type HeaderProps = SemanticBoxProps<HTMLElement>;
|
|
2077
|
+
|
|
2078
|
+
/**
|
|
2079
|
+
* Semantic `<header>` enriched with the same token-aware style props as `Box`.
|
|
2080
|
+
*
|
|
2081
|
+
* Use `Header` for the introductory content of a page or a section
|
|
2082
|
+
* (logo, site title, navigation). Screen-readers expose it as the
|
|
2083
|
+
* `banner` landmark when it is a direct child of `<body>`.
|
|
2084
|
+
*
|
|
2085
|
+
* @example <Header padding="md" display="flex" alignItems="center" gap="sm">…</Header>
|
|
2086
|
+
*/
|
|
2087
|
+
declare const Header: FC<HeaderProps>;
|
|
2088
|
+
|
|
2089
|
+
/**
|
|
2090
|
+
* Props for the Main component.
|
|
2091
|
+
* Accepts all style tokens from Box, forwarded to a native `<main>` element.
|
|
2092
|
+
*/
|
|
2093
|
+
type MainProps = SemanticBoxProps<HTMLElement>;
|
|
2094
|
+
|
|
2095
|
+
/**
|
|
2096
|
+
* Semantic `<main>` enriched with the same token-aware style props as `Box`.
|
|
2097
|
+
*
|
|
2098
|
+
* Use `Main` for the primary content of the page. There should be only **one**
|
|
2099
|
+
* `Main` per page. Screen-readers expose it as the `main` landmark, allowing
|
|
2100
|
+
* users to jump directly to the core content.
|
|
2101
|
+
*
|
|
2102
|
+
* @example <Main padding="xl" display="flex" flexDirection="column" gap="lg">…</Main>
|
|
2103
|
+
*/
|
|
2104
|
+
declare const Main: FC<MainProps>;
|
|
2105
|
+
|
|
2106
|
+
/**
|
|
2107
|
+
* Props for the Nav component.
|
|
2108
|
+
* Accepts all style tokens from Box, forwarded to a native `<nav>` element.
|
|
2109
|
+
*/
|
|
2110
|
+
type NavProps = SemanticBoxProps<HTMLElement>;
|
|
2111
|
+
|
|
2112
|
+
/**
|
|
2113
|
+
* Semantic `<nav>` enriched with the same token-aware style props as `Box`.
|
|
2114
|
+
*
|
|
2115
|
+
* Use `Nav` to wrap sets of navigation links. When multiple `Nav` elements
|
|
2116
|
+
* are present, give each a distinct `aria-label` so screen-reader users can
|
|
2117
|
+
* tell them apart (e.g. `aria-label="Main navigation"` vs `aria-label="Footer links"`).
|
|
2118
|
+
*
|
|
2119
|
+
* @example <Nav aria-label="Main navigation" display="flex" gap="sm">…</Nav>
|
|
2120
|
+
*/
|
|
2121
|
+
declare const Nav: FC<NavProps>;
|
|
2122
|
+
|
|
2123
|
+
/**
|
|
2124
|
+
* Props for the Section component.
|
|
2125
|
+
* Accepts all style tokens from Box, forwarded to a native `<section>` element.
|
|
2126
|
+
*/
|
|
2127
|
+
type SectionProps = SemanticBoxProps<HTMLElement>;
|
|
2128
|
+
|
|
2129
|
+
/**
|
|
2130
|
+
* Semantic `<section>` enriched with the same token-aware style props as `Box`.
|
|
2131
|
+
*
|
|
2132
|
+
* Use `Section` to group thematically related content — the browser outline
|
|
2133
|
+
* and screen-readers will announce it as a landmark region when it has an
|
|
2134
|
+
* accessible name (`aria-label` or `aria-labelledby`).
|
|
2135
|
+
*
|
|
2136
|
+
* @example <Section aria-label="Features" padding="lg" gap="md">…</Section>
|
|
2137
|
+
*/
|
|
2138
|
+
declare const Section: FC<SectionProps>;
|
|
2139
|
+
|
|
2140
|
+
/** Orientation of the separator line. */
|
|
2141
|
+
type SeparatorOrientation = 'horizontal' | 'vertical';
|
|
2142
|
+
/** Visual thickness of the separator line in pixels. */
|
|
2143
|
+
type SeparatorThickness = '1' | '2' | '4';
|
|
2144
|
+
|
|
2145
|
+
type SeparatorProps = Omit<HTMLAttributes<HTMLElement>, 'children'> & {
|
|
2146
|
+
ref?: Ref<HTMLElement>;
|
|
2147
|
+
/**
|
|
2148
|
+
* Orientation of the separator — determines layout direction. @default 'horizontal'
|
|
2149
|
+
* @a11y Sets `aria-orientation` accordingly on the rendered element.
|
|
2150
|
+
* For `'vertical'`, the parent must be a flex/grid container so `align-self: stretch` works.
|
|
2151
|
+
*/
|
|
2152
|
+
orientation?: SeparatorOrientation;
|
|
2153
|
+
/**
|
|
2154
|
+
* Theme color token for the separator line. @default 'borderMain'
|
|
2155
|
+
*/
|
|
2156
|
+
color?: keyof Theme['colors'];
|
|
2157
|
+
/**
|
|
2158
|
+
* Thickness of the separator line in pixels. @default '1'
|
|
2159
|
+
*/
|
|
2160
|
+
thickness?: SeparatorThickness;
|
|
2161
|
+
/**
|
|
2162
|
+
* Spacing token applied as margin around the separator.
|
|
2163
|
+
* Horizontal: `margin-block`; Vertical: `margin-inline`.
|
|
2164
|
+
*/
|
|
2165
|
+
spacing?: keyof Theme['spacing'];
|
|
2166
|
+
/**
|
|
2167
|
+
* Optional centered text label — only rendered on `orientation="horizontal"`.
|
|
2168
|
+
* When provided, the label is used as `aria-label` so screen readers announce
|
|
2169
|
+
* the section boundary with its name.
|
|
2170
|
+
*/
|
|
2171
|
+
label?: string;
|
|
2172
|
+
/**
|
|
2173
|
+
* Mark the separator as decorative (visual only). Sets `aria-hidden="true"`. @default false
|
|
2174
|
+
* @a11y Use when the separator is purely cosmetic and does not convey structural meaning.
|
|
2175
|
+
*/
|
|
2176
|
+
decorative?: boolean;
|
|
2177
|
+
};
|
|
2178
|
+
type SeparatorStyleParams = {
|
|
2179
|
+
orientation?: SeparatorOrientation;
|
|
2180
|
+
color?: keyof Theme['colors'];
|
|
2181
|
+
thickness?: SeparatorThickness;
|
|
2182
|
+
spacing?: keyof Theme['spacing'];
|
|
2183
|
+
hasLabel?: boolean;
|
|
2184
|
+
};
|
|
2185
|
+
|
|
2186
|
+
/**
|
|
2187
|
+
* A visual separator line (horizontal or vertical) with optional centered label.
|
|
2188
|
+
*
|
|
2189
|
+
* Uses `<hr>` for horizontal separators (implicit `role="separator"`) and a
|
|
2190
|
+
* `<div role="separator">` for vertical or labeled variants.
|
|
2191
|
+
*
|
|
2192
|
+
* @example <Separator />
|
|
2193
|
+
* @example <Separator orientation="vertical" />
|
|
2194
|
+
* @example <Separator label="Or" spacing="md" />
|
|
2195
|
+
* @example <Separator color="primaryMain" thickness="2" />
|
|
2196
|
+
* @example <Separator decorative />
|
|
2197
|
+
*/
|
|
2198
|
+
declare const Separator: FC<SeparatorProps>;
|
|
2199
|
+
|
|
1045
2200
|
/**
|
|
1046
2201
|
* A flex `Box` for laying out children along a single axis.
|
|
1047
2202
|
*
|
|
@@ -1291,6 +2446,83 @@ type DrawerContextValue = {
|
|
|
1291
2446
|
};
|
|
1292
2447
|
declare const useDrawerContext: () => DrawerContextValue;
|
|
1293
2448
|
|
|
2449
|
+
/** Size token controlling the dimensions and font scale of pagination items. */
|
|
2450
|
+
type PaginationSize = 'sm' | 'md' | 'lg';
|
|
2451
|
+
/** Visual shape of the pagination items. */
|
|
2452
|
+
type PaginationShape = 'rounded' | 'circular';
|
|
2453
|
+
|
|
2454
|
+
type PaginationProps = {
|
|
2455
|
+
/**
|
|
2456
|
+
* Currently active page (1-based). The component is controlled.
|
|
2457
|
+
* @a11y The matching page button exposes `aria-current="page"`.
|
|
2458
|
+
*/
|
|
2459
|
+
currentPage: number;
|
|
2460
|
+
/** Total number of pages available. */
|
|
2461
|
+
totalPages: number;
|
|
2462
|
+
/** Called with the requested page when the user navigates. */
|
|
2463
|
+
onPageChange: (page: number) => void;
|
|
2464
|
+
/**
|
|
2465
|
+
* Number of pages displayed on each side of the current page.
|
|
2466
|
+
* @default 1
|
|
2467
|
+
*/
|
|
2468
|
+
siblingCount?: number;
|
|
2469
|
+
/**
|
|
2470
|
+
* Number of pages always displayed at the very start and end.
|
|
2471
|
+
* @default 1
|
|
2472
|
+
*/
|
|
2473
|
+
boundaryCount?: number;
|
|
2474
|
+
/** Size token controlling item dimensions and font scale. @default 'md' */
|
|
2475
|
+
size?: PaginationSize;
|
|
2476
|
+
/** Visual shape of the items. @default 'rounded' */
|
|
2477
|
+
shape?: PaginationShape;
|
|
2478
|
+
/** Render the previous / next arrow controls. @default true */
|
|
2479
|
+
showPrevNext?: boolean;
|
|
2480
|
+
/** Render the jump-to-first / jump-to-last controls. @default false */
|
|
2481
|
+
showFirstLast?: boolean;
|
|
2482
|
+
/** Disable the whole pagination. */
|
|
2483
|
+
disabled?: boolean;
|
|
2484
|
+
/**
|
|
2485
|
+
* Accessible label for the `<nav>` landmark.
|
|
2486
|
+
* @default 'Pagination'
|
|
2487
|
+
* @a11y Recommended — describe the navigation to assistive technologies.
|
|
2488
|
+
*/
|
|
2489
|
+
ariaLabel?: string;
|
|
2490
|
+
/** Accessible label for the previous-page control. @default 'Go to previous page' */
|
|
2491
|
+
previousAriaLabel?: string;
|
|
2492
|
+
/** Accessible label for the next-page control. @default 'Go to next page' */
|
|
2493
|
+
nextAriaLabel?: string;
|
|
2494
|
+
/** Accessible label for the first-page control. @default 'Go to first page' */
|
|
2495
|
+
firstAriaLabel?: string;
|
|
2496
|
+
/** Accessible label for the last-page control. @default 'Go to last page' */
|
|
2497
|
+
lastAriaLabel?: string;
|
|
2498
|
+
/**
|
|
2499
|
+
* Builds the accessible label of a page button.
|
|
2500
|
+
* @default (page, selected) => selected ? `page ${page}` : `Go to page ${page}`
|
|
2501
|
+
*/
|
|
2502
|
+
getPageAriaLabel?: (page: number, selected: boolean) => string;
|
|
2503
|
+
};
|
|
2504
|
+
|
|
2505
|
+
/**
|
|
2506
|
+
* Accessible, controlled pagination control.
|
|
2507
|
+
*
|
|
2508
|
+
* Renders a `<nav>` landmark wrapping a list of page buttons, with optional
|
|
2509
|
+
* previous/next and first/last controls. Collapses long ranges using ellipses
|
|
2510
|
+
* (configurable via `siblingCount` and `boundaryCount`). The active page exposes
|
|
2511
|
+
* `aria-current="page"`.
|
|
2512
|
+
*
|
|
2513
|
+
* ```tsx
|
|
2514
|
+
* const [page, setPage] = useState(1)
|
|
2515
|
+
*
|
|
2516
|
+
* <Pagination
|
|
2517
|
+
* currentPage={page}
|
|
2518
|
+
* totalPages={10}
|
|
2519
|
+
* onPageChange={setPage}
|
|
2520
|
+
* showFirstLast
|
|
2521
|
+
* />
|
|
2522
|
+
* ```
|
|
2523
|
+
*/
|
|
2524
|
+
declare const Pagination: FC<PaginationProps>;
|
|
2525
|
+
|
|
1294
2526
|
type TabsProps = {
|
|
1295
2527
|
/** Children — typically a `Tabs.List` with `Tabs.Tab`s and one or more `Tabs.Panel`s. */
|
|
1296
2528
|
children: ReactNode;
|
|
@@ -1347,6 +2579,48 @@ type TabsComponent = FC<TabsProps> & {
|
|
|
1347
2579
|
|
|
1348
2580
|
declare const Tabs: TabsComponent;
|
|
1349
2581
|
|
|
2582
|
+
type AccordionProps = {
|
|
2583
|
+
/** Whether the accordion panel is expanded. Used for controlled mode. */
|
|
2584
|
+
open?: boolean;
|
|
2585
|
+
/** Initial open state in uncontrolled mode. @default false */
|
|
2586
|
+
defaultOpen?: boolean;
|
|
2587
|
+
/** Called when the open state changes. */
|
|
2588
|
+
onOpenChange?: (open: boolean) => void;
|
|
2589
|
+
/** `Accordion.Title` and `Accordion.Body` sub-components. */
|
|
2590
|
+
children: ReactNode;
|
|
2591
|
+
/**
|
|
2592
|
+
* Visual style variant. @default 'ghost'
|
|
2593
|
+
* - `ghost` — no border, minimal decoration.
|
|
2594
|
+
* - `outlined` — bordered card-like appearance.
|
|
2595
|
+
*/
|
|
2596
|
+
variant?: 'outlined' | 'ghost';
|
|
2597
|
+
/** Whether the accordion is disabled. @default false */
|
|
2598
|
+
disabled?: boolean;
|
|
2599
|
+
};
|
|
2600
|
+
|
|
2601
|
+
type AccordionTitleProps = {
|
|
2602
|
+
/** Trigger label — accepts any ReactNode (string, Text, Stack with icon, etc.). */
|
|
2603
|
+
children: ReactNode;
|
|
2604
|
+
/**
|
|
2605
|
+
* Heading level wrapping the trigger button, as recommended by the WAI-ARIA Accordion pattern.
|
|
2606
|
+
* The heading allows screen-reader users to navigate accordion items via the heading outline.
|
|
2607
|
+
* Match the level to the surrounding document hierarchy. @default 3
|
|
2608
|
+
*/
|
|
2609
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
2610
|
+
};
|
|
2611
|
+
|
|
2612
|
+
type AccordionBodyProps = {
|
|
2613
|
+
/** Content to reveal when the accordion is open. */
|
|
2614
|
+
children: ReactNode;
|
|
2615
|
+
};
|
|
2616
|
+
|
|
2617
|
+
type AccordionComponent = FC<AccordionProps> & {
|
|
2618
|
+
Title: FC<AccordionTitleProps>;
|
|
2619
|
+
Body: FC<AccordionBodyProps>;
|
|
2620
|
+
};
|
|
2621
|
+
|
|
2622
|
+
declare const Accordion: AccordionComponent;
|
|
2623
|
+
|
|
1350
2624
|
type AlertProps = {
|
|
1351
2625
|
/**
|
|
1352
2626
|
* Visual style of the alert. @default 'default'
|
|
@@ -1463,10 +2737,13 @@ type DialogComponent = FC<DialogProps> & {
|
|
|
1463
2737
|
|
|
1464
2738
|
declare const Dialog: DialogComponent;
|
|
1465
2739
|
|
|
2740
|
+
/** Where the menu opens relative to its anchor. */
|
|
2741
|
+
type MenuPlacement = 'bottom' | 'right';
|
|
2742
|
+
|
|
1466
2743
|
type MenuProps = {
|
|
1467
2744
|
/** Whether the menu is visible. */
|
|
1468
2745
|
open: boolean;
|
|
1469
|
-
/** Called when the menu should close (click outside or Escape key). */
|
|
2746
|
+
/** Called when the menu should close (click outside, outside scroll or Escape key). */
|
|
1470
2747
|
onClose: () => void;
|
|
1471
2748
|
/** Reference element used to position the menu. */
|
|
1472
2749
|
anchorEl?: HTMLElement | null;
|
|
@@ -1474,16 +2751,25 @@ type MenuProps = {
|
|
|
1474
2751
|
minWidth?: number | string;
|
|
1475
2752
|
/** Maximum height before scrolling. @default '20rem' */
|
|
1476
2753
|
maxHeight?: string;
|
|
1477
|
-
/**
|
|
2754
|
+
/** Where the menu opens relative to the anchor. @default 'bottom' */
|
|
2755
|
+
placement?: MenuPlacement;
|
|
2756
|
+
/** ARIA id for the menu panel. */
|
|
1478
2757
|
id?: string;
|
|
1479
2758
|
/**
|
|
1480
|
-
*
|
|
1481
|
-
*
|
|
2759
|
+
* ARIA role of the panel surface.
|
|
2760
|
+
* - `'menu'` (default) — action menu; children use `menuitem`.
|
|
2761
|
+
* - `'listbox'` — single/multi-select popup; children use `option`.
|
|
2762
|
+
* @default 'menu'
|
|
2763
|
+
*/
|
|
2764
|
+
role?: 'menu' | 'listbox';
|
|
2765
|
+
/**
|
|
2766
|
+
* Accessible name for the menu (use when there is no visible label).
|
|
2767
|
+
* @a11y Recommended — names the menu when no labelling element is referenced via `aria-labelledby`.
|
|
1482
2768
|
*/
|
|
1483
2769
|
'aria-label'?: string;
|
|
1484
2770
|
/**
|
|
1485
|
-
* Id of an element that labels the
|
|
1486
|
-
* @a11y Recommended — references the trigger's visible label to name the
|
|
2771
|
+
* Id of an element that labels the menu (e.g. the trigger's label).
|
|
2772
|
+
* @a11y Recommended — references the trigger's visible label to name the menu.
|
|
1487
2773
|
*/
|
|
1488
2774
|
'aria-labelledby'?: string;
|
|
1489
2775
|
/** Menu content — MenuGroup and/or MenuItem. */
|
|
@@ -1499,24 +2785,58 @@ type MenuGroupProps = {
|
|
|
1499
2785
|
children: ReactNode;
|
|
1500
2786
|
};
|
|
1501
2787
|
|
|
2788
|
+
/** ARIA role of a menu item. */
|
|
2789
|
+
type MenuItemRole = 'menuitem' | 'menuitemcheckbox' | 'menuitemradio' | 'option';
|
|
1502
2790
|
type MenuItemProps = HTMLAttributes<HTMLLIElement> & {
|
|
1503
2791
|
ref?: Ref<HTMLLIElement>;
|
|
1504
2792
|
/**
|
|
1505
2793
|
* Display text of the item.
|
|
1506
|
-
* @a11y Recommended — provides the
|
|
2794
|
+
* @a11y Recommended — provides the item's accessible name.
|
|
1507
2795
|
*/
|
|
1508
2796
|
label: string;
|
|
1509
2797
|
/** Optional SVG icon rendered before the label. */
|
|
1510
2798
|
icon?: ComponentType<SVGProps<SVGSVGElement>>;
|
|
1511
2799
|
/**
|
|
1512
|
-
*
|
|
1513
|
-
*
|
|
2800
|
+
* Color applied to the icon's stroke. Uses theme color tokens.
|
|
2801
|
+
* When omitted, the icon inherits the default behaviour (primaryMain when selected, textSecondary otherwise).
|
|
2802
|
+
*/
|
|
2803
|
+
iconColor?: keyof Theme['colors'];
|
|
2804
|
+
/**
|
|
2805
|
+
* ARIA role of the item.
|
|
2806
|
+
* - `'menuitem'` (default) — a regular action item.
|
|
2807
|
+
* - `'menuitemcheckbox'` — a toggleable item; pair with `checked`.
|
|
2808
|
+
* - `'menuitemradio'` — a single-choice item within a group; pair with `checked`.
|
|
2809
|
+
* @default 'menuitem'
|
|
2810
|
+
*/
|
|
2811
|
+
role?: MenuItemRole;
|
|
2812
|
+
/**
|
|
2813
|
+
* Checked state for `menuitemcheckbox` / `menuitemradio` items.
|
|
2814
|
+
* @a11y Recommended — exposes the state via `aria-checked` and shows the indicator.
|
|
2815
|
+
*/
|
|
2816
|
+
checked?: boolean;
|
|
2817
|
+
/**
|
|
2818
|
+
* Whether this item is visually highlighted as selected (e.g. the current value).
|
|
2819
|
+
* For checkbox/radio items prefer `checked`.
|
|
1514
2820
|
*/
|
|
1515
2821
|
selected?: boolean;
|
|
1516
2822
|
/** Whether this item has keyboard focus (highlighted via arrow navigation). */
|
|
1517
2823
|
focused?: boolean;
|
|
1518
2824
|
/** Whether the item is non-interactive. */
|
|
1519
2825
|
disabled?: boolean;
|
|
2826
|
+
/**
|
|
2827
|
+
* Whether clicking the item closes the whole menu (in addition to running
|
|
2828
|
+
* `onClick`).
|
|
2829
|
+
* @default true for `menuitem`, false for `menuitemcheckbox` / `menuitemradio`
|
|
2830
|
+
*/
|
|
2831
|
+
closeOnClick?: boolean;
|
|
2832
|
+
/**
|
|
2833
|
+
* Submenu content (MenuItem / MenuGroup). When provided, the item becomes a
|
|
2834
|
+
* submenu trigger that opens on hover, click, or ArrowRight.
|
|
2835
|
+
* @a11y Recommended — exposes `aria-haspopup="menu"` and `aria-expanded`.
|
|
2836
|
+
*/
|
|
2837
|
+
submenu?: ReactNode;
|
|
2838
|
+
/** Where the submenu opens relative to the item. @default 'right' */
|
|
2839
|
+
submenuPlacement?: MenuPlacement;
|
|
1520
2840
|
};
|
|
1521
2841
|
|
|
1522
2842
|
type MenuComponent = FC<MenuProps> & {
|
|
@@ -1551,5 +2871,5 @@ declare const lightTheme: Theme;
|
|
|
1551
2871
|
|
|
1552
2872
|
declare const darkTheme: Theme;
|
|
1553
2873
|
|
|
1554
|
-
export { Alert, Backdrop, Badge, Box, Breadcrumb, Button, Card, Checkbox, Dialog, Drawer, Form, Grid, Icon, IconButton, InfoBubble, Link, Menu, Select, Skeleton, Stack, Switch, Tabs, Text, TextField, Tooltip, darkTheme, lightTheme, useDrawerContext };
|
|
1555
|
-
export type { AlertBodyProps, AlertProps, AlertTitleProps, AlertVariant, BackdropProps, BadgeColor, BadgeIcon, BadgeProps, BadgeSize, BadgeVariant, BoxProps, BreadcrumbItemProps, BreadcrumbProps, BreadcrumbSeparator, ButtonColor, ButtonIcon, ButtonProps, ButtonSize, ButtonVariant, CardBodyProps, CardHeaderProps, CardProps, CardVariant, CheckboxProps, DialogBodyProps, DialogHeaderProps, DialogProps, DrawerBodyProps, DrawerFooterProps, DrawerHeaderProps, DrawerItemIcon, DrawerItemProps, DrawerProps, DrawerVariant, FormProps, GridProps, GridStyleProps, IconButtonProps, IconProps, IconStyleParams, InfoBubbleProps, LinkColor, LinkIcon, LinkProps, LinkUnderline, MenuGroupProps, MenuItemProps, MenuProps, Palette, SelectOption, SelectProps, SkeletonAnimation, SkeletonProps, SkeletonVariant, StackProps, SwitchColor, SwitchProps, SwitchSize, TabItemProps, TabsListProps, TabsPanelProps, TabsProps, TextFieldProps, TextFieldSize, TextFieldStatus, TextProps, TextStyleParams, TextVariantStyle, TextVariants, Theme, TooltipPlacement, TooltipProps };
|
|
2874
|
+
export { Accordion, Alert, Article, Aside, Avatar, AvatarGroup, Backdrop, Badge, Box, Breadcrumb, Button, Card, Checkbox, DatePicker, DefaultErrorFallback, Dialog, Drawer, ErrorBoundary, Fab, Footer, Form, Grid, Header, Icon, IconButton, Image, InfoBubble, Link, LoaderScreen, Main, Menu, Nav, Pagination, RadioButton, RadioGroup, Section, Select, Separator, Skeleton, Stack, SvgImage, Switch, Table, Tabs, Text, TextField, ToggleButton, ToggleGroup, ToggleIconButton, Tooltip, darkTheme, lightTheme, useDrawerContext };
|
|
2875
|
+
export type { AccordionBodyProps, AccordionProps, AccordionTitleProps, AlertBodyProps, AlertProps, AlertTitleProps, AlertVariant, ArticleProps, AsideProps, AvatarColor, AvatarGroupOverlap, AvatarGroupProps, AvatarProps, AvatarShape, AvatarSize, BackdropProps, BadgeColor, BadgeIcon, BadgeProps, BadgeSize, BadgeVariant, BoxProps, BreadcrumbItemProps, BreadcrumbProps, BreadcrumbSeparator, ButtonColor, ButtonIcon, ButtonProps, ButtonSize, ButtonVariant, CardBodyProps, CardHeaderProps, CardProps, CardVariant, CheckboxProps, DatePickerProps, DatePickerSize, DatePickerStatus, DefaultErrorFallbackProps, DialogBodyProps, DialogHeaderProps, DialogProps, DrawerBodyProps, DrawerFooterProps, DrawerHeaderProps, DrawerItemIcon, DrawerItemProps, DrawerProps, DrawerVariant, ErrorBoundaryFallbackRenderProps, ErrorBoundaryProps, FabColor, FabIcon, FabPlacement, FabProps, FabSize, FooterProps, FormProps, GridProps, GridStyleProps, HeaderProps, IconButtonProps, IconProps, IconStyleParams, ImageProps, InfoBubbleProps, LinkColor, LinkIcon, LinkProps, LinkUnderline, LoaderScreenProps, MainProps, MenuGroupProps, MenuItemProps, MenuItemRole, MenuPlacement, MenuProps, NavProps, PaginationProps, PaginationShape, PaginationSize, Palette, RadioButtonProps, RadioGroupProps, SectionProps, SelectOption, SelectProps, SeparatorOrientation, SeparatorProps, SeparatorStyleParams, SeparatorThickness, SkeletonAnimation, SkeletonProps, SkeletonVariant, StackProps, SvgImageProps, SwitchColor, SwitchProps, SwitchSize, TabItemProps, TableAlign, TableBodyProps, TableCellProps, TableColumn, TableFootProps, TableHeadProps, TableHeaderCellProps, TableLayout, TableProps, TableRowProps, TabsListProps, TabsPanelProps, TabsProps, TextFieldProps, TextFieldSize, TextFieldStatus, TextProps, TextStyleParams, TextVariantStyle, TextVariants, Theme, ToggleButtonProps, ToggleButtonVariant, ToggleGroupProps, ToggleIconButtonProps, TooltipPlacement, TooltipProps, WeekStart };
|