@instructure/ui-toggle-details 10.26.1 → 11.0.1-snapshot-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 CHANGED
@@ -3,7 +3,7 @@
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
- ## [10.26.1](https://github.com/instructure/instructure-ui/compare/v10.26.0...v10.26.1) (2025-10-06)
6
+ ## [11.0.1-snapshot-0](https://github.com/instructure/instructure-ui/compare/v11.0.0...v11.0.1-snapshot-0) (2025-10-07)
7
7
 
8
8
  **Note:** Version bump only for package @instructure/ui-toggle-details
9
9
 
@@ -11,6 +11,35 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
11
11
 
12
12
 
13
13
 
14
+ # [11.0.0](https://github.com/instructure/instructure-ui/compare/v10.26.0...v11.0.0) (2025-10-06)
15
+
16
+
17
+ ### Features
18
+
19
+ * **many:** instUI v11 release ([36f5438](https://github.com/instructure/instructure-ui/commit/36f54382669186227ba24798bbf7201ef2f5cd4c))
20
+
21
+
22
+ ### BREAKING CHANGES
23
+
24
+ * **many:** InstUI v11 contains the following breaking changes:
25
+ - React 16 and 17 are no longer supported
26
+ - remove `PropTypes` from all packages
27
+ - remove `CodeEditor` component
28
+ - remove `@instui/theme-registry` package
29
+ - remove `@testable`, `@experimental`, `@hack` decorators
30
+ - InstUISettingsProvider's `as` prop is removed
31
+ - `canvas.use()`, `canvasHighContrast.use()` functions are removed
32
+ - `canvasThemeLocal`, `canvasHighContrastThemeLocal` are removed
33
+ - `variables` field on theme objects are removed
34
+ - remove deprecated props from Table: Row's `isStacked`, Body's
35
+ `isStacked`, `hover`, and `headers`
36
+ - `Table`'s `caption` prop is now required
37
+ - `ui-dom-utils`'s `getComputedStyle` can now return `undefined`
38
+
39
+
40
+
41
+
42
+
14
43
  # [10.26.0](https://github.com/instructure/instructure-ui/compare/v10.25.0...v10.26.0) (2025-10-01)
15
44
 
16
45
  **Note:** Version bump only for package @instructure/ui-toggle-details
@@ -1,4 +1,4 @@
1
- var _dec, _dec2, _class, _ToggleDetails;
1
+ var _dec, _class, _ToggleDetails;
2
2
  /*
3
3
  * The MIT License (MIT)
4
4
  *
@@ -23,29 +23,31 @@ var _dec, _dec2, _class, _ToggleDetails;
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- import { Component } from 'react';
26
+ import { Component, createRef } from 'react';
27
27
  import { Button } from '@instructure/ui-buttons';
28
28
  import { IconArrowOpenEndSolid, IconArrowOpenDownSolid } from '@instructure/ui-icons';
29
29
  import { Expandable } from '@instructure/ui-expandable';
30
30
  import { omitProps, pickProps } from '@instructure/ui-react-utils';
31
31
  import { isActiveElement } from '@instructure/ui-dom-utils';
32
- import { testable } from '@instructure/ui-testable';
33
32
  import { withStyle } from '@instructure/emotion';
34
33
  import generateStyle from './styles';
35
34
  import generateComponentTheme from './theme';
36
- import { allowedProps, propTypes } from './props';
35
+ import { allowedProps } from './props';
37
36
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
38
37
  /**
39
38
  ---
40
39
  category: components
41
40
  ---
42
41
  **/
43
- let ToggleDetails = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_ToggleDetails = class ToggleDetails extends Component {
42
+ let ToggleDetails = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_ToggleDetails = class ToggleDetails extends Component {
44
43
  constructor(...args) {
45
44
  super(...args);
46
- this.ref = null;
47
- this._button = null;
48
- this.getButtonRef = el => this._button = el;
45
+ this._buttonNode = null;
46
+ this.ref = /*#__PURE__*/createRef();
47
+ // TODO this solution was generated with Gemini, should be tested if it works as fine as before
48
+ this.setButtonRef = node => {
49
+ this._buttonNode = node;
50
+ };
49
51
  this.handleToggle = (event, expanded) => {
50
52
  if (typeof this.props.onToggle === 'function') {
51
53
  this.props.onToggle(event, expanded);
@@ -53,11 +55,11 @@ let ToggleDetails = (_dec = withStyle(generateStyle, generateComponentTheme), _d
53
55
  };
54
56
  }
55
57
  get focused() {
56
- return isActiveElement(this._button);
58
+ return isActiveElement(this._buttonNode);
57
59
  }
58
60
  focus() {
59
- var _this$_button;
60
- (_this$_button = this._button) === null || _this$_button === void 0 ? void 0 : _this$_button.focus();
61
+ var _this$_buttonNode;
62
+ (_this$_buttonNode = this._buttonNode) === null || _this$_buttonNode === void 0 ? void 0 : _this$_buttonNode.focus();
61
63
  }
62
64
  componentDidMount() {
63
65
  var _this$props$makeStyle, _this$props;
@@ -82,8 +84,6 @@ let ToggleDetails = (_dec = withStyle(generateStyle, generateComponentTheme), _d
82
84
  }
83
85
  renderToggle(toggleProps, expanded) {
84
86
  const variant = this.props.variant;
85
- // Do not put aria-controls and aria-expanded into the toggle if there
86
- // is nothing to open
87
87
  const tProps = this.props.children ? toggleProps : {
88
88
  onClick: toggleProps.onClick
89
89
  };
@@ -98,7 +98,7 @@ let ToggleDetails = (_dec = withStyle(generateStyle, generateComponentTheme), _d
98
98
  ...props,
99
99
  display: "block",
100
100
  textAlign: "start",
101
- elementRef: this.getButtonRef,
101
+ elementRef: this.setButtonRef,
102
102
  children: summary
103
103
  });
104
104
  } else if (props.href) {
@@ -106,7 +106,7 @@ let ToggleDetails = (_dec = withStyle(generateStyle, generateComponentTheme), _d
106
106
  return _jsx("a", {
107
107
  ...props,
108
108
  css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.toggle,
109
- ref: this.getButtonRef,
109
+ ref: this.setButtonRef,
110
110
  children: summary
111
111
  });
112
112
  } else {
@@ -115,7 +115,7 @@ let ToggleDetails = (_dec = withStyle(generateStyle, generateComponentTheme), _d
115
115
  ...props,
116
116
  type: "button",
117
117
  css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.toggle,
118
- ref: this.getButtonRef,
118
+ ref: this.setButtonRef,
119
119
  children: summary
120
120
  });
121
121
  }
@@ -161,15 +161,14 @@ let ToggleDetails = (_dec = withStyle(generateStyle, generateComponentTheme), _d
161
161
  var _this$props$styles8;
162
162
  return _jsxs("div", {
163
163
  css: (_this$props$styles8 = this.props.styles) === null || _this$props$styles8 === void 0 ? void 0 : _this$props$styles8.toggleDetails,
164
- ref: el => {
165
- this.ref = el;
166
- },
164
+ ref: this.ref,
165
+ "data-cid": "ToggleDetails",
167
166
  children: [this.renderToggle(getToggleProps(), expanded), this.renderDetails(expanded, getDetailsProps())]
168
167
  });
169
168
  }
170
169
  });
171
170
  }
172
- }, _ToggleDetails.displayName = "ToggleDetails", _ToggleDetails.componentId = 'ToggleDetails', _ToggleDetails.allowedProps = allowedProps, _ToggleDetails.propTypes = propTypes, _ToggleDetails.defaultProps = {
171
+ }, _ToggleDetails.displayName = "ToggleDetails", _ToggleDetails.componentId = 'ToggleDetails', _ToggleDetails.allowedProps = allowedProps, _ToggleDetails.defaultProps = {
173
172
  variant: 'default',
174
173
  size: 'medium',
175
174
  fluidWidth: false,
@@ -178,6 +177,6 @@ let ToggleDetails = (_dec = withStyle(generateStyle, generateComponentTheme), _d
178
177
  iconPosition: 'start',
179
178
  defaultExpanded: false,
180
179
  children: null
181
- }, _ToggleDetails)) || _class) || _class);
180
+ }, _ToggleDetails)) || _class);
182
181
  export default ToggleDetails;
