@itwin/core-react 3.4.0-dev.8 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -1
- package/lib/cjs/core-react/_z-index.scss +1 -1
- package/lib/cjs/core-react/hocs/withOnOutsideClick.d.ts.map +1 -1
- package/lib/cjs/core-react/hocs/withOnOutsideClick.js +3 -0
- package/lib/cjs/core-react/hocs/withOnOutsideClick.js.map +1 -1
- package/lib/cjs/core-react/icons/IconComponent.d.ts.map +1 -1
- package/lib/cjs/core-react/icons/IconComponent.js +6 -2
- package/lib/cjs/core-react/icons/IconComponent.js.map +1 -1
- package/lib/cjs/core-react/select/ThemedSelect.js +1 -1
- package/lib/cjs/core-react/select/ThemedSelect.js.map +1 -1
- package/lib/cjs/core-react/utils/IconWebComponent.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/IconWebComponent.js +22 -1
- package/lib/cjs/core-react/utils/IconWebComponent.js.map +1 -1
- package/lib/cjs/core-react/utils/getCssVariable.d.ts.map +1 -1
- package/lib/cjs/core-react/utils/getCssVariable.js +0 -2
- package/lib/cjs/core-react/utils/getCssVariable.js.map +1 -1
- package/lib/esm/core-react/_z-index.scss +1 -1
- package/lib/esm/core-react/hocs/withOnOutsideClick.d.ts.map +1 -1
- package/lib/esm/core-react/hocs/withOnOutsideClick.js +3 -0
- package/lib/esm/core-react/hocs/withOnOutsideClick.js.map +1 -1
- package/lib/esm/core-react/icons/IconComponent.d.ts.map +1 -1
- package/lib/esm/core-react/icons/IconComponent.js +6 -2
- package/lib/esm/core-react/icons/IconComponent.js.map +1 -1
- package/lib/esm/core-react/select/ThemedSelect.js +1 -1
- package/lib/esm/core-react/select/ThemedSelect.js.map +1 -1
- package/lib/esm/core-react/utils/IconWebComponent.d.ts.map +1 -1
- package/lib/esm/core-react/utils/IconWebComponent.js +22 -1
- package/lib/esm/core-react/utils/IconWebComponent.js.map +1 -1
- package/lib/esm/core-react/utils/getCssVariable.d.ts.map +1 -1
- package/lib/esm/core-react/utils/getCssVariable.js +0 -2
- package/lib/esm/core-react/utils/getCssVariable.js.map +1 -1
- package/package.json +14 -22
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,54 @@
|
|
|
1
1
|
# Change Log - @itwin/core-react
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 13 Oct 2022 20:24:47 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 3.4.0
|
|
6
|
+
Thu, 13 Oct 2022 20:24:47 GMT
|
|
7
|
+
|
|
8
|
+
### Updates
|
|
9
|
+
|
|
10
|
+
- Added data uri handling for svg components
|
|
11
|
+
- Updated Node types declaration to support latest v16
|
|
12
|
+
|
|
13
|
+
## 3.3.5
|
|
14
|
+
Tue, 27 Sep 2022 11:50:59 GMT
|
|
15
|
+
|
|
16
|
+
_Version update only_
|
|
17
|
+
|
|
18
|
+
## 3.3.4
|
|
19
|
+
Thu, 08 Sep 2022 19:00:05 GMT
|
|
20
|
+
|
|
21
|
+
_Version update only_
|
|
22
|
+
|
|
23
|
+
## 3.3.3
|
|
24
|
+
Tue, 06 Sep 2022 20:54:19 GMT
|
|
25
|
+
|
|
26
|
+
_Version update only_
|
|
27
|
+
|
|
28
|
+
## 3.3.2
|
|
29
|
+
Thu, 01 Sep 2022 14:37:22 GMT
|
|
30
|
+
|
|
31
|
+
_Version update only_
|
|
32
|
+
|
|
33
|
+
## 3.3.1
|
|
34
|
+
Fri, 26 Aug 2022 15:40:02 GMT
|
|
35
|
+
|
|
36
|
+
_Version update only_
|
|
37
|
+
|
|
38
|
+
## 3.3.0
|
|
39
|
+
Thu, 18 Aug 2022 19:08:02 GMT
|
|
40
|
+
|
|
41
|
+
### Updates
|
|
42
|
+
|
|
43
|
+
- upgrade mocha to version 10.0.0
|
|
44
|
+
- Fix svg-loader to only fetch svg data once. Also update buic-background-panel to use buic-background-1 so disabled itwin-ui components are properly displayed.
|
|
45
|
+
- Add drop-target stacking context layer.
|
|
46
|
+
- Update iTwinUI-react to 1.38.1
|
|
47
|
+
|
|
48
|
+
## 3.2.9
|
|
49
|
+
Fri, 26 Aug 2022 14:21:40 GMT
|
|
50
|
+
|
|
51
|
+
_Version update only_
|
|
4
52
|
|
|
5
53
|
## 3.2.8
|
|
6
54
|
Tue, 09 Aug 2022 15:52:41 GMT
|
|
@@ -35,7 +35,7 @@ $uicore-internal-z-index-layers: view-overlay,
|
|
|
35
35
|
$uicore-z-index-step: 1000;
|
|
36
36
|
|
|
37
37
|
@function uicore-internal-get-next-z-index-step($counter) {
|
|
38
|
-
@return $counter
|
|
38
|
+
@return $counter + $uicore-z-index-step;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
$uicore-internal-z-index-layer-map: uicore-map-from-array-with-result-arg($uicore-internal-z-index-layers, get-function(uicore-internal-get-next-z-index-step), 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withOnOutsideClick.d.ts","sourceRoot":"","sources":["../../../../src/core-react/hocs/withOnOutsideClick.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,sCAAsC;IACtC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,GAAG,CAAC;IAC5C,8HAA8H;IAC9H,8BAA8B,CAAC,EAAE,OAAO,CAAC;CAC1C;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,+GAGG,UAAU,KAAK,GAAG,4BACtC,OAAO,qBACD,OAAO;;QAGvB,gBAAgB;;QAEhB,gBAAgB;;QAGhB,gBAAgB;+BACc,WAAW,GAAG,OAAO;QAcnD,gBAAgB;0BACS,UAAU;QAcnC,gBAAgB;iCACiB,UAAU;QAO3C,gBAAgB;uCACuB,YAAY;
|
|
1
|
+
{"version":3,"file":"withOnOutsideClick.d.ts","sourceRoot":"","sources":["../../../../src/core-react/hocs/withOnOutsideClick.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,sCAAsC;IACtC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,GAAG,CAAC;IAC5C,8HAA8H;IAC9H,8BAA8B,CAAC,EAAE,OAAO,CAAC;CAC1C;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,+GAGG,UAAU,KAAK,GAAG,4BACtC,OAAO,qBACD,OAAO;;QAGvB,gBAAgB;;QAEhB,gBAAgB;;QAGhB,gBAAgB;+BACc,WAAW,GAAG,OAAO;QAcnD,gBAAgB;0BACS,UAAU;QAcnC,gBAAgB;iCACiB,UAAU;QAO3C,gBAAgB;uCACuB,YAAY;QASnD,gBAAgB;qCACqB,YAAY;sEAaqB,cAAc,GAAG,IAAI;;;QAkB3F,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;QArFhB,gBAAgB;;QAEhB,gBAAgB;;QAGhB,gBAAgB;+BACc,WAAW,GAAG,OAAO;QAcnD,gBAAgB;0BACS,UAAU;QAcnC,gBAAgB;iCACiB,UAAU;QAO3C,gBAAgB;uCACuB,YAAY;QASnD,gBAAgB;qCACqB,YAAY;sEAaqB,cAAc,GAAG,IAAI;;;QAkB3F,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;CAmBnB,CAAC"}
|
|
@@ -31,6 +31,7 @@ Component, defaultOnOutsideClick, useCapture = true, usePointerEvents = true) =>
|
|
|
31
31
|
/** @internal */
|
|
32
32
|
this.handleDocumentPointerDown = (e) => {
|
|
33
33
|
this.isDownOutside = true;
|
|
34
|
+
// istanbul ignore else
|
|
34
35
|
if (this.outsideClickContainerDiv) {
|
|
35
36
|
// typically e.target test for instance of Node, but this is not working from pop out windows
|
|
36
37
|
this.isDownOutside = !!e.target && !this.outsideClickContainerDiv.contains(e.target);
|
|
@@ -39,6 +40,7 @@ Component, defaultOnOutsideClick, useCapture = true, usePointerEvents = true) =>
|
|
|
39
40
|
/** @internal */
|
|
40
41
|
this.handleDocumentPointerUp = (e) => {
|
|
41
42
|
let isUpOutside = true;
|
|
43
|
+
// istanbul ignore else
|
|
42
44
|
if (this.outsideClickContainerDiv) {
|
|
43
45
|
// typically e.target test for instance of Node, but this is not working from pop out windows
|
|
44
46
|
isUpOutside = !!e.target && !this.outsideClickContainerDiv.contains(e.target);
|
|
@@ -81,6 +83,7 @@ Component, defaultOnOutsideClick, useCapture = true, usePointerEvents = true) =>
|
|
|
81
83
|
}
|
|
82
84
|
getParentDocument() {
|
|
83
85
|
var _a, _b;
|
|
86
|
+
// istanbul ignore next
|
|
84
87
|
return (_b = (_a = this.outsideClickContainerDiv) === null || _a === void 0 ? void 0 : _a.ownerDocument) !== null && _b !== void 0 ? _b : document;
|
|
85
88
|
}
|
|
86
89
|
componentDidMount() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withOnOutsideClick.js","sourceRoot":"","sources":["../../../../src/core-react/hocs/withOnOutsideClick.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAA+B;AAY/B;;GAEG;AACI,MAAM,kBAAkB,GAAG;AAChC,gEAAgE;AAChE,SAA8C,EAC9C,qBAAkD,EAClD,aAAsB,IAAI,EAC1B,mBAA4B,IAAI,EAChC,EAAE;IACF,OAAO,MAAM,kBAAmB,SAAQ,KAAK,CAAC,aAAuD;QAA9F;;YACL,gBAAgB;YACT,6BAAwB,GAA2B,IAAI,CAAC;YAC/D,gBAAgB;YACT,kBAAa,GAAG,KAAK,CAAC;YAgC7B,gBAAgB;YACT,wBAAmB,GAAG,CAAC,CAAa,EAAE,EAAE;gBAC7C,IAAI,CAAC,IAAI,CAAC,wBAAwB,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,YAAY,IAAI,CAAC,IAAI,IAAI,CAAC,wBAAwB,CAAC,QAA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C,CAAC;AAhHW,QAAA,kBAAkB,sBAgH7B","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 Common\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\n/** Properties for [[withOnOutsideClick]] React higher-order component\r\n * @public\r\n */\r\nexport interface WithOnOutsideClickProps {\r\n /** Outside click callback function */\r\n onOutsideClick?: (event: MouseEvent) => any;\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}\r\n\r\n/** withOnOutsideClick is a React higher-order component that adds outside click support.\r\n * @public\r\n */\r\nexport const withOnOutsideClick = <ComponentProps extends {}>(\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n Component: React.ComponentType<ComponentProps>,\r\n defaultOnOutsideClick?: (event: MouseEvent) => any,\r\n useCapture: boolean = true,\r\n usePointerEvents: boolean = true,\r\n) => {\r\n return class WithOnOutsideClick extends React.PureComponent<ComponentProps & WithOnOutsideClickProps> {\r\n /** @internal */\r\n public outsideClickContainerDiv?: HTMLDivElement | null = null;\r\n /** @internal */\r\n public isDownOutside = false;\r\n\r\n /** @internal */\r\n public 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 /** @internal */\r\n public onOutsideClick(e: MouseEvent) {\r\n // istanbul ignore else\r\n if (e.target instanceof Node && e.target.nodeType === Node.ELEMENT_NODE) {\r\n // istanbul ignore else\r\n if (!this.props.closeOnNestedPopupOutsideClick && this.isInCorePopup(e.target as HTMLElement))\r\n return;\r\n }\r\n\r\n if (this.props.onOutsideClick)\r\n return this.props.onOutsideClick(e);\r\n else if (defaultOnOutsideClick)\r\n return defaultOnOutsideClick(e);\r\n }\r\n\r\n /** @internal */\r\n public handleDocumentClick = (e: MouseEvent) => {\r\n if (!this.outsideClickContainerDiv || !(e.target instanceof Node) || this.outsideClickContainerDiv.contains(e.target))\r\n return;\r\n\r\n return this.onOutsideClick(e);\r\n };\r\n\r\n /** @internal */\r\n public handleDocumentPointerDown = (e: PointerEvent) => {\r\n this.isDownOutside = true;\r\n // istanbul ignore else\r\n if (this.outsideClickContainerDiv) {\r\n // typically e.target test for instance of Node, but this is not working from pop out windows\r\n this.isDownOutside = !!e.target && !this.outsideClickContainerDiv.contains(e.target as any);\r\n }\r\n };\r\n\r\n /** @internal */\r\n public handleDocumentPointerUp = (e: PointerEvent) => {\r\n let isUpOutside = true;\r\n // istanbul ignore else\r\n if (this.outsideClickContainerDiv) {\r\n // typically e.target test for instance of Node, but this is not working from pop out windows\r\n isUpOutside = !!e.target && !this.outsideClickContainerDiv.contains(e.target as any);\r\n }\r\n\r\n const isOutsideClick = isUpOutside && this.isDownOutside;\r\n this.isDownOutside = false;\r\n isOutsideClick && this.onOutsideClick(e);\r\n };\r\n\r\n public handleOutsideClickContainerDivSet = (outsideClickContainerDiv: HTMLDivElement | null) => {\r\n this.outsideClickContainerDiv = outsideClickContainerDiv;\r\n };\r\n\r\n public getParentDocument() {\r\n // istanbul ignore next\r\n return this.outsideClickContainerDiv?.ownerDocument ?? document;\r\n }\r\n\r\n public override componentDidMount() {\r\n const outsideClickParentDocument = this.getParentDocument();\r\n if (usePointerEvents) {\r\n outsideClickParentDocument.addEventListener(\"pointerdown\", this.handleDocumentPointerDown, useCapture);\r\n outsideClickParentDocument.addEventListener(\"pointerup\", this.handleDocumentPointerUp, useCapture);\r\n } else\r\n outsideClickParentDocument.addEventListener(\"click\", this.handleDocumentClick, useCapture);\r\n }\r\n\r\n /** @internal */\r\n public override componentWillUnmount() {\r\n const outsideClickParentDocument = this.getParentDocument();\r\n if (usePointerEvents) {\r\n outsideClickParentDocument.removeEventListener(\"pointerdown\", this.handleDocumentPointerDown, useCapture);\r\n outsideClickParentDocument.removeEventListener(\"pointerup\", this.handleDocumentPointerUp, useCapture);\r\n } else\r\n outsideClickParentDocument.removeEventListener(\"click\", this.handleDocumentClick, useCapture);\r\n }\r\n\r\n public override render() {\r\n const { onOutsideClick, closeOnNestedPopupOutsideClick, ...props } = this.props; // eslint-disable-line @typescript-eslint/no-unused-vars\r\n return (\r\n <div ref={this.handleOutsideClickContainerDivSet}>\r\n <Component {...props as ComponentProps} />\r\n </div>\r\n );\r\n }\r\n };\r\n};\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconComponent.d.ts","sourceRoot":"","sources":["../../../../src/core-react/icons/IconComponent.tsx"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,sBAAsB,EAAqB,MAAM,uBAAuB,CAAC;AAElF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C;;GAEG;AACH,oBAAY,QAAQ,GAAG,MAAM,GAAG,sBAAsB,GAAG,KAAK,CAAC,SAAS,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,WAAW;IAC5C;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"IconComponent.d.ts","sourceRoot":"","sources":["../../../../src/core-react/icons/IconComponent.tsx"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,sBAAsB,EAAqB,MAAM,uBAAuB,CAAC;AAElF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C;;GAEG;AACH,oBAAY,QAAQ,GAAG,MAAM,GAAG,sBAAsB,GAAG,KAAK,CAAC,SAAS,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,WAAW;IAC5C;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,sBAgDpC"}
|
|
@@ -31,13 +31,17 @@ 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
|
|
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
|
|
38
38
|
// istanbul ignore next
|
|
39
39
|
const sanitizer = dompurify_1.default !== null && dompurify_1.default !== void 0 ? dompurify_1.default : DOMPurifyNS;
|
|
40
|
-
const
|
|
40
|
+
const sanitizerConfig = {
|
|
41
|
+
ALLOWED_TAGS: ["svg-loader"],
|
|
42
|
+
ADD_URI_SAFE_ATTR: webComponentString.startsWith("data:") ? ["src"] : [],
|
|
43
|
+
};
|
|
44
|
+
const sanitizedIconString = sanitizer.sanitize(svgDiv, sanitizerConfig);
|
|
41
45
|
// we can safely disable jam3/no-sanitizer-with-danger as we are sanitizing above
|
|
42
46
|
// eslint-disable-next-line @typescript-eslint/naming-convention, jam3/no-sanitizer-with-danger
|
|
43
47
|
const webComponentNode = React.createElement("div", { dangerouslySetInnerHTML: { __html: sanitizedIconString } });
|
|
@@ -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,MAAM,kBAAkB,GAAG,kCAAiB,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAC/E,IAAI,kBAAkB,EAAE;YACtB,MAAM,SAAS,GAAG,
|
|
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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,mBAAmB,GAAG,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;YACxE,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;AAhDD,oBAgDC","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\r\n const sanitizerConfig = {\r\n ALLOWED_TAGS: [\"svg-loader\"],\r\n ADD_URI_SAFE_ATTR: webComponentString.startsWith(\"data:\") ? [\"src\"] : [],\r\n };\r\n\r\n const sanitizedIconString = sanitizer.sanitize(svgDiv, sanitizerConfig);\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"]}
|
|
@@ -30,7 +30,7 @@ function ThemedSelect(props) {
|
|
|
30
30
|
const noOptionLabel = React.useRef();
|
|
31
31
|
const defaultOptionMessage = React.useCallback(() => {
|
|
32
32
|
if (!noOptionLabel.current) {
|
|
33
|
-
noOptionLabel.current = UiCore_1.UiCore.translate("
|
|
33
|
+
noOptionLabel.current = UiCore_1.UiCore.translate("reactselect.noSelectOption");
|
|
34
34
|
}
|
|
35
35
|
return noOptionLabel.current;
|
|
36
36
|
}, [noOptionLabel]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemedSelect.js","sourceRoot":"","sources":["../../../../src/core-react/select/ThemedSelect.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,4CAA4C;AAC5C;;GAEG;;;AAEH,gCAA8B;AAC9B,2CAAoC;AACpC,+BAA+B;AAC/B,+CAAqD;AAKrD,sCAAmC;AACnC,4DAAiE;AACjE,+CAAkD;AAqLlD,MAAM,UAAU,GAAG,CAAC,KAAqB,EAAE,EAAE;IAC3C,OAAO,CACL,6BAAK,SAAS,EAAC,uBAAuB;QACpC,oBAAC,yBAAU,CAAC,IAAI,OAAK,KAAK,GAAI,CAC1B,CACP,CAAC;AACJ,CAAC,CAAC;AACF;;;GAGG;AACH,gEAAgE;AAChE,SAAgB,YAAY,CAAC,KAAwB;;IACnD,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,EAAsB,CAAC;IACzD,MAAM,oBAAoB,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QAClD,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE;YAC1B,aAAa,CAAC,OAAO,GAAG,eAAM,CAAC,SAAS,CA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------------------------------------------\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 Select\r\n */\r\n\r\nimport \"./themed-select.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport Component, { components } from \"react-select\";\r\nimport { formatGroupLabel, getOptionLabel, getOptionValue } from \"react-select/src/builtins\";\r\nimport { SelectComponentsConfig } from \"react-select/src/components/index\";\r\nimport { MenuProps } from \"react-select/src/components/Menu\";\r\nimport { ActionMeta, FocusEventHandler, InputActionMeta, KeyboardEventHandler, ValueType } from \"react-select/src/types\";\r\nimport { UiCore } from \"../UiCore\";\r\nimport { getCssVariableAsNumber } from \"../utils/getCssVariable\";\r\nimport { getParentSelector } from \"./modalHelper\";\r\n\r\n// cspell:ignore reactselect builtins\r\n\r\n/* eslint-disable @typescript-eslint/no-shadow, @typescript-eslint/consistent-type-definitions, @typescript-eslint/array-type */\r\ntype FormatOptionLabelContext = \"menu\" | \"value\";\r\ntype FormatOptionLabelMeta = {\r\n context: FormatOptionLabelContext;\r\n inputValue: string;\r\n selectValue: ValueType<OptionType>;\r\n};\r\n\r\n/** OptionType for react-select 2.0 and above. which only accepts pairs of value & label strings\r\n * @beta\r\n * @deprecated use Select from @itwin/itwinui-react\r\n */\r\nexport interface OptionType {\r\n value: any;\r\n label: string;\r\n}\r\n/** OptionsType to match label/value pair OptionType\r\n * @beta\r\n * @deprecated use Select from @itwin/itwinui-react\r\n*/\r\nexport type OptionsType = Array<OptionType>;\r\n\r\n/** ThemedSelectProps to control specific features of ThemedSelect\r\n * @beta\r\n * @deprecated use Select from @itwin/itwinui-react\r\n */\r\nexport type ThemedSelectProps = {\r\n /* Aria label (for assistive tech) */\r\n \"aria-label\"?: string;\r\n /* HTML ID of an element that should be used as the label (for assistive tech) */\r\n \"aria-labelledby\"?: string;\r\n /* Focus the control when it is mounted */\r\n autoFocus?: boolean;\r\n /* Remove the currently focused option when the user presses backspace */\r\n backspaceRemovesValue?: boolean;\r\n /* Remove focus from the input when the user selects an option (handy for dismissing the keyboard on touch devices) */\r\n blurInputOnSelect?: boolean;\r\n /* When the user reaches the top/bottom of the menu, prevent scroll on the scroll-parent */\r\n captureMenuScroll?: boolean;\r\n /* Sets a className attribute on the outer component */\r\n className?: string;\r\n /* Close the select menu when the user selects an option */\r\n closeMenuOnSelect?: boolean;\r\n /*\r\n If `true`, close the select menu when the user scrolls the document/body.\r\n\r\n If a function, takes a standard javascript `ScrollEvent` you return a boolean:\r\n\r\n `true` => The menu closes\r\n\r\n `false` => The menu stays open\r\n\r\n This is useful when you have a scrollable modal and want to portal the menu out,\r\n but want to avoid graphical issues.\r\n */\r\n closeMenuOnScroll?: boolean | EventListener;\r\n /*\r\n This complex object includes all the compositional components that are used\r\n in `react-select`. If you wish to overwrite a component, pass in an object\r\n with the appropriate namespace.\r\n\r\n If you only wish to restyle a component, we recommend using the `styles` prop\r\n instead. For a list of the components that can be passed in, and the shape\r\n that will be passed to them, see [the components docs](/components)\r\n */\r\n components?: SelectComponentsConfig<OptionType>;\r\n /* Whether the value of the select, e.g. SingleValue, should be displayed in the control. */\r\n controlShouldRenderValue?: boolean;\r\n /* Ff true, the menu is open immediately */\r\n defaultMenuIsOpen?: boolean;\r\n /* Value set in the control by default */\r\n defaultValue?: ValueType<OptionType>;\r\n /** Provides ability to return reference to the outer HTMLDivElement */\r\n divRef?: React.Ref<HTMLDivElement>;\r\n /* Clear all values when the user presses escape AND the menu is closed */\r\n escapeClearsValue?: boolean;\r\n /* Custom method to filter whether an option should be displayed in the menu */\r\n filterOption?: ((\r\n option: OptionType,\r\n rawInput: string,\r\n ) => boolean) | null;\r\n /*\r\n Formats group labels in the menu as React components\r\n\r\n An example can be found in the [Replacing builtins](/advanced#replacing-builtins) documentation.\r\n*/\r\n formatGroupLabel?: typeof formatGroupLabel;\r\n /* Formats option labels in the menu and control as React components */\r\n formatOptionLabel?: (optionType: OptionType, formatLabelMeta: FormatOptionLabelMeta) => React.ReactNode;\r\n /* Resolves option data to a string to be displayed as the label by components */\r\n getOptionLabel?: typeof getOptionLabel;\r\n /* Resolves option data to a string to compare options and specify value attributes */\r\n getOptionValue?: typeof getOptionValue;\r\n /* Hide the selected option from the menu */\r\n hideSelectedOptions?: boolean;\r\n /* The id to set on the SelectContainer component. */\r\n id?: string;\r\n /* The value of the search input */\r\n inputValue?: string;\r\n /* The id of the search input */\r\n inputId?: string;\r\n /* Define an id prefix for the select components e.g. {your-id}-value */\r\n instanceId?: number | string;\r\n /* Is the select value clearable */\r\n isClearable?: boolean;\r\n /* Is the select disabled */\r\n isDisabled?: boolean;\r\n /* Is the select in a state of loading (async) */\r\n isLoading?: boolean;\r\n /*\r\n Override the built-in logic to detect whether an option is disabled\r\n\r\n An example can be found in the [Replacing builtins](/advanced#replacing-builtins) documentation.\r\n */\r\n isOptionDisabled?: (option: OptionType, options: OptionsType) => boolean | false;\r\n /* Support multiple selected options */\r\n isMulti?: boolean;\r\n /* If true, menu will not be opened in a portal */\r\n isMenuFixed?: boolean;\r\n /* Is the select direction right-to-left */\r\n isRtl?: boolean;\r\n /* Whether to enable search functionality */\r\n isSearchable?: boolean;\r\n /* Minimum height of the menu before flipping */\r\n minMenuHeight?: number;\r\n /* Maximum height of the menu before scrolling */\r\n maxMenuHeight?: number;\r\n /* Whether the menu is open */\r\n menuIsOpen?: boolean;\r\n /* Whether to block scroll events when the menu is open */\r\n menuShouldBlockScroll?: boolean;\r\n /* Whether the menu should be scrolled into view when it opens */\r\n menuShouldScrollIntoView?: boolean;\r\n /* Name of the HTML Input (optional - without this, no input will be rendered) */\r\n name?: string;\r\n /* Text to display when there are no options */\r\n noOptionsMessage?: (obj: { inputValue: string }) => string | null;\r\n /* Handle blur events on the control */\r\n onBlur?: FocusEventHandler;\r\n /* Handle change events on the select */\r\n onChange?: (value: ValueType<OptionType>, action: ActionMeta<OptionType>) => void;\r\n /* Handle focus events on the control */\r\n onFocus?: FocusEventHandler;\r\n /* Handle change events on the input */\r\n onInputChange?: (newValue: string, actionMeta?: InputActionMeta) => void;\r\n /* Handle key down events on the select */\r\n onKeyDown?: KeyboardEventHandler;\r\n /* Handle the menu opening */\r\n onMenuOpen?: () => void;\r\n /* Handle the menu closing */\r\n onMenuClose?: () => void;\r\n /* Fired when the user scrolls to the top of the menu */\r\n onMenuScrollToTop?: (e: React.SyntheticEvent<HTMLElement>) => void;\r\n /* Fired when the user scrolls to the bottom of the menu */\r\n onMenuScrollToBottom?: (e: React.SyntheticEvent<HTMLElement>) => void;\r\n /* Allows control of whether the menu is opened when the Select is focused */\r\n openMenuOnFocus?: boolean;\r\n /* Allows control of whether the menu is opened when the Select is clicked */\r\n openMenuOnClick?: boolean;\r\n /* Array of options that populate the select menu */\r\n options: OptionsType;\r\n /* Number of options to jump in menu when page{up|down} keys are used */\r\n pageSize?: number;\r\n /* Placeholder for the select value */\r\n placeholder?: string;\r\n /** Provides ability to return reference to the ThemedSelect */\r\n ref?: React.Ref<Component>;\r\n /* Sets additional styling */\r\n styles?: React.CSSProperties;\r\n /* Sets the tabIndex attribute on the input */\r\n tabIndex?: string;\r\n /* Select the currently focused option when the user presses tab */\r\n tabSelectsValue?: boolean;\r\n /* The value of the select; reflected by the selected option */\r\n value?: ValueType<OptionType>;\r\n};\r\n\r\nconst ThemedMenu = (props: MenuProps<any>) => { // eslint-disable-line @typescript-eslint/naming-convention\r\n return (\r\n <div className=\"uicore-reactSelectTop\">\r\n <components.Menu {...props} />\r\n </div>\r\n );\r\n};\r\n/** ThemedSelect is a wrapper for react-select with iTwin.js UI theming applied\r\n * @beta\r\n * @deprecated use Select from @itwin/itwinui-react\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function ThemedSelect(props: ThemedSelectProps) {\r\n const noOptionLabel = React.useRef<string | undefined>();\r\n const defaultOptionMessage = React.useCallback(() => {\r\n if (!noOptionLabel.current) {\r\n noOptionLabel.current = UiCore.translate(\"reactelect.noSelectOption\");\r\n }\r\n return noOptionLabel.current;\r\n }, [noOptionLabel]);\r\n const noOptionFunction = props.noOptionsMessage ?? defaultOptionMessage;\r\n const selectClassName = classnames(\"uicore-reactSelectTop\", props.className);\r\n const portalTarget = !!props.isMenuFixed ? undefined : getParentSelector();\r\n const {\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n classNamePrefix, className, noOptionsMessage, menuPortalTarget, isMenuFixed, styles, components, divRef, ref,\r\n // eslint-disable-next-line comma-dangle\r\n ...otherProps // pass-through props\r\n } = props as any;\r\n const selectStyles = {\r\n ...props.styles,\r\n menuPortal: (base: React.CSSProperties) => ({ ...base, zIndex }),\r\n };\r\n\r\n const zIndex = getCssVariableAsNumber(\"--uicore-z-index-dialog-popup\");\r\n return (\r\n <div className={selectClassName} ref={divRef}>\r\n <Component\r\n ref={ref}\r\n classNamePrefix=\"react-select\"\r\n noOptionsMessage={noOptionFunction}\r\n menuPortalTarget={portalTarget}\r\n styles={selectStyles}\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n components={{ Menu: ThemedMenu, ...props.components }}\r\n {...otherProps}\r\n />\r\n </div>\r\n );\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ThemedSelect.js","sourceRoot":"","sources":["../../../../src/core-react/select/ThemedSelect.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,4CAA4C;AAC5C;;GAEG;;;AAEH,gCAA8B;AAC9B,2CAAoC;AACpC,+BAA+B;AAC/B,+CAAqD;AAKrD,sCAAmC;AACnC,4DAAiE;AACjE,+CAAkD;AAqLlD,MAAM,UAAU,GAAG,CAAC,KAAqB,EAAE,EAAE;IAC3C,OAAO,CACL,6BAAK,SAAS,EAAC,uBAAuB;QACpC,oBAAC,yBAAU,CAAC,IAAI,OAAK,KAAK,GAAI,CAC1B,CACP,CAAC;AACJ,CAAC,CAAC;AACF;;;GAGG;AACH,gEAAgE;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AgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,YAAY,EAC9B,MAAM,EAAE,YAAY;YACpB,gEAAgE;YAChE,UAAU,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC,UAAU,EAAE,KACjD,UAAU,GACd,CACE,CACP,CAAC;AACJ,CAAC;AArCD,oCAqCC","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 Select\r\n */\r\n\r\nimport \"./themed-select.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport Component, { components } from \"react-select\";\r\nimport { formatGroupLabel, getOptionLabel, getOptionValue } from \"react-select/src/builtins\";\r\nimport { SelectComponentsConfig } from \"react-select/src/components/index\";\r\nimport { MenuProps } from \"react-select/src/components/Menu\";\r\nimport { ActionMeta, FocusEventHandler, InputActionMeta, KeyboardEventHandler, ValueType } from \"react-select/src/types\";\r\nimport { UiCore } from \"../UiCore\";\r\nimport { getCssVariableAsNumber } from \"../utils/getCssVariable\";\r\nimport { getParentSelector } from \"./modalHelper\";\r\n\r\n// cspell:ignore reactselect builtins\r\n\r\n/* eslint-disable @typescript-eslint/no-shadow, @typescript-eslint/consistent-type-definitions, @typescript-eslint/array-type */\r\ntype FormatOptionLabelContext = \"menu\" | \"value\";\r\ntype FormatOptionLabelMeta = {\r\n context: FormatOptionLabelContext;\r\n inputValue: string;\r\n selectValue: ValueType<OptionType>;\r\n};\r\n\r\n/** OptionType for react-select 2.0 and above. which only accepts pairs of value & label strings\r\n * @beta\r\n * @deprecated use Select from @itwin/itwinui-react\r\n */\r\nexport interface OptionType {\r\n value: any;\r\n label: string;\r\n}\r\n/** OptionsType to match label/value pair OptionType\r\n * @beta\r\n * @deprecated use Select from @itwin/itwinui-react\r\n*/\r\nexport type OptionsType = Array<OptionType>;\r\n\r\n/** ThemedSelectProps to control specific features of ThemedSelect\r\n * @beta\r\n * @deprecated use Select from @itwin/itwinui-react\r\n */\r\nexport type ThemedSelectProps = {\r\n /* Aria label (for assistive tech) */\r\n \"aria-label\"?: string;\r\n /* HTML ID of an element that should be used as the label (for assistive tech) */\r\n \"aria-labelledby\"?: string;\r\n /* Focus the control when it is mounted */\r\n autoFocus?: boolean;\r\n /* Remove the currently focused option when the user presses backspace */\r\n backspaceRemovesValue?: boolean;\r\n /* Remove focus from the input when the user selects an option (handy for dismissing the keyboard on touch devices) */\r\n blurInputOnSelect?: boolean;\r\n /* When the user reaches the top/bottom of the menu, prevent scroll on the scroll-parent */\r\n captureMenuScroll?: boolean;\r\n /* Sets a className attribute on the outer component */\r\n className?: string;\r\n /* Close the select menu when the user selects an option */\r\n closeMenuOnSelect?: boolean;\r\n /*\r\n If `true`, close the select menu when the user scrolls the document/body.\r\n\r\n If a function, takes a standard javascript `ScrollEvent` you return a boolean:\r\n\r\n `true` => The menu closes\r\n\r\n `false` => The menu stays open\r\n\r\n This is useful when you have a scrollable modal and want to portal the menu out,\r\n but want to avoid graphical issues.\r\n */\r\n closeMenuOnScroll?: boolean | EventListener;\r\n /*\r\n This complex object includes all the compositional components that are used\r\n in `react-select`. If you wish to overwrite a component, pass in an object\r\n with the appropriate namespace.\r\n\r\n If you only wish to restyle a component, we recommend using the `styles` prop\r\n instead. For a list of the components that can be passed in, and the shape\r\n that will be passed to them, see [the components docs](/components)\r\n */\r\n components?: SelectComponentsConfig<OptionType>;\r\n /* Whether the value of the select, e.g. SingleValue, should be displayed in the control. */\r\n controlShouldRenderValue?: boolean;\r\n /* Ff true, the menu is open immediately */\r\n defaultMenuIsOpen?: boolean;\r\n /* Value set in the control by default */\r\n defaultValue?: ValueType<OptionType>;\r\n /** Provides ability to return reference to the outer HTMLDivElement */\r\n divRef?: React.Ref<HTMLDivElement>;\r\n /* Clear all values when the user presses escape AND the menu is closed */\r\n escapeClearsValue?: boolean;\r\n /* Custom method to filter whether an option should be displayed in the menu */\r\n filterOption?: ((\r\n option: OptionType,\r\n rawInput: string,\r\n ) => boolean) | null;\r\n /*\r\n Formats group labels in the menu as React components\r\n\r\n An example can be found in the [Replacing builtins](/advanced#replacing-builtins) documentation.\r\n*/\r\n formatGroupLabel?: typeof formatGroupLabel;\r\n /* Formats option labels in the menu and control as React components */\r\n formatOptionLabel?: (optionType: OptionType, formatLabelMeta: FormatOptionLabelMeta) => React.ReactNode;\r\n /* Resolves option data to a string to be displayed as the label by components */\r\n getOptionLabel?: typeof getOptionLabel;\r\n /* Resolves option data to a string to compare options and specify value attributes */\r\n getOptionValue?: typeof getOptionValue;\r\n /* Hide the selected option from the menu */\r\n hideSelectedOptions?: boolean;\r\n /* The id to set on the SelectContainer component. */\r\n id?: string;\r\n /* The value of the search input */\r\n inputValue?: string;\r\n /* The id of the search input */\r\n inputId?: string;\r\n /* Define an id prefix for the select components e.g. {your-id}-value */\r\n instanceId?: number | string;\r\n /* Is the select value clearable */\r\n isClearable?: boolean;\r\n /* Is the select disabled */\r\n isDisabled?: boolean;\r\n /* Is the select in a state of loading (async) */\r\n isLoading?: boolean;\r\n /*\r\n Override the built-in logic to detect whether an option is disabled\r\n\r\n An example can be found in the [Replacing builtins](/advanced#replacing-builtins) documentation.\r\n */\r\n isOptionDisabled?: (option: OptionType, options: OptionsType) => boolean | false;\r\n /* Support multiple selected options */\r\n isMulti?: boolean;\r\n /* If true, menu will not be opened in a portal */\r\n isMenuFixed?: boolean;\r\n /* Is the select direction right-to-left */\r\n isRtl?: boolean;\r\n /* Whether to enable search functionality */\r\n isSearchable?: boolean;\r\n /* Minimum height of the menu before flipping */\r\n minMenuHeight?: number;\r\n /* Maximum height of the menu before scrolling */\r\n maxMenuHeight?: number;\r\n /* Whether the menu is open */\r\n menuIsOpen?: boolean;\r\n /* Whether to block scroll events when the menu is open */\r\n menuShouldBlockScroll?: boolean;\r\n /* Whether the menu should be scrolled into view when it opens */\r\n menuShouldScrollIntoView?: boolean;\r\n /* Name of the HTML Input (optional - without this, no input will be rendered) */\r\n name?: string;\r\n /* Text to display when there are no options */\r\n noOptionsMessage?: (obj: { inputValue: string }) => string | null;\r\n /* Handle blur events on the control */\r\n onBlur?: FocusEventHandler;\r\n /* Handle change events on the select */\r\n onChange?: (value: ValueType<OptionType>, action: ActionMeta<OptionType>) => void;\r\n /* Handle focus events on the control */\r\n onFocus?: FocusEventHandler;\r\n /* Handle change events on the input */\r\n onInputChange?: (newValue: string, actionMeta?: InputActionMeta) => void;\r\n /* Handle key down events on the select */\r\n onKeyDown?: KeyboardEventHandler;\r\n /* Handle the menu opening */\r\n onMenuOpen?: () => void;\r\n /* Handle the menu closing */\r\n onMenuClose?: () => void;\r\n /* Fired when the user scrolls to the top of the menu */\r\n onMenuScrollToTop?: (e: React.SyntheticEvent<HTMLElement>) => void;\r\n /* Fired when the user scrolls to the bottom of the menu */\r\n onMenuScrollToBottom?: (e: React.SyntheticEvent<HTMLElement>) => void;\r\n /* Allows control of whether the menu is opened when the Select is focused */\r\n openMenuOnFocus?: boolean;\r\n /* Allows control of whether the menu is opened when the Select is clicked */\r\n openMenuOnClick?: boolean;\r\n /* Array of options that populate the select menu */\r\n options: OptionsType;\r\n /* Number of options to jump in menu when page{up|down} keys are used */\r\n pageSize?: number;\r\n /* Placeholder for the select value */\r\n placeholder?: string;\r\n /** Provides ability to return reference to the ThemedSelect */\r\n ref?: React.Ref<Component>;\r\n /* Sets additional styling */\r\n styles?: React.CSSProperties;\r\n /* Sets the tabIndex attribute on the input */\r\n tabIndex?: string;\r\n /* Select the currently focused option when the user presses tab */\r\n tabSelectsValue?: boolean;\r\n /* The value of the select; reflected by the selected option */\r\n value?: ValueType<OptionType>;\r\n};\r\n\r\nconst ThemedMenu = (props: MenuProps<any>) => { // eslint-disable-line @typescript-eslint/naming-convention\r\n return (\r\n <div className=\"uicore-reactSelectTop\">\r\n <components.Menu {...props} />\r\n </div>\r\n );\r\n};\r\n/** ThemedSelect is a wrapper for react-select with iTwin.js UI theming applied\r\n * @beta\r\n * @deprecated use Select from @itwin/itwinui-react\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function ThemedSelect(props: ThemedSelectProps) {\r\n const noOptionLabel = React.useRef<string | undefined>();\r\n const defaultOptionMessage = React.useCallback(() => {\r\n if (!noOptionLabel.current) {\r\n noOptionLabel.current = UiCore.translate(\"reactselect.noSelectOption\");\r\n }\r\n return noOptionLabel.current;\r\n }, [noOptionLabel]);\r\n const noOptionFunction = props.noOptionsMessage ?? defaultOptionMessage;\r\n const selectClassName = classnames(\"uicore-reactSelectTop\", props.className);\r\n const portalTarget = !!props.isMenuFixed ? undefined : getParentSelector();\r\n const {\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n classNamePrefix, className, noOptionsMessage, menuPortalTarget, isMenuFixed, styles, components, divRef, ref,\r\n // eslint-disable-next-line comma-dangle\r\n ...otherProps // pass-through props\r\n } = props as any;\r\n const selectStyles = {\r\n ...props.styles,\r\n menuPortal: (base: React.CSSProperties) => ({ ...base, zIndex }),\r\n };\r\n\r\n const zIndex = getCssVariableAsNumber(\"--uicore-z-index-dialog-popup\");\r\n return (\r\n <div className={selectClassName} ref={divRef}>\r\n <Component\r\n ref={ref}\r\n classNamePrefix=\"react-select\"\r\n noOptionsMessage={noOptionFunction}\r\n menuPortalTarget={portalTarget}\r\n styles={selectStyles}\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n components={{ Menu: ThemedMenu, ...props.components }}\r\n {...otherProps}\r\n />\r\n </div>\r\n );\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;
|
|
1
|
+
{"version":3,"file":"IconWebComponent.d.ts","sourceRoot":"","sources":["../../../../src/core-react/utils/IconWebComponent.ts"],"names":[],"mappings":"AAMA;;GAEG;AAOH;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;YACjC,iBAAiB;YAKjB,OAAO;CAmDtB"}
|
|
@@ -13,6 +13,7 @@ exports.IconWebComponent = void 0;
|
|
|
13
13
|
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
14
14
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
15
15
|
const UiCore_1 = require("../UiCore");
|
|
16
|
+
const dompurify_1 = require("dompurify"), DOMPurifyNS = dompurify_1;
|
|
16
17
|
/**
|
|
17
18
|
* IconWebComponent loads icon from an svg path
|
|
18
19
|
*/
|
|
@@ -25,7 +26,27 @@ class IconWebComponent extends HTMLElement {
|
|
|
25
26
|
// if svg was already appended don't request it again
|
|
26
27
|
if (this.childNodes.length)
|
|
27
28
|
return;
|
|
28
|
-
|
|
29
|
+
const src = this.getAttribute("src") || "";
|
|
30
|
+
if (src.startsWith("data:")) {
|
|
31
|
+
const dataUriParts = src.split(",");
|
|
32
|
+
if (dataUriParts.length !== 2 || "data:image/svg+xml;base64" !== dataUriParts[0]) {
|
|
33
|
+
core_bentley_1.Logger.logError(UiCore_1.UiCore.loggerCategory(this), "Unable to load icon.");
|
|
34
|
+
}
|
|
35
|
+
// the esm build of dompurify has a default import but the cjs build does not
|
|
36
|
+
// if there is a default export, use it (likely esm), otherwise use the namespace
|
|
37
|
+
// istanbul ignore next
|
|
38
|
+
const sanitizer = dompurify_1.default !== null && dompurify_1.default !== void 0 ? dompurify_1.default : DOMPurifyNS;
|
|
39
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
40
|
+
const sanitizedSvg = sanitizer.sanitize(atob(dataUriParts[1]));
|
|
41
|
+
const parsedSvg = new window.DOMParser().parseFromString(sanitizedSvg, "text/xml");
|
|
42
|
+
const errorNode = parsedSvg.querySelector("parsererror");
|
|
43
|
+
if (errorNode || "svg" !== parsedSvg.documentElement.nodeName.toLowerCase()) {
|
|
44
|
+
throw new appui_abstract_1.UiError(UiCore_1.UiCore.loggerCategory(this), "Unable to load icon.");
|
|
45
|
+
}
|
|
46
|
+
!this.childNodes.length && this.append(parsedSvg.documentElement);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
await fetch(src)
|
|
29
50
|
.catch((_error) => {
|
|
30
51
|
core_bentley_1.Logger.logError(UiCore_1.UiCore.loggerCategory(this), "Unable to load icon.");
|
|
31
52
|
})
|
|
@@ -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,0DAAgD;AAChD,sDAA6C;AAC7C,sCAAmC;
|
|
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,0DAAgD;AAChD,sDAA6C;AAC7C,sCAAmC;AACnC,oEAAoD;AAEpD;;GAEG;AACH,MAAa,gBAAiB,SAAQ,WAAW;IACvC,KAAK,CAAC,iBAAiB;QAC7B,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9C,CAAC;IAEO,KAAK,CAAC,OAAO;QACnB,qDAAqD;QACrD,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM;YACxB,OAAO;QAET,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QAE3C,IAAI,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;YAC3B,MAAM,YAAY,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAEpC,IAAI,YAAY,CAAC,MAA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;gBACL,MAAM,IAAI,wBAAO,CAAE,eAAM,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,sBAAsB,CAAC,CAAC;aACzE;QACH,CAAC,CAAC;aACD,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;YACZ,IAAI,GAAG,KAAK,SAAS,EAAE;gBACrB,OAAO,CAAC,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,eAAe,CAAC,GAAG,EAAE,UAAU,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;AAzDD,4CAyDC","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\nimport DOMPurify, * as DOMPurifyNS from \"dompurify\";\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\r\n const src = this.getAttribute(\"src\") || \"\";\r\n\r\n if (src.startsWith(\"data:\")) {\r\n const dataUriParts = src.split(\",\");\r\n\r\n if (dataUriParts.length !== 2 || \"data:image/svg+xml;base64\" !== dataUriParts[0]) {\r\n Logger.logError(UiCore.loggerCategory(this), \"Unable to load icon.\");\r\n }\r\n\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 // eslint-disable-next-line deprecation/deprecation\r\n const sanitizedSvg = sanitizer.sanitize(atob(dataUriParts[1]));\r\n\r\n const parsedSvg = new window.DOMParser().parseFromString(sanitizedSvg, \"text/xml\");\r\n const errorNode = parsedSvg.querySelector(\"parsererror\");\r\n if (errorNode || \"svg\" !== parsedSvg.documentElement.nodeName.toLowerCase()) {\r\n throw new UiError (UiCore.loggerCategory(this), \"Unable to load icon.\");\r\n }\r\n\r\n !this.childNodes.length && this.append(parsedSvg.documentElement);\r\n return;\r\n }\r\n\r\n await fetch(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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCssVariable.d.ts","sourceRoot":"","sources":["../../../../src/core-react/utils/getCssVariable.ts"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"getCssVariable.d.ts","sourceRoot":"","sources":["../../../../src/core-react/utils/getCssVariable.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;GAEG;AACH,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,MAAM,CAKtF;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,MAAM,CAM9F"}
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.getCssVariableAsNumber = exports.getCssVariable = void 0;
|
|
11
|
-
/* istanbul ignore next */
|
|
12
11
|
/** Get CSS variable
|
|
13
12
|
* @public
|
|
14
13
|
*/
|
|
@@ -19,7 +18,6 @@ function getCssVariable(variableName, htmlElement) {
|
|
|
19
18
|
return cssVal;
|
|
20
19
|
}
|
|
21
20
|
exports.getCssVariable = getCssVariable;
|
|
22
|
-
/* istanbul ignore next */
|
|
23
21
|
/** Get CSS variable as number
|
|
24
22
|
* @public
|
|
25
23
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCssVariable.js","sourceRoot":"","sources":["../../../../src/core-react/utils/getCssVariable.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH
|
|
1
|
+
{"version":3,"file":"getCssVariable.js","sourceRoot":"","sources":["../../../../src/core-react/utils/getCssVariable.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;GAEG;AACH,SAAgB,cAAc,CAAC,YAAoB,EAAE,WAAyB;IAC5E,MAAM,OAAO,GAAG,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,QAAQ,CAAC,eAAe,CAAC;IACxD,MAAM,SAAS,GAAG,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACvE,OAAO,MAAM,CAAC;AAChB,CAAC;AALD,wCAKC;AAED;;GAEG;AACH,SAAgB,sBAAsB,CAAC,YAAoB,EAAE,WAAyB;IACpF,IAAI,SAAS,GAAW,GAAG,CAAC;IAC5B,MAAM,SAAS,GAAG,cAAc,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;IAC5D,IAAI,SAAS;QACX,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;IACpC,OAAO,SAAS,CAAC;AACnB,CAAC;AAND,wDAMC","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 Utilities\r\n */\r\n\r\n/** Get CSS variable\r\n * @public\r\n */\r\nexport function getCssVariable(variableName: string, htmlElement?: HTMLElement): string {\r\n const element = htmlElement ?? document.documentElement;\r\n const cssStyles = getComputedStyle(element, null);\r\n const cssVal = String(cssStyles.getPropertyValue(variableName)).trim();\r\n return cssVal;\r\n}\r\n\r\n/** Get CSS variable as number\r\n * @public\r\n */\r\nexport function getCssVariableAsNumber(variableName: string, htmlElement?: HTMLElement): number {\r\n let cssValNum: number = NaN;\r\n const cssValStr = getCssVariable(variableName, htmlElement);\r\n if (cssValStr)\r\n cssValNum = parseFloat(cssValStr);\r\n return cssValNum;\r\n}\r\n"]}
|
|
@@ -35,7 +35,7 @@ $uicore-internal-z-index-layers: view-overlay,
|
|
|
35
35
|
$uicore-z-index-step: 1000;
|
|
36
36
|
|
|
37
37
|
@function uicore-internal-get-next-z-index-step($counter) {
|
|
38
|
-
@return $counter
|
|
38
|
+
@return $counter + $uicore-z-index-step;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
$uicore-internal-z-index-layer-map: uicore-map-from-array-with-result-arg($uicore-internal-z-index-layers, get-function(uicore-internal-get-next-z-index-step), 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withOnOutsideClick.d.ts","sourceRoot":"","sources":["../../../../src/core-react/hocs/withOnOutsideClick.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,sCAAsC;IACtC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,GAAG,CAAC;IAC5C,8HAA8H;IAC9H,8BAA8B,CAAC,EAAE,OAAO,CAAC;CAC1C;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,+GAGG,UAAU,KAAK,GAAG,4BACtC,OAAO,qBACD,OAAO;;QAGvB,gBAAgB;;QAEhB,gBAAgB;;QAGhB,gBAAgB;+BACc,WAAW,GAAG,OAAO;QAcnD,gBAAgB;0BACS,UAAU;QAcnC,gBAAgB;iCACiB,UAAU;QAO3C,gBAAgB;uCACuB,YAAY;
|
|
1
|
+
{"version":3,"file":"withOnOutsideClick.d.ts","sourceRoot":"","sources":["../../../../src/core-react/hocs/withOnOutsideClick.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,sCAAsC;IACtC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,GAAG,CAAC;IAC5C,8HAA8H;IAC9H,8BAA8B,CAAC,EAAE,OAAO,CAAC;CAC1C;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,+GAGG,UAAU,KAAK,GAAG,4BACtC,OAAO,qBACD,OAAO;;QAGvB,gBAAgB;;QAEhB,gBAAgB;;QAGhB,gBAAgB;+BACc,WAAW,GAAG,OAAO;QAcnD,gBAAgB;0BACS,UAAU;QAcnC,gBAAgB;iCACiB,UAAU;QAO3C,gBAAgB;uCACuB,YAAY;QASnD,gBAAgB;qCACqB,YAAY;sEAaqB,cAAc,GAAG,IAAI;;;QAkB3F,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;QArFhB,gBAAgB;;QAEhB,gBAAgB;;QAGhB,gBAAgB;+BACc,WAAW,GAAG,OAAO;QAcnD,gBAAgB;0BACS,UAAU;QAcnC,gBAAgB;iCACiB,UAAU;QAO3C,gBAAgB;uCACuB,YAAY;QASnD,gBAAgB;qCACqB,YAAY;sEAaqB,cAAc,GAAG,IAAI;;;QAkB3F,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;CAmBnB,CAAC"}
|
|
@@ -28,6 +28,7 @@ Component, defaultOnOutsideClick, useCapture = true, usePointerEvents = true) =>
|
|
|
28
28
|
/** @internal */
|
|
29
29
|
this.handleDocumentPointerDown = (e) => {
|
|
30
30
|
this.isDownOutside = true;
|
|
31
|
+
// istanbul ignore else
|
|
31
32
|
if (this.outsideClickContainerDiv) {
|
|
32
33
|
// typically e.target test for instance of Node, but this is not working from pop out windows
|
|
33
34
|
this.isDownOutside = !!e.target && !this.outsideClickContainerDiv.contains(e.target);
|
|
@@ -36,6 +37,7 @@ Component, defaultOnOutsideClick, useCapture = true, usePointerEvents = true) =>
|
|
|
36
37
|
/** @internal */
|
|
37
38
|
this.handleDocumentPointerUp = (e) => {
|
|
38
39
|
let isUpOutside = true;
|
|
40
|
+
// istanbul ignore else
|
|
39
41
|
if (this.outsideClickContainerDiv) {
|
|
40
42
|
// typically e.target test for instance of Node, but this is not working from pop out windows
|
|
41
43
|
isUpOutside = !!e.target && !this.outsideClickContainerDiv.contains(e.target);
|
|
@@ -78,6 +80,7 @@ Component, defaultOnOutsideClick, useCapture = true, usePointerEvents = true) =>
|
|
|
78
80
|
}
|
|
79
81
|
getParentDocument() {
|
|
80
82
|
var _a, _b;
|
|
83
|
+
// istanbul ignore next
|
|
81
84
|
return (_b = (_a = this.outsideClickContainerDiv) === null || _a === void 0 ? void 0 : _a.ownerDocument) !== null && _b !== void 0 ? _b : document;
|
|
82
85
|
}
|
|
83
86
|
componentDidMount() {
|
|
@@ -1 +1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AE,UAAU,CAAC,CAAC;QAC/F,CAAC;QAED,gBAAgB;QACA,oBAAoB;YAClC,MAAM,0BAA0B,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC5D,IAAI,gBAAgB,EAAE;gBACpB,0BAA0B,CAAC,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,yBAAyB,EAAE,UAAU,CAAC,CAAC;gBAC1G,0BAA0B,CAAC,mBAAmB,CAAC,WAAW,EAAE,IAAI,CAAC,uBAAuB,EAAE,UAAU,CAAC,CAAC;aACvG;;gBACC,0BAA0B,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;QAClG,CAAC;QAEe,MAAM;YACpB,MAAM,EAAE,cAAc,EAAE,8BAA8B,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,wDAAwD;YACzI,OAAO,CACL,6BAAK,GAAG,EAAE,IAAI,CAAC,iCAAiC;gBAC9C,oBAAC,SAAS,OAAK,KAAuB,GAAI,CACtC,CACP,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,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 Common\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\n/** Properties for [[withOnOutsideClick]] React higher-order component\r\n * @public\r\n */\r\nexport interface WithOnOutsideClickProps {\r\n /** Outside click callback function */\r\n onOutsideClick?: (event: MouseEvent) => any;\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}\r\n\r\n/** withOnOutsideClick is a React higher-order component that adds outside click support.\r\n * @public\r\n */\r\nexport const withOnOutsideClick = <ComponentProps extends {}>(\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n Component: React.ComponentType<ComponentProps>,\r\n defaultOnOutsideClick?: (event: MouseEvent) => any,\r\n useCapture: boolean = true,\r\n usePointerEvents: boolean = true,\r\n) => {\r\n return class WithOnOutsideClick extends React.PureComponent<ComponentProps & WithOnOutsideClickProps> {\r\n /** @internal */\r\n public outsideClickContainerDiv?: HTMLDivElement | null = null;\r\n /** @internal */\r\n public isDownOutside = false;\r\n\r\n /** @internal */\r\n public 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 /** @internal */\r\n public onOutsideClick(e: MouseEvent) {\r\n // istanbul ignore else\r\n if (e.target instanceof Node && e.target.nodeType === Node.ELEMENT_NODE) {\r\n // istanbul ignore else\r\n if (!this.props.closeOnNestedPopupOutsideClick && this.isInCorePopup(e.target as HTMLElement))\r\n return;\r\n }\r\n\r\n if (this.props.onOutsideClick)\r\n return this.props.onOutsideClick(e);\r\n else if (defaultOnOutsideClick)\r\n return defaultOnOutsideClick(e);\r\n }\r\n\r\n /** @internal */\r\n public handleDocumentClick = (e: MouseEvent) => {\r\n if (!this.outsideClickContainerDiv || !(e.target instanceof Node) || this.outsideClickContainerDiv.contains(e.target))\r\n return;\r\n\r\n return this.onOutsideClick(e);\r\n };\r\n\r\n /** @internal */\r\n public handleDocumentPointerDown = (e: PointerEvent) => {\r\n this.isDownOutside = true;\r\n // istanbul ignore else\r\n if (this.outsideClickContainerDiv) {\r\n // typically e.target test for instance of Node, but this is not working from pop out windows\r\n this.isDownOutside = !!e.target && !this.outsideClickContainerDiv.contains(e.target as any);\r\n }\r\n };\r\n\r\n /** @internal */\r\n public handleDocumentPointerUp = (e: PointerEvent) => {\r\n let isUpOutside = true;\r\n // istanbul ignore else\r\n if (this.outsideClickContainerDiv) {\r\n // typically e.target test for instance of Node, but this is not working from pop out windows\r\n isUpOutside = !!e.target && !this.outsideClickContainerDiv.contains(e.target as any);\r\n }\r\n\r\n const isOutsideClick = isUpOutside && this.isDownOutside;\r\n this.isDownOutside = false;\r\n isOutsideClick && this.onOutsideClick(e);\r\n };\r\n\r\n public handleOutsideClickContainerDivSet = (outsideClickContainerDiv: HTMLDivElement | null) => {\r\n this.outsideClickContainerDiv = outsideClickContainerDiv;\r\n };\r\n\r\n public getParentDocument() {\r\n // istanbul ignore next\r\n return this.outsideClickContainerDiv?.ownerDocument ?? document;\r\n }\r\n\r\n public override componentDidMount() {\r\n const outsideClickParentDocument = this.getParentDocument();\r\n if (usePointerEvents) {\r\n outsideClickParentDocument.addEventListener(\"pointerdown\", this.handleDocumentPointerDown, useCapture);\r\n outsideClickParentDocument.addEventListener(\"pointerup\", this.handleDocumentPointerUp, useCapture);\r\n } else\r\n outsideClickParentDocument.addEventListener(\"click\", this.handleDocumentClick, useCapture);\r\n }\r\n\r\n /** @internal */\r\n public override componentWillUnmount() {\r\n const outsideClickParentDocument = this.getParentDocument();\r\n if (usePointerEvents) {\r\n outsideClickParentDocument.removeEventListener(\"pointerdown\", this.handleDocumentPointerDown, useCapture);\r\n outsideClickParentDocument.removeEventListener(\"pointerup\", this.handleDocumentPointerUp, useCapture);\r\n } else\r\n outsideClickParentDocument.removeEventListener(\"click\", this.handleDocumentClick, useCapture);\r\n }\r\n\r\n public override render() {\r\n const { onOutsideClick, closeOnNestedPopupOutsideClick, ...props } = this.props; // eslint-disable-line @typescript-eslint/no-unused-vars\r\n return (\r\n <div ref={this.handleOutsideClickContainerDivSet}>\r\n <Component {...props as ComponentProps} />\r\n </div>\r\n );\r\n }\r\n };\r\n};\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconComponent.d.ts","sourceRoot":"","sources":["../../../../src/core-react/icons/IconComponent.tsx"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,sBAAsB,EAAqB,MAAM,uBAAuB,CAAC;AAElF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C;;GAEG;AACH,oBAAY,QAAQ,GAAG,MAAM,GAAG,sBAAsB,GAAG,KAAK,CAAC,SAAS,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,WAAW;IAC5C;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"IconComponent.d.ts","sourceRoot":"","sources":["../../../../src/core-react/icons/IconComponent.tsx"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,sBAAsB,EAAqB,MAAM,uBAAuB,CAAC;AAElF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C;;GAEG;AACH,oBAAY,QAAQ,GAAG,MAAM,GAAG,sBAAsB,GAAG,KAAK,CAAC,SAAS,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,WAAW;IAC5C;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,sBAgDpC"}
|
|
@@ -28,13 +28,17 @@ 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
|
|
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
|
|
35
35
|
// istanbul ignore next
|
|
36
36
|
const sanitizer = DOMPurify !== null && DOMPurify !== void 0 ? DOMPurify : DOMPurifyNS;
|
|
37
|
-
const
|
|
37
|
+
const sanitizerConfig = {
|
|
38
|
+
ALLOWED_TAGS: ["svg-loader"],
|
|
39
|
+
ADD_URI_SAFE_ATTR: webComponentString.startsWith("data:") ? ["src"] : [],
|
|
40
|
+
};
|
|
41
|
+
const sanitizedIconString = sanitizer.sanitize(svgDiv, sanitizerConfig);
|
|
38
42
|
// we can safely disable jam3/no-sanitizer-with-danger as we are sanitizing above
|
|
39
43
|
// eslint-disable-next-line @typescript-eslint/naming-convention, jam3/no-sanitizer-with-danger
|
|
40
44
|
const webComponentNode = React.createElement("div", { dangerouslySetInnerHTML: { __html: sanitizedIconString } });
|
|
@@ -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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SAAS,EAAE,UAAU,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,IAC/D,gBAAgB,CACf,CACL,CAAC;SACH;QACD,OAAO,CAAC,2BAAG,SAAS,EAAE,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,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\r\n const sanitizerConfig = {\r\n ALLOWED_TAGS: [\"svg-loader\"],\r\n ADD_URI_SAFE_ATTR: webComponentString.startsWith(\"data:\") ? [\"src\"] : [],\r\n };\r\n\r\n const sanitizedIconString = sanitizer.sanitize(svgDiv, sanitizerConfig);\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"]}
|
|
@@ -27,7 +27,7 @@ export function ThemedSelect(props) {
|
|
|
27
27
|
const noOptionLabel = React.useRef();
|
|
28
28
|
const defaultOptionMessage = React.useCallback(() => {
|
|
29
29
|
if (!noOptionLabel.current) {
|
|
30
|
-
noOptionLabel.current = UiCore.translate("
|
|
30
|
+
noOptionLabel.current = UiCore.translate("reactselect.noSelectOption");
|
|
31
31
|
}
|
|
32
32
|
return noOptionLabel.current;
|
|
33
33
|
}, [noOptionLabel]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemedSelect.js","sourceRoot":"","sources":["../../../../src/core-react/select/ThemedSelect.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,4CAA4C;AAC5C;;GAEG;AAEH,OAAO,sBAAsB,CAAC;AAC9B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,SAAS,EAAE,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAKrD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAqLlD,MAAM,UAAU,GAAG,CAAC,KAAqB,EAAE,EAAE;IAC3C,OAAO,CACL,6BAAK,SAAS,EAAC,uBAAuB;QACpC,oBAAC,UAAU,CAAC,IAAI,OAAK,KAAK,GAAI,CAC1B,CACP,CAAC;AACJ,CAAC,CAAC;AACF;;;GAGG;AACH,gEAAgE;AAChE,MAAM,UAAU,YAAY,CAAC,KAAwB;;IACnD,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,EAAsB,CAAC;IACzD,MAAM,oBAAoB,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QAClD,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE;YAC1B,aAAa,CAAC,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC;SACvE;QACD,OAAO,aAAa,CAAC,OAAO,CAAC;IAC/B,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IACpB,MAAM,gBAAgB,GAAG,MAAA,KAAK,CAAC,gBAAgB,mCAAI,oBAAoB,CAAC;IACxE,MAAM,eAAe,GAAG,UAAU,CAAC,uBAAuB,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC7E,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;IAC3E,MAAM;IACJ,6DAA6D;IAC7D,eAAe,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG;IAC5G,wCAAwC;IACxC,GAAG,UAAU,CAAC,qBAAqB;MACpC,GAAG,KAAY,CAAC;IACjB,MAAM,YAAY,GAAG;QACnB,GAAG,KAAK,CAAC,MAAM;QACf,UAAU,EAAE,CAAC,IAAyB,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,CAAC;KACjE,CAAC;IAEF,MAAM,MAAM,GAAG,sBAAsB,CAAC,+BAA+B,CAAC,CAAC;IACvE,OAAO,CACL,6BAAK,SAAS,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM;QAC1C,oBAAC,SAAS,IACR,GAAG,EAAE,GAAG,EACR,eAAe,EAAC,cAAc,EAC9B,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,YAAY,EAC9B,MAAM,EAAE,YAAY;YACpB,gEAAgE;YAChE,UAAU,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC,UAAU,EAAE,KACjD,UAAU,GACd,CACE,CACP,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 Select\r\n */\r\n\r\nimport \"./themed-select.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport Component, { components } from \"react-select\";\r\nimport { formatGroupLabel, getOptionLabel, getOptionValue } from \"react-select/src/builtins\";\r\nimport { SelectComponentsConfig } from \"react-select/src/components/index\";\r\nimport { MenuProps } from \"react-select/src/components/Menu\";\r\nimport { ActionMeta, FocusEventHandler, InputActionMeta, KeyboardEventHandler, ValueType } from \"react-select/src/types\";\r\nimport { UiCore } from \"../UiCore\";\r\nimport { getCssVariableAsNumber } from \"../utils/getCssVariable\";\r\nimport { getParentSelector } from \"./modalHelper\";\r\n\r\n// cspell:ignore reactselect builtins\r\n\r\n/* eslint-disable @typescript-eslint/no-shadow, @typescript-eslint/consistent-type-definitions, @typescript-eslint/array-type */\r\ntype FormatOptionLabelContext = \"menu\" | \"value\";\r\ntype FormatOptionLabelMeta = {\r\n context: FormatOptionLabelContext;\r\n inputValue: string;\r\n selectValue: ValueType<OptionType>;\r\n};\r\n\r\n/** OptionType for react-select 2.0 and above. which only accepts pairs of value & label strings\r\n * @beta\r\n * @deprecated use Select from @itwin/itwinui-react\r\n */\r\nexport interface OptionType {\r\n value: any;\r\n label: string;\r\n}\r\n/** OptionsType to match label/value pair OptionType\r\n * @beta\r\n * @deprecated use Select from @itwin/itwinui-react\r\n*/\r\nexport type OptionsType = Array<OptionType>;\r\n\r\n/** ThemedSelectProps to control specific features of ThemedSelect\r\n * @beta\r\n * @deprecated use Select from @itwin/itwinui-react\r\n */\r\nexport type ThemedSelectProps = {\r\n /* Aria label (for assistive tech) */\r\n \"aria-label\"?: string;\r\n /* HTML ID of an element that should be used as the label (for assistive tech) */\r\n \"aria-labelledby\"?: string;\r\n /* Focus the control when it is mounted */\r\n autoFocus?: boolean;\r\n /* Remove the currently focused option when the user presses backspace */\r\n backspaceRemovesValue?: boolean;\r\n /* Remove focus from the input when the user selects an option (handy for dismissing the keyboard on touch devices) */\r\n blurInputOnSelect?: boolean;\r\n /* When the user reaches the top/bottom of the menu, prevent scroll on the scroll-parent */\r\n captureMenuScroll?: boolean;\r\n /* Sets a className attribute on the outer component */\r\n className?: string;\r\n /* Close the select menu when the user selects an option */\r\n closeMenuOnSelect?: boolean;\r\n /*\r\n If `true`, close the select menu when the user scrolls the document/body.\r\n\r\n If a function, takes a standard javascript `ScrollEvent` you return a boolean:\r\n\r\n `true` => The menu closes\r\n\r\n `false` => The menu stays open\r\n\r\n This is useful when you have a scrollable modal and want to portal the menu out,\r\n but want to avoid graphical issues.\r\n */\r\n closeMenuOnScroll?: boolean | EventListener;\r\n /*\r\n This complex object includes all the compositional components that are used\r\n in `react-select`. If you wish to overwrite a component, pass in an object\r\n with the appropriate namespace.\r\n\r\n If you only wish to restyle a component, we recommend using the `styles` prop\r\n instead. For a list of the components that can be passed in, and the shape\r\n that will be passed to them, see [the components docs](/components)\r\n */\r\n components?: SelectComponentsConfig<OptionType>;\r\n /* Whether the value of the select, e.g. SingleValue, should be displayed in the control. */\r\n controlShouldRenderValue?: boolean;\r\n /* Ff true, the menu is open immediately */\r\n defaultMenuIsOpen?: boolean;\r\n /* Value set in the control by default */\r\n defaultValue?: ValueType<OptionType>;\r\n /** Provides ability to return reference to the outer HTMLDivElement */\r\n divRef?: React.Ref<HTMLDivElement>;\r\n /* Clear all values when the user presses escape AND the menu is closed */\r\n escapeClearsValue?: boolean;\r\n /* Custom method to filter whether an option should be displayed in the menu */\r\n filterOption?: ((\r\n option: OptionType,\r\n rawInput: string,\r\n ) => boolean) | null;\r\n /*\r\n Formats group labels in the menu as React components\r\n\r\n An example can be found in the [Replacing builtins](/advanced#replacing-builtins) documentation.\r\n*/\r\n formatGroupLabel?: typeof formatGroupLabel;\r\n /* Formats option labels in the menu and control as React components */\r\n formatOptionLabel?: (optionType: OptionType, formatLabelMeta: FormatOptionLabelMeta) => React.ReactNode;\r\n /* Resolves option data to a string to be displayed as the label by components */\r\n getOptionLabel?: typeof getOptionLabel;\r\n /* Resolves option data to a string to compare options and specify value attributes */\r\n getOptionValue?: typeof getOptionValue;\r\n /* Hide the selected option from the menu */\r\n hideSelectedOptions?: boolean;\r\n /* The id to set on the SelectContainer component. */\r\n id?: string;\r\n /* The value of the search input */\r\n inputValue?: string;\r\n /* The id of the search input */\r\n inputId?: string;\r\n /* Define an id prefix for the select components e.g. {your-id}-value */\r\n instanceId?: number | string;\r\n /* Is the select value clearable */\r\n isClearable?: boolean;\r\n /* Is the select disabled */\r\n isDisabled?: boolean;\r\n /* Is the select in a state of loading (async) */\r\n isLoading?: boolean;\r\n /*\r\n Override the built-in logic to detect whether an option is disabled\r\n\r\n An example can be found in the [Replacing builtins](/advanced#replacing-builtins) documentation.\r\n */\r\n isOptionDisabled?: (option: OptionType, options: OptionsType) => boolean | false;\r\n /* Support multiple selected options */\r\n isMulti?: boolean;\r\n /* If true, menu will not be opened in a portal */\r\n isMenuFixed?: boolean;\r\n /* Is the select direction right-to-left */\r\n isRtl?: boolean;\r\n /* Whether to enable search functionality */\r\n isSearchable?: boolean;\r\n /* Minimum height of the menu before flipping */\r\n minMenuHeight?: number;\r\n /* Maximum height of the menu before scrolling */\r\n maxMenuHeight?: number;\r\n /* Whether the menu is open */\r\n menuIsOpen?: boolean;\r\n /* Whether to block scroll events when the menu is open */\r\n menuShouldBlockScroll?: boolean;\r\n /* Whether the menu should be scrolled into view when it opens */\r\n menuShouldScrollIntoView?: boolean;\r\n /* Name of the HTML Input (optional - without this, no input will be rendered) */\r\n name?: string;\r\n /* Text to display when there are no options */\r\n noOptionsMessage?: (obj: { inputValue: string }) => string | null;\r\n /* Handle blur events on the control */\r\n onBlur?: FocusEventHandler;\r\n /* Handle change events on the select */\r\n onChange?: (value: ValueType<OptionType>, action: ActionMeta<OptionType>) => void;\r\n /* Handle focus events on the control */\r\n onFocus?: FocusEventHandler;\r\n /* Handle change events on the input */\r\n onInputChange?: (newValue: string, actionMeta?: InputActionMeta) => void;\r\n /* Handle key down events on the select */\r\n onKeyDown?: KeyboardEventHandler;\r\n /* Handle the menu opening */\r\n onMenuOpen?: () => void;\r\n /* Handle the menu closing */\r\n onMenuClose?: () => void;\r\n /* Fired when the user scrolls to the top of the menu */\r\n onMenuScrollToTop?: (e: React.SyntheticEvent<HTMLElement>) => void;\r\n /* Fired when the user scrolls to the bottom of the menu */\r\n onMenuScrollToBottom?: (e: React.SyntheticEvent<HTMLElement>) => void;\r\n /* Allows control of whether the menu is opened when the Select is focused */\r\n openMenuOnFocus?: boolean;\r\n /* Allows control of whether the menu is opened when the Select is clicked */\r\n openMenuOnClick?: boolean;\r\n /* Array of options that populate the select menu */\r\n options: OptionsType;\r\n /* Number of options to jump in menu when page{up|down} keys are used */\r\n pageSize?: number;\r\n /* Placeholder for the select value */\r\n placeholder?: string;\r\n /** Provides ability to return reference to the ThemedSelect */\r\n ref?: React.Ref<Component>;\r\n /* Sets additional styling */\r\n styles?: React.CSSProperties;\r\n /* Sets the tabIndex attribute on the input */\r\n tabIndex?: string;\r\n /* Select the currently focused option when the user presses tab */\r\n tabSelectsValue?: boolean;\r\n /* The value of the select; reflected by the selected option */\r\n value?: ValueType<OptionType>;\r\n};\r\n\r\nconst ThemedMenu = (props: MenuProps<any>) => { // eslint-disable-line @typescript-eslint/naming-convention\r\n return (\r\n <div className=\"uicore-reactSelectTop\">\r\n <components.Menu {...props} />\r\n </div>\r\n );\r\n};\r\n/** ThemedSelect is a wrapper for react-select with iTwin.js UI theming applied\r\n * @beta\r\n * @deprecated use Select from @itwin/itwinui-react\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function ThemedSelect(props: ThemedSelectProps) {\r\n const noOptionLabel = React.useRef<string | undefined>();\r\n const defaultOptionMessage = React.useCallback(() => {\r\n if (!noOptionLabel.current) {\r\n noOptionLabel.current = UiCore.translate(\"reactelect.noSelectOption\");\r\n }\r\n return noOptionLabel.current;\r\n }, [noOptionLabel]);\r\n const noOptionFunction = props.noOptionsMessage ?? defaultOptionMessage;\r\n const selectClassName = classnames(\"uicore-reactSelectTop\", props.className);\r\n const portalTarget = !!props.isMenuFixed ? undefined : getParentSelector();\r\n const {\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n classNamePrefix, className, noOptionsMessage, menuPortalTarget, isMenuFixed, styles, components, divRef, ref,\r\n // eslint-disable-next-line comma-dangle\r\n ...otherProps // pass-through props\r\n } = props as any;\r\n const selectStyles = {\r\n ...props.styles,\r\n menuPortal: (base: React.CSSProperties) => ({ ...base, zIndex }),\r\n };\r\n\r\n const zIndex = getCssVariableAsNumber(\"--uicore-z-index-dialog-popup\");\r\n return (\r\n <div className={selectClassName} ref={divRef}>\r\n <Component\r\n ref={ref}\r\n classNamePrefix=\"react-select\"\r\n noOptionsMessage={noOptionFunction}\r\n menuPortalTarget={portalTarget}\r\n styles={selectStyles}\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n components={{ Menu: ThemedMenu, ...props.components }}\r\n {...otherProps}\r\n />\r\n </div>\r\n );\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ThemedSelect.js","sourceRoot":"","sources":["../../../../src/core-react/select/ThemedSelect.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,4CAA4C;AAC5C;;GAEG;AAEH,OAAO,sBAAsB,CAAC;AAC9B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,SAAS,EAAE,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAKrD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAqLlD,MAAM,UAAU,GAAG,CAAC,KAAqB,EAAE,EAAE;IAC3C,OAAO,CACL,6BAAK,SAAS,EAAC,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Ae,EAAE,GAAG,EAAE,MAAM;QAC1C,oBAAC,SAAS,IACR,GAAG,EAAE,GAAG,EACR,eAAe,EAAC,cAAc,EAC9B,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,YAAY,EAC9B,MAAM,EAAE,YAAY;YACpB,gEAAgE;YAChE,UAAU,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC,UAAU,EAAE,KACjD,UAAU,GACd,CACE,CACP,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 Select\r\n */\r\n\r\nimport \"./themed-select.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport Component, { components } from \"react-select\";\r\nimport { formatGroupLabel, getOptionLabel, getOptionValue } from \"react-select/src/builtins\";\r\nimport { SelectComponentsConfig } from \"react-select/src/components/index\";\r\nimport { MenuProps } from \"react-select/src/components/Menu\";\r\nimport { ActionMeta, FocusEventHandler, InputActionMeta, KeyboardEventHandler, ValueType } from \"react-select/src/types\";\r\nimport { UiCore } from \"../UiCore\";\r\nimport { getCssVariableAsNumber } from \"../utils/getCssVariable\";\r\nimport { getParentSelector } from \"./modalHelper\";\r\n\r\n// cspell:ignore reactselect builtins\r\n\r\n/* eslint-disable @typescript-eslint/no-shadow, @typescript-eslint/consistent-type-definitions, @typescript-eslint/array-type */\r\ntype FormatOptionLabelContext = \"menu\" | \"value\";\r\ntype FormatOptionLabelMeta = {\r\n context: FormatOptionLabelContext;\r\n inputValue: string;\r\n selectValue: ValueType<OptionType>;\r\n};\r\n\r\n/** OptionType for react-select 2.0 and above. which only accepts pairs of value & label strings\r\n * @beta\r\n * @deprecated use Select from @itwin/itwinui-react\r\n */\r\nexport interface OptionType {\r\n value: any;\r\n label: string;\r\n}\r\n/** OptionsType to match label/value pair OptionType\r\n * @beta\r\n * @deprecated use Select from @itwin/itwinui-react\r\n*/\r\nexport type OptionsType = Array<OptionType>;\r\n\r\n/** ThemedSelectProps to control specific features of ThemedSelect\r\n * @beta\r\n * @deprecated use Select from @itwin/itwinui-react\r\n */\r\nexport type ThemedSelectProps = {\r\n /* Aria label (for assistive tech) */\r\n \"aria-label\"?: string;\r\n /* HTML ID of an element that should be used as the label (for assistive tech) */\r\n \"aria-labelledby\"?: string;\r\n /* Focus the control when it is mounted */\r\n autoFocus?: boolean;\r\n /* Remove the currently focused option when the user presses backspace */\r\n backspaceRemovesValue?: boolean;\r\n /* Remove focus from the input when the user selects an option (handy for dismissing the keyboard on touch devices) */\r\n blurInputOnSelect?: boolean;\r\n /* When the user reaches the top/bottom of the menu, prevent scroll on the scroll-parent */\r\n captureMenuScroll?: boolean;\r\n /* Sets a className attribute on the outer component */\r\n className?: string;\r\n /* Close the select menu when the user selects an option */\r\n closeMenuOnSelect?: boolean;\r\n /*\r\n If `true`, close the select menu when the user scrolls the document/body.\r\n\r\n If a function, takes a standard javascript `ScrollEvent` you return a boolean:\r\n\r\n `true` => The menu closes\r\n\r\n `false` => The menu stays open\r\n\r\n This is useful when you have a scrollable modal and want to portal the menu out,\r\n but want to avoid graphical issues.\r\n */\r\n closeMenuOnScroll?: boolean | EventListener;\r\n /*\r\n This complex object includes all the compositional components that are used\r\n in `react-select`. If you wish to overwrite a component, pass in an object\r\n with the appropriate namespace.\r\n\r\n If you only wish to restyle a component, we recommend using the `styles` prop\r\n instead. For a list of the components that can be passed in, and the shape\r\n that will be passed to them, see [the components docs](/components)\r\n */\r\n components?: SelectComponentsConfig<OptionType>;\r\n /* Whether the value of the select, e.g. SingleValue, should be displayed in the control. */\r\n controlShouldRenderValue?: boolean;\r\n /* Ff true, the menu is open immediately */\r\n defaultMenuIsOpen?: boolean;\r\n /* Value set in the control by default */\r\n defaultValue?: ValueType<OptionType>;\r\n /** Provides ability to return reference to the outer HTMLDivElement */\r\n divRef?: React.Ref<HTMLDivElement>;\r\n /* Clear all values when the user presses escape AND the menu is closed */\r\n escapeClearsValue?: boolean;\r\n /* Custom method to filter whether an option should be displayed in the menu */\r\n filterOption?: ((\r\n option: OptionType,\r\n rawInput: string,\r\n ) => boolean) | null;\r\n /*\r\n Formats group labels in the menu as React components\r\n\r\n An example can be found in the [Replacing builtins](/advanced#replacing-builtins) documentation.\r\n*/\r\n formatGroupLabel?: typeof formatGroupLabel;\r\n /* Formats option labels in the menu and control as React components */\r\n formatOptionLabel?: (optionType: OptionType, formatLabelMeta: FormatOptionLabelMeta) => React.ReactNode;\r\n /* Resolves option data to a string to be displayed as the label by components */\r\n getOptionLabel?: typeof getOptionLabel;\r\n /* Resolves option data to a string to compare options and specify value attributes */\r\n getOptionValue?: typeof getOptionValue;\r\n /* Hide the selected option from the menu */\r\n hideSelectedOptions?: boolean;\r\n /* The id to set on the SelectContainer component. */\r\n id?: string;\r\n /* The value of the search input */\r\n inputValue?: string;\r\n /* The id of the search input */\r\n inputId?: string;\r\n /* Define an id prefix for the select components e.g. {your-id}-value */\r\n instanceId?: number | string;\r\n /* Is the select value clearable */\r\n isClearable?: boolean;\r\n /* Is the select disabled */\r\n isDisabled?: boolean;\r\n /* Is the select in a state of loading (async) */\r\n isLoading?: boolean;\r\n /*\r\n Override the built-in logic to detect whether an option is disabled\r\n\r\n An example can be found in the [Replacing builtins](/advanced#replacing-builtins) documentation.\r\n */\r\n isOptionDisabled?: (option: OptionType, options: OptionsType) => boolean | false;\r\n /* Support multiple selected options */\r\n isMulti?: boolean;\r\n /* If true, menu will not be opened in a portal */\r\n isMenuFixed?: boolean;\r\n /* Is the select direction right-to-left */\r\n isRtl?: boolean;\r\n /* Whether to enable search functionality */\r\n isSearchable?: boolean;\r\n /* Minimum height of the menu before flipping */\r\n minMenuHeight?: number;\r\n /* Maximum height of the menu before scrolling */\r\n maxMenuHeight?: number;\r\n /* Whether the menu is open */\r\n menuIsOpen?: boolean;\r\n /* Whether to block scroll events when the menu is open */\r\n menuShouldBlockScroll?: boolean;\r\n /* Whether the menu should be scrolled into view when it opens */\r\n menuShouldScrollIntoView?: boolean;\r\n /* Name of the HTML Input (optional - without this, no input will be rendered) */\r\n name?: string;\r\n /* Text to display when there are no options */\r\n noOptionsMessage?: (obj: { inputValue: string }) => string | null;\r\n /* Handle blur events on the control */\r\n onBlur?: FocusEventHandler;\r\n /* Handle change events on the select */\r\n onChange?: (value: ValueType<OptionType>, action: ActionMeta<OptionType>) => void;\r\n /* Handle focus events on the control */\r\n onFocus?: FocusEventHandler;\r\n /* Handle change events on the input */\r\n onInputChange?: (newValue: string, actionMeta?: InputActionMeta) => void;\r\n /* Handle key down events on the select */\r\n onKeyDown?: KeyboardEventHandler;\r\n /* Handle the menu opening */\r\n onMenuOpen?: () => void;\r\n /* Handle the menu closing */\r\n onMenuClose?: () => void;\r\n /* Fired when the user scrolls to the top of the menu */\r\n onMenuScrollToTop?: (e: React.SyntheticEvent<HTMLElement>) => void;\r\n /* Fired when the user scrolls to the bottom of the menu */\r\n onMenuScrollToBottom?: (e: React.SyntheticEvent<HTMLElement>) => void;\r\n /* Allows control of whether the menu is opened when the Select is focused */\r\n openMenuOnFocus?: boolean;\r\n /* Allows control of whether the menu is opened when the Select is clicked */\r\n openMenuOnClick?: boolean;\r\n /* Array of options that populate the select menu */\r\n options: OptionsType;\r\n /* Number of options to jump in menu when page{up|down} keys are used */\r\n pageSize?: number;\r\n /* Placeholder for the select value */\r\n placeholder?: string;\r\n /** Provides ability to return reference to the ThemedSelect */\r\n ref?: React.Ref<Component>;\r\n /* Sets additional styling */\r\n styles?: React.CSSProperties;\r\n /* Sets the tabIndex attribute on the input */\r\n tabIndex?: string;\r\n /* Select the currently focused option when the user presses tab */\r\n tabSelectsValue?: boolean;\r\n /* The value of the select; reflected by the selected option */\r\n value?: ValueType<OptionType>;\r\n};\r\n\r\nconst ThemedMenu = (props: MenuProps<any>) => { // eslint-disable-line @typescript-eslint/naming-convention\r\n return (\r\n <div className=\"uicore-reactSelectTop\">\r\n <components.Menu {...props} />\r\n </div>\r\n );\r\n};\r\n/** ThemedSelect is a wrapper for react-select with iTwin.js UI theming applied\r\n * @beta\r\n * @deprecated use Select from @itwin/itwinui-react\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function ThemedSelect(props: ThemedSelectProps) {\r\n const noOptionLabel = React.useRef<string | undefined>();\r\n const defaultOptionMessage = React.useCallback(() => {\r\n if (!noOptionLabel.current) {\r\n noOptionLabel.current = UiCore.translate(\"reactselect.noSelectOption\");\r\n }\r\n return noOptionLabel.current;\r\n }, [noOptionLabel]);\r\n const noOptionFunction = props.noOptionsMessage ?? defaultOptionMessage;\r\n const selectClassName = classnames(\"uicore-reactSelectTop\", props.className);\r\n const portalTarget = !!props.isMenuFixed ? undefined : getParentSelector();\r\n const {\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n classNamePrefix, className, noOptionsMessage, menuPortalTarget, isMenuFixed, styles, components, divRef, ref,\r\n // eslint-disable-next-line comma-dangle\r\n ...otherProps // pass-through props\r\n } = props as any;\r\n const selectStyles = {\r\n ...props.styles,\r\n menuPortal: (base: React.CSSProperties) => ({ ...base, zIndex }),\r\n };\r\n\r\n const zIndex = getCssVariableAsNumber(\"--uicore-z-index-dialog-popup\");\r\n return (\r\n <div className={selectClassName} ref={divRef}>\r\n <Component\r\n ref={ref}\r\n classNamePrefix=\"react-select\"\r\n noOptionsMessage={noOptionFunction}\r\n menuPortalTarget={portalTarget}\r\n styles={selectStyles}\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n components={{ Menu: ThemedMenu, ...props.components }}\r\n {...otherProps}\r\n />\r\n </div>\r\n );\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;
|
|
1
|
+
{"version":3,"file":"IconWebComponent.d.ts","sourceRoot":"","sources":["../../../../src/core-react/utils/IconWebComponent.ts"],"names":[],"mappings":"AAMA;;GAEG;AAOH;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;YACjC,iBAAiB;YAKjB,OAAO;CAmDtB"}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import { UiError } from "@itwin/appui-abstract";
|
|
11
11
|
import { Logger } from "@itwin/core-bentley";
|
|
12
12
|
import { UiCore } from "../UiCore";
|
|
13
|
+
import DOMPurify, * as DOMPurifyNS from "dompurify";
|
|
13
14
|
/**
|
|
14
15
|
* IconWebComponent loads icon from an svg path
|
|
15
16
|
*/
|
|
@@ -22,7 +23,27 @@ export class IconWebComponent extends HTMLElement {
|
|
|
22
23
|
// if svg was already appended don't request it again
|
|
23
24
|
if (this.childNodes.length)
|
|
24
25
|
return;
|
|
25
|
-
|
|
26
|
+
const src = this.getAttribute("src") || "";
|
|
27
|
+
if (src.startsWith("data:")) {
|
|
28
|
+
const dataUriParts = src.split(",");
|
|
29
|
+
if (dataUriParts.length !== 2 || "data:image/svg+xml;base64" !== dataUriParts[0]) {
|
|
30
|
+
Logger.logError(UiCore.loggerCategory(this), "Unable to load icon.");
|
|
31
|
+
}
|
|
32
|
+
// the esm build of dompurify has a default import but the cjs build does not
|
|
33
|
+
// if there is a default export, use it (likely esm), otherwise use the namespace
|
|
34
|
+
// istanbul ignore next
|
|
35
|
+
const sanitizer = DOMPurify !== null && DOMPurify !== void 0 ? DOMPurify : DOMPurifyNS;
|
|
36
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
37
|
+
const sanitizedSvg = sanitizer.sanitize(atob(dataUriParts[1]));
|
|
38
|
+
const parsedSvg = new window.DOMParser().parseFromString(sanitizedSvg, "text/xml");
|
|
39
|
+
const errorNode = parsedSvg.querySelector("parsererror");
|
|
40
|
+
if (errorNode || "svg" !== parsedSvg.documentElement.nodeName.toLowerCase()) {
|
|
41
|
+
throw new UiError(UiCore.loggerCategory(this), "Unable to load icon.");
|
|
42
|
+
}
|
|
43
|
+
!this.childNodes.length && this.append(parsedSvg.documentElement);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
await fetch(src)
|
|
26
47
|
.catch((_error) => {
|
|
27
48
|
Logger.logError(UiCore.loggerCategory(this), "Unable to load icon.");
|
|
28
49
|
})
|
|
@@ -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;
|
|
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;AACnC,OAAO,SAAS,EAAE,KAAK,WAAW,MAAM,WAAW,CAAC;AAEpD;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,WAAW;IACvC,KAAK,CAAC,iBAAiB;QAC7B,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9C,CAAC;IAEO,KAAK,CAAC,OAAO;QACnB,qDAAqD;QACrD,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM;Y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,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,sBAAsB,CAAC,CAAC;QACvE,CAAC,CAAC;aACD,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;YACvB,IAAI,QAAQ,IAAI,QAAQ,CAAC,EAAE,EAAE;gBAC3B,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;aACxB;iBAAM;gBACL,MAAM,IAAI,OAAO,CAAE,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,sBAAsB,CAAC,CAAC;aACzE;QACH,CAAC,CAAC;aACD,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;YACZ,IAAI,GAAG,KAAK,SAAS,EAAE;gBACrB,OAAO,CAAC,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,eAAe,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;aAClE;iBAAM;gBACL,MAAM,IAAI,OAAO,CAAE,MAAM,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","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\nimport DOMPurify, * as DOMPurifyNS from \"dompurify\";\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\r\n const src = this.getAttribute(\"src\") || \"\";\r\n\r\n if (src.startsWith(\"data:\")) {\r\n const dataUriParts = src.split(\",\");\r\n\r\n if (dataUriParts.length !== 2 || \"data:image/svg+xml;base64\" !== dataUriParts[0]) {\r\n Logger.logError(UiCore.loggerCategory(this), \"Unable to load icon.\");\r\n }\r\n\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 // eslint-disable-next-line deprecation/deprecation\r\n const sanitizedSvg = sanitizer.sanitize(atob(dataUriParts[1]));\r\n\r\n const parsedSvg = new window.DOMParser().parseFromString(sanitizedSvg, \"text/xml\");\r\n const errorNode = parsedSvg.querySelector(\"parsererror\");\r\n if (errorNode || \"svg\" !== parsedSvg.documentElement.nodeName.toLowerCase()) {\r\n throw new UiError (UiCore.loggerCategory(this), \"Unable to load icon.\");\r\n }\r\n\r\n !this.childNodes.length && this.append(parsedSvg.documentElement);\r\n return;\r\n }\r\n\r\n await fetch(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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCssVariable.d.ts","sourceRoot":"","sources":["../../../../src/core-react/utils/getCssVariable.ts"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"getCssVariable.d.ts","sourceRoot":"","sources":["../../../../src/core-react/utils/getCssVariable.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;GAEG;AACH,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,MAAM,CAKtF;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,MAAM,CAM9F"}
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
/** @packageDocumentation
|
|
6
6
|
* @module Utilities
|
|
7
7
|
*/
|
|
8
|
-
/* istanbul ignore next */
|
|
9
8
|
/** Get CSS variable
|
|
10
9
|
* @public
|
|
11
10
|
*/
|
|
@@ -15,7 +14,6 @@ export function getCssVariable(variableName, htmlElement) {
|
|
|
15
14
|
const cssVal = String(cssStyles.getPropertyValue(variableName)).trim();
|
|
16
15
|
return cssVal;
|
|
17
16
|
}
|
|
18
|
-
/* istanbul ignore next */
|
|
19
17
|
/** Get CSS variable as number
|
|
20
18
|
* @public
|
|
21
19
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCssVariable.js","sourceRoot":"","sources":["../../../../src/core-react/utils/getCssVariable.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH
|
|
1
|
+
{"version":3,"file":"getCssVariable.js","sourceRoot":"","sources":["../../../../src/core-react/utils/getCssVariable.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,YAAoB,EAAE,WAAyB;IAC5E,MAAM,OAAO,GAAG,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,QAAQ,CAAC,eAAe,CAAC;IACxD,MAAM,SAAS,GAAG,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACvE,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,YAAoB,EAAE,WAAyB;IACpF,IAAI,SAAS,GAAW,GAAG,CAAC;IAC5B,MAAM,SAAS,GAAG,cAAc,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;IAC5D,IAAI,SAAS;QACX,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;IACpC,OAAO,SAAS,CAAC;AACnB,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 Utilities\r\n */\r\n\r\n/** Get CSS variable\r\n * @public\r\n */\r\nexport function getCssVariable(variableName: string, htmlElement?: HTMLElement): string {\r\n const element = htmlElement ?? document.documentElement;\r\n const cssStyles = getComputedStyle(element, null);\r\n const cssVal = String(cssStyles.getPropertyValue(variableName)).trim();\r\n return cssVal;\r\n}\r\n\r\n/** Get CSS variable as number\r\n * @public\r\n */\r\nexport function getCssVariableAsNumber(variableName: string, htmlElement?: HTMLElement): number {\r\n let cssValNum: number = NaN;\r\n const cssValStr = getCssVariable(variableName, htmlElement);\r\n if (cssValStr)\r\n cssValNum = parseFloat(cssValStr);\r\n return cssValNum;\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/core-react",
|
|
3
|
-
"version": "3.4.0
|
|
3
|
+
"version": "3.4.0",
|
|
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.4.0
|
|
26
|
-
"@itwin/core-bentley": "^3.4.0
|
|
25
|
+
"@itwin/appui-abstract": "^3.4.0",
|
|
26
|
+
"@itwin/core-bentley": "^3.4.0",
|
|
27
27
|
"react": "^17.0.0",
|
|
28
28
|
"react-dom": "^17.0.0"
|
|
29
29
|
},
|
|
@@ -32,39 +32,33 @@
|
|
|
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.4.0
|
|
36
|
-
"@itwin/build-tools": "3.4.0
|
|
37
|
-
"@itwin/core-bentley": "3.4.0
|
|
38
|
-
"@itwin/core-common": "3.4.0
|
|
39
|
-
"@itwin/core-i18n": "3.4.0
|
|
40
|
-
"@itwin/eslint-plugin": "3.4.0
|
|
35
|
+
"@itwin/appui-abstract": "3.4.0",
|
|
36
|
+
"@itwin/build-tools": "3.4.0",
|
|
37
|
+
"@itwin/core-bentley": "3.4.0",
|
|
38
|
+
"@itwin/core-common": "3.4.0",
|
|
39
|
+
"@itwin/core-i18n": "3.4.0",
|
|
40
|
+
"@itwin/eslint-plugin": "3.4.0",
|
|
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
|
-
"@testing-library/user-event": "^
|
|
44
|
+
"@testing-library/user-event": "^14.4.2",
|
|
45
45
|
"@types/chai": "4.3.1",
|
|
46
46
|
"@types/chai-as-promised": "^7",
|
|
47
|
-
"@types/chai-jest-snapshot": "^1.3.0",
|
|
48
47
|
"@types/chai-spies": "^1.0.0",
|
|
49
48
|
"@types/dompurify": "^2.0.3",
|
|
50
|
-
"@types/enzyme": "3.9.3",
|
|
51
49
|
"@types/lodash": "^4.14.0",
|
|
52
50
|
"@types/mocha": "^8.2.2",
|
|
53
|
-
"@types/node": "16.11.
|
|
51
|
+
"@types/node": "16.11.59",
|
|
54
52
|
"@types/react": "^17.0.37",
|
|
55
53
|
"@types/react-autosuggest": "10.1.2",
|
|
56
54
|
"@types/react-dom": "^17.0.0",
|
|
57
55
|
"@types/react-select": "3.0.26",
|
|
58
56
|
"@types/sinon": "^9.0.0",
|
|
59
57
|
"@types/sinon-chai": "^3.2.0",
|
|
60
|
-
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.3",
|
|
61
58
|
"chai": "^4.1.2",
|
|
62
59
|
"chai-as-promised": "^7",
|
|
63
|
-
"chai-jest-snapshot": "^2.0.0",
|
|
64
60
|
"chai-spies": "1.0.0",
|
|
65
61
|
"cpx2": "^3.0.0",
|
|
66
|
-
"enzyme": "3.10.0",
|
|
67
|
-
"enzyme-to-json": "^3.3.4",
|
|
68
62
|
"eslint": "^7.11.0",
|
|
69
63
|
"ignore-styles": "^5.0.1",
|
|
70
64
|
"jsdom": "^19.0.0",
|
|
@@ -74,15 +68,13 @@
|
|
|
74
68
|
"raf": "^3.4.0",
|
|
75
69
|
"react": "^17.0.0",
|
|
76
70
|
"react-dom": "^17.0.0",
|
|
77
|
-
"react-dom-instance": "2.0.0",
|
|
78
71
|
"react-test-renderer": "^17.0.0",
|
|
79
72
|
"rimraf": "^3.0.2",
|
|
80
73
|
"sinon": "^9.0.2",
|
|
81
74
|
"sinon-chai": "^3.2.0",
|
|
82
75
|
"ts-node": "^10.8.2",
|
|
83
76
|
"typemoq": "^2.1.0",
|
|
84
|
-
"typescript": "~4.4.0"
|
|
85
|
-
"xmlhttprequest": "^1.8.0"
|
|
77
|
+
"typescript": "~4.4.0"
|
|
86
78
|
},
|
|
87
79
|
"//dependencies": [
|
|
88
80
|
"NOTE: these dependencies should be only for things that DO NOT APPEAR IN THE API",
|
|
@@ -91,8 +83,8 @@
|
|
|
91
83
|
"dependencies": {
|
|
92
84
|
"@bentley/icons-generic-webfont": "^1.0.15",
|
|
93
85
|
"@itwin/itwinui-css": "0.x",
|
|
94
|
-
"@itwin/itwinui-react": "
|
|
95
|
-
"classnames": "
|
|
86
|
+
"@itwin/itwinui-react": "~1.42.0",
|
|
87
|
+
"classnames": "2.3.1",
|
|
96
88
|
"dompurify": "^2.0.12",
|
|
97
89
|
"lodash": "^4.17.10",
|
|
98
90
|
"react-autosuggest": "^10.1.0",
|