@itwin/itwinui-react 1.42.0 → 1.44.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 +30 -0
- package/cjs/core/Backdrop/Backdrop.d.ts +10 -0
- package/cjs/core/Backdrop/Backdrop.js +41 -0
- package/cjs/core/Backdrop/index.d.ts +2 -0
- package/cjs/core/Backdrop/index.js +9 -0
- package/cjs/core/Breadcrumbs/Breadcrumbs.js +18 -18
- package/cjs/core/ButtonGroup/ButtonGroup.js +11 -4
- package/cjs/core/Dialog/Dialog.d.ts +41 -0
- package/cjs/core/Dialog/Dialog.js +59 -0
- package/cjs/core/Dialog/DialogBackdrop.d.ts +12 -0
- package/cjs/core/Dialog/DialogBackdrop.js +61 -0
- package/cjs/core/Dialog/DialogButtonBar.d.ts +18 -0
- package/cjs/core/Dialog/DialogButtonBar.js +50 -0
- package/cjs/core/Dialog/DialogContent.d.ts +17 -0
- package/cjs/core/Dialog/DialogContent.js +49 -0
- package/cjs/core/Dialog/DialogContext.d.ts +39 -0
- package/cjs/core/Dialog/DialogContext.js +16 -0
- package/cjs/core/Dialog/DialogMain.d.ts +36 -0
- package/cjs/core/Dialog/DialogMain.js +120 -0
- package/cjs/core/Dialog/DialogTitleBar.d.ts +34 -0
- package/cjs/core/Dialog/DialogTitleBar.js +69 -0
- package/cjs/core/Dialog/DialogTitleBarTitle.d.ts +15 -0
- package/cjs/core/Dialog/DialogTitleBarTitle.js +47 -0
- package/cjs/core/Dialog/index.d.ts +8 -0
- package/cjs/core/Dialog/index.js +10 -0
- package/cjs/core/Footer/Footer.d.ts +16 -2
- package/cjs/core/Footer/Footer.js +57 -45
- package/cjs/core/Footer/FooterItem.d.ts +8 -0
- package/cjs/core/Footer/FooterItem.js +46 -0
- package/cjs/core/Footer/FooterList.d.ts +8 -0
- package/cjs/core/Footer/FooterList.js +46 -0
- package/cjs/core/Footer/FooterSeparator.d.ts +8 -0
- package/cjs/core/Footer/FooterSeparator.js +46 -0
- package/cjs/core/Footer/index.d.ts +1 -1
- package/cjs/core/Footer/index.js +2 -1
- package/cjs/core/Menu/Menu.js +0 -3
- package/cjs/core/Modal/Modal.d.ts +4 -14
- package/cjs/core/Modal/Modal.js +9 -74
- package/cjs/core/Modal/ModalButtonBar.d.ts +1 -2
- package/cjs/core/Modal/ModalButtonBar.js +2 -39
- package/cjs/core/Modal/ModalContent.d.ts +1 -2
- package/cjs/core/Modal/ModalContent.js +2 -39
- package/cjs/core/Select/Select.d.ts +23 -8
- package/cjs/core/Select/Select.js +82 -25
- package/cjs/core/Select/SelectTag.d.ts +15 -0
- package/cjs/core/Select/SelectTag.js +48 -0
- package/cjs/core/Select/index.d.ts +1 -1
- package/cjs/core/Slider/Slider.d.ts +10 -0
- package/cjs/core/Slider/Slider.js +20 -14
- package/cjs/core/Slider/Thumb.d.ts +2 -1
- package/cjs/core/Slider/Thumb.js +5 -3
- package/cjs/core/Slider/Track.d.ts +2 -1
- package/cjs/core/Slider/Track.js +23 -4
- package/cjs/core/Table/Table.d.ts +2 -1
- package/cjs/core/Table/Table.js +8 -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/useScrollToRow.d.ts +1 -1
- package/cjs/core/Table/hooks/useScrollToRow.js +3 -3
- package/cjs/core/index.d.ts +4 -2
- 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/useOverflow.js +4 -1
- package/esm/core/Backdrop/Backdrop.d.ts +10 -0
- package/esm/core/Backdrop/Backdrop.js +35 -0
- package/esm/core/Backdrop/index.d.ts +2 -0
- package/esm/core/Backdrop/index.js +5 -0
- package/esm/core/Breadcrumbs/Breadcrumbs.js +18 -18
- package/esm/core/ButtonGroup/ButtonGroup.js +11 -4
- package/esm/core/Dialog/Dialog.d.ts +41 -0
- package/esm/core/Dialog/Dialog.js +53 -0
- package/esm/core/Dialog/DialogBackdrop.d.ts +12 -0
- package/esm/core/Dialog/DialogBackdrop.js +55 -0
- package/esm/core/Dialog/DialogButtonBar.d.ts +18 -0
- package/esm/core/Dialog/DialogButtonBar.js +44 -0
- package/esm/core/Dialog/DialogContent.d.ts +17 -0
- package/esm/core/Dialog/DialogContent.js +43 -0
- package/esm/core/Dialog/DialogContext.d.ts +39 -0
- package/esm/core/Dialog/DialogContext.js +9 -0
- package/esm/core/Dialog/DialogMain.d.ts +36 -0
- package/esm/core/Dialog/DialogMain.js +114 -0
- package/esm/core/Dialog/DialogTitleBar.d.ts +34 -0
- package/esm/core/Dialog/DialogTitleBar.js +63 -0
- package/esm/core/Dialog/DialogTitleBarTitle.d.ts +15 -0
- package/esm/core/Dialog/DialogTitleBarTitle.js +41 -0
- package/esm/core/Dialog/index.d.ts +8 -0
- package/esm/core/Dialog/index.js +6 -0
- package/esm/core/Footer/Footer.d.ts +16 -2
- package/esm/core/Footer/Footer.js +56 -43
- package/esm/core/Footer/FooterItem.d.ts +8 -0
- package/esm/core/Footer/FooterItem.js +39 -0
- package/esm/core/Footer/FooterList.d.ts +8 -0
- package/esm/core/Footer/FooterList.js +39 -0
- package/esm/core/Footer/FooterSeparator.d.ts +8 -0
- package/esm/core/Footer/FooterSeparator.js +39 -0
- package/esm/core/Footer/index.d.ts +1 -1
- package/esm/core/Footer/index.js +1 -1
- package/esm/core/Menu/Menu.js +0 -3
- package/esm/core/Modal/Modal.d.ts +4 -14
- package/esm/core/Modal/Modal.js +10 -75
- package/esm/core/Modal/ModalButtonBar.d.ts +1 -2
- package/esm/core/Modal/ModalButtonBar.js +2 -35
- package/esm/core/Modal/ModalContent.d.ts +1 -2
- package/esm/core/Modal/ModalContent.js +2 -35
- package/esm/core/Select/Select.d.ts +23 -8
- package/esm/core/Select/Select.js +83 -26
- package/esm/core/Select/SelectTag.d.ts +15 -0
- package/esm/core/Select/SelectTag.js +41 -0
- package/esm/core/Select/index.d.ts +1 -1
- package/esm/core/Slider/Slider.d.ts +10 -0
- package/esm/core/Slider/Slider.js +20 -14
- package/esm/core/Slider/Thumb.d.ts +2 -1
- package/esm/core/Slider/Thumb.js +5 -3
- package/esm/core/Slider/Track.d.ts +2 -1
- package/esm/core/Slider/Track.js +23 -4
- package/esm/core/Table/Table.d.ts +2 -1
- package/esm/core/Table/Table.js +8 -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/useScrollToRow.d.ts +1 -1
- package/esm/core/Table/hooks/useScrollToRow.js +3 -3
- package/esm/core/index.d.ts +4 -2
- 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/useOverflow.js +4 -1
- package/package.json +6 -5
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '@itwin/itwinui-css/css/dialog.css';
|
|
3
|
+
import { DialogContextProps } from './DialogContext';
|
|
4
|
+
export declare type DialogProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Dialog content.
|
|
7
|
+
*/
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
} & DialogContextProps;
|
|
10
|
+
/**
|
|
11
|
+
* Dialog component.
|
|
12
|
+
* @example
|
|
13
|
+
* <Dialog
|
|
14
|
+
* isOpen={isOpen}
|
|
15
|
+
* onClose={() => setIsOpen(false)}
|
|
16
|
+
* trapFocus
|
|
17
|
+
* preventDocumentScroll
|
|
18
|
+
* >
|
|
19
|
+
* <Dialog.Backdrop />
|
|
20
|
+
* <Dialog.Main aria-modal>
|
|
21
|
+
* <Dialog.TitleBar>My dialog title</Dialog.TitleBar>
|
|
22
|
+
* <Dialog.Content>
|
|
23
|
+
* Here is my dialog content
|
|
24
|
+
* </Dialog.Content>
|
|
25
|
+
* <Dialog.ButtonBar>
|
|
26
|
+
* <Button styleType='high-visibility'>Confirm</Button>
|
|
27
|
+
* <Button>Close</Button>
|
|
28
|
+
* </Dialog.ButtonBar>
|
|
29
|
+
* </Dialog.Main>
|
|
30
|
+
* </Dialog>
|
|
31
|
+
*/
|
|
32
|
+
export declare const Dialog: ((props: DialogProps) => JSX.Element) & {
|
|
33
|
+
Backdrop: React.ForwardRefExoticComponent<Pick<import("./DialogBackdrop").DialogBackdropProps, "onClose" | "key" | keyof React.HTMLAttributes<HTMLDivElement> | "isVisible" | "isDismissible" | "closeOnExternalClick"> & React.RefAttributes<HTMLDivElement>>;
|
|
34
|
+
Main: React.ForwardRefExoticComponent<Pick<import("./DialogMain").DialogMainProps, "onClose" | "key" | keyof React.HTMLAttributes<HTMLDivElement> | "styleType" | "isOpen" | "isDismissible" | "closeOnEsc" | "trapFocus" | "preventDocumentScroll"> & React.RefAttributes<HTMLDivElement>>;
|
|
35
|
+
TitleBar: React.ForwardRefExoticComponent<Pick<import("./DialogTitleBar").DialogTitleBarProps, "onClose" | "key" | keyof React.HTMLAttributes<HTMLDivElement> | "isDismissible" | "titleText"> & React.RefAttributes<HTMLDivElement>> & {
|
|
36
|
+
Title: React.ForwardRefExoticComponent<Pick<import("./DialogTitleBarTitle").DialogTitleBarTitleProps, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>>;
|
|
37
|
+
};
|
|
38
|
+
Content: React.ForwardRefExoticComponent<Pick<import("./DialogContent").DialogContentProps, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>>;
|
|
39
|
+
ButtonBar: React.ForwardRefExoticComponent<Pick<import("./DialogButtonBar").DialogButtonBarProps, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>>;
|
|
40
|
+
};
|
|
41
|
+
export default Dialog;
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
import '@itwin/itwinui-css/css/dialog.css';
|
|
7
|
+
import { DialogTitleBar } from './DialogTitleBar';
|
|
8
|
+
import { DialogContent } from './DialogContent';
|
|
9
|
+
import { DialogBackdrop } from './DialogBackdrop';
|
|
10
|
+
import { DialogContext } from './DialogContext';
|
|
11
|
+
import { DialogButtonBar } from './DialogButtonBar';
|
|
12
|
+
import DialogMain from './DialogMain';
|
|
13
|
+
/**
|
|
14
|
+
* Dialog component.
|
|
15
|
+
* @example
|
|
16
|
+
* <Dialog
|
|
17
|
+
* isOpen={isOpen}
|
|
18
|
+
* onClose={() => setIsOpen(false)}
|
|
19
|
+
* trapFocus
|
|
20
|
+
* preventDocumentScroll
|
|
21
|
+
* >
|
|
22
|
+
* <Dialog.Backdrop />
|
|
23
|
+
* <Dialog.Main aria-modal>
|
|
24
|
+
* <Dialog.TitleBar>My dialog title</Dialog.TitleBar>
|
|
25
|
+
* <Dialog.Content>
|
|
26
|
+
* Here is my dialog content
|
|
27
|
+
* </Dialog.Content>
|
|
28
|
+
* <Dialog.ButtonBar>
|
|
29
|
+
* <Button styleType='high-visibility'>Confirm</Button>
|
|
30
|
+
* <Button>Close</Button>
|
|
31
|
+
* </Dialog.ButtonBar>
|
|
32
|
+
* </Dialog.Main>
|
|
33
|
+
* </Dialog>
|
|
34
|
+
*/
|
|
35
|
+
export var Dialog = Object.assign(function (props) {
|
|
36
|
+
var children = props.children, _a = props.trapFocus, trapFocus = _a === void 0 ? false : _a, _b = props.preventDocumentScroll, preventDocumentScroll = _b === void 0 ? false : _b, _c = props.isOpen, isOpen = _c === void 0 ? false : _c, _d = props.isDismissible, isDismissible = _d === void 0 ? true : _d, _e = props.closeOnEsc, closeOnEsc = _e === void 0 ? true : _e, _f = props.closeOnExternalClick, closeOnExternalClick = _f === void 0 ? false : _f, onClose = props.onClose;
|
|
37
|
+
return (React.createElement(DialogContext.Provider, { value: {
|
|
38
|
+
isOpen: isOpen,
|
|
39
|
+
onClose: onClose,
|
|
40
|
+
closeOnEsc: closeOnEsc,
|
|
41
|
+
closeOnExternalClick: closeOnExternalClick,
|
|
42
|
+
isDismissible: isDismissible,
|
|
43
|
+
preventDocumentScroll: preventDocumentScroll,
|
|
44
|
+
trapFocus: trapFocus,
|
|
45
|
+
} }, children));
|
|
46
|
+
}, {
|
|
47
|
+
Backdrop: DialogBackdrop,
|
|
48
|
+
Main: DialogMain,
|
|
49
|
+
TitleBar: DialogTitleBar,
|
|
50
|
+
Content: DialogContent,
|
|
51
|
+
ButtonBar: DialogButtonBar,
|
|
52
|
+
});
|
|
53
|
+
export default Dialog;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BackdropProps } from '../Backdrop';
|
|
3
|
+
import { DialogContextProps } from './DialogContext';
|
|
4
|
+
export declare type DialogBackdropProps = BackdropProps & Pick<DialogContextProps, 'onClose' | 'isDismissible' | 'closeOnExternalClick'>;
|
|
5
|
+
/**
|
|
6
|
+
* Backdrop component for dialog. Recommended to be used with `Dialog`
|
|
7
|
+
* then its visibility is being controlled by dialog's `isOpen` prop.
|
|
8
|
+
* @example
|
|
9
|
+
* <Dialog.Backdrop />
|
|
10
|
+
*/
|
|
11
|
+
export declare const DialogBackdrop: React.ForwardRefExoticComponent<Pick<DialogBackdropProps, "onClose" | "key" | keyof React.HTMLAttributes<HTMLDivElement> | "isVisible" | "isDismissible" | "closeOnExternalClick"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
export default DialogBackdrop;
|
|
@@ -0,0 +1,55 @@
|
|
|
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 { Backdrop } from '../Backdrop';
|
|
29
|
+
import { useMergedRefs } from '../utils';
|
|
30
|
+
import { useDialogContext } from './DialogContext';
|
|
31
|
+
/**
|
|
32
|
+
* Backdrop component for dialog. Recommended to be used with `Dialog`
|
|
33
|
+
* then its visibility is being controlled by dialog's `isOpen` prop.
|
|
34
|
+
* @example
|
|
35
|
+
* <Dialog.Backdrop />
|
|
36
|
+
*/
|
|
37
|
+
export var DialogBackdrop = React.forwardRef(function (props, ref) {
|
|
38
|
+
var dialogContext = useDialogContext();
|
|
39
|
+
var _a = props.isVisible, isVisible = _a === void 0 ? dialogContext.isOpen : _a, _b = props.isDismissible, isDismissible = _b === void 0 ? dialogContext.isDismissible : _b, _c = props.onClose, onClose = _c === void 0 ? dialogContext.onClose : _c, _d = props.closeOnExternalClick, closeOnExternalClick = _d === void 0 ? dialogContext.closeOnExternalClick : _d, onMouseDown = props.onMouseDown, rest = __rest(props, ["isVisible", "isDismissible", "onClose", "closeOnExternalClick", "onMouseDown"]);
|
|
40
|
+
var backdropRef = React.useRef(null);
|
|
41
|
+
var refs = useMergedRefs(backdropRef, ref);
|
|
42
|
+
var handleMouseDown = function (event) {
|
|
43
|
+
// Prevents React from resetting its properties
|
|
44
|
+
event.persist();
|
|
45
|
+
if (event.target !== backdropRef.current) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (isDismissible && closeOnExternalClick && onClose) {
|
|
49
|
+
onClose(event);
|
|
50
|
+
}
|
|
51
|
+
onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(event);
|
|
52
|
+
};
|
|
53
|
+
return (React.createElement(Backdrop, __assign({ isVisible: isVisible, ref: refs, onMouseDown: handleMouseDown }, rest)));
|
|
54
|
+
});
|
|
55
|
+
export default DialogBackdrop;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '@itwin/itwinui-css/css/dialog.css';
|
|
3
|
+
export declare type DialogButtonBarProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Buttons in the dialog bar.
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
} & React.ComponentPropsWithRef<'div'>;
|
|
9
|
+
/**
|
|
10
|
+
* Container for Buttons in `Dialog`. Recommended to be used as a child of `Dialog`.
|
|
11
|
+
* @example
|
|
12
|
+
* <Dialog.ButtonBar>
|
|
13
|
+
* <Button styleType='high-visibility'>Confirm</Button>
|
|
14
|
+
* <Button>Close</Button>
|
|
15
|
+
* </Dialog.ButtonBar>
|
|
16
|
+
*/
|
|
17
|
+
export declare const DialogButtonBar: React.ForwardRefExoticComponent<Pick<DialogButtonBarProps, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
+
export default DialogButtonBar;
|
|
@@ -0,0 +1,44 @@
|
|
|
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 '../utils';
|
|
30
|
+
import '@itwin/itwinui-css/css/dialog.css';
|
|
31
|
+
/**
|
|
32
|
+
* Container for Buttons in `Dialog`. Recommended to be used as a child of `Dialog`.
|
|
33
|
+
* @example
|
|
34
|
+
* <Dialog.ButtonBar>
|
|
35
|
+
* <Button styleType='high-visibility'>Confirm</Button>
|
|
36
|
+
* <Button>Close</Button>
|
|
37
|
+
* </Dialog.ButtonBar>
|
|
38
|
+
*/
|
|
39
|
+
export var DialogButtonBar = React.forwardRef(function (props, ref) {
|
|
40
|
+
var children = props.children, className = props.className, rest = __rest(props, ["children", "className"]);
|
|
41
|
+
useTheme();
|
|
42
|
+
return (React.createElement("div", __assign({ className: cx('iui-dialog-button-bar', className), ref: ref }, rest), children));
|
|
43
|
+
});
|
|
44
|
+
export default DialogButtonBar;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '@itwin/itwinui-css/css/dialog.css';
|
|
3
|
+
export declare type DialogContentProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Main content in the `Dialog`.
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
} & React.ComponentPropsWithRef<'div'>;
|
|
9
|
+
/**
|
|
10
|
+
* Container for content in `Dialog`. Recommended to be used as a child of `Dialog`.
|
|
11
|
+
* @example
|
|
12
|
+
* <Dialog.Content>
|
|
13
|
+
* My dialog content
|
|
14
|
+
* </Dialog.Content>
|
|
15
|
+
*/
|
|
16
|
+
export declare const DialogContent: React.ForwardRefExoticComponent<Pick<DialogContentProps, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
export default DialogContent;
|
|
@@ -0,0 +1,43 @@
|
|
|
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 '../utils';
|
|
30
|
+
import '@itwin/itwinui-css/css/dialog.css';
|
|
31
|
+
/**
|
|
32
|
+
* Container for content in `Dialog`. Recommended to be used as a child of `Dialog`.
|
|
33
|
+
* @example
|
|
34
|
+
* <Dialog.Content>
|
|
35
|
+
* My dialog content
|
|
36
|
+
* </Dialog.Content>
|
|
37
|
+
*/
|
|
38
|
+
export var DialogContent = React.forwardRef(function (props, ref) {
|
|
39
|
+
var children = props.children, className = props.className, rest = __rest(props, ["children", "className"]);
|
|
40
|
+
useTheme();
|
|
41
|
+
return (React.createElement("div", __assign({ className: cx('iui-dialog-content', className), ref: ref }, rest), children));
|
|
42
|
+
});
|
|
43
|
+
export default DialogContent;
|
|
@@ -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 '../utils';
|
|
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 '../utils';
|
|
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;
|