@carbon/react 1.68.0 → 1.69.0-rc.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 (78) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +786 -786
  2. package/README.md +3 -3
  3. package/es/components/Accordion/AccordionItem.js +0 -1
  4. package/es/components/Button/Button.js +6 -0
  5. package/es/components/CheckboxGroup/CheckboxGroup.js +1 -2
  6. package/es/components/CheckboxGroup/index.d.ts +10 -0
  7. package/es/components/ComboBox/ComboBox.js +13 -18
  8. package/es/components/ComboButton/index.js +10 -3
  9. package/es/components/DataTable/TableCell.d.ts +1 -4
  10. package/es/components/DataTable/TableCell.js +3 -2
  11. package/es/components/Disclosure/index.d.ts +18 -0
  12. package/es/components/Dropdown/Dropdown.js +11 -9
  13. package/es/components/FileUploader/FileUploader.d.ts +8 -92
  14. package/es/components/FileUploader/FileUploader.js +116 -137
  15. package/es/components/IdPrefix/index.d.ts +26 -0
  16. package/es/components/Menu/MenuItem.js +1 -4
  17. package/es/components/MenuButton/index.d.ts +4 -0
  18. package/es/components/MenuButton/index.js +19 -5
  19. package/es/components/MultiSelect/MultiSelect.js +11 -9
  20. package/es/components/OverflowMenu/next/index.d.ts +4 -0
  21. package/es/components/OverflowMenu/next/index.js +19 -9
  22. package/es/components/PaginationNav/PaginationNav.js +1 -1
  23. package/es/components/Popover/index.js +18 -14
  24. package/es/components/Portal/index.d.ts +25 -0
  25. package/es/components/Slider/Slider.js +2 -2
  26. package/es/components/Tag/DismissibleTag.js +2 -2
  27. package/es/components/Tag/OperationalTag.d.ts +2 -10
  28. package/es/components/Tag/OperationalTag.js +2 -14
  29. package/es/components/Tag/SelectableTag.d.ts +2 -10
  30. package/es/components/Tag/SelectableTag.js +2 -16
  31. package/es/components/Toggle/Toggle.js +2 -0
  32. package/es/components/ToggleSmall/ToggleSmall.Skeleton.d.ts +49 -0
  33. package/es/components/ToggleSmall/index.d.ts +7 -0
  34. package/es/components/TreeView/TreeNode.js +4 -2
  35. package/es/components/TreeView/TreeView.js +4 -4
  36. package/es/components/UIShell/SideNavMenuItem.d.ts +4 -3
  37. package/es/components/UIShell/SideNavMenuItem.js +1 -4
  38. package/es/index.js +1 -1
  39. package/es/internal/useIdPrefix.d.ts +9 -0
  40. package/lib/components/Accordion/AccordionItem.js +0 -1
  41. package/lib/components/Button/Button.js +6 -0
  42. package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -2
  43. package/lib/components/CheckboxGroup/index.d.ts +10 -0
  44. package/lib/components/ComboBox/ComboBox.js +18 -23
  45. package/lib/components/ComboButton/index.js +12 -5
  46. package/lib/components/DataTable/TableCell.d.ts +1 -4
  47. package/lib/components/DataTable/TableCell.js +3 -2
  48. package/lib/components/Disclosure/index.d.ts +18 -0
  49. package/lib/components/Dropdown/Dropdown.js +18 -16
  50. package/lib/components/FileUploader/FileUploader.d.ts +8 -92
  51. package/lib/components/FileUploader/FileUploader.js +113 -134
  52. package/lib/components/IdPrefix/index.d.ts +26 -0
  53. package/lib/components/Menu/MenuItem.js +1 -4
  54. package/lib/components/MenuButton/index.d.ts +4 -0
  55. package/lib/components/MenuButton/index.js +19 -5
  56. package/lib/components/MultiSelect/MultiSelect.js +18 -16
  57. package/lib/components/OverflowMenu/next/index.d.ts +4 -0
  58. package/lib/components/OverflowMenu/next/index.js +21 -11
  59. package/lib/components/PaginationNav/PaginationNav.js +1 -1
  60. package/lib/components/Popover/index.js +18 -14
  61. package/lib/components/Portal/index.d.ts +25 -0
  62. package/lib/components/Slider/Slider.js +2 -2
  63. package/lib/components/Tag/DismissibleTag.js +2 -2
  64. package/lib/components/Tag/OperationalTag.d.ts +2 -10
  65. package/lib/components/Tag/OperationalTag.js +2 -14
  66. package/lib/components/Tag/SelectableTag.d.ts +2 -10
  67. package/lib/components/Tag/SelectableTag.js +2 -16
  68. package/lib/components/Toggle/Toggle.js +2 -0
  69. package/lib/components/ToggleSmall/ToggleSmall.Skeleton.d.ts +49 -0
  70. package/lib/components/ToggleSmall/index.d.ts +7 -0
  71. package/lib/components/TreeView/TreeNode.js +4 -2
  72. package/lib/components/TreeView/TreeView.js +4 -4
  73. package/lib/components/UIShell/SideNavMenuItem.d.ts +4 -3
  74. package/lib/components/UIShell/SideNavMenuItem.js +1 -4
  75. package/lib/index.js +2 -2
  76. package/lib/internal/useIdPrefix.d.ts +9 -0
  77. package/package.json +7 -7
  78. package/telemetry.yml +809 -809
