@wrrdev/fenix-ui 1.1.7 → 1.1.8

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.
@@ -5,8 +5,8 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
5
5
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
6
6
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
7
7
  var _FxToast_instances, render_fn;
8
- import { a as FENIX_ICON_BASE_CSS, f as fenixIconHtml, e as esc, i as isFenixIconName } from "./assets/base-css-Be_r8aTo.js";
9
- import { s, b } from "./assets/base-css-Be_r8aTo.js";
8
+ import { a as FENIX_ICON_BASE_CSS, f as fenixIconHtml, e as esc, i as isFenixIconName, l as loadFenixIconsFont } from "./assets/font-CF0TXsAP.js";
9
+ import { s, g } from "./assets/font-CF0TXsAP.js";
10
10
  const lightTokens = {
11
11
  color: {
12
12
  primary: "#c2410c",
@@ -1967,9 +1967,9 @@ const _FxCalendar = class _FxCalendar extends FxElement {
1967
1967
  <div class="grid ${this.view}">${cells}</div>
1968
1968
  `);
1969
1969
  this.root.querySelectorAll("[data-nav]").forEach(
1970
- (b2) => b2.addEventListener(
1970
+ (b) => b.addEventListener(
1971
1971
  "click",
1972
- () => this.navigate(Number(b2.dataset.nav))
1972
+ () => this.navigate(Number(b.dataset.nav))
1973
1973
  )
1974
1974
  );
1975
1975
  const gotoBtn = this.root.querySelector("[data-goto]");
@@ -1978,21 +1978,21 @@ const _FxCalendar = class _FxCalendar extends FxElement {
1978
1978
  this.render();
1979
1979
  });
1980
1980
  this.root.querySelectorAll("[data-day]").forEach(
1981
- (b2) => b2.addEventListener(
1981
+ (b) => b.addEventListener(
1982
1982
  "click",
1983
- () => this.pickDay(Number(b2.dataset.day))
1983
+ () => this.pickDay(Number(b.dataset.day))
1984
1984
  )
1985
1985
  );
1986
1986
  this.root.querySelectorAll("[data-month]").forEach(
1987
- (b2) => b2.addEventListener("click", () => {
1988
- this.cursor.m = Number(b2.dataset.month);
1987
+ (b) => b.addEventListener("click", () => {
1988
+ this.cursor.m = Number(b.dataset.month);
1989
1989
  this.view = "days";
1990
1990
  this.render();
1991
1991
  })
1992
1992
  );
1993
1993
  this.root.querySelectorAll("[data-year]").forEach(
1994
- (b2) => b2.addEventListener("click", () => {
1995
- this.cursor.y = Number(b2.dataset.year);
1994
+ (b) => b.addEventListener("click", () => {
1995
+ this.cursor.y = Number(b.dataset.year);
1996
1996
  this.view = "months";
1997
1997
  this.render();
1998
1998
  })
@@ -2403,7 +2403,7 @@ const _FxDatepicker = class _FxDatepicker extends FxElement {
2403
2403
  if (Number.isNaN(d.getTime())) return null;
2404
2404
  const [y, m, day] = iso.split("-").map((n) => parseInt(n, 10));
2405
2405
  if (d.getFullYear() !== y || d.getMonth() + 1 !== m || d.getDate() !== day) return null;
2406
- const cmp = (a, b2) => a.split("T")[0].localeCompare(b2.split("T")[0]);
2406
+ const cmp = (a, b) => a.split("T")[0].localeCompare(b.split("T")[0]);
2407
2407
  const min = this.getAttr("min");
2408
2408
  const max = this.getAttr("max");
2409
2409
  if (min && cmp(iso, min) < 0) return null;
@@ -2430,9 +2430,9 @@ const _FxDatepicker = class _FxDatepicker extends FxElement {
2430
2430
  this.setAttribute("start", this.withTime(parsed));
2431
2431
  this.removeAttribute("end");
2432
2432
  } else {
2433
- const [a, b2] = [this.getAttr("start").split("T")[0], parsed].sort();
2433
+ const [a, b] = [this.getAttr("start").split("T")[0], parsed].sort();
2434
2434
  this.setAttribute("start", this.withTime(a));
2435
- this.setAttribute("end", this.withTime(b2));
2435
+ this.setAttribute("end", this.withTime(b));
2436
2436
  }
2437
2437
  this.emitChange({ start: this.getAttr("start"), end: this.getAttr("end") });
2438
2438
  } else {
@@ -3399,8 +3399,8 @@ const _FxTable = class _FxTable extends FxElement {
3399
3399
  }
3400
3400
  const total = this.lazy ? this.total : out.length;
3401
3401
  if (this.sortField) {
3402
- out.sort((a, b2) => {
3403
- const av = a[this.sortField], bv = b2[this.sortField];
3402
+ out.sort((a, b) => {
3403
+ const av = a[this.sortField], bv = b[this.sortField];
3404
3404
  if (typeof av === "number" && typeof bv === "number")
3405
3405
  return (av - bv) * this.sortDir;
3406
3406
  return String(av ?? "").localeCompare(String(bv ?? ""), "pt-BR") * this.sortDir;
@@ -5465,6 +5465,75 @@ function defineFxAvatar() {
5465
5465
  return defineElement("fx-avatar", FxAvatar);
5466
5466
  }
5467
5467
  defineFxAvatar();
5468
+ const _FxIcon = class _FxIcon extends FxElement {
5469
+ static get observedAttributes() {
5470
+ return ["name", "size", "label", "fill", "bold"];
5471
+ }
5472
+ /** Nome do glifo (ou texto livre/emoji). */
5473
+ get name() {
5474
+ return this.getAttr("name");
5475
+ }
5476
+ set name(value) {
5477
+ this.setAttribute("name", value);
5478
+ }
5479
+ /** Tamanho: '' (herda 1em) | 'sm' | 'md' | 'lg' | 'xl'. */
5480
+ get size() {
5481
+ return this.getAttr("size");
5482
+ }
5483
+ set size(value) {
5484
+ if (value) this.setAttribute("size", value);
5485
+ else this.removeAttribute("size");
5486
+ }
5487
+ /** Nome acessível; vazio = ícone decorativo (aria-hidden). */
5488
+ get label() {
5489
+ return this.getAttr("label");
5490
+ }
5491
+ set label(value) {
5492
+ if (value) this.setAttribute("label", value);
5493
+ else this.removeAttribute("label");
5494
+ }
5495
+ connectedCallback() {
5496
+ loadFenixIconsFont();
5497
+ super.connectedCallback();
5498
+ }
5499
+ render() {
5500
+ const name = this.getAttr("name").trim();
5501
+ const label = this.getAttr("label").trim();
5502
+ const a11y = label ? `role="img" aria-label="${esc(label)}"` : 'aria-hidden="true"';
5503
+ if (!name) {
5504
+ this.setTemplate(`<span class="icon" part="icon" ${a11y}></span>`);
5505
+ return;
5506
+ }
5507
+ const inner = isFenixIconName(name) ? `<i class="icon fx-icon" part="icon" ${a11y}>${esc(name)}</i>` : `<span class="icon" part="icon" ${a11y}>${esc(name)}</span>`;
5508
+ this.setTemplate(inner);
5509
+ }
5510
+ };
5511
+ _FxIcon.styles = css`
5512
+ :host {
5513
+ display: inline-flex;
5514
+ align-items: center;
5515
+ justify-content: center;
5516
+ vertical-align: middle;
5517
+ line-height: 1;
5518
+ color: currentColor;
5519
+ font-size: var(--fx-icon-size, 1em);
5520
+ }
5521
+ :host([size='sm']) { font-size: var(--fx-icon-size-sm, 16px); }
5522
+ :host([size='md']) { font-size: var(--fx-icon-size-md, 20px); }
5523
+ :host([size='lg']) { font-size: var(--fx-icon-size-lg, 24px); }
5524
+ :host([size='xl']) { font-size: var(--fx-icon-size-xl, 32px); }
5525
+ :host([hidden]) { display: none; }
5526
+ .icon { display: inline-block; }
5527
+ /* Variantes da fonte (FILL/wght): vencem a classe base .fx-icon. */
5528
+ :host([fill]) .icon { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
5529
+ :host([bold]) .icon { font-variation-settings: 'FILL' 0, 'wght' 600, 'GRAD' 0, 'opsz' 24; }
5530
+ ${FENIX_ICON_BASE_CSS}
5531
+ `;
5532
+ let FxIcon = _FxIcon;
5533
+ function defineFxIcon() {
5534
+ return defineElement("fx-icon", FxIcon);
5535
+ }
5536
+ defineFxIcon();
5468
5537
  const _FxCard = class _FxCard extends FxElement {
5469
5538
  static get observedAttributes() {
5470
5539
  return ["variant", "radius", "size", "padded", "heading"];
@@ -9451,7 +9520,7 @@ const _FxOrderList = class _FxOrderList extends FxElement {
9451
9520
  _handleMoveAction(action) {
9452
9521
  if (!this._selection.length) return;
9453
9522
  const displayData = this._getDisplayData();
9454
- const selectedIndices = this._selection.map((s2) => displayData.findIndex((d) => this._getItemKey(d, -1) === this._getItemKey(s2, -1))).filter((i) => i >= 0).sort((a, b2) => a - b2);
9523
+ const selectedIndices = this._selection.map((s2) => displayData.findIndex((d) => this._getItemKey(d, -1) === this._getItemKey(s2, -1))).filter((i) => i >= 0).sort((a, b) => a - b);
9455
9524
  if (selectedIndices.length === 0) return;
9456
9525
  switch (action) {
9457
9526
  case "top":
@@ -9476,7 +9545,7 @@ const _FxOrderList = class _FxOrderList extends FxElement {
9476
9545
  items.push(this._data[actualIdx]);
9477
9546
  actualIndices.push(actualIdx);
9478
9547
  }
9479
- actualIndices.sort((a, b2) => b2 - a).forEach((i) => this._data.splice(i, 1));
9548
+ actualIndices.sort((a, b) => b - a).forEach((i) => this._data.splice(i, 1));
9480
9549
  const insertIdx = this._getActualIndex(0);
9481
9550
  this._data.splice(insertIdx, 0, ...items);
9482
9551
  this._applyFilter();
@@ -9492,7 +9561,7 @@ const _FxOrderList = class _FxOrderList extends FxElement {
9492
9561
  items.push(this._data[actualIdx]);
9493
9562
  actualIndices.push(actualIdx);
9494
9563
  }
9495
- actualIndices.sort((a, b2) => b2 - a).forEach((i) => this._data.splice(i, 1));
9564
+ actualIndices.sort((a, b) => b - a).forEach((i) => this._data.splice(i, 1));
9496
9565
  const displayData = this._getDisplayData();
9497
9566
  const insertIdx = this._getActualIndex(displayData.length - 1);
9498
9567
  this._data.splice(insertIdx + 1, 0, ...items);
@@ -9504,7 +9573,7 @@ const _FxOrderList = class _FxOrderList extends FxElement {
9504
9573
  _moveSelectedByOne(indices, delta) {
9505
9574
  const displayData = this._getDisplayData();
9506
9575
  if (displayData.length === 0) return;
9507
- const actualIndices = indices.map((idx) => this._getActualIndex(idx)).filter((idx) => idx >= 0).sort((a, b2) => a - b2);
9576
+ const actualIndices = indices.map((idx) => this._getActualIndex(idx)).filter((idx) => idx >= 0).sort((a, b) => a - b);
9508
9577
  if (actualIndices.length === 0) return;
9509
9578
  if (delta < 0 && actualIndices[0] <= 0) return;
9510
9579
  if (delta > 0 && actualIndices[actualIndices.length - 1] >= this._data.length - 1) return;
@@ -10676,6 +10745,7 @@ export {
10676
10745
  FxEmptyState,
10677
10746
  FxFileUpload,
10678
10747
  FxFloatlabel,
10748
+ FxIcon,
10679
10749
  FxInput,
10680
10750
  FxKnob,
10681
10751
  FxMenu,
@@ -10722,7 +10792,7 @@ export {
10722
10792
  resetTheme,
10723
10793
  s as sanitizeData,
10724
10794
  setTokens,
10725
- b as stripTags,
10795
+ g as stripTags,
10726
10796
  theme,
10727
10797
  themePresets,
10728
10798
  tokenCssVars