@kvdbil/components 15.0.39 → 15.0.41
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.
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
`,p=d.default(l.BodyText)`
|
|
25
25
|
flex: 1rem;
|
|
26
26
|
flex: 4;
|
|
27
|
-
`,
|
|
27
|
+
`,g=d.default(p)`
|
|
28
28
|
color: ${i.default.colors.text.disabled};
|
|
29
|
-
`,
|
|
29
|
+
`,y=d.default.div`
|
|
30
30
|
display: flex;
|
|
31
31
|
flex-wrap: wrap;
|
|
32
32
|
`,q=d.default(s.Chip)`
|
|
33
33
|
margin: 0.5rem;
|
|
34
|
-
`;exports.default=({value:r,label:i,onChange:l,onEdit:s,options:o=[],inputProps:a={},isClearable:d=!1,isEditionDisabled:v=!1,editText:b,saveText:C,cancelText:B,noValueText:T,formatterFunc:w,isSingleSelect:S,color:
|
|
34
|
+
`;exports.default=({value:r,label:i,onChange:l,onEdit:s,options:o=[],inputProps:a={},isClearable:d=!1,isEditionDisabled:v=!1,editText:b,saveText:C,cancelText:B,noValueText:T,formatterFunc:w,isSingleSelect:S,color:E="secondary",isInitialEditing:F})=>{const[k,D]=t.useState(r),[_,I]=t.useState(r),[L,M]=t.useState(!!F),P="string"==typeof k,$=w&&P?w?.(k):k,O=P?$:k.join(", "),V=k.length>0;t.useEffect((()=>s?.(L)),[s,L]);const z=()=>{L?D(_):I(k),M((e=>!e))};return e.jsxs(u,{children:[!L&&e.jsxs(e.Fragment,{children:[e.jsx(m,{children:i}),V&&e.jsx(p,{children:O}),!V&&e.jsx(g,{children:T}),e.jsx(n.Button,{variant:"flat",color:E,onClick:z,isDisabled:v,children:b})]}),L&&e.jsxs(c,{onSubmit:e=>{e.preventDefault(),l?.(k),M(!1)},children:[e.jsx(m,{children:i}),P&&e.jsx(x,{...a,autoFocus:!0,value:k,label:i,onChange:e=>D(e.target.value)}),!P&&e.jsx(y,{children:o.map((t=>e.jsx(q,{color:E,onClick:e=>{e.preventDefault(),(e=>{if("object"!=typeof k)throw new Error("Cannot toggle chip on other than array");if(S)return k.includes(e)&&d?void D([]):void D([e]);if(k.includes(e)){const t=k.filter((t=>t!==e));D(t)}else D((t=>[...t,e]))})(t)},variant:k.includes(t)?"solid":"outline",children:t},t)))}),e.jsxs(f,{children:[e.jsx(j,{type:"button",variant:"flat",color:"neutral",onClick:z,children:B}),e.jsx(h,{type:"submit",color:E,children:C})]})]})]})};
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import{jsxs as m,Fragment as
|
|
1
|
+
import{jsxs as m,Fragment as Q,jsx as t}from"react/jsx-runtime";import{useState as s,useEffect as R}from"react";import i from"styled-components";import v from"../../theme.js";import{BodyLink as U,BodyText as V}from"../../typography/BodyText/index.js";import{Button as f}from"../Button/index.js";import{Chip as W}from"../Chip/index.js";import{TextField as X}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 Y=i.div`
|
|
2
2
|
display: flex;
|
|
3
|
-
border-bottom: 1px solid ${
|
|
4
|
-
`,
|
|
3
|
+
border-bottom: 1px solid ${v.colors.gray.light5};
|
|
4
|
+
`,Z=i.form`
|
|
5
5
|
flex: 1;
|
|
6
6
|
flex-direction: column;
|
|
7
7
|
margin-bottom: 1rem;
|
|
8
|
-
`,
|
|
8
|
+
`,_=i(X)`
|
|
9
9
|
max-width: 20rem;
|
|
10
|
-
`,
|
|
10
|
+
`,q=i.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
|
-
`,q=i(f)`
|
|
17
|
-
min-width: 5rem;
|
|
18
16
|
`,z=i(f)`
|
|
19
17
|
min-width: 5rem;
|
|
18
|
+
`,A=i(f)`
|
|
19
|
+
min-width: 5rem;
|
|
20
20
|
margin-right: 1rem;
|
|
21
|
-
`,
|
|
21
|
+
`,y=i(U)`
|
|
22
22
|
flex: 1;
|
|
23
23
|
margin-right: 1rem;
|
|
24
|
-
`,C=i(
|
|
24
|
+
`,C=i(V)`
|
|
25
25
|
flex: 1rem;
|
|
26
26
|
flex: 4;
|
|
27
|
-
`,
|
|
28
|
-
color: ${
|
|
29
|
-
`,
|
|
27
|
+
`,G=i(C)`
|
|
28
|
+
color: ${v.colors.text.disabled};
|
|
29
|
+
`,M=i.div`
|
|
30
30
|
display: flex;
|
|
31
31
|
flex-wrap: wrap;
|
|
32
|
-
`,
|
|
32
|
+
`,ee=i(W)`
|
|
33
33
|
margin: 0.5rem;
|
|
34
|
-
`,
|
|
34
|
+
`,re=({value:p,label:d,onChange:w,onEdit:u,options:j=[],inputProps:E={},isClearable:T=!1,isEditionDisabled:k=!1,editText:D,saveText:F,cancelText:S,noValueText:B,formatterFunc:h,isSingleSelect:I,color:c="secondary",isInitialEditing:$})=>{const[r,o]=s(p),[H,J]=s(p),[l,x]=s(!!$),a=typeof r=="string",K=h&&a?h?.(r):r,L=a?K:r.join(", "),g=r.length>0;R(()=>u?.(l),[u,l]);const b=()=>{l?o(H):J(r),x(e=>!e)},N=e=>{e.preventDefault(),w?.(r),x(!1)},O=e=>{if(typeof r!="object")throw new Error("Cannot toggle chip on other than array");if(I){if(r.includes(e)&&T){o([]);return}o([e]);return}if(r.includes(e)){const n=r.filter(P=>P!==e);o(n);return}o(n=>[...n,e])};return m(Y,{children:[!l&&m(Q,{children:[t(y,{children:d}),g&&t(C,{children:L}),!g&&t(G,{children:B}),t(f,{variant:"flat",color:c,onClick:b,isDisabled:k,children:D})]}),l&&m(Z,{onSubmit:N,children:[t(y,{children:d}),a&&t(_,{...E,autoFocus:!0,value:r,label:d,onChange:e=>o(e.target.value)}),!a&&t(M,{children:j.map(e=>t(ee,{color:c,onClick:n=>{n.preventDefault(),O(e)},variant:r.includes(e)?"solid":"outline",children:e},e))}),m(q,{children:[t(A,{type:"button",variant:"flat",color:"neutral",onClick:b,children:S}),t(z,{type:"submit",color:c,children:F})]})]})]})};export{re as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kvdbil/components",
|
|
3
|
-
"version": "15.0.
|
|
3
|
+
"version": "15.0.41",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@testing-library/user-event": "^14.5.2",
|
|
70
70
|
"@types/classnames": "^2.2.11",
|
|
71
71
|
"@types/jest": "^29.5.12",
|
|
72
|
-
"@types/node": "22.13.
|
|
72
|
+
"@types/node": "22.13.11",
|
|
73
73
|
"@types/react": "^18.3.8",
|
|
74
74
|
"@types/react-collapse": "^5.0.4",
|
|
75
75
|
"@types/react-dom": "^18.3.0",
|
package/package.json.tmp
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kvdbil/components",
|
|
3
|
-
"version": "15.0.
|
|
3
|
+
"version": "15.0.41",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@testing-library/user-event": "^14.5.2",
|
|
69
69
|
"@types/classnames": "^2.2.11",
|
|
70
70
|
"@types/jest": "^29.5.12",
|
|
71
|
-
"@types/node": "22.13.
|
|
71
|
+
"@types/node": "22.13.11",
|
|
72
72
|
"@types/react": "^18.3.8",
|
|
73
73
|
"@types/react-collapse": "^5.0.4",
|
|
74
74
|
"@types/react-dom": "^18.3.0",
|
|
@@ -16,6 +16,7 @@ export interface EditRowProps<T> {
|
|
|
16
16
|
onChange?(value: T): void;
|
|
17
17
|
onEdit?(isEditing: boolean): void;
|
|
18
18
|
formatterFunc?(value: string): string;
|
|
19
|
+
isInitialEditing?: boolean;
|
|
19
20
|
}
|
|
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>) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
declare const EditRow: <T extends string | string[]>({ value: initialValue, label, onChange, onEdit, options, inputProps, isClearable, isEditionDisabled, editText, saveText, cancelText, noValueText, formatterFunc, isSingleSelect, color, isInitialEditing, }: EditRowProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
21
22
|
export default EditRow;
|