@lanaco/lnc-react-ui 4.0.211 → 4.0.212
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/dist/DragAndDropFile.cjs +10 -10
- package/dist/DragAndDropFile.js +374 -348
- package/dist/DragDropFiles.cjs +4 -4
- package/dist/DragDropFiles.js +38 -39
- package/package.json +1 -1
package/dist/DragDropFiles.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";const l=require("react/jsx-runtime"),s=require("react"),$=require("./emotion-styled.browser.esm-BtEseadx.cjs"),B=require("./DragAndDropFile.cjs"),E=require("./UploadedFile.cjs"),
|
|
1
|
+
"use strict";const l=require("react/jsx-runtime"),s=require("react"),$=require("./emotion-styled.browser.esm-BtEseadx.cjs"),B=require("./DragAndDropFile.cjs"),E=require("./UploadedFile.cjs"),p=require("./utils-CITgSxXe.cjs"),G=require("./FlexGrid.cjs"),f=require("./FlexGridItem.cjs"),M=require("./emotion-element-f0de968e.browser.esm-B7k6i6lC.cjs"),U=$.styled.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 1rem;
|
|
5
5
|
|
|
6
|
-
border: ${t=>`1px solid ${
|
|
7
|
-
border-radius: ${t=>
|
|
6
|
+
border: ${t=>`1px solid ${p.getColorRgbaValue(t.theme,"DragDropFiles",t.color,"enabled","border")}`};
|
|
7
|
+
border-radius: ${t=>p.getBorderRadiusValueWithUnits(t.theme,"regular")};
|
|
8
8
|
padding: 1.25rem 2.5rem;
|
|
9
9
|
|
|
10
10
|
& .file-item-lnc {
|
|
11
11
|
padding: 0.5rem 0.813rem;
|
|
12
12
|
height: 100%;
|
|
13
13
|
}
|
|
14
|
-
`,V=s.forwardRef((t,
|
|
14
|
+
`,V=s.forwardRef((t,g)=>{const{id:D="",disabled:x=!1,preventDefault:b=!1,acceptDropzone:q={},acceptInput:C,multiple:F=!0,selectFileText:j="Select file",dndFileText:R="Drag and drop file here or",control:w,showFileSize:a=!0,files:S=[],onChange:d=()=>{},onFocus:y=()=>{},onBlur:z=()=>{},onDropAccepted:m=()=>{},onDrop:u=()=>{},fileClick:A=()=>{},onCancel:k=()=>{},color:i="primary",size:c="small",dragAndDropFileProps:v,uploadedFileProps:n,..._}=t;var I={theme:M.useTheme(),size:c,color:i};const[r,h]=s.useState([]);s.useEffect(()=>{},[S]);const N=s.useCallback((e,o)=>{u&&u(e,o)},[]),O=s.useCallback(e=>{m&&m(e)},[]),T=e=>{var o;(o=e.target)!=null&&o.files?h([...r,...e.target.files]):e&&h([...r,...e]),d&&d(e)};return l.jsx(U,{ref:g,...I,..._,children:l.jsxs(G,{direction:"RowReverse",children:[l.jsx(f,{M:(r==null?void 0:r.length)>0?6:12,children:l.jsx(B,{id:D,disabled:x,preventDefault:b,acceptDropzone:q,acceptInput:C,multiple:F,selectFileText:j,dndFileText:R,control:w,showFileSize:a,showDnD:!((r==null?void 0:r.length)>0),onChange:T,onFocus:y,onBlur:z,onDrop:N,onDropAccepted:O,color:i,size:c,...v})}),r==null?void 0:r.map((e,o)=>l.jsx(f,{M:6,children:l.jsx(E,{fileName:e.name,fileSize:e.size,showFileSize:a,color:i,size:c,onFileClick:A,onCancel:k,...n,className:"file-item-lnc "+(n==null?void 0:n.className)},o)},o))]})})});module.exports=V;
|
package/dist/DragDropFiles.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as t, jsxs as B } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as G, useState as M, useEffect as U, useCallback as
|
|
2
|
+
import { forwardRef as G, useState as M, useEffect as U, useCallback as p } from "react";
|
|
3
3
|
import { s as V } from "./emotion-styled.browser.esm-BNN1dTl3.js";
|
|
4
4
|
import E from "./DragAndDropFile.js";
|
|
5
5
|
import P from "./UploadedFile.js";
|
|
6
6
|
import { c as W, b as q } from "./utils-B2fsQ6PS.js";
|
|
7
7
|
import H from "./FlexGrid.js";
|
|
8
|
-
import
|
|
8
|
+
import h from "./FlexGridItem.js";
|
|
9
9
|
import { u as J } from "./emotion-element-f0de968e.browser.esm-CkCiQliQ.js";
|
|
10
10
|
const K = V.div`
|
|
11
11
|
display: flex;
|
|
@@ -26,29 +26,29 @@ const K = V.div`
|
|
|
26
26
|
padding: 0.5rem 0.813rem;
|
|
27
27
|
height: 100%;
|
|
28
28
|
}
|
|
29
|
-
`, te = G((l,
|
|
29
|
+
`, te = G((l, g) => {
|
|
30
30
|
const {
|
|
31
|
-
id:
|
|
32
|
-
disabled:
|
|
33
|
-
preventDefault:
|
|
34
|
-
acceptDropzone:
|
|
35
|
-
acceptInput:
|
|
36
|
-
multiple:
|
|
37
|
-
selectFileText:
|
|
38
|
-
dndFileText:
|
|
39
|
-
control:
|
|
40
|
-
showFileSize:
|
|
41
|
-
files:
|
|
31
|
+
id: D = "",
|
|
32
|
+
disabled: u = !1,
|
|
33
|
+
preventDefault: x = !1,
|
|
34
|
+
acceptDropzone: b = {},
|
|
35
|
+
acceptInput: C,
|
|
36
|
+
multiple: F = !0,
|
|
37
|
+
selectFileText: z = "Select file",
|
|
38
|
+
dndFileText: A = "Drag and drop file here or",
|
|
39
|
+
control: R,
|
|
40
|
+
showFileSize: s = !0,
|
|
41
|
+
files: S = [],
|
|
42
42
|
// ----------------------------------------
|
|
43
|
-
onChange:
|
|
43
|
+
onChange: d = () => {
|
|
44
44
|
},
|
|
45
45
|
onFocus: v = () => {
|
|
46
46
|
},
|
|
47
47
|
onBlur: w = () => {
|
|
48
48
|
},
|
|
49
|
-
onDropAccepted:
|
|
49
|
+
onDropAccepted: c = () => {
|
|
50
50
|
},
|
|
51
|
-
onDrop:
|
|
51
|
+
onDrop: m = () => {
|
|
52
52
|
},
|
|
53
53
|
fileClick: y = () => {
|
|
54
54
|
},
|
|
@@ -62,32 +62,31 @@ const K = V.div`
|
|
|
62
62
|
...N
|
|
63
63
|
} = l;
|
|
64
64
|
var O = { theme: J(), size: n, color: a };
|
|
65
|
-
const [r,
|
|
65
|
+
const [r, f] = M([]);
|
|
66
66
|
U(() => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
f && f(e);
|
|
67
|
+
}, [S]);
|
|
68
|
+
const T = p((e, o) => {
|
|
69
|
+
m && m(e, o);
|
|
70
|
+
}, []), $ = p((e) => {
|
|
71
|
+
c && c(e);
|
|
73
72
|
}, []), j = (e) => {
|
|
74
73
|
var o;
|
|
75
|
-
(o = e.target) != null && o.files ?
|
|
74
|
+
(o = e.target) != null && o.files ? f([...r, ...e.target.files]) : e && f([...r, ...e]), d && d(e);
|
|
76
75
|
};
|
|
77
|
-
return /* @__PURE__ */ t(K, { ref:
|
|
78
|
-
/* @__PURE__ */ t(
|
|
76
|
+
return /* @__PURE__ */ t(K, { ref: g, ...O, ...N, children: /* @__PURE__ */ B(H, { direction: "RowReverse", children: [
|
|
77
|
+
/* @__PURE__ */ t(h, { M: (r == null ? void 0 : r.length) > 0 ? 6 : 12, children: /* @__PURE__ */ t(
|
|
79
78
|
E,
|
|
80
79
|
{
|
|
81
|
-
id:
|
|
82
|
-
disabled:
|
|
83
|
-
preventDefault:
|
|
84
|
-
acceptDropzone:
|
|
85
|
-
acceptInput:
|
|
86
|
-
multiple:
|
|
87
|
-
selectFileText:
|
|
88
|
-
dndFileText:
|
|
89
|
-
control:
|
|
90
|
-
showFileSize:
|
|
80
|
+
id: D,
|
|
81
|
+
disabled: u,
|
|
82
|
+
preventDefault: x,
|
|
83
|
+
acceptDropzone: b,
|
|
84
|
+
acceptInput: C,
|
|
85
|
+
multiple: F,
|
|
86
|
+
selectFileText: z,
|
|
87
|
+
dndFileText: A,
|
|
88
|
+
control: R,
|
|
89
|
+
showFileSize: s,
|
|
91
90
|
showDnD: !((r == null ? void 0 : r.length) > 0),
|
|
92
91
|
onChange: j,
|
|
93
92
|
onFocus: v,
|
|
@@ -99,12 +98,12 @@ const K = V.div`
|
|
|
99
98
|
...I
|
|
100
99
|
}
|
|
101
100
|
) }),
|
|
102
|
-
r == null ? void 0 : r.map((e, o) => /* @__PURE__ */ t(
|
|
101
|
+
r == null ? void 0 : r.map((e, o) => /* @__PURE__ */ t(h, { M: 6, children: /* @__PURE__ */ t(
|
|
103
102
|
P,
|
|
104
103
|
{
|
|
105
104
|
fileName: e.name,
|
|
106
105
|
fileSize: e.size,
|
|
107
|
-
showFileSize:
|
|
106
|
+
showFileSize: s,
|
|
108
107
|
color: a,
|
|
109
108
|
size: n,
|
|
110
109
|
onFileClick: y,
|