@semcore/link 16.0.1 → 16.0.2-prerelease.3
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 +6 -0
- package/README.md +1 -31
- package/lib/cjs/Link.js +45 -46
- package/lib/cjs/Link.js.map +1 -1
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/es6/Link.js +43 -43
- package/lib/es6/Link.js.map +1 -1
- package/lib/es6/index.d.js.map +1 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/esm/Link.mjs +44 -42
- package/lib/types/index.d.ts +4 -4
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
+
## [16.0.2] - 2025-06-16
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Version patch update due to children dependencies update (`@semcore/flex-box` [16.0.1 ~> 16.0.2], `@semcore/base-components` [16.0.1 ~> 16.0.2]).
|
|
10
|
+
|
|
5
11
|
## [16.0.1] - 2025-05-30
|
|
6
12
|
|
|
7
13
|
### Changed
|
package/README.md
CHANGED
|
@@ -13,40 +13,10 @@
|
|
|
13
13
|
## Install
|
|
14
14
|
|
|
15
15
|
```sh
|
|
16
|
-
npm install
|
|
16
|
+
npm install @semcore/link
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
## Usage
|
|
20
19
|
|
|
21
|
-
```jsx
|
|
22
|
-
import Link from 'intergalactic/link';
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
<details>
|
|
26
|
-
<summary>Alternative installation and use</summary>
|
|
27
|
-
|
|
28
|
-
**We do not recommend this usage path due to possible dependency and update issues.**
|
|
29
|
-
|
|
30
|
-
### Install
|
|
31
|
-
|
|
32
|
-
You can only install one package from the design system
|
|
33
|
-
|
|
34
|
-
```sh
|
|
35
|
-
npm install @semcore/link @semcore/core
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
`@semcore/core` - _is the basic package by which we create our components, and it contains all of the common logic
|
|
39
|
-
of the components that is discussed below. There should only be one version of the package in the project._
|
|
40
|
-
|
|
41
|
-
### Usage
|
|
42
|
-
|
|
43
|
-
You can use the package the same way but without `/ui/` in the import path.
|
|
44
|
-
|
|
45
|
-
```jsx
|
|
46
|
-
import Link from '@semcore/link';
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
</details>
|
|
50
20
|
|
|
51
21
|
## 👤 Author
|
|
52
22
|
|
package/lib/cjs/Link.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
@@ -8,52 +8,53 @@ exports["default"] = void 0;
|
|
|
8
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
-
var
|
|
11
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
|
+
var _isNativeReflectConstruct2 = _interopRequireDefault(require("@babel/runtime/helpers/isNativeReflectConstruct"));
|
|
13
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
12
14
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
-
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
14
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
16
|
var _core = require("@semcore/core");
|
|
16
|
-
var _react = _interopRequireDefault(require("react"));
|
|
17
|
-
var _typography = require("@semcore/typography");
|
|
18
|
-
var _flexBox = require("@semcore/flex-box");
|
|
19
|
-
var _tooltip = require("@semcore/tooltip");
|
|
20
|
-
var _keyboardFocusEnhance = _interopRequireDefault(require("@semcore/core/lib/utils/enhances/keyboardFocusEnhance"));
|
|
21
17
|
var _addonTextChildren = _interopRequireDefault(require("@semcore/core/lib/utils/addonTextChildren"));
|
|
22
|
-
var
|
|
23
|
-
var _hasLabels = _interopRequireDefault(require("@semcore/core/lib/utils/hasLabels"));
|
|
18
|
+
var _keyboardFocusEnhance = _interopRequireDefault(require("@semcore/core/lib/utils/enhances/keyboardFocusEnhance"));
|
|
24
19
|
var _resolveColorEnhance = _interopRequireDefault(require("@semcore/core/lib/utils/enhances/resolveColorEnhance"));
|
|
20
|
+
var _hasLabels = _interopRequireDefault(require("@semcore/core/lib/utils/hasLabels"));
|
|
21
|
+
var _logger = _interopRequireDefault(require("@semcore/core/lib/utils/logger"));
|
|
22
|
+
var _flexBox = require("@semcore/flex-box");
|
|
23
|
+
var _tooltip = require("@semcore/tooltip");
|
|
24
|
+
var _typography = require("@semcore/typography");
|
|
25
|
+
var _react = _interopRequireDefault(require("react"));
|
|
26
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, (0, _isNativeReflectConstruct2["default"])() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
25
27
|
/*!__reshadow-styles__:"./style/link.shadow.css"*/
|
|
26
|
-
var style = (
|
|
28
|
+
var style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".___SLink_h4l94_gg_{display:inline-block;font-family:inherit;color:var(--intergalactic-text-link, #006dca);line-height:normal;position:relative;cursor:pointer;border:0;padding:0;margin:0;box-shadow:none;-webkit-tap-highlight-color:transparent;background:0 0;transition:color .15s ease-in-out}.___SLink_h4l94_gg_,.___SLink_h4l94_gg_:active{-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SLink_h4l94_gg_:hover{-webkit-text-decoration:none;text-decoration:none}}.___SLink_h4l94_gg_::-moz-focus-inner{border:0;padding:0}.___SLink_h4l94_gg_.__active_h4l94_gg_,.___SLink_h4l94_gg_:active{color:var(--intergalactic-text-link-hover-active, #044792)}@media (hover:hover){.___SLink_h4l94_gg_:hover{color:var(--intergalactic-text-link-hover-active, #044792)}}.___SLink_h4l94_gg_.__active_h4l94_gg_ .___SText_h4l94_gg_,.___SLink_h4l94_gg_:active .___SText_h4l94_gg_{border-color:currentColor}@media (hover:hover){.___SLink_h4l94_gg_:hover .___SText_h4l94_gg_{border-color:currentColor}}.___SLink_h4l94_gg_.__enableVisited_h4l94_gg_:visited{color:var(--intergalactic-text-link-visited, #8649e1)}@media (hover:hover){.___SLink_h4l94_gg_.__enableVisited_h4l94_gg_:visited:hover{color:var(--intergalactic-text-link-visited, #8649e1)}}.___SLink_h4l94_gg_.__visually-disabled_h4l94_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SLink_h4l94_gg_.__noWrapText_h4l94_gg_{white-space:nowrap}.___SLink_h4l94_gg_.__inline_h4l94_gg_{display:inline}.___SAddon_h4l94_gg_{display:inline-flex;justify-content:center;align-items:center;margin-bottom:var(--intergalactic-spacing-05x, 2px);vertical-align:middle;pointer-events:none}.___SLink_h4l94_gg_ .___SAddon_h4l94_gg_:not(:only-child):first-child{margin-right:var(--intergalactic-spacing-1x, 4px)}.___SLink_h4l94_gg_ .___SAddon_h4l94_gg_:not(:only-child):last-child{margin-left:var(--intergalactic-spacing-1x, 4px)}.___SText_h4l94_gg_{border-bottom-width:1px;border-bottom-style:solid;border-color:transparent;transition:border-bottom-color .15s ease-in-out}.___SLink_h4l94_gg_.__text-color_h4l94_gg_{color:var(--text-color_h4l94)}.___SLink_h4l94_gg_.__text-color_h4l94_gg_.__active_h4l94_gg_,.___SLink_h4l94_gg_.__text-color_h4l94_gg_:active{color:var(--text-color_h4l94);filter:brightness(.8)}@media (hover:hover){.___SLink_h4l94_gg_.__text-color_h4l94_gg_:hover{color:var(--text-color_h4l94);filter:brightness(.8)}}@media (prefers-reduced-motion){.___SLink_h4l94_gg_,.___SText_h4l94_gg_{transition:none}}", /*__inner_css_end__*/"h4l94_gg_"),
|
|
27
29
|
/*__reshadow_css_end__*/
|
|
28
30
|
{
|
|
29
|
-
"__SLink": "
|
|
30
|
-
"_visually-disabled": "__visually-
|
|
31
|
-
"_noWrapText": "
|
|
32
|
-
"_inline": "
|
|
33
|
-
"__SAddon": "
|
|
34
|
-
"__SText": "
|
|
35
|
-
"_active": "
|
|
36
|
-
"_enableVisited": "
|
|
37
|
-
"_text-color": "__text-
|
|
38
|
-
"--text-color": "--text-
|
|
31
|
+
"__SLink": "___SLink_h4l94_gg_",
|
|
32
|
+
"_visually-disabled": "__visually-disabled_h4l94_gg_",
|
|
33
|
+
"_noWrapText": "__noWrapText_h4l94_gg_",
|
|
34
|
+
"_inline": "__inline_h4l94_gg_",
|
|
35
|
+
"__SAddon": "___SAddon_h4l94_gg_",
|
|
36
|
+
"__SText": "___SText_h4l94_gg_",
|
|
37
|
+
"_active": "__active_h4l94_gg_",
|
|
38
|
+
"_enableVisited": "__enableVisited_h4l94_gg_",
|
|
39
|
+
"_text-color": "__text-color_h4l94_gg_",
|
|
40
|
+
"--text-color": "--text-color_h4l94"
|
|
39
41
|
});
|
|
40
42
|
var RootLink = /*#__PURE__*/function (_Component) {
|
|
41
|
-
(0, _inherits2["default"])(RootLink, _Component);
|
|
42
|
-
var _super = (0, _createSuper2["default"])(RootLink);
|
|
43
43
|
function RootLink() {
|
|
44
44
|
var _this;
|
|
45
45
|
(0, _classCallCheck2["default"])(this, RootLink);
|
|
46
46
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
47
47
|
args[_key] = arguments[_key];
|
|
48
48
|
}
|
|
49
|
-
_this =
|
|
50
|
-
(0, _defineProperty2["default"])(
|
|
51
|
-
(0, _defineProperty2["default"])(
|
|
49
|
+
_this = _callSuper(this, RootLink, [].concat(args));
|
|
50
|
+
(0, _defineProperty2["default"])(_this, "containerRef", /*#__PURE__*/_react["default"].createRef());
|
|
51
|
+
(0, _defineProperty2["default"])(_this, "state", {
|
|
52
52
|
ariaLabelledByContent: ''
|
|
53
53
|
});
|
|
54
54
|
return _this;
|
|
55
55
|
}
|
|
56
|
-
(0,
|
|
56
|
+
(0, _inherits2["default"])(RootLink, _Component);
|
|
57
|
+
return (0, _createClass2["default"])(RootLink, [{
|
|
57
58
|
key: "componentDidMount",
|
|
58
59
|
value: function componentDidMount() {
|
|
59
60
|
var _this2 = this;
|
|
@@ -71,23 +72,23 @@ var RootLink = /*#__PURE__*/function (_Component) {
|
|
|
71
72
|
}
|
|
72
73
|
}, {
|
|
73
74
|
key: "renderLink",
|
|
74
|
-
value: function renderLink(
|
|
75
|
+
value: function renderLink(_ref0) {
|
|
75
76
|
var _ref = this.asProps,
|
|
76
77
|
_ref5;
|
|
77
|
-
var linkProps =
|
|
78
|
-
children =
|
|
78
|
+
var linkProps = _ref0.linkProps,
|
|
79
|
+
children = _ref0.children;
|
|
79
80
|
var styles = this.asProps.styles;
|
|
80
81
|
var SLink = _typography.Text;
|
|
81
82
|
return _ref5 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SLink, _ref5.cn("SLink", (0, _objectSpread2["default"])({}, (0, _core.assignProps)((0, _objectSpread2["default"])({}, linkProps), _ref))), children);
|
|
82
83
|
}
|
|
83
84
|
}, {
|
|
84
85
|
key: "renderLinkWithHint",
|
|
85
|
-
value: function renderLinkWithHint(
|
|
86
|
+
value: function renderLinkWithHint(_ref1) {
|
|
86
87
|
var _ref2 = this.asProps,
|
|
87
88
|
_ref6;
|
|
88
|
-
var linkProps =
|
|
89
|
-
children =
|
|
90
|
-
hintProps =
|
|
89
|
+
var linkProps = _ref1.linkProps,
|
|
90
|
+
children = _ref1.children,
|
|
91
|
+
hintProps = _ref1.hintProps;
|
|
91
92
|
var styles = this.asProps.styles;
|
|
92
93
|
var SLink = _tooltip.Hint;
|
|
93
94
|
return _ref6 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SLink, _ref6.cn("SLink", (0, _objectSpread2["default"])({}, (0, _core.assignProps)((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, linkProps), hintProps), _ref2))), children);
|
|
@@ -95,7 +96,7 @@ var RootLink = /*#__PURE__*/function (_Component) {
|
|
|
95
96
|
}, {
|
|
96
97
|
key: "render",
|
|
97
98
|
value: function render() {
|
|
98
|
-
var _ref7,
|
|
99
|
+
var _ref7, _ref10, _ref11;
|
|
99
100
|
var _this$asProps = this.asProps,
|
|
100
101
|
styles = _this$asProps.styles,
|
|
101
102
|
noWrap = _this$asProps.noWrap,
|
|
@@ -113,19 +114,19 @@ var RootLink = /*#__PURE__*/function (_Component) {
|
|
|
113
114
|
// @ts-ignore
|
|
114
115
|
var Link = this[_core.CORE_INSTANCE];
|
|
115
116
|
var children = (_ref7 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, AddonLeft ? /*#__PURE__*/_react["default"].createElement(Link.Addon, null, /*#__PURE__*/_react["default"].createElement(AddonLeft, _ref7.cn("AddonLeft", {}))) : null, (0, _addonTextChildren["default"])(Children, Link.Text, Link.Addon), AddonRight ? /*#__PURE__*/_react["default"].createElement(Link.Addon, null, /*#__PURE__*/_react["default"].createElement(AddonRight, _ref7.cn("AddonRight", {}))) : null));
|
|
116
|
-
var hintContent = (
|
|
117
|
+
var hintContent = (_ref10 = (_ref11 = title !== null && title !== void 0 ? title : ariaLabel) !== null && _ref11 !== void 0 ? _ref11 : this.state.ariaLabelledByContent) !== null && _ref10 !== void 0 ? _ref10 : '';
|
|
117
118
|
var linkProps = {
|
|
118
|
-
role: 'link',
|
|
119
|
-
tabIndex: disabled ? -1 : 0,
|
|
119
|
+
'role': 'link',
|
|
120
|
+
'tabIndex': disabled ? -1 : 0,
|
|
120
121
|
'use:href': disabled ? undefined : href,
|
|
121
122
|
'visually-disabled': disabled,
|
|
122
|
-
render: _typography.Text,
|
|
123
|
+
'render': _typography.Text,
|
|
123
124
|
'text-color': resolveColor(color),
|
|
124
|
-
tag: 'a',
|
|
125
|
-
noWrapText: noWrap,
|
|
125
|
+
'tag': 'a',
|
|
126
|
+
'noWrapText': noWrap,
|
|
126
127
|
'use:noWrap': false,
|
|
127
|
-
ref: this.containerRef,
|
|
128
|
-
__excludeProps: ['disabled', 'aria-disabled']
|
|
128
|
+
'ref': this.containerRef,
|
|
129
|
+
'__excludeProps': ['disabled', 'aria-disabled']
|
|
129
130
|
};
|
|
130
131
|
var hintProps = {
|
|
131
132
|
title: hintContent,
|
|
@@ -146,7 +147,6 @@ var RootLink = /*#__PURE__*/function (_Component) {
|
|
|
146
147
|
});
|
|
147
148
|
}
|
|
148
149
|
}]);
|
|
149
|
-
return RootLink;
|
|
150
150
|
}(_core.Component);
|
|
151
151
|
(0, _defineProperty2["default"])(RootLink, "displayName", 'Link');
|
|
152
152
|
(0, _defineProperty2["default"])(RootLink, "defaultProps", {
|
|
@@ -176,6 +176,5 @@ var Link = (0, _core.createComponent)(RootLink, {
|
|
|
176
176
|
Text: LinkText,
|
|
177
177
|
Addon: Addon
|
|
178
178
|
});
|
|
179
|
-
var _default = Link;
|
|
180
|
-
exports["default"] = _default;
|
|
179
|
+
var _default = exports["default"] = Link;
|
|
181
180
|
//# sourceMappingURL=Link.js.map
|
package/lib/cjs/Link.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.js","names":["_core","require","_react","_interopRequireDefault","_typography","_flexBox","_tooltip","_keyboardFocusEnhance","_addonTextChildren","_logger","_hasLabels","_resolveColorEnhance","style","sstyled","insert","RootLink","_Component","_inherits2","_super","_createSuper2","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty2","_assertThisInitialized2","React","createRef","ariaLabelledByContent","_createClass2","key","value","componentDidMount","_this2","process","env","NODE_ENV","logger","warn","containerRef","current","hasLabels","asProps","displayName","setTimeout","_document$getElementB","_document$getElementB2","setState","document","getElementById","textContent","renderLink","_ref10","_ref","_ref5","linkProps","children","styles","SLink","Text","createElement","cn","_objectSpread2","assignProps","renderLinkWithHint","_ref11","_ref2","_ref6","hintProps","Hint","render","_ref7","_ref12","_ref13","_this$asProps","noWrap","color","resolveColor","disabled","href","hasChildren","AddonLeft","addonLeft","AddonRight","addonRight","Children","title","ariaLabel","hintPlacement","Link","CORE_INSTANCE","Fragment","Addon","addonTextChildren","hintContent","state","role","tabIndex","undefined","tag","noWrapText","ref","__excludeProps","timeout","placement","Component","keyboardFocusEnhance","resolveColorEnhance","LinkText","props","_ref3","arguments[0]","_ref8","SText","Box","_ref4","_ref9","SAddon","createComponent","_default","exports"],"sources":["../../src/Link.jsx"],"sourcesContent":["import React from 'react';\nimport { createComponent, Component, Root, sstyled, CORE_INSTANCE } from '@semcore/core';\nimport { Text } from '@semcore/typography';\nimport { Box } from '@semcore/flex-box';\nimport { Hint } from '@semcore/tooltip';\nimport keyboardFocusEnhance from '@semcore/core/lib/utils/enhances/keyboardFocusEnhance';\nimport addonTextChildren from '@semcore/core/lib/utils/addonTextChildren';\nimport logger from '@semcore/core/lib/utils/logger';\nimport hasLabels from '@semcore/core/lib/utils/hasLabels';\nimport resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';\n\nimport style from './style/link.shadow.css';\n\nclass RootLink extends Component {\n static displayName = 'Link';\n static defaultProps = {\n noWrap: true,\n };\n static style = style;\n static enhance = [keyboardFocusEnhance(), resolveColorEnhance()];\n containerRef = React.createRef();\n\n state = {\n ariaLabelledByContent: '',\n };\n\n componentDidMount() {\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(\n this.containerRef.current && !hasLabels(this.containerRef.current),\n `'title' or 'aria-label' or 'aria-labelledby' are required props for links without text content`,\n this.asProps['data-ui-name'] || RootLink.displayName,\n );\n }\n\n if (this.asProps['aria-labelledby']) {\n setTimeout(() => {\n this.setState({\n ariaLabelledByContent:\n document.getElementById(this.asProps['aria-labelledby'])?.textContent ?? '',\n });\n }, 0);\n }\n }\n\n renderLink({ linkProps, children }) {\n const { styles } = this.asProps;\n const SLink = Root;\n\n return sstyled(styles)(\n <SLink render={Text} {...linkProps}>\n {children}\n </SLink>,\n );\n }\n\n renderLinkWithHint({ linkProps, children, hintProps }) {\n const { styles } = this.asProps;\n const SLink = Root;\n\n return sstyled(styles)(\n <SLink render={Hint} {...linkProps} {...hintProps}>\n {children}\n </SLink>,\n );\n }\n\n render() {\n const {\n styles,\n noWrap,\n color,\n resolveColor,\n disabled,\n href,\n children: hasChildren,\n addonLeft: AddonLeft,\n addonRight: AddonRight,\n Children,\n title,\n ['aria-label']: ariaLabel,\n hintPlacement,\n } = this.asProps;\n // @ts-ignore\n const Link = this[CORE_INSTANCE];\n\n const children = sstyled(styles)(\n <>\n {AddonLeft ? (\n <Link.Addon>\n <AddonLeft />\n </Link.Addon>\n ) : null}\n {addonTextChildren(Children, Link.Text, Link.Addon)}\n {AddonRight ? (\n <Link.Addon>\n <AddonRight />\n </Link.Addon>\n ) : null}\n </>,\n );\n\n const hintContent = title ?? ariaLabel ?? this.state.ariaLabelledByContent ?? '';\n\n const linkProps = {\n role: 'link',\n tabIndex: disabled ? -1 : 0,\n 'use:href': disabled ? undefined : href,\n 'visually-disabled': disabled,\n render: Text,\n 'text-color': resolveColor(color),\n tag: 'a',\n noWrapText: noWrap,\n 'use:noWrap': false,\n ref: this.containerRef,\n __excludeProps: ['disabled', 'aria-disabled'],\n };\n\n const hintProps = {\n title: hintContent,\n timeout: [250, 50],\n placement: hintPlacement,\n __excludeProps: [],\n };\n\n if (hasChildren === undefined || title) {\n return this.renderLinkWithHint({ linkProps, hintProps, children });\n }\n\n return this.renderLink({ linkProps, children });\n }\n}\n\nfunction LinkText(props) {\n const SText = Root;\n const { styles } = props;\n return sstyled(styles)(<SText render={Box} tag='span' />);\n}\n\nfunction Addon(props) {\n const SAddon = Root;\n const { styles } = props;\n return sstyled(styles)(<SAddon render={Box} tag='span' />);\n}\n\nconst Link = createComponent(RootLink, {\n Text: LinkText,\n Addon,\n});\n\nexport default Link;\n"],"mappings":";;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AADA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,qBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,kBAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,OAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,UAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,oBAAA,GAAAR,sBAAA,CAAAF,OAAA;AAAuF;AAAA,IAAAW,KAAA,+BAAAZ,KAAA,CAAAa,OAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,IAIjFC,QAAQ,0BAAAC,UAAA;EAAA,IAAAC,UAAA,aAAAF,QAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,OAAAC,aAAA,aAAAJ,QAAA;EAAA,SAAAA,SAAA;IAAA,IAAAK,KAAA;IAAA,IAAAC,gBAAA,mBAAAN,QAAA;IAAA,SAAAO,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,G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BhB,QAAQ,aAMK,CAAC,IAAAkG,gCAAoB,GAAE,EAAE,IAAAC,+BAAmB,GAAE,CAAC;AAkHlE,SAASC,QAAQA,CAACC,KAAK,EAAE;EAAA,IAAAC,KAAA,GAAAC,YAAA;IAAAC,KAAA;EACvB,IAAMC,KAAK,GAE2BC,YAAG;EADzC,IAAQzD,MAAM,GAAKoD,KAAK,CAAhBpD,MAAM;EACd,OAAAuD,KAAA,GAAO,IAAA1G,aAAO,EAACmD,MAAM,CAAC,eAAC9D,MAAA,YAAAiE,aAAA,CAACqD,KAAK,EAAAD,KAAA,CAAAnD,EAAA,cAAAC,cAAA,qBAAArE,KAAA,CAAAsE,WAAA;IAAA,OAAkB;EAAM,GAAA+C,KAAA,IAAG;AAC1D;AAEA,SAASlB,KAAKA,CAACiB,KAAK,EAAE;EAAA,IAAAM,KAAA,GAAAJ,YAAA;IAAAK,KAAA;EACpB,IAAMC,MAAM,GAE2BH,YAAG;EAD1C,IAAQzD,MAAM,GAAKoD,KAAK,CAAhBpD,MAAM;EACd,OAAA2D,KAAA,GAAO,IAAA9G,aAAO,EAACmD,MAAM,CAAC,eAAC9D,MAAA,YAAAiE,aAAA,CAACyD,MAAM,EAAAD,KAAA,CAAAvD,EAAA,eAAAC,cAAA,qBAAArE,KAAA,CAAAsE,WAAA;IAAA,OAAkB;EAAM,GAAAoD,KAAA,IAAG;AAC3D;AAEA,IAAM1B,IAAI,GAAG,IAAA6B,qBAAe,EAAC9G,QAAQ,EAAE;EACrCmD,IAAI,EAAEiD,QAAQ;EACdhB,KAAK,EAALA;AACF,CAAC,CAAC;AAAC,IAAA2B,QAAA,GAEY9B,IAAI;AAAA+B,OAAA,cAAAD,QAAA"}
|
|
1
|
+
{"version":3,"file":"Link.js","names":["_core","require","_addonTextChildren","_interopRequireDefault","_keyboardFocusEnhance","_resolveColorEnhance","_hasLabels","_logger","_flexBox","_tooltip","_typography","_react","_callSuper","t","o","e","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct2","Reflect","construct","constructor","apply","style","sstyled","insert","RootLink","_Component","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","concat","_defineProperty2","React","createRef","ariaLabelledByContent","_inherits2","_createClass2","key","value","componentDidMount","_this2","process","env","NODE_ENV","logger","warn","containerRef","current","hasLabels","asProps","displayName","setTimeout","_document$getElementB","_document$getElementB2","setState","document","getElementById","textContent","renderLink","_ref0","_ref","_ref5","linkProps","children","styles","SLink","Text","createElement","cn","_objectSpread2","assignProps","renderLinkWithHint","_ref1","_ref2","_ref6","hintProps","Hint","render","_ref7","_ref10","_ref11","_this$asProps","noWrap","color","resolveColor","disabled","href","hasChildren","AddonLeft","addonLeft","AddonRight","addonRight","Children","title","ariaLabel","hintPlacement","Link","CORE_INSTANCE","Fragment","Addon","addonTextChildren","hintContent","state","undefined","timeout","placement","__excludeProps","Component","keyboardFocusEnhance","resolveColorEnhance","LinkText","props","_ref3","arguments[0]","_ref8","SText","Box","_ref4","_ref9","SAddon","createComponent","_default","exports"],"sources":["../../src/Link.jsx"],"sourcesContent":["import { createComponent, Component, Root, sstyled, CORE_INSTANCE } from '@semcore/core';\nimport addonTextChildren from '@semcore/core/lib/utils/addonTextChildren';\nimport keyboardFocusEnhance from '@semcore/core/lib/utils/enhances/keyboardFocusEnhance';\nimport resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';\nimport hasLabels from '@semcore/core/lib/utils/hasLabels';\nimport logger from '@semcore/core/lib/utils/logger';\nimport { Box } from '@semcore/flex-box';\nimport { Hint } from '@semcore/tooltip';\nimport { Text } from '@semcore/typography';\nimport React from 'react';\n\nimport style from './style/link.shadow.css';\n\nclass RootLink extends Component {\n static displayName = 'Link';\n static defaultProps = {\n noWrap: true,\n };\n\n static style = style;\n static enhance = [keyboardFocusEnhance(), resolveColorEnhance()];\n containerRef = React.createRef();\n\n state = {\n ariaLabelledByContent: '',\n };\n\n componentDidMount() {\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(\n this.containerRef.current && !hasLabels(this.containerRef.current),\n `'title' or 'aria-label' or 'aria-labelledby' are required props for links without text content`,\n this.asProps['data-ui-name'] || RootLink.displayName,\n );\n }\n\n if (this.asProps['aria-labelledby']) {\n setTimeout(() => {\n this.setState({\n ariaLabelledByContent:\n document.getElementById(this.asProps['aria-labelledby'])?.textContent ?? '',\n });\n }, 0);\n }\n }\n\n renderLink({ linkProps, children }) {\n const { styles } = this.asProps;\n const SLink = Root;\n\n return sstyled(styles)(\n <SLink render={Text} {...linkProps}>\n {children}\n </SLink>,\n );\n }\n\n renderLinkWithHint({ linkProps, children, hintProps }) {\n const { styles } = this.asProps;\n const SLink = Root;\n\n return sstyled(styles)(\n <SLink render={Hint} {...linkProps} {...hintProps}>\n {children}\n </SLink>,\n );\n }\n\n render() {\n const {\n styles,\n noWrap,\n color,\n resolveColor,\n disabled,\n href,\n children: hasChildren,\n addonLeft: AddonLeft,\n addonRight: AddonRight,\n Children,\n title,\n 'aria-label': ariaLabel,\n hintPlacement,\n } = this.asProps;\n // @ts-ignore\n const Link = this[CORE_INSTANCE];\n\n const children = sstyled(styles)(\n <>\n {AddonLeft\n ? (\n <Link.Addon>\n <AddonLeft />\n </Link.Addon>\n )\n : null}\n {addonTextChildren(Children, Link.Text, Link.Addon)}\n {AddonRight\n ? (\n <Link.Addon>\n <AddonRight />\n </Link.Addon>\n )\n : null}\n </>,\n );\n\n const hintContent = title ?? ariaLabel ?? this.state.ariaLabelledByContent ?? '';\n\n const linkProps = {\n 'role': 'link',\n 'tabIndex': disabled ? -1 : 0,\n 'use:href': disabled ? undefined : href,\n 'visually-disabled': disabled,\n 'render': Text,\n 'text-color': resolveColor(color),\n 'tag': 'a',\n 'noWrapText': noWrap,\n 'use:noWrap': false,\n 'ref': this.containerRef,\n '__excludeProps': ['disabled', 'aria-disabled'],\n };\n\n const hintProps = {\n title: hintContent,\n timeout: [250, 50],\n placement: hintPlacement,\n __excludeProps: [],\n };\n\n if (hasChildren === undefined || title) {\n return this.renderLinkWithHint({ linkProps, hintProps, children });\n }\n\n return this.renderLink({ linkProps, children });\n }\n}\n\nfunction LinkText(props) {\n const SText = Root;\n const { styles } = props;\n return sstyled(styles)(<SText render={Box} tag='span' />);\n}\n\nfunction Addon(props) {\n const SAddon = Root;\n const { styles } = props;\n return sstyled(styles)(<SAddon render={Box} tag='span' />);\n}\n\nconst Link = createComponent(RootLink, {\n Text: LinkText,\n Addon,\n});\n\nexport default Link;\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,oBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,UAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,OAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAR,sBAAA,CAAAF,OAAA;AAA0B,SAAAW,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,aAAAF,CAAA,OAAAG,2BAAA,aAAAJ,CAAA,MAAAK,0BAAA,iBAAAC,OAAA,CAAAC,SAAA,CAAAN,CAAA,EAAAC,CAAA,YAAAC,gBAAA,aAAAH,CAAA,EAAAQ,WAAA,IAAAP,CAAA,CAAAQ,KAAA,CAAAT,CAAA,EAAAE,CAAA;AAAA;AAAA,IAAAQ,KAAA,8BAAAvB,KAAA,CAAAwB,OAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,IAIpBC,QAAQ,0BAAAC,UAAA;EAAA,SAAAD,SAAA;IAAA,IAAAE,KAAA;IAAA,IA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.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import type { Intergalactic, UnknownProperties } from '@semcore/core';\nimport type { BoxProps } from '@semcore/flex-box';\nimport type { TextProps } from '@semcore/typography';\nimport type React from 'react';\n\n/** @deprecated */\nexport interface ILinkProps extends LinkProps, UnknownProperties {}\nexport type LinkProps = TextProps & {\n /**\n * CSS property of the display link (inline|inline-block)\n * @default false\n */\n inline?: boolean;\n /**\n * Sets the link to the disabled state\n */\n disabled?: boolean;\n /**\n * Sets the link to the active state\n */\n active?: boolean;\n /** This flag enables highlighting of the visited link\n */\n enableVisited?: boolean;\n /** The text will not be moved to a new line\n * @default true\n */\n noWrap?: boolean;\n /** Left addon tag */\n addonLeft?: React.ElementType;\n /** Right addon tag */\n addonRight?: React.ElementType;\n};\n\ndeclare const Link: Intergalactic.Component<'a', LinkProps> & {\n Text: Intergalactic.Component<'span', TextProps>;\n Addon: Intergalactic.Component<'span', BoxProps>;\n};\n\nexport default Link;\n"],"mappings":"","ignoreList":[]}
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_Link","_interopRequireDefault","require"],"sources":["../../src/index.js"],"sourcesContent":["export { default } from './Link';\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Link","_interopRequireDefault","require"],"sources":["../../src/index.js"],"sourcesContent":["export { default } from './Link';\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA","ignoreList":[]}
|
package/lib/es6/Link.js
CHANGED
|
@@ -1,57 +1,58 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import
|
|
4
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
+
import _isNativeReflectConstruct from "@babel/runtime/helpers/isNativeReflectConstruct";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
7
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
-
import _createSuper from "@babel/runtime/helpers/createSuper";
|
|
7
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
9
|
import { sstyled as _sstyled } from "@semcore/core";
|
|
9
10
|
import { assignProps as _assignProps4 } from "@semcore/core";
|
|
10
11
|
import { assignProps as _assignProps3 } from "@semcore/core";
|
|
11
12
|
import { assignProps as _assignProps2 } from "@semcore/core";
|
|
12
13
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
13
|
-
|
|
14
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
14
15
|
import { createComponent, Component, Root, sstyled, CORE_INSTANCE } from '@semcore/core';
|
|
15
|
-
import { Text } from '@semcore/typography';
|
|
16
|
-
import { Box } from '@semcore/flex-box';
|
|
17
|
-
import { Hint } from '@semcore/tooltip';
|
|
18
|
-
import keyboardFocusEnhance from '@semcore/core/lib/utils/enhances/keyboardFocusEnhance';
|
|
19
16
|
import addonTextChildren from '@semcore/core/lib/utils/addonTextChildren';
|
|
20
|
-
import
|
|
21
|
-
import hasLabels from '@semcore/core/lib/utils/hasLabels';
|
|
17
|
+
import keyboardFocusEnhance from '@semcore/core/lib/utils/enhances/keyboardFocusEnhance';
|
|
22
18
|
import resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';
|
|
19
|
+
import hasLabels from '@semcore/core/lib/utils/hasLabels';
|
|
20
|
+
import logger from '@semcore/core/lib/utils/logger';
|
|
21
|
+
import { Box } from '@semcore/flex-box';
|
|
22
|
+
import { Hint } from '@semcore/tooltip';
|
|
23
|
+
import { Text } from '@semcore/typography';
|
|
24
|
+
import React from 'react';
|
|
23
25
|
/*!__reshadow-styles__:"./style/link.shadow.css"*/
|
|
24
|
-
var style = (
|
|
26
|
+
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SLink_h4l94_gg_{display:inline-block;font-family:inherit;color:var(--intergalactic-text-link, #006dca);line-height:normal;position:relative;cursor:pointer;border:0;padding:0;margin:0;box-shadow:none;-webkit-tap-highlight-color:transparent;background:0 0;transition:color .15s ease-in-out}.___SLink_h4l94_gg_,.___SLink_h4l94_gg_:active{-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SLink_h4l94_gg_:hover{-webkit-text-decoration:none;text-decoration:none}}.___SLink_h4l94_gg_::-moz-focus-inner{border:0;padding:0}.___SLink_h4l94_gg_.__active_h4l94_gg_,.___SLink_h4l94_gg_:active{color:var(--intergalactic-text-link-hover-active, #044792)}@media (hover:hover){.___SLink_h4l94_gg_:hover{color:var(--intergalactic-text-link-hover-active, #044792)}}.___SLink_h4l94_gg_.__active_h4l94_gg_ .___SText_h4l94_gg_,.___SLink_h4l94_gg_:active .___SText_h4l94_gg_{border-color:currentColor}@media (hover:hover){.___SLink_h4l94_gg_:hover .___SText_h4l94_gg_{border-color:currentColor}}.___SLink_h4l94_gg_.__enableVisited_h4l94_gg_:visited{color:var(--intergalactic-text-link-visited, #8649e1)}@media (hover:hover){.___SLink_h4l94_gg_.__enableVisited_h4l94_gg_:visited:hover{color:var(--intergalactic-text-link-visited, #8649e1)}}.___SLink_h4l94_gg_.__visually-disabled_h4l94_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SLink_h4l94_gg_.__noWrapText_h4l94_gg_{white-space:nowrap}.___SLink_h4l94_gg_.__inline_h4l94_gg_{display:inline}.___SAddon_h4l94_gg_{display:inline-flex;justify-content:center;align-items:center;margin-bottom:var(--intergalactic-spacing-05x, 2px);vertical-align:middle;pointer-events:none}.___SLink_h4l94_gg_ .___SAddon_h4l94_gg_:not(:only-child):first-child{margin-right:var(--intergalactic-spacing-1x, 4px)}.___SLink_h4l94_gg_ .___SAddon_h4l94_gg_:not(:only-child):last-child{margin-left:var(--intergalactic-spacing-1x, 4px)}.___SText_h4l94_gg_{border-bottom-width:1px;border-bottom-style:solid;border-color:transparent;transition:border-bottom-color .15s ease-in-out}.___SLink_h4l94_gg_.__text-color_h4l94_gg_{color:var(--text-color_h4l94)}.___SLink_h4l94_gg_.__text-color_h4l94_gg_.__active_h4l94_gg_,.___SLink_h4l94_gg_.__text-color_h4l94_gg_:active{color:var(--text-color_h4l94);filter:brightness(.8)}@media (hover:hover){.___SLink_h4l94_gg_.__text-color_h4l94_gg_:hover{color:var(--text-color_h4l94);filter:brightness(.8)}}@media (prefers-reduced-motion){.___SLink_h4l94_gg_,.___SText_h4l94_gg_{transition:none}}", /*__inner_css_end__*/"h4l94_gg_"),
|
|
25
27
|
/*__reshadow_css_end__*/
|
|
26
28
|
{
|
|
27
|
-
"__SLink": "
|
|
28
|
-
"_visually-disabled": "__visually-
|
|
29
|
-
"_noWrapText": "
|
|
30
|
-
"_inline": "
|
|
31
|
-
"__SAddon": "
|
|
32
|
-
"__SText": "
|
|
33
|
-
"_active": "
|
|
34
|
-
"_enableVisited": "
|
|
35
|
-
"_text-color": "__text-
|
|
36
|
-
"--text-color": "--text-
|
|
29
|
+
"__SLink": "___SLink_h4l94_gg_",
|
|
30
|
+
"_visually-disabled": "__visually-disabled_h4l94_gg_",
|
|
31
|
+
"_noWrapText": "__noWrapText_h4l94_gg_",
|
|
32
|
+
"_inline": "__inline_h4l94_gg_",
|
|
33
|
+
"__SAddon": "___SAddon_h4l94_gg_",
|
|
34
|
+
"__SText": "___SText_h4l94_gg_",
|
|
35
|
+
"_active": "__active_h4l94_gg_",
|
|
36
|
+
"_enableVisited": "__enableVisited_h4l94_gg_",
|
|
37
|
+
"_text-color": "__text-color_h4l94_gg_",
|
|
38
|
+
"--text-color": "--text-color_h4l94"
|
|
37
39
|
});
|
|
38
40
|
var RootLink = /*#__PURE__*/function (_Component) {
|
|
39
|
-
_inherits(RootLink, _Component);
|
|
40
|
-
var _super = _createSuper(RootLink);
|
|
41
41
|
function RootLink() {
|
|
42
42
|
var _this;
|
|
43
43
|
_classCallCheck(this, RootLink);
|
|
44
44
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
45
45
|
args[_key] = arguments[_key];
|
|
46
46
|
}
|
|
47
|
-
_this =
|
|
48
|
-
_defineProperty(
|
|
49
|
-
_defineProperty(
|
|
47
|
+
_this = _callSuper(this, RootLink, [].concat(args));
|
|
48
|
+
_defineProperty(_this, "containerRef", /*#__PURE__*/React.createRef());
|
|
49
|
+
_defineProperty(_this, "state", {
|
|
50
50
|
ariaLabelledByContent: ''
|
|
51
51
|
});
|
|
52
52
|
return _this;
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
_inherits(RootLink, _Component);
|
|
55
|
+
return _createClass(RootLink, [{
|
|
55
56
|
key: "componentDidMount",
|
|
56
57
|
value: function componentDidMount() {
|
|
57
58
|
var _this2 = this;
|
|
@@ -69,23 +70,23 @@ var RootLink = /*#__PURE__*/function (_Component) {
|
|
|
69
70
|
}
|
|
70
71
|
}, {
|
|
71
72
|
key: "renderLink",
|
|
72
|
-
value: function renderLink(
|
|
73
|
+
value: function renderLink(_ref0) {
|
|
73
74
|
var _ref = this.asProps,
|
|
74
75
|
_ref5;
|
|
75
|
-
var linkProps =
|
|
76
|
-
children =
|
|
76
|
+
var linkProps = _ref0.linkProps,
|
|
77
|
+
children = _ref0.children;
|
|
77
78
|
var styles = this.asProps.styles;
|
|
78
79
|
var SLink = Text;
|
|
79
80
|
return _ref5 = sstyled(styles), /*#__PURE__*/React.createElement(SLink, _ref5.cn("SLink", _objectSpread({}, _assignProps(_objectSpread({}, linkProps), _ref))), children);
|
|
80
81
|
}
|
|
81
82
|
}, {
|
|
82
83
|
key: "renderLinkWithHint",
|
|
83
|
-
value: function renderLinkWithHint(
|
|
84
|
+
value: function renderLinkWithHint(_ref1) {
|
|
84
85
|
var _ref2 = this.asProps,
|
|
85
86
|
_ref6;
|
|
86
|
-
var linkProps =
|
|
87
|
-
children =
|
|
88
|
-
hintProps =
|
|
87
|
+
var linkProps = _ref1.linkProps,
|
|
88
|
+
children = _ref1.children,
|
|
89
|
+
hintProps = _ref1.hintProps;
|
|
89
90
|
var styles = this.asProps.styles;
|
|
90
91
|
var SLink = Hint;
|
|
91
92
|
return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(SLink, _ref6.cn("SLink", _objectSpread({}, _assignProps2(_objectSpread(_objectSpread({}, linkProps), hintProps), _ref2))), children);
|
|
@@ -93,7 +94,7 @@ var RootLink = /*#__PURE__*/function (_Component) {
|
|
|
93
94
|
}, {
|
|
94
95
|
key: "render",
|
|
95
96
|
value: function render() {
|
|
96
|
-
var _ref7,
|
|
97
|
+
var _ref7, _ref10, _ref11;
|
|
97
98
|
var _this$asProps = this.asProps,
|
|
98
99
|
styles = _this$asProps.styles,
|
|
99
100
|
noWrap = _this$asProps.noWrap,
|
|
@@ -111,19 +112,19 @@ var RootLink = /*#__PURE__*/function (_Component) {
|
|
|
111
112
|
// @ts-ignore
|
|
112
113
|
var Link = this[CORE_INSTANCE];
|
|
113
114
|
var children = (_ref7 = sstyled(styles), /*#__PURE__*/React.createElement(React.Fragment, null, AddonLeft ? /*#__PURE__*/React.createElement(Link.Addon, null, /*#__PURE__*/React.createElement(AddonLeft, _ref7.cn("AddonLeft", {}))) : null, addonTextChildren(Children, Link.Text, Link.Addon), AddonRight ? /*#__PURE__*/React.createElement(Link.Addon, null, /*#__PURE__*/React.createElement(AddonRight, _ref7.cn("AddonRight", {}))) : null));
|
|
114
|
-
var hintContent = (
|
|
115
|
+
var hintContent = (_ref10 = (_ref11 = title !== null && title !== void 0 ? title : ariaLabel) !== null && _ref11 !== void 0 ? _ref11 : this.state.ariaLabelledByContent) !== null && _ref10 !== void 0 ? _ref10 : '';
|
|
115
116
|
var linkProps = {
|
|
116
|
-
role: 'link',
|
|
117
|
-
tabIndex: disabled ? -1 : 0,
|
|
117
|
+
'role': 'link',
|
|
118
|
+
'tabIndex': disabled ? -1 : 0,
|
|
118
119
|
'use:href': disabled ? undefined : href,
|
|
119
120
|
'visually-disabled': disabled,
|
|
120
|
-
render: Text,
|
|
121
|
+
'render': Text,
|
|
121
122
|
'text-color': resolveColor(color),
|
|
122
|
-
tag: 'a',
|
|
123
|
-
noWrapText: noWrap,
|
|
123
|
+
'tag': 'a',
|
|
124
|
+
'noWrapText': noWrap,
|
|
124
125
|
'use:noWrap': false,
|
|
125
|
-
ref: this.containerRef,
|
|
126
|
-
__excludeProps: ['disabled', 'aria-disabled']
|
|
126
|
+
'ref': this.containerRef,
|
|
127
|
+
'__excludeProps': ['disabled', 'aria-disabled']
|
|
127
128
|
};
|
|
128
129
|
var hintProps = {
|
|
129
130
|
title: hintContent,
|
|
@@ -144,7 +145,6 @@ var RootLink = /*#__PURE__*/function (_Component) {
|
|
|
144
145
|
});
|
|
145
146
|
}
|
|
146
147
|
}]);
|
|
147
|
-
return RootLink;
|
|
148
148
|
}(Component);
|
|
149
149
|
_defineProperty(RootLink, "displayName", 'Link');
|
|
150
150
|
_defineProperty(RootLink, "defaultProps", {
|
package/lib/es6/Link.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.js","names":["React","createComponent","Component","Root","sstyled","CORE_INSTANCE","Text","Box","Hint","keyboardFocusEnhance","addonTextChildren","logger","hasLabels","resolveColorEnhance","style","_sstyled","insert","RootLink","_Component","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","createRef","ariaLabelledByContent","_createClass","key","value","componentDidMount","_this2","process","env","NODE_ENV","warn","containerRef","current","asProps","displayName","setTimeout","_document$getElementB","_document$getElementB2","setState","document","getElementById","textContent","renderLink","_ref10","_ref","_ref5","linkProps","children","styles","SLink","createElement","cn","_objectSpread","_assignProps","renderLinkWithHint","_ref11","_ref2","_ref6","hintProps","_assignProps2","render","_ref7","_ref12","_ref13","_this$asProps","noWrap","color","resolveColor","disabled","href","hasChildren","AddonLeft","addonLeft","AddonRight","addonRight","Children","title","ariaLabel","hintPlacement","Link","Fragment","Addon","hintContent","state","role","tabIndex","undefined","tag","noWrapText","ref","__excludeProps","timeout","placement","LinkText","props","_ref3","arguments[0]","_ref8","SText","_assignProps3","_ref4","_ref9","SAddon","_assignProps4"],"sources":["../../src/Link.jsx"],"sourcesContent":["import React from 'react';\nimport { createComponent, Component, Root, sstyled, CORE_INSTANCE } from '@semcore/core';\nimport { Text } from '@semcore/typography';\nimport { Box } from '@semcore/flex-box';\nimport { Hint } from '@semcore/tooltip';\nimport keyboardFocusEnhance from '@semcore/core/lib/utils/enhances/keyboardFocusEnhance';\nimport addonTextChildren from '@semcore/core/lib/utils/addonTextChildren';\nimport logger from '@semcore/core/lib/utils/logger';\nimport hasLabels from '@semcore/core/lib/utils/hasLabels';\nimport resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';\n\nimport style from './style/link.shadow.css';\n\nclass RootLink extends Component {\n static displayName = 'Link';\n static defaultProps = {\n noWrap: true,\n };\n static style = style;\n static enhance = [keyboardFocusEnhance(), resolveColorEnhance()];\n containerRef = React.createRef();\n\n state = {\n ariaLabelledByContent: '',\n };\n\n componentDidMount() {\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(\n this.containerRef.current && !hasLabels(this.containerRef.current),\n `'title' or 'aria-label' or 'aria-labelledby' are required props for links without text content`,\n this.asProps['data-ui-name'] || RootLink.displayName,\n );\n }\n\n if (this.asProps['aria-labelledby']) {\n setTimeout(() => {\n this.setState({\n ariaLabelledByContent:\n document.getElementById(this.asProps['aria-labelledby'])?.textContent ?? '',\n });\n }, 0);\n }\n }\n\n renderLink({ linkProps, children }) {\n const { styles } = this.asProps;\n const SLink = Root;\n\n return sstyled(styles)(\n <SLink render={Text} {...linkProps}>\n {children}\n </SLink>,\n );\n }\n\n renderLinkWithHint({ linkProps, children, hintProps }) {\n const { styles } = this.asProps;\n const SLink = Root;\n\n return sstyled(styles)(\n <SLink render={Hint} {...linkProps} {...hintProps}>\n {children}\n </SLink>,\n );\n }\n\n render() {\n const {\n styles,\n noWrap,\n color,\n resolveColor,\n disabled,\n href,\n children: hasChildren,\n addonLeft: AddonLeft,\n addonRight: AddonRight,\n Children,\n title,\n ['aria-label']: ariaLabel,\n hintPlacement,\n } = this.asProps;\n // @ts-ignore\n const Link = this[CORE_INSTANCE];\n\n const children = sstyled(styles)(\n <>\n {AddonLeft ? (\n <Link.Addon>\n <AddonLeft />\n </Link.Addon>\n ) : null}\n {addonTextChildren(Children, Link.Text, Link.Addon)}\n {AddonRight ? (\n <Link.Addon>\n <AddonRight />\n </Link.Addon>\n ) : null}\n </>,\n );\n\n const hintContent = title ?? ariaLabel ?? this.state.ariaLabelledByContent ?? '';\n\n const linkProps = {\n role: 'link',\n tabIndex: disabled ? -1 : 0,\n 'use:href': disabled ? undefined : href,\n 'visually-disabled': disabled,\n render: Text,\n 'text-color': resolveColor(color),\n tag: 'a',\n noWrapText: noWrap,\n 'use:noWrap': false,\n ref: this.containerRef,\n __excludeProps: ['disabled', 'aria-disabled'],\n };\n\n const hintProps = {\n title: hintContent,\n timeout: [250, 50],\n placement: hintPlacement,\n __excludeProps: [],\n };\n\n if (hasChildren === undefined || title) {\n return this.renderLinkWithHint({ linkProps, hintProps, children });\n }\n\n return this.renderLink({ linkProps, children });\n }\n}\n\nfunction LinkText(props) {\n const SText = Root;\n const { styles } = props;\n return sstyled(styles)(<SText render={Box} tag='span' />);\n}\n\nfunction Addon(props) {\n const SAddon = Root;\n const { styles } = props;\n return sstyled(styles)(<SAddon render={Box} tag='span' />);\n}\n\nconst Link = createComponent(RootLink, {\n Text: LinkText,\n Addon,\n});\n\nexport default Link;\n"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe,EAAEC,SAAS,EAAEC,IAAI,EAAEC,OAAO,EAAEC,aAAa,QAAQ,eAAe;AACxF,SAASC,IAAI,QAAQ,qBAAqB;AAC1C,SAASC,GAAG,QAAQ,mBAAmB;AACvC,SAASC,IAAI,QAAQ,kBAAkB;AACvC,OAAOC,oBAAoB,MAAM,uDAAuD;AACxF,OAAOC,iBAAiB,MAAM,2CAA2C;AACzE,OAAOC,MAAM,MAAM,gCAAgC;AACnD,OAAOC,SAAS,MAAM,mCAAmC;AACzD,OAAOC,mBAAmB,MAAM,sDAAsD;AAAC;AAAA,IAAAC,KAAA,+BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,IAIjFC,QAAQ,0BAAAC,UAAA;EAAAC,SAAA,CAAAF,QAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,QAAA;EAAA,SAAAA,SAAA;IAAA,IAAAK,KAAA;IAAAC,eAAA,OAAAN,QAAA;IAAA,SAAAO,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA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A,GAAAC,YAAA;IAAAC,KAAA;EACvB,IAAMC,KAAK,GAE2B1G,GAAG;EADzC,IAAQwD,MAAM,GAAK8C,KAAK,CAAhB9C,MAAM;EACd,OAAAiD,KAAA,GAAO5G,OAAO,CAAC2D,MAAM,CAAC,eAAC/D,KAAA,CAAAiE,aAAA,CAACgD,KAAK,EAAAD,KAAA,CAAA9C,EAAA,UAAAC,aAAA,KAAA+C,aAAA;IAAA,OAAkB;EAAM,GAAAJ,KAAA,IAAG;AAC1D;AAEA,SAASd,KAAKA,CAACa,KAAK,EAAE;EAAA,IAAAM,KAAA,GAAAJ,YAAA;IAAAK,KAAA;EACpB,IAAMC,MAAM,GAE2B9G,GAAG;EAD1C,IAAQwD,MAAM,GAAK8C,KAAK,CAAhB9C,MAAM;EACd,OAAAqD,KAAA,GAAOhH,OAAO,CAAC2D,MAAM,CAAC,eAAC/D,KAAA,CAAAiE,aAAA,CAACoD,MAAM,EAAAD,KAAA,CAAAlD,EAAA,WAAAC,aAAA,KAAAmD,aAAA;IAAA,OAAkB;EAAM,GAAAH,KAAA,IAAG;AAC3D;AAEA,IAAMrB,IAAI,GAAG7F,eAAe,CAACgB,QAAQ,EAAE;EACrCX,IAAI,EAAEsG,QAAQ;EACdZ,KAAK,EAALA;AACF,CAAC,CAAC;AAEF,eAAeF,IAAI"}
|
|
1
|
+
{"version":3,"file":"Link.js","names":["createComponent","Component","Root","sstyled","CORE_INSTANCE","addonTextChildren","keyboardFocusEnhance","resolveColorEnhance","hasLabels","logger","Box","Hint","Text","React","style","_sstyled","insert","RootLink","_Component","_this","_classCallCheck","_len","arguments","length","args","Array","_key","_callSuper","concat","_defineProperty","createRef","ariaLabelledByContent","_inherits","_createClass","key","value","componentDidMount","_this2","process","env","NODE_ENV","warn","containerRef","current","asProps","displayName","setTimeout","_document$getElementB","_document$getElementB2","setState","document","getElementById","textContent","renderLink","_ref0","_ref","_ref5","linkProps","children","styles","SLink","createElement","cn","_objectSpread","_assignProps","renderLinkWithHint","_ref1","_ref2","_ref6","hintProps","_assignProps2","render","_ref7","_ref10","_ref11","_this$asProps","noWrap","color","resolveColor","disabled","href","hasChildren","AddonLeft","addonLeft","AddonRight","addonRight","Children","title","ariaLabel","hintPlacement","Link","Fragment","Addon","hintContent","state","undefined","timeout","placement","__excludeProps","LinkText","props","_ref3","arguments[0]","_ref8","SText","_assignProps3","_ref4","_ref9","SAddon","_assignProps4"],"sources":["../../src/Link.jsx"],"sourcesContent":["import { createComponent, Component, Root, sstyled, CORE_INSTANCE } from '@semcore/core';\nimport addonTextChildren from '@semcore/core/lib/utils/addonTextChildren';\nimport keyboardFocusEnhance from '@semcore/core/lib/utils/enhances/keyboardFocusEnhance';\nimport resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';\nimport hasLabels from '@semcore/core/lib/utils/hasLabels';\nimport logger from '@semcore/core/lib/utils/logger';\nimport { Box } from '@semcore/flex-box';\nimport { Hint } from '@semcore/tooltip';\nimport { Text } from '@semcore/typography';\nimport React from 'react';\n\nimport style from './style/link.shadow.css';\n\nclass RootLink extends Component {\n static displayName = 'Link';\n static defaultProps = {\n noWrap: true,\n };\n\n static style = style;\n static enhance = [keyboardFocusEnhance(), resolveColorEnhance()];\n containerRef = React.createRef();\n\n state = {\n ariaLabelledByContent: '',\n };\n\n componentDidMount() {\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(\n this.containerRef.current && !hasLabels(this.containerRef.current),\n `'title' or 'aria-label' or 'aria-labelledby' are required props for links without text content`,\n this.asProps['data-ui-name'] || RootLink.displayName,\n );\n }\n\n if (this.asProps['aria-labelledby']) {\n setTimeout(() => {\n this.setState({\n ariaLabelledByContent:\n document.getElementById(this.asProps['aria-labelledby'])?.textContent ?? '',\n });\n }, 0);\n }\n }\n\n renderLink({ linkProps, children }) {\n const { styles } = this.asProps;\n const SLink = Root;\n\n return sstyled(styles)(\n <SLink render={Text} {...linkProps}>\n {children}\n </SLink>,\n );\n }\n\n renderLinkWithHint({ linkProps, children, hintProps }) {\n const { styles } = this.asProps;\n const SLink = Root;\n\n return sstyled(styles)(\n <SLink render={Hint} {...linkProps} {...hintProps}>\n {children}\n </SLink>,\n );\n }\n\n render() {\n const {\n styles,\n noWrap,\n color,\n resolveColor,\n disabled,\n href,\n children: hasChildren,\n addonLeft: AddonLeft,\n addonRight: AddonRight,\n Children,\n title,\n 'aria-label': ariaLabel,\n hintPlacement,\n } = this.asProps;\n // @ts-ignore\n const Link = this[CORE_INSTANCE];\n\n const children = sstyled(styles)(\n <>\n {AddonLeft\n ? (\n <Link.Addon>\n <AddonLeft />\n </Link.Addon>\n )\n : null}\n {addonTextChildren(Children, Link.Text, Link.Addon)}\n {AddonRight\n ? (\n <Link.Addon>\n <AddonRight />\n </Link.Addon>\n )\n : null}\n </>,\n );\n\n const hintContent = title ?? ariaLabel ?? this.state.ariaLabelledByContent ?? '';\n\n const linkProps = {\n 'role': 'link',\n 'tabIndex': disabled ? -1 : 0,\n 'use:href': disabled ? undefined : href,\n 'visually-disabled': disabled,\n 'render': Text,\n 'text-color': resolveColor(color),\n 'tag': 'a',\n 'noWrapText': noWrap,\n 'use:noWrap': false,\n 'ref': this.containerRef,\n '__excludeProps': ['disabled', 'aria-disabled'],\n };\n\n const hintProps = {\n title: hintContent,\n timeout: [250, 50],\n placement: hintPlacement,\n __excludeProps: [],\n };\n\n if (hasChildren === undefined || title) {\n return this.renderLinkWithHint({ linkProps, hintProps, children });\n }\n\n return this.renderLink({ linkProps, children });\n }\n}\n\nfunction LinkText(props) {\n const SText = Root;\n const { styles } = props;\n return sstyled(styles)(<SText render={Box} tag='span' />);\n}\n\nfunction Addon(props) {\n const SAddon = Root;\n const { styles } = props;\n return sstyled(styles)(<SAddon render={Box} tag='span' />);\n}\n\nconst Link = createComponent(RootLink, {\n Text: LinkText,\n Addon,\n});\n\nexport default Link;\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAASA,eAAe,EAAEC,SAAS,EAAEC,IAAI,EAAEC,OAAO,EAAEC,a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D,MAAM,CAAC,eAAC9C,KAAA,CAAAgD,aAAA,CAAC+C,MAAM,EAAAD,KAAA,CAAA7C,EAAA,WAAAC,aAAA,KAAA8C,aAAA;IAAA,OAAkB;EAAM,GAAAH,KAAA,GAAE,CAAC;AAC3D;AAEA,IAAMhB,IAAI,GAAG1F,eAAe,CAACiB,QAAQ,EAAE;EACrCL,IAAI,EAAEuF,QAAQ;EACdP,KAAK,EAALA;AACF,CAAC,CAAC;AAEF,eAAeF,IAAI","ignoreList":[]}
|
package/lib/es6/index.d.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import type { Intergalactic, UnknownProperties } from '@semcore/core';\nimport type { BoxProps } from '@semcore/flex-box';\nimport type { TextProps } from '@semcore/typography';\nimport type React from 'react';\n\n/** @deprecated */\nexport interface ILinkProps extends LinkProps, UnknownProperties {}\nexport type LinkProps = TextProps & {\n /**\n * CSS property of the display link (inline|inline-block)\n * @default false\n */\n inline?: boolean;\n /**\n * Sets the link to the disabled state\n */\n disabled?: boolean;\n /**\n * Sets the link to the active state\n */\n active?: boolean;\n /** This flag enables highlighting of the visited link\n */\n enableVisited?: boolean;\n /** The text will not be moved to a new line\n * @default true\n */\n noWrap?: boolean;\n /** Left addon tag */\n addonLeft?: React.ElementType;\n /** Right addon tag */\n addonRight?: React.ElementType;\n};\n\ndeclare const Link: Intergalactic.Component<'a', LinkProps> & {\n Text: Intergalactic.Component<'span', TextProps>;\n Addon: Intergalactic.Component<'span', BoxProps>;\n};\n\nexport default Link;\n"],"mappings":"","ignoreList":[]}
|
package/lib/es6/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default"],"sources":["../../src/index.js"],"sourcesContent":["export { default } from './Link';\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,QAAQ"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["default"],"sources":["../../src/index.js"],"sourcesContent":["export { default } from './Link';\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,QAAQ","ignoreList":[]}
|
package/lib/esm/Link.mjs
CHANGED
|
@@ -1,59 +1,62 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
import
|
|
4
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
5
|
+
import _isNativeReflectConstruct from "@babel/runtime/helpers/esm/isNativeReflectConstruct";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
5
7
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
8
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
-
import {
|
|
9
|
-
import React from "react";
|
|
10
|
-
import { Text } from "@semcore/typography";
|
|
11
|
-
import { Box } from "@semcore/flex-box";
|
|
12
|
-
import { Hint } from "@semcore/tooltip";
|
|
13
|
-
import keyboardFocusEnhance from "@semcore/core/lib/utils/enhances/keyboardFocusEnhance";
|
|
9
|
+
import { createComponent, sstyled, assignProps, CORE_INSTANCE, Component } from "@semcore/core";
|
|
14
10
|
import addonTextChildren from "@semcore/core/lib/utils/addonTextChildren";
|
|
15
|
-
import
|
|
16
|
-
import hasLabels from "@semcore/core/lib/utils/hasLabels";
|
|
11
|
+
import keyboardFocusEnhance from "@semcore/core/lib/utils/enhances/keyboardFocusEnhance";
|
|
17
12
|
import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
|
|
13
|
+
import hasLabels from "@semcore/core/lib/utils/hasLabels";
|
|
14
|
+
import logger from "@semcore/core/lib/utils/logger";
|
|
15
|
+
import { Box } from "@semcore/flex-box";
|
|
16
|
+
import { Hint } from "@semcore/tooltip";
|
|
17
|
+
import { Text } from "@semcore/typography";
|
|
18
|
+
import React from "react";
|
|
19
|
+
function _callSuper(t, o, e) {
|
|
20
|
+
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
|
|
21
|
+
}
|
|
18
22
|
/*!__reshadow-styles__:"./style/link.shadow.css"*/
|
|
19
23
|
var style = (
|
|
20
24
|
/*__reshadow_css_start__*/
|
|
21
25
|
(sstyled.insert(
|
|
22
26
|
/*__inner_css_start__*/
|
|
23
|
-
".
|
|
27
|
+
".___SLink_h4l94_gg_{display:inline-block;font-family:inherit;color:var(--intergalactic-text-link, #006dca);line-height:normal;position:relative;cursor:pointer;border:0;padding:0;margin:0;box-shadow:none;-webkit-tap-highlight-color:transparent;background:0 0;transition:color .15s ease-in-out}.___SLink_h4l94_gg_,.___SLink_h4l94_gg_:active{-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SLink_h4l94_gg_:hover{-webkit-text-decoration:none;text-decoration:none}}.___SLink_h4l94_gg_::-moz-focus-inner{border:0;padding:0}.___SLink_h4l94_gg_.__active_h4l94_gg_,.___SLink_h4l94_gg_:active{color:var(--intergalactic-text-link-hover-active, #044792)}@media (hover:hover){.___SLink_h4l94_gg_:hover{color:var(--intergalactic-text-link-hover-active, #044792)}}.___SLink_h4l94_gg_.__active_h4l94_gg_ .___SText_h4l94_gg_,.___SLink_h4l94_gg_:active .___SText_h4l94_gg_{border-color:currentColor}@media (hover:hover){.___SLink_h4l94_gg_:hover .___SText_h4l94_gg_{border-color:currentColor}}.___SLink_h4l94_gg_.__enableVisited_h4l94_gg_:visited{color:var(--intergalactic-text-link-visited, #8649e1)}@media (hover:hover){.___SLink_h4l94_gg_.__enableVisited_h4l94_gg_:visited:hover{color:var(--intergalactic-text-link-visited, #8649e1)}}.___SLink_h4l94_gg_.__visually-disabled_h4l94_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SLink_h4l94_gg_.__noWrapText_h4l94_gg_{white-space:nowrap}.___SLink_h4l94_gg_.__inline_h4l94_gg_{display:inline}.___SAddon_h4l94_gg_{display:inline-flex;justify-content:center;align-items:center;margin-bottom:var(--intergalactic-spacing-05x, 2px);vertical-align:middle;pointer-events:none}.___SLink_h4l94_gg_ .___SAddon_h4l94_gg_:not(:only-child):first-child{margin-right:var(--intergalactic-spacing-1x, 4px)}.___SLink_h4l94_gg_ .___SAddon_h4l94_gg_:not(:only-child):last-child{margin-left:var(--intergalactic-spacing-1x, 4px)}.___SText_h4l94_gg_{border-bottom-width:1px;border-bottom-style:solid;border-color:transparent;transition:border-bottom-color .15s ease-in-out}.___SLink_h4l94_gg_.__text-color_h4l94_gg_{color:var(--text-color_h4l94)}.___SLink_h4l94_gg_.__text-color_h4l94_gg_.__active_h4l94_gg_,.___SLink_h4l94_gg_.__text-color_h4l94_gg_:active{color:var(--text-color_h4l94);filter:brightness(.8)}@media (hover:hover){.___SLink_h4l94_gg_.__text-color_h4l94_gg_:hover{color:var(--text-color_h4l94);filter:brightness(.8)}}@media (prefers-reduced-motion){.___SLink_h4l94_gg_,.___SText_h4l94_gg_{transition:none}}",
|
|
24
28
|
/*__inner_css_end__*/
|
|
25
|
-
"
|
|
29
|
+
"h4l94_gg_"
|
|
26
30
|
), /*__reshadow_css_end__*/
|
|
27
31
|
{
|
|
28
|
-
"__SLink": "
|
|
29
|
-
"_visually-disabled": "__visually-
|
|
30
|
-
"_noWrapText": "
|
|
31
|
-
"_inline": "
|
|
32
|
-
"__SAddon": "
|
|
33
|
-
"__SText": "
|
|
34
|
-
"_active": "
|
|
35
|
-
"_enableVisited": "
|
|
36
|
-
"_text-color": "__text-
|
|
37
|
-
"--text-color": "--text-
|
|
32
|
+
"__SLink": "___SLink_h4l94_gg_",
|
|
33
|
+
"_visually-disabled": "__visually-disabled_h4l94_gg_",
|
|
34
|
+
"_noWrapText": "__noWrapText_h4l94_gg_",
|
|
35
|
+
"_inline": "__inline_h4l94_gg_",
|
|
36
|
+
"__SAddon": "___SAddon_h4l94_gg_",
|
|
37
|
+
"__SText": "___SText_h4l94_gg_",
|
|
38
|
+
"_active": "__active_h4l94_gg_",
|
|
39
|
+
"_enableVisited": "__enableVisited_h4l94_gg_",
|
|
40
|
+
"_text-color": "__text-color_h4l94_gg_",
|
|
41
|
+
"--text-color": "--text-color_h4l94"
|
|
38
42
|
})
|
|
39
43
|
);
|
|
40
44
|
var RootLink = /* @__PURE__ */ function(_Component) {
|
|
41
|
-
_inherits(RootLink2, _Component);
|
|
42
|
-
var _super = _createSuper(RootLink2);
|
|
43
45
|
function RootLink2() {
|
|
44
46
|
var _this;
|
|
45
47
|
_classCallCheck(this, RootLink2);
|
|
46
48
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
47
49
|
args[_key] = arguments[_key];
|
|
48
50
|
}
|
|
49
|
-
_this =
|
|
50
|
-
_defineProperty(
|
|
51
|
-
_defineProperty(
|
|
51
|
+
_this = _callSuper(this, RootLink2, [].concat(args));
|
|
52
|
+
_defineProperty(_this, "containerRef", /* @__PURE__ */ React.createRef());
|
|
53
|
+
_defineProperty(_this, "state", {
|
|
52
54
|
ariaLabelledByContent: ""
|
|
53
55
|
});
|
|
54
56
|
return _this;
|
|
55
57
|
}
|
|
56
|
-
|
|
58
|
+
_inherits(RootLink2, _Component);
|
|
59
|
+
return _createClass(RootLink2, [{
|
|
57
60
|
key: "componentDidMount",
|
|
58
61
|
value: function componentDidMount() {
|
|
59
62
|
var _this2 = this;
|
|
@@ -71,18 +74,18 @@ var RootLink = /* @__PURE__ */ function(_Component) {
|
|
|
71
74
|
}
|
|
72
75
|
}, {
|
|
73
76
|
key: "renderLink",
|
|
74
|
-
value: function renderLink(
|
|
77
|
+
value: function renderLink(_ref0) {
|
|
75
78
|
var _ref = this.asProps, _ref5;
|
|
76
|
-
var linkProps =
|
|
79
|
+
var linkProps = _ref0.linkProps, children = _ref0.children;
|
|
77
80
|
var styles = this.asProps.styles;
|
|
78
81
|
var SLink = Text;
|
|
79
82
|
return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SLink, _ref5.cn("SLink", _objectSpread({}, assignProps(_objectSpread({}, linkProps), _ref))), children);
|
|
80
83
|
}
|
|
81
84
|
}, {
|
|
82
85
|
key: "renderLinkWithHint",
|
|
83
|
-
value: function renderLinkWithHint(
|
|
86
|
+
value: function renderLinkWithHint(_ref1) {
|
|
84
87
|
var _ref2 = this.asProps, _ref6;
|
|
85
|
-
var linkProps =
|
|
88
|
+
var linkProps = _ref1.linkProps, children = _ref1.children, hintProps = _ref1.hintProps;
|
|
86
89
|
var styles = this.asProps.styles;
|
|
87
90
|
var SLink = Hint;
|
|
88
91
|
return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SLink, _ref6.cn("SLink", _objectSpread({}, assignProps(_objectSpread(_objectSpread({}, linkProps), hintProps), _ref2))), children);
|
|
@@ -90,23 +93,23 @@ var RootLink = /* @__PURE__ */ function(_Component) {
|
|
|
90
93
|
}, {
|
|
91
94
|
key: "render",
|
|
92
95
|
value: function render() {
|
|
93
|
-
var _ref7,
|
|
96
|
+
var _ref7, _ref10, _ref11;
|
|
94
97
|
var _this$asProps = this.asProps, styles = _this$asProps.styles, noWrap = _this$asProps.noWrap, color = _this$asProps.color, resolveColor = _this$asProps.resolveColor, disabled = _this$asProps.disabled, href = _this$asProps.href, hasChildren = _this$asProps.children, AddonLeft = _this$asProps.addonLeft, AddonRight = _this$asProps.addonRight, Children = _this$asProps.Children, title = _this$asProps.title, ariaLabel = _this$asProps["aria-label"], hintPlacement = _this$asProps.hintPlacement;
|
|
95
98
|
var Link2 = this[CORE_INSTANCE];
|
|
96
99
|
var children = (_ref7 = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, AddonLeft ? /* @__PURE__ */ React.createElement(Link2.Addon, null, /* @__PURE__ */ React.createElement(AddonLeft, _ref7.cn("AddonLeft", {}))) : null, addonTextChildren(Children, Link2.Text, Link2.Addon), AddonRight ? /* @__PURE__ */ React.createElement(Link2.Addon, null, /* @__PURE__ */ React.createElement(AddonRight, _ref7.cn("AddonRight", {}))) : null));
|
|
97
|
-
var hintContent = (
|
|
100
|
+
var hintContent = (_ref10 = (_ref11 = title !== null && title !== void 0 ? title : ariaLabel) !== null && _ref11 !== void 0 ? _ref11 : this.state.ariaLabelledByContent) !== null && _ref10 !== void 0 ? _ref10 : "";
|
|
98
101
|
var linkProps = {
|
|
99
|
-
role: "link",
|
|
100
|
-
tabIndex: disabled ? -1 : 0,
|
|
102
|
+
"role": "link",
|
|
103
|
+
"tabIndex": disabled ? -1 : 0,
|
|
101
104
|
"use:href": disabled ? void 0 : href,
|
|
102
105
|
"visually-disabled": disabled,
|
|
103
|
-
render: Text,
|
|
106
|
+
"render": Text,
|
|
104
107
|
"text-color": resolveColor(color),
|
|
105
|
-
tag: "a",
|
|
106
|
-
noWrapText: noWrap,
|
|
108
|
+
"tag": "a",
|
|
109
|
+
"noWrapText": noWrap,
|
|
107
110
|
"use:noWrap": false,
|
|
108
|
-
ref: this.containerRef,
|
|
109
|
-
__excludeProps: ["disabled", "aria-disabled"]
|
|
111
|
+
"ref": this.containerRef,
|
|
112
|
+
"__excludeProps": ["disabled", "aria-disabled"]
|
|
110
113
|
};
|
|
111
114
|
var hintProps = {
|
|
112
115
|
title: hintContent,
|
|
@@ -127,7 +130,6 @@ var RootLink = /* @__PURE__ */ function(_Component) {
|
|
|
127
130
|
});
|
|
128
131
|
}
|
|
129
132
|
}]);
|
|
130
|
-
return RootLink2;
|
|
131
133
|
}(Component);
|
|
132
134
|
_defineProperty(RootLink, "displayName", "Link");
|
|
133
135
|
_defineProperty(RootLink, "defaultProps", {
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { TextProps } from '@semcore/typography';
|
|
4
|
-
import
|
|
1
|
+
import type { Intergalactic, UnknownProperties } from '@semcore/core';
|
|
2
|
+
import type { BoxProps } from '@semcore/flex-box';
|
|
3
|
+
import type { TextProps } from '@semcore/typography';
|
|
4
|
+
import type React from 'react';
|
|
5
5
|
|
|
6
6
|
/** @deprecated */
|
|
7
7
|
export interface ILinkProps extends LinkProps, UnknownProperties {}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/link",
|
|
3
3
|
"description": "Semrush Link Component",
|
|
4
|
-
"version": "16.0.
|
|
4
|
+
"version": "16.0.2-prerelease.3",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/
|
|
18
|
-
"@semcore/tooltip": "16.0.
|
|
19
|
-
"@semcore/
|
|
17
|
+
"@semcore/flex-box": "16.0.2-prerelease.3",
|
|
18
|
+
"@semcore/tooltip": "16.0.2-prerelease.3",
|
|
19
|
+
"@semcore/typography": "16.1.2-prerelease.3"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@semcore/base-components": "^16.0.
|
|
22
|
+
"@semcore/base-components": "^16.0.2-prerelease.3"
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"directory": "semcore/link"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@
|
|
30
|
+
"@semcore/core": "16.0.0",
|
|
31
31
|
"@semcore/testing-utils": "1.0.0",
|
|
32
|
-
"@semcore/icon": "
|
|
32
|
+
"@semcore/icon": "16.2.1-prerelease.3"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "pnpm semcore-builder --source=js && pnpm vite build"
|