@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
@@ -45,7 +45,7 @@ export interface DialogProps extends Omit<React.AllHTMLAttributes<HTMLDivElement
45
45
  footer?: string | React.ReactElement;
46
46
  /** List of DialogButtonDef objects specifying buttons and associated onClick events */
47
47
  buttonCluster?: DialogButtonDef[];
48
- /** Default alignment of dialog. Default: DialogAlignment.Center */
48
+ /** Default alignment of dialog. */
49
49
  alignment?: DialogAlignment;
50
50
  /** Initial x/left position of dialog in px. */
51
51
  x?: number;
@@ -63,9 +63,9 @@ export interface DialogProps extends Omit<React.AllHTMLAttributes<HTMLDivElement
63
63
  height?: string | number;
64
64
  /** 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 */
65
65
  minWidth?: string | number;
66
- /** 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 */
66
+ /** 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 */
67
67
  minHeight?: string | number;
68
- /** Maximum width that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */
68
+ /** 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% */
69
69
  maxWidth?: string | number;
70
70
  /** Maximum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */
71
71
  maxHeight?: string | number;
@@ -92,14 +92,10 @@ export interface DialogProps extends Omit<React.AllHTMLAttributes<HTMLDivElement
92
92
  interface DialogState {
93
93
  rightResizing: boolean;
94
94
  downResizing: boolean;
95
- moving: boolean;
96
- grabOffsetX: number;
97
- grabOffsetY: number;
98
95
  x?: number;
99
96
  y?: number;
100
97
  width?: number;
101
98
  height?: number;
102
- positionSet: boolean;
103
99
  }
104
100
  /**
105
101
  * Dialog React component with optional resizing and dragging functionality
@@ -114,8 +110,6 @@ export declare class Dialog extends React.Component<DialogProps, DialogState> {
114
110
  constructor(props: DialogProps);
115
111
  private getParentWindow;
116
112
  componentWillUnmount(): void;
117
- /** Keep title bar of movable Dialog at least partially visible */
118
- private _handleAppWindowResize;
119
113
  componentDidMount(): void;
120
114
  handleRefSet: (containerDiv: HTMLDivElement | null) => void;
121
115
  render(): React.ReactElement;
@@ -126,7 +120,6 @@ export declare class Dialog extends React.Component<DialogProps, DialogState> {
126
120
  private _handleStartResizeRight;
127
121
  private _handleStartResizeDown;
128
122
  private _handleStartResizeDownRight;
129
- private _handleStartMove;
130
123
  private _handlePointerMove;
131
124
  private _handlePointerUp;
132
125
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../src/core-react/dialog/Dialog.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,eAAe,CAAC;AAEvB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAOxD;;GAEG;AACH,oBAAY,eAAe;IACzB,OAAO,aAAa;IACpB,GAAG,QAAQ;IACX,QAAQ,cAAc;IACtB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,UAAU,gBAAgB;IAC1B,MAAM,WAAW;IACjB,WAAW,iBAAiB;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,EAC5D,WAAW;IACb,8CAA8C;IAC9C,MAAM,EAAE,OAAO,CAAC;IAEhB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6EAA6E;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,SAAyB,KAAK,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;gBAE1C,KAAK,EAAE,WAAW;IAQ9B,OAAO,CAAC,eAAe;IAKP,oBAAoB,IAAI,IAAI;IAW5B,iBAAiB,IAAI,IAAI;IAOlC,YAAY,iBAAkB,cAAc,GAAG,IAAI,UAExD;IAEc,MAAM,IAAI,KAAK,CAAC,YAAY;IA2J5C,OAAO,CAAC,4BAA4B;IAuBpC,SAAS,CAAC,gBAAgB,CACxB,aAAa,EAAE,eAAe,EAAE,GAAG,SAAS,EACjB,gBAAgB,GAAE,WAAW,CAAC,WAAW,CAAS,EAClD,mBAAmB,GAAE,OAAe,GAC9D,KAAK,CAAC,SAAS,EAAE,GAAG,SAAS;IAuEhC,OAAO,CAAC,YAAY,CAQlB;IAEF,SAAS,CAAC,2BAA2B,UAAW,kBAAkB,KAAG,IAAI,CAKvE;IAEF,OAAO,CAAC,uBAAuB,CAK7B;IAEF,OAAO,CAAC,sBAAsB,CAK5B;IAEF,OAAO,CAAC,2BAA2B,CAKjC;IAEF,OAAO,CAAC,kBAAkB,CAoCxB;IAEF,OAAO,CAAC,gBAAgB,CAiBtB;CACH"}
@@ -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,134 +125,100 @@ 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() {
199
- var _a;
200
131
  // istanbul ignore next
201
- return (_a = this._parentDocument.defaultView) !== null && _a !== void 0 ? _a : window;
132
+ return this._parentDocument.defaultView ?? window;
202
133
  }
203
134
  componentWillUnmount() {
204
135
  const parentWindow = this.getParentWindow();
205
136
  parentWindow.removeEventListener("pointerup", this._handlePointerUp, true);
206
137
  parentWindow.removeEventListener("pointermove", this._handlePointerMove, true);
207
138
  this._parentDocument.removeEventListener("keyup", this._handleKeyUp, true);
208
- parentWindow.addEventListener("resize", this._handleAppWindowResize);
209
139
  }
210
140
  componentDidMount() {
211
141
  const parentWindow = this.getParentWindow();
212
142
  parentWindow.addEventListener("pointerup", this._handlePointerUp, true);
213
143
  this._parentDocument.addEventListener("keyup", this._handleKeyUp, true);
214
- parentWindow.addEventListener("resize", this._handleAppWindowResize);
215
144
  }
216
145
  render() {
217
146
  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;
147
+ let initialOffset = {};
148
+ if (x || y) {
149
+ initialOffset = {
150
+ left: x ?? 0,
151
+ top: y ?? 0,
152
+ transform: "none",
153
+ };
154
+ }
218
155
  const containerStyle = {
156
+ ...initialOffset,
219
157
  margin: "",
220
- left: x,
221
- top: y,
222
158
  width,
223
159
  height,
224
160
  };
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
- }
161
+ // istanbul ignore else
162
+ if (this.state.width !== undefined)
163
+ containerStyle.width = this.state.width;
164
+ // istanbul ignore else
165
+ if (this.state.height !== undefined)
166
+ containerStyle.height = this.state.height;
247
167
  const minMaxStyle = {
248
168
  minWidth,
249
169
  minHeight,
250
170
  maxWidth,
251
171
  maxHeight,
252
172
  };
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,
173
+ const dialogBaseContainerStyle = {
174
+ ...containerStyle,
175
+ ...minMaxStyle,
259
176
  };
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 }))))))));
177
+ const buttons = this.getFooterButtons(buttonCluster, "high-visibility", true);
178
+ 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 },
179
+ modal && React.createElement(BaseDialog.Backdrop, { style: backgroundStyle }),
180
+ React.createElement(DivWithOutsideClick, { onOutsideClick: onOutsideClick },
181
+ 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 },
182
+ !hideHeader &&
183
+ (header || (React.createElement(BaseDialog.TitleBar, { titleText: title, style: titleStyle, "data-testid": "core-dialog-head" }))),
184
+ React.createElement(BaseDialog.Content, { className: contentClassName, style: { padding: inset ? undefined : 0, ...contentStyle } }, this.props.children),
185
+ footer || (React.createElement(BaseDialog.ButtonBar, { style: footerStyle }, buttons)),
186
+ resizable && (React.createElement(React.Fragment, null,
187
+ React.createElement("div", { className: classnames("core-dialog-resize-bar", "core-drag-right"), onPointerDown: this._handleStartResizeRight, "data-testid": "core-dialog-drag-right" }),
188
+ React.createElement("div", { className: classnames("core-dialog-resize-bar", "core-drag-bottom-right"), onPointerDown: this._handleStartResizeDownRight, "data-testid": "core-dialog-drag-bottom-right" }),
189
+ React.createElement("div", { className: classnames("core-dialog-resize-bar", "core-drag-bottom"), onPointerDown: this._handleStartResizeDown, "data-testid": "core-dialog-drag-bottom" })))))));
274
190
  }
