@carbon/react 1.59.0 → 1.60.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.
Files changed (115) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +813 -813
  2. package/es/_virtual/_rollupPluginBabelHelpers.js +23 -34
  3. package/es/components/Button/ButtonBase.d.ts +1 -1
  4. package/es/components/CheckboxGroup/CheckboxGroup.d.ts +27 -0
  5. package/es/components/CheckboxGroup/CheckboxGroup.js +5 -5
  6. package/es/components/ComboBox/ComboBox.d.ts +6 -0
  7. package/es/components/ComboBox/ComboBox.js +36 -3
  8. package/es/components/ComboButton/index.d.ts +1 -1
  9. package/es/components/ComposedModal/ModalHeader.js +0 -1
  10. package/es/components/DataTable/DataTable.d.ts +3 -0
  11. package/es/components/DataTable/DataTable.js +4 -1
  12. package/es/components/DataTable/TableSelectAll.d.ts +14 -3
  13. package/es/components/DataTable/TableSelectAll.js +10 -3
  14. package/es/components/DataTable/TableSelectRow.d.ts +16 -4
  15. package/es/components/DataTable/TableSelectRow.js +11 -4
  16. package/es/components/DatePicker/DatePicker.d.ts +1 -1
  17. package/es/components/DatePicker/DatePicker.js +0 -1
  18. package/es/components/DatePicker/index.d.ts +2 -2
  19. package/es/components/DatePickerInput/DatePickerInput.d.ts +1 -1
  20. package/es/components/DatePickerInput/index.d.ts +2 -2
  21. package/es/components/FileUploader/FileUploaderItem.js +7 -4
  22. package/es/components/Heading/index.d.ts +1 -1
  23. package/es/components/Link/Link.d.ts +1 -1
  24. package/es/components/ListBox/ListBoxMenu.js +0 -1
  25. package/es/components/Menu/Menu.d.ts +2 -1
  26. package/es/components/Menu/Menu.js +18 -12
  27. package/es/components/MenuButton/index.d.ts +2 -1
  28. package/es/components/MenuButton/index.js +50 -29
  29. package/es/components/MultiSelect/FilterableMultiSelect.js +3 -5
  30. package/es/components/MultiSelect/MultiSelect.js +0 -1
  31. package/es/components/NumberInput/NumberInput.js +1 -0
  32. package/es/components/Pagination/Pagination.js +2 -0
  33. package/es/components/PaginationNav/PaginationNav.js +2 -0
  34. package/es/components/Popover/index.js +0 -1
  35. package/es/components/PrimaryButton/PrimaryButton.d.ts +1 -1
  36. package/es/components/RadioButton/RadioButton.d.ts +2 -2
  37. package/es/components/RadioButton/index.d.ts +2 -1
  38. package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -3
  39. package/es/components/RadioButtonGroup/RadioButtonGroup.js +8 -10
  40. package/es/components/RadioButtonGroup/index.d.ts +2 -1
  41. package/es/components/SecondaryButton/SecondaryButton.d.ts +1 -1
  42. package/es/components/Tabs/Tabs.js +7 -4
  43. package/es/components/Tag/DismissibleTag.d.ts +1 -1
  44. package/es/components/Tag/OperationalTag.d.ts +1 -1
  45. package/es/components/Tag/SelectableTag.d.ts +1 -1
  46. package/es/components/Tag/Tag.d.ts +1 -1
  47. package/es/components/Text/index.d.ts +2 -2
  48. package/es/components/TextArea/TextArea.js +1 -0
  49. package/es/components/Toggletip/index.d.ts +1 -1
  50. package/es/components/Tooltip/DefinitionTooltip.js +22 -1
  51. package/es/components/UIShell/Content.d.ts +4 -7
  52. package/es/components/UIShell/Link.d.ts +1 -1
  53. package/es/components/UIShell/Link.js +1 -0
  54. package/es/components/UIShell/SideNav.js +1 -0
  55. package/es/components/UIShell/SwitcherItem.d.ts +1 -1
  56. package/es/index.js +1 -1
  57. package/es/internal/Selection.js +20 -17
  58. package/es/internal/useId.js +1 -1
  59. package/lib/_virtual/_rollupPluginBabelHelpers.js +23 -34
  60. package/lib/components/Button/ButtonBase.d.ts +1 -1
  61. package/lib/components/CheckboxGroup/CheckboxGroup.d.ts +27 -0
  62. package/lib/components/CheckboxGroup/CheckboxGroup.js +5 -5
  63. package/lib/components/ComboBox/ComboBox.d.ts +6 -0
  64. package/lib/components/ComboBox/ComboBox.js +35 -2
  65. package/lib/components/ComboButton/index.d.ts +1 -1
  66. package/lib/components/ComposedModal/ModalHeader.js +0 -1
  67. package/lib/components/DataTable/DataTable.d.ts +3 -0
  68. package/lib/components/DataTable/DataTable.js +4 -1
  69. package/lib/components/DataTable/TableSelectAll.d.ts +14 -3
  70. package/lib/components/DataTable/TableSelectAll.js +10 -3
  71. package/lib/components/DataTable/TableSelectRow.d.ts +16 -4
  72. package/lib/components/DataTable/TableSelectRow.js +11 -4
  73. package/lib/components/DatePicker/DatePicker.d.ts +1 -1
  74. package/lib/components/DatePicker/DatePicker.js +0 -1
  75. package/lib/components/DatePicker/index.d.ts +2 -2
  76. package/lib/components/DatePickerInput/DatePickerInput.d.ts +1 -1
  77. package/lib/components/DatePickerInput/index.d.ts +2 -2
  78. package/lib/components/FileUploader/FileUploaderItem.js +7 -4
  79. package/lib/components/Heading/index.d.ts +1 -1
  80. package/lib/components/Link/Link.d.ts +1 -1
  81. package/lib/components/ListBox/ListBoxMenu.js +0 -1
  82. package/lib/components/Menu/Menu.d.ts +2 -1
  83. package/lib/components/Menu/Menu.js +18 -12
  84. package/lib/components/MenuButton/index.d.ts +2 -1
  85. package/lib/components/MenuButton/index.js +46 -25
  86. package/lib/components/MultiSelect/FilterableMultiSelect.js +3 -5
  87. package/lib/components/MultiSelect/MultiSelect.js +0 -1
  88. package/lib/components/NumberInput/NumberInput.js +1 -0
  89. package/lib/components/Pagination/Pagination.js +2 -0
  90. package/lib/components/PaginationNav/PaginationNav.js +2 -0
  91. package/lib/components/Popover/index.js +0 -1
  92. package/lib/components/PrimaryButton/PrimaryButton.d.ts +1 -1
  93. package/lib/components/RadioButton/RadioButton.d.ts +2 -2
  94. package/lib/components/RadioButton/index.d.ts +2 -1
  95. package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -3
  96. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +8 -10
  97. package/lib/components/RadioButtonGroup/index.d.ts +2 -1
  98. package/lib/components/SecondaryButton/SecondaryButton.d.ts +1 -1
  99. package/lib/components/Tabs/Tabs.js +7 -4
  100. package/lib/components/Tag/DismissibleTag.d.ts +1 -1
  101. package/lib/components/Tag/OperationalTag.d.ts +1 -1
  102. package/lib/components/Tag/SelectableTag.d.ts +1 -1
  103. package/lib/components/Tag/Tag.d.ts +1 -1
  104. package/lib/components/Text/index.d.ts +2 -2
  105. package/lib/components/TextArea/TextArea.js +1 -0
  106. package/lib/components/Toggletip/index.d.ts +1 -1
  107. package/lib/components/Tooltip/DefinitionTooltip.js +22 -1
  108. package/lib/components/UIShell/Content.d.ts +4 -7
  109. package/lib/components/UIShell/Link.d.ts +1 -1
  110. package/lib/components/UIShell/Link.js +1 -0
  111. package/lib/components/UIShell/SideNav.js +1 -0
  112. package/lib/components/UIShell/SwitcherItem.d.ts +1 -1
  113. package/lib/index.js +2 -2
  114. package/lib/internal/Selection.js +19 -16
  115. package/package.json +10 -9
