@atlaskit/primitives 11.1.1 → 12.0.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 CHANGED
@@ -1,5 +1,73 @@
1
1
  # @atlaskit/primitives
2
2
 
3
+ ## 12.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#128232](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/128232)
8
+ [`c97dfe9e5b27d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c97dfe9e5b27d) -
9
+ Box no longer supports usage as an anchor tag (`<a>`). Use
10
+ [the Anchor primitive](https://atlassian.design/components/primitives/anchor/examples) instead,
11
+ which is more specialized. This has benefits including:
12
+
13
+ - Built-in event tracking support
14
+ - Default text underlines
15
+ - Automatic router link configuration from `@atlaskit/app-provider`
16
+ - Built-in accessible focus styles
17
+ - Warning screen-readers when links open in new windows
18
+
19
+ **Migrating to Anchor**
20
+
21
+ - First consider if another ADS link component such as `@atlaskit/link` is better suited rather
22
+ than building a custom anchor.
23
+ - Anchor has focus ring styles built-in, so remove existing styles including
24
+ `@atlaskit/focus-ring`.
25
+ - Anchor has a default cursor (`cursor: pointer`), so existing styles can be removed.
26
+ - Anchor has a default link underline, so an existing style can be removed.
27
+
28
+ **Before migration**
29
+
30
+ ```tsx
31
+ import { Box, xcss } from '@atlaskit/primitives';
32
+ import FocusRing from '@atlaskit/focus-ring';
33
+
34
+ const anchorStyles = xcss({
35
+ cursor: 'pointer',
36
+ color: 'color.link',
37
+ textDecoration: 'underline',
38
+ });
39
+
40
+ const MyApp = () => (
41
+ <FocusRing>
42
+ <Box as="a" href="/foo" xcss={anchorStyles}>
43
+ Hello
44
+ </Box>
45
+ </FocusRing>
46
+ );
47
+ ```
48
+
49
+ **After migration**
50
+
51
+ ```tsx
52
+ import { Anchor, xcss } from '@atlaskit/primitives';
53
+
54
+ const anchorStyles = xcss({
55
+ color: 'color.link',
56
+ });
57
+
58
+ const MyApp = () => (
59
+ <Anchor href="/foo" xcss={anchorStyles}>
60
+ Hello
61
+ </Anchor>
62
+ );
63
+ ```
64
+
65
+ ## 11.1.2
66
+
67
+ ### Patch Changes
68
+
69
+ - Updated dependencies
70
+
3
71
  ## 11.1.1
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, or [pressable](/components/primitives/pressable/usage) to
25
- build custom buttons.
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: "11.1.1",
108
+ packageVersion: "12.0.0",
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 and button (handled by Pressable)
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: "11.1.1",
98
+ packageVersion: "12.0.0",
99
99
  analyticsData: analyticsContext,
100
100
  actionSubject: 'button'
101
101
  });
@@ -95,7 +95,7 @@ const AnchorNoRef = ({
95
95
  action: 'clicked',
96
96
  componentName: componentName || 'Anchor',
97
97
  packageName: "@atlaskit/primitives",
98
- packageVersion: "11.1.1",
98
+ packageVersion: "12.0.0",
99
99
  analyticsData: analyticsContext,
100
100
  actionSubject: 'link'
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 and button (handled by Pressable)
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: "11.1.1",
88
+ packageVersion: "12.0.0",
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: "11.1.1",
102
+ packageVersion: "12.0.0",
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 and button (handled by Pressable)
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: "11.1.1",
92
+ packageVersion: "12.0.0",
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": "11.1.1",
3
+ "version": "12.0.0",
4
4
  "description": "Primitives are token-backed low-level building blocks.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -117,7 +117,7 @@
117
117
  "codegen-styles": "ts-node -r tsconfig-paths/register ./scripts/codegen-styles.tsx"
118
118
  },
119
119
  "dependencies": {
120
- "@atlaskit/analytics-next": "^9.3.0",
120
+ "@atlaskit/analytics-next": "^10.0.0",
121
121
  "@atlaskit/app-provider": "^1.3.0",
122
122
  "@atlaskit/css": "^0.3.0",
123
123
  "@atlaskit/ds-lib": "^2.3.0",
@@ -139,7 +139,7 @@
139
139
  "@af/formatting": "*",
140
140
  "@atlaskit/ssr": "*",
141
141
  "@atlaskit/toggle": "^13.2.0",
142
- "@atlaskit/tooltip": "^18.5.0",
142
+ "@atlaskit/tooltip": "^18.6.0",
143
143
  "@atlaskit/visual-regression": "*",
144
144
  "@atlassian/codegen": "^0.1.0",
145
145
  "@testing-library/react": "^12.1.5",