@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.
Files changed (142) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/cjs/core/Backdrop/Backdrop.d.ts +10 -0
  3. package/cjs/core/Backdrop/Backdrop.js +41 -0
  4. package/cjs/core/Backdrop/index.d.ts +2 -0
  5. package/cjs/core/Backdrop/index.js +9 -0
  6. package/cjs/core/Breadcrumbs/Breadcrumbs.js +18 -18
  7. package/cjs/core/ButtonGroup/ButtonGroup.js +11 -4
  8. package/cjs/core/ComboBox/ComboBox.js +15 -14
  9. package/cjs/core/Dialog/Dialog.d.ts +41 -0
  10. package/cjs/core/Dialog/Dialog.js +59 -0
  11. package/cjs/core/Dialog/DialogBackdrop.d.ts +12 -0
  12. package/cjs/core/Dialog/DialogBackdrop.js +61 -0
  13. package/cjs/core/Dialog/DialogButtonBar.d.ts +18 -0
  14. package/cjs/core/Dialog/DialogButtonBar.js +50 -0
  15. package/cjs/core/Dialog/DialogContent.d.ts +17 -0
  16. package/cjs/core/Dialog/DialogContent.js +49 -0
  17. package/cjs/core/Dialog/DialogContext.d.ts +39 -0
  18. package/cjs/core/Dialog/DialogContext.js +16 -0
  19. package/cjs/core/Dialog/DialogMain.d.ts +36 -0
  20. package/cjs/core/Dialog/DialogMain.js +120 -0
  21. package/cjs/core/Dialog/DialogTitleBar.d.ts +34 -0
  22. package/cjs/core/Dialog/DialogTitleBar.js +69 -0
  23. package/cjs/core/Dialog/DialogTitleBarTitle.d.ts +15 -0
  24. package/cjs/core/Dialog/DialogTitleBarTitle.js +47 -0
  25. package/cjs/core/Dialog/index.d.ts +8 -0
  26. package/cjs/core/Dialog/index.js +10 -0
  27. package/cjs/core/Footer/Footer.d.ts +16 -2
  28. package/cjs/core/Footer/Footer.js +57 -45
  29. package/cjs/core/Footer/FooterItem.d.ts +8 -0
  30. package/cjs/core/Footer/FooterItem.js +46 -0
  31. package/cjs/core/Footer/FooterList.d.ts +8 -0
  32. package/cjs/core/Footer/FooterList.js +46 -0
  33. package/cjs/core/Footer/FooterSeparator.d.ts +8 -0
  34. package/cjs/core/Footer/FooterSeparator.js +46 -0
  35. package/cjs/core/Footer/index.d.ts +1 -1
  36. package/cjs/core/Footer/index.js +2 -1
  37. package/cjs/core/Modal/Modal.d.ts +4 -14
  38. package/cjs/core/Modal/Modal.js +9 -74
  39. package/cjs/core/Modal/ModalButtonBar.d.ts +1 -2
  40. package/cjs/core/Modal/ModalButtonBar.js +2 -39
  41. package/cjs/core/Modal/ModalContent.d.ts +1 -2
  42. package/cjs/core/Modal/ModalContent.js +2 -39
  43. package/cjs/core/Slider/Slider.d.ts +10 -0
  44. package/cjs/core/Slider/Slider.js +20 -14
  45. package/cjs/core/Slider/Thumb.d.ts +2 -1
  46. package/cjs/core/Slider/Thumb.js +5 -3
  47. package/cjs/core/Slider/Track.d.ts +2 -1
  48. package/cjs/core/Slider/Track.js +23 -4
  49. package/cjs/core/Table/Table.d.ts +24 -0
  50. package/cjs/core/Table/Table.js +12 -4
  51. package/cjs/core/Table/TableRowMemoized.d.ts +2 -0
  52. package/cjs/core/Table/TableRowMemoized.js +2 -2
  53. package/cjs/core/Table/columns/actionColumn.d.ts +8 -3
  54. package/cjs/core/Table/columns/actionColumn.js +33 -2
  55. package/cjs/core/Table/hooks/index.d.ts +1 -0
  56. package/cjs/core/Table/hooks/index.js +3 -1
  57. package/cjs/core/Table/hooks/useScrollToRow.d.ts +11 -0
  58. package/cjs/core/Table/hooks/useScrollToRow.js +49 -0
  59. package/cjs/core/Tree/Tree.d.ts +9 -0
  60. package/cjs/core/Tree/Tree.js +67 -19
  61. package/cjs/core/Tree/TreeContext.d.ts +4 -0
  62. package/cjs/core/Tree/TreeNode.js +8 -9
  63. package/cjs/core/Typography/Small/Small.js +1 -1
  64. package/cjs/core/index.d.ts +3 -1
  65. package/cjs/core/index.js +6 -3
  66. package/cjs/core/utils/components/FocusTrap.js +1 -1
  67. package/cjs/core/utils/components/MiddleTextTruncation.js +1 -1
  68. package/cjs/core/utils/hooks/index.d.ts +1 -0
  69. package/cjs/core/utils/hooks/index.js +1 -0
  70. package/cjs/core/utils/hooks/useLatestRef.d.ts +9 -0
  71. package/cjs/core/utils/hooks/useLatestRef.js +26 -0
  72. package/esm/core/Backdrop/Backdrop.d.ts +10 -0
  73. package/esm/core/Backdrop/Backdrop.js +35 -0
  74. package/esm/core/Backdrop/index.d.ts +2 -0
  75. package/esm/core/Backdrop/index.js +5 -0
  76. package/esm/core/Breadcrumbs/Breadcrumbs.js +18 -18
  77. package/esm/core/ButtonGroup/ButtonGroup.js +11 -4
  78. package/esm/core/ComboBox/ComboBox.js +16 -15
  79. package/esm/core/Dialog/Dialog.d.ts +41 -0
  80. package/esm/core/Dialog/Dialog.js +53 -0
  81. package/esm/core/Dialog/DialogBackdrop.d.ts +12 -0
  82. package/esm/core/Dialog/DialogBackdrop.js +55 -0
  83. package/esm/core/Dialog/DialogButtonBar.d.ts +18 -0
  84. package/esm/core/Dialog/DialogButtonBar.js +44 -0
  85. package/esm/core/Dialog/DialogContent.d.ts +17 -0
  86. package/esm/core/Dialog/DialogContent.js +43 -0
  87. package/esm/core/Dialog/DialogContext.d.ts +39 -0
  88. package/esm/core/Dialog/DialogContext.js +9 -0
  89. package/esm/core/Dialog/DialogMain.d.ts +36 -0
  90. package/esm/core/Dialog/DialogMain.js +114 -0
  91. package/esm/core/Dialog/DialogTitleBar.d.ts +34 -0
  92. package/esm/core/Dialog/DialogTitleBar.js +63 -0
  93. package/esm/core/Dialog/DialogTitleBarTitle.d.ts +15 -0
  94. package/esm/core/Dialog/DialogTitleBarTitle.js +41 -0
  95. package/esm/core/Dialog/index.d.ts +8 -0
  96. package/esm/core/Dialog/index.js +6 -0
  97. package/esm/core/Footer/Footer.d.ts +16 -2
  98. package/esm/core/Footer/Footer.js +56 -43
  99. package/esm/core/Footer/FooterItem.d.ts +8 -0
  100. package/esm/core/Footer/FooterItem.js +39 -0
  101. package/esm/core/Footer/FooterList.d.ts +8 -0
  102. package/esm/core/Footer/FooterList.js +39 -0
  103. package/esm/core/Footer/FooterSeparator.d.ts +8 -0
  104. package/esm/core/Footer/FooterSeparator.js +39 -0
  105. package/esm/core/Footer/index.d.ts +1 -1
  106. package/esm/core/Footer/index.js +1 -1
  107. package/esm/core/Modal/Modal.d.ts +4 -14
  108. package/esm/core/Modal/Modal.js +10 -75
  109. package/esm/core/Modal/ModalButtonBar.d.ts +1 -2
  110. package/esm/core/Modal/ModalButtonBar.js +2 -35
  111. package/esm/core/Modal/ModalContent.d.ts +1 -2
  112. package/esm/core/Modal/ModalContent.js +2 -35
  113. package/esm/core/Slider/Slider.d.ts +10 -0
  114. package/esm/core/Slider/Slider.js +20 -14
  115. package/esm/core/Slider/Thumb.d.ts +2 -1
  116. package/esm/core/Slider/Thumb.js +5 -3
  117. package/esm/core/Slider/Track.d.ts +2 -1
  118. package/esm/core/Slider/Track.js +23 -4
  119. package/esm/core/Table/Table.d.ts +24 -0
  120. package/esm/core/Table/Table.js +13 -5
  121. package/esm/core/Table/TableRowMemoized.d.ts +2 -0
  122. package/esm/core/Table/TableRowMemoized.js +2 -2
  123. package/esm/core/Table/columns/actionColumn.d.ts +8 -3
  124. package/esm/core/Table/columns/actionColumn.js +33 -2
  125. package/esm/core/Table/hooks/index.d.ts +1 -0
  126. package/esm/core/Table/hooks/index.js +1 -0
  127. package/esm/core/Table/hooks/useScrollToRow.d.ts +11 -0
  128. package/esm/core/Table/hooks/useScrollToRow.js +42 -0
  129. package/esm/core/Tree/Tree.d.ts +9 -0
  130. package/esm/core/Tree/Tree.js +68 -20
  131. package/esm/core/Tree/TreeContext.d.ts +4 -0
  132. package/esm/core/Tree/TreeNode.js +8 -9
  133. package/esm/core/Typography/Small/Small.js +1 -1
  134. package/esm/core/index.d.ts +3 -1
  135. package/esm/core/index.js +2 -1
  136. package/esm/core/utils/components/FocusTrap.js +1 -1
  137. package/esm/core/utils/components/MiddleTextTruncation.js +1 -1
  138. package/esm/core/utils/hooks/index.d.ts +1 -0
  139. package/esm/core/utils/hooks/index.js +1 -0
  140. package/esm/core/utils/hooks/useLatestRef.d.ts +9 -0
  141. package/esm/core/utils/hooks/useLatestRef.js +19 -0
  142. package/package.json +6 -5
