@kvdbil/components 8.2.1 → 8.3.3
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/CheckBox/index.js +23 -25
- package/cjs/components/IconButton.js +7 -7
- package/cjs/components/RadioButton/index.js +4 -4
- package/esm/components/CheckBox/index.js +25 -27
- package/esm/components/IconButton.js +8 -8
- package/esm/components/RadioButton/index.js +1 -1
- package/package.json +1 -1
- package/types/components/CheckBox/index.d.ts +5 -6
- package/types/components/IconButton.d.ts +2 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("styled-components"),t=require("../../shared/helpers.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("styled-components"),t=require("../../shared/helpers.js"),o=require("../../theme.js"),s=require("../../typography/BodyText/index.js"),i=require("../../icons/components/CheckmarkIcon.js"),a=require("../IconButton.js");function l(m){return m&&typeof m=="object"&&"default"in m?m:{default:m}}require("../../shared/media-queries.js");var d=l(e),c=l(r);const n={regular:r.css`
|
|
2
2
|
width: 24px;
|
|
3
3
|
height: 24px;
|
|
4
4
|
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
}
|
|
17
17
|
`},u=r.css`
|
|
18
18
|
cursor: default;
|
|
19
|
-
border: 2px solid ${
|
|
19
|
+
border: 2px solid ${o.default.colors.gray.light2};
|
|
20
20
|
`,h=r.css`
|
|
21
|
-
background: ${
|
|
21
|
+
background: ${o.default.colors.gray.light2};
|
|
22
22
|
`,p=c.default.div`
|
|
23
23
|
display: flex;
|
|
24
24
|
align-items: center;
|
|
@@ -30,36 +30,34 @@
|
|
|
30
30
|
height: 100%;
|
|
31
31
|
margin: 0;
|
|
32
32
|
padding: 0;
|
|
33
|
+
outline: none;
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
z-index: 1;
|
|
36
|
+
${m=>n[m.boxSize]};
|
|
33
37
|
|
|
34
38
|
:focus-visible {
|
|
35
|
-
outline: none;
|
|
36
|
-
height: calc(100% + 1rem);
|
|
37
|
-
width: calc(100% + 1rem);
|
|
38
|
-
top: -0.5rem;
|
|
39
|
-
left: -0.5rem;
|
|
40
|
-
appearance: initial;
|
|
41
|
-
border-radius: 10rem;
|
|
42
39
|
transition: background-color 400ms;
|
|
43
|
-
${
|
|
40
|
+
${a.BackgroundStyles}
|
|
44
41
|
}
|
|
45
|
-
`,
|
|
42
|
+
`,x=c.default.span`
|
|
46
43
|
box-sizing: border-box;
|
|
47
44
|
cursor: pointer;
|
|
48
45
|
display: flex;
|
|
49
46
|
position: relative;
|
|
50
47
|
align-items: center;
|
|
51
48
|
justify-content: center;
|
|
49
|
+
z-index: 0;
|
|
52
50
|
|
|
53
|
-
border: 2px solid ${
|
|
51
|
+
border: 2px solid ${o.default.colors.gray.dark5};
|
|
54
52
|
|
|
55
|
-
${
|
|
53
|
+
${m=>n[m.size]};
|
|
56
54
|
|
|
57
55
|
svg {
|
|
58
56
|
opacity: 0;
|
|
59
|
-
color: ${({theme:
|
|
57
|
+
color: ${({theme:m})=>m.colors.common.white};
|
|
60
58
|
}
|
|
61
59
|
|
|
62
|
-
${
|
|
60
|
+
${m=>{return m.isChecked&&(y=m.color,r.css`
|
|
63
61
|
svg {
|
|
64
62
|
opacity: 1;
|
|
65
63
|
}
|
|
@@ -67,15 +65,15 @@
|
|
|
67
65
|
:hover {
|
|
68
66
|
}
|
|
69
67
|
|
|
70
|
-
background: ${
|
|
71
|
-
border: 2px solid ${
|
|
72
|
-
`);var
|
|
73
|
-
${
|
|
68
|
+
background: ${o.default.colors[y].main};
|
|
69
|
+
border: 2px solid ${o.default.colors[y].main};
|
|
70
|
+
`);var y}};
|
|
71
|
+
${m=>m.isDisabled&&u};
|
|
74
72
|
|
|
75
|
-
${
|
|
76
|
-
`,
|
|
77
|
-
cursor: ${({isDisabled:
|
|
73
|
+
${m=>m.isChecked&&m.isDisabled&&h};
|
|
74
|
+
`,g=c.default(s.BodyText)`
|
|
75
|
+
cursor: ${({isDisabled:m})=>m?"default":"pointer"};
|
|
78
76
|
user-select: none;
|
|
79
|
-
color: ${({theme:
|
|
77
|
+
color: ${({theme:m,isDisabled:y})=>y?m.colors.text.disabled:m.colors.text.dark};
|
|
80
78
|
margin-left: 0.5rem;
|
|
81
|
-
`,
|
|
79
|
+
`,f=({name:m=t.generateNameHash("check-box"),isDisabled:y=!1,size:k="regular",checked:$=!1,color:v="secondary",label:j,...q})=>d.default.createElement(p,null,d.default.createElement(b,{...q,type:"checkbox",checked:$,"data-validate":"checked",name:m,id:m,color:v,disabled:y,isDisabled:y,boxSize:k}),d.default.createElement(x,{size:k,color:v,isChecked:$,isDisabled:y},d.default.createElement(i.default,null)),j&&d.default.createElement(g,{as:"label",htmlFor:m,isDisabled:y},j));exports.CheckBox=f,exports.default=f;
|
|
@@ -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
|
|
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
|
-
`,
|
|
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&&
|
|
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
|
-
${
|
|
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
|
-
${
|
|
31
|
+
${c}
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
:active {
|
|
36
36
|
.button-background {
|
|
37
37
|
animation: ActiveRipple ${"750ms"};
|
|
38
|
-
${
|
|
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=
|
|
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);
|
|
@@ -71,15 +71,15 @@
|
|
|
71
71
|
${y=>y.isDisabled&&n};
|
|
72
72
|
|
|
73
73
|
${y=>y.isChecked&&y.isDisabled&&u};
|
|
74
|
-
`,
|
|
74
|
+
`,h=d.default.input`
|
|
75
75
|
display: none;
|
|
76
|
-
`,
|
|
76
|
+
`,p=d.default.span`
|
|
77
77
|
display: flex;
|
|
78
78
|
box-sizing: border-box;
|
|
79
79
|
border-radius: 50%;
|
|
80
80
|
|
|
81
81
|
border: 2px solid ${a.default.colors.gray.light1};
|
|
82
|
-
`,
|
|
82
|
+
`,g=d.default.span`
|
|
83
83
|
box-sizing: border-box;
|
|
84
84
|
opacity: 0;
|
|
85
85
|
margin: auto;
|
|
@@ -94,4 +94,4 @@
|
|
|
94
94
|
user-select: none;
|
|
95
95
|
color: ${({theme:y,isDisabled:$})=>$?y.colors.text.disabled:y.colors.text.dark};
|
|
96
96
|
margin-left: 0.5rem;
|
|
97
|
-
`,x=({name:y=t.generateNameHash("radio-button"),size:$="regular",checked:D=!1,isDisabled:k=!1,color:j="secondary",onChange:q,label:v,...E})=>s.default.createElement(f,null,s.default.createElement(l.default,{onClick:q,isActive:D,isDisabled:k,color:j},s.default.createElement(
|
|
97
|
+
`,x=({name:y=t.generateNameHash("radio-button"),size:$="regular",checked:D=!1,isDisabled:k=!1,color:j="secondary",onChange:q,label:v,...E})=>s.default.createElement(f,null,s.default.createElement(l.default,{onClick:q,isActive:D,isDisabled:k,color:j},s.default.createElement(h,{"data-validate":"checked",checked:D,type:"radio",name:y,id:y,onChange:q,disabled:k,...E}),s.default.createElement(b,{size:$,color:j,isChecked:D,isDisabled:k},s.default.createElement(p,{className:"circle circle--outer"},s.default.createElement(g,{className:"circle circle--inner"})))),v&&s.default.createElement(m,{as:"label",htmlFor:y,isDisabled:k},v));exports.RadioButton=x,exports.default=x;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import t from"react";import i,{css as r}from"styled-components";import{generateNameHash as m}from"../../shared/helpers.js";import s from"../../theme.js";import{BodyText as x}from"../../typography/BodyText/index.js";import g from"../../icons/components/CheckmarkIcon.js";import{BackgroundStyles as u}from"../IconButton.js";import"../../shared/media-queries.js";const b=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
|
-
`,
|
|
9
|
+
`,k=r`
|
|
10
10
|
width: 32px;
|
|
11
11
|
height: 32px;
|
|
12
12
|
|
|
@@ -14,10 +14,10 @@ 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
|
-
`,
|
|
17
|
+
`,d={regular:b,large:k},y=r`
|
|
18
18
|
cursor: default;
|
|
19
|
-
border: 2px solid ${
|
|
20
|
-
`,
|
|
19
|
+
border: 2px solid ${s.colors.gray.light2};
|
|
20
|
+
`,f=e=>r`
|
|
21
21
|
svg {
|
|
22
22
|
opacity: 1;
|
|
23
23
|
}
|
|
@@ -25,57 +25,55 @@ import o from"react";import c,{css as r}from"styled-components";import{generateN
|
|
|
25
25
|
:hover {
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
background: ${
|
|
29
|
-
border: 2px solid ${
|
|
30
|
-
|
|
31
|
-
background: ${
|
|
32
|
-
`,
|
|
28
|
+
background: ${s.colors[e].main};
|
|
29
|
+
border: 2px solid ${s.colors[e].main};
|
|
30
|
+
`,$=r`
|
|
31
|
+
background: ${s.colors.gray.light2};
|
|
32
|
+
`,v=i.div`
|
|
33
33
|
display: flex;
|
|
34
34
|
align-items: center;
|
|
35
35
|
box-sizing: border-box;
|
|
36
|
-
`,
|
|
36
|
+
`,z=i.input.attrs({type:"checkbox"})`
|
|
37
37
|
position: absolute;
|
|
38
38
|
appearance: none;
|
|
39
39
|
width: 100%;
|
|
40
40
|
height: 100%;
|
|
41
41
|
margin: 0;
|
|
42
42
|
padding: 0;
|
|
43
|
+
outline: none;
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
z-index: 1;
|
|
46
|
+
${e=>d[e.boxSize]};
|
|
43
47
|
|
|
44
48
|
:focus-visible {
|
|
45
|
-
outline: none;
|
|
46
|
-
height: calc(100% + 1rem);
|
|
47
|
-
width: calc(100% + 1rem);
|
|
48
|
-
top: -0.5rem;
|
|
49
|
-
left: -0.5rem;
|
|
50
|
-
appearance: initial;
|
|
51
|
-
border-radius: 10rem;
|
|
52
49
|
transition: background-color 400ms;
|
|
53
50
|
${u}
|
|
54
51
|
}
|
|
55
|
-
`,
|
|
52
|
+
`,C=i.span`
|
|
56
53
|
box-sizing: border-box;
|
|
57
54
|
cursor: pointer;
|
|
58
55
|
display: flex;
|
|
59
56
|
position: relative;
|
|
60
57
|
align-items: center;
|
|
61
58
|
justify-content: center;
|
|
59
|
+
z-index: 0;
|
|
62
60
|
|
|
63
|
-
border: 2px solid ${
|
|
61
|
+
border: 2px solid ${s.colors.gray.dark5};
|
|
64
62
|
|
|
65
|
-
${e=>
|
|
63
|
+
${e=>d[e.size]};
|
|
66
64
|
|
|
67
65
|
svg {
|
|
68
66
|
opacity: 0;
|
|
69
67
|
color: ${({theme:e})=>e.colors.common.white};
|
|
70
68
|
}
|
|
71
69
|
|
|
72
|
-
${e=>e.isChecked&&
|
|
73
|
-
${e=>e.isDisabled
|
|
70
|
+
${e=>e.isChecked&&f(e.color)};
|
|
71
|
+
${e=>e.isDisabled&&y};
|
|
74
72
|
|
|
75
|
-
${e=>e.isChecked&&e.isDisabled
|
|
76
|
-
`,
|
|
73
|
+
${e=>e.isChecked&&e.isDisabled&&$};
|
|
74
|
+
`,S=i(x)`
|
|
77
75
|
cursor: ${({isDisabled:e})=>e?"default":"pointer"};
|
|
78
76
|
user-select: none;
|
|
79
|
-
color: ${({theme:e,isDisabled:
|
|
77
|
+
color: ${({theme:e,isDisabled:o})=>o?e.colors.text.disabled:e.colors.text.dark};
|
|
80
78
|
margin-left: 0.5rem;
|
|
81
|
-
`,
|
|
79
|
+
`,h=({name:e=m("check-box"),isDisabled:o=!1,size:c="regular",checked:n=!1,color:a="secondary",label:l,...p})=>t.createElement(v,null,t.createElement(z,{...p,type:"checkbox",checked:n,"data-validate":"checked",name:e,id:e,color:a,disabled:o,isDisabled:o,boxSize:c}),t.createElement(C,{size:c,color:a,isChecked:n,isDisabled:o},t.createElement(g,null)),l&&t.createElement(S,{as:"label",htmlFor:e,isDisabled:o},l));export{h as CheckBox,h as default};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import a from"react";import i,{css as s}from"styled-components";const f=s`
|
|
2
2
|
background-color: transparent;
|
|
3
|
-
`,l="400ms",
|
|
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&&
|
|
7
|
-
`,
|
|
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 ${
|
|
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 ${
|
|
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
|
-
`,
|
|
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
|
-
`,
|
|
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};
|
|
@@ -94,4 +94,4 @@ import r from"react";import o,{css as i}from"styled-components";import{generateN
|
|
|
94
94
|
user-select: none;
|
|
95
95
|
color: ${({theme:e,isDisabled:l})=>l?e.colors.text.disabled:e.colors.text.dark};
|
|
96
96
|
margin-left: 0.5rem;
|
|
97
|
-
`,m=({name:e=p("radio-button"),size:l="regular",checked:s=!1,isDisabled:c=!1,color:a="secondary",onChange:n,label:d,...u})=>r.createElement(z,null,r.createElement(g,{onClick:n,isActive:s,isDisabled:c,color:a},r.createElement(E,{"data-validate":"checked",type:"radio",name:e,id:e,onChange:n,disabled:c,...u}),r.createElement(B,{size:l,color:a,isChecked:s,isDisabled:c},r.createElement(j,{className:"circle circle--outer"},r.createElement(C,{className:"circle circle--inner"})))),d&&r.createElement(S,{as:"label",htmlFor:e,isDisabled:c},d));export{m as RadioButton,m as default};
|
|
97
|
+
`,m=({name:e=p("radio-button"),size:l="regular",checked:s=!1,isDisabled:c=!1,color:a="secondary",onChange:n,label:d,...u})=>r.createElement(z,null,r.createElement(g,{onClick:n,isActive:s,isDisabled:c,color:a},r.createElement(E,{"data-validate":"checked",checked:s,type:"radio",name:e,id:e,onChange:n,disabled:c,...u}),r.createElement(B,{size:l,color:a,isChecked:s,isDisabled:c},r.createElement(j,{className:"circle circle--outer"},r.createElement(C,{className:"circle circle--inner"})))),d&&r.createElement(S,{as:"label",htmlFor:e,isDisabled:c},d));export{m as RadioButton,m as default};
|
package/package.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
2
|
import { CheckboxSize, Color } from '../../Types';
|
|
3
|
-
|
|
3
|
+
declare type ComponentPropsWithoutSize = Omit<ComponentPropsWithoutRef<'input'>, 'size'>;
|
|
4
|
+
export interface CheckBoxProps extends ComponentPropsWithoutSize {
|
|
4
5
|
name?: string;
|
|
5
6
|
size?: CheckboxSize;
|
|
6
|
-
value?: string;
|
|
7
7
|
color?: Color;
|
|
8
|
-
checked
|
|
8
|
+
checked?: boolean;
|
|
9
9
|
isDisabled?: boolean;
|
|
10
|
-
onClick?(): void;
|
|
11
10
|
label?: ReactNode;
|
|
12
11
|
}
|
|
13
|
-
export declare const CheckBox: ({ name, isDisabled, size, checked, color,
|
|
12
|
+
export declare const CheckBox: ({ name, isDisabled, size, checked, color, label, ...rest }: CheckBoxProps) => JSX.Element;
|
|
14
13
|
export default CheckBox;
|
|
@@ -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;
|