@atlaskit/modal-dialog 12.6.6 → 12.6.8

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,18 @@
1
1
  # @atlaskit/modal-dialog
2
2
 
3
+ ## 12.6.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d6f63fa1abc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d6f63fa1abc) - Adds support for surface detection when using design tokens. Enabling children to be styled with the Modal’s surface color when using the `utility.elevation.surface.current` design token.
8
+ - Updated dependencies
9
+
10
+ ## 12.6.7
11
+
12
+ ### Patch Changes
13
+
14
+ - [`d2b6377be3d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d2b6377be3d) - Add some basic JSDoc for internal components, add tokens.
15
+
3
16
  ## 12.6.6
4
17
 
5
18
  ### Patch Changes
@@ -18,6 +18,7 @@ var _focusRing = _interopRequireDefault(require("@atlaskit/focus-ring"));
18
18
  var _fadeIn = _interopRequireDefault(require("@atlaskit/motion/fade-in"));
19
19
  var _primitives = require("@atlaskit/primitives");
20
20
  var _colors = require("@atlaskit/theme/colors");
21
+ var _tokens = require("@atlaskit/tokens");
21
22
  var _constants = require("../constants");
22
23
  var _context = require("../context");
23
24
  var _useOnMotionFinish3 = _interopRequireDefault(require("../hooks/use-on-motion-finish"));
@@ -36,9 +37,8 @@ var dialogStyles = (0, _react2.css)((_css = {
36
37
  flex: '0 1 auto',
37
38
  flexDirection: 'column',
38
39
  backgroundColor: "var(--ds-surface-overlay, ".concat(_colors.N0, ")"),
39
- color: _constants.textColor,
40
- pointerEvents: 'auto'
41
- }, (0, _defineProperty2.default)(_css, _primitives.media.above.xs, {
40
+ color: _constants.textColor
41
+ }, (0, _defineProperty2.default)(_css, _tokens.CURRENT_SURFACE_CSS_VAR, "var(--ds-surface-overlay, ".concat(_colors.N0, ")")), (0, _defineProperty2.default)(_css, "pointerEvents", 'auto'), (0, _defineProperty2.default)(_css, _primitives.media.above.xs, {
42
42
  width: 'var(--modal-dialog-width)',
43
43
  maxWidth: 'inherit',
44
44
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.ScrollContext = exports.ModalContext = void 0;
7
7
  var _react = require("react");
8
8
  /* eslint-disable @repo/internal/react/require-jsdoc */
9
-
10
9
  var ModalContext = /*#__PURE__*/(0, _react.createContext)(null);
11
10
  exports.ModalContext = ModalContext;
12
11
  var ScrollContext = /*#__PURE__*/(0, _react.createContext)(null);
@@ -5,7 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = useOnMotionFinish;
7
7
  var _react = require("react");
8
- // eslint-disable-next-line @repo/internal/react/require-jsdoc
8
+ /**
9
+ * This will run the respective passed in callback functions when modal is
10
+ * opened or closed.
11
+ */
9
12
  function useOnMotionFinish(_ref) {
10
13
  var onOpenComplete = _ref.onOpenComplete,
11
14
  onCloseComplete = _ref.onCloseComplete;
@@ -6,7 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = useScroll;
7
7
  var _react = require("react");
8
8
  var _context = require("../context");
9
- // eslint-disable-next-line @repo/internal/react/require-jsdoc
9
+ /**
10
+ * This returns whether or not scrolling is allowed based on the existing
11
+ * scrolling context.
12
+ */
10
13
  function useScroll() {
11
14
  var shouldScrollInViewport = (0, _react.useContext)(_context.ScrollContext);
12
15
  if (shouldScrollInViewport == null) {
@@ -29,10 +29,8 @@ var fillScreenStyles = (0, _react2.css)({
29
29
  width: '100vw',
30
30
  height: '100vh',
31
31
  position: 'fixed',
32
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
33
- top: 0,
34
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
35
- left: 0,
32
+ top: "var(--ds-space-0, 0)",
33
+ left: "var(--ds-space-0, 0)",
36
34
  overflowY: 'auto',
37
35
  WebkitOverflowScrolling: 'touch'
38
36
  });
@@ -86,7 +84,7 @@ var ModalWrapper = function ModalWrapper(props) {
86
84
  action: 'closed',
87
85
  componentName: 'modalDialog',
88
86
  packageName: "@atlaskit/modal-dialog",
89
- packageVersion: "12.6.6"
87
+ packageVersion: "12.6.8"
90
88
  });
91
89
  var onBlanketClicked = (0, _react.useCallback)(function (e) {
92
90
  if (shouldCloseOnOverlayClick) {
@@ -9,6 +9,7 @@ import FocusRing from '@atlaskit/focus-ring';
9
9
  import FadeIn from '@atlaskit/motion/fade-in';
10
10
  import { media } from '@atlaskit/primitives';
11
11
  import { N0, N30A, N60A } from '@atlaskit/theme/colors';
12
+ import { CURRENT_SURFACE_CSS_VAR } from '@atlaskit/tokens';
12
13
  import { borderRadius, textColor } from '../constants';
13
14
  import { ModalContext, ScrollContext } from '../context';
14
15
  import useOnMotionFinish from '../hooks/use-on-motion-finish';
@@ -26,6 +27,7 @@ const dialogStyles = css({
26
27
  flexDirection: 'column',
27
28
  backgroundColor: `var(--ds-surface-overlay, ${N0})`,
28
29
  color: textColor,
30
+ [CURRENT_SURFACE_CSS_VAR]: `var(--ds-surface-overlay, ${N0})`,
29
31
  pointerEvents: 'auto',
30
32
  [media.above.xs]: {
31
33
  width: 'var(--modal-dialog-width)',
@@ -1,4 +1,4 @@
1
- /* eslint-disable @repo/internal/react/require-jsdoc */
2
1
  import { createContext } from 'react';
2
+ /* eslint-disable @repo/internal/react/require-jsdoc */
3
3
  export const ModalContext = /*#__PURE__*/createContext(null);
4
4
  export const ScrollContext = /*#__PURE__*/createContext(null);
@@ -1,5 +1,8 @@
1
1
  import { useCallback, useRef } from 'react';
2
- // eslint-disable-next-line @repo/internal/react/require-jsdoc
2
+ /**
3
+ * This will run the respective passed in callback functions when modal is
4
+ * opened or closed.
5
+ */
3
6
  export default function useOnMotionFinish({
4
7
  onOpenComplete,
5
8
  onCloseComplete
@@ -1,7 +1,10 @@
1
1
  import { useContext } from 'react';
2
2
  import { ScrollContext } from '../context';
3
3
 
4
- // eslint-disable-next-line @repo/internal/react/require-jsdoc
4
+ /**
5
+ * This returns whether or not scrolling is allowed based on the existing
6
+ * scrolling context.
7
+ */
5
8
  export default function useScroll() {
6
9
  const shouldScrollInViewport = useContext(ScrollContext);
7
10
  if (shouldScrollInViewport == null) {
@@ -19,10 +19,8 @@ const fillScreenStyles = css({
19
19
  width: '100vw',
20
20
  height: '100vh',
21
21
  position: 'fixed',
22
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
23
- top: 0,
24
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
25
- left: 0,
22
+ top: "var(--ds-space-0, 0)",
23
+ left: "var(--ds-space-0, 0)",
26
24
  overflowY: 'auto',
27
25
  WebkitOverflowScrolling: 'touch'
28
26
  });
@@ -72,7 +70,7 @@ const ModalWrapper = props => {
72
70
  action: 'closed',
73
71
  componentName: 'modalDialog',
74
72
  packageName: "@atlaskit/modal-dialog",
75
- packageVersion: "12.6.6"
73
+ packageVersion: "12.6.8"
76
74
  });
77
75
  const onBlanketClicked = useCallback(e => {
78
76
  if (shouldCloseOnOverlayClick) {
@@ -13,6 +13,7 @@ import FocusRing from '@atlaskit/focus-ring';
13
13
  import FadeIn from '@atlaskit/motion/fade-in';
14
14
  import { media } from '@atlaskit/primitives';
15
15
  import { N0, N30A, N60A } from '@atlaskit/theme/colors';
16
+ import { CURRENT_SURFACE_CSS_VAR } from '@atlaskit/tokens';
16
17
  import { borderRadius, textColor } from '../constants';
17
18
  import { ModalContext, ScrollContext } from '../context';
18
19
  import useOnMotionFinish from '../hooks/use-on-motion-finish';
@@ -29,9 +30,8 @@ var dialogStyles = css((_css = {
29
30
  flex: '0 1 auto',
30
31
  flexDirection: 'column',
31
32
  backgroundColor: "var(--ds-surface-overlay, ".concat(N0, ")"),
32
- color: textColor,
33
- pointerEvents: 'auto'
34
- }, _defineProperty(_css, media.above.xs, {
33
+ color: textColor
34
+ }, _defineProperty(_css, CURRENT_SURFACE_CSS_VAR, "var(--ds-surface-overlay, ".concat(N0, ")")), _defineProperty(_css, "pointerEvents", 'auto'), _defineProperty(_css, media.above.xs, {
35
35
  width: 'var(--modal-dialog-width)',
36
36
  maxWidth: 'inherit',
37
37
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
@@ -1,4 +1,4 @@
1
- /* eslint-disable @repo/internal/react/require-jsdoc */
2
1
  import { createContext } from 'react';
2
+ /* eslint-disable @repo/internal/react/require-jsdoc */
3
3
  export var ModalContext = /*#__PURE__*/createContext(null);
4
4
  export var ScrollContext = /*#__PURE__*/createContext(null);
@@ -1,5 +1,8 @@
1
1
  import { useCallback, useRef } from 'react';
2
- // eslint-disable-next-line @repo/internal/react/require-jsdoc
2
+ /**
3
+ * This will run the respective passed in callback functions when modal is
4
+ * opened or closed.
5
+ */
3
6
  export default function useOnMotionFinish(_ref) {
4
7
  var onOpenComplete = _ref.onOpenComplete,
5
8
  onCloseComplete = _ref.onCloseComplete;
@@ -1,7 +1,10 @@
1
1
  import { useContext } from 'react';
2
2
  import { ScrollContext } from '../context';
3
3
 
4
- // eslint-disable-next-line @repo/internal/react/require-jsdoc
4
+ /**
5
+ * This returns whether or not scrolling is allowed based on the existing
6
+ * scrolling context.
7
+ */
5
8
  export default function useScroll() {
6
9
  var shouldScrollInViewport = useContext(ScrollContext);
7
10
  if (shouldScrollInViewport == null) {
@@ -19,10 +19,8 @@ var fillScreenStyles = css({
19
19
  width: '100vw',
20
20
  height: '100vh',
21
21
  position: 'fixed',
22
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
23
- top: 0,
24
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
25
- left: 0,
22
+ top: "var(--ds-space-0, 0)",
23
+ left: "var(--ds-space-0, 0)",
26
24
  overflowY: 'auto',
27
25
  WebkitOverflowScrolling: 'touch'
28
26
  });
@@ -76,7 +74,7 @@ var ModalWrapper = function ModalWrapper(props) {
76
74
  action: 'closed',
77
75
  componentName: 'modalDialog',
78
76
  packageName: "@atlaskit/modal-dialog",
79
- packageVersion: "12.6.6"
77
+ packageVersion: "12.6.8"
80
78
  });
81
79
  var onBlanketClicked = useCallback(function (e) {
82
80
  if (shouldCloseOnOverlayClick) {
@@ -1,6 +1,10 @@
1
1
  import { RefObject } from 'react';
2
2
  import type { Transition } from '@atlaskit/motion/types';
3
3
  import { ModalDialogProps } from '../../types';
4
+ /**
5
+ * This will run the respective passed in callback functions when modal is
6
+ * opened or closed.
7
+ */
4
8
  export default function useOnMotionFinish({ onOpenComplete, onCloseComplete, }: Pick<ModalDialogProps, 'onOpenComplete' | 'onCloseComplete'>): [
5
9
  RefObject<HTMLElement>,
6
10
  (state: Transition) => void
@@ -1 +1,5 @@
1
+ /**
2
+ * This returns whether or not scrolling is allowed based on the existing
3
+ * scrolling context.
4
+ */
1
5
  export default function useScroll(): boolean;
@@ -1,6 +1,10 @@
1
1
  import { RefObject } from 'react';
2
2
  import type { Transition } from '@atlaskit/motion/types';
3
3
  import { ModalDialogProps } from '../../types';
4
+ /**
5
+ * This will run the respective passed in callback functions when modal is
6
+ * opened or closed.
7
+ */
4
8
  export default function useOnMotionFinish({ onOpenComplete, onCloseComplete, }: Pick<ModalDialogProps, 'onOpenComplete' | 'onCloseComplete'>): [
5
9
  RefObject<HTMLElement>,
6
10
  (state: Transition) => void
@@ -1 +1,5 @@
1
+ /**
2
+ * This returns whether or not scrolling is allowed based on the existing
3
+ * scrolling context.
4
+ */
1
5
  export default function useScroll(): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/modal-dialog",
3
- "version": "12.6.6",
3
+ "version": "12.6.8",
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/"
@@ -36,7 +36,7 @@
36
36
  "@atlaskit/portal": "^4.3.0",
37
37
  "@atlaskit/primitives": "^1.2.0",
38
38
  "@atlaskit/theme": "^12.5.0",
39
- "@atlaskit/tokens": "^1.14.0",
39
+ "@atlaskit/tokens": "^1.16.0",
40
40
  "@babel/runtime": "^7.0.0",
41
41
  "@emotion/react": "^11.7.1",
42
42
  "bind-event-listener": "^2.1.1",
@@ -1,113 +0,0 @@
1
- ## API Report File for "@atlaskit/modal-dialog"
2
-
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
-
5
- ```ts
6
-
7
- /// <reference types="react" />
8
-
9
- import { ExitingPersistenceProps } from '@atlaskit/motion/exiting-persistence';
10
- import { jsx } from '@emotion/react';
11
- import { default as React_2 } from 'react';
12
- import { ReactNode } from 'react';
13
- import { RefObject } from 'react';
14
- import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
15
-
16
- // @public (undocumented)
17
- export type Appearance = 'danger' | 'warning';
18
-
19
- // @public (undocumented)
20
- export type KeyboardOrMouseEvent = KeyboardEvent | React_2.KeyboardEvent<any> | React_2.MouseEvent<any>;
21
-
22
- // @public (undocumented)
23
- export type ModalAttributes = {
24
- testId?: ModalDialogProps['testId'];
25
- titleId: string;
26
- onClose?: OnCloseHandler;
27
- };
28
-
29
- // @public
30
- export const ModalBody: (props: ModalBodyProps) => jsx.JSX.Element;
31
-
32
- // @public (undocumented)
33
- export interface ModalBodyProps {
34
- children: React_2.ReactNode;
35
- testId?: string;
36
- }
37
-
38
- // @public (undocumented)
39
- export interface ModalDialogProps {
40
- autoFocus?: RefObject<HTMLElement | null | undefined> | boolean;
41
- children?: React_2.ReactNode;
42
- height?: number | string;
43
- isBlanketHidden?: boolean;
44
- label?: string;
45
- onClose?: OnCloseHandler;
46
- onCloseComplete?: OnCloseCompleteHandler;
47
- onOpenComplete?: OnOpenCompleteHandler;
48
- onStackChange?: OnStackChangeHandler;
49
- shouldCloseOnEscapePress?: boolean;
50
- shouldCloseOnOverlayClick?: boolean;
51
- shouldScrollInViewport?: boolean;
52
- stackIndex?: number;
53
- testId?: string;
54
- width?: WidthNames | number | string;
55
- }
56
-
57
- // @public
58
- export const ModalFooter: (props: ModalFooterProps) => jsx.JSX.Element;
59
-
60
- // @public (undocumented)
61
- export interface ModalFooterProps {
62
- children?: ReactNode;
63
- testId?: string;
64
- }
65
-
66
- // @public
67
- export const ModalHeader: (props: ModalHeaderProps) => jsx.JSX.Element;
68
-
69
- // @public (undocumented)
70
- export interface ModalHeaderProps {
71
- children?: React_2.ReactNode;
72
- testId?: string;
73
- }
74
-
75
- // @public
76
- export const ModalTitle: (props: ModalTitleProps) => jsx.JSX.Element;
77
-
78
- // @public (undocumented)
79
- export interface ModalTitleProps {
80
- appearance?: Appearance;
81
- children?: ReactNode;
82
- isMultiline?: boolean;
83
- testId?: string;
84
- }
85
-
86
- // @public
87
- export const ModalTransition: (props: Pick<ExitingPersistenceProps, 'children'>) => JSX.Element;
88
-
89
- // @public
90
- const ModalWrapper: (props: ModalDialogProps) => jsx.JSX.Element;
91
- export default ModalWrapper;
92
-
93
- // @public (undocumented)
94
- export type OnCloseCompleteHandler = (element: HTMLElement) => void;
95
-
96
- // @public (undocumented)
97
- export type OnCloseHandler = (e: KeyboardOrMouseEvent, analyticEvent: UIAnalyticsEvent) => void;
98
-
99
- // @public (undocumented)
100
- export type OnOpenCompleteHandler = (node: HTMLElement, isAppearing: boolean) => void;
101
-
102
- // @public (undocumented)
103
- export type OnStackChangeHandler = (stackIndex: number) => void;
104
-
105
- // @public (undocumented)
106
- export const useModal: () => ModalAttributes;
107
-
108
- // @public (undocumented)
109
- type WidthNames = 'large' | 'medium' | 'small' | 'x-large';
110
-
111
- // (No @packageDocumentation comment for this package)
112
-
113
- ```