@itwin/core-react 4.2.1 → 4.3.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/CHANGELOG.md +1 -6
  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/Gap.js +1 -1
  9. package/lib/cjs/core-react/base/Gap.js.map +1 -1
  10. package/lib/cjs/core-react/base/base.scss +3 -3
  11. package/lib/cjs/core-react/base/index.scss +3 -3
  12. package/lib/cjs/core-react/classes.scss +3 -3
  13. package/lib/cjs/core-react/colorthemes.scss +3 -3
  14. package/lib/cjs/core-react/colorvariables.scss +3 -3
  15. package/lib/cjs/core-react/contextmenu/ContextMenu.js +1 -2
  16. package/lib/cjs/core-react/contextmenu/ContextMenu.js.map +1 -1
  17. package/lib/cjs/core-react/contextmenu/ContextMenu.scss +3 -3
  18. package/lib/cjs/core-react/contextmenu/GlobalContextMenu.js +3 -5
  19. package/lib/cjs/core-react/contextmenu/GlobalContextMenu.js.map +1 -1
  20. package/lib/cjs/core-react/dialog/Dialog.d.ts +3 -10
  21. package/lib/cjs/core-react/dialog/Dialog.d.ts.map +1 -1
  22. package/lib/cjs/core-react/dialog/Dialog.js +70 -168
  23. package/lib/cjs/core-react/dialog/Dialog.js.map +1 -1
  24. package/lib/cjs/core-react/dialog/Dialog.scss +59 -217
  25. package/lib/cjs/core-react/dialog/GlobalDialog.js +1 -2
  26. package/lib/cjs/core-react/dialog/GlobalDialog.js.map +1 -1
  27. package/lib/cjs/core-react/elementseparator/ElementSeparator.js +2 -2
  28. package/lib/cjs/core-react/elementseparator/ElementSeparator.js.map +1 -1
  29. package/lib/cjs/core-react/expandable/index.scss +3 -3
  30. package/lib/cjs/core-react/expandable/list.scss +3 -3
  31. package/lib/cjs/core-react/hocs/withOnOutsideClick.js +1 -2
  32. package/lib/cjs/core-react/hocs/withOnOutsideClick.js.map +1 -1
  33. package/lib/cjs/core-react/icons/IconComponent.js +1 -1
  34. package/lib/cjs/core-react/icons/IconComponent.js.map +1 -1
  35. package/lib/cjs/core-react/icons/SvgPath.scss +3 -3
  36. package/lib/cjs/core-react/icons/WebFontIcon.scss +3 -3
  37. package/lib/cjs/core-react/icons/index.scss +3 -3
  38. package/lib/cjs/core-react/icons/mixins.scss +3 -3
  39. package/lib/cjs/core-react/icons/variables.scss +3 -3
  40. package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.scss +3 -3
  41. package/lib/cjs/core-react/index.scss +3 -3
  42. package/lib/cjs/core-react/inputs/index.scss +3 -3
  43. package/lib/cjs/core-react/inputs/input-label.scss +3 -3
  44. package/lib/cjs/core-react/inputs/input.scss +3 -3
  45. package/lib/cjs/core-react/inputs/numberinput/NumberInput.scss +3 -3
  46. package/lib/cjs/core-react/inputs/variables.scss +3 -3
  47. package/lib/cjs/core-react/listbox/Listbox.js +2 -3
  48. package/lib/cjs/core-react/listbox/Listbox.js.map +1 -1
  49. package/lib/cjs/core-react/listbox/Listbox.scss +3 -3
  50. package/lib/cjs/core-react/loading/LoadingPrompt.scss +3 -3
  51. package/lib/cjs/core-react/loading/LoadingSpinner.scss +3 -3
  52. package/lib/cjs/core-react/loading/index.scss +3 -3
  53. package/lib/cjs/core-react/loading/mixins.scss +3 -3
  54. package/lib/cjs/core-react/messagebox/MessageBox.d.ts.map +1 -1
  55. package/lib/cjs/core-react/messagebox/MessageBox.js +2 -2
  56. package/lib/cjs/core-react/messagebox/MessageBox.js.map +1 -1
  57. package/lib/cjs/core-react/messagebox/MessageBox.scss +3 -3
  58. package/lib/cjs/core-react/notification/MessageRenderer.js +1 -1
  59. package/lib/cjs/core-react/notification/MessageRenderer.js.map +1 -1
  60. package/lib/cjs/core-react/popup/Popup.js +4 -8
  61. package/lib/cjs/core-react/popup/Popup.js.map +1 -1
  62. package/lib/cjs/core-react/popup/Popup.scss +3 -3
  63. package/lib/cjs/core-react/radialmenu/RadialMenu.scss +3 -3
  64. package/lib/cjs/core-react/searchbox/SearchBox.scss +3 -3
  65. package/lib/cjs/core-react/settings/SettingsContainer.scss +3 -3
  66. package/lib/cjs/core-react/style/baseline.scss +3 -3
  67. package/lib/cjs/core-react/style/index.scss +3 -3
  68. package/lib/cjs/core-react/style/opacity.scss +3 -3
  69. package/lib/cjs/core-react/tabs/index.scss +3 -3
  70. package/lib/cjs/core-react/tabs/tabs.scss +3 -3
  71. package/lib/cjs/core-react/tabs/vertical.scss +3 -3
  72. package/lib/cjs/core-react/text/FilteredText.scss +3 -3
  73. package/lib/cjs/core-react/text/block.scss +3 -3
  74. package/lib/cjs/core-react/text/body.scss +3 -3
  75. package/lib/cjs/core-react/text/index.scss +3 -3
  76. package/lib/cjs/core-react/text/mixins.scss +3 -3
  77. package/lib/cjs/core-react/tree/ExpansionToggle.scss +3 -3
  78. package/lib/cjs/core-react/tree/Node.js +1 -2
  79. package/lib/cjs/core-react/tree/Node.js.map +1 -1
  80. package/lib/cjs/core-react/tree/Placeholder.scss +3 -3
  81. package/lib/cjs/core-react/tree/Tree.scss +3 -3
  82. package/lib/cjs/core-react/utils/IconWebComponent.js +1 -1
  83. package/lib/cjs/core-react/utils/IconWebComponent.js.map +1 -1
  84. package/lib/cjs/core-react/utils/getCssVariable.js +1 -1
  85. package/lib/cjs/core-react/utils/getCssVariable.js.map +1 -1
  86. package/lib/cjs/core-react/utils/hooks/useCrossOriginPopup.js +1 -2
  87. package/lib/cjs/core-react/utils/hooks/useCrossOriginPopup.js.map +1 -1
  88. package/lib/cjs/core-react/utils/hooks/useResizeObserver.js +8 -14
  89. package/lib/cjs/core-react/utils/hooks/useResizeObserver.js.map +1 -1
  90. package/lib/esm/core-react/_geometry.scss +3 -3
  91. package/lib/esm/core-react/_math.scss +3 -3
  92. package/lib/esm/core-react/_typography.scss +3 -3
  93. package/lib/esm/core-react/autosuggest/AutoSuggest.scss +3 -3
  94. package/lib/esm/core-react/badge/Badge.scss +3 -3
  95. package/lib/esm/core-react/badge/NewBadge.scss +3 -3
  96. package/lib/esm/core-react/base/Gap.js +1 -1
  97. package/lib/esm/core-react/base/Gap.js.map +1 -1
  98. package/lib/esm/core-react/base/base.scss +3 -3
  99. package/lib/esm/core-react/base/index.scss +3 -3
  100. package/lib/esm/core-react/classes.scss +3 -3
  101. package/lib/esm/core-react/colorthemes.scss +3 -3
  102. package/lib/esm/core-react/colorvariables.scss +3 -3
  103. package/lib/esm/core-react/contextmenu/ContextMenu.js +1 -2
  104. package/lib/esm/core-react/contextmenu/ContextMenu.js.map +1 -1
  105. package/lib/esm/core-react/contextmenu/ContextMenu.scss +3 -3
  106. package/lib/esm/core-react/contextmenu/GlobalContextMenu.js +3 -5
  107. package/lib/esm/core-react/contextmenu/GlobalContextMenu.js.map +1 -1
  108. package/lib/esm/core-react/dialog/Dialog.d.ts +3 -10
  109. package/lib/esm/core-react/dialog/Dialog.d.ts.map +1 -1
  110. package/lib/esm/core-react/dialog/Dialog.js +69 -167
  111. package/lib/esm/core-react/dialog/Dialog.js.map +1 -1
  112. package/lib/esm/core-react/dialog/Dialog.scss +59 -217
  113. package/lib/esm/core-react/dialog/GlobalDialog.js +1 -2
  114. package/lib/esm/core-react/dialog/GlobalDialog.js.map +1 -1
  115. package/lib/esm/core-react/elementseparator/ElementSeparator.js +2 -2
  116. package/lib/esm/core-react/elementseparator/ElementSeparator.js.map +1 -1
  117. package/lib/esm/core-react/expandable/index.scss +3 -3
  118. package/lib/esm/core-react/expandable/list.scss +3 -3
  119. package/lib/esm/core-react/hocs/withOnOutsideClick.js +1 -2
  120. package/lib/esm/core-react/hocs/withOnOutsideClick.js.map +1 -1
  121. package/lib/esm/core-react/icons/IconComponent.js +1 -1
  122. package/lib/esm/core-react/icons/IconComponent.js.map +1 -1
  123. package/lib/esm/core-react/icons/SvgPath.scss +3 -3
  124. package/lib/esm/core-react/icons/WebFontIcon.scss +3 -3
  125. package/lib/esm/core-react/icons/index.scss +3 -3
  126. package/lib/esm/core-react/icons/mixins.scss +3 -3
  127. package/lib/esm/core-react/icons/variables.scss +3 -3
  128. package/lib/esm/core-react/imagecheckbox/ImageCheckBox.scss +3 -3
  129. package/lib/esm/core-react/index.scss +3 -3
  130. package/lib/esm/core-react/inputs/index.scss +3 -3
  131. package/lib/esm/core-react/inputs/input-label.scss +3 -3
  132. package/lib/esm/core-react/inputs/input.scss +3 -3
  133. package/lib/esm/core-react/inputs/numberinput/NumberInput.scss +3 -3
  134. package/lib/esm/core-react/inputs/variables.scss +3 -3
  135. package/lib/esm/core-react/listbox/Listbox.js +2 -3
  136. package/lib/esm/core-react/listbox/Listbox.js.map +1 -1
  137. package/lib/esm/core-react/listbox/Listbox.scss +3 -3
  138. package/lib/esm/core-react/loading/LoadingPrompt.scss +3 -3
  139. package/lib/esm/core-react/loading/LoadingSpinner.scss +3 -3
  140. package/lib/esm/core-react/loading/index.scss +3 -3
  141. package/lib/esm/core-react/loading/mixins.scss +3 -3
  142. package/lib/esm/core-react/messagebox/MessageBox.d.ts.map +1 -1
  143. package/lib/esm/core-react/messagebox/MessageBox.js +2 -2
  144. package/lib/esm/core-react/messagebox/MessageBox.js.map +1 -1
  145. package/lib/esm/core-react/messagebox/MessageBox.scss +3 -3
  146. package/lib/esm/core-react/notification/MessageRenderer.js +1 -1
  147. package/lib/esm/core-react/notification/MessageRenderer.js.map +1 -1
  148. package/lib/esm/core-react/popup/Popup.js +4 -8
  149. package/lib/esm/core-react/popup/Popup.js.map +1 -1
  150. package/lib/esm/core-react/popup/Popup.scss +3 -3
  151. package/lib/esm/core-react/radialmenu/RadialMenu.scss +3 -3
  152. package/lib/esm/core-react/searchbox/SearchBox.scss +3 -3
  153. package/lib/esm/core-react/settings/SettingsContainer.scss +3 -3
  154. package/lib/esm/core-react/style/baseline.scss +3 -3
  155. package/lib/esm/core-react/style/index.scss +3 -3
  156. package/lib/esm/core-react/style/opacity.scss +3 -3
  157. package/lib/esm/core-react/tabs/index.scss +3 -3
  158. package/lib/esm/core-react/tabs/tabs.scss +3 -3
  159. package/lib/esm/core-react/tabs/vertical.scss +3 -3
  160. package/lib/esm/core-react/text/FilteredText.scss +3 -3
  161. package/lib/esm/core-react/text/block.scss +3 -3
  162. package/lib/esm/core-react/text/body.scss +3 -3
  163. package/lib/esm/core-react/text/index.scss +3 -3
  164. package/lib/esm/core-react/text/mixins.scss +3 -3
  165. package/lib/esm/core-react/tree/ExpansionToggle.scss +3 -3
  166. package/lib/esm/core-react/tree/Node.js +1 -2
  167. package/lib/esm/core-react/tree/Node.js.map +1 -1
  168. package/lib/esm/core-react/tree/Placeholder.scss +3 -3
  169. package/lib/esm/core-react/tree/Tree.scss +3 -3
  170. package/lib/esm/core-react/utils/IconWebComponent.js +1 -1
  171. package/lib/esm/core-react/utils/IconWebComponent.js.map +1 -1
  172. package/lib/esm/core-react/utils/getCssVariable.js +1 -1
  173. package/lib/esm/core-react/utils/getCssVariable.js.map +1 -1
  174. package/lib/esm/core-react/utils/hooks/useCrossOriginPopup.js +1 -2
  175. package/lib/esm/core-react/utils/hooks/useCrossOriginPopup.js.map +1 -1
  176. package/lib/esm/core-react/utils/hooks/useResizeObserver.js +8 -14
  177. package/lib/esm/core-react/utils/hooks/useResizeObserver.js.map +1 -1
  178. package/package.json +3 -3
  179. package/lib/cjs/core-react/dialog/SimpleDialog.d.ts +0 -68
  180. package/lib/cjs/core-react/dialog/SimpleDialog.d.ts.map +0 -1
  181. package/lib/cjs/core-react/dialog/SimpleDialog.js +0 -51
  182. package/lib/cjs/core-react/dialog/SimpleDialog.js.map +0 -1
  183. package/lib/esm/core-react/dialog/SimpleDialog.d.ts +0 -68
  184. package/lib/esm/core-react/dialog/SimpleDialog.d.ts.map +0 -1
  185. package/lib/esm/core-react/dialog/SimpleDialog.js +0 -47
  186. package/lib/esm/core-react/dialog/SimpleDialog.js.map +0 -1
