@itwin/itwinui-react 1.40.1 → 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 +42 -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 +22 -18
- 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/ErrorPage/ErrorPage.d.ts +3 -1
- package/cjs/core/ErrorPage/ErrorPage.js +31 -1
- 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 -13
- package/cjs/core/Modal/Modal.js +9 -71
- 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 +21 -10
- package/cjs/core/Table/TableRowMemoized.d.ts +4 -0
- package/cjs/core/Table/TableRowMemoized.js +15 -3
- package/cjs/core/Table/cells/EditableCell.js +7 -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 +23 -19
- 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/ErrorPage/ErrorPage.d.ts +3 -1
- package/esm/core/ErrorPage/ErrorPage.js +31 -1
- 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 -13
- package/esm/core/Modal/Modal.js +10 -72
- 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 +23 -12
- package/esm/core/Table/TableRowMemoized.d.ts +4 -0
- package/esm/core/Table/TableRowMemoized.js +15 -3
- package/esm/core/Table/cells/EditableCell.js +7 -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 +8 -7
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type DialogContextProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Flag whether dialog should be shown.
|
|
5
|
+
* @default false
|
|
6
|
+
*/
|
|
7
|
+
isOpen?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Handler that is called when dialog is closed.
|
|
10
|
+
*/
|
|
11
|
+
onClose?: (event?: React.SyntheticEvent) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Flag whether dialog is dismissible. If false, you can't close it.
|
|
14
|
+
* @default true
|
|
15
|
+
*/
|
|
16
|
+
isDismissible?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Flag whether dialog should be closed on backdrop press.
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
closeOnExternalClick?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Flag whether dialog should be closed on Escape key press.
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
closeOnEsc?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Traps the focus inside the dialog. This is useful when the dialog is modal.
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
trapFocus?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Prevents body from being scrollable. This is useful when the dialog is modal.
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
preventDocumentScroll?: boolean;
|
|
37
|
+
};
|
|
38
|
+
export declare const DialogContext: React.Context<DialogContextProps | undefined>;
|
|
39
|
+
export declare const useDialogContext: () => DialogContextProps;
|
|
@@ -0,0 +1,16 @@
|
|
|
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.useDialogContext = exports.DialogContext = 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
|
+
exports.DialogContext = react_1.default.createContext(undefined);
|
|
13
|
+
var useDialogContext = function () {
|
|
14
|
+
return react_1.default.useContext(exports.DialogContext) || {};
|
|
15
|
+
};
|
|
16
|
+
exports.useDialogContext = useDialogContext;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '@itwin/itwinui-css/css/dialog.css';
|
|
3
|
+
import { DialogContextProps } from './DialogContext';
|
|
4
|
+
export declare type DialogMainProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Type of the dialog.
|
|
7
|
+
* @default 'default'
|
|
8
|
+
*/
|
|
9
|
+
styleType?: 'default' | 'fullPage';
|
|
10
|
+
/**
|
|
11
|
+
* Content of the dialog.
|
|
12
|
+
*/
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
} & Omit<DialogContextProps, 'closeOnExternalClick'> & React.ComponentPropsWithRef<'div'>;
|
|
15
|
+
/**
|
|
16
|
+
* Dialog component which can wrap any content.
|
|
17
|
+
* @example
|
|
18
|
+
* <Dialog.Main>
|
|
19
|
+
* <Dialog.TitleBar>
|
|
20
|
+
* My dialog title
|
|
21
|
+
* </Dialog.TitleBar>
|
|
22
|
+
* <Dialog.Content>
|
|
23
|
+
* Here is my dialog content
|
|
24
|
+
* </Dialog.Content>
|
|
25
|
+
* <Dialog.ButtonBar>
|
|
26
|
+
* <Button styleType='high-visibility'>
|
|
27
|
+
* Primary button
|
|
28
|
+
* </Button>
|
|
29
|
+
* <Button>
|
|
30
|
+
* Secondary button
|
|
31
|
+
* </Button>
|
|
32
|
+
* </Dialog.ButtonBar>
|
|
33
|
+
* </Dialog.Main>
|
|
34
|
+
*/
|
|
35
|
+
export declare const DialogMain: React.ForwardRefExoticComponent<Pick<DialogMainProps, "onClose" | "key" | keyof React.HTMLAttributes<HTMLDivElement> | "styleType" | "isOpen" | "isDismissible" | "closeOnEsc" | "trapFocus" | "preventDocumentScroll"> & React.RefAttributes<HTMLDivElement>>;
|
|
36
|
+
export default DialogMain;
|
|
@@ -0,0 +1,120 @@
|
|
|
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.DialogMain = 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/dialog.css");
|
|
37
|
+
var DialogContext_1 = require("./DialogContext");
|
|
38
|
+
var react_transition_group_1 = require("react-transition-group");
|
|
39
|
+
/**
|
|
40
|
+
* Dialog component which can wrap any content.
|
|
41
|
+
* @example
|
|
42
|
+
* <Dialog.Main>
|
|
43
|
+
* <Dialog.TitleBar>
|
|
44
|
+
* My dialog title
|
|
45
|
+
* </Dialog.TitleBar>
|
|
46
|
+
* <Dialog.Content>
|
|
47
|
+
* Here is my dialog content
|
|
48
|
+
* </Dialog.Content>
|
|
49
|
+
* <Dialog.ButtonBar>
|
|
50
|
+
* <Button styleType='high-visibility'>
|
|
51
|
+
* Primary button
|
|
52
|
+
* </Button>
|
|
53
|
+
* <Button>
|
|
54
|
+
* Secondary button
|
|
55
|
+
* </Button>
|
|
56
|
+
* </Dialog.ButtonBar>
|
|
57
|
+
* </Dialog.Main>
|
|
58
|
+
*/
|
|
59
|
+
exports.DialogMain = react_1.default.forwardRef(function (props, ref) {
|
|
60
|
+
var dialogContext = (0, DialogContext_1.useDialogContext)();
|
|
61
|
+
var className = props.className, children = props.children, _a = props.styleType, styleType = _a === void 0 ? 'default' : _a, _b = props.isOpen, isOpen = _b === void 0 ? dialogContext.isOpen : _b, _c = props.isDismissible, isDismissible = _c === void 0 ? dialogContext.isDismissible : _c, _d = props.onClose, onClose = _d === void 0 ? dialogContext.onClose : _d, _e = props.closeOnEsc, closeOnEsc = _e === void 0 ? dialogContext.closeOnEsc : _e, _f = props.trapFocus, trapFocus = _f === void 0 ? dialogContext.trapFocus : _f, _g = props.preventDocumentScroll, preventDocumentScroll = _g === void 0 ? dialogContext.preventDocumentScroll : _g, onKeyDown = props.onKeyDown, rest = __rest(props, ["className", "children", "styleType", "isOpen", "isDismissible", "onClose", "closeOnEsc", "trapFocus", "preventDocumentScroll", "onKeyDown"]);
|
|
62
|
+
(0, utils_1.useTheme)();
|
|
63
|
+
var dialogRef = react_1.default.useRef(null);
|
|
64
|
+
var refs = (0, utils_1.useMergedRefs)(dialogRef, ref);
|
|
65
|
+
// Focuses dialog when opened and brings back focus to the previously focused element when closed.
|
|
66
|
+
var previousFocusedElement = react_1.default.useRef();
|
|
67
|
+
react_1.default.useEffect(function () {
|
|
68
|
+
var _a, _b, _c;
|
|
69
|
+
if (isOpen) {
|
|
70
|
+
previousFocusedElement.current = (_a = dialogRef.current) === null || _a === void 0 ? void 0 : _a.ownerDocument.activeElement;
|
|
71
|
+
(_b = dialogRef.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
(_c = previousFocusedElement.current) === null || _c === void 0 ? void 0 : _c.focus();
|
|
75
|
+
}
|
|
76
|
+
var ref = dialogRef.current;
|
|
77
|
+
return function () {
|
|
78
|
+
var _a;
|
|
79
|
+
(ref === null || ref === void 0 ? void 0 : ref.contains(document.activeElement)) &&
|
|
80
|
+
((_a = previousFocusedElement.current) === null || _a === void 0 ? void 0 : _a.focus());
|
|
81
|
+
};
|
|
82
|
+
}, [isOpen]);
|
|
83
|
+
// Prevents document from scrolling when the dialog is open.
|
|
84
|
+
var originalBodyOverflow = react_1.default.useRef('');
|
|
85
|
+
react_1.default.useEffect(function () {
|
|
86
|
+
var _a;
|
|
87
|
+
var ownerDocument = (_a = dialogRef.current) === null || _a === void 0 ? void 0 : _a.ownerDocument;
|
|
88
|
+
if (!ownerDocument || !preventDocumentScroll) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (isOpen) {
|
|
92
|
+
originalBodyOverflow.current = ownerDocument.body.style.overflow;
|
|
93
|
+
ownerDocument.body.style.overflow = 'hidden';
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
ownerDocument.body.style.overflow = originalBodyOverflow.current;
|
|
97
|
+
}
|
|
98
|
+
return function () {
|
|
99
|
+
ownerDocument.body.style.overflow = originalBodyOverflow.current;
|
|
100
|
+
};
|
|
101
|
+
}, [isOpen, preventDocumentScroll]);
|
|
102
|
+
var handleKeyDown = function (event) {
|
|
103
|
+
// Prevents React from resetting its properties
|
|
104
|
+
event.persist();
|
|
105
|
+
if (isDismissible && closeOnEsc && event.key === 'Escape' && onClose) {
|
|
106
|
+
onClose(event);
|
|
107
|
+
}
|
|
108
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
109
|
+
};
|
|
110
|
+
var content = (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-dialog', {
|
|
111
|
+
'iui-dialog-default': styleType === 'default',
|
|
112
|
+
'iui-dialog-full-page': styleType === 'fullPage',
|
|
113
|
+
'iui-dialog-visible': isOpen,
|
|
114
|
+
}, className), role: 'dialog', ref: refs, onKeyDown: handleKeyDown, tabIndex: -1 }, rest), children));
|
|
115
|
+
return (react_1.default.createElement(react_transition_group_1.CSSTransition, { in: isOpen, classNames: 'iui-dialog-animation', timeout: { exit: 600 }, unmountOnExit: true, nodeRef: dialogRef },
|
|
116
|
+
react_1.default.createElement(react_1.default.Fragment, null,
|
|
117
|
+
trapFocus && react_1.default.createElement(utils_1.FocusTrap, null, content),
|
|
118
|
+
!trapFocus && content)));
|
|
119
|
+
});
|
|
120
|
+
exports.default = exports.DialogMain;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '@itwin/itwinui-css/css/dialog.css';
|
|
3
|
+
import { DialogContextProps } from './DialogContext';
|
|
4
|
+
export declare type DialogTitleBarProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Dialog title bar content. If passed, then `title` prop is ignored.
|
|
7
|
+
*/
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Dialog title.
|
|
11
|
+
*/
|
|
12
|
+
titleText?: React.ReactNode;
|
|
13
|
+
} & Pick<DialogContextProps, 'isDismissible' | 'onClose'> & React.ComponentPropsWithRef<'div'>;
|
|
14
|
+
/**
|
|
15
|
+
* Dialog title bar. Recommended to be used as a child of `Dialog`.
|
|
16
|
+
* @example
|
|
17
|
+
* <Dialog.TitleBar title='My dialog title' />
|
|
18
|
+
* @example
|
|
19
|
+
* <Dialog.TitleBar>
|
|
20
|
+
* <Dialog.TitleBar.Title>My dialog title</Dialog.TitleBar.Title>
|
|
21
|
+
* <IconButton
|
|
22
|
+
* size='small'
|
|
23
|
+
* styleType='borderless'
|
|
24
|
+
* onClick={onClose}
|
|
25
|
+
* aria-label='Close'
|
|
26
|
+
* >
|
|
27
|
+
* <SvgClose />
|
|
28
|
+
* </IconButton>
|
|
29
|
+
* </Dialog.TitleBar>
|
|
30
|
+
*/
|
|
31
|
+
export declare const DialogTitleBar: React.ForwardRefExoticComponent<Pick<DialogTitleBarProps, "onClose" | "key" | keyof React.HTMLAttributes<HTMLDivElement> | "isDismissible" | "titleText"> & React.RefAttributes<HTMLDivElement>> & {
|
|
32
|
+
Title: React.ForwardRefExoticComponent<Pick<import("./DialogTitleBarTitle").DialogTitleBarTitleProps, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>>;
|
|
33
|
+
};
|
|
34
|
+
export default DialogTitleBar;
|
|
@@ -0,0 +1,69 @@
|
|
|
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.DialogTitleBar = 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 Close_1 = __importDefault(require("@itwin/itwinui-icons-react/cjs/icons/Close"));
|
|
36
|
+
var theming_1 = require("@storybook/theming");
|
|
37
|
+
var Buttons_1 = require("../Buttons");
|
|
38
|
+
require("@itwin/itwinui-css/css/dialog.css");
|
|
39
|
+
var DialogContext_1 = require("./DialogContext");
|
|
40
|
+
var DialogTitleBarTitle_1 = require("./DialogTitleBarTitle");
|
|
41
|
+
/**
|
|
42
|
+
* Dialog title bar. Recommended to be used as a child of `Dialog`.
|
|
43
|
+
* @example
|
|
44
|
+
* <Dialog.TitleBar title='My dialog title' />
|
|
45
|
+
* @example
|
|
46
|
+
* <Dialog.TitleBar>
|
|
47
|
+
* <Dialog.TitleBar.Title>My dialog title</Dialog.TitleBar.Title>
|
|
48
|
+
* <IconButton
|
|
49
|
+
* size='small'
|
|
50
|
+
* styleType='borderless'
|
|
51
|
+
* onClick={onClose}
|
|
52
|
+
* aria-label='Close'
|
|
53
|
+
* >
|
|
54
|
+
* <SvgClose />
|
|
55
|
+
* </IconButton>
|
|
56
|
+
* </Dialog.TitleBar>
|
|
57
|
+
*/
|
|
58
|
+
exports.DialogTitleBar = Object.assign(react_1.default.forwardRef(function (props, ref) {
|
|
59
|
+
var dialogContext = (0, DialogContext_1.useDialogContext)();
|
|
60
|
+
var children = props.children, titleText = props.titleText, _a = props.isDismissible, isDismissible = _a === void 0 ? dialogContext.isDismissible : _a, _b = props.onClose, onClose = _b === void 0 ? dialogContext.onClose : _b, className = props.className, rest = __rest(props, ["children", "titleText", "isDismissible", "onClose", "className"]);
|
|
61
|
+
(0, theming_1.useTheme)();
|
|
62
|
+
return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-dialog-title-bar', className), ref: ref }, rest), children ? (children) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
63
|
+
react_1.default.createElement(DialogTitleBarTitle_1.DialogTitleBarTitle, null, titleText),
|
|
64
|
+
isDismissible && (react_1.default.createElement(Buttons_1.IconButton, { size: 'small', styleType: 'borderless', onClick: onClose, "aria-label": 'Close' },
|
|
65
|
+
react_1.default.createElement(Close_1.default, null)))))));
|
|
66
|
+
}), {
|
|
67
|
+
Title: DialogTitleBarTitle_1.DialogTitleBarTitle,
|
|
68
|
+
});
|
|
69
|
+
exports.default = exports.DialogTitleBar;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '@itwin/itwinui-css/css/dialog.css';
|
|
3
|
+
export declare type DialogTitleBarTitleProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Dialog title content.
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
} & React.ComponentPropsWithRef<'div'>;
|
|
9
|
+
/**
|
|
10
|
+
* Dialog title bar. Recommended to be used as a child of `Dialog`.
|
|
11
|
+
* @example
|
|
12
|
+
* <Dialog.TitleBar>My dialog title</Dialog.TitleBar>
|
|
13
|
+
*/
|
|
14
|
+
export declare const DialogTitleBarTitle: React.ForwardRefExoticComponent<Pick<DialogTitleBarTitleProps, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
export default DialogTitleBarTitle;
|
|
@@ -0,0 +1,47 @@
|
|
|
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.DialogTitleBarTitle = 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 theming_1 = require("@storybook/theming");
|
|
36
|
+
require("@itwin/itwinui-css/css/dialog.css");
|
|
37
|
+
/**
|
|
38
|
+
* Dialog title bar. Recommended to be used as a child of `Dialog`.
|
|
39
|
+
* @example
|
|
40
|
+
* <Dialog.TitleBar>My dialog title</Dialog.TitleBar>
|
|
41
|
+
*/
|
|
42
|
+
exports.DialogTitleBarTitle = react_1.default.forwardRef(function (props, ref) {
|
|
43
|
+
var children = props.children, className = props.className, rest = __rest(props, ["children", "className"]);
|
|
44
|
+
(0, theming_1.useTheme)();
|
|
45
|
+
return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-dialog-title', className), ref: ref }, rest), children));
|
|
46
|
+
});
|
|
47
|
+
exports.default = exports.DialogTitleBarTitle;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { Dialog } from './Dialog';
|
|
2
|
+
export type { DialogProps } from './Dialog';
|
|
3
|
+
export type { DialogMainProps } from './DialogMain';
|
|
4
|
+
export type { DialogTitleBarProps } from './DialogTitleBar';
|
|
5
|
+
export type { DialogContentProps } from './DialogContent';
|
|
6
|
+
export type { DialogButtonBarProps } from './DialogButtonBar';
|
|
7
|
+
declare const _default: "./Dialog";
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Dialog = 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 Dialog_1 = require("./Dialog");
|
|
9
|
+
Object.defineProperty(exports, "Dialog", { enumerable: true, get: function () { return Dialog_1.Dialog; } });
|
|
10
|
+
exports.default = './Dialog';
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CommonProps } from '../utils';
|
|
3
3
|
import '@itwin/itwinui-css/css/non-ideal-state.css';
|
|
4
|
-
export declare type ErrorPageType = '401' | '403' | '404' | '500' | '502' | '503' | 'generic';
|
|
4
|
+
export declare type ErrorPageType = '300' | '301' | '302' | '303' | '304' | '305' | '307' | '308' | '401' | '403' | '404' | '408' | '500' | '502' | '503' | '504' | 'generic';
|
|
5
5
|
export declare type ErrorTypeTranslations = {
|
|
6
6
|
badGateway: string;
|
|
7
7
|
error: string;
|
|
8
8
|
forbidden: string;
|
|
9
9
|
internalServerError: string;
|
|
10
|
+
redirect?: string;
|
|
10
11
|
pageNotFound: string;
|
|
11
12
|
serviceUnavailable: string;
|
|
13
|
+
timedOut?: string;
|
|
12
14
|
unauthorized: string;
|
|
13
15
|
};
|
|
14
16
|
export declare type ErrorPageProps = {
|
|
@@ -37,6 +37,8 @@ var _500_1 = __importDefault(require("@itwin/itwinui-illustrations-react/cjs/ill
|
|
|
37
37
|
var _502_1 = __importDefault(require("@itwin/itwinui-illustrations-react/cjs/illustrations/502"));
|
|
38
38
|
var _503_1 = __importDefault(require("@itwin/itwinui-illustrations-react/cjs/illustrations/503"));
|
|
39
39
|
var Error_1 = __importDefault(require("@itwin/itwinui-illustrations-react/cjs/illustrations/Error"));
|
|
40
|
+
var Redirect_1 = __importDefault(require("@itwin/itwinui-illustrations-react/cjs/illustrations/Redirect"));
|
|
41
|
+
var TimedOut_1 = __importDefault(require("@itwin/itwinui-illustrations-react/cjs/illustrations/TimedOut"));
|
|
40
42
|
var react_1 = __importDefault(require("react"));
|
|
41
43
|
var Button_1 = require("../Buttons/Button");
|
|
42
44
|
var utils_1 = require("../utils");
|
|
@@ -50,9 +52,19 @@ require("@itwin/itwinui-css/css/non-ideal-state.css");
|
|
|
50
52
|
var ErrorPage = function (props) {
|
|
51
53
|
var errorType = props.errorType, errorName = props.errorName, errorMessage = props.errorMessage, primaryButtonHandle = props.primaryButtonHandle, primaryButtonLabel = props.primaryButtonLabel, secondaryButtonHandle = props.secondaryButtonHandle, secondaryButtonLabel = props.secondaryButtonLabel, translatedErrorMessages = props.translatedErrorMessages, className = props.className, rest = __rest(props, ["errorType", "errorName", "errorMessage", "primaryButtonHandle", "primaryButtonLabel", "secondaryButtonHandle", "secondaryButtonLabel", "translatedErrorMessages", "className"]);
|
|
52
54
|
(0, utils_1.useTheme)();
|
|
53
|
-
var defaultErrorMessages = __assign({ badGateway: 'Bad gateway', error: 'Error', forbidden: 'Forbidden', internalServerError: 'Internal server error', pageNotFound: 'Page not found', serviceUnavailable: 'Service unavailable', unauthorized: 'Unauthorized' }, translatedErrorMessages);
|
|
55
|
+
var defaultErrorMessages = __assign({ badGateway: 'Bad gateway', error: 'Error', forbidden: 'Forbidden', internalServerError: 'Internal server error', redirect: 'Redirect', pageNotFound: 'Page not found', serviceUnavailable: 'Service unavailable', timedOut: 'Timed out', unauthorized: 'Unauthorized' }, translatedErrorMessages);
|
|
54
56
|
function getErrorIcon() {
|
|
55
57
|
switch (errorType) {
|
|
58
|
+
case '300':
|
|
59
|
+
case '301':
|
|
60
|
+
case '302':
|
|
61
|
+
case '303':
|
|
62
|
+
case '304':
|
|
63
|
+
case '305':
|
|
64
|
+
case '307':
|
|
65
|
+
case '308': {
|
|
66
|
+
return react_1.default.createElement(Redirect_1.default, { className: 'iui-non-ideal-state-illustration' });
|
|
67
|
+
}
|
|
56
68
|
case '401': {
|
|
57
69
|
return react_1.default.createElement(_401_1.default, { className: 'iui-non-ideal-state-illustration' });
|
|
58
70
|
}
|
|
@@ -62,6 +74,10 @@ var ErrorPage = function (props) {
|
|
|
62
74
|
case '404': {
|
|
63
75
|
return react_1.default.createElement(_404_1.default, { className: 'iui-non-ideal-state-illustration' });
|
|
64
76
|
}
|
|
77
|
+
case '408':
|
|
78
|
+
case '504': {
|
|
79
|
+
return react_1.default.createElement(TimedOut_1.default, { className: 'iui-non-ideal-state-illustration' });
|
|
80
|
+
}
|
|
65
81
|
case '500': {
|
|
66
82
|
return react_1.default.createElement(_500_1.default, { className: 'iui-non-ideal-state-illustration' });
|
|
67
83
|
}
|
|
@@ -82,6 +98,16 @@ var ErrorPage = function (props) {
|
|
|
82
98
|
return errorName;
|
|
83
99
|
}
|
|
84
100
|
switch (errorType) {
|
|
101
|
+
case '300':
|
|
102
|
+
case '301':
|
|
103
|
+
case '302':
|
|
104
|
+
case '303':
|
|
105
|
+
case '304':
|
|
106
|
+
case '305':
|
|
107
|
+
case '307':
|
|
108
|
+
case '308': {
|
|
109
|
+
return defaultErrorMessages.redirect || '';
|
|
110
|
+
}
|
|
85
111
|
case '401': {
|
|
86
112
|
return defaultErrorMessages.unauthorized;
|
|
87
113
|
}
|
|
@@ -91,6 +117,10 @@ var ErrorPage = function (props) {
|
|
|
91
117
|
case '404': {
|
|
92
118
|
return defaultErrorMessages.pageNotFound;
|
|
93
119
|
}
|
|
120
|
+
case '408':
|
|
121
|
+
case '504': {
|
|
122
|
+
return defaultErrorMessages.timedOut || '';
|
|
123
|
+
}
|
|
94
124
|
case '500': {
|
|
95
125
|
return defaultErrorMessages.internalServerError;
|
|
96
126
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { StylingProps } from '../utils';
|
|
3
3
|
import '@itwin/itwinui-css/css/footer.css';
|
|
4
4
|
export declare type TitleTranslations = {
|
|
@@ -19,6 +19,11 @@ export declare type FooterProps = {
|
|
|
19
19
|
* Provide localized strings.
|
|
20
20
|
*/
|
|
21
21
|
translatedTitles?: TitleTranslations;
|
|
22
|
+
/**
|
|
23
|
+
* Custom footer content. If provided, it will render only what you passed.
|
|
24
|
+
* Use `defaultFooterElements` to get the default footer elements.
|
|
25
|
+
*/
|
|
26
|
+
children?: React.ReactNode;
|
|
22
27
|
} & StylingProps;
|
|
23
28
|
export declare type FooterElement = {
|
|
24
29
|
/**
|
|
@@ -34,6 +39,7 @@ export declare type FooterElement = {
|
|
|
34
39
|
*/
|
|
35
40
|
key?: keyof TitleTranslations | 'copyright' | (string & Record<never, never>);
|
|
36
41
|
};
|
|
42
|
+
export declare const defaultFooterElements: FooterElement[];
|
|
37
43
|
/**
|
|
38
44
|
* Footer element with all needed legal and info links.
|
|
39
45
|
* Be sure to place it manually at the bottom of your page.
|
|
@@ -47,5 +53,13 @@ export declare type FooterElement = {
|
|
|
47
53
|
* @example <caption>Changing a url</caption>
|
|
48
54
|
* <Footer customElements={(defaultElements) => defaultElements.map(element => ({ ...element, url: element.key === 'privacy' ? customPrivacyUrl : element.url }))} />
|
|
49
55
|
*/
|
|
50
|
-
export declare const Footer: (props: FooterProps) => JSX.Element
|
|
56
|
+
export declare const Footer: ((props: FooterProps) => JSX.Element) & {
|
|
57
|
+
List: (props: Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "key" | keyof React.HTMLAttributes<HTMLUListElement>> & {
|
|
58
|
+
ref?: ((instance: HTMLUListElement | null) => void) | React.RefObject<HTMLUListElement> | null | undefined;
|
|
59
|
+
}) => JSX.Element;
|
|
60
|
+
Item: (props: Pick<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "key" | keyof React.LiHTMLAttributes<HTMLLIElement>> & {
|
|
61
|
+
ref?: ((instance: HTMLLIElement | null) => void) | React.RefObject<HTMLLIElement> | null | undefined;
|
|
62
|
+
}) => JSX.Element;
|
|
63
|
+
Separator: (props: import("./FooterSeparator").FooterSeparatorProps) => JSX.Element;
|
|
64
|
+
};
|
|
51
65
|
export default Footer;
|