@atlaskit/primitives 5.2.0 → 5.4.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,22 @@
1
1
  # @atlaskit/primitives
2
2
 
3
+ ## 5.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#85745](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/85745) [`0e9c8c15ef86`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0e9c8c15ef86) - Extends XCSS selector types to allow up to two CSS psuedos to be used in combination. For example: `:visited:hover {}`.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+
13
+ ## 5.3.0
14
+
15
+ ### Minor Changes
16
+
17
+ - [#86400](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/86400) [`92f574fd392d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/92f574fd392d) - - Anchor now suffixes the accessible label with visually hidden text "(opens new window)" when `target` is set to `_blank`. This improves accessibility for screen readers.
18
+ - Anchor no longer automatically opens external links in new windows, which is a poor usability and accessibility practice. Previously this involved applying default attributes `rel="noopener noreferrer"` and `target="_blank"` when the link was detected to link externally.
19
+
3
20
  ## 5.2.0
4
21
 
5
22
  ### Minor Changes
@@ -5,7 +5,9 @@ order: 0
5
5
  ---
6
6
 
7
7
  import PressableDefault from '../../examples/constellation/pressable/default';
8
+ import PressableBasic from '../../examples/constellation/pressable/basic';
8
9
  import PressableStyled from '../../examples/constellation/pressable/styled';
10
+ import PressableDisabled from '../../examples/constellation/pressable/disabled';
9
11
 
10
12
  import { CodeDocsHeader } from '@af/design-system-docs-ui';
11
13
  import SectionMessage from '@atlaskit/section-message';
@@ -18,22 +20,45 @@ import SectionMessage from '@atlaskit/section-message';
18
20
 
19
21
  Pressable is a primitive used for building custom buttons with Atlassian Design System styling. This component is used by other design system components, such as the [Button component](/components/button/examples).
20
22
 
21
- For most buttons, use the [Button component](/components/button/examples) wherever possible, and use [XCSS](/components/primitives/xcss/usage) for any necessary customization. Only use pressable if you aren't able to use the button component.
23
+ Only use Pressable when [the Button component](/components/button/examples) is unsuitable and unable to be customized with [XCSS](/components/primitives/xcss/usage).
22
24
 
23
25
  ## Default
24
26
 
25
- Pressable comes unstyled, ready for styles to be applied.
27
+ Pressable is unstyled by default.
26
28
 
27
29
  <Example
28
30
  Component={PressableDefault}
29
31
  packageName="@atlaskit/primitives/pressable"
30
32
  />
31
33
 
32
- ## Styling
34
+ ## Basic styling with XCSS
33
35
 
34
- Pressable consumes the Box primitive to provide a consistent styling API that supports design tokens. See [Box](/components/primitives/box/examples) for complete styling documentation and examples.
36
+ Pressable can be styled using XCSS. Ensure styling indicates the interaction state using `:hover` and `:active` pseudo-classes.
37
+
38
+ By default, pressable includes consistent Atlassian Design System `:focus` styles so it's not necessary to add your own.
39
+
40
+ For more information on XCSS, see the dedicated [XCSS documentation](/components/primitives/xcss).
41
+
42
+ <Example
43
+ Component={PressableBasic}
44
+ packageName="@atlaskit/primitives/pressable"
45
+ />
46
+
47
+ ## Disabled
48
+
49
+ Pressable can be disabled using the `isDisabled` prop. Disabled styles should be conditionally applied and defined using XCSS.
50
+
51
+ <Example
52
+ Component={PressableDisabled}
53
+ packageName="@atlaskit/primitives/pressable"
54
+ />
55
+
56
+ ## Advanced styling
57
+
58
+ Advanced styling can be achieved using a combination of XCSS and other primitives.
35
59
 
36
60
  <Example
37
61
  Component={PressableStyled}
38
62
  packageName="@atlaskit/primitives/pressable"
63
+ backgroundColor="white"
39
64
  />
@@ -4,20 +4,97 @@ description: A pressable is a primitive used for building custom buttons.
4
4
  order: 2
5
5
  ---
6
6
 
7
- ## When not to use pressable
7
+ import pressablePrimaryDo from './images/pressable-01a-do.png';
8
+ import pressablePrimaryDont from './images/pressable-01b-dont.png';
8
9
 
9
- The [Button component](/components/button/usage) should be used whenever possible for buttons to maintain visual consistency. Only use pressable when building custom buttons beyond the capabilities of the button component. The decision to use pressable should involve checking if the button component can be customized to fit your needs using [XCSS](/components/primitives/XCSS/usage).
10
+ 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.
10
11
 
11
- Do not use Pressable for links (anchor tags). Use the equivalent [Anchor primitive](/components/primitives/anchor/usage) instead.
12
+ ![Pressable anatomy](./images/pressable-anatomy.png)
12
13
 
13
- ## Styling
14
+ 1. **Pressable area:** For accessibility this should be a minimum of 24 by 24 pixels, unless exempt from [Target Size (Minimum) (Level AA)](https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html).
15
+ 2. **Focus ring**: This is included in pressable and appears on keyboard focus.
16
+ 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.
14
17
 
15
- Display behavior follows the same patterns as [Box](/components/primitives/box/usage). Use available props or [XCSS](/components/primitives/xcss/usage) to customize padding options, background color, and other styles.
18
+ ## Use pressable when there aren't existing components that work for your experience
19
+
20
+ 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
+
22
+ <DoDont
23
+ type="do"
24
+ image={{
25
+ url: pressablePrimaryDo,
26
+ alt: "A set of custom buttons built with pressable that aren't possible using existing design system components",
27
+ }}
28
+ >
29
+ Use pressable to create buttons when there isn't an existing design system
30
+ component to achieve your use case.
31
+ </DoDont>
32
+
33
+ <DoDont
34
+ type="dont"
35
+ image={{
36
+ url: pressablePrimaryDont,
37
+ alt: 'A custom button build with Pressable that looks similar to Button, an existing design system component',
38
+ }}
39
+ >
40
+ Don't use pressable in place of an element that already has a design system
41
+ representation, such as{' '}
42
+ <a href="/components/button/examples">the button component</a>. This can cause
43
+ visual and behavioral inconsistencies in Atlassian products.
44
+ </DoDont>
45
+
46
+ ## Accessibility
47
+
48
+ ### Use clear labels for assistive technology
49
+
50
+ Pressable should always announce what action will happen once pressed.
51
+
52
+ ![Pressable labels](./images/pressable-labels.png)
53
+
54
+ #### When no visible label is present
55
+
56
+ - Ensure an accessible label is still available by using [the visually hidden component](/components/visually-hidden/examples) which will render hidden text inside the button. This is preferable over the `aria-label` attribute because not all screen readers translate this between languages.
57
+ - Use [a tooltip](/components/tooltip/examples) to provide sighted users with the same information.
58
+
59
+ ### Focus ring behavior
60
+
61
+ Pressable creates buttons that are available in focus order, and provides a visual ring to clarify what is in focus. Adding additional focus styles is unnecessary.
62
+
63
+ ### Avoid disabling buttons
64
+
65
+ Disabled buttons can cause accessibility problems. Avoid disabling buttons and [follow our disabled and tooltip button guidance](/components/button/button-new/usage#avoid-disabling-buttons).
66
+
67
+ ## Best practices
68
+
69
+ ### Make it clear what can be pressed
70
+
71
+ Custom buttons should be obviously interactable. Make sure they are clearly identifiable through styles, surrounding context, labels, or other cues.
72
+
73
+ ### Don't use pressable for navigation
74
+
75
+ Pressable is meant for on-page actions such as opening modals, or submitting forms. If you're making something that navigates to a new page, use a component that renders a semantically correct HTML `<a>` element such as:
76
+
77
+ - The [link](/components/primitives/link/examples) component (coming soon) for standard text links.
78
+ - The [anchor](/components/primitives/anchor/examples) primitive (coming soon) to create custom links.
79
+
80
+ ## Content guidelines
81
+
82
+ ### Use sentence case capitalization
83
+
84
+ Use sentence case capitalization, only capitalizing the first letter of the label and any proper nouns. Other forms of capitalization should be only applied through styling with `text-transform`.
85
+
86
+ ### Make it clear what pressing the button does
87
+
88
+ Make sure labels are concise, active, and clear about what pressing the button does.
89
+
90
+ For example, _Change issue color to yellow_ instead of _yellow_.
91
+
92
+ ### Follow other label and UI content guidance
93
+
94
+ Follow label and content guidelines for [buttons](/components/button/button-new/usage#content-guidelines). Review our [general UI text guidance](/foundations/accessibility/#meaningful-text) for specific question.
16
95
 
17
96
  ## Related
18
97
 
19
- - [The underlying box component](/components/primitives/box/usage)
20
- - [Counterpart anchor primitive for anchor tags](/components/primitives/anchor/usage)
21
- - [Manage horizontal layout using an inline component](/components/primitives/inline/usage)
22
- - [Manage vertical layout using a stack component](/components/primitives/stack/usage)
23
- - [Use design tokens in code with XCSS](/components/primitives/XCSS/usage)
98
+ - Use [existing buttons](/components/button/examples) or [menus](/components/button/examples) for most actions in Atlassian products.
99
+ - If you must create a custom component, consider using an existing component with [XCSS](/components/primitives/xcss) (coming soon).
100
+ - Pressable is built on the same API as [box](/components/primitives/box/usage). Use available props or [XCSS](/components/primitives/xcss/usage) to customize padding options, background color, and other styles.
@@ -16,9 +16,10 @@ var _analyticsNext = require("@atlaskit/analytics-next");
16
16
  var _appProvider = require("@atlaskit/app-provider");
17
17
  var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
18
18
  var _interactionContext = _interopRequireDefault(require("@atlaskit/interaction-context"));
19
+ var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
19
20
  var _xcss = require("../xcss/xcss");
20
21
  var _box = _interopRequireDefault(require("./box"));
21
- var _excluded = ["href", "children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "testId", "xcss", "target", "rel", "onClick", "interactionName", "componentName", "analyticsContext"];
22
+ var _excluded = ["href", "children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "testId", "xcss", "target", "onClick", "interactionName", "componentName", "analyticsContext"];
22
23
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
23
24
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
24
25
  // TODO: Duplicated FocusRing styles due to lack of `xcss` support
@@ -59,7 +60,6 @@ var Anchor = function Anchor(_ref, ref) {
59
60
  testId = _ref.testId,
60
61
  xcssStyles = _ref.xcss,
61
62
  target = _ref.target,
62
- rel = _ref.rel,
63
63
  _ref$onClick = _ref.onClick,
64
64
  providedOnClick = _ref$onClick === void 0 ? _noop.default : _ref$onClick,
65
65
  interactionName = _ref.interactionName,
@@ -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: "5.2.0",
79
+ packageVersion: "5.4.0",
80
80
  analyticsData: analyticsContext,
81
81
  actionSubject: 'link'
82
82
  });
@@ -108,8 +108,7 @@ var Anchor = function Anchor(_ref, ref) {
108
108
  testId: testId,
109
109
  "data-is-router-link": testId ? isRouterLink ? 'true' : 'false' : undefined,
110
110
  href: !isRouterLink && typeof href !== 'string' ? undefined : href,
111
- target: isExternal && target === undefined ? '_blank' : target,
112
- rel: isExternal && rel === undefined ? 'noopener noreferrer' : rel,
111
+ target: target,
113
112
  backgroundColor: backgroundColor,
114
113
  padding: padding,
115
114
  paddingBlock: paddingBlock,
@@ -122,7 +121,7 @@ var Anchor = function Anchor(_ref, ref) {
122
121
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
123
122
  ,
124
123
  xcss: styles
125
- }), children);
124
+ }), children, target === '_blank' && /*#__PURE__*/_react.default.createElement(_visuallyHidden.default, null, "(opens new window)"));
126
125
  };
