@ozguraltan/strapi-content-input 1.0.24 → 1.0.26

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/README.md CHANGED
@@ -308,6 +308,8 @@ The **`survey`** widget provides a full-featured survey, NPS, and quick-poll pla
308
308
  | `consent` | Required GDPR / KVKK consent switch (`accepted`) | Acceptance count & `100%` compliance bar |
309
309
  | `statement` | Rich informational callout / section intro block (no input required) | Informational separator |
310
310
 
311
+ - **Built-in `"No idea / N/A"` (`allowNoOpinion` + `i18n` `noOpinionLabel`) & Optional Clear:** Enable `allowNoOpinion: true` on any choice, scale (`likert_scale`, `nps`, `star_rating`), `matrix_single`, or `ranking` question (`__na__`). It satisfies `required` rules (and acts as an exclusive choice in `multiple_choice`), **excludes `__na__` from numeric averages (`★`, Likert) and NPS formulas**, reports its count & `%` separately in Strapi Analytics + `.xlsx`/`.csv` exports, and offers a `× Clear` action on non-required (`required: false`) questions.
312
+
311
313
  ### 5.3 Canonical Option IDs + Dynamic Strapi `i18n` Locales
312
314
  Every choice option, matrix row/column, and ranking item uses an immutable `id` alongside a dynamic `labels` dictionary populated from Strapi's active `i18n` locales (`Settings -> Internationalization`):
