@atlaskit/media-avatar-picker 24.3.21 → 24.3.23
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 +12 -0
- package/dist/cjs/avatar-picker-dialog/styles.js +10 -3
- package/dist/cjs/image-cropper/index.js +76 -19
- package/dist/cjs/image-cropper/styles.js +2 -21
- package/dist/cjs/image-placer/containerWrapper.js +15 -6
- package/dist/cjs/image-placer/styles.js +64 -25
- package/dist/es2019/avatar-picker-dialog/styles.js +8 -5
- package/dist/es2019/image-cropper/index.js +77 -19
- package/dist/es2019/image-cropper/styles.js +1 -71
- package/dist/es2019/image-placer/containerWrapper.js +19 -8
- package/dist/es2019/image-placer/styles.js +52 -69
- package/dist/esm/avatar-picker-dialog/styles.js +10 -3
- package/dist/esm/image-cropper/index.js +77 -19
- package/dist/esm/image-cropper/styles.js +1 -19
- package/dist/esm/image-placer/containerWrapper.js +16 -7
- package/dist/esm/image-placer/styles.js +63 -23
- package/dist/types/image-cropper/styles.d.ts +0 -19
- package/dist/types/image-placer/containerWrapper.d.ts +7 -1
- package/dist/types/image-placer/styles.d.ts +1 -10
- package/dist/types-ts4.5/image-cropper/styles.d.ts +0 -19
- package/dist/types-ts4.5/image-placer/containerWrapper.d.ts +7 -1
- package/dist/types-ts4.5/image-placer/styles.d.ts +1 -10
- package/package.json +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/media-avatar-picker
|
|
2
2
|
|
|
3
|
+
## 24.3.23
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#78361](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/78361) [`195d62082a3a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/195d62082a3a) - CXP-3050 Enforced design tokens and primitives
|
|
8
|
+
|
|
9
|
+
## 24.3.22
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#71706](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/71706) [`9f5b710e6a66`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9f5b710e6a66) - [ux] fix dialog header style
|
|
14
|
+
|
|
3
15
|
## 24.3.21
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -7,9 +7,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.modalHeaderStyles = exports.formStyles = exports.croppingWrapperStyles = exports.avatarPickerViewWrapperStyles = exports.avatarPickerErrorStyles = void 0;
|
|
8
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4
|
|
10
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
11
11
|
var avatarPickerErrorStyles = exports.avatarPickerErrorStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n margin: 0 ", " ", ";\n"])), "var(--ds-space-200, 16px)", "var(--ds-space-200, 16px)");
|
|
12
12
|
var formStyles = exports.formStyles = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n margin: 0;\n"])));
|
|
13
13
|
var avatarPickerViewWrapperStyles = exports.avatarPickerViewWrapperStyles = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n justify-content: center;\n align-items: flex-start;\n text-align: center;\n min-height: 339px;\n"])));
|
|
14
|
-
var modalHeaderStyles = exports.modalHeaderStyles = (0, _react.css)(
|
|
15
|
-
|
|
14
|
+
var modalHeaderStyles = exports.modalHeaderStyles = (0, _react.css)({
|
|
15
|
+
// Using `&` twice to increase specificity
|
|
16
|
+
'&&': {
|
|
17
|
+
margin: "var(--ds-space-200, 16px)",
|
|
18
|
+
fontWeight: 500,
|
|
19
|
+
fontSize: '20px'
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
var croppingWrapperStyles = exports.croppingWrapperStyles = (0, _react.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n display: inline-block;\n user-select: none;\n\n * {\n user-select: none;\n }\n"])));
|
|
@@ -20,12 +20,69 @@ var _reactIntlNext = require("react-intl-next");
|
|
|
20
20
|
var _mediaUi = require("@atlaskit/media-ui");
|
|
21
21
|
var _isImageRemote = require("./isImageRemote");
|
|
22
22
|
var _styles = require("./styles");
|
|
23
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
24
|
+
var _primitives = require("@atlaskit/primitives");
|
|
23
25
|
var _avatarPickerDialog = require("../avatar-picker-dialog");
|
|
24
26
|
var _layoutConst = require("../avatar-picker-dialog/layout-const");
|
|
25
27
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
26
28
|
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; }
|
|
27
29
|
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); }; }
|
|
28
30
|
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; } } /** @jsx jsx */
|
|
31
|
+
var removeImageButtonStyles = (0, _react.css)({
|
|
32
|
+
borderRadius: "var(--ds-border-radius-050, 3px)",
|
|
33
|
+
backgroundColor: 'transparent',
|
|
34
|
+
width: '24px',
|
|
35
|
+
height: '24px',
|
|
36
|
+
border: 'none',
|
|
37
|
+
cursor: 'pointer',
|
|
38
|
+
padding: 0,
|
|
39
|
+
svg: {
|
|
40
|
+
position: 'absolute',
|
|
41
|
+
top: "var(--ds-space-050, 4px)",
|
|
42
|
+
left: "var(--ds-space-050, 4px)"
|
|
43
|
+
},
|
|
44
|
+
'&:hover': {
|
|
45
|
+
backgroundColor: "var(--ds-background-neutral-hovered, ".concat(_colors.N50A, ")")
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
var removeImageContainerStyles = (0, _primitives.xcss)({
|
|
49
|
+
position: 'absolute',
|
|
50
|
+
right: 'space.050',
|
|
51
|
+
top: 'space.050'
|
|
52
|
+
});
|
|
53
|
+
var dragOverlayStyles = (0, _primitives.xcss)({
|
|
54
|
+
position: 'absolute',
|
|
55
|
+
width: '100%',
|
|
56
|
+
height: '100%',
|
|
57
|
+
cursor: 'move'
|
|
58
|
+
});
|
|
59
|
+
var maskShadow = {
|
|
60
|
+
boxShadow: "0 0 0 100px ".concat("var(--ds-surface-overlay, rgba(255, 255, 255))")
|
|
61
|
+
};
|
|
62
|
+
var maskStyles = (0, _primitives.xcss)({
|
|
63
|
+
position: 'absolute',
|
|
64
|
+
top: "".concat(_styles.CONTAINER_PADDING, "px"),
|
|
65
|
+
bottom: "".concat(_styles.CONTAINER_PADDING, "px"),
|
|
66
|
+
left: "".concat(_styles.CONTAINER_PADDING, "px"),
|
|
67
|
+
right: "".concat(_styles.CONTAINER_PADDING, "px"),
|
|
68
|
+
opacity: 'opacity.disabled'
|
|
69
|
+
});
|
|
70
|
+
var rectMaskStyles = (0, _primitives.xcss)({
|
|
71
|
+
borderRadius: 'border.radius.100'
|
|
72
|
+
});
|
|
73
|
+
var circularMaskStyles = (0, _primitives.xcss)({
|
|
74
|
+
borderRadius: 'border.radius.circle'
|
|
75
|
+
});
|
|
76
|
+
var containerStyles = (0, _primitives.xcss)({
|
|
77
|
+
position: 'relative',
|
|
78
|
+
overflow: 'hidden',
|
|
79
|
+
borderRadius: 'border.radius.100'
|
|
80
|
+
});
|
|
81
|
+
var imageContainerStyles = (0, _primitives.xcss)({
|
|
82
|
+
position: 'absolute',
|
|
83
|
+
userSelect: 'none',
|
|
84
|
+
borderRadius: 'border.radius.100'
|
|
85
|
+
});
|
|
29
86
|
var ImageCropper = exports.ImageCropper = /*#__PURE__*/function (_Component) {
|
|
30
87
|
(0, _inherits2.default)(ImageCropper, _Component);
|
|
31
88
|
var _super = _createSuper(ImageCropper);
|
|
@@ -76,33 +133,31 @@ var ImageCropper = exports.ImageCropper = /*#__PURE__*/function (_Component) {
|
|
|
76
133
|
onRemoveImage = _this$props3.onRemoveImage,
|
|
77
134
|
onImageLoaded = _this$props3.onImageLoaded,
|
|
78
135
|
formatMessage = _this$props3.intl.formatMessage;
|
|
79
|
-
var
|
|
136
|
+
var containerDimensions = (0, _primitives.xcss)({
|
|
80
137
|
width: "".concat(containerSize, "px"),
|
|
81
138
|
height: "".concat(containerSize, "px")
|
|
82
|
-
};
|
|
139
|
+
});
|
|
83
140
|
var width = imageWidth ? "".concat(imageWidth, "px") : 'auto';
|
|
84
141
|
var height = imageHeight ? "".concat(imageHeight, "px") : 'auto';
|
|
85
|
-
var
|
|
142
|
+
var imageContainerDynamicStyles = (0, _primitives.xcss)({
|
|
86
143
|
width: width,
|
|
87
144
|
height: height,
|
|
88
145
|
display: width === 'auto' ? 'none' : 'block',
|
|
89
146
|
top: "".concat(top, "px"),
|
|
90
147
|
left: "".concat(left, "px")
|
|
91
|
-
};
|
|
148
|
+
});
|
|
92
149
|
var crossOrigin;
|
|
93
150
|
try {
|
|
94
151
|
crossOrigin = (0, _isImageRemote.isImageRemote)(imageSource) ? 'anonymous' : undefined;
|
|
95
152
|
} catch (e) {
|
|
96
153
|
return null;
|
|
97
154
|
}
|
|
98
|
-
return (0, _react.jsx)(
|
|
155
|
+
return (0, _react.jsx)(_primitives.Box, {
|
|
99
156
|
id: "container",
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}, (0, _react.jsx)("div", {
|
|
157
|
+
xcss: [containerStyles, containerDimensions]
|
|
158
|
+
}, (0, _react.jsx)(_primitives.Box, {
|
|
103
159
|
id: "image-container",
|
|
104
|
-
|
|
105
|
-
style: imageContainerStyle
|
|
160
|
+
xcss: [imageContainerStyles, imageContainerDynamicStyles]
|
|
106
161
|
}, (0, _react.jsx)(_mediaUi.MediaImage, {
|
|
107
162
|
crossOrigin: crossOrigin,
|
|
108
163
|
dataURI: imageSource,
|
|
@@ -111,20 +166,22 @@ var ImageCropper = exports.ImageCropper = /*#__PURE__*/function (_Component) {
|
|
|
111
166
|
previewOrientation: "from-image",
|
|
112
167
|
onImageLoad: onImageLoaded,
|
|
113
168
|
onImageError: this.onImageError
|
|
114
|
-
})), isCircularMask ? (0, _react.jsx)(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
169
|
+
})), isCircularMask ? (0, _react.jsx)(_primitives.Box, {
|
|
170
|
+
xcss: [maskStyles, circularMaskStyles],
|
|
171
|
+
style: maskShadow
|
|
172
|
+
}) : (0, _react.jsx)(_primitives.Box, {
|
|
173
|
+
xcss: [maskStyles, rectMaskStyles],
|
|
174
|
+
style: maskShadow
|
|
175
|
+
}), (0, _react.jsx)(_primitives.Box, {
|
|
119
176
|
id: "drag-overlay",
|
|
120
|
-
|
|
177
|
+
xcss: dragOverlayStyles,
|
|
121
178
|
onMouseDown: this.onDragStarted
|
|
122
|
-
}), (0, _react.jsx)(
|
|
179
|
+
}), (0, _react.jsx)(_primitives.Box, {
|
|
123
180
|
id: "remove-image-container",
|
|
124
|
-
|
|
181
|
+
xcss: removeImageContainerStyles
|
|
125
182
|
}, (0, _react.jsx)("button", {
|
|
126
183
|
id: "remove-image-button",
|
|
127
|
-
css:
|
|
184
|
+
css: removeImageButtonStyles,
|
|
128
185
|
onClick: onRemoveImage
|
|
129
186
|
}, (0, _react.jsx)(_cross.default, {
|
|
130
187
|
size: "small",
|
|
@@ -1,26 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports.
|
|
8
|
-
var
|
|
9
|
-
var _react = require("@emotion/react");
|
|
10
|
-
var _constants = require("@atlaskit/theme/constants");
|
|
11
|
-
var _colors = require("@atlaskit/theme/colors");
|
|
12
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
13
|
-
// Using module augmentation to add crossOrigin attribute as it does not exist yet, PR has been opened in
|
|
14
|
-
// DefinitelyTyped for it
|
|
15
|
-
|
|
16
|
-
var containerStyles = exports.containerStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n overflow: hidden;\n border-radius: ", "px;\n"])), (0, _constants.borderRadius)());
|
|
17
|
-
var imageContainerStyles = exports.imageContainerStyles = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n /* Is needed so image is not selected, when dragged */\n -webkit-user-select: none; /* Chrome all / Safari all */\n -moz-user-select: none; /* Firefox all */\n -ms-user-select: none; /* IE 10+ */\n user-select: none; /* Likely future */\n border-radius: ", "px;\n"])), (0, _constants.borderRadius)());
|
|
18
|
-
var CONTAINER_PADDING = exports.CONTAINER_PADDING = 28;
|
|
19
|
-
|
|
20
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
21
|
-
var maskStyles = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n top: ", "px;\n bottom: ", "px;\n left: ", "px;\n right: ", "px;\n box-shadow: 0 0 0 100px\n ", ";\n opacity: ", ";\n"])), CONTAINER_PADDING, CONTAINER_PADDING, CONTAINER_PADDING, CONTAINER_PADDING, "var(--ds-surface-overlay, rgba(255, 255, 255))", "var(--ds-opacity-disabled, 0.5)");
|
|
22
|
-
var rectMaskStyles = exports.rectMaskStyles = (0, _react.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n border-radius: ", "px;\n"])), maskStyles, (0, _constants.borderRadius)());
|
|
23
|
-
var circularMaskStyles = exports.circularMaskStyles = (0, _react.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n border-radius: 500px;\n"])), maskStyles);
|
|
24
|
-
var dragOverlayStyles = exports.dragOverlayStyles = (0, _react.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n width: 100%;\n height: 100%;\n cursor: move;\n"])));
|
|
25
|
-
var removeImageContainerStyles = exports.removeImageContainerStyles = (0, _react.css)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n right: ", ";\n top: ", ";\n"])), "var(--ds-space-050, 4px)", "var(--ds-space-050, 4px)");
|
|
26
|
-
var removeImageButtonStyles = exports.removeImageButtonStyles = (0, _react.css)(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n border-radius: ", "px;\n background-color: transparent;\n width: 24px;\n height: 24px;\n border: none;\n cursor: pointer;\n padding: 0;\n\n svg {\n position: absolute;\n top: ", ";\n left: ", ";\n }\n\n &:hover {\n background-color: ", ";\n }\n"])), (0, _constants.borderRadius)(), "var(--ds-space-050, 4px)", "var(--ds-space-050, 4px)", "var(--ds-background-neutral-hovered, ".concat(_colors.N50A, ")"));
|
|
6
|
+
exports.CONTAINER_PADDING = void 0;
|
|
7
|
+
var CONTAINER_PADDING = exports.CONTAINER_PADDING = 28;
|
|
@@ -8,20 +8,29 @@ exports.ContainerWrapper = void 0;
|
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _react = require("@emotion/react");
|
|
11
|
+
var _primitives = require("@atlaskit/primitives");
|
|
11
12
|
var _styles = require("./styles");
|
|
12
13
|
var _excluded = ["width", "height", "margin", "children"];
|
|
13
14
|
/**@jsx jsx */
|
|
15
|
+
var containerWrapperStyles = (0, _primitives.xcss)({
|
|
16
|
+
background: "url('".concat(_styles.checkeredBg, "')"),
|
|
17
|
+
position: "relative",
|
|
18
|
+
cursor: "move",
|
|
19
|
+
userSelect: "none",
|
|
20
|
+
overflow: "hidden"
|
|
21
|
+
});
|
|
14
22
|
var ContainerWrapper = exports.ContainerWrapper = function ContainerWrapper(_ref) {
|
|
15
23
|
var width = _ref.width,
|
|
16
24
|
height = _ref.height,
|
|
17
25
|
margin = _ref.margin,
|
|
18
26
|
children = _ref.children,
|
|
19
27
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
var containerWrapperDimensions = (0, _primitives.xcss)({
|
|
29
|
+
width: "".concat(width !== undefined ? width + margin * 2 : 0, "px"),
|
|
30
|
+
height: "".concat(height !== undefined ? height + margin * 2 : 0, "px")
|
|
31
|
+
});
|
|
32
|
+
return (0, _react.jsx)(_primitives.Box, (0, _extends2.default)({
|
|
33
|
+
id: 'container-wrapper',
|
|
34
|
+
xcss: [containerWrapperStyles, containerWrapperDimensions]
|
|
26
35
|
}, props), children);
|
|
27
36
|
};
|
|
@@ -1,43 +1,82 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports.marginWrapperSquareStyles = exports.marginWrapperCircleStyles = exports.imageWrapperStyles = exports.imagePlacerWrapperStyles = exports.imagePlacerErrorWrapperStyles = exports.
|
|
8
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
6
|
+
exports.marginWrapperSquareStyles = exports.marginWrapperCircleStyles = exports.imageWrapperStyles = exports.imagePlacerWrapperStyles = exports.imagePlacerErrorWrapperStyles = exports.checkeredBg = exports.EASING = void 0;
|
|
9
7
|
var _react = require("@emotion/react");
|
|
10
8
|
var _colors = require("@atlaskit/theme/colors");
|
|
11
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
12
9
|
var checkeredBg = exports.checkeredBg = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAA6hpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgICAgICAgICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iPgogICAgICAgICA8eG1wOk1vZGlmeURhdGU+MjAxOC0xMC0zMFQxMjoxMDo5MjwveG1wOk1vZGlmeURhdGU+CiAgICAgICAgIDx4bXA6Q3JlYXRvclRvb2w+UGl4ZWxtYXRvciAzLjcuNTwveG1wOkNyZWF0b3JUb29sPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICAgICA8dGlmZjpDb21wcmVzc2lvbj4wPC90aWZmOkNvbXByZXNzaW9uPgogICAgICAgICA8dGlmZjpSZXNvbHV0aW9uVW5pdD4yPC90aWZmOlJlc29sdXRpb25Vbml0PgogICAgICAgICA8dGlmZjpZUmVzb2x1dGlvbj43MjwvdGlmZjpZUmVzb2x1dGlvbj4KICAgICAgICAgPHRpZmY6WFJlc29sdXRpb24+NzI8L3RpZmY6WFJlc29sdXRpb24+CiAgICAgICAgIDxleGlmOlBpeGVsWERpbWVuc2lvbj4xMDwvZXhpZjpQaXhlbFhEaW1lbnNpb24+CiAgICAgICAgIDxleGlmOkNvbG9yU3BhY2U+MTwvZXhpZjpDb2xvclNwYWNlPgogICAgICAgICA8ZXhpZjpQaXhlbFlEaW1lbnNpb24+MTA8L2V4aWY6UGl4ZWxZRGltZW5zaW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KX+XPjwAAACtJREFUGBljPHv27H8GNGBsbMyIJsTAhC6Aiz+ACjEcDXIjNg8OoBuJthoAzy0HeT3Qcc0AAAAASUVORK5CYII=';
|
|
13
10
|
var imagePlacerWrapperStyles = exports.imagePlacerWrapperStyles = function imagePlacerWrapperStyles(props) {
|
|
14
|
-
return (0, _react.css)(
|
|
11
|
+
return (0, _react.css)({
|
|
12
|
+
backgroundColor: props.backgroundColor,
|
|
13
|
+
display: 'inline-block'
|
|
14
|
+
});
|
|
15
15
|
};
|
|
16
|
-
var imagePlacerErrorWrapperStyles = exports.imagePlacerErrorWrapperStyles = (0, _react.css)(
|
|
17
|
-
var
|
|
18
|
-
var
|
|
16
|
+
var imagePlacerErrorWrapperStyles = exports.imagePlacerErrorWrapperStyles = (0, _react.css)({
|
|
17
|
+
backgroundColor: "var(--ds-background-danger-bold, ".concat(_colors.R500, ")"),
|
|
18
|
+
color: "var(--ds-text-inverse, white)",
|
|
19
|
+
width: '100%',
|
|
20
|
+
height: '100%',
|
|
21
|
+
textAlign: 'center',
|
|
22
|
+
paddingTop: '45%'
|
|
23
|
+
});
|
|
24
|
+
var EASING = exports.EASING = 0.15;
|
|
25
|
+
var imageWrapperStyles = exports.imageWrapperStyles = function imageWrapperStyles(_ref) {
|
|
26
|
+
var x = _ref.x,
|
|
27
|
+
y = _ref.y,
|
|
28
|
+
width = _ref.width,
|
|
19
29
|
height = _ref.height,
|
|
20
|
-
|
|
21
|
-
return (0, _react.css)(
|
|
30
|
+
transform = _ref.transform;
|
|
31
|
+
return (0, _react.css)({
|
|
32
|
+
left: "".concat(x, "px"),
|
|
33
|
+
top: "".concat(y, "px"),
|
|
34
|
+
width: "".concat(width, "px"),
|
|
35
|
+
height: "".concat(height, "px"),
|
|
36
|
+
transform: transform,
|
|
37
|
+
position: 'absolute',
|
|
38
|
+
transition: "margin-left ".concat(EASING, "s ease-out, margin-top ").concat(EASING, "s ease-out, left ").concat(EASING, "s ease-out, top ").concat(EASING, "s ease-out, width ").concat(EASING, "s ease-out, height ").concat(EASING, "s ease-out"),
|
|
39
|
+
userSelect: 'none',
|
|
40
|
+
pointerEvents: 'none'
|
|
41
|
+
});
|
|
22
42
|
};
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
var x = _ref2.x,
|
|
26
|
-
y = _ref2.y,
|
|
27
|
-
width = _ref2.width,
|
|
43
|
+
var marginWrapperSquareStyles = exports.marginWrapperSquareStyles = function marginWrapperSquareStyles(_ref2) {
|
|
44
|
+
var width = _ref2.width,
|
|
28
45
|
height = _ref2.height,
|
|
29
|
-
|
|
30
|
-
return (0, _react.css)(
|
|
46
|
+
size = _ref2.size;
|
|
47
|
+
return (0, _react.css)({
|
|
48
|
+
position: 'absolute',
|
|
49
|
+
left: 0,
|
|
50
|
+
top: 0,
|
|
51
|
+
borderStyle: 'solid',
|
|
52
|
+
borderColor: "var(--ds-surface-overlay, rgba(255, 255, 255))",
|
|
53
|
+
borderWidth: "".concat(size, "px"),
|
|
54
|
+
width: "".concat(width, "px"),
|
|
55
|
+
height: "".concat(height, "px"),
|
|
56
|
+
opacity: "var(--ds-opacity-disabled, 0.3)"
|
|
57
|
+
});
|
|
31
58
|
};
|
|
32
|
-
var
|
|
59
|
+
var marginWrapperCircleStyles = exports.marginWrapperCircleStyles = function marginWrapperCircleStyles(_ref3) {
|
|
33
60
|
var width = _ref3.width,
|
|
34
61
|
height = _ref3.height,
|
|
35
62
|
size = _ref3.size;
|
|
36
|
-
return (0, _react.css)(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
size
|
|
42
|
-
|
|
63
|
+
return (0, _react.css)({
|
|
64
|
+
position: 'absolute',
|
|
65
|
+
overflow: 'hidden',
|
|
66
|
+
left: '0px',
|
|
67
|
+
top: '0px',
|
|
68
|
+
width: "".concat(width + size * 2, "px"),
|
|
69
|
+
height: "".concat(height + size * 2, "px"),
|
|
70
|
+
'&:after': {
|
|
71
|
+
content: "''",
|
|
72
|
+
position: 'absolute',
|
|
73
|
+
left: "".concat(size, "px"),
|
|
74
|
+
top: "".concat(size, "px"),
|
|
75
|
+
borderRadius: '100%',
|
|
76
|
+
width: "".concat(width, "px"),
|
|
77
|
+
height: "".concat(height, "px"),
|
|
78
|
+
boxShadow: "0px 0px 0px ".concat(Math.max(width, height), "px ", "var(--ds-surface-overlay, rgba(255, 255, 255))"),
|
|
79
|
+
opacity: "var(--ds-opacity-disabled, 0.3)"
|
|
80
|
+
}
|
|
81
|
+
});
|
|
43
82
|
};
|
|
@@ -12,11 +12,14 @@ export const avatarPickerViewWrapperStyles = css`
|
|
|
12
12
|
text-align: center;
|
|
13
13
|
min-height: 339px;
|
|
14
14
|
`;
|
|
15
|
-
export const modalHeaderStyles = css
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
export const modalHeaderStyles = css({
|
|
16
|
+
// Using `&` twice to increase specificity
|
|
17
|
+
'&&': {
|
|
18
|
+
margin: "var(--ds-space-200, 16px)",
|
|
19
|
+
fontWeight: 500,
|
|
20
|
+
fontSize: '20px'
|
|
21
|
+
}
|
|
22
|
+
});
|
|
20
23
|
export const croppingWrapperStyles = css`
|
|
21
24
|
display: inline-block;
|
|
22
25
|
user-select: none;
|
|
@@ -7,9 +7,67 @@ import CrossIcon from '@atlaskit/icon/glyph/cross';
|
|
|
7
7
|
import { injectIntl } from 'react-intl-next';
|
|
8
8
|
import { messages, MediaImage } from '@atlaskit/media-ui';
|
|
9
9
|
import { isImageRemote } from './isImageRemote';
|
|
10
|
-
import {
|
|
10
|
+
import { CONTAINER_PADDING } from './styles';
|
|
11
|
+
import { N50A } from '@atlaskit/theme/colors';
|
|
12
|
+
import { css } from '@emotion/react';
|
|
13
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
11
14
|
import { ERROR } from '../avatar-picker-dialog';
|
|
12
15
|
import { CONTAINER_INNER_SIZE } from '../avatar-picker-dialog/layout-const';
|
|
16
|
+
const removeImageButtonStyles = css({
|
|
17
|
+
borderRadius: "var(--ds-border-radius-050, 3px)",
|
|
18
|
+
backgroundColor: 'transparent',
|
|
19
|
+
width: '24px',
|
|
20
|
+
height: '24px',
|
|
21
|
+
border: 'none',
|
|
22
|
+
cursor: 'pointer',
|
|
23
|
+
padding: 0,
|
|
24
|
+
svg: {
|
|
25
|
+
position: 'absolute',
|
|
26
|
+
top: "var(--ds-space-050, 4px)",
|
|
27
|
+
left: "var(--ds-space-050, 4px)"
|
|
28
|
+
},
|
|
29
|
+
'&:hover': {
|
|
30
|
+
backgroundColor: `var(--ds-background-neutral-hovered, ${N50A})`
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const removeImageContainerStyles = xcss({
|
|
34
|
+
position: 'absolute',
|
|
35
|
+
right: 'space.050',
|
|
36
|
+
top: 'space.050'
|
|
37
|
+
});
|
|
38
|
+
const dragOverlayStyles = xcss({
|
|
39
|
+
position: 'absolute',
|
|
40
|
+
width: '100%',
|
|
41
|
+
height: '100%',
|
|
42
|
+
cursor: 'move'
|
|
43
|
+
});
|
|
44
|
+
const maskShadow = {
|
|
45
|
+
boxShadow: `0 0 0 100px ${"var(--ds-surface-overlay, rgba(255, 255, 255))"}`
|
|
46
|
+
};
|
|
47
|
+
const maskStyles = xcss({
|
|
48
|
+
position: 'absolute',
|
|
49
|
+
top: `${CONTAINER_PADDING}px`,
|
|
50
|
+
bottom: `${CONTAINER_PADDING}px`,
|
|
51
|
+
left: `${CONTAINER_PADDING}px`,
|
|
52
|
+
right: `${CONTAINER_PADDING}px`,
|
|
53
|
+
opacity: 'opacity.disabled'
|
|
54
|
+
});
|
|
55
|
+
const rectMaskStyles = xcss({
|
|
56
|
+
borderRadius: 'border.radius.100'
|
|
57
|
+
});
|
|
58
|
+
const circularMaskStyles = xcss({
|
|
59
|
+
borderRadius: 'border.radius.circle'
|
|
60
|
+
});
|
|
61
|
+
const containerStyles = xcss({
|
|
62
|
+
position: 'relative',
|
|
63
|
+
overflow: 'hidden',
|
|
64
|
+
borderRadius: 'border.radius.100'
|
|
65
|
+
});
|
|
66
|
+
const imageContainerStyles = xcss({
|
|
67
|
+
position: 'absolute',
|
|
68
|
+
userSelect: 'none',
|
|
69
|
+
borderRadius: 'border.radius.100'
|
|
70
|
+
});
|
|
13
71
|
export class ImageCropper extends Component {
|
|
14
72
|
constructor(...args) {
|
|
15
73
|
super(...args);
|
|
@@ -57,33 +115,31 @@ export class ImageCropper extends Component {
|
|
|
57
115
|
formatMessage
|
|
58
116
|
}
|
|
59
117
|
} = this.props;
|
|
60
|
-
const
|
|
118
|
+
const containerDimensions = xcss({
|
|
61
119
|
width: `${containerSize}px`,
|
|
62
120
|
height: `${containerSize}px`
|
|
63
|
-
};
|
|
121
|
+
});
|
|
64
122
|
const width = imageWidth ? `${imageWidth}px` : 'auto';
|
|
65
123
|
const height = imageHeight ? `${imageHeight}px` : 'auto';
|
|
66
|
-
const
|
|
124
|
+
const imageContainerDynamicStyles = xcss({
|
|
67
125
|
width,
|
|
68
126
|
height,
|
|
69
127
|
display: width === 'auto' ? 'none' : 'block',
|
|
70
128
|
top: `${top}px`,
|
|
71
129
|
left: `${left}px`
|
|
72
|
-
};
|
|
130
|
+
});
|
|
73
131
|
let crossOrigin;
|
|
74
132
|
try {
|
|
75
133
|
crossOrigin = isImageRemote(imageSource) ? 'anonymous' : undefined;
|
|
76
134
|
} catch (e) {
|
|
77
135
|
return null;
|
|
78
136
|
}
|
|
79
|
-
return jsx(
|
|
137
|
+
return jsx(Box, {
|
|
80
138
|
id: "container",
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}, jsx("div", {
|
|
139
|
+
xcss: [containerStyles, containerDimensions]
|
|
140
|
+
}, jsx(Box, {
|
|
84
141
|
id: "image-container",
|
|
85
|
-
|
|
86
|
-
style: imageContainerStyle
|
|
142
|
+
xcss: [imageContainerStyles, imageContainerDynamicStyles]
|
|
87
143
|
}, jsx(MediaImage, {
|
|
88
144
|
crossOrigin: crossOrigin,
|
|
89
145
|
dataURI: imageSource,
|
|
@@ -92,17 +148,19 @@ export class ImageCropper extends Component {
|
|
|
92
148
|
previewOrientation: "from-image",
|
|
93
149
|
onImageLoad: onImageLoaded,
|
|
94
150
|
onImageError: this.onImageError
|
|
95
|
-
})), isCircularMask ? jsx(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
151
|
+
})), isCircularMask ? jsx(Box, {
|
|
152
|
+
xcss: [maskStyles, circularMaskStyles],
|
|
153
|
+
style: maskShadow
|
|
154
|
+
}) : jsx(Box, {
|
|
155
|
+
xcss: [maskStyles, rectMaskStyles],
|
|
156
|
+
style: maskShadow
|
|
157
|
+
}), jsx(Box, {
|
|
100
158
|
id: "drag-overlay",
|
|
101
|
-
|
|
159
|
+
xcss: dragOverlayStyles,
|
|
102
160
|
onMouseDown: this.onDragStarted
|
|
103
|
-
}), jsx(
|
|
161
|
+
}), jsx(Box, {
|
|
104
162
|
id: "remove-image-container",
|
|
105
|
-
|
|
163
|
+
xcss: removeImageContainerStyles
|
|
106
164
|
}, jsx("button", {
|
|
107
165
|
id: "remove-image-button",
|
|
108
166
|
css: removeImageButtonStyles,
|
|
@@ -1,71 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { borderRadius } from '@atlaskit/theme/constants';
|
|
3
|
-
import { N50A } from '@atlaskit/theme/colors';
|
|
4
|
-
|
|
5
|
-
// Using module augmentation to add crossOrigin attribute as it does not exist yet, PR has been opened in
|
|
6
|
-
// DefinitelyTyped for it
|
|
7
|
-
export const containerStyles = css`
|
|
8
|
-
position: relative;
|
|
9
|
-
overflow: hidden;
|
|
10
|
-
border-radius: ${borderRadius()}px;
|
|
11
|
-
`;
|
|
12
|
-
export const imageContainerStyles = css`
|
|
13
|
-
position: absolute;
|
|
14
|
-
/* Is needed so image is not selected, when dragged */
|
|
15
|
-
-webkit-user-select: none; /* Chrome all / Safari all */
|
|
16
|
-
-moz-user-select: none; /* Firefox all */
|
|
17
|
-
-ms-user-select: none; /* IE 10+ */
|
|
18
|
-
user-select: none; /* Likely future */
|
|
19
|
-
border-radius: ${borderRadius()}px;
|
|
20
|
-
`;
|
|
21
|
-
export const CONTAINER_PADDING = 28;
|
|
22
|
-
|
|
23
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
24
|
-
const maskStyles = css`
|
|
25
|
-
position: absolute;
|
|
26
|
-
top: ${CONTAINER_PADDING}px;
|
|
27
|
-
bottom: ${CONTAINER_PADDING}px;
|
|
28
|
-
left: ${CONTAINER_PADDING}px;
|
|
29
|
-
right: ${CONTAINER_PADDING}px;
|
|
30
|
-
box-shadow: 0 0 0 100px
|
|
31
|
-
${"var(--ds-surface-overlay, rgba(255, 255, 255))"};
|
|
32
|
-
opacity: ${"var(--ds-opacity-disabled, 0.5)"};
|
|
33
|
-
`;
|
|
34
|
-
export const rectMaskStyles = css`
|
|
35
|
-
${maskStyles};
|
|
36
|
-
border-radius: ${borderRadius()}px;
|
|
37
|
-
`;
|
|
38
|
-
export const circularMaskStyles = css`
|
|
39
|
-
${maskStyles};
|
|
40
|
-
border-radius: 500px;
|
|
41
|
-
`;
|
|
42
|
-
export const dragOverlayStyles = css`
|
|
43
|
-
position: absolute;
|
|
44
|
-
width: 100%;
|
|
45
|
-
height: 100%;
|
|
46
|
-
cursor: move;
|
|
47
|
-
`;
|
|
48
|
-
export const removeImageContainerStyles = css`
|
|
49
|
-
position: absolute;
|
|
50
|
-
right: ${"var(--ds-space-050, 4px)"};
|
|
51
|
-
top: ${"var(--ds-space-050, 4px)"};
|
|
52
|
-
`;
|
|
53
|
-
export const removeImageButtonStyles = css`
|
|
54
|
-
border-radius: ${borderRadius()}px;
|
|
55
|
-
background-color: transparent;
|
|
56
|
-
width: 24px;
|
|
57
|
-
height: 24px;
|
|
58
|
-
border: none;
|
|
59
|
-
cursor: pointer;
|
|
60
|
-
padding: 0;
|
|
61
|
-
|
|
62
|
-
svg {
|
|
63
|
-
position: absolute;
|
|
64
|
-
top: ${"var(--ds-space-050, 4px)"};
|
|
65
|
-
left: ${"var(--ds-space-050, 4px)"};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
&:hover {
|
|
69
|
-
background-color: ${`var(--ds-background-neutral-hovered, ${N50A})`};
|
|
70
|
-
}
|
|
71
|
-
`;
|
|
1
|
+
export const CONTAINER_PADDING = 28;
|
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
/**@jsx jsx */
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
|
-
import {
|
|
4
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
5
|
+
import { checkeredBg } from './styles';
|
|
6
|
+
const containerWrapperStyles = xcss({
|
|
7
|
+
background: `url('${checkeredBg}')`,
|
|
8
|
+
position: `relative`,
|
|
9
|
+
cursor: `move`,
|
|
10
|
+
userSelect: `none`,
|
|
11
|
+
overflow: `hidden`
|
|
12
|
+
});
|
|
5
13
|
export const ContainerWrapper = ({
|
|
6
14
|
width,
|
|
7
15
|
height,
|
|
8
16
|
margin,
|
|
9
17
|
children,
|
|
10
18
|
...props
|
|
11
|
-
}) =>
|
|
12
|
-
|
|
13
|
-
width
|
|
14
|
-
height
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
}) => {
|
|
20
|
+
const containerWrapperDimensions = xcss({
|
|
21
|
+
width: `${width !== undefined ? width + margin * 2 : 0}px`,
|
|
22
|
+
height: `${height !== undefined ? height + margin * 2 : 0}px`
|
|
23
|
+
});
|
|
24
|
+
return jsx(Box, _extends({
|
|
25
|
+
id: 'container-wrapper',
|
|
26
|
+
xcss: [containerWrapperStyles, containerWrapperDimensions]
|
|
27
|
+
}, props), children);
|
|
28
|
+
};
|