@atlaskit/popup 1.11.5 → 1.11.6

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,11 @@
1
1
  # @atlaskit/popup
2
2
 
3
+ ## 1.11.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#67435](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/67435) [`7949bd7f5cb6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7949bd7f5cb6) - Support to disable pointer-events on iframe when popup is open to fix issue of clicking on iframe won't close popup
8
+
3
9
  ## 1.11.5
4
10
 
5
11
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- import Button from '@atlaskit/button';
3
+ import Button from '@atlaskit/button/new';
4
4
 
5
5
  import Popup from '../src';
6
6
 
package/__perf__/open.tsx CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- import Button from '@atlaskit/button';
3
+ import Button from '@atlaskit/button/new';
4
4
 
5
5
  import Popup from '../src';
6
6
 
@@ -11,6 +11,8 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
11
11
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
12
  var _react = require("react");
13
13
  var _react2 = require("@emotion/react");
14
+ var _layering = require("@atlaskit/layering");
15
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
16
  var _popper = require("@atlaskit/popper");
15
17
  var _colors = require("@atlaskit/theme/colors");
16
18
  var _constants = require("@atlaskit/theme/constants");
@@ -35,6 +37,15 @@ var popupStyles = (0, _react2.css)((_css = {
35
37
  var popupOverflowStyles = (0, _react2.css)({
36
38
  overflow: 'auto'
37
39
  });
40
+
41
+ // disables iframe pointer events while popup is open, except if iframe is nested inside popup
42
+ // solves an issue of popup not being closed on iframe click
43
+ var blockPointerEventsOnExternalIframeStyles = (0, _react2.css)({
44
+ // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
45
+ 'iframe:not([data-ds--level] iframe)': {
46
+ pointerEvents: 'none'
47
+ }
48
+ });
38
49
  var DefaultPopupComponent = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
39
50
  var shouldRenderToParent = props.shouldRenderToParent,
40
51
  children = props.children,
@@ -84,6 +95,8 @@ function PopperWrapper(_ref) {
84
95
  triggerRef: triggerRef,
85
96
  shouldUseCaptureOnOutsideClick: shouldUseCaptureOnOutsideClick
86
97
  });
98
+ var _UNSAFE_useLayering = (0, _layering.UNSAFE_useLayering)(),
99
+ currentLevel = _UNSAFE_useLayering.currentLevel;
87
100
  var modifiers = (0, _react.useMemo)(function () {
88
101
  return [{
89
102
  name: 'flip',
@@ -106,6 +119,7 @@ function PopperWrapper(_ref) {
106
119
  update = _ref2.update;
107
120
  return (0, _react2.jsx)(PopupContainer, {
108
121
  id: id,
122
+ "data-ds--level": currentLevel,
109
123
  "data-placement": placement,
110
124
  "data-testid": testId,
111
125
  ref: function ref(node) {
@@ -124,7 +138,9 @@ function PopperWrapper(_ref) {
124
138
  ,
125
139
  tabIndex: autoFocus ? 0 : undefined,
126
140
  shouldRenderToParent: shouldRenderToParent
127
- }, (0, _react2.jsx)(_repositionOnUpdate.RepositionOnUpdate, {
141
+ }, (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.iframe_gojiv') && (0, _react2.jsx)(_react2.Global, {
142
+ styles: blockPointerEventsOnExternalIframeStyles
143
+ }), (0, _react2.jsx)(_repositionOnUpdate.RepositionOnUpdate, {
128
144
  update: update
129
145
  }, content({
130
146
  update: update,
@@ -1,7 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  /** @jsx jsx */
3
3
  import { forwardRef, useMemo, useState } from 'react';
4
- import { css, jsx } from '@emotion/react';
4
+ import { css, Global, jsx } from '@emotion/react';
5
+ import { UNSAFE_useLayering } from '@atlaskit/layering';
6
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
5
7
  import { Popper } from '@atlaskit/popper';
6
8
  import { N0, N50A, N60A } from '@atlaskit/theme/colors';
7
9
  import { layers } from '@atlaskit/theme/constants';
@@ -25,6 +27,15 @@ const popupStyles = css({
25
27
  const popupOverflowStyles = css({
26
28
  overflow: 'auto'
27
29
  });
30
+
31
+ // disables iframe pointer events while popup is open, except if iframe is nested inside popup
32
+ // solves an issue of popup not being closed on iframe click
33
+ const blockPointerEventsOnExternalIframeStyles = css({
34
+ // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
35
+ 'iframe:not([data-ds--level] iframe)': {
36
+ pointerEvents: 'none'
37
+ }
38
+ });
28
39
  const DefaultPopupComponent = /*#__PURE__*/forwardRef((props, ref) => {
29
40
  const {
30
41
  shouldRenderToParent,
@@ -68,6 +79,9 @@ function PopperWrapper({
68
79
  triggerRef,
69
80
  shouldUseCaptureOnOutsideClick
70
81
  });
82
+ const {
83
+ currentLevel
84
+ } = UNSAFE_useLayering();
71
85
  const modifiers = useMemo(() => [{
72
86
  name: 'flip',
73
87
  enabled: shouldFlip,
@@ -89,6 +103,7 @@ function PopperWrapper({
89
103
  }) => {
90
104
  return jsx(PopupContainer, {
91
105
  id: id,
106
+ "data-ds--level": currentLevel,
92
107
  "data-placement": placement,
93
108
  "data-testid": testId,
94
109
  ref: node => {
@@ -107,7 +122,9 @@ function PopperWrapper({
107
122
  ,
108
123
  tabIndex: autoFocus ? 0 : undefined,
109
124
  shouldRenderToParent: shouldRenderToParent
110
- }, jsx(RepositionOnUpdate, {
125
+ }, getBooleanFF('platform.design-system-team.iframe_gojiv') && jsx(Global, {
126
+ styles: blockPointerEventsOnExternalIframeStyles
127
+ }), jsx(RepositionOnUpdate, {
111
128
  update: update
112
129
  }, content({
113
130
  update,
@@ -6,7 +6,9 @@ var _excluded = ["shouldRenderToParent", "children"];
6
6
  var _css;
7
7
  /** @jsx jsx */
8
8
  import { forwardRef, useMemo, useState } from 'react';
9
- import { css, jsx } from '@emotion/react';
9
+ import { css, Global, jsx } from '@emotion/react';
10
+ import { UNSAFE_useLayering } from '@atlaskit/layering';
11
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
10
12
  import { Popper } from '@atlaskit/popper';
11
13
  import { N0, N50A, N60A } from '@atlaskit/theme/colors';
12
14
  import { layers } from '@atlaskit/theme/constants';
@@ -28,6 +30,15 @@ var popupStyles = css((_css = {
28
30
  var popupOverflowStyles = css({
29
31
  overflow: 'auto'
30
32
  });
33
+
34
+ // disables iframe pointer events while popup is open, except if iframe is nested inside popup
35
+ // solves an issue of popup not being closed on iframe click
36
+ var blockPointerEventsOnExternalIframeStyles = css({
37
+ // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
38
+ 'iframe:not([data-ds--level] iframe)': {
39
+ pointerEvents: 'none'
40
+ }
41
+ });
31
42
  var DefaultPopupComponent = /*#__PURE__*/forwardRef(function (props, ref) {
32
43
  var shouldRenderToParent = props.shouldRenderToParent,
33
44
  children = props.children,
@@ -77,6 +88,8 @@ function PopperWrapper(_ref) {
77
88
  triggerRef: triggerRef,
78
89
  shouldUseCaptureOnOutsideClick: shouldUseCaptureOnOutsideClick
79
90
  });
91
+ var _UNSAFE_useLayering = UNSAFE_useLayering(),
92
+ currentLevel = _UNSAFE_useLayering.currentLevel;
80
93
  var modifiers = useMemo(function () {
81
94
  return [{
82
95
  name: 'flip',
@@ -99,6 +112,7 @@ function PopperWrapper(_ref) {
99
112
  update = _ref2.update;
100
113
  return jsx(PopupContainer, {
101
114
  id: id,
115
+ "data-ds--level": currentLevel,
102
116
  "data-placement": placement,
103
117
  "data-testid": testId,
104
118
  ref: function ref(node) {
@@ -117,7 +131,9 @@ function PopperWrapper(_ref) {
117
131
  ,
118
132
  tabIndex: autoFocus ? 0 : undefined,
119
133
  shouldRenderToParent: shouldRenderToParent
120
- }, jsx(RepositionOnUpdate, {
134
+ }, getBooleanFF('platform.design-system-team.iframe_gojiv') && jsx(Global, {
135
+ styles: blockPointerEventsOnExternalIframeStyles
136
+ }), jsx(RepositionOnUpdate, {
121
137
  update: update
122
138
  }, content({
123
139
  update: update,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/popup",
3
- "version": "1.11.5",
3
+ "version": "1.11.6",
4
4
  "description": "A popup displays brief content in an overlay.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -44,7 +44,7 @@
44
44
  "@atlaskit/popper": "^5.5.0",
45
45
  "@atlaskit/portal": "^4.4.0",
46
46
  "@atlaskit/theme": "^12.6.0",
47
- "@atlaskit/tokens": "^1.28.0",
47
+ "@atlaskit/tokens": "^1.33.0",
48
48
  "@babel/runtime": "^7.0.0",
49
49
  "@emotion/react": "^11.7.1",
50
50
  "bind-event-listener": "^2.1.1",
@@ -58,7 +58,7 @@
58
58
  "devDependencies": {
59
59
  "@af/accessibility-testing": "*",
60
60
  "@af/visual-regression": "*",
61
- "@atlaskit/button": "^16.17.0",
61
+ "@atlaskit/button": "^17.2.0",
62
62
  "@atlaskit/icon": "^22.0.0",
63
63
  "@atlaskit/ssr": "*",
64
64
  "@atlaskit/visual-regression": "*",
@@ -102,6 +102,9 @@
102
102
  "platform-feature-flags": {
103
103
  "platform.design-system-team.layering_popup_1cnzt": {
104
104
  "type": "boolean"
105
+ },
106
+ "platform.design-system-team.iframe_gojiv": {
107
+ "type": "boolean"
105
108
  }
106
109
  },
107
110
  "homepage": "https://atlassian.design/components/popup/",
@@ -1,82 +0,0 @@
1
- ## API Report File for "@atlaskit/popup"
2
-
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
-
5
- ```ts
6
-
7
- import { ComponentType } from 'react';
8
- import { CSSProperties } from 'react';
9
- import { Dispatch } from 'react';
10
- import { FC } from 'react';
11
- import { Placement } from '@atlaskit/popper';
12
- import { PopperChildrenProps } from '@atlaskit/popper';
13
- import { default as React_2 } from 'react';
14
- import { ReactNode } from 'react';
15
- import { Ref } from 'react';
16
- import { SetStateAction } from 'react';
17
-
18
- // @public (undocumented)
19
- interface BaseProps {
20
- autoFocus?: boolean;
21
- boundary?: 'clippingParents' | HTMLElement;
22
- content: (props: ContentProps) => React_2.ReactNode;
23
- fallbackPlacements?: Placement[];
24
- id?: string;
25
- isOpen: boolean;
26
- offset?: [number, number];
27
- onClose?(event: Event | React_2.KeyboardEvent | React_2.MouseEvent): void;
28
- placement?: Placement;
29
- popupComponent?: ComponentType<PopupComponentProps>;
30
- rootBoundary?: 'document' | 'viewport';
31
- shouldFlip?: boolean;
32
- shouldRenderToParent?: boolean;
33
- shouldUseCaptureOnOutsideClick?: boolean;
34
- testId?: string;
35
- }
36
-
37
- // @public (undocumented)
38
- export interface ContentProps {
39
- isOpen: boolean;
40
- onClose?: BaseProps['onClose'];
41
- setInitialFocusRef: Dispatch<SetStateAction<HTMLElement | null>>;
42
- update: PopperChildrenProps['update'];
43
- }
44
-
45
- // @public (undocumented)
46
- const Popup: FC<PopupProps>;
47
- export { Popup }
48
- export default Popup;
49
-
50
- // @public (undocumented)
51
- export interface PopupComponentProps {
52
- 'data-placement': Placement;
53
- 'data-testid'?: string;
54
- children: ReactNode;
55
- id?: string;
56
- ref: Ref<HTMLDivElement>;
57
- shouldRenderToParent?: boolean;
58
- style: CSSProperties;
59
- tabIndex: number | undefined;
60
- }
61
-
62
- // @public (undocumented)
63
- export interface PopupProps extends BaseProps {
64
- trigger: (props: TriggerProps) => React_2.ReactNode;
65
- zIndex?: number;
66
- }
67
-
68
- // @public (undocumented)
69
- export interface TriggerProps {
70
- // (undocumented)
71
- 'aria-controls'?: string;
72
- // (undocumented)
73
- 'aria-expanded': boolean;
74
- // (undocumented)
75
- 'aria-haspopup': boolean;
76
- // (undocumented)
77
- ref: Ref<any>;
78
- }
79
-
80
- // (No @packageDocumentation comment for this package)
81
-
82
- ```