@micromag/element-author 0.3.832 → 0.4.6

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.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,9 +1,7 @@
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';
@@ -11,35 +9,23 @@ import { useSetting } from '@micromag/core/contexts';
11
9
 
12
10
  var styles$1 = {"container":"micromag-element-author-avatar-container","shapeCircle":"micromag-element-author-avatar-shapeCircle","shape":"micromag-element-author-avatar-shape"};
13
11
 
14
- var propTypes$1 = {
15
- image: PropTypes$1.imageElement,
16
- width: PropTypes.number,
17
- height: PropTypes.number,
18
- resolution: PropTypes.number,
19
- isTag: PropTypes.bool,
20
- shape: PropTypes.oneOf([null, 'tag', 'circle']),
21
- className: PropTypes.string,
22
- shouldLoad: PropTypes.bool
23
- };
24
- var defaultProps$1 = {
25
- image: null,
26
- width: 100,
27
- height: 100,
28
- resolution: 1,
29
- isTag: false,
30
- shape: 'circle',
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
46
  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"};
63
47
 
64
48
  var _excluded = ["author", "withImage", "withoutLink", "linkUnderlineColor", "className", "backgroundClassName", "collaboratorClassName", "shouldLoad"];
65
- var propTypes = {
66
- author: PropTypes.shape({
67
- slug: PropTypes.string,
68
- name: PropTypes$1.textElement,
69
- image: PropTypes$1.imageElement,
70
- url: PropTypes.string,
71
- collaborator: PropTypes$1.textElement
72
- }),
73
- withImage: PropTypes.bool,
74
- withoutLink: PropTypes.bool,
75
- linkUnderlineColor: PropTypes.string,
76
- className: PropTypes.string,
77
- backgroundClassName: PropTypes.string,
78
- collaboratorClassName: PropTypes.string,
79
- shouldLoad: PropTypes.bool
80
- };
81
- var defaultProps = {
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
+ .micromag-element-author-avatar-container{display:inline-block;position:relative;width:100%;z-index:1}.micromag-element-author-avatar-container.micromag-element-author-avatar-shapeCircle .micromag-element-author-avatar-shape{background-color:#fff;background-position:top;border-radius:50%;overflow:hidden}.micromag-element-author-avatar-container .micromag-element-author-avatar-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
+ .micromag-element-author-container{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;vertical-align:center}.micromag-element-author-container .micromag-element-author-image{margin-right:10px;max-width:35px}.micromag-element-author-container .micromag-element-author-link{-webkit-text-decoration:none;text-decoration:none}.micromag-element-author-container .micromag-element-author-right{display:block;-ms-flex-positive:1;flex-grow:1}.micromag-element-author-container .micromag-element-author-name p{display:inline;margin:0}.micromag-element-author-container .micromag-element-author-collaborator{background-color:transparent}.micromag-element-author-container .micromag-element-author-collaborator .micromag-element-author-collaboratorText{font-size:inherit}.micromag-element-author-container .micromag-element-author-collaborator .micromag-element-author-collaboratorText p{display:inline}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/element-author",
3
- "version": "0.3.832",
3
+ "version": "0.4.6",
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": "^16.8.0 || ^17.0.0 || ^18.0.0",
54
- "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
55
+ "react": "^19.2.0",
56
+ "react-dom": "^18.3.0 || ^19.0.0"
55
57
  },
56
58
  "peerDependencies": {
57
- "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
58
- "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
59
+ "react": "^19.2.0",
60
+ "react-dom": "^18.3.0 || ^19.0.0"
59
61
  },
60
62
  "dependencies": {
61
- "@babel/runtime": "^7.13.10",
62
- "@micromag/core": "^0.3.832",
63
- "@micromag/element-button": "^0.3.832",
64
- "@micromag/element-link": "^0.3.832",
65
- "@micromag/element-text": "^0.3.832",
63
+ "@babel/runtime": "^7.28.6",
64
+ "@micromag/core": "^0.4.6",
65
+ "@micromag/element-button": "^0.4.6",
66
+ "@micromag/element-link": "^0.4.6",
67
+ "@micromag/element-text": "^0.4.6",
66
68
  "classnames": "^2.2.6",
67
- "lodash": "^4.17.21",
68
- "prop-types": "^15.7.2",
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": "4969d64e304334cfd47321e624e5914e0694c55f"
77
+ "gitHead": "cf8440c2851b864167a1f545aa56551d55473263"
77
78
  }