@atlaskit/primitives 11.1.2 → 12.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +68 -0
- package/constellation/box/usage.mdx +3 -2
- package/constellation/overview/index.mdx +2 -0
- package/dist/cjs/components/anchor.js +1 -1
- package/dist/cjs/components/box.js +1 -1
- package/dist/cjs/components/pressable.js +1 -1
- package/dist/es2019/components/anchor.js +1 -1
- package/dist/es2019/components/box.js +1 -1
- package/dist/es2019/components/pressable.js +1 -1
- package/dist/esm/components/anchor.js +1 -1
- package/dist/esm/components/box.js +1 -1
- package/dist/esm/components/pressable.js +1 -1
- package/dist/types/components/box.d.ts +1 -1
- package/dist/types-ts4.5/components/box.d.ts +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,73 @@
|
|
|
1
1
|
# @atlaskit/primitives
|
|
2
2
|
|
|
3
|
+
## 12.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 12.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- [#128232](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/128232)
|
|
14
|
+
[`c97dfe9e5b27d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c97dfe9e5b27d) -
|
|
15
|
+
Box no longer supports usage as an anchor tag (`<a>`). Use
|
|
16
|
+
[the Anchor primitive](https://atlassian.design/components/primitives/anchor/examples) instead,
|
|
17
|
+
which is more specialized. This has benefits including:
|
|
18
|
+
|
|
19
|
+
- Built-in event tracking support
|
|
20
|
+
- Default text underlines
|
|
21
|
+
- Automatic router link configuration from `@atlaskit/app-provider`
|
|
22
|
+
- Built-in accessible focus styles
|
|
23
|
+
- Warning screen-readers when links open in new windows
|
|
24
|
+
|
|
25
|
+
**Migrating to Anchor**
|
|
26
|
+
|
|
27
|
+
- First consider if another ADS link component such as `@atlaskit/link` is better suited rather
|
|
28
|
+
than building a custom anchor.
|
|
29
|
+
- Anchor has focus ring styles built-in, so remove existing styles including
|
|
30
|
+
`@atlaskit/focus-ring`.
|
|
31
|
+
- Anchor has a default cursor (`cursor: pointer`), so existing styles can be removed.
|
|
32
|
+
- Anchor has a default link underline, so an existing style can be removed.
|
|
33
|
+
|
|
34
|
+
**Before migration**
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
38
|
+
import FocusRing from '@atlaskit/focus-ring';
|
|
39
|
+
|
|
40
|
+
const anchorStyles = xcss({
|
|
41
|
+
cursor: 'pointer',
|
|
42
|
+
color: 'color.link',
|
|
43
|
+
textDecoration: 'underline',
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const MyApp = () => (
|
|
47
|
+
<FocusRing>
|
|
48
|
+
<Box as="a" href="/foo" xcss={anchorStyles}>
|
|
49
|
+
Hello
|
|
50
|
+
</Box>
|
|
51
|
+
</FocusRing>
|
|
52
|
+
);
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**After migration**
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
import { Anchor, xcss } from '@atlaskit/primitives';
|
|
59
|
+
|
|
60
|
+
const anchorStyles = xcss({
|
|
61
|
+
color: 'color.link',
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const MyApp = () => (
|
|
65
|
+
<Anchor href="/foo" xcss={anchorStyles}>
|
|
66
|
+
Hello
|
|
67
|
+
</Anchor>
|
|
68
|
+
);
|
|
69
|
+
```
|
|
70
|
+
|
|
3
71
|
## 11.1.2
|
|
4
72
|
|
|
5
73
|
### Patch Changes
|
|
@@ -21,8 +21,8 @@ section wrappers.
|
|
|
21
21
|
Box, being generic in nature, can be "over-used", so it’s important to consider situations where
|
|
22
22
|
more specific and expressive primitives could be used. For example, use
|
|
23
23
|
[inline](/components/primitives/inline/usage) and [stack](/components/primitives/stack/usage) to
|
|
24
|
-
manage horizontal and vertical layouts,
|
|
25
|
-
build custom
|
|
24
|
+
manage horizontal and vertical layouts, [pressable](/components/primitives/pressable/usage) to build
|
|
25
|
+
custom buttons, or [anchor](/components/primitives/anchor/usage) to build custom links.
|
|
26
26
|
|
|
27
27
|
## Styling
|
|
28
28
|
|
|
@@ -43,4 +43,5 @@ Display behavior is set by using the available props or using
|
|
|
43
43
|
- [Manage horizontal layout using an inline component](/components/primitives/inline/usage)
|
|
44
44
|
- [Manage vertical layout using a stack component](/components/primitives/stack/usage)
|
|
45
45
|
- [Build custom buttons using a pressable component](/components/primitives/pressable/usage)
|
|
46
|
+
- [Build custom links using an anchor component](/components/primitives/anchor/usage)
|
|
46
47
|
- [Use design tokens in code with XCSS](/components/primitives/XCSS/usage)
|
|
@@ -45,6 +45,7 @@ Additional layouts not well-expressed by these core primitives can also be compo
|
|
|
45
45
|
Interactive primitives can be used to build:
|
|
46
46
|
|
|
47
47
|
- buttons (see [pressable](/components/primitives/pressable))
|
|
48
|
+
- links (see [anchor](/components/primitives/anchor))
|
|
48
49
|
|
|
49
50
|
## Installation
|
|
50
51
|
|
|
@@ -97,4 +98,5 @@ and vertical `Stack` components.
|
|
|
97
98
|
- [Bleed](/components/primitives/bleed/examples)
|
|
98
99
|
- [Flex](/components/primitives/flex/examples)
|
|
99
100
|
- [Pressable](/components/primitives/pressable/examples)
|
|
101
|
+
- [Anchor](/components/primitives/anchor/examples)
|
|
100
102
|
- [xcss](/components/primitives/xcss/usage)
|
|
@@ -105,7 +105,7 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
105
105
|
action: 'clicked',
|
|
106
106
|
componentName: componentName || 'Anchor',
|
|
107
107
|
packageName: "@atlaskit/primitives",
|
|
108
|
-
packageVersion: "
|
|
108
|
+
packageVersion: "12.0.1",
|
|
109
109
|
analyticsData: analyticsContext,
|
|
110
110
|
actionSubject: 'link'
|
|
111
111
|
});
|
|
@@ -19,7 +19,7 @@ var _excluded = ["as", "children", "backgroundColor", "padding", "paddingBlock",
|
|
|
19
19
|
* @jsx jsx
|
|
20
20
|
*/
|
|
21
21
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
22
|
-
// Can either Exclude or Extract - here we're excluding all SVG-related elements
|
|
22
|
+
// Can either Exclude or Extract - here we're excluding all SVG-related elements, <button> elements (handled by Pressable), and <a> elements (handled by Anchor)
|
|
23
23
|
|
|
24
24
|
// Basically just ElementType but without ComponentType, it makes sense to keep the "Type" suffix
|
|
25
25
|
// eslint-disable-next-line @repo/internal/react/consistent-types-definitions
|
|
@@ -95,7 +95,7 @@ var Pressable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
95
95
|
action: 'clicked',
|
|
96
96
|
componentName: componentName || 'Pressable',
|
|
97
97
|
packageName: "@atlaskit/primitives",
|
|
98
|
-
packageVersion: "
|
|
98
|
+
packageVersion: "12.0.1",
|
|
99
99
|
analyticsData: analyticsContext,
|
|
100
100
|
actionSubject: 'button'
|
|
101
101
|
});
|
|
@@ -11,7 +11,7 @@ import { backgroundColorStylesMap, isSurfaceColorToken, paddingStylesMap, surfac
|
|
|
11
11
|
import { parseXcss } from '../xcss/xcss';
|
|
12
12
|
import { SurfaceContext } from './internal/surface-provider';
|
|
13
13
|
|
|
14
|
-
// Can either Exclude or Extract - here we're excluding all SVG-related elements
|
|
14
|
+
// Can either Exclude or Extract - here we're excluding all SVG-related elements, <button> elements (handled by Pressable), and <a> elements (handled by Anchor)
|
|
15
15
|
|
|
16
16
|
// Basically just ElementType but without ComponentType, it makes sense to keep the "Type" suffix
|
|
17
17
|
// eslint-disable-next-line @repo/internal/react/consistent-types-definitions
|
|
@@ -85,7 +85,7 @@ const Pressable = /*#__PURE__*/forwardRef(({
|
|
|
85
85
|
action: 'clicked',
|
|
86
86
|
componentName: componentName || 'Pressable',
|
|
87
87
|
packageName: "@atlaskit/primitives",
|
|
88
|
-
packageVersion: "
|
|
88
|
+
packageVersion: "12.0.1",
|
|
89
89
|
analyticsData: analyticsContext,
|
|
90
90
|
actionSubject: 'button'
|
|
91
91
|
});
|
|
@@ -99,7 +99,7 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
99
99
|
action: 'clicked',
|
|
100
100
|
componentName: componentName || 'Anchor',
|
|
101
101
|
packageName: "@atlaskit/primitives",
|
|
102
|
-
packageVersion: "
|
|
102
|
+
packageVersion: "12.0.1",
|
|
103
103
|
analyticsData: analyticsContext,
|
|
104
104
|
actionSubject: 'link'
|
|
105
105
|
});
|
|
@@ -14,7 +14,7 @@ import { backgroundColorStylesMap, isSurfaceColorToken, paddingStylesMap, surfac
|
|
|
14
14
|
import { parseXcss } from '../xcss/xcss';
|
|
15
15
|
import { SurfaceContext } from './internal/surface-provider';
|
|
16
16
|
|
|
17
|
-
// Can either Exclude or Extract - here we're excluding all SVG-related elements
|
|
17
|
+
// Can either Exclude or Extract - here we're excluding all SVG-related elements, <button> elements (handled by Pressable), and <a> elements (handled by Anchor)
|
|
18
18
|
|
|
19
19
|
// Basically just ElementType but without ComponentType, it makes sense to keep the "Type" suffix
|
|
20
20
|
// eslint-disable-next-line @repo/internal/react/consistent-types-definitions
|
|
@@ -89,7 +89,7 @@ var Pressable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
89
89
|
action: 'clicked',
|
|
90
90
|
componentName: componentName || 'Pressable',
|
|
91
91
|
packageName: "@atlaskit/primitives",
|
|
92
|
-
packageVersion: "
|
|
92
|
+
packageVersion: "12.0.1",
|
|
93
93
|
analyticsData: analyticsContext,
|
|
94
94
|
actionSubject: 'button'
|
|
95
95
|
});
|
|
@@ -6,7 +6,7 @@ import { type ComponentPropsWithoutRef, type ComponentPropsWithRef, type ReactEl
|
|
|
6
6
|
import { type BackgroundColor, type Space } from '../xcss/style-maps.partial';
|
|
7
7
|
import { type SVGElements } from './internal/types';
|
|
8
8
|
import type { BasePrimitiveProps, StyleProp } from './types';
|
|
9
|
-
type AllowedElements = Exclude<keyof JSX.IntrinsicElements, SVGElements | 'button'>;
|
|
9
|
+
type AllowedElements = Exclude<keyof JSX.IntrinsicElements, SVGElements | 'button' | 'a'>;
|
|
10
10
|
type CustomElementType<P = any> = {
|
|
11
11
|
[K in AllowedElements]: P extends JSX.IntrinsicElements[K] ? K : never;
|
|
12
12
|
}[AllowedElements];
|
|
@@ -6,7 +6,7 @@ import { type ComponentPropsWithoutRef, type ComponentPropsWithRef, type ReactEl
|
|
|
6
6
|
import { type BackgroundColor, type Space } from '../xcss/style-maps.partial';
|
|
7
7
|
import { type SVGElements } from './internal/types';
|
|
8
8
|
import type { BasePrimitiveProps, StyleProp } from './types';
|
|
9
|
-
type AllowedElements = Exclude<keyof JSX.IntrinsicElements, SVGElements | 'button'>;
|
|
9
|
+
type AllowedElements = Exclude<keyof JSX.IntrinsicElements, SVGElements | 'button' | 'a'>;
|
|
10
10
|
type CustomElementType<P = any> = {
|
|
11
11
|
[K in AllowedElements]: P extends JSX.IntrinsicElements[K] ? K : never;
|
|
12
12
|
}[AllowedElements];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/primitives",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.1",
|
|
4
4
|
"description": "Primitives are token-backed low-level building blocks.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -117,13 +117,13 @@
|
|
|
117
117
|
"codegen-styles": "ts-node -r tsconfig-paths/register ./scripts/codegen-styles.tsx"
|
|
118
118
|
},
|
|
119
119
|
"dependencies": {
|
|
120
|
-
"@atlaskit/analytics-next": "^10.
|
|
121
|
-
"@atlaskit/app-provider": "^1.
|
|
122
|
-
"@atlaskit/css": "^0.
|
|
123
|
-
"@atlaskit/ds-lib": "^2.
|
|
120
|
+
"@atlaskit/analytics-next": "^10.1.0",
|
|
121
|
+
"@atlaskit/app-provider": "^1.4.0",
|
|
122
|
+
"@atlaskit/css": "^0.4.0",
|
|
123
|
+
"@atlaskit/ds-lib": "^2.4.0",
|
|
124
124
|
"@atlaskit/interaction-context": "^2.1.0",
|
|
125
|
-
"@atlaskit/tokens": "^1.
|
|
126
|
-
"@atlaskit/visually-hidden": "^1.
|
|
125
|
+
"@atlaskit/tokens": "^1.58.0",
|
|
126
|
+
"@atlaskit/visually-hidden": "^1.5.0",
|
|
127
127
|
"@babel/runtime": "^7.0.0",
|
|
128
128
|
"@emotion/react": "^11.7.1",
|
|
129
129
|
"@emotion/serialize": "^1.1.0",
|
|
@@ -138,8 +138,8 @@
|
|
|
138
138
|
"@af/accessibility-testing": "*",
|
|
139
139
|
"@af/formatting": "*",
|
|
140
140
|
"@atlaskit/ssr": "*",
|
|
141
|
-
"@atlaskit/toggle": "^13.
|
|
142
|
-
"@atlaskit/tooltip": "^18.
|
|
141
|
+
"@atlaskit/toggle": "^13.3.0",
|
|
142
|
+
"@atlaskit/tooltip": "^18.7.0",
|
|
143
143
|
"@atlaskit/visual-regression": "*",
|
|
144
144
|
"@atlassian/codegen": "^0.1.0",
|
|
145
145
|
"@testing-library/react": "^12.1.5",
|