@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.
- package/es/index.js +91 -43
- package/package.json +9 -7
package/es/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
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(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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.
|
|
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": "^
|
|
55
|
-
"react-dom": "^
|
|
56
|
+
"react": "^19.0.0",
|
|
57
|
+
"react-dom": "^19.0.0"
|
|
56
58
|
},
|
|
57
59
|
"peerDependencies": {
|
|
58
|
-
"react": "^
|
|
59
|
-
"react-dom": "^
|
|
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.
|
|
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": "
|
|
74
|
+
"gitHead": "fe510ee87845280d0760cb292aef9d2eb69e67c1",
|
|
73
75
|
"types": "es/index.d.ts"
|
|
74
76
|
}
|