@carbon/react 1.24.0 → 1.25.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 (131) hide show
  1. package/es/components/CodeSnippet/CodeSnippet.js +13 -115
  2. package/es/components/ComboBox/ComboBox.d.ts +6 -0
  3. package/es/components/ComboBox/ComboBox.js +19 -172
  4. package/es/components/ComboButton/index.js +164 -0
  5. package/es/components/ComposedModal/ComposedModal.js +1 -2
  6. package/es/components/DataTable/TableToolbar.d.ts +19 -0
  7. package/es/components/DataTable/TableToolbar.js +1 -1
  8. package/es/components/DataTable/TableToolbarAction.d.ts +21 -0
  9. package/es/components/DataTable/TableToolbarContent.d.ts +21 -0
  10. package/es/components/DataTable/TableToolbarMenu.d.ts +24 -0
  11. package/es/components/DataTable/TableToolbarMenu.js +3 -3
  12. package/es/components/DataTable/tools/sorting.js +2 -1
  13. package/es/components/DataTableSkeleton/DataTableSkeleton.d.ts +107 -0
  14. package/es/components/Dropdown/Dropdown.d.ts +6 -0
  15. package/es/components/Dropdown/Dropdown.js +8 -145
  16. package/es/components/FileUploader/FileUploader.js +1 -1
  17. package/es/components/FileUploader/FileUploaderDropContainer.js +30 -18
  18. package/es/components/FileUploader/FileUploaderItem.js +2 -1
  19. package/es/components/FileUploader/Filename.js +8 -2
  20. package/es/components/FluidTextArea/FluidTextArea.js +12 -1
  21. package/es/components/IconButton/index.js +1 -0
  22. package/es/components/ListBox/ListBoxSelection.js +4 -23
  23. package/es/components/ListBox/next/ListBoxSelection.js +2 -23
  24. package/es/components/Menu/Menu.js +50 -29
  25. package/es/components/Menu/MenuItem.js +1 -0
  26. package/es/components/MenuButton/index.js +127 -0
  27. package/es/components/Modal/Modal.js +4 -3
  28. package/es/components/MultiSelect/FilterableMultiSelect.js +31 -137
  29. package/es/components/MultiSelect/MultiSelect.d.ts +1 -1
  30. package/es/components/MultiSelect/MultiSelect.js +48 -26
  31. package/es/components/Notification/Notification.js +27 -264
  32. package/es/components/OverflowMenu/OverflowMenu.js +13 -139
  33. package/es/components/OverflowMenuItem/OverflowMenuItem.d.ts +58 -0
  34. package/es/components/OverflowMenuItem/OverflowMenuItem.js +12 -7
  35. package/es/components/OverflowMenuV2/index.js +15 -51
  36. package/es/components/Popover/index.d.ts +5 -1
  37. package/es/components/Popover/index.js +37 -9
  38. package/es/components/RadioButtonGroup/RadioButtonGroup.js +7 -4
  39. package/es/components/RadioTile/RadioTile.js +6 -6
  40. package/es/components/Select/Select.d.ts +89 -0
  41. package/es/components/SelectItem/SelectItem.d.ts +62 -0
  42. package/es/components/SelectItem/SelectItem.js +2 -4
  43. package/es/components/SelectItemGroup/SelectItemGroup.d.ts +52 -0
  44. package/es/components/SkeletonText/SkeletonText.js +1 -1
  45. package/es/components/StructuredList/StructuredList.js +10 -38
  46. package/es/components/Tabs/Tabs.js +3 -1
  47. package/es/components/TextArea/TextArea.Skeleton.d.ts +33 -0
  48. package/es/components/TextArea/TextArea.Skeleton.js +5 -5
  49. package/es/components/TextArea/TextArea.d.ts +9 -2
  50. package/es/components/TextArea/TextArea.js +31 -8
  51. package/es/components/TextArea/index.js +1 -0
  52. package/es/components/Toggle/Toggle.js +8 -19
  53. package/es/components/Tooltip/DefinitionTooltip.d.ts +52 -0
  54. package/es/components/Tooltip/DefinitionTooltip.js +2 -2
  55. package/es/components/Tooltip/Tooltip.d.ts +117 -0
  56. package/es/components/Tooltip/Tooltip.js +6 -4
  57. package/es/components/Tooltip/index.d.ts +9 -0
  58. package/es/index.d.ts +2 -0
  59. package/es/index.js +5 -3
  60. package/es/internal/ClickListener.js +1 -2
  61. package/es/internal/keyboard/match.js +1 -1
  62. package/es/internal/useAttachedMenu.js +85 -0
  63. package/es/internal/useDelayedState.d.ts +19 -0
  64. package/es/internal/useDelayedState.js +7 -3
  65. package/es/internal/useId.js +1 -1
  66. package/lib/components/CodeSnippet/CodeSnippet.js +13 -115
  67. package/lib/components/ComboBox/ComboBox.d.ts +6 -0
  68. package/lib/components/ComboBox/ComboBox.js +18 -171
  69. package/lib/components/ComboButton/index.js +174 -0
  70. package/lib/components/ComposedModal/ComposedModal.js +1 -2
  71. package/lib/components/DataTable/TableToolbar.d.ts +19 -0
  72. package/lib/components/DataTable/TableToolbar.js +1 -1
  73. package/lib/components/DataTable/TableToolbarAction.d.ts +21 -0
  74. package/lib/components/DataTable/TableToolbarContent.d.ts +21 -0
  75. package/lib/components/DataTable/TableToolbarMenu.d.ts +24 -0
  76. package/lib/components/DataTable/TableToolbarMenu.js +3 -3
  77. package/lib/components/DataTable/tools/sorting.js +2 -1
  78. package/lib/components/DataTableSkeleton/DataTableSkeleton.d.ts +107 -0
  79. package/lib/components/Dropdown/Dropdown.d.ts +6 -0
  80. package/lib/components/Dropdown/Dropdown.js +7 -144
  81. package/lib/components/FileUploader/FileUploader.js +1 -1
  82. package/lib/components/FileUploader/FileUploaderDropContainer.js +30 -18
  83. package/lib/components/FileUploader/FileUploaderItem.js +2 -1
  84. package/lib/components/FileUploader/Filename.js +8 -2
  85. package/lib/components/FluidTextArea/FluidTextArea.js +12 -1
  86. package/lib/components/IconButton/index.js +1 -0
  87. package/lib/components/ListBox/ListBoxSelection.js +4 -23
  88. package/lib/components/ListBox/next/ListBoxSelection.js +2 -23
  89. package/lib/components/Menu/Menu.js +50 -29
  90. package/lib/components/Menu/MenuItem.js +1 -0
  91. package/lib/components/MenuButton/index.js +137 -0
  92. package/lib/components/Modal/Modal.js +4 -3
  93. package/lib/components/MultiSelect/FilterableMultiSelect.js +29 -135
  94. package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
  95. package/lib/components/MultiSelect/MultiSelect.js +47 -25
  96. package/lib/components/Notification/Notification.js +27 -264
  97. package/lib/components/OverflowMenu/OverflowMenu.js +13 -139
  98. package/lib/components/OverflowMenuItem/OverflowMenuItem.d.ts +58 -0
  99. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +12 -7
  100. package/lib/components/OverflowMenuV2/index.js +13 -49
  101. package/lib/components/Popover/index.d.ts +5 -1
  102. package/lib/components/Popover/index.js +37 -9
  103. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +6 -3
  104. package/lib/components/RadioTile/RadioTile.js +6 -6
  105. package/lib/components/Select/Select.d.ts +89 -0
  106. package/lib/components/SelectItem/SelectItem.d.ts +62 -0
  107. package/lib/components/SelectItem/SelectItem.js +1 -3
  108. package/lib/components/SelectItemGroup/SelectItemGroup.d.ts +52 -0
  109. package/lib/components/SkeletonText/SkeletonText.js +1 -1
  110. package/lib/components/StructuredList/StructuredList.js +10 -38
  111. package/lib/components/Tabs/Tabs.js +3 -1
  112. package/lib/components/TextArea/TextArea.Skeleton.d.ts +33 -0
  113. package/lib/components/TextArea/TextArea.Skeleton.js +5 -5
  114. package/lib/components/TextArea/TextArea.d.ts +9 -2
  115. package/lib/components/TextArea/TextArea.js +30 -7
  116. package/lib/components/TextArea/index.js +2 -0
  117. package/lib/components/Toggle/Toggle.js +8 -19
  118. package/lib/components/Tooltip/DefinitionTooltip.d.ts +52 -0
  119. package/lib/components/Tooltip/DefinitionTooltip.js +2 -2
  120. package/lib/components/Tooltip/Tooltip.d.ts +117 -0
  121. package/lib/components/Tooltip/Tooltip.js +6 -4
  122. package/lib/components/Tooltip/index.d.ts +9 -0
  123. package/lib/index.d.ts +2 -0
  124. package/lib/index.js +50 -46
  125. package/lib/internal/ClickListener.js +1 -2
  126. package/lib/internal/keyboard/match.js +1 -1
  127. package/lib/internal/useAttachedMenu.js +89 -0
  128. package/lib/internal/useDelayedState.d.ts +19 -0
  129. package/lib/internal/useDelayedState.js +7 -3
  130. package/lib/internal/useId.js +1 -1
  131. package/package.json +3 -3