@@ -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 utils_1 = require("../utils");
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, utils_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 utils_1 = require("../utils");
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, utils_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,4 +1,4 @@
1
- /// <reference types="react" />
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;
@@ -34,7 +34,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
34
34
  return (mod && mod.__esModule) ? mod : { "default": mod };
35
35
  };
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.Footer = void 0;
37
+ exports.Footer = exports.defaultFooterElements = void 0;
38
38
  /*---------------------------------------------------------------------------------------------
39
39
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
40
40
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -43,6 +43,9 @@ var react_1 = __importDefault(require("react"));
43
43
  var classnames_1 = __importDefault(require("classnames"));
44
44
  var utils_1 = require("../utils");
45
45
  require("@itwin/itwinui-css/css/footer.css");
46
+ var FooterItem_1 = require("./FooterItem");
47
+ var FooterSeparator_1 = require("./FooterSeparator");
48
+ var FooterList_1 = require("./FooterList");
46
49
  var footerTranslations = {
47
50
  cookies: 'Cookies',
48
51
  legalNotices: 'Legal notices',
@@ -50,6 +53,37 @@ var footerTranslations = {
50
53
  termsOfService: 'Terms of service',
51
54
  termsOfUse: 'Terms of use',
52
55
  };
56
+ exports.defaultFooterElements = [
57
+ {
58
+ key: 'copyright',
59
+ title: "\u00A9 ".concat(new Date().getFullYear(), " Bentley Systems, Incorporated"),
60
+ },
61
+ {
62
+ key: 'termsOfService',
63
+ title: footerTranslations.termsOfService,
64
+ url: 'https://connect-agreementportal.bentley.com/AgreementApp/Home/Eula/view/readonly/BentleyConnect',
65
+ },
66
+ {
67
+ key: 'privacy',
68
+ title: footerTranslations.privacy,
69
+ url: 'https://www.bentley.com/en/privacy-policy',
70
+ },
71
+ {
72
+ key: 'termsOfUse',
73
+ title: footerTranslations.termsOfUse,
74
+ url: 'https://www.bentley.com/en/terms-of-use-and-select-online-agreement',
75
+ },
76
+ {
77
+ key: 'cookies',
78
+ title: footerTranslations.cookies,
79
+ url: 'https://www.bentley.com/en/cookie-policy',
80
+ },
81
+ {
82
+ key: 'legalNotices',
83
+ title: footerTranslations.legalNotices,
84
+ url: 'https://connect.bentley.com/Legal',
85
+ },
86
+ ];
53
87
  /**
54
88
  * Footer element with all needed legal and info links.
55
89
  * Be sure to place it manually at the bottom of your page.
@@ -63,54 +97,32 @@ var footerTranslations = {
63
97
  * @example <caption>Changing a url</caption>
64
98
  * <Footer customElements={(defaultElements) => defaultElements.map(element => ({ ...element, url: element.key === 'privacy' ? customPrivacyUrl : element.url }))} />
65
99
  */
