@atlaskit/primitives 0.9.1 → 0.9.2
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/README.md +6 -2
- package/box/package.json +2 -2
- package/constellation/box/code.mdx +6 -2
- package/constellation/box/usage.mdx +30 -0
- package/constellation/inline/usage.mdx +36 -0
- package/constellation/overview/images/box-usage-example.png +0 -0
- package/constellation/overview/images/inline-usage-example.png +0 -0
- package/constellation/overview/images/stack-usage-example.png +0 -0
- package/constellation/overview/index.mdx +66 -0
- package/constellation/stack/usage.mdx +31 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/xcss/style-maps.partial.js +13 -43
- package/dist/cjs/xcss/xcss.js +19 -19
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/xcss/style-maps.partial.js +12 -40
- package/dist/es2019/xcss/xcss.js +20 -20
- package/dist/esm/version.json +1 -1
- package/dist/esm/xcss/style-maps.partial.js +12 -40
- package/dist/esm/xcss/xcss.js +20 -20
- package/dist/types/components/box.d.ts +2 -2
- package/dist/types/components/inline.d.ts +7 -7
- package/dist/types/components/internal/base-box.d.ts +15 -14
- package/dist/types/components/stack.d.ts +6 -6
- package/dist/types/components/types.d.ts +2 -2
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/helpers/responsive/types.d.ts +4 -4
- package/dist/types/xcss/style-maps.partial.d.ts +79 -131
- package/dist/types/xcss/xcss.d.ts +11 -11
- package/extract-react-types/box-props.tsx +95 -0
- package/extract-react-types/inline-props.tsx +86 -1
- package/extract-react-types/stack-props.tsx +70 -1
- package/inline/package.json +2 -2
- package/package.json +18 -10
- package/report.api.md +87 -350
- package/responsive/package.json +2 -2
- package/scripts/codegen-file-templates/dimensions.tsx +17 -16
- package/scripts/codegen-styles.tsx +2 -2
- package/scripts/spacing-codegen-template.tsx +24 -91
- package/stack/package.json +2 -2
- package/tmp/api-report-tmp.d.ts +74 -99
- package/constellation/overview/examples.mdx +0 -7
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -4,6 +4,10 @@ Primitives are token-backed low-level building blocks.
|
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Detailed docs and example usage can be found at:
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
- [Overview](https://staging.atlassian.design/components/primitives/overview)
|
|
10
|
+
- [Box](https://staging.atlassian.design/components/primitives/box)
|
|
11
|
+
- [Inline](https://staging.atlassian.design/components/primitives/inline)
|
|
12
|
+
- [Stack](https://staging.atlassian.design/components/primitives/stack)
|
|
13
|
+
- [xCSS](https://staging.atlassian.design/components/primitives/xcss)
|
package/box/package.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Box
|
|
3
|
-
description:
|
|
3
|
+
description: Box is a primitive component that leverages the foundations of the Atlassian Design System.
|
|
4
4
|
order: 1
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
import BoxProps from '!!extract-react-types-loader!../../extract-react-types/box-props'
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
<PropsTable heading="" props={BoxProps} />
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Box
|
|
3
|
+
description: A box is a primitive component that acts as a generic container, and provides managed access to design tokens.
|
|
4
|
+
order: 2
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Use box to compose layouts with the valid spacing and background colors. 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
|
+
|
|
9
|
+
A `Box` is primarily a containment element, with visual props that affect the whitespace available to child elements.
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## Use `Box`
|
|
13
|
+
Display behavior is set by using the available props or using `xcss`. Makers can make design decisions for `Box` by setting:
|
|
14
|
+
|
|
15
|
+
- `padding`
|
|
16
|
+
- `paddingInline`
|
|
17
|
+
- `paddingInlineStart`
|
|
18
|
+
- `paddingInlineEnd`
|
|
19
|
+
- `paddingBlock`
|
|
20
|
+
- `paddingBlockStart`
|
|
21
|
+
- `paddingBlockEnd`
|
|
22
|
+
- `backgroundColor`
|
|
23
|
+
|
|
24
|
+
To identify usages of `Box` in a given design, look for where a UI element (could be as small as the parent of a button or as a big as the wrapper of an entire section) will receive some visual styles applied to a container.
|
|
25
|
+
|
|
26
|
+
`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
|
+
|
|
28
|
+
Related
|
|
29
|
+
- [Learn more about the Inline primitive](/components/primitives/inline/usage)
|
|
30
|
+
- [Learn more about the Stack primitive](/components/primitives/stack/usage)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Inline
|
|
3
|
+
description: An Inline is a primitive component that is responsible for the horizontal layout of its child elements.
|
|
4
|
+
order: 2
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Primitive components are designed to act as building blocks for composing a user experience. An Inline primitive should be used when you want to layout UI elements horizontally, and make use of the built-in design guidance from the Atlassian Design System.
|
|
8
|
+
|
|
9
|
+
Inline primitives work as you might expect, aligning content horizontally across a page or layout, as a container that decides the horizontal layout of its children. Inline components also decide the specifics of how the children are displayed, for example, where they are aligned or how much space is between child elements. Inline should be used purely for visual alignment, and should have no opinions about the functionality of its children.
|
|
10
|
+
|
|
11
|
+
In its simplest form, `Inline` operates like a flexbox row, however adds the built in design token support and guidance.
|
|
12
|
+
|
|
13
|
+
```jsx
|
|
14
|
+
<Inline space="space.100" alignInline="center" alignBlock="start">
|
|
15
|
+
...
|
|
16
|
+
</Inline>
|
|
17
|
+
```
|
|
18
|
+
It also has a flex-direction: row; but that’s the default, so not explicitly applied.
|
|
19
|
+
|
|
20
|
+
## Use `Inline`
|
|
21
|
+
The purpose of an Inline is primarily as a container element controlling how child components are displayed and positioned horizontally. Inline should be used any time you wish to layout elements or components horizontally.
|
|
22
|
+
|
|
23
|
+
The various Inline props can then be used to customize the spacing and styling on any child elements. These include:
|
|
24
|
+
|
|
25
|
+
- `alignBlock`
|
|
26
|
+
- `alignInline`
|
|
27
|
+
- `shouldWrap`
|
|
28
|
+
- `spread`
|
|
29
|
+
- `grow`
|
|
30
|
+
- `space`
|
|
31
|
+
- `rowSpace`
|
|
32
|
+
- `separator`
|
|
33
|
+
|
|
34
|
+
## Related
|
|
35
|
+
- [Learn more about the Box primitive](/components/primitives/box/usage)
|
|
36
|
+
- [Learn more about the Stack primitive](/components/primitives/stack/usage)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Primitives
|
|
3
|
+
description: Primitives are composable components that solve common layout problems.
|
|
4
|
+
|
|
5
|
+
order: 1
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
import SectionMessage from '@atlaskit/section-message';
|
|
9
|
+
import Image from '@atlaskit/image';
|
|
10
|
+
|
|
11
|
+
import boxUsageExample from './images/box-usage-example.png';
|
|
12
|
+
import inlineUsageExample from './images/inline-usage-example.png';
|
|
13
|
+
import stackUsageExample from './images/stack-usage-example.png';
|
|
14
|
+
|
|
15
|
+
<SectionMessage title="This is a preview of our new primitive components." appearance="warning">
|
|
16
|
+
Expect frequent changes as we iterate over the coming months. For early access and release updates for Atlassian employees, see details.
|
|
17
|
+
</SectionMessage>
|
|
18
|
+
|
|
19
|
+
Primitive components are a new type of component for layouts and placement of elements. They act as building blocks to compose different parts of the user experience, from the smallest design decisions (for example, the spacing around an icon) to larger layout decisions (for example, how a page is structured).
|
|
20
|
+
|
|
21
|
+
Primitives are designed to work hand in hand with design tokens, to provide opinionated solutions for common low-level design decisions that engineers often have to make. They are designed to reduce cognitive overhead for engineers by providing guardrails around what is recommended within our design system.
|
|
22
|
+
|
|
23
|
+
A primitive component is a pre-built solution in that they will only accept values that are valid in the Atlassian Design System, and help to implement common layout patterns. This reduces the need to look up documentation and write custom CSS.
|
|
24
|
+
|
|
25
|
+
## Available Primitives
|
|
26
|
+
|
|
27
|
+
Each primitive is designed to have a single responsibility, and it should be immediately clear where each primitive should be used. However, they are also flexible enough that they should be able to be used to compose complex designs not otherwise covered in the Design Systems.
|
|
28
|
+
|
|
29
|
+
Currently, three primitive components are available for use in Closed Beta they are Box, Inline and Stack. These were chosen because a large amount of layout problems can be reduced to laying out content:
|
|
30
|
+
- in a container (see [box](/components/primitives/box))
|
|
31
|
+
- horizontally (see [inline](/components/primitives/inline))
|
|
32
|
+
- vertically (see [stack](/components/primitives/stack))
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
To install primitive components, add @atlaskit/primitives as a dependency on your project:
|
|
37
|
+
```bash
|
|
38
|
+
$ yarn add @atlaskit/primitives
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Using Primitives
|
|
42
|
+
|
|
43
|
+
Use primitives for general layout styles for components. Primitives are not currently available in Figma, so the first step in implementing primitive components is identifying where they might fit in a given design. This involves breaking down a design into its core layout components to as granular level as is useful.
|
|
44
|
+
|
|
45
|
+
<SectionMessage appearance="warning">
|
|
46
|
+
Primitives could be skipped where absolute DOM control is required or very specific styling values are needed, however, this approach is more likely to produce visual elements that fail to adhere to the guidelines of the Atlassian Design System.
|
|
47
|
+
</SectionMessage>
|
|
48
|
+
|
|
49
|
+
You might like to think first about breaking down a page into Box containers, identifying larger pieces of a design that function in a similar manner or fulfill a singular purpose in a layout and grouping them together under a Box.
|
|
50
|
+
|
|
51
|
+
<Image src={boxUsageExample} />
|
|
52
|
+
|
|
53
|
+
The behavior within and around these boxes can then be broken down into their horizontal Inline and vertical Stack components.
|
|
54
|
+
|
|
55
|
+
<SectionMessage>
|
|
56
|
+
The ESLint rule use-primitives offers suggestions for possible primitives in a layout.
|
|
57
|
+
</SectionMessage>
|
|
58
|
+
|
|
59
|
+
<Image src={inlineUsageExample} />
|
|
60
|
+
<Image src={stackUsageExample} />
|
|
61
|
+
|
|
62
|
+
## Related
|
|
63
|
+
|
|
64
|
+
- [Learn more about the Box primitive](/components/primitives/box/usage)
|
|
65
|
+
- [Learn more about the Inline primitive](/components/primitives/inline/usage)
|
|
66
|
+
- [Learn more about the Stack primitive](/components/primitives/stack/usage)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Stack
|
|
3
|
+
description: A Stack is a primitive component that is responsible for the vertical layout of its child elements.
|
|
4
|
+
order: 2
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Primitive components are designed to act as building blocks for composing a user experience. A `Stack` primitive should be used when you want to layout UI elements vertically, and make use of the built-in design guidance from the Atlassian Design System.
|
|
8
|
+
|
|
9
|
+
`Stack` primitives work by aligning content vertically on a page or layout, as a container that decides the vertical layout of its children. `Stack` components also decide the specifics of how the children are displayed, for example, where they are aligned or how much space is between child elements. `Stack` should be used purely for visual alignment, and should have no opinions about the functionality of its children.
|
|
10
|
+
|
|
11
|
+
In its simplest form, `Stack` operates like a flexbox column, however adds the built in design token support and guidance.
|
|
12
|
+
|
|
13
|
+
```jsx
|
|
14
|
+
<Stack space="space.100" alignInline="center" alignBlock="start">
|
|
15
|
+
...
|
|
16
|
+
</Stack>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Use `Stack`
|
|
20
|
+
The purpose of a `Stack` is primarily as a container element controlling how content is displayed and aligned vertically. `Stack` should be used any time you wish to layout elements or components vertically.
|
|
21
|
+
|
|
22
|
+
The various `Stack` props can then be used to customize the spacing and styling on any child elements. These include:
|
|
23
|
+
- `alignBlock`
|
|
24
|
+
- `alignInline`
|
|
25
|
+
- `spread`
|
|
26
|
+
- `grow`
|
|
27
|
+
- `space`
|
|
28
|
+
|
|
29
|
+
## Related
|
|
30
|
+
- [Learn more about the Box primitive](/primitives/box/usage)
|
|
31
|
+
- [Learn more about the Stack primitive](/primitives/box/usage)
|
package/dist/cjs/version.json
CHANGED
|
@@ -4,16 +4,16 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.textColorMap = exports.spaceStylesMap = exports.spaceMap = exports.shadowMap = exports.positionMap = exports.paddingStylesMap = exports.
|
|
7
|
+
exports.textColorMap = exports.spaceStylesMap = exports.spaceMap = exports.shadowMap = exports.positionMap = exports.paddingStylesMap = exports.overflowMap = exports.overflowInlineMap = exports.overflowBlockMap = exports.layerMap = exports.flexShrinkMap = exports.flexMap = exports.flexGrowMap = exports.flexDirectionMap = exports.displayMap = exports.dimensionMap = exports.borderWidthMap = exports.borderStyleMap = exports.borderRadiusMap = exports.borderColorMap = exports.backgroundColorStylesMap = exports.backgroundColorMap = exports.alignSelfMap = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
10
|
/**
|
|
11
11
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
12
|
-
* @codegen <<SignedSource::
|
|
12
|
+
* @codegen <<SignedSource::7d4a8604dc454e30c0fec5c1330ea7c5>>
|
|
13
13
|
* @codegenId dimensions
|
|
14
14
|
* @codegenCommand yarn codegen-styles
|
|
15
15
|
* @codegenParams ["dimensions"]
|
|
16
|
-
* @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::
|
|
16
|
+
* @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::dbad5eb9ef292d4ec59f90459a81e1d6>>
|
|
17
17
|
*/
|
|
18
18
|
var dimensionMap = {
|
|
19
19
|
'100%': '100%',
|
|
@@ -32,29 +32,11 @@ exports.dimensionMap = dimensionMap;
|
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
35
|
-
* @codegen <<SignedSource::
|
|
35
|
+
* @codegen <<SignedSource::9fbc4dfcd8f43f52bff6b3bb666397fe>>
|
|
36
36
|
* @codegenId spacing
|
|
37
37
|
* @codegenCommand yarn codegen-styles
|
|
38
|
-
* @codegenParams ["padding", "space", "inset"]
|
|
39
38
|
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::167d3b69b159ae33e74d4ea5ab7eade6>>
|
|
40
39
|
*/
|
|
41
|
-
var paddingMap = {
|
|
42
|
-
'space.0': "var(--ds-space-0, 0px)",
|
|
43
|
-
'space.025': "var(--ds-space-025, 2px)",
|
|
44
|
-
'space.050': "var(--ds-space-050, 4px)",
|
|
45
|
-
'space.075': "var(--ds-space-075, 6px)",
|
|
46
|
-
'space.100': "var(--ds-space-100, 8px)",
|
|
47
|
-
'space.150': "var(--ds-space-150, 12px)",
|
|
48
|
-
'space.200': "var(--ds-space-200, 16px)",
|
|
49
|
-
'space.250': "var(--ds-space-250, 20px)",
|
|
50
|
-
'space.300': "var(--ds-space-300, 24px)",
|
|
51
|
-
'space.400': "var(--ds-space-400, 32px)",
|
|
52
|
-
'space.500': "var(--ds-space-500, 40px)",
|
|
53
|
-
'space.600': "var(--ds-space-600, 48px)",
|
|
54
|
-
'space.800': "var(--ds-space-800, 64px)",
|
|
55
|
-
'space.1000': "var(--ds-space-1000, 80px)"
|
|
56
|
-
};
|
|
57
|
-
exports.paddingMap = paddingMap;
|
|
58
40
|
var spaceMap = {
|
|
59
41
|
'space.0': "var(--ds-space-0, 0px)",
|
|
60
42
|
'space.025': "var(--ds-space-025, 2px)",
|
|
@@ -72,23 +54,6 @@ var spaceMap = {
|
|
|
72
54
|
'space.1000': "var(--ds-space-1000, 80px)"
|
|
73
55
|
};
|
|
74
56
|
exports.spaceMap = spaceMap;
|
|
75
|
-
var insetMap = {
|
|
76
|
-
'space.0': "var(--ds-space-0, 0px)",
|
|
77
|
-
'space.025': "var(--ds-space-025, 2px)",
|
|
78
|
-
'space.050': "var(--ds-space-050, 4px)",
|
|
79
|
-
'space.075': "var(--ds-space-075, 6px)",
|
|
80
|
-
'space.100': "var(--ds-space-100, 8px)",
|
|
81
|
-
'space.150': "var(--ds-space-150, 12px)",
|
|
82
|
-
'space.200': "var(--ds-space-200, 16px)",
|
|
83
|
-
'space.250': "var(--ds-space-250, 20px)",
|
|
84
|
-
'space.300': "var(--ds-space-300, 24px)",
|
|
85
|
-
'space.400': "var(--ds-space-400, 32px)",
|
|
86
|
-
'space.500': "var(--ds-space-500, 40px)",
|
|
87
|
-
'space.600': "var(--ds-space-600, 48px)",
|
|
88
|
-
'space.800': "var(--ds-space-800, 64px)",
|
|
89
|
-
'space.1000': "var(--ds-space-1000, 80px)"
|
|
90
|
-
};
|
|
91
|
-
exports.insetMap = insetMap;
|
|
92
57
|
/**
|
|
93
58
|
* @codegenEnd
|
|
94
59
|
*/
|
|
@@ -281,13 +246,13 @@ exports.textColorMap = textColorMap;
|
|
|
281
246
|
|
|
282
247
|
/**
|
|
283
248
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
284
|
-
* @codegen <<SignedSource::
|
|
249
|
+
* @codegen <<SignedSource::64f7b08cdbce710fba3157594ea695a8>>
|
|
285
250
|
* @codegenId misc
|
|
286
251
|
* @codegenCommand yarn codegen-styles
|
|
287
252
|
* @codegenParams ["align-self", "border-style", "display", "flex-direction", "flex-grow", "flex-shrink", "flex", "layer", "overflow", "position"]
|
|
288
253
|
* @codegenDependency ../../scripts/codegen-file-templates/align-self.tsx <<SignedSource::074079802534462de54bf882bb2073e5>>
|
|
289
254
|
* @codegenDependency ../../scripts/codegen-file-templates/border-style.tsx <<SignedSource::87e7e289ffeaac901997c4af98084a5f>>
|
|
290
|
-
* @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::
|
|
255
|
+
* @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::dbad5eb9ef292d4ec59f90459a81e1d6>>
|
|
291
256
|
* @codegenDependency ../../scripts/codegen-file-templates/display.tsx <<SignedSource::04ea30fcb3c02f2545af7fdc0206e645>>
|
|
292
257
|
* @codegenDependency ../../scripts/codegen-file-templates/flex-direction.tsx <<SignedSource::19809ba11675679c188b0d98fb651dc1>>
|
|
293
258
|
* @codegenDependency ../../scripts/codegen-file-templates/flex-grow.tsx <<SignedSource::b8a06b122cb609170f1f42778a6c270e>>
|
|
@@ -402,7 +367,12 @@ var borderRadiusMap = {
|
|
|
402
367
|
* @codegenEnd
|
|
403
368
|
*/
|
|
404
369
|
exports.borderRadiusMap = borderRadiusMap;
|
|
405
|
-
|
|
370
|
+
// Generate maps for Box props. backgroundColor, padding, etc
|
|
371
|
+
var spacingProperties = [
|
|
372
|
+
// Used by Box
|
|
373
|
+
'padding', 'paddingBlock', 'paddingBlockStart', 'paddingBlockEnd', 'paddingInline', 'paddingInlineStart', 'paddingInlineEnd',
|
|
374
|
+
// Used by Inline and Stack
|
|
375
|
+
'gap', 'rowGap', 'columnGap'];
|
|
406
376
|
var getSerializedStylesMap = function getSerializedStylesMap(cssProperty, tokenMap) {
|
|
407
377
|
return Object.keys(tokenMap).reduce(function (emotionSpacingMap, token) {
|
|
408
378
|
emotionSpacingMap[token] = (0, _react.css)((0, _defineProperty2.default)({}, cssProperty, tokenMap[token]));
|
|
@@ -410,7 +380,7 @@ var getSerializedStylesMap = function getSerializedStylesMap(cssProperty, tokenM
|
|
|
410
380
|
}, {});
|
|
411
381
|
};
|
|
412
382
|
var paddingStylesMap = spacingProperties.reduce(function (styleMap, spacingProperty) {
|
|
413
|
-
styleMap[spacingProperty] = getSerializedStylesMap(spacingProperty,
|
|
383
|
+
styleMap[spacingProperty] = getSerializedStylesMap(spacingProperty, spaceMap);
|
|
414
384
|
return styleMap;
|
|
415
385
|
}, {});
|
|
416
386
|
exports.paddingStylesMap = paddingStylesMap;
|
package/dist/cjs/xcss/xcss.js
CHANGED
|
@@ -34,13 +34,13 @@ var tokensMap = {
|
|
|
34
34
|
gap: _styleMaps.spaceMap,
|
|
35
35
|
height: _styleMaps.dimensionMap,
|
|
36
36
|
inlineSize: _styleMaps.dimensionMap,
|
|
37
|
-
inset: _styleMaps.
|
|
38
|
-
insetBlock: _styleMaps.
|
|
39
|
-
insetBlockEnd: _styleMaps.
|
|
40
|
-
insetBlockStart: _styleMaps.
|
|
41
|
-
insetInline: _styleMaps.
|
|
42
|
-
insetInlineEnd: _styleMaps.
|
|
43
|
-
insetInlineStart: _styleMaps.
|
|
37
|
+
inset: _styleMaps.spaceMap,
|
|
38
|
+
insetBlock: _styleMaps.spaceMap,
|
|
39
|
+
insetBlockEnd: _styleMaps.spaceMap,
|
|
40
|
+
insetBlockStart: _styleMaps.spaceMap,
|
|
41
|
+
insetInline: _styleMaps.spaceMap,
|
|
42
|
+
insetInlineEnd: _styleMaps.spaceMap,
|
|
43
|
+
insetInlineStart: _styleMaps.spaceMap,
|
|
44
44
|
left: _styleMaps.dimensionMap,
|
|
45
45
|
maxBlockSize: _styleMaps.dimensionMap,
|
|
46
46
|
maxHeight: _styleMaps.dimensionMap,
|
|
@@ -50,23 +50,23 @@ var tokensMap = {
|
|
|
50
50
|
minHeight: _styleMaps.dimensionMap,
|
|
51
51
|
minInlineSize: _styleMaps.dimensionMap,
|
|
52
52
|
minWidth: _styleMaps.dimensionMap,
|
|
53
|
-
outlineOffset: _styleMaps.
|
|
53
|
+
outlineOffset: _styleMaps.spaceMap,
|
|
54
54
|
outlineWidth: _styleMaps.borderWidthMap,
|
|
55
55
|
outlineColor: _styleMaps.borderColorMap,
|
|
56
56
|
overflow: _styleMaps.overflowMap,
|
|
57
57
|
overflowBlock: _styleMaps.overflowBlockMap,
|
|
58
58
|
overflowInline: _styleMaps.overflowInlineMap,
|
|
59
|
-
padding: _styleMaps.
|
|
60
|
-
paddingBlock: _styleMaps.
|
|
61
|
-
paddingBlockEnd: _styleMaps.
|
|
62
|
-
paddingBlockStart: _styleMaps.
|
|
63
|
-
paddingBottom: _styleMaps.
|
|
64
|
-
paddingInline: _styleMaps.
|
|
65
|
-
paddingInlineEnd: _styleMaps.
|
|
66
|
-
paddingInlineStart: _styleMaps.
|
|
67
|
-
paddingLeft: _styleMaps.
|
|
68
|
-
paddingRight: _styleMaps.
|
|
69
|
-
paddingTop: _styleMaps.
|
|
59
|
+
padding: _styleMaps.spaceMap,
|
|
60
|
+
paddingBlock: _styleMaps.spaceMap,
|
|
61
|
+
paddingBlockEnd: _styleMaps.spaceMap,
|
|
62
|
+
paddingBlockStart: _styleMaps.spaceMap,
|
|
63
|
+
paddingBottom: _styleMaps.spaceMap,
|
|
64
|
+
paddingInline: _styleMaps.spaceMap,
|
|
65
|
+
paddingInlineEnd: _styleMaps.spaceMap,
|
|
66
|
+
paddingInlineStart: _styleMaps.spaceMap,
|
|
67
|
+
paddingLeft: _styleMaps.spaceMap,
|
|
68
|
+
paddingRight: _styleMaps.spaceMap,
|
|
69
|
+
paddingTop: _styleMaps.spaceMap,
|
|
70
70
|
position: _styleMaps.positionMap,
|
|
71
71
|
right: _styleMaps.dimensionMap,
|
|
72
72
|
rowGap: _styleMaps.spaceMap,
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
2
|
/**
|
|
3
3
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
4
|
-
* @codegen <<SignedSource::
|
|
4
|
+
* @codegen <<SignedSource::7d4a8604dc454e30c0fec5c1330ea7c5>>
|
|
5
5
|
* @codegenId dimensions
|
|
6
6
|
* @codegenCommand yarn codegen-styles
|
|
7
7
|
* @codegenParams ["dimensions"]
|
|
8
|
-
* @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::
|
|
8
|
+
* @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::dbad5eb9ef292d4ec59f90459a81e1d6>>
|
|
9
9
|
*/
|
|
10
10
|
export const dimensionMap = {
|
|
11
11
|
'100%': '100%',
|
|
@@ -22,28 +22,11 @@ export const dimensionMap = {
|
|
|
22
22
|
*/
|
|
23
23
|
/**
|
|
24
24
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
25
|
-
* @codegen <<SignedSource::
|
|
25
|
+
* @codegen <<SignedSource::9fbc4dfcd8f43f52bff6b3bb666397fe>>
|
|
26
26
|
* @codegenId spacing
|
|
27
27
|
* @codegenCommand yarn codegen-styles
|
|
28
|
-
* @codegenParams ["padding", "space", "inset"]
|
|
29
28
|
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-spacing.tsx <<SignedSource::167d3b69b159ae33e74d4ea5ab7eade6>>
|
|
30
29
|
*/
|
|
31
|
-
export const paddingMap = {
|
|
32
|
-
'space.0': "var(--ds-space-0, 0px)",
|
|
33
|
-
'space.025': "var(--ds-space-025, 2px)",
|
|
34
|
-
'space.050': "var(--ds-space-050, 4px)",
|
|
35
|
-
'space.075': "var(--ds-space-075, 6px)",
|
|
36
|
-
'space.100': "var(--ds-space-100, 8px)",
|
|
37
|
-
'space.150': "var(--ds-space-150, 12px)",
|
|
38
|
-
'space.200': "var(--ds-space-200, 16px)",
|
|
39
|
-
'space.250': "var(--ds-space-250, 20px)",
|
|
40
|
-
'space.300': "var(--ds-space-300, 24px)",
|
|
41
|
-
'space.400': "var(--ds-space-400, 32px)",
|
|
42
|
-
'space.500': "var(--ds-space-500, 40px)",
|
|
43
|
-
'space.600': "var(--ds-space-600, 48px)",
|
|
44
|
-
'space.800': "var(--ds-space-800, 64px)",
|
|
45
|
-
'space.1000': "var(--ds-space-1000, 80px)"
|
|
46
|
-
};
|
|
47
30
|
export const spaceMap = {
|
|
48
31
|
'space.0': "var(--ds-space-0, 0px)",
|
|
49
32
|
'space.025': "var(--ds-space-025, 2px)",
|
|
@@ -60,22 +43,6 @@ export const spaceMap = {
|
|
|
60
43
|
'space.800': "var(--ds-space-800, 64px)",
|
|
61
44
|
'space.1000': "var(--ds-space-1000, 80px)"
|
|
62
45
|
};
|
|
63
|
-
export const insetMap = {
|
|
64
|
-
'space.0': "var(--ds-space-0, 0px)",
|
|
65
|
-
'space.025': "var(--ds-space-025, 2px)",
|
|
66
|
-
'space.050': "var(--ds-space-050, 4px)",
|
|
67
|
-
'space.075': "var(--ds-space-075, 6px)",
|
|
68
|
-
'space.100': "var(--ds-space-100, 8px)",
|
|
69
|
-
'space.150': "var(--ds-space-150, 12px)",
|
|
70
|
-
'space.200': "var(--ds-space-200, 16px)",
|
|
71
|
-
'space.250': "var(--ds-space-250, 20px)",
|
|
72
|
-
'space.300': "var(--ds-space-300, 24px)",
|
|
73
|
-
'space.400': "var(--ds-space-400, 32px)",
|
|
74
|
-
'space.500': "var(--ds-space-500, 40px)",
|
|
75
|
-
'space.600': "var(--ds-space-600, 48px)",
|
|
76
|
-
'space.800': "var(--ds-space-800, 64px)",
|
|
77
|
-
'space.1000': "var(--ds-space-1000, 80px)"
|
|
78
|
-
};
|
|
79
46
|
/**
|
|
80
47
|
* @codegenEnd
|
|
81
48
|
*/
|
|
@@ -262,13 +229,13 @@ export const textColorMap = {
|
|
|
262
229
|
*/
|
|
263
230
|
/**
|
|
264
231
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
265
|
-
* @codegen <<SignedSource::
|
|
232
|
+
* @codegen <<SignedSource::64f7b08cdbce710fba3157594ea695a8>>
|
|
266
233
|
* @codegenId misc
|
|
267
234
|
* @codegenCommand yarn codegen-styles
|
|
268
235
|
* @codegenParams ["align-self", "border-style", "display", "flex-direction", "flex-grow", "flex-shrink", "flex", "layer", "overflow", "position"]
|
|
269
236
|
* @codegenDependency ../../scripts/codegen-file-templates/align-self.tsx <<SignedSource::074079802534462de54bf882bb2073e5>>
|
|
270
237
|
* @codegenDependency ../../scripts/codegen-file-templates/border-style.tsx <<SignedSource::87e7e289ffeaac901997c4af98084a5f>>
|
|
271
|
-
* @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::
|
|
238
|
+
* @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::dbad5eb9ef292d4ec59f90459a81e1d6>>
|
|
272
239
|
* @codegenDependency ../../scripts/codegen-file-templates/display.tsx <<SignedSource::04ea30fcb3c02f2545af7fdc0206e645>>
|
|
273
240
|
* @codegenDependency ../../scripts/codegen-file-templates/flex-direction.tsx <<SignedSource::19809ba11675679c188b0d98fb651dc1>>
|
|
274
241
|
* @codegenDependency ../../scripts/codegen-file-templates/flex-grow.tsx <<SignedSource::b8a06b122cb609170f1f42778a6c270e>>
|
|
@@ -369,7 +336,12 @@ export const borderRadiusMap = {
|
|
|
369
336
|
* @codegenEnd
|
|
370
337
|
*/
|
|
371
338
|
|
|
372
|
-
|
|
339
|
+
// Generate maps for Box props. backgroundColor, padding, etc
|
|
340
|
+
const spacingProperties = [
|
|
341
|
+
// Used by Box
|
|
342
|
+
'padding', 'paddingBlock', 'paddingBlockStart', 'paddingBlockEnd', 'paddingInline', 'paddingInlineStart', 'paddingInlineEnd',
|
|
343
|
+
// Used by Inline and Stack
|
|
344
|
+
'gap', 'rowGap', 'columnGap'];
|
|
373
345
|
const getSerializedStylesMap = (cssProperty, tokenMap) => {
|
|
374
346
|
return Object.keys(tokenMap).reduce((emotionSpacingMap, token) => {
|
|
375
347
|
emotionSpacingMap[token] = css({
|
|
@@ -379,7 +351,7 @@ const getSerializedStylesMap = (cssProperty, tokenMap) => {
|
|
|
379
351
|
}, {});
|
|
380
352
|
};
|
|
381
353
|
export const paddingStylesMap = spacingProperties.reduce((styleMap, spacingProperty) => {
|
|
382
|
-
styleMap[spacingProperty] = getSerializedStylesMap(spacingProperty,
|
|
354
|
+
styleMap[spacingProperty] = getSerializedStylesMap(spacingProperty, spaceMap);
|
|
383
355
|
return styleMap;
|
|
384
356
|
}, {});
|
|
385
357
|
export const spaceStylesMap = spacingProperties.reduce((styleMap, spacingProperty) => {
|
package/dist/es2019/xcss/xcss.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
2
2
|
import { css as cssEmotion } from '@emotion/react';
|
|
3
3
|
import warnOnce from '@atlaskit/ds-lib/warn-once';
|
|
4
|
-
import { alignSelfMap, backgroundColorMap, borderColorMap, borderRadiusMap, borderStyleMap, borderWidthMap, dimensionMap, displayMap, flexDirectionMap, flexGrowMap, flexMap, flexShrinkMap,
|
|
4
|
+
import { alignSelfMap, backgroundColorMap, borderColorMap, borderRadiusMap, borderStyleMap, borderWidthMap, dimensionMap, displayMap, flexDirectionMap, flexGrowMap, flexMap, flexShrinkMap, layerMap, overflowBlockMap, overflowInlineMap, overflowMap, positionMap, shadowMap, spaceMap, textColorMap } from './style-maps.partial';
|
|
5
5
|
const tokensMap = {
|
|
6
6
|
alignSelf: alignSelfMap,
|
|
7
7
|
backgroundColor: backgroundColorMap,
|
|
@@ -22,13 +22,13 @@ const tokensMap = {
|
|
|
22
22
|
gap: spaceMap,
|
|
23
23
|
height: dimensionMap,
|
|
24
24
|
inlineSize: dimensionMap,
|
|
25
|
-
inset:
|
|
26
|
-
insetBlock:
|
|
27
|
-
insetBlockEnd:
|
|
28
|
-
insetBlockStart:
|
|
29
|
-
insetInline:
|
|
30
|
-
insetInlineEnd:
|
|
31
|
-
insetInlineStart:
|
|
25
|
+
inset: spaceMap,
|
|
26
|
+
insetBlock: spaceMap,
|
|
27
|
+
insetBlockEnd: spaceMap,
|
|
28
|
+
insetBlockStart: spaceMap,
|
|
29
|
+
insetInline: spaceMap,
|
|
30
|
+
insetInlineEnd: spaceMap,
|
|
31
|
+
insetInlineStart: spaceMap,
|
|
32
32
|
left: dimensionMap,
|
|
33
33
|
maxBlockSize: dimensionMap,
|
|
34
34
|
maxHeight: dimensionMap,
|
|
@@ -38,23 +38,23 @@ const tokensMap = {
|
|
|
38
38
|
minHeight: dimensionMap,
|
|
39
39
|
minInlineSize: dimensionMap,
|
|
40
40
|
minWidth: dimensionMap,
|
|
41
|
-
outlineOffset:
|
|
41
|
+
outlineOffset: spaceMap,
|
|
42
42
|
outlineWidth: borderWidthMap,
|
|
43
43
|
outlineColor: borderColorMap,
|
|
44
44
|
overflow: overflowMap,
|
|
45
45
|
overflowBlock: overflowBlockMap,
|
|
46
46
|
overflowInline: overflowInlineMap,
|
|
47
|
-
padding:
|
|
48
|
-
paddingBlock:
|
|
49
|
-
paddingBlockEnd:
|
|
50
|
-
paddingBlockStart:
|
|
51
|
-
paddingBottom:
|
|
52
|
-
paddingInline:
|
|
53
|
-
paddingInlineEnd:
|
|
54
|
-
paddingInlineStart:
|
|
55
|
-
paddingLeft:
|
|
56
|
-
paddingRight:
|
|
57
|
-
paddingTop:
|
|
47
|
+
padding: spaceMap,
|
|
48
|
+
paddingBlock: spaceMap,
|
|
49
|
+
paddingBlockEnd: spaceMap,
|
|
50
|
+
paddingBlockStart: spaceMap,
|
|
51
|
+
paddingBottom: spaceMap,
|
|
52
|
+
paddingInline: spaceMap,
|
|
53
|
+
paddingInlineEnd: spaceMap,
|
|
54
|
+
paddingInlineStart: spaceMap,
|
|
55
|
+
paddingLeft: spaceMap,
|
|
56
|
+
paddingRight: spaceMap,
|
|
57
|
+
paddingTop: spaceMap,
|
|
58
58
|
position: positionMap,
|
|
59
59
|
right: dimensionMap,
|
|
60
60
|
rowGap: spaceMap,
|
package/dist/esm/version.json
CHANGED