@atlaskit/primitives 1.0.5 → 1.0.6
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/constellation/bleed/example.mdx +2 -0
- package/constellation/box/examples.mdx +6 -0
- package/constellation/flex/examples.mdx +7 -2
- package/constellation/grid/examples.mdx +3 -0
- package/constellation/inline/examples.mdx +6 -0
- package/constellation/overview/index.mdx +12 -15
- package/constellation/responsive/01-show/code.mdx +19 -0
- package/constellation/responsive/02-hide/code.mdx +19 -0
- package/constellation/stack/examples.mdx +5 -0
- package/dist/cjs/components/inline.js +1 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/inline.js +1 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/inline.js +1 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/components/inline.d.ts +1 -2
- package/dist/types/responsive/hide.d.ts +8 -10
- package/dist/types/responsive/show.d.ts +8 -10
- package/dist/types-ts4.5/components/inline.d.ts +1 -2
- package/dist/types-ts4.5/responsive/hide.d.ts +8 -10
- package/dist/types-ts4.5/responsive/show.d.ts +8 -10
- package/extract-react-types/hide-props.tsx +48 -0
- package/extract-react-types/show-props.tsx +48 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/primitives
|
|
2
2
|
|
|
3
|
+
## 1.0.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`aa8ec75ace3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/aa8ec75ace3) - Simplify types for `Show` and `Hide` components. There should be no difference in behavior.
|
|
8
|
+
|
|
3
9
|
## 1.0.5
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -36,11 +36,13 @@ each avatar to overlap its direct sibling and create our desired stack.
|
|
|
36
36
|
## Block whitespace
|
|
37
37
|
|
|
38
38
|
Bleed can be controlled on the block axis (vertical) with the `block` property. The values of this property are tied to our spacing scale.
|
|
39
|
+
Note, in the context of a flex container bleed will collapse the whitespace around its child element.
|
|
39
40
|
|
|
40
41
|
<Example Component={BleedBlock} packageName="@atlaskit/primitives/bleed" />
|
|
41
42
|
|
|
42
43
|
## Inline whitespace
|
|
43
44
|
|
|
44
45
|
Bleed can also be controlled on the inline axis (horizontal) with the `inline` property. The values of this property are tied to our spacing scale.
|
|
46
|
+
Note, in the context of a flex container bleed will collapse the whitespace around its child element.
|
|
45
47
|
|
|
46
48
|
<Example Component={BleedInline} packageName="@atlaskit/primitives/bleed" />
|
|
@@ -8,6 +8,8 @@ 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 PracticalUseCase from '../../examples/constellation/box/practical-use-case';
|
|
12
|
+
|
|
11
13
|
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
12
14
|
|
|
13
15
|
<CodeDocsHeader
|
|
@@ -43,3 +45,7 @@ Box also exposes an `xcss` prop. This prop can take `xcss` function calls that c
|
|
|
43
45
|
<Example Component={BoxXcss} packageName="@atlaskit/primitives/box" />
|
|
44
46
|
|
|
45
47
|
For more information on xCSS, see the dedicated [xCSS](/components/primitives/xcss) documentation.
|
|
48
|
+
|
|
49
|
+
## Practical Use Case
|
|
50
|
+
|
|
51
|
+
<Example Component={PracticalUseCase} packageName="@atlaskit/primitives/box" />
|
|
@@ -21,11 +21,16 @@ import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
|
21
21
|
## Basic
|
|
22
22
|
|
|
23
23
|
The `Flex` component is designed as a very basic mapping to the CSS Flexbox API.
|
|
24
|
-
It can be used as a less richly-configured `Inline` or `Stack`.
|
|
24
|
+
It can be used as a less richly-configured `Inline` or `Stack`. Like `Stack` and `Inline`
|
|
25
|
+
`Flex` exclusively supports token-backed `gap` properties to ensure layouts using `Flex` match
|
|
26
|
+
the Atlassian Design System spacing scale.
|
|
25
27
|
|
|
26
28
|
<Example Component={FlexJustifyContent} packageName="@atlaskit/primitives/flex" />
|
|
27
29
|
|
|
28
|
-
## Align items
|
|
30
|
+
## Align items and justify content
|
|
31
|
+
|
|
32
|
+
`Flex` applies the `alignItems` and `justifyContent` properties to align content
|
|
33
|
+
along its cross and main axes respectively.
|
|
29
34
|
|
|
30
35
|
<Example Component={FlexAlignItems} packageName="@atlaskit/primitives/flex" />
|
|
31
36
|
|
|
@@ -44,3 +44,6 @@ Grid-prefixed properties in CSS do not have this prefix in the component API. `g
|
|
|
44
44
|
|
|
45
45
|
<Example Component={GridAutoFlow} packageName="@atlaskit/primitives/grid" />
|
|
46
46
|
|
|
47
|
+
You may also be looking for:
|
|
48
|
+
* [responsive layout grid](/components/grid)
|
|
49
|
+
* [legacy page grid](/components/page/grid)
|
|
@@ -14,6 +14,7 @@ import InlineWrap from '../../examples/constellation/inline/wrap';
|
|
|
14
14
|
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
|
+
import InlinePracticalUseCase from '../../examples/constellation/inline/practical-use-case';
|
|
17
18
|
|
|
18
19
|
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
19
20
|
|
|
@@ -23,6 +24,7 @@ import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
|
23
24
|
directoryName="primitives"
|
|
24
25
|
/>
|
|
25
26
|
|
|
27
|
+
|
|
26
28
|
## Basic
|
|
27
29
|
|
|
28
30
|
Inline is an abstraction to efficiently lay-out a group of elements horizontally.
|
|
@@ -89,3 +91,7 @@ To control that the `grow` prop can be used with the values:
|
|
|
89
91
|
It's possible to control the rendered HTML element with the `as` prop.
|
|
90
92
|
|
|
91
93
|
<Example Component={InlineAs} packageName="@atlaskit/primitives/inline" />
|
|
94
|
+
|
|
95
|
+
## Practical Use Case
|
|
96
|
+
|
|
97
|
+
<Example Component={InlinePracticalUseCase} packageName="@atlaskit/primitives/inline" />
|
|
@@ -19,19 +19,18 @@ import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
|
19
19
|
directoryName="primitives"
|
|
20
20
|
/>
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
They act as building blocks to compose different parts of the user experience,
|
|
22
|
+
Primitives are a new type of component for layouts and the placement of elements.
|
|
23
|
+
They act as simple building blocks to compose different parts of the user experience,
|
|
24
24
|
from the smallest design decisions (for example, the spacing around an icon) to larger layout decisions (for example, how a page is structured).
|
|
25
25
|
|
|
26
|
-
Primitives are
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
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.
|
|
26
|
+
Primitives are a combination of design tokens that go a step further.
|
|
27
|
+
These are component-like abstractions powered by design tokens that add a layer of ergonomics and accessibility. Tokens are great at describing the what of a design decision;
|
|
28
|
+
primitives make it easier to reason about the when and how. This reduces cognitive overhead and prevents accidents or mistakes.
|
|
31
29
|
|
|
32
30
|
## Available Primitives
|
|
33
31
|
|
|
34
|
-
Each primitive is designed to have a single responsibility, and it should be immediately clear where each primitive should be used.
|
|
32
|
+
Each primitive is designed to have a single responsibility, and it should be immediately clear where and when each primitive should be used.
|
|
33
|
+
However, they are also flexible enough that they should be able to be used together to compose complex designs not otherwise implemented directly in the Design Systems.
|
|
35
34
|
|
|
36
35
|
Currently, three core primitive components are available - Box, Inline and Stack. A large amount of layout problems can be reduced to laying out content:
|
|
37
36
|
- in a container (see [box](/components/primitives/box))
|
|
@@ -41,7 +40,7 @@ Currently, three core primitive components are available - Box, Inline and Stack
|
|
|
41
40
|
Additional layouts not well-expressed by these core primitives can also be composed using:
|
|
42
41
|
- CSS Flexbox (see [flex](/components/primitives/flex))
|
|
43
42
|
- CSS Grid (see [grid](/components/primitives/grid))
|
|
44
|
-
-
|
|
43
|
+
- Bleed (see [bleed](/components/primitives/bleed))
|
|
45
44
|
|
|
46
45
|
## Installation
|
|
47
46
|
|
|
@@ -52,15 +51,13 @@ $ yarn add @atlaskit/primitives
|
|
|
52
51
|
|
|
53
52
|
## Using Primitives
|
|
54
53
|
|
|
55
|
-
Use primitives for
|
|
54
|
+
Use primitives for composing layouts.
|
|
56
55
|
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.
|
|
57
56
|
This involves breaking down a design into its core layout components to as granular level as is useful.
|
|
58
57
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
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.
|
|
58
|
+
You might like to think first about breaking down a page into `Box` containers,
|
|
59
|
+
identifying larger pieces of a design that function in a similar manner or fulfill a singular purpose
|
|
60
|
+
in a layout and grouping them together under a Box.
|
|
64
61
|
|
|
65
62
|
<Image src={boxUsageExample} />
|
|
66
63
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Show
|
|
3
|
+
description: Show is a responsive primitive that displays children at specified breakpoints
|
|
4
|
+
order: 2
|
|
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 ShowProps from '!!extract-react-types-loader!../../../extract-react-types/show-props'
|
|
16
|
+
|
|
17
|
+
## Props
|
|
18
|
+
|
|
19
|
+
<PropsTable heading="" props={ShowProps} />
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Hide
|
|
3
|
+
description: Hide is a responsive primitive that hides children at specified breakpoints
|
|
4
|
+
order: 2
|
|
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 HideProps from '!!extract-react-types-loader!../../../extract-react-types/hide-props'
|
|
16
|
+
|
|
17
|
+
## Props
|
|
18
|
+
|
|
19
|
+
<PropsTable heading="" props={HideProps} />
|
|
@@ -5,6 +5,7 @@ order: 0
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
import StackBasic from '../../examples/constellation/stack/basic';
|
|
8
|
+
import PracticalUseCase from '../../examples/constellation/stack/practical-use-case';
|
|
8
9
|
import StackSpaceBasic from '../../examples/constellation/stack/space-basic';
|
|
9
10
|
import StackAlignBlock from '../../examples/constellation/stack/align-block';
|
|
10
11
|
import StackAlignInline from '../../examples/constellation/stack/align-inline';
|
|
@@ -68,3 +69,7 @@ To control that the `grow` prop can be used with the values:
|
|
|
68
69
|
It's possible to control the rendered HTML element with the `as` prop.
|
|
69
70
|
|
|
70
71
|
<Example Component={StackAs} packageName="@atlaskit/primitives/stack" />
|
|
72
|
+
|
|
73
|
+
## Practical Use Case
|
|
74
|
+
|
|
75
|
+
<Example Component={PracticalUseCase} packageName="@atlaskit/primitives/stack" />
|
|
@@ -39,8 +39,7 @@ var Separator = function Separator(_ref) {
|
|
|
39
39
|
/**
|
|
40
40
|
* __Inline__
|
|
41
41
|
*
|
|
42
|
-
* Inline is a primitive component based on
|
|
43
|
-
*
|
|
42
|
+
* Inline is a primitive component based on CSS Flexbox that manages the horizontal layout of direct children.
|
|
44
43
|
*
|
|
45
44
|
* @example
|
|
46
45
|
* ```tsx
|
package/dist/cjs/version.json
CHANGED
|
@@ -29,8 +29,7 @@ const Separator = ({
|
|
|
29
29
|
/**
|
|
30
30
|
* __Inline__
|
|
31
31
|
*
|
|
32
|
-
* Inline is a primitive component based on
|
|
33
|
-
*
|
|
32
|
+
* Inline is a primitive component based on CSS Flexbox that manages the horizontal layout of direct children.
|
|
34
33
|
*
|
|
35
34
|
* @example
|
|
36
35
|
* ```tsx
|
package/dist/es2019/version.json
CHANGED
|
@@ -31,8 +31,7 @@ var Separator = function Separator(_ref) {
|
|
|
31
31
|
/**
|
|
32
32
|
* __Inline__
|
|
33
33
|
*
|
|
34
|
-
* Inline is a primitive component based on
|
|
35
|
-
*
|
|
34
|
+
* Inline is a primitive component based on CSS Flexbox that manages the horizontal layout of direct children.
|
|
36
35
|
*
|
|
37
36
|
* @example
|
|
38
37
|
* ```tsx
|
package/dist/esm/version.json
CHANGED
|
@@ -56,8 +56,7 @@ export type Grow = 'hug' | 'fill';
|
|
|
56
56
|
/**
|
|
57
57
|
* __Inline__
|
|
58
58
|
*
|
|
59
|
-
* Inline is a primitive component based on
|
|
60
|
-
*
|
|
59
|
+
* Inline is a primitive component based on CSS Flexbox that manages the horizontal layout of direct children.
|
|
61
60
|
*
|
|
62
61
|
* @example
|
|
63
62
|
* ```tsx
|
|
@@ -6,24 +6,22 @@ type As = 'article' | 'aside' | 'dialog' | 'div' | 'footer' | 'header' | 'li' |
|
|
|
6
6
|
type ResponsiveHideProps = {
|
|
7
7
|
as?: As;
|
|
8
8
|
children: ReactNode;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* The smallest breakpoint is not included as it would always be shown and this would not be performant.
|
|
12
|
-
*
|
|
13
|
-
* @important do not mix `above` and `below` (TypeScript should prevent this)
|
|
14
|
-
*/
|
|
15
|
-
above?: Exclude<Breakpoint, 'xxs'>;
|
|
9
|
+
} & ({
|
|
10
|
+
above?: never;
|
|
16
11
|
/**
|
|
17
12
|
* Apply CSS to hide this specifically **below** this breakpoint.
|
|
18
13
|
* The smallest breakpoint is not included as it would never be shown and this would not be performant.
|
|
19
14
|
*
|
|
20
15
|
* @important do not mix `above` and `below` (TypeScript should prevent this)
|
|
21
16
|
*/
|
|
22
|
-
below?: Exclude<Breakpoint, 'xxs'>;
|
|
23
|
-
} & ({
|
|
24
|
-
above?: never;
|
|
25
17
|
below: Exclude<Breakpoint, 'xxs'>;
|
|
26
18
|
} | {
|
|
19
|
+
/**
|
|
20
|
+
* Apply CSS to hide this specifically **above** this breakpoint.
|
|
21
|
+
* The smallest breakpoint is not included as it would always be shown and this would not be performant.
|
|
22
|
+
*
|
|
23
|
+
* @important do not mix `above` and `below` (TypeScript should prevent this)
|
|
24
|
+
*/
|
|
27
25
|
above: Exclude<Breakpoint, 'xxs'>;
|
|
28
26
|
below?: never;
|
|
29
27
|
});
|
|
@@ -6,24 +6,22 @@ type As = 'article' | 'aside' | 'dialog' | 'div' | 'footer' | 'header' | 'li' |
|
|
|
6
6
|
type ResponsiveShowProps = {
|
|
7
7
|
as?: As;
|
|
8
8
|
children: ReactNode;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* The smallest breakpoint is not included as it would always be shown and this would not be performant.
|
|
12
|
-
*
|
|
13
|
-
* @important do not mix `above` and `below` (TypeScript should prevent this)
|
|
14
|
-
*/
|
|
15
|
-
above?: Exclude<Breakpoint, 'xxs'>;
|
|
9
|
+
} & ({
|
|
10
|
+
above?: never;
|
|
16
11
|
/**
|
|
17
12
|
* Apply CSS to show this specifically **below** this breakpoint.
|
|
18
13
|
* The smallest breakpoint is not included as it would never be shown and this would not be performant.
|
|
19
14
|
*
|
|
20
15
|
* @important do not mix `above` and `below` (TypeScript should prevent this)
|
|
21
16
|
*/
|
|
22
|
-
below?: Exclude<Breakpoint, 'xxs'>;
|
|
23
|
-
} & ({
|
|
24
|
-
above?: never;
|
|
25
17
|
below: Exclude<Breakpoint, 'xxs'>;
|
|
26
18
|
} | {
|
|
19
|
+
/**
|
|
20
|
+
* Apply CSS to show this specifically **above** this breakpoint.
|
|
21
|
+
* The smallest breakpoint is not included as it would always be shown and this would not be performant.
|
|
22
|
+
*
|
|
23
|
+
* @important do not mix `above` and `below` (TypeScript should prevent this)
|
|
24
|
+
*/
|
|
27
25
|
above: Exclude<Breakpoint, 'xxs'>;
|
|
28
26
|
below?: never;
|
|
29
27
|
});
|
|
@@ -56,8 +56,7 @@ export type Grow = 'hug' | 'fill';
|
|
|
56
56
|
/**
|
|
57
57
|
* __Inline__
|
|
58
58
|
*
|
|
59
|
-
* Inline is a primitive component based on
|
|
60
|
-
*
|
|
59
|
+
* Inline is a primitive component based on CSS Flexbox that manages the horizontal layout of direct children.
|
|
61
60
|
*
|
|
62
61
|
* @example
|
|
63
62
|
* ```tsx
|
|
@@ -6,24 +6,22 @@ type As = 'article' | 'aside' | 'dialog' | 'div' | 'footer' | 'header' | 'li' |
|
|
|
6
6
|
type ResponsiveHideProps = {
|
|
7
7
|
as?: As;
|
|
8
8
|
children: ReactNode;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* The smallest breakpoint is not included as it would always be shown and this would not be performant.
|
|
12
|
-
*
|
|
13
|
-
* @important do not mix `above` and `below` (TypeScript should prevent this)
|
|
14
|
-
*/
|
|
15
|
-
above?: Exclude<Breakpoint, 'xxs'>;
|
|
9
|
+
} & ({
|
|
10
|
+
above?: never;
|
|
16
11
|
/**
|
|
17
12
|
* Apply CSS to hide this specifically **below** this breakpoint.
|
|
18
13
|
* The smallest breakpoint is not included as it would never be shown and this would not be performant.
|
|
19
14
|
*
|
|
20
15
|
* @important do not mix `above` and `below` (TypeScript should prevent this)
|
|
21
16
|
*/
|
|
22
|
-
below?: Exclude<Breakpoint, 'xxs'>;
|
|
23
|
-
} & ({
|
|
24
|
-
above?: never;
|
|
25
17
|
below: Exclude<Breakpoint, 'xxs'>;
|
|
26
18
|
} | {
|
|
19
|
+
/**
|
|
20
|
+
* Apply CSS to hide this specifically **above** this breakpoint.
|
|
21
|
+
* The smallest breakpoint is not included as it would always be shown and this would not be performant.
|
|
22
|
+
*
|
|
23
|
+
* @important do not mix `above` and `below` (TypeScript should prevent this)
|
|
24
|
+
*/
|
|
27
25
|
above: Exclude<Breakpoint, 'xxs'>;
|
|
28
26
|
below?: never;
|
|
29
27
|
});
|
|
@@ -6,24 +6,22 @@ type As = 'article' | 'aside' | 'dialog' | 'div' | 'footer' | 'header' | 'li' |
|
|
|
6
6
|
type ResponsiveShowProps = {
|
|
7
7
|
as?: As;
|
|
8
8
|
children: ReactNode;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* The smallest breakpoint is not included as it would always be shown and this would not be performant.
|
|
12
|
-
*
|
|
13
|
-
* @important do not mix `above` and `below` (TypeScript should prevent this)
|
|
14
|
-
*/
|
|
15
|
-
above?: Exclude<Breakpoint, 'xxs'>;
|
|
9
|
+
} & ({
|
|
10
|
+
above?: never;
|
|
16
11
|
/**
|
|
17
12
|
* Apply CSS to show this specifically **below** this breakpoint.
|
|
18
13
|
* The smallest breakpoint is not included as it would never be shown and this would not be performant.
|
|
19
14
|
*
|
|
20
15
|
* @important do not mix `above` and `below` (TypeScript should prevent this)
|
|
21
16
|
*/
|
|
22
|
-
below?: Exclude<Breakpoint, 'xxs'>;
|
|
23
|
-
} & ({
|
|
24
|
-
above?: never;
|
|
25
17
|
below: Exclude<Breakpoint, 'xxs'>;
|
|
26
18
|
} | {
|
|
19
|
+
/**
|
|
20
|
+
* Apply CSS to show this specifically **above** this breakpoint.
|
|
21
|
+
* The smallest breakpoint is not included as it would always be shown and this would not be performant.
|
|
22
|
+
*
|
|
23
|
+
* @important do not mix `above` and `below` (TypeScript should prevent this)
|
|
24
|
+
*/
|
|
27
25
|
above: Exclude<Breakpoint, 'xxs'>;
|
|
28
26
|
below?: never;
|
|
29
27
|
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Breakpoint } from '../src/responsive/types';
|
|
4
|
+
|
|
5
|
+
type As =
|
|
6
|
+
| 'article'
|
|
7
|
+
| 'aside'
|
|
8
|
+
| 'dialog'
|
|
9
|
+
| 'div'
|
|
10
|
+
| 'footer'
|
|
11
|
+
| 'header'
|
|
12
|
+
| 'li'
|
|
13
|
+
| 'main'
|
|
14
|
+
| 'nav'
|
|
15
|
+
| 'ol'
|
|
16
|
+
| 'section'
|
|
17
|
+
| 'span'
|
|
18
|
+
| 'ul';
|
|
19
|
+
|
|
20
|
+
type ResponsiveHideProps = {
|
|
21
|
+
/**
|
|
22
|
+
* The DOM element to render as the Box. Defaults to `div`.
|
|
23
|
+
*/
|
|
24
|
+
as?: As;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Elements to be rendered inside the primitive.
|
|
28
|
+
*/
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Apply CSS to hide this specifically **above** this breakpoint.
|
|
33
|
+
* The smallest breakpoint is not included as it would always be shown and this would not be performant.
|
|
34
|
+
*
|
|
35
|
+
* @important do not mix `above` and `below` (TypeScript should prevent this)
|
|
36
|
+
*/
|
|
37
|
+
above?: Exclude<Breakpoint, 'xxs'>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Apply CSS to hide this specifically **below** this breakpoint.
|
|
41
|
+
* The smallest breakpoint is not included as it would never be shown and this would not be performant.
|
|
42
|
+
*
|
|
43
|
+
* @important do not mix `above` and `below` (TypeScript should prevent this)
|
|
44
|
+
*/
|
|
45
|
+
below?: Exclude<Breakpoint, 'xxs'>;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default function Hide(_: ResponsiveHideProps) {}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Breakpoint } from '../src/responsive/types';
|
|
4
|
+
|
|
5
|
+
type As =
|
|
6
|
+
| 'article'
|
|
7
|
+
| 'aside'
|
|
8
|
+
| 'dialog'
|
|
9
|
+
| 'div'
|
|
10
|
+
| 'footer'
|
|
11
|
+
| 'header'
|
|
12
|
+
| 'li'
|
|
13
|
+
| 'main'
|
|
14
|
+
| 'nav'
|
|
15
|
+
| 'ol'
|
|
16
|
+
| 'section'
|
|
17
|
+
| 'span'
|
|
18
|
+
| 'ul';
|
|
19
|
+
|
|
20
|
+
type ResponsiveShowProps = {
|
|
21
|
+
/**
|
|
22
|
+
* The DOM element to render as the Box. Defaults to `div`.
|
|
23
|
+
*/
|
|
24
|
+
as?: As;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Elements to be rendered inside the primitive.
|
|
28
|
+
*/
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Apply CSS to show this specifically **above** this breakpoint.
|
|
33
|
+
* The smallest breakpoint is not included as it would always be shown and this would not be performant.
|
|
34
|
+
*
|
|
35
|
+
* @important do not mix `above` and `below` (TypeScript should prevent this)
|
|
36
|
+
*/
|
|
37
|
+
above?: Exclude<Breakpoint, 'xxs'>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Apply CSS to show this specifically **below** this breakpoint.
|
|
41
|
+
* The smallest breakpoint is not included as it would never be shown and this would not be performant.
|
|
42
|
+
*
|
|
43
|
+
* @important do not mix `above` and `below` (TypeScript should prevent this)
|
|
44
|
+
*/
|
|
45
|
+
below?: Exclude<Breakpoint, 'xxs'>;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default function Show(_: ResponsiveShowProps) {}
|