313
315
  ```json
@@ -4,8 +4,8 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
5
  const admin = require("@strapi/strapi/admin");
6
6
  const XLSXNs = require("xlsx");
7
- const index = require("./index-CHtB_Fa5.js");
8
- const SurveyWidgetEditor = require("./SurveyWidgetEditor-D3KiAotu.js");
7
+ const index = require("./index-DuJM60tO.js");
8
+ const SurveyWidgetEditor = require("./SurveyWidgetEditor-BTipBBEU.js");
9
9
  function _interopNamespace(e) {
10
10
  if (e && e.__esModule) return e;
11
11
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -2,8 +2,8 @@ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useState, useCallback, useEffect } from "react";
3
3
  import { useFetchClient } from "@strapi/strapi/admin";
4
4
  import * as XLSXNs from "xlsx";
5
- import { M as MaterialIcon } from "./index-C5Uj5YV9.mjs";
6
- import { h as useStrapiLocales, K as getInitialLocale, L as createBlankSurveyDraft, M as ColorCodesManager, N as pickTextForLocale, O as SurveyAnalyticsView, P as SurveyStudioModal, Q as SurveyExportModal, T as SurveyImportModal, U as SurveyCleanupConfirmModal, V as persistLocale } from "./SurveyWidgetEditor-Y5BR-NWE.mjs";
5
+ import { M as MaterialIcon } from "./index-DSDcG4QW.mjs";
6
+ import { h as useStrapiLocales, K as getInitialLocale, L as createBlankSurveyDraft, M as ColorCodesManager, N as pickTextForLocale, O as SurveyAnalyticsView, P as SurveyStudioModal, Q as SurveyExportModal, T as SurveyImportModal, U as SurveyCleanupConfirmModal, V as persistLocale } from "./SurveyWidgetEditor-GKRT3eHj.mjs";
7
7
  const XLSX = XLSXNs?.utils ? XLSXNs : XLSXNs?.default || XLSXNs;
8
8
  const AnalyticsHubPage = () => {
9
9
  const { get, post } = useFetchClient();
@@ -1,8 +1,8 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import React, { useState, useRef, useEffect, useMemo, useCallback } from "react";
3
3
  import { createPortal } from "react-dom";
4
- import { u as uid, a as useEditorTranslator, R as ROW_PRESETS, g as getRowPresetLabel, W as WIDGET_DEFINITIONS, b as getWidgetLabel, C as CIColorField, c as createWidget, d as createBlock, e as createRow, f as getWidgetDefinition, S as StrapiMediaPicker, D as DEVICES, r as resolveAdminMediaUrl, h as useStrapiLocales, i as useOptionalEditorContext, j as resolveCanvasMediaUrl, k as DEVICE_INDEX_MAP, l as useEditorContext, m as getDevice, n as rowCanvasClasses, o as nodeCanvasStyles, p as extractResponsiveProp, q as blockCanvasClasses, s as useColorCodes, t as getDeviceLabel, v as WIDTH_PRESETS, Z as ZOOM_OPTIONS, w as ColorCodesModal, x as getWidgetDescription, y as WIDGET_CATEGORIES, z as normalizeLocalizedRecord, A as normalizeOptionListByLocales, B as getDeviceTooltip, E as SurveyWidgetEditor, F as setResponsiveProp, G as getClipboard, H as copyToClipboard, I as EditorProvider, J as ensureIds } from "./SurveyWidgetEditor-Y5BR-NWE.mjs";
5
- import { M as MaterialIcon } from "./index-C5Uj5YV9.mjs";
4
+ import { u as uid, a as useEditorTranslator, R as ROW_PRESETS, g as getRowPresetLabel, W as WIDGET_DEFINITIONS, b as getWidgetLabel, C as CIColorField, c as createWidget, d as createBlock, e as createRow, f as getWidgetDefinition, S as StrapiMediaPicker, D as DEVICES, r as resolveAdminMediaUrl, h as useStrapiLocales, i as useOptionalEditorContext, j as resolveCanvasMediaUrl, k as DEVICE_INDEX_MAP, l as useEditorContext, m as getDevice, n as rowCanvasClasses, o as nodeCanvasStyles, p as extractResponsiveProp, q as blockCanvasClasses, s as useColorCodes, t as getDeviceLabel, v as WIDTH_PRESETS, Z as ZOOM_OPTIONS, w as ColorCodesModal, x as getWidgetDescription, y as WIDGET_CATEGORIES, z as normalizeLocalizedRecord, A as normalizeOptionListByLocales, B as getDeviceTooltip, E as SurveyWidgetEditor, F as setResponsiveProp, G as getClipboard, H as copyToClipboard, I as EditorProvider, J as ensureIds } from "./SurveyWidgetEditor-GKRT3eHj.mjs";
5
+ import { M as MaterialIcon } from "./index-DSDcG4QW.mjs";
6
6
  import { Swiper, SwiperSlide } from "swiper/react";
7
7
  import { Navigation, Pagination, Autoplay, Parallax, EffectFade, EffectCreative, EffectCoverflow, EffectCube, EffectFlip, Mousewheel } from "swiper/modules";
8
8
  import { useFetchClient, useStrapiApp } from "@strapi/strapi/admin";
@@ -21830,22 +21830,25 @@ function ensureLocalizedObj(val, fallbackTr = "", fallbackEn = "") {
21830
21830
  en: String(val.en ?? val.tr ?? fallbackEn ?? fallbackTr)
21831
21831
  };
21832
21832
  }
21833
+ const FORM_TURKISH_CHAR_MAP = {
21834
+ ç: "c",
21835
+ Ç: "c",
21836
+ ğ: "g",
21837
+ Ğ: "g",
21838
+ ı: "i",
21839
+ İ: "i",
21840
+ ö: "o",
21841
+ Ö: "o",
21842
+ ş: "s",
21843
+ Ş: "s",
21844
+ ü: "u",
21845
+ Ü: "u"
21846
+ };
21847
+ function sanitizeFormSlugInput(input) {
21848
+ return String(input || "").replace(/[çÇğĞıİöÖşŞüÜ]/g, (ch) => FORM_TURKISH_CHAR_MAP[ch] || ch).toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9_-]/g, "");
21849
+ }
21833
21850
  function slugifyFieldKey(input) {
21834
- const map = {
21835
- ç: "c",
21836
- Ç: "c",
21837
- ğ: "g",
21838
- Ğ: "g",
21839
- ı: "i",
21840
- İ: "i",
21841
- ö: "o",
21842
- Ö: "o",
21843
- ş: "s",
21844
- Ş: "s",
21845
- ü: "u",
21846
- Ü: "u"
21847
- };
21848
- return String(input || "").replace(/[çÇğĞıİöÖşŞüÜ]/g, (ch) => map[ch] || ch).toLowerCase().replace(/[^a-z0-9_]+/g, "_").replace(/^_+|_+$/g, "");
21851
+ 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, "");
21849
21852
  }
21850
21853
  const FIELD_TYPES = [
21851
21854
  { value: "input", labelTr: "Metin Kutusu (Text Input)", labelEn: "Text Input" },
@@ -24734,13 +24737,55 @@ const ContentFormWidgetEditor = ({
24734
24737
  )
24735
24738
  ] }),
24736
24739
  /* @__PURE__ */ jsxs("div", { children: [
24737
- /* @__PURE__ */ jsx("label", { style: labelStyle$1, children: "Form Slug / ID" }),
24740
+ /* @__PURE__ */ jsxs(
24741
+ "div",
24742
+ {
24743
+ style: {
24744
+ display: "flex",
24745
+ alignItems: "center",
24746
+ justifyContent: "space-between",
24747
+ gap: 6,
24748
+ marginBottom: 4
24749
+ },
24750
+ children: [
24751
+ /* @__PURE__ */ jsx("label", { style: { ...labelStyle$1, marginBottom: 0 }, children: "Form Slug / ID" }),
24752
+ /* @__PURE__ */ jsx(
24753
+ "button",
24754
+ {
24755
+ type: "button",
24756
+ onClick: () => setDraft({
24757
+ ...draft,
24758
+ slug: slugifyFieldKey(draft.title || "") || draft.slug
24759
+ }),
24760
+ style: {
24761
+ padding: "1px 7px",
24762
+ borderRadius: 5,
24763
+ border: "1px solid #93c5fd",
24764
+ background: "#eff6ff",
24765
+ color: "#1d4ed8",
24766
+ fontSize: 10,
24767
+ fontWeight: 700,
24768
+ cursor: "pointer"
24769
+ },
24770
+ children: tr ? "↻ Başlıktan Üret" : "↻ From Title"
24771
+ }
24772
+ )
24773
+ ]
24774
+ }
24775
+ ),
24738
24776
  /* @__PURE__ */ jsx(
24739
24777
  "input",
24740
24778
  {
24741
24779
  type: "text",
24742
24780
  value: draft.slug || "",
24743
- onChange: (e) => setDraft({ ...draft, slug: slugifyFieldKey(e.target.value) }),
24781
+ onChange: (e) => setDraft({
24782
+ ...draft,
24783
+ slug: sanitizeFormSlugInput(e.target.value)
24784
+ }),
24785
+ onBlur: (e) => setDraft({
24786
+ ...draft,
24787
+ slug: slugifyFieldKey(e.target.value) || slugifyFieldKey(draft.title || "") || draft.slug
24788
+ }),
24744
24789
  style: { ...inputStyle$1, fontFamily: "monospace" }
24745
24790
  }
24746
24791
  )
@@ -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-D3KiAotu.js");
7
- const index = require("./index-CHtB_Fa5.js");
6
+ const SurveyWidgetEditor = require("./SurveyWidgetEditor-BTipBBEU.js");
7
+ const index = require("./index-DuJM60tO.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
  )