@atlaskit/primitives 0.16.0 → 1.0.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 +14 -0
- package/constellation/flex/code.mdx +7 -0
- package/constellation/flex/examples.mdx +34 -0
- package/constellation/overview/index.mdx +20 -14
- package/dist/cjs/components/flex.js +115 -0
- package/dist/cjs/index.js +7 -0
- package/dist/cjs/responsive/media-helper.js +15 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/flex.js +108 -0
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/responsive/media-helper.js +15 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/flex.js +107 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/responsive/media-helper.js +15 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/components/box.d.ts +1 -2
- package/dist/types/components/flex.d.ts +128 -0
- package/dist/types/components/inline.d.ts +1 -1
- package/dist/types/components/types.d.ts +2 -6
- package/dist/types/index.d.ts +2 -0
- package/dist/types/responsive/media-helper.d.ts +30 -0
- package/dist/types/xcss/xcss.d.ts +4 -4
- package/dist/types-ts4.5/components/box.d.ts +1 -2
- package/dist/types-ts4.5/components/flex.d.ts +128 -0
- package/dist/types-ts4.5/components/inline.d.ts +1 -1
- package/dist/types-ts4.5/components/types.d.ts +2 -6
- package/dist/types-ts4.5/index.d.ts +2 -0
- package/dist/types-ts4.5/responsive/media-helper.d.ts +30 -0
- package/dist/types-ts4.5/xcss/xcss.d.ts +4 -4
- package/extract-react-types/box-props.tsx +1 -9
- package/package.json +12 -3
- package/report.api.md +141 -23
- package/tmp/api-report-tmp.d.ts +83 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/primitives
|
|
2
2
|
|
|
3
|
+
## 1.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`cac98ccfb7d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cac98ccfb7d) - Introduces Flex component as common component for Stack, Inline.
|
|
8
|
+
|
|
9
|
+
## 1.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- [`fec62731e2e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fec62731e2e) - This package is now in open beta and is no longer considered experimental. We will be making iterative improvements until GA. While the API is likely to be stable, we reserve the right to make changes if required. This version contains no changes whatsoever.
|
|
14
|
+
|
|
15
|
+
P.S. The reason for the change is to aid package deduplication in the product.
|
|
16
|
+
|
|
3
17
|
## 0.16.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Flex
|
|
3
|
+
description: Flex is a primitive layout component that implements the CSS Flexbox API.
|
|
4
|
+
order: 0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
import FlexDirection from '../../examples/constellation/flex/direction';
|
|
8
|
+
import FlexAlignItems from '../../examples/constellation/flex/align-items';
|
|
9
|
+
import FlexJustifyContent from '../../examples/constellation/flex/justify-content';
|
|
10
|
+
import FlexWrap from '../../examples/constellation/flex/wrap';
|
|
11
|
+
|
|
12
|
+
## Basic
|
|
13
|
+
|
|
14
|
+
The `Flex` component is designed as a very basic mapping to the CSS Flexbox API.
|
|
15
|
+
It can be used as a less richly-configured `Inline` or `Stack`.
|
|
16
|
+
|
|
17
|
+
<Example Component={FlexJustifyContent} packageName="@atlaskit/primitives/flex" />
|
|
18
|
+
|
|
19
|
+
## Align items
|
|
20
|
+
|
|
21
|
+
<Example Component={FlexAlignItems} packageName="@atlaskit/primitives/flex" />
|
|
22
|
+
|
|
23
|
+
## Wrap
|
|
24
|
+
|
|
25
|
+
Flex-prefixed properties in CSS do not have this prefix in the component API.
|
|
26
|
+
For example `flex-wrap` is instead applied as the `wrap` property.
|
|
27
|
+
|
|
28
|
+
<Example Component={FlexWrap} packageName="@atlaskit/primitives/flex" />
|
|
29
|
+
|
|
30
|
+
## Direction
|
|
31
|
+
|
|
32
|
+
Flex direction is applied via the `direction` property.
|
|
33
|
+
|
|
34
|
+
<Example Component={FlexDirection} packageName="@atlaskit/primitives/flex" />
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Primitives
|
|
3
3
|
description: Primitives are composable components that solve common layout problems.
|
|
4
|
-
|
|
5
4
|
order: 1
|
|
6
5
|
---
|
|
7
6
|
|
|
@@ -12,25 +11,30 @@ import boxUsageExample from './images/box-usage-example.png';
|
|
|
12
11
|
import inlineUsageExample from './images/inline-usage-example.png';
|
|
13
12
|
import stackUsageExample from './images/stack-usage-example.png';
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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).
|
|
14
|
+
Primitive components are a new type of component for layouts and placement of elements.
|
|
15
|
+
They act as building blocks to compose different parts of the user experience,
|
|
16
|
+
from the smallest design decisions (for example, the spacing around an icon) to larger layout decisions (for example, how a page is structured).
|
|
20
17
|
|
|
21
|
-
Primitives are designed to work hand in hand with design tokens,
|
|
18
|
+
Primitives are designed to work hand in hand with design tokens,
|
|
19
|
+
to provide opinionated solutions for common low-level design decisions that engineers often have to make.
|
|
20
|
+
They are designed to reduce cognitive overhead for engineers by providing guardrails around what is recommended within our design system.
|
|
22
21
|
|
|
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.
|
|
22
|
+
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
23
|
|
|
25
24
|
## Available Primitives
|
|
26
25
|
|
|
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.
|
|
26
|
+
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
27
|
|
|
29
|
-
Currently, three primitive components are available
|
|
28
|
+
Currently, three core primitive components are available - Box, Inline and Stack. A large amount of layout problems can be reduced to laying out content:
|
|
30
29
|
- in a container (see [box](/components/primitives/box))
|
|
31
30
|
- horizontally (see [inline](/components/primitives/inline))
|
|
32
31
|
- vertically (see [stack](/components/primitives/stack))
|
|
33
32
|
|
|
33
|
+
Additional layouts not well-expressed by these core primitives can also be composed using:
|
|
34
|
+
- CSS Flexbox (see [flex](/components/primitives/flex))
|
|
35
|
+
- CSS Grid (see [grid](/components/primitives/grid))
|
|
36
|
+
- Divider (see [divider](/components/primitives/divider))
|
|
37
|
+
|
|
34
38
|
## Installation
|
|
35
39
|
|
|
36
40
|
To install primitive components, add @atlaskit/primitives as a dependency on your project:
|
|
@@ -40,17 +44,19 @@ $ yarn add @atlaskit/primitives
|
|
|
40
44
|
|
|
41
45
|
## Using Primitives
|
|
42
46
|
|
|
43
|
-
Use primitives for general layout styles for components.
|
|
47
|
+
Use primitives for general layout styles for components.
|
|
48
|
+
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.
|
|
49
|
+
This involves breaking down a design into its core layout components to as granular level as is useful.
|
|
44
50
|
|
|
45
51
|
<SectionMessage appearance="warning">
|
|
46
|
-
Primitives
|
|
52
|
+
Primitives should be avoided 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
53
|
</SectionMessage>
|
|
48
54
|
|
|
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.
|
|
55
|
+
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
56
|
|
|
51
57
|
<Image src={boxUsageExample} />
|
|
52
58
|
|
|
53
|
-
The behavior within and around these boxes can then be broken down into their horizontal Inline and vertical Stack components.
|
|
59
|
+
The behavior within and around these boxes can then be broken down into their horizontal `Inline` and vertical `Stack` components.
|
|
54
60
|
|
|
55
61
|
<SectionMessage>
|
|
56
62
|
The ESLint rule use-primitives offers suggestions for possible primitives in a layout.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _react2 = require("@emotion/react");
|
|
9
|
+
var _styleMaps = require("../xcss/style-maps.partial");
|
|
10
|
+
var _xcss = require("../xcss/xcss");
|
|
11
|
+
/* eslint-disable @repo/internal/styles/no-exported-styles */
|
|
12
|
+
/** @jsx jsx */
|
|
13
|
+
|
|
14
|
+
var justifyContentMap = {
|
|
15
|
+
start: (0, _react2.css)({
|
|
16
|
+
justifyContent: 'start'
|
|
17
|
+
}),
|
|
18
|
+
center: (0, _react2.css)({
|
|
19
|
+
justifyContent: 'center'
|
|
20
|
+
}),
|
|
21
|
+
end: (0, _react2.css)({
|
|
22
|
+
justifyContent: 'end'
|
|
23
|
+
}),
|
|
24
|
+
'space-between': (0, _react2.css)({
|
|
25
|
+
justifyContent: 'space-between'
|
|
26
|
+
}),
|
|
27
|
+
'space-around': (0, _react2.css)({
|
|
28
|
+
justifyContent: 'space-around'
|
|
29
|
+
}),
|
|
30
|
+
'space-evenly': (0, _react2.css)({
|
|
31
|
+
justifyContent: 'space-evenly'
|
|
32
|
+
}),
|
|
33
|
+
stretch: (0, _react2.css)({
|
|
34
|
+
justifyContent: 'stretch'
|
|
35
|
+
})
|
|
36
|
+
};
|
|
37
|
+
var flexDirectionMap = {
|
|
38
|
+
column: (0, _react2.css)({
|
|
39
|
+
flexDirection: 'column'
|
|
40
|
+
}),
|
|
41
|
+
row: (0, _react2.css)({
|
|
42
|
+
flexDirection: 'row'
|
|
43
|
+
})
|
|
44
|
+
};
|
|
45
|
+
var flexWrapMap = {
|
|
46
|
+
wrap: (0, _react2.css)({
|
|
47
|
+
flexWrap: 'wrap'
|
|
48
|
+
}),
|
|
49
|
+
nowrap: (0, _react2.css)({
|
|
50
|
+
flexWrap: 'nowrap'
|
|
51
|
+
})
|
|
52
|
+
};
|
|
53
|
+
var alignItemsMap = {
|
|
54
|
+
start: (0, _react2.css)({
|
|
55
|
+
alignItems: 'start'
|
|
56
|
+
}),
|
|
57
|
+
center: (0, _react2.css)({
|
|
58
|
+
alignItems: 'center'
|
|
59
|
+
}),
|
|
60
|
+
baseline: (0, _react2.css)({
|
|
61
|
+
alignItems: 'baseline'
|
|
62
|
+
}),
|
|
63
|
+
end: (0, _react2.css)({
|
|
64
|
+
alignItems: 'end'
|
|
65
|
+
})
|
|
66
|
+
};
|
|
67
|
+
var baseStyles = (0, _react2.css)({
|
|
68
|
+
display: 'flex',
|
|
69
|
+
boxSizing: 'border-box'
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* __Flex__
|
|
74
|
+
*
|
|
75
|
+
* `Flex` is a primitive component that implements the CSS Flexbox API.
|
|
76
|
+
*
|
|
77
|
+
* - [Examples](https://atlassian.design/components/primitives/flex/examples)
|
|
78
|
+
* - [Code](https://atlassian.design/components/primitives/flex/code)
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```tsx
|
|
82
|
+
* import { Flex, Box } from '@atlaskit/primitives'
|
|
83
|
+
*
|
|
84
|
+
* const Component = () => (
|
|
85
|
+
* <Flex direction="column">
|
|
86
|
+
* <Box padding="space.100" backgroundColor="neutral"></Box>
|
|
87
|
+
* <Box padding="space.100" backgroundColor="neutral"></Box>
|
|
88
|
+
* </Flex>
|
|
89
|
+
* )
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
var Flex = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
93
|
+
var as = _ref.as,
|
|
94
|
+
alignItems = _ref.alignItems,
|
|
95
|
+
justifyContent = _ref.justifyContent,
|
|
96
|
+
gap = _ref.gap,
|
|
97
|
+
rowGap = _ref.rowGap,
|
|
98
|
+
children = _ref.children,
|
|
99
|
+
testId = _ref.testId,
|
|
100
|
+
direction = _ref.direction,
|
|
101
|
+
wrap = _ref.wrap,
|
|
102
|
+
xcss = _ref.xcss;
|
|
103
|
+
var Component = as || 'div';
|
|
104
|
+
var xcssClassName = xcss && (0, _xcss.parseXcss)(xcss);
|
|
105
|
+
return (0, _react2.jsx)(Component, {
|
|
106
|
+
css: [baseStyles, gap && _styleMaps.spaceStylesMap.gap[gap], rowGap && _styleMaps.spaceStylesMap.rowGap[rowGap], alignItems && alignItemsMap[alignItems], direction && flexDirectionMap[direction], justifyContent && justifyContentMap[justifyContent], wrap && flexWrapMap[wrap],
|
|
107
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
108
|
+
xcssClassName && xcssClassName],
|
|
109
|
+
"data-testid": testId,
|
|
110
|
+
ref: ref
|
|
111
|
+
}, children);
|
|
112
|
+
}));
|
|
113
|
+
Flex.displayName = 'Flex';
|
|
114
|
+
var _default = Flex;
|
|
115
|
+
exports.default = _default;
|
package/dist/cjs/index.js
CHANGED
|
@@ -10,6 +10,12 @@ Object.defineProperty(exports, "Box", {
|
|
|
10
10
|
return _box.default;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
+
Object.defineProperty(exports, "Flex", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function get() {
|
|
16
|
+
return _flex.default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
13
19
|
Object.defineProperty(exports, "Inline", {
|
|
14
20
|
enumerable: true,
|
|
15
21
|
get: function get() {
|
|
@@ -51,4 +57,5 @@ var _pressable = _interopRequireDefault(require("./components/pressable"));
|
|
|
51
57
|
var _inline = _interopRequireDefault(require("./components/inline"));
|
|
52
58
|
var _xcss = require("./xcss/xcss");
|
|
53
59
|
var _stack = _interopRequireDefault(require("./components/stack"));
|
|
60
|
+
var _flex = _interopRequireDefault(require("./components/flex"));
|
|
54
61
|
var _responsive = require("./responsive");
|
|
@@ -20,10 +20,25 @@ var UNSAFE_media = {
|
|
|
20
20
|
* `above.xxs` is redundant and no media query should be used, but it's included for programatic purposes…
|
|
21
21
|
*/
|
|
22
22
|
xxs: "@media all",
|
|
23
|
+
/**
|
|
24
|
+
* Used for mobile viewports.
|
|
25
|
+
*/
|
|
23
26
|
xs: "@media (min-width: ".concat(_constants.UNSAFE_BREAKPOINTS_CONFIG.xs.min, ")"),
|
|
27
|
+
/**
|
|
28
|
+
* Used for tablet viewports.
|
|
29
|
+
*/
|
|
24
30
|
sm: "@media (min-width: ".concat(_constants.UNSAFE_BREAKPOINTS_CONFIG.sm.min, ")"),
|
|
31
|
+
/**
|
|
32
|
+
* Used for laptop viewports.
|
|
33
|
+
*/
|
|
25
34
|
md: "@media (min-width: ".concat(_constants.UNSAFE_BREAKPOINTS_CONFIG.md.min, ")"),
|
|
35
|
+
/**
|
|
36
|
+
* Used for desktop viewports.
|
|
37
|
+
*/
|
|
26
38
|
lg: "@media (min-width: ".concat(_constants.UNSAFE_BREAKPOINTS_CONFIG.lg.min, ")"),
|
|
39
|
+
/**
|
|
40
|
+
* Used for wide screen desktop viewports.
|
|
41
|
+
*/
|
|
27
42
|
xl: "@media (min-width: ".concat(_constants.UNSAFE_BREAKPOINTS_CONFIG.xl.min, ")")
|
|
28
43
|
},
|
|
29
44
|
/**
|
package/dist/cjs/version.json
CHANGED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/styles/no-exported-styles */
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import { forwardRef, memo } from 'react';
|
|
4
|
+
import { css, jsx } from '@emotion/react';
|
|
5
|
+
import { spaceStylesMap } from '../xcss/style-maps.partial';
|
|
6
|
+
import { parseXcss } from '../xcss/xcss';
|
|
7
|
+
const justifyContentMap = {
|
|
8
|
+
start: css({
|
|
9
|
+
justifyContent: 'start'
|
|
10
|
+
}),
|
|
11
|
+
center: css({
|
|
12
|
+
justifyContent: 'center'
|
|
13
|
+
}),
|
|
14
|
+
end: css({
|
|
15
|
+
justifyContent: 'end'
|
|
16
|
+
}),
|
|
17
|
+
'space-between': css({
|
|
18
|
+
justifyContent: 'space-between'
|
|
19
|
+
}),
|
|
20
|
+
'space-around': css({
|
|
21
|
+
justifyContent: 'space-around'
|
|
22
|
+
}),
|
|
23
|
+
'space-evenly': css({
|
|
24
|
+
justifyContent: 'space-evenly'
|
|
25
|
+
}),
|
|
26
|
+
stretch: css({
|
|
27
|
+
justifyContent: 'stretch'
|
|
28
|
+
})
|
|
29
|
+
};
|
|
30
|
+
const flexDirectionMap = {
|
|
31
|
+
column: css({
|
|
32
|
+
flexDirection: 'column'
|
|
33
|
+
}),
|
|
34
|
+
row: css({
|
|
35
|
+
flexDirection: 'row'
|
|
36
|
+
})
|
|
37
|
+
};
|
|
38
|
+
const flexWrapMap = {
|
|
39
|
+
wrap: css({
|
|
40
|
+
flexWrap: 'wrap'
|
|
41
|
+
}),
|
|
42
|
+
nowrap: css({
|
|
43
|
+
flexWrap: 'nowrap'
|
|
44
|
+
})
|
|
45
|
+
};
|
|
46
|
+
const alignItemsMap = {
|
|
47
|
+
start: css({
|
|
48
|
+
alignItems: 'start'
|
|
49
|
+
}),
|
|
50
|
+
center: css({
|
|
51
|
+
alignItems: 'center'
|
|
52
|
+
}),
|
|
53
|
+
baseline: css({
|
|
54
|
+
alignItems: 'baseline'
|
|
55
|
+
}),
|
|
56
|
+
end: css({
|
|
57
|
+
alignItems: 'end'
|
|
58
|
+
})
|
|
59
|
+
};
|
|
60
|
+
const baseStyles = css({
|
|
61
|
+
display: 'flex',
|
|
62
|
+
boxSizing: 'border-box'
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* __Flex__
|
|
67
|
+
*
|
|
68
|
+
* `Flex` is a primitive component that implements the CSS Flexbox API.
|
|
69
|
+
*
|
|
70
|
+
* - [Examples](https://atlassian.design/components/primitives/flex/examples)
|
|
71
|
+
* - [Code](https://atlassian.design/components/primitives/flex/code)
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```tsx
|
|
75
|
+
* import { Flex, Box } from '@atlaskit/primitives'
|
|
76
|
+
*
|
|
77
|
+
* const Component = () => (
|
|
78
|
+
* <Flex direction="column">
|
|
79
|
+
* <Box padding="space.100" backgroundColor="neutral"></Box>
|
|
80
|
+
* <Box padding="space.100" backgroundColor="neutral"></Box>
|
|
81
|
+
* </Flex>
|
|
82
|
+
* )
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
const Flex = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
86
|
+
as,
|
|
87
|
+
alignItems,
|
|
88
|
+
justifyContent,
|
|
89
|
+
gap,
|
|
90
|
+
rowGap,
|
|
91
|
+
children,
|
|
92
|
+
testId,
|
|
93
|
+
direction,
|
|
94
|
+
wrap,
|
|
95
|
+
xcss
|
|
96
|
+
}, ref) => {
|
|
97
|
+
const Component = as || 'div';
|
|
98
|
+
const xcssClassName = xcss && parseXcss(xcss);
|
|
99
|
+
return jsx(Component, {
|
|
100
|
+
css: [baseStyles, gap && spaceStylesMap.gap[gap], rowGap && spaceStylesMap.rowGap[rowGap], alignItems && alignItemsMap[alignItems], direction && flexDirectionMap[direction], justifyContent && justifyContentMap[justifyContent], wrap && flexWrapMap[wrap],
|
|
101
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
102
|
+
xcssClassName && xcssClassName],
|
|
103
|
+
"data-testid": testId,
|
|
104
|
+
ref: ref
|
|
105
|
+
}, children);
|
|
106
|
+
}));
|
|
107
|
+
Flex.displayName = 'Flex';
|
|
108
|
+
export default Flex;
|
package/dist/es2019/index.js
CHANGED
|
@@ -3,4 +3,5 @@ export { default as Pressable } from './components/pressable';
|
|
|
3
3
|
export { default as Inline } from './components/inline';
|
|
4
4
|
export { xcss } from './xcss/xcss';
|
|
5
5
|
export { default as Stack } from './components/stack';
|
|
6
|
+
export { default as Flex } from './components/flex';
|
|
6
7
|
export { UNSAFE_media, UNSAFE_BREAKPOINTS_CONFIG } from './responsive';
|
|
@@ -15,10 +15,25 @@ export const UNSAFE_media = {
|
|
|
15
15
|
* `above.xxs` is redundant and no media query should be used, but it's included for programatic purposes…
|
|
16
16
|
*/
|
|
17
17
|
xxs: `@media all`,
|
|
18
|
+
/**
|
|
19
|
+
* Used for mobile viewports.
|
|
20
|
+
*/
|
|
18
21
|
xs: `@media (min-width: ${UNSAFE_BREAKPOINTS_CONFIG.xs.min})`,
|
|
22
|
+
/**
|
|
23
|
+
* Used for tablet viewports.
|
|
24
|
+
*/
|
|
19
25
|
sm: `@media (min-width: ${UNSAFE_BREAKPOINTS_CONFIG.sm.min})`,
|
|
26
|
+
/**
|
|
27
|
+
* Used for laptop viewports.
|
|
28
|
+
*/
|
|
20
29
|
md: `@media (min-width: ${UNSAFE_BREAKPOINTS_CONFIG.md.min})`,
|
|
30
|
+
/**
|
|
31
|
+
* Used for desktop viewports.
|
|
32
|
+
*/
|
|
21
33
|
lg: `@media (min-width: ${UNSAFE_BREAKPOINTS_CONFIG.lg.min})`,
|
|
34
|
+
/**
|
|
35
|
+
* Used for wide screen desktop viewports.
|
|
36
|
+
*/
|
|
22
37
|
xl: `@media (min-width: ${UNSAFE_BREAKPOINTS_CONFIG.xl.min})`
|
|
23
38
|
},
|
|
24
39
|
/**
|
package/dist/es2019/version.json
CHANGED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/styles/no-exported-styles */
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import { forwardRef, memo } from 'react';
|
|
4
|
+
import { css, jsx } from '@emotion/react';
|
|
5
|
+
import { spaceStylesMap } from '../xcss/style-maps.partial';
|
|
6
|
+
import { parseXcss } from '../xcss/xcss';
|
|
7
|
+
var justifyContentMap = {
|
|
8
|
+
start: css({
|
|
9
|
+
justifyContent: 'start'
|
|
10
|
+
}),
|
|
11
|
+
center: css({
|
|
12
|
+
justifyContent: 'center'
|
|
13
|
+
}),
|
|
14
|
+
end: css({
|
|
15
|
+
justifyContent: 'end'
|
|
16
|
+
}),
|
|
17
|
+
'space-between': css({
|
|
18
|
+
justifyContent: 'space-between'
|
|
19
|
+
}),
|
|
20
|
+
'space-around': css({
|
|
21
|
+
justifyContent: 'space-around'
|
|
22
|
+
}),
|
|
23
|
+
'space-evenly': css({
|
|
24
|
+
justifyContent: 'space-evenly'
|
|
25
|
+
}),
|
|
26
|
+
stretch: css({
|
|
27
|
+
justifyContent: 'stretch'
|
|
28
|
+
})
|
|
29
|
+
};
|
|
30
|
+
var flexDirectionMap = {
|
|
31
|
+
column: css({
|
|
32
|
+
flexDirection: 'column'
|
|
33
|
+
}),
|
|
34
|
+
row: css({
|
|
35
|
+
flexDirection: 'row'
|
|
36
|
+
})
|
|
37
|
+
};
|
|
38
|
+
var flexWrapMap = {
|
|
39
|
+
wrap: css({
|
|
40
|
+
flexWrap: 'wrap'
|
|
41
|
+
}),
|
|
42
|
+
nowrap: css({
|
|
43
|
+
flexWrap: 'nowrap'
|
|
44
|
+
})
|
|
45
|
+
};
|
|
46
|
+
var alignItemsMap = {
|
|
47
|
+
start: css({
|
|
48
|
+
alignItems: 'start'
|
|
49
|
+
}),
|
|
50
|
+
center: css({
|
|
51
|
+
alignItems: 'center'
|
|
52
|
+
}),
|
|
53
|
+
baseline: css({
|
|
54
|
+
alignItems: 'baseline'
|
|
55
|
+
}),
|
|
56
|
+
end: css({
|
|
57
|
+
alignItems: 'end'
|
|
58
|
+
})
|
|
59
|
+
};
|
|
60
|
+
var baseStyles = css({
|
|
61
|
+
display: 'flex',
|
|
62
|
+
boxSizing: 'border-box'
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* __Flex__
|
|
67
|
+
*
|
|
68
|
+
* `Flex` is a primitive component that implements the CSS Flexbox API.
|
|
69
|
+
*
|
|
70
|
+
* - [Examples](https://atlassian.design/components/primitives/flex/examples)
|
|
71
|
+
* - [Code](https://atlassian.design/components/primitives/flex/code)
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```tsx
|
|
75
|
+
* import { Flex, Box } from '@atlaskit/primitives'
|
|
76
|
+
*
|
|
77
|
+
* const Component = () => (
|
|
78
|
+
* <Flex direction="column">
|
|
79
|
+
* <Box padding="space.100" backgroundColor="neutral"></Box>
|
|
80
|
+
* <Box padding="space.100" backgroundColor="neutral"></Box>
|
|
81
|
+
* </Flex>
|
|
82
|
+
* )
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
var Flex = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
86
|
+
var as = _ref.as,
|
|
87
|
+
alignItems = _ref.alignItems,
|
|
88
|
+
justifyContent = _ref.justifyContent,
|
|
89
|
+
gap = _ref.gap,
|
|
90
|
+
rowGap = _ref.rowGap,
|
|
91
|
+
children = _ref.children,
|
|
92
|
+
testId = _ref.testId,
|
|
93
|
+
direction = _ref.direction,
|
|
94
|
+
wrap = _ref.wrap,
|
|
95
|
+
xcss = _ref.xcss;
|
|
96
|
+
var Component = as || 'div';
|
|
97
|
+
var xcssClassName = xcss && parseXcss(xcss);
|
|
98
|
+
return jsx(Component, {
|
|
99
|
+
css: [baseStyles, gap && spaceStylesMap.gap[gap], rowGap && spaceStylesMap.rowGap[rowGap], alignItems && alignItemsMap[alignItems], direction && flexDirectionMap[direction], justifyContent && justifyContentMap[justifyContent], wrap && flexWrapMap[wrap],
|
|
100
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
101
|
+
xcssClassName && xcssClassName],
|
|
102
|
+
"data-testid": testId,
|
|
103
|
+
ref: ref
|
|
104
|
+
}, children);
|
|
105
|
+
}));
|
|
106
|
+
Flex.displayName = 'Flex';
|
|
107
|
+
export default Flex;
|
package/dist/esm/index.js
CHANGED
|
@@ -3,4 +3,5 @@ export { default as Pressable } from './components/pressable';
|
|
|
3
3
|
export { default as Inline } from './components/inline';
|
|
4
4
|
export { xcss } from './xcss/xcss';
|
|
5
5
|
export { default as Stack } from './components/stack';
|
|
6
|
+
export { default as Flex } from './components/flex';
|
|
6
7
|
export { UNSAFE_media, UNSAFE_BREAKPOINTS_CONFIG } from './responsive';
|
|
@@ -15,10 +15,25 @@ export var UNSAFE_media = {
|
|
|
15
15
|
* `above.xxs` is redundant and no media query should be used, but it's included for programatic purposes…
|
|
16
16
|
*/
|
|
17
17
|
xxs: "@media all",
|
|
18
|
+
/**
|
|
19
|
+
* Used for mobile viewports.
|
|
20
|
+
*/
|
|
18
21
|
xs: "@media (min-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.xs.min, ")"),
|
|
22
|
+
/**
|
|
23
|
+
* Used for tablet viewports.
|
|
24
|
+
*/
|
|
19
25
|
sm: "@media (min-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.sm.min, ")"),
|
|
26
|
+
/**
|
|
27
|
+
* Used for laptop viewports.
|
|
28
|
+
*/
|
|
20
29
|
md: "@media (min-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.md.min, ")"),
|
|
30
|
+
/**
|
|
31
|
+
* Used for desktop viewports.
|
|
32
|
+
*/
|
|
21
33
|
lg: "@media (min-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.lg.min, ")"),
|
|
34
|
+
/**
|
|
35
|
+
* Used for wide screen desktop viewports.
|
|
36
|
+
*/
|
|
22
37
|
xl: "@media (min-width: ".concat(UNSAFE_BREAKPOINTS_CONFIG.xl.min, ")")
|
|
23
38
|
},
|
|
24
39
|
/**
|
package/dist/esm/version.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { ElementType, FC, ReactElement } from 'react';
|
|
3
3
|
import { BaseBoxProps } from './internal/base-box';
|
|
4
|
-
|
|
5
|
-
export type BoxProps<T extends ElementType = 'div'> = Omit<BaseBoxProps<T>, 'className'> & PublicBoxPropsBase;
|
|
4
|
+
export type BoxProps<T extends ElementType = 'div'> = Omit<BaseBoxProps<T>, 'className'>;
|
|
6
5
|
type BoxComponent<T extends ElementType = 'div'> = (<T extends ElementType = 'div'>(props: BoxProps<T>) => ReactElement | null) & FC<BoxProps<T>>;
|
|
7
6
|
/**
|
|
8
7
|
* __Box__
|