@mond-design-system/react 6.1.0 → 6.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/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;
@@ -813,7 +820,7 @@ type SwitchProps = SwitchBaseProps & SwitchLabelEnforcement;
813
820
  * <Switch aria-label="Email on new posts" checked={on} loading={saving} onChange={toggle} />
814
821
  * ```
815
822
  */
816
- declare function Switch({ label, loading, disabled, className, ...rest }: SwitchProps): ReactElement;
823
+ declare function Switch({ label, loading, disabled, className, onClick, onChange, ...rest }: SwitchProps): ReactElement;
817
824
 
818
825
  interface SegmentOption<T extends string = string> {
819
826
  value: T;
@@ -1039,6 +1046,9 @@ declare function DataTable<Row>({ label, columns, rows, rowKey, rowLabel, rowAct
1039
1046
 
1040
1047
  interface EmptyStateProps {
1041
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;
1042
1052
  description?: string;
1043
1053
  /** Illustration or Icon slot. */
1044
1054
  icon?: ReactNode;
@@ -1058,7 +1068,7 @@ interface EmptyStateProps {
1058
1068
  * />
1059
1069
  * ```
1060
1070
  */
1061
- declare function EmptyState({ title, description, icon, action, className }: EmptyStateProps): ReactElement;
1071
+ declare function EmptyState({ title, level, description, icon, action, className }: EmptyStateProps): ReactElement;
1062
1072
 
