@llmnative/react 1.40.0 → 1.41.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.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +240 -238
- package/dist/index.mjs.map +1 -1
- package/dist/types/src/components/widgets/Form.d.ts +8 -0
- package/llms-full.txt +11 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -14361,62 +14361,62 @@ function xp(e) {
|
|
|
14361
14361
|
subscribe: (e) => (n.add(e), () => n.delete(e))
|
|
14362
14362
|
};
|
|
14363
14363
|
}
|
|
14364
|
-
var Sp = {}, Cp = ({ children: e, appearance: t = void 0, controller: n = void 0, header: r = void 0, footer: i = void 0, path: a = void 0, defaultValues: o = void 0, keyGenerator: s = void 0, onLoad: c = void 0, onRecordChange: l = void 0, onSave: u = void 0, onDelete: f = void 0, onComplete: p = void 0, log: m = !1, showNotice: h = !0,
|
|
14365
|
-
let
|
|
14366
|
-
|
|
14367
|
-
let
|
|
14368
|
-
if (!
|
|
14369
|
-
let e = yt(
|
|
14364
|
+
var Sp = {}, Cp = ({ children: e, appearance: t = void 0, controller: n = void 0, header: r = void 0, footer: i = void 0, path: a = void 0, defaultValues: o = void 0, keyGenerator: s = void 0, onLoad: c = void 0, onRecordChange: l = void 0, onSave: u = void 0, onDelete: f = void 0, onComplete: p = void 0, log: m = !1, showNotice: h = !0, requireChanges: g = !0, draftBucket: v = void 0, noticeAnchorRef: b = void 0, showBack: x = !1, wrapperClassName: S = void 0, headerClassName: D = void 0, className: O = void 0, footerClassName: k = void 0, formClassName: A = void 0 }) => {
|
|
14365
|
+
let M = j(), N = J("form"), P = Y("form"), F = zi(), I = rp(n), L = ep(I), R = w(void 0);
|
|
14366
|
+
R.current ||= xp(o);
|
|
14367
|
+
let z = R.current, B = E(z.subscribe, z.getRecord), V = z.setRecord, [U, W] = T(!1), [ee, te] = T(!1), ne = !o?.[uo], G = w(Ft(o ?? {})), [K, re] = T(() => yp(o)), [ie, ae] = T(null), oe = w({ isDirty: !1 }), se = C(() => {
|
|
14368
|
+
if (!v) return;
|
|
14369
|
+
let e = yt(v), t = yt(a || `${M.pathname}${M.hash || ""}`);
|
|
14370
14370
|
return e && t ? `llmnative.form-draft.${e}.${t}` : void 0;
|
|
14371
14371
|
}, [
|
|
14372
|
-
|
|
14373
|
-
|
|
14374
|
-
|
|
14372
|
+
v,
|
|
14373
|
+
M.pathname,
|
|
14374
|
+
M.hash,
|
|
14375
14375
|
a
|
|
14376
|
-
]),
|
|
14377
|
-
|
|
14378
|
-
}, [
|
|
14379
|
-
if (
|
|
14380
|
-
}, [
|
|
14381
|
-
|
|
14382
|
-
}, []), [
|
|
14383
|
-
h &&
|
|
14376
|
+
]), ce = !!(u || a || !ne), le = !(!f && ne), ue = C(() => !Kt(B, G.current), [B, G.current]), de = P.noChangesToSave ?? "No changes to save", fe = P.draftRestoreTitle ?? "Unsaved changes found", pe = P.draftRestoreMessage ?? "A local draft is available for this form. Restore it or discard it.", q = P.draftRestoreAction ?? "Restore", me = P.draftDiscardAction ?? "Discard", he = P.draftRestoredTitle ?? "Draft restored", ge = P.draftRestoredMessage ?? "The local draft has been restored. You can still discard it for a few seconds.", _e = _(() => {
|
|
14377
|
+
se && typeof localStorage < "u" && localStorage.removeItem(se);
|
|
14378
|
+
}, [se]), ve = _(() => {
|
|
14379
|
+
if (se && typeof localStorage < "u") return bp(localStorage.getItem(se));
|
|
14380
|
+
}, [se]), ye = _(() => {
|
|
14381
|
+
V(Ft(G.current));
|
|
14382
|
+
}, []), [be, xe] = T(void 0), Se = _(({ message: e, type: t = "danger" }) => {
|
|
14383
|
+
h && xe({
|
|
14384
14384
|
type: t,
|
|
14385
14385
|
message: e
|
|
14386
14386
|
});
|
|
14387
|
-
}, [h]), [
|
|
14388
|
-
|
|
14389
|
-
}, [
|
|
14390
|
-
let e =
|
|
14387
|
+
}, [h]), [Ce, we] = T({}), Te = w({}), Ee = w(null), De = w(B), Oe = w(o), ke = w(u), Ae = w(f), je = w(p), Me = w(a), Ne = w(m), Pe = _(() => {
|
|
14388
|
+
_e(), ye(), ae(null);
|
|
14389
|
+
}, [_e, ye]), Fe = _(() => {
|
|
14390
|
+
let e = ve();
|
|
14391
14391
|
if (!e) {
|
|
14392
|
-
|
|
14392
|
+
ae(null);
|
|
14393
14393
|
return;
|
|
14394
14394
|
}
|
|
14395
|
-
|
|
14396
|
-
}, [
|
|
14397
|
-
|
|
14398
|
-
}, [
|
|
14399
|
-
|
|
14400
|
-
}, []), Le = _((e) => {
|
|
14401
|
-
delete we.current[e];
|
|
14395
|
+
V(Ft(e)), ae("restored");
|
|
14396
|
+
}, [ve]), Ie = _(() => {
|
|
14397
|
+
we({}), xe(void 0), ae(null), ye();
|
|
14398
|
+
}, [ye]), Le = _((e, t) => {
|
|
14399
|
+
Te.current[e] = t;
|
|
14402
14400
|
}, []), Re = _((e) => {
|
|
14403
|
-
|
|
14401
|
+
delete Te.current[e];
|
|
14402
|
+
}, []), ze = _((e) => {
|
|
14403
|
+
we((t) => {
|
|
14404
14404
|
if (!t[e]) return t;
|
|
14405
14405
|
let { [e]: n, ...r } = t;
|
|
14406
14406
|
return r;
|
|
14407
14407
|
});
|
|
14408
|
-
}, []),
|
|
14408
|
+
}, []), Be = _(async () => {
|
|
14409
14409
|
let e = {};
|
|
14410
|
-
for (let [t, n] of Object.entries(
|
|
14410
|
+
for (let [t, n] of Object.entries(Te.current)) {
|
|
14411
14411
|
let { required: r, label: i, validator: a } = n.current, o = t.split(".").reduce((e, t) => {
|
|
14412
14412
|
if (e != null) {
|
|
14413
14413
|
if (Array.isArray(e)) return e[Number(t)];
|
|
14414
14414
|
if (typeof e == "object") return e[t];
|
|
14415
14415
|
}
|
|
14416
|
-
},
|
|
14416
|
+
}, De.current);
|
|
14417
14417
|
if (r && (o == null || typeof o == "string" && o.trim() === "" || Array.isArray(o) && o.length === 0)) {
|
|
14418
14418
|
let n = ul(i);
|
|
14419
|
-
e[t] = n ? Bn(
|
|
14419
|
+
e[t] = n ? Bn(P.requiredField, { field: n }) : P.requiredFieldGeneric;
|
|
14420
14420
|
continue;
|
|
14421
14421
|
}
|
|
14422
14422
|
if (a) {
|
|
@@ -14424,17 +14424,17 @@ var Sp = {}, Cp = ({ children: e, appearance: t = void 0, controller: n = void 0
|
|
|
14424
14424
|
n && (e[t] = n);
|
|
14425
14425
|
}
|
|
14426
14426
|
}
|
|
14427
|
-
if (
|
|
14427
|
+
if (we(e), Object.keys(e).length > 0) {
|
|
14428
14428
|
let t = Object.keys(e)[0];
|
|
14429
14429
|
requestAnimationFrame(() => {
|
|
14430
|
-
|
|
14430
|
+
Ee.current?.querySelector(`[name="${CSS.escape(t)}"]`)?.focus();
|
|
14431
14431
|
});
|
|
14432
14432
|
}
|
|
14433
14433
|
return Object.keys(e).length === 0;
|
|
14434
|
-
}, [
|
|
14434
|
+
}, [P]), Ve = _((e) => {
|
|
14435
14435
|
if (!a) return;
|
|
14436
14436
|
let t = vt(a);
|
|
14437
|
-
if (
|
|
14437
|
+
if (ne) return t.split("/").filter(Boolean).length % 2 == 0 && !s ? `/${t}` : `/${t}/${s?.(e) ?? Date.now().toString()}`;
|
|
14438
14438
|
let n = e[uo];
|
|
14439
14439
|
if (!n) return a;
|
|
14440
14440
|
let r = t.split("/").filter(Boolean);
|
|
@@ -14442,99 +14442,100 @@ var Sp = {}, Cp = ({ children: e, appearance: t = void 0, controller: n = void 0
|
|
|
14442
14442
|
}, [
|
|
14443
14443
|
a,
|
|
14444
14444
|
s,
|
|
14445
|
-
|
|
14446
|
-
]),
|
|
14447
|
-
if (
|
|
14445
|
+
ne
|
|
14446
|
+
]), He = _(async (e) => {
|
|
14447
|
+
if (Ne.current && Me.current && F) {
|
|
14448
14448
|
let t = (/* @__PURE__ */ new Date()).toISOString(), n = di("user");
|
|
14449
|
-
|
|
14449
|
+
F.set(`/log/${Me.current}/${yt(t)}`, {
|
|
14450
14450
|
user: n?.email ?? "unknown",
|
|
14451
14451
|
when: t,
|
|
14452
14452
|
action: e,
|
|
14453
|
-
record:
|
|
14453
|
+
record: De.current
|
|
14454
14454
|
});
|
|
14455
14455
|
}
|
|
14456
|
-
return
|
|
14457
|
-
message: e === "delete" ?
|
|
14456
|
+
return Se({
|
|
14457
|
+
message: e === "delete" ? P.deleteSuccess : P.saveSuccess,
|
|
14458
14458
|
type: "success"
|
|
14459
|
-
}), await
|
|
14460
|
-
record:
|
|
14459
|
+
}), await je.current?.({
|
|
14460
|
+
record: De.current,
|
|
14461
14461
|
action: e
|
|
14462
14462
|
}) ?? !0;
|
|
14463
14463
|
}, [
|
|
14464
|
-
|
|
14465
|
-
|
|
14466
|
-
|
|
14467
|
-
]),
|
|
14468
|
-
if (e?.preventDefault?.(), !
|
|
14469
|
-
message:
|
|
14464
|
+
F,
|
|
14465
|
+
Se,
|
|
14466
|
+
P
|
|
14467
|
+
]), Ue = _(async (e) => {
|
|
14468
|
+
if (e?.preventDefault?.(), g && !ue) return h && xe({
|
|
14469
|
+
message: de,
|
|
14470
14470
|
type: "info"
|
|
14471
14471
|
}), !1;
|
|
14472
14472
|
if (H(() => {
|
|
14473
|
-
|
|
14474
|
-
}), !await
|
|
14475
|
-
message:
|
|
14473
|
+
we({}), h && xe(void 0);
|
|
14474
|
+
}), !await Be()) return h && xe({
|
|
14475
|
+
message: P.noticeRequiredFields,
|
|
14476
14476
|
type: "warning"
|
|
14477
14477
|
}), !1;
|
|
14478
|
-
let t =
|
|
14479
|
-
|
|
14478
|
+
let t = ne ? "create" : "update";
|
|
14479
|
+
W(!0);
|
|
14480
14480
|
try {
|
|
14481
|
-
let e = (
|
|
14482
|
-
record:
|
|
14483
|
-
prevRecord:
|
|
14481
|
+
let e = (ke.current && await ke.current({
|
|
14482
|
+
record: De.current,
|
|
14483
|
+
prevRecord: Oe.current,
|
|
14484
14484
|
action: t,
|
|
14485
|
-
storagePath:
|
|
14486
|
-
})) ??
|
|
14487
|
-
return e && await
|
|
14485
|
+
storagePath: Me.current
|
|
14486
|
+
})) ?? Ve(De.current ?? {});
|
|
14487
|
+
return e && await F.set(e, Wt(De.current)), G.current = Ft(De.current ?? {}), re(yp(De.current)), _e(), ae(null), await He(t);
|
|
14488
14488
|
} finally {
|
|
14489
|
-
|
|
14489
|
+
W(!1);
|
|
14490
14490
|
}
|
|
14491
14491
|
}, [
|
|
14492
|
-
|
|
14493
|
-
Be,
|
|
14494
|
-
P,
|
|
14495
|
-
N.noticeRequiredFields,
|
|
14492
|
+
_e,
|
|
14496
14493
|
Ve,
|
|
14497
|
-
|
|
14498
|
-
|
|
14494
|
+
F,
|
|
14495
|
+
P.noticeRequiredFields,
|
|
14496
|
+
He,
|
|
14499
14497
|
ue,
|
|
14498
|
+
ne,
|
|
14499
|
+
de,
|
|
14500
|
+
g,
|
|
14500
14501
|
h,
|
|
14501
|
-
|
|
14502
|
-
]),
|
|
14503
|
-
e?.preventDefault?.(), h &&
|
|
14502
|
+
Be
|
|
14503
|
+
]), We = _(async (e) => {
|
|
14504
|
+
e?.preventDefault?.(), h && xe(void 0), te(!0);
|
|
14504
14505
|
try {
|
|
14505
|
-
let e = (
|
|
14506
|
-
return e && await
|
|
14506
|
+
let e = (Ae.current && await Ae.current({ record: De.current })) ?? Ve(De.current ?? {});
|
|
14507
|
+
return e && await F.remove(e), _e(), ae(null), await He("delete");
|
|
14507
14508
|
} finally {
|
|
14508
|
-
|
|
14509
|
+
te(!1);
|
|
14509
14510
|
}
|
|
14510
14511
|
}, [
|
|
14511
|
-
|
|
14512
|
-
Be,
|
|
14513
|
-
P,
|
|
14512
|
+
_e,
|
|
14514
14513
|
Ve,
|
|
14514
|
+
F,
|
|
14515
|
+
He,
|
|
14515
14516
|
h
|
|
14516
14517
|
]);
|
|
14517
14518
|
y(() => {
|
|
14518
14519
|
let e = Ft(o ?? {});
|
|
14519
|
-
if (o && (
|
|
14520
|
-
|
|
14520
|
+
if (o && (V(e), c?.(Ft(e))), G.current = e, re(yp(e)), !v) {
|
|
14521
|
+
ae(null);
|
|
14521
14522
|
return;
|
|
14522
14523
|
}
|
|
14523
|
-
let t =
|
|
14524
|
+
let t = ve();
|
|
14524
14525
|
if (t && yp(t) !== yp(e)) {
|
|
14525
|
-
|
|
14526
|
+
ae("restore");
|
|
14526
14527
|
return;
|
|
14527
14528
|
}
|
|
14528
|
-
|
|
14529
|
+
ae(null);
|
|
14529
14530
|
}, [
|
|
14530
14531
|
JSON.stringify(o),
|
|
14531
|
-
|
|
14532
|
+
v,
|
|
14532
14533
|
c,
|
|
14533
|
-
|
|
14534
|
+
ve
|
|
14534
14535
|
]), y(() => {
|
|
14535
|
-
|
|
14536
|
-
}, [
|
|
14537
|
-
|
|
14536
|
+
De.current = B, B !== void 0 && l?.(B);
|
|
14537
|
+
}, [B, l]), y(() => {
|
|
14538
|
+
Oe.current = o, ke.current = u, Ae.current = f, je.current = p, Me.current = a, Ne.current = m;
|
|
14538
14539
|
}, [
|
|
14539
14540
|
o,
|
|
14540
14541
|
m,
|
|
@@ -14543,215 +14544,216 @@ var Sp = {}, Cp = ({ children: e, appearance: t = void 0, controller: n = void 0
|
|
|
14543
14544
|
u,
|
|
14544
14545
|
a
|
|
14545
14546
|
]), y(() => {
|
|
14546
|
-
if (!
|
|
14547
|
-
if (!
|
|
14548
|
-
let e =
|
|
14549
|
-
if (e && yp(e) !==
|
|
14550
|
-
localStorage.removeItem(
|
|
14547
|
+
if (!se || typeof localStorage > "u" || B === void 0) return;
|
|
14548
|
+
if (!ue) {
|
|
14549
|
+
let e = ve();
|
|
14550
|
+
if (e && yp(e) !== K) return;
|
|
14551
|
+
localStorage.removeItem(se);
|
|
14551
14552
|
return;
|
|
14552
14553
|
}
|
|
14553
14554
|
let e = window.setTimeout(() => {
|
|
14554
14555
|
try {
|
|
14555
|
-
localStorage.setItem(
|
|
14556
|
+
localStorage.setItem(se, JSON.stringify(Wt(B)));
|
|
14556
14557
|
} catch {
|
|
14557
|
-
|
|
14558
|
+
Se({
|
|
14558
14559
|
type: "warning",
|
|
14559
|
-
message:
|
|
14560
|
+
message: P.draftSaveError ?? "Could not save a local draft — the change is too large for browser storage (e.g. an unsent image upload). Save the form to keep it."
|
|
14560
14561
|
});
|
|
14561
14562
|
}
|
|
14562
14563
|
}, 150);
|
|
14563
14564
|
return () => window.clearTimeout(e);
|
|
14564
14565
|
}, [
|
|
14565
|
-
|
|
14566
|
-
|
|
14567
|
-
|
|
14568
|
-
|
|
14569
|
-
|
|
14570
|
-
|
|
14566
|
+
K,
|
|
14567
|
+
se,
|
|
14568
|
+
ue,
|
|
14569
|
+
Se,
|
|
14570
|
+
ve,
|
|
14571
|
+
B
|
|
14571
14572
|
]), y(() => {
|
|
14572
|
-
|
|
14573
|
-
storageKey:
|
|
14574
|
-
record:
|
|
14575
|
-
isDirty:
|
|
14573
|
+
oe.current = {
|
|
14574
|
+
storageKey: se,
|
|
14575
|
+
record: B,
|
|
14576
|
+
isDirty: ue
|
|
14576
14577
|
};
|
|
14577
14578
|
}, [
|
|
14578
|
-
|
|
14579
|
-
|
|
14580
|
-
|
|
14579
|
+
se,
|
|
14580
|
+
ue,
|
|
14581
|
+
B
|
|
14581
14582
|
]), y(() => () => {
|
|
14582
|
-
let { storageKey: e, record: t, isDirty: n } =
|
|
14583
|
+
let { storageKey: e, record: t, isDirty: n } = oe.current;
|
|
14583
14584
|
if (e && n && t && typeof localStorage < "u") try {
|
|
14584
14585
|
localStorage.setItem(e, JSON.stringify(Wt(t)));
|
|
14585
14586
|
} catch {}
|
|
14586
14587
|
}, []), y(() => {
|
|
14587
|
-
|
|
14588
|
-
save:
|
|
14589
|
-
delete:
|
|
14590
|
-
reset:
|
|
14591
|
-
restoreDraft:
|
|
14592
|
-
discardDraft:
|
|
14588
|
+
L.bindActions({
|
|
14589
|
+
save: Ue,
|
|
14590
|
+
delete: We,
|
|
14591
|
+
reset: Ie,
|
|
14592
|
+
restoreDraft: Fe,
|
|
14593
|
+
discardDraft: Pe
|
|
14593
14594
|
});
|
|
14594
14595
|
}, [
|
|
14595
|
-
|
|
14596
|
-
|
|
14596
|
+
L,
|
|
14597
|
+
Pe,
|
|
14598
|
+
We,
|
|
14597
14599
|
Ue,
|
|
14598
|
-
|
|
14599
|
-
Fe
|
|
14600
|
-
Pe
|
|
14600
|
+
Ie,
|
|
14601
|
+
Fe
|
|
14601
14602
|
]), y(() => {
|
|
14602
|
-
|
|
14603
|
-
record:
|
|
14604
|
-
isNewRecord:
|
|
14605
|
-
isDirty:
|
|
14606
|
-
canSave:
|
|
14607
|
-
canDelete:
|
|
14608
|
-
isSaving:
|
|
14609
|
-
isDeleting:
|
|
14610
|
-
saveDisabled: !
|
|
14611
|
-
deleteDisabled: !
|
|
14612
|
-
hasDraft:
|
|
14613
|
-
draftStatus:
|
|
14614
|
-
errors:
|
|
14615
|
-
hasErrors: Object.keys(
|
|
14603
|
+
L.setState({
|
|
14604
|
+
record: De.current,
|
|
14605
|
+
isNewRecord: ne,
|
|
14606
|
+
isDirty: ue,
|
|
14607
|
+
canSave: ce,
|
|
14608
|
+
canDelete: le,
|
|
14609
|
+
isSaving: U,
|
|
14610
|
+
isDeleting: ee,
|
|
14611
|
+
saveDisabled: !ce || g && !ue || U,
|
|
14612
|
+
deleteDisabled: !le || ee,
|
|
14613
|
+
hasDraft: ie !== null,
|
|
14614
|
+
draftStatus: ie,
|
|
14615
|
+
errors: Ce,
|
|
14616
|
+
hasErrors: Object.keys(Ce).length > 0
|
|
14616
14617
|
});
|
|
14617
14618
|
}, [
|
|
14618
|
-
ce,
|
|
14619
|
-
se,
|
|
14620
|
-
I,
|
|
14621
|
-
re,
|
|
14622
|
-
Se,
|
|
14623
|
-
W,
|
|
14624
14619
|
le,
|
|
14625
|
-
|
|
14626
|
-
|
|
14627
|
-
|
|
14628
|
-
|
|
14629
|
-
|
|
14630
|
-
|
|
14631
|
-
|
|
14632
|
-
|
|
14633
|
-
|
|
14634
|
-
|
|
14635
|
-
|
|
14620
|
+
ce,
|
|
14621
|
+
L,
|
|
14622
|
+
ie,
|
|
14623
|
+
Ce,
|
|
14624
|
+
ee,
|
|
14625
|
+
ue,
|
|
14626
|
+
ne,
|
|
14627
|
+
U,
|
|
14628
|
+
B,
|
|
14629
|
+
g
|
|
14630
|
+
]), y(() => () => tp(I), [L]);
|
|
14631
|
+
let Ge = _((e) => {
|
|
14632
|
+
e.defaultPrevented || !e.ctrlKey && !e.metaKey || e.key.toLowerCase() !== "s" || I.saveDisabled || (e.preventDefault(), I.save());
|
|
14633
|
+
}, [I]), Ke = C(() => ({
|
|
14634
|
+
registerField: Le,
|
|
14635
|
+
unregisterField: Re,
|
|
14636
|
+
clearFieldError: ze,
|
|
14637
|
+
errors: Ce
|
|
14636
14638
|
}), [
|
|
14637
|
-
Ie,
|
|
14638
14639
|
Le,
|
|
14639
14640
|
Re,
|
|
14640
|
-
|
|
14641
|
-
|
|
14642
|
-
|
|
14641
|
+
ze,
|
|
14642
|
+
Ce
|
|
14643
|
+
]), qe = C(() => ({
|
|
14644
|
+
store: z,
|
|
14643
14645
|
wrapperClassName: "mb-3"
|
|
14644
|
-
}), [
|
|
14646
|
+
}), [z]), Je = C(() => /* @__PURE__ */ d.createElement(np.Provider, { value: I }, /* @__PURE__ */ d.createElement(up.Provider, { value: qe }, /* @__PURE__ */ d.createElement(dp.Provider, { value: Ke }, typeof e == "function" ? e({ record: B }) : e))), [
|
|
14645
14647
|
e,
|
|
14646
|
-
|
|
14647
|
-
|
|
14648
|
-
|
|
14649
|
-
|
|
14650
|
-
]),
|
|
14651
|
-
variant:
|
|
14652
|
-
appearance:
|
|
14653
|
-
placement:
|
|
14654
|
-
anchorRef:
|
|
14655
|
-
timeout:
|
|
14656
|
-
onClose:
|
|
14657
|
-
},
|
|
14658
|
-
if (!
|
|
14659
|
-
let e =
|
|
14648
|
+
I,
|
|
14649
|
+
qe,
|
|
14650
|
+
B,
|
|
14651
|
+
Ke
|
|
14652
|
+
]), Ye = C(() => be ? /* @__PURE__ */ d.createElement(ss, {
|
|
14653
|
+
variant: be.type,
|
|
14654
|
+
appearance: b ? "default" : "text",
|
|
14655
|
+
placement: b ? "sticky" : "inline",
|
|
14656
|
+
anchorRef: b,
|
|
14657
|
+
timeout: be.type === "success" ? 3e3 : void 0,
|
|
14658
|
+
onClose: be.type === "success" ? () => xe(void 0) : void 0
|
|
14659
|
+
}, be.message) : null, [be, b]), Xe = C(() => {
|
|
14660
|
+
if (!ie) return null;
|
|
14661
|
+
let e = ie === "restore" ? fe : he, t = ie === "restore" ? pe : ge;
|
|
14660
14662
|
return /* @__PURE__ */ d.createElement(ss, {
|
|
14661
|
-
variant:
|
|
14662
|
-
timeout:
|
|
14663
|
-
onClose:
|
|
14664
|
-
}, /* @__PURE__ */ d.createElement("div", { className: "flex items-start justify-between gap-3" }, /* @__PURE__ */ d.createElement("div", { className: "min-w-0" }, /* @__PURE__ */ d.createElement("div", { className: "font-medium" }, e), /* @__PURE__ */ d.createElement("div", { className: "text-sm opacity-90" }, t)), /* @__PURE__ */ d.createElement("div", { className: "flex shrink-0 items-center gap-2" },
|
|
14665
|
-
label:
|
|
14663
|
+
variant: ie === "restore" ? "warning" : "info",
|
|
14664
|
+
timeout: ie === "restored" ? 6e3 : void 0,
|
|
14665
|
+
onClose: ie === "restored" ? () => ae(null) : void 0
|
|
14666
|
+
}, /* @__PURE__ */ d.createElement("div", { className: "flex items-start justify-between gap-3" }, /* @__PURE__ */ d.createElement("div", { className: "min-w-0" }, /* @__PURE__ */ d.createElement("div", { className: "font-medium" }, e), /* @__PURE__ */ d.createElement("div", { className: "text-sm opacity-90" }, t)), /* @__PURE__ */ d.createElement("div", { className: "flex shrink-0 items-center gap-2" }, ie === "restore" ? /* @__PURE__ */ d.createElement(d.Fragment, null, /* @__PURE__ */ d.createElement(ni, {
|
|
14667
|
+
label: q,
|
|
14666
14668
|
variant: "warning",
|
|
14667
|
-
onClick: () =>
|
|
14669
|
+
onClick: () => Fe()
|
|
14668
14670
|
}), /* @__PURE__ */ d.createElement(ni, {
|
|
14669
|
-
label:
|
|
14671
|
+
label: me,
|
|
14670
14672
|
variant: "outline-secondary",
|
|
14671
|
-
onClick: () =>
|
|
14673
|
+
onClick: () => Pe()
|
|
14672
14674
|
})) : /* @__PURE__ */ d.createElement(ni, {
|
|
14673
|
-
label:
|
|
14675
|
+
label: me,
|
|
14674
14676
|
variant: "outline-secondary",
|
|
14675
|
-
onClick: () =>
|
|
14677
|
+
onClick: () => Pe()
|
|
14676
14678
|
}))));
|
|
14677
14679
|
}, [
|
|
14678
|
-
|
|
14680
|
+
Pe,
|
|
14681
|
+
me,
|
|
14682
|
+
ie,
|
|
14679
14683
|
q,
|
|
14680
|
-
re,
|
|
14681
14684
|
pe,
|
|
14682
14685
|
fe,
|
|
14683
|
-
|
|
14686
|
+
ge,
|
|
14684
14687
|
he,
|
|
14685
|
-
|
|
14686
|
-
|
|
14687
|
-
]), Xe = C(() => {
|
|
14688
|
+
Fe
|
|
14689
|
+
]), Ze = C(() => {
|
|
14688
14690
|
switch (t) {
|
|
14689
|
-
case "empty": return /* @__PURE__ */ d.createElement(d.Fragment, null,
|
|
14691
|
+
case "empty": return /* @__PURE__ */ d.createElement(d.Fragment, null, Xe, Je, Ye);
|
|
14690
14692
|
default: return /* @__PURE__ */ d.createElement(Gi, {
|
|
14691
14693
|
header: r || /* @__PURE__ */ d.createElement(wa, {
|
|
14692
|
-
rootItem:
|
|
14694
|
+
rootItem: ne ? P.headerAdd : P.headerEdit,
|
|
14693
14695
|
trail: a || void 0
|
|
14694
14696
|
}),
|
|
14695
|
-
footer: (i || !
|
|
14696
|
-
className: X(
|
|
14697
|
-
label:
|
|
14698
|
-
title:
|
|
14699
|
-
disabled:
|
|
14700
|
-
loading:
|
|
14701
|
-
onClick: (e) =>
|
|
14702
|
-
}), (f || !
|
|
14703
|
-
className:
|
|
14704
|
-
label:
|
|
14705
|
-
disabled:
|
|
14706
|
-
loading:
|
|
14707
|
-
onClick: (e) =>
|
|
14708
|
-
}),
|
|
14709
|
-
className:
|
|
14710
|
-
label:
|
|
14697
|
+
footer: (i || !ne || u || f || x || !!a) && /* @__PURE__ */ d.createElement(d.Fragment, null, i, Ye, (u || !!a || !ne) && /* @__PURE__ */ d.createElement(ti, {
|
|
14698
|
+
className: X(N.Form.buttonSaveClass, I.saveDisabled && "cursor-not-allowed opacity-50"),
|
|
14699
|
+
label: P.buttonSave,
|
|
14700
|
+
title: I.saveDisabled && !ue ? de : void 0,
|
|
14701
|
+
disabled: I.saveDisabled,
|
|
14702
|
+
loading: I.isSaving,
|
|
14703
|
+
onClick: (e) => I.save(e)
|
|
14704
|
+
}), (f || !ne) && /* @__PURE__ */ d.createElement(ti, {
|
|
14705
|
+
className: N.Form.buttonDeleteClass,
|
|
14706
|
+
label: P.buttonDelete,
|
|
14707
|
+
disabled: I.deleteDisabled,
|
|
14708
|
+
loading: I.isDeleting,
|
|
14709
|
+
onClick: (e) => I.delete(e)
|
|
14710
|
+
}), x && /* @__PURE__ */ d.createElement(ri, {
|
|
14711
|
+
className: N.Form.buttonBackClass,
|
|
14712
|
+
label: P.buttonBack
|
|
14711
14713
|
})),
|
|
14712
|
-
headerClassName:
|
|
14713
|
-
bodyClassName:
|
|
14714
|
-
footerClassName:
|
|
14715
|
-
}, /* @__PURE__ */ d.createElement(d.Fragment, null,
|
|
14714
|
+
headerClassName: D || N.Form.Card.headerClassName,
|
|
14715
|
+
bodyClassName: O || N.Form.Card.bodyClassName,
|
|
14716
|
+
footerClassName: k || N.Form.Card.footerClassName
|
|
14717
|
+
}, /* @__PURE__ */ d.createElement(d.Fragment, null, Xe, Je));
|
|
14716
14718
|
}
|
|
14717
14719
|
}, [
|
|
14718
14720
|
t,
|
|
14719
|
-
D,
|
|
14720
|
-
qe,
|
|
14721
|
-
N.buttonBack,
|
|
14722
|
-
N.buttonDelete,
|
|
14723
|
-
N.buttonSave,
|
|
14724
|
-
N.headerAdd,
|
|
14725
|
-
N.headerEdit,
|
|
14726
|
-
Ye,
|
|
14727
|
-
i,
|
|
14728
14721
|
O,
|
|
14729
|
-
|
|
14722
|
+
Je,
|
|
14723
|
+
P.buttonBack,
|
|
14724
|
+
P.buttonDelete,
|
|
14725
|
+
P.buttonSave,
|
|
14726
|
+
P.headerAdd,
|
|
14727
|
+
P.headerEdit,
|
|
14728
|
+
Xe,
|
|
14729
|
+
i,
|
|
14730
|
+
k,
|
|
14731
|
+
I,
|
|
14730
14732
|
r,
|
|
14731
|
-
|
|
14732
|
-
le,
|
|
14733
|
-
te,
|
|
14733
|
+
D,
|
|
14734
14734
|
ue,
|
|
14735
|
-
|
|
14735
|
+
ne,
|
|
14736
|
+
de,
|
|
14737
|
+
Ye,
|
|
14736
14738
|
f,
|
|
14737
14739
|
u,
|
|
14738
14740
|
a,
|
|
14739
|
-
|
|
14740
|
-
|
|
14741
|
-
|
|
14742
|
-
|
|
14743
|
-
|
|
14744
|
-
|
|
14745
|
-
|
|
14741
|
+
x,
|
|
14742
|
+
N.Form.buttonDeleteClass,
|
|
14743
|
+
N.Form.buttonSaveClass,
|
|
14744
|
+
N.Form.buttonBackClass,
|
|
14745
|
+
N.Form.Card.bodyClassName,
|
|
14746
|
+
N.Form.Card.footerClassName,
|
|
14747
|
+
N.Form.Card.headerClassName
|
|
14746
14748
|
]);
|
|
14747
|
-
return /* @__PURE__ */ d.createElement(Z, { className:
|
|
14748
|
-
ref:
|
|
14749
|
-
className:
|
|
14749
|
+
return /* @__PURE__ */ d.createElement(Z, { className: S || N.Form.wrapperClassName }, /* @__PURE__ */ d.createElement("form", {
|
|
14750
|
+
ref: Ee,
|
|
14751
|
+
className: A,
|
|
14750
14752
|
noValidate: !0,
|
|
14751
14753
|
onSubmit: (e) => e.preventDefault(),
|
|
14752
|
-
onKeyDownCapture:
|
|
14753
|
-
onKeyDown:
|
|
14754
|
-
},
|
|
14754
|
+
onKeyDownCapture: Ge,
|
|
14755
|
+
onKeyDown: Ge
|
|
14756
|
+
}, Ze));
|
|
14755
14757
|
}, wp = "flex items-center justify-between gap-3 border-b border-border/50 px-3 py-2", Tp = "text-xs font-medium uppercase tracking-[0.14em] text-muted-foreground", Ep = "px-3 py-3", Dp = "h-7 w-7 rounded-md bg-transparent p-0 text-muted-foreground hover:bg-destructive/10 hover:text-destructive", Op = ({ name: e, children: t, onChange: n, onAdd: r, onRemove: i, className: a, layout: o = "horizontal", minItems: s = void 0, maxItems: c = void 0, label: l = void 0, labelPosition: u = "top", hideRemoveButton: f = !1, readOnly: p = !1 }) => {
|
|
14756
14758
|
let { value: m, handleChange: h } = pp({
|
|
14757
14759
|
name: e,
|