@instructure/ui-toggle-details 11.6.0 → 11.6.1-pr-snapshot-1779894247159

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,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
+ ## [11.6.1-pr-snapshot-1779894247159](https://github.com/instructure/instructure-ui/compare/v11.6.0...v11.6.1-pr-snapshot-1779894247159) (2026-05-27)
7
+
8
+ **Note:** Version bump only for package @instructure/ui-toggle-details
9
+
10
+
11
+
12
+
13
+
6
14
  # [11.6.0](https://github.com/instructure/instructure-ui/compare/v11.5.0...v11.6.0) (2026-02-18)
7
15
 
8
16
  **Note:** Version bump only for package @instructure/ui-toggle-details
@@ -1,9 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.allowedProps = void 0;
7
1
  /*
8
2
  * The MIT License (MIT)
9
3
  *
@@ -28,4 +22,16 @@ exports.allowedProps = void 0;
28
22
  * SOFTWARE.
29
23
  */
30
24
 
31
- const allowedProps = exports.allowedProps = ['children', 'summary', 'toggleLabel', 'as', 'elementRef', 'size', 'expanded', 'defaultExpanded', 'onToggle', 'icon', 'iconExpanded', 'transition', 'border'];
25
+ module.exports = {
26
+ presets: [
27
+ [
28
+ require('@instructure/ui-babel-preset'),
29
+ {
30
+ coverage: Boolean(process.env.COVERAGE),
31
+ esModules: Boolean(process.env.ES_MODULES),
32
+ removeConsole: process.env.NODE_ENV === 'production',
33
+ transformImports: Boolean(process.env.TRANSFORM_IMPORTS)
34
+ }
35
+ ]
36
+ ]
37
+ }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@instructure/ui-toggle-details",
3
- "version": "11.6.0",
3
+ "version": "11.6.1-pr-snapshot-1779894247159",
4
+ "type": "module",
4
5
  "description": "A styled toggleable, accordion-like component.",
5
6
  "author": "Instructure, Inc. Engineering and Product Design",
6
7
  "module": "./es/index.js",
7
- "main": "./lib/index.js",
8
8
  "types": "./types/index.d.ts",