@@ -21,6 +21,7 @@ var useEvent = require('../../internal/useEvent.js');
21
21
  var createPropAdapter = require('../../tools/createPropAdapter.js');
22
22
  var react = require('@floating-ui/react');
23
23
  var floatingUi_dom = require('../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js');
24
+ var index = require('../FeatureFlags/index.js');
24
25
 
25
26
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
26
27
 
@@ -75,6 +76,7 @@ const Popover = /*#__PURE__*/React__default["default"].forwardRef(function Popov
75
76
  const floating = React.useRef(null);
76
77
  const caretRef = React.useRef(null);
77
78
  const popover = React.useRef(null);
79
+ const enableFloatingStyles = index.useFeatureFlag('enable-v12-dynamic-floating-styles') || autoAlign;
78
80
  let align = createPropAdapter.mapPopoverAlignProp(initialAlign);
79
81
 
80
82
  // If the `Popover` is the last focusable item in the tab order, it should also close when the browser window loses focus (#12922)
@@ -127,7 +129,7 @@ const Popover = /*#__PURE__*/React__default["default"].forwardRef(function Popov
127
129
  floatingStyles,
128
130
  placement,
129
131
  middlewareData
130
- } = react.useFloating(autoAlign ? {
132
+ } = react.useFloating(enableFloatingStyles ? {
131
133
  placement: align,
132
134
  // The floating element is positioned relative to its nearest
133
135
  // containing block (usually the viewport). It will in many cases also
@@ -135,13 +137,15 @@ const Popover = /*#__PURE__*/React__default["default"].forwardRef(function Popov
135
137
  // https://floating-ui.com/docs/misc#clipping
136
138
  strategy: 'fixed',
137
139
  // Middleware order matters, arrow should be last
138
- middleware: [react.offset(!isTabTip ? popoverDimensions?.current?.offset : 0), react.flip({
140
+ middleware: [react.offset(!isTabTip ? popoverDimensions?.current?.offset : 0), autoAlign && react.flip({
139
141
  fallbackAxisSideDirection: 'start'
140
142
  }), react.arrow({
141
143
  element: caretRef
142
- }), floatingUi_dom.hide()],
144
+ }), autoAlign && floatingUi_dom.hide()],
143
145
  whileElementsMounted: react.autoUpdate
144
- } : {} // When autoAlign is turned off, floating-ui will not be used
146
+ } : {}
147
+ // When autoAlign is turned off & the `enable-v12-dynamic-floating-styles` feature flag is not
148
+ // enabled, floating-ui will not be used
145
149
  );
146
150
  const value = React.useMemo(() => {
147
151
  return {
@@ -158,7 +162,7 @@ const Popover = /*#__PURE__*/React__default["default"].forwardRef(function Popov
158
162
  }
159
163
  }
160
164
  React.useEffect(() => {
161
- if (autoAlign) {
165
+ if (enableFloatingStyles) {
162
166
  const updatedFloatingStyles = {
163
167
  ...floatingStyles,
164
168
  visibility: middlewareData.hide?.referenceHidden ? 'hidden' : 'visible'
@@ -190,7 +194,7 @@ const Popover = /*#__PURE__*/React__default["default"].forwardRef(function Popov
190
194
  }
191
195
  }
192
196
  }
193
- }, [floatingStyles, refs.floating, autoAlign, middlewareData, placement, caret]);
197
+ }, [floatingStyles, refs.floating, enableFloatingStyles, middlewareData, placement, caret]);
194
198
  const ref = useMergedRefs.useMergedRefs([forwardRef, popover]);
195
199
  const currentAlignment = autoAlign && placement !== align ? placement : align;
196
200
  const className = cx__default["default"]({
@@ -199,7 +203,7 @@ const Popover = /*#__PURE__*/React__default["default"].forwardRef(function Popov
199
203
  [`${prefix}--popover--drop-shadow`]: dropShadow,
200
204
  [`${prefix}--popover--high-contrast`]: highContrast,
201
205
  [`${prefix}--popover--open`]: open,
202
- [`${prefix}--popover--auto-align ${prefix}--autoalign`]: autoAlign,
206
+ [`${prefix}--popover--auto-align ${prefix}--autoalign`]: enableFloatingStyles,
203
207
  [`${prefix}--popover--${currentAlignment}`]: true,
204
208
  [`${prefix}--popover--tab-tip`]: isTabTip
205
209
  }, customClassName);
@@ -215,8 +219,8 @@ const Popover = /*#__PURE__*/React__default["default"].forwardRef(function Popov
215
219
  * is on, even if they are a trigger element.
216
220
  */
217
221
  const isTriggerElement = item?.type === 'button';
218
- const isTriggerComponent = autoAlign && displayName && ['ToggletipButton'].includes(displayName);
219
- const isAllowedTriggerComponent = autoAlign && !['ToggletipContent', 'PopoverContent'].includes(displayName);
222
+ const isTriggerComponent = enableFloatingStyles && displayName && ['ToggletipButton'].includes(displayName);
223
+ const isAllowedTriggerComponent = enableFloatingStyles && !['ToggletipContent', 'PopoverContent'].includes(displayName);
220
224
  if ( /*#__PURE__*/React__default["default"].isValidElement(item) && (isTriggerElement || isTriggerComponent || isAllowedTriggerComponent)) {
221
225
  const className = item?.props?.className;
222
226
  const ref = (item?.props).ref;
@@ -235,7 +239,7 @@ const Popover = /*#__PURE__*/React__default["default"].forwardRef(function Popov
235
239
  // For a toggletip there is a specific trigger component, ToggletipButton.
236
240
  // In either of these caes we want to set this as the reference node for floating-ui autoAlign
237
241
  // positioning.
238
- if (autoAlign && item?.type?.displayName !== 'PopoverContent' || autoAlign && item?.type?.displayName === 'ToggletipButton') {
242
+ if (enableFloatingStyles && item?.type?.displayName !== 'PopoverContent' || enableFloatingStyles && item?.type?.displayName === 'ToggletipButton') {
239
243
  // Set the reference element for floating-ui
240
244
  refs.setReference(node);
241
245
  }
@@ -258,7 +262,7 @@ const Popover = /*#__PURE__*/React__default["default"].forwardRef(function Popov
258
262
  }, /*#__PURE__*/React__default["default"].createElement(BaseComponentAsAny, _rollupPluginBabelHelpers["extends"]({}, rest, {
259
263
  className: className,
260
264
  ref: ref
261
- }), autoAlign || isTabTip ? mappedChildren : children));
265
+ }), enableFloatingStyles || isTabTip ? mappedChildren : children));
262
266
  });
263
267
 
264
268
  // Note: this displayName is temporarily set so that Storybook ArgTable
@@ -269,7 +273,6 @@ if (process.env.NODE_ENV !== "production") {
269
273
  Popover.propTypes = {
270
274
  /**
271
275
  * Specify how the popover should align with the trigger element
272
-
273
276
  */
274
277
  align: deprecateValuesWithin["default"](PropTypes__default["default"].oneOf(['top', 'top-left',
275
278
  // deprecated use top-start instead
@@ -355,18 +358,19 @@ _ref2, forwardRef) {
355
358
  autoAlign
356
359
  } = React__default["default"].useContext(PopoverContext);
357
360
  const ref = useMergedRefs.useMergedRefs([setFloating, forwardRef]);
361
+ const enableFloatingStyles = index.useFeatureFlag('enable-v12-dynamic-floating-styles') || autoAlign;
358
362
  return /*#__PURE__*/React__default["default"].createElement("span", _rollupPluginBabelHelpers["extends"]({}, rest, {
359
363
  className: `${prefix}--popover`
360
364
  }), /*#__PURE__*/React__default["default"].createElement("span", {
361
365
  className: cx__default["default"](`${prefix}--popover-content`, className),
362
366
  ref: ref
363
- }, children, autoAlign && /*#__PURE__*/React__default["default"].createElement("span", {
367
+ }, children, enableFloatingStyles && /*#__PURE__*/React__default["default"].createElement("span", {
364
368
  className: cx__default["default"]({
365
369
  [`${prefix}--popover-caret`]: true,
366
370
  [`${prefix}--popover--auto-align`]: true
367
371
  }),
368
372
  ref: caretRef
369
- })), !autoAlign && /*#__PURE__*/React__default["default"].createElement("span", {
373
+ })), !enableFloatingStyles && /*#__PURE__*/React__default["default"].createElement("span", {
370
374
  className: cx__default["default"]({
371
375
  [`${prefix}--popover-caret`]: true
372
376
  }),
@@ -0,0 +1,25 @@
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
+ interface PortalProps {
9
+ /**
10
+ * Specify the children elements to be rendered inside of the <Portal>
11
+ */
12
+ children: ReactNode;
13
+ /**
14
+ * Provide a ref for a container node to render the portal
15
+ */
16
+ container?: React.RefObject<HTMLElement>;
17
+ }
18
+ /**
19
+ * Helper component for rendering content within a portal. By default, the
20
+ * portal will render into document.body. You can customize this behavior with
21
+ * the `container` prop. Any `children` provided to this component will be
22
+ * rendered inside of the container.
23
+ */
24
+ declare function Portal({ container, children, }: PortalProps): React.ReactPortal | null;
25
+ export { Portal };
@@ -1114,7 +1114,7 @@ class Slider extends React.PureComponent {
1114
1114
  className: lowerThumbClasses,
1115
1115
  role: "slider",
1116
1116
  id: twoHandles ? undefined : id,
1117
- tabIndex: !readOnly ? 0 : -1,
1117
+ tabIndex: readOnly || disabled ? undefined : 0,
1118
1118
  "aria-valuetext": `${formatLabel(value, '')}`,
1119
1119
  "aria-valuemax": twoHandles ? valueUpper : max,
1120
1120
  "aria-valuemin": min,
@@ -1133,7 +1133,7 @@ class Slider extends React.PureComponent {
1133
1133
  }, upperThumbWrapperProps), /*#__PURE__*/React__default["default"].createElement("div", {
1134
1134
  className: upperThumbClasses,
1135
1135
  role: "slider",
1136
- tabIndex: !readOnly ? 0 : -1,
1136
+ tabIndex: readOnly || disabled ? undefined : 0,
1137
1137
  "aria-valuemax": max,
1138
1138
  "aria-valuemin": value,
1139
1139
  "aria-valuenow": valueUpper,
@@ -89,7 +89,7 @@ const DismissibleTag = _ref => {
89
89
  }, /*#__PURE__*/React__default["default"].createElement(Text.Text, {
90
90
  title: tagTitle ? tagTitle : text,
91
91
  className: `${prefix}--tag__label`
92
- }, text), /*#__PURE__*/React__default["default"].createElement(Tooltip.Tooltip, {
92
+ }, text), normalizedSlug, /*#__PURE__*/React__default["default"].createElement(Tooltip.Tooltip, {
93
93
  label: isEllipsisApplied ? dismissLabel : title,
94
94
  align: "bottom",
95
95
  className: tooltipClasses,
@@ -101,7 +101,7 @@ const DismissibleTag = _ref => {
101
101
  onClick: handleClose,
102
102
  disabled: disabled,
103
103
  "aria-label": title
104
- }, _Close || (_Close = /*#__PURE__*/React__default["default"].createElement(iconsReact.Close, null)))), normalizedSlug));
104
+ }, _Close || (_Close = /*#__PURE__*/React__default["default"].createElement(iconsReact.Close, null))))));
105
105
  };
106
106
  DismissibleTag.propTypes = {
107
107
  /**
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
- import React, { MouseEventHandler, ReactNode } from 'react';
8
+ import React, { MouseEventHandler } from 'react';
9
9
  import { PolymorphicProps } from '../../types/common';
10
10
  import { SIZES } from './Tag';
11
11
  declare const TYPES: {
@@ -44,10 +44,6 @@ export interface OperationalTagBaseProps {
44
44
  * `md` (default) or `lg` sizes.
45
45
  */
46
46
  size?: keyof typeof SIZES;
47
- /**
48
- * **Experimental:** Provide a `Slug` component to be rendered inside the `OperationalTag` component
49
- */
50
- slug?: ReactNode;
51
47
  /**
52
48
  * Provide text to be rendered inside of a the tag.
53
49
  */
@@ -59,7 +55,7 @@ export interface OperationalTagBaseProps {
59
55
  }
60
56
  export type OperationalTagProps<T extends React.ElementType> = PolymorphicProps<T, OperationalTagBaseProps>;
61
57
  declare const OperationalTag: {
62
- <T extends React.ElementType<any, keyof React.JSX.IntrinsicElements>>({ className, disabled, id, renderIcon, slug, size, text, type, ...other }: OperationalTagProps<T>): import("react/jsx-runtime").JSX.Element;
58
+ <T extends React.ElementType<any, keyof React.JSX.IntrinsicElements>>({ className, disabled, id, renderIcon, size, text, type, ...other }: OperationalTagProps<T>): import("react/jsx-runtime").JSX.Element;
63
59
  propTypes: {
64
60
  /**
65
61
  * Provide a custom className that is applied to the containing <span>
@@ -83,10 +79,6 @@ declare const OperationalTag: {
83
79
  * `md` (default) or `lg` sizes.
84
80
  */
85
81
  size: PropTypes.Requireable<string>;
86
- /**
87
- * **Experimental:** Provide a `Slug` component to be rendered inside the `OperationalTag` component
88
- */
89
- slug: PropTypes.Requireable<PropTypes.ReactNodeLike>;
90
82
  /**
91
83
  * Provide text to be rendered inside of a the tag.
92
84
  */
@@ -46,7 +46,6 @@ const OperationalTag = _ref => {
46
46
  disabled,
47
47
  id,
48
48
  renderIcon,
49
- slug,
50
49
  size,
51
50
  text,
52
51
  type = 'gray',
@@ -61,13 +60,6 @@ const OperationalTag = _ref => {
61
60
  const newElement = tagRef.current?.getElementsByClassName(`${prefix}--tag__label`)[0];
62
61
  setIsEllipsisApplied(isEllipsisActive.isEllipsisActive(newElement));
63
62
  }, [prefix, tagRef]);
64
- let normalizedSlug;
65
- if (slug && slug['type']?.displayName === 'AILabel') {
66
- normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
67
- size: 'sm',
68
- kind: 'inline'
69
- });
70
- }
71
63
  const tooltipClasses = cx__default["default"](`${prefix}--icon-tooltip`, `${prefix}--tag-label-tooltip`);
72
64
  if (isEllipsisApplied) {
73
65
  return /*#__PURE__*/React__default["default"].createElement(Tooltip.Tooltip, {
@@ -88,7 +80,7 @@ const OperationalTag = _ref => {
88
80
  }, other), /*#__PURE__*/React__default["default"].createElement(Text.Text, {
89
81
  title: text,
90
82
  className: `${prefix}--tag__label`
91
- }, text), normalizedSlug));
83
+ }, text)));
92
84
  }
