@patternfly/react-core 4.169.0 → 4.169.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/esm/helpers/index.d.ts +1 -0
- package/dist/esm/helpers/index.d.ts.map +1 -1
- package/dist/esm/helpers/index.js +1 -0
- package/dist/esm/helpers/index.js.map +1 -1
- package/dist/esm/helpers/resizeObserver.d.ts +2 -3
- package/dist/esm/helpers/resizeObserver.d.ts.map +1 -1
- package/dist/esm/helpers/resizeObserver.js +5 -5
- package/dist/esm/helpers/resizeObserver.js.map +1 -1
- package/dist/js/helpers/index.d.ts +1 -0
- package/dist/js/helpers/index.d.ts.map +1 -1
- package/dist/js/helpers/index.js +1 -0
- package/dist/js/helpers/index.js.map +1 -1
- package/dist/js/helpers/resizeObserver.d.ts +2 -3
- package/dist/js/helpers/resizeObserver.d.ts.map +1 -1
- package/dist/js/helpers/resizeObserver.js +5 -5
- package/dist/js/helpers/resizeObserver.js.map +1 -1
- package/dist/umd/react-core.js +89 -88
- package/dist/umd/react-core.min.js +3 -3
- package/package.json +5 -5
- package/src/helpers/index.ts +1 -0
- package/src/helpers/resizeObserver.tsx +5 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 4.169.1 (2021-11-08)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **acccessconsoles:** use object type Select options values in order to not mix displayed text with option keys ([#6496](https://github.com/patternfly/patternfly-react/issues/6496)) ([975c8e1](https://github.com/patternfly/patternfly-react/commit/975c8e14d7ea8c53eb4048ea6ef73e804b3ad2be))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# 4.169.0 (2021-11-04)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
/**
|
|
3
2
|
* This function creates a ResizeObserver used to handle resize events for the given containerRef. If ResizeObserver
|
|
4
3
|
* or the given containerRef are not available, a window resize event listener is used by default.
|
|
@@ -55,9 +54,9 @@ import * as React from 'react';
|
|
|
55
54
|
* );
|
|
56
55
|
* }
|
|
57
56
|
*
|
|
58
|
-
* @param {
|
|
57
|
+
* @param {Element} containerRefElement The container reference to observe
|
|
59
58
|
* @param {Function} handleResize The function to call for resize events
|
|
60
59
|
* @return {Function} The function used to unobserve resize events
|
|
61
60
|
*/
|
|
62
|
-
export declare const getResizeObserver: (
|
|
61
|
+
export declare const getResizeObserver: (containerRefElement: Element, handleResize: () => void) => () => void;
|
|
63
62
|
//# sourceMappingURL=resizeObserver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resizeObserver.d.ts","sourceRoot":"","sources":["../../../src/helpers/resizeObserver.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resizeObserver.d.ts","sourceRoot":"","sources":["../../../src/helpers/resizeObserver.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,eAAO,MAAM,iBAAiB,wBAAyB,OAAO,gBAAgB,MAAM,IAAI,eA2BvF,CAAC"}
|
|
@@ -55,15 +55,15 @@ import { canUseDOM } from './util';
|
|
|
55
55
|
* );
|
|
56
56
|
* }
|
|
57
57
|
*
|
|
58
|
-
* @param {
|
|
58
|
+
* @param {Element} containerRefElement The container reference to observe
|
|
59
59
|
* @param {Function} handleResize The function to call for resize events
|
|
60
60
|
* @return {Function} The function used to unobserve resize events
|
|
61
61
|
*/
|
|
62
|
-
export const getResizeObserver = (
|
|
62
|
+
export const getResizeObserver = (containerRefElement, handleResize) => {
|
|
63
63
|
let unobserve;
|
|
64
64
|
if (canUseDOM) {
|
|
65
65
|
const { ResizeObserver } = window;
|
|
66
|
-
if (
|
|
66
|
+
if (containerRefElement && ResizeObserver) {
|
|
67
67
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
68
68
|
// Wrap resize function in requestAnimationFrame to avoid "ResizeObserver loop limit exceeded" errors
|
|
69
69
|
window.requestAnimationFrame(() => {
|
|
@@ -72,8 +72,8 @@ export const getResizeObserver = (containerRef, handleResize) => {
|
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
74
|
});
|
|
75
|
-
resizeObserver.observe(
|
|
76
|
-
unobserve = () => resizeObserver.unobserve(
|
|
75
|
+
resizeObserver.observe(containerRefElement);
|
|
76
|
+
unobserve = () => resizeObserver.unobserve(containerRefElement);
|
|
77
77
|
}
|
|
78
78
|
else {
|
|
79
79
|
window.addEventListener('resize', handleResize);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resizeObserver.js","sourceRoot":"","sources":["../../../src/helpers/resizeObserver.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resizeObserver.js","sourceRoot":"","sources":["../../../src/helpers/resizeObserver.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,mBAA4B,EAAE,YAAwB,EAAE,EAAE;IAC1F,IAAI,SAAc,CAAC;IAEnB,IAAI,SAAS,EAAE;QACb,MAAM,EAAE,cAAc,EAAE,GAAG,MAAa,CAAC;QAEzC,IAAI,mBAAmB,IAAI,cAAc,EAAE;YACzC,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,mBAAmB,CAAC,CAAC;YAC5C,SAAS,GAAG,GAAG,EAAE,CAAC,cAAc,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;SACjE;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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
|
package/dist/js/helpers/index.js
CHANGED
|
@@ -11,4 +11,5 @@ tslib_1.__exportStar(require("./util"), exports);
|
|
|
11
11
|
tslib_1.__exportStar(require("./Popper/Popper"), exports);
|
|
12
12
|
tslib_1.__exportStar(require("./useIsomorphicLayout"), exports);
|
|
13
13
|
tslib_1.__exportStar(require("./KeyboardHandler"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./resizeObserver"), exports);
|
|
14
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAC5B,gEAAsC;AACtC,kEAAwC;AACxC,0DAAgC;AAChC,sDAA4B;AAC5B,sDAA4B;AAC5B,iDAAuB;AACvB,0DAAgC;AAChC,gEAAsC;AACtC,4DAAkC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAC5B,gEAAsC;AACtC,kEAAwC;AACxC,0DAAgC;AAChC,sDAA4B;AAC5B,sDAA4B;AAC5B,iDAAuB;AACvB,0DAAgC;AAChC,gEAAsC;AACtC,4DAAkC;AAClC,2DAAiC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
/**
|
|
3
2
|
* This function creates a ResizeObserver used to handle resize events for the given containerRef. If ResizeObserver
|
|
4
3
|
* or the given containerRef are not available, a window resize event listener is used by default.
|
|
@@ -55,9 +54,9 @@ import * as React from 'react';
|
|
|
55
54
|
* );
|
|
56
55
|
* }
|
|
57
56
|
*
|
|
58
|
-
* @param {
|
|
57
|
+
* @param {Element} containerRefElement The container reference to observe
|
|
59
58
|
* @param {Function} handleResize The function to call for resize events
|
|
60
59
|
* @return {Function} The function used to unobserve resize events
|
|
61
60
|
*/
|
|
62
|
-
export declare const getResizeObserver: (
|
|
61
|
+
export declare const getResizeObserver: (containerRefElement: Element, handleResize: () => void) => () => void;
|
|
63
62
|
//# sourceMappingURL=resizeObserver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resizeObserver.d.ts","sourceRoot":"","sources":["../../../src/helpers/resizeObserver.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resizeObserver.d.ts","sourceRoot":"","sources":["../../../src/helpers/resizeObserver.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,eAAO,MAAM,iBAAiB,wBAAyB,OAAO,gBAAgB,MAAM,IAAI,eA2BvF,CAAC"}
|
|
@@ -58,15 +58,15 @@ const util_1 = require("./util");
|
|
|
58
58
|
* );
|
|
59
59
|
* }
|
|
60
60
|
*
|
|
61
|
-
* @param {
|
|
61
|
+
* @param {Element} containerRefElement The container reference to observe
|
|
62
62
|
* @param {Function} handleResize The function to call for resize events
|
|
63
63
|
* @return {Function} The function used to unobserve resize events
|
|
64
64
|
*/
|
|
65
|
-
const getResizeObserver = (
|
|
65
|
+
const getResizeObserver = (containerRefElement, handleResize) => {
|
|
66
66
|
let unobserve;
|
|
67
67
|
if (util_1.canUseDOM) {
|
|
68
68
|
const { ResizeObserver } = window;
|
|
69
|
-
if (
|
|
69
|
+
if (containerRefElement && ResizeObserver) {
|
|
70
70
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
71
71
|
// Wrap resize function in requestAnimationFrame to avoid "ResizeObserver loop limit exceeded" errors
|
|
72
72
|
window.requestAnimationFrame(() => {
|
|
@@ -75,8 +75,8 @@ const getResizeObserver = (containerRef, handleResize) => {
|
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
|
-
resizeObserver.observe(
|
|
79
|
-
unobserve = () => resizeObserver.unobserve(
|
|
78
|
+
resizeObserver.observe(containerRefElement);
|
|
79
|
+
unobserve = () => resizeObserver.unobserve(containerRefElement);
|
|
80
80
|
}
|
|
81
81
|
else {
|
|
82
82
|
window.addEventListener('resize', handleResize);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resizeObserver.js","sourceRoot":"","sources":["../../../src/helpers/resizeObserver.tsx"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"resizeObserver.js","sourceRoot":"","sources":["../../../src/helpers/resizeObserver.tsx"],"names":[],"mappings":";;;AAAA,iCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACI,MAAM,iBAAiB,GAAG,CAAC,mBAA4B,EAAE,YAAwB,EAAE,EAAE;IAC1F,IAAI,SAAc,CAAC;IAEnB,IAAI,gBAAS,EAAE;QACb,MAAM,EAAE,cAAc,EAAE,GAAG,MAAa,CAAC;QAEzC,IAAI,mBAAmB,IAAI,cAAc,EAAE;YACzC,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,mBAAmB,CAAC,CAAC;YAC5C,SAAS,GAAG,GAAG,EAAE,CAAC,cAAc,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;SACjE;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
|
@@ -3308,6 +3308,94 @@
|
|
|
3308
3308
|
noSpaceHandling: false
|
|
3309
3309
|
};
|
|
3310
3310
|
|
|
3311
|
+
/**
|
|
3312
|
+
* This function creates a ResizeObserver used to handle resize events for the given containerRef. If ResizeObserver
|
|
3313
|
+
* or the given containerRef are not available, a window resize event listener is used by default.
|
|
3314
|
+
*
|
|
3315
|
+
* Example 1:
|
|
3316
|
+
*
|
|
3317
|
+
* private containerRef = React.createRef<HTMLDivElement>();
|
|
3318
|
+
* private observer: any = () => {};
|
|
3319
|
+
*
|
|
3320
|
+
* public componentDidMount() {
|
|
3321
|
+
* this.observer = getResizeObserver(this.containerRef.current, this.handleResize);
|
|
3322
|
+
* }
|
|
3323
|
+
*
|
|
3324
|
+
* public componentWillUnmount() {
|
|
3325
|
+
* this.observer();
|
|
3326
|
+
* }
|
|
3327
|
+
*
|
|
3328
|
+
* private handleResize = () => {
|
|
3329
|
+
* if (this.containerRef.current && this.containerRef.current.clientWidth) {
|
|
3330
|
+
* this.setState({ width: this.containerRef.current.clientWidth });
|
|
3331
|
+
* }
|
|
3332
|
+
* };
|
|
3333
|
+
*
|
|
3334
|
+
* public render() {
|
|
3335
|
+
* return (
|
|
3336
|
+
* <div ref={this.containerRef} >
|
|
3337
|
+
* <Chart width={this.state.width} ... />
|
|
3338
|
+
* </div>
|
|
3339
|
+
* );
|
|
3340
|
+
* }
|
|
3341
|
+
*
|
|
3342
|
+
* Example 2:
|
|
3343
|
+
*
|
|
3344
|
+
* private inputRef = React.createRef<HTMLInputElement>();
|
|
3345
|
+
* private observer: any = () => {};
|
|
3346
|
+
*
|
|
3347
|
+
* public componentDidMount() {
|
|
3348
|
+
* this.observer = getResizeObserver(this.inputRef.current, this.handleResize);
|
|
3349
|
+
* }
|
|
3350
|
+
*
|
|
3351
|
+
* public componentWillUnmount() {
|
|
3352
|
+
* this.observer();
|
|
3353
|
+
* }
|
|
3354
|
+
*
|
|
3355
|
+
* private handleResize = () => {
|
|
3356
|
+
* if (this.inputRef.current) {
|
|
3357
|
+
* trimLeft(inputRef.current, String(this.props.value));
|
|
3358
|
+
* }
|
|
3359
|
+
* };
|
|
3360
|
+
*
|
|
3361
|
+
* public render() {
|
|
3362
|
+
* return (
|
|
3363
|
+
* <input ref={this.inputRef} ... />
|
|
3364
|
+
* );
|
|
3365
|
+
* }
|
|
3366
|
+
*
|
|
3367
|
+
* @param {Element} containerRefElement The container reference to observe
|
|
3368
|
+
* @param {Function} handleResize The function to call for resize events
|
|
3369
|
+
* @return {Function} The function used to unobserve resize events
|
|
3370
|
+
*/
|
|
3371
|
+
const getResizeObserver = (containerRefElement, handleResize) => {
|
|
3372
|
+
let unobserve;
|
|
3373
|
+
if (canUseDOM) {
|
|
3374
|
+
const { ResizeObserver } = window;
|
|
3375
|
+
if (containerRefElement && ResizeObserver) {
|
|
3376
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
3377
|
+
// Wrap resize function in requestAnimationFrame to avoid "ResizeObserver loop limit exceeded" errors
|
|
3378
|
+
window.requestAnimationFrame(() => {
|
|
3379
|
+
if (Array.isArray(entries) && entries.length > 0) {
|
|
3380
|
+
handleResize();
|
|
3381
|
+
}
|
|
3382
|
+
});
|
|
3383
|
+
});
|
|
3384
|
+
resizeObserver.observe(containerRefElement);
|
|
3385
|
+
unobserve = () => resizeObserver.unobserve(containerRefElement);
|
|
3386
|
+
}
|
|
3387
|
+
else {
|
|
3388
|
+
window.addEventListener('resize', handleResize);
|
|
3389
|
+
unobserve = () => window.removeEventListener('resize', handleResize);
|
|
3390
|
+
}
|
|
3391
|
+
}
|
|
3392
|
+
return () => {
|
|
3393
|
+
if (unobserve) {
|
|
3394
|
+
unobserve();
|
|
3395
|
+
}
|
|
3396
|
+
};
|
|
3397
|
+
};
|
|
3398
|
+
|
|
3311
3399
|
var _default$1n = {
|
|
3312
3400
|
"bullseye": "pf-l-bullseye"
|
|
3313
3401
|
};
|
|
@@ -5604,94 +5692,6 @@
|
|
|
5604
5692
|
};
|
|
5605
5693
|
BreadcrumbHeading.displayName = 'BreadcrumbHeading';
|
|
5606
5694
|
|
|
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
|
-
|
|
5695
5695
|
exports.TextInputTypes = void 0;
|
|
5696
5696
|
(function (TextInputTypes) {
|
|
5697
5697
|
TextInputTypes["text"] = "text";
|
|
@@ -20750,6 +20750,7 @@
|
|
|
20750
20750
|
exports.getNextIndex = getNextIndex;
|
|
20751
20751
|
exports.getOUIAProps = getOUIAProps;
|
|
20752
20752
|
exports.getOpacityTransition = getOpacityTransition;
|
|
20753
|
+
exports.getResizeObserver = getResizeObserver;
|
|
20753
20754
|
exports.getTextWidth = getTextWidth;
|
|
20754
20755
|
exports.getUniqueId = getUniqueId;
|
|
20755
20756
|
exports.globalBreakpoints = globalBreakpoints;
|