@semcore/link 16.1.0 → 16.1.1
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 +1 -1
- package/lib/cjs/Link.js +84 -57
- package/lib/cjs/Link.js.map +1 -1
- package/lib/cjs/index.d.js +2 -0
- package/lib/cjs/index.d.js.map +1 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/link.shadow.css +23 -20
- package/lib/es6/Link.js +84 -56
- package/lib/es6/Link.js.map +1 -1
- package/lib/es6/index.d.js +2 -0
- package/lib/es6/index.d.js.map +1 -0
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/style/link.shadow.css +23 -20
- package/lib/esm/Link.mjs +72 -48
- package/lib/esm/style/link.shadow.css +23 -20
- package/lib/types/index.d.ts +40 -3
- package/package.json +6 -6
- package/lib/cjs/Link.types.js +0 -2
- package/lib/cjs/Link.types.js.map +0 -1
- package/lib/es6/Link.types.js +0 -2
- package/lib/es6/Link.types.js.map +0 -1
- package/lib/types/Link.d.ts +0 -26
- package/lib/types/Link.types.d.ts +0 -35
package/CHANGELOG.md
CHANGED
package/lib/cjs/Link.js
CHANGED
|
@@ -12,28 +12,29 @@ 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");
|
|
16
15
|
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");
|
|
20
22
|
var _typography = require("@semcore/typography");
|
|
21
23
|
var _react = _interopRequireDefault(require("react"));
|
|
22
24
|
/*!__reshadow-styles__:"./style/link.shadow.css"*/
|
|
23
|
-
var style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".
|
|
25
|
+
var style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".___SLink_1xzws_gg_{display:inline-block;font-family:inherit;color:var(--intergalactic-text-link, rgb(35, 95, 226));line-height:normal;position:relative;cursor:pointer;border:0;padding:0;margin:0;box-shadow:none;-webkit-tap-highlight-color:transparent;background:0 0;transition:color .15s ease-in-out}.___SLink_1xzws_gg_,.___SLink_1xzws_gg_:active{-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SLink_1xzws_gg_:hover{-webkit-text-decoration:none;text-decoration:none}}.___SLink_1xzws_gg_::-moz-focus-inner{border:0;padding:0}.___SLink_1xzws_gg_.__active_1xzws_gg_,.___SLink_1xzws_gg_:active{color:var(--intergalactic-text-link-hover-active, rgb(33, 89, 215))}@media (hover:hover){.___SLink_1xzws_gg_:hover{color:var(--intergalactic-text-link-hover-active, rgb(33, 89, 215))}}.___SLink_1xzws_gg_.__active_1xzws_gg_ .___SText_1xzws_gg_,.___SLink_1xzws_gg_:active .___SText_1xzws_gg_{border-color:currentColor}@media (hover:hover){.___SLink_1xzws_gg_:hover .___SText_1xzws_gg_{border-color:currentColor}}.___SLink_1xzws_gg_.__enableVisited_1xzws_gg_:visited{color:var(--intergalactic-text-link-visited, rgb(128, 41, 236))}@media (hover:hover){.___SLink_1xzws_gg_.__enableVisited_1xzws_gg_:visited:hover{color:var(--intergalactic-text-link-visited, rgb(128, 41, 236))}}.___SLink_1xzws_gg_.__visually-disabled_1xzws_gg_{opacity:var(--intergalactic-disabled-opacity, 0.4);cursor:default;pointer-events:none}.___SLink_1xzws_gg_.__noWrapText_1xzws_gg_{white-space:nowrap}.___SLink_1xzws_gg_.__inline_1xzws_gg_{display:inline}.___SAddon_1xzws_gg_{display:inline-flex;justify-content:center;align-items:center;margin-bottom:var(--intergalactic-spacing-05x, 2px);vertical-align:middle;pointer-events:none}.___SLink_1xzws_gg_ .___SAddon_1xzws_gg_:not(:only-child):first-child{margin-right:var(--intergalactic-spacing-1x, 4px)}.___SLink_1xzws_gg_ .___SAddon_1xzws_gg_:not(:only-child):last-child{margin-left:var(--intergalactic-spacing-1x, 4px)}.___SText_1xzws_gg_{border-bottom-width:1px;border-bottom-style:solid;border-color:transparent;transition:border-bottom-color .15s ease-in-out}.___SLink_1xzws_gg_.__text-color_1xzws_gg_{color:var(--text-color_1xzws)}.___SLink_1xzws_gg_.__text-color_1xzws_gg_.__active_1xzws_gg_,.___SLink_1xzws_gg_.__text-color_1xzws_gg_:active{color:var(--text-color_1xzws);filter:brightness(.8)}@media (hover:hover){.___SLink_1xzws_gg_.__text-color_1xzws_gg_:hover{color:var(--text-color_1xzws);filter:brightness(.8)}}@media (prefers-reduced-motion){.___SLink_1xzws_gg_,.___SText_1xzws_gg_{transition:none}}", /*__inner_css_end__*/"1xzws_gg_"),
|
|
24
26
|
/*__reshadow_css_end__*/
|
|
25
27
|
{
|
|
26
|
-
"__SLink": "
|
|
27
|
-
"_visually-disabled": "__visually-
|
|
28
|
-
"
|
|
29
|
-
"_inline": "
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"--text-color": "--text-color_qyote"
|
|
28
|
+
"__SLink": "___SLink_1xzws_gg_",
|
|
29
|
+
"_visually-disabled": "__visually-disabled_1xzws_gg_",
|
|
30
|
+
"_noWrapText": "__noWrapText_1xzws_gg_",
|
|
31
|
+
"_inline": "__inline_1xzws_gg_",
|
|
32
|
+
"__SAddon": "___SAddon_1xzws_gg_",
|
|
33
|
+
"__SText": "___SText_1xzws_gg_",
|
|
34
|
+
"_active": "__active_1xzws_gg_",
|
|
35
|
+
"_enableVisited": "__enableVisited_1xzws_gg_",
|
|
36
|
+
"_text-color": "__text-color_1xzws_gg_",
|
|
37
|
+
"--text-color": "--text-color_1xzws"
|
|
37
38
|
});
|
|
38
39
|
var RootLink = /*#__PURE__*/function (_Component) {
|
|
39
40
|
function RootLink() {
|
|
@@ -67,26 +68,40 @@ var RootLink = /*#__PURE__*/function (_Component) {
|
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
70
|
}, {
|
|
70
|
-
key: "
|
|
71
|
-
value: function
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
key: "renderLink",
|
|
72
|
+
value: function renderLink(_ref0) {
|
|
73
|
+
var _ref = this.asProps,
|
|
74
|
+
_ref5;
|
|
75
|
+
var linkProps = _ref0.linkProps,
|
|
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);
|
|
75
92
|
}
|
|
76
93
|
}, {
|
|
77
94
|
key: "render",
|
|
78
95
|
value: function render() {
|
|
79
|
-
var
|
|
80
|
-
_ref4,
|
|
81
|
-
_ref7,
|
|
82
|
-
_ref8;
|
|
96
|
+
var _ref7, _ref10, _ref11;
|
|
83
97
|
var _this$asProps = this.asProps,
|
|
84
98
|
styles = _this$asProps.styles,
|
|
99
|
+
noWrap = _this$asProps.noWrap,
|
|
85
100
|
color = _this$asProps.color,
|
|
86
101
|
resolveColor = _this$asProps.resolveColor,
|
|
87
102
|
disabled = _this$asProps.disabled,
|
|
88
103
|
href = _this$asProps.href,
|
|
89
|
-
|
|
104
|
+
hasChildren = _this$asProps.children,
|
|
90
105
|
AddonLeft = _this$asProps.addonLeft,
|
|
91
106
|
AddonRight = _this$asProps.addonRight,
|
|
92
107
|
Children = _this$asProps.Children,
|
|
@@ -95,52 +110,64 @@ var RootLink = /*#__PURE__*/function (_Component) {
|
|
|
95
110
|
hintPlacement = _this$asProps.hintPlacement;
|
|
96
111
|
// @ts-ignore
|
|
97
112
|
var Link = this[_core.CORE_INSTANCE];
|
|
98
|
-
var
|
|
99
|
-
var
|
|
100
|
-
var
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
113
|
+
var children = (_ref7 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, AddonLeft ? /*#__PURE__*/_react["default"].createElement(Link.Addon, null, /*#__PURE__*/_react["default"].createElement(AddonLeft, _ref7.cn("AddonLeft", {}))) : null, (0, _addonTextChildren["default"])(Children, Link.Text, Link.Addon), AddonRight ? /*#__PURE__*/_react["default"].createElement(Link.Addon, null, /*#__PURE__*/_react["default"].createElement(AddonRight, _ref7.cn("AddonRight", {}))) : null));
|
|
114
|
+
var hintContent = (_ref10 = (_ref11 = title !== null && title !== void 0 ? title : ariaLabel) !== null && _ref11 !== void 0 ? _ref11 : this.state.ariaLabelledByContent) !== null && _ref10 !== void 0 ? _ref10 : '';
|
|
115
|
+
var linkProps = {
|
|
116
|
+
'role': 'link',
|
|
117
|
+
'tabIndex': disabled ? -1 : 0,
|
|
118
|
+
'use:href': disabled ? undefined : href,
|
|
119
|
+
'visually-disabled': disabled,
|
|
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
|
+
});
|
|
105
140
|
}
|
|
106
|
-
return
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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));
|
|
141
|
+
return this.renderLink({
|
|
142
|
+
linkProps: linkProps,
|
|
143
|
+
children: children
|
|
144
|
+
});
|
|
123
145
|
}
|
|
124
146
|
}]);
|
|
125
147
|
}(_core.Component);
|
|
126
148
|
(0, _defineProperty2["default"])(RootLink, "displayName", 'Link');
|
|
149
|
+
(0, _defineProperty2["default"])(RootLink, "defaultProps", {
|
|
150
|
+
noWrap: true
|
|
151
|
+
});
|
|
127
152
|
(0, _defineProperty2["default"])(RootLink, "style", style);
|
|
128
|
-
(0, _defineProperty2["default"])(RootLink, "enhance", [(0, _resolveColorEnhance["default"])()]);
|
|
153
|
+
(0, _defineProperty2["default"])(RootLink, "enhance", [(0, _keyboardFocusEnhance["default"])(), (0, _resolveColorEnhance["default"])()]);
|
|
129
154
|
function LinkText(props) {
|
|
130
|
-
var
|
|
131
|
-
|
|
132
|
-
var SText =
|
|
155
|
+
var _ref3 = arguments[0],
|
|
156
|
+
_ref8;
|
|
157
|
+
var SText = _flexBox.Box;
|
|
133
158
|
var styles = props.styles;
|
|
134
|
-
return
|
|
159
|
+
return _ref8 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SText, _ref8.cn("SText", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
|
|
160
|
+
"tag": 'span'
|
|
161
|
+
}, _ref3))));
|
|
135
162
|
}
|
|
136
163
|
function Addon(props) {
|
|
137
|
-
var
|
|
138
|
-
|
|
139
|
-
var SAddon =
|
|
164
|
+
var _ref4 = arguments[0],
|
|
165
|
+
_ref9;
|
|
166
|
+
var SAddon = _flexBox.Box;
|
|
140
167
|
var styles = props.styles;
|
|
141
|
-
return
|
|
168
|
+
return _ref9 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SAddon, _ref9.cn("SAddon", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
|
|
142
169
|
"tag": 'span'
|
|
143
|
-
},
|
|
170
|
+
}, _ref4))));
|
|
144
171
|
}
|
|
145
172
|
var Link = (0, _core.createComponent)(RootLink, {
|
|
146
173
|
Text: LinkText,
|
package/lib/cjs/Link.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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;EAA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AA,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":[]}
|
|
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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EAACrG,QAAQ,EAAE;EACrC+C,IAAI,EAAE4C,QAAQ;EACdX,KAAK,EAALA;AACF,CAAC,CAAC;AAAC,IAAAsB,QAAA,GAAAC,OAAA,cAEY1B,IAAI","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import type { Intergalactic, UnknownProperties } from '@semcore/core';\nimport type { BoxProps } from '@semcore/flex-box';\nimport type { TextProps } from '@semcore/typography';\nimport type React from 'react';\n\n/** @deprecated */\nexport interface ILinkProps extends LinkProps, UnknownProperties {}\nexport type LinkProps = TextProps & {\n /**\n * CSS property of the display link (inline|inline-block)\n * @default false\n */\n inline?: boolean;\n /**\n * Sets the link to the disabled state\n */\n disabled?: boolean;\n /**\n * Sets the link to the active state\n */\n active?: boolean;\n /** This flag enables highlighting of the visited link\n */\n enableVisited?: boolean;\n /** The text will not be moved to a new line\n * @default true\n */\n noWrap?: boolean;\n /** Left addon tag */\n addonLeft?: React.ElementType;\n /** Right addon tag */\n addonRight?: React.ElementType;\n};\n\ndeclare const Link: Intergalactic.Component<'a', LinkProps> & {\n Text: Intergalactic.Component<'span', TextProps>;\n Addon: Intergalactic.Component<'span', BoxProps>;\n};\n\nexport default Link;\n"],"mappings":"","ignoreList":[]}
|
package/lib/cjs/index.js.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.js"],"sourcesContent":["export { default } from './Link';\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA","ignoreList":[]}
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
SLink {
|
|
2
|
-
display: inline;
|
|
3
|
-
|
|
2
|
+
display: inline-block;
|
|
3
|
+
font-family: inherit;
|
|
4
4
|
color: var(--intergalactic-text-link, oklch(0.53 0.21 263));
|
|
5
|
+
line-height: normal;
|
|
5
6
|
position: relative;
|
|
6
7
|
cursor: pointer;
|
|
7
8
|
text-decoration: none;
|
|
9
|
+
border: none;
|
|
10
|
+
padding: 0;
|
|
11
|
+
margin: 0;
|
|
12
|
+
box-shadow: none;
|
|
8
13
|
-webkit-tap-highlight-color: transparent;
|
|
9
14
|
background: none;
|
|
10
15
|
transition: color 0.15s ease-in-out;
|
|
11
16
|
|
|
17
|
+
&:active,
|
|
18
|
+
&:hover {
|
|
19
|
+
text-decoration: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
12
22
|
&::-moz-focus-inner {
|
|
13
23
|
border: none;
|
|
14
24
|
padding: 0;
|
|
@@ -20,7 +30,7 @@ SLink {
|
|
|
20
30
|
color: var(--intergalactic-text-link-hover-active, oklch(0.51 0.202 263));
|
|
21
31
|
|
|
22
32
|
& SText {
|
|
23
|
-
|
|
33
|
+
border-color: currentColor;
|
|
24
34
|
}
|
|
25
35
|
}
|
|
26
36
|
|
|
@@ -37,7 +47,7 @@ SLink[visually-disabled] {
|
|
|
37
47
|
pointer-events: none;
|
|
38
48
|
}
|
|
39
49
|
|
|
40
|
-
SLink[
|
|
50
|
+
SLink[noWrapText] {
|
|
41
51
|
white-space: nowrap;
|
|
42
52
|
}
|
|
43
53
|
|
|
@@ -45,17 +55,13 @@ SLink[inline] {
|
|
|
45
55
|
display: inline;
|
|
46
56
|
}
|
|
47
57
|
|
|
48
|
-
SInner {
|
|
49
|
-
align-items: baseline;
|
|
50
|
-
height: 100%;
|
|
51
|
-
width: 100%;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
58
|
SAddon {
|
|
55
|
-
pointer-events: none;
|
|
56
|
-
vertical-align: middle;
|
|
57
59
|
display: inline-flex;
|
|
58
|
-
|
|
60
|
+
justify-content: center;
|
|
61
|
+
align-items: center;
|
|
62
|
+
margin-bottom: var(--intergalactic-spacing-05x, 2px);
|
|
63
|
+
vertical-align: middle;
|
|
64
|
+
pointer-events: none;
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
SLink SAddon {
|
|
@@ -69,13 +75,10 @@ SLink SAddon {
|
|
|
69
75
|
}
|
|
70
76
|
|
|
71
77
|
SText {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
text-underline-offset: 17%;
|
|
77
|
-
|
|
78
|
-
transition: text-decoration-color 0.15s ease-in-out;
|
|
78
|
+
border-bottom-width: 1px;
|
|
79
|
+
border-bottom-style: solid;
|
|
80
|
+
border-color: transparent;
|
|
81
|
+
transition: border-bottom-color 0.15s ease-in-out;
|
|
79
82
|
}
|
|
80
83
|
|
|
81
84
|
SLink[text-color] {
|
package/lib/es6/Link.js
CHANGED
|
@@ -5,32 +5,34 @@ 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";
|
|
8
9
|
import { assignProps as _assignProps3 } from "@semcore/core";
|
|
9
10
|
import { assignProps as _assignProps2 } from "@semcore/core";
|
|
10
11
|
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';
|
|
14
15
|
import resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';
|
|
15
16
|
import hasLabels from '@semcore/core/lib/utils/hasLabels';
|
|
16
17
|
import logger from '@semcore/core/lib/utils/logger';
|
|
18
|
+
import { Box } from '@semcore/flex-box';
|
|
19
|
+
import { Hint } from '@semcore/tooltip';
|
|
17
20
|
import { Text } from '@semcore/typography';
|
|
18
21
|
import React from 'react';
|
|
19
22
|
/*!__reshadow-styles__:"./style/link.shadow.css"*/
|
|
20
|
-
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".
|
|
23
|
+
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SLink_1xzws_gg_{display:inline-block;font-family:inherit;color:var(--intergalactic-text-link, rgb(35, 95, 226));line-height:normal;position:relative;cursor:pointer;border:0;padding:0;margin:0;box-shadow:none;-webkit-tap-highlight-color:transparent;background:0 0;transition:color .15s ease-in-out}.___SLink_1xzws_gg_,.___SLink_1xzws_gg_:active{-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SLink_1xzws_gg_:hover{-webkit-text-decoration:none;text-decoration:none}}.___SLink_1xzws_gg_::-moz-focus-inner{border:0;padding:0}.___SLink_1xzws_gg_.__active_1xzws_gg_,.___SLink_1xzws_gg_:active{color:var(--intergalactic-text-link-hover-active, rgb(33, 89, 215))}@media (hover:hover){.___SLink_1xzws_gg_:hover{color:var(--intergalactic-text-link-hover-active, rgb(33, 89, 215))}}.___SLink_1xzws_gg_.__active_1xzws_gg_ .___SText_1xzws_gg_,.___SLink_1xzws_gg_:active .___SText_1xzws_gg_{border-color:currentColor}@media (hover:hover){.___SLink_1xzws_gg_:hover .___SText_1xzws_gg_{border-color:currentColor}}.___SLink_1xzws_gg_.__enableVisited_1xzws_gg_:visited{color:var(--intergalactic-text-link-visited, rgb(128, 41, 236))}@media (hover:hover){.___SLink_1xzws_gg_.__enableVisited_1xzws_gg_:visited:hover{color:var(--intergalactic-text-link-visited, rgb(128, 41, 236))}}.___SLink_1xzws_gg_.__visually-disabled_1xzws_gg_{opacity:var(--intergalactic-disabled-opacity, 0.4);cursor:default;pointer-events:none}.___SLink_1xzws_gg_.__noWrapText_1xzws_gg_{white-space:nowrap}.___SLink_1xzws_gg_.__inline_1xzws_gg_{display:inline}.___SAddon_1xzws_gg_{display:inline-flex;justify-content:center;align-items:center;margin-bottom:var(--intergalactic-spacing-05x, 2px);vertical-align:middle;pointer-events:none}.___SLink_1xzws_gg_ .___SAddon_1xzws_gg_:not(:only-child):first-child{margin-right:var(--intergalactic-spacing-1x, 4px)}.___SLink_1xzws_gg_ .___SAddon_1xzws_gg_:not(:only-child):last-child{margin-left:var(--intergalactic-spacing-1x, 4px)}.___SText_1xzws_gg_{border-bottom-width:1px;border-bottom-style:solid;border-color:transparent;transition:border-bottom-color .15s ease-in-out}.___SLink_1xzws_gg_.__text-color_1xzws_gg_{color:var(--text-color_1xzws)}.___SLink_1xzws_gg_.__text-color_1xzws_gg_.__active_1xzws_gg_,.___SLink_1xzws_gg_.__text-color_1xzws_gg_:active{color:var(--text-color_1xzws);filter:brightness(.8)}@media (hover:hover){.___SLink_1xzws_gg_.__text-color_1xzws_gg_:hover{color:var(--text-color_1xzws);filter:brightness(.8)}}@media (prefers-reduced-motion){.___SLink_1xzws_gg_,.___SText_1xzws_gg_{transition:none}}", /*__inner_css_end__*/"1xzws_gg_"),
|
|
21
24
|
/*__reshadow_css_end__*/
|
|
22
25
|
{
|
|
23
|
-
"__SLink": "
|
|
24
|
-
"_visually-disabled": "__visually-
|
|
25
|
-
"
|
|
26
|
-
"_inline": "
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"--text-color": "--text-color_qyote"
|
|
26
|
+
"__SLink": "___SLink_1xzws_gg_",
|
|
27
|
+
"_visually-disabled": "__visually-disabled_1xzws_gg_",
|
|
28
|
+
"_noWrapText": "__noWrapText_1xzws_gg_",
|
|
29
|
+
"_inline": "__inline_1xzws_gg_",
|
|
30
|
+
"__SAddon": "___SAddon_1xzws_gg_",
|
|
31
|
+
"__SText": "___SText_1xzws_gg_",
|
|
32
|
+
"_active": "__active_1xzws_gg_",
|
|
33
|
+
"_enableVisited": "__enableVisited_1xzws_gg_",
|
|
34
|
+
"_text-color": "__text-color_1xzws_gg_",
|
|
35
|
+
"--text-color": "--text-color_1xzws"
|
|
34
36
|
});
|
|
35
37
|
var RootLink = /*#__PURE__*/function (_Component) {
|
|
36
38
|
function RootLink() {
|
|
@@ -64,26 +66,40 @@ var RootLink = /*#__PURE__*/function (_Component) {
|
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
}, {
|
|
67
|
-
key: "
|
|
68
|
-
value: function
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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);
|
|
72
90
|
}
|
|
73
91
|
}, {
|
|
74
92
|
key: "render",
|
|
75
93
|
value: function render() {
|
|
76
|
-
var
|
|
77
|
-
_ref4,
|
|
78
|
-
_ref7,
|
|
79
|
-
_ref8;
|
|
94
|
+
var _ref7, _ref10, _ref11;
|
|
80
95
|
var _this$asProps = this.asProps,
|
|
81
96
|
styles = _this$asProps.styles,
|
|
97
|
+
noWrap = _this$asProps.noWrap,
|
|
82
98
|
color = _this$asProps.color,
|
|
83
99
|
resolveColor = _this$asProps.resolveColor,
|
|
84
100
|
disabled = _this$asProps.disabled,
|
|
85
101
|
href = _this$asProps.href,
|
|
86
|
-
|
|
102
|
+
hasChildren = _this$asProps.children,
|
|
87
103
|
AddonLeft = _this$asProps.addonLeft,
|
|
88
104
|
AddonRight = _this$asProps.addonRight,
|
|
89
105
|
Children = _this$asProps.Children,
|
|
@@ -92,52 +108,64 @@ var RootLink = /*#__PURE__*/function (_Component) {
|
|
|
92
108
|
hintPlacement = _this$asProps.hintPlacement;
|
|
93
109
|
// @ts-ignore
|
|
94
110
|
var Link = this[CORE_INSTANCE];
|
|
95
|
-
var
|
|
96
|
-
var
|
|
97
|
-
var
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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
|
|
137
|
+
});
|
|
102
138
|
}
|
|
103
|
-
return
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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));
|
|
139
|
+
return this.renderLink({
|
|
140
|
+
linkProps: linkProps,
|
|
141
|
+
children: children
|
|
142
|
+
});
|
|
120
143
|
}
|
|
121
144
|
}]);
|
|
122
145
|
}(Component);
|
|
123
146
|
_defineProperty(RootLink, "displayName", 'Link');
|
|
147
|
+
_defineProperty(RootLink, "defaultProps", {
|
|
148
|
+
noWrap: true
|
|
149
|
+
});
|
|
124
150
|
_defineProperty(RootLink, "style", style);
|
|
125
|
-
_defineProperty(RootLink, "enhance", [resolveColorEnhance()]);
|
|
151
|
+
_defineProperty(RootLink, "enhance", [keyboardFocusEnhance(), resolveColorEnhance()]);
|
|
126
152
|
function LinkText(props) {
|
|
127
|
-
var
|
|
128
|
-
|
|
129
|
-
var SText =
|
|
153
|
+
var _ref3 = arguments[0],
|
|
154
|
+
_ref8;
|
|
155
|
+
var SText = Box;
|
|
130
156
|
var styles = props.styles;
|
|
131
|
-
return
|
|
157
|
+
return _ref8 = sstyled(styles), /*#__PURE__*/React.createElement(SText, _ref8.cn("SText", _objectSpread({}, _assignProps3({
|
|
158
|
+
"tag": 'span'
|
|
159
|
+
}, _ref3))));
|
|
132
160
|
}
|
|
133
161
|
function Addon(props) {
|
|
134
|
-
var
|
|
135
|
-
|
|
162
|
+
var _ref4 = arguments[0],
|
|
163
|
+
_ref9;
|
|
136
164
|
var SAddon = Box;
|
|
137
165
|
var styles = props.styles;
|
|
138
|
-
return
|
|
166
|
+
return _ref9 = sstyled(styles), /*#__PURE__*/React.createElement(SAddon, _ref9.cn("SAddon", _objectSpread({}, _assignProps4({
|
|
139
167
|
"tag": 'span'
|
|
140
|
-
},
|
|
168
|
+
}, _ref4))));
|
|
141
169
|
}
|
|
142
170
|
var Link = createComponent(RootLink, {
|
|
143
171
|
Text: LinkText,
|
package/lib/es6/Link.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,CAAAf,QAAA,EAAAC,UAAA;EAAA,OAAAe,YAAA,CAAAhB,QAAA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AAK,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":[]}
|
|
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;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AM,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":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import type { Intergalactic, UnknownProperties } from '@semcore/core';\nimport type { BoxProps } from '@semcore/flex-box';\nimport type { TextProps } from '@semcore/typography';\nimport type React from 'react';\n\n/** @deprecated */\nexport interface ILinkProps extends LinkProps, UnknownProperties {}\nexport type LinkProps = TextProps & {\n /**\n * CSS property of the display link (inline|inline-block)\n * @default false\n */\n inline?: boolean;\n /**\n * Sets the link to the disabled state\n */\n disabled?: boolean;\n /**\n * Sets the link to the active state\n */\n active?: boolean;\n /** This flag enables highlighting of the visited link\n */\n enableVisited?: boolean;\n /** The text will not be moved to a new line\n * @default true\n */\n noWrap?: boolean;\n /** Left addon tag */\n addonLeft?: React.ElementType;\n /** Right addon tag */\n addonRight?: React.ElementType;\n};\n\ndeclare const Link: Intergalactic.Component<'a', LinkProps> & {\n Text: Intergalactic.Component<'span', TextProps>;\n Addon: Intergalactic.Component<'span', BoxProps>;\n};\n\nexport default Link;\n"],"mappings":"","ignoreList":[]}
|
package/lib/es6/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default"],"sources":["../../src/index.
|
|
1
|
+
{"version":3,"file":"index.js","names":["default"],"sources":["../../src/index.js"],"sourcesContent":["export { default } from './Link';\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,QAAQ","ignoreList":[]}
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
SLink {
|
|
2
|
-
display: inline;
|
|
3
|
-
|
|
2
|
+
display: inline-block;
|
|
3
|
+
font-family: inherit;
|
|
4
4
|
color: var(--intergalactic-text-link, oklch(0.53 0.21 263));
|
|
5
|
+
line-height: normal;
|
|
5
6
|
position: relative;
|
|
6
7
|
cursor: pointer;
|
|
7
8
|
text-decoration: none;
|
|
9
|
+
border: none;
|
|
10
|
+
padding: 0;
|
|
11
|
+
margin: 0;
|
|
12
|
+
box-shadow: none;
|
|
8
13
|
-webkit-tap-highlight-color: transparent;
|
|
9
14
|
background: none;
|
|
10
15
|
transition: color 0.15s ease-in-out;
|
|
11
16
|
|
|
17
|
+
&:active,
|
|
18
|
+
&:hover {
|
|
19
|
+
text-decoration: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
12
22
|
&::-moz-focus-inner {
|
|
13
23
|
border: none;
|
|
14
24
|
padding: 0;
|
|
@@ -20,7 +30,7 @@ SLink {
|
|
|
20
30
|
color: var(--intergalactic-text-link-hover-active, oklch(0.51 0.202 263));
|
|
21
31
|
|
|
22
32
|
& SText {
|
|
23
|
-
|
|
33
|
+
border-color: currentColor;
|
|
24
34
|
}
|
|
25
35
|
}
|
|
26
36
|
|
|
@@ -37,7 +47,7 @@ SLink[visually-disabled] {
|
|
|
37
47
|
pointer-events: none;
|
|
38
48
|
}
|
|
39
49
|
|
|
40
|
-
SLink[
|
|
50
|
+
SLink[noWrapText] {
|
|
41
51
|
white-space: nowrap;
|
|
42
52
|
}
|
|
43
53
|
|
|
@@ -45,17 +55,13 @@ SLink[inline] {
|
|
|
45
55
|
display: inline;
|
|
46
56
|
}
|
|
47
57
|
|
|
48
|
-
SInner {
|
|
49
|
-
align-items: baseline;
|
|
50
|
-
height: 100%;
|
|
51
|
-
width: 100%;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
58
|
SAddon {
|
|
55
|
-
pointer-events: none;
|
|
56
|
-
vertical-align: middle;
|
|
57
59
|
display: inline-flex;
|
|
58
|
-
|
|
60
|
+
justify-content: center;
|
|
61
|
+
align-items: center;
|
|
62
|
+
margin-bottom: var(--intergalactic-spacing-05x, 2px);
|
|
63
|
+
vertical-align: middle;
|
|
64
|
+
pointer-events: none;
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
SLink SAddon {
|
|
@@ -69,13 +75,10 @@ SLink SAddon {
|
|
|
69
75
|
}
|
|
70
76
|
|
|
71
77
|
SText {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
text-underline-offset: 17%;
|
|
77
|
-
|
|
78
|
-
transition: text-decoration-color 0.15s ease-in-out;
|
|
78
|
+
border-bottom-width: 1px;
|
|
79
|
+
border-bottom-style: solid;
|
|
80
|
+
border-color: transparent;
|
|
81
|
+
transition: border-bottom-color 0.15s ease-in-out;
|
|
79
82
|
}
|
|
80
83
|
|
|
81
84
|
SLink[text-color] {
|
package/lib/esm/Link.mjs
CHANGED
|
@@ -4,12 +4,14 @@ 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 { sstyled,
|
|
8
|
-
import { Box, Hint } from "@semcore/base-components";
|
|
7
|
+
import { sstyled, createComponent, assignProps, CORE_INSTANCE, Component } from "@semcore/core";
|
|
9
8
|
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";
|
|
13
15
|
import { Text } from "@semcore/typography";
|
|
14
16
|
import React from "react";
|
|
15
17
|
/*!__reshadow-styles__:"./style/link.shadow.css"*/
|
|
@@ -17,22 +19,21 @@ var style = (
|
|
|
17
19
|
/*__reshadow_css_start__*/
|
|
18
20
|
(sstyled.insert(
|
|
19
21
|
/*__inner_css_start__*/
|
|
20
|
-
".
|
|
22
|
+
".___SLink_1xzws_gg_{display:inline-block;font-family:inherit;color:var(--intergalactic-text-link, rgb(35, 95, 226));line-height:normal;position:relative;cursor:pointer;border:0;padding:0;margin:0;box-shadow:none;-webkit-tap-highlight-color:transparent;background:0 0;transition:color .15s ease-in-out}.___SLink_1xzws_gg_,.___SLink_1xzws_gg_:active{-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SLink_1xzws_gg_:hover{-webkit-text-decoration:none;text-decoration:none}}.___SLink_1xzws_gg_::-moz-focus-inner{border:0;padding:0}.___SLink_1xzws_gg_.__active_1xzws_gg_,.___SLink_1xzws_gg_:active{color:var(--intergalactic-text-link-hover-active, rgb(33, 89, 215))}@media (hover:hover){.___SLink_1xzws_gg_:hover{color:var(--intergalactic-text-link-hover-active, rgb(33, 89, 215))}}.___SLink_1xzws_gg_.__active_1xzws_gg_ .___SText_1xzws_gg_,.___SLink_1xzws_gg_:active .___SText_1xzws_gg_{border-color:currentColor}@media (hover:hover){.___SLink_1xzws_gg_:hover .___SText_1xzws_gg_{border-color:currentColor}}.___SLink_1xzws_gg_.__enableVisited_1xzws_gg_:visited{color:var(--intergalactic-text-link-visited, rgb(128, 41, 236))}@media (hover:hover){.___SLink_1xzws_gg_.__enableVisited_1xzws_gg_:visited:hover{color:var(--intergalactic-text-link-visited, rgb(128, 41, 236))}}.___SLink_1xzws_gg_.__visually-disabled_1xzws_gg_{opacity:var(--intergalactic-disabled-opacity, 0.4);cursor:default;pointer-events:none}.___SLink_1xzws_gg_.__noWrapText_1xzws_gg_{white-space:nowrap}.___SLink_1xzws_gg_.__inline_1xzws_gg_{display:inline}.___SAddon_1xzws_gg_{display:inline-flex;justify-content:center;align-items:center;margin-bottom:var(--intergalactic-spacing-05x, 2px);vertical-align:middle;pointer-events:none}.___SLink_1xzws_gg_ .___SAddon_1xzws_gg_:not(:only-child):first-child{margin-right:var(--intergalactic-spacing-1x, 4px)}.___SLink_1xzws_gg_ .___SAddon_1xzws_gg_:not(:only-child):last-child{margin-left:var(--intergalactic-spacing-1x, 4px)}.___SText_1xzws_gg_{border-bottom-width:1px;border-bottom-style:solid;border-color:transparent;transition:border-bottom-color .15s ease-in-out}.___SLink_1xzws_gg_.__text-color_1xzws_gg_{color:var(--text-color_1xzws)}.___SLink_1xzws_gg_.__text-color_1xzws_gg_.__active_1xzws_gg_,.___SLink_1xzws_gg_.__text-color_1xzws_gg_:active{color:var(--text-color_1xzws);filter:brightness(.8)}@media (hover:hover){.___SLink_1xzws_gg_.__text-color_1xzws_gg_:hover{color:var(--text-color_1xzws);filter:brightness(.8)}}@media (prefers-reduced-motion){.___SLink_1xzws_gg_,.___SText_1xzws_gg_{transition:none}}",
|
|
21
23
|
/*__inner_css_end__*/
|
|
22
|
-
"
|
|
24
|
+
"1xzws_gg_"
|
|
23
25
|
), /*__reshadow_css_end__*/
|
|
24
26
|
{
|
|
25
|
-
"__SLink": "
|
|
26
|
-
"_visually-disabled": "__visually-
|
|
27
|
-
"
|
|
28
|
-
"_inline": "
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"--text-color": "--text-color_qyote"
|
|
27
|
+
"__SLink": "___SLink_1xzws_gg_",
|
|
28
|
+
"_visually-disabled": "__visually-disabled_1xzws_gg_",
|
|
29
|
+
"_noWrapText": "__noWrapText_1xzws_gg_",
|
|
30
|
+
"_inline": "__inline_1xzws_gg_",
|
|
31
|
+
"__SAddon": "___SAddon_1xzws_gg_",
|
|
32
|
+
"__SText": "___SText_1xzws_gg_",
|
|
33
|
+
"_active": "__active_1xzws_gg_",
|
|
34
|
+
"_enableVisited": "__enableVisited_1xzws_gg_",
|
|
35
|
+
"_text-color": "__text-color_1xzws_gg_",
|
|
36
|
+
"--text-color": "--text-color_1xzws"
|
|
36
37
|
})
|
|
37
38
|
);
|
|
38
39
|
var RootLink = /* @__PURE__ */ (function(_Component) {
|
|
@@ -67,62 +68,85 @@ var RootLink = /* @__PURE__ */ (function(_Component) {
|
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
70
|
}, {
|
|
70
|
-
key: "
|
|
71
|
-
value: function
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
key: "renderLink",
|
|
72
|
+
value: function renderLink(_ref0) {
|
|
73
|
+
var _ref = this.asProps, _ref5;
|
|
74
|
+
var linkProps = _ref0.linkProps, 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, _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);
|
|
75
87
|
}
|
|
76
88
|
}, {
|
|
77
89
|
key: "render",
|
|
78
90
|
value: function render() {
|
|
79
|
-
var
|
|
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,
|
|
91
|
+
var _ref7, _ref10, _ref11;
|
|
92
|
+
var _this$asProps = this.asProps, styles = _this$asProps.styles, noWrap = _this$asProps.noWrap, color = _this$asProps.color, resolveColor = _this$asProps.resolveColor, disabled = _this$asProps.disabled, href = _this$asProps.href, hasChildren = _this$asProps.children, AddonLeft = _this$asProps.addonLeft, AddonRight = _this$asProps.addonRight, Children = _this$asProps.Children, title = _this$asProps.title, ariaLabel = _this$asProps["aria-label"], hintPlacement = _this$asProps.hintPlacement;
|
|
81
93
|
var Link2 = this[CORE_INSTANCE];
|
|
82
|
-
var
|
|
83
|
-
var
|
|
84
|
-
var
|
|
85
|
-
|
|
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({
|
|
94
|
+
var children = (_ref7 = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, AddonLeft ? /* @__PURE__ */ React.createElement(Link2.Addon, null, /* @__PURE__ */ React.createElement(AddonLeft, _ref7.cn("AddonLeft", {}))) : null, addonTextChildren(Children, Link2.Text, Link2.Addon), AddonRight ? /* @__PURE__ */ React.createElement(Link2.Addon, null, /* @__PURE__ */ React.createElement(AddonRight, _ref7.cn("AddonRight", {}))) : null));
|
|
95
|
+
var hintContent = (_ref10 = (_ref11 = title !== null && title !== void 0 ? title : ariaLabel) !== null && _ref11 !== void 0 ? _ref11 : this.state.ariaLabelledByContent) !== null && _ref10 !== void 0 ? _ref10 : "";
|
|
96
|
+
var linkProps = {
|
|
97
|
+
"role": "link",
|
|
91
98
|
"tabIndex": disabled ? -1 : 0,
|
|
92
99
|
"use:href": disabled ? void 0 : href,
|
|
93
100
|
"visually-disabled": disabled,
|
|
101
|
+
"render": Text,
|
|
94
102
|
"text-color": resolveColor(color),
|
|
95
103
|
"tag": "a",
|
|
104
|
+
"noWrapText": noWrap,
|
|
105
|
+
"use:noWrap": false,
|
|
96
106
|
"ref": this.containerRef,
|
|
97
|
-
"__excludeProps":
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
"__excludeProps": ["disabled", "aria-disabled"]
|
|
108
|
+
};
|
|
109
|
+
var hintProps = {
|
|
110
|
+
title: hintContent,
|
|
111
|
+
timeout: [250, 50],
|
|
112
|
+
placement: hintPlacement,
|
|
113
|
+
__excludeProps: []
|
|
114
|
+
};
|
|
115
|
+
if (hasChildren === void 0 || title) {
|
|
116
|
+
return this.renderLinkWithHint({
|
|
117
|
+
linkProps,
|
|
118
|
+
hintProps,
|
|
119
|
+
children
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
return this.renderLink({
|
|
123
|
+
linkProps,
|
|
124
|
+
children
|
|
125
|
+
});
|
|
107
126
|
}
|
|
108
127
|
}]);
|
|
109
128
|
})(Component);
|
|
110
129
|
_defineProperty(RootLink, "displayName", "Link");
|
|
130
|
+
_defineProperty(RootLink, "defaultProps", {
|
|
131
|
+
noWrap: true
|
|
132
|
+
});
|
|
111
133
|
_defineProperty(RootLink, "style", style);
|
|
112
|
-
_defineProperty(RootLink, "enhance", [resolveColorEnhance()]);
|
|
134
|
+
_defineProperty(RootLink, "enhance", [keyboardFocusEnhance(), resolveColorEnhance()]);
|
|
113
135
|
function LinkText(props) {
|
|
114
|
-
var
|
|
115
|
-
var SText =
|
|
136
|
+
var _ref3 = arguments[0], _ref8;
|
|
137
|
+
var SText = Box;
|
|
116
138
|
var styles = props.styles;
|
|
117
|
-
return
|
|
139
|
+
return _ref8 = sstyled(styles), /* @__PURE__ */ React.createElement(SText, _ref8.cn("SText", _objectSpread({}, assignProps({
|
|
140
|
+
"tag": "span"
|
|
141
|
+
}, _ref3))));
|
|
118
142
|
}
|
|
119
143
|
function Addon(props) {
|
|
120
|
-
var
|
|
144
|
+
var _ref4 = arguments[0], _ref9;
|
|
121
145
|
var SAddon = Box;
|
|
122
146
|
var styles = props.styles;
|
|
123
|
-
return
|
|
147
|
+
return _ref9 = sstyled(styles), /* @__PURE__ */ React.createElement(SAddon, _ref9.cn("SAddon", _objectSpread({}, assignProps({
|
|
124
148
|
"tag": "span"
|
|
125
|
-
},
|
|
149
|
+
}, _ref4))));
|
|
126
150
|
}
|
|
127
151
|
var Link = createComponent(RootLink, {
|
|
128
152
|
Text: LinkText,
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
SLink {
|
|
2
|
-
display: inline;
|
|
3
|
-
|
|
2
|
+
display: inline-block;
|
|
3
|
+
font-family: inherit;
|
|
4
4
|
color: var(--intergalactic-text-link, oklch(0.53 0.21 263));
|
|
5
|
+
line-height: normal;
|
|
5
6
|
position: relative;
|
|
6
7
|
cursor: pointer;
|
|
7
8
|
text-decoration: none;
|
|
9
|
+
border: none;
|
|
10
|
+
padding: 0;
|
|
11
|
+
margin: 0;
|
|
12
|
+
box-shadow: none;
|
|
8
13
|
-webkit-tap-highlight-color: transparent;
|
|
9
14
|
background: none;
|
|
10
15
|
transition: color 0.15s ease-in-out;
|
|
11
16
|
|
|
17
|
+
&:active,
|
|
18
|
+
&:hover {
|
|
19
|
+
text-decoration: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
12
22
|
&::-moz-focus-inner {
|
|
13
23
|
border: none;
|
|
14
24
|
padding: 0;
|
|
@@ -20,7 +30,7 @@ SLink {
|
|
|
20
30
|
color: var(--intergalactic-text-link-hover-active, oklch(0.51 0.202 263));
|
|
21
31
|
|
|
22
32
|
& SText {
|
|
23
|
-
|
|
33
|
+
border-color: currentColor;
|
|
24
34
|
}
|
|
25
35
|
}
|
|
26
36
|
|
|
@@ -37,7 +47,7 @@ SLink[visually-disabled] {
|
|
|
37
47
|
pointer-events: none;
|
|
38
48
|
}
|
|
39
49
|
|
|
40
|
-
SLink[
|
|
50
|
+
SLink[noWrapText] {
|
|
41
51
|
white-space: nowrap;
|
|
42
52
|
}
|
|
43
53
|
|
|
@@ -45,17 +55,13 @@ SLink[inline] {
|
|
|
45
55
|
display: inline;
|
|
46
56
|
}
|
|
47
57
|
|
|
48
|
-
SInner {
|
|
49
|
-
align-items: baseline;
|
|
50
|
-
height: 100%;
|
|
51
|
-
width: 100%;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
58
|
SAddon {
|
|
55
|
-
pointer-events: none;
|
|
56
|
-
vertical-align: middle;
|
|
57
59
|
display: inline-flex;
|
|
58
|
-
|
|
60
|
+
justify-content: center;
|
|
61
|
+
align-items: center;
|
|
62
|
+
margin-bottom: var(--intergalactic-spacing-05x, 2px);
|
|
63
|
+
vertical-align: middle;
|
|
64
|
+
pointer-events: none;
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
SLink SAddon {
|
|
@@ -69,13 +75,10 @@ SLink SAddon {
|
|
|
69
75
|
}
|
|
70
76
|
|
|
71
77
|
SText {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
text-underline-offset: 17%;
|
|
77
|
-
|
|
78
|
-
transition: text-decoration-color 0.15s ease-in-out;
|
|
78
|
+
border-bottom-width: 1px;
|
|
79
|
+
border-bottom-style: solid;
|
|
80
|
+
border-color: transparent;
|
|
81
|
+
transition: border-bottom-color 0.15s ease-in-out;
|
|
79
82
|
}
|
|
80
83
|
|
|
81
84
|
SLink[text-color] {
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { Intergalactic, UnknownProperties } from '@semcore/core';
|
|
2
|
+
import type { BoxProps } from '@semcore/flex-box';
|
|
3
|
+
import type { TextProps } from '@semcore/typography';
|
|
4
|
+
import type React from 'react';
|
|
5
|
+
|
|
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;
|
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.
|
|
4
|
+
"version": "16.1.1",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/flex-box": "16.1.
|
|
18
|
-
"@semcore/tooltip": "16.1.
|
|
19
|
-
"@semcore/typography": "16.4.
|
|
17
|
+
"@semcore/flex-box": "16.1.1",
|
|
18
|
+
"@semcore/tooltip": "16.1.1",
|
|
19
|
+
"@semcore/typography": "16.4.1"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"@semcore/base-components": "^16.6.0"
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"directory": "semcore/link"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@semcore/testing-utils": "1.0.0",
|
|
31
30
|
"@semcore/core": "16.6.0",
|
|
32
|
-
"@semcore/
|
|
31
|
+
"@semcore/testing-utils": "1.0.0",
|
|
32
|
+
"@semcore/icon": "16.8.1"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "pnpm semcore-builder --source=js && pnpm vite build"
|
package/lib/cjs/Link.types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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/Link.types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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/types/Link.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
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;
|
|
@@ -1,35 +0,0 @@
|
|
|
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
|
-
};
|