@kvdbil/components 14.2.15 → 14.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("../../typography/ButtonText/index.js");require("react"),require("styled-components");const i={smaller:n.ButtonSmallTextStyle,small:n.ButtonRegularTextStyle,regular:n.ButtonRegularTextStyle,large:n.ButtonLargeTextStyle},e=(r,o)=>`
|
|
2
2
|
color: ${r.colors[o].main};
|
|
3
3
|
border: 2px solid ${r.colors[o].main};
|
|
4
4
|
background-color: transparent;
|
|
@@ -13,20 +13,17 @@
|
|
|
13
13
|
color: ${r.colors[o].light};
|
|
14
14
|
}
|
|
15
15
|
`,t=(r,o)=>`
|
|
16
|
-
color: ${
|
|
17
|
-
background-color: transparent;
|
|
16
|
+
color: ${r.colors[o].main};
|
|
18
17
|
|
|
19
|
-
:
|
|
20
|
-
color: ${r.colors[o].dark};
|
|
21
|
-
}
|
|
18
|
+
background-color: transparent;
|
|
22
19
|
|
|
23
|
-
:active {
|
|
20
|
+
:hover, :active {
|
|
24
21
|
color: ${r.colors[o].dark};
|
|
25
22
|
}
|
|
26
|
-
`,
|
|
23
|
+
`,l=r=>`
|
|
27
24
|
color: ${r.colors.gray.light1};
|
|
28
25
|
cursor: not-allowed;
|
|
29
|
-
`,
|
|
26
|
+
`,a={solid:(r,o,s)=>`
|
|
30
27
|
color: ${r.colors.text.light};
|
|
31
28
|
background-color: ${r.colors[o][s]};
|
|
32
29
|
|
|
@@ -39,11 +36,11 @@
|
|
|
39
36
|
border-color: ${r.colors[o].light};
|
|
40
37
|
filter: brightness(1.1)
|
|
41
38
|
}
|
|
42
|
-
`,outline:e,flat:t};exports.colorStyles=
|
|
43
|
-
${
|
|
39
|
+
`,outline:e,flat:t};exports.colorStyles=a,exports.disabledColorStyles=(r,o)=>o==="solid"?`
|
|
40
|
+
${l(r)};
|
|
44
41
|
background-color: ${r.colors.gray.light4};`:o==="outline"?`
|
|
45
|
-
${
|
|
46
|
-
border: 2px solid ${r.colors.gray.light1};`:
|
|
42
|
+
${l(r)};
|
|
43
|
+
border: 2px solid ${r.colors.gray.light1};`:l(r),exports.flatColorStyles=t,exports.fontSizes=i,exports.largeSizeStyles=()=>`
|
|
47
44
|
padding: 0.25rem 1.5rem;
|
|
48
45
|
min-height: 3.75rem;
|
|
49
46
|
`,exports.outlineColorStyles=e,exports.regularSizeStyles=()=>`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var x=require("react"),o=require("styled-components"),f=require("../../icons/components/CheckmarkIcon.js"),g=require("../../shared/helpers.js"),t=require("../../theme.js"),m=require("../../typography/BodyText/index.js"),k=require("../IconButton.js");function n(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}require("../../shared/media-queries.js");var s=n(x),i=n(o);const u={regular:o.css`
|
|
2
2
|
width: 24px;
|
|
3
3
|
height: 24px;
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
width: 15px;
|
|
7
7
|
height: 15px;
|
|
8
8
|
}
|
|
9
|
-
`,large:
|
|
9
|
+
`,large:o.css`
|
|
10
10
|
width: 32px;
|
|
11
11
|
height: 32px;
|
|
12
12
|
|
|
@@ -14,17 +14,19 @@
|
|
|
14
14
|
width: 22px;
|
|
15
15
|
height: 22px;
|
|
16
16
|
}
|
|
17
|
-
`},y=
|
|
17
|
+
`},y=o.css`
|
|
18
18
|
cursor: default;
|
|
19
|
-
border: 2px solid ${
|
|
20
|
-
|
|
21
|
-
background: ${
|
|
19
|
+
border: 2px solid ${t.default.colors.gray.light2};
|
|
20
|
+
`,$=o.css`
|
|
21
|
+
background: ${t.default.colors.gray.light2};
|
|
22
22
|
z-index: 1;
|
|
23
|
-
|
|
23
|
+
`,v=o.css`
|
|
24
|
+
border: 2px solid ${t.default.colors.error.dark};
|
|
25
|
+
`,z=i.default.div`
|
|
24
26
|
display: flex;
|
|
25
27
|
align-items: flex-start;
|
|
26
28
|
box-sizing: border-box;
|
|
27
|
-
`,
|
|
29
|
+
`,j=i.default.input.attrs({type:"checkbox"})`
|
|
28
30
|
position: absolute;
|
|
29
31
|
appearance: none;
|
|
30
32
|
width: 100%;
|
|
@@ -38,9 +40,9 @@
|
|
|
38
40
|
|
|
39
41
|
:focus-visible {
|
|
40
42
|
transition: background-color 400ms;
|
|
41
|
-
${
|
|
43
|
+
${k.BackgroundStyles}
|
|
42
44
|
}
|
|
43
|
-
`,
|
|
45
|
+
`,q=i.default.span`
|
|
44
46
|
box-sizing: border-box;
|
|
45
47
|
cursor: pointer;
|
|
46
48
|
display: flex;
|
|
@@ -49,7 +51,7 @@
|
|
|
49
51
|
justify-content: center;
|
|
50
52
|
z-index: 0;
|
|
51
53
|
|
|
52
|
-
border: 2px solid ${
|
|
54
|
+
border: 2px solid ${t.default.colors.gray.dark5};
|
|
53
55
|
|
|
54
56
|
${e=>u[e.size]};
|
|
55
57
|
|
|
@@ -58,7 +60,7 @@
|
|
|
58
60
|
color: ${({theme:e})=>e.colors.common.white};
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
${e=>e.isChecked&&(r=>
|
|
63
|
+
${e=>e.isChecked&&(r=>o.css`
|
|
62
64
|
svg {
|
|
63
65
|
opacity: 1;
|
|
64
66
|
}
|
|
@@ -66,16 +68,16 @@
|
|
|
66
68
|
:hover {
|
|
67
69
|
}
|
|
68
70
|
|
|
69
|
-
background: ${
|
|
70
|
-
border: 2px solid ${
|
|
71
|
+
background: ${t.default.colors[r].main};
|
|
72
|
+
border: 2px solid ${t.default.colors[r].main};
|
|
71
73
|
`)(e.color)};
|
|
72
74
|
${e=>e.isDisabled&&y};
|
|
73
|
-
|
|
74
|
-
${e=>e.isChecked&&e.isDisabled
|
|
75
|
-
`,
|
|
75
|
+
${e=>e.hasError&&v};
|
|
76
|
+
${e=>e.isChecked&&e.isDisabled&&$};
|
|
77
|
+
`,D=i.default(m.BodyText)`
|
|
76
78
|
flex: 1;
|
|
77
79
|
cursor: ${({isDisabled:e})=>e?"default":"pointer"};
|
|
78
80
|
user-select: none;
|
|
79
81
|
color: ${({theme:e,isDisabled:r})=>r?e.colors.text.disabled:e.colors.text.dark};
|
|
80
82
|
margin-left: 0.5rem;
|
|
81
|
-
`,h=({name:e=
|
|
83
|
+
`,h=({name:e=g.generateNameHash("check-box"),isDisabled:r=!1,size:a="regular",checked:l=!1,color:d="secondary",hasError:p=!1,label:c,...b})=>s.default.createElement(z,null,s.default.createElement(j,{...b,type:"checkbox",checked:l,"data-validate":"checked",name:e,id:e,color:d,disabled:r,isDisabled:r,boxSize:a}),s.default.createElement(q,{size:a,color:d,isChecked:l,isDisabled:r,hasError:p},s.default.createElement(f.default,null)),c&&s.default.createElement(D,{as:"label",htmlFor:e,isDisabled:r},c));exports.CheckBox=h,exports.default=h;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ButtonSmallTextStyle as
|
|
1
|
+
import{ButtonSmallTextStyle as i,ButtonRegularTextStyle as e,ButtonLargeTextStyle as a}from"../../typography/ButtonText/index.js";import"react";import"styled-components";const n={smaller:i,small:e,regular:e,large:a},d=()=>`
|
|
2
2
|
padding: 0.25rem 0.75rem;
|
|
3
3
|
min-height: 2.5rem;
|
|
4
4
|
`,g=()=>`
|
|
@@ -35,14 +35,11 @@ import{ButtonSmallTextStyle as a,ButtonRegularTextStyle as e,ButtonLargeTextStyl
|
|
|
35
35
|
color: ${o.colors[r].light};
|
|
36
36
|
}
|
|
37
37
|
`,s=(o,r)=>`
|
|
38
|
-
color: ${
|
|
39
|
-
background-color: transparent;
|
|
38
|
+
color: ${o.colors[r].main};
|
|
40
39
|
|
|
41
|
-
:
|
|
42
|
-
color: ${o.colors[r].dark};
|
|
43
|
-
}
|
|
40
|
+
background-color: transparent;
|
|
44
41
|
|
|
45
|
-
:active {
|
|
42
|
+
:hover, :active {
|
|
46
43
|
color: ${o.colors[r].dark};
|
|
47
44
|
}
|
|
48
45
|
`,l=o=>`
|
|
@@ -52,4 +49,4 @@ import{ButtonSmallTextStyle as a,ButtonRegularTextStyle as e,ButtonLargeTextStyl
|
|
|
52
49
|
${l(o)};
|
|
53
50
|
background-color: ${o.colors.gray.light4};`:r==="outline"?`
|
|
54
51
|
${l(o)};
|
|
55
|
-
border: 2px solid ${o.colors.gray.light1};`:l(o),
|
|
52
|
+
border: 2px solid ${o.colors.gray.light1};`:l(o),p={solid:h,outline:t,flat:s};export{p as colorStyles,$ as disabledColorStyles,s as flatColorStyles,n as fontSizes,m as largeSizeStyles,t as outlineColorStyles,g as regularSizeStyles,d as smallerAndSmallSizeStyles};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import s from"react";import t,{css as o}from"styled-components";import x from"../../icons/components/CheckmarkIcon.js";import{generateNameHash as b}from"../../shared/helpers.js";import i from"../../theme.js";import{BodyText as g}from"../../typography/BodyText/index.js";import{BackgroundStyles as u}from"../IconButton.js";import"../../shared/media-queries.js";const f=o`
|
|
2
2
|
width: 24px;
|
|
3
3
|
height: 24px;
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ import r from"react";import s,{css as i}from"styled-components";import h from"..
|
|
|
6
6
|
width: 15px;
|
|
7
7
|
height: 15px;
|
|
8
8
|
}
|
|
9
|
-
`,
|
|
9
|
+
`,k=o`
|
|
10
10
|
width: 32px;
|
|
11
11
|
height: 32px;
|
|
12
12
|
|
|
@@ -14,10 +14,10 @@ import r from"react";import s,{css as i}from"styled-components";import h from"..
|
|
|
14
14
|
width: 22px;
|
|
15
15
|
height: 22px;
|
|
16
16
|
}
|
|
17
|
-
`,
|
|
17
|
+
`,n={regular:f,large:k},y=o`
|
|
18
18
|
cursor: default;
|
|
19
|
-
border: 2px solid ${
|
|
20
|
-
|
|
19
|
+
border: 2px solid ${i.colors.gray.light2};
|
|
20
|
+
`,$=e=>o`
|
|
21
21
|
svg {
|
|
22
22
|
opacity: 1;
|
|
23
23
|
}
|
|
@@ -25,16 +25,18 @@ import r from"react";import s,{css as i}from"styled-components";import h from"..
|
|
|
25
25
|
:hover {
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
background: ${
|
|
29
|
-
border: 2px solid ${
|
|
30
|
-
|
|
31
|
-
background: ${
|
|
28
|
+
background: ${i.colors[e].main};
|
|
29
|
+
border: 2px solid ${i.colors[e].main};
|
|
30
|
+
`,z=o`
|
|
31
|
+
background: ${i.colors.gray.light2};
|
|
32
32
|
z-index: 1;
|
|
33
|
-
`,
|
|
33
|
+
`,v=o`
|
|
34
|
+
border: 2px solid ${i.colors.error.dark};
|
|
35
|
+
`,D=t.div`
|
|
34
36
|
display: flex;
|
|
35
37
|
align-items: flex-start;
|
|
36
38
|
box-sizing: border-box;
|
|
37
|
-
`,
|
|
39
|
+
`,E=t.input.attrs({type:"checkbox"})`
|
|
38
40
|
position: absolute;
|
|
39
41
|
appearance: none;
|
|
40
42
|
width: 100%;
|
|
@@ -44,13 +46,13 @@ import r from"react";import s,{css as i}from"styled-components";import h from"..
|
|
|
44
46
|
outline: none;
|
|
45
47
|
cursor: pointer;
|
|
46
48
|
z-index: 1;
|
|
47
|
-
${e=>
|
|
49
|
+
${e=>n[e.boxSize]};
|
|
48
50
|
|
|
49
51
|
:focus-visible {
|
|
50
52
|
transition: background-color 400ms;
|
|
51
|
-
${
|
|
53
|
+
${u}
|
|
52
54
|
}
|
|
53
|
-
`,
|
|
55
|
+
`,j=t.span`
|
|
54
56
|
box-sizing: border-box;
|
|
55
57
|
cursor: pointer;
|
|
56
58
|
display: flex;
|
|
@@ -59,23 +61,23 @@ import r from"react";import s,{css as i}from"styled-components";import h from"..
|
|
|
59
61
|
justify-content: center;
|
|
60
62
|
z-index: 0;
|
|
61
63
|
|
|
62
|
-
border: 2px solid ${
|
|
64
|
+
border: 2px solid ${i.colors.gray.dark5};
|
|
63
65
|
|
|
64
|
-
${e=>
|
|
66
|
+
${e=>n[e.size]};
|
|
65
67
|
|
|
66
68
|
svg {
|
|
67
69
|
opacity: 0;
|
|
68
70
|
color: ${({theme:e})=>e.colors.common.white};
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
${e=>e.isChecked
|
|
72
|
-
${e=>e.isDisabled&&
|
|
73
|
-
|
|
74
|
-
${e=>e.isChecked&&e.isDisabled
|
|
75
|
-
`,
|
|
73
|
+
${e=>e.isChecked&&$(e.color)};
|
|
74
|
+
${e=>e.isDisabled&&y};
|
|
75
|
+
${e=>e.hasError&&v};
|
|
76
|
+
${e=>e.isChecked&&e.isDisabled&&z};
|
|
77
|
+
`,w=t(g)`
|
|
76
78
|
flex: 1;
|
|
77
79
|
cursor: ${({isDisabled:e})=>e?"default":"pointer"};
|
|
78
80
|
user-select: none;
|
|
79
|
-
color: ${({theme:e,isDisabled:
|
|
81
|
+
color: ${({theme:e,isDisabled:r})=>r?e.colors.text.disabled:e.colors.text.dark};
|
|
80
82
|
margin-left: 0.5rem;
|
|
81
|
-
`,p=({name:e=
|
|
83
|
+
`,p=({name:e=b("check-box"),isDisabled:r=!1,size:a="regular",checked:l=!1,color:c="secondary",hasError:h=!1,label:d,...m})=>s.createElement(D,null,s.createElement(E,{...m,type:"checkbox",checked:l,"data-validate":"checked",name:e,id:e,color:c,disabled:r,isDisabled:r,boxSize:a}),s.createElement(j,{size:a,color:c,isChecked:l,isDisabled:r,hasError:h},s.createElement(x,null)),d&&s.createElement(w,{as:"label",htmlFor:e,isDisabled:r},d));export{p as CheckBox,p as default};
|
package/package.json
CHANGED
|
@@ -7,7 +7,8 @@ export interface CheckBoxProps extends ComponentPropsWithoutSize {
|
|
|
7
7
|
color?: Color;
|
|
8
8
|
checked?: boolean;
|
|
9
9
|
isDisabled?: boolean;
|
|
10
|
+
hasError?: boolean;
|
|
10
11
|
label?: ReactNode;
|
|
11
12
|
}
|
|
12
|
-
export declare const CheckBox: ({ name, isDisabled, size, checked, color, label, ...rest }: CheckBoxProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const CheckBox: ({ name, isDisabled, size, checked, color, hasError, label, ...rest }: CheckBoxProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
export default CheckBox;
|