admin-lib-cms 1.2.8 → 1.2.10
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/chunk-IXZXII3M.mjs +795 -0
- package/dist/client.d.mts +132 -0
- package/dist/client.d.ts +132 -0
- package/dist/client.js +725 -0
- package/dist/client.mjs +26 -0
- package/dist/index.d.mts +13 -111
- package/dist/index.d.ts +13 -111
- package/dist/index.js +204 -107
- package/dist/index.mjs +881 -1549
- package/package.json +7 -1
package/dist/index.js
CHANGED
|
@@ -827,6 +827,7 @@ function EditableReference({
|
|
|
827
827
|
|
|
828
828
|
// src/admin/AdminApp.tsx
|
|
829
829
|
var import_react5 = require("react");
|
|
830
|
+
var import_react_dom = require("react-dom");
|
|
830
831
|
var import_antd = require("antd");
|
|
831
832
|
var import_dayjs = __toESM(require("dayjs"));
|
|
832
833
|
var import_lucide_react2 = require("lucide-react");
|
|
@@ -1026,6 +1027,16 @@ function AdminAppContent(props) {
|
|
|
1026
1027
|
children: menuLabels.dashboard
|
|
1027
1028
|
}
|
|
1028
1029
|
),
|
|
1030
|
+
props.customSections?.map((cs) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1031
|
+
SideItem,
|
|
1032
|
+
{
|
|
1033
|
+
active: section === cs.id,
|
|
1034
|
+
onClick: () => setSection(cs.id),
|
|
1035
|
+
icon: cs.icon || /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.Boxes, { className: "h-4 w-4 shrink-0" }),
|
|
1036
|
+
children: cs.label
|
|
1037
|
+
},
|
|
1038
|
+
cs.id
|
|
1039
|
+
)),
|
|
1029
1040
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1030
1041
|
SideItem,
|
|
1031
1042
|
{
|
|
@@ -1103,7 +1114,10 @@ function AdminAppContent(props) {
|
|
|
1103
1114
|
!hideData && section === "submissions" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SubmissionsSection, {}),
|
|
1104
1115
|
!hideConfig && !hideGlobals && section === "config" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ConfigSection, {}),
|
|
1105
1116
|
!hideSettings && section === "settings" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SettingsSection, {}),
|
|
1106
|
-
section === "subscription" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SubscriptionPage, {})
|
|
1117
|
+
section === "subscription" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SubscriptionPage, {}),
|
|
1118
|
+
props.customSections?.map(
|
|
1119
|
+
(cs) => section === cs.id ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex-1 overflow-y-auto", children: typeof cs.component === "function" ? (0, import_react5.createElement)(cs.component) : cs.component }, cs.id) : null
|
|
1120
|
+
)
|
|
1107
1121
|
] })
|
|
1108
1122
|
] })
|
|
1109
1123
|
] });
|
|
@@ -2328,6 +2342,7 @@ function CollectionEditor({ collection }) {
|
|
|
2328
2342
|
newEntries[i].order = i;
|
|
2329
2343
|
await ctx.adapter.putEntry(collection.id, newEntries[i]);
|
|
2330
2344
|
}
|
|
2345
|
+
ctx.notifyCollectionChanged();
|
|
2331
2346
|
};
|
|
2332
2347
|
const onDragEnd = (e) => {
|
|
2333
2348
|
const target = e.target;
|
|
@@ -2430,7 +2445,7 @@ function CollectionEditor({ collection }) {
|
|
|
2430
2445
|
}
|
|
2431
2446
|
},
|
|
2432
2447
|
children: editing && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex max-h-[calc(100dvh-180px)] min-h-0 flex-col", children: [
|
|
2433
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "min-h-0 flex-1 overflow-y-auto px-6 py-5", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "grid grid-cols-1 gap-5 lg:grid-cols-2", children: collection.fields.filter((f) => f.id !== "order" && !f.hidden).map((f) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `block ${f.type === "richtext" || f.type === "branch-settings" || f.type === "time-range" ? "lg:col-span-2" : ""}`, children: [
|
|
2448
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "min-h-0 flex-1 overflow-y-auto px-6 py-5", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "grid grid-cols-1 gap-5 lg:grid-cols-2", children: collection.fields.filter((f) => f.id !== "order" && !f.hidden).map((f) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: `block ${f.type === "richtext" || f.type === "textarea" || f.type === "list" || f.type === "branch-settings" || f.type === "time-range" ? "lg:col-span-2" : ""}`, children: [
|
|
2434
2449
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "text-xs font-bold text-slate-500 uppercase tracking-wide flex items-center justify-between mb-1.5", children: [
|
|
2435
2450
|
f.label,
|
|
2436
2451
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-[10px] font-mono text-slate-300 bg-slate-50 px-1.5 py-0.5 rounded", children: f.type })
|
|
@@ -2444,15 +2459,21 @@ function CollectionEditor({ collection }) {
|
|
|
2444
2459
|
globalDiscount: Number(editing.discountPercent) || 0,
|
|
2445
2460
|
onChange: (val) => setEditing({ ...editing, [f.id]: val })
|
|
2446
2461
|
}
|
|
2447
|
-
) : f.type === "boolean" ? /* @__PURE__ */ (0, import_jsx_runtime5.
|
|
2448
|
-
"
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2462
|
+
) : f.type === "boolean" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mt-1 flex items-center gap-3", children: [
|
|
2463
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "relative inline-flex items-center cursor-pointer select-none", children: [
|
|
2464
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2465
|
+
"input",
|
|
2466
|
+
{
|
|
2467
|
+
type: "checkbox",
|
|
2468
|
+
checked: !!editing[f.id],
|
|
2469
|
+
onChange: (e) => setEditing({ ...editing, [f.id]: e.target.checked }),
|
|
2470
|
+
className: "sr-only peer"
|
|
2471
|
+
}
|
|
2472
|
+
),
|
|
2473
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "w-11 h-6 bg-slate-200 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-slate-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600" })
|
|
2474
|
+
] }),
|
|
2475
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-sm font-medium text-slate-700", children: editing[f.id] ? "Activado / S\xED" : "Desactivado / No" })
|
|
2476
|
+
] }) : f.type === "number" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2456
2477
|
FormattedNumberInput,
|
|
2457
2478
|
{
|
|
2458
2479
|
value: editing[f.id],
|
|
@@ -2493,21 +2514,22 @@ function CollectionEditor({ collection }) {
|
|
|
2493
2514
|
format: TIME_DISPLAY_FORMAT,
|
|
2494
2515
|
use12Hours: true
|
|
2495
2516
|
}
|
|
2496
|
-
) : f.type === "richtext" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2517
|
+
) : f.type === "richtext" || f.type === "textarea" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2497
2518
|
"textarea",
|
|
2498
2519
|
{
|
|
2499
2520
|
value: String(editing[f.id] ?? ""),
|
|
2500
2521
|
onChange: (e) => setEditing({ ...editing, [f.id]: e.target.value }),
|
|
2501
2522
|
rows: 4,
|
|
2502
|
-
|
|
2523
|
+
placeholder: `Escribe ${f.label.toLowerCase()}...`,
|
|
2524
|
+
className: "w-full rounded-xl border border-slate-200 px-4 py-3 text-sm shadow-sm focus:border-indigo-500 focus:ring-4 focus:ring-indigo-500/10 transition-all font-sans text-slate-800"
|
|
2503
2525
|
}
|
|
2504
2526
|
) : f.type === "icon" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2505
2527
|
SearchableSelect,
|
|
2506
2528
|
{
|
|
2507
2529
|
value: String(editing[f.id] ?? ""),
|
|
2508
2530
|
onChange: (val) => setEditing({ ...editing, [f.id]: val }),
|
|
2509
|
-
options: f.options
|
|
2510
|
-
placeholder: `
|
|
2531
|
+
options: f.options?.length ? f.options : ctx.iconMap ? Object.keys(ctx.iconMap) : [],
|
|
2532
|
+
placeholder: `Buscar icono ${f.label.toLowerCase()}...`,
|
|
2511
2533
|
iconMap: ctx.iconMap
|
|
2512
2534
|
}
|
|
2513
2535
|
) : f.type === "slug" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex gap-2", children: [
|
|
@@ -2782,34 +2804,44 @@ function CollectionEditor({ collection }) {
|
|
|
2782
2804
|
}
|
|
2783
2805
|
)
|
|
2784
2806
|
] }) : f.type === "list" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-3", children: [
|
|
2785
|
-
(Array.isArray(editing[f.id]) ? editing[f.id] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : []).map((item, idx) =>
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2807
|
+
(Array.isArray(editing[f.id]) ? editing[f.id] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : []).map((item, idx) => {
|
|
2808
|
+
const isFeatures = f.id === "features" || f.label.toLowerCase().includes("caracter\xEDstica") || f.label.toLowerCase().includes("beneficio");
|
|
2809
|
+
const placeholder = isFeatures ? `Caracter\xEDstica o beneficio ${idx + 1}...` : `Entregable o punto clave ${idx + 1}...`;
|
|
2810
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex gap-2 items-center", children: [
|
|
2811
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "text-xs font-mono font-bold text-slate-400 w-6 text-right shrink-0", children: [
|
|
2812
|
+
idx + 1,
|
|
2813
|
+
"."
|
|
2814
|
+
] }),
|
|
2815
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2816
|
+
"input",
|
|
2817
|
+
{
|
|
2818
|
+
type: "text",
|
|
2819
|
+
value: String(item ?? ""),
|
|
2820
|
+
placeholder,
|
|
2821
|
+
onChange: (e) => {
|
|
2822
|
+
let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : [];
|
|
2823
|
+
arr[idx] = e.target.value;
|
|
2824
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
2825
|
+
},
|
|
2826
|
+
className: "flex-1 rounded-xl border border-slate-200 px-4 py-2.5 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all bg-white"
|
|
2827
|
+
}
|
|
2828
|
+
),
|
|
2829
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2830
|
+
"button",
|
|
2831
|
+
{
|
|
2832
|
+
type: "button",
|
|
2833
|
+
onClick: () => {
|
|
2834
|
+
let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : [];
|
|
2835
|
+
arr.splice(idx, 1);
|
|
2836
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
2837
|
+
},
|
|
2838
|
+
className: "p-2 text-slate-400 hover:text-red-500 hover:bg-red-50 rounded-xl transition-colors cursor-pointer",
|
|
2839
|
+
title: "Eliminar elemento",
|
|
2840
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.Trash2, { className: "w-4 h-4" })
|
|
2841
|
+
}
|
|
2842
|
+
)
|
|
2843
|
+
] }, idx);
|
|
2844
|
+
}),
|
|
2813
2845
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2814
2846
|
"button",
|
|
2815
2847
|
{
|
|
@@ -2819,10 +2851,11 @@ function CollectionEditor({ collection }) {
|
|
|
2819
2851
|
arr.push("");
|
|
2820
2852
|
setEditing({ ...editing, [f.id]: arr });
|
|
2821
2853
|
},
|
|
2822
|
-
className: "inline-flex items-center gap-1.5 px-3 py-2 bg-indigo-50 hover:bg-indigo-100 text-indigo-700 text-xs font-
|
|
2854
|
+
className: "inline-flex items-center gap-1.5 px-3.5 py-2 bg-indigo-50 hover:bg-indigo-100 text-indigo-700 text-xs font-bold rounded-xl border border-indigo-100 transition-colors cursor-pointer",
|
|
2823
2855
|
children: [
|
|
2824
2856
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.Plus, { className: "w-3.5 h-3.5" }),
|
|
2825
|
-
"
|
|
2857
|
+
" ",
|
|
2858
|
+
f.id === "features" || f.label.toLowerCase().includes("caracter\xEDstica") ? "Agregar caracter\xEDstica uno a uno" : "Agregar entregable / punto uno a uno"
|
|
2826
2859
|
]
|
|
2827
2860
|
}
|
|
2828
2861
|
)
|
|
@@ -3443,79 +3476,143 @@ function Row({
|
|
|
3443
3476
|
function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
|
|
3444
3477
|
const [open, setOpen] = (0, import_react5.useState)(false);
|
|
3445
3478
|
const [search, setSearch] = (0, import_react5.useState)("");
|
|
3446
|
-
const
|
|
3447
|
-
const
|
|
3479
|
+
const btnRef = (0, import_react5.useRef)(null);
|
|
3480
|
+
const [coords, setCoords] = (0, import_react5.useState)({
|
|
3481
|
+
top: 0,
|
|
3482
|
+
left: 0,
|
|
3483
|
+
width: 250
|
|
3484
|
+
});
|
|
3485
|
+
const updateCoords = (0, import_react5.useCallback)(() => {
|
|
3486
|
+
if (btnRef.current) {
|
|
3487
|
+
const rect = btnRef.current.getBoundingClientRect();
|
|
3488
|
+
const dropdownHeight = 280;
|
|
3489
|
+
const spaceBelow = window.innerHeight - rect.bottom;
|
|
3490
|
+
const opensUp = spaceBelow < dropdownHeight && rect.top > dropdownHeight;
|
|
3491
|
+
setCoords({
|
|
3492
|
+
top: opensUp ? Math.max(10, rect.top - dropdownHeight - 6) : rect.bottom + 6,
|
|
3493
|
+
left: Math.max(10, Math.min(rect.left, window.innerWidth - rect.width - 10)),
|
|
3494
|
+
width: rect.width
|
|
3495
|
+
});
|
|
3496
|
+
}
|
|
3497
|
+
}, []);
|
|
3498
|
+
const handleToggle = () => {
|
|
3499
|
+
if (!open) {
|
|
3500
|
+
updateCoords();
|
|
3501
|
+
}
|
|
3502
|
+
setOpen((prev) => !prev);
|
|
3503
|
+
setSearch("");
|
|
3504
|
+
};
|
|
3505
|
+
(0, import_react5.useEffect)(() => {
|
|
3506
|
+
if (!open) return;
|
|
3507
|
+
const handleScrollOrResize = () => {
|
|
3508
|
+
updateCoords();
|
|
3509
|
+
};
|
|
3510
|
+
window.addEventListener("scroll", handleScrollOrResize, true);
|
|
3511
|
+
window.addEventListener("resize", handleScrollOrResize);
|
|
3512
|
+
return () => {
|
|
3513
|
+
window.removeEventListener("scroll", handleScrollOrResize, true);
|
|
3514
|
+
window.removeEventListener("resize", handleScrollOrResize);
|
|
3515
|
+
};
|
|
3516
|
+
}, [open, updateCoords]);
|
|
3517
|
+
const filtered = options.filter(
|
|
3518
|
+
(o) => o.toLowerCase().includes(search.toLowerCase())
|
|
3519
|
+
);
|
|
3520
|
+
const capped = filtered.slice(0, 100);
|
|
3448
3521
|
const SelectedIcon = iconMap && value ? iconMap[value] : null;
|
|
3449
3522
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "relative", children: [
|
|
3450
3523
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
3451
3524
|
"button",
|
|
3452
3525
|
{
|
|
3526
|
+
ref: btnRef,
|
|
3453
3527
|
type: "button",
|
|
3454
|
-
onClick:
|
|
3455
|
-
|
|
3456
|
-
setSearch("");
|
|
3457
|
-
},
|
|
3458
|
-
className: "w-full flex items-center justify-between rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm hover:border-slate-300 focus:border-indigo-500 bg-white transition-colors",
|
|
3528
|
+
onClick: handleToggle,
|
|
3529
|
+
className: "w-full flex items-center justify-between rounded-xl border border-slate-200 px-3.5 py-2.5 text-sm text-slate-800 shadow-sm hover:border-slate-300 focus:border-indigo-500 bg-white transition-colors cursor-pointer",
|
|
3459
3530
|
children: [
|
|
3460
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "flex items-center gap-2 truncate", children: [
|
|
3461
|
-
SelectedIcon && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3462
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "truncate", children: value || placeholder || "
|
|
3531
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "flex items-center gap-2.5 truncate", children: [
|
|
3532
|
+
SelectedIcon && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "w-5 h-5 flex items-center justify-center rounded bg-slate-100 text-indigo-600 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SelectedIcon, { className: "w-3.5 h-3.5" }) }),
|
|
3533
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "truncate font-medium", children: value || placeholder || "Seleccionar icono..." })
|
|
3463
3534
|
] }),
|
|
3464
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.ChevronDown, { className: `w-4 h-4 text-slate-400 transition-transform shrink-0 ${open ? "rotate-180" : ""}` })
|
|
3465
|
-
]
|
|
3466
|
-
}
|
|
3467
|
-
),
|
|
3468
|
-
open && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
3469
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "fixed inset-0 z-[100]", onClick: () => setOpen(false) }),
|
|
3470
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "absolute z-[101] mt-1 w-full rounded-xl border border-slate-200 bg-white shadow-2xl max-h-72 flex flex-col overflow-hidden animate-in fade-in slide-in-from-top-1 duration-150", children: [
|
|
3471
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "p-2 border-b border-slate-100 flex items-center gap-2", children: [
|
|
3472
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.Search, { className: "w-4 h-4 text-slate-400 shrink-0" }),
|
|
3473
3535
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3474
|
-
|
|
3536
|
+
import_lucide_react2.ChevronDown,
|
|
3475
3537
|
{
|
|
3476
|
-
|
|
3477
|
-
type: "text",
|
|
3478
|
-
className: "w-full text-sm outline-none bg-transparent text-slate-800 placeholder:text-slate-400",
|
|
3479
|
-
placeholder: "Type to search\u2026",
|
|
3480
|
-
value: search,
|
|
3481
|
-
onChange: (e) => setSearch(e.target.value)
|
|
3538
|
+
className: `w-4 h-4 text-slate-400 transition-transform shrink-0 ${open ? "rotate-180" : ""}`
|
|
3482
3539
|
}
|
|
3483
|
-
)
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3540
|
+
)
|
|
3541
|
+
]
|
|
3542
|
+
}
|
|
3543
|
+
),
|
|
3544
|
+
open && typeof document !== "undefined" && (0, import_react_dom.createPortal)(
|
|
3545
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
3546
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3547
|
+
"div",
|
|
3548
|
+
{
|
|
3549
|
+
className: "fixed inset-0 z-[99998] cursor-default",
|
|
3550
|
+
onClick: () => setOpen(false)
|
|
3551
|
+
}
|
|
3552
|
+
),
|
|
3553
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
3554
|
+
"div",
|
|
3555
|
+
{
|
|
3556
|
+
style: {
|
|
3557
|
+
position: "fixed",
|
|
3558
|
+
top: `${coords.top}px`,
|
|
3559
|
+
left: `${coords.left}px`,
|
|
3560
|
+
width: `${coords.width}px`
|
|
3561
|
+
},
|
|
3562
|
+
className: "z-[99999] rounded-2xl border border-slate-200 bg-white shadow-2xl max-h-72 flex flex-col overflow-hidden animate-in fade-in zoom-in-95 duration-150",
|
|
3563
|
+
children: [
|
|
3564
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "p-2.5 border-b border-slate-100 flex items-center gap-2 bg-slate-50/50", children: [
|
|
3565
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.Search, { className: "w-4 h-4 text-slate-400 shrink-0" }),
|
|
3566
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3567
|
+
"input",
|
|
3568
|
+
{
|
|
3569
|
+
autoFocus: true,
|
|
3570
|
+
type: "text",
|
|
3571
|
+
className: "w-full text-sm outline-none bg-transparent text-slate-800 placeholder:text-slate-400",
|
|
3572
|
+
placeholder: "Buscar icono por nombre (ej: LuCode, LuServer)...",
|
|
3573
|
+
value: search,
|
|
3574
|
+
onChange: (e) => setSearch(e.target.value)
|
|
3575
|
+
}
|
|
3576
|
+
),
|
|
3577
|
+
search && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-[10px] font-bold text-slate-400 bg-slate-200 px-1.5 py-0.5 rounded-full shrink-0 tabular-nums", children: filtered.length })
|
|
3578
|
+
] }),
|
|
3579
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "overflow-y-auto flex-1 p-1.5", children: [
|
|
3580
|
+
filtered.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "p-4 text-xs text-slate-500 text-center", children: [
|
|
3581
|
+
'No se encontraron iconos para "',
|
|
3582
|
+
search,
|
|
3583
|
+
'"'
|
|
3584
|
+
] }),
|
|
3585
|
+
capped.map((opt) => {
|
|
3586
|
+
const OptIcon = iconMap ? iconMap[opt] : null;
|
|
3587
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
3588
|
+
"button",
|
|
3589
|
+
{
|
|
3590
|
+
type: "button",
|
|
3591
|
+
className: `w-full flex items-center gap-2.5 text-left px-2.5 py-2 text-sm rounded-xl transition-colors cursor-pointer ${value === opt ? "bg-indigo-50 text-indigo-700 font-semibold" : "text-slate-700 hover:bg-slate-50"}`,
|
|
3592
|
+
onClick: () => {
|
|
3593
|
+
onChange(opt);
|
|
3594
|
+
setOpen(false);
|
|
3595
|
+
},
|
|
3596
|
+
children: [
|
|
3597
|
+
OptIcon && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "w-6 h-6 flex items-center justify-center rounded-lg bg-slate-100 text-indigo-600 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OptIcon, { className: "w-4 h-4" }) }),
|
|
3598
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "truncate", children: opt })
|
|
3599
|
+
]
|
|
3600
|
+
},
|
|
3601
|
+
opt
|
|
3602
|
+
);
|
|
3603
|
+
}),
|
|
3604
|
+
filtered.length > 100 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "px-3 py-2 text-[10px] text-slate-400 text-center border-t border-slate-100 mt-1", children: [
|
|
3605
|
+
"Mostrando 100 de ",
|
|
3606
|
+
filtered.length,
|
|
3607
|
+
" \u2014 escribe en el buscador para filtrar"
|
|
3608
|
+
] })
|
|
3609
|
+
] })
|
|
3610
|
+
]
|
|
3611
|
+
}
|
|
3612
|
+
)
|
|
3613
|
+
] }),
|
|
3614
|
+
document.body
|
|
3615
|
+
)
|
|
3519
3616
|
] });
|
|
3520
3617
|
}
|
|
3521
3618
|
function PasswordField({ value, onChange }) {
|