@carbon/react 1.64.0 → 1.65.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 (40) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1482 -1743
  2. package/es/components/DataTable/DataTable.d.ts +18 -18
  3. package/es/components/DataTable/DataTable.js +2 -2
  4. package/es/components/DataTable/TableExpandRow.d.ts +1 -1
  5. package/es/components/DataTable/TableExpandRow.js +1 -1
  6. package/es/components/DataTable/TableSelectAll.d.ts +2 -2
  7. package/es/components/DataTable/TableSelectAll.js +1 -1
  8. package/es/components/DataTable/TableSelectRow.d.ts +2 -2
  9. package/es/components/DataTable/TableSelectRow.js +1 -1
  10. package/es/components/FileUploader/FileUploaderItem.js +5 -3
  11. package/es/components/Menu/Menu.js +1 -1
  12. package/es/components/OverflowMenu/next/index.js +11 -5
  13. package/es/components/PaginationNav/PaginationNav.d.ts +4 -0
  14. package/es/components/PaginationNav/PaginationNav.js +8 -1
  15. package/es/components/Tag/Tag.js +2 -1
  16. package/es/components/Text/Text.d.ts +1 -19
  17. package/es/components/Text/Text.js +5 -3
  18. package/es/components/TextInput/PasswordInput.js +7 -1
  19. package/es/components/TileGroup/TileGroup.js +2 -2
  20. package/es/components/UIShell/Content.d.ts +3 -3
  21. package/lib/components/DataTable/DataTable.d.ts +18 -18
  22. package/lib/components/DataTable/DataTable.js +2 -2
  23. package/lib/components/DataTable/TableExpandRow.d.ts +1 -1
  24. package/lib/components/DataTable/TableExpandRow.js +1 -1
  25. package/lib/components/DataTable/TableSelectAll.d.ts +2 -2
  26. package/lib/components/DataTable/TableSelectAll.js +1 -1
  27. package/lib/components/DataTable/TableSelectRow.d.ts +2 -2
  28. package/lib/components/DataTable/TableSelectRow.js +1 -1
  29. package/lib/components/FileUploader/FileUploaderItem.js +4 -2
  30. package/lib/components/Menu/Menu.js +1 -1
  31. package/lib/components/OverflowMenu/next/index.js +11 -5
  32. package/lib/components/PaginationNav/PaginationNav.d.ts +4 -0
  33. package/lib/components/PaginationNav/PaginationNav.js +8 -1
  34. package/lib/components/Tag/Tag.js +2 -1
  35. package/lib/components/Text/Text.d.ts +1 -19
  36. package/lib/components/Text/Text.js +5 -3
  37. package/lib/components/TextInput/PasswordInput.js +7 -1
  38. package/lib/components/TileGroup/TileGroup.js +2 -2
  39. package/lib/components/UIShell/Content.d.ts +3 -3
  40. package/package.json +11 -11
