@instructure/ui-expandable 8.12.1-snapshot.45 → 8.12.1-snapshot.51
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/es/Expandable/index.js +15 -10
- package/lib/Expandable/index.js +16 -11
- package/lib/Expandable/props.js +1 -1
- package/package.json +9 -9
package/es/Expandable/index.js
CHANGED
|
@@ -26,11 +26,12 @@ import { uid } from '@instructure/uid';
|
|
|
26
26
|
import { createChainedFunction } from '@instructure/ui-utils';
|
|
27
27
|
import { propTypes, allowedProps } from './props';
|
|
28
28
|
|
|
29
|
-
const toggleExpanded =
|
|
30
|
-
expanded
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
29
|
+
const toggleExpanded = _ref => {
|
|
30
|
+
let expanded = _ref.expanded;
|
|
31
|
+
return {
|
|
32
|
+
expanded: !expanded
|
|
33
|
+
};
|
|
34
|
+
};
|
|
34
35
|
/**
|
|
35
36
|
---
|
|
36
37
|
category: components/utilities
|
|
@@ -62,7 +63,8 @@ class Expandable extends Component {
|
|
|
62
63
|
return this.isControlled() ? this.props.expanded : this.state.expanded;
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
isControlled(
|
|
66
|
+
isControlled() {
|
|
67
|
+
let props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props;
|
|
66
68
|
return typeof props.expanded === 'boolean';
|
|
67
69
|
}
|
|
68
70
|
|
|
@@ -79,6 +81,8 @@ class Expandable extends Component {
|
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
render() {
|
|
84
|
+
var _this = this;
|
|
85
|
+
|
|
82
86
|
const _this$props = this.props,
|
|
83
87
|
children = _this$props.children,
|
|
84
88
|
_this$props$render = _this$props.render,
|
|
@@ -87,11 +91,12 @@ class Expandable extends Component {
|
|
|
87
91
|
if (typeof render === 'function') {
|
|
88
92
|
return render({
|
|
89
93
|
expanded: this.expanded,
|
|
90
|
-
getToggleProps: (
|
|
94
|
+
getToggleProps: function () {
|
|
95
|
+
let props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
91
96
|
return {
|
|
92
|
-
'aria-controls':
|
|
93
|
-
'aria-expanded':
|
|
94
|
-
onClick: createChainedFunction(
|
|
97
|
+
'aria-controls': _this._contentId,
|
|
98
|
+
'aria-expanded': _this.expanded,
|
|
99
|
+
onClick: createChainedFunction(_this.handleToggle, props.onClick),
|
|
95
100
|
...props
|
|
96
101
|
};
|
|
97
102
|
},
|
package/lib/Expandable/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.default = exports.Expandable = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
|
|
@@ -36,11 +36,12 @@ var _props = require("./props");
|
|
|
36
36
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
37
37
|
* SOFTWARE.
|
|
38
38
|
*/
|
|
39
|
-
const toggleExpanded =
|
|
40
|
-
expanded
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
39
|
+
const toggleExpanded = _ref => {
|
|
40
|
+
let expanded = _ref.expanded;
|
|
41
|
+
return {
|
|
42
|
+
expanded: !expanded
|
|
43
|
+
};
|
|
44
|
+
};
|
|
44
45
|
/**
|
|
45
46
|
---
|
|
46
47
|
category: components/utilities
|
|
@@ -72,7 +73,8 @@ class Expandable extends _react.Component {
|
|
|
72
73
|
return this.isControlled() ? this.props.expanded : this.state.expanded;
|
|
73
74
|
}
|
|
74
75
|
|
|
75
|
-
isControlled(
|
|
76
|
+
isControlled() {
|
|
77
|
+
let props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props;
|
|
76
78
|
return typeof props.expanded === 'boolean';
|
|
77
79
|
}
|
|
78
80
|
|
|
@@ -89,6 +91,8 @@ class Expandable extends _react.Component {
|
|
|
89
91
|
}
|
|
90
92
|
|
|
91
93
|
render() {
|
|
94
|
+
var _this = this;
|
|
95
|
+
|
|
92
96
|
const _this$props = this.props,
|
|
93
97
|
children = _this$props.children,
|
|
94
98
|
_this$props$render = _this$props.render,
|
|
@@ -97,11 +101,12 @@ class Expandable extends _react.Component {
|
|
|
97
101
|
if (typeof render === 'function') {
|
|
98
102
|
return render({
|
|
99
103
|
expanded: this.expanded,
|
|
100
|
-
getToggleProps: (
|
|
104
|
+
getToggleProps: function () {
|
|
105
|
+
let props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
101
106
|
return {
|
|
102
|
-
'aria-controls':
|
|
103
|
-
'aria-expanded':
|
|
104
|
-
onClick: (0, _createChainedFunction.createChainedFunction)(
|
|
107
|
+
'aria-controls': _this._contentId,
|
|
108
|
+
'aria-expanded': _this.expanded,
|
|
109
|
+
onClick: (0, _createChainedFunction.createChainedFunction)(_this.handleToggle, props.onClick),
|
|
105
110
|
...props
|
|
106
111
|
};
|
|
107
112
|
},
|
package/lib/Expandable/props.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.propTypes = exports.allowedProps = void 0;
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-expandable",
|
|
3
|
-
"version": "8.12.1-snapshot.
|
|
3
|
+
"version": "8.12.1-snapshot.51+4d3697334",
|
|
4
4
|
"description": "A utility component for show/hide functionality",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -25,16 +25,16 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@babel/runtime": "^7.13.10",
|
|
28
|
-
"@instructure/ui-prop-types": "8.12.1-snapshot.
|
|
29
|
-
"@instructure/ui-testable": "8.12.1-snapshot.
|
|
30
|
-
"@instructure/ui-utils": "8.12.1-snapshot.
|
|
31
|
-
"@instructure/uid": "8.12.1-snapshot.
|
|
28
|
+
"@instructure/ui-prop-types": "8.12.1-snapshot.51+4d3697334",
|
|
29
|
+
"@instructure/ui-testable": "8.12.1-snapshot.51+4d3697334",
|
|
30
|
+
"@instructure/ui-utils": "8.12.1-snapshot.51+4d3697334",
|
|
31
|
+
"@instructure/uid": "8.12.1-snapshot.51+4d3697334",
|
|
32
32
|
"prop-types": "^15"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@instructure/ui-babel-preset": "8.12.1-snapshot.
|
|
36
|
-
"@instructure/ui-color-utils": "8.12.1-snapshot.
|
|
37
|
-
"@instructure/ui-test-utils": "8.12.1-snapshot.
|
|
35
|
+
"@instructure/ui-babel-preset": "8.12.1-snapshot.51+4d3697334",
|
|
36
|
+
"@instructure/ui-color-utils": "8.12.1-snapshot.51+4d3697334",
|
|
37
|
+
"@instructure/ui-test-utils": "8.12.1-snapshot.51+4d3697334"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"react": ">=16.8 <=17"
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"sideEffects": false,
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "4d369733414715a70bae0628378e8d82214eab3e"
|
|
47
47
|
}
|