@kvdbil/components 13.1.1 → 13.1.2
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/Button/index.js +22 -17
- package/cjs/components/Button/styles.js +28 -35
- package/cjs/components/Textfield/index.js +3 -3
- package/esm/components/Button/index.js +21 -16
- package/esm/components/Button/styles.js +11 -18
- package/esm/components/Textfield/index.js +12 -12
- package/package.json +1 -1
- package/types/components/Button/index.d.ts +1 -1
- package/types/components/Button/styles.d.ts +3 -4
|
@@ -1,34 +1,39 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("styled-components"),
|
|
2
|
-
${
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("styled-components"),l=require("../../theme.js"),r=require("../Spinner/index.js"),i=require("../../typography/ButtonText/index.js"),a=require("./styles.js");function s(x){return x&&typeof x=="object"&&"default"in x?x:{default:x}}var o=s(e),n=s(t);const u=n.default.button`
|
|
2
|
+
${i.BasicButtonFontStyle}
|
|
3
3
|
box-sizing: border-box;
|
|
4
4
|
outline: none;
|
|
5
5
|
cursor: pointer;
|
|
6
6
|
user-select: none;
|
|
7
7
|
position: relative;
|
|
8
8
|
border: none;
|
|
9
|
-
width: ${({
|
|
9
|
+
min-width: ${({minWidth:x})=>x||"auto"};
|
|
10
|
+
width: ${({fullWidth:x})=>x&&"100%"};
|
|
10
11
|
display: flex;
|
|
11
12
|
align-items: center;
|
|
12
|
-
justify-content: ${({sufixIcon:
|
|
13
|
+
justify-content: ${({sufixIcon:x,prefixIcon:b,isLoading:z})=>z||!x&&!b?"center":"space-between"};
|
|
13
14
|
|
|
14
|
-
${({size:
|
|
15
|
-
${({size:
|
|
16
|
-
${
|
|
17
|
-
${
|
|
18
|
-
${
|
|
19
|
-
${y==="large"&&i.largeSizeStyles(x,b)}
|
|
15
|
+
${({size:x="small"})=>a.fontSizes[x]||i.ButtonRegularTextStyle}
|
|
16
|
+
${({size:x})=>t.css`
|
|
17
|
+
${(x==="smaller"||x==="small")&&a.smallerAndSmallSizeStyles()}
|
|
18
|
+
${x==="regular"&&a.regularSizeStyles()}
|
|
19
|
+
${x==="large"&&a.largeSizeStyles()}
|
|
20
20
|
`}
|
|
21
21
|
background-color: transparent;
|
|
22
22
|
transition: color 0.3s ease, background-color 0.3s ease, border 0.3s ease;
|
|
23
|
-
${({variant:
|
|
24
|
-
${
|
|
23
|
+
${({variant:x="solid",color:b="primary",disabled:z,theme:S})=>t.css`
|
|
24
|
+
${z?a.disabledColorStyles(S,x):a.colorStyles[x](S,b)}
|
|
25
25
|
`}
|
|
26
26
|
&:focus-visible {
|
|
27
|
-
box-shadow: 0px 0px 0px 1px ${({theme:
|
|
27
|
+
box-shadow: 0px 0px 0px 1px ${({theme:x})=>x.colors.gray.light5};
|
|
28
28
|
}
|
|
29
29
|
`,d={smaller:"1rem",small:"1rem",regular:"1.5rem",large:"1.5rem"},f={smaller:"0.5rem",small:"0.5rem",regular:"1rem",large:"1rem"},c=n.default.span`
|
|
30
30
|
display: flex;
|
|
31
|
-
margin-right: ${({type:
|
|
32
|
-
margin-left: ${({type:
|
|
33
|
-
font-size: ${({size:
|
|
34
|
-
|
|
31
|
+
margin-right: ${({type:x,size:b})=>x==="prefix"?f[b]:0};
|
|
32
|
+
margin-left: ${({type:x,size:b})=>x==="sufix"?f[b]:0};
|
|
33
|
+
font-size: ${({size:x})=>d[x]};
|
|
34
|
+
opacity: ${({isLoading:x})=>x?0:1};
|
|
35
|
+
`,m=n.default(r.default)`
|
|
36
|
+
position: absolute;
|
|
37
|
+
`,p=n.default.span`
|
|
38
|
+
opacity: ${({isLoading:x})=>x?0:1};
|
|
39
|
+
`,g={smaller:1,small:1,regular:1.5,large:1.5},y=e.forwardRef(({size:x="small",color:b="primary",variant:z="solid",fullWidth:S=!1,isDisabled:j=!1,isLoading:$=!1,children:q,sufixIcon:v,prefixIcon:E,minWidth:B,as:I="button",...W},w)=>{return o.default.createElement(u,{...W,as:I,minWidth:B,color:b,disabled:j||$,fullWidth:S,theme:l.default,variant:z,size:x,isLoading:$,ref:w,prefixIcon:E,sufixIcon:v},o.default.createElement(o.default.Fragment,null,E&&o.default.createElement(c,{size:x,type:"prefix",isLoading:$},E),(L=$,typeof(h=q)=="string"||typeof h=="number"?o.default.createElement(p,{isLoading:L},h):o.default.isValidElement(h)?o.default.cloneElement(h,{style:{...h.props.style,opacity:L?0:1}}):h),v&&o.default.createElement(c,{size:x,type:"sufix",isLoading:$},v),$&&o.default.createElement(m,{color:l.default.colors.gray.light1,size:g[x]})));var h,L});y.displayName="Button",exports.Button=y,exports.default=y;
|
|
@@ -1,62 +1,55 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o=require("../../typography/ButtonText/index.js");require("react"),require("styled-components");const r={smaller:o.ButtonSmallTextStyle,small:o.ButtonRegularTextStyle,regular:o.ButtonRegularTextStyle,large:o.ButtonLargeTextStyle},
|
|
2
|
-
color: ${s.colors[
|
|
3
|
-
border: 2px solid ${s.colors[
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o=require("../../typography/ButtonText/index.js");require("react"),require("styled-components");const r={smaller:o.ButtonSmallTextStyle,small:o.ButtonRegularTextStyle,regular:o.ButtonRegularTextStyle,large:o.ButtonLargeTextStyle},l=(s,a)=>`
|
|
2
|
+
color: ${s.colors[a].main};
|
|
3
|
+
border: 2px solid ${s.colors[a].main};
|
|
4
4
|
background-color: transparent;
|
|
5
5
|
|
|
6
6
|
:hover {
|
|
7
|
-
border: 2px solid ${s.colors[
|
|
8
|
-
color: ${s.colors[
|
|
7
|
+
border: 2px solid ${s.colors[a].dark};
|
|
8
|
+
color: ${s.colors[a].dark};
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
:active {
|
|
12
|
-
border: 2px solid ${s.colors[
|
|
13
|
-
color: ${s.colors[
|
|
12
|
+
border: 2px solid ${s.colors[a].light};
|
|
13
|
+
color: ${s.colors[a].light};
|
|
14
14
|
}
|
|
15
|
-
`,
|
|
16
|
-
color: ${
|
|
15
|
+
`,n=(s,a)=>`
|
|
16
|
+
color: ${a!=="neutral"?s.colors[a].main:s.colors.neutral.light};
|
|
17
17
|
background-color: transparent;
|
|
18
18
|
|
|
19
19
|
:hover {
|
|
20
|
-
color: ${s.colors[
|
|
20
|
+
color: ${s.colors[a].dark};
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
:active {
|
|
24
|
-
color: ${s.colors[
|
|
24
|
+
color: ${s.colors[a].dark};
|
|
25
25
|
}
|
|
26
|
-
`,
|
|
26
|
+
`,e=s=>`
|
|
27
27
|
color: ${s.colors.gray.light1};
|
|
28
28
|
cursor: not-allowed;
|
|
29
|
-
`,t={solid:(s,
|
|
29
|
+
`,t={solid:(s,a)=>`
|
|
30
30
|
color: ${s.colors.text.light};
|
|
31
|
-
background-color: ${s.colors[
|
|
31
|
+
background-color: ${s.colors[a].main};
|
|
32
32
|
|
|
33
33
|
:hover {
|
|
34
|
-
border-color: ${s.colors[
|
|
35
|
-
background-color: ${s.colors[
|
|
34
|
+
border-color: ${s.colors[a].dark};
|
|
35
|
+
background-color: ${s.colors[a].dark};
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
:active {
|
|
39
|
-
border-color: ${s.colors[
|
|
40
|
-
background-color: ${s.colors[
|
|
39
|
+
border-color: ${s.colors[a].light};
|
|
40
|
+
background-color: ${s.colors[a].light}
|
|
41
41
|
}
|
|
42
|
-
`,outline:
|
|
43
|
-
${
|
|
44
|
-
background-color: ${s.colors.gray.light4};`:
|
|
45
|
-
${
|
|
46
|
-
border: 2px solid ${s.colors.gray.light1};`:
|
|
47
|
-
|
|
48
|
-
padding: 0 1.5rem;
|
|
42
|
+
`,outline:l,flat:n};exports.colorStyles=t,exports.disabledColorStyles=(s,a)=>a==="solid"?`
|
|
43
|
+
${e(s)};
|
|
44
|
+
background-color: ${s.colors.gray.light4};`:a==="outline"?`
|
|
45
|
+
${e(s)};
|
|
46
|
+
border: 2px solid ${s.colors.gray.light1};`:e(s),exports.flatColorStyles=n,exports.fontSizes=r,exports.largeSizeStyles=()=>`
|
|
47
|
+
padding: 0.25rem 1.5rem;
|
|
49
48
|
min-height: 3.75rem;
|
|
50
|
-
`,exports.outlineColorStyles=
|
|
51
|
-
|
|
52
|
-
padding: 0 1.5rem;
|
|
49
|
+
`,exports.outlineColorStyles=l,exports.regularSizeStyles=()=>`
|
|
50
|
+
padding: 0.25rem 1.5rem;
|
|
53
51
|
min-height: 3rem;
|
|
54
|
-
`,exports.
|
|
55
|
-
|
|
56
|
-
padding: 0 0.75rem;
|
|
57
|
-
min-height: 2.5rem;
|
|
58
|
-
`,exports.smallerSizeStyles=(s,i="auto")=>`
|
|
59
|
-
min-width: ${s?"4rem":i};
|
|
60
|
-
padding: 0 0.75rem;
|
|
52
|
+
`,exports.smallerAndSmallSizeStyles=()=>`
|
|
53
|
+
padding: 0.25rem 0.75rem;
|
|
61
54
|
min-height: 2.5rem;
|
|
62
55
|
`;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
position: relative;
|
|
13
13
|
padding: 0;
|
|
14
14
|
display: block;
|
|
15
|
-
`,
|
|
15
|
+
`,h=s.default.div`
|
|
16
16
|
display: flex;
|
|
17
17
|
text-align: center;
|
|
18
18
|
align-items: center;
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
${({disabled:y})=>y&&i}
|
|
31
31
|
${({hasError:y})=>y&&n}
|
|
32
32
|
${({centered:y})=>y&&"text-align: center;"}
|
|
33
|
-
`,
|
|
33
|
+
`,m=s.default.input`
|
|
34
34
|
${l.BodyTextStyle}
|
|
35
35
|
width: 100%;
|
|
36
36
|
cursor: text;
|
|
@@ -63,4 +63,4 @@
|
|
|
63
63
|
`,x=s.default.span`
|
|
64
64
|
display: block;
|
|
65
65
|
color: ${({theme:y})=>y.colors.error.dark};
|
|
66
|
-
`,g=({placeholder:y="",isDisabled:k=!1,centered:
|
|
66
|
+
`,g=({placeholder:y="",isDisabled:k=!1,centered:B=!1,hasError:w=!1,className:z,helperText:F,label:E="",onBlur:L=()=>null,onFocus:P=()=>null,forwardRef:_,suffix:T,name:j=a.generateNameHash("text-input"),errors:v,isAutoFocused:C=!1,...A})=>{const[q,N]=e.useState(!1),D=Boolean(A.value),S=v&&Array.isArray(v)&&(v==null?void 0:v.length)>0;return d.default.createElement(u,{className:z},d.default.createElement(h,{isFocused:q,disabled:k,centered:B,hasError:w,hasPlaceholder:!!y},d.default.createElement(m,{...A,id:j,name:j,"aria-label":E||j,ref:_,onFocus:$=>{N(!0),P($)},onBlur:$=>{N(!1),L($)},disabled:k,placeholder:E&&!q?"":y,autoFocus:C}),T&&d.default.createElement(f,null,T)),E&&d.default.createElement(t.Label,{htmlFor:j,isFocused:q,centered:B,hasError:w,hasValue:D,disabled:k},E),(F||S)&&d.default.createElement(p,{centered:B},F&&d.default.createElement(b,null,F),S&&v.map($=>d.default.createElement(x,{key:$},$))))};exports.TextField=g,exports.default=g;
|
|
@@ -1,34 +1,39 @@
|
|
|
1
|
-
import
|
|
2
|
-
${
|
|
1
|
+
import r,{forwardRef as w}from"react";import n,{css as y}from"styled-components";import f from"../../theme.js";import h from"../Spinner/index.js";import{BasicButtonFontStyle as C,ButtonRegularTextStyle as R}from"../../typography/ButtonText/index.js";import{fontSizes as T,smallerAndSmallSizeStyles as z,regularSizeStyles as A,largeSizeStyles as _,disabledColorStyles as k,colorStyles as F}from"./styles.js";const p=0,N=n.button`
|
|
2
|
+
${C}
|
|
3
3
|
box-sizing: border-box;
|
|
4
4
|
outline: none;
|
|
5
5
|
cursor: pointer;
|
|
6
6
|
user-select: none;
|
|
7
7
|
position: relative;
|
|
8
8
|
border: none;
|
|
9
|
+
min-width: ${({minWidth:e})=>e||"auto"};
|
|
9
10
|
width: ${({fullWidth:e})=>e&&"100%"};
|
|
10
11
|
display: flex;
|
|
11
12
|
align-items: center;
|
|
12
|
-
justify-content: ${({sufixIcon:e,prefixIcon:
|
|
13
|
+
justify-content: ${({sufixIcon:e,prefixIcon:t,isLoading:s})=>!s&&(e||t)?"space-between":"center"};
|
|
13
14
|
|
|
14
|
-
${({size:e="small"})=>
|
|
15
|
-
${({size:e
|
|
16
|
-
${e==="smaller"&&
|
|
17
|
-
${e==="
|
|
18
|
-
${e==="
|
|
19
|
-
${e==="large"&&k(r,t)}
|
|
15
|
+
${({size:e="small"})=>T[e]||R}
|
|
16
|
+
${({size:e})=>y`
|
|
17
|
+
${(e==="smaller"||e==="small")&&z()}
|
|
18
|
+
${e==="regular"&&A()}
|
|
19
|
+
${e==="large"&&_()}
|
|
20
20
|
`}
|
|
21
21
|
background-color: transparent;
|
|
22
22
|
transition: color 0.3s ease, background-color 0.3s ease, border 0.3s ease;
|
|
23
|
-
${({variant:e="solid",color:
|
|
24
|
-
${
|
|
23
|
+
${({variant:e="solid",color:t="primary",disabled:s,theme:a})=>y`
|
|
24
|
+
${s?k(a,e):F[e](a,t)}
|
|
25
25
|
`}
|
|
26
26
|
&:focus-visible {
|
|
27
27
|
box-shadow: 0px 0px 0px 1px ${({theme:e})=>e.colors.gray.light5};
|
|
28
28
|
}
|
|
29
|
-
`,
|
|
29
|
+
`,O={smaller:"1rem",small:"1rem",regular:"1.5rem",large:"1.5rem"},g={smaller:"0.5rem",small:"0.5rem",regular:"1rem",large:"1rem"},S=n.span`
|
|
30
30
|
display: flex;
|
|
31
|
-
margin-right: ${({type:e,size:
|
|
32
|
-
margin-left: ${({type:e,size:
|
|
33
|
-
font-size: ${({size:e})=>
|
|
34
|
-
|
|
31
|
+
margin-right: ${({type:e,size:t})=>e==="prefix"?g[t]:0};
|
|
32
|
+
margin-left: ${({type:e,size:t})=>e==="sufix"?g[t]:0};
|
|
33
|
+
font-size: ${({size:e})=>O[e]};
|
|
34
|
+
opacity: ${({isLoading:e})=>e?p:1};
|
|
35
|
+
`,v=n(h)`
|
|
36
|
+
position: absolute;
|
|
37
|
+
`,D=n.span`
|
|
38
|
+
opacity: ${({isLoading:e})=>e?p:1};
|
|
39
|
+
`,G={smaller:1,small:1,regular:1.5,large:1.5},c=w(({size:e="small",color:t="primary",variant:s="solid",fullWidth:a=!1,isDisabled:$=!1,isLoading:o=!1,children:b,sufixIcon:m,prefixIcon:i,minWidth:d,as:x="button",...E},B)=>{const j=(l,u)=>typeof l=="string"||typeof l=="number"?r.createElement(D,{isLoading:u},l):r.isValidElement(l)?r.cloneElement(l,{style:{...l.props.style,opacity:u?p:1}}):l;return r.createElement(N,{...E,as:x,minWidth:d,color:t,disabled:$||o,fullWidth:a,theme:f,variant:s,size:e,isLoading:o,ref:B,prefixIcon:i,sufixIcon:m},r.createElement(r.Fragment,null,i&&r.createElement(S,{size:e,type:"prefix",isLoading:o},i),j(b,o),m&&r.createElement(S,{size:e,type:"sufix",isLoading:o},m),o&&r.createElement(v,{color:f.colors.gray.light1,size:G[e]})))});c.displayName="Button";export{c as Button,c as default};
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
import{ButtonSmallTextStyle as
|
|
2
|
-
|
|
3
|
-
padding: 0 0.75rem;
|
|
1
|
+
import{ButtonSmallTextStyle as a,ButtonRegularTextStyle as s,ButtonLargeTextStyle as c}from"../../typography/ButtonText/index.js";import"react";import"styled-components";const i={smaller:a,small:s,regular:s,large:c},d=()=>`
|
|
2
|
+
padding: 0.25rem 0.75rem;
|
|
4
3
|
min-height: 2.5rem;
|
|
5
|
-
`,e=(
|
|
6
|
-
|
|
7
|
-
padding: 0 0.75rem;
|
|
8
|
-
min-height: 2.5rem;
|
|
9
|
-
`,g=(o,r="auto")=>`
|
|
10
|
-
min-width: ${o?"6rem":r};
|
|
11
|
-
padding: 0 1.5rem;
|
|
4
|
+
`,e=()=>`
|
|
5
|
+
padding: 0.25rem 1.5rem;
|
|
12
6
|
min-height: 3rem;
|
|
13
|
-
`,
|
|
14
|
-
|
|
15
|
-
padding: 0 1.5rem;
|
|
7
|
+
`,g=()=>`
|
|
8
|
+
padding: 0.25rem 1.5rem;
|
|
16
9
|
min-height: 3.75rem;
|
|
17
|
-
|
|
10
|
+
`,u=(o,r)=>`
|
|
18
11
|
color: ${o.colors.text.light};
|
|
19
12
|
background-color: ${o.colors[r].main};
|
|
20
13
|
|
|
@@ -27,7 +20,7 @@ import{ButtonSmallTextStyle as n,ButtonRegularTextStyle as t,ButtonLargeTextStyl
|
|
|
27
20
|
border-color: ${o.colors[r].light};
|
|
28
21
|
background-color: ${o.colors[r].light}
|
|
29
22
|
}
|
|
30
|
-
`,
|
|
23
|
+
`,t=(o,r)=>`
|
|
31
24
|
color: ${o.colors[r].main};
|
|
32
25
|
border: 2px solid ${o.colors[r].main};
|
|
33
26
|
background-color: transparent;
|
|
@@ -41,7 +34,7 @@ import{ButtonSmallTextStyle as n,ButtonRegularTextStyle as t,ButtonLargeTextStyl
|
|
|
41
34
|
border: 2px solid ${o.colors[r].light};
|
|
42
35
|
color: ${o.colors[r].light};
|
|
43
36
|
}
|
|
44
|
-
`,
|
|
37
|
+
`,n=(o,r)=>`
|
|
45
38
|
color: ${r!=="neutral"?o.colors[r].main:o.colors.neutral.light};
|
|
46
39
|
background-color: transparent;
|
|
47
40
|
|
|
@@ -55,8 +48,8 @@ import{ButtonSmallTextStyle as n,ButtonRegularTextStyle as t,ButtonLargeTextStyl
|
|
|
55
48
|
`,l=o=>`
|
|
56
49
|
color: ${o.colors.gray.light1};
|
|
57
50
|
cursor: not-allowed;
|
|
58
|
-
|
|
51
|
+
`,$=(o,r)=>r==="solid"?`
|
|
59
52
|
${l(o)};
|
|
60
53
|
background-color: ${o.colors.gray.light4};`:r==="outline"?`
|
|
61
54
|
${l(o)};
|
|
62
|
-
border: 2px solid ${o.colors.gray.light1};`:l(o),y={solid
|
|
55
|
+
border: 2px solid ${o.colors.gray.light1};`:l(o),y={solid:u,outline:t,flat:n};export{y as colorStyles,$ as disabledColorStyles,n as flatColorStyles,i as fontSizes,g as largeSizeStyles,t as outlineColorStyles,e as regularSizeStyles,d as smallerAndSmallSizeStyles};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import t,{useState as B}from"react";import o,{css as p}from"styled-components";import{Label as T}from"../FieldLabel.js";import{BodyTextStyle as j,CaptionStyle as w}from"../../typography/BodyText/index.js";import{generateNameHash as A}from"../../shared/helpers.js";import"../../shared/media-queries.js";const H=p`
|
|
2
2
|
border: 1px solid ${({theme:e})=>e.colors.gray.light2};
|
|
3
3
|
color: ${({theme:e})=>e.colors.text.disabled};
|
|
4
4
|
fill: ${({theme:e})=>e.colors.text.disabled};
|
|
@@ -8,11 +8,11 @@ import o,{useState as v}from"react";import t,{css as p}from"styled-components";i
|
|
|
8
8
|
border: 2px solid ${({theme:e})=>e.colors.gray.dark5};
|
|
9
9
|
color: ${({theme:e})=>e.colors.text.dark};
|
|
10
10
|
fill: ${({theme:e})=>e.colors.text.dark};
|
|
11
|
-
`,C=
|
|
11
|
+
`,C=o.div`
|
|
12
12
|
position: relative;
|
|
13
13
|
padding: 0;
|
|
14
14
|
display: block;
|
|
15
|
-
`,L=
|
|
15
|
+
`,L=o.div`
|
|
16
16
|
display: flex;
|
|
17
17
|
text-align: center;
|
|
18
18
|
align-items: center;
|
|
@@ -26,12 +26,12 @@ import o,{useState as v}from"react";import t,{css as p}from"styled-components";i
|
|
|
26
26
|
|
|
27
27
|
padding: 0.75rem 0.6rem;
|
|
28
28
|
|
|
29
|
-
${({hasError:e,isFocused:
|
|
29
|
+
${({hasError:e,isFocused:r})=>!e&&r&&z}
|
|
30
30
|
${({disabled:e})=>e&&H}
|
|
31
31
|
${({hasError:e})=>e&&I}
|
|
32
32
|
${({centered:e})=>e&&"text-align: center;"}
|
|
33
|
-
`,W=
|
|
34
|
-
${
|
|
33
|
+
`,W=o.input`
|
|
34
|
+
${j}
|
|
35
35
|
width: 100%;
|
|
36
36
|
cursor: text;
|
|
37
37
|
outline: none;
|
|
@@ -42,7 +42,7 @@ import o,{useState as v}from"react";import t,{css as p}from"styled-components";i
|
|
|
42
42
|
color: ${({theme:e})=>e.colors.text.disabled};
|
|
43
43
|
fill: ${({theme:e})=>e.colors.text.disabled};
|
|
44
44
|
}
|
|
45
|
-
`,_=
|
|
45
|
+
`,_=o.span`
|
|
46
46
|
display: flex;
|
|
47
47
|
font-family: ${({theme:e})=>e.typography.fontBaseFamily};
|
|
48
48
|
font-size: 1.25rem;
|
|
@@ -52,15 +52,15 @@ import o,{useState as v}from"react";import t,{css as p}from"styled-components";i
|
|
|
52
52
|
width: 1.375rem;
|
|
53
53
|
height: 1.375rem;
|
|
54
54
|
}
|
|
55
|
-
`,q=
|
|
56
|
-
${
|
|
55
|
+
`,q=o.div`
|
|
56
|
+
${w}
|
|
57
57
|
margin-top: 0.25rem;
|
|
58
58
|
|
|
59
59
|
${({centered:e})=>e&&"width: 100%; text-align: center;"}
|
|
60
|
-
`,
|
|
60
|
+
`,N=o.span`
|
|
61
61
|
display: block;
|
|
62
62
|
color: ${({theme:e})=>e.colors.text.disabled};
|
|
63
|
-
`,
|
|
63
|
+
`,P=o.span`
|
|
64
64
|
display: block;
|
|
65
65
|
color: ${({theme:e})=>e.colors.error.dark};
|
|
66
|
-
`,
|
|
66
|
+
`,g=({placeholder:e="",isDisabled:r=!1,centered:d=!1,hasError:m=!1,className:b,helperText:i,label:a="",onBlur:h=()=>null,onFocus:$=()=>null,forwardRef:k,suffix:u,name:n=A("text-input"),errors:s,isAutoFocused:E=!1,...x})=>{const[c,y]=B(!1),F=Boolean(x.value),f=s&&Array.isArray(s)&&(s==null?void 0:s.length)>0,v=l=>{y(!0),$(l)},S=l=>{y(!1),h(l)};return t.createElement(C,{className:b},t.createElement(L,{isFocused:c,disabled:r,centered:d,hasError:m,hasPlaceholder:!!e},t.createElement(W,{...x,id:n,name:n,"aria-label":a||n,ref:k,onFocus:v,onBlur:S,disabled:r,placeholder:a&&!c?"":e,autoFocus:E}),u&&t.createElement(_,null,u)),a&&t.createElement(T,{htmlFor:n,isFocused:c,centered:d,hasError:m,hasValue:F,disabled:r},a),(i||f)&&t.createElement(q,{centered:d},i&&t.createElement(N,null,i),f&&s.map(l=>t.createElement(P,{key:l},l))))};export{g as TextField,g as default};
|
package/package.json
CHANGED
|
@@ -15,5 +15,5 @@ interface Props {
|
|
|
15
15
|
as?: keyof JSX.IntrinsicElements;
|
|
16
16
|
}
|
|
17
17
|
export declare type ButtonProps = ComponentPropsWithRef<'button'> & Props;
|
|
18
|
-
export declare const Button: React.ForwardRefExoticComponent<Pick<ButtonProps, "form" | "slot" | "style" | "title" | "type" | "name" | "key" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "as" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "size" | "
|
|
18
|
+
export declare const Button: React.ForwardRefExoticComponent<Pick<ButtonProps, "form" | "slot" | "style" | "title" | "type" | "name" | "key" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "as" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "size" | "minWidth" | "fullWidth" | "sufixIcon" | "prefixIcon" | "isLoading" | "variant" | "isDisabled"> & React.RefAttributes<HTMLElement>>;
|
|
19
19
|
export default Button;
|
|
@@ -6,10 +6,9 @@ export declare const fontSizes: {
|
|
|
6
6
|
regular: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
7
7
|
large: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
8
8
|
};
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const largeSizeStyles: (isLoading?: boolean | undefined, minWidth?: string) => string;
|
|
9
|
+
export declare const smallerAndSmallSizeStyles: () => string;
|
|
10
|
+
export declare const regularSizeStyles: () => string;
|
|
11
|
+
export declare const largeSizeStyles: () => string;
|
|
13
12
|
export declare const outlineColorStyles: (theme: Theme, color: Color) => string;
|
|
14
13
|
export declare const flatColorStyles: (theme: Theme, color: Color) => string;
|
|
15
14
|
export declare const disabledColorStyles: (theme: Theme, variant: Variant) => string;
|