1063
1073
  interface TabsProps {
1064
1074
  value: string;
@@ -1295,6 +1305,8 @@ interface ModalProps {
1295
1305
  closeOnScrimClick?: boolean;
1296
1306
  /** alertdialog interrupts — ConfirmDialog sets it. Default "dialog". */
1297
1307
  role?: "dialog" | "alertdialog";
1308
+ /** id of the element that explains the dialog, read out with its name. */
1309
+ describedBy?: string | undefined;
1298
1310
  children: ReactNode;
1299
1311
  }
1300
1312
  /**
@@ -1309,7 +1321,7 @@ interface ModalProps {
1309
1321
  * </Modal>
1310
1322
  * ```
1311
1323
  */
1312
- 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;
1313
1325
  declare function ModalHeader({ children }: {
1314
1326
  children: ReactNode;
1315
1327
  }): react.JSX.Element;
@@ -1368,6 +1380,9 @@ interface PopoverProps {
1368
1380
  anchorRef: RefObject<HTMLElement | null>;
1369
1381
  /** Accessible name of the panel. */
1370
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;
1371
1386
  /** Side it prefers. It flips and slides to stay on screen. Default "bottom-start". */
1372
1387
  placement?: PopoverPlacement;
1373
1388
  className?: string;
@@ -1393,7 +1408,7 @@ interface PopoverProps {
1393
1408
  * </Popover>
1394
1409
  * ```
1395
1410
  */
1396
- 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;
1397
1412
  type PopoverHeaderProps = {
1398
1413
  children: ReactNode;
1399
1414
  } & ({
@@ -1597,6 +1612,10 @@ interface AppBarProps extends Omit<HTMLAttributes<HTMLElement>, "title"> {
1597
1612
  leading?: ReactNode;
1598
1613
  /** Right slot — actions. */
1599
1614
  trailing?: ReactNode;
1615
+ /** Drop the page padding so the bar's content reaches the screen edge.
1616
+ Off by default: the padding is what lines the bar up with the page
1617
+ column (Container shares the same token). */
1618
+ flush?: boolean;
1600
1619
  ref?: Ref<HTMLElement>;
1601
1620
  }
1602
1621
  /**
@@ -1613,7 +1632,7 @@ interface AppBarProps extends Omit<HTMLAttributes<HTMLElement>, "title"> {
1613
1632
  * />
1614
1633
  * ```
1615
1634
  */
1616
- declare function AppBar({ title, subtitle, leading, trailing, className, ref, ...rest }: AppBarProps): react.JSX.Element;
1635
+ declare function AppBar({ title, subtitle, leading, trailing, flush, className, ref, ...rest }: AppBarProps): react.JSX.Element;
1617
1636
 
1618
1637
  interface TabBarProps {
1619
1638
  /** Accessible name of the navigation landmark. */
@@ -1642,6 +1661,10 @@ interface TabBarItemProps {
1642
1661
  /** Attention dot on the icon — unread, pending. Boolean only: the count
1643
1662
  lives on the destination screen, the bar just says "something's there". */
1644
1663
  badge?: boolean | undefined;
1664
+ /** What the dot means, e.g. "New messages" — the dot itself sits inside the
1665
+ aria-hidden icon, so without these words the badge is invisible to a
1666
+ reader. The words are the app's, like every label here. */
1667
+ badgeLabel?: string | undefined;
1645
1668
  /** Element override for the link, e.g. a router's Link. A bottom bar is
1646
1669
  where a full page reload costs the most — it restarts the whole shell. */
1647
1670
  as?: ElementType;
@@ -1651,7 +1674,7 @@ interface TabBarItemProps {
1651
1674
  everywhere. Hidden, never dropped — the word is the item's name. */
1652
1675
  hideLabel?: boolean | undefined;
1653
1676
  }
1654
- declare function TabBarItem({ label, icon, href, onClick, active, badge, as, hideLabel, }: TabBarItemProps): react.JSX.Element;
1677
+ declare function TabBarItem({ label, icon, href, onClick, active, badge, badgeLabel, as, hideLabel, }: TabBarItemProps): react.JSX.Element;
1655
1678
  interface TabBarActionProps {
1656
1679
  /** Names the action — icon-only, so this is all a screen reader gets. */
1657
1680
  label: string;
@@ -2051,6 +2074,16 @@ interface UseOverlayOptions {
2051
2074
  * anchor are the same gesture answered two ways.
2052
2075
  */
2053
2076
  lockScroll?: boolean;
2077
+ /**
2078
+ * Trap Tab inside the panel and always hand focus back on close. Default
2079
+ * true.
2080
+ *
2081
+ * False for non-modal surfaces: the page behind a popover is still live,
2082
+ * so Tab walks out of the panel instead of cycling, and focus returns to
2083
+ * the opener only when the close takes it from inside the panel — a press
2084
+ * elsewhere on the page already put it where the reader wanted it.
2085
+ */
2086
+ modal?: boolean;
2054
2087
  }
2055
2088
  /**
2056
2089
  * 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;
@@ -813,7 +820,7 @@ type SwitchProps = SwitchBaseProps & SwitchLabelEnforcement;
813
820
  * <Switch aria-label="Email on new posts" checked={on} loading={saving} onChange={toggle} />
814
821
  * ```
815
822
  */
816
- declare function Switch({ label, loading, disabled, className, ...rest }: SwitchProps): ReactElement;
823
+ declare function Switch({ label, loading, disabled, className, onClick, onChange, ...rest }: SwitchProps): ReactElement;
817
824
 
818
825
  interface SegmentOption<T extends string = string> {
819
826
  value: T;
@@ -1039,6 +1046,9 @@ declare function DataTable<Row>({ label, columns, rows, rowKey, rowLabel, rowAct
1039
1046
 
1040
1047
  interface EmptyStateProps {
1041
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;
1042
1052
  description?: string;
1043
1053
  /** Illustration or Icon slot. */
1044
1054
  icon?: ReactNode;
@@ -1058,7 +1068,7 @@ interface EmptyStateProps {
1058
1068
  * />
1059
1069
  * ```
1060
1070
  */
1061
- declare function EmptyState({ title, description, icon, action, className }: EmptyStateProps): ReactElement;
1071
+ declare function EmptyState({ title, level, description, icon, action, className }: EmptyStateProps): ReactElement;
1062
1072
 
1063
1073
  interface TabsProps {
1064
1074
  value: string;
@@ -1295,6 +1305,8 @@ interface ModalProps {
1295
1305
  closeOnScrimClick?: boolean;
1296
1306
  /** alertdialog interrupts — ConfirmDialog sets it. Default "dialog". */
1297
1307
  role?: "dialog" | "alertdialog";
1308
+ /** id of the element that explains the dialog, read out with its name. */
1309
+ describedBy?: string | undefined;
1298
1310
  children: ReactNode;
1299
1311
  }
1300
1312
  /**
@@ -1309,7 +1321,7 @@ interface ModalProps {
1309
1321
  * </Modal>
1310
1322
  * ```
1311
1323
  */
1312
- 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;
1313
1325
  declare function ModalHeader({ children }: {
1314
1326
  children: ReactNode;
1315
1327
  }): react.JSX.Element;
@@ -1368,6 +1380,9 @@ interface PopoverProps {
1368
1380
  anchorRef: RefObject<HTMLElement | null>;
1369
1381
  /** Accessible name of the panel. */
1370
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;
1371
1386
  /** Side it prefers. It flips and slides to stay on screen. Default "bottom-start". */
1372
1387
  placement?: PopoverPlacement;
1373
1388
  className?: string;
@@ -1393,7 +1408,7 @@ interface PopoverProps {
1393
1408
  * </Popover>
1394
1409
  * ```
1395
1410
  */
1396
- 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;
1397
1412
  type PopoverHeaderProps = {
1398
1413
  children: ReactNode;
1399
1414
  } & ({
@@ -1597,6 +1612,10 @@ interface AppBarProps extends Omit<HTMLAttributes<HTMLElement>, "title"> {
1597
1612
  leading?: ReactNode;
1598
1613
  /** Right slot — actions. */
1599
1614
  trailing?: ReactNode;
1615
+ /** Drop the page padding so the bar's content reaches the screen edge.
1616
+ Off by default: the padding is what lines the bar up with the page
1617
+ column (Container shares the same token). */
1618
+ flush?: boolean;
1600
1619
  ref?: Ref<HTMLElement>;
1601
1620
  }
1602
1621
  /**
@@ -1613,7 +1632,7 @@ interface AppBarProps extends Omit<HTMLAttributes<HTMLElement>, "title"> {
1613
1632
  * />
1614
1633
  * ```
1615
1634
  */
1616
- declare function AppBar({ title, subtitle, leading, trailing, className, ref, ...rest }: AppBarProps): react.JSX.Element;
1635
+ declare function AppBar({ title, subtitle, leading, trailing, flush, className, ref, ...rest }: AppBarProps): react.JSX.Element;
1617
1636
 
1618
1637
  interface TabBarProps {
1619
1638
  /** Accessible name of the navigation landmark. */
@@ -1642,6 +1661,10 @@ interface TabBarItemProps {
1642
1661
  /** Attention dot on the icon — unread, pending. Boolean only: the count
1643
1662
  lives on the destination screen, the bar just says "something's there". */
1644
1663
  badge?: boolean | undefined;
1664
+ /** What the dot means, e.g. "New messages" — the dot itself sits inside the
1665
+ aria-hidden icon, so without these words the badge is invisible to a
1666
+ reader. The words are the app's, like every label here. */
1667
+ badgeLabel?: string | undefined;
1645
1668
  /** Element override for the link, e.g. a router's Link. A bottom bar is
1646
1669
  where a full page reload costs the most — it restarts the whole shell. */
1647
1670
  as?: ElementType;
@@ -1651,7 +1674,7 @@ interface TabBarItemProps {
1651
1674
  everywhere. Hidden, never dropped — the word is the item's name. */
1652
1675
  hideLabel?: boolean | undefined;
1653
1676
  }
1654
- declare function TabBarItem({ label, icon, href, onClick, active, badge, as, hideLabel, }: TabBarItemProps): react.JSX.Element;
1677
+ declare function TabBarItem({ label, icon, href, onClick, active, badge, badgeLabel, as, hideLabel, }: TabBarItemProps): react.JSX.Element;
1655
1678
  interface TabBarActionProps {
1656
1679
  /** Names the action — icon-only, so this is all a screen reader gets. */
1657
1680
  label: string;
@@ -2051,6 +2074,16 @@ interface UseOverlayOptions {
2051
2074
  * anchor are the same gesture answered two ways.
2052
2075
  */
2053
2076
  lockScroll?: boolean;
2077
+ /**
2078
+ * Trap Tab inside the panel and always hand focus back on close. Default
2079
+ * true.
2080
+ *
2081
+ * False for non-modal surfaces: the page behind a popover is still live,
2082
+ * so Tab walks out of the panel instead of cycling, and focus returns to
2083
+ * the opener only when the close takes it from inside the panel — a press
2084
+ * elsewhere on the page already put it where the reader wanted it.
2085
+ */
2086
+ modal?: boolean;
2054
2087
  }
2055
2088
  /**
2056
2089
  * Shared modal-surface behaviour: focus capture and restore, Escape to