@kvdbil/components 17.4.1 → 17.5.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.
@@ -1,51 +1,36 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("styled-components"),o=require("react-collapse"),s=require("../../shared/media-queries.js"),i=require("../../icons/components/ArrowDownIcon.js"),n=require("../../hooks/useNameAndId.js");require("../../shared/helpers.js");var a,l=(a=r)&&a.__esModule?a:{default:a};const d=l.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("styled-components"),i=require("react-collapse"),o=require("../../hooks/useNameAndId.js"),s=require("../ToggleArrow/index.js"),d=require("../../typography/BodyText/index.js");require("../../shared/helpers.js"),require("../../icons/components/ShowMoreIcon.js"),require("../../shared/media-queries.js");var l,n=(l=t)&&l.__esModule?l:{default:l};const a=n.default.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  .ReactCollapse--collapse {
5
5
  transition: height 300ms;
6
6
  }
7
- `,c=l.default.ul`
7
+ `,c=n.default.ul`
8
8
  margin: 0;
9
9
  padding: 0;
10
10
  list-style: none;
11
- `,m=l.default.div`
11
+ `,u=n.default.div`
12
12
  display: flex;
13
13
  flex-direction: row;
14
14
  justify-content: space-between;
15
15
  cursor: pointer;
16
- margin: 0.5rem 0;
17
- `,u=l.default.div`
18
- display: flex;
19
- justify-content: center;
20
- align-items: center;
21
- font-size: 0.75rem;
22
- color: ${({theme:e})=>e.colors.text.dark};
23
- transition: 200ms ease-in-out;
24
- transform: ${({isOpen:e})=>`rotate(${e?"180deg":"0deg"})`};
25
- `,p=l.default.li`
16
+ padding: 1rem 0;
17
+ `,p=n.default.li`
26
18
  border-top: ${({theme:e})=>`1px solid ${e.colors.grayscaleToned.light2}`};
27
- padding: ${({isOpen:e})=>e?"0.5rem 0 1rem 0":"0.5rem 0"};
28
19
 
29
20
  &:last-child {
30
21
  border-bottom: ${({theme:e})=>`1px solid ${e.colors.grayscaleToned.light2}`};
31
22
  }
