@instructure/ui-toggle-details 8.33.1 → 8.33.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 +4 -0
- package/es/ToggleDetails/ToggleDetailsLocator.js +2 -5
- package/es/ToggleDetails/index.js +9 -36
- package/es/ToggleDetails/props.js +1 -0
- package/es/ToggleDetails/styles.js +7 -8
- package/es/ToggleDetails/theme.js +6 -6
- package/es/ToggleGroup/ToggleGroupLocator.js +2 -4
- package/es/ToggleGroup/index.js +8 -21
- package/es/ToggleGroup/props.js +1 -0
- package/es/index.js +1 -0
- package/lib/ToggleDetails/ToggleDetailsLocator.js +3 -8
- package/lib/ToggleDetails/index.js +9 -50
- package/lib/ToggleDetails/locator.js +0 -2
- package/lib/ToggleDetails/props.js +1 -4
- package/lib/ToggleDetails/styles.js +7 -10
- package/lib/ToggleDetails/theme.js +6 -7
- package/lib/ToggleGroup/ToggleGroupLocator.js +3 -7
- package/lib/ToggleGroup/index.js +6 -37
- package/lib/ToggleGroup/locator.js +0 -2
- package/lib/ToggleGroup/props.js +1 -4
- package/lib/index.js +0 -2
- package/package.json +21 -21
- package/tsconfig.build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
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.33.2](https://github.com/instructure/instructure-ui/compare/v8.33.1...v8.33.2) (2023-01-25)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-toggle-details
|
|
9
|
+
|
|
6
10
|
## [8.33.1](https://github.com/instructure/instructure-ui/compare/v8.33.0...v8.33.1) (2023-01-06)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @instructure/ui-toggle-details
|
|
@@ -29,29 +29,26 @@ export const customMethods = {
|
|
|
29
29
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
30
30
|
args[_key - 1] = arguments[_key];
|
|
31
31
|
}
|
|
32
|
-
|
|
33
32
|
return (await ToggleLocator.find(element)).click(...args);
|
|
34
33
|
},
|
|
35
34
|
findToggle: function (element) {
|
|
36
35
|
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
37
36
|
args[_key2 - 1] = arguments[_key2];
|
|
38
37
|
}
|
|
39
|
-
|
|
40
38
|
return ToggleLocator.find(element, ...args);
|
|
41
39
|
},
|
|
42
40
|
findContent: async function (element) {
|
|
43
41
|
const toggle = await ToggleLocator.find(element);
|
|
44
|
-
|
|
45
42
|
if (toggle) {
|
|
46
43
|
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
47
44
|
args[_key3 - 1] = arguments[_key3];
|
|
48
45
|
}
|
|
49
|
-
|
|
50
46
|
return locator(`#${toggle.getAttribute('aria-controls')}`).find(...args);
|
|
51
47
|
} else {
|
|
52
48
|
return null;
|
|
53
49
|
}
|
|
54
50
|
}
|
|
55
51
|
};
|
|
56
|
-
export const ToggleDetailsLocator = locator(
|
|
52
|
+
export const ToggleDetailsLocator = locator(
|
|
53
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
57
54
|
ToggleDetails.selector, customMethods);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var _dec, _dec2, _class, _class2;
|
|
2
|
-
|
|
3
2
|
/*
|
|
4
3
|
* The MIT License (MIT)
|
|
5
4
|
*
|
|
@@ -23,7 +22,6 @@ var _dec, _dec2, _class, _class2;
|
|
|
23
22
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
23
|
* SOFTWARE.
|
|
25
24
|
*/
|
|
26
|
-
|
|
27
25
|
/** @jsx jsx */
|
|
28
26
|
import React, { Component } from 'react';
|
|
29
27
|
import { Button } from '@instructure/ui-buttons';
|
|
@@ -36,7 +34,6 @@ import { withStyle, jsx } from '@instructure/emotion';
|
|
|
36
34
|
import generateStyle from './styles';
|
|
37
35
|
import generateComponentTheme from './theme';
|
|
38
36
|
import { allowedProps, propTypes } from './props';
|
|
39
|
-
|
|
40
37
|
/**
|
|
41
38
|
---
|
|
42
39
|
category: components
|
|
@@ -48,70 +45,57 @@ let ToggleDetails = (_dec = withStyle(generateStyle, generateComponentTheme), _d
|
|
|
48
45
|
super(...arguments);
|
|
49
46
|
this.ref = null;
|
|
50
47
|
this._button = null;
|
|
51
|
-
|
|
52
48
|
this.getButtonRef = el => this._button = el;
|
|
53
|
-
|
|
54
49
|
this.handleToggle = (event, expanded) => {
|
|
55
50
|
var _this$props$makeStyle, _this$props;
|
|
56
|
-
|
|
57
51
|
if (typeof this.props.onToggle === 'function') {
|
|
58
52
|
this.props.onToggle(event, expanded);
|
|
59
53
|
}
|
|
60
|
-
|
|
61
54
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
|
|
62
55
|
animate: true
|
|
63
56
|
});
|
|
64
57
|
};
|
|
65
58
|
}
|
|
66
|
-
|
|
67
59
|
get focused() {
|
|
68
60
|
return isActiveElement(this._button);
|
|
69
61
|
}
|
|
70
|
-
|
|
71
62
|
focus() {
|
|
72
63
|
var _this$_button;
|
|
73
|
-
|
|
74
64
|
(_this$_button = this._button) === null || _this$_button === void 0 ? void 0 : _this$_button.focus();
|
|
75
65
|
}
|
|
76
|
-
|
|
77
66
|
componentDidMount() {
|
|
78
67
|
var _this$props$makeStyle2, _this$props2;
|
|
79
|
-
|
|
80
68
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, {
|
|
81
69
|
animate: false
|
|
82
70
|
});
|
|
83
71
|
}
|
|
84
|
-
|
|
85
72
|
componentDidUpdate() {
|
|
86
73
|
var _this$props$makeStyle3, _this$props3;
|
|
87
|
-
|
|
88
74
|
(_this$props$makeStyle3 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle3 === void 0 ? void 0 : _this$props$makeStyle3.call(_this$props3, {
|
|
89
75
|
animate: true
|
|
90
76
|
});
|
|
91
77
|
}
|
|
92
|
-
|
|
93
78
|
renderSummary(expanded) {
|
|
94
79
|
var _this$props$styles, _this$props$styles2;
|
|
95
|
-
|
|
96
80
|
const _this$props4 = this.props,
|
|
97
|
-
|
|
98
|
-
|
|
81
|
+
summary = _this$props4.summary,
|
|
82
|
+
iconPosition = _this$props4.iconPosition;
|
|
99
83
|
return jsx("span", {
|
|
100
84
|
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.summary
|
|
101
85
|
}, iconPosition === 'start' && this.renderIcon(expanded), jsx("span", {
|
|
102
86
|
css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.summaryText
|
|
103
87
|
}, summary), iconPosition === 'end' && this.renderIcon(expanded));
|
|
104
88
|
}
|
|
105
|
-
|
|
106
89
|
renderToggle(toggleProps, expanded) {
|
|
107
90
|
const variant = this.props.variant;
|
|
108
|
-
const props = {
|
|
91
|
+
const props = {
|
|
92
|
+
...omitProps(this.props, ToggleDetails.allowedProps),
|
|
109
93
|
...toggleProps,
|
|
110
|
-
children: this.renderSummary(expanded)
|
|
111
|
-
|
|
94
|
+
children: this.renderSummary(expanded)
|
|
95
|
+
// spread operator makes toggleProps loose Record<string, any>>
|
|
112
96
|
};
|
|
113
|
-
const summary = this.renderSummary(expanded);
|
|
114
97
|
|
|
98
|
+
const summary = this.renderSummary(expanded);
|
|
115
99
|
if (variant === 'filled') {
|
|
116
100
|
return jsx(Button, Object.assign({}, props, {
|
|
117
101
|
display: "block",
|
|
@@ -120,14 +104,12 @@ let ToggleDetails = (_dec = withStyle(generateStyle, generateComponentTheme), _d
|
|
|
120
104
|
}), summary);
|
|
121
105
|
} else if (props.href) {
|
|
122
106
|
var _this$props$styles3;
|
|
123
|
-
|
|
124
107
|
return jsx("a", Object.assign({}, props, {
|
|
125
108
|
css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.toggle,
|
|
126
109
|
ref: this.getButtonRef
|
|
127
110
|
}), summary);
|
|
128
111
|
} else {
|
|
129
112
|
var _this$props$styles4;
|
|
130
|
-
|
|
131
113
|
return jsx("button", Object.assign({}, props, {
|
|
132
114
|
type: "button",
|
|
133
115
|
css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.toggle,
|
|
@@ -135,19 +117,15 @@ let ToggleDetails = (_dec = withStyle(generateStyle, generateComponentTheme), _d
|
|
|
135
117
|
}), summary);
|
|
136
118
|
}
|
|
137
119
|
}
|
|
138
|
-
|
|
139
120
|
renderIcon(expanded) {
|
|
140
121
|
var _this$props$styles5;
|
|
141
|
-
|
|
142
122
|
const Icon = expanded ? this.props.iconExpanded : this.props.icon;
|
|
143
123
|
return this.props.children && Icon ? jsx("span", {
|
|
144
124
|
css: (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.icon
|
|
145
125
|
}, jsx(Icon, null)) : null;
|
|
146
126
|
}
|
|
147
|
-
|
|
148
127
|
renderDetails(expanded, detailsProps) {
|
|
149
128
|
var _this$props$styles6;
|
|
150
|
-
|
|
151
129
|
const children = this.props.children;
|
|
152
130
|
const expandedStyles = expanded ? {
|
|
153
131
|
display: 'block'
|
|
@@ -158,24 +136,20 @@ let ToggleDetails = (_dec = withStyle(generateStyle, generateComponentTheme), _d
|
|
|
158
136
|
css: [(_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.details, expandedStyles]
|
|
159
137
|
}), children && expanded && this.renderContent());
|
|
160
138
|
}
|
|
161
|
-
|
|
162
139
|
renderContent() {
|
|
163
140
|
var _this$props$styles7;
|
|
164
|
-
|
|
165
141
|
return jsx("div", {
|
|
166
142
|
css: (_this$props$styles7 = this.props.styles) === null || _this$props$styles7 === void 0 ? void 0 : _this$props$styles7.content
|
|
167
143
|
}, this.props.children);
|
|
168
144
|
}
|
|
169
|
-
|
|
170
145
|
render() {
|
|
171
146
|
return jsx(Expandable, Object.assign({}, pickProps(this.props, Expandable.allowedProps), {
|
|
172
147
|
onToggle: this.handleToggle
|
|
173
148
|
}), _ref => {
|
|
174
149
|
var _this$props$styles8;
|
|
175
|
-
|
|
176
150
|
let expanded = _ref.expanded,
|
|
177
|
-
|
|
178
|
-
|
|
151
|
+
getToggleProps = _ref.getToggleProps,
|
|
152
|
+
getDetailsProps = _ref.getDetailsProps;
|
|
179
153
|
return jsx("div", {
|
|
180
154
|
css: (_this$props$styles8 = this.props.styles) === null || _this$props$styles8 === void 0 ? void 0 : _this$props$styles8.toggleDetails,
|
|
181
155
|
ref: el => {
|
|
@@ -184,7 +158,6 @@ let ToggleDetails = (_dec = withStyle(generateStyle, generateComponentTheme), _d
|
|
|
184
158
|
}, this.renderToggle(getToggleProps(), expanded), this.renderDetails(expanded, getDetailsProps()));
|
|
185
159
|
});
|
|
186
160
|
}
|
|
187
|
-
|
|
188
161
|
}, _class2.displayName = "ToggleDetails", _class2.componentId = 'ToggleDetails', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
|
|
189
162
|
variant: 'default',
|
|
190
163
|
size: 'medium',
|
|
@@ -21,11 +21,13 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
+
|
|
24
25
|
import { keyframes } from '@instructure/emotion';
|
|
25
26
|
const contentAnimation = keyframes`
|
|
26
27
|
to {
|
|
27
28
|
opacity: 1;
|
|
28
29
|
}`;
|
|
30
|
+
|
|
29
31
|
/**
|
|
30
32
|
* ---
|
|
31
33
|
* private: true
|
|
@@ -36,12 +38,11 @@ const contentAnimation = keyframes`
|
|
|
36
38
|
* @param {Object} state the state of the component, the style is applied to
|
|
37
39
|
* @return {Object} The final style object, which will be used in the component
|
|
38
40
|
*/
|
|
39
|
-
|
|
40
41
|
const generateStyle = (componentTheme, props, state) => {
|
|
41
42
|
const fluidWidth = props.fluidWidth,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
iconPosition = props.iconPosition,
|
|
44
|
+
size = props.size,
|
|
45
|
+
variant = props.variant;
|
|
45
46
|
const animate = state.animate;
|
|
46
47
|
const positionIconAtEnd = iconPosition === 'end' && (variant === 'filled' || fluidWidth);
|
|
47
48
|
const fluidWidthStyles = fluidWidth ? {
|
|
@@ -169,10 +170,9 @@ const generateStyle = (componentTheme, props, state) => {
|
|
|
169
170
|
icon: {
|
|
170
171
|
label: 'toggleDetails__icon',
|
|
171
172
|
'& > svg': {
|
|
172
|
-
display: 'block'
|
|
173
|
-
/* fix vertical alignment of icon */
|
|
174
|
-
|
|
173
|
+
display: 'block' /* fix vertical alignment of icon */
|
|
175
174
|
},
|
|
175
|
+
|
|
176
176
|
...iconPositionStyles[iconPosition],
|
|
177
177
|
...iconSizeStyles[size]
|
|
178
178
|
},
|
|
@@ -193,5 +193,4 @@ const generateStyle = (componentTheme, props, state) => {
|
|
|
193
193
|
} : {}
|
|
194
194
|
};
|
|
195
195
|
};
|
|
196
|
-
|
|
197
196
|
export default generateStyle;
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
31
|
const colors = theme.colors,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
spacing = theme.spacing,
|
|
33
|
+
borders = theme.borders,
|
|
34
|
+
typography = theme.typography,
|
|
35
|
+
themeName = theme.key;
|
|
36
36
|
const themeSpecificStyle = {
|
|
37
37
|
canvas: {
|
|
38
38
|
toggleFocusBorderColor: theme['ic-brand-primary'],
|
|
@@ -65,9 +65,9 @@ const generateComponentTheme = theme => {
|
|
|
65
65
|
filledBorderRadius: borders === null || borders === void 0 ? void 0 : borders.radiusMedium,
|
|
66
66
|
filledPadding: spacing === null || spacing === void 0 ? void 0 : spacing.small
|
|
67
67
|
};
|
|
68
|
-
return {
|
|
68
|
+
return {
|
|
69
|
+
...componentVariables,
|
|
69
70
|
...themeSpecificStyle[themeName]
|
|
70
71
|
};
|
|
71
72
|
};
|
|
72
|
-
|
|
73
73
|
export default generateComponentTheme;
|
|
@@ -29,7 +29,6 @@ export const customMethods = {
|
|
|
29
29
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
30
30
|
args[_key - 1] = arguments[_key];
|
|
31
31
|
}
|
|
32
|
-
|
|
33
32
|
return (await ToggleLocator.find(element)).click(...args);
|
|
34
33
|
},
|
|
35
34
|
findToggle: async function () {
|
|
@@ -37,17 +36,16 @@ export const customMethods = {
|
|
|
37
36
|
},
|
|
38
37
|
findContent: async function (element) {
|
|
39
38
|
const toggle = await ToggleLocator.find(element);
|
|
40
|
-
|
|
41
39
|
if (toggle) {
|
|
42
40
|
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
43
41
|
args[_key2 - 1] = arguments[_key2];
|
|
44
42
|
}
|
|
45
|
-
|
|
46
43
|
return locator(`#${toggle.getAttribute('aria-controls')}`).find(...args);
|
|
47
44
|
} else {
|
|
48
45
|
return null;
|
|
49
46
|
}
|
|
50
47
|
}
|
|
51
|
-
};
|
|
48
|
+
};
|
|
52
49
|
|
|
50
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
53
51
|
export const ToggleGroupLocator = locator(ToggleGroup.selector, customMethods);
|
package/es/ToggleGroup/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var _dec, _class, _class2;
|
|
2
|
-
|
|
3
2
|
/*
|
|
4
3
|
* The MIT License (MIT)
|
|
5
4
|
*
|
|
@@ -23,6 +22,7 @@ var _dec, _class, _class2;
|
|
|
23
22
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
23
|
* SOFTWARE.
|
|
25
24
|
*/
|
|
25
|
+
|
|
26
26
|
import React, { Component } from 'react';
|
|
27
27
|
import { omitProps, pickProps, getElementType, callRenderProp } from '@instructure/ui-react-utils';
|
|
28
28
|
import { IconButton } from '@instructure/ui-buttons';
|
|
@@ -34,66 +34,56 @@ import { View } from '@instructure/ui-view';
|
|
|
34
34
|
import { IconArrowOpenEndSolid, IconArrowOpenDownSolid } from '@instructure/ui-icons';
|
|
35
35
|
import { testable } from '@instructure/ui-testable';
|
|
36
36
|
import { allowedProps, propTypes } from './props';
|
|
37
|
+
|
|
37
38
|
/**
|
|
38
39
|
---
|
|
39
40
|
category: components
|
|
40
41
|
---
|
|
41
42
|
@tsProps
|
|
42
43
|
**/
|
|
43
|
-
|
|
44
44
|
let ToggleGroup = (_dec = testable(), _dec(_class = (_class2 = class ToggleGroup extends Component {
|
|
45
45
|
constructor() {
|
|
46
46
|
super(...arguments);
|
|
47
47
|
this.ref = null;
|
|
48
48
|
this._button = null;
|
|
49
49
|
this._shouldTransition = false;
|
|
50
|
-
|
|
51
50
|
this.handleRef = el => {
|
|
52
51
|
const elementRef = this.props.elementRef;
|
|
53
52
|
this.ref = el;
|
|
54
|
-
|
|
55
53
|
if (typeof elementRef === 'function') {
|
|
56
54
|
elementRef(el);
|
|
57
55
|
}
|
|
58
56
|
};
|
|
59
|
-
|
|
60
57
|
this.handleButtonRef = el => {
|
|
61
58
|
this._button = el;
|
|
62
59
|
};
|
|
63
60
|
}
|
|
64
|
-
|
|
65
61
|
get focused() {
|
|
66
62
|
return isActiveElement(this._button);
|
|
67
63
|
}
|
|
68
|
-
|
|
69
64
|
focus() {
|
|
70
65
|
var _this$_button;
|
|
71
|
-
|
|
72
66
|
(_this$_button = this._button) === null || _this$_button === void 0 ? void 0 : _this$_button.focus();
|
|
73
67
|
}
|
|
74
|
-
|
|
75
68
|
componentDidMount() {
|
|
76
69
|
this._shouldTransition = true;
|
|
77
70
|
}
|
|
78
|
-
|
|
79
71
|
renderIcon(expanded) {
|
|
80
72
|
const Icon = expanded ? this.props.iconExpanded : this.props.icon;
|
|
81
73
|
return Icon ? callRenderProp(Icon) : null;
|
|
82
74
|
}
|
|
83
|
-
|
|
84
75
|
renderToggle(toggleProps, expanded) {
|
|
85
76
|
const _this$props = this.props,
|
|
86
|
-
|
|
87
|
-
|
|
77
|
+
toggleLabel = _this$props.toggleLabel,
|
|
78
|
+
size = _this$props.size;
|
|
88
79
|
let label;
|
|
89
|
-
|
|
90
80
|
if (typeof toggleLabel === 'function') {
|
|
91
81
|
label = toggleLabel(expanded);
|
|
92
82
|
} else {
|
|
93
83
|
label = toggleLabel;
|
|
94
84
|
}
|
|
95
|
-
|
|
96
|
-
|
|
85
|
+
const props = {
|
|
86
|
+
...toggleProps
|
|
97
87
|
};
|
|
98
88
|
return /*#__PURE__*/React.createElement(IconButton, Object.assign({}, props, {
|
|
99
89
|
withBackground: false,
|
|
@@ -103,7 +93,6 @@ let ToggleGroup = (_dec = testable(), _dec(_class = (_class2 = class ToggleGroup
|
|
|
103
93
|
screenReaderLabel: label
|
|
104
94
|
}), this.renderIcon(expanded));
|
|
105
95
|
}
|
|
106
|
-
|
|
107
96
|
renderDetails(detailsProps) {
|
|
108
97
|
return /*#__PURE__*/React.createElement(View, Object.assign({}, detailsProps, {
|
|
109
98
|
display: "block",
|
|
@@ -114,13 +103,12 @@ let ToggleGroup = (_dec = testable(), _dec(_class = (_class2 = class ToggleGroup
|
|
|
114
103
|
type: "fade"
|
|
115
104
|
}, this.props.children) : this.props.children);
|
|
116
105
|
}
|
|
117
|
-
|
|
118
106
|
render() {
|
|
119
107
|
const Element = getElementType(ToggleGroup, this.props);
|
|
120
108
|
return /*#__PURE__*/React.createElement(Expandable, pickProps(this.props, Expandable.allowedProps), _ref => {
|
|
121
109
|
let expanded = _ref.expanded,
|
|
122
|
-
|
|
123
|
-
|
|
110
|
+
getToggleProps = _ref.getToggleProps,
|
|
111
|
+
getDetailsProps = _ref.getDetailsProps;
|
|
124
112
|
return /*#__PURE__*/React.createElement(View, Object.assign({}, omitProps(this.props, ToggleGroup.allowedProps), {
|
|
125
113
|
borderWidth: this.props.border ? 'small' : 'none',
|
|
126
114
|
as: Element,
|
|
@@ -137,7 +125,6 @@ let ToggleGroup = (_dec = testable(), _dec(_class = (_class2 = class ToggleGroup
|
|
|
137
125
|
}, this.props.summary)), expanded ? this.renderDetails(getDetailsProps()) : /*#__PURE__*/React.createElement("span", getDetailsProps()));
|
|
138
126
|
});
|
|
139
127
|
}
|
|
140
|
-
|
|
141
128
|
}, _class2.displayName = "ToggleGroup", _class2.componentId = 'ToggleGroup', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
|
|
142
129
|
size: 'medium',
|
|
143
130
|
icon: IconArrowOpenEndSolid,
|
package/es/ToggleGroup/props.js
CHANGED
package/es/index.js
CHANGED
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.customMethods = exports.ToggleDetailsLocator = void 0;
|
|
7
|
-
|
|
8
7
|
var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
|
|
9
|
-
|
|
10
8
|
var _index = require("./index");
|
|
11
|
-
|
|
12
9
|
/*
|
|
13
10
|
* The MIT License (MIT)
|
|
14
11
|
*
|
|
@@ -32,30 +29,27 @@ var _index = require("./index");
|
|
|
32
29
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
30
|
* SOFTWARE.
|
|
34
31
|
*/
|
|
32
|
+
|
|
35
33
|
const ToggleLocator = (0, _locator.locator)('[aria-expanded][aria-controls]');
|
|
36
34
|
const customMethods = {
|
|
37
35
|
clickToggle: async function (element) {
|
|
38
36
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
39
37
|
args[_key - 1] = arguments[_key];
|
|
40
38
|
}
|
|
41
|
-
|
|
42
39
|
return (await ToggleLocator.find(element)).click(...args);
|
|
43
40
|
},
|
|
44
41
|
findToggle: function (element) {
|
|
45
42
|
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
46
43
|
args[_key2 - 1] = arguments[_key2];
|
|
47
44
|
}
|
|
48
|
-
|
|
49
45
|
return ToggleLocator.find(element, ...args);
|
|
50
46
|
},
|
|
51
47
|
findContent: async function (element) {
|
|
52
48
|
const toggle = await ToggleLocator.find(element);
|
|
53
|
-
|
|
54
49
|
if (toggle) {
|
|
55
50
|
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
56
51
|
args[_key3 - 1] = arguments[_key3];
|
|
57
52
|
}
|
|
58
|
-
|
|
59
53
|
return (0, _locator.locator)(`#${toggle.getAttribute('aria-controls')}`).find(...args);
|
|
60
54
|
} else {
|
|
61
55
|
return null;
|
|
@@ -63,6 +57,7 @@ const customMethods = {
|
|
|
63
57
|
}
|
|
64
58
|
};
|
|
65
59
|
exports.customMethods = customMethods;
|
|
66
|
-
const ToggleDetailsLocator = (0, _locator.locator)(
|
|
60
|
+
const ToggleDetailsLocator = (0, _locator.locator)(
|
|
61
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
67
62
|
_index.ToggleDetails.selector, customMethods);
|
|
68
63
|
exports.ToggleDetailsLocator = ToggleDetailsLocator;
|