@kvdbil/components 17.4.0 → 17.4.2
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.
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("../../typography/BodyText/index.js"),r=require("styled-components"),
|
|
2
|
-
text-decoration: ${({$withUnderline:e})=>e?`underline ${
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("../../typography/BodyText/index.js"),r=require("styled-components"),t=require("../../theme.js"),i=require("../../typography/Heading/index.js"),a=require("../Button/index.js"),s=require("react-router-dom");require("../../shared/media-queries.js"),require("react"),require("../Spinner/index.js"),require("../../utils/utils.js"),require("../../typography/ButtonText/index.js"),require("../Button/styles.js");var l,o=(l=r)&&l.__esModule?l:{default:l};const d=r.css`
|
|
2
|
+
text-decoration: ${({$withUnderline:e})=>e?`underline ${t.default.colors.info.dark}`:"none"};
|
|
3
3
|
|
|
4
4
|
span {
|
|
5
|
-
color: ${({$isButton:e})=>!e&&`${
|
|
5
|
+
color: ${({$isButton:e})=>!e&&`${t.default.colors.info.dark}`};
|
|
6
6
|
font-weight: 600;
|
|
7
7
|
}
|
|
8
8
|
`,u=o.default.a`
|
|
9
9
|
${d}
|
|
10
10
|
`,c=o.default(s.Link)`
|
|
11
11
|
${d}
|
|
12
|
-
`;function p(r,
|
|
12
|
+
`;function p(r,t){switch(t){case"BodyLink":return e.jsx(n.BodyLink,{as:"span",children:r});case"BodyText":return e.jsx(n.BodyText,{as:"span",children:r});case"Caption":return e.jsx(n.Caption,{as:"span",children:r});case"Caption2":return e.jsx(n.Caption2,{as:"span",children:r});case"CaptionLink":return e.jsx(n.CaptionLink,{as:"span",children:r});case"Status":return e.jsx(n.Status,{as:"span",children:r});case"Headline":return e.jsx(i.Headline,{as:"span",children:r});case"Title":return e.jsx(i.Title,{as:"span",children:r});case"Subtitle":return e.jsx(i.Subtitle,{as:"span",children:r});case"TinyTitleRegular":return e.jsx(i.TinyTitleRegular,{as:"span",children:r});case"TinyTitleBold":return e.jsx(i.TinyTitleBold,{as:"span",children:r});case"Display1":return e.jsx(i.Display1,{as:"span",children:r});case"Display2":return e.jsx(i.Display2,{as:"span",children:r});case"Display3":return e.jsx(i.Display3,{as:"span",children:r})}}const h=({path:n,text:r,url:t,rel:i,ariaLabel:s,typographyType:l="BodyLink",target:o,isButton:d=!1,buttonColor:h="primary",buttonColorShade:x,buttonVariant:y,fullWidth:f,buttonSize:j,withUnderline:b=!1,buttonPrefixIcon:m,children:B,fontFamily:T,isDisabled:k=!1})=>{const q=t??n??"";if(!q)return console.error('One of the props "path" or "url" must be defined in the Link component'),null;const g=q.startsWith("http")&&typeof window<"u"&&!q.includes(window.location.hostname),$={$isButton:d,$withUnderline:b,rel:i||("_blank"===o?g?"noopener noreferrer":"noopener":void 0),"aria-label":s},D=((n,r,t,i,s)=>e.jsxs(e.Fragment,{children:[r,t?e.jsx(a.Button,{as:"span",color:s.color,colorShade:s.colorShade,variant:s.variant,fullWidth:s.fullWidth,size:s.size,prefixIcon:s.prefixIcon,isDisabled:s.isDisabled,style:{display:"inline-flex",fontFamily:s.fontFamily?`${s.fontFamily}, sans-serif`:void 0},children:n}):n&&p(n,i)]}))(r,B,d,l,{color:h,colorShade:x,variant:y,fullWidth:f,size:j,prefixIcon:m,fontFamily:T,isDisabled:k});return g?e.jsx(u,{href:q,target:o??"_blank",...$,"data-testid":"external-link",children:D}):e.jsx(c,{to:q,target:o??"_self",...$,"data-testid":"internal-link","aria-disabled":k,tabIndex:k?-1:void 0,children:D})};exports.Link=h,exports.default=h;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import{jsxs as F,jsx as i,Fragment as v}from"react/jsx-runtime";import{Status as I,CaptionLink as W,Caption2 as z,Caption as U,BodyText as _,BodyLink as j}from"../../typography/BodyText/index.js";import h,{css as H}from"styled-components";import f from"../../theme.js";import{Display3 as R,Display2 as
|
|
1
|
+
import{jsxs as F,jsx as i,Fragment as v}from"react/jsx-runtime";import{Status as I,CaptionLink as W,Caption2 as z,Caption as U,BodyText as _,BodyLink as j}from"../../typography/BodyText/index.js";import h,{css as H}from"styled-components";import f from"../../theme.js";import{Display3 as R,Display2 as G,Display1 as J,TinyTitleBold as K,TinyTitleRegular as M,Subtitle as O,Title as P,Headline as V}from"../../typography/Heading/index.js";import{Button as q}from"../Button/index.js";import{Link as A}from"react-router-dom";import"../../shared/media-queries.js";import"react";import"../Spinner/index.js";import"../../utils/utils.js";import"../../typography/ButtonText/index.js";import"../Button/styles.js";const m=H`
|
|
2
2
|
text-decoration: ${({$withUnderline:n})=>n?`underline ${f.colors.info.dark}`:"none"};
|
|
3
3
|
|
|
4
4
|
span {
|
|
5
5
|
color: ${({$isButton:n})=>!n&&`${f.colors.info.dark}`};
|
|
6
6
|
font-weight: 600;
|
|
7
7
|
}
|
|
8
|
-
`,
|
|
8
|
+
`,E=h.a`
|
|
9
9
|
${m}
|
|
10
|
-
`,N=h(
|
|
10
|
+
`,N=h(A)`
|
|
11
11
|
${m}
|
|
12
|
-
`;function Q(n,r){switch(r){case"BodyLink":return i(j,{as:"span",children:n});case"BodyText":return i(_,{as:"span",children:n});case"Caption":return i(U,{as:"span",children:n});case"Caption2":return i(z,{as:"span",children:n});case"CaptionLink":return i(W,{as:"span",children:n});case"Status":return i(I,{as:"span",children:n});case"Headline":return i(
|
|
12
|
+
`;function Q(n,r){switch(r){case"BodyLink":return i(j,{as:"span",children:n});case"BodyText":return i(_,{as:"span",children:n});case"Caption":return i(U,{as:"span",children:n});case"Caption2":return i(z,{as:"span",children:n});case"CaptionLink":return i(W,{as:"span",children:n});case"Status":return i(I,{as:"span",children:n});case"Headline":return i(V,{as:"span",children:n});case"Title":return i(P,{as:"span",children:n});case"Subtitle":return i(O,{as:"span",children:n});case"TinyTitleRegular":return i(M,{as:"span",children:n});case"TinyTitleBold":return i(K,{as:"span",children:n});case"Display1":return i(J,{as:"span",children:n});case"Display2":return i(G,{as:"span",children:n});case"Display3":return i(R,{as:"span",children:n})}}const X=(n,r,o,a,t)=>F(v,{children:[r,o?i(q,{as:"span",color:t.color,colorShade:t.colorShade,variant:t.variant,fullWidth:t.fullWidth,size:t.size,prefixIcon:t.prefixIcon,isDisabled:t.isDisabled,style:{display:"inline-flex",fontFamily:t.fontFamily?`${t.fontFamily}, sans-serif`:void 0},children:n}):n&&Q(n,a)]}),y=({path:n,text:r,url:o,rel:a,ariaLabel:t,typographyType:b="BodyLink",target:s,isButton:d=!1,buttonColor:k="primary",buttonColorShade:x,buttonVariant:T,fullWidth:$,buttonSize:B,withUnderline:D=!1,buttonPrefixIcon:L,children:w,fontFamily:S,isDisabled:l=!1})=>{const e=o??n??"";if(!e)return console.error('One of the props "path" or "url" must be defined in the Link component'),null;const c=e.startsWith("http")&&typeof window<"u"&&!e.includes(window.location.hostname),g=()=>{if(a)return a;if(s==="_blank")return c?"noopener noreferrer":"noopener"},C={color:k,colorShade:x,variant:T,fullWidth:$,size:B,prefixIcon:L,fontFamily:S,isDisabled:l},p={$isButton:d,$withUnderline:D,rel:g(),"aria-label":t},u=X(r,w,d,b,C);return c?i(E,{href:e,target:s??"_blank",...p,"data-testid":"external-link",children:u}):i(N,{to:e,target:s??"_self",...p,"data-testid":"internal-link","aria-disabled":l,tabIndex:l?-1:void 0,children:u})};export{y as Link,y as default};
|
package/package.json
CHANGED
package/package.json.tmp
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ColorShade, ColorWithNeutral, FontFamily, Size, TypographyType, Variant } from '../../Types';
|
|
3
|
-
type Path = `/${string}`;
|
|
4
|
-
type HttpUrl = `http://${string}`;
|
|
5
|
-
type HttpsUrl = `https://${string}`;
|
|
3
|
+
export type Path = `/${string}`;
|
|
4
|
+
export type HttpUrl = `http://${string}`;
|
|
5
|
+
export type HttpsUrl = `https://${string}`;
|
|
6
6
|
interface BaseLinkProps {
|
|
7
7
|
typographyType?: TypographyType;
|
|
8
8
|
target?: '_blank' | '_self' | '_parent' | '_top';
|
|
@@ -25,12 +25,9 @@ export type LinkProps = BaseLinkProps & ({
|
|
|
25
25
|
} | {
|
|
26
26
|
text?: never;
|
|
27
27
|
children: ReactNode;
|
|
28
|
-
}) &
|
|
29
|
-
path
|
|
30
|
-
url?:
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
url: HttpUrl | HttpsUrl;
|
|
34
|
-
});
|
|
35
|
-
export declare const Link: ({ path, text, url, rel, ariaLabel, typographyType, target, isButton, buttonColor, buttonColorShade, buttonVariant, fullWidth, buttonSize, withUnderline, buttonPrefixIcon, children, fontFamily, isDisabled, }: LinkProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
}) & {
|
|
29
|
+
path?: Path;
|
|
30
|
+
url?: HttpUrl | HttpsUrl;
|
|
31
|
+
};
|
|
32
|
+
export declare const Link: ({ path, text, url, rel, ariaLabel, typographyType, target, isButton, buttonColor, buttonColorShade, buttonVariant, fullWidth, buttonSize, withUnderline, buttonPrefixIcon, children, fontFamily, isDisabled, }: LinkProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
36
33
|
export default Link;
|