@aurora-ds/components 1.1.6 → 1.2.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/cjs/index.js +710 -224
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +708 -226
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +386 -34
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentType, SVGProps, ButtonHTMLAttributes, Ref, FC, AnchorHTMLAttributes, HTMLAttributes, ReactNode, CSSProperties, FormEvent, InputHTMLAttributes } from 'react';
|
|
1
|
+
import { ComponentType, SVGProps, ButtonHTMLAttributes, Ref, FC, AnchorHTMLAttributes, HTMLAttributes, ReactNode, CSSProperties, FormEvent, InputHTMLAttributes, AriaRole, AriaAttributes } from 'react';
|
|
2
2
|
|
|
3
3
|
declare const lightPalette: {
|
|
4
4
|
surfaceBackground: string;
|
|
@@ -188,13 +188,19 @@ declare const themeShadows: {
|
|
|
188
188
|
|
|
189
189
|
/**
|
|
190
190
|
* Default spacing tokens
|
|
191
|
+
*
|
|
192
|
+
* ⚠️ Token keys MUST stay CSS-custom-property safe (letters, digits, hyphens only).
|
|
193
|
+
* They are turned into CSS variables (e.g. `smPlus` → `--theme-spacing-sm-plus`) by
|
|
194
|
+
* the theme proxy, so characters like `+` would produce invalid variable names and
|
|
195
|
+
* silently break any style that uses them.
|
|
191
196
|
*/
|
|
192
197
|
declare const themeSpacing: {
|
|
193
198
|
none: string;
|
|
194
199
|
'2xs': string;
|
|
195
200
|
xs: string;
|
|
196
|
-
|
|
201
|
+
xsPlus: string;
|
|
197
202
|
sm: string;
|
|
203
|
+
smPlus: string;
|
|
198
204
|
md: string;
|
|
199
205
|
lg: string;
|
|
200
206
|
xl: string;
|
|
@@ -276,8 +282,11 @@ type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
|
276
282
|
isLoading?: boolean;
|
|
277
283
|
/** Native button type. @default 'button' */
|
|
278
284
|
type?: 'button' | 'submit' | 'reset';
|
|
279
|
-
/**
|
|
280
|
-
|
|
285
|
+
/**
|
|
286
|
+
* Text label displayed inside the button. Can also pass children directly.
|
|
287
|
+
* @a11y Recommended — provides the button's accessible name. With no visible text, prefer `IconButton` with `ariaLabel`.
|
|
288
|
+
*/
|
|
289
|
+
label?: string;
|
|
281
290
|
/** SVG icon component rendered before the label (inherits the button color). */
|
|
282
291
|
startIcon?: ButtonIcon;
|
|
283
292
|
/** SVG icon component rendered after the label (inherits the button color). */
|
|
@@ -298,7 +307,10 @@ type IconButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'
|
|
|
298
307
|
ref?: Ref<HTMLButtonElement>;
|
|
299
308
|
/** SVG icon component to render inside the button. */
|
|
300
309
|
icon: ButtonIcon;
|
|
301
|
-
/**
|
|
310
|
+
/**
|
|
311
|
+
* Accessible label — required since there is no visible text.
|
|
312
|
+
* @a11y Required — the button's only accessible name (no visible text). Describe the action, not the icon (e.g. "Close" rather than "Cross").
|
|
313
|
+
*/
|
|
302
314
|
ariaLabel: string;
|
|
303
315
|
/** Visual style. @default 'contained' */
|
|
304
316
|
variant?: ButtonVariant;
|
|
@@ -331,10 +343,29 @@ type LinkProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
|
331
343
|
ref?: Ref<HTMLAnchorElement>;
|
|
332
344
|
/** Controls when the underline is visible. @default 'hover' */
|
|
333
345
|
underline?: LinkUnderline;
|
|
334
|
-
/**
|
|
346
|
+
/**
|
|
347
|
+
* Open in a new tab with `rel="noopener noreferrer"`.
|
|
348
|
+
* @a11y Recommended — warn users that a new tab will open (via visible text or `aria-label`).
|
|
349
|
+
*/
|
|
335
350
|
external?: boolean;
|
|
336
|
-
/**
|
|
351
|
+
/**
|
|
352
|
+
* Prevent navigation and style as inactive.
|
|
353
|
+
* @a11y Sets `aria-disabled`, removes the element from the tab order.
|
|
354
|
+
*/
|
|
337
355
|
disabled?: boolean;
|
|
356
|
+
/**
|
|
357
|
+
* The URL to navigate to. When omitted (SPA navigation via `onClick`),
|
|
358
|
+
* the component automatically adds `role="link"`, `tabIndex={0}` and
|
|
359
|
+
* handles Enter-key activation so that accessibility is preserved.
|
|
360
|
+
*
|
|
361
|
+
* @example
|
|
362
|
+
* // Standard href
|
|
363
|
+
* <Link href="/about">About</Link>
|
|
364
|
+
*
|
|
365
|
+
* // React Router (no href)
|
|
366
|
+
* <Link onClick={() => navigate('/about')}>About</Link>
|
|
367
|
+
*/
|
|
368
|
+
href?: string;
|
|
338
369
|
/** SVG icon rendered before the text. */
|
|
339
370
|
startIcon?: LinkIcon;
|
|
340
371
|
/** SVG icon rendered after the text. */
|
|
@@ -344,10 +375,15 @@ type LinkProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
|
344
375
|
/**
|
|
345
376
|
* Theme-aware anchor element with optional icons and underline control.
|
|
346
377
|
*
|
|
378
|
+
* Supports SPA navigation (e.g. React Router) via `onClick` without `href`.
|
|
379
|
+
* In that case the component stays accessible: it gets `role="link"`,
|
|
380
|
+
* `tabIndex={0}` and keyboard Enter support automatically.
|
|
381
|
+
*
|
|
347
382
|
* @example <Link href='/about'>About</Link>
|
|
348
383
|
* @example <Link href='https://example.com' external>External site</Link>
|
|
349
384
|
* @example <Link href='/profile' underline='always' startIcon={UserIcon}>Profile</Link>
|
|
350
385
|
* @example <Link href='/terms' underline='none'>Terms</Link>
|
|
386
|
+
* @example <Link onClick={() => navigate('/about')}>About (SPA)</Link>
|
|
351
387
|
*/
|
|
352
388
|
declare const Link: FC<LinkProps>;
|
|
353
389
|
|
|
@@ -376,7 +412,10 @@ type BadgeProps = HTMLAttributes<HTMLSpanElement> & {
|
|
|
376
412
|
endIcon?: BadgeIcon;
|
|
377
413
|
/** @deprecated Use `startIcon` instead. */
|
|
378
414
|
icon?: BadgeIcon;
|
|
379
|
-
/**
|
|
415
|
+
/**
|
|
416
|
+
* Render as a small colored dot indicator — children and icons are ignored. @default false
|
|
417
|
+
* @a11y Recommended — a dot conveys meaning visually only; add `role="img"` + `aria-label` (via the spread props) to describe it.
|
|
418
|
+
*/
|
|
380
419
|
dot?: boolean;
|
|
381
420
|
};
|
|
382
421
|
|
|
@@ -394,7 +433,10 @@ type TooltipPlacement = 'top' | 'bottom' | 'left' | 'right';
|
|
|
394
433
|
interface TooltipProps {
|
|
395
434
|
/** Content that triggers the tooltip on hover/focus. */
|
|
396
435
|
children: ReactNode;
|
|
397
|
-
/**
|
|
436
|
+
/**
|
|
437
|
+
* Text displayed inside the tooltip bubble.
|
|
438
|
+
* @a11y Recommended — exposed to assistive tech; keep it concise as it describes the trigger.
|
|
439
|
+
*/
|
|
398
440
|
label: string;
|
|
399
441
|
/** Placement of the tooltip relative to the trigger element. @default 'right' */
|
|
400
442
|
placement?: TooltipPlacement;
|
|
@@ -433,7 +475,10 @@ interface TooltipProps {
|
|
|
433
475
|
}
|
|
434
476
|
|
|
435
477
|
interface InfoBubbleProps {
|
|
436
|
-
/**
|
|
478
|
+
/**
|
|
479
|
+
* Text displayed inside the tooltip bubble.
|
|
480
|
+
* @a11y Recommended — provides the accessible name/description of the info trigger.
|
|
481
|
+
*/
|
|
437
482
|
label: string;
|
|
438
483
|
/** Placement of the tooltip relative to the info icon. @default 'top' */
|
|
439
484
|
placement?: TooltipPlacement;
|
|
@@ -470,7 +515,10 @@ declare const InfoBubble: FC<InfoBubbleProps>;
|
|
|
470
515
|
|
|
471
516
|
type IconProps = HTMLAttributes<HTMLDivElement> & {
|
|
472
517
|
ref?: Ref<HTMLDivElement>;
|
|
473
|
-
/**
|
|
518
|
+
/**
|
|
519
|
+
* SVG component to render — import with `?react` (e.g. `import MyIcon from './my-icon.svg?react'`).
|
|
520
|
+
* @a11y Recommended — decorative by default (`aria-hidden`). When meaningful, pass `role="img"` + `aria-label` through the spread props.
|
|
521
|
+
*/
|
|
474
522
|
icon: ComponentType<SVGProps<SVGSVGElement>>;
|
|
475
523
|
/** Size token mapped to `theme.fontSize`. Controls both width and height. @default 'md' */
|
|
476
524
|
size?: keyof Theme['fontSize'];
|
|
@@ -513,7 +561,10 @@ type SkeletonAnimation = 'shimmer' | false;
|
|
|
513
561
|
|
|
514
562
|
type SkeletonProps = HTMLAttributes<HTMLSpanElement> & {
|
|
515
563
|
ref?: Ref<HTMLSpanElement>;
|
|
516
|
-
/**
|
|
564
|
+
/**
|
|
565
|
+
* Shape of the placeholder: `'text'` | `'circular'` | `'rectangular'` | `'rounded'`. @default 'rounded'
|
|
566
|
+
* @a11y Recommended — convey loading state to assistive tech by wrapping the region with `aria-busy="true"` (or `role="status"`).
|
|
567
|
+
*/
|
|
517
568
|
variant?: SkeletonVariant;
|
|
518
569
|
/** Loading animation: `'shimmer'` (default) or `false` to disable. */
|
|
519
570
|
animation?: SkeletonAnimation;
|
|
@@ -554,9 +605,15 @@ type TextVariantStyle = {
|
|
|
554
605
|
|
|
555
606
|
type TextProps = HTMLAttributes<HTMLElement> & {
|
|
556
607
|
ref?: Ref<HTMLElement>;
|
|
557
|
-
/**
|
|
608
|
+
/**
|
|
609
|
+
* Semantic variant — determines the rendered HTML tag and baseline styles. @default 'span'
|
|
610
|
+
* @a11y Recommended — pick the variant matching the document outline (e.g. `h1`–`h6`, `p`) so semantics are conveyed to assistive tech.
|
|
611
|
+
*/
|
|
558
612
|
variant?: TextVariants;
|
|
559
|
-
/**
|
|
613
|
+
/**
|
|
614
|
+
* Override the rendered HTML tag while keeping variant styles (e.g. `variant="h1" as="h2"`).
|
|
615
|
+
* @a11y Recommended — keep the rendered tag consistent with the heading level expected by the page outline.
|
|
616
|
+
*/
|
|
560
617
|
as?: string;
|
|
561
618
|
/** Theme color token — e.g. `'textPrimary'`, `'errorMain'`, `'linkHover'`. @default 'inherit' */
|
|
562
619
|
color?: keyof Theme['colors'];
|
|
@@ -582,7 +639,10 @@ type TextProps = HTMLAttributes<HTMLElement> & {
|
|
|
582
639
|
noWrap?: boolean;
|
|
583
640
|
/** Preserve whitespace and line breaks (`white-space: pre-wrap`). */
|
|
584
641
|
preserveWhitespace?: boolean;
|
|
585
|
-
/**
|
|
642
|
+
/**
|
|
643
|
+
* Associates a `<label>` with an input — only meaningful when `variant` or `as` is `"label"`.
|
|
644
|
+
* @a11y Recommended — link the label to its control's `id` so clicking the label focuses the input.
|
|
645
|
+
*/
|
|
586
646
|
htmlFor?: string;
|
|
587
647
|
/** Explicit CSS width applied as a style property (not an HTML attribute). */
|
|
588
648
|
width?: CSSProperties['width'];
|
|
@@ -627,9 +687,15 @@ type FormProps = {
|
|
|
627
687
|
children: ReactNode;
|
|
628
688
|
/** Called when the form is submitted. Receives the native submit event. */
|
|
629
689
|
onSubmit: (event: FormEvent<HTMLFormElement>) => void;
|
|
630
|
-
/**
|
|
690
|
+
/**
|
|
691
|
+
* Accessible name for the form.
|
|
692
|
+
* @a11y Recommended — names the form landmark; use `aria-labelledby` instead when a visible heading exists.
|
|
693
|
+
*/
|
|
631
694
|
'aria-label'?: string;
|
|
632
|
-
/**
|
|
695
|
+
/**
|
|
696
|
+
* Id of an element that labels the form.
|
|
697
|
+
* @a11y Recommended — references a visible heading to name the form landmark.
|
|
698
|
+
*/
|
|
633
699
|
'aria-labelledby'?: string;
|
|
634
700
|
};
|
|
635
701
|
|
|
@@ -650,7 +716,10 @@ type SwitchColor = 'primary' | 'success' | 'error' | 'warning' | 'info' | 'neutr
|
|
|
650
716
|
|
|
651
717
|
type SwitchProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'> & {
|
|
652
718
|
ref?: Ref<HTMLInputElement>;
|
|
653
|
-
/**
|
|
719
|
+
/**
|
|
720
|
+
* Visible label rendered next to the switch.
|
|
721
|
+
* @a11y Recommended — provides the switch's accessible name. Without it, set `aria-label` instead.
|
|
722
|
+
*/
|
|
654
723
|
label?: string;
|
|
655
724
|
/** Size variant. @default 'md' */
|
|
656
725
|
size?: SwitchSize;
|
|
@@ -675,13 +744,22 @@ type TextFieldStatus = 'default' | 'error' | 'success' | 'warning';
|
|
|
675
744
|
|
|
676
745
|
type TextFieldProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> & {
|
|
677
746
|
ref?: Ref<HTMLInputElement>;
|
|
678
|
-
/**
|
|
747
|
+
/**
|
|
748
|
+
* Visible label rendered above the field.
|
|
749
|
+
* @a11y Recommended — provides the input's accessible name (linked via `htmlFor`/`id`).
|
|
750
|
+
*/
|
|
679
751
|
label?: string;
|
|
680
|
-
/**
|
|
752
|
+
/**
|
|
753
|
+
* Helper text or validation message rendered below the field.
|
|
754
|
+
* @a11y Recommended — linked to the input via `aria-describedby` (and `aria-errormessage` when `status='error'`).
|
|
755
|
+
*/
|
|
681
756
|
helperText?: string;
|
|
682
757
|
/** Size variant controlling height, padding and font size. @default 'md' */
|
|
683
758
|
size?: TextFieldSize;
|
|
684
|
-
/**
|
|
759
|
+
/**
|
|
760
|
+
* Semantic status affecting border and helper text color. @default 'default'
|
|
761
|
+
* @a11y Recommended — `status='error'` sets `aria-invalid` on the input.
|
|
762
|
+
*/
|
|
685
763
|
status?: TextFieldStatus;
|
|
686
764
|
/** SVG icon component rendered on the left inside the field. */
|
|
687
765
|
startIcon?: ComponentType<SVGProps<SVGSVGElement>>;
|
|
@@ -732,19 +810,31 @@ type SelectProps = {
|
|
|
732
810
|
onChange?: (value: string) => void;
|
|
733
811
|
/** List of options. */
|
|
734
812
|
options?: SelectOption[];
|
|
735
|
-
/**
|
|
813
|
+
/**
|
|
814
|
+
* Label rendered above the trigger.
|
|
815
|
+
* @a11y Recommended — associates an accessible name with the combobox via `aria-labelledby`.
|
|
816
|
+
*/
|
|
736
817
|
label?: string;
|
|
737
|
-
/**
|
|
818
|
+
/**
|
|
819
|
+
* Helper text or validation message rendered below the trigger.
|
|
820
|
+
* @a11y Recommended — linked to the trigger via `aria-describedby` (and `aria-errormessage` when `status='error'`).
|
|
821
|
+
*/
|
|
738
822
|
helperText?: string;
|
|
739
823
|
/** Placeholder shown when no option is selected. */
|
|
740
824
|
placeholder?: string;
|
|
741
825
|
/** Size variant. @default 'md' */
|
|
742
826
|
size?: TextFieldSize;
|
|
743
|
-
/**
|
|
827
|
+
/**
|
|
828
|
+
* Semantic status affecting border and helper text color. @default 'default'
|
|
829
|
+
* @a11y Recommended — `status='error'` sets `aria-invalid` and links the error message.
|
|
830
|
+
*/
|
|
744
831
|
status?: TextFieldStatus;
|
|
745
832
|
/** Whether the select is disabled. */
|
|
746
833
|
disabled?: boolean;
|
|
747
|
-
/**
|
|
834
|
+
/**
|
|
835
|
+
* Whether the field is required.
|
|
836
|
+
* @a11y Recommended — sets `aria-required` on the combobox and shows the visual asterisk on the label.
|
|
837
|
+
*/
|
|
748
838
|
required?: boolean;
|
|
749
839
|
/** Fixed width for the select. Defaults to 100% of its container. */
|
|
750
840
|
width?: string | number;
|
|
@@ -754,6 +844,36 @@ type SelectProps = {
|
|
|
754
844
|
|
|
755
845
|
declare const Select: FC<SelectProps>;
|
|
756
846
|
|
|
847
|
+
type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'size'> & {
|
|
848
|
+
ref?: Ref<HTMLInputElement>;
|
|
849
|
+
/**
|
|
850
|
+
* Visible label rendered next to the checkbox.
|
|
851
|
+
* @a11y Recommended — provides the checkbox's accessible name (clickable to toggle it).
|
|
852
|
+
*/
|
|
853
|
+
label?: ReactNode;
|
|
854
|
+
/**
|
|
855
|
+
* Helper text or validation message rendered below the checkbox row.
|
|
856
|
+
* @a11y Recommended — linked to the input via `aria-describedby`.
|
|
857
|
+
*/
|
|
858
|
+
helperText?: string;
|
|
859
|
+
/** Size variant controlling checkbox box size and text scale. @default 'md' */
|
|
860
|
+
size?: TextFieldSize;
|
|
861
|
+
/**
|
|
862
|
+
* Semantic status affecting border and helper text color. @default 'default'
|
|
863
|
+
* @a11y Recommended — `status='error'` sets `aria-invalid` on the input.
|
|
864
|
+
*/
|
|
865
|
+
status?: TextFieldStatus;
|
|
866
|
+
/**
|
|
867
|
+
* Sets the native checkbox in indeterminate (mixed) state.
|
|
868
|
+
* @a11y Recommended — exposes the mixed state via `aria-checked="mixed"`.
|
|
869
|
+
*/
|
|
870
|
+
indeterminate?: boolean;
|
|
871
|
+
/** @deprecated Use `status='error'` instead. Kept for backward compatibility. */
|
|
872
|
+
error?: boolean;
|
|
873
|
+
};
|
|
874
|
+
|
|
875
|
+
declare const Checkbox: FC<CheckboxProps>;
|
|
876
|
+
|
|
757
877
|
type BoxProps = HTMLAttributes<HTMLDivElement> & BoxStyleProps & {
|
|
758
878
|
ref?: Ref<HTMLDivElement>;
|
|
759
879
|
};
|
|
@@ -926,8 +1046,193 @@ declare const Grid: FC<GridProps>;
|
|
|
926
1046
|
*/
|
|
927
1047
|
declare const Stack: FC<StackProps>;
|
|
928
1048
|
|
|
1049
|
+
/**
|
|
1050
|
+
* Layout variant for the Drawer.
|
|
1051
|
+
* - `'permanent'` — inline drawer that pushes page content (default on desktop).
|
|
1052
|
+
* - `'temporary'` — portal overlay with backdrop that slides in from the left (default on mobile).
|
|
1053
|
+
*
|
|
1054
|
+
* Omitting the prop enables auto-detection based on viewport width.
|
|
1055
|
+
*/
|
|
1056
|
+
type DrawerVariant = 'permanent' | 'temporary';
|
|
1057
|
+
type DrawerProps = {
|
|
1058
|
+
/** Height of the drawer container. @default '100dvh' */
|
|
1059
|
+
height?: CSSProperties['height'];
|
|
1060
|
+
/** Content of the drawer — use Drawer.Header, Drawer.Body, Drawer.Footer. */
|
|
1061
|
+
children: ReactNode;
|
|
1062
|
+
/** Controlled expanded/collapsed state. For `temporary` variant, controls open/closed. */
|
|
1063
|
+
isExpanded: boolean;
|
|
1064
|
+
/** Callback fired when the consumer should toggle the expanded state. */
|
|
1065
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
1066
|
+
/**
|
|
1067
|
+
* Layout variant.
|
|
1068
|
+
* - `'permanent'`: inline, pushes content (default on desktop).
|
|
1069
|
+
* - `'temporary'`: portal overlay with backdrop (default on mobile).
|
|
1070
|
+
*
|
|
1071
|
+
* If omitted, auto-detects based on viewport width.
|
|
1072
|
+
*/
|
|
1073
|
+
variant?: DrawerVariant;
|
|
1074
|
+
/**
|
|
1075
|
+
* Called when the temporary drawer overlay requests to be closed
|
|
1076
|
+
* (backdrop click or Escape key). Falls back to `onExpandedChange(false)`
|
|
1077
|
+
* if not provided.
|
|
1078
|
+
*/
|
|
1079
|
+
onClose?: () => void;
|
|
1080
|
+
/** ARIA role applied to the root navigation container. @default 'navigation' */
|
|
1081
|
+
role?: AriaRole;
|
|
1082
|
+
/**
|
|
1083
|
+
* Accessible name for the drawer landmark. @default 'Navigation'
|
|
1084
|
+
* @a11y Recommended — distinguishes this landmark when several navigation regions exist on the page.
|
|
1085
|
+
*/
|
|
1086
|
+
ariaLabel?: string;
|
|
1087
|
+
/**
|
|
1088
|
+
* Id of the element that labels the drawer landmark.
|
|
1089
|
+
* @a11y Recommended — references a visible heading to name the landmark (alternative to `ariaLabel`).
|
|
1090
|
+
*/
|
|
1091
|
+
ariaLabelledBy?: string;
|
|
1092
|
+
/**
|
|
1093
|
+
* Id of the element that describes the drawer landmark.
|
|
1094
|
+
* @a11y Recommended — references descriptive text via `aria-describedby`.
|
|
1095
|
+
*/
|
|
1096
|
+
ariaDescribedBy?: string;
|
|
1097
|
+
};
|
|
1098
|
+
|
|
1099
|
+
type DrawerHeaderProps = Omit<BoxProps, 'aria-label' | 'aria-labelledby' | 'aria-describedby'> & {
|
|
1100
|
+
/** ARIA role applied to the header container. */
|
|
1101
|
+
role?: AriaRole;
|
|
1102
|
+
/**
|
|
1103
|
+
* Accessible name for the header region.
|
|
1104
|
+
* @a11y Recommended — names the header region for assistive tech.
|
|
1105
|
+
*/
|
|
1106
|
+
ariaLabel?: string;
|
|
1107
|
+
/**
|
|
1108
|
+
* Id of the element that labels the header region.
|
|
1109
|
+
* @a11y Recommended — references a visible heading via `aria-labelledby`.
|
|
1110
|
+
*/
|
|
1111
|
+
ariaLabelledBy?: string;
|
|
1112
|
+
/**
|
|
1113
|
+
* Id of the element that describes the header region.
|
|
1114
|
+
* @a11y Recommended — references descriptive text via `aria-describedby`.
|
|
1115
|
+
*/
|
|
1116
|
+
ariaDescribedBy?: string;
|
|
1117
|
+
};
|
|
1118
|
+
|
|
1119
|
+
type DrawerBodyProps = Omit<BoxProps, 'aria-label' | 'aria-labelledby' | 'aria-describedby'> & {
|
|
1120
|
+
/** ARIA role applied to the body container. */
|
|
1121
|
+
role?: AriaRole;
|
|
1122
|
+
/**
|
|
1123
|
+
* Accessible name for the body region.
|
|
1124
|
+
* @a11y Recommended — names the body region for assistive tech.
|
|
1125
|
+
*/
|
|
1126
|
+
ariaLabel?: string;
|
|
1127
|
+
/**
|
|
1128
|
+
* Id of the element that labels the body region.
|
|
1129
|
+
* @a11y Recommended — references a visible heading via `aria-labelledby`.
|
|
1130
|
+
*/
|
|
1131
|
+
ariaLabelledBy?: string;
|
|
1132
|
+
/**
|
|
1133
|
+
* Id of the element that describes the body region.
|
|
1134
|
+
* @a11y Recommended — references descriptive text via `aria-describedby`.
|
|
1135
|
+
*/
|
|
1136
|
+
ariaDescribedBy?: string;
|
|
1137
|
+
};
|
|
1138
|
+
|
|
1139
|
+
type DrawerFooterProps = Omit<BoxProps, 'aria-label' | 'aria-labelledby' | 'aria-describedby'> & {
|
|
1140
|
+
/** ARIA role applied to the footer container. */
|
|
1141
|
+
role?: AriaRole;
|
|
1142
|
+
/**
|
|
1143
|
+
* Accessible name for the footer region.
|
|
1144
|
+
* @a11y Recommended — names the footer region for assistive tech.
|
|
1145
|
+
*/
|
|
1146
|
+
ariaLabel?: string;
|
|
1147
|
+
/**
|
|
1148
|
+
* Id of the element that labels the footer region.
|
|
1149
|
+
* @a11y Recommended — references a visible heading via `aria-labelledby`.
|
|
1150
|
+
*/
|
|
1151
|
+
ariaLabelledBy?: string;
|
|
1152
|
+
/**
|
|
1153
|
+
* Id of the element that describes the footer region.
|
|
1154
|
+
* @a11y Recommended — references descriptive text via `aria-describedby`.
|
|
1155
|
+
*/
|
|
1156
|
+
ariaDescribedBy?: string;
|
|
1157
|
+
};
|
|
1158
|
+
|
|
1159
|
+
/** SVG icon component for DrawerItem slots. */
|
|
1160
|
+
type DrawerItemIcon = ComponentType<SVGProps<SVGSVGElement>>;
|
|
1161
|
+
type DrawerItemProps = {
|
|
1162
|
+
/** SVG icon shown in both expanded and collapsed states. */
|
|
1163
|
+
startIcon: DrawerItemIcon;
|
|
1164
|
+
/**
|
|
1165
|
+
* Text label — visible when expanded, shown as tooltip when collapsed.
|
|
1166
|
+
* @a11y Recommended — provides the item's accessible name in both expanded and collapsed states.
|
|
1167
|
+
*/
|
|
1168
|
+
label: string;
|
|
1169
|
+
/** Marks the item as selected/active. @default false */
|
|
1170
|
+
selected?: boolean;
|
|
1171
|
+
/** Extra content rendered after the label in expanded mode only (e.g. a badge). */
|
|
1172
|
+
endContent?: ReactNode;
|
|
1173
|
+
/** When provided, renders the item as an anchor `<a>` for navigation. */
|
|
1174
|
+
href?: string;
|
|
1175
|
+
/** Click handler (used for simple actions when no `href` is set). */
|
|
1176
|
+
onClick?: () => void;
|
|
1177
|
+
/** Prevents interaction and dims the item. @default false */
|
|
1178
|
+
disabled?: boolean;
|
|
1179
|
+
/**
|
|
1180
|
+
* Accessible label override (by default uses `label` when collapsed).
|
|
1181
|
+
* @a11y Recommended — override the accessible name when `label` is not descriptive enough.
|
|
1182
|
+
*/
|
|
1183
|
+
ariaLabel?: string;
|
|
1184
|
+
/**
|
|
1185
|
+
* Id of the element that labels this item.
|
|
1186
|
+
* @a11y Recommended — references an external label via `aria-labelledby`.
|
|
1187
|
+
*/
|
|
1188
|
+
ariaLabelledBy?: string;
|
|
1189
|
+
/**
|
|
1190
|
+
* Id of the element that describes this item.
|
|
1191
|
+
* @a11y Recommended — references descriptive text via `aria-describedby`.
|
|
1192
|
+
*/
|
|
1193
|
+
ariaDescribedBy?: string;
|
|
1194
|
+
/**
|
|
1195
|
+
* Id of the element controlled by this item.
|
|
1196
|
+
* @a11y Recommended — set with `ariaExpanded` when the item toggles a submenu/panel.
|
|
1197
|
+
*/
|
|
1198
|
+
ariaControls?: string;
|
|
1199
|
+
/**
|
|
1200
|
+
* Whether the controlled element is expanded/collapsed.
|
|
1201
|
+
* @a11y Recommended — exposes the expanded state of the controlled element via `aria-expanded`.
|
|
1202
|
+
*/
|
|
1203
|
+
ariaExpanded?: boolean;
|
|
1204
|
+
/**
|
|
1205
|
+
* Indicates popup behavior when item triggers a menu/dialog/listbox/tree/grid.
|
|
1206
|
+
* @a11y Recommended — set `aria-haspopup` when the item opens an overlay.
|
|
1207
|
+
*/
|
|
1208
|
+
ariaHasPopup?: AriaAttributes['aria-haspopup'];
|
|
1209
|
+
/**
|
|
1210
|
+
* Explicit current state. Defaults to `page` when `selected` is true.
|
|
1211
|
+
* @a11y Recommended — exposes the active item to assistive tech via `aria-current`.
|
|
1212
|
+
*/
|
|
1213
|
+
ariaCurrent?: AriaAttributes['aria-current'];
|
|
1214
|
+
};
|
|
1215
|
+
|
|
1216
|
+
type DrawerComponent = FC<DrawerProps> & {
|
|
1217
|
+
Header: FC<DrawerHeaderProps>;
|
|
1218
|
+
Body: FC<DrawerBodyProps>;
|
|
1219
|
+
Footer: FC<DrawerFooterProps>;
|
|
1220
|
+
Item: FC<DrawerItemProps>;
|
|
1221
|
+
};
|
|
1222
|
+
|
|
1223
|
+
declare const Drawer: DrawerComponent;
|
|
1224
|
+
|
|
1225
|
+
type DrawerContextValue = {
|
|
1226
|
+
/** Whether the drawer is in expanded (true) or collapsed (false) state. */
|
|
1227
|
+
isExpanded: boolean;
|
|
1228
|
+
};
|
|
1229
|
+
declare const useDrawerContext: () => DrawerContextValue;
|
|
1230
|
+
|
|
929
1231
|
type AlertProps = {
|
|
930
|
-
/**
|
|
1232
|
+
/**
|
|
1233
|
+
* Visual style of the alert. @default 'default'
|
|
1234
|
+
* @a11y Recommended — `'error'` renders `role="alert"` + `aria-live="assertive"`; other variants use `role="status"` + `aria-live="polite"`.
|
|
1235
|
+
*/
|
|
931
1236
|
variant?: AlertVariant;
|
|
932
1237
|
/** Alert sub-components: Alert.Title and/or Alert.Body. */
|
|
933
1238
|
children?: ReactNode;
|
|
@@ -966,10 +1271,32 @@ type AlertComponent = FC<AlertProps> & {
|
|
|
966
1271
|
|
|
967
1272
|
declare const Alert: AlertComponent;
|
|
968
1273
|
|
|
1274
|
+
type BackdropProps = {
|
|
1275
|
+
/** Whether the backdrop is fully visible (opacity 1). Transition is handled internally. */
|
|
1276
|
+
visible: boolean;
|
|
1277
|
+
/** Click handler — typically used to close the overlay. */
|
|
1278
|
+
onClick?: () => void;
|
|
1279
|
+
};
|
|
1280
|
+
|
|
1281
|
+
/**
|
|
1282
|
+
* Semi-transparent full-screen overlay used to visually block page content
|
|
1283
|
+
* while a modal element (dialog, temporary drawer…) is open.
|
|
1284
|
+
*
|
|
1285
|
+
* The `visible` prop drives the opacity transition: `false` = transparent,
|
|
1286
|
+
* `true` = `rgba(0,0,0,0.5)`. Mount/unmount is managed by the parent.
|
|
1287
|
+
*
|
|
1288
|
+
* @example
|
|
1289
|
+
* <Backdrop visible={isFadingIn} onClick={onClose} />
|
|
1290
|
+
*/
|
|
1291
|
+
declare const Backdrop: FC<BackdropProps>;
|
|
1292
|
+
|
|
969
1293
|
type DialogProps = {
|
|
970
1294
|
/** Whether the dialog is visible. */
|
|
971
1295
|
open: boolean;
|
|
972
|
-
/**
|
|
1296
|
+
/**
|
|
1297
|
+
* Called when the dialog should close (Escape key or close button).
|
|
1298
|
+
* @a11y Recommended — enables closing via Escape, which assistive-tech users expect.
|
|
1299
|
+
*/
|
|
973
1300
|
onClose: () => void;
|
|
974
1301
|
/** Whether clicking the backdrop closes the dialog. @default false */
|
|
975
1302
|
closeOnBackdropClick?: boolean;
|
|
@@ -983,16 +1310,25 @@ type DialogProps = {
|
|
|
983
1310
|
minHeight?: number | string;
|
|
984
1311
|
/** Whether the dialog takes the full viewport height on mobile (bottom-sheet variant). @default false */
|
|
985
1312
|
fullscreen?: boolean;
|
|
986
|
-
/**
|
|
1313
|
+
/**
|
|
1314
|
+
* Accessible label — use when Dialog.Header is not present.
|
|
1315
|
+
* @a11y Recommended — provides the dialog's accessible name when there is no `Dialog.Header` title to reference.
|
|
1316
|
+
*/
|
|
987
1317
|
'aria-label'?: string;
|
|
988
1318
|
/** Dialog content. Typically Dialog.Header + Dialog.Body. */
|
|
989
1319
|
children: ReactNode;
|
|
990
1320
|
};
|
|
991
1321
|
|
|
992
1322
|
type DialogHeaderProps = {
|
|
993
|
-
/**
|
|
1323
|
+
/**
|
|
1324
|
+
* Dialog title displayed in the header.
|
|
1325
|
+
* @a11y Recommended — labels the dialog via `aria-labelledby` (the accessible name).
|
|
1326
|
+
*/
|
|
994
1327
|
title: string;
|
|
995
|
-
/**
|
|
1328
|
+
/**
|
|
1329
|
+
* Called when the close button is clicked.
|
|
1330
|
+
* @a11y Recommended — the close button exposes an accessible label for keyboard/screen-reader users.
|
|
1331
|
+
*/
|
|
996
1332
|
onClose: () => void;
|
|
997
1333
|
};
|
|
998
1334
|
|
|
@@ -1021,6 +1357,16 @@ type MenuProps = {
|
|
|
1021
1357
|
maxHeight?: string;
|
|
1022
1358
|
/** ARIA id for the listbox panel. */
|
|
1023
1359
|
id?: string;
|
|
1360
|
+
/**
|
|
1361
|
+
* Accessible name for the listbox (use when there is no visible label).
|
|
1362
|
+
* @a11y Recommended — names the listbox when no labelling element is referenced via `aria-labelledby`.
|
|
1363
|
+
*/
|
|
1364
|
+
'aria-label'?: string;
|
|
1365
|
+
/**
|
|
1366
|
+
* Id of an element that labels the listbox (e.g. the trigger's label).
|
|
1367
|
+
* @a11y Recommended — references the trigger's visible label to name the listbox.
|
|
1368
|
+
*/
|
|
1369
|
+
'aria-labelledby'?: string;
|
|
1024
1370
|
/** Menu content — MenuGroup and/or MenuItem. */
|
|
1025
1371
|
children: ReactNode;
|
|
1026
1372
|
};
|
|
@@ -1036,11 +1382,17 @@ type MenuGroupProps = {
|
|
|
1036
1382
|
|
|
1037
1383
|
type MenuItemProps = HTMLAttributes<HTMLLIElement> & {
|
|
1038
1384
|
ref?: Ref<HTMLLIElement>;
|
|
1039
|
-
/**
|
|
1385
|
+
/**
|
|
1386
|
+
* Display text of the item.
|
|
1387
|
+
* @a11y Recommended — provides the option's accessible name.
|
|
1388
|
+
*/
|
|
1040
1389
|
label: string;
|
|
1041
1390
|
/** Optional SVG icon rendered before the label. */
|
|
1042
1391
|
icon?: ComponentType<SVGProps<SVGSVGElement>>;
|
|
1043
|
-
/**
|
|
1392
|
+
/**
|
|
1393
|
+
* Whether this item is currently selected.
|
|
1394
|
+
* @a11y Recommended — exposes the selected state via `aria-selected`.
|
|
1395
|
+
*/
|
|
1044
1396
|
selected?: boolean;
|
|
1045
1397
|
/** Whether this item has keyboard focus (highlighted via arrow navigation). */
|
|
1046
1398
|
focused?: boolean;
|
|
@@ -1080,5 +1432,5 @@ declare const lightTheme: Theme;
|
|
|
1080
1432
|
|
|
1081
1433
|
declare const darkTheme: Theme;
|
|
1082
1434
|
|
|
1083
|
-
export { Alert, Badge, Box, Button, Card, Dialog, Form, Grid, Icon, IconButton, InfoBubble, Link, Menu, Select, Skeleton, Stack, Switch, Text, TextField, Tooltip, darkTheme, lightTheme };
|
|
1084
|
-
export type { AlertBodyProps, AlertProps, AlertTitleProps, AlertVariant, BadgeColor, BadgeIcon, BadgeProps, BadgeSize, BadgeVariant, BoxProps, ButtonColor, ButtonIcon, ButtonProps, ButtonSize, ButtonVariant, CardBodyProps, CardHeaderProps, CardProps, CardVariant, DialogBodyProps, DialogHeaderProps, DialogProps, FormProps, GridProps, GridStyleProps, IconButtonProps, IconProps, IconStyleParams, InfoBubbleProps, LinkIcon, LinkProps, LinkUnderline, MenuGroupProps, MenuItemProps, MenuProps, Palette, SelectOption, SelectProps, SkeletonAnimation, SkeletonProps, SkeletonVariant, StackProps, SwitchColor, SwitchProps, SwitchSize, TextFieldProps, TextFieldSize, TextFieldStatus, TextProps, TextStyleParams, TextVariantStyle, TextVariants, Theme, TooltipPlacement, TooltipProps };
|
|
1435
|
+
export { Alert, Backdrop, Badge, Box, Button, Card, Checkbox, Dialog, Drawer, Form, Grid, Icon, IconButton, InfoBubble, Link, Menu, Select, Skeleton, Stack, Switch, Text, TextField, Tooltip, darkTheme, lightTheme, useDrawerContext };
|
|
1436
|
+
export type { AlertBodyProps, AlertProps, AlertTitleProps, AlertVariant, BackdropProps, BadgeColor, BadgeIcon, BadgeProps, BadgeSize, BadgeVariant, BoxProps, 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, LinkIcon, LinkProps, LinkUnderline, MenuGroupProps, MenuItemProps, MenuProps, Palette, SelectOption, SelectProps, SkeletonAnimation, SkeletonProps, SkeletonVariant, StackProps, SwitchColor, SwitchProps, SwitchSize, TextFieldProps, TextFieldSize, TextFieldStatus, TextProps, TextStyleParams, TextVariantStyle, TextVariants, Theme, TooltipPlacement, TooltipProps };
|