@llmnative/react 1.5.1 → 1.6.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/dist/index.mjs CHANGED
@@ -2461,7 +2461,10 @@ var vn = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10
2461
2461
  loaded: "Loaded",
2462
2462
  removeFile: "Remove",
2463
2463
  uploadAnother: "Upload another file",
2464
- dropToParse: "Drop to parse"
2464
+ dropToParse: "Drop to parse",
2465
+ insertFromUrl: "Insert from URL",
2466
+ urlPlaceholder: "https://…/image.png",
2467
+ invalidUrl: "Enter a valid URL"
2465
2468
  },
2466
2469
  notifications: {
2467
2470
  title: "Notifications",
@@ -7976,17 +7979,37 @@ var vc = 120, yc = 88, bc = (e) => {
7976
7979
  onSave: T,
7977
7980
  onClose: D
7978
7981
  }), p);
7979
- }, Nc = ({ name: e, onChange: n = void 0, label: r = void 0, feedback: i = void 0, editable: a = !1, multiple: o = !1, accept: s = "image/*", required: c = !1, max: l = 100, previewHeight: u = 100, previewWidth: d = 100, uploadPath: f = void 0, srcsetWidths: p = void 0, storageKey: m = void 0, storageProvider: g = void 0, before: _ = void 0, after: v = void 0, wrapperClassName: y = void 0, className: b = void 0 }) => {
7980
- let { files: x, currentFile: S, fileInputRef: C, formWrapClass: w, handleUploadChange: T, handleUpload: E, handleRemove: D, handleSave: O, handleEdit: k, handleClose: A } = Ec(e, n, y, f, p, m, g), j = nd(e, {
7982
+ }, Nc = ({ name: e, onChange: n = void 0, label: r = void 0, feedback: i = void 0, editable: a = !1, multiple: o = !1, accept: s = "image/*", required: c = !1, max: l = 100, previewHeight: u = 100, previewWidth: d = 100, uploadPath: f = void 0, srcsetWidths: p = void 0, storageKey: m = void 0, storageProvider: g = void 0, allowUrl: _ = !1, before: v = void 0, after: y = void 0, wrapperClassName: b = void 0, className: x = void 0 }) => {
7983
+ let { files: S, setFiles: C, currentFile: w, fileInputRef: T, formWrapClass: E, handleUploadChange: D, handleUpload: O, handleRemove: k, handleSave: A, handleEdit: j, handleClose: M } = Ec(e, n, b, f, p, m, g), N = nd(e, {
7981
7984
  required: c,
7982
7985
  label: r
7983
- }), M = Nn("upload"), [N, P] = h(null), [F, I] = h(/* @__PURE__ */ new Set()), L = (e, t) => {
7986
+ }), P = Nn("upload"), [F, I] = h(null), [L, R] = h(/* @__PURE__ */ new Set()), [ee, z] = h(!1), [B, V] = h(""), [H, U] = h(void 0), te = async () => {
7987
+ let e = B.trim();
7988
+ try {
7989
+ new URL(e);
7990
+ } catch {
7991
+ return U(P.invalidUrl), !1;
7992
+ }
7993
+ let t = {
7994
+ key: e,
7995
+ fileName: e.split("/").pop() || "image",
7996
+ size: 0,
7997
+ type: "",
7998
+ progress: 100,
7999
+ url: e,
8000
+ base64: "",
8001
+ variants: {}
8002
+ };
8003
+ return C((e) => o ? [...e, t] : [t]), V(""), U(void 0), z(!1), !0;
8004
+ }, ne = () => {
8005
+ z(!1), V(""), U(void 0);
8006
+ }, W = (e, t) => {
7984
8007
  let n = e.currentTarget, r = n.naturalWidth > 0 && n.naturalHeight > 0 && (n.naturalWidth < d || n.naturalHeight < u);
7985
- I((e) => {
8008
+ R((e) => {
7986
8009
  let n = new Set(e);
7987
8010
  return r ? n.add(t) : n.delete(t), n;
7988
8011
  });
7989
- }, R = ({ scales: e }) => {
8012
+ }, G = ({ scales: e }) => {
7990
8013
  if (!e) return;
7991
8014
  let n = Object.keys(e);
7992
8015
  return n.length === 0 ? null : n.map((n) => /* @__PURE__ */ t.createElement(Xn, { key: n }, /* @__PURE__ */ t.createElement("a", {
@@ -7996,19 +8019,19 @@ var vc = 120, yc = 88, bc = (e) => {
7996
8019
  rel: "noopener noreferrer"
7997
8020
  }, n)));
7998
8021
  };
7999
- return /* @__PURE__ */ t.createElement(Z, { className: w }, _, /* @__PURE__ */ t.createElement(Z, { className: b }, r && /* @__PURE__ */ t.createElement(js, {
8022
+ return /* @__PURE__ */ t.createElement(Z, { className: E }, v, /* @__PURE__ */ t.createElement(Z, { className: x }, r && /* @__PURE__ */ t.createElement(js, {
8000
8023
  label: r,
8001
8024
  required: c
8002
- }), /* @__PURE__ */ t.createElement("div", { className: "flex gap-2 flex-wrap" }, x.map((e, n) => /* @__PURE__ */ t.createElement("div", {
8025
+ }), /* @__PURE__ */ t.createElement("div", { className: "flex gap-2 flex-wrap" }, S.map((e, n) => /* @__PURE__ */ t.createElement("div", {
8003
8026
  key: n,
8004
8027
  className: "relative overflow-hidden rounded-lg border border-border",
8005
8028
  style: {
8006
8029
  width: d,
8007
8030
  height: u
8008
8031
  },
8009
- onMouseEnter: () => P(n),
8010
- onMouseLeave: () => P(null)
8011
- }, e.progress === 100 ? /* @__PURE__ */ t.createElement(t.Fragment, null, F.has(e.key) && /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement("div", {
8032
+ onMouseEnter: () => I(n),
8033
+ onMouseLeave: () => I(null)
8034
+ }, e.progress === 100 ? /* @__PURE__ */ t.createElement(t.Fragment, null, L.has(e.key) && /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement("div", {
8012
8035
  className: "absolute inset-0 dark:hidden",
8013
8036
  style: {
8014
8037
  backgroundColor: "#f0f0f0",
@@ -8027,11 +8050,11 @@ var vc = 120, yc = 88, bc = (e) => {
8027
8050
  })), /* @__PURE__ */ t.createElement("img", {
8028
8051
  src: jc(e),
8029
8052
  alt: `preview-${n}`,
8030
- className: `absolute inset-0 w-full h-full ${F.has(e.key) ? "object-contain p-1" : "object-cover"}`,
8031
- onLoad: (t) => L(t, e.key)
8053
+ className: `absolute inset-0 w-full h-full ${L.has(e.key) ? "object-contain p-1" : "object-cover"}`,
8054
+ onLoad: (t) => W(t, e.key)
8032
8055
  }), /* @__PURE__ */ t.createElement("div", {
8033
8056
  className: "absolute inset-0 bg-black/55 backdrop-blur-[1px] flex flex-col items-center justify-end pb-2 gap-1 transition-opacity",
8034
- style: { display: N === n ? "flex" : "none" }
8057
+ style: { display: F === n ? "flex" : "none" }
8035
8058
  }, /* @__PURE__ */ t.createElement("div", { className: "flex items-center gap-1.5" }, /* @__PURE__ */ t.createElement("a", {
8036
8059
  href: jc(e),
8037
8060
  target: "_blank",
@@ -8042,7 +8065,7 @@ var vc = 120, yc = 88, bc = (e) => {
8042
8065
  className: "w-4 h-4"
8043
8066
  })), a && /* @__PURE__ */ t.createElement("button", {
8044
8067
  type: "button",
8045
- onClick: () => k(e),
8068
+ onClick: () => j(e),
8046
8069
  className: "flex items-center justify-center w-7 h-7 rounded-full bg-white/20 hover:bg-white/35 text-white transition-colors"
8047
8070
  }, /* @__PURE__ */ t.createElement(Q, {
8048
8071
  name: "pencil",
@@ -8050,35 +8073,64 @@ var vc = 120, yc = 88, bc = (e) => {
8050
8073
  })), /* @__PURE__ */ t.createElement("button", {
8051
8074
  type: "button",
8052
8075
  onClick: (t) => {
8053
- t.preventDefault(), t.stopPropagation(), D(e.key);
8076
+ t.preventDefault(), t.stopPropagation(), k(e.key);
8054
8077
  },
8055
8078
  className: "flex items-center justify-center w-7 h-7 rounded-full bg-red-500/70 hover:bg-red-500/90 text-white transition-colors"
8056
8079
  }, /* @__PURE__ */ t.createElement(Q, {
8057
8080
  name: "x",
8058
8081
  className: "w-4 h-4"
8059
- }))), a && e.variants && Object.keys(e.variants).length > 0 && /* @__PURE__ */ t.createElement("div", { className: "flex flex-wrap gap-1 px-1" }, /* @__PURE__ */ t.createElement(R, { scales: e.variants })))) : /* @__PURE__ */ t.createElement(Zo, {
8082
+ }))), a && e.variants && Object.keys(e.variants).length > 0 && /* @__PURE__ */ t.createElement("div", { className: "flex flex-wrap gap-1 px-1" }, /* @__PURE__ */ t.createElement(G, { scales: e.variants })))) : /* @__PURE__ */ t.createElement(Zo, {
8060
8083
  max: 100,
8061
8084
  min: 0,
8062
8085
  value: e.progress,
8063
8086
  appearance: "circle"
8064
- }))), kc(x, l, o) && /* @__PURE__ */ t.createElement(Dc, {
8087
+ }))), kc(S, l, o) && /* @__PURE__ */ t.createElement("div", {
8088
+ className: "relative",
8089
+ style: {
8090
+ width: d,
8091
+ height: u
8092
+ }
8093
+ }, /* @__PURE__ */ t.createElement(Dc, {
8065
8094
  name: e,
8066
- fileInputRef: C,
8095
+ fileInputRef: T,
8067
8096
  accept: s,
8068
- onUpload: E,
8069
- onChange: T,
8097
+ onUpload: O,
8098
+ onChange: D,
8070
8099
  required: c,
8071
8100
  multiple: o,
8072
8101
  height: u,
8073
8102
  width: d,
8074
8103
  feedback: i
8075
- })), j && /* @__PURE__ */ t.createElement(ps, { message: j })), a && S && /* @__PURE__ */ t.createElement(Oc, {
8076
- title: M.editorImage,
8077
- file: S,
8104
+ }), _ && /* @__PURE__ */ t.createElement("button", {
8105
+ type: "button",
8106
+ onClick: () => z(!0),
8107
+ title: P.insertFromUrl,
8108
+ "aria-label": P.insertFromUrl,
8109
+ className: "absolute -right-2 -top-2 flex h-6 w-6 items-center justify-center rounded-full border border-border bg-card text-muted-foreground shadow-sm transition-colors hover:text-primary"
8110
+ }, /* @__PURE__ */ t.createElement(Q, {
8111
+ name: "link",
8112
+ className: "w-3.5 h-3.5"
8113
+ })))), N && /* @__PURE__ */ t.createElement(ps, { message: N })), a && w && /* @__PURE__ */ t.createElement(Oc, {
8114
+ title: P.editorImage,
8115
+ file: w,
8078
8116
  type: "img",
8079
- onSave: O,
8080
- onClose: A
8081
- }), v);
8117
+ onSave: A,
8118
+ onClose: M
8119
+ }), _ && ee && /* @__PURE__ */ t.createElement(Ai, {
8120
+ title: P.insertFromUrl,
8121
+ onSave: te,
8122
+ onClose: ne,
8123
+ size: "sm"
8124
+ }, /* @__PURE__ */ t.createElement("div", { className: "flex flex-col gap-1" }, /* @__PURE__ */ t.createElement("input", {
8125
+ type: "url",
8126
+ autoFocus: !0,
8127
+ value: B,
8128
+ onChange: (e) => {
8129
+ V(e.target.value), U(void 0);
8130
+ },
8131
+ placeholder: P.urlPlaceholder,
8132
+ className: "h-9 w-full rounded-md border border-input bg-background px-2.5 text-sm focus:outline-none focus:ring-1 focus:ring-ring"
8133
+ }), H && /* @__PURE__ */ t.createElement(ps, { message: H }))), y);
8082
8134
  }, Pc = {
8083
8135
  US: "United States",
8084
8136
  CN: "中国",
@@ -17107,7 +17159,10 @@ var Fh = (e) => {
17107
17159
  loaded: "Caricato",
17108
17160
  removeFile: "Rimuovi",
17109
17161
  uploadAnother: "Carica un altro file",
17110
- dropToParse: "Rilascia per analizzare"
17162
+ dropToParse: "Rilascia per analizzare",
17163
+ insertFromUrl: "Inserisci da URL",
17164
+ urlPlaceholder: "https://…/immagine.png",
17165
+ invalidUrl: "Inserisci un URL valido"
17111
17166
  },
17112
17167
  notifications: {
17113
17168
  title: "Notifiche",
@@ -17262,7 +17317,10 @@ var Fh = (e) => {
17262
17317
  loaded: "Geladen",
17263
17318
  removeFile: "Entfernen",
17264
17319
  uploadAnother: "Eine weitere Datei hochladen",
17265
- dropToParse: "Loslassen zum Analysieren"
17320
+ dropToParse: "Loslassen zum Analysieren",
17321
+ insertFromUrl: "Von URL einfügen",
17322
+ urlPlaceholder: "https://…/bild.png",
17323
+ invalidUrl: "Gültige URL eingeben"
17266
17324
  },
17267
17325
  notifications: {
17268
17326
  title: "Benachrichtigungen",
@@ -17417,7 +17475,10 @@ var Fh = (e) => {
17417
17475
  loaded: "Загружено",
17418
17476
  removeFile: "Удалить",
17419
17477
  uploadAnother: "Загрузить ещё один файл",
17420
- dropToParse: "Отпустите для анализа"
17478
+ dropToParse: "Отпустите для анализа",
17479
+ insertFromUrl: "Вставить по URL",
17480
+ urlPlaceholder: "https://…/image.png",
17481
+ invalidUrl: "Введите корректный URL"
17421
17482
  },
17422
17483
  notifications: {
17423
17484
  title: "Уведомления",
@@ -17572,7 +17633,10 @@ var Fh = (e) => {
17572
17633
  loaded: "已加载",
17573
17634
  removeFile: "删除",
17574
17635
  uploadAnother: "上传另一个文件",
17575
- dropToParse: "松开解析"
17636
+ dropToParse: "松开解析",
17637
+ insertFromUrl: "通过URL插入",
17638
+ urlPlaceholder: "https://…/image.png",
17639
+ invalidUrl: "请输入有效的URL"
17576
17640
  },
17577
17641
  notifications: {
17578
17642
  title: "通知",
@@ -17727,7 +17791,10 @@ var Fh = (e) => {
17727
17791
  loaded: "محمّل",
17728
17792
  removeFile: "إزالة",
17729
17793
  uploadAnother: "تحميل ملف آخر",
17730
- dropToParse: "أفلت للتحليل"
17794
+ dropToParse: "أفلت للتحليل",
17795
+ insertFromUrl: "إدراج من رابط",
17796
+ urlPlaceholder: "https://…/image.png",
17797
+ invalidUrl: "أدخل رابطًا صالحًا"
17731
17798
  },
17732
17799
  notifications: {
17733
17800
  title: "الإشعارات",