@itwin/core-react 3.3.0-dev.7 → 3.3.0-dev.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -1
- package/lib/cjs/core-react/colorvariables.scss +83 -83
- package/lib/cjs/core-react/icons/IconComponent.js +1 -1
- package/lib/cjs/core-react/icons/IconComponent.js.map +1 -1
- package/lib/cjs/core-react/popup/Popup.d.ts +6 -0
- package/lib/cjs/core-react/popup/Popup.d.ts.map +1 -1
- package/lib/cjs/core-react/popup/Popup.js +12 -2
- package/lib/cjs/core-react/popup/Popup.js.map +1 -1
- package/lib/cjs/core-react/utils/IconWebComponent.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/IconWebComponent.js +4 -1
- package/lib/cjs/core-react/utils/IconWebComponent.js.map +1 -1
- package/lib/esm/core-react/colorvariables.scss +83 -83
- package/lib/esm/core-react/icons/IconComponent.js +1 -1
- package/lib/esm/core-react/icons/IconComponent.js.map +1 -1
- package/lib/esm/core-react/popup/Popup.d.ts +6 -0
- package/lib/esm/core-react/popup/Popup.d.ts.map +1 -1
- package/lib/esm/core-react/popup/Popup.js +12 -2
- package/lib/esm/core-react/popup/Popup.js.map +1 -1
- package/lib/esm/core-react/utils/IconWebComponent.d.ts.map +1 -1
- package/lib/esm/core-react/utils/IconWebComponent.js +4 -1
- package/lib/esm/core-react/utils/IconWebComponent.js.map +1 -1
- package/package.json +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
# Change Log - @itwin/core-react
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 13 Jul 2022 15:45:52 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 3.2.5
|
|
6
|
+
Wed, 13 Jul 2022 15:45:52 GMT
|
|
7
|
+
|
|
8
|
+
### Updates
|
|
9
|
+
|
|
10
|
+
- Added a 'repositionOnResize' property on the 'Popup' component, to avoid closing the popup everythime the browser window is resized.
|
|
11
|
+
|
|
12
|
+
## 3.2.4
|
|
13
|
+
Tue, 21 Jun 2022 18:06:33 GMT
|
|
14
|
+
|
|
15
|
+
_Version update only_
|
|
16
|
+
|
|
17
|
+
## 3.2.3
|
|
18
|
+
Fri, 17 Jun 2022 15:18:39 GMT
|
|
19
|
+
|
|
20
|
+
_Version update only_
|
|
21
|
+
|
|
22
|
+
## 3.2.2
|
|
23
|
+
Fri, 10 Jun 2022 16:11:36 GMT
|
|
24
|
+
|
|
25
|
+
_Version update only_
|
|
26
|
+
|
|
27
|
+
## 3.2.1
|
|
28
|
+
Tue, 07 Jun 2022 15:02:56 GMT
|
|
29
|
+
|
|
30
|
+
### Updates
|
|
31
|
+
|
|
32
|
+
- Backport change to update panel background to use same as buic-background-dialog so dispabled itwin ui components display properly.
|
|
33
|
+
|
|
34
|
+
## 3.2.0
|
|
35
|
+
Fri, 20 May 2022 13:10:54 GMT
|
|
36
|
+
|
|
37
|
+
### Updates
|
|
38
|
+
|
|
39
|
+
- Added 'useCrossOriginPopup' and 'useInterval' hooks
|
|
40
|
+
- ListBox component: `onKeyPress` has been deprecated, switch to `onKeyDown`
|
|
41
|
+
- Fix for losing viewport content after clicking PW link
|
|
42
|
+
- Implement svg icons loading as a web component.
|
|
43
|
+
- Allow React icons to be used on Wedget tabs, backstage, and status bar items
|
|
4
44
|
|
|
5
45
|
## 3.1.3
|
|
6
46
|
Fri, 15 Apr 2022 13:49:25 GMT
|
|
@@ -13,104 +13,104 @@
|
|
|
13
13
|
:root {
|
|
14
14
|
|
|
15
15
|
// NEEDSWORK - Need to deprecate these accessory colors
|
|
16
|
-
--buic-accessory-hollow:
|
|
17
|
-
--buic-accessory-primary:
|
|
18
|
-
--buic-accessory-success:
|
|
19
|
-
--buic-accessory-alert:
|
|
20
|
-
--buic-accessory-warning:
|
|
21
|
-
--buic-accessory-primary-tint:
|
|
22
|
-
--buic-accessory-success-tint:
|
|
23
|
-
--buic-accessory-alert-tint:
|
|
24
|
-
--buic-accessory-warning-tint:
|
|
25
|
-
|
|
26
|
-
--buic-background-1-rgb:
|
|
27
|
-
--buic-background-2-rgb:
|
|
28
|
-
--buic-background-3-rgb:
|
|
29
|
-
--buic-background-4-rgb:
|
|
30
|
-
--buic-background-5-rgb:
|
|
31
|
-
|
|
32
|
-
--buic-background-1:
|
|
33
|
-
--buic-background-2:
|
|
34
|
-
--buic-background-3:
|
|
35
|
-
--buic-background-4:
|
|
36
|
-
--buic-background-5:
|
|
37
|
-
--buic-background-primary:
|
|
38
|
-
--buic-background-tooltip:
|
|
39
|
-
--buic-background-scrollbar:
|
|
40
|
-
--buic-background-scrollbar-hover:
|
|
41
|
-
|
|
42
|
-
--buic-foreground-body-rgb:
|
|
43
|
-
--buic-foreground-body:
|
|
44
|
-
--buic-foreground-body-reverse-rgb:
|
|
45
|
-
--buic-foreground-body-reverse:
|
|
46
|
-
--buic-foreground-muted:
|
|
47
|
-
--buic-foreground-disabled:
|
|
48
|
-
--buic-foreground-activehover:
|
|
49
|
-
|
|
50
|
-
--buic-inputs-border:
|
|
51
|
-
--buic-inputs-boxshadow:
|
|
52
|
-
--buic-popup-boxshadow:
|
|
53
|
-
|
|
54
|
-
--buic-foreground-primary:
|
|
55
|
-
--buic-foreground-primary-tone:
|
|
56
|
-
--buic-foreground-focus:
|
|
57
|
-
--buic-foreground-focus-border:
|
|
58
|
-
--buic-focus-boxshadow:
|
|
16
|
+
--buic-accessory-hollow: rgb(255, 255, 255);
|
|
17
|
+
--buic-accessory-primary: rgb(000, 139, 225);
|
|
18
|
+
--buic-accessory-success: rgb(083, 162, 026);
|
|
19
|
+
--buic-accessory-alert: rgb(211, 010, 010);
|
|
20
|
+
--buic-accessory-warning: rgb(241, 139, 018);
|
|
21
|
+
--buic-accessory-primary-tint: rgb(165, 215, 245);
|
|
22
|
+
--buic-accessory-success-tint: rgb(195, 225, 175);
|
|
23
|
+
--buic-accessory-alert-tint: rgb(239, 169, 169);
|
|
24
|
+
--buic-accessory-warning-tint: rgb(249, 215, 171);
|
|
25
|
+
|
|
26
|
+
--buic-background-1-rgb: var(--iui-color-background-1-rgb);
|
|
27
|
+
--buic-background-2-rgb: var(--iui-color-background-2-rgb);
|
|
28
|
+
--buic-background-3-rgb: var(--iui-color-background-3-rgb);
|
|
29
|
+
--buic-background-4-rgb: var(--iui-color-background-4-rgb);
|
|
30
|
+
--buic-background-5-rgb: var(--iui-color-background-5-rgb);
|
|
31
|
+
|
|
32
|
+
--buic-background-1: var(--iui-color-background-1);
|
|
33
|
+
--buic-background-2: var(--iui-color-background-2);
|
|
34
|
+
--buic-background-3: var(--iui-color-background-3);
|
|
35
|
+
--buic-background-4: var(--iui-color-background-4);
|
|
36
|
+
--buic-background-5: var(--iui-color-background-5);
|
|
37
|
+
--buic-background-primary: var(--iui-color-background-primary);
|
|
38
|
+
--buic-background-tooltip: rgba(var(--iui-color-background-5-rgb), 0.90);
|
|
39
|
+
--buic-background-scrollbar: rgba(var(--iui-color-foreground-body-rgb), var(--iui-opacity-4));
|
|
40
|
+
--buic-background-scrollbar-hover: rgba(var(--iui-color-foreground-body-rgb), var(--iui-opacity-3));
|
|
41
|
+
|
|
42
|
+
--buic-foreground-body-rgb: var(--iui-text-color-rgb);
|
|
43
|
+
--buic-foreground-body: var(--iui-text-color);
|
|
44
|
+
--buic-foreground-body-reverse-rgb: var(--iui-color-foreground-body-invert-rgb);
|
|
45
|
+
--buic-foreground-body-reverse: rgba(var(--iui-color-foreground-body-invert-rgb), var(--iui-opacity-2));
|
|
46
|
+
--buic-foreground-muted: var(--iui-text-color-muted);
|
|
47
|
+
--buic-foreground-disabled: var(--iui-text-color-placeholder);
|
|
48
|
+
--buic-foreground-activehover: var(--iui-icons-color-actionable-hover);
|
|
49
|
+
|
|
50
|
+
--buic-inputs-border: rgba(var(--iui-color-foreground-body-rgb), var(--iui-opacity-4));
|
|
51
|
+
--buic-inputs-boxshadow: var(--iui-focus-box-shadow);
|
|
52
|
+
--buic-popup-boxshadow: var(--buic-inputs-boxshadow);
|
|
53
|
+
|
|
54
|
+
--buic-foreground-primary: var(--iui-icons-color-primary);
|
|
55
|
+
--buic-foreground-primary-tone: var(--iui-color-foreground-primary-overlay);
|
|
56
|
+
--buic-foreground-focus: var(--iui-color-foreground-primary-overlay);
|
|
57
|
+
--buic-foreground-focus-border: var(--buic-inputs-border);
|
|
58
|
+
--buic-focus-boxshadow: rgba(var(--iui-color-foreground-primary-rgb), var(--iui-opacity-4));
|
|
59
59
|
|
|
60
60
|
// The following two are still in use by DatePicker and there is no itwinui equivalent
|
|
61
61
|
--buic-focus-boxshadow-gradient1: rgba(var(--buic-foreground-primary-tone-rgb), 0);
|
|
62
62
|
--buic-focus-boxshadow-gradient2: rgba(var(--buic-foreground-primary-rgb), 0.65);
|
|
63
63
|
|
|
64
|
-
--buic-foreground-accessory:
|
|
65
|
-
--buic-foreground-success:
|
|
66
|
-
--buic-foreground-positive:
|
|
67
|
-
--buic-foreground-positive-rgb:
|
|
68
|
-
--buic-foreground-alert:
|
|
69
|
-
--buic-foreground-negative:
|
|
70
|
-
--buic-foreground-negative-rgb:
|
|
71
|
-
--buic-foreground-warning:
|
|
72
|
-
--buic-foreground-warning-rgb:
|
|
64
|
+
--buic-foreground-accessory: var(--iui-color-foreground-accessory);
|
|
65
|
+
--buic-foreground-success: var(--iui-color-foreground-positive);
|
|
66
|
+
--buic-foreground-positive: var(--iui-color-foreground-positive);
|
|
67
|
+
--buic-foreground-positive-rgb: var(--iui-color-foreground-positive-rgb);
|
|
68
|
+
--buic-foreground-alert: var(--iui-color-foreground-negative);
|
|
69
|
+
--buic-foreground-negative: var(--iui-color-foreground-negative);
|
|
70
|
+
--buic-foreground-negative-rgb: var(--iui-color-foreground-negative-rgb);
|
|
71
|
+
--buic-foreground-warning: var(--iui-color-foreground-warning);
|
|
72
|
+
--buic-foreground-warning-rgb: var(--iui-color-foreground-warning-rgb);
|
|
73
73
|
|
|
74
|
-
--buic-background-focus-overlay:
|
|
75
|
-
--buic-background-hover-overlay:
|
|
76
|
-
--buic-background-active-overlay:
|
|
77
|
-
--buic-background-pressed-overlay:
|
|
74
|
+
--buic-background-focus-overlay: rgba(var(--iui-color-foreground-primary-rgb), var(--iui-opacity-6));
|
|
75
|
+
--buic-background-hover-overlay: rgba(var(--iui-color-foreground-primary-rgb), var(--iui-opacity-5));
|
|
76
|
+
--buic-background-active-overlay: rgba(var(--iui-color-foreground-primary-rgb), var(--iui-opacity-5));
|
|
77
|
+
--buic-background-pressed-overlay: rgba(var(--iui-color-foreground-primary-rgb), 0.3);
|
|
78
78
|
|
|
79
|
-
--buic-background-card:
|
|
80
|
-
--buic-background-striped_row:
|
|
79
|
+
--buic-background-card: var(--buic-background-tooltip);
|
|
80
|
+
--buic-background-striped_row: rgba(var(--iui-color-foreground-body-rgb), 0.03);
|
|
81
81
|
|
|
82
82
|
/** background.5 */
|
|
83
|
-
--buic-background-titlebar:
|
|
84
|
-
--buic-background-dialog-stroke:
|
|
85
|
-
--buic-background-widget-stroke:
|
|
86
|
-
--buic-background-control-stroke:
|
|
87
|
-
--buic-background-panel-stroke:
|
|
88
|
-
--buic-background-toolbutton-stroke:
|
|
83
|
+
--buic-background-titlebar: var(--buic-background-5);
|
|
84
|
+
--buic-background-dialog-stroke: var(--buic-background-5);
|
|
85
|
+
--buic-background-widget-stroke: var(--buic-background-5);
|
|
86
|
+
--buic-background-control-stroke: var(--buic-background-5);
|
|
87
|
+
--buic-background-panel-stroke: var(--buic-background-5);
|
|
88
|
+
--buic-background-toolbutton-stroke: var(--buic-background-5);
|
|
89
89
|
|
|
90
90
|
/** background.4 */
|
|
91
|
-
--buic-background-titlebar-outoffocus:
|
|
92
|
-
--buic-background-divider:
|
|
93
|
-
--buic-background-widget-element-stroke:
|
|
94
|
-
--buic-background-statusbar:
|
|
95
|
-
--buic-background-table-header:
|
|
96
|
-
--buic-background-control-stroke-disabled:
|
|
91
|
+
--buic-background-titlebar-outoffocus: var(--buic-background-4);
|
|
92
|
+
--buic-background-divider: var(--buic-background-4);
|
|
93
|
+
--buic-background-widget-element-stroke: var(--buic-background-4);
|
|
94
|
+
--buic-background-statusbar: var(--buic-background-4);
|
|
95
|
+
--buic-background-table-header: var(--buic-background-4);
|
|
96
|
+
--buic-background-control-stroke-disabled: var(--buic-background-4);
|
|
97
97
|
|
|
98
98
|
/** background.3 */
|
|
99
|
-
--buic-background-tab-inactive:
|
|
100
|
-
--buic-background-toolbutton-inactive:
|
|
101
|
-
--buic-background-context-menu:
|
|
102
|
-
--buic-background-panel:
|
|
103
|
-
--buic-background-
|
|
104
|
-
--buic-background-
|
|
105
|
-
--buic-background-control-disabled: var(--buic-background-3);
|
|
99
|
+
--buic-background-tab-inactive: var(--buic-background-3);
|
|
100
|
+
--buic-background-toolbutton-inactive: var(--buic-background-3);
|
|
101
|
+
--buic-background-context-menu: var(--buic-background-3);
|
|
102
|
+
--buic-background-widget-panel: var(--buic-background-3);
|
|
103
|
+
--buic-background-placeholder: var(--buic-background-3);
|
|
104
|
+
--buic-background-control-disabled: var(--buic-background-3);
|
|
106
105
|
|
|
107
106
|
/** background.2 */
|
|
108
|
-
--buic-background-tab-active:
|
|
109
|
-
--buic-background-dialog:
|
|
110
|
-
--buic-background-widget:
|
|
111
|
-
--buic-background-window:
|
|
112
|
-
--buic-background-toolbar:
|
|
107
|
+
--buic-background-tab-active: var(--buic-background-2);
|
|
108
|
+
--buic-background-dialog: var(--buic-background-2);
|
|
109
|
+
--buic-background-widget: var(--buic-background-2);
|
|
110
|
+
--buic-background-window: var(--buic-background-2);
|
|
111
|
+
--buic-background-toolbar: var(--buic-background-2);
|
|
112
|
+
--buic-background-panel: var(--buic-background-2);
|
|
113
113
|
|
|
114
114
|
/** background.1 */
|
|
115
|
-
--buic-background-control:
|
|
115
|
+
--buic-background-control: var(--buic-background-1);
|
|
116
116
|
}
|
|
@@ -31,7 +31,7 @@ function Icon(props) {
|
|
|
31
31
|
React.createElement(SvgSprite_1.SvgSprite, { src: svgSource })));
|
|
32
32
|
const webComponentString = appui_abstract_1.IconSpecUtilities.getWebComponentSource(iconString);
|
|
33
33
|
if (webComponentString) {
|
|
34
|
-
const svgLoader = `<svg-loader src=${webComponentString}
|
|
34
|
+
const svgLoader = `<svg-loader src=${webComponentString}></svg-loader>`;
|
|
35
35
|
const svgDiv = `<div>${svgLoader}</div>`;
|
|
36
36
|
// the esm build of dompurify has a default import but the cjs build does not
|
|
37
37
|
// if there is a default export, use it (likely esm), otherwise use the namespace
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconComponent.js","sourceRoot":"","sources":["../../../../src/core-react/icons/IconComponent.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,4CAA4C;AAC5C;;GAEG;;;AAEH,gCAA8B;AAC9B,+BAA+B;AAC/B,2CAAoC;AACpC,0DAAkF;AAClF,2CAAwC;AAExC,oEAAoD;AAiBpD;;GAEG;AACH,SAAgB,IAAI,CAAC,KAAgB;IACnC,IAAI,CAAC,KAAK,CAAC,QAAQ;QACjB,OAAO,IAAI,CAAC;IAEd,MAAM,UAAU,GAAG,CAAC,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ,IAAI,KAAK,CAAC,QAAQ,YAAY,uCAAsB,CAAC,CAAC,CAAC;QAC3G,uCAAsB,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAE9D,IAAI,UAAU,EAAE;QACd,MAAM,SAAS,GAAG,kCAAiB,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;QAC7D,kIAAkI;QAClI,IAAI,SAAS,KAAK,SAAS;YACzB,OAAO,CACL,2BAAG,SAAS,EAAE,IAAA,oBAAU,EAAC,MAAM,EAAE,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK;gBACpF,oBAAC,qBAAS,IAAC,GAAG,EAAE,SAAS,GAAI,CAC3B,CACL,CAAC;QACJ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ACjF,uBAAuB;YACvB,MAAM,SAAS,GAAG,mBAAS,aAAT,mBAAS,cAAT,mBAAS,GAAI,WAAW,CAAC;YAC3C,MAAM,mBAAmB,GAAG,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,YAAY,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;YACzF,iFAAiF;YACjF,+FAA+F;YAC/F,MAAM,gBAAgB,GAAG,6BAAK,uBAAuB,EAAE,EAAE,MAAM,EAAE,mBAAmB,EAAE,GAAQ,CAAC;YAC/F,OAAO,CACL,2BAAG,SAAS,EAAE,IAAA,oBAAU,EAAC,MAAM,EAAE,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,IAC/D,gBAAgB,CACf,CACL,CAAC;SACH;QACD,OAAO,CAAC,2BAAG,SAAS,EAAE,IAAA,oBAAU,EAAC,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,GAAI,CAAC,CAAC;KAChG;IAED,OAAO,CACL,2BAAG,SAAS,EAAE,IAAA,oBAAU,EAAC,MAAM,EAAE,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,IACnF,KAAK,CAAC,QAAQ,CACb,CACL,CAAC;AACJ,CAAC;AA1CD,oBA0CC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/* eslint-disable deprecation/deprecation */\r\n/** @packageDocumentation\r\n * @module Icon\r\n */\r\n\r\nimport \"./IconComponent.scss\";\r\nimport * as React from \"react\";\r\nimport classnames from \"classnames\";\r\nimport { ConditionalStringValue, IconSpecUtilities } from \"@itwin/appui-abstract\";\r\nimport { SvgSprite } from \"./SvgSprite\";\r\nimport { CommonProps } from \"../utils/Props\";\r\nimport DOMPurify, * as DOMPurifyNS from \"dompurify\";\r\n\r\n/** Prototype for an IconSpec which can be a string, ReactNode or ConditionalStringValue.\r\n * @public\r\n */\r\nexport type IconSpec = string | ConditionalStringValue | React.ReactNode;\r\n\r\n/** Properties for the [[Icon]] React component\r\n * @public\r\n */\r\nexport interface IconProps extends CommonProps {\r\n /** CSS class name or SvgSprite/SvgPath for icon. This is optional because it is improperly\r\n * used to extend other interfaces and changing it would break existing API.\r\n */\r\n iconSpec?: IconSpec;\r\n}\r\n\r\n/** Icon Functional component displays an icon based on an [[IconSpec]].\r\n * @public\r\n */\r\nexport function Icon(props: IconProps) {\r\n if (!props.iconSpec)\r\n return null;\r\n\r\n const iconString = (typeof props.iconSpec === \"string\" || props.iconSpec instanceof ConditionalStringValue) ?\r\n ConditionalStringValue.getValue(props.iconSpec) : undefined;\r\n\r\n if (iconString) {\r\n const svgSource = IconSpecUtilities.getSvgSource(iconString);\r\n // if string begins with \"svg:\" then we assume it was imported (into extension source file) using webpack loader svg-sprite-loader\r\n if (svgSource !== undefined)\r\n return (\r\n <i className={classnames(\"icon\", \"core-svg-icon\", props.className)} style={props.style}>\r\n <SvgSprite src={svgSource} />\r\n </i>\r\n );\r\n const webComponentString = IconSpecUtilities.getWebComponentSource(iconString);\r\n if (webComponentString) {\r\n const svgLoader = `<svg-loader src=${webComponentString}></svg-loader>`;\r\n const svgDiv = `<div>${svgLoader}</div>`;\r\n // the esm build of dompurify has a default import but the cjs build does not\r\n // if there is a default export, use it (likely esm), otherwise use the namespace\r\n // istanbul ignore next\r\n const sanitizer = DOMPurify ?? DOMPurifyNS;\r\n const sanitizedIconString = sanitizer.sanitize(svgDiv, { ALLOWED_TAGS: [\"svg-loader\"] });\r\n // we can safely disable jam3/no-sanitizer-with-danger as we are sanitizing above\r\n // eslint-disable-next-line @typescript-eslint/naming-convention, jam3/no-sanitizer-with-danger\r\n const webComponentNode = <div dangerouslySetInnerHTML={{ __html: sanitizedIconString }}></div>;\r\n return (\r\n <i className={classnames(\"icon\", \"core-svg-icon\", props.className)} >\r\n {webComponentNode}\r\n </i>\r\n );\r\n }\r\n return (<i className={classnames(\"icon\", iconString, props.className)} style={props.style} />);\r\n }\r\n\r\n return (\r\n <i className={classnames(\"icon\", \"core-svg-icon\", props.className)} style={props.style}>\r\n {props.iconSpec}\r\n </i>\r\n );\r\n}\r\n"]}
|
|
@@ -60,6 +60,11 @@ export interface PopupProps extends CommonProps {
|
|
|
60
60
|
/** If true the children are mounted once and unmounted when this component is unmounted. If false the
|
|
61
61
|
* children are unmounted each time the popup is closed. */
|
|
62
62
|
keepContentsMounted?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* If true the popup will remain open and will be repositioned when window resize events occur, default to false.
|
|
65
|
+
* @beta
|
|
66
|
+
* */
|
|
67
|
+
repositionOnResize?: boolean;
|
|
63
68
|
}
|
|
64
69
|
/** @internal */
|
|
65
70
|
interface PopupState {
|
|
@@ -88,6 +93,7 @@ export declare class Popup extends React.Component<PopupProps, PopupState> {
|
|
|
88
93
|
private _handleOutsideClick;
|
|
89
94
|
private _handleContextMenu;
|
|
90
95
|
private _handleKeyboard;
|
|
96
|
+
private _resize;
|
|
91
97
|
private _hide;
|
|
92
98
|
private _onShow;
|
|
93
99
|
private _onClose;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popup.d.ts","sourceRoot":"","sources":["../../../../src/core-react/popup/Popup.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,cAAc,CAAC;AAEtB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAc,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAU7C;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,WAAW;IAC7C,qDAAqD;IACrD,UAAU,EAAE,OAAO,CAAC;IACpB,iDAAiD;IACjD,SAAS,EAAE,OAAO,CAAC;IACnB,sEAAsE;IACtE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,oBAAoB;IAIpC,OAAO,CAAC,iBAAiB,CAQvB;IAEF,OAAO,CAAC,mBAAmB,CAQzB;IAEF,OAAO,CAAC,YAAY,CAUlB;IAEF,OAAO,CAAC,aAAa;IAcrB,OAAO,CAAC,mBAAmB,CAiBzB;IAEF,OAAO,CAAC,kBAAkB,CAUxB;IAEF,OAAO,CAAC,eAAe,CAerB;IAEF,OAAO,CAAC,OAAO,CAQb;IAEF,OAAO,CAAC,KAAK,CAKX;IAEF,OAAO,CAAC,OAAO;IAWf,OAAO,CAAC,QAAQ;IAchB,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,uBAAuB;IA6B/B,OAAO,CAAC,mBAAmB;IAkB3B,OAAO,CAAC,YAAY,CA2ElB;IAEF,OAAO,CAAC,uBAAuB;IAoE/B,OAAO,CAAC,SAAS,CAgCf;IAEF,OAAO,CAAC,mBAAmB,CAIzB;IAEc,MAAM;CA2CvB"}
|
|
@@ -25,7 +25,7 @@ class Popup extends React.Component {
|
|
|
25
25
|
this._bindWindowEvents = () => {
|
|
26
26
|
const activeWindow = this.getParentWindow();
|
|
27
27
|
activeWindow.addEventListener("pointerdown", this._handleOutsideClick);
|
|
28
|
-
activeWindow.addEventListener("resize", this.
|
|
28
|
+
activeWindow.addEventListener("resize", this._resize);
|
|
29
29
|
activeWindow.addEventListener("contextmenu", this._handleContextMenu);
|
|
30
30
|
activeWindow.addEventListener("scroll", this._hide);
|
|
31
31
|
activeWindow.addEventListener("wheel", this._handleWheel);
|
|
@@ -34,7 +34,7 @@ class Popup extends React.Component {
|
|
|
34
34
|
this._unBindWindowEvents = () => {
|
|
35
35
|
const activeWindow = this.getParentWindow();
|
|
36
36
|
activeWindow.removeEventListener("pointerdown", this._handleOutsideClick);
|
|
37
|
-
activeWindow.removeEventListener("resize", this.
|
|
37
|
+
activeWindow.removeEventListener("resize", this._resize);
|
|
38
38
|
activeWindow.removeEventListener("contextmenu", this._handleContextMenu);
|
|
39
39
|
activeWindow.removeEventListener("scroll", this._hide);
|
|
40
40
|
activeWindow.removeEventListener("wheel", this._handleWheel);
|
|
@@ -87,6 +87,16 @@ class Popup extends React.Component {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
};
|
|
90
|
+
this._resize = () => {
|
|
91
|
+
if (this.props.repositionOnResize) {
|
|
92
|
+
const position = this._toggleRelativePosition();
|
|
93
|
+
const point = this._fitPopup(this._getPosition(position));
|
|
94
|
+
this.setState({ left: point.x, top: point.y, position });
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
this._hide(); // legacy behavior
|
|
98
|
+
}
|
|
99
|
+
};
|
|
90
100
|
this._hide = () => {
|
|
91
101
|
if (this.props.isPinned)
|
|
92
102
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popup.js","sourceRoot":"","sources":["../../../../src/core-react/popup/Popup.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,wBAAsB;AACtB,2CAAoC;AACpC,+BAA+B;AAC/B,sCAAsC;AACtC,0DAAqE;AACrE,sDAAmD;AA8EnD;;GAEG;AACH,MAAa,KAAM,SAAQ,KAAK,CAAC,SAAiC;IAGhE,YAAY,KAAiB;;QAC3B,KAAK,CAAC,KAAK,CAAC,CAAC;QAHP,WAAM,GAAuB,IAAI,CAAC;QAkFlC,sBAAiB,GAAG,GAAG,EAAE;YAC/B,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;YAC5C,YAAY,CAAC,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;YACvE,YAAY,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YACpD,YAAY,CAAC,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;YACtE,YAAY,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YACpD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AAvde,kBAAY,GAAwB;IAChD,QAAQ,EAAE,iCAAgB,CAAC,MAAM;IACjC,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,CAAC;IACT,GAAG,EAAE,CAAC,CAAC;IACP,IAAI,EAAE,CAAC,CAAC;CACT,CAAC;AAidJ,SAAS,aAAa,CAAC,KAAa;IAClC,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACnC,OAAO,MAAM,IAAI,CAAC,CAAC;AACrB,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IAChC,OAAO,KAAK,CAAC,CAAC,CAAC,0BAA0B,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Popup\r\n */\r\n\r\nimport \"./Popup.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport * as ReactDOM from \"react-dom\";\r\nimport { RelativePosition, SpecialKey } from \"@itwin/appui-abstract\";\r\nimport { FocusTrap } from \"../focustrap/FocusTrap\";\r\nimport { CommonProps } from \"../utils/Props\";\r\n\r\n// cSpell:ignore focustrap focusable alertdialog\r\n\r\n/** @internal */\r\ninterface PopupPoint {\r\n x: number;\r\n y: number;\r\n}\r\n\r\n/** Properties for the [[Popup]] component\r\n * @public\r\n */\r\nexport interface PopupProps extends CommonProps {\r\n /** Show or hide the box shadow (defaults to true) */\r\n showShadow: boolean;\r\n /** Show or hide the arrow (defaults to false) */\r\n showArrow: boolean;\r\n /** Indicates whether the popup is shown or not (defaults to false) */\r\n isOpen: boolean;\r\n /** Direction (relative to the target) to which the popup is expanded (defaults to Bottom) */\r\n position: RelativePosition;\r\n /** Top position (absolute positioning - defaults to 0) */\r\n top: number;\r\n /** Left position (absolute positioning - defaults to 0) */\r\n left: number;\r\n /** Function called when the popup is opened */\r\n onOpen?: () => void;\r\n /** Function called when user clicks outside the popup */\r\n onOutsideClick?: (e: MouseEvent) => void;\r\n /** Function called when the popup is closed */\r\n onClose?: () => void;\r\n /** Function called when the popup is closed on Enter */\r\n onEnter?: () => void;\r\n /** Function called when the wheel is used */\r\n onWheel?: (e: WheelEvent) => void;\r\n /** Function called when the right mouse button is pressed */\r\n onContextMenu?: (e: MouseEvent) => void;\r\n /** Offset from the parent (defaults to 4) */\r\n offset: number;\r\n /** Target element to position popup */\r\n target?: HTMLElement | null;\r\n /** Role - if not specified \"dialog\" is used */\r\n role?: \"dialog\" | \"alert\" | \"alertdialog\";\r\n /** accessibility label */\r\n ariaLabel?: string;\r\n /** set focus to popup - default to not set focus */\r\n moveFocus?: boolean;\r\n /** Element to receive focus, specified by React.RefObject or CSS selector string. If undefined and moveFocus is true then focus is moved to first focusable element. */\r\n focusTarget?: React.RefObject<HTMLElement> | string;\r\n /** Indicates whether the popup is pinned. */\r\n isPinned?: boolean;\r\n /** Indicates whether to use animation for open/close (defaults to true) */\r\n animate?: boolean;\r\n /** Indicates whether to close the popup when Enter is pressed (defaults to true) */\r\n closeOnEnter?: boolean;\r\n /** Indicates whether to close the popup when the wheel is used (defaults to true) */\r\n closeOnWheel?: boolean;\r\n /** Indicates whether to close the popup when the right mouse button is pressed (defaults to true) */\r\n closeOnContextMenu?: boolean;\r\n /** If false outside click processing and closing are skipped if click occurs in another Popup component, default to false. */\r\n closeOnNestedPopupOutsideClick?: boolean;\r\n /** If true the children are mounted once and unmounted when this component is unmounted. If false the\r\n * children are unmounted each time the popup is closed. */\r\n keepContentsMounted?: boolean;\r\n}\r\n\r\n/** @internal */\r\ninterface PopupState {\r\n isOpen: boolean;\r\n top: number;\r\n left: number;\r\n position: RelativePosition;\r\n parentDocument: Document;\r\n animationEnded: boolean;\r\n}\r\n\r\n/** Popup React component displays a popup relative to an optional target element.\r\n * @public\r\n */\r\nexport class Popup extends React.Component<PopupProps, PopupState> {\r\n private _popup: HTMLElement | null = null;\r\n\r\n constructor(props: PopupProps) {\r\n super(props);\r\n const parentDocument = this.props.target?.ownerDocument ?? document;\r\n\r\n this.state = {\r\n animationEnded: false,\r\n isOpen: this.props.isOpen,\r\n top: 0,\r\n left: 0,\r\n position: this.props.position,\r\n parentDocument,\r\n };\r\n }\r\n\r\n public static defaultProps: Partial<PopupProps> = {\r\n position: RelativePosition.Bottom,\r\n showShadow: true,\r\n showArrow: false,\r\n isOpen: false,\r\n offset: 4,\r\n top: -1,\r\n left: -1,\r\n };\r\n\r\n public override componentDidMount() {\r\n if (this.props.isOpen) {\r\n this._onShow();\r\n }\r\n }\r\n\r\n private getParentWindow() {\r\n // istanbul ignore next\r\n return this.state.parentDocument.defaultView ?? window;\r\n }\r\n\r\n public override componentDidUpdate(previousProps: PopupProps, prevState: PopupState) {\r\n if (this.state.position !== prevState.position) {\r\n this.setState( { animationEnded: false });\r\n }\r\n\r\n if (this.props.target !== previousProps.target) {\r\n // istanbul ignore next\r\n {\r\n const parentDocument = this.props.target?.ownerDocument ?? document;\r\n if (parentDocument !== this.state.parentDocument) {\r\n this._unBindWindowEvents();\r\n this.setState({ parentDocument });\r\n }\r\n }\r\n }\r\n\r\n if (this.props.isOpen === previousProps.isOpen) {\r\n if (this.props.isOpen) {\r\n const position = this._toggleRelativePosition();\r\n const point = this._fitPopup(this._getPosition(position));\r\n if ((Math.abs(this.state.left - point.x) < 3) &&\r\n (Math.abs(this.state.top - point.y) < 3) &&\r\n this.state.position === position)\r\n return;\r\n\r\n this.setState({\r\n left: point.x,\r\n top: point.y,\r\n position,\r\n });\r\n }\r\n return;\r\n }\r\n\r\n if (this.props.isOpen) {\r\n this._onShow();\r\n } else {\r\n this._onClose();\r\n }\r\n }\r\n\r\n public override componentWillUnmount() {\r\n this._unBindWindowEvents();\r\n }\r\n\r\n private _bindWindowEvents = () => {\r\n const activeWindow = this.getParentWindow();\r\n activeWindow.addEventListener(\"pointerdown\", this._handleOutsideClick);\r\n activeWindow.addEventListener(\"resize\", this._hide);\r\n activeWindow.addEventListener(\"contextmenu\", this._handleContextMenu);\r\n activeWindow.addEventListener(\"scroll\", this._hide);\r\n activeWindow.addEventListener(\"wheel\", this._handleWheel);\r\n activeWindow.addEventListener(\"keydown\", this._handleKeyboard);\r\n };\r\n\r\n private _unBindWindowEvents = () => {\r\n const activeWindow = this.getParentWindow();\r\n activeWindow.removeEventListener(\"pointerdown\", this._handleOutsideClick);\r\n activeWindow.removeEventListener(\"resize\", this._hide);\r\n activeWindow.removeEventListener(\"contextmenu\", this._handleContextMenu);\r\n activeWindow.removeEventListener(\"scroll\", this._hide);\r\n activeWindow.removeEventListener(\"wheel\", this._handleWheel);\r\n activeWindow.removeEventListener(\"keydown\", this._handleKeyboard);\r\n };\r\n\r\n private _handleWheel = (event: WheelEvent) => {\r\n if (this._popup && this._popup.contains(event.target as Node))\r\n return;\r\n\r\n if (this.props.onWheel)\r\n return this.props.onWheel(event);\r\n\r\n const closeOnWheel = this.props.closeOnWheel !== undefined ? this.props.closeOnWheel : true;\r\n if (closeOnWheel)\r\n this._hide();\r\n };\r\n\r\n private isInCorePopup(element: HTMLElement): boolean {\r\n if (element.nodeName === \"DIV\") {\r\n if (element.classList && element.classList.contains(\"core-popup\"))\r\n return true;\r\n if (element.parentElement && this.isInCorePopup(element.parentElement))\r\n return true;\r\n } else {\r\n // istanbul ignore else\r\n if (element.parentElement && this.isInCorePopup(element.parentElement))\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n private _handleOutsideClick = (event: MouseEvent): void => {\r\n if (this._popup && this._popup.contains(event.target as Node))\r\n return;\r\n\r\n if (this.props.isPinned)\r\n return;\r\n\r\n if (!this.props.closeOnNestedPopupOutsideClick && this.isInCorePopup(event.target as HTMLElement))\r\n return;\r\n\r\n if (this.props.onOutsideClick)\r\n return this.props.onOutsideClick(event);\r\n\r\n if (this.props.target && this.props.target.contains(event.target as Node))\r\n return;\r\n\r\n this._onClose();\r\n };\r\n\r\n private _handleContextMenu = (event: MouseEvent) => {\r\n if (this._popup && this._popup.contains(event.target as Node))\r\n return;\r\n\r\n if (this.props.onContextMenu)\r\n return this.props.onContextMenu(event);\r\n\r\n const closeOnContextMenu = this.props.closeOnContextMenu !== undefined ? this.props.closeOnContextMenu : true;\r\n if (closeOnContextMenu)\r\n this._hide();\r\n };\r\n\r\n private _handleKeyboard = (event: KeyboardEvent): void => {\r\n if (this.props.isPinned)\r\n return;\r\n\r\n if (event.key === SpecialKey.Escape || event.key === SpecialKey.Enter) {\r\n const closeOnEnter = this.props.closeOnEnter !== undefined ? this.props.closeOnEnter : true;\r\n if (event.key === SpecialKey.Enter) {\r\n if (closeOnEnter)\r\n this._onClose(true);\r\n else\r\n this.props.onEnter && this.props.onEnter();\r\n } else {\r\n this._onClose(false);\r\n }\r\n }\r\n };\r\n\r\n private _hide = () => {\r\n if (this.props.isPinned)\r\n return;\r\n\r\n this._onClose();\r\n };\r\n\r\n private _onShow() {\r\n this._bindWindowEvents();\r\n const position = this._toggleRelativePosition();\r\n const point = this._fitPopup(this._getPosition(position));\r\n\r\n this.setState({ left: point.x, top: point.y, isOpen: true, position }, () => {\r\n if (this.props.onOpen)\r\n this.props.onOpen();\r\n });\r\n }\r\n\r\n private _onClose(enterKey?: boolean) {\r\n if (!this.state.isOpen)\r\n return;\r\n\r\n this._unBindWindowEvents();\r\n\r\n this.setState({ isOpen: false }, () => {\r\n if (enterKey && this.props.onEnter)\r\n this.props.onEnter();\r\n if (this.props.onClose)\r\n this.props.onClose();\r\n });\r\n }\r\n\r\n private _isPositionAbsolute(): boolean {\r\n return (this.props.top !== -1 && this.props.left !== -1);\r\n }\r\n\r\n private _getClassNameByPosition(position: RelativePosition): string {\r\n if (!this._isPositionAbsolute()) {\r\n switch (position) {\r\n case RelativePosition.TopLeft:\r\n return \"core-popup-top-left\";\r\n case RelativePosition.TopRight:\r\n return \"core-popup-top-right\";\r\n case RelativePosition.BottomLeft:\r\n return \"core-popup-bottom-left\";\r\n case RelativePosition.BottomRight:\r\n return \"core-popup-bottom-right\";\r\n case RelativePosition.Top:\r\n return \"core-popup-top\";\r\n case RelativePosition.Left:\r\n return \"core-popup-left\";\r\n case RelativePosition.Right:\r\n return \"core-popup-right\";\r\n case RelativePosition.Bottom:\r\n return \"core-popup-bottom\";\r\n case RelativePosition.LeftTop:\r\n return \"core-popup-left-top\";\r\n case RelativePosition.RightTop:\r\n return \"core-popup-right-top\";\r\n }\r\n }\r\n\r\n return \"\";\r\n }\r\n\r\n private _getPopupDimensions(): { popupWidth: number, popupHeight: number } {\r\n let popupWidth = 0;\r\n let popupHeight = 0;\r\n // istanbul ignore else\r\n if (this._popup) {\r\n const activeWindow = this.getParentWindow();\r\n const style = activeWindow.getComputedStyle(this._popup);\r\n const borderLeftWidth = parsePxString(style.borderLeftWidth);\r\n const borderRightWidth = parsePxString(style.borderRightWidth);\r\n const borderTopWidth = parsePxString(style.borderTopWidth);\r\n const borderBottomWidth = parsePxString(style.borderBottomWidth);\r\n popupWidth = this._popup.clientWidth + borderLeftWidth + borderRightWidth;\r\n popupHeight = this._popup.clientHeight + borderTopWidth + borderBottomWidth;\r\n }\r\n\r\n return { popupWidth, popupHeight };\r\n }\r\n\r\n private _getPosition = (position: RelativePosition) => {\r\n const activeWindow = this.getParentWindow();\r\n const { target, offset, top, left } = this.props;\r\n const offsetArrow = (this.props.showArrow) ? 6 : 0;\r\n\r\n // absolute position\r\n if (this._isPositionAbsolute())\r\n return { x: left, y: top };\r\n\r\n // sanity check\r\n const point = { x: 0, y: 0 };\r\n if (!this._popup || !target)\r\n return point;\r\n\r\n // relative position\r\n const scrollY = activeWindow.scrollY;\r\n const scrollX = activeWindow.scrollX;\r\n\r\n const targetRect = target.getBoundingClientRect();\r\n\r\n const { popupWidth, popupHeight } = this._getPopupDimensions();\r\n\r\n switch (position) {\r\n case RelativePosition.Top:\r\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\r\n point.x = scrollX + targetRect.left + (targetRect.width / 2) - (popupWidth / 2);\r\n break;\r\n\r\n case RelativePosition.TopLeft:\r\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\r\n point.x = scrollX + targetRect.left;\r\n break;\r\n\r\n case RelativePosition.TopRight:\r\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\r\n point.x = scrollX + targetRect.right - popupWidth;\r\n break;\r\n\r\n case RelativePosition.Bottom:\r\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\r\n point.x = scrollX + targetRect.left + (targetRect.width / 2) - (popupWidth / 2);\r\n break;\r\n\r\n case RelativePosition.BottomLeft:\r\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\r\n point.x = scrollX + targetRect.left;\r\n break;\r\n\r\n case RelativePosition.BottomRight:\r\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\r\n point.x = scrollX + targetRect.right - popupWidth;\r\n break;\r\n\r\n case RelativePosition.Left:\r\n point.y = scrollY + targetRect.top + (targetRect.height / 2) - (popupHeight / 2);\r\n point.x = scrollX + targetRect.left - popupWidth - offset - offsetArrow;\r\n break;\r\n\r\n case RelativePosition.LeftTop:\r\n point.y = scrollY + targetRect.top;\r\n point.x = scrollX + targetRect.left - popupWidth - offset - offsetArrow;\r\n break;\r\n\r\n case RelativePosition.Right:\r\n point.y = scrollY + targetRect.top + (targetRect.height / 2) - (popupHeight / 2);\r\n point.x = scrollX + targetRect.right + offset + offsetArrow;\r\n break;\r\n\r\n case RelativePosition.RightTop:\r\n point.y = scrollY + targetRect.top;\r\n point.x = scrollX + targetRect.right + offset + offsetArrow;\r\n break;\r\n }\r\n\r\n return point;\r\n };\r\n\r\n private _toggleRelativePosition(): RelativePosition {\r\n const { target, position, offset } = this.props;\r\n\r\n if (!this._popup || !target)\r\n return position;\r\n\r\n // istanbul ignore if\r\n if (this._isPositionAbsolute())\r\n return position;\r\n\r\n let newPosition = position;\r\n\r\n interface Rect {\r\n left: number;\r\n top: number;\r\n right: number;\r\n bottom: number;\r\n }\r\n\r\n const activeWindow = this.getParentWindow();\r\n\r\n // Note: Cannot use DOMRect yet since it's experimental and not available in all browsers (Nov. 2018)\r\n const viewportRect: Rect = { left: activeWindow.scrollX, top: activeWindow.scrollY, right: activeWindow.scrollX + activeWindow.innerWidth, bottom: activeWindow.scrollY + activeWindow.innerHeight };\r\n const targetRect = target.getBoundingClientRect();\r\n const { popupWidth, popupHeight } = this._getPopupDimensions();\r\n const containerStyle = activeWindow.getComputedStyle(target);\r\n const offsetArrow = this.props.showArrow ? /* istanbul ignore next */ 10 : 2;\r\n\r\n const bottomMargin = parseMargin(containerStyle.marginBottom);\r\n if ((targetRect.bottom + popupHeight + bottomMargin + offsetArrow + offset) > viewportRect.bottom) {\r\n if (newPosition === RelativePosition.Bottom)\r\n newPosition = RelativePosition.Top;\r\n else if (newPosition === RelativePosition.BottomLeft)\r\n newPosition = RelativePosition.TopLeft;\r\n else if (newPosition === RelativePosition.BottomRight)\r\n newPosition = RelativePosition.TopRight;\r\n }\r\n\r\n const topMargin = parseMargin(containerStyle.marginTop);\r\n if ((targetRect.top - popupHeight - topMargin - offsetArrow - offset) < viewportRect.top) {\r\n if (newPosition === RelativePosition.Top)\r\n newPosition = RelativePosition.Bottom;\r\n else if (newPosition === RelativePosition.TopLeft)\r\n newPosition = RelativePosition.BottomLeft;\r\n else if (newPosition === RelativePosition.TopRight)\r\n newPosition = RelativePosition.BottomRight;\r\n }\r\n\r\n const leftMargin = parseMargin(containerStyle.marginLeft);\r\n if ((targetRect.left - popupWidth - leftMargin - offsetArrow - offset) < viewportRect.left) {\r\n if (newPosition === RelativePosition.Left)\r\n newPosition = RelativePosition.Right;\r\n else if (newPosition === RelativePosition.LeftTop)\r\n newPosition = RelativePosition.RightTop;\r\n }\r\n\r\n const rightMargin = parseMargin(containerStyle.marginRight);\r\n if ((targetRect.right + popupWidth + rightMargin + offsetArrow + offset) > viewportRect.right) {\r\n if (newPosition === RelativePosition.Right)\r\n newPosition = RelativePosition.Left;\r\n else if (newPosition === RelativePosition.RightTop)\r\n newPosition = RelativePosition.LeftTop;\r\n }\r\n\r\n return newPosition;\r\n }\r\n\r\n // fit the popup within the extents of the view port\r\n private _fitPopup = (point: PopupPoint) => {\r\n const fittedPoint = point;\r\n\r\n // istanbul ignore if\r\n if (!this._popup) {\r\n return fittedPoint;\r\n }\r\n\r\n // const popupRect = this._popup.getBoundingClientRect();\r\n const { popupWidth, popupHeight } = this._getPopupDimensions();\r\n const { innerWidth, innerHeight } = window;\r\n\r\n // istanbul ignore if\r\n if (fittedPoint.y + popupHeight > innerHeight) {\r\n fittedPoint.y = innerHeight - popupHeight;\r\n }\r\n\r\n // istanbul ignore if\r\n if (fittedPoint.x + popupWidth > innerWidth) {\r\n fittedPoint.x = innerWidth - popupWidth;\r\n }\r\n\r\n // istanbul ignore if\r\n if (fittedPoint.y < 0) {\r\n fittedPoint.y = 0;\r\n }\r\n\r\n if (fittedPoint.x < 0) {\r\n fittedPoint.x = 0;\r\n }\r\n\r\n return fittedPoint;\r\n };\r\n\r\n private _handleAnimationEnd = (event: React.AnimationEvent<HTMLDivElement>) => {\r\n if (event.target === this._popup) {\r\n this.setState({ animationEnded: true });\r\n }\r\n };\r\n\r\n public override render() {\r\n const animate = this.props.animate !== undefined ? this.props.animate : true;\r\n const className = classnames(\r\n \"core-popup\",\r\n this._getClassNameByPosition(this.state.position),\r\n this.props.showShadow && \"core-popup-shadow\",\r\n this.props.showArrow && \"arrow\",\r\n !animate && \"core-popup-animation-none\",\r\n this.props.className,\r\n this.state.animationEnded && \"core-animation-ended\",\r\n (!this.props.isOpen && this.props.keepContentsMounted) && \"core-popup-hidden\"\r\n );\r\n\r\n const style: React.CSSProperties = {\r\n top: this.state.top,\r\n left: this.state.left,\r\n ...this.props.style,\r\n };\r\n\r\n const role = this.props.role ? this.props.role : \"dialog\"; // accessibility property\r\n\r\n if (!this.props.isOpen && !this.props.keepContentsMounted) {\r\n return null;\r\n }\r\n\r\n return ReactDOM.createPortal(\r\n (\r\n <div\r\n className={className} data-testid=\"core-popup\"\r\n ref={(element) => { this._popup = element; }}\r\n style={style}\r\n role={role}\r\n aria-modal={true}\r\n tabIndex={-1}\r\n aria-label={this.props.ariaLabel}\r\n onAnimationEnd={this._handleAnimationEnd}\r\n >\r\n <FocusTrap active={!!this.props.moveFocus} initialFocusElement={this.props.focusTarget} returnFocusOnDeactivate={true}>\r\n {this.props.children}\r\n </FocusTrap>\r\n </div>\r\n ), this.state.parentDocument.body);\r\n }\r\n}\r\n\r\nfunction parsePxString(pxStr: string): number {\r\n const parsed = parseInt(pxStr, 10);\r\n return parsed || 0;\r\n}\r\n\r\nfunction parseMargin(value: string) {\r\n return value ? /* istanbul ignore next */ parseFloat(value) : 0;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Popup.js","sourceRoot":"","sources":["../../../../src/core-react/popup/Popup.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,wBAAsB;AACtB,2CAAoC;AACpC,+BAA+B;AAC/B,sCAAsC;AACtC,0DAAqE;AACrE,sDAAmD;AAoFnD;;GAEG;AACH,MAAa,KAAM,SAAQ,KAAK,CAAC,SAAiC;IAGhE,YAAY,KAAiB;;QAC3B,KAAK,CAAC,KAAK,CAAC,CAAC;QAHP,WAAM,GAAuB,IAAI,CAAC;QAkFlC,sBAAiB,GAAG,GAAG,EAAE;YAC/B,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;YAC5C,YAAY,CAAC,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;YACvE,YAAY,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;YACtD,YAAY,CAAC,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAA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AAE,CAAC,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,EAC5C,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,gBACE,IAAI,EAChB,QAAQ,EAAE,CAAC,CAAC,gBACA,IAAI,CAAC,KAAK,CAAC,SAAS,EAChC,cAAc,EAAE,IAAI,CAAC,mBAAmB;YAExC,oBAAC,qBAAS,IAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,mBAAmB,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,uBAAuB,EAAE,IAAI,IAClH,IAAI,CAAC,KAAK,CAAC,QAAQ,CACV,CACR,CACP,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;;AAjfH,sBAkfC;AAjee,kBAAY,GAAwB;IAChD,QAAQ,EAAE,iCAAgB,CAAC,MAAM;IACjC,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,CAAC;IACT,GAAG,EAAE,CAAC,CAAC;IACP,IAAI,EAAE,CAAC,CAAC;CACT,CAAC;AA2dJ,SAAS,aAAa,CAAC,KAAa;IAClC,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACnC,OAAO,MAAM,IAAI,CAAC,CAAC;AACrB,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IAChC,OAAO,KAAK,CAAC,CAAC,CAAC,0BAA0B,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Popup\r\n */\r\n\r\nimport \"./Popup.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport * as ReactDOM from \"react-dom\";\r\nimport { RelativePosition, SpecialKey } from \"@itwin/appui-abstract\";\r\nimport { FocusTrap } from \"../focustrap/FocusTrap\";\r\nimport { CommonProps } from \"../utils/Props\";\r\n\r\n// cSpell:ignore focustrap focusable alertdialog\r\n\r\n/** @internal */\r\ninterface PopupPoint {\r\n x: number;\r\n y: number;\r\n}\r\n\r\n/** Properties for the [[Popup]] component\r\n * @public\r\n */\r\nexport interface PopupProps extends CommonProps {\r\n /** Show or hide the box shadow (defaults to true) */\r\n showShadow: boolean;\r\n /** Show or hide the arrow (defaults to false) */\r\n showArrow: boolean;\r\n /** Indicates whether the popup is shown or not (defaults to false) */\r\n isOpen: boolean;\r\n /** Direction (relative to the target) to which the popup is expanded (defaults to Bottom) */\r\n position: RelativePosition;\r\n /** Top position (absolute positioning - defaults to 0) */\r\n top: number;\r\n /** Left position (absolute positioning - defaults to 0) */\r\n left: number;\r\n /** Function called when the popup is opened */\r\n onOpen?: () => void;\r\n /** Function called when user clicks outside the popup */\r\n onOutsideClick?: (e: MouseEvent) => void;\r\n /** Function called when the popup is closed */\r\n onClose?: () => void;\r\n /** Function called when the popup is closed on Enter */\r\n onEnter?: () => void;\r\n /** Function called when the wheel is used */\r\n onWheel?: (e: WheelEvent) => void;\r\n /** Function called when the right mouse button is pressed */\r\n onContextMenu?: (e: MouseEvent) => void;\r\n /** Offset from the parent (defaults to 4) */\r\n offset: number;\r\n /** Target element to position popup */\r\n target?: HTMLElement | null;\r\n /** Role - if not specified \"dialog\" is used */\r\n role?: \"dialog\" | \"alert\" | \"alertdialog\";\r\n /** accessibility label */\r\n ariaLabel?: string;\r\n /** set focus to popup - default to not set focus */\r\n moveFocus?: boolean;\r\n /** Element to receive focus, specified by React.RefObject or CSS selector string. If undefined and moveFocus is true then focus is moved to first focusable element. */\r\n focusTarget?: React.RefObject<HTMLElement> | string;\r\n /** Indicates whether the popup is pinned. */\r\n isPinned?: boolean;\r\n /** Indicates whether to use animation for open/close (defaults to true) */\r\n animate?: boolean;\r\n /** Indicates whether to close the popup when Enter is pressed (defaults to true) */\r\n closeOnEnter?: boolean;\r\n /** Indicates whether to close the popup when the wheel is used (defaults to true) */\r\n closeOnWheel?: boolean;\r\n /** Indicates whether to close the popup when the right mouse button is pressed (defaults to true) */\r\n closeOnContextMenu?: boolean;\r\n /** If false outside click processing and closing are skipped if click occurs in another Popup component, default to false. */\r\n closeOnNestedPopupOutsideClick?: boolean;\r\n /** If true the children are mounted once and unmounted when this component is unmounted. If false the\r\n * children are unmounted each time the popup is closed. */\r\n keepContentsMounted?: boolean;\r\n\r\n /**\r\n * If true the popup will remain open and will be repositioned when window resize events occur, default to false.\r\n * @beta\r\n * */\r\n repositionOnResize?: boolean;\r\n}\r\n\r\n/** @internal */\r\ninterface PopupState {\r\n isOpen: boolean;\r\n top: number;\r\n left: number;\r\n position: RelativePosition;\r\n parentDocument: Document;\r\n animationEnded: boolean;\r\n}\r\n\r\n/** Popup React component displays a popup relative to an optional target element.\r\n * @public\r\n */\r\nexport class Popup extends React.Component<PopupProps, PopupState> {\r\n private _popup: HTMLElement | null = null;\r\n\r\n constructor(props: PopupProps) {\r\n super(props);\r\n const parentDocument = this.props.target?.ownerDocument ?? document;\r\n\r\n this.state = {\r\n animationEnded: false,\r\n isOpen: this.props.isOpen,\r\n top: 0,\r\n left: 0,\r\n position: this.props.position,\r\n parentDocument,\r\n };\r\n }\r\n\r\n public static defaultProps: Partial<PopupProps> = {\r\n position: RelativePosition.Bottom,\r\n showShadow: true,\r\n showArrow: false,\r\n isOpen: false,\r\n offset: 4,\r\n top: -1,\r\n left: -1,\r\n };\r\n\r\n public override componentDidMount() {\r\n if (this.props.isOpen) {\r\n this._onShow();\r\n }\r\n }\r\n\r\n private getParentWindow() {\r\n // istanbul ignore next\r\n return this.state.parentDocument.defaultView ?? window;\r\n }\r\n\r\n public override componentDidUpdate(previousProps: PopupProps, prevState: PopupState) {\r\n if (this.state.position !== prevState.position) {\r\n this.setState( { animationEnded: false });\r\n }\r\n\r\n if (this.props.target !== previousProps.target) {\r\n // istanbul ignore next\r\n {\r\n const parentDocument = this.props.target?.ownerDocument ?? document;\r\n if (parentDocument !== this.state.parentDocument) {\r\n this._unBindWindowEvents();\r\n this.setState({ parentDocument });\r\n }\r\n }\r\n }\r\n\r\n if (this.props.isOpen === previousProps.isOpen) {\r\n if (this.props.isOpen) {\r\n const position = this._toggleRelativePosition();\r\n const point = this._fitPopup(this._getPosition(position));\r\n if ((Math.abs(this.state.left - point.x) < 3) &&\r\n (Math.abs(this.state.top - point.y) < 3) &&\r\n this.state.position === position)\r\n return;\r\n\r\n this.setState({\r\n left: point.x,\r\n top: point.y,\r\n position,\r\n });\r\n }\r\n return;\r\n }\r\n\r\n if (this.props.isOpen) {\r\n this._onShow();\r\n } else {\r\n this._onClose();\r\n }\r\n }\r\n\r\n public override componentWillUnmount() {\r\n this._unBindWindowEvents();\r\n }\r\n\r\n private _bindWindowEvents = () => {\r\n const activeWindow = this.getParentWindow();\r\n activeWindow.addEventListener(\"pointerdown\", this._handleOutsideClick);\r\n activeWindow.addEventListener(\"resize\", this._resize);\r\n activeWindow.addEventListener(\"contextmenu\", this._handleContextMenu);\r\n activeWindow.addEventListener(\"scroll\", this._hide);\r\n activeWindow.addEventListener(\"wheel\", this._handleWheel);\r\n activeWindow.addEventListener(\"keydown\", this._handleKeyboard);\r\n };\r\n\r\n private _unBindWindowEvents = () => {\r\n const activeWindow = this.getParentWindow();\r\n activeWindow.removeEventListener(\"pointerdown\", this._handleOutsideClick);\r\n activeWindow.removeEventListener(\"resize\", this._resize);\r\n activeWindow.removeEventListener(\"contextmenu\", this._handleContextMenu);\r\n activeWindow.removeEventListener(\"scroll\", this._hide);\r\n activeWindow.removeEventListener(\"wheel\", this._handleWheel);\r\n activeWindow.removeEventListener(\"keydown\", this._handleKeyboard);\r\n };\r\n\r\n private _handleWheel = (event: WheelEvent) => {\r\n if (this._popup && this._popup.contains(event.target as Node))\r\n return;\r\n\r\n if (this.props.onWheel)\r\n return this.props.onWheel(event);\r\n\r\n const closeOnWheel = this.props.closeOnWheel !== undefined ? this.props.closeOnWheel : true;\r\n if (closeOnWheel)\r\n this._hide();\r\n };\r\n\r\n private isInCorePopup(element: HTMLElement): boolean {\r\n if (element.nodeName === \"DIV\") {\r\n if (element.classList && element.classList.contains(\"core-popup\"))\r\n return true;\r\n if (element.parentElement && this.isInCorePopup(element.parentElement))\r\n return true;\r\n } else {\r\n // istanbul ignore else\r\n if (element.parentElement && this.isInCorePopup(element.parentElement))\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n private _handleOutsideClick = (event: MouseEvent): void => {\r\n if (this._popup && this._popup.contains(event.target as Node))\r\n return;\r\n\r\n if (this.props.isPinned)\r\n return;\r\n\r\n if (!this.props.closeOnNestedPopupOutsideClick && this.isInCorePopup(event.target as HTMLElement))\r\n return;\r\n\r\n if (this.props.onOutsideClick)\r\n return this.props.onOutsideClick(event);\r\n\r\n if (this.props.target && this.props.target.contains(event.target as Node))\r\n return;\r\n\r\n this._onClose();\r\n };\r\n\r\n private _handleContextMenu = (event: MouseEvent) => {\r\n if (this._popup && this._popup.contains(event.target as Node))\r\n return;\r\n\r\n if (this.props.onContextMenu)\r\n return this.props.onContextMenu(event);\r\n\r\n const closeOnContextMenu = this.props.closeOnContextMenu !== undefined ? this.props.closeOnContextMenu : true;\r\n if (closeOnContextMenu)\r\n this._hide();\r\n };\r\n\r\n private _handleKeyboard = (event: KeyboardEvent): void => {\r\n if (this.props.isPinned)\r\n return;\r\n\r\n if (event.key === SpecialKey.Escape || event.key === SpecialKey.Enter) {\r\n const closeOnEnter = this.props.closeOnEnter !== undefined ? this.props.closeOnEnter : true;\r\n if (event.key === SpecialKey.Enter) {\r\n if (closeOnEnter)\r\n this._onClose(true);\r\n else\r\n this.props.onEnter && this.props.onEnter();\r\n } else {\r\n this._onClose(false);\r\n }\r\n }\r\n };\r\n\r\n private _resize = () => {\r\n if (this.props.repositionOnResize) {\r\n const position = this._toggleRelativePosition();\r\n const point = this._fitPopup(this._getPosition(position));\r\n this.setState({ left: point.x, top: point.y, position });\r\n } else {\r\n this._hide(); // legacy behavior\r\n }\r\n };\r\n\r\n private _hide = () => {\r\n if (this.props.isPinned)\r\n return;\r\n\r\n this._onClose();\r\n };\r\n\r\n private _onShow() {\r\n this._bindWindowEvents();\r\n const position = this._toggleRelativePosition();\r\n const point = this._fitPopup(this._getPosition(position));\r\n\r\n this.setState({ left: point.x, top: point.y, isOpen: true, position }, () => {\r\n if (this.props.onOpen)\r\n this.props.onOpen();\r\n });\r\n }\r\n\r\n private _onClose(enterKey?: boolean) {\r\n if (!this.state.isOpen)\r\n return;\r\n\r\n this._unBindWindowEvents();\r\n\r\n this.setState({ isOpen: false }, () => {\r\n if (enterKey && this.props.onEnter)\r\n this.props.onEnter();\r\n if (this.props.onClose)\r\n this.props.onClose();\r\n });\r\n }\r\n\r\n private _isPositionAbsolute(): boolean {\r\n return (this.props.top !== -1 && this.props.left !== -1);\r\n }\r\n\r\n private _getClassNameByPosition(position: RelativePosition): string {\r\n if (!this._isPositionAbsolute()) {\r\n switch (position) {\r\n case RelativePosition.TopLeft:\r\n return \"core-popup-top-left\";\r\n case RelativePosition.TopRight:\r\n return \"core-popup-top-right\";\r\n case RelativePosition.BottomLeft:\r\n return \"core-popup-bottom-left\";\r\n case RelativePosition.BottomRight:\r\n return \"core-popup-bottom-right\";\r\n case RelativePosition.Top:\r\n return \"core-popup-top\";\r\n case RelativePosition.Left:\r\n return \"core-popup-left\";\r\n case RelativePosition.Right:\r\n return \"core-popup-right\";\r\n case RelativePosition.Bottom:\r\n return \"core-popup-bottom\";\r\n case RelativePosition.LeftTop:\r\n return \"core-popup-left-top\";\r\n case RelativePosition.RightTop:\r\n return \"core-popup-right-top\";\r\n }\r\n }\r\n\r\n return \"\";\r\n }\r\n\r\n private _getPopupDimensions(): { popupWidth: number, popupHeight: number } {\r\n let popupWidth = 0;\r\n let popupHeight = 0;\r\n // istanbul ignore else\r\n if (this._popup) {\r\n const activeWindow = this.getParentWindow();\r\n const style = activeWindow.getComputedStyle(this._popup);\r\n const borderLeftWidth = parsePxString(style.borderLeftWidth);\r\n const borderRightWidth = parsePxString(style.borderRightWidth);\r\n const borderTopWidth = parsePxString(style.borderTopWidth);\r\n const borderBottomWidth = parsePxString(style.borderBottomWidth);\r\n popupWidth = this._popup.clientWidth + borderLeftWidth + borderRightWidth;\r\n popupHeight = this._popup.clientHeight + borderTopWidth + borderBottomWidth;\r\n }\r\n\r\n return { popupWidth, popupHeight };\r\n }\r\n\r\n private _getPosition = (position: RelativePosition) => {\r\n const activeWindow = this.getParentWindow();\r\n const { target, offset, top, left } = this.props;\r\n const offsetArrow = (this.props.showArrow) ? 6 : 0;\r\n\r\n // absolute position\r\n if (this._isPositionAbsolute())\r\n return { x: left, y: top };\r\n\r\n // sanity check\r\n const point = { x: 0, y: 0 };\r\n if (!this._popup || !target)\r\n return point;\r\n\r\n // relative position\r\n const scrollY = activeWindow.scrollY;\r\n const scrollX = activeWindow.scrollX;\r\n\r\n const targetRect = target.getBoundingClientRect();\r\n\r\n const { popupWidth, popupHeight } = this._getPopupDimensions();\r\n\r\n switch (position) {\r\n case RelativePosition.Top:\r\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\r\n point.x = scrollX + targetRect.left + (targetRect.width / 2) - (popupWidth / 2);\r\n break;\r\n\r\n case RelativePosition.TopLeft:\r\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\r\n point.x = scrollX + targetRect.left;\r\n break;\r\n\r\n case RelativePosition.TopRight:\r\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\r\n point.x = scrollX + targetRect.right - popupWidth;\r\n break;\r\n\r\n case RelativePosition.Bottom:\r\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\r\n point.x = scrollX + targetRect.left + (targetRect.width / 2) - (popupWidth / 2);\r\n break;\r\n\r\n case RelativePosition.BottomLeft:\r\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\r\n point.x = scrollX + targetRect.left;\r\n break;\r\n\r\n case RelativePosition.BottomRight:\r\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\r\n point.x = scrollX + targetRect.right - popupWidth;\r\n break;\r\n\r\n case RelativePosition.Left:\r\n point.y = scrollY + targetRect.top + (targetRect.height / 2) - (popupHeight / 2);\r\n point.x = scrollX + targetRect.left - popupWidth - offset - offsetArrow;\r\n break;\r\n\r\n case RelativePosition.LeftTop:\r\n point.y = scrollY + targetRect.top;\r\n point.x = scrollX + targetRect.left - popupWidth - offset - offsetArrow;\r\n break;\r\n\r\n case RelativePosition.Right:\r\n point.y = scrollY + targetRect.top + (targetRect.height / 2) - (popupHeight / 2);\r\n point.x = scrollX + targetRect.right + offset + offsetArrow;\r\n break;\r\n\r\n case RelativePosition.RightTop:\r\n point.y = scrollY + targetRect.top;\r\n point.x = scrollX + targetRect.right + offset + offsetArrow;\r\n break;\r\n }\r\n\r\n return point;\r\n };\r\n\r\n private _toggleRelativePosition(): RelativePosition {\r\n const { target, position, offset } = this.props;\r\n\r\n if (!this._popup || !target)\r\n return position;\r\n\r\n // istanbul ignore if\r\n if (this._isPositionAbsolute())\r\n return position;\r\n\r\n let newPosition = position;\r\n\r\n interface Rect {\r\n left: number;\r\n top: number;\r\n right: number;\r\n bottom: number;\r\n }\r\n\r\n const activeWindow = this.getParentWindow();\r\n\r\n // Note: Cannot use DOMRect yet since it's experimental and not available in all browsers (Nov. 2018)\r\n const viewportRect: Rect = { left: activeWindow.scrollX, top: activeWindow.scrollY, right: activeWindow.scrollX + activeWindow.innerWidth, bottom: activeWindow.scrollY + activeWindow.innerHeight };\r\n const targetRect = target.getBoundingClientRect();\r\n const { popupWidth, popupHeight } = this._getPopupDimensions();\r\n const containerStyle = activeWindow.getComputedStyle(target);\r\n const offsetArrow = this.props.showArrow ? /* istanbul ignore next */ 10 : 2;\r\n\r\n const bottomMargin = parseMargin(containerStyle.marginBottom);\r\n if ((targetRect.bottom + popupHeight + bottomMargin + offsetArrow + offset) > viewportRect.bottom) {\r\n if (newPosition === RelativePosition.Bottom)\r\n newPosition = RelativePosition.Top;\r\n else if (newPosition === RelativePosition.BottomLeft)\r\n newPosition = RelativePosition.TopLeft;\r\n else if (newPosition === RelativePosition.BottomRight)\r\n newPosition = RelativePosition.TopRight;\r\n }\r\n\r\n const topMargin = parseMargin(containerStyle.marginTop);\r\n if ((targetRect.top - popupHeight - topMargin - offsetArrow - offset) < viewportRect.top) {\r\n if (newPosition === RelativePosition.Top)\r\n newPosition = RelativePosition.Bottom;\r\n else if (newPosition === RelativePosition.TopLeft)\r\n newPosition = RelativePosition.BottomLeft;\r\n else if (newPosition === RelativePosition.TopRight)\r\n newPosition = RelativePosition.BottomRight;\r\n }\r\n\r\n const leftMargin = parseMargin(containerStyle.marginLeft);\r\n if ((targetRect.left - popupWidth - leftMargin - offsetArrow - offset) < viewportRect.left) {\r\n if (newPosition === RelativePosition.Left)\r\n newPosition = RelativePosition.Right;\r\n else if (newPosition === RelativePosition.LeftTop)\r\n newPosition = RelativePosition.RightTop;\r\n }\r\n\r\n const rightMargin = parseMargin(containerStyle.marginRight);\r\n if ((targetRect.right + popupWidth + rightMargin + offsetArrow + offset) > viewportRect.right) {\r\n if (newPosition === RelativePosition.Right)\r\n newPosition = RelativePosition.Left;\r\n else if (newPosition === RelativePosition.RightTop)\r\n newPosition = RelativePosition.LeftTop;\r\n }\r\n\r\n return newPosition;\r\n }\r\n\r\n // fit the popup within the extents of the view port\r\n private _fitPopup = (point: PopupPoint) => {\r\n const fittedPoint = point;\r\n\r\n // istanbul ignore if\r\n if (!this._popup) {\r\n return fittedPoint;\r\n }\r\n\r\n // const popupRect = this._popup.getBoundingClientRect();\r\n const { popupWidth, popupHeight } = this._getPopupDimensions();\r\n const { innerWidth, innerHeight } = window;\r\n\r\n // istanbul ignore if\r\n if (fittedPoint.y + popupHeight > innerHeight) {\r\n fittedPoint.y = innerHeight - popupHeight;\r\n }\r\n\r\n // istanbul ignore if\r\n if (fittedPoint.x + popupWidth > innerWidth) {\r\n fittedPoint.x = innerWidth - popupWidth;\r\n }\r\n\r\n // istanbul ignore if\r\n if (fittedPoint.y < 0) {\r\n fittedPoint.y = 0;\r\n }\r\n\r\n if (fittedPoint.x < 0) {\r\n fittedPoint.x = 0;\r\n }\r\n\r\n return fittedPoint;\r\n };\r\n\r\n private _handleAnimationEnd = (event: React.AnimationEvent<HTMLDivElement>) => {\r\n if (event.target === this._popup) {\r\n this.setState({ animationEnded: true });\r\n }\r\n };\r\n\r\n public override render() {\r\n const animate = this.props.animate !== undefined ? this.props.animate : true;\r\n const className = classnames(\r\n \"core-popup\",\r\n this._getClassNameByPosition(this.state.position),\r\n this.props.showShadow && \"core-popup-shadow\",\r\n this.props.showArrow && \"arrow\",\r\n !animate && \"core-popup-animation-none\",\r\n this.props.className,\r\n this.state.animationEnded && \"core-animation-ended\",\r\n (!this.props.isOpen && this.props.keepContentsMounted) && \"core-popup-hidden\"\r\n );\r\n\r\n const style: React.CSSProperties = {\r\n top: this.state.top,\r\n left: this.state.left,\r\n ...this.props.style,\r\n };\r\n\r\n const role = this.props.role ? this.props.role : \"dialog\"; // accessibility property\r\n\r\n if (!this.props.isOpen && !this.props.keepContentsMounted) {\r\n return null;\r\n }\r\n\r\n return ReactDOM.createPortal(\r\n (\r\n <div\r\n className={className} data-testid=\"core-popup\"\r\n ref={(element) => { this._popup = element; }}\r\n style={style}\r\n role={role}\r\n aria-modal={true}\r\n tabIndex={-1}\r\n aria-label={this.props.ariaLabel}\r\n onAnimationEnd={this._handleAnimationEnd}\r\n >\r\n <FocusTrap active={!!this.props.moveFocus} initialFocusElement={this.props.focusTarget} returnFocusOnDeactivate={true}>\r\n {this.props.children}\r\n </FocusTrap>\r\n </div>\r\n ), this.state.parentDocument.body);\r\n }\r\n}\r\n\r\nfunction parsePxString(pxStr: string): number {\r\n const parsed = parseInt(pxStr, 10);\r\n return parsed || 0;\r\n}\r\n\r\nfunction parseMargin(value: string) {\r\n return value ? /* istanbul ignore next */ parseFloat(value) : 0;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconWebComponent.d.ts","sourceRoot":"","sources":["../../../../src/core-react/utils/IconWebComponent.ts"],"names":[],"mappings":"AAMA;;GAEG;AAMH;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;YACjC,iBAAiB;YAKjB,OAAO;
|
|
1
|
+
{"version":3,"file":"IconWebComponent.d.ts","sourceRoot":"","sources":["../../../../src/core-react/utils/IconWebComponent.ts"],"names":[],"mappings":"AAMA;;GAEG;AAMH;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;YACjC,iBAAiB;YAKjB,OAAO;CAwBtB"}
|
|
@@ -22,6 +22,9 @@ class IconWebComponent extends HTMLElement {
|
|
|
22
22
|
this.dispatchEvent(new CustomEvent("load"));
|
|
23
23
|
}
|
|
24
24
|
async loadSvg() {
|
|
25
|
+
// if svg was already appended don't request it again
|
|
26
|
+
if (this.childNodes.length)
|
|
27
|
+
return;
|
|
25
28
|
await fetch(this.getAttribute("src") || "")
|
|
26
29
|
.catch((_error) => {
|
|
27
30
|
core_bentley_1.Logger.logError(UiCore_1.UiCore.loggerCategory(this), "Unable to load icon.");
|
|
@@ -42,7 +45,7 @@ class IconWebComponent extends HTMLElement {
|
|
|
42
45
|
throw new appui_abstract_1.UiError(UiCore_1.UiCore.loggerCategory(this), "Unable to load icon.");
|
|
43
46
|
}
|
|
44
47
|
})
|
|
45
|
-
.then((data) => this.append(data.documentElement));
|
|
48
|
+
.then((data) => !this.childNodes.length && this.append(data.documentElement));
|
|
46
49
|
}
|
|
47
50
|
}
|
|
48
51
|
exports.IconWebComponent = IconWebComponent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconWebComponent.js","sourceRoot":"","sources":["../../../../src/core-react/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,CAAC,CAAC;aAClE;iBAAM;gBACL,MAAM,IAAI,wBAAO,CAAE,eAAM,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,sBAAsB,CAAC,CAAC;aACzE;QACH,CAAC,CAAC;aACD,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;IAClF,CAAC;CACF;AA9BD,4CA8BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n// istanbul ignore file\r\n// IconWebComponent requires in-browser testing\r\n/** @packageDocumentation\r\n * @module Utilities\r\n */\r\n\r\nimport { UiError } from \"@itwin/appui-abstract\";\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport { UiCore } from \"../UiCore\";\r\n\r\n/**\r\n * IconWebComponent loads icon from an svg path\r\n */\r\nexport class IconWebComponent extends HTMLElement {\r\n private async connectedCallback() {\r\n await this.loadSvg();\r\n this.dispatchEvent(new CustomEvent(\"load\"));\r\n }\r\n\r\n private async loadSvg() {\r\n // if svg was already appended don't request it again\r\n if (this.childNodes.length)\r\n return;\r\n await fetch(this.getAttribute(\"src\") || \"\")\r\n .catch((_error) => {\r\n Logger.logError(UiCore.loggerCategory(this), \"Unable to load icon.\");\r\n })\r\n .then(async (response) => {\r\n if (response && response.ok) {\r\n return response.text();\r\n } else {\r\n throw new UiError (UiCore.loggerCategory(this), \"Unable to load icon.\");\r\n }\r\n })\r\n .then((str) => {\r\n if (str !== undefined) {\r\n return (new window.DOMParser()).parseFromString(str, \"text/xml\");\r\n } else {\r\n throw new UiError (UiCore.loggerCategory(this), \"Unable to load icon.\");\r\n }\r\n })\r\n .then((data) => !this.childNodes.length && this.append(data.documentElement));\r\n }\r\n}\r\n"]}
|
|
@@ -13,104 +13,104 @@
|
|
|
13
13
|
:root {
|
|
14
14
|
|
|
15
15
|
// NEEDSWORK - Need to deprecate these accessory colors
|
|
16
|
-
--buic-accessory-hollow:
|
|
17
|
-
--buic-accessory-primary:
|
|
18
|
-
--buic-accessory-success:
|
|
19
|
-
--buic-accessory-alert:
|
|
20
|
-
--buic-accessory-warning:
|
|
21
|
-
--buic-accessory-primary-tint:
|
|
22
|
-
--buic-accessory-success-tint:
|
|
23
|
-
--buic-accessory-alert-tint:
|
|
24
|
-
--buic-accessory-warning-tint:
|
|
25
|
-
|
|
26
|
-
--buic-background-1-rgb:
|
|
27
|
-
--buic-background-2-rgb:
|
|
28
|
-
--buic-background-3-rgb:
|
|
29
|
-
--buic-background-4-rgb:
|
|
30
|
-
--buic-background-5-rgb:
|
|
31
|
-
|
|
32
|
-
--buic-background-1:
|
|
33
|
-
--buic-background-2:
|
|
34
|
-
--buic-background-3:
|
|
35
|
-
--buic-background-4:
|
|
36
|
-
--buic-background-5:
|
|
37
|
-
--buic-background-primary:
|
|
38
|
-
--buic-background-tooltip:
|
|
39
|
-
--buic-background-scrollbar:
|
|
40
|
-
--buic-background-scrollbar-hover:
|
|
41
|
-
|
|
42
|
-
--buic-foreground-body-rgb:
|
|
43
|
-
--buic-foreground-body:
|
|
44
|
-
--buic-foreground-body-reverse-rgb:
|
|
45
|
-
--buic-foreground-body-reverse:
|
|
46
|
-
--buic-foreground-muted:
|
|
47
|
-
--buic-foreground-disabled:
|
|
48
|
-
--buic-foreground-activehover:
|
|
49
|
-
|
|
50
|
-
--buic-inputs-border:
|
|
51
|
-
--buic-inputs-boxshadow:
|
|
52
|
-
--buic-popup-boxshadow:
|
|
53
|
-
|
|
54
|
-
--buic-foreground-primary:
|
|
55
|
-
--buic-foreground-primary-tone:
|
|
56
|
-
--buic-foreground-focus:
|
|
57
|
-
--buic-foreground-focus-border:
|
|
58
|
-
--buic-focus-boxshadow:
|
|
16
|
+
--buic-accessory-hollow: rgb(255, 255, 255);
|
|
17
|
+
--buic-accessory-primary: rgb(000, 139, 225);
|
|
18
|
+
--buic-accessory-success: rgb(083, 162, 026);
|
|
19
|
+
--buic-accessory-alert: rgb(211, 010, 010);
|
|
20
|
+
--buic-accessory-warning: rgb(241, 139, 018);
|
|
21
|
+
--buic-accessory-primary-tint: rgb(165, 215, 245);
|
|
22
|
+
--buic-accessory-success-tint: rgb(195, 225, 175);
|
|
23
|
+
--buic-accessory-alert-tint: rgb(239, 169, 169);
|
|
24
|
+
--buic-accessory-warning-tint: rgb(249, 215, 171);
|
|
25
|
+
|
|
26
|
+
--buic-background-1-rgb: var(--iui-color-background-1-rgb);
|
|
27
|
+
--buic-background-2-rgb: var(--iui-color-background-2-rgb);
|
|
28
|
+
--buic-background-3-rgb: var(--iui-color-background-3-rgb);
|
|
29
|
+
--buic-background-4-rgb: var(--iui-color-background-4-rgb);
|
|
30
|
+
--buic-background-5-rgb: var(--iui-color-background-5-rgb);
|
|
31
|
+
|
|
32
|
+
--buic-background-1: var(--iui-color-background-1);
|
|
33
|
+
--buic-background-2: var(--iui-color-background-2);
|
|
34
|
+
--buic-background-3: var(--iui-color-background-3);
|
|
35
|
+
--buic-background-4: var(--iui-color-background-4);
|
|
36
|
+
--buic-background-5: var(--iui-color-background-5);
|
|
37
|
+
--buic-background-primary: var(--iui-color-background-primary);
|
|
38
|
+
--buic-background-tooltip: rgba(var(--iui-color-background-5-rgb), 0.90);
|
|
39
|
+
--buic-background-scrollbar: rgba(var(--iui-color-foreground-body-rgb), var(--iui-opacity-4));
|
|
40
|
+
--buic-background-scrollbar-hover: rgba(var(--iui-color-foreground-body-rgb), var(--iui-opacity-3));
|
|
41
|
+
|
|
42
|
+
--buic-foreground-body-rgb: var(--iui-text-color-rgb);
|
|
43
|
+
--buic-foreground-body: var(--iui-text-color);
|
|
44
|
+
--buic-foreground-body-reverse-rgb: var(--iui-color-foreground-body-invert-rgb);
|
|
45
|
+
--buic-foreground-body-reverse: rgba(var(--iui-color-foreground-body-invert-rgb), var(--iui-opacity-2));
|
|
46
|
+
--buic-foreground-muted: var(--iui-text-color-muted);
|
|
47
|
+
--buic-foreground-disabled: var(--iui-text-color-placeholder);
|
|
48
|
+
--buic-foreground-activehover: var(--iui-icons-color-actionable-hover);
|
|
49
|
+
|
|
50
|
+
--buic-inputs-border: rgba(var(--iui-color-foreground-body-rgb), var(--iui-opacity-4));
|
|
51
|
+
--buic-inputs-boxshadow: var(--iui-focus-box-shadow);
|
|
52
|
+
--buic-popup-boxshadow: var(--buic-inputs-boxshadow);
|
|
53
|
+
|
|
54
|
+
--buic-foreground-primary: var(--iui-icons-color-primary);
|
|
55
|
+
--buic-foreground-primary-tone: var(--iui-color-foreground-primary-overlay);
|
|
56
|
+
--buic-foreground-focus: var(--iui-color-foreground-primary-overlay);
|
|
57
|
+
--buic-foreground-focus-border: var(--buic-inputs-border);
|
|
58
|
+
--buic-focus-boxshadow: rgba(var(--iui-color-foreground-primary-rgb), var(--iui-opacity-4));
|
|
59
59
|
|
|
60
60
|
// The following two are still in use by DatePicker and there is no itwinui equivalent
|
|
61
61
|
--buic-focus-boxshadow-gradient1: rgba(var(--buic-foreground-primary-tone-rgb), 0);
|
|
62
62
|
--buic-focus-boxshadow-gradient2: rgba(var(--buic-foreground-primary-rgb), 0.65);
|
|
63
63
|
|
|
64
|
-
--buic-foreground-accessory:
|
|
65
|
-
--buic-foreground-success:
|
|
66
|
-
--buic-foreground-positive:
|
|
67
|
-
--buic-foreground-positive-rgb:
|
|
68
|
-
--buic-foreground-alert:
|
|
69
|
-
--buic-foreground-negative:
|
|
70
|
-
--buic-foreground-negative-rgb:
|
|
71
|
-
--buic-foreground-warning:
|
|
72
|
-
--buic-foreground-warning-rgb:
|
|
64
|
+
--buic-foreground-accessory: var(--iui-color-foreground-accessory);
|
|
65
|
+
--buic-foreground-success: var(--iui-color-foreground-positive);
|
|
66
|
+
--buic-foreground-positive: var(--iui-color-foreground-positive);
|
|
67
|
+
--buic-foreground-positive-rgb: var(--iui-color-foreground-positive-rgb);
|
|
68
|
+
--buic-foreground-alert: var(--iui-color-foreground-negative);
|
|
69
|
+
--buic-foreground-negative: var(--iui-color-foreground-negative);
|
|
70
|
+
--buic-foreground-negative-rgb: var(--iui-color-foreground-negative-rgb);
|
|
71
|
+
--buic-foreground-warning: var(--iui-color-foreground-warning);
|
|
72
|
+
--buic-foreground-warning-rgb: var(--iui-color-foreground-warning-rgb);
|
|
73
73
|
|
|
74
|
-
--buic-background-focus-overlay:
|
|
75
|
-
--buic-background-hover-overlay:
|
|
76
|
-
--buic-background-active-overlay:
|
|
77
|
-
--buic-background-pressed-overlay:
|
|
74
|
+
--buic-background-focus-overlay: rgba(var(--iui-color-foreground-primary-rgb), var(--iui-opacity-6));
|
|
75
|
+
--buic-background-hover-overlay: rgba(var(--iui-color-foreground-primary-rgb), var(--iui-opacity-5));
|
|
76
|
+
--buic-background-active-overlay: rgba(var(--iui-color-foreground-primary-rgb), var(--iui-opacity-5));
|
|
77
|
+
--buic-background-pressed-overlay: rgba(var(--iui-color-foreground-primary-rgb), 0.3);
|
|
78
78
|
|
|
79
|
-
--buic-background-card:
|
|
80
|
-
--buic-background-striped_row:
|
|
79
|
+
--buic-background-card: var(--buic-background-tooltip);
|
|
80
|
+
--buic-background-striped_row: rgba(var(--iui-color-foreground-body-rgb), 0.03);
|
|
81
81
|
|
|
82
82
|
/** background.5 */
|
|
83
|
-
--buic-background-titlebar:
|
|
84
|
-
--buic-background-dialog-stroke:
|
|
85
|
-
--buic-background-widget-stroke:
|
|
86
|
-
--buic-background-control-stroke:
|
|
87
|
-
--buic-background-panel-stroke:
|
|
88
|
-
--buic-background-toolbutton-stroke:
|
|
83
|
+
--buic-background-titlebar: var(--buic-background-5);
|
|
84
|
+
--buic-background-dialog-stroke: var(--buic-background-5);
|
|
85
|
+
--buic-background-widget-stroke: var(--buic-background-5);
|
|
86
|
+
--buic-background-control-stroke: var(--buic-background-5);
|
|
87
|
+
--buic-background-panel-stroke: var(--buic-background-5);
|
|
88
|
+
--buic-background-toolbutton-stroke: var(--buic-background-5);
|
|
89
89
|
|
|
90
90
|
/** background.4 */
|
|
91
|
-
--buic-background-titlebar-outoffocus:
|
|
92
|
-
--buic-background-divider:
|
|
93
|
-
--buic-background-widget-element-stroke:
|
|
94
|
-
--buic-background-statusbar:
|
|
95
|
-
--buic-background-table-header:
|
|
96
|
-
--buic-background-control-stroke-disabled:
|
|
91
|
+
--buic-background-titlebar-outoffocus: var(--buic-background-4);
|
|
92
|
+
--buic-background-divider: var(--buic-background-4);
|
|
93
|
+
--buic-background-widget-element-stroke: var(--buic-background-4);
|
|
94
|
+
--buic-background-statusbar: var(--buic-background-4);
|
|
95
|
+
--buic-background-table-header: var(--buic-background-4);
|
|
96
|
+
--buic-background-control-stroke-disabled: var(--buic-background-4);
|
|
97
97
|
|
|
98
98
|
/** background.3 */
|
|
99
|
-
--buic-background-tab-inactive:
|
|
100
|
-
--buic-background-toolbutton-inactive:
|
|
101
|
-
--buic-background-context-menu:
|
|
102
|
-
--buic-background-panel:
|
|
103
|
-
--buic-background-
|
|
104
|
-
--buic-background-
|
|
105
|
-
--buic-background-control-disabled: var(--buic-background-3);
|
|
99
|
+
--buic-background-tab-inactive: var(--buic-background-3);
|
|
100
|
+
--buic-background-toolbutton-inactive: var(--buic-background-3);
|
|
101
|
+
--buic-background-context-menu: var(--buic-background-3);
|
|
102
|
+
--buic-background-widget-panel: var(--buic-background-3);
|
|
103
|
+
--buic-background-placeholder: var(--buic-background-3);
|
|
104
|
+
--buic-background-control-disabled: var(--buic-background-3);
|
|
106
105
|
|
|
107
106
|
/** background.2 */
|
|
108
|
-
--buic-background-tab-active:
|
|
109
|
-
--buic-background-dialog:
|
|
110
|
-
--buic-background-widget:
|
|
111
|
-
--buic-background-window:
|
|
112
|
-
--buic-background-toolbar:
|
|
107
|
+
--buic-background-tab-active: var(--buic-background-2);
|
|
108
|
+
--buic-background-dialog: var(--buic-background-2);
|
|
109
|
+
--buic-background-widget: var(--buic-background-2);
|
|
110
|
+
--buic-background-window: var(--buic-background-2);
|
|
111
|
+
--buic-background-toolbar: var(--buic-background-2);
|
|
112
|
+
--buic-background-panel: var(--buic-background-2);
|
|
113
113
|
|
|
114
114
|
/** background.1 */
|
|
115
|
-
--buic-background-control:
|
|
115
|
+
--buic-background-control: var(--buic-background-1);
|
|
116
116
|
}
|
|
@@ -28,7 +28,7 @@ export function Icon(props) {
|
|
|
28
28
|
React.createElement(SvgSprite, { src: svgSource })));
|
|
29
29
|
const webComponentString = IconSpecUtilities.getWebComponentSource(iconString);
|
|
30
30
|
if (webComponentString) {
|
|
31
|
-
const svgLoader = `<svg-loader src=${webComponentString}
|
|
31
|
+
const svgLoader = `<svg-loader src=${webComponentString}></svg-loader>`;
|
|
32
32
|
const svgDiv = `<div>${svgLoader}</div>`;
|
|
33
33
|
// the esm build of dompurify has a default import but the cjs build does not
|
|
34
34
|
// if there is a default export, use it (likely esm), otherwise use the namespace
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconComponent.js","sourceRoot":"","sources":["../../../../src/core-react/icons/IconComponent.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,4CAA4C;AAC5C;;GAEG;AAEH,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,SAAS,EAAE,KAAK,WAAW,MAAM,WAAW,CAAC;AAiBpD;;GAEG;AACH,MAAM,UAAU,IAAI,CAAC,KAAgB;IACnC,IAAI,CAAC,KAAK,CAAC,QAAQ;QACjB,OAAO,IAAI,CAAC;IAEd,MAAM,UAAU,GAAG,CAAC,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ,IAAI,KAAK,CAA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E,KAAK,CAAC,KAAK,GAAI,CAAC,CAAC;KAChG;IAED,OAAO,CACL,2BAAG,SAAS,EAAE,UAAU,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,IACnF,KAAK,CAAC,QAAQ,CACb,CACL,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/* eslint-disable deprecation/deprecation */\r\n/** @packageDocumentation\r\n * @module Icon\r\n */\r\n\r\nimport \"./IconComponent.scss\";\r\nimport * as React from \"react\";\r\nimport classnames from \"classnames\";\r\nimport { ConditionalStringValue, IconSpecUtilities } from \"@itwin/appui-abstract\";\r\nimport { SvgSprite } from \"./SvgSprite\";\r\nimport { CommonProps } from \"../utils/Props\";\r\nimport DOMPurify, * as DOMPurifyNS from \"dompurify\";\r\n\r\n/** Prototype for an IconSpec which can be a string, ReactNode or ConditionalStringValue.\r\n * @public\r\n */\r\nexport type IconSpec = string | ConditionalStringValue | React.ReactNode;\r\n\r\n/** Properties for the [[Icon]] React component\r\n * @public\r\n */\r\nexport interface IconProps extends CommonProps {\r\n /** CSS class name or SvgSprite/SvgPath for icon. This is optional because it is improperly\r\n * used to extend other interfaces and changing it would break existing API.\r\n */\r\n iconSpec?: IconSpec;\r\n}\r\n\r\n/** Icon Functional component displays an icon based on an [[IconSpec]].\r\n * @public\r\n */\r\nexport function Icon(props: IconProps) {\r\n if (!props.iconSpec)\r\n return null;\r\n\r\n const iconString = (typeof props.iconSpec === \"string\" || props.iconSpec instanceof ConditionalStringValue) ?\r\n ConditionalStringValue.getValue(props.iconSpec) : undefined;\r\n\r\n if (iconString) {\r\n const svgSource = IconSpecUtilities.getSvgSource(iconString);\r\n // if string begins with \"svg:\" then we assume it was imported (into extension source file) using webpack loader svg-sprite-loader\r\n if (svgSource !== undefined)\r\n return (\r\n <i className={classnames(\"icon\", \"core-svg-icon\", props.className)} style={props.style}>\r\n <SvgSprite src={svgSource} />\r\n </i>\r\n );\r\n const webComponentString = IconSpecUtilities.getWebComponentSource(iconString);\r\n if (webComponentString) {\r\n const svgLoader = `<svg-loader src=${webComponentString}></svg-loader>`;\r\n const svgDiv = `<div>${svgLoader}</div>`;\r\n // the esm build of dompurify has a default import but the cjs build does not\r\n // if there is a default export, use it (likely esm), otherwise use the namespace\r\n // istanbul ignore next\r\n const sanitizer = DOMPurify ?? DOMPurifyNS;\r\n const sanitizedIconString = sanitizer.sanitize(svgDiv, { ALLOWED_TAGS: [\"svg-loader\"] });\r\n // we can safely disable jam3/no-sanitizer-with-danger as we are sanitizing above\r\n // eslint-disable-next-line @typescript-eslint/naming-convention, jam3/no-sanitizer-with-danger\r\n const webComponentNode = <div dangerouslySetInnerHTML={{ __html: sanitizedIconString }}></div>;\r\n return (\r\n <i className={classnames(\"icon\", \"core-svg-icon\", props.className)} >\r\n {webComponentNode}\r\n </i>\r\n );\r\n }\r\n return (<i className={classnames(\"icon\", iconString, props.className)} style={props.style} />);\r\n }\r\n\r\n return (\r\n <i className={classnames(\"icon\", \"core-svg-icon\", props.className)} style={props.style}>\r\n {props.iconSpec}\r\n </i>\r\n );\r\n}\r\n"]}
|
|
@@ -60,6 +60,11 @@ export interface PopupProps extends CommonProps {
|
|
|
60
60
|
/** If true the children are mounted once and unmounted when this component is unmounted. If false the
|
|
61
61
|
* children are unmounted each time the popup is closed. */
|
|
62
62
|
keepContentsMounted?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* If true the popup will remain open and will be repositioned when window resize events occur, default to false.
|
|
65
|
+
* @beta
|
|
66
|
+
* */
|
|
67
|
+
repositionOnResize?: boolean;
|
|
63
68
|
}
|
|
64
69
|
/** @internal */
|
|
65
70
|
interface PopupState {
|
|
@@ -88,6 +93,7 @@ export declare class Popup extends React.Component<PopupProps, PopupState> {
|
|
|
88
93
|
private _handleOutsideClick;
|
|
89
94
|
private _handleContextMenu;
|
|
90
95
|
private _handleKeyboard;
|
|
96
|
+
private _resize;
|
|
91
97
|
private _hide;
|
|
92
98
|
private _onShow;
|
|
93
99
|
private _onClose;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popup.d.ts","sourceRoot":"","sources":["../../../../src/core-react/popup/Popup.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,cAAc,CAAC;AAEtB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAc,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAU7C;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,WAAW;IAC7C,qDAAqD;IACrD,UAAU,EAAE,OAAO,CAAC;IACpB,iDAAiD;IACjD,SAAS,EAAE,OAAO,CAAC;IACnB,sEAAsE;IACtE,MAAM,EAAE,OAAO,CAAC;IAChB,6FAA6F;IAC7F,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,0DAA0D;IAC1D,GAAG,EAAE,MAAM,CAAC;IACZ,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,0DAA0D;IAC1D,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IACzC,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAClC,6DAA6D;IAC7D,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IACxC,6CAA6C;IAC7C,MAAM,EAA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{
|
|
|
22
22
|
this._bindWindowEvents = () => {
|
|
23
23
|
const activeWindow = this.getParentWindow();
|
|
24
24
|
activeWindow.addEventListener("pointerdown", this._handleOutsideClick);
|
|
25
|
-
activeWindow.addEventListener("resize", this.
|
|
25
|
+
activeWindow.addEventListener("resize", this._resize);
|
|
26
26
|
activeWindow.addEventListener("contextmenu", this._handleContextMenu);
|
|
27
27
|
activeWindow.addEventListener("scroll", this._hide);
|
|
28
28
|
activeWindow.addEventListener("wheel", this._handleWheel);
|
|
@@ -31,7 +31,7 @@ export class Popup extends React.Component {
|
|
|
31
31
|
this._unBindWindowEvents = () => {
|
|
32
32
|
const activeWindow = this.getParentWindow();
|
|
33
33
|
activeWindow.removeEventListener("pointerdown", this._handleOutsideClick);
|
|
34
|
-
activeWindow.removeEventListener("resize", this.
|
|
34
|
+
activeWindow.removeEventListener("resize", this._resize);
|
|
35
35
|
activeWindow.removeEventListener("contextmenu", this._handleContextMenu);
|
|
36
36
|
activeWindow.removeEventListener("scroll", this._hide);
|
|
37
37
|
activeWindow.removeEventListener("wheel", this._handleWheel);
|
|
@@ -84,6 +84,16 @@ export class Popup extends React.Component {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
|
+
this._resize = () => {
|
|
88
|
+
if (this.props.repositionOnResize) {
|
|
89
|
+
const position = this._toggleRelativePosition();
|
|
90
|
+
const point = this._fitPopup(this._getPosition(position));
|
|
91
|
+
this.setState({ left: point.x, top: point.y, position });
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
this._hide(); // legacy behavior
|
|
95
|
+
}
|
|
96
|
+
};
|
|
87
97
|
this._hide = () => {
|
|
88
98
|
if (this.props.isPinned)
|
|
89
99
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popup.js","sourceRoot":"","sources":["../../../../src/core-react/popup/Popup.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,cAAc,CA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AC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Popup\r\n */\r\n\r\nimport \"./Popup.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport * as ReactDOM from \"react-dom\";\r\nimport { RelativePosition, SpecialKey } from \"@itwin/appui-abstract\";\r\nimport { FocusTrap } from \"../focustrap/FocusTrap\";\r\nimport { CommonProps } from \"../utils/Props\";\r\n\r\n// cSpell:ignore focustrap focusable alertdialog\r\n\r\n/** @internal */\r\ninterface PopupPoint {\r\n x: number;\r\n y: number;\r\n}\r\n\r\n/** Properties for the [[Popup]] component\r\n * @public\r\n */\r\nexport interface PopupProps extends CommonProps {\r\n /** Show or hide the box shadow (defaults to true) */\r\n showShadow: boolean;\r\n /** Show or hide the arrow (defaults to false) */\r\n showArrow: boolean;\r\n /** Indicates whether the popup is shown or not (defaults to false) */\r\n isOpen: boolean;\r\n /** Direction (relative to the target) to which the popup is expanded (defaults to Bottom) */\r\n position: RelativePosition;\r\n /** Top position (absolute positioning - defaults to 0) */\r\n top: number;\r\n /** Left position (absolute positioning - defaults to 0) */\r\n left: number;\r\n /** Function called when the popup is opened */\r\n onOpen?: () => void;\r\n /** Function called when user clicks outside the popup */\r\n onOutsideClick?: (e: MouseEvent) => void;\r\n /** Function called when the popup is closed */\r\n onClose?: () => void;\r\n /** Function called when the popup is closed on Enter */\r\n onEnter?: () => void;\r\n /** Function called when the wheel is used */\r\n onWheel?: (e: WheelEvent) => void;\r\n /** Function called when the right mouse button is pressed */\r\n onContextMenu?: (e: MouseEvent) => void;\r\n /** Offset from the parent (defaults to 4) */\r\n offset: number;\r\n /** Target element to position popup */\r\n target?: HTMLElement | null;\r\n /** Role - if not specified \"dialog\" is used */\r\n role?: \"dialog\" | \"alert\" | \"alertdialog\";\r\n /** accessibility label */\r\n ariaLabel?: string;\r\n /** set focus to popup - default to not set focus */\r\n moveFocus?: boolean;\r\n /** Element to receive focus, specified by React.RefObject or CSS selector string. If undefined and moveFocus is true then focus is moved to first focusable element. */\r\n focusTarget?: React.RefObject<HTMLElement> | string;\r\n /** Indicates whether the popup is pinned. */\r\n isPinned?: boolean;\r\n /** Indicates whether to use animation for open/close (defaults to true) */\r\n animate?: boolean;\r\n /** Indicates whether to close the popup when Enter is pressed (defaults to true) */\r\n closeOnEnter?: boolean;\r\n /** Indicates whether to close the popup when the wheel is used (defaults to true) */\r\n closeOnWheel?: boolean;\r\n /** Indicates whether to close the popup when the right mouse button is pressed (defaults to true) */\r\n closeOnContextMenu?: boolean;\r\n /** If false outside click processing and closing are skipped if click occurs in another Popup component, default to false. */\r\n closeOnNestedPopupOutsideClick?: boolean;\r\n /** If true the children are mounted once and unmounted when this component is unmounted. If false the\r\n * children are unmounted each time the popup is closed. */\r\n keepContentsMounted?: boolean;\r\n}\r\n\r\n/** @internal */\r\ninterface PopupState {\r\n isOpen: boolean;\r\n top: number;\r\n left: number;\r\n position: RelativePosition;\r\n parentDocument: Document;\r\n animationEnded: boolean;\r\n}\r\n\r\n/** Popup React component displays a popup relative to an optional target element.\r\n * @public\r\n */\r\nexport class Popup extends React.Component<PopupProps, PopupState> {\r\n private _popup: HTMLElement | null = null;\r\n\r\n constructor(props: PopupProps) {\r\n super(props);\r\n const parentDocument = this.props.target?.ownerDocument ?? document;\r\n\r\n this.state = {\r\n animationEnded: false,\r\n isOpen: this.props.isOpen,\r\n top: 0,\r\n left: 0,\r\n position: this.props.position,\r\n parentDocument,\r\n };\r\n }\r\n\r\n public static defaultProps: Partial<PopupProps> = {\r\n position: RelativePosition.Bottom,\r\n showShadow: true,\r\n showArrow: false,\r\n isOpen: false,\r\n offset: 4,\r\n top: -1,\r\n left: -1,\r\n };\r\n\r\n public override componentDidMount() {\r\n if (this.props.isOpen) {\r\n this._onShow();\r\n }\r\n }\r\n\r\n private getParentWindow() {\r\n // istanbul ignore next\r\n return this.state.parentDocument.defaultView ?? window;\r\n }\r\n\r\n public override componentDidUpdate(previousProps: PopupProps, prevState: PopupState) {\r\n if (this.state.position !== prevState.position) {\r\n this.setState( { animationEnded: false });\r\n }\r\n\r\n if (this.props.target !== previousProps.target) {\r\n // istanbul ignore next\r\n {\r\n const parentDocument = this.props.target?.ownerDocument ?? document;\r\n if (parentDocument !== this.state.parentDocument) {\r\n this._unBindWindowEvents();\r\n this.setState({ parentDocument });\r\n }\r\n }\r\n }\r\n\r\n if (this.props.isOpen === previousProps.isOpen) {\r\n if (this.props.isOpen) {\r\n const position = this._toggleRelativePosition();\r\n const point = this._fitPopup(this._getPosition(position));\r\n if ((Math.abs(this.state.left - point.x) < 3) &&\r\n (Math.abs(this.state.top - point.y) < 3) &&\r\n this.state.position === position)\r\n return;\r\n\r\n this.setState({\r\n left: point.x,\r\n top: point.y,\r\n position,\r\n });\r\n }\r\n return;\r\n }\r\n\r\n if (this.props.isOpen) {\r\n this._onShow();\r\n } else {\r\n this._onClose();\r\n }\r\n }\r\n\r\n public override componentWillUnmount() {\r\n this._unBindWindowEvents();\r\n }\r\n\r\n private _bindWindowEvents = () => {\r\n const activeWindow = this.getParentWindow();\r\n activeWindow.addEventListener(\"pointerdown\", this._handleOutsideClick);\r\n activeWindow.addEventListener(\"resize\", this._hide);\r\n activeWindow.addEventListener(\"contextmenu\", this._handleContextMenu);\r\n activeWindow.addEventListener(\"scroll\", this._hide);\r\n activeWindow.addEventListener(\"wheel\", this._handleWheel);\r\n activeWindow.addEventListener(\"keydown\", this._handleKeyboard);\r\n };\r\n\r\n private _unBindWindowEvents = () => {\r\n const activeWindow = this.getParentWindow();\r\n activeWindow.removeEventListener(\"pointerdown\", this._handleOutsideClick);\r\n activeWindow.removeEventListener(\"resize\", this._hide);\r\n activeWindow.removeEventListener(\"contextmenu\", this._handleContextMenu);\r\n activeWindow.removeEventListener(\"scroll\", this._hide);\r\n activeWindow.removeEventListener(\"wheel\", this._handleWheel);\r\n activeWindow.removeEventListener(\"keydown\", this._handleKeyboard);\r\n };\r\n\r\n private _handleWheel = (event: WheelEvent) => {\r\n if (this._popup && this._popup.contains(event.target as Node))\r\n return;\r\n\r\n if (this.props.onWheel)\r\n return this.props.onWheel(event);\r\n\r\n const closeOnWheel = this.props.closeOnWheel !== undefined ? this.props.closeOnWheel : true;\r\n if (closeOnWheel)\r\n this._hide();\r\n };\r\n\r\n private isInCorePopup(element: HTMLElement): boolean {\r\n if (element.nodeName === \"DIV\") {\r\n if (element.classList && element.classList.contains(\"core-popup\"))\r\n return true;\r\n if (element.parentElement && this.isInCorePopup(element.parentElement))\r\n return true;\r\n } else {\r\n // istanbul ignore else\r\n if (element.parentElement && this.isInCorePopup(element.parentElement))\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n private _handleOutsideClick = (event: MouseEvent): void => {\r\n if (this._popup && this._popup.contains(event.target as Node))\r\n return;\r\n\r\n if (this.props.isPinned)\r\n return;\r\n\r\n if (!this.props.closeOnNestedPopupOutsideClick && this.isInCorePopup(event.target as HTMLElement))\r\n return;\r\n\r\n if (this.props.onOutsideClick)\r\n return this.props.onOutsideClick(event);\r\n\r\n if (this.props.target && this.props.target.contains(event.target as Node))\r\n return;\r\n\r\n this._onClose();\r\n };\r\n\r\n private _handleContextMenu = (event: MouseEvent) => {\r\n if (this._popup && this._popup.contains(event.target as Node))\r\n return;\r\n\r\n if (this.props.onContextMenu)\r\n return this.props.onContextMenu(event);\r\n\r\n const closeOnContextMenu = this.props.closeOnContextMenu !== undefined ? this.props.closeOnContextMenu : true;\r\n if (closeOnContextMenu)\r\n this._hide();\r\n };\r\n\r\n private _handleKeyboard = (event: KeyboardEvent): void => {\r\n if (this.props.isPinned)\r\n return;\r\n\r\n if (event.key === SpecialKey.Escape || event.key === SpecialKey.Enter) {\r\n const closeOnEnter = this.props.closeOnEnter !== undefined ? this.props.closeOnEnter : true;\r\n if (event.key === SpecialKey.Enter) {\r\n if (closeOnEnter)\r\n this._onClose(true);\r\n else\r\n this.props.onEnter && this.props.onEnter();\r\n } else {\r\n this._onClose(false);\r\n }\r\n }\r\n };\r\n\r\n private _hide = () => {\r\n if (this.props.isPinned)\r\n return;\r\n\r\n this._onClose();\r\n };\r\n\r\n private _onShow() {\r\n this._bindWindowEvents();\r\n const position = this._toggleRelativePosition();\r\n const point = this._fitPopup(this._getPosition(position));\r\n\r\n this.setState({ left: point.x, top: point.y, isOpen: true, position }, () => {\r\n if (this.props.onOpen)\r\n this.props.onOpen();\r\n });\r\n }\r\n\r\n private _onClose(enterKey?: boolean) {\r\n if (!this.state.isOpen)\r\n return;\r\n\r\n this._unBindWindowEvents();\r\n\r\n this.setState({ isOpen: false }, () => {\r\n if (enterKey && this.props.onEnter)\r\n this.props.onEnter();\r\n if (this.props.onClose)\r\n this.props.onClose();\r\n });\r\n }\r\n\r\n private _isPositionAbsolute(): boolean {\r\n return (this.props.top !== -1 && this.props.left !== -1);\r\n }\r\n\r\n private _getClassNameByPosition(position: RelativePosition): string {\r\n if (!this._isPositionAbsolute()) {\r\n switch (position) {\r\n case RelativePosition.TopLeft:\r\n return \"core-popup-top-left\";\r\n case RelativePosition.TopRight:\r\n return \"core-popup-top-right\";\r\n case RelativePosition.BottomLeft:\r\n return \"core-popup-bottom-left\";\r\n case RelativePosition.BottomRight:\r\n return \"core-popup-bottom-right\";\r\n case RelativePosition.Top:\r\n return \"core-popup-top\";\r\n case RelativePosition.Left:\r\n return \"core-popup-left\";\r\n case RelativePosition.Right:\r\n return \"core-popup-right\";\r\n case RelativePosition.Bottom:\r\n return \"core-popup-bottom\";\r\n case RelativePosition.LeftTop:\r\n return \"core-popup-left-top\";\r\n case RelativePosition.RightTop:\r\n return \"core-popup-right-top\";\r\n }\r\n }\r\n\r\n return \"\";\r\n }\r\n\r\n private _getPopupDimensions(): { popupWidth: number, popupHeight: number } {\r\n let popupWidth = 0;\r\n let popupHeight = 0;\r\n // istanbul ignore else\r\n if (this._popup) {\r\n const activeWindow = this.getParentWindow();\r\n const style = activeWindow.getComputedStyle(this._popup);\r\n const borderLeftWidth = parsePxString(style.borderLeftWidth);\r\n const borderRightWidth = parsePxString(style.borderRightWidth);\r\n const borderTopWidth = parsePxString(style.borderTopWidth);\r\n const borderBottomWidth = parsePxString(style.borderBottomWidth);\r\n popupWidth = this._popup.clientWidth + borderLeftWidth + borderRightWidth;\r\n popupHeight = this._popup.clientHeight + borderTopWidth + borderBottomWidth;\r\n }\r\n\r\n return { popupWidth, popupHeight };\r\n }\r\n\r\n private _getPosition = (position: RelativePosition) => {\r\n const activeWindow = this.getParentWindow();\r\n const { target, offset, top, left } = this.props;\r\n const offsetArrow = (this.props.showArrow) ? 6 : 0;\r\n\r\n // absolute position\r\n if (this._isPositionAbsolute())\r\n return { x: left, y: top };\r\n\r\n // sanity check\r\n const point = { x: 0, y: 0 };\r\n if (!this._popup || !target)\r\n return point;\r\n\r\n // relative position\r\n const scrollY = activeWindow.scrollY;\r\n const scrollX = activeWindow.scrollX;\r\n\r\n const targetRect = target.getBoundingClientRect();\r\n\r\n const { popupWidth, popupHeight } = this._getPopupDimensions();\r\n\r\n switch (position) {\r\n case RelativePosition.Top:\r\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\r\n point.x = scrollX + targetRect.left + (targetRect.width / 2) - (popupWidth / 2);\r\n break;\r\n\r\n case RelativePosition.TopLeft:\r\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\r\n point.x = scrollX + targetRect.left;\r\n break;\r\n\r\n case RelativePosition.TopRight:\r\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\r\n point.x = scrollX + targetRect.right - popupWidth;\r\n break;\r\n\r\n case RelativePosition.Bottom:\r\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\r\n point.x = scrollX + targetRect.left + (targetRect.width / 2) - (popupWidth / 2);\r\n break;\r\n\r\n case RelativePosition.BottomLeft:\r\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\r\n point.x = scrollX + targetRect.left;\r\n break;\r\n\r\n case RelativePosition.BottomRight:\r\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\r\n point.x = scrollX + targetRect.right - popupWidth;\r\n break;\r\n\r\n case RelativePosition.Left:\r\n point.y = scrollY + targetRect.top + (targetRect.height / 2) - (popupHeight / 2);\r\n point.x = scrollX + targetRect.left - popupWidth - offset - offsetArrow;\r\n break;\r\n\r\n case RelativePosition.LeftTop:\r\n point.y = scrollY + targetRect.top;\r\n point.x = scrollX + targetRect.left - popupWidth - offset - offsetArrow;\r\n break;\r\n\r\n case RelativePosition.Right:\r\n point.y = scrollY + targetRect.top + (targetRect.height / 2) - (popupHeight / 2);\r\n point.x = scrollX + targetRect.right + offset + offsetArrow;\r\n break;\r\n\r\n case RelativePosition.RightTop:\r\n point.y = scrollY + targetRect.top;\r\n point.x = scrollX + targetRect.right + offset + offsetArrow;\r\n break;\r\n }\r\n\r\n return point;\r\n };\r\n\r\n private _toggleRelativePosition(): RelativePosition {\r\n const { target, position, offset } = this.props;\r\n\r\n if (!this._popup || !target)\r\n return position;\r\n\r\n // istanbul ignore if\r\n if (this._isPositionAbsolute())\r\n return position;\r\n\r\n let newPosition = position;\r\n\r\n interface Rect {\r\n left: number;\r\n top: number;\r\n right: number;\r\n bottom: number;\r\n }\r\n\r\n const activeWindow = this.getParentWindow();\r\n\r\n // Note: Cannot use DOMRect yet since it's experimental and not available in all browsers (Nov. 2018)\r\n const viewportRect: Rect = { left: activeWindow.scrollX, top: activeWindow.scrollY, right: activeWindow.scrollX + activeWindow.innerWidth, bottom: activeWindow.scrollY + activeWindow.innerHeight };\r\n const targetRect = target.getBoundingClientRect();\r\n const { popupWidth, popupHeight } = this._getPopupDimensions();\r\n const containerStyle = activeWindow.getComputedStyle(target);\r\n const offsetArrow = this.props.showArrow ? /* istanbul ignore next */ 10 : 2;\r\n\r\n const bottomMargin = parseMargin(containerStyle.marginBottom);\r\n if ((targetRect.bottom + popupHeight + bottomMargin + offsetArrow + offset) > viewportRect.bottom) {\r\n if (newPosition === RelativePosition.Bottom)\r\n newPosition = RelativePosition.Top;\r\n else if (newPosition === RelativePosition.BottomLeft)\r\n newPosition = RelativePosition.TopLeft;\r\n else if (newPosition === RelativePosition.BottomRight)\r\n newPosition = RelativePosition.TopRight;\r\n }\r\n\r\n const topMargin = parseMargin(containerStyle.marginTop);\r\n if ((targetRect.top - popupHeight - topMargin - offsetArrow - offset) < viewportRect.top) {\r\n if (newPosition === RelativePosition.Top)\r\n newPosition = RelativePosition.Bottom;\r\n else if (newPosition === RelativePosition.TopLeft)\r\n newPosition = RelativePosition.BottomLeft;\r\n else if (newPosition === RelativePosition.TopRight)\r\n newPosition = RelativePosition.BottomRight;\r\n }\r\n\r\n const leftMargin = parseMargin(containerStyle.marginLeft);\r\n if ((targetRect.left - popupWidth - leftMargin - offsetArrow - offset) < viewportRect.left) {\r\n if (newPosition === RelativePosition.Left)\r\n newPosition = RelativePosition.Right;\r\n else if (newPosition === RelativePosition.LeftTop)\r\n newPosition = RelativePosition.RightTop;\r\n }\r\n\r\n const rightMargin = parseMargin(containerStyle.marginRight);\r\n if ((targetRect.right + popupWidth + rightMargin + offsetArrow + offset) > viewportRect.right) {\r\n if (newPosition === RelativePosition.Right)\r\n newPosition = RelativePosition.Left;\r\n else if (newPosition === RelativePosition.RightTop)\r\n newPosition = RelativePosition.LeftTop;\r\n }\r\n\r\n return newPosition;\r\n }\r\n\r\n // fit the popup within the extents of the view port\r\n private _fitPopup = (point: PopupPoint) => {\r\n const fittedPoint = point;\r\n\r\n // istanbul ignore if\r\n if (!this._popup) {\r\n return fittedPoint;\r\n }\r\n\r\n // const popupRect = this._popup.getBoundingClientRect();\r\n const { popupWidth, popupHeight } = this._getPopupDimensions();\r\n const { innerWidth, innerHeight } = window;\r\n\r\n // istanbul ignore if\r\n if (fittedPoint.y + popupHeight > innerHeight) {\r\n fittedPoint.y = innerHeight - popupHeight;\r\n }\r\n\r\n // istanbul ignore if\r\n if (fittedPoint.x + popupWidth > innerWidth) {\r\n fittedPoint.x = innerWidth - popupWidth;\r\n }\r\n\r\n // istanbul ignore if\r\n if (fittedPoint.y < 0) {\r\n fittedPoint.y = 0;\r\n }\r\n\r\n if (fittedPoint.x < 0) {\r\n fittedPoint.x = 0;\r\n }\r\n\r\n return fittedPoint;\r\n };\r\n\r\n private _handleAnimationEnd = (event: React.AnimationEvent<HTMLDivElement>) => {\r\n if (event.target === this._popup) {\r\n this.setState({ animationEnded: true });\r\n }\r\n };\r\n\r\n public override render() {\r\n const animate = this.props.animate !== undefined ? this.props.animate : true;\r\n const className = classnames(\r\n \"core-popup\",\r\n this._getClassNameByPosition(this.state.position),\r\n this.props.showShadow && \"core-popup-shadow\",\r\n this.props.showArrow && \"arrow\",\r\n !animate && \"core-popup-animation-none\",\r\n this.props.className,\r\n this.state.animationEnded && \"core-animation-ended\",\r\n (!this.props.isOpen && this.props.keepContentsMounted) && \"core-popup-hidden\"\r\n );\r\n\r\n const style: React.CSSProperties = {\r\n top: this.state.top,\r\n left: this.state.left,\r\n ...this.props.style,\r\n };\r\n\r\n const role = this.props.role ? this.props.role : \"dialog\"; // accessibility property\r\n\r\n if (!this.props.isOpen && !this.props.keepContentsMounted) {\r\n return null;\r\n }\r\n\r\n return ReactDOM.createPortal(\r\n (\r\n <div\r\n className={className} data-testid=\"core-popup\"\r\n ref={(element) => { this._popup = element; }}\r\n style={style}\r\n role={role}\r\n aria-modal={true}\r\n tabIndex={-1}\r\n aria-label={this.props.ariaLabel}\r\n onAnimationEnd={this._handleAnimationEnd}\r\n >\r\n <FocusTrap active={!!this.props.moveFocus} initialFocusElement={this.props.focusTarget} returnFocusOnDeactivate={true}>\r\n {this.props.children}\r\n </FocusTrap>\r\n </div>\r\n ), this.state.parentDocument.body);\r\n }\r\n}\r\n\r\nfunction parsePxString(pxStr: string): number {\r\n const parsed = parseInt(pxStr, 10);\r\n return parsed || 0;\r\n}\r\n\r\nfunction parseMargin(value: string) {\r\n return value ? /* istanbul ignore next */ parseFloat(value) : 0;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Popup.js","sourceRoot":"","sources":["../../../../src/core-react/popup/Popup.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,cAAc,CAAC;AACtB,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAoFnD;;GAEG;AACH,MAAM,OAAO,KAAM,SAAQ,KAAK,CAAC,SAAiC;IAGhE,YAAY,KAAiB;;QAC3B,KAAK,CAAC,KAAK,CAAC,CAAC;QAHP,WAAM,GAAuB,IAAI,CAAC;QAkFlC,sBAAiB,GAAG,GAAG,EAAE;YAC/B,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;YAC5C,YAAY,CAAC,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;YACvE,YAAY,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;YACtD,YAAY,CAAC,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;YACtE,YAAY,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YACpD,YAAY,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;YAC1D,YAAY,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QACjE,CAAC,CAAC;QAEM,wBAAmB,GAAG,GAAG,EAAE;Y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C,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,mBAAmB,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,uBAAuB,EAAE,IAAI,IAClH,IAAI,CAAC,KAAK,CAAC,QAAQ,CACV,CACR,CACP,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;;AAhea,kBAAY,GAAwB;IAChD,QAAQ,EAAE,gBAAgB,CAAC,MAAM;IACjC,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,CAAC;IACT,GAAG,EAAE,CAAC,CAAC;IACP,IAAI,EAAE,CAAC,CAAC;CACT,CAAC;AA2dJ,SAAS,aAAa,CAAC,KAAa;IAClC,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACnC,OAAO,MAAM,IAAI,CAAC,CAAC;AACrB,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IAChC,OAAO,KAAK,CAAC,CAAC,CAAC,0BAA0B,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Popup\r\n */\r\n\r\nimport \"./Popup.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport * as ReactDOM from \"react-dom\";\r\nimport { RelativePosition, SpecialKey } from \"@itwin/appui-abstract\";\r\nimport { FocusTrap } from \"../focustrap/FocusTrap\";\r\nimport { CommonProps } from \"../utils/Props\";\r\n\r\n// cSpell:ignore focustrap focusable alertdialog\r\n\r\n/** @internal */\r\ninterface PopupPoint {\r\n x: number;\r\n y: number;\r\n}\r\n\r\n/** Properties for the [[Popup]] component\r\n * @public\r\n */\r\nexport interface PopupProps extends CommonProps {\r\n /** Show or hide the box shadow (defaults to true) */\r\n showShadow: boolean;\r\n /** Show or hide the arrow (defaults to false) */\r\n showArrow: boolean;\r\n /** Indicates whether the popup is shown or not (defaults to false) */\r\n isOpen: boolean;\r\n /** Direction (relative to the target) to which the popup is expanded (defaults to Bottom) */\r\n position: RelativePosition;\r\n /** Top position (absolute positioning - defaults to 0) */\r\n top: number;\r\n /** Left position (absolute positioning - defaults to 0) */\r\n left: number;\r\n /** Function called when the popup is opened */\r\n onOpen?: () => void;\r\n /** Function called when user clicks outside the popup */\r\n onOutsideClick?: (e: MouseEvent) => void;\r\n /** Function called when the popup is closed */\r\n onClose?: () => void;\r\n /** Function called when the popup is closed on Enter */\r\n onEnter?: () => void;\r\n /** Function called when the wheel is used */\r\n onWheel?: (e: WheelEvent) => void;\r\n /** Function called when the right mouse button is pressed */\r\n onContextMenu?: (e: MouseEvent) => void;\r\n /** Offset from the parent (defaults to 4) */\r\n offset: number;\r\n /** Target element to position popup */\r\n target?: HTMLElement | null;\r\n /** Role - if not specified \"dialog\" is used */\r\n role?: \"dialog\" | \"alert\" | \"alertdialog\";\r\n /** accessibility label */\r\n ariaLabel?: string;\r\n /** set focus to popup - default to not set focus */\r\n moveFocus?: boolean;\r\n /** Element to receive focus, specified by React.RefObject or CSS selector string. If undefined and moveFocus is true then focus is moved to first focusable element. */\r\n focusTarget?: React.RefObject<HTMLElement> | string;\r\n /** Indicates whether the popup is pinned. */\r\n isPinned?: boolean;\r\n /** Indicates whether to use animation for open/close (defaults to true) */\r\n animate?: boolean;\r\n /** Indicates whether to close the popup when Enter is pressed (defaults to true) */\r\n closeOnEnter?: boolean;\r\n /** Indicates whether to close the popup when the wheel is used (defaults to true) */\r\n closeOnWheel?: boolean;\r\n /** Indicates whether to close the popup when the right mouse button is pressed (defaults to true) */\r\n closeOnContextMenu?: boolean;\r\n /** If false outside click processing and closing are skipped if click occurs in another Popup component, default to false. */\r\n closeOnNestedPopupOutsideClick?: boolean;\r\n /** If true the children are mounted once and unmounted when this component is unmounted. If false the\r\n * children are unmounted each time the popup is closed. */\r\n keepContentsMounted?: boolean;\r\n\r\n /**\r\n * If true the popup will remain open and will be repositioned when window resize events occur, default to false.\r\n * @beta\r\n * */\r\n repositionOnResize?: boolean;\r\n}\r\n\r\n/** @internal */\r\ninterface PopupState {\r\n isOpen: boolean;\r\n top: number;\r\n left: number;\r\n position: RelativePosition;\r\n parentDocument: Document;\r\n animationEnded: boolean;\r\n}\r\n\r\n/** Popup React component displays a popup relative to an optional target element.\r\n * @public\r\n */\r\nexport class Popup extends React.Component<PopupProps, PopupState> {\r\n private _popup: HTMLElement | null = null;\r\n\r\n constructor(props: PopupProps) {\r\n super(props);\r\n const parentDocument = this.props.target?.ownerDocument ?? document;\r\n\r\n this.state = {\r\n animationEnded: false,\r\n isOpen: this.props.isOpen,\r\n top: 0,\r\n left: 0,\r\n position: this.props.position,\r\n parentDocument,\r\n };\r\n }\r\n\r\n public static defaultProps: Partial<PopupProps> = {\r\n position: RelativePosition.Bottom,\r\n showShadow: true,\r\n showArrow: false,\r\n isOpen: false,\r\n offset: 4,\r\n top: -1,\r\n left: -1,\r\n };\r\n\r\n public override componentDidMount() {\r\n if (this.props.isOpen) {\r\n this._onShow();\r\n }\r\n }\r\n\r\n private getParentWindow() {\r\n // istanbul ignore next\r\n return this.state.parentDocument.defaultView ?? window;\r\n }\r\n\r\n public override componentDidUpdate(previousProps: PopupProps, prevState: PopupState) {\r\n if (this.state.position !== prevState.position) {\r\n this.setState( { animationEnded: false });\r\n }\r\n\r\n if (this.props.target !== previousProps.target) {\r\n // istanbul ignore next\r\n {\r\n const parentDocument = this.props.target?.ownerDocument ?? document;\r\n if (parentDocument !== this.state.parentDocument) {\r\n this._unBindWindowEvents();\r\n this.setState({ parentDocument });\r\n }\r\n }\r\n }\r\n\r\n if (this.props.isOpen === previousProps.isOpen) {\r\n if (this.props.isOpen) {\r\n const position = this._toggleRelativePosition();\r\n const point = this._fitPopup(this._getPosition(position));\r\n if ((Math.abs(this.state.left - point.x) < 3) &&\r\n (Math.abs(this.state.top - point.y) < 3) &&\r\n this.state.position === position)\r\n return;\r\n\r\n this.setState({\r\n left: point.x,\r\n top: point.y,\r\n position,\r\n });\r\n }\r\n return;\r\n }\r\n\r\n if (this.props.isOpen) {\r\n this._onShow();\r\n } else {\r\n this._onClose();\r\n }\r\n }\r\n\r\n public override componentWillUnmount() {\r\n this._unBindWindowEvents();\r\n }\r\n\r\n private _bindWindowEvents = () => {\r\n const activeWindow = this.getParentWindow();\r\n activeWindow.addEventListener(\"pointerdown\", this._handleOutsideClick);\r\n activeWindow.addEventListener(\"resize\", this._resize);\r\n activeWindow.addEventListener(\"contextmenu\", this._handleContextMenu);\r\n activeWindow.addEventListener(\"scroll\", this._hide);\r\n activeWindow.addEventListener(\"wheel\", this._handleWheel);\r\n activeWindow.addEventListener(\"keydown\", this._handleKeyboard);\r\n };\r\n\r\n private _unBindWindowEvents = () => {\r\n const activeWindow = this.getParentWindow();\r\n activeWindow.removeEventListener(\"pointerdown\", this._handleOutsideClick);\r\n activeWindow.removeEventListener(\"resize\", this._resize);\r\n activeWindow.removeEventListener(\"contextmenu\", this._handleContextMenu);\r\n activeWindow.removeEventListener(\"scroll\", this._hide);\r\n activeWindow.removeEventListener(\"wheel\", this._handleWheel);\r\n activeWindow.removeEventListener(\"keydown\", this._handleKeyboard);\r\n };\r\n\r\n private _handleWheel = (event: WheelEvent) => {\r\n if (this._popup && this._popup.contains(event.target as Node))\r\n return;\r\n\r\n if (this.props.onWheel)\r\n return this.props.onWheel(event);\r\n\r\n const closeOnWheel = this.props.closeOnWheel !== undefined ? this.props.closeOnWheel : true;\r\n if (closeOnWheel)\r\n this._hide();\r\n };\r\n\r\n private isInCorePopup(element: HTMLElement): boolean {\r\n if (element.nodeName === \"DIV\") {\r\n if (element.classList && element.classList.contains(\"core-popup\"))\r\n return true;\r\n if (element.parentElement && this.isInCorePopup(element.parentElement))\r\n return true;\r\n } else {\r\n // istanbul ignore else\r\n if (element.parentElement && this.isInCorePopup(element.parentElement))\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n private _handleOutsideClick = (event: MouseEvent): void => {\r\n if (this._popup && this._popup.contains(event.target as Node))\r\n return;\r\n\r\n if (this.props.isPinned)\r\n return;\r\n\r\n if (!this.props.closeOnNestedPopupOutsideClick && this.isInCorePopup(event.target as HTMLElement))\r\n return;\r\n\r\n if (this.props.onOutsideClick)\r\n return this.props.onOutsideClick(event);\r\n\r\n if (this.props.target && this.props.target.contains(event.target as Node))\r\n return;\r\n\r\n this._onClose();\r\n };\r\n\r\n private _handleContextMenu = (event: MouseEvent) => {\r\n if (this._popup && this._popup.contains(event.target as Node))\r\n return;\r\n\r\n if (this.props.onContextMenu)\r\n return this.props.onContextMenu(event);\r\n\r\n const closeOnContextMenu = this.props.closeOnContextMenu !== undefined ? this.props.closeOnContextMenu : true;\r\n if (closeOnContextMenu)\r\n this._hide();\r\n };\r\n\r\n private _handleKeyboard = (event: KeyboardEvent): void => {\r\n if (this.props.isPinned)\r\n return;\r\n\r\n if (event.key === SpecialKey.Escape || event.key === SpecialKey.Enter) {\r\n const closeOnEnter = this.props.closeOnEnter !== undefined ? this.props.closeOnEnter : true;\r\n if (event.key === SpecialKey.Enter) {\r\n if (closeOnEnter)\r\n this._onClose(true);\r\n else\r\n this.props.onEnter && this.props.onEnter();\r\n } else {\r\n this._onClose(false);\r\n }\r\n }\r\n };\r\n\r\n private _resize = () => {\r\n if (this.props.repositionOnResize) {\r\n const position = this._toggleRelativePosition();\r\n const point = this._fitPopup(this._getPosition(position));\r\n this.setState({ left: point.x, top: point.y, position });\r\n } else {\r\n this._hide(); // legacy behavior\r\n }\r\n };\r\n\r\n private _hide = () => {\r\n if (this.props.isPinned)\r\n return;\r\n\r\n this._onClose();\r\n };\r\n\r\n private _onShow() {\r\n this._bindWindowEvents();\r\n const position = this._toggleRelativePosition();\r\n const point = this._fitPopup(this._getPosition(position));\r\n\r\n this.setState({ left: point.x, top: point.y, isOpen: true, position }, () => {\r\n if (this.props.onOpen)\r\n this.props.onOpen();\r\n });\r\n }\r\n\r\n private _onClose(enterKey?: boolean) {\r\n if (!this.state.isOpen)\r\n return;\r\n\r\n this._unBindWindowEvents();\r\n\r\n this.setState({ isOpen: false }, () => {\r\n if (enterKey && this.props.onEnter)\r\n this.props.onEnter();\r\n if (this.props.onClose)\r\n this.props.onClose();\r\n });\r\n }\r\n\r\n private _isPositionAbsolute(): boolean {\r\n return (this.props.top !== -1 && this.props.left !== -1);\r\n }\r\n\r\n private _getClassNameByPosition(position: RelativePosition): string {\r\n if (!this._isPositionAbsolute()) {\r\n switch (position) {\r\n case RelativePosition.TopLeft:\r\n return \"core-popup-top-left\";\r\n case RelativePosition.TopRight:\r\n return \"core-popup-top-right\";\r\n case RelativePosition.BottomLeft:\r\n return \"core-popup-bottom-left\";\r\n case RelativePosition.BottomRight:\r\n return \"core-popup-bottom-right\";\r\n case RelativePosition.Top:\r\n return \"core-popup-top\";\r\n case RelativePosition.Left:\r\n return \"core-popup-left\";\r\n case RelativePosition.Right:\r\n return \"core-popup-right\";\r\n case RelativePosition.Bottom:\r\n return \"core-popup-bottom\";\r\n case RelativePosition.LeftTop:\r\n return \"core-popup-left-top\";\r\n case RelativePosition.RightTop:\r\n return \"core-popup-right-top\";\r\n }\r\n }\r\n\r\n return \"\";\r\n }\r\n\r\n private _getPopupDimensions(): { popupWidth: number, popupHeight: number } {\r\n let popupWidth = 0;\r\n let popupHeight = 0;\r\n // istanbul ignore else\r\n if (this._popup) {\r\n const activeWindow = this.getParentWindow();\r\n const style = activeWindow.getComputedStyle(this._popup);\r\n const borderLeftWidth = parsePxString(style.borderLeftWidth);\r\n const borderRightWidth = parsePxString(style.borderRightWidth);\r\n const borderTopWidth = parsePxString(style.borderTopWidth);\r\n const borderBottomWidth = parsePxString(style.borderBottomWidth);\r\n popupWidth = this._popup.clientWidth + borderLeftWidth + borderRightWidth;\r\n popupHeight = this._popup.clientHeight + borderTopWidth + borderBottomWidth;\r\n }\r\n\r\n return { popupWidth, popupHeight };\r\n }\r\n\r\n private _getPosition = (position: RelativePosition) => {\r\n const activeWindow = this.getParentWindow();\r\n const { target, offset, top, left } = this.props;\r\n const offsetArrow = (this.props.showArrow) ? 6 : 0;\r\n\r\n // absolute position\r\n if (this._isPositionAbsolute())\r\n return { x: left, y: top };\r\n\r\n // sanity check\r\n const point = { x: 0, y: 0 };\r\n if (!this._popup || !target)\r\n return point;\r\n\r\n // relative position\r\n const scrollY = activeWindow.scrollY;\r\n const scrollX = activeWindow.scrollX;\r\n\r\n const targetRect = target.getBoundingClientRect();\r\n\r\n const { popupWidth, popupHeight } = this._getPopupDimensions();\r\n\r\n switch (position) {\r\n case RelativePosition.Top:\r\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\r\n point.x = scrollX + targetRect.left + (targetRect.width / 2) - (popupWidth / 2);\r\n break;\r\n\r\n case RelativePosition.TopLeft:\r\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\r\n point.x = scrollX + targetRect.left;\r\n break;\r\n\r\n case RelativePosition.TopRight:\r\n point.y = scrollY + targetRect.top - popupHeight - offset - offsetArrow;\r\n point.x = scrollX + targetRect.right - popupWidth;\r\n break;\r\n\r\n case RelativePosition.Bottom:\r\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\r\n point.x = scrollX + targetRect.left + (targetRect.width / 2) - (popupWidth / 2);\r\n break;\r\n\r\n case RelativePosition.BottomLeft:\r\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\r\n point.x = scrollX + targetRect.left;\r\n break;\r\n\r\n case RelativePosition.BottomRight:\r\n point.y = scrollY + targetRect.bottom + offset + offsetArrow;\r\n point.x = scrollX + targetRect.right - popupWidth;\r\n break;\r\n\r\n case RelativePosition.Left:\r\n point.y = scrollY + targetRect.top + (targetRect.height / 2) - (popupHeight / 2);\r\n point.x = scrollX + targetRect.left - popupWidth - offset - offsetArrow;\r\n break;\r\n\r\n case RelativePosition.LeftTop:\r\n point.y = scrollY + targetRect.top;\r\n point.x = scrollX + targetRect.left - popupWidth - offset - offsetArrow;\r\n break;\r\n\r\n case RelativePosition.Right:\r\n point.y = scrollY + targetRect.top + (targetRect.height / 2) - (popupHeight / 2);\r\n point.x = scrollX + targetRect.right + offset + offsetArrow;\r\n break;\r\n\r\n case RelativePosition.RightTop:\r\n point.y = scrollY + targetRect.top;\r\n point.x = scrollX + targetRect.right + offset + offsetArrow;\r\n break;\r\n }\r\n\r\n return point;\r\n };\r\n\r\n private _toggleRelativePosition(): RelativePosition {\r\n const { target, position, offset } = this.props;\r\n\r\n if (!this._popup || !target)\r\n return position;\r\n\r\n // istanbul ignore if\r\n if (this._isPositionAbsolute())\r\n return position;\r\n\r\n let newPosition = position;\r\n\r\n interface Rect {\r\n left: number;\r\n top: number;\r\n right: number;\r\n bottom: number;\r\n }\r\n\r\n const activeWindow = this.getParentWindow();\r\n\r\n // Note: Cannot use DOMRect yet since it's experimental and not available in all browsers (Nov. 2018)\r\n const viewportRect: Rect = { left: activeWindow.scrollX, top: activeWindow.scrollY, right: activeWindow.scrollX + activeWindow.innerWidth, bottom: activeWindow.scrollY + activeWindow.innerHeight };\r\n const targetRect = target.getBoundingClientRect();\r\n const { popupWidth, popupHeight } = this._getPopupDimensions();\r\n const containerStyle = activeWindow.getComputedStyle(target);\r\n const offsetArrow = this.props.showArrow ? /* istanbul ignore next */ 10 : 2;\r\n\r\n const bottomMargin = parseMargin(containerStyle.marginBottom);\r\n if ((targetRect.bottom + popupHeight + bottomMargin + offsetArrow + offset) > viewportRect.bottom) {\r\n if (newPosition === RelativePosition.Bottom)\r\n newPosition = RelativePosition.Top;\r\n else if (newPosition === RelativePosition.BottomLeft)\r\n newPosition = RelativePosition.TopLeft;\r\n else if (newPosition === RelativePosition.BottomRight)\r\n newPosition = RelativePosition.TopRight;\r\n }\r\n\r\n const topMargin = parseMargin(containerStyle.marginTop);\r\n if ((targetRect.top - popupHeight - topMargin - offsetArrow - offset) < viewportRect.top) {\r\n if (newPosition === RelativePosition.Top)\r\n newPosition = RelativePosition.Bottom;\r\n else if (newPosition === RelativePosition.TopLeft)\r\n newPosition = RelativePosition.BottomLeft;\r\n else if (newPosition === RelativePosition.TopRight)\r\n newPosition = RelativePosition.BottomRight;\r\n }\r\n\r\n const leftMargin = parseMargin(containerStyle.marginLeft);\r\n if ((targetRect.left - popupWidth - leftMargin - offsetArrow - offset) < viewportRect.left) {\r\n if (newPosition === RelativePosition.Left)\r\n newPosition = RelativePosition.Right;\r\n else if (newPosition === RelativePosition.LeftTop)\r\n newPosition = RelativePosition.RightTop;\r\n }\r\n\r\n const rightMargin = parseMargin(containerStyle.marginRight);\r\n if ((targetRect.right + popupWidth + rightMargin + offsetArrow + offset) > viewportRect.right) {\r\n if (newPosition === RelativePosition.Right)\r\n newPosition = RelativePosition.Left;\r\n else if (newPosition === RelativePosition.RightTop)\r\n newPosition = RelativePosition.LeftTop;\r\n }\r\n\r\n return newPosition;\r\n }\r\n\r\n // fit the popup within the extents of the view port\r\n private _fitPopup = (point: PopupPoint) => {\r\n const fittedPoint = point;\r\n\r\n // istanbul ignore if\r\n if (!this._popup) {\r\n return fittedPoint;\r\n }\r\n\r\n // const popupRect = this._popup.getBoundingClientRect();\r\n const { popupWidth, popupHeight } = this._getPopupDimensions();\r\n const { innerWidth, innerHeight } = window;\r\n\r\n // istanbul ignore if\r\n if (fittedPoint.y + popupHeight > innerHeight) {\r\n fittedPoint.y = innerHeight - popupHeight;\r\n }\r\n\r\n // istanbul ignore if\r\n if (fittedPoint.x + popupWidth > innerWidth) {\r\n fittedPoint.x = innerWidth - popupWidth;\r\n }\r\n\r\n // istanbul ignore if\r\n if (fittedPoint.y < 0) {\r\n fittedPoint.y = 0;\r\n }\r\n\r\n if (fittedPoint.x < 0) {\r\n fittedPoint.x = 0;\r\n }\r\n\r\n return fittedPoint;\r\n };\r\n\r\n private _handleAnimationEnd = (event: React.AnimationEvent<HTMLDivElement>) => {\r\n if (event.target === this._popup) {\r\n this.setState({ animationEnded: true });\r\n }\r\n };\r\n\r\n public override render() {\r\n const animate = this.props.animate !== undefined ? this.props.animate : true;\r\n const className = classnames(\r\n \"core-popup\",\r\n this._getClassNameByPosition(this.state.position),\r\n this.props.showShadow && \"core-popup-shadow\",\r\n this.props.showArrow && \"arrow\",\r\n !animate && \"core-popup-animation-none\",\r\n this.props.className,\r\n this.state.animationEnded && \"core-animation-ended\",\r\n (!this.props.isOpen && this.props.keepContentsMounted) && \"core-popup-hidden\"\r\n );\r\n\r\n const style: React.CSSProperties = {\r\n top: this.state.top,\r\n left: this.state.left,\r\n ...this.props.style,\r\n };\r\n\r\n const role = this.props.role ? this.props.role : \"dialog\"; // accessibility property\r\n\r\n if (!this.props.isOpen && !this.props.keepContentsMounted) {\r\n return null;\r\n }\r\n\r\n return ReactDOM.createPortal(\r\n (\r\n <div\r\n className={className} data-testid=\"core-popup\"\r\n ref={(element) => { this._popup = element; }}\r\n style={style}\r\n role={role}\r\n aria-modal={true}\r\n tabIndex={-1}\r\n aria-label={this.props.ariaLabel}\r\n onAnimationEnd={this._handleAnimationEnd}\r\n >\r\n <FocusTrap active={!!this.props.moveFocus} initialFocusElement={this.props.focusTarget} returnFocusOnDeactivate={true}>\r\n {this.props.children}\r\n </FocusTrap>\r\n </div>\r\n ), this.state.parentDocument.body);\r\n }\r\n}\r\n\r\nfunction parsePxString(pxStr: string): number {\r\n const parsed = parseInt(pxStr, 10);\r\n return parsed || 0;\r\n}\r\n\r\nfunction parseMargin(value: string) {\r\n return value ? /* istanbul ignore next */ parseFloat(value) : 0;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconWebComponent.d.ts","sourceRoot":"","sources":["../../../../src/core-react/utils/IconWebComponent.ts"],"names":[],"mappings":"AAMA;;GAEG;AAMH;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;YACjC,iBAAiB;YAKjB,OAAO;
|
|
1
|
+
{"version":3,"file":"IconWebComponent.d.ts","sourceRoot":"","sources":["../../../../src/core-react/utils/IconWebComponent.ts"],"names":[],"mappings":"AAMA;;GAEG;AAMH;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;YACjC,iBAAiB;YAKjB,OAAO;CAwBtB"}
|
|
@@ -19,6 +19,9 @@ export class IconWebComponent extends HTMLElement {
|
|
|
19
19
|
this.dispatchEvent(new CustomEvent("load"));
|
|
20
20
|
}
|
|
21
21
|
async loadSvg() {
|
|
22
|
+
// if svg was already appended don't request it again
|
|
23
|
+
if (this.childNodes.length)
|
|
24
|
+
return;
|
|
22
25
|
await fetch(this.getAttribute("src") || "")
|
|
23
26
|
.catch((_error) => {
|
|
24
27
|
Logger.logError(UiCore.loggerCategory(this), "Unable to load icon.");
|
|
@@ -39,7 +42,7 @@ export class IconWebComponent extends HTMLElement {
|
|
|
39
42
|
throw new UiError(UiCore.loggerCategory(this), "Unable to load icon.");
|
|
40
43
|
}
|
|
41
44
|
})
|
|
42
|
-
.then((data) => this.append(data.documentElement));
|
|
45
|
+
.then((data) => !this.childNodes.length && this.append(data.documentElement));
|
|
43
46
|
}
|
|
44
47
|
}
|
|
45
48
|
//# sourceMappingURL=IconWebComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconWebComponent.js","sourceRoot":"","sources":["../../../../src/core-react/utils/IconWebComponent.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,uBAAuB;AACvB,+CAA+C;AAC/C;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,WAAW;IACvC,KAAK,CAAC,iBAAiB;QAC7B,MAAM,IAA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ACH,CAAC,CAAC;aACD,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;IAClF,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n// istanbul ignore file\r\n// IconWebComponent requires in-browser testing\r\n/** @packageDocumentation\r\n * @module Utilities\r\n */\r\n\r\nimport { UiError } from \"@itwin/appui-abstract\";\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport { UiCore } from \"../UiCore\";\r\n\r\n/**\r\n * IconWebComponent loads icon from an svg path\r\n */\r\nexport class IconWebComponent extends HTMLElement {\r\n private async connectedCallback() {\r\n await this.loadSvg();\r\n this.dispatchEvent(new CustomEvent(\"load\"));\r\n }\r\n\r\n private async loadSvg() {\r\n // if svg was already appended don't request it again\r\n if (this.childNodes.length)\r\n return;\r\n await fetch(this.getAttribute(\"src\") || \"\")\r\n .catch((_error) => {\r\n Logger.logError(UiCore.loggerCategory(this), \"Unable to load icon.\");\r\n })\r\n .then(async (response) => {\r\n if (response && response.ok) {\r\n return response.text();\r\n } else {\r\n throw new UiError (UiCore.loggerCategory(this), \"Unable to load icon.\");\r\n }\r\n })\r\n .then((str) => {\r\n if (str !== undefined) {\r\n return (new window.DOMParser()).parseFromString(str, \"text/xml\");\r\n } else {\r\n throw new UiError (UiCore.loggerCategory(this), \"Unable to load icon.\");\r\n }\r\n })\r\n .then((data) => !this.childNodes.length && this.append(data.documentElement));\r\n }\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/core-react",
|
|
3
|
-
"version": "3.3.0-dev.
|
|
3
|
+
"version": "3.3.0-dev.70",
|
|
4
4
|
"description": "iTwin.js UI core components",
|
|
5
5
|
"main": "lib/cjs/core-react.js",
|
|
6
6
|
"module": "lib/esm/core-react.js",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"url": "http://www.bentley.com"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@itwin/appui-abstract": "^3.3.0-dev.
|
|
26
|
-
"@itwin/core-bentley": "^3.3.0-dev.
|
|
25
|
+
"@itwin/appui-abstract": "^3.3.0-dev.70",
|
|
26
|
+
"@itwin/core-bentley": "^3.3.0-dev.70",
|
|
27
27
|
"react": "^17.0.0",
|
|
28
28
|
"react-dom": "^17.0.0"
|
|
29
29
|
},
|
|
@@ -32,17 +32,17 @@
|
|
|
32
32
|
"NOTE: All tools used by scripts in this package must be listed as devDependencies"
|
|
33
33
|
],
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@itwin/appui-abstract": "3.3.0-dev.
|
|
36
|
-
"@itwin/build-tools": "3.3.0-dev.
|
|
37
|
-
"@itwin/core-bentley": "3.3.0-dev.
|
|
38
|
-
"@itwin/core-common": "3.3.0-dev.
|
|
39
|
-
"@itwin/core-i18n": "3.3.0-dev.
|
|
40
|
-
"@itwin/eslint-plugin": "3.3.0-dev.
|
|
35
|
+
"@itwin/appui-abstract": "3.3.0-dev.70",
|
|
36
|
+
"@itwin/build-tools": "3.3.0-dev.70",
|
|
37
|
+
"@itwin/core-bentley": "3.3.0-dev.70",
|
|
38
|
+
"@itwin/core-common": "3.3.0-dev.70",
|
|
39
|
+
"@itwin/core-i18n": "3.3.0-dev.70",
|
|
40
|
+
"@itwin/eslint-plugin": "3.3.0-dev.70",
|
|
41
41
|
"@testing-library/dom": "^8.11.2",
|
|
42
42
|
"@testing-library/react": "^12.0.0",
|
|
43
43
|
"@testing-library/react-hooks": "^7.0.2",
|
|
44
44
|
"@testing-library/user-event": "^13.2.1",
|
|
45
|
-
"@types/chai": "
|
|
45
|
+
"@types/chai": "4.3.1",
|
|
46
46
|
"@types/chai-as-promised": "^7",
|
|
47
47
|
"@types/chai-jest-snapshot": "^1.3.0",
|
|
48
48
|
"@types/chai-spies": "^1.0.0",
|
|
@@ -63,13 +63,13 @@
|
|
|
63
63
|
"chai-jest-snapshot": "^2.0.0",
|
|
64
64
|
"chai-spies": "1.0.0",
|
|
65
65
|
"cpx2": "^3.0.0",
|
|
66
|
-
"enzyme": "
|
|
66
|
+
"enzyme": "3.10.0",
|
|
67
67
|
"enzyme-to-json": "^3.3.4",
|
|
68
68
|
"eslint": "^7.11.0",
|
|
69
69
|
"ignore-styles": "^5.0.1",
|
|
70
70
|
"jsdom": "^19.0.0",
|
|
71
71
|
"jsdom-global": "3.0.2",
|
|
72
|
-
"mocha": "^
|
|
72
|
+
"mocha": "^10.0.0",
|
|
73
73
|
"nyc": "^15.1.0",
|
|
74
74
|
"raf": "^3.4.0",
|
|
75
75
|
"react": "^17.0.0",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"rimraf": "^3.0.2",
|
|
80
80
|
"sinon": "^9.0.2",
|
|
81
81
|
"sinon-chai": "^3.2.0",
|
|
82
|
-
"ts-node": "^10.
|
|
82
|
+
"ts-node": "^10.8.2",
|
|
83
83
|
"typemoq": "^2.1.0",
|
|
84
84
|
"typescript": "~4.4.0",
|
|
85
85
|
"xmlhttprequest": "^1.8.0"
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"dependencies": {
|
|
92
92
|
"@bentley/icons-generic-webfont": "^1.0.15",
|
|
93
93
|
"@itwin/itwinui-css": "0.x",
|
|
94
|
-
"@itwin/itwinui-react": "^1.
|
|
94
|
+
"@itwin/itwinui-react": "^1.38.1",
|
|
95
95
|
"classnames": "^2.3.1",
|
|
96
96
|
"dompurify": "^2.0.12",
|
|
97
97
|
"lodash": "^4.17.10",
|