93
85
  return /*#__PURE__*/React__default["default"].createElement(Tag["default"], _rollupPluginBabelHelpers["extends"]({
94
86
  ref: tagRef,
@@ -98,7 +90,7 @@ const OperationalTag = _ref => {
98
90
  disabled: disabled,
99
91
  className: tagClasses,
100
92
  id: tagId
101
- }, other), normalizedSlug, /*#__PURE__*/React__default["default"].createElement(Text.Text, {
93
+ }, other), /*#__PURE__*/React__default["default"].createElement(Text.Text, {
102
94
  title: text,
103
95
  className: `${prefix}--tag__label`
104
96
  }, text));
@@ -126,10 +118,6 @@ OperationalTag.propTypes = {
126
118
  * `md` (default) or `lg` sizes.
127
119
  */
128
120
  size: PropTypes__default["default"].oneOf(Object.keys(Tag.SIZES)),
129
- /**
130
- * **Experimental:** Provide a `Slug` component to be rendered inside the `OperationalTag` component
131
- */
132
- slug: PropTypes__default["default"].node,
133
121
  /**
134
122
  * Provide text to be rendered inside of a the tag.
135
123
  */
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
- import React, { ReactNode } from 'react';
8
+ import React from 'react';
9
9
  import { PolymorphicProps } from '../../types/common';
10
10
  import { SIZES } from './Tag';
11
11
  export interface SelectableTagBaseProps {
@@ -35,10 +35,6 @@ export interface SelectableTagBaseProps {
35
35
  * `md` (default) or `lg` sizes.
36
36
  */
37
37
  size?: keyof typeof SIZES;
38
- /**
39
- * **Experimental:** Provide a `Slug` component to be rendered inside the `SelectableTag` component
40
- */
41
- slug?: ReactNode;
42
38
  /**
43
39
  * Provide text to be rendered inside of a the tag.
44
40
  */
@@ -46,7 +42,7 @@ export interface SelectableTagBaseProps {
46
42
  }
47
43
  export type SelectableTagProps<T extends React.ElementType> = PolymorphicProps<T, SelectableTagBaseProps>;
48
44
  declare const SelectableTag: {
49
- <T extends React.ElementType<any, keyof React.JSX.IntrinsicElements>>({ className, disabled, id, renderIcon, selected, slug, size, text, ...other }: SelectableTagProps<T>): import("react/jsx-runtime").JSX.Element;
45
+ <T extends React.ElementType<any, keyof React.JSX.IntrinsicElements>>({ className, disabled, id, renderIcon, selected, size, text, ...other }: SelectableTagProps<T>): import("react/jsx-runtime").JSX.Element;
50
46
  propTypes: {
51
47
  /**
52
48
  * Provide a custom className that is applied to the containing <span>
@@ -74,10 +70,6 @@ declare const SelectableTag: {
74
70
  * `md` (default) or `lg` sizes.
75
71
  */
76
72
  size: PropTypes.Requireable<string>;
77
- /**
78
- * **Experimental:** Provide a `Slug` component to be rendered inside the `SelectableTag` component
79
- */
80
- slug: PropTypes.Requireable<PropTypes.ReactNodeLike>;
81
73
  /**
82
74
  * Provide text to be rendered inside of a the tag.
83
75
  */
@@ -35,7 +35,6 @@ const SelectableTag = _ref => {
35
35
  id,
36
36
  renderIcon,
37
37
  selected = false,
38
- slug,
39
38
  size,
40
39
  text,
41
40
  ...other
@@ -52,13 +51,6 @@ const SelectableTag = _ref => {
52
51
  const newElement = tagRef.current?.getElementsByClassName(`${prefix}--tag__label`)[0];
53
52
  setIsEllipsisApplied(isEllipsisActive.isEllipsisActive(newElement));
54
53
  }, [prefix, tagRef]);
55
- let normalizedSlug;
56
- if (slug && slug['type']?.displayName === 'AILabel') {
57
- normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
58
- size: 'sm',
59
- kind: 'inline'
60
- });
61
- }
62
54
  const tooltipClasses = cx__default["default"](`${prefix}--icon-tooltip`, `${prefix}--tag-label-tooltip`);
63
55
 
64
56
  // Removing onClick from the spread operator
@@ -77,7 +69,6 @@ const SelectableTag = _ref => {
77
69
  }, /*#__PURE__*/React__default["default"].createElement(Tag["default"], _rollupPluginBabelHelpers["extends"]({
78
70
  "aria-pressed": selectedTag,
79
71
  ref: tagRef,
80
- slug: slug,
81
72
  size: size,
82
73
  renderIcon: renderIcon,
83
74
  disabled: disabled,
@@ -87,19 +78,18 @@ const SelectableTag = _ref => {
87
78
  }, otherProps), /*#__PURE__*/React__default["default"].createElement(Text.Text, {
88
79
  title: text,
89
80
  className: `${prefix}--tag__label`
90
- }, text), normalizedSlug));
81
+ }, text)));
91
82
  }
