@itwin/itwinui-react 1.41.0 → 1.43.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/cjs/core/Backdrop/Backdrop.d.ts +10 -0
- package/cjs/core/Backdrop/Backdrop.js +41 -0
- package/cjs/core/Backdrop/index.d.ts +2 -0
- package/cjs/core/Backdrop/index.js +9 -0
- package/cjs/core/Breadcrumbs/Breadcrumbs.js +18 -18
- package/cjs/core/ButtonGroup/ButtonGroup.js +11 -4
- package/cjs/core/ComboBox/ComboBox.js +15 -14
- package/cjs/core/Dialog/Dialog.d.ts +41 -0
- package/cjs/core/Dialog/Dialog.js +59 -0
- package/cjs/core/Dialog/DialogBackdrop.d.ts +12 -0
- package/cjs/core/Dialog/DialogBackdrop.js +61 -0
- package/cjs/core/Dialog/DialogButtonBar.d.ts +18 -0
- package/cjs/core/Dialog/DialogButtonBar.js +50 -0
- package/cjs/core/Dialog/DialogContent.d.ts +17 -0
- package/cjs/core/Dialog/DialogContent.js +49 -0
- package/cjs/core/Dialog/DialogContext.d.ts +39 -0
- package/cjs/core/Dialog/DialogContext.js +16 -0
- package/cjs/core/Dialog/DialogMain.d.ts +36 -0
- package/cjs/core/Dialog/DialogMain.js +120 -0
- package/cjs/core/Dialog/DialogTitleBar.d.ts +34 -0
- package/cjs/core/Dialog/DialogTitleBar.js +69 -0
- package/cjs/core/Dialog/DialogTitleBarTitle.d.ts +15 -0
- package/cjs/core/Dialog/DialogTitleBarTitle.js +47 -0
- package/cjs/core/Dialog/index.d.ts +8 -0
- package/cjs/core/Dialog/index.js +10 -0
- package/cjs/core/Footer/Footer.d.ts +16 -2
- package/cjs/core/Footer/Footer.js +57 -45
- package/cjs/core/Footer/FooterItem.d.ts +8 -0
- package/cjs/core/Footer/FooterItem.js +46 -0
- package/cjs/core/Footer/FooterList.d.ts +8 -0
- package/cjs/core/Footer/FooterList.js +46 -0
- package/cjs/core/Footer/FooterSeparator.d.ts +8 -0
- package/cjs/core/Footer/FooterSeparator.js +46 -0
- package/cjs/core/Footer/index.d.ts +1 -1
- package/cjs/core/Footer/index.js +2 -1
- package/cjs/core/Modal/Modal.d.ts +4 -14
- package/cjs/core/Modal/Modal.js +9 -74
- package/cjs/core/Modal/ModalButtonBar.d.ts +1 -2
- package/cjs/core/Modal/ModalButtonBar.js +2 -39
- package/cjs/core/Modal/ModalContent.d.ts +1 -2
- package/cjs/core/Modal/ModalContent.js +2 -39
- package/cjs/core/Slider/Slider.d.ts +10 -0
- package/cjs/core/Slider/Slider.js +20 -14
- package/cjs/core/Slider/Thumb.d.ts +2 -1
- package/cjs/core/Slider/Thumb.js +5 -3
- package/cjs/core/Slider/Track.d.ts +2 -1
- package/cjs/core/Slider/Track.js +23 -4
- package/cjs/core/Table/Table.d.ts +24 -0
- package/cjs/core/Table/Table.js +12 -4
- package/cjs/core/Table/TableRowMemoized.d.ts +2 -0
- package/cjs/core/Table/TableRowMemoized.js +2 -2
- package/cjs/core/Table/columns/actionColumn.d.ts +8 -3
- package/cjs/core/Table/columns/actionColumn.js +33 -2
- package/cjs/core/Table/hooks/index.d.ts +1 -0
- package/cjs/core/Table/hooks/index.js +3 -1
- package/cjs/core/Table/hooks/useScrollToRow.d.ts +11 -0
- package/cjs/core/Table/hooks/useScrollToRow.js +49 -0
- package/cjs/core/Tree/Tree.d.ts +9 -0
- package/cjs/core/Tree/Tree.js +67 -19
- package/cjs/core/Tree/TreeContext.d.ts +4 -0
- package/cjs/core/Tree/TreeNode.js +8 -9
- package/cjs/core/Typography/Small/Small.js +1 -1
- package/cjs/core/index.d.ts +3 -1
- package/cjs/core/index.js +6 -3
- package/cjs/core/utils/components/FocusTrap.js +1 -1
- package/cjs/core/utils/components/MiddleTextTruncation.js +1 -1
- package/cjs/core/utils/hooks/index.d.ts +1 -0
- package/cjs/core/utils/hooks/index.js +1 -0
- package/cjs/core/utils/hooks/useLatestRef.d.ts +9 -0
- package/cjs/core/utils/hooks/useLatestRef.js +26 -0
- package/esm/core/Backdrop/Backdrop.d.ts +10 -0
- package/esm/core/Backdrop/Backdrop.js +35 -0
- package/esm/core/Backdrop/index.d.ts +2 -0
- package/esm/core/Backdrop/index.js +5 -0
- package/esm/core/Breadcrumbs/Breadcrumbs.js +18 -18
- package/esm/core/ButtonGroup/ButtonGroup.js +11 -4
- package/esm/core/ComboBox/ComboBox.js +16 -15
- package/esm/core/Dialog/Dialog.d.ts +41 -0
- package/esm/core/Dialog/Dialog.js +53 -0
- package/esm/core/Dialog/DialogBackdrop.d.ts +12 -0
- package/esm/core/Dialog/DialogBackdrop.js +55 -0
- package/esm/core/Dialog/DialogButtonBar.d.ts +18 -0
- package/esm/core/Dialog/DialogButtonBar.js +44 -0
- package/esm/core/Dialog/DialogContent.d.ts +17 -0
- package/esm/core/Dialog/DialogContent.js +43 -0
- package/esm/core/Dialog/DialogContext.d.ts +39 -0
- package/esm/core/Dialog/DialogContext.js +9 -0
- package/esm/core/Dialog/DialogMain.d.ts +36 -0
- package/esm/core/Dialog/DialogMain.js +114 -0
- package/esm/core/Dialog/DialogTitleBar.d.ts +34 -0
- package/esm/core/Dialog/DialogTitleBar.js +63 -0
- package/esm/core/Dialog/DialogTitleBarTitle.d.ts +15 -0
- package/esm/core/Dialog/DialogTitleBarTitle.js +41 -0
- package/esm/core/Dialog/index.d.ts +8 -0
- package/esm/core/Dialog/index.js +6 -0
- package/esm/core/Footer/Footer.d.ts +16 -2
- package/esm/core/Footer/Footer.js +56 -43
- package/esm/core/Footer/FooterItem.d.ts +8 -0
- package/esm/core/Footer/FooterItem.js +39 -0
- package/esm/core/Footer/FooterList.d.ts +8 -0
- package/esm/core/Footer/FooterList.js +39 -0
- package/esm/core/Footer/FooterSeparator.d.ts +8 -0
- package/esm/core/Footer/FooterSeparator.js +39 -0
- package/esm/core/Footer/index.d.ts +1 -1
- package/esm/core/Footer/index.js +1 -1
- package/esm/core/Modal/Modal.d.ts +4 -14
- package/esm/core/Modal/Modal.js +10 -75
- package/esm/core/Modal/ModalButtonBar.d.ts +1 -2
- package/esm/core/Modal/ModalButtonBar.js +2 -35
- package/esm/core/Modal/ModalContent.d.ts +1 -2
- package/esm/core/Modal/ModalContent.js +2 -35
- package/esm/core/Slider/Slider.d.ts +10 -0
- package/esm/core/Slider/Slider.js +20 -14
- package/esm/core/Slider/Thumb.d.ts +2 -1
- package/esm/core/Slider/Thumb.js +5 -3
- package/esm/core/Slider/Track.d.ts +2 -1
- package/esm/core/Slider/Track.js +23 -4
- package/esm/core/Table/Table.d.ts +24 -0
- package/esm/core/Table/Table.js +13 -5
- package/esm/core/Table/TableRowMemoized.d.ts +2 -0
- package/esm/core/Table/TableRowMemoized.js +2 -2
- package/esm/core/Table/columns/actionColumn.d.ts +8 -3
- package/esm/core/Table/columns/actionColumn.js +33 -2
- package/esm/core/Table/hooks/index.d.ts +1 -0
- package/esm/core/Table/hooks/index.js +1 -0
- package/esm/core/Table/hooks/useScrollToRow.d.ts +11 -0
- package/esm/core/Table/hooks/useScrollToRow.js +42 -0
- package/esm/core/Tree/Tree.d.ts +9 -0
- package/esm/core/Tree/Tree.js +68 -20
- package/esm/core/Tree/TreeContext.d.ts +4 -0
- package/esm/core/Tree/TreeNode.js +8 -9
- package/esm/core/Typography/Small/Small.js +1 -1
- package/esm/core/index.d.ts +3 -1
- package/esm/core/index.js +2 -1
- package/esm/core/utils/components/FocusTrap.js +1 -1
- package/esm/core/utils/components/MiddleTextTruncation.js +1 -1
- package/esm/core/utils/hooks/index.d.ts +1 -0
- package/esm/core/utils/hooks/index.js +1 -0
- package/esm/core/utils/hooks/useLatestRef.d.ts +9 -0
- package/esm/core/utils/hooks/useLatestRef.js +19 -0
- package/package.json +6 -5
package/cjs/core/Table/Table.js
CHANGED
|
@@ -240,6 +240,7 @@ var Table = function (props) {
|
|
|
240
240
|
state.pageIndex,
|
|
241
241
|
state.pageSize,
|
|
242
242
|
]);
|
|
243
|
+
var _r = (0, hooks_1.useScrollToRow)(__assign(__assign({}, props), { page: page })), scrollToIndex = _r.scrollToIndex, tableRowRef = _r.tableRowRef;
|
|
243
244
|
var columnRefs = react_1.default.useRef({});
|
|
244
245
|
var previousTableWidth = react_1.default.useRef(0);
|
|
245
246
|
var onTableResize = react_1.default.useCallback(function (_a) {
|
|
@@ -276,11 +277,11 @@ var Table = function (props) {
|
|
|
276
277
|
var headerRef = react_1.default.useRef(null);
|
|
277
278
|
var bodyRef = react_1.default.useRef(null);
|
|
278
279
|
// Using `useState` to rerender rows when table body ref is available
|
|
279
|
-
var
|
|
280
|
+
var _s = react_1.default.useState(null), bodyRefState = _s[0], setBodyRefState = _s[1];
|
|
280
281
|
var getPreparedRow = react_1.default.useCallback(function (index) {
|
|
281
282
|
var row = page[index];
|
|
282
283
|
prepareRow(row);
|
|
283
|
-
return (react_1.default.createElement(TableRowMemoized_1.TableRowMemoized, { row: row, rowProps: rowProps, isLast: index === page.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, bodyRef: bodyRefState }));
|
|
284
|
+
return (react_1.default.createElement(TableRowMemoized_1.TableRowMemoized, { row: row, rowProps: rowProps, isLast: index === page.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, bodyRef: bodyRefState, tableRowRef: enableVirtualization ? undefined : tableRowRef(row) }));
|
|
284
285
|
}, [
|
|
285
286
|
page,
|
|
286
287
|
prepareRow,
|
|
@@ -294,6 +295,8 @@ var Table = function (props) {
|
|
|
294
295
|
instance,
|
|
295
296
|
expanderCell,
|
|
296
297
|
bodyRefState,
|
|
298
|
+
enableVirtualization,
|
|
299
|
+
tableRowRef,
|
|
297
300
|
]);
|
|
298
301
|
var virtualizedItemRenderer = react_1.default.useCallback(function (index) { return getPreparedRow(index); }, [getPreparedRow]);
|
|
299
302
|
var updateStickyState = function () {
|
|
@@ -330,7 +333,12 @@ var Table = function (props) {
|
|
|
330
333
|
className: (0, classnames_1.default)('iui-table', (_a = {}, _a["iui-".concat(density)] = density !== 'default', _a), className),
|
|
331
334
|
style: __assign({ minWidth: 0 }, style),
|
|
332
335
|
}), ariaDataAttributes),
|
|
333
|
-
react_1.default.createElement("div", { className: 'iui-table-header-wrapper', ref: headerRef
|
|
336
|
+
react_1.default.createElement("div", { className: 'iui-table-header-wrapper', ref: headerRef, onScroll: function () {
|
|
337
|
+
if (headerRef.current && bodyRef.current) {
|
|
338
|
+
bodyRef.current.scrollLeft = headerRef.current.scrollLeft;
|
|
339
|
+
updateStickyState();
|
|
340
|
+
}
|
|
341
|
+
} },
|
|
334
342
|
react_1.default.createElement("div", { className: 'iui-table-header' }, headerGroups.slice(1).map(function (headerGroup) {
|
|
335
343
|
var headerGroupProps = headerGroup.getHeaderGroupProps({
|
|
336
344
|
className: 'iui-row',
|
|
@@ -375,7 +383,7 @@ var Table = function (props) {
|
|
|
375
383
|
updateStickyState();
|
|
376
384
|
}
|
|
377
385
|
}, tabIndex: -1 }),
|
|
378
|
-
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 (_, index) { return getPreparedRow(index); })))),
|
|
386
|
+
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, scrollToIndex: scrollToIndex })) : (page.map(function (_, index) { return getPreparedRow(index); })))),
|
|
379
387
|
isLoading && data.length === 0 && (react_1.default.createElement("div", { className: 'iui-table-empty' },
|
|
380
388
|
react_1.default.createElement(ProgressIndicators_1.ProgressRadial, { indeterminate: true }))),
|
|
381
389
|
isLoading && data.length !== 0 && (react_1.default.createElement("div", { className: 'iui-row' },
|
|
@@ -21,6 +21,7 @@ export declare const TableRow: <T extends Record<string, unknown>>(props: {
|
|
|
21
21
|
tableInstance: TableInstance<T>;
|
|
22
22
|
expanderCell?: ((cellProps: CellProps<T, any>) => React.ReactNode) | undefined;
|
|
23
23
|
bodyRef: HTMLDivElement | null;
|
|
24
|
+
tableRowRef?: React.Ref<HTMLDivElement> | undefined;
|
|
24
25
|
}) => JSX.Element;
|
|
25
26
|
export declare const TableRowMemoized: <T extends Record<string, unknown>>(props: {
|
|
26
27
|
row: Row<T>;
|
|
@@ -37,4 +38,5 @@ export declare const TableRowMemoized: <T extends Record<string, unknown>>(props
|
|
|
37
38
|
tableInstance: TableInstance<T>;
|
|
38
39
|
expanderCell?: ((cellProps: CellProps<T, any>) => React.ReactNode) | undefined;
|
|
39
40
|
bodyRef: HTMLDivElement | null;
|
|
41
|
+
tableRowRef?: React.Ref<HTMLDivElement> | undefined;
|
|
40
42
|
}) => JSX.Element;
|
|
@@ -30,7 +30,7 @@ var TableCell_1 = require("./TableCell");
|
|
|
30
30
|
* When adding new features check whether it changes state that affects row. If it does then add equality check to `React.memo`.
|
|
31
31
|
*/
|
|
32
32
|
var TableRow = function (props) {
|
|
33
|
-
var row = props.row, rowProps = props.rowProps, isLast = props.isLast, onRowInViewport = props.onRowInViewport, onBottomReached = props.onBottomReached, intersectionMargin = props.intersectionMargin, onClick = props.onClick, subComponent = props.subComponent, isDisabled = props.isDisabled, tableHasSubRows = props.tableHasSubRows, tableInstance = props.tableInstance, expanderCell = props.expanderCell, bodyRef = props.bodyRef;
|
|
33
|
+
var row = props.row, rowProps = props.rowProps, isLast = props.isLast, onRowInViewport = props.onRowInViewport, onBottomReached = props.onBottomReached, intersectionMargin = props.intersectionMargin, onClick = props.onClick, subComponent = props.subComponent, isDisabled = props.isDisabled, tableHasSubRows = props.tableHasSubRows, tableInstance = props.tableInstance, expanderCell = props.expanderCell, bodyRef = props.bodyRef, tableRowRef = props.tableRowRef;
|
|
34
34
|
var onIntersect = react_1.default.useCallback(function () {
|
|
35
35
|
var _a, _b;
|
|
36
36
|
(_a = onRowInViewport.current) === null || _a === void 0 ? void 0 : _a.call(onRowInViewport, row.original);
|
|
@@ -58,7 +58,7 @@ var TableRow = function (props) {
|
|
|
58
58
|
'iui-disabled': isDisabled,
|
|
59
59
|
}, userRowProps === null || userRowProps === void 0 ? void 0 : userRowProps.className),
|
|
60
60
|
});
|
|
61
|
-
var refs = (0, utils_1.useMergedRefs)(intersectionRef, mergedProps.ref);
|
|
61
|
+
var refs = (0, utils_1.useMergedRefs)(intersectionRef, mergedProps.ref, tableRowRef);
|
|
62
62
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
63
63
|
react_1.default.createElement("div", __assign({}, mergedProps, { ref: refs, onClick: function (event) {
|
|
64
64
|
var _a;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { HeaderProps } from 'react-table';
|
|
3
|
+
import { DropdownMenuProps } from '../../DropdownMenu';
|
|
4
|
+
declare type ActionColumnProps = {
|
|
5
|
+
columnManager?: boolean | {
|
|
6
|
+
dropdownMenuProps: Omit<DropdownMenuProps, 'menuItems' | 'children'>;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
3
9
|
/**
|
|
4
10
|
* Action column that adds column manager to the Table header.
|
|
5
11
|
* It is recommended to add this column to the end of the Table
|
|
@@ -19,9 +25,7 @@ import { HeaderProps } from 'react-table';
|
|
|
19
25
|
* ),
|
|
20
26
|
* },
|
|
21
27
|
*/
|
|
22
|
-
export declare const ActionColumn: <T extends Record<string, unknown>>({ columnManager, }?: {
|
|
23
|
-
columnManager?: boolean | undefined;
|
|
24
|
-
}) => {
|
|
28
|
+
export declare const ActionColumn: <T extends Record<string, unknown>>({ columnManager, }?: ActionColumnProps) => {
|
|
25
29
|
id: string;
|
|
26
30
|
disableResizing: boolean;
|
|
27
31
|
disableGroupBy: boolean;
|
|
@@ -33,3 +37,4 @@ export declare const ActionColumn: <T extends Record<string, unknown>>({ columnM
|
|
|
33
37
|
disableReordering: boolean;
|
|
34
38
|
Header: ({ allColumns, dispatch, state }: HeaderProps<T>) => JSX.Element | null;
|
|
35
39
|
};
|
|
40
|
+
export {};
|
|
@@ -1,4 +1,15 @@
|
|
|
1
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
|
+
};
|
|
2
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
15
|
};
|
|
@@ -17,6 +28,7 @@ var Menu_1 = require("../../Menu");
|
|
|
17
28
|
var Table_1 = require("../Table");
|
|
18
29
|
var selectionColumn_1 = require("./selectionColumn");
|
|
19
30
|
var expanderColumn_1 = require("./expanderColumn");
|
|
31
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
20
32
|
var ACTION_CELL_ID = 'iui-table-action';
|
|
21
33
|
/**
|
|
22
34
|
* Action column that adds column manager to the Table header.
|
|
@@ -52,6 +64,7 @@ var ActionColumn = function (_a) {
|
|
|
52
64
|
Header: function (_a) {
|
|
53
65
|
var allColumns = _a.allColumns, dispatch = _a.dispatch, state = _a.state;
|
|
54
66
|
var _b = react_1.default.useState(false), isOpen = _b[0], setIsOpen = _b[1];
|
|
67
|
+
var buttonRef = react_1.default.useRef(null);
|
|
55
68
|
if (!columnManager) {
|
|
56
69
|
return null;
|
|
57
70
|
}
|
|
@@ -77,13 +90,31 @@ var ActionColumn = function (_a) {
|
|
|
77
90
|
}
|
|
78
91
|
// Triggers an update to resize the widths of all visible columns
|
|
79
92
|
dispatch({ type: Table_1.tableResizeStartAction });
|
|
93
|
+
// If some columns were resized and some columns visibility was enabled, then horizontal scrollbar appears
|
|
94
|
+
// and table is scrolled to the very left which means our visibility dropdown menu is not visible.
|
|
95
|
+
// So for better UX we need to scroll to that dropdown menu.
|
|
96
|
+
queueMicrotask(function () {
|
|
97
|
+
var _a;
|
|
98
|
+
(_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView();
|
|
99
|
+
});
|
|
80
100
|
};
|
|
81
101
|
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
102
|
react_1.default.createElement("div", { id: "iui-column-".concat(column.id) }, column.render('Header'))));
|
|
83
103
|
});
|
|
84
104
|
};
|
|
85
|
-
|
|
86
|
-
|
|
105
|
+
var dropdownMenuProps = typeof columnManager !== 'boolean'
|
|
106
|
+
? columnManager.dropdownMenuProps
|
|
107
|
+
: {};
|
|
108
|
+
return (react_1.default.createElement(DropdownMenu_1.DropdownMenu, __assign({}, dropdownMenuProps, { menuItems: headerCheckBoxes, onHide: function (i) {
|
|
109
|
+
var _a;
|
|
110
|
+
setIsOpen(false);
|
|
111
|
+
(_a = dropdownMenuProps.onHide) === null || _a === void 0 ? void 0 : _a.call(dropdownMenuProps, i);
|
|
112
|
+
}, onShow: function (i) {
|
|
113
|
+
var _a;
|
|
114
|
+
setIsOpen(true);
|
|
115
|
+
(_a = dropdownMenuProps.onShow) === null || _a === void 0 ? void 0 : _a.call(dropdownMenuProps, i);
|
|
116
|
+
}, style: __assign({ maxHeight: '315px' }, dropdownMenuProps.style), className: (0, classnames_1.default)('iui-scroll', dropdownMenuProps.className) }),
|
|
117
|
+
react_1.default.createElement(IconButton_1.IconButton, { styleType: 'borderless', isActive: isOpen, ref: buttonRef },
|
|
87
118
|
react_1.default.createElement(ColumnManager_1.default, null))));
|
|
88
119
|
},
|
|
89
120
|
};
|
|
@@ -4,4 +4,5 @@ export { useSubRowFiltering } from './useSubRowFiltering';
|
|
|
4
4
|
export { useSubRowSelection } from './useSubRowSelection';
|
|
5
5
|
export { useResizeColumns } from './useResizeColumns';
|
|
6
6
|
export { useColumnDragAndDrop } from './useColumnDragAndDrop';
|
|
7
|
+
export { useScrollToRow } from './useScrollToRow';
|
|
7
8
|
export { useStickyColumns } from './useStickyColumns';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useStickyColumns = exports.useColumnDragAndDrop = exports.useResizeColumns = exports.useSubRowSelection = exports.useSubRowFiltering = exports.useSelectionCell = exports.useExpanderCell = void 0;
|
|
3
|
+
exports.useStickyColumns = exports.useScrollToRow = exports.useColumnDragAndDrop = exports.useResizeColumns = exports.useSubRowSelection = exports.useSubRowFiltering = exports.useSelectionCell = exports.useExpanderCell = void 0;
|
|
4
4
|
/*---------------------------------------------------------------------------------------------
|
|
5
5
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
6
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -17,5 +17,7 @@ var useResizeColumns_1 = require("./useResizeColumns");
|
|
|
17
17
|
Object.defineProperty(exports, "useResizeColumns", { enumerable: true, get: function () { return useResizeColumns_1.useResizeColumns; } });
|
|
18
18
|
var useColumnDragAndDrop_1 = require("./useColumnDragAndDrop");
|
|
19
19
|
Object.defineProperty(exports, "useColumnDragAndDrop", { enumerable: true, get: function () { return useColumnDragAndDrop_1.useColumnDragAndDrop; } });
|
|
20
|
+
var useScrollToRow_1 = require("./useScrollToRow");
|
|
21
|
+
Object.defineProperty(exports, "useScrollToRow", { enumerable: true, get: function () { return useScrollToRow_1.useScrollToRow; } });
|
|
20
22
|
var useStickyColumns_1 = require("./useStickyColumns");
|
|
21
23
|
Object.defineProperty(exports, "useStickyColumns", { enumerable: true, get: function () { return useStickyColumns_1.useStickyColumns; } });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Row } from 'react-table';
|
|
2
|
+
import { TableProps } from '../Table';
|
|
3
|
+
declare type ScrollToRow<T extends Record<string, unknown>> = {
|
|
4
|
+
scrollToIndex: number | undefined;
|
|
5
|
+
tableRowRef: (row: Row<T>) => (element: HTMLDivElement) => void;
|
|
6
|
+
};
|
|
7
|
+
declare type ScrollToRowProps<T extends Record<string, unknown>> = TableProps<T> & {
|
|
8
|
+
page: Row<T>[];
|
|
9
|
+
};
|
|
10
|
+
export declare function useScrollToRow<T extends Record<string, unknown>>({ data, enableVirtualization, page, paginatorRenderer, scrollToRow, }: ScrollToRowProps<T>): ScrollToRow<T>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useScrollToRow = void 0;
|
|
7
|
+
/*---------------------------------------------------------------------------------------------
|
|
8
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
9
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
10
|
+
*--------------------------------------------------------------------------------------------*/
|
|
11
|
+
var react_1 = __importDefault(require("react"));
|
|
12
|
+
function useScrollToRow(_a) {
|
|
13
|
+
var data = _a.data, enableVirtualization = _a.enableVirtualization, page = _a.page, paginatorRenderer = _a.paginatorRenderer, scrollToRow = _a.scrollToRow;
|
|
14
|
+
var rowRefs = react_1.default.useRef({});
|
|
15
|
+
// Refs prevents from having `page` and `data` as dependencies
|
|
16
|
+
// therefore we avoid unnecessary scroll to row.
|
|
17
|
+
var pageRef = react_1.default.useRef(page);
|
|
18
|
+
pageRef.current = page;
|
|
19
|
+
var dataRef = react_1.default.useRef(data);
|
|
20
|
+
dataRef.current = data;
|
|
21
|
+
// For virtualized tables, all we need to do is pass the index of the item
|
|
22
|
+
// to the VirtualScroll component
|
|
23
|
+
var scrollToIndex = react_1.default.useMemo(function () {
|
|
24
|
+
if (!scrollToRow || paginatorRenderer) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
var index = scrollToRow(pageRef.current, dataRef.current);
|
|
28
|
+
return index < 0 ? undefined : index;
|
|
29
|
+
}, [paginatorRenderer, scrollToRow]);
|
|
30
|
+
// For non-virtualized tables, we need to add a ref to each row
|
|
31
|
+
// and scroll to the element
|
|
32
|
+
react_1.default.useEffect(function () {
|
|
33
|
+
var _a;
|
|
34
|
+
if (enableVirtualization ||
|
|
35
|
+
scrollToIndex === undefined ||
|
|
36
|
+
scrollToIndex === null ||
|
|
37
|
+
scrollToIndex < 0) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
(_a = rowRefs.current[pageRef.current[scrollToIndex].id]) === null || _a === void 0 ? void 0 : _a.scrollIntoView();
|
|
41
|
+
}, [enableVirtualization, scrollToIndex]);
|
|
42
|
+
var tableRowRef = react_1.default.useCallback(function (row) {
|
|
43
|
+
return function (element) {
|
|
44
|
+
rowRefs.current[row.id] = element;
|
|
45
|
+
};
|
|
46
|
+
}, []);
|
|
47
|
+
return { scrollToIndex: scrollToIndex, tableRowRef: tableRowRef };
|
|
48
|
+
}
|
|
49
|
+
exports.useScrollToRow = useScrollToRow;
|
package/cjs/core/Tree/Tree.d.ts
CHANGED
|
@@ -68,6 +68,15 @@ export declare type TreeProps<T> = {
|
|
|
68
68
|
* }, [expandedNodes]);
|
|
69
69
|
*/
|
|
70
70
|
getNode: (node: T) => NodeData<T>;
|
|
71
|
+
/**
|
|
72
|
+
* Virtualization is used to have a better performance with a lot of nodes.
|
|
73
|
+
*
|
|
74
|
+
* When enabled, Tree DOM structure will change - it will have a wrapper div
|
|
75
|
+
* to which `className` and `style` will be applied.
|
|
76
|
+
* @default false
|
|
77
|
+
* @beta
|
|
78
|
+
*/
|
|
79
|
+
enableVirtualization?: boolean;
|
|
71
80
|
} & Omit<CommonProps, 'title'>;
|
|
72
81
|
/**
|
|
73
82
|
* Tree component used to display a hierarchical structure of `TreeNodes`.
|
package/cjs/core/Tree/Tree.js
CHANGED
|
@@ -86,7 +86,7 @@ var TreeContext_1 = require("./TreeContext");
|
|
|
86
86
|
/>
|
|
87
87
|
*/
|
|
88
88
|
var Tree = function (props) {
|
|
89
|
-
var data = props.data, className = props.className, nodeRenderer = props.nodeRenderer, getNode = props.getNode, rest = __rest(props, ["data", "className", "nodeRenderer", "getNode"]);
|
|
89
|
+
var data = props.data, className = props.className, nodeRenderer = props.nodeRenderer, getNode = props.getNode, _a = props.enableVirtualization, enableVirtualization = _a === void 0 ? false : _a, style = props.style, rest = __rest(props, ["data", "className", "nodeRenderer", "getNode", "enableVirtualization", "style"]);
|
|
90
90
|
(0, utils_1.useTheme)();
|
|
91
91
|
var treeRef = react_1.default.useRef(null);
|
|
92
92
|
var focusedIndex = react_1.default.useRef(0);
|
|
@@ -124,7 +124,7 @@ var Tree = function (props) {
|
|
|
124
124
|
break;
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
|
-
var
|
|
127
|
+
var _b = react_1.default.useMemo(function () {
|
|
128
128
|
var flatList = [];
|
|
129
129
|
var firstLevelNodes = [];
|
|
130
130
|
var flattenNodes = function (nodes, depth, parentNode) {
|
|
@@ -153,25 +153,73 @@ var Tree = function (props) {
|
|
|
153
153
|
};
|
|
154
154
|
flattenNodes(data);
|
|
155
155
|
return [flatList, firstLevelNodes];
|
|
156
|
-
}, [data, getNode]), flatNodesList =
|
|
157
|
-
|
|
158
|
-
var _a;
|
|
159
|
-
var items = getFocusableNodes();
|
|
160
|
-
if (items.length > 0) {
|
|
161
|
-
(_a = items[focusedIndex.current]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
162
|
-
}
|
|
163
|
-
} }, rest), flatNodesList.map(function (flatNode) {
|
|
156
|
+
}, [data, getNode]), flatNodesList = _b[0], firstLevelNodesList = _b[1];
|
|
157
|
+
var itemRenderer = react_1.default.useCallback(function (index) {
|
|
164
158
|
var _a, _b, _c, _d;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
159
|
+
var node = flatNodesList[index];
|
|
160
|
+
return (react_1.default.createElement(TreeContext_1.TreeContext.Provider, { key: node.nodeProps.nodeId, value: {
|
|
161
|
+
nodeDepth: node.depth,
|
|
162
|
+
subNodeIds: node.subNodeIds,
|
|
163
|
+
groupSize: node.depth === 0
|
|
169
164
|
? firstLevelNodesList.length
|
|
170
|
-
: (_c = (_b = (_a =
|
|
171
|
-
indexInGroup:
|
|
172
|
-
parentNodeId: (_d =
|
|
173
|
-
|
|
174
|
-
|
|
165
|
+
: (_c = (_b = (_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.subNodeIds) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0,
|
|
166
|
+
indexInGroup: node.indexInGroup,
|
|
167
|
+
parentNodeId: (_d = node.parentNode) === null || _d === void 0 ? void 0 : _d.nodeProps.nodeId,
|
|
168
|
+
scrollToParent: node.parentNode
|
|
169
|
+
? function () {
|
|
170
|
+
var _a;
|
|
171
|
+
var parentNodeId = (_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.nodeProps.nodeId;
|
|
172
|
+
var parentNodeIndex = flatNodesList.findIndex(function (n) { return n.nodeProps.nodeId === parentNodeId; });
|
|
173
|
+
setScrollToIndex(parentNodeIndex);
|
|
174
|
+
}
|
|
175
|
+
: undefined,
|
|
176
|
+
} }, nodeRenderer(node.nodeProps)));
|
|
177
|
+
}, [firstLevelNodesList.length, flatNodesList, nodeRenderer]);
|
|
178
|
+
var _c = react_1.default.useState(), scrollToIndex = _c[0], setScrollToIndex = _c[1];
|
|
179
|
+
var flatNodesListRef = react_1.default.useRef(flatNodesList);
|
|
180
|
+
react_1.default.useEffect(function () {
|
|
181
|
+
flatNodesListRef.current = flatNodesList;
|
|
182
|
+
}, [flatNodesList]);
|
|
183
|
+
react_1.default.useEffect(function () {
|
|
184
|
+
setTimeout(function () {
|
|
185
|
+
var _a;
|
|
186
|
+
if (scrollToIndex !== undefined) {
|
|
187
|
+
var nodeId = flatNodesListRef.current[scrollToIndex].nodeProps.nodeId;
|
|
188
|
+
var nodeElement = (_a = treeRef.current) === null || _a === void 0 ? void 0 : _a.ownerDocument.querySelector("#".concat(nodeId));
|
|
189
|
+
nodeElement === null || nodeElement === void 0 ? void 0 : nodeElement.focus();
|
|
190
|
+
// Need to reset that if navigating with mouse and keyboard,
|
|
191
|
+
// e.g. pressing arrow left to go to parent node and then with mouse
|
|
192
|
+
// clicking some other child node and then pressing arrow left
|
|
193
|
+
setScrollToIndex(undefined);
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}, [scrollToIndex]);
|
|
197
|
+
var handleFocus = function (event) {
|
|
198
|
+
var _a, _b;
|
|
199
|
+
if ((_a = treeRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.relatedTarget)) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
var items = getFocusableNodes();
|
|
203
|
+
if (items.length > 0) {
|
|
204
|
+
(_b = items[focusedIndex.current]) === null || _b === void 0 ? void 0 : _b.focus();
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, enableVirtualization ? (react_1.default.createElement(VirtualizedTree, __assign({ flatNodesList: flatNodesList, itemRenderer: itemRenderer, scrollToIndex: scrollToIndex, onFocus: handleFocus, onKeyDown: handleKeyDown, ref: treeRef, className: className, style: style }, rest))) : (react_1.default.createElement(TreeElement, __assign({ onKeyDown: handleKeyDown, onFocus: handleFocus, className: className, style: style, ref: treeRef }, rest), flatNodesList.map(function (_, i) { return itemRenderer(i); })))));
|
|
175
208
|
};
|
|
176
209
|
exports.Tree = Tree;
|
|
210
|
+
var TreeElement = react_1.default.forwardRef(function (_a, ref) {
|
|
211
|
+
var children = _a.children, className = _a.className, rest = __rest(_a, ["children", "className"]);
|
|
212
|
+
return (react_1.default.createElement("ul", __assign({ className: (0, classnames_1.default)('iui-tree', className), role: 'tree', ref: ref, tabIndex: 0 }, rest), children));
|
|
213
|
+
});
|
|
214
|
+
// Having virtualized tree separately prevents from running all virtualization logic
|
|
215
|
+
var VirtualizedTree = react_1.default.forwardRef(function (_a, ref) {
|
|
216
|
+
var flatNodesList = _a.flatNodesList, itemRenderer = _a.itemRenderer, scrollToIndex = _a.scrollToIndex, className = _a.className, style = _a.style, rest = __rest(_a, ["flatNodesList", "itemRenderer", "scrollToIndex", "className", "style"]);
|
|
217
|
+
var _b = (0, utils_1.useVirtualization)({
|
|
218
|
+
itemsLength: flatNodesList.length,
|
|
219
|
+
itemRenderer: itemRenderer,
|
|
220
|
+
scrollToIndex: scrollToIndex,
|
|
221
|
+
}), outerProps = _b.outerProps, innerProps = _b.innerProps, visibleChildren = _b.visibleChildren;
|
|
222
|
+
return (react_1.default.createElement("div", __assign({}, __assign(__assign({}, outerProps), { className: (0, classnames_1.default)(className, outerProps.className), style: __assign(__assign({}, style), outerProps.style) })),
|
|
223
|
+
react_1.default.createElement(TreeElement, __assign({}, innerProps, rest, { ref: (0, utils_1.mergeRefs)(ref, innerProps.ref) }), visibleChildren)));
|
|
224
|
+
});
|
|
177
225
|
exports.default = exports.Tree;
|
|
@@ -20,6 +20,10 @@ export declare type TreeContextProps = {
|
|
|
20
20
|
* Node index in the list of nodes under the same parent node or in the root. Used for an accessibility attribute.
|
|
21
21
|
*/
|
|
22
22
|
indexInGroup: number;
|
|
23
|
+
/**
|
|
24
|
+
* Function that scrolls to the node's parent node.
|
|
25
|
+
*/
|
|
26
|
+
scrollToParent?: () => void;
|
|
23
27
|
};
|
|
24
28
|
export declare const TreeContext: React.Context<TreeContextProps | undefined>;
|
|
25
29
|
export declare const useTreeContext: () => TreeContextProps;
|
|
@@ -58,7 +58,7 @@ var TreeContext_1 = require("./TreeContext");
|
|
|
58
58
|
var TreeNode = function (props) {
|
|
59
59
|
var nodeId = props.nodeId, label = props.label, sublabel = props.sublabel, children = props.children, className = props.className, icon = props.icon, _a = props.hasSubNodes, hasSubNodes = _a === void 0 ? false : _a, _b = props.isDisabled, isDisabled = _b === void 0 ? false : _b, _c = props.isExpanded, isExpanded = _c === void 0 ? false : _c, _d = props.isSelected, isSelected = _d === void 0 ? false : _d, onSelected = props.onSelected, onExpanded = props.onExpanded, checkbox = props.checkbox, expander = props.expander, rest = __rest(props, ["nodeId", "label", "sublabel", "children", "className", "icon", "hasSubNodes", "isDisabled", "isExpanded", "isSelected", "onSelected", "onExpanded", "checkbox", "expander"]);
|
|
60
60
|
(0, utils_1.useTheme)();
|
|
61
|
-
var _e = (0, TreeContext_1.useTreeContext)(), nodeDepth = _e.nodeDepth, _f = _e.subNodeIds, subNodeIds = _f === void 0 ? [] : _f, parentNodeId = _e.parentNodeId, groupSize = _e.groupSize, indexInGroup = _e.indexInGroup;
|
|
61
|
+
var _e = (0, TreeContext_1.useTreeContext)(), nodeDepth = _e.nodeDepth, _f = _e.subNodeIds, subNodeIds = _f === void 0 ? [] : _f, parentNodeId = _e.parentNodeId, scrollToParent = _e.scrollToParent, groupSize = _e.groupSize, indexInGroup = _e.indexInGroup;
|
|
62
62
|
var _g = react_1.default.useState(false), isFocused = _g[0], setIsFocused = _g[1];
|
|
63
63
|
var nodeRef = react_1.default.useRef(null);
|
|
64
64
|
var styleDepth = react_1.default.useMemo(function () {
|
|
@@ -68,7 +68,7 @@ var TreeNode = function (props) {
|
|
|
68
68
|
: { marginLeft: nodeDepth ? nodeDepth * 28 : 0 };
|
|
69
69
|
}, [nodeDepth]);
|
|
70
70
|
var onKeyDown = function (event) {
|
|
71
|
-
var _a, _b, _c, _d, _e, _f
|
|
71
|
+
var _a, _b, _c, _d, _e, _f;
|
|
72
72
|
var isNodeFocused = nodeRef.current === ((_a = nodeRef.current) === null || _a === void 0 ? void 0 : _a.ownerDocument.activeElement);
|
|
73
73
|
switch (event.key) {
|
|
74
74
|
case 'ArrowLeft': {
|
|
@@ -79,20 +79,19 @@ var TreeNode = function (props) {
|
|
|
79
79
|
break;
|
|
80
80
|
}
|
|
81
81
|
if (parentNodeId) {
|
|
82
|
-
|
|
83
|
-
parentNode === null || parentNode === void 0 ? void 0 : parentNode.focus();
|
|
82
|
+
scrollToParent === null || scrollToParent === void 0 ? void 0 : scrollToParent();
|
|
84
83
|
break;
|
|
85
84
|
}
|
|
86
85
|
// If it is top level node (doesn't have parent node), then do nothing.
|
|
87
86
|
break;
|
|
88
87
|
}
|
|
89
88
|
var focusableElements = (0, utils_1.getFocusableElements)(nodeRef.current);
|
|
90
|
-
var currentIndex = focusableElements.indexOf((
|
|
89
|
+
var currentIndex = focusableElements.indexOf((_b = nodeRef.current) === null || _b === void 0 ? void 0 : _b.ownerDocument.activeElement);
|
|
91
90
|
if (currentIndex === 0) {
|
|
92
|
-
(
|
|
91
|
+
(_c = nodeRef.current) === null || _c === void 0 ? void 0 : _c.focus();
|
|
93
92
|
}
|
|
94
93
|
else {
|
|
95
|
-
(
|
|
94
|
+
(_d = focusableElements[currentIndex - 1]) === null || _d === void 0 ? void 0 : _d.focus();
|
|
96
95
|
}
|
|
97
96
|
break;
|
|
98
97
|
}
|
|
@@ -104,10 +103,10 @@ var TreeNode = function (props) {
|
|
|
104
103
|
onExpanded(nodeId, true);
|
|
105
104
|
break;
|
|
106
105
|
}
|
|
107
|
-
(
|
|
106
|
+
(_e = focusableElements[0]) === null || _e === void 0 ? void 0 : _e.focus();
|
|
108
107
|
break;
|
|
109
108
|
}
|
|
110
|
-
var currentIndex = focusableElements.indexOf((
|
|
109
|
+
var currentIndex = focusableElements.indexOf((_f = nodeRef.current) === null || _f === void 0 ? void 0 : _f.ownerDocument.activeElement);
|
|
111
110
|
if (currentIndex < focusableElements.length - 1) {
|
|
112
111
|
focusableElements[currentIndex + 1].focus();
|
|
113
112
|
break;
|
|
@@ -43,6 +43,6 @@ require("@itwin/itwinui-css/css/text.css");
|
|
|
43
43
|
exports.Small = react_1.default.forwardRef(function (props, ref) {
|
|
44
44
|
var className = props.className, _a = props.isMuted, isMuted = _a === void 0 ? false : _a, rest = __rest(props, ["className", "isMuted"]);
|
|
45
45
|
(0, utils_1.useTheme)();
|
|
46
|
-
return (react_1.default.createElement("
|
|
46
|
+
return (react_1.default.createElement("small", __assign({ ref: ref, className: (0, classnames_1.default)('iui-text-small', { 'iui-text-muted': isMuted }, className) }, rest)));
|
|
47
47
|
});
|
|
48
48
|
exports.default = exports.Small;
|
package/cjs/core/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { Alert } from './Alert';
|
|
2
2
|
export type { AlertProps } from './Alert';
|
|
3
|
+
export { Backdrop } from './Backdrop';
|
|
4
|
+
export type { BackdropProps } from './Backdrop';
|
|
3
5
|
export { Badge } from './Badge';
|
|
4
6
|
export type { BadgeProps } from './Badge';
|
|
5
7
|
export { Breadcrumbs } from './Breadcrumbs';
|
|
@@ -28,7 +30,7 @@ export { Fieldset } from './Fieldset';
|
|
|
28
30
|
export type { FieldsetProps } from './Fieldset';
|
|
29
31
|
export { FileUpload, FileUploadTemplate } from './FileUpload';
|
|
30
32
|
export type { FileUploadProps, FileUploadTemplateProps } from './FileUpload';
|
|
31
|
-
export { Footer } from './Footer';
|
|
33
|
+
export { Footer, defaultFooterElements } from './Footer';
|
|
32
34
|
export type { FooterProps, FooterElement, TitleTranslations } from './Footer';
|
|
33
35
|
export { Header, HeaderBreadcrumbs, HeaderButton, HeaderLogo } from './Header';
|
|
34
36
|
export type { HeaderProps, HeaderBreadcrumbsProps, HeaderButtonProps, HeaderLogoProps, } from './Header';
|
package/cjs/core/index.js
CHANGED
|
@@ -3,15 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.MiddleTextTruncation = exports.ColorValue = exports.useTheme = exports.getUserColor = exports.Wizard = exports.UserIconGroup = exports.UserIcon = void 0;
|
|
6
|
+
exports.MenuDivider = exports.MenuItem = exports.Menu = exports.LabeledTextarea = exports.LabeledSelect = exports.InputGroup = exports.LabeledInput = exports.Label = exports.Input = exports.InformationPanelContent = exports.InformationPanelBody = exports.InformationPanelHeader = exports.InformationPanelWrapper = exports.InformationPanel = exports.HorizontalTab = exports.HorizontalTabs = exports.Tab = exports.VerticalTabs = exports.HeaderLogo = exports.HeaderButton = exports.HeaderBreadcrumbs = exports.Header = exports.defaultFooterElements = exports.Footer = exports.FileUploadTemplate = exports.FileUpload = exports.Fieldset = exports.ExpandableBlock = exports.ErrorPage = exports.DropdownMenu = exports.generateLocalizedStrings = exports.DatePicker = exports.ComboBox = exports.ColorPalette = exports.ColorInputPanel = exports.ColorBuilder = exports.ColorSwatch = exports.ColorPicker = exports.Checkbox = exports.Carousel = exports.ButtonGroup = exports.SplitButton = exports.IdeasButton = exports.IconButton = exports.DropdownButton = exports.Button = exports.Breadcrumbs = exports.Badge = exports.Backdrop = exports.Alert = void 0;
|
|
7
|
+
exports.Kbd = exports.Code = exports.Blockquote = exports.Title = exports.Subheading = exports.Small = exports.Leading = exports.Headline = exports.Body = exports.Anchor = exports.TreeNodeExpander = exports.TreeNode = exports.Tree = exports.Tooltip = exports.ToggleSwitch = exports.ThemeProvider = exports.toaster = exports.TimePicker = exports.Tile = exports.Textarea = exports.TagContainer = exports.Tag = exports.SelectionColumn = exports.ExpanderColumn = exports.ActionColumn = exports.TablePaginator = exports.EditableCell = exports.DefaultCell = exports.FilterButtonBar = exports.tableFilters = exports.Table = exports.Surface = exports.StatusMessage = exports.Slider = exports.SkipToContentLink = exports.SidenavSubmenuHeader = exports.SidenavSubmenu = exports.SidenavButton = exports.SideNavigation = exports.Select = exports.RadioTileGroup = exports.RadioTile = exports.Radio = exports.ProgressRadial = exports.ProgressLinear = exports.ModalContent = exports.ModalButtonBar = exports.Modal = exports.MenuItemSkeleton = exports.MenuExtraContent = void 0;
|
|
8
|
+
exports.MiddleTextTruncation = exports.ColorValue = exports.useTheme = exports.getUserColor = exports.Wizard = exports.UserIconGroup = exports.UserIcon = exports.Text = exports.KbdKeys = void 0;
|
|
9
9
|
/*---------------------------------------------------------------------------------------------
|
|
10
10
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
11
11
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
12
12
|
*--------------------------------------------------------------------------------------------*/
|
|
13
13
|
var Alert_1 = require("./Alert");
|
|
14
14
|
Object.defineProperty(exports, "Alert", { enumerable: true, get: function () { return Alert_1.Alert; } });
|
|
15
|
+
var Backdrop_1 = require("./Backdrop");
|
|
16
|
+
Object.defineProperty(exports, "Backdrop", { enumerable: true, get: function () { return Backdrop_1.Backdrop; } });
|
|
15
17
|
var Badge_1 = require("./Badge");
|
|
16
18
|
Object.defineProperty(exports, "Badge", { enumerable: true, get: function () { return Badge_1.Badge; } });
|
|
17
19
|
var Breadcrumbs_1 = require("./Breadcrumbs");
|
|
@@ -52,6 +54,7 @@ Object.defineProperty(exports, "FileUpload", { enumerable: true, get: function (
|
|
|
52
54
|
Object.defineProperty(exports, "FileUploadTemplate", { enumerable: true, get: function () { return FileUpload_1.FileUploadTemplate; } });
|
|
53
55
|
var Footer_1 = require("./Footer");
|
|
54
56
|
Object.defineProperty(exports, "Footer", { enumerable: true, get: function () { return Footer_1.Footer; } });
|
|
57
|
+
Object.defineProperty(exports, "defaultFooterElements", { enumerable: true, get: function () { return Footer_1.defaultFooterElements; } });
|
|
55
58
|
var Header_1 = require("./Header");
|
|
56
59
|
Object.defineProperty(exports, "Header", { enumerable: true, get: function () { return Header_1.Header; } });
|
|
57
60
|
Object.defineProperty(exports, "HeaderBreadcrumbs", { enumerable: true, get: function () { return Header_1.HeaderBreadcrumbs; } });
|
|
@@ -42,7 +42,7 @@ var FocusTrap = function (props) {
|
|
|
42
42
|
lastElement === null || lastElement === void 0 ? void 0 : lastElement.focus();
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
|
-
return (react_1.default.createElement(
|
|
45
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
46
46
|
react_1.default.createElement("div", { tabIndex: 0, onFocus: onFirstFocus, "aria-hidden": true }),
|
|
47
47
|
react_1.default.cloneElement(children, {
|
|
48
48
|
ref: (0, useMergedRefs_1.mergeRefs)(children.ref, childRef),
|
|
@@ -44,7 +44,7 @@ var MiddleTextTruncation = function (props) {
|
|
|
44
44
|
var _b = (0, useOverflow_1.useOverflow)(text), ref = _b[0], visibleCount = _b[1];
|
|
45
45
|
var truncatedText = react_1.default.useMemo(function () {
|
|
46
46
|
if (visibleCount < text.length) {
|
|
47
|
-
return "".concat(text.
|
|
47
|
+
return "".concat(text.substring(0, visibleCount - endCharsCount - ELLIPSIS_CHAR.length)).concat(ELLIPSIS_CHAR).concat(text.substring(text.length - endCharsCount));
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
50
|
return text;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Hook that keeps track of the latest value in a ref.
|
|
4
|
+
* @private
|
|
5
|
+
* @example
|
|
6
|
+
* const { value } = props;
|
|
7
|
+
* const valueRef = useLatestRef(value);
|
|
8
|
+
*/
|
|
9
|
+
export declare const useLatestRef: <T>(value: T) => React.MutableRefObject<T>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useLatestRef = void 0;
|
|
7
|
+
/*---------------------------------------------------------------------------------------------
|
|
8
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
9
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
10
|
+
*--------------------------------------------------------------------------------------------*/
|
|
11
|
+
var react_1 = __importDefault(require("react"));
|
|
12
|
+
/**
|
|
13
|
+
* Hook that keeps track of the latest value in a ref.
|
|
14
|
+
* @private
|
|
15
|
+
* @example
|
|
16
|
+
* const { value } = props;
|
|
17
|
+
* const valueRef = useLatestRef(value);
|
|
18
|
+
*/
|
|
19
|
+
var useLatestRef = function (value) {
|
|
20
|
+
var valueRef = react_1.default.useRef(value);
|
|
21
|
+
react_1.default.useEffect(function () {
|
|
22
|
+
valueRef.current = value;
|
|
23
|
+
}, [value]);
|
|
24
|
+
return valueRef;
|
|
25
|
+
};
|
|
26
|
+
exports.useLatestRef = useLatestRef;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '@itwin/itwinui-css/css/backdrop.css';
|
|
3
|
+
export declare type BackdropProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Flag whether backdrop should be shown.
|
|
6
|
+
* @default true
|
|
7
|
+
*/
|
|
8
|
+
isVisible?: boolean;
|
|
9
|
+
} & React.ComponentPropsWithRef<'div'>;
|
|
10
|
+
export declare const Backdrop: React.ForwardRefExoticComponent<Pick<BackdropProps, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "isVisible"> & React.RefAttributes<HTMLDivElement>>;
|