@kvdbil/components 8.2.1 → 8.3.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.
@@ -78,4 +78,4 @@
78
78
  user-select: none;
79
79
  color: ${({theme:x,isDisabled:k})=>k?x.colors.text.disabled:x.colors.text.dark};
80
80
  margin-left: 0.5rem;
81
- `,g=({name:x=t.generateNameHash("check-box"),isDisabled:k=!1,size:j="regular",checked:v,color:y="secondary",onClick:q,label:$,...D})=>d.default.createElement(p,null,d.default.createElement(o.default,{onClick:q,isActive:v,isDisabled:k,color:y},d.default.createElement(b,{...D,"data-validate":"checked",name:x,id:x,color:y,disabled:k,isDisabled:k}),d.default.createElement(m,{size:j,color:y,isChecked:v,isDisabled:k},d.default.createElement(s.default,null))),$&&d.default.createElement(f,{as:"label",htmlFor:x,isDisabled:k},$));exports.CheckBox=g,exports.default=g;
81
+ `,g=({name:x=t.generateNameHash("check-box"),isDisabled:k=!1,size:j="regular",checked:y=!1,color:v="secondary",onClick:q,label:$,...D})=>d.default.createElement(p,null,d.default.createElement(o.default,{noTabIndex:!0,onClick:q,isActive:y,isDisabled:k,color:v},d.default.createElement(b,{...D,checked:y,"data-validate":"checked",name:x,id:x,color:v,disabled:k,isDisabled:k}),d.default.createElement(m,{size:j,color:v,isChecked:y,isDisabled:k},d.default.createElement(s.default,null))),$&&d.default.createElement(f,{as:"label",htmlFor:x,isDisabled:k},$));exports.CheckBox=g,exports.default=g;
@@ -1,9 +1,9 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("styled-components");function o(s){return s&&typeof s=="object"&&"default"in s?s:{default:s}}var i=o(e),r=o(t);const c=t.css`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("styled-components");function o(s){return s&&typeof s=="object"&&"default"in s?s:{default:s}}var i=o(e),r=o(t);const n=t.css`
2
2
  background-color: transparent;
3
- `,n=t.css`
3
+ `,c=t.css`
4
4
  background-color: ${({theme:s,color:b})=>s.colors[b].main};
5
5
  opacity: 0.1;
6
- ${s=>s.isDisabled&&c};
6
+ ${s=>s.isDisabled&&n};
7
7
  `,a=r.default.div`
8
8
  cursor: ${s=>s.isDisabled?"default":"pointer"};
9
9
  outline: none;
@@ -20,7 +20,7 @@
20
20
  :hover {
21
21
  .button-background {
22
22
  transition: background-color ${"400ms"};
23
- ${n}
23
+ ${c}
24
24
  }
25
25
  }
26
26
 
@@ -28,14 +28,14 @@
28
28
  .button-background {
29
29
  transition: background-color ${"400ms"};
30
30
  animation: FocusRipple ${"1500ms"} 0ms infinite alternate-reverse;
31
- ${n}
31
+ ${c}
32
32
  }
33
33
  }
34
34
 
35
35
  :active {
36
36
  .button-background {
37
37
  animation: ActiveRipple ${"750ms"};
38
- ${n}
38
+ ${c}
39
39
  }
40
40
  }
41
41
 
@@ -72,4 +72,4 @@
72
72
 
73
73
  position: absolute;
74
74
  border-radius: 10rem;
75
- `;exports.BackgroundStyles=n,exports.default=({children:s,isActive:b,isDisabled:p,onClick:d,color:f})=>i.default.createElement(a,{color:f,isActive:b,isDisabled:p,onClick:u=>{u.stopPropagation(),u.preventDefault(),u.persist(),p||typeof d!="function"||d(u)},onKeyDown:u=>{u.key!=="Enter"||p||typeof d!="function"||(u.persist(),d(u))},tabIndex:p?void 0:0},i.default.createElement(l,{className:"button-background"}),s);
75
+ `;exports.BackgroundStyles=c,exports.default=({children:s,isActive:b,isDisabled:p,onClick:d,noTabIndex:f=!1,color:m})=>i.default.createElement(a,{color:m,isActive:b,isDisabled:p,onClick:u=>{u.stopPropagation(),u.preventDefault(),u.persist(),p||typeof d!="function"||d(u)},onKeyDown:u=>{u.key!=="Enter"||p||typeof d!="function"||(u.persist(),d(u))},tabIndex:p||f?void 0:0},i.default.createElement(l,{className:"button-background"}),s);
@@ -1,4 +1,4 @@
1
- import o from"react";import c,{css as r}from"styled-components";import{generateNameHash as p}from"../../shared/helpers.js";import i from"../../theme.js";import{BodyText as g}from"../../typography/BodyText/index.js";import x,{BackgroundStyles as u}from"../IconButton.js";import b from"../../icons/components/CheckmarkIcon.js";import"../../shared/media-queries.js";const k=r`
1
+ import o from"react";import s,{css as r}from"styled-components";import{generateNameHash as p}from"../../shared/helpers.js";import i from"../../theme.js";import{BodyText as g}from"../../typography/BodyText/index.js";import x,{BackgroundStyles as u}from"../IconButton.js";import b from"../../icons/components/CheckmarkIcon.js";import"../../shared/media-queries.js";const y=r`
2
2
  width: 24px;
