@atlaskit/primitives 7.0.3 → 7.1.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 +16 -0
- package/dist/cjs/components/anchor.js +17 -4
- package/dist/cjs/components/pressable.js +1 -1
- package/dist/es2019/components/anchor.js +16 -3
- package/dist/es2019/components/pressable.js +1 -1
- package/dist/esm/components/anchor.js +17 -4
- package/dist/esm/components/pressable.js +1 -1
- package/dist/types/components/anchor.d.ts +3 -7
- package/dist/types/components/pressable.d.ts +3 -13
- package/dist/types-ts4.5/components/anchor.d.ts +3 -7
- package/dist/types-ts4.5/components/pressable.d.ts +3 -13
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/primitives
|
|
2
2
|
|
|
3
|
+
## 7.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#110702](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/110702)
|
|
8
|
+
[`b8c2eefeb195b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b8c2eefeb195b) - -
|
|
9
|
+
Anchor and Pressable primitives no longer require `children`, so labels can be supplied through
|
|
10
|
+
aria attributes if required
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#110702](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/110702)
|
|
15
|
+
[`b8c2eefeb195b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b8c2eefeb195b) - -
|
|
16
|
+
Fixed a bug with Anchor, where the "(opens new window)" label was not being automatically appended
|
|
17
|
+
to `aria-label` or `aria-labelledby`.
|
|
18
|
+
|
|
3
19
|
## 7.0.3
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -11,6 +11,7 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
|
11
11
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
12
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
+
var _reactUid = require("react-uid");
|
|
14
15
|
var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
|
|
15
16
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
16
17
|
var _appProvider = require("@atlaskit/app-provider");
|
|
@@ -19,7 +20,7 @@ var _interactionContext = _interopRequireDefault(require("@atlaskit/interaction-
|
|
|
19
20
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
20
21
|
var _xcss = require("../xcss/xcss");
|
|
21
22
|
var _box = _interopRequireDefault(require("./box"));
|
|
22
|
-
var _excluded = ["href", "children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "testId", "xcss", "target", "onClick", "interactionName", "componentName", "analyticsContext"];
|
|
23
|
+
var _excluded = ["href", "children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "testId", "xcss", "target", "onClick", "interactionName", "componentName", "analyticsContext", "aria-label", "aria-labelledby"];
|
|
23
24
|
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); }
|
|
24
25
|
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; }
|
|
25
26
|
// TODO: Duplicated FocusRing styles due to lack of `xcss` support
|
|
@@ -46,6 +47,7 @@ var focusRingStyles = (0, _xcss.xcss)({
|
|
|
46
47
|
});
|
|
47
48
|
var IS_EXTERNAL_LINK_REGEX = /^(?:(http|https):\/\/)/;
|
|
48
49
|
var IS_NON_HTTP_BASED = /^(((mailto|tel|sms):)|(#))/;
|
|
50
|
+
var OPENS_NEW_WINDOW_LABEL = '(opens new window)';
|
|
49
51
|
var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
50
52
|
var href = _ref.href,
|
|
51
53
|
children = _ref.children,
|
|
@@ -65,18 +67,25 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
65
67
|
interactionName = _ref.interactionName,
|
|
66
68
|
componentName = _ref.componentName,
|
|
67
69
|
analyticsContext = _ref.analyticsContext,
|
|
70
|
+
ariaLabel = _ref['aria-label'],
|
|
71
|
+
ariaLabelledBy = _ref['aria-labelledby'],
|
|
68
72
|
htmlAttributes = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
69
73
|
var interactionContext = (0, _react.useContext)(_interactionContext.default);
|
|
70
74
|
var handleClick = (0, _react.useCallback)(function (e, analyticsEvent) {
|
|
71
75
|
interactionContext && interactionContext.tracePress(interactionName, e.timeStamp);
|
|
72
76
|
providedOnClick(e, analyticsEvent);
|
|
73
77
|
}, [providedOnClick, interactionContext, interactionName]);
|
|
78
|
+
// TODO: Use React 18's useId() hook when we update.
|
|
79
|
+
// eslint-disable-next-line @repo/internal/react/disallow-unstable-values
|
|
80
|
+
var opensNewWindowLabelId = (0, _reactUid.uid)({
|
|
81
|
+
ariaLabelledBy: ariaLabelledBy
|
|
82
|
+
});
|
|
74
83
|
var onClick = (0, _analyticsNext.usePlatformLeafEventHandler)({
|
|
75
84
|
fn: handleClick,
|
|
76
85
|
action: 'clicked',
|
|
77
86
|
componentName: componentName || 'Anchor',
|
|
78
87
|
packageName: "@atlaskit/primitives",
|
|
79
|
-
packageVersion: "7.0
|
|
88
|
+
packageVersion: "7.1.0",
|
|
80
89
|
analyticsData: analyticsContext,
|
|
81
90
|
actionSubject: 'link'
|
|
82
91
|
});
|
|
@@ -117,11 +126,15 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
117
126
|
paddingInline: paddingInline,
|
|
118
127
|
paddingInlineStart: paddingInlineStart,
|
|
119
128
|
paddingInlineEnd: paddingInlineEnd,
|
|
120
|
-
onClick: onClick
|
|
129
|
+
onClick: onClick,
|
|
130
|
+
"aria-label": ariaLabel && target === '_blank' && !ariaLabelledBy ? "".concat(ariaLabel, " ").concat(OPENS_NEW_WINDOW_LABEL) : ariaLabel,
|
|
131
|
+
"aria-labelledby": ariaLabelledBy && target === '_blank' ? "".concat(ariaLabelledBy, " ").concat(opensNewWindowLabelId) : ariaLabelledBy
|
|
121
132
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
122
133
|
,
|
|
123
134
|
xcss: styles
|
|
124
|
-
}), children, target === '_blank' && /*#__PURE__*/_react.default.createElement(_visuallyHidden.default,
|
|
135
|
+
}), children, target === '_blank' && (children && !ariaLabel && !ariaLabelledBy || ariaLabelledBy) && /*#__PURE__*/_react.default.createElement(_visuallyHidden.default, {
|
|
136
|
+
id: opensNewWindowLabelId
|
|
137
|
+
}, OPENS_NEW_WINDOW_LABEL));
|
|
125
138
|
};
|
|
126
139
|
|
|
127
140
|
// Workarounds to support generic types with forwardRef
|
|
@@ -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: "7.0
|
|
81
|
+
packageVersion: "7.1.0",
|
|
82
82
|
analyticsData: analyticsContext,
|
|
83
83
|
actionSubject: 'button'
|
|
84
84
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { forwardRef, useCallback, useContext } from 'react';
|
|
3
|
+
import { uid } from 'react-uid';
|
|
3
4
|
import invariant from 'tiny-invariant';
|
|
4
5
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
5
6
|
import { useRouterLink } from '@atlaskit/app-provider';
|
|
@@ -32,6 +33,7 @@ const focusRingStyles = xcss({
|
|
|
32
33
|
});
|
|
33
34
|
const IS_EXTERNAL_LINK_REGEX = /^(?:(http|https):\/\/)/;
|
|
34
35
|
const IS_NON_HTTP_BASED = /^(((mailto|tel|sms):)|(#))/;
|
|
36
|
+
const OPENS_NEW_WINDOW_LABEL = '(opens new window)';
|
|
35
37
|
const AnchorNoRef = ({
|
|
36
38
|
href,
|
|
37
39
|
children,
|
|
@@ -50,6 +52,8 @@ const AnchorNoRef = ({
|
|
|
50
52
|
interactionName,
|
|
51
53
|
componentName,
|
|
52
54
|
analyticsContext,
|
|
55
|
+
'aria-label': ariaLabel,
|
|
56
|
+
'aria-labelledby': ariaLabelledBy,
|
|
53
57
|
...htmlAttributes
|
|
54
58
|
}, ref) => {
|
|
55
59
|
const interactionContext = useContext(InteractionContext);
|
|
@@ -57,12 +61,17 @@ const AnchorNoRef = ({
|
|
|
57
61
|
interactionContext && interactionContext.tracePress(interactionName, e.timeStamp);
|
|
58
62
|
providedOnClick(e, analyticsEvent);
|
|
59
63
|
}, [providedOnClick, interactionContext, interactionName]);
|
|
64
|
+
// TODO: Use React 18's useId() hook when we update.
|
|
65
|
+
// eslint-disable-next-line @repo/internal/react/disallow-unstable-values
|
|
66
|
+
const opensNewWindowLabelId = uid({
|
|
67
|
+
ariaLabelledBy
|
|
68
|
+
});
|
|
60
69
|
const onClick = usePlatformLeafEventHandler({
|
|
61
70
|
fn: handleClick,
|
|
62
71
|
action: 'clicked',
|
|
63
72
|
componentName: componentName || 'Anchor',
|
|
64
73
|
packageName: "@atlaskit/primitives",
|
|
65
|
-
packageVersion: "7.0
|
|
74
|
+
packageVersion: "7.1.0",
|
|
66
75
|
analyticsData: analyticsContext,
|
|
67
76
|
actionSubject: 'link'
|
|
68
77
|
});
|
|
@@ -103,11 +112,15 @@ const AnchorNoRef = ({
|
|
|
103
112
|
paddingInline: paddingInline,
|
|
104
113
|
paddingInlineStart: paddingInlineStart,
|
|
105
114
|
paddingInlineEnd: paddingInlineEnd,
|
|
106
|
-
onClick: onClick
|
|
115
|
+
onClick: onClick,
|
|
116
|
+
"aria-label": ariaLabel && target === '_blank' && !ariaLabelledBy ? `${ariaLabel} ${OPENS_NEW_WINDOW_LABEL}` : ariaLabel,
|
|
117
|
+
"aria-labelledby": ariaLabelledBy && target === '_blank' ? `${ariaLabelledBy} ${opensNewWindowLabelId}` : ariaLabelledBy
|
|
107
118
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
108
119
|
,
|
|
109
120
|
xcss: styles
|
|
110
|
-
}), children, target === '_blank' && /*#__PURE__*/React.createElement(VisuallyHidden,
|
|
121
|
+
}), children, target === '_blank' && (children && !ariaLabel && !ariaLabelledBy || ariaLabelledBy) && /*#__PURE__*/React.createElement(VisuallyHidden, {
|
|
122
|
+
id: opensNewWindowLabelId
|
|
123
|
+
}, OPENS_NEW_WINDOW_LABEL));
|
|
111
124
|
};
|
|
112
125
|
|
|
113
126
|
// Workarounds to support generic types with forwardRef
|
|
@@ -64,7 +64,7 @@ const Pressable = /*#__PURE__*/forwardRef(({
|
|
|
64
64
|
action: 'clicked',
|
|
65
65
|
componentName: componentName || 'Pressable',
|
|
66
66
|
packageName: "@atlaskit/primitives",
|
|
67
|
-
packageVersion: "7.0
|
|
67
|
+
packageVersion: "7.1.0",
|
|
68
68
|
analyticsData: analyticsContext,
|
|
69
69
|
actionSubject: 'button'
|
|
70
70
|
});
|
|
@@ -2,8 +2,9 @@ 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", "onClick", "interactionName", "componentName", "analyticsContext"];
|
|
5
|
+
var _excluded = ["href", "children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "testId", "xcss", "target", "onClick", "interactionName", "componentName", "analyticsContext", "aria-label", "aria-labelledby"];
|
|
6
6
|
import React, { forwardRef, useCallback, useContext } from 'react';
|
|
7
|
+
import { uid } from 'react-uid';
|
|
7
8
|
import invariant from 'tiny-invariant';
|
|
8
9
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
9
10
|
import { useRouterLink } from '@atlaskit/app-provider';
|
|
@@ -36,6 +37,7 @@ var focusRingStyles = xcss({
|
|
|
36
37
|
});
|
|
37
38
|
var IS_EXTERNAL_LINK_REGEX = /^(?:(http|https):\/\/)/;
|
|
38
39
|
var IS_NON_HTTP_BASED = /^(((mailto|tel|sms):)|(#))/;
|
|
40
|
+
var OPENS_NEW_WINDOW_LABEL = '(opens new window)';
|
|
39
41
|
var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
40
42
|
var href = _ref.href,
|
|
41
43
|
children = _ref.children,
|
|
@@ -55,18 +57,25 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
55
57
|
interactionName = _ref.interactionName,
|
|
56
58
|
componentName = _ref.componentName,
|
|
57
59
|
analyticsContext = _ref.analyticsContext,
|
|
60
|
+
ariaLabel = _ref['aria-label'],
|
|
61
|
+
ariaLabelledBy = _ref['aria-labelledby'],
|
|
58
62
|
htmlAttributes = _objectWithoutProperties(_ref, _excluded);
|
|
59
63
|
var interactionContext = useContext(InteractionContext);
|
|
60
64
|
var handleClick = useCallback(function (e, analyticsEvent) {
|
|
61
65
|
interactionContext && interactionContext.tracePress(interactionName, e.timeStamp);
|
|
62
66
|
providedOnClick(e, analyticsEvent);
|
|
63
67
|
}, [providedOnClick, interactionContext, interactionName]);
|
|
68
|
+
// TODO: Use React 18's useId() hook when we update.
|
|
69
|
+
// eslint-disable-next-line @repo/internal/react/disallow-unstable-values
|
|
70
|
+
var opensNewWindowLabelId = uid({
|
|
71
|
+
ariaLabelledBy: ariaLabelledBy
|
|
72
|
+
});
|
|
64
73
|
var onClick = usePlatformLeafEventHandler({
|
|
65
74
|
fn: handleClick,
|
|
66
75
|
action: 'clicked',
|
|
67
76
|
componentName: componentName || 'Anchor',
|
|
68
77
|
packageName: "@atlaskit/primitives",
|
|
69
|
-
packageVersion: "7.0
|
|
78
|
+
packageVersion: "7.1.0",
|
|
70
79
|
analyticsData: analyticsContext,
|
|
71
80
|
actionSubject: 'link'
|
|
72
81
|
});
|
|
@@ -107,11 +116,15 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
107
116
|
paddingInline: paddingInline,
|
|
108
117
|
paddingInlineStart: paddingInlineStart,
|
|
109
118
|
paddingInlineEnd: paddingInlineEnd,
|
|
110
|
-
onClick: onClick
|
|
119
|
+
onClick: onClick,
|
|
120
|
+
"aria-label": ariaLabel && target === '_blank' && !ariaLabelledBy ? "".concat(ariaLabel, " ").concat(OPENS_NEW_WINDOW_LABEL) : ariaLabel,
|
|
121
|
+
"aria-labelledby": ariaLabelledBy && target === '_blank' ? "".concat(ariaLabelledBy, " ").concat(opensNewWindowLabelId) : ariaLabelledBy
|
|
111
122
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
112
123
|
,
|
|
113
124
|
xcss: styles
|
|
114
|
-
}), children, target === '_blank' && /*#__PURE__*/React.createElement(VisuallyHidden,
|
|
125
|
+
}), children, target === '_blank' && (children && !ariaLabel && !ariaLabelledBy || ariaLabelledBy) && /*#__PURE__*/React.createElement(VisuallyHidden, {
|
|
126
|
+
id: opensNewWindowLabelId
|
|
127
|
+
}, OPENS_NEW_WINDOW_LABEL));
|
|
115
128
|
};
|
|
116
129
|
|
|
117
130
|
// Workarounds to support generic types with forwardRef
|
|
@@ -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: "7.0
|
|
71
|
+
packageVersion: "7.1.0",
|
|
72
72
|
analyticsData: analyticsContext,
|
|
73
73
|
actionSubject: 'button'
|
|
74
74
|
});
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import React, { type
|
|
1
|
+
import React, { type Ref } from 'react';
|
|
2
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
|
-
export type AnchorProps<RouterLinkConfig extends Record<string, any> = never> = RouterLinkComponentProps<RouterLinkConfig> & Omit<BoxProps<'a'>, 'href' | 'as' | '
|
|
6
|
-
/**
|
|
7
|
-
* `children` should be defined to ensure links have text.
|
|
8
|
-
*/
|
|
9
|
-
children: ReactNode;
|
|
5
|
+
export type AnchorProps<RouterLinkConfig extends Record<string, any> = never> = RouterLinkComponentProps<RouterLinkConfig> & Omit<BoxProps<'a'>, 'href' | 'as' | 'style' | 'onClick'> & {
|
|
10
6
|
/**
|
|
11
7
|
* 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
8
|
*/
|
|
@@ -26,7 +22,7 @@ export type AnchorProps<RouterLinkConfig extends Record<string, any> = never> =
|
|
|
26
22
|
*/
|
|
27
23
|
analyticsContext?: Record<string, any>;
|
|
28
24
|
};
|
|
29
|
-
declare const AnchorNoRef: <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;
|
|
25
|
+
declare const AnchorNoRef: <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, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...htmlAttributes }: AnchorProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
30
26
|
/**
|
|
31
27
|
* __Anchor__
|
|
32
28
|
*
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
3
3
|
import { type BoxProps } from './box';
|
|
4
|
-
export type PressableProps = Omit<BoxProps<'button'>, 'disabled' | 'as' | '
|
|
5
|
-
/**
|
|
6
|
-
* `children` should be defined to ensure buttons are not empty,
|
|
7
|
-
* because they should have labels.
|
|
8
|
-
*/
|
|
9
|
-
children: ReactNode;
|
|
4
|
+
export type PressableProps = Omit<BoxProps<'button'>, 'disabled' | 'as' | 'style' | 'onClick'> & {
|
|
10
5
|
isDisabled?: boolean;
|
|
11
6
|
/**
|
|
12
7
|
* 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.
|
|
@@ -34,12 +29,7 @@ export type PressableProps = Omit<BoxProps<'button'>, 'disabled' | 'as' | 'child
|
|
|
34
29
|
* - [Code](https://atlassian.design/components/primitives/pressable/code)
|
|
35
30
|
* - [Usage](https://atlassian.design/components/primitives/pressable/usage)
|
|
36
31
|
*/
|
|
37
|
-
declare const Pressable: React.ForwardRefExoticComponent<Pick<Omit<BoxProps<"button">, "style" | "disabled" | "
|
|
38
|
-
/**
|
|
39
|
-
* `children` should be defined to ensure buttons are not empty,
|
|
40
|
-
* because they should have labels.
|
|
41
|
-
*/
|
|
42
|
-
children: ReactNode;
|
|
32
|
+
declare const Pressable: React.ForwardRefExoticComponent<Pick<Omit<BoxProps<"button">, "style" | "disabled" | "as" | "onClick"> & {
|
|
43
33
|
isDisabled?: boolean | undefined;
|
|
44
34
|
/**
|
|
45
35
|
* 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.
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import React, { type
|
|
1
|
+
import React, { type Ref } from 'react';
|
|
2
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
|
-
export type AnchorProps<RouterLinkConfig extends Record<string, any> = never> = RouterLinkComponentProps<RouterLinkConfig> & Omit<BoxProps<'a'>, 'href' | 'as' | '
|
|
6
|
-
/**
|
|
7
|
-
* `children` should be defined to ensure links have text.
|
|
8
|
-
*/
|
|
9
|
-
children: ReactNode;
|
|
5
|
+
export type AnchorProps<RouterLinkConfig extends Record<string, any> = never> = RouterLinkComponentProps<RouterLinkConfig> & Omit<BoxProps<'a'>, 'href' | 'as' | 'style' | 'onClick'> & {
|
|
10
6
|
/**
|
|
11
7
|
* 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
8
|
*/
|
|
@@ -26,7 +22,7 @@ export type AnchorProps<RouterLinkConfig extends Record<string, any> = never> =
|
|
|
26
22
|
*/
|
|
27
23
|
analyticsContext?: Record<string, any>;
|
|
28
24
|
};
|
|
29
|
-
declare const AnchorNoRef: <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;
|
|
25
|
+
declare const AnchorNoRef: <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, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...htmlAttributes }: AnchorProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
30
26
|
/**
|
|
31
27
|
* __Anchor__
|
|
32
28
|
*
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
3
3
|
import { type BoxProps } from './box';
|
|
4
|
-
export type PressableProps = Omit<BoxProps<'button'>, 'disabled' | 'as' | '
|
|
5
|
-
/**
|
|
6
|
-
* `children` should be defined to ensure buttons are not empty,
|
|
7
|
-
* because they should have labels.
|
|
8
|
-
*/
|
|
9
|
-
children: ReactNode;
|
|
4
|
+
export type PressableProps = Omit<BoxProps<'button'>, 'disabled' | 'as' | 'style' | 'onClick'> & {
|
|
10
5
|
isDisabled?: boolean;
|
|
11
6
|
/**
|
|
12
7
|
* 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.
|
|
@@ -34,12 +29,7 @@ export type PressableProps = Omit<BoxProps<'button'>, 'disabled' | 'as' | 'child
|
|
|
34
29
|
* - [Code](https://atlassian.design/components/primitives/pressable/code)
|
|
35
30
|
* - [Usage](https://atlassian.design/components/primitives/pressable/usage)
|
|
36
31
|
*/
|
|
37
|
-
declare const Pressable: React.ForwardRefExoticComponent<Pick<Omit<BoxProps<"button">, "style" | "disabled" | "
|
|
38
|
-
/**
|
|
39
|
-
* `children` should be defined to ensure buttons are not empty,
|
|
40
|
-
* because they should have labels.
|
|
41
|
-
*/
|
|
42
|
-
children: ReactNode;
|
|
32
|
+
declare const Pressable: React.ForwardRefExoticComponent<Pick<Omit<BoxProps<"button">, "style" | "disabled" | "as" | "onClick"> & {
|
|
43
33
|
isDisabled?: boolean | undefined;
|
|
44
34
|
/**
|
|
45
35
|
* 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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/primitives",
|
|
3
|
-
"version": "7.0
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "Primitives are token-backed low-level building blocks.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -134,6 +134,7 @@
|
|
|
134
134
|
"@emotion/react": "^11.7.1",
|
|
135
135
|
"@emotion/serialize": "^1.1.0",
|
|
136
136
|
"bind-event-listener": "^3.0.0",
|
|
137
|
+
"react-uid": "^2.2.0",
|
|
137
138
|
"tiny-invariant": "^1.2.0"
|
|
138
139
|
},
|
|
139
140
|
"peerDependencies": {
|