183
182
  export { ToggleDetails };
@@ -22,20 +22,5 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import PropTypes from 'prop-types';
26
- import { controllable } from '@instructure/ui-prop-types';
27
- const propTypes = {
28
- variant: PropTypes.oneOf(['default', 'filled']),
29
- summary: PropTypes.node.isRequired,
30
- expanded: controllable(PropTypes.bool, 'onToggle', 'defaultExpanded'),
31
- defaultExpanded: PropTypes.bool,
32
- onToggle: PropTypes.func,
33
- icon: PropTypes.func,
34
- iconExpanded: PropTypes.func,
35
- iconPosition: PropTypes.oneOf(['start', 'end']),
36
- fluidWidth: PropTypes.bool,
37
- children: PropTypes.node,
38
- size: PropTypes.oneOf(['small', 'medium', 'large'])
39
- };
40
25
  const allowedProps = ['variant', 'summary', 'expanded', 'defaultExpanded', 'onToggle', 'icon', 'iconExpanded', 'iconPosition', 'fluidWidth', 'children', 'size'];
41
- export { propTypes, allowedProps };
26
+ export { allowedProps };
@@ -1,4 +1,4 @@
1
- var _dec, _dec2, _class, _ToggleGroup;
1
+ var _dec, _class, _ToggleGroup;
2
2
  /*
3
3
  * The MIT License (MIT)
4
4
  *
@@ -32,8 +32,7 @@ import { isActiveElement } from '@instructure/ui-dom-utils';
32
32
  import { Flex } from '@instructure/ui-flex';
33
33
  import { View } from '@instructure/ui-view';
34
34
  import { IconArrowOpenEndSolid, IconArrowOpenDownSolid } from '@instructure/ui-icons';
35
- import { testable } from '@instructure/ui-testable';
36
- import { allowedProps, propTypes } from './props';
35
+ import { allowedProps } from './props';
37
36
  import { withStyle } from '@instructure/emotion';
38
37
  import generateStyle from './styles';
39
38
  import generateComponentTheme from './theme';
@@ -44,7 +43,7 @@ category: components
44
43
  ---
45
44
  **/
