@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.
- package/cjs/components/Accordion/index.js +16 -31
- package/cjs/components/Link/index.js +4 -4
- package/esm/components/Accordion/index.js +18 -33
- package/esm/components/Link/index.js +4 -4
- package/package.json +1 -1
- package/package.json.tmp +1 -1
- package/types/components/Accordion/index.d.ts +2 -1
- package/types/components/Link/index.d.ts +8 -11
|
@@ -1,51 +1,36 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),
|
|
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=
|
|
7
|
+
`,c=n.default.ul`
|
|
8
8
|
margin: 0;
|
|
9
9
|
padding: 0;
|
|
10
10
|
list-style: none;
|
|
11
|
-
`,
|
|
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
|
-
|
|
17
|
-
`,
|
|
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
|
-
`,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
`,
|
|
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"),
|
|
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,51 +1,36 @@
|
|
|
1
|
-
import{jsx as i,jsxs as
|
|
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
|
-
`,
|
|
7
|
+
`,I=n.ul`
|
|
8
8
|
margin: 0;
|
|
9
9
|
padding: 0;
|
|
10
10
|
list-style: none;
|
|
11
|
-
`,
|
|
11
|
+
`,N=n.div`
|
|
12
12
|
display: flex;
|
|
13
13
|
flex-direction: row;
|
|
14
14
|
justify-content: space-between;
|
|
15
15
|
cursor: pointer;
|
|
16
|
-
|
|
17
|
-
`,
|
|
18
|
-
|
|
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:
|
|
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
|
-
`,
|
|
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
|
|
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;
|