@@ -13,8 +13,8 @@ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelper
13
13
  var cx = require('classnames');
14
14
  var PropTypes = require('prop-types');
15
15
  var React = require('react');
16
- var warning = require('../../internal/warning.js');
17
16
  var usePrefix = require('../../internal/usePrefix.js');
17
+ var warning = require('../../internal/warning.js');
18
18
  var match = require('../../internal/keyboard/match.js');
19
19
  var keys = require('../../internal/keyboard/keys.js');
20
20
 
@@ -54,14 +54,14 @@ var OverflowMenuItem = /*#__PURE__*/React__default["default"].forwardRef(functio
54
54
 
55
55
  function setTabFocus(evt) {
56
56
  if (match.match(evt, keys.ArrowDown)) {
57
- handleOverflowMenuItemFocus({
57
+ handleOverflowMenuItemFocus === null || handleOverflowMenuItemFocus === void 0 ? void 0 : handleOverflowMenuItemFocus({
58
58
  currentIndex: index,
59
59
  direction: 1
60
60
  });
61
61
  }
62
62
 
63
63
  if (match.match(evt, keys.ArrowUp)) {
64
- handleOverflowMenuItemFocus({
64
+ handleOverflowMenuItemFocus === null || handleOverflowMenuItemFocus === void 0 ? void 0 : handleOverflowMenuItemFocus({
65
65
  currentIndex: index,
66
66
  direction: -1
67
67
  });
@@ -101,17 +101,22 @@ var OverflowMenuItem = /*#__PURE__*/React__default["default"].forwardRef(functio
101
101
  className: overflowMenuBtnClasses,
102
102
  disabled: disabled,
103
103
  href: href,
104
- index: index,
105
104
  onClick: handleClick,
106
105
  onKeyDown: function onKeyDown(evt) {
107
106
  setTabFocus(evt);
108
107
 
109
108
  _onKeyDown(evt);
110
109
  },
111
- role: "menuitem",
110
+ role: "menuitem" // ref as any: the type of `ref` is `ForwardedRef<HTMLButtonElement>` in `Button` component
111
+ // but `OverflowMenuItem` can be rendered as `a` tag as well, which is `HTMLAnchorElement`
112
+ // so we have to use `any` here
113
+ ,
112
114
  ref: ref,
113
- tabIndex: "-1",
114
- title: requireTitle ? title || itemText : null
115
+ tabIndex: -1 // itemText as any: itemText may be a ReactNode, but `title` only accepts string
116
+ // to avoid compatibility issue, we use `any` here. Consider to enforce `itemText` to be `string?`
117
+ // in the next major release
118
+ ,
119
+ title: requireTitle ? title || itemText : undefined
115
120
  }, rest), OverflowMenuItemContent));
116
121
  });
117
122
  OverflowMenuItem.propTypes = {
@@ -14,9 +14,10 @@ var React = require('react');
14
14
  var PropTypes = require('prop-types');
15
15
  var cx = require('classnames');
16
16
  var iconsReact = require('@carbon/icons-react');
17
- var useId = require('../../internal/useId.js');
18
17
  var Menu = require('../Menu/Menu.js');
18
+ var useId = require('../../internal/useId.js');
19
19
  var usePrefix = require('../../internal/usePrefix.js');
20
+ var useAttachedMenu = require('../../internal/useAttachedMenu.js');
20
21
 
21
22
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
22
23
 
@@ -39,53 +40,16 @@ function OverflowMenuV2(_ref) {
39
40
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
40
41
 
41
42
  var id = useId.useId('overflowmenu');
42
-
43
- var _useState = React.useState(false),
44
- _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
45
- open = _useState2[0],
46
- setOpen = _useState2[1];
47
-
48
- var _useState3 = React.useState([[0, 0], [0, 0]]),
49
- _useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
50
- position = _useState4[0],
51
- setPosition = _useState4[1];
52
-
53
- var triggerRef = React.useRef(null);
54
43
  var prefix = usePrefix.usePrefix();
44
+ var triggerRef = React.useRef(null);
55
45
 
56
- function openMenu() {
57
- if (triggerRef.current) {
58
- var _triggerRef$current$g = triggerRef.current.getBoundingClientRect(),
59
- left = _triggerRef$current$g.left,
60
- top = _triggerRef$current$g.top,
61
- right = _triggerRef$current$g.right,
62
- bottom = _triggerRef$current$g.bottom;
63
-
64
- setPosition([[left, right], [top, bottom]]);
65
- }
66
-
67
- setOpen(true);
68
- }
69
-
70
- function closeMenu() {
71
- setOpen(false);
72
- }
73
-
74
- function handleClick() {
75
- if (open) {
76
- closeMenu();
77
- } else {
78
- openMenu();
79
- }
80
- }
81
-
82
- function handleMousedown(e) {
83
- // prevent default for mousedown on trigger element to avoid
84
- // the "blur" event from firing on the menu as this would close
85
- // it and immediately re-open since "click" event is fired after
86
- // "blur" event.
87
- e.preventDefault();
88
- }
46
+ var _useAttachedMenu = useAttachedMenu.useAttachedMenu(triggerRef),
47
+ open = _useAttachedMenu.open,
48
+ x = _useAttachedMenu.x,
49
+ y = _useAttachedMenu.y,
50
+ handleClick = _useAttachedMenu.handleClick,
51
+ handleMousedown = _useAttachedMenu.handleMousedown,
52
+ handleClose = _useAttachedMenu.handleClose;
89
53
 
90
54
  var containerClasses = cx__default["default"]("".concat(prefix, "--overflow-menu__container"));
91
55
  var triggerClasses = cx__default["default"]("".concat(prefix, "--overflow-menu"), (_classNames = {}, _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--overflow-menu--open"), open), _rollupPluginBabelHelpers.defineProperty(_classNames, className, className), _classNames), size !== defaultSize && "".concat(prefix, "--overflow-menu--").concat(size));
@@ -106,9 +70,9 @@ function OverflowMenuV2(_ref) {
106
70
  id: id,
107
71
  size: size,
108
72
  open: open,
109
- onClose: closeMenu,
110
- x: position[0],
111
- y: position[1]
73
+ onClose: handleClose,
74
+ x: x,
75
+ y: y
112
76
  }, children));
113
77
  }
114
78
 
@@ -13,7 +13,7 @@ interface PopoverBaseProps {
13
13
  */
14
14
  align?: PopoverAlignment;
15
15
  /**
16
- * Will auto-align the popover on first render if it is not visible. This prop is currently experimental and is subject to futurue changes.
16
+ * Will auto-align the popover on first render if it is not visible. This prop is currently experimental and is subject to future changes.
17
17
  */
18
18
  autoAlign?: boolean;
19
19
  /**
@@ -37,6 +37,10 @@ interface PopoverBaseProps {
37
37
  * Render the component using the high-contrast variant
38
38
  */
39
39
  highContrast?: boolean;
40
+ /**
41
+ * Render the component using the tab tip variant
42
+ */
43
+ isTabTip?: boolean;
40
44
  /**
41
45
  * Specify whether the component is currently open or closed
42
46
  */
@@ -23,7 +23,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
23
23
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
24
24
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
25
25
 
26
- var _excluded = ["align", "as", "autoAlign", "caret", "className", "children", "dropShadow", "highContrast", "open"],
26
+ var _excluded = ["isTabTip", "align", "as", "autoAlign", "caret", "className", "children", "dropShadow", "highContrast", "open"],
27
27
  _excluded2 = ["className", "children"];
28
28
  var PopoverContext = /*#__PURE__*/React__default["default"].createContext({
29
29
  floating: {
@@ -33,13 +33,14 @@ var PopoverContext = /*#__PURE__*/React__default["default"].createContext({
33
33
  var Popover = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, forwardRef) {
34
34
  var _cx;
35
35
 
36
- var _ref$align = _ref.align,
37
- align = _ref$align === void 0 ? 'bottom' : _ref$align,
36
+ var isTabTip = _ref.isTabTip,
37
+ _ref$align = _ref.align,
38
+ align = _ref$align === void 0 ? isTabTip ? 'bottom-left' : 'bottom' : _ref$align,
38
39
  as = _ref.as,
39
40
  _ref$autoAlign = _ref.autoAlign,
40
41
  autoAlign = _ref$autoAlign === void 0 ? false : _ref$autoAlign,
41
42
  _ref$caret = _ref.caret,
42
- caret = _ref$caret === void 0 ? true : _ref$caret,
43
+ caret = _ref$caret === void 0 ? isTabTip ? false : true : _ref$caret,
43
44
  customClassName = _ref.className,
44
45
  children = _ref.children,
45
46
  _ref$dropShadow = _ref.dropShadow,
@@ -57,6 +58,15 @@ var Popover = /*#__PURE__*/React__default["default"].forwardRef(function (_ref,
57
58
  floating: floating
58
59
  };
59
60
  }, []);
61
+
62
+ if (isTabTip) {
63
+ var tabTipAlignments = ['bottom-left', 'bottom-right'];
64
+
65
+ if (!tabTipAlignments.includes(align)) {
66
+ align = 'bottom-left';
67
+ }
68
+ }
69
+
60
70
  var ref = useMergedRefs.useMergedRefs([forwardRef, popover]);
61
71
 
62
72
  var _useState = React.useState(false),
@@ -69,13 +79,13 @@ var Popover = /*#__PURE__*/React__default["default"].forwardRef(function (_ref,
69
79
  autoAlignment = _useState4[0],
70
80
  setAutoAlignment = _useState4[1];
71
81
 
72
- var className = cx__default["default"]((_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover-container"), true), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover--caret"), caret), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover--drop-shadow"), dropShadow), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover--high-contrast"), highContrast), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover--open"), open), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover--").concat(autoAlignment), autoAligned), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover--").concat(align), !autoAligned), _cx), customClassName);
82
+ var className = cx__default["default"]((_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover-container"), true), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover--caret"), caret), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover--drop-shadow"), dropShadow), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover--high-contrast"), highContrast), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover--open"), open), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover--").concat(autoAlignment), autoAligned && !isTabTip), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover--").concat(align), !autoAligned), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover--tab-tip"), isTabTip), _cx), customClassName);
73
83
  useIsomorphicEffect["default"](function () {
74
84
  if (!open) {
75
85
  return;
76
86
  }
77
87
 
78
- if (!autoAlign) {
88
+ if (!autoAlign || isTabTip) {
79
89
  setAutoAligned(false);
80
90
  return;
81
91
  }
@@ -166,14 +176,27 @@ var Popover = /*#__PURE__*/React__default["default"].forwardRef(function (_ref,
166
176
  setAutoAligned(true);
167
177
  setAutoAlignment(alignment);
168
178
  }
169
- }, [autoAligned, align, autoAlign, prefix, open]);
179
+ }, [autoAligned, align, autoAlign, prefix, open, isTabTip]);
170
180
  var BaseComponent = as !== null && as !== void 0 ? as : 'span';
