@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"),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,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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kvdbil/components",
3
- "version": "17.4.2",
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.2",
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[];