32
- `,h=l.default.span`
33
- color: ${({theme:e})=>e.colors.text.dark};
34
- font-family: ${({theme:e})=>e.typography.fontBaseFamily};
35
- font-size: 0.9375rem;
36
- font-weight: ${({theme:e})=>e.typography.fontBaseBoldWeight};
37
- `,f=l.default.div`
38
- font-family: ${({theme:e})=>e.typography.fontBaseFamily};
39
- color: ${({theme:e})=>e.colors.text.dark};
40
- font-size: 0.9375rem;
41
- font-weight: ${({theme:e})=>e.typography.fontBaseRegularWeight};
42
- line-height: 1.3;
43
- transition: 200ms ease-in-out;
44
- ${s.mq("tablet")} {
45
- padding: 0;
46
- }
47
- & > * {
23
+ `,x=n.default.div`
24
+ padding-bottom: 1rem;
25
+
26
+ & > :first-child,
27
+ & > * :first-child {
48
28
  margin-top: 0;
29
+ padding-top: 0;
30
+ }
31
+ & > :last-child,
32
+ & > * :last-child {
49
33
  margin-bottom: 0;
34
+ padding-bottom: 0rem;
50
35
  }
51
- `,y=({items:r,...s})=>{const[a,l]=t.useState({}),{id:y}=n.useNameAndId("accordion"),g=e=>{l((t=>({...t,[e]:!t[e]})))},x=e=>()=>{g(e)},$=e=>t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),g(e))};return e.jsx(d,{...s,children:e.jsx(c,{className:"accordionList",children:r.map(((t,r)=>{const s=!!a[r],n=`${y}-${r}-header`,l=`${y}-${r}-content`;return e.jsxs(p,{isOpen:s,className:"accordionItem",children:[e.jsxs(m,{id:n,onClick:x(r),onKeyDown:$(r),className:"accordionItemTitle",role:"button",tabIndex:0,"aria-expanded":s,"aria-controls":l,children:[e.jsx(h,{as:"span",children:t.title}),e.jsx(u,{isOpen:s,children:e.jsx(i.default,{})})]}),e.jsx(o.UnmountClosed,{isOpened:s,children:e.jsx(f,{id:l,"aria-labelledby":n,role:"region",className:"wysiwyg",dangerouslySetInnerHTML:{__html:t.text}})},r)]},t.title)}))})})};exports.Accordion=y,exports.default=y;
36
+ `,m=({items:t,...l})=>{const[n,m]=r.useState({}),{id:h}=o.useNameAndId("accordion"),f=e=>{m((r=>({...r,[e]:!r[e]})))},g=e=>()=>{f(e)},j=e=>r=>{("Enter"===r.key||" "===r.key)&&(r.preventDefault(),f(e))};return e.jsx(a,{...l,children:e.jsx(c,{className:"accordionList",children:t.map(((r,t)=>{const o=!!n[t],l=`${h}-${t}-header`,a=`${h}-${t}-content`;return e.jsxs(p,{isOpen:o,className:"accordionItem",children:[e.jsxs(u,{id:l,onClick:g(t),onKeyDown:j(t),className:"accordionItemTitle",role:"button",tabIndex:0,"aria-expanded":o,"aria-controls":a,children:[e.jsx(d.BodyLink,{as:"span",children:r.title}),e.jsx(s.default,{isExpanded:o})]}),e.jsx(i.Collapse,{isOpened:o,children:e.jsx(x,{id:a,"aria-labelledby":l,role:"region",...o?null:{inert:""},children:"string"==typeof r.text?e.jsx(d.BodyText,{children:r.text}):r.text})},t)]},r.title)}))})})};exports.Accordion=m,exports.default=m;
@@ -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"),i=require("../../theme.js"),t=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 ${i.default.colors.info.dark}`:"none"};
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&&`${i.default.colors.info.dark}`};
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,i){switch(i){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(t.Headline,{as:"span",children:r});case"Title":return e.jsx(t.Title,{as:"span",children:r});case"Subtitle":return e.jsx(t.Subtitle,{as:"span",children:r});case"TinyTitleRegular":return e.jsx(t.TinyTitleRegular,{as:"span",children:r});case"TinyTitleBold":return e.jsx(t.TinyTitleBold,{as:"span",children:r});case"Display1":return e.jsx(t.Display1,{as:"span",children:r});case"Display2":return e.jsx(t.Display2,{as:"span",children:r});case"Display3":return e.jsx(t.Display3,{as:"span",children:r})}}const h=({path:n,text:r,url:i,rel:t,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:B,children:T,fontFamily:q,isDisabled:k=!1})=>{const m=i??n??"",g=m.startsWith("http")&&typeof window<"u"&&!m.includes(window.location.hostname),$={$isButton:d,$withUnderline:b,rel:t||("_blank"===o?g?"noopener noreferrer":"noopener":void 0),"aria-label":s},D=((n,r,i,t,s)=>e.jsxs(e.Fragment,{children:[r,i?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,t)]}))(r,T,d,l,{color:h,colorShade:x,variant:y,fullWidth:f,size:j,prefixIcon:B,fontFamily:q,isDisabled:k});return g?e.jsx(u,{href:m,target:o??"_blank",...$,"data-testid":"external-link",children:D}):e.jsx(c,{to:m,target:o??"_self",...$,"data-testid":"internal-link","aria-disabled":k,tabIndex:k?-1:void 0,children:D})};exports.Link=h,exports.default=h;
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,51 +1,36 @@
1
- import{jsx as i,jsxs as d}from"react/jsx-runtime";import{useState as $}from"react";import r from"styled-components";import{UnmountClosed as u}from"react-collapse";import{mq as x}from"../../shared/media-queries.js";import b from"../../icons/components/ArrowDownIcon.js";import{useNameAndId as w}from"../../hooks/useNameAndId.js";import"../../shared/helpers.js";const k=r.div`
1
+ import{jsx as i,jsxs as c}from"react/jsx-runtime";import{useState as y}from"react";import n from"styled-components";import{Collapse as b}from"react-collapse";import{useNameAndId as u}from"../../hooks/useNameAndId.js";import $ from"../ToggleArrow/index.js";import{BodyLink as k,BodyText as v}from"../../typography/BodyText/index.js";import"../../shared/helpers.js";import"../../icons/components/ShowMoreIcon.js";import"../../shared/media-queries.js";const T=n.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  .ReactCollapse--collapse {
5
5
  transition: height 300ms;
6
6
  }
7
- `,O=r.ul`
7
+ `,I=n.ul`
8
8
  margin: 0;
9
9
  padding: 0;
10
10
  list-style: none;
11
- `,v=r.div`
11
+ `,N=n.div`
12
12
  display: flex;
13
13
  flex-direction: row;
14
14
  justify-content: space-between;
15
15
  cursor: pointer;
16
- margin: 0.5rem 0;
17
- `,B=r.div`
18
- display: flex;
19
- justify-content: center;
20
- align-items: center;
21
- font-size: 0.75rem;
22
- color: ${({theme:e})=>e.colors.text.dark};
23
- transition: 200ms ease-in-out;
24
- transform: ${({isOpen:e})=>`rotate(${e?"180deg":"0deg"})`};
25
- `,I=r.li`
26
- border-top: ${({theme:e})=>`1px solid ${e.colors.grayscaleToned.light2}`};
27
- padding: ${({isOpen:e})=>e?"0.5rem 0 1rem 0":"0.5rem 0"};
16
+ padding: 1rem 0;
17
+ `,j=n.li`
18
+ border-top: ${({theme:o})=>`1px solid ${o.colors.grayscaleToned.light2}`};
28
19
 
29
20
  &:last-child {
30
- border-bottom: ${({theme:e})=>`1px solid ${e.colors.grayscaleToned.light2}`};
31
- }
32
- `,N=r.span`
33
- color: ${({theme:e})=>e.colors.text.dark};
34
- font-family: ${({theme:e})=>e.typography.fontBaseFamily};
35
- font-size: 0.9375rem;
36
- font-weight: ${({theme:e})=>e.typography.fontBaseBoldWeight};
37
- `,T=r.div`
38
- font-family: ${({theme:e})=>e.typography.fontBaseFamily};
39
- color: ${({theme:e})=>e.colors.text.dark};
40
- font-size: 0.9375rem;
41
- font-weight: ${({theme:e})=>e.typography.fontBaseRegularWeight};
42
- line-height: 1.3;
43
- transition: 200ms ease-in-out;
44
- ${x("tablet")} {
45
- padding: 0;
21
+ border-bottom: ${({theme:o})=>`1px solid ${o.colors.grayscaleToned.light2}`};
46
22
  }
47
- & > * {
23
+ `,w=n.div`
24
+ padding-bottom: 1rem;
25
+
26
+ & > :first-child,
27
+ & > * :first-child {
48
28
  margin-top: 0;
29
+ padding-top: 0;
30
+ }
31
+ & > :last-child,
32
+ & > * :last-child {
49
33
  margin-bottom: 0;
34
+ padding-bottom: 0rem;
50
35
  }
51
- `,c=({items:e,...p})=>{const[h,f]=$({}),{id:a}=w("accordion"),s=o=>{f(t=>({...t,[o]:!t[o]}))},g=o=>()=>{s(o)},y=o=>t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),s(o))};return i(k,{...p,children:i(O,{className:"accordionList",children:e.map((o,t)=>{const n=!!h[t],l=`${a}-${t}-header`,m=`${a}-${t}-content`;return d(I,{isOpen:n,className:"accordionItem",children:[d(v,{id:l,onClick:g(t),onKeyDown:y(t),className:"accordionItemTitle",role:"button",tabIndex:0,"aria-expanded":n,"aria-controls":m,children:[i(N,{as:"span",children:o.title}),i(B,{isOpen:n,children:i(b,{})})]}),i(u,{isOpened:n,children:i(T,{id:m,"aria-labelledby":l,role:"region",className:"wysiwyg",dangerouslySetInnerHTML:{__html:o.text}})},t)]},o.title)})})})};export{c as Accordion,c as default};
36
+ `,m=({items:o,...p})=>{const[h,f]=y({}),{id:l}=u("accordion"),d=e=>{f(t=>({...t,[e]:!t[e]}))},g=e=>()=>{d(e)},x=e=>t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),d(e))};return i(T,{...p,children:i(I,{className:"accordionList",children:o.map((e,t)=>{const r=!!h[t],a=`${l}-${t}-header`,s=`${l}-${t}-content`;return c(j,{isOpen:r,className:"accordionItem",children:[c(N,{id:a,onClick:g(t),onKeyDown:x(t),className:"accordionItemTitle",role:"button",tabIndex:0,"aria-expanded":r,"aria-controls":s,children:[i(k,{as:"span",children:e.title}),i($,{isExpanded:r})]}),i(b,{isOpened:r,children:i(w,{id:s,"aria-labelledby":a,role:"region",...r?null:{inert:""},children:typeof e.text=="string"?i(v,{children:e.text}):e.text})},t)]},e.title)})})})};export{m as Accordion,m as default};
@@ -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 J,Display1 as K,TinyTitleBold as M,TinyTitleRegular as O,Subtitle as P,Title as V,Headline as q}from"../../typography/Heading/index.js";import{Button as A}from"../Button/index.js";import{Link as E}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`
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
- `,G=h.a`
8
+ `,E=h.a`
9
9
  ${m}
