@semcore/link 16.0.11-prerelease.5 → 17.0.0-prerelease.17
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 +7 -1
- package/README.md +4 -4
- package/lib/cjs/Link.js +103 -147
- package/lib/cjs/Link.js.map +1 -1
- package/lib/cjs/Link.types.js +2 -0
- package/lib/cjs/Link.types.js.map +1 -0
- package/lib/cjs/index.js +3 -3
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/link.shadow.css +15 -13
- package/lib/es6/Link.js +98 -143
- package/lib/es6/Link.js.map +1 -1
- package/lib/es6/Link.types.js +2 -0
- package/lib/es6/Link.types.js.map +1 -0
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/style/link.shadow.css +15 -13
- package/lib/esm/Link.mjs +91 -117
- package/lib/esm/style/link.shadow.css +15 -13
- package/lib/types/Link.d.ts +25 -0
- package/lib/types/Link.types.d.ts +36 -0
- package/lib/types/index.d.ts +3 -40
- package/package.json +8 -8
- package/lib/cjs/index.d.js +0 -2
- package/lib/cjs/index.d.js.map +0 -1
- package/lib/es6/index.d.js +0 -2
- package/lib/es6/index.d.js.map +0 -1
package/lib/es6/Link.js
CHANGED
|
@@ -1,175 +1,130 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _callSuper from "@babel/runtime/helpers/callSuper";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
2
|
import { sstyled as _sstyled } from "@semcore/core";
|
|
8
|
-
import { assignProps as _assignProps4 } from "@semcore/core";
|
|
9
3
|
import { assignProps as _assignProps3 } from "@semcore/core";
|
|
10
4
|
import { assignProps as _assignProps2 } from "@semcore/core";
|
|
11
5
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
6
|
+
import { Box, Hint } from '@semcore/base-components';
|
|
12
7
|
import { createComponent, Component, Root, sstyled, CORE_INSTANCE } from '@semcore/core';
|
|
13
8
|
import addonTextChildren from '@semcore/core/lib/utils/addonTextChildren';
|
|
14
|
-
import keyboardFocusEnhance from '@semcore/core/lib/utils/enhances/keyboardFocusEnhance';
|
|
15
9
|
import resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';
|
|
16
10
|
import hasLabels from '@semcore/core/lib/utils/hasLabels';
|
|
17
11
|
import logger from '@semcore/core/lib/utils/logger';
|
|
18
|
-
import { Box } from '@semcore/flex-box';
|
|
19
|
-
import { Hint } from '@semcore/tooltip';
|
|
20
12
|
import { Text } from '@semcore/typography';
|
|
21
13
|
import React from 'react';
|
|
22
14
|
/*!__reshadow-styles__:"./style/link.shadow.css"*/
|
|
23
|
-
|
|
15
|
+
const style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SLink_1dx8e_gg_{display:inline;align-items:center;color:var(--intergalactic-text-link, #006dca);position:relative;cursor:pointer;-webkit-tap-highlight-color:transparent;background:0 0;transition:color .15s ease-in-out}.___SLink_1dx8e_gg_,.___SLink_1dx8e_gg_:active{-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SLink_1dx8e_gg_:hover{-webkit-text-decoration:none;text-decoration:none}}.___SLink_1dx8e_gg_::-moz-focus-inner{border:0;padding:0}.___SLink_1dx8e_gg_.__active_1dx8e_gg_,.___SLink_1dx8e_gg_:active{color:var(--intergalactic-text-link-hover-active, #044792)}@media (hover:hover){.___SLink_1dx8e_gg_:hover{color:var(--intergalactic-text-link-hover-active, #044792)}}.___SLink_1dx8e_gg_.__active_1dx8e_gg_ .___SText_1dx8e_gg_,.___SLink_1dx8e_gg_:active .___SText_1dx8e_gg_{border-color:currentColor}@media (hover:hover){.___SLink_1dx8e_gg_:hover .___SText_1dx8e_gg_{border-color:currentColor}}.___SLink_1dx8e_gg_.__enableVisited_1dx8e_gg_:visited{color:var(--intergalactic-text-link-visited, #8649e1)}@media (hover:hover){.___SLink_1dx8e_gg_.__enableVisited_1dx8e_gg_:visited:hover{color:var(--intergalactic-text-link-visited, #8649e1)}}.___SLink_1dx8e_gg_.__visually-disabled_1dx8e_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SLink_1dx8e_gg_.__noWrap_1dx8e_gg_{white-space:nowrap}.___SLink_1dx8e_gg_.__inline_1dx8e_gg_{display:inline}.___SInner_1dx8e_gg_{align-items:baseline;height:100%;width:100%}.___SAddon_1dx8e_gg_{align-items:baseline;vertical-align:-2px;pointer-events:none;align-self:center}.___SLink_1dx8e_gg_ .___SAddon_1dx8e_gg_:not(:only-child):first-child{margin-right:var(--intergalactic-spacing-1x, 4px)}.___SLink_1dx8e_gg_ .___SAddon_1dx8e_gg_:not(:only-child):last-child{margin-left:var(--intergalactic-spacing-1x, 4px)}.___SText_1dx8e_gg_{border-bottom-width:1px;border-bottom-style:solid;border-color:transparent;transition:border-bottom-color .15s ease-in-out}.___SText_1dx8e_gg_.__ellipsis_1dx8e_gg_{vertical-align:middle}.___SLink_1dx8e_gg_.__text-color_1dx8e_gg_{color:var(--text-color_1dx8e)}.___SLink_1dx8e_gg_.__text-color_1dx8e_gg_.__active_1dx8e_gg_,.___SLink_1dx8e_gg_.__text-color_1dx8e_gg_:active{color:var(--text-color_1dx8e);filter:brightness(.8)}@media (hover:hover){.___SLink_1dx8e_gg_.__text-color_1dx8e_gg_:hover{color:var(--text-color_1dx8e);filter:brightness(.8)}}@media (prefers-reduced-motion){.___SLink_1dx8e_gg_,.___SText_1dx8e_gg_{transition:none}}", /*__inner_css_end__*/"1dx8e_gg_"),
|
|
24
16
|
/*__reshadow_css_end__*/
|
|
25
17
|
{
|
|
26
|
-
"__SLink": "
|
|
27
|
-
"_visually-disabled": "__visually-
|
|
28
|
-
"
|
|
29
|
-
"_inline": "
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
18
|
+
"__SLink": "___SLink_1dx8e_gg_",
|
|
19
|
+
"_visually-disabled": "__visually-disabled_1dx8e_gg_",
|
|
20
|
+
"_noWrap": "__noWrap_1dx8e_gg_",
|
|
21
|
+
"_inline": "__inline_1dx8e_gg_",
|
|
22
|
+
"__SInner": "___SInner_1dx8e_gg_",
|
|
23
|
+
"__SAddon": "___SAddon_1dx8e_gg_",
|
|
24
|
+
"__SText": "___SText_1dx8e_gg_",
|
|
25
|
+
"_ellipsis": "__ellipsis_1dx8e_gg_",
|
|
26
|
+
"_active": "__active_1dx8e_gg_",
|
|
27
|
+
"_enableVisited": "__enableVisited_1dx8e_gg_",
|
|
28
|
+
"_text-color": "__text-color_1dx8e_gg_",
|
|
29
|
+
"--text-color": "--text-color_1dx8e"
|
|
36
30
|
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
args[_key] = arguments[_key];
|
|
43
|
-
}
|
|
44
|
-
_this = _callSuper(this, RootLink, [].concat(args));
|
|
45
|
-
_defineProperty(_this, "containerRef", /*#__PURE__*/React.createRef());
|
|
46
|
-
_defineProperty(_this, "state", {
|
|
31
|
+
class RootLink extends Component {
|
|
32
|
+
constructor(...args) {
|
|
33
|
+
super(...args);
|
|
34
|
+
_defineProperty(this, "containerRef", /*#__PURE__*/React.createRef());
|
|
35
|
+
_defineProperty(this, "state", {
|
|
47
36
|
ariaLabelledByContent: ''
|
|
48
37
|
});
|
|
49
|
-
return _this;
|
|
50
38
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
value: function componentDidMount() {
|
|
55
|
-
var _this2 = this;
|
|
56
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
57
|
-
logger.warn(this.containerRef.current && !hasLabels(this.containerRef.current), "'title' or 'aria-label' or 'aria-labelledby' are required props for links without text content", this.asProps['data-ui-name'] || RootLink.displayName);
|
|
58
|
-
}
|
|
59
|
-
if (this.asProps['aria-labelledby']) {
|
|
60
|
-
setTimeout(function () {
|
|
61
|
-
var _document$getElementB, _document$getElementB2;
|
|
62
|
-
_this2.setState({
|
|
63
|
-
ariaLabelledByContent: (_document$getElementB = (_document$getElementB2 = document.getElementById(_this2.asProps['aria-labelledby'])) === null || _document$getElementB2 === void 0 ? void 0 : _document$getElementB2.textContent) !== null && _document$getElementB !== void 0 ? _document$getElementB : ''
|
|
64
|
-
});
|
|
65
|
-
}, 0);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}, {
|
|
69
|
-
key: "renderLink",
|
|
70
|
-
value: function renderLink(_ref0) {
|
|
71
|
-
var _ref = this.asProps,
|
|
72
|
-
_ref5;
|
|
73
|
-
var linkProps = _ref0.linkProps,
|
|
74
|
-
children = _ref0.children;
|
|
75
|
-
var styles = this.asProps.styles;
|
|
76
|
-
var SLink = Text;
|
|
77
|
-
return _ref5 = sstyled(styles), /*#__PURE__*/React.createElement(SLink, _ref5.cn("SLink", _objectSpread({}, _assignProps(_objectSpread({}, linkProps), _ref))), children);
|
|
78
|
-
}
|
|
79
|
-
}, {
|
|
80
|
-
key: "renderLinkWithHint",
|
|
81
|
-
value: function renderLinkWithHint(_ref1) {
|
|
82
|
-
var _ref2 = this.asProps,
|
|
83
|
-
_ref6;
|
|
84
|
-
var linkProps = _ref1.linkProps,
|
|
85
|
-
children = _ref1.children,
|
|
86
|
-
hintProps = _ref1.hintProps;
|
|
87
|
-
var styles = this.asProps.styles;
|
|
88
|
-
var SLink = Hint;
|
|
89
|
-
return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(SLink, _ref6.cn("SLink", _objectSpread({}, _assignProps2(_objectSpread(_objectSpread({}, linkProps), hintProps), _ref2))), children);
|
|
39
|
+
componentDidMount() {
|
|
40
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
41
|
+
logger.warn(this.containerRef.current && !hasLabels(this.containerRef.current), `'title' or 'aria-label' or 'aria-labelledby' are required props for links without text content`, this.asProps['data-ui-name'] || RootLink.displayName);
|
|
90
42
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
var _this$asProps = this.asProps,
|
|
96
|
-
styles = _this$asProps.styles,
|
|
97
|
-
noWrap = _this$asProps.noWrap,
|
|
98
|
-
color = _this$asProps.color,
|
|
99
|
-
resolveColor = _this$asProps.resolveColor,
|
|
100
|
-
disabled = _this$asProps.disabled,
|
|
101
|
-
href = _this$asProps.href,
|
|
102
|
-
hasChildren = _this$asProps.children,
|
|
103
|
-
AddonLeft = _this$asProps.addonLeft,
|
|
104
|
-
AddonRight = _this$asProps.addonRight,
|
|
105
|
-
Children = _this$asProps.Children,
|
|
106
|
-
title = _this$asProps.title,
|
|
107
|
-
ariaLabel = _this$asProps['aria-label'],
|
|
108
|
-
hintPlacement = _this$asProps.hintPlacement;
|
|
109
|
-
// @ts-ignore
|
|
110
|
-
var Link = this[CORE_INSTANCE];
|
|
111
|
-
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));
|
|
112
|
-
var hintContent = (_ref10 = (_ref11 = title !== null && title !== void 0 ? title : ariaLabel) !== null && _ref11 !== void 0 ? _ref11 : this.state.ariaLabelledByContent) !== null && _ref10 !== void 0 ? _ref10 : '';
|
|
113
|
-
var linkProps = {
|
|
114
|
-
'role': 'link',
|
|
115
|
-
'tabIndex': disabled ? -1 : 0,
|
|
116
|
-
'use:href': disabled ? undefined : href,
|
|
117
|
-
'visually-disabled': disabled,
|
|
118
|
-
'render': Text,
|
|
119
|
-
'text-color': resolveColor(color),
|
|
120
|
-
'tag': 'a',
|
|
121
|
-
'noWrapText': noWrap,
|
|
122
|
-
'use:noWrap': false,
|
|
123
|
-
'ref': this.containerRef,
|
|
124
|
-
'__excludeProps': ['disabled', 'aria-disabled']
|
|
125
|
-
};
|
|
126
|
-
var hintProps = {
|
|
127
|
-
title: hintContent,
|
|
128
|
-
timeout: [250, 50],
|
|
129
|
-
placement: hintPlacement,
|
|
130
|
-
__excludeProps: []
|
|
131
|
-
};
|
|
132
|
-
if (hasChildren === undefined || title) {
|
|
133
|
-
return this.renderLinkWithHint({
|
|
134
|
-
linkProps: linkProps,
|
|
135
|
-
hintProps: hintProps,
|
|
136
|
-
children: children
|
|
43
|
+
if (this.asProps['aria-labelledby']) {
|
|
44
|
+
setTimeout(() => {
|
|
45
|
+
this.setState({
|
|
46
|
+
ariaLabelledByContent: document.getElementById(this.asProps['aria-labelledby'])?.textContent ?? ''
|
|
137
47
|
});
|
|
138
|
-
}
|
|
139
|
-
return this.renderLink({
|
|
140
|
-
linkProps: linkProps,
|
|
141
|
-
children: children
|
|
142
|
-
});
|
|
48
|
+
}, 0);
|
|
143
49
|
}
|
|
144
|
-
}
|
|
145
|
-
|
|
50
|
+
}
|
|
51
|
+
render() {
|
|
52
|
+
var _ref = this.asProps,
|
|
53
|
+
_ref4;
|
|
54
|
+
const {
|
|
55
|
+
styles,
|
|
56
|
+
color,
|
|
57
|
+
resolveColor,
|
|
58
|
+
disabled,
|
|
59
|
+
href,
|
|
60
|
+
children,
|
|
61
|
+
addonLeft: AddonLeft,
|
|
62
|
+
addonRight: AddonRight,
|
|
63
|
+
Children,
|
|
64
|
+
title,
|
|
65
|
+
'aria-label': ariaLabel,
|
|
66
|
+
hintPlacement
|
|
67
|
+
} = this.asProps;
|
|
68
|
+
// @ts-ignore
|
|
69
|
+
const Link = this[CORE_INSTANCE];
|
|
70
|
+
const SLink = Text;
|
|
71
|
+
const SInner = Box;
|
|
72
|
+
const hintContent = title ?? ariaLabel ?? this.state.ariaLabelledByContent ?? '';
|
|
73
|
+
const showHint = children === undefined || title;
|
|
74
|
+
return _ref4 = sstyled(styles), /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SLink, _ref4.cn("SLink", {
|
|
75
|
+
..._assignProps({
|
|
76
|
+
"role": 'link',
|
|
77
|
+
"tabIndex": disabled ? -1 : 0,
|
|
78
|
+
"use:href": disabled ? undefined : href,
|
|
79
|
+
"visually-disabled": disabled,
|
|
80
|
+
"text-color": resolveColor(color),
|
|
81
|
+
"tag": 'a',
|
|
82
|
+
"ref": this.containerRef,
|
|
83
|
+
"__excludeProps": ['disabled', 'aria-disabled'],
|
|
84
|
+
"aria-label": showHint ? hintContent : undefined
|
|
85
|
+
}, _ref)
|
|
86
|
+
}), /*#__PURE__*/React.createElement(SInner, _ref4.cn("SInner", {
|
|
87
|
+
"tag": 'span',
|
|
88
|
+
"data-ui-name": `${this.asProps['data-ui-name']}.InnerWrapper`
|
|
89
|
+
}), AddonLeft ? /*#__PURE__*/React.createElement(Link.Addon, null, /*#__PURE__*/React.createElement(AddonLeft, _ref4.cn("AddonLeft", {}))) : null, addonTextChildren(Children, Link.Text, Link.Addon), AddonRight ? /*#__PURE__*/React.createElement(Link.Addon, null, /*#__PURE__*/React.createElement(AddonRight, _ref4.cn("AddonRight", {}))) : null)), showHint && /*#__PURE__*/React.createElement(Hint, _ref4.cn("Hint", {
|
|
90
|
+
"triggerRef": this.containerRef,
|
|
91
|
+
"timeout": [250, 50],
|
|
92
|
+
"placement": hintPlacement
|
|
93
|
+
}), hintContent));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
146
96
|
_defineProperty(RootLink, "displayName", 'Link');
|
|
147
|
-
_defineProperty(RootLink, "defaultProps", {
|
|
148
|
-
noWrap: true
|
|
149
|
-
});
|
|
150
97
|
_defineProperty(RootLink, "style", style);
|
|
151
|
-
_defineProperty(RootLink, "enhance", [
|
|
98
|
+
_defineProperty(RootLink, "enhance", [resolveColorEnhance()]);
|
|
152
99
|
function LinkText(props) {
|
|
153
|
-
var
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
100
|
+
var _ref2 = arguments[0],
|
|
101
|
+
_ref5;
|
|
102
|
+
const SText = Text;
|
|
103
|
+
const {
|
|
104
|
+
styles
|
|
105
|
+
} = props;
|
|
106
|
+
return _ref5 = sstyled(styles), /*#__PURE__*/React.createElement(SText, _ref5.cn("SText", {
|
|
107
|
+
..._assignProps2({
|
|
108
|
+
"tag": 'span'
|
|
109
|
+
}, _ref2)
|
|
110
|
+
}));
|
|
160
111
|
}
|
|
161
112
|
function Addon(props) {
|
|
162
|
-
var
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
113
|
+
var _ref3 = arguments[0],
|
|
114
|
+
_ref6;
|
|
115
|
+
const SAddon = Box;
|
|
116
|
+
const {
|
|
117
|
+
styles
|
|
118
|
+
} = props;
|
|
119
|
+
return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(SAddon, _ref6.cn("SAddon", {
|
|
120
|
+
..._assignProps3({
|
|
121
|
+
"tag": 'span'
|
|
122
|
+
}, _ref3)
|
|
123
|
+
}));
|
|
169
124
|
}
|
|
170
|
-
|
|
125
|
+
const Link = createComponent(RootLink, {
|
|
171
126
|
Text: LinkText,
|
|
172
|
-
Addon
|
|
127
|
+
Addon
|
|
173
128
|
});
|
|
174
129
|
export default Link;
|
|
175
130
|
//# sourceMappingURL=Link.js.map
|
package/lib/es6/Link.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,aAAa,QAAQ,eAAe;AACxF,OAAOC,iBAAiB,MAAM,2CAA2C;AACzE,OAAOC,oBAAoB,MAAM,uDAAuD;AACxF,OAAOC,mBAAmB,MAAM,sDAAsD;AACtF,OAAOC,SAAS,MAAM,mCAAmC;AACzD,OAAOC,MAAM,MAAM,gCAAgC;AACnD,SAASC,GAAG,QAAQ,mBAAmB;AACvC,SAASC,IAAI,QAAQ,kBAAkB;AACvC,SAASC,IAAI,QAAQ,qBAAqB;AAC1C,OAAOC,KAAK,MAAM,OAAO;AAAC;AAAA,IAAAC,KAAA,8BAAAC,QAAA,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;IAAAC,eAAA,OAAAH,QAAA;IAAA,SAAAI,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;IAAA;IAAAP,KAAA,GAAAQ,UAAA,OAAAV,QAAA,KAAAW,MAAA,CAAAJ,IAAA;IAAAK,eAAA,CAAAV,KAAA,+BAQGN,KAAK,CAACiB,SAAS,CAAC,CAAC;IAAAD,eAAA,CAAAV,KAAA,WAExB;MACNY,qBAAqB,EAAE;IACzB,CAAC;IAAA,OAAAZ,KAAA;EAAA;EAAAa,SAAA,CAAAf,QAAA,EAAAC,UA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AAEA,SAAST,KAAKA,CAACQ,KAAK,EAAE;EAAA,IAAAM,KAAA,GAAAJ,YAAA;IAAAK,KAAA;EACpB,IAAMC,MAAM,GAE2BlG,GAAG;EAD1C,IAAQiD,MAAM,GAAKyC,KAAK,CAAhBzC,MAAM;EACd,OAAAgD,KAAA,GAAOxG,OAAO,CAACwD,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":[]}
|
|
1
|
+
{"version":3,"file":"Link.js","names":["Box","Hint","createComponent","Component","Root","sstyled","CORE_INSTANCE","addonTextChildren","resolveColorEnhance","hasLabels","logger","Text","React","style","_sstyled","insert","RootLink","constructor","args","_defineProperty","createRef","ariaLabelledByContent","componentDidMount","process","env","NODE_ENV","warn","containerRef","current","asProps","displayName","setTimeout","setState","document","getElementById","textContent","render","_ref","_ref4","styles","color","resolveColor","disabled","href","children","addonLeft","AddonLeft","addonRight","AddonRight","Children","title","ariaLabel","hintPlacement","Link","SLink","SInner","hintContent","state","showHint","undefined","createElement","Fragment","cn","_assignProps","Addon","LinkText","props","_ref2","arguments[0]","_ref5","SText","_assignProps2","_ref3","_ref6","SAddon","_assignProps3"],"sources":["../../src/Link.tsx"],"sourcesContent":["import type { BoxProps } from '@semcore/base-components';\nimport { Flex, Box, Hint } from '@semcore/base-components';\nimport type { Intergalactic, IRootComponentProps } from '@semcore/core';\nimport { createComponent, Component, Root, sstyled, CORE_INSTANCE } from '@semcore/core';\nimport addonTextChildren from '@semcore/core/lib/utils/addonTextChildren';\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 type { TextProps } from '@semcore/typography';\nimport { Text } from '@semcore/typography';\nimport React from 'react';\n\nimport type { LinkProps } from './Link.types';\nimport style from './style/link.shadow.css';\n\ntype State = {\n ariaLabelledByContent: string;\n};\n\nclass RootLink extends Component<LinkProps, typeof RootLink.enhance, never, {}, State> {\n static displayName = 'Link';\n\n static style = style;\n static enhance = [resolveColorEnhance()] as const;\n containerRef = React.createRef<HTMLElement | null>();\n\n state: 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 render() {\n const {\n styles,\n color,\n resolveColor,\n disabled,\n href,\n children,\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 const SLink = Root;\n const SInner = Box;\n const hintContent = title ?? ariaLabel ?? this.state.ariaLabelledByContent ?? '';\n const showHint = children === undefined || title;\n return sstyled(styles)(\n <>\n <SLink\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 ref={this.containerRef}\n __excludeProps={['disabled', 'aria-disabled']}\n aria-label={showHint ? hintContent : undefined}\n >\n <SInner\n tag='span'\n data-ui-name={`${this.asProps['data-ui-name']}.InnerWrapper`}\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 </SInner>\n </SLink>\n {showHint && (\n <Hint\n triggerRef={this.containerRef}\n timeout={[250, 50]}\n placement={hintPlacement}\n >\n {hintContent}\n </Hint>\n )}\n </>,\n );\n }\n}\n\nfunction LinkText(props: IRootComponentProps) {\n const SText = Root;\n const { styles } = props;\n return sstyled(styles)(<SText render={Text} tag='span' />);\n}\n\nfunction Addon(props: IRootComponentProps) {\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}) as Intergalactic.Component<'a', LinkProps, {}, typeof RootLink.enhance> & {\n Text: Intergalactic.Component<'span', TextProps>;\n Addon: Intergalactic.Component<'span', BoxProps>;\n};\n\nexport default Link;\n"],"mappings":";;;;;AACA,SAAeA,GAAG,EAAEC,IAAI,QAAQ,0BAA0B;AAE1D,SAASC,eAAe,EAAEC,SAAS,EAAEC,IAAI,EAAEC,OAAO,EAAEC,aAAa,QAAQ,eAAe;AACxF,OAAOC,iBAAiB,MAAM,2CAA2C;AACzE,OAAOC,mBAAmB,MAAM,sDAAsD;AACtF,OAAOC,SAAS,MAAM,mCAAmC;AACzD,OAAOC,MAAM,MAAM,gCAAgC;AAEnD,SAASC,IAAI,QAAQ,qBAAqB;AAC1C,OAAOC,KAAK,MAAM,OAAO;AAAC;AAAA,MAAAC,KAAA,8BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAS1B,MAAMC,QAAQ,SAASb,SAAS,CAAuD;EAAAc,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,oCAKtEP,KAAK,CAACQ,SAAS,CAAqB,CAAC;IAAAD,eA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PopperProps } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport type { TextProps } from '@semcore/typography';\nimport type React from 'react';\n\nexport type LinkProps = Intergalactic.InternalTypings.EfficientOmit<TextProps, 'ellipsis' | 'hintProps'> & {\n /**\n * CSS property of the display link (inline|inline-block)\n * @default false\n * @deprecated. You should use default inline-flex for all cases.\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 false\n */\n noWrap?: boolean;\n /** Left addon tag */\n addonLeft?: React.ElementType;\n /** Right addon tag */\n addonRight?: React.ElementType;\n /**\n * The position of the popper relative to the trigger that called it.\n * @default top\n */\n hintPlacement?: SimpleHintPopperProps['placement'];\n};\n"],"mappings":"","ignoreList":[]}
|
package/lib/es6/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default"],"sources":["../../src/index.
|
|
1
|
+
{"version":3,"file":"index.js","names":["default"],"sources":["../../src/index.ts"],"sourcesContent":["import type { LinkProps } from './Link.types';\n\nexport { default } from './Link';\nexport type { LinkProps };\n"],"mappings":"AAEA,SAASA,OAAO,QAAQ,QAAQ","ignoreList":[]}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
SLink {
|
|
2
|
-
display: inline
|
|
3
|
-
|
|
2
|
+
display: inline;
|
|
3
|
+
align-items: center;
|
|
4
4
|
color: var(--intergalactic-text-link, #006dca);
|
|
5
|
-
line-height: normal;
|
|
6
5
|
position: relative;
|
|
7
6
|
cursor: pointer;
|
|
8
7
|
text-decoration: none;
|
|
9
|
-
border: none;
|
|
10
|
-
padding: 0;
|
|
11
|
-
margin: 0;
|
|
12
|
-
box-shadow: none;
|
|
13
8
|
-webkit-tap-highlight-color: transparent;
|
|
14
9
|
background: none;
|
|
15
10
|
transition: color 0.15s ease-in-out;
|
|
@@ -47,7 +42,7 @@ SLink[visually-disabled] {
|
|
|
47
42
|
pointer-events: none;
|
|
48
43
|
}
|
|
49
44
|
|
|
50
|
-
SLink[
|
|
45
|
+
SLink[noWrap] {
|
|
51
46
|
white-space: nowrap;
|
|
52
47
|
}
|
|
53
48
|
|
|
@@ -55,13 +50,17 @@ SLink[inline] {
|
|
|
55
50
|
display: inline;
|
|
56
51
|
}
|
|
57
52
|
|
|
53
|
+
SInner {
|
|
54
|
+
align-items: baseline;
|
|
55
|
+
height: 100%;
|
|
56
|
+
width: 100%;
|
|
57
|
+
}
|
|
58
|
+
|
|
58
59
|
SAddon {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
align-items: center;
|
|
62
|
-
margin-bottom: var(--intergalactic-spacing-05x, 2px);
|
|
63
|
-
vertical-align: middle;
|
|
60
|
+
align-items: baseline;
|
|
61
|
+
vertical-align: -2px;
|
|
64
62
|
pointer-events: none;
|
|
63
|
+
align-self: center;
|
|
65
64
|
}
|
|
66
65
|
|
|
67
66
|
SLink SAddon {
|
|
@@ -80,6 +79,9 @@ SText {
|
|
|
80
79
|
border-color: transparent;
|
|
81
80
|
transition: border-bottom-color 0.15s ease-in-out;
|
|
82
81
|
}
|
|
82
|
+
SText[ellipsis] {
|
|
83
|
+
vertical-align: middle;
|
|
84
|
+
}
|
|
83
85
|
|
|
84
86
|
SLink[text-color] {
|
|
85
87
|
color: var(--text-color);
|