@rettangoli/ui 0.1.12 → 0.1.14

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.
@@ -123,17 +123,26 @@ class RettangoliInputElement extends HTMLElement {
123
123
  };
124
124
 
125
125
  attributeChangedCallback(name, oldValue, newValue) {
126
- // Handle key attribute change - reset value
127
- if (name === "key" && oldValue !== newValue) {
126
+ if (name === 'value') {
128
127
  requestAnimationFrame((() => {
129
128
  const value = this.getAttribute("value");
130
129
  this._inputElement.value = value ?? "";
131
130
  }))
132
- return;
131
+ }
132
+
133
+ if (name === 'placeholder') {
134
+ requestAnimationFrame((() => {
135
+ const placeholder = this.getAttribute("placeholder");
136
+ if (placeholder === undefined || placeholder === 'null') {
137
+ this._inputElement.removeAttribute('placeholder');
138
+ } else {
139
+ this._inputElement.setAttribute('placeholder', placeholder ?? "");
140
+ }
141
+ }))
133
142
  }
134
143
 
135
144
  // Handle input-specific attributes first
136
- if (["type", "placeholder", "disabled", "value", "step", "s"].includes(name)) {
145
+ if (["type", "disabled", "step", "s"].includes(name)) {
137
146
  this._updateInputAttributes();
138
147
  return;
139
148
  }
@@ -205,23 +214,13 @@ class RettangoliInputElement extends HTMLElement {
205
214
 
206
215
  _updateInputAttributes() {
207
216
  const type = this.getAttribute("type") || "text";
208
- const placeholder = this.getAttribute("placeholder");
209
- const value = this.getAttribute("value");
217
+ // const placeholder = this.getAttribute("placeholder");
218
+ // const value = this.getAttribute("value");
210
219
  const step = this.getAttribute("step");
211
220
  const isDisabled = this.hasAttribute('disabled');
212
221
 
213
222
  this._inputElement.setAttribute("type", type);
214
223
 
215
- if (placeholder !== null) {
216
- this._inputElement.setAttribute("placeholder", placeholder);
217
- } else {
218
- this._inputElement.removeAttribute("placeholder");
219
- }
220
-
221
- if (value !== null) {
222
- this._inputElement.value = value;
223
- }
224
-
225
224
  if (step !== null) {
226
225
  this._inputElement.setAttribute("step", step);
227
226
  } else {