@atlaskit/top-layer 1.3.0 → 1.5.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/animations/presets.js +46 -48
  3. package/dist/cjs/dialog/dialog-content.compiled.css +46 -2
  4. package/dist/cjs/dialog/dialog-content.js +39 -2
  5. package/dist/cjs/internal/use-animated-visibility.js +4 -4
  6. package/dist/cjs/popover/popover.compiled.css +22 -2
  7. package/dist/cjs/popover/popover.js +19 -3
  8. package/dist/es2019/animations/presets.js +42 -299
  9. package/dist/es2019/dialog/dialog-content.compiled.css +46 -2
  10. package/dist/es2019/dialog/dialog-content.js +35 -2
  11. package/dist/es2019/internal/use-animated-visibility.js +4 -4
  12. package/dist/es2019/popover/popover.compiled.css +22 -2
  13. package/dist/es2019/popover/popover.js +19 -3
  14. package/dist/esm/animations/presets.js +45 -48
  15. package/dist/esm/dialog/dialog-content.compiled.css +46 -2
  16. package/dist/esm/dialog/dialog-content.js +39 -2
  17. package/dist/esm/internal/use-animated-visibility.js +4 -4
  18. package/dist/esm/popover/popover.compiled.css +22 -2
  19. package/dist/esm/popover/popover.js +19 -3
  20. package/dist/types/animations/presets.d.ts +18 -0
  21. package/dist/types/animations/types.d.ts +10 -14
  22. package/dist/types/dialog/types.d.ts +9 -1
  23. package/dist/types/internal/use-animated-visibility.d.ts +2 -2
  24. package/package.json +13 -31
  25. package/dist/cjs/internal/ensure-preset-styles.js +0 -34
  26. package/dist/cjs/internal/use-animation-preset.js +0 -24
  27. package/dist/cjs/internal/use-preset-styles.js +0 -27
  28. package/dist/es2019/internal/ensure-preset-styles.js +0 -29
  29. package/dist/es2019/internal/use-animation-preset.js +0 -18
  30. package/dist/es2019/internal/use-preset-styles.js +0 -22
  31. package/dist/esm/internal/ensure-preset-styles.js +0 -28
  32. package/dist/esm/internal/use-animation-preset.js +0 -18
  33. package/dist/esm/internal/use-preset-styles.js +0 -21
  34. package/dist/types/internal/ensure-preset-styles.d.ts +0 -6
  35. package/dist/types/internal/use-animation-preset.d.ts +0 -11
  36. package/dist/types/internal/use-preset-styles.d.ts +0 -15
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/top-layer
2
2
 
3
+ ## 1.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`2f56c78f969b8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2f56c78f969b8) -
8
+ Update i18n NPM package versions for teamwork-graph (Group 16)
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
14
+ ## 1.4.0
15
+
16
+ ### Minor Changes
17
+
18
+ - [`608d20a3ca772`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/608d20a3ca772) -
19
+ Migrate top layer animation presets to Compiled CSS
20
+
3
21
  ## 1.3.0
4
22
 
5
23
  ### Minor Changes
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.animationDurations = void 0;
6
7
  exports.dialogFade = dialogFade;
7
8
  exports.dialogMotion = dialogMotion;
8
9
  exports.dialogSlideUpAndFade = dialogSlideUpAndFade;
@@ -11,13 +12,27 @@ exports.popupMotion = popupMotion;
11
12
  exports.scaleAndFade = scaleAndFade;
12
13
  exports.slideAndFade = slideAndFade;
13
14
  var _resolvePlacement = require("../internal/resolve-placement");
14
- // ══════════════════════════════════════════════════════════════════════════════
15
- // Popover presets
16
- // ══════════════════════════════════════════════════════════════════════════════
17
-
18
- // ── popupMotion ──
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
19
35
 
