@atlaskit/image 1.4.1 → 3.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 CHANGED
@@ -1,5 +1,42 @@
1
1
  # @atlaskit/image
2
2
 
3
+ ## 3.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#130672](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/130672)
8
+ [`c92554212ded6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c92554212ded6) -
9
+ Migrated from `@emotion/react` to `@compiled/react` in order to improve performance, align with
10
+ the rest of the Atlaskit techstack, and support React 18 Streaming SSR. Please note, in order to
11
+ use this version of `@atlaskit/image`, you will need to ensure that your bundler is configured to
12
+ handle `.css` imports correctly.
13
+
14
+ Removed `--img-source` and `--img-source-dark` CSS variables and `content` CSS property from
15
+ `<img>` since the `content` values were invalid before.
16
+
17
+ Most bundlers come with built-in support for `.css` imports, so you may not need to do anything.
18
+ If you are using a different bundler, please refer to the documentation for that bundler to
19
+ understand how to handle `.css` imports. For more information on the migration, please refer to
20
+ [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).
21
+
22
+ ## 2.0.0
23
+
24
+ ### Major Changes
25
+
26
+ - [#117363](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/117363)
27
+ [`10a0f7f6c2027`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/10a0f7f6c2027) -
28
+ This package's `peerDependencies` have been adjusted for `react` and/or `react-dom` to reflect the
29
+ status of only supporting React 18 going forward. No explicit breaking change to React support has
30
+ been made in this release, but this is to signify going forward, breaking changes for React 16 or
31
+ React 17 may come via non-major semver releases.
32
+
33
+ Please refer this community post for more details:
34
+ https://community.developer.atlassian.com/t/rfc-78-dropping-support-for-react-16-and-rendering-in-a-react-18-concurrent-root-in-jira-and-confluence/87026
35
+
36
+ ### Patch Changes
37
+
38
+ - Updated dependencies
39
+
3
40
  ## 1.4.1
4
41
 
5
42
  ### Patch Changes
@@ -0,0 +1,2 @@
1
+ ._4t3i1wug{height:auto}
2
+ ._p12f1osq{max-width:100%}
@@ -1,33 +1,24 @@
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 _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); }
20
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(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 && {}.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; }
21
+ var baseImageStyles = null;
31
22
 
32
23
  /**
33
24
  * __Image__
@@ -43,6 +34,7 @@ function Image(_ref) {
43
34
  srcDark = _ref.srcDark,
44
35
  alt = _ref.alt,
45
36
  testId = _ref.testId,
37
+ className = _ref.className,
46
38
  props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
47
39
  var imgRef = (0, _react.useRef)(null);
48
40
  var providedColorMode = (0, _appProvider.UNSAFE_useColorModeForMigration)();
@@ -59,17 +51,12 @@ function Image(_ref) {
59
51
  imgRef.current.src = src;
60
52
  }
61
53
  }, [src, srcDark, colorMode]);
62
- return (0, _react2.jsx)("img", (0, _extends2.default)({
54
+ return /*#__PURE__*/React.createElement("img", (0, _extends2.default)({
63
55
  alt: alt,
64
56
  "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],
57
+ src: src,
58
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
59
+ className: (0, _runtime.ax)(["_p12f1osq _4t3i1wug", className]),
73
60
  ref: imgRef
74
61
  // The spread operator is necessary since the component can accept all the props of an `img` element.
75
62
  // 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": "1.4.1",
3
+ "version": "3.0.0",
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": "1.8.1",
32
- "@atlaskit/tokens": "^3.3.0",
31
+ "@atlaskit/app-provider": "^2.0.0",
32
+ "@atlaskit/tokens": "^4.5.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
- "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
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": "*",
44
- "@atlaskit/ds-lib": "^3.5.0",
45
- "@atlaskit/link": "*",
46
- "@atlaskit/primitives": "^13.4.0",
47
- "@atlaskit/section-message": "*",
48
- "@atlaskit/ssr": "*",
40
+ "@af/accessibility-testing": "^2.0.0",
41
+ "@af/integration-testing": "^0.5.0",
42
+ "@af/visual-regression": "^1.3.0",
43
+ "@atlaskit/docs": "^10.0.0",
44
+ "@atlaskit/ds-lib": "^4.0.0",
45
+ "@atlaskit/link": "^3.0.0",
46
+ "@atlaskit/primitives": "^14.2.0",
47
+ "@atlaskit/section-message": "^8.2.0",
48
+ "@atlaskit/ssr": "^0.4.0",
49
49
  "@testing-library/react": "^13.4.0",
50
50
  "react-dom": "^18.2.0",
51
51
  "typescript": "~5.4.2"