@atlaskit/media-picker 62.0.0 → 63.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,23 @@
1
1
  # @atlaskit/media-picker
2
2
 
3
+ ## 63.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [`e9de546cfc7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e9de546cfc7) - Migrate to emotion from styled-components
8
+
9
+ ### Minor Changes
10
+
11
+ - [`bfde909c9b4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bfde909c9b4) - Add new feature flag mediaUploadApiV2
12
+ - [`35e43fcc798`](https://bitbucket.org/atlassian/atlassian-frontend/commits/35e43fcc798) - Add ufo feature flag logging
13
+
14
+ ### Patch Changes
15
+
16
+ - [`c0f85687ea0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c0f85687ea0) - Enabled UFO logger for all examples for Media-Picker
17
+ - [`c2ede50a80a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c2ede50a80a) - Add media region and environment returned from media API response into failed analytic events.
18
+ - [`19899f3e100`](https://bitbucket.org/atlassian/atlassian-frontend/commits/19899f3e100) - Make emotion as dev dependency instead peer dependency
19
+ - Updated dependencies
20
+
3
21
  ## 62.0.0
4
22
 
5
23
  ### Major Changes
@@ -182,13 +182,6 @@ exports.BrowserBase = BrowserBase;
182
182
  config: defaultConfig
183
183
  });
184
184
  var Browser = (0, _mediaCommon.withMediaAnalyticsContext)((0, _analytics.getPackageAttributes)(COMPONENT_NAME), {
185
- filterFeatureFlags: (0, _mediaCommon.filterFeatureFlagNames)({
186
- newCardExperience: true,
187
- captions: false,
188
- timestampOnVideo: false,
189
- observedWidth: false,
190
- mediaInline: false,
191
- folderUploads: true
192
- })
185
+ filterFeatureFlags: _analytics.LOGGED_FEATURE_FLAGS
193
186
  })((0, _analyticsNext.withAnalyticsEvents)()(BrowserBase));
194
187
  exports.Browser = Browser;
@@ -200,13 +200,6 @@ exports.ClipboardBase = ClipboardBase;
200
200
  config: defaultConfig
201
201
  });
202
202
  var Clipboard = (0, _mediaCommon.withMediaAnalyticsContext)((0, _analytics.getPackageAttributes)(COMPONENT_NAME), {
203
- filterFeatureFlags: (0, _mediaCommon.filterFeatureFlagNames)({
204
- newCardExperience: true,
205
- captions: false,
206
- timestampOnVideo: false,
207
- observedWidth: false,
208
- mediaInline: false,
209
- folderUploads: true
210
- })
203
+ filterFeatureFlags: _analytics.LOGGED_FEATURE_FLAGS
211
204
  })((0, _analyticsNext.withAnalyticsEvents)()(ClipboardBase));
212
205
  exports.Clipboard = Clipboard;
@@ -382,13 +382,6 @@ var DropzoneBase = /*#__PURE__*/function (_LocalUploadComponent) {
382
382
 
383
383
  exports.DropzoneBase = DropzoneBase;
384
384
  var Dropzone = (0, _mediaCommon.withMediaAnalyticsContext)((0, _analytics.getPackageAttributes)(COMPONENT_NAME), {
385
- filterFeatureFlags: (0, _mediaCommon.filterFeatureFlagNames)({
386
- newCardExperience: true,
387
- captions: false,
388
- timestampOnVideo: false,
389
- observedWidth: false,
390
- mediaInline: false,
391
- folderUploads: true
392
- })
385
+ filterFeatureFlags: _analytics.LOGGED_FEATURE_FLAGS
393
386
  })((0, _analyticsNext.withAnalyticsEvents)()(DropzoneBase));
394
387
  exports.Dropzone = Dropzone;
@@ -3,13 +3,30 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.LOGGED_FEATURE_FLAG_KEYS = exports.LOGGED_FEATURE_FLAGS = void 0;
6
7
  exports.getPackageAttributes = getPackageAttributes;
7
8
  exports.getRequestMetadata = getRequestMetadata;
8
9
 
9
10
  var _mediaClient = require("@atlaskit/media-client");
10
11
 
12
+ var _mediaCommon = require("@atlaskit/media-common");
13
+
11
14
  var _version = require("../version.json");
12
15
 
16
+ var relevantFlags = {
17
+ newCardExperience: true,
18
+ captions: false,
19
+ timestampOnVideo: false,
20
+ observedWidth: false,
21
+ mediaInline: false,
22
+ folderUploads: true,
23
+ mediaUploadApiV2: true
24
+ };
25
+ var LOGGED_FEATURE_FLAGS = (0, _mediaCommon.filterFeatureFlagNames)(relevantFlags);
26
+ exports.LOGGED_FEATURE_FLAGS = LOGGED_FEATURE_FLAGS;
27
+ var LOGGED_FEATURE_FLAG_KEYS = (0, _mediaCommon.filterFeatureFlagKeysAllProducts)(relevantFlags);
28
+ exports.LOGGED_FEATURE_FLAG_KEYS = LOGGED_FEATURE_FLAG_KEYS;
29
+
13
30
  function getPackageAttributes(componentName) {
14
31
  return {
15
32
  packageName: _version.name,
@@ -13,6 +13,8 @@ var _ufo = require("@atlaskit/ufo");
13
13
 
14
14
  var _mediaClient = require("@atlaskit/media-client");
15
15
 
16
+ var _analytics = require("./analytics");
17
+
16
18
  var _version = require("../version.json");
17
19
 
18
20
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -28,7 +30,8 @@ var initExperience = function initExperience(id, componentName) {
28
30
  component: "media-picker-".concat(componentName)
29
31
  },
30
32
  type: _ufo.ExperienceTypes.Experience,
31
- performanceType: _ufo.ExperiencePerformanceTypes.InlineResult
33
+ performanceType: _ufo.ExperiencePerformanceTypes.InlineResult,
34
+ featureFlags: _analytics.LOGGED_FEATURE_FLAG_KEYS
32
35
  };
33
36
  ufoExperience = new _ufo.ConcurrentExperience('media-upload', inlineExperience);
34
37
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/media-picker",
3
- "version": "62.0.0"
3
+ "version": "63.0.0"
4
4
  }
@@ -1,10 +1,10 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
3
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
4
- import { withMediaAnalyticsContext, filterFeatureFlagNames } from '@atlaskit/media-common';
4
+ import { withMediaAnalyticsContext } from '@atlaskit/media-common';
5
5
  import isValidId from 'uuid-validate';
6
6
  import { LocalUploadComponentReact } from '../localUploadReact';
7
- import { getPackageAttributes } from '../../util/analytics';
7
+ import { getPackageAttributes, LOGGED_FEATURE_FLAGS } from '../../util/analytics';
8
8
  const defaultConfig = {
9
9
  uploadParams: {}
10
10
  };
@@ -153,12 +153,5 @@ _defineProperty(BrowserBase, "defaultProps", {
153
153
  });
154
154
 
155
155
  export const Browser = withMediaAnalyticsContext(getPackageAttributes(COMPONENT_NAME), {
156
- filterFeatureFlags: filterFeatureFlagNames({
157
- newCardExperience: true,
158
- captions: false,
159
- timestampOnVideo: false,
160
- observedWidth: false,
161
- mediaInline: false,
162
- folderUploads: true
163
- })
156
+ filterFeatureFlags: LOGGED_FEATURE_FLAGS
164
157
  })(withAnalyticsEvents()(BrowserBase));
@@ -1,9 +1,9 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
3
- import { ANALYTICS_MEDIA_CHANNEL, withMediaAnalyticsContext, filterFeatureFlagNames } from '@atlaskit/media-common';
3
+ import { ANALYTICS_MEDIA_CHANNEL, withMediaAnalyticsContext } from '@atlaskit/media-common';
4
4
  import { LocalUploadComponentReact } from '../localUploadReact';
5
5
  import { LocalFileSource } from '../../service/types';
6
- import { getPackageAttributes } from '../../util/analytics';
6
+ import { getPackageAttributes, LOGGED_FEATURE_FLAGS } from '../../util/analytics';
7
7
  import { appendTimestamp } from '../../util/appendTimestamp';
8
8
  export const getFilesFromClipboard = files => {
9
9
  return Array.from(files).map(file => {
@@ -147,12 +147,5 @@ _defineProperty(ClipboardBase, "defaultProps", {
147
147
  });
148
148
 
149
149
  export const Clipboard = withMediaAnalyticsContext(getPackageAttributes(COMPONENT_NAME), {
150
- filterFeatureFlags: filterFeatureFlagNames({
151
- newCardExperience: true,
152
- captions: false,
153
- timestampOnVideo: false,
154
- observedWidth: false,
155
- mediaInline: false,
156
- folderUploads: true
157
- })
150
+ filterFeatureFlags: LOGGED_FEATURE_FLAGS
158
151
  })(withAnalyticsEvents()(ClipboardBase));
@@ -1,10 +1,10 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
3
- import { ANALYTICS_MEDIA_CHANNEL, getMediaFeatureFlag, withMediaAnalyticsContext, filterFeatureFlagNames } from '@atlaskit/media-common';
3
+ import { ANALYTICS_MEDIA_CHANNEL, getMediaFeatureFlag, withMediaAnalyticsContext } from '@atlaskit/media-common';
4
4
  import { isWebkitSupported } from '@atlaskit/media-ui/browser';
5
5
  import { getFilesFromItems, getFilesFromFileSystemEntries } from 'flat-files';
6
6
  import { LocalUploadComponentReact } from '../localUploadReact';
7
- import { getPackageAttributes } from '../../util/analytics';
7
+ import { getPackageAttributes, LOGGED_FEATURE_FLAGS } from '../../util/analytics';
8
8
 
9
9
  function dragContainsFiles(event) {
10
10
  if (!event.dataTransfer) {
@@ -281,12 +281,5 @@ export class DropzoneBase extends LocalUploadComponentReact {
281
281
 
282
282
  }
283
283
  export const Dropzone = withMediaAnalyticsContext(getPackageAttributes(COMPONENT_NAME), {
284
- filterFeatureFlags: filterFeatureFlagNames({
285
- newCardExperience: true,
286
- captions: false,
287
- timestampOnVideo: false,
288
- observedWidth: false,
289
- mediaInline: false,
290
- folderUploads: true
291
- })
284
+ filterFeatureFlags: LOGGED_FEATURE_FLAGS
292
285
  })(withAnalyticsEvents()(DropzoneBase));
@@ -1,6 +1,18 @@
1
1
  import { isRequestError } from '@atlaskit/media-client';
2
+ import { filterFeatureFlagKeysAllProducts, filterFeatureFlagNames } from '@atlaskit/media-common';
2
3
  import { name as packageName, version as packageVersion } from '../version.json'; // Component name will be prefixed with "media-picker-" in logs. Check ufoExperiences in utils files
3
4
 
5
+ const relevantFlags = {
6
+ newCardExperience: true,
7
+ captions: false,
8
+ timestampOnVideo: false,
9
+ observedWidth: false,
10
+ mediaInline: false,
11
+ folderUploads: true,
12
+ mediaUploadApiV2: true
13
+ };
14
+ export const LOGGED_FEATURE_FLAGS = filterFeatureFlagNames(relevantFlags);
15
+ export const LOGGED_FEATURE_FLAG_KEYS = filterFeatureFlagKeysAllProducts(relevantFlags);
4
16
  export function getPackageAttributes(componentName) {
5
17
  return {
6
18
  packageName,
@@ -1,5 +1,6 @@
1
1
  import { ConcurrentExperience, ExperiencePerformanceTypes, ExperienceTypes } from '@atlaskit/ufo';
2
2
  import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
3
+ import { LOGGED_FEATURE_FLAG_KEYS } from './analytics';
3
4
  import { name as packageName, version as packageVersion } from '../version.json';
4
5
  let ufoExperience;
5
6
 
@@ -10,7 +11,8 @@ const initExperience = (id, componentName) => {
10
11
  component: `media-picker-${componentName}`
11
12
  },
12
13
  type: ExperienceTypes.Experience,
13
- performanceType: ExperiencePerformanceTypes.InlineResult
14
+ performanceType: ExperiencePerformanceTypes.InlineResult,
15
+ featureFlags: LOGGED_FEATURE_FLAG_KEYS
14
16
  };
15
17
  ufoExperience = new ConcurrentExperience('media-upload', inlineExperience);
16
18
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/media-picker",
3
- "version": "62.0.0"
3
+ "version": "63.0.0"
4
4
  }
@@ -12,10 +12,10 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
12
12
 
13
13
  import React from 'react';
14
14
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
15
- import { withMediaAnalyticsContext, filterFeatureFlagNames } from '@atlaskit/media-common';
15
+ import { withMediaAnalyticsContext } from '@atlaskit/media-common';
16
16
  import isValidId from 'uuid-validate';
17
17
  import { LocalUploadComponentReact } from '../localUploadReact';
18
- import { getPackageAttributes } from '../../util/analytics';
18
+ import { getPackageAttributes, LOGGED_FEATURE_FLAGS } from '../../util/analytics';
19
19
  var defaultConfig = {
20
20
  uploadParams: {}
21
21
  };
@@ -166,12 +166,5 @@ _defineProperty(BrowserBase, "defaultProps", {
166
166
  });
167
167
 
168
168
  export var Browser = withMediaAnalyticsContext(getPackageAttributes(COMPONENT_NAME), {
169
- filterFeatureFlags: filterFeatureFlagNames({
170
- newCardExperience: true,
171
- captions: false,
172
- timestampOnVideo: false,
173
- observedWidth: false,
174
- mediaInline: false,
175
- folderUploads: true
176
- })
169
+ filterFeatureFlags: LOGGED_FEATURE_FLAGS
177
170
  })(withAnalyticsEvents()(BrowserBase));
@@ -11,10 +11,10 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
11
11
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
12
 
13
13
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
14
- import { ANALYTICS_MEDIA_CHANNEL, withMediaAnalyticsContext, filterFeatureFlagNames } from '@atlaskit/media-common';
14
+ import { ANALYTICS_MEDIA_CHANNEL, withMediaAnalyticsContext } from '@atlaskit/media-common';
15
15
  import { LocalUploadComponentReact } from '../localUploadReact';
16
16
  import { LocalFileSource } from '../../service/types';
17
- import { getPackageAttributes } from '../../util/analytics';
17
+ import { getPackageAttributes, LOGGED_FEATURE_FLAGS } from '../../util/analytics';
18
18
  import { appendTimestamp } from '../../util/appendTimestamp';
19
19
  export var getFilesFromClipboard = function getFilesFromClipboard(files) {
20
20
  return Array.from(files).map(function (file) {
@@ -184,12 +184,5 @@ _defineProperty(ClipboardBase, "defaultProps", {
184
184
  });
185
185
 
186
186
  export var Clipboard = withMediaAnalyticsContext(getPackageAttributes(COMPONENT_NAME), {
187
- filterFeatureFlags: filterFeatureFlagNames({
188
- newCardExperience: true,
189
- captions: false,
190
- timestampOnVideo: false,
191
- observedWidth: false,
192
- mediaInline: false,
193
- folderUploads: true
194
- })
187
+ filterFeatureFlags: LOGGED_FEATURE_FLAGS
195
188
  })(withAnalyticsEvents()(ClipboardBase));
@@ -13,11 +13,11 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
13
13
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
14
14
 
15
15
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
16
- import { ANALYTICS_MEDIA_CHANNEL, getMediaFeatureFlag, withMediaAnalyticsContext, filterFeatureFlagNames } from '@atlaskit/media-common';
16
+ import { ANALYTICS_MEDIA_CHANNEL, getMediaFeatureFlag, withMediaAnalyticsContext } from '@atlaskit/media-common';
17
17
  import { isWebkitSupported } from '@atlaskit/media-ui/browser';
18
18
  import { getFilesFromItems, getFilesFromFileSystemEntries } from 'flat-files';
19
19
  import { LocalUploadComponentReact } from '../localUploadReact';
20
- import { getPackageAttributes } from '../../util/analytics';
20
+ import { getPackageAttributes, LOGGED_FEATURE_FLAGS } from '../../util/analytics';
21
21
 
22
22
  function dragContainsFiles(event) {
23
23
  if (!event.dataTransfer) {
@@ -372,12 +372,5 @@ export var DropzoneBase = /*#__PURE__*/function (_LocalUploadComponent) {
372
372
  return DropzoneBase;
373
373
  }(LocalUploadComponentReact);
374
374
  export var Dropzone = withMediaAnalyticsContext(getPackageAttributes(COMPONENT_NAME), {
375
- filterFeatureFlags: filterFeatureFlagNames({
376
- newCardExperience: true,
377
- captions: false,
378
- timestampOnVideo: false,
379
- observedWidth: false,
380
- mediaInline: false,
381
- folderUploads: true
382
- })
375
+ filterFeatureFlags: LOGGED_FEATURE_FLAGS
383
376
  })(withAnalyticsEvents()(DropzoneBase));
@@ -1,6 +1,18 @@
1
1
  import { isRequestError } from '@atlaskit/media-client';
2
+ import { filterFeatureFlagKeysAllProducts, filterFeatureFlagNames } from '@atlaskit/media-common';
2
3
  import { name as packageName, version as packageVersion } from '../version.json'; // Component name will be prefixed with "media-picker-" in logs. Check ufoExperiences in utils files
3
4
 
5
+ var relevantFlags = {
6
+ newCardExperience: true,
7
+ captions: false,
8
+ timestampOnVideo: false,
9
+ observedWidth: false,
10
+ mediaInline: false,
11
+ folderUploads: true,
12
+ mediaUploadApiV2: true
13
+ };
14
+ export var LOGGED_FEATURE_FLAGS = filterFeatureFlagNames(relevantFlags);
15
+ export var LOGGED_FEATURE_FLAG_KEYS = filterFeatureFlagKeysAllProducts(relevantFlags);
4
16
  export function getPackageAttributes(componentName) {
5
17
  return {
6
18
  packageName: packageName,
@@ -6,6 +6,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
6
6
 
7
7
  import { ConcurrentExperience, ExperiencePerformanceTypes, ExperienceTypes } from '@atlaskit/ufo';
8
8
  import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
9
+ import { LOGGED_FEATURE_FLAG_KEYS } from './analytics';
9
10
  import { name as packageName, version as packageVersion } from '../version.json';
10
11
  var ufoExperience;
11
12
 
@@ -16,7 +17,8 @@ var initExperience = function initExperience(id, componentName) {
16
17
  component: "media-picker-".concat(componentName)
17
18
  },
18
19
  type: ExperienceTypes.Experience,
19
- performanceType: ExperiencePerformanceTypes.InlineResult
20
+ performanceType: ExperiencePerformanceTypes.InlineResult,
21
+ featureFlags: LOGGED_FEATURE_FLAG_KEYS
20
22
  };
21
23
  ufoExperience = new ConcurrentExperience('media-upload', inlineExperience);
22
24
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/media-picker",
3
- "version": "62.0.0"
3
+ "version": "63.0.0"
4
4
  }
@@ -1,5 +1,7 @@
1
1
  import { RequestMetadata } from '@atlaskit/media-client';
2
2
  import { PackageAttributes } from '@atlaskit/media-common';
3
3
  export declare type ComponentName = 'browser' | 'clipboard' | 'dropzone';
4
+ export declare const LOGGED_FEATURE_FLAGS: (keyof import("@atlaskit/media-common").MediaFeatureFlags)[];
5
+ export declare const LOGGED_FEATURE_FLAG_KEYS: string[];
4
6
  export declare function getPackageAttributes(componentName: ComponentName): PackageAttributes;
5
7
  export declare function getRequestMetadata(error?: Error): RequestMetadata | undefined;
@@ -0,0 +1,12 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { enableMediaUfoLogger } from '@atlaskit/media-test-helpers';
3
+ import { payloadPublisher } from '@atlassian/ufo';
4
+
5
+ type Props = {
6
+ children: ReactNode;
7
+ };
8
+
9
+ export const UfoLoggerWrapper: React.FC<Props> = ({ children }) => {
10
+ enableMediaUfoLogger(payloadPublisher);
11
+ return <>{children}</>;
12
+ };
@@ -1,15 +1,17 @@
1
- import styled from 'styled-components';
2
- export interface DropzoneContainerProps {
1
+ import { css } from '@emotion/react';
2
+ import { PastedImageStyleType } from './stylesWrapper';
3
+
4
+ interface DropzoneContainerProps {
3
5
  isActive: boolean;
4
6
  }
5
7
 
6
- export const PopupContainer = styled.div`
8
+ export const popupContainerStyles = css`
7
9
  display: flex;
8
10
  flex-direction: column;
9
11
  overflow: scroll;
10
12
  `;
11
13
 
12
- export const PopupHeader = styled.div`
14
+ export const popupHeaderStyles = css`
13
15
  border-bottom: 1px solid #ccc;
14
16
  margin-bottom: 15px;
15
17
  display: flex;
@@ -21,12 +23,12 @@ export const PopupHeader = styled.div`
21
23
  }
22
24
  `;
23
25
 
24
- export const PreviewImageWrapper = styled.div`
26
+ export const previewImageWrapperStyles = css`
25
27
  position: relative;
26
28
  margin-right: 15px;
27
29
  `;
28
30
 
29
- export const InfoWrapper = styled.pre`
31
+ export const infoWrapperStyles = css`
30
32
  position: absolute;
31
33
  width: 160px;
32
34
  color: black;
@@ -36,30 +38,25 @@ export const InfoWrapper = styled.pre`
36
38
  text-align: center;
37
39
  `;
38
40
 
39
- export const DropzoneContainer = styled.div`
41
+ export const dropzoneContainerStyles = ({
42
+ isActive,
43
+ }: DropzoneContainerProps) => css`
40
44
  width: 600px;
41
45
  min-height: 500px;
42
46
  border: 1px dashed transparent;
43
-
44
- ${(props: DropzoneContainerProps) =>
45
- props.isActive
46
- ? `
47
- border-color: gray;
48
- `
49
- : ''};
47
+ ${isActive ? `border-color: gray;` : ''}
50
48
  `;
51
49
 
52
- export const DropzoneConfigOptions = styled.div``;
53
- export const DropzoneRoot = styled.div`
50
+ export const dropzoneRootStyles = css`
54
51
  display: flex;
55
52
  `;
56
53
 
57
- export const DropzoneContentWrapper = styled.div`
54
+ export const dropzoneContentWrapperStyles = css`
58
55
  display: flex;
59
56
  min-height: 200px;
60
57
  `;
61
58
 
62
- export const PreviewsWrapper = styled.div`
59
+ export const previewsWrapperStyles = css`
63
60
  display: flex;
64
61
  flex-direction: column;
65
62
  overflow: visible;
@@ -67,17 +64,17 @@ export const PreviewsWrapper = styled.div`
67
64
  margin-bottom: 20px;
68
65
  `;
69
66
 
70
- export const PreviewsTitle = styled.h1`
67
+ export const previewsTitleStyles = css`
71
68
  width: 100%;
72
69
  `;
73
70
 
74
- export const UploadPreviewsFlexRow = styled.div`
71
+ export const uploadPreviewsFlexRowStyles = css`
75
72
  display: flex;
76
73
  flex-direction: row;
77
74
  flex-wrap: wrap;
78
75
  `;
79
76
 
80
- export const DropzoneItemsInfo = styled.div`
77
+ export const dropzoneItemsInfoStyles = css`
81
78
  flex: 1;
82
79
  min-width: 600px;
83
80
  display: flex;
@@ -85,19 +82,20 @@ export const DropzoneItemsInfo = styled.div`
85
82
  flex-direction: column;
86
83
  `;
87
84
 
88
- export interface ClipboardContainerProps {
85
+ interface ClipboardContainerProps {
89
86
  isWindowFocused: boolean;
90
87
  }
91
88
 
92
- export const ClipboardContainer = styled.div`
89
+ export const clipboardContainerStyles = ({
90
+ isWindowFocused,
91
+ }: ClipboardContainerProps) => css`
93
92
  padding: 10px;
94
93
  min-height: 400px;
95
94
 
96
- border: ${({ isWindowFocused }: ClipboardContainerProps) =>
97
- isWindowFocused ? `1px dashed gray` : `1px dashed transparent`};
95
+ border: ${isWindowFocused ? `1px dashed gray` : `1px dashed transparent`};
98
96
  `;
99
97
 
100
- export const InfoContainer = styled.div`
98
+ export const infoContainerStyles = css`
101
99
  position: absolute;
102
100
  top: 0;
103
101
  left: 0;
@@ -122,6 +120,7 @@ export const InfoContainer = styled.div`
122
120
  }
123
121
  `;
124
122
 
125
- export const PastedImage = styled.img`
126
- width: 100%;
123
+ export const pastedImageStyles = (style: PastedImageStyleType) => css`
124
+ width: ${style.width ? `${style.width}px` : '100%'};
125
+ ${style.height ? `height: ${style.height}px` : ''};
127
126
  `;
@@ -0,0 +1,105 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { ReactNode, forwardRef } from 'react';
4
+
5
+ import {
6
+ clipboardContainerStyles,
7
+ dropzoneContainerStyles,
8
+ dropzoneContentWrapperStyles,
9
+ dropzoneItemsInfoStyles,
10
+ infoContainerStyles,
11
+ infoWrapperStyles,
12
+ pastedImageStyles,
13
+ popupContainerStyles,
14
+ popupHeaderStyles,
15
+ previewImageWrapperStyles,
16
+ previewsTitleStyles,
17
+ previewsWrapperStyles,
18
+ uploadPreviewsFlexRowStyles,
19
+ } from './styles';
20
+
21
+ export const PopupContainer = ({ children }: { children: ReactNode }) => {
22
+ return <div css={popupContainerStyles}>{children}</div>;
23
+ };
24
+
25
+ export const PopupHeader = ({ children }: { children: ReactNode }) => {
26
+ return <div css={popupHeaderStyles}>{children}</div>;
27
+ };
28
+
29
+ export const PreviewImageWrapper = ({ children }: { children: ReactNode }) => {
30
+ return <div css={previewImageWrapperStyles}>{children}</div>;
31
+ };
32
+
33
+ export const InfoWrapper = ({ children }: { children: ReactNode }) => {
34
+ return <pre css={infoWrapperStyles}>{children}</pre>;
35
+ };
36
+
37
+ export const DropzoneContainer = forwardRef(
38
+ ({ isActive }: { isActive: boolean }, ref) => {
39
+ return (
40
+ <div
41
+ css={dropzoneContainerStyles({ isActive })}
42
+ ref={ref as React.RefObject<HTMLDivElement>}
43
+ />
44
+ );
45
+ },
46
+ );
47
+
48
+ export const DropzoneContentWrapper = ({
49
+ children,
50
+ }: {
51
+ children: ReactNode;
52
+ }) => {
53
+ return <div css={dropzoneContentWrapperStyles}>{children}</div>;
54
+ };
55
+
56
+ export const PreviewsWrapper = ({ children }: { children: ReactNode }) => {
57
+ return <div css={previewsWrapperStyles}>{children}</div>;
58
+ };
59
+
60
+ export const PreviewsTitle = ({ children }: { children: ReactNode }) => {
61
+ return <h1 css={previewsTitleStyles}>{children}</h1>;
62
+ };
63
+
64
+ export const UploadPreviewsFlexRow = ({
65
+ children,
66
+ }: {
67
+ children: ReactNode;
68
+ }) => {
69
+ return <div css={uploadPreviewsFlexRowStyles}>{children}</div>;
70
+ };
71
+
72
+ export const DropzoneItemsInfo = ({ children }: { children: ReactNode }) => {
73
+ return <div css={dropzoneItemsInfoStyles}>{children}</div>;
74
+ };
75
+
76
+ export const ClipboardContainer = ({
77
+ isWindowFocused,
78
+ children,
79
+ }: {
80
+ isWindowFocused: boolean;
81
+ children: ReactNode;
82
+ }) => {
83
+ return (
84
+ <div css={clipboardContainerStyles({ isWindowFocused })}>{children}</div>
85
+ );
86
+ };
87
+
88
+ export const InfoContainer = ({ children }: { children: ReactNode }) => {
89
+ return <div css={infoContainerStyles}>{children}</div>;
90
+ };
91
+
92
+ export type PastedImageStyleType = {
93
+ width: number | string;
94
+ height: number | string;
95
+ };
96
+
97
+ type PastedImageProps = {
98
+ src: string;
99
+ title: string;
100
+ style: PastedImageStyleType;
101
+ };
102
+
103
+ export const PastedImage = ({ src, style, title }: PastedImageProps) => {
104
+ return <img src={src} title={title} css={pastedImageStyles(style)} />;
105
+ };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { PreviewImageWrapper, InfoWrapper } from './styled';
2
+ import { PreviewImageWrapper, InfoWrapper } from './stylesWrapper';
3
3
  import { PreviewData } from './types';
4
4
  import { Card } from '@atlaskit/media-card';
5
5
  import { FileIdentifier } from '@atlaskit/media-client';
@@ -9,7 +9,7 @@ import {
9
9
  PreviewsTitle,
10
10
  PreviewsWrapper,
11
11
  UploadPreviewsFlexRow,
12
- } from './styled';
12
+ } from './stylesWrapper';
13
13
  import { PreviewData } from './types';