@@ -5,47 +5,36 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- function _defineProperty(obj, key, value) {
9
- key = _toPropertyKey(key);
10
- if (key in obj) {
11
- Object.defineProperty(obj, key, {
12
- value: value,
13
- enumerable: true,
14
- configurable: true,
15
- writable: true
16
- });
17
- } else {
18
- obj[key] = value;
19
- }
20
- return obj;
8
+ function _defineProperty(e, r, t) {
9
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
10
+ value: t,
11
+ enumerable: !0,
12
+ configurable: !0,
13
+ writable: !0
14
+ }) : e[r] = t, e;
21
15
  }
22
16
  function _extends() {
23
- _extends = Object.assign ? Object.assign.bind() : function (target) {
24
- for (var i = 1; i < arguments.length; i++) {
25
- var source = arguments[i];
26
- for (var key in source) {
27
- if (Object.prototype.hasOwnProperty.call(source, key)) {
28
- target[key] = source[key];
29
- }
30
- }
17
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
18
+ for (var e = 1; e < arguments.length; e++) {
19
+ var t = arguments[e];
20
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
31
21
  }
32
- return target;
33
- };
34
- return _extends.apply(this, arguments);
22
+ return n;
23
+ }, _extends.apply(null, arguments);
35
24
  }
36
- function _toPrimitive(input, hint) {
37
- if (typeof input !== "object" || input === null) return input;
38
- var prim = input[Symbol.toPrimitive];
39
- if (prim !== undefined) {
40
- var res = prim.call(input, hint || "default");
41
- if (typeof res !== "object") return res;
25
+ function _toPrimitive(t, r) {
26
+ if ("object" != typeof t || !t) return t;
27
+ var e = t[Symbol.toPrimitive];
28
+ if (void 0 !== e) {
29
+ var i = e.call(t, r || "default");
30
+ if ("object" != typeof i) return i;
42
31
  throw new TypeError("@@toPrimitive must return a primitive value.");
43
32
  }
44
- return (hint === "string" ? String : Number)(input);
33
+ return ("string" === r ? String : Number)(t);
45
34
  }
46
- function _toPropertyKey(arg) {
47
- var key = _toPrimitive(arg, "string");
48
- return typeof key === "symbol" ? key : String(key);
35
+ function _toPropertyKey(t) {
36
+ var i = _toPrimitive(t, "string");
37
+ return "symbol" == typeof i ? i : i + "";
49
38
  }
50
39
 
51
40
  export { _defineProperty as defineProperty, _extends as extends, _toPrimitive as toPrimitive, _toPropertyKey as toPropertyKey };
@@ -6,5 +6,5 @@
6
6
  */
7
7
  import React from 'react';
8
8
  import { ButtonProps } from './Button';
9
- declare const ButtonBase: React.ForwardRefExoticComponent<Omit<ButtonProps<React.ElementType<any>>, "ref"> & React.RefAttributes<unknown>>;
9
+ declare const ButtonBase: React.ForwardRefExoticComponent<Omit<ButtonProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<unknown>>;
10
10
  export default ButtonBase;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import React, { ReactNode } from 'react';
8
+ export interface CheckboxGroupProps {
9
+ children?: ReactNode;
10
+ className?: string;
11
+ helperText?: ReactNode;
12
+ invalid?: boolean;
13
+ invalidText?: ReactNode;
14
+ legendId?: ReactNode;
15
+ orientation?: 'horizontal' | 'vertical';
16
+ legendText: ReactNode;
17
+ readOnly?: boolean;
18
+ slug?: ReactNode;
19
+ warn?: boolean;
20
+ warnText?: ReactNode;
21
+ }
22
+ export interface CustomType {
23
+ size: string;
24
+ kind: string;
25
+ }
26
+ declare const CheckboxGroup: React.FC<CheckboxGroupProps>;
27
+ export default CheckboxGroup;
@@ -14,7 +14,7 @@ import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
14
14
  import setupGetInstanceId from '../../tools/setupGetInstanceId.js';
15
15
 
16
16
  const getInstanceId = setupGetInstanceId();
17
- function CheckboxGroup(_ref) {
17
+ const CheckboxGroup = _ref => {
18
18
  let {
19
19
  children,
20
20
  className,
@@ -49,7 +49,7 @@ function CheckboxGroup(_ref) {
49
49
 
50
50
  // Slug is always size `mini`
51
51
  let normalizedSlug;
52
- if (slug && slug['type']?.displayName === 'Slug') {
52
+ if ( /*#__PURE__*/React__default.isValidElement(slug) && slug['type']?.displayName === 'Slug') {
53
53
  normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
54
54
  size: 'mini',
55
55
  kind: 'default'
@@ -60,7 +60,6 @@ function CheckboxGroup(_ref) {
60
60
  "data-invalid": invalid ? true : undefined,
61
61
  "aria-labelledby": rest['aria-labelledby'] || legendId,
62
62
  "aria-readonly": readOnly,
63
- orientation: "vertical",
64
63
  "aria-describedby": !invalid && !warn && helper ? helperId : undefined
65
64
  }, rest), /*#__PURE__*/React__default.createElement("legend", {
66
65
  className: `${prefix}--label`,
@@ -76,7 +75,7 @@ function CheckboxGroup(_ref) {
76
75
  }), /*#__PURE__*/React__default.createElement("div", {
77
76
  className: `${prefix}--form-requirement`
78
77
  }, warnText))), showHelper && helper);
79
- }
78
+ };
80
79
  CheckboxGroup.propTypes = {
81
80
  /**
82
81
  * Provide the children form elements to be rendered inside of the <fieldset>
@@ -128,5 +127,6 @@ CheckboxGroup.propTypes = {
128
127
  */
129
128
  warnText: PropTypes.node
130
129
  };
130
+ var CheckboxGroup$1 = CheckboxGroup;
131
131
 
132
- export { CheckboxGroup as default };
132
+ export { CheckboxGroup$1 as default };
@@ -29,6 +29,12 @@ export interface ComboBoxProps<ItemType> extends Omit<InputHTMLAttributes<HTMLIn
29
29
  * 'aria-label' of the ListBox component.
30
30
  */
31
31
  ariaLabel?: string;
32
+ /**
33
+ * **Experimental**: Will attempt to automatically align the floating
34
+ * element to avoid collisions with the viewport and being clipped by
35
+ * ancestor elements.
36
+ */
37
+ autoAlign?: boolean;
32
38
  /**
33
39
  * An optional className to add to the container node
34
40
  */
@@ -9,7 +9,7 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
9
9
  import cx from 'classnames';
10
10
  import { useCombobox } from 'downshift';
11
11
  import PropTypes from 'prop-types';
12
- import React__default, { forwardRef, useContext, useRef, useState, useEffect } from 'react';
12
+ import React__default, { forwardRef, useEffect, useContext, useRef, useState } from 'react';
13
13
  import '../Text/index.js';
14
14
  import { WarningFilled, WarningAltFilled, Checkmark } from '@carbon/icons-react';
15
15
  import ListBox from '../ListBox/index.js';
@@ -19,6 +19,7 @@ import deprecate from '../../prop-types/deprecate.js';
19
19
  import { usePrefix } from '../../internal/usePrefix.js';
20
20
  import '../FluidForm/FluidForm.js';
21
21
  import { FormContext } from '../FluidForm/FormContext.js';
22
+ import { useFloating, flip, autoUpdate } from '@floating-ui/react';
22
23
  import { Text } from '../Text/Text.js';
23
24
  import { match } from '../../internal/keyboard/match.js';
24
25
  import ListBoxSelection from '../ListBox/next/ListBoxSelection.js';
@@ -86,6 +87,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
86
87
  const {
87
88
  ['aria-label']: ariaLabel = 'Choose an item',
88
89
  ariaLabel: deprecatedAriaLabel,
90
+ autoAlign = false,
89
91
  className: containerClassName,
90
92
  direction = 'bottom',
91
93
  disabled = false,
@@ -115,6 +117,28 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
115
117
  slug,
116
118
  ...rest
117
119
  } = props;
120
+ const {
121
+ refs,
122
+ floatingStyles
123
+ } = useFloating(autoAlign ? {
124
+ placement: direction,
125
+ strategy: 'fixed',
126
+ middleware: [flip()],
127
+ whileElementsMounted: autoUpdate
128
+ } : {});
129
+ const parentWidth = refs?.reference?.current?.clientWidth;
130
+ useEffect(() => {
131
+ if (autoAlign) {
132
+ Object.keys(floatingStyles).forEach(style => {
133
+ if (refs.floating.current) {
134
+ refs.floating.current.style[style] = floatingStyles[style];
135
+ }
136
+ });
137
+ if (parentWidth && refs.floating.current) {
138
+ refs.floating.current.style.width = parentWidth + 'px';
139
+ }
140
+ }
141
+ }, [autoAlign, floatingStyles, refs.floating, parentWidth]);
118
142
  const prefix = usePrefix();
119
143
  const {
120
144
  isFluid
@@ -369,6 +393,7 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
369
393
  light: light,
370
394
  size: size,
371
395
  warn: warn,
396
+ ref: refs.setReference,
372
397
  warnText: warnText,
373
398
  warnTextId: warnTextId
374
399
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -379,9 +404,9 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
379
404
  type: "text",
380
405
  tabIndex: 0,
381
406
  "aria-haspopup": "listbox",
382
- "aria-owns": getMenuProps().id,
383
407
  title: textInput?.current?.value
384
408
  }, getInputProps({
409
+ 'aria-controls': isOpen ? undefined : getMenuProps().id,
385
410
  placeholder,
386
411
  ref: {
387
412
  ...mergeRefs(textInput, ref)
@@ -443,8 +468,10 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
443
468
  // @ts-expect-error
444
469
  isOpen: isOpen,
445
470
  translateWithId: translateWithId
446
- }))), normalizedSlug, /*#__PURE__*/React__default.createElement(ListBox.Menu, getMenuProps({
471
+ }))), normalizedSlug, /*#__PURE__*/React__default.createElement(ListBox.Menu, _extends({}, getMenuProps({
447
472
  'aria-label': deprecatedAriaLabel || ariaLabel
473
+ }), {
474
+ ref: mergeRefs(getMenuProps().ref, refs.setFloating)
448
475
  }), isOpen ? filterItems(items, itemToString, inputValue).map((item, index) => {
449
476
  const isObject = item !== null && typeof item === 'object';
450
477
  const title = isObject && 'text' in item && itemToElement ? item.text?.toString() : itemToString(item);
@@ -498,6 +525,12 @@ ComboBox.propTypes = {
498
525
  * 'aria-label' of the ListBox component.
499
526
  */
500
527
  ariaLabel: deprecate(PropTypes.string, 'This prop syntax has been deprecated. Please use the new `aria-label`.'),
528
+ /**
529
+ * **Experimental**: Will attempt to automatically align the floating
530
+ * element to avoid collisions with the viewport and being clipped by
531
+ * ancestor elements.
532
+ */
533
+ autoAlign: PropTypes.bool,
501
534
  /**
502
535
  * An optional className to add to the container node
503
536
  */
@@ -8,7 +8,7 @@ import React from 'react';
8
8
  import { IconButton } from '../IconButton';
9
9
  import Button from '../Button';
10
10
  import { Menu } from '../Menu';
11
- export type MenuAlignment = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end';
11
+ import { MenuAlignment } from '../MenuButton';
12
12
  interface ComboButtonProps {
13
13
  /**
14
14
  * A collection of `MenuItems` to be rendered as additional actions for this `ComboButton`.
@@ -52,7 +52,6 @@ const ModalHeader = /*#__PURE__*/React__default.forwardRef(function ModalHeader(
52
52
  className: closeClass,
53
53
  label: iconDescription,
54
54
  onClick: handleCloseButtonClick,
55
- title: iconDescription,
56
55
  "aria-label": iconDescription,
57
56
  align: "left"
58
57
  }, /*#__PURE__*/React__default.createElement(Close, {
@@ -115,6 +115,7 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
115
115
  [key: string]: unknown;
116
116
  }) => {
117
117
  ariaLabel: string;
118
+ 'aria-label': string;
118
119
  checked: boolean | undefined;
119
120
  disabled?: boolean | undefined;
120
121
  id: string;
@@ -436,10 +437,12 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
436
437
  id: string;
437
438
  name: string;
438
439
  ariaLabel: string;
440
+ 'aria-label': string;
439
441
  disabled: boolean | undefined;
440
442
  radio: true | null;
441
443
  } | {
442
444
  ariaLabel: string;
445
+ 'aria-label': string;
443
446
  checked: boolean;
444
447
  id: string;
445
448
  indeterminate: boolean;
@@ -256,6 +256,8 @@ class DataTable extends React__default.Component {
256
256
  id: `${_this.getTablePrefix()}__select-row-${row.id}`,
257
257
  name: `select-row`,
258
258
  ariaLabel: t(translationKey),
259
+ // TODO remove in v12
260
+ 'aria-label': t(translationKey),
259
261
  disabled: row.disabled,
260
262
  radio: _this.props.radio || null
261
263
  };
@@ -271,6 +273,8 @@ class DataTable extends React__default.Component {
271
273
  return {
272
274
  ...rest,
273
275
  ariaLabel: t(translationKey),
276
+ // TODO remove in v12
277
+ 'aria-label': t(translationKey),
274
278
  checked,
275
279
  id: `${_this.getTablePrefix()}__select-all`,
276
280
  indeterminate,
@@ -569,7 +573,6 @@ class DataTable extends React__default.Component {
569
573
  ...getDerivedStateFromProps(_props, {}),
570
574
  isExpandedAll: false // Start with collapsed state, treat `undefined` as neutral state
571
575
  };
572
-
573
576
  this.instanceId = getInstanceId();
574
577
  }
575
578
 
@@ -9,8 +9,14 @@ import React from 'react';
9
9
  interface TableSelectAllProps {
10
10
  /**
11
11
  * Specify the aria label for the underlying input control
12
+ * node
12
13
  */
13
- ariaLabel: string;
14
+ ['aria-label']?: string;
15
+ /**
16
+ * @deprecated please use `aria-label` instead.
17
+ * Specify the aria label for the underlying input control
18
+ */
19
+ ariaLabel?: string;
14
20
  /**
15
21
  * Specify whether all items are selected, or not
16
22
  */
@@ -41,12 +47,17 @@ interface TableSelectAllProps {
41
47
  onSelect: React.MouseEventHandler<HTMLInputElement>;
42
48
  }
43
49
  declare const TableSelectAll: {
44
- ({ ariaLabel, checked, id, indeterminate, name, onSelect, disabled, className, }: TableSelectAllProps): import("react/jsx-runtime").JSX.Element;
50
+ ({ ariaLabel: deprecatedAriaLabel, ["aria-label"]: ariaLabel, checked, id, indeterminate, name, onSelect, disabled, className, }: TableSelectAllProps): import("react/jsx-runtime").JSX.Element;
45
51
  propTypes: {
46
52
  /**
47
53
  * Specify the aria label for the underlying input control
48
54
  */
49
- ariaLabel: PropTypes.Validator<string>;
55
+ "aria-label": PropTypes.Requireable<string>;
56
+ /**
57
+ * Deprecated, please use `aria-label` instead.
58
+ * Specify the aria label for the underlying input control
59
+ */
60
+ ariaLabel: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
50
61
  /**
51
62
  * Specify whether all items are selected, or not
52
63
  */
@@ -10,10 +10,12 @@ import React__default from 'react';
10
10
  import InlineCheckbox from '../InlineCheckbox/InlineCheckbox.js';
11
11
  import cx from 'classnames';
12
12
  import { usePrefix } from '../../internal/usePrefix.js';
13
+ import deprecate from '../../prop-types/deprecate.js';
13
14
 
14
15
  const TableSelectAll = _ref => {
15
16
  let {
16
- ariaLabel = 'Select all rows in the table',
17
+ ariaLabel: deprecatedAriaLabel = 'Select all rows in the table',
18
+ ['aria-label']: ariaLabel,
17
19
  checked,
18
20
  id,
19
21
  indeterminate,
@@ -28,7 +30,7 @@ const TableSelectAll = _ref => {
28
30
  scope: "col",
29
31
  className: cx(`${prefix}--table-column-checkbox`, className)
30
32
  }, /*#__PURE__*/React__default.createElement(InlineCheckbox, {
31
- "aria-label": ariaLabel,
33
+ "aria-label": ariaLabel || deprecatedAriaLabel,
32
34
  checked: checked,
33
35
  id: id,
34
36
  indeterminate: indeterminate,
@@ -41,7 +43,12 @@ TableSelectAll.propTypes = {
41
43
  /**
42
44
  * Specify the aria label for the underlying input control
43
45
  */
44
- ariaLabel: PropTypes.string.isRequired,
46
+ ['aria-label']: PropTypes.string,
47
+ /**
48
+ * Deprecated, please use `aria-label` instead.
49
+ * Specify the aria label for the underlying input control
50
+ */
51
+ ariaLabel: deprecate(PropTypes.string, 'This prop syntax has been deprecated. Please use the new `aria-label`.'),
45
52
  /**
46
53
  * Specify whether all items are selected, or not
47
54
  */
@@ -8,9 +8,16 @@ import PropTypes from 'prop-types';
8
8
  import React from 'react';
9
9
  export interface TableSelectRowProps {
10
10
  /**
11
- * Specify the aria label for the underlying input control
11
+ * Specify a label to be read by screen readers on the containing textbox
12
+ * node
12
13
  */
13
- ariaLabel: string;
14
+ ['aria-label']?: string;
15
+ /**
16
+ * @deprecated please use `aria-label` instead.
17
+ * Specify a label to be read by screen readers on the containing textbox
18
+ * node
19
+ */
20
+ ariaLabel?: string;
14
21
  /**
15
22
  * Specify whether this row is selected, or not
16
23
  */
@@ -45,12 +52,17 @@ export interface TableSelectRowProps {
45
52
  radio?: boolean;
46
53
  }
47
54
  declare const TableSelectRow: {
48
- ({ ariaLabel, checked, id, name, onSelect, onChange, disabled, radio, className, }: TableSelectRowProps): import("react/jsx-runtime").JSX.Element;
55
+ ({ ariaLabel: deprecatedAriaLabel, ["aria-label"]: ariaLabel, checked, id, name, onSelect, onChange, disabled, radio, className, }: TableSelectRowProps): import("react/jsx-runtime").JSX.Element;
49
56
  propTypes: {
50
57
  /**
51
58
  * Specify the aria label for the underlying input control
52
59
  */
53
- ariaLabel: PropTypes.Validator<string>;
60
+ "aria-label": PropTypes.Requireable<string>;
61
+ /**
62
+ * Deprecated, please use `aria-label` instead.
63
+ * Specify the aria label for the underlying input control
64
+ */
65
+ ariaLabel: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
54
66
  /**
55
67
  * Specify whether this row is selected, or not
56
68
  */
@@ -12,10 +12,12 @@ import cx from 'classnames';
12
12
  import InlineCheckbox from '../InlineCheckbox/InlineCheckbox.js';
13
13
  import RadioButton from '../RadioButton/RadioButton.js';
14
14
  import { usePrefix } from '../../internal/usePrefix.js';
15
+ import deprecate from '../../prop-types/deprecate.js';
15
16
 
16
17
  const TableSelectRow = _ref => {
17
18
  let {
18
- ariaLabel,
19
+ ariaLabel: deprecatedAriaLabel,
20
+ ['aria-label']: ariaLabel,
19
21
  checked,
20
22
  id,
21
23
  name,
@@ -45,17 +47,22 @@ const TableSelectRow = _ref => {
45
47
  className: tableSelectRowClasses,
46
48
  "aria-live": "off"
47
49
  }, /*#__PURE__*/React__default.createElement(InlineInputComponent, _extends({}, selectionInputProps, radio && {
48
- labelText: ariaLabel,
50
+ labelText: ariaLabel || deprecatedAriaLabel,
49
51
  hideLabel: true
50
52
  }, !radio && {
51
- ['aria-label']: ariaLabel
53
+ 'aria-label': ariaLabel || deprecatedAriaLabel
52
54
  })));
53
55
  };
54
56
  TableSelectRow.propTypes = {
55
57
  /**
56
58
  * Specify the aria label for the underlying input control
57
59
  */
58
- ariaLabel: PropTypes.string.isRequired,
60
+ ['aria-label']: PropTypes.string,
61
+ /**
62
+ * Deprecated, please use `aria-label` instead.
63
+ * Specify the aria label for the underlying input control
64
+ */
65
+ ariaLabel: deprecate(PropTypes.string, 'This prop syntax has been deprecated. Please use the new `aria-label`.'),
59
66
  /**
60
67
  * Specify whether this row is selected, or not
61
68
  */
@@ -20,7 +20,7 @@ export type CalRef = {
20
20
  plugins: [];
21
21
  clickOpens: any;
22
22
  };
23
- interface DatePickerProps {
23
+ export interface DatePickerProps {
24
24
  /**
25
25
  * Flatpickr prop passthrough enables direct date input, and when set to false,
26
26
  * we must clear dates manually by resetting the value prop to empty string making it a controlled input.
@@ -705,7 +705,6 @@ DatePicker.propTypes = {
705
705
  // Mandarin Traditional
706
706
  'zh' // Mandarin
707
707
  ])]),
708
-
709
708
  /**
710
709
  * The maximum date that a user can pick to.
711
710
  */
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import DatePicker from './DatePicker';
7
+ import DatePicker, { type DatePickerProps } from './DatePicker';
8
8
  export { default as DatePickerSkeleton, type DatePickerSkeletonProps, } from './DatePicker.Skeleton';
9
9
  export default DatePicker;
10
- export { DatePicker };
10
+ export { DatePicker, type DatePickerProps };
@@ -10,7 +10,7 @@ import { ReactAttr } from '../../types/common';
10
10
  type ExcludedAttributes = 'value' | 'onChange' | 'locale' | 'children';
11
11
  export type ReactNodeLike = ReactElementLike | ReactNodeArray | string | number | boolean | null | undefined;
12
12
  export type func = (...args: any[]) => any;
13
- interface DatePickerInputProps extends Omit<ReactAttr<HTMLInputElement>, ExcludedAttributes> {
13
+ export interface DatePickerInputProps extends Omit<ReactAttr<HTMLInputElement>, ExcludedAttributes> {
14
14
  /**
15
15
  * The type of the date picker:
16
16
  *
@@ -4,6 +4,6 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import DatePickerInput from './DatePickerInput';
7
+ import DatePickerInput, { type DatePickerInputProps } from './DatePickerInput';
8
8
  export default DatePickerInput;
9
- export { DatePickerInput };
9
+ export { DatePickerInput, type DatePickerInputProps };
@@ -45,6 +45,9 @@ function FileUploaderItem(_ref) {
45
45
  [`${prefix}--file__selected-file--sm`]: size === 'sm'
46
46
  });
47
47
  const isInvalid = invalid ? `${prefix}--file-filename-container-wrap-invalid` : `${prefix}--file-filename-container-wrap`;
48
+ const filterSpaceName = name => {
49
+ return name?.replace(/\s+/g, '');
50
+ };
48
51
  const isEllipsisActive = element => {
49
52
  setIsEllipsisApplied(element.offsetWidth < element.scrollWidth);
50
53
  return element.offsetWidth < element.scrollWidth;
@@ -68,12 +71,12 @@ function FileUploaderItem(_ref) {
68
71
  as: "p",
69
72
  title: name,
70
73
  className: `${prefix}--file-filename-button`,
71
- id: name
74
+ id: filterSpaceName(name)
72
75
  }, name)))) : /*#__PURE__*/React__default.createElement(Text, {
73
76
  as: "p",
74
77
  title: name,
75
78
  className: `${prefix}--file-filename`,
76
- id: name
79
+ id: filterSpaceName(name)
77
80
  }, name), /*#__PURE__*/React__default.createElement("div", {
78
81
  className: `${prefix}--file-container-item`
79
82
  }, /*#__PURE__*/React__default.createElement("span", {
@@ -83,7 +86,7 @@ function FileUploaderItem(_ref) {
83
86
  iconDescription: iconDescription,
84
87
  status: status,
85
88
  invalid: invalid,
86
- "aria-describedby": `${name}-id-error`,
89
+ "aria-describedby": invalid && errorSubject ? `${filterSpaceName(name)}-id-error` : undefined,
87
90
  onKeyDown: evt => {
88
91
  if (matches(evt, [Enter, Space])) {
89
92
  if (status === 'edit') {
@@ -104,7 +107,7 @@ function FileUploaderItem(_ref) {
104
107
  }))), invalid && errorSubject && /*#__PURE__*/React__default.createElement("div", {
105
108
  className: `${prefix}--form-requirement`,
106
109
  role: "alert",
107
- id: `${name}-id-error`
110
+ id: `${filterSpaceName(name)}-id-error`
108
111
  }, /*#__PURE__*/React__default.createElement(Text, {
109
112
  as: "div",
110
113
  className: `${prefix}--form-requirement__title`
@@ -11,6 +11,6 @@ type SectionBaseProps = {
11
11
  level?: HeadingLevel;
12
12
  };
13
13
  type SectionProps<E extends ElementType> = PolymorphicProps<E, SectionBaseProps>;
14
- export declare const Section: React.ForwardRefExoticComponent<Omit<SectionProps<React.ElementType<any>>, "ref"> & React.RefAttributes<unknown>>;
14
+ export declare const Section: React.ForwardRefExoticComponent<Omit<SectionProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<unknown>>;
15
15
  export declare const Heading: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
16
16
  export {};
@@ -49,5 +49,5 @@ export interface LinkBaseProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
49
49
  visited?: boolean;
50
50
  }
51
51
  export type LinkProps<E extends ElementType> = PolymorphicProps<E, LinkBaseProps>;
52
- declare const Link: React.ForwardRefExoticComponent<Omit<LinkProps<React.ElementType<any>>, "ref"> & React.RefAttributes<unknown>>;
52
+ declare const Link: React.ForwardRefExoticComponent<Omit<LinkProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<unknown>>;
53
53
  export default Link;
@@ -44,7 +44,6 @@ ListBoxMenu.propTypes = {
44
44
  type: PropTypes.oneOf([ListBoxMenuItem])
45
45
  }), PropTypes.bool // used in Dropdown for closed state
46
46
  ]),
47
-
48
47
  /**
49
48
  * Specify a custom `id`
50
49
  */
@@ -53,7 +53,7 @@ interface MenuProps extends React.HTMLAttributes<HTMLUListElement> {
53
53
  /**
54
54
  * Specify a DOM node where the Menu should be rendered in. Defaults to document.body.
55
55
  */
56
- target?: HTMLElement;
56
+ target?: Element;
57
57
  /**
58
58
  * Specify the x position of the Menu. Either pass a single number or an array with two numbers describing your activator's boundaries ([x1, x2])
59
59
  */
@@ -62,6 +62,7 @@ interface MenuProps extends React.HTMLAttributes<HTMLUListElement> {
62
62
  * Specify the y position of the Menu. Either pass a single number or an array with two numbers describing your activator's boundaries ([y1, y2])
63
63
  */
64
64
  y?: number | [number, number];
65
+ legacyAutoalign?: boolean;
65
66
  }
66
67
  declare const Menu: React.ForwardRefExoticComponent<MenuProps & React.RefAttributes<HTMLUListElement>>;
67
68
  export { Menu };