@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.
Files changed (128) hide show
  1. package/CHANGELOG.md +30 -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/Menu/Menu.js +0 -3
  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/Select/Select.d.ts +23 -8
  44. package/cjs/core/Select/Select.js +82 -25
  45. package/cjs/core/Select/SelectTag.d.ts +15 -0
  46. package/cjs/core/Select/SelectTag.js +48 -0
  47. package/cjs/core/Select/index.d.ts +1 -1
  48. package/cjs/core/Slider/Slider.d.ts +10 -0
  49. package/cjs/core/Slider/Slider.js +20 -14
  50. package/cjs/core/Slider/Thumb.d.ts +2 -1
  51. package/cjs/core/Slider/Thumb.js +5 -3
  52. package/cjs/core/Slider/Track.d.ts +2 -1
  53. package/cjs/core/Slider/Track.js +23 -4
  54. package/cjs/core/Table/Table.d.ts +2 -1
  55. package/cjs/core/Table/Table.js +8 -2
  56. package/cjs/core/Table/columns/actionColumn.d.ts +8 -3
  57. package/cjs/core/Table/columns/actionColumn.js +33 -2
  58. package/cjs/core/Table/hooks/useScrollToRow.d.ts +1 -1
  59. package/cjs/core/Table/hooks/useScrollToRow.js +3 -3
  60. package/cjs/core/index.d.ts +4 -2
  61. package/cjs/core/index.js +6 -3
  62. package/cjs/core/utils/components/FocusTrap.js +1 -1
  63. package/cjs/core/utils/components/MiddleTextTruncation.js +1 -1
  64. package/cjs/core/utils/hooks/useOverflow.js +4 -1
  65. package/esm/core/Backdrop/Backdrop.d.ts +10 -0
  66. package/esm/core/Backdrop/Backdrop.js +35 -0
  67. package/esm/core/Backdrop/index.d.ts +2 -0
  68. package/esm/core/Backdrop/index.js +5 -0
  69. package/esm/core/Breadcrumbs/Breadcrumbs.js +18 -18
  70. package/esm/core/ButtonGroup/ButtonGroup.js +11 -4
  71. package/esm/core/Dialog/Dialog.d.ts +41 -0
  72. package/esm/core/Dialog/Dialog.js +53 -0
  73. package/esm/core/Dialog/DialogBackdrop.d.ts +12 -0
  74. package/esm/core/Dialog/DialogBackdrop.js +55 -0
  75. package/esm/core/Dialog/DialogButtonBar.d.ts +18 -0
  76. package/esm/core/Dialog/DialogButtonBar.js +44 -0
  77. package/esm/core/Dialog/DialogContent.d.ts +17 -0
  78. package/esm/core/Dialog/DialogContent.js +43 -0
  79. package/esm/core/Dialog/DialogContext.d.ts +39 -0
  80. package/esm/core/Dialog/DialogContext.js +9 -0
  81. package/esm/core/Dialog/DialogMain.d.ts +36 -0
  82. package/esm/core/Dialog/DialogMain.js +114 -0
  83. package/esm/core/Dialog/DialogTitleBar.d.ts +34 -0
  84. package/esm/core/Dialog/DialogTitleBar.js +63 -0
  85. package/esm/core/Dialog/DialogTitleBarTitle.d.ts +15 -0
  86. package/esm/core/Dialog/DialogTitleBarTitle.js +41 -0
  87. package/esm/core/Dialog/index.d.ts +8 -0
  88. package/esm/core/Dialog/index.js +6 -0
  89. package/esm/core/Footer/Footer.d.ts +16 -2
  90. package/esm/core/Footer/Footer.js +56 -43
  91. package/esm/core/Footer/FooterItem.d.ts +8 -0
  92. package/esm/core/Footer/FooterItem.js +39 -0
  93. package/esm/core/Footer/FooterList.d.ts +8 -0
  94. package/esm/core/Footer/FooterList.js +39 -0
  95. package/esm/core/Footer/FooterSeparator.d.ts +8 -0
  96. package/esm/core/Footer/FooterSeparator.js +39 -0
  97. package/esm/core/Footer/index.d.ts +1 -1
  98. package/esm/core/Footer/index.js +1 -1
  99. package/esm/core/Menu/Menu.js +0 -3
  100. package/esm/core/Modal/Modal.d.ts +4 -14
  101. package/esm/core/Modal/Modal.js +10 -75
  102. package/esm/core/Modal/ModalButtonBar.d.ts +1 -2
  103. package/esm/core/Modal/ModalButtonBar.js +2 -35
  104. package/esm/core/Modal/ModalContent.d.ts +1 -2
  105. package/esm/core/Modal/ModalContent.js +2 -35
  106. package/esm/core/Select/Select.d.ts +23 -8
  107. package/esm/core/Select/Select.js +83 -26
  108. package/esm/core/Select/SelectTag.d.ts +15 -0
  109. package/esm/core/Select/SelectTag.js +41 -0
  110. package/esm/core/Select/index.d.ts +1 -1
  111. package/esm/core/Slider/Slider.d.ts +10 -0
  112. package/esm/core/Slider/Slider.js +20 -14
  113. package/esm/core/Slider/Thumb.d.ts +2 -1
  114. package/esm/core/Slider/Thumb.js +5 -3
  115. package/esm/core/Slider/Track.d.ts +2 -1
  116. package/esm/core/Slider/Track.js +23 -4
  117. package/esm/core/Table/Table.d.ts +2 -1
  118. package/esm/core/Table/Table.js +8 -2
  119. package/esm/core/Table/columns/actionColumn.d.ts +8 -3
  120. package/esm/core/Table/columns/actionColumn.js +33 -2
  121. package/esm/core/Table/hooks/useScrollToRow.d.ts +1 -1
  122. package/esm/core/Table/hooks/useScrollToRow.js +3 -3
  123. package/esm/core/index.d.ts +4 -2
  124. package/esm/core/index.js +2 -1
  125. package/esm/core/utils/components/FocusTrap.js +1 -1
  126. package/esm/core/utils/components/MiddleTextTruncation.js +1 -1
  127. package/esm/core/utils/hooks/useOverflow.js +4 -1
  128. package/package.json +6 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.44.0](https://www.github.com/iTwin/iTwinUI-react/compare/v1.43.1...v1.44.0) (2022-08-23)
4
+
5
+ ### What's new
6
+
7
+ * **Select:** Multiple selection support ([#700](https://www.github.com/iTwin/iTwinUI-react/issues/700)) ([b7d34c1](https://www.github.com/iTwin/iTwinUI-react/commit/b7d34c1702ae416d969bed21098270f7aa7731a9))
8
+
9
+ ### Fixes
10
+
11
+ * **Table:** Show correct icon on hover for columns with `sortDescFirst` ([#779](https://www.github.com/iTwin/iTwinUI-react/issues/779)) ([acf19a2](https://www.github.com/iTwin/iTwinUI-react/commit/acf19a23d4680e6e1c1789e45b8e76e0848d8166))
12
+
13
+ ### [1.43.1](https://www.github.com/iTwin/iTwinUI-react/compare/v1.43.0...v1.43.1) (2022-08-18)
14
+
15
+ ### Fixes
16
+
17
+ * **Dialog:** Fixed import path for `useTheme` ([#780](https://www.github.com/iTwin/iTwinUI-react/issues/780)) ([dc5f65a](https://www.github.com/iTwin/iTwinUI-react/commit/dc5f65af8a4a7e8d50f05952084a2ffe98bc0800))
18
+
19
+ ## [1.43.0](https://www.github.com/iTwin/iTwinUI-react/compare/v1.42.0...v1.43.0) (2022-08-17)
20
+
21
+ ### What's new
22
+
23
+ * **Footer:** Allows to use composition to customize Footer as you wish ([#754](https://www.github.com/iTwin/iTwinUI-react/issues/754)) ([48dfe52](https://www.github.com/iTwin/iTwinUI-react/commit/48dfe524f4ac45a81cd98504f38c50420f47664a))
24
+ * **Slider:** Adding vertical orientation support ([#747](https://www.github.com/iTwin/iTwinUI-react/issues/747)) ([18cb893](https://www.github.com/iTwin/iTwinUI-react/commit/18cb89317118081ab425606f5679be56e1b60552))
25
+ * **Table:** Style `DropdownMenu` inside of `ActionColumn` in `Table` ([#756](https://www.github.com/iTwin/iTwinUI-react/issues/756)) ([1116369](https://www.github.com/iTwin/iTwinUI-react/commit/111636962076797cbbc0f0b8b5ae4077a7e5a8d2))
26
+
27
+ ### Fixes
28
+
29
+ * **Breadcrumbs**, **ButtonGroup**: Fix focus getting lost while resizing on overflow ([#777](https://www.github.com/iTwin/iTwinUI-react/issues/777)) ([8ee9c7b](https://www.github.com/iTwin/iTwinUI-react/commit/8ee9c7b57829b330cea7db5f89864c90211ec4d1))
30
+ * **Table:** Enabled scrollToRow for lazy-loading tables ([#775](https://www.github.com/iTwin/iTwinUI-react/issues/775)) ([c57b458](https://www.github.com/iTwin/iTwinUI-react/commit/c57b458e7d74609d44d3f0d304e49ee2c1f22d54))
31
+ * **Table:** Syncing header and body horizontal scroll state ([#760](https://www.github.com/iTwin/iTwinUI-react/issues/760)) ([5ceeec2](https://www.github.com/iTwin/iTwinUI-react/commit/5ceeec279585ca5af92f1b26440c354ee6eeb027))
32
+
3
33
  ## [1.42.0](https://www.github.com/iTwin/iTwinUI-react/compare/v1.41.0...v1.42.0) (2022-07-26)
4
34
 
5
35
  ### Fixes
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import '@itwin/itwinui-css/css/backdrop.css';
3
+ export declare type BackdropProps = {
4
+ /**
5
+ * Flag whether backdrop should be shown.
6
+ * @default true
7
+ */
8
+ isVisible?: boolean;
9
+ } & React.ComponentPropsWithRef<'div'>;
10
+ export declare const Backdrop: React.ForwardRefExoticComponent<Pick<BackdropProps, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "isVisible"> & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,41 @@
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.Backdrop = 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/backdrop.css");
37
+ exports.Backdrop = react_1.default.forwardRef(function (props, ref) {
38
+ var _a = props.isVisible, isVisible = _a === void 0 ? true : _a, className = props.className, rest = __rest(props, ["isVisible", "className"]);
39
+ (0, utils_1.useTheme)();
40
+ return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-backdrop', { 'iui-backdrop-visible': isVisible }, className), ref: ref }, rest)));
41
+ });
@@ -0,0 +1,2 @@
1
+ export { Backdrop } from './Backdrop';
2
+ export type { BackdropProps } from './Backdrop';
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Backdrop = 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 Backdrop_1 = require("./Backdrop");
9
+ Object.defineProperty(exports, "Backdrop", { enumerable: true, get: function () { return Backdrop_1.Backdrop; } });
@@ -62,28 +62,15 @@ exports.Breadcrumbs = react_1.default.forwardRef(function (props, ref) {
62
62
  (0, utils_1.useTheme)();
63
63
  var _b = (0, utils_1.useOverflow)(items), overflowRef = _b[0], visibleCount = _b[1];
64
64
  var refs = (0, utils_1.useMergedRefs)(overflowRef, ref);
65
- var Separator = function () { return (react_1.default.createElement("li", { className: 'iui-breadcrumbs-separator', "aria-hidden": true }, separator !== null && separator !== void 0 ? separator : react_1.default.createElement(ChevronRight_1.default, null))); };
66
- var ListItem = function (_a) {
67
- var _b;
68
- var index = _a.index;
69
- var item = items[index];
70
- return (react_1.default.createElement("li", { className: 'iui-breadcrumbs-item iui-breadcrumbs-item-overrides' }, react_1.default.isValidElement(item)
71
- ? react_1.default.cloneElement(item, {
72
- 'aria-current': ((_b = item.props['aria-current']) !== null && _b !== void 0 ? _b : currentIndex === index)
73
- ? 'location'
74
- : undefined,
75
- })
76
- : item));
77
- };
78
65
  return (react_1.default.createElement("nav", __assign({ className: (0, classnames_1.default)('iui-breadcrumbs', className), ref: refs, "aria-label": 'Breadcrumb' }, rest),
79
66
  react_1.default.createElement("ol", { className: 'iui-breadcrumbs-list' },
80
67
  visibleCount > 1 && (react_1.default.createElement(react_1.default.Fragment, null,
81
- react_1.default.createElement(ListItem, { index: 0 }),
82
- react_1.default.createElement(Separator, null))),
68
+ react_1.default.createElement(ListItem, { item: items[0], isActive: currentIndex === 0 }),
69
+ react_1.default.createElement(Separator, { separator: separator }))),
83
70
  items.length - visibleCount > 0 && (react_1.default.createElement(react_1.default.Fragment, null,
84
71
  react_1.default.createElement("li", { className: 'iui-breadcrumbs-item iui-breadcrumbs-item-overrides' },
85
72
  react_1.default.createElement("span", { className: 'iui-breadcrumbs-text' }, "\u2026")),
86
- react_1.default.createElement(Separator, null))),
73
+ react_1.default.createElement(Separator, { separator: separator }))),
87
74
  items
88
75
  .slice(visibleCount > 1
89
76
  ? items.length - visibleCount + 1
@@ -93,8 +80,21 @@ exports.Breadcrumbs = react_1.default.forwardRef(function (props, ref) {
93
80
  ? 1 + (items.length - visibleCount) + _index
94
81
  : items.length - 1;
95
82
  return (react_1.default.createElement(react_1.default.Fragment, { key: index },
96
- react_1.default.createElement(ListItem, { index: index }),
97
- index < items.length - 1 && react_1.default.createElement(Separator, null)));
83
+ react_1.default.createElement(ListItem, { item: items[index], isActive: currentIndex === index }),
84
+ index < items.length - 1 && (react_1.default.createElement(Separator, { separator: separator }))));
98
85
  }))));
99
86
  });
87
+ var ListItem = function (_a) {
88
+ var _b;
89
+ var item = _a.item, isActive = _a.isActive;
90
+ return (react_1.default.createElement("li", { className: 'iui-breadcrumbs-item iui-breadcrumbs-item-overrides' }, react_1.default.isValidElement(item)
91
+ ? react_1.default.cloneElement(item, {
92
+ 'aria-current': ((_b = item.props['aria-current']) !== null && _b !== void 0 ? _b : isActive) ? 'location' : undefined,
93
+ })
94
+ : item));
95
+ };
96
+ var Separator = function (_a) {
97
+ var separator = _a.separator;
98
+ return (react_1.default.createElement("li", { className: 'iui-breadcrumbs-separator', "aria-hidden": true }, separator !== null && separator !== void 0 ? separator : react_1.default.createElement(ChevronRight_1.default, null)));
99
+ };
100
100
  exports.default = exports.Breadcrumbs;
@@ -72,9 +72,16 @@ exports.ButtonGroup = react_1.default.forwardRef(function (props, ref) {
72
72
  'iui-button-group': orientation === 'horizontal',
73
73
  'iui-button-group-vertical': orientation === 'vertical',
74
74
  'iui-button-group-overflow-x': !!overflowButton && orientation === 'horizontal',
75
- }, className), "aria-orientation": orientation, ref: refs }, rest), !!overflowButton && visibleCount < items.length ? (react_1.default.createElement(react_1.default.Fragment, null,
76
- overflowButton && overflowPlacement === 'start' && (react_1.default.createElement("div", null, overflowButton(visibleCount))),
77
- items.slice(0, visibleCount - 1),
78
- overflowButton && overflowPlacement === 'end' && (react_1.default.createElement("div", null, overflowButton(visibleCount))))) : (items)));
75
+ }, className), "aria-orientation": orientation, ref: refs }, rest),
76
+ react_1.default.createElement(react_1.default.Fragment, null,
77
+ visibleCount < items.length &&
78
+ overflowButton &&
79
+ overflowPlacement === 'start' && (react_1.default.createElement("div", null, overflowButton(visibleCount))),
80
+ visibleCount < items.length
81
+ ? items.slice(0, visibleCount - 1)
82
+ : items,
83
+ visibleCount < items.length &&
84
+ overflowButton &&
85
+ overflowPlacement === 'end' && (react_1.default.createElement("div", null, overflowButton(visibleCount))))));
79
86
  });
80
87
  exports.default = exports.ButtonGroup;
@@ -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,59 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Dialog = void 0;
7
+ /*---------------------------------------------------------------------------------------------
8
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
9
+ * See LICENSE.md in the project root for license terms and full copyright notice.
10
+ *--------------------------------------------------------------------------------------------*/
11
+ var react_1 = __importDefault(require("react"));
12
+ require("@itwin/itwinui-css/css/dialog.css");
13
+ var DialogTitleBar_1 = require("./DialogTitleBar");
14
+ var DialogContent_1 = require("./DialogContent");
15
+ var DialogBackdrop_1 = require("./DialogBackdrop");
16
+ var DialogContext_1 = require("./DialogContext");
17
+ var DialogButtonBar_1 = require("./DialogButtonBar");
18
+ var DialogMain_1 = __importDefault(require("./DialogMain"));
19
+ /**
20
+ * Dialog component.
21
+ * @example
22
+ * <Dialog
23
+ * isOpen={isOpen}
24
+ * onClose={() => setIsOpen(false)}
25
+ * trapFocus
26
+ * preventDocumentScroll
27
+ * >
28
+ * <Dialog.Backdrop />
29
+ * <Dialog.Main aria-modal>
30
+ * <Dialog.TitleBar>My dialog title</Dialog.TitleBar>
31
+ * <Dialog.Content>
32
+ * Here is my dialog content
33
+ * </Dialog.Content>
34
+ * <Dialog.ButtonBar>
35
+ * <Button styleType='high-visibility'>Confirm</Button>
36
+ * <Button>Close</Button>
37
+ * </Dialog.ButtonBar>
38
+ * </Dialog.Main>
39
+ * </Dialog>
40
+ */
41
+ exports.Dialog = Object.assign(function (props) {
42
+ 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;
43
+ return (react_1.default.createElement(DialogContext_1.DialogContext.Provider, { value: {
44
+ isOpen: isOpen,
45
+ onClose: onClose,
46
+ closeOnEsc: closeOnEsc,
47
+ closeOnExternalClick: closeOnExternalClick,
48
+ isDismissible: isDismissible,
49
+ preventDocumentScroll: preventDocumentScroll,
50
+ trapFocus: trapFocus,
51
+ } }, children));
52
+ }, {
53
+ Backdrop: DialogBackdrop_1.DialogBackdrop,
54
+ Main: DialogMain_1.default,
55
+ TitleBar: DialogTitleBar_1.DialogTitleBar,
56
+ Content: DialogContent_1.DialogContent,
57
+ ButtonBar: DialogButtonBar_1.DialogButtonBar,
58
+ });
59
+ exports.default = exports.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,61 @@
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.DialogBackdrop = 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 Backdrop_1 = require("../Backdrop");
35
+ var utils_1 = require("../utils");
36
+ var DialogContext_1 = require("./DialogContext");
37
+ /**
38
+ * Backdrop component for dialog. Recommended to be used with `Dialog`
39
+ * then its visibility is being controlled by dialog's `isOpen` prop.
40
+ * @example
41
+ * <Dialog.Backdrop />
42
+ */
43
+ exports.DialogBackdrop = react_1.default.forwardRef(function (props, ref) {
44
+ var dialogContext = (0, DialogContext_1.useDialogContext)();
45
+ 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"]);
46
+ var backdropRef = react_1.default.useRef(null);
47
+ var refs = (0, utils_1.useMergedRefs)(backdropRef, ref);
48
+ var handleMouseDown = function (event) {
49
+ // Prevents React from resetting its properties
50
+ event.persist();
51
+ if (event.target !== backdropRef.current) {
52
+ return;
53
+ }
54
+ if (isDismissible && closeOnExternalClick && onClose) {
55
+ onClose(event);
56
+ }
57
+ onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(event);
58
+ };
59
+ return (react_1.default.createElement(Backdrop_1.Backdrop, __assign({ isVisible: isVisible, ref: refs, onMouseDown: handleMouseDown }, rest)));
60
+ });
61
+ exports.default = exports.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,50 @@
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.DialogButtonBar = 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
+ * Container for Buttons in `Dialog`. Recommended to be used as a child of `Dialog`.
39
+ * @example
40
+ * <Dialog.ButtonBar>
41
+ * <Button styleType='high-visibility'>Confirm</Button>
42
+ * <Button>Close</Button>
43
+ * </Dialog.ButtonBar>
44
+ */
45
+ exports.DialogButtonBar = react_1.default.forwardRef(function (props, ref) {
46
+ var children = props.children, className = props.className, rest = __rest(props, ["children", "className"]);
47
+ (0, utils_1.useTheme)();
48
+ return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-dialog-button-bar', className), ref: ref }, rest), children));
49
+ });
50
+ exports.default = exports.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,49 @@
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.DialogContent = 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
+ * Container for content in `Dialog`. Recommended to be used as a child of `Dialog`.
39
+ * @example
40
+ * <Dialog.Content>
41
+ * My dialog content
42
+ * </Dialog.Content>
43
+ */
44
+ exports.DialogContent = react_1.default.forwardRef(function (props, ref) {
45
+ var children = props.children, className = props.className, rest = __rest(props, ["children", "className"]);
46
+ (0, utils_1.useTheme)();
47
+ return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-dialog-content', className), ref: ref }, rest), children));
48
+ });
49
+ exports.default = exports.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,16 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.useDialogContext = exports.DialogContext = void 0;
7
+ /*---------------------------------------------------------------------------------------------
8
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
9
+ * See LICENSE.md in the project root for license terms and full copyright notice.
10
+ *--------------------------------------------------------------------------------------------*/
11
+ var react_1 = __importDefault(require("react"));
12
+ exports.DialogContext = react_1.default.createContext(undefined);
13
+ var useDialogContext = function () {
14
+ return react_1.default.useContext(exports.DialogContext) || {};
15
+ };
16
+ exports.useDialogContext = useDialogContext;
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import '@itwin/itwinui-css/css/dialog.css';
3
+ import { DialogContextProps } from './DialogContext';
4
+ export declare type DialogMainProps = {
5
+ /**
6
+ * Type of the dialog.
7
+ * @default 'default'
8
+ */
9
+ styleType?: 'default' | 'fullPage';
10
+ /**
11
+ * Content of the dialog.
12
+ */
13
+ children: React.ReactNode;
14
+ } & Omit<DialogContextProps, 'closeOnExternalClick'> & React.ComponentPropsWithRef<'div'>;
15
+ /**
16
+ * Dialog component which can wrap any content.
17
+ * @example
18
+ * <Dialog.Main>
19
+ * <Dialog.TitleBar>
20
+ * My dialog title
21
+ * </Dialog.TitleBar>
22
+ * <Dialog.Content>
23
+ * Here is my dialog content
24
+ * </Dialog.Content>
25
+ * <Dialog.ButtonBar>
26
+ * <Button styleType='high-visibility'>
27
+ * Primary button
28
+ * </Button>
29
+ * <Button>
30
+ * Secondary button
31
+ * </Button>
32
+ * </Dialog.ButtonBar>
33
+ * </Dialog.Main>
34
+ */
35
+ export declare const DialogMain: React.ForwardRefExoticComponent<Pick<DialogMainProps, "onClose" | "key" | keyof React.HTMLAttributes<HTMLDivElement> | "styleType" | "isOpen" | "isDismissible" | "closeOnEsc" | "trapFocus" | "preventDocumentScroll"> & React.RefAttributes<HTMLDivElement>>;
36
+ export default DialogMain;