@micromag/element-urbania-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
@@ -55,7 +55,6 @@ var Avatar = function Avatar(_ref) {
55
55
  };
56
56
  Avatar.propTypes = propTypes$1;
57
57
  Avatar.defaultProps = defaultProps$1;
58
- var Avatar$1 = Avatar;
59
58
 
60
59
  var styles = {"container":"micromag-element-urbania-author-container","image":"micromag-element-urbania-author-image","link":"micromag-element-urbania-author-link","right":"micromag-element-urbania-author-right","name":"micromag-element-urbania-author-name","prefix":"micromag-element-urbania-author-prefix","collaborator":"micromag-element-urbania-author-collaborator","collaboratorText":"micromag-element-urbania-author-collaboratorText","isSmall":"micromag-element-urbania-author-isSmall","withoutImage":"micromag-element-urbania-author-withoutImage","withoutBackground":"micromag-element-urbania-author-withoutBackground"};
61
60
 
@@ -136,7 +135,7 @@ var UrbaniaAuthor = function UrbaniaAuthor(_ref) {
136
135
  }, otherProps), !withoutPrefix ? /*#__PURE__*/React.createElement(Text, Object.assign({}, name, {
137
136
  className: classNames([styles.prefix, _defineProperty({}, backgroundClassName, backgroundClassName)]),
138
137
  body: "<span>".concat(prefix, "<span>")
139
- })) : null, withAvatar ? /*#__PURE__*/React.createElement(Avatar$1, {
138
+ })) : null, withAvatar ? /*#__PURE__*/React.createElement(Avatar, {
140
139
  className: styles.image,
141
140
  image: image,
142
141
  shouldLoad: shouldLoad
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/element-urbania-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,162 +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 reactIntl = require('react-intl');
9
- var core = require('@micromag/core');
10
- var utils = require('@micromag/core/utils');
11
- var Link = require('@micromag/element-link');
12
- var Text = require('@micromag/element-text');
13
-
14
- var styles$1 = {"container":"micromag-element-urbania-author-avatar-container","shapeCircle":"micromag-element-urbania-author-avatar-shapeCircle","shape":"micromag-element-urbania-author-avatar-shape"};
15
-
16
- var propTypes$1 = {
17
- image: core.PropTypes.imageElement,
18
- width: PropTypes.number,
19
- height: PropTypes.number,
20
- resolution: PropTypes.number,
21
- isTag: PropTypes.bool,
22
- shape: PropTypes.oneOf([null, 'tag', 'circle']),
23
- className: PropTypes.string,
24
- shouldLoad: PropTypes.bool
25
- };
26
- var defaultProps$1 = {
27
- image: null,
28
- width: 100,
29
- height: 100,
30
- resolution: 1,
31
- isTag: false,
32
- shape: 'circle',
33
- className: null,
34
- shouldLoad: true
35
- };
36
- var Avatar = function Avatar(_ref) {
37
- var image = _ref.image,
38
- width = _ref.width,
39
- height = _ref.height,
40
- resolution = _ref.resolution,
41
- shape = _ref.shape,
42
- isTag = _ref.isTag,
43
- className = _ref.className,
44
- shouldLoad = _ref.shouldLoad;
45
- var imageAtSize = utils.getOptimalImageUrl(image, width, height, {
46
- resolution: resolution
47
- });
48
- var finalShape = shape !== null ? utils.pascalCase(shape) : null;
49
- return /*#__PURE__*/React.createElement("span", {
50
- className: classNames([styles$1.container, _defineProperty(_defineProperty(_defineProperty({}, styles$1["shape".concat(finalShape)], finalShape !== null), styles$1.isTag, isTag), className, className !== null)])
51
- }, /*#__PURE__*/React.createElement("span", {
52
- className: styles$1.shape,
53
- style: {
54
- backgroundImage: shouldLoad ? "url(\"".concat(imageAtSize, "\")") : null
55
- }
56
- }));
57
- };
58
- Avatar.propTypes = propTypes$1;
59
- Avatar.defaultProps = defaultProps$1;
60
- var Avatar$1 = Avatar;
61
-
62
- var styles = {"container":"micromag-element-urbania-author-container","image":"micromag-element-urbania-author-image","link":"micromag-element-urbania-author-link","right":"micromag-element-urbania-author-right","name":"micromag-element-urbania-author-name","prefix":"micromag-element-urbania-author-prefix","collaborator":"micromag-element-urbania-author-collaborator","collaboratorText":"micromag-element-urbania-author-collaboratorText","isSmall":"micromag-element-urbania-author-isSmall","withoutImage":"micromag-element-urbania-author-withoutImage","withoutBackground":"micromag-element-urbania-author-withoutBackground"};
63
-
64
- var _excluded = ["author", "withImage", "withoutLink", "withoutPrefix", "withoutBackground", "isSmall", "linkUnderlineColor", "className", "backgroundClassName", "collaboratorClassName", "shouldLoad"];
65
- var propTypes = {
66
- author: PropTypes.shape({
67
- slug: PropTypes.string,
68
- name: core.PropTypes.textElement,
69
- image: core.PropTypes.imageElement,
70
- url: PropTypes.string,
71
- collaborator: core.PropTypes.textElement
72
- }),
73
- withImage: PropTypes.bool,
74
- withoutLink: PropTypes.bool,
75
- withoutPrefix: PropTypes.bool,
76
- withoutBackground: PropTypes.bool,
77
- isSmall: PropTypes.bool,
78
- linkUnderlineColor: PropTypes.string,
79
- className: PropTypes.string,
80
- backgroundClassName: PropTypes.string,
81
- collaboratorClassName: PropTypes.string,
82
- shouldLoad: PropTypes.bool
83
- };
84
- var defaultProps = {
85
- author: null,
86
- withImage: true,
87
- withoutLink: false,
88
- withoutPrefix: false,
89
- withoutBackground: false,
90
- isSmall: false,
91
- linkUnderlineColor: null,
92
- className: null,
93
- backgroundClassName: null,
94
- collaboratorClassName: null,
95
- shouldLoad: true
96
- };
97
- var UrbaniaAuthor = function UrbaniaAuthor(_ref) {
98
- var author = _ref.author,
99
- withImage = _ref.withImage,
100
- withoutLink = _ref.withoutLink,
101
- withoutPrefix = _ref.withoutPrefix,
102
- withoutBackground = _ref.withoutBackground,
103
- isSmall = _ref.isSmall,
104
- linkUnderlineColor = _ref.linkUnderlineColor,
105
- className = _ref.className,
106
- backgroundClassName = _ref.backgroundClassName,
107
- collaboratorClassName = _ref.collaboratorClassName,
108
- shouldLoad = _ref.shouldLoad,
109
- otherProps = _objectWithoutProperties(_ref, _excluded);
110
- var intl = reactIntl.useIntl();
111
- var _ref2 = author || {},
112
- _ref2$name = _ref2.name,
113
- name = _ref2$name === void 0 ? null : _ref2$name,
114
- _ref2$image = _ref2.image,
115
- image = _ref2$image === void 0 ? null : _ref2$image,
116
- _ref2$url = _ref2.url,
117
- url = _ref2$url === void 0 ? null : _ref2$url,
118
- _ref2$collaborator = _ref2.collaborator,
119
- collaborator = _ref2$collaborator === void 0 ? null : _ref2$collaborator;
120
- var withAvatar = withImage && image !== null;
121
- var prefix = intl.formatMessage({
122
- id: "jEK6B8",
123
- defaultMessage: [{
124
- "type": 0,
125
- "value": "By"
126
- }]
127
- });
128
- var authorText = utils.isTextFilled(name) ? /*#__PURE__*/React.createElement(Text, Object.assign({
129
- className: classNames([styles.name, _defineProperty({}, backgroundClassName, backgroundClassName)])
130
- }, name)) : null;
131
- var collaboratorText = utils.isTextFilled(collaborator) ? /*#__PURE__*/React.createElement(Text, Object.assign({
132
- className: styles.collaboratorText
133
- }, collaborator, {
134
- inline: true
135
- })) : null;
136
- return /*#__PURE__*/React.createElement("div", Object.assign({
137
- className: classNames([styles.container, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles.isSmall, isSmall), styles.withoutAvatar, withAvatar), styles.withoutImage, !withImage || image === null), styles.withoutBackground, withoutBackground), className, className !== null)])
138
- }, otherProps), !withoutPrefix ? /*#__PURE__*/React.createElement(Text, Object.assign({}, name, {
139
- className: classNames([styles.prefix, _defineProperty({}, backgroundClassName, backgroundClassName)]),
140
- body: "<span>".concat(prefix, "<span>")
141
- })) : null, withAvatar ? /*#__PURE__*/React.createElement(Avatar$1, {
142
- className: styles.image,
143
- image: image,
144
- shouldLoad: shouldLoad
145
- }) : null, /*#__PURE__*/React.createElement("div", {
146
- className: styles.right
147
- }, url !== null && !withoutLink ? /*#__PURE__*/React.createElement(Link, {
148
- className: styles.link,
149
- url: url,
150
- external: true,
151
- style: {
152
- backgroundImage: linkUnderlineColor !== null ? "linear-gradient(0deg, ".concat(linkUnderlineColor, " 0, ").concat(linkUnderlineColor, ")") : null
153
- }
154
- }, authorText) : /*#__PURE__*/React.createElement("div", null, authorText), collaboratorText !== null ? /*#__PURE__*/React.createElement("div", {
155
- className: classNames([styles.collaborator, _defineProperty({}, collaboratorClassName, collaboratorClassName)])
156
- }, collaboratorText !== null ? collaboratorText : null) : null));
157
- };
158
- UrbaniaAuthor.propTypes = propTypes;
159
- UrbaniaAuthor.defaultProps = defaultProps;
160
- var UrbaniaAuthor$1 = UrbaniaAuthor;
161
-
162
- module.exports = UrbaniaAuthor$1;