@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.
Files changed (114) hide show
  1. package/CHANGELOG.md +14 -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/Dialog/Dialog.d.ts +41 -0
  9. package/cjs/core/Dialog/Dialog.js +59 -0
  10. package/cjs/core/Dialog/DialogBackdrop.d.ts +12 -0
  11. package/cjs/core/Dialog/DialogBackdrop.js +61 -0
  12. package/cjs/core/Dialog/DialogButtonBar.d.ts +18 -0
  13. package/cjs/core/Dialog/DialogButtonBar.js +50 -0
  14. package/cjs/core/Dialog/DialogContent.d.ts +17 -0
  15. package/cjs/core/Dialog/DialogContent.js +49 -0
  16. package/cjs/core/Dialog/DialogContext.d.ts +39 -0
  17. package/cjs/core/Dialog/DialogContext.js +16 -0
  18. package/cjs/core/Dialog/DialogMain.d.ts +36 -0
  19. package/cjs/core/Dialog/DialogMain.js +120 -0
  20. package/cjs/core/Dialog/DialogTitleBar.d.ts +34 -0
  21. package/cjs/core/Dialog/DialogTitleBar.js +69 -0
  22. package/cjs/core/Dialog/DialogTitleBarTitle.d.ts +15 -0
  23. package/cjs/core/Dialog/DialogTitleBarTitle.js +47 -0
  24. package/cjs/core/Dialog/index.d.ts +8 -0
  25. package/cjs/core/Dialog/index.js +10 -0
  26. package/cjs/core/Footer/Footer.d.ts +16 -2
  27. package/cjs/core/Footer/Footer.js +57 -45
  28. package/cjs/core/Footer/FooterItem.d.ts +8 -0
  29. package/cjs/core/Footer/FooterItem.js +46 -0
  30. package/cjs/core/Footer/FooterList.d.ts +8 -0
  31. package/cjs/core/Footer/FooterList.js +46 -0
  32. package/cjs/core/Footer/FooterSeparator.d.ts +8 -0
  33. package/cjs/core/Footer/FooterSeparator.js +46 -0
  34. package/cjs/core/Footer/index.d.ts +1 -1
  35. package/cjs/core/Footer/index.js +2 -1
  36. package/cjs/core/Modal/Modal.d.ts +4 -14
  37. package/cjs/core/Modal/Modal.js +9 -74
  38. package/cjs/core/Modal/ModalButtonBar.d.ts +1 -2
  39. package/cjs/core/Modal/ModalButtonBar.js +2 -39
  40. package/cjs/core/Modal/ModalContent.d.ts +1 -2
  41. package/cjs/core/Modal/ModalContent.js +2 -39
  42. package/cjs/core/Slider/Slider.d.ts +10 -0
  43. package/cjs/core/Slider/Slider.js +20 -14
  44. package/cjs/core/Slider/Thumb.d.ts +2 -1
  45. package/cjs/core/Slider/Thumb.js +5 -3
  46. package/cjs/core/Slider/Track.d.ts +2 -1
  47. package/cjs/core/Slider/Track.js +23 -4
  48. package/cjs/core/Table/Table.d.ts +2 -1
  49. package/cjs/core/Table/Table.js +6 -1
  50. package/cjs/core/Table/columns/actionColumn.d.ts +8 -3
  51. package/cjs/core/Table/columns/actionColumn.js +33 -2
  52. package/cjs/core/Table/hooks/useScrollToRow.d.ts +1 -1
  53. package/cjs/core/Table/hooks/useScrollToRow.js +3 -3
  54. package/cjs/core/index.d.ts +3 -1
  55. package/cjs/core/index.js +6 -3
  56. package/cjs/core/utils/components/FocusTrap.js +1 -1
  57. package/cjs/core/utils/components/MiddleTextTruncation.js +1 -1
  58. package/esm/core/Backdrop/Backdrop.d.ts +10 -0
  59. package/esm/core/Backdrop/Backdrop.js +35 -0
  60. package/esm/core/Backdrop/index.d.ts +2 -0
  61. package/esm/core/Backdrop/index.js +5 -0
  62. package/esm/core/Breadcrumbs/Breadcrumbs.js +18 -18
  63. package/esm/core/ButtonGroup/ButtonGroup.js +11 -4
  64. package/esm/core/Dialog/Dialog.d.ts +41 -0
  65. package/esm/core/Dialog/Dialog.js +53 -0
  66. package/esm/core/Dialog/DialogBackdrop.d.ts +12 -0
  67. package/esm/core/Dialog/DialogBackdrop.js +55 -0
  68. package/esm/core/Dialog/DialogButtonBar.d.ts +18 -0
  69. package/esm/core/Dialog/DialogButtonBar.js +44 -0
  70. package/esm/core/Dialog/DialogContent.d.ts +17 -0
  71. package/esm/core/Dialog/DialogContent.js +43 -0
  72. package/esm/core/Dialog/DialogContext.d.ts +39 -0
  73. package/esm/core/Dialog/DialogContext.js +9 -0
  74. package/esm/core/Dialog/DialogMain.d.ts +36 -0
  75. package/esm/core/Dialog/DialogMain.js +114 -0
  76. package/esm/core/Dialog/DialogTitleBar.d.ts +34 -0
  77. package/esm/core/Dialog/DialogTitleBar.js +63 -0
  78. package/esm/core/Dialog/DialogTitleBarTitle.d.ts +15 -0
  79. package/esm/core/Dialog/DialogTitleBarTitle.js +41 -0
  80. package/esm/core/Dialog/index.d.ts +8 -0
  81. package/esm/core/Dialog/index.js +6 -0
  82. package/esm/core/Footer/Footer.d.ts +16 -2
  83. package/esm/core/Footer/Footer.js +56 -43
  84. package/esm/core/Footer/FooterItem.d.ts +8 -0
  85. package/esm/core/Footer/FooterItem.js +39 -0
  86. package/esm/core/Footer/FooterList.d.ts +8 -0
  87. package/esm/core/Footer/FooterList.js +39 -0
  88. package/esm/core/Footer/FooterSeparator.d.ts +8 -0
  89. package/esm/core/Footer/FooterSeparator.js +39 -0
  90. package/esm/core/Footer/index.d.ts +1 -1
  91. package/esm/core/Footer/index.js +1 -1
  92. package/esm/core/Modal/Modal.d.ts +4 -14
  93. package/esm/core/Modal/Modal.js +10 -75
  94. package/esm/core/Modal/ModalButtonBar.d.ts +1 -2
  95. package/esm/core/Modal/ModalButtonBar.js +2 -35
  96. package/esm/core/Modal/ModalContent.d.ts +1 -2
  97. package/esm/core/Modal/ModalContent.js +2 -35
  98. package/esm/core/Slider/Slider.d.ts +10 -0
  99. package/esm/core/Slider/Slider.js +20 -14
  100. package/esm/core/Slider/Thumb.d.ts +2 -1
  101. package/esm/core/Slider/Thumb.js +5 -3
  102. package/esm/core/Slider/Track.d.ts +2 -1
  103. package/esm/core/Slider/Track.js +23 -4
  104. package/esm/core/Table/Table.d.ts +2 -1
  105. package/esm/core/Table/Table.js +6 -1
  106. package/esm/core/Table/columns/actionColumn.d.ts +8 -3
  107. package/esm/core/Table/columns/actionColumn.js +33 -2
  108. package/esm/core/Table/hooks/useScrollToRow.d.ts +1 -1
  109. package/esm/core/Table/hooks/useScrollToRow.js +3 -3
  110. package/esm/core/index.d.ts +3 -1
  111. package/esm/core/index.js +2 -1
  112. package/esm/core/utils/components/FocusTrap.js +1 -1
  113. package/esm/core/utils/components/MiddleTextTruncation.js +1 -1
  114. package/package.json +6 -5
