@atlaskit/primitives 3.1.0 → 3.2.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 +6 -0
- package/dist/cjs/components/anchor.js +4 -2
- package/dist/cjs/components/bleed.js +3 -2
- package/dist/cjs/components/box.js +5 -5
- package/dist/cjs/components/flex.js +3 -2
- package/dist/cjs/components/grid.js +3 -2
- package/dist/cjs/components/inline.js +8 -3
- package/dist/cjs/components/pressable.js +5 -1
- package/dist/cjs/components/stack.js +8 -3
- package/dist/cjs/xcss/xcss.js +52 -14
- package/dist/es2019/components/anchor.js +4 -2
- package/dist/es2019/components/bleed.js +3 -2
- package/dist/es2019/components/box.js +5 -5
- package/dist/es2019/components/flex.js +3 -2
- package/dist/es2019/components/grid.js +3 -2
- package/dist/es2019/components/inline.js +8 -3
- package/dist/es2019/components/pressable.js +5 -1
- package/dist/es2019/components/stack.js +8 -3
- package/dist/es2019/xcss/xcss.js +38 -8
- package/dist/esm/components/anchor.js +4 -2
- package/dist/esm/components/bleed.js +3 -2
- package/dist/esm/components/box.js +5 -5
- package/dist/esm/components/flex.js +3 -2
- package/dist/esm/components/grid.js +3 -2
- package/dist/esm/components/inline.js +8 -3
- package/dist/esm/components/pressable.js +5 -1
- package/dist/esm/components/stack.js +8 -3
- package/dist/esm/xcss/xcss.js +52 -10
- package/dist/types/components/flex.d.ts +2 -2
- package/dist/types/components/grid.d.ts +3 -3
- package/dist/types/components/pressable.d.ts +1 -1
- package/dist/types/components/stack.d.ts +1 -1
- package/dist/types/components/types.d.ts +3 -2
- package/dist/types/xcss/xcss.d.ts +11 -5
- package/dist/types-ts4.5/components/flex.d.ts +2 -2
- package/dist/types-ts4.5/components/grid.d.ts +3 -3
- package/dist/types-ts4.5/components/pressable.d.ts +1 -1
- package/dist/types-ts4.5/components/stack.d.ts +1 -1
- package/dist/types-ts4.5/components/types.d.ts +3 -2
- package/dist/types-ts4.5/xcss/xcss.d.ts +11 -5
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/primitives
|
|
2
2
|
|
|
3
|
+
## 3.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#77488](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/77488) [`9e119dcbfd60`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9e119dcbfd60) - The `xcss` prop on select components have had its type expanded to support styles being passed from Compiled CSS-in-JS. This is still experimental and something we'll be iterating on.
|
|
8
|
+
|
|
3
9
|
## 3.1.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -76,13 +76,15 @@ var Anchor = function Anchor(_ref, ref) {
|
|
|
76
76
|
action: 'clicked',
|
|
77
77
|
componentName: componentName || 'Anchor',
|
|
78
78
|
packageName: "@atlaskit/primitives",
|
|
79
|
-
packageVersion: "3.
|
|
79
|
+
packageVersion: "3.2.0",
|
|
80
80
|
analyticsData: analyticsContext,
|
|
81
81
|
actionSubject: 'link'
|
|
82
82
|
});
|
|
83
83
|
var RouterLink = (0, _appProvider.useRouterLink)();
|
|
84
84
|
|
|
85
|
-
//
|
|
85
|
+
// We're type coercing this as Compiled styles in an array isn't supported by the types
|
|
86
|
+
// But the runtime accepts it none-the-wiser. We can remove this entire block and replace
|
|
87
|
+
// it with cx(defaultStyles, focusRingStyles, xcssStyles) when we've moved away from Emotion.
|
|
86
88
|
var styles = Array.isArray(xcssStyles) ? [defaultStyles, focusRingStyles].concat((0, _toConsumableArray2.default)(xcssStyles)) : [defaultStyles, focusRingStyles, xcssStyles];
|
|
87
89
|
var isExternal = typeof href === 'string' && IS_EXTERNAL_LINK_REGEX.test(href);
|
|
88
90
|
var isNonHttpBased = typeof href === 'string' && IS_NON_HTTP_BASED.test(href);
|
|
@@ -66,11 +66,12 @@ var Bleed = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
66
66
|
block = _ref.block,
|
|
67
67
|
all = _ref.all,
|
|
68
68
|
xcss = _ref.xcss;
|
|
69
|
-
var
|
|
69
|
+
var resolvedStyles = (0, _xcss.parseXcss)(xcss);
|
|
70
70
|
return (0, _react2.jsx)("div", {
|
|
71
|
+
className: resolvedStyles.static,
|
|
71
72
|
css: [baseStyles, (inline || all) && inlineBleedMap[inline || all], (block || all) && blockBleedMap[block || all],
|
|
72
73
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
73
|
-
|
|
74
|
+
resolvedStyles.emotion],
|
|
74
75
|
"data-testid": testId
|
|
75
76
|
}, children);
|
|
76
77
|
});
|
|
@@ -32,7 +32,7 @@ var _excluded = ["as", "children", "backgroundColor", "padding", "paddingBlock",
|
|
|
32
32
|
*/
|
|
33
33
|
var Box = exports.Box = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
34
34
|
var _ref$as = _ref.as,
|
|
35
|
-
|
|
35
|
+
Component = _ref$as === void 0 ? 'div' : _ref$as,
|
|
36
36
|
children = _ref.children,
|
|
37
37
|
backgroundColor = _ref.backgroundColor,
|
|
38
38
|
padding = _ref.padding,
|
|
@@ -46,24 +46,24 @@ var Box = exports.Box = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
46
46
|
testId = _ref.testId,
|
|
47
47
|
xcss = _ref.xcss,
|
|
48
48
|
htmlAttributes = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
49
|
-
var Component = as;
|
|
50
49
|
// This is to remove className from safeHtmlAttributes
|
|
51
50
|
// @ts-expect-error className doesn't exist in the prop definition but we want to ensure it cannot be applied even if types are bypassed
|
|
52
51
|
var _spreadClass = htmlAttributes.className,
|
|
53
52
|
safeHtmlAttributes = (0, _objectWithoutProperties2.default)(htmlAttributes, _excluded2);
|
|
54
|
-
var
|
|
53
|
+
var resolvedStyles = (0, _xcss.parseXcss)(xcss);
|
|
55
54
|
var node =
|
|
56
55
|
// @ts-expect-error Expression produces a union type that is too complex to represent. I think this is unavoidable
|
|
57
56
|
(0, _react2.jsx)(Component, (0, _extends2.default)({
|
|
58
57
|
style: style
|
|
59
58
|
// @ts-expect-error Expression produces a union type that is too complex to represent. We may be able to narrow the type here but unsure.
|
|
60
59
|
,
|
|
61
|
-
ref: ref
|
|
60
|
+
ref: ref,
|
|
61
|
+
className: resolvedStyles.static
|
|
62
62
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
63
63
|
}, safeHtmlAttributes, {
|
|
64
64
|
css: [baseStyles, backgroundColor && _styleMaps.backgroundColorStylesMap[backgroundColor], (0, _styleMaps.isSurfaceColorToken)(backgroundColor) && _styleMaps.surfaceColorStylesMap[backgroundColor], padding && _styleMaps.paddingStylesMap.padding[padding], paddingBlock && _styleMaps.paddingStylesMap.paddingBlock[paddingBlock], paddingBlockStart && _styleMaps.paddingStylesMap.paddingBlockStart[paddingBlockStart], paddingBlockEnd && _styleMaps.paddingStylesMap.paddingBlockEnd[paddingBlockEnd], paddingInline && _styleMaps.paddingStylesMap.paddingInline[paddingInline], paddingInlineStart && _styleMaps.paddingStylesMap.paddingInlineStart[paddingInlineStart], paddingInlineEnd && _styleMaps.paddingStylesMap.paddingInlineEnd[paddingInlineEnd],
|
|
65
65
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
66
|
-
|
|
66
|
+
resolvedStyles.emotion],
|
|
67
67
|
"data-testid": testId
|
|
68
68
|
}), children);
|
|
69
69
|
return backgroundColor ? (0, _react2.jsx)(_surfaceProvider.SurfaceContext.Provider, {
|
|
@@ -105,12 +105,13 @@ var Flex = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(fu
|
|
|
105
105
|
direction = _ref.direction,
|
|
106
106
|
wrap = _ref.wrap,
|
|
107
107
|
xcss = _ref.xcss;
|
|
108
|
-
var
|
|
108
|
+
var resolvedStyles = (0, _xcss.parseXcss)(xcss);
|
|
109
109
|
return (0, _react2.jsx)(Component, {
|
|
110
110
|
role: role,
|
|
111
|
+
className: resolvedStyles.static,
|
|
111
112
|
css: [baseStyles, gap && _styleMaps.spaceStylesMap.gap[gap], columnGap && _styleMaps.spaceStylesMap.columnGap[columnGap], rowGap && _styleMaps.spaceStylesMap.rowGap[rowGap], alignItems && alignItemsMap[alignItems], direction && flexDirectionMap[direction], justifyContent && justifyContentMap[justifyContent], wrap && flexWrapMap[wrap],
|
|
112
113
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
113
|
-
|
|
114
|
+
resolvedStyles.emotion],
|
|
114
115
|
"data-testid": testId,
|
|
115
116
|
ref: ref
|
|
116
117
|
}, children);
|
|
@@ -152,7 +152,7 @@ var Grid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(fu
|
|
|
152
152
|
gridTemplateColumns = _ref.templateColumns,
|
|
153
153
|
xcss = _ref.xcss;
|
|
154
154
|
var Component = as || 'div';
|
|
155
|
-
var
|
|
155
|
+
var resolvedStyles = (0, _xcss.parseXcss)(xcss);
|
|
156
156
|
|
|
157
157
|
/**
|
|
158
158
|
* We use CSS variables to allow for dynamic grid templates instead of dynamically setting to `props.style`
|
|
@@ -172,9 +172,10 @@ var Grid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(fu
|
|
|
172
172
|
id: id,
|
|
173
173
|
role: role,
|
|
174
174
|
style: style,
|
|
175
|
+
className: resolvedStyles.static,
|
|
175
176
|
css: [baseStyles, gap && _styleMaps.spaceStylesMap.gap[gap], columnGap && _styleMaps.spaceStylesMap.columnGap[columnGap], rowGap && _styleMaps.spaceStylesMap.rowGap[rowGap], alignItems && alignItemsMap[alignItems], alignContent && alignContentMap[alignContent], justifyContent && justifyContentMap[justifyContent], autoFlow && gridAutoFlowMap[autoFlow],
|
|
176
177
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
177
|
-
|
|
178
|
+
resolvedStyles.emotion],
|
|
178
179
|
"data-testid": testId,
|
|
179
180
|
ref: ref
|
|
180
181
|
}, children);
|
|
@@ -73,6 +73,11 @@ var Inline = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(
|
|
|
73
73
|
}, separator && index > 0 ? separatorComponent : null, child);
|
|
74
74
|
}) : rawChildren;
|
|
75
75
|
var justifyContent = spread || alignInline;
|
|
76
|
+
|
|
77
|
+
// We're type coercing this as Compiled styles in an array isn't supported by the types
|
|
78
|
+
// But the runtime accepts it none-the-wiser. We can remove this entire block and replace
|
|
79
|
+
// it with cx(defaultStyles, focusRingStyles, xcssStyles) when we've moved away from Emotion.
|
|
80
|
+
var styles = grow ? [flexGrowMap[grow]].concat((0, _toConsumableArray2.default)(Array.isArray(xcss) ? xcss : [xcss])) : xcss;
|
|
76
81
|
return (0, _react2.jsx)(_flex.default, {
|
|
77
82
|
as: as,
|
|
78
83
|
role: role,
|
|
@@ -81,10 +86,10 @@ var Inline = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(
|
|
|
81
86
|
direction: "row",
|
|
82
87
|
gap: space,
|
|
83
88
|
rowGap: rowSpace,
|
|
84
|
-
wrap: shouldWrap ? 'wrap' : undefined
|
|
85
|
-
xcss: grow ? [flexGrowMap[grow]].concat((0, _toConsumableArray2.default)(Array.isArray(xcss) ? xcss : [xcss])) :
|
|
89
|
+
wrap: shouldWrap ? 'wrap' : undefined
|
|
86
90
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
87
|
-
|
|
91
|
+
,
|
|
92
|
+
xcss: styles,
|
|
88
93
|
testId: testId,
|
|
89
94
|
ref: ref
|
|
90
95
|
}, children);
|
|
@@ -80,7 +80,7 @@ var UNSAFE_PRESSABLE = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
80
80
|
action: 'clicked',
|
|
81
81
|
componentName: componentName || 'Pressable',
|
|
82
82
|
packageName: "@atlaskit/primitives",
|
|
83
|
-
packageVersion: "3.
|
|
83
|
+
packageVersion: "3.2.0",
|
|
84
84
|
analyticsData: analyticsContext,
|
|
85
85
|
actionSubject: 'button'
|
|
86
86
|
});
|
|
@@ -89,6 +89,10 @@ var UNSAFE_PRESSABLE = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
89
89
|
var styles = [(0, _xcss.xcss)({
|
|
90
90
|
cursor: isDisabled ? 'not-allowed' : 'pointer'
|
|
91
91
|
}), focusRingStyles];
|
|
92
|
+
|
|
93
|
+
// We're type coercing this as Compiled styles in an array isn't supported by the types
|
|
94
|
+
// But the runtime accepts it none-the-wiser. We can remove this entire block and replace
|
|
95
|
+
// it with cx(defaultStyles, focusRingStyles, xcssStyles) when we've moved away from Emotion.
|
|
92
96
|
styles = Array.isArray(xcssStyles) ? [].concat((0, _toConsumableArray2.default)(styles), (0, _toConsumableArray2.default)(xcssStyles)) : [].concat((0, _toConsumableArray2.default)(styles), [xcssStyles]);
|
|
93
97
|
return /*#__PURE__*/_react.default.createElement(_box.default, (0, _extends2.default)({}, htmlAttributes, {
|
|
94
98
|
as: "button",
|
|
@@ -50,16 +50,21 @@ var Stack = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(f
|
|
|
50
50
|
xcss = _ref.xcss,
|
|
51
51
|
role = _ref.role;
|
|
52
52
|
var justifyContent = spread || alignBlock;
|
|
53
|
+
|
|
54
|
+
// We're type coercing this as Compiled styles in an array isn't supported by the types
|
|
55
|
+
// But the runtime accepts it none-the-wiser. We can remove this entire block and replace
|
|
56
|
+
// it with cx(defaultStyles, focusRingStyles, xcssStyles) when we've moved away from Emotion.
|
|
57
|
+
var styles = grow ? [flexGrowMap[grow]].concat((0, _toConsumableArray2.default)(Array.isArray(xcss) ? xcss : [xcss])) : xcss;
|
|
53
58
|
return (0, _react2.jsx)(_flex.default, {
|
|
54
59
|
as: as,
|
|
55
60
|
role: role,
|
|
56
61
|
gap: space,
|
|
57
62
|
direction: "column",
|
|
58
63
|
alignItems: alignItems,
|
|
59
|
-
justifyContent: justifyContent
|
|
60
|
-
xcss: grow ? [flexGrowMap[grow]].concat((0, _toConsumableArray2.default)(Array.isArray(xcss) ? xcss : [xcss])) :
|
|
64
|
+
justifyContent: justifyContent
|
|
61
65
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
62
|
-
|
|
66
|
+
,
|
|
67
|
+
xcss: styles,
|
|
63
68
|
testId: testId,
|
|
64
69
|
ref: ref
|
|
65
70
|
}, children);
|
package/dist/cjs/xcss/xcss.js
CHANGED
|
@@ -6,15 +6,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.tokensMap = exports.parseXcss = void 0;
|
|
8
8
|
exports.xcss = xcss;
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
12
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
12
13
|
var _react = require("@emotion/react");
|
|
13
14
|
var _styleMaps = require("./style-maps.partial");
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
17
|
-
|
|
15
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
16
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
17
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */ // eslint-disable-next-line import/no-extraneous-dependencies
|
|
18
18
|
var tokensMap = exports.tokensMap = {
|
|
19
19
|
backgroundColor: _styleMaps.backgroundColorMap,
|
|
20
20
|
blockSize: _styleMaps.dimensionMap,
|
|
@@ -155,21 +155,59 @@ var baseXcss = function baseXcss(style) {
|
|
|
155
155
|
};
|
|
156
156
|
|
|
157
157
|
/**
|
|
158
|
-
*
|
|
159
|
-
*
|
|
158
|
+
* Picks out runtime XCSS objects and build-time XCSS strings. This is needed
|
|
159
|
+
* to supported both Emotion and Compiled styles until we've fully migrated
|
|
160
|
+
* to Compiled.
|
|
161
|
+
*
|
|
162
|
+
* @private
|
|
163
|
+
* @deprecated
|
|
160
164
|
*/
|
|
161
|
-
|
|
162
165
|
var parseXcss = exports.parseXcss = function parseXcss(args) {
|
|
163
166
|
if (Array.isArray(args)) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
+
var emotion = [];
|
|
168
|
+
var staticArr = [];
|
|
169
|
+
var _iterator = _createForOfIteratorHelper(args),
|
|
170
|
+
_step;
|
|
171
|
+
try {
|
|
172
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
173
|
+
var arg = _step.value;
|
|
174
|
+
var result = parseXcss(arg);
|
|
175
|
+
if (result.emotion) {
|
|
176
|
+
emotion.push.apply(emotion, (0, _toConsumableArray2.default)(result.emotion));
|
|
177
|
+
}
|
|
178
|
+
if (result.static) {
|
|
179
|
+
staticArr.push(result.static);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
} catch (err) {
|
|
183
|
+
_iterator.e(err);
|
|
184
|
+
} finally {
|
|
185
|
+
_iterator.f();
|
|
186
|
+
}
|
|
187
|
+
return {
|
|
188
|
+
emotion: emotion,
|
|
189
|
+
static: staticArr.join(' ')
|
|
190
|
+
};
|
|
167
191
|
}
|
|
168
|
-
var
|
|
169
|
-
|
|
170
|
-
|
|
192
|
+
var objArgs = args;
|
|
193
|
+
var _ref4 = objArgs || {},
|
|
194
|
+
styles = _ref4[uniqueSymbol];
|
|
195
|
+
if (styles) {
|
|
196
|
+
return {
|
|
197
|
+
emotion: [styles]
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
if (args) {
|
|
201
|
+
// We use string interpolation here instead of .toString() just
|
|
202
|
+
// in case the resulting object doesn't have the method available.
|
|
203
|
+
var stringifiedArgs = "".concat(args);
|
|
204
|
+
if (stringifiedArgs) {
|
|
205
|
+
return {
|
|
206
|
+
static: stringifiedArgs
|
|
207
|
+
};
|
|
208
|
+
}
|
|
171
209
|
}
|
|
172
|
-
return
|
|
210
|
+
return {};
|
|
173
211
|
};
|
|
174
212
|
|
|
175
213
|
// Media queries should not contain nested media queries
|
|
@@ -62,13 +62,15 @@ const Anchor = ({
|
|
|
62
62
|
action: 'clicked',
|
|
63
63
|
componentName: componentName || 'Anchor',
|
|
64
64
|
packageName: "@atlaskit/primitives",
|
|
65
|
-
packageVersion: "3.
|
|
65
|
+
packageVersion: "3.2.0",
|
|
66
66
|
analyticsData: analyticsContext,
|
|
67
67
|
actionSubject: 'link'
|
|
68
68
|
});
|
|
69
69
|
const RouterLink = useRouterLink();
|
|
70
70
|
|
|
71
|
-
//
|
|
71
|
+
// We're type coercing this as Compiled styles in an array isn't supported by the types
|
|
72
|
+
// But the runtime accepts it none-the-wiser. We can remove this entire block and replace
|
|
73
|
+
// it with cx(defaultStyles, focusRingStyles, xcssStyles) when we've moved away from Emotion.
|
|
72
74
|
const styles = Array.isArray(xcssStyles) ? [defaultStyles, focusRingStyles, ...xcssStyles] : [defaultStyles, focusRingStyles, xcssStyles];
|
|
73
75
|
const isExternal = typeof href === 'string' && IS_EXTERNAL_LINK_REGEX.test(href);
|
|
74
76
|
const isNonHttpBased = typeof href === 'string' && IS_NON_HTTP_BASED.test(href);
|
|
@@ -59,11 +59,12 @@ const Bleed = /*#__PURE__*/React.memo(({
|
|
|
59
59
|
all,
|
|
60
60
|
xcss
|
|
61
61
|
}) => {
|
|
62
|
-
const
|
|
62
|
+
const resolvedStyles = parseXcss(xcss);
|
|
63
63
|
return jsx("div", {
|
|
64
|
+
className: resolvedStyles.static,
|
|
64
65
|
css: [baseStyles, (inline || all) && inlineBleedMap[inline || all], (block || all) && blockBleedMap[block || all],
|
|
65
66
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
66
|
-
|
|
67
|
+
resolvedStyles.emotion],
|
|
67
68
|
"data-testid": testId
|
|
68
69
|
}, children);
|
|
69
70
|
});
|
|
@@ -21,7 +21,7 @@ import { SurfaceContext } from './internal/surface-provider';
|
|
|
21
21
|
* - [Usage](https://atlassian.design/components/primitives/box/usage)
|
|
22
22
|
*/
|
|
23
23
|
export const Box = /*#__PURE__*/forwardRef(({
|
|
24
|
-
as = 'div',
|
|
24
|
+
as: Component = 'div',
|
|
25
25
|
children,
|
|
26
26
|
backgroundColor,
|
|
27
27
|
padding,
|
|
@@ -36,26 +36,26 @@ export const Box = /*#__PURE__*/forwardRef(({
|
|
|
36
36
|
xcss,
|
|
37
37
|
...htmlAttributes
|
|
38
38
|
}, ref) => {
|
|
39
|
-
const Component = as;
|
|
40
39
|
// This is to remove className from safeHtmlAttributes
|
|
41
40
|
// @ts-expect-error className doesn't exist in the prop definition but we want to ensure it cannot be applied even if types are bypassed
|
|
42
41
|
const {
|
|
43
42
|
className: _spreadClass,
|
|
44
43
|
...safeHtmlAttributes
|
|
45
44
|
} = htmlAttributes;
|
|
46
|
-
const
|
|
45
|
+
const resolvedStyles = parseXcss(xcss);
|
|
47
46
|
const node =
|
|
48
47
|
// @ts-expect-error Expression produces a union type that is too complex to represent. I think this is unavoidable
|
|
49
48
|
jsx(Component, _extends({
|
|
50
49
|
style: style
|
|
51
50
|
// @ts-expect-error Expression produces a union type that is too complex to represent. We may be able to narrow the type here but unsure.
|
|
52
51
|
,
|
|
53
|
-
ref: ref
|
|
52
|
+
ref: ref,
|
|
53
|
+
className: resolvedStyles.static
|
|
54
54
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
55
55
|
}, safeHtmlAttributes, {
|
|
56
56
|
css: [baseStyles, backgroundColor && backgroundColorStylesMap[backgroundColor], isSurfaceColorToken(backgroundColor) && surfaceColorStylesMap[backgroundColor], padding && paddingStylesMap.padding[padding], paddingBlock && paddingStylesMap.paddingBlock[paddingBlock], paddingBlockStart && paddingStylesMap.paddingBlockStart[paddingBlockStart], paddingBlockEnd && paddingStylesMap.paddingBlockEnd[paddingBlockEnd], paddingInline && paddingStylesMap.paddingInline[paddingInline], paddingInlineStart && paddingStylesMap.paddingInlineStart[paddingInlineStart], paddingInlineEnd && paddingStylesMap.paddingInlineEnd[paddingInlineEnd],
|
|
57
57
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
58
|
-
|
|
58
|
+
resolvedStyles.emotion],
|
|
59
59
|
"data-testid": testId
|
|
60
60
|
}), children);
|
|
61
61
|
return backgroundColor ? jsx(SurfaceContext.Provider, {
|
|
@@ -98,12 +98,13 @@ const Flex = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
98
98
|
wrap,
|
|
99
99
|
xcss
|
|
100
100
|
}, ref) => {
|
|
101
|
-
const
|
|
101
|
+
const resolvedStyles = parseXcss(xcss);
|
|
102
102
|
return jsx(Component, {
|
|
103
103
|
role: role,
|
|
104
|
+
className: resolvedStyles.static,
|
|
104
105
|
css: [baseStyles, gap && spaceStylesMap.gap[gap], columnGap && spaceStylesMap.columnGap[columnGap], rowGap && spaceStylesMap.rowGap[rowGap], alignItems && alignItemsMap[alignItems], direction && flexDirectionMap[direction], justifyContent && justifyContentMap[justifyContent], wrap && flexWrapMap[wrap],
|
|
105
106
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
106
|
-
|
|
107
|
+
resolvedStyles.emotion],
|
|
107
108
|
"data-testid": testId,
|
|
108
109
|
ref: ref
|
|
109
110
|
}, children);
|
|
@@ -144,7 +144,7 @@ const Grid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
144
144
|
xcss
|
|
145
145
|
}, ref) => {
|
|
146
146
|
const Component = as || 'div';
|
|
147
|
-
const
|
|
147
|
+
const resolvedStyles = parseXcss(xcss);
|
|
148
148
|
|
|
149
149
|
/**
|
|
150
150
|
* We use CSS variables to allow for dynamic grid templates instead of dynamically setting to `props.style`
|
|
@@ -163,9 +163,10 @@ const Grid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
163
163
|
id: id,
|
|
164
164
|
role: role,
|
|
165
165
|
style: style,
|
|
166
|
+
className: resolvedStyles.static,
|
|
166
167
|
css: [baseStyles, gap && spaceStylesMap.gap[gap], columnGap && spaceStylesMap.columnGap[columnGap], rowGap && spaceStylesMap.rowGap[rowGap], alignItems && alignItemsMap[alignItems], alignContent && alignContentMap[alignContent], justifyContent && justifyContentMap[justifyContent], autoFlow && gridAutoFlowMap[autoFlow],
|
|
167
168
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
168
|
-
|
|
169
|
+
resolvedStyles.emotion],
|
|
169
170
|
"data-testid": testId,
|
|
170
171
|
ref: ref
|
|
171
172
|
}, children);
|
|
@@ -62,6 +62,11 @@ const Inline = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
62
62
|
}, separator && index > 0 ? separatorComponent : null, child);
|
|
63
63
|
}) : rawChildren;
|
|
64
64
|
const justifyContent = spread || alignInline;
|
|
65
|
+
|
|
66
|
+
// We're type coercing this as Compiled styles in an array isn't supported by the types
|
|
67
|
+
// But the runtime accepts it none-the-wiser. We can remove this entire block and replace
|
|
68
|
+
// it with cx(defaultStyles, focusRingStyles, xcssStyles) when we've moved away from Emotion.
|
|
69
|
+
const styles = grow ? [flexGrowMap[grow], ...(Array.isArray(xcss) ? xcss : [xcss])] : xcss;
|
|
65
70
|
return jsx(Flex, {
|
|
66
71
|
as: as,
|
|
67
72
|
role: role,
|
|
@@ -70,10 +75,10 @@ const Inline = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
70
75
|
direction: "row",
|
|
71
76
|
gap: space,
|
|
72
77
|
rowGap: rowSpace,
|
|
73
|
-
wrap: shouldWrap ? 'wrap' : undefined
|
|
74
|
-
xcss: grow ? [flexGrowMap[grow], ...(Array.isArray(xcss) ? xcss : [xcss])] :
|
|
78
|
+
wrap: shouldWrap ? 'wrap' : undefined
|
|
75
79
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
76
|
-
|
|
80
|
+
,
|
|
81
|
+
xcss: styles,
|
|
77
82
|
testId: testId,
|
|
78
83
|
ref: ref
|
|
79
84
|
}, children);
|
|
@@ -66,7 +66,7 @@ const UNSAFE_PRESSABLE = /*#__PURE__*/forwardRef(({
|
|
|
66
66
|
action: 'clicked',
|
|
67
67
|
componentName: componentName || 'Pressable',
|
|
68
68
|
packageName: "@atlaskit/primitives",
|
|
69
|
-
packageVersion: "3.
|
|
69
|
+
packageVersion: "3.2.0",
|
|
70
70
|
analyticsData: analyticsContext,
|
|
71
71
|
actionSubject: 'button'
|
|
72
72
|
});
|
|
@@ -75,6 +75,10 @@ const UNSAFE_PRESSABLE = /*#__PURE__*/forwardRef(({
|
|
|
75
75
|
let styles = [xcss({
|
|
76
76
|
cursor: isDisabled ? 'not-allowed' : 'pointer'
|
|
77
77
|
}), focusRingStyles];
|
|
78
|
+
|
|
79
|
+
// We're type coercing this as Compiled styles in an array isn't supported by the types
|
|
80
|
+
// But the runtime accepts it none-the-wiser. We can remove this entire block and replace
|
|
81
|
+
// it with cx(defaultStyles, focusRingStyles, xcssStyles) when we've moved away from Emotion.
|
|
78
82
|
styles = Array.isArray(xcssStyles) ? [...styles, ...xcssStyles] : [...styles, xcssStyles];
|
|
79
83
|
return /*#__PURE__*/React.createElement(Box, _extends({}, htmlAttributes, {
|
|
80
84
|
as: "button",
|
|
@@ -41,16 +41,21 @@ const Stack = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
41
41
|
role
|
|
42
42
|
}, ref) => {
|
|
43
43
|
const justifyContent = spread || alignBlock;
|
|
44
|
+
|
|
45
|
+
// We're type coercing this as Compiled styles in an array isn't supported by the types
|
|
46
|
+
// But the runtime accepts it none-the-wiser. We can remove this entire block and replace
|
|
47
|
+
// it with cx(defaultStyles, focusRingStyles, xcssStyles) when we've moved away from Emotion.
|
|
48
|
+
const styles = grow ? [flexGrowMap[grow], ...(Array.isArray(xcss) ? xcss : [xcss])] : xcss;
|
|
44
49
|
return jsx(Flex, {
|
|
45
50
|
as: as,
|
|
46
51
|
role: role,
|
|
47
52
|
gap: space,
|
|
48
53
|
direction: "column",
|
|
49
54
|
alignItems: alignItems,
|
|
50
|
-
justifyContent: justifyContent
|
|
51
|
-
xcss: grow ? [flexGrowMap[grow], ...(Array.isArray(xcss) ? xcss : [xcss])] :
|
|
55
|
+
justifyContent: justifyContent
|
|
52
56
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
53
|
-
|
|
57
|
+
,
|
|
58
|
+
xcss: styles,
|
|
54
59
|
testId: testId,
|
|
55
60
|
ref: ref
|
|
56
61
|
}, children);
|
package/dist/es2019/xcss/xcss.js
CHANGED
|
@@ -141,21 +141,51 @@ const baseXcss = style => {
|
|
|
141
141
|
};
|
|
142
142
|
|
|
143
143
|
/**
|
|
144
|
-
*
|
|
145
|
-
*
|
|
144
|
+
* Picks out runtime XCSS objects and build-time XCSS strings. This is needed
|
|
145
|
+
* to supported both Emotion and Compiled styles until we've fully migrated
|
|
146
|
+
* to Compiled.
|
|
147
|
+
*
|
|
148
|
+
* @private
|
|
149
|
+
* @deprecated
|
|
146
150
|
*/
|
|
147
|
-
|
|
148
151
|
export const parseXcss = args => {
|
|
149
152
|
if (Array.isArray(args)) {
|
|
150
|
-
|
|
153
|
+
const emotion = [];
|
|
154
|
+
const staticArr = [];
|
|
155
|
+
for (const arg of args) {
|
|
156
|
+
const result = parseXcss(arg);
|
|
157
|
+
if (result.emotion) {
|
|
158
|
+
emotion.push(...result.emotion);
|
|
159
|
+
}
|
|
160
|
+
if (result.static) {
|
|
161
|
+
staticArr.push(result.static);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
emotion,
|
|
166
|
+
static: staticArr.join(' ')
|
|
167
|
+
};
|
|
151
168
|
}
|
|
169
|
+
const objArgs = args;
|
|
152
170
|
const {
|
|
153
171
|
[uniqueSymbol]: styles
|
|
154
|
-
} =
|
|
155
|
-
if (
|
|
156
|
-
|
|
172
|
+
} = objArgs || {};
|
|
173
|
+
if (styles) {
|
|
174
|
+
return {
|
|
175
|
+
emotion: [styles]
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
if (args) {
|
|
179
|
+
// We use string interpolation here instead of .toString() just
|
|
180
|
+
// in case the resulting object doesn't have the method available.
|
|
181
|
+
const stringifiedArgs = `${args}`;
|
|
182
|
+
if (stringifiedArgs) {
|
|
183
|
+
return {
|
|
184
|
+
static: stringifiedArgs
|
|
185
|
+
};
|
|
186
|
+
}
|
|
157
187
|
}
|
|
158
|
-
return
|
|
188
|
+
return {};
|
|
159
189
|
};
|
|
160
190
|
|
|
161
191
|
// Media queries should not contain nested media queries
|
|
@@ -66,13 +66,15 @@ var Anchor = function Anchor(_ref, ref) {
|
|
|
66
66
|
action: 'clicked',
|
|
67
67
|
componentName: componentName || 'Anchor',
|
|
68
68
|
packageName: "@atlaskit/primitives",
|
|
69
|
-
packageVersion: "3.
|
|
69
|
+
packageVersion: "3.2.0",
|
|
70
70
|
analyticsData: analyticsContext,
|
|
71
71
|
actionSubject: 'link'
|
|
72
72
|
});
|
|
73
73
|
var RouterLink = useRouterLink();
|
|
74
74
|
|
|
75
|
-
//
|
|
75
|
+
// We're type coercing this as Compiled styles in an array isn't supported by the types
|
|
76
|
+
// But the runtime accepts it none-the-wiser. We can remove this entire block and replace
|
|
77
|
+
// it with cx(defaultStyles, focusRingStyles, xcssStyles) when we've moved away from Emotion.
|
|
76
78
|
var styles = Array.isArray(xcssStyles) ? [defaultStyles, focusRingStyles].concat(_toConsumableArray(xcssStyles)) : [defaultStyles, focusRingStyles, xcssStyles];
|
|
77
79
|
var isExternal = typeof href === 'string' && IS_EXTERNAL_LINK_REGEX.test(href);
|
|
78
80
|
var isNonHttpBased = typeof href === 'string' && IS_NON_HTTP_BASED.test(href);
|
|
@@ -58,11 +58,12 @@ var Bleed = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
58
58
|
block = _ref.block,
|
|
59
59
|
all = _ref.all,
|
|
60
60
|
xcss = _ref.xcss;
|
|
61
|
-
var
|
|
61
|
+
var resolvedStyles = parseXcss(xcss);
|
|
62
62
|
return jsx("div", {
|
|
63
|
+
className: resolvedStyles.static,
|
|
63
64
|
css: [baseStyles, (inline || all) && inlineBleedMap[inline || all], (block || all) && blockBleedMap[block || all],
|
|
64
65
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
65
|
-
|
|
66
|
+
resolvedStyles.emotion],
|
|
66
67
|
"data-testid": testId
|
|
67
68
|
}, children);
|
|
68
69
|
});
|
|
@@ -25,7 +25,7 @@ import { SurfaceContext } from './internal/surface-provider';
|
|
|
25
25
|
*/
|
|
26
26
|
export var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
27
27
|
var _ref$as = _ref.as,
|
|
28
|
-
|
|
28
|
+
Component = _ref$as === void 0 ? 'div' : _ref$as,
|
|
29
29
|
children = _ref.children,
|
|
30
30
|
backgroundColor = _ref.backgroundColor,
|
|
31
31
|
padding = _ref.padding,
|
|
@@ -39,24 +39,24 @@ export var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
39
39
|
testId = _ref.testId,
|
|
40
40
|
xcss = _ref.xcss,
|
|
41
41
|
htmlAttributes = _objectWithoutProperties(_ref, _excluded);
|
|
42
|
-
var Component = as;
|
|
43
42
|
// This is to remove className from safeHtmlAttributes
|
|
44
43
|
// @ts-expect-error className doesn't exist in the prop definition but we want to ensure it cannot be applied even if types are bypassed
|
|
45
44
|
var _spreadClass = htmlAttributes.className,
|
|
46
45
|
safeHtmlAttributes = _objectWithoutProperties(htmlAttributes, _excluded2);
|
|
47
|
-
var
|
|
46
|
+
var resolvedStyles = parseXcss(xcss);
|
|
48
47
|
var node =
|
|
49
48
|
// @ts-expect-error Expression produces a union type that is too complex to represent. I think this is unavoidable
|
|
50
49
|
jsx(Component, _extends({
|
|
51
50
|
style: style
|
|
52
51
|
// @ts-expect-error Expression produces a union type that is too complex to represent. We may be able to narrow the type here but unsure.
|
|
53
52
|
,
|
|
54
|
-
ref: ref
|
|
53
|
+
ref: ref,
|
|
54
|
+
className: resolvedStyles.static
|
|
55
55
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
56
56
|
}, safeHtmlAttributes, {
|
|
57
57
|
css: [baseStyles, backgroundColor && backgroundColorStylesMap[backgroundColor], isSurfaceColorToken(backgroundColor) && surfaceColorStylesMap[backgroundColor], padding && paddingStylesMap.padding[padding], paddingBlock && paddingStylesMap.paddingBlock[paddingBlock], paddingBlockStart && paddingStylesMap.paddingBlockStart[paddingBlockStart], paddingBlockEnd && paddingStylesMap.paddingBlockEnd[paddingBlockEnd], paddingInline && paddingStylesMap.paddingInline[paddingInline], paddingInlineStart && paddingStylesMap.paddingInlineStart[paddingInlineStart], paddingInlineEnd && paddingStylesMap.paddingInlineEnd[paddingInlineEnd],
|
|
58
58
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
59
|
-
|
|
59
|
+
resolvedStyles.emotion],
|
|
60
60
|
"data-testid": testId
|
|
61
61
|
}), children);
|
|
62
62
|
return backgroundColor ? jsx(SurfaceContext.Provider, {
|
|
@@ -98,12 +98,13 @@ var Flex = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
98
98
|
direction = _ref.direction,
|
|
99
99
|
wrap = _ref.wrap,
|
|
100
100
|
xcss = _ref.xcss;
|
|
101
|
-
var
|
|
101
|
+
var resolvedStyles = parseXcss(xcss);
|
|
102
102
|
return jsx(Component, {
|
|
103
103
|
role: role,
|
|
104
|
+
className: resolvedStyles.static,
|
|
104
105
|
css: [baseStyles, gap && spaceStylesMap.gap[gap], columnGap && spaceStylesMap.columnGap[columnGap], rowGap && spaceStylesMap.rowGap[rowGap], alignItems && alignItemsMap[alignItems], direction && flexDirectionMap[direction], justifyContent && justifyContentMap[justifyContent], wrap && flexWrapMap[wrap],
|
|
105
106
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
106
|
-
|
|
107
|
+
resolvedStyles.emotion],
|
|
107
108
|
"data-testid": testId,
|
|
108
109
|
ref: ref
|
|
109
110
|
}, children);
|
|
@@ -144,7 +144,7 @@ var Grid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
144
144
|
gridTemplateColumns = _ref.templateColumns,
|
|
145
145
|
xcss = _ref.xcss;
|
|
146
146
|
var Component = as || 'div';
|
|
147
|
-
var
|
|
147
|
+
var resolvedStyles = parseXcss(xcss);
|
|
148
148
|
|
|
149
149
|
/**
|
|
150
150
|
* We use CSS variables to allow for dynamic grid templates instead of dynamically setting to `props.style`
|
|
@@ -164,9 +164,10 @@ var Grid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
164
164
|
id: id,
|
|
165
165
|
role: role,
|
|
166
166
|
style: style,
|
|
167
|
+
className: resolvedStyles.static,
|
|
167
168
|
css: [baseStyles, gap && spaceStylesMap.gap[gap], columnGap && spaceStylesMap.columnGap[columnGap], rowGap && spaceStylesMap.rowGap[rowGap], alignItems && alignItemsMap[alignItems], alignContent && alignContentMap[alignContent], justifyContent && justifyContentMap[justifyContent], autoFlow && gridAutoFlowMap[autoFlow],
|
|
168
169
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
169
|
-
|
|
170
|
+
resolvedStyles.emotion],
|
|
170
171
|
"data-testid": testId,
|
|
171
172
|
ref: ref
|
|
172
173
|
}, children);
|
|
@@ -65,6 +65,11 @@ var Inline = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
65
65
|
}, separator && index > 0 ? separatorComponent : null, child);
|
|
66
66
|
}) : rawChildren;
|
|
67
67
|
var justifyContent = spread || alignInline;
|
|
68
|
+
|
|
69
|
+
// We're type coercing this as Compiled styles in an array isn't supported by the types
|
|
70
|
+
// But the runtime accepts it none-the-wiser. We can remove this entire block and replace
|
|
71
|
+
// it with cx(defaultStyles, focusRingStyles, xcssStyles) when we've moved away from Emotion.
|
|
72
|
+
var styles = grow ? [flexGrowMap[grow]].concat(_toConsumableArray(Array.isArray(xcss) ? xcss : [xcss])) : xcss;
|
|
68
73
|
return jsx(Flex, {
|
|
69
74
|
as: as,
|
|
70
75
|
role: role,
|
|
@@ -73,10 +78,10 @@ var Inline = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
73
78
|
direction: "row",
|
|
74
79
|
gap: space,
|
|
75
80
|
rowGap: rowSpace,
|
|
76
|
-
wrap: shouldWrap ? 'wrap' : undefined
|
|
77
|
-
xcss: grow ? [flexGrowMap[grow]].concat(_toConsumableArray(Array.isArray(xcss) ? xcss : [xcss])) :
|
|
81
|
+
wrap: shouldWrap ? 'wrap' : undefined
|
|
78
82
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
79
|
-
|
|
83
|
+
,
|
|
84
|
+
xcss: styles,
|
|
80
85
|
testId: testId,
|
|
81
86
|
ref: ref
|
|
82
87
|
}, children);
|
|
@@ -70,7 +70,7 @@ var UNSAFE_PRESSABLE = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
70
70
|
action: 'clicked',
|
|
71
71
|
componentName: componentName || 'Pressable',
|
|
72
72
|
packageName: "@atlaskit/primitives",
|
|
73
|
-
packageVersion: "3.
|
|
73
|
+
packageVersion: "3.2.0",
|
|
74
74
|
analyticsData: analyticsContext,
|
|
75
75
|
actionSubject: 'button'
|
|
76
76
|
});
|
|
@@ -79,6 +79,10 @@ var UNSAFE_PRESSABLE = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
79
79
|
var styles = [xcss({
|
|
80
80
|
cursor: isDisabled ? 'not-allowed' : 'pointer'
|
|
81
81
|
}), focusRingStyles];
|
|
82
|
+
|
|
83
|
+
// We're type coercing this as Compiled styles in an array isn't supported by the types
|
|
84
|
+
// But the runtime accepts it none-the-wiser. We can remove this entire block and replace
|
|
85
|
+
// it with cx(defaultStyles, focusRingStyles, xcssStyles) when we've moved away from Emotion.
|
|
82
86
|
styles = Array.isArray(xcssStyles) ? [].concat(_toConsumableArray(styles), _toConsumableArray(xcssStyles)) : [].concat(_toConsumableArray(styles), [xcssStyles]);
|
|
83
87
|
return /*#__PURE__*/React.createElement(Box, _extends({}, htmlAttributes, {
|
|
84
88
|
as: "button",
|
|
@@ -42,16 +42,21 @@ var Stack = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
42
42
|
xcss = _ref.xcss,
|
|
43
43
|
role = _ref.role;
|
|
44
44
|
var justifyContent = spread || alignBlock;
|
|
45
|
+
|
|
46
|
+
// We're type coercing this as Compiled styles in an array isn't supported by the types
|
|
47
|
+
// But the runtime accepts it none-the-wiser. We can remove this entire block and replace
|
|
48
|
+
// it with cx(defaultStyles, focusRingStyles, xcssStyles) when we've moved away from Emotion.
|
|
49
|
+
var styles = grow ? [flexGrowMap[grow]].concat(_toConsumableArray(Array.isArray(xcss) ? xcss : [xcss])) : xcss;
|
|
45
50
|
return jsx(Flex, {
|
|
46
51
|
as: as,
|
|
47
52
|
role: role,
|
|
48
53
|
gap: space,
|
|
49
54
|
direction: "column",
|
|
50
55
|
alignItems: alignItems,
|
|
51
|
-
justifyContent: justifyContent
|
|
52
|
-
xcss: grow ? [flexGrowMap[grow]].concat(_toConsumableArray(Array.isArray(xcss) ? xcss : [xcss])) :
|
|
56
|
+
justifyContent: justifyContent
|
|
53
57
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
54
|
-
|
|
58
|
+
,
|
|
59
|
+
xcss: styles,
|
|
55
60
|
testId: testId,
|
|
56
61
|
ref: ref
|
|
57
62
|
}, children);
|
package/dist/esm/xcss/xcss.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
1
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
4
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
5
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
6
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
4
8
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
5
9
|
import { css as cssEmotion } from '@emotion/react';
|
|
6
10
|
|
|
@@ -147,21 +151,59 @@ var baseXcss = function baseXcss(style) {
|
|
|
147
151
|
};
|
|
148
152
|
|
|
149
153
|
/**
|
|
150
|
-
*
|
|
151
|
-
*
|
|
154
|
+
* Picks out runtime XCSS objects and build-time XCSS strings. This is needed
|
|
155
|
+
* to supported both Emotion and Compiled styles until we've fully migrated
|
|
156
|
+
* to Compiled.
|
|
157
|
+
*
|
|
158
|
+
* @private
|
|
159
|
+
* @deprecated
|
|
152
160
|
*/
|
|
153
|
-
|
|
154
161
|
export var parseXcss = function parseXcss(args) {
|
|
155
162
|
if (Array.isArray(args)) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
163
|
+
var emotion = [];
|
|
164
|
+
var staticArr = [];
|
|
165
|
+
var _iterator = _createForOfIteratorHelper(args),
|
|
166
|
+
_step;
|
|
167
|
+
try {
|
|
168
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
169
|
+
var arg = _step.value;
|
|
170
|
+
var result = parseXcss(arg);
|
|
171
|
+
if (result.emotion) {
|
|
172
|
+
emotion.push.apply(emotion, _toConsumableArray(result.emotion));
|
|
173
|
+
}
|
|
174
|
+
if (result.static) {
|
|
175
|
+
staticArr.push(result.static);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
} catch (err) {
|
|
179
|
+
_iterator.e(err);
|
|
180
|
+
} finally {
|
|
181
|
+
_iterator.f();
|
|
182
|
+
}
|
|
183
|
+
return {
|
|
184
|
+
emotion: emotion,
|
|
185
|
+
static: staticArr.join(' ')
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
var objArgs = args;
|
|
189
|
+
var _ref4 = objArgs || {},
|
|
190
|
+
styles = _ref4[uniqueSymbol];
|
|
191
|
+
if (styles) {
|
|
192
|
+
return {
|
|
193
|
+
emotion: [styles]
|
|
194
|
+
};
|
|
159
195
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
196
|
+
if (args) {
|
|
197
|
+
// We use string interpolation here instead of .toString() just
|
|
198
|
+
// in case the resulting object doesn't have the method available.
|
|
199
|
+
var stringifiedArgs = "".concat(args);
|
|
200
|
+
if (stringifiedArgs) {
|
|
201
|
+
return {
|
|
202
|
+
static: stringifiedArgs
|
|
203
|
+
};
|
|
204
|
+
}
|
|
163
205
|
}
|
|
164
|
-
return
|
|
206
|
+
return {};
|
|
165
207
|
};
|
|
166
208
|
|
|
167
209
|
// Media queries should not contain nested media queries
|
|
@@ -100,11 +100,11 @@ declare const Flex: import("react").MemoExoticComponent<import("react").ForwardR
|
|
|
100
100
|
/**
|
|
101
101
|
* Used to align children along the main axis.
|
|
102
102
|
*/
|
|
103
|
-
justifyContent?: "space-around" | "space-between" | "space-evenly" | "stretch" | "
|
|
103
|
+
justifyContent?: "center" | "space-around" | "space-between" | "space-evenly" | "stretch" | "end" | "start" | undefined;
|
|
104
104
|
/**
|
|
105
105
|
* Used to align children along the cross axis.
|
|
106
106
|
*/
|
|
107
|
-
alignItems?: "
|
|
107
|
+
alignItems?: "center" | "stretch" | "end" | "start" | "baseline" | undefined;
|
|
108
108
|
/**
|
|
109
109
|
* Represents the space between each child.
|
|
110
110
|
*/
|
|
@@ -136,11 +136,11 @@ declare const Grid: import("react").MemoExoticComponent<import("react").ForwardR
|
|
|
136
136
|
/**
|
|
137
137
|
* Used to align children along the inline axis.
|
|
138
138
|
*/
|
|
139
|
-
justifyContent?: "space-around" | "space-between" | "space-evenly" | "stretch" | "
|
|
139
|
+
justifyContent?: "center" | "space-around" | "space-between" | "space-evenly" | "stretch" | "end" | "start" | undefined;
|
|
140
140
|
/**
|
|
141
141
|
* Used to align the grid along the inline axis.
|
|
142
142
|
*/
|
|
143
|
-
justifyItems?: "
|
|
143
|
+
justifyItems?: "center" | "stretch" | "end" | "start" | undefined;
|
|
144
144
|
/**
|
|
145
145
|
* Used to align children along the block axis.
|
|
146
146
|
*/
|
|
@@ -148,7 +148,7 @@ declare const Grid: import("react").MemoExoticComponent<import("react").ForwardR
|
|
|
148
148
|
/**
|
|
149
149
|
* Used to align the grid along the block axis.
|
|
150
150
|
*/
|
|
151
|
-
alignContent?: "space-around" | "space-between" | "space-evenly" | "stretch" | "
|
|
151
|
+
alignContent?: "center" | "space-around" | "space-between" | "space-evenly" | "stretch" | "end" | "start" | undefined;
|
|
152
152
|
/**
|
|
153
153
|
* Represents the space between each column.
|
|
154
154
|
*/
|
|
@@ -63,5 +63,5 @@ declare const UNSAFE_PRESSABLE: React.ForwardRefExoticComponent<Pick<Omit<BoxPro
|
|
|
63
63
|
* Additional information to be included in the `context` of analytics events that come from pressable.
|
|
64
64
|
*/
|
|
65
65
|
analyticsContext?: Record<string, any> | undefined;
|
|
66
|
-
}, "padding" | "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "backgroundColor" | "color" | "translate" | "
|
|
66
|
+
}, "padding" | "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "backgroundColor" | "color" | "translate" | "hidden" | "key" | "value" | "children" | "form" | "slot" | "title" | "name" | "type" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "testId" | "xcss" | "data-testid" | "isDisabled" | "interactionName" | "componentName" | "analyticsContext"> & React.RefAttributes<HTMLButtonElement>>;
|
|
67
67
|
export default UNSAFE_PRESSABLE;
|
|
@@ -58,7 +58,7 @@ declare const Stack: import("react").MemoExoticComponent<import("react").Forward
|
|
|
58
58
|
/**
|
|
59
59
|
* Used to align children along the block axis (typically vertical).
|
|
60
60
|
*/
|
|
61
|
-
alignBlock?: "
|
|
61
|
+
alignBlock?: "center" | "stretch" | "end" | "start" | undefined;
|
|
62
62
|
/**
|
|
63
63
|
* Used to align children along the inline axis (typically horizontal).
|
|
64
64
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { StrictXCSSProp, XCSSAllProperties, XCSSAllPseudos } from '@atlaskit/css';
|
|
2
3
|
import type { XCSS } from '../xcss/xcss';
|
|
3
4
|
export type BasePrimitiveProps = {
|
|
4
5
|
/**
|
|
@@ -11,9 +12,9 @@ export type BasePrimitiveProps = {
|
|
|
11
12
|
*/
|
|
12
13
|
'data-testid'?: never;
|
|
13
14
|
/**
|
|
14
|
-
* Apply a subset of permitted styles
|
|
15
|
+
* Apply a subset of permitted styles powered by Atlassian Design System design tokens.
|
|
15
16
|
*/
|
|
16
|
-
xcss?: XCSS | Array<XCSS | false | undefined>;
|
|
17
|
+
xcss?: XCSS | Array<XCSS | false | undefined> | StrictXCSSProp<XCSSAllProperties, XCSSAllPseudos>;
|
|
17
18
|
/**
|
|
18
19
|
* Accessible role.
|
|
19
20
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { css as cssEmotion } from '@emotion/react';
|
|
2
1
|
import type { CSSPropertiesWithMultiValues, SerializedStyles } from '@emotion/serialize';
|
|
3
2
|
import type * as CSS from 'csstype';
|
|
3
|
+
import type { StrictXCSSProp, XCSSAllProperties, XCSSAllPseudos } from '@atlaskit/css';
|
|
4
4
|
import type { MediaQuery } from '../responsive/types';
|
|
5
5
|
import { TokenisedProps } from './style-maps.partial';
|
|
6
6
|
export declare const tokensMap: {
|
|
@@ -1627,11 +1627,17 @@ export declare const tokensMap: {
|
|
|
1627
1627
|
};
|
|
1628
1628
|
declare const uniqueSymbol: unique symbol;
|
|
1629
1629
|
/**
|
|
1630
|
-
*
|
|
1631
|
-
*
|
|
1630
|
+
* Picks out runtime XCSS objects and build-time XCSS strings. This is needed
|
|
1631
|
+
* to supported both Emotion and Compiled styles until we've fully migrated
|
|
1632
|
+
* to Compiled.
|
|
1633
|
+
*
|
|
1634
|
+
* @private
|
|
1635
|
+
* @deprecated
|
|
1632
1636
|
*/
|
|
1633
|
-
|
|
1634
|
-
|
|
1637
|
+
export declare const parseXcss: (args: XCSS | (XCSS | false | undefined)[] | undefined | StrictXCSSProp<XCSSAllProperties, XCSSAllPseudos>) => {
|
|
1638
|
+
emotion?: SerializedStyles[];
|
|
1639
|
+
static?: string;
|
|
1640
|
+
};
|
|
1635
1641
|
type AllMedia = MediaQuery | '@media screen and (forced-colors: active), screen and (-ms-high-contrast: active)' | '@media (prefers-color-scheme: dark)' | '@media (prefers-color-scheme: light)' | '@media (prefers-reduced-motion: reduce)';
|
|
1636
1642
|
type CSSMediaQueries = {
|
|
1637
1643
|
[MQ in AllMedia]?: Omit<SafeCSSObject, AllMedia>;
|
|
@@ -100,11 +100,11 @@ declare const Flex: import("react").MemoExoticComponent<import("react").ForwardR
|
|
|
100
100
|
/**
|
|
101
101
|
* Used to align children along the main axis.
|
|
102
102
|
*/
|
|
103
|
-
justifyContent?: "space-around" | "space-between" | "space-evenly" | "stretch" | "
|
|
103
|
+
justifyContent?: "center" | "space-around" | "space-between" | "space-evenly" | "stretch" | "end" | "start" | undefined;
|
|
104
104
|
/**
|
|
105
105
|
* Used to align children along the cross axis.
|
|
106
106
|
*/
|
|
107
|
-
alignItems?: "
|
|
107
|
+
alignItems?: "center" | "stretch" | "end" | "start" | "baseline" | undefined;
|
|
108
108
|
/**
|
|
109
109
|
* Represents the space between each child.
|
|
110
110
|
*/
|
|
@@ -136,11 +136,11 @@ declare const Grid: import("react").MemoExoticComponent<import("react").ForwardR
|
|
|
136
136
|
/**
|
|
137
137
|
* Used to align children along the inline axis.
|
|
138
138
|
*/
|
|
139
|
-
justifyContent?: "space-around" | "space-between" | "space-evenly" | "stretch" | "
|
|
139
|
+
justifyContent?: "center" | "space-around" | "space-between" | "space-evenly" | "stretch" | "end" | "start" | undefined;
|
|
140
140
|
/**
|
|
141
141
|
* Used to align the grid along the inline axis.
|
|
142
142
|
*/
|
|
143
|
-
justifyItems?: "
|
|
143
|
+
justifyItems?: "center" | "stretch" | "end" | "start" | undefined;
|
|
144
144
|
/**
|
|
145
145
|
* Used to align children along the block axis.
|
|
146
146
|
*/
|
|
@@ -148,7 +148,7 @@ declare const Grid: import("react").MemoExoticComponent<import("react").ForwardR
|
|
|
148
148
|
/**
|
|
149
149
|
* Used to align the grid along the block axis.
|
|
150
150
|
*/
|
|
151
|
-
alignContent?: "space-around" | "space-between" | "space-evenly" | "stretch" | "
|
|
151
|
+
alignContent?: "center" | "space-around" | "space-between" | "space-evenly" | "stretch" | "end" | "start" | undefined;
|
|
152
152
|
/**
|
|
153
153
|
* Represents the space between each column.
|
|
154
154
|
*/
|
|
@@ -63,5 +63,5 @@ declare const UNSAFE_PRESSABLE: React.ForwardRefExoticComponent<Pick<Omit<BoxPro
|
|
|
63
63
|
* Additional information to be included in the `context` of analytics events that come from pressable.
|
|
64
64
|
*/
|
|
65
65
|
analyticsContext?: Record<string, any> | undefined;
|
|
66
|
-
}, "padding" | "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "backgroundColor" | "color" | "translate" | "
|
|
66
|
+
}, "padding" | "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "backgroundColor" | "color" | "translate" | "hidden" | "key" | "value" | "children" | "form" | "slot" | "title" | "name" | "type" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "testId" | "xcss" | "data-testid" | "isDisabled" | "interactionName" | "componentName" | "analyticsContext"> & React.RefAttributes<HTMLButtonElement>>;
|
|
67
67
|
export default UNSAFE_PRESSABLE;
|
|
@@ -58,7 +58,7 @@ declare const Stack: import("react").MemoExoticComponent<import("react").Forward
|
|
|
58
58
|
/**
|
|
59
59
|
* Used to align children along the block axis (typically vertical).
|
|
60
60
|
*/
|
|
61
|
-
alignBlock?: "
|
|
61
|
+
alignBlock?: "center" | "stretch" | "end" | "start" | undefined;
|
|
62
62
|
/**
|
|
63
63
|
* Used to align children along the inline axis (typically horizontal).
|
|
64
64
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { StrictXCSSProp, XCSSAllProperties, XCSSAllPseudos } from '@atlaskit/css';
|
|
2
3
|
import type { XCSS } from '../xcss/xcss';
|
|
3
4
|
export type BasePrimitiveProps = {
|
|
4
5
|
/**
|
|
@@ -11,9 +12,9 @@ export type BasePrimitiveProps = {
|
|
|
11
12
|
*/
|
|
12
13
|
'data-testid'?: never;
|
|
13
14
|
/**
|
|
14
|
-
* Apply a subset of permitted styles
|
|
15
|
+
* Apply a subset of permitted styles powered by Atlassian Design System design tokens.
|
|
15
16
|
*/
|
|
16
|
-
xcss?: XCSS | Array<XCSS | false | undefined>;
|
|
17
|
+
xcss?: XCSS | Array<XCSS | false | undefined> | StrictXCSSProp<XCSSAllProperties, XCSSAllPseudos>;
|
|
17
18
|
/**
|
|
18
19
|
* Accessible role.
|
|
19
20
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { css as cssEmotion } from '@emotion/react';
|
|
2
1
|
import type { CSSPropertiesWithMultiValues, SerializedStyles } from '@emotion/serialize';
|
|
3
2
|
import type * as CSS from 'csstype';
|
|
3
|
+
import type { StrictXCSSProp, XCSSAllProperties, XCSSAllPseudos } from '@atlaskit/css';
|
|
4
4
|
import type { MediaQuery } from '../responsive/types';
|
|
5
5
|
import { TokenisedProps } from './style-maps.partial';
|
|
6
6
|
export declare const tokensMap: {
|
|
@@ -1627,11 +1627,17 @@ export declare const tokensMap: {
|
|
|
1627
1627
|
};
|
|
1628
1628
|
declare const uniqueSymbol: unique symbol;
|
|
1629
1629
|
/**
|
|
1630
|
-
*
|
|
1631
|
-
*
|
|
1630
|
+
* Picks out runtime XCSS objects and build-time XCSS strings. This is needed
|
|
1631
|
+
* to supported both Emotion and Compiled styles until we've fully migrated
|
|
1632
|
+
* to Compiled.
|
|
1633
|
+
*
|
|
1634
|
+
* @private
|
|
1635
|
+
* @deprecated
|
|
1632
1636
|
*/
|
|
1633
|
-
|
|
1634
|
-
|
|
1637
|
+
export declare const parseXcss: (args: XCSS | (XCSS | false | undefined)[] | undefined | StrictXCSSProp<XCSSAllProperties, XCSSAllPseudos>) => {
|
|
1638
|
+
emotion?: SerializedStyles[];
|
|
1639
|
+
static?: string;
|
|
1640
|
+
};
|
|
1635
1641
|
type AllMedia = MediaQuery | '@media screen and (forced-colors: active), screen and (-ms-high-contrast: active)' | '@media (prefers-color-scheme: dark)' | '@media (prefers-color-scheme: light)' | '@media (prefers-reduced-motion: reduce)';
|
|
1636
1642
|
type CSSMediaQueries = {
|
|
1637
1643
|
[MQ in AllMedia]?: Omit<SafeCSSObject, AllMedia>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/primitives",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Primitives are token-backed low-level building blocks.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -124,6 +124,7 @@
|
|
|
124
124
|
"dependencies": {
|
|
125
125
|
"@atlaskit/analytics-next": "^9.2.0",
|
|
126
126
|
"@atlaskit/app-provider": "^1.0.0",
|
|
127
|
+
"@atlaskit/css": "^0.0.3",
|
|
127
128
|
"@atlaskit/ds-lib": "^2.2.0",
|
|
128
129
|
"@atlaskit/interaction-context": "^2.1.0",
|
|
129
130
|
"@atlaskit/tokens": "^1.38.0",
|