@instructure/ui-modal 10.26.1 → 11.0.1-snapshot-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -1
- package/es/Modal/ModalBody/index.js +8 -8
- package/es/Modal/ModalBody/props.js +1 -13
- package/es/Modal/ModalFooter/index.js +6 -6
- package/es/Modal/ModalFooter/props.js +1 -6
- package/es/Modal/ModalHeader/index.js +6 -6
- package/es/Modal/ModalHeader/props.js +1 -7
- package/es/Modal/index.js +6 -6
- package/es/Modal/props.js +1 -31
- package/lib/Modal/ModalBody/index.js +7 -7
- package/lib/Modal/ModalBody/props.js +1 -14
- package/lib/Modal/ModalFooter/index.js +5 -5
- package/lib/Modal/ModalFooter/props.js +1 -7
- package/lib/Modal/ModalHeader/index.js +5 -5
- package/lib/Modal/ModalHeader/props.js +1 -8
- package/lib/Modal/index.js +5 -5
- package/lib/Modal/props.js +1 -32
- package/package.json +19 -22
- package/src/Modal/ModalBody/index.tsx +4 -6
- package/src/Modal/ModalBody/props.ts +4 -16
- package/src/Modal/ModalFooter/index.tsx +2 -4
- package/src/Modal/ModalFooter/props.ts +1 -10
- package/src/Modal/ModalHeader/index.tsx +2 -4
- package/src/Modal/ModalHeader/props.ts +1 -11
- package/src/Modal/index.tsx +2 -4
- package/src/Modal/props.ts +1 -40
- package/tsconfig.build.json +0 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Modal/ModalBody/index.d.ts +0 -8
- package/types/Modal/ModalBody/index.d.ts.map +1 -1
- package/types/Modal/ModalBody/props.d.ts +6 -4
- package/types/Modal/ModalBody/props.d.ts.map +1 -1
- package/types/Modal/ModalFooter/index.d.ts +0 -4
- package/types/Modal/ModalFooter/index.d.ts.map +1 -1
- package/types/Modal/ModalFooter/props.d.ts +2 -3
- package/types/Modal/ModalFooter/props.d.ts.map +1 -1
- package/types/Modal/ModalHeader/index.d.ts +0 -5
- package/types/Modal/ModalHeader/index.d.ts.map +1 -1
- package/types/Modal/ModalHeader/props.d.ts +2 -3
- package/types/Modal/ModalHeader/props.d.ts.map +1 -1
- package/types/Modal/index.d.ts +1 -2
- package/types/Modal/index.d.ts.map +1 -1
- package/types/Modal/props.d.ts +2 -3
- package/types/Modal/props.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-modal",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.1-snapshot-0",
|
|
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",
|
|
@@ -24,32 +24,29 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.27.6",
|
|
27
|
-
"@instructure/console": "
|
|
28
|
-
"@instructure/emotion": "
|
|
29
|
-
"@instructure/shared-types": "
|
|
30
|
-
"@instructure/ui-buttons": "
|
|
31
|
-
"@instructure/ui-dialog": "
|
|
32
|
-
"@instructure/ui-dom-utils": "
|
|
33
|
-
"@instructure/ui-motion": "
|
|
34
|
-
"@instructure/ui-overlays": "
|
|
35
|
-
"@instructure/ui-portal": "
|
|
36
|
-
"@instructure/ui-
|
|
37
|
-
"@instructure/ui-
|
|
38
|
-
"@instructure/ui-
|
|
39
|
-
"@instructure/ui-utils": "10.26.1",
|
|
40
|
-
"@instructure/ui-view": "10.26.1",
|
|
41
|
-
"prop-types": "^15.8.1"
|
|
27
|
+
"@instructure/console": "11.0.1-snapshot-0",
|
|
28
|
+
"@instructure/emotion": "11.0.1-snapshot-0",
|
|
29
|
+
"@instructure/shared-types": "11.0.1-snapshot-0",
|
|
30
|
+
"@instructure/ui-buttons": "11.0.1-snapshot-0",
|
|
31
|
+
"@instructure/ui-dialog": "11.0.1-snapshot-0",
|
|
32
|
+
"@instructure/ui-dom-utils": "11.0.1-snapshot-0",
|
|
33
|
+
"@instructure/ui-motion": "11.0.1-snapshot-0",
|
|
34
|
+
"@instructure/ui-overlays": "11.0.1-snapshot-0",
|
|
35
|
+
"@instructure/ui-portal": "11.0.1-snapshot-0",
|
|
36
|
+
"@instructure/ui-react-utils": "11.0.1-snapshot-0",
|
|
37
|
+
"@instructure/ui-utils": "11.0.1-snapshot-0",
|
|
38
|
+
"@instructure/ui-view": "11.0.1-snapshot-0"
|
|
42
39
|
},
|
|
43
40
|
"peerDependencies": {
|
|
44
|
-
"react": ">=
|
|
41
|
+
"react": ">=18 <=19"
|
|
45
42
|
},
|
|
46
43
|
"devDependencies": {
|
|
47
|
-
"@instructure/ui-babel-preset": "
|
|
48
|
-
"@instructure/ui-color-utils": "
|
|
49
|
-
"@instructure/ui-position": "
|
|
50
|
-
"@instructure/ui-themes": "
|
|
44
|
+
"@instructure/ui-babel-preset": "11.0.1-snapshot-0",
|
|
45
|
+
"@instructure/ui-color-utils": "11.0.1-snapshot-0",
|
|
46
|
+
"@instructure/ui-position": "11.0.1-snapshot-0",
|
|
47
|
+
"@instructure/ui-themes": "11.0.1-snapshot-0",
|
|
51
48
|
"@testing-library/jest-dom": "^6.6.3",
|
|
52
|
-
"@testing-library/react": "
|
|
49
|
+
"@testing-library/react": "15.0.7",
|
|
53
50
|
"@testing-library/user-event": "^14.6.1",
|
|
54
51
|
"vitest": "^3.2.2"
|
|
55
52
|
},
|
|
@@ -25,15 +25,14 @@
|
|
|
25
25
|
import { Component } from 'react'
|
|
26
26
|
|
|
27
27
|
import { View } from '@instructure/ui-view'
|
|
28
|
-
import { testable } from '@instructure/ui-testable'
|
|
29
28
|
import { omitProps } from '@instructure/ui-react-utils'
|
|
30
|
-
import {
|
|
29
|
+
import { getCSSStyleDeclaration } from '@instructure/ui-dom-utils'
|
|
31
30
|
|
|
32
31
|
import { withStyle } from '@instructure/emotion'
|
|
33
32
|
import generateStyle from './styles'
|
|
34
33
|
import generateComponentTheme from './theme'
|
|
35
34
|
|
|
36
|
-
import {
|
|
35
|
+
import { allowedProps } from './props'
|
|
37
36
|
import type { ModalBodyProps } from './props'
|
|
38
37
|
import { UIElement } from '@instructure/shared-types'
|
|
39
38
|
|
|
@@ -44,11 +43,9 @@ id: Modal.Body
|
|
|
44
43
|
---
|
|
45
44
|
**/
|
|
46
45
|
@withStyle(generateStyle, generateComponentTheme)
|
|
47
|
-
@testable()
|
|
48
46
|
class ModalBody extends Component<ModalBodyProps> {
|
|
49
47
|
static readonly componentId = 'Modal.Body'
|
|
50
48
|
|
|
51
|
-
static propTypes = propTypes
|
|
52
49
|
static allowedProps = allowedProps
|
|
53
50
|
static defaultProps = {
|
|
54
51
|
padding: 'medium',
|
|
@@ -76,7 +73,7 @@ class ModalBody extends Component<ModalBodyProps> {
|
|
|
76
73
|
this.props.makeStyles?.()
|
|
77
74
|
|
|
78
75
|
// We detect if -moz- prefixed style is present to identify whether we are in Firefox browser
|
|
79
|
-
const style = this.ref &&
|
|
76
|
+
const style = this.ref && getCSSStyleDeclaration(this.ref)
|
|
80
77
|
const isFirefox = !!(
|
|
81
78
|
style &&
|
|
82
79
|
Array.prototype.slice
|
|
@@ -125,6 +122,7 @@ class ModalBody extends Component<ModalBodyProps> {
|
|
|
125
122
|
<View
|
|
126
123
|
{...passthroughProps}
|
|
127
124
|
display="block"
|
|
125
|
+
data-cid="ModalBody"
|
|
128
126
|
width={isFit ? '100%' : undefined}
|
|
129
127
|
height={isFit ? '100%' : undefined}
|
|
130
128
|
elementRef={this.handleRef}
|
|
@@ -23,8 +23,6 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
-
import PropTypes from 'prop-types'
|
|
27
|
-
|
|
28
26
|
import type {
|
|
29
27
|
Spacing,
|
|
30
28
|
WithStyleProps,
|
|
@@ -32,7 +30,6 @@ import type {
|
|
|
32
30
|
} from '@instructure/emotion'
|
|
33
31
|
import type {
|
|
34
32
|
AsElementType,
|
|
35
|
-
PropValidators,
|
|
36
33
|
ModalBodyTheme,
|
|
37
34
|
OtherHTMLAttributes,
|
|
38
35
|
UIElement
|
|
@@ -57,18 +54,9 @@ type ModalBodyProps = ModalBodyOwnProps &
|
|
|
57
54
|
|
|
58
55
|
type ModalBodyStyle = ComponentStyle<'modalBody'>
|
|
59
56
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
padding: PropTypes.string,
|
|
63
|
-
/**
|
|
64
|
-
* provides a reference to the underlying html root element
|
|
65
|
-
*/
|
|
66
|
-
elementRef: PropTypes.func,
|
|
67
|
-
as: PropTypes.elementType,
|
|
68
|
-
variant: PropTypes.oneOf(['default', 'inverse']),
|
|
69
|
-
overflow: PropTypes.oneOf(['scroll', 'fit'])
|
|
57
|
+
type ModalBodyState = {
|
|
58
|
+
isFirefox: boolean
|
|
70
59
|
}
|
|
71
|
-
|
|
72
60
|
const allowedProps: AllowedPropKeys = [
|
|
73
61
|
'children',
|
|
74
62
|
'padding',
|
|
@@ -78,5 +66,5 @@ const allowedProps: AllowedPropKeys = [
|
|
|
78
66
|
'overflow'
|
|
79
67
|
]
|
|
80
68
|
|
|
81
|
-
export type { ModalBodyProps, ModalBodyStyle }
|
|
82
|
-
export {
|
|
69
|
+
export type { ModalBodyProps, ModalBodyState, ModalBodyStyle }
|
|
70
|
+
export { allowedProps }
|
|
@@ -25,12 +25,11 @@
|
|
|
25
25
|
import { Component } from 'react'
|
|
26
26
|
|
|
27
27
|
import { passthroughProps } from '@instructure/ui-react-utils'
|
|
28
|
-
import { testable } from '@instructure/ui-testable'
|
|
29
28
|
import { withStyle } from '@instructure/emotion'
|
|
30
29
|
import generateStyle from './styles'
|
|
31
30
|
import generateComponentTheme from './theme'
|
|
32
31
|
|
|
33
|
-
import {
|
|
32
|
+
import { allowedProps } from './props'
|
|
34
33
|
import type { ModalFooterProps } from './props'
|
|
35
34
|
|
|
36
35
|
/**
|
|
@@ -40,11 +39,9 @@ id: Modal.Footer
|
|
|
40
39
|
---
|
|
41
40
|
**/
|
|
42
41
|
@withStyle(generateStyle, generateComponentTheme)
|
|
43
|
-
@testable()
|
|
44
42
|
class ModalFooter extends Component<ModalFooterProps> {
|
|
45
43
|
static readonly componentId = 'Modal.Footer'
|
|
46
44
|
|
|
47
|
-
static propTypes = propTypes
|
|
48
45
|
static allowedProps = allowedProps
|
|
49
46
|
static defaultProps = {
|
|
50
47
|
variant: 'default'
|
|
@@ -72,6 +69,7 @@ class ModalFooter extends Component<ModalFooterProps> {
|
|
|
72
69
|
css={this.props.styles?.modalFooter}
|
|
73
70
|
{...passthroughProps(rest)}
|
|
74
71
|
ref={this.handleRef}
|
|
72
|
+
data-cid="ModalFooter"
|
|
75
73
|
>
|
|
76
74
|
{children}
|
|
77
75
|
</div>
|
|
@@ -23,10 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
-
import PropTypes from 'prop-types'
|
|
27
|
-
|
|
28
26
|
import type {
|
|
29
|
-
PropValidators,
|
|
30
27
|
ModalFooterTheme,
|
|
31
28
|
OtherHTMLAttributes
|
|
32
29
|
} from '@instructure/shared-types'
|
|
@@ -46,13 +43,7 @@ type ModalFooterProps = ModalFooterOwnProps &
|
|
|
46
43
|
OtherHTMLAttributes<ModalFooterOwnProps>
|
|
47
44
|
|
|
48
45
|
type ModalFooterStyle = ComponentStyle<'modalFooter'>
|
|
49
|
-
|
|
50
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
51
|
-
children: PropTypes.node,
|
|
52
|
-
variant: PropTypes.oneOf(['default', 'inverse'])
|
|
53
|
-
}
|
|
54
|
-
|
|
55
46
|
const allowedProps: AllowedPropKeys = ['children', 'variant']
|
|
56
47
|
|
|
57
48
|
export type { ModalFooterProps, ModalFooterStyle }
|
|
58
|
-
export {
|
|
49
|
+
export { allowedProps }
|
|
@@ -28,7 +28,6 @@ import {
|
|
|
28
28
|
matchComponentTypes,
|
|
29
29
|
passthroughProps
|
|
30
30
|
} from '@instructure/ui-react-utils'
|
|
31
|
-
import { testable } from '@instructure/ui-testable'
|
|
32
31
|
|
|
33
32
|
import { withStyle } from '@instructure/emotion'
|
|
34
33
|
|
|
@@ -38,7 +37,7 @@ import type { CloseButtonProps } from '@instructure/ui-buttons'
|
|
|
38
37
|
import generateStyle from './styles'
|
|
39
38
|
import generateComponentTheme from './theme'
|
|
40
39
|
|
|
41
|
-
import {
|
|
40
|
+
import { allowedProps } from './props'
|
|
42
41
|
import type { ModalHeaderProps, ModalHeaderStyleProps } from './props'
|
|
43
42
|
|
|
44
43
|
type CloseButtonChild = ComponentElement<CloseButtonProps, CloseButton>
|
|
@@ -50,11 +49,9 @@ id: Modal.Header
|
|
|
50
49
|
---
|
|
51
50
|
**/
|
|
52
51
|
@withStyle(generateStyle, generateComponentTheme)
|
|
53
|
-
@testable()
|
|
54
52
|
class ModalHeader extends Component<ModalHeaderProps> {
|
|
55
53
|
static readonly componentId = 'Modal.Header'
|
|
56
54
|
|
|
57
|
-
static propTypes = propTypes
|
|
58
55
|
static allowedProps = allowedProps
|
|
59
56
|
static defaultProps = {
|
|
60
57
|
variant: 'default',
|
|
@@ -104,6 +101,7 @@ class ModalHeader extends Component<ModalHeaderProps> {
|
|
|
104
101
|
css={this.props.styles?.modalHeader}
|
|
105
102
|
{...passthroughProps(rest)}
|
|
106
103
|
ref={this.handleRef}
|
|
104
|
+
data-cid="ModalHeader"
|
|
107
105
|
>
|
|
108
106
|
{children}
|
|
109
107
|
</div>
|
|
@@ -23,10 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
-
import PropTypes from 'prop-types'
|
|
27
|
-
|
|
28
26
|
import type {
|
|
29
|
-
PropValidators,
|
|
30
27
|
ModalHeaderTheme,
|
|
31
28
|
OtherHTMLAttributes
|
|
32
29
|
} from '@instructure/shared-types'
|
|
@@ -51,14 +48,7 @@ type ModalHeaderProps = ModalHeaderOwnProps &
|
|
|
51
48
|
OtherHTMLAttributes<ModalHeaderOwnProps>
|
|
52
49
|
|
|
53
50
|
type ModalHeaderStyle = ComponentStyle<'modalHeader'>
|
|
54
|
-
|
|
55
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
56
|
-
children: PropTypes.node,
|
|
57
|
-
variant: PropTypes.oneOf(['default', 'inverse']),
|
|
58
|
-
spacing: PropTypes.oneOf(['default', 'compact'])
|
|
59
|
-
}
|
|
60
|
-
|
|
61
51
|
const allowedProps: AllowedPropKeys = ['children', 'variant', 'spacing']
|
|
62
52
|
|
|
63
53
|
export type { ModalHeaderProps, ModalHeaderStyleProps, ModalHeaderStyle }
|
|
64
|
-
export {
|
|
54
|
+
export { allowedProps }
|
package/src/Modal/index.tsx
CHANGED
|
@@ -26,7 +26,6 @@ import { Children, Component, isValidElement } from 'react'
|
|
|
26
26
|
|
|
27
27
|
import { passthroughProps, safeCloneElement } from '@instructure/ui-react-utils'
|
|
28
28
|
import { createChainedFunction } from '@instructure/ui-utils'
|
|
29
|
-
import { testable } from '@instructure/ui-testable'
|
|
30
29
|
|
|
31
30
|
import { Transition } from '@instructure/ui-motion'
|
|
32
31
|
import { Portal } from '@instructure/ui-portal'
|
|
@@ -43,7 +42,7 @@ import { withStyle } from '@instructure/emotion'
|
|
|
43
42
|
import generateStyle from './styles'
|
|
44
43
|
import generateComponentTheme from './theme'
|
|
45
44
|
|
|
46
|
-
import {
|
|
45
|
+
import { allowedProps } from './props'
|
|
47
46
|
import type {
|
|
48
47
|
ModalProps,
|
|
49
48
|
ModalState,
|
|
@@ -58,11 +57,9 @@ tags: overlay, portal, dialog
|
|
|
58
57
|
---
|
|
59
58
|
**/
|
|
60
59
|
@withStyle(generateStyle, generateComponentTheme)
|
|
61
|
-
@testable()
|
|
62
60
|
class Modal extends Component<ModalProps, ModalState> {
|
|
63
61
|
static readonly componentId = 'Modal'
|
|
64
62
|
|
|
65
|
-
static propTypes = propTypes
|
|
66
63
|
static allowedProps = allowedProps
|
|
67
64
|
static defaultProps = {
|
|
68
65
|
open: false,
|
|
@@ -282,6 +279,7 @@ class Modal extends Component<ModalProps, ModalState> {
|
|
|
282
279
|
insertAt={insertAt}
|
|
283
280
|
open={portalIsOpen}
|
|
284
281
|
onOpen={this.handlePortalOpen}
|
|
282
|
+
data-cid="Modal"
|
|
285
283
|
>
|
|
286
284
|
<Transition
|
|
287
285
|
in={open}
|
package/src/Modal/props.ts
CHANGED
|
@@ -23,16 +23,10 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
-
import PropTypes from 'prop-types'
|
|
27
|
-
|
|
28
|
-
import { element } from '@instructure/ui-prop-types'
|
|
29
|
-
import { transitionTypePropType } from '@instructure/ui-motion'
|
|
30
|
-
|
|
31
26
|
import { Dialog } from '@instructure/ui-dialog'
|
|
32
27
|
|
|
33
28
|
import type {
|
|
34
29
|
AsElementType,
|
|
35
|
-
PropValidators,
|
|
36
30
|
ModalTheme,
|
|
37
31
|
OtherHTMLAttributes,
|
|
38
32
|
LiveRegion,
|
|
@@ -198,39 +192,6 @@ type ModalState = {
|
|
|
198
192
|
open: boolean
|
|
199
193
|
windowHeight: number
|
|
200
194
|
}
|
|
201
|
-
|
|
202
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
203
|
-
label: PropTypes.string.isRequired,
|
|
204
|
-
children: PropTypes.node,
|
|
205
|
-
as: PropTypes.elementType,
|
|
206
|
-
size: PropTypes.oneOf(['auto', 'small', 'medium', 'large', 'fullscreen']),
|
|
207
|
-
variant: PropTypes.oneOf(['default', 'inverse']),
|
|
208
|
-
open: PropTypes.bool,
|
|
209
|
-
defaultFocusElement: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
210
|
-
shouldReturnFocus: PropTypes.bool,
|
|
211
|
-
shouldCloseOnDocumentClick: PropTypes.bool,
|
|
212
|
-
onOpen: PropTypes.func,
|
|
213
|
-
onClose: PropTypes.func,
|
|
214
|
-
onDismiss: PropTypes.func,
|
|
215
|
-
contentRef: PropTypes.func,
|
|
216
|
-
mountNode: PropTypes.oneOfType([element, PropTypes.func]),
|
|
217
|
-
insertAt: PropTypes.oneOf(['bottom', 'top']),
|
|
218
|
-
liveRegion: PropTypes.oneOfType([
|
|
219
|
-
element,
|
|
220
|
-
PropTypes.arrayOf(element),
|
|
221
|
-
PropTypes.func
|
|
222
|
-
]),
|
|
223
|
-
transition: transitionTypePropType,
|
|
224
|
-
onEnter: PropTypes.func,
|
|
225
|
-
onEntering: PropTypes.func,
|
|
226
|
-
onEntered: PropTypes.func,
|
|
227
|
-
onExit: PropTypes.func,
|
|
228
|
-
onExiting: PropTypes.func,
|
|
229
|
-
onExited: PropTypes.func,
|
|
230
|
-
constrain: PropTypes.oneOf(['window', 'parent']),
|
|
231
|
-
overflow: PropTypes.oneOf(['scroll', 'fit'])
|
|
232
|
-
}
|
|
233
|
-
|
|
234
195
|
const allowedProps: AllowedPropKeys = [
|
|
235
196
|
'label',
|
|
236
197
|
'children',
|
|
@@ -267,4 +228,4 @@ export type {
|
|
|
267
228
|
ModalPropsForTransition,
|
|
268
229
|
ModalPropsForDialog
|
|
269
230
|
}
|
|
270
|
-
export {
|
|
231
|
+
export { allowedProps }
|
package/tsconfig.build.json
CHANGED
|
@@ -16,9 +16,7 @@
|
|
|
16
16
|
{ "path": "../ui-motion/tsconfig.build.json" },
|
|
17
17
|
{ "path": "../ui-overlays/tsconfig.build.json" },
|
|
18
18
|
{ "path": "../ui-portal/tsconfig.build.json" },
|
|
19
|
-
{ "path": "../ui-prop-types/tsconfig.build.json" },
|
|
20
19
|
{ "path": "../ui-react-utils/tsconfig.build.json" },
|
|
21
|
-
{ "path": "../ui-testable/tsconfig.build.json" },
|
|
22
20
|
{ "path": "../ui-utils/tsconfig.build.json" },
|
|
23
21
|
{ "path": "../ui-view/tsconfig.build.json" },
|
|
24
22
|
{ "path": "../ui-babel-preset/tsconfig.build.json" },
|