46
45
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
47
- let ToggleGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_ToggleGroup = class ToggleGroup extends Component {
46
+ let ToggleGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_ToggleGroup = class ToggleGroup extends Component {
48
47
  constructor(...args) {
49
48
  super(...args);
50
49
  this.ref = null;
@@ -136,6 +135,7 @@ let ToggleGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
136
135
  borderRadius: "medium",
137
136
  background: "primary",
138
137
  borderColor: styles === null || styles === void 0 ? void 0 : styles.borderColor,
138
+ "data-cid": "ToggleGroup",
139
139
  children: [_jsxs(Flex, {
140
140
  padding: this.props.size === 'small' ? 'x-small' : 'small small small x-small',
141
141
  children: [_jsx(Flex.Item, {
@@ -153,7 +153,7 @@ let ToggleGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
153
153
  }
154
154
  });
155
155
  }
156
- }, _ToggleGroup.displayName = "ToggleGroup", _ToggleGroup.componentId = 'ToggleGroup', _ToggleGroup.allowedProps = allowedProps, _ToggleGroup.propTypes = propTypes, _ToggleGroup.defaultProps = {
156
+ }, _ToggleGroup.displayName = "ToggleGroup", _ToggleGroup.componentId = 'ToggleGroup', _ToggleGroup.allowedProps = allowedProps, _ToggleGroup.defaultProps = {
157
157
  size: 'medium',
158
158
  icon: IconArrowOpenEndSolid,
159
159
  iconExpanded: IconArrowOpenDownSolid,
@@ -161,6 +161,6 @@ let ToggleGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
161
161
  transition: true,
162
162
  as: 'span',
163
163
  border: true
164
- }, _ToggleGroup)) || _class) || _class);
164
+ }, _ToggleGroup)) || _class);
165
165
  export default ToggleGroup;
166
166
  export { ToggleGroup };