@@ -14,10 +14,8 @@ const React = require("react");
14
14
  const appui_abstract_1 = require("@itwin/appui-abstract");
15
15
  const DivWithOutsideClick_1 = require("../base/DivWithOutsideClick");
16
16
  const UiCore_1 = require("../UiCore");
17
- const FocusTrap_1 = require("../focustrap/FocusTrap");
18
17
  const itwinui_react_1 = require("@itwin/itwinui-react");
19
- const IconComponent_1 = require("../icons/IconComponent");
20
- const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
18
+ const itwinui_react_2 = require("@itwin/itwinui-react");
21
19
  // cspell:ignore focustrap
22
20
  /** Enum for dialog alignment
23
21
  * @public
@@ -43,28 +41,7 @@ class Dialog extends React.Component {
43
41
  super(props);
44
42
  this._parentDocument = document;
45
43
  this._containerRef = React.createRef();
46
- /** Keep title bar of movable Dialog at least partially visible */
47
44
  // istanbul ignore next
48
- this._handleAppWindowResize = () => {
49
- if (!this._containerRef.current || !this.props.movable)
50
- return;
51
- const parentWindow = this.getParentWindow();
52
- const { x, y } = this.state;
53
- let newX;
54
- let newY;
55
- if (undefined !== y && undefined !== x) {
56
- if (y > parentWindow.innerHeight - 32)
57
- newY = parentWindow.innerHeight - 32;
58
- if (x > parentWindow.innerWidth - 32)
59
- newX = parentWindow.innerWidth - 32;
60
- }
61
- if (newX !== undefined || newY !== undefined)
62
- this.setState({
63
- x: newX !== undefined ? newX : x,
64
- y: newY !== undefined ? newY : y,
65
- positionSet: true,
66
- });
67
- };
68
45
  this.handleRefSet = (containerDiv) => {
69
46
  if (containerDiv)
70
47
  this._parentDocument = containerDiv.ownerDocument;
@@ -100,29 +77,11 @@ class Dialog extends React.Component {
100
77
  const parentWindow = this.getParentWindow();
101
78
  parentWindow.addEventListener("pointermove", this._handlePointerMove, true);
102
79
  };
103
- this._handleStartMove = (event) => {
104
- if (!this.props.movable)
105
- return;
106
- event.preventDefault();
107
- // istanbul ignore else
108
- if (this._containerRef.current) {
109
- const rect = this._containerRef.current.getBoundingClientRect();
110
- const grabOffsetX = event.clientX - rect.left;
111
- const grabOffsetY = event.clientY - rect.top;
112
- this.setState({
113
- grabOffsetX,
114
- grabOffsetY,
115
- moving: true,
116
- });
117
- const parentWindow = this.getParentWindow();
118
- parentWindow.addEventListener("pointermove", this._handlePointerMove, true);
119
- }
120
- };
121
80
  this._handlePointerMove = (event) => {
122
- if ((!this.props.resizable && !this.props.movable) ||
123
- !this._containerRef.current)
81
+ // istanbul ignore next
82
+ if (!this.props.resizable || !this._containerRef.current)
124
83
  return;
125
- const { minWidth, maxWidth, minHeight, maxHeight, movable } = this.props;
84
+ const { minWidth, maxWidth, minHeight, maxHeight } = this.props;
126
85
  let { x, y, width, height } = this.state;
127
86
  // istanbul ignore else
128
87
  if (x === undefined) {
@@ -133,57 +92,34 @@ class Dialog extends React.Component {
133
92
  (x = rect.left),
134
93
  (y = rect.top);
135
94
  }
136
- if (this.props.resizable) {
137
- if (this.state.rightResizing) {
138
- const pointerX = event.clientX;
139
- width = pointerX - x;
140
- // istanbul ignore else
141
- if (typeof minWidth === "number")
142
- width = Math.max(width, minWidth);
143
- if (maxWidth !== undefined && typeof maxWidth === "number")
144
- width = Math.min(width, maxWidth);
145
- }
146
- if (this.state.downResizing) {
147
- const pointerY = event.clientY;
148
- height = pointerY - y;
149
- // istanbul ignore else
150
- if (typeof minHeight === "number")
151
- height = Math.max(height, minHeight);
152
- if (maxHeight !== undefined && typeof maxHeight === "number")
153
- height = Math.min(height, maxHeight);
154
- }
155
- this.setState({ width, height });
95
+ if (this.state.rightResizing) {
96
+ const pointerX = event.clientX;
97
+ width = pointerX - x;
98
+ // istanbul ignore else
99
+ if (typeof minWidth === "number")
100
+ width = Math.max(width, minWidth);
101
+ if (maxWidth !== undefined && typeof maxWidth === "number")
102
+ width = Math.min(width, maxWidth);
156
103
  }
157
- // istanbul ignore next
158
- if (movable && this.state.moving) {
159
- x = event.clientX - this.state.grabOffsetX;
160
- y = event.clientY - this.state.grabOffsetY;
161
- if (y < 0)
162
- y = 0;
163
- if (event.view) {
164
- if (y > event.view.innerHeight - 32)
165
- y = event.view.innerHeight - 32;
166
- if (x > event.view.innerWidth - 32)
167
- x = event.view.innerWidth - 32;
168
- if (width) {
169
- if (x < 0 - width + 32)
170
- x = 0 - width + 32;
171
- }
172
- }
173
- this.setState({ x, y, positionSet: true });
104
+ if (this.state.downResizing) {
105
+ const pointerY = event.clientY;
106
+ height = pointerY - y;
107
+ // istanbul ignore else
108
+ if (typeof minHeight === "number")
109
+ height = Math.max(height, minHeight);
110
+ if (maxHeight !== undefined && typeof maxHeight === "number")
111
+ height = Math.min(height, maxHeight);
174
112
  }
113
+ this.setState({ width, height });
175
114
  };
176
115
  this._handlePointerUp = (_event) => {
177
- if (!this.props.movable && !this.props.resizable)
116
+ if (!this.props.resizable)
178
117
  return;
179
118
  // istanbul ignore else
180
119
  if (this._containerRef.current) {
181
120
  this.setState({
182
121
  rightResizing: false,
183
122
  downResizing: false,
184
- moving: false,
185
- grabOffsetX: 0,
186
- grabOffsetY: 0,
187
123
  });
188
124
  }
189
125
  const parentWindow = this.getParentWindow();
@@ -192,134 +128,100 @@ class Dialog extends React.Component {
192
128
  this.state = {
193
129
  rightResizing: false,
194
130
  downResizing: false,
195
- moving: false,
196
- grabOffsetX: 0,
197
- grabOffsetY: 0,
198
- positionSet: props.x !== undefined || props.y !== undefined,
199
131
  };
200
132
  }
201
133
  getParentWindow() {
202
- var _a;
203
134
  // istanbul ignore next
204
- return (_a = this._parentDocument.defaultView) !== null && _a !== void 0 ? _a : window;
135
+ return this._parentDocument.defaultView ?? window;
205
136
  }
206
137
  componentWillUnmount() {
207
138
  const parentWindow = this.getParentWindow();
208
139
  parentWindow.removeEventListener("pointerup", this._handlePointerUp, true);
209
140
  parentWindow.removeEventListener("pointermove", this._handlePointerMove, true);
210
141
  this._parentDocument.removeEventListener("keyup", this._handleKeyUp, true);
211
- parentWindow.addEventListener("resize", this._handleAppWindowResize);
212
142
  }
213
143
  componentDidMount() {
214
144
  const parentWindow = this.getParentWindow();
215
145
  parentWindow.addEventListener("pointerup", this._handlePointerUp, true);
216
146
  this._parentDocument.addEventListener("keyup", this._handleKeyUp, true);
217
- parentWindow.addEventListener("resize", this._handleAppWindowResize);
218
147
  }
219
148
  render() {
220
149
  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;
150
+ let initialOffset = {};
151
+ if (x || y) {
152
+ initialOffset = {
153
+ left: x ?? 0,
154
+ top: y ?? 0,
155
+ transform: "none",
156
+ };
157
+ }
221
158
  const containerStyle = {
159
+ ...initialOffset,
222
160
  margin: "",
223
- left: x,
224
- top: y,
225
161
  width,
226
162
  height,
227
163
  };
228
- if (this.state.x !== undefined || this.state.y !== undefined) {
229
- // istanbul ignore else
230
- if (this.state.x !== undefined) {
231
- containerStyle.marginLeft = "0";
232
- containerStyle.marginRight = "0";
233
- containerStyle.left = this.state.x;
234
- }
235
- // istanbul ignore else
236
- if (this.state.y !== undefined) {
237
- containerStyle.marginTop = "0";
238
- containerStyle.marginBottom = "0";
239
- containerStyle.top = this.state.y;
240
- }
241
- }
242
- if (this.state.width !== undefined || this.state.height !== undefined) {
243
- // istanbul ignore else
244
- if (this.state.width !== undefined)
245
- containerStyle.width = this.state.width;
246
- // istanbul ignore else
247
- if (this.state.height !== undefined)
248
- containerStyle.height = this.state.height;
249
- }
164
+ // istanbul ignore else
165
+ if (this.state.width !== undefined)
166
+ containerStyle.width = this.state.width;
167
+ // istanbul ignore else
168
+ if (this.state.height !== undefined)
169
+ containerStyle.height = this.state.height;
250
170
  const minMaxStyle = {
251
171
  minWidth,
252
172
  minHeight,
253
173
  maxWidth,
254
174
  maxHeight,
255
175
  };
256
- const buttons = this.getFooterButtons(buttonCluster);
257
- const footerElement = footer ||
258
- (buttons && buttons.length > 0 && (React.createElement("div", { className: "core-dialog-buttons" }, buttons)));
259
- const divStyle = {
260
- ...backgroundStyle,
261
- ...style,
176
+ const dialogBaseContainerStyle = {
177
+ ...containerStyle,
178
+ ...minMaxStyle,
262
179
  };
263
- const headerElement = header || (React.createElement("div", { className: (0, classnames_1.default)("core-dialog-head", { "core-dialog-movable": movable }, { "core-dialog-modal": modal }), "data-testid": "core-dialog-head", onPointerDown: this._handleStartMove },
264
- React.createElement("div", { className: "core-dialog-title", "data-testid": "core-dialog-title", style: titleStyle }, title),
265
- React.createElement("button", { className: "core-focus-trap-ignore-initial core-dialog-close icon", "data-testid": "core-dialog-close", onClick: onClose },
266
- React.createElement(IconComponent_1.Icon, { iconSpec: React.createElement(itwinui_icons_react_1.SvgClose, null) }))));
267
- return (React.createElement("div", { ref: this.handleRefSet, className: (0, classnames_1.default)("core-dialog", !modal && "core-dialog-hidden", opened && "core-dialog-opened", className), style: divStyle, "data-testid": "core-dialog-root", ...props }, opened && (React.createElement(DivWithOutsideClick_1.DivWithOutsideClick, { onOutsideClick: onOutsideClick },
268
- React.createElement(FocusTrap_1.FocusTrap, { active: trapFocus && modal, returnFocusOnDeactivate: true },
269
- React.createElement("div", { className: (0, classnames_1.default)("core-dialog-container", this.getCSSClassNameFromAlignment(alignment)), style: { ...containerStyle, ...minMaxStyle }, "data-testid": "core-dialog-container", onPointerDown: this._handleContainerPointerDown },
270
- React.createElement("div", { className: "core-dialog-area", ref: this._containerRef, style: minMaxStyle },
271
- !hideHeader && headerElement,
272
- React.createElement("div", { className: (0, classnames_1.default)("core-dialog-content", { "core-dialog-content-no-inset": !inset }, contentClassName), style: contentStyle }, this.props.children),
273
- footerElement && (React.createElement("div", { className: "core-dialog-footer", style: footerStyle }, footerElement)),
274
- React.createElement("div", { className: (0, classnames_1.default)("core-dialog-drag", "core-dialog-drag-right", { "core-dialog-drag-enabled": resizable }), "data-testid": "core-dialog-drag-right", onPointerDown: this._handleStartResizeRight }),
275
- React.createElement("div", { className: (0, classnames_1.default)("core-dialog-drag", "core-dialog-drag-bottom-mid", { "core-dialog-drag-enabled": resizable }), "data-testid": "core-dialog-drag-bottom", onPointerDown: this._handleStartResizeDown }),
276
- React.createElement("div", { className: (0, classnames_1.default)("core-dialog-drag", "core-dialog-drag-bottom-right", { "core-dialog-drag-enabled": resizable }), "data-testid": "core-dialog-drag-bottom-right", onPointerDown: this._handleStartResizeDownRight }))))))));
180
+ const buttons = this.getFooterButtons(buttonCluster, "high-visibility", true);
181
+ return (React.createElement(itwinui_react_1.Dialog, { isOpen: opened, onClose: onClose, closeOnExternalClick: false, closeOnEsc: false, style: style, className: (0, classnames_1.default)("core-dialog", className), isDraggable: movable, trapFocus: trapFocus && /* istanbul ignore next */ modal, preventDocumentScroll: true, "data-testid": "core-dialog-root", ...props },
182
+ modal && React.createElement(itwinui_react_1.Dialog.Backdrop, { style: backgroundStyle }),
183
+ React.createElement(DivWithOutsideClick_1.DivWithOutsideClick, { onOutsideClick: onOutsideClick },
184
+ React.createElement(itwinui_react_1.Dialog.Main, { ref: this._containerRef, className: (0, classnames_1.default)("core-dialog-main", alignment && this.getCSSClassNameFromAlignment(alignment)), "data-testid": "core-dialog-container", style: dialogBaseContainerStyle, onPointerDown: this._handleContainerPointerDown },
185
+ !hideHeader &&
186
+ (header || (React.createElement(itwinui_react_1.Dialog.TitleBar, { titleText: title, style: titleStyle, "data-testid": "core-dialog-head" }))),
187
+ React.createElement(itwinui_react_1.Dialog.Content, { className: contentClassName, style: { padding: inset ? undefined : 0, ...contentStyle } }, this.props.children),
188
+ footer || (React.createElement(itwinui_react_1.Dialog.ButtonBar, { style: footerStyle }, buttons)),
189
+ resizable && (React.createElement(React.Fragment, null,
190
+ React.createElement("div", { className: (0, classnames_1.default)("core-dialog-resize-bar", "core-drag-right"), onPointerDown: this._handleStartResizeRight, "data-testid": "core-dialog-drag-right" }),
191
+ React.createElement("div", { className: (0, classnames_1.default)("core-dialog-resize-bar", "core-drag-bottom-right"), onPointerDown: this._handleStartResizeDownRight, "data-testid": "core-dialog-drag-bottom-right" }),
192
+ React.createElement("div", { className: (0, classnames_1.default)("core-dialog-resize-bar", "core-drag-bottom"), onPointerDown: this._handleStartResizeDown, "data-testid": "core-dialog-drag-bottom" })))))));
277
193
  }
278
194
  getCSSClassNameFromAlignment(alignment) {
279
- let className = "";
280
- // Drop the alignment CSS class if the Dialog has been sized or moved.
281
- if (this.state.positionSet)
282
- return "";
283
- // istanbul ignore next
284
- if (!alignment)
285
- alignment = DialogAlignment.Center;
286
195
  switch (alignment) {
287
196
  case DialogAlignment.TopLeft:
288
- className = "core-dialog-top-left";
289
- break;
197
+ return "core-align-top-left";
290
198
  case DialogAlignment.Top:
291
- className = "core-dialog-top";
292
- break;
199
+ return "core-align-top";
293
200
  case DialogAlignment.TopRight:
294
- className = "core-dialog-top-right";
295
- break;
201
+ return "core-align-top-right";
296
202
  case DialogAlignment.Left:
297
- className = "core-dialog-left";
298
- break;
203
+ return "core-align-left";
299
204
  case DialogAlignment.Center:
300
- className = "core-dialog-center";
301
- break;
205
+ return "core-align-center";
302
206
  case DialogAlignment.Right:
303
- className = "core-dialog-right";
304
- break;
207
+ return "core-align-right";
305
208
  case DialogAlignment.BottomLeft:
306
- className = "core-dialog-bottom-left";
307
- break;
209
+ return "core-align-bottom-left";
308
210
  case DialogAlignment.Bottom:
309
- className = "core-dialog-bottom";
310
- break;
211
+ return "core-align-bottom";
311
212
  case DialogAlignment.BottomRight:
312
- className = "core-dialog-bottom-right";
313
- break;
213
+ return "core-align-bottom-right";
314
214
  }
315
- return className;
316
215
  }
317
- getFooterButtons(buttonCluster, primaryStyleType = "cta", noCoreButtonClasses = false) {
216
+ getFooterButtons(buttonCluster,
217
+ /* istanbul ignore next */ primaryStyleType = "cta",
218
+ /* istanbul ignore next */ noCoreButtonClasses = false) {
318
219
  if (buttonCluster === undefined)
319
220
  return undefined;
320
221
  const buttons = [];
321
222
  buttonCluster.forEach((button, index) => {
322
223
  let buttonText = "";
224
+ // istanbul ignore next
323
225
  let buttonClass = (0, classnames_1.default)(!noCoreButtonClasses && "core-dialog-button", !noCoreButtonClasses && `dialog-button-${button.type}`, button.className);
324
226
  let usePrimaryStyleType = false;
325
227
  switch (button.type) {
@@ -363,15 +265,15 @@ class Dialog extends React.Component {
363
265
  }
364
266
  if (button.label)
365
267
  buttonText = button.label;
366
- buttons.push(React.createElement(itwinui_react_1.Button, { className: buttonClass, disabled: button.disabled, styleType: usePrimaryStyleType ? primaryStyleType : undefined, key: index.toString(), onClick: button.onClick }, buttonText));
268
+ buttons.push(React.createElement(itwinui_react_2.Button, { className: buttonClass, disabled: button.disabled, styleType: usePrimaryStyleType ? primaryStyleType : undefined, key: index.toString(), onClick: button.onClick }, buttonText));
367
269
  });
368
270
  return buttons;
369
271
  }
370
272
  }
371
273
  Dialog.defaultProps = {
372
- alignment: DialogAlignment.Center,
373
274
  minWidth: 300,
374
- minHeight: 100,
275
+ minHeight: 135,
276
+ maxWidth: "100%",
375
277
  width: "50%",
376
278
  hideHeader: false,
377
279
  resizable: false,
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../../src/core-react/dialog/Dialog.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,yBAAuB;AACvB,2CAAoC;AACpC,+BAA+B;AAE/B,0DAAqE;AACrE,qEAAkE;AAClE,sCAAmC;AAGnC,sDAAmD;AAEnD,wDAA8C;AAC9C,0DAA8C;AAC9C,oEAAsD;AAEtD,0BAA0B;AAE1B;;GAEG;AACH,IAAY,eAUX;AAVD,WAAY,eAAe;IACzB,uCAAoB,CAAA;IACpB,8BAAW,CAAA;IACX,yCAAsB,CAAA;IACtB,gCAAa,CAAA;IACb,oCAAiB,CAAA;IACjB,kCAAe,CAAA;IACf,6CAA0B,CAAA;IAC1B,oCAAiB,CAAA;IACjB,+CAA4B,CAAA;AAC9B,CAAC,EAVW,eAAe,G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AAC,WAAW,CAAC,CAAC;oBAC1D,mBAAmB,GAAG,IAAI,CAAC;oBAC3B,MAAM;gBACR,KAAK,iCAAgB,CAAC,QAAQ;oBAC5B,UAAU,GAAG,eAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;oBACjD,WAAW,GAAG,IAAA,oBAAU,EAAC,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;oBAC1D,mBAAmB,GAAG,IAAI,CAAC;oBAC3B,MAAM;aACT;YAED,IAAI,MAAM,CAAC,KAAK;gBAAE,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC;YAE5C,OAAO,CAAC,IAAI,CACV,oBAAC,sBAAM,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;;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;AAdS,wBAAM","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,yBAAuB;AACvB,2CAAoC;AACpC,+BAA+B;AAE/B,0DAAqE;AACrE,qEAAkE;AAClE,sCAAmC;AAGnC,wDAA4D;AAC5D,wDAA8C;AAG9C,0BAA0B;AAE1B;;GAEG;AACH,IAAY,eAUX;AAVD,WAAY,eAAe;IACzB,uCAAoB,CAAA;IACpB,8BAAW,CAAA;IACX,yCAAsB,CAAA;IACtB,gCAAa,CAAA;IACb,oCAAiB,CAAA;IACjB,kCAAe,CAAA;IACf,6CAA0B,CAAA;IAC1B,oCAAiB,CAAA;IACjB,+CAA4B,CAAA;AAC9B,CAAC,EAVW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAU1B;AAyFD;;;GAGG;AACH,MAAa,MAAO,SAAQ,KAAK,CAAC,SAAmC;IAmBnE,YAAY,KAAkB;QAC5B,KAAK,CAAC,KAAK,CAAC,CAAC;QAnBP,oBAAe,GAAG,QAAQ,CAAC;QAC3B,kBAAa,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QA+C1D,uBAAuB;QAChB,iBAAY,GAAG,CAAC,YAAmC,EAAE,EAAE;YAC5D,IAAI,YAAY;gBAAE,IAAI,CAAC,eAAe,GAAG,YAAY,CAAC,aAAa,CAAC;QACtE,CAAC,CAAC;QA+PM,iBAAY,GAAG,CAAC,KAAoB,EAAE,EAAE;YAC9C,IACE,KAAK,CAAC,G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U,EAAC,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;oBAC1D,mBAAmB,GAAG,IAAI,CAAC;oBAC3B,MAAM;gBACR,KAAK,iCAAgB,CAAC,QAAQ;oBAC5B,UAAU,GAAG,eAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;oBACjD,WAAW,GAAG,IAAA,oBAAU,EAAC,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;oBAC1D,mBAAmB,GAAG,IAAI,CAAC;oBAC3B,MAAM;aACT;YAED,IAAI,MAAM,CAAC,KAAK;gBAAE,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC;YAE5C,OAAO,CAAC,IAAI,CACV,oBAAC,sBAAM,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;AAdS,wBAAM","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"]}