saasufy-components 9.1.0 → 9.1.2

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.
@@ -59,18 +59,12 @@ class CollectionAdderForm extends SocketConsumer {
59
59
  }
60
60
 
61
61
  // Clear any existing field errors
62
- let inputSlot = this.shadowRoot.querySelector('.input-slot');
63
- if (inputSlot) {
64
- let slottedElements = inputSlot.assignedElements();
65
- slottedElements.forEach(element => {
66
- let existingFieldErrors = element.querySelectorAll('.collection-adder-field-error-container');
67
- existingFieldErrors.forEach(el => el.textContent = '');
68
-
69
- // Clear error classes from all inputs
70
- let allInputs = element.querySelectorAll('input, textarea, select');
71
- allInputs.forEach(input => input.classList.remove('error'));
72
- });
73
- }
62
+ let existingFieldErrors = this.querySelectorAll('.collection-adder-field-error-container');
63
+ existingFieldErrors.forEach(el => el.remove());
64
+
65
+ // Clear error classes from all inputs
66
+ let allInputs = this.querySelectorAll('input, textarea, select');
67
+ allInputs.forEach(input => input.classList.remove('error'));
74
68
 
75
69
  let trimSpaces = this.hasAttribute('trim-spaces');
76
70
 
@@ -184,26 +178,24 @@ class CollectionAdderForm extends SocketConsumer {
184
178
  let input = inputElements.find(el => el.name === fieldName);
185
179
 
186
180
  if (input) {
187
- // Look for a parent field container
188
- let fieldContainer = input.closest('.collection-adder-field-container');
189
-
190
- if (fieldContainer) {
191
- let errorDiv = fieldContainer.querySelector('.collection-adder-field-error-container');
192
- let inputType = input.type || (input.nodeName === 'TEXTAREA' ? 'textarea' : 'select');
193
-
194
- // For radio buttons and checkboxes, just add error class to input(s)
195
- if (inputType === 'radio') {
196
- let radioInputs = fieldContainer.querySelectorAll(`input[name="${fieldName}"][type="radio"]`);
197
- radioInputs.forEach(radio => radio.classList.add('error'));
198
- } else if (inputType === 'checkbox') {
199
- input.classList.add('error');
200
- } else {
201
- // For other input types, populate the error message div
202
- if (errorDiv) {
203
- let simpleFieldError = fieldError.replace(/^Invalid [^:]+:/i, '');
204
- errorDiv.textContent = simpleFieldError;
205
- }
206
- }
181
+ let inputType = input.type || (input.nodeName === 'TEXTAREA' ? 'textarea' : 'select');
182
+
183
+ // For radio buttons and checkboxes, just add error class to input(s)
184
+ if (inputType === 'radio') {
185
+ // Find all radio inputs with the same name
186
+ let radioInputs = inputElements.filter(el => el.name === fieldName && el.type === 'radio');
187
+ radioInputs.forEach(radio => radio.classList.add('error'));
188
+ } else if (inputType === 'checkbox') {
189
+ input.classList.add('error');
190
+ } else {
191
+ // For other input types, create and insert error message div before the input
192
+ let errorDiv = document.createElement('div');
193
+ errorDiv.classList.add('collection-adder-field-error-container');
194
+ errorDiv.classList.add('error');
195
+ let simpleFieldError = fieldError.replace(/^Invalid [^:]+:/i, '');
196
+ errorDiv.textContent = simpleFieldError;
197
+
198
+ input.parentNode.insertBefore(errorDiv, input);
207
199
  }
208
200
  }
209
201
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saasufy-components",
3
- "version": "9.1.0",
3
+ "version": "9.1.2",
4
4
  "description": "Components for Saasufy.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/styles.css CHANGED
@@ -162,6 +162,7 @@ collection-adder .collection-adder-form-content > label {
162
162
  collection-adder .collection-adder-field-container {
163
163
  display: flex;
164
164
  flex-direction: column;
165
+ flex-grow: 1;
165
166
  }
166
167
 
167
168
  .label-container {