@instructure/ui-modal 11.7.3-snapshot-7 → 11.7.3-snapshot-26

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +5 -2
  2. package/es/Modal/v1/ModalBody/index.js +53 -54
  3. package/es/Modal/v1/ModalBody/styles.js +3 -1
  4. package/es/Modal/v1/ModalBody/theme.js +4 -3
  5. package/es/Modal/v1/ModalContext.js +1 -1
  6. package/es/Modal/v1/ModalFooter/index.js +20 -23
  7. package/es/Modal/v1/ModalFooter/styles.js +3 -1
  8. package/es/Modal/v1/ModalFooter/theme.js +12 -11
  9. package/es/Modal/v1/ModalHeader/index.js +47 -50
  10. package/es/Modal/v1/ModalHeader/styles.js +7 -3
  11. package/es/Modal/v1/ModalHeader/theme.js +10 -9
  12. package/es/Modal/v1/index.js +88 -84
  13. package/es/Modal/v1/styles.js +5 -3
  14. package/es/Modal/v1/theme.js +19 -18
  15. package/es/Modal/v2/ModalBody/index.js +54 -55
  16. package/es/Modal/v2/ModalBody/styles.js +4 -2
  17. package/es/Modal/v2/ModalContext.js +1 -1
  18. package/es/Modal/v2/ModalFooter/index.js +20 -23
  19. package/es/Modal/v2/ModalFooter/styles.js +4 -2
  20. package/es/Modal/v2/ModalHeader/index.js +47 -50
  21. package/es/Modal/v2/ModalHeader/styles.js +7 -3
  22. package/es/Modal/v2/index.js +88 -84
  23. package/es/Modal/v2/styles.js +5 -3
  24. package/lib/Modal/v1/ModalBody/index.js +53 -54
  25. package/lib/Modal/v1/ModalBody/styles.js +3 -1
  26. package/lib/Modal/v1/ModalBody/theme.js +4 -3
  27. package/lib/Modal/v1/ModalContext.js +1 -1
  28. package/lib/Modal/v1/ModalFooter/index.js +20 -23
  29. package/lib/Modal/v1/ModalFooter/styles.js +3 -1
  30. package/lib/Modal/v1/ModalFooter/theme.js +12 -11
  31. package/lib/Modal/v1/ModalHeader/index.js +47 -50
  32. package/lib/Modal/v1/ModalHeader/styles.js +7 -3
  33. package/lib/Modal/v1/ModalHeader/theme.js +10 -9
  34. package/lib/Modal/v1/index.js +88 -84
  35. package/lib/Modal/v1/styles.js +5 -3
  36. package/lib/Modal/v1/theme.js +19 -18
  37. package/lib/Modal/v2/ModalBody/index.js +54 -55
  38. package/lib/Modal/v2/ModalBody/styles.js +4 -2
  39. package/lib/Modal/v2/ModalContext.js +1 -1
  40. package/lib/Modal/v2/ModalFooter/index.js +20 -23
  41. package/lib/Modal/v2/ModalFooter/styles.js +4 -2
  42. package/lib/Modal/v2/ModalHeader/index.js +47 -50
  43. package/lib/Modal/v2/ModalHeader/styles.js +7 -3
  44. package/lib/Modal/v2/index.js +88 -84
  45. package/lib/Modal/v2/styles.js +5 -3
  46. package/package.json +18 -18
  47. package/tsconfig.build.tsbuildinfo +1 -1
@@ -1,6 +1,4 @@
1
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
- const _excluded = ["open", "onOpen", "onClose", "mountNode", "insertAt", "transition", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "constrain", "overflow"];
3
- var _dec, _class, _Modal;
1
+ var _dec, _class;
4
2
  /*
5
3
  * The MIT License (MIT)
6
4
  *
@@ -47,60 +45,60 @@ tags: overlay, portal, dialog
47
45
  ---
48
46
  **/
