@itwin/itwinui-react 1.29.1 → 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 +36 -0
- package/cjs/core/Badge/Badge.js +2 -2
- package/cjs/core/ButtonGroup/ButtonGroup.d.ts +10 -3
- package/cjs/core/ButtonGroup/ButtonGroup.js +4 -3
- package/cjs/core/ColorPicker/ColorBuilder.js +19 -11
- package/cjs/core/ColorPicker/ColorSwatch.js +2 -2
- package/cjs/core/ComboBox/ComboBox.js +41 -36
- package/cjs/core/Modal/Modal.js +4 -1
- package/cjs/core/Radio/Radio.js +1 -1
- package/cjs/core/Select/Select.js +23 -8
- package/cjs/core/Slider/Slider.js +8 -2
- package/cjs/core/Table/Table.d.ts +10 -0
- package/cjs/core/Table/Table.js +23 -8
- package/cjs/core/Table/TablePaginator.js +7 -9
- package/cjs/core/Tile/Tile.js +16 -20
- package/cjs/core/utils/components/Popover.d.ts +2 -1
- package/cjs/core/utils/components/Popover.js +9 -6
- package/cjs/core/utils/components/VirtualScroll.d.ts +42 -0
- package/cjs/core/utils/components/VirtualScroll.js +174 -0
- package/cjs/core/utils/components/index.d.ts +1 -0
- package/cjs/core/utils/components/index.js +1 -0
- package/cjs/core/utils/props.d.ts +2 -2
- package/esm/core/Badge/Badge.js +2 -2
- package/esm/core/ButtonGroup/ButtonGroup.d.ts +10 -3
- package/esm/core/ButtonGroup/ButtonGroup.js +4 -3
- package/esm/core/ColorPicker/ColorBuilder.js +19 -11
- package/esm/core/ColorPicker/ColorSwatch.js +2 -2
- package/esm/core/ComboBox/ComboBox.js +41 -36
- package/esm/core/Modal/Modal.js +4 -1
- package/esm/core/Radio/Radio.js +1 -1
- package/esm/core/Select/Select.js +23 -8
- package/esm/core/Slider/Slider.js +8 -2
- package/esm/core/Table/Table.d.ts +10 -0
- package/esm/core/Table/Table.js +23 -8
- package/esm/core/Table/TablePaginator.js +7 -9
- package/esm/core/Tile/Tile.js +16 -20
- package/esm/core/utils/components/Popover.d.ts +2 -1
- package/esm/core/utils/components/Popover.js +9 -6
- package/esm/core/utils/components/VirtualScroll.d.ts +42 -0
- package/esm/core/utils/components/VirtualScroll.js +168 -0
- package/esm/core/utils/components/index.d.ts +1 -0
- package/esm/core/utils/components/index.js +1 -0
- package/esm/core/utils/props.d.ts +2 -2
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
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
|
+
|
|
14
|
+
## [1.30.0](https://www.github.com/iTwin/iTwinUI-react/compare/v1.29.3...v1.30.0) (2022-02-08)
|
|
15
|
+
|
|
16
|
+
### What's new
|
|
17
|
+
|
|
18
|
+
* **ButtonGroup:** Add new `overflowPlacement` prop to allow placing `overflowButton` at start ([#527](https://www.github.com/iTwin/iTwinUI-react/issues/527)) ([442ba87](https://www.github.com/iTwin/iTwinUI-react/commit/442ba87f8ba45240f07e8cacd9463cd95e5ec1e7))
|
|
19
|
+
* **Table:** Added new `enableVirtualization` prop for row virtualization ([#236](https://www.github.com/iTwin/iTwinUI-react/issues/236)) ([178bb75](https://www.github.com/iTwin/iTwinUI-react/commit/178bb756bf14fd0f780433ca33ea2a151d4c1436))
|
|
20
|
+
|
|
21
|
+
### Fixes
|
|
22
|
+
|
|
23
|
+
* **Popover:** Prevent from adding 5px padding ([#534](https://www.github.com/iTwin/iTwinUI-react/issues/534)) ([fea4782](https://www.github.com/iTwin/iTwinUI-react/commit/fea47823ae730b3e9b2bab2e2ec75b1ba8101b27))
|
|
24
|
+
* **Slider:** Handle pointermove events only when thumb is active ([#528](https://www.github.com/iTwin/iTwinUI-react/issues/528)) ([e41b53b](https://www.github.com/iTwin/iTwinUI-react/commit/e41b53b7ccda245f298bb33c6984f2431d917932))
|
|
25
|
+
|
|
26
|
+
### [1.29.3](https://www.github.com/iTwin/iTwinUI-react/compare/v1.29.2...v1.29.3) (2022-01-26)
|
|
27
|
+
|
|
28
|
+
### Fixes
|
|
29
|
+
|
|
30
|
+
* **Radio:** Fix radio dot size ([#525](https://www.github.com/iTwin/iTwinUI-react/issues/525)) ([8d952b9](https://www.github.com/iTwin/iTwinUI-react/commit/8d952b91dc83d21881f7ecca323cab55f5403d90))
|
|
31
|
+
|
|
32
|
+
### [1.29.2](https://www.github.com/iTwin/iTwinUI-react/compare/v1.29.1...v1.29.2) (2022-01-24)
|
|
33
|
+
|
|
34
|
+
### Fixes
|
|
35
|
+
|
|
36
|
+
* **Button:** Fix event typings for inline handlers ([#519](https://www.github.com/iTwin/iTwinUI-react/issues/519)) ([c72f5fd](https://www.github.com/iTwin/iTwinUI-react/commit/c72f5fdae00f61d38295f30111f36c403590ebfe))
|
|
37
|
+
* **Modal:** Dont use `stopPropagation` for closing on backdrop click ([#518](https://www.github.com/iTwin/iTwinUI-react/issues/518)) ([83a2400](https://www.github.com/iTwin/iTwinUI-react/commit/83a240046f4f04cc625fa8e53fe62d83a7af4c8b))
|
|
38
|
+
|
|
3
39
|
### [1.29.1](https://www.github.com/iTwin/iTwinUI-react/compare/v1.29.0...v1.29.1) (2022-01-19)
|
|
4
40
|
|
|
5
41
|
### Fixes
|
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;
|
|
@@ -6,13 +6,20 @@ export declare type ButtonGroupProps = {
|
|
|
6
6
|
*/
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
/**
|
|
9
|
-
* If specified, this prop will be used to show a custom button
|
|
10
|
-
*
|
|
9
|
+
* If specified, this prop will be used to show a custom button when overflow happens,
|
|
10
|
+
* i.e. when there is not enough space to fit all the buttons.
|
|
11
11
|
*
|
|
12
12
|
* Expects a function that takes the index of the first button that is overflowing (i.e. hidden)
|
|
13
13
|
* and returns the `ReactNode` to render.
|
|
14
|
+
*
|
|
15
|
+
* The placement of this button can be controlled using the `overflowPlacement` prop.
|
|
14
16
|
*/
|
|
15
17
|
overflowButton?: (firstOverflowingIndex: number) => React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* If `overflowButton` is specified, should it placed at the start or the end?
|
|
20
|
+
* @default 'end'
|
|
21
|
+
*/
|
|
22
|
+
overflowPlacement?: 'start' | 'end';
|
|
16
23
|
} & React.ComponentPropsWithRef<'div'>;
|
|
17
24
|
/**
|
|
18
25
|
* Group buttons together for common actions.
|
|
@@ -42,5 +49,5 @@ export declare type ButtonGroupProps = {
|
|
|
42
49
|
* {buttons}
|
|
43
50
|
* </ButtonGroup>
|
|
44
51
|
*/
|
|
45
|
-
export declare const ButtonGroup: React.ForwardRefExoticComponent<Pick<ButtonGroupProps, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "overflowButton"> & React.RefAttributes<HTMLDivElement>>;
|
|
52
|
+
export declare const ButtonGroup: React.ForwardRefExoticComponent<Pick<ButtonGroupProps, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "overflowButton" | "overflowPlacement"> & React.RefAttributes<HTMLDivElement>>;
|
|
46
53
|
export default ButtonGroup;
|
|
@@ -63,13 +63,14 @@ require("@itwin/itwinui-css/css/button.css");
|
|
|
63
63
|
* </ButtonGroup>
|
|
64
64
|
*/
|
|
65
65
|
exports.ButtonGroup = react_1.default.forwardRef(function (props, ref) {
|
|
66
|
-
var children = props.children, className = props.className, style = props.style, overflowButton = props.overflowButton, rest = __rest(props, ["children", "className", "style", "overflowButton"]);
|
|
66
|
+
var children = props.children, className = props.className, style = props.style, overflowButton = props.overflowButton, _a = props.overflowPlacement, overflowPlacement = _a === void 0 ? 'end' : _a, rest = __rest(props, ["children", "className", "style", "overflowButton", "overflowPlacement"]);
|
|
67
67
|
var items = react_1.default.useMemo(function () { var _a; return (_a = react_1.default.Children.map(children, function (child) { return react_1.default.createElement("div", null, child); })) !== null && _a !== void 0 ? _a : []; }, [children]);
|
|
68
68
|
(0, utils_1.useTheme)();
|
|
69
|
-
var
|
|
69
|
+
var _b = (0, utils_1.useOverflow)(items, !overflowButton), overflowRef = _b[0], visibleCount = _b[1];
|
|
70
70
|
var refs = (0, utils_1.useMergedRefs)(overflowRef, ref);
|
|
71
71
|
return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-button-group', className), style: __assign(__assign({}, (!!overflowButton && { width: '100%' })), style), ref: refs }, rest), !!overflowButton && visibleCount < items.length ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
72
|
+
overflowButton && overflowPlacement === 'start' && (react_1.default.createElement("div", null, overflowButton(visibleCount))),
|
|
72
73
|
items.slice(0, visibleCount - 1),
|
|
73
|
-
overflowButton(visibleCount))) : (items)));
|
|
74
|
+
overflowButton && overflowPlacement === 'end' && (react_1.default.createElement("div", null, overflowButton(visibleCount))))) : (items)));
|
|
74
75
|
});
|
|
75
76
|
exports.default = exports.ButtonGroup;
|
|
@@ -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,
|
|
@@ -138,22 +137,31 @@ exports.ColorBuilder = react_1.default.forwardRef(function (props, ref) {
|
|
|
138
137
|
}
|
|
139
138
|
}, [colorDotActive, updateColorDot]);
|
|
140
139
|
var handleSquarePointerUp = react_1.default.useCallback(function (event) {
|
|
140
|
+
if (!colorDotActive) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
141
143
|
updateSquareValue(event, 'onChange');
|
|
142
144
|
setColorDotActive(false);
|
|
143
145
|
event.preventDefault();
|
|
144
146
|
event.stopPropagation();
|
|
145
|
-
}, [updateSquareValue]);
|
|
147
|
+
}, [colorDotActive, updateSquareValue]);
|
|
146
148
|
(0, utils_1.useEventListener)('pointerup', handleSquarePointerUp, (_k = builderRef.current) === null || _k === void 0 ? void 0 : _k.ownerDocument);
|
|
147
149
|
var handleSquarePointerMove = react_1.default.useCallback(function (event) {
|
|
150
|
+
if (!colorDotActive) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
148
153
|
event.preventDefault();
|
|
149
154
|
event.stopPropagation();
|
|
150
155
|
updateSquareValue(event, 'onUpdate');
|
|
151
|
-
}, [updateSquareValue]);
|
|
156
|
+
}, [colorDotActive, updateSquareValue]);
|
|
152
157
|
(0, utils_1.useEventListener)('pointermove', handleSquarePointerMove, (_l = builderRef.current) === null || _l === void 0 ? void 0 : _l.ownerDocument);
|
|
153
158
|
var handleSquarePointerLeave = react_1.default.useCallback(function (event) {
|
|
159
|
+
if (!colorDotActive) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
154
162
|
updateSquareValue(event, 'onChange');
|
|
155
163
|
setColorDotActive(false);
|
|
156
|
-
}, [updateSquareValue]);
|
|
164
|
+
}, [colorDotActive, updateSquareValue]);
|
|
157
165
|
(0, utils_1.useEventListener)('pointerleave', handleSquarePointerLeave, (_m = builderRef.current) === null || _m === void 0 ? void 0 : _m.ownerDocument);
|
|
158
166
|
var keysPressed = react_1.default.useRef({}); // keep track of which keys are currently pressed
|
|
159
167
|
// Arrow key navigation for color dot
|
|
@@ -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;
|
package/cjs/core/Modal/Modal.js
CHANGED
|
@@ -110,13 +110,16 @@ var Modal = function (props) {
|
|
|
110
110
|
var handleMouseDown = function (event) {
|
|
111
111
|
// Prevents React from resetting its properties
|
|
112
112
|
event.persist();
|
|
113
|
+
if (event.target !== overlayRef.current) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
113
116
|
if (isDismissible && closeOnExternalClick && onClose) {
|
|
114
117
|
onClose(event);
|
|
115
118
|
}
|
|
116
119
|
};
|
|
117
120
|
return !!container ? (react_dom_1.default.createPortal(isOpen && (react_1.default.createElement(utils_1.FocusTrap, null,
|
|
118
121
|
react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-modal', 'iui-modal-visible', className), tabIndex: -1, onKeyDown: handleKeyDown, ref: overlayRef, onMouseDown: handleMouseDown }, rest),
|
|
119
|
-
react_1.default.createElement("div", { className: 'iui-modal-dialog', id: id, style: style, role: 'dialog', "aria-modal": 'true'
|
|
122
|
+
react_1.default.createElement("div", { className: 'iui-modal-dialog', id: id, style: style, role: 'dialog', "aria-modal": 'true' },
|
|
120
123
|
react_1.default.createElement("div", { className: 'iui-title-bar' },
|
|
121
124
|
react_1.default.createElement("div", { className: 'iui-title' }, title),
|
|
122
125
|
isDismissible && (react_1.default.createElement(IconButton_1.IconButton, { size: 'small', styleType: 'borderless', onClick: onClose, "aria-label": 'Close' },
|
package/cjs/core/Radio/Radio.js
CHANGED
|
@@ -58,7 +58,7 @@ exports.Radio = react_1.default.forwardRef(function (props, ref) {
|
|
|
58
58
|
react_1.default.createElement("input", __assign({ disabled: disabled, type: 'radio', ref: refs }, rest)),
|
|
59
59
|
react_1.default.createElement("span", { className: (0, classnames_1.default)('iui-radio-dot', checkmarkClassName), style: checkmarkStyle },
|
|
60
60
|
react_1.default.createElement("svg", { viewBox: '0 0 16 16', "aria-hidden": 'true', focusable: 'false' },
|
|
61
|
-
react_1.default.createElement("circle", { cx: '8', cy: '8', r: '
|
|
61
|
+
react_1.default.createElement("circle", { cx: '8', cy: '8', r: '4' }))),
|
|
62
62
|
label && react_1.default.createElement("span", { className: 'iui-label' }, label)));
|
|
63
63
|
});
|
|
64
64
|
exports.default = exports.Radio;
|
|
@@ -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;
|
|
@@ -164,10 +164,13 @@ exports.Slider = react_1.default.forwardRef(function (props, ref) {
|
|
|
164
164
|
onChange,
|
|
165
165
|
]);
|
|
166
166
|
var handlePointerMove = react_1.default.useCallback(function (event) {
|
|
167
|
+
if (activeThumbIndex === undefined) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
167
170
|
event.preventDefault();
|
|
168
171
|
event.stopPropagation();
|
|
169
172
|
updateThumbValue(event, 'onUpdate');
|
|
170
|
-
}, [updateThumbValue]);
|
|
173
|
+
}, [activeThumbIndex, updateThumbValue]);
|
|
171
174
|
// function called by Thumb keyboard processing
|
|
172
175
|
var onThumbValueChanged = react_1.default.useCallback(function (index, value) {
|
|
173
176
|
if (currentValues[index] === value) {
|
|
@@ -182,11 +185,14 @@ exports.Slider = react_1.default.forwardRef(function (props, ref) {
|
|
|
182
185
|
setActiveThumbIndex(index);
|
|
183
186
|
}, []);
|
|
184
187
|
var handlePointerUp = react_1.default.useCallback(function (event) {
|
|
188
|
+
if (activeThumbIndex === undefined) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
185
191
|
updateThumbValue(event, 'onChange');
|
|
186
192
|
setActiveThumbIndex(undefined);
|
|
187
193
|
event.preventDefault();
|
|
188
194
|
event.stopPropagation();
|
|
189
|
-
}, [updateThumbValue]);
|
|
195
|
+
}, [activeThumbIndex, updateThumbValue]);
|
|
190
196
|
var handlePointerDownOnSlider = react_1.default.useCallback(function (event) {
|
|
191
197
|
if (containerRef.current) {
|
|
192
198
|
var percent = getPercentageOfRectangle(containerRef.current.getBoundingClientRect(), event.clientX);
|
|
@@ -56,6 +56,7 @@ export declare type TableProps<T extends Record<string, unknown> = Record<string
|
|
|
56
56
|
isSelectable?: boolean;
|
|
57
57
|
/**
|
|
58
58
|
* Handler for rows selection. Must be memoized.
|
|
59
|
+
* This is triggered only by user initiated actions (i.e. data change will not call it).
|
|
59
60
|
*/
|
|
60
61
|
onSelect?: (selectedData: T[] | undefined, tableState?: TableState<T>) => void;
|
|
61
62
|
/**
|
|
@@ -160,6 +161,15 @@ export declare type TableProps<T extends Record<string, unknown> = Record<string
|
|
|
160
161
|
* @default 'default'
|
|
161
162
|
*/
|
|
162
163
|
styleType?: 'default' | 'zebra-rows';
|
|
164
|
+
/**
|
|
165
|
+
* Virtualization is used for the scrollable table body.
|
|
166
|
+
* Height on the table is required for virtualization to work.
|
|
167
|
+
* @example
|
|
168
|
+
* <Table enableVirtualization style={{height: 400}} {...} />
|
|
169
|
+
* @default false
|
|
170
|
+
* @beta
|
|
171
|
+
*/
|
|
172
|
+
enableVirtualization?: boolean;
|
|
163
173
|
} & Omit<CommonProps, 'title'>;
|
|
164
174
|
/**
|
|
165
175
|
* Table based on [react-table](https://react-table.tanstack.com/docs/api/overview).
|
package/cjs/core/Table/Table.js
CHANGED
|
@@ -46,6 +46,7 @@ var hooks_1 = require("./hooks");
|
|
|
46
46
|
var actionHandlers_1 = require("./actionHandlers");
|
|
47
47
|
var selectHandler_1 = require("./actionHandlers/selectHandler");
|
|
48
48
|
var resizeHandler_1 = require("./actionHandlers/resizeHandler");
|
|
49
|
+
var VirtualScroll_1 = __importDefault(require("../utils/components/VirtualScroll"));
|
|
49
50
|
var singleRowSelectedAction = 'singleRowSelected';
|
|
50
51
|
var tableResizeStartAction = 'tableResizeStart';
|
|
51
52
|
var tableResizeEndAction = 'tableResizeEnd';
|
|
@@ -93,9 +94,9 @@ var tableResizeEndAction = 'tableResizeEnd';
|
|
|
93
94
|
*/
|
|
94
95
|
var Table = function (props) {
|
|
95
96
|
var _a;
|
|
96
|
-
var data = props.data, columns = props.columns, _b = props.isLoading, isLoading = _b === void 0 ? false : _b, emptyTableContent = props.emptyTableContent, className = props.className, style = props.style, id = props.id, _c = props.isSelectable, isSelectable = _c === void 0 ? false : _c, onSelect = props.onSelect, onRowClick = props.onRowClick, _d = props.isSortable, isSortable = _d === void 0 ? false : _d, onSort = props.onSort, stateReducer = props.stateReducer, onBottomReached = props.onBottomReached, onRowInViewport = props.onRowInViewport, _e = props.intersectionMargin, intersectionMargin = _e === void 0 ? 300 : _e, subComponent = props.subComponent, onExpand = props.onExpand, onFilter = props.onFilter, emptyFilteredTableContent = props.emptyFilteredTableContent, filterFunctions = props.filterTypes, expanderCell = props.expanderCell, isRowDisabled = props.isRowDisabled, rowProps = props.rowProps, _f = props.density, density = _f === void 0 ? 'default' : _f, _g = props.selectSubRows, selectSubRows = _g === void 0 ? true : _g, getSubRows = props.getSubRows, _h = props.selectRowOnClick, selectRowOnClick = _h === void 0 ? true : _h, paginatorRenderer = props.paginatorRenderer, _j = props.pageSize, pageSize = _j === void 0 ? 25 : _j, _k = props.isResizable, isResizable = _k === void 0 ? false : _k, _l = props.styleType, styleType = _l === void 0 ? 'default' : _l, rest = __rest(props, ["data", "columns", "isLoading", "emptyTableContent", "className", "style", "id", "isSelectable", "onSelect", "onRowClick", "isSortable", "onSort", "stateReducer", "onBottomReached", "onRowInViewport", "intersectionMargin", "subComponent", "onExpand", "onFilter", "emptyFilteredTableContent", "filterTypes", "expanderCell", "isRowDisabled", "rowProps", "density", "selectSubRows", "getSubRows", "selectRowOnClick", "paginatorRenderer", "pageSize", "isResizable", "styleType"]);
|
|
97
|
+
var data = props.data, columns = props.columns, _b = props.isLoading, isLoading = _b === void 0 ? false : _b, emptyTableContent = props.emptyTableContent, className = props.className, style = props.style, id = props.id, _c = props.isSelectable, isSelectable = _c === void 0 ? false : _c, onSelect = props.onSelect, onRowClick = props.onRowClick, _d = props.isSortable, isSortable = _d === void 0 ? false : _d, onSort = props.onSort, stateReducer = props.stateReducer, onBottomReached = props.onBottomReached, onRowInViewport = props.onRowInViewport, _e = props.intersectionMargin, intersectionMargin = _e === void 0 ? 300 : _e, subComponent = props.subComponent, onExpand = props.onExpand, onFilter = props.onFilter, emptyFilteredTableContent = props.emptyFilteredTableContent, filterFunctions = props.filterTypes, expanderCell = props.expanderCell, isRowDisabled = props.isRowDisabled, rowProps = props.rowProps, _f = props.density, density = _f === void 0 ? 'default' : _f, _g = props.selectSubRows, selectSubRows = _g === void 0 ? true : _g, getSubRows = props.getSubRows, _h = props.selectRowOnClick, selectRowOnClick = _h === void 0 ? true : _h, paginatorRenderer = props.paginatorRenderer, _j = props.pageSize, pageSize = _j === void 0 ? 25 : _j, _k = props.isResizable, isResizable = _k === void 0 ? false : _k, _l = props.styleType, styleType = _l === void 0 ? 'default' : _l, _m = props.enableVirtualization, enableVirtualization = _m === void 0 ? false : _m, rest = __rest(props, ["data", "columns", "isLoading", "emptyTableContent", "className", "style", "id", "isSelectable", "onSelect", "onRowClick", "isSortable", "onSort", "stateReducer", "onBottomReached", "onRowInViewport", "intersectionMargin", "subComponent", "onExpand", "onFilter", "emptyFilteredTableContent", "filterTypes", "expanderCell", "isRowDisabled", "rowProps", "density", "selectSubRows", "getSubRows", "selectRowOnClick", "paginatorRenderer", "pageSize", "isResizable", "styleType", "enableVirtualization"]);
|
|
97
98
|
(0, utils_1.useTheme)();
|
|
98
|
-
var
|
|
99
|
+
var _o = react_1.default.useState(), ownerDocument = _o[0], setOwnerDocument = _o[1];
|
|
99
100
|
var defaultColumn = react_1.default.useMemo(function () { return ({
|
|
100
101
|
maxWidth: 0,
|
|
101
102
|
minWidth: 0,
|
|
@@ -233,6 +234,23 @@ var Table = function (props) {
|
|
|
233
234
|
});
|
|
234
235
|
var headerRef = react_1.default.useRef(null);
|
|
235
236
|
var bodyRef = react_1.default.useRef(null);
|
|
237
|
+
var getPreparedRow = react_1.default.useCallback(function (row) {
|
|
238
|
+
prepareRow(row);
|
|
239
|
+
return (react_1.default.createElement(TableRowMemoized_1.TableRowMemoized, { row: row, rowProps: rowProps, isLast: row.index === data.length - 1, onRowInViewport: onRowInViewportRef, onBottomReached: onBottomReachedRef, intersectionMargin: intersectionMargin, state: state, key: row.getRowProps().key, onClick: onRowClickHandler, subComponent: subComponent, isDisabled: !!(isRowDisabled === null || isRowDisabled === void 0 ? void 0 : isRowDisabled(row.original)), tableHasSubRows: hasAnySubRows, tableInstance: instance, expanderCell: expanderCell }));
|
|
240
|
+
}, [
|
|
241
|
+
data.length,
|
|
242
|
+
expanderCell,
|
|
243
|
+
hasAnySubRows,
|
|
244
|
+
instance,
|
|
245
|
+
intersectionMargin,
|
|
246
|
+
isRowDisabled,
|
|
247
|
+
onRowClickHandler,
|
|
248
|
+
prepareRow,
|
|
249
|
+
rowProps,
|
|
250
|
+
state,
|
|
251
|
+
subComponent,
|
|
252
|
+
]);
|
|
253
|
+
var virtualizedItemRenderer = react_1.default.useCallback(function (index) { return getPreparedRow(page[index]); }, [getPreparedRow, page]);
|
|
236
254
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
237
255
|
react_1.default.createElement("div", __assign({ ref: function (element) {
|
|
238
256
|
setOwnerDocument(element === null || element === void 0 ? void 0 : element.ownerDocument);
|
|
@@ -269,16 +287,13 @@ var Table = function (props) {
|
|
|
269
287
|
className: (0, classnames_1.default)('iui-table-body', {
|
|
270
288
|
'iui-zebra-striping': styleType === 'zebra-rows',
|
|
271
289
|
}),
|
|
290
|
+
style: { outline: 0 },
|
|
272
291
|
}), { ref: bodyRef, onScroll: function () {
|
|
273
292
|
if (headerRef.current && bodyRef.current) {
|
|
274
293
|
headerRef.current.scrollLeft = bodyRef.current.scrollLeft;
|
|
275
294
|
}
|
|
276
|
-
} }),
|
|
277
|
-
data.length !== 0 &&
|
|
278
|
-
page.map(function (row) {
|
|
279
|
-
prepareRow(row);
|
|
280
|
-
return (react_1.default.createElement(TableRowMemoized_1.TableRowMemoized, { row: row, rowProps: rowProps, isLast: row.index === data.length - 1, onRowInViewport: onRowInViewportRef, onBottomReached: onBottomReachedRef, intersectionMargin: intersectionMargin, state: state, key: row.getRowProps().key, onClick: onRowClickHandler, subComponent: subComponent, isDisabled: !!(isRowDisabled === null || isRowDisabled === void 0 ? void 0 : isRowDisabled(row.original)), tableHasSubRows: hasAnySubRows, tableInstance: instance, expanderCell: expanderCell }));
|
|
281
|
-
}),
|
|
295
|
+
}, tabIndex: -1 }),
|
|
296
|
+
data.length !== 0 && (react_1.default.createElement(react_1.default.Fragment, null, enableVirtualization ? (react_1.default.createElement(VirtualScroll_1.default, { itemsLength: page.length, itemRenderer: virtualizedItemRenderer })) : (page.map(function (row) { return getPreparedRow(row); })))),
|
|
282
297
|
isLoading && data.length === 0 && (react_1.default.createElement("div", { className: 'iui-table-empty' },
|
|
283
298
|
react_1.default.createElement(ProgressIndicators_1.ProgressRadial, { indeterminate: true }))),
|
|
284
299
|
isLoading && data.length !== 0 && (react_1.default.createElement("div", { className: 'iui-row' },
|
|
@@ -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
|
@@ -63,32 +63,31 @@ var Tile = function (props) {
|
|
|
63
63
|
var showMenu = react_1.default.useCallback(function () { return setIsMenuVisible(true); }, []);
|
|
64
64
|
var hideMenu = react_1.default.useCallback(function () { return setIsMenuVisible(false); }, []);
|
|
65
65
|
return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-tile', { 'iui-folder': variant === 'folder' }, { 'iui-new': isNew }, { 'iui-selected': isSelected }, className) }, rest),
|
|
66
|
-
thumbnail && (react_1.default.createElement("div", { className: 'iui-thumbnail' },
|
|
67
|
-
typeof thumbnail === 'string' ? (react_1.default.createElement("div", { className: 'iui-picture', style: { backgroundImage: "url(" + thumbnail + ")" } })) : thumbnail && thumbnail.type === 'img' ? (react_1.default.cloneElement(thumbnail, {
|
|
68
|
-
className: 'iui-picture',
|
|
66
|
+
thumbnail && (react_1.default.createElement("div", { className: 'iui-tile-thumbnail' },
|
|
67
|
+
typeof thumbnail === 'string' ? (react_1.default.createElement("div", { className: 'iui-tile-thumbnail-picture', style: { backgroundImage: "url(" + thumbnail + ")" } })) : thumbnail && thumbnail.type === 'img' ? (react_1.default.cloneElement(thumbnail, {
|
|
68
|
+
className: 'iui-tile-thumbnail-picture',
|
|
69
69
|
})) : react_1.default.isValidElement(thumbnail) ? (react_1.default.cloneElement(thumbnail, {
|
|
70
70
|
className: (0, classnames_1.default)('iui-thumbnail-icon', thumbnail.props.className),
|
|
71
71
|
})) : (thumbnail),
|
|
72
72
|
leftIcon &&
|
|
73
73
|
react_1.default.cloneElement(leftIcon, {
|
|
74
|
-
className: 'iui-small iui-type-indicator',
|
|
74
|
+
className: 'iui-small iui-tile-thumbnail-type-indicator',
|
|
75
75
|
}),
|
|
76
76
|
rightIcon &&
|
|
77
77
|
react_1.default.cloneElement(rightIcon, {
|
|
78
|
-
className: 'iui-small iui-quick-action',
|
|
78
|
+
className: 'iui-small iui-tile-thumbnail-quick-action',
|
|
79
79
|
}),
|
|
80
|
-
badge && react_1.default.createElement("div", { className: 'iui-badge-container' }, badge))),
|
|
81
|
-
react_1.default.createElement("div", { className: 'iui-content' },
|
|
82
|
-
react_1.default.createElement("div", { className: 'iui-name' },
|
|
80
|
+
badge && (react_1.default.createElement("div", { className: 'iui-tile-thumbnail-badge-container' }, badge)))),
|
|
81
|
+
react_1.default.createElement("div", { className: 'iui-tile-content' },
|
|
82
|
+
react_1.default.createElement("div", { className: 'iui-tile-name' },
|
|
83
83
|
isSelected && (react_1.default.createElement(Checkmark_1.default, { className: (0, classnames_1.default)('iui-tile-status-icon', 'iui-informational'), "aria-hidden": true })),
|
|
84
84
|
isNew && (react_1.default.createElement(New_1.default, { className: (0, classnames_1.default)('iui-tile-status-icon', 'iui-positive'), "aria-hidden": true })),
|
|
85
|
-
react_1.default.createElement("span", { className: 'iui-name-label' }, name)),
|
|
86
|
-
description != undefined && (react_1.default.createElement("div", { className: 'iui-description' }, description)),
|
|
87
|
-
metadata != undefined && (react_1.default.createElement("div", { className: 'iui-metadata' }, metadata)),
|
|
85
|
+
react_1.default.createElement("span", { className: 'iui-tile-name-label' }, name)),
|
|
86
|
+
description != undefined && (react_1.default.createElement("div", { className: 'iui-tile-description' }, description)),
|
|
87
|
+
metadata != undefined && (react_1.default.createElement("div", { className: 'iui-tile-metadata' }, metadata)),
|
|
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,16 +96,13 @@ 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
|
-
buttons &&
|
|
106
|
-
return react_1.default.cloneElement(button, {
|
|
107
|
-
className: (0, classnames_1.default)('iui-tile-button', button.props.className),
|
|
108
|
-
});
|
|
109
|
-
})))));
|
|
105
|
+
buttons && react_1.default.createElement("div", { className: 'iui-tile-buttons' }, buttons)));
|
|
110
106
|
};
|
|
111
107
|
exports.Tile = Tile;
|
|
112
108
|
exports.default = exports.Tile;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TippyProps } from '@tippyjs/react';
|
|
3
|
-
import { Placement, Instance } from 'tippy.js';
|
|
3
|
+
import type { Placement, Instance } from 'tippy.js';
|
|
4
4
|
export declare type PopoverInstance = Instance;
|
|
5
|
+
import '@itwin/itwinui-css/css/popover.css';
|
|
5
6
|
export declare type PopoverProps = {
|
|
6
7
|
/**
|
|
7
8
|
* Controlled flag for whether the popover is visible.
|