@instructure/ui-modal 8.23.1-snapshot.7 → 8.24.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.
@@ -73,11 +73,13 @@ var _dec, _dec2, _class, _class2;
73
73
  category: components
74
74
  tags: overlay, portal, dialog
75
75
  ---
76
+ @tsProps
76
77
  **/
77
78
  let Modal = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_class2 = class Modal extends _react.Component {
78
79
  constructor(props) {
79
80
  super(props);
80
81
  this._DOMNode = null;
82
+ this._content = null;
81
83
  this.ref = null;
82
84
 
83
85
  this.handleRef = el => {
@@ -88,7 +90,7 @@ let Modal = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
88
90
  this.DOMNode = DOMNode;
89
91
  };
90
92
 
91
- this.handleTransitionExited = _type => {
93
+ this.handleTransitionExited = () => {
92
94
  this.setState({
93
95
  transitioning: false
94
96
  });
@@ -108,10 +110,14 @@ let Modal = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
108
110
  }
109
111
 
110
112
  componentDidMount() {
111
- this.props.makeStyles();
113
+ var _this$props$makeStyle, _this$props;
114
+
115
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
112
116
  }
113
117
 
114
- componentDidUpdate(prevProps, prevState, snapshot) {
118
+ componentDidUpdate(prevProps) {
119
+ var _this$props$makeStyle2, _this$props2;
120
+
115
121
  if (prevProps.open && !this.props.open) {
116
122
  // closing
117
123
  this.setState({
@@ -119,7 +125,7 @@ let Modal = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
119
125
  });
120
126
  }
121
127
 
122
- this.props.makeStyles();
128
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
123
129
  }
124
130
 
125
131
  get defaultFocusElement() {
@@ -143,10 +149,10 @@ let Modal = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
143
149
  }
144
150
 
145
151
  renderChildren() {
146
- const _this$props = this.props,
147
- children = _this$props.children,
148
- variant = _this$props.variant,
149
- overflow = _this$props.overflow;
152
+ const _this$props3 = this.props,
153
+ children = _this$props3.children,
154
+ variant = _this$props3.variant,
155
+ overflow = _this$props3.overflow;
150
156
  return _react.Children.map(children, child => {
151
157
  if (!child) return; // ignore null, falsy children
152
158
 
@@ -164,16 +170,16 @@ let Modal = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
164
170
  }
165
171
 
166
172
  renderDialog(props) {
167
- const _this$props2 = this.props,
168
- onDismiss = _this$props2.onDismiss,
169
- label = _this$props2.label,
170
- shouldCloseOnDocumentClick = _this$props2.shouldCloseOnDocumentClick,
171
- shouldReturnFocus = _this$props2.shouldReturnFocus,
172
- liveRegion = _this$props2.liveRegion,
173
- size = _this$props2.size,
174
- constrain = _this$props2.constrain,
175
- as = _this$props2.as,
176
- styles = _this$props2.styles;
173
+ const _this$props4 = this.props,
174
+ onDismiss = _this$props4.onDismiss,
175
+ label = _this$props4.label,
176
+ shouldCloseOnDocumentClick = _this$props4.shouldCloseOnDocumentClick,
177
+ shouldReturnFocus = _this$props4.shouldReturnFocus,
178
+ liveRegion = _this$props4.liveRegion,
179
+ size = _this$props4.size,
180
+ constrain = _this$props4.constrain,
181
+ as = _this$props4.as,
182
+ styles = _this$props4.styles;
177
183
  const isFullScreen = size === 'fullscreen';
178
184
  const dialog = (0, _emotion.jsx)(_Dialog.Dialog, Object.assign({}, (0, _passthroughProps.passthroughProps)(props), {
179
185
  as: as,
@@ -203,22 +209,22 @@ let Modal = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
203
209
  render() {
204
210
  var _this$props$styles;
205
211
 
206
- const _this$props3 = this.props,
207
- open = _this$props3.open,
208
- onOpen = _this$props3.onOpen,
209
- onClose = _this$props3.onClose,
210
- mountNode = _this$props3.mountNode,
211
- insertAt = _this$props3.insertAt,
212
- transition = _this$props3.transition,
213
- onEnter = _this$props3.onEnter,
214
- onEntering = _this$props3.onEntering,
215
- onEntered = _this$props3.onEntered,
216
- onExit = _this$props3.onExit,
217
- onExiting = _this$props3.onExiting,
218
- onExited = _this$props3.onExited,
219
- constrain = _this$props3.constrain,
220
- overflow = _this$props3.overflow,
221
- passthroughProps = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
212
+ const _this$props5 = this.props,
213
+ open = _this$props5.open,
214
+ onOpen = _this$props5.onOpen,
215
+ onClose = _this$props5.onClose,
216
+ mountNode = _this$props5.mountNode,
217
+ insertAt = _this$props5.insertAt,
218
+ transition = _this$props5.transition,
219
+ onEnter = _this$props5.onEnter,
220
+ onEntering = _this$props5.onEntering,
221
+ onEntered = _this$props5.onEntered,
222
+ onExit = _this$props5.onExit,
223
+ onExiting = _this$props5.onExiting,
224
+ onExited = _this$props5.onExited,
225
+ constrain = _this$props5.constrain,
226
+ overflow = _this$props5.overflow,
227
+ passthroughProps = (0, _objectWithoutProperties2.default)(_this$props5, _excluded);
222
228
  const portalIsOpen = open || this.state.transitioning;
223
229
  return (0, _emotion.jsx)(_Portal.Portal, {
224
230
  mountNode: mountNode,
@@ -248,24 +254,9 @@ let Modal = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _d
248
254
  size: 'auto',
249
255
  variant: 'default',
250
256
  transition: 'fade',
251
- onOpen: event => {},
252
- onClose: event => {},
253
- onDismiss: event => {},
254
- onEnter: () => {},
255
- onEntering: () => {},
256
- onEntered: () => {},
257
- onExit: () => {},
258
- onExiting: () => {},
259
- onExited: () => {},
260
- as: void 0,
261
- mountNode: null,
262
257
  insertAt: 'bottom',
263
- liveRegion: null,
264
- contentRef: el => {},
265
258
  shouldCloseOnDocumentClick: true,
266
259
  shouldReturnFocus: true,
267
- defaultFocusElement: null,
268
- children: null,
269
260
  constrain: 'window',
270
261
  overflow: 'scroll'
271
262
  }, _class2.Header = _ModalHeader.ModalHeader, _class2.Body = _ModalBody.ModalBody, _class2.Footer = _ModalFooter.ModalFooter, _class2)) || _class) || _class);
@@ -45,129 +45,30 @@ var _ModalFooter = require("./ModalFooter");
45
45
  * SOFTWARE.
46
46
  */
47
47
  const propTypes = {
48
- /**
49
- * An accessible label for the `<Modal />` content
50
- */
51
48
  label: _propTypes.default.string.isRequired,
52
-
53
- /**
54
- * The children to be rendered within the `<Modal />`
55
- */
56
49
  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
50
  as: _propTypes.default.elementType,
62
-
63
- /**
64
- * The size of the `<Modal />` content
65
- */
66
51
  size: _propTypes.default.oneOf(['auto', 'small', 'medium', 'large', 'fullscreen']),
67
-
68
- /**
69
- * Designates the background style of the `<Modal />`
70
- */
71
52
  variant: _propTypes.default.oneOf(['default', 'inverse']),
72
-
73
- /**
74
- * Whether or not the `<Modal />` is open
75
- */
76
53
  open: _propTypes.default.bool,
77
-
78
- /**
79
- * An element or a function returning an element to focus by default
80
- */
81
54
  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
55
  shouldReturnFocus: _propTypes.default.bool,
87
-
88
- /**
89
- * Whether the `<Modal/>` should request close when the document is clicked
90
- */
91
56
  shouldCloseOnDocumentClick: _propTypes.default.bool,
92
-
93
- /**
94
- * Callback fired when `<Modal />` content has been mounted in the DOM
95
- */
96
57
  onOpen: _propTypes.default.func,
97
-
98
- /**
99
- * Callback fired when `<Modal />` has been unmounted from the DOM
100
- */
101
58
  onClose: _propTypes.default.func,
102
-
103
- /**
104
- * Callback fired when the `<Modal />` is requesting to be closed
105
- */
106
59
  onDismiss: _propTypes.default.func,
107
-
108
- /**
109
- *
110
- * A function that returns a reference to the content element
111
- */
112
60
  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
61
  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
62
  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
63
  liveRegion: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.element), _propTypes.default.element, _propTypes.default.func]),
130
64
  transition: _uiMotion.transitionTypePropType,
131
-
132
- /**
133
- * Callback fired before the <Modal /> transitions in
134
- */
135
65
  onEnter: _propTypes.default.func,
136
-
137
- /**
138
- * Callback fired as the <Modal /> begins to transition in
139
- */
140
66
  onEntering: _propTypes.default.func,
141
-
142
- /**
143
- * Callback fired after the <Modal /> finishes transitioning in
144
- */
145
67
  onEntered: _propTypes.default.func,
146
-
147
- /**
148
- * Callback fired right before the <Modal /> transitions out
149
- */
150
68
  onExit: _propTypes.default.func,
151
-
152
- /**
153
- * Callback fired as the <Modal /> begins to transition out
154
- */
155
69
  onExiting: _propTypes.default.func,
156
-
157
- /**
158
- * Callback fired after the <Modal /> finishes transitioning out
159
- */
160
70
  onExited: _propTypes.default.func,
161
-
162
- /**
163
- * Constrain the Modal to the document window or its closest positioned parent
164
- */
165
71
  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
72
  overflow: _propTypes.default.oneOf(['scroll', 'fit'])
172
73
  };
173
74
  exports.propTypes = propTypes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-modal",
3
- "version": "8.23.1-snapshot.7+67fb0a5be",
3
+ "version": "8.24.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,35 +24,34 @@
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
26
  "@babel/runtime": "^7.13.10",
27
- "@instructure/console": "8.23.1-snapshot.7+67fb0a5be",
28
- "@instructure/emotion": "8.23.1-snapshot.7+67fb0a5be",
29
- "@instructure/shared-types": "8.23.1-snapshot.7+67fb0a5be",
30
- "@instructure/ui-buttons": "8.23.1-snapshot.7+67fb0a5be",
31
- "@instructure/ui-dialog": "8.23.1-snapshot.7+67fb0a5be",
32
- "@instructure/ui-motion": "8.23.1-snapshot.7+67fb0a5be",
33
- "@instructure/ui-overlays": "8.23.1-snapshot.7+67fb0a5be",
34
- "@instructure/ui-portal": "8.23.1-snapshot.7+67fb0a5be",
35
- "@instructure/ui-prop-types": "8.23.1-snapshot.7+67fb0a5be",
36
- "@instructure/ui-react-utils": "8.23.1-snapshot.7+67fb0a5be",
37
- "@instructure/ui-testable": "8.23.1-snapshot.7+67fb0a5be",
38
- "@instructure/ui-utils": "8.23.1-snapshot.7+67fb0a5be",
39
- "@instructure/ui-view": "8.23.1-snapshot.7+67fb0a5be",
27
+ "@instructure/console": "8.24.0",
28
+ "@instructure/emotion": "8.24.0",
29
+ "@instructure/shared-types": "8.24.0",
30
+ "@instructure/ui-buttons": "8.24.0",
31
+ "@instructure/ui-dialog": "8.24.0",
32
+ "@instructure/ui-motion": "8.24.0",
33
+ "@instructure/ui-overlays": "8.24.0",
34
+ "@instructure/ui-portal": "8.24.0",
35
+ "@instructure/ui-prop-types": "8.24.0",
36
+ "@instructure/ui-react-utils": "8.24.0",
37
+ "@instructure/ui-testable": "8.24.0",
38
+ "@instructure/ui-utils": "8.24.0",
39
+ "@instructure/ui-view": "8.24.0",
40
40
  "prop-types": "^15"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "react": ">=16.8 <=17"
44
44
  },
45
45
  "devDependencies": {
46
- "@instructure/ui-babel-preset": "8.23.1-snapshot.7+67fb0a5be",
47
- "@instructure/ui-color-utils": "8.23.1-snapshot.7+67fb0a5be",
48
- "@instructure/ui-position": "8.23.1-snapshot.7+67fb0a5be",
49
- "@instructure/ui-test-locator": "8.23.1-snapshot.7+67fb0a5be",
50
- "@instructure/ui-test-utils": "8.23.1-snapshot.7+67fb0a5be",
51
- "@instructure/ui-themes": "8.23.1-snapshot.7+67fb0a5be"
46
+ "@instructure/ui-babel-preset": "8.24.0",
47
+ "@instructure/ui-color-utils": "8.24.0",
48
+ "@instructure/ui-position": "8.24.0",
49
+ "@instructure/ui-test-locator": "8.24.0",
50
+ "@instructure/ui-test-utils": "8.24.0",
51
+ "@instructure/ui-themes": "8.24.0"
52
52
  },
53
53
  "publishConfig": {
54
54
  "access": "public"
55
55
  },
56
- "sideEffects": false,
57
- "gitHead": "67fb0a5bed0138c5152872999bf1138dd2fd8fd7"
56
+ "sideEffects": false
58
57
  }
@@ -41,6 +41,7 @@ import type { ModalBodyProps } from './props'
41
41
  parent: Modal
42
42
  id: Modal.Body
43
43
  ---
44
+ @tsProps
44
45
  **/
45
46
  @withStyle(generateStyle, generateComponentTheme)
46
47
  @testable()
@@ -52,8 +53,7 @@ class ModalBody extends Component<ModalBodyProps> {
52
53
  static defaultProps = {
53
54
  padding: 'medium',
54
55
  as: 'div',
55
- variant: 'default',
56
- children: null
56
+ variant: 'default'
57
57
  }
58
58
 
59
59
  ref: Element | null = null
@@ -69,26 +69,16 @@ class ModalBody extends Component<ModalBodyProps> {
69
69
  }
70
70
 
71
71
  componentDidMount() {
72
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
73
- this.props.makeStyles()
72
+ this.props.makeStyles?.()
74
73
  }
75
74
 
76
- // @ts-expect-error ts-migrate(6133) FIXME: 'prevProps' is declared but its value is never rea... Remove this comment to see the full error message
77
- componentDidUpdate(prevProps, prevState, snapshot) {
78
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
79
- this.props.makeStyles()
75
+ componentDidUpdate() {
76
+ this.props.makeStyles?.()
80
77
  }
81
78
 
82
79
  render() {
83
- const {
84
- as,
85
- elementRef,
86
- overflow,
87
- variant,
88
- padding,
89
- children,
90
- ...rest
91
- } = this.props
80
+ const { as, elementRef, overflow, variant, padding, children, ...rest } =
81
+ this.props
92
82
 
93
83
  const passthroughProps = View.omitViewProps(
94
84
  omitProps(rest, ModalBody.allowedProps),
@@ -39,6 +39,7 @@ import type { ModalFooterProps } from './props'
39
39
  parent: Modal
40
40
  id: Modal.Footer
41
41
  ---
42
+ @tsProps
42
43
  **/
43
44
  @withStyle(generateStyle, generateComponentTheme)
44
45
  @testable()
@@ -48,25 +49,21 @@ class ModalFooter extends Component<ModalFooterProps> {
48
49
  static propTypes = propTypes
49
50
  static allowedProps = allowedProps
50
51
  static defaultProps = {
51
- variant: 'default',
52
- children: null
52
+ variant: 'default'
53
53
  }
54
54
 
55
- ref: Element | null = null
55
+ ref: HTMLDivElement | null = null
56
56
 
57
- handleRef = (el: Element | null) => {
57
+ handleRef = (el: HTMLDivElement | null) => {
58
58
  this.ref = el
59
59
  }
60
60
 
61
61
  componentDidMount() {
62
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
63
- this.props.makeStyles()
62
+ this.props.makeStyles?.()
64
63
  }
65
64
 
66
- // @ts-expect-error ts-migrate(6133) FIXME: 'prevProps' is declared but its value is never rea... Remove this comment to see the full error message
67
- componentDidUpdate(prevProps, prevState, snapshot) {
68
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
69
- this.props.makeStyles()
65
+ componentDidUpdate() {
66
+ this.props.makeStyles?.()
70
67
  }
71
68
 
72
69
  render() {
@@ -42,11 +42,14 @@ import generateComponentTheme from './theme'
42
42
  import { propTypes, allowedProps } from './props'
43
43
  import type { ModalHeaderProps, ModalHeaderStyleProps } from './props'
44
44
 
45
+ type CloseButtonChild = React.ComponentElement<CloseButtonProps, CloseButton>
46
+
45
47
  /**
46
48
  ---
47
49
  parent: Modal
48
50
  id: Modal.Header
49
51
  ---
52
+ @tsProps
50
53
  **/
51
54
  @withStyle(generateStyle, generateComponentTheme)
52
55
  @testable()
@@ -56,26 +59,22 @@ class ModalHeader extends Component<ModalHeaderProps> {
56
59
  static propTypes = propTypes
57
60
  static allowedProps = allowedProps
58
61
  static defaultProps = {
59
- children: null,
60
62
  variant: 'default',
61
63
  spacing: 'default'
62
64
  }
63
65
 
64
- ref: Element | null = null
66
+ ref: HTMLDivElement | null = null
65
67
 
66
- handleRef = (el: Element | null) => {
68
+ handleRef = (el: HTMLDivElement | null) => {
67
69
  this.ref = el
68
70
  }
69
71
 
70
72
  componentDidMount() {
71
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
72
- this.props.makeStyles(this.makeStyleProps())
73
+ this.props.makeStyles?.(this.makeStyleProps())
73
74
  }
74
75
 
75
- // @ts-expect-error ts-migrate(6133) FIXME: 'prevProps' is declared but its value is never rea... Remove this comment to see the full error message
76
- componentDidUpdate(prevProps, prevState, snapshot) {
77
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
78
- this.props.makeStyles(this.makeStyleProps())
76
+ componentDidUpdate() {
77
+ this.props.makeStyles?.(this.makeStyleProps())
79
78
  }
80
79
 
81
80
  makeStyleProps = (): ModalHeaderStyleProps => {
@@ -90,9 +89,7 @@ class ModalHeader extends Component<ModalHeaderProps> {
90
89
  React.Children.forEach(this.props.children, (child) => {
91
90
  if (
92
91
  child &&
93
- matchComponentTypes<
94
- React.ComponentElement<CloseButtonProps, CloseButton>
95
- >(child, [CloseButton])
92
+ matchComponentTypes<CloseButtonChild>(child, [CloseButton])
96
93
  ) {
97
94
  hasCloseButton = true
98
95
  }
@@ -34,7 +34,6 @@ import { createChainedFunction } from '@instructure/ui-utils'
34
34
  import { testable } from '@instructure/ui-testable'
35
35
 
36
36
  import { Transition } from '@instructure/ui-motion'
37
- import type { TransitionType } from '@instructure/ui-motion'
38
37
  import { Portal } from '@instructure/ui-portal'
39
38
  import type { PortalNode } from '@instructure/ui-portal'
40
39
  import { Dialog } from '@instructure/ui-dialog'
@@ -53,7 +52,12 @@ import generateStyle from './styles'
53
52
  import generateComponentTheme from './theme'
54
53
 
55
54
  import { propTypes, allowedProps } from './props'
56
- import type { ModalProps } from './props'
55
+ import type {
56
+ ModalProps,
57
+ ModalState,
58
+ ModalPropsForPortal,
59
+ ModalPropsForTransition
60
+ } from './props'
57
61
 
58
62
  type HeaderChild = React.ComponentElement<ModalHeaderProps, ModalHeader>
59
63
  type BodyChild = React.ComponentElement<ModalBodyProps, ModalBody>
@@ -64,10 +68,11 @@ type FooterChild = React.ComponentElement<ModalFooterProps, ModalFooter>
64
68
  category: components
65
69
  tags: overlay, portal, dialog
66
70
  ---
71
+ @tsProps
67
72
  **/
68
73
  @withStyle(generateStyle, generateComponentTheme)
69
74
  @testable()
70
- class Modal extends Component<ModalProps> {
75
+ class Modal extends Component<ModalProps, ModalState> {
71
76
  static readonly componentId = 'Modal'
72
77
 
73
78
  static propTypes = propTypes
@@ -77,28 +82,9 @@ class Modal extends Component<ModalProps> {
77
82
  size: 'auto',
78
83
  variant: 'default',
79
84
  transition: 'fade',
80
- // @ts-expect-error ts-migrate(6133) FIXME: 'event' is declared but its value is never read.
81
- onOpen: (event) => {},
82
- // @ts-expect-error ts-migrate(6133) FIXME: 'event' is declared but its value is never read.
83
- onClose: (event) => {},
84
- // @ts-expect-error ts-migrate(6133) FIXME: 'event' is declared but its value is never read.
85
- onDismiss: (event) => {},
86
- onEnter: () => {},
87
- onEntering: () => {},
88
- onEntered: () => {},
89
- onExit: () => {},
90
- onExiting: () => {},
91
- onExited: () => {},
92
- as: undefined,
93
- mountNode: null,
94
85
  insertAt: 'bottom',
95
- liveRegion: null,
96
- // @ts-expect-error ts-migrate(6133) FIXME: 'el' is declared but its value is never read.
97
- contentRef: (el) => {},
98
86
  shouldCloseOnDocumentClick: true,
99
87
  shouldReturnFocus: true,
100
- defaultFocusElement: null,
101
- children: null,
102
88
  constrain: 'window',
103
89
  overflow: 'scroll'
104
90
  }
@@ -107,8 +93,7 @@ class Modal extends Component<ModalProps> {
107
93
  static Body = ModalBody
108
94
  static Footer = ModalFooter
109
95
 
110
- // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'props' implicitly has an 'any' type.
111
- constructor(props) {
96
+ constructor(props: ModalProps) {
112
97
  super(props)
113
98
 
114
99
  this.state = {
@@ -117,6 +102,7 @@ class Modal extends Component<ModalProps> {
117
102
  }
118
103
 
119
104
  _DOMNode: PortalNode = null
105
+ _content: Dialog | null = null
120
106
 
121
107
  ref?: Element | null = null
122
108
 
@@ -125,20 +111,17 @@ class Modal extends Component<ModalProps> {
125
111
  }
126
112
 
127
113
  componentDidMount() {
128
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
129
- this.props.makeStyles()
114
+ this.props.makeStyles?.()
130
115
  }
131
116
 
132
- // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'prevProps' implicitly has an 'any' type... Remove this comment to see the full error message
133
- componentDidUpdate(prevProps, prevState, snapshot) {
117
+ componentDidUpdate(prevProps: ModalProps) {
134
118
  if (prevProps.open && !this.props.open) {
135
119
  // closing
136
120
  this.setState({
137
121
  transitioning: prevProps.transition !== null
138
122
  })
139
123
  }
140
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
141
- this.props.makeStyles()
124
+ this.props.makeStyles?.()
142
125
  }
143
126
 
144
127
  get defaultFocusElement() {
@@ -164,15 +147,13 @@ class Modal extends Component<ModalProps> {
164
147
  this.DOMNode = DOMNode
165
148
  }
166
149
 
167
- handleTransitionExited = (_type?: TransitionType) => {
150
+ handleTransitionExited: ModalProps['onExited'] = () => {
168
151
  this.setState({
169
152
  transitioning: false
170
153
  })
171
154
  }
172
155
 
173
- // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'el' implicitly has an 'any' type.
174
- contentRef = (el) => {
175
- // @ts-expect-error ts-migrate(2551) FIXME: Property '_content' does not exist on type 'Modal'... Remove this comment to see the full error message
156
+ contentRef = (el: Dialog | null) => {
176
157
  this._content = el
177
158
  if (typeof this.props.contentRef === 'function') {
178
159
  this.props.contentRef(el)
@@ -201,8 +182,15 @@ class Modal extends Component<ModalProps> {
201
182
  )
202
183
  }
203
184
 
204
- // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'props' implicitly has an 'any' type.
205
- renderDialog(props) {
185
+ renderDialog(
186
+ props: Omit<
187
+ ModalProps,
188
+ | keyof ModalPropsForPortal
189
+ | keyof ModalPropsForTransition
190
+ | 'constrain'
191
+ | 'overflow'
192
+ >
193
+ ) {
206
194
  const {
207
195
  onDismiss,
208
196
  label,
@@ -269,7 +257,6 @@ class Modal extends Component<ModalProps> {
269
257
  ...passthroughProps
270
258
  } = this.props
271
259
 
272
- // @ts-expect-error ts-migrate(2339) FIXME: Property 'transitioning' does not exist on type 'R... Remove this comment to see the full error message
273
260
  const portalIsOpen = open || this.state.transitioning
274
261
 
275
262
  return (