@@ -22,22 +22,5 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import PropTypes from 'prop-types';
26
- import { controllable } from '@instructure/ui-prop-types';
27
- const propTypes = {
28
- children: PropTypes.node.isRequired,
29
- summary: PropTypes.node.isRequired,
30
- toggleLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
31
- as: PropTypes.elementType,
32
- elementRef: PropTypes.func,
33
- size: PropTypes.oneOf(['small', 'medium', 'large']),
34
- expanded: controllable(PropTypes.bool, 'onToggle', 'defaultExpanded'),
35
- defaultExpanded: PropTypes.bool,
36
- onToggle: PropTypes.func,
37
- icon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
38
- iconExpanded: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
39
- transition: PropTypes.bool,
40
- border: PropTypes.bool
41
- };
42
25
  const allowedProps = ['children', 'summary', 'toggleLabel', 'as', 'elementRef', 'size', 'expanded', 'defaultExpanded', 'onToggle', 'icon', 'iconExpanded', 'transition', 'border'];
43
- export { propTypes, allowedProps };
26
+ export { allowedProps };
@@ -13,13 +13,12 @@ var _Expandable = require("@instructure/ui-expandable/lib/Expandable");
13
13
  var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
14
14
  var _pickProps = require("@instructure/ui-react-utils/lib/pickProps.js");
15
15
  var _isActiveElement = require("@instructure/ui-dom-utils/lib/isActiveElement.js");
16
- var _testable = require("@instructure/ui-testable/lib/testable.js");
17
16
  var _emotion = require("@instructure/emotion");
18
17
  var _styles = _interopRequireDefault(require("./styles"));
19
18
  var _theme = _interopRequireDefault(require("./theme"));
20
19
  var _props = require("./props");
21
20
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
22
- var _dec, _dec2, _class, _ToggleDetails;
21
+ var _dec, _class, _ToggleDetails;
23
22
  /*
24
23
  * The MIT License (MIT)
25
24
  *
@@ -48,12 +47,15 @@ var _dec, _dec2, _class, _ToggleDetails;
48
47
  category: components
49
48
  ---
50
49
  **/
