@instructure/ui-modal 11.7.4-snapshot-108 → 11.7.4-snapshot-111
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 +2 -1
- package/es/Modal/v2/styles.js +14 -3
- package/lib/Modal/v2/styles.js +14 -3
- package/package.json +17 -17
- package/src/Modal/v2/README.md +5 -2
- package/src/Modal/v2/styles.ts +16 -4
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Modal/v2/styles.d.ts +2 -2
- package/types/Modal/v2/styles.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
|
-
## [11.7.4-snapshot-
|
|
6
|
+
## [11.7.4-snapshot-111](https://github.com/instructure/instructure-ui/compare/v11.7.3...v11.7.4-snapshot-111) (2026-07-16)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### Bug Fixes
|
|
@@ -15,6 +15,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
15
15
|
### Features
|
|
16
16
|
|
|
17
17
|
* **many:** support current spacing tokens in the margin prop for v2 components ([1b47c5f](https://github.com/instructure/instructure-ui/commit/1b47c5f23eaa60b532cdfd53c39bd71f0cf51aaa))
|
|
18
|
+
* **ui-modal:** on larger screens, inset the fullscreen modal from the viewport edge for a11y ([e36b2b5](https://github.com/instructure/instructure-ui/commit/e36b2b586ce24b38d77144f7118169f9249bad29))
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
|
package/es/Modal/v2/styles.js
CHANGED
|
@@ -34,12 +34,13 @@ import { boxShadowObjectsToCSSString } from '@instructure/ui-themes';
|
|
|
34
34
|
* @param {Object} state the state of the component, the style is applied to
|
|
35
35
|
* @return {Object} The final style object, which will be used in the component
|
|
36
36
|
*/
|
|
37
|
-
const generateStyle = (componentTheme, props) => {
|
|
37
|
+
const generateStyle = (componentTheme, props, sharedTokens) => {
|
|
38
38
|
const {
|
|
39
39
|
size,
|
|
40
40
|
variant,
|
|
41
41
|
overflow
|
|
42
42
|
} = props;
|
|
43
|
+
const boxShadow = boxShadowObjectsToCSSString(componentTheme.boxShadow);
|
|
43
44
|
const commonSizeStyleExceptForFullscreen = {
|
|
44
45
|
maxWidth: '95%',
|
|
45
46
|
maxHeight: '95%',
|
|
@@ -71,7 +72,17 @@ const generateStyle = (componentTheme, props) => {
|
|
|
71
72
|
height: '100%',
|
|
72
73
|
boxShadow: 'none',
|
|
73
74
|
border: 'none',
|
|
74
|
-
borderRadius: 0
|
|
75
|
+
borderRadius: 0,
|
|
76
|
+
// On larger screens, inset the fullscreen modal from the viewport edge
|
|
77
|
+
// for a11y: the Mask flex-centers it, so `flex: 1` + `alignSelf: stretch`
|
|
78
|
+
// (auto height) gap it evenly via the margin; corners/shadow restored too.
|
|
79
|
+
[`@media screen and (min-width: ${sharedTokens.breakpoints.md})`]: {
|
|
80
|
+
margin: componentTheme.fullScreenMargin,
|
|
81
|
+
height: 'auto',
|
|
82
|
+
alignSelf: 'stretch',
|
|
83
|
+
borderRadius: componentTheme.borderRadius,
|
|
84
|
+
boxShadow
|
|
85
|
+
}
|
|
75
86
|
}
|
|
76
87
|
};
|
|
77
88
|
const backgroundStyles = variant === 'inverse' ? {
|
|
@@ -92,7 +103,7 @@ const generateStyle = (componentTheme, props) => {
|
|
|
92
103
|
flexDirection: 'column',
|
|
93
104
|
position: 'relative',
|
|
94
105
|
boxSizing: 'border-box',
|
|
95
|
-
boxShadow
|
|
106
|
+
boxShadow,
|
|
96
107
|
borderRadius: componentTheme.borderRadius,
|
|
97
108
|
overflow: 'hidden',
|
|
98
109
|
...sizeStyles[size],
|
package/lib/Modal/v2/styles.js
CHANGED
|
@@ -40,12 +40,13 @@ var _uiThemes = require("@instructure/ui-themes");
|
|
|
40
40
|
* @param {Object} state the state of the component, the style is applied to
|
|
41
41
|
* @return {Object} The final style object, which will be used in the component
|
|
42
42
|
*/
|
|
43
|
-
const generateStyle = (componentTheme, props) => {
|
|
43
|
+
const generateStyle = (componentTheme, props, sharedTokens) => {
|
|
44
44
|
const {
|
|
45
45
|
size,
|
|
46
46
|
variant,
|
|
47
47
|
overflow
|
|
48
48
|
} = props;
|
|
49
|
+
const boxShadow = (0, _uiThemes.boxShadowObjectsToCSSString)(componentTheme.boxShadow);
|
|
49
50
|
const commonSizeStyleExceptForFullscreen = {
|
|
50
51
|
maxWidth: '95%',
|
|
51
52
|
maxHeight: '95%',
|
|
@@ -77,7 +78,17 @@ const generateStyle = (componentTheme, props) => {
|
|
|
77
78
|
height: '100%',
|
|
78
79
|
boxShadow: 'none',
|
|
79
80
|
border: 'none',
|
|
80
|
-
borderRadius: 0
|
|
81
|
+
borderRadius: 0,
|
|
82
|
+
// On larger screens, inset the fullscreen modal from the viewport edge
|
|
83
|
+
// for a11y: the Mask flex-centers it, so `flex: 1` + `alignSelf: stretch`
|
|
84
|
+
// (auto height) gap it evenly via the margin; corners/shadow restored too.
|
|
85
|
+
[`@media screen and (min-width: ${sharedTokens.breakpoints.md})`]: {
|
|
86
|
+
margin: componentTheme.fullScreenMargin,
|
|
87
|
+
height: 'auto',
|
|
88
|
+
alignSelf: 'stretch',
|
|
89
|
+
borderRadius: componentTheme.borderRadius,
|
|
90
|
+
boxShadow
|
|
91
|
+
}
|
|
81
92
|
}
|
|
82
93
|
};
|
|
83
94
|
const backgroundStyles = variant === 'inverse' ? {
|
|
@@ -98,7 +109,7 @@ const generateStyle = (componentTheme, props) => {
|
|
|
98
109
|
flexDirection: 'column',
|
|
99
110
|
position: 'relative',
|
|
100
111
|
boxSizing: 'border-box',
|
|
101
|
-
boxShadow
|
|
112
|
+
boxShadow,
|
|
102
113
|
borderRadius: componentTheme.borderRadius,
|
|
103
114
|
overflow: 'hidden',
|
|
104
115
|
...sizeStyles[size],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-modal",
|
|
3
|
-
"version": "11.7.4-snapshot-
|
|
3
|
+
"version": "11.7.4-snapshot-111",
|
|
4
4
|
"description": "A component for displaying content in a dialog overlay",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -15,28 +15,28 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.29.7",
|
|
18
|
-
"@instructure/console": "11.7.4-snapshot-
|
|
19
|
-
"@instructure/
|
|
20
|
-
"@instructure/
|
|
21
|
-
"@instructure/
|
|
22
|
-
"@instructure/ui-
|
|
23
|
-
"@instructure/ui-dom-utils": "11.7.4-snapshot-
|
|
24
|
-
"@instructure/ui-motion": "11.7.4-snapshot-
|
|
25
|
-
"@instructure/ui-
|
|
26
|
-
"@instructure/ui-
|
|
27
|
-
"@instructure/ui-react-utils": "11.7.4-snapshot-
|
|
28
|
-
"@instructure/ui-themes": "11.7.4-snapshot-
|
|
29
|
-
"@instructure/ui-
|
|
30
|
-
"@instructure/ui-
|
|
18
|
+
"@instructure/console": "11.7.4-snapshot-111",
|
|
19
|
+
"@instructure/shared-types": "11.7.4-snapshot-111",
|
|
20
|
+
"@instructure/ui-dialog": "11.7.4-snapshot-111",
|
|
21
|
+
"@instructure/emotion": "11.7.4-snapshot-111",
|
|
22
|
+
"@instructure/ui-buttons": "11.7.4-snapshot-111",
|
|
23
|
+
"@instructure/ui-dom-utils": "11.7.4-snapshot-111",
|
|
24
|
+
"@instructure/ui-motion": "11.7.4-snapshot-111",
|
|
25
|
+
"@instructure/ui-overlays": "11.7.4-snapshot-111",
|
|
26
|
+
"@instructure/ui-portal": "11.7.4-snapshot-111",
|
|
27
|
+
"@instructure/ui-react-utils": "11.7.4-snapshot-111",
|
|
28
|
+
"@instructure/ui-themes": "11.7.4-snapshot-111",
|
|
29
|
+
"@instructure/ui-utils": "11.7.4-snapshot-111",
|
|
30
|
+
"@instructure/ui-view": "11.7.4-snapshot-111"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@testing-library/jest-dom": "^6.9.1",
|
|
34
34
|
"@testing-library/react": "16.3.2",
|
|
35
35
|
"@testing-library/user-event": "^14.6.1",
|
|
36
36
|
"vitest": "^4.1.9",
|
|
37
|
-
"@instructure/ui-babel-preset": "11.7.4-snapshot-
|
|
38
|
-
"@instructure/ui-
|
|
39
|
-
"@instructure/ui-
|
|
37
|
+
"@instructure/ui-babel-preset": "11.7.4-snapshot-111",
|
|
38
|
+
"@instructure/ui-position": "11.7.4-snapshot-111",
|
|
39
|
+
"@instructure/ui-color-utils": "11.7.4-snapshot-111"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"react": ">=18 <=19"
|
package/src/Modal/v2/README.md
CHANGED
|
@@ -148,8 +148,8 @@ const Example = () => {
|
|
|
148
148
|
background="primary-inverse"
|
|
149
149
|
margin="general.spaceXl auto none"
|
|
150
150
|
display="block"
|
|
151
|
-
width="
|
|
152
|
-
height="
|
|
151
|
+
width="30rem"
|
|
152
|
+
height="30rem"
|
|
153
153
|
borderWidth="large"
|
|
154
154
|
id="constrainExample"
|
|
155
155
|
></View>
|
|
@@ -464,6 +464,9 @@ const Example = () => {
|
|
|
464
464
|
<Modal
|
|
465
465
|
open={open}
|
|
466
466
|
size={smallViewport ? 'fullscreen' : 'small'}
|
|
467
|
+
// Simulate real small-screen behavior by themeOverride.
|
|
468
|
+
// On actual small screens this happens automatically, so no theme override is needed.
|
|
469
|
+
themeOverride={smallViewport ? { fullScreenMargin: '0', borderRadius: '0' } : undefined}
|
|
467
470
|
onDismiss={(event) => {
|
|
468
471
|
if (event.target.id !== 'toggleViewportButton') {
|
|
469
472
|
setOpen(false)
|
package/src/Modal/v2/styles.ts
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import { boxShadowObjectsToCSSString } from '@instructure/ui-themes'
|
|
26
|
-
import type { NewComponentTypes } from '@instructure/ui-themes'
|
|
26
|
+
import type { NewComponentTypes, SharedTokens } from '@instructure/ui-themes'
|
|
27
27
|
import type { ModalProps, ModalStyle } from './props'
|
|
28
28
|
|
|
29
29
|
/**
|
|
@@ -39,9 +39,11 @@ import type { ModalProps, ModalStyle } from './props'
|
|
|
39
39
|
*/
|
|
40
40
|
const generateStyle = (
|
|
41
41
|
componentTheme: ReturnType<NewComponentTypes['Modal']>,
|
|
42
|
-
props: ModalProps
|
|
42
|
+
props: ModalProps,
|
|
43
|
+
sharedTokens: SharedTokens
|
|
43
44
|
): ModalStyle => {
|
|
44
45
|
const { size, variant, overflow } = props
|
|
46
|
+
const boxShadow = boxShadowObjectsToCSSString(componentTheme.boxShadow)
|
|
45
47
|
|
|
46
48
|
const commonSizeStyleExceptForFullscreen = {
|
|
47
49
|
maxWidth: '95%',
|
|
@@ -75,7 +77,17 @@ const generateStyle = (
|
|
|
75
77
|
height: '100%',
|
|
76
78
|
boxShadow: 'none',
|
|
77
79
|
border: 'none',
|
|
78
|
-
borderRadius: 0
|
|
80
|
+
borderRadius: 0,
|
|
81
|
+
// On larger screens, inset the fullscreen modal from the viewport edge
|
|
82
|
+
// for a11y: the Mask flex-centers it, so `flex: 1` + `alignSelf: stretch`
|
|
83
|
+
// (auto height) gap it evenly via the margin; corners/shadow restored too.
|
|
84
|
+
[`@media screen and (min-width: ${sharedTokens.breakpoints.md})`]: {
|
|
85
|
+
margin: componentTheme.fullScreenMargin,
|
|
86
|
+
height: 'auto',
|
|
87
|
+
alignSelf: 'stretch',
|
|
88
|
+
borderRadius: componentTheme.borderRadius,
|
|
89
|
+
boxShadow
|
|
90
|
+
}
|
|
79
91
|
}
|
|
80
92
|
}
|
|
81
93
|
const backgroundStyles =
|
|
@@ -100,7 +112,7 @@ const generateStyle = (
|
|
|
100
112
|
flexDirection: 'column',
|
|
101
113
|
position: 'relative',
|
|
102
114
|
boxSizing: 'border-box',
|
|
103
|
-
boxShadow
|
|
115
|
+
boxShadow,
|
|
104
116
|
borderRadius: componentTheme.borderRadius,
|
|
105
117
|
overflow: 'hidden',
|
|
106
118
|
...sizeStyles[size!],
|