@itwin/itwinui-react 1.30.0 → 1.31.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.
- package/CHANGELOG.md +11 -0
- package/cjs/core/Badge/Badge.js +2 -2
- package/cjs/core/ColorPicker/ColorBuilder.js +7 -8
- package/cjs/core/ColorPicker/ColorSwatch.js +2 -2
- package/cjs/core/ComboBox/ComboBox.js +41 -36
- package/cjs/core/Select/Select.js +23 -8
- package/cjs/core/Table/TablePaginator.js +7 -9
- package/cjs/core/Tile/Tile.js +4 -4
- package/esm/core/Badge/Badge.js +2 -2
- package/esm/core/ColorPicker/ColorBuilder.js +7 -8
- package/esm/core/ColorPicker/ColorSwatch.js +2 -2
- package/esm/core/ComboBox/ComboBox.js +41 -36
- package/esm/core/Select/Select.js +23 -8
- package/esm/core/Table/TablePaginator.js +7 -9
- package/esm/core/Tile/Tile.js +4 -4
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.31.0](https://www.github.com/iTwin/iTwinUI-react/compare/v1.30.0...v1.31.0) (2022-02-15)
|
|
4
|
+
|
|
5
|
+
### What's new
|
|
6
|
+
|
|
7
|
+
* **Select:** Now uses an svg for the arrow to match ComboBox ([#540](https://www.github.com/iTwin/iTwinUI-react/issues/540)) ([c0ad092](https://www.github.com/iTwin/iTwinUI-react/commit/c0ad0921f859130f4cc866999ba2d31187b192ac))
|
|
8
|
+
|
|
9
|
+
### Fixes
|
|
10
|
+
|
|
11
|
+
* **ButtonGroup:** Fixed z-index handling through base CSS package.
|
|
12
|
+
* **Popover:** Fixed popover not hiding when target is scrolled off screen.
|
|
13
|
+
|
|
3
14
|
## [1.30.0](https://www.github.com/iTwin/iTwinUI-react/compare/v1.29.3...v1.30.0) (2022-02-08)
|
|
4
15
|
|
|
5
16
|
### What's new
|
package/cjs/core/Badge/Badge.js
CHANGED
|
@@ -66,8 +66,8 @@ var Badge = function (props) {
|
|
|
66
66
|
var backgroundColor = props.backgroundColor, style = props.style, className = props.className, children = props.children, rest = __rest(props, ["backgroundColor", "style", "className", "children"]);
|
|
67
67
|
(0, utils_1.useTheme)();
|
|
68
68
|
var _style = backgroundColor &&
|
|
69
|
-
((_c = (_b = (_a = (0, utils_1.getWindow)()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--badge-color: " + backgroundColor))
|
|
70
|
-
? __assign({ '--badge-color': getBadgeColorValue(backgroundColor) }, style) : __assign({ backgroundColor: getBadgeColorValue(backgroundColor) }, style);
|
|
69
|
+
((_c = (_b = (_a = (0, utils_1.getWindow)()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--iui-badge-background-color: " + backgroundColor))
|
|
70
|
+
? __assign({ '--iui-badge-background-color': getBadgeColorValue(backgroundColor) }, style) : __assign({ backgroundColor: getBadgeColorValue(backgroundColor) }, style);
|
|
71
71
|
return (react_1.default.createElement("span", __assign({ className: (0, classnames_1.default)('iui-badge', className), style: _style }, rest), children));
|
|
72
72
|
};
|
|
73
73
|
exports.Badge = Badge;
|
|
@@ -69,21 +69,20 @@ exports.ColorBuilder = react_1.default.forwardRef(function (props, ref) {
|
|
|
69
69
|
]);
|
|
70
70
|
var _p = react_1.default.useState(false), colorDotActive = _p[0], setColorDotActive = _p[1];
|
|
71
71
|
var hueColorString = hueSliderColor.toHexString();
|
|
72
|
-
var colorSquareStyle = ((_c = (_b = (_a = (0, utils_1.getWindow)()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--hue
|
|
72
|
+
var colorSquareStyle = ((_c = (_b = (_a = (0, utils_1.getWindow)()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--iui-color-field-hue: " + hueColorString))
|
|
73
73
|
? {
|
|
74
|
-
'--hue': hueColorString,
|
|
75
|
-
'--selected-color': dotColorString,
|
|
74
|
+
'--iui-color-field-hue': hueColorString,
|
|
75
|
+
'--iui-color-picker-selected-color': dotColorString,
|
|
76
76
|
}
|
|
77
77
|
: { backgroundColor: hueColorString };
|
|
78
|
-
var opacitySliderStyle = ((_f = (_e = (_d = (0, utils_1.getWindow)()) === null || _d === void 0 ? void 0 : _d.CSS) === null || _e === void 0 ? void 0 : _e.supports) === null || _f === void 0 ? void 0 : _f.call(_e, "--selected-color
|
|
79
|
-
? { '--selected-color': hueColorString }
|
|
78
|
+
var opacitySliderStyle = ((_f = (_e = (_d = (0, utils_1.getWindow)()) === null || _d === void 0 ? void 0 : _d.CSS) === null || _e === void 0 ? void 0 : _e.supports) === null || _f === void 0 ? void 0 : _f.call(_e, "--iui-color-picker-selected-color: " + hueColorString))
|
|
79
|
+
? { '--iui-color-picker-selected-color': hueColorString }
|
|
80
80
|
: { backgroundColor: hueColorString };
|
|
81
81
|
var squareTop = 100 - hsvColor.v;
|
|
82
82
|
var squareLeft = hsvColor.s;
|
|
83
|
-
var colorDotStyle = ((_j = (_h = (_g = (0, utils_1.getWindow)()) === null || _g === void 0 ? void 0 : _g.CSS) === null || _h === void 0 ? void 0 : _h.supports) === null || _j === void 0 ? void 0 : _j.call(_h, "--
|
|
83
|
+
var colorDotStyle = ((_j = (_h = (_g = (0, utils_1.getWindow)()) === null || _g === void 0 ? void 0 : _g.CSS) === null || _h === void 0 ? void 0 : _h.supports) === null || _j === void 0 ? void 0 : _j.call(_h, "--iui-color-dot-inset: 0"))
|
|
84
84
|
? {
|
|
85
|
-
'--
|
|
86
|
-
'--left': squareLeft.toString() + '%',
|
|
85
|
+
'--iui-color-dot-inset': squareTop.toString() + "% auto auto " + squareLeft.toString() + "%",
|
|
87
86
|
}
|
|
88
87
|
: {
|
|
89
88
|
backgroundColor: dotColorString,
|
|
@@ -51,8 +51,8 @@ exports.ColorSwatch = react_1.default.forwardRef(function (props, ref) {
|
|
|
51
51
|
}, [color]);
|
|
52
52
|
var _style = react_1.default.useMemo(function () {
|
|
53
53
|
var _a, _b, _c;
|
|
54
|
-
return ((_c = (_b = (_a = (0, utils_1.getWindow)()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--swatch-
|
|
55
|
-
? __assign({ '--swatch-
|
|
54
|
+
return ((_c = (_b = (_a = (0, utils_1.getWindow)()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--iui-color-swatch-background: " + colorString))
|
|
55
|
+
? __assign({ '--iui-color-swatch-background': colorString }, style) : __assign({ backgroundColor: colorString }, style);
|
|
56
56
|
}, [colorString, style]);
|
|
57
57
|
return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-color-swatch', { 'iui-active': isActive }, className), style: _style, onClick: onClick, tabIndex: isActive ? 0 : -1, "aria-selected": isActive, ref: ref }, rest)));
|
|
58
58
|
});
|
|
@@ -241,42 +241,47 @@ var ComboBox = function (props) {
|
|
|
241
241
|
selectedValue,
|
|
242
242
|
memoizedItems,
|
|
243
243
|
]);
|
|
244
|
-
return (react_1.default.createElement(utils_1.InputContainer, __assign({ className: className, isIconInline: true,
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
244
|
+
return (react_1.default.createElement(utils_1.InputContainer, __assign({ className: className, isIconInline: true }, rest, { id: id }),
|
|
245
|
+
react_1.default.createElement("div", { className: 'iui-input-with-icon' },
|
|
246
|
+
react_1.default.createElement(utils_1.Popover, __assign({ placement: 'bottom-start', visible: isOpen, onClickOutside: function (_, _a) {
|
|
247
|
+
var _b;
|
|
248
|
+
var target = _a.target;
|
|
249
|
+
if (!((_b = toggleButtonRef.current) === null || _b === void 0 ? void 0 : _b.contains(target))) {
|
|
250
|
+
setIsOpen(false);
|
|
251
|
+
}
|
|
252
|
+
}, animation: 'shift-away', duration: 200 }, dropdownMenuProps, { content: react_1.default.createElement(Menu_1.Menu, { id: id + "-list", className: 'iui-scroll', style: {
|
|
253
|
+
minWidth: minWidth,
|
|
254
|
+
maxWidth: "min(" + minWidth * 2 + "px, 90vw)",
|
|
255
|
+
maxHeight: 300,
|
|
256
|
+
}, setFocus: false, role: 'listbox', ref: menuRef }, menuItems), onHide: function (instance) {
|
|
257
|
+
var _a;
|
|
258
|
+
var selectedIndex = options.findIndex(function (_a) {
|
|
259
|
+
var value = _a.value;
|
|
260
|
+
return value === selectedValue;
|
|
261
|
+
});
|
|
262
|
+
setFocusedIndex(selectedIndex);
|
|
263
|
+
if (selectedIndex > -1) {
|
|
264
|
+
setInputValue(options[selectedIndex].label); // update input value to be same as selected value
|
|
265
|
+
}
|
|
266
|
+
(_a = dropdownMenuProps === null || dropdownMenuProps === void 0 ? void 0 : dropdownMenuProps.onHide) === null || _a === void 0 ? void 0 : _a.call(dropdownMenuProps, instance);
|
|
267
|
+
} }),
|
|
268
|
+
react_1.default.createElement(Input_1.Input, __assign({ ref: inputRef, onKeyDown: onKeyDown, onFocus: function () { return setIsOpen(true); }, onChange: onInput, value: inputValue, "aria-activedescendant": isOpen && focusedIndex > -1
|
|
269
|
+
? getOptionId(focusedIndex)
|
|
270
|
+
: undefined, role: 'combobox', "aria-controls": isOpen ? id + "-list" : undefined, "aria-autocomplete": 'list', spellCheck: false, autoCapitalize: 'none', autoCorrect: 'off' }, inputProps))),
|
|
271
|
+
react_1.default.createElement("span", { ref: toggleButtonRef, className: (0, classnames_1.default)('iui-end-icon', {
|
|
272
|
+
'iui-actionable': !(inputProps === null || inputProps === void 0 ? void 0 : inputProps.disabled),
|
|
273
|
+
'iui-disabled': inputProps === null || inputProps === void 0 ? void 0 : inputProps.disabled,
|
|
274
|
+
'iui-open': isOpen,
|
|
275
|
+
}), onClick: function () {
|
|
276
|
+
var _a;
|
|
277
|
+
if (isOpen) {
|
|
278
|
+
setIsOpen(false);
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
282
|
+
}
|
|
283
|
+
} },
|
|
284
|
+
react_1.default.createElement(CaretDownSmall_1.default, { "aria-hidden": true })))));
|
|
280
285
|
};
|
|
281
286
|
exports.ComboBox = ComboBox;
|
|
282
287
|
exports.default = exports.ComboBox;
|
|
@@ -36,6 +36,7 @@ var DropdownMenu_1 = require("../DropdownMenu");
|
|
|
36
36
|
var MenuItem_1 = require("../Menu/MenuItem");
|
|
37
37
|
var utils_1 = require("../utils");
|
|
38
38
|
require("@itwin/itwinui-css/css/inputs.css");
|
|
39
|
+
var CaretDownSmall_1 = __importDefault(require("@itwin/itwinui-icons-react/cjs/icons/CaretDownSmall"));
|
|
39
40
|
/**
|
|
40
41
|
* Select component to select value from options.
|
|
41
42
|
* Generic type is used for value. It prevents you from mistakenly using other types in `options`, `value` and `onChange`.
|
|
@@ -97,6 +98,7 @@ var Select = function (props) {
|
|
|
97
98
|
var _f = react_1.default.useState(0), minWidth = _f[0], setMinWidth = _f[1];
|
|
98
99
|
var toggle = function () { return setIsOpen(function (open) { return !open; }); };
|
|
99
100
|
var selectRef = react_1.default.useRef(null);
|
|
101
|
+
var toggleButtonRef = react_1.default.useRef(null);
|
|
100
102
|
var onShowHandler = react_1.default.useCallback(function (instance) {
|
|
101
103
|
setIsOpen(true);
|
|
102
104
|
onShow === null || onShow === void 0 ? void 0 : onShow(instance);
|
|
@@ -143,13 +145,20 @@ var Select = function (props) {
|
|
|
143
145
|
}
|
|
144
146
|
return options.find(function (option) { return option.value === value; });
|
|
145
147
|
}, [options, value]);
|
|
146
|
-
return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-
|
|
147
|
-
react_1.default.createElement(DropdownMenu_1.DropdownMenu, __assign({ menuItems: menuItems, placement: 'bottom-start', className: (0, classnames_1.default)('iui-scroll', menuClassName), style: __assign({ minWidth: minWidth, maxWidth: "min(" + minWidth * 2 + "px, 90vw)", maxHeight: "300px" }, menuStyle), role: 'listbox', onShow: onShowHandler, onHide: onHideHandler, disabled: disabled }, popoverProps, { visible: isOpen
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
148
|
+
return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-input-with-icon', className), "aria-expanded": isOpen, "aria-haspopup": 'listbox', style: style }, rest),
|
|
149
|
+
react_1.default.createElement(DropdownMenu_1.DropdownMenu, __assign({ menuItems: menuItems, placement: 'bottom-start', className: (0, classnames_1.default)('iui-scroll', menuClassName), style: __assign({ minWidth: minWidth, maxWidth: "min(" + minWidth * 2 + "px, 90vw)", maxHeight: "300px" }, menuStyle), role: 'listbox', onShow: onShowHandler, onHide: onHideHandler, disabled: disabled }, popoverProps, { visible: isOpen, onClickOutside: function (_, _a) {
|
|
150
|
+
var _b;
|
|
151
|
+
var target = _a.target;
|
|
152
|
+
if (!((_b = toggleButtonRef.current) === null || _b === void 0 ? void 0 : _b.contains(target))) {
|
|
153
|
+
setIsOpen(false);
|
|
154
|
+
}
|
|
155
|
+
} }),
|
|
156
|
+
react_1.default.createElement("div", { ref: selectRef, className: (0, classnames_1.default)('iui-select-button', (_a = {
|
|
157
|
+
'iui-placeholder': !selectedItem && !!placeholder,
|
|
158
|
+
'iui-disabled': disabled
|
|
159
|
+
},
|
|
160
|
+
_a["iui-" + size] = !!size,
|
|
161
|
+
_a)), onClick: function () { return !disabled && toggle(); }, onKeyDown: function (e) { return !disabled && onKeyDown(e, toggle); }, tabIndex: !disabled ? 0 : undefined },
|
|
153
162
|
!selectedItem && react_1.default.createElement("span", { className: 'iui-content' }, placeholder),
|
|
154
163
|
selectedItem &&
|
|
155
164
|
selectedItemRenderer &&
|
|
@@ -159,7 +168,13 @@ var Select = function (props) {
|
|
|
159
168
|
react_1.default.cloneElement(selectedItem.icon, {
|
|
160
169
|
className: (0, classnames_1.default)(selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.icon.props.className, 'iui-icon'),
|
|
161
170
|
}),
|
|
162
|
-
react_1.default.createElement("span", { className: 'iui-content' }, selectedItem.label)))))
|
|
171
|
+
react_1.default.createElement("span", { className: 'iui-content' }, selectedItem.label))))),
|
|
172
|
+
react_1.default.createElement("span", { ref: toggleButtonRef, className: (0, classnames_1.default)('iui-end-icon', {
|
|
173
|
+
'iui-actionable': !disabled,
|
|
174
|
+
'iui-disabled': disabled,
|
|
175
|
+
'iui-open': isOpen,
|
|
176
|
+
}), onClick: function () { return !disabled && toggle(); } },
|
|
177
|
+
react_1.default.createElement(CaretDownSmall_1.default, { "aria-hidden": true }))));
|
|
163
178
|
};
|
|
164
179
|
exports.Select = Select;
|
|
165
180
|
exports.default = exports.Select;
|
|
@@ -85,11 +85,10 @@ var TablePaginator = function (props) {
|
|
|
85
85
|
var buttonSize = size != 'default' ? 'small' : undefined;
|
|
86
86
|
var pageButton = react_1.default.useCallback(function (index, tabIndex) {
|
|
87
87
|
if (tabIndex === void 0) { tabIndex = index === focusedIndex ? 0 : -1; }
|
|
88
|
-
return (react_1.default.createElement("
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}), onClick: function () { return onPageChange(index); }, "aria-current": index === currentPage, "aria-label": localization.goToPageLabel(index + 1), tabIndex: tabIndex }, index + 1)));
|
|
88
|
+
return (react_1.default.createElement("button", { key: index, className: (0, classnames_1.default)('iui-paginator-page-button', {
|
|
89
|
+
'iui-active': index === currentPage,
|
|
90
|
+
'iui-paginator-page-button-small': buttonSize === 'small',
|
|
91
|
+
}), onClick: function () { return onPageChange(index); }, "aria-current": index === currentPage, "aria-label": localization.goToPageLabel(index + 1), tabIndex: tabIndex }, index + 1));
|
|
93
92
|
}, [focusedIndex, currentPage, localization, buttonSize, onPageChange]);
|
|
94
93
|
var totalPagesCount = Math.ceil(totalRowsCount / pageSize);
|
|
95
94
|
var pageList = react_1.default.useMemo(function () {
|
|
@@ -151,10 +150,9 @@ var TablePaginator = function (props) {
|
|
|
151
150
|
var hasNoRows = totalPagesCount === 0;
|
|
152
151
|
var showPagesList = totalPagesCount > 1 || isLoading;
|
|
153
152
|
var showPageSizeList = pageSizeList && onPageSizeChange && !!totalRowsCount;
|
|
154
|
-
var ellipsis = (react_1.default.createElement("
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}) }, "\u2026")));
|
|
153
|
+
var ellipsis = (react_1.default.createElement("span", { className: (0, classnames_1.default)('iui-paginator-ellipsis', {
|
|
154
|
+
'iui-paginator-ellipsis-small': size === 'small',
|
|
155
|
+
}) }, "\u2026"));
|
|
158
156
|
var noRowsContent = (react_1.default.createElement(react_1.default.Fragment, null, isLoading ? (react_1.default.createElement(ProgressIndicators_1.ProgressRadial, { indeterminate: true, size: 'small' })) : (react_1.default.createElement(Buttons_1.Button, { styleType: 'borderless', disabled: true, size: buttonSize }, "1"))));
|
|
159
157
|
if (!showPagesList && !showPageSizeList) {
|
|
160
158
|
return null;
|
package/cjs/core/Tile/Tile.js
CHANGED
|
@@ -88,7 +88,6 @@ var Tile = function (props) {
|
|
|
88
88
|
moreOptions && (react_1.default.createElement(DropdownMenu_1.DropdownMenu, { onShow: showMenu, onHide: hideMenu, menuItems: function (close) {
|
|
89
89
|
return moreOptions.map(function (option) {
|
|
90
90
|
return react_1.default.cloneElement(option, {
|
|
91
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
92
91
|
onClick: function (value) {
|
|
93
92
|
var _a, _b;
|
|
94
93
|
close();
|
|
@@ -97,10 +96,11 @@ var Tile = function (props) {
|
|
|
97
96
|
});
|
|
98
97
|
});
|
|
99
98
|
} },
|
|
100
|
-
react_1.default.createElement(
|
|
99
|
+
react_1.default.createElement("div", { className: (0, classnames_1.default)('iui-tile-more-options', {
|
|
101
100
|
'iui-visible': isMenuVisible,
|
|
102
|
-
})
|
|
103
|
-
react_1.default.createElement(
|
|
101
|
+
}) },
|
|
102
|
+
react_1.default.createElement(Buttons_1.IconButton, { styleType: 'borderless', size: 'small', "aria-label": 'More options' },
|
|
103
|
+
react_1.default.createElement(More_1.default, null))))),
|
|
104
104
|
children),
|
|
105
105
|
buttons && react_1.default.createElement("div", { className: 'iui-tile-buttons' }, buttons)));
|
|
106
106
|
};
|
package/esm/core/Badge/Badge.js
CHANGED
|
@@ -60,8 +60,8 @@ export var Badge = function (props) {
|
|
|
60
60
|
var backgroundColor = props.backgroundColor, style = props.style, className = props.className, children = props.children, rest = __rest(props, ["backgroundColor", "style", "className", "children"]);
|
|
61
61
|
useTheme();
|
|
62
62
|
var _style = backgroundColor &&
|
|
63
|
-
((_c = (_b = (_a = getWindow()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--badge-color: " + backgroundColor))
|
|
64
|
-
? __assign({ '--badge-color': getBadgeColorValue(backgroundColor) }, style) : __assign({ backgroundColor: getBadgeColorValue(backgroundColor) }, style);
|
|
63
|
+
((_c = (_b = (_a = getWindow()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--iui-badge-background-color: " + backgroundColor))
|
|
64
|
+
? __assign({ '--iui-badge-background-color': getBadgeColorValue(backgroundColor) }, style) : __assign({ backgroundColor: getBadgeColorValue(backgroundColor) }, style);
|
|
65
65
|
return (React.createElement("span", __assign({ className: cx('iui-badge', className), style: _style }, rest), children));
|
|
66
66
|
};
|
|
67
67
|
export default Badge;
|
|
@@ -63,21 +63,20 @@ export var ColorBuilder = React.forwardRef(function (props, ref) {
|
|
|
63
63
|
]);
|
|
64
64
|
var _p = React.useState(false), colorDotActive = _p[0], setColorDotActive = _p[1];
|
|
65
65
|
var hueColorString = hueSliderColor.toHexString();
|
|
66
|
-
var colorSquareStyle = ((_c = (_b = (_a = getWindow()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--hue
|
|
66
|
+
var colorSquareStyle = ((_c = (_b = (_a = getWindow()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--iui-color-field-hue: " + hueColorString))
|
|
67
67
|
? {
|
|
68
|
-
'--hue': hueColorString,
|
|
69
|
-
'--selected-color': dotColorString,
|
|
68
|
+
'--iui-color-field-hue': hueColorString,
|
|
69
|
+
'--iui-color-picker-selected-color': dotColorString,
|
|
70
70
|
}
|
|
71
71
|
: { backgroundColor: hueColorString };
|
|
72
|
-
var opacitySliderStyle = ((_f = (_e = (_d = getWindow()) === null || _d === void 0 ? void 0 : _d.CSS) === null || _e === void 0 ? void 0 : _e.supports) === null || _f === void 0 ? void 0 : _f.call(_e, "--selected-color
|
|
73
|
-
? { '--selected-color': hueColorString }
|
|
72
|
+
var opacitySliderStyle = ((_f = (_e = (_d = getWindow()) === null || _d === void 0 ? void 0 : _d.CSS) === null || _e === void 0 ? void 0 : _e.supports) === null || _f === void 0 ? void 0 : _f.call(_e, "--iui-color-picker-selected-color: " + hueColorString))
|
|
73
|
+
? { '--iui-color-picker-selected-color': hueColorString }
|
|
74
74
|
: { backgroundColor: hueColorString };
|
|
75
75
|
var squareTop = 100 - hsvColor.v;
|
|
76
76
|
var squareLeft = hsvColor.s;
|
|
77
|
-
var colorDotStyle = ((_j = (_h = (_g = getWindow()) === null || _g === void 0 ? void 0 : _g.CSS) === null || _h === void 0 ? void 0 : _h.supports) === null || _j === void 0 ? void 0 : _j.call(_h, "--
|
|
77
|
+
var colorDotStyle = ((_j = (_h = (_g = getWindow()) === null || _g === void 0 ? void 0 : _g.CSS) === null || _h === void 0 ? void 0 : _h.supports) === null || _j === void 0 ? void 0 : _j.call(_h, "--iui-color-dot-inset: 0"))
|
|
78
78
|
? {
|
|
79
|
-
'--
|
|
80
|
-
'--left': squareLeft.toString() + '%',
|
|
79
|
+
'--iui-color-dot-inset': squareTop.toString() + "% auto auto " + squareLeft.toString() + "%",
|
|
81
80
|
}
|
|
82
81
|
: {
|
|
83
82
|
backgroundColor: dotColorString,
|
|
@@ -45,8 +45,8 @@ export var ColorSwatch = React.forwardRef(function (props, ref) {
|
|
|
45
45
|
}, [color]);
|
|
46
46
|
var _style = React.useMemo(function () {
|
|
47
47
|
var _a, _b, _c;
|
|
48
|
-
return ((_c = (_b = (_a = getWindow()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--swatch-
|
|
49
|
-
? __assign({ '--swatch-
|
|
48
|
+
return ((_c = (_b = (_a = getWindow()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--iui-color-swatch-background: " + colorString))
|
|
49
|
+
? __assign({ '--iui-color-swatch-background': colorString }, style) : __assign({ backgroundColor: colorString }, style);
|
|
50
50
|
}, [colorString, style]);
|
|
51
51
|
return (React.createElement("div", __assign({ className: cx('iui-color-swatch', { 'iui-active': isActive }, className), style: _style, onClick: onClick, tabIndex: isActive ? 0 : -1, "aria-selected": isActive, ref: ref }, rest)));
|
|
52
52
|
});
|
|
@@ -235,41 +235,46 @@ export var ComboBox = function (props) {
|
|
|
235
235
|
selectedValue,
|
|
236
236
|
memoizedItems,
|
|
237
237
|
]);
|
|
238
|
-
return (React.createElement(InputContainer, __assign({ className: className, isIconInline: true,
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
238
|
+
return (React.createElement(InputContainer, __assign({ className: className, isIconInline: true }, rest, { id: id }),
|
|
239
|
+
React.createElement("div", { className: 'iui-input-with-icon' },
|
|
240
|
+
React.createElement(Popover, __assign({ placement: 'bottom-start', visible: isOpen, onClickOutside: function (_, _a) {
|
|
241
|
+
var _b;
|
|
242
|
+
var target = _a.target;
|
|
243
|
+
if (!((_b = toggleButtonRef.current) === null || _b === void 0 ? void 0 : _b.contains(target))) {
|
|
244
|
+
setIsOpen(false);
|
|
245
|
+
}
|
|
246
|
+
}, animation: 'shift-away', duration: 200 }, dropdownMenuProps, { content: React.createElement(Menu, { id: id + "-list", className: 'iui-scroll', style: {
|
|
247
|
+
minWidth: minWidth,
|
|
248
|
+
maxWidth: "min(" + minWidth * 2 + "px, 90vw)",
|
|
249
|
+
maxHeight: 300,
|
|
250
|
+
}, setFocus: false, role: 'listbox', ref: menuRef }, menuItems), onHide: function (instance) {
|
|
251
|
+
var _a;
|
|
252
|
+
var selectedIndex = options.findIndex(function (_a) {
|
|
253
|
+
var value = _a.value;
|
|
254
|
+
return value === selectedValue;
|
|
255
|
+
});
|
|
256
|
+
setFocusedIndex(selectedIndex);
|
|
257
|
+
if (selectedIndex > -1) {
|
|
258
|
+
setInputValue(options[selectedIndex].label); // update input value to be same as selected value
|
|
259
|
+
}
|
|
260
|
+
(_a = dropdownMenuProps === null || dropdownMenuProps === void 0 ? void 0 : dropdownMenuProps.onHide) === null || _a === void 0 ? void 0 : _a.call(dropdownMenuProps, instance);
|
|
261
|
+
} }),
|
|
262
|
+
React.createElement(Input, __assign({ ref: inputRef, onKeyDown: onKeyDown, onFocus: function () { return setIsOpen(true); }, onChange: onInput, value: inputValue, "aria-activedescendant": isOpen && focusedIndex > -1
|
|
263
|
+
? getOptionId(focusedIndex)
|
|
264
|
+
: undefined, role: 'combobox', "aria-controls": isOpen ? id + "-list" : undefined, "aria-autocomplete": 'list', spellCheck: false, autoCapitalize: 'none', autoCorrect: 'off' }, inputProps))),
|
|
265
|
+
React.createElement("span", { ref: toggleButtonRef, className: cx('iui-end-icon', {
|
|
266
|
+
'iui-actionable': !(inputProps === null || inputProps === void 0 ? void 0 : inputProps.disabled),
|
|
267
|
+
'iui-disabled': inputProps === null || inputProps === void 0 ? void 0 : inputProps.disabled,
|
|
268
|
+
'iui-open': isOpen,
|
|
269
|
+
}), onClick: function () {
|
|
270
|
+
var _a;
|
|
271
|
+
if (isOpen) {
|
|
272
|
+
setIsOpen(false);
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
276
|
+
}
|
|
277
|
+
} },
|
|
278
|
+
React.createElement(SvgCaretDownSmall, { "aria-hidden": true })))));
|
|
274
279
|
};
|
|
275
280
|
export default ComboBox;
|
|
@@ -30,6 +30,7 @@ import { DropdownMenu } from '../DropdownMenu';
|
|
|
30
30
|
import { MenuItem } from '../Menu/MenuItem';
|
|
31
31
|
import { useTheme } from '../utils';
|
|
32
32
|
import '@itwin/itwinui-css/css/inputs.css';
|
|
33
|
+
import SvgCaretDownSmall from '@itwin/itwinui-icons-react/cjs/icons/CaretDownSmall';
|
|
33
34
|
/**
|
|
34
35
|
* Select component to select value from options.
|
|
35
36
|
* Generic type is used for value. It prevents you from mistakenly using other types in `options`, `value` and `onChange`.
|
|
@@ -91,6 +92,7 @@ export var Select = function (props) {
|
|
|
91
92
|
var _f = React.useState(0), minWidth = _f[0], setMinWidth = _f[1];
|
|
92
93
|
var toggle = function () { return setIsOpen(function (open) { return !open; }); };
|
|
93
94
|
var selectRef = React.useRef(null);
|
|
95
|
+
var toggleButtonRef = React.useRef(null);
|
|
94
96
|
var onShowHandler = React.useCallback(function (instance) {
|
|
95
97
|
setIsOpen(true);
|
|
96
98
|
onShow === null || onShow === void 0 ? void 0 : onShow(instance);
|
|
@@ -137,13 +139,20 @@ export var Select = function (props) {
|
|
|
137
139
|
}
|
|
138
140
|
return options.find(function (option) { return option.value === value; });
|
|
139
141
|
}, [options, value]);
|
|
140
|
-
return (React.createElement("div", __assign({ className: cx('iui-
|
|
141
|
-
React.createElement(DropdownMenu, __assign({ menuItems: menuItems, placement: 'bottom-start', className: cx('iui-scroll', menuClassName), style: __assign({ minWidth: minWidth, maxWidth: "min(" + minWidth * 2 + "px, 90vw)", maxHeight: "300px" }, menuStyle), role: 'listbox', onShow: onShowHandler, onHide: onHideHandler, disabled: disabled }, popoverProps, { visible: isOpen
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
142
|
+
return (React.createElement("div", __assign({ className: cx('iui-input-with-icon', className), "aria-expanded": isOpen, "aria-haspopup": 'listbox', style: style }, rest),
|
|
143
|
+
React.createElement(DropdownMenu, __assign({ menuItems: menuItems, placement: 'bottom-start', className: cx('iui-scroll', menuClassName), style: __assign({ minWidth: minWidth, maxWidth: "min(" + minWidth * 2 + "px, 90vw)", maxHeight: "300px" }, menuStyle), role: 'listbox', onShow: onShowHandler, onHide: onHideHandler, disabled: disabled }, popoverProps, { visible: isOpen, onClickOutside: function (_, _a) {
|
|
144
|
+
var _b;
|
|
145
|
+
var target = _a.target;
|
|
146
|
+
if (!((_b = toggleButtonRef.current) === null || _b === void 0 ? void 0 : _b.contains(target))) {
|
|
147
|
+
setIsOpen(false);
|
|
148
|
+
}
|
|
149
|
+
} }),
|
|
150
|
+
React.createElement("div", { ref: selectRef, className: cx('iui-select-button', (_a = {
|
|
151
|
+
'iui-placeholder': !selectedItem && !!placeholder,
|
|
152
|
+
'iui-disabled': disabled
|
|
153
|
+
},
|
|
154
|
+
_a["iui-" + size] = !!size,
|
|
155
|
+
_a)), onClick: function () { return !disabled && toggle(); }, onKeyDown: function (e) { return !disabled && onKeyDown(e, toggle); }, tabIndex: !disabled ? 0 : undefined },
|
|
147
156
|
!selectedItem && React.createElement("span", { className: 'iui-content' }, placeholder),
|
|
148
157
|
selectedItem &&
|
|
149
158
|
selectedItemRenderer &&
|
|
@@ -153,6 +162,12 @@ export var Select = function (props) {
|
|
|
153
162
|
React.cloneElement(selectedItem.icon, {
|
|
154
163
|
className: cx(selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.icon.props.className, 'iui-icon'),
|
|
155
164
|
}),
|
|
156
|
-
React.createElement("span", { className: 'iui-content' }, selectedItem.label)))))
|
|
165
|
+
React.createElement("span", { className: 'iui-content' }, selectedItem.label))))),
|
|
166
|
+
React.createElement("span", { ref: toggleButtonRef, className: cx('iui-end-icon', {
|
|
167
|
+
'iui-actionable': !disabled,
|
|
168
|
+
'iui-disabled': disabled,
|
|
169
|
+
'iui-open': isOpen,
|
|
170
|
+
}), onClick: function () { return !disabled && toggle(); } },
|
|
171
|
+
React.createElement(SvgCaretDownSmall, { "aria-hidden": true }))));
|
|
157
172
|
};
|
|
158
173
|
export default Select;
|
|
@@ -79,11 +79,10 @@ export var TablePaginator = function (props) {
|
|
|
79
79
|
var buttonSize = size != 'default' ? 'small' : undefined;
|
|
80
80
|
var pageButton = React.useCallback(function (index, tabIndex) {
|
|
81
81
|
if (tabIndex === void 0) { tabIndex = index === focusedIndex ? 0 : -1; }
|
|
82
|
-
return (React.createElement("
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}), onClick: function () { return onPageChange(index); }, "aria-current": index === currentPage, "aria-label": localization.goToPageLabel(index + 1), tabIndex: tabIndex }, index + 1)));
|
|
82
|
+
return (React.createElement("button", { key: index, className: cx('iui-paginator-page-button', {
|
|
83
|
+
'iui-active': index === currentPage,
|
|
84
|
+
'iui-paginator-page-button-small': buttonSize === 'small',
|
|
85
|
+
}), onClick: function () { return onPageChange(index); }, "aria-current": index === currentPage, "aria-label": localization.goToPageLabel(index + 1), tabIndex: tabIndex }, index + 1));
|
|
87
86
|
}, [focusedIndex, currentPage, localization, buttonSize, onPageChange]);
|
|
88
87
|
var totalPagesCount = Math.ceil(totalRowsCount / pageSize);
|
|
89
88
|
var pageList = React.useMemo(function () {
|
|
@@ -145,10 +144,9 @@ export var TablePaginator = function (props) {
|
|
|
145
144
|
var hasNoRows = totalPagesCount === 0;
|
|
146
145
|
var showPagesList = totalPagesCount > 1 || isLoading;
|
|
147
146
|
var showPageSizeList = pageSizeList && onPageSizeChange && !!totalRowsCount;
|
|
148
|
-
var ellipsis = (React.createElement("
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}) }, "\u2026")));
|
|
147
|
+
var ellipsis = (React.createElement("span", { className: cx('iui-paginator-ellipsis', {
|
|
148
|
+
'iui-paginator-ellipsis-small': size === 'small',
|
|
149
|
+
}) }, "\u2026"));
|
|
152
150
|
var noRowsContent = (React.createElement(React.Fragment, null, isLoading ? (React.createElement(ProgressRadial, { indeterminate: true, size: 'small' })) : (React.createElement(Button, { styleType: 'borderless', disabled: true, size: buttonSize }, "1"))));
|
|
153
151
|
if (!showPagesList && !showPageSizeList) {
|
|
154
152
|
return null;
|
package/esm/core/Tile/Tile.js
CHANGED
|
@@ -82,7 +82,6 @@ export var Tile = function (props) {
|
|
|
82
82
|
moreOptions && (React.createElement(DropdownMenu, { onShow: showMenu, onHide: hideMenu, menuItems: function (close) {
|
|
83
83
|
return moreOptions.map(function (option) {
|
|
84
84
|
return React.cloneElement(option, {
|
|
85
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
86
85
|
onClick: function (value) {
|
|
87
86
|
var _a, _b;
|
|
88
87
|
close();
|
|
@@ -91,10 +90,11 @@ export var Tile = function (props) {
|
|
|
91
90
|
});
|
|
92
91
|
});
|
|
93
92
|
} },
|
|
94
|
-
React.createElement(
|
|
93
|
+
React.createElement("div", { className: cx('iui-tile-more-options', {
|
|
95
94
|
'iui-visible': isMenuVisible,
|
|
96
|
-
})
|
|
97
|
-
React.createElement(
|
|
95
|
+
}) },
|
|
96
|
+
React.createElement(IconButton, { styleType: 'borderless', size: 'small', "aria-label": 'More options' },
|
|
97
|
+
React.createElement(SvgMore, null))))),
|
|
98
98
|
children),
|
|
99
99
|
buttons && React.createElement("div", { className: 'iui-tile-buttons' }, buttons)));
|
|
100
100
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/itwinui-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.31.0",
|
|
4
4
|
"author": "Bentley Systems",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "cjs/index.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"build-storybook": "build-storybook"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@itwin/itwinui-css": "^0.
|
|
43
|
+
"@itwin/itwinui-css": "^0.47.0",
|
|
44
44
|
"@itwin/itwinui-icons-react": "^1.5.0",
|
|
45
45
|
"@itwin/itwinui-illustrations-react": "^1.0.1",
|
|
46
46
|
"@tippyjs/react": "^4.2.5",
|