@atlaskit/top-layer 1.5.0 → 1.6.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 +8 -0
- package/dist/cjs/dialog/animations.js +90 -0
- package/dist/cjs/dialog/dialog-content.compiled.css +17 -25
- package/dist/cjs/dialog/dialog-content.js +29 -41
- package/dist/cjs/entry-points/animations.js +9 -8
- package/dist/cjs/internal/use-animated-visibility.js +40 -8
- package/dist/cjs/popover/animations.js +196 -0
- package/dist/cjs/popover/popover.compiled.css +17 -14
- package/dist/cjs/popover/popover.js +21 -30
- package/dist/es2019/dialog/animations.js +80 -0
- package/dist/es2019/dialog/dialog-content.compiled.css +17 -25
- package/dist/es2019/dialog/dialog-content.js +29 -38
- package/dist/es2019/entry-points/animations.js +2 -1
- package/dist/es2019/internal/use-animated-visibility.js +41 -8
- package/dist/es2019/popover/animations.js +190 -0
- package/dist/es2019/popover/popover.compiled.css +17 -14
- package/dist/es2019/popover/popover.js +21 -27
- package/dist/esm/dialog/animations.js +82 -0
- package/dist/esm/dialog/dialog-content.compiled.css +17 -25
- package/dist/esm/dialog/dialog-content.js +29 -41
- package/dist/esm/entry-points/animations.js +2 -1
- package/dist/esm/internal/use-animated-visibility.js +41 -8
- package/dist/esm/popover/animations.js +187 -0
- package/dist/esm/popover/popover.compiled.css +17 -14
- package/dist/esm/popover/popover.js +21 -30
- package/dist/types/dialog/animations.d.ts +57 -0
- package/dist/types/dialog/types.d.ts +2 -2
- package/dist/types/entry-points/animations.d.ts +2 -2
- package/dist/types/internal/use-animated-visibility.d.ts +35 -6
- package/dist/types/popover/animations.d.ts +52 -0
- package/dist/types/popover/types.d.ts +3 -3
- package/package.json +27 -9
- package/dist/cjs/animations/presets.js +0 -298
- package/dist/cjs/animations/types.js +0 -5
- package/dist/es2019/animations/presets.js +0 -285
- package/dist/es2019/animations/types.js +0 -1
- package/dist/esm/animations/presets.js +0 -285
- package/dist/esm/animations/types.js +0 -1
- package/dist/types/animations/presets.d.ts +0 -128
- package/dist/types/animations/types.d.ts +0 -34
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/top-layer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.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",
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
"module": "dist/esm/index.js",
|
|
11
11
|
"module:es2019": "dist/es2019/index.js",
|
|
12
12
|
"types": "dist/types/index.d.ts",
|
|
13
|
-
"sideEffects": [
|
|
13
|
+
"sideEffects": [
|
|
14
|
+
"*.compiled.css"
|
|
15
|
+
],
|
|
14
16
|
"atlaskit:src": "src/index.tsx",
|
|
15
17
|
"atlassian": {
|
|
16
18
|
"react-compiler": {
|
|
@@ -26,7 +28,9 @@
|
|
|
26
28
|
"category": "Libraries"
|
|
27
29
|
},
|
|
28
30
|
"integrationTests": {
|
|
29
|
-
"additionalBrowsers": [
|
|
31
|
+
"additionalBrowsers": [
|
|
32
|
+
"desktop-firefox"
|
|
33
|
+
]
|
|
30
34
|
}
|
|
31
35
|
},
|
|
32
36
|
"dependencies": {
|
|
@@ -65,15 +69,29 @@
|
|
|
65
69
|
},
|
|
66
70
|
"techstack": {
|
|
67
71
|
"@atlassian/frontend": {
|
|
68
|
-
"import-structure": [
|
|
69
|
-
|
|
72
|
+
"import-structure": [
|
|
73
|
+
"atlassian-conventions"
|
|
74
|
+
],
|
|
75
|
+
"circular-dependencies": [
|
|
76
|
+
"file-and-folder-level"
|
|
77
|
+
]
|
|
70
78
|
},
|
|
71
79
|
"@repo/internal": {
|
|
72
80
|
"dom-events": "use-bind-event-listener",
|
|
73
|
-
"ui-components": [
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"
|
|
81
|
+
"ui-components": [
|
|
82
|
+
"lite-mode"
|
|
83
|
+
],
|
|
84
|
+
"design-tokens": [
|
|
85
|
+
"color",
|
|
86
|
+
"spacing"
|
|
87
|
+
],
|
|
88
|
+
"deprecation": [
|
|
89
|
+
"no-deprecated-imports"
|
|
90
|
+
],
|
|
91
|
+
"styling": [
|
|
92
|
+
"static",
|
|
93
|
+
"compiled"
|
|
94
|
+
]
|
|
77
95
|
}
|
|
78
96
|
},
|
|
79
97
|
"publishConfig": {
|
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.animationDurations = void 0;
|
|
7
|
-
exports.dialogFade = dialogFade;
|
|
8
|
-
exports.dialogMotion = dialogMotion;
|
|
9
|
-
exports.dialogSlideUpAndFade = dialogSlideUpAndFade;
|
|
10
|
-
exports.fade = fade;
|
|
11
|
-
exports.popupMotion = popupMotion;
|
|
12
|
-
exports.scaleAndFade = scaleAndFade;
|
|
13
|
-
exports.slideAndFade = slideAndFade;
|
|
14
|
-
var _resolvePlacement = require("../internal/resolve-placement");
|
|
15
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
16
|
-
var animationDurations = exports.animationDurations = {
|
|
17
|
-
popupMotion: {
|
|
18
|
-
enter: 150,
|
|
19
|
-
exit: 100
|
|
20
|
-
},
|
|
21
|
-
popoverTransition: {
|
|
22
|
-
enter: 350,
|
|
23
|
-
exit: 175
|
|
24
|
-
},
|
|
25
|
-
dialogMotion: {
|
|
26
|
-
enter: 250,
|
|
27
|
-
exit: 200
|
|
28
|
-
},
|
|
29
|
-
dialogTransition: {
|
|
30
|
-
enter: 350,
|
|
31
|
-
exit: 175
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
// popupMotion
|
|
35
|
-
|
|
36
|
-
function getPopupMotionProperties(_ref) {
|
|
37
|
-
var placement = _ref.placement;
|
|
38
|
-
var _getPlacement = (0, _resolvePlacement.getPlacement)({
|
|
39
|
-
placement: placement
|
|
40
|
-
}),
|
|
41
|
-
axis = _getPlacement.axis,
|
|
42
|
-
edge = _getPlacement.edge;
|
|
43
|
-
if (axis === 'block' && edge === 'start') {
|
|
44
|
-
return {
|
|
45
|
-
'--ds-popover-motion-enter': "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)",
|
|
46
|
-
'--ds-popover-motion-exit': "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)"
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
if (axis === 'inline' && edge === 'start') {
|
|
50
|
-
return {
|
|
51
|
-
'--ds-popover-motion-enter': "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)",
|
|
52
|
-
'--ds-popover-motion-exit': "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)"
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
if (axis === 'inline' && edge === 'end') {
|
|
56
|
-
return {
|
|
57
|
-
'--ds-popover-motion-enter': "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)",
|
|
58
|
-
'--ds-popover-motion-exit': "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)"
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
// Default: block/end (popover below trigger)
|
|
62
|
-
return {
|
|
63
|
-
'--ds-popover-motion-enter': "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)",
|
|
64
|
-
'--ds-popover-motion-exit': "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)"
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
69
|
-
function popupMotion() {
|
|
70
|
-
return {
|
|
71
|
-
name: 'popup-motion',
|
|
72
|
-
enterDurationMs: animationDurations.popupMotion.enter,
|
|
73
|
-
exitDurationMs: animationDurations.popupMotion.exit,
|
|
74
|
-
getProperties: function getProperties(_ref2) {
|
|
75
|
-
var placement = _ref2.placement;
|
|
76
|
-
return getPopupMotionProperties({
|
|
77
|
-
placement: placement
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// slideAndFade
|
|
84
|
-
|
|
85
|
-
function getSlideAndFadeProperties(_ref3) {
|
|
86
|
-
var placement = _ref3.placement,
|
|
87
|
-
distance = _ref3.distance;
|
|
88
|
-
var pos = "".concat(distance, "px");
|
|
89
|
-
var neg = "-".concat(distance, "px");
|
|
90
|
-
var _getPlacement2 = (0, _resolvePlacement.getPlacement)({
|
|
91
|
-
placement: placement
|
|
92
|
-
}),
|
|
93
|
-
axis = _getPlacement2.axis,
|
|
94
|
-
edge = _getPlacement2.edge;
|
|
95
|
-
if (axis === 'block' && edge === 'start') {
|
|
96
|
-
return {
|
|
97
|
-
'--ds-popover-tx': '0',
|
|
98
|
-
'--ds-popover-ty': pos
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
if (axis === 'block' && edge === 'end') {
|
|
102
|
-
return {
|
|
103
|
-
'--ds-popover-tx': '0',
|
|
104
|
-
'--ds-popover-ty': neg
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
if (axis === 'inline' && edge === 'start') {
|
|
108
|
-
return {
|
|
109
|
-
'--ds-popover-tx': pos,
|
|
110
|
-
'--ds-popover-ty': '0'
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
if (axis === 'inline' && edge === 'end') {
|
|
114
|
-
return {
|
|
115
|
-
'--ds-popover-tx': neg,
|
|
116
|
-
'--ds-popover-ty': '0'
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
return {
|
|
120
|
-
'--ds-popover-tx': '0',
|
|
121
|
-
'--ds-popover-ty': neg
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Directional slide + opacity animation.
|
|
127
|
-
*
|
|
128
|
-
* The popover slides in from the direction opposite its placement edge
|
|
129
|
-
* (e.g. a `block-end` popover slides down from above).
|
|
130
|
-
*
|
|
131
|
-
* @param options.distance - Slide distance in pixels. Defaults to `4`.
|
|
132
|
-
*
|
|
133
|
-
* @example
|
|
134
|
-
* ```tsx
|
|
135
|
-
* import { slideAndFade } from '@atlaskit/top-layer/animations';
|
|
136
|
-
*
|
|
137
|
-
* // Default 4px slide (tooltip)
|
|
138
|
-
* <Popover animate={slideAndFade()} />
|
|
139
|
-
*
|
|
140
|
-
* // Custom 8px slide (popup / dropdown)
|
|
141
|
-
* <Popover animate={slideAndFade({ distance: 8 })} />
|
|
142
|
-
* ```
|
|
143
|
-
*/
|
|
144
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
145
|
-
function slideAndFade(options) {
|
|
146
|
-
var _options$distance;
|
|
147
|
-
var distance = (_options$distance = options === null || options === void 0 ? void 0 : options.distance) !== null && _options$distance !== void 0 ? _options$distance : 4;
|
|
148
|
-
return {
|
|
149
|
-
name: 'slide-and-fade',
|
|
150
|
-
getProperties: function getProperties(_ref4) {
|
|
151
|
-
var placement = _ref4.placement;
|
|
152
|
-
return getSlideAndFadeProperties({
|
|
153
|
-
placement: placement,
|
|
154
|
-
distance: distance
|
|
155
|
-
});
|
|
156
|
-
},
|
|
157
|
-
enterDurationMs: animationDurations.popoverTransition.enter,
|
|
158
|
-
exitDurationMs: animationDurations.popoverTransition.exit
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// fade
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Simple opacity transition, no transform.
|
|
166
|
-
*
|
|
167
|
-
* Suitable for popup dialogs or content that does not need directional motion.
|
|
168
|
-
*
|
|
169
|
-
* @example
|
|
170
|
-
* ```tsx
|
|
171
|
-
* import { fade } from '@atlaskit/top-layer/animations';
|
|
172
|
-
*
|
|
173
|
-
* <Popover animate={fade()} />
|
|
174
|
-
* ```
|
|
175
|
-
*/
|
|
176
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
177
|
-
function fade() {
|
|
178
|
-
return {
|
|
179
|
-
name: 'fade',
|
|
180
|
-
enterDurationMs: animationDurations.popoverTransition.enter,
|
|
181
|
-
exitDurationMs: animationDurations.popoverTransition.exit
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// scaleAndFade
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Scale from 0.95 + opacity transition.
|
|
189
|
-
*
|
|
190
|
-
* Suitable for menus, dropdowns, and select options.
|
|
191
|
-
*
|
|
192
|
-
* @example
|
|
193
|
-
* ```tsx
|
|
194
|
-
* import { scaleAndFade } from '@atlaskit/top-layer/animations';
|
|
195
|
-
*
|
|
196
|
-
* <Popover animate={scaleAndFade()} />
|
|
197
|
-
* ```
|
|
198
|
-
*/
|
|
199
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
200
|
-
function scaleAndFade() {
|
|
201
|
-
return {
|
|
202
|
-
name: 'scale-and-fade',
|
|
203
|
-
enterDurationMs: animationDurations.popoverTransition.enter,
|
|
204
|
-
exitDurationMs: animationDurations.popoverTransition.exit
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// dialogMotion
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Dialog motion animation.
|
|
212
|
-
*
|
|
213
|
-
* Includes backdrop fade animation.
|
|
214
|
-
*
|
|
215
|
-
* @example
|
|
216
|
-
* ```tsx
|
|
217
|
-
* import { dialogMotion } from '@atlaskit/top-layer/animations';
|
|
218
|
-
*
|
|
219
|
-
* <Dialog animate={dialogMotion()} isOpen={isOpen} onClose={handleClose} label="...">
|
|
220
|
-
* ...
|
|
221
|
-
* </Dialog>
|
|
222
|
-
* ```
|
|
223
|
-
*/
|
|
224
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
225
|
-
function dialogMotion() {
|
|
226
|
-
// Bare preset name; `Dialog` prefixes it via `data-ds-dialog-{name}`.
|
|
227
|
-
return {
|
|
228
|
-
name: 'motion',
|
|
229
|
-
enterDurationMs: animationDurations.dialogMotion.enter,
|
|
230
|
-
exitDurationMs: animationDurations.dialogMotion.exit
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
// dialogSlideUpAndFade
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Slide up + opacity animation for dialogs.
|
|
238
|
-
*
|
|
239
|
-
* Entry slides up from below; exit slides up and out (asymmetric).
|
|
240
|
-
* Includes backdrop fade animation.
|
|
241
|
-
*
|
|
242
|
-
* @param options.distance - Slide distance in pixels. Defaults to `12`.
|
|
243
|
-
*
|
|
244
|
-
* @example
|
|
245
|
-
* ```tsx
|
|
246
|
-
* import { dialogSlideUpAndFade } from '@atlaskit/top-layer/animations';
|
|
247
|
-
*
|
|
248
|
-
* const animation = dialogSlideUpAndFade();
|
|
249
|
-
* <Dialog animate={animation} isOpen={isOpen} onClose={handleClose} label="...">
|
|
250
|
-
* ...
|
|
251
|
-
* </Dialog>
|
|
252
|
-
* ```
|
|
253
|
-
*/
|
|
254
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
255
|
-
function dialogSlideUpAndFade(options) {
|
|
256
|
-
var _options$distance2;
|
|
257
|
-
var distance = (_options$distance2 = options === null || options === void 0 ? void 0 : options.distance) !== null && _options$distance2 !== void 0 ? _options$distance2 : 12;
|
|
258
|
-
|
|
259
|
-
// Bare preset name; `Dialog` prefixes it via `data-ds-dialog-{name}`.
|
|
260
|
-
// The distance is applied via the `--ds-dialog-ty` custom property rather
|
|
261
|
-
// than baked into the styles, so the name stays stable across distances.
|
|
262
|
-
return {
|
|
263
|
-
name: 'slide-up-and-fade',
|
|
264
|
-
getProperties: function getProperties() {
|
|
265
|
-
return {
|
|
266
|
-
'--ds-dialog-ty': "".concat(distance, "px")
|
|
267
|
-
};
|
|
268
|
-
},
|
|
269
|
-
enterDurationMs: animationDurations.dialogTransition.enter,
|
|
270
|
-
exitDurationMs: animationDurations.dialogTransition.exit
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
// dialogFade
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Simple opacity transition for dialogs, no transform.
|
|
278
|
-
*
|
|
279
|
-
* Includes backdrop fade animation.
|
|
280
|
-
*
|
|
281
|
-
* @example
|
|
282
|
-
* ```tsx
|
|
283
|
-
* import { dialogFade } from '@atlaskit/top-layer/animations';
|
|
284
|
-
*
|
|
285
|
-
* <Dialog animate={dialogFade()} isOpen={isOpen} onClose={handleClose} label="...">
|
|
286
|
-
* ...
|
|
287
|
-
* </Dialog>
|
|
288
|
-
* ```
|
|
289
|
-
*/
|
|
290
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
291
|
-
function dialogFade() {
|
|
292
|
-
// Bare preset name; `Dialog` prefixes it via `data-ds-dialog-{name}`.
|
|
293
|
-
return {
|
|
294
|
-
name: 'fade',
|
|
295
|
-
enterDurationMs: animationDurations.dialogTransition.enter,
|
|
296
|
-
exitDurationMs: animationDurations.dialogTransition.exit
|
|
297
|
-
};
|
|
298
|
-
}
|
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
import { getPlacement } from '../internal/resolve-placement';
|
|
2
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
3
|
-
export const animationDurations = {
|
|
4
|
-
popupMotion: {
|
|
5
|
-
enter: 150,
|
|
6
|
-
exit: 100
|
|
7
|
-
},
|
|
8
|
-
popoverTransition: {
|
|
9
|
-
enter: 350,
|
|
10
|
-
exit: 175
|
|
11
|
-
},
|
|
12
|
-
dialogMotion: {
|
|
13
|
-
enter: 250,
|
|
14
|
-
exit: 200
|
|
15
|
-
},
|
|
16
|
-
dialogTransition: {
|
|
17
|
-
enter: 350,
|
|
18
|
-
exit: 175
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
// popupMotion
|
|
22
|
-
|
|
23
|
-
function getPopupMotionProperties({
|
|
24
|
-
placement
|
|
25
|
-
}) {
|
|
26
|
-
const {
|
|
27
|
-
axis,
|
|
28
|
-
edge
|
|
29
|
-
} = getPlacement({
|
|
30
|
-
placement
|
|
31
|
-
});
|
|
32
|
-
if (axis === 'block' && edge === 'start') {
|
|
33
|
-
return {
|
|
34
|
-
'--ds-popover-motion-enter': "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)",
|
|
35
|
-
'--ds-popover-motion-exit': "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)"
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
if (axis === 'inline' && edge === 'start') {
|
|
39
|
-
return {
|
|
40
|
-
'--ds-popover-motion-enter': "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)",
|
|
41
|
-
'--ds-popover-motion-exit': "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)"
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
if (axis === 'inline' && edge === 'end') {
|
|
45
|
-
return {
|
|
46
|
-
'--ds-popover-motion-enter': "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)",
|
|
47
|
-
'--ds-popover-motion-exit': "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)"
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
// Default: block/end (popover below trigger)
|
|
51
|
-
return {
|
|
52
|
-
'--ds-popover-motion-enter': "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)",
|
|
53
|
-
'--ds-popover-motion-exit': "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)"
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
58
|
-
export function popupMotion() {
|
|
59
|
-
return {
|
|
60
|
-
name: 'popup-motion',
|
|
61
|
-
enterDurationMs: animationDurations.popupMotion.enter,
|
|
62
|
-
exitDurationMs: animationDurations.popupMotion.exit,
|
|
63
|
-
getProperties: ({
|
|
64
|
-
placement
|
|
65
|
-
}) => getPopupMotionProperties({
|
|
66
|
-
placement
|
|
67
|
-
})
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// slideAndFade
|
|
72
|
-
|
|
73
|
-
function getSlideAndFadeProperties({
|
|
74
|
-
placement,
|
|
75
|
-
distance
|
|
76
|
-
}) {
|
|
77
|
-
const pos = `${distance}px`;
|
|
78
|
-
const neg = `-${distance}px`;
|
|
79
|
-
const {
|
|
80
|
-
axis,
|
|
81
|
-
edge
|
|
82
|
-
} = getPlacement({
|
|
83
|
-
placement
|
|
84
|
-
});
|
|
85
|
-
if (axis === 'block' && edge === 'start') {
|
|
86
|
-
return {
|
|
87
|
-
'--ds-popover-tx': '0',
|
|
88
|
-
'--ds-popover-ty': pos
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
if (axis === 'block' && edge === 'end') {
|
|
92
|
-
return {
|
|
93
|
-
'--ds-popover-tx': '0',
|
|
94
|
-
'--ds-popover-ty': neg
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
if (axis === 'inline' && edge === 'start') {
|
|
98
|
-
return {
|
|
99
|
-
'--ds-popover-tx': pos,
|
|
100
|
-
'--ds-popover-ty': '0'
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
if (axis === 'inline' && edge === 'end') {
|
|
104
|
-
return {
|
|
105
|
-
'--ds-popover-tx': neg,
|
|
106
|
-
'--ds-popover-ty': '0'
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
return {
|
|
110
|
-
'--ds-popover-tx': '0',
|
|
111
|
-
'--ds-popover-ty': neg
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Directional slide + opacity animation.
|
|
117
|
-
*
|
|
118
|
-
* The popover slides in from the direction opposite its placement edge
|
|
119
|
-
* (e.g. a `block-end` popover slides down from above).
|
|
120
|
-
*
|
|
121
|
-
* @param options.distance - Slide distance in pixels. Defaults to `4`.
|
|
122
|
-
*
|
|
123
|
-
* @example
|
|
124
|
-
* ```tsx
|
|
125
|
-
* import { slideAndFade } from '@atlaskit/top-layer/animations';
|
|
126
|
-
*
|
|
127
|
-
* // Default 4px slide (tooltip)
|
|
128
|
-
* <Popover animate={slideAndFade()} />
|
|
129
|
-
*
|
|
130
|
-
* // Custom 8px slide (popup / dropdown)
|
|
131
|
-
* <Popover animate={slideAndFade({ distance: 8 })} />
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
135
|
-
export function slideAndFade(options) {
|
|
136
|
-
var _options$distance;
|
|
137
|
-
const distance = (_options$distance = options === null || options === void 0 ? void 0 : options.distance) !== null && _options$distance !== void 0 ? _options$distance : 4;
|
|
138
|
-
return {
|
|
139
|
-
name: 'slide-and-fade',
|
|
140
|
-
getProperties: ({
|
|
141
|
-
placement
|
|
142
|
-
}) => getSlideAndFadeProperties({
|
|
143
|
-
placement,
|
|
144
|
-
distance
|
|
145
|
-
}),
|
|
146
|
-
enterDurationMs: animationDurations.popoverTransition.enter,
|
|
147
|
-
exitDurationMs: animationDurations.popoverTransition.exit
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// fade
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Simple opacity transition, no transform.
|
|
155
|
-
*
|
|
156
|
-
* Suitable for popup dialogs or content that does not need directional motion.
|
|
157
|
-
*
|
|
158
|
-
* @example
|
|
159
|
-
* ```tsx
|
|
160
|
-
* import { fade } from '@atlaskit/top-layer/animations';
|
|
161
|
-
*
|
|
162
|
-
* <Popover animate={fade()} />
|
|
163
|
-
* ```
|
|
164
|
-
*/
|
|
165
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
166
|
-
export function fade() {
|
|
167
|
-
return {
|
|
168
|
-
name: 'fade',
|
|
169
|
-
enterDurationMs: animationDurations.popoverTransition.enter,
|
|
170
|
-
exitDurationMs: animationDurations.popoverTransition.exit
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// scaleAndFade
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Scale from 0.95 + opacity transition.
|
|
178
|
-
*
|
|
179
|
-
* Suitable for menus, dropdowns, and select options.
|
|
180
|
-
*
|
|
181
|
-
* @example
|
|
182
|
-
* ```tsx
|
|
183
|
-
* import { scaleAndFade } from '@atlaskit/top-layer/animations';
|
|
184
|
-
*
|
|
185
|
-
* <Popover animate={scaleAndFade()} />
|
|
186
|
-
* ```
|
|
187
|
-
*/
|
|
188
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
189
|
-
export function scaleAndFade() {
|
|
190
|
-
return {
|
|
191
|
-
name: 'scale-and-fade',
|
|
192
|
-
enterDurationMs: animationDurations.popoverTransition.enter,
|
|
193
|
-
exitDurationMs: animationDurations.popoverTransition.exit
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
// dialogMotion
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Dialog motion animation.
|
|
201
|
-
*
|
|
202
|
-
* Includes backdrop fade animation.
|
|
203
|
-
*
|
|
204
|
-
* @example
|
|
205
|
-
* ```tsx
|
|
206
|
-
* import { dialogMotion } from '@atlaskit/top-layer/animations';
|
|
207
|
-
*
|
|
208
|
-
* <Dialog animate={dialogMotion()} isOpen={isOpen} onClose={handleClose} label="...">
|
|
209
|
-
* ...
|
|
210
|
-
* </Dialog>
|
|
211
|
-
* ```
|
|
212
|
-
*/
|
|
213
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
214
|
-
export function dialogMotion() {
|
|
215
|
-
// Bare preset name; `Dialog` prefixes it via `data-ds-dialog-{name}`.
|
|
216
|
-
return {
|
|
217
|
-
name: 'motion',
|
|
218
|
-
enterDurationMs: animationDurations.dialogMotion.enter,
|
|
219
|
-
exitDurationMs: animationDurations.dialogMotion.exit
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
// dialogSlideUpAndFade
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Slide up + opacity animation for dialogs.
|
|
227
|
-
*
|
|
228
|
-
* Entry slides up from below; exit slides up and out (asymmetric).
|
|
229
|
-
* Includes backdrop fade animation.
|
|
230
|
-
*
|
|
231
|
-
* @param options.distance - Slide distance in pixels. Defaults to `12`.
|
|
232
|
-
*
|
|
233
|
-
* @example
|
|
234
|
-
* ```tsx
|
|
235
|
-
* import { dialogSlideUpAndFade } from '@atlaskit/top-layer/animations';
|
|
236
|
-
*
|
|
237
|
-
* const animation = dialogSlideUpAndFade();
|
|
238
|
-
* <Dialog animate={animation} isOpen={isOpen} onClose={handleClose} label="...">
|
|
239
|
-
* ...
|
|
240
|
-
* </Dialog>
|
|
241
|
-
* ```
|
|
242
|
-
*/
|
|
243
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
244
|
-
export function dialogSlideUpAndFade(options) {
|
|
245
|
-
var _options$distance2;
|
|
246
|
-
const distance = (_options$distance2 = options === null || options === void 0 ? void 0 : options.distance) !== null && _options$distance2 !== void 0 ? _options$distance2 : 12;
|
|
247
|
-
|
|
248
|
-
// Bare preset name; `Dialog` prefixes it via `data-ds-dialog-{name}`.
|
|
249
|
-
// The distance is applied via the `--ds-dialog-ty` custom property rather
|
|
250
|
-
// than baked into the styles, so the name stays stable across distances.
|
|
251
|
-
return {
|
|
252
|
-
name: 'slide-up-and-fade',
|
|
253
|
-
getProperties: () => ({
|
|
254
|
-
'--ds-dialog-ty': `${distance}px`
|
|
255
|
-
}),
|
|
256
|
-
enterDurationMs: animationDurations.dialogTransition.enter,
|
|
257
|
-
exitDurationMs: animationDurations.dialogTransition.exit
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
// dialogFade
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Simple opacity transition for dialogs, no transform.
|
|
265
|
-
*
|
|
266
|
-
* Includes backdrop fade animation.
|
|
267
|
-
*
|
|
268
|
-
* @example
|
|
269
|
-
* ```tsx
|
|
270
|
-
* import { dialogFade } from '@atlaskit/top-layer/animations';
|
|
271
|
-
*
|
|
272
|
-
* <Dialog animate={dialogFade()} isOpen={isOpen} onClose={handleClose} label="...">
|
|
273
|
-
* ...
|
|
274
|
-
* </Dialog>
|
|
275
|
-
* ```
|
|
276
|
-
*/
|
|
277
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
278
|
-
export function dialogFade() {
|
|
279
|
-
// Bare preset name; `Dialog` prefixes it via `data-ds-dialog-{name}`.
|
|
280
|
-
return {
|
|
281
|
-
name: 'fade',
|
|
282
|
-
enterDurationMs: animationDurations.dialogTransition.enter,
|
|
283
|
-
exitDurationMs: animationDurations.dialogTransition.exit
|
|
284
|
-
};
|
|
285
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|