@itwin/itwinui-react 3.11.0 → 3.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.11.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2074](https://github.com/iTwin/iTwinUI/pull/2074): Fixed indentation of `Tree` nodes to be aligned regardless of the presence of expander button.
8
+ - [#2064](https://github.com/iTwin/iTwinUI/pull/2064): Adjusted `Dialog` and `ExpandableBlock` to round some CSS `transform` values. This helps avoid blurry text on Windows in some cases.
9
+ - [#2055](https://github.com/iTwin/iTwinUI/pull/2055): Fixed an issue in `Breadcrumbs.Item` where using a custom link component (e.g. `as={Link}` for client side routing) would break the CSS styling.
10
+ - [#2071](https://github.com/iTwin/iTwinUI/pull/2071): Fixed a minor issue in `ComboBox` where a `label` attribute was accidentally being added to options in the DOM.
11
+ - [#2068](https://github.com/iTwin/iTwinUI/pull/2068): Fixed `EditableCell` so that it correctly merges `className` and `style` props with the corresponding internal props.
12
+ - [#2073](https://github.com/iTwin/iTwinUI/pull/2073): Fixed CommonJS types exports for the `/react-table` entrypoint.
13
+ - [#2055](https://github.com/iTwin/iTwinUI/pull/2055): Fixed a regression from `v3.10.0` where non-button and non-link `Breadcrumbs.Item`s were getting a hover styling as if it were a button.
14
+
3
15
  ## 3.11.0
4
16
 
5
17
  ### Minor Changes
@@ -102,9 +102,19 @@ const ListItem = ({ item, isActive, }) => {
102
102
  const Separator = ({ separator }) => (React.createElement(index_js_1.Box, { as: 'li', className: 'iui-breadcrumbs-separator', "aria-hidden": true }, separator ?? React.createElement(index_js_1.SvgChevronRight, null)));
103
103
  // ----------------------------------------------------------------------------
104
104
  const BreadcrumbsItem = React.forwardRef((props, forwardedRef) => {
105
- const { children, className, ...rest } = props;
106
- const defaultAs = !!props.href ? Anchor_js_1.Anchor : !!props.onClick ? 'button' : 'span';
107
- return (React.createElement(Button_js_1.Button, { as: defaultAs, className: (0, classnames_1.default)('iui-breadcrumbs-content', className), styleType: 'borderless', ref: forwardedRef, ...rest }, children));
105
+ const { as: asProp, ...rest } = props;
106
+ const commonProps = {
107
+ ...rest,
108
+ className: (0, classnames_1.default)('iui-breadcrumbs-content', props.className),
109
+ ref: forwardedRef,
110
+ };
111
+ if (String(asProp) === 'span' ||
112
+ (props.href == null && props.onClick == null && asProp == null)) {
113
+ return React.createElement(index_js_1.Box, { as: 'span', ...commonProps });
114
+ }
115
+ return (React.createElement(Button_js_1.Button, { as: (asProp === 'a' || (asProp == null && !!props.href)
116
+ ? Anchor_js_1.Anchor
117
+ : asProp), styleType: 'borderless', ...commonProps }));
108
118
  });
109
119
  BreadcrumbsItem.displayName = 'Breadcrumbs.Item';
110
120
  // ----------------------------------------------------------------------------
@@ -264,7 +264,7 @@ exports.ComboBox = React.forwardRef((props, forwardedRef) => {
264
264
  const getMenuItem = React.useCallback((option, filteredIndex) => {
265
265
  const optionId = getOptionId(option, id);
266
266
  const { __originalIndex } = optionsExtraInfoRef.current[optionId];
267
- const { icon, startIcon: startIconProp, ...restOptions } = option;
267
+ const { icon, startIcon: startIconProp, label, ...restOptions } = option;
268
268
  const startIcon = startIconProp ?? icon;
269
269
  const customItem = itemRenderer
270
270
  ? itemRenderer(option, {
@@ -291,7 +291,7 @@ exports.ComboBox = React.forwardRef((props, forwardedRef) => {
291
291
  }),
292
292
  })) : (React.createElement(ComboBoxMenuItem_js_1.ComboBoxMenuItem, { key: optionId, id: optionId, startIcon: startIcon, ...restOptions, isSelected: isMenuItemSelected(__originalIndex), onClick: () => {
293
293
  onClickHandler(__originalIndex);
294
- }, index: __originalIndex, "data-iui-filtered-index": filteredIndex }, option.label));
294
+ }, index: __originalIndex, "data-iui-filtered-index": filteredIndex }, label));
295
295
  }, [
296
296
  enableVirtualization,
297
297
  focusedIndex,
@@ -22,6 +22,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
25
28
  Object.defineProperty(exports, "__esModule", { value: true });
26
29
  exports.EditableCell = void 0;
27
30
  /*---------------------------------------------------------------------------------------------
@@ -30,6 +33,7 @@ exports.EditableCell = void 0;
30
33
  *--------------------------------------------------------------------------------------------*/
31
34
  const React = __importStar(require("react"));
32
35
  const index_js_1 = require("../../../utils/index.js");
36
+ const classnames_1 = __importDefault(require("classnames"));
33
37
  /**
34
38
  * Editable cell.
35
39
  * It should be passed to `cellRenderer`.
@@ -41,7 +45,7 @@ const index_js_1 = require("../../../utils/index.js");
41
45
  * }
42
46
  */
43
47
  const EditableCell = (props) => {
44
- const { cellElementProps, cellProps, onCellEdit, children, isDisabled, ...rest } = props;
48
+ const { cellElementProps: { className: cellElementClassName, style: cellElementStyle, ...cellElementProps }, cellProps, onCellEdit, children, isDisabled, className, style, ...rest } = props;
45
49
  isDisabled; // To omit and prevent eslint error.
46
50
  const sanitizeString = (text) => {
47
51
  return text.replace(/(\r\n|\n|\r)+/gm, ' ');
@@ -52,7 +56,7 @@ const EditableCell = (props) => {
52
56
  }, [cellProps.value]);
53
57
  const [key, setKey] = React.useState((0, index_js_1.getRandomValue)(10));
54
58
  const [isDirty, setIsDirty] = React.useState(false);
55
- return (React.createElement(index_js_1.Box, { ...cellElementProps, contentEditable: true, suppressContentEditableWarning: true, key: key, ...rest, onInput: (e) => {
59
+ return (React.createElement(index_js_1.Box, { ...cellElementProps, contentEditable: true, suppressContentEditableWarning: true, key: key, ...rest, className: (0, classnames_1.default)(cellElementClassName, className), style: { ...cellElementStyle, ...style }, onInput: (e) => {
56
60
  setValue(sanitizeString(e.target.innerText));
57
61
  setIsDirty(true);
58
62
  props.onInput?.(e);
@@ -73,9 +73,19 @@ const ListItem = ({ item, isActive, }) => {
73
73
  const Separator = ({ separator }) => (React.createElement(Box, { as: 'li', className: 'iui-breadcrumbs-separator', "aria-hidden": true }, separator ?? React.createElement(SvgChevronRight, null)));
74
74
  // ----------------------------------------------------------------------------
75
75
  const BreadcrumbsItem = React.forwardRef((props, forwardedRef) => {
76
- const { children, className, ...rest } = props;
77
- const defaultAs = !!props.href ? Anchor : !!props.onClick ? 'button' : 'span';
78
- return (React.createElement(Button, { as: defaultAs, className: cx('iui-breadcrumbs-content', className), styleType: 'borderless', ref: forwardedRef, ...rest }, children));
76
+ const { as: asProp, ...rest } = props;
77
+ const commonProps = {
78
+ ...rest,
79
+ className: cx('iui-breadcrumbs-content', props.className),
80
+ ref: forwardedRef,
81
+ };
82
+ if (String(asProp) === 'span' ||
83
+ (props.href == null && props.onClick == null && asProp == null)) {
84
+ return React.createElement(Box, { as: 'span', ...commonProps });
85
+ }
86
+ return (React.createElement(Button, { as: (asProp === 'a' || (asProp == null && !!props.href)
87
+ ? Anchor
88
+ : asProp), styleType: 'borderless', ...commonProps }));
79
89
  });
80
90
  BreadcrumbsItem.displayName = 'Breadcrumbs.Item';
81
91
  // ----------------------------------------------------------------------------
@@ -238,7 +238,7 @@ export const ComboBox = React.forwardRef((props, forwardedRef) => {
238
238
  const getMenuItem = React.useCallback((option, filteredIndex) => {
239
239
  const optionId = getOptionId(option, id);
240
240
  const { __originalIndex } = optionsExtraInfoRef.current[optionId];
241
- const { icon, startIcon: startIconProp, ...restOptions } = option;
241
+ const { icon, startIcon: startIconProp, label, ...restOptions } = option;
242
242
  const startIcon = startIconProp ?? icon;
243
243
  const customItem = itemRenderer
244
244
  ? itemRenderer(option, {
@@ -265,7 +265,7 @@ export const ComboBox = React.forwardRef((props, forwardedRef) => {
265
265
  }),
266
266
  })) : (React.createElement(ComboBoxMenuItem, { key: optionId, id: optionId, startIcon: startIcon, ...restOptions, isSelected: isMenuItemSelected(__originalIndex), onClick: () => {
267
267
  onClickHandler(__originalIndex);
268
- }, index: __originalIndex, "data-iui-filtered-index": filteredIndex }, option.label));
268
+ }, index: __originalIndex, "data-iui-filtered-index": filteredIndex }, label));
269
269
  }, [
270
270
  enableVirtualization,
271
271
  focusedIndex,
@@ -4,6 +4,7 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import * as React from 'react';
6
6
  import { Box, getRandomValue } from '../../../utils/index.js';
7
+ import cx from 'classnames';
7
8
  /**
8
9
  * Editable cell.
9
10
  * It should be passed to `cellRenderer`.
@@ -15,7 +16,7 @@ import { Box, getRandomValue } from '../../../utils/index.js';
15
16
  * }
16
17
  */
17
18
  export const EditableCell = (props) => {
18
- const { cellElementProps, cellProps, onCellEdit, children, isDisabled, ...rest } = props;
19
+ const { cellElementProps: { className: cellElementClassName, style: cellElementStyle, ...cellElementProps }, cellProps, onCellEdit, children, isDisabled, className, style, ...rest } = props;
19
20
  isDisabled; // To omit and prevent eslint error.
20
21
  const sanitizeString = (text) => {
21
22
  return text.replace(/(\r\n|\n|\r)+/gm, ' ');
@@ -26,7 +27,7 @@ export const EditableCell = (props) => {
26
27
  }, [cellProps.value]);
27
28
  const [key, setKey] = React.useState(getRandomValue(10));
28
29
  const [isDirty, setIsDirty] = React.useState(false);
29
- return (React.createElement(Box, { ...cellElementProps, contentEditable: true, suppressContentEditableWarning: true, key: key, ...rest, onInput: (e) => {
30
+ return (React.createElement(Box, { ...cellElementProps, contentEditable: true, suppressContentEditableWarning: true, key: key, ...rest, className: cx(cellElementClassName, className), style: { ...cellElementStyle, ...style }, onInput: (e) => {
30
31
  setValue(sanitizeString(e.target.innerText));
31
32
  setIsDirty(true);
32
33
  props.onInput?.(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/itwinui-react",
3
- "version": "3.11.0",
3
+ "version": "3.11.1",
4
4
  "author": "Bentley Systems",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -19,6 +19,12 @@
19
19
  }
20
20
  },
21
21
  "./react-table": {
22
+ "import": {
23
+ "types": "./esm/react-table/react-table.d.ts"
24
+ },
25
+ "require": {
26
+ "types": "./cjs/react-table/react-table.d.ts"
27
+ },
22
28
  "types": "./react-table.d.ts"
23
29
  },
24
30
  "./styles.css": "./styles.css",