127
126
 
128
127
  // Workarounds to support generic types with forwardRef
@@ -80,7 +80,7 @@ var UNSAFE_PRESSABLE = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
80
80
  action: 'clicked',
81
81
  componentName: componentName || 'Pressable',
82
82
  packageName: "@atlaskit/primitives",
83
- packageVersion: "5.2.0",
83
+ packageVersion: "5.4.0",
84
84
  analyticsData: analyticsContext,
85
85
  actionSubject: 'button'
86
86
  });
@@ -73,10 +73,10 @@ var allSpaceMap = exports.allSpaceMap = _objectSpread(_objectSpread({}, positive
73
73
 
74
74
  /**
75
75
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
76
- * @codegen <<SignedSource::fcf1cfc01cda3c278e69b0b564c7746d>>
76
+ * @codegen <<SignedSource::7e2103695ffbc3573276b7ef3408c91b>>
77
77
  * @codegenId inverse-colors
78
78
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
79
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
79
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::eface03157c2df5c1b3b305911d3ed4d>>
80
80
  */
81
81
  var inverseColorMap = exports.inverseColorMap = {
82
82
  'color.background.neutral.bold': 'color.text.inverse',
@@ -114,11 +114,11 @@ var inverseColorMap = exports.inverseColorMap = {
114
114
 
115
115
  /**
116
116
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
117
- * @codegen <<SignedSource::8c10abde8168de6260b5aa120dd948bc>>
117
+ * @codegen <<SignedSource::b219b05d38339a7cd427cbf5de4ad327>>
118
118
  * @codegenId elevation
119
119
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
120
120
  * @codegenParams ["opacity", "shadow", "surface"]
121
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
121
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::eface03157c2df5c1b3b305911d3ed4d>>
122
122
  */
123
123
  var opacityMap = exports.opacityMap = {
124
124
  'opacity.disabled': "var(--ds-opacity-disabled, 0.4)",
@@ -149,11 +149,11 @@ var surfaceColorMap = exports.surfaceColorMap = {
149
149
 
150
150
  /**
151
151
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
152
- * @codegen <<SignedSource::0f7982208166d5dae0e25517d29aeaef>>
152
+ * @codegen <<SignedSource::75cecbb153ddd5bdd2cb0c5e9a07107d>>
153
153
  * @codegenId colors
154
154
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
155
155
  * @codegenParams ["border", "background", "text", "fill"]
156
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
156
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::eface03157c2df5c1b3b305911d3ed4d>>
157
157
  */
158
158
  var borderColorMap = exports.borderColorMap = {
159
159
  'color.border': "var(--ds-border, #091e4221)",
@@ -413,7 +413,8 @@ var textColorMap = exports.textColorMap = {
413
413
  'color.text.subtle': "var(--ds-text-subtle, #42526E)",
414
414
  'color.link': "var(--ds-link, #0052CC)",
415
415
  'color.link.pressed': "var(--ds-link-pressed, #0747A6)",
416
- 'color.link.visited': "var(--ds-link-visited, #403294)"
416
+ 'color.link.visited': "var(--ds-link-visited, #403294)",
417
+ 'color.link.visited.pressed': "var(--ds-link-visited-pressed, #403294)"
417
418
  };
418
419
  var fillMap = exports.fillMap = {
419
420
  'color.icon': "var(--ds-icon, #505F79)",
@@ -212,6 +212,8 @@ var parseXcss = exports.parseXcss = function parseXcss(args) {
212
212
 
213
213
  // Media queries should not contain nested media queries
214
214
 
215
+ // Allow chained pseudos, e.g. `:visited:hover`
216
+
215
217
  // Pseudos should not contain nested pseudos, or media queries
216
218
 
217
219
  /**
@@ -5,6 +5,7 @@ import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
5
5
  import { useRouterLink } from '@atlaskit/app-provider';
6
6
  import noop from '@atlaskit/ds-lib/noop';
7
7
  import InteractionContext from '@atlaskit/interaction-context';
8
+ import VisuallyHidden from '@atlaskit/visually-hidden';
8
9
  import { xcss } from '../xcss/xcss';
9
10
  import Box from './box';
10
11
  // TODO: Duplicated FocusRing styles due to lack of `xcss` support
@@ -45,7 +46,6 @@ const Anchor = ({
45
46
  testId,
46
47
  xcss: xcssStyles,
47
48
  target,
48
- rel,
49
49
  onClick: providedOnClick = noop,
50
50
  interactionName,
51
51
  componentName,
@@ -62,7 +62,7 @@ const Anchor = ({
62
62
  action: 'clicked',
63
63
  componentName: componentName || 'Anchor',
64
64
  packageName: "@atlaskit/primitives",
65
- packageVersion: "5.2.0",
65
+ packageVersion: "5.4.0",
66
66
  analyticsData: analyticsContext,
67
67
  actionSubject: 'link'
68
68
  });
@@ -94,8 +94,7 @@ const Anchor = ({
94
94
  testId: testId,
95
95
  "data-is-router-link": testId ? isRouterLink ? 'true' : 'false' : undefined,
96
96
  href: !isRouterLink && typeof href !== 'string' ? undefined : href,
97
- target: isExternal && target === undefined ? '_blank' : target,
98
- rel: isExternal && rel === undefined ? 'noopener noreferrer' : rel,
97
+ target: target,
99
98
  backgroundColor: backgroundColor,
100
99
  padding: padding,
101
100
  paddingBlock: paddingBlock,
@@ -108,7 +107,7 @@ const Anchor = ({
108
107
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
109
108
  ,
110
109
  xcss: styles
111
- }), children);
110
+ }), children, target === '_blank' && /*#__PURE__*/React.createElement(VisuallyHidden, null, "(opens new window)"));
112
111
  };
113
112
 
114
113
  // Workarounds to support generic types with forwardRef
@@ -66,7 +66,7 @@ const UNSAFE_PRESSABLE = /*#__PURE__*/forwardRef(({
66
66
  action: 'clicked',
67
67
  componentName: componentName || 'Pressable',
68
68
  packageName: "@atlaskit/primitives",
69
- packageVersion: "5.2.0",
69
+ packageVersion: "5.4.0",
70
70
  analyticsData: analyticsContext,
71
71
  actionSubject: 'button'
72
72
  });
@@ -67,10 +67,10 @@ export const allSpaceMap = {
67
67
 
68
68
  /**
69
69
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
70
- * @codegen <<SignedSource::fcf1cfc01cda3c278e69b0b564c7746d>>
70
+ * @codegen <<SignedSource::7e2103695ffbc3573276b7ef3408c91b>>
71
71
  * @codegenId inverse-colors
72
72
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
73
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
73
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::eface03157c2df5c1b3b305911d3ed4d>>
74
74
  */
75
75
  export const inverseColorMap = {
76
76
  'color.background.neutral.bold': 'color.text.inverse',
@@ -108,11 +108,11 @@ export const inverseColorMap = {
108
108
 
109
109
  /**
110
110
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
111
- * @codegen <<SignedSource::8c10abde8168de6260b5aa120dd948bc>>
111
+ * @codegen <<SignedSource::b219b05d38339a7cd427cbf5de4ad327>>
112
112
  * @codegenId elevation
113
113
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
114
114
  * @codegenParams ["opacity", "shadow", "surface"]
115
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
115
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::eface03157c2df5c1b3b305911d3ed4d>>
116
116
  */
117
117
  export const opacityMap = {
118
118
  'opacity.disabled': "var(--ds-opacity-disabled, 0.4)",
@@ -143,11 +143,11 @@ export const surfaceColorMap = {
143
143
 
144
144
  /**
145
145
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
146
- * @codegen <<SignedSource::0f7982208166d5dae0e25517d29aeaef>>
146
+ * @codegen <<SignedSource::75cecbb153ddd5bdd2cb0c5e9a07107d>>
147
147
  * @codegenId colors
148
148
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
149
149
  * @codegenParams ["border", "background", "text", "fill"]
150
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
150
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::eface03157c2df5c1b3b305911d3ed4d>>
151
151
  */
152
152
  export const borderColorMap = {
153
153
  'color.border': "var(--ds-border, #091e4221)",
@@ -407,7 +407,8 @@ export const textColorMap = {
407
407
  'color.text.subtle': "var(--ds-text-subtle, #42526E)",
408
408
  'color.link': "var(--ds-link, #0052CC)",
409
409
  'color.link.pressed': "var(--ds-link-pressed, #0747A6)",
410
- 'color.link.visited': "var(--ds-link-visited, #403294)"
410
+ 'color.link.visited': "var(--ds-link-visited, #403294)",
411
+ 'color.link.visited.pressed': "var(--ds-link-visited-pressed, #403294)"
411
412
  };
412
413
  export const fillMap = {
413
414
  'color.icon': "var(--ds-icon, #505F79)",
@@ -190,6 +190,8 @@ export const parseXcss = args => {
190
190
 
191
191
  // Media queries should not contain nested media queries
192
192
 
193
+ // Allow chained pseudos, e.g. `:visited:hover`
194
+
193
195
  // Pseudos should not contain nested pseudos, or media queries
194
196
 
195
197
  /**
@@ -2,13 +2,14 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _typeof from "@babel/runtime/helpers/typeof";
3
3
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
- var _excluded = ["href", "children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "testId", "xcss", "target", "rel", "onClick", "interactionName", "componentName", "analyticsContext"];
5
+ var _excluded = ["href", "children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "testId", "xcss", "target", "onClick", "interactionName", "componentName", "analyticsContext"];
6
6
  import React, { forwardRef, useCallback, useContext } from 'react';
7
7
  import invariant from 'tiny-invariant';
8
8
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
9
9
  import { useRouterLink } from '@atlaskit/app-provider';
10
10
  import noop from '@atlaskit/ds-lib/noop';
11
11
  import InteractionContext from '@atlaskit/interaction-context';
12
+ import VisuallyHidden from '@atlaskit/visually-hidden';
12
13
  import { xcss } from '../xcss/xcss';
13
14
  import Box from './box';
14
15
  // TODO: Duplicated FocusRing styles due to lack of `xcss` support
@@ -49,7 +50,6 @@ var Anchor = function Anchor(_ref, ref) {
49
50
  testId = _ref.testId,
50
51
  xcssStyles = _ref.xcss,
51
52
  target = _ref.target,
52
- rel = _ref.rel,
53
53
  _ref$onClick = _ref.onClick,
54
54
  providedOnClick = _ref$onClick === void 0 ? noop : _ref$onClick,
55
55
  interactionName = _ref.interactionName,
@@ -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: "5.2.0",
69
+ packageVersion: "5.4.0",
70
70
  analyticsData: analyticsContext,
71
71
  actionSubject: 'link'
72
72
  });
@@ -98,8 +98,7 @@ var Anchor = function Anchor(_ref, ref) {
98
98
  testId: testId,
99
99
  "data-is-router-link": testId ? isRouterLink ? 'true' : 'false' : undefined,
100
100
  href: !isRouterLink && typeof href !== 'string' ? undefined : href,
101
- target: isExternal && target === undefined ? '_blank' : target,
102
- rel: isExternal && rel === undefined ? 'noopener noreferrer' : rel,
101
+ target: target,
103
102
  backgroundColor: backgroundColor,
104
103
  padding: padding,
105
104
  paddingBlock: paddingBlock,
@@ -112,7 +111,7 @@ var Anchor = function Anchor(_ref, ref) {
112
111
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
113
112
  ,
114
113
  xcss: styles
115
- }), children);
114
+ }), children, target === '_blank' && /*#__PURE__*/React.createElement(VisuallyHidden, null, "(opens new window)"));
116
115
  };
117
116
 
118
117
  // Workarounds to support generic types with forwardRef
@@ -70,7 +70,7 @@ var UNSAFE_PRESSABLE = /*#__PURE__*/forwardRef(function (_ref, ref) {
70
70
  action: 'clicked',
71
71
  componentName: componentName || 'Pressable',
72
72
  packageName: "@atlaskit/primitives",
73
- packageVersion: "5.2.0",
73
+ packageVersion: "5.4.0",
74
74
  analyticsData: analyticsContext,
75
75
  actionSubject: 'button'
76
76
  });
@@ -67,10 +67,10 @@ export var allSpaceMap = _objectSpread(_objectSpread({}, positiveSpaceMap), nega
67
67
 
68
68
  /**
69
69
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
70
- * @codegen <<SignedSource::fcf1cfc01cda3c278e69b0b564c7746d>>
70
+ * @codegen <<SignedSource::7e2103695ffbc3573276b7ef3408c91b>>
71
71
  * @codegenId inverse-colors
72
72
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
73
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
73
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::eface03157c2df5c1b3b305911d3ed4d>>
74
74
  */
75
75
  export var inverseColorMap = {
76
76
  'color.background.neutral.bold': 'color.text.inverse',
@@ -108,11 +108,11 @@ export var inverseColorMap = {
108
108
 
109
109
  /**
110
110
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
111
- * @codegen <<SignedSource::8c10abde8168de6260b5aa120dd948bc>>
111
+ * @codegen <<SignedSource::b219b05d38339a7cd427cbf5de4ad327>>
112
112
  * @codegenId elevation
113
113
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
114
114
  * @codegenParams ["opacity", "shadow", "surface"]
115
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
115
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::eface03157c2df5c1b3b305911d3ed4d>>
116
116
  */
117
117
  export var opacityMap = {
118
118
  'opacity.disabled': "var(--ds-opacity-disabled, 0.4)",
@@ -143,11 +143,11 @@ export var surfaceColorMap = {
143
143
 
144
144
  /**
145
145
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
146
- * @codegen <<SignedSource::0f7982208166d5dae0e25517d29aeaef>>
146
+ * @codegen <<SignedSource::75cecbb153ddd5bdd2cb0c5e9a07107d>>
147
147
  * @codegenId colors
148
148
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
149
149
  * @codegenParams ["border", "background", "text", "fill"]
150
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
150
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::eface03157c2df5c1b3b305911d3ed4d>>
151
151
  */
152
152
  export var borderColorMap = {
153
153
  'color.border': "var(--ds-border, #091e4221)",
@@ -407,7 +407,8 @@ export var textColorMap = {
407
407
  'color.text.subtle': "var(--ds-text-subtle, #42526E)",
408
408
  'color.link': "var(--ds-link, #0052CC)",
409
409
  'color.link.pressed': "var(--ds-link-pressed, #0747A6)",
410
- 'color.link.visited': "var(--ds-link-visited, #403294)"
410
+ 'color.link.visited': "var(--ds-link-visited, #403294)",
411
+ 'color.link.visited.pressed': "var(--ds-link-visited-pressed, #403294)"
411
412
  };
412
413
  export var fillMap = {
413
414
  'color.icon': "var(--ds-icon, #505F79)",
@@ -208,6 +208,8 @@ export var parseXcss = function parseXcss(args) {
208
208
 
209
209
  // Media queries should not contain nested media queries
210
210
 
211
+ // Allow chained pseudos, e.g. `:visited:hover`
212
+
211
213
  // Pseudos should not contain nested pseudos, or media queries
212
214
 
213
215
  /**
@@ -26,7 +26,7 @@ export type AnchorProps<RouterLinkConfig extends Record<string, any> = never> =
26
26
  */
27
27
  analyticsContext?: Record<string, any>;
28
28
  };
29
- declare const Anchor: <RouterLinkConfig extends Record<string, any> = never>({ href, children, backgroundColor, padding, paddingBlock, paddingBlockStart, paddingBlockEnd, paddingInline, paddingInlineStart, paddingInlineEnd, testId, xcss: xcssStyles, target, rel, onClick: providedOnClick, interactionName, componentName, analyticsContext, ...htmlAttributes }: AnchorProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
29
+ declare const Anchor: <RouterLinkConfig extends Record<string, any> = never>({ href, children, backgroundColor, padding, paddingBlock, paddingBlockStart, paddingBlockEnd, paddingInline, paddingInlineStart, paddingInlineEnd, testId, xcss: xcssStyles, target, onClick: providedOnClick, interactionName, componentName, analyticsContext, ...htmlAttributes }: AnchorProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
30
30
  /**
31
31
  * __UNSAFE_ANCHOR__
32
32
  *
@@ -88,10 +88,10 @@ export type AllSpace = keyof typeof allSpaceMap;
88
88
  */
89
89
  /**
90
90
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
91
- * @codegen <<SignedSource::fcf1cfc01cda3c278e69b0b564c7746d>>
91
+ * @codegen <<SignedSource::7e2103695ffbc3573276b7ef3408c91b>>
92
92
  * @codegenId inverse-colors
93
93
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
94
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
94
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::eface03157c2df5c1b3b305911d3ed4d>>
95
95
  */
96
96
  export declare const inverseColorMap: {
97
97
  readonly 'color.background.neutral.bold': "color.text.inverse";
@@ -127,11 +127,11 @@ export declare const inverseColorMap: {
127
127
  */
128
128
  /**
129
129
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
130
- * @codegen <<SignedSource::8c10abde8168de6260b5aa120dd948bc>>
130
+ * @codegen <<SignedSource::b219b05d38339a7cd427cbf5de4ad327>>
131
131
  * @codegenId elevation
132
132
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
133
133
  * @codegenParams ["opacity", "shadow", "surface"]
134
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
134
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::eface03157c2df5c1b3b305911d3ed4d>>
135
135
  */
136
136
  export declare const opacityMap: {
137
137
  readonly 'opacity.disabled': "var(--ds-opacity-disabled)";
@@ -164,11 +164,11 @@ export type SurfaceColor = keyof typeof surfaceColorMap;
164
164
  */
165
165
  /**
166
166
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
167
- * @codegen <<SignedSource::0f7982208166d5dae0e25517d29aeaef>>
167
+ * @codegen <<SignedSource::75cecbb153ddd5bdd2cb0c5e9a07107d>>
168
168
  * @codegenId colors
169
169
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
170
170
  * @codegenParams ["border", "background", "text", "fill"]
171
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
171
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::eface03157c2df5c1b3b305911d3ed4d>>
172
172
  */
173
173
  export declare const borderColorMap: {
174
174
  readonly 'color.border': "var(--ds-border)";
@@ -431,6 +431,7 @@ export declare const textColorMap: {
431
431
  readonly 'color.link': "var(--ds-link)";
432
432
  readonly 'color.link.pressed': "var(--ds-link-pressed)";
433
433
  readonly 'color.link.visited': "var(--ds-link-visited)";
434
+ readonly 'color.link.visited.pressed': "var(--ds-link-visited-pressed)";
434
435
  };
435
436
  export type TextColor = keyof typeof textColorMap;
436
437
  export declare const fillMap: {
@@ -702,6 +702,7 @@ export declare const tokensMap: {
702
702
  readonly 'color.link': "var(--ds-link)";
703
703
  readonly 'color.link.pressed': "var(--ds-link-pressed)";
704
704
  readonly 'color.link.visited': "var(--ds-link-visited)";
705
+ readonly 'color.link.visited.pressed': "var(--ds-link-visited-pressed)";
705
706
  };
706
707
  readonly columnGap: {
707
708
  'space.0': "var(--ds-space-0)";
@@ -1642,8 +1643,9 @@ type AllMedia = MediaQuery | '@media screen and (forced-colors: active), screen
1642
1643
  type CSSMediaQueries = {
1643
1644
  [MQ in AllMedia]?: Omit<SafeCSSObject, AllMedia>;
1644
1645
  };
1646
+ type ChainedCSSPseudos = `${CSS.Pseudos}${CSS.Pseudos}`;
1645
1647
  type CSSPseudos = {
1646
- [Pseudo in CSS.Pseudos]?: Omit<SafeCSSObject, CSS.Pseudos | AllMedia>;
1648
+ [Pseudo in CSS.Pseudos | ChainedCSSPseudos]?: Omit<SafeCSSObject, CSS.Pseudos | AllMedia>;
1647
1649
  };
1648
1650
  type AtRulesWithoutMedia = Exclude<CSS.AtRules, '@media'>;
1649
1651
  type CSSAtRules = {
@@ -26,7 +26,7 @@ export type AnchorProps<RouterLinkConfig extends Record<string, any> = never> =
26
26
  */
27
27
  analyticsContext?: Record<string, any>;
28
28
  };
29
- declare const Anchor: <RouterLinkConfig extends Record<string, any> = never>({ href, children, backgroundColor, padding, paddingBlock, paddingBlockStart, paddingBlockEnd, paddingInline, paddingInlineStart, paddingInlineEnd, testId, xcss: xcssStyles, target, rel, onClick: providedOnClick, interactionName, componentName, analyticsContext, ...htmlAttributes }: AnchorProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
29
+ declare const Anchor: <RouterLinkConfig extends Record<string, any> = never>({ href, children, backgroundColor, padding, paddingBlock, paddingBlockStart, paddingBlockEnd, paddingInline, paddingInlineStart, paddingInlineEnd, testId, xcss: xcssStyles, target, onClick: providedOnClick, interactionName, componentName, analyticsContext, ...htmlAttributes }: AnchorProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
30
30
  /**
31
31
  * __UNSAFE_ANCHOR__
32
32
  *
@@ -88,10 +88,10 @@ export type AllSpace = keyof typeof allSpaceMap;
88
88
  */
89
89
  /**
90
90
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
91
- * @codegen <<SignedSource::fcf1cfc01cda3c278e69b0b564c7746d>>
91
+ * @codegen <<SignedSource::7e2103695ffbc3573276b7ef3408c91b>>
92
92
  * @codegenId inverse-colors
93
93
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
94
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
94
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::eface03157c2df5c1b3b305911d3ed4d>>
95
95
  */
96
96
  export declare const inverseColorMap: {
97
97
  readonly 'color.background.neutral.bold': "color.text.inverse";
@@ -127,11 +127,11 @@ export declare const inverseColorMap: {
127
127
  */
128
128
  /**
129
129
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
130
- * @codegen <<SignedSource::8c10abde8168de6260b5aa120dd948bc>>
130
+ * @codegen <<SignedSource::b219b05d38339a7cd427cbf5de4ad327>>
131
131
  * @codegenId elevation
132
132
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
133
133
  * @codegenParams ["opacity", "shadow", "surface"]
134
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
134
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::eface03157c2df5c1b3b305911d3ed4d>>
135
135
  */
136
136
  export declare const opacityMap: {
137
137
  readonly 'opacity.disabled': "var(--ds-opacity-disabled)";
@@ -164,11 +164,11 @@ export type SurfaceColor = keyof typeof surfaceColorMap;
164
164
  */
165
165
  /**
166
166
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
167
- * @codegen <<SignedSource::0f7982208166d5dae0e25517d29aeaef>>
167
+ * @codegen <<SignedSource::75cecbb153ddd5bdd2cb0c5e9a07107d>>
168
168
  * @codegenId colors
169
169
  * @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
170
170
  * @codegenParams ["border", "background", "text", "fill"]
171
- * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::f1021f8d47ab63374e371ce18db72a1c>>
171
+ * @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::eface03157c2df5c1b3b305911d3ed4d>>
172
172
  */
173
173
  export declare const borderColorMap: {
174
174
  readonly 'color.border': "var(--ds-border)";
@@ -431,6 +431,7 @@ export declare const textColorMap: {
431
431
  readonly 'color.link': "var(--ds-link)";
432
432
  readonly 'color.link.pressed': "var(--ds-link-pressed)";
433
433
  readonly 'color.link.visited': "var(--ds-link-visited)";
434
+ readonly 'color.link.visited.pressed': "var(--ds-link-visited-pressed)";
434
435
  };
435
436
  export type TextColor = keyof typeof textColorMap;
436
437
  export declare const fillMap: {
@@ -702,6 +702,7 @@ export declare const tokensMap: {
702
702
  readonly 'color.link': "var(--ds-link)";
703
703
  readonly 'color.link.pressed': "var(--ds-link-pressed)";
704
704
  readonly 'color.link.visited': "var(--ds-link-visited)";
705
+ readonly 'color.link.visited.pressed': "var(--ds-link-visited-pressed)";
705
706
  };
706
707
  readonly columnGap: {
707
708
  'space.0': "var(--ds-space-0)";
@@ -1642,8 +1643,9 @@ type AllMedia = MediaQuery | '@media screen and (forced-colors: active), screen
1642
1643
  type CSSMediaQueries = {
1643
1644
  [MQ in AllMedia]?: Omit<SafeCSSObject, AllMedia>;
1644
1645
  };
1646
+ type ChainedCSSPseudos = `${CSS.Pseudos}${CSS.Pseudos}`;
1645
1647
  type CSSPseudos = {
1646
- [Pseudo in CSS.Pseudos]?: Omit<SafeCSSObject, CSS.Pseudos | AllMedia>;
1648
+ [Pseudo in CSS.Pseudos | ChainedCSSPseudos]?: Omit<SafeCSSObject, CSS.Pseudos | AllMedia>;
1647
1649
  };
1648
1650
  type AtRulesWithoutMedia = Exclude<CSS.AtRules, '@media'>;
1649
1651
  type CSSAtRules = {
@@ -1,6 +1,8 @@
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
2
  import React, { ReactNode } from 'react';
3
3
 
4
+ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
5
+
4
6
  import { BasePrimitiveProps, StyleProp } from '../src/components/types';
5
7
 
6
8
  // eslint-disable-next-line @typescript-eslint/no-namespace
@@ -73,13 +75,35 @@ export default function Pressable(
73
75
  paddingInlineEnd?: Space;
74
76
 
75
77
  /**
76
- * A token alias for background color. See:<br>
77
- * [https://atlassian.design/components/tokens/all-tokens#color-background](https://atlassian.design/components/tokens/all-tokens#color-background)<br>
78
+ * A token alias for background color. See [https://atlassian.design/components/tokens/all-tokens#color-background](background tokens) for a list of options.
78
79
  * When the background color is set to a [surface token](/components/tokens/all-tokens#elevation-surface),
79
- * the [current surface](/components/tokens/code#current-surface-color) CSS variable will also be set to this value in the Box styles.
80
+ * the [current surface](/components/tokens/code#current-surface-color) CSS variable will also be set to this value in the Pressable styles.
80
81
  */
81
82
  backgroundColor?: Token.BackgroundColor;
82
83
 
84
+ /**
85
+ * Handler to be called on click. The second argument can be used to track analytics data. See the tutorial in the analytics-next package for details.
86
+ */
87
+ onClick?: (
88
+ e: React.MouseEvent<HTMLButtonElement>,
89
+ analyticsEvent: UIAnalyticsEvent,
90
+ ) => void;
91
+
92
+ /**
93
+ * An optional name used to identify the interaction type to analytics press listeners.
94
+ */
95
+ interactionName?: string;
96
+
97
+ /**
98
+ * An optional component name used to identify this component to analytics press listeners. This can be altered if a parent component's name is preferred rather than the default 'Pressable'.
99
+ */
100
+ componentName?: string;
101
+
102
+ /**
103
+ * Additional information to be included in the `context` of analytics events that come from Pressable.
104
+ */
105
+ analyticsContext?: Record<string, any>;
106
+
83
107
  /**
84
108
  * Elements to be rendered inside the primitive.
85
109
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "5.2.0",
3
+ "version": "5.4.0",
4
4
  "description": "Primitives are token-backed low-level building blocks.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -103,7 +103,7 @@
103
103
  "slug": "primitives/pressable",
104
104
  "id": "@atlaskit/primitives/pressable",
105
105
  "status": {
106
- "type": "alpha"
106
+ "type": "closed-beta"
107
107
  }
108
108
  },
109
109
  {
@@ -123,11 +123,12 @@
123
123
  },
124
124
  "dependencies": {
125
125
  "@atlaskit/analytics-next": "^9.2.0",
126
- "@atlaskit/app-provider": "^1.0.0",
126
+ "@atlaskit/app-provider": "^1.1.0",
127
127
  "@atlaskit/css": "^0.0.5",
128
128
  "@atlaskit/ds-lib": "^2.2.0",
129
129
  "@atlaskit/interaction-context": "^2.1.0",
130
- "@atlaskit/tokens": "^1.42.0",
130
+ "@atlaskit/tokens": "^1.43.0",
131
+ "@atlaskit/visually-hidden": "^1.2.4",
131
132
  "@babel/runtime": "^7.0.0",
132
133
  "@emotion/react": "^11.7.1",
133
134
  "@emotion/serialize": "^1.1.0",
@@ -945,6 +945,7 @@ exports[`@atlaskit/primitives text styles are generated correctly 1`] = `
945
945
  'color.link': token('color.link', '#0052CC'),
946
946
  'color.link.pressed': token('color.link.pressed', '#0747A6'),
947
947
  'color.link.visited': token('color.link.visited', '#403294'),
948
+ 'color.link.visited.pressed': token('color.link.visited.pressed', '#403294'),
948
949
  } as const;
949
950
 
950
951
  export type TextColor = keyof typeof textColorMap;