@instructure/ui-toggle-details 8.24.4 → 8.24.6-snapshot.8
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 +8 -0
- package/LICENSE.md +27 -0
- package/es/ToggleDetails/ToggleDetailsLocator.js +2 -1
- package/es/ToggleDetails/index.js +14 -7
- package/es/ToggleDetails/props.js +0 -36
- package/es/ToggleGroup/ToggleGroupLocator.js +2 -1
- package/es/ToggleGroup/index.js +9 -6
- package/es/ToggleGroup/props.js +0 -48
- package/lib/ToggleDetails/ToggleDetailsLocator.js +2 -1
- package/lib/ToggleDetails/index.js +15 -6
- package/lib/ToggleDetails/props.js +0 -36
- package/lib/ToggleGroup/ToggleGroupLocator.js +2 -1
- package/lib/ToggleGroup/index.js +10 -5
- package/lib/ToggleGroup/props.js +0 -48
- package/package.json +23 -22
- package/src/ToggleDetails/index.tsx +21 -28
- package/src/ToggleDetails/props.ts +30 -30
- package/src/ToggleGroup/index.tsx +17 -18
- package/src/ToggleGroup/props.ts +35 -35
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/ToggleDetails/index.d.ts +22 -18
- package/types/ToggleDetails/index.d.ts.map +1 -1
- package/types/ToggleDetails/props.d.ts +30 -3
- package/types/ToggleDetails/props.d.ts.map +1 -1
- package/types/ToggleGroup/index.d.ts +18 -16
- package/types/ToggleGroup/index.d.ts.map +1 -1
- package/types/ToggleGroup/props.d.ts +42 -5
- package/types/ToggleGroup/props.d.ts.map +1 -1
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.24.5](https://github.com/instructure/instructure-ui/compare/v8.24.3...v8.24.5) (2022-05-31)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-toggle-details
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [8.24.4](https://github.com/instructure/instructure-ui/compare/v8.24.3...v8.24.4) (2022-05-27)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @instructure/ui-toggle-details
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: The MIT License (MIT)
|
|
3
|
+
category: Getting Started
|
|
4
|
+
order: 9
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# The MIT License (MIT)
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2015 Instructure, Inc.
|
|
10
|
+
|
|
11
|
+
**Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions.**
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
@@ -53,4 +53,5 @@ export const customMethods = {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
-
export const ToggleDetailsLocator = locator(
|
|
56
|
+
export const ToggleDetailsLocator = locator( // @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
|
+
ToggleDetails.selector, customMethods);
|
|
@@ -25,7 +25,7 @@ var _dec, _dec2, _class, _class2;
|
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
27
|
/** @jsx jsx */
|
|
28
|
-
import { Component } from 'react';
|
|
28
|
+
import React, { Component } from 'react';
|
|
29
29
|
import { Button } from '@instructure/ui-buttons';
|
|
30
30
|
import { IconArrowOpenEndSolid, IconArrowOpenDownSolid } from '@instructure/ui-icons';
|
|
31
31
|
import { Expandable } from '@instructure/ui-expandable';
|
|
@@ -36,23 +36,28 @@ import { withStyle, jsx } from '@instructure/emotion';
|
|
|
36
36
|
import generateStyle from './styles';
|
|
37
37
|
import generateComponentTheme from './theme';
|
|
38
38
|
import { allowedProps, propTypes } from './props';
|
|
39
|
+
|
|
39
40
|
/**
|
|
40
41
|
---
|
|
41
42
|
category: components
|
|
42
43
|
---
|
|
44
|
+
@tsProps
|
|
43
45
|
**/
|
|
44
|
-
|
|
45
46
|
let ToggleDetails = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_class2 = class ToggleDetails extends Component {
|
|
46
47
|
constructor() {
|
|
47
48
|
super(...arguments);
|
|
48
49
|
this.ref = null;
|
|
50
|
+
this._button = null;
|
|
49
51
|
|
|
50
52
|
this.getButtonRef = el => this._button = el;
|
|
51
53
|
|
|
52
54
|
this.handleToggle = (event, expanded) => {
|
|
53
55
|
var _this$props$makeStyle, _this$props;
|
|
54
56
|
|
|
55
|
-
this.props.onToggle
|
|
57
|
+
if (typeof this.props.onToggle === 'function') {
|
|
58
|
+
this.props.onToggle(event, expanded);
|
|
59
|
+
}
|
|
60
|
+
|
|
56
61
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
|
|
57
62
|
animate: true
|
|
58
63
|
});
|
|
@@ -64,7 +69,9 @@ let ToggleDetails = (_dec = withStyle(generateStyle, generateComponentTheme), _d
|
|
|
64
69
|
}
|
|
65
70
|
|
|
66
71
|
focus() {
|
|
67
|
-
|
|
72
|
+
var _this$_button;
|
|
73
|
+
|
|
74
|
+
(_this$_button = this._button) === null || _this$_button === void 0 ? void 0 : _this$_button.focus();
|
|
68
75
|
}
|
|
69
76
|
|
|
70
77
|
componentDidMount() {
|
|
@@ -100,7 +107,8 @@ let ToggleDetails = (_dec = withStyle(generateStyle, generateComponentTheme), _d
|
|
|
100
107
|
const variant = this.props.variant;
|
|
101
108
|
const props = { ...omitProps(this.props, ToggleDetails.allowedProps),
|
|
102
109
|
...toggleProps,
|
|
103
|
-
children: this.renderSummary()
|
|
110
|
+
children: this.renderSummary(expanded) // spread operator makes toggleProps loose Record<string, any>>
|
|
111
|
+
|
|
104
112
|
};
|
|
105
113
|
const summary = this.renderSummary(expanded);
|
|
106
114
|
|
|
@@ -132,7 +140,7 @@ let ToggleDetails = (_dec = withStyle(generateStyle, generateComponentTheme), _d
|
|
|
132
140
|
var _this$props$styles5;
|
|
133
141
|
|
|
134
142
|
const Icon = expanded ? this.props.iconExpanded : this.props.icon;
|
|
135
|
-
return this.props.children ? jsx("span", {
|
|
143
|
+
return this.props.children && Icon ? jsx("span", {
|
|
136
144
|
css: (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.icon
|
|
137
145
|
}, jsx(Icon, null)) : null;
|
|
138
146
|
}
|
|
@@ -185,7 +193,6 @@ let ToggleDetails = (_dec = withStyle(generateStyle, generateComponentTheme), _d
|
|
|
185
193
|
iconExpanded: IconArrowOpenDownSolid,
|
|
186
194
|
iconPosition: 'start',
|
|
187
195
|
defaultExpanded: false,
|
|
188
|
-
onToggle: function (event, expanded) {},
|
|
189
196
|
children: null
|
|
190
197
|
}, _class2)) || _class) || _class);
|
|
191
198
|
export default ToggleDetails;
|
|
@@ -25,51 +25,15 @@ import PropTypes from 'prop-types';
|
|
|
25
25
|
import { controllable } from '@instructure/ui-prop-types';
|
|
26
26
|
const propTypes = {
|
|
27
27
|
variant: PropTypes.oneOf(['default', 'filled']),
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* The summary that displays and can be interacted with
|
|
31
|
-
*/
|
|
32
28
|
summary: PropTypes.node.isRequired,
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Whether the content is expanded or hidden
|
|
36
|
-
*/
|
|
37
29
|
expanded: controllable(PropTypes.bool, 'onToggle', 'defaultExpanded'),
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Whether the content is initially expanded or hidden (uncontrolled)
|
|
41
|
-
*/
|
|
42
30
|
defaultExpanded: PropTypes.bool,
|
|
43
31
|
onToggle: PropTypes.func,
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* The icon to display next to the summary text when content is hidden
|
|
47
|
-
*/
|
|
48
32
|
icon: PropTypes.func,
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* The icon to display when content is expanded
|
|
52
|
-
*/
|
|
53
33
|
iconExpanded: PropTypes.func,
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Icon position at the start or end of the summary text
|
|
57
|
-
*/
|
|
58
34
|
iconPosition: PropTypes.oneOf(['start', 'end']),
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* should the summary fill the width of its container
|
|
62
|
-
*/
|
|
63
35
|
fluidWidth: PropTypes.bool,
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* The toggleable content passed inside the ToggleDetails component
|
|
67
|
-
*/
|
|
68
36
|
children: PropTypes.node,
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Choose a size for the expand/collapse icon
|
|
72
|
-
*/
|
|
73
37
|
size: PropTypes.oneOf(['small', 'medium', 'large'])
|
|
74
38
|
};
|
|
75
39
|
const allowedProps = ['variant', 'summary', 'expanded', 'defaultExpanded', 'onToggle', 'icon', 'iconExpanded', 'iconPosition', 'fluidWidth', 'children', 'size'];
|
|
@@ -48,5 +48,6 @@ export const customMethods = {
|
|
|
48
48
|
return null;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
};
|
|
51
|
+
}; // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
52
|
+
|
|
52
53
|
export const ToggleGroupLocator = locator(ToggleGroup.selector, customMethods);
|
package/es/ToggleGroup/index.js
CHANGED
|
@@ -24,7 +24,7 @@ var _dec, _class, _class2;
|
|
|
24
24
|
* SOFTWARE.
|
|
25
25
|
*/
|
|
26
26
|
import React, { Component } from 'react';
|
|
27
|
-
import { omitProps, pickProps, getElementType } from '@instructure/ui-react-utils';
|
|
27
|
+
import { omitProps, pickProps, getElementType, callRenderProp } from '@instructure/ui-react-utils';
|
|
28
28
|
import { IconButton } from '@instructure/ui-buttons';
|
|
29
29
|
import { Transition } from '@instructure/ui-motion';
|
|
30
30
|
import { Expandable } from '@instructure/ui-expandable';
|
|
@@ -38,6 +38,7 @@ import { allowedProps, propTypes } from './props';
|
|
|
38
38
|
---
|
|
39
39
|
category: components
|
|
40
40
|
---
|
|
41
|
+
@tsProps
|
|
41
42
|
**/
|
|
42
43
|
|
|
43
44
|
let ToggleGroup = (_dec = testable(), _dec(_class = (_class2 = class ToggleGroup extends Component {
|
|
@@ -66,7 +67,9 @@ let ToggleGroup = (_dec = testable(), _dec(_class = (_class2 = class ToggleGroup
|
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
focus() {
|
|
69
|
-
|
|
70
|
+
var _this$_button;
|
|
71
|
+
|
|
72
|
+
(_this$_button = this._button) === null || _this$_button === void 0 ? void 0 : _this$_button.focus();
|
|
70
73
|
}
|
|
71
74
|
|
|
72
75
|
componentDidMount() {
|
|
@@ -75,7 +78,7 @@ let ToggleGroup = (_dec = testable(), _dec(_class = (_class2 = class ToggleGroup
|
|
|
75
78
|
|
|
76
79
|
renderIcon(expanded) {
|
|
77
80
|
const Icon = expanded ? this.props.iconExpanded : this.props.icon;
|
|
78
|
-
return
|
|
81
|
+
return Icon ? callRenderProp(Icon) : null;
|
|
79
82
|
}
|
|
80
83
|
|
|
81
84
|
renderToggle(toggleProps, expanded) {
|
|
@@ -90,7 +93,9 @@ let ToggleGroup = (_dec = testable(), _dec(_class = (_class2 = class ToggleGroup
|
|
|
90
93
|
label = toggleLabel;
|
|
91
94
|
}
|
|
92
95
|
|
|
93
|
-
|
|
96
|
+
const props = { ...toggleProps
|
|
97
|
+
};
|
|
98
|
+
return /*#__PURE__*/React.createElement(IconButton, Object.assign({}, props, {
|
|
94
99
|
withBackground: false,
|
|
95
100
|
withBorder: false,
|
|
96
101
|
size: size === 'large' ? 'medium' : 'small',
|
|
@@ -138,10 +143,8 @@ let ToggleGroup = (_dec = testable(), _dec(_class = (_class2 = class ToggleGroup
|
|
|
138
143
|
icon: IconArrowOpenEndSolid,
|
|
139
144
|
iconExpanded: IconArrowOpenDownSolid,
|
|
140
145
|
defaultExpanded: false,
|
|
141
|
-
onToggle: function (event, expanded) {},
|
|
142
146
|
transition: true,
|
|
143
147
|
as: 'span',
|
|
144
|
-
elementRef: el => {},
|
|
145
148
|
border: true
|
|
146
149
|
}, _class2)) || _class);
|
|
147
150
|
export default ToggleGroup;
|
package/es/ToggleGroup/props.js
CHANGED
|
@@ -24,66 +24,18 @@
|
|
|
24
24
|
import PropTypes from 'prop-types';
|
|
25
25
|
import { controllable } from '@instructure/ui-prop-types';
|
|
26
26
|
const propTypes = {
|
|
27
|
-
/**
|
|
28
|
-
* the content to show and hide
|
|
29
|
-
*/
|
|
30
27
|
children: PropTypes.node.isRequired,
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* the content area next to the toggle button
|
|
34
|
-
*/
|
|
35
28
|
summary: PropTypes.node.isRequired,
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* provides a screenreader label for the toggle button
|
|
39
|
-
* (takes `expanded` as an argument if a function)
|
|
40
|
-
*/
|
|
41
29
|
toggleLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* the element type to render as
|
|
45
|
-
*/
|
|
46
30
|
as: PropTypes.elementType,
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* provides a reference to the underlying html root element
|
|
50
|
-
*/
|
|
51
31
|
elementRef: PropTypes.func,
|
|
52
32
|
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Whether the content is expanded or hidden
|
|
56
|
-
*/
|
|
57
33
|
expanded: controllable(PropTypes.bool, 'onToggle', 'defaultExpanded'),
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Whether the content is initially expanded or hidden (uncontrolled)
|
|
61
|
-
*/
|
|
62
34
|
defaultExpanded: PropTypes.bool,
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Fired when the content display is toggled
|
|
66
|
-
*/
|
|
67
35
|
onToggle: PropTypes.func,
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* The icon displayed in the toggle button when the content is hidden
|
|
71
|
-
*/
|
|
72
36
|
icon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* The icon displayed in the toggle button when the content is showing
|
|
76
|
-
*/
|
|
77
37
|
iconExpanded: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Transition content into view
|
|
81
|
-
*/
|
|
82
38
|
transition: PropTypes.bool,
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Toggle the border around the component
|
|
86
|
-
*/
|
|
87
39
|
border: PropTypes.bool
|
|
88
40
|
};
|
|
89
41
|
const allowedProps = ['children', 'summary', 'toggleLabel', 'as', 'elementRef', 'size', 'expanded', 'defaultExpanded', 'onToggle', 'icon', 'iconExpanded', 'transition', 'border'];
|
|
@@ -63,5 +63,6 @@ const customMethods = {
|
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
exports.customMethods = customMethods;
|
|
66
|
-
const ToggleDetailsLocator = (0, _locator.locator)(
|
|
66
|
+
const ToggleDetailsLocator = (0, _locator.locator)( // @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
|
+
_index.ToggleDetails.selector, customMethods);
|
|
67
68
|
exports.ToggleDetailsLocator = ToggleDetailsLocator;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
|
|
3
5
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
6
|
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -7,7 +9,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
9
|
});
|
|
8
10
|
exports.default = exports.ToggleDetails = void 0;
|
|
9
11
|
|
|
10
|
-
var _react = require("react");
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
13
|
|
|
12
14
|
var _Button = require("@instructure/ui-buttons/lib/Button");
|
|
13
15
|
|
|
@@ -39,18 +41,23 @@ var _dec, _dec2, _class, _class2;
|
|
|
39
41
|
---
|
|
40
42
|
category: components
|
|
41
43
|
---
|
|
44
|
+
@tsProps
|
|
42
45
|
**/
|
|
43
46
|
let ToggleDetails = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_class2 = class ToggleDetails extends _react.Component {
|
|
44
47
|
constructor() {
|
|
45
48
|
super(...arguments);
|
|
46
49
|
this.ref = null;
|
|
50
|
+
this._button = null;
|
|
47
51
|
|
|
48
52
|
this.getButtonRef = el => this._button = el;
|
|
49
53
|
|
|
50
54
|
this.handleToggle = (event, expanded) => {
|
|
51
55
|
var _this$props$makeStyle, _this$props;
|
|
52
56
|
|
|
53
|
-
this.props.onToggle
|
|
57
|
+
if (typeof this.props.onToggle === 'function') {
|
|
58
|
+
this.props.onToggle(event, expanded);
|
|
59
|
+
}
|
|
60
|
+
|
|
54
61
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
|
|
55
62
|
animate: true
|
|
56
63
|
});
|
|
@@ -62,7 +69,9 @@ let ToggleDetails = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
62
69
|
}
|
|
63
70
|
|
|
64
71
|
focus() {
|
|
65
|
-
|
|
72
|
+
var _this$_button;
|
|
73
|
+
|
|
74
|
+
(_this$_button = this._button) === null || _this$_button === void 0 ? void 0 : _this$_button.focus();
|
|
66
75
|
}
|
|
67
76
|
|
|
68
77
|
componentDidMount() {
|
|
@@ -98,7 +107,8 @@ let ToggleDetails = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
98
107
|
const variant = this.props.variant;
|
|
99
108
|
const props = { ...(0, _omitProps.omitProps)(this.props, ToggleDetails.allowedProps),
|
|
100
109
|
...toggleProps,
|
|
101
|
-
children: this.renderSummary()
|
|
110
|
+
children: this.renderSummary(expanded) // spread operator makes toggleProps loose Record<string, any>>
|
|
111
|
+
|
|
102
112
|
};
|
|
103
113
|
const summary = this.renderSummary(expanded);
|
|
104
114
|
|
|
@@ -130,7 +140,7 @@ let ToggleDetails = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
130
140
|
var _this$props$styles5;
|
|
131
141
|
|
|
132
142
|
const Icon = expanded ? this.props.iconExpanded : this.props.icon;
|
|
133
|
-
return this.props.children ? (0, _emotion.jsx)("span", {
|
|
143
|
+
return this.props.children && Icon ? (0, _emotion.jsx)("span", {
|
|
134
144
|
css: (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.icon
|
|
135
145
|
}, (0, _emotion.jsx)(Icon, null)) : null;
|
|
136
146
|
}
|
|
@@ -183,7 +193,6 @@ let ToggleDetails = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
183
193
|
iconExpanded: _IconArrowOpenDownSolid.IconArrowOpenDownSolid,
|
|
184
194
|
iconPosition: 'start',
|
|
185
195
|
defaultExpanded: false,
|
|
186
|
-
onToggle: function (event, expanded) {},
|
|
187
196
|
children: null
|
|
188
197
|
}, _class2)) || _class) || _class);
|
|
189
198
|
exports.ToggleDetails = ToggleDetails;
|
|
@@ -36,51 +36,15 @@ var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
|
|
|
36
36
|
*/
|
|
37
37
|
const propTypes = {
|
|
38
38
|
variant: _propTypes.default.oneOf(['default', 'filled']),
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* The summary that displays and can be interacted with
|
|
42
|
-
*/
|
|
43
39
|
summary: _propTypes.default.node.isRequired,
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Whether the content is expanded or hidden
|
|
47
|
-
*/
|
|
48
40
|
expanded: (0, _controllable.controllable)(_propTypes.default.bool, 'onToggle', 'defaultExpanded'),
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Whether the content is initially expanded or hidden (uncontrolled)
|
|
52
|
-
*/
|
|
53
41
|
defaultExpanded: _propTypes.default.bool,
|
|
54
42
|
onToggle: _propTypes.default.func,
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* The icon to display next to the summary text when content is hidden
|
|
58
|
-
*/
|
|
59
43
|
icon: _propTypes.default.func,
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* The icon to display when content is expanded
|
|
63
|
-
*/
|
|
64
44
|
iconExpanded: _propTypes.default.func,
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Icon position at the start or end of the summary text
|
|
68
|
-
*/
|
|
69
45
|
iconPosition: _propTypes.default.oneOf(['start', 'end']),
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* should the summary fill the width of its container
|
|
73
|
-
*/
|
|
74
46
|
fluidWidth: _propTypes.default.bool,
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* The toggleable content passed inside the ToggleDetails component
|
|
78
|
-
*/
|
|
79
47
|
children: _propTypes.default.node,
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Choose a size for the expand/collapse icon
|
|
83
|
-
*/
|
|
84
48
|
size: _propTypes.default.oneOf(['small', 'medium', 'large'])
|
|
85
49
|
};
|
|
86
50
|
exports.propTypes = propTypes;
|
|
@@ -57,7 +57,8 @@ const customMethods = {
|
|
|
57
57
|
return null;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
};
|
|
60
|
+
}; // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
61
|
+
|
|
61
62
|
exports.customMethods = customMethods;
|
|
62
63
|
const ToggleGroupLocator = (0, _locator.locator)(_index.ToggleGroup.selector, customMethods);
|
|
63
64
|
exports.ToggleGroupLocator = ToggleGroupLocator;
|
package/lib/ToggleGroup/index.js
CHANGED
|
@@ -15,6 +15,8 @@ var _pickProps = require("@instructure/ui-react-utils/lib/pickProps.js");
|
|
|
15
15
|
|
|
16
16
|
var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
|
|
17
17
|
|
|
18
|
+
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
19
|
+
|
|
18
20
|
var _IconButton = require("@instructure/ui-buttons/lib/IconButton");
|
|
19
21
|
|
|
20
22
|
var _Transition = require("@instructure/ui-motion/lib/Transition");
|
|
@@ -41,6 +43,7 @@ var _dec, _class, _class2;
|
|
|
41
43
|
---
|
|
42
44
|
category: components
|
|
43
45
|
---
|
|
46
|
+
@tsProps
|
|
44
47
|
**/
|
|
45
48
|
let ToggleGroup = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 = class ToggleGroup extends _react.Component {
|
|
46
49
|
constructor() {
|
|
@@ -68,7 +71,9 @@ let ToggleGroup = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 = cl
|
|
|
68
71
|
}
|
|
69
72
|
|
|
70
73
|
focus() {
|
|
71
|
-
|
|
74
|
+
var _this$_button;
|
|
75
|
+
|
|
76
|
+
(_this$_button = this._button) === null || _this$_button === void 0 ? void 0 : _this$_button.focus();
|
|
72
77
|
}
|
|
73
78
|
|
|
74
79
|
componentDidMount() {
|
|
@@ -77,7 +82,7 @@ let ToggleGroup = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 = cl
|
|
|
77
82
|
|
|
78
83
|
renderIcon(expanded) {
|
|
79
84
|
const Icon = expanded ? this.props.iconExpanded : this.props.icon;
|
|
80
|
-
return
|
|
85
|
+
return Icon ? (0, _callRenderProp.callRenderProp)(Icon) : null;
|
|
81
86
|
}
|
|
82
87
|
|
|
83
88
|
renderToggle(toggleProps, expanded) {
|
|
@@ -92,7 +97,9 @@ let ToggleGroup = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 = cl
|
|
|
92
97
|
label = toggleLabel;
|
|
93
98
|
}
|
|
94
99
|
|
|
95
|
-
|
|
100
|
+
const props = { ...toggleProps
|
|
101
|
+
};
|
|
102
|
+
return /*#__PURE__*/_react.default.createElement(_IconButton.IconButton, Object.assign({}, props, {
|
|
96
103
|
withBackground: false,
|
|
97
104
|
withBorder: false,
|
|
98
105
|
size: size === 'large' ? 'medium' : 'small',
|
|
@@ -140,10 +147,8 @@ let ToggleGroup = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 = cl
|
|
|
140
147
|
icon: _IconArrowOpenEndSolid.IconArrowOpenEndSolid,
|
|
141
148
|
iconExpanded: _IconArrowOpenDownSolid.IconArrowOpenDownSolid,
|
|
142
149
|
defaultExpanded: false,
|
|
143
|
-
onToggle: function (event, expanded) {},
|
|
144
150
|
transition: true,
|
|
145
151
|
as: 'span',
|
|
146
|
-
elementRef: el => {},
|
|
147
152
|
border: true
|
|
148
153
|
}, _class2)) || _class);
|
|
149
154
|
exports.ToggleGroup = ToggleGroup;
|
package/lib/ToggleGroup/props.js
CHANGED
|
@@ -35,66 +35,18 @@ var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
|
|
|
35
35
|
* SOFTWARE.
|
|
36
36
|
*/
|
|
37
37
|
const propTypes = {
|
|
38
|
-
/**
|
|
39
|
-
* the content to show and hide
|
|
40
|
-
*/
|
|
41
38
|
children: _propTypes.default.node.isRequired,
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* the content area next to the toggle button
|
|
45
|
-
*/
|
|
46
39
|
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
40
|
toggleLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired,
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* the element type to render as
|
|
56
|
-
*/
|
|
57
41
|
as: _propTypes.default.elementType,
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* provides a reference to the underlying html root element
|
|
61
|
-
*/
|
|
62
42
|
elementRef: _propTypes.default.func,
|
|
63
43
|
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Whether the content is expanded or hidden
|
|
67
|
-
*/
|
|
68
44
|
expanded: (0, _controllable.controllable)(_propTypes.default.bool, 'onToggle', 'defaultExpanded'),
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Whether the content is initially expanded or hidden (uncontrolled)
|
|
72
|
-
*/
|
|
73
45
|
defaultExpanded: _propTypes.default.bool,
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Fired when the content display is toggled
|
|
77
|
-
*/
|
|
78
46
|
onToggle: _propTypes.default.func,
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* The icon displayed in the toggle button when the content is hidden
|
|
82
|
-
*/
|
|
83
47
|
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
48
|
iconExpanded: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Transition content into view
|
|
92
|
-
*/
|
|
93
49
|
transition: _propTypes.default.bool,
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Toggle the border around the component
|
|
97
|
-
*/
|
|
98
50
|
border: _propTypes.default.bool
|
|
99
51
|
};
|
|
100
52
|
exports.propTypes = propTypes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-toggle-details",
|
|
3
|
-
"version": "8.24.
|
|
3
|
+
"version": "8.24.6-snapshot.8+04059ead3",
|
|
4
4
|
"description": "A styled toggleable, accordion-like component.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,29 +23,29 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "8.24.
|
|
27
|
-
"@instructure/ui-test-locator": "8.24.
|
|
28
|
-
"@instructure/ui-test-queries": "8.24.
|
|
29
|
-
"@instructure/ui-test-utils": "8.24.
|
|
30
|
-
"@instructure/ui-themes": "8.24.
|
|
26
|
+
"@instructure/ui-babel-preset": "8.24.6-snapshot.8+04059ead3",
|
|
27
|
+
"@instructure/ui-test-locator": "8.24.6-snapshot.8+04059ead3",
|
|
28
|
+
"@instructure/ui-test-queries": "8.24.6-snapshot.8+04059ead3",
|
|
29
|
+
"@instructure/ui-test-utils": "8.24.6-snapshot.8+04059ead3",
|
|
30
|
+
"@instructure/ui-themes": "8.24.6-snapshot.8+04059ead3"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.13.10",
|
|
34
|
-
"@instructure/emotion": "8.24.
|
|
35
|
-
"@instructure/shared-types": "8.24.
|
|
36
|
-
"@instructure/ui-buttons": "8.24.
|
|
37
|
-
"@instructure/ui-dom-utils": "8.24.
|
|
38
|
-
"@instructure/ui-expandable": "8.24.
|
|
39
|
-
"@instructure/ui-flex": "8.24.
|
|
40
|
-
"@instructure/ui-icons": "8.24.
|
|
41
|
-
"@instructure/ui-menu": "8.24.
|
|
42
|
-
"@instructure/ui-motion": "8.24.
|
|
43
|
-
"@instructure/ui-prop-types": "8.24.
|
|
44
|
-
"@instructure/ui-react-utils": "8.24.
|
|
45
|
-
"@instructure/ui-testable": "8.24.
|
|
46
|
-
"@instructure/ui-utils": "8.24.
|
|
47
|
-
"@instructure/ui-view": "8.24.
|
|
48
|
-
"@instructure/uid": "8.24.
|
|
34
|
+
"@instructure/emotion": "8.24.6-snapshot.8+04059ead3",
|
|
35
|
+
"@instructure/shared-types": "8.24.6-snapshot.8+04059ead3",
|
|
36
|
+
"@instructure/ui-buttons": "8.24.6-snapshot.8+04059ead3",
|
|
37
|
+
"@instructure/ui-dom-utils": "8.24.6-snapshot.8+04059ead3",
|
|
38
|
+
"@instructure/ui-expandable": "8.24.6-snapshot.8+04059ead3",
|
|
39
|
+
"@instructure/ui-flex": "8.24.6-snapshot.8+04059ead3",
|
|
40
|
+
"@instructure/ui-icons": "8.24.6-snapshot.8+04059ead3",
|
|
41
|
+
"@instructure/ui-menu": "8.24.6-snapshot.8+04059ead3",
|
|
42
|
+
"@instructure/ui-motion": "8.24.6-snapshot.8+04059ead3",
|
|
43
|
+
"@instructure/ui-prop-types": "8.24.6-snapshot.8+04059ead3",
|
|
44
|
+
"@instructure/ui-react-utils": "8.24.6-snapshot.8+04059ead3",
|
|
45
|
+
"@instructure/ui-testable": "8.24.6-snapshot.8+04059ead3",
|
|
46
|
+
"@instructure/ui-utils": "8.24.6-snapshot.8+04059ead3",
|
|
47
|
+
"@instructure/ui-view": "8.24.6-snapshot.8+04059ead3",
|
|
48
|
+
"@instructure/uid": "8.24.6-snapshot.8+04059ead3",
|
|
49
49
|
"prop-types": "^15"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
@@ -54,5 +54,6 @@
|
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
-
"sideEffects": false
|
|
57
|
+
"sideEffects": false,
|
|
58
|
+
"gitHead": "04059ead31f299766bd01b88105f2793456f1973"
|
|
58
59
|
}
|