form-builder-pro 1.3.9 → 1.4.0

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.css CHANGED
@@ -1089,6 +1089,9 @@ body {
1089
1089
  .items-center {
1090
1090
  align-items: center;
1091
1091
  }
1092
+ .justify-start {
1093
+ justify-content: flex-start;
1094
+ }
1092
1095
  .justify-end {
1093
1096
  justify-content: flex-end;
1094
1097
  }
@@ -1220,6 +1223,10 @@ body {
1220
1223
  .border-dashed {
1221
1224
  border-style: dashed;
1222
1225
  }
1226
+ .border-\[\#019FA2\] {
1227
+ --tw-border-opacity: 1;
1228
+ border-color: rgb(1 159 162 / var(--tw-border-opacity, 1));
1229
+ }
1223
1230
  .border-\[\#635bff\]\/35 {
1224
1231
  border-color: rgb(99 91 255 / 0.35);
1225
1232
  }
@@ -1310,6 +1317,9 @@ body {
1310
1317
  --tw-bg-opacity: 1;
1311
1318
  background-color: rgb(249 250 251 / var(--tw-bg-opacity, 1));
1312
1319
  }
1320
+ .bg-gray-50\/50 {
1321
+ background-color: rgb(249 250 251 / 0.5);
1322
+ }
1313
1323
  .bg-red-500 {
1314
1324
  --tw-bg-opacity: 1;
1315
1325
  background-color: rgb(239 68 68 / var(--tw-bg-opacity, 1));
@@ -1471,6 +1481,10 @@ body {
1471
1481
  .tracking-wider {
1472
1482
  letter-spacing: 0.05em;
1473
1483
  }
1484
+ .text-\[\#019FA2\] {
1485
+ --tw-text-opacity: 1;
1486
+ color: rgb(1 159 162 / var(--tw-text-opacity, 1));
1487
+ }
1474
1488
  .text-\[\#3b497e\] {
1475
1489
  --tw-text-opacity: 1;
1476
1490
  color: rgb(59 73 126 / var(--tw-text-opacity, 1));
@@ -1789,6 +1803,10 @@ input[type="radio"]:checked::after {
1789
1803
  background-color: rgb(1 138 141 / var(--tw-bg-opacity, 1));
1790
1804
  }
1791
1805
 
1806
+ .hover\:bg-\[\#019FA2\]\/10:hover {
1807
+ background-color: rgb(1 159 162 / 0.1);
1808
+ }
1809
+
1792
1810
  .hover\:bg-\[\#635bff\]:hover {
1793
1811
  --tw-bg-opacity: 1;
1794
1812
  background-color: rgb(99 91 255 / var(--tw-bg-opacity, 1));
@@ -1968,6 +1986,11 @@ input[type="radio"]:checked::after {
1968
1986
  opacity: 0.7;
1969
1987
  }
1970
1988
 
1989
+ .dark\:border-\[\#019FA2\]:is(.dark *) {
1990
+ --tw-border-opacity: 1;
1991
+ border-color: rgb(1 159 162 / var(--tw-border-opacity, 1));
1992
+ }
1993
+
1971
1994
  .dark\:border-\[\#635bff\]\/50:is(.dark *) {
1972
1995
  border-color: rgb(99 91 255 / 0.5);
1973
1996
  }
@@ -2006,6 +2029,10 @@ input[type="radio"]:checked::after {
2006
2029
  background-color: rgb(31 41 55 / var(--tw-bg-opacity, 1));
2007
2030
  }
2008
2031
 
2032
+ .dark\:bg-gray-800\/30:is(.dark *) {
2033
+ background-color: rgb(31 41 55 / 0.3);
2034
+ }
2035
+
2009
2036
  .dark\:bg-gray-800\/40:is(.dark *) {
2010
2037
  background-color: rgb(31 41 55 / 0.4);
2011
2038
  }
@@ -2024,6 +2051,11 @@ input[type="radio"]:checked::after {
2024
2051
  background-color: rgb(3 7 18 / var(--tw-bg-opacity, 1));
2025
2052
  }
2026
2053
 
2054
+ .dark\:text-\[\#4dd4d6\]:is(.dark *) {
2055
+ --tw-text-opacity: 1;
2056
+ color: rgb(77 212 214 / var(--tw-text-opacity, 1));
2057
+ }
2058
+
2027
2059
  .dark\:text-blue-200:is(.dark *) {
2028
2060
  --tw-text-opacity: 1;
2029
2061
  color: rgb(191 219 254 / var(--tw-text-opacity, 1));
package/dist/index.js CHANGED
@@ -7441,6 +7441,18 @@ var FormRenderer = class {
7441
7441
  grid.appendChild(fieldWrapper);
7442
7442
  });
7443
7443
  sectionEl.appendChild(grid);
7444
+ if (section.repeatable === true) {
7445
+ const addLabel = section.addButtonLabel && section.addButtonLabel.trim() || "+ Add";
7446
+ const addRow = createElement("div", { className: "mt-3 flex justify-start" });
7447
+ addRow.appendChild(
7448
+ createElement("button", {
7449
+ type: "button",
7450
+ className: "px-4 py-2 text-sm font-medium rounded-md border border-[#019FA2] text-[#019FA2] dark:text-[#4dd4d6] dark:border-[#019FA2] bg-transparent hover:bg-[#019FA2]/10 transition-colors",
7451
+ text: addLabel
7452
+ })
7453
+ );
7454
+ sectionEl.appendChild(addRow);
7455
+ }
7444
7456
  form.appendChild(sectionEl);
7445
7457
  });
7446
7458
  const submitBtn = createElement("button", {
@@ -9916,6 +9928,21 @@ var Section = class _Section {
9916
9928
  nestedWrap.appendChild(nestedList);
9917
9929
  sectionEl.appendChild(nestedWrap);
9918
9930
  }
9931
+ if (this.section.repeatable === true) {
9932
+ const addLabel = this.section.addButtonLabel && this.section.addButtonLabel.trim() || "+ Add";
9933
+ const footer = createElement("div", {
9934
+ className: "px-4 pb-4 pt-2 flex justify-start border-t border-gray-100 dark:border-gray-800 bg-gray-50/50 dark:bg-gray-800/30"
9935
+ });
9936
+ footer.appendChild(
9937
+ createElement("button", {
9938
+ type: "button",
9939
+ className: "px-4 py-2 text-sm font-medium rounded-md border border-[#019FA2] text-[#019FA2] dark:text-[#4dd4d6] dark:border-[#019FA2] bg-white dark:bg-gray-900 hover:bg-[#019FA2]/10 transition-colors",
9940
+ text: addLabel,
9941
+ onclick: (e) => e.preventDefault()
9942
+ })
9943
+ );
9944
+ sectionEl.appendChild(footer);
9945
+ }
9919
9946
  this.initFieldSortable(fieldsGrid);
9920
9947
  return sectionEl;
9921
9948
  }
@@ -10274,6 +10301,7 @@ var FormBuilder = class {
10274
10301
  collapsible: s.collapsible,
10275
10302
  parentGroupId: s.parentGroupId,
10276
10303
  repeatable: s.repeatable,
10304
+ addButtonLabel: s.addButtonLabel,
10277
10305
  minInstances: s.minInstances,
10278
10306
  maxInstances: s.maxInstances,
10279
10307
  css: s.css,
@@ -11164,11 +11192,37 @@ var FormBuilder = class {
11164
11192
  this.createCheckboxField(
11165
11193
  "Allow multiple instances",
11166
11194
  section.repeatable === true,
11167
- (checked) => formStore.getState().updateSection(sectionId, { repeatable: checked }),
11195
+ (checked) => formStore.getState().updateSection(sectionId, {
11196
+ repeatable: checked,
11197
+ ...checked ? {} : { addButtonLabel: null }
11198
+ }),
11168
11199
  `group-repeatable-${sectionId}`
11169
11200
  )
11170
11201
  );
11171
11202
  if (section.repeatable === true) {
11203
+ const addLabelWrap = createElement("div", { className: "mb-2" });
11204
+ addLabelWrap.appendChild(
11205
+ createElement("label", {
11206
+ className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1",
11207
+ text: "Add Button Label"
11208
+ })
11209
+ );
11210
+ addLabelWrap.appendChild(
11211
+ createElement("input", {
11212
+ type: "text",
11213
+ className: "w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md bg-transparent",
11214
+ value: section.addButtonLabel ?? "",
11215
+ placeholder: "e.g. + Billing Address",
11216
+ "data-focus-id": `group-add-btn-label-${sectionId}`,
11217
+ oninput: (e) => {
11218
+ const raw = e.target.value;
11219
+ formStore.getState().updateSection(sectionId, {
11220
+ addButtonLabel: raw === "" ? null : raw
11221
+ });
11222
+ }
11223
+ })
11224
+ );
11225
+ body.appendChild(addLabelWrap);
11172
11226
  const minG = createElement("div", { className: "mb-2" });
11173
11227
  minG.appendChild(createElement("label", { className: "block text-sm font-normal text-gray-700 dark:text-gray-300 mb-1", text: "Min Instances" }));
11174
11228
  minG.appendChild(createElement("input", {