@itwin/itwinui-react 1.42.0 → 1.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -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/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 +2 -1
- package/cjs/core/Table/Table.js +6 -1
- package/cjs/core/Table/columns/actionColumn.d.ts +8 -3
- package/cjs/core/Table/columns/actionColumn.js +33 -2
- package/cjs/core/Table/hooks/useScrollToRow.d.ts +1 -1
- package/cjs/core/Table/hooks/useScrollToRow.js +3 -3
- 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/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/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 +2 -1
- package/esm/core/Table/Table.js +6 -1
- package/esm/core/Table/columns/actionColumn.d.ts +8 -3
- package/esm/core/Table/columns/actionColumn.js +33 -2
- package/esm/core/Table/hooks/useScrollToRow.d.ts +1 -1
- package/esm/core/Table/hooks/useScrollToRow.js +3 -3
- 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/package.json +6 -5
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
1
12
|
/*---------------------------------------------------------------------------------------------
|
|
2
13
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
14
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -11,6 +22,7 @@ import { MenuItem } from '../../Menu';
|
|
|
11
22
|
import { tableResizeStartAction } from '../Table';
|
|
12
23
|
import { SELECTION_CELL_ID } from './selectionColumn';
|
|
13
24
|
import { EXPANDER_CELL_ID } from './expanderColumn';
|
|
25
|
+
import cx from 'classnames';
|
|
14
26
|
var ACTION_CELL_ID = 'iui-table-action';
|
|
15
27
|
/**
|
|
16
28
|
* Action column that adds column manager to the Table header.
|
|
@@ -46,6 +58,7 @@ export var ActionColumn = function (_a) {
|
|
|
46
58
|
Header: function (_a) {
|
|
47
59
|
var allColumns = _a.allColumns, dispatch = _a.dispatch, state = _a.state;
|
|
48
60
|
var _b = React.useState(false), isOpen = _b[0], setIsOpen = _b[1];
|
|
61
|
+
var buttonRef = React.useRef(null);
|
|
49
62
|
if (!columnManager) {
|
|
50
63
|
return null;
|
|
51
64
|
}
|
|
@@ -71,13 +84,31 @@ export var ActionColumn = function (_a) {
|
|
|
71
84
|
}
|
|
72
85
|
// Triggers an update to resize the widths of all visible columns
|
|
73
86
|
dispatch({ type: tableResizeStartAction });
|
|
87
|
+
// If some columns were resized and some columns visibility was enabled, then horizontal scrollbar appears
|
|
88
|
+
// and table is scrolled to the very left which means our visibility dropdown menu is not visible.
|
|
89
|
+
// So for better UX we need to scroll to that dropdown menu.
|
|
90
|
+
queueMicrotask(function () {
|
|
91
|
+
var _a;
|
|
92
|
+
(_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView();
|
|
93
|
+
});
|
|
74
94
|
};
|
|
75
95
|
return (React.createElement(MenuItem, { key: column.id, icon: React.createElement(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 },
|
|
76
96
|
React.createElement("div", { id: "iui-column-".concat(column.id) }, column.render('Header'))));
|
|
77
97
|
});
|
|
78
98
|
};
|
|
79
|
-
|
|
80
|
-
|
|
99
|
+
var dropdownMenuProps = typeof columnManager !== 'boolean'
|
|
100
|
+
? columnManager.dropdownMenuProps
|
|
101
|
+
: {};
|
|
102
|
+
return (React.createElement(DropdownMenu, __assign({}, dropdownMenuProps, { menuItems: headerCheckBoxes, onHide: function (i) {
|
|
103
|
+
var _a;
|
|
104
|
+
setIsOpen(false);
|
|
105
|
+
(_a = dropdownMenuProps.onHide) === null || _a === void 0 ? void 0 : _a.call(dropdownMenuProps, i);
|
|
106
|
+
}, onShow: function (i) {
|
|
107
|
+
var _a;
|
|
108
|
+
setIsOpen(true);
|
|
109
|
+
(_a = dropdownMenuProps.onShow) === null || _a === void 0 ? void 0 : _a.call(dropdownMenuProps, i);
|
|
110
|
+
}, style: __assign({ maxHeight: '315px' }, dropdownMenuProps.style), className: cx('iui-scroll', dropdownMenuProps.className) }),
|
|
111
|
+
React.createElement(IconButton, { styleType: 'borderless', isActive: isOpen, ref: buttonRef },
|
|
81
112
|
React.createElement(SvgColumnManager, null))));
|
|
82
113
|
},
|
|
83
114
|
};
|
|
@@ -7,5 +7,5 @@ declare type ScrollToRow<T extends Record<string, unknown>> = {
|
|
|
7
7
|
declare type ScrollToRowProps<T extends Record<string, unknown>> = TableProps<T> & {
|
|
8
8
|
page: Row<T>[];
|
|
9
9
|
};
|
|
10
|
-
export declare function useScrollToRow<T extends Record<string, unknown>>({ data, enableVirtualization, page, paginatorRenderer, scrollToRow,
|
|
10
|
+
export declare function useScrollToRow<T extends Record<string, unknown>>({ data, enableVirtualization, page, paginatorRenderer, scrollToRow, }: ScrollToRowProps<T>): ScrollToRow<T>;
|
|
11
11
|
export {};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import React from 'react';
|
|
6
6
|
export function useScrollToRow(_a) {
|
|
7
|
-
var data = _a.data, enableVirtualization = _a.enableVirtualization, page = _a.page, paginatorRenderer = _a.paginatorRenderer, scrollToRow = _a.scrollToRow
|
|
7
|
+
var data = _a.data, enableVirtualization = _a.enableVirtualization, page = _a.page, paginatorRenderer = _a.paginatorRenderer, scrollToRow = _a.scrollToRow;
|
|
8
8
|
var rowRefs = React.useRef({});
|
|
9
9
|
// Refs prevents from having `page` and `data` as dependencies
|
|
10
10
|
// therefore we avoid unnecessary scroll to row.
|
|
@@ -15,12 +15,12 @@ export function useScrollToRow(_a) {
|
|
|
15
15
|
// For virtualized tables, all we need to do is pass the index of the item
|
|
16
16
|
// to the VirtualScroll component
|
|
17
17
|
var scrollToIndex = React.useMemo(function () {
|
|
18
|
-
if (!scrollToRow || paginatorRenderer
|
|
18
|
+
if (!scrollToRow || paginatorRenderer) {
|
|
19
19
|
return undefined;
|
|
20
20
|
}
|
|
21
21
|
var index = scrollToRow(pageRef.current, dataRef.current);
|
|
22
22
|
return index < 0 ? undefined : index;
|
|
23
|
-
}, [
|
|
23
|
+
}, [paginatorRenderer, scrollToRow]);
|
|
24
24
|
// For non-virtualized tables, we need to add a ref to each row
|
|
25
25
|
// and scroll to the element
|
|
26
26
|
React.useEffect(function () {
|
package/esm/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/esm/core/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
export { Alert } from './Alert';
|
|
6
|
+
export { Backdrop } from './Backdrop';
|
|
6
7
|
export { Badge } from './Badge';
|
|
7
8
|
export { Breadcrumbs } from './Breadcrumbs';
|
|
8
9
|
export { Button, DropdownButton, IconButton, IdeasButton, SplitButton, } from './Buttons';
|
|
@@ -17,7 +18,7 @@ export { ErrorPage } from './ErrorPage';
|
|
|
17
18
|
export { ExpandableBlock } from './ExpandableBlock';
|
|
18
19
|
export { Fieldset } from './Fieldset';
|
|
19
20
|
export { FileUpload, FileUploadTemplate } from './FileUpload';
|
|
20
|
-
export { Footer } from './Footer';
|
|
21
|
+
export { Footer, defaultFooterElements } from './Footer';
|
|
21
22
|
export { Header, HeaderBreadcrumbs, HeaderButton, HeaderLogo } from './Header';
|
|
22
23
|
export { VerticalTabs, Tab, HorizontalTabs, HorizontalTab } from './Tabs';
|
|
23
24
|
export { InformationPanel, InformationPanelWrapper, InformationPanelHeader, InformationPanelBody, InformationPanelContent, } from './InformationPanel';
|
|
@@ -36,7 +36,7 @@ export var FocusTrap = function (props) {
|
|
|
36
36
|
lastElement === null || lastElement === void 0 ? void 0 : lastElement.focus();
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
return (React.createElement(
|
|
39
|
+
return (React.createElement(React.Fragment, null,
|
|
40
40
|
React.createElement("div", { tabIndex: 0, onFocus: onFirstFocus, "aria-hidden": true }),
|
|
41
41
|
React.cloneElement(children, {
|
|
42
42
|
ref: mergeRefs(children.ref, childRef),
|
|
@@ -38,7 +38,7 @@ export var MiddleTextTruncation = function (props) {
|
|
|
38
38
|
var _b = useOverflow(text), ref = _b[0], visibleCount = _b[1];
|
|
39
39
|
var truncatedText = React.useMemo(function () {
|
|
40
40
|
if (visibleCount < text.length) {
|
|
41
|
-
return "".concat(text.
|
|
41
|
+
return "".concat(text.substring(0, visibleCount - endCharsCount - ELLIPSIS_CHAR.length)).concat(ELLIPSIS_CHAR).concat(text.substring(text.length - endCharsCount));
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
44
44
|
return text;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/itwinui-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.43.0",
|
|
4
4
|
"author": "Bentley Systems",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "cjs/index.js",
|
|
@@ -29,10 +29,11 @@
|
|
|
29
29
|
"ux"
|
|
30
30
|
],
|
|
31
31
|
"scripts": {
|
|
32
|
-
"build": "yarn clean && yarn copy-files && tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json",
|
|
33
|
-
"build:watch": "yarn clean && yarn copy-files && concurrently \"tsc -p tsconfig.cjs.json --watch\" \"tsc -p tsconfig.esm.json --watch\"",
|
|
34
|
-
"clean": "yarn clean:coverage && rimraf esm && rimraf cjs",
|
|
32
|
+
"build": "yarn clean:build && yarn copy-files && tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json",
|
|
33
|
+
"build:watch": "yarn clean:build && yarn copy-files && concurrently \"tsc -p tsconfig.cjs.json --watch\" \"tsc -p tsconfig.esm.json --watch\"",
|
|
34
|
+
"clean:build": "yarn clean:coverage && rimraf esm && rimraf cjs",
|
|
35
35
|
"clean:coverage": "rimraf coverage",
|
|
36
|
+
"clean": "rimraf .turbo && yarn clean:coverage && yarn clean:build && rimraf node_modules",
|
|
36
37
|
"test": "jest",
|
|
37
38
|
"test:watch": "jest --watch",
|
|
38
39
|
"format": "prettier --config .prettierrc **/*.{tsx,ts,js} --ignore-path .gitignore --write",
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
"createComponent": "node ../../scripts/createComponent.js"
|
|
44
45
|
},
|
|
45
46
|
"dependencies": {
|
|
46
|
-
"@itwin/itwinui-css": "^0.
|
|
47
|
+
"@itwin/itwinui-css": "^0.63.0",
|
|
47
48
|
"@itwin/itwinui-icons-react": "^1.10.1",
|
|
48
49
|
"@itwin/itwinui-illustrations-react": "^1.3.1",
|
|
49
50
|
"@tippyjs/react": "^4.2.5",
|