@dynamic-framework/ui-react 2.10.0 → 2.11.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.
Files changed (145) hide show
  1. package/dist/DPortalStack-6zJm6JoD.js +14 -0
  2. package/dist/DPortalStack-6zJm6JoD.js.map +1 -0
  3. package/dist/DPortalStack-D1-GGU4C.js +12 -0
  4. package/dist/DPortalStack-D1-GGU4C.js.map +1 -0
  5. package/dist/api.json +7429 -0
  6. package/dist/css/dynamic-ui.css +95 -26
  7. package/dist/css/dynamic-ui.min.css +2 -2
  8. package/dist/esm/components/DAlert/DAlert.js +2 -2
  9. package/dist/esm/components/DAlert/DAlert.js.map +1 -1
  10. package/dist/esm/components/DButtonIcon/DButtonIcon.js +6 -3
  11. package/dist/esm/components/DButtonIcon/DButtonIcon.js.map +1 -1
  12. package/dist/esm/components/DDataStateWrapper/DDataStateWrapper.js +10 -3
  13. package/dist/esm/components/DDataStateWrapper/DDataStateWrapper.js.map +1 -1
  14. package/dist/esm/components/DErrorBoundary/DErrorBoundary.js +3 -3
  15. package/dist/esm/components/DErrorBoundary/DErrorBoundary.js.map +1 -1
  16. package/dist/esm/components/DErrorBoundary/components/DefaultErrorBoundary.js +2 -2
  17. package/dist/esm/components/DErrorBoundary/components/DefaultErrorBoundary.js.map +1 -1
  18. package/dist/esm/components/DInput/DInput.js +15 -3
  19. package/dist/esm/components/DInput/DInput.js.map +1 -1
  20. package/dist/esm/components/DInputCheck/DInputCheck.js +45 -8
  21. package/dist/esm/components/DInputCheck/DInputCheck.js.map +1 -1
  22. package/dist/esm/components/DInputCounter/DInputCounter.js +78 -20
  23. package/dist/esm/components/DInputCounter/DInputCounter.js.map +1 -1
  24. package/dist/esm/components/DInputCurrency/DInputCurrency.js +8 -3
  25. package/dist/esm/components/DInputCurrency/DInputCurrency.js.map +1 -1
  26. package/dist/esm/components/DInputPhone/DInputPhone.js +14 -2
  27. package/dist/esm/components/DInputPhone/DInputPhone.js.map +1 -1
  28. package/dist/esm/components/DInputPin/DInputPin.js +3 -1
  29. package/dist/esm/components/DInputPin/DInputPin.js.map +1 -1
  30. package/dist/esm/components/DInputRange/DInputRange.js +16 -2
  31. package/dist/esm/components/DInputRange/DInputRange.js.map +1 -1
  32. package/dist/esm/components/DInputSelect/DInputSelect.js +18 -4
  33. package/dist/esm/components/DInputSelect/DInputSelect.js.map +1 -1
  34. package/dist/esm/components/DInputSwitch/DInputSwitch.js +20 -9
  35. package/dist/esm/components/DInputSwitch/DInputSwitch.js.map +1 -1
  36. package/dist/esm/components/DListGroup/DListGroup.js +10 -2
  37. package/dist/esm/components/DListGroup/DListGroup.js.map +1 -1
  38. package/dist/esm/components/DListGroup/ListGroupContext.js +11 -0
  39. package/dist/esm/components/DListGroup/ListGroupContext.js.map +1 -0
  40. package/dist/esm/components/DListGroup/components/DListGroupItem.js +34 -16
  41. package/dist/esm/components/DListGroup/components/DListGroupItem.js.map +1 -1
  42. package/dist/esm/components/DListGroup/components/warnInvalidListMarkup.js +30 -0
  43. package/dist/esm/components/DListGroup/components/warnInvalidListMarkup.js.map +1 -0
  44. package/dist/esm/components/DPasswordStrengthMeter/DPasswordStrengthMeter.js +2 -2
  45. package/dist/esm/components/DPasswordStrengthMeter/DPasswordStrengthMeter.js.map +1 -1
  46. package/dist/esm/components/DProgress/DProgress.js +9 -3
  47. package/dist/esm/components/DProgress/DProgress.js.map +1 -1
  48. package/dist/esm/components/DSelect/DSelect.js +31 -3
  49. package/dist/esm/components/DSelect/DSelect.js.map +1 -1
  50. package/dist/esm/components/DSelect/createAriaGuidance.js +57 -0
  51. package/dist/esm/components/DSelect/createAriaGuidance.js.map +1 -0
  52. package/dist/esm/components/DTabs/DTabs.js +29 -40
  53. package/dist/esm/components/DTabs/DTabs.js.map +1 -1
  54. package/dist/esm/components/DTabs/TabContext.js +3 -2
  55. package/dist/esm/components/DTabs/TabContext.js.map +1 -1
  56. package/dist/esm/components/DTabs/components/DTabContent.js +2 -2
  57. package/dist/esm/components/DTabs/components/DTabContent.js.map +1 -1
  58. package/dist/esm/components/DTabs/components/DTabsProvider.js +22 -0
  59. package/dist/esm/components/DTabs/components/DTabsProvider.js.map +1 -0
  60. package/dist/esm/components/DTabs/index.js +1 -0
  61. package/dist/esm/components/DTabs/index.js.map +1 -1
  62. package/dist/esm/components/DToast/DToast.js +7 -2
  63. package/dist/esm/components/DToast/DToast.js.map +1 -1
  64. package/dist/esm/components/DToastContainer/useDToast.js +5 -5
  65. package/dist/esm/components/DToastContainer/useDToast.js.map +1 -1
  66. package/dist/esm/components/internal/DFormLabel.js +46 -0
  67. package/dist/esm/components/internal/DFormLabel.js.map +1 -0
  68. package/dist/esm/contexts/DPortalContext.js +43 -8
  69. package/dist/esm/contexts/DPortalContext.js.map +1 -1
  70. package/dist/esm/contexts/portal/DPortalStack.js +12 -0
  71. package/dist/esm/contexts/portal/DPortalStack.js.map +1 -0
  72. package/dist/esm/hooks/useControlledState.js +51 -0
  73. package/dist/esm/hooks/useControlledState.js.map +1 -0
  74. package/dist/esm/hooks/useInputCurrency.js +73 -19
  75. package/dist/esm/hooks/useInputCurrency.js.map +1 -1
  76. package/dist/esm/hooks/useMediaBreakpointUp.js +42 -3
  77. package/dist/esm/hooks/useMediaBreakpointUp.js.map +1 -1
  78. package/dist/esm/hooks/useResponsiveProp.js +13 -2
  79. package/dist/esm/hooks/useResponsiveProp.js.map +1 -1
  80. package/dist/esm/index.js +1 -0
  81. package/dist/esm/index.js.map +1 -1
  82. package/dist/esm/utils/hasLabelContent.js +48 -0
  83. package/dist/esm/utils/hasLabelContent.js.map +1 -0
  84. package/dist/esm/utils/isTextLabel.js +23 -0
  85. package/dist/esm/utils/isTextLabel.js.map +1 -0
  86. package/dist/esm/utils/labelClickGuard.js +61 -0
  87. package/dist/esm/utils/labelClickGuard.js.map +1 -0
  88. package/dist/esm/utils/warnLabelUsage.js +57 -0
  89. package/dist/esm/utils/warnLabelUsage.js.map +1 -0
  90. package/dist/icons-core.json +1 -1
  91. package/dist/index.esm.js +865 -163
  92. package/dist/index.esm.js.map +1 -1
  93. package/dist/index.js +864 -161
  94. package/dist/index.js.map +1 -1
  95. package/dist/types/components/DAlert/DAlert.d.ts +16 -2
  96. package/dist/types/components/DButtonIcon/DButtonIcon.d.ts +9 -1
  97. package/dist/types/components/DDataStateWrapper/DDataStateWrapper.d.ts +29 -4
  98. package/dist/types/components/DDataStateWrapper/index.d.ts +1 -1
  99. package/dist/types/components/DErrorBoundary/DErrorBoundary.d.ts +6 -1
  100. package/dist/types/components/DErrorBoundary/components/DefaultErrorBoundary.d.ts +3 -1
  101. package/dist/types/components/DInput/DInput.d.ts +11 -2
  102. package/dist/types/components/DInputCheck/DInputCheck.d.ts +28 -3
  103. package/dist/types/components/DInputCounter/DInputCounter.d.ts +15 -3
  104. package/dist/types/components/DInputCurrency/DInputCurrency.d.ts +10 -3
  105. package/dist/types/components/DInputPhone/DInputPhone.d.ts +11 -2
  106. package/dist/types/components/DInputPin/DInputPin.d.ts +12 -2
  107. package/dist/types/components/DInputRange/DInputRange.d.ts +15 -2
  108. package/dist/types/components/DInputSelect/DInputSelect.d.ts +18 -3
  109. package/dist/types/components/DInputSwitch/DInputSwitch.d.ts +28 -3
  110. package/dist/types/components/DListGroup/DListGroup.d.ts +12 -1
  111. package/dist/types/components/DListGroup/ListGroupContext.d.ts +8 -0
  112. package/dist/types/components/DListGroup/components/DListGroupItem.d.ts +6 -1
  113. package/dist/types/components/DListGroup/components/warnInvalidListMarkup.d.ts +13 -0
  114. package/dist/types/components/DPasswordStrengthMeter/DPasswordStrengthMeter.d.ts +18 -3
  115. package/dist/types/components/DProgress/DProgress.d.ts +13 -1
  116. package/dist/types/components/DSelect/DSelect.d.ts +23 -3
  117. package/dist/types/components/DSelect/createAriaGuidance.d.ts +21 -0
  118. package/dist/types/components/DTabs/DTabs.d.ts +13 -2
  119. package/dist/types/components/DTabs/TabContext.d.ts +5 -0
  120. package/dist/types/components/DTabs/components/DTabsProvider.d.ts +11 -0
  121. package/dist/types/components/DTabs/index.d.ts +1 -0
  122. package/dist/types/components/DToast/DToast.d.ts +10 -3
  123. package/dist/types/components/DToastContainer/useDToast.d.ts +8 -1
  124. package/dist/types/components/index.d.ts +2 -2
  125. package/dist/types/components/interface.d.ts +7 -0
  126. package/dist/types/components/internal/DFormLabel.d.ts +30 -0
  127. package/dist/types/contexts/portal/DPortalStack.d.ts +13 -0
  128. package/dist/types/hooks/useControlledState.d.ts +17 -0
  129. package/dist/types/hooks/useInputCurrency.d.ts +26 -1
  130. package/dist/types/hooks/useMediaBreakpointUp.d.ts +10 -0
  131. package/dist/types/utils/hasLabelContent.d.ts +30 -0
  132. package/dist/types/utils/isTextLabel.d.ts +17 -0
  133. package/dist/types/utils/labelClickGuard.d.ts +20 -0
  134. package/dist/types/utils/warnLabelUsage.d.ts +43 -0
  135. package/package.json +8 -3
  136. package/src/style/abstracts/variables/_body.scss +2 -2
  137. package/src/style/abstracts/variables/_chips.scss +2 -0
  138. package/src/style/abstracts/variables/_colors.scss +2 -2
  139. package/src/style/base/_buttons.scss +4 -1
  140. package/src/style/base/_input-group.scss +5 -2
  141. package/src/style/base/_list-group.scss +55 -0
  142. package/src/style/components/_d-chip.scss +7 -2
  143. package/src/style/components/_d-tabs.scss +3 -0
  144. package/src/style/helpers/_color-bg.scss +5 -0
  145. package/src/style/root/_root.scss +9 -0
