@instructure/ui-modal 8.8.1-snapshot.3 → 8.9.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 +6 -0
- package/es/Modal/ModalBody/index.js +7 -18
- package/{src/Modal/ModalBody/types.ts → es/Modal/ModalBody/props.js} +12 -13
- package/es/Modal/ModalFooter/index.js +5 -10
- package/{src/Modal/ModalFooter/types.ts → es/Modal/ModalFooter/props.js} +7 -6
- package/es/Modal/ModalHeader/index.js +5 -10
- package/{src/Modal/ModalHeader/types.ts → es/Modal/ModalHeader/props.js} +7 -10
- package/es/Modal/index.js +6 -134
- package/es/Modal/props.js +157 -0
- package/lib/Modal/ModalBody/index.js +7 -18
- package/lib/Modal/ModalBody/props.js +47 -0
- package/lib/Modal/ModalFooter/index.js +6 -11
- package/lib/Modal/ModalFooter/props.js +41 -0
- package/lib/Modal/ModalHeader/index.js +6 -11
- package/lib/Modal/ModalHeader/props.js +41 -0
- package/lib/Modal/index.js +7 -138
- package/lib/Modal/props.js +175 -0
- package/package.json +21 -22
- package/src/Modal/ModalBody/index.tsx +8 -21
- package/src/Modal/{types.ts → ModalBody/props.ts} +38 -31
- package/src/Modal/ModalBody/styles.ts +1 -1
- package/src/Modal/ModalFooter/index.tsx +6 -13
- package/src/Modal/ModalFooter/props.ts +50 -0
- package/src/Modal/ModalFooter/styles.ts +1 -1
- package/src/Modal/ModalHeader/index.tsx +6 -13
- package/src/Modal/ModalHeader/props.ts +54 -0
- package/src/Modal/ModalHeader/styles.ts +1 -1
- package/src/Modal/index.tsx +7 -145
- package/src/Modal/props.ts +238 -0
- package/src/Modal/styles.ts +1 -1
- package/src/index.ts +4 -4
- package/types/Modal/ModalBody/index.d.ts +27 -14
- package/types/Modal/ModalBody/index.d.ts.map +1 -1
- package/types/Modal/ModalBody/props.d.ts +19 -0
- package/types/Modal/ModalBody/props.d.ts.map +1 -0
- package/types/Modal/ModalBody/styles.d.ts +1 -1
- package/types/Modal/ModalFooter/index.d.ts +9 -8
- package/types/Modal/ModalFooter/index.d.ts.map +1 -1
- package/types/Modal/ModalFooter/props.d.ts +15 -0
- package/types/Modal/ModalFooter/props.d.ts.map +1 -0
- package/types/Modal/ModalFooter/styles.d.ts +1 -1
- package/types/Modal/ModalHeader/index.d.ts +10 -9
- package/types/Modal/ModalHeader/index.d.ts.map +1 -1
- package/types/Modal/ModalHeader/props.d.ts +18 -0
- package/types/Modal/ModalHeader/props.d.ts.map +1 -0
- package/types/Modal/ModalHeader/styles.d.ts +1 -1
- package/types/Modal/index.d.ts +55 -110
- package/types/Modal/index.d.ts.map +1 -1
- package/types/Modal/{types.d.ts → props.d.ts} +13 -6
- package/types/Modal/{types.d.ts.map → props.d.ts.map} +1 -1
- package/types/Modal/styles.d.ts +1 -1
- package/types/index.d.ts +4 -4
- package/LICENSE.md +0 -27
- package/es/Modal/ModalBody/types.js +0 -1
- package/es/Modal/ModalFooter/types.js +0 -1
- package/es/Modal/ModalHeader/types.js +0 -1
- package/es/Modal/types.js +0 -1
- package/lib/Modal/ModalBody/types.js +0 -1
- package/lib/Modal/ModalFooter/types.js +0 -1
- package/lib/Modal/ModalHeader/types.js +0 -1
- package/lib/Modal/types.js +0 -1
- package/types/Modal/ModalBody/types.d.ts +0 -12
- package/types/Modal/ModalBody/types.d.ts.map +0 -1
- package/types/Modal/ModalFooter/types.d.ts +0 -6
- package/types/Modal/ModalFooter/types.d.ts.map +0 -1
- package/types/Modal/ModalHeader/types.d.ts +0 -9
- package/types/Modal/ModalHeader/types.d.ts.map +0 -1
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.allowedProps = exports.propTypes = void 0;
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _element = require("@instructure/ui-prop-types/lib/element.js");
|
|
13
|
+
|
|
14
|
+
var _Children = require("@instructure/ui-prop-types/lib/Children.js");
|
|
15
|
+
|
|
16
|
+
var _Transition = require("@instructure/ui-motion/lib/Transition");
|
|
17
|
+
|
|
18
|
+
var _ModalHeader = require("./ModalHeader");
|
|
19
|
+
|
|
20
|
+
var _ModalBody = require("./ModalBody");
|
|
21
|
+
|
|
22
|
+
var _ModalFooter = require("./ModalFooter");
|
|
23
|
+
|
|
24
|
+
/*
|
|
25
|
+
* The MIT License (MIT)
|
|
26
|
+
*
|
|
27
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
28
|
+
*
|
|
29
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
30
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
31
|
+
* in the Software without restriction, including without limitation the rights
|
|
32
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
33
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
34
|
+
* furnished to do so, subject to the following conditions:
|
|
35
|
+
*
|
|
36
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
37
|
+
* copies or substantial portions of the Software.
|
|
38
|
+
*
|
|
39
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
40
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
41
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
42
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
43
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
44
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
45
|
+
* SOFTWARE.
|
|
46
|
+
*/
|
|
47
|
+
const propTypes = {
|
|
48
|
+
/**
|
|
49
|
+
* An accessible label for the `<Modal />` content
|
|
50
|
+
*/
|
|
51
|
+
label: _propTypes.default.string.isRequired,
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The children to be rendered within the `<Modal />`
|
|
55
|
+
*/
|
|
56
|
+
children: _Children.Children.enforceOrder([_ModalHeader.ModalHeader, _ModalBody.ModalBody, _ModalFooter.ModalFooter], [_ModalHeader.ModalHeader, _ModalBody.ModalBody], [_ModalBody.ModalBody, _ModalFooter.ModalFooter], [_ModalBody.ModalBody]),
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The element to render the dialog as, `span` by default
|
|
60
|
+
*/
|
|
61
|
+
as: _propTypes.default.elementType,
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The size of the `<Modal />` content
|
|
65
|
+
*/
|
|
66
|
+
size: _propTypes.default.oneOf(['auto', 'small', 'medium', 'large', 'fullscreen']),
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Designates the background style of the `<Modal />`
|
|
70
|
+
*/
|
|
71
|
+
variant: _propTypes.default.oneOf(['default', 'inverse']),
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Whether or not the `<Modal />` is open
|
|
75
|
+
*/
|
|
76
|
+
open: _propTypes.default.bool,
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* An element or a function returning an element to focus by default
|
|
80
|
+
*/
|
|
81
|
+
defaultFocusElement: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func]),
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Whether focus should be returned to the trigger when the `<Modal/>` is closed
|
|
85
|
+
*/
|
|
86
|
+
shouldReturnFocus: _propTypes.default.bool,
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Whether the `<Modal/>` should request close when the document is clicked
|
|
90
|
+
*/
|
|
91
|
+
shouldCloseOnDocumentClick: _propTypes.default.bool,
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Callback fired when `<Modal />` content has been mounted in the DOM
|
|
95
|
+
*/
|
|
96
|
+
onOpen: _propTypes.default.func,
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Callback fired when `<Modal />` has been unmounted from the DOM
|
|
100
|
+
*/
|
|
101
|
+
onClose: _propTypes.default.func,
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Callback fired when the `<Modal />` is requesting to be closed
|
|
105
|
+
*/
|
|
106
|
+
onDismiss: _propTypes.default.func,
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
*
|
|
110
|
+
* A function that returns a reference to the content element
|
|
111
|
+
*/
|
|
112
|
+
contentRef: _propTypes.default.func,
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* An element or a function returning an element to use as the mount node
|
|
116
|
+
* for the `<Modal />` (defaults to `document.body`)
|
|
117
|
+
*/
|
|
118
|
+
mountNode: _propTypes.default.oneOfType([_element.element, _propTypes.default.func]),
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Insert the element at the 'top' of the mountNode or at the 'bottom'
|
|
122
|
+
*/
|
|
123
|
+
insertAt: _propTypes.default.oneOf(['bottom', 'top']),
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* An element, function returning an element, or array of elements that will not be hidden from
|
|
127
|
+
* the screen reader when the `<Modal />` is open
|
|
128
|
+
*/
|
|
129
|
+
liveRegion: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.element), _propTypes.default.element, _propTypes.default.func]),
|
|
130
|
+
transition: _Transition.Transition.propTypes.type,
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Callback fired before the <Modal /> transitions in
|
|
134
|
+
*/
|
|
135
|
+
onEnter: _propTypes.default.func,
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Callback fired as the <Modal /> begins to transition in
|
|
139
|
+
*/
|
|
140
|
+
onEntering: _propTypes.default.func,
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Callback fired after the <Modal /> finishes transitioning in
|
|
144
|
+
*/
|
|
145
|
+
onEntered: _propTypes.default.func,
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Callback fired right before the <Modal /> transitions out
|
|
149
|
+
*/
|
|
150
|
+
onExit: _propTypes.default.func,
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Callback fired as the <Modal /> begins to transition out
|
|
154
|
+
*/
|
|
155
|
+
onExiting: _propTypes.default.func,
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Callback fired after the <Modal /> finishes transitioning out
|
|
159
|
+
*/
|
|
160
|
+
onExited: _propTypes.default.func,
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Constrain the Modal to the document window or its closest positioned parent
|
|
164
|
+
*/
|
|
165
|
+
constrain: _propTypes.default.oneOf(['window', 'parent']),
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Should ModalBody handle overflow with scrollbars, or fit its
|
|
169
|
+
* content within its own height?
|
|
170
|
+
*/
|
|
171
|
+
overflow: _propTypes.default.oneOf(['scroll', 'fit'])
|
|
172
|
+
};
|
|
173
|
+
exports.propTypes = propTypes;
|
|
174
|
+
const allowedProps = ['label', 'children', 'as', 'size', 'variant', 'open', 'defaultFocusElement', 'shouldReturnFocus', 'shouldCloseOnDocumentClick', 'onOpen', 'onClose', 'onDismiss', 'contentRef', 'mountNode', 'insertAt', 'liveRegion', 'transition', 'onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited', 'constrain', 'overflow'];
|
|
175
|
+
exports.allowedProps = allowedProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-modal",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.9.0",
|
|
4
4
|
"description": "A component for displaying content in a dialog overlay",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -25,35 +25,34 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@babel/runtime": "^7.13.10",
|
|
28
|
-
"@instructure/console": "8.
|
|
29
|
-
"@instructure/emotion": "8.
|
|
30
|
-
"@instructure/
|
|
31
|
-
"@instructure/ui-
|
|
32
|
-
"@instructure/ui-
|
|
33
|
-
"@instructure/ui-
|
|
34
|
-
"@instructure/ui-
|
|
35
|
-
"@instructure/ui-
|
|
36
|
-
"@instructure/ui-
|
|
37
|
-
"@instructure/ui-
|
|
38
|
-
"@instructure/ui-
|
|
39
|
-
"@instructure/ui-
|
|
28
|
+
"@instructure/console": "8.9.0",
|
|
29
|
+
"@instructure/emotion": "8.9.0",
|
|
30
|
+
"@instructure/shared-types": "8.9.0",
|
|
31
|
+
"@instructure/ui-buttons": "8.9.0",
|
|
32
|
+
"@instructure/ui-dialog": "8.9.0",
|
|
33
|
+
"@instructure/ui-motion": "8.9.0",
|
|
34
|
+
"@instructure/ui-overlays": "8.9.0",
|
|
35
|
+
"@instructure/ui-portal": "8.9.0",
|
|
36
|
+
"@instructure/ui-prop-types": "8.9.0",
|
|
37
|
+
"@instructure/ui-react-utils": "8.9.0",
|
|
38
|
+
"@instructure/ui-testable": "8.9.0",
|
|
39
|
+
"@instructure/ui-utils": "8.9.0",
|
|
40
|
+
"@instructure/ui-view": "8.9.0",
|
|
40
41
|
"prop-types": "^15"
|
|
41
42
|
},
|
|
42
43
|
"peerDependencies": {
|
|
43
44
|
"react": ">=16.8 <=17"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
|
-
"@instructure/
|
|
47
|
-
"@instructure/ui-
|
|
48
|
-
"@instructure/ui-
|
|
49
|
-
"@instructure/ui-
|
|
50
|
-
"@instructure/ui-test-
|
|
51
|
-
"@instructure/ui-
|
|
52
|
-
"@instructure/ui-themes": "8.8.1-snapshot.3+d5d6d4cd8"
|
|
47
|
+
"@instructure/ui-babel-preset": "8.9.0",
|
|
48
|
+
"@instructure/ui-color-utils": "8.9.0",
|
|
49
|
+
"@instructure/ui-position": "8.9.0",
|
|
50
|
+
"@instructure/ui-test-locator": "8.9.0",
|
|
51
|
+
"@instructure/ui-test-utils": "8.9.0",
|
|
52
|
+
"@instructure/ui-themes": "8.9.0"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
-
"sideEffects": false
|
|
58
|
-
"gitHead": "d5d6d4cd8f300e8635c69248f5d794c002269e08"
|
|
57
|
+
"sideEffects": false
|
|
59
58
|
}
|
|
@@ -24,16 +24,17 @@
|
|
|
24
24
|
|
|
25
25
|
/** @jsx jsx */
|
|
26
26
|
import { Component } from 'react'
|
|
27
|
-
import PropTypes from 'prop-types'
|
|
28
27
|
|
|
29
28
|
import { View } from '@instructure/ui-view'
|
|
30
29
|
import { testable } from '@instructure/ui-testable'
|
|
31
30
|
import { omitProps } from '@instructure/ui-react-utils'
|
|
32
31
|
|
|
33
|
-
import { withStyle, jsx
|
|
32
|
+
import { withStyle, jsx } from '@instructure/emotion'
|
|
34
33
|
import generateStyle from './styles'
|
|
35
34
|
import generateComponentTheme from './theme'
|
|
36
|
-
|
|
35
|
+
|
|
36
|
+
import { propTypes, allowedProps } from './props'
|
|
37
|
+
import type { ModalBodyProps } from './props'
|
|
37
38
|
|
|
38
39
|
/**
|
|
39
40
|
---
|
|
@@ -46,27 +47,13 @@ id: Modal.Body
|
|
|
46
47
|
class ModalBody extends Component<ModalBodyProps> {
|
|
47
48
|
static readonly componentId = 'Modal.Body'
|
|
48
49
|
|
|
49
|
-
static propTypes =
|
|
50
|
-
|
|
51
|
-
padding: ThemeablePropTypes.spacing,
|
|
52
|
-
elementRef: PropTypes.func,
|
|
53
|
-
as: PropTypes.elementType,
|
|
54
|
-
variant: PropTypes.oneOf(['default', 'inverse']),
|
|
55
|
-
overflow: PropTypes.oneOf(['scroll', 'fit']),
|
|
56
|
-
|
|
57
|
-
// eslint-disable-next-line react/require-default-props
|
|
58
|
-
makeStyles: PropTypes.func,
|
|
59
|
-
// eslint-disable-next-line react/require-default-props
|
|
60
|
-
styles: PropTypes.object
|
|
61
|
-
}
|
|
62
|
-
|
|
50
|
+
static propTypes = propTypes
|
|
51
|
+
static allowedProps = allowedProps
|
|
63
52
|
static defaultProps = {
|
|
64
53
|
padding: 'medium',
|
|
65
54
|
as: 'div',
|
|
66
55
|
variant: 'default',
|
|
67
|
-
children: null
|
|
68
|
-
elementRef: undefined,
|
|
69
|
-
overflow: undefined
|
|
56
|
+
children: null
|
|
70
57
|
}
|
|
71
58
|
|
|
72
59
|
componentDidMount() {
|
|
@@ -105,7 +92,7 @@ class ModalBody extends Component<ModalBodyProps> {
|
|
|
105
92
|
height={isFit ? '100%' : undefined}
|
|
106
93
|
elementRef={elementRef}
|
|
107
94
|
as={as}
|
|
108
|
-
css={this.props.styles
|
|
95
|
+
css={this.props.styles?.modalBody}
|
|
109
96
|
padding={padding}
|
|
110
97
|
tabIndex={-1} // prevent FF from focusing view when scrollable
|
|
111
98
|
>
|
|
@@ -22,39 +22,46 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import type { PositionMountNode } from '@instructure/ui-position'
|
|
28
|
-
import type { TransitionType } from '@instructure/ui-motion'
|
|
25
|
+
import React from 'react'
|
|
26
|
+
import PropTypes from 'prop-types'
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
import { ThemeablePropTypes } from '@instructure/emotion'
|
|
29
|
+
|
|
30
|
+
import type { Spacing, WithStyleProps } from '@instructure/emotion'
|
|
31
|
+
import type { AsElementType, PropValidators } from '@instructure/shared-types'
|
|
32
|
+
|
|
33
|
+
type ModalBodyOwnProps = {
|
|
34
|
+
children?: React.ReactNode
|
|
35
|
+
padding?: Spacing
|
|
36
|
+
elementRef?: (...args: any[]) => any
|
|
32
37
|
as?: AsElementType
|
|
33
|
-
size?: 'auto' | 'small' | 'medium' | 'large' | 'fullscreen'
|
|
34
38
|
variant?: 'default' | 'inverse'
|
|
35
|
-
open?: boolean
|
|
36
|
-
defaultFocusElement?: React.ReactElement | ((...args: any[]) => any)
|
|
37
|
-
shouldReturnFocus?: boolean
|
|
38
|
-
shouldCloseOnDocumentClick?: boolean
|
|
39
|
-
onOpen?: (DOMNode: PortalNode) => any
|
|
40
|
-
onClose?: (...args: any[]) => any
|
|
41
|
-
onDismiss?: (...args: any[]) => any
|
|
42
|
-
contentRef?: (...args: any[]) => any
|
|
43
|
-
mountNode?: PositionMountNode
|
|
44
|
-
insertAt?: 'bottom' | 'top'
|
|
45
|
-
liveRegion?:
|
|
46
|
-
| React.ReactElement[]
|
|
47
|
-
| React.ReactElement
|
|
48
|
-
| ((...args: any[]) => any)
|
|
49
|
-
transition?: TransitionType
|
|
50
|
-
onEnter?: (...args: any[]) => any
|
|
51
|
-
onEntering?: (...args: any[]) => any
|
|
52
|
-
onEntered?: (...args: any[]) => any
|
|
53
|
-
onExit?: (...args: any[]) => any
|
|
54
|
-
onExiting?: (...args: any[]) => any
|
|
55
|
-
onExited?: (...args: any[]) => any
|
|
56
|
-
constrain?: 'window' | 'parent'
|
|
57
39
|
overflow?: 'scroll' | 'fit'
|
|
58
|
-
makeStyles?: (...args: any[]) => any
|
|
59
|
-
styles?: any
|
|
60
40
|
}
|
|
41
|
+
|
|
42
|
+
type PropKeys = keyof ModalBodyOwnProps
|
|
43
|
+
|
|
44
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
45
|
+
|
|
46
|
+
type ModalBodyProps = ModalBodyOwnProps & WithStyleProps
|
|
47
|
+
|
|
48
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
49
|
+
children: PropTypes.node,
|
|
50
|
+
padding: ThemeablePropTypes.spacing,
|
|
51
|
+
elementRef: PropTypes.func,
|
|
52
|
+
as: PropTypes.elementType,
|
|
53
|
+
variant: PropTypes.oneOf(['default', 'inverse']),
|
|
54
|
+
overflow: PropTypes.oneOf(['scroll', 'fit'])
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const allowedProps: AllowedPropKeys = [
|
|
58
|
+
'children',
|
|
59
|
+
'padding',
|
|
60
|
+
'elementRef',
|
|
61
|
+
'as',
|
|
62
|
+
'variant',
|
|
63
|
+
'overflow'
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
export type { ModalBodyProps }
|
|
67
|
+
export { propTypes, allowedProps }
|
|
@@ -24,14 +24,15 @@
|
|
|
24
24
|
|
|
25
25
|
/** @jsx jsx */
|
|
26
26
|
import { Component } from 'react'
|
|
27
|
-
import PropTypes from 'prop-types'
|
|
28
27
|
|
|
29
28
|
import { passthroughProps } from '@instructure/ui-react-utils'
|
|
30
29
|
import { testable } from '@instructure/ui-testable'
|
|
31
30
|
import { withStyle, jsx } from '@instructure/emotion'
|
|
32
31
|
import generateStyle from './styles'
|
|
33
32
|
import generateComponentTheme from './theme'
|
|
34
|
-
|
|
33
|
+
|
|
34
|
+
import { propTypes, allowedProps } from './props'
|
|
35
|
+
import type { ModalFooterProps } from './props'
|
|
35
36
|
|
|
36
37
|
/**
|
|
37
38
|
---
|
|
@@ -44,16 +45,8 @@ id: Modal.Footer
|
|
|
44
45
|
class ModalFooter extends Component<ModalFooterProps> {
|
|
45
46
|
static readonly componentId = 'Modal.Footer'
|
|
46
47
|
|
|
47
|
-
static propTypes =
|
|
48
|
-
|
|
49
|
-
variant: PropTypes.oneOf(['default', 'inverse']),
|
|
50
|
-
|
|
51
|
-
// eslint-disable-next-line react/require-default-props
|
|
52
|
-
makeStyles: PropTypes.func,
|
|
53
|
-
// eslint-disable-next-line react/require-default-props
|
|
54
|
-
styles: PropTypes.object
|
|
55
|
-
}
|
|
56
|
-
|
|
48
|
+
static propTypes = propTypes
|
|
49
|
+
static allowedProps = allowedProps
|
|
57
50
|
static defaultProps = {
|
|
58
51
|
variant: 'default',
|
|
59
52
|
children: null
|
|
@@ -74,7 +67,7 @@ class ModalFooter extends Component<ModalFooterProps> {
|
|
|
74
67
|
const { children, ...rest } = this.props
|
|
75
68
|
|
|
76
69
|
return (
|
|
77
|
-
<div css={this.props.styles
|
|
70
|
+
<div css={this.props.styles?.modalFooter} {...passthroughProps(rest)}>
|
|
78
71
|
{children}
|
|
79
72
|
</div>
|
|
80
73
|
)
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
import React from 'react'
|
|
26
|
+
import PropTypes from 'prop-types'
|
|
27
|
+
|
|
28
|
+
import type { PropValidators } from '@instructure/shared-types'
|
|
29
|
+
import type { WithStyleProps } from '@instructure/emotion'
|
|
30
|
+
|
|
31
|
+
type ModalFooterOwnProps = {
|
|
32
|
+
children?: React.ReactNode
|
|
33
|
+
variant?: 'default' | 'inverse'
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
type PropKeys = keyof ModalFooterOwnProps
|
|
37
|
+
|
|
38
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
39
|
+
|
|
40
|
+
type ModalFooterProps = ModalFooterOwnProps & WithStyleProps
|
|
41
|
+
|
|
42
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
43
|
+
children: PropTypes.node,
|
|
44
|
+
variant: PropTypes.oneOf(['default', 'inverse'])
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const allowedProps: AllowedPropKeys = ['children', 'variant']
|
|
48
|
+
|
|
49
|
+
export type { ModalFooterProps }
|
|
50
|
+
export { propTypes, allowedProps }
|