@atlaskit/primitives 6.1.2 → 6.3.0
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 +20 -0
- package/constellation/anchor/examples.mdx +75 -5
- package/constellation/anchor/usage.mdx +91 -27
- package/constellation/pressable/examples.mdx +14 -24
- package/constellation/pressable/usage.mdx +5 -2
- package/constellation/text/examples.mdx +50 -18
- package/constellation/text/usage.mdx +11 -1
- package/constellation/xcss/usage.mdx +12 -6
- package/dist/cjs/components/anchor.js +2 -2
- package/dist/cjs/components/pressable.js +1 -1
- package/dist/cjs/responsive/hide.js +6 -2
- package/dist/cjs/responsive/show.js +6 -2
- package/dist/es2019/components/anchor.js +2 -2
- package/dist/es2019/components/pressable.js +1 -1
- package/dist/es2019/responsive/hide.js +6 -2
- package/dist/es2019/responsive/show.js +6 -2
- package/dist/esm/components/anchor.js +2 -2
- package/dist/esm/components/pressable.js +1 -1
- package/dist/esm/responsive/hide.js +6 -2
- package/dist/esm/responsive/show.js +6 -2
- package/dist/types/components/anchor.d.ts +2 -2
- package/dist/types/components/pressable.d.ts +2 -2
- package/dist/types/responsive/hide.d.ts +5 -4
- package/dist/types/responsive/show.d.ts +4 -3
- package/dist/types-ts4.5/components/anchor.d.ts +2 -2
- package/dist/types-ts4.5/components/pressable.d.ts +2 -2
- package/dist/types-ts4.5/responsive/hide.d.ts +5 -4
- package/dist/types-ts4.5/responsive/show.d.ts +4 -3
- package/extract-react-types/anchor-props.tsx +34 -8
- package/extract-react-types/pressable-props.tsx +14 -11
- package/package.json +5 -5
- /package/constellation/bleed/{example.mdx → examples.mdx} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/primitives
|
|
2
2
|
|
|
3
|
+
## 6.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#95202](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/95202)
|
|
8
|
+
[`b28e3d55ab88`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b28e3d55ab88) -
|
|
9
|
+
Adds "Fill" to the set of exported style map types
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 6.2.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [#100442](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/100442)
|
|
20
|
+
[`6b3630addb05`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6b3630addb05) -
|
|
21
|
+
Add `xcss` to responsive components `Show` and `Hide`.
|
|
22
|
+
|
|
3
23
|
## 6.1.2
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -5,7 +5,13 @@ order: 0
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
import AnchorDefault from '../../examples/constellation/anchor/default';
|
|
8
|
+
import AnchorBasic from '../../examples/constellation/anchor/basic';
|
|
8
9
|
import AnchorStyled from '../../examples/constellation/anchor/styled';
|
|
10
|
+
import AnchorHtmlAttributes from '../../examples/constellation/anchor/html-attributes';
|
|
11
|
+
import AnchorRouterLinkConfiguration from '../../examples/constellation/anchor/router-link-configuration';
|
|
12
|
+
import AnchorPressTracing from '../../examples/constellation/anchor/press-tracing';
|
|
13
|
+
import AnchorAnalytics from '../../examples/constellation/anchor/analytics';
|
|
14
|
+
import AnchorAnalyticsGASv3 from '../../examples/constellation/anchor/analytics-gasv3';
|
|
9
15
|
|
|
10
16
|
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
11
17
|
import SectionMessage from '@atlaskit/section-message';
|
|
@@ -16,18 +22,82 @@ import SectionMessage from '@atlaskit/section-message';
|
|
|
16
22
|
directoryName="primitives"
|
|
17
23
|
/>
|
|
18
24
|
|
|
19
|
-
Anchor is a primitive used for building custom
|
|
25
|
+
Anchor is a primitive used for building custom links with Atlassian Design System styling, routing support, and built-in event tracking. Ultimately it renders an anchor `<a>` element.
|
|
20
26
|
|
|
21
|
-
|
|
27
|
+
Only use anchor when existing components such as [link](/components/link/examples) or [link button](/components/button/link-button/examples) are unsuitable and unable to be customized to fit your needs.
|
|
22
28
|
|
|
23
29
|
## Default
|
|
24
30
|
|
|
25
|
-
Anchor
|
|
31
|
+
Anchor is unstyled besides a default underline. If you are using the [CSS reset](/components/css-reset/examples), it will also inherit some global styles.
|
|
26
32
|
|
|
27
33
|
<Example Component={AnchorDefault} packageName="@atlaskit/primitives/anchor" />
|
|
28
34
|
|
|
29
|
-
##
|
|
35
|
+
## Basic styling with XCSS
|
|
30
36
|
|
|
31
|
-
Anchor
|
|
37
|
+
Anchor can be styled using XCSS. It includes consistent Atlassian Design System `:focus` styles, so it's unnecessary to add your own.
|
|
38
|
+
|
|
39
|
+
For more information on XCSS, see the [XCSS documentation](/components/primitives/xcss).
|
|
40
|
+
|
|
41
|
+
<Example Component={AnchorBasic} packageName="@atlaskit/primitives/anchor" />
|
|
42
|
+
|
|
43
|
+
## Advanced styling
|
|
44
|
+
|
|
45
|
+
Use a combination of XCSS and other primitives for more complex designs.
|
|
32
46
|
|
|
33
47
|
<Example Component={AnchorStyled} packageName="@atlaskit/primitives/anchor" />
|
|
48
|
+
|
|
49
|
+
## HTML attributes
|
|
50
|
+
|
|
51
|
+
Anchor passes through all valid HTML attributes to the underlying `<a>` element.
|
|
52
|
+
|
|
53
|
+
<Example
|
|
54
|
+
Component={AnchorHtmlAttributes}
|
|
55
|
+
packageName="@atlaskit/primitives/anchor"
|
|
56
|
+
/>
|
|
57
|
+
|
|
58
|
+
## Router links
|
|
59
|
+
|
|
60
|
+
Routing libraries often supply their own link components enhanced with routing support. This can be configured in the [AppProvider context](/components/app-provider/examples#router-links), and anchor will automatically use it.
|
|
61
|
+
|
|
62
|
+
This example shows a configuration for [React Resource Router](https://github.com/atlassian-labs/react-resource-router), however any routing library can be used.
|
|
63
|
+
|
|
64
|
+
Using this method, anchor accepts `href` as a string for standard usage. For advanced usage, an object can be passed.
|
|
65
|
+
|
|
66
|
+
Anchor will only render a router link if:
|
|
67
|
+
|
|
68
|
+
- a link component is set in the app provider
|
|
69
|
+
- it's not an external link (starting with `http://` or `https://`)
|
|
70
|
+
- it's not a non-HTTP-based link (e.g. emails, phone numbers, hash links etc.).
|
|
71
|
+
|
|
72
|
+
<Example
|
|
73
|
+
Component={AnchorRouterLinkConfiguration}
|
|
74
|
+
packageName="@atlaskit/primitives/anchor"
|
|
75
|
+
appearance="source-only"
|
|
76
|
+
/>
|
|
77
|
+
|
|
78
|
+
<Snippet
|
|
79
|
+
name="primitives-event-tracking-header"
|
|
80
|
+
variables={{ componentName: 'anchor' }}
|
|
81
|
+
/>
|
|
82
|
+
|
|
83
|
+
<Example
|
|
84
|
+
Component={AnchorAnalytics}
|
|
85
|
+
packageName="@atlaskit/primitives/anchor"
|
|
86
|
+
/>
|
|
87
|
+
|
|
88
|
+
<Snippet name="primitives-event-tracking-gasv3" />
|
|
89
|
+
|
|
90
|
+
<Example
|
|
91
|
+
Component={AnchorAnalyticsGASv3}
|
|
92
|
+
packageName="@atlaskit/primitives/anchor"
|
|
93
|
+
/>
|
|
94
|
+
|
|
95
|
+
<Snippet
|
|
96
|
+
name="primitives-event-tracking-ufo"
|
|
97
|
+
variables={{ componentName: 'anchor' }}
|
|
98
|
+
/>
|
|
99
|
+
|
|
100
|
+
<Example
|
|
101
|
+
Component={AnchorPressTracing}
|
|
102
|
+
packageName="@atlaskit/primitives/anchor"
|
|
103
|
+
/>
|
|
@@ -4,44 +4,108 @@ description: An anchor is a primitive for building custom links.
|
|
|
4
4
|
order: 2
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Usage
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Anchors help users navigate to another page or sections of a page. They can also download files or provide contact information such as phone numbers or email addresses.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Anchor has consistent focus styles and analytics built in. It works with design tokens to make it easy to compose Atlassian-styled links that aren't possible using the [link component](/components/link/examples), [link buttons](/components/button/link-button/examples), or other existing design system components.
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Use anchor when there aren't existing components that work for your experience
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Existing components such as the [link component](/components/link/examples) (for text-based links) should be used whenever possible for links to maintain visual consistency. Only use anchor when building custom links beyond the capabilities of the the link component.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Do not use anchor to perform actions rather than navigation. Use the equivalent [pressable primitive](/components/primitives/pressable/examples) to build a custom button instead.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
## Accessibility
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
### Underline links unless other context already indicates it is a link
|
|
22
22
|
|
|
23
|
-
Anchor
|
|
23
|
+
Anchor has an underline by default but it can be disabled in some circumstances. Underlines help differentiate links from regular text and addresses a WCAG-A recommendation. Using color alone isn't accessible, especially if links are surrounded by other text.
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
<Anchor<MyRouterLinkConfig>
|
|
27
|
-
href={{
|
|
28
|
-
to: '/home',
|
|
29
|
-
replace: true
|
|
30
|
-
}}
|
|
31
|
-
>
|
|
32
|
-
Home
|
|
33
|
-
</Anchor>
|
|
34
|
-
```
|
|
25
|
+
Only remove underlines if the context surrounding the link makes it clear that it is interactive, such as in navigation. Anhor may also be used to create linkable areas such as a card, in which case the underline may be omitted.
|
|
35
26
|
|
|
36
|
-
|
|
27
|
+
Also, don't underline text that isn't a link. This makes the text look clickable because it looks a link.
|
|
37
28
|
|
|
38
|
-
|
|
29
|
+
For more information see ['Understanding Use of Color (Level A)'](https://www.w3.org/WAI/WCAG22/Understanding/use-of-color.html) and ['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).
|
|
30
|
+
|
|
31
|
+
<!-- TODO: Add do/dont images once designed (if necessary?) -->
|
|
32
|
+
|
|
33
|
+
<DoDont type="do">
|
|
34
|
+
Use underlined links in body copy. Only omit an underline if the context makes
|
|
35
|
+
it clear the link is selectable.
|
|
36
|
+
</DoDont>
|
|
37
|
+
|
|
38
|
+
<DoDont type="dont">Use underlined links in navigation.</DoDont>
|
|
39
|
+
|
|
40
|
+
### Use descriptive link text that clarifies the purpose of the link
|
|
41
|
+
|
|
42
|
+
Don't link vague words or phrases like “here” or “learn more.” Make sure the linked text clearly describes the purpose of the link.
|
|
43
|
+
|
|
44
|
+
<!-- TODO: Add some Do/Don't images as examples -->
|
|
45
|
+
|
|
46
|
+
<DoDont type="do">Clearly describe the purpose of the link.</DoDont>
|
|
47
|
+
|
|
48
|
+
<DoDont type="dont">Link vague words or phrases.</DoDont>
|
|
49
|
+
|
|
50
|
+
### Only open links in a new window or tab when necessary
|
|
51
|
+
|
|
52
|
+
Opening links in a new window can be disorienting for people, so only do it when necessary.
|
|
53
|
+
|
|
54
|
+
It might make sense for a link to open in a new window if:
|
|
55
|
+
|
|
56
|
+
- There's a risk of someone losing their current place or task
|
|
57
|
+
- The link takes the person out of the current product or to an external website
|
|
58
|
+
|
|
59
|
+
For more information see ['G200: Opening new windows and tabs from a link only when necessary'](https://www.w3.org/TR/WCAG20-TECHS/G200.html).
|
|
60
|
+
|
|
61
|
+
### Keep links large enough to interact with
|
|
62
|
+
|
|
63
|
+
Make link text size at least 12px. Smaller text is harder to read and interact with. If anchor is not used for text-based links, ensure the clickable area is at least 24 by 24 pixels for accessibility unless exempt from [Target Size (Minimum) (Level AA)](https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html).
|
|
64
|
+
|
|
65
|
+
## Best practices
|
|
66
|
+
|
|
67
|
+
### Don't confuse links and buttons
|
|
68
|
+
|
|
69
|
+
Anchors are for navigation and URL changes, while buttons are for on-page actions such as form submissions or opening modals. These elements are treated differently by assistive technologies, so avoid using one in place of the other.
|
|
70
|
+
|
|
71
|
+
More details on [when to use links and buttons](/components/button/button-new/usage#use-buttons-for-actions-and-links-for-navigation).
|
|
72
|
+
|
|
73
|
+
## Content guidelines
|
|
74
|
+
|
|
75
|
+
### Use clear and unique link text
|
|
76
|
+
|
|
77
|
+
Try not to repeat the same link text over and over on a page. Make sure link text is clear about where the link will go.
|
|
78
|
+
|
|
79
|
+
### Specify download links, including file type and size
|
|
80
|
+
|
|
81
|
+
Always specify if a link triggers a download, and make the linked text clear about what exactly will be downloaded. Include file type and size as well.
|
|
82
|
+
|
|
83
|
+
### Don't include unnecessary links
|
|
84
|
+
|
|
85
|
+
Using too many links can overwhelm other, more important information on a page.
|
|
86
|
+
|
|
87
|
+
Anchors take people to a new page or location. Be mindful of whether or not the linked resource is helpful or distracting to the current task.
|
|
88
|
+
|
|
89
|
+
### Links in sentences or body copy
|
|
90
|
+
|
|
91
|
+
Only link the words that are necessary to clarify where the link goes. Don't link the entire sentence. (Linking smaller phrases can be better for internationalization when sentence structures change across languages.)
|
|
92
|
+
|
|
93
|
+
Only include the verb in the linked text if it better describes the purpose the link or differentiates it from other links and actions on the page.
|
|
94
|
+
|
|
95
|
+
For example:
|
|
96
|
+
|
|
97
|
+
> Update [Jira settings](https://atlassian.design/components/button/button-new/usage#use-buttons-for-actions-and-links-for-navigation) to turn off notifications. To upgrade, [sign up for Jira](https://atlassian.design/components/button/button-new/usage#use-buttons-for-actions-and-links-for-navigation).
|
|
98
|
+
|
|
99
|
+
If only Jira was linked, it wouldn't be clear that this was a sign up page.
|
|
100
|
+
|
|
101
|
+
### Links on their own (UI elements or navigation)
|
|
102
|
+
|
|
103
|
+
For standalone links, link the whole phrase. Don't add punctuation.
|
|
104
|
+
|
|
105
|
+
These type of links typically follow general button or other label content rules (sentence case capitalization, no punctuation, etc.)
|
|
39
106
|
|
|
40
107
|
## Related
|
|
41
108
|
|
|
42
|
-
- [
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
- [Manage horizontal layout using an inline component](/components/primitives/inline/usage)
|
|
46
|
-
- [Manage vertical layout using a stack component](/components/primitives/stack/usage)
|
|
47
|
-
- [Use design tokens in code with XCSS](/components/primitives/XCSS/usage)
|
|
109
|
+
- [Counterpart pressable primitive for buttons](/components/primitives/button/usage)
|
|
110
|
+
- Prefer to use existing components such as the [link component](/components/link/examples) or [link buttons](/components/button/link-button/examples)
|
|
111
|
+
- Anchor is built on the same API as [box](/components/primitives/box/usage)
|
|
@@ -25,7 +25,7 @@ import SectionMessage from '@atlaskit/section-message';
|
|
|
25
25
|
|
|
26
26
|
Pressable is a primitive used for building custom buttons with Atlassian Design System styling and built-in event tracking. It renders a `<button>` element.
|
|
27
27
|
|
|
28
|
-
Only use Pressable when existing components such as [
|
|
28
|
+
Only use Pressable when existing components such as [button](/components/button/examples) are unsuitable and unable to be customized to fit your needs.
|
|
29
29
|
|
|
30
30
|
## Default
|
|
31
31
|
|
|
@@ -40,7 +40,7 @@ Pressable is unstyled by default.
|
|
|
40
40
|
|
|
41
41
|
Pressable can be styled using XCSS. Ensure styling indicates the interaction state using `:hover` and `:active` pseudo-classes. Pressable includes consistent Atlassian Design System `:focus` styles, so it's unnecessary to add your own.
|
|
42
42
|
|
|
43
|
-
For more information on XCSS, see the
|
|
43
|
+
For more information on XCSS, see the [XCSS documentation](/components/primitives/xcss).
|
|
44
44
|
|
|
45
45
|
<Example
|
|
46
46
|
Component={PressableBasic}
|
|
@@ -87,39 +87,29 @@ Pressable passes through all valid HTML attributes to the underlying `<button>`
|
|
|
87
87
|
packageName="@atlaskit/primitives/pressable"
|
|
88
88
|
/>
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
### React UFO press interactions
|
|
95
|
-
|
|
96
|
-
By default, pressable fires [React UFO (Unified Frontend Observability) press interactions](https://developer.atlassian.com/platform/ufo/react-ufo/react-ufo/getting-started/#quick-start--press-interactions) for available listeners. This helps Atlassian measure performance and reliability. Additional detail can be provided using the `interactionName` prop.
|
|
90
|
+
<Snippet
|
|
91
|
+
name="primitives-event-tracking-header"
|
|
92
|
+
variables={{ componentName: 'pressable' }}
|
|
93
|
+
/>
|
|
97
94
|
|
|
98
95
|
<Example
|
|
99
|
-
Component={
|
|
96
|
+
Component={PressableAnalytics}
|
|
100
97
|
packageName="@atlaskit/primitives/pressable"
|
|
101
98
|
/>
|
|
102
99
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
Pressable comes with built-in Atlaskit analytics support using the [Analytics next package](https://atlaskit.atlassian.com/packages/analytics/analytics-next), and fires events for available listeners. Currently this is only available for `onClick`.
|
|
106
|
-
|
|
107
|
-
It always fires events on the `atlaskit` channel. To also fire events on other channels, use the provided `analyticsEvent` in `onClick`. To configure event data, use `componentName` (defaults to 'Pressable') and `analyticsContext` for passing other metadata.
|
|
108
|
-
|
|
109
|
-
See the event data in the console.
|
|
100
|
+
<Snippet name="primitives-event-tracking-gasv3" />
|
|
110
101
|
|
|
111
102
|
<Example
|
|
112
|
-
Component={
|
|
103
|
+
Component={PressableAnalyticsGASv3}
|
|
113
104
|
packageName="@atlaskit/primitives/pressable"
|
|
114
105
|
/>
|
|
115
106
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
See the event data in the console.
|
|
107
|
+
<Snippet
|
|
108
|
+
name="primitives-event-tracking-ufo"
|
|
109
|
+
variables={{ componentName: 'pressable' }}
|
|
110
|
+
/>
|
|
121
111
|
|
|
122
112
|
<Example
|
|
123
|
-
Component={
|
|
113
|
+
Component={PressablePressTracing}
|
|
124
114
|
packageName="@atlaskit/primitives/pressable"
|
|
125
115
|
/>
|
|
@@ -7,6 +7,8 @@ order: 2
|
|
|
7
7
|
import pressablePrimaryDo from './images/pressable-01a-do.png';
|
|
8
8
|
import pressablePrimaryDont from './images/pressable-01b-dont.png';
|
|
9
9
|
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
10
12
|
Pressable is a button with consistent focus styles and analytics built in. Pressable works with design tokens to make it easy to compose Atlassian-styled clickable elements that aren't possible using existing [buttons](/components/button/examples), [menus](/components/menu/examples), or other existing design system components.
|
|
11
13
|
|
|
12
14
|

|
|
@@ -15,7 +17,7 @@ Pressable is a button with consistent focus styles and analytics built in. Press
|
|
|
15
17
|
2. **Focus ring**: This is included in pressable and appears on keyboard focus.
|
|
16
18
|
3. **Accessible label:** Pressable should always include a clear label for accessibility. Use this to communicate the action that occurs when the button is pressed.
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
### Use pressable when there aren't existing components that work for your experience
|
|
19
21
|
|
|
20
22
|
Only use pressable when existing components such as [the button component](/components/button/examples), menus, or other existing design system components can't be customized to fit your case. Using existing components with safe customizations will prevent inconsistency as Atlassian UI evolves.
|
|
21
23
|
|
|
@@ -95,5 +97,6 @@ Follow label and content guidelines for [buttons](/components/button/button-new/
|
|
|
95
97
|
|
|
96
98
|
## Related
|
|
97
99
|
|
|
98
|
-
-
|
|
100
|
+
- [Counterpart anchor primitive for links](/components/primitives/button/usage)
|
|
101
|
+
- Prefer to use existing components such as [buttons](/components/button/examples) or [menus](/components/menu/examples) for most actions in Atlassian products
|
|
99
102
|
- Pressable is built on the same API as [box](/components/primitives/box/usage)
|
|
@@ -4,40 +4,72 @@ description: Text is a token-backed typography component to display body text.
|
|
|
4
4
|
order: 0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
7
|
+
import TextBasic from '../../examples/constellation/text/text-basic';
|
|
8
|
+
import TextColorInverse from '../../examples/constellation/text/text-color-inverse';
|
|
9
|
+
import TextColorInherit from '../../examples/constellation/text/text-color-inherit';
|
|
10
|
+
import TextWeight from '../../examples/constellation/text/text-weight';
|
|
11
|
+
import TextAlign from '../../examples/constellation/text/text-align';
|
|
12
|
+
import TextAsElement from '../../examples/constellation/text/text-as-element';
|
|
13
|
+
import TextSpacing from '../../examples/constellation/text/text-spacing';
|
|
14
|
+
import TextTruncation from '../../examples/constellation/text/text-truncation';
|
|
12
15
|
|
|
13
16
|
## Basic
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
Use a Text component for main content. Text typically appears after headings or subheadings as detailed descriptions and messages, but also as standalone text in components.
|
|
16
19
|
|
|
17
|
-
The `size` prop expresses the visual appearance of the text element
|
|
20
|
+
The `size` prop expresses the visual appearance of the text element:
|
|
21
|
+
- `'large'` is for long-form content. Use this size for a comfortable reading experience such as in blogs.
|
|
22
|
+
- `'medium'` is the default size in components or where space is limited, for detailed or descriptive content such as primary descriptions in flags.
|
|
23
|
+
- `'small'` should be used sparingly and is for secondary level content such as fine print or semantic messaging.
|
|
18
24
|
|
|
19
|
-
<Example Component={
|
|
25
|
+
<Example Component={TextBasic} packageName="@atlaskit/primitives" />
|
|
20
26
|
|
|
21
27
|
## Color
|
|
22
28
|
|
|
23
|
-
|
|
29
|
+
Text uses the `color.text` token which automatically switches colors to be legible across both light and dark modes.
|
|
24
30
|
|
|
25
|
-
|
|
31
|
+
Text will automatically apply the correct inverse color token if placed within a [box component](/components/primitives/box) with a bold background color.
|
|
26
32
|
|
|
27
|
-
|
|
33
|
+
<Example Component={TextColorInverse} packageName="@atlaskit/primitives" />
|
|
28
34
|
|
|
29
|
-
|
|
35
|
+
The `color` prop can be used with any text color token. If Text is nested inside another Text component, color will automatically inherit from its parent.
|
|
30
36
|
|
|
31
|
-
<Example Component={
|
|
37
|
+
<Example Component={TextColorInherit} packageName="@atlaskit/primitives" />
|
|
38
|
+
|
|
39
|
+
## Font weight
|
|
40
|
+
|
|
41
|
+
Font weight defaults to regular (400) and can be set using the `weight` prop.
|
|
42
|
+
More information about the available weights can be found on the [typography foundations page](/foundations/typography-beta/#body-font-weight).
|
|
43
|
+
|
|
44
|
+
Note: Text supports the semibold weight, however due to differences between font stacks across different operating systems, semibold text may render as bold.
|
|
45
|
+
We recommend using regular, medium, and bold for the best results.
|
|
46
|
+
|
|
47
|
+
<Example Component={TextWeight} packageName="@atlaskit/primitives" />
|
|
32
48
|
|
|
33
49
|
## Alignment
|
|
34
50
|
|
|
35
|
-
|
|
51
|
+
Text can be aligned using the `align` prop.
|
|
52
|
+
|
|
53
|
+
<Example Component={TextAlign} packageName="@atlaskit/primitives" />
|
|
54
|
+
|
|
55
|
+
## Rendered HTML element
|
|
56
|
+
|
|
57
|
+
Text renders a HTML `<span>` element by default. Use the `as` prop to change the rendered HTML element.
|
|
58
|
+
|
|
59
|
+
<Example Component={TextAsElement} packageName="@atlaskit/primitives" />
|
|
60
|
+
|
|
61
|
+
## Arrangement with other text styles
|
|
62
|
+
|
|
63
|
+
Text does not apply any vertical margin or spacing. To control space between text and other content, use a [stack component](/components/primitives/stack).
|
|
64
|
+
|
|
65
|
+
The available values for paragraph spacing are outlined in the [Typography foundations](/foundations/typography-beta/#body) page.
|
|
66
|
+
|
|
67
|
+
<Example Component={TextSpacing} packageName="@atlaskit/primitives" />
|
|
36
68
|
|
|
37
|
-
|
|
69
|
+
## Truncation
|
|
38
70
|
|
|
39
|
-
|
|
71
|
+
Truncation in product experiences [should be avoided](/content/language-and-grammar/#truncation).
|
|
40
72
|
|
|
41
|
-
|
|
73
|
+
However if truncation cannot be avoided, for example when displaying user-generated content, use the `maxLines` prop to indicate how text should be truncated.
|
|
42
74
|
|
|
43
|
-
<Example Component={
|
|
75
|
+
<Example Component={TextTruncation} packageName="@atlaskit/primitives" />
|
|
@@ -6,4 +6,14 @@ order: 2
|
|
|
6
6
|
|
|
7
7
|
## Usage
|
|
8
8
|
|
|
9
|
-
Use
|
|
9
|
+
Use the text component for all non-heading text, including main content, detailed descriptions, and text in components.
|
|
10
|
+
|
|
11
|
+
For each size, a specific line height is automatically set ensuring text is compliant with accessibility standards.
|
|
12
|
+
|
|
13
|
+
Read more usage guidance for body text in our [Typography foundations](/foundations/typography-beta#body).
|
|
14
|
+
|
|
15
|
+
## Accessibility
|
|
16
|
+
|
|
17
|
+
### Color contrast
|
|
18
|
+
|
|
19
|
+
Text should be a minimum of 4.5:1 color contrast.
|
|
@@ -8,17 +8,23 @@ import { MediaQueriesTable } from '@af/design-system-docs-ui';
|
|
|
8
8
|
|
|
9
9
|
XCSS is an Atlassian Design System styling API that natively integrates with Atlassian's [design tokens](/tokens) and [primitives](/components/primitives/overview).
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
To ensure future compliance with XCSS as it evolves over time, we highly recommend you enable our ESLint plugins and adhere to the [UI Styling Standard](/components/eslint-plugin-ui-styling-standard) guidelines by writing local, type-safe, static styles.
|
|
12
|
+
|
|
13
|
+
- [@atlaskit/eslint-plugin-design-system](/components/eslint-plugin-design-system)
|
|
14
|
+
- [@atlaskit/eslint-plugin-ui-styling-standard](/components/eslint-plugin-ui-styling-standard)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
The XCSS utility behaves similarly to the `css` utility in libraries like `styled-components`, `@compiled` or `@emotion`, and is built off of `@emotion/react` today. If you've used these libraries, XCSS will feel familiar, with a few additional features and constraints.
|
|
12
18
|
|
|
13
19
|
Familiar features:
|
|
14
20
|
|
|
15
|
-
- XCSS
|
|
16
|
-
- XCSS
|
|
21
|
+
- XCSS is applied as an Emotion `className` to our primitive components
|
|
22
|
+
- XCSS works with the basic CSS object interface found elsewhere
|
|
17
23
|
- XCSS supports style precedence and conditional styles
|
|
18
24
|
|
|
19
25
|
Key differences:
|
|
20
26
|
|
|
21
|
-
- XCSS has type-safety that ensures token name usage for all CSS properties represented by design tokens
|
|
27
|
+
- XCSS has type-safety that ensures token name usage for all CSS properties represented by design tokens
|
|
22
28
|
- XCSS restricts nested selectors completely from usage
|
|
23
29
|
|
|
24
30
|
## Usage
|
|
@@ -115,7 +121,7 @@ The only limitation is that a media query can't contain another media query. Thi
|
|
|
115
121
|
|
|
116
122
|
Additionally, pseudo-selectors can't contain media queries. To use media queries and pseudos, the media query must contain the pseudo.
|
|
117
123
|
|
|
118
|
-
```
|
|
124
|
+
```tsx
|
|
119
125
|
import { xcss } from '@atlaskit/primitives';
|
|
120
126
|
import { media } from '@atlaskit/primitives/responsive';
|
|
121
127
|
|
|
@@ -127,7 +133,7 @@ const someStyles = xcss({
|
|
|
127
133
|
}
|
|
128
134
|
},
|
|
129
135
|
|
|
130
|
-
// This is not okay,
|
|
136
|
+
// This is not okay, we don't allow pseudos to contain media queries
|
|
131
137
|
':hover': {
|
|
132
138
|
[media.above.md]: {
|
|
133
139
|
backgroundColor: 'color.background.primary.hovered'
|
|
@@ -76,7 +76,7 @@ var Anchor = function Anchor(_ref, ref) {
|
|
|
76
76
|
action: 'clicked',
|
|
77
77
|
componentName: componentName || 'Anchor',
|
|
78
78
|
packageName: "@atlaskit/primitives",
|
|
79
|
-
packageVersion: "6.
|
|
79
|
+
packageVersion: "6.3.0",
|
|
80
80
|
analyticsData: analyticsContext,
|
|
81
81
|
actionSubject: 'link'
|
|
82
82
|
});
|
|
@@ -94,7 +94,7 @@ var Anchor = function Anchor(_ref, ref) {
|
|
|
94
94
|
*
|
|
95
95
|
* - a link component is set in the app provider
|
|
96
96
|
* - it's not an external link (starting with `http://` or `https://`)
|
|
97
|
-
* - it's not a non-HTTP-based link (e.g.
|
|
97
|
+
* - it's not a non-HTTP-based link (e.g. emails, phone numbers, hash links etc.).
|
|
98
98
|
*/
|
|
99
99
|
var isRouterLink = RouterLink && !isExternal && !isNonHttpBased;
|
|
100
100
|
var hrefObjectUsedWithoutRouterLink = RouterLink === undefined && (0, _typeof2.default)(href) === 'object';
|
|
@@ -78,7 +78,7 @@ var Pressable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
78
78
|
action: 'clicked',
|
|
79
79
|
componentName: componentName || 'Pressable',
|
|
80
80
|
packageName: "@atlaskit/primitives",
|
|
81
|
-
packageVersion: "6.
|
|
81
|
+
packageVersion: "6.3.0",
|
|
82
82
|
analyticsData: analyticsContext,
|
|
83
83
|
actionSubject: 'button'
|
|
84
84
|
});
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Hide = void 0;
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
|
+
var _xcss = require("../xcss/xcss");
|
|
8
9
|
var _buildMediaQueryCss = require("./build-media-query-css");
|
|
9
10
|
/** @jsx jsx */
|
|
10
11
|
|
|
@@ -27,8 +28,11 @@ var Hide = exports.Hide = function Hide(_ref) {
|
|
|
27
28
|
below = _ref.below,
|
|
28
29
|
children = _ref.children,
|
|
29
30
|
_ref$as = _ref.as,
|
|
30
|
-
AsElement = _ref$as === void 0 ? 'div' : _ref$as
|
|
31
|
+
AsElement = _ref$as === void 0 ? 'div' : _ref$as,
|
|
32
|
+
xcss = _ref.xcss;
|
|
33
|
+
var resolvedStyles = (0, _xcss.parseXcss)(xcss);
|
|
31
34
|
return (0, _react.jsx)(AsElement, {
|
|
32
|
-
|
|
35
|
+
className: resolvedStyles.static,
|
|
36
|
+
css: [above && hideAboveQueries[above], below && hideBelowQueries[below], resolvedStyles.emotion]
|
|
33
37
|
}, children);
|
|
34
38
|
};
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Show = void 0;
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
|
+
var _xcss = require("../xcss/xcss");
|
|
8
9
|
var _buildMediaQueryCss = require("./build-media-query-css");
|
|
9
10
|
/** @jsx jsx */
|
|
10
11
|
|
|
@@ -30,8 +31,11 @@ var Show = exports.Show = function Show(_ref) {
|
|
|
30
31
|
below = _ref.below,
|
|
31
32
|
children = _ref.children,
|
|
32
33
|
_ref$as = _ref.as,
|
|
33
|
-
AsElement = _ref$as === void 0 ? 'div' : _ref$as
|
|
34
|
+
AsElement = _ref$as === void 0 ? 'div' : _ref$as,
|
|
35
|
+
xcss = _ref.xcss;
|
|
36
|
+
var resolvedStyles = (0, _xcss.parseXcss)(xcss);
|
|
34
37
|
return (0, _react.jsx)(AsElement, {
|
|
35
|
-
|
|
38
|
+
className: resolvedStyles.static,
|
|
39
|
+
css: [defaultHiddenStyles, above && showAboveQueries[above], below && showBelowQueries[below], resolvedStyles.emotion]
|
|
36
40
|
}, children);
|
|
37
41
|
};
|
|
@@ -62,7 +62,7 @@ const Anchor = ({
|
|
|
62
62
|
action: 'clicked',
|
|
63
63
|
componentName: componentName || 'Anchor',
|
|
64
64
|
packageName: "@atlaskit/primitives",
|
|
65
|
-
packageVersion: "6.
|
|
65
|
+
packageVersion: "6.3.0",
|
|
66
66
|
analyticsData: analyticsContext,
|
|
67
67
|
actionSubject: 'link'
|
|
68
68
|
});
|
|
@@ -80,7 +80,7 @@ const Anchor = ({
|
|
|
80
80
|
*
|
|
81
81
|
* - a link component is set in the app provider
|
|
82
82
|
* - it's not an external link (starting with `http://` or `https://`)
|
|
83
|
-
* - it's not a non-HTTP-based link (e.g.
|
|
83
|
+
* - it's not a non-HTTP-based link (e.g. emails, phone numbers, hash links etc.).
|
|
84
84
|
*/
|
|
85
85
|
const isRouterLink = RouterLink && !isExternal && !isNonHttpBased;
|
|
86
86
|
const hrefObjectUsedWithoutRouterLink = RouterLink === undefined && typeof href === 'object';
|
|
@@ -64,7 +64,7 @@ const Pressable = /*#__PURE__*/forwardRef(({
|
|
|
64
64
|
action: 'clicked',
|
|
65
65
|
componentName: componentName || 'Pressable',
|
|
66
66
|
packageName: "@atlaskit/primitives",
|
|
67
|
-
packageVersion: "6.
|
|
67
|
+
packageVersion: "6.3.0",
|
|
68
68
|
analyticsData: analyticsContext,
|
|
69
69
|
actionSubject: 'button'
|
|
70
70
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
|
+
import { parseXcss } from '../xcss/xcss';
|
|
4
5
|
import { UNSAFE_buildAboveMediaQueryCSS, UNSAFE_buildBelowMediaQueryCSS } from './build-media-query-css';
|
|
5
6
|
const hideAboveQueries = UNSAFE_buildAboveMediaQueryCSS({
|
|
6
7
|
display: 'none'
|
|
@@ -20,9 +21,12 @@ export const Hide = ({
|
|
|
20
21
|
above,
|
|
21
22
|
below,
|
|
22
23
|
children,
|
|
23
|
-
as: AsElement = 'div'
|
|
24
|
+
as: AsElement = 'div',
|
|
25
|
+
xcss
|
|
24
26
|
}) => {
|
|
27
|
+
const resolvedStyles = parseXcss(xcss);
|
|
25
28
|
return jsx(AsElement, {
|
|
26
|
-
|
|
29
|
+
className: resolvedStyles.static,
|
|
30
|
+
css: [above && hideAboveQueries[above], below && hideBelowQueries[below], resolvedStyles.emotion]
|
|
27
31
|
}, children);
|
|
28
32
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
|
+
import { parseXcss } from '../xcss/xcss';
|
|
4
5
|
import { UNSAFE_buildAboveMediaQueryCSS, UNSAFE_buildBelowMediaQueryCSS } from './build-media-query-css';
|
|
5
6
|
const showAboveQueries = UNSAFE_buildAboveMediaQueryCSS({
|
|
6
7
|
display: 'revert'
|
|
@@ -23,9 +24,12 @@ export const Show = ({
|
|
|
23
24
|
above,
|
|
24
25
|
below,
|
|
25
26
|
children,
|
|
26
|
-
as: AsElement = 'div'
|
|
27
|
+
as: AsElement = 'div',
|
|
28
|
+
xcss
|
|
27
29
|
}) => {
|
|
30
|
+
const resolvedStyles = parseXcss(xcss);
|
|
28
31
|
return jsx(AsElement, {
|
|
29
|
-
|
|
32
|
+
className: resolvedStyles.static,
|
|
33
|
+
css: [defaultHiddenStyles, above && showAboveQueries[above], below && showBelowQueries[below], resolvedStyles.emotion]
|
|
30
34
|
}, children);
|
|
31
35
|
};
|
|
@@ -66,7 +66,7 @@ var Anchor = function Anchor(_ref, ref) {
|
|
|
66
66
|
action: 'clicked',
|
|
67
67
|
componentName: componentName || 'Anchor',
|
|
68
68
|
packageName: "@atlaskit/primitives",
|
|
69
|
-
packageVersion: "6.
|
|
69
|
+
packageVersion: "6.3.0",
|
|
70
70
|
analyticsData: analyticsContext,
|
|
71
71
|
actionSubject: 'link'
|
|
72
72
|
});
|
|
@@ -84,7 +84,7 @@ var Anchor = function Anchor(_ref, ref) {
|
|
|
84
84
|
*
|
|
85
85
|
* - a link component is set in the app provider
|
|
86
86
|
* - it's not an external link (starting with `http://` or `https://`)
|
|
87
|
-
* - it's not a non-HTTP-based link (e.g.
|
|
87
|
+
* - it's not a non-HTTP-based link (e.g. emails, phone numbers, hash links etc.).
|
|
88
88
|
*/
|
|
89
89
|
var isRouterLink = RouterLink && !isExternal && !isNonHttpBased;
|
|
90
90
|
var hrefObjectUsedWithoutRouterLink = RouterLink === undefined && _typeof(href) === 'object';
|
|
@@ -68,7 +68,7 @@ var Pressable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
68
68
|
action: 'clicked',
|
|
69
69
|
componentName: componentName || 'Pressable',
|
|
70
70
|
packageName: "@atlaskit/primitives",
|
|
71
|
-
packageVersion: "6.
|
|
71
|
+
packageVersion: "6.3.0",
|
|
72
72
|
analyticsData: analyticsContext,
|
|
73
73
|
actionSubject: 'button'
|
|
74
74
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
|
+
import { parseXcss } from '../xcss/xcss';
|
|
4
5
|
import { UNSAFE_buildAboveMediaQueryCSS, UNSAFE_buildBelowMediaQueryCSS } from './build-media-query-css';
|
|
5
6
|
var hideAboveQueries = UNSAFE_buildAboveMediaQueryCSS({
|
|
6
7
|
display: 'none'
|
|
@@ -21,8 +22,11 @@ export var Hide = function Hide(_ref) {
|
|
|
21
22
|
below = _ref.below,
|
|
22
23
|
children = _ref.children,
|
|
23
24
|
_ref$as = _ref.as,
|
|
24
|
-
AsElement = _ref$as === void 0 ? 'div' : _ref$as
|
|
25
|
+
AsElement = _ref$as === void 0 ? 'div' : _ref$as,
|
|
26
|
+
xcss = _ref.xcss;
|
|
27
|
+
var resolvedStyles = parseXcss(xcss);
|
|
25
28
|
return jsx(AsElement, {
|
|
26
|
-
|
|
29
|
+
className: resolvedStyles.static,
|
|
30
|
+
css: [above && hideAboveQueries[above], below && hideBelowQueries[below], resolvedStyles.emotion]
|
|
27
31
|
}, children);
|
|
28
32
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
|
+
import { parseXcss } from '../xcss/xcss';
|
|
4
5
|
import { UNSAFE_buildAboveMediaQueryCSS, UNSAFE_buildBelowMediaQueryCSS } from './build-media-query-css';
|
|
5
6
|
var showAboveQueries = UNSAFE_buildAboveMediaQueryCSS({
|
|
6
7
|
display: 'revert'
|
|
@@ -24,8 +25,11 @@ export var Show = function Show(_ref) {
|
|
|
24
25
|
below = _ref.below,
|
|
25
26
|
children = _ref.children,
|
|
26
27
|
_ref$as = _ref.as,
|
|
27
|
-
AsElement = _ref$as === void 0 ? 'div' : _ref$as
|
|
28
|
+
AsElement = _ref$as === void 0 ? 'div' : _ref$as,
|
|
29
|
+
xcss = _ref.xcss;
|
|
30
|
+
var resolvedStyles = parseXcss(xcss);
|
|
28
31
|
return jsx(AsElement, {
|
|
29
|
-
|
|
32
|
+
className: resolvedStyles.static,
|
|
33
|
+
css: [defaultHiddenStyles, above && showAboveQueries[above], below && showBelowQueries[below], resolvedStyles.emotion]
|
|
30
34
|
}, children);
|
|
31
35
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { type ReactNode, type Ref } from 'react';
|
|
2
|
-
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
+
import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
3
3
|
import { type RouterLinkComponentProps } from '@atlaskit/app-provider';
|
|
4
4
|
import { type BoxProps } from './box';
|
|
5
5
|
export type AnchorProps<RouterLinkConfig extends Record<string, any> = never> = RouterLinkComponentProps<RouterLinkConfig> & Omit<BoxProps<'a'>, 'href' | 'as' | 'children' | 'style' | 'onClick'> & {
|
|
@@ -8,7 +8,7 @@ export type AnchorProps<RouterLinkConfig extends Record<string, any> = never> =
|
|
|
8
8
|
*/
|
|
9
9
|
children: ReactNode;
|
|
10
10
|
/**
|
|
11
|
-
* Handler
|
|
11
|
+
* Handler called on click. The second argument can be used to track analytics data. See the tutorial in the analytics-next package for details.
|
|
12
12
|
*/
|
|
13
13
|
onClick?: (e: React.MouseEvent<HTMLAnchorElement>, analyticsEvent: UIAnalyticsEvent) => void;
|
|
14
14
|
/**
|
|
@@ -9,7 +9,7 @@ export type PressableProps = Omit<BoxProps<'button'>, 'disabled' | 'as' | 'child
|
|
|
9
9
|
children: ReactNode;
|
|
10
10
|
isDisabled?: boolean;
|
|
11
11
|
/**
|
|
12
|
-
* Handler
|
|
12
|
+
* Handler called on click. The second argument provides an Atlaskit UI analytics event that can be fired to a listening channel. See the ['analytics-next' package](https://atlaskit.atlassian.com/packages/analytics/analytics-next) documentation for more information.
|
|
13
13
|
*/
|
|
14
14
|
onClick?: (e: React.MouseEvent<HTMLButtonElement>, analyticsEvent: UIAnalyticsEvent) => void;
|
|
15
15
|
/**
|
|
@@ -42,7 +42,7 @@ declare const Pressable: React.ForwardRefExoticComponent<Pick<Omit<BoxProps<"but
|
|
|
42
42
|
children: ReactNode;
|
|
43
43
|
isDisabled?: boolean | undefined;
|
|
44
44
|
/**
|
|
45
|
-
* Handler
|
|
45
|
+
* Handler called on click. The second argument provides an Atlaskit UI analytics event that can be fired to a listening channel. See the ['analytics-next' package](https://atlaskit.atlassian.com/packages/analytics/analytics-next) documentation for more information.
|
|
46
46
|
*/
|
|
47
47
|
onClick?: ((e: React.MouseEvent<HTMLButtonElement>, analyticsEvent: UIAnalyticsEvent) => void) | undefined;
|
|
48
48
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { ReactNode } from 'react';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
|
-
import type
|
|
4
|
+
import { type BasePrimitiveProps } from '../components/types';
|
|
5
|
+
import { type Breakpoint } from './types';
|
|
5
6
|
type As = 'article' | 'aside' | 'dialog' | 'div' | 'footer' | 'header' | 'li' | 'main' | 'nav' | 'ol' | 'section' | 'span' | 'ul';
|
|
6
7
|
type ResponsiveHideProps = {
|
|
7
8
|
as?: As;
|
|
@@ -24,7 +25,7 @@ type ResponsiveHideProps = {
|
|
|
24
25
|
*/
|
|
25
26
|
above: Exclude<Breakpoint, 'xxs'>;
|
|
26
27
|
below?: never;
|
|
27
|
-
})
|
|
28
|
+
}) & Pick<BasePrimitiveProps, 'xcss'>;
|
|
28
29
|
/**
|
|
29
30
|
* Hides the content at a given breakpoint. By default, content is shown. The primary use case is for visual presentation.
|
|
30
31
|
* Mix `<Hide above="md">` with `<Show above="md">` to achieve content that shifts at a breakpoint.
|
|
@@ -33,5 +34,5 @@ type ResponsiveHideProps = {
|
|
|
33
34
|
* - This only uses `display: none` hide, it does not skip rendering of children trees.
|
|
34
35
|
* - As this is rendered at all times, there is little performance savings here (just that this is not painted).
|
|
35
36
|
*/
|
|
36
|
-
export declare const Hide: ({ above, below, children, as: AsElement, }: ResponsiveHideProps) => jsx.JSX.Element;
|
|
37
|
+
export declare const Hide: ({ above, below, children, as: AsElement, xcss, }: ResponsiveHideProps) => jsx.JSX.Element;
|
|
37
38
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { ReactNode } from 'react';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
|
+
import { type BasePrimitiveProps } from '../components/types';
|
|
4
5
|
import type { Breakpoint } from './types';
|
|
5
6
|
type As = 'article' | 'aside' | 'dialog' | 'div' | 'footer' | 'header' | 'li' | 'main' | 'nav' | 'ol' | 'section' | 'span' | 'ul';
|
|
6
7
|
type ResponsiveShowProps = {
|
|
@@ -24,7 +25,7 @@ type ResponsiveShowProps = {
|
|
|
24
25
|
*/
|
|
25
26
|
above: Exclude<Breakpoint, 'xxs'>;
|
|
26
27
|
below?: never;
|
|
27
|
-
})
|
|
28
|
+
}) & Pick<BasePrimitiveProps, 'xcss'>;
|
|
28
29
|
/**
|
|
29
30
|
* Shows the content at a given breakpoint. By default, content is hidden. The primary use case is for visual presentation.
|
|
30
31
|
* Mix `<Show above="md">` with `<Hide above="md">` to achieve content that shifts at a breakpoint.
|
|
@@ -33,5 +34,5 @@ type ResponsiveShowProps = {
|
|
|
33
34
|
* - This only uses `display: none` and `display: revert` to show/hide, it does not skip rendering of children trees.
|
|
34
35
|
* - As this is rendered at all times, there is little performance savings here (just that this is not painted).
|
|
35
36
|
*/
|
|
36
|
-
export declare const Show: ({ above, below, children, as: AsElement, }: ResponsiveShowProps) => jsx.JSX.Element;
|
|
37
|
+
export declare const Show: ({ above, below, children, as: AsElement, xcss, }: ResponsiveShowProps) => jsx.JSX.Element;
|
|
37
38
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { type ReactNode, type Ref } from 'react';
|
|
2
|
-
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
+
import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
3
3
|
import { type RouterLinkComponentProps } from '@atlaskit/app-provider';
|
|
4
4
|
import { type BoxProps } from './box';
|
|
5
5
|
export type AnchorProps<RouterLinkConfig extends Record<string, any> = never> = RouterLinkComponentProps<RouterLinkConfig> & Omit<BoxProps<'a'>, 'href' | 'as' | 'children' | 'style' | 'onClick'> & {
|
|
@@ -8,7 +8,7 @@ export type AnchorProps<RouterLinkConfig extends Record<string, any> = never> =
|
|
|
8
8
|
*/
|
|
9
9
|
children: ReactNode;
|
|
10
10
|
/**
|
|
11
|
-
* Handler
|
|
11
|
+
* Handler called on click. The second argument can be used to track analytics data. See the tutorial in the analytics-next package for details.
|
|
12
12
|
*/
|
|
13
13
|
onClick?: (e: React.MouseEvent<HTMLAnchorElement>, analyticsEvent: UIAnalyticsEvent) => void;
|
|
14
14
|
/**
|
|
@@ -9,7 +9,7 @@ export type PressableProps = Omit<BoxProps<'button'>, 'disabled' | 'as' | 'child
|
|
|
9
9
|
children: ReactNode;
|
|
10
10
|
isDisabled?: boolean;
|
|
11
11
|
/**
|
|
12
|
-
* Handler
|
|
12
|
+
* Handler called on click. The second argument provides an Atlaskit UI analytics event that can be fired to a listening channel. See the ['analytics-next' package](https://atlaskit.atlassian.com/packages/analytics/analytics-next) documentation for more information.
|
|
13
13
|
*/
|
|
14
14
|
onClick?: (e: React.MouseEvent<HTMLButtonElement>, analyticsEvent: UIAnalyticsEvent) => void;
|
|
15
15
|
/**
|
|
@@ -42,7 +42,7 @@ declare const Pressable: React.ForwardRefExoticComponent<Pick<Omit<BoxProps<"but
|
|
|
42
42
|
children: ReactNode;
|
|
43
43
|
isDisabled?: boolean | undefined;
|
|
44
44
|
/**
|
|
45
|
-
* Handler
|
|
45
|
+
* Handler called on click. The second argument provides an Atlaskit UI analytics event that can be fired to a listening channel. See the ['analytics-next' package](https://atlaskit.atlassian.com/packages/analytics/analytics-next) documentation for more information.
|
|
46
46
|
*/
|
|
47
47
|
onClick?: ((e: React.MouseEvent<HTMLButtonElement>, analyticsEvent: UIAnalyticsEvent) => void) | undefined;
|
|
48
48
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { ReactNode } from 'react';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
|
-
import type
|
|
4
|
+
import { type BasePrimitiveProps } from '../components/types';
|
|
5
|
+
import { type Breakpoint } from './types';
|
|
5
6
|
type As = 'article' | 'aside' | 'dialog' | 'div' | 'footer' | 'header' | 'li' | 'main' | 'nav' | 'ol' | 'section' | 'span' | 'ul';
|
|
6
7
|
type ResponsiveHideProps = {
|
|
7
8
|
as?: As;
|
|
@@ -24,7 +25,7 @@ type ResponsiveHideProps = {
|
|
|
24
25
|
*/
|
|
25
26
|
above: Exclude<Breakpoint, 'xxs'>;
|
|
26
27
|
below?: never;
|
|
27
|
-
})
|
|
28
|
+
}) & Pick<BasePrimitiveProps, 'xcss'>;
|
|
28
29
|
/**
|
|
29
30
|
* Hides the content at a given breakpoint. By default, content is shown. The primary use case is for visual presentation.
|
|
30
31
|
* Mix `<Hide above="md">` with `<Show above="md">` to achieve content that shifts at a breakpoint.
|
|
@@ -33,5 +34,5 @@ type ResponsiveHideProps = {
|
|
|
33
34
|
* - This only uses `display: none` hide, it does not skip rendering of children trees.
|
|
34
35
|
* - As this is rendered at all times, there is little performance savings here (just that this is not painted).
|
|
35
36
|
*/
|
|
36
|
-
export declare const Hide: ({ above, below, children, as: AsElement, }: ResponsiveHideProps) => jsx.JSX.Element;
|
|
37
|
+
export declare const Hide: ({ above, below, children, as: AsElement, xcss, }: ResponsiveHideProps) => jsx.JSX.Element;
|
|
37
38
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { ReactNode } from 'react';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
|
+
import { type BasePrimitiveProps } from '../components/types';
|
|
4
5
|
import type { Breakpoint } from './types';
|
|
5
6
|
type As = 'article' | 'aside' | 'dialog' | 'div' | 'footer' | 'header' | 'li' | 'main' | 'nav' | 'ol' | 'section' | 'span' | 'ul';
|
|
6
7
|
type ResponsiveShowProps = {
|
|
@@ -24,7 +25,7 @@ type ResponsiveShowProps = {
|
|
|
24
25
|
*/
|
|
25
26
|
above: Exclude<Breakpoint, 'xxs'>;
|
|
26
27
|
below?: never;
|
|
27
|
-
})
|
|
28
|
+
}) & Pick<BasePrimitiveProps, 'xcss'>;
|
|
28
29
|
/**
|
|
29
30
|
* Shows the content at a given breakpoint. By default, content is hidden. The primary use case is for visual presentation.
|
|
30
31
|
* Mix `<Show above="md">` with `<Hide above="md">` to achieve content that shifts at a breakpoint.
|
|
@@ -33,5 +34,5 @@ type ResponsiveShowProps = {
|
|
|
33
34
|
* - This only uses `display: none` and `display: revert` to show/hide, it does not skip rendering of children trees.
|
|
34
35
|
* - As this is rendered at all times, there is little performance savings here (just that this is not painted).
|
|
35
36
|
*/
|
|
36
|
-
export declare const Show: ({ above, below, children, as: AsElement, }: ResponsiveShowProps) => jsx.JSX.Element;
|
|
37
|
+
export declare const Show: ({ above, below, children, as: AsElement, xcss, }: ResponsiveShowProps) => jsx.JSX.Element;
|
|
37
38
|
export {};
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
// TODO: Switch from ERT to ts-morph when this is completed and has reasonable adoption: https://product-fabric.atlassian.net/browse/DSP-10364
|
|
2
|
-
import React
|
|
2
|
+
import type React from 'react';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
type BasePrimitiveProps,
|
|
8
|
+
type StyleProp,
|
|
9
|
+
} from '../src/components/types';
|
|
5
10
|
|
|
6
11
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
7
12
|
namespace Token {
|
|
@@ -30,19 +35,17 @@ export default function Anchor<
|
|
|
30
35
|
>(
|
|
31
36
|
_: {
|
|
32
37
|
/**
|
|
33
|
-
* A link can be provided as a string
|
|
34
|
-
* it can be mapped to the underlying router link component,
|
|
35
|
-
* or optionally a custom object defined in the generic type for advanced use.
|
|
38
|
+
* A link can be provided as a string If a router link configuration is set in the [app provider](https://atlassian.design/components/app-provider/examples), this can be mapped to an underlying router link component. For advanced usage an object can be passed. See [the code examples](https://atlassian.design/components/primitives/anchor/examples#router-links) for more information.
|
|
36
39
|
*/
|
|
37
40
|
href: string | RouterLinkConfig;
|
|
38
41
|
|
|
39
42
|
/**
|
|
40
|
-
* The `target` attribute of the anchor HTML element.
|
|
43
|
+
* The `target` attribute of the anchor HTML element.
|
|
41
44
|
*/
|
|
42
45
|
target?: React.AnchorHTMLAttributes<HTMLAnchorElement>['target'];
|
|
43
46
|
|
|
44
47
|
/**
|
|
45
|
-
* The `rel` attribute of the anchor HTML element.
|
|
48
|
+
* The `rel` attribute of the anchor HTML element.
|
|
46
49
|
*/
|
|
47
50
|
rel?: React.AnchorHTMLAttributes<HTMLAnchorElement>['rel'];
|
|
48
51
|
|
|
@@ -81,6 +84,29 @@ export default function Anchor<
|
|
|
81
84
|
*/
|
|
82
85
|
paddingInlineEnd?: Space;
|
|
83
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Handler called on click. You can use the second argument to fire Atlaskit analytics events on custom channels. They could then be routed to GASv3 analytics. See the code examples for information on [firing Atlaskit analytics events](https://atlassian.design/components/primitives/anchor/examples#atlaskit-analytics) or [routing these to GASv3 analytics](https://atlassian.design/components/primitives/anchor/examples#gasv3-analytics).
|
|
89
|
+
*/
|
|
90
|
+
onClick?: (
|
|
91
|
+
e: React.MouseEvent<HTMLButtonElement>,
|
|
92
|
+
analyticsEvent: UIAnalyticsEvent,
|
|
93
|
+
) => void;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* An optional component name used to identify this component to Atlaskit analytics press listeners. This can be altered if a parent component's name is preferred rather than the default 'Anchor'. See [the code example](https://atlassian.design/components/primitives/anchor/examples#atlaskit-analytics) for more information.
|
|
97
|
+
*/
|
|
98
|
+
componentName?: string;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Additional information to be included in the `context` of Atlaskit analytics events that come from anchor. See [the code example](https://atlassian.design/components/primitives/anchor/examples#atlaskit-analytics) for more information.
|
|
102
|
+
*/
|
|
103
|
+
analyticsContext?: Record<string, any>;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* An optional name used to identify the anchor to interaction content listeners. By default, anchor fires React UFO (Unified Frontend Observability) press interactions for available listeners. This helps Atlassian measure performance and reliability. See [the code example](https://atlassian.design/components/primitives/anchor/examples#react-ufo-press-interactions) for more information.
|
|
107
|
+
*/
|
|
108
|
+
interactionName?: string;
|
|
109
|
+
|
|
84
110
|
/**
|
|
85
111
|
* A token alias for background color. See:<br>
|
|
86
112
|
* [https://atlassian.design/components/tokens/all-tokens#color-background](https://atlassian.design/components/tokens/all-tokens#color-background)<br>
|
|
@@ -92,7 +118,7 @@ export default function Anchor<
|
|
|
92
118
|
/**
|
|
93
119
|
* Elements to be rendered inside the primitive.
|
|
94
120
|
*/
|
|
95
|
-
children: ReactNode;
|
|
121
|
+
children: React.ReactNode;
|
|
96
122
|
|
|
97
123
|
/**
|
|
98
124
|
* Forwarded ref element.
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
// TODO: Switch from ERT to ts-morph when this is completed and has reasonable adoption: https://product-fabric.atlassian.net/browse/DSP-10364
|
|
2
|
-
import React
|
|
2
|
+
import type React from 'react';
|
|
3
3
|
|
|
4
|
-
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
4
|
+
import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
type BasePrimitiveProps,
|
|
8
|
+
type StyleProp,
|
|
9
|
+
} from '../src/components/types';
|
|
7
10
|
|
|
8
11
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
9
12
|
namespace Token {
|
|
@@ -82,7 +85,7 @@ export default function Pressable(
|
|
|
82
85
|
backgroundColor?: Token.BackgroundColor;
|
|
83
86
|
|
|
84
87
|
/**
|
|
85
|
-
* Handler
|
|
88
|
+
* Handler called on click. You can use the second argument to fire Atlaskit analytics events on custom channels. They could then be routed to GASv3 analytics. See the code examples for information on [firing Atlaskit analytics events](https://atlassian.design/components/primitives/pressable/examples#atlaskit-analytics) or [routing these to GASv3 analytics](https://atlassian.design/components/primitives/pressable/examples#gasv3-analytics).
|
|
86
89
|
*/
|
|
87
90
|
onClick?: (
|
|
88
91
|
e: React.MouseEvent<HTMLButtonElement>,
|
|
@@ -90,24 +93,24 @@ export default function Pressable(
|
|
|
90
93
|
) => void;
|
|
91
94
|
|
|
92
95
|
/**
|
|
93
|
-
* An optional name used to identify
|
|
96
|
+
* An optional component name used to identify this component to Atlaskit analytics press listeners. This can be altered if a parent component's name is preferred rather than the default 'Pressable'. See [the code example](https://atlassian.design/components/primitives/pressable/examples#atlaskit-analytics) for more information.
|
|
94
97
|
*/
|
|
95
|
-
|
|
98
|
+
componentName?: string;
|
|
96
99
|
|
|
97
100
|
/**
|
|
98
|
-
*
|
|
101
|
+
* Additional information to be included in the `context` of Atlaskit analytics events that come from pressable. See [the code example](https://atlassian.design/components/primitives/pressable/examples#atlaskit-analytics) for more information.
|
|
99
102
|
*/
|
|
100
|
-
|
|
103
|
+
analyticsContext?: Record<string, any>;
|
|
101
104
|
|
|
102
105
|
/**
|
|
103
|
-
*
|
|
106
|
+
* An optional name used to identify the pressable to interaction content listeners. By default, pressable fires React UFO (Unified Frontend Observability) press interactions for available listeners. This helps Atlassian measure performance and reliability. See [the code example](https://atlassian.design/components/primitives/pressable/examples#react-ufo-press-interactions) for more information.
|
|
104
107
|
*/
|
|
105
|
-
|
|
108
|
+
interactionName?: string;
|
|
106
109
|
|
|
107
110
|
/**
|
|
108
111
|
* Elements to be rendered inside the primitive.
|
|
109
112
|
*/
|
|
110
|
-
children: ReactNode;
|
|
113
|
+
children: React.ReactNode;
|
|
111
114
|
|
|
112
115
|
/**
|
|
113
116
|
* Forwarded ref element.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/primitives",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.0",
|
|
4
4
|
"description": "Primitives are token-backed low-level building blocks.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"slug": "primitives/text",
|
|
95
95
|
"id": "@atlaskit/primitives/text",
|
|
96
96
|
"status": {
|
|
97
|
-
"type": "
|
|
97
|
+
"type": "beta"
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
100
|
{
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"slug": "primitives/anchor",
|
|
113
113
|
"id": "@atlaskit/primitives/anchor",
|
|
114
114
|
"status": {
|
|
115
|
-
"type": "
|
|
115
|
+
"type": "closed-beta"
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
]
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
"@atlaskit/css": "^0.1.0",
|
|
129
129
|
"@atlaskit/ds-lib": "^2.3.0",
|
|
130
130
|
"@atlaskit/interaction-context": "^2.1.0",
|
|
131
|
-
"@atlaskit/tokens": "^1.
|
|
131
|
+
"@atlaskit/tokens": "^1.49.0",
|
|
132
132
|
"@atlaskit/visually-hidden": "^1.3.0",
|
|
133
133
|
"@babel/runtime": "^7.0.0",
|
|
134
134
|
"@emotion/react": "^11.7.1",
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
"@af/formatting": "*",
|
|
145
145
|
"@atlaskit/ssr": "*",
|
|
146
146
|
"@atlaskit/toggle": "^13.1.0",
|
|
147
|
-
"@atlaskit/tooltip": "^18.
|
|
147
|
+
"@atlaskit/tooltip": "^18.4.0",
|
|
148
148
|
"@atlaskit/visual-regression": "*",
|
|
149
149
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
150
150
|
"@atlassian/codegen": "^0.1.0",
|
|
File without changes
|