@tecof/theme-editor 0.0.27 → 0.0.28

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
@@ -497,9 +497,16 @@ var TecofEditor = ({
497
497
  saving && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tecof-editor-save-indicator", children: saveStatus === "error" ? "Save failed" : "Saving..." })
498
498
  ] });
499
499
  };
500
- var TecofRender = ({ data: data3, config: config3, className }) => {
500
+ var TecofRender = ({ data: data3, config: config3, className, cmsData }) => {
501
501
  if (!data3) return null;
502
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children: /* @__PURE__ */ jsxRuntime.jsx(core.Render, { config: config3, data: data3 }) });
502
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children: /* @__PURE__ */ jsxRuntime.jsx(
503
+ core.Render,
504
+ {
505
+ config: config3,
506
+ data: data3,
507
+ metadata: { cmsData: cmsData || null }
508
+ }
509
+ ) });
503
510
  };
504
511
  var IMAGE_EXTENSIONS = ["png", "jpg", "jpeg", "webp", "gif", "svg", "avif", "bmp", "tiff", "heic"];
505
512
  var VIDEO_EXTENSIONS = ["mp4", "webm", "ogg", "avi", "mov", "quicktime"];
@@ -765,34 +772,38 @@ var createLucideIcon = (iconName, iconNode) => {
765
772
  var __iconNode = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
766
773
  var Check = createLucideIcon("check", __iconNode);
767
774
 
775
+ // node_modules/lucide-react/dist/esm/icons/chevron-down.js
776
+ var __iconNode2 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
777
+ var ChevronDown = createLucideIcon("chevron-down", __iconNode2);
778
+
768
779
  // node_modules/lucide-react/dist/esm/icons/chevron-right.js
769
- var __iconNode2 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
770
- var ChevronRight = createLucideIcon("chevron-right", __iconNode2);
780
+ var __iconNode3 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
781
+ var ChevronRight = createLucideIcon("chevron-right", __iconNode3);
771
782
 
772
783
  // node_modules/lucide-react/dist/esm/icons/code.js
773
- var __iconNode3 = [
784
+ var __iconNode4 = [
774
785
  ["path", { d: "m16 18 6-6-6-6", key: "eg8j8" }],
775
786
  ["path", { d: "m8 6-6 6 6 6", key: "ppft3o" }]
776
787
  ];
777
- var Code = createLucideIcon("code", __iconNode3);
788
+ var Code = createLucideIcon("code", __iconNode4);
778
789
 
779
790
  // node_modules/lucide-react/dist/esm/icons/copy.js
780
- var __iconNode4 = [
791
+ var __iconNode5 = [
781
792
  ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
782
793
  ["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
783
794
  ];
784
- var Copy = createLucideIcon("copy", __iconNode4);
795
+ var Copy = createLucideIcon("copy", __iconNode5);
785
796
 
786
797
  // node_modules/lucide-react/dist/esm/icons/external-link.js
787
- var __iconNode5 = [
798
+ var __iconNode6 = [
788
799
  ["path", { d: "M15 3h6v6", key: "1q9fwt" }],
789
800
  ["path", { d: "M10 14 21 3", key: "gplh6r" }],
790
801
  ["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
791
802
  ];
792
- var ExternalLink = createLucideIcon("external-link", __iconNode5);
803
+ var ExternalLink = createLucideIcon("external-link", __iconNode6);
793
804
 
794
805
  // node_modules/lucide-react/dist/esm/icons/file-text.js
795
- var __iconNode6 = [
806
+ var __iconNode7 = [
796
807
  [
797
808
  "path",
798
809
  {
@@ -805,10 +816,10 @@ var __iconNode6 = [
805
816
  ["path", { d: "M16 13H8", key: "t4e002" }],
806
817
  ["path", { d: "M16 17H8", key: "z1uh3a" }]
807
818
  ];
808
- var FileText = createLucideIcon("file-text", __iconNode6);
819
+ var FileText = createLucideIcon("file-text", __iconNode7);
809
820
 
810
821
  // node_modules/lucide-react/dist/esm/icons/file.js
811
- var __iconNode7 = [
822
+ var __iconNode8 = [
812
823
  [
813
824
  "path",
814
825
  {
@@ -818,10 +829,10 @@ var __iconNode7 = [
818
829
  ],
819
830
  ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }]
820
831
  ];
821
- var File2 = createLucideIcon("file", __iconNode7);
832
+ var File2 = createLucideIcon("file", __iconNode8);
822
833
 
823
834
  // node_modules/lucide-react/dist/esm/icons/folder-open.js
824
- var __iconNode8 = [
835
+ var __iconNode9 = [
825
836
  [
826
837
  "path",
827
838
  {
@@ -830,36 +841,47 @@ var __iconNode8 = [
830
841
  }
831
842
  ]
832
843
  ];
833
- var FolderOpen = createLucideIcon("folder-open", __iconNode8);
844
+ var FolderOpen = createLucideIcon("folder-open", __iconNode9);
834
845
 
835
846
  // node_modules/lucide-react/dist/esm/icons/globe.js
836
- var __iconNode9 = [
847
+ var __iconNode10 = [
837
848
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
838
849
  ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
839
850
  ["path", { d: "M2 12h20", key: "9i4pu4" }]
840
851
  ];
841
- var Globe = createLucideIcon("globe", __iconNode9);
852
+ var Globe = createLucideIcon("globe", __iconNode10);
853
+
854
+ // node_modules/lucide-react/dist/esm/icons/grip-vertical.js
855
+ var __iconNode11 = [
856
+ ["circle", { cx: "9", cy: "12", r: "1", key: "1vctgf" }],
857
+ ["circle", { cx: "9", cy: "5", r: "1", key: "hp0tcf" }],
858
+ ["circle", { cx: "9", cy: "19", r: "1", key: "fkjjf6" }],
859
+ ["circle", { cx: "15", cy: "12", r: "1", key: "1tmaij" }],
860
+ ["circle", { cx: "15", cy: "5", r: "1", key: "19l28e" }],
861
+ ["circle", { cx: "15", cy: "19", r: "1", key: "f4zoj3" }]
862
+ ];
863
+ var GripVertical = createLucideIcon("grip-vertical", __iconNode11);
842
864
 
843
865
  // node_modules/lucide-react/dist/esm/icons/image-plus.js
844
- var __iconNode10 = [
866
+ var __iconNode12 = [
845
867
  ["path", { d: "M16 5h6", key: "1vod17" }],
846
868
  ["path", { d: "M19 2v6", key: "4bpg5p" }],
847
869
  ["path", { d: "M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5", key: "1ue2ih" }],
848
870
  ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }],
849
871
  ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }]
850
872
  ];
851
- var ImagePlus = createLucideIcon("image-plus", __iconNode10);
873
+ var ImagePlus = createLucideIcon("image-plus", __iconNode12);
852
874
 
853
875
  // node_modules/lucide-react/dist/esm/icons/image.js
854
- var __iconNode11 = [
876
+ var __iconNode13 = [
855
877
  ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
856
878
  ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
857
879
  ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
858
880
  ];
859
- var Image2 = createLucideIcon("image", __iconNode11);
881
+ var Image2 = createLucideIcon("image", __iconNode13);
860
882
 
861
883
  // node_modules/lucide-react/dist/esm/icons/languages.js
862
- var __iconNode12 = [
884
+ var __iconNode14 = [
863
885
  ["path", { d: "m5 8 6 6", key: "1wu5hv" }],
864
886
  ["path", { d: "m4 14 6-6 2-3", key: "1k1g8d" }],
865
887
  ["path", { d: "M2 5h12", key: "or177f" }],
@@ -867,21 +889,21 @@ var __iconNode12 = [
867
889
  ["path", { d: "m22 22-5-10-5 10", key: "don7ne" }],
868
890
  ["path", { d: "M14 18h6", key: "1m8k6r" }]
869
891
  ];
870
- var Languages = createLucideIcon("languages", __iconNode12);
892
+ var Languages = createLucideIcon("languages", __iconNode14);
871
893
 
872
894
  // node_modules/lucide-react/dist/esm/icons/link.js
873
- var __iconNode13 = [
895
+ var __iconNode15 = [
874
896
  ["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
875
897
  ["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }]
876
898
  ];
877
- var Link = createLucideIcon("link", __iconNode13);
899
+ var Link = createLucideIcon("link", __iconNode15);
878
900
 
879
901
  // node_modules/lucide-react/dist/esm/icons/loader-circle.js
880
- var __iconNode14 = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
881
- var LoaderCircle = createLucideIcon("loader-circle", __iconNode14);
902
+ var __iconNode16 = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
903
+ var LoaderCircle = createLucideIcon("loader-circle", __iconNode16);
882
904
 
883
905
  // node_modules/lucide-react/dist/esm/icons/pencil.js
884
- var __iconNode15 = [
906
+ var __iconNode17 = [
885
907
  [
886
908
  "path",
887
909
  {
@@ -891,55 +913,62 @@ var __iconNode15 = [
891
913
  ],
892
914
  ["path", { d: "m15 5 4 4", key: "1mk7zo" }]
893
915
  ];
894
- var Pencil = createLucideIcon("pencil", __iconNode15);
916
+ var Pencil = createLucideIcon("pencil", __iconNode17);
917
+
918
+ // node_modules/lucide-react/dist/esm/icons/plus.js
919
+ var __iconNode18 = [
920
+ ["path", { d: "M5 12h14", key: "1ays0h" }],
921
+ ["path", { d: "M12 5v14", key: "s699le" }]
922
+ ];
923
+ var Plus = createLucideIcon("plus", __iconNode18);
895
924
 
896
925
  // node_modules/lucide-react/dist/esm/icons/refresh-ccw.js
897
- var __iconNode16 = [
926
+ var __iconNode19 = [
898
927
  ["path", { d: "M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "14sxne" }],
899
928
  ["path", { d: "M3 3v5h5", key: "1xhq8a" }],
900
929
  ["path", { d: "M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16", key: "1hlbsb" }],
901
930
  ["path", { d: "M16 16h5v5", key: "ccwih5" }]
902
931
  ];
903
- var RefreshCcw = createLucideIcon("refresh-ccw", __iconNode16);
932
+ var RefreshCcw = createLucideIcon("refresh-ccw", __iconNode19);
904
933
 
905
934
  // node_modules/lucide-react/dist/esm/icons/rotate-ccw.js
906
- var __iconNode17 = [
935
+ var __iconNode20 = [
907
936
  ["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
908
937
  ["path", { d: "M3 3v5h5", key: "1xhq8a" }]
909
938
  ];
910
- var RotateCcw = createLucideIcon("rotate-ccw", __iconNode17);
939
+ var RotateCcw = createLucideIcon("rotate-ccw", __iconNode20);
911
940
 
912
941
  // node_modules/lucide-react/dist/esm/icons/search.js
913
- var __iconNode18 = [
942
+ var __iconNode21 = [
914
943
  ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
915
944
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
916
945
  ];
917
- var Search = createLucideIcon("search", __iconNode18);
946
+ var Search = createLucideIcon("search", __iconNode21);
918
947
 
919
948
  // node_modules/lucide-react/dist/esm/icons/trash-2.js
920
- var __iconNode19 = [
949
+ var __iconNode22 = [
921
950
  ["path", { d: "M10 11v6", key: "nco0om" }],
922
951
  ["path", { d: "M14 11v6", key: "outv1u" }],
923
952
  ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
924
953
  ["path", { d: "M3 6h18", key: "d0wm0j" }],
925
954
  ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
926
955
  ];
927
- var Trash2 = createLucideIcon("trash-2", __iconNode19);
956
+ var Trash2 = createLucideIcon("trash-2", __iconNode22);
928
957
 
929
958
  // node_modules/lucide-react/dist/esm/icons/upload.js
930
- var __iconNode20 = [
959
+ var __iconNode23 = [
931
960
  ["path", { d: "M12 3v12", key: "1x0j5s" }],
932
961
  ["path", { d: "m17 8-5-5-5 5", key: "7q97r8" }],
933
962
  ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }]
934
963
  ];
935
- var Upload = createLucideIcon("upload", __iconNode20);
964
+ var Upload = createLucideIcon("upload", __iconNode23);
936
965
 
937
966
  // node_modules/lucide-react/dist/esm/icons/x.js
938
- var __iconNode21 = [
967
+ var __iconNode24 = [
939
968
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
940
969
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
941
970
  ];
942
- var X = createLucideIcon("x", __iconNode21);
971
+ var X = createLucideIcon("x", __iconNode24);
943
972
  var FieldErrorBoundary = class extends React__default.Component {
944
973
  constructor(props) {
945
974
  super(props);
@@ -24215,6 +24244,308 @@ var createColorField = (options = {}) => {
24215
24244
  ) }) })
24216
24245
  };
24217
24246
  };
24247
+ var RepeaterRow = ({
24248
+ row,
24249
+ rowIndex,
24250
+ subFields,
24251
+ isExpanded,
24252
+ onToggle,
24253
+ onRemove,
24254
+ onDuplicate,
24255
+ onMoveUp,
24256
+ onMoveDown,
24257
+ onChange,
24258
+ canRemove,
24259
+ canMoveUp,
24260
+ canMoveDown,
24261
+ readOnly
24262
+ }) => {
24263
+ const previewLabel = React__default.useMemo(() => {
24264
+ const keys = Object.keys(subFields);
24265
+ if (keys.length === 0) return `Sat\u0131r ${rowIndex + 1}`;
24266
+ const firstKey = keys[0];
24267
+ const val = row[firstKey];
24268
+ if (!val) return `Sat\u0131r ${rowIndex + 1}`;
24269
+ if (Array.isArray(val) && val.length > 0 && typeof val[0] === "object" && "value" in val[0]) {
24270
+ const text2 = val[0]?.value;
24271
+ if (typeof text2 === "string" && text2.trim()) {
24272
+ return text2.length > 40 ? text2.substring(0, 40) + "\u2026" : text2;
24273
+ }
24274
+ }
24275
+ if (typeof val === "string" && val.trim()) {
24276
+ return val.length > 40 ? val.substring(0, 40) + "\u2026" : val;
24277
+ }
24278
+ return `Sat\u0131r ${rowIndex + 1}`;
24279
+ }, [row, subFields, rowIndex]);
24280
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `tecof-repeater-row ${isExpanded ? "expanded" : ""}`, children: [
24281
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-repeater-row-header", onClick: onToggle, children: [
24282
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-repeater-row-left", children: [
24283
+ /* @__PURE__ */ jsxRuntime.jsx(GripVertical, { size: 14, className: "tecof-repeater-grip" }),
24284
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tecof-repeater-row-index", children: rowIndex + 1 }),
24285
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tecof-repeater-row-preview", children: previewLabel })
24286
+ ] }),
24287
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-repeater-row-actions", children: [
24288
+ !readOnly && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
24289
+ canMoveUp && /* @__PURE__ */ jsxRuntime.jsx(
24290
+ "button",
24291
+ {
24292
+ type: "button",
24293
+ className: "tecof-repeater-action-btn",
24294
+ onClick: (e3) => {
24295
+ e3.stopPropagation();
24296
+ onMoveUp();
24297
+ },
24298
+ title: "Yukar\u0131 Ta\u015F\u0131",
24299
+ children: "\u25B2"
24300
+ }
24301
+ ),
24302
+ canMoveDown && /* @__PURE__ */ jsxRuntime.jsx(
24303
+ "button",
24304
+ {
24305
+ type: "button",
24306
+ className: "tecof-repeater-action-btn",
24307
+ onClick: (e3) => {
24308
+ e3.stopPropagation();
24309
+ onMoveDown();
24310
+ },
24311
+ title: "A\u015Fa\u011F\u0131 Ta\u015F\u0131",
24312
+ children: "\u25BC"
24313
+ }
24314
+ ),
24315
+ /* @__PURE__ */ jsxRuntime.jsx(
24316
+ "button",
24317
+ {
24318
+ type: "button",
24319
+ className: "tecof-repeater-action-btn",
24320
+ onClick: (e3) => {
24321
+ e3.stopPropagation();
24322
+ onDuplicate();
24323
+ },
24324
+ title: "Kopyala",
24325
+ children: /* @__PURE__ */ jsxRuntime.jsx(Copy, { size: 13 })
24326
+ }
24327
+ ),
24328
+ canRemove && /* @__PURE__ */ jsxRuntime.jsx(
24329
+ "button",
24330
+ {
24331
+ type: "button",
24332
+ className: "tecof-repeater-action-btn tecof-repeater-action-btn-danger",
24333
+ onClick: (e3) => {
24334
+ e3.stopPropagation();
24335
+ onRemove();
24336
+ },
24337
+ title: "Sil",
24338
+ children: /* @__PURE__ */ jsxRuntime.jsx(Trash2, { size: 13 })
24339
+ }
24340
+ )
24341
+ ] }),
24342
+ /* @__PURE__ */ jsxRuntime.jsx(
24343
+ ChevronDown,
24344
+ {
24345
+ size: 16,
24346
+ className: `tecof-repeater-chevron ${isExpanded ? "rotated" : ""}`
24347
+ }
24348
+ )
24349
+ ] })
24350
+ ] }),
24351
+ isExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tecof-repeater-row-content", children: Object.entries(subFields).map(([key, fieldDef]) => {
24352
+ const fieldValue = row[key];
24353
+ const renderFn = fieldDef?.render;
24354
+ if (typeof renderFn !== "function") return null;
24355
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tecof-repeater-subfield", children: renderFn({
24356
+ field: fieldDef,
24357
+ name: `${key}_${rowIndex}`,
24358
+ id: `repeater-${rowIndex}-${key}`,
24359
+ value: fieldValue,
24360
+ onChange: (val) => onChange(key, val),
24361
+ readOnly
24362
+ }) }, key);
24363
+ }) })
24364
+ ] });
24365
+ };
24366
+ var RepeaterField = ({
24367
+ value: rawValue,
24368
+ onChange,
24369
+ readOnly,
24370
+ subFields = {},
24371
+ minItems = 0,
24372
+ maxItems,
24373
+ defaultRow
24374
+ }) => {
24375
+ const items = React__default.useMemo(() => Array.isArray(rawValue) ? rawValue : [], [rawValue]);
24376
+ const [expandedRows, setExpandedRows] = React__default.useState(() => new Set(items.length > 0 ? [0] : []));
24377
+ const onChangeRef = React__default.useRef(onChange);
24378
+ onChangeRef.current = onChange;
24379
+ const canAdd = maxItems == null || items.length < maxItems;
24380
+ const canRemove = items.length > minItems;
24381
+ const buildDefaultRow = React__default.useCallback(() => {
24382
+ if (defaultRow) return { ...defaultRow };
24383
+ const row = {};
24384
+ for (const [key, fieldDef] of Object.entries(subFields)) {
24385
+ const ft = fieldDef?._fieldType;
24386
+ if (ft === "language" || ft === "editor") {
24387
+ row[key] = [];
24388
+ } else if (ft === "upload") {
24389
+ row[key] = [];
24390
+ } else if (ft === "link") {
24391
+ row[key] = [];
24392
+ } else if (ft === "color") {
24393
+ row[key] = "#000000";
24394
+ } else {
24395
+ row[key] = "";
24396
+ }
24397
+ }
24398
+ return row;
24399
+ }, [subFields, defaultRow]);
24400
+ const handleAdd = React__default.useCallback(() => {
24401
+ if (!canAdd) return;
24402
+ const newRow = buildDefaultRow();
24403
+ const newItems = [...items, newRow];
24404
+ onChangeRef.current(newItems);
24405
+ setExpandedRows((prev) => {
24406
+ const next = new Set(prev);
24407
+ next.add(newItems.length - 1);
24408
+ return next;
24409
+ });
24410
+ }, [canAdd, buildDefaultRow, items]);
24411
+ const handleRemove = React__default.useCallback((index2) => {
24412
+ if (!canRemove) return;
24413
+ const newItems = items.filter((_2, i2) => i2 !== index2);
24414
+ onChangeRef.current(newItems);
24415
+ setExpandedRows((prev) => {
24416
+ const next = /* @__PURE__ */ new Set();
24417
+ prev.forEach((idx) => {
24418
+ if (idx < index2) next.add(idx);
24419
+ else if (idx > index2) next.add(idx - 1);
24420
+ });
24421
+ return next;
24422
+ });
24423
+ }, [canRemove, items]);
24424
+ const handleDuplicate = React__default.useCallback((index2) => {
24425
+ if (!canAdd) return;
24426
+ const newItems = [...items];
24427
+ const cloned = JSON.parse(JSON.stringify(items[index2]));
24428
+ newItems.splice(index2 + 1, 0, cloned);
24429
+ onChangeRef.current(newItems);
24430
+ setExpandedRows((prev) => {
24431
+ const next = /* @__PURE__ */ new Set();
24432
+ prev.forEach((idx) => {
24433
+ if (idx <= index2) next.add(idx);
24434
+ else next.add(idx + 1);
24435
+ });
24436
+ next.add(index2 + 1);
24437
+ return next;
24438
+ });
24439
+ }, [canAdd, items]);
24440
+ const handleMove = React__default.useCallback((index2, direction) => {
24441
+ const target = direction === "up" ? index2 - 1 : index2 + 1;
24442
+ if (target < 0 || target >= items.length) return;
24443
+ const newItems = [...items];
24444
+ [newItems[index2], newItems[target]] = [newItems[target], newItems[index2]];
24445
+ onChangeRef.current(newItems);
24446
+ setExpandedRows((prev) => {
24447
+ const next = /* @__PURE__ */ new Set();
24448
+ prev.forEach((idx) => {
24449
+ if (idx === index2) next.add(target);
24450
+ else if (idx === target) next.add(index2);
24451
+ else next.add(idx);
24452
+ });
24453
+ return next;
24454
+ });
24455
+ }, [items]);
24456
+ const handleSubFieldChange = React__default.useCallback((rowIndex, key, val) => {
24457
+ const newItems = items.map((row, i2) => {
24458
+ if (i2 !== rowIndex) return row;
24459
+ return { ...row, [key]: val };
24460
+ });
24461
+ onChangeRef.current(newItems);
24462
+ }, [items]);
24463
+ const toggleRow = React__default.useCallback((index2) => {
24464
+ setExpandedRows((prev) => {
24465
+ const next = new Set(prev);
24466
+ if (next.has(index2)) next.delete(index2);
24467
+ else next.add(index2);
24468
+ return next;
24469
+ });
24470
+ }, []);
24471
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-repeater-container", children: [
24472
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tecof-repeater-header", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "tecof-repeater-count", children: [
24473
+ items.length,
24474
+ " sat\u0131r",
24475
+ maxItems != null && ` / ${maxItems}`
24476
+ ] }) }),
24477
+ items.length === 0 && !readOnly && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tecof-repeater-empty", children: [
24478
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "tecof-repeater-empty-text", children: "Hen\xFCz sat\u0131r eklenmemi\u015F" }),
24479
+ /* @__PURE__ */ jsxRuntime.jsxs(
24480
+ "button",
24481
+ {
24482
+ type: "button",
24483
+ className: "tecof-repeater-add-btn",
24484
+ onClick: handleAdd,
24485
+ children: [
24486
+ /* @__PURE__ */ jsxRuntime.jsx(Plus, { size: 14 }),
24487
+ " \u0130lk Sat\u0131r\u0131 Ekle"
24488
+ ]
24489
+ }
24490
+ )
24491
+ ] }),
24492
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tecof-repeater-rows", children: items.map((row, idx) => /* @__PURE__ */ jsxRuntime.jsx(
24493
+ RepeaterRow,
24494
+ {
24495
+ row,
24496
+ rowIndex: idx,
24497
+ subFields,
24498
+ isExpanded: expandedRows.has(idx),
24499
+ onToggle: () => toggleRow(idx),
24500
+ onRemove: () => handleRemove(idx),
24501
+ onDuplicate: () => handleDuplicate(idx),
24502
+ onMoveUp: () => handleMove(idx, "up"),
24503
+ onMoveDown: () => handleMove(idx, "down"),
24504
+ onChange: (key, val) => handleSubFieldChange(idx, key, val),
24505
+ canRemove,
24506
+ canMoveUp: idx > 0,
24507
+ canMoveDown: idx < items.length - 1,
24508
+ readOnly
24509
+ },
24510
+ idx
24511
+ )) }),
24512
+ items.length > 0 && !readOnly && canAdd && /* @__PURE__ */ jsxRuntime.jsxs(
24513
+ "button",
24514
+ {
24515
+ type: "button",
24516
+ className: "tecof-repeater-add-btn-bottom",
24517
+ onClick: handleAdd,
24518
+ children: [
24519
+ /* @__PURE__ */ jsxRuntime.jsx(Plus, { size: 14 }),
24520
+ " Sat\u0131r Ekle"
24521
+ ]
24522
+ }
24523
+ )
24524
+ ] });
24525
+ };
24526
+ RepeaterField.displayName = "RepeaterField";
24527
+ var createRepeaterField = (options) => {
24528
+ const { label, labelIcon, visible, ...fieldOptions } = options;
24529
+ return {
24530
+ type: "custom",
24531
+ _fieldType: "repeater",
24532
+ label,
24533
+ labelIcon,
24534
+ visible,
24535
+ render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsxRuntime.jsx(core.FieldLabel, { label: label || "", icon: labelIcon, readOnly, children: /* @__PURE__ */ jsxRuntime.jsx(FieldErrorBoundary, { fieldName: name3, children: /* @__PURE__ */ jsxRuntime.jsx(
24536
+ RepeaterField,
24537
+ {
24538
+ field,
24539
+ name: name3,
24540
+ id,
24541
+ value: value || [],
24542
+ onChange,
24543
+ readOnly,
24544
+ ...fieldOptions
24545
+ }
24546
+ ) }) })
24547
+ };
24548
+ };
24218
24549
 
