@nivaro/react 0.3.10 → 0.3.11
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/full.css +1 -1
- package/dist/hooks/useNivaroForm.js +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +34 -3
- package/dist/shared/components/CollectionBrowserView.js +1546 -1477
- package/dist/shared/components/ItemEditForm.js +4332 -4195
- package/dist/shared/components/PageRenderer.js +512 -465
- package/dist/shared/components/QueryStatStrip.js +74 -70
- package/dist/shared/components/ReportView.js +818 -827
- package/dist/shared/components/SheetHeaderBody.js +16 -14
- package/dist/shared/components/item-edit/CatalogPickerField.js +1029 -933
- package/dist/shared/components/item-edit/FieldRenderer.js +161 -156
- package/dist/shared/components/item-edit/FieldRow.js +20 -19
- package/dist/shared/components/item-edit/FilePickerField.js +52 -40
- package/dist/shared/components/item-edit/GroupSection.js +221 -221
- package/dist/shared/components/item-edit/InlineGridField.js +41 -41
- package/dist/shared/components/item-edit/InlineTableField.js +2249 -2238
- package/dist/shared/components/item-edit/M2MCombobox.js +46 -44
- package/dist/shared/components/item-edit/NestedRelationEditor.js +11 -11
- package/dist/shared/components/item-edit/QuickPicker.js +263 -216
- package/dist/shared/components/item-edit/RelationCombobox.js +285 -245
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +42 -32
- package/dist/shared/components/item-edit/RowHistorySheet.js +130 -134
- package/dist/shared/components/item-edit/SummaryPanel.js +305 -279
- package/dist/shared/components/item-edit/helpers.js +133 -134
- package/dist/shared/components/item-edit/line-qty.js +57 -0
- package/dist/shared/components/item-edit/option-disambiguate.js +53 -0
- package/dist/shared/components/panels/AddendumLinesDiff.js +87 -90
- package/dist/shared/components/panels/CommentPanel.js +350 -315
- package/dist/shared/components/panels/ItemLockBanner.js +297 -230
- package/dist/shared/components/panels/PipelinePanel.js +719 -701
- package/dist/shared/components/queue/QueueQuickFilters.js +43 -41
- package/dist/shared/components/queue/QueueWorklist.js +1005 -935
- package/dist/shared/components/widgets/ReviewListWidget.js +99 -93
- package/dist/shared/lib/obligation-banner.js +14 -13
- package/dist/shared/lib/obligation-reason-text.js +13 -0
- package/dist/shared/lib/query-filter-seed.js +34 -11
- package/dist/shared/lib/sanitize-html.js +24 -15
- package/dist/shared/lib/sheet-def.js +38 -22
- package/dist/shared/lib/unique-options.js +10 -0
- package/dist/shared/lib/utils.js +57 -43
- package/dist/shared/lib/validation-rules.js +58 -34
- package/package.json +1 -1
|
@@ -1,202 +1,228 @@
|
|
|
1
|
-
import { jsxs as i, jsx as
|
|
2
|
-
import { useQueries as
|
|
3
|
-
import { Check as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { get as
|
|
7
|
-
import { cn as
|
|
8
|
-
import { Skeleton as
|
|
1
|
+
import { jsxs as i, jsx as s, Fragment as ze } from "react/jsx-runtime";
|
|
2
|
+
import { useQueries as Se, useQuery as _e } from "@tanstack/react-query";
|
|
3
|
+
import { Check as qe, X as Ye, Search as Ze, ChevronLeft as Le } from "lucide-react";
|
|
4
|
+
import { useState as Q, useRef as Me, useEffect as L, useMemo as _ } from "react";
|
|
5
|
+
import { useNivaroClient as et } from "../../context.js";
|
|
6
|
+
import { get as M } from "../../lib/commands.js";
|
|
7
|
+
import { cn as T, titleCase as Ce } from "../../lib/utils.js";
|
|
8
|
+
import { Skeleton as oe } from "../ui/skeleton.js";
|
|
9
9
|
import "../../lib/field-interfaces.js";
|
|
10
|
-
import { resolveOptionFilterTokens as
|
|
11
|
-
import { getCascadeFilters as
|
|
12
|
-
import { resolveM2MRelatedCollection as
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
import { resolveOptionFilterTokens as je } from "../../lib/option-filter-tokens.js";
|
|
11
|
+
import { getCascadeFilters as Ae, buildCascadeFilter as tt, parseJson as de, applyDisplayTemplate as Te } from "./helpers.js";
|
|
12
|
+
import { resolveM2MRelatedCollection as nt } from "./M2MCombobox.js";
|
|
13
|
+
import { collidingIds as rt, disambiguators as lt } from "./option-disambiguate.js";
|
|
14
|
+
const st = 12, at = 200, $e = (p) => {
|
|
15
|
+
if (!p) return;
|
|
16
|
+
const S = [...p.matchAll(/\{\{\s*([^}\s]+)\s*\}\}/g)].map((k) => k[1]);
|
|
16
17
|
return ["id", ...new Set(S)].join(",");
|
|
17
|
-
},
|
|
18
|
-
function
|
|
19
|
-
return
|
|
18
|
+
}, G = (p) => p == null || p === "" || Array.isArray(p) && p.length === 0;
|
|
19
|
+
function it(p, S, k, K, $) {
|
|
20
|
+
return _(() => {
|
|
20
21
|
var b;
|
|
21
|
-
const
|
|
22
|
-
for (const
|
|
23
|
-
const o = S.find((
|
|
24
|
-
(
|
|
22
|
+
const x = [];
|
|
23
|
+
for (const m of p) {
|
|
24
|
+
const o = S.find((u) => u.field === m) ?? null, q = ($ == null ? void 0 : $[m]) ?? (o == null ? void 0 : o.label) ?? Ce(m), N = k.find(
|
|
25
|
+
(u) => u.many_collection === K && u.many_field === m && !u.junction_field
|
|
25
26
|
);
|
|
26
|
-
if (
|
|
27
|
-
|
|
28
|
-
field:
|
|
29
|
-
label:
|
|
27
|
+
if (N != null && N.one_collection) {
|
|
28
|
+
x.push({
|
|
29
|
+
field: m,
|
|
30
|
+
label: q,
|
|
30
31
|
required: !!(o != null && o.required),
|
|
31
32
|
kind: "m2o",
|
|
32
33
|
multi: !1,
|
|
33
|
-
target:
|
|
34
|
+
target: N.one_collection,
|
|
34
35
|
fc: o
|
|
35
36
|
});
|
|
36
37
|
continue;
|
|
37
38
|
}
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
40
|
-
const
|
|
41
|
-
(
|
|
42
|
-
) : void 0,
|
|
43
|
-
|
|
44
|
-
field:
|
|
45
|
-
label:
|
|
39
|
+
const f = k.find((u) => u.one_collection === K && u.one_field === m);
|
|
40
|
+
if (f != null && f.many_collection) {
|
|
41
|
+
const u = f.junction_field ?? ((b = k.find((g) => g.many_collection === f.many_collection && g.id !== f.id)) == null ? void 0 : b.many_field) ?? null, ee = u ? k.find(
|
|
42
|
+
(g) => g.many_collection === f.many_collection && g.many_field === u
|
|
43
|
+
) : void 0, te = nt(ee), O = de((o == null ? void 0 : o.options) ?? null);
|
|
44
|
+
x.push({
|
|
45
|
+
field: m,
|
|
46
|
+
label: q,
|
|
46
47
|
required: !!(o != null && o.required),
|
|
47
48
|
kind: "m2m",
|
|
48
|
-
multi: (
|
|
49
|
-
target:
|
|
49
|
+
multi: (O == null ? void 0 : O.max_values) !== 1,
|
|
50
|
+
target: te,
|
|
50
51
|
fc: o
|
|
51
52
|
});
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
|
-
return
|
|
55
|
-
}, [
|
|
55
|
+
return x.filter((m) => m.target);
|
|
56
|
+
}, [p, S, k, K, $]);
|
|
56
57
|
}
|
|
57
|
-
function
|
|
58
|
-
collection:
|
|
58
|
+
function Nt({
|
|
59
|
+
collection: p,
|
|
59
60
|
itemId: S,
|
|
60
|
-
steps:
|
|
61
|
-
fieldConfig:
|
|
62
|
-
relations:
|
|
63
|
-
draft:
|
|
61
|
+
steps: k,
|
|
62
|
+
fieldConfig: K,
|
|
63
|
+
relations: $,
|
|
64
|
+
draft: x,
|
|
64
65
|
getM2M: b,
|
|
65
|
-
onChange:
|
|
66
|
+
onChange: m,
|
|
66
67
|
onM2MChange: o,
|
|
67
|
-
fieldLabels:
|
|
68
|
-
fieldOptionFilters:
|
|
69
|
-
onCompleteChange:
|
|
70
|
-
onFinish:
|
|
71
|
-
finishLabel:
|
|
72
|
-
finishRequiresComplete:
|
|
73
|
-
className:
|
|
68
|
+
fieldLabels: q,
|
|
69
|
+
fieldOptionFilters: N,
|
|
70
|
+
onCompleteChange: f,
|
|
71
|
+
onFinish: u,
|
|
72
|
+
finishLabel: ee = "Done",
|
|
73
|
+
finishRequiresComplete: te = !0,
|
|
74
|
+
className: O
|
|
74
75
|
}) {
|
|
75
|
-
var
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}, [
|
|
80
|
-
const
|
|
76
|
+
var ve;
|
|
77
|
+
const g = et(), a = it(k, K, $, p, q), ne = (e) => e.kind === "m2m" ? b(e.field) : x[e.field], h = (e) => !G(ne(e)), [H, Fe] = Q(() => /* @__PURE__ */ new Set()), [Ie, C] = Q(null), re = a.find((e) => !h(e) && !H.has(e.field)), Ee = Ie ?? (re == null ? void 0 : re.field) ?? ((ve = a[0]) == null ? void 0 : ve.field) ?? null, y = a.findIndex((e) => e.field === Ee), t = y >= 0 ? a[y] : null, F = a.length > 0 && a.every((e) => h(e) || !e.required && H.has(e.field)), ce = Me(null);
|
|
78
|
+
L(() => {
|
|
79
|
+
ce.current !== F && (ce.current = F, f == null || f(F));
|
|
80
|
+
}, [F, f]);
|
|
81
|
+
const le = _(() => {
|
|
81
82
|
if (!(t != null && t.fc)) return;
|
|
82
|
-
const e =
|
|
83
|
+
const e = Ae(t.fc.dependency_config), n = tt({
|
|
83
84
|
rules: e,
|
|
84
85
|
parentValue: (w) => {
|
|
85
|
-
const
|
|
86
|
-
if ((
|
|
87
|
-
const
|
|
88
|
-
return
|
|
86
|
+
const E = a.find((D) => D.field === w);
|
|
87
|
+
if ((E == null ? void 0 : E.kind) === "m2m") {
|
|
88
|
+
const D = b(w) ?? [];
|
|
89
|
+
return D.length === 0 ? null : D.length === 1 ? D[0] : D;
|
|
89
90
|
}
|
|
90
|
-
const
|
|
91
|
-
if (
|
|
92
|
-
const
|
|
93
|
-
return
|
|
91
|
+
const we = x[w];
|
|
92
|
+
if (we != null) return we;
|
|
93
|
+
const P = b(w);
|
|
94
|
+
return P != null && P.length ? P.length === 1 ? P[0] : P : null;
|
|
94
95
|
},
|
|
95
96
|
parentOptionFilter: (w) => {
|
|
96
|
-
const
|
|
97
|
-
return
|
|
97
|
+
const E = N == null ? void 0 : N[w];
|
|
98
|
+
return E ? je(E, x, S) : void 0;
|
|
98
99
|
}
|
|
99
|
-
}), r =
|
|
100
|
+
}), r = de(t.fc.options ?? null), l = r != null && r.option_filter ? je(r.option_filter, x, S) : void 0, d = [n.filter, l].filter(
|
|
100
101
|
(w) => !!w && Object.keys(w).length > 0
|
|
101
|
-
),
|
|
102
|
-
return
|
|
103
|
-
}, [t == null ? void 0 : t.field, t == null ? void 0 : t.fc,
|
|
104
|
-
const r = a.find((
|
|
105
|
-
return r ? !
|
|
106
|
-
}) : [], [t == null ? void 0 : t.field, t == null ? void 0 : t.fc,
|
|
102
|
+
), A = d.length === 0 ? void 0 : d.length === 1 ? d[0] : { _and: d };
|
|
103
|
+
return A ? JSON.stringify(A) : void 0;
|
|
104
|
+
}, [t == null ? void 0 : t.field, t == null ? void 0 : t.fc, x, a, N, S, b]), se = _(() => t != null && t.fc ? Ae(t.fc.dependency_config).filter((n) => n.show_all_if_no_parent === !1).map((n) => n.parent_field).filter((n) => {
|
|
105
|
+
const r = a.find((l) => l.field === n);
|
|
106
|
+
return r ? !h(r) : G(x[n] ?? b(n));
|
|
107
|
+
}) : [], [t == null ? void 0 : t.field, t == null ? void 0 : t.fc, x, a, b]), ue = _(
|
|
107
108
|
() => [...new Set(a.map((e) => e.target).filter((e) => !!e))],
|
|
108
109
|
[a]
|
|
109
|
-
),
|
|
110
|
-
queries:
|
|
110
|
+
), Pe = Se({
|
|
111
|
+
queries: ue.map((e) => ({
|
|
111
112
|
queryKey: ["collection-display-meta", e],
|
|
112
|
-
queryFn: () =>
|
|
113
|
+
queryFn: () => g.request(M(`/collections/${e}`)).then((n) => n.data),
|
|
113
114
|
staleTime: 10 * 6e4
|
|
114
115
|
}))
|
|
115
|
-
}),
|
|
116
|
-
var r,
|
|
117
|
-
const n = e ?
|
|
118
|
-
return n >= 0 ? ((
|
|
119
|
-
},
|
|
120
|
-
|
|
121
|
-
const e = window.setTimeout(() =>
|
|
116
|
+
}), ae = (e) => {
|
|
117
|
+
var r, l;
|
|
118
|
+
const n = e ? ue.indexOf(e) : -1;
|
|
119
|
+
return n >= 0 ? ((l = (r = Pe[n]) == null ? void 0 : r.data) == null ? void 0 : l.display_template) ?? null : null;
|
|
120
|
+
}, J = ae((t == null ? void 0 : t.target) ?? null), j = $e(J), [U, me] = Q(""), [v, pe] = Q("");
|
|
121
|
+
L(() => {
|
|
122
|
+
const e = window.setTimeout(() => pe(U.trim()), 180);
|
|
122
123
|
return () => window.clearTimeout(e);
|
|
123
|
-
}, [
|
|
124
|
-
|
|
124
|
+
}, [U]), L(() => {
|
|
125
|
+
me(""), pe("");
|
|
125
126
|
}, [t == null ? void 0 : t.field]);
|
|
126
|
-
const
|
|
127
|
+
const De = !!(t != null && t.target) && se.length === 0, R = _(() => {
|
|
127
128
|
var n;
|
|
128
|
-
const e =
|
|
129
|
+
const e = de(((n = t == null ? void 0 : t.fc) == null ? void 0 : n.options) ?? null);
|
|
129
130
|
return typeof (e == null ? void 0 : e.option_sort) == "string" && e.option_sort.trim() ? e.option_sort.trim() : "";
|
|
130
|
-
}, [t == null ? void 0 : t.fc]),
|
|
131
|
-
data:
|
|
132
|
-
isLoading:
|
|
133
|
-
isError:
|
|
134
|
-
refetch:
|
|
135
|
-
} =
|
|
131
|
+
}, [t == null ? void 0 : t.fc]), V = R && !/^-?label$/.test(R) ? R : void 0, {
|
|
132
|
+
data: c,
|
|
133
|
+
isLoading: Qe,
|
|
134
|
+
isError: Ke,
|
|
135
|
+
refetch: Oe
|
|
136
|
+
} = _e({
|
|
136
137
|
queryKey: [
|
|
137
138
|
"quick-picker-opts",
|
|
138
139
|
(t == null ? void 0 : t.target) ?? "",
|
|
139
|
-
|
|
140
|
-
|
|
140
|
+
le ?? "",
|
|
141
|
+
j,
|
|
141
142
|
v,
|
|
142
|
-
|
|
143
|
+
V ?? ""
|
|
143
144
|
],
|
|
144
|
-
queryFn: () =>
|
|
145
|
-
|
|
146
|
-
limit:
|
|
145
|
+
queryFn: () => g.request(
|
|
146
|
+
M(`/items/${t.target}`, {
|
|
147
|
+
limit: at,
|
|
147
148
|
picker: "1",
|
|
148
|
-
...
|
|
149
|
-
...
|
|
150
|
-
...
|
|
149
|
+
...V ? { sort: V } : {},
|
|
150
|
+
...j ? { fields: j } : {},
|
|
151
|
+
...le ? { filter: le } : {},
|
|
151
152
|
...v ? { search: v } : {}
|
|
152
153
|
})
|
|
153
154
|
).then((e) => e.data ?? []),
|
|
154
|
-
enabled:
|
|
155
|
+
enabled: De,
|
|
155
156
|
staleTime: 3e4
|
|
156
|
-
}),
|
|
157
|
-
const e = [...
|
|
158
|
-
if (
|
|
157
|
+
}), I = (e) => Te(J, e) || `#${String(e.id)}`, B = _(() => {
|
|
158
|
+
const e = [...c ?? []];
|
|
159
|
+
if (V) return e;
|
|
159
160
|
const n = R === "-label" ? -1 : 1;
|
|
160
|
-
return e.sort((r,
|
|
161
|
-
}, [
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
161
|
+
return e.sort((r, l) => n * I(r).localeCompare(I(l)));
|
|
162
|
+
}, [c, J, V, R]), X = _(() => rt(c ?? [], I), [c, J]), { data: W } = _e({
|
|
163
|
+
queryKey: ["quick-picker-dups", (t == null ? void 0 : t.target) ?? "", X.join(",")],
|
|
164
|
+
queryFn: () => g.request(
|
|
165
|
+
M(`/items/${t.target}`, {
|
|
166
|
+
limit: X.length,
|
|
167
|
+
picker: "1",
|
|
168
|
+
filter: JSON.stringify({ id: { _in: X } }),
|
|
169
|
+
fields: "*"
|
|
170
|
+
})
|
|
171
|
+
).then((e) => e.data ?? []),
|
|
172
|
+
enabled: !!(t != null && t.target) && X.length > 0,
|
|
173
|
+
staleTime: 6e4
|
|
174
|
+
}), z = _(() => {
|
|
175
|
+
if (!(W != null && W.length)) return /* @__PURE__ */ new Map();
|
|
176
|
+
const e = new Map(
|
|
177
|
+
(c ?? []).map((r) => [String(r.id), I(r).trim().toLowerCase()])
|
|
178
|
+
), n = /* @__PURE__ */ new Map();
|
|
179
|
+
for (const r of W) {
|
|
180
|
+
const l = e.get(String(r.id));
|
|
181
|
+
l !== void 0 && n.set(l, [...n.get(l) ?? [], r]);
|
|
182
|
+
}
|
|
183
|
+
return lt(
|
|
184
|
+
[...n.values()],
|
|
185
|
+
((j == null ? void 0 : j.split(",")) ?? []).map((r) => r.split(".")[0])
|
|
186
|
+
);
|
|
187
|
+
}, [W, c, J, j]), fe = !v && ((c == null ? void 0 : c.length) ?? 0) > st ? !0 : !!v, [he, Je] = Q(() => /* @__PURE__ */ new Set()), [Re, Ve] = Q(() => /* @__PURE__ */ new Set());
|
|
188
|
+
L(() => {
|
|
189
|
+
if (!t || !c || c.length !== 1 || v || h(t) || Re.has(t.field) || he.has(t.field)) return;
|
|
190
|
+
const e = String(c[0].id);
|
|
191
|
+
Je((n) => new Set(n).add(t.field)), t.kind === "m2m" ? o(t.field, [e]) : m(t.field, c[0].id);
|
|
192
|
+
}, [t == null ? void 0 : t.field, c, v]);
|
|
193
|
+
const ie = (e, n) => {
|
|
168
194
|
const r = String(n.id);
|
|
169
195
|
if (e.kind === "m2m") {
|
|
170
|
-
const
|
|
196
|
+
const l = b(e.field) ?? [];
|
|
171
197
|
if (e.multi) {
|
|
172
|
-
o(e.field,
|
|
198
|
+
o(e.field, l.includes(r) ? l.filter((d) => d !== r) : [...l, r]);
|
|
173
199
|
return;
|
|
174
200
|
}
|
|
175
201
|
o(e.field, [r]);
|
|
176
202
|
} else
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
},
|
|
180
|
-
|
|
181
|
-
},
|
|
182
|
-
|
|
183
|
-
},
|
|
203
|
+
m(e.field, n.id);
|
|
204
|
+
C(null);
|
|
205
|
+
}, Be = (e) => {
|
|
206
|
+
Ve((n) => new Set(n).add(e.field)), e.kind === "m2m" ? o(e.field, []) : m(e.field, null), C(e.field);
|
|
207
|
+
}, We = (e) => C(e.field), xe = () => {
|
|
208
|
+
y > 0 && C(a[y - 1].field);
|
|
209
|
+
}, Ge = () => {
|
|
184
210
|
var r;
|
|
185
211
|
const e = a.findIndex(
|
|
186
|
-
(
|
|
187
|
-
), n = e >= 0 ? e : Math.min(
|
|
188
|
-
|
|
189
|
-
},
|
|
190
|
-
|
|
191
|
-
},
|
|
192
|
-
queries:
|
|
193
|
-
const r = Array.isArray(n) ? n.map(String) :
|
|
212
|
+
(l, d) => d > y && !h(l) && !H.has(l.field)
|
|
213
|
+
), n = e >= 0 ? e : Math.min(y + 1, a.length - 1);
|
|
214
|
+
C(((r = a[n]) == null ? void 0 : r.field) ?? null);
|
|
215
|
+
}, be = (e) => {
|
|
216
|
+
Fe((n) => new Set(n).add(e.field)), C(null);
|
|
217
|
+
}, ge = a.map((e) => ({ d: e, v: ne(e) })), He = Se({
|
|
218
|
+
queries: ge.map(({ d: e, v: n }) => {
|
|
219
|
+
const r = Array.isArray(n) ? n.map(String) : G(n) ? [] : [String(n)], l = $e(ae(e.target));
|
|
194
220
|
return {
|
|
195
|
-
queryKey: ["quick-picker-labels", e.target ?? "", r.join(","),
|
|
196
|
-
queryFn: () =>
|
|
197
|
-
|
|
221
|
+
queryKey: ["quick-picker-labels", e.target ?? "", r.join(","), l ?? "*"],
|
|
222
|
+
queryFn: () => g.request(
|
|
223
|
+
M(`/items/${e.target}`, {
|
|
198
224
|
filter: JSON.stringify({ id: { _in: r } }),
|
|
199
|
-
...
|
|
225
|
+
...l ? { fields: l } : {},
|
|
200
226
|
limit: r.length
|
|
201
227
|
})
|
|
202
228
|
).then((d) => d.data ?? []),
|
|
@@ -204,51 +230,51 @@ function ht({
|
|
|
204
230
|
staleTime: 6e4
|
|
205
231
|
};
|
|
206
232
|
})
|
|
207
|
-
}),
|
|
233
|
+
}), ye = (e) => {
|
|
208
234
|
var d;
|
|
209
|
-
const { d: n, v: r } =
|
|
210
|
-
if (
|
|
211
|
-
const
|
|
212
|
-
return
|
|
235
|
+
const { d: n, v: r } = ge[e];
|
|
236
|
+
if (G(r)) return null;
|
|
237
|
+
const l = (d = He[e]) == null ? void 0 : d.data;
|
|
238
|
+
return l != null && l.length ? l.map((A) => Te(ae(n.target), A) || `#${String(A.id)}`).join(", ") : Array.isArray(r) ? `${r.length} selected` : "…";
|
|
213
239
|
};
|
|
214
240
|
if (a.length === 0) return null;
|
|
215
|
-
const
|
|
216
|
-
!t ||
|
|
241
|
+
const ke = a.map((e, n) => h(e) ? ye(n) : null).filter((e) => !!e), Y = t ? ne(t) : null, Ne = Array.isArray(Y) ? Y.map(String) : G(Y) ? [] : [String(Y)], Z = y === a.length - 1, Ue = t ? h(t) || !t.required && !0 : !1, Xe = () => {
|
|
242
|
+
!t || Z || (!h(t) && !t.required ? be(t) : Ge());
|
|
217
243
|
};
|
|
218
|
-
return /* @__PURE__ */ i("div", { "data-quick-picker": !0, className:
|
|
219
|
-
/* @__PURE__ */
|
|
220
|
-
const r =
|
|
244
|
+
return /* @__PURE__ */ i("div", { "data-quick-picker": !0, className: T("space-y-3", O), children: [
|
|
245
|
+
/* @__PURE__ */ s("ol", { className: "flex flex-wrap items-center gap-x-1 gap-y-1", "aria-label": "Quick picker steps", children: a.map((e, n) => {
|
|
246
|
+
const r = h(e), l = e.field === (t == null ? void 0 : t.field), d = r ? ye(n) : null, A = !r && H.has(e.field);
|
|
221
247
|
return /* @__PURE__ */ i("li", { className: "flex items-center gap-1", children: [
|
|
222
248
|
/* @__PURE__ */ i(
|
|
223
249
|
"button",
|
|
224
250
|
{
|
|
225
251
|
type: "button",
|
|
226
|
-
onClick: () =>
|
|
227
|
-
"aria-current":
|
|
228
|
-
className:
|
|
252
|
+
onClick: () => We(e),
|
|
253
|
+
"aria-current": l ? "step" : void 0,
|
|
254
|
+
className: T(
|
|
229
255
|
"flex max-w-[220px] items-center gap-1.5 rounded-full border px-2 py-0.5 text-[11.5px] transition-colors duration-150",
|
|
230
|
-
|
|
256
|
+
l ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : r ? "border-slate-200 bg-slate-50 text-slate-700 hover:border-slate-300 dark:border-border dark:bg-muted dark:text-slate-200" : "border-dashed border-slate-200 text-slate-400 hover:border-slate-300 dark:border-border"
|
|
231
257
|
),
|
|
232
258
|
children: [
|
|
233
|
-
/* @__PURE__ */
|
|
259
|
+
/* @__PURE__ */ s(
|
|
234
260
|
"span",
|
|
235
261
|
{
|
|
236
|
-
className:
|
|
262
|
+
className: T(
|
|
237
263
|
"flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-full text-[8px] font-bold",
|
|
238
|
-
r ||
|
|
264
|
+
r || l ? "bg-nvr-cyan text-[#172940]" : "bg-slate-200 text-slate-500 dark:bg-white/[0.12] dark:text-slate-400"
|
|
239
265
|
),
|
|
240
|
-
children: r ? /* @__PURE__ */
|
|
266
|
+
children: r ? /* @__PURE__ */ s(qe, { className: "h-2 w-2", strokeWidth: 3 }) : n + 1
|
|
241
267
|
}
|
|
242
268
|
),
|
|
243
269
|
/* @__PURE__ */ i("span", { className: "truncate", children: [
|
|
244
|
-
/* @__PURE__ */
|
|
245
|
-
r && d && /* @__PURE__ */
|
|
246
|
-
|
|
270
|
+
/* @__PURE__ */ s("span", { className: T(r && "text-slate-400 dark:text-slate-500"), children: e.label }),
|
|
271
|
+
r && d && /* @__PURE__ */ s("span", { className: "ml-1 font-medium text-slate-700 dark:text-slate-200", children: d }),
|
|
272
|
+
A && /* @__PURE__ */ s("span", { className: "ml-1 italic text-slate-400", children: "skipped" })
|
|
247
273
|
] })
|
|
248
274
|
]
|
|
249
275
|
}
|
|
250
276
|
),
|
|
251
|
-
n < a.length - 1 && /* @__PURE__ */
|
|
277
|
+
n < a.length - 1 && /* @__PURE__ */ s("span", { className: "h-px w-2 bg-slate-200 dark:bg-border", "aria-hidden": !0 })
|
|
252
278
|
] }, e.field);
|
|
253
279
|
}) }),
|
|
254
280
|
t ? /* @__PURE__ */ i(
|
|
@@ -260,118 +286,139 @@ function ht({
|
|
|
260
286
|
/* @__PURE__ */ i("div", { className: "mb-2 flex items-baseline gap-2", children: [
|
|
261
287
|
/* @__PURE__ */ i("span", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: [
|
|
262
288
|
t.label,
|
|
263
|
-
t.required && /* @__PURE__ */
|
|
289
|
+
t.required && /* @__PURE__ */ s("span", { className: "ml-0.5 text-destructive", children: "*" })
|
|
264
290
|
] }),
|
|
265
291
|
/* @__PURE__ */ i("span", { className: "text-[11px] text-slate-400", children: [
|
|
266
|
-
|
|
292
|
+
y + 1,
|
|
267
293
|
" of ",
|
|
268
294
|
a.length,
|
|
269
295
|
t.multi ? " · pick one or more" : "",
|
|
270
|
-
|
|
296
|
+
he.has(t.field) && h(t) ? " · only option" : ""
|
|
271
297
|
] }),
|
|
272
|
-
/* @__PURE__ */
|
|
273
|
-
|
|
298
|
+
/* @__PURE__ */ s("span", { className: "flex-1" }),
|
|
299
|
+
h(t) && /* @__PURE__ */ i(
|
|
274
300
|
"button",
|
|
275
301
|
{
|
|
276
302
|
type: "button",
|
|
277
|
-
onClick: () =>
|
|
303
|
+
onClick: () => Be(t),
|
|
278
304
|
className: "flex items-center gap-0.5 text-[11.5px] text-slate-500 hover:text-slate-700 dark:hover:text-slate-300",
|
|
279
305
|
children: [
|
|
280
|
-
/* @__PURE__ */
|
|
306
|
+
/* @__PURE__ */ s(Ye, { className: "h-3 w-3" }),
|
|
281
307
|
" Clear"
|
|
282
308
|
]
|
|
283
309
|
}
|
|
284
310
|
)
|
|
285
311
|
] }),
|
|
286
|
-
/* @__PURE__ */
|
|
312
|
+
/* @__PURE__ */ s("div", { className: "min-h-[120px]", children: se.length > 0 ? /* @__PURE__ */ i("p", { className: "text-[12.5px] text-slate-500 dark:text-slate-400", children: [
|
|
287
313
|
"Pick",
|
|
288
314
|
" ",
|
|
289
|
-
|
|
315
|
+
se.map(
|
|
290
316
|
(e) => {
|
|
291
317
|
var n;
|
|
292
|
-
return ((n = a.find((r) => r.field === e)) == null ? void 0 : n.label) ?? (
|
|
318
|
+
return ((n = a.find((r) => r.field === e)) == null ? void 0 : n.label) ?? (q == null ? void 0 : q[e]) ?? Ce(e);
|
|
293
319
|
}
|
|
294
320
|
).join(" and "),
|
|
295
321
|
" ",
|
|
296
322
|
"first."
|
|
297
|
-
] }) :
|
|
323
|
+
] }) : Ke ? /* @__PURE__ */ i("p", { className: "text-[12.5px] text-destructive", children: [
|
|
298
324
|
"Could not load options.",
|
|
299
325
|
" ",
|
|
300
|
-
/* @__PURE__ */
|
|
301
|
-
] }) :
|
|
302
|
-
/* @__PURE__ */
|
|
303
|
-
/* @__PURE__ */
|
|
304
|
-
/* @__PURE__ */
|
|
305
|
-
] }) : /* @__PURE__ */ i(
|
|
306
|
-
|
|
307
|
-
/* @__PURE__ */
|
|
308
|
-
/* @__PURE__ */
|
|
326
|
+
/* @__PURE__ */ s("button", { type: "button", onClick: () => void Oe(), className: "underline", children: "Retry" })
|
|
327
|
+
] }) : Qe && !c ? /* @__PURE__ */ i("div", { className: "flex gap-1.5", children: [
|
|
328
|
+
/* @__PURE__ */ s(oe, { className: "h-8 w-24 rounded-full" }),
|
|
329
|
+
/* @__PURE__ */ s(oe, { className: "h-8 w-28 rounded-full" }),
|
|
330
|
+
/* @__PURE__ */ s(oe, { className: "h-8 w-20 rounded-full" })
|
|
331
|
+
] }) : /* @__PURE__ */ i(ze, { children: [
|
|
332
|
+
fe && /* @__PURE__ */ i("div", { className: "relative mb-2", children: [
|
|
333
|
+
/* @__PURE__ */ s(Ze, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
|
|
334
|
+
/* @__PURE__ */ s(
|
|
309
335
|
"input",
|
|
310
336
|
{
|
|
311
337
|
autoFocus: !0,
|
|
312
|
-
value:
|
|
313
|
-
onChange: (e) =>
|
|
338
|
+
value: U,
|
|
339
|
+
onChange: (e) => me(e.target.value),
|
|
314
340
|
onKeyDown: (e) => {
|
|
315
|
-
e.key === "Enter" &&
|
|
341
|
+
e.key === "Enter" && B[0] && ie(t, B[0]), e.key === "Backspace" && !U && y > 0 && xe();
|
|
316
342
|
},
|
|
317
343
|
placeholder: `Search ${t.label.toLowerCase()}…`,
|
|
318
344
|
className: "h-9 w-full rounded-md border border-slate-200 bg-white pl-8 pr-2 text-[13px] focus:border-nvr-cyan focus:outline-none dark:border-border dark:bg-card"
|
|
319
345
|
}
|
|
320
346
|
)
|
|
321
347
|
] }),
|
|
322
|
-
|
|
348
|
+
B.length === 0 ? /* @__PURE__ */ i("p", { className: "text-[12.5px] text-slate-500 dark:text-slate-400", children: [
|
|
323
349
|
"No ",
|
|
324
350
|
t.label.toLowerCase(),
|
|
325
351
|
" match",
|
|
326
|
-
|
|
352
|
+
ke.length ? ` ${ke.join(" · ")}` : "",
|
|
327
353
|
v ? ` and “${v}”` : "",
|
|
328
354
|
"."
|
|
329
|
-
] }) :
|
|
330
|
-
const n =
|
|
355
|
+
] }) : fe ? /* @__PURE__ */ s("div", { className: "max-h-72 overflow-y-auto rounded-md border border-slate-200 dark:border-border", children: B.map((e) => {
|
|
356
|
+
const n = Ne.includes(String(e.id));
|
|
331
357
|
return /* @__PURE__ */ i(
|
|
332
358
|
"button",
|
|
333
359
|
{
|
|
334
360
|
type: "button",
|
|
335
361
|
"aria-pressed": n,
|
|
336
|
-
onClick: () =>
|
|
337
|
-
className:
|
|
362
|
+
onClick: () => ie(t, e),
|
|
363
|
+
className: T(
|
|
338
364
|
"flex w-full items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted",
|
|
339
365
|
n && "bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan"
|
|
340
366
|
),
|
|
341
367
|
children: [
|
|
342
|
-
/* @__PURE__ */
|
|
368
|
+
/* @__PURE__ */ s(
|
|
343
369
|
"span",
|
|
344
370
|
{
|
|
345
|
-
className:
|
|
371
|
+
className: T(
|
|
346
372
|
"flex h-4 w-4 shrink-0 items-center justify-center rounded-full border",
|
|
347
373
|
n ? "border-nvr-cyan bg-nvr-cyan" : "border-slate-300 dark:border-slate-600"
|
|
348
374
|
),
|
|
349
|
-
children: n && /* @__PURE__ */
|
|
375
|
+
children: n && /* @__PURE__ */ s(qe, { className: "h-2.5 w-2.5 text-[#172940]", strokeWidth: 3 })
|
|
350
376
|
}
|
|
351
377
|
),
|
|
352
|
-
/* @__PURE__ */
|
|
378
|
+
/* @__PURE__ */ s("span", { className: "truncate", children: I(e) }),
|
|
379
|
+
z.has(String(e.id)) && /* @__PURE__ */ s(
|
|
380
|
+
"span",
|
|
381
|
+
{
|
|
382
|
+
className: "ml-auto max-w-[45%] shrink-0 truncate pl-2 text-[11.5px] text-muted-foreground",
|
|
383
|
+
"data-option-detail": !0,
|
|
384
|
+
children: z.get(String(e.id))
|
|
385
|
+
}
|
|
386
|
+
)
|
|
353
387
|
]
|
|
354
388
|
},
|
|
355
389
|
String(e.id)
|
|
356
390
|
);
|
|
357
|
-
}) }) : /* @__PURE__ */
|
|
391
|
+
}) }) : /* @__PURE__ */ s(
|
|
358
392
|
"div",
|
|
359
393
|
{
|
|
360
394
|
role: t.multi ? "group" : "radiogroup",
|
|
361
395
|
className: "flex flex-wrap gap-2",
|
|
362
|
-
children:
|
|
363
|
-
const n =
|
|
364
|
-
return /* @__PURE__ */
|
|
396
|
+
children: B.map((e) => {
|
|
397
|
+
const n = Ne.includes(String(e.id));
|
|
398
|
+
return /* @__PURE__ */ i(
|
|
365
399
|
"button",
|
|
366
400
|
{
|
|
367
401
|
type: "button",
|
|
368
402
|
"aria-pressed": n,
|
|
369
|
-
onClick: () =>
|
|
370
|
-
className:
|
|
403
|
+
onClick: () => ie(t, e),
|
|
404
|
+
className: T(
|
|
371
405
|
"h-8 rounded-full border px-3 text-[13px] transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
|
|
372
406
|
n ? "border-nvr-cyan bg-nvr-cyan/10 font-medium text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 bg-white text-slate-700 hover:border-slate-300 dark:border-border dark:bg-card dark:text-slate-200"
|
|
373
407
|
),
|
|
374
|
-
children:
|
|
408
|
+
children: [
|
|
409
|
+
I(e),
|
|
410
|
+
z.has(String(e.id)) && /* @__PURE__ */ i(
|
|
411
|
+
"span",
|
|
412
|
+
{
|
|
413
|
+
className: "ml-1.5 text-[11.5px] font-normal text-muted-foreground",
|
|
414
|
+
"data-option-detail": !0,
|
|
415
|
+
children: [
|
|
416
|
+
"· ",
|
|
417
|
+
z.get(String(e.id))
|
|
418
|
+
]
|
|
419
|
+
}
|
|
420
|
+
)
|
|
421
|
+
]
|
|
375
422
|
},
|
|
376
423
|
String(e.id)
|
|
377
424
|
);
|
|
@@ -384,41 +431,41 @@ function ht({
|
|
|
384
431
|
"button",
|
|
385
432
|
{
|
|
386
433
|
type: "button",
|
|
387
|
-
onClick:
|
|
388
|
-
disabled:
|
|
434
|
+
onClick: xe,
|
|
435
|
+
disabled: y === 0,
|
|
389
436
|
className: "flex h-8 items-center gap-1 rounded-md px-2 text-[12.5px] text-slate-600 hover:bg-muted disabled:opacity-40 dark:text-slate-300",
|
|
390
437
|
children: [
|
|
391
|
-
/* @__PURE__ */
|
|
438
|
+
/* @__PURE__ */ s(Le, { className: "h-3.5 w-3.5" }),
|
|
392
439
|
" Back"
|
|
393
440
|
]
|
|
394
441
|
}
|
|
395
442
|
),
|
|
396
|
-
/* @__PURE__ */
|
|
397
|
-
!t.required && !
|
|
443
|
+
/* @__PURE__ */ s("span", { className: "flex-1" }),
|
|
444
|
+
!t.required && !h(t) && !Z && /* @__PURE__ */ s(
|
|
398
445
|
"button",
|
|
399
446
|
{
|
|
400
447
|
type: "button",
|
|
401
|
-
onClick: () =>
|
|
448
|
+
onClick: () => be(t),
|
|
402
449
|
className: "h-8 rounded-md px-2 text-[12.5px] text-slate-500 hover:bg-muted dark:text-slate-400",
|
|
403
450
|
children: "Skip"
|
|
404
451
|
}
|
|
405
452
|
),
|
|
406
|
-
|
|
453
|
+
u && (Z || F) ? /* @__PURE__ */ s(
|
|
407
454
|
"button",
|
|
408
455
|
{
|
|
409
456
|
type: "button",
|
|
410
|
-
onClick:
|
|
411
|
-
disabled:
|
|
457
|
+
onClick: u,
|
|
458
|
+
disabled: te && !F,
|
|
412
459
|
"data-quick-picker-create": !0,
|
|
413
460
|
className: "h-8 rounded-md bg-nvr-cyan px-3 text-[12.5px] font-semibold text-[#172940] hover:bg-nvr-cyan-dark disabled:opacity-40",
|
|
414
|
-
children:
|
|
461
|
+
children: ee
|
|
415
462
|
}
|
|
416
|
-
) :
|
|
463
|
+
) : Z ? null : /* @__PURE__ */ s(
|
|
417
464
|
"button",
|
|
418
465
|
{
|
|
419
466
|
type: "button",
|
|
420
|
-
onClick:
|
|
421
|
-
disabled: !
|
|
467
|
+
onClick: Xe,
|
|
468
|
+
disabled: !Ue,
|
|
422
469
|
className: "h-8 rounded-md bg-nvr-cyan px-3 text-[12.5px] font-semibold text-[#172940] hover:bg-nvr-cyan-dark disabled:opacity-40",
|
|
423
470
|
children: "Next"
|
|
424
471
|
}
|
|
@@ -427,10 +474,10 @@ function ht({
|
|
|
427
474
|
]
|
|
428
475
|
},
|
|
429
476
|
t.field
|
|
430
|
-
) : /* @__PURE__ */
|
|
477
|
+
) : /* @__PURE__ */ s("p", { className: "text-[12.5px] text-slate-500 dark:text-slate-400", children: "All steps done — pick any step above to change it." })
|
|
431
478
|
] });
|
|
432
479
|
}
|
|
433
480
|
export {
|
|
434
|
-
|
|
435
|
-
|
|
481
|
+
Nt as QuickPicker,
|
|
482
|
+
it as useQuickPickerStepDefs
|
|
436
483
|
};
|