@@ -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,9 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import React from 'react';
6
+ export var DialogContext = React.createContext(undefined);
7
+ export var useDialogContext = function () {
8
+ return React.useContext(DialogContext) || {};
9
+ };
@@ -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,114 @@
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
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ /*---------------------------------------------------------------------------------------------
24
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
25
+ * See LICENSE.md in the project root for license terms and full copyright notice.
26
+ *--------------------------------------------------------------------------------------------*/
27
+ import React from 'react';
28
+ import cx from 'classnames';
29
+ import { FocusTrap, useMergedRefs, useTheme } from '../utils';
30
+ import '@itwin/itwinui-css/css/dialog.css';
31
+ import { useDialogContext } from './DialogContext';
32
+ import { CSSTransition } from 'react-transition-group';
33
+ /**
34
+ * Dialog component which can wrap any content.
35
+ * @example
36
+ * <Dialog.Main>
37
+ * <Dialog.TitleBar>
38
+ * My dialog title
39
+ * </Dialog.TitleBar>
40
+ * <Dialog.Content>
41
+ * Here is my dialog content
42
+ * </Dialog.Content>
43
+ * <Dialog.ButtonBar>
44
+ * <Button styleType='high-visibility'>
45
+ * Primary button
46
+ * </Button>
47
+ * <Button>
48
+ * Secondary button
49
+ * </Button>
50
+ * </Dialog.ButtonBar>
51
+ * </Dialog.Main>
52
+ */
53
+ export var DialogMain = React.forwardRef(function (props, ref) {
54
+ var dialogContext = useDialogContext();
55
+ 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"]);
56
+ useTheme();
57
+ var dialogRef = React.useRef(null);
58
+ var refs = useMergedRefs(dialogRef, ref);
59
+ // Focuses dialog when opened and brings back focus to the previously focused element when closed.
60
+ var previousFocusedElement = React.useRef();
61
+ React.useEffect(function () {
62
+ var _a, _b, _c;
63
+ if (isOpen) {
64
+ previousFocusedElement.current = (_a = dialogRef.current) === null || _a === void 0 ? void 0 : _a.ownerDocument.activeElement;
65
+ (_b = dialogRef.current) === null || _b === void 0 ? void 0 : _b.focus();
66
+ }
67
+ else {
68
+ (_c = previousFocusedElement.current) === null || _c === void 0 ? void 0 : _c.focus();
69
+ }
70
+ var ref = dialogRef.current;
71
+ return function () {
72
+ var _a;
73
+ (ref === null || ref === void 0 ? void 0 : ref.contains(document.activeElement)) &&
74
+ ((_a = previousFocusedElement.current) === null || _a === void 0 ? void 0 : _a.focus());
75
+ };
76
+ }, [isOpen]);
77
+ // Prevents document from scrolling when the dialog is open.
78
+ var originalBodyOverflow = React.useRef('');
79
+ React.useEffect(function () {
80
+ var _a;
81
+ var ownerDocument = (_a = dialogRef.current) === null || _a === void 0 ? void 0 : _a.ownerDocument;
82
+ if (!ownerDocument || !preventDocumentScroll) {
83
+ return;
84
+ }
85
+ if (isOpen) {
86
+ originalBodyOverflow.current = ownerDocument.body.style.overflow;
87
+ ownerDocument.body.style.overflow = 'hidden';
88
+ }
89
+ else {
90
+ ownerDocument.body.style.overflow = originalBodyOverflow.current;
91
+ }
92
+ return function () {
93
+ ownerDocument.body.style.overflow = originalBodyOverflow.current;
94
+ };
95
+ }, [isOpen, preventDocumentScroll]);
96
+ var handleKeyDown = function (event) {
97
+ // Prevents React from resetting its properties
98
+ event.persist();
99
+ if (isDismissible && closeOnEsc && event.key === 'Escape' && onClose) {
100
+ onClose(event);
101
+ }
102
+ onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
103
+ };
104
+ var content = (React.createElement("div", __assign({ className: cx('iui-dialog', {
105
+ 'iui-dialog-default': styleType === 'default',
106
+ 'iui-dialog-full-page': styleType === 'fullPage',
107
+ 'iui-dialog-visible': isOpen,
108
+ }, className), role: 'dialog', ref: refs, onKeyDown: handleKeyDown, tabIndex: -1 }, rest), children));
109
+ return (React.createElement(CSSTransition, { in: isOpen, classNames: 'iui-dialog-animation', timeout: { exit: 600 }, unmountOnExit: true, nodeRef: dialogRef },
110
+ React.createElement(React.Fragment, null,
111
+ trapFocus && React.createElement(FocusTrap, null, content),
112
+ !trapFocus && content)));
113
+ });
114
+ export default 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,63 @@
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
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ /*---------------------------------------------------------------------------------------------
24
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
25
+ * See LICENSE.md in the project root for license terms and full copyright notice.
26
+ *--------------------------------------------------------------------------------------------*/
27
+ import React from 'react';
28
+ import cx from 'classnames';
29
+ import SvgClose from '@itwin/itwinui-icons-react/cjs/icons/Close';
30
+ import { useTheme } from '@storybook/theming';
31
+ import { IconButton } from '../Buttons';
32
+ import '@itwin/itwinui-css/css/dialog.css';
33
+ import { useDialogContext } from './DialogContext';
34
+ import { DialogTitleBarTitle } from './DialogTitleBarTitle';
35
+ /**
36
+ * Dialog title bar. Recommended to be used as a child of `Dialog`.
37
+ * @example
38
+ * <Dialog.TitleBar title='My dialog title' />
39
+ * @example
40
+ * <Dialog.TitleBar>
41
+ * <Dialog.TitleBar.Title>My dialog title</Dialog.TitleBar.Title>
42
+ * <IconButton
43
+ * size='small'
44
+ * styleType='borderless'
45
+ * onClick={onClose}
46
+ * aria-label='Close'
47
+ * >
48
+ * <SvgClose />
49
+ * </IconButton>
50
+ * </Dialog.TitleBar>
51
+ */
52
+ export var DialogTitleBar = Object.assign(React.forwardRef(function (props, ref) {
53
+ var dialogContext = useDialogContext();
54
+ 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"]);
55
+ useTheme();
56
+ return (React.createElement("div", __assign({ className: cx('iui-dialog-title-bar', className), ref: ref }, rest), children ? (children) : (React.createElement(React.Fragment, null,
57
+ React.createElement(DialogTitleBarTitle, null, titleText),
58
+ isDismissible && (React.createElement(IconButton, { size: 'small', styleType: 'borderless', onClick: onClose, "aria-label": 'Close' },
59
+ React.createElement(SvgClose, null)))))));
60
+ }), {
61
+ Title: DialogTitleBarTitle,
62
+ });
63
+ export default 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,41 @@
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
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ /*---------------------------------------------------------------------------------------------
24
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
25
+ * See LICENSE.md in the project root for license terms and full copyright notice.
26
+ *--------------------------------------------------------------------------------------------*/
27
+ import React from 'react';
28
+ import cx from 'classnames';
29
+ import { useTheme } from '@storybook/theming';
30
+ import '@itwin/itwinui-css/css/dialog.css';
31
+ /**
32
+ * Dialog title bar. Recommended to be used as a child of `Dialog`.
33
+ * @example
34
+ * <Dialog.TitleBar>My dialog title</Dialog.TitleBar>
35
+ */
36
+ export var DialogTitleBarTitle = React.forwardRef(function (props, ref) {
37
+ var children = props.children, className = props.className, rest = __rest(props, ["children", "className"]);
38
+ useTheme();
39
+ return (React.createElement("div", __assign({ className: cx('iui-dialog-title', className), ref: ref }, rest), children));
40
+ });
41
+ export default 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,6 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ export { Dialog } from './Dialog';
6
+ export 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;
@@ -37,6 +37,9 @@ import React from 'react';
37
37
  import cx from 'classnames';
