@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
@@ -17,6 +17,7 @@ import { useWindowEvent } from '../../internal/useEvent.js';
17
17
  import { mapPopoverAlignProp } from '../../tools/createPropAdapter.js';
18
18
  import { useFloating, offset, flip, arrow, autoUpdate } from '@floating-ui/react';
19
19
  import { hide } from '../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js';
20
+ import { useFeatureFlag } from '../FeatureFlags/index.js';
20
21
 
21
22
  const PopoverContext = /*#__PURE__*/React__default.createContext({
22
23
  setFloating: {
@@ -65,6 +66,7 @@ const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFun
65
66
  const floating = useRef(null);
66
67
  const caretRef = useRef(null);
67
68
  const popover = useRef(null);
69
+ const enableFloatingStyles = useFeatureFlag('enable-v12-dynamic-floating-styles') || autoAlign;
68
70
  let align = mapPopoverAlignProp(initialAlign);
69
71
 
70
72
  // If the `Popover` is the last focusable item in the tab order, it should also close when the browser window loses focus (#12922)
@@ -117,7 +119,7 @@ const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFun
117
119
  floatingStyles,
118
120
  placement,
119
121
  middlewareData
120
- } = useFloating(autoAlign ? {
122
+ } = useFloating(enableFloatingStyles ? {
121
123
  placement: align,
122
124
  // The floating element is positioned relative to its nearest
123
125
  // containing block (usually the viewport). It will in many cases also
@@ -125,13 +127,15 @@ const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFun
125
127
  // https://floating-ui.com/docs/misc#clipping
126
128
  strategy: 'fixed',
127
129
  // Middleware order matters, arrow should be last
128
- middleware: [offset(!isTabTip ? popoverDimensions?.current?.offset : 0), flip({
130
+ middleware: [offset(!isTabTip ? popoverDimensions?.current?.offset : 0), autoAlign && flip({
129
131
  fallbackAxisSideDirection: 'start'
130
132
  }), arrow({
131
133
  element: caretRef
132
- }), hide()],
134
+ }), autoAlign && hide()],
133
135
  whileElementsMounted: autoUpdate
134
- } : {} // When autoAlign is turned off, floating-ui will not be used
136
+ } : {}
137
+ // When autoAlign is turned off & the `enable-v12-dynamic-floating-styles` feature flag is not
138
+ // enabled, floating-ui will not be used
135
139
  );
136
140
  const value = useMemo(() => {
137
141
  return {
@@ -148,7 +152,7 @@ const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFun
148
152
  }
149
153
  }
150
154
  useEffect(() => {
151
- if (autoAlign) {
155
+ if (enableFloatingStyles) {
152
156
  const updatedFloatingStyles = {
153
157
  ...floatingStyles,
154
158
  visibility: middlewareData.hide?.referenceHidden ? 'hidden' : 'visible'
@@ -180,7 +184,7 @@ const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFun
180
184
  }
181
185
  }
182
186
  }
183
- }, [floatingStyles, refs.floating, autoAlign, middlewareData, placement, caret]);
187
+ }, [floatingStyles, refs.floating, enableFloatingStyles, middlewareData, placement, caret]);
184
188
  const ref = useMergedRefs([forwardRef, popover]);
185
189
  const currentAlignment = autoAlign && placement !== align ? placement : align;
186
190
  const className = cx({
@@ -189,7 +193,7 @@ const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFun
189
193
  [`${prefix}--popover--drop-shadow`]: dropShadow,
190
194
  [`${prefix}--popover--high-contrast`]: highContrast,
191
195
  [`${prefix}--popover--open`]: open,
192
- [`${prefix}--popover--auto-align ${prefix}--autoalign`]: autoAlign,
196
+ [`${prefix}--popover--auto-align ${prefix}--autoalign`]: enableFloatingStyles,
193
197
  [`${prefix}--popover--${currentAlignment}`]: true,
194
198
  [`${prefix}--popover--tab-tip`]: isTabTip
195
199
  }, customClassName);
@@ -205,8 +209,8 @@ const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFun
205
209
  * is on, even if they are a trigger element.
206
210
  */
207
211
  const isTriggerElement = item?.type === 'button';
208
- const isTriggerComponent = autoAlign && displayName && ['ToggletipButton'].includes(displayName);
209
- const isAllowedTriggerComponent = autoAlign && !['ToggletipContent', 'PopoverContent'].includes(displayName);
212
+ const isTriggerComponent = enableFloatingStyles && displayName && ['ToggletipButton'].includes(displayName);
213
+ const isAllowedTriggerComponent = enableFloatingStyles && !['ToggletipContent', 'PopoverContent'].includes(displayName);
210
214
  if ( /*#__PURE__*/React__default.isValidElement(item) && (isTriggerElement || isTriggerComponent || isAllowedTriggerComponent)) {
211
215
  const className = item?.props?.className;
212
216
  const ref = (item?.props).ref;
@@ -225,7 +229,7 @@ const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFun
225
229
  // For a toggletip there is a specific trigger component, ToggletipButton.
226
230
  // In either of these caes we want to set this as the reference node for floating-ui autoAlign
227
231
  // positioning.
228
- if (autoAlign && item?.type?.displayName !== 'PopoverContent' || autoAlign && item?.type?.displayName === 'ToggletipButton') {
232
+ if (enableFloatingStyles && item?.type?.displayName !== 'PopoverContent' || enableFloatingStyles && item?.type?.displayName === 'ToggletipButton') {
229
233
  // Set the reference element for floating-ui
230
234
  refs.setReference(node);
231
235
  }
@@ -248,7 +252,7 @@ const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFun
248
252
  }, /*#__PURE__*/React__default.createElement(BaseComponentAsAny, _extends({}, rest, {
249
253
  className: className,
250
254
  ref: ref
251
- }), autoAlign || isTabTip ? mappedChildren : children));
255
+ }), enableFloatingStyles || isTabTip ? mappedChildren : children));
252
256
  });
