@atlaskit/media-avatar-picker 23.1.1 → 23.2.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,28 @@
1
1
  # @atlaskit/media-avatar-picker
2
2
 
3
+ ## 23.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`cb2392f6d33`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cb2392f6d33) - Upgrade to TypeScript 4.2.4
8
+ - Updated dependencies
9
+
10
+ ## 23.2.0
11
+
12
+ ### Minor Changes
13
+
14
+ - [`306b52fd9ca`](https://bitbucket.org/atlassian/atlassian-frontend/commits/306b52fd9ca) - [ux] MEX-1467 - The optional paramater maxImageSize for the media-avatar-picker can be used to modify the max file size of the image
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+
20
+ ## 23.1.2
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies
25
+
3
26
  ## 23.1.1
4
27
 
5
28
  ### Patch Changes
@@ -303,13 +303,16 @@ var ImageNavigator = /*#__PURE__*/function (_Component) {
303
303
  }, {
304
304
  key: "validateFile",
305
305
  value: function validateFile(imageFile) {
306
- var formatMessage = this.props.intl.formatMessage;
306
+ var _this$props2 = this.props,
307
+ formatMessage = _this$props2.intl.formatMessage,
308
+ _this$props2$maxImage = _this$props2.maxImageSize,
309
+ maxImageSize = _this$props2$maxImage === void 0 ? _avatarPickerDialog.MAX_SIZE_MB : _this$props2$maxImage;
307
310
 
308
311
  if (_avatarPickerDialog.ACCEPT.indexOf(imageFile.type) === -1) {
309
312
  return formatMessage(_avatarPickerDialog.ERROR.FORMAT);
310
- } else if ((0, _util.fileSizeMb)(imageFile) > _avatarPickerDialog.MAX_SIZE_MB) {
313
+ } else if ((0, _util.fileSizeMb)(imageFile) > maxImageSize) {
311
314
  return formatMessage(_avatarPickerDialog.ERROR.SIZE, {
312
- MAX_SIZE_MB: _avatarPickerDialog.MAX_SIZE_MB
315
+ MAX_SIZE_MB: maxImageSize
313
316
  });
314
317
  }
315
318
 
@@ -373,9 +376,9 @@ var ImageNavigator = /*#__PURE__*/function (_Component) {
373
376
  }, {
374
377
  key: "renderImageUploader",
375
378
  value: function renderImageUploader() {
376
- var _this$props2 = this.props,
377
- errorMessage = _this$props2.errorMessage,
378
- isLoading = _this$props2.isLoading;
379
+ var _this$props3 = this.props,
380
+ errorMessage = _this$props3.errorMessage,
381
+ isLoading = _this$props3.isLoading;
379
382
  return /*#__PURE__*/_react.default.createElement(_styled.ImageUploader, null, this.renderDragZone(), isLoading ? null : /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_styled.PaddedBreak, null, /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, errorMessage ? _mediaUi.messages.try_again : _mediaUi.messages.or)), /*#__PURE__*/_react.default.createElement(_customThemeButton.default, {
380
383
  onClick: this.onUploadButtonClick,
381
384
  isDisabled: isLoading
@@ -421,9 +424,9 @@ var ImageNavigator = /*#__PURE__*/function (_Component) {
421
424
  }, {
422
425
  key: "dataURI",
423
426
  get: function get() {
424
- var _this$props3 = this.props,
425
- imageSource = _this$props3.imageSource,
426
- errorMessage = _this$props3.errorMessage;
427
+ var _this$props4 = this.props,
428
+ imageSource = _this$props4.imageSource,
429
+ errorMessage = _this$props4.errorMessage;
427
430
  var fileImageSource = this.state.fileImageSource;
428
431
  return errorMessage ? undefined : imageSource || fileImageSource;
429
432
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-avatar-picker",
3
- "version": "23.1.1",
3
+ "version": "23.2.1",
4
4
  "sideEffects": false
5
5
  }
@@ -255,14 +255,15 @@ export class ImageNavigator extends Component {
255
255
  const {
256
256
  intl: {
257
257
  formatMessage
258
- }
258
+ },
259
+ maxImageSize = MAX_SIZE_MB
259
260
  } = this.props;
260
261
 
261
262
  if (ACCEPT.indexOf(imageFile.type) === -1) {
262
263
  return formatMessage(ERROR.FORMAT);
263
- } else if (fileSizeMb(imageFile) > MAX_SIZE_MB) {
264
+ } else if (fileSizeMb(imageFile) > maxImageSize) {
264
265
  return formatMessage(ERROR.SIZE, {
265
- MAX_SIZE_MB
266
+ MAX_SIZE_MB: maxImageSize
266
267
  });
267
268
  }
268
269
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-avatar-picker",
3
- "version": "23.1.1",
3
+ "version": "23.2.1",
4
4
  "sideEffects": false
5
5
  }
@@ -280,13 +280,16 @@ export var ImageNavigator = /*#__PURE__*/function (_Component) {
280
280
  }, {
281
281
  key: "validateFile",
282
282
  value: function validateFile(imageFile) {
283
- var formatMessage = this.props.intl.formatMessage;
283
+ var _this$props2 = this.props,
284
+ formatMessage = _this$props2.intl.formatMessage,
285
+ _this$props2$maxImage = _this$props2.maxImageSize,
286
+ maxImageSize = _this$props2$maxImage === void 0 ? MAX_SIZE_MB : _this$props2$maxImage;
284
287
 
285
288
  if (ACCEPT.indexOf(imageFile.type) === -1) {
286
289
  return formatMessage(ERROR.FORMAT);
287
- } else if (fileSizeMb(imageFile) > MAX_SIZE_MB) {
290
+ } else if (fileSizeMb(imageFile) > maxImageSize) {
288
291
  return formatMessage(ERROR.SIZE, {
289
- MAX_SIZE_MB: MAX_SIZE_MB
292
+ MAX_SIZE_MB: maxImageSize
290
293
  });
291
294
  }
292
295
 
@@ -350,9 +353,9 @@ export var ImageNavigator = /*#__PURE__*/function (_Component) {
350
353
  }, {
351
354
  key: "renderImageUploader",
352
355
  value: function renderImageUploader() {
353
- var _this$props2 = this.props,
354
- errorMessage = _this$props2.errorMessage,
355
- isLoading = _this$props2.isLoading;
356
+ var _this$props3 = this.props,
357
+ errorMessage = _this$props3.errorMessage,
358
+ isLoading = _this$props3.isLoading;
356
359
  return /*#__PURE__*/React.createElement(ImageUploader, null, this.renderDragZone(), isLoading ? null : /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(PaddedBreak, null, /*#__PURE__*/React.createElement(FormattedMessage, errorMessage ? messages.try_again : messages.or)), /*#__PURE__*/React.createElement(Button, {
357
360
  onClick: this.onUploadButtonClick,
358
361
  isDisabled: isLoading
@@ -398,9 +401,9 @@ export var ImageNavigator = /*#__PURE__*/function (_Component) {
398
401
  }, {
399
402
  key: "dataURI",
400
403
  get: function get() {
401
- var _this$props3 = this.props,
402
- imageSource = _this$props3.imageSource,
403
- errorMessage = _this$props3.errorMessage;
404
+ var _this$props4 = this.props,
405
+ imageSource = _this$props4.imageSource,
406
+ errorMessage = _this$props4.errorMessage;
404
407
  var fileImageSource = this.state.fileImageSource;
405
408
  return errorMessage ? undefined : imageSource || fileImageSource;
406
409
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-avatar-picker",
3
- "version": "23.1.1",
3
+ "version": "23.2.1",
4
4
  "sideEffects": false
5
5
  }
@@ -37,6 +37,8 @@ export interface AvatarPickerDialogProps {
37
37
  predefinedAvatarsText?: string;
38
38
  /** The target width/height of the resulting (square) avatar. Leave blank for default (200x200) */
39
39
  outputSize?: number;
40
+ /** This optional property allows the consumer to define the maximum image size that can be uploaded. */
41
+ maxImageSize?: number;
40
42
  }
41
43
  export interface AvatarPickerDialogState {
42
44
  mode: Mode;
@@ -12,7 +12,7 @@ declare module 'react' {
12
12
  }
13
13
  }
14
14
  export declare const Container: ComponentClass<HTMLAttributes<{}>>;
15
- export declare const ImageContainer: import("styled-components").StyledComponentClass<import("react").DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, any, import("react").DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
15
+ export declare const ImageContainer: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement>, any, import("react").ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement>>;
16
16
  export declare const CONTAINER_PADDING = 28;
17
17
  export declare const RectMask: ComponentClass<HTMLAttributes<{}>>;
18
18
  export declare const CircularMask: ComponentClass<HTMLAttributes<{}>>;
@@ -23,6 +23,7 @@ export interface Props {
23
23
  onImageUploaded: (file: File) => void;
24
24
  onImageError: (errorMessage: string) => void;
25
25
  isLoading?: boolean;
26
+ maxImageSize?: number;
26
27
  }
27
28
  export interface State {
28
29
  imagePos: Vector2;
@@ -16,4 +16,4 @@ export interface DragZoneTextProps {
16
16
  export declare const DragZoneText: ComponentClass<HTMLAttributes<{}> & DragZoneTextProps>;
17
17
  export declare const SelectionBlocker: ComponentClass<HTMLAttributes<{}>>;
18
18
  export declare const PaddedBreak: ComponentClass<HTMLAttributes<{}>>;
19
- export declare const SliderWrapper: import("styled-components").StyledComponentClass<import("react").DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, any, import("react").DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
19
+ export declare const SliderWrapper: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement>, any, import("react").ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-avatar-picker",
3
- "version": "23.1.1",
3
+ "version": "23.2.1",
4
4
  "description": "A component to select, drag and resize image avatars. It also provides a default list of predefined avatars.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -15,7 +15,7 @@
15
15
  "sideEffects": false,
16
16
  "atlaskit:src": "src/index.ts",
17
17
  "af:exports": {
18
- ".": "./src/index.ts"
18
+ ".": "./src/index.tsx"
19
19
  },
20
20
  "atlassian": {
21
21
  "team": "Media Experience",
@@ -26,9 +26,9 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "@atlaskit/button": "^16.2.0",
29
+ "@atlaskit/button": "^16.3.0",
30
30
  "@atlaskit/icon": "^21.10.0",
31
- "@atlaskit/media-ui": "^20.0.0",
31
+ "@atlaskit/media-ui": "^21.1.0",
32
32
  "@atlaskit/modal-dialog": "^12.2.0",
33
33
  "@atlaskit/range": "^6.0.0",
34
34
  "@atlaskit/spinner": "^15.0.0",
@@ -43,8 +43,8 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@atlaskit/docs": "*",
46
- "@atlaskit/media-core": "^32.2.0",
47
- "@atlaskit/media-test-helpers": "^29.2.0",
46
+ "@atlaskit/media-core": "^32.3.0",
47
+ "@atlaskit/media-test-helpers": "^29.4.0",
48
48
  "@atlaskit/page": "^12.1.0",
49
49
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
50
50
  "@types/enzyme": "^3.1.15",
@@ -52,7 +52,7 @@
52
52
  "react": "^16.8.0",
53
53
  "react-dom": "^16.8.0",
54
54
  "react-intl-next": "npm:react-intl@^5.18.1",
55
- "typescript": "3.9.6"
55
+ "typescript": "4.2.4"
56
56
  },
57
57
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
58
58
  }