@atlaskit/primitives 8.2.1 → 10.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 +19 -0
- package/dist/cjs/components/anchor.js +2 -8
- package/dist/cjs/components/box.js +1 -1
- package/dist/cjs/components/pressable.js +38 -43
- package/dist/es2019/components/anchor.js +3 -9
- package/dist/es2019/components/box.js +1 -1
- package/dist/es2019/components/pressable.js +39 -44
- package/dist/esm/components/anchor.js +3 -9
- package/dist/esm/components/box.js +1 -1
- package/dist/esm/components/pressable.js +39 -44
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/primitives
|
|
2
2
|
|
|
3
|
+
## 10.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#115948](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/115948)
|
|
8
|
+
[`1798755846b6d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1798755846b6d) -
|
|
9
|
+
Released Anchor primitive to open beta.
|
|
10
|
+
|
|
11
|
+
## 9.0.0
|
|
12
|
+
|
|
13
|
+
### Major Changes
|
|
14
|
+
|
|
15
|
+
- [#114987](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/114987)
|
|
16
|
+
[`d4d420c947747`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d4d420c947747) -
|
|
17
|
+
[ux] Pressable and Anchor primitives no longer support surface color detection to improve
|
|
18
|
+
performance. These primitives don't contain nested layouts so this is not needed. Although this is
|
|
19
|
+
a breaking change, the impact of this change is minimal as no usage of surface detection in these
|
|
20
|
+
primitives has been observed.
|
|
21
|
+
|
|
3
22
|
## 8.2.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -19,7 +19,6 @@ var _interactionContext = _interopRequireDefault(require("@atlaskit/interaction-
|
|
|
19
19
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
20
20
|
var _styleMaps = require("../xcss/style-maps.partial");
|
|
21
21
|
var _xcss = require("../xcss/xcss");
|
|
22
|
-
var _surfaceProvider = require("./internal/surface-provider");
|
|
23
22
|
var _excluded = ["href", "children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "onClick", "interactionName", "componentName", "analyticsContext", "aria-label", "aria-labelledby", "style", "target", "testId", "xcss"],
|
|
24
23
|
_excluded2 = ["className"];
|
|
25
24
|
/**
|
|
@@ -104,7 +103,7 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
104
103
|
action: 'clicked',
|
|
105
104
|
componentName: componentName || 'Anchor',
|
|
106
105
|
packageName: "@atlaskit/primitives",
|
|
107
|
-
packageVersion: "
|
|
106
|
+
packageVersion: "10.0.0",
|
|
108
107
|
analyticsData: analyticsContext,
|
|
109
108
|
actionSubject: 'link'
|
|
110
109
|
});
|
|
@@ -129,7 +128,7 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
129
128
|
var hrefObjectUsedWithoutRouterLink = RouterLink === undefined && (0, _typeof2.default)(href) === 'object';
|
|
130
129
|
(0, _tinyInvariant.default)(!hrefObjectUsedWithoutRouterLink, "@atlaskit/primitives: Anchor primitive cannot pass an object to 'href' unless a router link is configured in the AppProvider");
|
|
131
130
|
var Component = isRouterLink ? RouterLink : 'a';
|
|
132
|
-
|
|
131
|
+
return (0, _react2.jsx)(Component
|
|
133
132
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
134
133
|
, (0, _extends2.default)({
|
|
135
134
|
style: style,
|
|
@@ -149,8 +148,6 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
149
148
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
150
149
|
backgroundColor && _styleMaps.backgroundColorStylesMap[backgroundColor],
|
|
151
150
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
152
|
-
(0, _styleMaps.isSurfaceColorToken)(backgroundColor) && _styleMaps.surfaceColorStylesMap[backgroundColor],
|
|
153
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
154
151
|
padding && _styleMaps.paddingStylesMap.padding[padding],
|
|
155
152
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
156
153
|
paddingBlock && _styleMaps.paddingStylesMap.paddingBlock[paddingBlock],
|
|
@@ -171,9 +168,6 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
171
168
|
}), children, target === '_blank' && (children && !ariaLabel && !ariaLabelledBy || ariaLabelledBy) && (0, _react2.jsx)(_visuallyHidden.default, {
|
|
172
169
|
id: opensNewWindowLabelId
|
|
173
170
|
}, OPENS_NEW_WINDOW_LABEL));
|
|
174
|
-
return backgroundColor ? (0, _react2.jsx)(_surfaceProvider.SurfaceContext.Provider, {
|
|
175
|
-
value: backgroundColor
|
|
176
|
-
}, node) : node;
|
|
177
171
|
};
|
|
178
172
|
|
|
179
173
|
// Workarounds to support generic types with forwardRef
|
|
@@ -61,7 +61,7 @@ var Box = exports.Box = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
61
61
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
62
62
|
, (0, _extends2.default)({
|
|
63
63
|
style: style
|
|
64
|
-
// @ts-
|
|
64
|
+
// @ts-ignore Expression produces a union type that is too complex to represent. We may be able to narrow the type here but unsure.
|
|
65
65
|
,
|
|
66
66
|
ref: ref
|
|
67
67
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -14,7 +14,6 @@ var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
|
14
14
|
var _interactionContext = _interopRequireDefault(require("@atlaskit/interaction-context"));
|
|
15
15
|
var _styleMaps = require("../xcss/style-maps.partial");
|
|
16
16
|
var _xcss = require("../xcss/xcss");
|
|
17
|
-
var _surfaceProvider = require("./internal/surface-provider");
|
|
18
17
|
var _excluded = ["children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "isDisabled", "type", "onClick", "interactionName", "componentName", "analyticsContext", "style", "testId", "xcss"],
|
|
19
18
|
_excluded2 = ["className"];
|
|
20
19
|
/**
|
|
@@ -96,7 +95,7 @@ var Pressable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
96
95
|
action: 'clicked',
|
|
97
96
|
componentName: componentName || 'Pressable',
|
|
98
97
|
packageName: "@atlaskit/primitives",
|
|
99
|
-
packageVersion: "
|
|
98
|
+
packageVersion: "10.0.0",
|
|
100
99
|
analyticsData: analyticsContext,
|
|
101
100
|
actionSubject: 'button'
|
|
102
101
|
});
|
|
@@ -106,46 +105,42 @@ var Pressable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
106
105
|
var _spreadClass = htmlAttributes.className,
|
|
107
106
|
safeHtmlAttributes = (0, _objectWithoutProperties2.default)(htmlAttributes, _excluded2);
|
|
108
107
|
var resolvedStyles = (0, _xcss.parseXcss)(xcss);
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}), children);
|
|
147
|
-
return backgroundColor ? (0, _react2.jsx)(_surfaceProvider.SurfaceContext.Provider, {
|
|
148
|
-
value: backgroundColor
|
|
149
|
-
}, node) : node;
|
|
108
|
+
return (
|
|
109
|
+
// eslint-disable-next-line @atlaskit/design-system/no-html-button
|
|
110
|
+
(0, _react2.jsx)("button", (0, _extends2.default)({
|
|
111
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
112
|
+
style: style,
|
|
113
|
+
ref: ref
|
|
114
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
115
|
+
,
|
|
116
|
+
className: resolvedStyles.static
|
|
117
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
118
|
+
}, safeHtmlAttributes, {
|
|
119
|
+
// eslint-disable-next-line react/button-has-type
|
|
120
|
+
type: type,
|
|
121
|
+
onClick: onClick,
|
|
122
|
+
disabled: isDisabled,
|
|
123
|
+
css: [baseStyles, focusRingStyles, isDisabled ? disabledStyles : enabledStyles,
|
|
124
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
125
|
+
backgroundColor && _styleMaps.backgroundColorStylesMap[backgroundColor],
|
|
126
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
127
|
+
padding && _styleMaps.paddingStylesMap.padding[padding],
|
|
128
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
129
|
+
paddingBlock && _styleMaps.paddingStylesMap.paddingBlock[paddingBlock],
|
|
130
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
131
|
+
paddingBlockStart && _styleMaps.paddingStylesMap.paddingBlockStart[paddingBlockStart],
|
|
132
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
133
|
+
paddingBlockEnd && _styleMaps.paddingStylesMap.paddingBlockEnd[paddingBlockEnd],
|
|
134
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
135
|
+
paddingInline && _styleMaps.paddingStylesMap.paddingInline[paddingInline],
|
|
136
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
137
|
+
paddingInlineStart && _styleMaps.paddingStylesMap.paddingInlineStart[paddingInlineStart],
|
|
138
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
139
|
+
paddingInlineEnd && _styleMaps.paddingStylesMap.paddingInlineEnd[paddingInlineEnd],
|
|
140
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
141
|
+
resolvedStyles.emotion],
|
|
142
|
+
"data-testid": testId
|
|
143
|
+
}), children)
|
|
144
|
+
);
|
|
150
145
|
});
|
|
151
146
|
var _default = exports.default = Pressable;
|
|
@@ -14,9 +14,8 @@ import { useRouterLink } from '@atlaskit/app-provider';
|
|
|
14
14
|
import noop from '@atlaskit/ds-lib/noop';
|
|
15
15
|
import InteractionContext from '@atlaskit/interaction-context';
|
|
16
16
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
17
|
-
import { backgroundColorStylesMap, borderColorMap, borderWidthMap,
|
|
17
|
+
import { backgroundColorStylesMap, borderColorMap, borderWidthMap, paddingStylesMap, positiveSpaceMap } from '../xcss/style-maps.partial';
|
|
18
18
|
import { parseXcss } from '../xcss/xcss';
|
|
19
|
-
import { SurfaceContext } from './internal/surface-provider';
|
|
20
19
|
// TODO: duplicates FocusRing styles from `@atlaskit/focus-ring`.
|
|
21
20
|
const focusRingStyles = css({
|
|
22
21
|
'&:focus, &:focus-visible': {
|
|
@@ -94,7 +93,7 @@ const AnchorNoRef = ({
|
|
|
94
93
|
action: 'clicked',
|
|
95
94
|
componentName: componentName || 'Anchor',
|
|
96
95
|
packageName: "@atlaskit/primitives",
|
|
97
|
-
packageVersion: "
|
|
96
|
+
packageVersion: "10.0.0",
|
|
98
97
|
analyticsData: analyticsContext,
|
|
99
98
|
actionSubject: 'link'
|
|
100
99
|
});
|
|
@@ -121,7 +120,7 @@ const AnchorNoRef = ({
|
|
|
121
120
|
const hrefObjectUsedWithoutRouterLink = RouterLink === undefined && typeof href === 'object';
|
|
122
121
|
invariant(!hrefObjectUsedWithoutRouterLink, `@atlaskit/primitives: Anchor primitive cannot pass an object to 'href' unless a router link is configured in the AppProvider`);
|
|
123
122
|
const Component = isRouterLink ? RouterLink : 'a';
|
|
124
|
-
|
|
123
|
+
return jsx(Component
|
|
125
124
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
126
125
|
, _extends({
|
|
127
126
|
style: style,
|
|
@@ -141,8 +140,6 @@ const AnchorNoRef = ({
|
|
|
141
140
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
142
141
|
backgroundColor && backgroundColorStylesMap[backgroundColor],
|
|
143
142
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
144
|
-
isSurfaceColorToken(backgroundColor) && surfaceColorStylesMap[backgroundColor],
|
|
145
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
146
143
|
padding && paddingStylesMap.padding[padding],
|
|
147
144
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
148
145
|
paddingBlock && paddingStylesMap.paddingBlock[paddingBlock],
|
|
@@ -163,9 +160,6 @@ const AnchorNoRef = ({
|
|
|
163
160
|
}), children, target === '_blank' && (children && !ariaLabel && !ariaLabelledBy || ariaLabelledBy) && jsx(VisuallyHidden, {
|
|
164
161
|
id: opensNewWindowLabelId
|
|
165
162
|
}, OPENS_NEW_WINDOW_LABEL));
|
|
166
|
-
return backgroundColor ? jsx(SurfaceContext.Provider, {
|
|
167
|
-
value: backgroundColor
|
|
168
|
-
}, node) : node;
|
|
169
163
|
};
|
|
170
164
|
|
|
171
165
|
// Workarounds to support generic types with forwardRef
|
|
@@ -55,7 +55,7 @@ export const Box = /*#__PURE__*/forwardRef(({
|
|
|
55
55
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
56
56
|
, _extends({
|
|
57
57
|
style: style
|
|
58
|
-
// @ts-
|
|
58
|
+
// @ts-ignore Expression produces a union type that is too complex to represent. We may be able to narrow the type here but unsure.
|
|
59
59
|
,
|
|
60
60
|
ref: ref
|
|
61
61
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -10,9 +10,8 @@ import { css, jsx } from '@emotion/react';
|
|
|
10
10
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
11
11
|
import noop from '@atlaskit/ds-lib/noop';
|
|
12
12
|
import InteractionContext from '@atlaskit/interaction-context';
|
|
13
|
-
import { backgroundColorStylesMap, borderColorMap, borderWidthMap,
|
|
13
|
+
import { backgroundColorStylesMap, borderColorMap, borderWidthMap, paddingStylesMap, positiveSpaceMap } from '../xcss/style-maps.partial';
|
|
14
14
|
import { parseXcss } from '../xcss/xcss';
|
|
15
|
-
import { SurfaceContext } from './internal/surface-provider';
|
|
16
15
|
// This duplicates FocusRing styles from `@atlaskit/focus-ring`.
|
|
17
16
|
const focusRingStyles = css({
|
|
18
17
|
'&:focus, &:focus-visible': {
|
|
@@ -86,7 +85,7 @@ const Pressable = /*#__PURE__*/forwardRef(({
|
|
|
86
85
|
action: 'clicked',
|
|
87
86
|
componentName: componentName || 'Pressable',
|
|
88
87
|
packageName: "@atlaskit/primitives",
|
|
89
|
-
packageVersion: "
|
|
88
|
+
packageVersion: "10.0.0",
|
|
90
89
|
analyticsData: analyticsContext,
|
|
91
90
|
actionSubject: 'button'
|
|
92
91
|
});
|
|
@@ -98,46 +97,42 @@ const Pressable = /*#__PURE__*/forwardRef(({
|
|
|
98
97
|
...safeHtmlAttributes
|
|
99
98
|
} = htmlAttributes;
|
|
100
99
|
const resolvedStyles = parseXcss(xcss);
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}), children);
|
|
139
|
-
return backgroundColor ? jsx(SurfaceContext.Provider, {
|
|
140
|
-
value: backgroundColor
|
|
141
|
-
}, node) : node;
|
|
100
|
+
return (
|
|
101
|
+
// eslint-disable-next-line @atlaskit/design-system/no-html-button
|
|
102
|
+
jsx("button", _extends({
|
|
103
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
104
|
+
style: style,
|
|
105
|
+
ref: ref
|
|
106
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
107
|
+
,
|
|
108
|
+
className: resolvedStyles.static
|
|
109
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
110
|
+
}, safeHtmlAttributes, {
|
|
111
|
+
// eslint-disable-next-line react/button-has-type
|
|
112
|
+
type: type,
|
|
113
|
+
onClick: onClick,
|
|
114
|
+
disabled: isDisabled,
|
|
115
|
+
css: [baseStyles, focusRingStyles, isDisabled ? disabledStyles : enabledStyles,
|
|
116
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
117
|
+
backgroundColor && backgroundColorStylesMap[backgroundColor],
|
|
118
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
119
|
+
padding && paddingStylesMap.padding[padding],
|
|
120
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
121
|
+
paddingBlock && paddingStylesMap.paddingBlock[paddingBlock],
|
|
122
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
123
|
+
paddingBlockStart && paddingStylesMap.paddingBlockStart[paddingBlockStart],
|
|
124
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
125
|
+
paddingBlockEnd && paddingStylesMap.paddingBlockEnd[paddingBlockEnd],
|
|
126
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
127
|
+
paddingInline && paddingStylesMap.paddingInline[paddingInline],
|
|
128
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
129
|
+
paddingInlineStart && paddingStylesMap.paddingInlineStart[paddingInlineStart],
|
|
130
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
131
|
+
paddingInlineEnd && paddingStylesMap.paddingInlineEnd[paddingInlineEnd],
|
|
132
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
133
|
+
resolvedStyles.emotion],
|
|
134
|
+
"data-testid": testId
|
|
135
|
+
}), children)
|
|
136
|
+
);
|
|
142
137
|
});
|
|
143
138
|
export default Pressable;
|
|
@@ -18,9 +18,8 @@ import { useRouterLink } from '@atlaskit/app-provider';
|
|
|
18
18
|
import noop from '@atlaskit/ds-lib/noop';
|
|
19
19
|
import InteractionContext from '@atlaskit/interaction-context';
|
|
20
20
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
21
|
-
import { backgroundColorStylesMap, borderColorMap, borderWidthMap,
|
|
21
|
+
import { backgroundColorStylesMap, borderColorMap, borderWidthMap, paddingStylesMap, positiveSpaceMap } from '../xcss/style-maps.partial';
|
|
22
22
|
import { parseXcss } from '../xcss/xcss';
|
|
23
|
-
import { SurfaceContext } from './internal/surface-provider';
|
|
24
23
|
// TODO: duplicates FocusRing styles from `@atlaskit/focus-ring`.
|
|
25
24
|
var focusRingStyles = css({
|
|
26
25
|
'&:focus, &:focus-visible': {
|
|
@@ -98,7 +97,7 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
98
97
|
action: 'clicked',
|
|
99
98
|
componentName: componentName || 'Anchor',
|
|
100
99
|
packageName: "@atlaskit/primitives",
|
|
101
|
-
packageVersion: "
|
|
100
|
+
packageVersion: "10.0.0",
|
|
102
101
|
analyticsData: analyticsContext,
|
|
103
102
|
actionSubject: 'link'
|
|
104
103
|
});
|
|
@@ -123,7 +122,7 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
123
122
|
var hrefObjectUsedWithoutRouterLink = RouterLink === undefined && _typeof(href) === 'object';
|
|
124
123
|
invariant(!hrefObjectUsedWithoutRouterLink, "@atlaskit/primitives: Anchor primitive cannot pass an object to 'href' unless a router link is configured in the AppProvider");
|
|
125
124
|
var Component = isRouterLink ? RouterLink : 'a';
|
|
126
|
-
|
|
125
|
+
return jsx(Component
|
|
127
126
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
128
127
|
, _extends({
|
|
129
128
|
style: style,
|
|
@@ -143,8 +142,6 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
143
142
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
144
143
|
backgroundColor && backgroundColorStylesMap[backgroundColor],
|
|
145
144
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
146
|
-
isSurfaceColorToken(backgroundColor) && surfaceColorStylesMap[backgroundColor],
|
|
147
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
148
145
|
padding && paddingStylesMap.padding[padding],
|
|
149
146
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
150
147
|
paddingBlock && paddingStylesMap.paddingBlock[paddingBlock],
|
|
@@ -165,9 +162,6 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
165
162
|
}), children, target === '_blank' && (children && !ariaLabel && !ariaLabelledBy || ariaLabelledBy) && jsx(VisuallyHidden, {
|
|
166
163
|
id: opensNewWindowLabelId
|
|
167
164
|
}, OPENS_NEW_WINDOW_LABEL));
|
|
168
|
-
return backgroundColor ? jsx(SurfaceContext.Provider, {
|
|
169
|
-
value: backgroundColor
|
|
170
|
-
}, node) : node;
|
|
171
165
|
};
|
|
172
166
|
|
|
173
167
|
// Workarounds to support generic types with forwardRef
|
|
@@ -56,7 +56,7 @@ export var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
56
56
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
57
57
|
, _extends({
|
|
58
58
|
style: style
|
|
59
|
-
// @ts-
|
|
59
|
+
// @ts-ignore Expression produces a union type that is too complex to represent. We may be able to narrow the type here but unsure.
|
|
60
60
|
,
|
|
61
61
|
ref: ref
|
|
62
62
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -13,9 +13,8 @@ import { css, jsx } from '@emotion/react';
|
|
|
13
13
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
14
14
|
import noop from '@atlaskit/ds-lib/noop';
|
|
15
15
|
import InteractionContext from '@atlaskit/interaction-context';
|
|
16
|
-
import { backgroundColorStylesMap, borderColorMap, borderWidthMap,
|
|
16
|
+
import { backgroundColorStylesMap, borderColorMap, borderWidthMap, paddingStylesMap, positiveSpaceMap } from '../xcss/style-maps.partial';
|
|
17
17
|
import { parseXcss } from '../xcss/xcss';
|
|
18
|
-
import { SurfaceContext } from './internal/surface-provider';
|
|
19
18
|
// This duplicates FocusRing styles from `@atlaskit/focus-ring`.
|
|
20
19
|
var focusRingStyles = css({
|
|
21
20
|
'&:focus, &:focus-visible': {
|
|
@@ -90,7 +89,7 @@ var Pressable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
90
89
|
action: 'clicked',
|
|
91
90
|
componentName: componentName || 'Pressable',
|
|
92
91
|
packageName: "@atlaskit/primitives",
|
|
93
|
-
packageVersion: "
|
|
92
|
+
packageVersion: "10.0.0",
|
|
94
93
|
analyticsData: analyticsContext,
|
|
95
94
|
actionSubject: 'button'
|
|
96
95
|
});
|
|
@@ -100,46 +99,42 @@ var Pressable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
100
99
|
var _spreadClass = htmlAttributes.className,
|
|
101
100
|
safeHtmlAttributes = _objectWithoutProperties(htmlAttributes, _excluded2);
|
|
102
101
|
var resolvedStyles = parseXcss(xcss);
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}), children);
|
|
141
|
-
return backgroundColor ? jsx(SurfaceContext.Provider, {
|
|
142
|
-
value: backgroundColor
|
|
143
|
-
}, node) : node;
|
|
102
|
+
return (
|
|
103
|
+
// eslint-disable-next-line @atlaskit/design-system/no-html-button
|
|
104
|
+
jsx("button", _extends({
|
|
105
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
106
|
+
style: style,
|
|
107
|
+
ref: ref
|
|
108
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
109
|
+
,
|
|
110
|
+
className: resolvedStyles.static
|
|
111
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
112
|
+
}, safeHtmlAttributes, {
|
|
113
|
+
// eslint-disable-next-line react/button-has-type
|
|
114
|
+
type: type,
|
|
115
|
+
onClick: onClick,
|
|
116
|
+
disabled: isDisabled,
|
|
117
|
+
css: [baseStyles, focusRingStyles, isDisabled ? disabledStyles : enabledStyles,
|
|
118
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
119
|
+
backgroundColor && backgroundColorStylesMap[backgroundColor],
|
|
120
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
121
|
+
padding && paddingStylesMap.padding[padding],
|
|
122
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
123
|
+
paddingBlock && paddingStylesMap.paddingBlock[paddingBlock],
|
|
124
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
125
|
+
paddingBlockStart && paddingStylesMap.paddingBlockStart[paddingBlockStart],
|
|
126
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
127
|
+
paddingBlockEnd && paddingStylesMap.paddingBlockEnd[paddingBlockEnd],
|
|
128
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
129
|
+
paddingInline && paddingStylesMap.paddingInline[paddingInline],
|
|
130
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
131
|
+
paddingInlineStart && paddingStylesMap.paddingInlineStart[paddingInlineStart],
|
|
132
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
133
|
+
paddingInlineEnd && paddingStylesMap.paddingInlineEnd[paddingInlineEnd],
|
|
134
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
135
|
+
resolvedStyles.emotion],
|
|
136
|
+
"data-testid": testId
|
|
137
|
+
}), children)
|
|
138
|
+
);
|
|
144
139
|
});
|
|
145
140
|
export default Pressable;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/primitives",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "Primitives are token-backed low-level building blocks.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"slug": "primitives/anchor",
|
|
113
113
|
"id": "@atlaskit/primitives/anchor",
|
|
114
114
|
"status": {
|
|
115
|
-
"type": "
|
|
115
|
+
"type": "beta"
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
]
|