253
257
 
254
258
  // Note: this displayName is temporarily set so that Storybook ArgTable
@@ -259,7 +263,6 @@ if (process.env.NODE_ENV !== "production") {
259
263
  Popover.propTypes = {
260
264
  /**
261
265
  * Specify how the popover should align with the trigger element
262
-
263
266
  */
264
267
  align: deprecateValuesWithin(PropTypes.oneOf(['top', 'top-left',
265
268
  // deprecated use top-start instead
@@ -345,18 +348,19 @@ _ref2, forwardRef) {
345
348
  autoAlign
346
349
  } = React__default.useContext(PopoverContext);
347
350
  const ref = useMergedRefs([setFloating, forwardRef]);
351
+ const enableFloatingStyles = useFeatureFlag('enable-v12-dynamic-floating-styles') || autoAlign;
348
352
  return /*#__PURE__*/React__default.createElement("span", _extends({}, rest, {
349
353
  className: `${prefix}--popover`
350
354
  }), /*#__PURE__*/React__default.createElement("span", {
351
355
  className: cx(`${prefix}--popover-content`, className),
352
356
  ref: ref
353
- }, children, autoAlign && /*#__PURE__*/React__default.createElement("span", {
357
+ }, children, enableFloatingStyles && /*#__PURE__*/React__default.createElement("span", {
354
358
  className: cx({
355
359
  [`${prefix}--popover-caret`]: true,
356
360
  [`${prefix}--popover--auto-align`]: true
357
361
  }),
358
362
  ref: caretRef
359
- })), !autoAlign && /*#__PURE__*/React__default.createElement("span", {
363
+ })), !enableFloatingStyles && /*#__PURE__*/React__default.createElement("span", {
360
364
  className: cx({
361
365
  [`${prefix}--popover-caret`]: true
362
366
  }),
@@ -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 };
@@ -1103,7 +1103,7 @@ class Slider extends PureComponent {
1103
1103
  className: lowerThumbClasses,
1104
1104
  role: "slider",
1105
1105
  id: twoHandles ? undefined : id,
1106
- tabIndex: !readOnly ? 0 : -1,
1106
+ tabIndex: readOnly || disabled ? undefined : 0,
1107
1107
  "aria-valuetext": `${formatLabel(value, '')}`,
1108
1108
  "aria-valuemax": twoHandles ? valueUpper : max,
1109
1109
  "aria-valuemin": min,
@@ -1122,7 +1122,7 @@ class Slider extends PureComponent {
1122
1122
  }, upperThumbWrapperProps), /*#__PURE__*/React__default.createElement("div", {
1123
1123
  className: upperThumbClasses,
1124
1124
  role: "slider",
1125
- tabIndex: !readOnly ? 0 : -1,
1125
+ tabIndex: readOnly || disabled ? undefined : 0,
1126
1126
  "aria-valuemax": max,
1127
1127
  "aria-valuemin": value,
1128
1128
  "aria-valuenow": valueUpper,
@@ -79,7 +79,7 @@ const DismissibleTag = _ref => {
79
79
  }, /*#__PURE__*/React__default.createElement(Text, {
80
80
  title: tagTitle ? tagTitle : text,
81
81
  className: `${prefix}--tag__label`
82
- }, text), /*#__PURE__*/React__default.createElement(Tooltip, {
82
+ }, text), normalizedSlug, /*#__PURE__*/React__default.createElement(Tooltip, {
83
83
  label: isEllipsisApplied ? dismissLabel : title,
84
84
  align: "bottom",
85
85
  className: tooltipClasses,
@@ -91,7 +91,7 @@ const DismissibleTag = _ref => {
91
91
  onClick: handleClose,
92
92
  disabled: disabled,
93
93
  "aria-label": title
94
- }, _Close || (_Close = /*#__PURE__*/React__default.createElement(Close, null)))), normalizedSlug));
94
+ }, _Close || (_Close = /*#__PURE__*/React__default.createElement(Close, null))))));
95
95
  };
