admin-lib-cms 1.2.2 → 1.2.3
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 +212 -128
- package/dist/index.mjs +214 -129
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1372,6 +1372,8 @@ function FieldEditor({
|
|
|
1372
1372
|
const ctx = useCmsContext();
|
|
1373
1373
|
const [expandedItems, setExpandedItems] = (0, import_react5.useState)({});
|
|
1374
1374
|
const [searchQuery, setSearchQuery] = (0, import_react5.useState)("");
|
|
1375
|
+
const [listDragIdx, setListDragIdx] = (0, import_react5.useState)(null);
|
|
1376
|
+
const [listDragOverIdx, setListDragOverIdx] = (0, import_react5.useState)(null);
|
|
1375
1377
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "p-5 animate-in slide-in-from-right-4 duration-200", children: [
|
|
1376
1378
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mb-5", children: [
|
|
1377
1379
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "inline-flex items-center gap-1.5 px-2 py-1 rounded bg-indigo-50 text-indigo-700 text-[10px] font-bold uppercase tracking-wider mb-2", children: meta.type }),
|
|
@@ -1561,163 +1563,245 @@ function FieldEditor({
|
|
|
1561
1563
|
if (!title.includes(searchQuery.toLowerCase())) return null;
|
|
1562
1564
|
}
|
|
1563
1565
|
const isExpanded = expandedItems[idx] ?? false;
|
|
1564
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1567
|
+
"div",
|
|
1568
|
+
{
|
|
1569
|
+
draggable: true,
|
|
1570
|
+
onDragStart: (e) => {
|
|
1571
|
+
setListDragIdx(idx);
|
|
1572
|
+
e.dataTransfer.effectAllowed = "move";
|
|
1573
|
+
},
|
|
1574
|
+
onDragOver: (e) => {
|
|
1575
|
+
e.preventDefault();
|
|
1576
|
+
e.dataTransfer.dropEffect = "move";
|
|
1577
|
+
setListDragOverIdx(idx);
|
|
1578
|
+
},
|
|
1579
|
+
onDragEnd: () => {
|
|
1580
|
+
setListDragIdx(null);
|
|
1581
|
+
setListDragOverIdx(null);
|
|
1582
|
+
},
|
|
1583
|
+
onDrop: (e) => {
|
|
1584
|
+
e.preventDefault();
|
|
1585
|
+
if (listDragIdx === null || listDragIdx === idx) {
|
|
1586
|
+
setListDragOverIdx(null);
|
|
1587
|
+
return;
|
|
1575
1588
|
}
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
const arr = Array.isArray(value) ? [...value] : [];
|
|
1588
|
-
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: val };
|
|
1589
|
-
onChange(arr);
|
|
1590
|
-
}
|
|
1591
|
-
}
|
|
1592
|
-
) : schemaField.type === "textarea" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1593
|
-
"textarea",
|
|
1589
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1590
|
+
const [moved] = arr.splice(listDragIdx, 1);
|
|
1591
|
+
arr.splice(idx, 0, moved);
|
|
1592
|
+
onChange(arr);
|
|
1593
|
+
setListDragIdx(null);
|
|
1594
|
+
setListDragOverIdx(null);
|
|
1595
|
+
},
|
|
1596
|
+
className: `bg-slate-50 p-3 rounded-xl border transition-all relative group ${listDragOverIdx === idx ? "border-indigo-500 border-2 bg-indigo-50/40" : "border-slate-200 hover:border-slate-300"} ${listDragIdx === idx ? "opacity-40" : ""}`,
|
|
1597
|
+
children: [
|
|
1598
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1599
|
+
"div",
|
|
1594
1600
|
{
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1601
|
+
className: "absolute left-3 top-3.5 z-10 flex items-center gap-1 text-slate-400 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none group-hover:pointer-events-auto select-none",
|
|
1602
|
+
title: "Drag or use arrows to reorder",
|
|
1603
|
+
children: [
|
|
1604
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.GripVertical, { className: "w-4 h-4 cursor-grab active:cursor-grabbing hover:text-indigo-600" }),
|
|
1605
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1606
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1607
|
+
"button",
|
|
1608
|
+
{
|
|
1609
|
+
type: "button",
|
|
1610
|
+
disabled: idx === 0,
|
|
1611
|
+
onClick: (e) => {
|
|
1612
|
+
e.stopPropagation();
|
|
1613
|
+
if (idx === 0) return;
|
|
1614
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1615
|
+
const [moved] = arr.splice(idx, 1);
|
|
1616
|
+
arr.splice(idx - 1, 0, moved);
|
|
1617
|
+
onChange(arr);
|
|
1618
|
+
},
|
|
1619
|
+
className: "p-0.5 hover:text-indigo-600 disabled:opacity-20 transition-colors",
|
|
1620
|
+
title: "Move Up",
|
|
1621
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.ChevronUp, { className: "w-3.5 h-3.5" })
|
|
1622
|
+
}
|
|
1623
|
+
),
|
|
1624
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1625
|
+
"button",
|
|
1626
|
+
{
|
|
1627
|
+
type: "button",
|
|
1628
|
+
disabled: idx === (Array.isArray(value) ? value.length - 1 : 0),
|
|
1629
|
+
onClick: (e) => {
|
|
1630
|
+
e.stopPropagation();
|
|
1631
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1632
|
+
if (idx >= arr.length - 1) return;
|
|
1633
|
+
const [moved] = arr.splice(idx, 1);
|
|
1634
|
+
arr.splice(idx + 1, 0, moved);
|
|
1635
|
+
onChange(arr);
|
|
1636
|
+
},
|
|
1637
|
+
className: "p-0.5 hover:text-indigo-600 disabled:opacity-20 transition-colors",
|
|
1638
|
+
title: "Move Down",
|
|
1639
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.ChevronDown, { className: "w-3.5 h-3.5" })
|
|
1640
|
+
}
|
|
1641
|
+
)
|
|
1642
|
+
] })
|
|
1643
|
+
]
|
|
1603
1644
|
}
|
|
1604
|
-
)
|
|
1605
|
-
|
|
1606
|
-
|
|
1645
|
+
),
|
|
1646
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-3 w-full min-w-0", children: [
|
|
1647
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1648
|
+
"div",
|
|
1607
1649
|
{
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
},
|
|
1615
|
-
className: "w-4 h-4 text-indigo-600 border-slate-300 rounded focus:ring-indigo-500"
|
|
1650
|
+
className: "flex items-center justify-between cursor-pointer py-1 select-none",
|
|
1651
|
+
onClick: () => setExpandedItems((prev) => ({ ...prev, [idx]: !isExpanded })),
|
|
1652
|
+
children: [
|
|
1653
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "font-semibold text-slate-700 text-sm flex-1 truncate pr-6 pl-0.5 group-hover:pl-20 transition-all duration-200", children: meta.itemSchema ? item?.title || item?.name || `Item ${idx + 1}` : String(item) }),
|
|
1654
|
+
isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.ChevronUp, { className: "w-4 h-4 text-slate-500 shrink-0" }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.ChevronDown, { className: "w-4 h-4 text-slate-500 shrink-0" })
|
|
1655
|
+
]
|
|
1616
1656
|
}
|
|
1617
1657
|
),
|
|
1618
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
"input",
|
|
1658
|
+
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "pt-3 border-t border-slate-200 mt-2 space-y-3", children: meta.itemSchema ? meta.itemSchema.map((schemaField) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
1659
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { className: "block text-[10px] font-bold text-slate-500 uppercase mb-1", children: schemaField.label || schemaField.key }),
|
|
1660
|
+
schemaField.type === "icon" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1661
|
+
SearchableSelect,
|
|
1623
1662
|
{
|
|
1624
|
-
|
|
1663
|
+
value: String(item?.[schemaField.key] ?? ""),
|
|
1664
|
+
options: schemaField.options ?? [],
|
|
1665
|
+
placeholder: "Search icon...",
|
|
1666
|
+
iconMap: ctx.iconMap,
|
|
1667
|
+
onChange: (val) => {
|
|
1668
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1669
|
+
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: val };
|
|
1670
|
+
onChange(arr);
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
) : schemaField.type === "textarea" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1674
|
+
"textarea",
|
|
1675
|
+
{
|
|
1676
|
+
rows: 3,
|
|
1625
1677
|
value: String(item?.[schemaField.key] ?? ""),
|
|
1626
1678
|
onChange: (e) => {
|
|
1627
1679
|
const arr = Array.isArray(value) ? [...value] : [];
|
|
1628
1680
|
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
|
|
1629
1681
|
onChange(arr);
|
|
1630
1682
|
},
|
|
1631
|
-
placeholder: "https://...",
|
|
1632
1683
|
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
1633
1684
|
}
|
|
1634
|
-
),
|
|
1635
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "flex-shrink-0 cursor-pointer rounded-lg bg-slate-100 px-3 py-2 text-sm font-medium text-slate-700 hover:bg-slate-200 transition-colors border border-slate-200 flex items-center justify-center", children: [
|
|
1636
|
-
"Upload",
|
|
1685
|
+
) : schemaField.type === "boolean" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "flex items-center gap-2 mt-1 cursor-pointer", children: [
|
|
1637
1686
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1638
1687
|
"input",
|
|
1639
1688
|
{
|
|
1640
|
-
type: "
|
|
1641
|
-
|
|
1642
|
-
className: "hidden",
|
|
1689
|
+
type: "checkbox",
|
|
1690
|
+
checked: !!item?.[schemaField.key],
|
|
1643
1691
|
onChange: (e) => {
|
|
1644
|
-
const
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1692
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1693
|
+
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.checked };
|
|
1694
|
+
onChange(arr);
|
|
1695
|
+
},
|
|
1696
|
+
className: "w-4 h-4 text-indigo-600 border-slate-300 rounded focus:ring-indigo-500"
|
|
1697
|
+
}
|
|
1698
|
+
),
|
|
1699
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-sm text-slate-700", children: schemaField.label || schemaField.key })
|
|
1700
|
+
] }) : schemaField.type === "image" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-3 mt-1", children: [
|
|
1701
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex gap-2", children: [
|
|
1702
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1703
|
+
"input",
|
|
1704
|
+
{
|
|
1705
|
+
type: "url",
|
|
1706
|
+
value: String(item?.[schemaField.key] ?? ""),
|
|
1707
|
+
onChange: (e) => {
|
|
1708
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1709
|
+
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
|
|
1710
|
+
onChange(arr);
|
|
1711
|
+
},
|
|
1712
|
+
placeholder: "https://...",
|
|
1713
|
+
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
1656
1714
|
}
|
|
1715
|
+
),
|
|
1716
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "flex-shrink-0 cursor-pointer rounded-lg bg-slate-100 px-3 py-2 text-sm font-medium text-slate-700 hover:bg-slate-200 transition-colors border border-slate-200 flex items-center justify-center", children: [
|
|
1717
|
+
"Upload",
|
|
1718
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1719
|
+
"input",
|
|
1720
|
+
{
|
|
1721
|
+
type: "file",
|
|
1722
|
+
accept: "image/*",
|
|
1723
|
+
className: "hidden",
|
|
1724
|
+
onChange: (e) => {
|
|
1725
|
+
const file = e.target.files?.[0];
|
|
1726
|
+
if (file) {
|
|
1727
|
+
void handleImageFile(
|
|
1728
|
+
file,
|
|
1729
|
+
(url) => {
|
|
1730
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1731
|
+
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: url };
|
|
1732
|
+
onChange(arr);
|
|
1733
|
+
},
|
|
1734
|
+
ctx.uploadImage
|
|
1735
|
+
);
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
)
|
|
1740
|
+
] })
|
|
1741
|
+
] }),
|
|
1742
|
+
item?.[schemaField.key] ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "rounded-lg border border-slate-200 p-1 bg-slate-50 overflow-hidden relative group max-w-xs", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1743
|
+
"img",
|
|
1744
|
+
{
|
|
1745
|
+
src: String(item?.[schemaField.key]),
|
|
1746
|
+
alt: "",
|
|
1747
|
+
className: "w-full h-auto max-h-32 object-contain rounded-md"
|
|
1657
1748
|
}
|
|
1658
|
-
)
|
|
1659
|
-
] })
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1749
|
+
) }) : null
|
|
1750
|
+
] }) : schemaField.type === "select" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1751
|
+
"select",
|
|
1752
|
+
{
|
|
1753
|
+
value: String(item?.[schemaField.key] ?? ""),
|
|
1754
|
+
onChange: (e) => {
|
|
1755
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1756
|
+
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
|
|
1757
|
+
onChange(arr);
|
|
1758
|
+
},
|
|
1759
|
+
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20 bg-white",
|
|
1760
|
+
children: schemaField.options?.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: opt, children: opt }, opt))
|
|
1761
|
+
}
|
|
1762
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1763
|
+
"input",
|
|
1764
|
+
{
|
|
1765
|
+
type: "text",
|
|
1766
|
+
value: String(item?.[schemaField.key] ?? ""),
|
|
1767
|
+
onChange: (e) => {
|
|
1768
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1769
|
+
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
|
|
1770
|
+
onChange(arr);
|
|
1771
|
+
},
|
|
1772
|
+
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
1773
|
+
}
|
|
1774
|
+
)
|
|
1775
|
+
] }, schemaField.key)) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1776
|
+
"input",
|
|
1663
1777
|
{
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1778
|
+
type: "text",
|
|
1779
|
+
value: String(item),
|
|
1780
|
+
onChange: (e) => {
|
|
1781
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1782
|
+
arr[idx] = e.target.value;
|
|
1783
|
+
onChange(arr);
|
|
1784
|
+
},
|
|
1785
|
+
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
1667
1786
|
}
|
|
1668
|
-
) })
|
|
1669
|
-
] })
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
value: String(item?.[schemaField.key] ?? ""),
|
|
1673
|
-
onChange: (e) => {
|
|
1674
|
-
const arr = Array.isArray(value) ? [...value] : [];
|
|
1675
|
-
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
|
|
1676
|
-
onChange(arr);
|
|
1677
|
-
},
|
|
1678
|
-
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20 bg-white",
|
|
1679
|
-
children: schemaField.options?.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: opt, children: opt }, opt))
|
|
1680
|
-
}
|
|
1681
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1682
|
-
"input",
|
|
1787
|
+
) })
|
|
1788
|
+
] }),
|
|
1789
|
+
!meta.fixedLength && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1790
|
+
"button",
|
|
1683
1791
|
{
|
|
1684
|
-
|
|
1685
|
-
value: String(item?.[schemaField.key] ?? ""),
|
|
1686
|
-
onChange: (e) => {
|
|
1792
|
+
onClick: () => {
|
|
1687
1793
|
const arr = Array.isArray(value) ? [...value] : [];
|
|
1688
|
-
arr
|
|
1794
|
+
arr.splice(idx, 1);
|
|
1689
1795
|
onChange(arr);
|
|
1690
1796
|
},
|
|
1691
|
-
className: "
|
|
1797
|
+
className: "p-1.5 text-slate-400 hover:text-red-500 hover:bg-red-50 rounded-lg transition-colors absolute top-2 right-2 opacity-0 group-hover:opacity-100",
|
|
1798
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.Trash2, { className: "w-4 h-4" })
|
|
1692
1799
|
}
|
|
1693
1800
|
)
|
|
1694
|
-
]
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
value: String(item),
|
|
1699
|
-
onChange: (e) => {
|
|
1700
|
-
const arr = Array.isArray(value) ? [...value] : [];
|
|
1701
|
-
arr[idx] = e.target.value;
|
|
1702
|
-
onChange(arr);
|
|
1703
|
-
},
|
|
1704
|
-
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
1705
|
-
}
|
|
1706
|
-
) })
|
|
1707
|
-
] }),
|
|
1708
|
-
!meta.fixedLength && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1709
|
-
"button",
|
|
1710
|
-
{
|
|
1711
|
-
onClick: () => {
|
|
1712
|
-
const arr = Array.isArray(value) ? [...value] : [];
|
|
1713
|
-
arr.splice(idx, 1);
|
|
1714
|
-
onChange(arr);
|
|
1715
|
-
},
|
|
1716
|
-
className: "p-1.5 text-slate-400 hover:text-red-500 hover:bg-red-50 rounded-lg transition-colors absolute top-2 right-2 opacity-0 group-hover:opacity-100",
|
|
1717
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.Trash2, { className: "w-4 h-4" })
|
|
1718
|
-
}
|
|
1719
|
-
)
|
|
1720
|
-
] }, idx);
|
|
1801
|
+
]
|
|
1802
|
+
},
|
|
1803
|
+
idx
|
|
1804
|
+
);
|
|
1721
1805
|
}),
|
|
1722
1806
|
!meta.fixedLength && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1723
1807
|
"button",
|
package/dist/index.mjs
CHANGED
|
@@ -736,7 +736,8 @@ import {
|
|
|
736
736
|
SlidersHorizontal,
|
|
737
737
|
LogOut,
|
|
738
738
|
ExternalLink as ExternalLink2,
|
|
739
|
-
Check
|
|
739
|
+
Check,
|
|
740
|
+
GripVertical
|
|
740
741
|
} from "lucide-react";
|
|
741
742
|
import { CreditCard as CreditCard2 } from "lucide-react";
|
|
742
743
|
import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
@@ -1371,6 +1372,8 @@ function FieldEditor({
|
|
|
1371
1372
|
const ctx = useCmsContext();
|
|
1372
1373
|
const [expandedItems, setExpandedItems] = useState5({});
|
|
1373
1374
|
const [searchQuery, setSearchQuery] = useState5("");
|
|
1375
|
+
const [listDragIdx, setListDragIdx] = useState5(null);
|
|
1376
|
+
const [listDragOverIdx, setListDragOverIdx] = useState5(null);
|
|
1374
1377
|
return /* @__PURE__ */ jsxs4("div", { className: "p-5 animate-in slide-in-from-right-4 duration-200", children: [
|
|
1375
1378
|
/* @__PURE__ */ jsxs4("div", { className: "mb-5", children: [
|
|
1376
1379
|
/* @__PURE__ */ jsx5("div", { className: "inline-flex items-center gap-1.5 px-2 py-1 rounded bg-indigo-50 text-indigo-700 text-[10px] font-bold uppercase tracking-wider mb-2", children: meta.type }),
|
|
@@ -1560,163 +1563,245 @@ function FieldEditor({
|
|
|
1560
1563
|
if (!title.includes(searchQuery.toLowerCase())) return null;
|
|
1561
1564
|
}
|
|
1562
1565
|
const isExpanded = expandedItems[idx] ?? false;
|
|
1563
|
-
return /* @__PURE__ */ jsxs4(
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1566
|
+
return /* @__PURE__ */ jsxs4(
|
|
1567
|
+
"div",
|
|
1568
|
+
{
|
|
1569
|
+
draggable: true,
|
|
1570
|
+
onDragStart: (e) => {
|
|
1571
|
+
setListDragIdx(idx);
|
|
1572
|
+
e.dataTransfer.effectAllowed = "move";
|
|
1573
|
+
},
|
|
1574
|
+
onDragOver: (e) => {
|
|
1575
|
+
e.preventDefault();
|
|
1576
|
+
e.dataTransfer.dropEffect = "move";
|
|
1577
|
+
setListDragOverIdx(idx);
|
|
1578
|
+
},
|
|
1579
|
+
onDragEnd: () => {
|
|
1580
|
+
setListDragIdx(null);
|
|
1581
|
+
setListDragOverIdx(null);
|
|
1582
|
+
},
|
|
1583
|
+
onDrop: (e) => {
|
|
1584
|
+
e.preventDefault();
|
|
1585
|
+
if (listDragIdx === null || listDragIdx === idx) {
|
|
1586
|
+
setListDragOverIdx(null);
|
|
1587
|
+
return;
|
|
1574
1588
|
}
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
const arr = Array.isArray(value) ? [...value] : [];
|
|
1587
|
-
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: val };
|
|
1588
|
-
onChange(arr);
|
|
1589
|
-
}
|
|
1590
|
-
}
|
|
1591
|
-
) : schemaField.type === "textarea" ? /* @__PURE__ */ jsx5(
|
|
1592
|
-
"textarea",
|
|
1589
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1590
|
+
const [moved] = arr.splice(listDragIdx, 1);
|
|
1591
|
+
arr.splice(idx, 0, moved);
|
|
1592
|
+
onChange(arr);
|
|
1593
|
+
setListDragIdx(null);
|
|
1594
|
+
setListDragOverIdx(null);
|
|
1595
|
+
},
|
|
1596
|
+
className: `bg-slate-50 p-3 rounded-xl border transition-all relative group ${listDragOverIdx === idx ? "border-indigo-500 border-2 bg-indigo-50/40" : "border-slate-200 hover:border-slate-300"} ${listDragIdx === idx ? "opacity-40" : ""}`,
|
|
1597
|
+
children: [
|
|
1598
|
+
/* @__PURE__ */ jsxs4(
|
|
1599
|
+
"div",
|
|
1593
1600
|
{
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1601
|
+
className: "absolute left-3 top-3.5 z-10 flex items-center gap-1 text-slate-400 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none group-hover:pointer-events-auto select-none",
|
|
1602
|
+
title: "Drag or use arrows to reorder",
|
|
1603
|
+
children: [
|
|
1604
|
+
/* @__PURE__ */ jsx5(GripVertical, { className: "w-4 h-4 cursor-grab active:cursor-grabbing hover:text-indigo-600" }),
|
|
1605
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1", children: [
|
|
1606
|
+
/* @__PURE__ */ jsx5(
|
|
1607
|
+
"button",
|
|
1608
|
+
{
|
|
1609
|
+
type: "button",
|
|
1610
|
+
disabled: idx === 0,
|
|
1611
|
+
onClick: (e) => {
|
|
1612
|
+
e.stopPropagation();
|
|
1613
|
+
if (idx === 0) return;
|
|
1614
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1615
|
+
const [moved] = arr.splice(idx, 1);
|
|
1616
|
+
arr.splice(idx - 1, 0, moved);
|
|
1617
|
+
onChange(arr);
|
|
1618
|
+
},
|
|
1619
|
+
className: "p-0.5 hover:text-indigo-600 disabled:opacity-20 transition-colors",
|
|
1620
|
+
title: "Move Up",
|
|
1621
|
+
children: /* @__PURE__ */ jsx5(ChevronUp, { className: "w-3.5 h-3.5" })
|
|
1622
|
+
}
|
|
1623
|
+
),
|
|
1624
|
+
/* @__PURE__ */ jsx5(
|
|
1625
|
+
"button",
|
|
1626
|
+
{
|
|
1627
|
+
type: "button",
|
|
1628
|
+
disabled: idx === (Array.isArray(value) ? value.length - 1 : 0),
|
|
1629
|
+
onClick: (e) => {
|
|
1630
|
+
e.stopPropagation();
|
|
1631
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1632
|
+
if (idx >= arr.length - 1) return;
|
|
1633
|
+
const [moved] = arr.splice(idx, 1);
|
|
1634
|
+
arr.splice(idx + 1, 0, moved);
|
|
1635
|
+
onChange(arr);
|
|
1636
|
+
},
|
|
1637
|
+
className: "p-0.5 hover:text-indigo-600 disabled:opacity-20 transition-colors",
|
|
1638
|
+
title: "Move Down",
|
|
1639
|
+
children: /* @__PURE__ */ jsx5(ChevronDown, { className: "w-3.5 h-3.5" })
|
|
1640
|
+
}
|
|
1641
|
+
)
|
|
1642
|
+
] })
|
|
1643
|
+
]
|
|
1602
1644
|
}
|
|
1603
|
-
)
|
|
1604
|
-
|
|
1605
|
-
|
|
1645
|
+
),
|
|
1646
|
+
/* @__PURE__ */ jsxs4("div", { className: "space-y-3 w-full min-w-0", children: [
|
|
1647
|
+
/* @__PURE__ */ jsxs4(
|
|
1648
|
+
"div",
|
|
1606
1649
|
{
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
},
|
|
1614
|
-
className: "w-4 h-4 text-indigo-600 border-slate-300 rounded focus:ring-indigo-500"
|
|
1650
|
+
className: "flex items-center justify-between cursor-pointer py-1 select-none",
|
|
1651
|
+
onClick: () => setExpandedItems((prev) => ({ ...prev, [idx]: !isExpanded })),
|
|
1652
|
+
children: [
|
|
1653
|
+
/* @__PURE__ */ jsx5("div", { className: "font-semibold text-slate-700 text-sm flex-1 truncate pr-6 pl-0.5 group-hover:pl-20 transition-all duration-200", children: meta.itemSchema ? item?.title || item?.name || `Item ${idx + 1}` : String(item) }),
|
|
1654
|
+
isExpanded ? /* @__PURE__ */ jsx5(ChevronUp, { className: "w-4 h-4 text-slate-500 shrink-0" }) : /* @__PURE__ */ jsx5(ChevronDown, { className: "w-4 h-4 text-slate-500 shrink-0" })
|
|
1655
|
+
]
|
|
1615
1656
|
}
|
|
1616
1657
|
),
|
|
1617
|
-
/* @__PURE__ */ jsx5("
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
"input",
|
|
1658
|
+
isExpanded && /* @__PURE__ */ jsx5("div", { className: "pt-3 border-t border-slate-200 mt-2 space-y-3", children: meta.itemSchema ? meta.itemSchema.map((schemaField) => /* @__PURE__ */ jsxs4("div", { children: [
|
|
1659
|
+
/* @__PURE__ */ jsx5("label", { className: "block text-[10px] font-bold text-slate-500 uppercase mb-1", children: schemaField.label || schemaField.key }),
|
|
1660
|
+
schemaField.type === "icon" ? /* @__PURE__ */ jsx5(
|
|
1661
|
+
SearchableSelect,
|
|
1622
1662
|
{
|
|
1623
|
-
|
|
1663
|
+
value: String(item?.[schemaField.key] ?? ""),
|
|
1664
|
+
options: schemaField.options ?? [],
|
|
1665
|
+
placeholder: "Search icon...",
|
|
1666
|
+
iconMap: ctx.iconMap,
|
|
1667
|
+
onChange: (val) => {
|
|
1668
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1669
|
+
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: val };
|
|
1670
|
+
onChange(arr);
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
) : schemaField.type === "textarea" ? /* @__PURE__ */ jsx5(
|
|
1674
|
+
"textarea",
|
|
1675
|
+
{
|
|
1676
|
+
rows: 3,
|
|
1624
1677
|
value: String(item?.[schemaField.key] ?? ""),
|
|
1625
1678
|
onChange: (e) => {
|
|
1626
1679
|
const arr = Array.isArray(value) ? [...value] : [];
|
|
1627
1680
|
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
|
|
1628
1681
|
onChange(arr);
|
|
1629
1682
|
},
|
|
1630
|
-
placeholder: "https://...",
|
|
1631
1683
|
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
1632
1684
|
}
|
|
1633
|
-
),
|
|
1634
|
-
/* @__PURE__ */ jsxs4("label", { className: "flex-shrink-0 cursor-pointer rounded-lg bg-slate-100 px-3 py-2 text-sm font-medium text-slate-700 hover:bg-slate-200 transition-colors border border-slate-200 flex items-center justify-center", children: [
|
|
1635
|
-
"Upload",
|
|
1685
|
+
) : schemaField.type === "boolean" ? /* @__PURE__ */ jsxs4("label", { className: "flex items-center gap-2 mt-1 cursor-pointer", children: [
|
|
1636
1686
|
/* @__PURE__ */ jsx5(
|
|
1637
1687
|
"input",
|
|
1638
1688
|
{
|
|
1639
|
-
type: "
|
|
1640
|
-
|
|
1641
|
-
className: "hidden",
|
|
1689
|
+
type: "checkbox",
|
|
1690
|
+
checked: !!item?.[schemaField.key],
|
|
1642
1691
|
onChange: (e) => {
|
|
1643
|
-
const
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1692
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1693
|
+
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.checked };
|
|
1694
|
+
onChange(arr);
|
|
1695
|
+
},
|
|
1696
|
+
className: "w-4 h-4 text-indigo-600 border-slate-300 rounded focus:ring-indigo-500"
|
|
1697
|
+
}
|
|
1698
|
+
),
|
|
1699
|
+
/* @__PURE__ */ jsx5("span", { className: "text-sm text-slate-700", children: schemaField.label || schemaField.key })
|
|
1700
|
+
] }) : schemaField.type === "image" ? /* @__PURE__ */ jsxs4("div", { className: "space-y-3 mt-1", children: [
|
|
1701
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
|
|
1702
|
+
/* @__PURE__ */ jsx5(
|
|
1703
|
+
"input",
|
|
1704
|
+
{
|
|
1705
|
+
type: "url",
|
|
1706
|
+
value: String(item?.[schemaField.key] ?? ""),
|
|
1707
|
+
onChange: (e) => {
|
|
1708
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1709
|
+
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
|
|
1710
|
+
onChange(arr);
|
|
1711
|
+
},
|
|
1712
|
+
placeholder: "https://...",
|
|
1713
|
+
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
1655
1714
|
}
|
|
1715
|
+
),
|
|
1716
|
+
/* @__PURE__ */ jsxs4("label", { className: "flex-shrink-0 cursor-pointer rounded-lg bg-slate-100 px-3 py-2 text-sm font-medium text-slate-700 hover:bg-slate-200 transition-colors border border-slate-200 flex items-center justify-center", children: [
|
|
1717
|
+
"Upload",
|
|
1718
|
+
/* @__PURE__ */ jsx5(
|
|
1719
|
+
"input",
|
|
1720
|
+
{
|
|
1721
|
+
type: "file",
|
|
1722
|
+
accept: "image/*",
|
|
1723
|
+
className: "hidden",
|
|
1724
|
+
onChange: (e) => {
|
|
1725
|
+
const file = e.target.files?.[0];
|
|
1726
|
+
if (file) {
|
|
1727
|
+
void handleImageFile(
|
|
1728
|
+
file,
|
|
1729
|
+
(url) => {
|
|
1730
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1731
|
+
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: url };
|
|
1732
|
+
onChange(arr);
|
|
1733
|
+
},
|
|
1734
|
+
ctx.uploadImage
|
|
1735
|
+
);
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
)
|
|
1740
|
+
] })
|
|
1741
|
+
] }),
|
|
1742
|
+
item?.[schemaField.key] ? /* @__PURE__ */ jsx5("div", { className: "rounded-lg border border-slate-200 p-1 bg-slate-50 overflow-hidden relative group max-w-xs", children: /* @__PURE__ */ jsx5(
|
|
1743
|
+
"img",
|
|
1744
|
+
{
|
|
1745
|
+
src: String(item?.[schemaField.key]),
|
|
1746
|
+
alt: "",
|
|
1747
|
+
className: "w-full h-auto max-h-32 object-contain rounded-md"
|
|
1656
1748
|
}
|
|
1657
|
-
)
|
|
1658
|
-
] })
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1749
|
+
) }) : null
|
|
1750
|
+
] }) : schemaField.type === "select" ? /* @__PURE__ */ jsx5(
|
|
1751
|
+
"select",
|
|
1752
|
+
{
|
|
1753
|
+
value: String(item?.[schemaField.key] ?? ""),
|
|
1754
|
+
onChange: (e) => {
|
|
1755
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1756
|
+
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
|
|
1757
|
+
onChange(arr);
|
|
1758
|
+
},
|
|
1759
|
+
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20 bg-white",
|
|
1760
|
+
children: schemaField.options?.map((opt) => /* @__PURE__ */ jsx5("option", { value: opt, children: opt }, opt))
|
|
1761
|
+
}
|
|
1762
|
+
) : /* @__PURE__ */ jsx5(
|
|
1763
|
+
"input",
|
|
1764
|
+
{
|
|
1765
|
+
type: "text",
|
|
1766
|
+
value: String(item?.[schemaField.key] ?? ""),
|
|
1767
|
+
onChange: (e) => {
|
|
1768
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1769
|
+
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
|
|
1770
|
+
onChange(arr);
|
|
1771
|
+
},
|
|
1772
|
+
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
1773
|
+
}
|
|
1774
|
+
)
|
|
1775
|
+
] }, schemaField.key)) : /* @__PURE__ */ jsx5(
|
|
1776
|
+
"input",
|
|
1662
1777
|
{
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1778
|
+
type: "text",
|
|
1779
|
+
value: String(item),
|
|
1780
|
+
onChange: (e) => {
|
|
1781
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1782
|
+
arr[idx] = e.target.value;
|
|
1783
|
+
onChange(arr);
|
|
1784
|
+
},
|
|
1785
|
+
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
1666
1786
|
}
|
|
1667
|
-
) })
|
|
1668
|
-
] })
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
value: String(item?.[schemaField.key] ?? ""),
|
|
1672
|
-
onChange: (e) => {
|
|
1673
|
-
const arr = Array.isArray(value) ? [...value] : [];
|
|
1674
|
-
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
|
|
1675
|
-
onChange(arr);
|
|
1676
|
-
},
|
|
1677
|
-
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20 bg-white",
|
|
1678
|
-
children: schemaField.options?.map((opt) => /* @__PURE__ */ jsx5("option", { value: opt, children: opt }, opt))
|
|
1679
|
-
}
|
|
1680
|
-
) : /* @__PURE__ */ jsx5(
|
|
1681
|
-
"input",
|
|
1787
|
+
) })
|
|
1788
|
+
] }),
|
|
1789
|
+
!meta.fixedLength && /* @__PURE__ */ jsx5(
|
|
1790
|
+
"button",
|
|
1682
1791
|
{
|
|
1683
|
-
|
|
1684
|
-
value: String(item?.[schemaField.key] ?? ""),
|
|
1685
|
-
onChange: (e) => {
|
|
1792
|
+
onClick: () => {
|
|
1686
1793
|
const arr = Array.isArray(value) ? [...value] : [];
|
|
1687
|
-
arr
|
|
1794
|
+
arr.splice(idx, 1);
|
|
1688
1795
|
onChange(arr);
|
|
1689
1796
|
},
|
|
1690
|
-
className: "
|
|
1797
|
+
className: "p-1.5 text-slate-400 hover:text-red-500 hover:bg-red-50 rounded-lg transition-colors absolute top-2 right-2 opacity-0 group-hover:opacity-100",
|
|
1798
|
+
children: /* @__PURE__ */ jsx5(Trash2, { className: "w-4 h-4" })
|
|
1691
1799
|
}
|
|
1692
1800
|
)
|
|
1693
|
-
]
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
value: String(item),
|
|
1698
|
-
onChange: (e) => {
|
|
1699
|
-
const arr = Array.isArray(value) ? [...value] : [];
|
|
1700
|
-
arr[idx] = e.target.value;
|
|
1701
|
-
onChange(arr);
|
|
1702
|
-
},
|
|
1703
|
-
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
1704
|
-
}
|
|
1705
|
-
) })
|
|
1706
|
-
] }),
|
|
1707
|
-
!meta.fixedLength && /* @__PURE__ */ jsx5(
|
|
1708
|
-
"button",
|
|
1709
|
-
{
|
|
1710
|
-
onClick: () => {
|
|
1711
|
-
const arr = Array.isArray(value) ? [...value] : [];
|
|
1712
|
-
arr.splice(idx, 1);
|
|
1713
|
-
onChange(arr);
|
|
1714
|
-
},
|
|
1715
|
-
className: "p-1.5 text-slate-400 hover:text-red-500 hover:bg-red-50 rounded-lg transition-colors absolute top-2 right-2 opacity-0 group-hover:opacity-100",
|
|
1716
|
-
children: /* @__PURE__ */ jsx5(Trash2, { className: "w-4 h-4" })
|
|
1717
|
-
}
|
|
1718
|
-
)
|
|
1719
|
-
] }, idx);
|
|
1801
|
+
]
|
|
1802
|
+
},
|
|
1803
|
+
idx
|
|
1804
|
+
);
|
|
1720
1805
|
}),
|
|
1721
1806
|
!meta.fixedLength && /* @__PURE__ */ jsxs4(
|
|
1722
1807
|
"button",
|