@atlaskit/top-layer 0.7.0 → 0.8.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 +13 -0
- package/dist/cjs/internal/ensure-preset-styles.js +1 -1
- package/dist/cjs/internal/use-anchor-position.js +4 -22
- package/dist/cjs/internal/use-preset-styles.js +1 -1
- package/dist/cjs/popup/popup-content.js +1 -7
- package/dist/es2019/internal/ensure-preset-styles.js +1 -1
- package/dist/es2019/internal/use-anchor-position.js +4 -20
- package/dist/es2019/internal/use-preset-styles.js +1 -1
- package/dist/es2019/popup/popup-content.js +1 -7
- package/dist/esm/internal/ensure-preset-styles.js +1 -1
- package/dist/esm/internal/use-anchor-position.js +4 -22
- package/dist/esm/internal/use-preset-styles.js +1 -1
- package/dist/esm/popup/popup-content.js +1 -7
- package/dist/types/internal/use-anchor-position.d.ts +1 -11
- package/dist/types/internal/use-preset-styles.d.ts +1 -1
- package/dist/types/popover/types.d.ts +1 -2
- package/dist/types/popup/types.d.ts +1 -28
- package/dist/types-ts4.5/internal/use-anchor-position.d.ts +1 -11
- package/dist/types-ts4.5/internal/use-preset-styles.d.ts +1 -1
- package/dist/types-ts4.5/popover/types.d.ts +1 -2
- package/dist/types-ts4.5/popup/types.d.ts +1 -28
- package/package.json +2 -2
- package/arrow/package.json +0 -17
- package/dist/cjs/arrow/index.js +0 -130
- package/dist/cjs/arrow/types.js +0 -5
- package/dist/cjs/entry-points/arrow.js +0 -12
- package/dist/es2019/arrow/index.js +0 -268
- package/dist/es2019/arrow/types.js +0 -1
- package/dist/es2019/entry-points/arrow.js +0 -1
- package/dist/esm/arrow/index.js +0 -123
- package/dist/esm/arrow/types.js +0 -1
- package/dist/esm/entry-points/arrow.js +0 -1
- package/dist/types/arrow/index.d.ts +0 -24
- package/dist/types/arrow/types.d.ts +0 -29
- package/dist/types/entry-points/arrow.d.ts +0 -2
- package/dist/types-ts4.5/arrow/index.d.ts +0 -24
- package/dist/types-ts4.5/arrow/types.d.ts +0 -29
- package/dist/types-ts4.5/entry-points/arrow.d.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/top-layer
|
|
2
2
|
|
|
3
|
+
## 0.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`cce485619197c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cce485619197c) -
|
|
8
|
+
Remove arrow() implementation, as there are currently no consumers of it.
|
|
9
|
+
|
|
10
|
+
## 0.7.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 0.7.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -12,7 +12,7 @@ exports.ensurePresetStyles = ensurePresetStyles;
|
|
|
12
12
|
*
|
|
13
13
|
* Note: injected `<style>` elements and the tracking Set are append-only —
|
|
14
14
|
* they are never removed. This is intentional: the number of distinct
|
|
15
|
-
* presets is bounded (handful of animation
|
|
15
|
+
* presets is bounded (handful of animation presets), so the
|
|
16
16
|
* memory footprint is negligible. Removing styles would risk breaking
|
|
17
17
|
* other instances of the same preset that are still mounted.
|
|
18
18
|
*
|
|
@@ -277,8 +277,7 @@ function useAnchorPosition(_ref5) {
|
|
|
277
277
|
_ref5$placement = _ref5.placement,
|
|
278
278
|
placement = _ref5$placement === void 0 ? {} : _ref5$placement,
|
|
279
279
|
_ref5$forceFallbackPo = _ref5.forceFallbackPositioning,
|
|
280
|
-
forceFallbackPositioning = _ref5$forceFallbackPo === void 0 ? false : _ref5$forceFallbackPo
|
|
281
|
-
arrow = _ref5.arrow;
|
|
280
|
+
forceFallbackPositioning = _ref5$forceFallbackPo === void 0 ? false : _ref5$forceFallbackPo;
|
|
282
281
|
var id = (0, _react.useId)();
|
|
283
282
|
// Stabilize `placement` object so the same object literal
|
|
284
283
|
// value returns an object with the same reference
|
|
@@ -315,9 +314,7 @@ function useAnchorPosition(_ref5) {
|
|
|
315
314
|
})
|
|
316
315
|
}, {
|
|
317
316
|
property: 'position-try-fallbacks',
|
|
318
|
-
value:
|
|
319
|
-
placement: stablePlacement
|
|
320
|
-
}) : placementToTryFallbacks({
|
|
317
|
+
value: placementToTryFallbacks({
|
|
321
318
|
placement: stablePlacement
|
|
322
319
|
})
|
|
323
320
|
},
|
|
@@ -380,19 +377,6 @@ function useAnchorPosition(_ref5) {
|
|
|
380
377
|
value: crossAxisShiftActive.value
|
|
381
378
|
});
|
|
382
379
|
}
|
|
383
|
-
if (arrow) {
|
|
384
|
-
// Set the arrow size variable used by the injected arrow CSS
|
|
385
|
-
// and the @position-try rules for margin values.
|
|
386
|
-
popoverStyles.push({
|
|
387
|
-
property: '--ds-arrow-size',
|
|
388
|
-
value: gapCssValue
|
|
389
|
-
});
|
|
390
|
-
// Mark the popover root as the arrow host. The ARROW_CSS targets
|
|
391
|
-
// [data-ds-popover-arrow] to apply clip-path: inset(0) margin-box
|
|
392
|
-
// and box-shadow: none. Must be on the popover root (not a child)
|
|
393
|
-
// because that's where useAnchorPosition sets the margin gap.
|
|
394
|
-
popover.setAttribute('data-ds-popover-arrow', '');
|
|
395
|
-
}
|
|
396
380
|
|
|
397
381
|
/**
|
|
398
382
|
* **We are never cleaning up anchor names**
|
|
@@ -415,9 +399,7 @@ function useAnchorPosition(_ref5) {
|
|
|
415
399
|
var _undoPositioning = (0, _combine.combine)((0, _setStyle.setStyle)({
|
|
416
400
|
el: popover,
|
|
417
401
|
styles: popoverStyles
|
|
418
|
-
})
|
|
419
|
-
return popover.removeAttribute('data-ds-popover-arrow');
|
|
420
|
-
} : function () {});
|
|
402
|
+
}));
|
|
421
403
|
return _undoPositioning;
|
|
422
404
|
}
|
|
423
405
|
|
|
@@ -566,5 +548,5 @@ function useAnchorPosition(_ref5) {
|
|
|
566
548
|
popover.style.removeProperty('opacity');
|
|
567
549
|
});
|
|
568
550
|
return undoPositioning;
|
|
569
|
-
}, [anchorRef, popoverRef, stablePlacement, forceFallbackPositioning,
|
|
551
|
+
}, [anchorRef, popoverRef, stablePlacement, forceFallbackPositioning, id]);
|
|
570
552
|
}
|
|
@@ -11,7 +11,7 @@ var _ensurePresetStyles = require("./ensure-preset-styles");
|
|
|
11
11
|
* is injected once into `document.head`.
|
|
12
12
|
*
|
|
13
13
|
* Works with any preset that has `{ css, name }` — animation presets
|
|
14
|
-
* (TAnimationPreset)
|
|
14
|
+
* (TAnimationPreset) satisfies this shape.
|
|
15
15
|
*/
|
|
16
16
|
function usePresetStyles(_ref) {
|
|
17
17
|
var preset = _ref.preset;
|
|
@@ -13,7 +13,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
13
13
|
var _mergeRefs = _interopRequireDefault(require("@atlaskit/ds-lib/merge-refs"));
|
|
14
14
|
var _roleTypes = require("../internal/role-types");
|
|
15
15
|
var _useAnchorPosition = require("../internal/use-anchor-position");
|
|
16
|
-
var _usePresetStyles = require("../internal/use-preset-styles");
|
|
17
16
|
var _useWidthFromAnchor = require("../internal/use-width-from-anchor");
|
|
18
17
|
var _popover = require("../popover/popover");
|
|
19
18
|
var _popupContext = require("./popup-context");
|
|
@@ -32,7 +31,6 @@ var PopupContent = exports.PopupContent = /*#__PURE__*/(0, _react.forwardRef)(fu
|
|
|
32
31
|
label = _ref.label,
|
|
33
32
|
labelledBy = _ref.labelledBy,
|
|
34
33
|
animate = _ref.animate,
|
|
35
|
-
arrow = _ref.arrow,
|
|
36
34
|
mode = _ref.mode,
|
|
37
35
|
_ref$widthFromAnchor = _ref.widthFromAnchor,
|
|
38
36
|
widthFromAnchor = _ref$widthFromAnchor === void 0 ? 'none' : _ref$widthFromAnchor,
|
|
@@ -129,17 +127,13 @@ var PopupContent = exports.PopupContent = /*#__PURE__*/(0, _react.forwardRef)(fu
|
|
|
129
127
|
// reach the same DOM element for togglePopover). Otherwise use a local ref.
|
|
130
128
|
var localRef = (0, _react.useRef)(null);
|
|
131
129
|
var popoverRef = (_ctx$popoverRef = ctx === null || ctx === void 0 ? void 0 : ctx.popoverRef) !== null && _ctx$popoverRef !== void 0 ? _ctx$popoverRef : localRef;
|
|
132
|
-
var arrowPreset = (0, _usePresetStyles.usePresetStyles)({
|
|
133
|
-
preset: arrow
|
|
134
|
-
});
|
|
135
130
|
(0, _useAnchorPosition.useAnchorPosition)({
|
|
136
131
|
anchorRef: triggerRef !== null && triggerRef !== void 0 ? triggerRef : {
|
|
137
132
|
current: null
|
|
138
133
|
},
|
|
139
134
|
popoverRef: popoverRef,
|
|
140
135
|
placement: placement,
|
|
141
|
-
forceFallbackPositioning: forceFallbackPositioning
|
|
142
|
-
arrow: arrowPreset !== null && arrowPreset !== void 0 ? arrowPreset : undefined
|
|
136
|
+
forceFallbackPositioning: forceFallbackPositioning
|
|
143
137
|
});
|
|
144
138
|
(0, _useWidthFromAnchor.useWidthFromAnchor)({
|
|
145
139
|
mode: widthFromAnchor,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Note: injected `<style>` elements and the tracking Set are append-only —
|
|
8
8
|
* they are never removed. This is intentional: the number of distinct
|
|
9
|
-
* presets is bounded (handful of animation
|
|
9
|
+
* presets is bounded (handful of animation presets), so the
|
|
10
10
|
* memory footprint is negligible. Removing styles would risk breaking
|
|
11
11
|
* other instances of the same preset that are still mounted.
|
|
12
12
|
*
|
|
@@ -269,8 +269,7 @@ export function useAnchorPosition({
|
|
|
269
269
|
anchorRef,
|
|
270
270
|
popoverRef,
|
|
271
271
|
placement = {},
|
|
272
|
-
forceFallbackPositioning = false
|
|
273
|
-
arrow
|
|
272
|
+
forceFallbackPositioning = false
|
|
274
273
|
}) {
|
|
275
274
|
const id = useId();
|
|
276
275
|
// Stabilize `placement` object so the same object literal
|
|
@@ -308,9 +307,7 @@ export function useAnchorPosition({
|
|
|
308
307
|
})
|
|
309
308
|
}, {
|
|
310
309
|
property: 'position-try-fallbacks',
|
|
311
|
-
value:
|
|
312
|
-
placement: stablePlacement
|
|
313
|
-
}) : placementToTryFallbacks({
|
|
310
|
+
value: placementToTryFallbacks({
|
|
314
311
|
placement: stablePlacement
|
|
315
312
|
})
|
|
316
313
|
},
|
|
@@ -373,19 +370,6 @@ export function useAnchorPosition({
|
|
|
373
370
|
value: crossAxisShiftActive.value
|
|
374
371
|
});
|
|
375
372
|
}
|
|
376
|
-
if (arrow) {
|
|
377
|
-
// Set the arrow size variable used by the injected arrow CSS
|
|
378
|
-
// and the @position-try rules for margin values.
|
|
379
|
-
popoverStyles.push({
|
|
380
|
-
property: '--ds-arrow-size',
|
|
381
|
-
value: gapCssValue
|
|
382
|
-
});
|
|
383
|
-
// Mark the popover root as the arrow host. The ARROW_CSS targets
|
|
384
|
-
// [data-ds-popover-arrow] to apply clip-path: inset(0) margin-box
|
|
385
|
-
// and box-shadow: none. Must be on the popover root (not a child)
|
|
386
|
-
// because that's where useAnchorPosition sets the margin gap.
|
|
387
|
-
popover.setAttribute('data-ds-popover-arrow', '');
|
|
388
|
-
}
|
|
389
373
|
|
|
390
374
|
/**
|
|
391
375
|
* **We are never cleaning up anchor names**
|
|
@@ -408,7 +392,7 @@ export function useAnchorPosition({
|
|
|
408
392
|
const undoPositioning = combine(setStyle({
|
|
409
393
|
el: popover,
|
|
410
394
|
styles: popoverStyles
|
|
411
|
-
})
|
|
395
|
+
}));
|
|
412
396
|
return undoPositioning;
|
|
413
397
|
}
|
|
414
398
|
|
|
@@ -546,5 +530,5 @@ export function useAnchorPosition({
|
|
|
546
530
|
popover.style.removeProperty('opacity');
|
|
547
531
|
});
|
|
548
532
|
return undoPositioning;
|
|
549
|
-
}, [anchorRef, popoverRef, stablePlacement, forceFallbackPositioning,
|
|
533
|
+
}, [anchorRef, popoverRef, stablePlacement, forceFallbackPositioning, id]);
|
|
550
534
|
}
|
|
@@ -5,7 +5,7 @@ import { ensurePresetStyles } from './ensure-preset-styles';
|
|
|
5
5
|
* is injected once into `document.head`.
|
|
6
6
|
*
|
|
7
7
|
* Works with any preset that has `{ css, name }` — animation presets
|
|
8
|
-
* (TAnimationPreset)
|
|
8
|
+
* (TAnimationPreset) satisfies this shape.
|
|
9
9
|
*/
|
|
10
10
|
export function usePresetStyles({
|
|
11
11
|
preset
|
|
@@ -5,7 +5,6 @@ import React, { forwardRef, useCallback, useLayoutEffect, useRef } from 'react';
|
|
|
5
5
|
import mergeRefs from '@atlaskit/ds-lib/merge-refs';
|
|
6
6
|
import { roleToAriaHasPopup } from '../internal/role-types';
|
|
7
7
|
import { useAnchorPosition } from '../internal/use-anchor-position';
|
|
8
|
-
import { usePresetStyles } from '../internal/use-preset-styles';
|
|
9
8
|
import { useWidthFromAnchor } from '../internal/use-width-from-anchor';
|
|
10
9
|
import { Popover } from '../popover/popover';
|
|
11
10
|
import { useMaybePopupContext } from './popup-context';
|
|
@@ -22,7 +21,6 @@ export const PopupContent = /*#__PURE__*/forwardRef(function PopupContent({
|
|
|
22
21
|
label,
|
|
23
22
|
labelledBy,
|
|
24
23
|
animate,
|
|
25
|
-
arrow,
|
|
26
24
|
mode,
|
|
27
25
|
widthFromAnchor = 'none',
|
|
28
26
|
xcss,
|
|
@@ -120,17 +118,13 @@ export const PopupContent = /*#__PURE__*/forwardRef(function PopupContent({
|
|
|
120
118
|
// reach the same DOM element for togglePopover). Otherwise use a local ref.
|
|
121
119
|
const localRef = useRef(null);
|
|
122
120
|
const popoverRef = (_ctx$popoverRef = ctx === null || ctx === void 0 ? void 0 : ctx.popoverRef) !== null && _ctx$popoverRef !== void 0 ? _ctx$popoverRef : localRef;
|
|
123
|
-
const arrowPreset = usePresetStyles({
|
|
124
|
-
preset: arrow
|
|
125
|
-
});
|
|
126
121
|
useAnchorPosition({
|
|
127
122
|
anchorRef: triggerRef !== null && triggerRef !== void 0 ? triggerRef : {
|
|
128
123
|
current: null
|
|
129
124
|
},
|
|
130
125
|
popoverRef,
|
|
131
126
|
placement,
|
|
132
|
-
forceFallbackPositioning
|
|
133
|
-
arrow: arrowPreset !== null && arrowPreset !== void 0 ? arrowPreset : undefined
|
|
127
|
+
forceFallbackPositioning
|
|
134
128
|
});
|
|
135
129
|
useWidthFromAnchor({
|
|
136
130
|
mode: widthFromAnchor,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Note: injected `<style>` elements and the tracking Set are append-only —
|
|
8
8
|
* they are never removed. This is intentional: the number of distinct
|
|
9
|
-
* presets is bounded (handful of animation
|
|
9
|
+
* presets is bounded (handful of animation presets), so the
|
|
10
10
|
* memory footprint is negligible. Removing styles would risk breaking
|
|
11
11
|
* other instances of the same preset that are still mounted.
|
|
12
12
|
*
|
|
@@ -263,8 +263,7 @@ export function useAnchorPosition(_ref5) {
|
|
|
263
263
|
_ref5$placement = _ref5.placement,
|
|
264
264
|
placement = _ref5$placement === void 0 ? {} : _ref5$placement,
|
|
265
265
|
_ref5$forceFallbackPo = _ref5.forceFallbackPositioning,
|
|
266
|
-
forceFallbackPositioning = _ref5$forceFallbackPo === void 0 ? false : _ref5$forceFallbackPo
|
|
267
|
-
arrow = _ref5.arrow;
|
|
266
|
+
forceFallbackPositioning = _ref5$forceFallbackPo === void 0 ? false : _ref5$forceFallbackPo;
|
|
268
267
|
var id = useId();
|
|
269
268
|
// Stabilize `placement` object so the same object literal
|
|
270
269
|
// value returns an object with the same reference
|
|
@@ -301,9 +300,7 @@ export function useAnchorPosition(_ref5) {
|
|
|
301
300
|
})
|
|
302
301
|
}, {
|
|
303
302
|
property: 'position-try-fallbacks',
|
|
304
|
-
value:
|
|
305
|
-
placement: stablePlacement
|
|
306
|
-
}) : placementToTryFallbacks({
|
|
303
|
+
value: placementToTryFallbacks({
|
|
307
304
|
placement: stablePlacement
|
|
308
305
|
})
|
|
309
306
|
},
|
|
@@ -366,19 +363,6 @@ export function useAnchorPosition(_ref5) {
|
|
|
366
363
|
value: crossAxisShiftActive.value
|
|
367
364
|
});
|
|
368
365
|
}
|
|
369
|
-
if (arrow) {
|
|
370
|
-
// Set the arrow size variable used by the injected arrow CSS
|
|
371
|
-
// and the @position-try rules for margin values.
|
|
372
|
-
popoverStyles.push({
|
|
373
|
-
property: '--ds-arrow-size',
|
|
374
|
-
value: gapCssValue
|
|
375
|
-
});
|
|
376
|
-
// Mark the popover root as the arrow host. The ARROW_CSS targets
|
|
377
|
-
// [data-ds-popover-arrow] to apply clip-path: inset(0) margin-box
|
|
378
|
-
// and box-shadow: none. Must be on the popover root (not a child)
|
|
379
|
-
// because that's where useAnchorPosition sets the margin gap.
|
|
380
|
-
popover.setAttribute('data-ds-popover-arrow', '');
|
|
381
|
-
}
|
|
382
366
|
|
|
383
367
|
/**
|
|
384
368
|
* **We are never cleaning up anchor names**
|
|
@@ -401,9 +385,7 @@ export function useAnchorPosition(_ref5) {
|
|
|
401
385
|
var _undoPositioning = combine(setStyle({
|
|
402
386
|
el: popover,
|
|
403
387
|
styles: popoverStyles
|
|
404
|
-
})
|
|
405
|
-
return popover.removeAttribute('data-ds-popover-arrow');
|
|
406
|
-
} : function () {});
|
|
388
|
+
}));
|
|
407
389
|
return _undoPositioning;
|
|
408
390
|
}
|
|
409
391
|
|
|
@@ -552,5 +534,5 @@ export function useAnchorPosition(_ref5) {
|
|
|
552
534
|
popover.style.removeProperty('opacity');
|
|
553
535
|
});
|
|
554
536
|
return undoPositioning;
|
|
555
|
-
}, [anchorRef, popoverRef, stablePlacement, forceFallbackPositioning,
|
|
537
|
+
}, [anchorRef, popoverRef, stablePlacement, forceFallbackPositioning, id]);
|
|
556
538
|
}
|
|
@@ -5,7 +5,7 @@ import { ensurePresetStyles } from './ensure-preset-styles';
|
|
|
5
5
|
* is injected once into `document.head`.
|
|
6
6
|
*
|
|
7
7
|
* Works with any preset that has `{ css, name }` — animation presets
|
|
8
|
-
* (TAnimationPreset)
|
|
8
|
+
* (TAnimationPreset) satisfies this shape.
|
|
9
9
|
*/
|
|
10
10
|
export function usePresetStyles(_ref) {
|
|
11
11
|
var preset = _ref.preset;
|
|
@@ -5,7 +5,6 @@ import React, { forwardRef, useCallback, useLayoutEffect, useRef } from 'react';
|
|
|
5
5
|
import mergeRefs from '@atlaskit/ds-lib/merge-refs';
|
|
6
6
|
import { roleToAriaHasPopup } from '../internal/role-types';
|
|
7
7
|
import { useAnchorPosition } from '../internal/use-anchor-position';
|
|
8
|
-
import { usePresetStyles } from '../internal/use-preset-styles';
|
|
9
8
|
import { useWidthFromAnchor } from '../internal/use-width-from-anchor';
|
|
10
9
|
import { Popover } from '../popover/popover';
|
|
11
10
|
import { useMaybePopupContext } from './popup-context';
|
|
@@ -23,7 +22,6 @@ export var PopupContent = /*#__PURE__*/forwardRef(function PopupContent(_ref, re
|
|
|
23
22
|
label = _ref.label,
|
|
24
23
|
labelledBy = _ref.labelledBy,
|
|
25
24
|
animate = _ref.animate,
|
|
26
|
-
arrow = _ref.arrow,
|
|
27
25
|
mode = _ref.mode,
|
|
28
26
|
_ref$widthFromAnchor = _ref.widthFromAnchor,
|
|
29
27
|
widthFromAnchor = _ref$widthFromAnchor === void 0 ? 'none' : _ref$widthFromAnchor,
|
|
@@ -120,17 +118,13 @@ export var PopupContent = /*#__PURE__*/forwardRef(function PopupContent(_ref, re
|
|
|
120
118
|
// reach the same DOM element for togglePopover). Otherwise use a local ref.
|
|
121
119
|
var localRef = useRef(null);
|
|
122
120
|
var popoverRef = (_ctx$popoverRef = ctx === null || ctx === void 0 ? void 0 : ctx.popoverRef) !== null && _ctx$popoverRef !== void 0 ? _ctx$popoverRef : localRef;
|
|
123
|
-
var arrowPreset = usePresetStyles({
|
|
124
|
-
preset: arrow
|
|
125
|
-
});
|
|
126
121
|
useAnchorPosition({
|
|
127
122
|
anchorRef: triggerRef !== null && triggerRef !== void 0 ? triggerRef : {
|
|
128
123
|
current: null
|
|
129
124
|
},
|
|
130
125
|
popoverRef: popoverRef,
|
|
131
126
|
placement: placement,
|
|
132
|
-
forceFallbackPositioning: forceFallbackPositioning
|
|
133
|
-
arrow: arrowPreset !== null && arrowPreset !== void 0 ? arrowPreset : undefined
|
|
127
|
+
forceFallbackPositioning: forceFallbackPositioning
|
|
134
128
|
});
|
|
135
129
|
useWidthFromAnchor({
|
|
136
130
|
mode: widthFromAnchor,
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
* is never painted at the wrong location.
|
|
14
14
|
*/
|
|
15
15
|
import { type RefObject } from 'react';
|
|
16
|
-
import { type TArrowPreset } from '../arrow/types';
|
|
17
16
|
import { type TPlacementOptions } from '../internal/resolve-placement';
|
|
18
17
|
export { getPlacement } from './resolve-placement';
|
|
19
18
|
/**
|
|
@@ -91,7 +90,7 @@ export declare function placementToTryFallbacks({ placement }: {
|
|
|
91
90
|
* comparison is used internally so re-runs are skipped when the resolved
|
|
92
91
|
* placement shape is unchanged.
|
|
93
92
|
*/
|
|
94
|
-
export declare function useAnchorPosition({ anchorRef, popoverRef, placement, forceFallbackPositioning,
|
|
93
|
+
export declare function useAnchorPosition({ anchorRef, popoverRef, placement, forceFallbackPositioning, }: {
|
|
95
94
|
/**
|
|
96
95
|
* Element to position relative to.
|
|
97
96
|
*/
|
|
@@ -127,13 +126,4 @@ export declare function useAnchorPosition({ anchorRef, popoverRef, placement, fo
|
|
|
127
126
|
* behavior in any environment, including production.
|
|
128
127
|
*/
|
|
129
128
|
forceFallbackPositioning?: boolean;
|
|
130
|
-
/**
|
|
131
|
-
* Arrow preset from `@atlaskit/top-layer/arrow`. When provided, uses
|
|
132
|
-
* the preset's named `@position-try` rules (which update both
|
|
133
|
-
* `position-area` and `margin` on flip) and sets `--ds-arrow-size`.
|
|
134
|
-
*
|
|
135
|
-
* Pass `null` to disable. Has no effect in the JS fallback path -
|
|
136
|
-
* arrows are CSS-only.
|
|
137
|
-
*/
|
|
138
|
-
arrow?: TArrowPreset | null;
|
|
139
129
|
}): void;
|
|
@@ -7,7 +7,7 @@ type TPresetWithCssAndName = {
|
|
|
7
7
|
* is injected once into `document.head`.
|
|
8
8
|
*
|
|
9
9
|
* Works with any preset that has `{ css, name }` — animation presets
|
|
10
|
-
* (TAnimationPreset)
|
|
10
|
+
* (TAnimationPreset) satisfies this shape.
|
|
11
11
|
*/
|
|
12
12
|
export declare function usePresetStyles<T extends TPresetWithCssAndName>({ preset, }: {
|
|
13
13
|
preset: T | false | null | undefined;
|
|
@@ -41,8 +41,7 @@ type TPopoverBaseProps = {
|
|
|
41
41
|
children: ReactNode;
|
|
42
42
|
/**
|
|
43
43
|
* Additional CSS styles applied to the popover root element.
|
|
44
|
-
* Use to set `backgroundColor`
|
|
45
|
-
* `background: inherit`) match the popup surface colour.
|
|
44
|
+
* Use to set `backgroundColor` to match the popup surface colour.
|
|
46
45
|
*/
|
|
47
46
|
xcss?: StrictXCSSProp<'backgroundColor', never>;
|
|
48
47
|
/**
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type ReactElement, type ReactNode, type Ref, type RefObject } from 'react';
|
|
2
2
|
import { type StrictXCSSProp } from '@atlaskit/css';
|
|
3
3
|
import { type TAnimationPreset } from '../animations/types';
|
|
4
|
-
import { type TArrowPreset } from '../arrow/types';
|
|
5
4
|
import { type TPlacementOptions } from '../internal/resolve-placement';
|
|
6
5
|
import { type TRoleRequiringAccessibleName, type TRoleWithImplicitName } from '../internal/role-types';
|
|
7
6
|
import { type TPopoverCloseReason, type TWidthFromAnchorMode } from '../popover/types';
|
|
@@ -131,14 +130,10 @@ type TPopupContentBaseProps = {
|
|
|
131
130
|
* Applies additional CSS styles to the popover root element using
|
|
132
131
|
* design-system-safe xcss.
|
|
133
132
|
*
|
|
134
|
-
* **Required when using `arrow`:** the arrow pseudo-elements use
|
|
135
|
-
* `background: inherit` to pick up their color from the popover root.
|
|
136
|
-
* Without setting `backgroundColor` here, the arrow tip will be transparent.
|
|
137
|
-
*
|
|
138
133
|
* @example
|
|
139
134
|
* ```tsx
|
|
140
135
|
* const styles = cssMap({ surface: { backgroundColor: token('elevation.surface.overlay') } });
|
|
141
|
-
* <Popup.Content xcss={styles.surface}
|
|
136
|
+
* <Popup.Content xcss={styles.surface} ... />
|
|
142
137
|
* ```
|
|
143
138
|
*/
|
|
144
139
|
xcss?: StrictXCSSProp<'backgroundColor', never>;
|
|
@@ -173,28 +168,6 @@ type TPopupContentBaseProps = {
|
|
|
173
168
|
* behavior in any environment, including production.
|
|
174
169
|
*/
|
|
175
170
|
forceFallbackPositioning?: boolean;
|
|
176
|
-
/**
|
|
177
|
-
* Arrow preset from `@atlaskit/top-layer/arrow`.
|
|
178
|
-
*
|
|
179
|
-
* When provided, renders CSS arrows that automatically flip when the
|
|
180
|
-
* popover flips via `@position-try` fallbacks. The arrows inherit
|
|
181
|
-
* their background color from the popover element.
|
|
182
|
-
*
|
|
183
|
-
* @example
|
|
184
|
-
* ```tsx
|
|
185
|
-
* import { arrow } from '@atlaskit/top-layer/arrow';
|
|
186
|
-
*
|
|
187
|
-
* const myArrow = arrow();
|
|
188
|
-
* <Popup.Content arrow={myArrow} />
|
|
189
|
-
* ```
|
|
190
|
-
*
|
|
191
|
-
* Constraints:
|
|
192
|
-
* - `box-shadow` is disabled on the popover (incompatible with the
|
|
193
|
-
* `clip-path: inset() margin-box` technique)
|
|
194
|
-
* - `::before` and `::after` pseudo-elements are consumed by the arrows
|
|
195
|
-
* - Only works with CSS Anchor Positioning; no arrow in the JS fallback
|
|
196
|
-
*/
|
|
197
|
-
arrow?: false | TArrowPreset;
|
|
198
171
|
/**
|
|
199
172
|
* Native popover attribute value. Default is `'auto'`.
|
|
200
173
|
*
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
* is never painted at the wrong location.
|
|
14
14
|
*/
|
|
15
15
|
import { type RefObject } from 'react';
|
|
16
|
-
import { type TArrowPreset } from '../arrow/types';
|
|
17
16
|
import { type TPlacementOptions } from '../internal/resolve-placement';
|
|
18
17
|
export { getPlacement } from './resolve-placement';
|
|
19
18
|
/**
|
|
@@ -91,7 +90,7 @@ export declare function placementToTryFallbacks({ placement }: {
|
|
|
91
90
|
* comparison is used internally so re-runs are skipped when the resolved
|
|
92
91
|
* placement shape is unchanged.
|
|
93
92
|
*/
|
|
94
|
-
export declare function useAnchorPosition({ anchorRef, popoverRef, placement, forceFallbackPositioning,
|
|
93
|
+
export declare function useAnchorPosition({ anchorRef, popoverRef, placement, forceFallbackPositioning, }: {
|
|
95
94
|
/**
|
|
96
95
|
* Element to position relative to.
|
|
97
96
|
*/
|
|
@@ -127,13 +126,4 @@ export declare function useAnchorPosition({ anchorRef, popoverRef, placement, fo
|
|
|
127
126
|
* behavior in any environment, including production.
|
|
128
127
|
*/
|
|
129
128
|
forceFallbackPositioning?: boolean;
|
|
130
|
-
/**
|
|
131
|
-
* Arrow preset from `@atlaskit/top-layer/arrow`. When provided, uses
|
|
132
|
-
* the preset's named `@position-try` rules (which update both
|
|
133
|
-
* `position-area` and `margin` on flip) and sets `--ds-arrow-size`.
|
|
134
|
-
*
|
|
135
|
-
* Pass `null` to disable. Has no effect in the JS fallback path -
|
|
136
|
-
* arrows are CSS-only.
|
|
137
|
-
*/
|
|
138
|
-
arrow?: TArrowPreset | null;
|
|
139
129
|
}): void;
|
|
@@ -7,7 +7,7 @@ type TPresetWithCssAndName = {
|
|
|
7
7
|
* is injected once into `document.head`.
|
|
8
8
|
*
|
|
9
9
|
* Works with any preset that has `{ css, name }` — animation presets
|
|
10
|
-
* (TAnimationPreset)
|
|
10
|
+
* (TAnimationPreset) satisfies this shape.
|
|
11
11
|
*/
|
|
12
12
|
export declare function usePresetStyles<T extends TPresetWithCssAndName>({ preset, }: {
|
|
13
13
|
preset: T | false | null | undefined;
|
|
@@ -41,8 +41,7 @@ type TPopoverBaseProps = {
|
|
|
41
41
|
children: ReactNode;
|
|
42
42
|
/**
|
|
43
43
|
* Additional CSS styles applied to the popover root element.
|
|
44
|
-
* Use to set `backgroundColor`
|
|
45
|
-
* `background: inherit`) match the popup surface colour.
|
|
44
|
+
* Use to set `backgroundColor` to match the popup surface colour.
|
|
46
45
|
*/
|
|
47
46
|
xcss?: StrictXCSSProp<'backgroundColor', never>;
|
|
48
47
|
/**
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type ReactElement, type ReactNode, type Ref, type RefObject } from 'react';
|
|
2
2
|
import { type StrictXCSSProp } from '@atlaskit/css';
|
|
3
3
|
import { type TAnimationPreset } from '../animations/types';
|
|
4
|
-
import { type TArrowPreset } from '../arrow/types';
|
|
5
4
|
import { type TPlacementOptions } from '../internal/resolve-placement';
|
|
6
5
|
import { type TRoleRequiringAccessibleName, type TRoleWithImplicitName } from '../internal/role-types';
|
|
7
6
|
import { type TPopoverCloseReason, type TWidthFromAnchorMode } from '../popover/types';
|
|
@@ -131,14 +130,10 @@ type TPopupContentBaseProps = {
|
|
|
131
130
|
* Applies additional CSS styles to the popover root element using
|
|
132
131
|
* design-system-safe xcss.
|
|
133
132
|
*
|
|
134
|
-
* **Required when using `arrow`:** the arrow pseudo-elements use
|
|
135
|
-
* `background: inherit` to pick up their color from the popover root.
|
|
136
|
-
* Without setting `backgroundColor` here, the arrow tip will be transparent.
|
|
137
|
-
*
|
|
138
133
|
* @example
|
|
139
134
|
* ```tsx
|
|
140
135
|
* const styles = cssMap({ surface: { backgroundColor: token('elevation.surface.overlay') } });
|
|
141
|
-
* <Popup.Content xcss={styles.surface}
|
|
136
|
+
* <Popup.Content xcss={styles.surface} ... />
|
|
142
137
|
* ```
|
|
143
138
|
*/
|
|
144
139
|
xcss?: StrictXCSSProp<'backgroundColor', never>;
|
|
@@ -173,28 +168,6 @@ type TPopupContentBaseProps = {
|
|
|
173
168
|
* behavior in any environment, including production.
|
|
174
169
|
*/
|
|
175
170
|
forceFallbackPositioning?: boolean;
|
|
176
|
-
/**
|
|
177
|
-
* Arrow preset from `@atlaskit/top-layer/arrow`.
|
|
178
|
-
*
|
|
179
|
-
* When provided, renders CSS arrows that automatically flip when the
|
|
180
|
-
* popover flips via `@position-try` fallbacks. The arrows inherit
|
|
181
|
-
* their background color from the popover element.
|
|
182
|
-
*
|
|
183
|
-
* @example
|
|
184
|
-
* ```tsx
|
|
185
|
-
* import { arrow } from '@atlaskit/top-layer/arrow';
|
|
186
|
-
*
|
|
187
|
-
* const myArrow = arrow();
|
|
188
|
-
* <Popup.Content arrow={myArrow} />
|
|
189
|
-
* ```
|
|
190
|
-
*
|
|
191
|
-
* Constraints:
|
|
192
|
-
* - `box-shadow` is disabled on the popover (incompatible with the
|
|
193
|
-
* `clip-path: inset() margin-box` technique)
|
|
194
|
-
* - `::before` and `::after` pseudo-elements are consumed by the arrows
|
|
195
|
-
* - Only works with CSS Anchor Positioning; no arrow in the JS fallback
|
|
196
|
-
*/
|
|
197
|
-
arrow?: false | TArrowPreset;
|
|
198
171
|
/**
|
|
199
172
|
* Native popover attribute value. Default is `'auto'`.
|
|
200
173
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/top-layer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.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",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@atlaskit/browser-apis": "^0.0.
|
|
37
|
+
"@atlaskit/browser-apis": "^0.0.2",
|
|
38
38
|
"@atlaskit/css": "^0.19.0",
|
|
39
39
|
"@atlaskit/ds-lib": "^7.0.0",
|
|
40
40
|
"@atlaskit/layering": "^3.7.0",
|
package/arrow/package.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@atlaskit/top-layer/arrow",
|
|
3
|
-
"main": "../dist/cjs/entry-points/arrow.js",
|
|
4
|
-
"module": "../dist/esm/entry-points/arrow.js",
|
|
5
|
-
"module:es2019": "../dist/es2019/entry-points/arrow.js",
|
|
6
|
-
"sideEffects": [
|
|
7
|
-
"*.compiled.css"
|
|
8
|
-
],
|
|
9
|
-
"types": "../dist/types/entry-points/arrow.d.ts",
|
|
10
|
-
"typesVersions": {
|
|
11
|
-
">=4.5 <5.9": {
|
|
12
|
-
"*": [
|
|
13
|
-
"../dist/types-ts4.5/entry-points/arrow.d.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|