@atlaskit/primitives 17.1.1 → 18.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/codemods/hypermod.config.tsx +5 -1
- package/constellation/anchor/usage.mdx +40 -38
- package/constellation/pressable/usage.mdx +23 -22
- package/dist/cjs/compiled/components/anchor.js +2 -4
- package/dist/cjs/compiled/components/box.js +1 -3
- package/dist/cjs/compiled/components/focusable.js +1 -3
- package/dist/cjs/compiled/components/pressable.js +2 -4
- package/dist/cjs/components/anchor.js +3 -5
- package/dist/cjs/components/bleed.js +1 -1
- package/dist/cjs/components/box.js +1 -3
- package/dist/cjs/components/pressable.js +1 -2
- package/dist/cjs/responsive/hide.js +1 -1
- package/dist/cjs/xcss/style-maps.partial.js +293 -292
- package/dist/es2019/compiled/components/anchor.js +2 -4
- package/dist/es2019/compiled/components/box.js +1 -3
- package/dist/es2019/compiled/components/focusable.js +1 -3
- package/dist/es2019/compiled/components/pressable.js +2 -4
- package/dist/es2019/components/anchor.js +3 -5
- package/dist/es2019/components/bleed.js +1 -1
- package/dist/es2019/components/box.js +1 -3
- package/dist/es2019/components/pressable.js +1 -2
- package/dist/es2019/responsive/hide.js +1 -1
- package/dist/es2019/xcss/style-maps.partial.js +293 -292
- package/dist/esm/compiled/components/anchor.js +2 -4
- package/dist/esm/compiled/components/box.js +1 -3
- package/dist/esm/compiled/components/focusable.js +1 -3
- package/dist/esm/compiled/components/pressable.js +2 -4
- package/dist/esm/components/anchor.js +3 -5
- package/dist/esm/components/bleed.js +1 -1
- package/dist/esm/components/box.js +1 -3
- package/dist/esm/components/pressable.js +1 -2
- package/dist/esm/responsive/hide.js +1 -1
- package/dist/esm/xcss/style-maps.partial.js +293 -292
- package/dist/types/compiled/components/flex.d.ts +2 -2
- package/dist/types/compiled/components/grid.d.ts +2 -2
- package/dist/types/compiled/components/inline.d.ts +2 -2
- package/dist/types/compiled/components/stack.d.ts +2 -2
- package/dist/types/compiled/index.d.ts +1 -1
- package/dist/types/components/flex.d.ts +19 -18
- package/dist/types/components/grid.d.ts +30 -29
- package/dist/types/components/inline.d.ts +1 -1
- package/dist/types/components/stack.d.ts +2 -2
- package/dist/types/components/text.d.ts +4 -3
- package/dist/types/responsive/build-media-query-css.d.ts +3 -3
- package/dist/types/responsive/media-helper.d.ts +17 -17
- package/dist/types/utils/has-text-ancestor-context.d.ts +2 -1
- package/dist/types/utils/surface-provider.d.ts +2 -1
- package/dist/types/xcss/style-maps.partial.d.ts +11 -11
- package/dist/types-ts4.5/compiled/components/flex.d.ts +2 -2
- package/dist/types-ts4.5/compiled/components/grid.d.ts +2 -2
- package/dist/types-ts4.5/compiled/components/inline.d.ts +2 -2
- package/dist/types-ts4.5/compiled/components/stack.d.ts +2 -2
- package/dist/types-ts4.5/compiled/index.d.ts +1 -1
- package/dist/types-ts4.5/components/flex.d.ts +19 -18
- package/dist/types-ts4.5/components/grid.d.ts +30 -29
- package/dist/types-ts4.5/components/inline.d.ts +1 -1
- package/dist/types-ts4.5/components/stack.d.ts +2 -2
- package/dist/types-ts4.5/components/text.d.ts +4 -3
- package/dist/types-ts4.5/responsive/build-media-query-css.d.ts +3 -3
- package/dist/types-ts4.5/responsive/media-helper.d.ts +17 -17
- package/dist/types-ts4.5/utils/has-text-ancestor-context.d.ts +2 -1
- package/dist/types-ts4.5/utils/surface-provider.d.ts +2 -1
- package/dist/types-ts4.5/xcss/style-maps.partial.d.ts +11 -11
- package/package.json +8 -8
- package/scripts/codegen-styles.tsx +6 -9
- package/scripts/color-codegen-template.tsx +8 -9
- package/scripts/elevation-codegen-template.tsx +8 -9
- package/scripts/inverse-color-map-template.tsx +1 -1
- package/scripts/misc-codegen-template.tsx +3 -1
- package/scripts/shape-codegen-template.tsx +3 -1
- package/scripts/spacing-codegen-template.tsx +1 -1
- package/scripts/text-codegen-template.tsx +2 -2
- package/scripts/typography-codegen-template.tsx +7 -4
- package/scripts/utils.tsx +17 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/primitives
|
|
2
2
|
|
|
3
|
+
## 18.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`5db9e3f21a52f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5db9e3f21a52f) -
|
|
8
|
+
Internal refactoring
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 18.0.0
|
|
12
|
+
|
|
13
|
+
### Major Changes
|
|
14
|
+
|
|
15
|
+
- [`2abd451d54eb2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2abd451d54eb2) -
|
|
16
|
+
Removes atlassian-legacy-light/dark color themes from the tokens package. These themes are unused
|
|
17
|
+
and non-functional in terms of color contrast. As a result some primitive components may recieve
|
|
18
|
+
modern fallback color values in some scenarios, however these are inline with the latest token
|
|
19
|
+
themes.
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
|
|
3
25
|
## 17.1.1
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -39,48 +39,50 @@ Anchors are underlined by default. This helps differentiate links from regular t
|
|
|
39
39
|
accessibility requirement. Using color alone to differentiate links isn't accessible, especially if
|
|
40
40
|
links are surrounded by other text.
|
|
41
41
|
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
<DoDont
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
>
|
|
59
|
-
|
|
60
|
-
</DoDont>
|
|
42
|
+
<DoDontGrid>
|
|
43
|
+
<DoDont
|
|
44
|
+
type="do"
|
|
45
|
+
image={{
|
|
46
|
+
url: anchor1Do,
|
|
47
|
+
alt: 'A link surrounded by regular text. The link provides color and an underline to differentiate the link from regular text.',
|
|
48
|
+
}}
|
|
49
|
+
>
|
|
50
|
+
Use both underlines and color for links surrounded by regular text.
|
|
51
|
+
</DoDont>
|
|
52
|
+
<DoDont
|
|
53
|
+
type="dont"
|
|
54
|
+
image={{
|
|
55
|
+
url: anchor1Dont,
|
|
56
|
+
alt: "A link surrounded by regular text. The link provides only color but no underline to differentiate the link from regular text, however it's insufficient.",
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
Only use color to differentiate links from regular text.
|
|
60
|
+
</DoDont>
|
|
61
|
+
</DoDontGrid>
|
|
61
62
|
|
|
62
63
|
Only remove underlines and omit other style affordances such as color if the context surrounding the
|
|
63
64
|
link makes it clear that it's interactive, such as in navigation or a card layout.
|
|
64
65
|
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
<DoDont
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
>
|
|
82
|
-
|
|
83
|
-
</DoDont>
|
|
66
|
+
<DoDontGrid>
|
|
67
|
+
<DoDont
|
|
68
|
+
type="do"
|
|
69
|
+
image={{
|
|
70
|
+
url: anchor2Do,
|
|
71
|
+
alt: 'Links in a navigation section. The links use a subtle text color and no underline, which is appropriate because the surrounding context makes it clear that they are links.',
|
|
72
|
+
}}
|
|
73
|
+
>
|
|
74
|
+
Omit underlines and color when surrounding context makes it clear it's a link.
|
|
75
|
+
</DoDont>
|
|
76
|
+
<DoDont
|
|
77
|
+
type="dont"
|
|
78
|
+
image={{
|
|
79
|
+
url: anchor2Dont,
|
|
80
|
+
alt: 'Links in a navigation section. The links use a bright text color and underline, which is not required because the surrounding context makes it clear that they are links.',
|
|
81
|
+
}}
|
|
82
|
+
>
|
|
83
|
+
Use underlines and color when surrounding context already makes it clear it's a link.
|
|
84
|
+
</DoDont>
|
|
85
|
+
</DoDontGrid>
|
|
84
86
|
|
|
85
87
|
Also, don't underline text that isn't a link. This makes the text look clickable because it looks a
|
|
86
88
|
link.
|
|
@@ -32,28 +32,29 @@ Only use pressable when existing components such as [buttons](/components/button
|
|
|
32
32
|
Using [existing components](/components) with safe customizations is usually faster and keeps
|
|
33
33
|
Atlassian UI more visually consistent as things change.
|
|
34
34
|
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
<DoDont
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
</DoDont>
|
|
35
|
+
<DoDontGrid>
|
|
36
|
+
<DoDont
|
|
37
|
+
type="do"
|
|
38
|
+
image={{
|
|
39
|
+
url: pressablePrimaryDo,
|
|
40
|
+
alt: 'A set of custom buttons built with pressable that are not possible using existing design system components',
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
Use pressable to create buttons when there isn't an existing design system component to achieve
|
|
44
|
+
your use case.
|
|
45
|
+
</DoDont>
|
|
46
|
+
<DoDont
|
|
47
|
+
type="dont"
|
|
48
|
+
image={{
|
|
49
|
+
url: pressablePrimaryDont,
|
|
50
|
+
alt: 'A custom button build with Pressable that looks similar to Button, an existing design system component',
|
|
51
|
+
}}
|
|
52
|
+
>
|
|
53
|
+
Don't use pressable to redesign elements that already exists in the Atlassian design system,
|
|
54
|
+
such as <a href="/components/button/examples">buttons</a>. This can cause visual and behavioral
|
|
55
|
+
inconsistency in apps.
|
|
56
|
+
</DoDont>
|
|
57
|
+
</DoDontGrid>
|
|
57
58
|
|
|
58
59
|
## Accessibility
|
|
59
60
|
|
|
@@ -70,7 +70,7 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
70
70
|
action: 'clicked',
|
|
71
71
|
componentName: componentName || 'Anchor',
|
|
72
72
|
packageName: "@atlaskit/primitives",
|
|
73
|
-
packageVersion: "
|
|
73
|
+
packageVersion: "0.0.0-development",
|
|
74
74
|
analyticsData: analyticsContext,
|
|
75
75
|
actionSubject: 'link'
|
|
76
76
|
});
|
|
@@ -98,9 +98,7 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
98
98
|
// @ts-expect-error we don't allow `a` on Focusable for makers as they should use Anchor instead
|
|
99
99
|
, (0, _extends2.default)({
|
|
100
100
|
as: Component,
|
|
101
|
-
className: xcss
|
|
102
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- TODO: Properly type this and allow pass-through if we can determine the type
|
|
103
|
-
,
|
|
101
|
+
className: xcss,
|
|
104
102
|
style: style,
|
|
105
103
|
ref: ref
|
|
106
104
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
@@ -336,9 +336,7 @@ var Box = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
336
336
|
// @ts-ignore -- not using expect since it causes issues with help-center local consumption - className doesn't exist in the prop definition but we want to ensure it cannot be applied even if types are bypassed
|
|
337
337
|
var _spreadClass = htmlAttributes.className,
|
|
338
338
|
safeHtmlAttributes = (0, _objectWithoutProperties2.default)(htmlAttributes, _excluded2);
|
|
339
|
-
var node = /*#__PURE__*/React.createElement(Component
|
|
340
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
341
|
-
, (0, _extends2.default)({
|
|
339
|
+
var node = /*#__PURE__*/React.createElement(Component, (0, _extends2.default)({
|
|
342
340
|
style: style
|
|
343
341
|
// @ts-ignore -- Expression produces a union type that is too complex to represent. We may be able to narrow the type here but unsure.
|
|
344
342
|
,
|
|
@@ -40,9 +40,7 @@ var Focusable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
40
40
|
return /*#__PURE__*/React.createElement(Component, (0, _extends2.default)({}, safeHtmlAttributes, {
|
|
41
41
|
// @ts-ignore Expression produces a union type that is too complex to represent. We may be able to narrow the type here but unsure.
|
|
42
42
|
ref: ref,
|
|
43
|
-
className: (0, _runtime.ax)(["_ymio1r31 _ypr0glyw _zcxs1o36 _mizu194a _1ah3dkaa _ra3xnqa1 _128mdkaa _1cvmnqa1 _4davt94y", isInset && "_1ah31gjf _2mwq1gjf", xcss])
|
|
44
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
45
|
-
,
|
|
43
|
+
className: (0, _runtime.ax)(["_ymio1r31 _ypr0glyw _zcxs1o36 _mizu194a _1ah3dkaa _ra3xnqa1 _128mdkaa _1cvmnqa1 _4davt94y", isInset && "_1ah31gjf _2mwq1gjf", xcss]),
|
|
46
44
|
style: style,
|
|
47
45
|
"data-testid": testId
|
|
48
46
|
}), children);
|
|
@@ -61,7 +61,7 @@ var Pressable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
61
61
|
action: 'clicked',
|
|
62
62
|
componentName: componentName || 'Pressable',
|
|
63
63
|
packageName: "@atlaskit/primitives",
|
|
64
|
-
packageVersion: "
|
|
64
|
+
packageVersion: "0.0.0-development",
|
|
65
65
|
analyticsData: analyticsContext,
|
|
66
66
|
actionSubject: 'button'
|
|
67
67
|
});
|
|
@@ -78,9 +78,7 @@ var Pressable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
78
78
|
// Adding a tabIndex of 0 to the button will allow it to be focused on click.
|
|
79
79
|
// This is a known issue in Safari that is meant to be "intended", see https://bugs.webkit.org/show_bug.cgi?id=22261
|
|
80
80
|
,
|
|
81
|
-
tabIndex: tabIndex !== null && tabIndex !== void 0 ? tabIndex : (0, _deviceCheck.isSafari)() && !isDisabled ? 0 : undefined
|
|
82
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- TODO: Properly type this and allow pass-through if we can determine the type
|
|
83
|
-
,
|
|
81
|
+
tabIndex: tabIndex !== null && tabIndex !== void 0 ? tabIndex : (0, _deviceCheck.isSafari)() && !isDisabled ? 0 : undefined,
|
|
84
82
|
style: style
|
|
85
83
|
}, safeHtmlAttributes, {
|
|
86
84
|
type: type,
|
|
@@ -26,7 +26,7 @@ var _excluded = ["href", "children", "backgroundColor", "newWindowLabel", "paddi
|
|
|
26
26
|
* @jsxRuntime classic
|
|
27
27
|
* @jsx jsx
|
|
28
28
|
*/
|
|
29
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
29
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
30
30
|
// TODO: duplicates FocusRing styles from `@atlaskit/focus-ring`.
|
|
31
31
|
var focusRingStyles = (0, _react2.css)({
|
|
32
32
|
'&:focus, &:focus-visible': {
|
|
@@ -105,7 +105,7 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
105
105
|
action: 'clicked',
|
|
106
106
|
componentName: componentName || 'Anchor',
|
|
107
107
|
packageName: "@atlaskit/primitives",
|
|
108
|
-
packageVersion: "
|
|
108
|
+
packageVersion: "0.0.0-development",
|
|
109
109
|
analyticsData: analyticsContext,
|
|
110
110
|
actionSubject: 'link'
|
|
111
111
|
});
|
|
@@ -130,9 +130,7 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
130
130
|
var hrefObjectUsedWithoutRouterLink = RouterLink === undefined && (0, _typeof2.default)(href) === 'object';
|
|
131
131
|
(0, _tinyInvariant.default)(!hrefObjectUsedWithoutRouterLink, "@atlaskit/primitives: Anchor primitive cannot pass an object to 'href' unless a router link is configured in the AppProvider");
|
|
132
132
|
var Component = isRouterLink ? RouterLink : 'a';
|
|
133
|
-
return (0, _react2.jsx)(Component
|
|
134
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
135
|
-
, (0, _extends2.default)({
|
|
133
|
+
return (0, _react2.jsx)(Component, (0, _extends2.default)({
|
|
136
134
|
style: style,
|
|
137
135
|
ref: ref
|
|
138
136
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -14,7 +14,7 @@ var _xcss = require("../xcss/xcss");
|
|
|
14
14
|
* @jsx jsx
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports, @atlaskit/ui-styling-standard/use-compiled
|
|
18
18
|
|
|
19
19
|
var baseStyles = (0, _react2.css)({
|
|
20
20
|
boxSizing: 'border-box'
|
|
@@ -57,9 +57,7 @@ var Box = exports.Box = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
57
57
|
var resolvedStyles = (0, _xcss.parseXcss)(xcss);
|
|
58
58
|
var node =
|
|
59
59
|
// @ts-expect-error Expression produces a union type that is too complex to represent. I think this is unavoidable
|
|
60
|
-
(0, _react2.jsx)(Component
|
|
61
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
62
|
-
, (0, _extends2.default)({
|
|
60
|
+
(0, _react2.jsx)(Component, (0, _extends2.default)({
|
|
63
61
|
style: style
|
|
64
62
|
// @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
63
|
,
|
|
@@ -97,7 +97,7 @@ var Pressable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
97
97
|
action: 'clicked',
|
|
98
98
|
componentName: componentName || 'Pressable',
|
|
99
99
|
packageName: "@atlaskit/primitives",
|
|
100
|
-
packageVersion: "
|
|
100
|
+
packageVersion: "0.0.0-development",
|
|
101
101
|
analyticsData: analyticsContext,
|
|
102
102
|
actionSubject: 'button'
|
|
103
103
|
});
|
|
@@ -108,7 +108,6 @@ var Pressable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
108
108
|
safeHtmlAttributes = (0, _objectWithoutProperties2.default)(htmlAttributes, _excluded2);
|
|
109
109
|
var resolvedStyles = (0, _xcss.parseXcss)(xcss);
|
|
110
110
|
return (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
111
|
style: style,
|
|
113
112
|
ref: ref
|
|
114
113
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -14,7 +14,7 @@ var _buildMediaQueryCss = require("./build-media-query-css");
|
|
|
14
14
|
* @jsx jsx
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
18
18
|
|
|
19
19
|
var hideAboveQueries = (0, _buildMediaQueryCss.UNSAFE_buildAboveMediaQueryCSS)({
|
|
20
20
|
display: 'none'
|