20
- var POPUP_MOTION_CSS = "\n [data-ds-popover-popup-motion] {\n animation: var(--ds-popover-motion-exit);\n animation-fill-mode: forwards;\n transition:\n overlay 150ms allow-discrete,\n display 150ms allow-discrete;\n }\n\n [data-ds-popover-popup-motion]:popover-open {\n animation: var(--ds-popover-motion-enter);\n animation-fill-mode: backwards;\n }\n\n @media (prefers-reduced-motion: reduce) {\n [data-ds-popover-popup-motion],\n [data-ds-popover-popup-motion]:popover-open {\n animation: none;\n transition-duration: 0s;\n }\n }\n";
21
36
  function getPopupMotionProperties(_ref) {
22
37
  var placement = _ref.placement;
23
38
  var _getPlacement = (0, _resolvePlacement.getPlacement)({
@@ -54,9 +69,8 @@ function getPopupMotionProperties(_ref) {
54
69
  function popupMotion() {
55
70
  return {
56
71
  name: 'popup-motion',
57
- css: POPUP_MOTION_CSS,
58
- enterDurationMs: 150,
59
- exitDurationMs: 100,
72
+ enterDurationMs: animationDurations.popupMotion.enter,
73
+ exitDurationMs: animationDurations.popupMotion.exit,
60
74
  getProperties: function getProperties(_ref2) {
61
75
  var placement = _ref2.placement;
62
76
  return getPopupMotionProperties({
@@ -66,7 +80,7 @@ function popupMotion() {
66
80
  };
67
81
  }
68
82
 
69
- // ── slideAndFade ──
83
+ // slideAndFade
70
84
 
71
85
  function getSlideAndFadeProperties(_ref3) {
72
86
  var placement = _ref3.placement,
@@ -108,9 +122,6 @@ function getSlideAndFadeProperties(_ref3) {
108
122
  };
109
123
  }
110
124
 
111
- // ℹ️ Note: The `transform` x value is flipped in right-to-left mode using the `[dir='rtl']` selector.
112
- var SLIDE_AND_FADE_CSS = "\n[data-ds-popover-slide-and-fade] {\n opacity: 0;\n transform: translate(var(--ds-popover-tx, 0), var(--ds-popover-ty, 0));\n transition:\n opacity 175ms cubic-bezier(0.15, 1, 0.3, 1),\n transform 175ms cubic-bezier(0.15, 1, 0.3, 1),\n overlay 175ms allow-discrete,\n display 175ms allow-discrete;\n}\n\n[dir='rtl'] [data-ds-popover-slide-and-fade] {\n transform: translate(calc(-1 * var(--ds-popover-tx, 0)), var(--ds-popover-ty, 0));\n}\n\n[data-ds-popover-slide-and-fade]:popover-open {\n opacity: 1;\n transform: none;\n transition-duration: 350ms;\n}\n\n@starting-style {\n [data-ds-popover-slide-and-fade]:popover-open {\n opacity: 0;\n transform: translate(var(--ds-popover-tx, 0), var(--ds-popover-ty, 0));\n }\n}\n\n@starting-style {\n [dir='rtl'] [data-ds-popover-slide-and-fade]:popover-open {\n transform: translate(calc(-1 * var(--ds-popover-tx, 0)), var(--ds-popover-ty, 0));\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n [data-ds-popover-slide-and-fade],\n [data-ds-popover-slide-and-fade]:popover-open {\n transition-duration: 0s;\n }\n}\n";
113
-
114
125
  /**
115
126
  * Directional slide + opacity animation.
116
127
  *
@@ -136,7 +147,6 @@ function slideAndFade(options) {
136
147
  var distance = (_options$distance = options === null || options === void 0 ? void 0 : options.distance) !== null && _options$distance !== void 0 ? _options$distance : 4;
137
148
  return {
138
149
  name: 'slide-and-fade',
139
- css: SLIDE_AND_FADE_CSS,
140
150
  getProperties: function getProperties(_ref4) {
141
151
  var placement = _ref4.placement;
142
152
  return getSlideAndFadeProperties({
@@ -144,15 +154,13 @@ function slideAndFade(options) {
144
154
  distance: distance
145
155
  });
146
156
  },
147
- enterDurationMs: 350,
148
- exitDurationMs: 175
157
+ enterDurationMs: animationDurations.popoverTransition.enter,
158
+ exitDurationMs: animationDurations.popoverTransition.exit
149
159
  };
150
160
  }
151
161
 
152
162
  // fade
153
163
 
154
- var FADE_CSS = "\n[data-ds-popover-fade] {\n opacity: 0;\n transition:\n opacity 175ms cubic-bezier(0.15, 1, 0.3, 1),\n overlay 175ms allow-discrete,\n display 175ms allow-discrete;\n}\n\n[data-ds-popover-fade]:popover-open {\n opacity: 1;\n transition-duration: 350ms;\n}\n\n@starting-style {\n [data-ds-popover-fade]:popover-open {\n opacity: 0;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n [data-ds-popover-fade],\n [data-ds-popover-fade]:popover-open {\n transition-duration: 0s;\n }\n}\n";
155
-
156
164
  /**
157
165
  * Simple opacity transition, no transform.
158
166
  *
@@ -169,16 +177,13 @@ var FADE_CSS = "\n[data-ds-popover-fade] {\n opacity: 0;\n transition:\n op
169
177
  function fade() {
170
178
  return {
171
179
  name: 'fade',
172
- css: FADE_CSS,
173
- enterDurationMs: 350,
174
- exitDurationMs: 175
180
+ enterDurationMs: animationDurations.popoverTransition.enter,
181
+ exitDurationMs: animationDurations.popoverTransition.exit
175
182
  };
176
183
  }
177
184
 
178
185
  // scaleAndFade
179
186
 
180
- var SCALE_AND_FADE_CSS = "\n[data-ds-popover-scale-and-fade] {\n opacity: 0;\n transform: scale(0.95);\n transition:\n opacity 175ms cubic-bezier(0.15, 1, 0.3, 1),\n transform 175ms cubic-bezier(0.15, 1, 0.3, 1),\n overlay 175ms allow-discrete,\n display 175ms allow-discrete;\n}\n\n[data-ds-popover-scale-and-fade]:popover-open {\n opacity: 1;\n transform: none;\n transition-duration: 350ms;\n}\n\n@starting-style {\n [data-ds-popover-scale-and-fade]:popover-open {\n opacity: 0;\n transform: scale(0.95);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n [data-ds-popover-scale-and-fade],\n [data-ds-popover-scale-and-fade]:popover-open {\n transition-duration: 0s;\n }\n}\n";
181
-
182
187
  /**
183
188
  * Scale from 0.95 + opacity transition.
184
189
  *
@@ -195,19 +200,12 @@ var SCALE_AND_FADE_CSS = "\n[data-ds-popover-scale-and-fade] {\n opacity: 0;\n
195
200
  function scaleAndFade() {
196
201
  return {
197
202
  name: 'scale-and-fade',
198
- css: SCALE_AND_FADE_CSS,
199
- enterDurationMs: 350,
200
- exitDurationMs: 175
203
+ enterDurationMs: animationDurations.popoverTransition.enter,
204
+ exitDurationMs: animationDurations.popoverTransition.exit
201
205
  };
202
206
  }
203
207
 
204
- // ══════════════════════════════════════════════════════════════════════════════
205
- // Dialog presets
206
- // ══════════════════════════════════════════════════════════════════════════════
207
-
208
- // ── dialogMotion ──
209
-
210
- var DIALOG_MOTION_CSS = "\n [data-ds-dialog-motion] {\n animation: ".concat("var(--ds-modal-exit, 200ms cubic-bezier(0.6, 0, 0.8, 0.6) ScaleOut100to95)", ";\n animation-fill-mode: forwards;\n transition:\n overlay 200ms allow-discrete,\n display 200ms allow-discrete;\n }\n\n [data-ds-dialog-motion][open] {\n animation: ", "var(--ds-modal-enter, 250ms cubic-bezier(0.4, 0, 0, 1) ScaleIn95to100)", ";\n animation-fill-mode: backwards;\n }\n\n [data-ds-dialog-motion]::backdrop {\n animation: ", "var(--ds-blanket-exit, 200ms cubic-bezier(0.6, 0, 0.8, 0.6) FadeOut100to0)", ";\n animation-fill-mode: forwards;\n background-color: var(--ds-blanket, #050C1F75);\n transition:\n overlay 200ms allow-discrete,\n display 200ms allow-discrete;\n }\n\n [data-ds-dialog-motion][open]::backdrop {\n animation: ", "var(--ds-blanket-enter, 250ms cubic-bezier(0.4, 0, 0, 1) FadeIn0to100)", ";\n animation-fill-mode: backwards;\n }\n\n @media (prefers-reduced-motion: reduce) {\n [data-ds-dialog-motion],\n [data-ds-dialog-motion][open],\n [data-ds-dialog-motion]::backdrop,\n [data-ds-dialog-motion][open]::backdrop {\n animation: none;\n transition-duration: 0s;\n }\n }\n");
208
+ // dialogMotion
211
209
 
212
210
  /**
213
211
  * Dialog motion animation.
@@ -228,15 +226,12 @@ function dialogMotion() {
228
226
  // Bare preset name; `Dialog` prefixes it via `data-ds-dialog-{name}`.
229
227
  return {
230
228
  name: 'motion',
231
- css: DIALOG_MOTION_CSS,
232
- enterDurationMs: 250,
233
- exitDurationMs: 200
229
+ enterDurationMs: animationDurations.dialogMotion.enter,
230
+ exitDurationMs: animationDurations.dialogMotion.exit
234
231
  };
235
232
  }
236
233
 
237
- // ── dialogSlideUpAndFade ──
238
-
239
- var DIALOG_SLIDE_UP_AND_FADE_CSS = "\n[data-ds-dialog-slide-up-and-fade] {\n opacity: 0;\n transform: translateY(calc(-1 * var(--ds-dialog-ty, 12px)));\n transition:\n opacity 175ms cubic-bezier(0.15, 1, 0.3, 1),\n transform 175ms cubic-bezier(0.15, 1, 0.3, 1),\n overlay 175ms allow-discrete,\n display 175ms allow-discrete;\n}\n\n[data-ds-dialog-slide-up-and-fade][open] {\n opacity: 1;\n transform: none;\n transition-duration: 350ms;\n}\n\n@starting-style {\n [data-ds-dialog-slide-up-and-fade][open] {\n opacity: 0;\n transform: translateY(var(--ds-dialog-ty, 12px));\n }\n}\n\n[data-ds-dialog-slide-up-and-fade]::backdrop {\n background-color: transparent;\n transition:\n background-color 175ms cubic-bezier(0.15, 1, 0.3, 1),\n overlay 175ms allow-discrete,\n display 175ms allow-discrete;\n}\n\n[data-ds-dialog-slide-up-and-fade][open]::backdrop {\n background-color: var(--ds-blanket, #050C1F75);\n transition-duration: 350ms;\n}\n\n@starting-style {\n [data-ds-dialog-slide-up-and-fade][open]::backdrop {\n background-color: transparent;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n [data-ds-dialog-slide-up-and-fade],\n [data-ds-dialog-slide-up-and-fade][open],\n [data-ds-dialog-slide-up-and-fade]::backdrop,\n [data-ds-dialog-slide-up-and-fade][open]::backdrop {\n transition-duration: 0s;\n }\n}\n";
234
+ // dialogSlideUpAndFade
240
235
 
241
236
  /**
242
237
  * Slide up + opacity animation for dialogs.
@@ -262,18 +257,22 @@ function dialogSlideUpAndFade(options) {
262
257
  var distance = (_options$distance2 = options === null || options === void 0 ? void 0 : options.distance) !== null && _options$distance2 !== void 0 ? _options$distance2 : 12;
263
258
 
264
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.
265
262
  return {
266
- name: distance === 12 ? 'slide-up-and-fade' : "slide-up-and-fade-".concat(distance),
267
- css: distance === 12 ? DIALOG_SLIDE_UP_AND_FADE_CSS : DIALOG_SLIDE_UP_AND_FADE_CSS.replace(/12px/g, "".concat(distance, "px")),
268
- enterDurationMs: 350,
269
- exitDurationMs: 175
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
270
271
  };
271
272
  }
272
273
 
273
274
  // dialogFade
274
275
 
275
- var DIALOG_FADE_CSS = "\n[data-ds-dialog-fade] {\n opacity: 0;\n transition:\n opacity 175ms cubic-bezier(0.15, 1, 0.3, 1),\n overlay 175ms allow-discrete,\n display 175ms allow-discrete;\n}\n\n[data-ds-dialog-fade][open] {\n opacity: 1;\n transition-duration: 350ms;\n}\n\n@starting-style {\n [data-ds-dialog-fade][open] {\n opacity: 0;\n }\n}\n\n[data-ds-dialog-fade]::backdrop {\n background-color: transparent;\n transition:\n background-color 175ms cubic-bezier(0.15, 1, 0.3, 1),\n overlay 175ms allow-discrete,\n display 175ms allow-discrete;\n}\n\n[data-ds-dialog-fade][open]::backdrop {\n background-color: var(--ds-blanket, #050C1F75);\n transition-duration: 350ms;\n}\n\n@starting-style {\n [data-ds-dialog-fade][open]::backdrop {\n background-color: transparent;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n [data-ds-dialog-fade],\n [data-ds-dialog-fade][open],\n [data-ds-dialog-fade]::backdrop,\n [data-ds-dialog-fade][open]::backdrop {\n transition-duration: 0s;\n }\n}\n";
276
-
277
276
  /**
278
277
  * Simple opacity transition for dialogs, no transform.
279
278
  *
@@ -293,8 +292,7 @@ function dialogFade() {
293
292
  // Bare preset name; `Dialog` prefixes it via `data-ds-dialog-{name}`.
294
293
  return {
295
294
  name: 'fade',
296
- css: DIALOG_FADE_CSS,
297
- enterDurationMs: 350,
298
- exitDurationMs: 175
295
+ enterDurationMs: animationDurations.dialogTransition.enter,
296
+ exitDurationMs: animationDurations.dialogTransition.exit
299
297
  };
300
298
  }
@@ -1,14 +1,58 @@
1
1
 
2
- ._19itglyw{border:none}._18u01wug{margin-left:auto}
2
+ ._19itglyw{border:none}
3
+ ._1iu47kvq[open]{animation:var(--ds-modal-enter,.25s cubic-bezier(.4,0,0,1) ScaleIn95to100)}
4
+ ._1m5e1op4::-ms-backdrop{animation:var(--ds-blanket-exit,.2s cubic-bezier(.6,0,.8,.6) FadeOut100to0)}
5
+ ._1m5e1op4::backdrop{animation:var(--ds-blanket-exit,.2s cubic-bezier(.6,0,.8,.6) FadeOut100to0)}
6
+ ._vhgsxbuz[open]::-ms-backdrop{animation:var(--ds-blanket-enter,.25s cubic-bezier(.4,0,0,1) FadeIn0to100)}
7
+ ._vhgsxbuz[open]::backdrop{animation:var(--ds-blanket-enter,.25s cubic-bezier(.4,0,0,1) FadeIn0to100)}
8
+ ._y44vgeqi{animation:var(--ds-modal-exit,.2s cubic-bezier(.6,0,.8,.6) ScaleOut100to95)}._13ku1a34::-ms-backdrop{transition-timing-function:cubic-bezier(.15,1,.3,1)}
9
+ ._13ku1a34::backdrop{transition-timing-function:cubic-bezier(.15,1,.3,1)}
10
+ ._18u01wug{margin-left:auto}
3
11
  ._19pk1wug{margin-top:auto}
12
+ ._1fsl1ttt[open]{transition-duration:.35s}
13
+ ._1fyf1a5r::-ms-backdrop{transition-behavior:allow-discrete}
14
+ ._1fyf1a5r::backdrop{transition-behavior:allow-discrete}
15
+ ._1gbckb7n[open]{opacity:1}
16
+ ._1i0neoah[open]{animation-fill-mode:backwards}
17
+ ._1jhdq7pw::-ms-backdrop{animation-fill-mode:forwards}
18
+ ._1jhdq7pw::backdrop{animation-fill-mode:forwards}
19
+ ._1kdeglyw[open]{transform:none}
4
20
  ._1ltk1i5c::-ms-backdrop{background-color:var(--ds-blanket,#050c1f75)}
5
21
  ._1ltk1i5c::backdrop{background-color:var(--ds-blanket,#050c1f75)}
22
+ ._1ltk1j28::-ms-backdrop{background-color:transparent}
23
+ ._1ltk1j28::backdrop{background-color:transparent}
24
+ ._1o51q7pw{animation-fill-mode:forwards}
25
+ ._1oecfnf5{transition-duration:.2s}
26
+ ._1oecluct{transition-duration:175ms}
6
27
  ._1q51ze3t{padding-block-start:var(--ds-space-0,0)}
28
+ ._1rsueoah[open]::-ms-backdrop{animation-fill-mode:backwards}
29
+ ._1rsueoah[open]::backdrop{animation-fill-mode:backwards}
30
+ ._1s9z1a5r{transition-behavior:allow-discrete}
7
31
  ._2hwx1wug{margin-right:auto}
32
+ ._4v7i1ttt[open]::-ms-backdrop{transition-duration:.35s}
33
+ ._4v7i1ttt[open]::backdrop{transition-duration:.35s}
34
+ ._6fl41a34{transition-timing-function:cubic-bezier(.15,1,.3,1)}
8
35
  ._85i5ze3t{padding-block-end:var(--ds-space-0,0)}
9
36
  ._bfhk1j28{background-color:transparent}
10
37
  ._bozgze3t{padding-inline-start:var(--ds-space-0,0)}
11
38
  ._c71lglyw{max-height:none}
39
+ ._d7fr1i5c[open]::-ms-backdrop{background-color:var(--ds-blanket,#050c1f75)}
40
+ ._d7fr1i5c[open]::backdrop{background-color:var(--ds-blanket,#050c1f75)}
41
+ ._k8m011k7{transition-property:overlay,display}
42
+ ._k8m01slm{transition-property:opacity,overlay,display}
43
+ ._k8m0rv36{transition-property:opacity,transform,overlay,display}
44
+ ._njwk11k7::-ms-backdrop{-ms-transition-property:overlay,display;transition-property:overlay,display}
45
+ ._njwk11k7::backdrop{transition-property:overlay,display}
46
+ ._njwkivc9::-ms-backdrop{-ms-transition-property:background-color,overlay,display;transition-property:background-color,overlay,display}
47
+ ._njwkivc9::backdrop{transition-property:background-color,overlay,display}
12
48
  ._otyr1wug{margin-bottom:auto}
13
49
  ._p12fglyw{max-width:none}
14
- ._y4tize3t{padding-inline-end:var(--ds-space-0,0)}
50
+ ._t9ec9o47{transform:translateY(calc(var(--ds-dialog-ty, 9pt)*-1))}
51
+ ._tzy4idpf{opacity:0}
52
+ ._y4tize3t{padding-inline-end:var(--ds-space-0,0)}
53
+ ._yhpqfnf5::-ms-backdrop{transition-duration:.2s}
54
+ ._yhpqfnf5::backdrop{transition-duration:.2s}
55
+ ._yhpqluct::-ms-backdrop{transition-duration:175ms}
56
+ ._yhpqluct::backdrop{transition-duration:175ms}
57
+ @media (prefers-reduced-motion:reduce){._156yru3m{transition-duration:0s}._aeldru3m[open]{transition-duration:0s}._1sbqru3m::-ms-backdrop{transition-duration:0s}._1sbqru3m::backdrop{transition-duration:0s}._1i6zru3m[open]::-ms-backdrop{transition-duration:0s}._1i6zru3m[open]::backdrop{transition-duration:0s}._bl8aglyw{animation-name:none}._10aiglyw[open]{animation-name:none}._l57nglyw::-ms-backdrop{animation-name:none}._l57nglyw::backdrop{animation-name:none}._19awglyw[open]::-ms-backdrop{animation-name:none}._19awglyw[open]::backdrop{animation-name:none}}
58
+ @starting-style{._1dar1j28[open]::-ms-backdrop{background-color:transparent}._1dar1j28[open]::backdrop{background-color:transparent}._rornidpf[open]{opacity:0}._1hqtc4j2[open]{transform:translateY(var(--ds-dialog-ty,9pt))}}
@@ -11,6 +11,7 @@ require("./dialog-content.compiled.css");
11
11
  var _runtime = require("@compiled/react/runtime");
12
12
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
14
15
  var _react = _interopRequireWildcard(require("react"));
15
16
  var _bindEventListener = require("bind-event-listener");
16
17
  var _mergeRefs = _interopRequireDefault(require("@atlaskit/ds-lib/merge-refs"));
@@ -19,7 +20,15 @@ var _openLayerObserver = require("@atlaskit/layering/experimental/open-layer-obs
19
20
  var _useAnimatedVisibility = require("../internal/use-animated-visibility");
20
21
  var _useFocusWrap = require("../internal/use-focus-wrap");
21
22
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
22
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- dialog reset requires values not in cssMap's type union
23
+ // These animation styles use the non-strict Compiled cssMap because they rely
24
+ // on `@starting-style`, `[open]`, and `allow-discrete`. Keep them in this
25
+ // component so the Compiled transform can statically extract every referenced
26
+ // style.
27
+ var dialogAnimationStyles = {
28
+ motion: "_y44vgeqi _1o51q7pw _k8m011k7 _1oecfnf5 _1s9z1a5r _1iu47kvq _1i0neoah _1m5e1op4 _1jhdq7pw _1ltk1i5c _njwk11k7 _yhpqfnf5 _1fyf1a5r _vhgsxbuz _1rsueoah _bl8aglyw _156yru3m _10aiglyw _aeldru3m _l57nglyw _1sbqru3m _19awglyw _1i6zru3m",
29
+ slideUpAndFade: "_tzy4idpf _t9ec9o47 _k8m0rv36 _1oecluct _6fl41a34 _1s9z1a5r _1gbckb7n _1kdeglyw _1fsl1ttt _rornidpf _1hqtc4j2 _1ltk1j28 _njwkivc9 _yhpqluct _13ku1a34 _1fyf1a5r _d7fr1i5c _4v7i1ttt _1dar1j28 _156yru3m _aeldru3m _1sbqru3m _1i6zru3m",
30
+ fade: "_tzy4idpf _k8m01slm _1oecluct _6fl41a34 _1s9z1a5r _1gbckb7n _1fsl1ttt _rornidpf _1ltk1j28 _njwkivc9 _yhpqluct _13ku1a34 _1fyf1a5r _d7fr1i5c _4v7i1ttt _1dar1j28 _156yru3m _aeldru3m _1sbqru3m _1i6zru3m"
31
+ };
23
32
  var styles = {
24
33
  dialog: "_19itglyw _19pk1wug _2hwx1wug _otyr1wug _18u01wug _1q51ze3t _y4tize3t _85i5ze3t _bozgze3t _p12fglyw _c71lglyw _bfhk1j28 _1ltk1i5c"
25
34
  };
@@ -48,6 +57,7 @@ var Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(function Dialo
48
57
  onEnterFinish = _ref.onEnterFinish,
49
58
  onExitFinish = _ref.onExitFinish,
50
59
  animate = _ref.animate,
60
+ xcssFromProps = _ref.xcss,
51
61
  style = _ref.style,
52
62
  testId = _ref.testId,
53
63
  providedId = _ref.id,
@@ -111,6 +121,32 @@ var Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(function Dialo
111
121
  }
112
122
  }, [isOpen]);
113
123
 
124
+ // Apply preset-provided animation custom properties (e.g. the
125
+ // `--ds-dialog-ty` slide distance for `dialogSlideUpAndFade`). The
126
+ // cleanup removes them so a preset change does not leave stale
127
+ // custom properties on the element. Dialog presets do not vary by
128
+ // placement, so an empty placement is passed.
129
+ (0, _react.useLayoutEffect)(function () {
130
+ var dialog = ownRef.current;
131
+ if (!dialog || !(preset !== null && preset !== void 0 && preset.getProperties)) {
132
+ return;
133
+ }
134
+ var props = preset.getProperties({
135
+ placement: {}
136
+ });
137
+ Object.entries(props).forEach(function (_ref2) {
138
+ var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
139
+ key = _ref3[0],
140
+ value = _ref3[1];
141
+ dialog.style.setProperty(key, String(value));
142
+ });
143
+ return function () {
144
+ Object.keys(props).forEach(function (key) {
145
+ dialog.style.removeProperty(key);
146
+ });
147
+ };
148
+ }, [preset, isVisible]);
149
+
114
150
  // Handle native Escape (cancel event)
115
151
  var handleCancel = (0, _react.useCallback)(function (event) {
116
152
  // Only handle a cancel targeting THIS dialog. Native `cancel` does not
@@ -179,7 +215,8 @@ var Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(function Dialo
179
215
  onCancel: handleCancel,
180
216
  "data-testid": testId
181
217
  }, preset ? (0, _defineProperty2.default)({}, "data-ds-dialog-".concat(preset.name), '') : undefined, {
182
- className: (0, _runtime.ax)([styles.dialog])
218
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- xcss prop passes Compiled atomic class names from consumer-owned cssMap entries
219
+ className: (0, _runtime.ax)([styles.dialog, (preset === null || preset === void 0 ? void 0 : preset.name) === 'motion' && dialogAnimationStyles.motion, (preset === null || preset === void 0 ? void 0 : preset.name) === 'slide-up-and-fade' && dialogAnimationStyles.slideUpAndFade, (preset === null || preset === void 0 ? void 0 : preset.name) === 'fade' && dialogAnimationStyles.fade, xcssFromProps])
183
220
  }), shouldHideBackdrop &&
184
221
  /*#__PURE__*/
185
222
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles
@@ -9,7 +9,6 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
9
9
  var _react = require("react");
10
10
  var _bindEventListener = require("bind-event-listener");
11
11
  var _reducedMotion = require("./reduced-motion");
12
- var _usePresetStyles = require("./use-preset-styles");
13
12
  /**
14
13
  * Fires `onSettled` once when `transitionend` fires on `element`, or after
15
14
  * `safetyNetMs` if the event is swallowed (mid-transition unmount, CSS
@@ -112,9 +111,10 @@ function useAnimatedVisibility(_ref2) {
112
111
  elementRef = _ref2.elementRef,
113
112
  onEnterFinish = _ref2.onEnterFinish,
114
113
  onExitFinish = _ref2.onExitFinish;
115
- var preset = (0, _usePresetStyles.usePresetStyles)({
116
- preset: animate
117
- });
114
+ // Styles are applied via the `css` prop on the host element (see `Popover`
115
+ // and `Dialog`), so there is no longer any CSS injection step. Normalize a
116
+ // falsy `animate` to `null`.
117
+ var preset = animate || null;
118
118
 
119
119
  // False when there is no preset or `prefers-reduced-motion` is set.
120
120
  var willAnimate = Boolean(animate) && !(0, _reducedMotion.prefersReducedMotion)();
@@ -1,13 +1,33 @@
1
1
 
2
+ ._15ns179n:popover-open{animation:var(--ds-popover-motion-enter)}
2
3
  ._19itglyw{border:none}
3
- ._1r041wug{inset:auto}._18m9ewfl{overflow-y:visible}
4
+ ._1r041wug{inset:auto}
5
+ ._y44vof1f{animation:var(--ds-popover-motion-exit)}._12t71ttt:popover-open{transition-duration:.35s}
6
+ ._162xglyw:popover-open{transform:none}
7
+ ._18m9ewfl{overflow-y:visible}
4
8
  ._18u0idpf{margin-left:0}
5
9
  ._19bvidpf{padding-left:0}
6
10
  ._19pkidpf{margin-top:0}
11
+ ._1f6ykb7n:popover-open{opacity:1}
12
+ ._1o51q7pw{animation-fill-mode:forwards}
13
+ ._1oec6ebc{transition-duration:.15s}
14
+ ._1oecluct{transition-duration:175ms}
7
15
  ._1reoewfl{overflow-x:visible}
16
+ ._1s9z1a5r{transition-behavior:allow-discrete}
8
17
  ._2hwxidpf{margin-right:0}
18
+ ._6fl41a34{transition-timing-function:cubic-bezier(.15,1,.3,1)}
9
19
  ._bfhk1j28{background-color:transparent}
10
20
  ._ca0qidpf{padding-top:0}
21
+ ._k8m011k7{transition-property:overlay,display}
22
+ ._k8m01slm{transition-property:opacity,overlay,display}
23
+ ._k8m0rv36{transition-property:opacity,transform,overlay,display}
11
24
  ._n3tdidpf{padding-bottom:0}
25
+ ._n70peoah:popover-open{animation-fill-mode:backwards}
12
26
  ._otyridpf{margin-bottom:0}
13
- ._u5f3idpf{padding-right:0}
27
+ ._t9ecgt2x{transform:scale(.95)}
28
+ ._t9ecxauz{transform:translate(var(--ds-popover-tx,0),var(--ds-popover-ty,0))}
29
+ ._tzy4idpf{opacity:0}
30
+ ._u5f3idpf{padding-right:0}
31
+ [dir=rtl] ._1tz31oq6{transform:translate(calc(var(--ds-popover-tx, 0)*-1),var(--ds-popover-ty,0))}
32
+ @media (prefers-reduced-motion:reduce){._156yru3m{transition-duration:0s}._2qm2ru3m:popover-open{transition-duration:0s}._bl8aglyw{animation-name:none}._8rmvglyw:popover-open{animation-name:none}}
33
+ @starting-style{._1wuhidpf:popover-open{opacity:0}._1423gt2x:popover-open{transform:scale(.95)}._1423xauz:popover-open{transform:translate(var(--ds-popover-tx,0),var(--ds-popover-ty,0))}[dir=rtl] ._1dml1oq6:popover-open{transform:translate(calc(var(--ds-popover-tx, 0)*-1),var(--ds-popover-ty,0))}}
@@ -35,7 +35,16 @@ var supportsPopoverHint = (0, _once.default)(function () {
35
35
  return element.popover === 'hint';
36
36
  });
37
37
 
38
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- popover UA reset requires values not in cssMap's type union
38
+ // These animation styles use the non-strict Compiled cssMap because they rely
39
+ // on `@starting-style`, `:popover-open`, `[dir='rtl']`, and `allow-discrete`.
40
+ // Keep them in this component so the Compiled transform can statically extract
41
+ // every referenced style.
42
+ var popoverAnimationStyles = {
43
+ popupMotion: "_y44vof1f _1o51q7pw _k8m011k7 _1oec6ebc _1s9z1a5r _15ns179n _n70peoah _bl8aglyw _156yru3m _8rmvglyw _2qm2ru3m",
44
+ slideAndFade: "_tzy4idpf _t9ecxauz _k8m0rv36 _1oecluct _6fl41a34 _1s9z1a5r _1tz31oq6 _1f6ykb7n _162xglyw _12t71ttt _1wuhidpf _1423xauz _156yru3m _2qm2ru3m _1dml1oq6",
45
+ fade: "_tzy4idpf _k8m01slm _1oecluct _6fl41a34 _1s9z1a5r _1f6ykb7n _12t71ttt _1wuhidpf _156yru3m _2qm2ru3m",
46
+ scaleAndFade: "_tzy4idpf _t9ecgt2x _k8m0rv36 _1oecluct _6fl41a34 _1s9z1a5r _1f6ykb7n _162xglyw _12t71ttt _1wuhidpf _1423gt2x _156yru3m _2qm2ru3m"
47
+ };
39
48
  var styles = {
40
49
  root: "_19itglyw _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _19pkidpf _2hwxidpf _otyridpf _18u0idpf _1r041wug _1reoewfl _18m9ewfl _bfhk1j28"
41
50
  };
@@ -263,7 +272,9 @@ var Popover = exports.Popover = /*#__PURE__*/(0, _react.forwardRef)(function Pop
263
272
  }, [handleToggle, handleBeforeToggle, isVisible]);
264
273
 
265
274
  // Placement-dependent animation CSS vars. Kept separate from show/hide
266
- // so preset reference changes do not re-trigger visibility.
275
+ // so preset reference changes do not re-trigger visibility. The cleanup
276
+ // removes the properties so a preset change does not leave stale custom
277
+ // properties on the element.
267
278
  (0, _react.useLayoutEffect)(function () {
268
279
  var element = ownRef.current;
269
280
  if (!element || !(preset !== null && preset !== void 0 && preset.getProperties) || !placement) {
@@ -278,6 +289,11 @@ var Popover = exports.Popover = /*#__PURE__*/(0, _react.forwardRef)(function Pop
278
289
  value = _ref3[1];
279
290
  element.style.setProperty(key, String(value));
280
291
  });
292
+ return function () {
293
+ Object.keys(props).forEach(function (key) {
294
+ element.style.removeProperty(key);
295
+ });
296
+ };
281
297
  }, [preset, placement, isVisible]);
282
298
 
283
299
  // Show/hide based on isOpen. `showPopover`/`hidePopover` are no-ops when
@@ -329,6 +345,6 @@ var Popover = exports.Popover = /*#__PURE__*/(0, _react.forwardRef)(function Pop
329
345
  "data-testid": testId
330
346
  }, preset ? (0, _defineProperty2.default)({}, "data-ds-popover-".concat(preset.name), '') : undefined, {
331
347
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- xcss prop passes compiled atomic class names
332
- className: (0, _runtime.ax)([styles.root, xcssFromProps])
348
+ className: (0, _runtime.ax)([styles.root, (preset === null || preset === void 0 ? void 0 : preset.name) === 'popup-motion' && popoverAnimationStyles.popupMotion, (preset === null || preset === void 0 ? void 0 : preset.name) === 'slide-and-fade' && popoverAnimationStyles.slideAndFade, (preset === null || preset === void 0 ? void 0 : preset.name) === 'fade' && popoverAnimationStyles.fade, (preset === null || preset === void 0 ? void 0 : preset.name) === 'scale-and-fade' && popoverAnimationStyles.scaleAndFade, xcssFromProps])
333
349
  }), children);
334
350
  });