releasebird-javascript-sdk 1.0.83 → 1.0.85
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/src/RbirdFormManager.js
CHANGED
|
@@ -56,8 +56,9 @@ export class RbirdFormManager {
|
|
|
56
56
|
if (this.displayedForms.has(formId)) {
|
|
57
57
|
// Double-check if the form element actually exists in DOM
|
|
58
58
|
const existingForm = document.getElementById(`rbird-form-${formId}`);
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
const existingOverlay = document.getElementById(`rbird-form-overlay-${formId}`);
|
|
60
|
+
if (!existingForm && !existingOverlay) {
|
|
61
|
+
// Form element was removed (e.g., closed modal or SPA navigation), allow re-rendering
|
|
61
62
|
this.displayedForms.delete(formId);
|
|
62
63
|
} else {
|
|
63
64
|
console.warn('[RbirdFormManager] Form is already displayed:', formId);
|
|
@@ -162,7 +163,7 @@ export class RbirdFormManager {
|
|
|
162
163
|
` : ''}
|
|
163
164
|
<div class="rbird-form-body">
|
|
164
165
|
${form.title ? `<h3 class="rbird-form-title" style="${this.getTitleStyles(theme)}">${this.escapeHtml(form.title)}</h3>` : ''}
|
|
165
|
-
${form.description ? `<p class="rbird-form-description" style="${this.getDescriptionStyles()}">${this.escapeHtml(form.description)}</p>` : ''}
|
|
166
|
+
${form.description ? `<p class="rbird-form-description" style="${this.getDescriptionStyles(theme)}">${this.escapeHtml(form.description)}</p>` : ''}
|
|
166
167
|
<form class="rbird-form-fields" data-form-id="${form.id}">
|
|
167
168
|
${fieldsHtml}
|
|
168
169
|
<button type="submit" class="rbird-form-submit" style="${this.getSubmitButtonStyles(theme)}">
|
|
@@ -206,7 +207,7 @@ export class RbirdFormManager {
|
|
|
206
207
|
let html = `<div class="rbird-form-field" style="margin-bottom: 16px;">`;
|
|
207
208
|
|
|
208
209
|
if (field.label) {
|
|
209
|
-
html += `<label style="${this.getLabelStyles()}">${this.escapeHtml(field.label)} ${requiredMark}</label>`;
|
|
210
|
+
html += `<label style="${this.getLabelStyles(theme)}">${this.escapeHtml(field.label)} ${requiredMark}</label>`;
|
|
210
211
|
}
|
|
211
212
|
|
|
212
213
|
switch (field.type) {
|
|
@@ -416,26 +417,26 @@ export class RbirdFormManager {
|
|
|
416
417
|
getTitleStyles(theme) {
|
|
417
418
|
return `
|
|
418
419
|
margin: 0 0 8px 0;
|
|
419
|
-
font-size: 20px;
|
|
420
|
+
font-size: ${theme.titleFontSize || '20px'};
|
|
420
421
|
font-weight: 600;
|
|
421
422
|
color: ${theme.primaryColor || '#1f2937'};
|
|
422
423
|
`;
|
|
423
424
|
}
|
|
424
425
|
|
|
425
|
-
getDescriptionStyles() {
|
|
426
|
+
getDescriptionStyles(theme) {
|
|
426
427
|
return `
|
|
427
428
|
margin: 0 0 20px 0;
|
|
428
|
-
font-size: 14px;
|
|
429
|
+
font-size: ${theme.descriptionFontSize || '14px'};
|
|
429
430
|
color: #6b7280;
|
|
430
431
|
line-height: 1.5;
|
|
431
432
|
`;
|
|
432
433
|
}
|
|
433
434
|
|
|
434
|
-
getLabelStyles() {
|
|
435
|
+
getLabelStyles(theme) {
|
|
435
436
|
return `
|
|
436
437
|
display: block;
|
|
437
438
|
margin-bottom: 6px;
|
|
438
|
-
font-size: 14px;
|
|
439
|
+
font-size: ${theme.labelFontSize || '14px'};
|
|
439
440
|
font-weight: 500;
|
|
440
441
|
color: #374151;
|
|
441
442
|
`;
|