@atlaskit/primitives 0.8.9 → 0.9.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 +16 -0
- package/constellation/inline/code.mdx +1 -1
- package/constellation/stack/code.mdx +1 -1
- package/constellation/xcss/examples.mdx +21 -0
- package/constellation/xcss/logo.png +0 -0
- package/constellation/xcss/migration.mdx +142 -0
- package/constellation/xcss/usage.mdx +115 -0
- package/dist/cjs/components/box.js +1 -1
- package/dist/cjs/components/inline.js +1 -1
- package/dist/cjs/components/internal/base-box.js +1 -1
- package/dist/cjs/components/stack.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/{internal → xcss}/xcss.js +20 -8
- package/dist/es2019/components/box.js +1 -1
- package/dist/es2019/components/inline.js +1 -1
- package/dist/es2019/components/internal/base-box.js +1 -1
- package/dist/es2019/components/stack.js +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/{internal → xcss}/xcss.js +19 -6
- package/dist/esm/components/box.js +1 -1
- package/dist/esm/components/inline.js +1 -1
- package/dist/esm/components/internal/base-box.js +1 -1
- package/dist/esm/components/stack.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/esm/{internal → xcss}/xcss.js +20 -8
- package/dist/types/components/inline.d.ts +1 -1
- package/dist/types/components/internal/base-box.d.ts +1 -1
- package/dist/types/components/stack.d.ts +1 -1
- package/dist/types/components/types.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/{internal → xcss}/style-maps.partial.d.ts +4 -1
- package/dist/types/{internal → xcss}/xcss.d.ts +17 -10
- package/package.json +18 -9
- package/report.api.md +8 -5
- package/tmp/api-report-tmp.d.ts +6 -5
- package/dist/cjs/components/internal/extract-react-types/inline-props.js +0 -7
- package/dist/cjs/components/internal/extract-react-types/stack-props.js +0 -7
- package/dist/es2019/components/internal/extract-react-types/inline-props.js +0 -1
- package/dist/es2019/components/internal/extract-react-types/stack-props.js +0 -1
- package/dist/esm/components/internal/extract-react-types/inline-props.js +0 -1
- package/dist/esm/components/internal/extract-react-types/stack-props.js +0 -1
- package/dist/types/components/internal/extract-react-types/inline-props.d.ts +0 -2
- package/dist/types/components/internal/extract-react-types/stack-props.d.ts +0 -2
- /package/dist/cjs/{internal → xcss}/style-maps.partial.js +0 -0
- /package/dist/es2019/{internal → xcss}/style-maps.partial.js +0 -0
- /package/dist/esm/{internal → xcss}/style-maps.partial.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/primitives
|
|
2
2
|
|
|
3
|
+
## 0.9.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`5a9e73494eb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5a9e73494eb) - Updates to internal documentation.
|
|
8
|
+
|
|
9
|
+
## 0.9.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`56507598609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56507598609) - Skip minor dependency bump
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 0.8.9
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -4,7 +4,7 @@ description: Inline is a primitive component based on flexbox that manages the h
|
|
|
4
4
|
order: 1
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import InlineProps from '!!extract-react-types-loader!../../
|
|
7
|
+
import InlineProps from '!!extract-react-types-loader!../../extract-react-types/inline-props'
|
|
8
8
|
|
|
9
9
|
## Props
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ description: Stack is a primitive component based on flexbox that manages the ve
|
|
|
4
4
|
order: 1
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import StackProps from '!!extract-react-types-loader!../../
|
|
7
|
+
import StackProps from '!!extract-react-types-loader!../../extract-react-types/stack-props'
|
|
8
8
|
|
|
9
9
|
## Props
|
|
10
10
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: xCSS
|
|
3
|
+
description: xCSS is a safer, tokens-first approach to CSS-in-JS.
|
|
4
|
+
order: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
import xcssBasic from '../../examples/constellation/xcss/basic';
|
|
8
|
+
import xcssInteractive from '../../examples/constellation/xcss/interactivity';
|
|
9
|
+
|
|
10
|
+
## Basic
|
|
11
|
+
|
|
12
|
+
`xcss` can be used to pull together different types of interactions and UI in a safer more composable way.
|
|
13
|
+
|
|
14
|
+
<Example Component={xcssBasic} packageName="@atlaskit/primitives/xcss" />
|
|
15
|
+
|
|
16
|
+
## Interactivity
|
|
17
|
+
|
|
18
|
+
To enable interactivity you can lean on familiar selectors like `:hover` and `:focus-visible`.
|
|
19
|
+
|
|
20
|
+
<Example Component={xcssInteractive} packageName="@atlaskit/primitives/xcss" />
|
|
21
|
+
|
|
Binary file
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Migrating your app to xCSS
|
|
3
|
+
description: xCSS is a safer, tokens-first approach to CSS-in-JS.
|
|
4
|
+
order: 2
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Summary of changes
|
|
8
|
+
|
|
9
|
+
### Changes for developers
|
|
10
|
+
|
|
11
|
+
There are two key changes to be mindful of when migrating to use `xcss`.
|
|
12
|
+
The first is needing to update callsites to remove any nested styles and
|
|
13
|
+
tokenised values.
|
|
14
|
+
|
|
15
|
+
```diff
|
|
16
|
+
- import { css } from '@emotion/react';
|
|
17
|
+
+ import { xcss } from '@atlaskit/primitives';
|
|
18
|
+
|
|
19
|
+
- const someStyles = css({
|
|
20
|
+
+ const someStyles = xcss({
|
|
21
|
+
// token based properties will no longer need to be wrapped
|
|
22
|
+
- padding: token('space.100'),
|
|
23
|
+
+ padding: 'space.100'
|
|
24
|
+
// no change is required for non-tokenised values
|
|
25
|
+
transform: 'scale(2)'
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The second is that for the `xcss` function to be applied correctly it must be applied on a
|
|
30
|
+
component with an `xcss` JSXAttribute. By default this won't work with the `css` or `className`
|
|
31
|
+
JSXAttributes - so be aware if you're not seeing your styles appear.
|
|
32
|
+
|
|
33
|
+
```diff
|
|
34
|
+
- <div css={someStyles} />
|
|
35
|
+
+ <Box xcss={someStyles} />
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
#### Changing the way you express styles
|
|
40
|
+
|
|
41
|
+
Why are nested selectors a problem? A key philosophy of `xcss` is encouraging more deterministic style application. This restriction is designed to eliminate side-effects and
|
|
42
|
+
encourage component encapsulation. Consider the below example:
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
const myComponentStyles = css({
|
|
46
|
+
'> *': {
|
|
47
|
+
color: 'color.text.danger',
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const MyComponent = () => (
|
|
52
|
+
<div css={myComponentStyles}>
|
|
53
|
+
<p>Text here</p>
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Here the component is applying styles that are implicity meant for the text wrapped in the `p` below.
|
|
59
|
+
In this simple example, it may seem okay, desirable even, but cases like these often occur across module or component boundaries.
|
|
60
|
+
|
|
61
|
+
This makes the visibility of these dependencies harder to capture or reason about.
|
|
62
|
+
Styles that are inherited or indirectly apply make a UI brittle to change and hard to evolve.
|
|
63
|
+
Instead, if the same styles are applied directly on the affected element we can minimize and in some cases completely eliminate this problem.
|
|
64
|
+
|
|
65
|
+
```diff
|
|
66
|
+
const myTextStyles = xcss({
|
|
67
|
+
- '> *': {
|
|
68
|
+
color: 'color.text.danger',
|
|
69
|
+
- }
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const MyComponent = () => (
|
|
73
|
+
- <div xcss={myComponentStyles}>
|
|
74
|
+
+ <Box
|
|
75
|
+
+ <Text xcss={myTextStyles}>Text here</Text>
|
|
76
|
+
</Box>
|
|
77
|
+
);
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
There are likely to be cases where nesting is the only option. While not desirable, this is fine as long as it's considered
|
|
81
|
+
a last resort.
|
|
82
|
+
|
|
83
|
+
### FAQ
|
|
84
|
+
|
|
85
|
+
Overall migration to `xcss` is fairly simple for the majority of cases. Here are some common strategies for migrations.
|
|
86
|
+
|
|
87
|
+
#### Non-tokenised values
|
|
88
|
+
|
|
89
|
+
If you're yet to migrate to tokens, you have two options. You can migrate to tokens first and then on a second pass
|
|
90
|
+
migrate to `xcss` or you can make the jump directly.
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
const someStyles = css({
|
|
94
|
+
color: 'red',
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// ->>> Optional middle step
|
|
98
|
+
const someStyles = css({
|
|
99
|
+
color: token('color.text.danger'),
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// ->>> The final state
|
|
103
|
+
const someStyles = xcss({
|
|
104
|
+
color: 'color.text.danger',
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
#### Moving from the `styled` API
|
|
109
|
+
|
|
110
|
+
If you're currently using the `styled` API there are a few steps required to migration.
|
|
111
|
+
The safest approach is to a step change to use object styles, migrate to tokens (optionally)
|
|
112
|
+
and then migrate to `xcss`.
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
const MyComponent = styled.div`
|
|
116
|
+
color: red;
|
|
117
|
+
`;
|
|
118
|
+
|
|
119
|
+
// ->>> move to object styles
|
|
120
|
+
const MyComponent = styled.div({
|
|
121
|
+
color: 'red';
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// ->>> move to tokens
|
|
125
|
+
const MyComponent = styled.div({
|
|
126
|
+
color: token('color.text.danger'),
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// ->>> move to Box
|
|
130
|
+
const myComponentStyles = xcss({
|
|
131
|
+
color: 'color.text.danger',
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
const MyComponent = () => <Box xcss={myComponentStyles} />
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
## Get help
|
|
139
|
+
|
|
140
|
+
* Atlassians can reach out in [Slack](slack://channel?team=TFCUTJ0G5&id=CFJ9DU39U) for help with `xcss` migration.
|
|
141
|
+
* Other developers who need help with tokens or the `xcss` utility can post in the [public developer community](https://community.developer.atlassian.com/).
|
|
142
|
+
* For general help with the Atlassian Design System, [contact us](/resources/contact-us).
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: xCSS
|
|
3
|
+
description: xCSS is a safer, tokens-first approach to CSS-in-JS.
|
|
4
|
+
order: 0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
`xcss` is an Atlassian Design System styling API designed to natively integrate with
|
|
10
|
+
Atlassian's [design tokens](/tokens) and [primitives](/components/primitives) in a safer, more resilient and evolvable way.
|
|
11
|
+
|
|
12
|
+
The `xcss` utility behaves similarly to the `css` utility in libraries
|
|
13
|
+
like `styled-components`, `@compiled` or `@emotion` - so if you've used those libraries before
|
|
14
|
+
it will feel very familiar, with a few additional features and some constraints.
|
|
15
|
+
|
|
16
|
+
Features that will feel familiar:
|
|
17
|
+
|
|
18
|
+
* `xcss` will generate a `className` to be applied on your components
|
|
19
|
+
* `xcss` will provide key-value pairs of CSS properties in an object format
|
|
20
|
+
* `xcss` supports style precedence and conditional styles
|
|
21
|
+
|
|
22
|
+
But it also has a few key differences.
|
|
23
|
+
|
|
24
|
+
* `xcss` has type-safety that uses token names for all CSS properties that are represented by design tokens.
|
|
25
|
+
* `xcss` restricts nested selectors completely from usage.
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
To get started, import the function from `@atlaskit/primitives` and create a style:
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { xcss } from '@atlaskit/primitives';
|
|
33
|
+
|
|
34
|
+
// Creates a basic style
|
|
35
|
+
const someStyles = xcss({
|
|
36
|
+
display: 'block',
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Apply this style to a component through the `xcss` prop:
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
44
|
+
|
|
45
|
+
// Creates a basic style
|
|
46
|
+
const someStyles = xcss({
|
|
47
|
+
display: 'block',
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const MyBox = () => {
|
|
51
|
+
return <Box xcss={someStyles} />
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The prop and the `xcss` function are direct complements and are meant
|
|
56
|
+
to be used together. Note: styles generated from `xcss` cannot be applied directly
|
|
57
|
+
to the `className` property or `css` as they are with other CSS-in-JS libraries.
|
|
58
|
+
|
|
59
|
+
### Type safety
|
|
60
|
+
|
|
61
|
+
`xcss` uses strongly-typed values generated from design token
|
|
62
|
+
definitions to make it simpler to apply the right token for the right CSS property.
|
|
63
|
+
This is intended to be more ergonomic and intuitive but also prevent the misapplication of tokens
|
|
64
|
+
to the wrong properties.
|
|
65
|
+
|
|
66
|
+
Any [valid token name](/components/tokens/all-tokens) is available to be applied against its
|
|
67
|
+
matching CSS property. For example, the token name `space.200`
|
|
68
|
+
is a valid value below for `padding` but will not appear
|
|
69
|
+
as a color, or a font.
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
import { xcss } from '@atlaskit/primitives';
|
|
73
|
+
|
|
74
|
+
const someStyles = xcss({
|
|
75
|
+
padding: 'space.200', // <--- works
|
|
76
|
+
color: 'space.200', // <--- invalid and will error
|
|
77
|
+
borderRadius: 'radius.100' // <--- also valid
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Restricted nesting
|
|
82
|
+
|
|
83
|
+
`xcss` is meant to be flexible enough for you to implement any design but it does
|
|
84
|
+
restrict the application of styles in one key way. Selectors cannot be
|
|
85
|
+
nested or target elements beyond the element on which styles are applied.
|
|
86
|
+
This restriction is intended to encourage better component encapsulation, reduce side-effects and make
|
|
87
|
+
your codebase more resilient to change.
|
|
88
|
+
|
|
89
|
+
```tsx
|
|
90
|
+
import { xcss } from '@atlaskit/primitives';
|
|
91
|
+
|
|
92
|
+
const someStyles = xcss({
|
|
93
|
+
':hover': {
|
|
94
|
+
transform: 'scale(1)' // this is okay
|
|
95
|
+
},
|
|
96
|
+
// This is not okay as this selector affects any nested div in
|
|
97
|
+
// the component tree.
|
|
98
|
+
'div:hover': {
|
|
99
|
+
transform: 'scale(1)'
|
|
100
|
+
},
|
|
101
|
+
// Neither is this
|
|
102
|
+
'> * > div:hover': {
|
|
103
|
+
transform: 'scale(1)'
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
These unsafe selectors will throw a type error if applied.
|
|
109
|
+
For richer examples of how to use `xcss` please see our [documentation here](/components/primitives/xcss/examples).
|
|
110
|
+
|
|
111
|
+
## Get help
|
|
112
|
+
|
|
113
|
+
* Atlassians can reach out in [Slack](slack://channel?team=TFCUTJ0G5&id=CFJ9DU39U) for help with `xcss` migration.
|
|
114
|
+
* Other developers who need help with tokens or the `xcss` utility can post in the [public developer community](https://community.developer.atlassian.com/).
|
|
115
|
+
* For general help with the Atlassian Design System, [contact us](/resources/contact-us).
|
|
@@ -9,7 +9,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
|
-
var _xcss = require("../
|
|
12
|
+
var _xcss = require("../xcss/xcss");
|
|
13
13
|
var _baseBox = require("./internal/base-box");
|
|
14
14
|
var _excluded = ["as", "children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "style", "testId", "xcss"],
|
|
15
15
|
_excluded2 = ["className"];
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _react2 = require("@emotion/react");
|
|
9
|
-
var _styleMaps = require("../
|
|
9
|
+
var _styleMaps = require("../xcss/style-maps.partial");
|
|
10
10
|
/* eslint-disable @repo/internal/styles/no-exported-styles */
|
|
11
11
|
/** @jsx jsx */
|
|
12
12
|
|
|
@@ -9,7 +9,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
|
-
var _styleMaps = require("../../
|
|
12
|
+
var _styleMaps = require("../../xcss/style-maps.partial");
|
|
13
13
|
var _excluded = ["as", "className", "children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "style", "testId"];
|
|
14
14
|
/* eslint-disable @repo/internal/styles/no-exported-styles */
|
|
15
15
|
/** @jsx jsx */
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _react2 = require("@emotion/react");
|
|
9
|
-
var _styleMaps = require("../
|
|
9
|
+
var _styleMaps = require("../xcss/style-maps.partial");
|
|
10
10
|
/* eslint-disable @repo/internal/styles/no-exported-styles */
|
|
11
11
|
/** @jsx jsx */
|
|
12
12
|
|
package/dist/cjs/index.js
CHANGED
|
@@ -30,5 +30,5 @@ Object.defineProperty(exports, "xcss", {
|
|
|
30
30
|
});
|
|
31
31
|
var _box = _interopRequireDefault(require("./components/box"));
|
|
32
32
|
var _inline = _interopRequireDefault(require("./components/inline"));
|
|
33
|
-
var _xcss = require("./
|
|
33
|
+
var _xcss = require("./xcss/xcss");
|
|
34
34
|
var _stack = _interopRequireDefault(require("./components/stack"));
|
package/dist/cjs/version.json
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.parseXcss = void 0;
|
|
8
8
|
exports.xcss = xcss;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
11
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
12
|
var _react = require("@emotion/react");
|
|
@@ -49,6 +50,9 @@ var tokensMap = {
|
|
|
49
50
|
minHeight: _styleMaps.dimensionMap,
|
|
50
51
|
minInlineSize: _styleMaps.dimensionMap,
|
|
51
52
|
minWidth: _styleMaps.dimensionMap,
|
|
53
|
+
outlineOffset: _styleMaps.paddingMap,
|
|
54
|
+
outlineWidth: _styleMaps.borderWidthMap,
|
|
55
|
+
outlineColor: _styleMaps.borderColorMap,
|
|
52
56
|
overflow: _styleMaps.overflowMap,
|
|
53
57
|
overflowBlock: _styleMaps.overflowBlockMap,
|
|
54
58
|
overflowInline: _styleMaps.overflowInlineMap,
|
|
@@ -70,7 +74,7 @@ var tokensMap = {
|
|
|
70
74
|
width: _styleMaps.dimensionMap,
|
|
71
75
|
zIndex: _styleMaps.layerMap
|
|
72
76
|
};
|
|
73
|
-
var uniqueSymbol = Symbol('
|
|
77
|
+
var uniqueSymbol = Symbol('UNSAFE_INTERNAL_styles');
|
|
74
78
|
var isSafeEnvToThrow = function isSafeEnvToThrow() {
|
|
75
79
|
return (typeof process === "undefined" ? "undefined" : (0, _typeof2.default)(process)) === 'object' && (0, _typeof2.default)(process.env) === 'object' && process.env.NODE_ENV !== 'production';
|
|
76
80
|
};
|
|
@@ -124,10 +128,7 @@ var transformStyles = function transformStyles(styleObj) {
|
|
|
124
128
|
};
|
|
125
129
|
var baseXcss = function baseXcss(style) {
|
|
126
130
|
var transformedStyles = transformStyles(style);
|
|
127
|
-
return {
|
|
128
|
-
symbol: uniqueSymbol,
|
|
129
|
-
styles: (0, _react.css)(transformedStyles)
|
|
130
|
-
};
|
|
131
|
+
return (0, _defineProperty2.default)({}, uniqueSymbol, (0, _react.css)(transformedStyles));
|
|
131
132
|
};
|
|
132
133
|
|
|
133
134
|
/**
|
|
@@ -141,9 +142,8 @@ var parseXcss = function parseXcss(args) {
|
|
|
141
142
|
return x && parseXcss(x);
|
|
142
143
|
}).filter(Boolean);
|
|
143
144
|
}
|
|
144
|
-
var
|
|
145
|
-
|
|
146
|
-
if ((typeof process === "undefined" ? "undefined" : (0, _typeof2.default)(process)) && process.env.NODE_ENV === 'development' && symbol !== uniqueSymbol) {
|
|
145
|
+
var styles = args[uniqueSymbol];
|
|
146
|
+
if ((typeof process === "undefined" ? "undefined" : (0, _typeof2.default)(process)) && process.env.NODE_ENV === 'development' && typeof styles === 'undefined') {
|
|
147
147
|
throw new Error('Styles generated from unsafe source, use the `xcss` export from `@atlaskit/primitives`.');
|
|
148
148
|
}
|
|
149
149
|
return styles;
|
|
@@ -156,6 +156,18 @@ var boxWrapper = function boxWrapper(style) {
|
|
|
156
156
|
var inlineWrapper = function inlineWrapper(style) {
|
|
157
157
|
return xcss(style);
|
|
158
158
|
};
|
|
159
|
+
/**
|
|
160
|
+
* ### xcss
|
|
161
|
+
*
|
|
162
|
+
* `xcss` is a safer, tokens-first approach to CSS-in-JS. It allows token-backed values for
|
|
163
|
+
* CSS application.
|
|
164
|
+
*
|
|
165
|
+
* ```tsx
|
|
166
|
+
* const styles = xcss({
|
|
167
|
+
* padding: 'space.100'
|
|
168
|
+
* })
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
159
171
|
function xcss(style) {
|
|
160
172
|
return baseXcss(style);
|
|
161
173
|
}
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { jsx } from '@emotion/react';
|
|
5
|
-
import { parseXcss } from '../
|
|
5
|
+
import { parseXcss } from '../xcss/xcss';
|
|
6
6
|
import { BaseBox } from './internal/base-box';
|
|
7
7
|
/**
|
|
8
8
|
* __Box__
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { Children, forwardRef, Fragment, memo } from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
|
-
import { spaceStylesMap } from '../
|
|
5
|
+
import { spaceStylesMap } from '../xcss/style-maps.partial';
|
|
6
6
|
const alignItemsMap = {
|
|
7
7
|
center: css({
|
|
8
8
|
alignItems: 'center'
|
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import { forwardRef } from 'react';
|
|
5
5
|
import { css, jsx } from '@emotion/react';
|
|
6
|
-
import { backgroundColorStylesMap, paddingStylesMap } from '../../
|
|
6
|
+
import { backgroundColorStylesMap, paddingStylesMap } from '../../xcss/style-maps.partial';
|
|
7
7
|
|
|
8
8
|
// Without this type annotation on Box we don't get autocomplete for props due to forwardRef types
|
|
9
9
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { forwardRef, memo } from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
|
-
import { spaceStylesMap } from '../
|
|
5
|
+
import { spaceStylesMap } from '../xcss/style-maps.partial';
|
|
6
6
|
const justifyContentMap = {
|
|
7
7
|
start: css({
|
|
8
8
|
justifyContent: 'start'
|
package/dist/es2019/index.js
CHANGED
package/dist/es2019/version.json
CHANGED
|
@@ -38,6 +38,9 @@ const tokensMap = {
|
|
|
38
38
|
minHeight: dimensionMap,
|
|
39
39
|
minInlineSize: dimensionMap,
|
|
40
40
|
minWidth: dimensionMap,
|
|
41
|
+
outlineOffset: paddingMap,
|
|
42
|
+
outlineWidth: borderWidthMap,
|
|
43
|
+
outlineColor: borderColorMap,
|
|
41
44
|
overflow: overflowMap,
|
|
42
45
|
overflowBlock: overflowBlockMap,
|
|
43
46
|
overflowInline: overflowInlineMap,
|
|
@@ -59,7 +62,7 @@ const tokensMap = {
|
|
|
59
62
|
width: dimensionMap,
|
|
60
63
|
zIndex: layerMap
|
|
61
64
|
};
|
|
62
|
-
const uniqueSymbol = Symbol('
|
|
65
|
+
const uniqueSymbol = Symbol('UNSAFE_INTERNAL_styles');
|
|
63
66
|
const isSafeEnvToThrow = () => typeof process === 'object' && typeof process.env === 'object' && process.env.NODE_ENV !== 'production';
|
|
64
67
|
const reNestedSelectors = /(\.|\s|&+|\*\>|#|\[.*\])/;
|
|
65
68
|
const rePseudos = /^::?.*$/;
|
|
@@ -109,8 +112,7 @@ const transformStyles = styleObj => {
|
|
|
109
112
|
const baseXcss = style => {
|
|
110
113
|
const transformedStyles = transformStyles(style);
|
|
111
114
|
return {
|
|
112
|
-
|
|
113
|
-
styles: cssEmotion(transformedStyles)
|
|
115
|
+
[uniqueSymbol]: cssEmotion(transformedStyles)
|
|
114
116
|
};
|
|
115
117
|
};
|
|
116
118
|
|
|
@@ -124,10 +126,9 @@ export const parseXcss = args => {
|
|
|
124
126
|
return args.map(x => x && parseXcss(x)).filter(Boolean);
|
|
125
127
|
}
|
|
126
128
|
const {
|
|
127
|
-
|
|
128
|
-
styles
|
|
129
|
+
[uniqueSymbol]: styles
|
|
129
130
|
} = args;
|
|
130
|
-
if (typeof process && process.env.NODE_ENV === 'development' &&
|
|
131
|
+
if (typeof process && process.env.NODE_ENV === 'development' && typeof styles === 'undefined') {
|
|
131
132
|
throw new Error('Styles generated from unsafe source, use the `xcss` export from `@atlaskit/primitives`.');
|
|
132
133
|
}
|
|
133
134
|
return styles;
|
|
@@ -135,6 +136,18 @@ export const parseXcss = args => {
|
|
|
135
136
|
// unused private functions only so we can extract the return type from a generic function
|
|
136
137
|
const boxWrapper = style => xcss(style);
|
|
137
138
|
const inlineWrapper = style => xcss(style);
|
|
139
|
+
/**
|
|
140
|
+
* ### xcss
|
|
141
|
+
*
|
|
142
|
+
* `xcss` is a safer, tokens-first approach to CSS-in-JS. It allows token-backed values for
|
|
143
|
+
* CSS application.
|
|
144
|
+
*
|
|
145
|
+
* ```tsx
|
|
146
|
+
* const styles = xcss({
|
|
147
|
+
* padding: 'space.100'
|
|
148
|
+
* })
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
138
151
|
export function xcss(style) {
|
|
139
152
|
return baseXcss(style);
|
|
140
153
|
}
|
|
@@ -5,7 +5,7 @@ var _excluded = ["as", "children", "backgroundColor", "padding", "paddingBlock",
|
|
|
5
5
|
/** @jsx jsx */
|
|
6
6
|
import { forwardRef } from 'react';
|
|
7
7
|
import { jsx } from '@emotion/react';
|
|
8
|
-
import { parseXcss } from '../
|
|
8
|
+
import { parseXcss } from '../xcss/xcss';
|
|
9
9
|
import { BaseBox } from './internal/base-box';
|
|
10
10
|
/**
|
|
11
11
|
* __Box__
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { Children, forwardRef, Fragment, memo } from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
|
-
import { spaceStylesMap } from '../
|
|
5
|
+
import { spaceStylesMap } from '../xcss/style-maps.partial';
|
|
6
6
|
var alignItemsMap = {
|
|
7
7
|
center: css({
|
|
8
8
|
alignItems: 'center'
|
|
@@ -5,7 +5,7 @@ var _excluded = ["as", "className", "children", "backgroundColor", "padding", "p
|
|
|
5
5
|
/** @jsx jsx */
|
|
6
6
|
import { forwardRef } from 'react';
|
|
7
7
|
import { css, jsx } from '@emotion/react';
|
|
8
|
-
import { backgroundColorStylesMap, paddingStylesMap } from '../../
|
|
8
|
+
import { backgroundColorStylesMap, paddingStylesMap } from '../../xcss/style-maps.partial';
|
|
9
9
|
|
|
10
10
|
// Without this type annotation on Box we don't get autocomplete for props due to forwardRef types
|
|
11
11
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { forwardRef, memo } from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
|
-
import { spaceStylesMap } from '../
|
|
5
|
+
import { spaceStylesMap } from '../xcss/style-maps.partial';
|
|
6
6
|
var justifyContentMap = {
|
|
7
7
|
start: css({
|
|
8
8
|
justifyContent: 'start'
|
package/dist/esm/index.js
CHANGED
package/dist/esm/version.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
3
4
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
@@ -40,6 +41,9 @@ var tokensMap = {
|
|
|
40
41
|
minHeight: dimensionMap,
|
|
41
42
|
minInlineSize: dimensionMap,
|
|
42
43
|
minWidth: dimensionMap,
|
|
44
|
+
outlineOffset: paddingMap,
|
|
45
|
+
outlineWidth: borderWidthMap,
|
|
46
|
+
outlineColor: borderColorMap,
|
|
43
47
|
overflow: overflowMap,
|
|
44
48
|
overflowBlock: overflowBlockMap,
|
|
45
49
|
overflowInline: overflowInlineMap,
|
|
@@ -61,7 +65,7 @@ var tokensMap = {
|
|
|
61
65
|
width: dimensionMap,
|
|
62
66
|
zIndex: layerMap
|
|
63
67
|
};
|
|
64
|
-
var uniqueSymbol = Symbol('
|
|
68
|
+
var uniqueSymbol = Symbol('UNSAFE_INTERNAL_styles');
|
|
65
69
|
var isSafeEnvToThrow = function isSafeEnvToThrow() {
|
|
66
70
|
return (typeof process === "undefined" ? "undefined" : _typeof(process)) === 'object' && _typeof(process.env) === 'object' && process.env.NODE_ENV !== 'production';
|
|
67
71
|
};
|
|
@@ -115,10 +119,7 @@ var transformStyles = function transformStyles(styleObj) {
|
|
|
115
119
|
};
|
|
116
120
|
var baseXcss = function baseXcss(style) {
|
|
117
121
|
var transformedStyles = transformStyles(style);
|
|
118
|
-
return {
|
|
119
|
-
symbol: uniqueSymbol,
|
|
120
|
-
styles: cssEmotion(transformedStyles)
|
|
121
|
-
};
|
|
122
|
+
return _defineProperty({}, uniqueSymbol, cssEmotion(transformedStyles));
|
|
122
123
|
};
|
|
123
124
|
|
|
124
125
|
/**
|
|
@@ -132,9 +133,8 @@ export var parseXcss = function parseXcss(args) {
|
|
|
132
133
|
return x && parseXcss(x);
|
|
133
134
|
}).filter(Boolean);
|
|
134
135
|
}
|
|
135
|
-
var
|
|
136
|
-
|
|
137
|
-
if ((typeof process === "undefined" ? "undefined" : _typeof(process)) && process.env.NODE_ENV === 'development' && symbol !== uniqueSymbol) {
|
|
136
|
+
var styles = args[uniqueSymbol];
|
|
137
|
+
if ((typeof process === "undefined" ? "undefined" : _typeof(process)) && process.env.NODE_ENV === 'development' && typeof styles === 'undefined') {
|
|
138
138
|
throw new Error('Styles generated from unsafe source, use the `xcss` export from `@atlaskit/primitives`.');
|
|
139
139
|
}
|
|
140
140
|
return styles;
|
|
@@ -146,6 +146,18 @@ var boxWrapper = function boxWrapper(style) {
|
|
|
146
146
|
var inlineWrapper = function inlineWrapper(style) {
|
|
147
147
|
return xcss(style);
|
|
148
148
|
};
|
|
149
|
+
/**
|
|
150
|
+
* ### xcss
|
|
151
|
+
*
|
|
152
|
+
* `xcss` is a safer, tokens-first approach to CSS-in-JS. It allows token-backed values for
|
|
153
|
+
* CSS application.
|
|
154
|
+
*
|
|
155
|
+
* ```tsx
|
|
156
|
+
* const styles = xcss({
|
|
157
|
+
* padding: 'space.100'
|
|
158
|
+
* })
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
149
161
|
export function xcss(style) {
|
|
150
162
|
return baseXcss(style);
|
|
151
163
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { ElementType, ReactNode } from 'react';
|
|
3
|
-
import { type Gap, type RowGap } from '../
|
|
3
|
+
import { type Gap, type RowGap } from '../xcss/style-maps.partial';
|
|
4
4
|
export interface InlineProps<T extends ElementType = 'div'> {
|
|
5
5
|
/**
|
|
6
6
|
* The DOM element to render as the Inline. Defaults to `div`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { ComponentPropsWithoutRef, ComponentPropsWithRef, ElementType, FC, ReactElement, ReactNode } from 'react';
|
|
3
|
-
import { BackgroundColor, Padding, PaddingBlock, PaddingBlockEnd, PaddingBlockStart, PaddingInline, PaddingInlineEnd, PaddingInlineStart } from '../../
|
|
3
|
+
import { BackgroundColor, Padding, PaddingBlock, PaddingBlockEnd, PaddingBlockStart, PaddingInline, PaddingInlineEnd, PaddingInlineStart } from '../../xcss/style-maps.partial';
|
|
4
4
|
import type { BasePrimitiveProps } from '../types';
|
|
5
5
|
export declare type BaseBoxProps<T extends ElementType = 'div'> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & BaseBoxPropsFoundation<T>;
|
|
6
6
|
declare type BaseBoxPropsFoundation<T extends ElementType> = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { ElementType, ReactNode } from 'react';
|
|
3
|
-
import { type Gap } from '../
|
|
3
|
+
import { type Gap } from '../xcss/style-maps.partial';
|
|
4
4
|
export interface StackProps<T extends ElementType = 'div'> {
|
|
5
5
|
/**
|
|
6
6
|
* The DOM element to render as the Stack. Defaults to `div`.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
|
-
import { type BoxXCSS } from '../
|
|
2
|
+
import { type BoxXCSS } from '../xcss/xcss';
|
|
3
3
|
export declare type BasePrimitiveProps = {
|
|
4
4
|
/**
|
|
5
5
|
* A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as Box, type BoxProps } from './components/box';
|
|
2
2
|
export { default as Inline, type InlineProps } from './components/inline';
|
|
3
|
-
export { xcss } from './
|
|
3
|
+
export { xcss } from './xcss/xcss';
|
|
4
4
|
export { default as Stack, type StackProps } from './components/stack';
|
|
@@ -458,6 +458,9 @@ export declare type TokenisedProps = {
|
|
|
458
458
|
minHeight?: MinHeight;
|
|
459
459
|
minInlineSize?: MinInlineSize;
|
|
460
460
|
minWidth?: MinWidth;
|
|
461
|
+
outlineColor?: BorderColor;
|
|
462
|
+
outlineOffset?: Padding;
|
|
463
|
+
outlineWidth?: BorderWidth;
|
|
461
464
|
overflow?: Overflow;
|
|
462
465
|
overflowBlock?: OverflowBlock;
|
|
463
466
|
overflowInline?: OverflowInline;
|
|
@@ -476,7 +479,7 @@ export declare type TokenisedProps = {
|
|
|
476
479
|
zIndex?: Layer;
|
|
477
480
|
};
|
|
478
481
|
declare const spacingProperties: readonly ["padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "gap", "rowGap", "columnGap"];
|
|
479
|
-
declare type SpacingProperty = typeof spacingProperties[number];
|
|
482
|
+
declare type SpacingProperty = (typeof spacingProperties)[number];
|
|
480
483
|
declare type SpacingToken = keyof typeof paddingMap;
|
|
481
484
|
declare type BackgroundColorToken = keyof typeof backgroundColorMap;
|
|
482
485
|
declare type SpacingStyleMap = Record<SpacingProperty, Record<SpacingToken, SerializedStyles>>;
|
|
@@ -17,34 +17,41 @@ declare type CSSPseudos = {
|
|
|
17
17
|
declare type SafeCSSObject = CSSPseudos & TokenisedProps & Omit<CSSPropertiesWithMultiValues, keyof TokenisedProps>;
|
|
18
18
|
declare type ScopedSafeCSSObject<T extends keyof SafeCSSObject> = Pick<SafeCSSObject, T>;
|
|
19
19
|
declare const boxWrapper: (style: any) => {
|
|
20
|
-
readonly
|
|
21
|
-
readonly styles: BoxStyles;
|
|
20
|
+
readonly [uniqueSymbol]: BoxStyles;
|
|
22
21
|
};
|
|
23
22
|
declare const inlineWrapper: (style: any) => {
|
|
24
|
-
readonly
|
|
25
|
-
readonly styles: InlineStyles;
|
|
23
|
+
readonly [uniqueSymbol]: InlineStyles;
|
|
26
24
|
};
|
|
27
25
|
declare type XCSS = ReturnType<typeof boxWrapper> | ReturnType<typeof inlineWrapper>;
|
|
28
26
|
declare type AllowedBoxStyles = keyof SafeCSSObject;
|
|
29
27
|
declare type AllowedInlineStyles = 'backgroundColor' | 'padding';
|
|
28
|
+
/**
|
|
29
|
+
* ### xcss
|
|
30
|
+
*
|
|
31
|
+
* `xcss` is a safer, tokens-first approach to CSS-in-JS. It allows token-backed values for
|
|
32
|
+
* CSS application.
|
|
33
|
+
*
|
|
34
|
+
* ```tsx
|
|
35
|
+
* const styles = xcss({
|
|
36
|
+
* padding: 'space.100'
|
|
37
|
+
* })
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
30
40
|
export declare function xcss<Primitive extends typeof Box | typeof Inline = typeof Box>(style: Primitive extends typeof Box ? ScopedSafeCSSObject<AllowedBoxStyles> | ScopedSafeCSSObject<AllowedBoxStyles>[] : Primitive extends typeof Inline ? ScopedSafeCSSObject<AllowedInlineStyles> | ScopedSafeCSSObject<AllowedInlineStyles>[] : never): {
|
|
31
|
-
readonly
|
|
32
|
-
readonly styles: Primitive extends (<T extends import("react").ElementType<any> = "div">(props: import("../index").BoxProps<T>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null) & import("react").FC<import("../index").BoxProps<"div">> ? BoxStyles : Primitive extends import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<import("../index").InlineProps<import("react").ElementType<any>>, "as" | "children" | "testId" | "alignInline" | "alignBlock" | "shouldWrap" | "spread" | "grow" | "space" | "rowSpace" | "separator"> & import("react").RefAttributes<any>>> ? InlineStyles : never;
|
|
41
|
+
readonly [uniqueSymbol]: Primitive extends (<T extends import("react").ElementType<any> = "div">(props: import("../index").BoxProps<T>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null) & import("react").FC<import("../index").BoxProps<"div">> ? BoxStyles : Primitive extends import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<import("../index").InlineProps<import("react").ElementType<any>>, "as" | "children" | "testId" | "alignInline" | "alignBlock" | "shouldWrap" | "spread" | "grow" | "space" | "rowSpace" | "separator"> & import("react").RefAttributes<any>>> ? InlineStyles : never;
|
|
33
42
|
};
|
|
34
43
|
declare const boxTag: unique symbol;
|
|
35
44
|
export declare type BoxStyles = SerializedStyles & {
|
|
36
45
|
[boxTag]: true;
|
|
37
46
|
};
|
|
38
47
|
export declare type BoxXCSS = {
|
|
39
|
-
readonly
|
|
40
|
-
readonly styles: BoxStyles;
|
|
48
|
+
readonly [uniqueSymbol]: BoxStyles;
|
|
41
49
|
};
|
|
42
50
|
declare const inlineTag: unique symbol;
|
|
43
51
|
export declare type InlineStyles = SerializedStyles & {
|
|
44
52
|
[inlineTag]: true;
|
|
45
53
|
};
|
|
46
54
|
export declare type InlineXCSS = {
|
|
47
|
-
readonly
|
|
48
|
-
readonly styles: InlineStyles;
|
|
55
|
+
readonly [uniqueSymbol]: InlineStyles;
|
|
49
56
|
};
|
|
50
57
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/primitives",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Primitives are token-backed low-level building blocks.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -55,6 +55,15 @@
|
|
|
55
55
|
"status": {
|
|
56
56
|
"type": "alpha"
|
|
57
57
|
}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"title": "xCSS",
|
|
61
|
+
"folder": "xcss",
|
|
62
|
+
"slug": "primitives/xcss",
|
|
63
|
+
"id": "@atlaskit/primitives/xcss",
|
|
64
|
+
"status": {
|
|
65
|
+
"type": "alpha"
|
|
66
|
+
}
|
|
58
67
|
}
|
|
59
68
|
]
|
|
60
69
|
}
|
|
@@ -76,8 +85,8 @@
|
|
|
76
85
|
"./responsive": "./src/helpers/responsive/index.tsx"
|
|
77
86
|
},
|
|
78
87
|
"dependencies": {
|
|
79
|
-
"@atlaskit/ds-lib": "^2.
|
|
80
|
-
"@atlaskit/tokens": "^1.
|
|
88
|
+
"@atlaskit/ds-lib": "^2.2.0",
|
|
89
|
+
"@atlaskit/tokens": "^1.3.0",
|
|
81
90
|
"@babel/runtime": "^7.0.0",
|
|
82
91
|
"@emotion/react": "^11.7.1",
|
|
83
92
|
"@emotion/serialize": "^1.1.0"
|
|
@@ -98,19 +107,19 @@
|
|
|
98
107
|
"@atlaskit/icon-object": "*",
|
|
99
108
|
"@atlaskit/logo": "*",
|
|
100
109
|
"@atlaskit/lozenge": "*",
|
|
101
|
-
"@atlaskit/radio": "^5.
|
|
102
|
-
"@atlaskit/range": "^7.0
|
|
110
|
+
"@atlaskit/radio": "^5.5.0",
|
|
111
|
+
"@atlaskit/range": "^7.1.0",
|
|
103
112
|
"@atlaskit/ssr": "*",
|
|
104
113
|
"@atlaskit/tag": "*",
|
|
105
114
|
"@atlaskit/theme": "*",
|
|
106
115
|
"@atlaskit/visual-regression": "*",
|
|
107
116
|
"@atlaskit/webdriver-runner": "*",
|
|
108
117
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
109
|
-
"@atlassian/codegen": "^0.0
|
|
110
|
-
"@atlassian/gemini-visual-regression": "^0.0.
|
|
118
|
+
"@atlassian/codegen": "^0.1.0",
|
|
119
|
+
"@atlassian/gemini-visual-regression": "^0.0.6",
|
|
111
120
|
"@testing-library/react": "^12.1.5",
|
|
112
121
|
"csstype": "^3.1.0",
|
|
113
|
-
"prettier": "^2.
|
|
122
|
+
"prettier": "^2.8.0",
|
|
114
123
|
"react-dom": "^16.8.0",
|
|
115
124
|
"ts-node": "^10.9.1",
|
|
116
125
|
"typescript": "4.5.5",
|
|
@@ -142,4 +151,4 @@
|
|
|
142
151
|
}
|
|
143
152
|
},
|
|
144
153
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|
|
145
|
-
}
|
|
154
|
+
}
|
package/report.api.md
CHANGED
|
@@ -311,8 +311,7 @@ const boxTag: unique symbol;
|
|
|
311
311
|
|
|
312
312
|
// @public (undocumented)
|
|
313
313
|
type BoxXCSS = {
|
|
314
|
-
readonly
|
|
315
|
-
readonly styles: BoxStyles;
|
|
314
|
+
readonly [uniqueSymbol]: BoxStyles;
|
|
316
315
|
};
|
|
317
316
|
|
|
318
317
|
// @public (undocumented)
|
|
@@ -949,6 +948,9 @@ type TokenisedProps = {
|
|
|
949
948
|
minHeight?: MinHeight;
|
|
950
949
|
minInlineSize?: MinInlineSize;
|
|
951
950
|
minWidth?: MinWidth;
|
|
951
|
+
outlineColor?: BorderColor;
|
|
952
|
+
outlineOffset?: Padding;
|
|
953
|
+
outlineWidth?: BorderWidth;
|
|
952
954
|
overflow?: Overflow;
|
|
953
955
|
overflowBlock?: OverflowBlock;
|
|
954
956
|
overflowInline?: OverflowInline;
|
|
@@ -976,7 +978,7 @@ const uniqueSymbol: unique symbol;
|
|
|
976
978
|
// @public (undocumented)
|
|
977
979
|
type Width = keyof typeof dimensionMap;
|
|
978
980
|
|
|
979
|
-
// @public
|
|
981
|
+
// @public
|
|
980
982
|
export function xcss<Primitive extends typeof Box | typeof Inline = typeof Box>(
|
|
981
983
|
style: Primitive extends typeof Box
|
|
982
984
|
?
|
|
@@ -988,8 +990,9 @@ export function xcss<Primitive extends typeof Box | typeof Inline = typeof Box>(
|
|
|
988
990
|
| ScopedSafeCSSObject<AllowedInlineStyles>[]
|
|
989
991
|
: never,
|
|
990
992
|
): {
|
|
991
|
-
readonly
|
|
992
|
-
|
|
993
|
+
readonly [uniqueSymbol]: Primitive extends (<
|
|
994
|
+
T extends ElementType<any> = 'div',
|
|
995
|
+
>(
|
|
993
996
|
props: BoxProps<T>,
|
|
994
997
|
) => ReactElement<any, JSXElementConstructor<any> | string> | null) &
|
|
995
998
|
FC<BoxProps<'div'>>
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -273,8 +273,7 @@ const boxTag: unique symbol;
|
|
|
273
273
|
|
|
274
274
|
// @public (undocumented)
|
|
275
275
|
type BoxXCSS = {
|
|
276
|
-
readonly
|
|
277
|
-
readonly styles: BoxStyles;
|
|
276
|
+
readonly [uniqueSymbol]: BoxStyles;
|
|
278
277
|
};
|
|
279
278
|
|
|
280
279
|
// @public (undocumented)
|
|
@@ -635,6 +634,9 @@ type TokenisedProps = {
|
|
|
635
634
|
minHeight?: MinHeight;
|
|
636
635
|
minInlineSize?: MinInlineSize;
|
|
637
636
|
minWidth?: MinWidth;
|
|
637
|
+
outlineColor?: BorderColor;
|
|
638
|
+
outlineOffset?: Padding;
|
|
639
|
+
outlineWidth?: BorderWidth;
|
|
638
640
|
overflow?: Overflow;
|
|
639
641
|
overflowBlock?: OverflowBlock;
|
|
640
642
|
overflowInline?: OverflowInline;
|
|
@@ -662,10 +664,9 @@ const uniqueSymbol: unique symbol;
|
|
|
662
664
|
// @public (undocumented)
|
|
663
665
|
type Width = keyof typeof dimensionMap;
|
|
664
666
|
|
|
665
|
-
// @public
|
|
667
|
+
// @public
|
|
666
668
|
export function xcss<Primitive extends typeof Box | typeof Inline = typeof Box>(style: Primitive extends typeof Box ? ScopedSafeCSSObject<AllowedBoxStyles> | ScopedSafeCSSObject<AllowedBoxStyles>[] : Primitive extends typeof Inline ? ScopedSafeCSSObject<AllowedInlineStyles> | ScopedSafeCSSObject<AllowedInlineStyles>[] : never): {
|
|
667
|
-
readonly
|
|
668
|
-
readonly styles: Primitive extends (<T extends ElementType<any> = "div">(props: BoxProps<T>) => ReactElement<any, JSXElementConstructor<any>| string> | null) & FC<BoxProps<"div">> ? BoxStyles : Primitive extends MemoExoticComponent<ForwardRefExoticComponent<Pick<InlineProps<ElementType<any>>, "alignBlock" | "alignInline" | "as" | "children" | "grow" | "rowSpace" | "separator" | "shouldWrap" | "space" | "spread" | "testId"> & RefAttributes<any>>> ? InlineStyles : never;
|
|
669
|
+
readonly [uniqueSymbol]: Primitive extends (<T extends ElementType<any> = "div">(props: BoxProps<T>) => ReactElement<any, JSXElementConstructor<any>| string> | null) & FC<BoxProps<"div">> ? BoxStyles : Primitive extends MemoExoticComponent<ForwardRefExoticComponent<Pick<InlineProps<ElementType<any>>, "alignBlock" | "alignInline" | "as" | "children" | "grow" | "rowSpace" | "separator" | "shouldWrap" | "space" | "spread" | "testId"> & RefAttributes<any>>> ? InlineStyles : never;
|
|
669
670
|
};
|
|
670
671
|
|
|
671
672
|
// (No @packageDocumentation comment for this package)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function Inline(_) {}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function Inline(_) {}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function Inline(_) {}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function Inline(_) {}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|