@wrrdev/fenix-ui 1.1.3 → 1.1.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/README.md +2 -2
- package/dist/assets/base-css-Be_r8aTo.js +74 -0
- package/dist/assets/base-css-Be_r8aTo.js.map +1 -0
- package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/autocomplete.js +21 -7
- package/dist/components/autocomplete/autocomplete.js.map +1 -1
- package/dist/components/button/button.d.ts +4 -2
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/button.js +29 -9
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/chip/chip.d.ts.map +1 -1
- package/dist/components/chip/chip.js +4 -2
- package/dist/components/chip/chip.js.map +1 -1
- package/dist/components/confirmpopup/confirmpopup.d.ts.map +1 -1
- package/dist/components/confirmpopup/confirmpopup.js +2 -0
- package/dist/components/confirmpopup/confirmpopup.js.map +1 -1
- package/dist/components/datepicker/datepicker.d.ts.map +1 -1
- package/dist/components/datepicker/datepicker.js +5 -1
- package/dist/components/datepicker/datepicker.js.map +1 -1
- package/dist/components/dialog/dialog.d.ts.map +1 -1
- package/dist/components/dialog/dialog.js +2 -0
- package/dist/components/dialog/dialog.js.map +1 -1
- package/dist/components/empty-state/empty-state.d.ts.map +1 -1
- package/dist/components/empty-state/empty-state.js +4 -1
- package/dist/components/empty-state/empty-state.js.map +1 -1
- package/dist/components/fileupload/fileupload.d.ts.map +1 -1
- package/dist/components/fileupload/fileupload.js +10 -3
- package/dist/components/fileupload/fileupload.js.map +1 -1
- package/dist/components/floatlabel/floatlabel.d.ts +8 -0
- package/dist/components/floatlabel/floatlabel.d.ts.map +1 -1
- package/dist/components/floatlabel/floatlabel.js +66 -3
- package/dist/components/floatlabel/floatlabel.js.map +1 -1
- package/dist/components/input/input.d.ts +4 -1
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/input/input.js +68 -2
- package/dist/components/input/input.js.map +1 -1
- package/dist/components/multiselect/multiselect.d.ts.map +1 -1
- package/dist/components/multiselect/multiselect.js +4 -1
- package/dist/components/multiselect/multiselect.js.map +1 -1
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/popover/popover.js +2 -0
- package/dist/components/popover/popover.js.map +1 -1
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/select/select.js +5 -1
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/textarea/textarea.d.ts.map +1 -1
- package/dist/components/textarea/textarea.js +5 -2
- package/dist/components/textarea/textarea.js.map +1 -1
- package/dist/core/jsx.d.ts +25 -0
- package/dist/core/jsx.d.ts.map +1 -1
- package/dist/core/jsx.js.map +1 -1
- package/dist/core/vue.d.ts +3 -1
- package/dist/core/vue.d.ts.map +1 -1
- package/dist/core/vue.js.map +1 -1
- package/dist/docs/app.d.ts.map +1 -1
- package/dist/docs/componentes/alert.doc.d.ts.map +1 -1
- package/dist/docs/componentes/autocomplete.doc.d.ts.map +1 -1
- package/dist/docs/componentes/button.doc.d.ts.map +1 -1
- package/dist/docs/componentes/confirmpopup.doc.d.ts.map +1 -1
- package/dist/docs/componentes/datepicker.doc.d.ts.map +1 -1
- package/dist/docs/componentes/fileupload.doc.d.ts.map +1 -1
- package/dist/docs/componentes/floatlabel.doc.d.ts.map +1 -1
- package/dist/docs/componentes/input.doc.d.ts.map +1 -1
- package/dist/docs/componentes/multiselect.doc.d.ts.map +1 -1
- package/dist/docs/componentes/select.doc.d.ts.map +1 -1
- package/dist/docs/componentes/textarea.doc.d.ts.map +1 -1
- package/dist/fenix-ui.esm.js.map +1 -1
- package/dist/fenix-ui.umd.min.js +342 -218
- package/dist/fenix-ui2.esm.js +2 -2
- package/dist/fenix-ui3.esm.js +308 -147
- package/dist/fenix-ui3.esm.js.map +1 -1
- package/dist/icons/base-css.d.ts +16 -0
- package/dist/icons/base-css.d.ts.map +1 -1
- package/dist/icons/base-css.js +10 -0
- package/dist/icons/base-css.js.map +1 -1
- package/package.json +1 -1
- package/dist/assets/base-css-BifSeW2H.js +0 -31
- package/dist/assets/base-css-BifSeW2H.js.map +0 -1
package/dist/fenix-ui3.esm.js
CHANGED
|
@@ -5,7 +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, i as isFenixIconName } from "./assets/base-css-
|
|
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";
|
|
9
10
|
const lightTokens = {
|
|
10
11
|
color: {
|
|
11
12
|
primary: "#c2410c",
|
|
@@ -306,37 +307,6 @@ function defineElement(tag, ctor) {
|
|
|
306
307
|
}
|
|
307
308
|
return customElements.get(tag) ?? ctor;
|
|
308
309
|
}
|
|
309
|
-
const HTML_ENTITIES = {
|
|
310
|
-
"&": "&",
|
|
311
|
-
"<": "<",
|
|
312
|
-
">": ">",
|
|
313
|
-
'"': """,
|
|
314
|
-
"'": "'",
|
|
315
|
-
"/": "/",
|
|
316
|
-
"`": "`",
|
|
317
|
-
"=": "="
|
|
318
|
-
};
|
|
319
|
-
const SANITIZE_REGEX = /[&<>"'`=/]/g;
|
|
320
|
-
function esc(value) {
|
|
321
|
-
if (value == null) return "";
|
|
322
|
-
return String(value).replace(SANITIZE_REGEX, (char) => HTML_ENTITIES[char] || char);
|
|
323
|
-
}
|
|
324
|
-
function stripTags(html) {
|
|
325
|
-
return html.replace(/<[^>]*>/g, "");
|
|
326
|
-
}
|
|
327
|
-
function sanitizeData(data) {
|
|
328
|
-
if (data == null) return data;
|
|
329
|
-
if (typeof data === "string") return esc(data);
|
|
330
|
-
if (Array.isArray(data)) return data.map(sanitizeData);
|
|
331
|
-
if (typeof data === "object") {
|
|
332
|
-
const result = {};
|
|
333
|
-
for (const [key2, value] of Object.entries(data)) {
|
|
334
|
-
result[key2] = sanitizeData(value);
|
|
335
|
-
}
|
|
336
|
-
return result;
|
|
337
|
-
}
|
|
338
|
-
return data;
|
|
339
|
-
}
|
|
340
310
|
const FX_JSX_TYPES = true;
|
|
341
311
|
const _FxButton = class _FxButton extends FxElement {
|
|
342
312
|
constructor() {
|
|
@@ -359,12 +329,12 @@ const _FxButton = class _FxButton extends FxElement {
|
|
|
359
329
|
};
|
|
360
330
|
}
|
|
361
331
|
static get observedAttributes() {
|
|
362
|
-
return ["variant", "size", "disabled", "loading", "type", "full"];
|
|
332
|
+
return ["variant", "size", "disabled", "loading", "type", "full", "icon", "icon-pos"];
|
|
363
333
|
}
|
|
364
334
|
/** Tamanho. Padrão: `'md'`. */
|
|
365
335
|
get size() {
|
|
366
|
-
const
|
|
367
|
-
return
|
|
336
|
+
const s2 = this.getAttr("size", "md");
|
|
337
|
+
return s2 === "sm" || s2 === "lg" ? s2 : "md";
|
|
368
338
|
}
|
|
369
339
|
set size(value) {
|
|
370
340
|
this.setAttribute("size", value);
|
|
@@ -385,21 +355,28 @@ const _FxButton = class _FxButton extends FxElement {
|
|
|
385
355
|
const loading = this.hasAttr("loading");
|
|
386
356
|
const disabled = this.hasAttr("disabled") || loading;
|
|
387
357
|
const btnType = this.getAttr("type", "button");
|
|
358
|
+
const icon = this.getAttr("icon");
|
|
359
|
+
const iconRight = this.getAttr("icon-pos", "left") === "right";
|
|
360
|
+
const slottedIcon = this.querySelector('[slot="icon"]');
|
|
361
|
+
const iconContent = slottedIcon ? '<slot name="icon"></slot>' : icon ? fenixIconHtml(icon) : "";
|
|
388
362
|
this.setTemplate(`
|
|
389
363
|
<button class="btn" part="button" type="${btnType}">
|
|
390
|
-
|
|
364
|
+
${!iconRight ? `<span class="btn__icon" part="icon">${iconContent}</span>` : ""}
|
|
391
365
|
<span class="btn__label" part="label"><slot></slot></span>
|
|
366
|
+
${iconRight ? `<span class="btn__icon" part="icon">${iconContent}</span>` : ""}
|
|
392
367
|
${loading ? '<span class="btn__spinner" aria-hidden="true"></span>' : ""}
|
|
393
368
|
</button>
|
|
394
369
|
`);
|
|
395
370
|
const btn = this.root.querySelector(".btn");
|
|
396
371
|
if (!btn) return;
|
|
397
|
-
const
|
|
398
|
-
const
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
372
|
+
const hasIcon = iconContent.trim() !== "";
|
|
373
|
+
for (const wrap of this.root.querySelectorAll(".btn__icon")) {
|
|
374
|
+
wrap.toggleAttribute("hidden", !hasIcon);
|
|
375
|
+
}
|
|
376
|
+
const hasLabel = [...this.childNodes ?? []].some(
|
|
377
|
+
(n) => n.nodeType === Node.ELEMENT_NODE ? n.getAttribute?.("slot") !== "icon" : (n.textContent ?? "").trim() !== ""
|
|
378
|
+
);
|
|
379
|
+
btn.classList.toggle("btn--icon-only", !hasLabel && hasIcon);
|
|
403
380
|
if (disabled) {
|
|
404
381
|
btn.setAttribute("disabled", "");
|
|
405
382
|
btn.setAttribute("aria-disabled", "true");
|
|
@@ -420,10 +397,18 @@ const _FxButton = class _FxButton extends FxElement {
|
|
|
420
397
|
}
|
|
421
398
|
};
|
|
422
399
|
_FxButton.styles = css`
|
|
400
|
+
${FENIX_ICON_BASE_CSS}
|
|
423
401
|
:host {
|
|
424
402
|
display: inline-block;
|
|
425
403
|
vertical-align: middle;
|
|
426
404
|
}
|
|
405
|
+
/* Full width: o host inline-block é shrink-to-fit, então precisa virar
|
|
406
|
+
block para o 100% do .btn interno ter contra o que esticar. */
|
|
407
|
+
:host([full]) {
|
|
408
|
+
display: block;
|
|
409
|
+
width: 100%;
|
|
410
|
+
max-width: 100%;
|
|
411
|
+
}
|
|
427
412
|
.btn {
|
|
428
413
|
display: inline-flex;
|
|
429
414
|
align-items: center;
|
|
@@ -475,9 +460,13 @@ _FxButton.styles = css`
|
|
|
475
460
|
:host([variant='outline']) .btn:hover { background: var(--fx-surface-surface-hover); filter: none; }
|
|
476
461
|
|
|
477
462
|
/* Ícone e spinner */
|
|
478
|
-
.btn__icon { display: inline-flex; }
|
|
463
|
+
.btn__icon { display: inline-flex; align-items: center; font-size: var(--fx-button-icon-size, calc(var(--fx-font-size) + 6px)); line-height: 1; }
|
|
479
464
|
.btn__icon[hidden] { display: none; }
|
|
480
465
|
.btn__label { display: inline-flex; align-items: center; justify-content: center; }
|
|
466
|
+
/* Icon-only: a label some (o gap do flex some junto) e o botão vira
|
|
467
|
+
quadrado com padding simétrico — ícone perfeitamente centralizado. */
|
|
468
|
+
.btn--icon-only { padding-left: var(--fx-space-md); padding-right: var(--fx-space-md); }
|
|
469
|
+
.btn--icon-only .btn__label { display: none; }
|
|
481
470
|
.btn[hidden] { display: none; }
|
|
482
471
|
.btn__spinner {
|
|
483
472
|
width: 1em;
|
|
@@ -571,8 +560,8 @@ const _FxSpinner = class _FxSpinner extends FxElement {
|
|
|
571
560
|
}
|
|
572
561
|
/** Tamanho do spinner. Padrão: `'md'`. */
|
|
573
562
|
get size() {
|
|
574
|
-
const
|
|
575
|
-
return
|
|
563
|
+
const s2 = this.getAttr("size", "md");
|
|
564
|
+
return s2 === "sm" || s2 === "lg" ? s2 : "md";
|
|
576
565
|
}
|
|
577
566
|
set size(value) {
|
|
578
567
|
this.setAttribute("size", value);
|
|
@@ -612,12 +601,12 @@ const _FxSelect = class _FxSelect extends FxElement {
|
|
|
612
601
|
// `value` fica FORA da observação: refleti-lo no change não pode
|
|
613
602
|
// re-renderizar o template e fechar o dropdown.
|
|
614
603
|
static get observedAttributes() {
|
|
615
|
-
return ["size", "disabled", "placeholder", "searchable", "clearable", "error", "success"];
|
|
604
|
+
return ["size", "disabled", "placeholder", "searchable", "clearable", "error", "invalid", "success", "valid"];
|
|
616
605
|
}
|
|
617
606
|
/** Tamanho do campo. Padrão: `'md'`. */
|
|
618
607
|
get size() {
|
|
619
|
-
const
|
|
620
|
-
return
|
|
608
|
+
const s2 = this.getAttr("size", "md");
|
|
609
|
+
return s2 === "sm" || s2 === "lg" ? s2 : "md";
|
|
621
610
|
}
|
|
622
611
|
set size(value) {
|
|
623
612
|
this.setAttribute("size", value);
|
|
@@ -808,6 +797,10 @@ _FxSelect.styles = css`
|
|
|
808
797
|
}
|
|
809
798
|
:host([size='sm']) .trigger { min-width: 180px; min-height: var(--fx-size-sm); }
|
|
810
799
|
:host([size='lg']) .trigger { min-height: var(--fx-size-lg); font-size: calc(var(--fx-font-size) + 4px); }
|
|
800
|
+
/* Full width: o host estica até o pai e o trigger acompanha. */
|
|
801
|
+
:host([full]) { display: block; width: 100%; }
|
|
802
|
+
:host([full]) .trigger { width: 100%; min-width: 0; }
|
|
803
|
+
:host([full]) .panel { width: 100%; }
|
|
811
804
|
/* Validação */
|
|
812
805
|
:host([error]) .trigger,
|
|
813
806
|
:host([invalid]) .trigger {
|
|
@@ -921,6 +914,8 @@ defineFxSelect();
|
|
|
921
914
|
const _FxInput = class _FxInput extends FxElement {
|
|
922
915
|
// `value` fica FORA da observação: refleti-lo a cada tecla não pode
|
|
923
916
|
// re-renderizar o template, senão o campo perde o foco ao digitar.
|
|
917
|
+
// `error`/`success` (+ aliases `invalid`/`valid`) PRECISAM ser observados:
|
|
918
|
+
// é assim que o toggle no playground / setAttribute no submit re-renderiza.
|
|
924
919
|
static get observedAttributes() {
|
|
925
920
|
return [
|
|
926
921
|
"type",
|
|
@@ -930,13 +925,19 @@ const _FxInput = class _FxInput extends FxElement {
|
|
|
930
925
|
"readonly",
|
|
931
926
|
"min",
|
|
932
927
|
"max",
|
|
933
|
-
"step"
|
|
928
|
+
"step",
|
|
929
|
+
"icon",
|
|
930
|
+
"icon-pos",
|
|
931
|
+
"error",
|
|
932
|
+
"invalid",
|
|
933
|
+
"success",
|
|
934
|
+
"valid"
|
|
934
935
|
];
|
|
935
936
|
}
|
|
936
937
|
/** Tamanho do campo. Padrão: `'md'`. */
|
|
937
938
|
get size() {
|
|
938
|
-
const
|
|
939
|
-
return
|
|
939
|
+
const s2 = this.getAttr("size", "md");
|
|
940
|
+
return s2 === "sm" || s2 === "lg" ? s2 : "md";
|
|
940
941
|
}
|
|
941
942
|
set size(value) {
|
|
942
943
|
this.setAttribute("size", value);
|
|
@@ -961,12 +962,21 @@ const _FxInput = class _FxInput extends FxElement {
|
|
|
961
962
|
const min = this.getAttr("min");
|
|
962
963
|
const max = this.getAttr("max");
|
|
963
964
|
const step = this.getAttr("step");
|
|
965
|
+
const icon = this.getAttr("icon");
|
|
966
|
+
const iconPos = this.getAttr("icon-pos", "left") === "right" ? "right" : "left";
|
|
967
|
+
const slottedIcon = this.querySelector('[slot="icon"]');
|
|
968
|
+
const iconContent = slottedIcon ? '<slot name="icon" part="icon"></slot>' : icon ? fenixIconHtml(icon) : "";
|
|
969
|
+
const useIconBox = Boolean(iconContent);
|
|
964
970
|
this.setTemplate(`
|
|
965
|
-
${this.hasAttr("clearable") ? '<div class="wrap">' : ""}
|
|
971
|
+
${this.hasAttr("clearable") ? '<div class="wrap" part="wrap">' : ""}
|
|
972
|
+
${useIconBox ? `<div class="field-icon icon-${iconPos}">` : ""}
|
|
973
|
+
${useIconBox && iconPos === "left" ? iconContent : ""}
|
|
966
974
|
<input class="field" part="input" type="${esc(type)}"
|
|
967
975
|
${placeholder ? `placeholder="${esc(placeholder)}"` : ""}
|
|
968
976
|
${min ? `min="${esc(min)}"` : ""} ${max ? `max="${esc(max)}"` : ""} ${step ? `step="${esc(step)}"` : ""}
|
|
969
977
|
/>
|
|
978
|
+
${useIconBox && iconPos === "right" ? iconContent : ""}
|
|
979
|
+
${useIconBox ? "</div>" : ""}
|
|
970
980
|
${this.hasAttr("clearable") ? '<button type="button" class="clear" part="clear" aria-label="Limpar" tabindex="-1">×</button></div>' : ""}
|
|
971
981
|
`);
|
|
972
982
|
const field = this.root.querySelector(".field");
|
|
@@ -1056,10 +1066,56 @@ _FxInput.styles = css`
|
|
|
1056
1066
|
}
|
|
1057
1067
|
:host([size='sm']) .field { padding: var(--fx-space-sm) var(--fx-space-md); font-size: var(--fx-font-size); width: 220px; min-height: var(--fx-size-sm); }
|
|
1058
1068
|
:host([size='lg']) .field { padding: var(--fx-space-lg) var(--fx-space-xl); font-size: calc(var(--fx-font-size) + 4px); width: 300px; min-height: var(--fx-size-lg); }
|
|
1069
|
+
/* Full width: o host estica até o pai e o campo interno acompanha
|
|
1070
|
+
(usar com um container de largura controlada, ex. w-full no Vue). */
|
|
1071
|
+
:host([full]) { display: block; width: 100%; }
|
|
1072
|
+
:host([full]) .field { width: 100%; }
|
|
1059
1073
|
/* Clearable */
|
|
1060
1074
|
:host([clearable]) { position: relative; display: inline-flex; }
|
|
1075
|
+
:host([clearable][full]) { display: block; }
|
|
1061
1076
|
.wrap { position: relative; display: inline-flex; align-items: center; }
|
|
1077
|
+
:host([full]) .wrap { display: flex; width: 100%; }
|
|
1062
1078
|
:host([clearable]) .field { padding-right: var(--fx-space-xl); }
|
|
1079
|
+
:host([clearable][full]) .field { flex: 1 1 auto; }
|
|
1080
|
+
/* Ícones (attr icon + slot icon) — DENTRO do campo, sobre o padding
|
|
1081
|
+
(padrão Material/PrimeVue). Tamanho ajustável via --fx-input-icon-size. */
|
|
1082
|
+
.field-icon {
|
|
1083
|
+
position: relative;
|
|
1084
|
+
display: inline-flex;
|
|
1085
|
+
box-sizing: border-box;
|
|
1086
|
+
}
|
|
1087
|
+
.field-icon .field { flex: 1 1 auto; min-width: 0; }
|
|
1088
|
+
:host([full]) .field-icon { display: flex; width: 100%; }
|
|
1089
|
+
.field-icon .fx-icon,
|
|
1090
|
+
.field-icon ::slotted([slot='icon']) {
|
|
1091
|
+
position: absolute;
|
|
1092
|
+
top: 50%;
|
|
1093
|
+
transform: translateY(-50%);
|
|
1094
|
+
display: inline-flex;
|
|
1095
|
+
align-items: center;
|
|
1096
|
+
justify-content: center;
|
|
1097
|
+
font-size: var(--fx-input-icon-size, calc(var(--fx-font-size) + 6px));
|
|
1098
|
+
line-height: 1;
|
|
1099
|
+
color: var(--fx-text-muted);
|
|
1100
|
+
pointer-events: none;
|
|
1101
|
+
z-index: 1;
|
|
1102
|
+
}
|
|
1103
|
+
.field-icon.icon-left .fx-icon,
|
|
1104
|
+
.field-icon.icon-left ::slotted([slot='icon']) { left: var(--fx-space-md); }
|
|
1105
|
+
.field-icon.icon-right .fx-icon,
|
|
1106
|
+
.field-icon.icon-right ::slotted([slot='icon']) { right: var(--fx-space-md); }
|
|
1107
|
+
/* padding = posição do ícone + largura + folga extra para o texto
|
|
1108
|
+
não colar no glifo. */
|
|
1109
|
+
.field-icon.icon-left .field {
|
|
1110
|
+
padding-left: calc(var(--fx-input-icon-size, calc(var(--fx-font-size) + 6px)) + var(--fx-space-md) + var(--fx-space-sm));
|
|
1111
|
+
}
|
|
1112
|
+
.field-icon.icon-right .field {
|
|
1113
|
+
padding-right: calc(var(--fx-input-icon-size, calc(var(--fx-font-size) + 6px)) + var(--fx-space-md) + var(--fx-space-sm));
|
|
1114
|
+
}
|
|
1115
|
+
/* icon-pos right + clearable: desloca o × para não sobrepor o ícone. */
|
|
1116
|
+
.field-icon.icon-right + .clear {
|
|
1117
|
+
right: calc(var(--fx-input-icon-size, calc(var(--fx-font-size) + 6px)) + var(--fx-space-lg));
|
|
1118
|
+
}
|
|
1063
1119
|
.clear {
|
|
1064
1120
|
position: absolute;
|
|
1065
1121
|
right: var(--fx-space-xs);
|
|
@@ -1074,6 +1130,8 @@ _FxInput.styles = css`
|
|
|
1074
1130
|
}
|
|
1075
1131
|
.clear:hover { color: var(--fx-color-danger); }
|
|
1076
1132
|
.clear[hidden] { display: none; }
|
|
1133
|
+
/* Base dos glifos Fenix Icons (o @font-face vem de @wrrdev/fenix-ui/icons). */
|
|
1134
|
+
${FENIX_ICON_BASE_CSS}
|
|
1077
1135
|
`;
|
|
1078
1136
|
let FxInput = _FxInput;
|
|
1079
1137
|
function defineFxInput() {
|
|
@@ -1086,8 +1144,8 @@ const _FxSwitch = class _FxSwitch extends FxElement {
|
|
|
1086
1144
|
}
|
|
1087
1145
|
/** Tamanho da trilha. Padrão: `'md'`. */
|
|
1088
1146
|
get size() {
|
|
1089
|
-
const
|
|
1090
|
-
return
|
|
1147
|
+
const s2 = this.getAttr("size", "md");
|
|
1148
|
+
return s2 === "sm" || s2 === "lg" ? s2 : "md";
|
|
1091
1149
|
}
|
|
1092
1150
|
set size(value) {
|
|
1093
1151
|
this.setAttribute("size", value);
|
|
@@ -1194,7 +1252,7 @@ const _FxMultiselect = class _FxMultiselect extends FxElement {
|
|
|
1194
1252
|
this.selected = /* @__PURE__ */ new Set();
|
|
1195
1253
|
}
|
|
1196
1254
|
static get observedAttributes() {
|
|
1197
|
-
return ["disabled", "placeholder"];
|
|
1255
|
+
return ["disabled", "placeholder", "error", "invalid", "success", "valid"];
|
|
1198
1256
|
}
|
|
1199
1257
|
/** Valores selecionados (CSV no atributo / array na propriedade). */
|
|
1200
1258
|
get values() {
|
|
@@ -1416,6 +1474,9 @@ _FxMultiselect.styles = css`
|
|
|
1416
1474
|
}
|
|
1417
1475
|
:host([size='sm']) .trigger { min-height: var(--fx-size-sm); width: 200px; }
|
|
1418
1476
|
:host([size='lg']) .trigger { min-height: var(--fx-size-lg); width: 280px; font-size: calc(var(--fx-font-size) + 4px); }
|
|
1477
|
+
/* Full width: o host estica até o pai e o trigger acompanha. */
|
|
1478
|
+
:host([full]) { display: block; width: 100%; }
|
|
1479
|
+
:host([full]) .trigger { width: 100%; }
|
|
1419
1480
|
/* Validação */
|
|
1420
1481
|
:host([error]) .trigger,
|
|
1421
1482
|
:host([invalid]) .trigger {
|
|
@@ -1715,13 +1776,13 @@ const _FxCalendar = class _FxCalendar extends FxElement {
|
|
|
1715
1776
|
this.values.map((iso) => parseBound(iso)?.lo ?? 0).filter(Boolean)
|
|
1716
1777
|
);
|
|
1717
1778
|
if (this.mode === "range") {
|
|
1718
|
-
let
|
|
1779
|
+
let s2 = this.pickStart;
|
|
1719
1780
|
let e = this.pickEnd;
|
|
1720
1781
|
const attrS = parseBound(this.getAttr("start", ""));
|
|
1721
1782
|
const attrE = parseBound(this.getAttr("end", ""));
|
|
1722
|
-
if (
|
|
1783
|
+
if (s2 === null && attrS) s2 = attrS.lo;
|
|
1723
1784
|
if (e === null && attrE) e = attrE.lo;
|
|
1724
|
-
return { start:
|
|
1785
|
+
return { start: s2, end: e, single: null, multi };
|
|
1725
1786
|
}
|
|
1726
1787
|
if (this.mode === "multiple") {
|
|
1727
1788
|
return { start: null, end: null, single: null, multi };
|
|
@@ -1844,9 +1905,9 @@ const _FxCalendar = class _FxCalendar extends FxElement {
|
|
|
1844
1905
|
<div class="grid ${this.view}">${cells}</div>
|
|
1845
1906
|
`);
|
|
1846
1907
|
this.root.querySelectorAll("[data-nav]").forEach(
|
|
1847
|
-
(
|
|
1908
|
+
(b2) => b2.addEventListener(
|
|
1848
1909
|
"click",
|
|
1849
|
-
() => this.navigate(Number(
|
|
1910
|
+
() => this.navigate(Number(b2.dataset.nav))
|
|
1850
1911
|
)
|
|
1851
1912
|
);
|
|
1852
1913
|
const gotoBtn = this.root.querySelector("[data-goto]");
|
|
@@ -1855,21 +1916,21 @@ const _FxCalendar = class _FxCalendar extends FxElement {
|
|
|
1855
1916
|
this.render();
|
|
1856
1917
|
});
|
|
1857
1918
|
this.root.querySelectorAll("[data-day]").forEach(
|
|
1858
|
-
(
|
|
1919
|
+
(b2) => b2.addEventListener(
|
|
1859
1920
|
"click",
|
|
1860
|
-
() => this.pickDay(Number(
|
|
1921
|
+
() => this.pickDay(Number(b2.dataset.day))
|
|
1861
1922
|
)
|
|
1862
1923
|
);
|
|
1863
1924
|
this.root.querySelectorAll("[data-month]").forEach(
|
|
1864
|
-
(
|
|
1865
|
-
this.cursor.m = Number(
|
|
1925
|
+
(b2) => b2.addEventListener("click", () => {
|
|
1926
|
+
this.cursor.m = Number(b2.dataset.month);
|
|
1866
1927
|
this.view = "days";
|
|
1867
1928
|
this.render();
|
|
1868
1929
|
})
|
|
1869
1930
|
);
|
|
1870
1931
|
this.root.querySelectorAll("[data-year]").forEach(
|
|
1871
|
-
(
|
|
1872
|
-
this.cursor.y = Number(
|
|
1932
|
+
(b2) => b2.addEventListener("click", () => {
|
|
1933
|
+
this.cursor.y = Number(b2.dataset.year);
|
|
1873
1934
|
this.view = "months";
|
|
1874
1935
|
this.render();
|
|
1875
1936
|
})
|
|
@@ -2042,7 +2103,7 @@ const _FxDatepicker = class _FxDatepicker extends FxElement {
|
|
|
2042
2103
|
this.time = { h: 0, m: 0, s: 0 };
|
|
2043
2104
|
}
|
|
2044
2105
|
static get observedAttributes() {
|
|
2045
|
-
return ["value", "start", "end", "values", "mode", "min", "max", "placeholder", "disabled", "format", "show-time", "free-text"];
|
|
2106
|
+
return ["value", "start", "end", "values", "mode", "min", "max", "placeholder", "disabled", "format", "show-time", "free-text", "error", "invalid", "success", "valid"];
|
|
2046
2107
|
}
|
|
2047
2108
|
get mode() {
|
|
2048
2109
|
const m = this.getAttr("mode", "single");
|
|
@@ -2097,15 +2158,15 @@ const _FxDatepicker = class _FxDatepicker extends FxElement {
|
|
|
2097
2158
|
/** Texto exibido no input conforme o modo. */
|
|
2098
2159
|
displayText() {
|
|
2099
2160
|
if (this.mode === "range") {
|
|
2100
|
-
const
|
|
2161
|
+
const s2 = this.getAttr("start");
|
|
2101
2162
|
const e = this.getAttr("end");
|
|
2102
2163
|
this.hasAttr("show-time") ? " " : " → ";
|
|
2103
|
-
if (!
|
|
2164
|
+
if (!s2 && !e) return "";
|
|
2104
2165
|
if (this.hasAttr("show-time")) {
|
|
2105
2166
|
const f = (iso) => iso ? `${this.formatDate(iso)} ${this.timeText()}` : iso ? `${this.formatDate(iso)} …` : "";
|
|
2106
|
-
return
|
|
2167
|
+
return s2 && e ? `${f(s2)} → ${f(e)}` : f(s2);
|
|
2107
2168
|
}
|
|
2108
|
-
return
|
|
2169
|
+
return s2 && e ? `${this.formatDate(s2)} → ${this.formatDate(e)}` : s2 ? `${this.formatDate(s2)} → …` : "";
|
|
2109
2170
|
}
|
|
2110
2171
|
if (this.mode === "multiple") {
|
|
2111
2172
|
return this.values.map((v) => this.formatDate(v)).join(", ");
|
|
@@ -2123,8 +2184,8 @@ const _FxDatepicker = class _FxDatepicker extends FxElement {
|
|
|
2123
2184
|
const src = this.value || this.getAttr("start") || "";
|
|
2124
2185
|
const t = src.split("T")[1];
|
|
2125
2186
|
if (!t) return;
|
|
2126
|
-
const [h, m,
|
|
2127
|
-
this.time = { h: h || 0, m: m || 0, s:
|
|
2187
|
+
const [h, m, s2] = t.split(":").map((n) => parseInt(n, 10));
|
|
2188
|
+
this.time = { h: h || 0, m: m || 0, s: s2 || 0 };
|
|
2128
2189
|
}
|
|
2129
2190
|
/** Anexa o horário interno ao ISO puro vindo do calendário. */
|
|
2130
2191
|
withTime(iso) {
|
|
@@ -2232,12 +2293,12 @@ const _FxDatepicker = class _FxDatepicker extends FxElement {
|
|
|
2232
2293
|
const applyTime = () => {
|
|
2233
2294
|
const h = this.root.querySelector(".t-h");
|
|
2234
2295
|
const m = this.root.querySelector(".t-m");
|
|
2235
|
-
const
|
|
2296
|
+
const s2 = this.root.querySelector(".t-s");
|
|
2236
2297
|
const clamp = (v, max) => Math.min(max, Math.max(0, parseInt(v ?? "0", 10) || 0));
|
|
2237
2298
|
this.time = {
|
|
2238
2299
|
h: clamp(h?.value, 23),
|
|
2239
2300
|
m: clamp(m?.value, 59),
|
|
2240
|
-
s: clamp(
|
|
2301
|
+
s: clamp(s2?.value, 59)
|
|
2241
2302
|
};
|
|
2242
2303
|
const reattach = (iso) => iso.split("T")[0] ? `${iso.split("T")[0]}T${this.timeText()}` : iso;
|
|
2243
2304
|
if (this.value) this.setAttribute("value", reattach(this.value));
|
|
@@ -2280,7 +2341,7 @@ const _FxDatepicker = class _FxDatepicker extends FxElement {
|
|
|
2280
2341
|
if (Number.isNaN(d.getTime())) return null;
|
|
2281
2342
|
const [y, m, day] = iso.split("-").map((n) => parseInt(n, 10));
|
|
2282
2343
|
if (d.getFullYear() !== y || d.getMonth() + 1 !== m || d.getDate() !== day) return null;
|
|
2283
|
-
const cmp = (a,
|
|
2344
|
+
const cmp = (a, b2) => a.split("T")[0].localeCompare(b2.split("T")[0]);
|
|
2284
2345
|
const min = this.getAttr("min");
|
|
2285
2346
|
const max = this.getAttr("max");
|
|
2286
2347
|
if (min && cmp(iso, min) < 0) return null;
|
|
@@ -2307,9 +2368,9 @@ const _FxDatepicker = class _FxDatepicker extends FxElement {
|
|
|
2307
2368
|
this.setAttribute("start", this.withTime(parsed));
|
|
2308
2369
|
this.removeAttribute("end");
|
|
2309
2370
|
} else {
|
|
2310
|
-
const [a,
|
|
2371
|
+
const [a, b2] = [this.getAttr("start").split("T")[0], parsed].sort();
|
|
2311
2372
|
this.setAttribute("start", this.withTime(a));
|
|
2312
|
-
this.setAttribute("end", this.withTime(
|
|
2373
|
+
this.setAttribute("end", this.withTime(b2));
|
|
2313
2374
|
}
|
|
2314
2375
|
this.emitChange({ start: this.getAttr("start"), end: this.getAttr("end") });
|
|
2315
2376
|
} else {
|
|
@@ -2356,6 +2417,10 @@ _FxDatepicker.styles = css`
|
|
|
2356
2417
|
:host([mode='range'][size='lg']) .field { min-width: 360px; }
|
|
2357
2418
|
:host([mode='multiple'][size='lg']) .field { min-width: 320px; }
|
|
2358
2419
|
:host([show-time]) .field { min-width: 250px; }
|
|
2420
|
+
/* Full width: o host estica até o pai (os min-width dos modos são
|
|
2421
|
+
descartados para permitir layouts estreitos sob controle do pai). */
|
|
2422
|
+
:host([full]) { display: block; width: 100%; }
|
|
2423
|
+
:host([full]) .field { min-width: 0; }
|
|
2359
2424
|
/* Validação */
|
|
2360
2425
|
:host([error]) .field,
|
|
2361
2426
|
:host([invalid]) .field {
|
|
@@ -2494,8 +2559,8 @@ const _FxCheckbox = class _FxCheckbox extends FxElement {
|
|
|
2494
2559
|
}
|
|
2495
2560
|
/** Tamanho do controle. Padrão: `'md'`. */
|
|
2496
2561
|
get size() {
|
|
2497
|
-
const
|
|
2498
|
-
return
|
|
2562
|
+
const s2 = this.getAttr("size", "md");
|
|
2563
|
+
return s2 === "sm" || s2 === "lg" ? s2 : "md";
|
|
2499
2564
|
}
|
|
2500
2565
|
set size(value) {
|
|
2501
2566
|
this.setAttribute("size", value);
|
|
@@ -2623,8 +2688,8 @@ const _FxRadio = class _FxRadio extends FxElement {
|
|
|
2623
2688
|
}
|
|
2624
2689
|
/** Tamanho do controle. Padrão: `'md'`. */
|
|
2625
2690
|
get size() {
|
|
2626
|
-
const
|
|
2627
|
-
return
|
|
2691
|
+
const s2 = this.getAttr("size", "md");
|
|
2692
|
+
return s2 === "sm" || s2 === "lg" ? s2 : "md";
|
|
2628
2693
|
}
|
|
2629
2694
|
set size(value) {
|
|
2630
2695
|
this.setAttribute("size", value);
|
|
@@ -3267,8 +3332,8 @@ const _FxTable = class _FxTable extends FxElement {
|
|
|
3267
3332
|
}
|
|
3268
3333
|
const total = this.lazy ? this.total : out.length;
|
|
3269
3334
|
if (this.sortField) {
|
|
3270
|
-
out.sort((a,
|
|
3271
|
-
const av = a[this.sortField], bv =
|
|
3335
|
+
out.sort((a, b2) => {
|
|
3336
|
+
const av = a[this.sortField], bv = b2[this.sortField];
|
|
3272
3337
|
if (typeof av === "number" && typeof bv === "number")
|
|
3273
3338
|
return (av - bv) * this.sortDir;
|
|
3274
3339
|
return String(av ?? "").localeCompare(String(bv ?? ""), "pt-BR") * this.sortDir;
|
|
@@ -3287,7 +3352,7 @@ const _FxTable = class _FxTable extends FxElement {
|
|
|
3287
3352
|
if (!input) return [];
|
|
3288
3353
|
const attr = input.getAttribute("data-search-fields");
|
|
3289
3354
|
if (attr === null) return [];
|
|
3290
|
-
return attr.split(",").map((
|
|
3355
|
+
return attr.split(",").map((s2) => s2.trim()).filter(Boolean);
|
|
3291
3356
|
}
|
|
3292
3357
|
cellHtml(col, row) {
|
|
3293
3358
|
const template = col.template?.innerHTML ?? col.directTemplate;
|
|
@@ -3671,7 +3736,7 @@ const _FxFloatlabel = class _FxFloatlabel extends FxElement {
|
|
|
3671
3736
|
this.listenersReady = false;
|
|
3672
3737
|
}
|
|
3673
3738
|
static get observedAttributes() {
|
|
3674
|
-
return ["variant", "error", "invalid", "success", "valid"];
|
|
3739
|
+
return ["variant", "error", "invalid", "success", "valid", "full", "icon", "icon-pos"];
|
|
3675
3740
|
}
|
|
3676
3741
|
render() {
|
|
3677
3742
|
const control = this.findControl();
|
|
@@ -3695,6 +3760,9 @@ const _FxFloatlabel = class _FxFloatlabel extends FxElement {
|
|
|
3695
3760
|
this.syncControlReference(control);
|
|
3696
3761
|
this.syncState();
|
|
3697
3762
|
this.applyError();
|
|
3763
|
+
this.applyFull();
|
|
3764
|
+
this.applyIcon();
|
|
3765
|
+
this.syncIconIndent();
|
|
3698
3766
|
}
|
|
3699
3767
|
disconnectedCallback() {
|
|
3700
3768
|
super.disconnectedCallback();
|
|
@@ -3720,6 +3788,7 @@ const _FxFloatlabel = class _FxFloatlabel extends FxElement {
|
|
|
3720
3788
|
this.syncControlReference(control);
|
|
3721
3789
|
this.syncState();
|
|
3722
3790
|
this.applyError();
|
|
3791
|
+
this.applyFull();
|
|
3723
3792
|
});
|
|
3724
3793
|
}
|
|
3725
3794
|
if (this.listenersReady) return;
|
|
@@ -3739,10 +3808,13 @@ const _FxFloatlabel = class _FxFloatlabel extends FxElement {
|
|
|
3739
3808
|
this.observer = null;
|
|
3740
3809
|
this.targetControl = control;
|
|
3741
3810
|
if (control) {
|
|
3742
|
-
this.observer = new MutationObserver(() =>
|
|
3811
|
+
this.observer = new MutationObserver(() => {
|
|
3812
|
+
this.syncState();
|
|
3813
|
+
this.syncIconIndent();
|
|
3814
|
+
});
|
|
3743
3815
|
this.observer.observe(control, {
|
|
3744
3816
|
attributes: true,
|
|
3745
|
-
attributeFilter: ["value", "values", "start", "end", "open"]
|
|
3817
|
+
attributeFilter: ["value", "values", "start", "end", "open", "icon", "icon-pos"]
|
|
3746
3818
|
});
|
|
3747
3819
|
}
|
|
3748
3820
|
}
|
|
@@ -3774,6 +3846,41 @@ const _FxFloatlabel = class _FxFloatlabel extends FxElement {
|
|
|
3774
3846
|
this.removeAttribute("focus");
|
|
3775
3847
|
}
|
|
3776
3848
|
}
|
|
3849
|
+
/**
|
|
3850
|
+
* variant="in" + ícone à esquerda dentro do campo (fx-input icon):
|
|
3851
|
+
* enquanto a label é placeholder ela precisa começar depois do glifo.
|
|
3852
|
+
* Detecta via atributos icon/icon-pos (ou slot icon) do controle.
|
|
3853
|
+
*/
|
|
3854
|
+
syncIconIndent() {
|
|
3855
|
+
const label = this.root.querySelector(".flabel");
|
|
3856
|
+
if (!label) return;
|
|
3857
|
+
const c = this.targetControl;
|
|
3858
|
+
const hasLeftIcon = Boolean(
|
|
3859
|
+
c && (c.hasAttribute("icon") || c.querySelector(':scope > [slot="icon"]')) && c.getAttribute("icon-pos") !== "right"
|
|
3860
|
+
);
|
|
3861
|
+
label.classList.toggle("icon-indent", hasLeftIcon);
|
|
3862
|
+
}
|
|
3863
|
+
applyFull() {
|
|
3864
|
+
if (this.targetControl && typeof this.targetControl.setAttribute === "function") {
|
|
3865
|
+
if (this.hasAttr("full")) {
|
|
3866
|
+
this.targetControl.setAttribute("full", "");
|
|
3867
|
+
} else {
|
|
3868
|
+
this.targetControl.removeAttribute("full");
|
|
3869
|
+
}
|
|
3870
|
+
}
|
|
3871
|
+
}
|
|
3872
|
+
applyIcon() {
|
|
3873
|
+
if (this.targetControl && typeof this.targetControl.setAttribute === "function") {
|
|
3874
|
+
if (this.hasAttr("icon")) {
|
|
3875
|
+
const icon = this.getAttr("icon");
|
|
3876
|
+
const iconPos = this.getAttr("icon-pos");
|
|
3877
|
+
if (icon !== "") this.targetControl.setAttribute("icon", icon);
|
|
3878
|
+
else this.targetControl.setAttribute("icon", "");
|
|
3879
|
+
if (iconPos && iconPos !== "left") this.targetControl.setAttribute("icon-pos", iconPos);
|
|
3880
|
+
else this.targetControl.removeAttribute("icon-pos");
|
|
3881
|
+
}
|
|
3882
|
+
}
|
|
3883
|
+
}
|
|
3777
3884
|
applyError() {
|
|
3778
3885
|
const hasError = this.hasAttr("error") || this.hasAttr("invalid");
|
|
3779
3886
|
const errMsg = this.root.querySelector(
|
|
@@ -3816,6 +3923,12 @@ _FxFloatlabel.styles = css`
|
|
|
3816
3923
|
font-size: var(--fx-font-size);
|
|
3817
3924
|
vertical-align: middle;
|
|
3818
3925
|
}
|
|
3926
|
+
/* Full width: o host estica até o pai; o controle interno com
|
|
3927
|
+
atributo full (ou largura herdada) acompanha. */
|
|
3928
|
+
:host([full]) {
|
|
3929
|
+
display: block;
|
|
3930
|
+
width: 100%;
|
|
3931
|
+
}
|
|
3819
3932
|
.wrapper {
|
|
3820
3933
|
position: relative;
|
|
3821
3934
|
display: inline-block;
|
|
@@ -3881,6 +3994,21 @@ _FxFloatlabel.styles = css`
|
|
|
3881
3994
|
color: var(--fx-color-primary, #4f46e5);
|
|
3882
3995
|
}
|
|
3883
3996
|
|
|
3997
|
+
/* ---- variant="in" com ícone dentro do campo (fx-input icon):
|
|
3998
|
+
enquanto a label funciona como placeholder (sem foco/valor), ela
|
|
3999
|
+
começa DEPOIS do glifo (mesma métrica de padding do fx-input).
|
|
4000
|
+
Ao subir (active), volta ao offset padrão da borda. ---- */
|
|
4001
|
+
:host([variant="in"]) .flabel.icon-indent {
|
|
4002
|
+
left: calc(
|
|
4003
|
+
var(--fx-space-md, 12px) +
|
|
4004
|
+
var(--fx-input-icon-size, calc(var(--fx-font-size, 14px) + 6px)) +
|
|
4005
|
+
var(--fx-space-sm, 8px)
|
|
4006
|
+
);
|
|
4007
|
+
}
|
|
4008
|
+
:host([variant="in"][active]) .flabel.icon-indent {
|
|
4009
|
+
left: var(--fx-space-md, 12px);
|
|
4010
|
+
}
|
|
4011
|
+
|
|
3884
4012
|
/* ---- variant="over": label estática ACIMA do campo (fora, em fluxo) ---- */
|
|
3885
4013
|
:host([variant="over"]) {
|
|
3886
4014
|
display: block;
|
|
@@ -3928,11 +4056,11 @@ function defineFxFloatlabel() {
|
|
|
3928
4056
|
defineFxFloatlabel();
|
|
3929
4057
|
const _FxTextarea = class _FxTextarea extends FxElement {
|
|
3930
4058
|
static get observedAttributes() {
|
|
3931
|
-
return ["size", "placeholder", "disabled", "readonly", "rows", "maxlength"];
|
|
4059
|
+
return ["size", "placeholder", "disabled", "readonly", "rows", "maxlength", "error", "invalid", "success", "valid"];
|
|
3932
4060
|
}
|
|
3933
4061
|
get size() {
|
|
3934
|
-
const
|
|
3935
|
-
return
|
|
4062
|
+
const s2 = this.getAttr("size", "md");
|
|
4063
|
+
return s2 === "sm" || s2 === "lg" ? s2 : "md";
|
|
3936
4064
|
}
|
|
3937
4065
|
set size(value) {
|
|
3938
4066
|
this.setAttribute("size", value);
|
|
@@ -4020,8 +4148,11 @@ _FxTextarea.styles = css`
|
|
|
4020
4148
|
border-color: var(--fx-color-success, #16a34a);
|
|
4021
4149
|
box-shadow: 0 0 0 3px color-mix(in srgb, var(--fx-color-success, #16a34a) 18%, transparent);
|
|
4022
4150
|
}
|
|
4023
|
-
:host([size='sm']) .field {
|
|
4151
|
+
:host([size='sm']) .field { min-height: var(--fx-size-sm); padding: var(--fx-space-sm) var(--fx-space-md); width: 220px; }
|
|
4024
4152
|
:host([size='lg']) .field { width: 300px; min-height: calc(var(--fx-size-lg) + 80px); }
|
|
4153
|
+
/* Full width: o host estica até o pai e o campo interno acompanha. */
|
|
4154
|
+
:host([full]) { display: block; width: 100%; }
|
|
4155
|
+
:host([full]) .field { width: 100%; }
|
|
4025
4156
|
`;
|
|
4026
4157
|
let FxTextarea = _FxTextarea;
|
|
4027
4158
|
function defineFxTextarea() {
|
|
@@ -4058,6 +4189,8 @@ const _FxDialog = class _FxDialog extends FxElement {
|
|
|
4058
4189
|
</div>
|
|
4059
4190
|
`);
|
|
4060
4191
|
if (!isOpen) return;
|
|
4192
|
+
this._cleanup?.();
|
|
4193
|
+
this._cleanup = void 0;
|
|
4061
4194
|
const overlay = this.root.querySelector(".overlay");
|
|
4062
4195
|
const closeBtn = this.root.querySelector(".close");
|
|
4063
4196
|
const close = () => {
|
|
@@ -4320,6 +4453,8 @@ const _FxConfirmPopup = class _FxConfirmPopup extends FxElement {
|
|
|
4320
4453
|
if (!this.open) return;
|
|
4321
4454
|
const popup = this.root.querySelector(".popup");
|
|
4322
4455
|
if (!popup) return;
|
|
4456
|
+
this._cleanup?.();
|
|
4457
|
+
this._cleanup = void 0;
|
|
4323
4458
|
const close = (event) => {
|
|
4324
4459
|
this.open = false;
|
|
4325
4460
|
this._cleanup?.();
|
|
@@ -4504,11 +4639,11 @@ const _FxFileUpload = class _FxFileUpload extends FxElement {
|
|
|
4504
4639
|
this._done = false;
|
|
4505
4640
|
}
|
|
4506
4641
|
static get observedAttributes() {
|
|
4507
|
-
return ["mode", "size", "severity", "label", "icon", "accept", "multiple", "disabled", "show-progress", "progress", "value"];
|
|
4642
|
+
return ["mode", "size", "severity", "label", "icon", "accept", "multiple", "disabled", "show-progress", "progress", "value", "full"];
|
|
4508
4643
|
}
|
|
4509
4644
|
get size() {
|
|
4510
|
-
const
|
|
4511
|
-
return
|
|
4645
|
+
const s2 = this.getAttr("size", "md");
|
|
4646
|
+
return s2 === "sm" || s2 === "lg" ? s2 : "md";
|
|
4512
4647
|
}
|
|
4513
4648
|
set size(value) {
|
|
4514
4649
|
this.setAttribute("size", value);
|
|
@@ -4548,11 +4683,11 @@ const _FxFileUpload = class _FxFileUpload extends FxElement {
|
|
|
4548
4683
|
const fileInput = `<input type="file" class="picker" ${accept ? `accept="${esc(accept)}"` : ""} ${multiple ? "multiple" : ""} ${disabled ? "disabled" : ""} />`;
|
|
4549
4684
|
this.setTemplate(`
|
|
4550
4685
|
${advanced ? `<div class="drop" part="dropzone" role="button" tabindex="0" aria-label="${esc(label)}">
|
|
4551
|
-
${icon ? `<span class="icon" aria-hidden="true">${
|
|
4686
|
+
${icon ? `<span class="icon" part="icon" aria-hidden="true">${fenixIconHtml(icon)}</span>` : ""}
|
|
4552
4687
|
<span>${esc(label)}</span>
|
|
4553
4688
|
<span class="hint">ou arraste e solte aqui</span>
|
|
4554
4689
|
</div>` : `<button type="button" class="btn" part="button">
|
|
4555
|
-
${icon ? `<span class="icon" aria-hidden="true">${
|
|
4690
|
+
${icon ? `<span class="icon" part="icon" aria-hidden="true">${fenixIconHtml(icon)}</span>` : ""}
|
|
4556
4691
|
<span>${esc(label)}</span>
|
|
4557
4692
|
</button>`}
|
|
4558
4693
|
${fileInput}
|
|
@@ -4767,6 +4902,12 @@ _FxFileUpload.styles = css`
|
|
|
4767
4902
|
min-width: 34px;
|
|
4768
4903
|
text-align: right;
|
|
4769
4904
|
}
|
|
4905
|
+
/* Full width: o host estica até o pai e o botão/dropzone acompanha. */
|
|
4906
|
+
:host([full]) { display: block; width: 100%; }
|
|
4907
|
+
:host([full]) .btn { width: 100%; }
|
|
4908
|
+
:host([full]) .drop { width: 100%; }
|
|
4909
|
+
/* Base dos glifos Fenix Icons (o @font-face vem de @wrrdev/fenix-ui/icons). */
|
|
4910
|
+
${FENIX_ICON_BASE_CSS}
|
|
4770
4911
|
`;
|
|
4771
4912
|
let FxFileUpload = _FxFileUpload;
|
|
4772
4913
|
function defineFxFileUpload() {
|
|
@@ -5054,7 +5195,7 @@ const _FxChip = class _FxChip extends FxElement {
|
|
|
5054
5195
|
this.setTemplate(`
|
|
5055
5196
|
<span class="chip ${clickable ? "clickable" : ""}" part="chip" role="${clickable ? "button" : "status"}"
|
|
5056
5197
|
${clickable ? `tabindex="0" aria-pressed="${this.selected}"` : ""} ${disabled ? 'aria-disabled="true"' : ""}>
|
|
5057
|
-
${icon ? `<span class="icon" aria-hidden="true">${
|
|
5198
|
+
${icon ? `<span class="icon" aria-hidden="true">${fenixIconHtml(icon)}</span>` : ""}
|
|
5058
5199
|
<slot></slot>
|
|
5059
5200
|
<button type="button" class="remove" part="remove" aria-label="Remover" ${removable ? "" : "hidden"}>×</button>
|
|
5060
5201
|
</span>
|
|
@@ -5131,6 +5272,8 @@ _FxChip.styles = css`
|
|
|
5131
5272
|
.chip.clickable:active { transform: scale(0.97); }
|
|
5132
5273
|
|
|
5133
5274
|
.icon { line-height: 1; }
|
|
5275
|
+
/* Base dos glifos Fenix Icons (o @font-face vem de @wrrdev/fenix-ui/icons). */
|
|
5276
|
+
${FENIX_ICON_BASE_CSS}
|
|
5134
5277
|
.remove {
|
|
5135
5278
|
display: inline-flex;
|
|
5136
5279
|
align-items: center;
|
|
@@ -5345,12 +5488,12 @@ const _FxBreadcrumb = class _FxBreadcrumb extends FxElement {
|
|
|
5345
5488
|
item.setAttribute("aria-current", isLast ? "page" : "false");
|
|
5346
5489
|
nav.appendChild(item);
|
|
5347
5490
|
if (isLast) return;
|
|
5348
|
-
const
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
nav.appendChild(
|
|
5491
|
+
const s2 = document.createElement("span");
|
|
5492
|
+
s2.className = "sep";
|
|
5493
|
+
s2.setAttribute("part", "separator");
|
|
5494
|
+
s2.setAttribute("aria-hidden", "true");
|
|
5495
|
+
s2.textContent = sep;
|
|
5496
|
+
nav.appendChild(s2);
|
|
5354
5497
|
});
|
|
5355
5498
|
}
|
|
5356
5499
|
connectedCallback() {
|
|
@@ -5453,6 +5596,8 @@ const _FxPopover = class _FxPopover extends FxElement {
|
|
|
5453
5596
|
if (!this.open) return;
|
|
5454
5597
|
const popup = this.root.querySelector(".popup");
|
|
5455
5598
|
if (!popup) return;
|
|
5599
|
+
this._cleanup?.();
|
|
5600
|
+
this._cleanup = void 0;
|
|
5456
5601
|
const close = () => {
|
|
5457
5602
|
this.open = false;
|
|
5458
5603
|
this._cleanup?.();
|
|
@@ -5922,7 +6067,7 @@ const _FxMenu = class _FxMenu extends FxElement {
|
|
|
5922
6067
|
}
|
|
5923
6068
|
render() {
|
|
5924
6069
|
const titleAttr = this.getAttr("titles");
|
|
5925
|
-
const titles = titleAttr ? titleAttr.split(",").map((
|
|
6070
|
+
const titles = titleAttr ? titleAttr.split(",").map((s2) => s2.trim()) : [];
|
|
5926
6071
|
const items = this.items;
|
|
5927
6072
|
const itemsHtml = items.map((it, i) => {
|
|
5928
6073
|
const label = titles[i] || it.textContent?.trim() || `Item ${i + 1}`;
|
|
@@ -6054,7 +6199,7 @@ const _FxToggleButtonGroup = class _FxToggleButtonGroup extends FxElement {
|
|
|
6054
6199
|
}
|
|
6055
6200
|
get value() {
|
|
6056
6201
|
const raw = this.getAttr("value");
|
|
6057
|
-
return raw ? raw.split(",").map((
|
|
6202
|
+
return raw ? raw.split(",").map((s2) => s2.trim()).filter(Boolean) : [];
|
|
6058
6203
|
}
|
|
6059
6204
|
set value(v) {
|
|
6060
6205
|
this.setAttribute("value", v.join(","));
|
|
@@ -6153,7 +6298,7 @@ const _FxEmptyState = class _FxEmptyState extends FxElement {
|
|
|
6153
6298
|
const description = this.getAttr("description");
|
|
6154
6299
|
this.setTemplate(`
|
|
6155
6300
|
<div class="wrap" part="wrap">
|
|
6156
|
-
<span class="icon" part="icon" aria-hidden="true">${
|
|
6301
|
+
<span class="icon" part="icon" aria-hidden="true">${fenixIconHtml(icon)}</span>
|
|
6157
6302
|
<h4 part="heading" ${heading ? "" : "hidden"}>${esc(heading)}</h4>
|
|
6158
6303
|
<p part="description" ${description ? "" : "hidden"}>${esc(description)}</p>
|
|
6159
6304
|
<slot name="icon"></slot>
|
|
@@ -6200,6 +6345,8 @@ _FxEmptyState.styles = css`
|
|
|
6200
6345
|
p[hidden] { display: none; }
|
|
6201
6346
|
.action { margin-top: var(--fx-space-sm); }
|
|
6202
6347
|
.action:empty { display: none; }
|
|
6348
|
+
/* Base dos glifos Fenix Icons (o @font-face vem de @wrrdev/fenix-ui/icons). */
|
|
6349
|
+
${FENIX_ICON_BASE_CSS}
|
|
6203
6350
|
`;
|
|
6204
6351
|
let FxEmptyState = _FxEmptyState;
|
|
6205
6352
|
function defineFxEmptyState() {
|
|
@@ -6481,7 +6628,7 @@ const _FxCarousel = class _FxCarousel extends FxElement {
|
|
|
6481
6628
|
}
|
|
6482
6629
|
render() {
|
|
6483
6630
|
this._slides = Array.from(this.children).filter((el) => el.matches('[slot="slide"]'));
|
|
6484
|
-
const contentsHtml = this._slides.map((
|
|
6631
|
+
const contentsHtml = this._slides.map((s2, i) => `<div class="slide" part="slide" data-i="${i}" ${i === this.active ? "" : "hidden"}>${s2.innerHTML}</div>`).join("");
|
|
6485
6632
|
this.setTemplate(`
|
|
6486
6633
|
<div class="viewport" part="viewport">
|
|
6487
6634
|
${contentsHtml}
|
|
@@ -6515,8 +6662,8 @@ const _FxCarousel = class _FxCarousel extends FxElement {
|
|
|
6515
6662
|
}
|
|
6516
6663
|
if (String(target) === this.getAttribute("active")) return;
|
|
6517
6664
|
this.active = target;
|
|
6518
|
-
this.root.querySelectorAll(".slide").forEach((
|
|
6519
|
-
|
|
6665
|
+
this.root.querySelectorAll(".slide").forEach((s2) => {
|
|
6666
|
+
s2.toggleAttribute("hidden", Number(s2.dataset.i) !== target);
|
|
6520
6667
|
});
|
|
6521
6668
|
this.root.querySelectorAll(".dot").forEach((d) => {
|
|
6522
6669
|
d.classList.toggle("on", Number(d.dataset.i) === target);
|
|
@@ -7617,8 +7764,8 @@ const _FxSkeleton = class _FxSkeleton extends FxElement {
|
|
|
7617
7764
|
return;
|
|
7618
7765
|
}
|
|
7619
7766
|
if (variant === "rect") {
|
|
7620
|
-
const
|
|
7621
|
-
this.setTemplate(`<div class="bone" part="bone" style="${
|
|
7767
|
+
const s2 = style || "width:100%;height:80px;";
|
|
7768
|
+
this.setTemplate(`<div class="bone" part="bone" style="${s2}"></div>`);
|
|
7622
7769
|
return;
|
|
7623
7770
|
}
|
|
7624
7771
|
const lines = Number(this.getAttr("lines", "3")) || 3;
|
|
@@ -8125,7 +8272,7 @@ const _FxPagination = class _FxPagination extends FxElement {
|
|
|
8125
8272
|
render() {
|
|
8126
8273
|
const pages = this.pages;
|
|
8127
8274
|
const current = Math.min(Math.max(1, this.page), pages);
|
|
8128
|
-
const opts = (this.getAttr("rows-options", "5,10,20,50") || "").split(",").map((
|
|
8275
|
+
const opts = (this.getAttr("rows-options", "5,10,20,50") || "").split(",").map((s2) => s2.trim()).filter(Boolean);
|
|
8129
8276
|
const window_ = [];
|
|
8130
8277
|
for (let p = Math.max(1, current - 2); p <= Math.min(pages, current + 2); p++) window_.push(p);
|
|
8131
8278
|
const from = total0(current, this.rows);
|
|
@@ -8222,11 +8369,11 @@ function defineFxPagination() {
|
|
|
8222
8369
|
defineFxPagination();
|
|
8223
8370
|
const _FxAutocomplete = class _FxAutocomplete extends FxElement {
|
|
8224
8371
|
static get observedAttributes() {
|
|
8225
|
-
return ["size", "placeholder", "source", "disabled", "min-chars"];
|
|
8372
|
+
return ["size", "placeholder", "source", "disabled", "min-chars", "error", "invalid", "success", "valid"];
|
|
8226
8373
|
}
|
|
8227
8374
|
get size() {
|
|
8228
|
-
const
|
|
8229
|
-
return
|
|
8375
|
+
const s2 = this.getAttr("size", "md");
|
|
8376
|
+
return s2 === "sm" || s2 === "lg" ? s2 : "md";
|
|
8230
8377
|
}
|
|
8231
8378
|
set size(v) {
|
|
8232
8379
|
this.setAttribute("size", v);
|
|
@@ -8278,7 +8425,7 @@ const _FxAutocomplete = class _FxAutocomplete extends FxElement {
|
|
|
8278
8425
|
const openList = () => {
|
|
8279
8426
|
if (!list) return;
|
|
8280
8427
|
const q = field.value.toLowerCase();
|
|
8281
|
-
const matches = this.source.filter((
|
|
8428
|
+
const matches = this.source.filter((s2) => s2.toLowerCase().includes(q)).slice(0, 8);
|
|
8282
8429
|
list.innerHTML = matches.length ? matches.map((m) => `<button type="button" class="opt" role="option" data-v="${esc(m)}">${esc(m)}</button>`).join("") : '<div class="empty">Nenhum resultado</div>';
|
|
8283
8430
|
list.querySelectorAll(".opt").forEach((btn) => {
|
|
8284
8431
|
btn.addEventListener("click", () => {
|
|
@@ -8324,7 +8471,7 @@ _FxAutocomplete.styles = css`
|
|
|
8324
8471
|
font-family: var(--fx-font-family);
|
|
8325
8472
|
font-size: var(--fx-font-size);
|
|
8326
8473
|
}
|
|
8327
|
-
|
|
8474
|
+
.field {
|
|
8328
8475
|
font-family: inherit;
|
|
8329
8476
|
font-size: inherit;
|
|
8330
8477
|
font-weight: var(--fx-font-weight);
|
|
@@ -8340,15 +8487,29 @@ _FxAutocomplete.styles = css`
|
|
|
8340
8487
|
border-color var(--fx-motion-duration-normal) var(--fx-motion-easing),
|
|
8341
8488
|
box-shadow var(--fx-motion-duration-normal) var(--fx-motion-easing);
|
|
8342
8489
|
}
|
|
8343
|
-
|
|
8344
|
-
|
|
8345
|
-
|
|
8490
|
+
.field::placeholder { color: var(--fx-text-muted); opacity: 1; }
|
|
8491
|
+
.field:hover { border-color: var(--fx-border-hover); }
|
|
8492
|
+
.field:focus-visible {
|
|
8346
8493
|
outline: none;
|
|
8347
8494
|
border-color: var(--fx-color-primary);
|
|
8348
8495
|
box-shadow: var(--fx-effect-focus-ring, none);
|
|
8349
8496
|
}
|
|
8350
|
-
:host([size='sm'])
|
|
8351
|
-
:host([size='lg'])
|
|
8497
|
+
:host([size='sm']) .field { width: 220px; min-height: var(--fx-size-sm); padding: var(--fx-space-sm) var(--fx-space-md); }
|
|
8498
|
+
:host([size='lg']) .field { width: 300px; min-height: var(--fx-size-lg); }
|
|
8499
|
+
/* Full width: o host estica até o pai e o campo interno acompanha. */
|
|
8500
|
+
:host([full]) { display: block; width: 100%; }
|
|
8501
|
+
:host([full]) .field { width: 100%; }
|
|
8502
|
+
/* Validação: sobrescrevem a borda/foco via token do preset. */
|
|
8503
|
+
:host([error]) .field,
|
|
8504
|
+
:host([invalid]) .field {
|
|
8505
|
+
border-color: var(--fx-color-danger, #dc2626);
|
|
8506
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--fx-color-danger, #dc2626) 18%, transparent);
|
|
8507
|
+
}
|
|
8508
|
+
:host([success]) .field,
|
|
8509
|
+
:host([valid]) .field {
|
|
8510
|
+
border-color: var(--fx-color-success, #16a34a);
|
|
8511
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--fx-color-success, #16a34a) 18%, transparent);
|
|
8512
|
+
}
|
|
8352
8513
|
.list {
|
|
8353
8514
|
position: absolute;
|
|
8354
8515
|
top: calc(100% + 4px);
|
|
@@ -8455,8 +8616,8 @@ const _FxKnob = class _FxKnob extends FxElement {
|
|
|
8455
8616
|
this.setAttribute("step", String(v));
|
|
8456
8617
|
}
|
|
8457
8618
|
get size() {
|
|
8458
|
-
const
|
|
8459
|
-
return
|
|
8619
|
+
const s2 = this.getAttr("size", "md");
|
|
8620
|
+
return s2 === "sm" || s2 === "lg" ? s2 : "md";
|
|
8460
8621
|
}
|
|
8461
8622
|
set size(v) {
|
|
8462
8623
|
this.setAttribute("size", v);
|
|
@@ -8532,9 +8693,9 @@ const _FxKnob = class _FxKnob extends FxElement {
|
|
|
8532
8693
|
this.attachListeners();
|
|
8533
8694
|
}
|
|
8534
8695
|
getSizeNum() {
|
|
8535
|
-
const
|
|
8536
|
-
if (
|
|
8537
|
-
if (
|
|
8696
|
+
const s2 = this.size;
|
|
8697
|
+
if (s2 === "sm") return 60;
|
|
8698
|
+
if (s2 === "lg") return 140;
|
|
8538
8699
|
return 100;
|
|
8539
8700
|
}
|
|
8540
8701
|
/** Valida um valor de cor CSS, retornando-o seguro ou vazio. */
|
|
@@ -8796,8 +8957,8 @@ const _FxOrderList = class _FxOrderList extends FxElement {
|
|
|
8796
8957
|
this.toggleAttr("striped", v);
|
|
8797
8958
|
}
|
|
8798
8959
|
get selectionMode() {
|
|
8799
|
-
const
|
|
8800
|
-
return
|
|
8960
|
+
const s2 = this.getAttr("selection-mode", "");
|
|
8961
|
+
return s2 === "single" || s2 === "multiple" ? s2 : "";
|
|
8801
8962
|
}
|
|
8802
8963
|
set selectionMode(v) {
|
|
8803
8964
|
this.setAttribute("selection-mode", v);
|
|
@@ -8879,7 +9040,7 @@ const _FxOrderList = class _FxOrderList extends FxElement {
|
|
|
8879
9040
|
return JSON.stringify(item);
|
|
8880
9041
|
}
|
|
8881
9042
|
_isSelected(item) {
|
|
8882
|
-
return this._selection.some((
|
|
9043
|
+
return this._selection.some((s2) => this._getItemKey(s2, -1) === this._getItemKey(item, -1));
|
|
8883
9044
|
}
|
|
8884
9045
|
_moveItem(fromIndex, toIndex) {
|
|
8885
9046
|
const actualFrom = this._getActualIndex(fromIndex);
|
|
@@ -8915,7 +9076,7 @@ const _FxOrderList = class _FxOrderList extends FxElement {
|
|
|
8915
9076
|
}
|
|
8916
9077
|
_toggleSelection(item) {
|
|
8917
9078
|
const key2 = this._getItemKey(item, -1);
|
|
8918
|
-
const index = this._selection.findIndex((
|
|
9079
|
+
const index = this._selection.findIndex((s2) => this._getItemKey(s2, -1) === key2);
|
|
8919
9080
|
if (index >= 0) {
|
|
8920
9081
|
this._selection.splice(index, 1);
|
|
8921
9082
|
} else if (this.selectionMode === "multiple") {
|
|
@@ -9189,7 +9350,7 @@ const _FxOrderList = class _FxOrderList extends FxElement {
|
|
|
9189
9350
|
_handleMoveAction(action) {
|
|
9190
9351
|
if (!this._selection.length) return;
|
|
9191
9352
|
const displayData = this._getDisplayData();
|
|
9192
|
-
const selectedIndices = this._selection.map((
|
|
9353
|
+
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);
|
|
9193
9354
|
if (selectedIndices.length === 0) return;
|
|
9194
9355
|
switch (action) {
|
|
9195
9356
|
case "top":
|
|
@@ -9214,7 +9375,7 @@ const _FxOrderList = class _FxOrderList extends FxElement {
|
|
|
9214
9375
|
items.push(this._data[actualIdx]);
|
|
9215
9376
|
actualIndices.push(actualIdx);
|
|
9216
9377
|
}
|
|
9217
|
-
actualIndices.sort((a,
|
|
9378
|
+
actualIndices.sort((a, b2) => b2 - a).forEach((i) => this._data.splice(i, 1));
|
|
9218
9379
|
const insertIdx = this._getActualIndex(0);
|
|
9219
9380
|
this._data.splice(insertIdx, 0, ...items);
|
|
9220
9381
|
this._applyFilter();
|
|
@@ -9230,7 +9391,7 @@ const _FxOrderList = class _FxOrderList extends FxElement {
|
|
|
9230
9391
|
items.push(this._data[actualIdx]);
|
|
9231
9392
|
actualIndices.push(actualIdx);
|
|
9232
9393
|
}
|
|
9233
|
-
actualIndices.sort((a,
|
|
9394
|
+
actualIndices.sort((a, b2) => b2 - a).forEach((i) => this._data.splice(i, 1));
|
|
9234
9395
|
const displayData = this._getDisplayData();
|
|
9235
9396
|
const insertIdx = this._getActualIndex(displayData.length - 1);
|
|
9236
9397
|
this._data.splice(insertIdx + 1, 0, ...items);
|
|
@@ -9242,7 +9403,7 @@ const _FxOrderList = class _FxOrderList extends FxElement {
|
|
|
9242
9403
|
_moveSelectedByOne(indices, delta) {
|
|
9243
9404
|
const displayData = this._getDisplayData();
|
|
9244
9405
|
if (displayData.length === 0) return;
|
|
9245
|
-
const actualIndices = indices.map((idx) => this._getActualIndex(idx)).filter((idx) => idx >= 0).sort((a,
|
|
9406
|
+
const actualIndices = indices.map((idx) => this._getActualIndex(idx)).filter((idx) => idx >= 0).sort((a, b2) => a - b2);
|
|
9246
9407
|
if (actualIndices.length === 0) return;
|
|
9247
9408
|
if (delta < 0 && actualIndices[0] <= 0) return;
|
|
9248
9409
|
if (delta > 0 && actualIndices[actualIndices.length - 1] >= this._data.length - 1) return;
|
|
@@ -9265,7 +9426,7 @@ const _FxOrderList = class _FxOrderList extends FxElement {
|
|
|
9265
9426
|
}
|
|
9266
9427
|
_updateControlsState() {
|
|
9267
9428
|
const displayData = this._getDisplayData();
|
|
9268
|
-
const selectedIndices = this._selection.map((
|
|
9429
|
+
const selectedIndices = this._selection.map((s2) => displayData.findIndex((d) => this._getItemKey(d, -1) === this._getItemKey(s2, -1))).filter((i) => i >= 0);
|
|
9269
9430
|
const buttons = this.root.querySelectorAll(".control-btn");
|
|
9270
9431
|
buttons.forEach((btn) => {
|
|
9271
9432
|
const action = btn.dataset.action;
|
|
@@ -9471,8 +9632,8 @@ const _FxPickList = class _FxPickList extends FxElement {
|
|
|
9471
9632
|
this.toggleAttr("striped", v);
|
|
9472
9633
|
}
|
|
9473
9634
|
get selectionMode() {
|
|
9474
|
-
const
|
|
9475
|
-
return
|
|
9635
|
+
const s2 = this.getAttr("selection-mode", "");
|
|
9636
|
+
return s2 === "single" || s2 === "multiple" ? s2 : "";
|
|
9476
9637
|
}
|
|
9477
9638
|
set selectionMode(v) {
|
|
9478
9639
|
this.setAttribute("selection-mode", v);
|
|
@@ -9607,10 +9768,10 @@ const _FxPickList = class _FxPickList extends FxElement {
|
|
|
9607
9768
|
return JSON.stringify(item);
|
|
9608
9769
|
}
|
|
9609
9770
|
_isSourceSelected(item, index) {
|
|
9610
|
-
return this._sourceSelection.some((
|
|
9771
|
+
return this._sourceSelection.some((s2) => this._getItemKey(s2, -1, true) === this._getItemKey(item, index, true));
|
|
9611
9772
|
}
|
|
9612
9773
|
_isTargetSelected(item, index) {
|
|
9613
|
-
return this._targetSelection.some((
|
|
9774
|
+
return this._targetSelection.some((s2) => this._getItemKey(s2, -1, false) === this._getItemKey(item, index, false));
|
|
9614
9775
|
}
|
|
9615
9776
|
_emitMoveToTarget() {
|
|
9616
9777
|
this.dispatchEvent(new CustomEvent("move-to-target", {
|
|
@@ -9753,7 +9914,7 @@ const _FxPickList = class _FxPickList extends FxElement {
|
|
|
9753
9914
|
_moveToTarget() {
|
|
9754
9915
|
if (!this._sourceSelection.length) return;
|
|
9755
9916
|
const items = [...this._sourceSelection];
|
|
9756
|
-
this._source = this._source.filter((
|
|
9917
|
+
this._source = this._source.filter((s2) => !items.some((i) => this._getItemKey(i, -1, true) === this._getItemKey(s2, -1, true)));
|
|
9757
9918
|
this._target = [...this._target, ...items];
|
|
9758
9919
|
this._sourceSelection = [];
|
|
9759
9920
|
this._filteredSource = null;
|
|
@@ -9799,7 +9960,7 @@ const _FxPickList = class _FxPickList extends FxElement {
|
|
|
9799
9960
|
_toggleSourceSelection(item, index) {
|
|
9800
9961
|
const mode = this.selectionMode || "single";
|
|
9801
9962
|
const key2 = this._getItemKey(item, index, true);
|
|
9802
|
-
const idx = this._sourceSelection.findIndex((
|
|
9963
|
+
const idx = this._sourceSelection.findIndex((s2) => this._getItemKey(s2, -1, true) === key2);
|
|
9803
9964
|
if (idx >= 0) {
|
|
9804
9965
|
this._sourceSelection.splice(idx, 1);
|
|
9805
9966
|
} else if (mode === "multiple") {
|
|
@@ -9814,7 +9975,7 @@ const _FxPickList = class _FxPickList extends FxElement {
|
|
|
9814
9975
|
_toggleTargetSelection(item, index) {
|
|
9815
9976
|
const mode = this.selectionMode || "single";
|
|
9816
9977
|
const key2 = this._getItemKey(item, index, false);
|
|
9817
|
-
const idx = this._targetSelection.findIndex((
|
|
9978
|
+
const idx = this._targetSelection.findIndex((s2) => this._getItemKey(s2, -1, false) === key2);
|
|
9818
9979
|
if (idx >= 0) {
|
|
9819
9980
|
this._targetSelection.splice(idx, 1);
|
|
9820
9981
|
} else if (mode === "multiple") {
|
|
@@ -10277,7 +10438,7 @@ const _FxAccordion = class _FxAccordion extends FxElement {
|
|
|
10277
10438
|
}
|
|
10278
10439
|
/** Valores ativos como array. */
|
|
10279
10440
|
get values() {
|
|
10280
|
-
return this.getAttr("value", "").split(",").map((
|
|
10441
|
+
return this.getAttr("value", "").split(",").map((s2) => s2.trim()).filter(Boolean);
|
|
10281
10442
|
}
|
|
10282
10443
|
set values(v) {
|
|
10283
10444
|
this.setAttribute("value", v.join(","));
|
|
@@ -10458,9 +10619,9 @@ export {
|
|
|
10458
10619
|
lightTokens,
|
|
10459
10620
|
listPresets,
|
|
10460
10621
|
resetTheme,
|
|
10461
|
-
sanitizeData,
|
|
10622
|
+
s as sanitizeData,
|
|
10462
10623
|
setTokens,
|
|
10463
|
-
stripTags,
|
|
10624
|
+
b as stripTags,
|
|
10464
10625
|
theme,
|
|
10465
10626
|
themePresets,
|
|
10466
10627
|
tokenCssVars
|