@optionfactory/ful 3.0.0 → 3.0.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.
package/dist/ful.mjs CHANGED
@@ -1436,24 +1436,29 @@ class Input extends ParsedElement {
1436
1436
  <ful-field-error></ful-field-error>
1437
1437
  `;
1438
1438
  static formAssociated = true;
1439
- #input;
1440
- #fieldError;
1439
+ _input;
1440
+ _fieldError;
1441
1441
  constructor() {
1442
1442
  super();
1443
1443
  this.internals = this.attachInternals();
1444
1444
  this.internals.role = 'presentation';
1445
1445
  }
1446
+ _type(){
1447
+ return this.getAttribute("type") ?? 'text'; }
1448
+ _fragment(type, slots){
1449
+ return this.template().withOverlay({ type, slots }).render();
1450
+ }
1446
1451
  render({ slots, observed, disabled }) {
1447
- const type = this.getAttribute("type") ?? 'text';
1448
- const fragment = this.template().withOverlay({ type, slots }).render();
1449
- this.#input = fragment.querySelector("input,textarea");
1452
+ const type = this._type();
1453
+ const fragment = this._fragment(type, slots );
1454
+ this._input = fragment.querySelector("input,textarea");
1450
1455
 
1451
- Attributes.forward('input-', this, this.#input);
1456
+ Attributes.forward('input-', this, this._input);
1452
1457
  this.disabled = disabled;
1453
1458
  this.readonly = observed.readonly;
1454
1459
  this.value = observed.value;
1455
1460
 
1456
- this.#input.addEventListener('change', (evt) => {
1461
+ this._input.addEventListener('change', (evt) => {
1457
1462
  evt.stopPropagation();
1458
1463
  this.dispatchEvent(new CustomEvent('change', {
1459
1464
  bubbles: true,
@@ -1465,40 +1470,40 @@ class Input extends ParsedElement {
1465
1470
  });
1466
1471
  const label = fragment.querySelector('label');
1467
1472
  label.addEventListener('click', () => this.focus());
1468
- this.#fieldError = fragment.querySelector('ful-field-error');
1469
- this.#input.ariaDescribedByElements = [this.#fieldError];
1470
- this.#input.ariaLabelledByElements = [label];
1473
+ this._fieldError = fragment.querySelector('ful-field-error');
1474
+ this._input.ariaDescribedByElements = [this._fieldError];
1475
+ this._input.ariaLabelledByElements = [label];
1471
1476
  this.replaceChildren(fragment);
1472
1477
  }
1473
1478
  get value() {
1474
- return this.#input.value === '' ? null : this.#input.value;
1479
+ return this._input.value === '' ? null : this._input.value;
1475
1480
  }
1476
1481
  set value(value) {
1477
- this.#input.value = value === '' ? null : value;
1482
+ this._input.value = value === '' ? null : value;
1478
1483
  }
1479
1484
  get readonly(){
1480
- return this.#input.readOnly;
1485
+ return this._input.readOnly;
1481
1486
  }
1482
1487
  set readonly(v) {
1483
- this.#input.readOnly = v;
1488
+ this._input.readOnly = v;
1484
1489
  }
1485
1490
  get disabled(){
1486
- return this.#input.hasAttribute('disabled');
1491
+ return this._input.hasAttribute('disabled');
1487
1492
  }
1488
1493
  set disabled(d){
1489
- Attributes.toggle(this.#input, 'disabled', d);
1494
+ Attributes.toggle(this._input, 'disabled', d);
1490
1495
  }
1491
1496
  focus(options) {
1492
- this.#input.focus(options);
1497
+ this._input.focus(options);
1493
1498
  }
1494
1499
  setCustomValidity(error) {
1495
1500
  if (!error) {
1496
1501
  this.internals.setValidity({});
1497
- this.#fieldError.innerText = "";
1502
+ this._fieldError.innerText = "";
1498
1503
  return;
1499
1504
  }
1500
1505
  this.internals.setValidity({ customError: true }, " ");
1501
- this.#fieldError.innerText = error;
1506
+ this._fieldError.innerText = error;
1502
1507
  }
1503
1508
  formResetCallback(){
1504
1509
  this.value = this.getAttribute("value");