@@ -1,18 +1,32 @@
1
1
  import type { PropsWithChildren } from 'react';
2
- import type { BaseProps, ComponentStateColor } from '../interface';
2
+ import type { BaseProps, ComponentStateColor, LiveRegionRole } from '../interface';
3
3
  type Props = BaseProps & PropsWithChildren<{
4
4
  id?: string;
5
5
  color?: ComponentStateColor;
6
+ /**
7
+ * `alert` (default) interrupts the screen reader, for critical errors.
8
+ * `status` announces without interrupting, for dynamic non-critical
9
+ * messages. `none` renders no role, for static content already on screen.
10
+ */
11
+ role?: LiveRegionRole;
6
12
  icon?: string;
13
+ /**
14
+ * Renders the leading icon. Set to `false` for an alert without icon, such
15
+ * as an informative block inside a form where the icon competes with the
16
+ * content. When `true`, `icon` falls back to the one mapped to `color`.
17
+ */
18
+ showIcon?: boolean;
7
19
  iconFamilyClass?: string;
8
20
  iconFamilyPrefix?: string;
9
21
  iconMaterialStyle?: boolean;
10
22
  showClose?: boolean;
23
+ /** Accessible name of the close button. */
24
+ closeAriaLabel?: string;
11
25
  iconClose?: string;
12
26
  iconCloseFamilyClass?: string;
13
27
  iconCloseFamilyPrefix?: string;
14
28
  iconCloseMaterialStyle?: boolean;
15
29
  onClose?: () => void;
16
30
  }>;
