@itwin/itwinui-react 1.47.1 → 1.48.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,18 @@
1
1
  # Changelog
2
2
 
3
+ ### [1.48.1](https://www.github.com/iTwin/iTwinUI-react/compare/v1.48.0...v1.48.1) (2022-10-24)
4
+
5
+ ### Fixes
6
+
7
+ * **Modal:** Apply z-index on dialog wrapper ([#892](https://www.github.com/iTwin/iTwinUI-react/issues/892)) ([0637b54](https://www.github.com/iTwin/iTwinUI-react/commit/0637b54769f14b48075460d94cf64937f90a9ee3))
8
+
9
+ ## [1.48.0](https://www.github.com/iTwin/iTwinUI-react/compare/v1.47.1...v1.48.0) (2022-10-18)
10
+
11
+ ### Fixes
12
+
13
+ * **Slider:** `onUpdate` called on thumb keyboard press, keyboard `onChange` called onKeyUp ([#857](https://www.github.com/iTwin/iTwinUI-react/issues/857)) ([e881387](https://www.github.com/iTwin/iTwinUI-react/commit/e881387b3bf01163c74d4b5dbd945c20616fd237))
14
+ * **Table:** Fix "un/select all rows" behavior when a filter is applied ([81a54f7](https://www.github.com/iTwin/iTwinUI-react/commit/81a54f794afcc7490799da03914ffa156fa1055f))
15
+
3
16
  ### [1.47.1](https://www.github.com/iTwin/iTwinUI-react/compare/v1.47.0...v1.47.1) (2022-10-10)
4
17
 
5
18
  ### Fixes
@@ -12,7 +25,6 @@
12
25
 
13
26
  * **Table:** Column resize modes ([#835](https://www.github.com/iTwin/iTwinUI-react/issues/835)) ([771a517](https://www.github.com/iTwin/iTwinUI-react/commit/771a517aa2031d5936521764a09613b6433ff283))
14
27
 
15
-
16
28
  ### Fixes
17
29
 
18
30
  * **Table:** Fixed when fast resizing caused Table to throw an error ([#848](https://www.github.com/iTwin/iTwinUI-react/issues/848)) ([058ad3a](https://www.github.com/iTwin/iTwinUI-react/commit/058ad3a7c1bb4a3198a4dde1105cca47a2ef2998))
@@ -177,15 +177,20 @@ exports.Slider = react_1.default.forwardRef(function (props, ref) {
177
177
  updateThumbValue(event, 'onUpdate');
178
178
  }, [activeThumbIndex, updateThumbValue]);
179
179
  // function called by Thumb keyboard processing
180
- var onThumbValueChanged = react_1.default.useCallback(function (index, value) {
181
- if (currentValues[index] === value) {
180
+ var onThumbValueChanged = react_1.default.useCallback(function (index, value, keyboardReleased) {
181
+ if (currentValues[index] === value && !keyboardReleased) {
182
182
  return;
183
183
  }
184
- var newValues = __spreadArray([], currentValues, true);
185
- newValues[index] = value;
186
- setCurrentValues(newValues);
187
- onChange === null || onChange === void 0 ? void 0 : onChange(newValues);
188
- }, [currentValues, onChange]);
184
+ if (keyboardReleased) {
185
+ onChange === null || onChange === void 0 ? void 0 : onChange(currentValues); // currentValues since key up should not change value but only stop continuous value selection
186
+ }
187
+ else {
188
+ var newValues = __spreadArray([], currentValues, true); // newValues since key down should change value
189
+ newValues[index] = value;
190
+ onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(newValues);
191
+ setCurrentValues(newValues);
192
+ }
193
+ }, [currentValues, onUpdate, onChange]);
189
194
  var onThumbActivated = react_1.default.useCallback(function (index) {
190
195
  setActiveThumbIndex(index);
191
196
  }, []);
@@ -45,7 +45,7 @@ export declare type ThumbProps = {
45
45
  /**
46
46
  * Callback to invoke when keyboard is used to modify Thumb value.
47
47
  */
48
- onThumbValueChanged: (index: number, value: number) => void;
48
+ onThumbValueChanged: (index: number, value: number, keyboardReleased: boolean) => void;
49
49
  /**
50
50
  * Additional tooltip props.
51
51
  */
@@ -41,24 +41,24 @@ var Tooltip_1 = require("../Tooltip");
41
41
  var Thumb = function (props) {
42
42
  var value = props.value, index = props.index, minVal = props.minVal, maxVal = props.maxVal, step = props.step, sliderMin = props.sliderMin, sliderMax = props.sliderMax, isActive = props.isActive, onThumbActivated = props.onThumbActivated, onThumbValueChanged = props.onThumbValueChanged, tooltipProps = props.tooltipProps, thumbProps = props.thumbProps, disabled = props.disabled, orientation = props.orientation;
43
43
  var thumbRef = react_1.default.useRef(null);
44
- var handleOnKeyDown = react_1.default.useCallback(function (event) {
44
+ var handleOnKeyboardEvent = react_1.default.useCallback(function (event, keyboardReleased) {
45
45
  if (disabled || event.altKey) {
46
46
  return;
47
47
  }
48
48
  switch (event.key) {
49
49
  case 'ArrowLeft':
50
50
  case 'ArrowDown':
51
- onThumbValueChanged(index, Math.max(value - step, minVal));
51
+ onThumbValueChanged(index, Math.max(value - step, minVal), keyboardReleased);
52
52
  break;
53
53
  case 'ArrowRight':
54
54
  case 'ArrowUp':
55
- onThumbValueChanged(index, Math.min(value + step, maxVal));
55
+ onThumbValueChanged(index, Math.min(value + step, maxVal), keyboardReleased);
56
56
  break;
57
57
  case 'Home':
58
- onThumbValueChanged(index, minVal);
58
+ onThumbValueChanged(index, minVal, keyboardReleased);
59
59
  break;
60
60
  case 'End':
61
- onThumbValueChanged(index, maxVal);
61
+ onThumbValueChanged(index, maxVal, keyboardReleased);
62
62
  break;
63
63
  default:
64
64
  return;
@@ -89,6 +89,6 @@ var Thumb = function (props) {
89
89
  return (react_1.default.createElement(Tooltip_1.Tooltip, __assign({ visible: isActive || hasFocus || isHovered, placement: 'top' }, tooltipProps),
90
90
  react_1.default.createElement("div", __assign({}, rest, { "data-index": index, ref: thumbRef, style: __assign(__assign({}, style), (orientation === 'horizontal'
91
91
  ? { left: "".concat(lowPercent, "%") }
92
- : { bottom: "".concat(lowPercent, "%") })), className: (0, classnames_1.default)('iui-slider-thumb', { 'iui-active': isActive }, className), role: 'slider', tabIndex: disabled ? undefined : 0, "aria-valuemin": minVal, "aria-valuenow": value, "aria-valuemax": maxVal, "aria-disabled": disabled, onPointerDown: handlePointerDownOnThumb, onKeyDown: handleOnKeyDown, onFocus: function () { return setHasFocus(true); }, onBlur: function () { return setHasFocus(false); }, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } }))));
92
+ : { bottom: "".concat(lowPercent, "%") })), className: (0, classnames_1.default)('iui-slider-thumb', { 'iui-active': isActive }, className), role: 'slider', tabIndex: disabled ? undefined : 0, "aria-valuemin": minVal, "aria-valuenow": value, "aria-valuemax": maxVal, "aria-disabled": disabled, onPointerDown: handlePointerDownOnThumb, onKeyDown: function (event) { return handleOnKeyboardEvent(event, false); }, onKeyUp: function (event) { return handleOnKeyboardEvent(event, true); }, onFocus: function () { return setHasFocus(true); }, onBlur: function () { return setHasFocus(false); }, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } }))));
93
93
  };
94
94
  exports.Thumb = Thumb;
@@ -29,7 +29,7 @@ export declare const SelectionColumn: <T extends Record<string, unknown>>(props?
29
29
  maxWidth: number;
30
30
  columnClassName: string;
31
31
  cellClassName: string;
32
- Header: ({ getToggleAllRowsSelectedProps, rows, initialRows, state, }: HeaderProps<T>) => JSX.Element;
32
+ Header: ({ getToggleAllRowsSelectedProps, toggleAllRowsSelected, rows, initialRows, state, }: HeaderProps<T>) => JSX.Element;
33
33
  Cell: ({ row }: CellProps<T, any>) => JSX.Element;
34
34
  cellRenderer: (props: CellRendererProps<T>) => JSX.Element;
35
35
  };
@@ -52,11 +52,14 @@ var SelectionColumn = function (props) {
52
52
  columnClassName: 'iui-slot',
53
53
  cellClassName: 'iui-slot',
54
54
  Header: function (_a) {
55
- var getToggleAllRowsSelectedProps = _a.getToggleAllRowsSelectedProps, rows = _a.rows, initialRows = _a.initialRows, state = _a.state;
55
+ var getToggleAllRowsSelectedProps = _a.getToggleAllRowsSelectedProps, toggleAllRowsSelected = _a.toggleAllRowsSelected, rows = _a.rows, initialRows = _a.initialRows, state = _a.state;
56
56
  var disabled = rows.every(function (row) { return isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(row.original); });
57
57
  var checked = initialRows.every(function (row) { return state.selectedRowIds[row.id] || (isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(row.original)); });
58
+ var indeterminate = !checked && Object.keys(state.selectedRowIds).length > 0;
58
59
  return (react_1.default.createElement(Checkbox_1.Checkbox, __assign({}, getToggleAllRowsSelectedProps(), { style: {}, title: '' // Removes default title that comes from react-table
59
- , checked: checked && !disabled, indeterminate: !checked && Object.keys(state.selectedRowIds).length > 0, disabled: disabled })));
60
+ , checked: checked && !disabled, indeterminate: indeterminate, disabled: disabled, onChange: function () {
61
+ return toggleAllRowsSelected(!rows.some(function (row) { return row.isSelected; }));
62
+ } })));
60
63
  },
61
64
  Cell: function (_a) {
62
65
  var row = _a.row;
@@ -19,6 +19,7 @@ var getContainer = function (containerId, ownerDocument) {
19
19
  if (container == null && !!ownerDocument) {
20
20
  container = ownerDocument.createElement('div');
21
21
  container.setAttribute('id', containerId);
22
+ container.innerHTML = "<style>:where(.iui-dialog-wrapper) { z-index: 999; }</style>"; // TODO: move to css
22
23
  ownerDocument.body.appendChild(container);
23
24
  }
24
25
  return container;
@@ -171,15 +171,20 @@ export var Slider = React.forwardRef(function (props, ref) {
171
171
  updateThumbValue(event, 'onUpdate');
172
172
  }, [activeThumbIndex, updateThumbValue]);
173
173
  // function called by Thumb keyboard processing
174
- var onThumbValueChanged = React.useCallback(function (index, value) {
175
- if (currentValues[index] === value) {
174
+ var onThumbValueChanged = React.useCallback(function (index, value, keyboardReleased) {
175
+ if (currentValues[index] === value && !keyboardReleased) {
176
176
  return;
177
177
  }
178
- var newValues = __spreadArray([], currentValues, true);
179
- newValues[index] = value;
180
- setCurrentValues(newValues);
181
- onChange === null || onChange === void 0 ? void 0 : onChange(newValues);
182
- }, [currentValues, onChange]);
178
+ if (keyboardReleased) {
179
+ onChange === null || onChange === void 0 ? void 0 : onChange(currentValues); // currentValues since key up should not change value but only stop continuous value selection
180
+ }
181
+ else {
182
+ var newValues = __spreadArray([], currentValues, true); // newValues since key down should change value
183
+ newValues[index] = value;
184
+ onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(newValues);
185
+ setCurrentValues(newValues);
186
+ }
187
+ }, [currentValues, onUpdate, onChange]);
183
188
  var onThumbActivated = React.useCallback(function (index) {
184
189
  setActiveThumbIndex(index);
185
190
  }, []);
@@ -45,7 +45,7 @@ export declare type ThumbProps = {
45
45
  /**
46
46
  * Callback to invoke when keyboard is used to modify Thumb value.
47
47
  */
48
- onThumbValueChanged: (index: number, value: number) => void;
48
+ onThumbValueChanged: (index: number, value: number, keyboardReleased: boolean) => void;
49
49
  /**
50
50
  * Additional tooltip props.
51
51
  */
@@ -35,24 +35,24 @@ import { Tooltip } from '../Tooltip';
35
35
  export var Thumb = function (props) {
36
36
  var value = props.value, index = props.index, minVal = props.minVal, maxVal = props.maxVal, step = props.step, sliderMin = props.sliderMin, sliderMax = props.sliderMax, isActive = props.isActive, onThumbActivated = props.onThumbActivated, onThumbValueChanged = props.onThumbValueChanged, tooltipProps = props.tooltipProps, thumbProps = props.thumbProps, disabled = props.disabled, orientation = props.orientation;
37
37
  var thumbRef = React.useRef(null);
38
- var handleOnKeyDown = React.useCallback(function (event) {
38
+ var handleOnKeyboardEvent = React.useCallback(function (event, keyboardReleased) {
39
39
  if (disabled || event.altKey) {
40
40
  return;
41
41
  }
42
42
  switch (event.key) {
43
43
  case 'ArrowLeft':
44
44
  case 'ArrowDown':
45
- onThumbValueChanged(index, Math.max(value - step, minVal));
45
+ onThumbValueChanged(index, Math.max(value - step, minVal), keyboardReleased);
46
46
  break;
47
47
  case 'ArrowRight':
48
48
  case 'ArrowUp':
49
- onThumbValueChanged(index, Math.min(value + step, maxVal));
49
+ onThumbValueChanged(index, Math.min(value + step, maxVal), keyboardReleased);
50
50
  break;
51
51
  case 'Home':
52
- onThumbValueChanged(index, minVal);
52
+ onThumbValueChanged(index, minVal, keyboardReleased);
53
53
  break;
54
54
  case 'End':
55
- onThumbValueChanged(index, maxVal);
55
+ onThumbValueChanged(index, maxVal, keyboardReleased);
56
56
  break;
57
57
  default:
58
58
  return;
@@ -83,5 +83,5 @@ export var Thumb = function (props) {
83
83
  return (React.createElement(Tooltip, __assign({ visible: isActive || hasFocus || isHovered, placement: 'top' }, tooltipProps),
84
84
  React.createElement("div", __assign({}, rest, { "data-index": index, ref: thumbRef, style: __assign(__assign({}, style), (orientation === 'horizontal'
85
85
  ? { left: "".concat(lowPercent, "%") }
86
- : { bottom: "".concat(lowPercent, "%") })), className: cx('iui-slider-thumb', { 'iui-active': isActive }, className), role: 'slider', tabIndex: disabled ? undefined : 0, "aria-valuemin": minVal, "aria-valuenow": value, "aria-valuemax": maxVal, "aria-disabled": disabled, onPointerDown: handlePointerDownOnThumb, onKeyDown: handleOnKeyDown, onFocus: function () { return setHasFocus(true); }, onBlur: function () { return setHasFocus(false); }, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } }))));
86
+ : { bottom: "".concat(lowPercent, "%") })), className: cx('iui-slider-thumb', { 'iui-active': isActive }, className), role: 'slider', tabIndex: disabled ? undefined : 0, "aria-valuemin": minVal, "aria-valuenow": value, "aria-valuemax": maxVal, "aria-disabled": disabled, onPointerDown: handlePointerDownOnThumb, onKeyDown: function (event) { return handleOnKeyboardEvent(event, false); }, onKeyUp: function (event) { return handleOnKeyboardEvent(event, true); }, onFocus: function () { return setHasFocus(true); }, onBlur: function () { return setHasFocus(false); }, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } }))));
87
87
  };
@@ -29,7 +29,7 @@ export declare const SelectionColumn: <T extends Record<string, unknown>>(props?
29
29
  maxWidth: number;
30
30
  columnClassName: string;
31
31
  cellClassName: string;
32
- Header: ({ getToggleAllRowsSelectedProps, rows, initialRows, state, }: HeaderProps<T>) => JSX.Element;
32
+ Header: ({ getToggleAllRowsSelectedProps, toggleAllRowsSelected, rows, initialRows, state, }: HeaderProps<T>) => JSX.Element;
33
33
  Cell: ({ row }: CellProps<T, any>) => JSX.Element;
34
34
  cellRenderer: (props: CellRendererProps<T>) => JSX.Element;
35
35
  };
@@ -46,11 +46,14 @@ export var SelectionColumn = function (props) {
46
46
  columnClassName: 'iui-slot',
47
47
  cellClassName: 'iui-slot',
48
48
  Header: function (_a) {
49
- var getToggleAllRowsSelectedProps = _a.getToggleAllRowsSelectedProps, rows = _a.rows, initialRows = _a.initialRows, state = _a.state;
49
+ var getToggleAllRowsSelectedProps = _a.getToggleAllRowsSelectedProps, toggleAllRowsSelected = _a.toggleAllRowsSelected, rows = _a.rows, initialRows = _a.initialRows, state = _a.state;
50
50
  var disabled = rows.every(function (row) { return isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(row.original); });
51
51
  var checked = initialRows.every(function (row) { return state.selectedRowIds[row.id] || (isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(row.original)); });
52
+ var indeterminate = !checked && Object.keys(state.selectedRowIds).length > 0;
52
53
  return (React.createElement(Checkbox, __assign({}, getToggleAllRowsSelectedProps(), { style: {}, title: '' // Removes default title that comes from react-table
53
- , checked: checked && !disabled, indeterminate: !checked && Object.keys(state.selectedRowIds).length > 0, disabled: disabled })));
54
+ , checked: checked && !disabled, indeterminate: indeterminate, disabled: disabled, onChange: function () {
55
+ return toggleAllRowsSelected(!rows.some(function (row) { return row.isSelected; }));
56
+ } })));
54
57
  },
55
58
  Cell: function (_a) {
56
59
  var row = _a.row;
@@ -16,6 +16,7 @@ export var getContainer = function (containerId, ownerDocument) {
16
16
  if (container == null && !!ownerDocument) {
17
17
  container = ownerDocument.createElement('div');
18
18
  container.setAttribute('id', containerId);
19
+ container.innerHTML = "<style>:where(.iui-dialog-wrapper) { z-index: 999; }</style>"; // TODO: move to css
19
20
  ownerDocument.body.appendChild(container);
20
21
  }
21
22
  return container;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/itwinui-react",
3
- "version": "1.47.1",
3
+ "version": "1.48.1",
4
4
  "author": "Bentley Systems",
5
5
  "license": "MIT",
6
6
  "main": "cjs/index.js",