@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.
Files changed (75) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/codemods/hypermod.config.tsx +5 -1
  3. package/constellation/anchor/usage.mdx +40 -38
  4. package/constellation/pressable/usage.mdx +23 -22
  5. package/dist/cjs/compiled/components/anchor.js +2 -4
  6. package/dist/cjs/compiled/components/box.js +1 -3
  7. package/dist/cjs/compiled/components/focusable.js +1 -3
  8. package/dist/cjs/compiled/components/pressable.js +2 -4
  9. package/dist/cjs/components/anchor.js +3 -5
  10. package/dist/cjs/components/bleed.js +1 -1
  11. package/dist/cjs/components/box.js +1 -3
  12. package/dist/cjs/components/pressable.js +1 -2
  13. package/dist/cjs/responsive/hide.js +1 -1
  14. package/dist/cjs/xcss/style-maps.partial.js +293 -292
  15. package/dist/es2019/compiled/components/anchor.js +2 -4
  16. package/dist/es2019/compiled/components/box.js +1 -3
  17. package/dist/es2019/compiled/components/focusable.js +1 -3
  18. package/dist/es2019/compiled/components/pressable.js +2 -4
  19. package/dist/es2019/components/anchor.js +3 -5
  20. package/dist/es2019/components/bleed.js +1 -1
  21. package/dist/es2019/components/box.js +1 -3
  22. package/dist/es2019/components/pressable.js +1 -2
  23. package/dist/es2019/responsive/hide.js +1 -1
  24. package/dist/es2019/xcss/style-maps.partial.js +293 -292
  25. package/dist/esm/compiled/components/anchor.js +2 -4
  26. package/dist/esm/compiled/components/box.js +1 -3
  27. package/dist/esm/compiled/components/focusable.js +1 -3
  28. package/dist/esm/compiled/components/pressable.js +2 -4
  29. package/dist/esm/components/anchor.js +3 -5
  30. package/dist/esm/components/bleed.js +1 -1
  31. package/dist/esm/components/box.js +1 -3
  32. package/dist/esm/components/pressable.js +1 -2
  33. package/dist/esm/responsive/hide.js +1 -1
  34. package/dist/esm/xcss/style-maps.partial.js +293 -292
  35. package/dist/types/compiled/components/flex.d.ts +2 -2
  36. package/dist/types/compiled/components/grid.d.ts +2 -2
  37. package/dist/types/compiled/components/inline.d.ts +2 -2
  38. package/dist/types/compiled/components/stack.d.ts +2 -2
  39. package/dist/types/compiled/index.d.ts +1 -1
  40. package/dist/types/components/flex.d.ts +19 -18
  41. package/dist/types/components/grid.d.ts +30 -29
  42. package/dist/types/components/inline.d.ts +1 -1
  43. package/dist/types/components/stack.d.ts +2 -2
  44. package/dist/types/components/text.d.ts +4 -3
  45. package/dist/types/responsive/build-media-query-css.d.ts +3 -3
  46. package/dist/types/responsive/media-helper.d.ts +17 -17
  47. package/dist/types/utils/has-text-ancestor-context.d.ts +2 -1
  48. package/dist/types/utils/surface-provider.d.ts +2 -1
  49. package/dist/types/xcss/style-maps.partial.d.ts +11 -11
  50. package/dist/types-ts4.5/compiled/components/flex.d.ts +2 -2
  51. package/dist/types-ts4.5/compiled/components/grid.d.ts +2 -2
  52. package/dist/types-ts4.5/compiled/components/inline.d.ts +2 -2
  53. package/dist/types-ts4.5/compiled/components/stack.d.ts +2 -2
  54. package/dist/types-ts4.5/compiled/index.d.ts +1 -1
  55. package/dist/types-ts4.5/components/flex.d.ts +19 -18
  56. package/dist/types-ts4.5/components/grid.d.ts +30 -29
  57. package/dist/types-ts4.5/components/inline.d.ts +1 -1
  58. package/dist/types-ts4.5/components/stack.d.ts +2 -2
  59. package/dist/types-ts4.5/components/text.d.ts +4 -3
  60. package/dist/types-ts4.5/responsive/build-media-query-css.d.ts +3 -3
  61. package/dist/types-ts4.5/responsive/media-helper.d.ts +17 -17
  62. package/dist/types-ts4.5/utils/has-text-ancestor-context.d.ts +2 -1
  63. package/dist/types-ts4.5/utils/surface-provider.d.ts +2 -1
  64. package/dist/types-ts4.5/xcss/style-maps.partial.d.ts +11 -11
  65. package/package.json +8 -8
  66. package/scripts/codegen-styles.tsx +6 -9
  67. package/scripts/color-codegen-template.tsx +8 -9
  68. package/scripts/elevation-codegen-template.tsx +8 -9
  69. package/scripts/inverse-color-map-template.tsx +1 -1
  70. package/scripts/misc-codegen-template.tsx +3 -1
  71. package/scripts/shape-codegen-template.tsx +3 -1
  72. package/scripts/spacing-codegen-template.tsx +1 -1
  73. package/scripts/text-codegen-template.tsx +2 -2
  74. package/scripts/typography-codegen-template.tsx +7 -4
  75. 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
@@ -1,6 +1,10 @@
1
1
  import compiledForkStage1 from './compiled-fork-stage1/transform';
2
2
 
3
- const config = {
3
+ const config: {
4
+ presets: {
5
+ 'compiled-fork-stage1': typeof compiledForkStage1;
6
+ };
7
+ } = {
4
8
  presets: {
5
9
  'compiled-fork-stage1': compiledForkStage1,
6
10
  },
@@ -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
- <DoDont
43
- type="do"
44
- image={{
45
- url: anchor1Do,
46
- alt: 'A link surrounded by regular text. The link provides color and an underline to differentiate the link from regular text.',
47
- }}
48
- >
49
- Use both underlines and color for links surrounded by regular text.
50
- </DoDont>
51
-
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>
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
- <DoDont
66
- type="do"
67
- image={{
68
- url: anchor2Do,
69
- 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.',
70
- }}
71
- >
72
- Omit underlines and color when surrounding context makes it clear it's a link.
73
- </DoDont>
74
-
75
- <DoDont
76
- type="dont"
77
- image={{
78
- url: anchor2Dont,
79
- 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.',
80
- }}
81
- >
82
- Use underlines and color when surrounding context already makes it clear it's a link.
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
- <DoDont
36
- type="do"
37
- image={{
38
- url: pressablePrimaryDo,
39
- alt: 'A set of custom buttons built with pressable that are not possible using existing design system components',
40
- }}
41
- >
42
- Use pressable to create buttons when there isn't an existing design system component to achieve
43
- your use case.
44
- </DoDont>
45
-
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, such
54
- as <a href="/components/button/examples">buttons</a>. This can cause visual and behavioral
55
- inconsistency in apps.
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: "17.1.0",
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: "17.1.0",
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 -- Ignored via go/DSP-18766
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: "17.1.0",
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 -- Ignored via go/DSP-18766
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: "17.1.0",
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 -- Ignored via go/DSP-18766
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'