181
+ var mappedChildren = React__default["default"].Children.map(children, function (child) {
182
+ var item = child;
183
+
184
+ if ((item === null || item === void 0 ? void 0 : item.type) === 'button') {
185
+ var _className = item.props.className;
186
+ var tabTipClasses = cx__default["default"]("".concat(prefix, "--popover--tab-tip__button"), _className);
187
+ return /*#__PURE__*/React__default["default"].cloneElement(item, {
188
+ className: tabTipClasses
189
+ });
190
+ } else {
191
+ return item;
192
+ }
193
+ });
171
194
  return /*#__PURE__*/React__default["default"].createElement(PopoverContext.Provider, {
172
195
  value: value
173
196
  }, /*#__PURE__*/React__default["default"].createElement(BaseComponent, _rollupPluginBabelHelpers["extends"]({}, rest, {
174
197
  className: className,
175
198
  ref: ref
176
- }), children));
199
+ }), isTabTip ? mappedChildren : children));
177
200
  }); // Note: this displayName is temporarily set so that Storybook ArgTable
178
201
  // correctly displays the name of this component
179
202
 
@@ -194,7 +217,7 @@ Popover.propTypes = {
194
217
  as: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].elementType]),
195
218
 
196
219
  /**
197
- * Will auto-align the popover on first render if it is not visible. This prop is currently experimental and is subject to futurue changes.
220
+ * Will auto-align the popover on first render if it is not visible. This prop is currently experimental and is subject to future changes.
198
221
  */
