@nivaro/react 0.3.141 → 0.3.143

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.
@@ -2,7 +2,7 @@ import { jsxs as a, jsx as e, Fragment as S } from "react/jsx-runtime";
2
2
  import { useQueryClient as oe, useQuery as X, useMutation as Y } from "@tanstack/react-query";
3
3
  import { FileSpreadsheet as Ne, Download as Z, RotateCcw as ve, Undo2 as ee, Ban as we, ArrowRight as ye, AlertTriangle as Ce, Loader2 as H, Search as $e, ChevronDown as ie, ChevronRight as ce, Check as ue, Copy as me, ExternalLink as _e } from "lucide-react";
4
4
  import { useState as k, useEffect as he, useMemo as pe } from "react";
5
- import { useNivaroClient as te, useApiFetchConfig as Re, useItemNavigation as Se } from "../../context.js";
5
+ import { useApiFetchConfig as Re, useNivaroClient as te, useItemNavigation as Se } from "../../context.js";
6
6
  import { useDebounced as Te } from "../../hooks/useDebounced.js";
7
7
  import { get as xe, post as J } from "../../lib/commands.js";
8
8
  import { errorSentence as ae, rowErrorSentence as Le } from "../../lib/error-message.js";
@@ -0,0 +1,41 @@
1
+ function l(t) {
2
+ let n = [];
3
+ if (Array.isArray(t)) n = t;
4
+ else if (typeof t == "string") {
5
+ const i = t.trim();
6
+ if (i.startsWith("["))
7
+ try {
8
+ const r = JSON.parse(i);
9
+ Array.isArray(r) && (n = r);
10
+ } catch {
11
+ n = [];
12
+ }
13
+ else i && (n = i.split(","));
14
+ }
15
+ const e = [];
16
+ for (const i of n) {
17
+ const r = String(i ?? "").trim();
18
+ r && !e.includes(r) && e.push(r);
19
+ }
20
+ return e;
21
+ }
22
+ const s = "No match fields: every row will be created as a new record";
23
+ function a(t) {
24
+ return t.length === 0 ? s : null;
25
+ }
26
+ function c(t, n) {
27
+ return t.length > 0 || n;
28
+ }
29
+ function o(t, n) {
30
+ const e = t.filter(
31
+ (i) => i.value !== "id" && !/links several/.test(i.hint ?? "") && n.has(i.value)
32
+ );
33
+ return n.has("id") ? [{ value: "id", label: "ID", hint: "id" }, ...e] : e;
34
+ }
35
+ export {
36
+ s as NO_MATCH_WARNING,
37
+ c as canStartImport,
38
+ o as matchFieldOptions,
39
+ a as noMatchWarning,
40
+ l as parseMatchFields
41
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nivaro/react",
3
- "version": "0.3.141",
3
+ "version": "0.3.143",
4
4
  "description": "React hooks and components for Nivaro CMS forms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",