@atlaskit/primitives 1.0.1 → 1.0.3
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 +13 -0
- package/constellation/box/code.mdx +8 -0
- package/constellation/box/examples.mdx +8 -1
- package/constellation/flex/code.mdx +14 -2
- package/constellation/flex/examples.mdx +9 -0
- package/constellation/grid/code.mdx +19 -0
- package/constellation/grid/examples.mdx +46 -0
- package/constellation/inline/code.mdx +8 -0
- package/constellation/inline/examples.mdx +9 -1
- package/constellation/overview/index.mdx +8 -0
- package/constellation/responsive/01-show/examples.mdx +31 -0
- package/constellation/responsive/02-hide/examples.mdx +30 -0
- package/constellation/responsive/03-breakpoints/examples.mdx +51 -0
- package/constellation/responsive/examples.mdx +12 -23
- package/constellation/stack/code.mdx +8 -0
- package/constellation/stack/examples.mdx +9 -1
- package/constellation/xcss/examples.mdx +8 -0
- package/dist/cjs/components/flex.js +7 -3
- package/dist/cjs/components/grid.js +127 -0
- package/dist/cjs/components/inline.js +16 -48
- package/dist/cjs/components/stack.js +19 -39
- package/dist/cjs/index.js +13 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/xcss/style-maps.partial.js +8 -2
- package/dist/cjs/xcss/xcss.js +1 -1
- package/dist/es2019/components/flex.js +6 -3
- package/dist/es2019/components/grid.js +118 -0
- package/dist/es2019/components/inline.js +15 -49
- package/dist/es2019/components/stack.js +18 -40
- package/dist/es2019/index.js +2 -1
- package/dist/es2019/responsive/build-media-query-css.js +0 -1
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/xcss/style-maps.partial.js +8 -2
- package/dist/es2019/xcss/xcss.js +1 -1
- package/dist/esm/components/flex.js +7 -3
- package/dist/esm/components/grid.js +119 -0
- package/dist/esm/components/inline.js +16 -49
- package/dist/esm/components/stack.js +19 -40
- package/dist/esm/index.js +2 -1
- package/dist/esm/version.json +1 -1
- package/dist/esm/xcss/style-maps.partial.js +8 -2
- package/dist/esm/xcss/xcss.js +1 -1
- package/dist/types/components/flex.d.ts +17 -8
- package/dist/types/components/grid.d.ts +154 -0
- package/dist/types/components/inline.d.ts +50 -12
- package/dist/types/components/stack.d.ts +38 -8
- package/dist/types/index.d.ts +2 -1
- package/dist/types/xcss/style-maps.partial.d.ts +8 -2
- package/dist/types/xcss/xcss.d.ts +11 -14
- package/dist/types-ts4.5/components/flex.d.ts +17 -8
- package/dist/types-ts4.5/components/grid.d.ts +154 -0
- package/dist/types-ts4.5/components/inline.d.ts +50 -12
- package/dist/types-ts4.5/components/stack.d.ts +38 -8
- package/dist/types-ts4.5/index.d.ts +2 -1
- package/dist/types-ts4.5/xcss/style-maps.partial.d.ts +8 -2
- package/dist/types-ts4.5/xcss/xcss.d.ts +11 -14
- package/extract-react-types/flex-props.tsx +80 -0
- package/extract-react-types/grid-props.tsx +102 -0
- package/package.json +47 -40
- package/report.api.md +276 -59
- package/scripts/__tests__/__snapshots__/codegen.test.tsx.snap +24 -0
- package/tmp/api-report-tmp.d.ts +0 -670
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/primitives
|
|
2
2
|
|
|
3
|
+
## 1.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`298df94426c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/298df94426c) - Regenerates codegen'd artifacts as a result of introducting new brand background design tokens.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 1.0.2
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`45ff2cd234f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/45ff2cd234f) - Fixes missing type in `Flex` component, adds `Grid` component.
|
|
15
|
+
|
|
3
16
|
## 1.0.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -4,6 +4,14 @@ description: Box is a primitive component that leverages the foundations of the
|
|
|
4
4
|
order: 1
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
8
|
+
|
|
9
|
+
<CodeDocsHeader
|
|
10
|
+
name="@atlaskit/primitives"
|
|
11
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
12
|
+
directoryName="primitives"
|
|
13
|
+
/>
|
|
14
|
+
|
|
7
15
|
import BoxProps from '!!extract-react-types-loader!../../extract-react-types/box-props'
|
|
8
16
|
|
|
9
17
|
## Props
|
|
@@ -8,6 +8,13 @@ import BoxBasic from '../../examples/constellation/box/basic';
|
|
|
8
8
|
import BoxPadding from '../../examples/constellation/box/padding';
|
|
9
9
|
import BoxBackgroundColor from '../../examples/constellation/box/background-color';
|
|
10
10
|
import BoxXcss from '../../examples/constellation/box/xcss';
|
|
11
|
+
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
12
|
+
|
|
13
|
+
<CodeDocsHeader
|
|
14
|
+
name="@atlaskit/primitives"
|
|
15
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
16
|
+
directoryName="primitives"
|
|
17
|
+
/>
|
|
11
18
|
|
|
12
19
|
## Basic
|
|
13
20
|
|
|
@@ -31,7 +38,7 @@ Padding props can be used to access spacing design token and control internal la
|
|
|
31
38
|
|
|
32
39
|
## xCSS
|
|
33
40
|
|
|
34
|
-
Box also exposes an `xcss` prop. This prop can take `xcss` function calls that contain a subset of permitted styles. When used with `Box`, xCSS takes most CSS properties, and when a token exists, the rule accepts that token as a value.
|
|
41
|
+
Box also exposes an `xcss` prop. This prop can take `xcss` function calls that contain a subset of permitted styles. When used with `Box`, xCSS takes most CSS properties, and when a token exists, the rule accepts that token as a value.
|
|
35
42
|
|
|
36
43
|
<Example Component={BoxXcss} packageName="@atlaskit/primitives/box" />
|
|
37
44
|
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Flex
|
|
3
|
-
description: Flex is a primitive component that
|
|
3
|
+
description: Flex is a primitive layout component that implements the CSS Flexbox API.
|
|
4
4
|
order: 1
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
8
|
+
|
|
9
|
+
<CodeDocsHeader
|
|
10
|
+
name="@atlaskit/primitives"
|
|
11
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
12
|
+
directoryName="primitives"
|
|
13
|
+
/>
|
|
14
|
+
|
|
15
|
+
import FlexProps from '!!extract-react-types-loader!../../extract-react-types/flex-props'
|
|
16
|
+
|
|
17
|
+
## Props
|
|
18
|
+
|
|
19
|
+
<PropsTable heading="" props={FlexProps} />
|
|
@@ -9,6 +9,15 @@ import FlexAlignItems from '../../examples/constellation/flex/align-items';
|
|
|
9
9
|
import FlexJustifyContent from '../../examples/constellation/flex/justify-content';
|
|
10
10
|
import FlexWrap from '../../examples/constellation/flex/wrap';
|
|
11
11
|
|
|
12
|
+
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
13
|
+
|
|
14
|
+
<CodeDocsHeader
|
|
15
|
+
name="@atlaskit/primitives"
|
|
16
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
17
|
+
directoryName="primitives"
|
|
18
|
+
/>
|
|
19
|
+
|
|
20
|
+
|
|
12
21
|
## Basic
|
|
13
22
|
|
|
14
23
|
The `Flex` component is designed as a very basic mapping to the CSS Flexbox API.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Grid
|
|
3
|
+
description: Grid is a primitive layout component that implements the CSS Grid API.
|
|
4
|
+
order: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
8
|
+
|
|
9
|
+
<CodeDocsHeader
|
|
10
|
+
name="@atlaskit/primitives"
|
|
11
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
12
|
+
directoryName="primitives"
|
|
13
|
+
/>
|
|
14
|
+
|
|
15
|
+
import BoxProps from '!!extract-react-types-loader!../../extract-react-types/grid-props'
|
|
16
|
+
|
|
17
|
+
## Props
|
|
18
|
+
|
|
19
|
+
<PropsTable heading="" props={BoxProps} />
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Grid
|
|
3
|
+
description: Grid is a primitive layout component that implements the CSS Grid API.
|
|
4
|
+
order: 0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
import GridBasic from '../../examples/constellation/grid/basic';
|
|
8
|
+
import GridGap from '../../examples/constellation/grid/gap';
|
|
9
|
+
import GridTemplate from '../../examples/constellation/grid/template';
|
|
10
|
+
import GridAutoFlow from '../../examples/constellation/grid/auto-flow';
|
|
11
|
+
|
|
12
|
+
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
13
|
+
|
|
14
|
+
<CodeDocsHeader
|
|
15
|
+
name="@atlaskit/primitives"
|
|
16
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
17
|
+
directoryName="primitives"
|
|
18
|
+
/>
|
|
19
|
+
|
|
20
|
+
## Basic
|
|
21
|
+
|
|
22
|
+
The `Grid` component is designed as a very basic mapping to the CSS Grid API.
|
|
23
|
+
It can be used as an alternative to [Flex](/components/primitives/flex), [Inline](/components/primitives/inline) or [Stack](/components/primitives/stack).
|
|
24
|
+
|
|
25
|
+
<Example Component={GridBasic} packageName="@atlaskit/primitives/grid" />
|
|
26
|
+
|
|
27
|
+
## Gap properties
|
|
28
|
+
|
|
29
|
+
Gap properties - `rowGap`, `columnGap` and `gap` only allow token-backed values. This is to aid ergonomics
|
|
30
|
+
and keep the whitespace of the grid harmonious with our spacing system.
|
|
31
|
+
|
|
32
|
+
<Example Component={GridGap} packageName="@atlaskit/primitives/grid" />
|
|
33
|
+
|
|
34
|
+
## Template syntax
|
|
35
|
+
|
|
36
|
+
Grid-prefixed template properties in CSS do not have this prefix in the component API.
|
|
37
|
+
For example `grid-template-*` are instead applied as `templateColumns`, `templateRows` and `templateArea` properties.
|
|
38
|
+
|
|
39
|
+
<Example Component={GridTemplate} packageName="@atlaskit/primitives/grid" />
|
|
40
|
+
|
|
41
|
+
## Autoflow syntax
|
|
42
|
+
|
|
43
|
+
Grid-prefixed properties in CSS do not have this prefix in the component API. `grid-auto-flow` is instead applied via `autoFlow`.
|
|
44
|
+
|
|
45
|
+
<Example Component={GridAutoFlow} packageName="@atlaskit/primitives/grid" />
|
|
46
|
+
|
|
@@ -4,6 +4,14 @@ description: Inline is a primitive component based on flexbox that manages the h
|
|
|
4
4
|
order: 1
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
8
|
+
|
|
9
|
+
<CodeDocsHeader
|
|
10
|
+
name="@atlaskit/primitives"
|
|
11
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
12
|
+
directoryName="primitives"
|
|
13
|
+
/>
|
|
14
|
+
|
|
7
15
|
import InlineProps from '!!extract-react-types-loader!../../extract-react-types/inline-props'
|
|
8
16
|
|
|
9
17
|
## Props
|
|
@@ -15,9 +15,17 @@ import InlineSeparator from '../../examples/constellation/inline/separator';
|
|
|
15
15
|
import InlineGrow from '../../examples/constellation/inline/grow';
|
|
16
16
|
import InlineAs from '../../examples/constellation/inline/as';
|
|
17
17
|
|
|
18
|
+
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
19
|
+
|
|
20
|
+
<CodeDocsHeader
|
|
21
|
+
name="@atlaskit/primitives"
|
|
22
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
23
|
+
directoryName="primitives"
|
|
24
|
+
/>
|
|
25
|
+
|
|
18
26
|
## Basic
|
|
19
27
|
|
|
20
|
-
Inline is an abstraction to efficiently lay-out a group of elements horizontally.
|
|
28
|
+
Inline is an abstraction to efficiently lay-out a group of elements horizontally.
|
|
21
29
|
Use the given props to configure display behaviour using scalable recommendations from the Atlassian Design System.
|
|
22
30
|
|
|
23
31
|
<Example Component={InlineBasic} packageName="@atlaskit/primitives/inline" />
|
|
@@ -11,6 +11,14 @@ import boxUsageExample from './images/box-usage-example.png';
|
|
|
11
11
|
import inlineUsageExample from './images/inline-usage-example.png';
|
|
12
12
|
import stackUsageExample from './images/stack-usage-example.png';
|
|
13
13
|
|
|
14
|
+
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
15
|
+
|
|
16
|
+
<CodeDocsHeader
|
|
17
|
+
name="@atlaskit/primitives"
|
|
18
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
19
|
+
directoryName="primitives"
|
|
20
|
+
/>
|
|
21
|
+
|
|
14
22
|
Primitive components are a new type of component for layouts and placement of elements.
|
|
15
23
|
They act as building blocks to compose different parts of the user experience,
|
|
16
24
|
from the smallest design decisions (for example, the spacing around an icon) to larger layout decisions (for example, how a page is structured).
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Show
|
|
3
|
+
description: Show is a responsive primitive that displays children at specified breakpoints
|
|
4
|
+
order: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
import ShowExample from '../../../examples/constellation/responsive/show';
|
|
8
|
+
import ShowHideExample from '../../../examples/constellation/responsive/show-hide';
|
|
9
|
+
|
|
10
|
+
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
11
|
+
|
|
12
|
+
<CodeDocsHeader
|
|
13
|
+
name="@atlaskit/primitives"
|
|
14
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
15
|
+
directoryName="primitives"
|
|
16
|
+
/>
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Show
|
|
20
|
+
|
|
21
|
+
This allows you to Show the children using CSS `display: …` either above or below a breakpoint. By default, unless the breakpoint is met, contents are hidden.
|
|
22
|
+
|
|
23
|
+
Note that this does not skip rendering of your children; the contents are rendered into the DOM at all times, so there is typically little performance savings—primarily that this is not painted.
|
|
24
|
+
|
|
25
|
+
<Example Component={ShowExample} packageName="@atlaskit/primitives/responsive" />
|
|
26
|
+
|
|
27
|
+
### Mixing Show and Hide
|
|
28
|
+
|
|
29
|
+
Prefer using consistent `above` or `below` for readability and consistency.
|
|
30
|
+
|
|
31
|
+
<Example Component={ShowHideExample} packageName="@atlaskit/primitives/responsive" />
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Hide
|
|
3
|
+
description: Hide is a responsive primitive that hides children at specified breakpoints
|
|
4
|
+
order: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
import HideExample from '../../../examples/constellation/responsive/hide';
|
|
8
|
+
import ShowHideExample from '../../../examples/constellation/responsive/show-hide';
|
|
9
|
+
|
|
10
|
+
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
11
|
+
|
|
12
|
+
<CodeDocsHeader
|
|
13
|
+
name="@atlaskit/primitives"
|
|
14
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
15
|
+
directoryName="primitives"
|
|
16
|
+
/>
|
|
17
|
+
|
|
18
|
+
### Hide
|
|
19
|
+
|
|
20
|
+
This allows you to Hide the children using CSS `display: none` either above or below a breakpoint. By default, unless the breakpoint is met, contents are hidden.
|
|
21
|
+
|
|
22
|
+
When hidden, this does not skip rendering of your children; the contents are rendered into the DOM at all times so there is typically little performance savings—primarily that this is not painted.
|
|
23
|
+
|
|
24
|
+
<Example Component={HideExample} packageName="@atlaskit/primitives/responsive" />
|
|
25
|
+
|
|
26
|
+
### Mixing Show and Hide
|
|
27
|
+
|
|
28
|
+
Prefer using consistent `above` or `below` for readability and consistency.
|
|
29
|
+
|
|
30
|
+
<Example Component={ShowHideExample} packageName="@atlaskit/primitives/responsive" />
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Breakpoints
|
|
3
|
+
description: Breakpoints can be accessed through the media object for use in styles
|
|
4
|
+
order: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
import { MediaQueriesTable } from '@af/design-system-docs-ui';
|
|
8
|
+
|
|
9
|
+
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
10
|
+
|
|
11
|
+
<CodeDocsHeader
|
|
12
|
+
name="@atlaskit/primitives"
|
|
13
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
14
|
+
directoryName="primitives"
|
|
15
|
+
/>
|
|
16
|
+
|
|
17
|
+
### Media Queries
|
|
18
|
+
Media queries can be applied through the `media` object.
|
|
19
|
+
|
|
20
|
+
|
|
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
|
+
```
|
|
@@ -10,6 +10,15 @@ import ShowExample from '../../examples/constellation/responsive/show';
|
|
|
10
10
|
import HideExample from '../../examples/constellation/responsive/hide';
|
|
11
11
|
import ShowHideExample from '../../examples/constellation/responsive/show-hide';
|
|
12
12
|
|
|
13
|
+
|
|
14
|
+
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
15
|
+
|
|
16
|
+
<CodeDocsHeader
|
|
17
|
+
name="@atlaskit/primitives"
|
|
18
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
19
|
+
directoryName="primitives"
|
|
20
|
+
/>
|
|
21
|
+
|
|
13
22
|
## Responsive `css` or `xcss`
|
|
14
23
|
|
|
15
24
|
Utilize our media queries exposed in `css`, `styled`, or `xcss` as computed keys to build responsive UIs. Learn more about these media query exports in [usage](/components/primitives/responsive/usage).
|
|
@@ -26,26 +35,6 @@ Please use `xcss` whenever possible to ensure consistency and safety with style
|
|
|
26
35
|
|
|
27
36
|
## Responsive primitives
|
|
28
37
|
|
|
29
|
-
Consider these shortcuts to writing your own custom media queries.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
This allows you to Show the children using CSS `display: …` either above or below a breakpoint. By default, unless the breakpoint is met, contents are hidden.
|
|
34
|
-
|
|
35
|
-
Note that this does not skip rendering of your children; the contents are rendered into the DOM at all times, so there is typically little performance savings—primarily that this is not painted.
|
|
36
|
-
|
|
37
|
-
<Example Component={ShowExample} packageName="@atlaskit/primitives/responsive" />
|
|
38
|
-
|
|
39
|
-
### Hide
|
|
40
|
-
|
|
41
|
-
This allows you to Hide the children using CSS `display: none` either above or below a breakpoint. By default, unless the breakpoint is met, contents are hidden.
|
|
42
|
-
|
|
43
|
-
When hidden, this does not skip rendering of your children; the contents are rendered into the DOM at all times so there is typically little performance savings—primarily that this is not painted.
|
|
44
|
-
|
|
45
|
-
<Example Component={HideExample} packageName="@atlaskit/primitives/responsive" />
|
|
46
|
-
|
|
47
|
-
### Mixing Show and Hide
|
|
48
|
-
|
|
49
|
-
Prefer using consistent `above` or `below` for readability and consistency.
|
|
50
|
-
|
|
51
|
-
<Example Component={ShowHideExample} packageName="@atlaskit/primitives/responsive" />
|
|
38
|
+
Consider these shortcuts to writing your own custom media queries. Composing with our primitives will be far quicker and consistent to implement, but may result in excess DOM nodes.
|
|
39
|
+
* [Show](/components/primitives/responsive/show)
|
|
40
|
+
* [Hide](/components/primitives/responsive/hide)
|
|
@@ -4,6 +4,14 @@ description: Stack is a primitive component based on flexbox that manages the ve
|
|
|
4
4
|
order: 1
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
8
|
+
|
|
9
|
+
<CodeDocsHeader
|
|
10
|
+
name="@atlaskit/primitives"
|
|
11
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
12
|
+
directoryName="primitives"
|
|
13
|
+
/>
|
|
14
|
+
|
|
7
15
|
import StackProps from '!!extract-react-types-loader!../../extract-react-types/stack-props'
|
|
8
16
|
|
|
9
17
|
## Props
|
|
@@ -12,6 +12,14 @@ import StackSpread from '../../examples/constellation/stack/spread';
|
|
|
12
12
|
import StackGrow from '../../examples/constellation/stack/grow';
|
|
13
13
|
import StackAs from '../../examples/constellation/stack/as';
|
|
14
14
|
|
|
15
|
+
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
16
|
+
|
|
17
|
+
<CodeDocsHeader
|
|
18
|
+
name="@atlaskit/primitives"
|
|
19
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
20
|
+
directoryName="primitives"
|
|
21
|
+
/>
|
|
22
|
+
|
|
15
23
|
## Basic
|
|
16
24
|
|
|
17
25
|
Stack is an abstraction to lay-out a group of elements vertically.
|
|
@@ -46,7 +54,7 @@ Elements can be set to stay together next to each other (default behaviour) or s
|
|
|
46
54
|
|
|
47
55
|
## Width control
|
|
48
56
|
|
|
49
|
-
By default a `Stack` will have its width influenced by the context where it appears.
|
|
57
|
+
By default a `Stack` will have its width influenced by the context where it appears.
|
|
50
58
|
|
|
51
59
|
To control that the `grow` prop can be used with the values:
|
|
52
60
|
|
|
@@ -8,6 +8,14 @@ import xcssBasic from '../../examples/constellation/xcss/basic';
|
|
|
8
8
|
import xcssInteractive from '../../examples/constellation/xcss/interactivity';
|
|
9
9
|
import xcssResponsive from '../../examples/constellation/xcss/responsiveness';
|
|
10
10
|
|
|
11
|
+
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
12
|
+
|
|
13
|
+
<CodeDocsHeader
|
|
14
|
+
name="@atlaskit/primitives"
|
|
15
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
16
|
+
directoryName="primitives"
|
|
17
|
+
/>
|
|
18
|
+
|
|
11
19
|
## Basic
|
|
12
20
|
|
|
13
21
|
`xcss` can pull together different types of interactions and UI in a safer more composable way.
|
|
@@ -62,6 +62,9 @@ var alignItemsMap = {
|
|
|
62
62
|
}),
|
|
63
63
|
end: (0, _react2.css)({
|
|
64
64
|
alignItems: 'end'
|
|
65
|
+
}),
|
|
66
|
+
stretch: (0, _react2.css)({
|
|
67
|
+
alignItems: 'stretch'
|
|
65
68
|
})
|
|
66
69
|
};
|
|
67
70
|
var baseStyles = (0, _react2.css)({
|
|
@@ -90,20 +93,21 @@ var baseStyles = (0, _react2.css)({
|
|
|
90
93
|
* ```
|
|
91
94
|
*/
|
|
92
95
|
var Flex = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
93
|
-
var as = _ref.as,
|
|
96
|
+
var _ref$as = _ref.as,
|
|
97
|
+
Component = _ref$as === void 0 ? 'div' : _ref$as,
|
|
94
98
|
alignItems = _ref.alignItems,
|
|
95
99
|
justifyContent = _ref.justifyContent,
|
|
96
100
|
gap = _ref.gap,
|
|
101
|
+
columnGap = _ref.columnGap,
|
|
97
102
|
rowGap = _ref.rowGap,
|
|
98
103
|
children = _ref.children,
|
|
99
104
|
testId = _ref.testId,
|
|
100
105
|
direction = _ref.direction,
|
|
101
106
|
wrap = _ref.wrap,
|
|
102
107
|
xcss = _ref.xcss;
|
|
103
|
-
var Component = as || 'div';
|
|
104
108
|
var xcssClassName = xcss && (0, _xcss.parseXcss)(xcss);
|
|
105
109
|
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],
|
|
110
|
+
css: [baseStyles, gap && _styleMaps.spaceStylesMap.gap[gap], columnGap && _styleMaps.spaceStylesMap.columnGap[columnGap], rowGap && _styleMaps.spaceStylesMap.rowGap[rowGap], alignItems && alignItemsMap[alignItems], direction && flexDirectionMap[direction], justifyContent && justifyContentMap[justifyContent], wrap && flexWrapMap[wrap],
|
|
107
111
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
108
112
|
xcssClassName && xcssClassName],
|
|
109
113
|
"data-testid": testId,
|
|
@@ -0,0 +1,127 @@
|
|
|
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 alignItemsMap = {
|
|
38
|
+
start: (0, _react2.css)({
|
|
39
|
+
alignItems: 'start'
|
|
40
|
+
}),
|
|
41
|
+
center: (0, _react2.css)({
|
|
42
|
+
alignItems: 'center'
|
|
43
|
+
}),
|
|
44
|
+
baseline: (0, _react2.css)({
|
|
45
|
+
alignItems: 'baseline'
|
|
46
|
+
}),
|
|
47
|
+
end: (0, _react2.css)({
|
|
48
|
+
alignItems: 'end'
|
|
49
|
+
})
|
|
50
|
+
};
|
|
51
|
+
var baseStyles = (0, _react2.css)({
|
|
52
|
+
display: 'grid',
|
|
53
|
+
boxSizing: 'border-box'
|
|
54
|
+
});
|
|
55
|
+
var gridAutoFlowMap = {
|
|
56
|
+
row: (0, _react2.css)({
|
|
57
|
+
gridAutoFlow: 'row'
|
|
58
|
+
}),
|
|
59
|
+
column: (0, _react2.css)({
|
|
60
|
+
gridAutoFlow: 'column'
|
|
61
|
+
}),
|
|
62
|
+
dense: (0, _react2.css)({
|
|
63
|
+
gridAutoFlow: 'dense'
|
|
64
|
+
}),
|
|
65
|
+
'row dense': (0, _react2.css)({
|
|
66
|
+
gridAutoFlow: 'row dense'
|
|
67
|
+
}),
|
|
68
|
+
'column dense': (0, _react2.css)({
|
|
69
|
+
gridAutoFlow: 'column dense'
|
|
70
|
+
})
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* __Grid__
|
|
75
|
+
*
|
|
76
|
+
* `Grid` is a primitive component that implements the CSS Grid API.
|
|
77
|
+
*
|
|
78
|
+
* - [Examples](https://atlassian.design/components/primitives/grid/examples)
|
|
79
|
+
* - [Code](https://atlassian.design/components/primitives/grid/code)
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```tsx
|
|
83
|
+
* import { Grid, Box } from '@atlaskit/primitives'
|
|
84
|
+
*
|
|
85
|
+
* const Component = () => (
|
|
86
|
+
* <Grid gap="space.100" gridColumns="1fr 1fr">
|
|
87
|
+
* <Box padding="space.100" backgroundColor="neutral"></Box>
|
|
88
|
+
* <Box padding="space.100" backgroundColor="neutral"></Box>
|
|
89
|
+
* </Grid>
|
|
90
|
+
* )
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
var Grid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
94
|
+
var as = _ref.as,
|
|
95
|
+
alignItems = _ref.alignItems,
|
|
96
|
+
justifyContent = _ref.justifyContent,
|
|
97
|
+
gap = _ref.gap,
|
|
98
|
+
columnGap = _ref.columnGap,
|
|
99
|
+
rowGap = _ref.rowGap,
|
|
100
|
+
children = _ref.children,
|
|
101
|
+
testId = _ref.testId,
|
|
102
|
+
autoFlow = _ref.autoFlow,
|
|
103
|
+
gridTemplateAreas = _ref.templateAreas,
|
|
104
|
+
gridTemplateRows = _ref.templateRows,
|
|
105
|
+
gridTemplateColumns = _ref.templateColumns,
|
|
106
|
+
xcss = _ref.xcss;
|
|
107
|
+
var Component = as || 'div';
|
|
108
|
+
var xcssClassName = xcss && (0, _xcss.parseXcss)(xcss);
|
|
109
|
+
var style = gridTemplateAreas || gridTemplateColumns || gridTemplateRows ? Object.assign({}, {
|
|
110
|
+
gridTemplateAreas: gridTemplateAreas ? gridTemplateAreas.map(function (str) {
|
|
111
|
+
return "\"".concat(str, "\"");
|
|
112
|
+
}).join('\n') : undefined,
|
|
113
|
+
gridTemplateColumns: gridTemplateColumns,
|
|
114
|
+
gridTemplateRows: gridTemplateRows
|
|
115
|
+
}) : undefined;
|
|
116
|
+
return (0, _react2.jsx)(Component, {
|
|
117
|
+
style: style,
|
|
118
|
+
css: [baseStyles, gap && _styleMaps.spaceStylesMap.gap[gap], columnGap && _styleMaps.spaceStylesMap.columnGap[columnGap], rowGap && _styleMaps.spaceStylesMap.rowGap[rowGap], alignItems && alignItemsMap[alignItems], justifyContent && justifyContentMap[justifyContent], autoFlow && gridAutoFlowMap[autoFlow],
|
|
119
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
120
|
+
xcssClassName && xcssClassName],
|
|
121
|
+
"data-testid": testId,
|
|
122
|
+
ref: ref
|
|
123
|
+
}, children);
|
|
124
|
+
}));
|
|
125
|
+
Grid.displayName = 'Grid';
|
|
126
|
+
var _default = Grid;
|
|
127
|
+
exports.default = _default;
|