@ozguraltan/strapi-content-input 1.0.23 → 1.0.25

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.
@@ -3,8 +3,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
5
  const ReactDOM = require("react-dom");
6
- const SurveyWidgetEditor = require("./SurveyWidgetEditor-DOYxWop9.js");
7
- const index = require("./index-B9C8Qrfd.js");
6
+ const SurveyWidgetEditor = require("./SurveyWidgetEditor-DNDtKbmo.js");
7
+ const index = require("./index--fSIDKkt.js");
8
8
  const react = require("swiper/react");
9
9
  const modules = require("swiper/modules");
10
10
  const admin = require("@strapi/strapi/admin");
@@ -21852,22 +21852,25 @@ function ensureLocalizedObj(val, fallbackTr = "", fallbackEn = "") {
21852
21852
  en: String(val.en ?? val.tr ?? fallbackEn ?? fallbackTr)
21853
21853
  };
21854
21854
  }
21855
+ const FORM_TURKISH_CHAR_MAP = {
21856
+ ç: "c",
21857
+ Ç: "c",
21858
+ ğ: "g",
21859
+ Ğ: "g",
21860
+ ı: "i",
21861
+ İ: "i",
21862
+ ö: "o",
21863
+ Ö: "o",
21864
+ ş: "s",
21865
+ Ş: "s",
21866
+ ü: "u",
21867
+ Ü: "u"
21868
+ };
21869
+ function sanitizeFormSlugInput(input) {
21870
+ return String(input || "").replace(/[çÇğĞıİöÖşŞüÜ]/g, (ch) => FORM_TURKISH_CHAR_MAP[ch] || ch).toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9_-]/g, "");
21871
+ }
21855
21872
  function slugifyFieldKey(input) {
21856
- const map = {
21857
- ç: "c",
21858
- Ç: "c",
21859
- ğ: "g",
21860
- Ğ: "g",
21861
- ı: "i",
21862
- İ: "i",
21863
- ö: "o",
21864
- Ö: "o",
21865
- ş: "s",
21866
- Ş: "s",
21867
- ü: "u",
21868
- Ü: "u"
21869
- };
21870
- return String(input || "").replace(/[çÇğĞıİöÖşŞüÜ]/g, (ch) => map[ch] || ch).toLowerCase().replace(/[^a-z0-9_]+/g, "_").replace(/^_+|_+$/g, "");
21873
+ return String(input || "").replace(/[çÇğĞıİöÖşŞüÜ]/g, (ch) => FORM_TURKISH_CHAR_MAP[ch] || ch).toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/-{2,}/g, "-").replace(/_{2,}/g, "_").replace(/^[-_]+|[-_]+$/g, "");
21871
21874
  }
21872
21875
  const FIELD_TYPES = [
21873
21876
  { value: "input", labelTr: "Metin Kutusu (Text Input)", labelEn: "Text Input" },
@@ -24756,13 +24759,55 @@ const ContentFormWidgetEditor = ({
24756
24759
  )
24757
24760
  ] }),
24758
24761
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
24759
- /* @__PURE__ */ jsxRuntime.jsx("label", { style: labelStyle$1, children: "Form Slug / ID" }),
24762
+ /* @__PURE__ */ jsxRuntime.jsxs(
24763
+ "div",
24764
+ {
24765
+ style: {
24766
+ display: "flex",
24767
+ alignItems: "center",
24768
+ justifyContent: "space-between",
24769
+ gap: 6,
24770
+ marginBottom: 4
24771
+ },
24772
+ children: [
24773
+ /* @__PURE__ */ jsxRuntime.jsx("label", { style: { ...labelStyle$1, marginBottom: 0 }, children: "Form Slug / ID" }),
24774
+ /* @__PURE__ */ jsxRuntime.jsx(
24775
+ "button",
24776
+ {
24777
+ type: "button",
24778
+ onClick: () => setDraft({
24779
+ ...draft,
24780
+ slug: slugifyFieldKey(draft.title || "") || draft.slug
24781
+ }),
24782
+ style: {
24783
+ padding: "1px 7px",
24784
+ borderRadius: 5,
24785
+ border: "1px solid #93c5fd",
24786
+ background: "#eff6ff",
24787
+ color: "#1d4ed8",
24788
+ fontSize: 10,
24789
+ fontWeight: 700,
24790
+ cursor: "pointer"
24791
+ },
24792
+ children: tr ? "↻ Başlıktan Üret" : "↻ From Title"
24793
+ }
24794
+ )
24795
+ ]
24796
+ }
24797
+ ),
24760
24798
  /* @__PURE__ */ jsxRuntime.jsx(
24761
24799
  "input",
24762
24800
  {
24763
24801
  type: "text",
24764
24802
  value: draft.slug || "",
24765
- onChange: (e) => setDraft({ ...draft, slug: slugifyFieldKey(e.target.value) }),
24803
+ onChange: (e) => setDraft({
24804
+ ...draft,
24805
+ slug: sanitizeFormSlugInput(e.target.value)
24806
+ }),
24807
+ onBlur: (e) => setDraft({
24808
+ ...draft,
24809
+ slug: slugifyFieldKey(e.target.value) || slugifyFieldKey(draft.title || "") || draft.slug
24810
+ }),
24766
24811
  style: { ...inputStyle$1, fontFamily: "monospace" }
24767
24812
  }
24768
24813
  )