@instructure/ui-modal 10.16.1-snapshot-0 → 10.16.1
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 +1 -1
- package/es/Modal/ModalBody/__new-tests__/ModalBody.test.js +21 -12
- package/es/Modal/ModalBody/index.js +10 -6
- package/es/Modal/ModalFooter/__new-tests__/ModalFooter.test.js +8 -5
- package/es/Modal/ModalFooter/index.js +8 -7
- package/es/Modal/ModalHeader/__new-tests__/ModalHeader.test.js +19 -12
- package/es/Modal/ModalHeader/index.js +10 -9
- package/es/Modal/__new-tests__/Modal.test.js +185 -97
- package/es/Modal/index.js +33 -25
- package/lib/Modal/ModalBody/__new-tests__/ModalBody.test.js +22 -13
- package/lib/Modal/ModalBody/index.js +9 -5
- package/lib/Modal/ModalFooter/__new-tests__/ModalFooter.test.js +9 -6
- package/lib/Modal/ModalFooter/index.js +7 -6
- package/lib/Modal/ModalHeader/__new-tests__/ModalHeader.test.js +20 -13
- package/lib/Modal/ModalHeader/index.js +9 -9
- package/lib/Modal/__new-tests__/Modal.test.js +185 -97
- package/lib/Modal/index.js +32 -24
- package/package.json +19 -19
- package/src/Modal/ModalBody/__new-tests__/ModalBody.test.tsx +0 -2
- package/src/Modal/ModalBody/index.tsx +1 -2
- package/src/Modal/ModalFooter/__new-tests__/ModalFooter.test.tsx +0 -2
- package/src/Modal/ModalFooter/index.tsx +1 -2
- package/src/Modal/ModalHeader/__new-tests__/ModalHeader.test.tsx +0 -2
- package/src/Modal/ModalHeader/index.tsx +4 -5
- package/src/Modal/__new-tests__/Modal.test.tsx +3 -5
- package/src/Modal/index.tsx +1 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Modal/ModalBody/__new-tests__/ModalBody.test.d.ts.map +1 -1
- package/types/Modal/ModalBody/index.d.ts +1 -3
- package/types/Modal/ModalBody/index.d.ts.map +1 -1
- package/types/Modal/ModalFooter/__new-tests__/ModalFooter.test.d.ts.map +1 -1
- package/types/Modal/ModalFooter/index.d.ts +1 -3
- package/types/Modal/ModalFooter/index.d.ts.map +1 -1
- package/types/Modal/ModalHeader/__new-tests__/ModalHeader.test.d.ts.map +1 -1
- package/types/Modal/ModalHeader/index.d.ts +2 -4
- package/types/Modal/ModalHeader/index.d.ts.map +1 -1
- package/types/Modal/index.d.ts +2 -4
- package/types/Modal/index.d.ts.map +1 -1
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.16.1
|
|
6
|
+
## [10.16.1](https://github.com/instructure/instructure-ui/compare/v10.16.0...v10.16.1) (2025-04-22)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-modal
|
|
9
9
|
|
|
@@ -23,7 +23,6 @@ var _ModalBody, _ModalBody2, _ModalBody3;
|
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import React from 'react';
|
|
27
26
|
import { render } from '@testing-library/react';
|
|
28
27
|
import { vi } from 'vitest';
|
|
29
28
|
import '@testing-library/jest-dom';
|
|
@@ -32,19 +31,23 @@ import canvas from '@instructure/ui-themes';
|
|
|
32
31
|
import { View } from '@instructure/ui-view';
|
|
33
32
|
import { ModalBody } from '../index';
|
|
34
33
|
import generateComponentTheme from '../theme';
|
|
34
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
35
35
|
const BODY_TEXT = 'Modal-body-text';
|
|
36
36
|
describe('<ModalBody />', () => {
|
|
37
37
|
it('should render', async () => {
|
|
38
|
-
const _render = render(_ModalBody || (_ModalBody =
|
|
38
|
+
const _render = render(_ModalBody || (_ModalBody = _jsx(ModalBody, {
|
|
39
|
+
children: BODY_TEXT
|
|
40
|
+
}))),
|
|
39
41
|
findByText = _render.findByText;
|
|
40
42
|
const modalBody = await findByText(BODY_TEXT);
|
|
41
43
|
expect(modalBody).toBeInTheDocument();
|
|
42
44
|
});
|
|
43
45
|
it('should set inverse styles', async () => {
|
|
44
46
|
const themeVariables = generateComponentTheme(canvas);
|
|
45
|
-
const _render2 = render(_ModalBody2 || (_ModalBody2 =
|
|
46
|
-
variant: "inverse"
|
|
47
|
-
|
|
47
|
+
const _render2 = render(_ModalBody2 || (_ModalBody2 = _jsx(ModalBody, {
|
|
48
|
+
variant: "inverse",
|
|
49
|
+
children: BODY_TEXT
|
|
50
|
+
}))),
|
|
48
51
|
findByText = _render2.findByText;
|
|
49
52
|
const modalBody = await findByText(BODY_TEXT);
|
|
50
53
|
const modalBodyStyle = window.getComputedStyle(modalBody);
|
|
@@ -53,14 +56,16 @@ describe('<ModalBody />', () => {
|
|
|
53
56
|
expect(bodyBackground).toBe(themeVariables.inverseBackground);
|
|
54
57
|
});
|
|
55
58
|
it('should set the same width and height as the parent when overflow is set to fit', async () => {
|
|
56
|
-
const _render3 = render(
|
|
59
|
+
const _render3 = render(_jsx("div", {
|
|
57
60
|
style: {
|
|
58
61
|
width: '500px',
|
|
59
62
|
height: '600px'
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
},
|
|
64
|
+
children: _ModalBody3 || (_ModalBody3 = _jsx(ModalBody, {
|
|
65
|
+
overflow: "fit",
|
|
66
|
+
children: BODY_TEXT
|
|
67
|
+
}))
|
|
68
|
+
})),
|
|
64
69
|
findByText = _render3.findByText;
|
|
65
70
|
const modalBody = await findByText(BODY_TEXT);
|
|
66
71
|
const modalBodyStyle = window.getComputedStyle(modalBody);
|
|
@@ -81,7 +86,9 @@ describe('<ModalBody />', () => {
|
|
|
81
86
|
const props = {
|
|
82
87
|
[prop]: allowedProps[prop]
|
|
83
88
|
};
|
|
84
|
-
render(
|
|
89
|
+
render(_jsx(ModalBody, {
|
|
90
|
+
...props
|
|
91
|
+
}));
|
|
85
92
|
expect(consoleErrorSpy).not.toHaveBeenCalled();
|
|
86
93
|
consoleErrorSpy.mockRestore();
|
|
87
94
|
});
|
|
@@ -92,7 +99,9 @@ describe('<ModalBody />', () => {
|
|
|
92
99
|
const props = {
|
|
93
100
|
[prop]: 'NOT_ALLOWED_VALUE'
|
|
94
101
|
};
|
|
95
|
-
render(
|
|
102
|
+
render(_jsx(ModalBody, {
|
|
103
|
+
...props
|
|
104
|
+
}));
|
|
96
105
|
expect(consoleErrorSpy).toHaveBeenCalledWith(expect.stringContaining(expectedErrorMessage), expect.any(String));
|
|
97
106
|
consoleErrorSpy.mockRestore();
|
|
98
107
|
});
|
|
@@ -25,16 +25,16 @@ var _dec, _dec2, _class, _ModalBody;
|
|
|
25
25
|
* SOFTWARE.
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
/** @jsx jsx */
|
|
29
28
|
import { Component } from 'react';
|
|
30
29
|
import { View } from '@instructure/ui-view';
|
|
31
30
|
import { testable } from '@instructure/ui-testable';
|
|
32
31
|
import { omitProps } from '@instructure/ui-react-utils';
|
|
33
32
|
import { getComputedStyle } from '@instructure/ui-dom-utils';
|
|
34
|
-
import { withStyle
|
|
33
|
+
import { withStyle } from '@instructure/emotion';
|
|
35
34
|
import generateStyle from './styles';
|
|
36
35
|
import generateComponentTheme from './theme';
|
|
37
36
|
import { propTypes, allowedProps } from './props';
|
|
37
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
38
38
|
/**
|
|
39
39
|
---
|
|
40
40
|
parent: Modal
|
|
@@ -85,7 +85,8 @@ let ModalBody = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
85
85
|
rest = _objectWithoutProperties(_this$props3, _excluded);
|
|
86
86
|
const passthroughProps = View.omitViewProps(omitProps(rest, ModalBody.allowedProps), ModalBody);
|
|
87
87
|
const isFit = overflow === 'fit';
|
|
88
|
-
return
|
|
88
|
+
return _jsx(View, {
|
|
89
|
+
...passthroughProps,
|
|
89
90
|
display: "block",
|
|
90
91
|
width: isFit ? '100%' : void 0,
|
|
91
92
|
height: isFit ? '100%' : void 0,
|
|
@@ -97,9 +98,12 @@ let ModalBody = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
97
98
|
// the container focusable when it is scrollable.
|
|
98
99
|
// This is a feature, not a bug, but it prevents VoiceOver
|
|
99
100
|
// to correctly focus inside the body in other browsers.
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
,
|
|
102
|
+
...(this.state.isFirefox && {
|
|
103
|
+
tabIndex: -1
|
|
104
|
+
}),
|
|
105
|
+
children: children
|
|
106
|
+
});
|
|
103
107
|
}
|
|
104
108
|
}, _ModalBody.displayName = "ModalBody", _ModalBody.componentId = 'Modal.Body', _ModalBody.propTypes = propTypes, _ModalBody.allowedProps = allowedProps, _ModalBody.defaultProps = {
|
|
105
109
|
padding: 'medium',
|
|
@@ -23,26 +23,29 @@ var _ModalFooter, _ModalFooter2;
|
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import React from 'react';
|
|
27
26
|
import { render } from '@testing-library/react';
|
|
28
27
|
import '@testing-library/jest-dom';
|
|
29
28
|
import canvas from '@instructure/ui-themes';
|
|
30
29
|
import { color2hex } from '@instructure/ui-color-utils';
|
|
31
30
|
import { ModalFooter } from '../index';
|
|
32
31
|
import generateComponentTheme from '../theme';
|
|
32
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
33
33
|
const FOOTER_TEXT = 'Modal-footer-text';
|
|
34
34
|
describe('<ModalFooter />', () => {
|
|
35
35
|
it('should render', async () => {
|
|
36
|
-
const _render = render(_ModalFooter || (_ModalFooter =
|
|
36
|
+
const _render = render(_ModalFooter || (_ModalFooter = _jsx(ModalFooter, {
|
|
37
|
+
children: FOOTER_TEXT
|
|
38
|
+
}))),
|
|
37
39
|
findByText = _render.findByText;
|
|
38
40
|
const modalFooter = await findByText(FOOTER_TEXT);
|
|
39
41
|
expect(modalFooter).toBeInTheDocument();
|
|
40
42
|
});
|
|
41
43
|
it('should set inverse styles', async () => {
|
|
42
44
|
const themeVariables = generateComponentTheme(canvas);
|
|
43
|
-
const _render2 = render(_ModalFooter2 || (_ModalFooter2 =
|
|
44
|
-
variant: "inverse"
|
|
45
|
-
|
|
45
|
+
const _render2 = render(_ModalFooter2 || (_ModalFooter2 = _jsx(ModalFooter, {
|
|
46
|
+
variant: "inverse",
|
|
47
|
+
children: FOOTER_TEXT
|
|
48
|
+
}))),
|
|
46
49
|
findByText = _render2.findByText;
|
|
47
50
|
const modalFooter = await findByText(FOOTER_TEXT);
|
|
48
51
|
const modalFooterStyle = window.getComputedStyle(modalFooter);
|
|
@@ -25,14 +25,14 @@ var _dec, _dec2, _class, _ModalFooter;
|
|
|
25
25
|
* SOFTWARE.
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
/** @jsx jsx */
|
|
29
28
|
import { Component } from 'react';
|
|
30
29
|
import { passthroughProps } from '@instructure/ui-react-utils';
|
|
31
30
|
import { testable } from '@instructure/ui-testable';
|
|
32
|
-
import { withStyle
|
|
31
|
+
import { withStyle } from '@instructure/emotion';
|
|
33
32
|
import generateStyle from './styles';
|
|
34
33
|
import generateComponentTheme from './theme';
|
|
35
34
|
import { propTypes, allowedProps } from './props';
|
|
35
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
36
36
|
/**
|
|
37
37
|
---
|
|
38
38
|
parent: Modal
|
|
@@ -60,11 +60,12 @@ let ModalFooter = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
60
60
|
const _this$props3 = this.props,
|
|
61
61
|
children = _this$props3.children,
|
|
62
62
|
rest = _objectWithoutProperties(_this$props3, _excluded);
|
|
63
|
-
return
|
|
64
|
-
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.modalFooter
|
|
65
|
-
|
|
66
|
-
ref: this.handleRef
|
|
67
|
-
|
|
63
|
+
return _jsx("div", {
|
|
64
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.modalFooter,
|
|
65
|
+
...passthroughProps(rest),
|
|
66
|
+
ref: this.handleRef,
|
|
67
|
+
children: children
|
|
68
|
+
});
|
|
68
69
|
}
|
|
69
70
|
}, _ModalFooter.displayName = "ModalFooter", _ModalFooter.componentId = 'Modal.Footer', _ModalFooter.propTypes = propTypes, _ModalFooter.allowedProps = allowedProps, _ModalFooter.defaultProps = {
|
|
70
71
|
variant: 'default'
|
|
@@ -23,26 +23,29 @@ var _ModalHeader, _ModalHeader2, _ModalHeader3, _ModalHeader4, _ModalHeader5;
|
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import React from 'react';
|
|
27
26
|
import { render } from '@testing-library/react';
|
|
28
27
|
import '@testing-library/jest-dom';
|
|
29
28
|
import canvas from '@instructure/ui-themes';
|
|
30
29
|
import { color2hex } from '@instructure/ui-color-utils';
|
|
31
30
|
import { ModalHeader } from '../index';
|
|
32
31
|
import generateComponentTheme from '../theme';
|
|
32
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
33
33
|
const HEADER_TEXT = 'Modal-footer-text';
|
|
34
34
|
describe('<ModalHeader />', () => {
|
|
35
35
|
it('should render', async () => {
|
|
36
|
-
const _render = render(_ModalHeader || (_ModalHeader =
|
|
36
|
+
const _render = render(_ModalHeader || (_ModalHeader = _jsx(ModalHeader, {
|
|
37
|
+
children: HEADER_TEXT
|
|
38
|
+
}))),
|
|
37
39
|
findByText = _render.findByText;
|
|
38
40
|
const modalHeader = await findByText(HEADER_TEXT);
|
|
39
41
|
expect(modalHeader).toBeInTheDocument();
|
|
40
42
|
});
|
|
41
43
|
it('should set inverse styles', async () => {
|
|
42
44
|
const themeVariables = generateComponentTheme(canvas);
|
|
43
|
-
const _render2 = render(_ModalHeader2 || (_ModalHeader2 =
|
|
44
|
-
variant: "inverse"
|
|
45
|
-
|
|
45
|
+
const _render2 = render(_ModalHeader2 || (_ModalHeader2 = _jsx(ModalHeader, {
|
|
46
|
+
variant: "inverse",
|
|
47
|
+
children: HEADER_TEXT
|
|
48
|
+
}))),
|
|
46
49
|
findByText = _render2.findByText;
|
|
47
50
|
const modalHeader = await findByText(HEADER_TEXT);
|
|
48
51
|
const modalHeaderStyle = window.getComputedStyle(modalHeader);
|
|
@@ -55,7 +58,9 @@ describe('<ModalHeader />', () => {
|
|
|
55
58
|
describe('spacing prop', () => {
|
|
56
59
|
it('should be correct by default', async () => {
|
|
57
60
|
const themeVariables = generateComponentTheme(canvas);
|
|
58
|
-
const _render3 = render(_ModalHeader3 || (_ModalHeader3 =
|
|
61
|
+
const _render3 = render(_ModalHeader3 || (_ModalHeader3 = _jsx(ModalHeader, {
|
|
62
|
+
children: HEADER_TEXT
|
|
63
|
+
}))),
|
|
59
64
|
findByText = _render3.findByText;
|
|
60
65
|
const modalHeader = await findByText(HEADER_TEXT);
|
|
61
66
|
const modalHeaderStyle = window.getComputedStyle(modalHeader);
|
|
@@ -65,9 +70,10 @@ describe('<ModalHeader />', () => {
|
|
|
65
70
|
});
|
|
66
71
|
it('should correctly set default spacing', async () => {
|
|
67
72
|
const themeVariables = generateComponentTheme(canvas);
|
|
68
|
-
const _render4 = render(_ModalHeader4 || (_ModalHeader4 =
|
|
69
|
-
spacing: "default"
|
|
70
|
-
|
|
73
|
+
const _render4 = render(_ModalHeader4 || (_ModalHeader4 = _jsx(ModalHeader, {
|
|
74
|
+
spacing: "default",
|
|
75
|
+
children: HEADER_TEXT
|
|
76
|
+
}))),
|
|
71
77
|
findByText = _render4.findByText;
|
|
72
78
|
const modalHeader = await findByText(HEADER_TEXT);
|
|
73
79
|
const modalHeaderStyle = window.getComputedStyle(modalHeader);
|
|
@@ -77,9 +83,10 @@ describe('<ModalHeader />', () => {
|
|
|
77
83
|
});
|
|
78
84
|
it('should correctly set compact spacing', async () => {
|
|
79
85
|
const themeVariables = generateComponentTheme(canvas);
|
|
80
|
-
const _render5 = render(_ModalHeader5 || (_ModalHeader5 =
|
|
81
|
-
spacing: "compact"
|
|
82
|
-
|
|
86
|
+
const _render5 = render(_ModalHeader5 || (_ModalHeader5 = _jsx(ModalHeader, {
|
|
87
|
+
spacing: "compact",
|
|
88
|
+
children: HEADER_TEXT
|
|
89
|
+
}))),
|
|
83
90
|
findByText = _render5.findByText;
|
|
84
91
|
const modalHeader = await findByText(HEADER_TEXT);
|
|
85
92
|
const modalHeaderStyle = window.getComputedStyle(modalHeader);
|
|
@@ -25,15 +25,15 @@ var _dec, _dec2, _class, _ModalHeader;
|
|
|
25
25
|
* SOFTWARE.
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
import React, { Component } from 'react';
|
|
28
|
+
import { Children, Component } from 'react';
|
|
30
29
|
import { matchComponentTypes, passthroughProps } from '@instructure/ui-react-utils';
|
|
31
30
|
import { testable } from '@instructure/ui-testable';
|
|
32
|
-
import { withStyle
|
|
31
|
+
import { withStyle } from '@instructure/emotion';
|
|
33
32
|
import { CloseButton } from '@instructure/ui-buttons';
|
|
34
33
|
import generateStyle from './styles';
|
|
35
34
|
import generateComponentTheme from './theme';
|
|
36
35
|
import { propTypes, allowedProps } from './props';
|
|
36
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
37
37
|
/**
|
|
38
38
|
---
|
|
39
39
|
parent: Modal
|
|
@@ -63,7 +63,7 @@ let ModalHeader = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
63
63
|
}
|
|
64
64
|
get usesCloseButton() {
|
|
65
65
|
let hasCloseButton = false;
|
|
66
|
-
|
|
66
|
+
Children.forEach(this.props.children, child => {
|
|
67
67
|
if (child && matchComponentTypes(child, [CloseButton])) {
|
|
68
68
|
hasCloseButton = true;
|
|
69
69
|
}
|
|
@@ -75,11 +75,12 @@ let ModalHeader = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
75
75
|
const _this$props3 = this.props,
|
|
76
76
|
children = _this$props3.children,
|
|
77
77
|
rest = _objectWithoutProperties(_this$props3, _excluded);
|
|
78
|
-
return
|
|
79
|
-
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.modalHeader
|
|
80
|
-
|
|
81
|
-
ref: this.handleRef
|
|
82
|
-
|
|
78
|
+
return _jsx("div", {
|
|
79
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.modalHeader,
|
|
80
|
+
...passthroughProps(rest),
|
|
81
|
+
ref: this.handleRef,
|
|
82
|
+
children: children
|
|
83
|
+
});
|
|
83
84
|
}
|
|
84
85
|
}, _ModalHeader.displayName = "ModalHeader", _ModalHeader.componentId = 'Modal.Header', _ModalHeader.propTypes = propTypes, _ModalHeader.allowedProps = allowedProps, _ModalHeader.defaultProps = {
|
|
85
86
|
variant: 'default',
|