@uploadcare/react-uploader
Advanced tools
Comparing version 0.6.1 to 1.0.0
@@ -1,8 +0,8 @@ | ||
import type { ConfigType } from '@uploadcare/blocks'; | ||
import { defineLocale } from '@uploadcare/blocks'; | ||
import type { EventMap } from '@uploadcare/blocks'; | ||
import type { ConfigType } from '@uploadcare/file-uploader'; | ||
import { defineLocale } from '@uploadcare/file-uploader'; | ||
import type { EventMap } from '@uploadcare/file-uploader'; | ||
import { FC } from 'react'; | ||
import { default as React_2 } from 'react'; | ||
import type { Ref } from 'react'; | ||
import { UploadCtxProvider } from '@uploadcare/blocks'; | ||
import { UploadCtxProvider } from '@uploadcare/file-uploader'; | ||
@@ -52,4 +52,4 @@ export { defineLocale } | ||
export * from "@uploadcare/blocks/types/index.js"; | ||
export * from "@uploadcare/file-uploader/types/index.js"; | ||
export { } |
@@ -1,4 +0,4 @@ | ||
import s, { useState as B, useEffect as F, useMemo as f } from "react"; | ||
import * as i from "@uploadcare/blocks"; | ||
import { UploadCtxProvider as W, defineLocale as q } from "@uploadcare/blocks"; | ||
import c, { useState as F, useEffect as b, useMemo as f } from "react"; | ||
import * as i from "@uploadcare/file-uploader"; | ||
import { UploadCtxProvider as W, defineLocale as q } from "@uploadcare/file-uploader"; | ||
const R = /* @__PURE__ */ new Set([ | ||
@@ -9,45 +9,45 @@ "children", | ||
"className" | ||
]), b = (e = {}) => Object == null ? void 0 : Object.keys(e).reduce((r, o) => { | ||
var a, n; | ||
const t = e == null ? void 0 : e[o], l = `on${(n = (a = t == null ? void 0 : t.split("-")) == null ? void 0 : a.map((c) => c.charAt(0).toUpperCase() + c.slice(1))) == null ? void 0 : n.join("")}`; | ||
return r[l] = t, r; | ||
}, {}), h = /* @__PURE__ */ new WeakMap(), O = (e) => { | ||
let r = h.get(e); | ||
return r === void 0 && (r = /* @__PURE__ */ new Map(), h.set(e, r)), r; | ||
]), O = (e = {}) => Object == null ? void 0 : Object.keys(e).reduce((n, o) => { | ||
var l, r; | ||
const t = e == null ? void 0 : e[o], a = `on${(r = (l = t == null ? void 0 : t.split("-")) == null ? void 0 : l.map((s) => s.charAt(0).toUpperCase() + s.slice(1))) == null ? void 0 : r.join("")}`; | ||
return n[a] = t, n; | ||
}, {}), h = /* @__PURE__ */ new WeakMap(), T = (e) => { | ||
let n = h.get(e); | ||
return n === void 0 && (n = /* @__PURE__ */ new Map(), h.set(e, n)), n; | ||
}, x = ({ | ||
node: e, | ||
nameProp: r, | ||
nameProp: n, | ||
valueProp: o, | ||
prevValueProp: a, | ||
event: n | ||
prevValueProp: l, | ||
event: r | ||
}) => { | ||
if (n !== void 0) { | ||
if (o !== a) { | ||
const t = O(e), l = t.has(n); | ||
let c = t.get(n); | ||
o !== void 0 ? l ? c.handleEvent = o : (c = { handleEvent: o }, t.set(n, c), e.addEventListener( | ||
n, | ||
(d) => c.handleEvent(d.detail) | ||
)) : l && (t.delete(n), e.removeEventListener(n, c)); | ||
if (r !== void 0) { | ||
if (o !== l) { | ||
const t = T(e), a = t.has(r); | ||
let s = t.get(r); | ||
o !== void 0 ? a ? s.handleEvent = o : (s = { handleEvent: o }, t.set(r, s), e.addEventListener( | ||
r, | ||
(d) => s.handleEvent(d.detail) | ||
)) : a && (t.delete(r), e.removeEventListener(r, s)); | ||
} | ||
return; | ||
} | ||
e[r] = o, o == null && r in HTMLElement.prototype && e.removeAttribute(r); | ||
}, T = (e, r, o) => { | ||
const a = {}, n = {}; | ||
return Object.entries(e).forEach(([t, l]) => { | ||
R.has(t) ? a[t === "className" ? "class" : t] = l : r.has(t) || t in o.prototype ? n[t] = l : a[t] = l; | ||
}), { reactProps: a, customElProps: n }; | ||
e[n] = o, o == null && n in HTMLElement.prototype && e.removeAttribute(n); | ||
}, j = (e, n, o) => { | ||
const l = {}, r = {}; | ||
return Object.entries(e).forEach(([t, a]) => { | ||
R.has(t) ? l[t === "className" ? "class" : t] = a : n.has(t) || t in o.prototype ? r[t] = a : l[t] = a; | ||
}), { reactProps: l, customElProps: r }; | ||
}, v = ({ | ||
react: e, | ||
// https://react.dev/warnings/invalid-hook-call-warning | ||
tag: r, | ||
tag: n, | ||
elClass: o, | ||
schemaEvents: a | ||
schemaEvents: l | ||
}) => { | ||
const n = b(a), t = new Set(Object.keys(n ?? {})), l = e.forwardRef( | ||
(c, d) => { | ||
const u = e.useRef(/* @__PURE__ */ new Map()), g = e.useRef(null), { reactProps: I, customElProps: M } = T(c, t, o); | ||
const r = O(l), t = new Set(Object.keys(r ?? {})), a = e.forwardRef( | ||
(s, d) => { | ||
const u = e.useRef(/* @__PURE__ */ new Map()), E = e.useRef(null), { reactProps: I, customElProps: M } = j(s, t, o); | ||
return e.useLayoutEffect(() => { | ||
if (g.current === null) | ||
if (E.current === null) | ||
return; | ||
@@ -57,22 +57,22 @@ const m = /* @__PURE__ */ new Map(); | ||
x({ | ||
node: g.current, | ||
node: E.current, | ||
nameProp: p, | ||
valueProp: M[p], | ||
prevValueProp: u.current.get(p), | ||
event: n[p] | ||
}), u.current.delete(p), m.set(p, c[p]); | ||
event: r[p] | ||
}), u.current.delete(p), m.set(p, s[p]); | ||
for (const [p, y] of u.current) | ||
x({ | ||
node: g.current, | ||
node: E.current, | ||
nameProp: p, | ||
valueProp: void 0, | ||
prevValueProp: y, | ||
event: n[p] | ||
event: r[p] | ||
}); | ||
u.current = m; | ||
}), e.createElement(r ?? o.__tag, { | ||
}), e.createElement(n ?? o.__tag, { | ||
...I, | ||
ref: e.useCallback( | ||
(m) => { | ||
g.current = m, typeof d == "function" ? d(m) : d !== null && (d.current = m); | ||
E.current = m, typeof d == "function" ? d(m) : d !== null && (d.current = m); | ||
}, | ||
@@ -84,110 +84,110 @@ [d] | ||
); | ||
return l.displayName = o.name, l; | ||
}, E = v({ | ||
react: s, | ||
tag: "lr-config", | ||
return a.displayName = o.name, a; | ||
}, g = v({ | ||
react: c, | ||
tag: "uc-config", | ||
elClass: i.Config | ||
}), P = v({ | ||
react: s, | ||
tag: "lr-upload-ctx-provider", | ||
}), C = v({ | ||
react: c, | ||
tag: "uc-upload-ctx-provider", | ||
elClass: i.UploadCtxProvider, | ||
schemaEvents: i.UploadCtxProvider.EventType | ||
}), C = (e) => { | ||
const r = {}, o = {}; | ||
return Object.entries(e).forEach(([a, n]) => { | ||
a.startsWith("on") ? r[a] = n : o[a] = n; | ||
}), P = (e) => { | ||
const n = {}, o = {}; | ||
return Object.entries(e).forEach(([l, r]) => { | ||
l.startsWith("on") ? n[l] = r : o[l] = r; | ||
}), { | ||
eventHandlers: r, | ||
eventHandlers: n, | ||
config: o | ||
}; | ||
}, j = "0.6.0", L = "React-Uploader", U = () => `${L}/${j}`, w = ({ children: e }) => e, A = () => { | ||
const [e, r] = B(!1); | ||
return F(() => { | ||
typeof window < "u" && r(!0); | ||
}, B = "0.6.1", N = "React-Uploader", U = () => `${N}/${B}`, w = ({ children: e }) => e, A = () => { | ||
const [e, n] = F(!1); | ||
return b(() => { | ||
typeof window < "u" && n(!0); | ||
}, []), e; | ||
}; | ||
i.registerBlocks(i); | ||
const N = v({ | ||
react: s, | ||
tag: "lr-file-uploader-regular", | ||
i.defineComponents(i); | ||
const _ = v({ | ||
react: c, | ||
tag: "uc-file-uploader-regular", | ||
elClass: i.FileUploaderRegular | ||
}), S = ({ | ||
}), X = ({ | ||
ctxName: e, | ||
className: r, | ||
className: n, | ||
classNameUploader: o, | ||
apiRef: a, | ||
fallback: n, | ||
apiRef: l, | ||
fallback: r, | ||
...t | ||
}) => { | ||
const l = f(() => e ?? i.UID.generate(), [e]), { eventHandlers: c, config: d } = f( | ||
() => C(t), | ||
const a = f(() => e ?? i.UID.generate(), [e]), { eventHandlers: s, config: d } = f( | ||
() => P(t), | ||
[t] | ||
), u = A(); | ||
return /* @__PURE__ */ s.createElement(w, { condition: u, fallback: n }, /* @__PURE__ */ s.createElement("div", { className: r }, /* @__PURE__ */ s.createElement(E, { userAgentIntegration: U(), "ctx-name": l, ...d }), /* @__PURE__ */ s.createElement( | ||
P, | ||
return /* @__PURE__ */ c.createElement(w, { condition: u, fallback: r }, /* @__PURE__ */ c.createElement("div", { className: n }, /* @__PURE__ */ c.createElement(g, { userAgentIntegration: U(), "ctx-name": a, ...d }), /* @__PURE__ */ c.createElement( | ||
C, | ||
{ | ||
ref: a, | ||
"ctx-name": l, | ||
...c | ||
ref: l, | ||
"ctx-name": a, | ||
...s | ||
} | ||
), /* @__PURE__ */ s.createElement(N, { class: o, "ctx-name": l }))); | ||
), /* @__PURE__ */ c.createElement(_, { class: o, "ctx-name": a }))); | ||
}; | ||
i.registerBlocks(i); | ||
const _ = v({ | ||
react: s, | ||
tag: "lr-file-uploader-minimal", | ||
i.defineComponents(i); | ||
const H = v({ | ||
react: c, | ||
tag: "uc-file-uploader-minimal", | ||
elClass: i.FileUploaderMinimal | ||
}), X = ({ | ||
}), D = ({ | ||
ctxName: e, | ||
className: r, | ||
className: n, | ||
classNameUploader: o, | ||
apiRef: a, | ||
fallback: n, | ||
apiRef: l, | ||
fallback: r, | ||
...t | ||
}) => { | ||
const l = f(() => e ?? i.UID.generate(), [e]), { eventHandlers: c, config: d } = f( | ||
() => C(t), | ||
const a = f(() => e ?? i.UID.generate(), [e]), { eventHandlers: s, config: d } = f( | ||
() => P(t), | ||
[t] | ||
), u = A(); | ||
return /* @__PURE__ */ s.createElement(w, { condition: u, fallback: n }, /* @__PURE__ */ s.createElement("div", { className: r }, /* @__PURE__ */ s.createElement(E, { userAgentIntegration: U(), "ctx-name": l, ...d }), /* @__PURE__ */ s.createElement( | ||
P, | ||
return /* @__PURE__ */ c.createElement(w, { condition: u, fallback: r }, /* @__PURE__ */ c.createElement("div", { className: n }, /* @__PURE__ */ c.createElement(g, { userAgentIntegration: U(), "ctx-name": a, ...d }), /* @__PURE__ */ c.createElement( | ||
C, | ||
{ | ||
ref: a, | ||
"ctx-name": l, | ||
...c | ||
ref: l, | ||
"ctx-name": a, | ||
...s | ||
} | ||
), /* @__PURE__ */ s.createElement(_, { class: o, "ctx-name": l }))); | ||
), /* @__PURE__ */ c.createElement(H, { class: o, "ctx-name": a }))); | ||
}; | ||
i.registerBlocks(i); | ||
const k = v({ | ||
react: s, | ||
tag: "lr-file-uploader-inline", | ||
i.defineComponents(i); | ||
const L = v({ | ||
react: c, | ||
tag: "uc-file-uploader-inline", | ||
elClass: i.FileUploaderMinimal | ||
}), D = ({ | ||
}), V = ({ | ||
ctxName: e, | ||
className: r, | ||
className: n, | ||
classNameUploader: o, | ||
apiRef: a, | ||
fallback: n, | ||
apiRef: l, | ||
fallback: r, | ||
...t | ||
}) => { | ||
const l = f(() => e ?? i.UID.generate(), [e]), { eventHandlers: c, config: d } = f( | ||
() => C(t), | ||
const a = f(() => e ?? i.UID.generate(), [e]), { eventHandlers: s, config: d } = f( | ||
() => P(t), | ||
[t] | ||
), u = A(); | ||
return /* @__PURE__ */ s.createElement(w, { condition: u, fallback: n }, /* @__PURE__ */ s.createElement("div", { className: r }, /* @__PURE__ */ s.createElement(E, { userAgentIntegration: U(), "ctx-name": l, ...d }), /* @__PURE__ */ s.createElement( | ||
P, | ||
return /* @__PURE__ */ c.createElement(w, { condition: u, fallback: r }, /* @__PURE__ */ c.createElement("div", { className: n }, /* @__PURE__ */ c.createElement(g, { userAgentIntegration: U(), "ctx-name": a, ...d }), /* @__PURE__ */ c.createElement( | ||
C, | ||
{ | ||
ref: a, | ||
"ctx-name": l, | ||
...c | ||
ref: l, | ||
"ctx-name": a, | ||
...s | ||
} | ||
), /* @__PURE__ */ s.createElement(k, { class: o, "ctx-name": l }))); | ||
), /* @__PURE__ */ c.createElement(L, { class: o, "ctx-name": a }))); | ||
}; | ||
export { | ||
D as FileUploaderInline, | ||
X as FileUploaderMinimal, | ||
S as FileUploaderRegular, | ||
V as FileUploaderInline, | ||
D as FileUploaderMinimal, | ||
X as FileUploaderRegular, | ||
W as UploadCtxProvider, | ||
q as defineLocale | ||
}; |
{ | ||
"name": "@uploadcare/react-uploader", | ||
"description": "React component for file uploads using Uploadcare", | ||
"version": "0.6.1", | ||
"version": "1.0.0", | ||
"private": false, | ||
@@ -30,3 +30,3 @@ "type": "module", | ||
"dependencies": { | ||
"@uploadcare/blocks": "^0.46.3", | ||
"@uploadcare/file-uploader": "^1.2.0", | ||
"@uploadcare/react-adapter": "^0.3.0" | ||
@@ -85,3 +85,3 @@ }, | ||
], | ||
"gitHead": "7a9d2bf3144fd140cfa640eb031927fb9fc480aa" | ||
"gitHead": "486c9c6691a208950d223ffda5c9e1f546b365e4" | ||
} |
@@ -104,3 +104,3 @@ # Uploadcare React Uploader | ||
```css | ||
.fileUploaderWrapper lr-file-uploader-regular { | ||
.fileUploaderWrapper uc-file-uploader-regular { | ||
} | ||
@@ -107,0 +107,0 @@ ``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
87708
497
2
+ Added@uploadcare/file-uploader@1.13.2(transitive)
- Removed@uploadcare/blocks@^0.46.3
- Removed@uploadcare/blocks@0.46.3(transitive)