92
83
  return /*#__PURE__*/React__default["default"].createElement(Tag["default"], _rollupPluginBabelHelpers["extends"]({
93
84
  "aria-pressed": selectedTag,
94
85
  ref: tagRef,
95
- slug: slug,
96
86
  size: size,
97
87
  renderIcon: renderIcon,
98
88
  disabled: disabled,
99
89
  className: tagClasses,
100
90
  id: tagId,
101
91
  onClick: () => setSelectedTag(!selectedTag)
102
- }, otherProps), normalizedSlug, /*#__PURE__*/React__default["default"].createElement(Text.Text, {
92
+ }, otherProps), /*#__PURE__*/React__default["default"].createElement(Text.Text, {
103
93
  title: text,
104
94
  className: `${prefix}--tag__label`
105
95
  }, text));
@@ -131,10 +121,6 @@ SelectableTag.propTypes = {
131
121
  * `md` (default) or `lg` sizes.
132
122
  */
133
123
  size: PropTypes__default["default"].oneOf(Object.keys(Tag.SIZES)),
134
- /**
135
- * **Experimental:** Provide a `Slug` component to be rendered inside the `SelectableTag` component
136
- */
137
- slug: PropTypes__default["default"].node,
138
124
  /**
139
125
  * Provide text to be rendered inside of a the tag.
140
126
  */
@@ -113,6 +113,8 @@ function Toggle(_ref) {
113
113
  }, /*#__PURE__*/React__default["default"].createElement("div", {
114
114
  className: switchClasses
115
115
  }, isSm && /*#__PURE__*/React__default["default"].createElement("svg", {
116
+ "aria-hidden": "true",
117
+ focusable: "false",
116
118
  className: `${prefix}--toggle__check`,
117
119
  width: "6px",
118
120
  height: "5px",
@@ -0,0 +1,49 @@
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 React from 'react';
9
+ interface ToggleSmallSkeletonProps {
10
+ ['aria-label']: string;
11
+ /**
12
+ * Specify an optional className to add to the form item wrapper.
13
+ */
14
+ className?: string;
15
+ /**
16
+ * Provide an id that unique represents the underlying `<input>`
17
+ */
18
+ id?: string;
19
+ /**
20
+ * Provide the text that will be read by a screen reader when visiting this
21
+ * control
22
+ * `aria-label` is always required but will be null if `labelText` is also
23
+ * provided
24
+ */
25
+ labelText?: string;
26
+ }
27
+ declare class ToggleSmallSkeleton extends React.Component<ToggleSmallSkeletonProps> {
28
+ static propTypes: {
29
+ "aria-label": PropTypes.Validator<string>;
30
+ /**
31
+ * Specify an optional className to add to the form item wrapper.
32
+ */
33
+ className: PropTypes.Requireable<string>;
34
+ /**
35
+ * Provide an id that unique represents the underlying `<input>`
36
+ */
37
+ id: PropTypes.Requireable<string>;
38
+ /**
39
+ * Provide the text that will be read by a screen reader when visiting this
40
+ * control
41
+ * `aria-label` is always required but will be null if `labelText` is also
42
+ * provided
43
+ */
44
+ labelText: PropTypes.Requireable<string>;
45
+ };
46
+ render(): import("react/jsx-runtime").JSX.Element;
47
+ }
48
+ export default ToggleSmallSkeleton;
49
+ export { ToggleSmallSkeleton };
@@ -0,0 +1,7 @@
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
+ export * from './ToggleSmall.Skeleton';
@@ -281,9 +281,11 @@ const TreeNode = /*#__PURE__*/React__default["default"].forwardRef((_ref, forwar
281
281
  className: `${prefix}--tree-node__label__details`
282
282
  }, Icon && /*#__PURE__*/React__default["default"].createElement(Icon, {
283
283
  className: `${prefix}--tree-node__icon`
284
- }), label)), expanded && /*#__PURE__*/React__default["default"].createElement("ul", {
284
+ }), label)), /*#__PURE__*/React__default["default"].createElement("ul", {
285
285
  role: "group",
286
- className: `${prefix}--tree-node__children`
286
+ className: cx__default["default"](`${prefix}--tree-node__children`, {
287
+ [`${prefix}--tree-node--hidden`]: !expanded
288
+ })
287
289
  }, nodesWithProps));
