@instructure/ui-modal 10.26.1-snapshot-2 → 10.26.2
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 +5 -18
- package/es/Modal/ModalBody/index.js +8 -8
- package/es/Modal/ModalBody/props.js +13 -1
- package/es/Modal/ModalFooter/index.js +6 -6
- package/es/Modal/ModalFooter/props.js +6 -1
- package/es/Modal/ModalHeader/index.js +6 -6
- package/es/Modal/ModalHeader/props.js +7 -1
- package/es/Modal/index.js +6 -6
- package/es/Modal/props.js +31 -1
- package/lib/Modal/ModalBody/index.js +7 -7
- package/lib/Modal/ModalBody/props.js +14 -1
- package/lib/Modal/ModalFooter/index.js +5 -5
- package/lib/Modal/ModalFooter/props.js +7 -1
- package/lib/Modal/ModalHeader/index.js +5 -5
- package/lib/Modal/ModalHeader/props.js +8 -1
- package/lib/Modal/index.js +5 -5
- package/lib/Modal/props.js +32 -1
- package/package.json +22 -19
- package/src/Modal/ModalBody/index.tsx +6 -4
- package/src/Modal/ModalBody/props.ts +16 -4
- package/src/Modal/ModalFooter/index.tsx +4 -2
- package/src/Modal/ModalFooter/props.ts +10 -1
- package/src/Modal/ModalHeader/index.tsx +4 -2
- package/src/Modal/ModalHeader/props.ts +11 -1
- package/src/Modal/index.tsx +4 -2
- package/src/Modal/props.ts +40 -1
- package/tsconfig.build.json +2 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Modal/ModalBody/index.d.ts +8 -0
- package/types/Modal/ModalBody/index.d.ts.map +1 -1
- package/types/Modal/ModalBody/props.d.ts +4 -6
- package/types/Modal/ModalBody/props.d.ts.map +1 -1
- package/types/Modal/ModalFooter/index.d.ts +4 -0
- package/types/Modal/ModalFooter/index.d.ts.map +1 -1
- package/types/Modal/ModalFooter/props.d.ts +3 -2
- package/types/Modal/ModalFooter/props.d.ts.map +1 -1
- package/types/Modal/ModalHeader/index.d.ts +5 -0
- package/types/Modal/ModalHeader/index.d.ts.map +1 -1
- package/types/Modal/ModalHeader/props.d.ts +3 -2
- package/types/Modal/ModalHeader/props.d.ts.map +1 -1
- package/types/Modal/index.d.ts +2 -1
- package/types/Modal/index.d.ts.map +1 -1
- package/types/Modal/props.d.ts +3 -2
- 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": "10.26.
|
|
3
|
+
"version": "10.26.2",
|
|
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,29 +24,32 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.27.6",
|
|
27
|
-
"@instructure/console": "10.26.
|
|
28
|
-
"@instructure/emotion": "10.26.
|
|
29
|
-
"@instructure/shared-types": "10.26.
|
|
30
|
-
"@instructure/ui-buttons": "10.26.
|
|
31
|
-
"@instructure/ui-dialog": "10.26.
|
|
32
|
-
"@instructure/ui-dom-utils": "10.26.
|
|
33
|
-
"@instructure/ui-motion": "10.26.
|
|
34
|
-
"@instructure/ui-overlays": "10.26.
|
|
35
|
-
"@instructure/ui-portal": "10.26.
|
|
36
|
-
"@instructure/ui-
|
|
37
|
-
"@instructure/ui-utils": "10.26.
|
|
38
|
-
"@instructure/ui-
|
|
27
|
+
"@instructure/console": "10.26.2",
|
|
28
|
+
"@instructure/emotion": "10.26.2",
|
|
29
|
+
"@instructure/shared-types": "10.26.2",
|
|
30
|
+
"@instructure/ui-buttons": "10.26.2",
|
|
31
|
+
"@instructure/ui-dialog": "10.26.2",
|
|
32
|
+
"@instructure/ui-dom-utils": "10.26.2",
|
|
33
|
+
"@instructure/ui-motion": "10.26.2",
|
|
34
|
+
"@instructure/ui-overlays": "10.26.2",
|
|
35
|
+
"@instructure/ui-portal": "10.26.2",
|
|
36
|
+
"@instructure/ui-prop-types": "10.26.2",
|
|
37
|
+
"@instructure/ui-react-utils": "10.26.2",
|
|
38
|
+
"@instructure/ui-testable": "10.26.2",
|
|
39
|
+
"@instructure/ui-utils": "10.26.2",
|
|
40
|
+
"@instructure/ui-view": "10.26.2",
|
|
41
|
+
"prop-types": "^15.8.1"
|
|
39
42
|
},
|
|
40
43
|
"peerDependencies": {
|
|
41
|
-
"react": ">=
|
|
44
|
+
"react": ">=16.14 <=18"
|
|
42
45
|
},
|
|
43
46
|
"devDependencies": {
|
|
44
|
-
"@instructure/ui-babel-preset": "10.26.
|
|
45
|
-
"@instructure/ui-color-utils": "10.26.
|
|
46
|
-
"@instructure/ui-position": "10.26.
|
|
47
|
-
"@instructure/ui-themes": "10.26.
|
|
47
|
+
"@instructure/ui-babel-preset": "10.26.2",
|
|
48
|
+
"@instructure/ui-color-utils": "10.26.2",
|
|
49
|
+
"@instructure/ui-position": "10.26.2",
|
|
50
|
+
"@instructure/ui-themes": "10.26.2",
|
|
48
51
|
"@testing-library/jest-dom": "^6.6.3",
|
|
49
|
-
"@testing-library/react": "
|
|
52
|
+
"@testing-library/react": "^16.0.1",
|
|
50
53
|
"@testing-library/user-event": "^14.6.1",
|
|
51
54
|
"vitest": "^3.2.2"
|
|
52
55
|
},
|
|
@@ -25,14 +25,15 @@
|
|
|
25
25
|
import { Component } from 'react'
|
|
26
26
|
|
|
27
27
|
import { View } from '@instructure/ui-view'
|
|
28
|
+
import { testable } from '@instructure/ui-testable'
|
|
28
29
|
import { omitProps } from '@instructure/ui-react-utils'
|
|
29
|
-
import {
|
|
30
|
+
import { getComputedStyle } from '@instructure/ui-dom-utils'
|
|
30
31
|
|
|
31
32
|
import { withStyle } from '@instructure/emotion'
|
|
32
33
|
import generateStyle from './styles'
|
|
33
34
|
import generateComponentTheme from './theme'
|
|
34
35
|
|
|
35
|
-
import { allowedProps } from './props'
|
|
36
|
+
import { propTypes, allowedProps } from './props'
|
|
36
37
|
import type { ModalBodyProps } from './props'
|
|
37
38
|
import { UIElement } from '@instructure/shared-types'
|
|
38
39
|
|
|
@@ -43,9 +44,11 @@ id: Modal.Body
|
|
|
43
44
|
---
|
|
44
45
|
**/
|
|
45
46
|
@withStyle(generateStyle, generateComponentTheme)
|
|
47
|
+
@testable()
|
|
46
48
|
class ModalBody extends Component<ModalBodyProps> {
|
|
47
49
|
static readonly componentId = 'Modal.Body'
|
|
48
50
|
|
|
51
|
+
static propTypes = propTypes
|
|
49
52
|
static allowedProps = allowedProps
|
|
50
53
|
static defaultProps = {
|
|
51
54
|
padding: 'medium',
|
|
@@ -73,7 +76,7 @@ class ModalBody extends Component<ModalBodyProps> {
|
|
|
73
76
|
this.props.makeStyles?.()
|
|
74
77
|
|
|
75
78
|
// We detect if -moz- prefixed style is present to identify whether we are in Firefox browser
|
|
76
|
-
const style = this.ref &&
|
|
79
|
+
const style = this.ref && getComputedStyle(this.ref)
|
|
77
80
|
const isFirefox = !!(
|
|
78
81
|
style &&
|
|
79
82
|
Array.prototype.slice
|
|
@@ -122,7 +125,6 @@ class ModalBody extends Component<ModalBodyProps> {
|
|
|
122
125
|
<View
|
|
123
126
|
{...passthroughProps}
|
|
124
127
|
display="block"
|
|
125
|
-
data-cid="ModalBody"
|
|
126
128
|
width={isFit ? '100%' : undefined}
|
|
127
129
|
height={isFit ? '100%' : undefined}
|
|
128
130
|
elementRef={this.handleRef}
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
+
import PropTypes from 'prop-types'
|
|
27
|
+
|
|
26
28
|
import type {
|
|
27
29
|
Spacing,
|
|
28
30
|
WithStyleProps,
|
|
@@ -30,6 +32,7 @@ import type {
|
|
|
30
32
|
} from '@instructure/emotion'
|
|
31
33
|
import type {
|
|
32
34
|
AsElementType,
|
|
35
|
+
PropValidators,
|
|
33
36
|
ModalBodyTheme,
|
|
34
37
|
OtherHTMLAttributes,
|
|
35
38
|
UIElement
|
|
@@ -54,9 +57,18 @@ type ModalBodyProps = ModalBodyOwnProps &
|
|
|
54
57
|
|
|
55
58
|
type ModalBodyStyle = ComponentStyle<'modalBody'>
|
|
56
59
|
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
61
|
+
children: PropTypes.node,
|
|
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'])
|
|
59
70
|
}
|
|
71
|
+
|
|
60
72
|
const allowedProps: AllowedPropKeys = [
|
|
61
73
|
'children',
|
|
62
74
|
'padding',
|
|
@@ -66,5 +78,5 @@ const allowedProps: AllowedPropKeys = [
|
|
|
66
78
|
'overflow'
|
|
67
79
|
]
|
|
68
80
|
|
|
69
|
-
export type { ModalBodyProps,
|
|
70
|
-
export { allowedProps }
|
|
81
|
+
export type { ModalBodyProps, ModalBodyStyle }
|
|
82
|
+
export { propTypes, allowedProps }
|
|
@@ -25,11 +25,12 @@
|
|
|
25
25
|
import { Component } from 'react'
|
|
26
26
|
|
|
27
27
|
import { passthroughProps } from '@instructure/ui-react-utils'
|
|
28
|
+
import { testable } from '@instructure/ui-testable'
|
|
28
29
|
import { withStyle } from '@instructure/emotion'
|
|
29
30
|
import generateStyle from './styles'
|
|
30
31
|
import generateComponentTheme from './theme'
|
|
31
32
|
|
|
32
|
-
import { allowedProps } from './props'
|
|
33
|
+
import { propTypes, allowedProps } from './props'
|
|
33
34
|
import type { ModalFooterProps } from './props'
|
|
34
35
|
|
|
35
36
|
/**
|
|
@@ -39,9 +40,11 @@ id: Modal.Footer
|
|
|
39
40
|
---
|
|
40
41
|
**/
|
|
41
42
|
@withStyle(generateStyle, generateComponentTheme)
|
|
43
|
+
@testable()
|
|
42
44
|
class ModalFooter extends Component<ModalFooterProps> {
|
|
43
45
|
static readonly componentId = 'Modal.Footer'
|
|
44
46
|
|
|
47
|
+
static propTypes = propTypes
|
|
45
48
|
static allowedProps = allowedProps
|
|
46
49
|
static defaultProps = {
|
|
47
50
|
variant: 'default'
|
|
@@ -69,7 +72,6 @@ class ModalFooter extends Component<ModalFooterProps> {
|
|
|
69
72
|
css={this.props.styles?.modalFooter}
|
|
70
73
|
{...passthroughProps(rest)}
|
|
71
74
|
ref={this.handleRef}
|
|
72
|
-
data-cid="ModalFooter"
|
|
73
75
|
>
|
|
74
76
|
{children}
|
|
75
77
|
</div>
|
|
@@ -23,7 +23,10 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
+
import PropTypes from 'prop-types'
|
|
27
|
+
|
|
26
28
|
import type {
|
|
29
|
+
PropValidators,
|
|
27
30
|
ModalFooterTheme,
|
|
28
31
|
OtherHTMLAttributes
|
|
29
32
|
} from '@instructure/shared-types'
|
|
@@ -43,7 +46,13 @@ type ModalFooterProps = ModalFooterOwnProps &
|
|
|
43
46
|
OtherHTMLAttributes<ModalFooterOwnProps>
|
|
44
47
|
|
|
45
48
|
type ModalFooterStyle = ComponentStyle<'modalFooter'>
|
|
49
|
+
|
|
50
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
51
|
+
children: PropTypes.node,
|
|
52
|
+
variant: PropTypes.oneOf(['default', 'inverse'])
|
|
53
|
+
}
|
|
54
|
+
|
|
46
55
|
const allowedProps: AllowedPropKeys = ['children', 'variant']
|
|
47
56
|
|
|
48
57
|
export type { ModalFooterProps, ModalFooterStyle }
|
|
49
|
-
export { allowedProps }
|
|
58
|
+
export { propTypes, allowedProps }
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
matchComponentTypes,
|
|
29
29
|
passthroughProps
|
|
30
30
|
} from '@instructure/ui-react-utils'
|
|
31
|
+
import { testable } from '@instructure/ui-testable'
|
|
31
32
|
|
|
32
33
|
import { withStyle } from '@instructure/emotion'
|
|
33
34
|
|
|
@@ -37,7 +38,7 @@ import type { CloseButtonProps } from '@instructure/ui-buttons'
|
|
|
37
38
|
import generateStyle from './styles'
|
|
38
39
|
import generateComponentTheme from './theme'
|
|
39
40
|
|
|
40
|
-
import { allowedProps } from './props'
|
|
41
|
+
import { propTypes, allowedProps } from './props'
|
|
41
42
|
import type { ModalHeaderProps, ModalHeaderStyleProps } from './props'
|
|
42
43
|
|
|
43
44
|
type CloseButtonChild = ComponentElement<CloseButtonProps, CloseButton>
|
|
@@ -49,9 +50,11 @@ id: Modal.Header
|
|
|
49
50
|
---
|
|
50
51
|
**/
|
|
51
52
|
@withStyle(generateStyle, generateComponentTheme)
|
|
53
|
+
@testable()
|
|
52
54
|
class ModalHeader extends Component<ModalHeaderProps> {
|
|
53
55
|
static readonly componentId = 'Modal.Header'
|
|
54
56
|
|
|
57
|
+
static propTypes = propTypes
|
|
55
58
|
static allowedProps = allowedProps
|
|
56
59
|
static defaultProps = {
|
|
57
60
|
variant: 'default',
|
|
@@ -101,7 +104,6 @@ class ModalHeader extends Component<ModalHeaderProps> {
|
|
|
101
104
|
css={this.props.styles?.modalHeader}
|
|
102
105
|
{...passthroughProps(rest)}
|
|
103
106
|
ref={this.handleRef}
|
|
104
|
-
data-cid="ModalHeader"
|
|
105
107
|
>
|
|
106
108
|
{children}
|
|
107
109
|
</div>
|
|
@@ -23,7 +23,10 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
+
import PropTypes from 'prop-types'
|
|
27
|
+
|
|
26
28
|
import type {
|
|
29
|
+
PropValidators,
|
|
27
30
|
ModalHeaderTheme,
|
|
28
31
|
OtherHTMLAttributes
|
|
29
32
|
} from '@instructure/shared-types'
|
|
@@ -48,7 +51,14 @@ type ModalHeaderProps = ModalHeaderOwnProps &
|
|
|
48
51
|
OtherHTMLAttributes<ModalHeaderOwnProps>
|
|
49
52
|
|
|
50
53
|
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
|
+
|
|
51
61
|
const allowedProps: AllowedPropKeys = ['children', 'variant', 'spacing']
|
|
52
62
|
|
|
53
63
|
export type { ModalHeaderProps, ModalHeaderStyleProps, ModalHeaderStyle }
|
|
54
|
-
export { allowedProps }
|
|
64
|
+
export { propTypes, allowedProps }
|
package/src/Modal/index.tsx
CHANGED
|
@@ -26,6 +26,7 @@ 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'
|
|
29
30
|
|
|
30
31
|
import { Transition } from '@instructure/ui-motion'
|
|
31
32
|
import { Portal } from '@instructure/ui-portal'
|
|
@@ -42,7 +43,7 @@ import { withStyle } from '@instructure/emotion'
|
|
|
42
43
|
import generateStyle from './styles'
|
|
43
44
|
import generateComponentTheme from './theme'
|
|
44
45
|
|
|
45
|
-
import { allowedProps } from './props'
|
|
46
|
+
import { propTypes, allowedProps } from './props'
|
|
46
47
|
import type {
|
|
47
48
|
ModalProps,
|
|
48
49
|
ModalState,
|
|
@@ -57,9 +58,11 @@ tags: overlay, portal, dialog
|
|
|
57
58
|
---
|
|
58
59
|
**/
|
|
59
60
|
@withStyle(generateStyle, generateComponentTheme)
|
|
61
|
+
@testable()
|
|
60
62
|
class Modal extends Component<ModalProps, ModalState> {
|
|
61
63
|
static readonly componentId = 'Modal'
|
|
62
64
|
|
|
65
|
+
static propTypes = propTypes
|
|
63
66
|
static allowedProps = allowedProps
|
|
64
67
|
static defaultProps = {
|
|
65
68
|
open: false,
|
|
@@ -279,7 +282,6 @@ class Modal extends Component<ModalProps, ModalState> {
|
|
|
279
282
|
insertAt={insertAt}
|
|
280
283
|
open={portalIsOpen}
|
|
281
284
|
onOpen={this.handlePortalOpen}
|
|
282
|
-
data-cid="Modal"
|
|
283
285
|
>
|
|
284
286
|
<Transition
|
|
285
287
|
in={open}
|
package/src/Modal/props.ts
CHANGED
|
@@ -23,10 +23,16 @@
|
|
|
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
|
+
|
|
26
31
|
import { Dialog } from '@instructure/ui-dialog'
|
|
27
32
|
|
|
28
33
|
import type {
|
|
29
34
|
AsElementType,
|
|
35
|
+
PropValidators,
|
|
30
36
|
ModalTheme,
|
|
31
37
|
OtherHTMLAttributes,
|
|
32
38
|
LiveRegion,
|
|
@@ -192,6 +198,39 @@ type ModalState = {
|
|
|
192
198
|
open: boolean
|
|
193
199
|
windowHeight: number
|
|
194
200
|
}
|
|
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
|
+
|
|
195
234
|
const allowedProps: AllowedPropKeys = [
|
|
196
235
|
'label',
|
|
197
236
|
'children',
|
|
@@ -228,4 +267,4 @@ export type {
|
|
|
228
267
|
ModalPropsForTransition,
|
|
229
268
|
ModalPropsForDialog
|
|
230
269
|
}
|
|
231
|
-
export { allowedProps }
|
|
270
|
+
export { propTypes, allowedProps }
|
package/tsconfig.build.json
CHANGED
|
@@ -16,7 +16,9 @@
|
|
|
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" },
|
|
19
20
|
{ "path": "../ui-react-utils/tsconfig.build.json" },
|
|
21
|
+
{ "path": "../ui-testable/tsconfig.build.json" },
|
|
20
22
|
{ "path": "../ui-utils/tsconfig.build.json" },
|
|
21
23
|
{ "path": "../ui-view/tsconfig.build.json" },
|
|
22
24
|
{ "path": "../ui-babel-preset/tsconfig.build.json" },
|