@instructure/ui-react-utils 8.10.1-snapshot.9 → 8.10.3-snapshot.2
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
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
## [8.10.2](https://github.com/instructure/instructure-ui/compare/v8.10.1...v8.10.2) (2021-10-01)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-react-utils
|
|
9
|
+
|
|
10
|
+
## [8.10.1](https://github.com/instructure/instructure-ui/compare/v8.10.0...v8.10.1) (2021-10-01)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @instructure/ui-react-utils
|
|
13
|
+
|
|
6
14
|
# [8.10.0](https://github.com/instructure/instructure-ui/compare/v8.9.1...v8.10.0) (2021-09-28)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @instructure/ui-react-utils
|
package/es/safeCloneElement.js
CHANGED
|
@@ -38,6 +38,7 @@ function safeCloneElement(element, props, ...children) {
|
|
|
38
38
|
const cloneRef = props.ref;
|
|
39
39
|
const originalRef = element.ref;
|
|
40
40
|
const originalRefIsAFunction = typeof originalRef === 'function';
|
|
41
|
+
const cloneRefIsFunction = typeof cloneRef === 'function';
|
|
41
42
|
const mergedProps = { ...props
|
|
42
43
|
};
|
|
43
44
|
|
|
@@ -73,8 +74,13 @@ Ignoring ref: ${originalRef}`);
|
|
|
73
74
|
return /*#__PURE__*/React.cloneElement(element, { ...mergedProps,
|
|
74
75
|
|
|
75
76
|
ref(component) {
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
if (cloneRefIsFunction) {
|
|
78
|
+
;
|
|
79
|
+
cloneRef(component);
|
|
80
|
+
} else {
|
|
81
|
+
cloneRef.current = component;
|
|
82
|
+
}
|
|
83
|
+
|
|
78
84
|
originalRef(component);
|
|
79
85
|
}
|
|
80
86
|
|
package/lib/safeCloneElement.js
CHANGED
|
@@ -51,6 +51,7 @@ function safeCloneElement(element, props, ...children) {
|
|
|
51
51
|
const cloneRef = props.ref;
|
|
52
52
|
const originalRef = element.ref;
|
|
53
53
|
const originalRefIsAFunction = typeof originalRef === 'function';
|
|
54
|
+
const cloneRefIsFunction = typeof cloneRef === 'function';
|
|
54
55
|
const mergedProps = { ...props
|
|
55
56
|
};
|
|
56
57
|
|
|
@@ -86,8 +87,13 @@ Ignoring ref: ${originalRef}`);
|
|
|
86
87
|
return /*#__PURE__*/_react.default.cloneElement(element, { ...mergedProps,
|
|
87
88
|
|
|
88
89
|
ref(component) {
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
if (cloneRefIsFunction) {
|
|
91
|
+
;
|
|
92
|
+
cloneRef(component);
|
|
93
|
+
} else {
|
|
94
|
+
cloneRef.current = component;
|
|
95
|
+
}
|
|
96
|
+
|
|
91
97
|
originalRef(component);
|
|
92
98
|
}
|
|
93
99
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-react-utils",
|
|
3
|
-
"version": "8.10.
|
|
3
|
+
"version": "8.10.3-snapshot.2+ccdf8f43b",
|
|
4
4
|
"description": "A React utility library made by Instructure Inc.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -23,17 +23,17 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "8.10.
|
|
27
|
-
"@instructure/ui-test-utils": "8.10.
|
|
26
|
+
"@instructure/ui-babel-preset": "8.10.3-snapshot.2+ccdf8f43b",
|
|
27
|
+
"@instructure/ui-test-utils": "8.10.3-snapshot.2+ccdf8f43b"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@babel/runtime": "^7.13.10",
|
|
31
31
|
"@emotion/is-prop-valid": "^1",
|
|
32
|
-
"@instructure/console": "8.10.
|
|
33
|
-
"@instructure/shared-types": "8.10.
|
|
34
|
-
"@instructure/ui-decorator": "8.10.
|
|
35
|
-
"@instructure/ui-dom-utils": "8.10.
|
|
36
|
-
"@instructure/ui-utils": "8.10.
|
|
32
|
+
"@instructure/console": "8.10.3-snapshot.2+ccdf8f43b",
|
|
33
|
+
"@instructure/shared-types": "8.10.3-snapshot.2+ccdf8f43b",
|
|
34
|
+
"@instructure/ui-decorator": "8.10.3-snapshot.2+ccdf8f43b",
|
|
35
|
+
"@instructure/ui-dom-utils": "8.10.3-snapshot.2+ccdf8f43b",
|
|
36
|
+
"@instructure/ui-utils": "8.10.3-snapshot.2+ccdf8f43b",
|
|
37
37
|
"prop-types": "^15"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
46
|
"sideEffects": false,
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "ccdf8f43b56a8edef32600281692dfeb436d5a01"
|
|
48
48
|
}
|
package/src/safeCloneElement.ts
CHANGED
|
@@ -46,6 +46,7 @@ function safeCloneElement<
|
|
|
46
46
|
const cloneRef = props.ref
|
|
47
47
|
const originalRef = element.ref
|
|
48
48
|
const originalRefIsAFunction = typeof originalRef === 'function'
|
|
49
|
+
const cloneRefIsFunction = typeof cloneRef === 'function'
|
|
49
50
|
|
|
50
51
|
const mergedProps = { ...props }
|
|
51
52
|
|
|
@@ -92,7 +93,12 @@ Ignoring ref: ${originalRef}`
|
|
|
92
93
|
{
|
|
93
94
|
...mergedProps,
|
|
94
95
|
ref(component: any) {
|
|
95
|
-
|
|
96
|
+
if (cloneRefIsFunction) {
|
|
97
|
+
;(cloneRef as (instance: any) => void)(component)
|
|
98
|
+
} else {
|
|
99
|
+
//@ts-expect-error needed for backwards compat
|
|
100
|
+
cloneRef.current = component
|
|
101
|
+
}
|
|
96
102
|
originalRef(component)
|
|
97
103
|
}
|
|
98
104
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safeCloneElement.d.ts","sourceRoot":"","sources":["../src/safeCloneElement.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,EAAE,eAAe,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKvE;;;;;;;;GAQG;AACH,iBAAS,gBAAgB,CACvB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IAAE,KAAK,CAAC,EAAE,GAAG,CAAA;CAAE,GAAG,eAAe,CAAC,CAAC,CAAC,EAEpE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,GAAG,CAAA;CAAE,EACxC,KAAK,EAAE,CAAC,EACR,GAAG,QAAQ,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"safeCloneElement.d.ts","sourceRoot":"","sources":["../src/safeCloneElement.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,EAAE,eAAe,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKvE;;;;;;;;GAQG;AACH,iBAAS,gBAAgB,CACvB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IAAE,KAAK,CAAC,EAAE,GAAG,CAAA;CAAE,GAAG,eAAe,CAAC,CAAC,CAAC,EAEpE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,GAAG,CAAA;CAAE,EACxC,KAAK,EAAE,CAAC,EACR,GAAG,QAAQ,EAAE,SAAS,EAAE,oEA+DzB;AAED,eAAe,gBAAgB,CAAA;AAC/B,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
|