3
3
  height: 24px;
4
4
 
@@ -6,7 +6,7 @@ import o from"react";import c,{css as r}from"styled-components";import{generateN
6
6
  width: 15px;
7
7
  height: 15px;
8
8
  }
9
- `,y=r`
9
+ `,f=r`
10
10
  width: 32px;
11
11
  height: 32px;
12
12
 
@@ -14,7 +14,7 @@ import o from"react";import c,{css as r}from"styled-components";import{generateN
14
14
  width: 22px;
15
15
  height: 22px;
16
16
  }
17
- `,f={regular:k,large:y},$=r`
17
+ `,k={regular:y,large:f},$=r`
18
18
  cursor: default;
19
19
  border: 2px solid ${i.colors.gray.light2};
20
20
  `,v=e=>r`
@@ -29,11 +29,11 @@ import o from"react";import c,{css as r}from"styled-components";import{generateN
29
29
  border: 2px solid ${i.colors[e].main};
30
30
  `,C=r`
31
31
  background: ${i.colors.gray.light2};
32
- `,j=c.div`
32
+ `,j=s.div`
33
33
  display: flex;
34
34
  align-items: center;
35
35
  box-sizing: border-box;
36
- `,w=c.input.attrs({type:"checkbox"})`
36
+ `,w=s.input.attrs({type:"checkbox"})`
37
37
  position: absolute;
38
38
  appearance: none;
39
39
  width: 100%;
@@ -52,7 +52,7 @@ import o from"react";import c,{css as r}from"styled-components";import{generateN
52
52
  transition: background-color 400ms;
53
53
  ${u}
54
54
  }
55
- `,z=c.span`
55
+ `,z=s.span`
56
56
  box-sizing: border-box;
57
57
  cursor: pointer;
58
58
  display: flex;
@@ -62,7 +62,7 @@ import o from"react";import c,{css as r}from"styled-components";import{generateN
62
62
 
63
63
  border: 2px solid ${i.colors.gray.dark5};
64
64
 
65
- ${e=>f[e.size]};
65
+ ${e=>k[e.size]};
66
66
 
67
67
  svg {
68
68
  opacity: 0;
@@ -73,9 +73,9 @@ import o from"react";import c,{css as r}from"styled-components";import{generateN
73
73
  ${e=>e.isDisabled&&$};
74
74
 
75
75
  ${e=>e.isChecked&&e.isDisabled&&C};
76
- `,B=c(g)`
76
+ `,B=s(g)`
77
77
  cursor: ${({isDisabled:e})=>e?"default":"pointer"};
78
78
  user-select: none;
79
79
  color: ${({theme:e,isDisabled:t})=>t?e.colors.text.disabled:e.colors.text.dark};
80
80
  margin-left: 0.5rem;
81
- `,l=({name:e=p("check-box"),isDisabled:t=!1,size:d="regular",checked:a,color:s="secondary",onClick:m,label:n,...h})=>o.createElement(j,null,o.createElement(x,{onClick:m,isActive:a,isDisabled:t,color:s},o.createElement(w,{...h,"data-validate":"checked",name:e,id:e,color:s,disabled:t,isDisabled:t}),o.createElement(z,{size:d,color:s,isChecked:a,isDisabled:t},o.createElement(b,null))),n&&o.createElement(B,{as:"label",htmlFor:e,isDisabled:t},n));export{l as CheckBox,l as default};
81
+ `,l=({name:e=p("check-box"),isDisabled:t=!1,size:d="regular",checked:a=!1,color:c="secondary",onClick:m,label:n,...h})=>o.createElement(j,null,o.createElement(x,{noTabIndex:!0,onClick:m,isActive:a,isDisabled:t,color:c},o.createElement(w,{...h,checked:a,"data-validate":"checked",name:e,id:e,color:c,disabled:t,isDisabled:t}),o.createElement(z,{size:d,color:c,isChecked:a,isDisabled:t},o.createElement(b,null))),n&&o.createElement(B,{as:"label",htmlFor:e,isDisabled:t},n));export{l as CheckBox,l as default};
@@ -1,10 +1,10 @@
1
- import i from"react";import a,{css as s}from"styled-components";const m=s`
1
+ import a from"react";import i,{css as s}from"styled-components";const f=s`
2
2
  background-color: transparent;
3
- `,l="400ms",f="1500ms",b="750ms",c=s`
3
+ `,l="400ms",b="1500ms",k="750ms",c=s`
4
4
  background-color: ${({theme:o,color:r})=>o.colors[r].main};
5
5
  opacity: 0.1;
6
- ${o=>o.isDisabled&&m};
7
- `,k=a.div`
6
+ ${o=>o.isDisabled&&f};
7
+ `,g=i.div`
8
8
  cursor: ${o=>o.isDisabled?"default":"pointer"};
9
9
  outline: none;
10
10
 
@@ -27,14 +27,14 @@ import i from"react";import a,{css as s}from"styled-components";const m=s`
27
27
  :focus {
28
28
  .button-background {
29
29
  transition: background-color ${l};
30
- animation: FocusRipple ${f} 0ms infinite alternate-reverse;
30
+ animation: FocusRipple ${b} 0ms infinite alternate-reverse;
31
31
  ${c}
32
32
  }
33
33
  }
34
34
 
35
35
  :active {
36
36
  .button-background {
37
- animation: ActiveRipple ${b};
37
+ animation: ActiveRipple ${k};
38
38
  ${c}
39
39
  }
40
40
  }
@@ -62,7 +62,7 @@ import i from"react";import a,{css as s}from"styled-components";const m=s`
62
62
  clip-path: circle(50%);
63
63
  }
64
64
  }
65
- `,g=a.div`
65
+ `,h=i.div`
66
66
  top: 0;
67
67
  left: 0;
68
68
 
@@ -72,4 +72,4 @@ import i from"react";import a,{css as s}from"styled-components";const m=s`
72
72
 
73
73
  position: absolute;
74
74
  border-radius: 10rem;
75
- `,h=({children:o,isActive:r,isDisabled:e,onClick:n,color:p})=>{const u=t=>{t.key==="Enter"&&!e&&typeof n=="function"&&(t.persist(),n(t))},d=t=>{t.stopPropagation(),t.preventDefault(),t.persist(),!e&&typeof n=="function"&&n(t)};return i.createElement(k,{color:p,isActive:r,isDisabled:e,onClick:d,onKeyDown:u,tabIndex:e?void 0:0},i.createElement(g,{className:"button-background"}),o)};export{c as BackgroundStyles,h as default};
75
+ `,y=({children:o,isActive:r,isDisabled:e,onClick:n,noTabIndex:p=!1,color:u})=>{const d=t=>{t.key==="Enter"&&!e&&typeof n=="function"&&(t.persist(),n(t))},m=t=>{t.stopPropagation(),t.preventDefault(),t.persist(),!e&&typeof n=="function"&&n(t)};return a.createElement(g,{color:u,isActive:r,isDisabled:e,onClick:m,onKeyDown:d,tabIndex:e||p?void 0:0},a.createElement(h,{className:"button-background"}),o)};export{c as BackgroundStyles,y as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kvdbil/components",
3
- "version": "8.2.1",
3
+ "version": "8.3.0",
4
4
  "sideEffects": false,
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -5,7 +5,7 @@ export interface CheckBoxProps {
5
5
  size?: CheckboxSize;
6
6
  value?: string;
7
7
  color?: Color;
8
- checked: boolean;
8
+ checked?: boolean;
9
9
  isDisabled?: boolean;
10
10
  onClick?(): void;
11
11
  label?: ReactNode;
@@ -9,7 +9,8 @@ interface Props {
9
9
  children: ReactNode;
10
10
  isActive: boolean;
11
11
  isDisabled: boolean;
12
+ noTabIndex?: boolean;
12
13
  onClick?(event: MouseEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement>): void;
13
14
  }
14
- declare const IconButton: ({ children, isActive, isDisabled, onClick, color, }: Props) => JSX.Element;
15
+ declare const IconButton: ({ children, isActive, isDisabled, onClick, noTabIndex, color, }: Props) => JSX.Element;
15
16
  export default IconButton;