66
- var Footer = function (props) {
67
- var customElements = props.customElements, translatedTitles = props.translatedTitles, className = props.className, rest = __rest(props, ["customElements", "translatedTitles", "className"]);
100
+ exports.Footer = Object.assign(function (props) {
101
+ var children = props.children, customElements = props.customElements, translatedTitles = props.translatedTitles, className = props.className, rest = __rest(props, ["children", "customElements", "translatedTitles", "className"]);
68
102
  (0, utils_1.useTheme)();
69
103
  var titles = __assign(__assign({}, footerTranslations), translatedTitles);
70
- var defaultElements = [
71
- {
72
- key: 'copyright',
73
- title: "\u00A9 ".concat(new Date().getFullYear(), " Bentley Systems, Incorporated"),
74
- },
75
- {
76
- key: 'termsOfService',
77
- title: titles.termsOfService,
78
- url: 'https://connect-agreementportal.bentley.com/AgreementApp/Home/Eula/view/readonly/BentleyConnect',
79
- },
80
- {
81
- key: 'privacy',
82
- title: titles.privacy,
83
- url: 'https://www.bentley.com/en/privacy-policy',
84
- },
85
- {
86
- key: 'termsOfUse',
87
- title: titles.termsOfUse,
88
- url: 'https://www.bentley.com/en/terms-of-use-and-select-online-agreement',
89
- },
90
- {
91
- key: 'cookies',
92
- title: titles.cookies,
93
- url: 'https://www.bentley.com/en/cookie-policy',
94
- },
95
- {
96
- key: 'legalNotices',
97
- title: titles.legalNotices,
98
- url: 'https://connect.bentley.com/Legal',
99
- },
100
- ];
101
- var elements = defaultElements;
104
+ var translatedElements = exports.defaultFooterElements.map(function (element) {
105
+ if (element.key && titles.hasOwnProperty(element.key)) {
106
+ var key = element.key;
107
+ return __assign(__assign({}, element), { title: titles[key] });
108
+ }
109
+ return element;
110
+ });
111
+ var elements = translatedElements;
102
112
  if (customElements) {
103
113
  elements =
104
114
  typeof customElements === 'function'
105
- ? customElements(defaultElements)
106
- : __spreadArray(__spreadArray([], defaultElements, true), customElements, true);
115
+ ? customElements(translatedElements)
116
+ : __spreadArray(__spreadArray([], translatedElements, true), customElements, true);
107
117
  }
108
- return (react_1.default.createElement("footer", __assign({ className: (0, classnames_1.default)('iui-legal-footer', className) }, rest),
109
- react_1.default.createElement("ul", null, elements.map(function (element, index) {
110
- return (react_1.default.createElement("li", { key: element.key || "".concat(element.title, "-").concat(index) },
111
- index > 0 && react_1.default.createElement("span", { className: 'iui-separator' }),
112
- element.url ? (react_1.default.createElement("a", { href: element.url, target: '_blank', rel: 'noreferrer' }, element.title)) : (element.title)));
113
- }))));
114
- };
115
- exports.Footer = Footer;
118
+ return (react_1.default.createElement("footer", __assign({ className: (0, classnames_1.default)('iui-legal-footer', className) }, rest), children ? (children) : (react_1.default.createElement(FooterList_1.FooterList, null, elements.map(function (element, index) {
119
+ return (react_1.default.createElement(react_1.default.Fragment, { key: element.key || "".concat(element.title, "-").concat(index) },
120
+ index > 0 && react_1.default.createElement(FooterSeparator_1.FooterSeparator, null),
121
+ react_1.default.createElement(FooterItem_1.FooterItem, null, element.url ? (react_1.default.createElement("a", { href: element.url, target: '_blank', rel: 'noreferrer' }, element.title)) : (element.title))));
122
+ })))));
123
+ }, {
124
+ List: FooterList_1.FooterList,
125
+ Item: FooterItem_1.FooterItem,
126
+ Separator: FooterSeparator_1.FooterSeparator,
127
+ });
116
128
  exports.default = exports.Footer;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import '@itwin/itwinui-css/css/footer.css';
