@atlaskit/top-layer 1.10.1 → 3.0.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 +24 -0
- package/README.md +13 -25
- package/dist/cjs/dialog/dialog-content.compiled.css +5 -18
- package/dist/cjs/dialog/dialog-content.js +22 -20
- package/dist/cjs/internal/placement-to-position-area.js +5 -5
- package/dist/cjs/internal/placement-to-try-fallbacks.js +1 -1
- package/dist/cjs/internal/resolve-css-length-to-pixels.js +1 -1
- package/dist/cjs/internal/resolve-placement.js +3 -3
- package/dist/cjs/internal/use-anchor-position.js +2 -2
- package/dist/cjs/internal/use-animated-visibility.js +3 -17
- package/dist/cjs/popover/popover.compiled.css +4 -10
- package/dist/cjs/popover/popover.js +56 -50
- package/dist/cjs/popover-surface/popover-surface.js +1 -1
- package/dist/es2019/dialog/dialog-content.compiled.css +5 -18
- package/dist/es2019/dialog/dialog-content.js +21 -19
- package/dist/es2019/internal/placement-to-position-area.js +2 -2
- package/dist/es2019/internal/placement-to-try-fallbacks.js +2 -2
- package/dist/es2019/internal/resolve-css-length-to-pixels.js +1 -1
- package/dist/es2019/internal/resolve-placement.js +2 -2
- package/dist/es2019/internal/use-anchor-position.js +3 -3
- package/dist/es2019/internal/use-animated-visibility.js +3 -17
- package/dist/es2019/popover/popover.compiled.css +4 -10
- package/dist/es2019/popover/popover.js +57 -50
- package/dist/es2019/popover-surface/popover-surface.js +1 -1
- package/dist/esm/dialog/dialog-content.compiled.css +5 -18
- package/dist/esm/dialog/dialog-content.js +22 -20
- package/dist/esm/internal/placement-to-position-area.js +5 -5
- package/dist/esm/internal/placement-to-try-fallbacks.js +2 -2
- package/dist/esm/internal/resolve-css-length-to-pixels.js +1 -1
- package/dist/esm/internal/resolve-placement.js +2 -2
- package/dist/esm/internal/use-anchor-position.js +3 -3
- package/dist/esm/internal/use-animated-visibility.js +3 -17
- package/dist/esm/popover/popover.compiled.css +4 -10
- package/dist/esm/popover/popover.js +57 -51
- package/dist/esm/popover-surface/popover-surface.js +1 -1
- package/dist/types/dialog/types.d.ts +24 -11
- package/dist/types/internal/resolve-placement.d.ts +6 -4
- package/dist/types/internal/use-animated-visibility.d.ts +2 -14
- package/dist/types/placement-map/legacy-placements.d.ts +1 -1
- package/dist/types/popover/types.d.ts +23 -41
- package/package.json +4 -4
- package/dist/cjs/popover/animations.js +0 -50
- package/dist/es2019/popover/animations.js +0 -46
- package/dist/esm/popover/animations.js +0 -44
- package/dist/types/popover/animations.d.ts +0 -7
|
@@ -2,7 +2,6 @@ import { type ReactNode } from 'react';
|
|
|
2
2
|
import { type StrictXCSSProp } from '@atlaskit/css';
|
|
3
3
|
import { type TPlacementOptions } from '../internal/resolve-placement';
|
|
4
4
|
import { type TAriaRoleRequired, type TRoleRequiringAccessibleName, type TRoleWithImplicitName } from '../internal/role-types';
|
|
5
|
-
import type { TAnimationConfig } from '../internal/use-animated-visibility';
|
|
6
5
|
/**
|
|
7
6
|
* The reason a popover was closed.
|
|
8
7
|
*
|
|
@@ -33,20 +32,24 @@ export type { TPlacementOptions };
|
|
|
33
32
|
type TPopoverBaseProps = {
|
|
34
33
|
children: ReactNode;
|
|
35
34
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
35
|
+
* Animation styles applied while the popover is entering.
|
|
36
|
+
*
|
|
37
|
+
* Only applied when `shouldAnimate` is `true`.
|
|
38
38
|
*/
|
|
39
|
-
|
|
40
|
-
requiredPseudos: '&:popover-open';
|
|
41
|
-
requiredProperties: never;
|
|
42
|
-
}>;
|
|
39
|
+
enteringAnimationXcss?: StrictXCSSProp<'animationName' | 'animationDuration' | 'animationTimingFunction' | 'animationDelay', never>;
|
|
43
40
|
/**
|
|
44
|
-
* Animation
|
|
41
|
+
* Animation styles applied while the popover is exiting.
|
|
45
42
|
*
|
|
46
|
-
*
|
|
47
|
-
* enhancement: browsers without support show/hide instantly.
|
|
43
|
+
* Only applied when `shouldAnimate` is `true`.
|
|
48
44
|
*/
|
|
49
|
-
|
|
45
|
+
exitingAnimationXcss?: StrictXCSSProp<'animationName' | 'animationDuration' | 'animationTimingFunction' | 'animationDelay', never>;
|
|
46
|
+
/**
|
|
47
|
+
* Whether the popover should animate in and out.
|
|
48
|
+
*
|
|
49
|
+
* When `true`, default popover animation styles are applied. Use `enteringAnimationXcss`
|
|
50
|
+
* and `exitingAnimationXcss` to override the animation used for each phase.
|
|
51
|
+
*/
|
|
52
|
+
shouldAnimate?: boolean;
|
|
50
53
|
/**
|
|
51
54
|
* Test ID applied to the popover element.
|
|
52
55
|
*/
|
|
@@ -61,9 +64,10 @@ type TPopoverBaseProps = {
|
|
|
61
64
|
/**
|
|
62
65
|
* Whether the popover is open.
|
|
63
66
|
*
|
|
64
|
-
* - **`true`:** show the popover (calls `showPopover()
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
+
* - **`true`:** show the popover (calls `showPopover()`). When `shouldAnimate`
|
|
68
|
+
* is `true`, the entry animation plays via `@starting-style`.
|
|
69
|
+
* - **`false`:** hide the popover. When `shouldAnimate` is `true`, the exit
|
|
70
|
+
* animation plays via `allow-discrete` before the popover becomes logically closed.
|
|
67
71
|
* Otherwise hides instantly.
|
|
68
72
|
*
|
|
69
73
|
* The consumer does not conditionally render the `Popover` - visibility is driven
|
|
@@ -77,8 +81,8 @@ type TPopoverBaseProps = {
|
|
|
77
81
|
* The exact unmount timing is private and may change.
|
|
78
82
|
* - The `id` (supplied or generated via `usePopoverId()`) is stable across opens.
|
|
79
83
|
* - The `ref` is populated only while the host element is rendered. Consumers
|
|
80
|
-
* that read from the ref outside of `
|
|
81
|
-
*
|
|
84
|
+
* that read from the ref outside of `onEnterFinish` should gate the read on
|
|
85
|
+
* `isOpen` being `true`.
|
|
82
86
|
*
|
|
83
87
|
* **Important:** For `mode="auto"` popovers, the browser can dismiss the popover
|
|
84
88
|
* via light dismiss (Escape, click outside) independently of this prop. When that
|
|
@@ -87,34 +91,12 @@ type TPopoverBaseProps = {
|
|
|
87
91
|
* React state will be out of sync (the popover will be hidden despite `isOpen={true}`).
|
|
88
92
|
*/
|
|
89
93
|
isOpen: boolean;
|
|
90
|
-
/**
|
|
91
|
-
* Called when the popover's open state changes via browser toggle events.
|
|
92
|
-
*
|
|
93
|
-
* Receives the new open state and a reference to the popover element,
|
|
94
|
-
* which is useful for focus management (e.g. focusing the first interactive
|
|
95
|
-
* child on open via `getFirstFocusable` from `@atlaskit/top-layer/focus`).
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
* ```tsx
|
|
99
|
-
* <Popover
|
|
100
|
-
* onOpenChange={({ isOpen, element }) => {
|
|
101
|
-
* if (isOpen) {
|
|
102
|
-
* getFirstFocusable({ container: element })?.focus();
|
|
103
|
-
* }
|
|
104
|
-
* }}
|
|
105
|
-
* />
|
|
106
|
-
* ```
|
|
107
|
-
*/
|
|
108
|
-
onOpenChange?: (args: {
|
|
109
|
-
isOpen: boolean;
|
|
110
|
-
element: HTMLDivElement;
|
|
111
|
-
}) => void;
|
|
112
94
|
/**
|
|
113
95
|
* Placement hint for directional animations (e.g. `slideAndFade`).
|
|
114
96
|
*
|
|
115
|
-
* When `
|
|
116
|
-
*
|
|
117
|
-
*
|
|
97
|
+
* When `shouldAnimate` is `true`, placement is used to set CSS custom
|
|
98
|
+
* properties (like `--ds-popover-tx`, `--ds-popover-ty`) that control the
|
|
99
|
+
* slide direction. Has no effect without `shouldAnimate`.
|
|
118
100
|
*
|
|
119
101
|
* This does NOT control positioning. Use `useAnchorPosition` for that.
|
|
120
102
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/top-layer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Low-level layering primitives based on popover and dialog",
|
|
5
5
|
"homepage": "https://atlassian.design/components/top-layer",
|
|
6
6
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@atlaskit/ds-lib": "^8.0.0",
|
|
41
41
|
"@atlaskit/layering": "^5.0.0",
|
|
42
42
|
"@atlaskit/react-compiler-gating": "^0.2.0",
|
|
43
|
-
"@atlaskit/tokens": "^16.
|
|
43
|
+
"@atlaskit/tokens": "^16.3.0",
|
|
44
44
|
"@babel/runtime": "^7.0.0",
|
|
45
45
|
"@compiled/react": "^1.0.0",
|
|
46
46
|
"bind-event-listener": "^3.0.0",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"@af/integration-testing": "workspace:^",
|
|
55
55
|
"@af/visual-regression": "workspace:^",
|
|
56
56
|
"@atlaskit/button": "^24.3.0",
|
|
57
|
-
"@atlaskit/heading": "^
|
|
57
|
+
"@atlaskit/heading": "^7.0.0",
|
|
58
58
|
"@atlaskit/lozenge": "^14.1.0",
|
|
59
|
-
"@atlaskit/primitives": "^22.
|
|
59
|
+
"@atlaskit/primitives": "^22.2.0",
|
|
60
60
|
"@atlaskit/ssr": "workspace:^",
|
|
61
61
|
"@atlaskit/textfield": "^9.1.0",
|
|
62
62
|
"@atlassian/ssr-tests": "workspace:^",
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getPopupMotionStyles = getPopupMotionStyles;
|
|
7
|
-
var _resolvePlacement = require("../internal/resolve-placement");
|
|
8
|
-
function getPopupMotionStyles(_ref) {
|
|
9
|
-
var placement = _ref.placement;
|
|
10
|
-
var _getPlacement = (0, _resolvePlacement.getPlacement)({
|
|
11
|
-
placement: placement
|
|
12
|
-
}),
|
|
13
|
-
axis = _getPlacement.axis,
|
|
14
|
-
edge = _getPlacement.edge;
|
|
15
|
-
if (axis === 'block' && edge === 'start') {
|
|
16
|
-
return [{
|
|
17
|
-
property: '--ds-popover-motion-enter',
|
|
18
|
-
value: "var(--ds-popup-enter-top, 150ms cubic-bezier(0.4, 1, 0.6, 1) SlideInTop8px, 150ms cubic-bezier(0.4, 1, 0.6, 1) FadeIn0to100)"
|
|
19
|
-
}, {
|
|
20
|
-
property: '--ds-popover-motion-exit',
|
|
21
|
-
value: "var(--ds-popup-exit-top, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) SlideOutTop8px, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) FadeOut100to0)"
|
|
22
|
-
}];
|
|
23
|
-
}
|
|
24
|
-
if (axis === 'inline' && edge === 'start') {
|
|
25
|
-
return [{
|
|
26
|
-
property: '--ds-popover-motion-enter',
|
|
27
|
-
value: "var(--ds-popup-enter-left, 150ms cubic-bezier(0.4, 1, 0.6, 1) SlideInLeft8px, 150ms cubic-bezier(0.4, 1, 0.6, 1) FadeIn0to100)"
|
|
28
|
-
}, {
|
|
29
|
-
property: '--ds-popover-motion-exit',
|
|
30
|
-
value: "var(--ds-popup-exit-left, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) SlideOutLeft8px, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) FadeOut100to0)"
|
|
31
|
-
}];
|
|
32
|
-
}
|
|
33
|
-
if (axis === 'inline' && edge === 'end') {
|
|
34
|
-
return [{
|
|
35
|
-
property: '--ds-popover-motion-enter',
|
|
36
|
-
value: "var(--ds-popup-enter-right, 150ms cubic-bezier(0.4, 1, 0.6, 1) SlideInRight8px, 150ms cubic-bezier(0.4, 1, 0.6, 1) FadeIn0to100)"
|
|
37
|
-
}, {
|
|
38
|
-
property: '--ds-popover-motion-exit',
|
|
39
|
-
value: "var(--ds-popup-exit-right, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) SlideOutRight8px, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) FadeOut100to0)"
|
|
40
|
-
}];
|
|
41
|
-
}
|
|
42
|
-
// Default: block/end (popover below trigger)
|
|
43
|
-
return [{
|
|
44
|
-
property: '--ds-popover-motion-enter',
|
|
45
|
-
value: "var(--ds-popup-enter-bottom, 150ms cubic-bezier(0.4, 1, 0.6, 1) SlideInBottom8px, 150ms cubic-bezier(0.4, 1, 0.6, 1) FadeIn0to100)"
|
|
46
|
-
}, {
|
|
47
|
-
property: '--ds-popover-motion-exit',
|
|
48
|
-
value: "var(--ds-popup-exit-bottom, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) SlideOutBottom8px, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) FadeOut100to0)"
|
|
49
|
-
}];
|
|
50
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { getPlacement } from '../internal/resolve-placement';
|
|
2
|
-
export function getPopupMotionStyles({
|
|
3
|
-
placement
|
|
4
|
-
}) {
|
|
5
|
-
const {
|
|
6
|
-
axis,
|
|
7
|
-
edge
|
|
8
|
-
} = getPlacement({
|
|
9
|
-
placement
|
|
10
|
-
});
|
|
11
|
-
if (axis === 'block' && edge === 'start') {
|
|
12
|
-
return [{
|
|
13
|
-
property: '--ds-popover-motion-enter',
|
|
14
|
-
value: "var(--ds-popup-enter-top, 150ms cubic-bezier(0.4, 1, 0.6, 1) SlideInTop8px, 150ms cubic-bezier(0.4, 1, 0.6, 1) FadeIn0to100)"
|
|
15
|
-
}, {
|
|
16
|
-
property: '--ds-popover-motion-exit',
|
|
17
|
-
value: "var(--ds-popup-exit-top, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) SlideOutTop8px, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) FadeOut100to0)"
|
|
18
|
-
}];
|
|
19
|
-
}
|
|
20
|
-
if (axis === 'inline' && edge === 'start') {
|
|
21
|
-
return [{
|
|
22
|
-
property: '--ds-popover-motion-enter',
|
|
23
|
-
value: "var(--ds-popup-enter-left, 150ms cubic-bezier(0.4, 1, 0.6, 1) SlideInLeft8px, 150ms cubic-bezier(0.4, 1, 0.6, 1) FadeIn0to100)"
|
|
24
|
-
}, {
|
|
25
|
-
property: '--ds-popover-motion-exit',
|
|
26
|
-
value: "var(--ds-popup-exit-left, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) SlideOutLeft8px, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) FadeOut100to0)"
|
|
27
|
-
}];
|
|
28
|
-
}
|
|
29
|
-
if (axis === 'inline' && edge === 'end') {
|
|
30
|
-
return [{
|
|
31
|
-
property: '--ds-popover-motion-enter',
|
|
32
|
-
value: "var(--ds-popup-enter-right, 150ms cubic-bezier(0.4, 1, 0.6, 1) SlideInRight8px, 150ms cubic-bezier(0.4, 1, 0.6, 1) FadeIn0to100)"
|
|
33
|
-
}, {
|
|
34
|
-
property: '--ds-popover-motion-exit',
|
|
35
|
-
value: "var(--ds-popup-exit-right, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) SlideOutRight8px, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) FadeOut100to0)"
|
|
36
|
-
}];
|
|
37
|
-
}
|
|
38
|
-
// Default: block/end (popover below trigger)
|
|
39
|
-
return [{
|
|
40
|
-
property: '--ds-popover-motion-enter',
|
|
41
|
-
value: "var(--ds-popup-enter-bottom, 150ms cubic-bezier(0.4, 1, 0.6, 1) SlideInBottom8px, 150ms cubic-bezier(0.4, 1, 0.6, 1) FadeIn0to100)"
|
|
42
|
-
}, {
|
|
43
|
-
property: '--ds-popover-motion-exit',
|
|
44
|
-
value: "var(--ds-popup-exit-bottom, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) SlideOutBottom8px, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) FadeOut100to0)"
|
|
45
|
-
}];
|
|
46
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { getPlacement } from '../internal/resolve-placement';
|
|
2
|
-
export function getPopupMotionStyles(_ref) {
|
|
3
|
-
var placement = _ref.placement;
|
|
4
|
-
var _getPlacement = getPlacement({
|
|
5
|
-
placement: placement
|
|
6
|
-
}),
|
|
7
|
-
axis = _getPlacement.axis,
|
|
8
|
-
edge = _getPlacement.edge;
|
|
9
|
-
if (axis === 'block' && edge === 'start') {
|
|
10
|
-
return [{
|
|
11
|
-
property: '--ds-popover-motion-enter',
|
|
12
|
-
value: "var(--ds-popup-enter-top, 150ms cubic-bezier(0.4, 1, 0.6, 1) SlideInTop8px, 150ms cubic-bezier(0.4, 1, 0.6, 1) FadeIn0to100)"
|
|
13
|
-
}, {
|
|
14
|
-
property: '--ds-popover-motion-exit',
|
|
15
|
-
value: "var(--ds-popup-exit-top, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) SlideOutTop8px, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) FadeOut100to0)"
|
|
16
|
-
}];
|
|
17
|
-
}
|
|
18
|
-
if (axis === 'inline' && edge === 'start') {
|
|
19
|
-
return [{
|
|
20
|
-
property: '--ds-popover-motion-enter',
|
|
21
|
-
value: "var(--ds-popup-enter-left, 150ms cubic-bezier(0.4, 1, 0.6, 1) SlideInLeft8px, 150ms cubic-bezier(0.4, 1, 0.6, 1) FadeIn0to100)"
|
|
22
|
-
}, {
|
|
23
|
-
property: '--ds-popover-motion-exit',
|
|
24
|
-
value: "var(--ds-popup-exit-left, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) SlideOutLeft8px, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) FadeOut100to0)"
|
|
25
|
-
}];
|
|
26
|
-
}
|
|
27
|
-
if (axis === 'inline' && edge === 'end') {
|
|
28
|
-
return [{
|
|
29
|
-
property: '--ds-popover-motion-enter',
|
|
30
|
-
value: "var(--ds-popup-enter-right, 150ms cubic-bezier(0.4, 1, 0.6, 1) SlideInRight8px, 150ms cubic-bezier(0.4, 1, 0.6, 1) FadeIn0to100)"
|
|
31
|
-
}, {
|
|
32
|
-
property: '--ds-popover-motion-exit',
|
|
33
|
-
value: "var(--ds-popup-exit-right, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) SlideOutRight8px, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) FadeOut100to0)"
|
|
34
|
-
}];
|
|
35
|
-
}
|
|
36
|
-
// Default: block/end (popover below trigger)
|
|
37
|
-
return [{
|
|
38
|
-
property: '--ds-popover-motion-enter',
|
|
39
|
-
value: "var(--ds-popup-enter-bottom, 150ms cubic-bezier(0.4, 1, 0.6, 1) SlideInBottom8px, 150ms cubic-bezier(0.4, 1, 0.6, 1) FadeIn0to100)"
|
|
40
|
-
}, {
|
|
41
|
-
property: '--ds-popover-motion-exit',
|
|
42
|
-
value: "var(--ds-popup-exit-bottom, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) SlideOutBottom8px, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) FadeOut100to0)"
|
|
43
|
-
}];
|
|
44
|
-
}
|