51
- let ToggleDetails = exports.ToggleDetails = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_ToggleDetails = class ToggleDetails extends _react.Component {
50
+ let ToggleDetails = exports.ToggleDetails = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_ToggleDetails = class ToggleDetails extends _react.Component {
52
51
  constructor(...args) {
53
52
  super(...args);
54
- this.ref = null;
55
- this._button = null;
56
- this.getButtonRef = el => this._button = el;
53
+ this._buttonNode = null;
54
+ this.ref = /*#__PURE__*/(0, _react.createRef)();
55
+ // TODO this solution was generated with Gemini, should be tested if it works as fine as before
56
+ this.setButtonRef = node => {
57
+ this._buttonNode = node;
58
+ };
57
59
  this.handleToggle = (event, expanded) => {
58
60
  if (typeof this.props.onToggle === 'function') {
59
61
  this.props.onToggle(event, expanded);
@@ -61,11 +63,11 @@ let ToggleDetails = exports.ToggleDetails = (_dec = (0, _emotion.withStyle)(_sty
61
63
  };
62
64
  }
63
65
  get focused() {
64
- return (0, _isActiveElement.isActiveElement)(this._button);
66
+ return (0, _isActiveElement.isActiveElement)(this._buttonNode);
65
67
  }
66
68
  focus() {
67
- var _this$_button;
68
- (_this$_button = this._button) === null || _this$_button === void 0 ? void 0 : _this$_button.focus();
69
+ var _this$_buttonNode;
70
+ (_this$_buttonNode = this._buttonNode) === null || _this$_buttonNode === void 0 ? void 0 : _this$_buttonNode.focus();
69
71
  }
70
72
  componentDidMount() {
71
73
  var _this$props$makeStyle, _this$props;
@@ -90,8 +92,6 @@ let ToggleDetails = exports.ToggleDetails = (_dec = (0, _emotion.withStyle)(_sty
90
92
  }
91
93
  renderToggle(toggleProps, expanded) {
92
94
  const variant = this.props.variant;
93
- // Do not put aria-controls and aria-expanded into the toggle if there
94
- // is nothing to open
95
95
  const tProps = this.props.children ? toggleProps : {
96
96
  onClick: toggleProps.onClick
97
97
  };
@@ -106,7 +106,7 @@ let ToggleDetails = exports.ToggleDetails = (_dec = (0, _emotion.withStyle)(_sty
106
106
  ...props,
107
107
  display: "block",
108
108
  textAlign: "start",
109
- elementRef: this.getButtonRef,
109
+ elementRef: this.setButtonRef,
110
110
  children: summary
111
111
  });
112
112
  } else if (props.href) {
@@ -114,7 +114,7 @@ let ToggleDetails = exports.ToggleDetails = (_dec = (0, _emotion.withStyle)(_sty
114
114
  return (0, _jsxRuntime.jsx)("a", {
115
115
  ...props,
116
116
  css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.toggle,
117
- ref: this.getButtonRef,
117
+ ref: this.setButtonRef,
118
118
  children: summary
119
119
  });
120
120
  } else {
@@ -123,7 +123,7 @@ let ToggleDetails = exports.ToggleDetails = (_dec = (0, _emotion.withStyle)(_sty
123
123
  ...props,
124
124
  type: "button",
125
125
  css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.toggle,
126
- ref: this.getButtonRef,
126
+ ref: this.setButtonRef,
127
127
  children: summary
128
128
  });
129
129
  }
@@ -169,15 +169,14 @@ let ToggleDetails = exports.ToggleDetails = (_dec = (0, _emotion.withStyle)(_sty
169
169
  var _this$props$styles8;
170
170
  return (0, _jsxRuntime.jsxs)("div", {
171
171
  css: (_this$props$styles8 = this.props.styles) === null || _this$props$styles8 === void 0 ? void 0 : _this$props$styles8.toggleDetails,
172
- ref: el => {
173
- this.ref = el;
174
- },
172
+ ref: this.ref,
173
+ "data-cid": "ToggleDetails",
175
174
  children: [this.renderToggle(getToggleProps(), expanded), this.renderDetails(expanded, getDetailsProps())]
176
175
  });
177
176
  }
178
177
  });
179
178
  }
180
- }, _ToggleDetails.displayName = "ToggleDetails", _ToggleDetails.componentId = 'ToggleDetails', _ToggleDetails.allowedProps = _props.allowedProps, _ToggleDetails.propTypes = _props.propTypes, _ToggleDetails.defaultProps = {
179
+ }, _ToggleDetails.displayName = "ToggleDetails", _ToggleDetails.componentId = 'ToggleDetails', _ToggleDetails.allowedProps = _props.allowedProps, _ToggleDetails.defaultProps = {
181
180
  variant: 'default',
182
181
  size: 'medium',
183
182
  fluidWidth: false,
@@ -186,5 +185,5 @@ let ToggleDetails = exports.ToggleDetails = (_dec = (0, _emotion.withStyle)(_sty
186
185
  iconPosition: 'start',
187
186
  defaultExpanded: false,
188
187
  children: null
189
- }, _ToggleDetails)) || _class) || _class);
188
+ }, _ToggleDetails)) || _class);
190
189
  var _default = exports.default = ToggleDetails;
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
- exports.propTypes = exports.allowedProps = void 0;
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
9
- var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
6
+ exports.allowedProps = void 0;
10
7
  /*
11
8
  * The MIT License (MIT)
12
9
  *
@@ -31,17 +28,4 @@ var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
31
28
  * SOFTWARE.
32
29
  */
33
30
 
34
- const propTypes = exports.propTypes = {
35
- variant: _propTypes.default.oneOf(['default', 'filled']),
36
- summary: _propTypes.default.node.isRequired,
37
- expanded: (0, _controllable.controllable)(_propTypes.default.bool, 'onToggle', 'defaultExpanded'),
38
- defaultExpanded: _propTypes.default.bool,
39
- onToggle: _propTypes.default.func,
40
- icon: _propTypes.default.func,
41
- iconExpanded: _propTypes.default.func,
42
- iconPosition: _propTypes.default.oneOf(['start', 'end']),
43
- fluidWidth: _propTypes.default.bool,
44
- children: _propTypes.default.node,
45
- size: _propTypes.default.oneOf(['small', 'medium', 'large'])
46
- };
47
31
  const allowedProps = exports.allowedProps = ['variant', 'summary', 'expanded', 'defaultExpanded', 'onToggle', 'icon', 'iconExpanded', 'iconPosition', 'fluidWidth', 'children', 'size'];
