@atlaskit/modal-dialog 12.2.7 → 12.2.10

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,26 @@
1
1
  # @atlaskit/modal-dialog
2
2
 
3
+ ## 12.2.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [`e4b612d1c48`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e4b612d1c48) - Internal migration to bind-event-listener for safer DOM Event cleanup
8
+ - [`347fd703ce0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/347fd703ce0) - Internally shifting to using bind-event-listener for events added in effects
9
+ - [`07ab2748b62`](https://bitbucket.org/atlassian/atlassian-frontend/commits/07ab2748b62) - [ux] - Changes the position of icon in ModalTitle having an appearance prop to be top aligned instead of center. This only affects titles that where the title wraps into multiple lines.
10
+ - Updated dependencies
11
+
12
+ ## 12.2.9
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
18
+ ## 12.2.8
19
+
20
+ ### Patch Changes
21
+
22
+ - [`0d1c80fe00d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0d1c80fe00d) - [ux] The width of the modal dialog now respect the custom value of the `width` prop.
23
+
3
24
  ## 12.2.7
4
25
 
5
26
  ### Patch Changes
@@ -28,7 +28,6 @@ var positionerStyles = (0, _core.css)({
28
28
  left: 0
29
29
  });
30
30
  var viewportScrollStyles = (0, _core.css)({
31
- width: 'max-content',
32
31
  height: 'auto',
33
32
  position: 'relative',
34
33
  '@media (min-width: 480px)': {
@@ -37,7 +36,6 @@ var viewportScrollStyles = (0, _core.css)({
37
36
  });
38
37
  var bodyScrollStyles = (0, _core.css)({
39
38
  '@media (min-width: 480px)': {
40
- width: 'max-content',
41
39
  maxWidth: maxWidthDimensions,
42
40
  maxHeight: maxHeightDimensions,
43
41
  marginRight: 'auto',
@@ -15,10 +15,14 @@ var _react = _interopRequireWildcard(require("react"));
15
15
 
16
16
  var _core = require("@emotion/core");
17
17
 
18
+ var _bindEventListener = require("bind-event-listener");
19
+
18
20
  var _rafSchd = _interopRequireDefault(require("raf-schd"));
19
21
 
20
22
  var _mergeRefs = _interopRequireDefault(require("@atlaskit/ds-lib/merge-refs"));
21
23
 
24
+ var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
25
+
22
26
  var _useLazyCallback = _interopRequireDefault(require("@atlaskit/ds-lib/use-lazy-callback"));
23
27
 
24
28
  var _useStateRef3 = _interopRequireDefault(require("@atlaskit/ds-lib/use-state-ref"));
@@ -110,8 +114,14 @@ var ScrollContainer = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
110
114
  }));
111
115
  (0, _react.useEffect)(function () {
112
116
  var target = scrollableRef.current;
113
- window.addEventListener('resize', setLazyKeylines, false);
114
- target === null || target === void 0 ? void 0 : target.addEventListener('scroll', setLazyKeylines, false);
117
+ var unbindWindowEvent = (0, _bindEventListener.bind)(window, {
118
+ type: 'resize',
119
+ listener: setLazyKeylines
120
+ });
121
+ var unbindTargetEvent = target ? (0, _bindEventListener.bind)(target, {
122
+ type: 'scroll',
123
+ listener: setLazyKeylines
124
+ }) : _noop.default;
115
125
  setLazyContentFocus();
116
126
  setLazyKeylines();
117
127
  setLazySiblings({
@@ -119,8 +129,8 @@ var ScrollContainer = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
119
129
  next: Boolean(target === null || target === void 0 ? void 0 : target.nextElementSibling)
120
130
  });
121
131
  return function () {
122
- window.removeEventListener('resize', setLazyKeylines, false);
123
- target === null || target === void 0 ? void 0 : target.removeEventListener('scroll', setLazyKeylines, false);
132
+ unbindWindowEvent();
133
+ unbindTargetEvent();
124
134
  };
125
135
  }, [setLazyContentFocus, setLazyKeylines, setLazySiblings]);
126
136
  return (0, _core.jsx)(_focusRing.default, {
@@ -11,7 +11,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
11
11
 
12
12
  var _react = require("react");
13
13
 
14
- var _useWindowEvent = _interopRequireDefault(require("@atlaskit/ds-lib/use-window-event"));
14
+ var _bindEventListener = require("bind-event-listener");
15
15
 
16
16
  /**
17
17
  * Returns how far the body is scrolled from the top of the viewport.
@@ -50,6 +50,11 @@ function usePreventProgrammaticScroll() {
50
50
  window.scrollTo(window.pageXOffset, scrollTopOffset);
51
51
  }
52
52
  }, [scrollTopOffset]);
53
- (0, _useWindowEvent.default)('scroll', onWindowScroll);
53
+ (0, _react.useEffect)(function () {
54
+ return (0, _bindEventListener.bind)(window, {
55
+ type: 'scroll',
56
+ listener: onWindowScroll
57
+ });
58
+ }, [onWindowScroll]);
54
59
  return scrollTopOffset;
55
60
  }
@@ -44,9 +44,8 @@ var textStyles = (0, _core.css)({
44
44
  });
45
45
  var iconStyles = (0, _core.css)({
46
46
  marginRight: "".concat(_constants.titleIconMargin, "px"),
47
-
48
- /* Keeps the size of the icon the same, in case the text element grows in width. */
49
- flex: '0 0 auto'
47
+ flex: '0 0 auto',
48
+ alignSelf: 'start'
50
49
  });
51
50
  /**
52
51
  * When the title is truncated (not multi-line), we adjust the
@@ -86,7 +86,7 @@ var ModalWrapper = function ModalWrapper(props) {
86
86
  action: 'closed',
87
87
  componentName: 'modalDialog',
88
88
  packageName: "@atlaskit/modal-dialog",
89
- packageVersion: "12.2.7"
89
+ packageVersion: "12.2.10"
90
90
  });
91
91
  var onBlanketClicked = (0, _react.useCallback)(function (e) {
92
92
  if (shouldCloseOnOverlayClick) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/modal-dialog",
3
- "version": "12.2.7",
3
+ "version": "12.2.10",
4
4
  "sideEffects": false
5
5
  }
@@ -16,7 +16,6 @@ const positionerStyles = css({
16
16
  left: 0
17
17
  });
18
18
  const viewportScrollStyles = css({
19
- width: 'max-content',
20
19
  height: 'auto',
21
20
  position: 'relative',
22
21
  '@media (min-width: 480px)': {
@@ -25,7 +24,6 @@ const viewportScrollStyles = css({
25
24
  });
26
25
  const bodyScrollStyles = css({
27
26
  '@media (min-width: 480px)': {
28
- width: 'max-content',
29
27
  maxWidth: maxWidthDimensions,
30
28
  maxHeight: maxHeightDimensions,
31
29
  marginRight: 'auto',
@@ -1,8 +1,10 @@
1
1
  /** @jsx jsx */
2
2
  import React, { forwardRef, useEffect, useRef, useState } from 'react';
3
3
  import { css, jsx } from '@emotion/core';
4
+ import { bind } from 'bind-event-listener';
4
5
  import rafSchedule from 'raf-schd';
5
6
  import mergeRefs from '@atlaskit/ds-lib/merge-refs';
7
+ import noop from '@atlaskit/ds-lib/noop';
6
8
  import useLazyCallback from '@atlaskit/ds-lib/use-lazy-callback';
7
9
  import useStateRef from '@atlaskit/ds-lib/use-state-ref';
8
10
  import FocusRing from '@atlaskit/focus-ring';
@@ -70,8 +72,14 @@ const ScrollContainer = /*#__PURE__*/forwardRef((props, ref) => {
70
72
  }));
71
73
  useEffect(() => {
72
74
  const target = scrollableRef.current;
73
- window.addEventListener('resize', setLazyKeylines, false);
74
- target === null || target === void 0 ? void 0 : target.addEventListener('scroll', setLazyKeylines, false);
75
+ const unbindWindowEvent = bind(window, {
76
+ type: 'resize',
77
+ listener: setLazyKeylines
78
+ });
79
+ const unbindTargetEvent = target ? bind(target, {
80
+ type: 'scroll',
81
+ listener: setLazyKeylines
82
+ }) : noop;
75
83
  setLazyContentFocus();
76
84
  setLazyKeylines();
77
85
  setLazySiblings({
@@ -79,8 +87,8 @@ const ScrollContainer = /*#__PURE__*/forwardRef((props, ref) => {
79
87
  next: Boolean(target === null || target === void 0 ? void 0 : target.nextElementSibling)
80
88
  });
81
89
  return () => {
82
- window.removeEventListener('resize', setLazyKeylines, false);
83
- target === null || target === void 0 ? void 0 : target.removeEventListener('scroll', setLazyKeylines, false);
90
+ unbindWindowEvent();
91
+ unbindTargetEvent();
84
92
  };
85
93
  }, [setLazyContentFocus, setLazyKeylines, setLazySiblings]);
86
94
  return jsx(FocusRing, {
@@ -1,5 +1,5 @@
1
- import { useCallback, useLayoutEffect, useState } from 'react';
2
- import useWindowEvent from '@atlaskit/ds-lib/use-window-event';
1
+ import { useCallback, useEffect, useLayoutEffect, useState } from 'react';
2
+ import { bind } from 'bind-event-listener';
3
3
  /**
4
4
  * Returns how far the body is scrolled from the top of the viewport.
5
5
  *
@@ -34,6 +34,11 @@ export default function usePreventProgrammaticScroll() {
34
34
  window.scrollTo(window.pageXOffset, scrollTopOffset);
35
35
  }
36
36
  }, [scrollTopOffset]);
37
- useWindowEvent('scroll', onWindowScroll);
37
+ useEffect(() => {
38
+ return bind(window, {
39
+ type: 'scroll',
40
+ listener: onWindowScroll
41
+ });
42
+ }, [onWindowScroll]);
38
43
  return scrollTopOffset;
39
44
  }
@@ -30,9 +30,8 @@ const textStyles = css({
30
30
  });
31
31
  const iconStyles = css({
32
32
  marginRight: `${titleIconMargin}px`,
33
-
34
- /* Keeps the size of the icon the same, in case the text element grows in width. */
35
- flex: '0 0 auto'
33
+ flex: '0 0 auto',
34
+ alignSelf: 'start'
36
35
  });
37
36
  /**
38
37
  * When the title is truncated (not multi-line), we adjust the
@@ -50,7 +50,7 @@ const ModalWrapper = props => {
50
50
  action: 'closed',
51
51
  componentName: 'modalDialog',
52
52
  packageName: "@atlaskit/modal-dialog",
53
- packageVersion: "12.2.7"
53
+ packageVersion: "12.2.10"
54
54
  });
55
55
  const onBlanketClicked = useCallback(e => {
56
56
  if (shouldCloseOnOverlayClick) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/modal-dialog",
3
- "version": "12.2.7",
3
+ "version": "12.2.10",
4
4
  "sideEffects": false
5
5
  }
@@ -16,7 +16,6 @@ var positionerStyles = css({
16
16
  left: 0
17
17
  });
18
18
  var viewportScrollStyles = css({
19
- width: 'max-content',
20
19
  height: 'auto',
21
20
  position: 'relative',
22
21
  '@media (min-width: 480px)': {
@@ -25,7 +24,6 @@ var viewportScrollStyles = css({
25
24
  });
26
25
  var bodyScrollStyles = css({
27
26
  '@media (min-width: 480px)': {
28
- width: 'max-content',
29
27
  maxWidth: maxWidthDimensions,
30
28
  maxHeight: maxHeightDimensions,
31
29
  marginRight: 'auto',
@@ -3,8 +3,10 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  /** @jsx jsx */
4
4
  import React, { forwardRef, useEffect, useRef, useState } from 'react';
5
5
  import { css, jsx } from '@emotion/core';
6
+ import { bind } from 'bind-event-listener';
6
7
  import rafSchedule from 'raf-schd';
7
8
  import mergeRefs from '@atlaskit/ds-lib/merge-refs';
9
+ import noop from '@atlaskit/ds-lib/noop';
8
10
  import useLazyCallback from '@atlaskit/ds-lib/use-lazy-callback';
9
11
  import useStateRef from '@atlaskit/ds-lib/use-state-ref';
10
12
  import FocusRing from '@atlaskit/focus-ring';
@@ -87,8 +89,14 @@ var ScrollContainer = /*#__PURE__*/forwardRef(function (props, ref) {
87
89
  }));
88
90
  useEffect(function () {
89
91
  var target = scrollableRef.current;
90
- window.addEventListener('resize', setLazyKeylines, false);
91
- target === null || target === void 0 ? void 0 : target.addEventListener('scroll', setLazyKeylines, false);
92
+ var unbindWindowEvent = bind(window, {
93
+ type: 'resize',
94
+ listener: setLazyKeylines
95
+ });
96
+ var unbindTargetEvent = target ? bind(target, {
97
+ type: 'scroll',
98
+ listener: setLazyKeylines
99
+ }) : noop;
92
100
  setLazyContentFocus();
93
101
  setLazyKeylines();
94
102
  setLazySiblings({
@@ -96,8 +104,8 @@ var ScrollContainer = /*#__PURE__*/forwardRef(function (props, ref) {
96
104
  next: Boolean(target === null || target === void 0 ? void 0 : target.nextElementSibling)
97
105
  });
98
106
  return function () {
99
- window.removeEventListener('resize', setLazyKeylines, false);
100
- target === null || target === void 0 ? void 0 : target.removeEventListener('scroll', setLazyKeylines, false);
107
+ unbindWindowEvent();
108
+ unbindTargetEvent();
101
109
  };
102
110
  }, [setLazyContentFocus, setLazyKeylines, setLazySiblings]);
103
111
  return jsx(FocusRing, {
@@ -1,6 +1,6 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import { useCallback, useLayoutEffect, useState } from 'react';
3
- import useWindowEvent from '@atlaskit/ds-lib/use-window-event';
2
+ import { useCallback, useEffect, useLayoutEffect, useState } from 'react';
3
+ import { bind } from 'bind-event-listener';
4
4
  /**
5
5
  * Returns how far the body is scrolled from the top of the viewport.
6
6
  *
@@ -39,6 +39,11 @@ export default function usePreventProgrammaticScroll() {
39
39
  window.scrollTo(window.pageXOffset, scrollTopOffset);
40
40
  }
41
41
  }, [scrollTopOffset]);
42
- useWindowEvent('scroll', onWindowScroll);
42
+ useEffect(function () {
43
+ return bind(window, {
44
+ type: 'scroll',
45
+ listener: onWindowScroll
46
+ });
47
+ }, [onWindowScroll]);
43
48
  return scrollTopOffset;
44
49
  }
@@ -30,9 +30,8 @@ var textStyles = css({
30
30
  });
31
31
  var iconStyles = css({
32
32
  marginRight: "".concat(titleIconMargin, "px"),
33
-
34
- /* Keeps the size of the icon the same, in case the text element grows in width. */
35
- flex: '0 0 auto'
33
+ flex: '0 0 auto',
34
+ alignSelf: 'start'
36
35
  });
37
36
  /**
38
37
  * When the title is truncated (not multi-line), we adjust the
@@ -57,7 +57,7 @@ var ModalWrapper = function ModalWrapper(props) {
57
57
  action: 'closed',
58
58
  componentName: 'modalDialog',
59
59
  packageName: "@atlaskit/modal-dialog",
60
- packageVersion: "12.2.7"
60
+ packageVersion: "12.2.10"
61
61
  });
62
62
  var onBlanketClicked = useCallback(function (e) {
63
63
  if (shouldCloseOnOverlayClick) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/modal-dialog",
3
- "version": "12.2.7",
3
+ "version": "12.2.10",
4
4
  "sideEffects": false
5
5
  }
@@ -3,5 +3,6 @@
3
3
  "main": "../dist/cjs/hooks.js",
4
4
  "module": "../dist/esm/hooks.js",
5
5
  "module:es2019": "../dist/es2019/hooks.js",
6
+ "sideEffects": false,
6
7
  "types": "../dist/types/hooks.d.ts"
7
8
  }
@@ -3,5 +3,6 @@
3
3
  "main": "../dist/cjs/modal-body.js",
4
4
  "module": "../dist/esm/modal-body.js",
5
5
  "module:es2019": "../dist/es2019/modal-body.js",
6
+ "sideEffects": false,
6
7
  "types": "../dist/types/modal-body.d.ts"
7
8
  }
@@ -3,5 +3,6 @@
3
3
  "main": "../dist/cjs/modal-wrapper.js",
4
4
  "module": "../dist/esm/modal-wrapper.js",
5
5
  "module:es2019": "../dist/es2019/modal-wrapper.js",
6
+ "sideEffects": false,
6
7
  "types": "../dist/types/modal-wrapper.d.ts"
7
8
  }
@@ -3,5 +3,6 @@
3
3
  "main": "../dist/cjs/modal-footer.js",
4
4
  "module": "../dist/esm/modal-footer.js",
5
5
  "module:es2019": "../dist/es2019/modal-footer.js",
6
+ "sideEffects": false,
6
7
  "types": "../dist/types/modal-footer.d.ts"
7
8
  }
@@ -3,5 +3,6 @@
3
3
  "main": "../dist/cjs/modal-header.js",
4
4
  "module": "../dist/esm/modal-header.js",
5
5
  "module:es2019": "../dist/es2019/modal-header.js",
6
+ "sideEffects": false,
6
7
  "types": "../dist/types/modal-header.d.ts"
7
8
  }
@@ -3,5 +3,6 @@
3
3
  "main": "../dist/cjs/modal-title.js",
4
4
  "module": "../dist/esm/modal-title.js",
5
5
  "module:es2019": "../dist/es2019/modal-title.js",
6
+ "sideEffects": false,
6
7
  "types": "../dist/types/modal-title.d.ts"
7
8
  }
@@ -3,5 +3,6 @@
3
3
  "main": "../dist/cjs/modal-transition.js",
4
4
  "module": "../dist/esm/modal-transition.js",
5
5
  "module:es2019": "../dist/es2019/modal-transition.js",
6
+ "sideEffects": false,
6
7
  "types": "../dist/types/modal-transition.d.ts"
7
8
  }
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@atlaskit/modal-dialog",
3
- "version": "12.2.7",
3
+ "version": "12.2.10",
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/"
7
7
  },
8
- "repository": "https://bitbucket.org/atlassian/atlassian-frontend",
8
+ "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
9
9
  "author": "Atlassian Pty Ltd",
10
10
  "license": "Apache-2.0",
11
11
  "main": "dist/cjs/index.js",
@@ -29,7 +29,8 @@
29
29
  "team": "Design System Team",
30
30
  "releaseModel": "scheduled",
31
31
  "website": {
32
- "name": "Modal dialog"
32
+ "name": "Modal dialog",
33
+ "category": "Components"
33
34
  }
34
35
  },
35
36
  "scripts": {
@@ -38,16 +39,17 @@
38
39
  "dependencies": {
39
40
  "@atlaskit/analytics-next": "^8.2.0",
40
41
  "@atlaskit/blanket": "^12.2.0",
41
- "@atlaskit/codemod-utils": "^4.0.0",
42
- "@atlaskit/ds-lib": "^1.4.0",
42
+ "@atlaskit/codemod-utils": "^4.1.0",
43
+ "@atlaskit/ds-lib": "^2.0.0",
43
44
  "@atlaskit/focus-ring": "^1.0.0",
44
45
  "@atlaskit/icon": "^21.10.0",
45
- "@atlaskit/motion": "^1.0.0",
46
+ "@atlaskit/motion": "^1.1.0",
46
47
  "@atlaskit/portal": "^4.1.0",
47
48
  "@atlaskit/theme": "^12.1.0",
48
- "@atlaskit/tokens": "^0.9.0",
49
+ "@atlaskit/tokens": "^0.10.0",
49
50
  "@babel/runtime": "^7.0.0",
50
51
  "@emotion/core": "^10.0.9",
52
+ "bind-event-listener": "^2.1.0",
51
53
  "raf-schd": "^4.0.3",
52
54
  "react-focus-lock": "^2.5.2",
53
55
  "react-scrolllock": "^5.0.1",
@@ -101,6 +103,7 @@
101
103
  "import-structure": "atlassian-conventions"
102
104
  },
103
105
  "@repo/internal": {
106
+ "dom-events": "use-bind-event-listener",
104
107
  "ui-components": "lite-mode",
105
108
  "analytics": "analytics-next",
106
109
  "theming": "tokens",
@@ -3,5 +3,6 @@
3
3
  "main": "../dist/cjs/types.js",
4
4
  "module": "../dist/esm/types.js",
5
5
  "module:es2019": "../dist/es2019/types.js",
6
+ "sideEffects": false,
6
7
  "types": "../dist/types/types.d.ts"
7
8
  }