@atlaskit/popup 1.20.2 → 1.21.0

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,24 @@
1
1
  # @atlaskit/popup
2
2
 
3
+ ## 1.21.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`8b8090800a35d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8b8090800a35d) -
8
+ Bump peer dependency for react-dom to include version 17 and 18.
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
14
+ ## 1.20.3
15
+
16
+ ### Patch Changes
17
+
18
+ - [#123803](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/123803)
19
+ [`741dadf4fa8f9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/741dadf4fa8f9) -
20
+ Added modifiers prop to the popup
21
+
3
22
  ## 1.20.2
4
23
 
5
24
  ### Patch Changes
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
8
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
11
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
@@ -89,7 +90,8 @@ function PopperWrapper(_ref) {
89
90
  strategy = _ref.strategy,
90
91
  role = _ref.role,
91
92
  label = _ref.label,
92
- titleId = _ref.titleId;
93
+ titleId = _ref.titleId,
94
+ modifiers = _ref.modifiers;
93
95
  var _useState = (0, _react.useState)(null),
94
96
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
95
97
  popupRef = _useState2[0],
@@ -117,7 +119,7 @@ function PopperWrapper(_ref) {
117
119
  });
118
120
  var _UNSAFE_useLayering = (0, _layering.UNSAFE_useLayering)(),
119
121
  currentLevel = _UNSAFE_useLayering.currentLevel;
120
- var modifiers = (0, _react.useMemo)(function () {
122
+ var mergedModifiers = (0, _react.useMemo)(function () {
121
123
  return [{
122
124
  name: 'flip',
123
125
  enabled: shouldFlip,
@@ -126,12 +128,12 @@ function PopperWrapper(_ref) {
126
128
  boundary: boundary,
127
129
  fallbackPlacements: fallbackPlacements
128
130
  }
129
- }];
130
- }, [shouldFlip, rootBoundary, boundary, fallbackPlacements]);
131
+ }].concat((0, _toConsumableArray2.default)(modifiers || []));
132
+ }, [shouldFlip, rootBoundary, boundary, fallbackPlacements, modifiers]);
131
133
  return (0, _react2.jsx)(_popper.Popper, {
132
134
  placement: placement,
133
135
  offset: offset,
134
- modifiers: modifiers,
136
+ modifiers: mergedModifiers,
135
137
  strategy: strategy
136
138
  }, function (_ref2) {
137
139
  var _ref3 = _ref2.ref,
@@ -165,7 +167,7 @@ function PopperWrapper(_ref) {
165
167
  tabIndex: autoFocus ? 0 : undefined,
166
168
  shouldRenderToParent: shouldRenderToParent,
167
169
  shouldFitContainer: shouldFitContainer
168
- }, (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.iframe_gojiv') && (0, _react2.jsx)(_react2.Global, {
170
+ }, (0, _platformFeatureFlags.fg)('platform.design-system-team.iframe_gojiv') && (0, _react2.jsx)(_react2.Global, {
169
171
  styles: blockPointerEventsOnExternalIframeStyles
170
172
  }), (0, _react2.jsx)(_repositionOnUpdate.RepositionOnUpdate, {
171
173
  update: update
package/dist/cjs/popup.js CHANGED
@@ -60,7 +60,8 @@ var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (_ref) {
60
60
  strategy = _ref.strategy,
61
61
  role = _ref.role,
62
62
  label = _ref.label,
63
- titleId = _ref.titleId;
63
+ titleId = _ref.titleId,
64
+ modifiers = _ref.modifiers;
64
65
  var _useState = (0, _react.useState)(null),
65
66
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
66
67
  triggerRef = _useState2[0],
@@ -92,7 +93,8 @@ var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (_ref) {
92
93
  strategy: shouldFitContainer ? 'absolute' : strategy,
93
94
  role: role,
94
95
  label: label,
95
- titleId: titleId
96
+ titleId: titleId,
97
+ modifiers: modifiers
96
98
  }));
97
99
  var popupContent = (0, _react2.jsx)(_popper.Manager, null, (0, _react2.jsx)(_popper.Reference, null, function (_ref2) {
98
100
  var ref = _ref2.ref;
@@ -8,7 +8,7 @@ import { forwardRef, useMemo, useState } from 'react';
8
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
9
  import { css, Global, jsx } from '@emotion/react';
10
10
  import { UNSAFE_useLayering } from '@atlaskit/layering';
11
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
11
+ import { fg } from '@atlaskit/platform-feature-flags';
12
12
  import { Popper } from '@atlaskit/popper';
13
13
  import { N0, N50A, N60A } from '@atlaskit/theme/colors';
14
14
  import { layers } from '@atlaskit/theme/constants';
@@ -69,6 +69,7 @@ function PopperWrapper({
69
69
  rootBoundary,
70
70
  shouldFlip,
71
71
  placement = 'auto',
72
+ // @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
72
73
  popupComponent: PopupContainer = DefaultPopupComponent,
73
74
  autoFocus = true,
74
75
  triggerRef,
@@ -79,7 +80,8 @@ function PopperWrapper({
79
80
  strategy,
80
81
  role,
81
82
  label,
82
- titleId
83
+ titleId,
84
+ modifiers
83
85
  }) {
84
86
  const [popupRef, setPopupRef] = useState(null);
85
87
  const [initialFocusRef, setInitialFocusRef] = useState(null);
@@ -103,7 +105,7 @@ function PopperWrapper({
103
105
  const {
104
106
  currentLevel
105
107
  } = UNSAFE_useLayering();
106
- const modifiers = useMemo(() => [{
108
+ const mergedModifiers = useMemo(() => [{
107
109
  name: 'flip',
108
110
  enabled: shouldFlip,
109
111
  options: {
@@ -111,11 +113,11 @@ function PopperWrapper({
111
113
  boundary,
112
114
  fallbackPlacements
113
115
  }
114
- }], [shouldFlip, rootBoundary, boundary, fallbackPlacements]);
116
+ }, ...(modifiers || [])], [shouldFlip, rootBoundary, boundary, fallbackPlacements, modifiers]);
115
117
  return jsx(Popper, {
116
118
  placement: placement,
117
119
  offset: offset,
118
- modifiers: modifiers,
120
+ modifiers: mergedModifiers,
119
121
  strategy: strategy
120
122
  }, ({
121
123
  ref,
@@ -150,7 +152,7 @@ function PopperWrapper({
150
152
  tabIndex: autoFocus ? 0 : undefined,
151
153
  shouldRenderToParent: shouldRenderToParent,
152
154
  shouldFitContainer: shouldFitContainer
153
- }, getBooleanFF('platform.design-system-team.iframe_gojiv') && jsx(Global, {
155
+ }, fg('platform.design-system-team.iframe_gojiv') && jsx(Global, {
154
156
  styles: blockPointerEventsOnExternalIframeStyles
155
157
  }), jsx(RepositionOnUpdate, {
156
158
  update: update
@@ -42,7 +42,8 @@ export const Popup = /*#__PURE__*/memo(({
42
42
  strategy,
43
43
  role,
44
44
  label,
45
- titleId
45
+ titleId,
46
+ modifiers
46
47
  }) => {
47
48
  const [triggerRef, setTriggerRef] = useState(null);
48
49
  const getMergedTriggerRef = useGetMemoizedMergedTriggerRef();
@@ -72,7 +73,8 @@ export const Popup = /*#__PURE__*/memo(({
72
73
  strategy: shouldFitContainer ? 'absolute' : strategy,
73
74
  role: role,
74
75
  label: label,
75
- titleId: titleId
76
+ titleId: titleId,
77
+ modifiers: modifiers
76
78
  }));
77
79
  const popupContent = jsx(Manager, null, jsx(Reference, null, ({
78
80
  ref
@@ -1,3 +1,4 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
1
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
3
  import _extends from "@babel/runtime/helpers/extends";
3
4
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
@@ -13,7 +14,7 @@ import { forwardRef, useMemo, useState } from 'react';
13
14
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
14
15
  import { css, Global, jsx } from '@emotion/react';
15
16
  import { UNSAFE_useLayering } from '@atlaskit/layering';
16
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
17
+ import { fg } from '@atlaskit/platform-feature-flags';
17
18
  import { Popper } from '@atlaskit/popper';
18
19
  import { N0, N50A, N60A } from '@atlaskit/theme/colors';
19
20
  import { layers } from '@atlaskit/theme/constants';
@@ -83,7 +84,8 @@ function PopperWrapper(_ref) {
83
84
  strategy = _ref.strategy,
84
85
  role = _ref.role,
85
86
  label = _ref.label,
86
- titleId = _ref.titleId;
87
+ titleId = _ref.titleId,
88
+ modifiers = _ref.modifiers;
87
89
  var _useState = useState(null),
88
90
  _useState2 = _slicedToArray(_useState, 2),
89
91
  popupRef = _useState2[0],
@@ -111,7 +113,7 @@ function PopperWrapper(_ref) {
111
113
  });
112
114
  var _UNSAFE_useLayering = UNSAFE_useLayering(),
113
115
  currentLevel = _UNSAFE_useLayering.currentLevel;
114
- var modifiers = useMemo(function () {
116
+ var mergedModifiers = useMemo(function () {
115
117
  return [{
116
118
  name: 'flip',
117
119
  enabled: shouldFlip,
@@ -120,12 +122,12 @@ function PopperWrapper(_ref) {
120
122
  boundary: boundary,
121
123
  fallbackPlacements: fallbackPlacements
122
124
  }
123
- }];
124
- }, [shouldFlip, rootBoundary, boundary, fallbackPlacements]);
125
+ }].concat(_toConsumableArray(modifiers || []));
126
+ }, [shouldFlip, rootBoundary, boundary, fallbackPlacements, modifiers]);
125
127
  return jsx(Popper, {
126
128
  placement: placement,
127
129
  offset: offset,
128
- modifiers: modifiers,
130
+ modifiers: mergedModifiers,
129
131
  strategy: strategy
130
132
  }, function (_ref2) {
131
133
  var _ref3 = _ref2.ref,
@@ -159,7 +161,7 @@ function PopperWrapper(_ref) {
159
161
  tabIndex: autoFocus ? 0 : undefined,
160
162
  shouldRenderToParent: shouldRenderToParent,
161
163
  shouldFitContainer: shouldFitContainer
162
- }, getBooleanFF('platform.design-system-team.iframe_gojiv') && jsx(Global, {
164
+ }, fg('platform.design-system-team.iframe_gojiv') && jsx(Global, {
163
165
  styles: blockPointerEventsOnExternalIframeStyles
164
166
  }), jsx(RepositionOnUpdate, {
165
167
  update: update
package/dist/esm/popup.js CHANGED
@@ -52,7 +52,8 @@ export var Popup = /*#__PURE__*/memo(function (_ref) {
52
52
  strategy = _ref.strategy,
53
53
  role = _ref.role,
54
54
  label = _ref.label,
55
- titleId = _ref.titleId;
55
+ titleId = _ref.titleId,
56
+ modifiers = _ref.modifiers;
56
57
  var _useState = useState(null),
57
58
  _useState2 = _slicedToArray(_useState, 2),
58
59
  triggerRef = _useState2[0],
@@ -84,7 +85,8 @@ export var Popup = /*#__PURE__*/memo(function (_ref) {
84
85
  strategy: shouldFitContainer ? 'absolute' : strategy,
85
86
  role: role,
86
87
  label: label,
87
- titleId: titleId
88
+ titleId: titleId,
89
+ modifiers: modifiers
88
90
  }));
89
91
  var popupContent = jsx(Manager, null, jsx(Reference, null, function (_ref2) {
90
92
  var ref = _ref2.ref;
@@ -1,4 +1,4 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import { type PopperWrapperProps } from './types';
3
- declare function PopperWrapper({ isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldFitContainer, shouldDisableFocusLock, strategy, role, label, titleId, }: PopperWrapperProps): jsx.JSX.Element;
3
+ declare function PopperWrapper({ isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldFitContainer, shouldDisableFocusLock, strategy, role, label, titleId, modifiers, }: PopperWrapperProps): jsx.JSX.Element;
4
4
  export default PopperWrapper;
@@ -1,5 +1,5 @@
1
1
  import { type ComponentType, type CSSProperties, type Dispatch, type PropsWithChildren, type default as React, type ReactNode, type Ref, type SetStateAction } from 'react';
2
- import { type Placement, type PopperChildrenProps } from '@atlaskit/popper';
2
+ import { type Modifier, type Placement, type PopperChildrenProps } from '@atlaskit/popper';
3
3
  export interface TriggerProps {
4
4
  ref: Ref<any>;
5
5
  'aria-controls'?: string;
@@ -189,6 +189,11 @@ interface BaseProps {
189
189
  * Usage of either this, or the `label` attribute is strongly recommended.
190
190
  */
191
191
  titleId?: string;
192
+ /**
193
+ * Additional modifiers and modifier overwrites.
194
+ * for more details - https://popper.js.org/docs/v1/#modifiers
195
+ */
196
+ modifiers?: Partial<Modifier<string, object>>[];
192
197
  }
193
198
  interface InternalPopupProps extends BaseProps {
194
199
  /**
@@ -1,4 +1,4 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import { type PopperWrapperProps } from './types';
3
- declare function PopperWrapper({ isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldFitContainer, shouldDisableFocusLock, strategy, role, label, titleId, }: PopperWrapperProps): jsx.JSX.Element;
3
+ declare function PopperWrapper({ isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldFitContainer, shouldDisableFocusLock, strategy, role, label, titleId, modifiers, }: PopperWrapperProps): jsx.JSX.Element;
4
4
  export default PopperWrapper;
@@ -1,5 +1,5 @@
1
1
  import { type ComponentType, type CSSProperties, type Dispatch, type PropsWithChildren, type default as React, type ReactNode, type Ref, type SetStateAction } from 'react';
2
- import { type Placement, type PopperChildrenProps } from '@atlaskit/popper';
2
+ import { type Modifier, type Placement, type PopperChildrenProps } from '@atlaskit/popper';
3
3
  export interface TriggerProps {
4
4
  ref: Ref<any>;
5
5
  'aria-controls'?: string;
@@ -192,6 +192,11 @@ interface BaseProps {
192
192
  * Usage of either this, or the `label` attribute is strongly recommended.
193
193
  */
194
194
  titleId?: string;
195
+ /**
196
+ * Additional modifiers and modifier overwrites.
197
+ * for more details - https://popper.js.org/docs/v1/#modifiers
198
+ */
199
+ modifiers?: Partial<Modifier<string, object>>[];
195
200
  }
196
201
  interface InternalPopupProps extends BaseProps {
197
202
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/popup",
3
- "version": "1.20.2",
3
+ "version": "1.21.0",
4
4
  "description": "A popup displays brief content in an overlay.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -44,10 +44,10 @@
44
44
  "@atlaskit/layering": "^0.3.0",
45
45
  "@atlaskit/platform-feature-flags": "^0.3.0",
46
46
  "@atlaskit/popper": "^6.1.0",
47
- "@atlaskit/portal": "^4.6.0",
48
- "@atlaskit/primitives": "^11.0.0",
47
+ "@atlaskit/portal": "^4.7.0",
48
+ "@atlaskit/primitives": "^11.1.0",
49
49
  "@atlaskit/theme": "^12.11.0",
50
- "@atlaskit/tokens": "^1.56.0",
50
+ "@atlaskit/tokens": "^1.57.0",
51
51
  "@babel/runtime": "^7.0.0",
52
52
  "@emotion/react": "^11.7.1",
53
53
  "bind-event-listener": "^3.0.0",
@@ -58,13 +58,13 @@
58
58
  },
59
59
  "peerDependencies": {
60
60
  "react": "^16.8.0 || ^17.0.0 || ~18.2.0",
61
- "react-dom": "^16.8.0"
61
+ "react-dom": "^16.8.0 || ^17.0.0 || ~18.2.0"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@af/accessibility-testing": "*",
65
65
  "@af/visual-regression": "*",
66
- "@atlaskit/button": "^19.0.0",
67
- "@atlaskit/icon": "^22.7.0",
66
+ "@atlaskit/button": "^19.1.0",
67
+ "@atlaskit/icon": "^22.10.0",
68
68
  "@atlaskit/ssr": "*",
69
69
  "@atlaskit/textfield": "^6.4.0",
70
70
  "@atlaskit/toggle": "^13.2.0",