9
9
  "repository": {
10
10
  "type": "git",
@@ -15,27 +15,27 @@
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
17
  "@babel/runtime": "^7.27.6",
18
- "@instructure/emotion": "11.6.0",
19
- "@instructure/ui-buttons": "11.6.0",
20
- "@instructure/ui-dom-utils": "11.6.0",
21
- "@instructure/shared-types": "11.6.0",
22
- "@instructure/ui-expandable": "11.6.0",
23
- "@instructure/ui-flex": "11.6.0",
24
- "@instructure/ui-icons": "11.6.0",
25
- "@instructure/ui-react-utils": "11.6.0",
26
- "@instructure/ui-motion": "11.6.0",
27
- "@instructure/ui-utils": "11.6.0",
28
- "@instructure/ui-view": "11.6.0",
29
- "@instructure/uid": "11.6.0"
18
+ "@instructure/shared-types": "11.6.1-pr-snapshot-1779894247159",
19
+ "@instructure/emotion": "11.6.1-pr-snapshot-1779894247159",
20
+ "@instructure/ui-buttons": "11.6.1-pr-snapshot-1779894247159",
21
+ "@instructure/ui-dom-utils": "11.6.1-pr-snapshot-1779894247159",
22
+ "@instructure/ui-expandable": "11.6.1-pr-snapshot-1779894247159",
23
+ "@instructure/ui-flex": "11.6.1-pr-snapshot-1779894247159",
24
+ "@instructure/ui-icons": "11.6.1-pr-snapshot-1779894247159",
25
+ "@instructure/ui-motion": "11.6.1-pr-snapshot-1779894247159",
26
+ "@instructure/ui-react-utils": "11.6.1-pr-snapshot-1779894247159",
27
+ "@instructure/ui-view": "11.6.1-pr-snapshot-1779894247159",
28
+ "@instructure/ui-utils": "11.6.1-pr-snapshot-1779894247159",
29
+ "@instructure/uid": "11.6.1-pr-snapshot-1779894247159"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@testing-library/jest-dom": "^6.6.3",
33
33
  "@testing-library/react": "15.0.7",
34
34
  "@testing-library/user-event": "^14.6.1",
35
35
  "vitest": "^3.2.2",
36
- "@instructure/ui-axe-check": "11.6.0",
37
- "@instructure/ui-babel-preset": "11.6.0",
38
- "@instructure/ui-themes": "11.6.0"
36
+ "@instructure/ui-babel-preset": "11.6.1-pr-snapshot-1779894247159",
37
+ "@instructure/ui-axe-check": "11.6.1-pr-snapshot-1779894247159",
38
+ "@instructure/ui-themes": "11.6.1-pr-snapshot-1779894247159"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "react": ">=18 <=19"
@@ -48,10 +48,8 @@
48
48
  ".": {
49
49
  "types": "./types/index.d.ts",
50
50
  "import": "./es/index.js",
51
- "require": "./lib/index.js",
52
51
  "default": "./es/index.js"
53
52
  },
54
- "./lib/*": "./lib/*",
55
53
  "./es/*": "./es/*",
56
54
  "./types/*": "./types/*",
57
55
  "./package.json": "./package.json",
@@ -61,7 +59,7 @@
61
59
  "lint": "ui-scripts lint",
62
60
  "lint:fix": "ui-scripts lint --fix",
63
61
  "clean": "ui-scripts clean",
64
- "build": "ui-scripts build --modules es,cjs",
62
+ "build": "ui-scripts build",
65
63
  "build:watch": "pnpm run ts:check -- --watch & ui-scripts build --watch",
66
64
  "build:types": "tsc -p tsconfig.build.json",
67
65
  "ts:check": "tsc -p tsconfig.build.json --noEmit --emitDeclarationOnly false"
@@ -1,189 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = exports.ToggleDetails = void 0;
8
- var _react = require("react");
9
- var _Button = require("@instructure/ui-buttons/lib/Button");
10
- var _IconArrowOpenEndSolid = require("@instructure/ui-icons/lib/IconArrowOpenEndSolid.js");
11
- var _IconArrowOpenDownSolid = require("@instructure/ui-icons/lib/IconArrowOpenDownSolid.js");
12
- var _Expandable = require("@instructure/ui-expandable/lib/Expandable");
13
- var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
14
- var _pickProps = require("@instructure/ui-react-utils/lib/pickProps.js");
15
- var _isActiveElement = require("@instructure/ui-dom-utils/lib/isActiveElement.js");
16
- var _emotion = require("@instructure/emotion");
17
- var _styles = _interopRequireDefault(require("./styles"));
18
- var _theme = _interopRequireDefault(require("./theme"));
19
- var _props = require("./props");
20
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
21
- var _dec, _class, _ToggleDetails;
22
- /*
23
- * The MIT License (MIT)
24
- *
25
- * Copyright (c) 2015 - present Instructure, Inc.
26
- *
27
- * Permission is hereby granted, free of charge, to any person obtaining a copy
28
- * of this software and associated documentation files (the "Software"), to deal
29
- * in the Software without restriction, including without limitation the rights
30
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
31
- * copies of the Software, and to permit persons to whom the Software is
32
- * furnished to do so, subject to the following conditions:
33
- *
34
- * The above copyright notice and this permission notice shall be included in all
35
- * copies or substantial portions of the Software.
36
- *
37
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
38
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
39
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
40
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
41
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
42
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
43
- * SOFTWARE.
44
- */
45
- /**
46
- ---
47
- category: components
48
- ---
49
- **/
50
- let ToggleDetails = exports.ToggleDetails = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_ToggleDetails = class ToggleDetails extends _react.Component {
51
- constructor(...args) {
52
- super(...args);
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
- };
59
- this.handleToggle = (event, expanded) => {
60
- if (typeof this.props.onToggle === 'function') {
61
- this.props.onToggle(event, expanded);
62
- }
63
- };
64
- }
65
- get focused() {
66
- return (0, _isActiveElement.isActiveElement)(this._buttonNode);
67
- }
68
- focus() {
69
- var _this$_buttonNode;
70
- (_this$_buttonNode = this._buttonNode) === null || _this$_buttonNode === void 0 ? void 0 : _this$_buttonNode.focus();
71
- }
72
- componentDidMount() {
73
- var _this$props$makeStyle, _this$props;
74
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
75
- }
76
- componentDidUpdate() {
77
- var _this$props$makeStyle2, _this$props2;
78
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
79
- }
80
- renderSummary(expanded) {
81
- var _this$props$styles, _this$props$styles2;
82
- const _this$props3 = this.props,
83
- summary = _this$props3.summary,
84
- iconPosition = _this$props3.iconPosition;
85
- return (0, _jsxRuntime.jsxs)("span", {
86
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.summary,
87
- children: [iconPosition === 'start' && this.renderIcon(expanded), (0, _jsxRuntime.jsx)("span", {
88
- css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.summaryText,
89
- children: summary
90
- }), iconPosition === 'end' && this.renderIcon(expanded)]
91
- });
92
- }
93
- renderToggle(toggleProps, expanded) {
94
- const variant = this.props.variant;
95
- const tProps = this.props.children ? toggleProps : {
96
- onClick: toggleProps.onClick
97
- };
98
- const props = {
99
- ...(0, _omitProps.omitProps)(this.props, ToggleDetails.allowedProps),
100
- ...tProps,
101
- children: this.renderSummary(expanded)
102
- };
103
- const summary = this.renderSummary(expanded);
104
- if (variant === 'filled') {
105
- return (0, _jsxRuntime.jsx)(_Button.Button, {
106
- ...props,
107
- display: "block",
108
- textAlign: "start",
109
- elementRef: this.setButtonRef,
110
- children: summary
111
- });
112
- } else if (props.href) {
113
- var _this$props$styles3;
114
- return (0, _jsxRuntime.jsx)("a", {
115
- ...props,
116
- css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.toggle,
117
- ref: this.setButtonRef,
118
- children: summary
119
- });
120
- } else {
121
- var _this$props$styles4;
122
- return (0, _jsxRuntime.jsx)("button", {
123
- ...props,
124
- type: "button",
125
- css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.toggle,
126
- ref: this.setButtonRef,
127
- children: summary
128
- });
129
- }
130
- }
131
- renderIcon(expanded) {
132
- var _this$props$styles5;
133
- const Icon = expanded ? this.props.iconExpanded : this.props.icon;
134
- return this.props.children && Icon ? (0, _jsxRuntime.jsx)("span", {
135
- css: (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.icon,
136
- children: (0, _jsxRuntime.jsx)(Icon, {})
137
- }) : null;
138
- }
139
- renderDetails(expanded, detailsProps) {
140
- var _this$props$styles6;
141
- if (!this.props.children) return null;
142
- const expandedStyles = expanded ? {
143
- display: 'block'
144
- } : {
145
- display: 'none'
146
- };
147
- return (0, _jsxRuntime.jsx)("div", {
148
- ...detailsProps,
149
- css: [(_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.details, expandedStyles],
150
- children: expanded && this.renderContent()
151
- });
152
- }
153
- renderContent() {
154
- var _this$props$styles7;
155
- return (0, _jsxRuntime.jsx)("div", {
156
- css: (_this$props$styles7 = this.props.styles) === null || _this$props$styles7 === void 0 ? void 0 : _this$props$styles7.content,
157
- children: this.props.children
158
- });
159
- }
160
- render() {
161
- return (0, _jsxRuntime.jsx)(_Expandable.Expandable, {
162
- ...(0, _pickProps.pickProps)(this.props, _Expandable.Expandable.allowedProps),
163
- onToggle: this.handleToggle,
164
- children: ({
165
- expanded,
166
- getToggleProps,
167
- getDetailsProps
168
- }) => {
169
- var _this$props$styles8;
170
- return (0, _jsxRuntime.jsxs)("div", {
171
- css: (_this$props$styles8 = this.props.styles) === null || _this$props$styles8 === void 0 ? void 0 : _this$props$styles8.toggleDetails,
172
- ref: this.ref,
173
- "data-cid": "ToggleDetails",
174
- children: [this.renderToggle(getToggleProps(), expanded), this.renderDetails(expanded, getDetailsProps())]
175
- });
176
- }
177
- });
178
- }
179
- }, _ToggleDetails.displayName = "ToggleDetails", _ToggleDetails.componentId = 'ToggleDetails', _ToggleDetails.allowedProps = _props.allowedProps, _ToggleDetails.defaultProps = {
180
- variant: 'default',
181
- size: 'medium',
182
- fluidWidth: false,
183
- icon: _IconArrowOpenEndSolid.IconArrowOpenEndSolid,
184
- iconExpanded: _IconArrowOpenDownSolid.IconArrowOpenDownSolid,
185
- iconPosition: 'start',
186
- defaultExpanded: false,
187
- children: null
188
- }, _ToggleDetails)) || _class);
189
- var _default = exports.default = ToggleDetails;
@@ -1,31 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.allowedProps = void 0;
7
- /*
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2015 - present Instructure, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
-
31
- const allowedProps = exports.allowedProps = ['variant', 'summary', 'expanded', 'defaultExpanded', 'onToggle', 'icon', 'iconExpanded', 'iconPosition', 'fluidWidth', 'children', 'size'];
@@ -1,200 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _emotion = require("@instructure/emotion");
8
- /*
9
- * The MIT License (MIT)
10
- *
11
- * Copyright (c) 2015 - present Instructure, Inc.
12
- *
13
- * Permission is hereby granted, free of charge, to any person obtaining a copy
14
- * of this software and associated documentation files (the "Software"), to deal
15
- * in the Software without restriction, including without limitation the rights
16
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
- * copies of the Software, and to permit persons to whom the Software is
18
- * furnished to do so, subject to the following conditions:
19
- *
20
- * The above copyright notice and this permission notice shall be included in all
21
- * copies or substantial portions of the Software.
22
- *
23
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
- * SOFTWARE.
30
- */
31
-
32
- const contentAnimation = (0, _emotion.keyframes)`
33
- to {
34
- opacity: 1;
35
- }`;
36
-
37
- /**
38
- * ---
39
- * private: true
40
- * ---
41
- * Generates the style object from the theme and provided additional information
42
- * @param {Object} componentTheme The theme variable object.
43
- * @param {Object} props the props of the component, the style is applied to
44
- * @param {Object} state the state of the component, the style is applied to
45
- * @return {Object} The final style object, which will be used in the component
46
- */
47
- const generateStyle = (componentTheme, props, _state) => {
48
- const fluidWidth = props.fluidWidth,
49
- iconPosition = props.iconPosition,
50
- size = props.size,
51
- variant = props.variant;
52
- const positionIconAtEnd = iconPosition === 'end' && (variant === 'filled' || fluidWidth);
53
- const fluidWidthStyles = fluidWidth ? {
54
- display: 'block',
55
- width: '100%'
56
- } : {};
57
- const iconPositionStyles = {
58
- start: {
59
- marginInlineEnd: componentTheme.iconMargin,
60
- marginInlineStart: 0
61
- },
62
- end: {
63
- marginInlineStart: componentTheme.iconMargin,
64
- marginInlineEnd: 0
65
- }
66
- };
67
- const fontSizeStyles = {
68
- small: {
69
- fontSize: componentTheme.fontSizeSmall
70
- },
71
- medium: {
72
- fontSize: componentTheme.fontSizeMedium
73
- },
74
- large: {
75
- fontSize: componentTheme.fontSizeLarge
76
- }
77
- };
78
- const iconSizeStyles = {
79
- small: {
80
- fontSize: componentTheme.smallIconSize
81
- },
82
- medium: {
83
- fontSize: componentTheme.mediumIconSize
84
- },
85
- large: {
86
- fontSize: componentTheme.largeIconSize
87
- }
88
- };
89
- const indentDetailsStyles = iconPosition === 'start' && !fluidWidth ? {
90
- small: {
91
- paddingInlineStart: `calc(${componentTheme.smallIconSize} + ${componentTheme.togglePadding})`,
92
- paddingInlineEnd: '0'
93
- },
94
- medium: {
95
- paddingInlineStart: `calc(${componentTheme.mediumIconSize} + ${componentTheme.togglePadding})`,
96
- paddingInlineEnd: '0'
97
- },
98
- large: {
99
- paddingInlineStart: `calc(${componentTheme.largeIconSize} + ${componentTheme.togglePadding})`,
100
- paddingInlineEnd: '0'
101
- }
102
- } : {
103
- small: {},
104
- medium: {},
105
- large: {}
106
- };
107
- return {
108
- toggleDetails: {
109
- label: 'toggleDetails',
110
- fontFamily: componentTheme.fontFamily,
111
- fontWeight: componentTheme.fontWeight,
112
- lineHeight: componentTheme.lineHeight
113
- },
114
- summary: {
115
- label: 'toggleDetails__summary',
116
- position: 'relative',
117
- display: 'flex',
118
- alignItems: 'center',
119
- boxSizing: 'border-box',
120
- textAlign: 'start'
121
- },
122
- summaryText: {
123
- label: 'toggleDetails__summaryText',
124
- minWidth: '0.0625rem',
125
- flexGrow: 1,
126
- ...(positionIconAtEnd ? {
127
- flex: 1
128
- } : {})
129
- },
130
- toggle: {
131
- label: 'toggleDetails__toggle',
132
- fontFamily: componentTheme.fontFamily,
133
- appearance: 'none',
134
- cursor: 'pointer',
135
- userSelect: 'none',
136
- touchAction: 'manipulation',
137
- position: 'relative',
138
- overflow: 'visible',
139
- boxSizing: 'border-box',
140
- padding: '0',
141
- margin: '0',
142
- outline: 'none',
143
- border: 'none',
144
- background: 'transparent',
145
- color: componentTheme.textColor,
146
- '&::-moz-focus-inner': {
147
- padding: '0',
148
- margin: '0'
149
- },
150
- '&::before': {
151
- content: '""',
152
- position: 'absolute',
153
- top: '-0.375rem',
154
- left: '-0.375rem',
155
- right: '-0.375rem',
156
- bottom: '-0.375rem',
157
- border: `${componentTheme.toggleBorderWidth} ${componentTheme.toggleBorderStyle} ${componentTheme.toggleFocusBorderColor}`,
158
- borderRadius: `calc(${componentTheme.toggleBorderRadius} * 1.5)`,
159
- opacity: 0,
160
- pointerEvents: 'none'
161
- },
162
- '&:focus': {
163
- '&::before': {
164
- opacity: 1
165
- }
166
- },
167
- '&:focus, &:hover, &:active': {
168
- textDecoration: 'none',
169
- color: componentTheme.textColor
170
- },
171
- textDecoration: 'none',
172
- ...fluidWidthStyles,
173
- ...fontSizeStyles[size]
174
- },
175
- icon: {
176
- label: 'toggleDetails__icon',
177
- '& > svg': {
178
- display: 'block' /* fix vertical alignment of icon */
179
- },
180
- ...iconPositionStyles[iconPosition],
181
- ...iconSizeStyles[size]
182
- },
183
- details: {
184
- label: 'toggleDetails__details',
185
- boxSizing: 'border-box',
186
- paddingTop: componentTheme.togglePadding,
187
- color: componentTheme.textColor,
188
- ...fontSizeStyles[size],
189
- ...indentDetailsStyles[size]
190
- },
191
- content: {
192
- label: 'toggleDetails__content',
193
- opacity: 0.01,
194
- animationName: contentAnimation,
195
- animationFillMode: 'forwards',
196
- animationDuration: '.3s'
197
- }
198
- };
199
- };
200
- var _default = exports.default = generateStyle;
@@ -1,80 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- /*
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2015 - present Instructure, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
-
31
- /**
32
- * Generates the theme object for the component from the theme and provided additional information
33
- * @param {Object} theme The actual theme object.
34
- * @return {Object} The final theme object with the overrides and component variables
35
- */
36
- const generateComponentTheme = theme => {
37
- var _colors$contrasts, _colors$contrasts2, _colors$contrasts3, _colors$contrasts4, _colors$contrasts5;
38
- const colors = theme.colors,
39
- spacing = theme.spacing,
40
- borders = theme.borders,
41
- typography = theme.typography,
42
- themeName = theme.key;
43
- const themeSpecificStyle = {
44
- canvas: {
45
- toggleFocusBorderColor: theme['ic-brand-primary'],
46
- iconColor: theme['ic-brand-font-color-dark'],
47
- textColor: theme['ic-brand-font-color-dark']
48
- }
49
- };
50
- const componentVariables = {
51
- fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
52
- fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightNormal,
53
- lineHeight: typography === null || typography === void 0 ? void 0 : typography.lineHeight,
54
- textColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.grey125125,
55
- fontSizeSmall: typography === null || typography === void 0 ? void 0 : typography.fontSizeSmall,
56
- fontSizeMedium: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
57
- fontSizeLarge: typography === null || typography === void 0 ? void 0 : typography.fontSizeLarge,
58
- smallIconSize: '0.5rem',
59
- mediumIconSize: '0.75rem',
60
- largeIconSize: '1rem',
61
- iconMargin: spacing === null || spacing === void 0 ? void 0 : spacing.xxSmall,
62
- iconColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts2 = colors.contrasts) === null || _colors$contrasts2 === void 0 ? void 0 : _colors$contrasts2.grey125125,
63
- togglePadding: spacing === null || spacing === void 0 ? void 0 : spacing.xxSmall,
64
- toggleBorderRadius: borders === null || borders === void 0 ? void 0 : borders.radiusMedium,
65
- toggleBorderWidth: borders === null || borders === void 0 ? void 0 : borders.widthMedium,
66
- toggleBorderStyle: borders === null || borders === void 0 ? void 0 : borders.style,
67
- toggleFocusBorderColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts3 = colors.contrasts) === null || _colors$contrasts3 === void 0 ? void 0 : _colors$contrasts3.blue4570,
68
- filledBackgroundColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts4 = colors.contrasts) === null || _colors$contrasts4 === void 0 ? void 0 : _colors$contrasts4.grey1111,
69
- filledBorderWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
70
- filledBorderStyle: borders === null || borders === void 0 ? void 0 : borders.style,
71
- filledBorderColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts5 = colors.contrasts) === null || _colors$contrasts5 === void 0 ? void 0 : _colors$contrasts5.grey1424,
72
- filledBorderRadius: borders === null || borders === void 0 ? void 0 : borders.radiusMedium,
73
- filledPadding: spacing === null || spacing === void 0 ? void 0 : spacing.small
74
- };
75
- return {
76
- ...componentVariables,
77
- ...themeSpecificStyle[themeName]
78
- };
79
- };
80
- var _default = exports.default = generateComponentTheme;
@@ -1,174 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = exports.ToggleGroup = void 0;
8
- var _react = require("react");
9
- var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
10
- var _pickProps = require("@instructure/ui-react-utils/lib/pickProps.js");
11
- var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
12
- var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
13
- var _IconButton = require("@instructure/ui-buttons/lib/IconButton");
14
- var _Transition = require("@instructure/ui-motion/lib/Transition");
15
- var _Expandable = require("@instructure/ui-expandable/lib/Expandable");
16
- var _isActiveElement = require("@instructure/ui-dom-utils/lib/isActiveElement.js");
17
- var _Flex = require("@instructure/ui-flex/lib/Flex");
18
- var _View = require("@instructure/ui-view/lib/View");
19
- var _IconArrowOpenEndSolid = require("@instructure/ui-icons/lib/IconArrowOpenEndSolid.js");
20
- var _IconArrowOpenDownSolid = require("@instructure/ui-icons/lib/IconArrowOpenDownSolid.js");
21
- var _props = require("./props");
22
- var _emotion = require("@instructure/emotion");
23
- var _styles = _interopRequireDefault(require("./styles"));
24
- var _theme = _interopRequireDefault(require("./theme"));
25
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
26
- var _dec, _class, _ToggleGroup;
27
- /*
28
- * The MIT License (MIT)
29
- *
30
- * Copyright (c) 2015 - present Instructure, Inc.
31
- *
32
- * Permission is hereby granted, free of charge, to any person obtaining a copy
33
- * of this software and associated documentation files (the "Software"), to deal
34
- * in the Software without restriction, including without limitation the rights
35
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
36
- * copies of the Software, and to permit persons to whom the Software is
37
- * furnished to do so, subject to the following conditions:
38
- *
39
- * The above copyright notice and this permission notice shall be included in all
40
- * copies or substantial portions of the Software.
41
- *
42
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
43
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
44
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
45
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
46
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
47
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
48
- * SOFTWARE.
49
- */
50
- /**
51
- ---
52
- category: components
53
- ---
54
- **/
55
- let ToggleGroup = exports.ToggleGroup = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_ToggleGroup = class ToggleGroup extends _react.Component {
56
- constructor(...args) {
57
- super(...args);
58
- this.ref = null;
59
- this._button = null;
60
- this._shouldTransition = false;
61
- this.handleRef = el => {
62
- const elementRef = this.props.elementRef;
63
- this.ref = el;
64
- if (typeof elementRef === 'function') {
65
- elementRef(el);
66
- }
67
- };
68
- this.handleButtonRef = el => {
69
- this._button = el;
70
- };
71
- }
72
- get focused() {
73
- return (0, _isActiveElement.isActiveElement)(this._button);
74
- }
75
- focus() {
76
- var _this$_button;
77
- (_this$_button = this._button) === null || _this$_button === void 0 ? void 0 : _this$_button.focus();
78
- }
79
- componentDidMount() {
80
- this._shouldTransition = true;
81
- }
82
- componentDidUpdate() {
83
- var _this$props$makeStyle, _this$props;
84
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.state);
85
- }
86
- renderIcon(expanded) {
87
- const Icon = expanded ? this.props.iconExpanded : this.props.icon;
88
- return Icon ? (0, _callRenderProp.callRenderProp)(Icon) : null;
89
- }
90
- renderToggle(toggleProps, expanded) {
91
- const _this$props2 = this.props,
92
- toggleLabel = _this$props2.toggleLabel,
93
- size = _this$props2.size;
94
- let label;
95
- if (typeof toggleLabel === 'function') {
96
- label = toggleLabel(expanded);
97
- } else {
98
- label = toggleLabel;
99
- }
100
- const props = {
101
- ...toggleProps
102
- };
103
- return (0, _jsxRuntime.jsx)(_IconButton.IconButton, {
104
- ...props,
105
- withBackground: false,
106
- withBorder: false,
107
- size: size === 'large' ? 'medium' : 'small',
108
- elementRef: this.handleButtonRef,
109
- screenReaderLabel: label,
110
- children: this.renderIcon(expanded)
111
- });
112
- }
113
- renderDetails(detailsProps) {
114
- const styles = this.props.styles;
115
- return (0, _jsxRuntime.jsx)(_View.View, {
116
- ...detailsProps,
117
- display: "block",
118
- borderWidth: "small none none none",
119
- borderColor: styles === null || styles === void 0 ? void 0 : styles.borderColor,
120
- children: this.props.transition && this._shouldTransition ? (0, _jsxRuntime.jsx)(_Transition.Transition, {
121
- transitionOnMount: true,
122
- in: true,
123
- type: "fade",
124
- children: this.props.children
125
- }) : this.props.children
126
- });
127
- }
128
- render() {
129
- const Element = (0, _getElementType.getElementType)(ToggleGroup, this.props);
130
- const styles = this.props.styles;
131
- return (0, _jsxRuntime.jsx)(_Expandable.Expandable, {
132
- ...(0, _pickProps.pickProps)(this.props, _Expandable.Expandable.allowedProps),
133
- children: ({
134
- expanded,
135
- getToggleProps,
136
- getDetailsProps
137
- }) => {
138
- return (0, _jsxRuntime.jsxs)(_View.View, {
139
- ...(0, _omitProps.omitProps)(this.props, ToggleGroup.allowedProps),
140
- borderWidth: this.props.border ? 'small' : 'none',
141
- as: Element,
142
- elementRef: this.handleRef,
143
- display: "block",
144
- borderRadius: "medium",
145
- background: "primary",
146
- borderColor: styles === null || styles === void 0 ? void 0 : styles.borderColor,
147
- "data-cid": "ToggleGroup",
148
- children: [(0, _jsxRuntime.jsxs)(_Flex.Flex, {
149
- padding: this.props.size === 'small' ? 'x-small' : 'small small small x-small',
150
- children: [(0, _jsxRuntime.jsx)(_Flex.Flex.Item, {
151
- children: this.renderToggle(getToggleProps(), expanded)
152
- }), (0, _jsxRuntime.jsx)(_Flex.Flex.Item, {
153
- shouldGrow: true,
154
- shouldShrink: true,
155
- padding: "0 0 0 x-small",
156
- children: this.props.summary
157
- })]
158
- }), expanded ? this.renderDetails(getDetailsProps()) : (0, _jsxRuntime.jsx)("span", {
159
- ...getDetailsProps()
160
- })]
161
- });
162
- }
163
- });
164
- }
165
- }, _ToggleGroup.displayName = "ToggleGroup", _ToggleGroup.componentId = 'ToggleGroup', _ToggleGroup.allowedProps = _props.allowedProps, _ToggleGroup.defaultProps = {
166
- size: 'medium',
167
- icon: _IconArrowOpenEndSolid.IconArrowOpenEndSolid,
168
- iconExpanded: _IconArrowOpenDownSolid.IconArrowOpenDownSolid,
169
- defaultExpanded: false,
170
- transition: true,
171
- as: 'span',
172
- border: true
173
- }, _ToggleGroup)) || _class);
174
- var _default = exports.default = ToggleGroup;
@@ -1,46 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- /*
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2015 - present Instructure, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
-
31
- /**
32
- * ---
33
- * private: true
34
- * ---
35
- * Generates the style object from the theme and provided additional information
36
- * @param {Object} componentTheme The theme variable object.
37
- * @param {Object} props the props of the component, the style is applied to
38
- * @param {Object} state the state of the component, the style is applied to
39
- * @return {Object} The final style object, which will be used in the component
40
- */
41
- const generateStyle = (componentTheme, _props) => {
42
- return {
43
- borderColor: componentTheme.borderColor
44
- };
45
- };
46
- var _default = exports.default = generateStyle;
@@ -1,46 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- /*
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2015 - present Instructure, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
-
31
- /**
32
- * Generates the theme object for the component from the theme and provided additional information
33
- * @param {Object} theme The actual theme object.
34
- * @return {Object} The final theme object with the overrides and component variables
35
- */
36
- const generateComponentTheme = theme => {
37
- var _colors$contrasts;
38
- const colors = theme.colors;
39
- const componentVariables = {
40
- borderColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.grey3045
41
- };
42
- return {
43
- ...componentVariables
44
- };
45
- };
46
- var _default = exports.default = generateComponentTheme;
package/lib/index.js DELETED
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "ToggleDetails", {
7
- enumerable: true,
8
- get: function () {
9
- return _ToggleDetails.ToggleDetails;
10
- }
11
- });
12
- Object.defineProperty(exports, "ToggleGroup", {
13
- enumerable: true,
14
- get: function () {
15
- return _ToggleGroup.ToggleGroup;
16
- }
17
- });
18
- var _ToggleDetails = require("./ToggleDetails");
19
- var _ToggleGroup = require("./ToggleGroup");
package/lib/package.json DELETED
@@ -1 +0,0 @@
1
- {"type":"commonjs"}