admin-lib-cms 1.1.3 → 1.1.4

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 CHANGED
@@ -1523,7 +1523,31 @@ function CollectionEditor({ collection }) {
1523
1523
  placeholder: `Search ${f.label.toLowerCase()}...`,
1524
1524
  iconMap: ctx.iconMap
1525
1525
  }
1526
- ) : f.type === "select" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
1526
+ ) : f.type === "slug" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex gap-2", children: [
1527
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1528
+ "input",
1529
+ {
1530
+ type: "text",
1531
+ value: String(editing[f.id] ?? ""),
1532
+ onChange: (e) => setEditing({ ...editing, [f.id]: e.target.value }),
1533
+ className: "flex-1 rounded-xl border border-slate-200 px-4 py-2.5 text-sm shadow-sm focus:border-indigo-500 focus:ring-4 focus:ring-indigo-500/10 transition-all"
1534
+ }
1535
+ ),
1536
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1537
+ "button",
1538
+ {
1539
+ type: "button",
1540
+ onClick: () => {
1541
+ const sourceField = f.source || "title";
1542
+ let val = String(editing[sourceField] || editing.id || "");
1543
+ val = val.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)+/g, "");
1544
+ setEditing({ ...editing, [f.id]: val });
1545
+ },
1546
+ className: "px-4 py-2.5 bg-slate-100 hover:bg-slate-200 text-slate-700 text-sm font-semibold rounded-xl border border-slate-200 transition-colors",
1547
+ children: "Generate"
1548
+ }
1549
+ )
1550
+ ] }) : f.type === "select" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
1527
1551
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1528
1552
  "input",
1529
1553
  {
package/dist/index.mjs CHANGED
@@ -1521,7 +1521,31 @@ function CollectionEditor({ collection }) {
1521
1521
  placeholder: `Search ${f.label.toLowerCase()}...`,
1522
1522
  iconMap: ctx.iconMap
1523
1523
  }
1524
- ) : f.type === "select" ? /* @__PURE__ */ jsxs2("div", { children: [
1524
+ ) : f.type === "slug" ? /* @__PURE__ */ jsxs2("div", { className: "flex gap-2", children: [
1525
+ /* @__PURE__ */ jsx5(
1526
+ "input",
1527
+ {
1528
+ type: "text",
1529
+ value: String(editing[f.id] ?? ""),
1530
+ onChange: (e) => setEditing({ ...editing, [f.id]: e.target.value }),
1531
+ className: "flex-1 rounded-xl border border-slate-200 px-4 py-2.5 text-sm shadow-sm focus:border-indigo-500 focus:ring-4 focus:ring-indigo-500/10 transition-all"
1532
+ }
1533
+ ),
1534
+ /* @__PURE__ */ jsx5(
1535
+ "button",
1536
+ {
1537
+ type: "button",
1538
+ onClick: () => {
1539
+ const sourceField = f.source || "title";
1540
+ let val = String(editing[sourceField] || editing.id || "");
1541
+ val = val.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)+/g, "");
1542
+ setEditing({ ...editing, [f.id]: val });
1543
+ },
1544
+ className: "px-4 py-2.5 bg-slate-100 hover:bg-slate-200 text-slate-700 text-sm font-semibold rounded-xl border border-slate-200 transition-colors",
1545
+ children: "Generate"
1546
+ }
1547
+ )
1548
+ ] }) : f.type === "select" ? /* @__PURE__ */ jsxs2("div", { children: [
1525
1549
  /* @__PURE__ */ jsx5(
1526
1550
  "input",
1527
1551
  {
package/dist/types.d.mts CHANGED
@@ -23,11 +23,12 @@ interface PageDef {
23
23
  interface CollectionField {
24
24
  id: string;
25
25
  label: string;
26
- type: FieldType | "number" | "boolean" | "select" | "icon";
26
+ type: FieldType | "number" | "boolean" | "select" | "icon" | "slug";
27
27
  options?: string[] | {
28
28
  label: string;
29
29
  value: string;
30
30
  }[];
31
+ source?: string;
31
32
  defaultValue?: unknown;
32
33
  }
33
34
  interface CollectionDef {
package/dist/types.d.ts CHANGED
@@ -23,11 +23,12 @@ interface PageDef {
23
23
  interface CollectionField {
24
24
  id: string;
25
25
  label: string;
26
- type: FieldType | "number" | "boolean" | "select" | "icon";
26
+ type: FieldType | "number" | "boolean" | "select" | "icon" | "slug";
27
27
  options?: string[] | {
28
28
  label: string;
29
29
  value: string;
30
30
  }[];
31
+ source?: string;
31
32
  defaultValue?: unknown;
32
33
  }
33
34
  interface CollectionDef {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "admin-lib-cms",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "Agnostic Admin CMS Library",
5
5
  "keywords": [
6
6
  "cms",