96
96
  DismissibleTag.propTypes = {
97
97
  /**
@@ -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
  */
@@ -36,7 +36,6 @@ const OperationalTag = _ref => {
36
36
  disabled,
37
37
  id,
38
38
  renderIcon,
39
- slug,
40
39
  size,
41
40
  text,
42
41
  type = 'gray',
@@ -51,13 +50,6 @@ const OperationalTag = _ref => {
51
50
  const newElement = tagRef.current?.getElementsByClassName(`${prefix}--tag__label`)[0];
52
51
  setIsEllipsisApplied(isEllipsisActive(newElement));
53
52
  }, [prefix, tagRef]);
54
- let normalizedSlug;
55
- if (slug && slug['type']?.displayName === 'AILabel') {
56
- normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
57
- size: 'sm',
58
- kind: 'inline'
59
- });
60
- }
61
53
  const tooltipClasses = cx(`${prefix}--icon-tooltip`, `${prefix}--tag-label-tooltip`);
62
54
  if (isEllipsisApplied) {
63
55
  return /*#__PURE__*/React__default.createElement(Tooltip, {
@@ -78,7 +70,7 @@ const OperationalTag = _ref => {
78
70
  }, other), /*#__PURE__*/React__default.createElement(Text, {
79
71
  title: text,
80
72
  className: `${prefix}--tag__label`
81
- }, text), normalizedSlug));
73
+ }, text)));
82
74
  }