@@ -18,13 +18,12 @@ var _Flex = require("@instructure/ui-flex/lib/Flex");
18
18
  var _View = require("@instructure/ui-view/lib/View");
19
19
  var _IconArrowOpenEndSolid = require("@instructure/ui-icons/lib/IconArrowOpenEndSolid.js");
20
20
  var _IconArrowOpenDownSolid = require("@instructure/ui-icons/lib/IconArrowOpenDownSolid.js");
21
- var _testable = require("@instructure/ui-testable/lib/testable.js");
22
21
  var _props = require("./props");
23
22
  var _emotion = require("@instructure/emotion");
24
23
  var _styles = _interopRequireDefault(require("./styles"));
25
24
  var _theme = _interopRequireDefault(require("./theme"));
26
25
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
27
- var _dec, _dec2, _class, _ToggleGroup;
26
+ var _dec, _class, _ToggleGroup;
28
27
  /*
29
28
  * The MIT License (MIT)
30
29
  *
@@ -53,7 +52,7 @@ var _dec, _dec2, _class, _ToggleGroup;
53
52
  category: components
54
53
  ---
55
54
  **/
56
- let ToggleGroup = exports.ToggleGroup = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_ToggleGroup = class ToggleGroup extends _react.Component {
55
+ let ToggleGroup = exports.ToggleGroup = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_ToggleGroup = class ToggleGroup extends _react.Component {
57
56
  constructor(...args) {
58
57
  super(...args);
59
58
  this.ref = null;
@@ -145,6 +144,7 @@ let ToggleGroup = exports.ToggleGroup = (_dec = (0, _emotion.withStyle)(_styles.
145
144
  borderRadius: "medium",
146
145
  background: "primary",
147
146
  borderColor: styles === null || styles === void 0 ? void 0 : styles.borderColor,
147
+ "data-cid": "ToggleGroup",
148
148
  children: [(0, _jsxRuntime.jsxs)(_Flex.Flex, {
149
149
  padding: this.props.size === 'small' ? 'x-small' : 'small small small x-small',
150
150
  children: [(0, _jsxRuntime.jsx)(_Flex.Flex.Item, {
@@ -162,7 +162,7 @@ let ToggleGroup = exports.ToggleGroup = (_dec = (0, _emotion.withStyle)(_styles.
162
162
  }
163
163
  });
164
164
  }
165
- }, _ToggleGroup.displayName = "ToggleGroup", _ToggleGroup.componentId = 'ToggleGroup', _ToggleGroup.allowedProps = _props.allowedProps, _ToggleGroup.propTypes = _props.propTypes, _ToggleGroup.defaultProps = {
165
+ }, _ToggleGroup.displayName = "ToggleGroup", _ToggleGroup.componentId = 'ToggleGroup', _ToggleGroup.allowedProps = _props.allowedProps, _ToggleGroup.defaultProps = {
166
166
  size: 'medium',
167
167
  icon: _IconArrowOpenEndSolid.IconArrowOpenEndSolid,
168
168
  iconExpanded: _IconArrowOpenDownSolid.IconArrowOpenDownSolid,
@@ -170,5 +170,5 @@ let ToggleGroup = exports.ToggleGroup = (_dec = (0, _emotion.withStyle)(_styles.
170
170
  transition: true,
171
171
  as: 'span',
172
172
  border: true
173
- }, _ToggleGroup)) || _class) || _class);
173
+ }, _ToggleGroup)) || _class);
174
174
  var _default = exports.default = ToggleGroup;
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
- exports.propTypes = exports.allowedProps = void 0;
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
9
- var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
6
+ exports.allowedProps = void 0;
10
7
  /*
11
8
  * The MIT License (MIT)
12
9
  *
@@ -31,19 +28,4 @@ var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
31
28
  * SOFTWARE.
32
29
  */
33
30
 
34
- const propTypes = exports.propTypes = {
35
- children: _propTypes.default.node.isRequired,
36
- summary: _propTypes.default.node.isRequired,
37
- toggleLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired,
38
- as: _propTypes.default.elementType,
39
- elementRef: _propTypes.default.func,
40
- size: _propTypes.default.oneOf(['small', 'medium', 'large']),
41
- expanded: (0, _controllable.controllable)(_propTypes.default.bool, 'onToggle', 'defaultExpanded'),
42
- defaultExpanded: _propTypes.default.bool,
43
- onToggle: _propTypes.default.func,
44
- icon: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
45
- iconExpanded: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
46
- transition: _propTypes.default.bool,
47
- border: _propTypes.default.bool
48
- };
49
31
  const allowedProps = exports.allowedProps = ['children', 'summary', 'toggleLabel', 'as', 'elementRef', 'size', 'expanded', 'defaultExpanded', 'onToggle', 'icon', 'iconExpanded', 'transition', 'border'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-toggle-details",
3
- "version": "10.26.1",
3
+ "version": "11.0.1-snapshot-0",
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,34 +23,31 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@instructure/ui-axe-check": "10.26.1",
27
- "@instructure/ui-babel-preset": "10.26.1",
28
- "@instructure/ui-themes": "10.26.1",
26
+ "@instructure/ui-axe-check": "11.0.1-snapshot-0",
27
+ "@instructure/ui-babel-preset": "11.0.1-snapshot-0",
28
+ "@instructure/ui-themes": "11.0.1-snapshot-0",
29
29
  "@testing-library/jest-dom": "^6.6.3",
30
- "@testing-library/react": "^16.0.1",
30
+ "@testing-library/react": "15.0.7",
31
31
  "@testing-library/user-event": "^14.6.1",
32
32
  "vitest": "^3.2.2"
33
33
  },
34
34
  "dependencies": {
35
35
  "@babel/runtime": "^7.27.6",
36
- "@instructure/emotion": "10.26.1",
37
- "@instructure/shared-types": "10.26.1",
38
- "@instructure/ui-buttons": "10.26.1",
39
- "@instructure/ui-dom-utils": "10.26.1",
40
- "@instructure/ui-expandable": "10.26.1",
41
- "@instructure/ui-flex": "10.26.1",
42
- "@instructure/ui-icons": "10.26.1",
43
- "@instructure/ui-motion": "10.26.1",
44
- "@instructure/ui-prop-types": "10.26.1",
45
- "@instructure/ui-react-utils": "10.26.1",
46
- "@instructure/ui-testable": "10.26.1",
47
- "@instructure/ui-utils": "10.26.1",
48
- "@instructure/ui-view": "10.26.1",
49
- "@instructure/uid": "10.26.1",
50
- "prop-types": "^15.8.1"
36
+ "@instructure/emotion": "11.0.1-snapshot-0",
37
+ "@instructure/shared-types": "11.0.1-snapshot-0",
38
+ "@instructure/ui-buttons": "11.0.1-snapshot-0",
39
+ "@instructure/ui-dom-utils": "11.0.1-snapshot-0",
40
+ "@instructure/ui-expandable": "11.0.1-snapshot-0",
41
+ "@instructure/ui-flex": "11.0.1-snapshot-0",
42
+ "@instructure/ui-icons": "11.0.1-snapshot-0",
43
+ "@instructure/ui-motion": "11.0.1-snapshot-0",
44
+ "@instructure/ui-react-utils": "11.0.1-snapshot-0",
45
+ "@instructure/ui-utils": "11.0.1-snapshot-0",
46
+ "@instructure/ui-view": "11.0.1-snapshot-0",
47
+ "@instructure/uid": "11.0.1-snapshot-0"
51
48
  },
52
49
  "peerDependencies": {
53
- "react": ">=16.14 <=18"
50
+ "react": ">=18 <=19"
54
51
  },
55
52
  "publishConfig": {
56
53
  "access": "public"
@@ -22,7 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import { Component } from 'react'
25
+ import { Component, createRef } from 'react'
26
26
  import { Button } from '@instructure/ui-buttons'
27
27
  import {
28
28
  IconArrowOpenEndSolid,
@@ -31,13 +31,12 @@ import {
31
31
  import { Expandable } from '@instructure/ui-expandable'
32
32
  import { omitProps, pickProps } from '@instructure/ui-react-utils'
33
33
  import { isActiveElement } from '@instructure/ui-dom-utils'
34
- import { testable } from '@instructure/ui-testable'
35
34
 
36
35
  import { withStyle } from '@instructure/emotion'
37
36
  import generateStyle from './styles'
38
37
  import generateComponentTheme from './theme'
39
38
  import type { ToggleDetailsProps } from './props'
40
- import { allowedProps, propTypes } from './props'
39
+ import { allowedProps } from './props'
41
40
  import type { ExpandableToggleProps } from '@instructure/ui-expandable'
42
41
  import type { ViewProps } from '@instructure/ui-view'
43
42
 
@@ -47,11 +46,9 @@ category: components
47
46
  ---
48
47
  **/
49
48
  @withStyle(generateStyle, generateComponentTheme)
50
- @testable()
51
49
  class ToggleDetails extends Component<ToggleDetailsProps> {
52
50
  static readonly componentId = 'ToggleDetails'
53
51
  static allowedProps = allowedProps
54
- static propTypes = propTypes
55
52
 
56
53
  static defaultProps = {
57
54
  variant: 'default',
@@ -64,15 +61,20 @@ class ToggleDetails extends Component<ToggleDetailsProps> {
64
61
  children: null
65
62
  }
66
63
 
67
- ref: Element | null = null
68
- _button: HTMLElement | null = null
64
+ _buttonNode: HTMLElement | null = null
65
+ ref = createRef<HTMLDivElement>()
66
+
67
+ // TODO this solution was generated with Gemini, should be tested if it works as fine as before
68
+ setButtonRef = (node: Element | null) => {
69
+ this._buttonNode = node as HTMLElement | null
70
+ }
69
71
 
70
72
  get focused() {
71
- return isActiveElement(this._button)
73
+ return isActiveElement(this._buttonNode)
72
74
  }
73
75
 
74
76
  focus() {
75
- this._button?.focus()
77
+ this._buttonNode?.focus()
76
78
  }
77
79
 
78
80
  componentDidMount() {
@@ -83,8 +85,6 @@ class ToggleDetails extends Component<ToggleDetailsProps> {
83
85
  this.props.makeStyles?.()
84
86
  }
85
87
 
86
- getButtonRef = (el: Element | null) => (this._button = el as HTMLElement)
87
-
88
88
  renderSummary(expanded: boolean) {
89
89
  const { summary, iconPosition } = this.props
90
90
 
@@ -102,8 +102,6 @@ class ToggleDetails extends Component<ToggleDetailsProps> {
102
102
  expanded: boolean
103
103
  ) {
104
104
  const { variant } = this.props
105
- // Do not put aria-controls and aria-expanded into the toggle if there
106
- // is nothing to open
107
105
  const tProps = this.props.children
108
106
  ? toggleProps
109
107
  : { onClick: toggleProps.onClick }
@@ -120,14 +118,14 @@ class ToggleDetails extends Component<ToggleDetailsProps> {
120
118
  {...props}
121
119
  display="block"
122
120
  textAlign="start"
123
- elementRef={this.getButtonRef}
121
+ elementRef={this.setButtonRef}
124
122
  >
125
123
  {summary}
126
124
  </Button>
127
125
  )
128
126
  } else if (props.href) {
129
127
  return (
130
- <a {...props} css={this.props.styles?.toggle} ref={this.getButtonRef}>
128
+ <a {...props} css={this.props.styles?.toggle} ref={this.setButtonRef}>
131
129
  {summary}
132
130
  </a>
133
131
  )
@@ -137,7 +135,7 @@ class ToggleDetails extends Component<ToggleDetailsProps> {
137
135
  {...props}
138
136
  type="button"
139
137
  css={this.props.styles?.toggle}
140
- ref={this.getButtonRef}
138
+ ref={this.setButtonRef}
141
139
  >
142
140
  {summary}
143
141
  </button>
@@ -188,9 +186,8 @@ class ToggleDetails extends Component<ToggleDetailsProps> {
188
186
  return (
189
187
  <div
190
188
  css={this.props.styles?.toggleDetails}
191
- ref={(el) => {
192
- this.ref = el
193
- }}
189
+ ref={this.ref}
190
+ data-cid="ToggleDetails"
194
191
  >
195
192
  {this.renderToggle(getToggleProps(), expanded)}
196
193
  {this.renderDetails(expanded, getDetailsProps())}