@atlaskit/modal-dialog 17.2.0 → 17.2.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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/modal-dialog
2
2
 
3
+ ## 17.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`6a5baf4c2b1ac`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6a5baf4c2b1ac) -
8
+ Behind `platform-dst-top-layer`, a modal with no `height` sizes to its content again. Before, a
9
+ child with `flex: 1` collapsed the modal to 0px.
10
+
11
+ ## 17.2.1
12
+
13
+ ### Patch Changes
14
+
15
+ - [`c7a4861c669f1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c7a4861c669f1) -
16
+ Behind `platform-dst-top-layer`, the modal fits the viewport and a full-screen modal fills it.
17
+
3
18
  ## 17.2.0
4
19
 
5
20
  ### Minor Changes
@@ -1,9 +1,10 @@
1
1
  import { type JSCodeshift } from 'jscodeshift';
2
2
  import { type Collection } from 'jscodeshift/src/Collection';
3
3
 
4
+ import { getJSXAttributesByName } from '@atlaskit/codemod-utils/support';
5
+
4
6
  import { addCommentToStartOfFile } from './add-comment-to-start-of-file';
5
7
  import { getDefaultSpecifier } from './get-default-specifier';
6
- import { getJSXAttributesByName } from './get-jsx-attributes-by-name';
7
8
  import { getNamedSpecifier } from './get-named-specifier';
8
9
 
9
10
  export const createRemoveFuncIfBooleanFor: (
@@ -1,8 +1,9 @@
1
1
  import { type JSCodeshift, type VariableDeclaration } from 'jscodeshift';
2
2
  import { type Collection } from 'jscodeshift/src/Collection';
3
3
 
4
+ import { getJSXAttributesByName } from '@atlaskit/codemod-utils/support';
5
+
4
6
  import { findIdentifierAndReplaceAttribute } from './find-identifier-and-replace-attribute';
5
- import { getJSXAttributesByName } from './get-jsx-attributes-by-name';
6
7
  import { getNamedSpecifier } from './get-named-specifier';
7
8
  import { hasVariableAssignment } from './has-variable-assignment';
8
9
 
@@ -51,8 +51,8 @@ var ModalDialog = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
51
51
  shouldScrollInViewport = _props$shouldScrollIn === void 0 ? false : _props$shouldScrollIn,
52
52
  shouldCloseOnEscapePress = props.shouldCloseOnEscapePress,
53
53
  autoFocus = props.autoFocus,
54
- _props$UNSAFE__disabl = props.UNSAFE__disableAutoFocusForAsyncWrapper,
55
- UNSAFE__disableAutoFocusForAsyncWrapper = _props$UNSAFE__disabl === void 0 ? false : _props$UNSAFE__disabl,
54
+ _props$UNSAFE__disabl = props.UNSAFE__disableInitialAutoFocus,
55
+ UNSAFE__disableInitialAutoFocus = _props$UNSAFE__disabl === void 0 ? false : _props$UNSAFE__disabl,
56
56
  stackIndex = props.stackIndex,
57
57
  onClose = props.onClose,
58
58
  onCloseComplete = props.onCloseComplete,
@@ -84,7 +84,7 @@ var ModalDialog = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
84
84
  }, []);
85
85
  (0, _useAutoFocus.default)(autoFocus,
86
86
  // When a user supplies a ref to focus we enable this hook
87
- (0, _typeof2.default)(autoFocus) === 'object' && !UNSAFE__disableAutoFocusForAsyncWrapper);
87
+ (0, _typeof2.default)(autoFocus) === 'object' && !UNSAFE__disableInitialAutoFocus);
88
88
  var _useOnMotionFinish = (0, _useOnMotionFinish3.default)({
89
89
  onOpenComplete: onOpenComplete,
90
90
  onCloseComplete: onCloseComplete
@@ -7,21 +7,25 @@
7
7
  ._1bsbauwl{width:100vw}
8
8
  ._1dg11kw7>form:only-child{flex-direction:inherit}
9
9
  ._1e02ze3t{inset-inline-start:var(--ds-space-0,0)}
10
+ ._1e0c11p5{display:grid}
10
11
  ._1e0c1txw{display:flex}
11
12
  ._1mq81kw7>form:only-child{display:inherit}
12
13
  ._1q1l1bhr{--ds-elevation-surface-current:var(--ds-surface-overlay,#fff)}
13
14
  ._1reoewfl{overflow-x:visible}
14
15
  ._2hwxidpf{margin-right:0}
15
16
  ._2lx21bp4{flex-direction:column}
17
+ ._2z05i47z{grid-template-rows:minmax(0,1fr)}
16
18
  ._4t3i1kxc{height:100vh}
17
19
  ._8am5i4x0{-webkit-overflow-scrolling:touch}
18
20
  ._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
21
+ ._ds62idpf>form:only-child{min-height:0}
19
22
  ._kqsw1n9t{position:fixed}
20
23
  ._lcxv1wug{pointer-events:auto}
24
+ ._lcxvglyw{pointer-events:none}
21
25
  ._ln19p27b{scrollbar-gutter:stable}
22
26
  ._m01u1kw7>form:only-child{max-height:inherit}
23
27
  ._otyridpf{margin-bottom:0}._128mdkaa:focus-visible{outline-width:var(--ds-border-width-focused,2px)}
24
28
  ._1ah3dkaa:focus-visible{outline-offset:var(--ds-border-width-focused,2px)}
25
29
  ._mizu1v1w:focus-visible{outline-color:var(--ds-border-focused,#4688ec)}
26
30
  ._ra3xnqa1:focus-visible{outline-style:solid}
27
- @media (min-width:30rem){._1jyk17ks{height:var(--modal-dialog-height)}._g7116m9r{width:var(--modal-dialog-width)}._we1i18uh{max-width:calc(100vw - 90pt)}._1sg41wqb{margin-top:60px}._maxs1wug{margin-right:auto}._1jvh1wqb{margin-bottom:60px}._1uca1wug{margin-left:auto}._1mpv184x{min-height:min-content}._e8uo1ris{max-height:max-content}._epkxpb1k{border-radius:var(--ds-radius-xlarge,9pt)}._zg7p130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}}
31
+ @media (min-width:30rem){._1jyk17ks{height:var(--modal-dialog-height)}._g7116m9r{width:var(--modal-dialog-width)}._we1i18uh{max-width:calc(100vw - 90pt)}._e8uo221b{max-height:calc(100vh - 90pt)}._1sg41wqb{margin-top:60px}._maxs1wug{margin-right:auto}._1jvh1wqb{margin-bottom:60px}._1uca1wug{margin-left:auto}._1mpv184x{min-height:min-content}._epkxpb1k{border-radius:var(--ds-radius-xlarge,9pt)}._zg7p130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}}
@@ -43,6 +43,7 @@ var _scrollContext = require("../scroll-context");
43
43
  var _width = require("../width");
44
44
  var _modalDialog = _interopRequireDefault(require("./modal-dialog"));
45
45
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
46
+ // eslint-disable-next-line @atlaskit/design-system/no-third-party-focus-traps -- existing usage from before this rule was added
46
47
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-atlaskit-theme
47
48
  var fillScreenStyles = null;
48
49
 
@@ -52,7 +53,7 @@ var fillScreenStyles = null;
52
53
  var dialogStyles = {
53
54
  'body-scroll': "_1reoewfl _18m9ewfl _19pkidpf _2hwxidpf _otyridpf _18u0idpf _1sg41wqb _maxs1wug _1jvh1wqb _1uca1wug",
54
55
  'viewport-scroll': "_ln19p27b _1bsbauwl _4t3i1kxc",
55
- 'full-screen': ""
56
+ 'full-screen': "_1bsbauwl _4t3i1kxc"
56
57
  };
57
58
 
58
59
  // Visual styles for modal content inside native <dialog>.
@@ -64,15 +65,25 @@ var LOCAL_CURRENT_SURFACE_CSS_VAR = '--ds-elevation-surface-current';
64
65
  * Styles applied to the visual modal surface.
65
66
  */
66
67
  var surfaceStyles = {
67
- root: "_1e0c1txw _2lx21bp4 _bfhk1bhr _1q1l1bhr _lcxv1wug _1mq81kw7 _m01u1kw7 _1dg11kw7 _mizu1v1w _1ah3dkaa _ra3xnqa1 _128mdkaa _zg7p130s",
68
+ root: "_1e0c1txw _2lx21bp4 _bfhk1bhr _1q1l1bhr _lcxv1wug _1mq81kw7 _m01u1kw7 _ds62idpf _1dg11kw7 _mizu1v1w _1ah3dkaa _ra3xnqa1 _128mdkaa _zg7p130s",
68
69
  borderRadius: "_2rkoidpf _epkxpb1k"
69
70
  };
70
71
  var topLayerScrollModeStyles = {
71
72
  'full-screen': "_1bsbauwl _4t3i1kxc _kqsw1n9t _152tze3t _1e02ze3t _18m91wug _8am5i4x0",
72
73
  'viewport-scroll': "_4t3i1kxc _1sg41wqb _maxs1wug _1jvh1wqb _1uca1wug _1mpv184x _1jyk17ks _g7116m9r _we1i18uh",
73
- 'body-scroll': "_1bsbauwl _4t3i1kxc _1jyk17ks _g7116m9r _we1i18uh"
74
+ 'body-scroll': "_1bsbauwl _4t3i1kxc _1jyk17ks _g7116m9r _we1i18uh _e8uo221b"
75
+ };
76
+
77
+ /**
78
+ * Sizing container around the surface. As a stretched grid item, the surface sizes to its content
79
+ * and has a definite height. A fixed height with `max-height: max-content` collapses with a
80
+ * `flex: 1` child. `pointer-events: none` keeps presses beside the surface as backdrop presses.
81
+ */
82
+ var sizingContainerStyles = {
83
+ 'body-scroll': "_1e0c11p5 _2z05i47z _lcxvglyw _e8uo221b",
84
+ 'viewport-scroll': "_1e0c11p5 _lcxvglyw",
85
+ 'full-screen': "_1e0c11p5 _lcxvglyw"
74
86
  };
75
- var topLayerAutoHeightStyles = null;
76
87
  var allowlistElements = function allowlistElements(element, callback) {
77
88
  // Allow focus outside modal when AUI dialog is visible
78
89
  // eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- legacy FocusLock allowlist
@@ -94,7 +105,7 @@ function useModalCloseHandler(providedOnClose) {
94
105
  action: 'closed',
95
106
  componentName: 'modalDialog',
96
107
  packageName: "@atlaskit/modal-dialog",
97
- packageVersion: "17.1.2"
108
+ packageVersion: "17.2.1"
98
109
  });
99
110
  }
100
111
  function getScrollMode(_ref) {
@@ -133,11 +144,9 @@ function getTopLayerSurfaceWidth(input) {
133
144
  }
134
145
  function getTopLayerSurfaceHeight(input) {
135
146
  if (!input) {
136
- // Although this value would ordinarily fill the viewport height,
137
- // there is also a `max-height: max-content` applied to keep it constrained.
138
- // But we need to provide the modal with a fixed height (non-keyword, non-percentage)
139
- // in order for child elements with 100% height to work correctly.
140
- return 'calc(100vh - 120px)';
147
+ // Size to the content. The sizing container gives the surface a definite height, so
148
+ // children with `height: 100%` still fill it. See `sizingContainerStyles`.
149
+ return 'auto';
141
150
  }
142
151
  if (typeof input === 'number') {
143
152
  return "".concat(input, "px");
@@ -190,7 +199,7 @@ function getDismissedBy(_ref2) {
190
199
  */
191
200
  function ModalWrapperTopLayer(props) {
192
201
  var autoFocus = props.autoFocus,
193
- UNSAFE__disableAutoFocusForAsyncWrapper = props.UNSAFE__disableAutoFocusForAsyncWrapper,
202
+ UNSAFE__disableInitialAutoFocus = props.UNSAFE__disableInitialAutoFocus,
194
203
  _props$shouldCloseOnE = props.shouldCloseOnEscapePress,
195
204
  shouldCloseOnEscapePress = _props$shouldCloseOnE === void 0 ? true : _props$shouldCloseOnE,
196
205
  _props$shouldCloseOnO = props.shouldCloseOnOverlayClick,
@@ -318,7 +327,7 @@ function ModalWrapperTopLayer(props) {
318
327
 
319
328
  // Focus a ref-targeted element after mount (when autoFocus is a ref).
320
329
  // When true, native <dialog>.showModal() handles focus automatically.
321
- (0, _useAutoFocus.default)((0, _typeof2.default)(autoFocus) === 'object' ? autoFocus : undefined, (0, _typeof2.default)(autoFocus) === 'object' && !UNSAFE__disableAutoFocusForAsyncWrapper);
330
+ (0, _useAutoFocus.default)((0, _typeof2.default)(autoFocus) === 'object' ? autoFocus : undefined, (0, _typeof2.default)(autoFocus) === 'object' && !UNSAFE__disableInitialAutoFocus);
322
331
 
323
332
  // Chrome cross-origin iframe DnD workaround (crbug.com/362301053)
324
333
  (0, _react.useEffect)(function () {
@@ -352,17 +361,19 @@ function ModalWrapperTopLayer(props) {
352
361
  }), /*#__PURE__*/React.createElement(_dialogScrollLock.DialogScrollLock, {
353
362
  isOpen: true
354
363
  }), /*#__PURE__*/React.createElement("div", {
364
+ className: (0, _runtime.ax)([sizingContainerStyles[scrollMode]])
365
+ }, /*#__PURE__*/React.createElement("div", {
355
366
  ref: contentRef,
356
367
  style: {
357
368
  '--modal-dialog-height': getTopLayerSurfaceHeight(height),
358
369
  '--modal-dialog-width': getTopLayerSurfaceWidth(width)
359
370
  },
360
- className: (0, _runtime.ax)([surfaceStyles.root, !isFullScreen && surfaceStyles.borderRadius, topLayerScrollModeStyles[scrollMode], !height && !isFullScreen && "_e8uo1ris"])
371
+ className: (0, _runtime.ax)([surfaceStyles.root, !isFullScreen && surfaceStyles.borderRadius, topLayerScrollModeStyles[scrollMode]])
361
372
  }, /*#__PURE__*/React.createElement(_context.ModalContext.Provider, {
362
373
  value: modalDialogContext
363
374
  }, /*#__PURE__*/React.createElement(_scrollContext.ScrollContext.Provider, {
364
375
  value: shouldScrollInViewport
365
- }, /*#__PURE__*/React.createElement(_motionPresenceBoundary.default, null, children)))));
376
+ }, /*#__PURE__*/React.createElement(_motionPresenceBoundary.default, null, children))))));
366
377
  }
367
378
 
368
379
  /**
@@ -373,8 +384,8 @@ function ModalWrapperTopLayer(props) {
373
384
  */
374
385
  var ModalWrapperLegacy = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
375
386
  var autoFocus = props.autoFocus,
376
- _props$UNSAFE__disabl = props.UNSAFE__disableAutoFocusForAsyncWrapper,
377
- UNSAFE__disableAutoFocusForAsyncWrapper = _props$UNSAFE__disabl === void 0 ? false : _props$UNSAFE__disabl,
387
+ _props$UNSAFE__disabl = props.UNSAFE__disableInitialAutoFocus,
388
+ UNSAFE__disableInitialAutoFocus = _props$UNSAFE__disabl === void 0 ? false : _props$UNSAFE__disabl,
378
389
  focusLockAllowlist = props.focusLockAllowlist,
379
390
  _props$shouldCloseOnE2 = props.shouldCloseOnEscapePress,
380
391
  shouldCloseOnEscapePress = _props$shouldCloseOnE2 === void 0 ? true : _props$shouldCloseOnE2,
@@ -406,7 +417,7 @@ var ModalWrapperLegacy = /*#__PURE__*/(0, _react.forwardRef)(function (props, re
406
417
  var isForeground = stackIndex === 0;
407
418
 
408
419
  // If no ref is provided, autofocus on first element
409
- var autoFocusLock = !UNSAFE__disableAutoFocusForAsyncWrapper && !((0, _typeof2.default)(autoFocus) === 'object');
420
+ var autoFocusLock = !UNSAFE__disableInitialAutoFocus && !((0, _typeof2.default)(autoFocus) === 'object');
410
421
  var onCloseHandler = useModalCloseHandler(providedOnClose);
411
422
  var onBlanketClicked = (0, _react.useCallback)(function (e) {
412
423
  if (shouldCloseOnOverlayClick) {
@@ -39,7 +39,7 @@ const ModalDialog = /*#__PURE__*/forwardRef((props, ref) => {
39
39
  shouldScrollInViewport = false,
40
40
  shouldCloseOnEscapePress,
41
41
  autoFocus,
42
- UNSAFE__disableAutoFocusForAsyncWrapper = false,
42
+ UNSAFE__disableInitialAutoFocus = false,
43
43
  stackIndex,
44
44
  onClose,
45
45
  onCloseComplete,
@@ -67,7 +67,7 @@ const ModalDialog = /*#__PURE__*/forwardRef((props, ref) => {
67
67
  combine(disableDraggingToCrossOriginIFramesForElement(), disableDraggingToCrossOriginIFramesForTextSelection(), disableDraggingToCrossOriginIFramesForExternal()), []);
68
68
  useAutoFocus(autoFocus,
69
69
  // When a user supplies a ref to focus we enable this hook
70
- typeof autoFocus === 'object' && !UNSAFE__disableAutoFocusForAsyncWrapper);
70
+ typeof autoFocus === 'object' && !UNSAFE__disableInitialAutoFocus);
71
71
  const [motionRef, onMotionFinish] = useOnMotionFinish({
72
72
  onOpenComplete,
73
73
  onCloseComplete
@@ -7,21 +7,25 @@
7
7
  ._1bsbauwl{width:100vw}
8
8
  ._1dg11kw7>form:only-child{flex-direction:inherit}
9
9
  ._1e02ze3t{inset-inline-start:var(--ds-space-0,0)}
10
+ ._1e0c11p5{display:grid}
10
11
  ._1e0c1txw{display:flex}
11
12
  ._1mq81kw7>form:only-child{display:inherit}
12
13
  ._1q1l1bhr{--ds-elevation-surface-current:var(--ds-surface-overlay,#fff)}
13
14
  ._1reoewfl{overflow-x:visible}
14
15
  ._2hwxidpf{margin-right:0}
15
16
  ._2lx21bp4{flex-direction:column}
17
+ ._2z05i47z{grid-template-rows:minmax(0,1fr)}
16
18
  ._4t3i1kxc{height:100vh}
17
19
  ._8am5i4x0{-webkit-overflow-scrolling:touch}
18
20
  ._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
21
+ ._ds62idpf>form:only-child{min-height:0}
19
22
  ._kqsw1n9t{position:fixed}
20
23
  ._lcxv1wug{pointer-events:auto}
24
+ ._lcxvglyw{pointer-events:none}
21
25
  ._ln19p27b{scrollbar-gutter:stable}
22
26
  ._m01u1kw7>form:only-child{max-height:inherit}
23
27
  ._otyridpf{margin-bottom:0}._128mdkaa:focus-visible{outline-width:var(--ds-border-width-focused,2px)}
24
28
  ._1ah3dkaa:focus-visible{outline-offset:var(--ds-border-width-focused,2px)}
25
29
  ._mizu1v1w:focus-visible{outline-color:var(--ds-border-focused,#4688ec)}
26
30
  ._ra3xnqa1:focus-visible{outline-style:solid}
27
- @media (min-width:30rem){._1jyk17ks{height:var(--modal-dialog-height)}._g7116m9r{width:var(--modal-dialog-width)}._we1i18uh{max-width:calc(100vw - 90pt)}._1sg41wqb{margin-top:60px}._maxs1wug{margin-right:auto}._1jvh1wqb{margin-bottom:60px}._1uca1wug{margin-left:auto}._1mpv184x{min-height:min-content}._e8uo1ris{max-height:max-content}._epkxpb1k{border-radius:var(--ds-radius-xlarge,9pt)}._zg7p130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}}
31
+ @media (min-width:30rem){._1jyk17ks{height:var(--modal-dialog-height)}._g7116m9r{width:var(--modal-dialog-width)}._we1i18uh{max-width:calc(100vw - 90pt)}._e8uo221b{max-height:calc(100vh - 90pt)}._1sg41wqb{margin-top:60px}._maxs1wug{margin-right:auto}._1jvh1wqb{margin-bottom:60px}._1uca1wug{margin-left:auto}._1mpv184x{min-height:min-content}._epkxpb1k{border-radius:var(--ds-radius-xlarge,9pt)}._zg7p130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}}
@@ -4,6 +4,7 @@ import "./modal-wrapper.compiled.css";
4
4
  import * as React from 'react';
5
5
  import { ax, ix } from "@compiled/react/runtime";
6
6
  import { forwardRef, useCallback, useEffect, useMemo, useRef } from 'react';
7
+ // eslint-disable-next-line @atlaskit/design-system/no-third-party-focus-traps -- existing usage from before this rule was added
7
8
  import FocusLock from 'react-focus-lock';
8
9
  import ScrollLock, { TouchScrollable } from 'react-scrolllock';
9
10
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
@@ -42,7 +43,7 @@ const fillScreenStyles = null;
42
43
  const dialogStyles = {
43
44
  'body-scroll': "_1reoewfl _18m9ewfl _19pkidpf _2hwxidpf _otyridpf _18u0idpf _1sg41wqb _maxs1wug _1jvh1wqb _1uca1wug",
44
45
  'viewport-scroll': "_ln19p27b _1bsbauwl _4t3i1kxc",
45
- 'full-screen': ""
46
+ 'full-screen': "_1bsbauwl _4t3i1kxc"
46
47
  };
47
48
 
48
49
  // Visual styles for modal content inside native <dialog>.
@@ -54,15 +55,25 @@ const LOCAL_CURRENT_SURFACE_CSS_VAR = '--ds-elevation-surface-current';
54
55
  * Styles applied to the visual modal surface.
55
56
  */
56
57
  const surfaceStyles = {
57
- root: "_1e0c1txw _2lx21bp4 _bfhk1bhr _1q1l1bhr _lcxv1wug _1mq81kw7 _m01u1kw7 _1dg11kw7 _mizu1v1w _1ah3dkaa _ra3xnqa1 _128mdkaa _zg7p130s",
58
+ root: "_1e0c1txw _2lx21bp4 _bfhk1bhr _1q1l1bhr _lcxv1wug _1mq81kw7 _m01u1kw7 _ds62idpf _1dg11kw7 _mizu1v1w _1ah3dkaa _ra3xnqa1 _128mdkaa _zg7p130s",
58
59
  borderRadius: "_2rkoidpf _epkxpb1k"
59
60
  };
60
61
  const topLayerScrollModeStyles = {
61
62
  'full-screen': "_1bsbauwl _4t3i1kxc _kqsw1n9t _152tze3t _1e02ze3t _18m91wug _8am5i4x0",
62
63
  'viewport-scroll': "_4t3i1kxc _1sg41wqb _maxs1wug _1jvh1wqb _1uca1wug _1mpv184x _1jyk17ks _g7116m9r _we1i18uh",
63
- 'body-scroll': "_1bsbauwl _4t3i1kxc _1jyk17ks _g7116m9r _we1i18uh"
64
+ 'body-scroll': "_1bsbauwl _4t3i1kxc _1jyk17ks _g7116m9r _we1i18uh _e8uo221b"
65
+ };
66
+
67
+ /**
68
+ * Sizing container around the surface. As a stretched grid item, the surface sizes to its content
69
+ * and has a definite height. A fixed height with `max-height: max-content` collapses with a
70
+ * `flex: 1` child. `pointer-events: none` keeps presses beside the surface as backdrop presses.
71
+ */
72
+ const sizingContainerStyles = {
73
+ 'body-scroll': "_1e0c11p5 _2z05i47z _lcxvglyw _e8uo221b",
74
+ 'viewport-scroll': "_1e0c11p5 _lcxvglyw",
75
+ 'full-screen': "_1e0c11p5 _lcxvglyw"
64
76
  };
65
- const topLayerAutoHeightStyles = null;
66
77
  const allowlistElements = (element, callback) => {
67
78
  // Allow focus outside modal when AUI dialog is visible
68
79
  // eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- legacy FocusLock allowlist
@@ -84,7 +95,7 @@ function useModalCloseHandler(providedOnClose) {
84
95
  action: 'closed',
85
96
  componentName: 'modalDialog',
86
97
  packageName: "@atlaskit/modal-dialog",
87
- packageVersion: "17.1.2"
98
+ packageVersion: "17.2.1"
88
99
  });
89
100
  }
90
101
  function getScrollMode({
@@ -124,11 +135,9 @@ function getTopLayerSurfaceWidth(input) {
124
135
  }
125
136
  function getTopLayerSurfaceHeight(input) {
126
137
  if (!input) {
127
- // Although this value would ordinarily fill the viewport height,
128
- // there is also a `max-height: max-content` applied to keep it constrained.
129
- // But we need to provide the modal with a fixed height (non-keyword, non-percentage)
130
- // in order for child elements with 100% height to work correctly.
131
- return 'calc(100vh - 120px)';
138
+ // Size to the content. The sizing container gives the surface a definite height, so
139
+ // children with `height: 100%` still fill it. See `sizingContainerStyles`.
140
+ return 'auto';
132
141
  }
133
142
  if (typeof input === 'number') {
134
143
  return `${input}px`;
@@ -183,7 +192,7 @@ function getDismissedBy({
183
192
  function ModalWrapperTopLayer(props) {
184
193
  const {
185
194
  autoFocus,
186
- UNSAFE__disableAutoFocusForAsyncWrapper,
195
+ UNSAFE__disableInitialAutoFocus,
187
196
  shouldCloseOnEscapePress = true,
188
197
  shouldCloseOnOverlayClick = true,
189
198
  shouldScrollInViewport = false,
@@ -306,7 +315,7 @@ function ModalWrapperTopLayer(props) {
306
315
 
307
316
  // Focus a ref-targeted element after mount (when autoFocus is a ref).
308
317
  // When true, native <dialog>.showModal() handles focus automatically.
309
- useAutoFocus(typeof autoFocus === 'object' ? autoFocus : undefined, typeof autoFocus === 'object' && !UNSAFE__disableAutoFocusForAsyncWrapper);
318
+ useAutoFocus(typeof autoFocus === 'object' ? autoFocus : undefined, typeof autoFocus === 'object' && !UNSAFE__disableInitialAutoFocus);
310
319
 
311
320
  // Chrome cross-origin iframe DnD workaround (crbug.com/362301053)
312
321
  useEffect(() => {
@@ -340,17 +349,19 @@ function ModalWrapperTopLayer(props) {
340
349
  }), /*#__PURE__*/React.createElement(DialogScrollLock, {
341
350
  isOpen: true
342
351
  }), /*#__PURE__*/React.createElement("div", {
352
+ className: ax([sizingContainerStyles[scrollMode]])
353
+ }, /*#__PURE__*/React.createElement("div", {
343
354
  ref: contentRef,
344
355
  style: {
345
356
  '--modal-dialog-height': getTopLayerSurfaceHeight(height),
346
357
  '--modal-dialog-width': getTopLayerSurfaceWidth(width)
347
358
  },
348
- className: ax([surfaceStyles.root, !isFullScreen && surfaceStyles.borderRadius, topLayerScrollModeStyles[scrollMode], !height && !isFullScreen && "_e8uo1ris"])
359
+ className: ax([surfaceStyles.root, !isFullScreen && surfaceStyles.borderRadius, topLayerScrollModeStyles[scrollMode]])
349
360
  }, /*#__PURE__*/React.createElement(ModalContext.Provider, {
350
361
  value: modalDialogContext
351
362
  }, /*#__PURE__*/React.createElement(ScrollContext.Provider, {
352
363
  value: shouldScrollInViewport
353
- }, /*#__PURE__*/React.createElement(MotionPresenceBoundary, null, children)))));
364
+ }, /*#__PURE__*/React.createElement(MotionPresenceBoundary, null, children))))));
354
365
  }
355
366
 
356
367
  /**
@@ -362,7 +373,7 @@ function ModalWrapperTopLayer(props) {
362
373
  const ModalWrapperLegacy = /*#__PURE__*/forwardRef((props, ref) => {
363
374
  const {
364
375
  autoFocus,
365
- UNSAFE__disableAutoFocusForAsyncWrapper = false,
376
+ UNSAFE__disableInitialAutoFocus = false,
366
377
  focusLockAllowlist,
367
378
  shouldCloseOnEscapePress = true,
368
379
  shouldCloseOnOverlayClick = true,
@@ -389,7 +400,7 @@ const ModalWrapperLegacy = /*#__PURE__*/forwardRef((props, ref) => {
389
400
  const isForeground = stackIndex === 0;
390
401
 
391
402
  // If no ref is provided, autofocus on first element
392
- const autoFocusLock = !UNSAFE__disableAutoFocusForAsyncWrapper && !(typeof autoFocus === 'object');
403
+ const autoFocusLock = !UNSAFE__disableInitialAutoFocus && !(typeof autoFocus === 'object');
393
404
  const onCloseHandler = useModalCloseHandler(providedOnClose);
394
405
  const onBlanketClicked = useCallback(e => {
395
406
  if (shouldCloseOnOverlayClick) {
@@ -42,8 +42,8 @@ var ModalDialog = /*#__PURE__*/forwardRef(function (props, ref) {
42
42
  shouldScrollInViewport = _props$shouldScrollIn === void 0 ? false : _props$shouldScrollIn,
43
43
  shouldCloseOnEscapePress = props.shouldCloseOnEscapePress,
44
44
  autoFocus = props.autoFocus,
45
- _props$UNSAFE__disabl = props.UNSAFE__disableAutoFocusForAsyncWrapper,
46
- UNSAFE__disableAutoFocusForAsyncWrapper = _props$UNSAFE__disabl === void 0 ? false : _props$UNSAFE__disabl,
45
+ _props$UNSAFE__disabl = props.UNSAFE__disableInitialAutoFocus,
46
+ UNSAFE__disableInitialAutoFocus = _props$UNSAFE__disabl === void 0 ? false : _props$UNSAFE__disabl,
47
47
  stackIndex = props.stackIndex,
48
48
  onClose = props.onClose,
49
49
  onCloseComplete = props.onCloseComplete,
@@ -75,7 +75,7 @@ var ModalDialog = /*#__PURE__*/forwardRef(function (props, ref) {
75
75
  }, []);
76
76
  useAutoFocus(autoFocus,
77
77
  // When a user supplies a ref to focus we enable this hook
78
- _typeof(autoFocus) === 'object' && !UNSAFE__disableAutoFocusForAsyncWrapper);
78
+ _typeof(autoFocus) === 'object' && !UNSAFE__disableInitialAutoFocus);
79
79
  var _useOnMotionFinish = useOnMotionFinish({
80
80
  onOpenComplete: onOpenComplete,
81
81
  onCloseComplete: onCloseComplete
@@ -7,21 +7,25 @@
7
7
  ._1bsbauwl{width:100vw}
8
8
  ._1dg11kw7>form:only-child{flex-direction:inherit}
9
9
  ._1e02ze3t{inset-inline-start:var(--ds-space-0,0)}
10
+ ._1e0c11p5{display:grid}
10
11
  ._1e0c1txw{display:flex}
11
12
  ._1mq81kw7>form:only-child{display:inherit}
12
13
  ._1q1l1bhr{--ds-elevation-surface-current:var(--ds-surface-overlay,#fff)}
13
14
  ._1reoewfl{overflow-x:visible}
14
15
  ._2hwxidpf{margin-right:0}
15
16
  ._2lx21bp4{flex-direction:column}
17
+ ._2z05i47z{grid-template-rows:minmax(0,1fr)}
16
18
  ._4t3i1kxc{height:100vh}
17
19
  ._8am5i4x0{-webkit-overflow-scrolling:touch}
18
20
  ._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
21
+ ._ds62idpf>form:only-child{min-height:0}
19
22
  ._kqsw1n9t{position:fixed}
20
23
  ._lcxv1wug{pointer-events:auto}
24
+ ._lcxvglyw{pointer-events:none}
21
25
  ._ln19p27b{scrollbar-gutter:stable}
22
26
  ._m01u1kw7>form:only-child{max-height:inherit}
23
27
  ._otyridpf{margin-bottom:0}._128mdkaa:focus-visible{outline-width:var(--ds-border-width-focused,2px)}
24
28
  ._1ah3dkaa:focus-visible{outline-offset:var(--ds-border-width-focused,2px)}
25
29
  ._mizu1v1w:focus-visible{outline-color:var(--ds-border-focused,#4688ec)}
26
30
  ._ra3xnqa1:focus-visible{outline-style:solid}
27
- @media (min-width:30rem){._1jyk17ks{height:var(--modal-dialog-height)}._g7116m9r{width:var(--modal-dialog-width)}._we1i18uh{max-width:calc(100vw - 90pt)}._1sg41wqb{margin-top:60px}._maxs1wug{margin-right:auto}._1jvh1wqb{margin-bottom:60px}._1uca1wug{margin-left:auto}._1mpv184x{min-height:min-content}._e8uo1ris{max-height:max-content}._epkxpb1k{border-radius:var(--ds-radius-xlarge,9pt)}._zg7p130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}}
31
+ @media (min-width:30rem){._1jyk17ks{height:var(--modal-dialog-height)}._g7116m9r{width:var(--modal-dialog-width)}._we1i18uh{max-width:calc(100vw - 90pt)}._e8uo221b{max-height:calc(100vh - 90pt)}._1sg41wqb{margin-top:60px}._maxs1wug{margin-right:auto}._1jvh1wqb{margin-bottom:60px}._1uca1wug{margin-left:auto}._1mpv184x{min-height:min-content}._epkxpb1k{border-radius:var(--ds-radius-xlarge,9pt)}._zg7p130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}}
@@ -5,6 +5,7 @@ import "./modal-wrapper.compiled.css";
5
5
  import * as React from 'react';
6
6
  import { ax, ix } from "@compiled/react/runtime";
7
7
  import { forwardRef, useCallback, useEffect, useMemo, useRef } from 'react';
8
+ // eslint-disable-next-line @atlaskit/design-system/no-third-party-focus-traps -- existing usage from before this rule was added
8
9
  import FocusLock from 'react-focus-lock';
9
10
  import ScrollLock, { TouchScrollable } from 'react-scrolllock';
10
11
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
@@ -43,7 +44,7 @@ var fillScreenStyles = null;
43
44
  var dialogStyles = {
44
45
  'body-scroll': "_1reoewfl _18m9ewfl _19pkidpf _2hwxidpf _otyridpf _18u0idpf _1sg41wqb _maxs1wug _1jvh1wqb _1uca1wug",
45
46
  'viewport-scroll': "_ln19p27b _1bsbauwl _4t3i1kxc",
46
- 'full-screen': ""
47
+ 'full-screen': "_1bsbauwl _4t3i1kxc"
47
48
  };
48
49
 
49
50
  // Visual styles for modal content inside native <dialog>.
@@ -55,15 +56,25 @@ var LOCAL_CURRENT_SURFACE_CSS_VAR = '--ds-elevation-surface-current';
55
56
  * Styles applied to the visual modal surface.
56
57
  */
57
58
  var surfaceStyles = {
58
- root: "_1e0c1txw _2lx21bp4 _bfhk1bhr _1q1l1bhr _lcxv1wug _1mq81kw7 _m01u1kw7 _1dg11kw7 _mizu1v1w _1ah3dkaa _ra3xnqa1 _128mdkaa _zg7p130s",
59
+ root: "_1e0c1txw _2lx21bp4 _bfhk1bhr _1q1l1bhr _lcxv1wug _1mq81kw7 _m01u1kw7 _ds62idpf _1dg11kw7 _mizu1v1w _1ah3dkaa _ra3xnqa1 _128mdkaa _zg7p130s",
59
60
  borderRadius: "_2rkoidpf _epkxpb1k"
60
61
  };
61
62
  var topLayerScrollModeStyles = {
62
63
  'full-screen': "_1bsbauwl _4t3i1kxc _kqsw1n9t _152tze3t _1e02ze3t _18m91wug _8am5i4x0",
63
64
  'viewport-scroll': "_4t3i1kxc _1sg41wqb _maxs1wug _1jvh1wqb _1uca1wug _1mpv184x _1jyk17ks _g7116m9r _we1i18uh",
64
- 'body-scroll': "_1bsbauwl _4t3i1kxc _1jyk17ks _g7116m9r _we1i18uh"
65
+ 'body-scroll': "_1bsbauwl _4t3i1kxc _1jyk17ks _g7116m9r _we1i18uh _e8uo221b"
66
+ };
67
+
68
+ /**
69
+ * Sizing container around the surface. As a stretched grid item, the surface sizes to its content
70
+ * and has a definite height. A fixed height with `max-height: max-content` collapses with a
71
+ * `flex: 1` child. `pointer-events: none` keeps presses beside the surface as backdrop presses.
72
+ */
73
+ var sizingContainerStyles = {
74
+ 'body-scroll': "_1e0c11p5 _2z05i47z _lcxvglyw _e8uo221b",
75
+ 'viewport-scroll': "_1e0c11p5 _lcxvglyw",
76
+ 'full-screen': "_1e0c11p5 _lcxvglyw"
65
77
  };
66
- var topLayerAutoHeightStyles = null;
67
78
  var allowlistElements = function allowlistElements(element, callback) {
68
79
  // Allow focus outside modal when AUI dialog is visible
69
80
  // eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- legacy FocusLock allowlist
@@ -85,7 +96,7 @@ function useModalCloseHandler(providedOnClose) {
85
96
  action: 'closed',
86
97
  componentName: 'modalDialog',
87
98
  packageName: "@atlaskit/modal-dialog",
88
- packageVersion: "17.1.2"
99
+ packageVersion: "17.2.1"
89
100
  });
90
101
  }
91
102
  function getScrollMode(_ref) {
@@ -124,11 +135,9 @@ function getTopLayerSurfaceWidth(input) {
124
135
  }
125
136
  function getTopLayerSurfaceHeight(input) {
126
137
  if (!input) {
127
- // Although this value would ordinarily fill the viewport height,
128
- // there is also a `max-height: max-content` applied to keep it constrained.
129
- // But we need to provide the modal with a fixed height (non-keyword, non-percentage)
130
- // in order for child elements with 100% height to work correctly.
131
- return 'calc(100vh - 120px)';
138
+ // Size to the content. The sizing container gives the surface a definite height, so
139
+ // children with `height: 100%` still fill it. See `sizingContainerStyles`.
140
+ return 'auto';
132
141
  }
133
142
  if (typeof input === 'number') {
134
143
  return "".concat(input, "px");
@@ -181,7 +190,7 @@ function getDismissedBy(_ref2) {
181
190
  */
182
191
  function ModalWrapperTopLayer(props) {
183
192
  var autoFocus = props.autoFocus,
184
- UNSAFE__disableAutoFocusForAsyncWrapper = props.UNSAFE__disableAutoFocusForAsyncWrapper,
193
+ UNSAFE__disableInitialAutoFocus = props.UNSAFE__disableInitialAutoFocus,
185
194
  _props$shouldCloseOnE = props.shouldCloseOnEscapePress,
186
195
  shouldCloseOnEscapePress = _props$shouldCloseOnE === void 0 ? true : _props$shouldCloseOnE,
187
196
  _props$shouldCloseOnO = props.shouldCloseOnOverlayClick,
@@ -309,7 +318,7 @@ function ModalWrapperTopLayer(props) {
309
318
 
310
319
  // Focus a ref-targeted element after mount (when autoFocus is a ref).
311
320
  // When true, native <dialog>.showModal() handles focus automatically.
312
- useAutoFocus(_typeof(autoFocus) === 'object' ? autoFocus : undefined, _typeof(autoFocus) === 'object' && !UNSAFE__disableAutoFocusForAsyncWrapper);
321
+ useAutoFocus(_typeof(autoFocus) === 'object' ? autoFocus : undefined, _typeof(autoFocus) === 'object' && !UNSAFE__disableInitialAutoFocus);
313
322
 
314
323
  // Chrome cross-origin iframe DnD workaround (crbug.com/362301053)
315
324
  useEffect(function () {
@@ -343,17 +352,19 @@ function ModalWrapperTopLayer(props) {
343
352
  }), /*#__PURE__*/React.createElement(DialogScrollLock, {
344
353
  isOpen: true
345
354
  }), /*#__PURE__*/React.createElement("div", {
355
+ className: ax([sizingContainerStyles[scrollMode]])
356
+ }, /*#__PURE__*/React.createElement("div", {
346
357
  ref: contentRef,
347
358
  style: {
348
359
  '--modal-dialog-height': getTopLayerSurfaceHeight(height),
349
360
  '--modal-dialog-width': getTopLayerSurfaceWidth(width)
350
361
  },
351
- className: ax([surfaceStyles.root, !isFullScreen && surfaceStyles.borderRadius, topLayerScrollModeStyles[scrollMode], !height && !isFullScreen && "_e8uo1ris"])
362
+ className: ax([surfaceStyles.root, !isFullScreen && surfaceStyles.borderRadius, topLayerScrollModeStyles[scrollMode]])
352
363
  }, /*#__PURE__*/React.createElement(ModalContext.Provider, {
353
364
  value: modalDialogContext
354
365
  }, /*#__PURE__*/React.createElement(ScrollContext.Provider, {
355
366
  value: shouldScrollInViewport
356
- }, /*#__PURE__*/React.createElement(MotionPresenceBoundary, null, children)))));
367
+ }, /*#__PURE__*/React.createElement(MotionPresenceBoundary, null, children))))));
357
368
  }
358
369
 
359
370
  /**
@@ -364,8 +375,8 @@ function ModalWrapperTopLayer(props) {
364
375
  */
365
376
  var ModalWrapperLegacy = /*#__PURE__*/forwardRef(function (props, ref) {
366
377
  var autoFocus = props.autoFocus,
367
- _props$UNSAFE__disabl = props.UNSAFE__disableAutoFocusForAsyncWrapper,
368
- UNSAFE__disableAutoFocusForAsyncWrapper = _props$UNSAFE__disabl === void 0 ? false : _props$UNSAFE__disabl,
378
+ _props$UNSAFE__disabl = props.UNSAFE__disableInitialAutoFocus,
379
+ UNSAFE__disableInitialAutoFocus = _props$UNSAFE__disabl === void 0 ? false : _props$UNSAFE__disabl,
369
380
  focusLockAllowlist = props.focusLockAllowlist,
370
381
  _props$shouldCloseOnE2 = props.shouldCloseOnEscapePress,
371
382
  shouldCloseOnEscapePress = _props$shouldCloseOnE2 === void 0 ? true : _props$shouldCloseOnE2,
@@ -397,7 +408,7 @@ var ModalWrapperLegacy = /*#__PURE__*/forwardRef(function (props, ref) {
397
408
  var isForeground = stackIndex === 0;
398
409
 
399
410
  // If no ref is provided, autofocus on first element
400
- var autoFocusLock = !UNSAFE__disableAutoFocusForAsyncWrapper && !(_typeof(autoFocus) === 'object');
411
+ var autoFocusLock = !UNSAFE__disableInitialAutoFocus && !(_typeof(autoFocus) === 'object');
401
412
  var onCloseHandler = useModalCloseHandler(providedOnClose);
402
413
  var onBlanketClicked = useCallback(function (e) {
403
414
  if (shouldCloseOnOverlayClick) {
@@ -25,7 +25,7 @@ export interface ModalDialogProps {
25
25
  * ready. This is gated by `platform_dst-automated_focus` and must not be
26
26
  * used by Makers or ordinary Modal Dialog consumers.
27
27
  */
28
- UNSAFE__disableAutoFocusForAsyncWrapper?: boolean;
28
+ UNSAFE__disableInitialAutoFocus?: boolean;
29
29
  /**
30
30
  * Contents of the modal dialog.
31
31
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/modal-dialog",
3
- "version": "17.2.0",
3
+ "version": "17.2.2",
4
4
  "description": "A modal dialog displays content that requires user interaction, in a layer above the page.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -39,19 +39,19 @@
39
39
  "dependencies": {
40
40
  "@atlaskit/analytics-next": "^12.6.0",
41
41
  "@atlaskit/blanket": "^16.4.0",
42
- "@atlaskit/button": "^25.6.0",
42
+ "@atlaskit/button": "^25.7.0",
43
43
  "@atlaskit/css": "^1.1.0",
44
44
  "@atlaskit/ds-lib": "^8.0.0",
45
45
  "@atlaskit/icon": "^38.0.0",
46
46
  "@atlaskit/layering": "^6.1.0",
47
- "@atlaskit/motion": "^9.5.0",
47
+ "@atlaskit/motion": "^9.6.0",
48
48
  "@atlaskit/platform-feature-flags": "^2.2.0",
49
49
  "@atlaskit/portal": "^7.1.0",
50
50
  "@atlaskit/pragmatic-drag-and-drop": "^4.0.0",
51
- "@atlaskit/primitives": "^22.6.0",
51
+ "@atlaskit/primitives": "^22.7.0",
52
52
  "@atlaskit/react-compiler-gating": "^0.2.0",
53
53
  "@atlaskit/theme": "^28.2.0",
54
- "@atlaskit/tokens": "^20.8.0",
54
+ "@atlaskit/tokens": "^20.10.0",
55
55
  "@atlaskit/top-layer": "^7.1.0",
56
56
  "@babel/runtime": "^7.0.0",
57
57
  "@compiled/react": "^1.0.2",
@@ -67,15 +67,16 @@
67
67
  "@af/accessibility-testing": "workspace:^",
68
68
  "@af/integration-testing": "workspace:^",
69
69
  "@af/visual-regression": "workspace:^",
70
- "@atlaskit/avatar": "^30.0.0",
70
+ "@atlaskit/avatar": "^30.1.0",
71
71
  "@atlaskit/avatar-group": "^14.4.0",
72
72
  "@atlaskit/banner": "^15.3.0",
73
73
  "@atlaskit/breadcrumbs": "^17.8.0",
74
74
  "@atlaskit/checkbox": "^19.3.0",
75
75
  "@atlaskit/code": "^20.0.0",
76
+ "@atlaskit/codemod-utils": "^5.2.0",
76
77
  "@atlaskit/datetime-picker": "^19.4.0",
77
78
  "@atlaskit/docs": "^12.3.0",
78
- "@atlaskit/dropdown-menu": "^21.0.0",
79
+ "@atlaskit/dropdown-menu": "^21.1.0",
79
80
  "@atlaskit/flag": "^19.0.0",
80
81
  "@atlaskit/form": "^18.3.0",
81
82
  "@atlaskit/heading": "^8.0.0",
@@ -1,18 +0,0 @@
1
- import { type ASTPath, type JSCodeshift, type JSXAttribute } from 'jscodeshift';
2
- import { type Collection } from 'jscodeshift/src/Collection';
3
-
4
- export function getJSXAttributesByName(
5
- j: JSCodeshift,
6
- element: ASTPath<any>,
7
- attributeName: string,
8
- ): Collection<JSXAttribute> {
9
- return j(element)
10
- .find(j.JSXOpeningElement)
11
- .find(j.JSXAttribute)
12
- .filter((attribute) => {
13
- const matches = j(attribute)
14
- .find(j.JSXIdentifier)
15
- .filter((identifier) => identifier.value.name === attributeName);
16
- return Boolean(matches.length);
17
- });
18
- }