@@ -20,7 +20,7 @@ interface TableSelectAllProps {
20
20
  /**
21
21
  * Specify whether all items are selected, or not
22
22
  */
23
- checked: boolean;
23
+ checked?: boolean;
24
24
  /**
25
25
  * The CSS class names of the cell that wraps the underlying input control
26
26
  */
@@ -61,7 +61,7 @@ declare const TableSelectAll: {
61
61
  /**
62
62
  * Specify whether all items are selected, or not
63
63
  */
64
- checked: PropTypes.Validator<boolean>;
64
+ checked: PropTypes.Requireable<boolean>;
65
65
  /**
66
66
  * The CSS class names of the cell that wraps the underlying input control
67
67
  */
@@ -62,7 +62,7 @@ TableSelectAll.propTypes = {
62
62
  /**
63
63
  * Specify whether all items are selected, or not
64
64
  */
65
- checked: PropTypes__default["default"].bool.isRequired,
65
+ checked: PropTypes__default["default"].bool,
66
66
  /**
67
67
  * The CSS class names of the cell that wraps the underlying input control
68
68
  */
@@ -21,7 +21,7 @@ export interface TableSelectRowProps {
21
21
  /**
22
22
  * Specify whether this row is selected, or not
23
23
  */
24
- checked: boolean;
24
+ checked?: boolean;
25
25
  /**
26
26
  * The CSS class names of the cell that wraps the underlying input control
27
27
  */
@@ -66,7 +66,7 @@ declare const TableSelectRow: {
66
66
  /**
67
67
  * Specify whether this row is selected, or not
68
68
  */
69
- checked: PropTypes.Validator<boolean>;
69
+ checked: PropTypes.Requireable<boolean>;
70
70
  /**
71
71
  * The CSS class names of the cell that wraps the underlying input control
72
72
  */
@@ -78,7 +78,7 @@ TableSelectRow.propTypes = {
78
78
  /**
79
79
  * Specify whether this row is selected, or not
80
80
  */
81
- checked: PropTypes__default["default"].bool.isRequired,
81
+ checked: PropTypes__default["default"].bool,
82
82
  /**
83
83
  * The CSS class names of the cell that wraps the underlying input control
84
84
  */
@@ -44,6 +44,7 @@ function FileUploaderItem(_ref) {
44
44
  className,
45
45
  ...other
46
46
  } = _ref;
47
+ const textRef = React.useRef(null);
47
48
  const [isEllipsisApplied, setIsEllipsisApplied] = React.useState(false);
48
49
  const prefix = usePrefix.usePrefix();
49
50
  const {
@@ -63,8 +64,7 @@ function FileUploaderItem(_ref) {
63
64
  return element.offsetWidth < element.scrollWidth;
64
65
  };
65
66
  React.useLayoutEffect(() => {
66
- const element = document.querySelector(`[title="${name}"]`);
67
- isEllipsisActive(element);
67
+ isEllipsisActive(textRef.current);
68
68
  }, [prefix, name]);
69
69
  return /*#__PURE__*/React__default["default"].createElement("span", _rollupPluginBabelHelpers["extends"]({
70
70
  className: classes
@@ -78,11 +78,13 @@ function FileUploaderItem(_ref) {
78
78
  className: `${prefix}--file-filename-button`,
79
79
  type: "button"
80
80
  }, /*#__PURE__*/React__default["default"].createElement(Text.Text, {
81
+ ref: textRef,
81
82
  as: "p",
82
83
  title: name,
83
84
  className: `${prefix}--file-filename-button`,
84
85
  id: filterSpaceName(name)
85
86
  }, name)))) : /*#__PURE__*/React__default["default"].createElement(Text.Text, {
87
+ ref: textRef,
86
88
  as: "p",
87
89
  title: name,
88
90
  className: `${prefix}--file-filename`,
@@ -167,7 +167,7 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(_ref, forwardRef) {
167
167
  }
168
168
  if (indexToFocus !== currentItem) {
169
169
  const nodeToFocus = focusableItems[indexToFocus];
170
- nodeToFocus.ref.current.focus();
170
+ nodeToFocus.ref?.current?.focus();
171
171
  }
172
172
  }
173
173
  function handleBlur(e) {
@@ -48,16 +48,22 @@ const OverflowMenu = /*#__PURE__*/React__default["default"].forwardRef(function
48
48
  placement,
49
49
  middlewareData
50
50
  } = react.useFloating(autoAlign ? {
51
+ // Computing the position starts with initial positioning
52
+ // via `placement`.
51
53
  placement: menuAlignment,
52
54
  // The floating element is positioned relative to its nearest
53
- // containing block (usually the viewport). It will in many cases also
54
- // “break” the floating element out of a clipping ancestor.
55
+ // containing block (usually the viewport). It will in many cases
56
+ // also “break” the floating element out of a clipping ancestor.
55
57
  // https://floating-ui.com/docs/misc#clipping
56
58
  strategy: 'fixed',
57
- // Middleware order matters, arrow should be last
59
+ // Middleware are executed as an in-between “middle” step of the
60
+ // initial `placement` computation and eventual return of data for
61
+ // rendering. Each middleware is executed in order.
58
62
  middleware: [react.flip({
59
- fallbackAxisSideDirection: 'start',
60
- fallbackPlacements: ['top-start', 'top-end', 'bottom-start', 'bottom-end']
63
+ // An explicit array of placements to try if the initial
64
+ // `placement` doesn’t fit on the axes in which overflow
65
+ // is checked.
66
+ fallbackPlacements: menuAlignment.includes('bottom') ? ['bottom-start', 'bottom-end', 'top-start', 'top-end'] : ['top-start', 'top-end', 'bottom-start', 'bottom-end']
61
67
  })],
62
68
  whileElementsMounted: react.autoUpdate
63
69
  } : {} // When autoAlign is turned off, floating-ui will not be used
@@ -43,6 +43,10 @@ interface PaginationNavProps extends Omit<React.HTMLAttributes<HTMLElement>, 'on
43
43
  * The index of current page.
44
44
  */
45
45
  page?: number;
46
+ /**
47
+ * Specify the size of the PaginationNav.
48
+ */
49
+ size?: 'sm' | 'md' | 'lg';
46
50
  /**
47
51
  * The total number of items.
48
52
  */
@@ -185,6 +185,7 @@ const PaginationNav = /*#__PURE__*/React__default["default"].forwardRef(function
185
185
  itemsShown = 10,
186
186
  page = 0,
187
187
  loop = false,
188
+ size = 'lg',
188
189
  translateWithId: t = translateWithId,
189
190
  ...rest
190
191
  } = _ref4;
@@ -255,7 +256,9 @@ const PaginationNav = /*#__PURE__*/React__default["default"].forwardRef(function
255
256
  React.useEffect(() => {
256
257
  setIsOverFlowDisabled(disableOverflow);
257
258
  }, [disableOverflow]);
258
- const classNames = cx__default["default"](`${prefix}--pagination-nav`, className);
259
+ const classNames = cx__default["default"](`${prefix}--pagination-nav`, className, {
260
+ [`${prefix}--layout--size-${size}`]: size
261
+ });
259
262
  const backwardButtonDisabled = !loop && currentPage === 0;
260
263
  const forwardButtonDisabled = !loop && currentPage === totalItems - 1;
261
264
  const startOffset = itemsDisplayedOnPage <= 4 && currentPage > 1 ? 0 : 1;
@@ -408,6 +411,10 @@ PaginationNav.propTypes = {
408
411
  * The index of current page.
409
412
  */
410
413
  page: PropTypes__default["default"].number,
414
+ /**
415
+ * Specify the size of the PaginationNav.
416
+ */
417
+ size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg']),
411
418
  /**
412
419
  * The total number of items.
413
420
  */
@@ -132,7 +132,8 @@ const Tag = /*#__PURE__*/React__default["default"].forwardRef(function Tag(_ref,
132
132
  ref: ref,
133
133
  disabled: disabled,
134
134
  className: tagClasses,
135
- id: tagId
135
+ id: tagId,
136
+ type: ComponentTag === 'button' ? 'button' : undefined
136
137
  }, other), CustomIconElement && size !== 'sm' ? /*#__PURE__*/React__default["default"].createElement("div", {
137
138
  className: `${prefix}--tag__custom-icon`
138
139
  }, /*#__PURE__*/React__default["default"].createElement(CustomIconElement, null)) : '', isEllipsisApplied && !isInteractiveTag ? /*#__PURE__*/React__default["default"].createElement(DefinitionTooltip.DefinitionTooltip, {
@@ -4,7 +4,6 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import PropTypes from 'prop-types';
8
7
  import React from 'react';
9
8
  import { PolymorphicProps } from '../../types/common';
10
9
  import { TextDir } from './TextDirection';
@@ -12,22 +11,5 @@ export interface TextBaseProps {
12
11
  dir?: TextDir | undefined;
13
12
  }
14
13
  export type TextProps<T extends React.ElementType> = PolymorphicProps<T, TextBaseProps>;
15
- declare function Text<T extends React.ElementType>({ as, children, dir, ...rest }: TextProps<T>): import("react/jsx-runtime").JSX.Element;
16
- declare namespace Text {
17
- var propTypes: {
18
- /**
19
- * Provide a custom element type used to render the outermost node
20
- */
21
- as: PropTypes.Requireable<NonNullable<((...args: any[]) => any) | PropTypes.ReactComponentLike | null | undefined>>;
22
- /**
23
- * Provide child elements or text to be rendered inside of this component
24
- */
25
- children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
26
- /**
27
- * Specify the text direction to be used for this component and any of its
28
- * children
29
- */
30
- dir: PropTypes.Requireable<string>;
31
- };
32
- }
14
+ declare const Text: React.ForwardRefExoticComponent<Omit<TextProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<HTMLElement>>;
33
15
  export { Text };
@@ -19,7 +19,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
19
19
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
20
20
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
21
21
 
22
- function Text(_ref) {
22
+ const Text = /*#__PURE__*/React__default["default"].forwardRef(function Text(_ref, ref) {
23
23
  let {
24
24
  as,
25
25
  children,
@@ -59,8 +59,10 @@ function Text(_ref) {
59
59
  }
60
60
  return /*#__PURE__*/React__default["default"].createElement(TextDirectionContext.TextDirectionContext.Provider, {
61
61
  value: value
62
- }, /*#__PURE__*/React__default["default"].createElement(BaseComponent, _rollupPluginBabelHelpers["extends"]({}, rest, textProps), children));
63
- }
62
+ }, /*#__PURE__*/React__default["default"].createElement(BaseComponent, _rollupPluginBabelHelpers["extends"]({
63
+ ref: ref
64
+ }, rest, textProps), children));
65
+ });
64
66
  Text.propTypes = {
65
67
  /**
66
68
  * Provide a custom element type used to render the outermost node
@@ -97,10 +97,12 @@ const PasswordInput = /*#__PURE__*/React__default["default"].forwardRef(function
97
97
  placeholder,
98
98
  type: inputType,
99
99
  className: textInputClasses,
100
+ readOnly,
100
101
  ref,
101
102
  ...rest
102
103
  };
103
104
  const inputWrapperClasses = cx__default["default"](`${prefix}--form-item`, `${prefix}--text-input-wrapper`, `${prefix}--password-input-wrapper`, {
105
+ [`${prefix}--text-input-wrapper--readonly`]: readOnly,
104
106
  [`${prefix}--text-input-wrapper--light`]: light,
105
107
  [`${prefix}--text-input-wrapper--inline`]: inline,
106
108
  [`${prefix}--text-input--fluid`]: isFluid
@@ -183,7 +185,7 @@ const PasswordInput = /*#__PURE__*/React__default["default"].forwardRef(function
183
185
  }, /*#__PURE__*/React__default["default"].createElement("button", {
184
186
  type: "button",
185
187
  className: passwordVisibilityToggleClasses,
186
- disabled: disabled,
188
+ disabled: disabled || readOnly,
187
189
  onClick: handleTogglePasswordVisibility
188
190
  }, passwordVisibilityIcon)));
189
191
  React.useEffect(() => {
@@ -242,6 +244,10 @@ PasswordInput.propTypes = {
242
244
  * Specify whether the control is currently invalid
243
245
  */
244
246
  invalid: PropTypes__default["default"].bool,
247
+ /**
248
+ * Whether the PasswordInput should be read-only
249
+ */
250
+ readOnly: PropTypes__default["default"].bool,
245
251
  /**
246
252
  * Provide the text that is displayed when the control is in an invalid state
247
253
  */
@@ -49,7 +49,7 @@ const TileGroup = props => {
49
49
  const traverseAndModifyChildren = children => {
50
50
  return React__default["default"].Children.map(children, child => {
51
51
  // If RadioTile found, return it with necessary props
52
- if (child.type === RadioTile["default"]) {
52
+ if (child?.type === RadioTile["default"]) {
53
53
  const {
54
54
  value,
55
55
  ...otherProps
@@ -62,7 +62,7 @@ const TileGroup = props => {
62
62
  onChange: handleChange,
63
63
  checked: value === selected
64
64
  }));
65
- } else if (child.props && child.props.children) {
65
+ } else if (child?.props?.children) {
66
66
  // If the child is not RadioTile and has children, recheck the children
67
67
  return /*#__PURE__*/React__default["default"].cloneElement(child, {
68
68
  ...child.props,
@@ -82,12 +82,12 @@ declare const Content: {
82
82
  "aria-colindextext"?: string | undefined;
83
83
  "aria-colspan"?: number | undefined;
84
84
  "aria-controls"?: string | undefined;
85
- "aria-current"?: boolean | "true" | "false" | "time" | "page" | "step" | "location" | "date" | undefined;
85
+ "aria-current"?: boolean | "true" | "false" | "time" | "date" | "step" | "page" | "location" | undefined;
86
86
  "aria-describedby"?: string | undefined;
87
87
  "aria-description"?: string | undefined;
88
88
  "aria-details"?: string | undefined;
89
89
  "aria-disabled"?: (boolean | "true" | "false") | undefined;
90
- "aria-dropeffect"?: "link" | "none" | "copy" | "execute" | "move" | "popup" | undefined;
90
+ "aria-dropeffect"?: "link" | "none" | "copy" | "move" | "execute" | "popup" | undefined;
91
91
  "aria-errormessage"?: string | undefined;
92
92
  "aria-expanded"?: (boolean | "true" | "false") | undefined;
93
93
  "aria-flowto"?: string | undefined;
@@ -109,7 +109,7 @@ declare const Content: {
109
109
  "aria-posinset"?: number | undefined;
110
110
  "aria-pressed"?: boolean | "true" | "false" | "mixed" | undefined;
111
111
  "aria-readonly"?: (boolean | "true" | "false") | undefined;
112
- "aria-relevant"?: "text" | "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
112
+ "aria-relevant"?: "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
113
113
  "aria-required"?: (boolean | "true" | "false") | undefined;
114
114
  "aria-roledescription"?: string | undefined;
115
115
  "aria-rowcount"?: number | 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.64.0",
4
+ "version": "1.65.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.21.0",
52
- "@carbon/icons-react": "^11.47.0",
53
- "@carbon/layout": "^11.24.0",
54
- "@carbon/styles": "^1.63.0",
51
+ "@carbon/feature-flags": "^0.22.0-rc.0",
52
+ "@carbon/icons-react": "^11.48.0-rc.0",
53
+ "@carbon/layout": "^11.25.0-rc.0",
54
+ "@carbon/styles": "^1.64.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",
@@ -79,8 +79,8 @@
79
79
  "@babel/preset-env": "^7.24.7",
80
80
  "@babel/preset-react": "^7.24.7",
81
81
  "@babel/preset-typescript": "^7.24.7",
82
- "@carbon/test-utils": "^10.30.0",
83
- "@carbon/themes": "^11.38.0",
82
+ "@carbon/test-utils": "^10.31.0-rc.0",
83
+ "@carbon/themes": "^11.39.0-rc.0",
84
84
  "@figma/code-connect": "^1.0.4",
85
85
  "@rollup/plugin-babel": "^6.0.0",
86
86
  "@rollup/plugin-commonjs": "^26.0.0",
@@ -117,7 +117,7 @@
117
117
  "react-dom": "^18.2.0",
118
118
  "remark-gfm": "^3.0.1",
119
119
  "requestanimationframe": "^0.0.23",
120
- "rimraf": "^5.0.0",
120
+ "rimraf": "^6.0.0",
121
121
  "rollup": "^2.79.1",
122
122
  "rollup-plugin-strip-banner": "^3.0.0",
123
123
  "sass": "^1.51.0",
@@ -125,8 +125,8 @@
125
125
  "storybook": "^7.1.0",
126
126
  "storybook-addon-accessibility-checker": "^3.1.61-rc.3",
127
127
  "stream-browserify": "^3.0.0",
128
- "style-loader": "^3.3.1",
129
- "typescript-config-carbon": "^0.2.0",
128
+ "style-loader": "^4.0.0",
129
+ "typescript-config-carbon": "^0.3.0-rc.0",
130
130
  "webpack": "^5.65.0",
131
131
  "webpack-dev-server": "^4.7.4"
132
132
  },
@@ -141,5 +141,5 @@
141
141
  "**/*.scss",
142
142
  "**/*.css"
143
143
  ],
144
- "gitHead": "185c4cf3598df1050c197870455c01775e21c366"
144
+ "gitHead": "5e14bf5949724bee568601e514b5ce18e50d4525"
145
145
  }