@semcore/link 5.44.0-prerelease.4 → 5.44.0
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/CHANGELOG.md +3 -3
- package/lib/esm/Link.mjs +136 -0
- package/lib/esm/index.mjs +4 -0
- package/package.json +12 -7
- package/vite.config.ts +17 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
-
## [5.44.0] - 2025-
|
|
5
|
+
## [5.44.0] - 2025-03-14
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### Added
|
|
8
8
|
|
|
9
|
-
-
|
|
9
|
+
- Build for ESM.
|
|
10
10
|
|
|
11
11
|
## [5.43.1] - 2025-02-05
|
|
12
12
|
|
package/lib/esm/Link.mjs
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import y from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import A from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import C from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import f from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
5
|
+
import T from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
+
import E from "@babel/runtime/helpers/esm/createSuper";
|
|
7
|
+
import g from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
+
import { sstyled as P } from "@semcore/utils/lib/core/index";
|
|
9
|
+
import R, { sstyled as u, assignProps as k, Component as w } from "@semcore/core";
|
|
10
|
+
import i from "react";
|
|
11
|
+
import { Text as M } from "@semcore/typography";
|
|
12
|
+
import { Box as S } from "@semcore/flex-box";
|
|
13
|
+
import { Hint as O } from "@semcore/tooltip";
|
|
14
|
+
import W from "@semcore/utils/lib/enhances/keyboardFocusEnhance";
|
|
15
|
+
import B from "@semcore/utils/lib/addonTextChildren";
|
|
16
|
+
import F from "@semcore/utils/lib/logger";
|
|
17
|
+
import H from "@semcore/utils/lib/hasLabels";
|
|
18
|
+
import $ from "@semcore/utils/lib/enhances/resolveColorEnhance";
|
|
19
|
+
var V = (
|
|
20
|
+
/*__reshadow_css_start__*/
|
|
21
|
+
(P.insert(
|
|
22
|
+
/*__inner_css_start__*/
|
|
23
|
+
".___SLink_1ggr4_gg_{display:inline-block;font-family:inherit;color:var(--intergalactic-text-link, #006dca);line-height:normal;position:relative;cursor:pointer;-webkit-text-decoration:none;text-decoration:none;border:0;padding:0;margin:0;box-shadow:none;-webkit-tap-highlight-color:transparent;outline:0;background:0 0;transition:color .15s ease-in-out}.___SLink_1ggr4_gg_:active,.___SLink_1ggr4_gg_:focus{outline:0;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SLink_1ggr4_gg_:hover{outline:0;-webkit-text-decoration:none;text-decoration:none}}.___SLink_1ggr4_gg_::-moz-focus-inner{border:0;padding:0}.___SLink_1ggr4_gg_.__active_1ggr4_gg_,.___SLink_1ggr4_gg_:active{color:var(--intergalactic-text-link-hover-active, #044792)}@media (hover:hover){.___SLink_1ggr4_gg_:hover{color:var(--intergalactic-text-link-hover-active, #044792)}}.___SLink_1ggr4_gg_.__active_1ggr4_gg_ .___SText_1ggr4_gg_,.___SLink_1ggr4_gg_:active .___SText_1ggr4_gg_{border-color:currentColor}@media (hover:hover){.___SLink_1ggr4_gg_:hover .___SText_1ggr4_gg_{border-color:currentColor}}.___SLink_1ggr4_gg_.__enableVisited_1ggr4_gg_:visited{color:var(--intergalactic-text-link-visited, #8649e1)}@media (hover:hover){.___SLink_1ggr4_gg_.__enableVisited_1ggr4_gg_:visited:hover{color:var(--intergalactic-text-link-visited, #8649e1)}}.___SLink_1ggr4_gg_.__keyboardFocused_1ggr4_gg_{outline-color:var(--intergalactic-keyboard-focus-outline, rgba(0, 143, 248, 0.5));outline-style:solid;outline-width:3px}.___SLink_1ggr4_gg_.__visually-disabled_1ggr4_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SLink_1ggr4_gg_.__noWrapText_1ggr4_gg_{white-space:nowrap}.___SLink_1ggr4_gg_.__inline_1ggr4_gg_{display:inline}.___SAddon_1ggr4_gg_{display:inline-flex;justify-content:center;align-items:center;margin-bottom:var(--intergalactic-spacing-05x, 2px);vertical-align:middle;pointer-events:none}.___SLink_1ggr4_gg_ .___SAddon_1ggr4_gg_:not(:only-child):first-child{margin-right:var(--intergalactic-spacing-1x, 4px)}.___SLink_1ggr4_gg_ .___SAddon_1ggr4_gg_:not(:only-child):last-child{margin-left:var(--intergalactic-spacing-1x, 4px)}.___SText_1ggr4_gg_{border-bottom-width:1px;border-bottom-style:solid;border-color:transparent;transition:border-bottom-color .15s ease-in-out}.___SLink_1ggr4_gg_.__text-color_1ggr4_gg_{color:var(--text-color_1ggr4)}.___SLink_1ggr4_gg_.__text-color_1ggr4_gg_.__active_1ggr4_gg_,.___SLink_1ggr4_gg_.__text-color_1ggr4_gg_:active{color:var(--text-color_1ggr4);filter:brightness(.8)}@media (hover:hover){.___SLink_1ggr4_gg_.__text-color_1ggr4_gg_:hover{color:var(--text-color_1ggr4);filter:brightness(.8)}}@media (prefers-reduced-motion){.___SLink_1ggr4_gg_,.___SText_1ggr4_gg_{transition:none}}",
|
|
24
|
+
"1ggr4_gg_"
|
|
25
|
+
), {
|
|
26
|
+
__SLink: "___SLink_1ggr4_gg_",
|
|
27
|
+
_keyboardFocused: "__keyboardFocused_1ggr4_gg_",
|
|
28
|
+
"_visually-disabled": "__visually-disabled_1ggr4_gg_",
|
|
29
|
+
_noWrapText: "__noWrapText_1ggr4_gg_",
|
|
30
|
+
_inline: "__inline_1ggr4_gg_",
|
|
31
|
+
__SAddon: "___SAddon_1ggr4_gg_",
|
|
32
|
+
__SText: "___SText_1ggr4_gg_",
|
|
33
|
+
_active: "__active_1ggr4_gg_",
|
|
34
|
+
_enableVisited: "__enableVisited_1ggr4_gg_",
|
|
35
|
+
"_text-color": "__text-color_1ggr4_gg_",
|
|
36
|
+
"--text-color": "--text-color_1ggr4"
|
|
37
|
+
})
|
|
38
|
+
), h = /* @__PURE__ */ function(s) {
|
|
39
|
+
T(o, s);
|
|
40
|
+
var a = E(o);
|
|
41
|
+
function o() {
|
|
42
|
+
var t;
|
|
43
|
+
A(this, o);
|
|
44
|
+
for (var e = arguments.length, n = new Array(e), _ = 0; _ < e; _++)
|
|
45
|
+
n[_] = arguments[_];
|
|
46
|
+
return t = a.call.apply(a, [this].concat(n)), g(f(t), "containerRef", /* @__PURE__ */ i.createRef()), g(f(t), "state", {
|
|
47
|
+
ariaLabelledByContent: "",
|
|
48
|
+
visibleHint: !1
|
|
49
|
+
}), g(f(t), "handleMouseEnterOnlyAddon", function() {
|
|
50
|
+
t.setState({
|
|
51
|
+
visibleHint: !0
|
|
52
|
+
});
|
|
53
|
+
}), g(f(t), "handleMouseLeaveOnlyAddon", function() {
|
|
54
|
+
t.setState({
|
|
55
|
+
visibleHint: !1
|
|
56
|
+
});
|
|
57
|
+
}), t;
|
|
58
|
+
}
|
|
59
|
+
return C(o, [{
|
|
60
|
+
key: "componentDidMount",
|
|
61
|
+
value: function() {
|
|
62
|
+
var e = this;
|
|
63
|
+
process.env.NODE_ENV !== "production" && F.warn(this.containerRef.current && !H(this.containerRef.current), "'title' or 'aria-label' or 'aria-labelledby' are required props for links without text content", this.asProps["data-ui-name"] || o.displayName), this.asProps["aria-labelledby"] && setTimeout(function() {
|
|
64
|
+
var n, _;
|
|
65
|
+
e.setState({
|
|
66
|
+
ariaLabelledByContent: (n = (_ = document.getElementById(e.asProps["aria-labelledby"])) === null || _ === void 0 ? void 0 : _.textContent) !== null && n !== void 0 ? n : ""
|
|
67
|
+
});
|
|
68
|
+
}, 0);
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
key: "renderChildren",
|
|
72
|
+
value: function() {
|
|
73
|
+
var e = this.asProps, n = e.Children, _ = e.styles, r = e.addonLeft, l = e.addonRight;
|
|
74
|
+
return u(_), /* @__PURE__ */ i.createElement(i.Fragment, null, r ? /* @__PURE__ */ i.createElement(v.Addon, {
|
|
75
|
+
tag: r
|
|
76
|
+
}) : null, B(n, v.Text, v.Addon), l ? /* @__PURE__ */ i.createElement(v.Addon, {
|
|
77
|
+
tag: l
|
|
78
|
+
}) : null);
|
|
79
|
+
}
|
|
80
|
+
}, {
|
|
81
|
+
key: "renderOnlyAddons",
|
|
82
|
+
value: function() {
|
|
83
|
+
var e, n, _, r = this.asProps, l = r.styles, m = r.addonLeft, p = r.addonRight, d = r.title, c = r["aria-label"], b = r.keyboardFocused, x = this.state.visibleHint, L = (n = (_ = d ?? c) !== null && _ !== void 0 ? _ : this.state.ariaLabelledByContent) !== null && n !== void 0 ? n : "";
|
|
84
|
+
return e = u(l), /* @__PURE__ */ i.createElement(v.Addon, {
|
|
85
|
+
tag: O,
|
|
86
|
+
title: L,
|
|
87
|
+
timeout: [250, 50],
|
|
88
|
+
visible: b || x
|
|
89
|
+
}, m && /* @__PURE__ */ i.createElement(m, e.cn("AddonLeft", {})), p && /* @__PURE__ */ i.createElement(p, e.cn("AddonRight", {})));
|
|
90
|
+
}
|
|
91
|
+
}, {
|
|
92
|
+
key: "render",
|
|
93
|
+
value: function() {
|
|
94
|
+
var e = this.asProps, n, _ = M, r = this.asProps, l = r.styles, m = r.noWrap, p = r.color, d = r.resolveColor, c = r.disabled, b = r.href, x = r.children;
|
|
95
|
+
return n = u(l), /* @__PURE__ */ i.createElement(_, n.cn("SLink", y({}, k({
|
|
96
|
+
role: "link",
|
|
97
|
+
tabIndex: c ? -1 : 0,
|
|
98
|
+
"use:href": c ? void 0 : b,
|
|
99
|
+
"visually-disabled": c,
|
|
100
|
+
"text-color": d(p),
|
|
101
|
+
tag: "a",
|
|
102
|
+
noWrapText: m,
|
|
103
|
+
"use:noWrap": !1,
|
|
104
|
+
ref: this.containerRef,
|
|
105
|
+
__excludeProps: ["disabled", "aria-disabled"],
|
|
106
|
+
onMouseEnter: this.handleMouseEnterOnlyAddon,
|
|
107
|
+
onMouseLeave: this.handleMouseLeaveOnlyAddon
|
|
108
|
+
}, e))), x !== void 0 ? this.renderChildren() : this.renderOnlyAddons());
|
|
109
|
+
}
|
|
110
|
+
}]), o;
|
|
111
|
+
}(w);
|
|
112
|
+
g(h, "displayName", "Link");
|
|
113
|
+
g(h, "defaultProps", {
|
|
114
|
+
noWrap: !0
|
|
115
|
+
});
|
|
116
|
+
g(h, "style", V);
|
|
117
|
+
g(h, "enhance", [W(), $()]);
|
|
118
|
+
function N(s) {
|
|
119
|
+
var a = arguments[0], o, t = S, e = s.styles;
|
|
120
|
+
return o = u(e), /* @__PURE__ */ i.createElement(t, o.cn("SText", y({}, k({
|
|
121
|
+
tag: "span"
|
|
122
|
+
}, a))));
|
|
123
|
+
}
|
|
124
|
+
function D(s) {
|
|
125
|
+
var a = arguments[0], o, t = S, e = s.styles;
|
|
126
|
+
return o = u(e), /* @__PURE__ */ i.createElement(t, o.cn("SAddon", y({}, k({
|
|
127
|
+
tag: "span"
|
|
128
|
+
}, a))));
|
|
129
|
+
}
|
|
130
|
+
var v = R(h, {
|
|
131
|
+
Text: N,
|
|
132
|
+
Addon: D
|
|
133
|
+
});
|
|
134
|
+
export {
|
|
135
|
+
v as default
|
|
136
|
+
};
|
package/package.json
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/link",
|
|
3
3
|
"description": "Semrush Link Component",
|
|
4
|
-
"version": "5.44.0
|
|
4
|
+
"version": "5.44.0",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"author": "UI-kit team <ui-kit-team@semrush.com>",
|
|
10
10
|
"license": "MIT",
|
|
11
|
+
"exports": {
|
|
12
|
+
"require": "./lib/cjs/index.js",
|
|
13
|
+
"import": "./lib/esm/index.mjs",
|
|
14
|
+
"types": "./lib/types/index.d.ts"
|
|
15
|
+
},
|
|
11
16
|
"dependencies": {
|
|
12
|
-
"@semcore/utils": "4.
|
|
13
|
-
"@semcore/typography": "5.52.0
|
|
14
|
-
"@semcore/flex-box": "5.41.0
|
|
15
|
-
"@semcore/tooltip": "6.
|
|
17
|
+
"@semcore/utils": "4.48.0",
|
|
18
|
+
"@semcore/typography": "5.52.0",
|
|
19
|
+
"@semcore/flex-box": "5.41.0",
|
|
20
|
+
"@semcore/tooltip": "6.49.0"
|
|
16
21
|
},
|
|
17
22
|
"peerDependencies": {
|
|
18
|
-
"@semcore/core": "^2.
|
|
23
|
+
"@semcore/core": "^2.17.5",
|
|
19
24
|
"react": "16.8 - 18",
|
|
20
25
|
"react-dom": "16.8 - 18"
|
|
21
26
|
},
|
|
@@ -30,6 +35,6 @@
|
|
|
30
35
|
"@semcore/icon": "*"
|
|
31
36
|
},
|
|
32
37
|
"scripts": {
|
|
33
|
-
"build": "pnpm semcore-builder --source=js"
|
|
38
|
+
"build": "pnpm semcore-builder --source=js && pnpm vite build"
|
|
34
39
|
}
|
|
35
40
|
}
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineConfig, mergeConfig } from 'vite';
|
|
2
|
+
|
|
3
|
+
import viteConfig from '../../commonVite.config';
|
|
4
|
+
|
|
5
|
+
export default mergeConfig(
|
|
6
|
+
viteConfig,
|
|
7
|
+
defineConfig({
|
|
8
|
+
build: {
|
|
9
|
+
lib: {
|
|
10
|
+
entry: './src/index.js',
|
|
11
|
+
},
|
|
12
|
+
rollupOptions: {
|
|
13
|
+
external: ['react', 'react-dom', 'react/jsx-runtime', /@babel\/runtime\/*/, /@semcore\/*/],
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
}),
|
|
17
|
+
);
|