@ta-interaktiv/contentbricks
Advanced tools
Comparing version 1.3.4 to 1.3.6
# Change Log | ||
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
## [1.3.4](https://gitlab.com/ta-interaktiv/packages/compare/@ta-interaktiv/contentbricks@1.3.3...@ta-interaktiv/contentbricks@1.3.4) (2020-07-21) | ||
## [1.3.6](https://gitlab.com/ta-interaktiv/packages/compare/@ta-interaktiv/contentbricks@1.3.5...@ta-interaktiv/contentbricks@1.3.6) (2022-02-10) | ||
**Note:** Version bump only for package @ta-interaktiv/contentbricks | ||
## [1.3.3](https://gitlab.com/ta-interaktiv/packages/compare/@ta-interaktiv/contentbricks@1.3.2...@ta-interaktiv/contentbricks@1.3.3) (2020-07-21) | ||
**Note:** Version bump only for package @ta-interaktiv/contentbricks | ||
## [1.3.2](https://gitlab.com/ta-interaktiv/packages/compare/@ta-interaktiv/contentbricks@1.3.1...@ta-interaktiv/contentbricks@1.3.2) (2020-07-21) | ||
**Note:** Version bump only for package @ta-interaktiv/contentbricks | ||
## [1.3.1](https://gitlab.com/ta-interaktiv/packages/compare/@ta-interaktiv/contentbricks@1.3.0...@ta-interaktiv/contentbricks@1.3.1) (2020-07-21) | ||
## [1.3.5](https://gitlab.com/ta-interaktiv/packages/compare/@ta-interaktiv/contentbricks@1.3.0...@ta-interaktiv/contentbricks@1.3.5) (2022-02-10) | ||
@@ -23,2 +20,26 @@ ### Bug Fixes | ||
## [1.3.4](https://gitlab.com/ta-interaktiv/packages/compare/@ta-interaktiv/contentbricks@1.3.0...@ta-interaktiv/contentbricks@1.3.4) (2022-02-10) | ||
### Bug Fixes | ||
- Icon never at end of line ([b4281c4](https://gitlab.com/ta-interaktiv/packages/commit/b4281c4683f86e3b119d652de2ec7a1ffd656dd6)) | ||
## [1.3.3](https://gitlab.com/ta-interaktiv/packages/compare/@ta-interaktiv/contentbricks@1.3.0...@ta-interaktiv/contentbricks@1.3.3) (2022-02-10) | ||
### Bug Fixes | ||
- Icon never at end of line ([b4281c4](https://gitlab.com/ta-interaktiv/packages/commit/b4281c4683f86e3b119d652de2ec7a1ffd656dd6)) | ||
## [1.3.2](https://gitlab.com/ta-interaktiv/packages/compare/@ta-interaktiv/contentbricks@1.3.0...@ta-interaktiv/contentbricks@1.3.2) (2022-02-10) | ||
### Bug Fixes | ||
- Icon never at end of line ([b4281c4](https://gitlab.com/ta-interaktiv/packages/commit/b4281c4683f86e3b119d652de2ec7a1ffd656dd6)) | ||
## [1.3.1](https://gitlab.com/ta-interaktiv/packages/compare/@ta-interaktiv/contentbricks@1.3.0...@ta-interaktiv/contentbricks@1.3.1) (2020-10-01) | ||
### Bug Fixes | ||
- Icon never at end of line ([b4281c4](https://gitlab.com/ta-interaktiv/packages/commit/b4281c4683f86e3b119d652de2ec7a1ffd656dd6)) | ||
# [1.3.0](https://gitlab.com/ta-interaktiv/packages/compare/@ta-interaktiv/contentbricks@1.1.8...@ta-interaktiv/contentbricks@1.3.0) (2020-05-12) | ||
@@ -25,0 +46,0 @@ |
@@ -107,6 +107,8 @@ 'use strict'; | ||
var Link = function (_a) { | ||
var _b = _a.href, href = _b === void 0 ? '' : _b, _c = _a.icon, icon = _c === void 0 ? 'icon-external-link' : _c, _d = _a.hideIcon, hideIcon = _d === void 0 ? false : _d, _e = _a.target, target = _e === void 0 ? ['_parent', '_blank'] : _e, _f = _a.className, className = _f === void 0 ? 'cbLink' : _f, _g = _a.style, style = _g === void 0 ? { whiteSpace: 'nowrap' } : _g, _h = _a.children, children = _h === void 0 ? 'Link' : _h, _j = _a.allowWordWrap, allowWordWrap = _j === void 0 ? false : _j, props = __rest(_a, ["href", "icon", "hideIcon", "target", "className", "style", "children", "allowWordWrap"]); | ||
var _b = _a.href, href = _b === void 0 ? '' : _b, icon = _a.icon, _c = _a.hideIcon, hideIcon = _c === void 0 ? false : _c, _d = _a.target, target = _d === void 0 ? ['_parent', '_blank'] : _d, _e = _a.className, className = _e === void 0 ? 'cbLink' : _e, _f = _a.style, style = _f === void 0 ? { whiteSpace: 'nowrap' } : _f, _g = _a.children, children = _g === void 0 ? 'Link' : _g, _h = _a.allowWordWrap, allowWordWrap = _h === void 0 ? true : _h, props = __rest(_a, ["href", "icon", "hideIcon", "target", "className", "style", "children", "allowWordWrap"]); | ||
var hrefIsArticleID = false; | ||
if (!validURL(href)) { | ||
if (isnum(href) && (href.length === 8 || href.length === 12)) { | ||
href = 'https://www.' + parseHostname().publicationDomain + '/' + href; | ||
hrefIsArticleID = true; | ||
} | ||
@@ -128,4 +130,4 @@ } | ||
var kids = React__default.Children.toArray(children); | ||
var head = kids[0]; | ||
var tail = kids.slice(1); | ||
var head = kids[0].split(' '); | ||
var tail = (head.length > 1 ? ' ' : '') + head.pop(); | ||
if (typeof head === 'string') { | ||
@@ -136,10 +138,12 @@ tail = head.slice(1).concat(tail); | ||
return (React__default.createElement("a", __assign({ href: href, target: openIn, className: className + ' cB', style: __assign(__assign(__assign({}, style), noWrap), (placeholderMode ? { color: placeholderColor } : {})) }, props), | ||
head.join(' '), | ||
React__default.createElement("span", { style: { whiteSpace: 'nowrap' } }, | ||
!hideIcon && (React__default.createElement("i", { className: 'icon ' + icon, style: { fontSize: '.8em' } })), | ||
head), | ||
tail)); | ||
tail, | ||
!hideIcon && !hrefIsArticleID && !icon && (React__default.createElement("img", { src: require('./assets/icn_link_arrow_l.svg') })), | ||
!hideIcon && !hrefIsArticleID && icon && (React__default.createElement(React__default.Fragment, null, | ||
' ', | ||
React__default.createElement("i", { className: 'icon ' + icon, style: { fontSize: '.8em' } })))))); | ||
}; | ||
Link.defaultProps = { | ||
href: '', | ||
icon: 'external-link', | ||
hideIcon: false, | ||
@@ -150,3 +154,3 @@ target: ['_parent', '_blank'], | ||
children: 'Link', | ||
allowWordWrap: false | ||
allowWordWrap: true | ||
}; | ||
@@ -153,0 +157,0 @@ |
@@ -18,3 +18,2 @@ import React, { CSSProperties } from 'react'; | ||
href: string; | ||
icon: string; | ||
hideIcon: boolean; | ||
@@ -21,0 +20,0 @@ target: string[]; |
@@ -100,6 +100,8 @@ import React, { forwardRef, useState, useEffect, useLayoutEffect, useRef } from 'react'; | ||
var Link = function (_a) { | ||
var _b = _a.href, href = _b === void 0 ? '' : _b, _c = _a.icon, icon = _c === void 0 ? 'icon-external-link' : _c, _d = _a.hideIcon, hideIcon = _d === void 0 ? false : _d, _e = _a.target, target = _e === void 0 ? ['_parent', '_blank'] : _e, _f = _a.className, className = _f === void 0 ? 'cbLink' : _f, _g = _a.style, style = _g === void 0 ? { whiteSpace: 'nowrap' } : _g, _h = _a.children, children = _h === void 0 ? 'Link' : _h, _j = _a.allowWordWrap, allowWordWrap = _j === void 0 ? false : _j, props = __rest(_a, ["href", "icon", "hideIcon", "target", "className", "style", "children", "allowWordWrap"]); | ||
var _b = _a.href, href = _b === void 0 ? '' : _b, icon = _a.icon, _c = _a.hideIcon, hideIcon = _c === void 0 ? false : _c, _d = _a.target, target = _d === void 0 ? ['_parent', '_blank'] : _d, _e = _a.className, className = _e === void 0 ? 'cbLink' : _e, _f = _a.style, style = _f === void 0 ? { whiteSpace: 'nowrap' } : _f, _g = _a.children, children = _g === void 0 ? 'Link' : _g, _h = _a.allowWordWrap, allowWordWrap = _h === void 0 ? true : _h, props = __rest(_a, ["href", "icon", "hideIcon", "target", "className", "style", "children", "allowWordWrap"]); | ||
var hrefIsArticleID = false; | ||
if (!validURL(href)) { | ||
if (isnum(href) && (href.length === 8 || href.length === 12)) { | ||
href = 'https://www.' + parseHostname().publicationDomain + '/' + href; | ||
hrefIsArticleID = true; | ||
} | ||
@@ -121,4 +123,4 @@ } | ||
var kids = React.Children.toArray(children); | ||
var head = kids[0]; | ||
var tail = kids.slice(1); | ||
var head = kids[0].split(' '); | ||
var tail = (head.length > 1 ? ' ' : '') + head.pop(); | ||
if (typeof head === 'string') { | ||
@@ -129,10 +131,12 @@ tail = head.slice(1).concat(tail); | ||
return (React.createElement("a", __assign({ href: href, target: openIn, className: className + ' cB', style: __assign(__assign(__assign({}, style), noWrap), (placeholderMode ? { color: placeholderColor } : {})) }, props), | ||
head.join(' '), | ||
React.createElement("span", { style: { whiteSpace: 'nowrap' } }, | ||
!hideIcon && (React.createElement("i", { className: 'icon ' + icon, style: { fontSize: '.8em' } })), | ||
head), | ||
tail)); | ||
tail, | ||
!hideIcon && !hrefIsArticleID && !icon && (React.createElement("img", { src: require('./assets/icn_link_arrow_l.svg') })), | ||
!hideIcon && !hrefIsArticleID && icon && (React.createElement(React.Fragment, null, | ||
' ', | ||
React.createElement("i", { className: 'icon ' + icon, style: { fontSize: '.8em' } })))))); | ||
}; | ||
Link.defaultProps = { | ||
href: '', | ||
icon: 'external-link', | ||
hideIcon: false, | ||
@@ -143,3 +147,3 @@ target: ['_parent', '_blank'], | ||
children: 'Link', | ||
allowWordWrap: false | ||
allowWordWrap: true | ||
}; | ||
@@ -146,0 +150,0 @@ |
@@ -18,3 +18,2 @@ import React, { CSSProperties } from 'react'; | ||
href: string; | ||
icon: string; | ||
hideIcon: boolean; | ||
@@ -21,0 +20,0 @@ target: string[]; |
{ | ||
"name": "@ta-interaktiv/contentbricks", | ||
"version": "1.3.4", | ||
"version": "1.3.6", | ||
"description": "> TODO: description", | ||
@@ -52,3 +52,3 @@ "author": "Sebastian Broschinski <sebastian.broschinski@tamedia.ch>", | ||
}, | ||
"gitHead": "530e9c577c5e9b1e80ea2b439837d5439eb8de1d", | ||
"gitHead": "9df928ed92c0526010407ca1b0e3568db7d35fa0", | ||
"devDependencies": { | ||
@@ -55,0 +55,0 @@ "@types/mdx-js__react": "^1.5.1" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
483845
3700
2