@atlaskit/top-layer 0.1.1 → 0.1.4
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 +19 -0
- package/dist/cjs/internal/use-anchor-positioning.js +8 -1
- package/dist/cjs/popover/popover.js +3 -1
- package/dist/cjs/popup/popup-content.js +3 -1
- package/dist/es2019/internal/use-anchor-positioning.js +6 -1
- package/dist/es2019/popover/popover.js +3 -1
- package/dist/es2019/popup/popup-content.js +3 -1
- package/dist/esm/internal/use-anchor-positioning.js +8 -1
- package/dist/esm/popover/popover.js +3 -1
- package/dist/esm/popup/popup-content.js +3 -1
- package/dist/types/popover/types.d.ts +7 -0
- package/dist/types/popup/types.d.ts +16 -0
- package/dist/types-ts4.5/popover/types.d.ts +7 -0
- package/dist/types-ts4.5/popup/types.d.ts +16 -0
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/top-layer
|
|
2
2
|
|
|
3
|
+
## 0.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`f4eca31807dcc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f4eca31807dcc) -
|
|
8
|
+
Add new xcss on popover to support customize background color and address arrow style issue
|
|
9
|
+
|
|
10
|
+
## 0.1.3
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
16
|
+
## 0.1.2
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 0.1.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -239,6 +239,11 @@ function useAnchorPosition(_ref4) {
|
|
|
239
239
|
property: '--ds-arrow-size',
|
|
240
240
|
value: "".concat(offset, "px")
|
|
241
241
|
});
|
|
242
|
+
// Mark the popover root as the arrow host. The ARROW_CSS targets
|
|
243
|
+
// [data-ds-popover-arrow] to apply clip-path: inset(1px) margin-box
|
|
244
|
+
// and box-shadow: none. Must be on the popover root (not a child)
|
|
245
|
+
// because that's where useAnchorPosition sets the margin gap.
|
|
246
|
+
popover.setAttribute('data-ds-popover-arrow', '');
|
|
242
247
|
}
|
|
243
248
|
var _undoPositioning = (0, _combine.combine)((0, _setStyle.setStyle)({
|
|
244
249
|
el: trigger,
|
|
@@ -249,7 +254,9 @@ function useAnchorPosition(_ref4) {
|
|
|
249
254
|
}), (0, _setStyle.setStyle)({
|
|
250
255
|
el: popover,
|
|
251
256
|
styles: popoverStyles
|
|
252
|
-
}))
|
|
257
|
+
}), arrow ? function () {
|
|
258
|
+
return popover.removeAttribute('data-ds-popover-arrow');
|
|
259
|
+
} : function () {});
|
|
253
260
|
return _undoPositioning;
|
|
254
261
|
}
|
|
255
262
|
|
|
@@ -67,6 +67,7 @@ var Popover = exports.Popover = /*#__PURE__*/(0, _react.forwardRef)(function Pop
|
|
|
67
67
|
placement = _ref.placement,
|
|
68
68
|
testId = _ref.testId,
|
|
69
69
|
isOpen = _ref.isOpen,
|
|
70
|
+
xcssFromProps = _ref.xcss,
|
|
70
71
|
role = _ref.role,
|
|
71
72
|
label = _ref.label,
|
|
72
73
|
labelledBy = _ref.labelledBy,
|
|
@@ -248,6 +249,7 @@ var Popover = exports.Popover = /*#__PURE__*/(0, _react.forwardRef)(function Pop
|
|
|
248
249
|
"aria-labelledby": labelledBy,
|
|
249
250
|
"data-testid": testId
|
|
250
251
|
}, preset ? (0, _defineProperty2.default)({}, "data-ds-popover-".concat(preset.name), '') : undefined, {
|
|
251
|
-
|
|
252
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- xcss prop passes compiled atomic class names
|
|
253
|
+
className: (0, _runtime.ax)([styles.root, xcssFromProps])
|
|
252
254
|
}), showChildren ? children : null);
|
|
253
255
|
});
|
|
@@ -35,6 +35,7 @@ var PopupContent = exports.PopupContent = /*#__PURE__*/(0, _react.forwardRef)(fu
|
|
|
35
35
|
mode = _ref.mode,
|
|
36
36
|
_ref$width = _ref.width,
|
|
37
37
|
width = _ref$width === void 0 ? 'content' : _ref$width,
|
|
38
|
+
xcss = _ref.xcss,
|
|
38
39
|
isOpenProp = _ref.isOpen,
|
|
39
40
|
triggerRefProp = _ref.triggerRef,
|
|
40
41
|
placementProp = _ref.placement,
|
|
@@ -193,7 +194,8 @@ var PopupContent = exports.PopupContent = /*#__PURE__*/(0, _react.forwardRef)(fu
|
|
|
193
194
|
onOpenChange: handleOpenChange,
|
|
194
195
|
testId: testId,
|
|
195
196
|
children: children,
|
|
196
|
-
id: ctx === null || ctx === void 0 ? void 0 : ctx.popoverId
|
|
197
|
+
id: ctx === null || ctx === void 0 ? void 0 : ctx.popoverId,
|
|
198
|
+
xcss: xcss
|
|
197
199
|
};
|
|
198
200
|
return /*#__PURE__*/_react.default.createElement(_popover.Popover, (0, _extends2.default)({
|
|
199
201
|
ref: combinedRef
|
|
@@ -232,6 +232,11 @@ export function useAnchorPosition({
|
|
|
232
232
|
property: '--ds-arrow-size',
|
|
233
233
|
value: `${offset}px`
|
|
234
234
|
});
|
|
235
|
+
// Mark the popover root as the arrow host. The ARROW_CSS targets
|
|
236
|
+
// [data-ds-popover-arrow] to apply clip-path: inset(1px) margin-box
|
|
237
|
+
// and box-shadow: none. Must be on the popover root (not a child)
|
|
238
|
+
// because that's where useAnchorPosition sets the margin gap.
|
|
239
|
+
popover.setAttribute('data-ds-popover-arrow', '');
|
|
235
240
|
}
|
|
236
241
|
const undoPositioning = combine(setStyle({
|
|
237
242
|
el: trigger,
|
|
@@ -242,7 +247,7 @@ export function useAnchorPosition({
|
|
|
242
247
|
}), setStyle({
|
|
243
248
|
el: popover,
|
|
244
249
|
styles: popoverStyles
|
|
245
|
-
}));
|
|
250
|
+
}), arrow ? () => popover.removeAttribute('data-ds-popover-arrow') : () => {});
|
|
246
251
|
return undoPositioning;
|
|
247
252
|
}
|
|
248
253
|
|
|
@@ -54,6 +54,7 @@ export const Popover = /*#__PURE__*/forwardRef(function Popover({
|
|
|
54
54
|
placement,
|
|
55
55
|
testId,
|
|
56
56
|
isOpen,
|
|
57
|
+
xcss: xcssFromProps,
|
|
57
58
|
// ARIA
|
|
58
59
|
role,
|
|
59
60
|
label,
|
|
@@ -237,6 +238,7 @@ export const Popover = /*#__PURE__*/forwardRef(function Popover({
|
|
|
237
238
|
}, preset ? {
|
|
238
239
|
[`data-ds-popover-${preset.name}`]: ''
|
|
239
240
|
} : undefined, {
|
|
240
|
-
|
|
241
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- xcss prop passes compiled atomic class names
|
|
242
|
+
className: ax([styles.root, xcssFromProps])
|
|
241
243
|
}), showChildren ? children : null);
|
|
242
244
|
});
|
|
@@ -24,6 +24,7 @@ export const PopupContent = /*#__PURE__*/forwardRef(function PopupContent({
|
|
|
24
24
|
arrow,
|
|
25
25
|
mode,
|
|
26
26
|
width = 'content',
|
|
27
|
+
xcss,
|
|
27
28
|
isOpen: isOpenProp,
|
|
28
29
|
triggerRef: triggerRefProp,
|
|
29
30
|
placement: placementProp,
|
|
@@ -184,7 +185,8 @@ export const PopupContent = /*#__PURE__*/forwardRef(function PopupContent({
|
|
|
184
185
|
onOpenChange: handleOpenChange,
|
|
185
186
|
testId,
|
|
186
187
|
children,
|
|
187
|
-
id: ctx === null || ctx === void 0 ? void 0 : ctx.popoverId
|
|
188
|
+
id: ctx === null || ctx === void 0 ? void 0 : ctx.popoverId,
|
|
189
|
+
xcss
|
|
188
190
|
};
|
|
189
191
|
return /*#__PURE__*/React.createElement(Popover, _extends({
|
|
190
192
|
ref: combinedRef
|
|
@@ -226,6 +226,11 @@ export function useAnchorPosition(_ref4) {
|
|
|
226
226
|
property: '--ds-arrow-size',
|
|
227
227
|
value: "".concat(offset, "px")
|
|
228
228
|
});
|
|
229
|
+
// Mark the popover root as the arrow host. The ARROW_CSS targets
|
|
230
|
+
// [data-ds-popover-arrow] to apply clip-path: inset(1px) margin-box
|
|
231
|
+
// and box-shadow: none. Must be on the popover root (not a child)
|
|
232
|
+
// because that's where useAnchorPosition sets the margin gap.
|
|
233
|
+
popover.setAttribute('data-ds-popover-arrow', '');
|
|
229
234
|
}
|
|
230
235
|
var _undoPositioning = combine(setStyle({
|
|
231
236
|
el: trigger,
|
|
@@ -236,7 +241,9 @@ export function useAnchorPosition(_ref4) {
|
|
|
236
241
|
}), setStyle({
|
|
237
242
|
el: popover,
|
|
238
243
|
styles: popoverStyles
|
|
239
|
-
}))
|
|
244
|
+
}), arrow ? function () {
|
|
245
|
+
return popover.removeAttribute('data-ds-popover-arrow');
|
|
246
|
+
} : function () {});
|
|
240
247
|
return _undoPositioning;
|
|
241
248
|
}
|
|
242
249
|
|
|
@@ -58,6 +58,7 @@ export var Popover = /*#__PURE__*/forwardRef(function Popover(_ref, ref) {
|
|
|
58
58
|
placement = _ref.placement,
|
|
59
59
|
testId = _ref.testId,
|
|
60
60
|
isOpen = _ref.isOpen,
|
|
61
|
+
xcssFromProps = _ref.xcss,
|
|
61
62
|
role = _ref.role,
|
|
62
63
|
label = _ref.label,
|
|
63
64
|
labelledBy = _ref.labelledBy,
|
|
@@ -239,6 +240,7 @@ export var Popover = /*#__PURE__*/forwardRef(function Popover(_ref, ref) {
|
|
|
239
240
|
"aria-labelledby": labelledBy,
|
|
240
241
|
"data-testid": testId
|
|
241
242
|
}, preset ? _defineProperty({}, "data-ds-popover-".concat(preset.name), '') : undefined, {
|
|
242
|
-
|
|
243
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- xcss prop passes compiled atomic class names
|
|
244
|
+
className: ax([styles.root, xcssFromProps])
|
|
243
245
|
}), showChildren ? children : null);
|
|
244
246
|
});
|
|
@@ -26,6 +26,7 @@ export var PopupContent = /*#__PURE__*/forwardRef(function PopupContent(_ref, re
|
|
|
26
26
|
mode = _ref.mode,
|
|
27
27
|
_ref$width = _ref.width,
|
|
28
28
|
width = _ref$width === void 0 ? 'content' : _ref$width,
|
|
29
|
+
xcss = _ref.xcss,
|
|
29
30
|
isOpenProp = _ref.isOpen,
|
|
30
31
|
triggerRefProp = _ref.triggerRef,
|
|
31
32
|
placementProp = _ref.placement,
|
|
@@ -184,7 +185,8 @@ export var PopupContent = /*#__PURE__*/forwardRef(function PopupContent(_ref, re
|
|
|
184
185
|
onOpenChange: handleOpenChange,
|
|
185
186
|
testId: testId,
|
|
186
187
|
children: children,
|
|
187
|
-
id: ctx === null || ctx === void 0 ? void 0 : ctx.popoverId
|
|
188
|
+
id: ctx === null || ctx === void 0 ? void 0 : ctx.popoverId,
|
|
189
|
+
xcss: xcss
|
|
188
190
|
};
|
|
189
191
|
return /*#__PURE__*/React.createElement(Popover, _extends({
|
|
190
192
|
ref: combinedRef
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
+
import { type StrictXCSSProp } from '@atlaskit/css';
|
|
2
3
|
import { type TAnimationPreset } from '../animations/types';
|
|
3
4
|
import { type TAriaRoleOptional, type TRoleRequiringAccessibleName, type TRoleWithImplicitName } from '../internal/role-types';
|
|
4
5
|
import { type TPlacementOptions } from '../popup/types';
|
|
@@ -38,6 +39,12 @@ export type TPopoverForwardedProps = TPopoverBaseProps & {
|
|
|
38
39
|
export type TPopoverInternalProps = TPopoverForwardedProps;
|
|
39
40
|
type TPopoverBaseProps = {
|
|
40
41
|
children: ReactNode;
|
|
42
|
+
/**
|
|
43
|
+
* Additional CSS styles applied to the popover root element.
|
|
44
|
+
* Use to set `backgroundColor` so arrow pseudo-elements (which use
|
|
45
|
+
* `background: inherit`) match the popup surface colour.
|
|
46
|
+
*/
|
|
47
|
+
xcss?: StrictXCSSProp<'backgroundColor', never>;
|
|
41
48
|
/**
|
|
42
49
|
* Animation preset for entry/exit transitions.
|
|
43
50
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ReactElement, type ReactNode, type Ref, type RefObject } from 'react';
|
|
2
|
+
import { type StrictXCSSProp } from '@atlaskit/css';
|
|
2
3
|
import { type TAnimationPreset } from '../animations/types';
|
|
3
4
|
import { type TArrowPreset } from '../arrow/types';
|
|
4
5
|
import { type TPlacement } from '../internal/resolve-placement';
|
|
@@ -135,6 +136,21 @@ type TPopupContentBaseProps = {
|
|
|
135
136
|
* Falls back to a one-off measurement of the trigger's width.
|
|
136
137
|
*/
|
|
137
138
|
width?: 'content' | 'trigger' | 'min-trigger';
|
|
139
|
+
/**
|
|
140
|
+
* Applies additional CSS styles to the popover root element using
|
|
141
|
+
* design-system-safe xcss.
|
|
142
|
+
*
|
|
143
|
+
* **Required when using `arrow`:** the arrow pseudo-elements use
|
|
144
|
+
* `background: inherit` to pick up their color from the popover root.
|
|
145
|
+
* Without setting `backgroundColor` here, the arrow tip will be transparent.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```tsx
|
|
149
|
+
* const styles = cssMap({ surface: { backgroundColor: token('elevation.surface.overlay') } });
|
|
150
|
+
* <Popup.Content xcss={styles.surface} arrow={arrowPreset} ... />
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
xcss?: StrictXCSSProp<'backgroundColor', never>;
|
|
138
154
|
/**
|
|
139
155
|
* Ref to the trigger element for anchor positioning.
|
|
140
156
|
* When absent, anchor positioning is skipped (consumer handles positioning).
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
+
import { type StrictXCSSProp } from '@atlaskit/css';
|
|
2
3
|
import { type TAnimationPreset } from '../animations/types';
|
|
3
4
|
import { type TAriaRoleOptional, type TRoleRequiringAccessibleName, type TRoleWithImplicitName } from '../internal/role-types';
|
|
4
5
|
import { type TPlacementOptions } from '../popup/types';
|
|
@@ -38,6 +39,12 @@ export type TPopoverForwardedProps = TPopoverBaseProps & {
|
|
|
38
39
|
export type TPopoverInternalProps = TPopoverForwardedProps;
|
|
39
40
|
type TPopoverBaseProps = {
|
|
40
41
|
children: ReactNode;
|
|
42
|
+
/**
|
|
43
|
+
* Additional CSS styles applied to the popover root element.
|
|
44
|
+
* Use to set `backgroundColor` so arrow pseudo-elements (which use
|
|
45
|
+
* `background: inherit`) match the popup surface colour.
|
|
46
|
+
*/
|
|
47
|
+
xcss?: StrictXCSSProp<'backgroundColor', never>;
|
|
41
48
|
/**
|
|
42
49
|
* Animation preset for entry/exit transitions.
|
|
43
50
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ReactElement, type ReactNode, type Ref, type RefObject } from 'react';
|
|
2
|
+
import { type StrictXCSSProp } from '@atlaskit/css';
|
|
2
3
|
import { type TAnimationPreset } from '../animations/types';
|
|
3
4
|
import { type TArrowPreset } from '../arrow/types';
|
|
4
5
|
import { type TPlacement } from '../internal/resolve-placement';
|
|
@@ -135,6 +136,21 @@ type TPopupContentBaseProps = {
|
|
|
135
136
|
* Falls back to a one-off measurement of the trigger's width.
|
|
136
137
|
*/
|
|
137
138
|
width?: 'content' | 'trigger' | 'min-trigger';
|
|
139
|
+
/**
|
|
140
|
+
* Applies additional CSS styles to the popover root element using
|
|
141
|
+
* design-system-safe xcss.
|
|
142
|
+
*
|
|
143
|
+
* **Required when using `arrow`:** the arrow pseudo-elements use
|
|
144
|
+
* `background: inherit` to pick up their color from the popover root.
|
|
145
|
+
* Without setting `backgroundColor` here, the arrow tip will be transparent.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```tsx
|
|
149
|
+
* const styles = cssMap({ surface: { backgroundColor: token('elevation.surface.overlay') } });
|
|
150
|
+
* <Popup.Content xcss={styles.surface} arrow={arrowPreset} ... />
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
xcss?: StrictXCSSProp<'backgroundColor', never>;
|
|
138
154
|
/**
|
|
139
155
|
* Ref to the trigger element for anchor positioning.
|
|
140
156
|
* When absent, anchor positioning is skipped (consumer handles positioning).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/top-layer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
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",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@atlaskit/browser-apis": "^0.0.1",
|
|
38
38
|
"@atlaskit/css": "^0.19.0",
|
|
39
|
-
"@atlaskit/ds-lib": "^
|
|
40
|
-
"@atlaskit/tokens": "^
|
|
39
|
+
"@atlaskit/ds-lib": "^7.0.0",
|
|
40
|
+
"@atlaskit/tokens": "^13.0.0",
|
|
41
41
|
"@babel/runtime": "^7.0.0",
|
|
42
42
|
"@compiled/react": "^0.20.0",
|
|
43
43
|
"bind-event-listener": "^3.0.0",
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@af/integration-testing": "workspace:^",
|
|
52
52
|
"@af/visual-regression": "workspace:^",
|
|
53
|
-
"@atlaskit/button": "^23.
|
|
54
|
-
"@atlaskit/heading": "^5.
|
|
55
|
-
"@atlaskit/lozenge": "^13.
|
|
56
|
-
"@atlaskit/primitives": "^
|
|
53
|
+
"@atlaskit/button": "^23.11.0",
|
|
54
|
+
"@atlaskit/heading": "^5.4.0",
|
|
55
|
+
"@atlaskit/lozenge": "^13.6.0",
|
|
56
|
+
"@atlaskit/primitives": "^19.0.0",
|
|
57
57
|
"@atlaskit/ssr": "workspace:^",
|
|
58
|
-
"@atlaskit/textfield": "^8.
|
|
58
|
+
"@atlaskit/textfield": "^8.3.0",
|
|
59
59
|
"@atlassian/react-compiler-gating": "workspace:^",
|
|
60
60
|
"@atlassian/ssr-tests": "workspace:^",
|
|
61
61
|
"@atlassian/testing-library": "^0.5.0",
|