@micromag/element-author 0.3.832 → 0.4.4
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/assets/css/styles.css +2 -2
- package/es/index.d.ts +22 -0
- package/es/index.js +38 -74
- package/es/styles.css +2 -0
- package/package.json +16 -15
package/assets/css/styles.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.
|
|
2
|
-
.
|
|
1
|
+
.container{display:inline-block;position:relative;width:100%;z-index:1}.container.shapeCircle .shape{background-color:#fff;background-position:top;border-radius:50%;overflow:hidden}.container .shape{background-color:#fff;background-position:50%;background-repeat:no-repeat;background-size:cover;-webkit-box-shadow:0 0 4px rgba(0,0,0,.2);box-shadow:0 0 4px rgba(0,0,0,.2);display:block;height:0;padding-bottom:100%;width:100%}
|
|
2
|
+
.container{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;vertical-align:center}.container .image{margin-right:10px;max-width:35px}.container .link{-webkit-text-decoration:none;text-decoration:none}.container .right{display:block;-ms-flex-positive:1;flex-grow:1}.container .name p{display:inline;margin:0}.container .collaborator{background-color:transparent}.container .collaborator .collaboratorText{font-size:inherit}.container .collaborator .collaboratorText p{display:inline}
|
package/es/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { TextElement, ImageElement } from '@micromag/core';
|
|
3
|
+
|
|
4
|
+
interface AuthorProps {
|
|
5
|
+
author?: {
|
|
6
|
+
slug?: string;
|
|
7
|
+
name?: TextElement;
|
|
8
|
+
image?: ImageElement;
|
|
9
|
+
url?: string;
|
|
10
|
+
collaborator?: TextElement;
|
|
11
|
+
} | null;
|
|
12
|
+
withImage?: boolean;
|
|
13
|
+
withoutLink?: boolean;
|
|
14
|
+
linkUnderlineColor?: string | null;
|
|
15
|
+
className?: string | null;
|
|
16
|
+
backgroundClassName?: string | null;
|
|
17
|
+
collaboratorClassName?: string | null;
|
|
18
|
+
shouldLoad?: boolean;
|
|
19
|
+
}
|
|
20
|
+
declare function Author({ author, withImage, withoutLink, linkUnderlineColor, className, backgroundClassName, collaboratorClassName, shouldLoad, ...otherProps }: AuthorProps): react_jsx_runtime.JSX.Element;
|
|
21
|
+
|
|
22
|
+
export { Author as default };
|
package/es/index.js
CHANGED
|
@@ -1,45 +1,31 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
4
|
import React from 'react';
|
|
6
|
-
import { PropTypes as PropTypes$1 } from '@micromag/core';
|
|
7
5
|
import { getOptimalImageUrl, pascalCase, isTextFilled } from '@micromag/core/utils';
|
|
8
6
|
import Link from '@micromag/element-link';
|
|
9
7
|
import Text from '@micromag/element-text';
|
|
10
8
|
import { useSetting } from '@micromag/core/contexts';
|
|
11
9
|
|
|
12
|
-
var styles$1 = {"container":"
|
|
10
|
+
var styles$1 = {"container":"container","shapeCircle":"shapeCircle","shape":"shape"};
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
image
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
className: null,
|
|
32
|
-
shouldLoad: true
|
|
33
|
-
};
|
|
34
|
-
var Avatar = function Avatar(_ref) {
|
|
35
|
-
var image = _ref.image,
|
|
36
|
-
width = _ref.width,
|
|
37
|
-
height = _ref.height,
|
|
38
|
-
resolution = _ref.resolution,
|
|
39
|
-
shape = _ref.shape,
|
|
40
|
-
isTag = _ref.isTag,
|
|
41
|
-
className = _ref.className,
|
|
42
|
-
shouldLoad = _ref.shouldLoad;
|
|
12
|
+
function Avatar(_ref) {
|
|
13
|
+
var _ref$image = _ref.image,
|
|
14
|
+
image = _ref$image === void 0 ? null : _ref$image,
|
|
15
|
+
_ref$width = _ref.width,
|
|
16
|
+
width = _ref$width === void 0 ? 100 : _ref$width,
|
|
17
|
+
_ref$height = _ref.height,
|
|
18
|
+
height = _ref$height === void 0 ? 100 : _ref$height,
|
|
19
|
+
_ref$resolution = _ref.resolution,
|
|
20
|
+
resolution = _ref$resolution === void 0 ? 1 : _ref$resolution,
|
|
21
|
+
_ref$shape = _ref.shape,
|
|
22
|
+
shape = _ref$shape === void 0 ? 'circle' : _ref$shape,
|
|
23
|
+
_ref$isTag = _ref.isTag,
|
|
24
|
+
isTag = _ref$isTag === void 0 ? false : _ref$isTag,
|
|
25
|
+
_ref$className = _ref.className,
|
|
26
|
+
className = _ref$className === void 0 ? null : _ref$className,
|
|
27
|
+
_ref$shouldLoad = _ref.shouldLoad,
|
|
28
|
+
shouldLoad = _ref$shouldLoad === void 0 ? true : _ref$shouldLoad;
|
|
43
29
|
var supportsWebp = useSetting('supportsWebp', false);
|
|
44
30
|
var imageResolution = useSetting('imageResolution', resolution);
|
|
45
31
|
var imageAtSize = getOptimalImageUrl(image, width, height, {
|
|
@@ -55,48 +41,28 @@ var Avatar = function Avatar(_ref) {
|
|
|
55
41
|
backgroundImage: shouldLoad ? "url(\"".concat(imageAtSize, "\")") : null
|
|
56
42
|
}
|
|
57
43
|
}));
|
|
58
|
-
}
|
|
59
|
-
Avatar.propTypes = propTypes$1;
|
|
60
|
-
Avatar.defaultProps = defaultProps$1;
|
|
44
|
+
}
|
|
61
45
|
|
|
62
|
-
var styles = {"container":"
|
|
46
|
+
var styles = {"container":"container","image":"image","link":"link","right":"right","name":"name","collaborator":"collaborator","collaboratorText":"collaboratorText"};
|
|
63
47
|
|
|
64
48
|
var _excluded = ["author", "withImage", "withoutLink", "linkUnderlineColor", "className", "backgroundClassName", "collaboratorClassName", "shouldLoad"];
|
|
65
|
-
|
|
66
|
-
author
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
author: null,
|
|
83
|
-
withImage: true,
|
|
84
|
-
withoutLink: false,
|
|
85
|
-
linkUnderlineColor: null,
|
|
86
|
-
className: null,
|
|
87
|
-
backgroundClassName: null,
|
|
88
|
-
collaboratorClassName: null,
|
|
89
|
-
shouldLoad: true
|
|
90
|
-
};
|
|
91
|
-
var Author = function Author(_ref) {
|
|
92
|
-
var author = _ref.author,
|
|
93
|
-
withImage = _ref.withImage,
|
|
94
|
-
withoutLink = _ref.withoutLink,
|
|
95
|
-
linkUnderlineColor = _ref.linkUnderlineColor,
|
|
96
|
-
className = _ref.className,
|
|
97
|
-
backgroundClassName = _ref.backgroundClassName,
|
|
98
|
-
collaboratorClassName = _ref.collaboratorClassName,
|
|
99
|
-
shouldLoad = _ref.shouldLoad,
|
|
49
|
+
function Author(_ref) {
|
|
50
|
+
var _ref$author = _ref.author,
|
|
51
|
+
author = _ref$author === void 0 ? null : _ref$author,
|
|
52
|
+
_ref$withImage = _ref.withImage,
|
|
53
|
+
withImage = _ref$withImage === void 0 ? true : _ref$withImage,
|
|
54
|
+
_ref$withoutLink = _ref.withoutLink,
|
|
55
|
+
withoutLink = _ref$withoutLink === void 0 ? false : _ref$withoutLink,
|
|
56
|
+
_ref$linkUnderlineCol = _ref.linkUnderlineColor,
|
|
57
|
+
linkUnderlineColor = _ref$linkUnderlineCol === void 0 ? null : _ref$linkUnderlineCol,
|
|
58
|
+
_ref$className = _ref.className,
|
|
59
|
+
className = _ref$className === void 0 ? null : _ref$className,
|
|
60
|
+
_ref$backgroundClassN = _ref.backgroundClassName,
|
|
61
|
+
backgroundClassName = _ref$backgroundClassN === void 0 ? null : _ref$backgroundClassN,
|
|
62
|
+
_ref$collaboratorClas = _ref.collaboratorClassName,
|
|
63
|
+
collaboratorClassName = _ref$collaboratorClas === void 0 ? null : _ref$collaboratorClas,
|
|
64
|
+
_ref$shouldLoad = _ref.shouldLoad,
|
|
65
|
+
shouldLoad = _ref$shouldLoad === void 0 ? true : _ref$shouldLoad,
|
|
100
66
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
101
67
|
var _ref2 = author || {},
|
|
102
68
|
_ref2$name = _ref2.name,
|
|
@@ -134,8 +100,6 @@ var Author = function Author(_ref) {
|
|
|
134
100
|
}, authorText) : /*#__PURE__*/React.createElement("div", null, authorText), collaboratorText !== null ? /*#__PURE__*/React.createElement("div", {
|
|
135
101
|
className: classNames([styles.collaborator, _defineProperty({}, collaboratorClassName, collaboratorClassName)])
|
|
136
102
|
}, collaboratorText !== null ? collaboratorText : null) : null));
|
|
137
|
-
}
|
|
138
|
-
Author.propTypes = propTypes;
|
|
139
|
-
Author.defaultProps = defaultProps;
|
|
103
|
+
}
|
|
140
104
|
|
|
141
105
|
export { Author as default };
|
package/es/styles.css
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.container{display:inline-block;position:relative;width:100%;z-index:1}.container.shapeCircle .shape{background-color:#fff;background-position:top;border-radius:50%;overflow:hidden}.container .shape{background-color:#fff;background-position:50%;background-repeat:no-repeat;background-size:cover;-webkit-box-shadow:0 0 4px rgba(0,0,0,.2);box-shadow:0 0 4px rgba(0,0,0,.2);display:block;height:0;padding-bottom:100%;width:100%}
|
|
2
|
+
.container{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;vertical-align:center}.container .image{margin-right:10px;max-width:35px}.container .link{-webkit-text-decoration:none;text-decoration:none}.container .right{display:block;-ms-flex-positive:1;flex-grow:1}.container .name p{display:inline;margin:0}.container .collaborator{background-color:transparent}.container .collaborator .collaboratorText{font-size:inherit}.container .collaborator .collaboratorText p{display:inline}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-author",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -32,9 +32,11 @@
|
|
|
32
32
|
"license": "ISC",
|
|
33
33
|
"type": "module",
|
|
34
34
|
"module": "es/index.js",
|
|
35
|
+
"types": "es/index.d.ts",
|
|
35
36
|
"exports": {
|
|
36
37
|
".": {
|
|
37
|
-
"import": "./es/index.js"
|
|
38
|
+
"import": "./es/index.js",
|
|
39
|
+
"types": "./es/index.d.ts"
|
|
38
40
|
},
|
|
39
41
|
"./assets/css/styles": "./assets/css/styles.css",
|
|
40
42
|
"./assets/css/styles.css": "./assets/css/styles.css"
|
|
@@ -47,31 +49,30 @@
|
|
|
47
49
|
"scripts": {
|
|
48
50
|
"clean": "rm -rf es && rm -rf lib && rm -rf assets",
|
|
49
51
|
"prepublishOnly": "npm run build",
|
|
50
|
-
"build": "../../scripts/prepare-package.sh"
|
|
52
|
+
"build": "../../scripts/prepare-package.sh --types"
|
|
51
53
|
},
|
|
52
54
|
"devDependencies": {
|
|
53
|
-
"react": "^
|
|
54
|
-
"react-dom": "^
|
|
55
|
+
"react": "^19.2.0",
|
|
56
|
+
"react-dom": "^18.3.0 || ^19.0.0"
|
|
55
57
|
},
|
|
56
58
|
"peerDependencies": {
|
|
57
|
-
"react": "^
|
|
58
|
-
"react-dom": "^
|
|
59
|
+
"react": "^19.2.0",
|
|
60
|
+
"react-dom": "^18.3.0 || ^19.0.0"
|
|
59
61
|
},
|
|
60
62
|
"dependencies": {
|
|
61
63
|
"@babel/runtime": "^7.13.10",
|
|
62
|
-
"@micromag/core": "^0.
|
|
63
|
-
"@micromag/element-button": "^0.
|
|
64
|
-
"@micromag/element-link": "^0.
|
|
65
|
-
"@micromag/element-text": "^0.
|
|
64
|
+
"@micromag/core": "^0.4.4",
|
|
65
|
+
"@micromag/element-button": "^0.4.4",
|
|
66
|
+
"@micromag/element-link": "^0.4.4",
|
|
67
|
+
"@micromag/element-text": "^0.4.4",
|
|
66
68
|
"classnames": "^2.2.6",
|
|
67
|
-
"lodash": "^4.17.
|
|
68
|
-
"
|
|
69
|
-
"react-intl": "^6.6.4",
|
|
69
|
+
"lodash": "^4.17.23",
|
|
70
|
+
"react-intl": "^8.1.3",
|
|
70
71
|
"uuid": "^9.0.0"
|
|
71
72
|
},
|
|
72
73
|
"publishConfig": {
|
|
73
74
|
"access": "public",
|
|
74
75
|
"registry": "https://registry.npmjs.org/"
|
|
75
76
|
},
|
|
76
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "04b8519c3a3ddace5a21497e22faa11865d57f6d"
|
|
77
78
|
}
|