@micromag/element-link 0.4.69 → 0.4.74

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.
Files changed (2) hide show
  1. package/es/index.js +91 -43
  2. package/package.json +9 -7
package/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import _objectSpread from '@babel/runtime/helpers/objectSpread2';
1
+ import { c } from 'react/compiler-runtime';
2
2
  import classNames from 'classnames';
3
3
  import { useId } from 'react';
4
4
  import { getStyleFromMargin } from '@micromag/core/utils';
@@ -6,53 +6,101 @@ import { jsx } from 'react/jsx-runtime';
6
6
 
7
7
  var styles = {"container":"micromag-element-link-container"};
8
8
 
9
- function Link(_ref) {
10
- var _ref$url = _ref.url,
11
- url = _ref$url === void 0 ? null : _ref$url,
12
- _ref$target = _ref.target,
13
- linkTarget = _ref$target === void 0 ? null : _ref$target,
14
- _ref$rel = _ref.rel,
15
- linkRel = _ref$rel === void 0 ? null : _ref$rel,
16
- _ref$external = _ref.external,
17
- external = _ref$external === void 0 ? true : _ref$external,
18
- _ref$margin = _ref.margin,
19
- margin = _ref$margin === void 0 ? null : _ref$margin,
20
- _ref$className = _ref.className,
21
- className = _ref$className === void 0 ? null : _ref$className,
22
- _ref$children = _ref.children,
23
- children = _ref$children === void 0 ? null : _ref$children,
24
- _ref$focusable = _ref.focusable,
25
- focusable = _ref$focusable === void 0 ? true : _ref$focusable;
26
- var finalStyle = null;
9
+ function Link(t0) {
10
+ const $ = c(17);
11
+ const {
12
+ url: t1,
13
+ target: t2,
14
+ rel: t3,
15
+ external: t4,
16
+ margin: t5,
17
+ className: t6,
18
+ children: t7,
19
+ focusable: t8
20
+ } = t0;
21
+ const url = t1 === undefined ? null : t1;
22
+ const linkTarget = t2 === undefined ? null : t2;
23
+ const linkRel = t3 === undefined ? null : t3;
24
+ const external = t4 === undefined ? true : t4;
25
+ const margin = t5 === undefined ? null : t5;
26
+ const className = t6 === undefined ? null : t6;
27
+ const children = t7 === undefined ? null : t7;
28
+ const focusable = t8 === undefined ? true : t8;
29
+ let finalStyle = null;
27
30
  if (margin !== null) {
28
- finalStyle = _objectSpread(_objectSpread({}, finalStyle), getStyleFromMargin(margin));
31
+ let t9;
32
+ if ($[0] !== margin) {
33
+ t9 = getStyleFromMargin(margin);
34
+ $[0] = margin;
35
+ $[1] = t9;
36
+ } else {
37
+ t9 = $[1];
38
+ }
39
+ let t10;
40
+ if ($[2] !== t9) {
41
+ t10 = {
42
+ ...null,
43
+ ...t9
44
+ };
45
+ $[2] = t9;
46
+ $[3] = t10;
47
+ } else {
48
+ t10 = $[3];
49
+ }
50
+ finalStyle = t10;
29
51
  }
30
- var uniqueId = useId();
31
- var id = finalStyle !== null ? "link-component-".concat(uniqueId) : null;
32
- var _ref2 = external ? {
33
- target: '_blank',
34
- rel: 'noopener noreferer'
52
+ const uniqueId = useId();
53
+ const id = finalStyle !== null ? `link-component-${uniqueId}` : null;
54
+ let t9;
55
+ if ($[4] !== external || $[5] !== linkRel || $[6] !== linkTarget) {
56
+ t9 = external ? {
57
+ target: "_blank",
58
+ rel: "noopener noreferer"
35
59
  } : {
36
60
  target: linkTarget,
37
61
  rel: linkRel
38
- },
39
- target = _ref2.target,
40
- rel = _ref2.rel;
41
- return url ? /*#__PURE__*/jsx("a", {
42
- id: id,
43
- className: classNames([styles.container, className]),
44
- style: finalStyle,
45
- href: url,
46
- target: target,
47
- rel: rel,
48
- tabIndex: focusable ? '0' : '-1',
49
- children: children
50
- }) : /*#__PURE__*/jsx("div", {
51
- id: id,
52
- className: classNames([styles.container, className]),
53
- style: finalStyle,
54
- children: children
55
- });
62
+ };
63
+ $[4] = external;
64
+ $[5] = linkRel;
65
+ $[6] = linkTarget;
66
+ $[7] = t9;
67
+ } else {
68
+ t9 = $[7];
69
+ }
70
+ const {
71
+ target,
72
+ rel
73
+ } = t9;
74
+ let t10;
75
+ if ($[8] !== children || $[9] !== className || $[10] !== finalStyle || $[11] !== focusable || $[12] !== id || $[13] !== rel || $[14] !== target || $[15] !== url) {
76
+ t10 = url ? /*#__PURE__*/jsx("a", {
77
+ id: id,
78
+ className: classNames([styles.container, className]),
79
+ style: finalStyle,
80
+ href: url,
81
+ target: target,
82
+ rel: rel,
83
+ tabIndex: focusable ? "0" : "-1",
84
+ children: children
85
+ }) : /*#__PURE__*/jsx("div", {
86
+ id: id,
87
+ className: classNames([styles.container, className]),
88
+ style: finalStyle,
89
+ children: children
90
+ });
91
+ $[8] = children;
92
+ $[9] = className;
93
+ $[10] = finalStyle;
94
+ $[11] = focusable;
95
+ $[12] = id;
96
+ $[13] = rel;
97
+ $[14] = target;
98
+ $[15] = url;
99
+ $[16] = t10;
100
+ } else {
101
+ t10 = $[16];
102
+ }
103
+ return t10;
56
104
  }
57
105
 
58
106
  export { Link as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/element-link",
3
- "version": "0.4.69",
3
+ "version": "0.4.74",
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
+ "style": "./assets/css/styles.css",
35
36
  "exports": {
36
37
  ".": {
37
38
  "types": "./es/index.d.ts",
39
+ "style": "./assets/css/styles.css",
38
40
  "import": "./es/index.js"
39
41
  },
40
42
  "./assets/css/styles": "./assets/css/styles.css",
@@ -51,16 +53,16 @@
51
53
  "build": "../../scripts/prepare-package.sh --types"
52
54
  },
53
55
  "devDependencies": {
54
- "react": "^18.3.0 || ^19.0.0",
55
- "react-dom": "^18.3.0 || ^19.0.0"
56
+ "react": "^19.0.0",
57
+ "react-dom": "^19.0.0"
56
58
  },
57
59
  "peerDependencies": {
58
- "react": "^18.3.0 || ^19.0.0",
59
- "react-dom": "^18.3.0 || ^19.0.0"
60
+ "react": "^19.0.0",
61
+ "react-dom": "^19.0.0"
60
62
  },
61
63
  "dependencies": {
62
64
  "@babel/runtime": "^7.28.6",
63
- "@micromag/core": "^0.4.69",
65
+ "@micromag/core": "^0.4.74",
64
66
  "classnames": "^2.2.6",
65
67
  "react-intl": "^8.1.3 || ^10.0.0",
66
68
  "uuid": "^9.0.0"
@@ -69,6 +71,6 @@
69
71
  "access": "public",
70
72
  "registry": "https://registry.npmjs.org/"
71
73
  },
72
- "gitHead": "509e113dc06022d6092e4aac9f47ccd5facfd59d",
74
+ "gitHead": "fe510ee87845280d0760cb292aef9d2eb69e67c1",
73
75
  "types": "es/index.d.ts"
74
76
  }