@optionfactory/ful 1.0.3 → 1.0.5

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
@@ -1399,7 +1399,8 @@ class Input extends ParsedElement {
1399
1399
  <div class="input-group">
1400
1400
  <span data-tpl-if="slots.ibefore" class="input-group-text">{{{{ slots.ibefore }}}}</span>
1401
1401
  {{{{ slots.before }}}}
1402
- <input class="form-control" data-tpl-id="id" type="text" placeholder=" " data-tpl-aria-describedby="fieldErrorId" form="">
1402
+ <input data-tpl-if="type != 'textarea'" class="form-control" data-tpl-id="id" data-tpl-type="type" placeholder=" " data-tpl-aria-describedby="fieldErrorId" form="">
1403
+ <textarea data-tpl-if="type == 'textarea'" class="form-control" data-tpl-id="id" placeholder=" " data-tpl-aria-describedby="fieldErrorId" form=""></textarea>
1403
1404
  {{{{ slots.after }}}}
1404
1405
  <span data-tpl-if="slots.iafter" class="input-group-text">{{{{ slots.iafter }}}}</span>
1405
1406
  </div>
@@ -1415,9 +1416,9 @@ class Input extends ParsedElement {
1415
1416
  render({ slots }) {
1416
1417
  const id = Attributes.uid('ful-input');
1417
1418
  const fieldErrorId = `${id}-error`;
1418
-
1419
- const fragment = this.template().withOverlay({ id, fieldErrorId, slots }).render();
1420
- this.#input = fragment.querySelector("input");
1419
+ const type = this.getAttribute("type") ?? 'text';
1420
+ const fragment = this.template().withOverlay({ id, type, fieldErrorId, slots }).render();
1421
+ this.#input = fragment.querySelector("input,textarea");
1421
1422
  Attributes.forward('input-', this, this.#input);
1422
1423
  this.#input.addEventListener('change', (evt) => {
1423
1424
  evt.stopPropagation();
@@ -1849,6 +1850,7 @@ class RadioGroup extends ParsedElement {
1849
1850
  static formAssociated = true;
1850
1851
  #fieldError;
1851
1852
  #firstRadio;
1853
+ #booleanType;
1852
1854
  constructor() {
1853
1855
  super();
1854
1856
  this.internals = this.attachInternals();
@@ -1883,11 +1885,12 @@ class RadioGroup extends ParsedElement {
1883
1885
  this.template().withOverlay({ name, fieldErrorId, slots, inputsAndLabels }).renderTo(this);
1884
1886
  this.#fieldError = this.querySelector('ful-field-error');
1885
1887
  this.#firstRadio = this.querySelector('input[type=radio]');
1888
+ this.#booleanType = this.getAttribute('type') === 'boolean';
1886
1889
  }
1887
1890
  get value() {
1888
1891
  /** @type {HTMLInputElement|null} */
1889
1892
  const checked = this.querySelector('input[type=radio]:checked');
1890
- return checked ? checked.value : null;
1893
+ return checked ? (this.#booleanType ? (checked.value === 'true') : checked.value) : null;
1891
1894
  }
1892
1895
  set value(value) {
1893
1896
  if (value === null) {
@@ -1897,7 +1900,7 @@ class RadioGroup extends ParsedElement {
1897
1900
  return;
1898
1901
  }
1899
1902
  /** @type {HTMLInputElement|null} */
1900
- const el = this.querySelector(`input[type=radio][value=${CSS.escape(value)}]`);
1903
+ const el = this.querySelector(`input[type=radio][value=${CSS.escape(String(value))}]`);
1901
1904
  if (el) {
1902
1905
  el.checked = true;
1903
1906
  }
@@ -1921,7 +1924,7 @@ class Checkbox extends ParsedElement {
1921
1924
  static slots = true;
1922
1925
  static template = `
1923
1926
  <div data-tpl-class="klass">
1924
- <input dat-tpl-id="id" class="form-check-input" type="checkbox" role="switch" form="" placeholder=" " data-tpl-aria-describedby="fieldErrorId">
1927
+ <input data-tpl-id="id" class="form-check-input" type="checkbox" role="switch" form="" placeholder=" " data-tpl-aria-describedby="fieldErrorId">
1925
1928
  <label data-tpl-for="id" class="form-check-label">{{{{ slots.default }}}}</label>
1926
1929
  </div>
1927
1930
  <ful-field-error data-tpl-if="fieldErrorId"></ful-field-error>