@mond-design-system/react 6.1.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;
@@ -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
  } & ({
@@ -1642,6 +1657,10 @@ interface TabBarItemProps {
1642
1657
  /** Attention dot on the icon — unread, pending. Boolean only: the count
1643
1658
  lives on the destination screen, the bar just says "something's there". */
1644
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;
1645
1664
  /** Element override for the link, e.g. a router's Link. A bottom bar is
1646
1665
  where a full page reload costs the most — it restarts the whole shell. */
1647
1666
  as?: ElementType;
@@ -1651,7 +1670,7 @@ interface TabBarItemProps {
1651
1670
  everywhere. Hidden, never dropped — the word is the item's name. */
1652
1671
  hideLabel?: boolean | undefined;
1653
1672
  }
1654
- 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;
1655
1674
  interface TabBarActionProps {
1656
1675
  /** Names the action — icon-only, so this is all a screen reader gets. */
1657
1676
  label: string;
@@ -2051,6 +2070,16 @@ interface UseOverlayOptions {
2051
2070
  * anchor are the same gesture answered two ways.
2052
2071
  */
2053
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;
2054
2083
  }
2055
2084
  /**
2056
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;
@@ -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
  } & ({
@@ -1642,6 +1657,10 @@ interface TabBarItemProps {
1642
1657
  /** Attention dot on the icon — unread, pending. Boolean only: the count
1643
1658
  lives on the destination screen, the bar just says "something's there". */
1644
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;
1645
1664
  /** Element override for the link, e.g. a router's Link. A bottom bar is
1646
1665
  where a full page reload costs the most — it restarts the whole shell. */
1647
1666
  as?: ElementType;
@@ -1651,7 +1670,7 @@ interface TabBarItemProps {
1651
1670
  everywhere. Hidden, never dropped — the word is the item's name. */
1652
1671
  hideLabel?: boolean | undefined;
1653
1672
  }
1654
- 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;
1655
1674
  interface TabBarActionProps {
1656
1675
  /** Names the action — icon-only, so this is all a screen reader gets. */
1657
1676
  label: string;
@@ -2051,6 +2070,16 @@ interface UseOverlayOptions {
2051
2070
  * anchor are the same gesture answered two ways.
2052
2071
  */
2053
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;
2054
2083
  }
2055
2084
  /**
2056
2085
  * Shared modal-surface behaviour: focus capture and restore, Escape to