@mond-design-system/react 6.0.0 → 6.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -179,7 +179,7 @@ type ButtonProps = ButtonBaseProps & IconOnlyEnforcement;
179
179
  * <Button iconOnly aria-label="Menu" shape="rect"><Icon name="menu" /></Button>
180
180
  * ```
181
181
  */
182
- declare function Button({ variant, size, shape, onMedia, iconLeft, iconRight, loading, disabled, fullWidth, iconOnly, type, href, as, className, children, ...rest }: ButtonProps): ReactElement;
182
+ declare function Button({ variant, size, shape, onMedia, iconLeft, iconRight, loading, disabled, fullWidth, iconOnly, type, href, as, className, children, onClick, ...rest }: ButtonProps): ReactElement;
183
183
 
184
184
  type LinkVariant = "inline" | "standalone" | "plain";
185
185
  type LinkSize = "xs" | "sm" | "base" | "lg" | "xl";
@@ -192,6 +192,10 @@ type LinkOwnProps<E extends ElementType> = {
192
192
  size?: LinkSize;
193
193
  /** Opens in a new tab with rel protection. */
194
194
  external?: boolean;
195
+ /** Announced after the link text, unseen — a new tab is a context change a
196
+ reader cannot see coming, e.g. "opens in new tab". The words are the
197
+ app's, so they arrive here rather than being baked in English. */
198
+ externalLabel?: string;
195
199
  /** Element override — `'button'` for a link-styled action, or a router's
196
200
  Link component, whose own props (`to`, `href`, …) then type-check. */
197
201
  as?: E;
@@ -208,7 +212,7 @@ type LinkProps<E extends ElementType = "a"> = LinkOwnProps<E> & Omit<ComponentPr
208
212
  * <Link as={RouterLink} to="/about">About</Link>
209
213
  * ```
210
214
  */
211
- declare function Link<E extends ElementType = "a">({ variant, size, external, as, ...rest }: LinkProps<E>): ReactElement;
215
+ declare function Link<E extends ElementType = "a">({ variant, size, external, externalLabel, as, children, ...rest }: LinkProps<E>): ReactElement;
212
216
 
213
217
  type AvatarSize = "xs" | "sm" | "md" | "lg" | "xl";
214
218
  /** One of the five brand identity tints (`--mds-avatar-tone-1..5`). */
@@ -406,7 +410,7 @@ interface CountButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>,
406
410
  * </CountButton>
407
411
  * ```
408
412
  */
409
- declare function CountButton({ icon, label, active, tone, disabled, loading, className, children, ...rest }: CountButtonProps): ReactElement;
413
+ declare function CountButton({ icon, label, active, tone, disabled, loading, className, children, onClick, ...rest }: CountButtonProps): ReactElement;
410
414
 
411
415
  interface DateTimePickerLabels {
412
416
  /** Accessible name of the picker dialog. */
@@ -586,6 +590,9 @@ interface FieldContextValue {
586
590
  /** Space-joined ids of hint/error, for aria-describedby. */
587
591
  describedBy: string | undefined;
588
592
  invalid: boolean;
593
+ /** The label's asterisk is aria-hidden decoration; controls carry the
594
+ * requirement as aria-required so assistive tech hears it too. */
595
+ required: boolean;
589
596
  }
590
597
  /** Controls call this to pick up Field wiring. Null outside a Field. */
591
598
  declare function useFieldContext(): FieldContextValue | null;
@@ -765,9 +772,12 @@ interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "typ
765
772
  */
766
773
  declare function Checkbox({ label, labelHidden, indeterminate, className, ref, ...rest }: CheckboxProps): ReactElement;
767
774
 
775
+ type RadioSize = "sm" | "md" | "lg";
768
776
  interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size"> {
769
777
  /** Inline label — part of the click target. */
770
778
  label: string;
779
+ /** Control step. Default md. The 44px target holds at every step. */
780
+ size?: RadioSize;
771
781
  ref?: Ref<HTMLInputElement>;
772
782
  }
773
783
  /**
@@ -782,7 +792,7 @@ interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type"
782
792
  * </fieldset>
783
793
  * ```
784
794
  */
