@patternfly/react-core 4.168.8 → 4.169.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 +41 -0
- package/dist/esm/components/AboutModal/AboutModal.d.ts +2 -0
- package/dist/esm/components/AboutModal/AboutModal.d.ts.map +1 -1
- package/dist/esm/components/AboutModal/AboutModal.js.map +1 -1
- package/dist/esm/components/AboutModal/AboutModalContainer.d.ts +2 -0
- package/dist/esm/components/AboutModal/AboutModalContainer.d.ts.map +1 -1
- package/dist/esm/components/AboutModal/AboutModalContainer.js +2 -2
- package/dist/esm/components/AboutModal/AboutModalContainer.js.map +1 -1
- package/dist/esm/components/Banner/Banner.d.ts +1 -1
- package/dist/esm/components/Banner/Banner.d.ts.map +1 -1
- package/dist/esm/components/Banner/Banner.js +5 -1
- package/dist/esm/components/Banner/Banner.js.map +1 -1
- package/dist/esm/components/Dropdown/DropdownGroup.d.ts.map +1 -1
- package/dist/esm/components/Dropdown/DropdownGroup.js +10 -6
- package/dist/esm/components/Dropdown/DropdownGroup.js.map +1 -1
- package/dist/esm/components/TextInput/TextInput.d.ts +1 -0
- package/dist/esm/components/TextInput/TextInput.d.ts.map +1 -1
- package/dist/esm/components/TextInput/TextInput.js +6 -7
- package/dist/esm/components/TextInput/TextInput.js.map +1 -1
- package/dist/esm/helpers/resizeObserver.d.ts +63 -0
- package/dist/esm/helpers/resizeObserver.d.ts.map +1 -0
- package/dist/esm/helpers/resizeObserver.js +89 -0
- package/dist/esm/helpers/resizeObserver.js.map +1 -0
- package/dist/js/components/AboutModal/AboutModal.d.ts +2 -0
- package/dist/js/components/AboutModal/AboutModal.d.ts.map +1 -1
- package/dist/js/components/AboutModal/AboutModal.js.map +1 -1
- package/dist/js/components/AboutModal/AboutModalContainer.d.ts +2 -0
- package/dist/js/components/AboutModal/AboutModalContainer.d.ts.map +1 -1
- package/dist/js/components/AboutModal/AboutModalContainer.js +2 -2
- package/dist/js/components/AboutModal/AboutModalContainer.js.map +1 -1
- package/dist/js/components/Banner/Banner.d.ts +1 -1
- package/dist/js/components/Banner/Banner.d.ts.map +1 -1
- package/dist/js/components/Banner/Banner.js +4 -1
- package/dist/js/components/Banner/Banner.js.map +1 -1
- package/dist/js/components/Dropdown/DropdownGroup.d.ts.map +1 -1
- package/dist/js/components/Dropdown/DropdownGroup.js +9 -6
- package/dist/js/components/Dropdown/DropdownGroup.js.map +1 -1
- package/dist/js/components/TextInput/TextInput.d.ts +1 -0
- package/dist/js/components/TextInput/TextInput.d.ts.map +1 -1
- package/dist/js/components/TextInput/TextInput.js +5 -6
- package/dist/js/components/TextInput/TextInput.js.map +1 -1
- package/dist/js/helpers/resizeObserver.d.ts +63 -0
- package/dist/js/helpers/resizeObserver.d.ts.map +1 -0
- package/dist/js/helpers/resizeObserver.js +93 -0
- package/dist/js/helpers/resizeObserver.js.map +1 -0
- package/dist/umd/react-core.js +107 -15
- package/dist/umd/react-core.min.js +3 -3
- package/package.json +5 -5
- package/src/components/AboutModal/AboutModal.tsx +2 -0
- package/src/components/AboutModal/AboutModalContainer.tsx +8 -1
- package/src/components/Banner/Banner.tsx +4 -2
- package/src/components/Banner/__tests__/__snapshots__/Banner.test.tsx.snap +6 -0
- package/src/components/Dropdown/DropdownGroup.tsx +3 -2
- package/src/components/TextInput/TextInput.tsx +6 -7
- package/src/helpers/resizeObserver.tsx +91 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownGroup.js","sourceRoot":"","sources":["../../../../src/components/Dropdown/DropdownGroup.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAC/B,2DAA+C;AAC/C,2DAAsD;AAW/C,MAAM,aAAa,GAAgD,CAAC,EACzE,QAAQ,GAAG,IAAI,EACf,SAAS,GAAG,EAAE,EACd,KAAK,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"DropdownGroup.js","sourceRoot":"","sources":["../../../../src/components/Dropdown/DropdownGroup.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAC/B,2DAA+C;AAC/C,2DAAsD;AAW/C,MAAM,aAAa,GAAgD,CAAC,EAKtD,EAAE,EAAE;QALkD,EACzE,QAAQ,GAAG,IAAI,EACf,SAAS,GAAG,EAAE,EACd,KAAK,GAAG,EAAE,OAES,EADhB,KAAK,sBAJiE,kCAK1E,CADS;IACgB,OAAA,CACxB,oBAAC,mCAAe,CAAC,QAAQ,QACtB,CAAC,EAAE,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,EAAE,EAAE;QACzD,MAAM,gBAAgB,GAAG,gBAAuB,CAAC;QACjD,OAAO,CACL,oBAAC,gBAAgB,kBAAC,SAAS,EAAE,kBAAG,CAAC,YAAY,EAAE,SAAS,CAAC,IAAM,KAAK;YACjE,KAAK,IAAI,CACR,4BAAI,SAAS,EAAE,kBAAG,CAAC,iBAAiB,CAAC,yBAClC,KAAK,CACH,CACN;YACD,4BAAI,IAAI,EAAC,MAAM,IAAE,QAAQ,CAAM,CACd,CACpB,CAAC;IACJ,CAAC,CACwB,CAC5B,CAAA;CAAA,CAAC;AArBW,QAAA,aAAa,iBAqBxB;AACF,qBAAa,CAAC,WAAW,GAAG,eAAe,CAAC"}
|
|
@@ -57,6 +57,7 @@ export declare class TextInputBase extends React.Component<TextInputProps, TextI
|
|
|
57
57
|
static displayName: string;
|
|
58
58
|
static defaultProps: TextInputProps;
|
|
59
59
|
inputRef: React.RefObject<HTMLInputElement>;
|
|
60
|
+
observer: any;
|
|
60
61
|
constructor(props: TextInputProps);
|
|
61
62
|
handleChange: (event: React.FormEvent<HTMLInputElement>) => void;
|
|
62
63
|
componentDidMount(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../../../src/components/TextInput/TextInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAkC,SAAS,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../../../src/components/TextInput/TextInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAkC,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1E,oBAAY,cAAc;IACxB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,aAAa,mBAAmB;IAChC,KAAK,UAAU;IACf,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,GAAG,QAAQ;CACZ;AAED,MAAM,WAAW,cACf,SAAQ,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAAE,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,KAAK,CAAC,EACrG,SAAS;IACX,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,8CAA8C;IAC9C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACxD,mDAAmD;IACnD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC7E,mCAAmC;IACnC,IAAI,CAAC,EACD,MAAM,GACN,MAAM,GACN,gBAAgB,GAChB,OAAO,GACP,OAAO,GACP,QAAQ,GACR,UAAU,GACV,QAAQ,GACR,KAAK,GACL,MAAM,GACN,KAAK,CAAC;IACV,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAChC,wBAAwB;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,8CAA8C;IAC9C,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAChC,6DAA6D;IAC7D,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAC/B,mBAAmB;IACnB,WAAW,CAAC,EAAE,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC9C,6DAA6D;IAC7D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wEAAwE;IACxE,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,UAAU,cAAc;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,aAAc,SAAQ,KAAK,CAAC,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC;IAChF,MAAM,CAAC,WAAW,SAAmB;IACrC,MAAM,CAAC,YAAY,EAAE,cAAc,CAWjC;IACF,QAAQ,oCAAuC;IAC/C,QAAQ,EAAE,GAAG,CAAY;gBAEb,KAAK,EAAE,cAAc;IAWjC,YAAY,UAAW,MAAM,SAAS,CAAC,gBAAgB,CAAC,UAItD;IAEF,iBAAiB;IAQjB,oBAAoB;IAMpB,YAAY,aAKV;IAEF,WAAW,aAMT;IAEF,OAAO,WAAY,GAAG,UAMpB;IAEF,MAAM,WAAY,GAAG,UAMnB;IAEF,MAAM;CA0DP;AAED,eAAO,MAAM,SAAS,yFAEpB,CAAC"}
|
|
@@ -8,6 +8,7 @@ const react_styles_1 = require("@patternfly/react-styles");
|
|
|
8
8
|
const constants_1 = require("../../helpers/constants");
|
|
9
9
|
const util_1 = require("../../helpers/util");
|
|
10
10
|
const helpers_1 = require("../../helpers");
|
|
11
|
+
const resizeObserver_1 = require("../../helpers/resizeObserver");
|
|
11
12
|
var TextInputTypes;
|
|
12
13
|
(function (TextInputTypes) {
|
|
13
14
|
TextInputTypes["text"] = "text";
|
|
@@ -26,6 +27,7 @@ class TextInputBase extends React.Component {
|
|
|
26
27
|
constructor(props) {
|
|
27
28
|
super(props);
|
|
28
29
|
this.inputRef = React.createRef();
|
|
30
|
+
this.observer = () => { };
|
|
29
31
|
this.handleChange = (event) => {
|
|
30
32
|
if (this.props.onChange) {
|
|
31
33
|
this.props.onChange(event.currentTarget.value, event);
|
|
@@ -68,17 +70,14 @@ class TextInputBase extends React.Component {
|
|
|
68
70
|
}
|
|
69
71
|
componentDidMount() {
|
|
70
72
|
if (this.props.isLeftTruncated) {
|
|
73
|
+
const inputRef = this.props.innerRef || this.inputRef;
|
|
74
|
+
this.observer = resizeObserver_1.getResizeObserver(inputRef.current, this.handleResize);
|
|
71
75
|
this.handleResize();
|
|
72
|
-
if (util_1.canUseDOM) {
|
|
73
|
-
window.addEventListener('resize', util_1.debounce(this.handleResize, 250));
|
|
74
|
-
}
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
componentWillUnmount() {
|
|
78
79
|
if (this.props.isLeftTruncated) {
|
|
79
|
-
|
|
80
|
-
window.removeEventListener('resize', util_1.debounce(this.handleResize, 250));
|
|
81
|
-
}
|
|
80
|
+
this.observer();
|
|
82
81
|
}
|
|
83
82
|
}
|
|
84
83
|
render() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.js","sourceRoot":"","sources":["../../../../src/components/TextInput/TextInput.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAC/B,4HAAsF;AACtF,2DAA+C;AAC/C,uDAA2D;AAC3D,
|
|
1
|
+
{"version":3,"file":"TextInput.js","sourceRoot":"","sources":["../../../../src/components/TextInput/TextInput.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAC/B,4HAAsF;AACtF,2DAA+C;AAC/C,uDA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creates a ResizeObserver used to handle resize events for the given containerRef. If ResizeObserver
|
|
4
|
+
* or the given containerRef are not available, a window resize event listener is used by default.
|
|
5
|
+
*
|
|
6
|
+
* Example 1:
|
|
7
|
+
*
|
|
8
|
+
* private containerRef = React.createRef<HTMLDivElement>();
|
|
9
|
+
* private observer: any = () => {};
|
|
10
|
+
*
|
|
11
|
+
* public componentDidMount() {
|
|
12
|
+
* this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
|
|
13
|
+
* }
|
|
14
|
+
*
|
|
15
|
+
* public componentWillUnmount() {
|
|
16
|
+
* this.observer();
|
|
17
|
+
* }
|
|
18
|
+
*
|
|
19
|
+
* private handleResize = () => {
|
|
20
|
+
* if (this.containerRef.current && this.containerRef.current.clientWidth) {
|
|
21
|
+
* this.setState({ width: this.containerRef.current.clientWidth });
|
|
22
|
+
* }
|
|
23
|
+
* };
|
|
24
|
+
*
|
|
25
|
+
* public render() {
|
|
26
|
+
* return (
|
|
27
|
+
* <div ref={this.containerRef} >
|
|
28
|
+
* <Chart width={this.state.width} ... />
|
|
29
|
+
* </div>
|
|
30
|
+
* );
|
|
31
|
+
* }
|
|
32
|
+
*
|
|
33
|
+
* Example 2:
|
|
34
|
+
*
|
|
35
|
+
* private inputRef = React.createRef<HTMLInputElement>();
|
|
36
|
+
* private observer: any = () => {};
|
|
37
|
+
*
|
|
38
|
+
* public componentDidMount() {
|
|
39
|
+
* this.observer = getResizeObserver(this.inputRef.current, this.handleResize);
|
|
40
|
+
* }
|
|
41
|
+
*
|
|
42
|
+
* public componentWillUnmount() {
|
|
43
|
+
* this.observer();
|
|
44
|
+
* }
|
|
45
|
+
*
|
|
46
|
+
* private handleResize = () => {
|
|
47
|
+
* if (this.inputRef.current) {
|
|
48
|
+
* trimLeft(inputRef.current, String(this.props.value));
|
|
49
|
+
* }
|
|
50
|
+
* };
|
|
51
|
+
*
|
|
52
|
+
* public render() {
|
|
53
|
+
* return (
|
|
54
|
+
* <input ref={this.inputRef} ... />
|
|
55
|
+
* );
|
|
56
|
+
* }
|
|
57
|
+
*
|
|
58
|
+
* @param {React.RefObject} containerRef The container reference to observe
|
|
59
|
+
* @param {Function} handleResize The function to call for resize events
|
|
60
|
+
* @return {Function} The function used to unobserve resize events
|
|
61
|
+
*/
|
|
62
|
+
export declare const getResizeObserver: (containerRef: React.RefObject<any>, handleResize: () => void) => () => void;
|
|
63
|
+
//# sourceMappingURL=resizeObserver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resizeObserver.d.ts","sourceRoot":"","sources":["../../../src/helpers/resizeObserver.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,eAAO,MAAM,iBAAiB,iBAAkB,MAAM,SAAS,CAAC,GAAG,CAAC,gBAAgB,MAAM,IAAI,eA2B7F,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getResizeObserver = void 0;
|
|
4
|
+
const util_1 = require("./util");
|
|
5
|
+
/**
|
|
6
|
+
* This function creates a ResizeObserver used to handle resize events for the given containerRef. If ResizeObserver
|
|
7
|
+
* or the given containerRef are not available, a window resize event listener is used by default.
|
|
8
|
+
*
|
|
9
|
+
* Example 1:
|
|
10
|
+
*
|
|
11
|
+
* private containerRef = React.createRef<HTMLDivElement>();
|
|
12
|
+
* private observer: any = () => {};
|
|
13
|
+
*
|
|
14
|
+
* public componentDidMount() {
|
|
15
|
+
* this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
|
|
16
|
+
* }
|
|
17
|
+
*
|
|
18
|
+
* public componentWillUnmount() {
|
|
19
|
+
* this.observer();
|
|
20
|
+
* }
|
|
21
|
+
*
|
|
22
|
+
* private handleResize = () => {
|
|
23
|
+
* if (this.containerRef.current && this.containerRef.current.clientWidth) {
|
|
24
|
+
* this.setState({ width: this.containerRef.current.clientWidth });
|
|
25
|
+
* }
|
|
26
|
+
* };
|
|
27
|
+
*
|
|
28
|
+
* public render() {
|
|
29
|
+
* return (
|
|
30
|
+
* <div ref={this.containerRef} >
|
|
31
|
+
* <Chart width={this.state.width} ... />
|
|
32
|
+
* </div>
|
|
33
|
+
* );
|
|
34
|
+
* }
|
|
35
|
+
*
|
|
36
|
+
* Example 2:
|
|
37
|
+
*
|
|
38
|
+
* private inputRef = React.createRef<HTMLInputElement>();
|
|
39
|
+
* private observer: any = () => {};
|
|
40
|
+
*
|
|
41
|
+
* public componentDidMount() {
|
|
42
|
+
* this.observer = getResizeObserver(this.inputRef.current, this.handleResize);
|
|
43
|
+
* }
|
|
44
|
+
*
|
|
45
|
+
* public componentWillUnmount() {
|
|
46
|
+
* this.observer();
|
|
47
|
+
* }
|
|
48
|
+
*
|
|
49
|
+
* private handleResize = () => {
|
|
50
|
+
* if (this.inputRef.current) {
|
|
51
|
+
* trimLeft(inputRef.current, String(this.props.value));
|
|
52
|
+
* }
|
|
53
|
+
* };
|
|
54
|
+
*
|
|
55
|
+
* public render() {
|
|
56
|
+
* return (
|
|
57
|
+
* <input ref={this.inputRef} ... />
|
|
58
|
+
* );
|
|
59
|
+
* }
|
|
60
|
+
*
|
|
61
|
+
* @param {React.RefObject} containerRef The container reference to observe
|
|
62
|
+
* @param {Function} handleResize The function to call for resize events
|
|
63
|
+
* @return {Function} The function used to unobserve resize events
|
|
64
|
+
*/
|
|
65
|
+
const getResizeObserver = (containerRef, handleResize) => {
|
|
66
|
+
let unobserve;
|
|
67
|
+
if (util_1.canUseDOM) {
|
|
68
|
+
const { ResizeObserver } = window;
|
|
69
|
+
if (containerRef && ResizeObserver) {
|
|
70
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
71
|
+
// Wrap resize function in requestAnimationFrame to avoid "ResizeObserver loop limit exceeded" errors
|
|
72
|
+
window.requestAnimationFrame(() => {
|
|
73
|
+
if (Array.isArray(entries) && entries.length > 0) {
|
|
74
|
+
handleResize();
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
resizeObserver.observe(containerRef);
|
|
79
|
+
unobserve = () => resizeObserver.unobserve(containerRef);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
window.addEventListener('resize', handleResize);
|
|
83
|
+
unobserve = () => window.removeEventListener('resize', handleResize);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return () => {
|
|
87
|
+
if (unobserve) {
|
|
88
|
+
unobserve();
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
exports.getResizeObserver = getResizeObserver;
|
|
93
|
+
//# sourceMappingURL=resizeObserver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resizeObserver.js","sourceRoot":"","sources":["../../../src/helpers/resizeObserver.tsx"],"names":[],"mappings":";;;AACA,iCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACI,MAAM,iBAAiB,GAAG,CAAC,YAAkC,EAAE,YAAwB,EAAE,EAAE;IAChG,IAAI,SAAc,CAAC;IAEnB,IAAI,gBAAS,EAAE;QACb,MAAM,EAAE,cAAc,EAAE,GAAG,MAAa,CAAC;QAEzC,IAAI,YAAY,IAAI,cAAc,EAAE;YAClC,MAAM,cAAc,GAAG,IAAI,cAAc,CAAC,CAAC,OAAY,EAAE,EAAE;gBACzD,qGAAqG;gBACrG,MAAM,CAAC,qBAAqB,CAAC,GAAG,EAAE;oBAChC,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;wBAChD,YAAY,EAAE,CAAC;qBAChB;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YACH,cAAc,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;YACrC,SAAS,GAAG,GAAG,EAAE,CAAC,cAAc,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;SAC1D;aAAM;YACL,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;YAChD,SAAS,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;SACtE;KACF;IACD,OAAO,GAAG,EAAE;QACV,IAAI,SAAS,EAAE;YACb,SAAS,EAAE,CAAC;SACb;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AA3BW,QAAA,iBAAiB,qBA2B5B"}
|
package/dist/umd/react-core.js
CHANGED
|
@@ -3637,12 +3637,12 @@
|
|
|
3637
3637
|
Backdrop.displayName = 'Backdrop';
|
|
3638
3638
|
|
|
3639
3639
|
const AboutModalContainer = (_a) => {
|
|
3640
|
-
var { children, className = '', isOpen = false, onClose = () => undefined, productName = '', trademark, brandImageSrc, brandImageAlt, backgroundImageSrc, closeButtonAriaLabel, aboutModalBoxHeaderId, aboutModalBoxContentId } = _a, props = __rest$1(_a, ["children", "className", "isOpen", "onClose", "productName", "trademark", "brandImageSrc", "brandImageAlt", "backgroundImageSrc", "closeButtonAriaLabel", "aboutModalBoxHeaderId", "aboutModalBoxContentId"]);
|
|
3640
|
+
var { children, className = '', isOpen = false, onClose = () => undefined, productName = '', trademark, brandImageSrc, brandImageAlt, backgroundImageSrc, closeButtonAriaLabel, aboutModalBoxHeaderId, aboutModalBoxContentId, disableFocusTrap = false } = _a, props = __rest$1(_a, ["children", "className", "isOpen", "onClose", "productName", "trademark", "brandImageSrc", "brandImageAlt", "backgroundImageSrc", "closeButtonAriaLabel", "aboutModalBoxHeaderId", "aboutModalBoxContentId", "disableFocusTrap"]);
|
|
3641
3641
|
if (!isOpen) {
|
|
3642
3642
|
return null;
|
|
3643
3643
|
}
|
|
3644
3644
|
return (React__namespace.createElement(Backdrop, null,
|
|
3645
|
-
React__namespace.createElement(FocusTrap, { focusTrapOptions: { clickOutsideDeactivates: true }, className: css(_default$1n.bullseye) },
|
|
3645
|
+
React__namespace.createElement(FocusTrap, { active: !disableFocusTrap, focusTrapOptions: { clickOutsideDeactivates: true }, className: css(_default$1n.bullseye) },
|
|
3646
3646
|
React__namespace.createElement(AboutModalBox, { className: className, "aria-labelledby": aboutModalBoxHeaderId, "aria-describedby": aboutModalBoxContentId },
|
|
3647
3647
|
React__namespace.createElement(AboutModalBoxBrand, { src: brandImageSrc, alt: brandImageAlt }),
|
|
3648
3648
|
React__namespace.createElement(AboutModalBoxCloseButton, { "aria-label": closeButtonAriaLabel, onClose: onClose }),
|
|
@@ -4653,12 +4653,15 @@
|
|
|
4653
4653
|
};
|
|
4654
4654
|
Dropdown.displayName = 'Dropdown';
|
|
4655
4655
|
|
|
4656
|
-
const DropdownGroup = (
|
|
4657
|
-
|
|
4658
|
-
return (React__namespace.createElement(
|
|
4659
|
-
|
|
4660
|
-
React__namespace.createElement(
|
|
4661
|
-
|
|
4656
|
+
const DropdownGroup = (_a) => {
|
|
4657
|
+
var { children = null, className = '', label = '' } = _a, props = __rest$1(_a, ["children", "className", "label"]);
|
|
4658
|
+
return (React__namespace.createElement(DropdownContext.Consumer, null, ({ sectionClass, sectionTitleClass, sectionComponent }) => {
|
|
4659
|
+
const SectionComponent = sectionComponent;
|
|
4660
|
+
return (React__namespace.createElement(SectionComponent, Object.assign({ className: css(sectionClass, className) }, props),
|
|
4661
|
+
label && (React__namespace.createElement("h1", { className: css(sectionTitleClass), "aria-hidden": true }, label)),
|
|
4662
|
+
React__namespace.createElement("ul", { role: "none" }, children)));
|
|
4663
|
+
}));
|
|
4664
|
+
};
|
|
4662
4665
|
DropdownGroup.displayName = 'DropdownGroup';
|
|
4663
4666
|
|
|
4664
4667
|
class InternalDropdownItem extends React__namespace.Component {
|
|
@@ -5529,7 +5532,10 @@
|
|
|
5529
5532
|
}
|
|
5530
5533
|
};
|
|
5531
5534
|
|
|
5532
|
-
const Banner = (
|
|
5535
|
+
const Banner = (_a) => {
|
|
5536
|
+
var { children, className, variant = 'default', isSticky = false } = _a, props = __rest$1(_a, ["children", "className", "variant", "isSticky"]);
|
|
5537
|
+
return (React__namespace.createElement("div", Object.assign({ className: css(_default$13.banner, _default$13.modifiers[variant], isSticky && _default$13.modifiers.sticky, className) }, props), children));
|
|
5538
|
+
};
|
|
5533
5539
|
Banner.displayName = 'Banner';
|
|
5534
5540
|
|
|
5535
5541
|
const Brand = (_a) => {
|
|
@@ -5598,6 +5604,94 @@
|
|
|
5598
5604
|
};
|
|
5599
5605
|
BreadcrumbHeading.displayName = 'BreadcrumbHeading';
|
|
5600
5606
|
|
|
5607
|
+
/**
|
|
5608
|
+
* This function creates a ResizeObserver used to handle resize events for the given containerRef. If ResizeObserver
|
|
5609
|
+
* or the given containerRef are not available, a window resize event listener is used by default.
|
|
5610
|
+
*
|
|
5611
|
+
* Example 1:
|
|
5612
|
+
*
|
|
5613
|
+
* private containerRef = React.createRef<HTMLDivElement>();
|
|
5614
|
+
* private observer: any = () => {};
|
|
5615
|
+
*
|
|
5616
|
+
* public componentDidMount() {
|
|
5617
|
+
* this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
|
|
5618
|
+
* }
|
|
5619
|
+
*
|
|
5620
|
+
* public componentWillUnmount() {
|
|
5621
|
+
* this.observer();
|
|
5622
|
+
* }
|
|
5623
|
+
*
|
|
5624
|
+
* private handleResize = () => {
|
|
5625
|
+
* if (this.containerRef.current && this.containerRef.current.clientWidth) {
|
|
5626
|
+
* this.setState({ width: this.containerRef.current.clientWidth });
|
|
5627
|
+
* }
|
|
5628
|
+
* };
|
|
5629
|
+
*
|
|
5630
|
+
* public render() {
|
|
5631
|
+
* return (
|
|
5632
|
+
* <div ref={this.containerRef} >
|
|
5633
|
+
* <Chart width={this.state.width} ... />
|
|
5634
|
+
* </div>
|
|
5635
|
+
* );
|
|
5636
|
+
* }
|
|
5637
|
+
*
|
|
5638
|
+
* Example 2:
|
|
5639
|
+
*
|
|
5640
|
+
* private inputRef = React.createRef<HTMLInputElement>();
|
|
5641
|
+
* private observer: any = () => {};
|
|
5642
|
+
*
|
|
5643
|
+
* public componentDidMount() {
|
|
5644
|
+
* this.observer = getResizeObserver(this.inputRef.current, this.handleResize);
|
|
5645
|
+
* }
|
|
5646
|
+
*
|
|
5647
|
+
* public componentWillUnmount() {
|
|
5648
|
+
* this.observer();
|
|
5649
|
+
* }
|
|
5650
|
+
*
|
|
5651
|
+
* private handleResize = () => {
|
|
5652
|
+
* if (this.inputRef.current) {
|
|
5653
|
+
* trimLeft(inputRef.current, String(this.props.value));
|
|
5654
|
+
* }
|
|
5655
|
+
* };
|
|
5656
|
+
*
|
|
5657
|
+
* public render() {
|
|
5658
|
+
* return (
|
|
5659
|
+
* <input ref={this.inputRef} ... />
|
|
5660
|
+
* );
|
|
5661
|
+
* }
|
|
5662
|
+
*
|
|
5663
|
+
* @param {React.RefObject} containerRef The container reference to observe
|
|
5664
|
+
* @param {Function} handleResize The function to call for resize events
|
|
5665
|
+
* @return {Function} The function used to unobserve resize events
|
|
5666
|
+
*/
|
|
5667
|
+
const getResizeObserver = (containerRef, handleResize) => {
|
|
5668
|
+
let unobserve;
|
|
5669
|
+
if (canUseDOM) {
|
|
5670
|
+
const { ResizeObserver } = window;
|
|
5671
|
+
if (containerRef && ResizeObserver) {
|
|
5672
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
5673
|
+
// Wrap resize function in requestAnimationFrame to avoid "ResizeObserver loop limit exceeded" errors
|
|
5674
|
+
window.requestAnimationFrame(() => {
|
|
5675
|
+
if (Array.isArray(entries) && entries.length > 0) {
|
|
5676
|
+
handleResize();
|
|
5677
|
+
}
|
|
5678
|
+
});
|
|
5679
|
+
});
|
|
5680
|
+
resizeObserver.observe(containerRef);
|
|
5681
|
+
unobserve = () => resizeObserver.unobserve(containerRef);
|
|
5682
|
+
}
|
|
5683
|
+
else {
|
|
5684
|
+
window.addEventListener('resize', handleResize);
|
|
5685
|
+
unobserve = () => window.removeEventListener('resize', handleResize);
|
|
5686
|
+
}
|
|
5687
|
+
}
|
|
5688
|
+
return () => {
|
|
5689
|
+
if (unobserve) {
|
|
5690
|
+
unobserve();
|
|
5691
|
+
}
|
|
5692
|
+
};
|
|
5693
|
+
};
|
|
5694
|
+
|
|
5601
5695
|
exports.TextInputTypes = void 0;
|
|
5602
5696
|
(function (TextInputTypes) {
|
|
5603
5697
|
TextInputTypes["text"] = "text";
|
|
@@ -5616,6 +5710,7 @@
|
|
|
5616
5710
|
constructor(props) {
|
|
5617
5711
|
super(props);
|
|
5618
5712
|
this.inputRef = React__namespace.createRef();
|
|
5713
|
+
this.observer = () => { };
|
|
5619
5714
|
this.handleChange = (event) => {
|
|
5620
5715
|
if (this.props.onChange) {
|
|
5621
5716
|
this.props.onChange(event.currentTarget.value, event);
|
|
@@ -5658,17 +5753,14 @@
|
|
|
5658
5753
|
}
|
|
5659
5754
|
componentDidMount() {
|
|
5660
5755
|
if (this.props.isLeftTruncated) {
|
|
5756
|
+
const inputRef = this.props.innerRef || this.inputRef;
|
|
5757
|
+
this.observer = getResizeObserver(inputRef.current, this.handleResize);
|
|
5661
5758
|
this.handleResize();
|
|
5662
|
-
if (canUseDOM) {
|
|
5663
|
-
window.addEventListener('resize', debounce$1(this.handleResize, 250));
|
|
5664
|
-
}
|
|
5665
5759
|
}
|
|
5666
5760
|
}
|
|
5667
5761
|
componentWillUnmount() {
|
|
5668
5762
|
if (this.props.isLeftTruncated) {
|
|
5669
|
-
|
|
5670
|
-
window.removeEventListener('resize', debounce$1(this.handleResize, 250));
|
|
5671
|
-
}
|
|
5763
|
+
this.observer();
|
|
5672
5764
|
}
|
|
5673
5765
|
}
|
|
5674
5766
|
render() {
|