3
+ export declare type FooterItemProps = React.ComponentPropsWithRef<'li'>;
4
+ /**
5
+ * Footer item. Recommended to use inside `Footer.List`.
6
+ */
7
+ export declare const FooterItem: (props: FooterItemProps) => JSX.Element;
8
+ export default FooterItem;
@@ -0,0 +1,46 @@
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.FooterItem = 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 utils_1 = require("../utils");
35
+ var classnames_1 = __importDefault(require("classnames"));
36
+ require("@itwin/itwinui-css/css/footer.css");
37
+ /**
38
+ * Footer item. Recommended to use inside `Footer.List`.
39
+ */
40
+ var FooterItem = function (props) {
41
+ var children = props.children, className = props.className, rest = __rest(props, ["children", "className"]);
42
+ (0, utils_1.useTheme)();
43
+ return (react_1.default.createElement("li", __assign({ className: (0, classnames_1.default)('iui-legal-footer-item', className) }, rest), children));
44
+ };
45
+ exports.FooterItem = FooterItem;
46
+ exports.default = exports.FooterItem;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import '@itwin/itwinui-css/css/footer.css';
3
+ export declare type FooterListProps = React.ComponentPropsWithRef<'ul'>;
4
+ /**
5
+ * Footer list. Recommended to use inside `Footer` with `Footer.Item` and `Footer.Separator`.
6
+ */
7
+ export declare const FooterList: (props: FooterListProps) => JSX.Element;
8
+ export default FooterList;
@@ -0,0 +1,46 @@
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.FooterList = 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 utils_1 = require("../utils");
35
+ var classnames_1 = __importDefault(require("classnames"));
36
+ require("@itwin/itwinui-css/css/footer.css");
37
+ /**
38
+ * Footer list. Recommended to use inside `Footer` with `Footer.Item` and `Footer.Separator`.
39
+ */
40
+ var FooterList = function (props) {
41
+ var className = props.className, children = props.children, rest = __rest(props, ["className", "children"]);
42
+ (0, utils_1.useTheme)();
43
+ return (react_1.default.createElement("ul", __assign({ className: (0, classnames_1.default)('iui-legal-footer-list', className) }, rest), children));
44
+ };
45
+ exports.FooterList = FooterList;
46
+ exports.default = exports.FooterList;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import '@itwin/itwinui-css/css/footer.css';
3
+ export declare type FooterSeparatorProps = Omit<React.ComponentPropsWithRef<'li'>, 'children'>;
4
+ /**
5
+ * Footer separator. Recommended to use inside `Footer.List`.
6
+ */
7
+ export declare const FooterSeparator: (props: FooterSeparatorProps) => JSX.Element;
8
+ export default FooterSeparator;