form-builder-pro 1.1.6 → 1.1.8
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 +10 -0
- package/dist/index.d.mts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +15 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -1
package/dist/index.css
CHANGED
|
@@ -1631,6 +1631,16 @@ input[type="radio"]:checked::after {
|
|
|
1631
1631
|
border-color: hsl(var(--secondary));
|
|
1632
1632
|
}
|
|
1633
1633
|
|
|
1634
|
+
.hover\:bg-\[\#018a8d\]:hover {
|
|
1635
|
+
--tw-bg-opacity: 1;
|
|
1636
|
+
background-color: rgb(1 138 141 / var(--tw-bg-opacity, 1));
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
.hover\:bg-\[\#2d3a62\]:hover {
|
|
1640
|
+
--tw-bg-opacity: 1;
|
|
1641
|
+
background-color: rgb(45 58 98 / var(--tw-bg-opacity, 1));
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1634
1644
|
.hover\:bg-blue-200:hover {
|
|
1635
1645
|
--tw-bg-opacity: 1;
|
|
1636
1646
|
background-color: rgb(191 219 254 / var(--tw-bg-opacity, 1));
|
package/dist/index.d.mts
CHANGED
|
@@ -258,7 +258,6 @@ declare class FormBuilder {
|
|
|
258
258
|
private container;
|
|
259
259
|
private unsubscribe;
|
|
260
260
|
private options;
|
|
261
|
-
private isInputUpdate;
|
|
262
261
|
private lastRenderedSchemaHash;
|
|
263
262
|
constructor(container: HTMLElement, options?: FormBuilderOptions);
|
|
264
263
|
loadForm(json: FormSchema): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -258,7 +258,6 @@ declare class FormBuilder {
|
|
|
258
258
|
private container;
|
|
259
259
|
private unsubscribe;
|
|
260
260
|
private options;
|
|
261
|
-
private isInputUpdate;
|
|
262
261
|
private lastRenderedSchemaHash;
|
|
263
262
|
constructor(container: HTMLElement, options?: FormBuilderOptions);
|
|
264
263
|
loadForm(json: FormSchema): void;
|
package/dist/index.js
CHANGED
|
@@ -8616,8 +8616,6 @@ var FormBuilder = class {
|
|
|
8616
8616
|
__publicField(this, "container");
|
|
8617
8617
|
__publicField(this, "unsubscribe");
|
|
8618
8618
|
__publicField(this, "options");
|
|
8619
|
-
__publicField(this, "isInputUpdate", false);
|
|
8620
|
-
// Track if update is from text input
|
|
8621
8619
|
__publicField(this, "lastRenderedSchemaHash", "");
|
|
8622
8620
|
__publicField(this, "activeTab", "fields");
|
|
8623
8621
|
if (!container) {
|
|
@@ -8775,12 +8773,11 @@ var FormBuilder = class {
|
|
|
8775
8773
|
}
|
|
8776
8774
|
}
|
|
8777
8775
|
setupSubscriptions() {
|
|
8776
|
+
let lastPreviewMode = null;
|
|
8778
8777
|
this.unsubscribe = formStore.subscribe(() => {
|
|
8779
|
-
if (this.isInputUpdate) {
|
|
8780
|
-
this.isInputUpdate = false;
|
|
8781
|
-
return;
|
|
8782
|
-
}
|
|
8783
8778
|
const state = formStore.getState();
|
|
8779
|
+
const previewModeChanged = lastPreviewMode !== null && lastPreviewMode !== state.isPreviewMode;
|
|
8780
|
+
lastPreviewMode = state.isPreviewMode;
|
|
8784
8781
|
const schemaHash = JSON.stringify({
|
|
8785
8782
|
sections: state.schema.sections.map((s) => ({
|
|
8786
8783
|
id: s.id,
|
|
@@ -8793,9 +8790,11 @@ var FormBuilder = class {
|
|
|
8793
8790
|
// to prevent re-renders on typing
|
|
8794
8791
|
}))
|
|
8795
8792
|
})),
|
|
8796
|
-
selectedField: state.selectedFieldId
|
|
8793
|
+
selectedField: state.selectedFieldId,
|
|
8794
|
+
isPreviewMode: state.isPreviewMode
|
|
8795
|
+
// Include preview mode in hash
|
|
8797
8796
|
});
|
|
8798
|
-
if (schemaHash !== this.lastRenderedSchemaHash) {
|
|
8797
|
+
if (schemaHash !== this.lastRenderedSchemaHash || previewModeChanged) {
|
|
8799
8798
|
this.lastRenderedSchemaHash = schemaHash;
|
|
8800
8799
|
this.render();
|
|
8801
8800
|
}
|
|
@@ -9008,9 +9007,14 @@ var FormBuilder = class {
|
|
|
9008
9007
|
}
|
|
9009
9008
|
}, [getIcon("Trash2", 16), createElement("span", { className: "", title: "Clear" })]);
|
|
9010
9009
|
const previewBtn = createElement("button", {
|
|
9011
|
-
className: `flex items-center px-3 py-2 text-sm
|
|
9012
|
-
onclick: () =>
|
|
9013
|
-
|
|
9010
|
+
className: `flex items-center justify-center px-3 py-2 text-sm font-medium rounded-md transition-colors ${state.isPreviewMode ? "bg-[#019FA2] text-white hover:bg-[#018a8d]" : "bg-[#3b497e] text-white hover:bg-[#2d3a62]"}`,
|
|
9011
|
+
onclick: (e) => {
|
|
9012
|
+
e.preventDefault();
|
|
9013
|
+
e.stopPropagation();
|
|
9014
|
+
formStore.getState().togglePreview();
|
|
9015
|
+
},
|
|
9016
|
+
title: state.isPreviewMode ? "Exit Preview" : "Preview Form"
|
|
9017
|
+
}, [getIcon(state.isPreviewMode ? "X" : "Eye", 16)]);
|
|
9014
9018
|
const saveBtn = createElement("button", {
|
|
9015
9019
|
className: "flex items-center px-3 py-2 text-sm font-medium text-white bg-[#019FA2] rounded-md shadow-sm transition-colors",
|
|
9016
9020
|
onclick: () => {
|
|
@@ -9141,7 +9145,6 @@ var FormBuilder = class {
|
|
|
9141
9145
|
placeholder: "formName (e.g., contactForm)",
|
|
9142
9146
|
"data-focus-id": "form-name",
|
|
9143
9147
|
oninput: (e) => {
|
|
9144
|
-
this.isInputUpdate = true;
|
|
9145
9148
|
formStore.getState().setSchema({ ...state.schema, formName: e.target.value });
|
|
9146
9149
|
}
|
|
9147
9150
|
});
|
|
@@ -9204,7 +9207,6 @@ var FormBuilder = class {
|
|
|
9204
9207
|
value: selectedField.label,
|
|
9205
9208
|
"data-focus-id": `field-label-${selectedField.id}`,
|
|
9206
9209
|
oninput: (e) => {
|
|
9207
|
-
this.isInputUpdate = true;
|
|
9208
9210
|
formStore.getState().updateField(selectedField.id, { label: e.target.value });
|
|
9209
9211
|
}
|
|
9210
9212
|
}));
|
|
@@ -9216,7 +9218,6 @@ var FormBuilder = class {
|
|
|
9216
9218
|
value: selectedField.placeholder || "",
|
|
9217
9219
|
"data-focus-id": `field-placeholder-${selectedField.id}`,
|
|
9218
9220
|
oninput: (e) => {
|
|
9219
|
-
this.isInputUpdate = true;
|
|
9220
9221
|
formStore.getState().updateField(selectedField.id, { placeholder: e.target.value });
|
|
9221
9222
|
}
|
|
9222
9223
|
}));
|