17
- export default function DAlert({ color, icon: iconProp, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, iconClose: iconCloseProp, iconCloseFamilyClass, iconCloseFamilyPrefix, iconCloseMaterialStyle, showClose, onClose, children, id, className, style, dataAttributes, }: Props): import("react").JSX.Element;
31
+ export default function DAlert({ color, role, icon: iconProp, showIcon, iconFamilyClass, iconFamilyPrefix, iconMaterialStyle, iconClose: iconCloseProp, iconCloseFamilyClass, iconCloseFamilyPrefix, iconCloseMaterialStyle, showClose, closeAriaLabel, onClose, children, id, className, style, dataAttributes, }: Props): import("react").JSX.Element;
18
32
  export {};
@@ -1,8 +1,16 @@
1
1
  import type { MouseEvent } from 'react';
2
+ import type { ResponsiveProp } from '../../hooks/useResponsiveProp';
2
3
  import type { BaseProps, ButtonVariant, ComponentColor, ComponentSize, FamilyIconProps, InputState } from '../interface';
3
4
  type Props = BaseProps & FamilyIconProps & React.ButtonHTMLAttributes<HTMLButtonElement> & {
4
5
  icon: string;
5
6
  size?: ComponentSize;
7
+ /**
8
+ * Size of the icon glyph, forwarded to `DIcon` (e.g. `"1.5rem"`, or a
9
+ * responsive object such as `{ xs: '1rem', lg: '2rem' }`, which follows
10
+ * viewport changes). Without it the glyph follows the button's font size,
11
+ * which changes with `size`.
12
+ */
13
+ iconSize?: string | ResponsiveProp;
6
14
  variant?: ButtonVariant;
7
15
  color?: ComponentColor;
8
16
  state?: InputState;
@@ -14,5 +22,5 @@ type Props = BaseProps & FamilyIconProps & React.ButtonHTMLAttributes<HTMLButton
14
22
  rel?: React.AnchorHTMLAttributes<HTMLAnchorElement>['rel'];
15
23
  onClick?: (event: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
16
24
  };
17
- export default function DButtonIcon({ id, icon, size, className, variant, state, loadingAriaLabel, iconMaterialStyle, disabled, color, loading, href, target, rel, stopPropagationEnabled, style, iconFamilyClass, iconFamilyPrefix, dataAttributes, onClick, 'aria-label': ariaLabelProp, ...rest }: Props): import("react").JSX.Element;
25
+ export default function DButtonIcon({ id, icon, size, iconSize, className, variant, state, loadingAriaLabel, iconMaterialStyle, disabled, color, loading, href, target, rel, stopPropagationEnabled, style, iconFamilyClass, iconFamilyPrefix, dataAttributes, onClick, 'aria-label': ariaLabelProp, ...rest }: Props): import("react").JSX.Element;
18
26
  export {};
@@ -6,16 +6,41 @@ export type DDataStateMessages = {
6
6
  error?: string;
7
7
  retry?: string;
8
8
  };
9
- type DDataStateWrapperProps<T> = {
9
+ type DDataStateWrapperBaseProps = {
10
10
  isLoading: boolean;
11
11
  isError: boolean;
12
- data: T[] | undefined;
13
12
  onRetry?: () => void;
14
13
  messages?: DDataStateMessages;
15
14
  renderLoading?: Renderable;
16
15
  renderEmpty?: Renderable;
17
16
  renderError?: Renderable;
17
+ };
18
+ /** A collection: empty when it has no items. */
19
+ export type DDataStateWrapperListProps<T> = DDataStateWrapperBaseProps & {
20
+ /**
21
+ * A collection; empty when it has no items. For a single resource, pass the
22
+ * object itself: that overload is typed by `DDataStateWrapperSingleProps`.
23
+ */
24
+ data: T[] | undefined;
25
+ /** Receives the array. */
18
26
  children: (data: T[]) => ReactNode;
19
27
  };
20
- export default function DDataStateWrapper<T>({ isLoading, isError, data, onRetry, messages, renderLoading, renderEmpty, renderError, children, }: DDataStateWrapperProps<T>): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
21
- export {};
28
+ /**
29
+ * A single resource (an entity detail, a summary, a config object): empty when
30
+ * it is `null` or `undefined`. The render prop receives the same object.
31
+ */
32
+ export type DDataStateWrapperSingleProps<T> = DDataStateWrapperBaseProps & {
33
+ /** A single resource; empty when it is `null` or `undefined`. */
34
+ data: T | null | undefined;
35
+ /** Receives the object itself. */
36
+ children: (data: T) => ReactNode;
37
+ };
38
+ /**
39
+ * Renders the loading, error, empty or success state of fetched data, in that
40
+ * order of precedence. `data` is either a collection (empty with no items) or a
41
+ * single resource (empty when `null`/`undefined`); `children` gets it back with
42
+ * the same shape.
43
+ */
44
+ declare function DDataStateWrapper<T>(props: DDataStateWrapperListProps<T>): ReactNode;
45
+ declare function DDataStateWrapper<T>(props: DDataStateWrapperSingleProps<T>): ReactNode;
46
+ export default DDataStateWrapper;
@@ -2,5 +2,5 @@ import DDataStateWrapper from './DDataStateWrapper';
2
2
  export { EmptyState } from './components/EmptyState';
3
3
  export { ErrorState } from './components/ErrorState';
4
4
  export { LoadingState } from './components/LoadingState';
5
- export type { DDataStateMessages } from './DDataStateWrapper';
5
+ export type { DDataStateMessages, DDataStateWrapperListProps, DDataStateWrapperSingleProps, } from './DDataStateWrapper';
6
6
  export default DDataStateWrapper;
@@ -7,5 +7,10 @@ export type DErrorBoundaryProps = PropsWithChildren<{
7
7
  resetKeys?: unknown[];
8
8
  onReset?: () => void;
9
9
  onError?: (error: unknown, info: ErrorInfo) => void;
10
+ /** Texts of the default fallback. Ignored when `fallback` is provided. */
11
+ messages?: {
12
+ error?: string;
13
+ retry?: string;
14
+ };
10
15
  }>;
11
- export default function DErrorBoundary({ name, fallback, resetKeys, onReset, onError, children, }: DErrorBoundaryProps): import("react").JSX.Element;
16
+ export default function DErrorBoundary({ name, fallback, resetKeys, onReset, onError, messages, children, }: DErrorBoundaryProps): import("react").JSX.Element;
@@ -2,6 +2,8 @@
2
2
  import { FallbackProps } from 'react-error-boundary';
3
3
  type Props = {
4
4
  resetErrorBoundary: FallbackProps['resetErrorBoundary'];
5
+ message?: string;
6
+ retryMessage?: string;
5
7
  };
6
- export default function DefaultErrorBoundary({ resetErrorBoundary }: Props): import("react").JSX.Element;
8
+ export default function DefaultErrorBoundary({ resetErrorBoundary, message, retryMessage, }: Props): import("react").JSX.Element;
7
9
  export {};
@@ -1,8 +1,17 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { BaseProps, ComponentSize, EndIconProps, FamilyIconProps, StartIconProps } from '../interface';
3
- declare const ForwardedDInput: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "value" | "onChange">, "label" | "invalid" | "value" | "onChange" | "size" | keyof BaseProps | keyof FamilyIconProps | keyof StartIconProps | keyof EndIconProps | "loading" | "hint" | "valid" | "floatingLabel" | "inputStart" | "inputEnd" | "readonly" | "onIconStartClick" | "onIconEndClick"> & BaseProps & FamilyIconProps & StartIconProps & EndIconProps & {
3
+ declare const ForwardedDInput: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "onChange" | "value">, "label" | "onChange" | "invalid" | "value" | "size" | "floatingLabel" | keyof BaseProps | keyof FamilyIconProps | keyof StartIconProps | keyof EndIconProps | "loading" | "hint" | "valid" | "inputStart" | "inputEnd" | "readonly" | "onIconStartClick" | "onIconEndClick"> & BaseProps & FamilyIconProps & StartIconProps & EndIconProps & {
4
4
  value?: string | undefined;
5
- label?: string | undefined;
5
+ /**
6
+ * The label of the control. Any node is accepted, so it can carry a link, an
7
+ * info trigger or other markup — the terms-and-conditions pattern.
8
+ *
9
+ * Text doubles as the control's accessible name. A richer label does not, so
10
+ * pass `aria-label` alongside it; a development-only warning says so when it
11
+ * is missing. A rich label also does not fit `floatingLabel`, whose layout
12
+ * animates a single line of text.
13
+ */
14
+ label?: ReactNode;
6
15
  loading?: boolean | undefined;
7
16
  hint?: string | undefined;
8
17
  size?: ComponentSize | undefined;
@@ -1,12 +1,37 @@
1
- import type { ChangeEvent, ComponentPropsWithoutRef } from 'react';
1
+ import type { ChangeEvent, ComponentPropsWithoutRef, ReactNode } from 'react';
2
2
  import type { BaseProps, InputCheckType } from '../interface';
3
3
  type Props = ComponentPropsWithoutRef<'input'> & BaseProps & {
4
4
  id?: string;
5
5
  type: InputCheckType;
6
6
  name?: string;
7
- label?: string;
7
+ /**
8
+ * The label of the control. Any node is accepted, so it can carry a link, an
9
+ * info trigger or other markup — the terms-and-conditions pattern.
10
+ *
11
+ * Text doubles as the control's accessible name. A richer label does not, so
12
+ * pass `ariaLabel` alongside it; a development-only warning says so when it
13
+ * is missing.
14
+ */
15
+ label?: ReactNode;
16
+ /**
17
+ * Accessible name of the control, needed when `label` is not plain text.
18
+ * Without it the name becomes whatever the label subtree computes to, which
19
+ * for a label carrying a link or an icon reads as the wrong name or as none.
20
+ */
8
21
  ariaLabel?: string;
22
+ /**
23
+ * Checked state of the control.
24
+ *
25
+ * Passed together with `onChange` the control is fully controlled: when the
26
+ * parent rejects a change the DOM snaps back to this value.
27
+ *
28
+ * Passed on its own it is taken as the starting value and the control keeps
29
+ * toggling by itself — the historical behaviour. Prefer `defaultChecked` for
30
+ * that, it says so out loud.
31
+ */
9
32
  checked?: boolean;
33
+ /** Starting checked state for uncontrolled usage. */
34
+ defaultChecked?: boolean;
10
35
  inputClassName?: string;
11
36
  disabled?: boolean;
12
37
  invalid?: boolean;
@@ -17,5 +42,5 @@ type Props = ComponentPropsWithoutRef<'input'> & BaseProps & {
17
42
  value?: string;
18
43
  onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
19
44
  };
20
- export default function DInputCheck({ id: idProp, type, name, label, ariaLabel, checked, disabled, invalid, valid, indeterminate, inputClassName, value, hint, onChange, className, style, dataAttributes, ...props }: Props): import("react").JSX.Element;
45
+ export default function DInputCheck({ id: idProp, type, name, label, ariaLabel, checked, defaultChecked, disabled, invalid, valid, indeterminate, inputClassName, value, hint, onChange, className, style, dataAttributes, ...props }: Props): import("react").JSX.Element;
21
46
  export {};
@@ -1,13 +1,25 @@
1
1
  /// <reference types="react" />
2
2
  type NonDInputProps = {
3
+ /**
4
+ * Current value of the counter.
5
+ *
6
+ * Passed together with `onChange` the counter is fully controlled: when the
7
+ * parent rejects a change the counter snaps back to this value.
8
+ *
9
+ * Passed on its own it is taken as the starting value and the counter keeps
10
+ * counting by itself — the historical behaviour. Prefer `defaultValue` for
11
+ * that, it says so out loud.
12
+ */
3
13
  value?: number;
14
+ /** Starting value for uncontrolled usage; falls back to `minValue`. */
15
+ defaultValue?: number;
4
16
  minValue: number;
5
17
  maxValue: number;
6
18
  onChange?: (value?: number) => void;
7
19
  };
8
- declare const ForwardedDInputCounter: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "value" | "onChange">, "label" | "invalid" | "value" | "onChange" | "size" | keyof import("../interface").BaseProps | keyof import("../interface").FamilyIconProps | keyof import("../interface").StartIconProps | keyof import("../interface").EndIconProps | "loading" | "hint" | "valid" | "floatingLabel" | "inputStart" | "inputEnd" | "readonly" | "onIconStartClick" | "onIconEndClick"> & import("../interface").BaseProps & import("../interface").FamilyIconProps & import("../interface").StartIconProps & import("../interface").EndIconProps & {
20
+ declare const ForwardedDInputCounter: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "onChange" | "value">, "label" | "onChange" | "invalid" | "value" | "size" | "floatingLabel" | keyof import("../interface").BaseProps | keyof import("../interface").FamilyIconProps | keyof import("../interface").StartIconProps | keyof import("../interface").EndIconProps | "loading" | "hint" | "valid" | "inputStart" | "inputEnd" | "readonly" | "onIconStartClick" | "onIconEndClick"> & import("../interface").BaseProps & import("../interface").FamilyIconProps & import("../interface").StartIconProps & import("../interface").EndIconProps & {
9
21
  value?: string | undefined;
10
- label?: string | undefined;
22
+ label?: import("react").ReactNode;
11
23
  loading?: boolean | undefined;
12
24
  hint?: string | undefined;
13
25
  size?: import("../interface").ComponentSize | undefined;
@@ -20,5 +32,5 @@ declare const ForwardedDInputCounter: import("react").ForwardRefExoticComponent<
20
32
  onChange?: ((value: string) => void) | undefined;
21
33
  onIconStartClick?: ((value?: string | undefined) => void) | undefined;
22
34
  onIconEndClick?: ((value?: string | undefined) => void) | undefined;
23
- } & import("react").RefAttributes<HTMLInputElement>, "ref">, "value" | "onChange" | "type" | "validIcon" | "invalidIcon">, keyof NonDInputProps> & NonDInputProps & import("react").RefAttributes<HTMLInputElement>>;
35
+ } & import("react").RefAttributes<HTMLInputElement>, "ref">, "onChange" | "value" | "type" | "validIcon" | "invalidIcon">, keyof NonDInputProps> & NonDInputProps & import("react").RefAttributes<HTMLInputElement>>;
24
36
  export default ForwardedDInputCounter;
@@ -3,12 +3,19 @@ type NonDInputProps = {
3
3
  value?: number;
4
4
  minValue?: number;
5
5
  maxValue?: number;
6
+ /**
7
+ * When `true` (default) a value outside `minValue`/`maxValue` is brought
8
+ * into range on mount, when it changes and on blur, and `onChange` receives
9
+ * the clamped number. When `false` the entered value is kept and the input
10
+ * is marked invalid while it is out of range, unless `invalid` is set.
11
+ */
12
+ clamp?: boolean;
6
13
  currencyCode?: string;
7
14
  onChange?: (value?: number) => void;
8
15
  };
9
- declare const ForwardedDInputCurrency: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "value" | "onChange">, "label" | "invalid" | "value" | "onChange" | "size" | keyof import("../interface").BaseProps | keyof import("../interface").FamilyIconProps | keyof import("../interface").StartIconProps | keyof import("../interface").EndIconProps | "loading" | "hint" | "valid" | "floatingLabel" | "inputStart" | "inputEnd" | "readonly" | "onIconStartClick" | "onIconEndClick"> & import("../interface").BaseProps & import("../interface").FamilyIconProps & import("../interface").StartIconProps & import("../interface").EndIconProps & {
16
+ declare const ForwardedDInputCurrency: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "onChange" | "value">, "label" | "onChange" | "invalid" | "value" | "size" | "floatingLabel" | keyof import("../interface").BaseProps | keyof import("../interface").FamilyIconProps | keyof import("../interface").StartIconProps | keyof import("../interface").EndIconProps | "loading" | "hint" | "valid" | "inputStart" | "inputEnd" | "readonly" | "onIconStartClick" | "onIconEndClick"> & import("../interface").BaseProps & import("../interface").FamilyIconProps & import("../interface").StartIconProps & import("../interface").EndIconProps & {
10
17
  value?: string | undefined;
11
- label?: string | undefined;
18
+ label?: import("react").ReactNode;
12
19
  loading?: boolean | undefined;
13
20
  hint?: string | undefined;
14
21
  size?: import("../interface").ComponentSize | undefined;
@@ -21,5 +28,5 @@ declare const ForwardedDInputCurrency: import("react").ForwardRefExoticComponent
21
28
  onChange?: ((value: string) => void) | undefined;
22
29
  onIconStartClick?: ((value?: string | undefined) => void) | undefined;
23
30
  onIconEndClick?: ((value?: string | undefined) => void) | undefined;
24
- } & import("react").RefAttributes<HTMLInputElement>, "ref">, "value" | "onChange" | "type">, keyof NonDInputProps> & NonDInputProps & import("react").RefAttributes<HTMLInputElement>>;
31
+ } & import("react").RefAttributes<HTMLInputElement>, "ref">, "onChange" | "value" | "type">, keyof NonDInputProps> & NonDInputProps & import("react").RefAttributes<HTMLInputElement>>;
25
32
  export default ForwardedDInputCurrency;
@@ -7,9 +7,18 @@ type OnChangeType = {
7
7
  country: ParsedCountry;
8
8
  isValid: boolean;
9
9
  };
10
- declare const ForwardedDInputPhone: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "pattern" | "value" | "inputMode" | "onChange" | "onWheel" | "type">, "label" | "invalid" | "value" | "onChange" | "size" | keyof BaseProps | keyof FamilyIconProps | keyof EndIconProps | "loading" | "hint" | "valid" | "floatingLabel" | "inputEnd" | "onIconEndClick" | "countrySelectorProps" | "filteredCountries" | "defaultCountry"> & BaseProps & FamilyIconProps & EndIconProps & {
10
+ declare const ForwardedDInputPhone: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "pattern" | "inputMode" | "onChange" | "onWheel" | "value" | "type">, "label" | "onChange" | "invalid" | "value" | "size" | "floatingLabel" | keyof BaseProps | keyof FamilyIconProps | keyof EndIconProps | "loading" | "hint" | "valid" | "inputEnd" | "onIconEndClick" | "countrySelectorProps" | "filteredCountries" | "defaultCountry"> & BaseProps & FamilyIconProps & EndIconProps & {
11
11
  value?: string | undefined;
12
- label?: string | undefined;
12
+ /**
13
+ * The label of the control. Any node is accepted, so it can carry a link, an
14
+ * info trigger or other markup.
15
+ *
16
+ * Text doubles as the control's accessible name. A richer label does not, so
17
+ * pass `aria-label` alongside it; a development-only warning says so when it
18
+ * is missing. A rich label also does not fit `floatingLabel`, whose layout
19
+ * animates a single line of text.
20
+ */
21
+ label?: ReactNode;
13
22
  loading?: boolean | undefined;
14
23
  hint?: string | undefined;
15
24
  size?: ComponentSize | undefined;
@@ -1,8 +1,13 @@
1
- /// <reference types="react" />
1
+ import type { ReactNode } from 'react';
2
2
  import type { BaseProps, FamilyIconProps, PinInputMode, PinInputType } from '../interface';
3
3
  type Props = BaseProps & FamilyIconProps & {
4
4
  id?: string;
5
- label?: string;
5
+ /**
6
+ * Visible label of the group. Each character input carries its own
7
+ * `aria-label`, so this never acts as the accessible name and a non-text
8
+ * label does not warn here the way it does on the other inputs.
9
+ */
10
+ label?: ReactNode;
6
11
  placeholder?: string;
7
12
  type?: PinInputType;
8
13
  disabled?: boolean;
@@ -15,6 +20,11 @@ type Props = BaseProps & FamilyIconProps & {
15
20
  invalid?: boolean;
16
21
  valid?: boolean;
17
22
  onChange?: (value: string) => void;
23
+ /**
24
+ * Accessible name given to every character input, suffixed with its position
25
+ * — "Pin character number 2 of 4". Each input is named on its own, which is
26
+ * why `label` never acts as the accessible name here.
27
+ */
18
28
  'aria-label'?: string;
19
29
  };
20
30
  export default function DInputPin({ id: idProp, label, placeholder, type, disabled, loading, secret, characters, innerInputMode, hint, invalid, valid, className, style, dataAttributes, onChange, 'aria-label': ariaLabel, }: Props): import("react").JSX.Element;
@@ -1,7 +1,20 @@
1
- /// <reference types="react" />
1
+ import type { ReactNode } from 'react';
2
2
  import type { BaseProps } from '../interface';
3
3
  declare const ForwardedDInputRange: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "type">, "label" | "ariaLabel" | keyof BaseProps | "filledValue"> & BaseProps & {
4
- label?: string | undefined;
4
+ /**
5
+ * The label of the control. Any node is accepted, so it can carry a link, an
6
+ * info trigger or other markup.
7
+ *
8
+ * Text doubles as the control's accessible name. A richer label does not, so
9
+ * pass `ariaLabel` alongside it; a development-only warning says so when it
10
+ * is missing.
11
+ */
12
+ label?: ReactNode;
13
+ /**
14
+ * Accessible name of the control, needed when `label` is not plain text.
15
+ * Without it the name becomes whatever the label subtree computes to, which
16
+ * for a label carrying a link or an icon reads as the wrong name or as none.
17
+ */
5
18
  ariaLabel?: string | undefined;
6
19
  filledValue?: boolean | undefined;
7
20
  } & import("react").RefAttributes<HTMLInputElement>>;
@@ -1,4 +1,4 @@
1
- import type { FocusEvent, MouseEvent } from 'react';
1
+ import type { FocusEvent, MouseEvent, ReactNode } from 'react';
2
2
  import type { BaseProps, ComponentSize, EndIconProps, FamilyIconProps, StartIconProps } from '../interface';
3
3
  export type DefaultOption = {
4
4
  value: string | number;
@@ -7,7 +7,22 @@ export type DefaultOption = {
7
7
  export type Props<T> = BaseProps & FamilyIconProps & StartIconProps & EndIconProps & {
8
8
  id?: string;
9
9
  name?: string;
10
- label?: string;
10
+ /**
11
+ * The label of the control. Any node is accepted, so it can carry a link, an
12
+ * info trigger or other markup.
13
+ *
14
+ * Text doubles as the control's accessible name. A richer label does not, so
15
+ * pass `ariaLabel` alongside it; a development-only warning says so when it
16
+ * is missing. A rich label also does not fit `floatingLabel`, whose layout
17
+ * animates a single line of text.
18
+ */
19
+ label?: ReactNode;
20
+ /**
21
+ * Accessible name of the control, needed when `label` is not plain text.
22
+ * Without it the name becomes whatever the label subtree computes to, which
23
+ * for a label carrying a link or an icon reads as the wrong name or as none.
24
+ */
25
+ ariaLabel?: string;
11
26
  disabled?: boolean;
12
27
  loading?: boolean;
13
28
  invalid?: boolean;
@@ -24,4 +39,4 @@ export type Props<T> = BaseProps & FamilyIconProps & StartIconProps & EndIconPro
24
39
  valueExtractor?: (item: T) => string | number;
25
40
  labelExtractor?: (item: T) => string;
26
41
  };
27
- export default function DInputSelect<T extends object = DefaultOption>({ id: idProp, name, label, className, style, options, disabled, loading, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, hint, value, size, floatingLabel, invalid, valid, dataAttributes, valueExtractor, labelExtractor, onChange, onBlur, onIconStartClick, onIconEndClick, }: Props<T>): import("react").JSX.Element;
42
+ export default function DInputSelect<T extends object = DefaultOption>({ id: idProp, name, label, ariaLabel, className, style, options, disabled, loading, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, hint, value, size, floatingLabel, invalid, valid, dataAttributes, valueExtractor, labelExtractor, onChange, onBlur, onIconStartClick, onIconEndClick, }: Props<T>): import("react").JSX.Element;
@@ -1,11 +1,36 @@
1
- /// <reference types="react" />
1
+ import type { ReactNode } from 'react';
2
2
  import type { BaseProps } from '../interface';
3
3
  type Props = BaseProps & {
4
4
  id?: string;
5
- label?: string;
5
+ /**
6
+ * The label of the control. Any node is accepted, so it can carry a link, an
7
+ * info trigger or other markup.
8
+ *
9
+ * Text doubles as the control's accessible name. A richer label does not, so
10
+ * pass `ariaLabel` alongside it; a development-only warning says so when it
11
+ * is missing.
12
+ */
13
+ label?: ReactNode;
14
+ /**
15
+ * Accessible name of the control, needed when `label` is not plain text.
16
+ * Without it the name becomes whatever the label subtree computes to, which
17
+ * for a label carrying a link or an icon reads as the wrong name or as none.
18
+ */
6
19
  ariaLabel?: string;
7
20
  name?: string;
21
+ /**
22
+ * Checked state of the switch.
23
+ *
24
+ * Passed together with `onChange` the switch is fully controlled: when the
25
+ * parent rejects a change the switch snaps back to this value.
26
+ *
27
+ * Passed on its own it is taken as the starting value and the switch keeps
28
+ * toggling by itself — the historical behaviour. Prefer `defaultChecked` for
29
+ * that, it says so out loud.
30
+ */
8
31
  checked?: boolean;
32
+ /** Starting checked state for uncontrolled usage. */
33
+ defaultChecked?: boolean;
9
34
  disabled?: boolean;
10
35
  inputClassName?: string;
11
36
  invalid?: boolean;
@@ -14,5 +39,5 @@ type Props = BaseProps & {
14
39
  readonly?: boolean;
15
40
  onChange?: (isChecked: boolean) => void;
16
41
  };
17
- export default function DInputSwitch({ id: idProp, label, ariaLabel, name, checked, disabled, invalid, valid, hint, readonly, className, style, dataAttributes, inputClassName, onChange, }: Props): import("react").JSX.Element;
42
+ export default function DInputSwitch({ id: idProp, label, ariaLabel, name, checked, defaultChecked, disabled, invalid, valid, hint, readonly, className, style, dataAttributes, inputClassName, onChange, }: Props): import("react").JSX.Element;
18
43
  export {};
@@ -6,8 +6,19 @@ type Props = BaseProps & PropsWithChildren<{
6
6
  numbered?: boolean;
7
7
  flush?: boolean;
8
8
  horizontal?: boolean | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
9
+ /**
10
+ * Accessible name of the list, so screen readers can tell it apart from
11
+ * other lists on the page (e.g. "Recent movements"). Ignored when
12
+ * `ariaLabelledBy` is set.
13
+ */
14
+ ariaLabel?: string;
15
+ /**
16
+ * Id of a visible element that names the list, such as the heading above
17
+ * it. When set, `aria-label` is not rendered.
18
+ */
19
+ ariaLabelledBy?: string;
9
20
  }>;
10
- declare function DListGroup({ as, numbered, flush, horizontal, children, className, style, dataAttributes, }: Props): import("react").JSX.Element;
21
+ declare function DListGroup({ as, numbered, flush, horizontal, ariaLabel, ariaLabelledBy, children, className, style, dataAttributes, }: Props): import("react").JSX.Element;
11
22
  declare const _default: typeof DListGroup & {
12
23
  Item: typeof DListGroupItem;
13
24
  };
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * Element the enclosing `DListGroup` renders, so each `DListGroupItem` can
4
+ * check that its own element is valid content for it. `undefined` outside a
5
+ * `DListGroup`.
6
+ */
7
+ declare const ListGroupContext: import("react").Context<"div" | "ol" | "ul" | undefined>;
8
+ export default ListGroupContext;
@@ -4,10 +4,15 @@ type Props = BaseProps & StartIconProps & EndIconProps & PropsWithChildren<{
4
4
  as?: 'li' | 'a' | 'button';
5
5
  action?: boolean;
6
6
  active?: boolean;
7
+ /**
8
+ * Value of `aria-current` while the item is `active`: `'page'` for the
9
+ * current page of a navigation, `'step'` for the current step of a flow.
10
+ */
11
+ ariaCurrent?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true';
7
12
  disabled?: boolean;
8
13
  href?: string;
9
14
  onClick?: () => void;
10
15
  color?: ComponentColor;
11
16
  }>;
12
- export default function DListGroupItem({ as, action: actionProp, active, disabled, href, onClick, color, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartMaterialStyle, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndMaterialStyle, children, className, style, dataAttributes, }: Props): import("react").JSX.Element;
17
+ export default function DListGroupItem({ as, action: actionProp, active, ariaCurrent, disabled, href, onClick, color, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartMaterialStyle, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndMaterialStyle, children, className, style, dataAttributes, }: Props): import("react").JSX.Element;
13
18
  export {};
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Warns, once per combination and only outside production builds, that a
3
+ * `DListGroupItem` renders an element its `DListGroup` container can't hold.
4
+ *
5
+ * Links and buttons inside a <ul>/<ol> are wrapped in an <li>, so the only
6
+ * invalid pair left is a plain item (an <li>) inside `as="div"`: an <li>
7
+ * outside of any list. It doesn't fail visibly, which is why it's reported.
8
+ *
9
+ * The `process.env.NODE_ENV` guard at the call site is what bundlers
10
+ * constant-fold, so the whole call — and this module — drops out of a
11
+ * consumer's production bundle.
12
+ */
13
+ export default function warnInvalidListMarkup(container: 'div', item: 'li'): void;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import type { ReactNode } from 'react';
2
2
  import type { BaseProps } from '../interface';
3
3
  export type ValidationMessages = {
4
4
  number: string;
@@ -10,7 +10,22 @@ export type ValidationMessages = {
10
10
  export type ValidationCheck = 'uppercase' | 'lowercase' | 'number' | 'specialChar';
11
11
  type Props = BaseProps & {
12
12
  id?: string;
13
- label?: string;
13
+ /**
14
+ * The label of the password field. Any node is accepted, so it can carry a
15
+ * link or an info trigger.
16
+ *
17
+ * Text doubles as the control's accessible name. A richer label does not, so
18
+ * pass `aria-label` alongside it; a development-only warning says so when it
19
+ * is missing.
20
+ */
21
+ label?: ReactNode;
22
+ /**
23
+ * Accessible name of the password field. Spelled as the native attribute
24
+ * because it is forwarded straight to the nested input, which is also the
25
+ * component the development-only naming warning comes from — so the advice it
26
+ * gives names a prop this component accepts.
27
+ */
28
+ 'aria-label'?: string;
14
29
  placeholder?: string;
15
30
  value?: string;
16
31
  name?: string;
@@ -21,5 +36,5 @@ type Props = BaseProps & {
21
36
  onChange?: (value: string) => void;
22
37
  readonly?: boolean;
23
38
  };
24
- export default function DPasswordStrengthMeter({ id, label, placeholder, value, name, disabled, invalid, validationMessages, enabledChecks, className, style, dataAttributes, onChange, readonly, }: Props): import("react").JSX.Element;
39
+ export default function DPasswordStrengthMeter({ id, label, 'aria-label': ariaLabel, placeholder, value, name, disabled, invalid, validationMessages, enabledChecks, className, style, dataAttributes, onChange, readonly, }: Props): import("react").JSX.Element;
25
40
  export {};
@@ -7,6 +7,18 @@ type Props = BaseProps & {
7
7
  hideCurrentValue?: boolean;
8
8
  enableStripedAnimation?: boolean;
9
9
  height?: string | number;
10
+ /**
11
+ * Accessible name of the bar. Describe what progresses (e.g. "Upload
12
+ * progress"), not the role. Defaults to `'Progress bar'` when neither this
13
+ * nor `ariaLabelledBy` is set.
14
+ */
15
+ ariaLabel?: string;
16
+ /**
17
+ * Id of a visible element that names the bar, for a title rendered next to
18
+ * it. When set, `aria-label` is not rendered, so `ariaLabel` and the default
19
+ * name are ignored.
20
+ */
21
+ ariaLabelledBy?: string;
10
22
  };
11
- export default function DProgress({ className, style, currentValue, minValue, maxValue, hideCurrentValue, enableStripedAnimation, height, dataAttributes, }: Props): import("react").JSX.Element;
23
+ export default function DProgress({ className, style, currentValue, minValue, maxValue, hideCurrentValue, enableStripedAnimation, height, ariaLabel, ariaLabelledBy, dataAttributes, }: Props): import("react").JSX.Element;
12
24
  export {};
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import type { ReactNode } from 'react';
2
2
  import type { Props as SelectProps, GroupBase } from 'react-select';
3
3
  import DSelectOptionCheck from './components/DSelectOptionCheck';
4
4
  import DSelectOptionIcon from './components/DSelectOptionIcon';
@@ -13,7 +13,27 @@ import DSelectSingleValueEmojiText from './components/DSelectSingleValueEmojiTex
13
13
  import DSelectPlaceholder from './components/DSelectPlaceholder';
14
14
  import type { BaseProps, EndIconProps, FamilyIconProps, StartIconProps } from '../interface';
15
15
  type Props<Option, IsMulti extends boolean, Group extends GroupBase<Option>> = BaseProps & FamilyIconProps & StartIconProps & EndIconProps & Omit<SelectProps<Option, IsMulti, Group>, 'isDisabled' | 'isClearable' | 'isLoading' | 'isRtl' | 'isSearchable' | 'isMulti'> & {
16
- label?: string;
16
+ /**
17
+ * The label of the control. Any node is accepted, so it can carry a link, an
18
+ * info trigger or other markup.
19
+ *
20
+ * Text doubles as the control's accessible name. A richer label does not, so
21
+ * pass `ariaLabel`, or `aria-labelledby` pointing at a text element, alongside
22
+ * it; a development-only warning says so when both are missing. A rich label
23
+ * also does not fit `floatingLabel`, whose layout animates a single line of
24
+ * text.
25
+ */
26
+ label?: ReactNode;
27
+ /**
28
+ * Accessible name of the control. It outranks the `label` in the accessible
29
+ * name computation, so use it to name a control with a non-text label or to
30
+ * replace the name a text label gives.
31
+ *
32
+ * Without a `label` or an `aria-labelledby` it falls back to a generic
33
+ * string, so an unlabelled select is never nameless. With either there is no
34
+ * fallback: a generic `aria-label` would override the label and make every
35
+ * select announce the same name.
36
+ */
17
37
  ariaLabel?: string;
18
38
  hint?: string;
19
39
  invalid?: boolean;
@@ -29,7 +49,7 @@ type Props<Option, IsMulti extends boolean, Group extends GroupBase<Option>> = B
29
49
  searchable?: SelectProps<Option, IsMulti, Group>['isSearchable'];
30
50
  multi?: SelectProps<Option, IsMulti, Group>['isMulti'];
31
51
  };
32
- declare function DSelect<Option = unknown, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>({ id: idProp, className, style, label, hint, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, invalid, valid, menuWithMaxContent, disabled, clearable, loading, floatingLabel, rtl, searchable, multi, components, defaultValue, placeholder, onIconStartClick, onIconEndClick, dataAttributes, ariaLabel, ...props }: Props<Option, IsMulti, Group>): import("react").JSX.Element;
52
+ declare function DSelect<Option = unknown, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>({ id: idProp, inputId: inputIdProp, className, style, label, hint, iconFamilyClass, iconFamilyPrefix, iconStart, iconStartFamilyClass, iconStartFamilyPrefix, iconStartAriaLabel, iconStartTabIndex, iconEnd, iconEndFamilyClass, iconEndFamilyPrefix, iconEndAriaLabel, iconEndTabIndex, invalid, valid, menuWithMaxContent, disabled, clearable, loading, floatingLabel, rtl, searchable, multi, components, defaultValue, placeholder, onIconStartClick, onIconEndClick, dataAttributes, ariaLabel, ariaLiveMessages, ...props }: Props<Option, IsMulti, Group>): import("react").JSX.Element;
33
53
  declare const _default: typeof DSelect & {
34
54
  OptionCheck: typeof DSelectOptionCheck;
35
55
  OptionIcon: typeof DSelectOptionIcon;
@@ -0,0 +1,21 @@
1
+ import type { AriaGuidanceProps } from 'react-select';
2
+ type Names = {
3
+ /** The `aria-labelledby` that reaches the input, if any. */
4
+ labelledBy?: string;
5
+ /** The text of the visible `label`, if it is text. */
6
+ label?: string;
7
+ };
8
+ /**
9
+ * Builds react-select's `guidance` live message around the control's name.
10
+ *
11
+ * react-select announces "<aria-label> is focused" on the first focus of the
12
+ * input, falling back to "Select" when there is no `aria-label`. Neither a text
13
+ * `label` nor `aria-labelledby` reaches that message, so the announcement would
14
+ * disagree with the name assistive technology exposes.
15
+ *
16
+ * The name follows the accessible name precedence: `aria-labelledby`, then
17
+ * `aria-label`, then the `<label>`. react-select does not export its default
18
+ * messages, so this mirrors them for every context and only swaps the name.
19
+ */
20
+ export default function createAriaGuidance({ labelledBy, label }: Names): ({ "aria-label": ariaLabel, context, isSearchable, isMulti, tabSelectsValue, isInitialFocus, }: AriaGuidanceProps) => string;
21
+ export {};