38
38
  import { useTheme } from '../utils';
39
39
  import '@itwin/itwinui-css/css/footer.css';
40
+ import { FooterItem } from './FooterItem';
41
+ import { FooterSeparator } from './FooterSeparator';
42
+ import { FooterList } from './FooterList';
40
43
  var footerTranslations = {
41
44
  cookies: 'Cookies',
42
45
  legalNotices: 'Legal notices',
@@ -44,6 +47,37 @@ var footerTranslations = {
44
47
  termsOfService: 'Terms of service',
45
48
  termsOfUse: 'Terms of use',
46
49
  };
50
+ export var defaultFooterElements = [
51
+ {
52
+ key: 'copyright',
53
+ title: "\u00A9 ".concat(new Date().getFullYear(), " Bentley Systems, Incorporated"),
54
+ },
55
+ {
56
+ key: 'termsOfService',
57
+ title: footerTranslations.termsOfService,
58
+ url: 'https://connect-agreementportal.bentley.com/AgreementApp/Home/Eula/view/readonly/BentleyConnect',
59
+ },
60
+ {
61
+ key: 'privacy',
62
+ title: footerTranslations.privacy,
63
+ url: 'https://www.bentley.com/en/privacy-policy',
64
+ },
65
+ {
66
+ key: 'termsOfUse',
67
+ title: footerTranslations.termsOfUse,
68
+ url: 'https://www.bentley.com/en/terms-of-use-and-select-online-agreement',
69
+ },
70
+ {
71
+ key: 'cookies',
72
+ title: footerTranslations.cookies,
73
+ url: 'https://www.bentley.com/en/cookie-policy',
74
+ },
75
+ {
76
+ key: 'legalNotices',
77
+ title: footerTranslations.legalNotices,
78
+ url: 'https://connect.bentley.com/Legal',
79
+ },
80
+ ];
47
81
  /**
48
82
  * Footer element with all needed legal and info links.
49
83
  * Be sure to place it manually at the bottom of your page.
@@ -57,53 +91,32 @@ var footerTranslations = {
57
91
  * @example <caption>Changing a url</caption>
58
92
  * <Footer customElements={(defaultElements) => defaultElements.map(element => ({ ...element, url: element.key === 'privacy' ? customPrivacyUrl : element.url }))} />
59
93
  */
60
- export var Footer = function (props) {
61
- var customElements = props.customElements, translatedTitles = props.translatedTitles, className = props.className, rest = __rest(props, ["customElements", "translatedTitles", "className"]);
94
+ export var Footer = Object.assign(function (props) {
95
+ var children = props.children, customElements = props.customElements, translatedTitles = props.translatedTitles, className = props.className, rest = __rest(props, ["children", "customElements", "translatedTitles", "className"]);
62
96
  useTheme();
63
97
  var titles = __assign(__assign({}, footerTranslations), translatedTitles);
64
- var defaultElements = [
65
- {
66
- key: 'copyright',
67
- title: "\u00A9 ".concat(new Date().getFullYear(), " Bentley Systems, Incorporated"),
68
- },
69
- {
70
- key: 'termsOfService',
71
- title: titles.termsOfService,
72
- url: 'https://connect-agreementportal.bentley.com/AgreementApp/Home/Eula/view/readonly/BentleyConnect',
73
- },
74
- {
75
- key: 'privacy',
76
- title: titles.privacy,
77
- url: 'https://www.bentley.com/en/privacy-policy',
78
- },
79
- {
80
- key: 'termsOfUse',
81
- title: titles.termsOfUse,
82
- url: 'https://www.bentley.com/en/terms-of-use-and-select-online-agreement',
83
- },
84
- {
85
- key: 'cookies',
86
- title: titles.cookies,
87
- url: 'https://www.bentley.com/en/cookie-policy',
88
- },
89
- {
90
- key: 'legalNotices',
91
- title: titles.legalNotices,
92
- url: 'https://connect.bentley.com/Legal',
93
- },
94
- ];
95
- var elements = defaultElements;
98
+ var translatedElements = defaultFooterElements.map(function (element) {
99
+ if (element.key && titles.hasOwnProperty(element.key)) {
100
+ var key = element.key;
101
+ return __assign(__assign({}, element), { title: titles[key] });
102
+ }
103
+ return element;
104
+ });
105
+ var elements = translatedElements;
96
106
  if (customElements) {
97
107
  elements =
98
108
  typeof customElements === 'function'
99
- ? customElements(defaultElements)
100
- : __spreadArray(__spreadArray([], defaultElements, true), customElements, true);
109
+ ? customElements(translatedElements)
110
+ : __spreadArray(__spreadArray([], translatedElements, true), customElements, true);
101
111
  }
102
- return (React.createElement("footer", __assign({ className: cx('iui-legal-footer', className) }, rest),
103
- React.createElement("ul", null, elements.map(function (element, index) {
104
- return (React.createElement("li", { key: element.key || "".concat(element.title, "-").concat(index) },
105
- index > 0 && React.createElement("span", { className: 'iui-separator' }),
106
- element.url ? (React.createElement("a", { href: element.url, target: '_blank', rel: 'noreferrer' }, element.title)) : (element.title)));
107
- }))));
108
- };
112
+ return (React.createElement("footer", __assign({ className: cx('iui-legal-footer', className) }, rest), children ? (children) : (React.createElement(FooterList, null, elements.map(function (element, index) {
113
+ return (React.createElement(React.Fragment, { key: element.key || "".concat(element.title, "-").concat(index) },
114
+ index > 0 && React.createElement(FooterSeparator, null),
115
+ React.createElement(FooterItem, null, element.url ? (React.createElement("a", { href: element.url, target: '_blank', rel: 'noreferrer' }, element.title)) : (element.title))));
116
+ })))));
117
+ }, {
118
+ List: FooterList,
119
+ Item: FooterItem,
120
+ Separator: FooterSeparator,
121
+ });
109
122
  export default 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,39 @@
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
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ /*---------------------------------------------------------------------------------------------
24
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
25
+ * See LICENSE.md in the project root for license terms and full copyright notice.
26
+ *--------------------------------------------------------------------------------------------*/
27
+ import React from 'react';
28
+ import { useTheme } from '../utils';
29
+ import cx from 'classnames';
30
+ import '@itwin/itwinui-css/css/footer.css';
31
+ /**
32
+ * Footer item. Recommended to use inside `Footer.List`.
33
+ */
34
+ export var FooterItem = function (props) {
35
+ var children = props.children, className = props.className, rest = __rest(props, ["children", "className"]);
36
+ useTheme();
37
+ return (React.createElement("li", __assign({ className: cx('iui-legal-footer-item', className) }, rest), children));
38
+ };
39
+ export default 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,39 @@
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
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ /*---------------------------------------------------------------------------------------------
24
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
25
+ * See LICENSE.md in the project root for license terms and full copyright notice.
26
+ *--------------------------------------------------------------------------------------------*/
27
+ import React from 'react';
28
+ import { useTheme } from '../utils';
29
+ import cx from 'classnames';
30
+ import '@itwin/itwinui-css/css/footer.css';
31
+ /**
32
+ * Footer list. Recommended to use inside `Footer` with `Footer.Item` and `Footer.Separator`.
33
+ */
34
+ export var FooterList = function (props) {
35
+ var className = props.className, children = props.children, rest = __rest(props, ["className", "children"]);
36
+ useTheme();
37
+ return (React.createElement("ul", __assign({ className: cx('iui-legal-footer-list', className) }, rest), children));
38
+ };
39
+ export default 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;