10
- `,N=h(E)`
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(q,{as:"span",children:n});case"Title":return i(V,{as:"span",children:n});case"Subtitle":return i(P,{as:"span",children:n});case"TinyTitleRegular":return i(O,{as:"span",children:n});case"TinyTitleBold":return i(M,{as:"span",children:n});case"Display1":return i(K,{as:"span",children:n});case"Display2":return i(J,{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(A,{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:w,children:L,fontFamily:S,isDisabled:l=!1})=>{const e=o??n??"",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:w,fontFamily:S,isDisabled:l},p={$isButton:d,$withUnderline:D,rel:g(),"aria-label":t},u=X(r,L,d,b,C);return c?i(G,{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};
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kvdbil/components",
3
- "version": "17.4.1",
3
+ "version": "17.5.0",
4
4
  "sideEffects": false,
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
package/package.json.tmp CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kvdbil/components",
3
- "version": "17.4.1",
3
+ "version": "17.5.0",
4
4
  "sideEffects": false,
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -1,6 +1,7 @@
1
+ import { ReactNode } from 'react';
1
2
  interface IItem {
2
3
  title: string;
3
- text: string;
4
+ text: ReactNode;
4
5
  }
5
6
  export interface AccordionProps {
6
7
  items: IItem[];
@@ -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: Path;
30
- url?: never;
31
- } | {
32
- path?: never;
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;