275
191
  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
192
  switch (alignment) {
284
193
  case DialogAlignment.TopLeft:
285
- className = "core-dialog-top-left";
286
- break;
194
+ return "core-align-top-left";
287
195
  case DialogAlignment.Top:
288
- className = "core-dialog-top";
289
- break;
196
+ return "core-align-top";
290
197
  case DialogAlignment.TopRight:
291
- className = "core-dialog-top-right";
292
- break;
198
+ return "core-align-top-right";
293
199
  case DialogAlignment.Left:
294
- className = "core-dialog-left";
295
- break;
200
+ return "core-align-left";
296
201
  case DialogAlignment.Center:
297
- className = "core-dialog-center";
298
- break;
202
+ return "core-align-center";
299
203
  case DialogAlignment.Right:
300
- className = "core-dialog-right";
301
- break;
204
+ return "core-align-right";
302
205
  case DialogAlignment.BottomLeft:
303
- className = "core-dialog-bottom-left";
304
- break;
206
+ return "core-align-bottom-left";
305
207
  case DialogAlignment.Bottom:
306
- className = "core-dialog-bottom";
307
- break;
208
+ return "core-align-bottom";
308
209
  case DialogAlignment.BottomRight:
309
- className = "core-dialog-bottom-right";
310
- break;
210
+ return "core-align-bottom-right";
311
211
  }
312
- return className;
313
212
  }
314
- getFooterButtons(buttonCluster, primaryStyleType = "cta", noCoreButtonClasses = false) {
213
+ getFooterButtons(buttonCluster,
214
+ /* istanbul ignore next */ primaryStyleType = "cta",
215
+ /* istanbul ignore next */ noCoreButtonClasses = false) {
315
216
  if (buttonCluster === undefined)
316
217
  return undefined;
317
218
  const buttons = [];
318
219
  buttonCluster.forEach((button, index) => {
319
220
  let buttonText = "";
221
+ // istanbul ignore next
320
222
  let buttonClass = classnames(!noCoreButtonClasses && "core-dialog-button", !noCoreButtonClasses && `dialog-button-${button.type}`, button.className);
321
223
  let usePrimaryStyleType = false;
322
224
  switch (button.type) {
@@ -366,9 +268,9 @@ class Dialog extends React.Component {
366
268
  }
367
269
  }
368
270
  Dialog.defaultProps = {
369
- alignment: DialogAlignment.Center,
370
271
  minWidth: 300,
371
- minHeight: 100,
272
+ minHeight: 135,
273
+ maxWidth: "100%",
372
274
  width: "50%",
373
275
  hideHeader: false,
374
276
  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,OAAO,eAAe,CAAC;AACvB,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,OAAO,EAAE,SAAS,EAAE,MAAM,wBAA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,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,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,0BAA0B;AAE1B;;GAEG;AACH,MAAM,CAAN,IAAY,eAUX;AAVD,WAAY,eAAe;IACzB,uCAAoB,CAAA;IACpB,8BAAW,CAAA;IACX,yCAAsB,CAAA;IACtB,gCAAa,CAAA;I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AY,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"]}