@itwin/core-react 4.2.1 → 4.3.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 (126) hide show
  1. package/CHANGELOG.md +7 -4
  2. package/lib/cjs/core-react/_geometry.scss +3 -3
  3. package/lib/cjs/core-react/_math.scss +3 -3
  4. package/lib/cjs/core-react/_typography.scss +3 -3
  5. package/lib/cjs/core-react/autosuggest/AutoSuggest.scss +3 -3
  6. package/lib/cjs/core-react/badge/Badge.scss +3 -3
  7. package/lib/cjs/core-react/badge/NewBadge.scss +3 -3
  8. package/lib/cjs/core-react/base/base.scss +3 -3
  9. package/lib/cjs/core-react/base/index.scss +3 -3
  10. package/lib/cjs/core-react/classes.scss +3 -3
  11. package/lib/cjs/core-react/colorthemes.scss +3 -3
  12. package/lib/cjs/core-react/colorvariables.scss +3 -3
  13. package/lib/cjs/core-react/contextmenu/ContextMenu.scss +3 -3
  14. package/lib/cjs/core-react/dialog/Dialog.d.ts +3 -10
  15. package/lib/cjs/core-react/dialog/Dialog.d.ts.map +1 -1
  16. package/lib/cjs/core-react/dialog/Dialog.js +69 -166
  17. package/lib/cjs/core-react/dialog/Dialog.js.map +1 -1
  18. package/lib/cjs/core-react/dialog/Dialog.scss +59 -217
  19. package/lib/cjs/core-react/expandable/index.scss +3 -3
  20. package/lib/cjs/core-react/expandable/list.scss +3 -3
  21. package/lib/cjs/core-react/icons/SvgPath.scss +3 -3
  22. package/lib/cjs/core-react/icons/WebFontIcon.scss +3 -3
  23. package/lib/cjs/core-react/icons/index.scss +3 -3
  24. package/lib/cjs/core-react/icons/mixins.scss +3 -3
  25. package/lib/cjs/core-react/icons/variables.scss +3 -3
  26. package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.scss +3 -3
  27. package/lib/cjs/core-react/index.scss +3 -3
  28. package/lib/cjs/core-react/inputs/index.scss +3 -3
  29. package/lib/cjs/core-react/inputs/input-label.scss +3 -3
  30. package/lib/cjs/core-react/inputs/input.scss +3 -3
  31. package/lib/cjs/core-react/inputs/numberinput/NumberInput.scss +3 -3
  32. package/lib/cjs/core-react/inputs/variables.scss +3 -3
  33. package/lib/cjs/core-react/listbox/Listbox.scss +3 -3
  34. package/lib/cjs/core-react/loading/LoadingPrompt.scss +3 -3
  35. package/lib/cjs/core-react/loading/LoadingSpinner.scss +3 -3
  36. package/lib/cjs/core-react/loading/index.scss +3 -3
  37. package/lib/cjs/core-react/loading/mixins.scss +3 -3
  38. package/lib/cjs/core-react/messagebox/MessageBox.d.ts.map +1 -1
  39. package/lib/cjs/core-react/messagebox/MessageBox.js +2 -2
  40. package/lib/cjs/core-react/messagebox/MessageBox.js.map +1 -1
  41. package/lib/cjs/core-react/messagebox/MessageBox.scss +3 -3
  42. package/lib/cjs/core-react/popup/Popup.scss +3 -3
  43. package/lib/cjs/core-react/radialmenu/RadialMenu.scss +3 -3
  44. package/lib/cjs/core-react/searchbox/SearchBox.scss +3 -3
  45. package/lib/cjs/core-react/settings/SettingsContainer.scss +3 -3
  46. package/lib/cjs/core-react/style/baseline.scss +3 -3
  47. package/lib/cjs/core-react/style/index.scss +3 -3
  48. package/lib/cjs/core-react/style/opacity.scss +3 -3
  49. package/lib/cjs/core-react/tabs/index.scss +3 -3
  50. package/lib/cjs/core-react/tabs/tabs.scss +3 -3
  51. package/lib/cjs/core-react/tabs/vertical.scss +3 -3
  52. package/lib/cjs/core-react/text/FilteredText.scss +3 -3
  53. package/lib/cjs/core-react/text/block.scss +3 -3
  54. package/lib/cjs/core-react/text/body.scss +3 -3
  55. package/lib/cjs/core-react/text/index.scss +3 -3
  56. package/lib/cjs/core-react/text/mixins.scss +3 -3
  57. package/lib/cjs/core-react/tree/ExpansionToggle.scss +3 -3
  58. package/lib/cjs/core-react/tree/Placeholder.scss +3 -3
  59. package/lib/cjs/core-react/tree/Tree.scss +3 -3
  60. package/lib/esm/core-react/_geometry.scss +3 -3
  61. package/lib/esm/core-react/_math.scss +3 -3
  62. package/lib/esm/core-react/_typography.scss +3 -3
  63. package/lib/esm/core-react/autosuggest/AutoSuggest.scss +3 -3
  64. package/lib/esm/core-react/badge/Badge.scss +3 -3
  65. package/lib/esm/core-react/badge/NewBadge.scss +3 -3
  66. package/lib/esm/core-react/base/base.scss +3 -3
  67. package/lib/esm/core-react/base/index.scss +3 -3
  68. package/lib/esm/core-react/classes.scss +3 -3
  69. package/lib/esm/core-react/colorthemes.scss +3 -3
  70. package/lib/esm/core-react/colorvariables.scss +3 -3
  71. package/lib/esm/core-react/contextmenu/ContextMenu.scss +3 -3
  72. package/lib/esm/core-react/dialog/Dialog.d.ts +3 -10
  73. package/lib/esm/core-react/dialog/Dialog.d.ts.map +1 -1
  74. package/lib/esm/core-react/dialog/Dialog.js +68 -165
  75. package/lib/esm/core-react/dialog/Dialog.js.map +1 -1
  76. package/lib/esm/core-react/dialog/Dialog.scss +59 -217
  77. package/lib/esm/core-react/expandable/index.scss +3 -3
  78. package/lib/esm/core-react/expandable/list.scss +3 -3
  79. package/lib/esm/core-react/icons/SvgPath.scss +3 -3
  80. package/lib/esm/core-react/icons/WebFontIcon.scss +3 -3
  81. package/lib/esm/core-react/icons/index.scss +3 -3
  82. package/lib/esm/core-react/icons/mixins.scss +3 -3
  83. package/lib/esm/core-react/icons/variables.scss +3 -3
  84. package/lib/esm/core-react/imagecheckbox/ImageCheckBox.scss +3 -3
  85. package/lib/esm/core-react/index.scss +3 -3
  86. package/lib/esm/core-react/inputs/index.scss +3 -3
  87. package/lib/esm/core-react/inputs/input-label.scss +3 -3
  88. package/lib/esm/core-react/inputs/input.scss +3 -3
  89. package/lib/esm/core-react/inputs/numberinput/NumberInput.scss +3 -3
  90. package/lib/esm/core-react/inputs/variables.scss +3 -3
  91. package/lib/esm/core-react/listbox/Listbox.scss +3 -3
  92. package/lib/esm/core-react/loading/LoadingPrompt.scss +3 -3
  93. package/lib/esm/core-react/loading/LoadingSpinner.scss +3 -3
  94. package/lib/esm/core-react/loading/index.scss +3 -3
  95. package/lib/esm/core-react/loading/mixins.scss +3 -3
  96. package/lib/esm/core-react/messagebox/MessageBox.d.ts.map +1 -1
  97. package/lib/esm/core-react/messagebox/MessageBox.js +2 -2
  98. package/lib/esm/core-react/messagebox/MessageBox.js.map +1 -1
  99. package/lib/esm/core-react/messagebox/MessageBox.scss +3 -3
  100. package/lib/esm/core-react/popup/Popup.scss +3 -3
  101. package/lib/esm/core-react/radialmenu/RadialMenu.scss +3 -3
  102. package/lib/esm/core-react/searchbox/SearchBox.scss +3 -3
  103. package/lib/esm/core-react/settings/SettingsContainer.scss +3 -3
  104. package/lib/esm/core-react/style/baseline.scss +3 -3
  105. package/lib/esm/core-react/style/index.scss +3 -3
  106. package/lib/esm/core-react/style/opacity.scss +3 -3
  107. package/lib/esm/core-react/tabs/index.scss +3 -3
  108. package/lib/esm/core-react/tabs/tabs.scss +3 -3
  109. package/lib/esm/core-react/tabs/vertical.scss +3 -3
  110. package/lib/esm/core-react/text/FilteredText.scss +3 -3
  111. package/lib/esm/core-react/text/block.scss +3 -3
  112. package/lib/esm/core-react/text/body.scss +3 -3
  113. package/lib/esm/core-react/text/index.scss +3 -3
  114. package/lib/esm/core-react/text/mixins.scss +3 -3
  115. package/lib/esm/core-react/tree/ExpansionToggle.scss +3 -3
  116. package/lib/esm/core-react/tree/Placeholder.scss +3 -3
  117. package/lib/esm/core-react/tree/Tree.scss +3 -3
  118. package/package.json +3 -3
  119. package/lib/cjs/core-react/dialog/SimpleDialog.d.ts +0 -68
  120. package/lib/cjs/core-react/dialog/SimpleDialog.d.ts.map +0 -1
  121. package/lib/cjs/core-react/dialog/SimpleDialog.js +0 -51
  122. package/lib/cjs/core-react/dialog/SimpleDialog.js.map +0 -1
  123. package/lib/esm/core-react/dialog/SimpleDialog.d.ts +0 -68
  124. package/lib/esm/core-react/dialog/SimpleDialog.d.ts.map +0 -1
  125. package/lib/esm/core-react/dialog/SimpleDialog.js +0 -47
  126. package/lib/esm/core-react/dialog/SimpleDialog.js.map +0 -1