24219
24550
  // src/utils/index.ts
24220
24551
  function hexToHsl(hex) {
@@ -24374,6 +24705,7 @@ lucide-react/dist/esm/context.js:
24374
24705
  lucide-react/dist/esm/Icon.js:
24375
24706
  lucide-react/dist/esm/createLucideIcon.js:
24376
24707
  lucide-react/dist/esm/icons/check.js:
24708
+ lucide-react/dist/esm/icons/chevron-down.js:
24377
24709
  lucide-react/dist/esm/icons/chevron-right.js:
24378
24710
  lucide-react/dist/esm/icons/code.js:
24379
24711
  lucide-react/dist/esm/icons/copy.js:
@@ -24382,12 +24714,14 @@ lucide-react/dist/esm/icons/file-text.js:
24382
24714
  lucide-react/dist/esm/icons/file.js:
24383
24715
  lucide-react/dist/esm/icons/folder-open.js:
24384
24716
  lucide-react/dist/esm/icons/globe.js:
24717
+ lucide-react/dist/esm/icons/grip-vertical.js:
24385
24718
  lucide-react/dist/esm/icons/image-plus.js:
24386
24719
  lucide-react/dist/esm/icons/image.js:
24387
24720
  lucide-react/dist/esm/icons/languages.js:
24388
24721
  lucide-react/dist/esm/icons/link.js:
24389
24722
  lucide-react/dist/esm/icons/loader-circle.js:
24390
24723
  lucide-react/dist/esm/icons/pencil.js:
24724
+ lucide-react/dist/esm/icons/plus.js:
24391
24725
  lucide-react/dist/esm/icons/refresh-ccw.js:
24392
24726
  lucide-react/dist/esm/icons/rotate-ccw.js:
24393
24727
  lucide-react/dist/esm/icons/search.js:
@@ -24483,6 +24817,7 @@ exports.EditorField = EditorField;
24483
24817
  exports.FieldErrorBoundary = FieldErrorBoundary;
24484
24818
  exports.LanguageField = LanguageField;
24485
24819
  exports.LinkField = LinkField;
24820
+ exports.RepeaterField = RepeaterField;
24486
24821
  exports.TecofApiClient = TecofApiClient;
24487
24822
  exports.TecofEditor = TecofEditor;
24488
24823
  exports.TecofPicture = TecofPicture;
@@ -24494,6 +24829,7 @@ exports.createColorField = createColorField;
24494
24829
  exports.createEditorField = createEditorField;
24495
24830
  exports.createLanguageField = createLanguageField;
24496
24831
  exports.createLinkField = createLinkField;
24832
+ exports.createRepeaterField = createRepeaterField;
24497
24833
  exports.createUploadField = createUploadField;
24498
24834
  exports.darken = darken;
24499
24835
  exports.generateCSSVariables = generateCSSVariables;