@semcore/link 5.44.2-prerelease.5 → 5.44.3-prerelease.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/lib/cjs/Link.js +15 -13
- package/lib/cjs/Link.js.map +1 -1
- package/lib/es6/Link.js +15 -13
- package/lib/es6/Link.js.map +1 -1
- package/lib/esm/Link.mjs +135 -110
- package/lib/esm/index.mjs +2 -2
- package/lib/esm/style/link.shadow.css +112 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
+
## [5.44.3] - 2025-05-09
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Version patch update due to children dependencies update (`@semcore/utils` [4.48.2 ~> 4.48.4], `@semcore/flex-box` [5.41.2 ~> 5.41.3], `@semcore/core` [2.39.2 ~> 2.39.3]).
|
|
10
|
+
|
|
5
11
|
## [5.44.2] - 2025-04-04
|
|
6
12
|
|
|
7
13
|
### Changed
|
package/lib/cjs/Link.js
CHANGED
|
@@ -24,19 +24,21 @@ var _addonTextChildren = _interopRequireDefault(require("@semcore/utils/lib/addo
|
|
|
24
24
|
var _logger = _interopRequireDefault(require("@semcore/utils/lib/logger"));
|
|
25
25
|
var _hasLabels = _interopRequireDefault(require("@semcore/utils/lib/hasLabels"));
|
|
26
26
|
var _resolveColorEnhance = _interopRequireDefault(require("@semcore/utils/lib/enhances/resolveColorEnhance"));
|
|
27
|
-
|
|
28
|
-
var style = ( /*__reshadow_css_start__*/_index.sstyled.insert( /*__inner_css_start__*/".
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
27
|
+
/*!__reshadow-styles__:"./style/link.shadow.css"*/
|
|
28
|
+
var style = ( /*__reshadow_css_start__*/_index.sstyled.insert( /*__inner_css_start__*/".___SLink_7ovi8_gg_{display:inline-block;font-family:inherit;color:var(--intergalactic-text-link, #006dca);line-height:normal;position:relative;cursor:pointer;-webkit-text-decoration:none;text-decoration:none;border:0;padding:0;margin:0;box-shadow:none;-webkit-tap-highlight-color:transparent;outline:0;background:0 0;transition:color .15s ease-in-out}.___SLink_7ovi8_gg_:active,.___SLink_7ovi8_gg_:focus{outline:0;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SLink_7ovi8_gg_:hover{outline:0;-webkit-text-decoration:none;text-decoration:none}}.___SLink_7ovi8_gg_::-moz-focus-inner{border:0;padding:0}.___SLink_7ovi8_gg_.__active_7ovi8_gg_,.___SLink_7ovi8_gg_:active{color:var(--intergalactic-text-link-hover-active, #044792)}@media (hover:hover){.___SLink_7ovi8_gg_:hover{color:var(--intergalactic-text-link-hover-active, #044792)}}.___SLink_7ovi8_gg_.__active_7ovi8_gg_ .___SText_7ovi8_gg_,.___SLink_7ovi8_gg_:active .___SText_7ovi8_gg_{border-color:currentColor}@media (hover:hover){.___SLink_7ovi8_gg_:hover .___SText_7ovi8_gg_{border-color:currentColor}}.___SLink_7ovi8_gg_.__enableVisited_7ovi8_gg_:visited{color:var(--intergalactic-text-link-visited, #8649e1)}@media (hover:hover){.___SLink_7ovi8_gg_.__enableVisited_7ovi8_gg_:visited:hover{color:var(--intergalactic-text-link-visited, #8649e1)}}.___SLink_7ovi8_gg_.__keyboardFocused_7ovi8_gg_{outline-color:var(--intergalactic-keyboard-focus-outline, rgba(0, 143, 248, 0.5));outline-style:solid;outline-width:3px}.___SLink_7ovi8_gg_.__visually-disabled_7ovi8_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SLink_7ovi8_gg_.__noWrapText_7ovi8_gg_{white-space:nowrap}.___SLink_7ovi8_gg_.__inline_7ovi8_gg_{display:inline}.___SAddon_7ovi8_gg_{display:inline-flex;justify-content:center;align-items:center;margin-bottom:var(--intergalactic-spacing-05x, 2px);vertical-align:middle;pointer-events:none}.___SLink_7ovi8_gg_ .___SAddon_7ovi8_gg_:not(:only-child):first-child{margin-right:var(--intergalactic-spacing-1x, 4px)}.___SLink_7ovi8_gg_ .___SAddon_7ovi8_gg_:not(:only-child):last-child{margin-left:var(--intergalactic-spacing-1x, 4px)}.___SText_7ovi8_gg_{border-bottom-width:1px;border-bottom-style:solid;border-color:transparent;transition:border-bottom-color .15s ease-in-out}.___SLink_7ovi8_gg_.__text-color_7ovi8_gg_{color:var(--text-color_7ovi8)}.___SLink_7ovi8_gg_.__text-color_7ovi8_gg_.__active_7ovi8_gg_,.___SLink_7ovi8_gg_.__text-color_7ovi8_gg_:active{color:var(--text-color_7ovi8);filter:brightness(.8)}@media (hover:hover){.___SLink_7ovi8_gg_.__text-color_7ovi8_gg_:hover{color:var(--text-color_7ovi8);filter:brightness(.8)}}@media (prefers-reduced-motion){.___SLink_7ovi8_gg_,.___SText_7ovi8_gg_{transition:none}}", /*__inner_css_end__*/"7ovi8_gg_"),
|
|
29
|
+
/*__reshadow_css_end__*/
|
|
30
|
+
{
|
|
31
|
+
"__SLink": "___SLink_7ovi8_gg_",
|
|
32
|
+
"_keyboardFocused": "__keyboardFocused_7ovi8_gg_",
|
|
33
|
+
"_visually-disabled": "__visually-disabled_7ovi8_gg_",
|
|
34
|
+
"_noWrapText": "__noWrapText_7ovi8_gg_",
|
|
35
|
+
"_inline": "__inline_7ovi8_gg_",
|
|
36
|
+
"__SAddon": "___SAddon_7ovi8_gg_",
|
|
37
|
+
"__SText": "___SText_7ovi8_gg_",
|
|
38
|
+
"_active": "__active_7ovi8_gg_",
|
|
39
|
+
"_enableVisited": "__enableVisited_7ovi8_gg_",
|
|
40
|
+
"_text-color": "__text-color_7ovi8_gg_",
|
|
41
|
+
"--text-color": "--text-color_7ovi8"
|
|
40
42
|
});
|
|
41
43
|
var RootLink = /*#__PURE__*/function (_Component) {
|
|
42
44
|
(0, _inherits2["default"])(RootLink, _Component);
|
package/lib/cjs/Link.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.js","names":["_core","_interopRequireWildcard","require","_react","_interopRequireDefault","_typography","_flexBox","_tooltip","_keyboardFocusEnhance","_addonTextChildren","_logger","_hasLabels","_resolveColorEnhance","style","_index","sstyled","insert","RootLink","_Component","_inherits2","_super","_createSuper2","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty2","_assertThisInitialized2","React","createRef","ariaLabelledByContent","visibleHint","setState","_createClass2","key","value","componentDidMount","_this2","process","env","NODE_ENV","logger","warn","containerRef","current","hasLabels","asProps","displayName","setTimeout","_document$getElementB","_document$getElementB2","document","getElementById","textContent","renderChildren","_ref4","_this$asProps","Children","styles","AddonLeft","addonLeft","AddonRight","addonRight","createElement","Fragment","Link","Addon","tag","addonTextChildren","Text","renderOnlyAddons","_ref5","_ref9","_ref10","_this$asProps2","title","ariaLabel","keyboardFocused","state","hintContent","Hint","timeout","visible","cn","render","_ref","_ref6","SLink","_this$asProps3","noWrap","color","resolveColor","disabled","href","hasChildren","children","_objectSpread2","assignProps","undefined","handleMouseEnterOnlyAddon","handleMouseLeaveOnlyAddon","Component","keyboardFocusEnhance","resolveColorEnhance","LinkText","props","_ref2","arguments[0]","_ref7","SText","Box","_ref3","_ref8","SAddon","createComponent","_default","exports"],"sources":["../../src/Link.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, Root, sstyled } from '@semcore/core';\nimport { Text } from '@semcore/typography';\nimport { Box } from '@semcore/flex-box';\nimport { Hint } from '@semcore/tooltip';\nimport keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\nimport addonTextChildren from '@semcore/utils/lib/addonTextChildren';\nimport logger from '@semcore/utils/lib/logger';\nimport hasLabels from '@semcore/utils/lib/hasLabels';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\n\nimport style from './style/link.shadow.css';\n\nclass RootLink extends Component {\n static displayName = 'Link';\n static defaultProps = {\n noWrap: true,\n };\n static style = style;\n static enhance = [keyboardFocusEnhance(), resolveColorEnhance()];\n containerRef = React.createRef();\n\n state = {\n ariaLabelledByContent: '',\n visibleHint: false,\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 handleMouseEnterOnlyAddon = () => {\n this.setState({ visibleHint: true });\n };\n handleMouseLeaveOnlyAddon = () => {\n this.setState({ visibleHint: false });\n };\n\n renderChildren() {\n const { Children, styles, addonLeft: AddonLeft, addonRight: AddonRight } = this.asProps;\n\n return sstyled(styles)(\n <>\n {AddonLeft ? <Link.Addon tag={AddonLeft} /> : null}\n {addonTextChildren(Children, Link.Text, Link.Addon)}\n {AddonRight ? <Link.Addon tag={AddonRight} /> : null}\n </>,\n );\n }\n\n renderOnlyAddons() {\n const {\n styles,\n addonLeft: AddonLeft,\n addonRight: AddonRight,\n title,\n ['aria-label']: ariaLabel,\n keyboardFocused,\n } = this.asProps;\n const { visibleHint } = this.state;\n\n const hintContent = title ?? ariaLabel ?? this.state.ariaLabelledByContent ?? '';\n\n return sstyled(styles)(\n <Link.Addon\n tag={Hint}\n title={hintContent}\n timeout={[250, 50]}\n visible={keyboardFocused || visibleHint}\n >\n {AddonLeft && <AddonLeft />}\n {AddonRight && <AddonRight />}\n </Link.Addon>,\n );\n }\n\n render() {\n const SLink = Root;\n const {\n styles,\n noWrap,\n color,\n resolveColor,\n disabled,\n href,\n children: hasChildren,\n } = this.asProps;\n\n return sstyled(styles)(\n <SLink\n role='link'\n tabIndex={disabled ? -1 : 0}\n use:href={disabled ? undefined : href}\n visually-disabled={disabled}\n render={Text}\n text-color={resolveColor(color)}\n tag='a'\n noWrapText={noWrap}\n use:noWrap={false}\n ref={this.containerRef}\n __excludeProps={['disabled', 'aria-disabled']}\n onMouseEnter={this.handleMouseEnterOnlyAddon}\n onMouseLeave={this.handleMouseLeaveOnlyAddon}\n >\n {hasChildren !== undefined ? this.renderChildren() : this.renderOnlyAddons()}\n </SLink>,\n );\n }\n}\n\nfunction LinkText(props) {\n const SText = Root;\n const { styles } = props;\n return sstyled(styles)(<SText render={Box} tag='span' />);\n}\n\nfunction Addon(props) {\n const SAddon = Root;\n const { styles } = props;\n return sstyled(styles)(<SAddon render={Box} tag='span' />);\n}\n\nconst Link = createComponent(RootLink, {\n Text: LinkText,\n Addon,\n});\n\nexport default Link;\n"],"mappings":";;;;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AADA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,qBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,kBAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,OAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,UAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,oBAAA,GAAAR,sBAAA,CAAAF,OAAA;AAAkF;AAAA,IAAAW,KAAA,+BAAAC,MAAA,CAAAC,OAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,IAI5EC,QAAQ,0BAAAC,UAAA;EAA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A,aAJGhB,QAAQ,WAKGJ,KAAK;AAAA,IAAAoB,gBAAA,aALhBhB,QAAQ,aAMK,CAAC,IAAA4F,gCAAoB,GAAE,EAAE,IAAAC,+BAAmB,GAAE,CAAC;AA0GlE,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,IAAApG,aAAO,EAACkD,MAAM,CAAC,eAAC9D,MAAA,YAAAmE,aAAA,CAAC8C,KAAK,EAAAD,KAAA,CAAAzB,EAAA,cAAAa,cAAA,qBAAAvG,KAAA,CAAAwG,WAAA;IAAA,OAAkB;EAAM,GAAAS,KAAA,IAAG;AAC1D;AAEA,SAASxC,KAAKA,CAACuC,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,IAAAxG,aAAO,EAACkD,MAAM,CAAC,eAAC9D,MAAA,YAAAmE,aAAA,CAACkD,MAAM,EAAAD,KAAA,CAAA7B,EAAA,eAAAa,cAAA,qBAAAvG,KAAA,CAAAwG,WAAA;IAAA,OAAkB;EAAM,GAAAc,KAAA,IAAG;AAC3D;AAEA,IAAM9C,IAAI,GAAG,IAAAiD,gBAAe,EAACxG,QAAQ,EAAE;EACrC2D,IAAI,EAAEmC,QAAQ;EACdtC,KAAK,EAALA;AACF,CAAC,CAAC;AAAC,IAAAiD,QAAA,GAEYlD,IAAI;AAAAmD,OAAA,cAAAD,QAAA"}
|
|
1
|
+
{"version":3,"file":"Link.js","names":["_core","_interopRequireWildcard","require","_react","_interopRequireDefault","_typography","_flexBox","_tooltip","_keyboardFocusEnhance","_addonTextChildren","_logger","_hasLabels","_resolveColorEnhance","style","_index","sstyled","insert","RootLink","_Component","_inherits2","_super","_createSuper2","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty2","_assertThisInitialized2","React","createRef","ariaLabelledByContent","visibleHint","setState","_createClass2","key","value","componentDidMount","_this2","process","env","NODE_ENV","logger","warn","containerRef","current","hasLabels","asProps","displayName","setTimeout","_document$getElementB","_document$getElementB2","document","getElementById","textContent","renderChildren","_ref4","_this$asProps","Children","styles","AddonLeft","addonLeft","AddonRight","addonRight","createElement","Fragment","Link","Addon","tag","addonTextChildren","Text","renderOnlyAddons","_ref5","_ref9","_ref10","_this$asProps2","title","ariaLabel","keyboardFocused","state","hintContent","Hint","timeout","visible","cn","render","_ref","_ref6","SLink","_this$asProps3","noWrap","color","resolveColor","disabled","href","hasChildren","children","_objectSpread2","assignProps","undefined","handleMouseEnterOnlyAddon","handleMouseLeaveOnlyAddon","Component","keyboardFocusEnhance","resolveColorEnhance","LinkText","props","_ref2","arguments[0]","_ref7","SText","Box","_ref3","_ref8","SAddon","createComponent","_default","exports"],"sources":["../../src/Link.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, Root, sstyled } from '@semcore/core';\nimport { Text } from '@semcore/typography';\nimport { Box } from '@semcore/flex-box';\nimport { Hint } from '@semcore/tooltip';\nimport keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\nimport addonTextChildren from '@semcore/utils/lib/addonTextChildren';\nimport logger from '@semcore/utils/lib/logger';\nimport hasLabels from '@semcore/utils/lib/hasLabels';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\n\nimport style from './style/link.shadow.css';\n\nclass RootLink extends Component {\n static displayName = 'Link';\n static defaultProps = {\n noWrap: true,\n };\n static style = style;\n static enhance = [keyboardFocusEnhance(), resolveColorEnhance()];\n containerRef = React.createRef();\n\n state = {\n ariaLabelledByContent: '',\n visibleHint: false,\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 handleMouseEnterOnlyAddon = () => {\n this.setState({ visibleHint: true });\n };\n handleMouseLeaveOnlyAddon = () => {\n this.setState({ visibleHint: false });\n };\n\n renderChildren() {\n const { Children, styles, addonLeft: AddonLeft, addonRight: AddonRight } = this.asProps;\n\n return sstyled(styles)(\n <>\n {AddonLeft ? <Link.Addon tag={AddonLeft} /> : null}\n {addonTextChildren(Children, Link.Text, Link.Addon)}\n {AddonRight ? <Link.Addon tag={AddonRight} /> : null}\n </>,\n );\n }\n\n renderOnlyAddons() {\n const {\n styles,\n addonLeft: AddonLeft,\n addonRight: AddonRight,\n title,\n ['aria-label']: ariaLabel,\n keyboardFocused,\n } = this.asProps;\n const { visibleHint } = this.state;\n\n const hintContent = title ?? ariaLabel ?? this.state.ariaLabelledByContent ?? '';\n\n return sstyled(styles)(\n <Link.Addon\n tag={Hint}\n title={hintContent}\n timeout={[250, 50]}\n visible={keyboardFocused || visibleHint}\n >\n {AddonLeft && <AddonLeft />}\n {AddonRight && <AddonRight />}\n </Link.Addon>,\n );\n }\n\n render() {\n const SLink = Root;\n const {\n styles,\n noWrap,\n color,\n resolveColor,\n disabled,\n href,\n children: hasChildren,\n } = this.asProps;\n\n return sstyled(styles)(\n <SLink\n role='link'\n tabIndex={disabled ? -1 : 0}\n use:href={disabled ? undefined : href}\n visually-disabled={disabled}\n render={Text}\n text-color={resolveColor(color)}\n tag='a'\n noWrapText={noWrap}\n use:noWrap={false}\n ref={this.containerRef}\n __excludeProps={['disabled', 'aria-disabled']}\n onMouseEnter={this.handleMouseEnterOnlyAddon}\n onMouseLeave={this.handleMouseLeaveOnlyAddon}\n >\n {hasChildren !== undefined ? this.renderChildren() : this.renderOnlyAddons()}\n </SLink>,\n );\n }\n}\n\nfunction LinkText(props) {\n const SText = Root;\n const { styles } = props;\n return sstyled(styles)(<SText render={Box} tag='span' />);\n}\n\nfunction Addon(props) {\n const SAddon = Root;\n const { styles } = props;\n return sstyled(styles)(<SAddon render={Box} tag='span' />);\n}\n\nconst Link = createComponent(RootLink, {\n Text: LinkText,\n Addon,\n});\n\nexport default Link;\n"],"mappings":";;;;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AADA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,qBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,kBAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,OAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,UAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,oBAAA,GAAAR,sBAAA,CAAAF,OAAA;AAAkF;AAAA,IAAAW,KAAA,+BAAAC,MAAA,CAAAC,OAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,IAI5EC,QAAQ,0BAAAC,UAAA;EAAA,IAAAC,UAAA,aAAAF,QAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,OAAAC,aAAA,aAAAJ,QAAA;EAAA,SAAAA,SAAA;IAAA,IAAAK,KAAA;IAAA,IAAAC,gBAAA,mBAAAN,QAAA;IAAA,SAAAO,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IA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MAAM,GAAK+C,KAAK,CAAhB/C,MAAM;EACd,OAAAkD,KAAA,GAAO,IAAApG,aAAO,EAACkD,MAAM,CAAC,eAAC9D,MAAA,YAAAmE,aAAA,CAAC8C,KAAK,EAAAD,KAAA,CAAAzB,EAAA,cAAAa,cAAA,qBAAAvG,KAAA,CAAAwG,WAAA;IAAA,OAAkB;EAAM,GAAAS,KAAA,IAAG;AAC1D;AAEA,SAASxC,KAAKA,CAACuC,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,IAAAxG,aAAO,EAACkD,MAAM,CAAC,eAAC9D,MAAA,YAAAmE,aAAA,CAACkD,MAAM,EAAAD,KAAA,CAAA7B,EAAA,eAAAa,cAAA,qBAAAvG,KAAA,CAAAwG,WAAA;IAAA,OAAkB;EAAM,GAAAc,KAAA,IAAG;AAC3D;AAEA,IAAM9C,IAAI,GAAG,IAAAiD,gBAAe,EAACxG,QAAQ,EAAE;EACrC2D,IAAI,EAAEmC,QAAQ;EACdtC,KAAK,EAALA;AACF,CAAC,CAAC;AAAC,IAAAiD,QAAA,GAEYlD,IAAI;AAAAmD,OAAA,cAAAD,QAAA"}
|
package/lib/es6/Link.js
CHANGED
|
@@ -19,19 +19,21 @@ import addonTextChildren from '@semcore/utils/lib/addonTextChildren';
|
|
|
19
19
|
import logger from '@semcore/utils/lib/logger';
|
|
20
20
|
import hasLabels from '@semcore/utils/lib/hasLabels';
|
|
21
21
|
import resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';
|
|
22
|
-
|
|
23
|
-
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
22
|
+
/*!__reshadow-styles__:"./style/link.shadow.css"*/
|
|
23
|
+
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SLink_7ovi8_gg_{display:inline-block;font-family:inherit;color:var(--intergalactic-text-link, #006dca);line-height:normal;position:relative;cursor:pointer;-webkit-text-decoration:none;text-decoration:none;border:0;padding:0;margin:0;box-shadow:none;-webkit-tap-highlight-color:transparent;outline:0;background:0 0;transition:color .15s ease-in-out}.___SLink_7ovi8_gg_:active,.___SLink_7ovi8_gg_:focus{outline:0;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SLink_7ovi8_gg_:hover{outline:0;-webkit-text-decoration:none;text-decoration:none}}.___SLink_7ovi8_gg_::-moz-focus-inner{border:0;padding:0}.___SLink_7ovi8_gg_.__active_7ovi8_gg_,.___SLink_7ovi8_gg_:active{color:var(--intergalactic-text-link-hover-active, #044792)}@media (hover:hover){.___SLink_7ovi8_gg_:hover{color:var(--intergalactic-text-link-hover-active, #044792)}}.___SLink_7ovi8_gg_.__active_7ovi8_gg_ .___SText_7ovi8_gg_,.___SLink_7ovi8_gg_:active .___SText_7ovi8_gg_{border-color:currentColor}@media (hover:hover){.___SLink_7ovi8_gg_:hover .___SText_7ovi8_gg_{border-color:currentColor}}.___SLink_7ovi8_gg_.__enableVisited_7ovi8_gg_:visited{color:var(--intergalactic-text-link-visited, #8649e1)}@media (hover:hover){.___SLink_7ovi8_gg_.__enableVisited_7ovi8_gg_:visited:hover{color:var(--intergalactic-text-link-visited, #8649e1)}}.___SLink_7ovi8_gg_.__keyboardFocused_7ovi8_gg_{outline-color:var(--intergalactic-keyboard-focus-outline, rgba(0, 143, 248, 0.5));outline-style:solid;outline-width:3px}.___SLink_7ovi8_gg_.__visually-disabled_7ovi8_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SLink_7ovi8_gg_.__noWrapText_7ovi8_gg_{white-space:nowrap}.___SLink_7ovi8_gg_.__inline_7ovi8_gg_{display:inline}.___SAddon_7ovi8_gg_{display:inline-flex;justify-content:center;align-items:center;margin-bottom:var(--intergalactic-spacing-05x, 2px);vertical-align:middle;pointer-events:none}.___SLink_7ovi8_gg_ .___SAddon_7ovi8_gg_:not(:only-child):first-child{margin-right:var(--intergalactic-spacing-1x, 4px)}.___SLink_7ovi8_gg_ .___SAddon_7ovi8_gg_:not(:only-child):last-child{margin-left:var(--intergalactic-spacing-1x, 4px)}.___SText_7ovi8_gg_{border-bottom-width:1px;border-bottom-style:solid;border-color:transparent;transition:border-bottom-color .15s ease-in-out}.___SLink_7ovi8_gg_.__text-color_7ovi8_gg_{color:var(--text-color_7ovi8)}.___SLink_7ovi8_gg_.__text-color_7ovi8_gg_.__active_7ovi8_gg_,.___SLink_7ovi8_gg_.__text-color_7ovi8_gg_:active{color:var(--text-color_7ovi8);filter:brightness(.8)}@media (hover:hover){.___SLink_7ovi8_gg_.__text-color_7ovi8_gg_:hover{color:var(--text-color_7ovi8);filter:brightness(.8)}}@media (prefers-reduced-motion){.___SLink_7ovi8_gg_,.___SText_7ovi8_gg_{transition:none}}", /*__inner_css_end__*/"7ovi8_gg_"),
|
|
24
|
+
/*__reshadow_css_end__*/
|
|
25
|
+
{
|
|
26
|
+
"__SLink": "___SLink_7ovi8_gg_",
|
|
27
|
+
"_keyboardFocused": "__keyboardFocused_7ovi8_gg_",
|
|
28
|
+
"_visually-disabled": "__visually-disabled_7ovi8_gg_",
|
|
29
|
+
"_noWrapText": "__noWrapText_7ovi8_gg_",
|
|
30
|
+
"_inline": "__inline_7ovi8_gg_",
|
|
31
|
+
"__SAddon": "___SAddon_7ovi8_gg_",
|
|
32
|
+
"__SText": "___SText_7ovi8_gg_",
|
|
33
|
+
"_active": "__active_7ovi8_gg_",
|
|
34
|
+
"_enableVisited": "__enableVisited_7ovi8_gg_",
|
|
35
|
+
"_text-color": "__text-color_7ovi8_gg_",
|
|
36
|
+
"--text-color": "--text-color_7ovi8"
|
|
35
37
|
});
|
|
36
38
|
var RootLink = /*#__PURE__*/function (_Component) {
|
|
37
39
|
_inherits(RootLink, _Component);
|
package/lib/es6/Link.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.js","names":["React","createComponent","Component","Root","sstyled","Text","Box","Hint","keyboardFocusEnhance","addonTextChildren","logger","hasLabels","resolveColorEnhance","style","_sstyled","insert","RootLink","_Component","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","createRef","ariaLabelledByContent","visibleHint","setState","_createClass","key","value","componentDidMount","_this2","process","env","NODE_ENV","warn","containerRef","current","asProps","displayName","setTimeout","_document$getElementB","_document$getElementB2","document","getElementById","textContent","renderChildren","_ref4","_this$asProps","Children","styles","AddonLeft","addonLeft","AddonRight","addonRight","createElement","Fragment","Link","Addon","tag","renderOnlyAddons","_ref5","_ref9","_ref10","_this$asProps2","title","ariaLabel","keyboardFocused","state","hintContent","timeout","visible","cn","render","_ref","_ref6","SLink","_this$asProps3","noWrap","color","resolveColor","disabled","href","hasChildren","children","_objectSpread","_assignProps","undefined","handleMouseEnterOnlyAddon","handleMouseLeaveOnlyAddon","LinkText","props","_ref2","arguments[0]","_ref7","SText","_assignProps2","_ref3","_ref8","SAddon","_assignProps3"],"sources":["../../src/Link.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, Root, sstyled } from '@semcore/core';\nimport { Text } from '@semcore/typography';\nimport { Box } from '@semcore/flex-box';\nimport { Hint } from '@semcore/tooltip';\nimport keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\nimport addonTextChildren from '@semcore/utils/lib/addonTextChildren';\nimport logger from '@semcore/utils/lib/logger';\nimport hasLabels from '@semcore/utils/lib/hasLabels';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\n\nimport style from './style/link.shadow.css';\n\nclass RootLink extends Component {\n static displayName = 'Link';\n static defaultProps = {\n noWrap: true,\n };\n static style = style;\n static enhance = [keyboardFocusEnhance(), resolveColorEnhance()];\n containerRef = React.createRef();\n\n state = {\n ariaLabelledByContent: '',\n visibleHint: false,\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 handleMouseEnterOnlyAddon = () => {\n this.setState({ visibleHint: true });\n };\n handleMouseLeaveOnlyAddon = () => {\n this.setState({ visibleHint: false });\n };\n\n renderChildren() {\n const { Children, styles, addonLeft: AddonLeft, addonRight: AddonRight } = this.asProps;\n\n return sstyled(styles)(\n <>\n {AddonLeft ? <Link.Addon tag={AddonLeft} /> : null}\n {addonTextChildren(Children, Link.Text, Link.Addon)}\n {AddonRight ? <Link.Addon tag={AddonRight} /> : null}\n </>,\n );\n }\n\n renderOnlyAddons() {\n const {\n styles,\n addonLeft: AddonLeft,\n addonRight: AddonRight,\n title,\n ['aria-label']: ariaLabel,\n keyboardFocused,\n } = this.asProps;\n const { visibleHint } = this.state;\n\n const hintContent = title ?? ariaLabel ?? this.state.ariaLabelledByContent ?? '';\n\n return sstyled(styles)(\n <Link.Addon\n tag={Hint}\n title={hintContent}\n timeout={[250, 50]}\n visible={keyboardFocused || visibleHint}\n >\n {AddonLeft && <AddonLeft />}\n {AddonRight && <AddonRight />}\n </Link.Addon>,\n );\n }\n\n render() {\n const SLink = Root;\n const {\n styles,\n noWrap,\n color,\n resolveColor,\n disabled,\n href,\n children: hasChildren,\n } = this.asProps;\n\n return sstyled(styles)(\n <SLink\n role='link'\n tabIndex={disabled ? -1 : 0}\n use:href={disabled ? undefined : href}\n visually-disabled={disabled}\n render={Text}\n text-color={resolveColor(color)}\n tag='a'\n noWrapText={noWrap}\n use:noWrap={false}\n ref={this.containerRef}\n __excludeProps={['disabled', 'aria-disabled']}\n onMouseEnter={this.handleMouseEnterOnlyAddon}\n onMouseLeave={this.handleMouseLeaveOnlyAddon}\n >\n {hasChildren !== undefined ? this.renderChildren() : this.renderOnlyAddons()}\n </SLink>,\n );\n }\n}\n\nfunction LinkText(props) {\n const SText = Root;\n const { styles } = props;\n return sstyled(styles)(<SText render={Box} tag='span' />);\n}\n\nfunction Addon(props) {\n const SAddon = Root;\n const { styles } = props;\n return sstyled(styles)(<SAddon render={Box} tag='span' />);\n}\n\nconst Link = createComponent(RootLink, {\n Text: LinkText,\n Addon,\n});\n\nexport default Link;\n"],"mappings":";;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,IAAIC,SAAS,EAAEC,IAAI,EAAEC,OAAO,QAAQ,eAAe;AACzE,SAASC,IAAI,QAAQ,qBAAqB;AAC1C,SAASC,GAAG,QAAQ,mBAAmB;AACvC,SAASC,IAAI,QAAQ,kBAAkB;AACvC,OAAOC,oBAAoB,MAAM,kDAAkD;AACnF,OAAOC,iBAAiB,MAAM,sCAAsC;AACpE,OAAOC,MAAM,MAAM,2BAA2B;AAC9C,OAAOC,SAAS,MAAM,8BAA8B;AACpD,OAAOC,mBAAmB,MAAM,iDAAiD;AAAC;AAAA,IAAAC,KAAA,+BAAAC,QAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,IAI5EC,QAAQ,0BAAAC,UAAA;EAAAC,SAAA,CAAAF,QAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,QAAA;EAAA,SAAAA,SAAA;IAAA,IAAAK,KAAA;IAAAC,eAAA,OAAAN,QA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C,KAAK,CAAhBzC,MAAM;EACd,OAAA4C,KAAA,GAAOrG,OAAO,CAACyD,MAAM,CAAC,eAAC7D,KAAA,CAAAkE,aAAA,CAACwC,KAAK,EAAAD,KAAA,CAAAtB,EAAA,UAAAa,aAAA,KAAAW,aAAA;IAAA,OAAkB;EAAM,GAAAJ,KAAA,IAAG;AAC1D;AAEA,SAASlC,KAAKA,CAACiC,KAAK,EAAE;EAAA,IAAAM,KAAA,GAAAJ,YAAA;IAAAK,KAAA;EACpB,IAAMC,MAAM,GAE2BxG,GAAG;EAD1C,IAAQuD,MAAM,GAAKyC,KAAK,CAAhBzC,MAAM;EACd,OAAAgD,KAAA,GAAOzG,OAAO,CAACyD,MAAM,CAAC,eAAC7D,KAAA,CAAAkE,aAAA,CAAC4C,MAAM,EAAAD,KAAA,CAAA1B,EAAA,WAAAa,aAAA,KAAAe,aAAA;IAAA,OAAkB;EAAM,GAAAH,KAAA,IAAG;AAC3D;AAEA,IAAMxC,IAAI,GAAGnE,eAAe,CAACe,QAAQ,EAAE;EACrCX,IAAI,EAAEgG,QAAQ;EACdhC,KAAK,EAALA;AACF,CAAC,CAAC;AAEF,eAAeD,IAAI"}
|
|
1
|
+
{"version":3,"file":"Link.js","names":["React","createComponent","Component","Root","sstyled","Text","Box","Hint","keyboardFocusEnhance","addonTextChildren","logger","hasLabels","resolveColorEnhance","style","_sstyled","insert","RootLink","_Component","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","createRef","ariaLabelledByContent","visibleHint","setState","_createClass","key","value","componentDidMount","_this2","process","env","NODE_ENV","warn","containerRef","current","asProps","displayName","setTimeout","_document$getElementB","_document$getElementB2","document","getElementById","textContent","renderChildren","_ref4","_this$asProps","Children","styles","AddonLeft","addonLeft","AddonRight","addonRight","createElement","Fragment","Link","Addon","tag","renderOnlyAddons","_ref5","_ref9","_ref10","_this$asProps2","title","ariaLabel","keyboardFocused","state","hintContent","timeout","visible","cn","render","_ref","_ref6","SLink","_this$asProps3","noWrap","color","resolveColor","disabled","href","hasChildren","children","_objectSpread","_assignProps","undefined","handleMouseEnterOnlyAddon","handleMouseLeaveOnlyAddon","LinkText","props","_ref2","arguments[0]","_ref7","SText","_assignProps2","_ref3","_ref8","SAddon","_assignProps3"],"sources":["../../src/Link.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, Root, sstyled } from '@semcore/core';\nimport { Text } from '@semcore/typography';\nimport { Box } from '@semcore/flex-box';\nimport { Hint } from '@semcore/tooltip';\nimport keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\nimport addonTextChildren from '@semcore/utils/lib/addonTextChildren';\nimport logger from '@semcore/utils/lib/logger';\nimport hasLabels from '@semcore/utils/lib/hasLabels';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\n\nimport style from './style/link.shadow.css';\n\nclass RootLink extends Component {\n static displayName = 'Link';\n static defaultProps = {\n noWrap: true,\n };\n static style = style;\n static enhance = [keyboardFocusEnhance(), resolveColorEnhance()];\n containerRef = React.createRef();\n\n state = {\n ariaLabelledByContent: '',\n visibleHint: false,\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 handleMouseEnterOnlyAddon = () => {\n this.setState({ visibleHint: true });\n };\n handleMouseLeaveOnlyAddon = () => {\n this.setState({ visibleHint: false });\n };\n\n renderChildren() {\n const { Children, styles, addonLeft: AddonLeft, addonRight: AddonRight } = this.asProps;\n\n return sstyled(styles)(\n <>\n {AddonLeft ? <Link.Addon tag={AddonLeft} /> : null}\n {addonTextChildren(Children, Link.Text, Link.Addon)}\n {AddonRight ? <Link.Addon tag={AddonRight} /> : null}\n </>,\n );\n }\n\n renderOnlyAddons() {\n const {\n styles,\n addonLeft: AddonLeft,\n addonRight: AddonRight,\n title,\n ['aria-label']: ariaLabel,\n keyboardFocused,\n } = this.asProps;\n const { visibleHint } = this.state;\n\n const hintContent = title ?? ariaLabel ?? this.state.ariaLabelledByContent ?? '';\n\n return sstyled(styles)(\n <Link.Addon\n tag={Hint}\n title={hintContent}\n timeout={[250, 50]}\n visible={keyboardFocused || visibleHint}\n >\n {AddonLeft && <AddonLeft />}\n {AddonRight && <AddonRight />}\n </Link.Addon>,\n );\n }\n\n render() {\n const SLink = Root;\n const {\n styles,\n noWrap,\n color,\n resolveColor,\n disabled,\n href,\n children: hasChildren,\n } = this.asProps;\n\n return sstyled(styles)(\n <SLink\n role='link'\n tabIndex={disabled ? -1 : 0}\n use:href={disabled ? undefined : href}\n visually-disabled={disabled}\n render={Text}\n text-color={resolveColor(color)}\n tag='a'\n noWrapText={noWrap}\n use:noWrap={false}\n ref={this.containerRef}\n __excludeProps={['disabled', 'aria-disabled']}\n onMouseEnter={this.handleMouseEnterOnlyAddon}\n onMouseLeave={this.handleMouseLeaveOnlyAddon}\n >\n {hasChildren !== undefined ? this.renderChildren() : this.renderOnlyAddons()}\n </SLink>,\n );\n }\n}\n\nfunction LinkText(props) {\n const SText = Root;\n const { styles } = props;\n return sstyled(styles)(<SText render={Box} tag='span' />);\n}\n\nfunction Addon(props) {\n const SAddon = Root;\n const { styles } = props;\n return sstyled(styles)(<SAddon render={Box} tag='span' />);\n}\n\nconst Link = createComponent(RootLink, {\n Text: LinkText,\n Addon,\n});\n\nexport default Link;\n"],"mappings":";;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,IAAIC,SAAS,EAAEC,IAAI,EAAEC,OAAO,QAAQ,eAAe;AACzE,SAASC,IAAI,QAAQ,qBAAqB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,QAAQ;EACdhC,KAAK,EAALA;AACF,CAAC,CAAC;AAEF,eAAeD,IAAI"}
|
package/lib/esm/Link.mjs
CHANGED
|
@@ -1,136 +1,161 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { sstyled
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { Text
|
|
12
|
-
import { Box
|
|
13
|
-
import { Hint
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
+
import { sstyled } from "@semcore/utils/lib/core/index";
|
|
9
|
+
import createComponent, { sstyled as sstyled$1, assignProps, Component } from "@semcore/core";
|
|
10
|
+
import React from "react";
|
|
11
|
+
import { Text } from "@semcore/typography";
|
|
12
|
+
import { Box } from "@semcore/flex-box";
|
|
13
|
+
import { Hint } from "@semcore/tooltip";
|
|
14
|
+
import keyboardFocusEnhance from "@semcore/utils/lib/enhances/keyboardFocusEnhance";
|
|
15
|
+
import addonTextChildren from "@semcore/utils/lib/addonTextChildren";
|
|
16
|
+
import logger from "@semcore/utils/lib/logger";
|
|
17
|
+
import hasLabels from "@semcore/utils/lib/hasLabels";
|
|
18
|
+
import resolveColorEnhance from "@semcore/utils/lib/enhances/resolveColorEnhance";
|
|
19
|
+
/*!__reshadow-styles__:"./style/link.shadow.css"*/
|
|
20
|
+
var style = (
|
|
20
21
|
/*__reshadow_css_start__*/
|
|
21
|
-
(
|
|
22
|
+
(sstyled.insert(
|
|
22
23
|
/*__inner_css_start__*/
|
|
23
|
-
".
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
"
|
|
24
|
+
".___SLink_7ovi8_gg_{display:inline-block;font-family:inherit;color:var(--intergalactic-text-link, #006dca);line-height:normal;position:relative;cursor:pointer;-webkit-text-decoration:none;text-decoration:none;border:0;padding:0;margin:0;box-shadow:none;-webkit-tap-highlight-color:transparent;outline:0;background:0 0;transition:color .15s ease-in-out}.___SLink_7ovi8_gg_:active,.___SLink_7ovi8_gg_:focus{outline:0;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SLink_7ovi8_gg_:hover{outline:0;-webkit-text-decoration:none;text-decoration:none}}.___SLink_7ovi8_gg_::-moz-focus-inner{border:0;padding:0}.___SLink_7ovi8_gg_.__active_7ovi8_gg_,.___SLink_7ovi8_gg_:active{color:var(--intergalactic-text-link-hover-active, #044792)}@media (hover:hover){.___SLink_7ovi8_gg_:hover{color:var(--intergalactic-text-link-hover-active, #044792)}}.___SLink_7ovi8_gg_.__active_7ovi8_gg_ .___SText_7ovi8_gg_,.___SLink_7ovi8_gg_:active .___SText_7ovi8_gg_{border-color:currentColor}@media (hover:hover){.___SLink_7ovi8_gg_:hover .___SText_7ovi8_gg_{border-color:currentColor}}.___SLink_7ovi8_gg_.__enableVisited_7ovi8_gg_:visited{color:var(--intergalactic-text-link-visited, #8649e1)}@media (hover:hover){.___SLink_7ovi8_gg_.__enableVisited_7ovi8_gg_:visited:hover{color:var(--intergalactic-text-link-visited, #8649e1)}}.___SLink_7ovi8_gg_.__keyboardFocused_7ovi8_gg_{outline-color:var(--intergalactic-keyboard-focus-outline, rgba(0, 143, 248, 0.5));outline-style:solid;outline-width:3px}.___SLink_7ovi8_gg_.__visually-disabled_7ovi8_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SLink_7ovi8_gg_.__noWrapText_7ovi8_gg_{white-space:nowrap}.___SLink_7ovi8_gg_.__inline_7ovi8_gg_{display:inline}.___SAddon_7ovi8_gg_{display:inline-flex;justify-content:center;align-items:center;margin-bottom:var(--intergalactic-spacing-05x, 2px);vertical-align:middle;pointer-events:none}.___SLink_7ovi8_gg_ .___SAddon_7ovi8_gg_:not(:only-child):first-child{margin-right:var(--intergalactic-spacing-1x, 4px)}.___SLink_7ovi8_gg_ .___SAddon_7ovi8_gg_:not(:only-child):last-child{margin-left:var(--intergalactic-spacing-1x, 4px)}.___SText_7ovi8_gg_{border-bottom-width:1px;border-bottom-style:solid;border-color:transparent;transition:border-bottom-color .15s ease-in-out}.___SLink_7ovi8_gg_.__text-color_7ovi8_gg_{color:var(--text-color_7ovi8)}.___SLink_7ovi8_gg_.__text-color_7ovi8_gg_.__active_7ovi8_gg_,.___SLink_7ovi8_gg_.__text-color_7ovi8_gg_:active{color:var(--text-color_7ovi8);filter:brightness(.8)}@media (hover:hover){.___SLink_7ovi8_gg_.__text-color_7ovi8_gg_:hover{color:var(--text-color_7ovi8);filter:brightness(.8)}}@media (prefers-reduced-motion){.___SLink_7ovi8_gg_,.___SText_7ovi8_gg_{transition:none}}",
|
|
25
|
+
/*__inner_css_end__*/
|
|
26
|
+
"7ovi8_gg_"
|
|
27
|
+
), /*__reshadow_css_end__*/
|
|
28
|
+
{
|
|
29
|
+
"__SLink": "___SLink_7ovi8_gg_",
|
|
30
|
+
"_keyboardFocused": "__keyboardFocused_7ovi8_gg_",
|
|
31
|
+
"_visually-disabled": "__visually-disabled_7ovi8_gg_",
|
|
32
|
+
"_noWrapText": "__noWrapText_7ovi8_gg_",
|
|
33
|
+
"_inline": "__inline_7ovi8_gg_",
|
|
34
|
+
"__SAddon": "___SAddon_7ovi8_gg_",
|
|
35
|
+
"__SText": "___SText_7ovi8_gg_",
|
|
36
|
+
"_active": "__active_7ovi8_gg_",
|
|
37
|
+
"_enableVisited": "__enableVisited_7ovi8_gg_",
|
|
38
|
+
"_text-color": "__text-color_7ovi8_gg_",
|
|
39
|
+
"--text-color": "--text-color_7ovi8"
|
|
37
40
|
})
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
);
|
|
42
|
+
var RootLink = /* @__PURE__ */ function(_Component) {
|
|
43
|
+
_inherits(RootLink2, _Component);
|
|
44
|
+
var _super = _createSuper(RootLink2);
|
|
45
|
+
function RootLink2() {
|
|
46
|
+
var _this;
|
|
47
|
+
_classCallCheck(this, RootLink2);
|
|
48
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
49
|
+
args[_key] = arguments[_key];
|
|
50
|
+
}
|
|
51
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
52
|
+
_defineProperty(_assertThisInitialized(_this), "containerRef", /* @__PURE__ */ React.createRef());
|
|
53
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
47
54
|
ariaLabelledByContent: "",
|
|
48
|
-
visibleHint:
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
visibleHint: false
|
|
56
|
+
});
|
|
57
|
+
_defineProperty(_assertThisInitialized(_this), "handleMouseEnterOnlyAddon", function() {
|
|
58
|
+
_this.setState({
|
|
59
|
+
visibleHint: true
|
|
52
60
|
});
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
|
|
61
|
+
});
|
|
62
|
+
_defineProperty(_assertThisInitialized(_this), "handleMouseLeaveOnlyAddon", function() {
|
|
63
|
+
_this.setState({
|
|
64
|
+
visibleHint: false
|
|
56
65
|
});
|
|
57
|
-
})
|
|
66
|
+
});
|
|
67
|
+
return _this;
|
|
58
68
|
}
|
|
59
|
-
|
|
69
|
+
_createClass(RootLink2, [{
|
|
60
70
|
key: "componentDidMount",
|
|
61
|
-
value: function() {
|
|
62
|
-
var
|
|
63
|
-
process.env.NODE_ENV !== "production"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
value: function componentDidMount() {
|
|
72
|
+
var _this2 = this;
|
|
73
|
+
if (process.env.NODE_ENV !== "production") {
|
|
74
|
+
logger.warn(this.containerRef.current && !hasLabels(this.containerRef.current), "'title' or 'aria-label' or 'aria-labelledby' are required props for links without text content", this.asProps["data-ui-name"] || RootLink2.displayName);
|
|
75
|
+
}
|
|
76
|
+
if (this.asProps["aria-labelledby"]) {
|
|
77
|
+
setTimeout(function() {
|
|
78
|
+
var _document$getElementB, _document$getElementB2;
|
|
79
|
+
_this2.setState({
|
|
80
|
+
ariaLabelledByContent: (_document$getElementB = (_document$getElementB2 = document.getElementById(_this2.asProps["aria-labelledby"])) === null || _document$getElementB2 === void 0 ? void 0 : _document$getElementB2.textContent) !== null && _document$getElementB !== void 0 ? _document$getElementB : ""
|
|
81
|
+
});
|
|
82
|
+
}, 0);
|
|
83
|
+
}
|
|
69
84
|
}
|
|
70
85
|
}, {
|
|
71
86
|
key: "renderChildren",
|
|
72
|
-
value: function() {
|
|
73
|
-
var
|
|
74
|
-
return
|
|
75
|
-
tag:
|
|
76
|
-
}) : null,
|
|
77
|
-
tag:
|
|
87
|
+
value: function renderChildren() {
|
|
88
|
+
var _this$asProps = this.asProps, Children = _this$asProps.Children, styles = _this$asProps.styles, AddonLeft = _this$asProps.addonLeft, AddonRight = _this$asProps.addonRight;
|
|
89
|
+
return sstyled$1(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, AddonLeft ? /* @__PURE__ */ React.createElement(Link.Addon, {
|
|
90
|
+
tag: AddonLeft
|
|
91
|
+
}) : null, addonTextChildren(Children, Link.Text, Link.Addon), AddonRight ? /* @__PURE__ */ React.createElement(Link.Addon, {
|
|
92
|
+
tag: AddonRight
|
|
78
93
|
}) : null);
|
|
79
94
|
}
|
|
80
95
|
}, {
|
|
81
96
|
key: "renderOnlyAddons",
|
|
82
|
-
value: function() {
|
|
83
|
-
var
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
97
|
+
value: function renderOnlyAddons() {
|
|
98
|
+
var _ref5, _ref9, _ref10;
|
|
99
|
+
var _this$asProps2 = this.asProps, styles = _this$asProps2.styles, AddonLeft = _this$asProps2.addonLeft, AddonRight = _this$asProps2.addonRight, title = _this$asProps2.title, ariaLabel = _this$asProps2["aria-label"], keyboardFocused = _this$asProps2.keyboardFocused;
|
|
100
|
+
var visibleHint = this.state.visibleHint;
|
|
101
|
+
var hintContent = (_ref9 = (_ref10 = title !== null && title !== void 0 ? title : ariaLabel) !== null && _ref10 !== void 0 ? _ref10 : this.state.ariaLabelledByContent) !== null && _ref9 !== void 0 ? _ref9 : "";
|
|
102
|
+
return _ref5 = sstyled$1(styles), /* @__PURE__ */ React.createElement(Link.Addon, {
|
|
103
|
+
tag: Hint,
|
|
104
|
+
title: hintContent,
|
|
87
105
|
timeout: [250, 50],
|
|
88
|
-
visible:
|
|
89
|
-
},
|
|
106
|
+
visible: keyboardFocused || visibleHint
|
|
107
|
+
}, AddonLeft && /* @__PURE__ */ React.createElement(AddonLeft, _ref5.cn("AddonLeft", {})), AddonRight && /* @__PURE__ */ React.createElement(AddonRight, _ref5.cn("AddonRight", {})));
|
|
90
108
|
}
|
|
91
109
|
}, {
|
|
92
110
|
key: "render",
|
|
93
|
-
value: function() {
|
|
94
|
-
var
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
"
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
111
|
+
value: function render() {
|
|
112
|
+
var _ref = this.asProps, _ref6;
|
|
113
|
+
var SLink = Text;
|
|
114
|
+
var _this$asProps3 = this.asProps, styles = _this$asProps3.styles, noWrap = _this$asProps3.noWrap, color = _this$asProps3.color, resolveColor = _this$asProps3.resolveColor, disabled = _this$asProps3.disabled, href = _this$asProps3.href, hasChildren = _this$asProps3.children;
|
|
115
|
+
return _ref6 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SLink, _ref6.cn("SLink", _objectSpread({}, assignProps({
|
|
116
|
+
"role": "link",
|
|
117
|
+
"tabIndex": disabled ? -1 : 0,
|
|
118
|
+
"use:href": disabled ? void 0 : href,
|
|
119
|
+
"visually-disabled": disabled,
|
|
120
|
+
"text-color": resolveColor(color),
|
|
121
|
+
"tag": "a",
|
|
122
|
+
"noWrapText": noWrap,
|
|
123
|
+
"use:noWrap": false,
|
|
124
|
+
"ref": this.containerRef,
|
|
125
|
+
"__excludeProps": ["disabled", "aria-disabled"],
|
|
126
|
+
"onMouseEnter": this.handleMouseEnterOnlyAddon,
|
|
127
|
+
"onMouseLeave": this.handleMouseLeaveOnlyAddon
|
|
128
|
+
}, _ref))), hasChildren !== void 0 ? this.renderChildren() : this.renderOnlyAddons());
|
|
109
129
|
}
|
|
110
|
-
}])
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
130
|
+
}]);
|
|
131
|
+
return RootLink2;
|
|
132
|
+
}(Component);
|
|
133
|
+
_defineProperty(RootLink, "displayName", "Link");
|
|
134
|
+
_defineProperty(RootLink, "defaultProps", {
|
|
135
|
+
noWrap: true
|
|
115
136
|
});
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
function
|
|
119
|
-
var
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
},
|
|
137
|
+
_defineProperty(RootLink, "style", style);
|
|
138
|
+
_defineProperty(RootLink, "enhance", [keyboardFocusEnhance(), resolveColorEnhance()]);
|
|
139
|
+
function LinkText(props) {
|
|
140
|
+
var _ref2 = arguments[0], _ref7;
|
|
141
|
+
var SText = Box;
|
|
142
|
+
var styles = props.styles;
|
|
143
|
+
return _ref7 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SText, _ref7.cn("SText", _objectSpread({}, assignProps({
|
|
144
|
+
"tag": "span"
|
|
145
|
+
}, _ref2))));
|
|
123
146
|
}
|
|
124
|
-
function
|
|
125
|
-
var
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
},
|
|
147
|
+
function Addon(props) {
|
|
148
|
+
var _ref3 = arguments[0], _ref8;
|
|
149
|
+
var SAddon = Box;
|
|
150
|
+
var styles = props.styles;
|
|
151
|
+
return _ref8 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SAddon, _ref8.cn("SAddon", _objectSpread({}, assignProps({
|
|
152
|
+
"tag": "span"
|
|
153
|
+
}, _ref3))));
|
|
129
154
|
}
|
|
130
|
-
var
|
|
131
|
-
Text:
|
|
132
|
-
Addon
|
|
155
|
+
var Link = createComponent(RootLink, {
|
|
156
|
+
Text: LinkText,
|
|
157
|
+
Addon
|
|
133
158
|
});
|
|
134
159
|
export {
|
|
135
|
-
|
|
160
|
+
Link as default
|
|
136
161
|
};
|
package/lib/esm/index.mjs
CHANGED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
SLink {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
font-family: inherit;
|
|
4
|
+
color: var(--intergalactic-text-link, #006dca);
|
|
5
|
+
line-height: normal;
|
|
6
|
+
position: relative;
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
text-decoration: none;
|
|
9
|
+
border: none;
|
|
10
|
+
padding: 0;
|
|
11
|
+
margin: 0;
|
|
12
|
+
box-shadow: none;
|
|
13
|
+
-webkit-tap-highlight-color: transparent;
|
|
14
|
+
outline: 0;
|
|
15
|
+
background: none;
|
|
16
|
+
transition: color 0.15s ease-in-out;
|
|
17
|
+
|
|
18
|
+
&:active,
|
|
19
|
+
&:hover,
|
|
20
|
+
&:focus {
|
|
21
|
+
outline: 0;
|
|
22
|
+
text-decoration: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&::-moz-focus-inner {
|
|
26
|
+
border: none;
|
|
27
|
+
padding: 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&[active],
|
|
31
|
+
&:hover,
|
|
32
|
+
&:active {
|
|
33
|
+
color: var(--intergalactic-text-link-hover-active, #044792);
|
|
34
|
+
|
|
35
|
+
& SText {
|
|
36
|
+
border-color: currentColor;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&[enableVisited]:visited,
|
|
41
|
+
&[enableVisited]:visited:hover {
|
|
42
|
+
color: var(--intergalactic-text-link-visited, #8649e1);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
SLink[keyboardFocused] {
|
|
47
|
+
outline-color: var(--intergalactic-keyboard-focus-outline, rgba(0, 143, 248, 0.5));
|
|
48
|
+
outline-style: solid;
|
|
49
|
+
outline-width: 3px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
SLink[visually-disabled] {
|
|
53
|
+
opacity: var(--intergalactic-disabled-opacity, 0.3);
|
|
54
|
+
cursor: default;
|
|
55
|
+
/* Disable link interactions */
|
|
56
|
+
pointer-events: none;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
SLink[noWrapText] {
|
|
60
|
+
white-space: nowrap;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
SLink[inline] {
|
|
64
|
+
display: inline;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
SAddon {
|
|
68
|
+
display: inline-flex;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
align-items: center;
|
|
71
|
+
margin-bottom: var(--intergalactic-spacing-05x, 2px);
|
|
72
|
+
vertical-align: middle;
|
|
73
|
+
pointer-events: none;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
SLink SAddon {
|
|
77
|
+
&:not(:only-child):first-child {
|
|
78
|
+
margin-right: var(--intergalactic-spacing-1x, 4px);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&:not(:only-child):last-child {
|
|
82
|
+
margin-left: var(--intergalactic-spacing-1x, 4px);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
SText {
|
|
87
|
+
border-bottom-width: 1px;
|
|
88
|
+
border-bottom-style: solid;
|
|
89
|
+
border-color: transparent;
|
|
90
|
+
transition: border-bottom-color 0.15s ease-in-out;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
SLink[text-color] {
|
|
94
|
+
color: var(--text-color);
|
|
95
|
+
|
|
96
|
+
&[active],
|
|
97
|
+
&:hover,
|
|
98
|
+
&:active {
|
|
99
|
+
color: var(--text-color);
|
|
100
|
+
filter: brightness(0.8);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@media (prefers-reduced-motion) {
|
|
105
|
+
SLink {
|
|
106
|
+
transition: none;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
SText {
|
|
110
|
+
transition: none;
|
|
111
|
+
}
|
|
112
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/link",
|
|
3
3
|
"description": "Semrush Link Component",
|
|
4
|
-
"version": "5.44.
|
|
4
|
+
"version": "5.44.3-prerelease.0",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/utils": "4.48.
|
|
18
|
-
"@semcore/typography": "5.
|
|
19
|
-
"@semcore/flex-box": "5.41.
|
|
20
|
-
"@semcore/tooltip": "6.49.
|
|
17
|
+
"@semcore/utils": "4.48.4-prerelease.0",
|
|
18
|
+
"@semcore/typography": "5.53.1-prerelease.0",
|
|
19
|
+
"@semcore/flex-box": "5.41.3-prerelease.0",
|
|
20
|
+
"@semcore/tooltip": "6.49.3-prerelease.0"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@semcore/core": "^2.39.
|
|
23
|
+
"@semcore/core": "^2.39.3-prerelease.0",
|
|
24
24
|
"react": "16.8 - 18",
|
|
25
25
|
"react-dom": "16.8 - 18"
|
|
26
26
|
},
|