@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.mjs CHANGED
@@ -459,9 +459,16 @@ var TecofEditor = ({
459
459
  saving && /* @__PURE__ */ jsx("div", { className: "tecof-editor-save-indicator", children: saveStatus === "error" ? "Save failed" : "Saving..." })
460
460
  ] });
461
461
  };
462
- var TecofRender = ({ data: data3, config: config3, className }) => {
462
+ var TecofRender = ({ data: data3, config: config3, className, cmsData }) => {
463
463
  if (!data3) return null;
464
- return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(Render, { config: config3, data: data3 }) });
464
+ return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(
465
+ Render,
466
+ {
467
+ config: config3,
468
+ data: data3,
469
+ metadata: { cmsData: cmsData || null }
470
+ }
471
+ ) });
465
472
  };
466
473
  var IMAGE_EXTENSIONS = ["png", "jpg", "jpeg", "webp", "gif", "svg", "avif", "bmp", "tiff", "heic"];
467
474
  var VIDEO_EXTENSIONS = ["mp4", "webm", "ogg", "avi", "mov", "quicktime"];
@@ -727,34 +734,38 @@ var createLucideIcon = (iconName, iconNode) => {
727
734
  var __iconNode = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
728
735
  var Check = createLucideIcon("check", __iconNode);
729
736
 
737
+ // node_modules/lucide-react/dist/esm/icons/chevron-down.js
738
+ var __iconNode2 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
739
+ var ChevronDown = createLucideIcon("chevron-down", __iconNode2);
740
+
730
741
  // node_modules/lucide-react/dist/esm/icons/chevron-right.js
731
- var __iconNode2 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
732
- var ChevronRight = createLucideIcon("chevron-right", __iconNode2);
742
+ var __iconNode3 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
743
+ var ChevronRight = createLucideIcon("chevron-right", __iconNode3);
733
744
 
734
745
  // node_modules/lucide-react/dist/esm/icons/code.js
735
- var __iconNode3 = [
746
+ var __iconNode4 = [
736
747
  ["path", { d: "m16 18 6-6-6-6", key: "eg8j8" }],
737
748
  ["path", { d: "m8 6-6 6 6 6", key: "ppft3o" }]
738
749
  ];
739
- var Code = createLucideIcon("code", __iconNode3);
750
+ var Code = createLucideIcon("code", __iconNode4);
740
751
 
741
752
  // node_modules/lucide-react/dist/esm/icons/copy.js
742
- var __iconNode4 = [
753
+ var __iconNode5 = [
743
754
  ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
744
755
  ["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" }]
745
756
  ];
746
- var Copy = createLucideIcon("copy", __iconNode4);
757
+ var Copy = createLucideIcon("copy", __iconNode5);
747
758
 
748
759
  // node_modules/lucide-react/dist/esm/icons/external-link.js
749
- var __iconNode5 = [
760
+ var __iconNode6 = [
750
761
  ["path", { d: "M15 3h6v6", key: "1q9fwt" }],
751
762
  ["path", { d: "M10 14 21 3", key: "gplh6r" }],
752
763
  ["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
753
764
  ];
754
- var ExternalLink = createLucideIcon("external-link", __iconNode5);
765
+ var ExternalLink = createLucideIcon("external-link", __iconNode6);
755
766
 
756
767
  // node_modules/lucide-react/dist/esm/icons/file-text.js
757
- var __iconNode6 = [
768
+ var __iconNode7 = [
758
769
  [
759
770
  "path",
760
771
  {
@@ -767,10 +778,10 @@ var __iconNode6 = [
767
778
  ["path", { d: "M16 13H8", key: "t4e002" }],
768
779
  ["path", { d: "M16 17H8", key: "z1uh3a" }]
769
780
  ];
770
- var FileText = createLucideIcon("file-text", __iconNode6);
781
+ var FileText = createLucideIcon("file-text", __iconNode7);
771
782
 
772
783
  // node_modules/lucide-react/dist/esm/icons/file.js
773
- var __iconNode7 = [
784
+ var __iconNode8 = [
774
785
  [
775
786
  "path",
776
787
  {
@@ -780,10 +791,10 @@ var __iconNode7 = [
780
791
  ],
781
792
  ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }]
782
793
  ];
783
- var File2 = createLucideIcon("file", __iconNode7);
794
+ var File2 = createLucideIcon("file", __iconNode8);
784
795
 
785
796
  // node_modules/lucide-react/dist/esm/icons/folder-open.js
786
- var __iconNode8 = [
797
+ var __iconNode9 = [
787
798
  [
788
799
  "path",
789
800
  {
@@ -792,36 +803,47 @@ var __iconNode8 = [
792
803
  }
793
804
  ]
794
805
  ];
795
- var FolderOpen = createLucideIcon("folder-open", __iconNode8);
806
+ var FolderOpen = createLucideIcon("folder-open", __iconNode9);
796
807
 
797
808
  // node_modules/lucide-react/dist/esm/icons/globe.js
798
- var __iconNode9 = [
809
+ var __iconNode10 = [
799
810
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
800
811
  ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
801
812
  ["path", { d: "M2 12h20", key: "9i4pu4" }]
802
813
  ];
803
- var Globe = createLucideIcon("globe", __iconNode9);
814
+ var Globe = createLucideIcon("globe", __iconNode10);
815
+
816
+ // node_modules/lucide-react/dist/esm/icons/grip-vertical.js
817
+ var __iconNode11 = [
818
+ ["circle", { cx: "9", cy: "12", r: "1", key: "1vctgf" }],
819
+ ["circle", { cx: "9", cy: "5", r: "1", key: "hp0tcf" }],
820
+ ["circle", { cx: "9", cy: "19", r: "1", key: "fkjjf6" }],
821
+ ["circle", { cx: "15", cy: "12", r: "1", key: "1tmaij" }],
822
+ ["circle", { cx: "15", cy: "5", r: "1", key: "19l28e" }],
823
+ ["circle", { cx: "15", cy: "19", r: "1", key: "f4zoj3" }]
824
+ ];
825
+ var GripVertical = createLucideIcon("grip-vertical", __iconNode11);
804
826
 
805
827
  // node_modules/lucide-react/dist/esm/icons/image-plus.js
806
- var __iconNode10 = [
828
+ var __iconNode12 = [
807
829
  ["path", { d: "M16 5h6", key: "1vod17" }],
808
830
  ["path", { d: "M19 2v6", key: "4bpg5p" }],
809
831
  ["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" }],
810
832
  ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }],
811
833
  ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }]
812
834
  ];
813
- var ImagePlus = createLucideIcon("image-plus", __iconNode10);
835
+ var ImagePlus = createLucideIcon("image-plus", __iconNode12);
814
836
 
815
837
  // node_modules/lucide-react/dist/esm/icons/image.js
816
- var __iconNode11 = [
838
+ var __iconNode13 = [
817
839
  ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
818
840
  ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
819
841
  ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
820
842
  ];
821
- var Image2 = createLucideIcon("image", __iconNode11);
843
+ var Image2 = createLucideIcon("image", __iconNode13);
822
844
 
823
845
  // node_modules/lucide-react/dist/esm/icons/languages.js
824
- var __iconNode12 = [
846
+ var __iconNode14 = [
825
847
  ["path", { d: "m5 8 6 6", key: "1wu5hv" }],
826
848
  ["path", { d: "m4 14 6-6 2-3", key: "1k1g8d" }],
827
849
  ["path", { d: "M2 5h12", key: "or177f" }],
@@ -829,21 +851,21 @@ var __iconNode12 = [
829
851
  ["path", { d: "m22 22-5-10-5 10", key: "don7ne" }],
830
852
  ["path", { d: "M14 18h6", key: "1m8k6r" }]
831
853
  ];
832
- var Languages = createLucideIcon("languages", __iconNode12);
854
+ var Languages = createLucideIcon("languages", __iconNode14);
833
855
 
834
856
  // node_modules/lucide-react/dist/esm/icons/link.js
835
- var __iconNode13 = [
857
+ var __iconNode15 = [
836
858
  ["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" }],
837
859
  ["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" }]
838
860
  ];
839
- var Link = createLucideIcon("link", __iconNode13);
861
+ var Link = createLucideIcon("link", __iconNode15);
840
862
 
841
863
  // node_modules/lucide-react/dist/esm/icons/loader-circle.js
842
- var __iconNode14 = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
843
- var LoaderCircle = createLucideIcon("loader-circle", __iconNode14);
864
+ var __iconNode16 = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
865
+ var LoaderCircle = createLucideIcon("loader-circle", __iconNode16);
844
866
 
845
867
  // node_modules/lucide-react/dist/esm/icons/pencil.js
846
- var __iconNode15 = [
868
+ var __iconNode17 = [
847
869
  [
848
870
  "path",
849
871
  {
@@ -853,55 +875,62 @@ var __iconNode15 = [
853
875
  ],
854
876
  ["path", { d: "m15 5 4 4", key: "1mk7zo" }]
855
877
  ];
856
- var Pencil = createLucideIcon("pencil", __iconNode15);
878
+ var Pencil = createLucideIcon("pencil", __iconNode17);
879
+
880
+ // node_modules/lucide-react/dist/esm/icons/plus.js
881
+ var __iconNode18 = [
882
+ ["path", { d: "M5 12h14", key: "1ays0h" }],
883
+ ["path", { d: "M12 5v14", key: "s699le" }]
884
+ ];
885
+ var Plus = createLucideIcon("plus", __iconNode18);
857
886
 
858
887
  // node_modules/lucide-react/dist/esm/icons/refresh-ccw.js
859
- var __iconNode16 = [
888
+ var __iconNode19 = [
860
889
  ["path", { d: "M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "14sxne" }],
861
890
  ["path", { d: "M3 3v5h5", key: "1xhq8a" }],
862
891
  ["path", { d: "M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16", key: "1hlbsb" }],
863
892
  ["path", { d: "M16 16h5v5", key: "ccwih5" }]
864
893
  ];
865
- var RefreshCcw = createLucideIcon("refresh-ccw", __iconNode16);
894
+ var RefreshCcw = createLucideIcon("refresh-ccw", __iconNode19);
866
895
 
867
896
  // node_modules/lucide-react/dist/esm/icons/rotate-ccw.js
868
- var __iconNode17 = [
897
+ var __iconNode20 = [
869
898
  ["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
870
899
  ["path", { d: "M3 3v5h5", key: "1xhq8a" }]
871
900
  ];
872
- var RotateCcw = createLucideIcon("rotate-ccw", __iconNode17);
901
+ var RotateCcw = createLucideIcon("rotate-ccw", __iconNode20);
873
902
 
874
903
  // node_modules/lucide-react/dist/esm/icons/search.js
875
- var __iconNode18 = [
904
+ var __iconNode21 = [
876
905
  ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
877
906
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
878
907
  ];
879
- var Search = createLucideIcon("search", __iconNode18);
908
+ var Search = createLucideIcon("search", __iconNode21);
880
909
 
881
910
  // node_modules/lucide-react/dist/esm/icons/trash-2.js
882
- var __iconNode19 = [
911
+ var __iconNode22 = [
883
912
  ["path", { d: "M10 11v6", key: "nco0om" }],
884
913
  ["path", { d: "M14 11v6", key: "outv1u" }],
885
914
  ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
886
915
  ["path", { d: "M3 6h18", key: "d0wm0j" }],
887
916
  ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
888
917
  ];
889
- var Trash2 = createLucideIcon("trash-2", __iconNode19);
918
+ var Trash2 = createLucideIcon("trash-2", __iconNode22);
890
919
 
891
920
  // node_modules/lucide-react/dist/esm/icons/upload.js
892
- var __iconNode20 = [
921
+ var __iconNode23 = [
893
922
  ["path", { d: "M12 3v12", key: "1x0j5s" }],
894
923
  ["path", { d: "m17 8-5-5-5 5", key: "7q97r8" }],
895
924
  ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }]
896
925
  ];
897
- var Upload = createLucideIcon("upload", __iconNode20);
926
+ var Upload = createLucideIcon("upload", __iconNode23);
898
927
 
899
928
  // node_modules/lucide-react/dist/esm/icons/x.js
900
- var __iconNode21 = [
929
+ var __iconNode24 = [
901
930
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
902
931
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
903
932
  ];
904
- var X = createLucideIcon("x", __iconNode21);
933
+ var X = createLucideIcon("x", __iconNode24);
905
934
  var FieldErrorBoundary = class extends Component {
906
935
  constructor(props) {
907
936
  super(props);
@@ -24177,6 +24206,308 @@ var createColorField = (options = {}) => {
24177
24206
  ) }) })
24178
24207
  };
24179
24208
  };
24209
+ var RepeaterRow = ({
24210
+ row,
24211
+ rowIndex,
24212
+ subFields,
24213
+ isExpanded,
24214
+ onToggle,
24215
+ onRemove,
24216
+ onDuplicate,
24217
+ onMoveUp,
24218
+ onMoveDown,
24219
+ onChange,
24220
+ canRemove,
24221
+ canMoveUp,
24222
+ canMoveDown,
24223
+ readOnly
24224
+ }) => {
24225
+ const previewLabel = useMemo(() => {
24226
+ const keys = Object.keys(subFields);
24227
+ if (keys.length === 0) return `Sat\u0131r ${rowIndex + 1}`;
24228
+ const firstKey = keys[0];
24229
+ const val = row[firstKey];
24230
+ if (!val) return `Sat\u0131r ${rowIndex + 1}`;
24231
+ if (Array.isArray(val) && val.length > 0 && typeof val[0] === "object" && "value" in val[0]) {
24232
+ const text2 = val[0]?.value;
24233
+ if (typeof text2 === "string" && text2.trim()) {
24234
+ return text2.length > 40 ? text2.substring(0, 40) + "\u2026" : text2;
24235
+ }
24236
+ }
24237
+ if (typeof val === "string" && val.trim()) {
24238
+ return val.length > 40 ? val.substring(0, 40) + "\u2026" : val;
24239
+ }
24240
+ return `Sat\u0131r ${rowIndex + 1}`;
24241
+ }, [row, subFields, rowIndex]);
24242
+ return /* @__PURE__ */ jsxs("div", { className: `tecof-repeater-row ${isExpanded ? "expanded" : ""}`, children: [
24243
+ /* @__PURE__ */ jsxs("div", { className: "tecof-repeater-row-header", onClick: onToggle, children: [
24244
+ /* @__PURE__ */ jsxs("div", { className: "tecof-repeater-row-left", children: [
24245
+ /* @__PURE__ */ jsx(GripVertical, { size: 14, className: "tecof-repeater-grip" }),
24246
+ /* @__PURE__ */ jsx("span", { className: "tecof-repeater-row-index", children: rowIndex + 1 }),
24247
+ /* @__PURE__ */ jsx("span", { className: "tecof-repeater-row-preview", children: previewLabel })
24248
+ ] }),
24249
+ /* @__PURE__ */ jsxs("div", { className: "tecof-repeater-row-actions", children: [
24250
+ !readOnly && /* @__PURE__ */ jsxs(Fragment, { children: [
24251
+ canMoveUp && /* @__PURE__ */ jsx(
24252
+ "button",
24253
+ {
24254
+ type: "button",
24255
+ className: "tecof-repeater-action-btn",
24256
+ onClick: (e3) => {
24257
+ e3.stopPropagation();
24258
+ onMoveUp();
24259
+ },
24260
+ title: "Yukar\u0131 Ta\u015F\u0131",
24261
+ children: "\u25B2"
24262
+ }
24263
+ ),
24264
+ canMoveDown && /* @__PURE__ */ jsx(
24265
+ "button",
24266
+ {
24267
+ type: "button",
24268
+ className: "tecof-repeater-action-btn",
24269
+ onClick: (e3) => {
24270
+ e3.stopPropagation();
24271
+ onMoveDown();
24272
+ },
24273
+ title: "A\u015Fa\u011F\u0131 Ta\u015F\u0131",
24274
+ children: "\u25BC"
24275
+ }
24276
+ ),
24277
+ /* @__PURE__ */ jsx(
24278
+ "button",
24279
+ {
24280
+ type: "button",
24281
+ className: "tecof-repeater-action-btn",
24282
+ onClick: (e3) => {
24283
+ e3.stopPropagation();
24284
+ onDuplicate();
24285
+ },
24286
+ title: "Kopyala",
24287
+ children: /* @__PURE__ */ jsx(Copy, { size: 13 })
24288
+ }
24289
+ ),
24290
+ canRemove && /* @__PURE__ */ jsx(
24291
+ "button",
24292
+ {
24293
+ type: "button",
24294
+ className: "tecof-repeater-action-btn tecof-repeater-action-btn-danger",
24295
+ onClick: (e3) => {
24296
+ e3.stopPropagation();
24297
+ onRemove();
24298
+ },
24299
+ title: "Sil",
24300
+ children: /* @__PURE__ */ jsx(Trash2, { size: 13 })
24301
+ }
24302
+ )
24303
+ ] }),
24304
+ /* @__PURE__ */ jsx(
24305
+ ChevronDown,
24306
+ {
24307
+ size: 16,
24308
+ className: `tecof-repeater-chevron ${isExpanded ? "rotated" : ""}`
24309
+ }
24310
+ )
24311
+ ] })
24312
+ ] }),
24313
+ isExpanded && /* @__PURE__ */ jsx("div", { className: "tecof-repeater-row-content", children: Object.entries(subFields).map(([key, fieldDef]) => {
24314
+ const fieldValue = row[key];
24315
+ const renderFn = fieldDef?.render;
24316
+ if (typeof renderFn !== "function") return null;
24317
+ return /* @__PURE__ */ jsx("div", { className: "tecof-repeater-subfield", children: renderFn({
24318
+ field: fieldDef,
24319
+ name: `${key}_${rowIndex}`,
24320
+ id: `repeater-${rowIndex}-${key}`,
24321
+ value: fieldValue,
24322
+ onChange: (val) => onChange(key, val),
24323
+ readOnly
24324
+ }) }, key);
24325
+ }) })
24326
+ ] });
24327
+ };
24328
+ var RepeaterField = ({
24329
+ value: rawValue,
24330
+ onChange,
24331
+ readOnly,
24332
+ subFields = {},
24333
+ minItems = 0,
24334
+ maxItems,
24335
+ defaultRow
24336
+ }) => {
24337
+ const items = useMemo(() => Array.isArray(rawValue) ? rawValue : [], [rawValue]);
24338
+ const [expandedRows, setExpandedRows] = useState(() => new Set(items.length > 0 ? [0] : []));
24339
+ const onChangeRef = useRef(onChange);
24340
+ onChangeRef.current = onChange;
24341
+ const canAdd = maxItems == null || items.length < maxItems;
24342
+ const canRemove = items.length > minItems;
24343
+ const buildDefaultRow = useCallback(() => {
24344
+ if (defaultRow) return { ...defaultRow };
24345
+ const row = {};
24346
+ for (const [key, fieldDef] of Object.entries(subFields)) {
24347
+ const ft = fieldDef?._fieldType;
24348
+ if (ft === "language" || ft === "editor") {
24349
+ row[key] = [];
24350
+ } else if (ft === "upload") {
24351
+ row[key] = [];
24352
+ } else if (ft === "link") {
24353
+ row[key] = [];
24354
+ } else if (ft === "color") {
24355
+ row[key] = "#000000";
24356
+ } else {
24357
+ row[key] = "";
24358
+ }
24359
+ }
24360
+ return row;
24361
+ }, [subFields, defaultRow]);
24362
+ const handleAdd = useCallback(() => {
24363
+ if (!canAdd) return;
24364
+ const newRow = buildDefaultRow();
24365
+ const newItems = [...items, newRow];
24366
+ onChangeRef.current(newItems);
24367
+ setExpandedRows((prev) => {
24368
+ const next = new Set(prev);
24369
+ next.add(newItems.length - 1);
24370
+ return next;
24371
+ });
24372
+ }, [canAdd, buildDefaultRow, items]);
24373
+ const handleRemove = useCallback((index2) => {
24374
+ if (!canRemove) return;
24375
+ const newItems = items.filter((_2, i2) => i2 !== index2);
24376
+ onChangeRef.current(newItems);
24377
+ setExpandedRows((prev) => {
24378
+ const next = /* @__PURE__ */ new Set();
24379
+ prev.forEach((idx) => {
24380
+ if (idx < index2) next.add(idx);
24381
+ else if (idx > index2) next.add(idx - 1);
24382
+ });
24383
+ return next;
24384
+ });
24385
+ }, [canRemove, items]);
24386
+ const handleDuplicate = useCallback((index2) => {
24387
+ if (!canAdd) return;
24388
+ const newItems = [...items];
24389
+ const cloned = JSON.parse(JSON.stringify(items[index2]));
24390
+ newItems.splice(index2 + 1, 0, cloned);
24391
+ onChangeRef.current(newItems);
24392
+ setExpandedRows((prev) => {
24393
+ const next = /* @__PURE__ */ new Set();
24394
+ prev.forEach((idx) => {
24395
+ if (idx <= index2) next.add(idx);
24396
+ else next.add(idx + 1);
24397
+ });
24398
+ next.add(index2 + 1);
24399
+ return next;
24400
+ });
24401
+ }, [canAdd, items]);
24402
+ const handleMove = useCallback((index2, direction) => {
24403
+ const target = direction === "up" ? index2 - 1 : index2 + 1;
24404
+ if (target < 0 || target >= items.length) return;
24405
+ const newItems = [...items];
24406
+ [newItems[index2], newItems[target]] = [newItems[target], newItems[index2]];
24407
+ onChangeRef.current(newItems);
24408
+ setExpandedRows((prev) => {
24409
+ const next = /* @__PURE__ */ new Set();
24410
+ prev.forEach((idx) => {
24411
+ if (idx === index2) next.add(target);
24412
+ else if (idx === target) next.add(index2);
24413
+ else next.add(idx);
24414
+ });
24415
+ return next;
24416
+ });
24417
+ }, [items]);
24418
+ const handleSubFieldChange = useCallback((rowIndex, key, val) => {
24419
+ const newItems = items.map((row, i2) => {
24420
+ if (i2 !== rowIndex) return row;
24421
+ return { ...row, [key]: val };
24422
+ });
24423
+ onChangeRef.current(newItems);
24424
+ }, [items]);
24425
+ const toggleRow = useCallback((index2) => {
24426
+ setExpandedRows((prev) => {
24427
+ const next = new Set(prev);
24428
+ if (next.has(index2)) next.delete(index2);
24429
+ else next.add(index2);
24430
+ return next;
24431
+ });
24432
+ }, []);
24433
+ return /* @__PURE__ */ jsxs("div", { className: "tecof-repeater-container", children: [
24434
+ /* @__PURE__ */ jsx("div", { className: "tecof-repeater-header", children: /* @__PURE__ */ jsxs("span", { className: "tecof-repeater-count", children: [
24435
+ items.length,
24436
+ " sat\u0131r",
24437
+ maxItems != null && ` / ${maxItems}`
24438
+ ] }) }),
24439
+ items.length === 0 && !readOnly && /* @__PURE__ */ jsxs("div", { className: "tecof-repeater-empty", children: [
24440
+ /* @__PURE__ */ jsx("p", { className: "tecof-repeater-empty-text", children: "Hen\xFCz sat\u0131r eklenmemi\u015F" }),
24441
+ /* @__PURE__ */ jsxs(
24442
+ "button",
24443
+ {
24444
+ type: "button",
24445
+ className: "tecof-repeater-add-btn",
24446
+ onClick: handleAdd,
24447
+ children: [
24448
+ /* @__PURE__ */ jsx(Plus, { size: 14 }),
24449
+ " \u0130lk Sat\u0131r\u0131 Ekle"
24450
+ ]
24451
+ }
24452
+ )
24453
+ ] }),
24454
+ /* @__PURE__ */ jsx("div", { className: "tecof-repeater-rows", children: items.map((row, idx) => /* @__PURE__ */ jsx(
24455
+ RepeaterRow,
24456
+ {
24457
+ row,
24458
+ rowIndex: idx,
24459
+ subFields,
24460
+ isExpanded: expandedRows.has(idx),
24461
+ onToggle: () => toggleRow(idx),
24462
+ onRemove: () => handleRemove(idx),
24463
+ onDuplicate: () => handleDuplicate(idx),
24464
+ onMoveUp: () => handleMove(idx, "up"),
24465
+ onMoveDown: () => handleMove(idx, "down"),
24466
+ onChange: (key, val) => handleSubFieldChange(idx, key, val),
24467
+ canRemove,
24468
+ canMoveUp: idx > 0,
24469
+ canMoveDown: idx < items.length - 1,
24470
+ readOnly
24471
+ },
24472
+ idx
24473
+ )) }),
24474
+ items.length > 0 && !readOnly && canAdd && /* @__PURE__ */ jsxs(
24475
+ "button",
24476
+ {
24477
+ type: "button",
24478
+ className: "tecof-repeater-add-btn-bottom",
24479
+ onClick: handleAdd,
24480
+ children: [
24481
+ /* @__PURE__ */ jsx(Plus, { size: 14 }),
24482
+ " Sat\u0131r Ekle"
24483
+ ]
24484
+ }
24485
+ )
24486
+ ] });
24487
+ };
24488
+ RepeaterField.displayName = "RepeaterField";
24489
+ var createRepeaterField = (options) => {
24490
+ const { label, labelIcon, visible, ...fieldOptions } = options;
24491
+ return {
24492
+ type: "custom",
24493
+ _fieldType: "repeater",
24494
+ label,
24495
+ labelIcon,
24496
+ visible,
24497
+ render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsx(FieldLabel, { label: label || "", icon: labelIcon, readOnly, children: /* @__PURE__ */ jsx(FieldErrorBoundary, { fieldName: name3, children: /* @__PURE__ */ jsx(
24498
+ RepeaterField,
24499
+ {
24500
+ field,
24501
+ name: name3,
24502
+ id,
24503
+ value: value || [],
24504
+ onChange,
24505
+ readOnly,
24506
+ ...fieldOptions
24507
+ }
24508
+ ) }) })
24509
+ };
24510
+ };
24180
24511
 
24181
24512
  // src/utils/index.ts
24182
24513
  function hexToHsl(hex) {
@@ -24336,6 +24667,7 @@ lucide-react/dist/esm/context.js:
24336
24667
  lucide-react/dist/esm/Icon.js:
24337
24668
  lucide-react/dist/esm/createLucideIcon.js:
24338
24669
  lucide-react/dist/esm/icons/check.js:
24670
+ lucide-react/dist/esm/icons/chevron-down.js:
24339
24671
  lucide-react/dist/esm/icons/chevron-right.js:
24340
24672
  lucide-react/dist/esm/icons/code.js:
24341
24673
  lucide-react/dist/esm/icons/copy.js:
@@ -24344,12 +24676,14 @@ lucide-react/dist/esm/icons/file-text.js:
24344
24676
  lucide-react/dist/esm/icons/file.js:
24345
24677
  lucide-react/dist/esm/icons/folder-open.js:
24346
24678
  lucide-react/dist/esm/icons/globe.js:
24679
+ lucide-react/dist/esm/icons/grip-vertical.js:
24347
24680
  lucide-react/dist/esm/icons/image-plus.js:
24348
24681
  lucide-react/dist/esm/icons/image.js:
24349
24682
  lucide-react/dist/esm/icons/languages.js:
24350
24683
  lucide-react/dist/esm/icons/link.js:
24351
24684
  lucide-react/dist/esm/icons/loader-circle.js:
24352
24685
  lucide-react/dist/esm/icons/pencil.js:
24686
+ lucide-react/dist/esm/icons/plus.js:
24353
24687
  lucide-react/dist/esm/icons/refresh-ccw.js:
24354
24688
  lucide-react/dist/esm/icons/rotate-ccw.js:
24355
24689
  lucide-react/dist/esm/icons/search.js:
@@ -24439,6 +24773,6 @@ filepond-plugin-image-edit/dist/filepond-plugin-image-edit.esm.js:
24439
24773
  *)
24440
24774
  */
24441
24775
 
24442
- export { CodeEditorField, ColorField, EditorField, FieldErrorBoundary, LanguageField, LinkField, TecofApiClient, TecofEditor, TecofPicture, TecofProvider, TecofRender, UploadField, createCodeEditorField, createColorField, createEditorField, createLanguageField, createLinkField, createUploadField, darken, generateCSSVariables, getDefaultTheme, hexToHsl, hslToHex, lighten, mergeTheme, useTecof };
24776
+ export { CodeEditorField, ColorField, EditorField, FieldErrorBoundary, LanguageField, LinkField, RepeaterField, TecofApiClient, TecofEditor, TecofPicture, TecofProvider, TecofRender, UploadField, createCodeEditorField, createColorField, createEditorField, createLanguageField, createLinkField, createRepeaterField, createUploadField, darken, generateCSSVariables, getDefaultTheme, hexToHsl, hslToHex, lighten, mergeTheme, useTecof };
24443
24777
  //# sourceMappingURL=index.mjs.map
24444
24778
  //# sourceMappingURL=index.mjs.map