@atlaskit/primitives 7.0.0 → 7.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/.eslintrc.js +1 -1
- package/CHANGELOG.md +10 -1
- package/LICENSE.md +6 -8
- package/constellation/anchor/code.mdx +3 -3
- package/constellation/anchor/examples.mdx +33 -39
- package/constellation/anchor/usage.mdx +60 -30
- package/constellation/bleed/code.mdx +3 -3
- package/constellation/bleed/examples.mdx +17 -13
- package/constellation/box/code.mdx +3 -3
- package/constellation/box/examples.mdx +25 -19
- package/constellation/box/usage.mdx +15 -5
- package/constellation/flex/code.mdx +3 -3
- package/constellation/flex/examples.mdx +12 -11
- package/constellation/grid/code.mdx +3 -3
- package/constellation/grid/examples.mdx +15 -10
- package/constellation/inline/code.mdx +3 -3
- package/constellation/inline/examples.mdx +32 -38
- package/constellation/inline/usage.mdx +15 -6
- package/constellation/overview/index.mdx +29 -27
- package/constellation/pressable/code.mdx +5 -4
- package/constellation/pressable/examples.mdx +35 -52
- package/constellation/pressable/usage.mdx +50 -29
- package/constellation/responsive/01-show/code.mdx +3 -3
- package/constellation/responsive/01-show/examples.mdx +9 -13
- package/constellation/responsive/02-hide/code.mdx +3 -3
- package/constellation/responsive/02-hide/examples.mdx +9 -13
- package/constellation/responsive/03-breakpoints/examples.mdx +3 -3
- package/constellation/responsive/examples.mdx +10 -10
- package/constellation/responsive/usage.mdx +23 -15
- package/constellation/stack/code.mdx +3 -3
- package/constellation/stack/examples.mdx +26 -20
- package/constellation/stack/usage.mdx +13 -5
- package/constellation/text/code.mdx +3 -3
- package/constellation/text/examples.mdx +29 -15
- package/constellation/text/usage.mdx +6 -3
- package/constellation/xcss/examples.mdx +7 -5
- package/constellation/xcss/migration.mdx +32 -25
- package/constellation/xcss/usage.mdx +72 -60
- package/dist/cjs/components/anchor.js +1 -1
- package/dist/cjs/components/pressable.js +1 -1
- package/dist/cjs/xcss/style-maps.partial.js +13 -13
- package/dist/es2019/components/anchor.js +1 -1
- package/dist/es2019/components/pressable.js +1 -1
- package/dist/es2019/xcss/style-maps.partial.js +13 -13
- package/dist/esm/components/anchor.js +1 -1
- package/dist/esm/components/pressable.js +1 -1
- package/dist/esm/xcss/style-maps.partial.js +13 -13
- package/dist/types/responsive/index.d.ts +2 -2
- package/dist/types/xcss/style-maps.partial.d.ts +13 -13
- package/dist/types-ts4.5/responsive/index.d.ts +2 -2
- package/dist/types-ts4.5/xcss/style-maps.partial.d.ts +13 -13
- package/extract-react-types/anchor-props.tsx +108 -116
- package/extract-react-types/bleed-props.tsx +17 -22
- package/extract-react-types/box-props.tsx +67 -70
- package/extract-react-types/flex-props.tsx +61 -61
- package/extract-react-types/grid-props.tsx +92 -92
- package/extract-react-types/hide-props.tsx +35 -35
- package/extract-react-types/inline-props.tsx +68 -68
- package/extract-react-types/pressable-props.tsx +101 -107
- package/extract-react-types/show-props.tsx +35 -35
- package/extract-react-types/stack-props.tsx +55 -55
- package/package.json +2 -2
- package/report.api.md +940 -965
- package/scripts/border-codegen-template.tsx +40 -47
- package/scripts/codegen-file-templates/dimensions.tsx +8 -8
- package/scripts/codegen-file-templates/layer.tsx +9 -9
- package/scripts/codegen-styles.tsx +97 -103
- package/scripts/color-codegen-template.tsx +61 -73
- package/scripts/elevation-codegen-template.tsx +50 -62
- package/scripts/inverse-color-map-template.tsx +26 -31
- package/scripts/misc-codegen-template.tsx +4 -9
- package/scripts/spacing-codegen-template.tsx +25 -31
- package/scripts/typography-codegen-template.tsx +59 -65
- package/scripts/utils.tsx +36 -43
package/.eslintrc.js
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/primitives
|
|
2
2
|
|
|
3
|
+
## 7.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#110191](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/110191)
|
|
8
|
+
[`c3dc02298f8aa`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c3dc02298f8aa) -
|
|
9
|
+
[ux] Change heading xsmall lineheight from 16 to 20 for minor third theme.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 7.0.0
|
|
4
13
|
|
|
5
14
|
### Major Changes
|
|
@@ -98,7 +107,7 @@
|
|
|
98
107
|
|
|
99
108
|
- [#93706](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/93706)
|
|
100
109
|
[`2e4fdfa436da`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2e4fdfa436da) -
|
|
101
|
-
Add support for React 18.
|
|
110
|
+
Add support for React 18 in non-strict mode.
|
|
102
111
|
|
|
103
112
|
## 5.6.1
|
|
104
113
|
|
package/LICENSE.md
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
Copyright 2022 Atlassian Pty Ltd
|
|
2
2
|
|
|
3
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
|
|
5
|
-
You may obtain a copy of the License at
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
|
|
4
|
+
compliance with the License. You may obtain a copy of the License at
|
|
6
5
|
|
|
7
6
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
7
|
|
|
9
|
-
Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
distributed
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
limitations under the License.
|
|
8
|
+
Unless required by applicable law or agreed to in writing, software distributed under the License is
|
|
9
|
+
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
10
|
+
implied. See the License for the specific language governing permissions and limitations under the
|
|
11
|
+
License.
|
|
@@ -7,9 +7,9 @@ order: 1
|
|
|
7
7
|
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
8
8
|
|
|
9
9
|
<CodeDocsHeader
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
name="@atlaskit/primitives"
|
|
11
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
12
|
+
directoryName="primitives"
|
|
13
13
|
/>
|
|
14
14
|
|
|
15
15
|
import ERTAnchor from '!!extract-react-types-loader!../../extract-react-types/anchor-props';
|
|
@@ -17,26 +17,31 @@ import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
|
17
17
|
import SectionMessage from '@atlaskit/section-message';
|
|
18
18
|
|
|
19
19
|
<CodeDocsHeader
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
name="@atlaskit/primitives"
|
|
21
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
22
|
+
directoryName="primitives"
|
|
23
23
|
/>
|
|
24
24
|
|
|
25
|
-
Anchor is a primitive for building custom links with Atlassian Design System styling, routing
|
|
25
|
+
Anchor is a primitive for building custom links with Atlassian Design System styling, routing
|
|
26
|
+
support, and built-in event tracking. It renders an anchor `<a>` element.
|
|
26
27
|
|
|
27
|
-
Only use anchor when existing components such as [link](/components/link/examples) or
|
|
28
|
+
Only use anchor when existing components such as [link](/components/link/examples) or
|
|
29
|
+
[link button](/components/button/link-button/examples) can't be customized to fit your needs.
|
|
28
30
|
|
|
29
31
|
## Default
|
|
30
32
|
|
|
31
|
-
Anchor is unstyled besides a default underline and consistent Atlassian Design System `:focus`
|
|
33
|
+
Anchor is unstyled besides a default underline and consistent Atlassian Design System `:focus`
|
|
34
|
+
styles.
|
|
32
35
|
|
|
33
|
-
If you are using the [CSS reset](/components/css-reset/examples), anchor will also inherit some
|
|
36
|
+
If you are using the [CSS reset](/components/css-reset/examples), anchor will also inherit some
|
|
37
|
+
global styles.
|
|
34
38
|
|
|
35
39
|
<Example Component={AnchorDefault} packageName="@atlaskit/primitives/anchor" />
|
|
36
40
|
|
|
37
41
|
## Basic styling with XCSS
|
|
38
42
|
|
|
39
|
-
Anchor can be styled further using the design system styling API,
|
|
43
|
+
Anchor can be styled further using the design system styling API,
|
|
44
|
+
[XCSS](/components/primitives/xcss).
|
|
40
45
|
|
|
41
46
|
<Example Component={AnchorBasic} packageName="@atlaskit/primitives/anchor" />
|
|
42
47
|
|
|
@@ -48,20 +53,24 @@ Use a combination of XCSS and other primitives for more complex designs.
|
|
|
48
53
|
|
|
49
54
|
## HTML attributes
|
|
50
55
|
|
|
51
|
-
Anchor can pass all valid
|
|
56
|
+
Anchor can pass all valid
|
|
57
|
+
[anchor HTML attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attributes),
|
|
58
|
+
such as `rel` or `download`, to the underlying `<a>` element.
|
|
52
59
|
|
|
53
|
-
<Example
|
|
54
|
-
Component={AnchorHtmlAttributes}
|
|
55
|
-
packageName="@atlaskit/primitives/anchor"
|
|
56
|
-
/>
|
|
60
|
+
<Example Component={AnchorHtmlAttributes} packageName="@atlaskit/primitives/anchor" />
|
|
57
61
|
|
|
58
62
|
## Router links
|
|
59
63
|
|
|
60
|
-
Routing libraries often supply link components enhanced with routing support. You can configure this
|
|
64
|
+
Routing libraries often supply link components enhanced with routing support. You can configure this
|
|
65
|
+
in the [AppProvider context](/components/app-provider/examples#router-links), and anchor will
|
|
66
|
+
automatically use it.
|
|
61
67
|
|
|
62
|
-
This example shows a configuration for
|
|
68
|
+
This example shows a configuration for
|
|
69
|
+
[React Resource Router](https://github.com/atlassian-labs/react-resource-router), however any
|
|
70
|
+
routing library can be used.
|
|
63
71
|
|
|
64
|
-
Using this method, anchor accepts `href` as a string for standard usage. For advanced usage, an
|
|
72
|
+
Using this method, anchor accepts `href` as a string for standard usage. For advanced usage, an
|
|
73
|
+
object can be passed.
|
|
65
74
|
|
|
66
75
|
Anchor will only render a router link if:
|
|
67
76
|
|
|
@@ -70,34 +79,19 @@ Anchor will only render a router link if:
|
|
|
70
79
|
- it's not a non-HTTP-based link (e.g. emails, phone numbers, hash links etc.).
|
|
71
80
|
|
|
72
81
|
<Example
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
82
|
+
Component={AnchorRouterLinkConfiguration}
|
|
83
|
+
packageName="@atlaskit/primitives/anchor"
|
|
84
|
+
appearance="source-only"
|
|
76
85
|
/>
|
|
77
86
|
|
|
78
|
-
<Snippet
|
|
79
|
-
name="primitives-event-tracking-header"
|
|
80
|
-
variables={{ componentName: 'anchor' }}
|
|
81
|
-
/>
|
|
87
|
+
<Snippet name="primitives-event-tracking-header" variables={{ componentName: 'anchor' }} />
|
|
82
88
|
|
|
83
|
-
<Example
|
|
84
|
-
Component={AnchorAnalytics}
|
|
85
|
-
packageName="@atlaskit/primitives/anchor"
|
|
86
|
-
/>
|
|
89
|
+
<Example Component={AnchorAnalytics} packageName="@atlaskit/primitives/anchor" />
|
|
87
90
|
|
|
88
91
|
<Snippet name="primitives-event-tracking-gasv3" />
|
|
89
92
|
|
|
90
|
-
<Example
|
|
91
|
-
Component={AnchorAnalyticsGASv3}
|
|
92
|
-
packageName="@atlaskit/primitives/anchor"
|
|
93
|
-
/>
|
|
93
|
+
<Example Component={AnchorAnalyticsGASv3} packageName="@atlaskit/primitives/anchor" />
|
|
94
94
|
|
|
95
|
-
<Snippet
|
|
96
|
-
name="primitives-event-tracking-ufo"
|
|
97
|
-
variables={{ componentName: 'anchor' }}
|
|
98
|
-
/>
|
|
95
|
+
<Snippet name="primitives-event-tracking-ufo" variables={{ componentName: 'anchor' }} />
|
|
99
96
|
|
|
100
|
-
<Example
|
|
101
|
-
Component={AnchorPressTracing}
|
|
102
|
-
packageName="@atlaskit/primitives/anchor"
|
|
103
|
-
/>
|
|
97
|
+
<Example Component={AnchorPressTracing} packageName="@atlaskit/primitives/anchor" />
|
|
@@ -6,55 +6,72 @@ order: 2
|
|
|
6
6
|
|
|
7
7
|
## Usage
|
|
8
8
|
|
|
9
|
-
Use an anchor to make elements that work like hyperlinks. Anchors can navigate to any linkable
|
|
9
|
+
Use an anchor to make elements that work like hyperlinks. Anchors can navigate to any linkable
|
|
10
|
+
location such as a web page, a location on a page, a file download, or a `mailto` email address.
|
|
10
11
|
|
|
12
|
+
Anchor is based on the HTML `<a>` tag, but with Atlassian focus styles and analytics events built
|
|
13
|
+
in. You can customize the anchor's appearance further using our styling APIs.
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
For example, an anchor could be used to make
|
|
16
|
+
[a link card](/components/primitives/anchor/examples#advanced-styling) with a larger clickable area
|
|
17
|
+
than a typical [link](/components/link/examples).
|
|
16
18
|
|
|
17
19
|
### Use links, link buttons, or other existing components where possible
|
|
18
20
|
|
|
19
|
-
Anchor is meant for custom elements and styles that aren't possible using other components. For
|
|
21
|
+
Anchor is meant for custom elements and styles that aren't possible using other components. For
|
|
22
|
+
standard links or buttons that navigate users to a new location, use
|
|
23
|
+
[link](/components/link/examples) or [link button](/components/button/link-button/examples).
|
|
20
24
|
|
|
21
|
-
Using [existing components](/components) wherever possible makes Atlassian's UI more visually
|
|
25
|
+
Using [existing components](/components) wherever possible makes Atlassian's UI more visually
|
|
26
|
+
consistent, and these components are faster to use for most basic use cases.
|
|
22
27
|
|
|
23
28
|
## Accessibility
|
|
24
29
|
|
|
25
30
|
### Show what's clickable using underlines or other affordances
|
|
26
31
|
|
|
27
|
-
Anchors have an underline by default. This helps differentiate links from regular text, which is an
|
|
32
|
+
Anchors have an underline by default. This helps differentiate links from regular text, which is an
|
|
33
|
+
accessibility requirement. Using color alone to differentiate links isn't accessible, especially if
|
|
34
|
+
links are surrounded by other text.
|
|
28
35
|
|
|
29
|
-
Only remove underlines if the context surrounding the link makes it clear that it's interactive,
|
|
36
|
+
Only remove underlines if the context surrounding the link makes it clear that it's interactive,
|
|
37
|
+
such as in navigation or a card layout.
|
|
30
38
|
|
|
31
|
-
Also, don't underline text that isn't a link. This makes the text look clickable because it looks a
|
|
39
|
+
Also, don't underline text that isn't a link. This makes the text look clickable because it looks a
|
|
40
|
+
link.
|
|
32
41
|
|
|
33
42
|
<!-- TODO: Add do/dont images once designed (if necessary?) -->
|
|
34
43
|
|
|
35
44
|
<DoDont type="do">
|
|
36
|
-
|
|
37
|
-
|
|
45
|
+
Use underlined links in body copy. Only omit an underline if the context makes it clear the link
|
|
46
|
+
is selectable.
|
|
38
47
|
</DoDont>
|
|
39
48
|
|
|
40
49
|
<DoDont type="dont">Use underlined links in navigation.</DoDont>
|
|
41
50
|
|
|
42
|
-
For more information see
|
|
51
|
+
For more information see
|
|
52
|
+
['Understanding Use of Color (Level A)'](https://www.w3.org/WAI/WCAG22/Understanding/use-of-color.html)
|
|
53
|
+
and
|
|
54
|
+
['Failure of Success Criterion 1.4.1 due to creating links that are not visually evident without color vision'](https://www.w3.org/WAI/WCAG22/Techniques/failures/F73).
|
|
43
55
|
|
|
44
56
|
### Use anchor for links and navigation, not on-page actions
|
|
45
57
|
|
|
46
|
-
Anchors are for navigation and URL changes, while buttons are for on-page actions such as form
|
|
58
|
+
Anchors are for navigation and URL changes, while buttons are for on-page actions such as form
|
|
59
|
+
submissions or opening modals. These elements are treated differently by assistive technologies, so
|
|
60
|
+
avoid using one in place of the other.
|
|
47
61
|
|
|
48
|
-
Don't use anchor to make custom actions rather than navigation elements. To build a custom action or
|
|
49
|
-
|
|
50
|
-
More on [when to use links vs buttons](/components/button/usage#use-buttons-for-actions-and-links-for-navigation).
|
|
62
|
+
Don't use anchor to make custom actions rather than navigation elements. To build a custom action or
|
|
63
|
+
button, use the [pressable primitive](/components/primitives/pressable/examples) instead.
|
|
51
64
|
|
|
65
|
+
More on
|
|
66
|
+
[when to use links vs buttons](/components/button/usage#use-buttons-for-actions-and-links-for-navigation).
|
|
52
67
|
|
|
53
68
|
### Use descriptive link text that clarifies the purpose of the link
|
|
54
69
|
|
|
55
|
-
Don't link vague words or phrases like “here” or “learn more.” Make sure the linked text clearly
|
|
70
|
+
Don't link vague words or phrases like “here” or “learn more.” Make sure the linked text clearly
|
|
71
|
+
describes the purpose of the link for assistive technologies.
|
|
56
72
|
|
|
57
|
-
See [link content guidelines](/components/primitives/anchor/usage#content-guidelines) for details
|
|
73
|
+
See [link content guidelines](/components/primitives/anchor/usage#content-guidelines) for details
|
|
74
|
+
and examples.
|
|
58
75
|
|
|
59
76
|
<!-- TODO: Crosslink updated link content guidance. Should be info in language and grammar and link component. (snippet time?) -->
|
|
60
77
|
<!-- TODO: Add some Do/Don't images as examples -->
|
|
@@ -72,22 +89,27 @@ It might make sense for a link to open in a new window if:
|
|
|
72
89
|
- There's a risk of someone losing their current place or task
|
|
73
90
|
- The link takes the person out of the current product or to an external website
|
|
74
91
|
|
|
75
|
-
For more information see
|
|
92
|
+
For more information see
|
|
93
|
+
['G200: Opening new windows and tabs from a link only when necessary'](https://www.w3.org/TR/WCAG20-TECHS/G200.html).
|
|
76
94
|
|
|
77
95
|
### Keep links large enough to interact with
|
|
78
96
|
|
|
79
|
-
Make link text size at least 12px. Smaller text is harder to read and interact with. If anchor is
|
|
80
|
-
|
|
97
|
+
Make link text size at least 12px. Smaller text is harder to read and interact with. If anchor is
|
|
98
|
+
not used for text-based links, ensure the clickable area is at least 24 by 24 pixels for
|
|
99
|
+
accessibility unless exempt from
|
|
100
|
+
[Target Size (Minimum) (Level AA)](https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html).
|
|
81
101
|
|
|
82
102
|
## Content guidelines
|
|
83
103
|
|
|
84
104
|
### Use clear and unique link text
|
|
85
105
|
|
|
86
|
-
Try not to repeat the same link text over and over on a page. Make sure link text is clear about
|
|
106
|
+
Try not to repeat the same link text over and over on a page. Make sure link text is clear about
|
|
107
|
+
where the link will go.
|
|
87
108
|
|
|
88
109
|
### Specify download links, including file type and size
|
|
89
110
|
|
|
90
|
-
Always specify if a link triggers a download, and make the linked text clear about what exactly will
|
|
111
|
+
Always specify if a link triggers a download, and make the linked text clear about what exactly will
|
|
112
|
+
be downloaded. Include file type and size as well.
|
|
91
113
|
|
|
92
114
|
<!-- TODO: add example of this -->
|
|
93
115
|
|
|
@@ -95,17 +117,23 @@ Always specify if a link triggers a download, and make the linked text clear abo
|
|
|
95
117
|
|
|
96
118
|
Using too many links can overwhelm other, more important information on a page.
|
|
97
119
|
|
|
98
|
-
Anchors take people to a new page or location. Be mindful of whether or not the linked resource is
|
|
120
|
+
Anchors take people to a new page or location. Be mindful of whether or not the linked resource is
|
|
121
|
+
helpful or distracting to the current task.
|
|
99
122
|
|
|
100
123
|
### Links in sentences or body copy
|
|
101
124
|
|
|
102
|
-
Only link the words that are necessary to clarify where the link goes. Don't link the entire
|
|
125
|
+
Only link the words that are necessary to clarify where the link goes. Don't link the entire
|
|
126
|
+
sentence. (Linking smaller phrases can be better for internationalization when sentence structures
|
|
127
|
+
change across languages.)
|
|
103
128
|
|
|
104
|
-
Only include the verb in the linked text if it better describes the purpose the link or
|
|
129
|
+
Only include the verb in the linked text if it better describes the purpose the link or
|
|
130
|
+
differentiates it from other links and actions on the page.
|
|
105
131
|
|
|
106
132
|
For example:
|
|
107
133
|
|
|
108
|
-
> Update [Jira settings](/components/button/usage#use-buttons-for-actions-and-links-for-navigation)
|
|
134
|
+
> Update [Jira settings](/components/button/usage#use-buttons-for-actions-and-links-for-navigation)
|
|
135
|
+
> to turn off notifications. To upgrade,
|
|
136
|
+
> [sign up for Jira](/components/button/usage#use-buttons-for-actions-and-links-for-navigation).
|
|
109
137
|
|
|
110
138
|
If only Jira was linked, it wouldn't be clear that this was a sign up page.
|
|
111
139
|
|
|
@@ -113,10 +141,12 @@ If only Jira was linked, it wouldn't be clear that this was a sign up page.
|
|
|
113
141
|
|
|
114
142
|
For standalone links, link the whole phrase. Don't add punctuation.
|
|
115
143
|
|
|
116
|
-
These type of links typically follow general button or other label content rules (sentence case
|
|
144
|
+
These type of links typically follow general button or other label content rules (sentence case
|
|
145
|
+
capitalization, no punctuation, etc.)
|
|
117
146
|
|
|
118
147
|
## Related
|
|
119
148
|
|
|
120
|
-
- Use existing components such as [link](/components/link/examples) or
|
|
149
|
+
- Use existing components such as [link](/components/link/examples) or
|
|
150
|
+
[link button](/components/button/link-button/examples) wherever possible.
|
|
121
151
|
- Use [pressable primitive for custom buttons](/components/primitives/button/usage).
|
|
122
152
|
- Anchor is built on the same API as [box](/components/primitives/box/usage).
|
|
@@ -11,9 +11,9 @@ props:
|
|
|
11
11
|
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
12
12
|
|
|
13
13
|
<CodeDocsHeader
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
name="@atlaskit/primitives"
|
|
15
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
16
|
+
directoryName="primitives"
|
|
17
17
|
/>
|
|
18
18
|
|
|
19
19
|
## Props
|
|
@@ -12,37 +12,41 @@ import BleedAll from '../../examples/constellation/bleed/all';
|
|
|
12
12
|
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
13
13
|
|
|
14
14
|
<CodeDocsHeader
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
name="@atlaskit/primitives"
|
|
16
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
17
|
+
directoryName="primitives"
|
|
18
18
|
/>
|
|
19
19
|
|
|
20
20
|
## Using Bleed
|
|
21
21
|
|
|
22
|
-
Bleed is a component that allows its children to break the boundaries of its container. This is
|
|
23
|
-
that wants to negate the padding or whitespace applied by its parent in a
|
|
24
|
-
|
|
22
|
+
Bleed is a component that allows its children to break the boundaries of its container. This is
|
|
23
|
+
useful for content that wants to negate the padding or whitespace applied by its parent in a
|
|
24
|
+
controlled manner. For example in the below grid layout, the middle item bleeds across the inline
|
|
25
|
+
and block axes to overlap the gap set by the grid.
|
|
25
26
|
|
|
26
27
|
<Example Component={BleedAll} packageName="@atlaskit/primitives/bleed" />
|
|
27
28
|
|
|
28
29
|
## Bleed and no bleed
|
|
29
30
|
|
|
30
|
-
Bleed might be utilised to create a stacking effect with a group of avatars. Here each avatar is
|
|
31
|
-
container. Without a bleed, each avatar would sit directly
|
|
32
|
-
|
|
31
|
+
Bleed might be utilised to create a stacking effect with a group of avatars. Here each avatar is
|
|
32
|
+
laid out with the `Inline` parent container. Without a bleed, each avatar would sit directly
|
|
33
|
+
adjacent to its sibling. With `Bleed` we can negate the whitespace and force each avatar to overlap
|
|
34
|
+
its direct sibling and create our desired stack.
|
|
33
35
|
|
|
34
36
|
<Example Component={BleedDefault} packageName="@atlaskit/primitives/bleed" />
|
|
35
37
|
|
|
36
38
|
## Block whitespace
|
|
37
39
|
|
|
38
|
-
Bleed can be controlled on the block axis (vertical) with the `block` property. The values of this
|
|
39
|
-
Note, in the context of a flex container bleed will collapse
|
|
40
|
+
Bleed can be controlled on the block axis (vertical) with the `block` property. The values of this
|
|
41
|
+
property are tied to our spacing scale. Note, in the context of a flex container bleed will collapse
|
|
42
|
+
the whitespace around its child element.
|
|
40
43
|
|
|
41
44
|
<Example Component={BleedBlock} packageName="@atlaskit/primitives/bleed" />
|
|
42
45
|
|
|
43
46
|
## Inline whitespace
|
|
44
47
|
|
|
45
|
-
Bleed can also be controlled on the inline axis (horizontal) with the `inline` property. The values
|
|
46
|
-
Note, in the context of a flex container bleed will
|
|
48
|
+
Bleed can also be controlled on the inline axis (horizontal) with the `inline` property. The values
|
|
49
|
+
of this property are tied to our spacing scale. Note, in the context of a flex container bleed will
|
|
50
|
+
collapse the whitespace around its child element.
|
|
47
51
|
|
|
48
52
|
<Example Component={BleedInline} packageName="@atlaskit/primitives/bleed" />
|
|
@@ -11,9 +11,9 @@ props:
|
|
|
11
11
|
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
12
12
|
|
|
13
13
|
<CodeDocsHeader
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
name="@atlaskit/primitives"
|
|
15
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
16
|
+
directoryName="primitives"
|
|
17
17
|
/>
|
|
18
18
|
|
|
19
19
|
## Props
|
|
@@ -14,38 +14,44 @@ import BoxPracticalUseCase from '../../examples/constellation/box/practical-use-
|
|
|
14
14
|
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
15
15
|
|
|
16
16
|
<CodeDocsHeader
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
name="@atlaskit/primitives"
|
|
18
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
19
|
+
directoryName="primitives"
|
|
20
20
|
/>
|
|
21
21
|
|
|
22
22
|
## Basic
|
|
23
23
|
|
|
24
|
-
Box is a general-purpose container that allows for controlled use of design tokens. Use the given
|
|
25
|
-
|
|
24
|
+
Box is a general-purpose container that allows for controlled use of design tokens. Use the given
|
|
25
|
+
props to configure display behavior and styling that aligns with the Atlassian Design System. Use
|
|
26
|
+
[XCSS](/components/primitives/xcss/usage) to style primitive components safely with tokens.
|
|
26
27
|
|
|
27
28
|
<Example Component={BoxBasic} packageName="@atlaskit/primitives/box" />
|
|
28
29
|
|
|
29
30
|
## Padding
|
|
30
31
|
|
|
31
|
-
Use padding props to access spacing design tokens and control internal layout. The following example
|
|
32
|
+
Use padding props to access spacing design tokens and control internal layout. The following example
|
|
33
|
+
demonstrates how each prop works with space tokens.
|
|
32
34
|
|
|
33
35
|
<Example Component={BoxPadding} packageName="@atlaskit/primitives/box" />
|
|
34
36
|
|
|
35
|
-
The nomenclature used by these props follows
|
|
37
|
+
The nomenclature used by these props follows
|
|
38
|
+
[logical properties](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties). This
|
|
39
|
+
naming is used to support different
|
|
40
|
+
[writing modes](https://developer.mozilla.org/en-US/docs/Web/CSS/writing-mode) in Atlassian
|
|
41
|
+
products.
|
|
36
42
|
|
|
37
43
|
## Background color
|
|
38
44
|
|
|
39
|
-
Box accepts a wide variety of background colors, referenced as semantic design tokens. For the full
|
|
45
|
+
Box accepts a wide variety of background colors, referenced as semantic design tokens. For the full
|
|
46
|
+
list of color tokens, visit the [token list](/components/tokens/all-tokens).
|
|
40
47
|
|
|
41
|
-
<Example
|
|
42
|
-
Component={BoxBackgroundColor}
|
|
43
|
-
packageName="@atlaskit/primitives/box"
|
|
44
|
-
/>
|
|
48
|
+
<Example Component={BoxBackgroundColor} packageName="@atlaskit/primitives/box" />
|
|
45
49
|
|
|
46
50
|
## XCSS
|
|
47
51
|
|
|
48
|
-
Box exposes an `xcss` prop. This prop accepts `xcss` function calls that contain a subset of
|
|
52
|
+
Box exposes an `xcss` prop. This prop accepts `xcss` function calls that contain a subset of
|
|
53
|
+
permitted styles. When used with `Box`, `xcss` accepts most CSS properties, and when a token exists,
|
|
54
|
+
the rule accepts that token as a value.
|
|
49
55
|
|
|
50
56
|
For more information on XCSS, see the dedicated [XCSS documentation](/components/primitives/xcss).
|
|
51
57
|
|
|
@@ -53,7 +59,8 @@ For more information on XCSS, see the dedicated [XCSS documentation](/components
|
|
|
53
59
|
|
|
54
60
|
## Conditional styles
|
|
55
61
|
|
|
56
|
-
To achieve conditional styles, we suggest composing conditional styles via the `props.xcss` API
|
|
62
|
+
To achieve conditional styles, we suggest composing conditional styles via the `props.xcss` API
|
|
63
|
+
rather than applying conditional behaviour to individual props.
|
|
57
64
|
|
|
58
65
|
<Example Component={BoxConditional} packageName="@atlaskit/primitives/box" />
|
|
59
66
|
|
|
@@ -61,9 +68,8 @@ To achieve conditional styles, we suggest composing conditional styles via the `
|
|
|
61
68
|
|
|
62
69
|
Box is designed to be composed with inline, stack, and other components to create layouts.
|
|
63
70
|
|
|
64
|
-
Atlassian uses dozens of distinct card-like components across products. Therefore, rather than
|
|
71
|
+
Atlassian uses dozens of distinct card-like components across products. Therefore, rather than
|
|
72
|
+
providing a strict component, the Atlassian Design System empowers and supports you to build your
|
|
73
|
+
own card components in ways that are consistent and will scale over time.
|
|
65
74
|
|
|
66
|
-
<Example
|
|
67
|
-
Component={BoxPracticalUseCase}
|
|
68
|
-
packageName="@atlaskit/primitives/box"
|
|
69
|
-
/>
|
|
75
|
+
<Example Component={BoxPracticalUseCase} packageName="@atlaskit/primitives/box" />
|
|
@@ -4,19 +4,29 @@ description: A box is a generic container that provides managed access to design
|
|
|
4
4
|
order: 2
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
A box is a generic container that provides convenient and managed access to design tokens, and
|
|
7
|
+
A box is a generic container that provides convenient and managed access to design tokens, and
|
|
8
|
+
built-in guidance for the best practices of the Atlassian Design System. Use box in conjunction with
|
|
9
|
+
other layout components such as [inline](/components/primitives/inline/usage) and
|
|
10
|
+
[stack](/components/primitives/stack/usage) to easily create customized layouts.
|
|
8
11
|
|
|
9
|
-
Use a box to compose layouts and add styling to child elements through visual props, including
|
|
12
|
+
Use a box to compose layouts and add styling to child elements through visual props, including
|
|
13
|
+
spacing and color through design tokens.
|
|
10
14
|
|
|
11
15
|
## Using box
|
|
12
16
|
|
|
13
|
-
To identify usages of box in a given design, look for where a UI element will receive some visual
|
|
17
|
+
To identify usages of box in a given design, look for where a UI element will receive some visual
|
|
18
|
+
styles applied to a container. Box can be used on a range of sizes of elements, from buttons to
|
|
19
|
+
section wrappers.
|
|
14
20
|
|
|
15
|
-
Box, being generic in nature, can be "over-used", so it’s important to consider situations where
|
|
21
|
+
Box, being generic in nature, can be "over-used", so it’s important to consider situations where
|
|
22
|
+
more specific and expressive primitives could be used. For example, use
|
|
23
|
+
[inline](/components/primitives/inline/usage) and [stack](/components/primitives/stack/usage) to
|
|
24
|
+
manage horizontal and vertical layouts, respectively.
|
|
16
25
|
|
|
17
26
|
## Styling
|
|
18
27
|
|
|
19
|
-
Display behavior is set by using the available props or using
|
|
28
|
+
Display behavior is set by using the available props or using
|
|
29
|
+
[XCSS](/components/primitives/xcss/usage). Makers can make design decisions for box by setting:
|
|
20
30
|
|
|
21
31
|
- `padding`
|
|
22
32
|
- `paddingInline`
|
|
@@ -11,9 +11,9 @@ props:
|
|
|
11
11
|
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
12
12
|
|
|
13
13
|
<CodeDocsHeader
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
name="@atlaskit/primitives"
|
|
15
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
16
|
+
directoryName="primitives"
|
|
17
17
|
/>
|
|
18
18
|
|
|
19
19
|
## Props
|
|
@@ -12,30 +12,31 @@ import FlexWrap from '../../examples/constellation/flex/wrap';
|
|
|
12
12
|
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
13
13
|
|
|
14
14
|
<CodeDocsHeader
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
name="@atlaskit/primitives"
|
|
16
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
17
|
+
directoryName="primitives"
|
|
18
18
|
/>
|
|
19
19
|
|
|
20
20
|
## Basic
|
|
21
21
|
|
|
22
|
-
The `Flex` component is a basic mapping to the CSS Flexbox API. It can be used as a less
|
|
22
|
+
The `Flex` component is a basic mapping to the CSS Flexbox API. It can be used as a less
|
|
23
|
+
richly-configured `Inline` or `Stack`. Like Stack and Inline, `Flex` exclusively supports
|
|
24
|
+
token-backed `gap` properties to ensure layouts using `Flex` match the Atlassian Design System
|
|
25
|
+
spacing scale.
|
|
23
26
|
|
|
24
|
-
<Example
|
|
25
|
-
Component={FlexJustifyContent}
|
|
26
|
-
packageName="@atlaskit/primitives/flex"
|
|
27
|
-
/>
|
|
27
|
+
<Example Component={FlexJustifyContent} packageName="@atlaskit/primitives/flex" />
|
|
28
28
|
|
|
29
29
|
## Align items and justify content
|
|
30
30
|
|
|
31
|
-
`Flex` applies the `alignItems` and `justifyContent` properties to align content along its cross and
|
|
31
|
+
`Flex` applies the `alignItems` and `justifyContent` properties to align content along its cross and
|
|
32
|
+
main axes respectively.
|
|
32
33
|
|
|
33
34
|
<Example Component={FlexAlignItems} packageName="@atlaskit/primitives/flex" />
|
|
34
35
|
|
|
35
36
|
## Wrap
|
|
36
37
|
|
|
37
|
-
Flex-prefixed properties in CSS do not have this prefix in the component API.
|
|
38
|
-
|
|
38
|
+
Flex-prefixed properties in CSS do not have this prefix in the component API. For example,
|
|
39
|
+
`flex-wrap` is instead applied as the `wrap` property.
|
|
39
40
|
|
|
40
41
|
<Example Component={FlexWrap} packageName="@atlaskit/primitives/flex" />
|
|
41
42
|
|
|
@@ -11,9 +11,9 @@ props:
|
|
|
11
11
|
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
12
12
|
|
|
13
13
|
<CodeDocsHeader
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
name="@atlaskit/primitives"
|
|
15
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
16
|
+
directoryName="primitives"
|
|
17
17
|
/>
|
|
18
18
|
|
|
19
19
|
## Props
|