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