@atlaskit/primitives 1.0.8 → 1.0.9
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 +9 -3
- package/README.md +1 -1
- package/constellation/box/code.mdx +1 -1
- package/constellation/box/examples.mdx +11 -10
- package/constellation/box/usage.mdx +6 -8
- package/constellation/inline/usage.mdx +1 -1
- package/constellation/responsive/03-breakpoints/examples.mdx +0 -30
- package/constellation/stack/usage.mdx +1 -1
- package/constellation/xcss/examples.mdx +3 -3
- package/constellation/xcss/migration.mdx +2 -2
- package/constellation/xcss/usage.mdx +7 -7
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/version.json +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/primitives
|
|
2
2
|
|
|
3
|
+
## 1.0.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`1859bc0b8c7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1859bc0b8c7) - Update the casing on `xcss` to ensure consistency with the API and package consumption.
|
|
8
|
+
|
|
3
9
|
## 1.0.8
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -96,7 +102,7 @@
|
|
|
96
102
|
|
|
97
103
|
### Patch Changes
|
|
98
104
|
|
|
99
|
-
- [`4c026f170d6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4c026f170d6) - Remove warnings for non-token values passed to
|
|
105
|
+
- [`4c026f170d6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4c026f170d6) - Remove warnings for non-token values passed to xcss in non-development environments.
|
|
100
106
|
|
|
101
107
|
## 0.14.2
|
|
102
108
|
|
|
@@ -173,7 +179,7 @@
|
|
|
173
179
|
|
|
174
180
|
### Minor Changes
|
|
175
181
|
|
|
176
|
-
- [`8bd6dc6027f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8bd6dc6027f) - Box backgroundColor prop now accepts full token names, abbreviated forms will no longer work.
|
|
182
|
+
- [`8bd6dc6027f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8bd6dc6027f) - Box backgroundColor prop now accepts full token names, abbreviated forms will no longer work. xcss now accepts full token names, abbreviated forms will no longer work.
|
|
177
183
|
|
|
178
184
|
## 0.10.1
|
|
179
185
|
|
|
@@ -186,7 +192,7 @@
|
|
|
186
192
|
|
|
187
193
|
### Minor Changes
|
|
188
194
|
|
|
189
|
-
- [`313d71fce9c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/313d71fce9c) - Allow media queries at predefined breakpoints to be applied through
|
|
195
|
+
- [`313d71fce9c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/313d71fce9c) - Allow media queries at predefined breakpoints to be applied through xcss.
|
|
190
196
|
|
|
191
197
|
## 0.9.5
|
|
192
198
|
|
package/README.md
CHANGED
|
@@ -10,4 +10,4 @@ Detailed docs and example usage can be found at:
|
|
|
10
10
|
- [Box](https://staging.atlassian.design/components/primitives/box)
|
|
11
11
|
- [Inline](https://staging.atlassian.design/components/primitives/inline)
|
|
12
12
|
- [Stack](https://staging.atlassian.design/components/primitives/stack)
|
|
13
|
-
- [
|
|
13
|
+
- [xcss](https://staging.atlassian.design/components/primitives/xcss)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Box
|
|
3
|
-
description:
|
|
3
|
+
description: A box is a primitive component that acts as a generic container, and provides managed access to design tokens.
|
|
4
4
|
order: 1
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Box
|
|
3
|
-
description:
|
|
3
|
+
description: A box is a primitive component that acts as a generic container, and provides managed access to design tokens.
|
|
4
4
|
order: 0
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -20,32 +20,33 @@ import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
|
20
20
|
|
|
21
21
|
## Basic
|
|
22
22
|
|
|
23
|
-
Box is a general-purpose container
|
|
23
|
+
Box is a general-purpose container that allows for controlled use of design tokens. Use the given props to configure display behaviour and styling that aligns with the Atlassian Design System.
|
|
24
|
+
[To learn more about styling primitive components visit our xcss documentation.](/components/primitives/xcss/usage)
|
|
24
25
|
|
|
25
26
|
<Example Component={BoxBasic} packageName="@atlaskit/primitives/box" />
|
|
26
27
|
|
|
27
28
|
## Padding
|
|
28
29
|
|
|
29
|
-
Padding props can be used to access spacing design
|
|
30
|
+
Padding props can be used to access spacing design tokens and control internal layout. The following example demonstrates how each prop works with space tokens.
|
|
30
31
|
|
|
31
32
|
<Example Component={BoxPadding} packageName="@atlaskit/primitives/box" />
|
|
32
33
|
|
|
33
|
-
|
|
34
|
+
The nomenclature used by these props follows [logical properties](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties). This naming is used to support different [writing modes](https://developer.mozilla.org/en-US/docs/Web/CSS/writing-mode) in our products.
|
|
34
35
|
|
|
35
36
|
## Background color
|
|
36
37
|
|
|
37
|
-
`Box` accepts a wide variety of background colors, referenced as semantic design tokens.
|
|
38
|
+
`Box` accepts a wide variety of background colors, referenced as semantic design tokens. For the full list of color tokens or to learn more, visit our [Token documentation](/tokens/design-tokens/).
|
|
38
39
|
|
|
39
40
|
<Example Component={BoxBackgroundColor} packageName="@atlaskit/primitives/box" />
|
|
40
41
|
|
|
41
|
-
##
|
|
42
|
+
## xcss
|
|
42
43
|
|
|
43
|
-
Box
|
|
44
|
+
Box exposes an `xcss` prop. This prop accepts `xcss` function calls that contain a subset of permitted styles. When used with `Box`, xcss accepts most CSS properties, and when a token exists, the rule accepts that token as a value.
|
|
45
|
+
For more information on xcss, see the dedicated [xcss documentation](/components/primitives/xcss).
|
|
44
46
|
|
|
45
47
|
<Example Component={BoxXcss} packageName="@atlaskit/primitives/box" />
|
|
46
48
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
## Practical Use Case
|
|
49
|
+
## Practical use case
|
|
50
50
|
|
|
51
|
+
`Box` is designed to be used in conjunction with `Inline` and `Stack` to create layouts. This example demonstrates how primitives can be used to create familiar components and patterns.
|
|
51
52
|
<Example Component={PracticalUseCase} packageName="@atlaskit/primitives/box" />
|
|
@@ -4,12 +4,10 @@ description: A box is a primitive component that acts as a generic container, an
|
|
|
4
4
|
order: 2
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
A `Box` is a generic container with convenient and managed access to design tokens, and built-in guidance for the best practices of the Atlassian Design System.
|
|
8
|
+
Use a `Box` to compose layouts and add styling to child elements through visual props, including spacing and color through design tokens.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
## Use `Box`
|
|
10
|
+
## `Box` styling
|
|
13
11
|
Display behavior is set by using the available props or using `xcss`. Makers can make design decisions for `Box` by setting:
|
|
14
12
|
|
|
15
13
|
- `padding`
|
|
@@ -21,10 +19,10 @@ Display behavior is set by using the available props or using `xcss`. Makers can
|
|
|
21
19
|
- `paddingBlockEnd`
|
|
22
20
|
- `backgroundColor`
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
## Using `Box`
|
|
23
|
+
To identify usages of `Box` in a given design, look for where a UI element will receive some visual styles applied to a container. `Box` can be used on a range of sizes of elements, from buttons to section wrappers.
|
|
26
24
|
`Box`, being generic in nature, can be "over-used", so it’s important to consider situations where more specific and expressive primitives could be used, for example: `Inline` and `Stack` to manage horizontal and vertical layouts, respectively.
|
|
27
25
|
|
|
28
|
-
Related
|
|
26
|
+
## Related
|
|
29
27
|
- [Learn more about the Inline primitive](/components/primitives/inline/usage)
|
|
30
28
|
- [Learn more about the Stack primitive](/components/primitives/stack/usage)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Inline
|
|
3
|
-
description:
|
|
3
|
+
description: Inline is a primitive component based on flexbox that manages the horizontal layout of direct children.
|
|
4
4
|
order: 2
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -19,33 +19,3 @@ Media queries can be applied through the `media` object.
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
<MediaQueriesTable />
|
|
22
|
-
|
|
23
|
-
When used with `xcss`, be aware that a media query can't contain another media query to prevent arbitrary nesting. Additionally, pseudo-selectors can't contain media queries. To use media queries and pseudos, the media query must contain the pseudo.
|
|
24
|
-
|
|
25
|
-
```
|
|
26
|
-
import { xcss } from '@atlaskit/primitives';
|
|
27
|
-
import { media } from '@atlaskit/primitives/responsive';
|
|
28
|
-
|
|
29
|
-
const someStyles = xcss({
|
|
30
|
-
// This is okay, since media queries can contain pseudos
|
|
31
|
-
[media.above.md]: {
|
|
32
|
-
':hover': {
|
|
33
|
-
backgroundColor: 'color.background.primary.hovered'
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
// This is not okay, since pseudos can't contain media queries
|
|
38
|
-
':hover': {
|
|
39
|
-
[media.above.md]: {
|
|
40
|
-
backgroundColor: 'color.background.primary.hovered'
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
// This is not okay, since media queries can't contain media queries
|
|
45
|
-
[media.above.md]: {
|
|
46
|
-
[media.above.xs]: {
|
|
47
|
-
backgroundColor: 'color.background.primary.hovered'
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Stack
|
|
3
|
-
description:
|
|
3
|
+
description: Stack is a primitive component based on flexbox that manages the vertical layout of direct children.
|
|
4
4
|
order: 2
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
3
|
-
description:
|
|
2
|
+
title: xcss
|
|
3
|
+
description: xcss is a safer, tokens-first approach to CSS-in-JS.
|
|
4
4
|
order: 1
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -31,6 +31,6 @@ To enable interactivity, use familiar selectors like `:hover` and `:focus-visibl
|
|
|
31
31
|
|
|
32
32
|
## Responsiveness
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
xcss also accepts a subset of media queries at predefined breakpoints:
|
|
35
35
|
|
|
36
36
|
<Example Component={xcssResponsive} packageName="@atlaskit/primitives/xcss" />
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
3
|
-
description:
|
|
2
|
+
title: xcss
|
|
3
|
+
description: xcss is a safer, tokens-first approach to CSS-in-JS.
|
|
4
4
|
order: 0
|
|
5
5
|
---
|
|
6
6
|
import { MediaQueriesTable } from '@af/design-system-docs-ui';
|
|
@@ -55,7 +55,7 @@ Note: styles generated from `xcss` cannot be applied directly to the `className`
|
|
|
55
55
|
|
|
56
56
|
### Type safety
|
|
57
57
|
|
|
58
|
-
`xcss` uses strongly-typed values generated from design token definitions, making it simpler to apply the right token to the right CSS property.
|
|
58
|
+
`xcss` uses strongly-typed values generated from design token definitions, making it simpler to apply the right token to the right CSS property.
|
|
59
59
|
This is intended to be more ergonomic and intuitive, but also prevent the misapplication of tokens to the wrong properties.
|
|
60
60
|
|
|
61
61
|
Any [valid token name](/components/tokens/all-tokens) is available to be applied against its
|
|
@@ -74,7 +74,7 @@ const someStyles = xcss({
|
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
### Restricted nesting
|
|
77
|
-
`xcss` is flexible enough to implement any design, but it does restrict the application of styles in one key way.
|
|
77
|
+
`xcss` is flexible enough to implement any design, but it does restrict the application of styles in one key way.
|
|
78
78
|
Selectors cannot be nested or target elements beyond the element on which styles are applied.
|
|
79
79
|
This restriction is intended to encourage better component encapsulation, reduce side-effects and make the codebase more resilient to change.
|
|
80
80
|
|
|
@@ -108,14 +108,14 @@ These unsafe selectors will throw a type error if applied.
|
|
|
108
108
|
For richer examples of how to use `xcss` please see the [primitives `xcss` documentation](/components/primitives/xcss/examples).
|
|
109
109
|
|
|
110
110
|
### Media Queries
|
|
111
|
-
|
|
111
|
+
xcss can create responsive layouts at predefined breakpoints that are consistent with the Atlassian Design System. To enable responsive behavior, xcss exposes the following pre-defined breakpoints:
|
|
112
112
|
<MediaQueriesTable />
|
|
113
113
|
|
|
114
114
|
Media queries can be applied through keys that can be imported from `@atlaskit/primitives/responsive`.
|
|
115
115
|
For in depth examples on how to enable responsive behavior, please see our [primitive responsiveness documentation](/components/primitives/xcss/examples#responsiveness).
|
|
116
116
|
|
|
117
|
-
The objects defined at each breakpoint behave in much the same way as a normal
|
|
118
|
-
The only limitation is that a media query can't contain another media query. This is to prevent arbitrary nesting.
|
|
117
|
+
The objects defined at each breakpoint behave in much the same way as a normal xcss object, and can apply responsiveness to any CSS.
|
|
118
|
+
The only limitation is that a media query can't contain another media query. This is to prevent arbitrary nesting.
|
|
119
119
|
Additionally, pseudo-selectors can't contain media queries. To use media queries and pseudos, the media query must contain the pseudo.
|
|
120
120
|
|
|
121
121
|
```
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/version.json
CHANGED
package/dist/esm/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/primitives",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "Primitives are token-backed low-level building blocks.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
|
-
"title": "
|
|
92
|
+
"title": "xcss",
|
|
93
93
|
"folder": "xcss",
|
|
94
94
|
"slug": "primitives/xcss",
|
|
95
95
|
"id": "@atlaskit/primitives/xcss",
|