@kvdbil/components 13.9.1 → 13.9.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,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("./Tab.js"),r=require("styled-components"),l=require("../../shared/media-queries.js"),i=require("react-collapse"),n=require("../../typography/Heading/index.js");function a(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("./Tab.js"),r=require("styled-components"),l=require("../../shared/media-queries.js"),i=require("react-collapse"),n=require("../../typography/Heading/index.js");function a(h){return h&&typeof h=="object"&&"default"in h?h:{default:h}}require("../Button/index.js"),require("../../theme.js"),require("../Spinner/index.js"),require("../../typography/ButtonText/index.js"),require("../Button/styles.js"),require("../../utils/utils.js");var o=a(e),d=a(r);const s=d.default.div`
|
|
2
2
|
.ReactCollapse--collapse {
|
|
3
3
|
transition: height 300ms;
|
|
4
4
|
}
|
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
margin: 0.5rem 0;
|
|
9
9
|
display: flex;
|
|
10
10
|
flex-direction: row;
|
|
11
|
-
justify-content:
|
|
11
|
+
justify-content: ${({justify:h})=>h};
|
|
12
12
|
align-items: center;
|
|
13
13
|
|
|
14
|
-
${({theme:
|
|
15
|
-
border-bottom: 3px solid ${
|
|
14
|
+
${({theme:h,fullWidthBorder:A,borderColor:x})=>A?`border-bottom: 3px solid ${h.colors.gray[x]};`:`& > li {
|
|
15
|
+
border-bottom: 3px solid ${h.colors.gray[x]};
|
|
16
16
|
}`}
|
|
17
17
|
|
|
18
18
|
${l.mq(null,"mobileL")} {
|
|
19
19
|
flex-direction: column;
|
|
20
|
-
justify-content: ${({justify:
|
|
20
|
+
justify-content: ${({justify:h})=>h};
|
|
21
21
|
}
|
|
22
22
|
`,c=d.default(n.Title)`
|
|
23
23
|
margin: 0;
|
|
@@ -25,4 +25,4 @@
|
|
|
25
25
|
display: flex;
|
|
26
26
|
`,f=d.default.div`
|
|
27
27
|
padding: 0.5rem 0;
|
|
28
|
-
`,b=d.default.div``,m=({activeColor:
|
|
28
|
+
`,b=d.default.div``,m=({activeColor:h="secondary",justify:A="end",activeIndex:x,initalActive:I,children:U=[],kbNavAutoOpen:T=!0,onTabClick:O,fullWidthBorder:_=!0,borderColor:H="light6",headline:R})=>{var W,L;const q=e.Children.map(U,y=>y),[k,D]=e.useState(()=>I!=null?I:q.findIndex(y=>!y.props.isDisabled)),S=e.useRef([]),K=Boolean((L=(W=q[k])==null?void 0:W.props)==null?void 0:L.children);e.useEffect(()=>{x!==void 0&&D(x)},[x]);const M=(y,v)=>{if(y.preventDefault(),y.key!=="Enter"||T||D(v),y.key==="ArrowLeft"||y.key==="ArrowRight"){const g=T?k:v,j=y.key==="ArrowRight",E=j?g+1:0,w=j?q.length:g,$=q.slice(E,w);j||$.reverse();const B=$.findIndex(C=>!C.props.isDisabled);if(B!==-1){const C=j?g+(B+1):g-(B+1);T&&D(C),S.current[C].focus()}}};return o.default.createElement(s,null,o.default.createElement(i.UnmountClosed,{isOpened:!0},o.default.createElement(u,{fullWidthBorder:_,justify:R?"space-between":A,role:"tablist",borderColor:H},R&&o.default.createElement(c,null,R),o.default.createElement(p,null,q.map((y,v)=>{if(!y)return null;const g=k===v;return o.default.createElement(t.default,{key:v,label:y.props.label,isDisabled:y.props.isDisabled,index:v,id:v,isActive:k===v,activeColor:h,onClick:(j,E)=>{var w,$;g||y.props.isDisabled||(($=(w=y.props).onClick)==null||$.call(w,j,E),O==null||O(j,E),((B,C)=>{B.preventDefault(),D(C)})(j,E))},onKeyUp:M,ref:j=>S.current[v]=j})}))),K&&o.default.createElement(f,null,q.map((y,v)=>{const g=y.props.children&&k===v;return o.default.createElement(b,{key:v,id:`tabpanel-${v}`,role:"tabpanel","aria-labelledby":`tab-${v}`,"aria-hidden":g?"false":"true"},g&&y.props.children)}))))};exports.Tabs=m,exports.default=m;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o,{Children as A,useState as B,useRef as S,useEffect as H}from"react";import I from"./Tab.js";import a from"styled-components";import{mq as P}from"../../shared/media-queries.js";import{UnmountClosed as U}from"react-collapse";import{Title as q}from"../../typography/Heading/index.js";import"../Button/index.js";import"../../theme.js";import"../Spinner/index.js";import"../../typography/ButtonText/index.js";import"../Button/styles.js";import"../../utils/utils.js";const F=a.div`
|
|
2
2
|
.ReactCollapse--collapse {
|
|
3
3
|
transition: height 300ms;
|
|
4
4
|
}
|
|
@@ -8,16 +8,16 @@ import l,{Children as A,useState as B,useRef as S,useEffect as H}from"react";imp
|
|
|
8
8
|
margin: 0.5rem 0;
|
|
9
9
|
display: flex;
|
|
10
10
|
flex-direction: row;
|
|
11
|
-
justify-content:
|
|
11
|
+
justify-content: ${({justify:s})=>s};
|
|
12
12
|
align-items: center;
|
|
13
13
|
|
|
14
|
-
${({theme:
|
|
15
|
-
border-bottom: 3px solid ${
|
|
14
|
+
${({theme:s,fullWidthBorder:b,borderColor:l})=>b?`border-bottom: 3px solid ${s.colors.gray[l]};`:`& > li {
|
|
15
|
+
border-bottom: 3px solid ${s.colors.gray[l]};
|
|
16
16
|
}`}
|
|
17
17
|
|
|
18
18
|
${P(null,"mobileL")} {
|
|
19
19
|
flex-direction: column;
|
|
20
|
-
justify-content: ${({justify:
|
|
20
|
+
justify-content: ${({justify:s})=>s};
|
|
21
21
|
}
|
|
22
22
|
`,L=a(q)`
|
|
23
23
|
margin: 0;
|
|
@@ -25,4 +25,4 @@ import l,{Children as A,useState as B,useRef as S,useEffect as H}from"react";imp
|
|
|
25
25
|
display: flex;
|
|
26
26
|
`,G=a.div`
|
|
27
27
|
padding: 0.5rem 0;
|
|
28
|
-
`,J=a.div``,D=({activeColor:
|
|
28
|
+
`,J=a.div``,D=({activeColor:s="secondary",justify:b="end",activeIndex:l,initalActive:T,children:$=[],kbNavAutoOpen:y=!0,onTabClick:j,fullWidthBorder:R=!0,borderColor:k="light6",headline:h})=>{var v,E;const i=A.map($,e=>e),[c,m]=B(()=>T!=null?T:i.findIndex(e=>!e.props.isDisabled)),C=S([]),w=Boolean((E=(v=i[c])==null?void 0:v.props)==null?void 0:E.children),_=(e,t)=>{e.preventDefault(),m(t)};H(()=>{typeof l!="undefined"&&m(l)},[l]);const x=(e,t)=>{if(e.preventDefault(),e.key==="Enter"&&!y&&m(t),e.key==="ArrowLeft"||e.key==="ArrowRight"){const n=y?c:t,r=e.key==="ArrowRight",d=r?n+1:0,u=r?i.length:n,p=i.slice(d,u);r||p.reverse();const g=p.findIndex(f=>!f.props.isDisabled);if(g!==-1){const f=r?n+(g+1):n-(g+1);y&&m(f),C.current[f].focus()}}};return o.createElement(F,null,o.createElement(U,{isOpened:!0},o.createElement(K,{fullWidthBorder:R,justify:h?"space-between":b,role:"tablist",borderColor:k},h&&o.createElement(L,null,h),o.createElement(z,null,i.map((e,t)=>{if(!e)return null;const n=c===t;return o.createElement(I,{key:t,label:e.props.label,isDisabled:e.props.isDisabled,index:t,id:t,isActive:c===t,activeColor:s,onClick:(r,d)=>{var u,p;!n&&!e.props.isDisabled&&((p=(u=e.props).onClick)==null||p.call(u,r,d),j==null||j(r,d),_(r,d))},onKeyUp:x,ref:r=>C.current[t]=r})}))),w&&o.createElement(G,null,i.map((e,t)=>{const n=e.props.children&&c===t;return o.createElement(J,{key:t,id:`tabpanel-${t}`,role:"tabpanel","aria-labelledby":`tab-${t}`,"aria-hidden":n?"false":"true"},n&&e.props.children)}))))};export{D as Tabs,D as default};
|