@atlaskit/popup 1.1.5 → 1.1.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 +11 -0
- package/dist/cjs/PopperWrapper.js +6 -6
- package/dist/cjs/Popup.js +2 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/PopperWrapper.js +7 -6
- package/dist/es2019/Popup.js +2 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/PopperWrapper.js +6 -5
- package/dist/esm/Popup.js +2 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/PopperWrapper.d.ts +1 -1
- package/dist/types/types.d.ts +7 -1
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/popup
|
|
2
2
|
|
|
3
|
+
## 1.1.6
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`f142150a3e8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f142150a3e8) - Expose `fallbackPlacement` modifier from to specify a list of fallback options to try incase there isn't enough space
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [`f460cc7c411`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f460cc7c411) - Builds for this package now pass through a tokens babel plugin, removing runtime invocations of the tokens() function and improving bundle size.
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 1.1.5
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -21,8 +21,6 @@ var _colors = require("@atlaskit/theme/colors");
|
|
|
21
21
|
|
|
22
22
|
var _constants = require("@atlaskit/theme/constants");
|
|
23
23
|
|
|
24
|
-
var _tokens = require("@atlaskit/tokens");
|
|
25
|
-
|
|
26
24
|
var _RepositionOnUpdate = require("./RepositionOnUpdate");
|
|
27
25
|
|
|
28
26
|
var _useCloseManager = require("./useCloseManager");
|
|
@@ -35,9 +33,9 @@ var popupStyles = (0, _core.css)({
|
|
|
35
33
|
boxSizing: 'border-box',
|
|
36
34
|
zIndex: _constants.layers.layer(),
|
|
37
35
|
flex: '1 1 auto',
|
|
38
|
-
backgroundColor: (
|
|
36
|
+
backgroundColor: "var(--ds-background-overlay, ".concat(_colors.N0, ")"),
|
|
39
37
|
borderRadius: "".concat((0, _constants.borderRadius)(), "px"),
|
|
40
|
-
boxShadow: (
|
|
38
|
+
boxShadow: "var(--ds-overlay, ".concat("0 4px 8px -2px ".concat(_colors.N50A, ", 0 0 1px ").concat(_colors.N60A), ")"),
|
|
41
39
|
overflow: 'auto',
|
|
42
40
|
':focus': {
|
|
43
41
|
outline: 'none'
|
|
@@ -56,6 +54,7 @@ function PopperWrapper(_ref) {
|
|
|
56
54
|
offset = _ref.offset,
|
|
57
55
|
testId = _ref.testId,
|
|
58
56
|
content = _ref.content,
|
|
57
|
+
fallbackPlacements = _ref.fallbackPlacements,
|
|
59
58
|
onClose = _ref.onClose,
|
|
60
59
|
boundary = _ref.boundary,
|
|
61
60
|
rootBoundary = _ref.rootBoundary,
|
|
@@ -94,10 +93,11 @@ function PopperWrapper(_ref) {
|
|
|
94
93
|
enabled: shouldFlip,
|
|
95
94
|
options: {
|
|
96
95
|
rootBoundary: rootBoundary,
|
|
97
|
-
boundary: boundary
|
|
96
|
+
boundary: boundary,
|
|
97
|
+
fallbackPlacements: fallbackPlacements
|
|
98
98
|
}
|
|
99
99
|
}];
|
|
100
|
-
}, [shouldFlip, rootBoundary, boundary]);
|
|
100
|
+
}, [shouldFlip, rootBoundary, boundary, fallbackPlacements]);
|
|
101
101
|
return (0, _core.jsx)(_popper.Popper, {
|
|
102
102
|
placement: placement,
|
|
103
103
|
offset: offset,
|
package/dist/cjs/Popup.js
CHANGED
|
@@ -39,6 +39,7 @@ var Popup = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
39
39
|
shouldFlip = _ref$shouldFlip === void 0 ? true : _ref$shouldFlip,
|
|
40
40
|
_ref$placement = _ref.placement,
|
|
41
41
|
placement = _ref$placement === void 0 ? 'auto' : _ref$placement,
|
|
42
|
+
fallbackPlacements = _ref.fallbackPlacements,
|
|
42
43
|
PopupContainer = _ref.popupComponent,
|
|
43
44
|
_ref$autoFocus = _ref.autoFocus,
|
|
44
45
|
autoFocus = _ref$autoFocus === void 0 ? true : _ref$autoFocus,
|
|
@@ -74,6 +75,7 @@ var Popup = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
74
75
|
content: content,
|
|
75
76
|
isOpen: isOpen,
|
|
76
77
|
placement: placement,
|
|
78
|
+
fallbackPlacements: fallbackPlacements,
|
|
77
79
|
boundary: boundary,
|
|
78
80
|
rootBoundary: rootBoundary,
|
|
79
81
|
shouldFlip: shouldFlip,
|
package/dist/cjs/version.json
CHANGED
|
@@ -6,7 +6,6 @@ import { css, jsx } from '@emotion/core';
|
|
|
6
6
|
import { Popper } from '@atlaskit/popper';
|
|
7
7
|
import { N0, N50A, N60A } from '@atlaskit/theme/colors';
|
|
8
8
|
import { borderRadius, layers } from '@atlaskit/theme/constants';
|
|
9
|
-
import { token } from '@atlaskit/tokens';
|
|
10
9
|
import { RepositionOnUpdate } from './RepositionOnUpdate';
|
|
11
10
|
import { useCloseManager } from './useCloseManager';
|
|
12
11
|
import { useFocusManager } from './useFocusManager';
|
|
@@ -15,9 +14,9 @@ const popupStyles = css({
|
|
|
15
14
|
boxSizing: 'border-box',
|
|
16
15
|
zIndex: layers.layer(),
|
|
17
16
|
flex: '1 1 auto',
|
|
18
|
-
backgroundColor:
|
|
17
|
+
backgroundColor: `var(--ds-background-overlay, ${N0})`,
|
|
19
18
|
borderRadius: `${borderRadius()}px`,
|
|
20
|
-
boxShadow:
|
|
19
|
+
boxShadow: `var(--ds-overlay, ${`0 4px 8px -2px ${N50A}, 0 0 1px ${N60A}`})`,
|
|
21
20
|
overflow: 'auto',
|
|
22
21
|
':focus': {
|
|
23
22
|
outline: 'none'
|
|
@@ -34,6 +33,7 @@ function PopperWrapper({
|
|
|
34
33
|
offset,
|
|
35
34
|
testId,
|
|
36
35
|
content,
|
|
36
|
+
fallbackPlacements,
|
|
37
37
|
onClose,
|
|
38
38
|
boundary,
|
|
39
39
|
rootBoundary,
|
|
@@ -59,10 +59,11 @@ function PopperWrapper({
|
|
|
59
59
|
name: 'flip',
|
|
60
60
|
enabled: shouldFlip,
|
|
61
61
|
options: {
|
|
62
|
-
rootBoundary
|
|
63
|
-
boundary
|
|
62
|
+
rootBoundary,
|
|
63
|
+
boundary,
|
|
64
|
+
fallbackPlacements
|
|
64
65
|
}
|
|
65
|
-
}], [shouldFlip, rootBoundary, boundary]);
|
|
66
|
+
}], [shouldFlip, rootBoundary, boundary, fallbackPlacements]);
|
|
66
67
|
return jsx(Popper, {
|
|
67
68
|
placement: placement,
|
|
68
69
|
offset: offset,
|
package/dist/es2019/Popup.js
CHANGED
|
@@ -18,6 +18,7 @@ export const Popup = /*#__PURE__*/memo(({
|
|
|
18
18
|
rootBoundary = 'viewport',
|
|
19
19
|
shouldFlip = true,
|
|
20
20
|
placement = 'auto',
|
|
21
|
+
fallbackPlacements,
|
|
21
22
|
popupComponent: PopupContainer,
|
|
22
23
|
autoFocus = true,
|
|
23
24
|
zIndex = defaultLayer
|
|
@@ -48,6 +49,7 @@ export const Popup = /*#__PURE__*/memo(({
|
|
|
48
49
|
content: content,
|
|
49
50
|
isOpen: isOpen,
|
|
50
51
|
placement: placement,
|
|
52
|
+
fallbackPlacements: fallbackPlacements,
|
|
51
53
|
boundary: boundary,
|
|
52
54
|
rootBoundary: rootBoundary,
|
|
53
55
|
shouldFlip: shouldFlip,
|
package/dist/es2019/version.json
CHANGED
|
@@ -7,7 +7,6 @@ import { css, jsx } from '@emotion/core';
|
|
|
7
7
|
import { Popper } from '@atlaskit/popper';
|
|
8
8
|
import { N0, N50A, N60A } from '@atlaskit/theme/colors';
|
|
9
9
|
import { borderRadius, layers } from '@atlaskit/theme/constants';
|
|
10
|
-
import { token } from '@atlaskit/tokens';
|
|
11
10
|
import { RepositionOnUpdate } from './RepositionOnUpdate';
|
|
12
11
|
import { useCloseManager } from './useCloseManager';
|
|
13
12
|
import { useFocusManager } from './useFocusManager';
|
|
@@ -16,9 +15,9 @@ var popupStyles = css({
|
|
|
16
15
|
boxSizing: 'border-box',
|
|
17
16
|
zIndex: layers.layer(),
|
|
18
17
|
flex: '1 1 auto',
|
|
19
|
-
backgroundColor:
|
|
18
|
+
backgroundColor: "var(--ds-background-overlay, ".concat(N0, ")"),
|
|
20
19
|
borderRadius: "".concat(borderRadius(), "px"),
|
|
21
|
-
boxShadow:
|
|
20
|
+
boxShadow: "var(--ds-overlay, ".concat("0 4px 8px -2px ".concat(N50A, ", 0 0 1px ").concat(N60A), ")"),
|
|
22
21
|
overflow: 'auto',
|
|
23
22
|
':focus': {
|
|
24
23
|
outline: 'none'
|
|
@@ -37,6 +36,7 @@ function PopperWrapper(_ref) {
|
|
|
37
36
|
offset = _ref.offset,
|
|
38
37
|
testId = _ref.testId,
|
|
39
38
|
content = _ref.content,
|
|
39
|
+
fallbackPlacements = _ref.fallbackPlacements,
|
|
40
40
|
onClose = _ref.onClose,
|
|
41
41
|
boundary = _ref.boundary,
|
|
42
42
|
rootBoundary = _ref.rootBoundary,
|
|
@@ -75,10 +75,11 @@ function PopperWrapper(_ref) {
|
|
|
75
75
|
enabled: shouldFlip,
|
|
76
76
|
options: {
|
|
77
77
|
rootBoundary: rootBoundary,
|
|
78
|
-
boundary: boundary
|
|
78
|
+
boundary: boundary,
|
|
79
|
+
fallbackPlacements: fallbackPlacements
|
|
79
80
|
}
|
|
80
81
|
}];
|
|
81
|
-
}, [shouldFlip, rootBoundary, boundary]);
|
|
82
|
+
}, [shouldFlip, rootBoundary, boundary, fallbackPlacements]);
|
|
82
83
|
return jsx(Popper, {
|
|
83
84
|
placement: placement,
|
|
84
85
|
offset: offset,
|
package/dist/esm/Popup.js
CHANGED
|
@@ -23,6 +23,7 @@ export var Popup = /*#__PURE__*/memo(function (_ref) {
|
|
|
23
23
|
shouldFlip = _ref$shouldFlip === void 0 ? true : _ref$shouldFlip,
|
|
24
24
|
_ref$placement = _ref.placement,
|
|
25
25
|
placement = _ref$placement === void 0 ? 'auto' : _ref$placement,
|
|
26
|
+
fallbackPlacements = _ref.fallbackPlacements,
|
|
26
27
|
PopupContainer = _ref.popupComponent,
|
|
27
28
|
_ref$autoFocus = _ref.autoFocus,
|
|
28
29
|
autoFocus = _ref$autoFocus === void 0 ? true : _ref$autoFocus,
|
|
@@ -58,6 +59,7 @@ export var Popup = /*#__PURE__*/memo(function (_ref) {
|
|
|
58
59
|
content: content,
|
|
59
60
|
isOpen: isOpen,
|
|
60
61
|
placement: placement,
|
|
62
|
+
fallbackPlacements: fallbackPlacements,
|
|
61
63
|
boundary: boundary,
|
|
62
64
|
rootBoundary: rootBoundary,
|
|
63
65
|
shouldFlip: shouldFlip,
|
package/dist/esm/version.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { PopperWrapperProps } from './types';
|
|
2
|
-
declare function PopperWrapper({ isOpen, id, offset, testId, content, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, }: PopperWrapperProps): JSX.Element;
|
|
2
|
+
declare function PopperWrapper({ isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, }: PopperWrapperProps): JSX.Element;
|
|
3
3
|
export default PopperWrapper;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface TriggerProps {
|
|
|
7
7
|
'aria-haspopup': boolean;
|
|
8
8
|
}
|
|
9
9
|
export declare type PopupRef = HTMLDivElement | null;
|
|
10
|
-
export declare type TriggerRef = HTMLElement | null;
|
|
10
|
+
export declare type TriggerRef = HTMLElement | HTMLButtonElement | null;
|
|
11
11
|
export interface ContentProps {
|
|
12
12
|
/**
|
|
13
13
|
* Will reposition the popup if any of the content has changed.
|
|
@@ -82,6 +82,12 @@ interface BaseProps {
|
|
|
82
82
|
* Defaults to `"auto"`.
|
|
83
83
|
*/
|
|
84
84
|
placement?: Placement;
|
|
85
|
+
/**
|
|
86
|
+
* Defines a list of placements to try.
|
|
87
|
+
* When no space is available on the preferred placement,
|
|
88
|
+
* the modifier will test the ones provided in the list, and use the first useful one.
|
|
89
|
+
*/
|
|
90
|
+
fallbackPlacements?: Placement[];
|
|
85
91
|
/**
|
|
86
92
|
* The boundary element that the popup will check for overflow.
|
|
87
93
|
* Defaults to `"clippingParents"` which are parent scroll containers,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/popup",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "A portalled popup primitive that is tied to a trigger element.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@atlaskit/popper": "^5.0.0",
|
|
31
31
|
"@atlaskit/portal": "^4.0.0",
|
|
32
32
|
"@atlaskit/theme": "^12.0.0",
|
|
33
|
-
"@atlaskit/tokens": "^0.
|
|
33
|
+
"@atlaskit/tokens": "^0.4.0",
|
|
34
34
|
"@babel/runtime": "^7.0.0",
|
|
35
35
|
"@emotion/core": "^10.0.9",
|
|
36
36
|
"bind-event-listener": "^1.0.2",
|
|
@@ -77,7 +77,10 @@
|
|
|
77
77
|
"analytics": "analytics-next",
|
|
78
78
|
"theming": "tokens",
|
|
79
79
|
"deprecation": "no-deprecated-imports",
|
|
80
|
-
"styling":
|
|
80
|
+
"styling": [
|
|
81
|
+
"static",
|
|
82
|
+
"emotion"
|
|
83
|
+
]
|
|
81
84
|
}
|
|
82
85
|
},
|
|
83
86
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|