@itwin/itwinui-react 1.36.0 → 1.37.2
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 +27 -0
- package/cjs/core/Alert/Alert.js +1 -1
- package/cjs/core/Badge/Badge.js +1 -1
- package/cjs/core/Breadcrumbs/Breadcrumbs.d.ts +2 -2
- package/cjs/core/Buttons/Button/Button.js +2 -2
- package/cjs/core/Buttons/IconButton/IconButton.js +2 -2
- package/cjs/core/Carousel/Carousel.js +1 -1
- package/cjs/core/Carousel/CarouselDotsList.js +1 -1
- package/cjs/core/Carousel/CarouselSlider.js +1 -1
- package/cjs/core/Checkbox/Checkbox.js +1 -1
- package/cjs/core/ColorPicker/ColorBuilder.js +3 -3
- package/cjs/core/ColorPicker/ColorInputPanel.js +1 -1
- package/cjs/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/cjs/core/ColorPicker/ColorSwatch.js +1 -1
- package/cjs/core/ComboBox/ComboBox.js +9 -6
- package/cjs/core/DatePicker/DatePicker.js +2 -2
- package/cjs/core/ExpandableBlock/ExpandableBlock.js +1 -1
- package/cjs/core/Footer/Footer.js +2 -2
- package/cjs/core/Header/HeaderBreadcrumbs.js +1 -1
- package/cjs/core/Header/HeaderButton.js +1 -0
- package/cjs/core/InformationPanel/InformationPanel.js +2 -2
- package/cjs/core/Input/Input.js +1 -1
- package/cjs/core/ProgressIndicators/ProgressLinear/ProgressLinear.d.ts +1 -1
- package/cjs/core/ProgressIndicators/ProgressLinear/ProgressLinear.js +2 -2
- package/cjs/core/ProgressIndicators/ProgressRadial/ProgressRadial.js +2 -2
- package/cjs/core/Radio/Radio.js +1 -1
- package/cjs/core/Select/Select.js +3 -3
- package/cjs/core/SkipToContentLink/SkipToContentLink.d.ts +33 -0
- package/cjs/core/SkipToContentLink/SkipToContentLink.js +50 -0
- package/cjs/core/SkipToContentLink/index.d.ts +4 -0
- package/cjs/core/SkipToContentLink/index.js +10 -0
- package/cjs/core/Slider/Slider.js +1 -1
- package/cjs/core/Slider/Thumb.js +1 -1
- package/cjs/core/Slider/Track.js +1 -1
- package/cjs/core/Surface/Surface.d.ts +32 -0
- package/cjs/core/Surface/Surface.js +70 -0
- package/cjs/core/Surface/index.d.ts +4 -0
- package/cjs/core/Surface/index.js +10 -0
- package/cjs/core/Table/Table.d.ts +6 -0
- package/cjs/core/Table/Table.js +34 -12
- package/cjs/core/Table/TablePaginator.js +6 -6
- package/cjs/core/Table/TableRowMemoized.js +1 -1
- package/cjs/core/Table/cells/EditableCell.js +2 -1
- package/cjs/core/Table/columns/actionColumn.js +2 -2
- package/cjs/core/Table/hooks/useSelectionCell.d.ts +1 -1
- package/cjs/core/Table/hooks/useSelectionCell.js +3 -2
- package/cjs/core/Table/utils.js +5 -5
- package/cjs/core/Tabs/Tabs.d.ts +1 -1
- package/cjs/core/Tabs/Tabs.js +7 -8
- package/cjs/core/Tag/Tag.js +6 -3
- package/cjs/core/Tag/TagContainer.js +1 -1
- package/cjs/core/Tile/Tile.d.ts +6 -2
- package/cjs/core/Tile/Tile.js +8 -3
- package/cjs/core/Toast/Toast.js +2 -2
- package/cjs/core/Toast/ToastWrapper.js +1 -1
- package/cjs/core/Tree/TreeNode.js +2 -2
- package/cjs/core/Typography/Text/Text.js +1 -1
- package/cjs/core/UserIcon/UserIcon.js +2 -2
- package/cjs/core/UserIconGroup/UserIconGroup.js +3 -3
- package/cjs/core/Wizard/Step.js +1 -1
- package/cjs/core/Wizard/Wizard.js +1 -1
- package/cjs/core/index.d.ts +4 -0
- package/cjs/core/index.js +6 -2
- package/cjs/core/utils/color/ColorValue.js +11 -11
- package/cjs/core/utils/color/index.js +5 -1
- package/cjs/core/utils/components/FocusTrap.js +6 -8
- package/cjs/core/utils/components/InputContainer.js +1 -1
- package/cjs/core/utils/components/MiddleTextTruncation.js +1 -1
- package/cjs/core/utils/components/VirtualScroll.js +1 -1
- package/cjs/core/utils/components/WithCSSTransition.js +5 -5
- package/cjs/core/utils/components/index.js +5 -1
- package/cjs/core/utils/functions/focusable.js +1 -1
- package/cjs/core/utils/functions/index.js +5 -1
- package/cjs/core/utils/hooks/index.js +5 -1
- package/cjs/core/utils/hooks/useOverflow.js +3 -3
- package/cjs/core/utils/hooks/useTheme.js +1 -1
- package/cjs/core/utils/index.js +5 -1
- package/cjs/index.js +5 -1
- package/esm/core/Alert/Alert.js +1 -1
- package/esm/core/Badge/Badge.js +1 -1
- package/esm/core/Breadcrumbs/Breadcrumbs.d.ts +2 -2
- package/esm/core/Buttons/Button/Button.js +2 -2
- package/esm/core/Buttons/IconButton/IconButton.js +2 -2
- package/esm/core/Carousel/Carousel.js +1 -1
- package/esm/core/Carousel/CarouselDotsList.js +1 -1
- package/esm/core/Carousel/CarouselSlider.js +1 -1
- package/esm/core/Checkbox/Checkbox.js +1 -1
- package/esm/core/ColorPicker/ColorBuilder.js +3 -3
- package/esm/core/ColorPicker/ColorInputPanel.js +1 -1
- package/esm/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/esm/core/ColorPicker/ColorSwatch.js +1 -1
- package/esm/core/ComboBox/ComboBox.js +9 -6
- package/esm/core/DatePicker/DatePicker.js +2 -2
- package/esm/core/ExpandableBlock/ExpandableBlock.js +1 -1
- package/esm/core/Footer/Footer.js +2 -2
- package/esm/core/Header/HeaderBreadcrumbs.js +1 -1
- package/esm/core/Header/HeaderButton.js +1 -0
- package/esm/core/InformationPanel/InformationPanel.js +2 -2
- package/esm/core/Input/Input.js +1 -1
- package/esm/core/ProgressIndicators/ProgressLinear/ProgressLinear.d.ts +1 -1
- package/esm/core/ProgressIndicators/ProgressLinear/ProgressLinear.js +2 -2
- package/esm/core/ProgressIndicators/ProgressRadial/ProgressRadial.js +2 -2
- package/esm/core/Radio/Radio.js +1 -1
- package/esm/core/Select/Select.js +3 -3
- package/esm/core/SkipToContentLink/SkipToContentLink.d.ts +33 -0
- package/esm/core/SkipToContentLink/SkipToContentLink.js +44 -0
- package/esm/core/SkipToContentLink/index.d.ts +4 -0
- package/esm/core/SkipToContentLink/index.js +6 -0
- package/esm/core/Slider/Slider.js +1 -1
- package/esm/core/Slider/Thumb.js +1 -1
- package/esm/core/Slider/Track.js +1 -1
- package/esm/core/Surface/Surface.d.ts +32 -0
- package/esm/core/Surface/Surface.js +64 -0
- package/esm/core/Surface/index.d.ts +4 -0
- package/esm/core/Surface/index.js +6 -0
- package/esm/core/Table/Table.d.ts +6 -0
- package/esm/core/Table/Table.js +34 -12
- package/esm/core/Table/TablePaginator.js +6 -6
- package/esm/core/Table/TableRowMemoized.js +1 -1
- package/esm/core/Table/cells/EditableCell.js +2 -1
- package/esm/core/Table/columns/actionColumn.js +2 -2
- package/esm/core/Table/hooks/useSelectionCell.d.ts +1 -1
- package/esm/core/Table/hooks/useSelectionCell.js +3 -2
- package/esm/core/Table/utils.js +5 -5
- package/esm/core/Tabs/Tabs.d.ts +1 -1
- package/esm/core/Tabs/Tabs.js +7 -8
- package/esm/core/Tag/Tag.js +6 -3
- package/esm/core/Tag/TagContainer.js +1 -1
- package/esm/core/Tile/Tile.d.ts +6 -2
- package/esm/core/Tile/Tile.js +8 -3
- package/esm/core/Toast/Toast.js +2 -2
- package/esm/core/Toast/ToastWrapper.js +1 -1
- package/esm/core/Tree/TreeNode.js +2 -2
- package/esm/core/Typography/Text/Text.js +1 -1
- package/esm/core/UserIcon/UserIcon.js +2 -2
- package/esm/core/UserIconGroup/UserIconGroup.js +3 -3
- package/esm/core/Wizard/Step.js +1 -1
- package/esm/core/Wizard/Wizard.js +1 -1
- package/esm/core/index.d.ts +4 -0
- package/esm/core/index.js +2 -0
- package/esm/core/utils/color/ColorValue.js +11 -11
- package/esm/core/utils/components/FocusTrap.js +6 -8
- package/esm/core/utils/components/InputContainer.js +1 -1
- package/esm/core/utils/components/MiddleTextTruncation.js +1 -1
- package/esm/core/utils/components/VirtualScroll.js +1 -1
- package/esm/core/utils/components/WithCSSTransition.js +5 -5
- package/esm/core/utils/functions/focusable.js +1 -1
- package/esm/core/utils/hooks/useOverflow.js +3 -3
- package/esm/core/utils/hooks/useTheme.js +1 -1
- package/package.json +22 -21
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CommonProps } from '../utils';
|
|
3
|
+
import '@itwin/itwinui-css/css/surface.css';
|
|
4
|
+
export declare type SurfaceProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Sets the elevation of the surface
|
|
7
|
+
* @default 0
|
|
8
|
+
*/
|
|
9
|
+
elevation?: 0 | 1 | 2 | 3 | 4 | 5;
|
|
10
|
+
/**
|
|
11
|
+
* Content in the surface.
|
|
12
|
+
*/
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
} & Omit<CommonProps, 'title'>;
|
|
15
|
+
/**
|
|
16
|
+
* The Surface container allows content to appear elevated through the use of a drop shadow
|
|
17
|
+
* @example
|
|
18
|
+
* <Surface>Surface Content</Surface>
|
|
19
|
+
* <Surface elevation={2}>Surface Content</Surface>
|
|
20
|
+
*/
|
|
21
|
+
export declare const Surface: React.ForwardRefExoticComponent<{
|
|
22
|
+
/**
|
|
23
|
+
* Sets the elevation of the surface
|
|
24
|
+
* @default 0
|
|
25
|
+
*/
|
|
26
|
+
elevation?: 0 | 1 | 2 | 3 | 4 | 5 | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Content in the surface.
|
|
29
|
+
*/
|
|
30
|
+
children: React.ReactNode;
|
|
31
|
+
} & Omit<CommonProps, "title"> & React.RefAttributes<HTMLDivElement>>;
|
|
32
|
+
export default Surface;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.Surface = void 0;
|
|
29
|
+
/*---------------------------------------------------------------------------------------------
|
|
30
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
31
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
32
|
+
*--------------------------------------------------------------------------------------------*/
|
|
33
|
+
var react_1 = __importDefault(require("react"));
|
|
34
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
35
|
+
var utils_1 = require("../utils");
|
|
36
|
+
require("@itwin/itwinui-css/css/surface.css");
|
|
37
|
+
/**
|
|
38
|
+
* Helper function that returns one of the preset surface elevation values.
|
|
39
|
+
*/
|
|
40
|
+
var getSurfaceElevationValue = function (elevation) {
|
|
41
|
+
switch (elevation) {
|
|
42
|
+
case 1:
|
|
43
|
+
return '0 1px 5px rgba(0, 0, 0, 0.25)';
|
|
44
|
+
case 2:
|
|
45
|
+
return '0 1px 10px rgba(0, 0, 0, 0.25)';
|
|
46
|
+
case 3:
|
|
47
|
+
return '0 3px 14px rgba(0, 0, 0, 0.25)';
|
|
48
|
+
case 4:
|
|
49
|
+
return '0 6px 30px rgba(0, 0, 0, 0.25)';
|
|
50
|
+
case 5:
|
|
51
|
+
return '0 9px 46px rgba(0, 0, 0, 0.25)';
|
|
52
|
+
default:
|
|
53
|
+
return 'none';
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* The Surface container allows content to appear elevated through the use of a drop shadow
|
|
58
|
+
* @example
|
|
59
|
+
* <Surface>Surface Content</Surface>
|
|
60
|
+
* <Surface elevation={2}>Surface Content</Surface>
|
|
61
|
+
*/
|
|
62
|
+
exports.Surface = react_1.default.forwardRef(function (props, ref) {
|
|
63
|
+
var _a, _b, _c;
|
|
64
|
+
var _d = props.elevation, elevation = _d === void 0 ? 0 : _d, className = props.className, style = props.style, children = props.children, rest = __rest(props, ["elevation", "className", "style", "children"]);
|
|
65
|
+
(0, utils_1.useTheme)();
|
|
66
|
+
var _style = ((_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-surface-elevation: ".concat(getSurfaceElevationValue(elevation))))
|
|
67
|
+
? __assign({ '--iui-surface-elevation': getSurfaceElevationValue(elevation) }, style) : __assign({ boxShadow: getSurfaceElevationValue(elevation) }, style);
|
|
68
|
+
return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-surface', className), style: _style, ref: ref }, rest), children));
|
|
69
|
+
});
|
|
70
|
+
exports.default = exports.Surface;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Surface = void 0;
|
|
4
|
+
/*---------------------------------------------------------------------------------------------
|
|
5
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
|
+
*--------------------------------------------------------------------------------------------*/
|
|
8
|
+
var Surface_1 = require("./Surface");
|
|
9
|
+
Object.defineProperty(exports, "Surface", { enumerable: true, get: function () { return Surface_1.Surface; } });
|
|
10
|
+
exports.default = './Surface';
|
|
@@ -64,6 +64,12 @@ export declare type TableProps<T extends Record<string, unknown> = Record<string
|
|
|
64
64
|
* Handler for when a row is clicked. Must be memoized.
|
|
65
65
|
*/
|
|
66
66
|
onRowClick?: (event: React.MouseEvent, row: Row<T>) => void;
|
|
67
|
+
/**
|
|
68
|
+
* Modify the selection mode of the table.
|
|
69
|
+
* The column with checkboxes will not be present with 'single' selection mode.
|
|
70
|
+
* @default 'multi'
|
|
71
|
+
*/
|
|
72
|
+
selectionMode?: 'multi' | 'single';
|
|
67
73
|
/**
|
|
68
74
|
* Flag whether table columns can be sortable.
|
|
69
75
|
* @default false
|
package/cjs/core/Table/Table.js
CHANGED
|
@@ -49,6 +49,16 @@ var columns_1 = require("./columns");
|
|
|
49
49
|
var singleRowSelectedAction = 'singleRowSelected';
|
|
50
50
|
exports.tableResizeStartAction = 'tableResizeStart';
|
|
51
51
|
var tableResizeEndAction = 'tableResizeEnd';
|
|
52
|
+
var flattenColumns = function (columns) {
|
|
53
|
+
var flatColumns = [];
|
|
54
|
+
columns.forEach(function (column) {
|
|
55
|
+
flatColumns.push(column);
|
|
56
|
+
if (column.columns) {
|
|
57
|
+
flatColumns.push.apply(flatColumns, flattenColumns(column.columns));
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
return flatColumns;
|
|
61
|
+
};
|
|
52
62
|
/**
|
|
53
63
|
* Table based on [react-table](https://react-table.tanstack.com/docs/api/overview).
|
|
54
64
|
* @example
|
|
@@ -93,8 +103,7 @@ var tableResizeEndAction = 'tableResizeEnd';
|
|
|
93
103
|
*/
|
|
94
104
|
var Table = function (props) {
|
|
95
105
|
var _a;
|
|
96
|
-
var _b;
|
|
97
|
-
var data = props.data, columns = props.columns, _c = props.isLoading, isLoading = _c === void 0 ? false : _c, emptyTableContent = props.emptyTableContent, className = props.className, style = props.style, id = props.id, _d = props.isSelectable, isSelectable = _d === void 0 ? false : _d, onSelect = props.onSelect, onRowClick = props.onRowClick, _e = props.isSortable, isSortable = _e === void 0 ? false : _e, onSort = props.onSort, stateReducer = props.stateReducer, onBottomReached = props.onBottomReached, onRowInViewport = props.onRowInViewport, _f = props.intersectionMargin, intersectionMargin = _f === void 0 ? 300 : _f, subComponent = props.subComponent, onExpand = props.onExpand, onFilter = props.onFilter, emptyFilteredTableContent = props.emptyFilteredTableContent, filterFunctions = props.filterTypes, expanderCell = props.expanderCell, isRowDisabled = props.isRowDisabled, rowProps = props.rowProps, _g = props.density, density = _g === void 0 ? 'default' : _g, _h = props.selectSubRows, selectSubRows = _h === void 0 ? true : _h, getSubRows = props.getSubRows, _j = props.selectRowOnClick, selectRowOnClick = _j === void 0 ? true : _j, paginatorRenderer = props.paginatorRenderer, _k = props.pageSize, pageSize = _k === void 0 ? 25 : _k, _l = props.isResizable, isResizable = _l === void 0 ? false : _l, _m = props.styleType, styleType = _m === void 0 ? 'default' : _m, _o = props.enableVirtualization, enableVirtualization = _o === void 0 ? false : _o, _p = props.enableColumnReordering, enableColumnReordering = _p === void 0 ? false : _p, 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", "enableColumnReordering"]);
|
|
106
|
+
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.selectionMode, selectionMode = _d === void 0 ? 'multi' : _d, _e = props.isSortable, isSortable = _e === void 0 ? false : _e, onSort = props.onSort, stateReducer = props.stateReducer, onBottomReached = props.onBottomReached, onRowInViewport = props.onRowInViewport, _f = props.intersectionMargin, intersectionMargin = _f === void 0 ? 300 : _f, subComponent = props.subComponent, onExpand = props.onExpand, onFilter = props.onFilter, emptyFilteredTableContent = props.emptyFilteredTableContent, filterFunctions = props.filterTypes, expanderCell = props.expanderCell, isRowDisabled = props.isRowDisabled, rowProps = props.rowProps, _g = props.density, density = _g === void 0 ? 'default' : _g, _h = props.selectSubRows, selectSubRows = _h === void 0 ? true : _h, getSubRows = props.getSubRows, _j = props.selectRowOnClick, selectRowOnClick = _j === void 0 ? true : _j, paginatorRenderer = props.paginatorRenderer, _k = props.pageSize, pageSize = _k === void 0 ? 25 : _k, _l = props.isResizable, isResizable = _l === void 0 ? false : _l, _m = props.styleType, styleType = _m === void 0 ? 'default' : _m, _o = props.enableVirtualization, enableVirtualization = _o === void 0 ? false : _o, _p = props.enableColumnReordering, enableColumnReordering = _p === void 0 ? false : _p, rest = __rest(props, ["data", "columns", "isLoading", "emptyTableContent", "className", "style", "id", "isSelectable", "onSelect", "onRowClick", "selectionMode", "isSortable", "onSort", "stateReducer", "onBottomReached", "onRowInViewport", "intersectionMargin", "subComponent", "onExpand", "onFilter", "emptyFilteredTableContent", "filterTypes", "expanderCell", "isRowDisabled", "rowProps", "density", "selectSubRows", "getSubRows", "selectRowOnClick", "paginatorRenderer", "pageSize", "isResizable", "styleType", "enableVirtualization", "enableColumnReordering"]);
|
|
98
107
|
(0, utils_1.useTheme)();
|
|
99
108
|
var _q = react_1.default.useState(), ownerDocument = _q[0], setOwnerDocument = _q[1];
|
|
100
109
|
var defaultColumn = react_1.default.useMemo(function () { return ({
|
|
@@ -109,7 +118,10 @@ var Table = function (props) {
|
|
|
109
118
|
onBottomReachedRef.current = onBottomReached;
|
|
110
119
|
onRowInViewportRef.current = onRowInViewport;
|
|
111
120
|
}, [onBottomReached, onRowInViewport]);
|
|
112
|
-
var hasManualSelectionColumn =
|
|
121
|
+
var hasManualSelectionColumn = react_1.default.useMemo(function () {
|
|
122
|
+
var flatColumns = flattenColumns(columns);
|
|
123
|
+
return flatColumns.some(function (column) { return column.id === columns_1.SELECTION_CELL_ID; });
|
|
124
|
+
}, [columns]);
|
|
113
125
|
var tableStateReducer = react_1.default.useCallback(function (newState, action, previousState, instance) {
|
|
114
126
|
switch (action.type) {
|
|
115
127
|
case react_table_1.actions.toggleSortBy:
|
|
@@ -165,7 +177,7 @@ var Table = function (props) {
|
|
|
165
177
|
return getSubRows ? getSubRows(item, index) : item.subRows;
|
|
166
178
|
});
|
|
167
179
|
}, [data, getSubRows]);
|
|
168
|
-
var instance = (0, react_table_1.useTable)(__assign(__assign({ manualPagination: !paginatorRenderer, paginateExpandedRows: false }, props), { columns: columns, defaultColumn: defaultColumn, disableSortBy: !isSortable, stateReducer: tableStateReducer, filterTypes: filterTypes, selectSubRows: selectSubRows, data: data, getSubRows: getSubRows, initialState: __assign({ pageSize: pageSize }, props.initialState) }), react_table_1.useFlexLayout, (0, hooks_1.useResizeColumns)(ownerDocument), react_table_1.useFilters, (0, hooks_1.useSubRowFiltering)(hasAnySubRows), react_table_1.useSortBy, react_table_1.useExpanded, react_table_1.usePagination, react_table_1.useRowSelect, hooks_1.useSubRowSelection, (0, hooks_1.useExpanderCell)(subComponent, expanderCell, isRowDisabled), (0, hooks_1.useSelectionCell)(isSelectable, isRowDisabled), react_table_1.useColumnOrder, (0, hooks_1.useColumnDragAndDrop)(enableColumnReordering));
|
|
180
|
+
var instance = (0, react_table_1.useTable)(__assign(__assign({ manualPagination: !paginatorRenderer, paginateExpandedRows: false }, props), { columns: columns, defaultColumn: defaultColumn, disableSortBy: !isSortable, stateReducer: tableStateReducer, filterTypes: filterTypes, selectSubRows: selectSubRows, data: data, getSubRows: getSubRows, initialState: __assign({ pageSize: pageSize }, props.initialState) }), react_table_1.useFlexLayout, (0, hooks_1.useResizeColumns)(ownerDocument), react_table_1.useFilters, (0, hooks_1.useSubRowFiltering)(hasAnySubRows), react_table_1.useSortBy, react_table_1.useExpanded, react_table_1.usePagination, react_table_1.useRowSelect, hooks_1.useSubRowSelection, (0, hooks_1.useExpanderCell)(subComponent, expanderCell, isRowDisabled), (0, hooks_1.useSelectionCell)(isSelectable, selectionMode, isRowDisabled), react_table_1.useColumnOrder, (0, hooks_1.useColumnDragAndDrop)(enableColumnReordering));
|
|
169
181
|
var getTableProps = instance.getTableProps, rows = instance.rows, headerGroups = instance.headerGroups, getTableBodyProps = instance.getTableBodyProps, prepareRow = instance.prepareRow, state = instance.state, allColumns = instance.allColumns, filteredFlatRows = instance.filteredFlatRows, dispatch = instance.dispatch, page = instance.page, gotoPage = instance.gotoPage, setPageSize = instance.setPageSize, flatHeaders = instance.flatHeaders;
|
|
170
182
|
var ariaDataAttributes = Object.entries(rest).reduce(function (result, _a) {
|
|
171
183
|
var key = _a[0], value = _a[1];
|
|
@@ -177,8 +189,14 @@ var Table = function (props) {
|
|
|
177
189
|
var areFiltersSet = allColumns.some(function (column) { return !!column.filterValue; });
|
|
178
190
|
var onRowClickHandler = react_1.default.useCallback(function (event, row) {
|
|
179
191
|
var isDisabled = isRowDisabled === null || isRowDisabled === void 0 ? void 0 : isRowDisabled(row.original);
|
|
180
|
-
if (
|
|
181
|
-
|
|
192
|
+
if (!isDisabled) {
|
|
193
|
+
onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(event, row);
|
|
194
|
+
}
|
|
195
|
+
if (isSelectable &&
|
|
196
|
+
!isDisabled &&
|
|
197
|
+
selectRowOnClick &&
|
|
198
|
+
!event.isDefaultPrevented()) {
|
|
199
|
+
if (!row.isSelected && (selectionMode === 'single' || !event.ctrlKey)) {
|
|
182
200
|
dispatch({
|
|
183
201
|
type: singleRowSelectedAction,
|
|
184
202
|
id: row.id,
|
|
@@ -188,10 +206,14 @@ var Table = function (props) {
|
|
|
188
206
|
row.toggleRowSelected(!row.isSelected);
|
|
189
207
|
}
|
|
190
208
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
209
|
+
}, [
|
|
210
|
+
isRowDisabled,
|
|
211
|
+
isSelectable,
|
|
212
|
+
selectRowOnClick,
|
|
213
|
+
selectionMode,
|
|
214
|
+
dispatch,
|
|
215
|
+
onRowClick,
|
|
216
|
+
]);
|
|
195
217
|
react_1.default.useEffect(function () {
|
|
196
218
|
setPageSize(pageSize);
|
|
197
219
|
}, [pageSize, setPageSize]);
|
|
@@ -272,7 +294,7 @@ var Table = function (props) {
|
|
|
272
294
|
resizeRef(element);
|
|
273
295
|
}
|
|
274
296
|
}, id: id }, getTableProps({
|
|
275
|
-
className: (0, classnames_1.default)('iui-table', (_a = {}, _a["iui-"
|
|
297
|
+
className: (0, classnames_1.default)('iui-table', (_a = {}, _a["iui-".concat(density)] = density !== 'default', _a), className),
|
|
276
298
|
style: style,
|
|
277
299
|
}), ariaDataAttributes),
|
|
278
300
|
react_1.default.createElement("div", { className: 'iui-table-header', ref: headerRef }, headerGroups.slice(1).map(function (headerGroup) {
|
|
@@ -289,7 +311,7 @@ var Table = function (props) {
|
|
|
289
311
|
} }),
|
|
290
312
|
column.render('Header'),
|
|
291
313
|
(data.length !== 0 || areFiltersSet) && (react_1.default.createElement(filters_1.FilterToggle, { column: column, ownerDocument: ownerDocument })),
|
|
292
|
-
data.length !== 0 && column.canSort && (react_1.default.createElement("div", { className: 'iui-cell-end-icon' }, column.isSorted && column.isSortedDesc ? (react_1.default.createElement(
|
|
314
|
+
data.length !== 0 && column.canSort && (react_1.default.createElement("div", { className: 'iui-cell-end-icon' }, column.isSorted && column.isSortedDesc ? (react_1.default.createElement(SortDown_1.default, { className: 'iui-icon iui-sort', "aria-hidden": true })) : (react_1.default.createElement(SortUp_1.default, { className: 'iui-icon iui-sort', "aria-hidden": true })))),
|
|
293
315
|
isResizable &&
|
|
294
316
|
column.isResizerVisible &&
|
|
295
317
|
index !== headerGroup.headers.length - 1 && (react_1.default.createElement("div", __assign({}, column.getResizerProps(), { className: 'iui-resizer' }),
|
|
@@ -40,15 +40,15 @@ var ProgressIndicators_1 = require("../ProgressIndicators");
|
|
|
40
40
|
var Menu_1 = require("../Menu");
|
|
41
41
|
var utils_1 = require("../utils");
|
|
42
42
|
var defaultLocalization = {
|
|
43
|
-
pageSizeLabel: function (size) { return size
|
|
43
|
+
pageSizeLabel: function (size) { return "".concat(size, " per page"); },
|
|
44
44
|
rangeLabel: function (startIndex, endIndex, totalRows, isLoading) {
|
|
45
45
|
return isLoading
|
|
46
|
-
? startIndex
|
|
47
|
-
: startIndex
|
|
46
|
+
? "".concat(startIndex, "-").concat(endIndex, "\u2026")
|
|
47
|
+
: "".concat(startIndex, "-").concat(endIndex, " of ").concat(totalRows);
|
|
48
48
|
},
|
|
49
49
|
previousPage: 'Previous page',
|
|
50
50
|
nextPage: 'Next page',
|
|
51
|
-
goToPageLabel: function (page) { return "Go to page "
|
|
51
|
+
goToPageLabel: function (page) { return "Go to page ".concat(page); },
|
|
52
52
|
rowsPerPageLabel: 'Rows per page',
|
|
53
53
|
};
|
|
54
54
|
/**
|
|
@@ -72,12 +72,12 @@ var TablePaginator = function (props) {
|
|
|
72
72
|
var needFocus = react_1.default.useRef(false);
|
|
73
73
|
var isMounted = react_1.default.useRef(false);
|
|
74
74
|
react_1.default.useEffect(function () {
|
|
75
|
-
var _a, _b
|
|
75
|
+
var _a, _b;
|
|
76
76
|
// Checking `isMounted.current` prevents from focusing on initial load.
|
|
77
77
|
// Checking `needFocus.current` prevents from focusing page when clicked on previous/next page.
|
|
78
78
|
if (isMounted.current && needFocus.current) {
|
|
79
79
|
var buttonToFocus = Array.from((_b = (_a = pageListRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.iui-paginator-page-button')) !== null && _b !== void 0 ? _b : []).find(function (el) { var _a; return ((_a = el.textContent) === null || _a === void 0 ? void 0 : _a.trim()) === (focusedIndex + 1).toString(); });
|
|
80
|
-
|
|
80
|
+
buttonToFocus === null || buttonToFocus === void 0 ? void 0 : buttonToFocus.focus();
|
|
81
81
|
needFocus.current = false;
|
|
82
82
|
}
|
|
83
83
|
isMounted.current = true;
|
|
@@ -37,7 +37,7 @@ var TableRow = function (props) {
|
|
|
37
37
|
isLast && ((_b = onBottomReached.current) === null || _b === void 0 ? void 0 : _b.call(onBottomReached));
|
|
38
38
|
}, [isLast, onBottomReached, onRowInViewport, row.original]);
|
|
39
39
|
var rowRef = (0, utils_1.useIntersection)(onIntersect, {
|
|
40
|
-
rootMargin: intersectionMargin
|
|
40
|
+
rootMargin: "".concat(intersectionMargin, "px"),
|
|
41
41
|
});
|
|
42
42
|
var userRowProps = rowProps === null || rowProps === void 0 ? void 0 : rowProps(row);
|
|
43
43
|
var mergedProps = __assign(__assign(__assign({}, row.getRowProps({ style: { flex: "0 0 auto", minWidth: '100%' } })), userRowProps), {
|
|
@@ -42,7 +42,8 @@ var react_1 = __importDefault(require("react"));
|
|
|
42
42
|
* }
|
|
43
43
|
*/
|
|
44
44
|
var EditableCell = function (props) {
|
|
45
|
-
var cellElementProps = props.cellElementProps, cellProps = props.cellProps, onCellEdit = props.onCellEdit, children = props.children, rest = __rest(props, ["cellElementProps", "cellProps", "onCellEdit", "children"]);
|
|
45
|
+
var cellElementProps = props.cellElementProps, cellProps = props.cellProps, onCellEdit = props.onCellEdit, children = props.children, isDisabled = props.isDisabled, rest = __rest(props, ["cellElementProps", "cellProps", "onCellEdit", "children", "isDisabled"]);
|
|
46
|
+
isDisabled; // To omit and prevent eslint error.
|
|
46
47
|
var sanitizeString = function (text) {
|
|
47
48
|
return text.replace(/(\r\n|\n|\r)+/gm, ' ');
|
|
48
49
|
};
|
|
@@ -78,8 +78,8 @@ var ActionColumn = function (_a) {
|
|
|
78
78
|
// Triggers an update to resize the widths of all visible columns
|
|
79
79
|
dispatch({ type: Table_1.tableResizeStartAction });
|
|
80
80
|
};
|
|
81
|
-
return (react_1.default.createElement(Menu_1.MenuItem, { key: column.id, icon: react_1.default.createElement(Checkbox_1.Checkbox, { checked: checked, disabled: column.disableToggleVisibility, onClick: function (e) { return e.stopPropagation(); }, onChange: onClick, "aria-labelledby": "iui-column-"
|
|
82
|
-
react_1.default.createElement("div", { id: "iui-column-"
|
|
81
|
+
return (react_1.default.createElement(Menu_1.MenuItem, { key: column.id, icon: react_1.default.createElement(Checkbox_1.Checkbox, { checked: checked, disabled: column.disableToggleVisibility, onClick: function (e) { return e.stopPropagation(); }, onChange: onClick, "aria-labelledby": "iui-column-".concat(column.id) }), onClick: onClick, disabled: column.disableToggleVisibility },
|
|
82
|
+
react_1.default.createElement("div", { id: "iui-column-".concat(column.id) }, column.render('Header'))));
|
|
83
83
|
});
|
|
84
84
|
};
|
|
85
85
|
return (react_1.default.createElement(DropdownMenu_1.DropdownMenu, { menuItems: headerCheckBoxes, onHide: function () { return setIsOpen(false); }, onShow: function () { return setIsOpen(true); } },
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Hooks } from 'react-table';
|
|
2
|
-
export declare const useSelectionCell: <T extends Record<string, unknown>>(isSelectable: boolean, isRowDisabled?: ((rowData: T) => boolean) | undefined) => (hooks: Hooks<T>) => void;
|
|
2
|
+
export declare const useSelectionCell: <T extends Record<string, unknown>>(isSelectable: boolean, selectionMode: 'multi' | 'single', isRowDisabled?: ((rowData: T) => boolean) | undefined) => (hooks: Hooks<T>) => void;
|
|
@@ -11,12 +11,13 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.useSelectionCell = void 0;
|
|
13
13
|
var columns_1 = require("../columns");
|
|
14
|
-
var useSelectionCell = function (isSelectable, isRowDisabled) { return function (hooks) {
|
|
14
|
+
var useSelectionCell = function (isSelectable, selectionMode, isRowDisabled) { return function (hooks) {
|
|
15
15
|
if (!isSelectable) {
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
18
|
hooks.allColumns.push(function (columns) {
|
|
19
|
-
return
|
|
19
|
+
return selectionMode === 'single' ||
|
|
20
|
+
columns.find(function (c) { return c.id === columns_1.SELECTION_CELL_ID; })
|
|
20
21
|
? columns
|
|
21
22
|
: __spreadArray([(0, columns_1.SelectionColumn)({ isDisabled: isRowDisabled })], columns, true);
|
|
22
23
|
});
|
package/cjs/core/Table/utils.js
CHANGED
|
@@ -5,21 +5,21 @@ var getCellStyle = function (column, isTableResizing) {
|
|
|
5
5
|
var style = {};
|
|
6
6
|
style.flex = "1 1 145px";
|
|
7
7
|
if (column.width) {
|
|
8
|
-
var width = typeof column.width === 'string' ? column.width : column.width
|
|
8
|
+
var width = typeof column.width === 'string' ? column.width : "".concat(column.width, "px");
|
|
9
9
|
style.width = width;
|
|
10
10
|
// This allows flexbox to handle the width of the column on table resize
|
|
11
11
|
if (isTableResizing && column.canResize) {
|
|
12
|
-
style.flex = Number(column.width)
|
|
12
|
+
style.flex = "".concat(Number(column.width), " ").concat(Number(column.width), " ").concat(width);
|
|
13
13
|
}
|
|
14
14
|
else {
|
|
15
|
-
style.flex = "0 0 "
|
|
15
|
+
style.flex = "0 0 ".concat(width);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
if (column.maxWidth) {
|
|
19
|
-
style.maxWidth = column.maxWidth
|
|
19
|
+
style.maxWidth = "".concat(column.maxWidth, "px");
|
|
20
20
|
}
|
|
21
21
|
if (column.minWidth) {
|
|
22
|
-
style.minWidth = column.minWidth
|
|
22
|
+
style.minWidth = "".concat(column.minWidth, "px");
|
|
23
23
|
}
|
|
24
24
|
return style;
|
|
25
25
|
};
|
package/cjs/core/Tabs/Tabs.d.ts
CHANGED
package/cjs/core/Tabs/Tabs.js
CHANGED
|
@@ -83,20 +83,19 @@ var Tabs = function (props) {
|
|
|
83
83
|
var activeTab = tablistRef.current.children[currentActiveIndex];
|
|
84
84
|
var activeTabRect = activeTab.getBoundingClientRect();
|
|
85
85
|
setStripeProperties(__assign(__assign({}, (orientation === 'horizontal' && {
|
|
86
|
-
'--stripe-width': activeTabRect.width
|
|
87
|
-
'--stripe-left': activeTab.offsetLeft
|
|
86
|
+
'--stripe-width': "".concat(activeTabRect.width, "px"),
|
|
87
|
+
'--stripe-left': "".concat(activeTab.offsetLeft, "px"),
|
|
88
88
|
})), (orientation === 'vertical' && {
|
|
89
|
-
'--stripe-height': activeTabRect.height
|
|
90
|
-
'--stripe-top': activeTab.offsetTop
|
|
89
|
+
'--stripe-height': "".concat(activeTabRect.height, "px"),
|
|
90
|
+
'--stripe-top': "".concat(activeTab.offsetTop, "px"),
|
|
91
91
|
})));
|
|
92
92
|
}
|
|
93
93
|
}, [currentActiveIndex, type, orientation, tabsWidth]);
|
|
94
94
|
var _l = react_1.default.useState(), focusedIndex = _l[0], setFocusedIndex = _l[1];
|
|
95
95
|
react_1.default.useEffect(function () {
|
|
96
|
-
var _a;
|
|
97
96
|
if (tablistRef.current && focusedIndex !== undefined) {
|
|
98
97
|
var tab = tablistRef.current.querySelectorAll('.iui-tab')[focusedIndex];
|
|
99
|
-
|
|
98
|
+
tab === null || tab === void 0 ? void 0 : tab.focus();
|
|
100
99
|
}
|
|
101
100
|
}, [focusedIndex]);
|
|
102
101
|
var _m = react_1.default.useState(false), hasSublabel = _m[0], setHasSublabel = _m[1]; // used for setting size
|
|
@@ -173,8 +172,8 @@ var Tabs = function (props) {
|
|
|
173
172
|
}
|
|
174
173
|
};
|
|
175
174
|
var isIE = !((_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, '--stripe-width', '100px'));
|
|
176
|
-
return (react_1.default.createElement("div", { className: (0, classnames_1.default)('iui-tabs-wrapper', "iui-"
|
|
177
|
-
react_1.default.createElement("ul", __assign({ className: (0, classnames_1.default)('iui-tabs', "iui-"
|
|
175
|
+
return (react_1.default.createElement("div", { className: (0, classnames_1.default)('iui-tabs-wrapper', "iui-".concat(orientation), wrapperClassName), style: stripeProperties },
|
|
176
|
+
react_1.default.createElement("ul", __assign({ className: (0, classnames_1.default)('iui-tabs', "iui-".concat(type), {
|
|
178
177
|
'iui-green': color === 'green',
|
|
179
178
|
'iui-animated': type !== 'default' && !isIE,
|
|
180
179
|
'iui-not-animated': isIE,
|
package/cjs/core/Tag/Tag.js
CHANGED
|
@@ -45,9 +45,12 @@ var Buttons_1 = require("../Buttons");
|
|
|
45
45
|
var Tag = function (props) {
|
|
46
46
|
var className = props.className, _a = props.variant, variant = _a === void 0 ? 'default' : _a, children = props.children, onRemove = props.onRemove, rest = __rest(props, ["className", "variant", "children", "onRemove"]);
|
|
47
47
|
(0, utils_1.useTheme)();
|
|
48
|
-
return (react_1.default.createElement("span", __assign({ className: (0, classnames_1.default)(
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
return (react_1.default.createElement("span", __assign({ className: (0, classnames_1.default)({
|
|
49
|
+
'iui-tag-basic': variant === 'basic',
|
|
50
|
+
'iui-tag': variant === 'default',
|
|
51
|
+
}, className) }, rest),
|
|
52
|
+
variant === 'default' ? (react_1.default.createElement("span", { className: 'iui-tag-label' }, children)) : (children),
|
|
53
|
+
onRemove && (react_1.default.createElement(Buttons_1.IconButton, { styleType: 'borderless', size: 'small', onClick: onRemove, "aria-label": 'Delete tag', className: 'iui-tag-button' },
|
|
51
54
|
react_1.default.createElement(CloseSmall_1.default, { "aria-hidden": true })))));
|
|
52
55
|
};
|
|
53
56
|
exports.Tag = Tag;
|
|
@@ -45,7 +45,7 @@ var TagContainer = function (props) {
|
|
|
45
45
|
var className = props.className, children = props.children, overflow = props.overflow, _b = props.background, background = _b === void 0 ? 'none' : _b, rest = __rest(props, ["className", "children", "overflow", "background"]);
|
|
46
46
|
(0, utils_1.useTheme)();
|
|
47
47
|
return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-tag-container', (_a = {},
|
|
48
|
-
_a["iui-"
|
|
48
|
+
_a["iui-".concat(overflow)] = !!overflow,
|
|
49
49
|
_a['iui-visible'] = background !== 'none',
|
|
50
50
|
_a), className) }, rest), children));
|
|
51
51
|
};
|
package/cjs/core/Tile/Tile.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { CommonProps } from '../utils';
|
|
3
2
|
import '@itwin/itwinui-css/css/tile.css';
|
|
4
3
|
export declare type TileProps = {
|
|
5
4
|
/**
|
|
@@ -80,7 +79,12 @@ export declare type TileProps = {
|
|
|
80
79
|
* Any custom nodes that will be appended to the tile's main content.
|
|
81
80
|
*/
|
|
82
81
|
children?: React.ReactNode;
|
|
83
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Whether the tile is expected to be interactable (i.e. `onClick`).
|
|
84
|
+
* It becomes focusable and gets on hover styling.
|
|
85
|
+
*/
|
|
86
|
+
isActionable?: boolean;
|
|
87
|
+
} & React.ComponentPropsWithoutRef<'div'>;
|
|
84
88
|
/**
|
|
85
89
|
* Tile component that displays content and actions in a card-like format.
|
|
86
90
|
* @example
|
package/cjs/core/Tile/Tile.js
CHANGED
|
@@ -57,14 +57,19 @@ var Buttons_1 = require("../Buttons");
|
|
|
57
57
|
* />
|
|
58
58
|
*/
|
|
59
59
|
var Tile = function (props) {
|
|
60
|
-
var className = props.className, name = props.name, description = props.description, metadata = props.metadata, thumbnail = props.thumbnail, buttons = props.buttons, leftIcon = props.leftIcon, rightIcon = props.rightIcon, badge = props.badge, isNew = props.isNew, isSelected = props.isSelected, moreOptions = props.moreOptions, _a = props.variant, variant = _a === void 0 ? 'default' : _a, children = props.children, rest = __rest(props, ["className", "name", "description", "metadata", "thumbnail", "buttons", "leftIcon", "rightIcon", "badge", "isNew", "isSelected", "moreOptions", "variant", "children"]);
|
|
60
|
+
var className = props.className, name = props.name, description = props.description, metadata = props.metadata, thumbnail = props.thumbnail, buttons = props.buttons, leftIcon = props.leftIcon, rightIcon = props.rightIcon, badge = props.badge, isNew = props.isNew, isSelected = props.isSelected, moreOptions = props.moreOptions, _a = props.variant, variant = _a === void 0 ? 'default' : _a, children = props.children, isActionable = props.isActionable, rest = __rest(props, ["className", "name", "description", "metadata", "thumbnail", "buttons", "leftIcon", "rightIcon", "badge", "isNew", "isSelected", "moreOptions", "variant", "children", "isActionable"]);
|
|
61
61
|
(0, utils_1.useTheme)();
|
|
62
62
|
var _b = react_1.default.useState(false), isMenuVisible = _b[0], setIsMenuVisible = _b[1];
|
|
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
|
-
return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-tile', {
|
|
65
|
+
return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-tile', {
|
|
66
|
+
'iui-folder': variant === 'folder',
|
|
67
|
+
'iui-new': isNew,
|
|
68
|
+
'iui-selected': isSelected,
|
|
69
|
+
'iui-actionable': isActionable,
|
|
70
|
+
}, className), tabIndex: isActionable ? 0 : undefined }, rest),
|
|
66
71
|
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("
|
|
72
|
+
typeof thumbnail === 'string' ? (react_1.default.createElement("div", { className: 'iui-tile-thumbnail-picture', style: { backgroundImage: "url(".concat(thumbnail, ")") } })) : thumbnail && thumbnail.type === 'img' ? (react_1.default.cloneElement(thumbnail, {
|
|
68
73
|
className: 'iui-tile-thumbnail-picture',
|
|
69
74
|
})) : react_1.default.isValidElement(thumbnail) ? (react_1.default.cloneElement(thumbnail, {
|
|
70
75
|
className: (0, classnames_1.default)('iui-thumbnail-icon', thumbnail.props.className),
|
package/cjs/core/Toast/Toast.js
CHANGED
|
@@ -123,7 +123,7 @@ var Toast = function (props) {
|
|
|
123
123
|
}, onExiting: function (node) {
|
|
124
124
|
var _a = calculateOutAnimation(node), translateX = _a.translateX, translateY = _a.translateY;
|
|
125
125
|
node.style.transform = animateOutTo
|
|
126
|
-
? "scale(0.9) translate("
|
|
126
|
+
? "scale(0.9) translate(".concat(translateX, "px,").concat(translateY, "px)")
|
|
127
127
|
: "scale(0.9)";
|
|
128
128
|
node.style.opacity = '0';
|
|
129
129
|
node.style.transitionDuration = animateOutTo ? '400ms' : '120ms';
|
|
@@ -140,7 +140,7 @@ exports.Toast = Toast;
|
|
|
140
140
|
var ToastPresentation = function (props) {
|
|
141
141
|
var content = props.content, category = props.category, _a = props.type, type = _a === void 0 ? 'temporary' : _a, link = props.link, hasCloseButton = props.hasCloseButton, onClose = props.onClose, className = props.className, rest = __rest(props, ["content", "category", "type", "link", "hasCloseButton", "onClose", "className"]);
|
|
142
142
|
var StatusIcon = utils_1.StatusIconMap[category];
|
|
143
|
-
return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)("iui-toast iui-"
|
|
143
|
+
return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)("iui-toast iui-".concat(category), className) }, rest),
|
|
144
144
|
react_1.default.createElement("div", { className: 'iui-status-area' }, react_1.default.createElement(StatusIcon, { className: 'iui-icon' })),
|
|
145
145
|
react_1.default.createElement("div", { className: 'iui-message' }, content),
|
|
146
146
|
link && (react_1.default.createElement("a", { className: 'iui-toast-anchor', onClick: link.onClick }, link.title)),
|
|
@@ -26,7 +26,7 @@ var Toast_1 = __importDefault(require("./Toast"));
|
|
|
26
26
|
var ToastWrapper = function (props) {
|
|
27
27
|
var toasts = props.toasts, _a = props.placement, placement = _a === void 0 ? 'top' : _a;
|
|
28
28
|
var placementPosition = placement.startsWith('top') ? 'top' : 'bottom';
|
|
29
|
-
return (react_1.default.createElement("span", { className: (0, classnames_1.default)("iui-toast-wrapper", "iui-placement-"
|
|
29
|
+
return (react_1.default.createElement("span", { className: (0, classnames_1.default)("iui-toast-wrapper", "iui-placement-".concat(placement)) }, toasts.map(function (toastProps) {
|
|
30
30
|
return (react_1.default.createElement(Toast_1.default, __assign({ key: toastProps.id, placementPosition: placementPosition }, toastProps)));
|
|
31
31
|
})));
|
|
32
32
|
};
|
|
@@ -63,7 +63,7 @@ var TreeNode = function (props) {
|
|
|
63
63
|
var nodeRef = react_1.default.useRef(null);
|
|
64
64
|
var styleDepth = react_1.default.useMemo(function () {
|
|
65
65
|
var _a, _b, _c;
|
|
66
|
-
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, "--level: "
|
|
66
|
+
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, "--level: ".concat(nodeDepth)))
|
|
67
67
|
? { '--level': nodeDepth }
|
|
68
68
|
: { marginLeft: nodeDepth ? nodeDepth * 28 : 0 };
|
|
69
69
|
}, [nodeDepth]);
|
|
@@ -79,7 +79,7 @@ var TreeNode = function (props) {
|
|
|
79
79
|
break;
|
|
80
80
|
}
|
|
81
81
|
if (parentNodeId) {
|
|
82
|
-
var parentNode = (_b = nodeRef.current) === null || _b === void 0 ? void 0 : _b.ownerDocument.querySelector("#"
|
|
82
|
+
var parentNode = (_b = nodeRef.current) === null || _b === void 0 ? void 0 : _b.ownerDocument.querySelector("#".concat(parentNodeId));
|
|
83
83
|
parentNode === null || parentNode === void 0 ? void 0 : parentNode.focus();
|
|
84
84
|
break;
|
|
85
85
|
}
|
|
@@ -49,7 +49,7 @@ exports.Text = react_1.default.forwardRef(function (props, ref) {
|
|
|
49
49
|
var _b = props.variant, variant = _b === void 0 ? 'body' : _b, _c = props.as, Element = _c === void 0 ? 'div' : _c, className = props.className, _d = props.isMuted, isMuted = _d === void 0 ? false : _d, _e = props.isSkeleton, isSkeleton = _e === void 0 ? false : _e, rest = __rest(props, ["variant", "as", "className", "isMuted", "isSkeleton"]);
|
|
50
50
|
(0, utils_1.useTheme)();
|
|
51
51
|
return (react_1.default.createElement(Element, __assign({ className: (0, classnames_1.default)((_a = {},
|
|
52
|
-
_a["iui-text-"
|
|
52
|
+
_a["iui-text-".concat(variant)] = variant !== 'body',
|
|
53
53
|
_a['iui-text-block'] = variant === 'body',
|
|
54
54
|
_a['iui-text-muted'] = isMuted,
|
|
55
55
|
_a['iui-skeleton'] = isSkeleton,
|
|
@@ -60,10 +60,10 @@ var UserIcon = function (props) {
|
|
|
60
60
|
var _c = props.size, size = _c === void 0 ? 'small' : _c, status = props.status, abbreviation = props.abbreviation, image = props.image, _d = props.backgroundColor, backgroundColor = _d === void 0 ? 'white' : _d, title = props.title, translatedStatusTitles = props.translatedStatusTitles, className = props.className, style = props.style, rest = __rest(props, ["size", "status", "abbreviation", "image", "backgroundColor", "title", "translatedStatusTitles", "className", "style"]);
|
|
61
61
|
(0, utils_1.useTheme)();
|
|
62
62
|
var statusTitles = __assign(__assign({}, exports.defaultStatusTitles), translatedStatusTitles);
|
|
63
|
-
return (react_1.default.createElement("span", __assign({ className: (0, classnames_1.default)('iui-user-icon', (_a = {}, _a["iui-"
|
|
63
|
+
return (react_1.default.createElement("span", __assign({ className: (0, classnames_1.default)('iui-user-icon', (_a = {}, _a["iui-".concat(size)] = size !== 'medium', _a), className), title: title, style: style }, rest), image !== null && image !== void 0 ? image : (react_1.default.createElement("abbr", { className: 'iui-initials', style: { backgroundColor: backgroundColor } }, abbreviation === null || abbreviation === void 0 ? void 0 : abbreviation.substring(0, 2))),
|
|
64
64
|
react_1.default.createElement("span", { className: 'iui-stroke' }),
|
|
65
65
|
status && (react_1.default.createElement("span", { title: statusTitles[status], className: (0, classnames_1.default)('iui-status', (_b = {},
|
|
66
|
-
_b["iui-"
|
|
66
|
+
_b["iui-".concat(status)] = !!status,
|
|
67
67
|
_b)), "aria-label": statusTitles[status] }))));
|
|
68
68
|
};
|
|
69
69
|
exports.UserIcon = UserIcon;
|
|
@@ -84,10 +84,10 @@ var UserIconGroup = function (props) {
|
|
|
84
84
|
childrenArray.length <= maxIcons + 1 && getUserIconList(maxIcons + 1),
|
|
85
85
|
childrenArray.length > maxIcons + 1 && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
86
86
|
getUserIconList(maxIcons),
|
|
87
|
-
react_1.default.createElement("div", __assign({}, countIconProps, { className: (0, classnames_1.default)('iui-user-icon', (_a = {}, _a["iui-"
|
|
87
|
+
react_1.default.createElement("div", __assign({}, countIconProps, { className: (0, classnames_1.default)('iui-user-icon', (_a = {}, _a["iui-".concat(iconSize)] = iconSize !== 'medium', _a), 'iui-user-icon-count', countIconProps === null || countIconProps === void 0 ? void 0 : countIconProps.className) }),
|
|
88
88
|
react_1.default.createElement("abbr", { className: 'iui-initials' }, childrenLength <= maxLength
|
|
89
|
-
? ""
|
|
90
|
-
: maxLength
|
|
89
|
+
? "".concat(childrenLength - maxIcons)
|
|
90
|
+
: "".concat(maxLength, "+")),
|
|
91
91
|
react_1.default.createElement("span", { className: 'iui-stroke' })))))));
|
|
92
92
|
};
|
|
93
93
|
exports.UserIconGroup = UserIconGroup;
|
package/cjs/core/Wizard/Step.js
CHANGED
|
@@ -54,7 +54,7 @@ var Step = function (props) {
|
|
|
54
54
|
var stepShape = (react_1.default.createElement("li", __assign({ className: (0, classnames_1.default)('iui-wizard-step', {
|
|
55
55
|
'iui-current': isActive,
|
|
56
56
|
'iui-clickable': isClickable,
|
|
57
|
-
}, className), style: __assign({ width: type === 'default' ? 100 / totalSteps
|
|
57
|
+
}, className), style: __assign({ width: type === 'default' ? "".concat(100 / totalSteps, "%") : undefined }, style), onClick: onCompletedClick, onKeyDown: onKeyDown, "aria-current": isActive ? 'step' : undefined, tabIndex: isClickable ? 0 : undefined }, rest),
|
|
58
58
|
react_1.default.createElement("div", { className: 'iui-wizard-track-content' },
|
|
59
59
|
react_1.default.createElement("span", { className: 'iui-wizard-circle' }, type === 'workflow' ? title : index + 1)),
|
|
60
60
|
type === 'default' && (react_1.default.createElement("span", { className: 'iui-wizard-step-name' }, title))));
|
|
@@ -37,7 +37,7 @@ require("@itwin/itwinui-css/css/wizard.css");
|
|
|
37
37
|
var Step_1 = require("./Step");
|
|
38
38
|
var defaultWizardLocalization = {
|
|
39
39
|
stepsCountLabel: function (currentStep, totalSteps) {
|
|
40
|
-
return "Step "
|
|
40
|
+
return "Step ".concat(currentStep, " of ").concat(totalSteps, ":");
|
|
41
41
|
},
|
|
42
42
|
};
|
|
43
43
|
/**
|