@atlaskit/media-avatar-picker 23.0.0 → 23.1.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 +10 -0
- package/dist/cjs/avatar-picker-dialog/index.js +4 -3
- package/dist/cjs/image-navigator/index.js +2 -2
- package/dist/cjs/predefined-avatar-list/index.js +2 -2
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/viewport/viewport-render.js +8 -5
- package/dist/es2019/avatar-picker-dialog/index.js +4 -3
- package/dist/es2019/image-navigator/index.js +2 -2
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/viewport/viewport-render.js +8 -6
- package/dist/esm/avatar-picker-dialog/index.js +4 -3
- package/dist/esm/image-navigator/index.js +2 -2
- package/dist/esm/predefined-avatar-list/index.js +2 -2
- package/dist/esm/version.json +1 -1
- package/dist/esm/viewport/viewport-render.js +8 -5
- package/dist/types/avatar-picker-dialog/index.d.ts +1 -1
- package/dist/types/avatar-picker-dialog/types.d.ts +2 -0
- package/dist/types/image-navigator/index.d.ts +2 -2
- package/dist/types/viewport/viewport-render.d.ts +1 -1
- package/package.json +7 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/media-avatar-picker
|
|
2
2
|
|
|
3
|
+
## 23.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`6c6bd435635`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6c6bd435635) - TC-2422: add the ability for avatars to have different output sizes
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 23.0.0
|
|
4
14
|
|
|
5
15
|
### Major Changes
|
|
@@ -146,20 +146,21 @@ var AvatarPickerDialog = /*#__PURE__*/function (_PureComponent) {
|
|
|
146
146
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onImageNavigatorLoad", function (loadParams) {
|
|
147
147
|
_this.exportCroppedImage = loadParams.export;
|
|
148
148
|
});
|
|
149
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "exportCroppedImage", function () {
|
|
149
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "exportCroppedImage", function (outputSize) {
|
|
150
150
|
return '';
|
|
151
151
|
});
|
|
152
152
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onSaveClick", function () {
|
|
153
153
|
var _this$props = _this.props,
|
|
154
154
|
onImagePicked = _this$props.onImagePicked,
|
|
155
155
|
onImagePickedDataURI = _this$props.onImagePickedDataURI,
|
|
156
|
-
onAvatarPicked = _this$props.onAvatarPicked
|
|
156
|
+
onAvatarPicked = _this$props.onAvatarPicked,
|
|
157
|
+
outputSize = _this$props.outputSize;
|
|
157
158
|
var _this$state = _this.state,
|
|
158
159
|
selectedImage = _this$state.selectedImage,
|
|
159
160
|
selectedAvatar = _this$state.selectedAvatar;
|
|
160
161
|
|
|
161
162
|
if (selectedImage) {
|
|
162
|
-
var exportedCroppedImageURI = _this.exportCroppedImage();
|
|
163
|
+
var exportedCroppedImageURI = _this.exportCroppedImage(outputSize);
|
|
163
164
|
|
|
164
165
|
if (onImagePicked) {
|
|
165
166
|
onImagePicked((0, _mediaUi.dataURItoFile)(exportedCroppedImageURI), fixedCrop);
|
|
@@ -170,12 +170,12 @@ var ImageNavigator = /*#__PURE__*/function (_Component) {
|
|
|
170
170
|
|
|
171
171
|
_this.exportCrop();
|
|
172
172
|
});
|
|
173
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "exportCroppedImage", function () {
|
|
173
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "exportCroppedImage", function (outputSize) {
|
|
174
174
|
var _assertThisInitialize = (0, _assertThisInitialized2.default)(_this),
|
|
175
175
|
imageElement = _assertThisInitialize.imageElement;
|
|
176
176
|
|
|
177
177
|
if (imageElement) {
|
|
178
|
-
var canvas = (0, _viewport2.renderViewport)(_this.state.viewport, imageElement);
|
|
178
|
+
var canvas = (0, _viewport2.renderViewport)(_this.state.viewport, imageElement, document.createElement('canvas'), outputSize);
|
|
179
179
|
|
|
180
180
|
if (canvas) {
|
|
181
181
|
return canvas.toDataURL();
|
|
@@ -35,9 +35,9 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
35
35
|
|
|
36
36
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
37
37
|
|
|
38
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
38
|
+
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; }
|
|
39
39
|
|
|
40
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
40
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
41
41
|
|
|
42
42
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
43
43
|
|
package/dist/cjs/version.json
CHANGED
|
@@ -13,6 +13,7 @@ exports.radians = radians;
|
|
|
13
13
|
|
|
14
14
|
var renderViewport = function renderViewport(viewport, image) {
|
|
15
15
|
var canvas = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document.createElement('canvas');
|
|
16
|
+
var outputSize = arguments.length > 3 ? arguments[3] : undefined;
|
|
16
17
|
var visibleSourceBounds = viewport.visibleSourceBounds,
|
|
17
18
|
innerBounds = viewport.innerBounds,
|
|
18
19
|
itemSourceBounds = viewport.itemSourceBounds,
|
|
@@ -20,8 +21,10 @@ var renderViewport = function renderViewport(viewport, image) {
|
|
|
20
21
|
var sourceBounds = visibleSourceBounds;
|
|
21
22
|
var width = innerBounds.width,
|
|
22
23
|
height = innerBounds.height;
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
var targetSizeActual = outputSize !== null && outputSize !== void 0 ? outputSize : width;
|
|
25
|
+
var outputScaleFactor = targetSizeActual / width;
|
|
26
|
+
canvas.width = width * outputScaleFactor;
|
|
27
|
+
canvas.height = height * outputScaleFactor;
|
|
25
28
|
var ctx = canvas.getContext('2d');
|
|
26
29
|
|
|
27
30
|
if (ctx && image) {
|
|
@@ -34,13 +37,13 @@ var renderViewport = function renderViewport(viewport, image) {
|
|
|
34
37
|
|
|
35
38
|
case 3:
|
|
36
39
|
sourceBounds = sourceBounds.hFlipWithin(itemSourceBounds).vFlipWithin(itemSourceBounds);
|
|
37
|
-
ctx.translate(width, height);
|
|
40
|
+
ctx.translate(width * outputScaleFactor, height * outputScaleFactor);
|
|
38
41
|
ctx.scale(-1, -1);
|
|
39
42
|
break;
|
|
40
43
|
|
|
41
44
|
case 4:
|
|
42
45
|
sourceBounds = sourceBounds.vFlipWithin(itemSourceBounds);
|
|
43
|
-
ctx.translate(0, height);
|
|
46
|
+
ctx.translate(0, height * outputScaleFactor);
|
|
44
47
|
ctx.scale(1, -1);
|
|
45
48
|
break;
|
|
46
49
|
|
|
@@ -75,7 +78,7 @@ var renderViewport = function renderViewport(viewport, image) {
|
|
|
75
78
|
break;
|
|
76
79
|
}
|
|
77
80
|
|
|
78
|
-
ctx.drawImage(image, sourceBounds.x, sourceBounds.y, sourceBounds.width, sourceBounds.height, 0, 0, width, height);
|
|
81
|
+
ctx.drawImage(image, sourceBounds.x, sourceBounds.y, sourceBounds.width, sourceBounds.height, 0, 0, width * outputScaleFactor, height * outputScaleFactor);
|
|
79
82
|
return canvas;
|
|
80
83
|
} else {
|
|
81
84
|
return null;
|
|
@@ -60,13 +60,14 @@ export class AvatarPickerDialog extends PureComponent {
|
|
|
60
60
|
this.exportCroppedImage = loadParams.export;
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
_defineProperty(this, "exportCroppedImage",
|
|
63
|
+
_defineProperty(this, "exportCroppedImage", outputSize => '');
|
|
64
64
|
|
|
65
65
|
_defineProperty(this, "onSaveClick", () => {
|
|
66
66
|
const {
|
|
67
67
|
onImagePicked,
|
|
68
68
|
onImagePickedDataURI,
|
|
69
|
-
onAvatarPicked
|
|
69
|
+
onAvatarPicked,
|
|
70
|
+
outputSize
|
|
70
71
|
} = this.props;
|
|
71
72
|
const {
|
|
72
73
|
selectedImage,
|
|
@@ -74,7 +75,7 @@ export class AvatarPickerDialog extends PureComponent {
|
|
|
74
75
|
} = this.state;
|
|
75
76
|
|
|
76
77
|
if (selectedImage) {
|
|
77
|
-
const exportedCroppedImageURI = this.exportCroppedImage();
|
|
78
|
+
const exportedCroppedImageURI = this.exportCroppedImage(outputSize);
|
|
78
79
|
|
|
79
80
|
if (onImagePicked) {
|
|
80
81
|
onImagePicked(dataURItoFile(exportedCroppedImageURI), fixedCrop);
|
|
@@ -110,13 +110,13 @@ export class ImageNavigator extends Component {
|
|
|
110
110
|
this.exportCrop();
|
|
111
111
|
});
|
|
112
112
|
|
|
113
|
-
_defineProperty(this, "exportCroppedImage",
|
|
113
|
+
_defineProperty(this, "exportCroppedImage", outputSize => {
|
|
114
114
|
const {
|
|
115
115
|
imageElement
|
|
116
116
|
} = this;
|
|
117
117
|
|
|
118
118
|
if (imageElement) {
|
|
119
|
-
const canvas = renderViewport(this.state.viewport, imageElement);
|
|
119
|
+
const canvas = renderViewport(this.state.viewport, imageElement, document.createElement('canvas'), outputSize);
|
|
120
120
|
|
|
121
121
|
if (canvas) {
|
|
122
122
|
return canvas.toDataURL();
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const radians = deg => deg * (Math.PI / 180);
|
|
2
|
-
export const renderViewport = (viewport, image, canvas = document.createElement('canvas')) => {
|
|
2
|
+
export const renderViewport = (viewport, image, canvas = document.createElement('canvas'), outputSize) => {
|
|
3
3
|
const {
|
|
4
4
|
visibleSourceBounds,
|
|
5
5
|
innerBounds,
|
|
@@ -11,8 +11,10 @@ export const renderViewport = (viewport, image, canvas = document.createElement(
|
|
|
11
11
|
width,
|
|
12
12
|
height
|
|
13
13
|
} = innerBounds;
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const targetSizeActual = outputSize !== null && outputSize !== void 0 ? outputSize : width;
|
|
15
|
+
const outputScaleFactor = targetSizeActual / width;
|
|
16
|
+
canvas.width = width * outputScaleFactor;
|
|
17
|
+
canvas.height = height * outputScaleFactor;
|
|
16
18
|
const ctx = canvas.getContext('2d');
|
|
17
19
|
|
|
18
20
|
if (ctx && image) {
|
|
@@ -25,13 +27,13 @@ export const renderViewport = (viewport, image, canvas = document.createElement(
|
|
|
25
27
|
|
|
26
28
|
case 3:
|
|
27
29
|
sourceBounds = sourceBounds.hFlipWithin(itemSourceBounds).vFlipWithin(itemSourceBounds);
|
|
28
|
-
ctx.translate(width, height);
|
|
30
|
+
ctx.translate(width * outputScaleFactor, height * outputScaleFactor);
|
|
29
31
|
ctx.scale(-1, -1);
|
|
30
32
|
break;
|
|
31
33
|
|
|
32
34
|
case 4:
|
|
33
35
|
sourceBounds = sourceBounds.vFlipWithin(itemSourceBounds);
|
|
34
|
-
ctx.translate(0, height);
|
|
36
|
+
ctx.translate(0, height * outputScaleFactor);
|
|
35
37
|
ctx.scale(1, -1);
|
|
36
38
|
break;
|
|
37
39
|
|
|
@@ -66,7 +68,7 @@ export const renderViewport = (viewport, image, canvas = document.createElement(
|
|
|
66
68
|
break;
|
|
67
69
|
}
|
|
68
70
|
|
|
69
|
-
ctx.drawImage(image, sourceBounds.x, sourceBounds.y, sourceBounds.width, sourceBounds.height, 0, 0, width, height);
|
|
71
|
+
ctx.drawImage(image, sourceBounds.x, sourceBounds.y, sourceBounds.width, sourceBounds.height, 0, 0, width * outputScaleFactor, height * outputScaleFactor);
|
|
70
72
|
return canvas;
|
|
71
73
|
} else {
|
|
72
74
|
return null;
|
|
@@ -114,7 +114,7 @@ export var AvatarPickerDialog = /*#__PURE__*/function (_PureComponent) {
|
|
|
114
114
|
_this.exportCroppedImage = loadParams.export;
|
|
115
115
|
});
|
|
116
116
|
|
|
117
|
-
_defineProperty(_assertThisInitialized(_this), "exportCroppedImage", function () {
|
|
117
|
+
_defineProperty(_assertThisInitialized(_this), "exportCroppedImage", function (outputSize) {
|
|
118
118
|
return '';
|
|
119
119
|
});
|
|
120
120
|
|
|
@@ -122,13 +122,14 @@ export var AvatarPickerDialog = /*#__PURE__*/function (_PureComponent) {
|
|
|
122
122
|
var _this$props = _this.props,
|
|
123
123
|
onImagePicked = _this$props.onImagePicked,
|
|
124
124
|
onImagePickedDataURI = _this$props.onImagePickedDataURI,
|
|
125
|
-
onAvatarPicked = _this$props.onAvatarPicked
|
|
125
|
+
onAvatarPicked = _this$props.onAvatarPicked,
|
|
126
|
+
outputSize = _this$props.outputSize;
|
|
126
127
|
var _this$state = _this.state,
|
|
127
128
|
selectedImage = _this$state.selectedImage,
|
|
128
129
|
selectedAvatar = _this$state.selectedAvatar;
|
|
129
130
|
|
|
130
131
|
if (selectedImage) {
|
|
131
|
-
var exportedCroppedImageURI = _this.exportCroppedImage();
|
|
132
|
+
var exportedCroppedImageURI = _this.exportCroppedImage(outputSize);
|
|
132
133
|
|
|
133
134
|
if (onImagePicked) {
|
|
134
135
|
onImagePicked(dataURItoFile(exportedCroppedImageURI), fixedCrop);
|
|
@@ -138,12 +138,12 @@ export var ImageNavigator = /*#__PURE__*/function (_Component) {
|
|
|
138
138
|
_this.exportCrop();
|
|
139
139
|
});
|
|
140
140
|
|
|
141
|
-
_defineProperty(_assertThisInitialized(_this), "exportCroppedImage", function () {
|
|
141
|
+
_defineProperty(_assertThisInitialized(_this), "exportCroppedImage", function (outputSize) {
|
|
142
142
|
var _assertThisInitialize = _assertThisInitialized(_this),
|
|
143
143
|
imageElement = _assertThisInitialize.imageElement;
|
|
144
144
|
|
|
145
145
|
if (imageElement) {
|
|
146
|
-
var canvas = renderViewport(_this.state.viewport, imageElement);
|
|
146
|
+
var canvas = renderViewport(_this.state.viewport, imageElement, document.createElement('canvas'), outputSize);
|
|
147
147
|
|
|
148
148
|
if (canvas) {
|
|
149
149
|
return canvas.toDataURL();
|
|
@@ -5,9 +5,9 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
|
|
8
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
8
|
+
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; }
|
|
9
9
|
|
|
10
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
10
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
11
|
|
|
12
12
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
13
13
|
|
package/dist/esm/version.json
CHANGED
|
@@ -3,6 +3,7 @@ export var radians = function radians(deg) {
|
|
|
3
3
|
};
|
|
4
4
|
export var renderViewport = function renderViewport(viewport, image) {
|
|
5
5
|
var canvas = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document.createElement('canvas');
|
|
6
|
+
var outputSize = arguments.length > 3 ? arguments[3] : undefined;
|
|
6
7
|
var visibleSourceBounds = viewport.visibleSourceBounds,
|
|
7
8
|
innerBounds = viewport.innerBounds,
|
|
8
9
|
itemSourceBounds = viewport.itemSourceBounds,
|
|
@@ -10,8 +11,10 @@ export var renderViewport = function renderViewport(viewport, image) {
|
|
|
10
11
|
var sourceBounds = visibleSourceBounds;
|
|
11
12
|
var width = innerBounds.width,
|
|
12
13
|
height = innerBounds.height;
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
var targetSizeActual = outputSize !== null && outputSize !== void 0 ? outputSize : width;
|
|
15
|
+
var outputScaleFactor = targetSizeActual / width;
|
|
16
|
+
canvas.width = width * outputScaleFactor;
|
|
17
|
+
canvas.height = height * outputScaleFactor;
|
|
15
18
|
var ctx = canvas.getContext('2d');
|
|
16
19
|
|
|
17
20
|
if (ctx && image) {
|
|
@@ -24,13 +27,13 @@ export var renderViewport = function renderViewport(viewport, image) {
|
|
|
24
27
|
|
|
25
28
|
case 3:
|
|
26
29
|
sourceBounds = sourceBounds.hFlipWithin(itemSourceBounds).vFlipWithin(itemSourceBounds);
|
|
27
|
-
ctx.translate(width, height);
|
|
30
|
+
ctx.translate(width * outputScaleFactor, height * outputScaleFactor);
|
|
28
31
|
ctx.scale(-1, -1);
|
|
29
32
|
break;
|
|
30
33
|
|
|
31
34
|
case 4:
|
|
32
35
|
sourceBounds = sourceBounds.vFlipWithin(itemSourceBounds);
|
|
33
|
-
ctx.translate(0, height);
|
|
36
|
+
ctx.translate(0, height * outputScaleFactor);
|
|
34
37
|
ctx.scale(1, -1);
|
|
35
38
|
break;
|
|
36
39
|
|
|
@@ -65,7 +68,7 @@ export var renderViewport = function renderViewport(viewport, image) {
|
|
|
65
68
|
break;
|
|
66
69
|
}
|
|
67
70
|
|
|
68
|
-
ctx.drawImage(image, sourceBounds.x, sourceBounds.y, sourceBounds.width, sourceBounds.height, 0, 0, width, height);
|
|
71
|
+
ctx.drawImage(image, sourceBounds.x, sourceBounds.y, sourceBounds.width, sourceBounds.height, 0, 0, width * outputScaleFactor, height * outputScaleFactor);
|
|
69
72
|
return canvas;
|
|
70
73
|
} else {
|
|
71
74
|
return null;
|
|
@@ -26,7 +26,7 @@ export declare class AvatarPickerDialog extends PureComponent<AvatarPickerDialog
|
|
|
26
26
|
* Initialised with no-op function. Is assigned cropped image exporting
|
|
27
27
|
* function when internal ImageCropper mounts via this.onImageNavigatorLoad
|
|
28
28
|
*/
|
|
29
|
-
exportCroppedImage: () => string;
|
|
29
|
+
exportCroppedImage: (outputSize?: number | undefined) => string;
|
|
30
30
|
onSaveClick: () => void;
|
|
31
31
|
onShowMore: () => void;
|
|
32
32
|
onGoBack: () => void;
|
|
@@ -35,6 +35,8 @@ export interface AvatarPickerDialogProps {
|
|
|
35
35
|
isLoading?: boolean;
|
|
36
36
|
/** This property decribe the text related to the Avatar. */
|
|
37
37
|
predefinedAvatarsText?: string;
|
|
38
|
+
/** The target width/height of the resulting (square) avatar. Leave blank for default (200x200) */
|
|
39
|
+
outputSize?: number;
|
|
38
40
|
}
|
|
39
41
|
export interface AvatarPickerDialogState {
|
|
40
42
|
mode: Mode;
|
|
@@ -4,7 +4,7 @@ import { WrappedComponentProps } from 'react-intl-next';
|
|
|
4
4
|
import { Vector2 } from '@atlaskit/media-ui';
|
|
5
5
|
import { Viewport } from '../viewport';
|
|
6
6
|
export interface LoadParameters {
|
|
7
|
-
export: () => string;
|
|
7
|
+
export: (outputSize?: number) => string;
|
|
8
8
|
}
|
|
9
9
|
export declare type OnLoadHandler = (params: LoadParameters) => void;
|
|
10
10
|
export declare const viewport: Viewport;
|
|
@@ -55,7 +55,7 @@ export declare class ImageNavigator extends Component<Props & WrappedComponentPr
|
|
|
55
55
|
* @param height the height of the image
|
|
56
56
|
*/
|
|
57
57
|
onImageLoaded: (image: HTMLImageElement) => void;
|
|
58
|
-
exportCroppedImage: () => string;
|
|
58
|
+
exportCroppedImage: (outputSize?: number | undefined) => string;
|
|
59
59
|
exportCrop(): void;
|
|
60
60
|
validateFile(imageFile: File): string | null;
|
|
61
61
|
readFile(imageFile: File): Promise<void>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Viewport } from './viewport';
|
|
2
2
|
export declare const radians: (deg: number) => number;
|
|
3
|
-
export declare const renderViewport: (viewport: Viewport, image: HTMLImageElement, canvas?: HTMLCanvasElement) => HTMLCanvasElement | null;
|
|
3
|
+
export declare const renderViewport: (viewport: Viewport, image: HTMLImageElement, canvas?: HTMLCanvasElement, outputSize?: number | undefined) => HTMLCanvasElement | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-avatar-picker",
|
|
3
|
-
"version": "23.
|
|
3
|
+
"version": "23.1.0",
|
|
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/"
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@atlaskit/button": "^16.0.0",
|
|
30
|
-
"@atlaskit/icon": "^21.
|
|
31
|
-
"@atlaskit/media-ui": "^
|
|
30
|
+
"@atlaskit/icon": "^21.10.0",
|
|
31
|
+
"@atlaskit/media-ui": "^19.0.0",
|
|
32
32
|
"@atlaskit/modal-dialog": "^12.2.0",
|
|
33
|
-
"@atlaskit/range": "^
|
|
33
|
+
"@atlaskit/range": "^6.0.0",
|
|
34
34
|
"@atlaskit/spinner": "^15.0.0",
|
|
35
|
-
"@atlaskit/theme": "^12.
|
|
35
|
+
"@atlaskit/theme": "^12.1.0",
|
|
36
36
|
"@babel/runtime": "^7.0.0",
|
|
37
37
|
"exenv": "^1.2.2"
|
|
38
38
|
},
|
|
@@ -42,11 +42,10 @@
|
|
|
42
42
|
"styled-components": "^3.2.6"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@atlaskit/build-utils": "*",
|
|
46
45
|
"@atlaskit/docs": "*",
|
|
47
46
|
"@atlaskit/media-core": "^32.2.0",
|
|
48
|
-
"@atlaskit/media-test-helpers": "^29.
|
|
49
|
-
"@atlaskit/page": "^12.
|
|
47
|
+
"@atlaskit/media-test-helpers": "^29.1.0",
|
|
48
|
+
"@atlaskit/page": "^12.1.0",
|
|
50
49
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
51
50
|
"@types/enzyme": "^3.1.15",
|
|
52
51
|
"enzyme": "^3.10.0",
|