@kvdbil/components 8.7.0 → 8.8.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.
- package/cjs/components/Button/styles.js +3 -3
- package/cjs/components/EditRow/index.js +9 -9
- package/cjs/components/ValuationRange/index.js +10 -10
- package/esm/components/Button/styles.js +7 -7
- package/esm/components/EditRow/index.js +15 -15
- package/esm/components/ValuationRange/index.js +2 -2
- package/package.json +1 -1
- package/types/components/EditRow/index.d.ts +3 -1
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
color: ${s.colors[a].light};
|
|
14
14
|
}
|
|
15
15
|
`,l=(s,a)=>`
|
|
16
|
-
color: ${s.colors[a].main};
|
|
16
|
+
color: ${a!=="neutral"?s.colors[a].main:s.colors.neutral.light};
|
|
17
17
|
background-color: transparent;
|
|
18
18
|
|
|
19
19
|
:hover {
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
background-color: ${s.colors[a].light}
|
|
41
41
|
}
|
|
42
42
|
`,outline:n,flat:l};exports.colorStyles=t,exports.disabledColorStyles=(s,a)=>a==="solid"?`
|
|
43
|
-
${e(s)};
|
|
43
|
+
${e(s)};
|
|
44
44
|
background-color: ${s.colors.gray.light4};`:a==="outline"?`
|
|
45
|
-
${e(s)};
|
|
45
|
+
${e(s)};
|
|
46
46
|
border: 2px solid ${s.colors.gray.light1};`:e(s),exports.flatColorStyles=l,exports.fontSizes=r,exports.largeSizeStyles=(s,a="auto")=>`
|
|
47
47
|
min-width: ${s?"8.5rem":a};
|
|
48
48
|
padding: ${s?"8px 24px":"16px 24px"};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("styled-components"),l=require("../../theme.js"),r=require("../../typography/BodyText/index.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("styled-components"),l=require("../../theme.js"),r=require("../../typography/BodyText/index.js"),n=require("../Button/index.js"),a=require("../Chip/index.js"),i=require("../Textfield/index.js");function u(q){return q&&typeof q=="object"&&"default"in q?q:{default:q}}require("../../shared/media-queries.js"),require("../Spinner/index.js"),require("../../typography/ButtonText/index.js"),require("../Button/styles.js"),require("../../icons/components/CloseIcon.js"),require("../Chip/styles.js"),require("../FieldLabel.js"),require("../../shared/helpers.js");var o=u(e),d=u(t);const s=d.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
border-bottom: 1px solid ${l.default.colors.gray.light5};
|
|
4
|
-
`,
|
|
4
|
+
`,f=d.default.form`
|
|
5
5
|
flex: 1;
|
|
6
6
|
flex-direction: column;
|
|
7
7
|
margin-bottom: 1rem;
|
|
8
|
-
`,c=d.default(
|
|
8
|
+
`,c=d.default(i.TextField)`
|
|
9
9
|
max-width: 20rem;
|
|
10
10
|
`,m=d.default.div`
|
|
11
11
|
flex: 1;
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
align-items: flex-end;
|
|
14
14
|
justify-content: flex-end;
|
|
15
15
|
margin-top: 1rem;
|
|
16
|
-
`,p=d.default(
|
|
16
|
+
`,p=d.default(n.Button)`
|
|
17
17
|
min-width: 5rem;
|
|
18
|
-
`,x=d.default(
|
|
18
|
+
`,x=d.default(n.Button)`
|
|
19
19
|
min-width: 5rem;
|
|
20
20
|
margin-right: 1rem;
|
|
21
21
|
`,y=d.default(r.BodyLink)`
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
flex: 4;
|
|
27
27
|
`,g=d.default(h)`
|
|
28
28
|
color: ${l.default.colors.text.disabled};
|
|
29
|
-
`,
|
|
29
|
+
`,v=d.default.div`
|
|
30
30
|
display: flex;
|
|
31
31
|
flex-wrap: wrap;
|
|
32
|
-
`,
|
|
33
|
-
margin: 0.
|
|
34
|
-
`;exports.default=({value:
|
|
32
|
+
`,j=d.default(a.Chip)`
|
|
33
|
+
margin: 0.5rem;
|
|
34
|
+
`;exports.default=({value:q,label:k,onChange:P,onEdit:F,options:M=[],inputProps:O={},isClearable:V=!1,isEditionDisabled:z=!1,editText:A,saveText:G,cancelText:H,noValueText:J,formatterFunc:D,isSingleSelect:K,color:S="secondary"})=>{const[E,C]=e.useState(q),[N,Q]=e.useState(q),[B,_]=e.useState(!1),T=typeof E=="string",R=D&&T?D==null?void 0:D(E):E,U=T?R:E.join(", "),$=E.length>0;e.useEffect(()=>F==null?void 0:F(B),[F,B]);const I=()=>{B?C(N):Q(E),_(b=>!b)};return o.default.createElement(s,null,!B&&o.default.createElement(o.default.Fragment,null,o.default.createElement(y,null,k),$&&o.default.createElement(h,null,U),!$&&o.default.createElement(g,null,J),o.default.createElement(n.Button,{variant:"flat",color:S,onClick:I,isDisabled:z},A)),B&&o.default.createElement(f,{onSubmit:b=>{b.preventDefault(),P==null||P(E),_(!1)}},o.default.createElement(y,null,k),T&&o.default.createElement(c,{...O,autoFocus:!0,value:E,label:k,onChange:b=>C(b.target.value)}),!T&&o.default.createElement(v,null,M.map(b=>o.default.createElement(j,{color:S,onClick:W=>{W.preventDefault(),(w=>{if(typeof E!="object")throw new Error("Cannot toggle chip on other than array");if(K)return E.includes(w)&&V?void C([]):void C([w]);if(E.includes(w)){const L=E.filter(X=>X!==w);C(L)}else C(L=>[...L,w])})(b)},key:b,variant:E.includes(b)?"solid":"outline"},b))),o.default.createElement(m,null,o.default.createElement(x,{type:"button",variant:"flat",color:"neutral",onClick:I},H),o.default.createElement(p,{type:"submit",color:S},G))))};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("styled-components"),l=require("../../typography/BodyText/index.js"),a=require("../../typography/Heading/index.js");function r(h){return h&&typeof h=="object"&&"default"in h?h:{default:h}}require("../../shared/media-queries.js");var o=r(e),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("styled-components"),l=require("../../typography/BodyText/index.js"),a=require("../../typography/Heading/index.js");function r(h){return h&&typeof h=="object"&&"default"in h?h:{default:h}}require("../../shared/media-queries.js");var o=r(e),i=r(t);const n=i.default.div`
|
|
2
2
|
margin: 0 1rem;
|
|
3
|
-
`,d=
|
|
3
|
+
`,d=i.default.div`
|
|
4
4
|
flex: 1;
|
|
5
5
|
display: flex;
|
|
6
6
|
justify-content: center;
|
|
7
7
|
align-items: flex-end;
|
|
8
|
-
`,u=
|
|
8
|
+
`,u=i.default.div`
|
|
9
9
|
white-space: nowrap;
|
|
10
10
|
color: ${({theme:h,$color:x,$type:y})=>h.colors[x][y]};
|
|
11
|
-
`,c=
|
|
11
|
+
`,c=i.default(a.Subtitle)`
|
|
12
12
|
color: ${({theme:h})=>h.colors.text.disabled};
|
|
13
|
-
`,s=
|
|
13
|
+
`,s=i.default.div`
|
|
14
14
|
width: 100%;
|
|
15
15
|
align-items: center;
|
|
16
16
|
display: flex;
|
|
17
17
|
padding: 0.25rem 0;
|
|
18
|
-
`,m=
|
|
18
|
+
`,m=i.default(l.Caption).attrs({as:"span"})`
|
|
19
19
|
white-space: nowrap;
|
|
20
20
|
width: 20%;
|
|
21
21
|
text-align: center;
|
|
22
22
|
color: ${({theme:h})=>h.colors.text.disabled};
|
|
23
|
-
`,f=
|
|
23
|
+
`,f=i.default.div`
|
|
24
24
|
width: 80%;
|
|
25
25
|
border-left: ${({theme:h,$color:x,$type:y})=>`1px solid ${h.colors[x][y]}`};
|
|
26
26
|
border-right: ${({theme:h,$color:x,$type:y})=>`1px solid ${h.colors[x][y]}`};
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
align-items: flex-end;
|
|
31
31
|
justify-content: center;
|
|
32
32
|
margin: auto;
|
|
33
|
-
`,p=
|
|
33
|
+
`,p=i.default.div`
|
|
34
34
|
height: 0.33rem;
|
|
35
35
|
width: 100%;
|
|
36
36
|
background: ${({theme:h,$color:x,$type:y})=>h.colors[x][y]};
|
|
37
|
-
`,$=
|
|
37
|
+
`,$=i.default.div`
|
|
38
38
|
background: ${({theme:h,$color:x,$type:y})=>h.colors[x][y]};
|
|
39
39
|
width: 1px;
|
|
40
40
|
height: 0.7rem;
|
|
41
41
|
top: 0;
|
|
42
42
|
position: absolute;
|
|
43
|
-
`;exports.default=({intervalMin:h=0,intervalMax:x=0,value:y=0,color:g="primary",noApproximateSymbol:j=!1,isDisabled:q=!1,manualValuationText:v=""})=>{const E=new Intl.NumberFormat("sv-SE"),w=h>0&&x>0&&!v,S=y>0&&!v,b=q?"lighter":"main";return o.default.createElement(
|
|
43
|
+
`;exports.default=({intervalMin:h=0,intervalMax:x=0,value:y=0,color:g="primary",noApproximateSymbol:j=!1,isDisabled:q=!1,manualValuationText:v=""})=>{const E=new Intl.NumberFormat("sv-SE"),w=h>0&&x>0&&!v,S=y>0&&!v,b=q?"lighter":"main";return o.default.createElement(n,null,o.default.createElement(s,null,o.default.createElement(m,null,w?`- ${E.format(h)}`:""),o.default.createElement(d,null,o.default.createElement(u,{$color:g,$type:b},S&&o.default.createElement(o.default.Fragment,null,o.default.createElement(a.Title,{as:"span"},`${j?"":"~ "}${E.format(y)} `),o.default.createElement(a.Subtitle,{as:"span"},"kr")),v&&o.default.createElement(c,{as:"span"},v))),o.default.createElement(m,null,w?`+ ${E.format(x)}`:"")),o.default.createElement(f,{$color:g,$type:b},o.default.createElement(p,{$color:g,$type:b}),o.default.createElement($,{$color:g,$type:b})))};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ButtonSmallTextStyle as
|
|
1
|
+
import{ButtonSmallTextStyle as c,ButtonRegularTextStyle as t,ButtonLargeTextStyle as n}from"../../typography/ButtonText/index.js";import"react";import"styled-components";const i={smaller:c,small:t,regular:t,large:n},d=(o,r="auto")=>`
|
|
2
2
|
min-width: ${o?"4rem":r};
|
|
3
3
|
padding: ${o?"11px 10px":"12px"};
|
|
4
4
|
`,e=(o,r="auto")=>`
|
|
@@ -10,7 +10,7 @@ import{ButtonSmallTextStyle as a,ButtonRegularTextStyle as t,ButtonLargeTextStyl
|
|
|
10
10
|
`,$=(o,r="auto")=>`
|
|
11
11
|
min-width: ${o?"8.5rem":r};
|
|
12
12
|
padding: ${o?"8px 24px":"16px 24px"};
|
|
13
|
-
`,
|
|
13
|
+
`,u=(o,r)=>`
|
|
14
14
|
color: ${o.colors.text.light};
|
|
15
15
|
background-color: ${o.colors[r].main};
|
|
16
16
|
|
|
@@ -37,8 +37,8 @@ import{ButtonSmallTextStyle as a,ButtonRegularTextStyle as t,ButtonLargeTextStyl
|
|
|
37
37
|
border: 2px solid ${o.colors[r].light};
|
|
38
38
|
color: ${o.colors[r].light};
|
|
39
39
|
}
|
|
40
|
-
`,
|
|
41
|
-
color: ${o.colors[r].main};
|
|
40
|
+
`,a=(o,r)=>`
|
|
41
|
+
color: ${r!=="neutral"?o.colors[r].main:o.colors.neutral.light};
|
|
42
42
|
background-color: transparent;
|
|
43
43
|
|
|
44
44
|
:hover {
|
|
@@ -52,7 +52,7 @@ import{ButtonSmallTextStyle as a,ButtonRegularTextStyle as t,ButtonLargeTextStyl
|
|
|
52
52
|
color: ${o.colors.gray.light1};
|
|
53
53
|
cursor: not-allowed;
|
|
54
54
|
`,g=(o,r)=>r==="solid"?`
|
|
55
|
-
${l(o)};
|
|
55
|
+
${l(o)};
|
|
56
56
|
background-color: ${o.colors.gray.light4};`:r==="outline"?`
|
|
57
|
-
${l(o)};
|
|
58
|
-
border: 2px solid ${o.colors.gray.light1};`:l(o),
|
|
57
|
+
${l(o)};
|
|
58
|
+
border: 2px solid ${o.colors.gray.light1};`:l(o),x={solid:u,outline:s,flat:a};export{x as colorStyles,g as disabledColorStyles,a as flatColorStyles,i as fontSizes,$ as largeSizeStyles,s as outlineColorStyles,p as regularSizeStyles,e as smallSizeStyles,d as smallerSizeStyles};
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import t,{useState as
|
|
1
|
+
import t,{useState as u,useEffect as N}from"react";import l from"styled-components";import E from"../../theme.js";import{BodyLink as O,BodyText as z}from"../../typography/BodyText/index.js";import{Button as f}from"../Button/index.js";import{Chip as A}from"../Chip/index.js";import{TextField as G}from"../Textfield/index.js";import"../../shared/media-queries.js";import"../Spinner/index.js";import"../../typography/ButtonText/index.js";import"../Button/styles.js";import"../../icons/components/CloseIcon.js";import"../Chip/styles.js";import"../FieldLabel.js";import"../../shared/helpers.js";const H=l.div`
|
|
2
2
|
display: flex;
|
|
3
|
-
border-bottom: 1px solid ${
|
|
4
|
-
`,
|
|
3
|
+
border-bottom: 1px solid ${E.colors.gray.light5};
|
|
4
|
+
`,J=l.form`
|
|
5
5
|
flex: 1;
|
|
6
6
|
flex-direction: column;
|
|
7
7
|
margin-bottom: 1rem;
|
|
8
|
-
`,
|
|
8
|
+
`,K=l(G)`
|
|
9
9
|
max-width: 20rem;
|
|
10
|
-
`,
|
|
10
|
+
`,M=l.div`
|
|
11
11
|
flex: 1;
|
|
12
12
|
display: flex;
|
|
13
13
|
align-items: flex-end;
|
|
14
14
|
justify-content: flex-end;
|
|
15
15
|
margin-top: 1rem;
|
|
16
|
-
`,
|
|
16
|
+
`,P=l(f)`
|
|
17
17
|
min-width: 5rem;
|
|
18
|
-
`,
|
|
18
|
+
`,Q=l(f)`
|
|
19
19
|
min-width: 5rem;
|
|
20
20
|
margin-right: 1rem;
|
|
21
|
-
`,
|
|
21
|
+
`,v=l(O)`
|
|
22
22
|
flex: 1;
|
|
23
23
|
margin-right: 1rem;
|
|
24
|
-
`,j=
|
|
24
|
+
`,j=l(z)`
|
|
25
25
|
flex: 1rem;
|
|
26
26
|
flex: 4;
|
|
27
|
-
`,
|
|
28
|
-
color: ${
|
|
29
|
-
`,
|
|
27
|
+
`,U=l(j)`
|
|
28
|
+
color: ${E.colors.text.disabled};
|
|
29
|
+
`,W=l.div`
|
|
30
30
|
display: flex;
|
|
31
31
|
flex-wrap: wrap;
|
|
32
|
-
`,
|
|
33
|
-
margin: 0.
|
|
34
|
-
`,
|
|
32
|
+
`,X=l(A)`
|
|
33
|
+
margin: 0.5rem;
|
|
34
|
+
`,Y=({value:p,label:a,onChange:h,onEdit:m,options:C=[],inputProps:B={},isClearable:b=!1,isEditionDisabled:w=!1,editText:S,saveText:T,cancelText:V,noValueText:k,formatterFunc:c,isSingleSelect:F,color:d="secondary"})=>{const[n,r]=u(p),[D,L]=u(p),[o,x]=u(!1),s=typeof n=="string",I=c&&s?c==null?void 0:c(n):n,R=s?I:n.join(", "),g=n.length>0;N(()=>m==null?void 0:m(o),[m,o]);const y=()=>{o?r(D):L(n),x(e=>!e)},_=e=>{e.preventDefault(),h==null||h(n),x(!1)},$=e=>{if(typeof n!="object")throw new Error("Cannot toggle chip on other than array");if(F){if(n.includes(e)&&b){r([]);return}r([e]);return}if(n.includes(e)){const i=n.filter(q=>q!==e);r(i);return}r(i=>[...i,e])};return t.createElement(H,null,!o&&t.createElement(t.Fragment,null,t.createElement(v,null,a),g&&t.createElement(j,null,R),!g&&t.createElement(U,null,k),t.createElement(f,{variant:"flat",color:d,onClick:y,isDisabled:w},S)),o&&t.createElement(J,{onSubmit:_},t.createElement(v,null,a),s&&t.createElement(K,{...B,autoFocus:!0,value:n,label:a,onChange:e=>r(e.target.value)}),!s&&t.createElement(W,null,C.map(e=>t.createElement(X,{color:d,onClick:i=>{i.preventDefault(),$(e)},key:e,variant:n.includes(e)?"solid":"outline"},e))),t.createElement(M,null,t.createElement(Q,{type:"button",variant:"flat",color:"neutral",onClick:y},V),t.createElement(P,{type:"submit",color:d},T))))};export{Y as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import t from"react";import o from"styled-components";import{Caption as f}from"../../typography/BodyText/index.js";import{Subtitle as m,
|
|
1
|
+
import t from"react";import o from"styled-components";import{Caption as f}from"../../typography/BodyText/index.js";import{Subtitle as m,Title as h}from"../../typography/Heading/index.js";import"../../shared/media-queries.js";const u=o.div`
|
|
2
2
|
margin: 0 1rem;
|
|
3
3
|
`,y=o.div`
|
|
4
4
|
flex: 1;
|
|
@@ -40,4 +40,4 @@ import t from"react";import o from"styled-components";import{Caption as f}from".
|
|
|
40
40
|
height: 0.7rem;
|
|
41
41
|
top: 0;
|
|
42
42
|
position: absolute;
|
|
43
|
-
`,C=({intervalMin:e=0,intervalMax:n=0,value:r=0,color:
|
|
43
|
+
`,C=({intervalMin:e=0,intervalMax:n=0,value:r=0,color:l="primary",noApproximateSymbol:p=!1,isDisabled:g=!1,manualValuationText:s=""})=>{const i=new Intl.NumberFormat("sv-SE"),c=e>0&&n>0&&!s,$=r>0&&!s,a=g?"lighter":"main";return t.createElement(u,null,t.createElement(w,null,t.createElement(d,null,c?`- ${i.format(e)}`:""),t.createElement(y,null,t.createElement(E,{$color:l,$type:a},$&&t.createElement(t.Fragment,null,t.createElement(h,{as:"span"},`${p?"":"~ "}${i.format(r)} `),t.createElement(m,{as:"span"},"kr")),s&&t.createElement(b,{as:"span"},s))),t.createElement(d,null,c?`+ ${i.format(n)}`:"")),t.createElement(x,{$color:l,$type:a},t.createElement(v,{$color:l,$type:a}),t.createElement(R,{$color:l,$type:a})))};export{C as default};
|
package/package.json
CHANGED
|
@@ -12,8 +12,10 @@ export interface EditRowProps<T> {
|
|
|
12
12
|
isSingleSelect?: boolean;
|
|
13
13
|
inputProps?: TextFieldProps;
|
|
14
14
|
isClearable?: boolean;
|
|
15
|
+
isEditionDisabled?: boolean;
|
|
15
16
|
onChange?(value: T): void;
|
|
17
|
+
onEdit?(isEditing: boolean): void;
|
|
16
18
|
formatterFunc?(value: string): string;
|
|
17
19
|
}
|
|
18
|
-
declare const EditRow: <T extends string | string[]>({ value: initialValue, label, onChange, options, inputProps, isClearable, editText, saveText, cancelText, noValueText, formatterFunc, isSingleSelect, color, }: EditRowProps<T>) => JSX.Element;
|
|
20
|
+
declare const EditRow: <T extends string | string[]>({ value: initialValue, label, onChange, onEdit, options, inputProps, isClearable, isEditionDisabled, editText, saveText, cancelText, noValueText, formatterFunc, isSingleSelect, color, }: EditRowProps<T>) => JSX.Element;
|
|
19
21
|
export default EditRow;
|