@atlaskit/popup 3.0.1 → 4.1.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 +33 -0
- package/dist/cjs/compositional/popup.js +1 -2
- package/dist/cjs/popper-wrapper.compiled.css +20 -0
- package/dist/cjs/popper-wrapper.js +36 -58
- package/dist/cjs/popup.compiled.css +1 -0
- package/dist/cjs/popup.js +19 -21
- package/dist/cjs/use-appearance.js +2 -2
- package/dist/es2019/compositional/popup.js +1 -2
- package/dist/es2019/popper-wrapper.compiled.css +20 -0
- package/dist/es2019/popper-wrapper.js +31 -57
- package/dist/es2019/popup.compiled.css +1 -0
- package/dist/es2019/popup.js +15 -19
- package/dist/es2019/use-appearance.js +1 -1
- package/dist/esm/compositional/popup.js +1 -2
- package/dist/esm/popper-wrapper.compiled.css +20 -0
- package/dist/esm/popper-wrapper.js +32 -57
- package/dist/esm/popup.compiled.css +1 -0
- package/dist/esm/popup.js +16 -19
- package/dist/esm/use-appearance.js +1 -1
- package/dist/types/popper-wrapper.d.ts +2 -2
- package/dist/types/types.d.ts +9 -2
- package/dist/types-ts4.5/popper-wrapper.d.ts +2 -2
- package/dist/types-ts4.5/types.d.ts +9 -2
- package/package.json +9 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @atlaskit/popup
|
|
2
2
|
|
|
3
|
+
## 4.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#142168](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/142168)
|
|
8
|
+
[`92095a01848e7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/92095a01848e7) -
|
|
9
|
+
The bounded style overrides prop (xcss) now supports logical longhand properties for padding.
|
|
10
|
+
|
|
11
|
+
## 4.0.0
|
|
12
|
+
|
|
13
|
+
### Major Changes
|
|
14
|
+
|
|
15
|
+
- [#137034](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/137034)
|
|
16
|
+
[`a832dd489aab3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a832dd489aab3) - -
|
|
17
|
+
Migrated from `@emotion/react` to `@compiled/react` in order to improve performance, align with
|
|
18
|
+
the rest of the Atlaskit techstack, and support React 18 Streaming SSR.
|
|
19
|
+
|
|
20
|
+
- Added a `className` prop for applying a focus ring to the custom popup container (Currently
|
|
21
|
+
controlled by the feature flag `platform-design-system-apply-popup-wrapper-focus`). See usage
|
|
22
|
+
example [here](https://atlassian.design/components/popup/examples#customization).
|
|
23
|
+
|
|
24
|
+
Please note, in order to use this version of `@atlaskit/popup`, you will need to ensure that your
|
|
25
|
+
bundler is configured to handle `.css` imports correctly.
|
|
26
|
+
|
|
27
|
+
Most bundlers come with built-in support for `.css` imports, so you may not need to do anything.
|
|
28
|
+
If you are using a different bundler, please refer to the documentation for that bundler to
|
|
29
|
+
understand how to handle `.css` imports. For more information on the migration, please refer to
|
|
30
|
+
[RFC-73 Migrating our components to Compiled CSS-in-JS](https://community.developer.atlassian.com/t/rfc-73-migrating-our-components-to-compiled-css-in-js/85953).
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- Updated dependencies
|
|
35
|
+
|
|
3
36
|
## 3.0.1
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
|
@@ -15,7 +15,6 @@ var _layering = require("@atlaskit/layering");
|
|
|
15
15
|
var _openLayerObserver = require("@atlaskit/layering/experimental/open-layer-observer");
|
|
16
16
|
var _popper = require("@atlaskit/popper");
|
|
17
17
|
var _portal = _interopRequireDefault(require("@atlaskit/portal"));
|
|
18
|
-
var _constants = require("@atlaskit/theme/constants");
|
|
19
18
|
var _popperWrapper = _interopRequireDefault(require("../popper-wrapper"));
|
|
20
19
|
var _useAppearance = require("../use-appearance");
|
|
21
20
|
var _useGetMemoizedMergedTriggerRef = require("../use-get-memoized-merged-trigger-ref");
|
|
@@ -99,7 +98,7 @@ var PopupTrigger = exports.PopupTrigger = function PopupTrigger(_ref2) {
|
|
|
99
98
|
});
|
|
100
99
|
});
|
|
101
100
|
};
|
|
102
|
-
var defaultLayer =
|
|
101
|
+
var defaultLayer = 400;
|
|
103
102
|
/**
|
|
104
103
|
* Disables popper.js GPU acceleration for this popup.
|
|
105
104
|
* This means only positioning will be used, without any transforms.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
._1r04idpf{inset:0}
|
|
3
|
+
._2rkoglpi{border-radius:var(--ds-border-radius,4px)}
|
|
4
|
+
._dk5d1b66{inset-inline:var(--ds-space-050,4px)}._152t1b66{inset-block-start:var(--ds-space-050,4px)}
|
|
5
|
+
._16qs1cd0{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #091e4226,0 0 1px #091e424f)}
|
|
6
|
+
._18m91wug{overflow-y:auto}
|
|
7
|
+
._1bsb1osq{width:100%}
|
|
8
|
+
._1e0c1ule{display:block}
|
|
9
|
+
._1pby1nn1{z-index:400}
|
|
10
|
+
._1q1l1bhr{--ds-elevation-surface-current:var(--ds-surface-overlay,#fff)}
|
|
11
|
+
._1reo1wug{overflow-x:auto}
|
|
12
|
+
._bfhk10xm{background-color:var(--ds-blanket,#091e427d)}
|
|
13
|
+
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|
|
14
|
+
._c71ldtre{max-height:50vh}
|
|
15
|
+
._kqsw1n9t{position:fixed}
|
|
16
|
+
._syaz1fxt{color:var(--ds-text,#172b4d)}
|
|
17
|
+
._vchhusvi{box-sizing:border-box}
|
|
18
|
+
._1hvw1o36:focus{outline-width:medium}
|
|
19
|
+
._49pcglyw:focus{outline-style:none}
|
|
20
|
+
._nt751r31:focus{outline-color:currentColor}
|
|
@@ -1,76 +1,50 @@
|
|
|
1
|
+
/* popper-wrapper.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
1
2
|
"use strict";
|
|
2
3
|
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
6
|
Object.defineProperty(exports, "__esModule", {
|
|
5
7
|
value: true
|
|
6
8
|
});
|
|
7
9
|
exports.default = void 0;
|
|
10
|
+
require("./popper-wrapper.compiled.css");
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var React = _react;
|
|
8
13
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
15
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
16
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
|
-
var
|
|
13
|
-
var _react = require("react");
|
|
14
|
-
var _react2 = require("@emotion/react");
|
|
15
|
-
var _focusRing = _interopRequireDefault(require("@atlaskit/focus-ring"));
|
|
17
|
+
var _runtime = require("@compiled/react/runtime");
|
|
16
18
|
var _layering = require("@atlaskit/layering");
|
|
17
19
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
20
|
var _popper = require("@atlaskit/popper");
|
|
19
|
-
var _colors = require("@atlaskit/theme/colors");
|
|
20
|
-
var _constants = require("@atlaskit/theme/constants");
|
|
21
|
-
var _tokens = require("@atlaskit/tokens");
|
|
22
21
|
var _repositionOnUpdate = require("./reposition-on-update");
|
|
23
22
|
var _useCloseManager = require("./use-close-manager");
|
|
24
23
|
var _useFocusManager = require("./use-focus-manager");
|
|
25
|
-
var _excluded = ["shouldRenderToParent", "shouldFitContainer", "children", "appearance", "
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
boxShadow: "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(_colors.N50A, ", 0 0 1px ").concat(_colors.N60A), ")"),
|
|
40
|
-
// Resetting text color for portal content.
|
|
41
|
-
// Otherwise, when rendering into the parent (not using a portal),
|
|
42
|
-
// the text color can be inherited from the parent.
|
|
43
|
-
color: "var(--ds-text, #172B4D)"
|
|
44
|
-
}, _tokens.CURRENT_SURFACE_CSS_VAR, "var(--ds-surface-overlay, ".concat(_colors.N0, ")")), '&:focus', {
|
|
45
|
-
outline: 'none'
|
|
46
|
-
}));
|
|
47
|
-
var scrollableStyles = (0, _react2.css)({
|
|
48
|
-
overflow: 'auto'
|
|
49
|
-
});
|
|
50
|
-
var blanketStyles = (0, _react2.css)({
|
|
51
|
-
position: 'fixed',
|
|
52
|
-
inset: 0,
|
|
53
|
-
backgroundColor: "var(--ds-blanket, #091E427D)"
|
|
54
|
-
});
|
|
55
|
-
var modalStyles = (0, _react2.css)({
|
|
56
|
-
maxHeight: '50vh',
|
|
57
|
-
position: 'fixed',
|
|
58
|
-
insetBlockStart: "var(--ds-space-050, 4px)",
|
|
59
|
-
insetInline: "var(--ds-space-050, 4px)"
|
|
60
|
-
});
|
|
24
|
+
var _excluded = ["shouldRenderToParent", "shouldFitContainer", "children", "appearance", "className"];
|
|
25
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
26
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
27
|
+
var LOCAL_CURRENT_SURFACE_CSS_VAR = '--ds-elevation-surface-current';
|
|
28
|
+
var fullWidthStyles = null;
|
|
29
|
+
var wrapperStyles = {
|
|
30
|
+
root: "_2rkoglpi _1e0c1ule _vchhusvi _1pby1nn1 _bfhk1bhr _16qs1cd0 _syaz1fxt _1q1l1bhr _nt751r31 _49pcglyw _1hvw1o36"
|
|
31
|
+
};
|
|
32
|
+
var scrollableStyles = null;
|
|
33
|
+
var blanketStyles = null;
|
|
34
|
+
var modalStyles = null;
|
|
35
|
+
var focusRingStyles = {
|
|
36
|
+
root: "_mizu194a _1ah31bk5 _ra3xnqa1 _128m1bk5 _1cvmnqa1 _4davt94y"
|
|
37
|
+
};
|
|
61
38
|
var DefaultPopupComponent = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
62
39
|
var shouldRenderToParent = props.shouldRenderToParent,
|
|
63
40
|
shouldFitContainer = props.shouldFitContainer,
|
|
64
41
|
children = props.children,
|
|
65
42
|
appearance = props.appearance,
|
|
66
|
-
|
|
43
|
+
className = props.className,
|
|
67
44
|
htmlAttributes = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
68
|
-
return
|
|
69
|
-
//
|
|
70
|
-
|
|
71
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- This rule still fails because of the TS assertion
|
|
72
|
-
className: xcss,
|
|
73
|
-
css: [rootStyles, appearance === 'UNSAFE_modal-below-sm' && modalStyles, !shouldRenderToParent && scrollableStyles, shouldFitContainer && fullWidthStyles]
|
|
45
|
+
return /*#__PURE__*/React.createElement("div", (0, _extends2.default)({
|
|
46
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
47
|
+
className: (0, _runtime.ax)([wrapperStyles.root, appearance === 'UNSAFE_modal-below-sm' && "_dk5d1b66 _c71ldtre _kqsw1n9t _152t1b66", !shouldRenderToParent && "_1reo1wug _18m91wug", shouldFitContainer && "_1bsb1osq", className])
|
|
74
48
|
}, htmlAttributes, {
|
|
75
49
|
ref: ref
|
|
76
50
|
}), children);
|
|
@@ -152,7 +126,7 @@ function PopperWrapper(_ref) {
|
|
|
152
126
|
}
|
|
153
127
|
}].concat((0, _toConsumableArray2.default)(modifiers || []));
|
|
154
128
|
}, [shouldFlip, rootBoundary, boundary, fallbackPlacements, modifiers]);
|
|
155
|
-
return
|
|
129
|
+
return /*#__PURE__*/React.createElement(_popper.Popper, {
|
|
156
130
|
placement: placement,
|
|
157
131
|
offset: offset,
|
|
158
132
|
modifiers: mergedModifiers,
|
|
@@ -163,8 +137,14 @@ function PopperWrapper(_ref) {
|
|
|
163
137
|
style = _ref2.style,
|
|
164
138
|
placement = _ref2.placement,
|
|
165
139
|
update = _ref2.update;
|
|
166
|
-
var popupContainer =
|
|
167
|
-
|
|
140
|
+
var popupContainer = /*#__PURE__*/React.createElement(PopupContainer
|
|
141
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
142
|
+
, {
|
|
143
|
+
className: (0, _runtime.ax)([xcss,
|
|
144
|
+
// @ts-expect-error: `ax` is not typed correctly
|
|
145
|
+
!initialFocusRef &&
|
|
146
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
147
|
+
(0, _platformFeatureFlags.fg)('platform-design-system-apply-popup-wrapper-focus') && focusRingStyles.root]),
|
|
168
148
|
appearance: appearance,
|
|
169
149
|
id: id,
|
|
170
150
|
"data-ds--level": currentLevel,
|
|
@@ -192,7 +172,7 @@ function PopperWrapper(_ref) {
|
|
|
192
172
|
tabIndex: autoFocus ? 0 : undefined,
|
|
193
173
|
shouldRenderToParent: shouldRenderToParent,
|
|
194
174
|
shouldFitContainer: shouldFitContainer
|
|
195
|
-
},
|
|
175
|
+
}, /*#__PURE__*/React.createElement(_repositionOnUpdate.RepositionOnUpdate, {
|
|
196
176
|
update: update
|
|
197
177
|
}, content({
|
|
198
178
|
update: update,
|
|
@@ -200,10 +180,8 @@ function PopperWrapper(_ref) {
|
|
|
200
180
|
onClose: onClose,
|
|
201
181
|
setInitialFocusRef: setInitialFocusRef
|
|
202
182
|
})));
|
|
203
|
-
return
|
|
204
|
-
|
|
205
|
-
})) : (0, _react2.jsx)(_react.Fragment, null, popupContainer, appearance === 'UNSAFE_modal-below-sm' && (0, _react2.jsx)("div", {
|
|
206
|
-
css: blanketStyles
|
|
183
|
+
return /*#__PURE__*/React.createElement(_react.Fragment, null, popupContainer, appearance === 'UNSAFE_modal-below-sm' && /*#__PURE__*/React.createElement("div", {
|
|
184
|
+
className: (0, _runtime.ax)(["_1r04idpf _kqsw1n9t _bfhk10xm"])
|
|
207
185
|
}));
|
|
208
186
|
});
|
|
209
187
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._kqswh2mm{position:relative}
|
package/dist/cjs/popup.js
CHANGED
|
@@ -1,37 +1,35 @@
|
|
|
1
|
+
/* popup.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
1
2
|
"use strict";
|
|
2
3
|
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
6
|
Object.defineProperty(exports, "__esModule", {
|
|
5
7
|
value: true
|
|
6
8
|
});
|
|
7
9
|
exports.Popup = void 0;
|
|
10
|
+
require("./popup.compiled.css");
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var React = _react;
|
|
13
|
+
var _runtime = require("@compiled/react/runtime");
|
|
8
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
-
var _react = require("react");
|
|
10
|
-
var _react2 = require("@emotion/react");
|
|
11
15
|
var _useId = require("@atlaskit/ds-lib/use-id");
|
|
12
16
|
var _layering = require("@atlaskit/layering");
|
|
13
17
|
var _openLayerObserver = require("@atlaskit/layering/experimental/open-layer-observer");
|
|
14
18
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
19
|
var _popper = require("@atlaskit/popper");
|
|
16
20
|
var _portal = _interopRequireDefault(require("@atlaskit/portal"));
|
|
17
|
-
var
|
|
18
|
-
var _constants = require("@atlaskit/theme/constants");
|
|
21
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
19
22
|
var _popperWrapper = _interopRequireDefault(require("./popper-wrapper"));
|
|
20
23
|
var _useAppearance = require("./use-appearance");
|
|
21
24
|
var _useGetMemoizedMergedTriggerRef = require("./use-get-memoized-merged-trigger-ref");
|
|
22
25
|
var _useGetMemoizedMergedTriggerRefNew = require("./use-get-memoized-merged-trigger-ref-new");
|
|
26
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
27
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
23
28
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
30
|
-
|
|
31
|
-
var defaultLayer = _constants.layers.layer();
|
|
32
|
-
var wrapperStyles = (0, _primitives.xcss)({
|
|
33
|
-
position: 'relative'
|
|
34
|
-
});
|
|
29
|
+
var defaultLayer = 400;
|
|
30
|
+
var wrapperStyles = {
|
|
31
|
+
root: "_kqswh2mm"
|
|
32
|
+
};
|
|
35
33
|
var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
36
34
|
var xcss = _ref.xcss,
|
|
37
35
|
_ref$appearance = _ref.appearance,
|
|
@@ -93,9 +91,9 @@ var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
93
91
|
isOpen: isOpen,
|
|
94
92
|
onClose: handleOpenLayerObserverCloseSignal
|
|
95
93
|
});
|
|
96
|
-
var renderPopperWrapper =
|
|
94
|
+
var renderPopperWrapper = /*#__PURE__*/React.createElement(_layering.Layering, {
|
|
97
95
|
isDisabled: false
|
|
98
|
-
},
|
|
96
|
+
}, /*#__PURE__*/React.createElement(_popperWrapper.default, {
|
|
99
97
|
xcss: xcss,
|
|
100
98
|
appearance: appearance,
|
|
101
99
|
content: content,
|
|
@@ -124,7 +122,7 @@ var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
124
122
|
modifiers: modifiers,
|
|
125
123
|
shouldFitViewport: shouldFitViewport
|
|
126
124
|
}));
|
|
127
|
-
var popupContent =
|
|
125
|
+
var popupContent = /*#__PURE__*/React.createElement(_popper.Manager, null, /*#__PURE__*/React.createElement(_popper.Reference, null, function (_ref2) {
|
|
128
126
|
var ref = _ref2.ref;
|
|
129
127
|
return trigger({
|
|
130
128
|
ref: !(0, _platformFeatureFlags.fg)('platform-design-system-popup-ref') ? getMergedTriggerRef(ref, setTriggerRef, isOpen) : getMergedTriggerRefNew(ref, setTriggerRef),
|
|
@@ -132,12 +130,12 @@ var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
132
130
|
'aria-expanded': isOpen,
|
|
133
131
|
'aria-haspopup': role === 'dialog' && (0, _platformFeatureFlags.fg)('platform_dst_popup-disable-focuslock') ? 'dialog' : true
|
|
134
132
|
});
|
|
135
|
-
}), isOpen && (shouldRenderToParent || shouldFitContainer ? renderPopperWrapper :
|
|
133
|
+
}), isOpen && (shouldRenderToParent || shouldFitContainer ? renderPopperWrapper : /*#__PURE__*/React.createElement(_portal.default, {
|
|
136
134
|
zIndex: zIndex
|
|
137
135
|
}, renderPopperWrapper)));
|
|
138
136
|
if (shouldFitContainer) {
|
|
139
|
-
return
|
|
140
|
-
xcss: wrapperStyles
|
|
137
|
+
return /*#__PURE__*/React.createElement(_compiled.Box, {
|
|
138
|
+
xcss: wrapperStyles.root
|
|
141
139
|
}, popupContent);
|
|
142
140
|
}
|
|
143
141
|
return popupContent;
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.usePopupAppearance = usePopupAppearance;
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _react = require("react");
|
|
10
|
-
var
|
|
10
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
11
11
|
/**
|
|
12
12
|
* **usePopupAppearance()**
|
|
13
13
|
*
|
|
@@ -19,7 +19,7 @@ var _responsive = require("@atlaskit/primitives/responsive");
|
|
|
19
19
|
function usePopupAppearance(_ref) {
|
|
20
20
|
var _appearance = _ref.appearance,
|
|
21
21
|
_shouldRenderToParent = _ref.shouldRenderToParent;
|
|
22
|
-
var mq = (0,
|
|
22
|
+
var mq = (0, _compiled.UNSAFE_useMediaQuery)('below.sm', function (e) {
|
|
23
23
|
setIsSmallViewport(!!e.matches);
|
|
24
24
|
});
|
|
25
25
|
var _useState = (0, _react.useState)(!!(mq !== null && mq !== void 0 && mq.matches)),
|
|
@@ -6,7 +6,6 @@ import { Layering } from '@atlaskit/layering';
|
|
|
6
6
|
import { useNotifyOpenLayerObserver } from '@atlaskit/layering/experimental/open-layer-observer';
|
|
7
7
|
import { Manager, Reference } from '@atlaskit/popper';
|
|
8
8
|
import Portal from '@atlaskit/portal';
|
|
9
|
-
import { layers } from '@atlaskit/theme/constants';
|
|
10
9
|
import PopperWrapper from '../popper-wrapper';
|
|
11
10
|
import { usePopupAppearance } from '../use-appearance';
|
|
12
11
|
import { useGetMemoizedMergedTriggerRef } from '../use-get-memoized-merged-trigger-ref';
|
|
@@ -85,7 +84,7 @@ export const PopupTrigger = ({
|
|
|
85
84
|
'aria-haspopup': true
|
|
86
85
|
}));
|
|
87
86
|
};
|
|
88
|
-
const defaultLayer =
|
|
87
|
+
const defaultLayer = 400;
|
|
89
88
|
/**
|
|
90
89
|
* Disables popper.js GPU acceleration for this popup.
|
|
91
90
|
* This means only positioning will be used, without any transforms.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
._1r04idpf{inset:0}
|
|
3
|
+
._2rkoglpi{border-radius:var(--ds-border-radius,4px)}
|
|
4
|
+
._dk5d1b66{inset-inline:var(--ds-space-050,4px)}._152t1b66{inset-block-start:var(--ds-space-050,4px)}
|
|
5
|
+
._16qs1cd0{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #091e4226,0 0 1px #091e424f)}
|
|
6
|
+
._18m91wug{overflow-y:auto}
|
|
7
|
+
._1bsb1osq{width:100%}
|
|
8
|
+
._1e0c1ule{display:block}
|
|
9
|
+
._1pby1nn1{z-index:400}
|
|
10
|
+
._1q1l1bhr{--ds-elevation-surface-current:var(--ds-surface-overlay,#fff)}
|
|
11
|
+
._1reo1wug{overflow-x:auto}
|
|
12
|
+
._bfhk10xm{background-color:var(--ds-blanket,#091e427d)}
|
|
13
|
+
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|
|
14
|
+
._c71ldtre{max-height:50vh}
|
|
15
|
+
._kqsw1n9t{position:fixed}
|
|
16
|
+
._syaz1fxt{color:var(--ds-text,#172b4d)}
|
|
17
|
+
._vchhusvi{box-sizing:border-box}
|
|
18
|
+
._1hvw1o36:focus{outline-width:medium}
|
|
19
|
+
._49pcglyw:focus{outline-style:none}
|
|
20
|
+
._nt751r31:focus{outline-color:currentColor}
|
|
@@ -1,68 +1,38 @@
|
|
|
1
|
+
/* popper-wrapper.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* @jsx jsx
|
|
5
|
-
*/
|
|
3
|
+
import "./popper-wrapper.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
6
5
|
import { forwardRef, Fragment, useMemo, useState } from 'react';
|
|
7
|
-
import {
|
|
8
|
-
import FocusRing from '@atlaskit/focus-ring';
|
|
6
|
+
import { ax, ix } from '@compiled/react/runtime';
|
|
9
7
|
import { useLayering } from '@atlaskit/layering';
|
|
10
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
9
|
import { Popper } from '@atlaskit/popper';
|
|
12
|
-
import { N0, N50A, N60A } from '@atlaskit/theme/colors';
|
|
13
|
-
import { layers } from '@atlaskit/theme/constants';
|
|
14
|
-
import { CURRENT_SURFACE_CSS_VAR } from '@atlaskit/tokens';
|
|
15
10
|
import { RepositionOnUpdate } from './reposition-on-update';
|
|
16
11
|
import { useCloseManager } from './use-close-manager';
|
|
17
12
|
import { useFocusManager } from './use-focus-manager';
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// Otherwise, when rendering into the parent (not using a portal),
|
|
30
|
-
// the text color can be inherited from the parent.
|
|
31
|
-
color: "var(--ds-text, #172B4D)",
|
|
32
|
-
[CURRENT_SURFACE_CSS_VAR]: `var(--ds-surface-overlay, ${N0})`,
|
|
33
|
-
'&:focus': {
|
|
34
|
-
outline: 'none'
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
const scrollableStyles = css({
|
|
38
|
-
overflow: 'auto'
|
|
39
|
-
});
|
|
40
|
-
const blanketStyles = css({
|
|
41
|
-
position: 'fixed',
|
|
42
|
-
inset: 0,
|
|
43
|
-
backgroundColor: "var(--ds-blanket, #091E427D)"
|
|
44
|
-
});
|
|
45
|
-
const modalStyles = css({
|
|
46
|
-
maxHeight: '50vh',
|
|
47
|
-
position: 'fixed',
|
|
48
|
-
insetBlockStart: "var(--ds-space-050, 4px)",
|
|
49
|
-
insetInline: "var(--ds-space-050, 4px)"
|
|
50
|
-
});
|
|
13
|
+
const LOCAL_CURRENT_SURFACE_CSS_VAR = '--ds-elevation-surface-current';
|
|
14
|
+
const fullWidthStyles = null;
|
|
15
|
+
const wrapperStyles = {
|
|
16
|
+
root: "_2rkoglpi _1e0c1ule _vchhusvi _1pby1nn1 _bfhk1bhr _16qs1cd0 _syaz1fxt _1q1l1bhr _nt751r31 _49pcglyw _1hvw1o36"
|
|
17
|
+
};
|
|
18
|
+
const scrollableStyles = null;
|
|
19
|
+
const blanketStyles = null;
|
|
20
|
+
const modalStyles = null;
|
|
21
|
+
const focusRingStyles = {
|
|
22
|
+
root: "_mizu194a _1ah31bk5 _ra3xnqa1 _128m1bk5 _1cvmnqa1 _4davt94y"
|
|
23
|
+
};
|
|
51
24
|
const DefaultPopupComponent = /*#__PURE__*/forwardRef((props, ref) => {
|
|
52
25
|
const {
|
|
53
26
|
shouldRenderToParent,
|
|
54
27
|
shouldFitContainer,
|
|
55
28
|
children,
|
|
56
29
|
appearance,
|
|
57
|
-
|
|
30
|
+
className,
|
|
58
31
|
...htmlAttributes
|
|
59
32
|
} = props;
|
|
60
|
-
return
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- This rule still fails because of the TS assertion
|
|
64
|
-
className: xcss,
|
|
65
|
-
css: [rootStyles, appearance === 'UNSAFE_modal-below-sm' && modalStyles, !shouldRenderToParent && scrollableStyles, shouldFitContainer && fullWidthStyles]
|
|
33
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
34
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
35
|
+
className: ax([wrapperStyles.root, appearance === 'UNSAFE_modal-below-sm' && "_dk5d1b66 _c71ldtre _kqsw1n9t _152t1b66", !shouldRenderToParent && "_1reo1wug _18m91wug", shouldFitContainer && "_1bsb1osq", className])
|
|
66
36
|
}, htmlAttributes, {
|
|
67
37
|
ref: ref
|
|
68
38
|
}), children);
|
|
@@ -134,7 +104,7 @@ function PopperWrapper({
|
|
|
134
104
|
fallbackPlacements
|
|
135
105
|
}
|
|
136
106
|
}, ...(modifiers || [])], [shouldFlip, rootBoundary, boundary, fallbackPlacements, modifiers]);
|
|
137
|
-
return
|
|
107
|
+
return /*#__PURE__*/React.createElement(Popper, {
|
|
138
108
|
placement: placement,
|
|
139
109
|
offset: offset,
|
|
140
110
|
modifiers: mergedModifiers,
|
|
@@ -146,8 +116,14 @@ function PopperWrapper({
|
|
|
146
116
|
placement,
|
|
147
117
|
update
|
|
148
118
|
}) => {
|
|
149
|
-
const popupContainer =
|
|
150
|
-
|
|
119
|
+
const popupContainer = /*#__PURE__*/React.createElement(PopupContainer
|
|
120
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
121
|
+
, {
|
|
122
|
+
className: ax([xcss,
|
|
123
|
+
// @ts-expect-error: `ax` is not typed correctly
|
|
124
|
+
!initialFocusRef &&
|
|
125
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
126
|
+
fg('platform-design-system-apply-popup-wrapper-focus') && focusRingStyles.root]),
|
|
151
127
|
appearance: appearance,
|
|
152
128
|
id: id,
|
|
153
129
|
"data-ds--level": currentLevel,
|
|
@@ -175,7 +151,7 @@ function PopperWrapper({
|
|
|
175
151
|
tabIndex: autoFocus ? 0 : undefined,
|
|
176
152
|
shouldRenderToParent: shouldRenderToParent,
|
|
177
153
|
shouldFitContainer: shouldFitContainer
|
|
178
|
-
},
|
|
154
|
+
}, /*#__PURE__*/React.createElement(RepositionOnUpdate, {
|
|
179
155
|
update: update
|
|
180
156
|
}, content({
|
|
181
157
|
update,
|
|
@@ -183,10 +159,8 @@ function PopperWrapper({
|
|
|
183
159
|
onClose,
|
|
184
160
|
setInitialFocusRef
|
|
185
161
|
})));
|
|
186
|
-
return
|
|
187
|
-
|
|
188
|
-
})) : jsx(Fragment, null, popupContainer, appearance === 'UNSAFE_modal-below-sm' && jsx("div", {
|
|
189
|
-
css: blanketStyles
|
|
162
|
+
return /*#__PURE__*/React.createElement(Fragment, null, popupContainer, appearance === 'UNSAFE_modal-below-sm' && /*#__PURE__*/React.createElement("div", {
|
|
163
|
+
className: ax(["_1r04idpf _kqsw1n9t _bfhk10xm"])
|
|
190
164
|
}));
|
|
191
165
|
});
|
|
192
166
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._kqswh2mm{position:relative}
|
package/dist/es2019/popup.js
CHANGED
|
@@ -1,28 +1,24 @@
|
|
|
1
|
+
/* popup.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
1
2
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
*/
|
|
3
|
+
import "./popup.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import { memo, useCallback, useState } from 'react';
|
|
7
|
-
|
|
8
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
|
-
import { jsx } from '@emotion/react';
|
|
10
7
|
import { useId } from '@atlaskit/ds-lib/use-id';
|
|
11
8
|
import { Layering } from '@atlaskit/layering';
|
|
12
9
|
import { useNotifyOpenLayerObserver } from '@atlaskit/layering/experimental/open-layer-observer';
|
|
13
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
11
|
import { Manager, Reference } from '@atlaskit/popper';
|
|
15
12
|
import Portal from '@atlaskit/portal';
|
|
16
|
-
import { Box
|
|
17
|
-
import { layers } from '@atlaskit/theme/constants';
|
|
13
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
18
14
|
import PopperWrapper from './popper-wrapper';
|
|
19
15
|
import { usePopupAppearance } from './use-appearance';
|
|
20
16
|
import { useGetMemoizedMergedTriggerRef } from './use-get-memoized-merged-trigger-ref';
|
|
21
17
|
import { useGetMemoizedMergedTriggerRefNew } from './use-get-memoized-merged-trigger-ref-new';
|
|
22
|
-
const defaultLayer =
|
|
23
|
-
const wrapperStyles =
|
|
24
|
-
|
|
25
|
-
}
|
|
18
|
+
const defaultLayer = 400;
|
|
19
|
+
const wrapperStyles = {
|
|
20
|
+
root: "_kqswh2mm"
|
|
21
|
+
};
|
|
26
22
|
export const Popup = /*#__PURE__*/memo(({
|
|
27
23
|
xcss,
|
|
28
24
|
appearance: inAppearance = 'default',
|
|
@@ -72,9 +68,9 @@ export const Popup = /*#__PURE__*/memo(({
|
|
|
72
68
|
isOpen,
|
|
73
69
|
onClose: handleOpenLayerObserverCloseSignal
|
|
74
70
|
});
|
|
75
|
-
const renderPopperWrapper =
|
|
71
|
+
const renderPopperWrapper = /*#__PURE__*/React.createElement(Layering, {
|
|
76
72
|
isDisabled: false
|
|
77
|
-
},
|
|
73
|
+
}, /*#__PURE__*/React.createElement(PopperWrapper, {
|
|
78
74
|
xcss: xcss,
|
|
79
75
|
appearance: appearance,
|
|
80
76
|
content: content,
|
|
@@ -103,7 +99,7 @@ export const Popup = /*#__PURE__*/memo(({
|
|
|
103
99
|
modifiers: modifiers,
|
|
104
100
|
shouldFitViewport: shouldFitViewport
|
|
105
101
|
}));
|
|
106
|
-
const popupContent =
|
|
102
|
+
const popupContent = /*#__PURE__*/React.createElement(Manager, null, /*#__PURE__*/React.createElement(Reference, null, ({
|
|
107
103
|
ref
|
|
108
104
|
}) => {
|
|
109
105
|
return trigger({
|
|
@@ -112,12 +108,12 @@ export const Popup = /*#__PURE__*/memo(({
|
|
|
112
108
|
'aria-expanded': isOpen,
|
|
113
109
|
'aria-haspopup': role === 'dialog' && fg('platform_dst_popup-disable-focuslock') ? 'dialog' : true
|
|
114
110
|
});
|
|
115
|
-
}), isOpen && (shouldRenderToParent || shouldFitContainer ? renderPopperWrapper :
|
|
111
|
+
}), isOpen && (shouldRenderToParent || shouldFitContainer ? renderPopperWrapper : /*#__PURE__*/React.createElement(Portal, {
|
|
116
112
|
zIndex: zIndex
|
|
117
113
|
}, renderPopperWrapper)));
|
|
118
114
|
if (shouldFitContainer) {
|
|
119
|
-
return
|
|
120
|
-
xcss: wrapperStyles
|
|
115
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
116
|
+
xcss: wrapperStyles.root
|
|
121
117
|
}, popupContent);
|
|
122
118
|
}
|
|
123
119
|
return popupContent;
|
|
@@ -7,7 +7,6 @@ import { Layering } from '@atlaskit/layering';
|
|
|
7
7
|
import { useNotifyOpenLayerObserver } from '@atlaskit/layering/experimental/open-layer-observer';
|
|
8
8
|
import { Manager, Reference } from '@atlaskit/popper';
|
|
9
9
|
import Portal from '@atlaskit/portal';
|
|
10
|
-
import { layers } from '@atlaskit/theme/constants';
|
|
11
10
|
import PopperWrapper from '../popper-wrapper';
|
|
12
11
|
import { usePopupAppearance } from '../use-appearance';
|
|
13
12
|
import { useGetMemoizedMergedTriggerRef } from '../use-get-memoized-merged-trigger-ref';
|
|
@@ -89,7 +88,7 @@ export var PopupTrigger = function PopupTrigger(_ref2) {
|
|
|
89
88
|
});
|
|
90
89
|
});
|
|
91
90
|
};
|
|
92
|
-
var defaultLayer =
|
|
91
|
+
var defaultLayer = 400;
|
|
93
92
|
/**
|
|
94
93
|
* Disables popper.js GPU acceleration for this popup.
|
|
95
94
|
* This means only positioning will be used, without any transforms.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
._1r04idpf{inset:0}
|
|
3
|
+
._2rkoglpi{border-radius:var(--ds-border-radius,4px)}
|
|
4
|
+
._dk5d1b66{inset-inline:var(--ds-space-050,4px)}._152t1b66{inset-block-start:var(--ds-space-050,4px)}
|
|
5
|
+
._16qs1cd0{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #091e4226,0 0 1px #091e424f)}
|
|
6
|
+
._18m91wug{overflow-y:auto}
|
|
7
|
+
._1bsb1osq{width:100%}
|
|
8
|
+
._1e0c1ule{display:block}
|
|
9
|
+
._1pby1nn1{z-index:400}
|
|
10
|
+
._1q1l1bhr{--ds-elevation-surface-current:var(--ds-surface-overlay,#fff)}
|
|
11
|
+
._1reo1wug{overflow-x:auto}
|
|
12
|
+
._bfhk10xm{background-color:var(--ds-blanket,#091e427d)}
|
|
13
|
+
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|
|
14
|
+
._c71ldtre{max-height:50vh}
|
|
15
|
+
._kqsw1n9t{position:fixed}
|
|
16
|
+
._syaz1fxt{color:var(--ds-text,#172b4d)}
|
|
17
|
+
._vchhusvi{box-sizing:border-box}
|
|
18
|
+
._1hvw1o36:focus{outline-width:medium}
|
|
19
|
+
._49pcglyw:focus{outline-style:none}
|
|
20
|
+
._nt751r31:focus{outline-color:currentColor}
|
|
@@ -1,69 +1,40 @@
|
|
|
1
|
+
/* popper-wrapper.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
1
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
4
|
import _extends from "@babel/runtime/helpers/extends";
|
|
4
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* @jsxRuntime classic
|
|
9
|
-
* @jsx jsx
|
|
10
|
-
*/
|
|
6
|
+
var _excluded = ["shouldRenderToParent", "shouldFitContainer", "children", "appearance", "className"];
|
|
7
|
+
import "./popper-wrapper.compiled.css";
|
|
8
|
+
import * as React from 'react';
|
|
11
9
|
import { forwardRef, Fragment, useMemo, useState } from 'react';
|
|
12
|
-
import {
|
|
13
|
-
import FocusRing from '@atlaskit/focus-ring';
|
|
10
|
+
import { ax, ix } from '@compiled/react/runtime';
|
|
14
11
|
import { useLayering } from '@atlaskit/layering';
|
|
15
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
13
|
import { Popper } from '@atlaskit/popper';
|
|
17
|
-
import { N0, N50A, N60A } from '@atlaskit/theme/colors';
|
|
18
|
-
import { layers } from '@atlaskit/theme/constants';
|
|
19
|
-
import { CURRENT_SURFACE_CSS_VAR } from '@atlaskit/tokens';
|
|
20
14
|
import { RepositionOnUpdate } from './reposition-on-update';
|
|
21
15
|
import { useCloseManager } from './use-close-manager';
|
|
22
16
|
import { useFocusManager } from './use-focus-manager';
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// Otherwise, when rendering into the parent (not using a portal),
|
|
35
|
-
// the text color can be inherited from the parent.
|
|
36
|
-
color: "var(--ds-text, #172B4D)"
|
|
37
|
-
}, CURRENT_SURFACE_CSS_VAR, "var(--ds-surface-overlay, ".concat(N0, ")")), '&:focus', {
|
|
38
|
-
outline: 'none'
|
|
39
|
-
}));
|
|
40
|
-
var scrollableStyles = css({
|
|
41
|
-
overflow: 'auto'
|
|
42
|
-
});
|
|
43
|
-
var blanketStyles = css({
|
|
44
|
-
position: 'fixed',
|
|
45
|
-
inset: 0,
|
|
46
|
-
backgroundColor: "var(--ds-blanket, #091E427D)"
|
|
47
|
-
});
|
|
48
|
-
var modalStyles = css({
|
|
49
|
-
maxHeight: '50vh',
|
|
50
|
-
position: 'fixed',
|
|
51
|
-
insetBlockStart: "var(--ds-space-050, 4px)",
|
|
52
|
-
insetInline: "var(--ds-space-050, 4px)"
|
|
53
|
-
});
|
|
17
|
+
var LOCAL_CURRENT_SURFACE_CSS_VAR = '--ds-elevation-surface-current';
|
|
18
|
+
var fullWidthStyles = null;
|
|
19
|
+
var wrapperStyles = {
|
|
20
|
+
root: "_2rkoglpi _1e0c1ule _vchhusvi _1pby1nn1 _bfhk1bhr _16qs1cd0 _syaz1fxt _1q1l1bhr _nt751r31 _49pcglyw _1hvw1o36"
|
|
21
|
+
};
|
|
22
|
+
var scrollableStyles = null;
|
|
23
|
+
var blanketStyles = null;
|
|
24
|
+
var modalStyles = null;
|
|
25
|
+
var focusRingStyles = {
|
|
26
|
+
root: "_mizu194a _1ah31bk5 _ra3xnqa1 _128m1bk5 _1cvmnqa1 _4davt94y"
|
|
27
|
+
};
|
|
54
28
|
var DefaultPopupComponent = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
55
29
|
var shouldRenderToParent = props.shouldRenderToParent,
|
|
56
30
|
shouldFitContainer = props.shouldFitContainer,
|
|
57
31
|
children = props.children,
|
|
58
32
|
appearance = props.appearance,
|
|
59
|
-
|
|
33
|
+
className = props.className,
|
|
60
34
|
htmlAttributes = _objectWithoutProperties(props, _excluded);
|
|
61
|
-
return
|
|
62
|
-
//
|
|
63
|
-
|
|
64
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- This rule still fails because of the TS assertion
|
|
65
|
-
className: xcss,
|
|
66
|
-
css: [rootStyles, appearance === 'UNSAFE_modal-below-sm' && modalStyles, !shouldRenderToParent && scrollableStyles, shouldFitContainer && fullWidthStyles]
|
|
35
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
36
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
37
|
+
className: ax([wrapperStyles.root, appearance === 'UNSAFE_modal-below-sm' && "_dk5d1b66 _c71ldtre _kqsw1n9t _152t1b66", !shouldRenderToParent && "_1reo1wug _18m91wug", shouldFitContainer && "_1bsb1osq", className])
|
|
67
38
|
}, htmlAttributes, {
|
|
68
39
|
ref: ref
|
|
69
40
|
}), children);
|
|
@@ -145,7 +116,7 @@ function PopperWrapper(_ref) {
|
|
|
145
116
|
}
|
|
146
117
|
}].concat(_toConsumableArray(modifiers || []));
|
|
147
118
|
}, [shouldFlip, rootBoundary, boundary, fallbackPlacements, modifiers]);
|
|
148
|
-
return
|
|
119
|
+
return /*#__PURE__*/React.createElement(Popper, {
|
|
149
120
|
placement: placement,
|
|
150
121
|
offset: offset,
|
|
151
122
|
modifiers: mergedModifiers,
|
|
@@ -156,8 +127,14 @@ function PopperWrapper(_ref) {
|
|
|
156
127
|
style = _ref2.style,
|
|
157
128
|
placement = _ref2.placement,
|
|
158
129
|
update = _ref2.update;
|
|
159
|
-
var popupContainer =
|
|
160
|
-
|
|
130
|
+
var popupContainer = /*#__PURE__*/React.createElement(PopupContainer
|
|
131
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
132
|
+
, {
|
|
133
|
+
className: ax([xcss,
|
|
134
|
+
// @ts-expect-error: `ax` is not typed correctly
|
|
135
|
+
!initialFocusRef &&
|
|
136
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
137
|
+
fg('platform-design-system-apply-popup-wrapper-focus') && focusRingStyles.root]),
|
|
161
138
|
appearance: appearance,
|
|
162
139
|
id: id,
|
|
163
140
|
"data-ds--level": currentLevel,
|
|
@@ -185,7 +162,7 @@ function PopperWrapper(_ref) {
|
|
|
185
162
|
tabIndex: autoFocus ? 0 : undefined,
|
|
186
163
|
shouldRenderToParent: shouldRenderToParent,
|
|
187
164
|
shouldFitContainer: shouldFitContainer
|
|
188
|
-
},
|
|
165
|
+
}, /*#__PURE__*/React.createElement(RepositionOnUpdate, {
|
|
189
166
|
update: update
|
|
190
167
|
}, content({
|
|
191
168
|
update: update,
|
|
@@ -193,10 +170,8 @@ function PopperWrapper(_ref) {
|
|
|
193
170
|
onClose: onClose,
|
|
194
171
|
setInitialFocusRef: setInitialFocusRef
|
|
195
172
|
})));
|
|
196
|
-
return
|
|
197
|
-
|
|
198
|
-
})) : jsx(Fragment, null, popupContainer, appearance === 'UNSAFE_modal-below-sm' && jsx("div", {
|
|
199
|
-
css: blanketStyles
|
|
173
|
+
return /*#__PURE__*/React.createElement(Fragment, null, popupContainer, appearance === 'UNSAFE_modal-below-sm' && /*#__PURE__*/React.createElement("div", {
|
|
174
|
+
className: ax(["_1r04idpf _kqsw1n9t _bfhk10xm"])
|
|
200
175
|
}));
|
|
201
176
|
});
|
|
202
177
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._kqswh2mm{position:relative}
|
package/dist/esm/popup.js
CHANGED
|
@@ -1,29 +1,26 @@
|
|
|
1
|
+
/* popup.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import "./popup.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
2
6
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
3
|
-
/**
|
|
4
|
-
* @jsxRuntime classic
|
|
5
|
-
* @jsx jsx
|
|
6
|
-
*/
|
|
7
|
-
import { memo, useCallback, useState } from 'react';
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
import { jsx } from '@emotion/react';
|
|
8
|
+
import { memo, useCallback, useState } from 'react';
|
|
11
9
|
import { useId } from '@atlaskit/ds-lib/use-id';
|
|
12
10
|
import { Layering } from '@atlaskit/layering';
|
|
13
11
|
import { useNotifyOpenLayerObserver } from '@atlaskit/layering/experimental/open-layer-observer';
|
|
14
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
13
|
import { Manager, Reference } from '@atlaskit/popper';
|
|
16
14
|
import Portal from '@atlaskit/portal';
|
|
17
|
-
import { Box
|
|
18
|
-
import { layers } from '@atlaskit/theme/constants';
|
|
15
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
19
16
|
import PopperWrapper from './popper-wrapper';
|
|
20
17
|
import { usePopupAppearance } from './use-appearance';
|
|
21
18
|
import { useGetMemoizedMergedTriggerRef } from './use-get-memoized-merged-trigger-ref';
|
|
22
19
|
import { useGetMemoizedMergedTriggerRefNew } from './use-get-memoized-merged-trigger-ref-new';
|
|
23
|
-
var defaultLayer =
|
|
24
|
-
var wrapperStyles =
|
|
25
|
-
|
|
26
|
-
}
|
|
20
|
+
var defaultLayer = 400;
|
|
21
|
+
var wrapperStyles = {
|
|
22
|
+
root: "_kqswh2mm"
|
|
23
|
+
};
|
|
27
24
|
export var Popup = /*#__PURE__*/memo(function (_ref) {
|
|
28
25
|
var xcss = _ref.xcss,
|
|
29
26
|
_ref$appearance = _ref.appearance,
|
|
@@ -85,9 +82,9 @@ export var Popup = /*#__PURE__*/memo(function (_ref) {
|
|
|
85
82
|
isOpen: isOpen,
|
|
86
83
|
onClose: handleOpenLayerObserverCloseSignal
|
|
87
84
|
});
|
|
88
|
-
var renderPopperWrapper =
|
|
85
|
+
var renderPopperWrapper = /*#__PURE__*/React.createElement(Layering, {
|
|
89
86
|
isDisabled: false
|
|
90
|
-
},
|
|
87
|
+
}, /*#__PURE__*/React.createElement(PopperWrapper, {
|
|
91
88
|
xcss: xcss,
|
|
92
89
|
appearance: appearance,
|
|
93
90
|
content: content,
|
|
@@ -116,7 +113,7 @@ export var Popup = /*#__PURE__*/memo(function (_ref) {
|
|
|
116
113
|
modifiers: modifiers,
|
|
117
114
|
shouldFitViewport: shouldFitViewport
|
|
118
115
|
}));
|
|
119
|
-
var popupContent =
|
|
116
|
+
var popupContent = /*#__PURE__*/React.createElement(Manager, null, /*#__PURE__*/React.createElement(Reference, null, function (_ref2) {
|
|
120
117
|
var ref = _ref2.ref;
|
|
121
118
|
return trigger({
|
|
122
119
|
ref: !fg('platform-design-system-popup-ref') ? getMergedTriggerRef(ref, setTriggerRef, isOpen) : getMergedTriggerRefNew(ref, setTriggerRef),
|
|
@@ -124,12 +121,12 @@ export var Popup = /*#__PURE__*/memo(function (_ref) {
|
|
|
124
121
|
'aria-expanded': isOpen,
|
|
125
122
|
'aria-haspopup': role === 'dialog' && fg('platform_dst_popup-disable-focuslock') ? 'dialog' : true
|
|
126
123
|
});
|
|
127
|
-
}), isOpen && (shouldRenderToParent || shouldFitContainer ? renderPopperWrapper :
|
|
124
|
+
}), isOpen && (shouldRenderToParent || shouldFitContainer ? renderPopperWrapper : /*#__PURE__*/React.createElement(Portal, {
|
|
128
125
|
zIndex: zIndex
|
|
129
126
|
}, renderPopperWrapper)));
|
|
130
127
|
if (shouldFitContainer) {
|
|
131
|
-
return
|
|
132
|
-
xcss: wrapperStyles
|
|
128
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
129
|
+
xcss: wrapperStyles.root
|
|
133
130
|
}, popupContent);
|
|
134
131
|
}
|
|
135
132
|
return popupContent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import { UNSAFE_useMediaQuery as useMediaQuery } from '@atlaskit/primitives/
|
|
3
|
+
import { UNSAFE_useMediaQuery as useMediaQuery } from '@atlaskit/primitives/compiled';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* **usePopupAppearance()**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { type PopperWrapperProps } from './types';
|
|
3
|
-
declare function PopperWrapper({ xcss, isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldFitContainer, shouldDisableFocusLock, shouldReturnFocus, strategy, role, label, titleId, modifiers, shouldFitViewport, appearance, }: PopperWrapperProps):
|
|
3
|
+
declare function PopperWrapper({ xcss, isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldFitContainer, shouldDisableFocusLock, shouldReturnFocus, strategy, role, label, titleId, modifiers, shouldFitViewport, appearance, }: PopperWrapperProps): JSX.Element;
|
|
4
4
|
export default PopperWrapper;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -81,6 +81,10 @@ export interface PopupComponentProps {
|
|
|
81
81
|
* We strongly recommend using only `menu` or `dialog`.
|
|
82
82
|
*/
|
|
83
83
|
role?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Class name to apply to the popup container element.
|
|
86
|
+
*/
|
|
87
|
+
className?: string;
|
|
84
88
|
}
|
|
85
89
|
interface BaseProps {
|
|
86
90
|
/**
|
|
@@ -88,7 +92,10 @@ interface BaseProps {
|
|
|
88
92
|
* The "UNSAFE_modal-below-sm" appearance makes the popup appear as a modal when the viewport is smaller than "sm".
|
|
89
93
|
*/
|
|
90
94
|
appearance?: 'default' | 'UNSAFE_modal-below-sm';
|
|
91
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Bounded style overrides.
|
|
97
|
+
*/
|
|
98
|
+
xcss?: StrictXCSSProp<'padding' | 'paddingInline' | 'paddingBlock' | 'paddingInlineStart' | 'paddingInlineEnd' | 'paddingBlockStart' | 'paddingBlockEnd' | 'width', never>;
|
|
92
99
|
/**
|
|
93
100
|
* Use this to either show or hide the popup.
|
|
94
101
|
* When set to `false` the popup will not render anything to the DOM.
|
|
@@ -238,7 +245,7 @@ interface InternalPopupProps extends BaseProps {
|
|
|
238
245
|
/**
|
|
239
246
|
* Z-index that the popup should be displayed in.
|
|
240
247
|
* This is passed to the portal component.
|
|
241
|
-
* The default is
|
|
248
|
+
* The default is 400.
|
|
242
249
|
*/
|
|
243
250
|
zIndex?: number;
|
|
244
251
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { type PopperWrapperProps } from './types';
|
|
3
|
-
declare function PopperWrapper({ xcss, isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldFitContainer, shouldDisableFocusLock, shouldReturnFocus, strategy, role, label, titleId, modifiers, shouldFitViewport, appearance, }: PopperWrapperProps):
|
|
3
|
+
declare function PopperWrapper({ xcss, isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldFitContainer, shouldDisableFocusLock, shouldReturnFocus, strategy, role, label, titleId, modifiers, shouldFitViewport, appearance, }: PopperWrapperProps): JSX.Element;
|
|
4
4
|
export default PopperWrapper;
|
|
@@ -81,6 +81,10 @@ export interface PopupComponentProps {
|
|
|
81
81
|
* We strongly recommend using only `menu` or `dialog`.
|
|
82
82
|
*/
|
|
83
83
|
role?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Class name to apply to the popup container element.
|
|
86
|
+
*/
|
|
87
|
+
className?: string;
|
|
84
88
|
}
|
|
85
89
|
interface BaseProps {
|
|
86
90
|
/**
|
|
@@ -88,7 +92,10 @@ interface BaseProps {
|
|
|
88
92
|
* The "UNSAFE_modal-below-sm" appearance makes the popup appear as a modal when the viewport is smaller than "sm".
|
|
89
93
|
*/
|
|
90
94
|
appearance?: 'default' | 'UNSAFE_modal-below-sm';
|
|
91
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Bounded style overrides.
|
|
97
|
+
*/
|
|
98
|
+
xcss?: StrictXCSSProp<'padding' | 'paddingInline' | 'paddingBlock' | 'paddingInlineStart' | 'paddingInlineEnd' | 'paddingBlockStart' | 'paddingBlockEnd' | 'width', never>;
|
|
92
99
|
/**
|
|
93
100
|
* Use this to either show or hide the popup.
|
|
94
101
|
* When set to `false` the popup will not render anything to the DOM.
|
|
@@ -241,7 +248,7 @@ interface InternalPopupProps extends BaseProps {
|
|
|
241
248
|
/**
|
|
242
249
|
* Z-index that the popup should be displayed in.
|
|
243
250
|
* This is passed to the portal component.
|
|
244
|
-
* The default is
|
|
251
|
+
* The default is 400.
|
|
245
252
|
*/
|
|
246
253
|
zIndex?: number;
|
|
247
254
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/popup",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "A popup displays brief content in an overlay.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -40,16 +40,14 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@atlaskit/css": "^0.10.0",
|
|
42
42
|
"@atlaskit/ds-lib": "^4.0.0",
|
|
43
|
-
"@atlaskit/focus-ring": "^3.0.0",
|
|
44
43
|
"@atlaskit/layering": "^2.1.0",
|
|
45
44
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
46
45
|
"@atlaskit/popper": "^7.0.0",
|
|
47
46
|
"@atlaskit/portal": "^5.1.0",
|
|
48
|
-
"@atlaskit/primitives": "^14.
|
|
49
|
-
"@atlaskit/
|
|
50
|
-
"@atlaskit/tokens": "^4.5.0",
|
|
47
|
+
"@atlaskit/primitives": "^14.4.0",
|
|
48
|
+
"@atlaskit/tokens": "^4.8.0",
|
|
51
49
|
"@babel/runtime": "^7.0.0",
|
|
52
|
-
"@
|
|
50
|
+
"@compiled/react": "^0.18.3",
|
|
53
51
|
"bind-event-listener": "^3.0.0",
|
|
54
52
|
"focus-trap": "^2.4.5",
|
|
55
53
|
"memoize-one": "^6.0.0",
|
|
@@ -63,14 +61,14 @@
|
|
|
63
61
|
"@af/accessibility-testing": "^2.0.0",
|
|
64
62
|
"@af/integration-testing": "^0.5.0",
|
|
65
63
|
"@af/visual-regression": "^1.3.0",
|
|
66
|
-
"@atlaskit/button": "^
|
|
67
|
-
"@atlaskit/code": "^
|
|
64
|
+
"@atlaskit/button": "^23.0.0",
|
|
65
|
+
"@atlaskit/code": "^17.0.0",
|
|
68
66
|
"@atlaskit/docs": "^10.0.0",
|
|
69
67
|
"@atlaskit/form": "^12.0.0",
|
|
70
|
-
"@atlaskit/heading": "^5.
|
|
71
|
-
"@atlaskit/icon": "^25.
|
|
68
|
+
"@atlaskit/heading": "^5.2.0",
|
|
69
|
+
"@atlaskit/icon": "^25.6.0",
|
|
72
70
|
"@atlaskit/link": "^3.1.0",
|
|
73
|
-
"@atlaskit/modal-dialog": "^14.
|
|
71
|
+
"@atlaskit/modal-dialog": "^14.1.0",
|
|
74
72
|
"@atlaskit/section-message": "^8.2.0",
|
|
75
73
|
"@atlaskit/ssr": "^0.4.0",
|
|
76
74
|
"@atlaskit/textfield": "^8.0.0",
|
|
@@ -78,7 +76,6 @@
|
|
|
78
76
|
"@atlaskit/visual-regression": "^0.10.0",
|
|
79
77
|
"@atlassian/feature-flags-test-utils": "^0.3.0",
|
|
80
78
|
"@atlassian/ssr-tests": "^0.2.0",
|
|
81
|
-
"@compiled/react": "^0.18.3",
|
|
82
79
|
"@testing-library/react": "^13.4.0",
|
|
83
80
|
"@testing-library/react-hooks": "^8.0.1",
|
|
84
81
|
"@testing-library/user-event": "^14.4.3",
|