@instructure/ui-toggle-details 8.8.1-snapshot.3 → 8.9.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 +6 -0
- package/es/ToggleDetails/index.js +38 -72
- package/es/ToggleDetails/props.js +76 -0
- package/es/ToggleGroup/index.js +3 -67
- package/es/ToggleGroup/props.js +90 -0
- package/lib/ToggleDetails/index.js +38 -73
- package/lib/ToggleDetails/props.js +88 -0
- package/lib/ToggleGroup/index.js +3 -70
- package/lib/ToggleGroup/props.js +102 -0
- package/package.json +22 -23
- package/src/ToggleDetails/index.tsx +16 -64
- package/src/ToggleDetails/props.ts +112 -0
- package/src/ToggleDetails/styles.ts +1 -1
- package/src/ToggleGroup/index.tsx +6 -59
- package/src/ToggleGroup/props.ts +124 -0
- package/src/index.ts +2 -2
- package/types/ToggleDetails/index.d.ts +27 -45
- package/types/ToggleDetails/index.d.ts.map +1 -1
- package/types/ToggleDetails/props.d.ts +27 -0
- package/types/ToggleDetails/props.d.ts.map +1 -0
- package/types/ToggleDetails/styles.d.ts +1 -1
- package/types/ToggleGroup/index.d.ts +41 -65
- package/types/ToggleGroup/index.d.ts.map +1 -1
- package/types/ToggleGroup/props.d.ts +25 -0
- package/types/ToggleGroup/props.d.ts.map +1 -0
- package/types/index.d.ts +2 -2
- package/LICENSE.md +0 -27
- package/es/ToggleDetails/types.js +0 -1
- package/es/ToggleGroup/types.js +0 -1
- package/lib/ToggleDetails/types.js +0 -1
- package/lib/ToggleGroup/types.js +0 -1
- package/src/ToggleDetails/types.ts +0 -42
- package/src/ToggleGroup/types.ts +0 -41
- package/types/ToggleDetails/types.d.ts +0 -19
- package/types/ToggleDetails/types.d.ts.map +0 -1
- package/types/ToggleGroup/types.d.ts +0 -17
- package/types/ToggleGroup/types.d.ts.map +0 -1
|
@@ -9,8 +9,6 @@ exports.ToggleDetails = exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
|
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
12
|
var _Button = require("@instructure/ui-buttons/lib/Button");
|
|
15
13
|
|
|
16
14
|
var _IconArrowOpenEndSolid = require("@instructure/ui-icons/lib/IconArrowOpenEndSolid.js");
|
|
@@ -19,8 +17,6 @@ var _IconArrowOpenDownSolid = require("@instructure/ui-icons/lib/IconArrowOpenDo
|
|
|
19
17
|
|
|
20
18
|
var _Expandable = require("@instructure/ui-expandable/lib/Expandable");
|
|
21
19
|
|
|
22
|
-
var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
|
|
23
|
-
|
|
24
20
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
25
21
|
|
|
26
22
|
var _pickProps = require("@instructure/ui-react-utils/lib/pickProps.js");
|
|
@@ -35,6 +31,8 @@ var _styles = _interopRequireDefault(require("./styles"));
|
|
|
35
31
|
|
|
36
32
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
37
33
|
|
|
34
|
+
var _props = require("./props");
|
|
35
|
+
|
|
38
36
|
var _dec, _dec2, _class, _class2, _temp;
|
|
39
37
|
|
|
40
38
|
/**
|
|
@@ -49,8 +47,10 @@ let ToggleDetails = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
49
47
|
this.getButtonRef = el => this._button = el;
|
|
50
48
|
|
|
51
49
|
this.handleToggle = (event, expanded) => {
|
|
50
|
+
var _this$props$makeStyle, _this$props;
|
|
51
|
+
|
|
52
52
|
this.props.onToggle(event, expanded);
|
|
53
|
-
this.props.makeStyles({
|
|
53
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
|
|
54
54
|
animate: true
|
|
55
55
|
});
|
|
56
56
|
};
|
|
@@ -65,25 +65,31 @@ let ToggleDetails = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
componentDidMount() {
|
|
68
|
-
|
|
68
|
+
var _this$props$makeStyle2, _this$props2;
|
|
69
|
+
|
|
70
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, {
|
|
69
71
|
animate: false
|
|
70
72
|
});
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
componentDidUpdate() {
|
|
74
|
-
|
|
76
|
+
var _this$props$makeStyle3, _this$props3;
|
|
77
|
+
|
|
78
|
+
(_this$props$makeStyle3 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle3 === void 0 ? void 0 : _this$props$makeStyle3.call(_this$props3, {
|
|
75
79
|
animate: true
|
|
76
80
|
});
|
|
77
81
|
}
|
|
78
82
|
|
|
79
83
|
renderSummary(expanded) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
var _this$props$styles, _this$props$styles2;
|
|
85
|
+
|
|
86
|
+
const _this$props4 = this.props,
|
|
87
|
+
summary = _this$props4.summary,
|
|
88
|
+
iconPosition = _this$props4.iconPosition;
|
|
83
89
|
return (0, _emotion.jsx)("span", {
|
|
84
|
-
css: this.props.styles.summary
|
|
90
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.summary
|
|
85
91
|
}, iconPosition === 'start' && this.renderIcon(expanded), (0, _emotion.jsx)("span", {
|
|
86
|
-
css: this.props.styles.summaryText
|
|
92
|
+
css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.summaryText
|
|
87
93
|
}, summary), iconPosition === 'end' && this.renderIcon(expanded));
|
|
88
94
|
}
|
|
89
95
|
|
|
@@ -102,27 +108,35 @@ let ToggleDetails = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
102
108
|
elementRef: this.getButtonRef
|
|
103
109
|
}), summary);
|
|
104
110
|
} else if (props.href) {
|
|
111
|
+
var _this$props$styles3;
|
|
112
|
+
|
|
105
113
|
return (0, _emotion.jsx)("a", Object.assign({}, props, {
|
|
106
|
-
css: this.props.styles.toggle,
|
|
114
|
+
css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.toggle,
|
|
107
115
|
ref: this.getButtonRef
|
|
108
116
|
}), summary);
|
|
109
117
|
} else {
|
|
118
|
+
var _this$props$styles4;
|
|
119
|
+
|
|
110
120
|
return (0, _emotion.jsx)("button", Object.assign({}, props, {
|
|
111
121
|
type: "button",
|
|
112
|
-
css: this.props.styles.toggle,
|
|
122
|
+
css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.toggle,
|
|
113
123
|
ref: this.getButtonRef
|
|
114
124
|
}), summary);
|
|
115
125
|
}
|
|
116
126
|
}
|
|
117
127
|
|
|
118
128
|
renderIcon(expanded) {
|
|
129
|
+
var _this$props$styles5;
|
|
130
|
+
|
|
119
131
|
const Icon = expanded ? this.props.iconExpanded : this.props.icon;
|
|
120
132
|
return this.props.children ? (0, _emotion.jsx)("span", {
|
|
121
|
-
css: this.props.styles.icon
|
|
133
|
+
css: (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.icon
|
|
122
134
|
}, (0, _emotion.jsx)(Icon, null)) : null;
|
|
123
135
|
}
|
|
124
136
|
|
|
125
137
|
renderDetails(expanded, detailsProps) {
|
|
138
|
+
var _this$props$styles6;
|
|
139
|
+
|
|
126
140
|
const children = this.props.children;
|
|
127
141
|
const expandedStyles = expanded ? {
|
|
128
142
|
display: 'block'
|
|
@@ -130,13 +144,15 @@ let ToggleDetails = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
130
144
|
display: 'none'
|
|
131
145
|
};
|
|
132
146
|
return (0, _emotion.jsx)("div", Object.assign({}, detailsProps, {
|
|
133
|
-
css: [this.props.styles.details, expandedStyles]
|
|
147
|
+
css: [(_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.details, expandedStyles]
|
|
134
148
|
}), children && expanded && this.renderContent());
|
|
135
149
|
}
|
|
136
150
|
|
|
137
151
|
renderContent() {
|
|
152
|
+
var _this$props$styles7;
|
|
153
|
+
|
|
138
154
|
return (0, _emotion.jsx)("div", {
|
|
139
|
-
css: this.props.styles.content
|
|
155
|
+
css: (_this$props$styles7 = this.props.styles) === null || _this$props$styles7 === void 0 ? void 0 : _this$props$styles7.content
|
|
140
156
|
}, this.props.children);
|
|
141
157
|
}
|
|
142
158
|
|
|
@@ -148,65 +164,15 @@ let ToggleDetails = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
148
164
|
getToggleProps,
|
|
149
165
|
getDetailsProps
|
|
150
166
|
}) => {
|
|
167
|
+
var _this$props$styles8;
|
|
168
|
+
|
|
151
169
|
return (0, _emotion.jsx)("div", {
|
|
152
|
-
css: this.props.styles.toggleDetails
|
|
170
|
+
css: (_this$props$styles8 = this.props.styles) === null || _this$props$styles8 === void 0 ? void 0 : _this$props$styles8.toggleDetails
|
|
153
171
|
}, this.renderToggle(getToggleProps(), expanded), this.renderDetails(expanded, getDetailsProps()));
|
|
154
172
|
});
|
|
155
173
|
}
|
|
156
174
|
|
|
157
|
-
}, _class2.displayName = "ToggleDetails", _class2.componentId = 'ToggleDetails', _class2.propTypes = {
|
|
158
|
-
// eslint-disable-next-line react/require-default-props
|
|
159
|
-
makeStyles: _propTypes.default.func,
|
|
160
|
-
// eslint-disable-next-line react/require-default-props
|
|
161
|
-
styles: _propTypes.default.object,
|
|
162
|
-
variant: _propTypes.default.oneOf(['default', 'filled']),
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* The summary that displays and can be interacted with
|
|
166
|
-
*/
|
|
167
|
-
summary: _propTypes.default.node.isRequired,
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Whether the content is expanded or hidden
|
|
171
|
-
*/
|
|
172
|
-
expanded: (0, _controllable.controllable)(_propTypes.default.bool, 'onToggle', 'defaultExpanded'),
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Whether the content is initially expanded or hidden (uncontrolled)
|
|
176
|
-
*/
|
|
177
|
-
defaultExpanded: _propTypes.default.bool,
|
|
178
|
-
onToggle: _propTypes.default.func,
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* The icon to display next to the summary text when content is hidden
|
|
182
|
-
*/
|
|
183
|
-
icon: _propTypes.default.func,
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* The icon to display when content is expanded
|
|
187
|
-
*/
|
|
188
|
-
iconExpanded: _propTypes.default.func,
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Icon position at the start or end of the summary text
|
|
192
|
-
*/
|
|
193
|
-
iconPosition: _propTypes.default.oneOf(['start', 'end']),
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* should the summary fill the width of its container
|
|
197
|
-
*/
|
|
198
|
-
fluidWidth: _propTypes.default.bool,
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* The toggleable content passed inside the ToggleDetails component
|
|
202
|
-
*/
|
|
203
|
-
children: _propTypes.default.node,
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Choose a size for the expand/collapse icon
|
|
207
|
-
*/
|
|
208
|
-
size: _propTypes.default.oneOf(['small', 'medium', 'large'])
|
|
209
|
-
}, _class2.defaultProps = {
|
|
175
|
+
}, _class2.displayName = "ToggleDetails", _class2.componentId = 'ToggleDetails', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
|
210
176
|
variant: 'default',
|
|
211
177
|
size: 'medium',
|
|
212
178
|
fluidWidth: false,
|
|
@@ -215,8 +181,7 @@ let ToggleDetails = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
215
181
|
iconPosition: 'start',
|
|
216
182
|
defaultExpanded: false,
|
|
217
183
|
onToggle: function (event, expanded) {},
|
|
218
|
-
children: null
|
|
219
|
-
expanded: void 0
|
|
184
|
+
children: null
|
|
220
185
|
}, _temp)) || _class) || _class);
|
|
221
186
|
exports.ToggleDetails = ToggleDetails;
|
|
222
187
|
var _default = ToggleDetails;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.allowedProps = exports.propTypes = void 0;
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* The MIT License (MIT)
|
|
16
|
+
*
|
|
17
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
18
|
+
*
|
|
19
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
20
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
21
|
+
* in the Software without restriction, including without limitation the rights
|
|
22
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
23
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
24
|
+
* furnished to do so, subject to the following conditions:
|
|
25
|
+
*
|
|
26
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
27
|
+
* copies or substantial portions of the Software.
|
|
28
|
+
*
|
|
29
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
30
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
31
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
32
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
33
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
34
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
|
+
* SOFTWARE.
|
|
36
|
+
*/
|
|
37
|
+
const propTypes = {
|
|
38
|
+
variant: _propTypes.default.oneOf(['default', 'filled']),
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The summary that displays and can be interacted with
|
|
42
|
+
*/
|
|
43
|
+
summary: _propTypes.default.node.isRequired,
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Whether the content is expanded or hidden
|
|
47
|
+
*/
|
|
48
|
+
expanded: (0, _controllable.controllable)(_propTypes.default.bool, 'onToggle', 'defaultExpanded'),
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Whether the content is initially expanded or hidden (uncontrolled)
|
|
52
|
+
*/
|
|
53
|
+
defaultExpanded: _propTypes.default.bool,
|
|
54
|
+
onToggle: _propTypes.default.func,
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The icon to display next to the summary text when content is hidden
|
|
58
|
+
*/
|
|
59
|
+
icon: _propTypes.default.func,
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The icon to display when content is expanded
|
|
63
|
+
*/
|
|
64
|
+
iconExpanded: _propTypes.default.func,
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Icon position at the start or end of the summary text
|
|
68
|
+
*/
|
|
69
|
+
iconPosition: _propTypes.default.oneOf(['start', 'end']),
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* should the summary fill the width of its container
|
|
73
|
+
*/
|
|
74
|
+
fluidWidth: _propTypes.default.bool,
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The toggleable content passed inside the ToggleDetails component
|
|
78
|
+
*/
|
|
79
|
+
children: _propTypes.default.node,
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Choose a size for the expand/collapse icon
|
|
83
|
+
*/
|
|
84
|
+
size: _propTypes.default.oneOf(['small', 'medium', 'large'])
|
|
85
|
+
};
|
|
86
|
+
exports.propTypes = propTypes;
|
|
87
|
+
const allowedProps = ['variant', 'summary', 'expanded', 'defaultExpanded', 'onToggle', 'icon', 'iconExpanded', 'iconPosition', 'fluidWidth', 'children', 'size'];
|
|
88
|
+
exports.allowedProps = allowedProps;
|
package/lib/ToggleGroup/index.js
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
4
|
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
@@ -11,8 +9,6 @@ exports.ToggleGroup = exports.default = void 0;
|
|
|
11
9
|
|
|
12
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
11
|
|
|
14
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
|
|
16
12
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
17
13
|
|
|
18
14
|
var _pickProps = require("@instructure/ui-react-utils/lib/pickProps.js");
|
|
@@ -25,8 +21,6 @@ var _Transition = require("@instructure/ui-motion/lib/Transition");
|
|
|
25
21
|
|
|
26
22
|
var _Expandable = require("@instructure/ui-expandable/lib/Expandable");
|
|
27
23
|
|
|
28
|
-
var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
|
|
29
|
-
|
|
30
24
|
var _isActiveElement = require("@instructure/ui-dom-utils/lib/isActiveElement.js");
|
|
31
25
|
|
|
32
26
|
var _Flex = require("@instructure/ui-flex/lib/Flex");
|
|
@@ -39,6 +33,8 @@ var _IconArrowOpenDownSolid = require("@instructure/ui-icons/lib/IconArrowOpenDo
|
|
|
39
33
|
|
|
40
34
|
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
41
35
|
|
|
36
|
+
var _props = require("./props");
|
|
37
|
+
|
|
42
38
|
var _dec, _class, _class2, _temp;
|
|
43
39
|
|
|
44
40
|
/**
|
|
@@ -128,70 +124,7 @@ let ToggleGroup = (_dec = (0, _testable.testable)(), _dec(_class = (_temp = _cla
|
|
|
128
124
|
});
|
|
129
125
|
}
|
|
130
126
|
|
|
131
|
-
}, _class2.displayName = "ToggleGroup", _class2.componentId = 'ToggleGroup', _class2.propTypes = {
|
|
132
|
-
/**
|
|
133
|
-
* the content to show and hide
|
|
134
|
-
*/
|
|
135
|
-
children: _propTypes.default.node.isRequired,
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* the content area next to the toggle button
|
|
139
|
-
*/
|
|
140
|
-
summary: _propTypes.default.node.isRequired,
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* provides a screenreader label for the toggle button
|
|
144
|
-
* (takes `expanded` as an argument if a function)
|
|
145
|
-
*/
|
|
146
|
-
toggleLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired,
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* the element type to render as
|
|
150
|
-
*/
|
|
151
|
-
as: _propTypes.default.elementType,
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* provides a reference to the underlying html root element
|
|
155
|
-
*/
|
|
156
|
-
elementRef: _propTypes.default.func,
|
|
157
|
-
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Whether the content is expanded or hidden
|
|
161
|
-
*/
|
|
162
|
-
expanded: (0, _controllable.controllable)(_propTypes.default.bool, 'onToggle', 'defaultExpanded'),
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Whether the content is initially expanded or hidden (uncontrolled)
|
|
166
|
-
*/
|
|
167
|
-
defaultExpanded: _propTypes.default.bool,
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Fired when the content display is toggled
|
|
171
|
-
*/
|
|
172
|
-
onToggle: _propTypes.default.func,
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* The icon displayed in the toggle button when the content is hidden
|
|
176
|
-
*/
|
|
177
|
-
icon: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* The icon displayed in the toggle button when the content is showing
|
|
181
|
-
*/
|
|
182
|
-
iconExpanded: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Transition content into view
|
|
186
|
-
*/
|
|
187
|
-
transition: _propTypes.default.bool,
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Toggle the border around the component
|
|
191
|
-
*/
|
|
192
|
-
border: _propTypes.default.bool
|
|
193
|
-
}, _class2.defaultProps = {
|
|
194
|
-
expanded: void 0,
|
|
127
|
+
}, _class2.displayName = "ToggleGroup", _class2.componentId = 'ToggleGroup', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
|
195
128
|
size: 'medium',
|
|
196
129
|
icon: _IconArrowOpenEndSolid.IconArrowOpenEndSolid,
|
|
197
130
|
iconExpanded: _IconArrowOpenDownSolid.IconArrowOpenDownSolid,
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.allowedProps = exports.propTypes = void 0;
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* The MIT License (MIT)
|
|
16
|
+
*
|
|
17
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
18
|
+
*
|
|
19
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
20
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
21
|
+
* in the Software without restriction, including without limitation the rights
|
|
22
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
23
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
24
|
+
* furnished to do so, subject to the following conditions:
|
|
25
|
+
*
|
|
26
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
27
|
+
* copies or substantial portions of the Software.
|
|
28
|
+
*
|
|
29
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
30
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
31
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
32
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
33
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
34
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
|
+
* SOFTWARE.
|
|
36
|
+
*/
|
|
37
|
+
const propTypes = {
|
|
38
|
+
/**
|
|
39
|
+
* the content to show and hide
|
|
40
|
+
*/
|
|
41
|
+
children: _propTypes.default.node.isRequired,
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* the content area next to the toggle button
|
|
45
|
+
*/
|
|
46
|
+
summary: _propTypes.default.node.isRequired,
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* provides a screenreader label for the toggle button
|
|
50
|
+
* (takes `expanded` as an argument if a function)
|
|
51
|
+
*/
|
|
52
|
+
toggleLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired,
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* the element type to render as
|
|
56
|
+
*/
|
|
57
|
+
as: _propTypes.default.elementType,
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* provides a reference to the underlying html root element
|
|
61
|
+
*/
|
|
62
|
+
elementRef: _propTypes.default.func,
|
|
63
|
+
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Whether the content is expanded or hidden
|
|
67
|
+
*/
|
|
68
|
+
expanded: (0, _controllable.controllable)(_propTypes.default.bool, 'onToggle', 'defaultExpanded'),
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Whether the content is initially expanded or hidden (uncontrolled)
|
|
72
|
+
*/
|
|
73
|
+
defaultExpanded: _propTypes.default.bool,
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Fired when the content display is toggled
|
|
77
|
+
*/
|
|
78
|
+
onToggle: _propTypes.default.func,
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The icon displayed in the toggle button when the content is hidden
|
|
82
|
+
*/
|
|
83
|
+
icon: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The icon displayed in the toggle button when the content is showing
|
|
87
|
+
*/
|
|
88
|
+
iconExpanded: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Transition content into view
|
|
92
|
+
*/
|
|
93
|
+
transition: _propTypes.default.bool,
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Toggle the border around the component
|
|
97
|
+
*/
|
|
98
|
+
border: _propTypes.default.bool
|
|
99
|
+
};
|
|
100
|
+
exports.propTypes = propTypes;
|
|
101
|
+
const allowedProps = ['children', 'summary', 'toggleLabel', 'as', 'elementRef', 'size', 'expanded', 'defaultExpanded', 'onToggle', 'icon', 'iconExpanded', 'transition', 'border'];
|
|
102
|
+
exports.allowedProps = allowedProps;
|