@micromag/element-author 0.3.541 → 0.3.569

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/es/index.js CHANGED
@@ -54,7 +54,6 @@ var Avatar = function Avatar(_ref) {
54
54
  };
55
55
  Avatar.propTypes = propTypes$1;
56
56
  Avatar.defaultProps = defaultProps$1;
57
- var Avatar$1 = Avatar;
58
57
 
59
58
  var styles = {"container":"micromag-element-author-container","image":"micromag-element-author-image","link":"micromag-element-author-link","right":"micromag-element-author-right","name":"micromag-element-author-name","collaborator":"micromag-element-author-collaborator","collaboratorText":"micromag-element-author-collaboratorText"};
60
59
 
@@ -115,7 +114,7 @@ var Author = function Author(_ref) {
115
114
  })) : null;
116
115
  return /*#__PURE__*/React.createElement("div", Object.assign({
117
116
  className: classNames([styles.container, _defineProperty({}, className, className !== null)])
118
- }, otherProps), withAvatar ? /*#__PURE__*/React.createElement(Avatar$1, {
117
+ }, otherProps), withAvatar ? /*#__PURE__*/React.createElement(Avatar, {
119
118
  className: styles.image,
120
119
  image: image,
121
120
  shouldLoad: shouldLoad
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/element-author",
3
- "version": "0.3.541",
3
+ "version": "0.3.569",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -30,11 +30,10 @@
30
30
  }
31
31
  ],
32
32
  "license": "ISC",
33
- "main": "lib/index.js",
33
+ "type": "module",
34
34
  "module": "es/index.js",
35
35
  "exports": {
36
36
  ".": {
37
- "require": "./lib/index.js",
38
37
  "import": "./es/index.js"
39
38
  },
40
39
  "./assets/css/styles": "./assets/css/styles.css",
@@ -60,10 +59,10 @@
60
59
  },
61
60
  "dependencies": {
62
61
  "@babel/runtime": "^7.13.10",
63
- "@micromag/core": "^0.3.541",
64
- "@micromag/element-button": "^0.3.541",
65
- "@micromag/element-link": "^0.3.541",
66
- "@micromag/element-text": "^0.3.541",
62
+ "@micromag/core": "^0.3.569",
63
+ "@micromag/element-button": "^0.3.569",
64
+ "@micromag/element-link": "^0.3.569",
65
+ "@micromag/element-text": "^0.3.569",
67
66
  "classnames": "^2.2.6",
68
67
  "lodash": "^4.17.21",
69
68
  "prop-types": "^15.7.2",
@@ -74,5 +73,5 @@
74
73
  "access": "public",
75
74
  "registry": "https://registry.npmjs.org/"
76
75
  },
77
- "gitHead": "6c04a7e327b5fbc096785c11320b3fbd3c5751c8"
76
+ "gitHead": "ceb71f23a32ab8df4a1563a1e5cd5598e539de4d"
78
77
  }