785
- declare function Radio({ label, className, ...rest }: RadioProps): ReactElement;
795
+ declare function Radio({ label, size, className, ...rest }: RadioProps): ReactElement;
786
796
 
787
797
  interface SwitchBaseProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size"> {
788
798
  /** Busy blocks toggling for the same reason disabled does — a second tap
@@ -810,7 +820,7 @@ type SwitchProps = SwitchBaseProps & SwitchLabelEnforcement;
810
820
  * <Switch aria-label="Email on new posts" checked={on} loading={saving} onChange={toggle} />
811
821
  * ```
812
822
  */
813
- declare function Switch({ label, loading, disabled, className, ...rest }: SwitchProps): ReactElement;
823
+ declare function Switch({ label, loading, disabled, className, onClick, onChange, ...rest }: SwitchProps): ReactElement;
814
824
 
815
825
  interface SegmentOption<T extends string = string> {
816
826
  value: T;
@@ -1036,6 +1046,9 @@ declare function DataTable<Row>({ label, columns, rows, rowKey, rowLabel, rowAct
1036
1046
 
1037
1047
  interface EmptyStateProps {
1038
1048
  title: string;
1049
+ /** Outline level of the title — the caller knows where the empty state
1050
+ * sits in the page's heading structure. Default 3. */
1051
+ level?: HeadingLevel;
1039
1052
  description?: string;
1040
1053
  /** Illustration or Icon slot. */
1041
1054
  icon?: ReactNode;
@@ -1055,7 +1068,7 @@ interface EmptyStateProps {
1055
1068
  * />
1056
1069
  * ```
1057
1070
  */
1058
- declare function EmptyState({ title, description, icon, action, className }: EmptyStateProps): ReactElement;
1071
+ declare function EmptyState({ title, level, description, icon, action, className }: EmptyStateProps): ReactElement;
1059
1072
 
1060
1073
  interface TabsProps {
1061
1074
  value: string;
@@ -1292,6 +1305,8 @@ interface ModalProps {
1292
1305
  closeOnScrimClick?: boolean;
1293
1306
  /** alertdialog interrupts — ConfirmDialog sets it. Default "dialog". */
1294
1307
  role?: "dialog" | "alertdialog";
1308
+ /** id of the element that explains the dialog, read out with its name. */
1309
+ describedBy?: string | undefined;
1295
1310
  children: ReactNode;
1296
1311
  }
1297
1312
  /**
@@ -1306,7 +1321,7 @@ interface ModalProps {
1306
1321
  * </Modal>
1307
1322
  * ```
1308
1323
  */
1309
- declare function Modal({ open, onClose, label, closeOnScrimClick, role, children }: ModalProps): react.JSX.Element;
1324
+ declare function Modal({ open, onClose, label, closeOnScrimClick, role, describedBy, children }: ModalProps): react.JSX.Element;
1310
1325
  declare function ModalHeader({ children }: {
1311
1326
  children: ReactNode;
1312
1327
  }): react.JSX.Element;
@@ -1365,6 +1380,9 @@ interface PopoverProps {
1365
1380
  anchorRef: RefObject<HTMLElement | null>;
1366
1381
  /** Accessible name of the panel. */
1367
1382
  label: string;
1383
+ /** Lands on the panel element, so the trigger's aria-controls has something
1384
+ to point at. The trigger is the caller's, so the wiring is too. */
1385
+ id?: string | undefined;
1368
1386
  /** Side it prefers. It flips and slides to stay on screen. Default "bottom-start". */
1369
1387
  placement?: PopoverPlacement;
1370
1388
  className?: string;
@@ -1390,7 +1408,7 @@ interface PopoverProps {
1390
1408
  * </Popover>
1391
1409
  * ```
1392
1410
  */
1393
- declare function Popover({ open, onClose, anchorRef, label, placement, className, children, }: PopoverProps): react.ReactPortal | null;
1411
+ declare function Popover({ open, onClose, anchorRef, label, id, placement, className, children, }: PopoverProps): react.ReactPortal | null;
1394
1412
  type PopoverHeaderProps = {
1395
1413
  children: ReactNode;
1396
1414
  } & ({
@@ -1639,6 +1657,10 @@ interface TabBarItemProps {
1639
1657
  /** Attention dot on the icon — unread, pending. Boolean only: the count
1640
1658
  lives on the destination screen, the bar just says "something's there". */
1641
1659
  badge?: boolean | undefined;
1660
+ /** What the dot means, e.g. "New messages" — the dot itself sits inside the
1661
+ aria-hidden icon, so without these words the badge is invisible to a
1662
+ reader. The words are the app's, like every label here. */
1663
+ badgeLabel?: string | undefined;
1642
1664
  /** Element override for the link, e.g. a router's Link. A bottom bar is
1643
1665
  where a full page reload costs the most — it restarts the whole shell. */
1644
1666
  as?: ElementType;
@@ -1648,7 +1670,7 @@ interface TabBarItemProps {
1648
1670
  everywhere. Hidden, never dropped — the word is the item's name. */
1649
1671
  hideLabel?: boolean | undefined;
1650
1672
  }
1651
- declare function TabBarItem({ label, icon, href, onClick, active, badge, as, hideLabel, }: TabBarItemProps): react.JSX.Element;
1673
+ declare function TabBarItem({ label, icon, href, onClick, active, badge, badgeLabel, as, hideLabel, }: TabBarItemProps): react.JSX.Element;
1652
1674
  interface TabBarActionProps {
1653
1675
  /** Names the action — icon-only, so this is all a screen reader gets. */
1654
1676
  label: string;
@@ -2048,6 +2070,16 @@ interface UseOverlayOptions {
2048
2070
  * anchor are the same gesture answered two ways.
2049
2071
  */
2050
2072
  lockScroll?: boolean;
2073
+ /**
2074
+ * Trap Tab inside the panel and always hand focus back on close. Default
2075
+ * true.
2076
+ *
2077
+ * False for non-modal surfaces: the page behind a popover is still live,
2078
+ * so Tab walks out of the panel instead of cycling, and focus returns to
2079
+ * the opener only when the close takes it from inside the panel — a press
2080
+ * elsewhere on the page already put it where the reader wanted it.
2081
+ */
2082
+ modal?: boolean;
2051
2083
  }
2052
2084
  /**
2053
2085
  * Shared modal-surface behaviour: focus capture and restore, Escape to
package/dist/index.d.ts CHANGED
@@ -179,7 +179,7 @@ type ButtonProps = ButtonBaseProps & IconOnlyEnforcement;
179
179
  * <Button iconOnly aria-label="Menu" shape="rect"><Icon name="menu" /></Button>
180
180
  * ```
181
181
  */
182
- declare function Button({ variant, size, shape, onMedia, iconLeft, iconRight, loading, disabled, fullWidth, iconOnly, type, href, as, className, children, ...rest }: ButtonProps): ReactElement;
182
+ declare function Button({ variant, size, shape, onMedia, iconLeft, iconRight, loading, disabled, fullWidth, iconOnly, type, href, as, className, children, onClick, ...rest }: ButtonProps): ReactElement;
183
183
 
184
184
  type LinkVariant = "inline" | "standalone" | "plain";
185
185
  type LinkSize = "xs" | "sm" | "base" | "lg" | "xl";
@@ -192,6 +192,10 @@ type LinkOwnProps<E extends ElementType> = {
192
192
  size?: LinkSize;
193
193
  /** Opens in a new tab with rel protection. */
194
194
  external?: boolean;
195
+ /** Announced after the link text, unseen — a new tab is a context change a
196
+ reader cannot see coming, e.g. "opens in new tab". The words are the
197
+ app's, so they arrive here rather than being baked in English. */
198
+ externalLabel?: string;
195
199
  /** Element override — `'button'` for a link-styled action, or a router's
196
200
  Link component, whose own props (`to`, `href`, …) then type-check. */
197
201
  as?: E;
@@ -208,7 +212,7 @@ type LinkProps<E extends ElementType = "a"> = LinkOwnProps<E> & Omit<ComponentPr
208
212
  * <Link as={RouterLink} to="/about">About</Link>
209
213
  * ```
210
214
  */
211
- declare function Link<E extends ElementType = "a">({ variant, size, external, as, ...rest }: LinkProps<E>): ReactElement;
215
+ declare function Link<E extends ElementType = "a">({ variant, size, external, externalLabel, as, children, ...rest }: LinkProps<E>): ReactElement;
212
216
 
213
217
  type AvatarSize = "xs" | "sm" | "md" | "lg" | "xl";
214
218
  /** One of the five brand identity tints (`--mds-avatar-tone-1..5`). */
@@ -406,7 +410,7 @@ interface CountButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>,
406
410
  * </CountButton>
407
411
  * ```
408
412
  */
409
- declare function CountButton({ icon, label, active, tone, disabled, loading, className, children, ...rest }: CountButtonProps): ReactElement;
413
+ declare function CountButton({ icon, label, active, tone, disabled, loading, className, children, onClick, ...rest }: CountButtonProps): ReactElement;
410
414
 
411
415
  interface DateTimePickerLabels {
412
416
  /** Accessible name of the picker dialog. */
@@ -586,6 +590,9 @@ interface FieldContextValue {
586
590
  /** Space-joined ids of hint/error, for aria-describedby. */
587
591
  describedBy: string | undefined;
588
592
  invalid: boolean;
593
+ /** The label's asterisk is aria-hidden decoration; controls carry the
594
+ * requirement as aria-required so assistive tech hears it too. */
595
+ required: boolean;
589
596
  }
590
597
  /** Controls call this to pick up Field wiring. Null outside a Field. */
591
598
  declare function useFieldContext(): FieldContextValue | null;
@@ -765,9 +772,12 @@ interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "typ
765
772
  */
766
773
  declare function Checkbox({ label, labelHidden, indeterminate, className, ref, ...rest }: CheckboxProps): ReactElement;
767
774
 
775
+ type RadioSize = "sm" | "md" | "lg";
768
776
  interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size"> {
769
777
  /** Inline label — part of the click target. */
770
778
  label: string;
779
+ /** Control step. Default md. The 44px target holds at every step. */
780
+ size?: RadioSize;
771
781
  ref?: Ref<HTMLInputElement>;
772
782
  }
773
783
  /**
@@ -782,7 +792,7 @@ interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type"
782
792
  * </fieldset>
783
793
  * ```
784
794
  */
785
- declare function Radio({ label, className, ...rest }: RadioProps): ReactElement;
795
+ declare function Radio({ label, size, className, ...rest }: RadioProps): ReactElement;
786
796
 
787
797
  interface SwitchBaseProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size"> {
788
798
  /** Busy blocks toggling for the same reason disabled does — a second tap
@@ -810,7 +820,7 @@ type SwitchProps = SwitchBaseProps & SwitchLabelEnforcement;
810
820
  * <Switch aria-label="Email on new posts" checked={on} loading={saving} onChange={toggle} />
811
821
  * ```
812
822
  */
813
- declare function Switch({ label, loading, disabled, className, ...rest }: SwitchProps): ReactElement;
823
+ declare function Switch({ label, loading, disabled, className, onClick, onChange, ...rest }: SwitchProps): ReactElement;
814
824
 
815
825
  interface SegmentOption<T extends string = string> {
816
826
  value: T;
@@ -1036,6 +1046,9 @@ declare function DataTable<Row>({ label, columns, rows, rowKey, rowLabel, rowAct
1036
1046
 
1037
1047
  interface EmptyStateProps {
1038
1048
  title: string;
1049
+ /** Outline level of the title — the caller knows where the empty state
1050
+ * sits in the page's heading structure. Default 3. */
1051
+ level?: HeadingLevel;
1039
1052
  description?: string;
1040
1053
  /** Illustration or Icon slot. */
1041
1054
  icon?: ReactNode;
@@ -1055,7 +1068,7 @@ interface EmptyStateProps {
1055
1068
  * />
1056
1069
  * ```
1057
1070
  */
1058
- declare function EmptyState({ title, description, icon, action, className }: EmptyStateProps): ReactElement;
1071
+ declare function EmptyState({ title, level, description, icon, action, className }: EmptyStateProps): ReactElement;
1059
1072
 
1060
1073
  interface TabsProps {
1061
1074
  value: string;
@@ -1292,6 +1305,8 @@ interface ModalProps {
1292
1305
  closeOnScrimClick?: boolean;
1293
1306
  /** alertdialog interrupts — ConfirmDialog sets it. Default "dialog". */
1294
1307
  role?: "dialog" | "alertdialog";
1308
+ /** id of the element that explains the dialog, read out with its name. */
1309
+ describedBy?: string | undefined;
1295
1310
  children: ReactNode;
1296
1311
  }
1297
1312
  /**
@@ -1306,7 +1321,7 @@ interface ModalProps {
1306
1321
  * </Modal>
1307
1322
  * ```
1308
1323
  */
1309
- declare function Modal({ open, onClose, label, closeOnScrimClick, role, children }: ModalProps): react.JSX.Element;
1324
+ declare function Modal({ open, onClose, label, closeOnScrimClick, role, describedBy, children }: ModalProps): react.JSX.Element;
1310
1325
  declare function ModalHeader({ children }: {
1311
1326
  children: ReactNode;
1312
1327
  }): react.JSX.Element;
@@ -1365,6 +1380,9 @@ interface PopoverProps {
1365
1380
  anchorRef: RefObject<HTMLElement | null>;
1366
1381
  /** Accessible name of the panel. */
1367
1382
  label: string;
1383
+ /** Lands on the panel element, so the trigger's aria-controls has something
1384
+ to point at. The trigger is the caller's, so the wiring is too. */
1385
+ id?: string | undefined;
1368
1386
  /** Side it prefers. It flips and slides to stay on screen. Default "bottom-start". */
1369
1387
  placement?: PopoverPlacement;
1370
1388
  className?: string;
@@ -1390,7 +1408,7 @@ interface PopoverProps {
1390
1408
  * </Popover>
1391
1409
  * ```
1392
1410
  */
1393
- declare function Popover({ open, onClose, anchorRef, label, placement, className, children, }: PopoverProps): react.ReactPortal | null;
1411
+ declare function Popover({ open, onClose, anchorRef, label, id, placement, className, children, }: PopoverProps): react.ReactPortal | null;
1394
1412
  type PopoverHeaderProps = {
1395
1413
  children: ReactNode;
1396
1414
  } & ({
@@ -1639,6 +1657,10 @@ interface TabBarItemProps {
1639
1657
  /** Attention dot on the icon — unread, pending. Boolean only: the count
1640
1658
  lives on the destination screen, the bar just says "something's there". */
1641
1659
  badge?: boolean | undefined;
1660
+ /** What the dot means, e.g. "New messages" — the dot itself sits inside the
1661
+ aria-hidden icon, so without these words the badge is invisible to a
1662
+ reader. The words are the app's, like every label here. */
1663
+ badgeLabel?: string | undefined;
1642
1664
  /** Element override for the link, e.g. a router's Link. A bottom bar is
1643
1665
  where a full page reload costs the most — it restarts the whole shell. */
1644
1666
  as?: ElementType;
@@ -1648,7 +1670,7 @@ interface TabBarItemProps {
1648
1670
  everywhere. Hidden, never dropped — the word is the item's name. */
1649
1671
  hideLabel?: boolean | undefined;
1650
1672
  }
1651
- declare function TabBarItem({ label, icon, href, onClick, active, badge, as, hideLabel, }: TabBarItemProps): react.JSX.Element;
1673
+ declare function TabBarItem({ label, icon, href, onClick, active, badge, badgeLabel, as, hideLabel, }: TabBarItemProps): react.JSX.Element;
1652
1674
  interface TabBarActionProps {
1653
1675
  /** Names the action — icon-only, so this is all a screen reader gets. */
1654
1676
  label: string;
@@ -2048,6 +2070,16 @@ interface UseOverlayOptions {
2048
2070
  * anchor are the same gesture answered two ways.
2049
2071
  */
2050
2072
  lockScroll?: boolean;
2073
+ /**
2074
+ * Trap Tab inside the panel and always hand focus back on close. Default
2075
+ * true.
2076
+ *
2077
+ * False for non-modal surfaces: the page behind a popover is still live,
2078
+ * so Tab walks out of the panel instead of cycling, and focus returns to
2079
+ * the opener only when the close takes it from inside the panel — a press
2080
+ * elsewhere on the page already put it where the reader wanted it.
2081
+ */
2082
+ modal?: boolean;
2051
2083
  }
2052
2084
  /**
2053
2085
  * Shared modal-surface behaviour: focus capture and restore, Escape to