@instructure/ui-modal 11.7.8 → 11.7.9-pr-snapshot-1792147648392
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 +13 -0
- package/es/Modal/v1/ModalBody/index.js +115 -162
- package/es/Modal/v1/ModalBody/props.js +9 -26
- package/es/Modal/v1/ModalBody/styles.js +20 -57
- package/es/Modal/v1/ModalBody/theme.js +6 -37
- package/es/Modal/v1/ModalContext.js +3 -31
- package/es/Modal/v1/ModalFooter/index.js +43 -64
- package/es/Modal/v1/ModalFooter/props.js +5 -26
- package/es/Modal/v1/ModalFooter/styles.js +23 -59
- package/es/Modal/v1/ModalFooter/theme.js +15 -48
- package/es/Modal/v1/ModalHeader/index.js +76 -99
- package/es/Modal/v1/ModalHeader/props.js +6 -26
- package/es/Modal/v1/ModalHeader/styles.js +38 -78
- package/es/Modal/v1/ModalHeader/theme.js +14 -46
- package/es/Modal/v1/index.js +192 -251
- package/es/Modal/v1/props.js +28 -26
- package/es/Modal/v1/styles.js +78 -117
- package/es/Modal/v1/theme.js +20 -55
- package/es/Modal/v2/ModalBody/index.js +118 -164
- package/es/Modal/v2/ModalBody/props.js +10 -26
- package/es/Modal/v2/ModalBody/styles.js +30 -69
- package/es/Modal/v2/ModalContext.js +3 -31
- package/es/Modal/v2/ModalFooter/index.js +46 -65
- package/es/Modal/v2/ModalFooter/props.js +6 -26
- package/es/Modal/v2/ModalFooter/styles.js +23 -61
- package/es/Modal/v2/ModalHeader/index.js +82 -107
- package/es/Modal/v2/ModalHeader/props.js +6 -26
- package/es/Modal/v2/ModalHeader/styles.js +38 -79
- package/es/Modal/v2/index.js +192 -251
- package/es/Modal/v2/props.js +28 -26
- package/es/Modal/v2/styles.js +87 -130
- package/es/exports/a.js +1 -24
- package/es/exports/b.js +1 -24
- package/package.json +20 -26
- package/tsconfig.build.json +0 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/lib/Modal/v1/ModalBody/index.js +0 -183
- package/lib/Modal/v1/ModalBody/props.js +0 -31
- package/lib/Modal/v1/ModalBody/styles.js +0 -64
- package/lib/Modal/v1/ModalBody/theme.js +0 -44
- package/lib/Modal/v1/ModalContext.js +0 -39
- package/lib/Modal/v1/ModalFooter/index.js +0 -76
- package/lib/Modal/v1/ModalFooter/props.js +0 -31
- package/lib/Modal/v1/ModalFooter/styles.js +0 -66
- package/lib/Modal/v1/ModalFooter/theme.js +0 -55
- package/lib/Modal/v1/ModalHeader/index.js +0 -116
- package/lib/Modal/v1/ModalHeader/props.js +0 -31
- package/lib/Modal/v1/ModalHeader/styles.js +0 -85
- package/lib/Modal/v1/ModalHeader/theme.js +0 -53
- package/lib/Modal/v1/index.js +0 -297
- package/lib/Modal/v1/props.js +0 -31
- package/lib/Modal/v1/styles.js +0 -124
- package/lib/Modal/v1/theme.js +0 -62
- package/lib/Modal/v2/ModalBody/index.js +0 -184
- package/lib/Modal/v2/ModalBody/props.js +0 -31
- package/lib/Modal/v2/ModalBody/styles.js +0 -76
- package/lib/Modal/v2/ModalContext.js +0 -39
- package/lib/Modal/v2/ModalFooter/index.js +0 -76
- package/lib/Modal/v2/ModalFooter/props.js +0 -31
- package/lib/Modal/v2/ModalFooter/styles.js +0 -68
- package/lib/Modal/v2/ModalHeader/index.js +0 -123
- package/lib/Modal/v2/ModalHeader/props.js +0 -31
- package/lib/Modal/v2/ModalHeader/styles.js +0 -86
- package/lib/Modal/v2/index.js +0 -296
- package/lib/Modal/v2/props.js +0 -31
- package/lib/Modal/v2/styles.js +0 -138
- package/lib/exports/a.js +0 -30
- package/lib/exports/b.js +0 -30
- package/lib/package.json +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
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.7.9-pr-snapshot-1792147648392](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9-pr-snapshot-1792147648392) (2026-10-16)
|
|
7
|
+
|
|
8
|
+
### Build System
|
|
9
|
+
|
|
10
|
+
* **many:** replace babel with swc ([7e36c54](https://github.com/instructure/instructure-ui/commit/7e36c54d240b4fa483801c03ab18e7f860f561e2))
|
|
11
|
+
|
|
12
|
+
### BREAKING CHANGES
|
|
13
|
+
|
|
14
|
+
* **many:** `@instructure/ui-babel-preset` and
|
|
15
|
+
`@instructure/browserslist-config-instui` are removed and will no longer be
|
|
16
|
+
published. Packages depend on `@swc/helpers` instead of `@babel/runtime`.
|
|
17
|
+
|
|
18
|
+
|
|
6
19
|
## [11.7.8](https://github.com/instructure/instructure-ui/compare/v11.7.7...v11.7.8) (2026-10-02)
|
|
7
20
|
|
|
8
21
|
**Note:** Version bump only for package @instructure/ui-modal
|
|
@@ -1,28 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* The MIT License (MIT)
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
6
|
-
*
|
|
7
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
-
* in the Software without restriction, including without limitation the rights
|
|
10
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
* furnished to do so, subject to the following conditions:
|
|
13
|
-
*
|
|
14
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
* copies or substantial portions of the Software.
|
|
16
|
-
*
|
|
17
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
* SOFTWARE.
|
|
24
|
-
*/
|
|
25
|
-
|
|
1
|
+
import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
|
|
2
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
26
3
|
import { Component } from 'react';
|
|
27
4
|
import { View } from '@instructure/ui-view/v11_6';
|
|
28
5
|
import { omitProps } from '@instructure/ui-react-utils';
|
|
@@ -32,147 +9,123 @@ import generateStyle from './styles.js';
|
|
|
32
9
|
import generateComponentTheme from './theme.js';
|
|
33
10
|
import { allowedProps } from './props.js';
|
|
34
11
|
import ModalContext from '../ModalContext.js';
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
12
|
+
class ModalBody extends Component {
|
|
13
|
+
static{
|
|
14
|
+
this.displayName = 'ModalBody';
|
|
15
|
+
}
|
|
16
|
+
static{
|
|
17
|
+
this.componentId = 'Modal.Body';
|
|
18
|
+
}
|
|
19
|
+
static{
|
|
20
|
+
this.allowedProps = allowedProps;
|
|
21
|
+
}
|
|
22
|
+
static{
|
|
23
|
+
this.defaultProps = {
|
|
24
|
+
padding: 'medium',
|
|
25
|
+
as: 'div',
|
|
26
|
+
variant: 'default'
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
constructor(props){
|
|
30
|
+
super(props), this.state = {
|
|
31
|
+
isFirefox: false,
|
|
32
|
+
needsTabIndex: false
|
|
33
|
+
}, this.lastNeedsTabIndex = false, this.ref = null, this.handleRef = (el)=>{
|
|
34
|
+
const { elementRef } = this.props;
|
|
35
|
+
this.ref = el;
|
|
36
|
+
if (typeof elementRef === 'function') {
|
|
37
|
+
elementRef(el);
|
|
38
|
+
}
|
|
39
|
+
}, this.syncTabIndex = ()=>{
|
|
40
|
+
const finalRef = this.getFinalRef(this.ref);
|
|
41
|
+
const hasScrollbar = !!finalRef && Math.abs((finalRef.scrollHeight ?? 0) - (finalRef.getBoundingClientRect()?.height ?? 0)) > 1;
|
|
42
|
+
const needsTabIndex = hasScrollbar && findTabbable(finalRef).length === 0;
|
|
43
|
+
if (needsTabIndex === this.lastNeedsTabIndex) return;
|
|
44
|
+
this.lastNeedsTabIndex = needsTabIndex;
|
|
45
|
+
this.setState({
|
|
46
|
+
needsTabIndex
|
|
47
|
+
});
|
|
48
|
+
};
|
|
69
49
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
50
|
+
componentDidMount() {
|
|
51
|
+
this.props.makeStyles?.();
|
|
52
|
+
const style = this.ref && getCSSStyleDeclaration(this.ref);
|
|
53
|
+
const isFirefox = !!(style && Array.prototype.slice.call(style).join('').match(/(?:-moz-)/));
|
|
54
|
+
if (isFirefox) {
|
|
55
|
+
this.setState({
|
|
56
|
+
isFirefox
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
const finalRef = this.getFinalRef(this.ref);
|
|
60
|
+
if (finalRef && typeof ResizeObserver !== 'undefined') {
|
|
61
|
+
this.syncTabIndex();
|
|
62
|
+
this.resizeObserver = new ResizeObserver(this.syncTabIndex);
|
|
63
|
+
this.resizeObserver.observe(finalRef);
|
|
64
|
+
this.mutationObserver = new MutationObserver(this.syncTabIndex);
|
|
65
|
+
this.mutationObserver.observe(finalRef, {
|
|
66
|
+
childList: true,
|
|
67
|
+
subtree: true,
|
|
68
|
+
attributes: true,
|
|
69
|
+
attributeFilter: [
|
|
70
|
+
'disabled',
|
|
71
|
+
'tabindex',
|
|
72
|
+
'hidden',
|
|
73
|
+
'href',
|
|
74
|
+
'contenteditable',
|
|
75
|
+
'type',
|
|
76
|
+
'class',
|
|
77
|
+
'style'
|
|
78
|
+
]
|
|
79
|
+
});
|
|
80
|
+
}
|
|
84
81
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
this.resizeObserver = new ResizeObserver(this.syncTabIndex);
|
|
89
|
-
this.resizeObserver.observe(finalRef);
|
|
90
|
-
this.mutationObserver = new MutationObserver(this.syncTabIndex);
|
|
91
|
-
this.mutationObserver.observe(finalRef, {
|
|
92
|
-
childList: true,
|
|
93
|
-
subtree: true,
|
|
94
|
-
attributes: true,
|
|
95
|
-
attributeFilter: ['disabled', 'tabindex', 'hidden', 'href', 'contenteditable', 'type', 'class', 'style']
|
|
96
|
-
});
|
|
82
|
+
componentDidUpdate() {
|
|
83
|
+
this.props.makeStyles?.();
|
|
84
|
+
this.syncTabIndex();
|
|
97
85
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
// The observers miss some changes, e.g. a text-only edit that makes the
|
|
102
|
-
// body overflow without resizing it. syncTabIndex returns early if
|
|
103
|
-
// nothing changed.
|
|
104
|
-
this.syncTabIndex();
|
|
105
|
-
}
|
|
106
|
-
componentWillUnmount() {
|
|
107
|
-
this.resizeObserver?.disconnect();
|
|
108
|
-
this.mutationObserver?.disconnect();
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// The body is a tab stop only while it can be scrolled but holds nothing
|
|
112
|
-
// focusable.
|
|
113
|
-
syncTabIndex = () => {
|
|
114
|
-
const finalRef = this.getFinalRef(this.ref);
|
|
115
|
-
const hasScrollbar = !!finalRef && Math.abs((finalRef.scrollHeight ?? 0) - (finalRef.getBoundingClientRect()?.height ?? 0)) > 1;
|
|
116
|
-
const needsTabIndex = hasScrollbar && findTabbable(finalRef).length === 0;
|
|
117
|
-
if (needsTabIndex === this.lastNeedsTabIndex) return;
|
|
118
|
-
this.lastNeedsTabIndex = needsTabIndex;
|
|
119
|
-
this.setState({
|
|
120
|
-
needsTabIndex
|
|
121
|
-
});
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
// this recursive function is needed because `ref` can be a React component.
|
|
125
|
-
// TODO rethink, the 'as' prop, likely its not a good idea to allow React
|
|
126
|
-
// components. See INSTUI-4674
|
|
127
|
-
getFinalRef(el) {
|
|
128
|
-
if (!el) {
|
|
129
|
-
return undefined;
|
|
86
|
+
componentWillUnmount() {
|
|
87
|
+
this.resizeObserver?.disconnect();
|
|
88
|
+
this.mutationObserver?.disconnect();
|
|
130
89
|
}
|
|
131
|
-
|
|
132
|
-
|
|
90
|
+
getFinalRef(el) {
|
|
91
|
+
if (!el) {
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
if (el instanceof Element) {
|
|
95
|
+
return el;
|
|
96
|
+
}
|
|
97
|
+
if (el.ref) {
|
|
98
|
+
return this.getFinalRef(el.ref);
|
|
99
|
+
}
|
|
100
|
+
return undefined;
|
|
133
101
|
}
|
|
134
|
-
|
|
135
|
-
|
|
102
|
+
render() {
|
|
103
|
+
const { as, elementRef, overflow, variant, padding, children, ...rest } = this.props;
|
|
104
|
+
const passthroughProps = View.omitViewProps(omitProps(rest, ModalBody.allowedProps), ModalBody);
|
|
105
|
+
const isFit = overflow === 'fit';
|
|
106
|
+
const { needsTabIndex } = this.state;
|
|
107
|
+
return /*#__PURE__*/ _jsx(ModalContext.Consumer, {
|
|
108
|
+
children: (value)=>/*#__PURE__*/ _jsx(View, {
|
|
109
|
+
...passthroughProps,
|
|
110
|
+
display: "block",
|
|
111
|
+
"data-cid": "ModalBody",
|
|
112
|
+
width: isFit ? '100%' : undefined,
|
|
113
|
+
height: isFit ? '100%' : undefined,
|
|
114
|
+
elementRef: this.handleRef,
|
|
115
|
+
as: as,
|
|
116
|
+
css: this.props.styles?.modalBody,
|
|
117
|
+
padding: padding,
|
|
118
|
+
...needsTabIndex ? {
|
|
119
|
+
tabIndex: 0,
|
|
120
|
+
'aria-label': value.bodyScrollAriaLabel
|
|
121
|
+
} : {},
|
|
122
|
+
children: children
|
|
123
|
+
})
|
|
124
|
+
});
|
|
136
125
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
as,
|
|
142
|
-
elementRef,
|
|
143
|
-
overflow,
|
|
144
|
-
variant,
|
|
145
|
-
padding,
|
|
146
|
-
children,
|
|
147
|
-
...rest
|
|
148
|
-
} = this.props;
|
|
149
|
-
const passthroughProps = View.omitViewProps(omitProps(rest, ModalBody.allowedProps), ModalBody);
|
|
150
|
-
const isFit = overflow === 'fit';
|
|
151
|
-
const {
|
|
152
|
-
needsTabIndex
|
|
153
|
-
} = this.state;
|
|
154
|
-
return _jsx(ModalContext.Consumer, {
|
|
155
|
-
children: value => _jsx(View, {
|
|
156
|
-
...passthroughProps,
|
|
157
|
-
display: "block",
|
|
158
|
-
"data-cid": "ModalBody",
|
|
159
|
-
width: isFit ? '100%' : undefined,
|
|
160
|
-
height: isFit ? '100%' : undefined,
|
|
161
|
-
elementRef: this.handleRef,
|
|
162
|
-
as: as,
|
|
163
|
-
css: this.props.styles?.modalBody,
|
|
164
|
-
padding: padding
|
|
165
|
-
// check if there is a scrollbar and no focusable children, if so, the
|
|
166
|
-
// element has to be tabbable
|
|
167
|
-
,
|
|
168
|
-
...(needsTabIndex ? {
|
|
169
|
-
tabIndex: 0,
|
|
170
|
-
'aria-label': value.bodyScrollAriaLabel
|
|
171
|
-
} : {}),
|
|
172
|
-
children: children
|
|
173
|
-
})
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
}) || _class);
|
|
126
|
+
}
|
|
127
|
+
ModalBody = _ts_decorate([
|
|
128
|
+
withStyle(generateStyle, generateComponentTheme)
|
|
129
|
+
], ModalBody);
|
|
177
130
|
export default ModalBody;
|
|
178
|
-
export { ModalBody };
|
|
131
|
+
export { ModalBody };
|
|
@@ -1,26 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
const allowedProps = ['children', 'padding', 'elementRef', 'as', 'variant', 'overflow'];
|
|
26
|
-
export { allowedProps };
|
|
1
|
+
const allowedProps = [
|
|
2
|
+
'children',
|
|
3
|
+
'padding',
|
|
4
|
+
'elementRef',
|
|
5
|
+
'as',
|
|
6
|
+
'variant',
|
|
7
|
+
'overflow'
|
|
8
|
+
];
|
|
9
|
+
export { allowedProps };
|
|
@@ -1,58 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* ---
|
|
27
|
-
* private: true
|
|
28
|
-
* ---
|
|
29
|
-
* Generates the style object from the theme and provided additional information
|
|
30
|
-
* @param {Object} componentTheme The theme variable object.
|
|
31
|
-
* @param {Object} props the props of the component, the style is applied to
|
|
32
|
-
* @param {Object} state the state of the component, the style is applied to
|
|
33
|
-
* @return {Object} The final style object, which will be used in the component
|
|
34
|
-
*/
|
|
35
|
-
const generateStyle = (componentTheme, props) => {
|
|
36
|
-
const {
|
|
37
|
-
variant
|
|
38
|
-
} = props;
|
|
39
|
-
const backgroundStyle = variant === 'inverse' ? {
|
|
40
|
-
background: componentTheme.inverseBackground
|
|
41
|
-
} : {};
|
|
42
|
-
return {
|
|
43
|
-
modalBody: {
|
|
44
|
-
label: 'modalBody',
|
|
45
|
-
boxSizing: 'border-box',
|
|
46
|
-
flex: '1 1 auto',
|
|
47
|
-
'&:focus': {
|
|
48
|
-
outline: 'none'
|
|
49
|
-
},
|
|
50
|
-
// ModalBody is set to scrollable above 20rem height
|
|
51
|
-
'@media (min-height: 20rem)': {
|
|
52
|
-
overflowY: 'auto'
|
|
53
|
-
},
|
|
54
|
-
...backgroundStyle
|
|
55
|
-
}
|
|
56
|
-
};
|
|
1
|
+
const generateStyle = (componentTheme, props)=>{
|
|
2
|
+
const { variant } = props;
|
|
3
|
+
const backgroundStyle = variant === 'inverse' ? {
|
|
4
|
+
background: componentTheme.inverseBackground
|
|
5
|
+
} : {};
|
|
6
|
+
return {
|
|
7
|
+
modalBody: {
|
|
8
|
+
label: 'modalBody',
|
|
9
|
+
boxSizing: 'border-box',
|
|
10
|
+
flex: '1 1 auto',
|
|
11
|
+
'&:focus': {
|
|
12
|
+
outline: 'none'
|
|
13
|
+
},
|
|
14
|
+
'@media (min-height: 20rem)': {
|
|
15
|
+
overflowY: 'auto'
|
|
16
|
+
},
|
|
17
|
+
...backgroundStyle
|
|
18
|
+
}
|
|
19
|
+
};
|
|
57
20
|
};
|
|
58
|
-
export default generateStyle;
|
|
21
|
+
export default generateStyle;
|
|
@@ -1,38 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Generates the theme object for the component from the theme and provided additional information
|
|
27
|
-
* @param {Object} theme The actual theme object.
|
|
28
|
-
* @return {Object} The final theme object with the overrides and component variables
|
|
29
|
-
*/
|
|
30
|
-
const generateComponentTheme = theme => {
|
|
31
|
-
const {
|
|
32
|
-
colors
|
|
33
|
-
} = theme;
|
|
34
|
-
return {
|
|
35
|
-
inverseBackground: colors?.contrasts?.grey100100
|
|
36
|
-
};
|
|
1
|
+
const generateComponentTheme = (theme)=>{
|
|
2
|
+
const { colors } = theme;
|
|
3
|
+
return {
|
|
4
|
+
inverseBackground: colors?.contrasts?.grey100100
|
|
5
|
+
};
|
|
37
6
|
};
|
|
38
|
-
export default generateComponentTheme;
|
|
7
|
+
export default generateComponentTheme;
|
|
@@ -1,34 +1,6 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The MIT License (MIT)
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
1
|
import { createContext } from 'react';
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
* @private
|
|
29
|
-
*/
|
|
30
|
-
const ModalContext = /*#__PURE__*/createContext({
|
|
31
|
-
bodyScrollAriaLabel: undefined
|
|
2
|
+
const ModalContext = createContext({
|
|
3
|
+
bodyScrollAriaLabel: undefined
|
|
32
4
|
});
|
|
33
5
|
export default ModalContext;
|
|
34
|
-
export { ModalContext };
|
|
6
|
+
export { ModalContext };
|
|
@@ -1,71 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* The MIT License (MIT)
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
6
|
-
*
|
|
7
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
-
* in the Software without restriction, including without limitation the rights
|
|
10
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
* furnished to do so, subject to the following conditions:
|
|
13
|
-
*
|
|
14
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
* copies or substantial portions of the Software.
|
|
16
|
-
*
|
|
17
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
* SOFTWARE.
|
|
24
|
-
*/
|
|
25
|
-
|
|
1
|
+
import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
|
|
2
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
26
3
|
import { Component } from 'react';
|
|
27
4
|
import { passthroughProps } from '@instructure/ui-react-utils';
|
|
28
5
|
import { withStyle } from '@instructure/emotion';
|
|
29
6
|
import generateStyle from './styles.js';
|
|
30
7
|
import generateComponentTheme from './theme.js';
|
|
31
8
|
import { allowedProps } from './props.js';
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
9
|
+
class ModalFooter extends Component {
|
|
10
|
+
static{
|
|
11
|
+
this.displayName = 'ModalFooter';
|
|
12
|
+
}
|
|
13
|
+
static{
|
|
14
|
+
this.componentId = 'Modal.Footer';
|
|
15
|
+
}
|
|
16
|
+
static{
|
|
17
|
+
this.allowedProps = allowedProps;
|
|
18
|
+
}
|
|
19
|
+
static{
|
|
20
|
+
this.defaultProps = {
|
|
21
|
+
variant: 'default'
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
componentDidMount() {
|
|
25
|
+
this.props.makeStyles?.();
|
|
26
|
+
}
|
|
27
|
+
componentDidUpdate() {
|
|
28
|
+
this.props.makeStyles?.();
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
const { children, ...rest } = this.props;
|
|
32
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
33
|
+
css: this.props.styles?.modalFooter,
|
|
34
|
+
...passthroughProps(rest),
|
|
35
|
+
ref: this.handleRef,
|
|
36
|
+
"data-cid": "ModalFooter",
|
|
37
|
+
children: children
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
constructor(...args){
|
|
41
|
+
super(...args), this.ref = null, this.handleRef = (el)=>{
|
|
42
|
+
this.ref = el;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
ModalFooter = _ts_decorate([
|
|
47
|
+
withStyle(generateStyle, generateComponentTheme)
|
|
48
|
+
], ModalFooter);
|
|
70
49
|
export default ModalFooter;
|
|
71
|
-
export { ModalFooter };
|
|
50
|
+
export { ModalFooter };
|
|
@@ -1,26 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
const allowedProps = ['children', 'variant'];
|
|
26
|
-
export { allowedProps };
|
|
1
|
+
const allowedProps = [
|
|
2
|
+
'children',
|
|
3
|
+
'variant'
|
|
4
|
+
];
|
|
5
|
+
export { allowedProps };
|