package/lib/index.js DELETED
@@ -1,141 +0,0 @@
1
- 'use strict';
2
-
3
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
- var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
5
- var classNames = require('classnames');
6
- var PropTypes = require('prop-types');
7
- var React = require('react');
8
- var core = require('@micromag/core');
9
- var utils = require('@micromag/core/utils');
10
- var Link = require('@micromag/element-link');
11
- var Text = require('@micromag/element-text');
12
-
13
- var styles$1 = {"container":"micromag-element-author-avatar-container","shapeCircle":"micromag-element-author-avatar-shapeCircle","shape":"micromag-element-author-avatar-shape"};
14
-
15
- var propTypes$1 = {
16
- image: core.PropTypes.imageElement,
17
- width: PropTypes.number,
18
- height: PropTypes.number,
19
- resolution: PropTypes.number,
20
- isTag: PropTypes.bool,
21
- shape: PropTypes.oneOf([null, 'tag', 'circle']),
22
- className: PropTypes.string,
23
- shouldLoad: PropTypes.bool
24
- };
25
- var defaultProps$1 = {
26
- image: null,
27
- width: 100,
28
- height: 100,
29
- resolution: 1,
30
- isTag: false,
31
- shape: 'circle',
32
- className: null,
33
- shouldLoad: true
34
- };
35
- var Avatar = function Avatar(_ref) {
36
- var image = _ref.image,
37
- width = _ref.width,
38
- height = _ref.height,
39
- resolution = _ref.resolution,
40
- shape = _ref.shape,
41
- isTag = _ref.isTag,
42
- className = _ref.className,
43
- shouldLoad = _ref.shouldLoad;
44
- var imageAtSize = utils.getOptimalImageUrl(image, width, height, {
45
- resolution: resolution
46
- });
47
- var finalShape = shape !== null ? utils.pascalCase(shape) : null;
48
- return /*#__PURE__*/React.createElement("span", {
49
- className: classNames([styles$1.container, _defineProperty(_defineProperty(_defineProperty({}, styles$1["shape".concat(finalShape)], finalShape !== null), styles$1.isTag, isTag), className, className !== null)])
50
- }, /*#__PURE__*/React.createElement("span", {
51
- className: styles$1.shape,
52
- style: {
53
- backgroundImage: shouldLoad ? "url(\"".concat(imageAtSize, "\")") : null
54
- }
55
- }));
56
- };
57
- Avatar.propTypes = propTypes$1;
58
- Avatar.defaultProps = defaultProps$1;
59
- var Avatar$1 = Avatar;
60
-
61
- var styles = {"container":"micromag-element-author-container","image":"micromag-element-author-image","link":"micromag-element-author-link","right":"micromag-element-author-right","name":"micromag-element-author-name","collaborator":"micromag-element-author-collaborator","collaboratorText":"micromag-element-author-collaboratorText"};
62
-
63
- var _excluded = ["author", "withImage", "withoutLink", "linkUnderlineColor", "className", "backgroundClassName", "collaboratorClassName", "shouldLoad"];
64
- var propTypes = {
65
- author: PropTypes.shape({
66
- slug: PropTypes.string,
67
- name: core.PropTypes.textElement,
68
- image: core.PropTypes.imageElement,
69
- url: PropTypes.string,
70
- collaborator: core.PropTypes.textElement
71
- }),
72
- withImage: PropTypes.bool,
73
- withoutLink: PropTypes.bool,
74
- linkUnderlineColor: PropTypes.string,
75
- className: PropTypes.string,
76
- backgroundClassName: PropTypes.string,
77
- collaboratorClassName: PropTypes.string,
78
- shouldLoad: PropTypes.bool
79
- };
80
- var defaultProps = {
81
- author: null,
82
- withImage: true,
83
- withoutLink: false,
84
- linkUnderlineColor: null,
85
- className: null,
86
- backgroundClassName: null,
87
- collaboratorClassName: null,
88
- shouldLoad: true
89
- };
90
- var Author = function Author(_ref) {
91
- var author = _ref.author,
92
- withImage = _ref.withImage,
93
- withoutLink = _ref.withoutLink,
94
- linkUnderlineColor = _ref.linkUnderlineColor,
95
- className = _ref.className,
96
- backgroundClassName = _ref.backgroundClassName,
97
- collaboratorClassName = _ref.collaboratorClassName,
98
- shouldLoad = _ref.shouldLoad,
99
- otherProps = _objectWithoutProperties(_ref, _excluded);
100
- var _ref2 = author || {},
101
- _ref2$name = _ref2.name,
102
- name = _ref2$name === void 0 ? null : _ref2$name,
103
- _ref2$image = _ref2.image,
104
- image = _ref2$image === void 0 ? null : _ref2$image,
105
- _ref2$url = _ref2.url,
106
- url = _ref2$url === void 0 ? null : _ref2$url,
107
- _ref2$collaborator = _ref2.collaborator,
108
- collaborator = _ref2$collaborator === void 0 ? null : _ref2$collaborator;
109
- var withAvatar = withImage && image !== null;
110
- var authorText = utils.isTextFilled(name) ? /*#__PURE__*/React.createElement(Text, Object.assign({
111
- className: classNames([styles.name, _defineProperty({}, backgroundClassName, backgroundClassName)])
112
- }, name)) : null;
113
- var collaboratorText = utils.isTextFilled(collaborator) ? /*#__PURE__*/React.createElement(Text, Object.assign({
114
- className: styles.collaboratorText
115
- }, collaborator, {
116
- inline: true
117
- })) : null;
118
- return /*#__PURE__*/React.createElement("div", Object.assign({
119
- className: classNames([styles.container, _defineProperty({}, className, className !== null)])
120
- }, otherProps), withAvatar ? /*#__PURE__*/React.createElement(Avatar$1, {
121
- className: styles.image,
122
- image: image,
123
- shouldLoad: shouldLoad
124
- }) : null, /*#__PURE__*/React.createElement("div", {
125
- className: styles.right
126
- }, url !== null && !withoutLink ? /*#__PURE__*/React.createElement(Link, {
127
- className: styles.link,
128
- url: url,
129
- external: true,
130
- style: {
131
- backgroundImage: linkUnderlineColor !== null ? "linear-gradient(0deg, ".concat(linkUnderlineColor, " 0, ").concat(linkUnderlineColor, ")") : null
132
- }
133
- }, authorText) : /*#__PURE__*/React.createElement("div", null, authorText), collaboratorText !== null ? /*#__PURE__*/React.createElement("div", {
134
- className: classNames([styles.collaborator, _defineProperty({}, collaboratorClassName, collaboratorClassName)])
135
- }, collaboratorText !== null ? collaboratorText : null) : null));
136
- };
137
- Author.propTypes = propTypes;
138
- Author.defaultProps = defaultProps;
139
- var Author$1 = Author;
140
-
141
- module.exports = Author$1;