49
47
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
50
- let Modal = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_Modal = class Modal extends Component {
48
+ let Modal = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class Modal extends Component {
49
+ static displayName = "Modal";
50
+ static componentId = 'Modal';
51
+ static allowedProps = allowedProps;
52
+ static defaultProps = {
53
+ open: false,
54
+ size: 'auto',
55
+ variant: 'default',
56
+ transition: 'fade',
57
+ insertAt: 'bottom',
58
+ shouldCloseOnDocumentClick: true,
59
+ shouldReturnFocus: true,
60
+ constrain: 'window',
61
+ overflow: 'scroll'
62
+ };
63
+ static Header = ModalHeader;
64
+ static Body = ModalBody;
65
+ static Footer = ModalFooter;
51
66
  constructor(props) {
52
- var _props$open;
53
67
  super(props);
54
- this._DOMNode = null;
55
- this._content = null;
56
- this.ref = null;
57
- this.handleRef = el => {
58
- this.ref = el;
59
- };
60
- this.updateHeight = () => {
61
- this.setState({
62
- windowHeight: window.innerHeight
63
- });
64
- };
65
- this.handlePortalOpen = DOMNode => {
66
- this.DOMNode = DOMNode;
67
- };
68
- this.handleTransitionComplete = () => {
69
- this.setState({
70
- transitioning: false
71
- });
72
- };
73
- this.contentRef = el => {
74
- this._content = el;
75
- if (typeof this.props.contentRef === 'function') {
76
- this.props.contentRef(el);
77
- }
78
- };
79
68
  this.state = {
80
69
  transitioning: false,
81
- open: (_props$open = props.open) !== null && _props$open !== void 0 ? _props$open : false,
70
+ open: props.open ?? false,
82
71
  windowHeight: 99999,
83
- bodyScrollAriaLabel: void 0
72
+ bodyScrollAriaLabel: undefined
84
73
  };
85
74
  }
75
+ _DOMNode = null;
76
+ _content = null;
77
+ ref = null;
78
+ handleRef = el => {
79
+ this.ref = el;
80
+ };
86
81
  componentDidMount() {
87
- var _this$props$makeStyle, _this$props;
88
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
82
+ this.props.makeStyles?.();
89
83
  window.addEventListener('resize', this.updateHeight);
90
84
  }
91
85
  componentDidUpdate(prevProps) {
92
- var _this$props$makeStyle2, _this$props2;
93
86
  if (this.props.open !== prevProps.open) {
94
87
  this.setState({
95
88
  transitioning: true,
96
89
  open: !!this.props.open
97
90
  });
98
91
  }
99
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
92
+ this.props.makeStyles?.();
100
93
  }
101
94
  componentWillUnmount() {
102
95
  window.removeEventListener('resize', this.updateHeight);
103
96
  }
97
+ updateHeight = () => {
98
+ this.setState({
99
+ windowHeight: window.innerHeight
100
+ });
101
+ };
104
102
  get defaultFocusElement() {
105
103
  return this.props.defaultFocusElement;
106
104
  }
@@ -117,12 +115,27 @@ let Modal = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
117
115
  return 'center';
118
116
  }
119
117
  }