@@ -11,10 +11,8 @@ import * as React from "react";
11
11
  import { DialogButtonType, SpecialKey } from "@itwin/appui-abstract";
12
12
  import { DivWithOutsideClick } from "../base/DivWithOutsideClick";
13
13
  import { UiCore } from "../UiCore";
14
- import { FocusTrap } from "../focustrap/FocusTrap";
14
+ import { Dialog as BaseDialog } from "@itwin/itwinui-react";
15
15
  import { Button } from "@itwin/itwinui-react";
16
- import { Icon } from "../icons/IconComponent";
17
- import { SvgClose } from "@itwin/itwinui-icons-react";
18
16
  // cspell:ignore focustrap
19
17
  /** Enum for dialog alignment
20
18
  * @public
@@ -40,28 +38,7 @@ class Dialog extends React.Component {
40
38
  super(props);
41
39
  this._parentDocument = document;
42
40
  this._containerRef = React.createRef();
43
- /** Keep title bar of movable Dialog at least partially visible */
44
41
  // istanbul ignore next
45
- this._handleAppWindowResize = () => {
46
- if (!this._containerRef.current || !this.props.movable)
47
- return;
48
- const parentWindow = this.getParentWindow();
49
- const { x, y } = this.state;
50
- let newX;
51
- let newY;
52
- if (undefined !== y && undefined !== x) {
53
- if (y > parentWindow.innerHeight - 32)
54
- newY = parentWindow.innerHeight - 32;
55
- if (x > parentWindow.innerWidth - 32)
56
- newX = parentWindow.innerWidth - 32;
57
- }
58
- if (newX !== undefined || newY !== undefined)
59
- this.setState({
60
- x: newX !== undefined ? newX : x,
61
- y: newY !== undefined ? newY : y,
62
- positionSet: true,
63
- });
64
- };
65
42
  this.handleRefSet = (containerDiv) => {
66
43
  if (containerDiv)
67
44
  this._parentDocument = containerDiv.ownerDocument;
@@ -97,29 +74,11 @@ class Dialog extends React.Component {
97
74
  const parentWindow = this.getParentWindow();
98
75
  parentWindow.addEventListener("pointermove", this._handlePointerMove, true);
99
76
  };
100
- this._handleStartMove = (event) => {
101
- if (!this.props.movable)
102
- return;
103
- event.preventDefault();
104
- // istanbul ignore else
105
- if (this._containerRef.current) {
106
- const rect = this._containerRef.current.getBoundingClientRect();
107
- const grabOffsetX = event.clientX - rect.left;
108
- const grabOffsetY = event.clientY - rect.top;
109
- this.setState({
110
- grabOffsetX,
111
- grabOffsetY,
112
- moving: true,
113
- });
114
- const parentWindow = this.getParentWindow();
115
- parentWindow.addEventListener("pointermove", this._handlePointerMove, true);
116
- }
117
- };
118
77
  this._handlePointerMove = (event) => {
119
- if ((!this.props.resizable && !this.props.movable) ||
120
- !this._containerRef.current)
78
+ // istanbul ignore next
79
+ if (!this.props.resizable || !this._containerRef.current)
121
80
  return;
122
- const { minWidth, maxWidth, minHeight, maxHeight, movable } = this.props;
81
+ const { minWidth, maxWidth, minHeight, maxHeight } = this.props;
123
82
  let { x, y, width, height } = this.state;
124
83
  // istanbul ignore else
125
84
  if (x === undefined) {
@@ -130,57 +89,34 @@ class Dialog extends React.Component {
130
89
  (x = rect.left),
131
90
  (y = rect.top);
132
91
  }
133
- if (this.props.resizable) {
134
- if (this.state.rightResizing) {
135
- const pointerX = event.clientX;
136
- width = pointerX - x;
137
- // istanbul ignore else
138
- if (typeof minWidth === "number")
139
- width = Math.max(width, minWidth);
140
- if (maxWidth !== undefined && typeof maxWidth === "number")
141
- width = Math.min(width, maxWidth);
142
- }
143
- if (this.state.downResizing) {
144
- const pointerY = event.clientY;
145
- height = pointerY - y;
146
- // istanbul ignore else
147
- if (typeof minHeight === "number")
148
- height = Math.max(height, minHeight);
149
- if (maxHeight !== undefined && typeof maxHeight === "number")
150
- height = Math.min(height, maxHeight);
151
- }
152
- this.setState({ width, height });
92
+ if (this.state.rightResizing) {
93
+ const pointerX = event.clientX;
94
+ width = pointerX - x;
95
+ // istanbul ignore else
96
+ if (typeof minWidth === "number")
97
+ width = Math.max(width, minWidth);
98
+ if (maxWidth !== undefined && typeof maxWidth === "number")
99
+ width = Math.min(width, maxWidth);
153
100
  }
154
- // istanbul ignore next
155
- if (movable && this.state.moving) {
156
- x = event.clientX - this.state.grabOffsetX;
157
- y = event.clientY - this.state.grabOffsetY;
158
- if (y < 0)
159
- y = 0;
160
- if (event.view) {
161
- if (y > event.view.innerHeight - 32)
162
- y = event.view.innerHeight - 32;
163
- if (x > event.view.innerWidth - 32)
164
- x = event.view.innerWidth - 32;
165
- if (width) {
166
- if (x < 0 - width + 32)
167
- x = 0 - width + 32;
168
- }
169
- }
170
- this.setState({ x, y, positionSet: true });
101
+ if (this.state.downResizing) {
102
+ const pointerY = event.clientY;
103
+ height = pointerY - y;
104
+ // istanbul ignore else
105
+ if (typeof minHeight === "number")
106
+ height = Math.max(height, minHeight);
107
+ if (maxHeight !== undefined && typeof maxHeight === "number")
108
+ height = Math.min(height, maxHeight);
171
109
  }
110
+ this.setState({ width, height });
172
111
  };
173
112
  this._handlePointerUp = (_event) => {
174
- if (!this.props.movable && !this.props.resizable)
113
+ if (!this.props.resizable)
175
114
  return;
176
115
  // istanbul ignore else
177
116
  if (this._containerRef.current) {
178
117
  this.setState({
179
118
  rightResizing: false,
180
119
  downResizing: false,
181
- moving: false,
182
- grabOffsetX: 0,
183
- grabOffsetY: 0,
184
120
  });
185
121
  }
186
122
  const parentWindow = this.getParentWindow();
@@ -189,10 +125,6 @@ class Dialog extends React.Component {
189
125
  this.state = {
190
126
  rightResizing: false,
191
127
  downResizing: false,
192
- moving: false,
193
- grabOffsetX: 0,
194
- grabOffsetY: 0,
195
- positionSet: props.x !== undefined || props.y !== undefined,
196
128
  };
197
129
  }
198
130
  getParentWindow() {
@@ -205,118 +137,89 @@ class Dialog extends React.Component {
205
137
  parentWindow.removeEventListener("pointerup", this._handlePointerUp, true);
206
138
  parentWindow.removeEventListener("pointermove", this._handlePointerMove, true);
207
139
  this._parentDocument.removeEventListener("keyup", this._handleKeyUp, true);
208
- parentWindow.addEventListener("resize", this._handleAppWindowResize);
209
140
  }
210
141
  componentDidMount() {
211
142
  const parentWindow = this.getParentWindow();
212
143
  parentWindow.addEventListener("pointerup", this._handlePointerUp, true);
213
144
  this._parentDocument.addEventListener("keyup", this._handleKeyUp, true);
214
- parentWindow.addEventListener("resize", this._handleAppWindowResize);
215
145
  }
216
146
  render() {
217
147
  const { opened, title, footer, buttonCluster, onClose, onEscape, onOutsideClick, minWidth, minHeight, x, y, width, height, maxHeight, maxWidth, backgroundStyle, titleStyle, footerStyle, style, contentStyle, contentClassName, modal, resizable, movable, className, alignment, inset, trapFocus, modelessId, onModelessPointerDown, hideHeader, header, ...props } = this.props;
148
+ let initialOffset = {};
149
+ if (x || y) {
150
+ initialOffset = {
151
+ left: x !== null && x !== void 0 ? x : 0,
152
+ top: y !== null && y !== void 0 ? y : 0,
153
+ transform: "none",
154
+ };
155
+ }
218
156
  const containerStyle = {
157
+ ...initialOffset,
219
158
  margin: "",
220
- left: x,
221
- top: y,
222
159
  width,
223
160
  height,
224
161
  };
225
- if (this.state.x !== undefined || this.state.y !== undefined) {
226
- // istanbul ignore else
227
- if (this.state.x !== undefined) {
228
- containerStyle.marginLeft = "0";
229
- containerStyle.marginRight = "0";
230
- containerStyle.left = this.state.x;
231
- }
232
- // istanbul ignore else
233
- if (this.state.y !== undefined) {
234
- containerStyle.marginTop = "0";
235
- containerStyle.marginBottom = "0";
236
- containerStyle.top = this.state.y;
237
- }
238
- }
239
- if (this.state.width !== undefined || this.state.height !== undefined) {
240
- // istanbul ignore else
241
- if (this.state.width !== undefined)
242
- containerStyle.width = this.state.width;
243
- // istanbul ignore else
244
- if (this.state.height !== undefined)
245
- containerStyle.height = this.state.height;
246
- }
162
+ // istanbul ignore else
163
+ if (this.state.width !== undefined)
164
+ containerStyle.width = this.state.width;
165
+ // istanbul ignore else
166
+ if (this.state.height !== undefined)
167
+ containerStyle.height = this.state.height;
247
168
  const minMaxStyle = {
248
169
  minWidth,
249
170
  minHeight,
250
171
  maxWidth,
251
172
  maxHeight,
252
173
  };
253
- const buttons = this.getFooterButtons(buttonCluster);
254
- const footerElement = footer ||
255
- (buttons && buttons.length > 0 && (React.createElement("div", { className: "core-dialog-buttons" }, buttons)));
256
- const divStyle = {
257
- ...backgroundStyle,
258
- ...style,
174
+ const dialogBaseContainerStyle = {
175
+ ...containerStyle,
176
+ ...minMaxStyle,
259
177
  };
260
- const headerElement = header || (React.createElement("div", { className: classnames("core-dialog-head", { "core-dialog-movable": movable }, { "core-dialog-modal": modal }), "data-testid": "core-dialog-head", onPointerDown: this._handleStartMove },
261
- React.createElement("div", { className: "core-dialog-title", "data-testid": "core-dialog-title", style: titleStyle }, title),
262
- React.createElement("button", { className: "core-focus-trap-ignore-initial core-dialog-close icon", "data-testid": "core-dialog-close", onClick: onClose },
263
- React.createElement(Icon, { iconSpec: React.createElement(SvgClose, null) }))));
264
- return (React.createElement("div", { ref: this.handleRefSet, className: classnames("core-dialog", !modal && "core-dialog-hidden", opened && "core-dialog-opened", className), style: divStyle, "data-testid": "core-dialog-root", ...props }, opened && (React.createElement(DivWithOutsideClick, { onOutsideClick: onOutsideClick },
265
- React.createElement(FocusTrap, { active: trapFocus && modal, returnFocusOnDeactivate: true },
266
- React.createElement("div", { className: classnames("core-dialog-container", this.getCSSClassNameFromAlignment(alignment)), style: { ...containerStyle, ...minMaxStyle }, "data-testid": "core-dialog-container", onPointerDown: this._handleContainerPointerDown },
267
- React.createElement("div", { className: "core-dialog-area", ref: this._containerRef, style: minMaxStyle },
268
- !hideHeader && headerElement,
269
- React.createElement("div", { className: classnames("core-dialog-content", { "core-dialog-content-no-inset": !inset }, contentClassName), style: contentStyle }, this.props.children),
270
- footerElement && (React.createElement("div", { className: "core-dialog-footer", style: footerStyle }, footerElement)),
271
- React.createElement("div", { className: classnames("core-dialog-drag", "core-dialog-drag-right", { "core-dialog-drag-enabled": resizable }), "data-testid": "core-dialog-drag-right", onPointerDown: this._handleStartResizeRight }),
272
- React.createElement("div", { className: classnames("core-dialog-drag", "core-dialog-drag-bottom-mid", { "core-dialog-drag-enabled": resizable }), "data-testid": "core-dialog-drag-bottom", onPointerDown: this._handleStartResizeDown }),
273
- React.createElement("div", { className: classnames("core-dialog-drag", "core-dialog-drag-bottom-right", { "core-dialog-drag-enabled": resizable }), "data-testid": "core-dialog-drag-bottom-right", onPointerDown: this._handleStartResizeDownRight }))))))));
178
+ const buttons = this.getFooterButtons(buttonCluster, "high-visibility", true);
179
+ return (React.createElement(BaseDialog, { isOpen: opened, onClose: onClose, closeOnExternalClick: false, closeOnEsc: false, style: style, className: classnames("core-dialog", className), isDraggable: movable, trapFocus: trapFocus && /* istanbul ignore next */ modal, preventDocumentScroll: true, "data-testid": "core-dialog-root", ...props },
180
+ modal && React.createElement(BaseDialog.Backdrop, { style: backgroundStyle }),
181
+ React.createElement(DivWithOutsideClick, { onOutsideClick: onOutsideClick },
182
+ React.createElement(BaseDialog.Main, { ref: this._containerRef, className: classnames("core-dialog-main", alignment && this.getCSSClassNameFromAlignment(alignment)), "data-testid": "core-dialog-container", style: dialogBaseContainerStyle, onPointerDown: this._handleContainerPointerDown },
183
+ !hideHeader &&
184
+ (header || (React.createElement(BaseDialog.TitleBar, { titleText: title, style: titleStyle, "data-testid": "core-dialog-head" }))),
185
+ React.createElement(BaseDialog.Content, { className: contentClassName, style: { padding: inset ? undefined : 0, ...contentStyle } }, this.props.children),
186
+ footer || (React.createElement(BaseDialog.ButtonBar, { style: footerStyle }, buttons)),
187
+ resizable && (React.createElement(React.Fragment, null,
188
+ React.createElement("div", { className: classnames("core-dialog-resize-bar", "core-drag-right"), onPointerDown: this._handleStartResizeRight, "data-testid": "core-dialog-drag-right" }),
189
+ React.createElement("div", { className: classnames("core-dialog-resize-bar", "core-drag-bottom-right"), onPointerDown: this._handleStartResizeDownRight, "data-testid": "core-dialog-drag-bottom-right" }),
190
+ React.createElement("div", { className: classnames("core-dialog-resize-bar", "core-drag-bottom"), onPointerDown: this._handleStartResizeDown, "data-testid": "core-dialog-drag-bottom" })))))));
274
191
  }
275
192
  getCSSClassNameFromAlignment(alignment) {
276
- let className = "";
277
- // Drop the alignment CSS class if the Dialog has been sized or moved.
278
- if (this.state.positionSet)
279
- return "";
280
- // istanbul ignore next
281
- if (!alignment)
282
- alignment = DialogAlignment.Center;
283
193
  switch (alignment) {
284
194
  case DialogAlignment.TopLeft:
285
- className = "core-dialog-top-left";
286
- break;
195
+ return "core-align-top-left";
287
196
  case DialogAlignment.Top:
288
- className = "core-dialog-top";
289
- break;
197
+ return "core-align-top";
290
198
  case DialogAlignment.TopRight:
291
- className = "core-dialog-top-right";
292
- break;
199
+ return "core-align-top-right";
293
200
  case DialogAlignment.Left:
294
- className = "core-dialog-left";
295
- break;
201
+ return "core-align-left";
296
202
  case DialogAlignment.Center:
297
- className = "core-dialog-center";
298
- break;
203
+ return "core-align-center";
299
204
  case DialogAlignment.Right:
300
- className = "core-dialog-right";
301
- break;
205
+ return "core-align-right";
302
206
  case DialogAlignment.BottomLeft:
303
- className = "core-dialog-bottom-left";
304
- break;
207
+ return "core-align-bottom-left";
305
208
  case DialogAlignment.Bottom:
306
- className = "core-dialog-bottom";
307
- break;
209
+ return "core-align-bottom";
308
210
  case DialogAlignment.BottomRight:
309
- className = "core-dialog-bottom-right";
310
- break;
211
+ return "core-align-bottom-right";
311
212
  }
312
- return className;
313
213
  }
314
- getFooterButtons(buttonCluster, primaryStyleType = "cta", noCoreButtonClasses = false) {
214
+ getFooterButtons(buttonCluster,
215
+ /* istanbul ignore next */ primaryStyleType = "cta",
216
+ /* istanbul ignore next */ noCoreButtonClasses = false) {
315
217
  if (buttonCluster === undefined)
316
218
  return undefined;
317
219
  const buttons = [];
318
220
  buttonCluster.forEach((button, index) => {
319
221
  let buttonText = "";
222
+ // istanbul ignore next
320
223
  let buttonClass = classnames(!noCoreButtonClasses && "core-dialog-button", !noCoreButtonClasses && `dialog-button-${button.type}`, button.className);
321
224
  let usePrimaryStyleType = false;
322
225
  switch (button.type) {
@@ -366,9 +269,9 @@ class Dialog extends React.Component {
366
269
  }
367
270
  }
368
271
  Dialog.defaultProps = {
369
- alignment: DialogAlignment.Center,
370
272
  minWidth: 300,
371
- minHeight: 100,
273
+ minHeight: 135,
274
+ maxWidth: "100%",
372
275
  width: "50%",
373
276
  hideHeader: false,
374
277
  resizable: false,
@@ -1 +1 @@
1
- {"version":3,"file":"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C,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,EAC7D,GAAG,EAAE,KAAK,CAAC,QAAQ,EAAE,EACrB,OAAO,EAAE,MAAM,CAAC,OAAO,IAEtB,UAAU,CACJ,CACV,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;;AA3Ya,mBAAY,GAAyB;IACjD,SAAS,EAAE,eAAe,CAAC,MAAM;IACjC,QAAQ,EAAE,GAAG;IACb,SAAS,EAAE,GAAG;IACd,KAAK,EAAE,KAAK;IACZ,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE,KAAK;IAChB,OAAO,EAAE,KAAK;IACd,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,IAAI;IACX,SAAS,EAAE,KAAK;CACjB,AAXyB,CAWxB;SAdS,MAAM","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Dialog\n */\n\nimport \"./Dialog.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { DialogButtonDef } from \"@itwin/appui-abstract\";\nimport { DialogButtonType, SpecialKey } from \"@itwin/appui-abstract\";\nimport { DivWithOutsideClick } from \"../base/DivWithOutsideClick\";\nimport { UiCore } from \"../UiCore\";\nimport type { CommonProps } from \"../utils/Props\";\nimport type { Omit } from \"../utils/typeUtils\";\nimport { FocusTrap } from \"../focustrap/FocusTrap\";\nimport type { ButtonProps } from \"@itwin/itwinui-react\";\nimport { Button } from \"@itwin/itwinui-react\";\nimport { Icon } from \"../icons/IconComponent\";\nimport { SvgClose } from \"@itwin/itwinui-icons-react\";\n\n// cspell:ignore focustrap\n\n/** Enum for dialog alignment\n * @public\n */\nexport enum DialogAlignment {\n TopLeft = \"top-left\",\n Top = \"top\",\n TopRight = \"top-right\",\n Left = \"left\",\n Center = \"center\",\n Right = \"right\",\n BottomLeft = \"bottom-left\",\n Bottom = \"bottom\",\n BottomRight = \"bottom-right\",\n}\n\n/** Properties for the [[Dialog]] component\n * @public\n */\nexport interface DialogProps\n extends Omit<React.AllHTMLAttributes<HTMLDivElement>, \"title\">,\n CommonProps {\n /** Indicates whether to show dialog or not */\n opened: boolean;\n\n /** Indicates whether the user can resize dialog with cursor. Default: false */\n resizable?: boolean;\n /** Indicates whether the user can move dialog with cursor. Default: false */\n movable?: boolean;\n /** Indicates whether the content should be inset. Default: true */\n inset?: boolean;\n /** Indicates whether the focus should be trapped within the dialog. Default: false */\n trapFocus?: boolean;\n\n /** Whether the hide the header. Default: false */\n hideHeader?: boolean;\n /** Override for the header */\n header?: React.ReactNode;\n /** Title to show in title bar of dialog */\n title?: string | React.ReactElement;\n /** Footer to show at bottom of dialog. Note: will override buttonCluster */\n footer?: string | React.ReactElement;\n /** List of DialogButtonDef objects specifying buttons and associated onClick events */\n buttonCluster?: DialogButtonDef[];\n\n /** Default alignment of dialog. Default: DialogAlignment.Center */\n alignment?: DialogAlignment;\n /** Initial x/left position of dialog in px. */\n x?: number;\n /** Initial y/top position of dialog in px. */\n y?: number;\n\n /** onClick event for X button for dialog */\n onClose?: () => void;\n /** 'keyup' event for Esc key */\n onEscape?: () => void;\n /** Triggered when a click is triggered outside of this dialog. */\n onOutsideClick?: (event: MouseEvent) => any;\n\n /** Initial width of dialog. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: \"50%\" */\n width?: string | number;\n /** Initial height of dialog. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */\n height?: string | number;\n /** Minimum width that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: 300px */\n minWidth?: string | number;\n /** Minimum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: 100px */\n minHeight?: string | number;\n /** Maximum width that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */\n maxWidth?: string | number;\n /** Maximum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */\n maxHeight?: string | number;\n\n /** Whether to show background overlay. Default: true.\n * @note Modeless dialogs require an id and an implementation of onModelessPointerDown.\n */\n modal?: boolean;\n /** An id for a modeless dialog */\n modelessId?: string;\n /** Pointer Down event handler when modeless (modal = false) */\n onModelessPointerDown?: (event: React.PointerEvent, id: string) => void;\n\n /** Custom CSS Style for overlay */\n backgroundStyle?: React.CSSProperties;\n /** Custom CSS Style for title */\n titleStyle?: React.CSSProperties;\n /** Custom CSS Style for footer */\n footerStyle?: React.CSSProperties;\n /** Custom CSS class name for the content */\n contentClassName?: string;\n /** Custom CSS Style for the content */\n contentStyle?: React.CSSProperties;\n}\n\n/** @internal */\ninterface DialogState {\n rightResizing: boolean;\n downResizing: boolean;\n moving: boolean;\n grabOffsetX: number;\n grabOffsetY: number;\n x?: number;\n y?: number;\n width?: number;\n height?: number;\n positionSet: boolean;\n}\n\n/**\n * Dialog React component with optional resizing and dragging functionality\n * @public\n */\nexport class Dialog extends React.Component<DialogProps, DialogState> {\n private _parentDocument = document;\n private _containerRef = React.createRef<HTMLDivElement>();\n public static defaultProps: Partial<DialogProps> = {\n alignment: DialogAlignment.Center,\n minWidth: 300,\n minHeight: 100,\n width: \"50%\",\n hideHeader: false,\n resizable: false,\n movable: false,\n modal: true,\n inset: true,\n trapFocus: false,\n };\n\n /** @internal */\n public override readonly state: Readonly<DialogState>;\n\n constructor(props: DialogProps) {\n super(props);\n this.state = {\n rightResizing: false,\n downResizing: false,\n moving: false,\n grabOffsetX: 0,\n grabOffsetY: 0,\n positionSet: props.x !== undefined || props.y !== undefined,\n };\n }\n\n private getParentWindow() {\n // istanbul ignore next\n return this._parentDocument.defaultView ?? window;\n }\n\n public override componentWillUnmount(): void {\n const parentWindow = this.getParentWindow();\n parentWindow.removeEventListener(\"pointerup\", this._handlePointerUp, true);\n parentWindow.removeEventListener(\n \"pointermove\",\n this._handlePointerMove,\n true\n );\n this._parentDocument.removeEventListener(\"keyup\", this._handleKeyUp, true);\n parentWindow.addEventListener(\"resize\", this._handleAppWindowResize);\n }\n\n /** Keep title bar of movable Dialog at least partially visible */\n // istanbul ignore next\n private _handleAppWindowResize = (): void => {\n if (!this._containerRef.current || !this.props.movable) return;\n\n const parentWindow = this.getParentWindow();\n const { x, y } = this.state;\n let newX: number | undefined;\n let newY: number | undefined;\n\n if (undefined !== y && undefined !== x) {\n if (y > parentWindow.innerHeight - 32)\n newY = parentWindow.innerHeight - 32;\n if (x > parentWindow.innerWidth - 32) newX = parentWindow.innerWidth - 32;\n }\n\n if (newX !== undefined || newY !== undefined)\n this.setState({\n x: newX !== undefined ? newX : x,\n y: newY !== undefined ? newY : y,\n positionSet: true,\n });\n };\n\n public override componentDidMount(): void {\n const parentWindow = this.getParentWindow();\n parentWindow.addEventListener(\"pointerup\", this._handlePointerUp, true);\n this._parentDocument.addEventListener(\"keyup\", this._handleKeyUp, true);\n parentWindow.addEventListener(\"resize\", this._handleAppWindowResize);\n }\n\n public handleRefSet = (containerDiv: HTMLDivElement | null) => {\n if (containerDiv) this._parentDocument = containerDiv.ownerDocument;\n };\n\n public override render(): React.ReactElement {\n const {\n opened,\n title,\n footer,\n buttonCluster,\n onClose,\n onEscape,\n onOutsideClick,\n minWidth,\n minHeight,\n x,\n y,\n width,\n height,\n maxHeight,\n maxWidth,\n backgroundStyle,\n titleStyle,\n footerStyle,\n style,\n contentStyle,\n contentClassName,\n modal,\n resizable,\n movable,\n className,\n alignment,\n inset,\n trapFocus,\n modelessId,\n onModelessPointerDown,\n hideHeader,\n header,\n ...props\n } = this.props;\n\n const containerStyle: React.CSSProperties = {\n margin: \"\",\n left: x,\n top: y,\n width,\n height,\n };\n\n if (this.state.x !== undefined || this.state.y !== undefined) {\n // istanbul ignore else\n if (this.state.x !== undefined) {\n containerStyle.marginLeft = \"0\";\n containerStyle.marginRight = \"0\";\n containerStyle.left = this.state.x;\n }\n // istanbul ignore else\n if (this.state.y !== undefined) {\n containerStyle.marginTop = \"0\";\n containerStyle.marginBottom = \"0\";\n containerStyle.top = this.state.y;\n }\n }\n\n if (this.state.width !== undefined || this.state.height !== undefined) {\n // istanbul ignore else\n if (this.state.width !== undefined)\n containerStyle.width = this.state.width;\n // istanbul ignore else\n if (this.state.height !== undefined)\n containerStyle.height = this.state.height;\n }\n\n const minMaxStyle: React.CSSProperties = {\n minWidth,\n minHeight,\n maxWidth,\n maxHeight,\n };\n\n const buttons = this.getFooterButtons(buttonCluster);\n\n const footerElement: React.ReactNode =\n footer ||\n (buttons && buttons.length > 0 && (\n <div className={\"core-dialog-buttons\"}>{buttons}</div>\n ));\n\n const divStyle: React.CSSProperties = {\n ...backgroundStyle,\n ...style,\n };\n\n const headerElement = header || (\n <div\n className={classnames(\n \"core-dialog-head\",\n { \"core-dialog-movable\": movable },\n { \"core-dialog-modal\": modal }\n )}\n data-testid=\"core-dialog-head\"\n onPointerDown={this._handleStartMove}\n >\n <div\n className={\"core-dialog-title\"}\n data-testid=\"core-dialog-title\"\n style={titleStyle}\n >\n {title}\n </div>\n <button\n className={\"core-focus-trap-ignore-initial core-dialog-close icon\"}\n data-testid=\"core-dialog-close\"\n onClick={onClose}\n >\n <Icon iconSpec={<SvgClose />} />\n </button>\n </div>\n );\n\n return (\n <div\n ref={this.handleRefSet}\n className={classnames(\n \"core-dialog\",\n !modal && \"core-dialog-hidden\",\n opened && \"core-dialog-opened\",\n className\n )}\n style={divStyle}\n data-testid=\"core-dialog-root\"\n {...props}\n >\n {opened && (\n <DivWithOutsideClick onOutsideClick={onOutsideClick}>\n <FocusTrap\n active={trapFocus && modal}\n returnFocusOnDeactivate={true}\n >\n <div\n className={classnames(\n \"core-dialog-container\",\n this.getCSSClassNameFromAlignment(alignment)\n )}\n style={{ ...containerStyle, ...minMaxStyle }}\n data-testid=\"core-dialog-container\"\n onPointerDown={this._handleContainerPointerDown}\n >\n <div\n className={\"core-dialog-area\"}\n ref={this._containerRef}\n style={minMaxStyle}\n >\n {!hideHeader && headerElement}\n <div\n className={classnames(\n \"core-dialog-content\",\n { \"core-dialog-content-no-inset\": !inset },\n contentClassName\n )}\n style={contentStyle}\n >\n {this.props.children}\n </div>\n {footerElement && (\n <div className={\"core-dialog-footer\"} style={footerStyle}>\n {footerElement}\n </div>\n )}\n <div\n className={classnames(\n \"core-dialog-drag\",\n \"core-dialog-drag-right\",\n { \"core-dialog-drag-enabled\": resizable }\n )}\n data-testid=\"core-dialog-drag-right\"\n onPointerDown={this._handleStartResizeRight}\n />\n <div\n className={classnames(\n \"core-dialog-drag\",\n \"core-dialog-drag-bottom-mid\",\n { \"core-dialog-drag-enabled\": resizable }\n )}\n data-testid=\"core-dialog-drag-bottom\"\n onPointerDown={this._handleStartResizeDown}\n />\n <div\n className={classnames(\n \"core-dialog-drag\",\n \"core-dialog-drag-bottom-right\",\n { \"core-dialog-drag-enabled\": resizable }\n )}\n data-testid=\"core-dialog-drag-bottom-right\"\n onPointerDown={this._handleStartResizeDownRight}\n />\n </div>\n </div>\n </FocusTrap>\n </DivWithOutsideClick>\n )}\n </div>\n );\n }\n\n private getCSSClassNameFromAlignment(alignment?: DialogAlignment): string {\n let className = \"\";\n\n // Drop the alignment CSS class if the Dialog has been sized or moved.\n if (this.state.positionSet) return \"\";\n\n // istanbul ignore next\n if (!alignment) alignment = DialogAlignment.Center;\n\n switch (alignment) {\n case DialogAlignment.TopLeft:\n className = \"core-dialog-top-left\";\n break;\n case DialogAlignment.Top:\n className = \"core-dialog-top\";\n break;\n case DialogAlignment.TopRight:\n className = \"core-dialog-top-right\";\n break;\n case DialogAlignment.Left:\n className = \"core-dialog-left\";\n break;\n case DialogAlignment.Center:\n className = \"core-dialog-center\";\n break;\n case DialogAlignment.Right:\n className = \"core-dialog-right\";\n break;\n case DialogAlignment.BottomLeft:\n className = \"core-dialog-bottom-left\";\n break;\n case DialogAlignment.Bottom:\n className = \"core-dialog-bottom\";\n break;\n case DialogAlignment.BottomRight:\n className = \"core-dialog-bottom-right\";\n break;\n }\n\n return className;\n }\n\n protected getFooterButtons(\n buttonCluster: DialogButtonDef[] | undefined,\n primaryStyleType: ButtonProps[\"styleType\"] = \"cta\",\n noCoreButtonClasses: boolean = false\n ): React.ReactNode[] | undefined {\n if (buttonCluster === undefined) return undefined;\n\n const buttons: React.ReactNode[] = [];\n buttonCluster.forEach((button: DialogButtonDef, index: number) => {\n let buttonText = \"\";\n let buttonClass = classnames(\n !noCoreButtonClasses && \"core-dialog-button\",\n !noCoreButtonClasses && `dialog-button-${button.type}`,\n button.className\n );\n let usePrimaryStyleType = false;\n\n switch (button.type) {\n case DialogButtonType.OK:\n buttonText = UiCore.translate(\"dialog.ok\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n case DialogButtonType.Retry:\n buttonText = UiCore.translate(\"dialog.retry\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n case DialogButtonType.Yes:\n buttonText = UiCore.translate(\"dialog.yes\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n case DialogButtonType.No:\n buttonText = UiCore.translate(\"dialog.no\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n break;\n case DialogButtonType.Cancel:\n buttonText = UiCore.translate(\"dialog.cancel\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n break;\n case DialogButtonType.Close:\n buttonText = UiCore.translate(\"dialog.close\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n break;\n case DialogButtonType.Next:\n buttonText = UiCore.translate(\"dialog.next\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n case DialogButtonType.Previous:\n buttonText = UiCore.translate(\"dialog.previous\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n }\n\n if (button.label) buttonText = button.label;\n\n buttons.push(\n <Button\n className={buttonClass}\n disabled={button.disabled}\n styleType={usePrimaryStyleType ? primaryStyleType : undefined}\n key={index.toString()}\n onClick={button.onClick}\n >\n {buttonText}\n </Button>\n );\n });\n return buttons;\n }\n\n private _handleKeyUp = (event: KeyboardEvent) => {\n if (\n event.key === SpecialKey.Escape &&\n this.props.opened &&\n this.props.onEscape\n ) {\n this.props.onEscape();\n }\n };\n\n protected _handleContainerPointerDown = (event: React.PointerEvent): void => {\n if (!this.props.modal) {\n if (this.props.onModelessPointerDown && this.props.modelessId)\n this.props.onModelessPointerDown(event, this.props.modelessId);\n }\n };\n\n private _handleStartResizeRight = (event: React.PointerEvent): void => {\n event.preventDefault();\n this.setState({ rightResizing: true });\n const parentWindow = this.getParentWindow();\n parentWindow.addEventListener(\"pointermove\", this._handlePointerMove, true);\n };\n\n private _handleStartResizeDown = (event: React.PointerEvent): void => {\n event.preventDefault();\n this.setState({ downResizing: true });\n const parentWindow = this.getParentWindow();\n parentWindow.addEventListener(\"pointermove\", this._handlePointerMove, true);\n };\n\n private _handleStartResizeDownRight = (event: React.PointerEvent): void => {\n event.preventDefault();\n this.setState({ downResizing: true, rightResizing: true });\n const parentWindow = this.getParentWindow();\n parentWindow.addEventListener(\"pointermove\", this._handlePointerMove, true);\n };\n\n private _handleStartMove = (event: React.PointerEvent): void => {\n if (!this.props.movable) return;\n\n event.preventDefault();\n // istanbul ignore else\n if (this._containerRef.current) {\n const rect = this._containerRef.current.getBoundingClientRect();\n const grabOffsetX = event.clientX - rect.left;\n const grabOffsetY = event.clientY - rect.top;\n this.setState({\n grabOffsetX,\n grabOffsetY,\n moving: true,\n });\n\n const parentWindow = this.getParentWindow();\n parentWindow.addEventListener(\n \"pointermove\",\n this._handlePointerMove,\n true\n );\n }\n };\n\n private _handlePointerMove = (event: PointerEvent): void => {\n if (\n (!this.props.resizable && !this.props.movable) ||\n !this._containerRef.current\n )\n return;\n\n const { minWidth, maxWidth, minHeight, maxHeight, movable } = this.props;\n let { x, y, width, height } = this.state;\n\n // istanbul ignore else\n if (x === undefined) {\n // if x is undefined, so is y, width, and height\n const rect = this._containerRef.current.getBoundingClientRect();\n (width = rect.width),\n (height = rect.height),\n (x = rect.left),\n (y = rect.top);\n }\n\n if (this.props.resizable) {\n if (this.state.rightResizing) {\n const pointerX = event.clientX;\n width = pointerX - x;\n // istanbul ignore else\n if (typeof minWidth === \"number\") width = Math.max(width, minWidth);\n if (maxWidth !== undefined && typeof maxWidth === \"number\")\n width = Math.min(width, maxWidth);\n }\n\n if (this.state.downResizing) {\n const pointerY = event.clientY;\n height = pointerY - y!;\n // istanbul ignore else\n if (typeof minHeight === \"number\") height = Math.max(height, minHeight);\n if (maxHeight !== undefined && typeof maxHeight === \"number\")\n height = Math.min(height, maxHeight);\n }\n\n this.setState({ width, height });\n }\n\n // istanbul ignore next\n if (movable && this.state.moving) {\n x = event.clientX - this.state.grabOffsetX;\n y = event.clientY - this.state.grabOffsetY;\n if (y < 0) y = 0;\n if (event.view) {\n if (y > event.view.innerHeight - 32) y = event.view.innerHeight - 32;\n if (x > event.view.innerWidth - 32) x = event.view.innerWidth - 32;\n if (width) {\n if (x < 0 - width + 32) x = 0 - width + 32;\n }\n }\n\n this.setState({ x, y, positionSet: true });\n }\n };\n\n private _handlePointerUp = (_event: PointerEvent): void => {\n if (!this.props.movable && !this.props.resizable) return;\n\n // istanbul ignore else\n if (this._containerRef.current) {\n this.setState({\n rightResizing: false,\n downResizing: false,\n moving: false,\n grabOffsetX: 0,\n grabOffsetY: 0,\n });\n }\n\n const parentWindow = this.getParentWindow();\n parentWindow.removeEventListener(\n \"pointermove\",\n this._handlePointerMove,\n true\n );\n };\n}\n"]}
1
+ {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../../src/core-react/dialog/Dialog.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,eAAe,CAAC;AACvB,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE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,CAAC;oBAC3B,MAAM;aACT;YAED,IAAI,MAAM,CAAC,KAAK;gBAAE,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC;YAE5C,OAAO,CAAC,IAAI,CACV,oBAAC,MAAM,IACL,SAAS,EAAE,WAAW,EACtB,QAAQ,EAAE,MAAM,CAAC,QAAQ,EACzB,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,EAC7D,GAAG,EAAE,KAAK,CAAC,QAAQ,EAAE,EACrB,OAAO,EAAE,MAAM,CAAC,OAAO,IAEtB,UAAU,CACJ,CACV,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;;AA9Sa,mBAAY,GAAyB;IACjD,QAAQ,EAAE,GAAG;IACb,SAAS,EAAE,GAAG;IACd,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,KAAK;IACZ,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE,KAAK;IAChB,OAAO,EAAE,KAAK;IACd,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,IAAI;IACX,SAAS,EAAE,KAAK;CACjB,AAXyB,CAWxB;SAdS,MAAM","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Dialog\n */\n\nimport \"./Dialog.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { DialogButtonDef } from \"@itwin/appui-abstract\";\nimport { DialogButtonType, SpecialKey } from \"@itwin/appui-abstract\";\nimport { DivWithOutsideClick } from \"../base/DivWithOutsideClick\";\nimport { UiCore } from \"../UiCore\";\nimport type { CommonProps } from \"../utils/Props\";\nimport type { Omit } from \"../utils/typeUtils\";\nimport { Dialog as BaseDialog } from \"@itwin/itwinui-react\";\nimport { Button } from \"@itwin/itwinui-react\";\nimport type { ButtonProps } from \"@itwin/itwinui-react\";\n\n// cspell:ignore focustrap\n\n/** Enum for dialog alignment\n * @public\n */\nexport enum DialogAlignment {\n TopLeft = \"top-left\",\n Top = \"top\",\n TopRight = \"top-right\",\n Left = \"left\",\n Center = \"center\",\n Right = \"right\",\n BottomLeft = \"bottom-left\",\n Bottom = \"bottom\",\n BottomRight = \"bottom-right\",\n}\n\n/** Properties for the [[Dialog]] component\n * @public\n */\nexport interface DialogProps\n extends Omit<React.AllHTMLAttributes<HTMLDivElement>, \"title\">,\n CommonProps {\n /** Indicates whether to show dialog or not */\n opened: boolean;\n\n /** Indicates whether the user can resize dialog with cursor. Default: false */\n resizable?: boolean;\n /** Indicates whether the user can move dialog with cursor. Default: false */\n movable?: boolean;\n /** Indicates whether the content should be inset. Default: true */\n inset?: boolean;\n /** Indicates whether the focus should be trapped within the dialog. Default: false */\n trapFocus?: boolean;\n\n /** Whether the hide the header. Default: false */\n hideHeader?: boolean;\n /** Override for the header */\n header?: React.ReactNode;\n /** Title to show in title bar of dialog */\n title?: string | React.ReactElement;\n /** Footer to show at bottom of dialog. Note: will override buttonCluster */\n footer?: string | React.ReactElement;\n /** List of DialogButtonDef objects specifying buttons and associated onClick events */\n buttonCluster?: DialogButtonDef[];\n\n /** Default alignment of dialog. */\n alignment?: DialogAlignment;\n /** Initial x/left position of dialog in px. */\n x?: number;\n /** Initial y/top position of dialog in px. */\n y?: number;\n\n /** onClick event for X button for dialog */\n onClose?: () => void;\n /** 'keyup' event for Esc key */\n onEscape?: () => void;\n /** Triggered when a click is triggered outside of this dialog. */\n onOutsideClick?: (event: MouseEvent) => any;\n\n /** Initial width of dialog. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: \"50%\" */\n width?: string | number;\n /** Initial height of dialog. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */\n height?: string | number;\n /** Minimum width that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: 300px */\n minWidth?: string | number;\n /** Minimum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: 135px */\n minHeight?: string | number;\n /** Maximum width that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: 100% */\n maxWidth?: string | number;\n /** Maximum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */\n maxHeight?: string | number;\n\n /** Whether to show background overlay. Default: true.\n * @note Modeless dialogs require an id and an implementation of onModelessPointerDown.\n */\n modal?: boolean;\n /** An id for a modeless dialog */\n modelessId?: string;\n /** Pointer Down event handler when modeless (modal = false) */\n onModelessPointerDown?: (event: React.PointerEvent, id: string) => void;\n\n /** Custom CSS Style for overlay */\n backgroundStyle?: React.CSSProperties;\n /** Custom CSS Style for title */\n titleStyle?: React.CSSProperties;\n /** Custom CSS Style for footer */\n footerStyle?: React.CSSProperties;\n /** Custom CSS class name for the content */\n contentClassName?: string;\n /** Custom CSS Style for the content */\n contentStyle?: React.CSSProperties;\n}\n\n/** @internal */\ninterface DialogState {\n rightResizing: boolean;\n downResizing: boolean;\n x?: number;\n y?: number;\n width?: number;\n height?: number;\n}\n\n/**\n * Dialog React component with optional resizing and dragging functionality\n * @public\n */\nexport class Dialog extends React.Component<DialogProps, DialogState> {\n private _parentDocument = document;\n private _containerRef = React.createRef<HTMLDivElement>();\n public static defaultProps: Partial<DialogProps> = {\n minWidth: 300,\n minHeight: 135,\n maxWidth: \"100%\",\n width: \"50%\",\n hideHeader: false,\n resizable: false,\n movable: false,\n modal: true,\n inset: true,\n trapFocus: false,\n };\n\n /** @internal */\n public override readonly state: Readonly<DialogState>;\n\n constructor(props: DialogProps) {\n super(props);\n this.state = {\n rightResizing: false,\n downResizing: false,\n };\n }\n\n private getParentWindow() {\n // istanbul ignore next\n return this._parentDocument.defaultView ?? window;\n }\n\n public override componentWillUnmount(): void {\n const parentWindow = this.getParentWindow();\n parentWindow.removeEventListener(\"pointerup\", this._handlePointerUp, true);\n parentWindow.removeEventListener(\n \"pointermove\",\n this._handlePointerMove,\n true\n );\n this._parentDocument.removeEventListener(\"keyup\", this._handleKeyUp, true);\n }\n\n public override componentDidMount(): void {\n const parentWindow = this.getParentWindow();\n parentWindow.addEventListener(\"pointerup\", this._handlePointerUp, true);\n this._parentDocument.addEventListener(\"keyup\", this._handleKeyUp, true);\n }\n\n // istanbul ignore next\n public handleRefSet = (containerDiv: HTMLDivElement | null) => {\n if (containerDiv) this._parentDocument = containerDiv.ownerDocument;\n };\n\n public override render(): React.ReactElement {\n const {\n opened,\n title,\n footer,\n buttonCluster,\n onClose,\n onEscape,\n onOutsideClick,\n minWidth,\n minHeight,\n x,\n y,\n width,\n height,\n maxHeight,\n maxWidth,\n backgroundStyle,\n titleStyle,\n footerStyle,\n style,\n contentStyle,\n contentClassName,\n modal,\n resizable,\n movable,\n className,\n alignment,\n inset,\n trapFocus,\n modelessId,\n onModelessPointerDown,\n hideHeader,\n header,\n ...props\n } = this.props;\n\n let initialOffset: React.CSSProperties = {};\n if (x || y) {\n initialOffset = {\n left: x ?? 0,\n top: y ?? 0,\n transform: \"none\",\n };\n }\n\n const containerStyle: React.CSSProperties = {\n ...initialOffset,\n margin: \"\",\n width,\n height,\n };\n\n // istanbul ignore else\n if (this.state.width !== undefined) containerStyle.width = this.state.width;\n // istanbul ignore else\n if (this.state.height !== undefined)\n containerStyle.height = this.state.height;\n\n const minMaxStyle: React.CSSProperties = {\n minWidth,\n minHeight,\n maxWidth,\n maxHeight,\n };\n const dialogBaseContainerStyle: React.CSSProperties = {\n ...containerStyle,\n ...minMaxStyle,\n };\n\n const buttons = this.getFooterButtons(\n buttonCluster,\n \"high-visibility\",\n true\n );\n\n return (\n <BaseDialog\n isOpen={opened}\n onClose={onClose}\n closeOnExternalClick={false}\n closeOnEsc={false}\n style={style}\n className={classnames(\"core-dialog\", className)}\n isDraggable={movable}\n trapFocus={trapFocus && /* istanbul ignore next */ modal}\n preventDocumentScroll={true}\n data-testid=\"core-dialog-root\"\n {...props}\n >\n {modal && <BaseDialog.Backdrop style={backgroundStyle} />}\n <DivWithOutsideClick onOutsideClick={onOutsideClick}>\n <BaseDialog.Main\n ref={this._containerRef}\n className={classnames(\n \"core-dialog-main\",\n alignment && this.getCSSClassNameFromAlignment(alignment)\n )}\n data-testid=\"core-dialog-container\"\n style={dialogBaseContainerStyle}\n onPointerDown={this._handleContainerPointerDown}\n >\n {!hideHeader &&\n (header || (\n <BaseDialog.TitleBar\n titleText={title}\n style={titleStyle}\n data-testid=\"core-dialog-head\"\n />\n ))}\n <BaseDialog.Content\n className={contentClassName}\n style={{ padding: inset ? undefined : 0, ...contentStyle }}\n >\n {this.props.children}\n </BaseDialog.Content>\n {footer || (\n <BaseDialog.ButtonBar style={footerStyle}>\n {buttons}\n </BaseDialog.ButtonBar>\n )}\n {resizable && (\n <>\n <div\n className={classnames(\n \"core-dialog-resize-bar\",\n \"core-drag-right\"\n )}\n onPointerDown={this._handleStartResizeRight}\n data-testid=\"core-dialog-drag-right\"\n />\n <div\n className={classnames(\n \"core-dialog-resize-bar\",\n \"core-drag-bottom-right\"\n )}\n onPointerDown={this._handleStartResizeDownRight}\n data-testid=\"core-dialog-drag-bottom-right\"\n />\n <div\n className={classnames(\n \"core-dialog-resize-bar\",\n \"core-drag-bottom\"\n )}\n onPointerDown={this._handleStartResizeDown}\n data-testid=\"core-dialog-drag-bottom\"\n />\n </>\n )}\n </BaseDialog.Main>\n </DivWithOutsideClick>\n </BaseDialog>\n );\n }\n\n private getCSSClassNameFromAlignment(alignment: DialogAlignment): string {\n switch (alignment) {\n case DialogAlignment.TopLeft:\n return \"core-align-top-left\";\n case DialogAlignment.Top:\n return \"core-align-top\";\n case DialogAlignment.TopRight:\n return \"core-align-top-right\";\n case DialogAlignment.Left:\n return \"core-align-left\";\n case DialogAlignment.Center:\n return \"core-align-center\";\n case DialogAlignment.Right:\n return \"core-align-right\";\n case DialogAlignment.BottomLeft:\n return \"core-align-bottom-left\";\n case DialogAlignment.Bottom:\n return \"core-align-bottom\";\n case DialogAlignment.BottomRight:\n return \"core-align-bottom-right\";\n }\n }\n\n protected getFooterButtons(\n buttonCluster: DialogButtonDef[] | undefined,\n /* istanbul ignore next */ primaryStyleType: ButtonProps[\"styleType\"] = \"cta\",\n /* istanbul ignore next */ noCoreButtonClasses: boolean = false\n ): React.ReactNode[] | undefined {\n if (buttonCluster === undefined) return undefined;\n\n const buttons: React.ReactNode[] = [];\n buttonCluster.forEach((button: DialogButtonDef, index: number) => {\n let buttonText = \"\";\n // istanbul ignore next\n let buttonClass = classnames(\n !noCoreButtonClasses && \"core-dialog-button\",\n !noCoreButtonClasses && `dialog-button-${button.type}`,\n button.className\n );\n let usePrimaryStyleType = false;\n\n switch (button.type) {\n case DialogButtonType.OK:\n buttonText = UiCore.translate(\"dialog.ok\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n case DialogButtonType.Retry:\n buttonText = UiCore.translate(\"dialog.retry\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n case DialogButtonType.Yes:\n buttonText = UiCore.translate(\"dialog.yes\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n case DialogButtonType.No:\n buttonText = UiCore.translate(\"dialog.no\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n break;\n case DialogButtonType.Cancel:\n buttonText = UiCore.translate(\"dialog.cancel\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n break;\n case DialogButtonType.Close:\n buttonText = UiCore.translate(\"dialog.close\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n break;\n case DialogButtonType.Next:\n buttonText = UiCore.translate(\"dialog.next\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n case DialogButtonType.Previous:\n buttonText = UiCore.translate(\"dialog.previous\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n }\n\n if (button.label) buttonText = button.label;\n\n buttons.push(\n <Button\n className={buttonClass}\n disabled={button.disabled}\n styleType={usePrimaryStyleType ? primaryStyleType : undefined}\n key={index.toString()}\n onClick={button.onClick}\n >\n {buttonText}\n </Button>\n );\n });\n return buttons;\n }\n\n private _handleKeyUp = (event: KeyboardEvent) => {\n if (\n event.key === SpecialKey.Escape &&\n this.props.opened &&\n this.props.onEscape\n ) {\n this.props.onEscape();\n }\n };\n\n protected _handleContainerPointerDown = (event: React.PointerEvent): void => {\n if (!this.props.modal) {\n if (this.props.onModelessPointerDown && this.props.modelessId)\n this.props.onModelessPointerDown(event, this.props.modelessId);\n }\n };\n\n private _handleStartResizeRight = (event: React.PointerEvent): void => {\n event.preventDefault();\n this.setState({ rightResizing: true });\n const parentWindow = this.getParentWindow();\n parentWindow.addEventListener(\"pointermove\", this._handlePointerMove, true);\n };\n\n private _handleStartResizeDown = (event: React.PointerEvent): void => {\n event.preventDefault();\n this.setState({ downResizing: true });\n const parentWindow = this.getParentWindow();\n parentWindow.addEventListener(\"pointermove\", this._handlePointerMove, true);\n };\n\n private _handleStartResizeDownRight = (event: React.PointerEvent): void => {\n event.preventDefault();\n this.setState({ downResizing: true, rightResizing: true });\n const parentWindow = this.getParentWindow();\n parentWindow.addEventListener(\"pointermove\", this._handlePointerMove, true);\n };\n\n private _handlePointerMove = (event: PointerEvent): void => {\n // istanbul ignore next\n if (!this.props.resizable || !this._containerRef.current) return;\n\n const { minWidth, maxWidth, minHeight, maxHeight } = this.props;\n let { x, y, width, height } = this.state;\n\n // istanbul ignore else\n if (x === undefined) {\n // if x is undefined, so is y, width, and height\n const rect = this._containerRef.current.getBoundingClientRect();\n (width = rect.width),\n (height = rect.height),\n (x = rect.left),\n (y = rect.top);\n }\n\n if (this.state.rightResizing) {\n const pointerX = event.clientX;\n width = pointerX - x;\n // istanbul ignore else\n if (typeof minWidth === \"number\") width = Math.max(width, minWidth);\n if (maxWidth !== undefined && typeof maxWidth === \"number\")\n width = Math.min(width, maxWidth);\n }\n\n if (this.state.downResizing) {\n const pointerY = event.clientY;\n height = pointerY - y!;\n // istanbul ignore else\n if (typeof minHeight === \"number\") height = Math.max(height, minHeight);\n if (maxHeight !== undefined && typeof maxHeight === \"number\")\n height = Math.min(height, maxHeight);\n }\n\n this.setState({ width, height });\n };\n\n private _handlePointerUp = (_event: PointerEvent): void => {\n if (!this.props.resizable) return;\n\n // istanbul ignore else\n if (this._containerRef.current) {\n this.setState({\n rightResizing: false,\n downResizing: false,\n });\n }\n\n const parentWindow = this.getParentWindow();\n parentWindow.removeEventListener(\n \"pointermove\",\n this._handlePointerMove,\n true\n );\n };\n}\n"]}