@itwin/itwinui-react 3.16.3 → 3.16.4

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,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.16.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2389](https://github.com/iTwin/iTwinUI/pull/2389): Fixed `Table` bug where parent rows had indeterminate checkboxes even when all sub rows were selected.
8
+ - [#2390](https://github.com/iTwin/iTwinUI/pull/2390): Fixed `ThemeProvider` bug of re-mounting its children and losing state when `portalContainer` is toggled between `undefined` and defined.
9
+ - [#2396](https://github.com/iTwin/iTwinUI/pull/2396): Fixed rare bug where icons in button components (e.g. `Button`, `SidenavButton`, etc.) were becoming 0 in width when less space was available.
10
+
3
11
  ## 3.16.3
4
12
 
5
13
  ### Patch Changes
@@ -29,19 +29,18 @@ const onSelectHandler = (newState, instance, onSelect, isRowDisabled) => {
29
29
  let newSelectedRowIds = {};
30
30
  let handleRow = (row) => {
31
31
  if (isRowDisabled?.(row.original)) return false;
32
+ let hasSubComponents = !!row.initialSubRows[0]?.original[_Table.iuiId];
33
+ let hasSubRows = row.subRows.length > 0 && !hasSubComponents;
32
34
  let isAllSubSelected = true;
33
- if (row.initialSubRows[0]?.original[_Table.iuiId] === void 0)
35
+ if (hasSubRows)
34
36
  row.initialSubRows.forEach((subRow) => {
35
37
  let result = handleRow(subRow);
36
38
  if (!result) isAllSubSelected = false;
37
39
  });
38
- if (
39
- newState.selectedRowIds[row.id] &&
40
- (!instance.selectSubRows ||
41
- !row.initialSubRows.length ||
42
- isAllSubSelected)
43
- )
44
- newSelectedRowIds[row.id] = true;
40
+ let isRowSelected = newState.selectedRowIds[row.id];
41
+ let case1 = isRowSelected && (!instance.selectSubRows || !hasSubRows);
42
+ let case2 = hasSubRows && isAllSubSelected;
43
+ if (case1 || case2) newSelectedRowIds[row.id] = true;
45
44
  return !!newSelectedRowIds[row.id];
46
45
  };
47
46
  instance.initialRows.forEach((row) => handleRow(row));
@@ -96,16 +96,24 @@ const ToastProvider = ({ children, inherit = false }) => {
96
96
  placement: 'top',
97
97
  },
98
98
  });
99
- if (_react.useContext(ToasterStateContext) && inherit) return children;
99
+ let toasterDispatchContext = _react.useContext(ToasterDispatchContext);
100
+ let toasterStateContext = _react.useContext(ToasterStateContext);
101
+ let shouldReuse = toasterStateContext && inherit;
102
+ let toasterDispatchContextValue = shouldReuse
103
+ ? toasterDispatchContext
104
+ : dispatch;
105
+ let toasterStateContextValue = shouldReuse
106
+ ? toasterStateContext
107
+ : toasterState;
100
108
  return _react.createElement(
101
109
  ToasterDispatchContext.Provider,
102
110
  {
103
- value: dispatch,
111
+ value: toasterDispatchContextValue,
104
112
  },
105
113
  _react.createElement(
106
114
  ToasterStateContext.Provider,
107
115
  {
108
- value: toasterState,
116
+ value: toasterStateContextValue,
109
117
  },
110
118
  children,
111
119
  ),
package/DEV-cjs/styles.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
- const e = '3.16.3';
3
+ const e = '3.16.4';
4
4
  const u = new Proxy(
5
5
  {},
6
6
  {
@@ -7,19 +7,18 @@ let onSelectHandler = (newState, instance, onSelect, isRowDisabled) => {
7
7
  let newSelectedRowIds = {};
8
8
  let handleRow = (row) => {
9
9
  if (isRowDisabled?.(row.original)) return false;
10
+ let hasSubComponents = !!row.initialSubRows[0]?.original[iuiId];
11
+ let hasSubRows = row.subRows.length > 0 && !hasSubComponents;
10
12
  let isAllSubSelected = true;
11
- if (row.initialSubRows[0]?.original[iuiId] === void 0)
13
+ if (hasSubRows)
12
14
  row.initialSubRows.forEach((subRow) => {
13
15
  let result = handleRow(subRow);
14
16
  if (!result) isAllSubSelected = false;
15
17
  });
16
- if (
17
- newState.selectedRowIds[row.id] &&
18
- (!instance.selectSubRows ||
19
- !row.initialSubRows.length ||
20
- isAllSubSelected)
21
- )
22
- newSelectedRowIds[row.id] = true;
18
+ let isRowSelected = newState.selectedRowIds[row.id];
19
+ let case1 = isRowSelected && (!instance.selectSubRows || !hasSubRows);
20
+ let case2 = hasSubRows && isAllSubSelected;
21
+ if (case1 || case2) newSelectedRowIds[row.id] = true;
23
22
  return !!newSelectedRowIds[row.id];
24
23
  };
25
24
  instance.initialRows.forEach((row) => handleRow(row));
@@ -66,16 +66,24 @@ export const ToastProvider = ({ children, inherit = false }) => {
66
66
  placement: 'top',
67
67
  },
68
68
  });
69
- if (React.useContext(ToasterStateContext) && inherit) return children;
69
+ let toasterDispatchContext = React.useContext(ToasterDispatchContext);
70
+ let toasterStateContext = React.useContext(ToasterStateContext);
71
+ let shouldReuse = toasterStateContext && inherit;
72
+ let toasterDispatchContextValue = shouldReuse
73
+ ? toasterDispatchContext
74
+ : dispatch;
75
+ let toasterStateContextValue = shouldReuse
76
+ ? toasterStateContext
77
+ : toasterState;
70
78
  return React.createElement(
71
79
  ToasterDispatchContext.Provider,
72
80
  {
73
- value: dispatch,
81
+ value: toasterDispatchContextValue,
74
82
  },
75
83
  React.createElement(
76
84
  ToasterStateContext.Provider,
77
85
  {
78
- value: toasterState,
86
+ value: toasterStateContextValue,
79
87
  },
80
88
  children,
81
89
  ),
package/DEV-esm/styles.js CHANGED
@@ -1,4 +1,4 @@
1
- const t = '3.16.3';
1
+ const t = '3.16.4';
2
2
  const u = new Proxy(
3
3
  {},
4
4
  {
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright © 2021-2024 Bentley Systems, Incorporated. All rights reserved.
3
+ Copyright © 2021-2025 Bentley Systems, Incorporated. All rights reserved.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
@@ -29,19 +29,18 @@ const onSelectHandler = (newState, instance, onSelect, isRowDisabled) => {
29
29
  let newSelectedRowIds = {};
30
30
  let handleRow = (row) => {
31
31
  if (isRowDisabled?.(row.original)) return false;
32
+ let hasSubComponents = !!row.initialSubRows[0]?.original[_Table.iuiId];
33
+ let hasSubRows = row.subRows.length > 0 && !hasSubComponents;
32
34
  let isAllSubSelected = true;
33
- if (row.initialSubRows[0]?.original[_Table.iuiId] === void 0)
35
+ if (hasSubRows)
34
36
  row.initialSubRows.forEach((subRow) => {
35
37
  let result = handleRow(subRow);
36
38
  if (!result) isAllSubSelected = false;
37
39
  });
38
- if (
39
- newState.selectedRowIds[row.id] &&
40
- (!instance.selectSubRows ||
41
- !row.initialSubRows.length ||
42
- isAllSubSelected)
43
- )
44
- newSelectedRowIds[row.id] = true;
40
+ let isRowSelected = newState.selectedRowIds[row.id];
41
+ let case1 = isRowSelected && (!instance.selectSubRows || !hasSubRows);
42
+ let case2 = hasSubRows && isAllSubSelected;
43
+ if (case1 || case2) newSelectedRowIds[row.id] = true;
45
44
  return !!newSelectedRowIds[row.id];
46
45
  };
47
46
  instance.initialRows.forEach((row) => handleRow(row));
@@ -38,7 +38,7 @@ export declare const Toaster: () => React.JSX.Element;
38
38
  export declare const ToastProvider: ({ children, inherit, }: {
39
39
  children: React.ReactNode;
40
40
  inherit?: boolean;
41
- }) => string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
41
+ }) => React.JSX.Element;
42
42
  export declare const ToasterStateContext: React.Context<ToasterState | undefined>;
43
43
  type ToasterState = {
44
44
  toasts: ToastProps[];
@@ -96,16 +96,24 @@ const ToastProvider = ({ children, inherit = false }) => {
96
96
  placement: 'top',
97
97
  },
98
98
  });
99
- if (_react.useContext(ToasterStateContext) && inherit) return children;
99
+ let toasterDispatchContext = _react.useContext(ToasterDispatchContext);
100
+ let toasterStateContext = _react.useContext(ToasterStateContext);
101
+ let shouldReuse = toasterStateContext && inherit;
102
+ let toasterDispatchContextValue = shouldReuse
103
+ ? toasterDispatchContext
104
+ : dispatch;
105
+ let toasterStateContextValue = shouldReuse
106
+ ? toasterStateContext
107
+ : toasterState;
100
108
  return _react.createElement(
101
109
  ToasterDispatchContext.Provider,
102
110
  {
103
- value: dispatch,
111
+ value: toasterDispatchContextValue,
104
112
  },
105
113
  _react.createElement(
106
114
  ToasterStateContext.Provider,
107
115
  {
108
- value: toasterState,
116
+ value: toasterStateContextValue,
109
117
  },
110
118
  children,
111
119
  ),
package/cjs/styles.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
- const e = '3.16.3';
3
+ const e = '3.16.4';
4
4
  const u = new Proxy(
5
5
  {},
6
6
  {
@@ -7,19 +7,18 @@ let onSelectHandler = (newState, instance, onSelect, isRowDisabled) => {
7
7
  let newSelectedRowIds = {};
8
8
  let handleRow = (row) => {
9
9
  if (isRowDisabled?.(row.original)) return false;
10
+ let hasSubComponents = !!row.initialSubRows[0]?.original[iuiId];
11
+ let hasSubRows = row.subRows.length > 0 && !hasSubComponents;
10
12
  let isAllSubSelected = true;
11
- if (row.initialSubRows[0]?.original[iuiId] === void 0)
13
+ if (hasSubRows)
12
14
  row.initialSubRows.forEach((subRow) => {
13
15
  let result = handleRow(subRow);
14
16
  if (!result) isAllSubSelected = false;
15
17
  });
16
- if (
17
- newState.selectedRowIds[row.id] &&
18
- (!instance.selectSubRows ||
19
- !row.initialSubRows.length ||
20
- isAllSubSelected)
21
- )
22
- newSelectedRowIds[row.id] = true;
18
+ let isRowSelected = newState.selectedRowIds[row.id];
19
+ let case1 = isRowSelected && (!instance.selectSubRows || !hasSubRows);
20
+ let case2 = hasSubRows && isAllSubSelected;
21
+ if (case1 || case2) newSelectedRowIds[row.id] = true;
23
22
  return !!newSelectedRowIds[row.id];
24
23
  };
25
24
  instance.initialRows.forEach((row) => handleRow(row));
@@ -38,7 +38,7 @@ export declare const Toaster: () => React.JSX.Element;
38
38
  export declare const ToastProvider: ({ children, inherit, }: {
39
39
  children: React.ReactNode;
40
40
  inherit?: boolean;
41
- }) => string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
41
+ }) => React.JSX.Element;
42
42
  export declare const ToasterStateContext: React.Context<ToasterState | undefined>;
43
43
  type ToasterState = {
44
44
  toasts: ToastProps[];
@@ -66,16 +66,24 @@ export const ToastProvider = ({ children, inherit = false }) => {
66
66
  placement: 'top',
67
67
  },
68
68
  });
69
- if (React.useContext(ToasterStateContext) && inherit) return children;
69
+ let toasterDispatchContext = React.useContext(ToasterDispatchContext);
70
+ let toasterStateContext = React.useContext(ToasterStateContext);
71
+ let shouldReuse = toasterStateContext && inherit;
72
+ let toasterDispatchContextValue = shouldReuse
73
+ ? toasterDispatchContext
74
+ : dispatch;
75
+ let toasterStateContextValue = shouldReuse
76
+ ? toasterStateContext
77
+ : toasterState;
70
78
  return React.createElement(
71
79
  ToasterDispatchContext.Provider,
72
80
  {
73
- value: dispatch,
81
+ value: toasterDispatchContextValue,
74
82
  },
75
83
  React.createElement(
76
84
  ToasterStateContext.Provider,
77
85
  {
78
- value: toasterState,
86
+ value: toasterStateContextValue,
79
87
  },
80
88
  children,
81
89
  ),
package/esm/styles.js CHANGED
@@ -1,4 +1,4 @@
1
- const t = '3.16.3';
1
+ const t = '3.16.4';
2
2
  const u = new Proxy(
3
3
  {},
4
4
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/itwinui-react",
3
- "version": "3.16.3",
3
+ "version": "3.16.4",
4
4
  "author": "Bentley Systems",
5
5
  "license": "MIT",
6
6
  "type": "module",