118
+ handlePortalOpen = DOMNode => {
119
+ this.DOMNode = DOMNode;
120
+ };
121
+ handleTransitionComplete = () => {
122
+ this.setState({
123
+ transitioning: false
124
+ });
125
+ };
126
+ contentRef = el => {
127
+ this._content = el;
128
+ if (typeof this.props.contentRef === 'function') {
129
+ this.props.contentRef(el);
130
+ }
131
+ };
120
132
  renderChildren() {
121
- const _this$props3 = this.props,
122
- children = _this$props3.children,
123
- variant = _this$props3.variant,
124
- overflow = _this$props3.overflow,
125
- styles = _this$props3.styles;
133
+ const {
134
+ children,
135
+ variant,
136
+ overflow,
137
+ styles
138
+ } = this.props;
126
139
  const childrenArray = Children.toArray(children);
127
140
  const headerAndBody = [];
128
141
  const others = [];
@@ -139,33 +152,33 @@ let Modal = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
139
152
  // Putting ModalHeader and ModalBody into the same container, so they can be styled together;
140
153
  // this is needed to apply a media query breakpoint
141
154
  const wrappedHeaderAndBody = headerAndBody.length > 0 ? _jsx("div", {
142
- css: styles === null || styles === void 0 ? void 0 : styles.joinedHeaderAndBody,
155
+ css: styles?.joinedHeaderAndBody,
143
156
  children: headerAndBody
144
157
  }, "header-and-body") : null;
145
158
  return [...(wrappedHeaderAndBody ? [wrappedHeaderAndBody] : []), ...others];
146
159
  }
147
160
  cloneChildWithProps(child, variant, overflow) {
148
161
  if (/*#__PURE__*/isValidElement(child)) {
149
- var _child$props;
150
162
  return safeCloneElement(child, {
151
163
  variant: variant,
152
- overflow: (child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.overflow) || overflow
164
+ overflow: child?.props?.overflow || overflow
153
165
  });
154
166
  } else {
155
167
  return child;
156
168
  }
157
169
  }
158
170
  renderDialog(props) {
159
- const _this$props4 = this.props,
160
- onDismiss = _this$props4.onDismiss,
161
- label = _this$props4.label,
162
- shouldCloseOnDocumentClick = _this$props4.shouldCloseOnDocumentClick,
163
- shouldReturnFocus = _this$props4.shouldReturnFocus,
164
- liveRegion = _this$props4.liveRegion,
165
- size = _this$props4.size,
166
- constrain = _this$props4.constrain,
167
- as = _this$props4.as,
168
- styles = _this$props4.styles;
171
+ const {
172
+ onDismiss,
173
+ label,
174
+ shouldCloseOnDocumentClick,
175
+ shouldReturnFocus,
176
+ liveRegion,
177
+ size,
178
+ constrain,
179
+ as,
180
+ styles
181
+ } = this.props;
169
182
  const isFullScreen = size === 'fullscreen';
170
183
  const dialog = _jsx(Dialog, {
171
184
  ...passthroughProps(props),
@@ -179,7 +192,7 @@ let Modal = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
179
192
  shouldReturnFocus: shouldReturnFocus,
180
193
  liveRegion: liveRegion,
181
194
  onDismiss: onDismiss,
182
- css: styles === null || styles === void 0 ? void 0 : styles.modal,
195
+ css: styles?.modal,
183
196
  ref: this.contentRef
184
197
  // aria-modal="true" see VO bug https://bugs.webkit.org/show_bug.cgi?id=174667
185
198
  ,
@@ -196,23 +209,24 @@ let Modal = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
196
209
  });
197
210
  }
198
211
  render() {
199
- var _this$props$styles;
200
- const _this$props5 = this.props,
201
- open = _this$props5.open,
202
- onOpen = _this$props5.onOpen,
203
- onClose = _this$props5.onClose,
204
- mountNode = _this$props5.mountNode,
205
- insertAt = _this$props5.insertAt,
206
- transition = _this$props5.transition,
207
- onEnter = _this$props5.onEnter,
208
- onEntering = _this$props5.onEntering,
209
- onEntered = _this$props5.onEntered,
210
- onExit = _this$props5.onExit,
211
- onExiting = _this$props5.onExiting,
212
- onExited = _this$props5.onExited,
213
- constrain = _this$props5.constrain,
214
- overflow = _this$props5.overflow,
215
- passthroughProps = _objectWithoutProperties(_this$props5, _excluded);
212
+ const {
213
+ open,
214
+ onOpen,
215
+ onClose,
216
+ mountNode,
217
+ insertAt,
218
+ transition,
219
+ onEnter,
220
+ onEntering,
221
+ onEntered,
222
+ onExit,
223
+ onExiting,
224
+ onExited,
225
+ constrain,
226
+ overflow,
227
+ // TODO this is not used currently
228
+ ...passthroughProps
229
+ } = this.props;
216
230
  const portalIsOpen = this.state.open || this.state.transitioning;
217
231
  return _jsx(Portal, {
218
232
  mountNode: mountNode,
@@ -238,23 +252,13 @@ let Modal = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
238
252
  })
239
253
  },