288
290
  });
289
291
  TreeNode.propTypes = {
@@ -161,12 +161,12 @@ const TreeView = _ref => {
161
161
  }])) {
162
162
  const nodeIds = [];
163
163
  if (match.matches(event, [keys.Home, keys.End])) {
164
- if (multiselect && event.shiftKey && event.ctrlKey && treeWalker.current.currentNode instanceof Element && !treeWalker.current.currentNode.getAttribute('aria-disabled')) {
164
+ if (multiselect && event.shiftKey && event.ctrlKey && treeWalker.current.currentNode instanceof Element && !treeWalker.current.currentNode.getAttribute('aria-disabled') && !treeWalker.current.currentNode.classList.contains(`${prefix}--tree-node--hidden`)) {
165
165
  nodeIds.push(treeWalker.current.currentNode?.id);
166
166
  }
167
167
  while (match.match(event, keys.Home) ? treeWalker.current.previousNode() : treeWalker.current.nextNode()) {
168
168
  nextFocusNode = treeWalker.current.currentNode;
169
- if (multiselect && event.shiftKey && event.ctrlKey && nextFocusNode instanceof Element && !nextFocusNode.getAttribute('aria-disabled')) {
169
+ if (multiselect && event.shiftKey && event.ctrlKey && nextFocusNode instanceof Element && !nextFocusNode.getAttribute('aria-disabled') && !nextFocusNode.classList.contains(`${prefix}--tree-node--hidden`)) {
170
170
  nodeIds.push(nextFocusNode?.id);
171
171
  }
172
172
  }
@@ -177,7 +177,7 @@ const TreeView = _ref => {
177
177
  }) && event.ctrlKey) {
178
178
  treeWalker.current.currentNode = treeWalker.current.root;
179
179
  while (treeWalker.current.nextNode()) {
180
- if (treeWalker.current.currentNode instanceof Element && !treeWalker.current.currentNode.getAttribute('aria-disabled')) {
180
+ if (treeWalker.current.currentNode instanceof Element && !treeWalker.current.currentNode.getAttribute('aria-disabled') && !treeWalker.current.currentNode.classList.contains(`${prefix}--tree-node--hidden`)) {
181
181
  nodeIds.push(treeWalker.current.currentNode?.id);
182
182
  }
183
183
  }
@@ -199,7 +199,7 @@ const TreeView = _ref => {
199
199
  if (!(node instanceof Element)) {
200
200
  return NodeFilter.FILTER_SKIP;
201
201
  }
202
- if (node.classList.contains(`${prefix}--tree-node--disabled`)) {
202
+ if (node.classList.contains(`${prefix}--tree-node--disabled`) || node.classList.contains(`${prefix}--tree-node--hidden`)) {
203
203
  return NodeFilter.FILTER_REJECT;
204
204
  }
205
205
  if (node.matches(`li.${prefix}--tree-node`)) {
@@ -4,8 +4,9 @@
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 React, { HTMLAttributes } from 'react';
8
- interface SideNavMenuItemProps extends HTMLAttributes<HTMLElement> {
7
+ import React, { ComponentProps } from 'react';
8
+ import Link from './Link';
9
+ interface SideNavMenuItemProps extends ComponentProps<typeof Link> {
9
10
  /**
10
11
  * Specify the children to be rendered inside of the `SideNavMenuItem`
11
12
  */
@@ -25,5 +26,5 @@ interface SideNavMenuItemProps extends HTMLAttributes<HTMLElement> {
25
26
  */
26
27
  href?: string;
27
28
  }
28
- declare const SideNavMenuItem: React.ForwardRefExoticComponent<SideNavMenuItemProps & React.RefAttributes<HTMLElement>>;
29
+ declare const SideNavMenuItem: React.ForwardRefExoticComponent<Omit<SideNavMenuItemProps, "ref"> & React.RefAttributes<HTMLElement>>;
29
30
  export default SideNavMenuItem;
@@ -29,7 +29,6 @@ const SideNavMenuItem = /*#__PURE__*/React__default["default"].forwardRef(functi
29
29
  children,
30
30
  className: customClassName,
31
31
  isActive,
32
- href,
33
32
  ...rest
34
33
  } = props;
35
34
  const className = cx__default["default"](`${prefix}--side-nav__menu-item`, customClassName);
@@ -39,9 +38,7 @@ const SideNavMenuItem = /*#__PURE__*/React__default["default"].forwardRef(functi
39
38
  });
40
39
  return /*#__PURE__*/React__default["default"].createElement("li", {
41
40
  className: className
42
- }, /*#__PURE__*/React__default["default"].createElement(Link["default"], _rollupPluginBabelHelpers["extends"]({
43
- href: href
44
- }, rest, {
41
+ }, /*#__PURE__*/React__default["default"].createElement(Link["default"], _rollupPluginBabelHelpers["extends"]({}, rest, {
45
42
  className: linkClassName,
46
43
  ref: ref
47
44
  }), /*#__PURE__*/React__default["default"].createElement(SideNavLinkText["default"], null, children)));
package/lib/index.js CHANGED
@@ -22,6 +22,7 @@ var Button_Skeleton = require('./components/Button/Button.Skeleton.js');
22
22
  var ButtonSet = require('./components/ButtonSet/ButtonSet.js');
23
23
  var Checkbox = require('./components/Checkbox/Checkbox.js');
24
24
  var Checkbox_Skeleton = require('./components/Checkbox/Checkbox.Skeleton.js');
25
+ var CheckboxGroup = require('./components/CheckboxGroup/CheckboxGroup.js');
25
26
  var index$4 = require('./components/ClassPrefix/index.js');
26
27
  var CodeSnippet = require('./components/CodeSnippet/CodeSnippet.js');
27
28
  var CodeSnippet_Skeleton = require('./components/CodeSnippet/CodeSnippet.Skeleton.js');
@@ -215,7 +216,6 @@ var LayoutDirection = require('./components/LayoutDirection/LayoutDirection.js')
215
216
  var useLayoutDirection = require('./components/LayoutDirection/useLayoutDirection.js');
216
217
  var Text = require('./components/Text/Text.js');
217
218
  var TextDirection = require('./components/Text/TextDirection.js');
218
- var CheckboxGroup = require('./components/CheckboxGroup/CheckboxGroup.js');
219
219
  var DataTable = require('./components/DataTable/DataTable.js');
220
220
  var Table = require('./components/DataTable/Table.js');
221
221
  var TableActionList = require('./components/DataTable/TableActionList.js');
@@ -259,6 +259,7 @@ exports.ButtonSkeleton = Button_Skeleton["default"];
259
259
  exports.ButtonSet = ButtonSet["default"];
260
260
  exports.Checkbox = Checkbox["default"];
261
261
  exports.CheckboxSkeleton = Checkbox_Skeleton["default"];
262
+ exports.CheckboxGroup = CheckboxGroup["default"];
262
263
  exports.ClassPrefix = index$4.ClassPrefix;
263
264
  exports.CodeSnippet = CodeSnippet["default"];
264
265
  exports.CodeSnippetSkeleton = CodeSnippet_Skeleton["default"];
@@ -498,7 +499,6 @@ exports.unstable_LayoutDirection = LayoutDirection.LayoutDirection;
498
499
  exports.unstable_useLayoutDirection = useLayoutDirection.useLayoutDirection;
499
500
  exports.unstable_Text = Text.Text;
500
501
  exports.unstable_TextDirection = TextDirection.TextDirection;
501
- exports.CheckboxGroup = CheckboxGroup["default"];
502
502
  exports.DataTable = DataTable["default"];
503
503
  exports.Table = Table.Table;
504
504
  exports.TableActionList = TableActionList["default"];
@@ -0,0 +1,9 @@
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 from 'react';
8
+ export declare const IdPrefixContext: React.Context<string | null | undefined>;
9
+ export declare function useIdPrefix(): string | null | undefined;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/react",
3
3
  "description": "React components for the Carbon Design System",
4
- "version": "1.68.0",
4
+ "version": "1.69.0-rc.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -48,10 +48,10 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@babel/runtime": "^7.24.7",
51
- "@carbon/feature-flags": "^0.23.0",
52
- "@carbon/icons-react": "^11.51.0",
53
- "@carbon/layout": "^11.27.0",
54
- "@carbon/styles": "^1.67.0",
51
+ "@carbon/feature-flags": "^0.24.0-rc.0",
52
+ "@carbon/icons-react": "^11.52.0-rc.0",
53
+ "@carbon/layout": "^11.28.0-rc.0",
54
+ "@carbon/styles": "^1.68.0-rc.0",
55
55
  "@floating-ui/react": "^0.26.0",
56
56
  "@ibm/telemetry-js": "^1.5.0",
57
57
  "classnames": "2.5.1",
@@ -80,7 +80,7 @@
80
80
  "@babel/preset-react": "^7.24.7",
81
81
  "@babel/preset-typescript": "^7.24.7",
82
82
  "@carbon/test-utils": "^10.33.0",
83
- "@carbon/themes": "^11.42.0",
83
+ "@carbon/themes": "^11.43.0-rc.0",
84
84
  "@figma/code-connect": "^1.1.4",
85
85
  "@rollup/plugin-babel": "^6.0.0",
86
86
  "@rollup/plugin-commonjs": "^26.0.0",
@@ -144,5 +144,5 @@
144
144
  "**/*.scss",
145
145
  "**/*.css"
146
146
  ],
147
- "gitHead": "a4e466817cb1f68711d5691468dd12a6756c275e"
147
+ "gitHead": "e48f5e6815bd93e518e8da73c7555590b85cda22"
148
148
  }