@atlaskit/top-layer 0.11.0 → 0.12.1
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/dist/cjs/animations/presets.js +5 -0
- package/dist/cjs/entry-points/use-arrow-navigation.js +3 -2
- package/dist/cjs/internal/placement-to-position-area.js +43 -0
- package/dist/cjs/internal/placement-to-try-fallbacks.js +82 -0
- package/dist/cjs/internal/use-anchor-position.js +18 -131
- package/dist/cjs/internal/use-animated-visibility.js +84 -7
- package/dist/cjs/popover/popover.js +2 -0
- package/dist/cjs/popup/popup-content.js +55 -15
- package/dist/cjs/popup/popup-context.js +14 -33
- package/dist/cjs/popup/popup-provider.js +15 -0
- package/dist/cjs/popup/popup-trigger-function.js +9 -6
- package/dist/cjs/popup/popup-trigger.js +14 -9
- package/dist/cjs/popup/popup.js +7 -7
- package/dist/cjs/popup/use-maybe-popup-context.js +17 -0
- package/dist/cjs/popup/use-popup-context.js +20 -0
- package/dist/cjs/use-arrow-navigation/index.js +3 -2
- package/dist/cjs/use-arrow-navigation/is-at-current-menu-level.js +87 -0
- package/dist/cjs/use-arrow-navigation/use-arrow-navigation.js +0 -82
- package/dist/es2019/animations/presets.js +5 -0
- package/dist/es2019/entry-points/use-arrow-navigation.js +2 -1
- package/dist/es2019/internal/placement-to-position-area.js +40 -0
- package/dist/es2019/internal/placement-to-try-fallbacks.js +77 -0
- package/dist/es2019/internal/use-anchor-position.js +2 -116
- package/dist/es2019/internal/use-animated-visibility.js +84 -7
- package/dist/es2019/popover/popover.js +2 -0
- package/dist/es2019/popup/popup-content.js +55 -14
- package/dist/es2019/popup/popup-context.js +14 -30
- package/dist/es2019/popup/popup-provider.js +10 -0
- package/dist/es2019/popup/popup-trigger-function.js +8 -5
- package/dist/es2019/popup/popup-trigger.js +14 -8
- package/dist/es2019/popup/popup.js +4 -4
- package/dist/es2019/popup/use-maybe-popup-context.js +12 -0
- package/dist/es2019/popup/use-popup-context.js +15 -0
- package/dist/es2019/use-arrow-navigation/index.js +2 -1
- package/dist/es2019/use-arrow-navigation/is-at-current-menu-level.js +81 -0
- package/dist/es2019/use-arrow-navigation/use-arrow-navigation.js +0 -81
- package/dist/esm/animations/presets.js +5 -0
- package/dist/esm/entry-points/use-arrow-navigation.js +2 -1
- package/dist/esm/internal/placement-to-position-area.js +38 -0
- package/dist/esm/internal/placement-to-try-fallbacks.js +76 -0
- package/dist/esm/internal/use-anchor-position.js +16 -127
- package/dist/esm/internal/use-animated-visibility.js +84 -7
- package/dist/esm/popover/popover.js +2 -0
- package/dist/esm/popup/popup-content.js +55 -14
- package/dist/esm/popup/popup-context.js +14 -30
- package/dist/esm/popup/popup-provider.js +10 -0
- package/dist/esm/popup/popup-trigger-function.js +8 -5
- package/dist/esm/popup/popup-trigger.js +14 -8
- package/dist/esm/popup/popup.js +6 -6
- package/dist/esm/popup/use-maybe-popup-context.js +12 -0
- package/dist/esm/popup/use-popup-context.js +15 -0
- package/dist/esm/use-arrow-navigation/index.js +2 -1
- package/dist/esm/use-arrow-navigation/is-at-current-menu-level.js +81 -0
- package/dist/esm/use-arrow-navigation/use-arrow-navigation.js +0 -81
- package/dist/types/animations/types.d.ts +5 -1
- package/dist/types/entry-points/use-arrow-navigation.d.ts +2 -1
- package/dist/types/internal/placement-to-position-area.d.ts +21 -0
- package/dist/types/internal/placement-to-try-fallbacks.d.ts +36 -0
- package/dist/types/internal/use-anchor-position.d.ts +0 -55
- package/dist/types/internal/use-animated-visibility.d.ts +8 -2
- package/dist/types/popover/types.d.ts +8 -0
- package/dist/types/popup/popup-context.d.ts +25 -25
- package/dist/types/popup/popup-provider.d.ts +10 -0
- package/dist/types/popup/types.d.ts +12 -0
- package/dist/types/popup/use-maybe-popup-context.d.ts +8 -0
- package/dist/types/popup/use-popup-context.d.ts +7 -0
- package/dist/types/use-arrow-navigation/index.d.ts +2 -1
- package/dist/types/use-arrow-navigation/is-at-current-menu-level.d.ts +48 -0
- package/dist/types/use-arrow-navigation/use-arrow-navigation.d.ts +0 -48
- package/dist/types-ts4.5/animations/types.d.ts +5 -1
- package/dist/types-ts4.5/entry-points/use-arrow-navigation.d.ts +2 -1
- package/dist/types-ts4.5/internal/placement-to-position-area.d.ts +21 -0
- package/dist/types-ts4.5/internal/placement-to-try-fallbacks.d.ts +36 -0
- package/dist/types-ts4.5/internal/use-anchor-position.d.ts +0 -55
- package/dist/types-ts4.5/internal/use-animated-visibility.d.ts +8 -2
- package/dist/types-ts4.5/popover/types.d.ts +8 -0
- package/dist/types-ts4.5/popup/popup-context.d.ts +25 -25
- package/dist/types-ts4.5/popup/popup-provider.d.ts +10 -0
- package/dist/types-ts4.5/popup/types.d.ts +12 -0
- package/dist/types-ts4.5/popup/use-maybe-popup-context.d.ts +8 -0
- package/dist/types-ts4.5/popup/use-popup-context.d.ts +7 -0
- package/dist/types-ts4.5/use-arrow-navigation/index.d.ts +2 -1
- package/dist/types-ts4.5/use-arrow-navigation/is-at-current-menu-level.d.ts +48 -0
- package/dist/types-ts4.5/use-arrow-navigation/use-arrow-navigation.d.ts +0 -48
- package/package.json +2 -2
- package/dist/cjs/arrow/index.js +0 -131
- package/dist/cjs/arrow/types.js +0 -5
- package/dist/es2019/arrow/index.js +0 -269
- package/dist/es2019/arrow/types.js +0 -1
- package/dist/esm/arrow/index.js +0 -124
- package/dist/esm/arrow/types.js +0 -1
- package/dist/types/arrow/index.d.ts +0 -24
- package/dist/types/arrow/types.d.ts +0 -29
- package/dist/types-ts4.5/arrow/index.d.ts +0 -24
- package/dist/types-ts4.5/arrow/types.d.ts +0 -29
package/dist/esm/arrow/index.js
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import once from '@atlaskit/ds-lib/once';
|
|
2
|
-
import { getPlacement } from '../internal/resolve-placement';
|
|
3
|
-
import { placementToPositionArea } from '../internal/use-anchor-position';
|
|
4
|
-
/**
|
|
5
|
-
* CSS for popover arrows using the `clip-path: inset() margin-box` technique.
|
|
6
|
-
*
|
|
7
|
-
* How it works:
|
|
8
|
-
* 1. Four arrow shapes exist simultaneously as `::before` (top/bottom) and
|
|
9
|
-
* `::after` (left/right) hexagonal pseudo-elements.
|
|
10
|
-
* 2. `clip-path: inset(0) margin-box` clips the popover to its margin-box.
|
|
11
|
-
* 3. Margin on the anchor-facing side pushes the popover away, creating space
|
|
12
|
-
* where one arrow "escapes" the clip boundary and becomes visible.
|
|
13
|
-
* 4. `@position-try` rules change both `position-area` and `margin` when
|
|
14
|
-
* flipping, ensuring the correct arrow is always shown.
|
|
15
|
-
*
|
|
16
|
-
* Constraints:
|
|
17
|
-
* - `box-shadow` must be `none` (interferes with `clip-path: inset() margin-box`)
|
|
18
|
-
* - `::before` and `::after` are consumed - consumers cannot use them
|
|
19
|
-
* - Arrow pseudo-elements use `background: inherit` from the popover element
|
|
20
|
-
*
|
|
21
|
-
* @see https://goulet.dev/posts/tooltip-with-popover-and-anchor-positioning/
|
|
22
|
-
*/
|
|
23
|
-
var ARROW_CSS = "\n[data-ds-popover-arrow] {\n clip-path: inset(var(--ds-arrow-offset, 0px)) margin-box;\n box-shadow: none;\n}\n\n/* Top and Bottom arrows (vertical hexagon) */\n[data-ds-popover-arrow]::before {\n content: \"\";\n position: absolute;\n z-index: -1;\n background: inherit;\n left: 50%;\n transform: translateX(-50%);\n width: calc(var(--ds-arrow-size, 8px) * 2);\n height: calc(100% + var(--ds-arrow-size, 8px) * 2);\n top: calc(var(--ds-arrow-size, 8px) * -1);\n clip-path: polygon(\n 0 var(--ds-arrow-size, 8px),\n 50% 0,\n 100% var(--ds-arrow-size, 8px),\n 100% calc(100% - var(--ds-arrow-size, 8px)),\n 50% 100%,\n 0 calc(100% - var(--ds-arrow-size, 8px))\n );\n}\n\n/* Left and Right arrows (horizontal hexagon) */\n[data-ds-popover-arrow]::after {\n content: \"\";\n position: absolute;\n z-index: -1;\n background: inherit;\n top: 50%;\n transform: translateY(-50%);\n height: calc(var(--ds-arrow-size, 8px) * 2);\n width: calc(100% + var(--ds-arrow-size, 8px) * 2);\n left: calc(var(--ds-arrow-size, 8px) * -1);\n clip-path: polygon(\n var(--ds-arrow-size, 8px) 0,\n calc(100% - var(--ds-arrow-size, 8px)) 0,\n 100% 50%,\n calc(100% - var(--ds-arrow-size, 8px)) 100%,\n var(--ds-arrow-size, 8px) 100%,\n 0 50%\n );\n}\n\n/* \u2500\u2500 @position-try rules \u2500\u2500\n * One rule per possible position-area value.\n * Each sets the position-area and the correct margin direction\n * so the arrow on the anchor-facing side is revealed.\n *\n * Margin direction per edge:\n * block-start (above anchor) \u2192 margin-block-end (bottom, facing anchor)\n * block-end (below anchor) \u2192 margin-block-start (top, facing anchor)\n * inline-start (left of anchor) \u2192 margin-inline-end (right, facing anchor)\n * inline-end (right of anchor) \u2192 margin-inline-start (left, facing anchor)\n */\n\n/* Each rule sets two margins: the anchor-facing margin for the gap\n (via --ds-arrow-size) and one cross-axis margin for the shift\n (via one of --ds-cross-axis-shift-margin-start, --ds-cross-axis-shift-margin-end,\n --ds-cross-axis-shift-margin-block-start, or --ds-cross-axis-shift-margin-block-end). The\n side matches the popover's anchored cross-axis edge per align. Only\n one of the four properties is non-zero at a time; useAnchorPosition\n picks it. See notes/architecture/positioning.md for details. */\n/* Single-axis centered (align: center) */\n@position-try --ds-arrow-block-start {\n position-area: block-start;\n margin: 0;\n margin-block-end: var(--ds-arrow-size, 8px);\n margin-inline-start: var(--ds-cross-axis-shift-margin-start, 0px);\n}\n@position-try --ds-arrow-block-end {\n position-area: block-end;\n margin: 0;\n margin-block-start: var(--ds-arrow-size, 8px);\n margin-inline-start: var(--ds-cross-axis-shift-margin-start, 0px);\n}\n@position-try --ds-arrow-inline-start {\n position-area: inline-start;\n margin: 0;\n margin-inline-end: var(--ds-arrow-size, 8px);\n margin-block-start: var(--ds-cross-axis-shift-margin-block-start, 0px);\n}\n@position-try --ds-arrow-inline-end {\n position-area: inline-end;\n margin: 0;\n margin-inline-start: var(--ds-arrow-size, 8px);\n margin-block-start: var(--ds-cross-axis-shift-margin-block-start, 0px);\n}\n\n/* Block edge + inline span (align: start uses span-inline-end; align: end uses span-inline-start) */\n@position-try --ds-arrow-block-start-span-inline-start {\n position-area: block-start span-inline-start;\n margin: 0;\n margin-block-end: var(--ds-arrow-size, 8px);\n margin-inline-end: var(--ds-cross-axis-shift-margin-end, 0px);\n}\n@position-try --ds-arrow-block-start-span-inline-end {\n position-area: block-start span-inline-end;\n margin: 0;\n margin-block-end: var(--ds-arrow-size, 8px);\n margin-inline-start: var(--ds-cross-axis-shift-margin-start, 0px);\n}\n@position-try --ds-arrow-block-end-span-inline-start {\n position-area: block-end span-inline-start;\n margin: 0;\n margin-block-start: var(--ds-arrow-size, 8px);\n margin-inline-end: var(--ds-cross-axis-shift-margin-end, 0px);\n}\n@position-try --ds-arrow-block-end-span-inline-end {\n position-area: block-end span-inline-end;\n margin: 0;\n margin-block-start: var(--ds-arrow-size, 8px);\n margin-inline-start: var(--ds-cross-axis-shift-margin-start, 0px);\n}\n\n/* Inline edge + block span (align: start uses span-block-end; align: end uses span-block-start) */\n@position-try --ds-arrow-inline-start-span-block-start {\n position-area: inline-start span-block-start;\n margin: 0;\n margin-inline-end: var(--ds-arrow-size, 8px);\n margin-block-end: var(--ds-cross-axis-shift-margin-block-end, 0px);\n}\n@position-try --ds-arrow-inline-start-span-block-end {\n position-area: inline-start span-block-end;\n margin: 0;\n margin-inline-end: var(--ds-arrow-size, 8px);\n margin-block-start: var(--ds-cross-axis-shift-margin-block-start, 0px);\n}\n@position-try --ds-arrow-inline-end-span-block-start {\n position-area: inline-end span-block-start;\n margin: 0;\n margin-inline-start: var(--ds-arrow-size, 8px);\n margin-block-end: var(--ds-cross-axis-shift-margin-block-end, 0px);\n}\n@position-try --ds-arrow-inline-end-span-block-end {\n position-area: inline-end span-block-end;\n margin: 0;\n margin-inline-start: var(--ds-arrow-size, 8px);\n margin-block-start: var(--ds-cross-axis-shift-margin-block-start, 0px);\n}\n";
|
|
24
|
-
|
|
25
|
-
// ── Placement utilities ──
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Converts a `position-area` value to a CSS rule name by replacing spaces with hyphens
|
|
29
|
-
* and prepending `--ds-arrow-`.
|
|
30
|
-
*
|
|
31
|
-
* @example positionAreaToRuleName('block-end span-inline-start') → '--ds-arrow-block-end-span-inline-start'
|
|
32
|
-
*/
|
|
33
|
-
function positionAreaToRuleName(_ref) {
|
|
34
|
-
var positionArea = _ref.positionArea;
|
|
35
|
-
return "--ds-arrow-".concat(positionArea.replace(/ /g, '-'));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Returns `position-try-fallbacks` using named `@position-try` rules
|
|
40
|
-
* that change both `position-area` and `margin` when flipping.
|
|
41
|
-
*
|
|
42
|
-
* This is required for the arrow technique because built-in keywords
|
|
43
|
-
* (`flip-block`, `flip-inline`) only flip `position-area` - they do
|
|
44
|
-
* not update the margin direction needed to reveal the correct arrow.
|
|
45
|
-
*/
|
|
46
|
-
function getTryFallbacks(_ref2) {
|
|
47
|
-
var placement = _ref2.placement;
|
|
48
|
-
var _getPlacement = getPlacement({
|
|
49
|
-
placement: placement
|
|
50
|
-
}),
|
|
51
|
-
axis = _getPlacement.axis,
|
|
52
|
-
edge = _getPlacement.edge,
|
|
53
|
-
align = _getPlacement.align;
|
|
54
|
-
if (align === 'center') {
|
|
55
|
-
// Single-axis: only flip the edge
|
|
56
|
-
var _flippedEdge = edge === 'start' ? 'end' : 'start';
|
|
57
|
-
return positionAreaToRuleName({
|
|
58
|
-
positionArea: placementToPositionArea({
|
|
59
|
-
placement: {
|
|
60
|
-
axis: axis,
|
|
61
|
-
edge: _flippedEdge
|
|
62
|
-
}
|
|
63
|
-
})
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Compound placement: try flipping edge, alignment, and both
|
|
68
|
-
var flippedEdge = edge === 'start' ? 'end' : 'start';
|
|
69
|
-
var flippedAlign = align === 'start' ? 'end' : 'start';
|
|
70
|
-
return [positionAreaToRuleName({
|
|
71
|
-
positionArea: placementToPositionArea({
|
|
72
|
-
placement: {
|
|
73
|
-
axis: axis,
|
|
74
|
-
edge: flippedEdge,
|
|
75
|
-
align: align
|
|
76
|
-
}
|
|
77
|
-
})
|
|
78
|
-
}), positionAreaToRuleName({
|
|
79
|
-
positionArea: placementToPositionArea({
|
|
80
|
-
placement: {
|
|
81
|
-
axis: axis,
|
|
82
|
-
edge: edge,
|
|
83
|
-
align: flippedAlign
|
|
84
|
-
}
|
|
85
|
-
})
|
|
86
|
-
}), positionAreaToRuleName({
|
|
87
|
-
positionArea: placementToPositionArea({
|
|
88
|
-
placement: {
|
|
89
|
-
axis: axis,
|
|
90
|
-
edge: flippedEdge,
|
|
91
|
-
align: flippedAlign
|
|
92
|
-
}
|
|
93
|
-
})
|
|
94
|
-
})].join(', ');
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Creates an arrow preset for popover content.
|
|
99
|
-
*
|
|
100
|
-
* The returned object is passed to `PopoverContent`'s `arrow` prop.
|
|
101
|
-
* It carries the CSS string and fallback logic so that consumers who
|
|
102
|
-
* do not use arrows pay no bundle cost.
|
|
103
|
-
*
|
|
104
|
-
* The arrows inherit their background from the popover element.
|
|
105
|
-
* When `arrow` is active, `PopoverContent` does not reset `background`
|
|
106
|
-
* to `transparent`, allowing the UA default (`canvas`) or a consumer-set
|
|
107
|
-
* background to show through.
|
|
108
|
-
*
|
|
109
|
-
* @example
|
|
110
|
-
* ```tsx
|
|
111
|
-
* import { arrow } from '@atlaskit/top-layer/arrow';
|
|
112
|
-
*
|
|
113
|
-
* const myArrow = arrow();
|
|
114
|
-
*
|
|
115
|
-
* <Popup.Content arrow={myArrow} />
|
|
116
|
-
* ```
|
|
117
|
-
*/
|
|
118
|
-
export var arrow = once(function () {
|
|
119
|
-
return {
|
|
120
|
-
name: 'arrow',
|
|
121
|
-
css: ARROW_CSS,
|
|
122
|
-
getTryFallbacks: getTryFallbacks
|
|
123
|
-
};
|
|
124
|
-
});
|
package/dist/esm/arrow/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { type TArrowPreset } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Creates an arrow preset for popover content.
|
|
4
|
-
*
|
|
5
|
-
* The returned object is passed to `PopoverContent`'s `arrow` prop.
|
|
6
|
-
* It carries the CSS string and fallback logic so that consumers who
|
|
7
|
-
* do not use arrows pay no bundle cost.
|
|
8
|
-
*
|
|
9
|
-
* The arrows inherit their background from the popover element.
|
|
10
|
-
* When `arrow` is active, `PopoverContent` does not reset `background`
|
|
11
|
-
* to `transparent`, allowing the UA default (`canvas`) or a consumer-set
|
|
12
|
-
* background to show through.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```tsx
|
|
16
|
-
* import { arrow } from '@atlaskit/top-layer/arrow';
|
|
17
|
-
*
|
|
18
|
-
* const myArrow = arrow();
|
|
19
|
-
*
|
|
20
|
-
* <Popup.Content arrow={myArrow} />
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export declare const arrow: () => TArrowPreset;
|
|
24
|
-
export type { TArrowPreset } from './types';
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { TPlacementOptions } from '../popup/types';
|
|
2
|
-
/**
|
|
3
|
-
* A self-contained arrow preset for PopoverContent.
|
|
4
|
-
*
|
|
5
|
-
* Contains the CSS rules (injected once into `<head>`), a data-attribute name
|
|
6
|
-
* for CSS targeting, and a function to compute `position-try-fallbacks` values
|
|
7
|
-
* that change both `position-area` and `margin` when the popover flips.
|
|
8
|
-
*
|
|
9
|
-
* Imported from `@atlaskit/top-layer/arrow` so that consumers who do not use
|
|
10
|
-
* arrows pay no bundle cost for the CSS string or fallback logic.
|
|
11
|
-
*/
|
|
12
|
-
export type TArrowPreset = {
|
|
13
|
-
/**
|
|
14
|
-
* CSS to inject once into `document.head`, scoped to `[data-ds-popover-{name}]`.
|
|
15
|
-
*/
|
|
16
|
-
css: string;
|
|
17
|
-
/**
|
|
18
|
-
* Data attribute suffix for CSS targeting (e.g. `'arrow'`).
|
|
19
|
-
*/
|
|
20
|
-
name: string;
|
|
21
|
-
/**
|
|
22
|
-
* Returns the `position-try-fallbacks` value for a given placement.
|
|
23
|
-
* Uses named `@position-try` rules that update both `position-area`
|
|
24
|
-
* and `margin` so the correct arrow is revealed after a flip.
|
|
25
|
-
*/
|
|
26
|
-
getTryFallbacks: (args: {
|
|
27
|
-
placement: TPlacementOptions;
|
|
28
|
-
}) => string;
|
|
29
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { type TArrowPreset } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Creates an arrow preset for popover content.
|
|
4
|
-
*
|
|
5
|
-
* The returned object is passed to `PopoverContent`'s `arrow` prop.
|
|
6
|
-
* It carries the CSS string and fallback logic so that consumers who
|
|
7
|
-
* do not use arrows pay no bundle cost.
|
|
8
|
-
*
|
|
9
|
-
* The arrows inherit their background from the popover element.
|
|
10
|
-
* When `arrow` is active, `PopoverContent` does not reset `background`
|
|
11
|
-
* to `transparent`, allowing the UA default (`canvas`) or a consumer-set
|
|
12
|
-
* background to show through.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```tsx
|
|
16
|
-
* import { arrow } from '@atlaskit/top-layer/arrow';
|
|
17
|
-
*
|
|
18
|
-
* const myArrow = arrow();
|
|
19
|
-
*
|
|
20
|
-
* <Popup.Content arrow={myArrow} />
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export declare const arrow: () => TArrowPreset;
|
|
24
|
-
export type { TArrowPreset } from './types';
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { TPlacementOptions } from '../popup/types';
|
|
2
|
-
/**
|
|
3
|
-
* A self-contained arrow preset for PopoverContent.
|
|
4
|
-
*
|
|
5
|
-
* Contains the CSS rules (injected once into `<head>`), a data-attribute name
|
|
6
|
-
* for CSS targeting, and a function to compute `position-try-fallbacks` values
|
|
7
|
-
* that change both `position-area` and `margin` when the popover flips.
|
|
8
|
-
*
|
|
9
|
-
* Imported from `@atlaskit/top-layer/arrow` so that consumers who do not use
|
|
10
|
-
* arrows pay no bundle cost for the CSS string or fallback logic.
|
|
11
|
-
*/
|
|
12
|
-
export type TArrowPreset = {
|
|
13
|
-
/**
|
|
14
|
-
* CSS to inject once into `document.head`, scoped to `[data-ds-popover-{name}]`.
|
|
15
|
-
*/
|
|
16
|
-
css: string;
|
|
17
|
-
/**
|
|
18
|
-
* Data attribute suffix for CSS targeting (e.g. `'arrow'`).
|
|
19
|
-
*/
|
|
20
|
-
name: string;
|
|
21
|
-
/**
|
|
22
|
-
* Returns the `position-try-fallbacks` value for a given placement.
|
|
23
|
-
* Uses named `@position-try` rules that update both `position-area`
|
|
24
|
-
* and `margin` so the correct arrow is revealed after a flip.
|
|
25
|
-
*/
|
|
26
|
-
getTryFallbacks: (args: {
|
|
27
|
-
placement: TPlacementOptions;
|
|
28
|
-
}) => string;
|
|
29
|
-
};
|