@atlaskit/image 2.0.0 → 3.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 CHANGED
@@ -1,5 +1,30 @@
1
1
  # @atlaskit/image
2
2
 
3
+ ## 3.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 3.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - [#130672](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/130672)
14
+ [`c92554212ded6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c92554212ded6) -
15
+ Migrated from `@emotion/react` to `@compiled/react` in order to improve performance, align with
16
+ the rest of the Atlaskit techstack, and support React 18 Streaming SSR. Please note, in order to
17
+ use this version of `@atlaskit/image`, you will need to ensure that your bundler is configured to
18
+ handle `.css` imports correctly.
19
+
20
+ Removed `--img-source` and `--img-source-dark` CSS variables and `content` CSS property from
21
+ `<img>` since the `content` values were invalid before.
22
+
23
+ Most bundlers come with built-in support for `.css` imports, so you may not need to do anything.
24
+ If you are using a different bundler, please refer to the documentation for that bundler to
25
+ understand how to handle `.css` imports. For more information on the migration, please refer to
26
+ [RFC-73 Migrating our components to Compiled CSS-in-JS](https://community.developer.atlassian.com/t/rfc-73-migrating-our-components-to-compiled-css-in-js/85953).
27
+
3
28
  ## 2.0.0
4
29
 
5
30
  ### Major Changes
@@ -0,0 +1,2 @@
1
+ ._4t3i1wug{height:auto}
2
+ ._p12f1osq{max-width:100%}
@@ -1,33 +1,23 @@
1
+ /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
2
  "use strict";
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
6
  Object.defineProperty(exports, "__esModule", {
5
7
  value: true
6
8
  });
7
9
  exports.default = Image;
10
+ require("./index.compiled.css");
11
+ var _react = _interopRequireWildcard(require("react"));
12
+ var React = _react;
13
+ var _runtime = require("@compiled/react/runtime");
8
14
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
15
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
- var _react = require("react");
11
- var _react2 = require("@emotion/react");
12
16
  var _appProvider = require("@atlaskit/app-provider");
13
17
  var _tokens = require("@atlaskit/tokens");
14
- var _excluded = ["src", "srcDark", "alt", "testId"];
15
- /**
16
- * @jsxRuntime classic
17
- * @jsx jsx
18
- */
19
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
20
- var baseImageStyles = (0, _react2.css)({
21
- maxWidth: '100%',
22
- height: 'auto'
23
- });
24
- var themedImageStyles = (0, _react2.css)({
25
- content: "url(var(--img-source))",
26
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
27
- 'html[data-color-mode=dark] &': {
28
- content: "var(--img-source-dark)"
29
- }
30
- });
18
+ var _excluded = ["src", "srcDark", "alt", "testId", "className"];
19
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
20
+ var baseImageStyles = null;
31
21
 
32
22
  /**
33
23
  * __Image__
@@ -43,6 +33,7 @@ function Image(_ref) {
43
33
  srcDark = _ref.srcDark,
44
34
  alt = _ref.alt,
45
35
  testId = _ref.testId,
36
+ className = _ref.className,
46
37
  props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
47
38
  var imgRef = (0, _react.useRef)(null);
48
39
  var providedColorMode = (0, _appProvider.UNSAFE_useColorModeForMigration)();
@@ -59,17 +50,12 @@ function Image(_ref) {
59
50
  imgRef.current.src = src;
60
51
  }
61
52
  }, [src, srcDark, colorMode]);
62
- return (0, _react2.jsx)("img", (0, _extends2.default)({
53
+ return /*#__PURE__*/React.createElement("img", (0, _extends2.default)({
63
54
  alt: alt,
64
55
  "data-testid": testId,
65
- src: src
66
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
67
- ,
68
- style: {
69
- '--img-source': src,
70
- '--img-source-dark': srcDark || src
71
- },
72
- css: [baseImageStyles, themedImageStyles],
56
+ src: src,
57
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
58
+ className: (0, _runtime.ax)(["_p12f1osq _4t3i1wug", className]),
73
59
  ref: imgRef
74
60
  // The spread operator is necessary since the component can accept all the props of an `img` element.
75
61
  // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
@@ -0,0 +1,2 @@
1
+ ._4t3i1wug{height:auto}
2
+ ._p12f1osq{max-width:100%}
@@ -1,25 +1,12 @@
1
+ /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
2
  import _extends from "@babel/runtime/helpers/extends";
2
- /**
3
- * @jsxRuntime classic
4
- * @jsx jsx
5
- */
3
+ import "./index.compiled.css";
4
+ import * as React from 'react';
5
+ import { ax, ix } from "@compiled/react/runtime";
6
6
  import { useEffect, useRef } from 'react';
7
-
8
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
- import { css, jsx } from '@emotion/react';
10
7
  import { UNSAFE_useColorModeForMigration } from '@atlaskit/app-provider';
11
8
  import { useThemeObserver } from '@atlaskit/tokens';
12
- const baseImageStyles = css({
13
- maxWidth: '100%',
14
- height: 'auto'
15
- });
16
- const themedImageStyles = css({
17
- content: `url(var(--img-source))`,
18
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
19
- 'html[data-color-mode=dark] &': {
20
- content: `var(--img-source-dark)`
21
- }
22
- });
9
+ const baseImageStyles = null;
23
10
 
24
11
  /**
25
12
  * __Image__
@@ -35,6 +22,7 @@ export default function Image({
35
22
  srcDark,
36
23
  alt,
37
24
  testId,
25
+ className,
38
26
  ...props
39
27
  }) {
40
28
  const imgRef = useRef(null);
@@ -53,17 +41,12 @@ export default function Image({
53
41
  imgRef.current.src = src;
54
42
  }
55
43
  }, [src, srcDark, colorMode]);
56
- return jsx("img", _extends({
44
+ return /*#__PURE__*/React.createElement("img", _extends({
57
45
  alt: alt,
58
46
  "data-testid": testId,
59
- src: src
60
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
61
- ,
62
- style: {
63
- '--img-source': src,
64
- '--img-source-dark': srcDark || src
65
- },
66
- css: [baseImageStyles, themedImageStyles],
47
+ src: src,
48
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
49
+ className: ax(["_p12f1osq _4t3i1wug", className]),
67
50
  ref: imgRef
68
51
  // The spread operator is necessary since the component can accept all the props of an `img` element.
69
52
  // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
@@ -0,0 +1,2 @@
1
+ ._4t3i1wug{height:auto}
2
+ ._p12f1osq{max-width:100%}
@@ -1,27 +1,14 @@
1
+ /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
2
  import _extends from "@babel/runtime/helpers/extends";
2
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["src", "srcDark", "alt", "testId"];
4
- /**
5
- * @jsxRuntime classic
6
- * @jsx jsx
7
- */
4
+ var _excluded = ["src", "srcDark", "alt", "testId", "className"];
5
+ import "./index.compiled.css";
6
+ import * as React from 'react';
7
+ import { ax, ix } from "@compiled/react/runtime";
8
8
  import { useEffect, useRef } from 'react';
9
-
10
- // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
11
- import { css, jsx } from '@emotion/react';
12
9
  import { UNSAFE_useColorModeForMigration } from '@atlaskit/app-provider';
13
10
  import { useThemeObserver } from '@atlaskit/tokens';
14
- var baseImageStyles = css({
15
- maxWidth: '100%',
16
- height: 'auto'
17
- });
18
- var themedImageStyles = css({
19
- content: "url(var(--img-source))",
20
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
21
- 'html[data-color-mode=dark] &': {
22
- content: "var(--img-source-dark)"
23
- }
24
- });
11
+ var baseImageStyles = null;
25
12
 
26
13
  /**
27
14
  * __Image__
@@ -37,6 +24,7 @@ export default function Image(_ref) {
37
24
  srcDark = _ref.srcDark,
38
25
  alt = _ref.alt,
39
26
  testId = _ref.testId,
27
+ className = _ref.className,
40
28
  props = _objectWithoutProperties(_ref, _excluded);
41
29
  var imgRef = useRef(null);
42
30
  var providedColorMode = UNSAFE_useColorModeForMigration();
@@ -53,17 +41,12 @@ export default function Image(_ref) {
53
41
  imgRef.current.src = src;
54
42
  }
55
43
  }, [src, srcDark, colorMode]);
56
- return jsx("img", _extends({
44
+ return /*#__PURE__*/React.createElement("img", _extends({
57
45
  alt: alt,
58
46
  "data-testid": testId,
59
- src: src
60
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
61
- ,
62
- style: {
63
- '--img-source': src,
64
- '--img-source-dark': srcDark || src
65
- },
66
- css: [baseImageStyles, themedImageStyles],
47
+ src: src,
48
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
49
+ className: ax(["_p12f1osq _4t3i1wug", className]),
67
50
  ref: imgRef
68
51
  // The spread operator is necessary since the component can accept all the props of an `img` element.
69
52
  // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- import { jsx } from '@emotion/react';
3
2
  interface ImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {
4
3
  /**
5
4
  * Image URL to use for dark mode. This overrides `src` when the user
@@ -22,5 +21,5 @@ interface ImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {
22
21
  * - [Code](https://atlassian.design/components/image/code)
23
22
  * - [Usage](https://atlassian.design/components/image/usage)
24
23
  */
25
- export default function Image({ src, srcDark, alt, testId, ...props }: ImageProps): jsx.JSX.Element;
24
+ export default function Image({ src, srcDark, alt, testId, className, ...props }: ImageProps): JSX.Element;
26
25
  export {};
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- import { jsx } from '@emotion/react';
3
2
  interface ImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {
4
3
  /**
5
4
  * Image URL to use for dark mode. This overrides `src` when the user
@@ -22,5 +21,5 @@ interface ImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {
22
21
  * - [Code](https://atlassian.design/components/image/code)
23
22
  * - [Usage](https://atlassian.design/components/image/usage)
24
23
  */
25
- export default function Image({ src, srcDark, alt, testId, ...props }: ImageProps): jsx.JSX.Element;
24
+ export default function Image({ src, srcDark, alt, testId, className, ...props }: ImageProps): JSX.Element;
26
25
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/image",
3
- "version": "2.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "An image that changes in light or dark themes.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -28,24 +28,24 @@
28
28
  "runReact18": true
29
29
  },
30
30
  "dependencies": {
31
- "@atlaskit/app-provider": "2.0.0",
32
- "@atlaskit/tokens": "^4.0.0",
31
+ "@atlaskit/app-provider": "^2.2.0",
32
+ "@atlaskit/tokens": "^5.0.0",
33
33
  "@babel/runtime": "^7.0.0",
34
- "@emotion/react": "^11.7.1"
34
+ "@compiled/react": "^0.18.3"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "react": "^18.2.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@af/accessibility-testing": "*",
41
- "@af/integration-testing": "*",
42
- "@af/visual-regression": "*",
43
- "@atlaskit/docs": "*",
40
+ "@af/accessibility-testing": "workspace:^",
41
+ "@af/integration-testing": "workspace:^",
42
+ "@af/visual-regression": "workspace:^",
43
+ "@atlaskit/docs": "^10.0.0",
44
44
  "@atlaskit/ds-lib": "^4.0.0",
45
- "@atlaskit/link": "*",
46
- "@atlaskit/primitives": "^14.0.0",
47
- "@atlaskit/section-message": "*",
48
- "@atlaskit/ssr": "*",
45
+ "@atlaskit/link": "^3.2.0",
46
+ "@atlaskit/primitives": "^14.8.0",
47
+ "@atlaskit/section-message": "^8.2.0",
48
+ "@atlassian/ssr-tests": "^0.2.0",
49
49
  "@testing-library/react": "^13.4.0",
50
50
  "react-dom": "^18.2.0",
51
51
  "typescript": "~5.4.2"