199
222
  autoAlign: PropTypes__default["default"].bool,
200
223
 
@@ -224,6 +247,11 @@ Popover.propTypes = {
224
247
  */
225
248
  highContrast: PropTypes__default["default"].bool,
226
249
 
250
+ /**
251
+ * Render the component using the tab tip variant
252
+ */
253
+ isTabTip: PropTypes__default["default"].bool,
254
+
227
255
  /**
228
256
  * Specify whether the component is currently open or closed
229
257
  */
@@ -22,6 +22,7 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
22
22
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
23
23
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
24
24
 
25
+ var _excluded = ["children", "className", "defaultSelected", "disabled", "labelPosition", "legendText", "name", "onChange", "orientation", "readOnly", "valueSelected"];
25
26
  var RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef(function RadioButtonGroup(_ref, ref) {
26
27
  var _classNames;
27
28
 
@@ -38,7 +39,9 @@ var RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef(functio
38
39
  _ref$orientation = _ref.orientation,
39
40
  orientation = _ref$orientation === void 0 ? 'horizontal' : _ref$orientation,
40
41
  readOnly = _ref.readOnly,
41
- valueSelected = _ref.valueSelected;
42
+ valueSelected = _ref.valueSelected,
43
+ rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
44
+
42
45
  var prefix = usePrefix.usePrefix();
43
46
 
44
47
  var _useState = React.useState(valueSelected !== null && valueSelected !== void 0 ? valueSelected : defaultSelected),
@@ -95,11 +98,11 @@ var RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef(functio
95
98
  return /*#__PURE__*/React__default["default"].createElement("div", {
96
99
  className: wrapperClasses,
97
100
  ref: ref
98
- }, /*#__PURE__*/React__default["default"].createElement("fieldset", {
101
+ }, /*#__PURE__*/React__default["default"].createElement("fieldset", _rollupPluginBabelHelpers["extends"]({
99
102
  className: fieldsetClasses,
100
103
  disabled: disabled,
101
104
  "aria-readonly": readOnly
102
- }, legendText && /*#__PURE__*/React__default["default"].createElement(index.Legend, {
105
+ }, rest), legendText && /*#__PURE__*/React__default["default"].createElement(index.Legend, {
103
106
  className: "".concat(prefix, "--label")
104
107
  }, legendText), getRadioButtons()));
105
108
  });
@@ -29,8 +29,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
29
29
  var _CheckmarkFilled;
30
30
 
31
31
  var _excluded = ["children", "className", "disabled", "light", "checked", "name", "value", "id", "onChange", "tabIndex"];
32
-
33
- function RadioTile(_ref) {
32
+ var RadioTile = /*#__PURE__*/React__default["default"].forwardRef(function RadioTile(_ref, ref) {
34
33
  var _cx;
35
34
 
36
35
  var children = _ref.children,
@@ -70,7 +69,8 @@ function RadioTile(_ref) {
70
69
  onKeyDown: !disabled ? handleOnKeyDown : null,
71
70
  tabIndex: !disabled ? tabIndex : null,
72
71
  type: "radio",
73
- value: value
72
+ value: value,
73
+ ref: ref
74
74
  }), /*#__PURE__*/React__default["default"].createElement("label", _rollupPluginBabelHelpers["extends"]({}, rest, {
75
75
  htmlFor: inputId,
76
76
  className: className
@@ -79,8 +79,7 @@ function RadioTile(_ref) {
79
79
  }, _CheckmarkFilled || (_CheckmarkFilled = /*#__PURE__*/React__default["default"].createElement(iconsReact.CheckmarkFilled, null))), /*#__PURE__*/React__default["default"].createElement("span", {
80
80
  className: "".concat(prefix, "--tile-content")
81
81
  }, children)));
82
- }
83
-
82
+ });
84
83
  RadioTile.propTypes = {
85
84
  /**
86
85
  * `true` if this tile should be selected.
@@ -137,5 +136,6 @@ RadioTile.defaultProps = {
137
136
  onChange: function onChange() {},
138
137
  tabIndex: 0
139
138
  };
139
+ var RadioTile$1 = RadioTile;
140
140
 
141
- exports["default"] = RadioTile;
141
+ exports["default"] = RadioTile$1;
@@ -0,0 +1,89 @@
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, { ChangeEventHandler, ComponentPropsWithRef, ReactNode } from 'react';
8
+ type ExcludedAttributes = 'size';
9
+ interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, ExcludedAttributes> {
10
+ /**
11
+ * Provide the contents of your Select
12
+ */
13
+ children?: ReactNode;
14
+ /**
15
+ * Specify an optional className to be applied to the node containing the label and the select box
16
+ */
17
+ className?: string;
18
+ /**
19
+ * Optionally provide the default value of the `<select>`
20
+ */
21
+ defaultValue?: any;
22
+ /**
23
+ * Specify whether the control is disabled
24
+ */
25
+ disabled?: boolean;
26
+ /**
27
+ * Provide text that is used alongside the control label for additional help
28
+ */
29
+ helperText?: ReactNode;
30
+ /**
31
+ * Specify whether the label should be hidden, or not
32
+ */
33
+ hideLabel?: boolean;
34
+ /**
35
+ * Specify a custom `id` for the `<select>`
36
+ */
37
+ id: string;
38
+ /**
39
+ * Specify whether you want the inline version of this control
40
+ */
41
+ inline?: boolean;
42
+ /**
43
+ * Specify if the currently value is invalid.
44
+ */
45
+ invalid?: boolean;
46
+ /**
47
+ * Message which is displayed if the value is invalid.
48
+ */
49
+ invalidText?: ReactNode;
50
+ /**
51
+ * Provide label text to be read by screen readers when interacting with the control.
52
+ */
53
+ labelText?: ReactNode;
54
+ /**
55
+ * `true` to use the light version. For use on $ui-01 backgrounds only.
56
+ * Don't use this to make tile background color same as container background color.
57
+ *
58
+ * @deprecated The `light` prop for `Select` is no longer needed and has been deprecated in v11 in favor of the new `Layer` component.
59
+ * It will be moved in the next major release.
60
+ */
61
+ light?: boolean;
62
+ /**
63
+ * Reserved for use with <Pagination> component. Will not render a label for the
64
+ * select since Pagination renders one for us.
65
+ */
66
+ noLabel?: boolean;
67
+ /**
68
+ * Provide an optional `onChange` hook that is called each time the value of the underlying `<input>` changes.
69
+ */
70
+ onChange?: ChangeEventHandler<HTMLSelectElement>;
71
+ /**
72
+ * Whether the select should be read-only
73
+ */
74
+ readOnly?: boolean;
75
+ /**
76
+ * Specify the size of the Select Input.
77
+ */
78
+ size?: 'sm' | 'md' | 'lg';
79
+ /**
80
+ * Specify whether the control is currently in warning state
81
+ */
82
+ warn?: boolean;
83
+ /**
84
+ * Provide the text that is displayed when the control is in warning state
85
+ */
86
+ warnText?: ReactNode;
87
+ }
88
+ declare const Select: React.ForwardRefExoticComponent<Pick<SelectProps, "value" | "children" | "className" | "disabled" | "size" | "form" | "slot" | "style" | "title" | "dir" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "autoComplete" | "multiple" | "key" | "id" | "onAnimationEnd" | "aria-controls" | "aria-expanded" | "onClick" | "onKeyDown" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "inline" | "name" | "readOnly" | "required" | "labelText" | "hideLabel" | "light" | "invalid" | "invalidText" | "warn" | "warnText" | "helperText" | "noLabel"> & React.RefAttributes<HTMLSelectElement>>;
89
+ export default Select;
@@ -0,0 +1,62 @@
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 PropTypes from 'prop-types';
8
+ import { HTMLAttributes } from 'react';
9
+ export interface SelectItemProps extends HTMLAttributes<HTMLOptionElement> {
10
+ /**
11
+ * Specify an optional className to be applied to the node
12
+ */
13
+ className?: string;
14
+ /**
15
+ * Specify whether the <SelectItem> should be disabled
16
+ */
17
+ disabled?: boolean;
18
+ /**
19
+ * Specify whether the <SelectItem> is hidden
20
+ */
21
+ hidden?: boolean;
22
+ /**
23
+ * Provide the contents of your <SelectItem>
24
+ */
25
+ text: string;
26
+ /**
27
+ * Specify the value of the <SelectItem>
28
+ */
29
+ value: any;
30
+ }
31
+ declare const SelectItem: {
32
+ ({ className, value, disabled, hidden, text, ...other }: SelectItemProps): JSX.Element;
33
+ propTypes: {
34
+ /**
35
+ * Specify an optional className to be applied to the node
36
+ */
37
+ className: PropTypes.Requireable<string>;
38
+ /**
39
+ * Specify whether the <SelectItem> should be disabled
40
+ */
41
+ disabled: PropTypes.Requireable<boolean>;
42
+ /**
43
+ * Specify whether the <SelectItem> is hidden
44
+ */
45
+ hidden: PropTypes.Requireable<boolean>;
46
+ /**
47
+ * Provide the contents of your <SelectItem>
48
+ */
49
+ text: PropTypes.Validator<string>;
50
+ /**
51
+ * Specify the value of the <SelectItem>
52
+ */
53
+ value: PropTypes.Validator<any>;
54
+ };
55
+ defaultProps: {
56
+ disabled: boolean;
57
+ hidden: boolean;
58
+ value: string;
59
+ text: string;
60
+ };
61
+ };
62
+ export default SelectItem;
@@ -24,8 +24,6 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
24
24
  var _excluded = ["className", "value", "disabled", "hidden", "text"];
25
25
 
26
26
  var SelectItem = function SelectItem(_ref) {
27
- var _classNames;
28
-
29
27
  var className = _ref.className,
30
28
  value = _ref.value,
31
29
  disabled = _ref.disabled,
@@ -34,7 +32,7 @@ var SelectItem = function SelectItem(_ref) {
34
32
  other = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
35
33
 
36
34
  var prefix = usePrefix.usePrefix();
37
- var selectItemClasses = cx__default["default"]((_classNames = {}, _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--select-option"), true), _rollupPluginBabelHelpers.defineProperty(_classNames, className, className), _classNames));
35
+ var selectItemClasses = cx__default["default"](_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--select-option"), true), className && _rollupPluginBabelHelpers.defineProperty({}, className, className)));
38
36
  return /*#__PURE__*/React__default["default"].createElement("option", _rollupPluginBabelHelpers["extends"]({}, other, {
39
37
  className: selectItemClasses,
40
38
  value: value,
@@ -0,0 +1,52 @@
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 PropTypes from 'prop-types';
8
+ import { HTMLAttributes, ReactNode } from 'react';
9
+ export interface SelectItemGroupProps extends HTMLAttributes<HTMLOptGroupElement> {
10
+ /**
11
+ * Provide the contents of your <SelectItemGroup>
12
+ */
13
+ children?: ReactNode;
14
+ /**
15
+ * Specify an optional className to be applied to the node
16
+ */
17
+ className?: string;
18
+ /**
19
+ * Specify whether the <SelectItemGroup> should be disabled
20
+ */
21
+ disabled?: boolean;
22
+ /**
23
+ * Specify the label to be displayed
24
+ */
25
+ label: string;
26
+ }
27
+ declare const SelectItemGroup: {
28
+ ({ children, className, disabled, label, ...other }: SelectItemGroupProps): JSX.Element;
29
+ propTypes: {
30
+ /**
31
+ * Provide the contents of your <SelectItemGroup>
32
+ */
33
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
34
+ /**
35
+ * Specify an optional className to be applied to the node
36
+ */
37
+ className: PropTypes.Requireable<string>;
38
+ /**
39
+ * Specify whether the <SelectItemGroup> should be disabled
40
+ */
41
+ disabled: PropTypes.Requireable<boolean>;
42
+ /**
43
+ * Specify the label to be displayed
44
+ */
45
+ label: PropTypes.Validator<string>;
46
+ };
47
+ defaultProps: {
48
+ disabled: boolean;
49
+ label: string | undefined;
50
+ };
51
+ };
52
+ export default SelectItemGroup;
@@ -56,7 +56,7 @@ var SkeletonText = function SkeletonText(_ref) {
56
56
  useIsomorphicEffect["default"](function () {
57
57
  refs.current.map(function (item, j) {
58
58
  var randomPercentWidth = getRandomInt(0, 75, j) + 'px';
59
- var randomPxWidth = getRandomInt(widthNum - 75, widthNum, j) + 'px';
59
+ var randomPxWidth = getRandomInt(Math.max(widthNum - 75, 0), widthNum, j) + 'px';
60
60
 
61
61
  if (item) {
62
62
  if (widthPercent && paragraph) {
@@ -23,7 +23,9 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
23
23
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
24
24
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
25
25
 
26
- var _excluded = ["children", "selection", "className", "ariaLabel", "isCondensed", "isFlush"],
26
+ var _StructuredListWrappe;
27
+
28
+ var _excluded = ["children", "selection", "className", "aria-label", "ariaLabel", "isCondensed", "isFlush"],
27
29
  _excluded2 = ["children", "className"],
28
30
  _excluded3 = ["children", "className"],
29
31
  _excluded4 = ["onKeyDown", "children", "className", "head"],
@@ -37,7 +39,8 @@ function StructuredListWrapper(props) {
37
39
  var children = props.children,
38
40
  selection = props.selection,
39
41
  className = props.className,
40
- ariaLabel = props.ariaLabel,
42
+ ariaLabel = props['aria-label'],
43
+ deprecatedAriaLabel = props.ariaLabel,
41
44
  isCondensed = props.isCondensed,
42
45
  isFlush = props.isFlush,
43
46
  other = _rollupPluginBabelHelpers.objectWithoutProperties(props, _excluded);
@@ -58,46 +61,15 @@ function StructuredListWrapper(props) {
58
61
  role: "table",
59
62
  className: classes
60
63
  }, other, {
61
- "aria-label": ariaLabel
64
+ "aria-label": deprecatedAriaLabel || ariaLabel
62
65
  }), children)));
63
66
  }
64
- StructuredListWrapper.propTypes = {
65
- /**
66
- * Specify a label to be read by screen readers on the container node
67
- */
68
- ariaLabel: PropTypes__default["default"].string,
69
-
70
- /**
71
- * Provide the contents of your StructuredListWrapper
72
- */
73
- children: PropTypes__default["default"].node,
74
-
75
- /**
76
- * Specify an optional className to be applied to the container node
77
- */
78
- className: PropTypes__default["default"].string,
79
-
80
- /**
81
- * Specify if structured list is condensed, default is false
82
- */
83
- isCondensed: PropTypes__default["default"].bool,
84
-
85
- /**
86
- * Specify if structured list is flush, default is false
87
- */
88
- isFlush: PropTypes__default["default"].bool,
89
-
90
- /**
91
- * Specify whether your StructuredListWrapper should have selections
92
- */
93
- selection: PropTypes__default["default"].bool
94
- };
95
- StructuredListWrapper.defaultProps = {
67
+ StructuredListWrapper.propTypes = (_StructuredListWrappe = {}, _rollupPluginBabelHelpers.defineProperty(_StructuredListWrappe, 'aria-label', PropTypes__default["default"].string), _rollupPluginBabelHelpers.defineProperty(_StructuredListWrappe, "ariaLabel", deprecate["default"](PropTypes__default["default"].string, 'This prop syntax has been deprecated. Please use the new `aria-label`.')), _rollupPluginBabelHelpers.defineProperty(_StructuredListWrappe, "children", PropTypes__default["default"].node), _rollupPluginBabelHelpers.defineProperty(_StructuredListWrappe, "className", PropTypes__default["default"].string), _rollupPluginBabelHelpers.defineProperty(_StructuredListWrappe, "isCondensed", PropTypes__default["default"].bool), _rollupPluginBabelHelpers.defineProperty(_StructuredListWrappe, "isFlush", PropTypes__default["default"].bool), _rollupPluginBabelHelpers.defineProperty(_StructuredListWrappe, "selection", PropTypes__default["default"].bool), _StructuredListWrappe);
68
+ StructuredListWrapper.defaultProps = _rollupPluginBabelHelpers.defineProperty({
96
69
  selection: false,
97
70
  isCondensed: false,
98
- isFlush: false,
99
- ariaLabel: 'Structured list section'
100
- };
71
+ isFlush: false
72
+ }, 'aria-label', 'Structured list section');
101
73
  function StructuredListHead(props) {
102
74
  var children = props.children,
103
75
  className = props.className,