83
75
  return /*#__PURE__*/React__default.createElement(Tag, _extends({
84
76
  ref: tagRef,
@@ -88,7 +80,7 @@ const OperationalTag = _ref => {
88
80
  disabled: disabled,
89
81
  className: tagClasses,
90
82
  id: tagId
91
- }, other), normalizedSlug, /*#__PURE__*/React__default.createElement(Text, {
83
+ }, other), /*#__PURE__*/React__default.createElement(Text, {
92
84
  title: text,
93
85
  className: `${prefix}--tag__label`
94
86
  }, text));
@@ -116,10 +108,6 @@ OperationalTag.propTypes = {
116
108
  * `md` (default) or `lg` sizes.
117
109
  */
118
110
  size: PropTypes.oneOf(Object.keys(SIZES)),
119
- /**
120
- * **Experimental:** Provide a `Slug` component to be rendered inside the `OperationalTag` component
121
- */
122
- slug: PropTypes.node,
123
111
  /**
124
112
  * Provide text to be rendered inside of a the tag.
125
113
  */
@@ -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
  */
@@ -25,7 +25,6 @@ const SelectableTag = _ref => {
25
25
  id,
26
26
  renderIcon,
27
27
  selected = false,
28
- slug,
29
28
  size,
30
29
  text,
31
30
  ...other
@@ -42,13 +41,6 @@ const SelectableTag = _ref => {
42
41
  const newElement = tagRef.current?.getElementsByClassName(`${prefix}--tag__label`)[0];
43
42
  setIsEllipsisApplied(isEllipsisActive(newElement));
44
43
  }, [prefix, tagRef]);
45
- let normalizedSlug;
46
- if (slug && slug['type']?.displayName === 'AILabel') {
47
- normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
48
- size: 'sm',
49
- kind: 'inline'
50
- });
51
- }
52
44
  const tooltipClasses = cx(`${prefix}--icon-tooltip`, `${prefix}--tag-label-tooltip`);
53
45
 
54
46
  // Removing onClick from the spread operator
@@ -67,7 +59,6 @@ const SelectableTag = _ref => {
67
59
  }, /*#__PURE__*/React__default.createElement(Tag, _extends({
68
60
  "aria-pressed": selectedTag,
69
61
  ref: tagRef,
70
- slug: slug,
71
62
  size: size,
72
63
  renderIcon: renderIcon,
73
64
  disabled: disabled,
@@ -77,19 +68,18 @@ const SelectableTag = _ref => {
77
68
  }, otherProps), /*#__PURE__*/React__default.createElement(Text, {
78
69
  title: text,
79
70
  className: `${prefix}--tag__label`
80
- }, text), normalizedSlug));
71
+ }, text)));
81
72
  }
82
73
  return /*#__PURE__*/React__default.createElement(Tag, _extends({
83
74
  "aria-pressed": selectedTag,
84
75
  ref: tagRef,
85
- slug: slug,
86
76
  size: size,
87
77
  renderIcon: renderIcon,
88
78
  disabled: disabled,
89
79
  className: tagClasses,
90
80
  id: tagId,
91
81
  onClick: () => setSelectedTag(!selectedTag)
92
- }, otherProps), normalizedSlug, /*#__PURE__*/React__default.createElement(Text, {
82
+ }, otherProps), /*#__PURE__*/React__default.createElement(Text, {
93
83
  title: text,
94
84
  className: `${prefix}--tag__label`
95
85
  }, text));
@@ -121,10 +111,6 @@ SelectableTag.propTypes = {
121
111
  * `md` (default) or `lg` sizes.
122
112
  */
123
113
  size: PropTypes.oneOf(Object.keys(SIZES)),
124
- /**
125
- * **Experimental:** Provide a `Slug` component to be rendered inside the `SelectableTag` component
126
- */
127
- slug: PropTypes.node,
128
114
  /**
129
115
  * Provide text to be rendered inside of a the tag.
130
116
  */
@@ -103,6 +103,8 @@ function Toggle(_ref) {
103
103
  }, /*#__PURE__*/React__default.createElement("div", {
104
104
  className: switchClasses
105
105
  }, isSm && /*#__PURE__*/React__default.createElement("svg", {
106
+ "aria-hidden": "true",
107
+ focusable: "false",
106
108
  className: `${prefix}--toggle__check`,
107
109
  width: "6px",
108
110
  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';
@@ -271,9 +271,11 @@ const TreeNode = /*#__PURE__*/React__default.forwardRef((_ref, forwardedRef) =>
271
271
  className: `${prefix}--tree-node__label__details`
272
272
  }, Icon && /*#__PURE__*/React__default.createElement(Icon, {
273
273
  className: `${prefix}--tree-node__icon`
274
- }), label)), expanded && /*#__PURE__*/React__default.createElement("ul", {
274
+ }), label)), /*#__PURE__*/React__default.createElement("ul", {
275
275
  role: "group",
276
- className: `${prefix}--tree-node__children`
276
+ className: cx(`${prefix}--tree-node__children`, {
277
+ [`${prefix}--tree-node--hidden`]: !expanded
278
+ })
277
279
  }, nodesWithProps));