240
254
  children: constrain === 'parent' ? _jsx("span", {
241
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.constrainContext,
255
+ css: this.props.styles?.constrainContext,
242
256
  children: this.renderDialog(passthroughProps)
243
257
  }) : this.renderDialog(passthroughProps)
244
258
  })
245
259
  })
246
260
  });
247
261
  }
248
- }, _Modal.displayName = "Modal", _Modal.componentId = 'Modal', _Modal.allowedProps = allowedProps, _Modal.defaultProps = {
249
- open: false,
250
- size: 'auto',
251
- variant: 'default',
252
- transition: 'fade',
253
- insertAt: 'bottom',
254
- shouldCloseOnDocumentClick: true,
255
- shouldReturnFocus: true,
256
- constrain: 'window',
257
- overflow: 'scroll'
258
- }, _Modal.Header = ModalHeader, _Modal.Body = ModalBody, _Modal.Footer = ModalFooter, _Modal)) || _class);
262
+ }) || _class);
259
263
  export default Modal;
260
264
  export { Modal, ModalHeader, ModalBody, ModalFooter };
@@ -33,9 +33,11 @@
33
33
  * @return {Object} The final style object, which will be used in the component
34
34
  */
35
35
  const generateStyle = (componentTheme, props) => {
36
- const size = props.size,
37
- variant = props.variant,
38
- overflow = props.overflow;
36
+ const {
37
+ size,
38
+ variant,
39
+ overflow
40
+ } = props;
39
41
  const commonSizeStyleExceptForFullscreen = {
40
42
  maxWidth: '95%',
41
43
  maxHeight: '95%',
@@ -28,25 +28,26 @@
28
28
  * @return {Object} The final theme object with the overrides and component variables
29
29
  */
30
30
  const generateComponentTheme = theme => {
31
- var _colors$contrasts, _colors$contrasts2, _colors$contrasts3, _colors$contrasts4, _colors$contrasts5;
32
- const colors = theme.colors,
33
- typography = theme.typography,
34
- borders = theme.borders,
35
- breakpoints = theme.breakpoints,
36
- shadows = theme.shadows;
31
+ const {
32
+ colors,
33
+ typography,
34
+ borders,
35
+ breakpoints,
36
+ shadows
37
+ } = theme;
37
38
  const componentVariables = {
38
- fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
39
- textColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.grey125125,
40
- background: colors === null || colors === void 0 ? void 0 : (_colors$contrasts2 = colors.contrasts) === null || _colors$contrasts2 === void 0 ? void 0 : _colors$contrasts2.white1010,
41
- borderColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts3 = colors.contrasts) === null || _colors$contrasts3 === void 0 ? void 0 : _colors$contrasts3.grey1424,
42
- borderRadius: borders === null || borders === void 0 ? void 0 : borders.radiusMedium,
43
- inverseBackground: colors === null || colors === void 0 ? void 0 : (_colors$contrasts4 = colors.contrasts) === null || _colors$contrasts4 === void 0 ? void 0 : _colors$contrasts4.grey100100,
44
- inverseTextColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts5 = colors.contrasts) === null || _colors$contrasts5 === void 0 ? void 0 : _colors$contrasts5.white1010,
45
- autoMinWidth: breakpoints === null || breakpoints === void 0 ? void 0 : breakpoints.xSmall,
46
- smallMaxWidth: breakpoints === null || breakpoints === void 0 ? void 0 : breakpoints.small,
47
- mediumMaxWidth: breakpoints === null || breakpoints === void 0 ? void 0 : breakpoints.medium,
48
- largeMaxWidth: breakpoints === null || breakpoints === void 0 ? void 0 : breakpoints.large,
49
- boxShadow: shadows === null || shadows === void 0 ? void 0 : shadows.depth3
39
+ fontFamily: typography?.fontFamily,
40
+ textColor: colors?.contrasts?.grey125125,
41
+ background: colors?.contrasts?.white1010,
42
+ borderColor: colors?.contrasts?.grey1424,
43
+ borderRadius: borders?.radiusMedium,
44
+ inverseBackground: colors?.contrasts?.grey100100,
45
+ inverseTextColor: colors?.contrasts?.white1010,
46
+ autoMinWidth: breakpoints?.xSmall,
47
+ smallMaxWidth: breakpoints?.small,
48
+ mediumMaxWidth: breakpoints?.medium,
49
+ largeMaxWidth: breakpoints?.large,
50
+ boxShadow: shadows?.depth3
50
51
  };
51
52
  return {
52
53
  ...componentVariables
@@ -1,6 +1,4 @@
1
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
- const _excluded = ["as", "elementRef", "overflow", "variant", "padding", "spacing", "children"];
3
- var _dec, _class, _ModalBody;
1
+ var _dec, _class;
4
2
  /*
5
3
  * The MIT License (MIT)
6
4
  *
@@ -40,21 +38,30 @@ id: Modal.Body
40
38
  ---
41
39
  **/
42
40
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
43
- let ModalBody = (_dec = withStyle(generateStyle, 'ModalBody'), _dec(_class = (_ModalBody = class ModalBody extends Component {
41
+ let ModalBody = (_dec = withStyle(generateStyle, 'ModalBody'), _dec(_class = class ModalBody extends Component {
42
+ static displayName = "ModalBody";
43
+ static componentId = 'Modal.Body';
44
+ static allowedProps = allowedProps;
45
+ static defaultProps = {
46
+ padding: 'medium',
47
+ as: 'div',
48
+ variant: 'default'
49
+ };
50
+ ref = null;
51
+ handleRef = el => {
52
+ const {
53
+ elementRef
54
+ } = this.props;
55
+ this.ref = el;
56
+ if (typeof elementRef === 'function') {
57
+ elementRef(el);
58
+ }
59
+ };
44
60
  constructor(props) {
45
61
  super(props);
46
- this.ref = null;
47
- this.handleRef = el => {
48
- const elementRef = this.props.elementRef;
49
- this.ref = el;
50
- if (typeof elementRef === 'function') {
51
- elementRef(el);
52
- }
53
- };
54
62
  }
55
63
  componentDidMount() {
56
- var _this$props$makeStyle, _this$props;
57
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
64
+ this.props.makeStyles?.();
58
65
 
59
66
  // We detect if -moz- prefixed style is present to identify whether we are in Firefox browser
60
67
  const style = this.ref && getCSSStyleDeclaration(this.ref);
@@ -66,12 +73,11 @@ let ModalBody = (_dec = withStyle(generateStyle, 'ModalBody'), _dec(_class = (_M
66
73
  }
67
74
  }
68
75
  componentDidUpdate() {
69
- var _this$props$makeStyle2, _this$props2;
70
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
76
+ this.props.makeStyles?.();
71
77
  }
72
78
  getFinalRef(el) {
73
79
  if (!el) {
74
- return void 0;
80
+ return undefined;
75
81
  }
76
82
  if (el instanceof Element) {
77
83
  return el;
@@ -79,54 +85,47 @@ let ModalBody = (_dec = withStyle(generateStyle, 'ModalBody'), _dec(_class = (_M
79
85
  if (el.ref) {
80
86
  return this.getFinalRef(el.ref);
81
87
  }
82
- return void 0;
88
+ return undefined;
83
89
  }
84
90
  render() {
85
- var _finalRef$scrollHeigh, _finalRef$getBounding, _finalRef$getBounding2;
86
- const _this$props3 = this.props,
87
- as = _this$props3.as,
88
- elementRef = _this$props3.elementRef,
89
- overflow = _this$props3.overflow,
90
- variant = _this$props3.variant,
91
- padding = _this$props3.padding,
92
- spacing = _this$props3.spacing,
93
- children = _this$props3.children,
94
- rest = _objectWithoutProperties(_this$props3, _excluded);
91
+ const {
92
+ as,
93
+ elementRef,
94
+ overflow,
95
+ variant,
96
+ padding,
97
+ spacing,
98
+ children,
99
+ ...rest
100
+ } = this.props;
95
101
  const passthroughProps = View.omitViewProps(omitProps(rest, ModalBody.allowedProps), ModalBody);
96
102
  const isFit = overflow === 'fit';
97
103
  // this recursive function is needed because `ref` can be a React component.
98
104
  // TODO rethink, the 'as' prop, likely its not a good idea to allow React
99
105
  // components. See INSTUI-4674
100
106
  const finalRef = this.getFinalRef(this.ref);
101
- const hasScrollbar = finalRef && Math.abs(((_finalRef$scrollHeigh = finalRef.scrollHeight) !== null && _finalRef$scrollHeigh !== void 0 ? _finalRef$scrollHeigh : 0) - ((_finalRef$getBounding = (_finalRef$getBounding2 = finalRef.getBoundingClientRect()) === null || _finalRef$getBounding2 === void 0 ? void 0 : _finalRef$getBounding2.height) !== null && _finalRef$getBounding !== void 0 ? _finalRef$getBounding : 0)) > 1;
107
+ const hasScrollbar = finalRef && Math.abs((finalRef.scrollHeight ?? 0) - (finalRef.getBoundingClientRect()?.height ?? 0)) > 1;
102
108
  return _jsx(ModalContext.Consumer, {
103
- children: value => {
104
- var _this$props$styles;
105
- return _jsx(View, {
106
- ...passthroughProps,
107
- display: "block",
108
- "data-cid": "ModalBody",
109
- width: isFit ? '100%' : void 0,
110
- height: isFit ? '100%' : void 0,
111
- elementRef: this.handleRef,
112
- as: as,
113
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.modalBody,
114
- padding: spacing ? void 0 : padding
115
- // check if there is a scrollbar, if so, the element has to be tabbable
116
- ,
117
- ...(hasScrollbar ? {
118
- tabIndex: 0,
119
- 'aria-label': value.bodyScrollAriaLabel
120
- } : {}),
121
- children: children
122
- });
123
- }
109
+ children: value => _jsx(View, {
110
+ ...passthroughProps,
111
+ display: "block",
112
+ "data-cid": "ModalBody",
113
+ width: isFit ? '100%' : undefined,
114
+ height: isFit ? '100%' : undefined,
115
+ elementRef: this.handleRef,
116
+ as: as,
117
+ css: this.props.styles?.modalBody,
118
+ padding: spacing ? undefined : padding
119
+ // check if there is a scrollbar, if so, the element has to be tabbable
120
+ ,
121
+ ...(hasScrollbar ? {
122
+ tabIndex: 0,
123
+ 'aria-label': value.bodyScrollAriaLabel
124
+ } : {}),
125
+ children: children
126
+ })
124
127
  });
125
128
  }
126
- }, _ModalBody.displayName = "ModalBody", _ModalBody.componentId = 'Modal.Body', _ModalBody.allowedProps = allowedProps, _ModalBody.defaultProps = {
127
- padding: 'medium',
128
- as: 'div',
129
- variant: 'default'
130
- }, _ModalBody)) || _class);
129
+ }) || _class);
131
130
  export default ModalBody;
132
131
  export { ModalBody };
@@ -34,8 +34,10 @@
34
34
  * @return {Object} The final style object, which will be used in the component
35
35
  */
36
36
  const generateStyle = (componentTheme, props) => {
37
- const variant = props.variant,
38
- spacing = props.spacing;
37
+ const {
38
+ variant,
39
+ spacing
40
+ } = props;
39
41
  const sizeVariants = {
40
42
  default: {
41
43
  padding: componentTheme.padding
@@ -28,7 +28,7 @@ import { createContext } from 'react';
28
28
  * @private
29
29
  */
30
30
  const ModalContext = /*#__PURE__*/createContext({
31
- bodyScrollAriaLabel: void 0
31
+ bodyScrollAriaLabel: undefined
32
32
  });
33
33
  export default ModalContext;
34
34
  export { ModalContext };
@@ -1,6 +1,4 @@
1
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
- const _excluded = ["children"];
3
- var _dec, _class, _ModalFooter;
1
+ var _dec, _class;
4
2
  /*
5
3
  * The MIT License (MIT)
6
4
  *
@@ -37,37 +35,36 @@ parent: Modal
37
35
  id: Modal.Footer
38
36
  ---
39
37
  **/
40
- let ModalFooter = (_dec = withStyle(generateStyle, 'ModalFooter'), _dec(_class = (_ModalFooter = class ModalFooter extends Component {
41
- constructor(...args) {
42
- super(...args);
43
- this.ref = null;
44
- this.handleRef = el => {
45
- this.ref = el;
46
- };
47
- }
38
+ let ModalFooter = (_dec = withStyle(generateStyle, 'ModalFooter'), _dec(_class = class ModalFooter extends Component {
39
+ static displayName = "ModalFooter";
40
+ static componentId = 'Modal.Footer';
41
+ static allowedProps = allowedProps;
42
+ static defaultProps = {
43
+ variant: 'default'
44
+ };
45
+ ref = null;
46
+ handleRef = el => {
47
+ this.ref = el;
48
+ };
48
49
  componentDidMount() {
49
- var _this$props$makeStyle, _this$props;
50
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
50
+ this.props.makeStyles?.();
51
51
  }
52
52
  componentDidUpdate() {
53
- var _this$props$makeStyle2, _this$props2;
54
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
53
+ this.props.makeStyles?.();
55
54
  }
56
55
  render() {
57
- var _this$props$styles;
58
- const _this$props3 = this.props,
59
- children = _this$props3.children,
60
- rest = _objectWithoutProperties(_this$props3, _excluded);
56
+ const {
57
+ children,
58
+ ...rest
59
+ } = this.props;
61
60
  return _jsx("div", {
62
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.modalFooter,
61
+ css: this.props.styles?.modalFooter,
63
62
  ...passthroughProps(rest),
64
63
  ref: this.handleRef,
65
64
  "data-cid": "ModalFooter",
66
65
  children: children
67
66
  });
68
67
  }
69
- }, _ModalFooter.displayName = "ModalFooter", _ModalFooter.componentId = 'Modal.Footer', _ModalFooter.allowedProps = allowedProps, _ModalFooter.defaultProps = {
70
- variant: 'default'
71
- }, _ModalFooter)) || _class);
68
+ }) || _class);
72
69
  export default ModalFooter;
73
70
  export { ModalFooter };
@@ -34,8 +34,10 @@
34
34
  * @return {Object} The final style object, which will be used in the component
35
35
  */
36
36
  const generateStyle = (componentTheme, props) => {
37
- const variant = props.variant,
38
- spacing = props.spacing;
37
+ const {
38
+ variant,
39
+ spacing
40
+ } = props;
39
41
  const backgroundStyle = variant === 'inverse' ? {
40
42
  background: componentTheme.inverseBackgroundColor,
41
43
  borderTop: `${componentTheme.borderWidth} solid ${componentTheme.inverseBorderColor}`