@semcore/link 16.1.0-prerelease.3 → 16.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/Link.js +57 -84
- 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.map +1 -1
- package/lib/cjs/style/link.shadow.css +20 -23
- package/lib/es6/Link.js +56 -84
- 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 +20 -23
- package/lib/esm/Link.mjs +48 -72
- package/lib/esm/style/link.shadow.css +20 -23
- package/lib/types/Link.d.ts +26 -0
- package/lib/types/Link.types.d.ts +35 -0
- package/lib/types/index.d.ts +3 -40
- package/package.json +7 -7
- 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/cjs/Link.js
CHANGED
|
@@ -12,29 +12,28 @@ var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/callSup
|
|
|
12
12
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
14
|
var _core = require("@semcore/core");
|
|
15
|
+
var _baseComponents = require("@semcore/base-components");
|
|
15
16
|
var _addonTextChildren = _interopRequireDefault(require("@semcore/core/lib/utils/addonTextChildren"));
|
|
16
|
-
var _keyboardFocusEnhance = _interopRequireDefault(require("@semcore/core/lib/utils/enhances/keyboardFocusEnhance"));
|
|
17
17
|
var _resolveColorEnhance = _interopRequireDefault(require("@semcore/core/lib/utils/enhances/resolveColorEnhance"));
|
|
18
18
|
var _hasLabels = _interopRequireDefault(require("@semcore/core/lib/utils/hasLabels"));
|
|
19
19
|
var _logger = _interopRequireDefault(require("@semcore/core/lib/utils/logger"));
|
|
20
|
-
var _flexBox = require("@semcore/flex-box");
|
|
21
|
-
var _tooltip = require("@semcore/tooltip");
|
|
22
20
|
var _typography = require("@semcore/typography");
|
|
23
21
|
var _react = _interopRequireDefault(require("react"));
|
|
24
22
|
/*!__reshadow-styles__:"./style/link.shadow.css"*/
|
|
25
|
-
var style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".
|
|
23
|
+
var style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".___SLink_qyote_gg_{display:inline;align-items:center;color:var(--intergalactic-text-link, rgb(35, 95, 226));position:relative;cursor:pointer;-webkit-text-decoration:none;text-decoration:none;-webkit-tap-highlight-color:transparent;background:0 0;transition:color .15s ease-in-out}.___SLink_qyote_gg_::-moz-focus-inner{border:0;padding:0}.___SLink_qyote_gg_.__active_qyote_gg_,.___SLink_qyote_gg_:active{color:var(--intergalactic-text-link-hover-active, rgb(33, 89, 215))}@media (hover:hover){.___SLink_qyote_gg_:hover{color:var(--intergalactic-text-link-hover-active, rgb(33, 89, 215))}}.___SLink_qyote_gg_.__active_qyote_gg_ .___SText_qyote_gg_,.___SLink_qyote_gg_:active .___SText_qyote_gg_{text-decoration-color:currentColor}@media (hover:hover){.___SLink_qyote_gg_:hover .___SText_qyote_gg_{text-decoration-color:currentColor}}.___SLink_qyote_gg_.__enableVisited_qyote_gg_:visited{color:var(--intergalactic-text-link-visited, rgb(128, 41, 236))}@media (hover:hover){.___SLink_qyote_gg_.__enableVisited_qyote_gg_:visited:hover{color:var(--intergalactic-text-link-visited, rgb(128, 41, 236))}}.___SLink_qyote_gg_.__visually-disabled_qyote_gg_{opacity:var(--intergalactic-disabled-opacity, 0.4);cursor:default;pointer-events:none}.___SLink_qyote_gg_.__noWrap_qyote_gg_{white-space:nowrap}.___SLink_qyote_gg_.__inline_qyote_gg_{display:inline}.___SInner_qyote_gg_{align-items:baseline;height:100%;width:100%}.___SAddon_qyote_gg_{pointer-events:none;vertical-align:middle;display:inline-flex;margin-top:-2.5px}.___SLink_qyote_gg_ .___SAddon_qyote_gg_:not(:only-child):first-child{margin-right:var(--intergalactic-spacing-1x, 4px)}.___SLink_qyote_gg_ .___SAddon_qyote_gg_:not(:only-child):last-child{margin-left:var(--intergalactic-spacing-1x, 4px)}.___SText_qyote_gg_{-webkit-text-decoration:underline;text-decoration:underline;text-decoration-style:solid;text-decoration-thickness:1px;text-decoration-color:transparent;text-underline-offset:17%;transition:text-decoration-color .15s ease-in-out}.___SLink_qyote_gg_.__text-color_qyote_gg_{color:var(--text-color_qyote)}.___SLink_qyote_gg_.__text-color_qyote_gg_.__active_qyote_gg_,.___SLink_qyote_gg_.__text-color_qyote_gg_:active{color:var(--text-color_qyote);filter:brightness(.8)}@media (hover:hover){.___SLink_qyote_gg_.__text-color_qyote_gg_:hover{color:var(--text-color_qyote);filter:brightness(.8)}}@media (prefers-reduced-motion){.___SLink_qyote_gg_,.___SText_qyote_gg_{transition:none}}", /*__inner_css_end__*/"qyote_gg_"),
|
|
26
24
|
/*__reshadow_css_end__*/
|
|
27
25
|
{
|
|
28
|
-
"__SLink": "
|
|
29
|
-
"_visually-disabled": "__visually-
|
|
30
|
-
"
|
|
31
|
-
"_inline": "
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
26
|
+
"__SLink": "___SLink_qyote_gg_",
|
|
27
|
+
"_visually-disabled": "__visually-disabled_qyote_gg_",
|
|
28
|
+
"_noWrap": "__noWrap_qyote_gg_",
|
|
29
|
+
"_inline": "__inline_qyote_gg_",
|
|
30
|
+
"__SInner": "___SInner_qyote_gg_",
|
|
31
|
+
"__SAddon": "___SAddon_qyote_gg_",
|
|
32
|
+
"__SText": "___SText_qyote_gg_",
|
|
33
|
+
"_active": "__active_qyote_gg_",
|
|
34
|
+
"_enableVisited": "__enableVisited_qyote_gg_",
|
|
35
|
+
"_text-color": "__text-color_qyote_gg_",
|
|
36
|
+
"--text-color": "--text-color_qyote"
|
|
38
37
|
});
|
|
39
38
|
var RootLink = /*#__PURE__*/function (_Component) {
|
|
40
39
|
function RootLink() {
|
|
@@ -68,40 +67,26 @@ var RootLink = /*#__PURE__*/function (_Component) {
|
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
69
|
}, {
|
|
71
|
-
key: "
|
|
72
|
-
value: function
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
children = _ref0.children;
|
|
77
|
-
var styles = this.asProps.styles;
|
|
78
|
-
var SLink = _typography.Text;
|
|
79
|
-
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);
|
|
80
|
-
}
|
|
81
|
-
}, {
|
|
82
|
-
key: "renderLinkWithHint",
|
|
83
|
-
value: function renderLinkWithHint(_ref1) {
|
|
84
|
-
var _ref2 = this.asProps,
|
|
85
|
-
_ref6;
|
|
86
|
-
var linkProps = _ref1.linkProps,
|
|
87
|
-
children = _ref1.children,
|
|
88
|
-
hintProps = _ref1.hintProps;
|
|
89
|
-
var styles = this.asProps.styles;
|
|
90
|
-
var SLink = _tooltip.Hint;
|
|
91
|
-
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);
|
|
70
|
+
key: "getTextProps",
|
|
71
|
+
value: function getTextProps() {
|
|
72
|
+
return {
|
|
73
|
+
'hint:triggerRef': this.containerRef
|
|
74
|
+
};
|
|
92
75
|
}
|
|
93
76
|
}, {
|
|
94
77
|
key: "render",
|
|
95
78
|
value: function render() {
|
|
96
|
-
var
|
|
79
|
+
var _ref = this.asProps,
|
|
80
|
+
_ref4,
|
|
81
|
+
_ref7,
|
|
82
|
+
_ref8;
|
|
97
83
|
var _this$asProps = this.asProps,
|
|
98
84
|
styles = _this$asProps.styles,
|
|
99
|
-
noWrap = _this$asProps.noWrap,
|
|
100
85
|
color = _this$asProps.color,
|
|
101
86
|
resolveColor = _this$asProps.resolveColor,
|
|
102
87
|
disabled = _this$asProps.disabled,
|
|
103
88
|
href = _this$asProps.href,
|
|
104
|
-
|
|
89
|
+
children = _this$asProps.children,
|
|
105
90
|
AddonLeft = _this$asProps.addonLeft,
|
|
106
91
|
AddonRight = _this$asProps.addonRight,
|
|
107
92
|
Children = _this$asProps.Children,
|
|
@@ -110,64 +95,52 @@ var RootLink = /*#__PURE__*/function (_Component) {
|
|
|
110
95
|
hintPlacement = _this$asProps.hintPlacement;
|
|
111
96
|
// @ts-ignore
|
|
112
97
|
var Link = this[_core.CORE_INSTANCE];
|
|
113
|
-
var
|
|
114
|
-
var
|
|
115
|
-
var
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
'
|
|
120
|
-
'render': _typography.Text,
|
|
121
|
-
'text-color': resolveColor(color),
|
|
122
|
-
'tag': 'a',
|
|
123
|
-
'noWrapText': noWrap,
|
|
124
|
-
'use:noWrap': false,
|
|
125
|
-
'ref': this.containerRef,
|
|
126
|
-
'__excludeProps': ['disabled', 'aria-disabled']
|
|
127
|
-
};
|
|
128
|
-
var hintProps = {
|
|
129
|
-
title: hintContent,
|
|
130
|
-
timeout: [250, 50],
|
|
131
|
-
placement: hintPlacement,
|
|
132
|
-
__excludeProps: []
|
|
133
|
-
};
|
|
134
|
-
if (hasChildren === undefined || title) {
|
|
135
|
-
return this.renderLinkWithHint({
|
|
136
|
-
linkProps: linkProps,
|
|
137
|
-
hintProps: hintProps,
|
|
138
|
-
children: children
|
|
139
|
-
});
|
|
98
|
+
var SLink = _typography.Text;
|
|
99
|
+
var SInner = _baseComponents.Box;
|
|
100
|
+
var hintContent = (_ref7 = (_ref8 = title !== null && title !== void 0 ? title : ariaLabel) !== null && _ref8 !== void 0 ? _ref8 : this.state.ariaLabelledByContent) !== null && _ref7 !== void 0 ? _ref7 : '';
|
|
101
|
+
var showHint = children === undefined || title;
|
|
102
|
+
var excludeProps = ['title', 'aria-disabled'];
|
|
103
|
+
if (!this.asProps['use:disabled']) {
|
|
104
|
+
excludeProps.push('disabled');
|
|
140
105
|
}
|
|
141
|
-
return
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
106
|
+
return _ref4 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(SLink, _ref4.cn("SLink", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
|
|
107
|
+
"tabIndex": disabled ? -1 : 0,
|
|
108
|
+
"use:href": disabled ? undefined : href,
|
|
109
|
+
"visually-disabled": disabled,
|
|
110
|
+
"text-color": resolveColor(color),
|
|
111
|
+
"tag": 'a',
|
|
112
|
+
"ref": this.containerRef,
|
|
113
|
+
"__excludeProps": excludeProps,
|
|
114
|
+
"aria-label": showHint ? hintContent : undefined
|
|
115
|
+
}, _ref))), /*#__PURE__*/_react["default"].createElement(SInner, _ref4.cn("SInner", {
|
|
116
|
+
"tag": 'span',
|
|
117
|
+
"data-ui-name": "".concat(this.asProps['data-ui-name'], ".InnerWrapper")
|
|
118
|
+
}), AddonLeft ? /*#__PURE__*/_react["default"].createElement(Link.Addon, null, /*#__PURE__*/_react["default"].createElement(AddonLeft, _ref4.cn("AddonLeft", {}))) : null, (0, _addonTextChildren["default"])(Children, Link.Text, Link.Addon), AddonRight ? /*#__PURE__*/_react["default"].createElement(Link.Addon, null, /*#__PURE__*/_react["default"].createElement(AddonRight, _ref4.cn("AddonRight", {}))) : null)), showHint && /*#__PURE__*/_react["default"].createElement(_baseComponents.Hint, _ref4.cn("Hint", {
|
|
119
|
+
"triggerRef": this.containerRef,
|
|
120
|
+
"timeout": [250, 50],
|
|
121
|
+
"placement": hintPlacement
|
|
122
|
+
}), hintContent));
|
|
145
123
|
}
|
|
146
124
|
}]);
|
|
147
125
|
}(_core.Component);
|
|
148
126
|
(0, _defineProperty2["default"])(RootLink, "displayName", 'Link');
|
|
149
|
-
(0, _defineProperty2["default"])(RootLink, "defaultProps", {
|
|
150
|
-
noWrap: true
|
|
151
|
-
});
|
|
152
127
|
(0, _defineProperty2["default"])(RootLink, "style", style);
|
|
153
|
-
(0, _defineProperty2["default"])(RootLink, "enhance", [(0,
|
|
128
|
+
(0, _defineProperty2["default"])(RootLink, "enhance", [(0, _resolveColorEnhance["default"])()]);
|
|
154
129
|
function LinkText(props) {
|
|
155
|
-
var
|
|
156
|
-
|
|
157
|
-
var SText =
|
|
130
|
+
var _ref2 = arguments[0],
|
|
131
|
+
_ref5;
|
|
132
|
+
var SText = _typography.Text;
|
|
158
133
|
var styles = props.styles;
|
|
159
|
-
return
|
|
160
|
-
"tag": 'span'
|
|
161
|
-
}, _ref3))));
|
|
134
|
+
return _ref5 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SText, _ref5.cn("SText", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({}, _ref2))));
|
|
162
135
|
}
|
|
163
136
|
function Addon(props) {
|
|
164
|
-
var
|
|
165
|
-
|
|
166
|
-
var SAddon =
|
|
137
|
+
var _ref3 = arguments[0],
|
|
138
|
+
_ref6;
|
|
139
|
+
var SAddon = _baseComponents.Box;
|
|
167
140
|
var styles = props.styles;
|
|
168
|
-
return
|
|
141
|
+
return _ref6 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SAddon, _ref6.cn("SAddon", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
|
|
169
142
|
"tag": 'span'
|
|
170
|
-
},
|
|
143
|
+
}, _ref3))));
|
|
171
144
|
}
|
|
172
145
|
var Link = (0, _core.createComponent)(RootLink, {
|
|
173
146
|
Text: LinkText,
|
package/lib/cjs/Link.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.js","names":["_core","require","_addonTextChildren","_interopRequireDefault","_keyboardFocusEnhance","_resolveColorEnhance","_hasLabels","_logger","_flexBox","_tooltip","_typography","_react","style","sstyled","insert","RootLink","_Component","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","_callSuper2","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;AAAA,IAAAW,KAAA,8BAAAZ,KAAA,CAAAa,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,IAAAC,gBAAA,mBAAAH,QAAA;IAAA,SAAAI,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAA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AAA,aANhBZ,QAAQ,aAOK,CAAC,IAAAyF,gCAAoB,EAAC,CAAC,EAAE,IAAAC,+BAAmB,EAAC,CAAC,CAAC;AAsHlE,SAASC,QAAQA,CAACC,KAAK,EAAE;EAAA,IAAAC,KAAA,GAAAC,YAAA;IAAAC,KAAA;EACvB,IAAMC,KAAK,GAE2BC,YAAG;EADzC,IAAQpD,MAAM,GAAK+C,KAAK,CAAhB/C,MAAM;EACd,OAAAkD,KAAA,GAAO,IAAAjG,aAAO,EAAC+C,MAAM,CAAC,eAACjD,MAAA,YAAAoD,aAAA,CAACgD,KAAK,EAAAD,KAAA,CAAA9C,EAAA,cAAAC,cAAA,qBAAAjE,KAAA,CAAAkE,WAAA;IAAA,OAAkB;EAAM,GAAA0C,KAAA,GAAE,CAAC;AAC1D;AAEA,SAASb,KAAKA,CAACY,KAAK,EAAE;EAAA,IAAAM,KAAA,GAAAJ,YAAA;IAAAK,KAAA;EACpB,IAAMC,MAAM,GAE2BH,YAAG;EAD1C,IAAQpD,MAAM,GAAK+C,KAAK,CAAhB/C,MAAM;EACd,OAAAsD,KAAA,GAAO,IAAArG,aAAO,EAAC+C,MAAM,CAAC,eAACjD,MAAA,YAAAoD,aAAA,CAACoD,MAAM,EAAAD,KAAA,CAAAlD,EAAA,eAAAC,cAAA,qBAAAjE,KAAA,CAAAkE,WAAA;IAAA,OAAkB;EAAM,GAAA+C,KAAA,GAAE,CAAC;AAC3D;AAEA,IAAMrB,IAAI,GAAG,IAAAwB,qBAAe,EAACrG,QAAQ,EAAE;EACrC+C,IAAI,EAAE4C,QAAQ;EACdX,KAAK,EAALA;AACF,CAAC,CAAC;AAAC,IAAAsB,QAAA,GAAAC,OAAA,cAEY1B,IAAI","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Link.js","names":["_core","require","_baseComponents","_addonTextChildren","_interopRequireDefault","_resolveColorEnhance","_hasLabels","_logger","_typography","_react","style","sstyled","insert","RootLink","_Component","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","_callSuper2","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","getTextProps","render","_ref","_ref4","_ref7","_ref8","_this$asProps","styles","color","resolveColor","disabled","href","children","AddonLeft","addonLeft","AddonRight","addonRight","Children","title","ariaLabel","hintPlacement","Link","CORE_INSTANCE","SLink","Text","SInner","Box","hintContent","state","showHint","undefined","excludeProps","push","createElement","Fragment","cn","_objectSpread2","assignProps","Addon","addonTextChildren","Hint","Component","resolveColorEnhance","LinkText","props","_ref2","arguments[0]","_ref5","SText","_ref3","_ref6","SAddon","createComponent","_default","exports"],"sources":["../../src/Link.tsx"],"sourcesContent":["import type { BoxProps } from '@semcore/base-components';\nimport { 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 { NSText } 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 getTextProps(): NSText.HintProps {\n return {\n 'hint:triggerRef': this.containerRef,\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\n const excludeProps = ['title', 'aria-disabled'];\n if (!this.asProps['use:disabled']) {\n excludeProps.push('disabled');\n }\n\n return sstyled(styles)(\n <>\n <SLink\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={excludeProps}\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} />);\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', NSText.Props>;\n Addon: Intergalactic.Component<'span', BoxProps>;\n};\n\nexport default Link;\n"],"mappings":";;;;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAFA,IAAAC,eAAA,GAAAD,OAAA;AAGA,IAAAE,kBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,oBAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,UAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,OAAA,GAAAH,sBAAA,CAAAH,OAAA;AAEA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAL,sBAAA,CAAAH,OAAA;AAA0B;AAAA,IAAAS,KAAA,8BAAAV,KAAA,CAAAW,OAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,IASpBC,QAAQ,0BAAAC,UAAA;EAAA,SAAAD,SAAA;IAAA,IAAAE,KAAA;IAAA,IAAAC,gBAAA,mBAAAH,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,OAAAQ,WAAA,mBAAAV,QAAA,KAAAW,MAAA,CAAAJ,IAAA;IAAA,IAAAK,gBAAA,aAAAV,KAAA,+BAKGW,iBAAK,CAACC,SAAS,CAAqB,CAAC;IAAA,IAAAF,gBAAA,aAAAV,KAAA,WAErC;MACba,qBAAqB,EAAE;IACzB,CAAC;IAA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AAAe,gBAAA,aAHhBZ,QAAQ,aAIK,CAAC,IAAAiF,+BAAmB,EAAC,CAAC,CAAC;AA2G1C,SAASC,QAAQA,CAACC,KAA0B,EAAE;EAAA,IAAAC,KAAA,GAAAC,YAAA;IAAAC,KAAA;EAC5C,IAAMC,KAAK,GAE2BxB,gBAAI;EAD1C,IAAQjB,MAAM,GAAKqC,KAAK,CAAhBrC,MAAM;EACd,OAAAwC,KAAA,GAAO,IAAAxF,aAAO,EAACgD,MAAM,CAAC,eAAClD,MAAA,YAAA4E,aAAA,CAACe,KAAK,EAAAD,KAAA,CAAAZ,EAAA,cAAAC,cAAA,qBAAAxF,KAAA,CAAAyF,WAAA,MAAAQ,KAAA,GAAgB,CAAC;AAChD;AAEA,SAASP,KAAKA,CAACM,KAA0B,EAAE;EAAA,IAAAK,KAAA,GAAAH,YAAA;IAAAI,KAAA;EACzC,IAAMC,MAAM,GAE2BzB,mBAAG;EAD1C,IAAQnB,MAAM,GAAKqC,KAAK,CAAhBrC,MAAM;EACd,OAAA2C,KAAA,GAAO,IAAA3F,aAAO,EAACgD,MAAM,CAAC,eAAClD,MAAA,YAAA4E,aAAA,CAACkB,MAAM,EAAAD,KAAA,CAAAf,EAAA,eAAAC,cAAA,qBAAAxF,KAAA,CAAAyF,WAAA;IAAA,OAAkB;EAAM,GAAAY,KAAA,GAAE,CAAC;AAC3D;AAEA,IAAM5B,IAAI,GAAG,IAAA+B,qBAAe,EAAC3F,QAAQ,EAAE;EACrC+D,IAAI,EAAEmB,QAAQ;EACdL,KAAK,EAALA;AACF,CAAC,CAGA;AAAC,IAAAe,QAAA,GAAAC,OAAA,cAEajC,IAAI","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Link.types.js","names":[],"sources":["../../src/Link.types.ts"],"sourcesContent":["import type { BoxProps, SimpleHintPopperProps } from '@semcore/base-components';\nimport type { NSText } from '@semcore/typography';\nimport type React from 'react';\n\nexport type LinkProps = BoxProps & NSText.BaseProps & {\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/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_Link","_interopRequireDefault","require"],"sources":["../../src/index.
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Link","_interopRequireDefault","require"],"sources":["../../src/index.ts"],"sourcesContent":["import type { LinkProps } from './Link.types';\n\nexport { default } from './Link';\nexport type { LinkProps };\n"],"mappings":";;;;;;;;;;;;AAEA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA","ignoreList":[]}
|
|
@@ -1,24 +1,14 @@
|
|
|
1
1
|
SLink {
|
|
2
|
-
display: inline
|
|
3
|
-
|
|
2
|
+
display: inline;
|
|
3
|
+
align-items: center;
|
|
4
4
|
color: var(--intergalactic-text-link, oklch(0.53 0.21 263));
|
|
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;
|
|
16
11
|
|
|
17
|
-
&:active,
|
|
18
|
-
&:hover {
|
|
19
|
-
text-decoration: none;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
12
|
&::-moz-focus-inner {
|
|
23
13
|
border: none;
|
|
24
14
|
padding: 0;
|
|
@@ -30,7 +20,7 @@ SLink {
|
|
|
30
20
|
color: var(--intergalactic-text-link-hover-active, oklch(0.51 0.202 263));
|
|
31
21
|
|
|
32
22
|
& SText {
|
|
33
|
-
|
|
23
|
+
text-decoration-color: currentColor;
|
|
34
24
|
}
|
|
35
25
|
}
|
|
36
26
|
|
|
@@ -47,7 +37,7 @@ SLink[visually-disabled] {
|
|
|
47
37
|
pointer-events: none;
|
|
48
38
|
}
|
|
49
39
|
|
|
50
|
-
SLink[
|
|
40
|
+
SLink[noWrap] {
|
|
51
41
|
white-space: nowrap;
|
|
52
42
|
}
|
|
53
43
|
|
|
@@ -55,13 +45,17 @@ SLink[inline] {
|
|
|
55
45
|
display: inline;
|
|
56
46
|
}
|
|
57
47
|
|
|
48
|
+
SInner {
|
|
49
|
+
align-items: baseline;
|
|
50
|
+
height: 100%;
|
|
51
|
+
width: 100%;
|
|
52
|
+
}
|
|
53
|
+
|
|
58
54
|
SAddon {
|
|
59
|
-
display: inline-flex;
|
|
60
|
-
justify-content: center;
|
|
61
|
-
align-items: center;
|
|
62
|
-
margin-bottom: var(--intergalactic-spacing-05x, 2px);
|
|
63
|
-
vertical-align: middle;
|
|
64
55
|
pointer-events: none;
|
|
56
|
+
vertical-align: middle;
|
|
57
|
+
display: inline-flex;
|
|
58
|
+
margin-top: -2.5px;
|
|
65
59
|
}
|
|
66
60
|
|
|
67
61
|
SLink SAddon {
|
|
@@ -75,10 +69,13 @@ SLink SAddon {
|
|
|
75
69
|
}
|
|
76
70
|
|
|
77
71
|
SText {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
72
|
+
text-decoration: underline;
|
|
73
|
+
text-decoration-style: solid;
|
|
74
|
+
text-decoration-thickness: 1px;
|
|
75
|
+
text-decoration-color: transparent;
|
|
76
|
+
text-underline-offset: 17%;
|
|
77
|
+
|
|
78
|
+
transition: text-decoration-color 0.15s ease-in-out;
|
|
82
79
|
}
|
|
83
80
|
|
|
84
81
|
SLink[text-color] {
|
package/lib/es6/Link.js
CHANGED
|
@@ -5,34 +5,32 @@ import _callSuper from "@babel/runtime/helpers/callSuper";
|
|
|
5
5
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
6
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
7
|
import { sstyled as _sstyled } from "@semcore/core";
|
|
8
|
-
import { assignProps as _assignProps4 } from "@semcore/core";
|
|
9
8
|
import { assignProps as _assignProps3 } from "@semcore/core";
|
|
10
9
|
import { assignProps as _assignProps2 } from "@semcore/core";
|
|
11
10
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
11
|
+
import { Box, Hint } from '@semcore/base-components';
|
|
12
12
|
import { createComponent, Component, Root, sstyled, CORE_INSTANCE } from '@semcore/core';
|
|
13
13
|
import addonTextChildren from '@semcore/core/lib/utils/addonTextChildren';
|
|
14
|
-
import keyboardFocusEnhance from '@semcore/core/lib/utils/enhances/keyboardFocusEnhance';
|
|
15
14
|
import resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';
|
|
16
15
|
import hasLabels from '@semcore/core/lib/utils/hasLabels';
|
|
17
16
|
import logger from '@semcore/core/lib/utils/logger';
|
|
18
|
-
import { Box } from '@semcore/flex-box';
|
|
19
|
-
import { Hint } from '@semcore/tooltip';
|
|
20
17
|
import { Text } from '@semcore/typography';
|
|
21
18
|
import React from 'react';
|
|
22
19
|
/*!__reshadow-styles__:"./style/link.shadow.css"*/
|
|
23
|
-
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".
|
|
20
|
+
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SLink_qyote_gg_{display:inline;align-items:center;color:var(--intergalactic-text-link, rgb(35, 95, 226));position:relative;cursor:pointer;-webkit-text-decoration:none;text-decoration:none;-webkit-tap-highlight-color:transparent;background:0 0;transition:color .15s ease-in-out}.___SLink_qyote_gg_::-moz-focus-inner{border:0;padding:0}.___SLink_qyote_gg_.__active_qyote_gg_,.___SLink_qyote_gg_:active{color:var(--intergalactic-text-link-hover-active, rgb(33, 89, 215))}@media (hover:hover){.___SLink_qyote_gg_:hover{color:var(--intergalactic-text-link-hover-active, rgb(33, 89, 215))}}.___SLink_qyote_gg_.__active_qyote_gg_ .___SText_qyote_gg_,.___SLink_qyote_gg_:active .___SText_qyote_gg_{text-decoration-color:currentColor}@media (hover:hover){.___SLink_qyote_gg_:hover .___SText_qyote_gg_{text-decoration-color:currentColor}}.___SLink_qyote_gg_.__enableVisited_qyote_gg_:visited{color:var(--intergalactic-text-link-visited, rgb(128, 41, 236))}@media (hover:hover){.___SLink_qyote_gg_.__enableVisited_qyote_gg_:visited:hover{color:var(--intergalactic-text-link-visited, rgb(128, 41, 236))}}.___SLink_qyote_gg_.__visually-disabled_qyote_gg_{opacity:var(--intergalactic-disabled-opacity, 0.4);cursor:default;pointer-events:none}.___SLink_qyote_gg_.__noWrap_qyote_gg_{white-space:nowrap}.___SLink_qyote_gg_.__inline_qyote_gg_{display:inline}.___SInner_qyote_gg_{align-items:baseline;height:100%;width:100%}.___SAddon_qyote_gg_{pointer-events:none;vertical-align:middle;display:inline-flex;margin-top:-2.5px}.___SLink_qyote_gg_ .___SAddon_qyote_gg_:not(:only-child):first-child{margin-right:var(--intergalactic-spacing-1x, 4px)}.___SLink_qyote_gg_ .___SAddon_qyote_gg_:not(:only-child):last-child{margin-left:var(--intergalactic-spacing-1x, 4px)}.___SText_qyote_gg_{-webkit-text-decoration:underline;text-decoration:underline;text-decoration-style:solid;text-decoration-thickness:1px;text-decoration-color:transparent;text-underline-offset:17%;transition:text-decoration-color .15s ease-in-out}.___SLink_qyote_gg_.__text-color_qyote_gg_{color:var(--text-color_qyote)}.___SLink_qyote_gg_.__text-color_qyote_gg_.__active_qyote_gg_,.___SLink_qyote_gg_.__text-color_qyote_gg_:active{color:var(--text-color_qyote);filter:brightness(.8)}@media (hover:hover){.___SLink_qyote_gg_.__text-color_qyote_gg_:hover{color:var(--text-color_qyote);filter:brightness(.8)}}@media (prefers-reduced-motion){.___SLink_qyote_gg_,.___SText_qyote_gg_{transition:none}}", /*__inner_css_end__*/"qyote_gg_"),
|
|
24
21
|
/*__reshadow_css_end__*/
|
|
25
22
|
{
|
|
26
|
-
"__SLink": "
|
|
27
|
-
"_visually-disabled": "__visually-
|
|
28
|
-
"
|
|
29
|
-
"_inline": "
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
23
|
+
"__SLink": "___SLink_qyote_gg_",
|
|
24
|
+
"_visually-disabled": "__visually-disabled_qyote_gg_",
|
|
25
|
+
"_noWrap": "__noWrap_qyote_gg_",
|
|
26
|
+
"_inline": "__inline_qyote_gg_",
|
|
27
|
+
"__SInner": "___SInner_qyote_gg_",
|
|
28
|
+
"__SAddon": "___SAddon_qyote_gg_",
|
|
29
|
+
"__SText": "___SText_qyote_gg_",
|
|
30
|
+
"_active": "__active_qyote_gg_",
|
|
31
|
+
"_enableVisited": "__enableVisited_qyote_gg_",
|
|
32
|
+
"_text-color": "__text-color_qyote_gg_",
|
|
33
|
+
"--text-color": "--text-color_qyote"
|
|
36
34
|
});
|
|
37
35
|
var RootLink = /*#__PURE__*/function (_Component) {
|
|
38
36
|
function RootLink() {
|
|
@@ -66,40 +64,26 @@ var RootLink = /*#__PURE__*/function (_Component) {
|
|
|
66
64
|
}
|
|
67
65
|
}
|
|
68
66
|
}, {
|
|
69
|
-
key: "
|
|
70
|
-
value: function
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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);
|
|
67
|
+
key: "getTextProps",
|
|
68
|
+
value: function getTextProps() {
|
|
69
|
+
return {
|
|
70
|
+
'hint:triggerRef': this.containerRef
|
|
71
|
+
};
|
|
90
72
|
}
|
|
91
73
|
}, {
|
|
92
74
|
key: "render",
|
|
93
75
|
value: function render() {
|
|
94
|
-
var
|
|
76
|
+
var _ref = this.asProps,
|
|
77
|
+
_ref4,
|
|
78
|
+
_ref7,
|
|
79
|
+
_ref8;
|
|
95
80
|
var _this$asProps = this.asProps,
|
|
96
81
|
styles = _this$asProps.styles,
|
|
97
|
-
noWrap = _this$asProps.noWrap,
|
|
98
82
|
color = _this$asProps.color,
|
|
99
83
|
resolveColor = _this$asProps.resolveColor,
|
|
100
84
|
disabled = _this$asProps.disabled,
|
|
101
85
|
href = _this$asProps.href,
|
|
102
|
-
|
|
86
|
+
children = _this$asProps.children,
|
|
103
87
|
AddonLeft = _this$asProps.addonLeft,
|
|
104
88
|
AddonRight = _this$asProps.addonRight,
|
|
105
89
|
Children = _this$asProps.Children,
|
|
@@ -108,64 +92,52 @@ var RootLink = /*#__PURE__*/function (_Component) {
|
|
|
108
92
|
hintPlacement = _this$asProps.hintPlacement;
|
|
109
93
|
// @ts-ignore
|
|
110
94
|
var Link = this[CORE_INSTANCE];
|
|
111
|
-
var
|
|
112
|
-
var
|
|
113
|
-
var
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
'
|
|
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
|
|
137
|
-
});
|
|
95
|
+
var SLink = Text;
|
|
96
|
+
var SInner = Box;
|
|
97
|
+
var hintContent = (_ref7 = (_ref8 = title !== null && title !== void 0 ? title : ariaLabel) !== null && _ref8 !== void 0 ? _ref8 : this.state.ariaLabelledByContent) !== null && _ref7 !== void 0 ? _ref7 : '';
|
|
98
|
+
var showHint = children === undefined || title;
|
|
99
|
+
var excludeProps = ['title', 'aria-disabled'];
|
|
100
|
+
if (!this.asProps['use:disabled']) {
|
|
101
|
+
excludeProps.push('disabled');
|
|
138
102
|
}
|
|
139
|
-
return
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
103
|
+
return _ref4 = sstyled(styles), /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SLink, _ref4.cn("SLink", _objectSpread({}, _assignProps({
|
|
104
|
+
"tabIndex": disabled ? -1 : 0,
|
|
105
|
+
"use:href": disabled ? undefined : href,
|
|
106
|
+
"visually-disabled": disabled,
|
|
107
|
+
"text-color": resolveColor(color),
|
|
108
|
+
"tag": 'a',
|
|
109
|
+
"ref": this.containerRef,
|
|
110
|
+
"__excludeProps": excludeProps,
|
|
111
|
+
"aria-label": showHint ? hintContent : undefined
|
|
112
|
+
}, _ref))), /*#__PURE__*/React.createElement(SInner, _ref4.cn("SInner", {
|
|
113
|
+
"tag": 'span',
|
|
114
|
+
"data-ui-name": "".concat(this.asProps['data-ui-name'], ".InnerWrapper")
|
|
115
|
+
}), 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", {
|
|
116
|
+
"triggerRef": this.containerRef,
|
|
117
|
+
"timeout": [250, 50],
|
|
118
|
+
"placement": hintPlacement
|
|
119
|
+
}), hintContent));
|
|
143
120
|
}
|
|
144
121
|
}]);
|
|
145
122
|
}(Component);
|
|
146
123
|
_defineProperty(RootLink, "displayName", 'Link');
|
|
147
|
-
_defineProperty(RootLink, "defaultProps", {
|
|
148
|
-
noWrap: true
|
|
149
|
-
});
|
|
150
124
|
_defineProperty(RootLink, "style", style);
|
|
151
|
-
_defineProperty(RootLink, "enhance", [
|
|
125
|
+
_defineProperty(RootLink, "enhance", [resolveColorEnhance()]);
|
|
152
126
|
function LinkText(props) {
|
|
153
|
-
var
|
|
154
|
-
|
|
155
|
-
var SText =
|
|
127
|
+
var _ref2 = arguments[0],
|
|
128
|
+
_ref5;
|
|
129
|
+
var SText = Text;
|
|
156
130
|
var styles = props.styles;
|
|
157
|
-
return
|
|
158
|
-
"tag": 'span'
|
|
159
|
-
}, _ref3))));
|
|
131
|
+
return _ref5 = sstyled(styles), /*#__PURE__*/React.createElement(SText, _ref5.cn("SText", _objectSpread({}, _assignProps2({}, _ref2))));
|
|
160
132
|
}
|
|
161
133
|
function Addon(props) {
|
|
162
|
-
var
|
|
163
|
-
|
|
134
|
+
var _ref3 = arguments[0],
|
|
135
|
+
_ref6;
|
|
164
136
|
var SAddon = Box;
|
|
165
137
|
var styles = props.styles;
|
|
166
|
-
return
|
|
138
|
+
return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(SAddon, _ref6.cn("SAddon", _objectSpread({}, _assignProps3({
|
|
167
139
|
"tag": 'span'
|
|
168
|
-
},
|
|
140
|
+
}, _ref3))));
|
|
169
141
|
}
|
|
170
142
|
var Link = createComponent(RootLink, {
|
|
171
143
|
Text: LinkText,
|
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;EA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QAAQ,iBACS,MAAM;AAAAY,eAAA,CADvBZ,QAAQ,kBAEU;EACpB2D,MAAM,EAAE;AACV,CAAC;AAAA/C,eAAA,CAJGZ,QAAQ,WAMGH,KAAK;AAAAe,eAAA,CANhBZ,QAAQ,aAOK,CAACX,oBAAoB,CAAC,CAAC,EAAEC,mBAAmB,CAAC,CAAC,CAAC;AAsHlE,SAAS4F,QAAQA,CAACC,KAAK,EAAE;EAAA,IAAAC,KAAA,GAAAC,YAAA;IAAAC,KAAA;EACvB,IAAMC,KAAK,GAE2B9F,GAAG;EADzC,IAAQiD,MAAM,GAAKyC,KAAK,CAAhBzC,MAAM;EACd,OAAA4C,KAAA,GAAOpG,OAAO,CAACwD,MAAM,CAAC,eAAC9C,KAAA,CAAAgD,aAAA,CAAC2C,KAAK,EAAAD,KAAA,CAAAzC,EAAA,UAAAC,aAAA,KAAA0C,aAAA;IAAA,OAAkB;EAAM,GAAAJ,KAAA,GAAE,CAAC;AAC1D;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","_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","getTextProps","render","_ref","_ref4","_ref7","_ref8","_this$asProps","styles","color","resolveColor","disabled","href","children","AddonLeft","addonLeft","AddonRight","addonRight","Children","title","ariaLabel","hintPlacement","Link","SLink","SInner","hintContent","state","showHint","undefined","excludeProps","push","createElement","Fragment","cn","_objectSpread","_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 { 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 { NSText } 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 getTextProps(): NSText.HintProps {\n return {\n 'hint:triggerRef': this.containerRef,\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\n const excludeProps = ['title', 'aria-disabled'];\n if (!this.asProps['use:disabled']) {\n excludeProps.push('disabled');\n }\n\n return sstyled(styles)(\n <>\n <SLink\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={excludeProps}\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} />);\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', NSText.Props>;\n Addon: Intergalactic.Component<'span', BoxProps>;\n};\n\nexport default Link;\n"],"mappings":";;;;;;;;;;AACA,SAASA,GAAG,EAAEC,IAAI,QAAQ,0BAA0B;AAEpD,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,IAAAC,KAAA,8BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,IASpBC,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,+BAKGN,KAAK,CAACiB,SAAS,CAAqB,CAAC;IAAAD,eAAA,CAAAV,KAAA,WAErC;MACbY,qBAAqB,EAAE;IACzB,CAAC;IAAA,OAAAZ,KAAA;EAAA;EAAAa,SAAA,CAA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IAAAC,KAAA,GAAAC,YAAA;IAAAC,KAAA;EAC5C,IAAMC,KAAK,GAE2BlF,IAAI;EAD1C,IAAQgD,MAAM,GAAK8B,KAAK,CAAhB9B,MAAM;EACd,OAAAiC,KAAA,GAAOvF,OAAO,CAACsD,MAAM,CAAC,eAAC/C,KAAA,CAAAsE,aAAA,CAACW,KAAK,EAAAD,KAAA,CAAAR,EAAA,UAAAC,aAAA,KAAAS,aAAA,KAAAJ,KAAA,GAAgB,CAAC;AAChD;AAEA,SAASH,KAAKA,CAACE,KAA0B,EAAE;EAAA,IAAAM,KAAA,GAAAJ,YAAA;IAAAK,KAAA;EACzC,IAAMC,MAAM,GAE2BjG,GAAG;EAD1C,IAAQ2D,MAAM,GAAK8B,KAAK,CAAhB9B,MAAM;EACd,OAAAqC,KAAA,GAAO3F,OAAO,CAACsD,MAAM,CAAC,eAAC/C,KAAA,CAAAsE,aAAA,CAACe,MAAM,EAAAD,KAAA,CAAAZ,EAAA,WAAAC,aAAA,KAAAa,aAAA;IAAA,OAAkB;EAAM,GAAAH,KAAA,GAAE,CAAC;AAC3D;AAEA,IAAMtB,IAAI,GAAGvE,eAAe,CAACc,QAAQ,EAAE;EACrCL,IAAI,EAAE6E,QAAQ;EACdD,KAAK,EAALA;AACF,CAAC,CAGA;AAED,eAAed,IAAI","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Link.types.js","names":[],"sources":["../../src/Link.types.ts"],"sourcesContent":["import type { BoxProps, SimpleHintPopperProps } from '@semcore/base-components';\nimport type { NSText } from '@semcore/typography';\nimport type React from 'react';\n\nexport type LinkProps = BoxProps & NSText.BaseProps & {\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,24 +1,14 @@
|
|
|
1
1
|
SLink {
|
|
2
|
-
display: inline
|
|
3
|
-
|
|
2
|
+
display: inline;
|
|
3
|
+
align-items: center;
|
|
4
4
|
color: var(--intergalactic-text-link, oklch(0.53 0.21 263));
|
|
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;
|
|
16
11
|
|
|
17
|
-
&:active,
|
|
18
|
-
&:hover {
|
|
19
|
-
text-decoration: none;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
12
|
&::-moz-focus-inner {
|
|
23
13
|
border: none;
|
|
24
14
|
padding: 0;
|
|
@@ -30,7 +20,7 @@ SLink {
|
|
|
30
20
|
color: var(--intergalactic-text-link-hover-active, oklch(0.51 0.202 263));
|
|
31
21
|
|
|
32
22
|
& SText {
|
|
33
|
-
|
|
23
|
+
text-decoration-color: currentColor;
|
|
34
24
|
}
|
|
35
25
|
}
|
|
36
26
|
|
|
@@ -47,7 +37,7 @@ SLink[visually-disabled] {
|
|
|
47
37
|
pointer-events: none;
|
|
48
38
|
}
|
|
49
39
|
|
|
50
|
-
SLink[
|
|
40
|
+
SLink[noWrap] {
|
|
51
41
|
white-space: nowrap;
|
|
52
42
|
}
|
|
53
43
|
|
|
@@ -55,13 +45,17 @@ SLink[inline] {
|
|
|
55
45
|
display: inline;
|
|
56
46
|
}
|
|
57
47
|
|
|
48
|
+
SInner {
|
|
49
|
+
align-items: baseline;
|
|
50
|
+
height: 100%;
|
|
51
|
+
width: 100%;
|
|
52
|
+
}
|
|
53
|
+
|
|
58
54
|
SAddon {
|
|
59
|
-
display: inline-flex;
|
|
60
|
-
justify-content: center;
|
|
61
|
-
align-items: center;
|
|
62
|
-
margin-bottom: var(--intergalactic-spacing-05x, 2px);
|
|
63
|
-
vertical-align: middle;
|
|
64
55
|
pointer-events: none;
|
|
56
|
+
vertical-align: middle;
|
|
57
|
+
display: inline-flex;
|
|
58
|
+
margin-top: -2.5px;
|
|
65
59
|
}
|
|
66
60
|
|
|
67
61
|
SLink SAddon {
|
|
@@ -75,10 +69,13 @@ SLink SAddon {
|
|
|
75
69
|
}
|
|
76
70
|
|
|
77
71
|
SText {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
72
|
+
text-decoration: underline;
|
|
73
|
+
text-decoration-style: solid;
|
|
74
|
+
text-decoration-thickness: 1px;
|
|
75
|
+
text-decoration-color: transparent;
|
|
76
|
+
text-underline-offset: 17%;
|
|
77
|
+
|
|
78
|
+
transition: text-decoration-color 0.15s ease-in-out;
|
|
82
79
|
}
|
|
83
80
|
|
|
84
81
|
SLink[text-color] {
|
package/lib/esm/Link.mjs
CHANGED
|
@@ -4,14 +4,12 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
4
4
|
import _callSuper from "@babel/runtime/helpers/esm/callSuper";
|
|
5
5
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
6
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
7
|
-
import {
|
|
7
|
+
import { sstyled, CORE_INSTANCE, assignProps, Component, createComponent } from "@semcore/core";
|
|
8
|
+
import { Box, Hint } from "@semcore/base-components";
|
|
8
9
|
import addonTextChildren from "@semcore/core/lib/utils/addonTextChildren";
|
|
9
|
-
import keyboardFocusEnhance from "@semcore/core/lib/utils/enhances/keyboardFocusEnhance";
|
|
10
10
|
import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
|
|
11
11
|
import hasLabels from "@semcore/core/lib/utils/hasLabels";
|
|
12
12
|
import logger from "@semcore/core/lib/utils/logger";
|
|
13
|
-
import { Box } from "@semcore/flex-box";
|
|
14
|
-
import { Hint } from "@semcore/tooltip";
|
|
15
13
|
import { Text } from "@semcore/typography";
|
|
16
14
|
import React from "react";
|
|
17
15
|
/*!__reshadow-styles__:"./style/link.shadow.css"*/
|
|
@@ -19,21 +17,22 @@ var style = (
|
|
|
19
17
|
/*__reshadow_css_start__*/
|
|
20
18
|
(sstyled.insert(
|
|
21
19
|
/*__inner_css_start__*/
|
|
22
|
-
".
|
|
20
|
+
".___SLink_qyote_gg_{display:inline;align-items:center;color:var(--intergalactic-text-link, rgb(35, 95, 226));position:relative;cursor:pointer;-webkit-text-decoration:none;text-decoration:none;-webkit-tap-highlight-color:transparent;background:0 0;transition:color .15s ease-in-out}.___SLink_qyote_gg_::-moz-focus-inner{border:0;padding:0}.___SLink_qyote_gg_.__active_qyote_gg_,.___SLink_qyote_gg_:active{color:var(--intergalactic-text-link-hover-active, rgb(33, 89, 215))}@media (hover:hover){.___SLink_qyote_gg_:hover{color:var(--intergalactic-text-link-hover-active, rgb(33, 89, 215))}}.___SLink_qyote_gg_.__active_qyote_gg_ .___SText_qyote_gg_,.___SLink_qyote_gg_:active .___SText_qyote_gg_{text-decoration-color:currentColor}@media (hover:hover){.___SLink_qyote_gg_:hover .___SText_qyote_gg_{text-decoration-color:currentColor}}.___SLink_qyote_gg_.__enableVisited_qyote_gg_:visited{color:var(--intergalactic-text-link-visited, rgb(128, 41, 236))}@media (hover:hover){.___SLink_qyote_gg_.__enableVisited_qyote_gg_:visited:hover{color:var(--intergalactic-text-link-visited, rgb(128, 41, 236))}}.___SLink_qyote_gg_.__visually-disabled_qyote_gg_{opacity:var(--intergalactic-disabled-opacity, 0.4);cursor:default;pointer-events:none}.___SLink_qyote_gg_.__noWrap_qyote_gg_{white-space:nowrap}.___SLink_qyote_gg_.__inline_qyote_gg_{display:inline}.___SInner_qyote_gg_{align-items:baseline;height:100%;width:100%}.___SAddon_qyote_gg_{pointer-events:none;vertical-align:middle;display:inline-flex;margin-top:-2.5px}.___SLink_qyote_gg_ .___SAddon_qyote_gg_:not(:only-child):first-child{margin-right:var(--intergalactic-spacing-1x, 4px)}.___SLink_qyote_gg_ .___SAddon_qyote_gg_:not(:only-child):last-child{margin-left:var(--intergalactic-spacing-1x, 4px)}.___SText_qyote_gg_{-webkit-text-decoration:underline;text-decoration:underline;text-decoration-style:solid;text-decoration-thickness:1px;text-decoration-color:transparent;text-underline-offset:17%;transition:text-decoration-color .15s ease-in-out}.___SLink_qyote_gg_.__text-color_qyote_gg_{color:var(--text-color_qyote)}.___SLink_qyote_gg_.__text-color_qyote_gg_.__active_qyote_gg_,.___SLink_qyote_gg_.__text-color_qyote_gg_:active{color:var(--text-color_qyote);filter:brightness(.8)}@media (hover:hover){.___SLink_qyote_gg_.__text-color_qyote_gg_:hover{color:var(--text-color_qyote);filter:brightness(.8)}}@media (prefers-reduced-motion){.___SLink_qyote_gg_,.___SText_qyote_gg_{transition:none}}",
|
|
23
21
|
/*__inner_css_end__*/
|
|
24
|
-
"
|
|
22
|
+
"qyote_gg_"
|
|
25
23
|
), /*__reshadow_css_end__*/
|
|
26
24
|
{
|
|
27
|
-
"__SLink": "
|
|
28
|
-
"_visually-disabled": "__visually-
|
|
29
|
-
"
|
|
30
|
-
"_inline": "
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
25
|
+
"__SLink": "___SLink_qyote_gg_",
|
|
26
|
+
"_visually-disabled": "__visually-disabled_qyote_gg_",
|
|
27
|
+
"_noWrap": "__noWrap_qyote_gg_",
|
|
28
|
+
"_inline": "__inline_qyote_gg_",
|
|
29
|
+
"__SInner": "___SInner_qyote_gg_",
|
|
30
|
+
"__SAddon": "___SAddon_qyote_gg_",
|
|
31
|
+
"__SText": "___SText_qyote_gg_",
|
|
32
|
+
"_active": "__active_qyote_gg_",
|
|
33
|
+
"_enableVisited": "__enableVisited_qyote_gg_",
|
|
34
|
+
"_text-color": "__text-color_qyote_gg_",
|
|
35
|
+
"--text-color": "--text-color_qyote"
|
|
37
36
|
})
|
|
38
37
|
);
|
|
39
38
|
var RootLink = /* @__PURE__ */ (function(_Component) {
|
|
@@ -68,85 +67,62 @@ var RootLink = /* @__PURE__ */ (function(_Component) {
|
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
69
|
}, {
|
|
71
|
-
key: "
|
|
72
|
-
value: function
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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, _ref6;
|
|
83
|
-
var linkProps = _ref1.linkProps, children = _ref1.children, hintProps = _ref1.hintProps;
|
|
84
|
-
var styles = this.asProps.styles;
|
|
85
|
-
var SLink = Hint;
|
|
86
|
-
return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SLink, _ref6.cn("SLink", _objectSpread({}, assignProps(_objectSpread(_objectSpread({}, linkProps), hintProps), _ref2))), children);
|
|
70
|
+
key: "getTextProps",
|
|
71
|
+
value: function getTextProps() {
|
|
72
|
+
return {
|
|
73
|
+
"hint:triggerRef": this.containerRef
|
|
74
|
+
};
|
|
87
75
|
}
|
|
88
76
|
}, {
|
|
89
77
|
key: "render",
|
|
90
78
|
value: function render() {
|
|
91
|
-
var
|
|
92
|
-
var _this$asProps = this.asProps, styles = _this$asProps.styles,
|
|
79
|
+
var _ref = this.asProps, _ref4, _ref7, _ref8;
|
|
80
|
+
var _this$asProps = this.asProps, styles = _this$asProps.styles, color = _this$asProps.color, resolveColor = _this$asProps.resolveColor, disabled = _this$asProps.disabled, href = _this$asProps.href, children = _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;
|
|
93
81
|
var Link2 = this[CORE_INSTANCE];
|
|
94
|
-
var
|
|
95
|
-
var
|
|
96
|
-
var
|
|
97
|
-
|
|
82
|
+
var SLink = Text;
|
|
83
|
+
var SInner = Box;
|
|
84
|
+
var hintContent = (_ref7 = (_ref8 = title !== null && title !== void 0 ? title : ariaLabel) !== null && _ref8 !== void 0 ? _ref8 : this.state.ariaLabelledByContent) !== null && _ref7 !== void 0 ? _ref7 : "";
|
|
85
|
+
var showHint = children === void 0 || title;
|
|
86
|
+
var excludeProps = ["title", "aria-disabled"];
|
|
87
|
+
if (!this.asProps["use:disabled"]) {
|
|
88
|
+
excludeProps.push("disabled");
|
|
89
|
+
}
|
|
90
|
+
return _ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SLink, _ref4.cn("SLink", _objectSpread({}, assignProps({
|
|
98
91
|
"tabIndex": disabled ? -1 : 0,
|
|
99
92
|
"use:href": disabled ? void 0 : href,
|
|
100
93
|
"visually-disabled": disabled,
|
|
101
|
-
"render": Text,
|
|
102
94
|
"text-color": resolveColor(color),
|
|
103
95
|
"tag": "a",
|
|
104
|
-
"noWrapText": noWrap,
|
|
105
|
-
"use:noWrap": false,
|
|
106
96
|
"ref": this.containerRef,
|
|
107
|
-
"__excludeProps":
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
linkProps,
|
|
118
|
-
hintProps,
|
|
119
|
-
children
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
return this.renderLink({
|
|
123
|
-
linkProps,
|
|
124
|
-
children
|
|
125
|
-
});
|
|
97
|
+
"__excludeProps": excludeProps,
|
|
98
|
+
"aria-label": showHint ? hintContent : void 0
|
|
99
|
+
}, _ref))), /* @__PURE__ */ React.createElement(SInner, _ref4.cn("SInner", {
|
|
100
|
+
"tag": "span",
|
|
101
|
+
"data-ui-name": "".concat(this.asProps["data-ui-name"], ".InnerWrapper")
|
|
102
|
+
}), AddonLeft ? /* @__PURE__ */ React.createElement(Link2.Addon, null, /* @__PURE__ */ React.createElement(AddonLeft, _ref4.cn("AddonLeft", {}))) : null, addonTextChildren(Children, Link2.Text, Link2.Addon), AddonRight ? /* @__PURE__ */ React.createElement(Link2.Addon, null, /* @__PURE__ */ React.createElement(AddonRight, _ref4.cn("AddonRight", {}))) : null)), showHint && /* @__PURE__ */ React.createElement(Hint, _ref4.cn("Hint", {
|
|
103
|
+
"triggerRef": this.containerRef,
|
|
104
|
+
"timeout": [250, 50],
|
|
105
|
+
"placement": hintPlacement
|
|
106
|
+
}), hintContent));
|
|
126
107
|
}
|
|
127
108
|
}]);
|
|
128
109
|
})(Component);
|
|
129
110
|
_defineProperty(RootLink, "displayName", "Link");
|
|
130
|
-
_defineProperty(RootLink, "defaultProps", {
|
|
131
|
-
noWrap: true
|
|
132
|
-
});
|
|
133
111
|
_defineProperty(RootLink, "style", style);
|
|
134
|
-
_defineProperty(RootLink, "enhance", [
|
|
112
|
+
_defineProperty(RootLink, "enhance", [resolveColorEnhance()]);
|
|
135
113
|
function LinkText(props) {
|
|
136
|
-
var
|
|
137
|
-
var SText =
|
|
114
|
+
var _ref2 = arguments[0], _ref5;
|
|
115
|
+
var SText = Text;
|
|
138
116
|
var styles = props.styles;
|
|
139
|
-
return
|
|
140
|
-
"tag": "span"
|
|
141
|
-
}, _ref3))));
|
|
117
|
+
return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SText, _ref5.cn("SText", _objectSpread({}, assignProps({}, _ref2))));
|
|
142
118
|
}
|
|
143
119
|
function Addon(props) {
|
|
144
|
-
var
|
|
120
|
+
var _ref3 = arguments[0], _ref6;
|
|
145
121
|
var SAddon = Box;
|
|
146
122
|
var styles = props.styles;
|
|
147
|
-
return
|
|
123
|
+
return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SAddon, _ref6.cn("SAddon", _objectSpread({}, assignProps({
|
|
148
124
|
"tag": "span"
|
|
149
|
-
},
|
|
125
|
+
}, _ref3))));
|
|
150
126
|
}
|
|
151
127
|
var Link = createComponent(RootLink, {
|
|
152
128
|
Text: LinkText,
|
|
@@ -1,24 +1,14 @@
|
|
|
1
1
|
SLink {
|
|
2
|
-
display: inline
|
|
3
|
-
|
|
2
|
+
display: inline;
|
|
3
|
+
align-items: center;
|
|
4
4
|
color: var(--intergalactic-text-link, oklch(0.53 0.21 263));
|
|
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;
|
|
16
11
|
|
|
17
|
-
&:active,
|
|
18
|
-
&:hover {
|
|
19
|
-
text-decoration: none;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
12
|
&::-moz-focus-inner {
|
|
23
13
|
border: none;
|
|
24
14
|
padding: 0;
|
|
@@ -30,7 +20,7 @@ SLink {
|
|
|
30
20
|
color: var(--intergalactic-text-link-hover-active, oklch(0.51 0.202 263));
|
|
31
21
|
|
|
32
22
|
& SText {
|
|
33
|
-
|
|
23
|
+
text-decoration-color: currentColor;
|
|
34
24
|
}
|
|
35
25
|
}
|
|
36
26
|
|
|
@@ -47,7 +37,7 @@ SLink[visually-disabled] {
|
|
|
47
37
|
pointer-events: none;
|
|
48
38
|
}
|
|
49
39
|
|
|
50
|
-
SLink[
|
|
40
|
+
SLink[noWrap] {
|
|
51
41
|
white-space: nowrap;
|
|
52
42
|
}
|
|
53
43
|
|
|
@@ -55,13 +45,17 @@ SLink[inline] {
|
|
|
55
45
|
display: inline;
|
|
56
46
|
}
|
|
57
47
|
|
|
48
|
+
SInner {
|
|
49
|
+
align-items: baseline;
|
|
50
|
+
height: 100%;
|
|
51
|
+
width: 100%;
|
|
52
|
+
}
|
|
53
|
+
|
|
58
54
|
SAddon {
|
|
59
|
-
display: inline-flex;
|
|
60
|
-
justify-content: center;
|
|
61
|
-
align-items: center;
|
|
62
|
-
margin-bottom: var(--intergalactic-spacing-05x, 2px);
|
|
63
|
-
vertical-align: middle;
|
|
64
55
|
pointer-events: none;
|
|
56
|
+
vertical-align: middle;
|
|
57
|
+
display: inline-flex;
|
|
58
|
+
margin-top: -2.5px;
|
|
65
59
|
}
|
|
66
60
|
|
|
67
61
|
SLink SAddon {
|
|
@@ -75,10 +69,13 @@ SLink SAddon {
|
|
|
75
69
|
}
|
|
76
70
|
|
|
77
71
|
SText {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
72
|
+
text-decoration: underline;
|
|
73
|
+
text-decoration-style: solid;
|
|
74
|
+
text-decoration-thickness: 1px;
|
|
75
|
+
text-decoration-color: transparent;
|
|
76
|
+
text-underline-offset: 17%;
|
|
77
|
+
|
|
78
|
+
transition: text-decoration-color 0.15s ease-in-out;
|
|
82
79
|
}
|
|
83
80
|
|
|
84
81
|
SLink[text-color] {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { BoxProps } from '@semcore/base-components';
|
|
2
|
+
import type { Intergalactic } from '@semcore/core';
|
|
3
|
+
import { Component } from '@semcore/core';
|
|
4
|
+
import type { NSText } from '@semcore/typography';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import type { LinkProps } from './Link.types';
|
|
7
|
+
type State = {
|
|
8
|
+
ariaLabelledByContent: string;
|
|
9
|
+
};
|
|
10
|
+
declare class RootLink extends Component<LinkProps, typeof RootLink.enhance, never, {}, State> {
|
|
11
|
+
static displayName: string;
|
|
12
|
+
static style: {
|
|
13
|
+
[key: string]: string;
|
|
14
|
+
};
|
|
15
|
+
static enhance: readonly [(props: any) => any];
|
|
16
|
+
containerRef: React.RefObject<HTMLElement | null>;
|
|
17
|
+
state: State;
|
|
18
|
+
componentDidMount(): void;
|
|
19
|
+
getTextProps(): NSText.HintProps;
|
|
20
|
+
render(): React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
declare const Link: Intergalactic.Component<"a", LinkProps, {}, typeof RootLink.enhance> & {
|
|
23
|
+
Text: Intergalactic.Component<"span", NSText.Props>;
|
|
24
|
+
Addon: Intergalactic.Component<"span", BoxProps>;
|
|
25
|
+
};
|
|
26
|
+
export default Link;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { BoxProps, SimpleHintPopperProps } from '@semcore/base-components';
|
|
2
|
+
import type { NSText } from '@semcore/typography';
|
|
3
|
+
import type React from 'react';
|
|
4
|
+
export type LinkProps = BoxProps & NSText.BaseProps & {
|
|
5
|
+
/**
|
|
6
|
+
* CSS property of the display link (inline|inline-block)
|
|
7
|
+
* @default false
|
|
8
|
+
* @deprecated. You should use default inline-flex for all cases.
|
|
9
|
+
*/
|
|
10
|
+
inline?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Sets the link to the disabled state
|
|
13
|
+
*/
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Sets the link to the active state
|
|
17
|
+
*/
|
|
18
|
+
active?: boolean;
|
|
19
|
+
/** This flag enables highlighting of the visited link
|
|
20
|
+
*/
|
|
21
|
+
enableVisited?: boolean;
|
|
22
|
+
/** The text will not be moved to a new line
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
noWrap?: boolean;
|
|
26
|
+
/** Left addon tag */
|
|
27
|
+
addonLeft?: React.ElementType;
|
|
28
|
+
/** Right addon tag */
|
|
29
|
+
addonRight?: React.ElementType;
|
|
30
|
+
/**
|
|
31
|
+
* The position of the popper relative to the trigger that called it.
|
|
32
|
+
* @default top
|
|
33
|
+
*/
|
|
34
|
+
hintPlacement?: SimpleHintPopperProps['placement'];
|
|
35
|
+
};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,40 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import type React from 'react';
|
|
5
|
-
|
|
6
|
-
/** @deprecated */
|
|
7
|
-
export interface ILinkProps extends LinkProps, UnknownProperties {}
|
|
8
|
-
export type LinkProps = TextProps & {
|
|
9
|
-
/**
|
|
10
|
-
* CSS property of the display link (inline|inline-block)
|
|
11
|
-
* @default false
|
|
12
|
-
*/
|
|
13
|
-
inline?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Sets the link to the disabled state
|
|
16
|
-
*/
|
|
17
|
-
disabled?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Sets the link to the active state
|
|
20
|
-
*/
|
|
21
|
-
active?: boolean;
|
|
22
|
-
/** This flag enables highlighting of the visited link
|
|
23
|
-
*/
|
|
24
|
-
enableVisited?: boolean;
|
|
25
|
-
/** The text will not be moved to a new line
|
|
26
|
-
* @default true
|
|
27
|
-
*/
|
|
28
|
-
noWrap?: boolean;
|
|
29
|
-
/** Left addon tag */
|
|
30
|
-
addonLeft?: React.ElementType;
|
|
31
|
-
/** Right addon tag */
|
|
32
|
-
addonRight?: React.ElementType;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
declare const Link: Intergalactic.Component<'a', LinkProps> & {
|
|
36
|
-
Text: Intergalactic.Component<'span', TextProps>;
|
|
37
|
-
Addon: Intergalactic.Component<'span', BoxProps>;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export default Link;
|
|
1
|
+
import type { LinkProps } from './Link.types';
|
|
2
|
+
export { default } from './Link';
|
|
3
|
+
export type { LinkProps };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/link",
|
|
3
3
|
"description": "Semrush Link Component",
|
|
4
|
-
"version": "16.1.0
|
|
4
|
+
"version": "16.1.0",
|
|
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/flex-box": "16.1.0
|
|
18
|
-
"@semcore/tooltip": "16.1.0
|
|
19
|
-
"@semcore/typography": "16.4.0
|
|
17
|
+
"@semcore/flex-box": "16.1.0",
|
|
18
|
+
"@semcore/tooltip": "16.1.0",
|
|
19
|
+
"@semcore/typography": "16.4.0"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@semcore/base-components": "^16.6.0
|
|
22
|
+
"@semcore/base-components": "^16.6.0"
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@semcore/testing-utils": "1.0.0",
|
|
31
|
-
"@semcore/core": "16.6.0
|
|
32
|
-
"@semcore/icon": "16.8.0
|
|
31
|
+
"@semcore/core": "16.6.0",
|
|
32
|
+
"@semcore/icon": "16.8.0"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "pnpm semcore-builder --source=js && pnpm vite build"
|
package/lib/cjs/index.d.js
DELETED
package/lib/cjs/index.d.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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.d.js
DELETED
package/lib/es6/index.d.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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":[]}
|