14
14
 
15
15
  export interface PreviewsDataState {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-picker",
3
- "version": "62.0.0",
3
+ "version": "63.0.0",
4
4
  "description": "Library for handling file uploads",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -28,8 +28,8 @@
28
28
  "dependencies": {
29
29
  "@atlaskit/analytics-next": "^8.2.0",
30
30
  "@atlaskit/media-client": "^16.0.0",
31
- "@atlaskit/media-common": "^2.13.0",
32
- "@atlaskit/media-ui": "^22.0.0",
31
+ "@atlaskit/media-common": "^2.14.0",
32
+ "@atlaskit/media-ui": "^22.1.0",
33
33
  "@atlaskit/ufo": "^0.1.0",
34
34
  "@babel/runtime": "^7.0.0",
35
35
  "eventemitter2": "^4.1.0",
@@ -44,16 +44,15 @@
44
44
  "@atlaskit/media-core": "^33.0.0",
45
45
  "react": "^16.8.0",
46
46
  "react-dom": "^16.8.0",
47
- "react-intl-next": "npm:react-intl@^5.18.1",
48
- "styled-components": "^3.2.6"
47
+ "react-intl-next": "npm:react-intl@^5.18.1"
49
48
  },
50
49
  "devDependencies": {
51
50
  "@atlaskit/analytics-listeners": "^8.2.0",
52
51
  "@atlaskit/analytics-namespaced-context": "^6.4.0",
53
52
  "@atlaskit/button": "^16.3.0",
54
53
  "@atlaskit/docs": "*",
55
- "@atlaskit/dropdown-menu": "^11.1.0",
56
- "@atlaskit/media-card": "^73.6.0",
54
+ "@atlaskit/dropdown-menu": "^11.2.0",
55
+ "@atlaskit/media-card": "^73.7.0",
57
56
  "@atlaskit/media-core": "^33.0.0",
58
57
  "@atlaskit/media-test-helpers": "^30.0.0",
59
58
  "@atlaskit/spinner": "^15.0.0",
@@ -61,6 +60,7 @@
61
60
  "@atlaskit/toggle": "^12.4.0",
62
61
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
63
62
  "@atlassian/ufo": "^0.1.12",
63
+ "@emotion/react": "^11.7.1",
64
64
  "@types/enzyme": "^3.1.15",
65
65
  "@types/react": "^16.8.0",
66
66
  "enzyme": "^3.10.0",