@kvdbil/components 17.4.2 → 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"),
|
|
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,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};
|
package/package.json
CHANGED
package/package.json.tmp
CHANGED