278
280
  });
279
281
  TreeNode.propTypes = {
@@ -151,12 +151,12 @@ const TreeView = _ref => {
151
151
  }])) {
152
152
  const nodeIds = [];
153
153
  if (matches(event, [Home, End])) {
154
- if (multiselect && event.shiftKey && event.ctrlKey && treeWalker.current.currentNode instanceof Element && !treeWalker.current.currentNode.getAttribute('aria-disabled')) {
154
+ 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`)) {
155
155
  nodeIds.push(treeWalker.current.currentNode?.id);
156
156
  }
157
157
  while (match(event, Home) ? treeWalker.current.previousNode() : treeWalker.current.nextNode()) {
158
158
  nextFocusNode = treeWalker.current.currentNode;
159
- if (multiselect && event.shiftKey && event.ctrlKey && nextFocusNode instanceof Element && !nextFocusNode.getAttribute('aria-disabled')) {
159
+ if (multiselect && event.shiftKey && event.ctrlKey && nextFocusNode instanceof Element && !nextFocusNode.getAttribute('aria-disabled') && !nextFocusNode.classList.contains(`${prefix}--tree-node--hidden`)) {
160
160
  nodeIds.push(nextFocusNode?.id);
161
161
  }
162
162
  }
@@ -167,7 +167,7 @@ const TreeView = _ref => {
167
167
  }) && event.ctrlKey) {
168
168
  treeWalker.current.currentNode = treeWalker.current.root;
169
169
  while (treeWalker.current.nextNode()) {
170
- if (treeWalker.current.currentNode instanceof Element && !treeWalker.current.currentNode.getAttribute('aria-disabled')) {
170
+ if (treeWalker.current.currentNode instanceof Element && !treeWalker.current.currentNode.getAttribute('aria-disabled') && !treeWalker.current.currentNode.classList.contains(`${prefix}--tree-node--hidden`)) {
171
171
  nodeIds.push(treeWalker.current.currentNode?.id);
172
172
  }
173
173
  }
@@ -189,7 +189,7 @@ const TreeView = _ref => {
189
189
  if (!(node instanceof Element)) {
190
190
  return NodeFilter.FILTER_SKIP;
191
191
  }
192
- if (node.classList.contains(`${prefix}--tree-node--disabled`)) {
192
+ if (node.classList.contains(`${prefix}--tree-node--disabled`) || node.classList.contains(`${prefix}--tree-node--hidden`)) {
193
193
  return NodeFilter.FILTER_REJECT;
194
194
  }
195
195
  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;
@@ -19,7 +19,6 @@ const SideNavMenuItem = /*#__PURE__*/React__default.forwardRef(function SideNavM
19
19
  children,
20
20
  className: customClassName,
21
21
  isActive,
22
- href,
23
22
  ...rest
24
23
  } = props;
25
24
  const className = cx(`${prefix}--side-nav__menu-item`, customClassName);
@@ -29,9 +28,7 @@ const SideNavMenuItem = /*#__PURE__*/React__default.forwardRef(function SideNavM
29
28
  });
30
29
  return /*#__PURE__*/React__default.createElement("li", {
31
30
  className: className
32
- }, /*#__PURE__*/React__default.createElement(Link, _extends({
33
- href: href
34
- }, rest, {
31
+ }, /*#__PURE__*/React__default.createElement(Link, _extends({}, rest, {
35
32
  className: linkClassName,
36
33
  ref: ref
37
34
  }), /*#__PURE__*/React__default.createElement(SideNavLinkText, null, children)));
package/es/index.js CHANGED
@@ -18,6 +18,7 @@ export { default as ButtonSkeleton } from './components/Button/Button.Skeleton.j
18
18
  export { default as ButtonSet } from './components/ButtonSet/ButtonSet.js';
19
19
  export { default as Checkbox } from './components/Checkbox/Checkbox.js';
20
20
  export { default as CheckboxSkeleton } from './components/Checkbox/Checkbox.Skeleton.js';
21
+ export { default as CheckboxGroup } from './components/CheckboxGroup/CheckboxGroup.js';
21
22
  export { ClassPrefix } from './components/ClassPrefix/index.js';
22
23
  export { default as CodeSnippet } from './components/CodeSnippet/CodeSnippet.js';
23
24
  export { default as CodeSnippetSkeleton } from './components/CodeSnippet/CodeSnippet.Skeleton.js';
@@ -211,7 +212,6 @@ export { LayoutDirection as unstable_LayoutDirection } from './components/Layout
211
212
  export { useLayoutDirection as unstable_useLayoutDirection } from './components/LayoutDirection/useLayoutDirection.js';
212
213
  export { Text as unstable_Text } from './components/Text/Text.js';
213
214
  export { TextDirection as unstable_TextDirection } from './components/Text/TextDirection.js';
214
- export { default as CheckboxGroup } from './components/CheckboxGroup/CheckboxGroup.js';
215
215
  export { default as DataTable } from './components/DataTable/DataTable.js';
216
216
  export { Table } from './components/DataTable/Table.js';
217
217
  export { default as TableActionList } from './components/DataTable/TableActionList.js';
@@ -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;
@@ -118,7 +118,6 @@ function AccordionItem(_ref) {
118
118
  className: `${prefix}--accordion__title`
119
119
  }, title)), /*#__PURE__*/React__default["default"].createElement("div", {
120
120
  ref: content,
121
- hidden: !isOpen,
122
121
  className: `${prefix}--accordion__wrapper`,
123
122
  onTransitionEnd: onAnimationEnd
124
123
  }, /*#__PURE__*/React__default["default"].createElement("div", {
@@ -35,6 +35,7 @@ const Button = /*#__PURE__*/React__default["default"].forwardRef(function Button
35
35
  const tooltipRef = React.useRef(null);
36
36
  const {
37
37
  as,
38
+ autoAlign = false,
38
39
  children,
39
40
  hasIconOnly = false,
40
41
  iconDescription,
@@ -93,6 +94,7 @@ const Button = /*#__PURE__*/React__default["default"].forwardRef(function Button
93
94
  onMouseLeave: onMouseLeave,
94
95
  onFocus: onFocus,
95
96
  onBlur: onBlur,
97
+ autoAlign: autoAlign,
96
98
  onClick: events.composeEventHandlers([onClick, handleClick]),
97
99
  renderIcon: iconOnlyImage ? null : ButtonImageElement // avoid doubling the icon.
98
100
  }), iconOnlyImage ?? children);
@@ -105,6 +107,10 @@ Button.propTypes = {
105
107
  * Make sure to apply all props to the root node and render children appropriately
106
108
  */
107
109
  as: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].string, PropTypes__default["default"].elementType]),
110
+ /**
111
+ * **Experimental**: Will attempt to automatically align the tooltip
112
+ */
113
+ autoAlign: PropTypes__default["default"].bool,
108
114
  /**
109
115
  * Specify the content of your Button
110
116
  */
@@ -136,6 +136,5 @@ CheckboxGroup.propTypes = {
136
136
  */
137
137
  warnText: PropTypes__default["default"].node
138
138
  };
139
- var CheckboxGroup$1 = CheckboxGroup;
140
139
 
141
- exports["default"] = CheckboxGroup$1;
140
+ exports["default"] = CheckboxGroup;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Copyright IBM Corp. 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 CheckboxGroup from './CheckboxGroup';
8
+ import { type CheckboxGroupProps, type CustomType } from './CheckboxGroup';
9
+ export default CheckboxGroup;
10
+ export { CheckboxGroup, type CheckboxGroupProps, type CustomType };