@tooark/web-components 1.0.1 → 1.2.0
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 +14 -8
- package/README.pt-BR.md +16 -10
- package/dist/index.cjs +338 -99
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +924 -39
- package/dist/index.d.ts +924 -39
- package/dist/index.js +317 -100
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
var core = require('@tooark/core');
|
|
4
4
|
|
|
5
|
+
// Base dos Custom Elements que também carrega fora do navegador. No SSR (Node, Angular SSR, Next, Nuxt) não existe
|
|
6
|
+
// HTMLElement, e um `extends HTMLElement` no topo do módulo derrubaria o import de quem só renderiza o HTML; lá a
|
|
7
|
+
// base é uma classe vazia, e os elementos só passam a existir no cliente, quando registerTooark*() os define.
|
|
8
|
+
/** `HTMLElement` no navegador; fora dele, uma classe vazia para o módulo poder ser importado no servidor. */
|
|
9
|
+
const HTMLElementBase = typeof HTMLElement === "undefined" ? class {
|
|
10
|
+
} : HTMLElement;
|
|
11
|
+
|
|
5
12
|
const INTENTS = ["primary", "secondary", "success", "warning", "danger", "info", "neutral"];
|
|
6
13
|
/** Devolve um ArkIntent válido a partir de um atributo, caindo no fallback quando não reconhece. */
|
|
7
14
|
function normalizeIntent(value, fallback = "primary") {
|
|
@@ -74,7 +81,7 @@ const CLOSE_SVG$3 = `
|
|
|
74
81
|
* anima a saída (slide-down, quick), emite `ark-dismiss` e esconde o host com
|
|
75
82
|
* `hidden`; remover é do app, que também pode tirar o `hidden` para reexibir.
|
|
76
83
|
*/
|
|
77
|
-
class ArkAlert extends
|
|
84
|
+
class ArkAlert extends HTMLElementBase {
|
|
78
85
|
constructor() {
|
|
79
86
|
super(...arguments);
|
|
80
87
|
this.ownClasses = [];
|
|
@@ -291,7 +298,7 @@ const PERSON_SVG = `
|
|
|
291
298
|
* (`aria-hidden`, a menos que o host tenha aria-label próprio). `color` troca
|
|
292
299
|
* o tint primary por uma cor própria (texto na cor, fundo suave).
|
|
293
300
|
*/
|
|
294
|
-
class ArkAvatar extends
|
|
301
|
+
class ArkAvatar extends HTMLElementBase {
|
|
295
302
|
constructor() {
|
|
296
303
|
super(...arguments);
|
|
297
304
|
this.ownClasses = [];
|
|
@@ -475,7 +482,7 @@ ArkAvatar.tagName = "ark-avatar";
|
|
|
475
482
|
* hooks): os filhos do usuário, ícone e texto, ficam onde estão. Não é
|
|
476
483
|
* interativo; um badge clicável é um ark-button pequeno.
|
|
477
484
|
*/
|
|
478
|
-
class ArkBadge extends
|
|
485
|
+
class ArkBadge extends HTMLElementBase {
|
|
479
486
|
constructor() {
|
|
480
487
|
super(...arguments);
|
|
481
488
|
this.ownClasses = [];
|
|
@@ -608,6 +615,18 @@ class ArkBadge extends HTMLElement {
|
|
|
608
615
|
}
|
|
609
616
|
ArkBadge.tagName = "ark-badge";
|
|
610
617
|
|
|
618
|
+
// Setters de propriedades que espelham um atributo de texto. React 19 e Vue gravam a prop como propriedade quando o
|
|
619
|
+
// elemento já registrado a expõe, então todo getter de atributo observado precisa de um setter que reflita o valor.
|
|
620
|
+
/** Grava `value` no atributo `name`; null/undefined removem o atributo. */
|
|
621
|
+
function reflectAttr(el, name, value) {
|
|
622
|
+
if (value === null || value === undefined) {
|
|
623
|
+
el.removeAttribute(name);
|
|
624
|
+
}
|
|
625
|
+
else {
|
|
626
|
+
el.setAttribute(name, String(value));
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
|
|
611
630
|
/** SVG do spinner de carregamento: usa o preset `.ark-animate-spin` do core, isento de movimento reduzido. */
|
|
612
631
|
const SPINNER_SVG$1 = `
|
|
613
632
|
<svg class="ark:h-[1em] ark:w-[1em] ark-animate-spin" viewBox="0 0 24 24" fill="none" aria-hidden="true">
|
|
@@ -637,10 +656,10 @@ let arkButtonIdCounter = 0;
|
|
|
637
656
|
* donos deles. Com `href`, um `<a>` "esticado" cobre o host, recebe o foco e
|
|
638
657
|
* é nomeado pelo conteúdo do host (`aria-labelledby`).
|
|
639
658
|
*/
|
|
640
|
-
class ArkButton extends
|
|
659
|
+
class ArkButton extends HTMLElementBase {
|
|
641
660
|
/**
|
|
642
|
-
*
|
|
643
|
-
* @returns
|
|
661
|
+
* Atributos observados pelo componente, a que ele reage em attributeChangedCallback.
|
|
662
|
+
* @returns Array de nomes de atributos observados.
|
|
644
663
|
*/
|
|
645
664
|
static get observedAttributes() {
|
|
646
665
|
return [
|
|
@@ -679,7 +698,7 @@ class ArkButton extends HTMLElement {
|
|
|
679
698
|
// --- Interação ---
|
|
680
699
|
/**
|
|
681
700
|
* Manipula o clique no botão, tratando submissão e reset de formulários.
|
|
682
|
-
* @param event Evento de clique
|
|
701
|
+
* @param event Evento de clique.
|
|
683
702
|
*/
|
|
684
703
|
this.handleClick = (event) => {
|
|
685
704
|
// Se o botão é um link ou do tipo "button", não faz nada.
|
|
@@ -711,7 +730,7 @@ class ArkButton extends HTMLElement {
|
|
|
711
730
|
};
|
|
712
731
|
/**
|
|
713
732
|
* Manipula o pressionamento de tecla no botão, tratando Enter e Espaço.
|
|
714
|
-
* @param event Evento de teclado
|
|
733
|
+
* @param event Evento de teclado.
|
|
715
734
|
*/
|
|
716
735
|
this.handleKeydown = (event) => {
|
|
717
736
|
// Se o botão é um link, não é o alvo do evento ou está desabilitado, não faz nada.
|
|
@@ -730,8 +749,7 @@ class ArkButton extends HTMLElement {
|
|
|
730
749
|
};
|
|
731
750
|
/**
|
|
732
751
|
* Manipula o keyup no botão, tratando a tecla Espaço.
|
|
733
|
-
* @param event Evento de teclado
|
|
734
|
-
* @returns void
|
|
752
|
+
* @param event Evento de teclado.
|
|
735
753
|
*/
|
|
736
754
|
this.handleKeyup = (event) => {
|
|
737
755
|
// Se o botão é um link, não é o alvo do evento ou está desabilitado, não faz nada.
|
|
@@ -765,7 +783,9 @@ class ArkButton extends HTMLElement {
|
|
|
765
783
|
}
|
|
766
784
|
/**
|
|
767
785
|
* Chamado pelo navegador quando um atributo observado do elemento é alterado.
|
|
768
|
-
* @param name
|
|
786
|
+
* @param name Nome do atributo alterado.
|
|
787
|
+
* @param oldValue Valor antigo do atributo.
|
|
788
|
+
* @param newValue Novo valor do atributo.
|
|
769
789
|
*/
|
|
770
790
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
771
791
|
// Se o atributo alterado for "class", reaplica apenas as classes próprias do componente.
|
|
@@ -865,6 +885,9 @@ class ArkButton extends HTMLElement {
|
|
|
865
885
|
const type = this.getAttribute("type");
|
|
866
886
|
return type === "submit" || type === "reset" ? type : "button";
|
|
867
887
|
}
|
|
888
|
+
set type(value) {
|
|
889
|
+
reflectAttr(this, "type", value);
|
|
890
|
+
}
|
|
868
891
|
/**
|
|
869
892
|
* Formulário ao qual o botão pertence (via ElementInternals).
|
|
870
893
|
*/
|
|
@@ -873,8 +896,8 @@ class ArkButton extends HTMLElement {
|
|
|
873
896
|
}
|
|
874
897
|
// --- Estilo ---
|
|
875
898
|
/**
|
|
876
|
-
* Normaliza o valor do intent,
|
|
877
|
-
* @param value Valor do intent.
|
|
899
|
+
* Normaliza o valor do intent, caindo em "primary" quando não é um dos valores válidos.
|
|
900
|
+
* @param value Valor do intent a ser normalizado.
|
|
878
901
|
* @returns Intent normalizado.
|
|
879
902
|
*/
|
|
880
903
|
normalizeIntent(value) {
|
|
@@ -892,8 +915,8 @@ class ArkButton extends HTMLElement {
|
|
|
892
915
|
return "primary";
|
|
893
916
|
}
|
|
894
917
|
/**
|
|
895
|
-
* Resolve a variante e o intent do botão com base nos atributos.
|
|
896
|
-
* @returns Objeto contendo a variante de estilo e o intent.
|
|
918
|
+
* Resolve a variante de estilo e o intent do botão com base nos atributos.
|
|
919
|
+
* @returns Objeto contendo a variante de estilo (`styleVariant`) e o intent (`intent`) do botão.
|
|
897
920
|
*/
|
|
898
921
|
resolveVariantAndIntent() {
|
|
899
922
|
const variant = (this.getAttribute("variant") || "primary").toLowerCase();
|
|
@@ -911,7 +934,8 @@ class ArkButton extends HTMLElement {
|
|
|
911
934
|
variant === "success" ||
|
|
912
935
|
variant === "warning" ||
|
|
913
936
|
variant === "danger" ||
|
|
914
|
-
variant === "info"
|
|
937
|
+
variant === "info" ||
|
|
938
|
+
variant === "neutral") {
|
|
915
939
|
return {
|
|
916
940
|
styleVariant: "solid",
|
|
917
941
|
intent: this.normalizeIntent(attrIntent || variant)
|
|
@@ -1206,7 +1230,7 @@ ArkButton.formAssociated = true;
|
|
|
1206
1230
|
* eventos por dia (`events` + `event-display`). O ark-datepicker embute este
|
|
1207
1231
|
* componente (modo inline e no popup do modo input).
|
|
1208
1232
|
*/
|
|
1209
|
-
class ArkCalendar extends
|
|
1233
|
+
class ArkCalendar extends HTMLElementBase {
|
|
1210
1234
|
constructor() {
|
|
1211
1235
|
super(...arguments);
|
|
1212
1236
|
this.root = null;
|
|
@@ -1219,6 +1243,8 @@ class ArkCalendar extends HTMLElement {
|
|
|
1219
1243
|
this.eventsProp = null;
|
|
1220
1244
|
/** Direção da navegação de mês por clique nas setas: dirige o slide do grid. */
|
|
1221
1245
|
this.navDirection = null;
|
|
1246
|
+
/** Último período anunciado (título do cabeçalho); o primeiro build só registra, sem anunciar. */
|
|
1247
|
+
this.announcedPeriod = null;
|
|
1222
1248
|
/** Última seleção feita pelo usuário: recebe um "pop" de entrada. */
|
|
1223
1249
|
this.justSelectedISO = null;
|
|
1224
1250
|
/** Navegação por teclado no grid (padrão WAI-ARIA de grade de datas). */
|
|
@@ -1312,6 +1338,12 @@ class ArkCalendar extends HTMLElement {
|
|
|
1312
1338
|
return this.eventsProp ?? this.parseEventsAttr();
|
|
1313
1339
|
}
|
|
1314
1340
|
set events(list) {
|
|
1341
|
+
// Frameworks que preferem propriedade a atributo (React 19, Vue) entregam o JSON do wrapper aqui.
|
|
1342
|
+
if (typeof list === "string") {
|
|
1343
|
+
this.eventsProp = null;
|
|
1344
|
+
this.setAttribute("events", list);
|
|
1345
|
+
return;
|
|
1346
|
+
}
|
|
1315
1347
|
this.eventsProp = Array.isArray(list) ? list : null;
|
|
1316
1348
|
if (this.root)
|
|
1317
1349
|
this.build();
|
|
@@ -1555,6 +1587,13 @@ class ArkCalendar extends HTMLElement {
|
|
|
1555
1587
|
}
|
|
1556
1588
|
return grid;
|
|
1557
1589
|
}
|
|
1590
|
+
// A troca de período vai ao leitor de tela pelo anunciador do core: um aria-live no título entraria no nome do
|
|
1591
|
+
// controle e, recriado a cada build, nem seria anunciado.
|
|
1592
|
+
announcePeriod(text) {
|
|
1593
|
+
if (this.announcedPeriod !== null && this.announcedPeriod !== text)
|
|
1594
|
+
core.announce(text);
|
|
1595
|
+
this.announcedPeriod = text;
|
|
1596
|
+
}
|
|
1558
1597
|
build() {
|
|
1559
1598
|
if (!this.locale)
|
|
1560
1599
|
this.locale = this.getLocale();
|
|
@@ -1630,7 +1669,6 @@ class ArkCalendar extends HTMLElement {
|
|
|
1630
1669
|
title.type = "button";
|
|
1631
1670
|
title.className = `${palette.headerText} ark:rounded ark:px-2 ark:py-0.5 ark:transition ark:hover:opacity-75 ark:focus:outline-none ark:focus:ring-2 ${palette.focusRing}`;
|
|
1632
1671
|
applyTestHooks(this, "calendar", title, "title");
|
|
1633
|
-
title.setAttribute("aria-live", "polite");
|
|
1634
1672
|
if (this.view === "days") {
|
|
1635
1673
|
title.textContent = `${loc.months[this.viewDate.getMonth()]} ${this.viewDate.getFullYear()}`;
|
|
1636
1674
|
}
|
|
@@ -1641,6 +1679,7 @@ class ArkCalendar extends HTMLElement {
|
|
|
1641
1679
|
const start = this.yearsBlockStart();
|
|
1642
1680
|
title.textContent = `${start}–${start + 11}`;
|
|
1643
1681
|
}
|
|
1682
|
+
this.announcePeriod(title.textContent);
|
|
1644
1683
|
title.addEventListener("click", () => {
|
|
1645
1684
|
this.view = this.view === "days" ? "months" : this.view === "months" ? "years" : "days";
|
|
1646
1685
|
this.build();
|
|
@@ -1873,7 +1912,7 @@ ArkCalendar.tagName = "ark-calendar";
|
|
|
1873
1912
|
* escala o espaçamento interno (padding do host e gap entre as linhas) e
|
|
1874
1913
|
* `rounded` os cantos. Não é interativo e não tem role próprio.
|
|
1875
1914
|
*/
|
|
1876
|
-
class ArkCard extends
|
|
1915
|
+
class ArkCard extends HTMLElementBase {
|
|
1877
1916
|
constructor() {
|
|
1878
1917
|
super(...arguments);
|
|
1879
1918
|
this.ownClasses = [];
|
|
@@ -1983,7 +2022,7 @@ const CHROME_ATTR = "data-ark-chrome";
|
|
|
1983
2022
|
* Setas e dots vivem num overlay `position: sticky` (ver components.css).
|
|
1984
2023
|
* Arrasto com mouse é emulado; touch/trackpad usam a rolagem nativa.
|
|
1985
2024
|
*/
|
|
1986
|
-
class ArkCarousel extends
|
|
2025
|
+
class ArkCarousel extends HTMLElementBase {
|
|
1987
2026
|
static get observedAttributes() {
|
|
1988
2027
|
return [
|
|
1989
2028
|
"theme",
|
|
@@ -2466,7 +2505,7 @@ let nextId$1 = 0;
|
|
|
2466
2505
|
* caixa por aria-labelledby e a alternam ao clique. Os nós próprios ficam no
|
|
2467
2506
|
* início do host, marcados data-ark-chrome, antes dos filhos do usuário.
|
|
2468
2507
|
*/
|
|
2469
|
-
class ArkCheckbox extends
|
|
2508
|
+
class ArkCheckbox extends HTMLElementBase {
|
|
2470
2509
|
static get observedAttributes() {
|
|
2471
2510
|
return [
|
|
2472
2511
|
"checked",
|
|
@@ -2788,7 +2827,7 @@ ArkCheckbox.tagName = "ark-checkbox";
|
|
|
2788
2827
|
* (/segundo), no estilo DigitalClock do MUI. Valor sempre em 24h "HH:mm:ss";
|
|
2789
2828
|
* `hours-format="12"` só muda a exibição (coluna AM/PM).
|
|
2790
2829
|
*/
|
|
2791
|
-
class ArkClock extends
|
|
2830
|
+
class ArkClock extends HTMLElementBase {
|
|
2792
2831
|
constructor() {
|
|
2793
2832
|
super(...arguments);
|
|
2794
2833
|
this.root = null;
|
|
@@ -2814,7 +2853,7 @@ class ArkClock extends HTMLElement {
|
|
|
2814
2853
|
};
|
|
2815
2854
|
}
|
|
2816
2855
|
static get observedAttributes() {
|
|
2817
|
-
return ["value", "seconds", "step-minutes", "hours-format", "lang", "theme", "intent", "testid"];
|
|
2856
|
+
return ["value", "seconds", "step-minutes", "hours-format", "lang", "locale-json", "theme", "intent", "testid"];
|
|
2818
2857
|
}
|
|
2819
2858
|
connectedCallback() {
|
|
2820
2859
|
this.build();
|
|
@@ -2834,6 +2873,9 @@ class ArkClock extends HTMLElement {
|
|
|
2834
2873
|
get value() {
|
|
2835
2874
|
return this.getAttribute("value") || "";
|
|
2836
2875
|
}
|
|
2876
|
+
set value(value) {
|
|
2877
|
+
reflectAttr(this, "value", value);
|
|
2878
|
+
}
|
|
2837
2879
|
getIntent() {
|
|
2838
2880
|
const intent = (this.getAttribute("intent") || "").toLowerCase();
|
|
2839
2881
|
if (intent === "primary" ||
|
|
@@ -2950,7 +2992,7 @@ class ArkClock extends HTMLElement {
|
|
|
2950
2992
|
}
|
|
2951
2993
|
build() {
|
|
2952
2994
|
const palette = this.getPalette(this.getIntent());
|
|
2953
|
-
const loc = core.resolveLocale((this.getAttribute("lang") || "en"), undefined);
|
|
2995
|
+
const loc = core.resolveLocale((this.getAttribute("lang") || "en"), this.getAttribute("locale-json") || undefined);
|
|
2954
2996
|
this.root?.remove();
|
|
2955
2997
|
this.columnEls.clear();
|
|
2956
2998
|
const container = document.createElement("div");
|
|
@@ -3044,7 +3086,7 @@ ArkClock.tagName = "ark-clock";
|
|
|
3044
3086
|
* movem e selecionam dando a volta, Home/End, Espaço seleciona. `change` só
|
|
3045
3087
|
* quando a seleção muda pelo usuário.
|
|
3046
3088
|
*/
|
|
3047
|
-
class ArkColorSwatches extends
|
|
3089
|
+
class ArkColorSwatches extends HTMLElementBase {
|
|
3048
3090
|
static get observedAttributes() {
|
|
3049
3091
|
return ["value", "colors", "label", "aria-label", "disabled", "size", "theme", "class", "testid"];
|
|
3050
3092
|
}
|
|
@@ -3118,6 +3160,12 @@ class ArkColorSwatches extends HTMLElement {
|
|
|
3118
3160
|
}
|
|
3119
3161
|
}
|
|
3120
3162
|
set colors(list) {
|
|
3163
|
+
// Frameworks que preferem propriedade a atributo (React 19, Vue) entregam o JSON do wrapper aqui.
|
|
3164
|
+
if (typeof list === "string") {
|
|
3165
|
+
this.colorsProperty = null;
|
|
3166
|
+
this.setAttribute("colors", list);
|
|
3167
|
+
return;
|
|
3168
|
+
}
|
|
3121
3169
|
this.colorsProperty = Array.isArray(list) ? list : null;
|
|
3122
3170
|
if (this.isConnected)
|
|
3123
3171
|
this.updateAppearance();
|
|
@@ -3240,7 +3288,7 @@ ArkColorSwatches.tagName = "ark-color-swatches";
|
|
|
3240
3288
|
* filtro e do nome (padrão: o texto dos filhos sem slot). A paleta escreve
|
|
3241
3289
|
* `id`, `hidden`, `aria-selected` e a ordem visual.
|
|
3242
3290
|
*/
|
|
3243
|
-
class ArkCommandItem extends
|
|
3291
|
+
class ArkCommandItem extends HTMLElementBase {
|
|
3244
3292
|
static get observedAttributes() {
|
|
3245
3293
|
return ["value", "group", "label", "disabled", "class", "testid"];
|
|
3246
3294
|
}
|
|
@@ -3274,10 +3322,16 @@ class ArkCommandItem extends HTMLElement {
|
|
|
3274
3322
|
get value() {
|
|
3275
3323
|
return this.getAttribute("value") || "";
|
|
3276
3324
|
}
|
|
3325
|
+
set value(value) {
|
|
3326
|
+
reflectAttr(this, "value", value);
|
|
3327
|
+
}
|
|
3277
3328
|
/** Seção em que a paleta lista o item; vazio é sem grupo. */
|
|
3278
3329
|
get group() {
|
|
3279
3330
|
return (this.getAttribute("group") || "").trim();
|
|
3280
3331
|
}
|
|
3332
|
+
set group(value) {
|
|
3333
|
+
reflectAttr(this, "group", value);
|
|
3334
|
+
}
|
|
3281
3335
|
/** Texto usado no filtro e no nome da opção: `label`, senão o texto dos filhos sem slot. */
|
|
3282
3336
|
get label() {
|
|
3283
3337
|
const attr = this.getAttribute("label");
|
|
@@ -3290,6 +3344,9 @@ class ArkCommandItem extends HTMLElement {
|
|
|
3290
3344
|
.replace(/\s+/g, " ")
|
|
3291
3345
|
.trim();
|
|
3292
3346
|
}
|
|
3347
|
+
set label(value) {
|
|
3348
|
+
reflectAttr(this, "label", value);
|
|
3349
|
+
}
|
|
3293
3350
|
get disabled() {
|
|
3294
3351
|
return this.hasAttribute("disabled");
|
|
3295
3352
|
}
|
|
@@ -3355,7 +3412,7 @@ function normalize(text) {
|
|
|
3355
3412
|
* Enter seleciona, Esc fecha; `hotkey` abre de qualquer lugar da página. A
|
|
3356
3413
|
* página para de rolar enquanto aberta, salvo com `no-scroll-lock`.
|
|
3357
3414
|
*/
|
|
3358
|
-
class ArkCommandPalette extends
|
|
3415
|
+
class ArkCommandPalette extends HTMLElementBase {
|
|
3359
3416
|
static get observedAttributes() {
|
|
3360
3417
|
return [
|
|
3361
3418
|
"open",
|
|
@@ -3381,6 +3438,8 @@ class ArkCommandPalette extends HTMLElement {
|
|
|
3381
3438
|
this.ownClasses = [];
|
|
3382
3439
|
this.syncingClass = false;
|
|
3383
3440
|
this.state = "closed";
|
|
3441
|
+
/** A abertura em curso veio do connectedCallback: o ark-open espera um microtask. */
|
|
3442
|
+
this.openingOnConnect = false;
|
|
3384
3443
|
this.releaseTrap = null;
|
|
3385
3444
|
this.queryTimer = null;
|
|
3386
3445
|
this.activeId = null;
|
|
@@ -3493,12 +3552,16 @@ class ArkCommandPalette extends HTMLElement {
|
|
|
3493
3552
|
if (!this.observer) {
|
|
3494
3553
|
// Itens que entram ou saem (busca assíncrona, frameworks) reordenam a lista.
|
|
3495
3554
|
this.observer = new MutationObserver(() => this.syncItems());
|
|
3496
|
-
|
|
3555
|
+
// subtree: o item de um wrapper de framework entra dentro do wrapper, não como filho da paleta.
|
|
3556
|
+
this.observer.observe(this, { childList: true, subtree: true });
|
|
3497
3557
|
}
|
|
3498
3558
|
document.addEventListener("keydown", this.handleHotkey);
|
|
3499
3559
|
this.updateAppearance();
|
|
3500
|
-
if (this.hasAttribute("open"))
|
|
3560
|
+
if (this.hasAttribute("open")) {
|
|
3561
|
+
this.openingOnConnect = true;
|
|
3501
3562
|
this.openNow();
|
|
3563
|
+
this.openingOnConnect = false;
|
|
3564
|
+
}
|
|
3502
3565
|
}
|
|
3503
3566
|
disconnectedCallback() {
|
|
3504
3567
|
this.observer?.disconnect();
|
|
@@ -3578,9 +3641,12 @@ class ArkCommandPalette extends HTMLElement {
|
|
|
3578
3641
|
this.removeAttribute("open");
|
|
3579
3642
|
}
|
|
3580
3643
|
// --- Itens ---
|
|
3581
|
-
/**
|
|
3644
|
+
/**
|
|
3645
|
+
* Os ark-command-item desta paleta, na ordem do DOM. Descendentes, não só filhos: um wrapper de framework (o
|
|
3646
|
+
* `<ark-command-item-wrapper>` do Angular) fica entre a paleta e o item. Itens de uma paleta aninhada são dela.
|
|
3647
|
+
*/
|
|
3582
3648
|
items() {
|
|
3583
|
-
return Array.from(this.querySelectorAll("
|
|
3649
|
+
return Array.from(this.querySelectorAll("ark-command-item")).filter((el) => el instanceof ArkCommandItem && el.closest("ark-command-palette") === this);
|
|
3584
3650
|
}
|
|
3585
3651
|
visibleItems() {
|
|
3586
3652
|
return this.items().filter((item) => !item.hidden);
|
|
@@ -3627,13 +3693,17 @@ class ArkCommandPalette extends HTMLElement {
|
|
|
3627
3693
|
}
|
|
3628
3694
|
groups.forEach((group, index) => {
|
|
3629
3695
|
const header = this.groupEls[index];
|
|
3630
|
-
|
|
3696
|
+
// Só escreve o que mudou: o observer (subtree) veria a troca do nó de texto e sincronizaria em laço.
|
|
3697
|
+
if (header.textContent !== group)
|
|
3698
|
+
header.textContent = group;
|
|
3631
3699
|
header.style.order = String((index + 1) * 1000);
|
|
3632
3700
|
applyTestHooks(this, "command-palette", header, "group");
|
|
3633
3701
|
});
|
|
3634
3702
|
this.listEl.setAttribute("aria-owns", visible.map((item) => item.id).join(" "));
|
|
3635
3703
|
this.emptyEl.hidden = visible.length > 0;
|
|
3636
|
-
|
|
3704
|
+
const noResults = this.getLocale().noResults;
|
|
3705
|
+
if (this.emptyEl.textContent !== noResults)
|
|
3706
|
+
this.emptyEl.textContent = noResults;
|
|
3637
3707
|
const enabled = visible.filter((item) => !item.disabled);
|
|
3638
3708
|
if (!enabled.some((item) => item.id === this.activeId))
|
|
3639
3709
|
this.activeId = enabled[0]?.id ?? null;
|
|
@@ -3696,7 +3766,17 @@ class ArkCommandPalette extends HTMLElement {
|
|
|
3696
3766
|
});
|
|
3697
3767
|
field?.select();
|
|
3698
3768
|
this.inputEl?.inputElement?.setAttribute("aria-expanded", "true");
|
|
3699
|
-
|
|
3769
|
+
const emit = () => {
|
|
3770
|
+
if (this.state === "open")
|
|
3771
|
+
this.dispatchEvent(new CustomEvent("ark-open", { bubbles: true, composed: true }));
|
|
3772
|
+
};
|
|
3773
|
+
// Aberto já ao conectar (open no HTML, hidratação de SSR, framework que grava a prop antes de inserir): o evento
|
|
3774
|
+
// sai num microtask, para chegar a quem se inscreve no mesmo ciclo em que o nó entrou (os wrappers React e
|
|
3775
|
+
// Angular ligam os listeners dos overlays durante a montagem) em vez de disparar antes de alguém escutar.
|
|
3776
|
+
if (this.openingOnConnect)
|
|
3777
|
+
queueMicrotask(emit);
|
|
3778
|
+
else
|
|
3779
|
+
emit();
|
|
3700
3780
|
}
|
|
3701
3781
|
closeNow() {
|
|
3702
3782
|
if (this.state !== "open")
|
|
@@ -3789,7 +3869,8 @@ class ArkCommandPalette extends HTMLElement {
|
|
|
3789
3869
|
this.inputEl.removeAttribute(attr);
|
|
3790
3870
|
}
|
|
3791
3871
|
}
|
|
3792
|
-
this.emptyEl.textContent
|
|
3872
|
+
if (this.emptyEl.textContent !== locale.noResults)
|
|
3873
|
+
this.emptyEl.textContent = locale.noResults;
|
|
3793
3874
|
applyTestHooks(this, "command-palette", this);
|
|
3794
3875
|
applyTestHooks(this, "command-palette", this.inputEl, "input");
|
|
3795
3876
|
applyTestHooks(this, "command-palette", this.listEl, "list");
|
|
@@ -4023,7 +4104,7 @@ const CALENDAR_ATTRS = [
|
|
|
4023
4104
|
"events",
|
|
4024
4105
|
"event-display"
|
|
4025
4106
|
];
|
|
4026
|
-
const CLOCK_ATTRS = ["lang", "theme", "intent", "seconds", "step-minutes", "hours-format"];
|
|
4107
|
+
const CLOCK_ATTRS = ["lang", "locale-json", "theme", "intent", "seconds", "step-minutes", "hours-format"];
|
|
4027
4108
|
const CALENDAR_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>`;
|
|
4028
4109
|
const CLOCK_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>`;
|
|
4029
4110
|
/**
|
|
@@ -4041,7 +4122,7 @@ const CLOCK_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="16" heigh
|
|
|
4041
4122
|
* core (abre abaixo, vira para cima sem espaço) e animado com `scale` a
|
|
4042
4123
|
* partir da origem.
|
|
4043
4124
|
*/
|
|
4044
|
-
class ArkDatepicker extends
|
|
4125
|
+
class ArkDatepicker extends HTMLElementBase {
|
|
4045
4126
|
constructor() {
|
|
4046
4127
|
super(...arguments);
|
|
4047
4128
|
this.calendarEl = null;
|
|
@@ -4049,6 +4130,8 @@ class ArkDatepicker extends HTMLElement {
|
|
|
4049
4130
|
this.inputComp = null;
|
|
4050
4131
|
this.toggleEl = null;
|
|
4051
4132
|
this.popupEl = null;
|
|
4133
|
+
/** Calendário e/ou relógio: inline no host ou dentro do popup. */
|
|
4134
|
+
this.panelEl = null;
|
|
4052
4135
|
/** Para de reposicionar o popup em scroll/resize; só existe enquanto aberto. */
|
|
4053
4136
|
this.disposePosition = null;
|
|
4054
4137
|
this.hiddenInputEl = null;
|
|
@@ -4164,6 +4247,9 @@ class ArkDatepicker extends HTMLElement {
|
|
|
4164
4247
|
get value() {
|
|
4165
4248
|
return this.getAttribute("value") || "";
|
|
4166
4249
|
}
|
|
4250
|
+
set value(value) {
|
|
4251
|
+
reflectAttr(this, "value", value);
|
|
4252
|
+
}
|
|
4167
4253
|
hasRendered() {
|
|
4168
4254
|
return this.calendarEl !== null || this.clockEl !== null;
|
|
4169
4255
|
}
|
|
@@ -4323,6 +4409,7 @@ class ArkDatepicker extends HTMLElement {
|
|
|
4323
4409
|
this.inputComp = null;
|
|
4324
4410
|
this.toggleEl = null;
|
|
4325
4411
|
this.popupEl = null;
|
|
4412
|
+
this.panelEl = null;
|
|
4326
4413
|
this.hiddenInputEl = null;
|
|
4327
4414
|
}
|
|
4328
4415
|
forwardAttr(target, name) {
|
|
@@ -4365,8 +4452,14 @@ class ArkDatepicker extends HTMLElement {
|
|
|
4365
4452
|
}
|
|
4366
4453
|
render() {
|
|
4367
4454
|
const panel = this.buildPanel();
|
|
4455
|
+
this.panelEl = panel;
|
|
4456
|
+
// O valor vai ao formulário por um input oculto nos dois modos (inline também participa de <form>).
|
|
4457
|
+
const hidden = document.createElement("input");
|
|
4458
|
+
hidden.type = "hidden";
|
|
4459
|
+
this.hiddenInputEl = hidden;
|
|
4368
4460
|
if (!this.isInputMode()) {
|
|
4369
4461
|
this.appendChild(panel);
|
|
4462
|
+
this.appendChild(hidden);
|
|
4370
4463
|
this.applyHooks();
|
|
4371
4464
|
return;
|
|
4372
4465
|
}
|
|
@@ -4419,8 +4512,6 @@ class ArkDatepicker extends HTMLElement {
|
|
|
4419
4512
|
popup.setAttribute("popover", "manual");
|
|
4420
4513
|
popup.setAttribute("role", "dialog");
|
|
4421
4514
|
popup.appendChild(panel);
|
|
4422
|
-
const hidden = document.createElement("input");
|
|
4423
|
-
hidden.type = "hidden";
|
|
4424
4515
|
wrapper.appendChild(inputComp);
|
|
4425
4516
|
wrapper.appendChild(popup);
|
|
4426
4517
|
this.appendChild(wrapper);
|
|
@@ -4428,7 +4519,6 @@ class ArkDatepicker extends HTMLElement {
|
|
|
4428
4519
|
this.inputComp = inputComp;
|
|
4429
4520
|
this.toggleEl = toggle;
|
|
4430
4521
|
this.popupEl = popup;
|
|
4431
|
-
this.hiddenInputEl = hidden;
|
|
4432
4522
|
this.applyHooks();
|
|
4433
4523
|
}
|
|
4434
4524
|
applyHooks() {
|
|
@@ -4488,10 +4578,21 @@ class ArkDatepicker extends HTMLElement {
|
|
|
4488
4578
|
}
|
|
4489
4579
|
/** Sincroniza aparência/estado do campo com os atributos atuais. */
|
|
4490
4580
|
syncField() {
|
|
4491
|
-
|
|
4581
|
+
const disabled = this.hasAttribute("disabled");
|
|
4582
|
+
// Nos dois modos: o input oculto leva nome e valor ao formulário, e `disabled` tira os painéis de interação
|
|
4583
|
+
// (inline eles estão à vista; no modo input o campo e o botão também ficam desabilitados abaixo).
|
|
4584
|
+
if (this.hiddenInputEl) {
|
|
4585
|
+
this.hiddenInputEl.name = this.getAttribute("name") || "";
|
|
4586
|
+
this.hiddenInputEl.value = this.getAttribute("value") || "";
|
|
4587
|
+
this.hiddenInputEl.disabled = disabled;
|
|
4588
|
+
}
|
|
4589
|
+
if (this.panelEl) {
|
|
4590
|
+
this.panelEl.inert = disabled;
|
|
4591
|
+
this.panelEl.classList.toggle("ark:opacity-50", disabled);
|
|
4592
|
+
}
|
|
4593
|
+
if (!this.isInputMode() || !this.inputComp || !this.toggleEl || !this.popupEl)
|
|
4492
4594
|
return;
|
|
4493
4595
|
const loc = this.getLocale();
|
|
4494
|
-
const disabled = this.hasAttribute("disabled");
|
|
4495
4596
|
this.forwardAttr(this.inputComp, "theme");
|
|
4496
4597
|
this.inputComp.setAttribute("placeholder", this.getAttribute("placeholder") || this.getFormat().toLowerCase());
|
|
4497
4598
|
if (disabled) {
|
|
@@ -4507,9 +4608,6 @@ class ArkDatepicker extends HTMLElement {
|
|
|
4507
4608
|
this.popupEl.setAttribute("aria-label", loc.openCalendar);
|
|
4508
4609
|
this.inputComp.inputElement?.setAttribute("aria-haspopup", "dialog");
|
|
4509
4610
|
this.inputComp.inputElement?.setAttribute("aria-expanded", this.popupOpen ? "true" : "false");
|
|
4510
|
-
this.hiddenInputEl.name = this.getAttribute("name") || "";
|
|
4511
|
-
this.hiddenInputEl.value = this.getAttribute("value") || "";
|
|
4512
|
-
this.hiddenInputEl.disabled = disabled;
|
|
4513
4611
|
this.updateInputDisplay();
|
|
4514
4612
|
}
|
|
4515
4613
|
updateInputDisplay() {
|
|
@@ -4635,7 +4733,7 @@ function cssLength$2(value) {
|
|
|
4635
4733
|
* navegando por cursor virtual ainda alcança o conteúdo atrás. A página para
|
|
4636
4734
|
* de rolar enquanto aberto (`lockScroll` de core), salvo com `no-scroll-lock`.
|
|
4637
4735
|
*/
|
|
4638
|
-
class ArkDialog extends
|
|
4736
|
+
class ArkDialog extends HTMLElementBase {
|
|
4639
4737
|
static get observedAttributes() {
|
|
4640
4738
|
return [
|
|
4641
4739
|
"open",
|
|
@@ -4662,6 +4760,8 @@ class ArkDialog extends HTMLElement {
|
|
|
4662
4760
|
this.syncingClass = false;
|
|
4663
4761
|
/** Visibilidade real: `open` também cobre a animação de entrada; `closing` é a saída ainda visível. */
|
|
4664
4762
|
this.state = "closed";
|
|
4763
|
+
/** A abertura em curso veio do connectedCallback: o ark-open espera um microtask. */
|
|
4764
|
+
this.openingOnConnect = false;
|
|
4665
4765
|
this.releaseTrap = null;
|
|
4666
4766
|
/** Motivo pedido por `close(reason)`, lido quando o atributo `open` some. */
|
|
4667
4767
|
this.pendingReason = null;
|
|
@@ -4687,8 +4787,11 @@ class ArkDialog extends HTMLElement {
|
|
|
4687
4787
|
this.observer.observe(this, { childList: true });
|
|
4688
4788
|
}
|
|
4689
4789
|
this.updateAppearance();
|
|
4690
|
-
if (this.hasAttribute("open"))
|
|
4790
|
+
if (this.hasAttribute("open")) {
|
|
4791
|
+
this.openingOnConnect = true;
|
|
4691
4792
|
this.openNow();
|
|
4793
|
+
this.openingOnConnect = false;
|
|
4794
|
+
}
|
|
4692
4795
|
}
|
|
4693
4796
|
disconnectedCallback() {
|
|
4694
4797
|
this.observer?.disconnect();
|
|
@@ -4778,7 +4881,17 @@ class ArkDialog extends HTMLElement {
|
|
|
4778
4881
|
this.close("backdrop");
|
|
4779
4882
|
}
|
|
4780
4883
|
});
|
|
4781
|
-
|
|
4884
|
+
const emit = () => {
|
|
4885
|
+
if (this.state === "open")
|
|
4886
|
+
this.dispatchEvent(new CustomEvent("ark-open", { bubbles: true, composed: true }));
|
|
4887
|
+
};
|
|
4888
|
+
// Aberto já ao conectar (open no HTML, hidratação de SSR, framework que grava a prop antes de inserir): o evento
|
|
4889
|
+
// sai num microtask, para chegar a quem se inscreve no mesmo ciclo em que o nó entrou (os wrappers React e
|
|
4890
|
+
// Angular ligam os listeners dos overlays durante a montagem) em vez de disparar antes de alguém escutar.
|
|
4891
|
+
if (this.openingOnConnect)
|
|
4892
|
+
queueMicrotask(emit);
|
|
4893
|
+
else
|
|
4894
|
+
emit();
|
|
4782
4895
|
}
|
|
4783
4896
|
closeNow(reason) {
|
|
4784
4897
|
if (this.state !== "open")
|
|
@@ -4990,7 +5103,7 @@ function cssLength$1(value) {
|
|
|
4990
5103
|
* verdade, como no ark-dialog, e em overlay a página para de rolar enquanto
|
|
4991
5104
|
* aberta, salvo com `no-scroll-lock`.
|
|
4992
5105
|
*/
|
|
4993
|
-
class ArkDrawer extends
|
|
5106
|
+
class ArkDrawer extends HTMLElementBase {
|
|
4994
5107
|
static get observedAttributes() {
|
|
4995
5108
|
return [
|
|
4996
5109
|
"open",
|
|
@@ -5016,6 +5129,8 @@ class ArkDrawer extends HTMLElement {
|
|
|
5016
5129
|
this.ownClasses = [];
|
|
5017
5130
|
this.syncingClass = false;
|
|
5018
5131
|
this.state = "closed";
|
|
5132
|
+
/** A abertura em curso veio do connectedCallback: o ark-open espera um microtask. */
|
|
5133
|
+
this.openingOnConnect = false;
|
|
5019
5134
|
this.releaseTrap = null;
|
|
5020
5135
|
this.pendingReason = null;
|
|
5021
5136
|
this.warned = false;
|
|
@@ -5038,8 +5153,11 @@ class ArkDrawer extends HTMLElement {
|
|
|
5038
5153
|
this.observer.observe(this, { childList: true });
|
|
5039
5154
|
}
|
|
5040
5155
|
this.updateAppearance();
|
|
5041
|
-
if (this.hasAttribute("open"))
|
|
5156
|
+
if (this.hasAttribute("open")) {
|
|
5157
|
+
this.openingOnConnect = true;
|
|
5042
5158
|
this.openNow();
|
|
5159
|
+
this.openingOnConnect = false;
|
|
5160
|
+
}
|
|
5043
5161
|
}
|
|
5044
5162
|
disconnectedCallback() {
|
|
5045
5163
|
this.observer?.disconnect();
|
|
@@ -5103,10 +5221,16 @@ class ArkDrawer extends HTMLElement {
|
|
|
5103
5221
|
const side = (this.getAttribute("side") || "").toLowerCase();
|
|
5104
5222
|
return side === "left" || side === "top" || side === "bottom" ? side : "right";
|
|
5105
5223
|
}
|
|
5224
|
+
set side(value) {
|
|
5225
|
+
reflectAttr(this, "side", value);
|
|
5226
|
+
}
|
|
5106
5227
|
/** `overlay` (popover modal com scrim) ou `inline` (no fluxo, só anima). Padrão: "overlay". */
|
|
5107
5228
|
get mode() {
|
|
5108
5229
|
return (this.getAttribute("mode") || "").toLowerCase() === "inline" ? "inline" : "overlay";
|
|
5109
5230
|
}
|
|
5231
|
+
set mode(value) {
|
|
5232
|
+
reflectAttr(this, "mode", value);
|
|
5233
|
+
}
|
|
5110
5234
|
/** Abre a gaveta: adiciona `open`, que faz o resto. */
|
|
5111
5235
|
show() {
|
|
5112
5236
|
if (!this.open)
|
|
@@ -5155,7 +5279,17 @@ class ArkDrawer extends HTMLElement {
|
|
|
5155
5279
|
animation.cancel();
|
|
5156
5280
|
void core.arkEnter(this, this.preset(), { easing: "sheet" });
|
|
5157
5281
|
}
|
|
5158
|
-
|
|
5282
|
+
const emit = () => {
|
|
5283
|
+
if (this.state === "open")
|
|
5284
|
+
this.dispatchEvent(new CustomEvent("ark-open", { bubbles: true, composed: true }));
|
|
5285
|
+
};
|
|
5286
|
+
// Aberto já ao conectar (open no HTML, hidratação de SSR, framework que grava a prop antes de inserir): o evento
|
|
5287
|
+
// sai num microtask, para chegar a quem se inscreve no mesmo ciclo em que o nó entrou (os wrappers React e
|
|
5288
|
+
// Angular ligam os listeners dos overlays durante a montagem) em vez de disparar antes de alguém escutar.
|
|
5289
|
+
if (this.openingOnConnect)
|
|
5290
|
+
queueMicrotask(emit);
|
|
5291
|
+
else
|
|
5292
|
+
emit();
|
|
5159
5293
|
}
|
|
5160
5294
|
closeNow(reason) {
|
|
5161
5295
|
if (this.state !== "open")
|
|
@@ -5357,7 +5491,7 @@ ArkDrawer.tagName = "ark-drawer";
|
|
|
5357
5491
|
* `description`, em nós do componente ao fim do host. Filhos sem slot entram
|
|
5358
5492
|
* entre a descrição e a ação. Não é interativo e não tem role próprio.
|
|
5359
5493
|
*/
|
|
5360
|
-
class ArkEmpty extends
|
|
5494
|
+
class ArkEmpty extends HTMLElementBase {
|
|
5361
5495
|
constructor() {
|
|
5362
5496
|
super(...arguments);
|
|
5363
5497
|
this.ownClasses = [];
|
|
@@ -5476,7 +5610,7 @@ const UPLOAD_SVG = `
|
|
|
5476
5610
|
* tela. O rótulo aponta para o input (associação nativa) e nomeia o botão
|
|
5477
5611
|
* junto do próprio texto dele.
|
|
5478
5612
|
*/
|
|
5479
|
-
class ArkFileInput extends
|
|
5613
|
+
class ArkFileInput extends HTMLElementBase {
|
|
5480
5614
|
constructor() {
|
|
5481
5615
|
super(...arguments);
|
|
5482
5616
|
this.inputEl = null;
|
|
@@ -5913,7 +6047,7 @@ let arkInputIdCounter = 0;
|
|
|
5913
6047
|
* um botão de mostrar/ocultar na ponta direita. Atributos nativos como
|
|
5914
6048
|
* `maxlength` ou `inputmode` são espelhados no <input> sem interpretação.
|
|
5915
6049
|
*/
|
|
5916
|
-
class ArkInput extends
|
|
6050
|
+
class ArkInput extends HTMLElementBase {
|
|
5917
6051
|
constructor() {
|
|
5918
6052
|
super(...arguments);
|
|
5919
6053
|
this.inputEl = null;
|
|
@@ -6222,7 +6356,7 @@ ArkInput.tagName = "ark-input";
|
|
|
6222
6356
|
* usuário. Não é interativo e não tem role próprio; para leitores de tela é
|
|
6223
6357
|
* texto comum, como um <kbd>.
|
|
6224
6358
|
*/
|
|
6225
|
-
class ArkKbd extends
|
|
6359
|
+
class ArkKbd extends HTMLElementBase {
|
|
6226
6360
|
constructor() {
|
|
6227
6361
|
super(...arguments);
|
|
6228
6362
|
this.ownClasses = [];
|
|
@@ -6344,7 +6478,7 @@ function cloneRow(row) {
|
|
|
6344
6478
|
* adicionar e remover anunciam a contagem ao leitor de tela. A célula de
|
|
6345
6479
|
* valor é um ark-input comum: autocomplete de variáveis fica no app.
|
|
6346
6480
|
*/
|
|
6347
|
-
class ArkKvEditor extends
|
|
6481
|
+
class ArkKvEditor extends HTMLElementBase {
|
|
6348
6482
|
static get observedAttributes() {
|
|
6349
6483
|
return [
|
|
6350
6484
|
"rows",
|
|
@@ -6440,6 +6574,11 @@ class ArkKvEditor extends HTMLElement {
|
|
|
6440
6574
|
return this.model.map((row) => ({ ...row }));
|
|
6441
6575
|
}
|
|
6442
6576
|
set rows(value) {
|
|
6577
|
+
// Uma string é o JSON do atributo (React 19 e Vue gravam a prop como propriedade): segue o caminho do atributo.
|
|
6578
|
+
if (typeof value === "string") {
|
|
6579
|
+
this.setAttribute("rows", value);
|
|
6580
|
+
return;
|
|
6581
|
+
}
|
|
6443
6582
|
this.model = Array.isArray(value) ? value.map(cloneRow) : [];
|
|
6444
6583
|
this.resetRows();
|
|
6445
6584
|
if (this.isConnected)
|
|
@@ -6817,9 +6956,11 @@ class ArkKvEditor extends HTMLElement {
|
|
|
6817
6956
|
input.toggleAttribute("readonly", readonly);
|
|
6818
6957
|
applyTestHooks(this, "kv-editor", input, name);
|
|
6819
6958
|
}
|
|
6820
|
-
//
|
|
6959
|
+
// Tipo efetivo: com a coluna de tipos, o que o select mostra (o da linha se está na lista, senão o primeiro).
|
|
6960
|
+
const rowType = types.length > 0 ? (row.type && types.includes(row.type) ? row.type : types[0]) : row.type;
|
|
6961
|
+
// Campo de valor: senha com o olho quando é segredo; senão o tipo efetivo (number, date...) ou texto.
|
|
6821
6962
|
const isSecret = withSecret && row.secret === true;
|
|
6822
|
-
parts.value.setAttribute("type", isSecret ? "password" : (VALUE_INPUT_TYPES[
|
|
6963
|
+
parts.value.setAttribute("type", isSecret ? "password" : (VALUE_INPUT_TYPES[rowType ?? ""] ?? "text"));
|
|
6823
6964
|
parts.value.toggleAttribute("reveal", isSecret);
|
|
6824
6965
|
if (parts.secret) {
|
|
6825
6966
|
parts.secret.setAttribute("aria-label", locale.secret);
|
|
@@ -6837,9 +6978,8 @@ class ArkKvEditor extends HTMLElement {
|
|
|
6837
6978
|
}
|
|
6838
6979
|
if (parts.type) {
|
|
6839
6980
|
parts.type.options = types.map((type) => ({ value: type, label: type }));
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
parts.type.value = current;
|
|
6981
|
+
if (rowType && parts.type.value !== rowType)
|
|
6982
|
+
parts.type.value = rowType;
|
|
6843
6983
|
parts.type.setAttribute("aria-label", locale.type);
|
|
6844
6984
|
parts.type.setAttribute("size", size);
|
|
6845
6985
|
parts.type.toggleAttribute("disabled", readonly);
|
|
@@ -6998,7 +7138,7 @@ function cssLength(value) {
|
|
|
6998
7138
|
* nomeado; sem ele é decorativo (`aria-hidden`): o texto ao lado é o que
|
|
6999
7139
|
* conta.
|
|
7000
7140
|
*/
|
|
7001
|
-
class ArkMark extends
|
|
7141
|
+
class ArkMark extends HTMLElementBase {
|
|
7002
7142
|
constructor() {
|
|
7003
7143
|
super(...arguments);
|
|
7004
7144
|
this.ownClasses = [];
|
|
@@ -7103,7 +7243,7 @@ let menuSeq = 0;
|
|
|
7103
7243
|
* a saída são transições CSS em components.css, porque o light dismiss de um
|
|
7104
7244
|
* popover auto não pode ser interceptado por JS para animar antes de esconder.
|
|
7105
7245
|
*/
|
|
7106
|
-
class ArkMenu extends
|
|
7246
|
+
class ArkMenu extends HTMLElementBase {
|
|
7107
7247
|
static get observedAttributes() {
|
|
7108
7248
|
return ["for", "open", "align", "direction", "size", "theme", "class", "testid"];
|
|
7109
7249
|
}
|
|
@@ -7274,6 +7414,11 @@ class ArkMenu extends HTMLElement {
|
|
|
7274
7414
|
}
|
|
7275
7415
|
set open(value) {
|
|
7276
7416
|
const next = core.coerceBooleanAttr(value);
|
|
7417
|
+
// Desconectado (React 19 e Vue gravam a prop antes de inserir o nó): só reflete; o connectedCallback abre.
|
|
7418
|
+
if (!this.isConnected) {
|
|
7419
|
+
this.toggleAttribute("open", next);
|
|
7420
|
+
return;
|
|
7421
|
+
}
|
|
7277
7422
|
if (next) {
|
|
7278
7423
|
this.show();
|
|
7279
7424
|
}
|
|
@@ -7491,7 +7636,7 @@ const CHECK_SVG$1 = `
|
|
|
7491
7636
|
* item. Seleção, foco e teclado são coordenados pelo ark-menu; `size` e
|
|
7492
7637
|
* `theme` chegam propagados dele.
|
|
7493
7638
|
*/
|
|
7494
|
-
class ArkMenuItem extends
|
|
7639
|
+
class ArkMenuItem extends HTMLElementBase {
|
|
7495
7640
|
static get observedAttributes() {
|
|
7496
7641
|
return ["value", "disabled", "intent", "divider", "checked", "static", "size", "theme", "class", "testid"];
|
|
7497
7642
|
}
|
|
@@ -7535,6 +7680,9 @@ class ArkMenuItem extends HTMLElement {
|
|
|
7535
7680
|
get value() {
|
|
7536
7681
|
return this.getAttribute("value") || "";
|
|
7537
7682
|
}
|
|
7683
|
+
set value(value) {
|
|
7684
|
+
reflectAttr(this, "value", value);
|
|
7685
|
+
}
|
|
7538
7686
|
get disabled() {
|
|
7539
7687
|
return this.hasAttribute("disabled");
|
|
7540
7688
|
}
|
|
@@ -7546,6 +7694,11 @@ class ArkMenuItem extends HTMLElement {
|
|
|
7546
7694
|
return this.hasAttribute("checked") && this.getAttribute("checked") !== "false";
|
|
7547
7695
|
}
|
|
7548
7696
|
set checked(value) {
|
|
7697
|
+
// Três estados: null/undefined voltam a item comum (React tira a prop assim); false desmarca o checkbox.
|
|
7698
|
+
if (value === null || value === undefined) {
|
|
7699
|
+
this.removeAttribute("checked");
|
|
7700
|
+
return;
|
|
7701
|
+
}
|
|
7549
7702
|
this.setAttribute("checked", core.coerceBooleanAttr(value) ? "" : "false");
|
|
7550
7703
|
}
|
|
7551
7704
|
/** Item selecionável (não é divisor nem conteúdo estático). */
|
|
@@ -7711,7 +7864,7 @@ ArkMenuItem.tagName = "ark-menu-item";
|
|
|
7711
7864
|
* loop, com duração fixa e isento de movimento reduzido, como o spinner: é o
|
|
7712
7865
|
* único sinal de progresso.
|
|
7713
7866
|
*/
|
|
7714
|
-
class ArkProgress extends
|
|
7867
|
+
class ArkProgress extends HTMLElementBase {
|
|
7715
7868
|
constructor() {
|
|
7716
7869
|
super(...arguments);
|
|
7717
7870
|
this.ownClasses = [];
|
|
@@ -7896,7 +8049,7 @@ let nextId = 0;
|
|
|
7896
8049
|
* marcado, ou o primeiro habilitado). `label`, aria-label e filhos nomeiam a
|
|
7897
8050
|
* opção como no ark-checkbox.
|
|
7898
8051
|
*/
|
|
7899
|
-
class ArkRadio extends
|
|
8052
|
+
class ArkRadio extends HTMLElementBase {
|
|
7900
8053
|
static get observedAttributes() {
|
|
7901
8054
|
return [
|
|
7902
8055
|
"checked",
|
|
@@ -8351,7 +8504,7 @@ const DEFAULT_EVENT_MINUTES = 60;
|
|
|
8351
8504
|
* eventos são o conteúdo: clicar num evento emite `ark-event-click` e clicar num
|
|
8352
8505
|
* espaço livre emite `ark-slot-click` (útil para criar um evento).
|
|
8353
8506
|
*/
|
|
8354
|
-
class ArkScheduler extends
|
|
8507
|
+
class ArkScheduler extends HTMLElementBase {
|
|
8355
8508
|
constructor() {
|
|
8356
8509
|
super(...arguments);
|
|
8357
8510
|
this.root = null;
|
|
@@ -8360,6 +8513,8 @@ class ArkScheduler extends HTMLElement {
|
|
|
8360
8513
|
this.refDate = new Date();
|
|
8361
8514
|
this.nowTimer = null;
|
|
8362
8515
|
this.navDirection = null;
|
|
8516
|
+
/** Último período anunciado (título do cabeçalho); o primeiro build só registra, sem anunciar. */
|
|
8517
|
+
this.announcedPeriod = null;
|
|
8363
8518
|
this.syncingAttr = false;
|
|
8364
8519
|
/** Linhas de "agora" vivas na tela: reposicionadas sem rebuild a cada minuto. */
|
|
8365
8520
|
this.nowLines = [];
|
|
@@ -8415,6 +8570,12 @@ class ArkScheduler extends HTMLElement {
|
|
|
8415
8570
|
return this.eventsProp ?? this.parseEventsAttr();
|
|
8416
8571
|
}
|
|
8417
8572
|
set events(list) {
|
|
8573
|
+
// Frameworks que preferem propriedade a atributo (React 19, Vue) entregam o JSON do wrapper aqui.
|
|
8574
|
+
if (typeof list === "string") {
|
|
8575
|
+
this.eventsProp = null;
|
|
8576
|
+
this.setAttribute("events", list);
|
|
8577
|
+
return;
|
|
8578
|
+
}
|
|
8418
8579
|
this.eventsProp = Array.isArray(list) ? list : null;
|
|
8419
8580
|
if (this.root)
|
|
8420
8581
|
this.build();
|
|
@@ -8431,6 +8592,9 @@ class ArkScheduler extends HTMLElement {
|
|
|
8431
8592
|
get date() {
|
|
8432
8593
|
return formatISODate(this.refDate);
|
|
8433
8594
|
}
|
|
8595
|
+
set date(value) {
|
|
8596
|
+
reflectAttr(this, "date", value);
|
|
8597
|
+
}
|
|
8434
8598
|
parseEventsAttr() {
|
|
8435
8599
|
const raw = this.getAttribute("events");
|
|
8436
8600
|
if (!raw)
|
|
@@ -8694,8 +8858,8 @@ class ArkScheduler extends HTMLElement {
|
|
|
8694
8858
|
applyTestHooks(this, "scheduler", nextBtn, "next");
|
|
8695
8859
|
const title = document.createElement("h2");
|
|
8696
8860
|
title.className = `${palette.headerText} ark:ml-1`;
|
|
8697
|
-
title.setAttribute("aria-live", "polite");
|
|
8698
8861
|
title.textContent = this.getTitle();
|
|
8862
|
+
this.announcePeriod(title.textContent);
|
|
8699
8863
|
applyTestHooks(this, "scheduler", title, "title");
|
|
8700
8864
|
left.appendChild(todayBtn);
|
|
8701
8865
|
left.appendChild(prevBtn);
|
|
@@ -8729,6 +8893,8 @@ class ArkScheduler extends HTMLElement {
|
|
|
8729
8893
|
return;
|
|
8730
8894
|
this.setAttribute("view", detail.value);
|
|
8731
8895
|
this.dispatchEvent(new CustomEvent("ark-view-change", { detail: { view: detail.value }, bubbles: true, composed: true }));
|
|
8896
|
+
// Outra view mostra outro intervalo (a semana vira o mês): quem carrega eventos por período precisa saber.
|
|
8897
|
+
this.emitRangeChange();
|
|
8732
8898
|
});
|
|
8733
8899
|
header.appendChild(left);
|
|
8734
8900
|
header.appendChild(group);
|
|
@@ -8984,6 +9150,7 @@ class ArkScheduler extends HTMLElement {
|
|
|
8984
9150
|
this.syncDateAttr();
|
|
8985
9151
|
this.setAttribute("view", "day");
|
|
8986
9152
|
this.dispatchEvent(new CustomEvent("ark-view-change", { detail: { view: "day" }, bubbles: true, composed: true }));
|
|
9153
|
+
this.emitRangeChange();
|
|
8987
9154
|
});
|
|
8988
9155
|
cell.appendChild(more);
|
|
8989
9156
|
}
|
|
@@ -9075,6 +9242,13 @@ class ArkScheduler extends HTMLElement {
|
|
|
9075
9242
|
line.style.top = `${((nowMinutes - hourStart * 60) / totalMinutes) * bodyHeight}px`;
|
|
9076
9243
|
}
|
|
9077
9244
|
}
|
|
9245
|
+
// A troca de período vai ao leitor de tela pelo anunciador do core: um aria-live no título entraria no nome do
|
|
9246
|
+
// controle e, recriado a cada build, nem seria anunciado.
|
|
9247
|
+
announcePeriod(text) {
|
|
9248
|
+
if (this.announcedPeriod !== null && this.announcedPeriod !== text)
|
|
9249
|
+
core.announce(text);
|
|
9250
|
+
this.announcedPeriod = text;
|
|
9251
|
+
}
|
|
9078
9252
|
build() {
|
|
9079
9253
|
if (!this.locale)
|
|
9080
9254
|
this.locale = this.getLocale();
|
|
@@ -9130,7 +9304,7 @@ let arkSelectIdCounter = 0;
|
|
|
9130
9304
|
* propriedade JS), nunca de filhos: o <select> exige os <option> dentro dele
|
|
9131
9305
|
* e a lib não move filhos do usuário.
|
|
9132
9306
|
*/
|
|
9133
|
-
class ArkSelect extends
|
|
9307
|
+
class ArkSelect extends HTMLElementBase {
|
|
9134
9308
|
constructor() {
|
|
9135
9309
|
super(...arguments);
|
|
9136
9310
|
this.selectEl = null;
|
|
@@ -9436,7 +9610,7 @@ const SHAPE_LABEL = {
|
|
|
9436
9610
|
* e nomeada pelo nome localizado da forma. Mesmo teclado do
|
|
9437
9611
|
* ark-color-swatches. `change` só quando a seleção muda pelo usuário.
|
|
9438
9612
|
*/
|
|
9439
|
-
class ArkShapePicker extends
|
|
9613
|
+
class ArkShapePicker extends HTMLElementBase {
|
|
9440
9614
|
static get observedAttributes() {
|
|
9441
9615
|
return [
|
|
9442
9616
|
"value",
|
|
@@ -9650,7 +9824,7 @@ const RADIUS = {
|
|
|
9650
9824
|
* substitui o skeleton
|
|
9651
9825
|
* entra com `.ark-animate-fade-in`, sem elemento próprio para isso.
|
|
9652
9826
|
*/
|
|
9653
|
-
class ArkSkeleton extends
|
|
9827
|
+
class ArkSkeleton extends HTMLElementBase {
|
|
9654
9828
|
constructor() {
|
|
9655
9829
|
super(...arguments);
|
|
9656
9830
|
this.ownClasses = [];
|
|
@@ -9802,7 +9976,7 @@ const SPINNER_SVG = `
|
|
|
9802
9976
|
* string `loading` do idioma). Gira sempre, inclusive sob movimento reduzido:
|
|
9803
9977
|
* é o único sinal de progresso. Sem `intent` herda a cor do texto ao redor.
|
|
9804
9978
|
*/
|
|
9805
|
-
class ArkSpinner extends
|
|
9979
|
+
class ArkSpinner extends HTMLElementBase {
|
|
9806
9980
|
constructor() {
|
|
9807
9981
|
super(...arguments);
|
|
9808
9982
|
this.ownClasses = [];
|
|
@@ -9911,7 +10085,7 @@ const BIG_STEP = 10;
|
|
|
9911
10085
|
* reescrito a cada mudança) e `ark-resize` publica os tamanhos; persistir é
|
|
9912
10086
|
* do app. Nada anima: redimensionar é interação de alta frequência.
|
|
9913
10087
|
*/
|
|
9914
|
-
class ArkSplitPane extends
|
|
10088
|
+
class ArkSplitPane extends HTMLElementBase {
|
|
9915
10089
|
constructor() {
|
|
9916
10090
|
super(...arguments);
|
|
9917
10091
|
this.handles = [];
|
|
@@ -10022,7 +10196,8 @@ class ArkSplitPane extends HTMLElement {
|
|
|
10022
10196
|
return this.normalizedSizes(this.panels().length);
|
|
10023
10197
|
}
|
|
10024
10198
|
set sizes(value) {
|
|
10025
|
-
|
|
10199
|
+
// React 19 e Vue entregam aqui a string do atributo ("30,70") quando a prop vem do wrapper.
|
|
10200
|
+
this.setAttribute("sizes", typeof value === "string" ? value : value.map((size) => String(size)).join(","));
|
|
10026
10201
|
}
|
|
10027
10202
|
// --- Painéis e medidas ---
|
|
10028
10203
|
/** Os filhos do usuário: tudo que não é chrome do componente. */
|
|
@@ -10208,7 +10383,7 @@ ArkSplitPane.tagName = "ark-split-pane";
|
|
|
10208
10383
|
* (`aria-hidden`), para o texto ao lado ser o que conta. Estático por
|
|
10209
10384
|
* design: nunca pulsa.
|
|
10210
10385
|
*/
|
|
10211
|
-
class ArkStatusDot extends
|
|
10386
|
+
class ArkStatusDot extends HTMLElementBase {
|
|
10212
10387
|
constructor() {
|
|
10213
10388
|
super(...arguments);
|
|
10214
10389
|
this.ownClasses = [];
|
|
@@ -10299,7 +10474,7 @@ const CROSS_SVG = '<svg viewBox="0 0 12 12" fill="none" stroke="currentColor" st
|
|
|
10299
10474
|
* submetendo `name`/`value` apenas quando marcado. Tem tabela de proporções
|
|
10300
10475
|
* própria, em vez da escala de altura dos demais controles.
|
|
10301
10476
|
*/
|
|
10302
|
-
class ArkSwitch extends
|
|
10477
|
+
class ArkSwitch extends HTMLElementBase {
|
|
10303
10478
|
constructor() {
|
|
10304
10479
|
super(...arguments);
|
|
10305
10480
|
this.trackEl = null;
|
|
@@ -10604,7 +10779,7 @@ const CLOSE_SVG = `
|
|
|
10604
10779
|
* Seleção e roving tabindex são coordenados pelo ark-tabs; `variant`,
|
|
10605
10780
|
* `size`, `intent`, `theme` e idioma chegam propagados dele.
|
|
10606
10781
|
*/
|
|
10607
|
-
class ArkTab extends
|
|
10782
|
+
class ArkTab extends HTMLElementBase {
|
|
10608
10783
|
static get observedAttributes() {
|
|
10609
10784
|
return [
|
|
10610
10785
|
"value",
|
|
@@ -10684,6 +10859,9 @@ class ArkTab extends HTMLElement {
|
|
|
10684
10859
|
get value() {
|
|
10685
10860
|
return this.getAttribute("value") || "";
|
|
10686
10861
|
}
|
|
10862
|
+
set value(value) {
|
|
10863
|
+
reflectAttr(this, "value", value);
|
|
10864
|
+
}
|
|
10687
10865
|
/** Aba ativa; o ark-tabs reflete aqui o seu `value`. */
|
|
10688
10866
|
get selected() {
|
|
10689
10867
|
return this.hasAttribute("selected");
|
|
@@ -10707,6 +10885,9 @@ class ArkTab extends HTMLElement {
|
|
|
10707
10885
|
get closable() {
|
|
10708
10886
|
return this.hasAttribute("closable") && this.getVariant() === "editor";
|
|
10709
10887
|
}
|
|
10888
|
+
set closable(value) {
|
|
10889
|
+
this.toggleAttribute("closable", core.coerceBooleanAttr(value));
|
|
10890
|
+
}
|
|
10710
10891
|
/** Pede a seleção desta aba: emite `change` com o valor, que o ark-tabs consolida. */
|
|
10711
10892
|
select() {
|
|
10712
10893
|
if (this.disabled || this.selected)
|
|
@@ -10957,7 +11138,7 @@ const PROPAGATED_ATTRS = ["variant", "size", "intent", "rounded", "fill", "theme
|
|
|
10957
11138
|
* inserido de uma vez o grupo pode rodar antes de as abas serem upgraded, e
|
|
10958
11139
|
* uma propriedade escrita antes do upgrade esconderia o accessor da classe.
|
|
10959
11140
|
*/
|
|
10960
|
-
class ArkTabs extends
|
|
11141
|
+
class ArkTabs extends HTMLElementBase {
|
|
10961
11142
|
static get observedAttributes() {
|
|
10962
11143
|
return [
|
|
10963
11144
|
"value",
|
|
@@ -11190,7 +11371,7 @@ let arkTextareaIdCounter = 0;
|
|
|
11190
11371
|
* (`field-sizing: content` nativo, com fallback por JS), `monospace` e
|
|
11191
11372
|
* `resize` atendem edição de código e de dados.
|
|
11192
11373
|
*/
|
|
11193
|
-
class ArkTextarea extends
|
|
11374
|
+
class ArkTextarea extends HTMLElementBase {
|
|
11194
11375
|
constructor() {
|
|
11195
11376
|
super(...arguments);
|
|
11196
11377
|
this.textareaEl = null;
|
|
@@ -11398,7 +11579,7 @@ ArkTextarea.tagName = "ark-textarea";
|
|
|
11398
11579
|
* dialogs e menus, e é reaberta a cada toast novo para voltar ao topo da
|
|
11399
11580
|
* pilha do top layer quando um overlay abriu depois dela.
|
|
11400
11581
|
*/
|
|
11401
|
-
class ArkToaster extends
|
|
11582
|
+
class ArkToaster extends HTMLElementBase {
|
|
11402
11583
|
constructor() {
|
|
11403
11584
|
super(...arguments);
|
|
11404
11585
|
this.root = null;
|
|
@@ -11453,15 +11634,8 @@ class ArkToaster extends HTMLElement {
|
|
|
11453
11634
|
this.entered.delete(id);
|
|
11454
11635
|
}
|
|
11455
11636
|
this.toasts = [item, ...this.toasts.filter((toast) => toast.id !== id)];
|
|
11456
|
-
|
|
11457
|
-
|
|
11458
|
-
const removed = this.toasts.slice(maxVisible);
|
|
11459
|
-
this.toasts = this.toasts.slice(0, maxVisible);
|
|
11460
|
-
for (const toast of removed) {
|
|
11461
|
-
this.clearTimer(toast.id);
|
|
11462
|
-
}
|
|
11463
|
-
}
|
|
11464
|
-
this.scheduleDismiss(item);
|
|
11637
|
+
// O render agenda o fechamento dos visíveis; o mesmo id recomeça a contagem.
|
|
11638
|
+
this.clearTimer(id);
|
|
11465
11639
|
this.render();
|
|
11466
11640
|
// Um overlay aberto depois da pilha ficaria por cima dela: reentrar no top layer a põe acima de novo.
|
|
11467
11641
|
this.raise();
|
|
@@ -11662,7 +11836,17 @@ class ArkToaster extends HTMLElement {
|
|
|
11662
11836
|
this.root.className = `${palette.stack} ${this.getPositionClasses(this.getPosition())}`;
|
|
11663
11837
|
applyTestHooks(this, "toaster", this.root);
|
|
11664
11838
|
this.syncPopover();
|
|
11665
|
-
|
|
11839
|
+
// Até max-visible cards; o excedente (os mais antigos) espera na fila com o relógio parado e entra quando um sai.
|
|
11840
|
+
const visible = this.toasts.slice(0, this.getMaxVisible());
|
|
11841
|
+
const activeIds = new Set(visible.map((toast) => toast.id));
|
|
11842
|
+
for (const toast of this.toasts) {
|
|
11843
|
+
if (!activeIds.has(toast.id)) {
|
|
11844
|
+
this.clearTimer(toast.id);
|
|
11845
|
+
}
|
|
11846
|
+
else if (!this.timers.has(toast.id) && !this.exiting.has(toast.id)) {
|
|
11847
|
+
this.scheduleDismiss(toast);
|
|
11848
|
+
}
|
|
11849
|
+
}
|
|
11666
11850
|
for (const id of this.entered) {
|
|
11667
11851
|
if (!activeIds.has(id))
|
|
11668
11852
|
this.entered.delete(id);
|
|
@@ -11679,8 +11863,8 @@ class ArkToaster extends HTMLElement {
|
|
|
11679
11863
|
}
|
|
11680
11864
|
// Do mais antigo (fim da pilha) ao mais novo: um card novo entra antes do card do toast seguinte na lista.
|
|
11681
11865
|
let next = null;
|
|
11682
|
-
for (let index =
|
|
11683
|
-
const toast =
|
|
11866
|
+
for (let index = visible.length - 1; index >= 0; index--) {
|
|
11867
|
+
const toast = visible[index];
|
|
11684
11868
|
let card = existing.get(toast.id);
|
|
11685
11869
|
if (!card) {
|
|
11686
11870
|
card = this.buildCard(toast, palette);
|
|
@@ -11771,7 +11955,7 @@ ArkToaster.tagName = "ark-toaster";
|
|
|
11771
11955
|
* (classes, role, foco, teclado): os filhos do usuário ficam onde estão.
|
|
11772
11956
|
* Dentro de um ark-toggle-group vira item de segmented control.
|
|
11773
11957
|
*/
|
|
11774
|
-
class ArkToggle extends
|
|
11958
|
+
class ArkToggle extends HTMLElementBase {
|
|
11775
11959
|
static get observedAttributes() {
|
|
11776
11960
|
return ["pressed", "disabled", "size", "intent", "theme", "value", "class", "testid"];
|
|
11777
11961
|
}
|
|
@@ -11838,6 +12022,9 @@ class ArkToggle extends HTMLElement {
|
|
|
11838
12022
|
get value() {
|
|
11839
12023
|
return this.getAttribute("value") || "";
|
|
11840
12024
|
}
|
|
12025
|
+
set value(value) {
|
|
12026
|
+
reflectAttr(this, "value", value);
|
|
12027
|
+
}
|
|
11841
12028
|
toggle() {
|
|
11842
12029
|
if (this.disabled)
|
|
11843
12030
|
return;
|
|
@@ -11966,7 +12153,7 @@ ArkToggle.tagName = "ark-toggle";
|
|
|
11966
12153
|
* (`role="group"` + classes): os itens do usuário ficam onde estão, então
|
|
11967
12154
|
* frameworks podem adicionar/remover toggles livremente.
|
|
11968
12155
|
*/
|
|
11969
|
-
class ArkToggleGroup extends
|
|
12156
|
+
class ArkToggleGroup extends HTMLElementBase {
|
|
11970
12157
|
static get observedAttributes() {
|
|
11971
12158
|
return ["value", "multiple", "disabled", "size", "intent", "theme", "class", "testid"];
|
|
11972
12159
|
}
|
|
@@ -12122,6 +12309,8 @@ ArkToggleGroup.tagName = "ark-toggle-group";
|
|
|
12122
12309
|
|
|
12123
12310
|
/** Contador para o id do balão, que o `aria-describedby` do gatilho referencia. */
|
|
12124
12311
|
let tooltipSeq = 0;
|
|
12312
|
+
/** Tolerância para o ponteiro atravessar o espaço entre gatilho e balão sem fechar a dica. */
|
|
12313
|
+
const HIDE_GRACE_MS = 100;
|
|
12125
12314
|
/**
|
|
12126
12315
|
* Dica de contexto. O host envolve o gatilho do usuário (primeiro filho sem
|
|
12127
12316
|
* `slot`) sem movê-lo e cria o balão: `role="tooltip"` com `popover="manual"`,
|
|
@@ -12131,11 +12320,12 @@ let tooltipSeq = 0;
|
|
|
12131
12320
|
* components.css). O gatilho recebe `aria-describedby` do balão e precisa ser
|
|
12132
12321
|
* focável por conta própria.
|
|
12133
12322
|
*
|
|
12134
|
-
* Abre em hover (depois de `delay`) e em foco (na hora); fecha ao sair
|
|
12135
|
-
*
|
|
12323
|
+
* Abre em hover (depois de `delay`) e em foco (na hora); fecha ao sair (com
|
|
12324
|
+
* uma tolerância para o ponteiro chegar ao balão, que mantém a dica aberta),
|
|
12325
|
+
* ao perder o foco, com Esc e no pointerdown. Posicionado por `positionAnchored`
|
|
12136
12326
|
* de core, com flip quando não cabe. Entrada `fade` quick, sem saída animada.
|
|
12137
12327
|
*/
|
|
12138
|
-
class ArkTooltip extends
|
|
12328
|
+
class ArkTooltip extends HTMLElementBase {
|
|
12139
12329
|
static get observedAttributes() {
|
|
12140
12330
|
return ["content", "side", "delay", "open", "theme", "class", "testid"];
|
|
12141
12331
|
}
|
|
@@ -12150,6 +12340,7 @@ class ArkTooltip extends HTMLElement {
|
|
|
12150
12340
|
this.bubble = null;
|
|
12151
12341
|
this.trigger = null;
|
|
12152
12342
|
this.openTimer = null;
|
|
12343
|
+
this.hideTimer = null;
|
|
12153
12344
|
this.disposePosition = null;
|
|
12154
12345
|
this.isOpen = false;
|
|
12155
12346
|
this.syncingOpen = false;
|
|
@@ -12159,12 +12350,14 @@ class ArkTooltip extends HTMLElement {
|
|
|
12159
12350
|
this.handlePointerOver = (event) => {
|
|
12160
12351
|
if (this.isInside(event.relatedTarget))
|
|
12161
12352
|
return;
|
|
12353
|
+
// Voltou (ao gatilho ou ao balão) dentro da tolerância: a dica fica.
|
|
12354
|
+
this.cancelHide();
|
|
12162
12355
|
this.scheduleShow();
|
|
12163
12356
|
};
|
|
12164
12357
|
this.handlePointerOut = (event) => {
|
|
12165
12358
|
if (this.isInside(event.relatedTarget))
|
|
12166
12359
|
return;
|
|
12167
|
-
this.
|
|
12360
|
+
this.scheduleHide();
|
|
12168
12361
|
};
|
|
12169
12362
|
// Clicar no gatilho dispensa a dica; ela volta só depois de sair e entrar de novo.
|
|
12170
12363
|
this.handlePointerDown = () => {
|
|
@@ -12217,6 +12410,7 @@ class ArkTooltip extends HTMLElement {
|
|
|
12217
12410
|
this.observer?.disconnect();
|
|
12218
12411
|
this.observer = null;
|
|
12219
12412
|
this.clearTimer();
|
|
12413
|
+
this.cancelHide();
|
|
12220
12414
|
document.removeEventListener("keydown", this.handleDocumentKeydown, true);
|
|
12221
12415
|
this.disposePosition?.();
|
|
12222
12416
|
this.disposePosition = null;
|
|
@@ -12252,6 +12446,11 @@ class ArkTooltip extends HTMLElement {
|
|
|
12252
12446
|
}
|
|
12253
12447
|
set open(value) {
|
|
12254
12448
|
const next = core.coerceBooleanAttr(value);
|
|
12449
|
+
// Desconectado (React 19 e Vue gravam a prop antes de inserir o nó): só reflete; o connectedCallback abre.
|
|
12450
|
+
if (!this.isConnected) {
|
|
12451
|
+
this.toggleAttribute("open", next);
|
|
12452
|
+
return;
|
|
12453
|
+
}
|
|
12255
12454
|
if (next) {
|
|
12256
12455
|
this.show();
|
|
12257
12456
|
}
|
|
@@ -12276,6 +12475,7 @@ class ArkTooltip extends HTMLElement {
|
|
|
12276
12475
|
/** Fecha na hora, sem animação de saída. */
|
|
12277
12476
|
hide() {
|
|
12278
12477
|
this.clearTimer();
|
|
12478
|
+
this.cancelHide();
|
|
12279
12479
|
if (!this.isOpen)
|
|
12280
12480
|
return;
|
|
12281
12481
|
this.isOpen = false;
|
|
@@ -12319,6 +12519,21 @@ class ArkTooltip extends HTMLElement {
|
|
|
12319
12519
|
this.openTimer = null;
|
|
12320
12520
|
}
|
|
12321
12521
|
}
|
|
12522
|
+
cancelHide() {
|
|
12523
|
+
if (this.hideTimer !== null) {
|
|
12524
|
+
clearTimeout(this.hideTimer);
|
|
12525
|
+
this.hideTimer = null;
|
|
12526
|
+
}
|
|
12527
|
+
}
|
|
12528
|
+
scheduleHide() {
|
|
12529
|
+
this.clearTimer();
|
|
12530
|
+
if (!this.isOpen || this.hideTimer !== null)
|
|
12531
|
+
return;
|
|
12532
|
+
this.hideTimer = setTimeout(() => {
|
|
12533
|
+
this.hideTimer = null;
|
|
12534
|
+
this.hide();
|
|
12535
|
+
}, HIDE_GRACE_MS);
|
|
12536
|
+
}
|
|
12322
12537
|
scheduleShow() {
|
|
12323
12538
|
if (this.isOpen || this.openTimer !== null)
|
|
12324
12539
|
return;
|
|
@@ -12383,7 +12598,6 @@ class ArkTooltip extends HTMLElement {
|
|
|
12383
12598
|
if (!this.ownBubble) {
|
|
12384
12599
|
const bubble = document.createElement("div");
|
|
12385
12600
|
bubble.setAttribute("data-ark-chrome", "bubble");
|
|
12386
|
-
bubble.className = "ark:pointer-events-none";
|
|
12387
12601
|
this.appendChild(bubble);
|
|
12388
12602
|
this.ownBubble = bubble;
|
|
12389
12603
|
}
|
|
@@ -12443,6 +12657,9 @@ ArkTooltip.tagName = "ark-tooltip";
|
|
|
12443
12657
|
* para garantir que eles estejam disponíveis como elementos personalizados.
|
|
12444
12658
|
*/
|
|
12445
12659
|
function registerTooarkComponents() {
|
|
12660
|
+
// Fora do navegador (SSR) não há registro de elementos: no-op, e o cliente registra na hidratação.
|
|
12661
|
+
if (typeof customElements === "undefined")
|
|
12662
|
+
return;
|
|
12446
12663
|
if (!customElements.get(ArkAlert.tagName)) {
|
|
12447
12664
|
customElements.define(ArkAlert.tagName, ArkAlert);
|
|
12448
12665
|
}
|
|
@@ -12575,20 +12792,41 @@ function registerTooarkComponents() {
|
|
|
12575
12792
|
}
|
|
12576
12793
|
}
|
|
12577
12794
|
|
|
12795
|
+
exports.ARK_MARK_PATHS = ARK_MARK_PATHS;
|
|
12796
|
+
exports.ARK_MARK_SHAPES = ARK_MARK_SHAPES;
|
|
12797
|
+
exports.ArkAlert = ArkAlert;
|
|
12798
|
+
exports.ArkAvatar = ArkAvatar;
|
|
12578
12799
|
exports.ArkBadge = ArkBadge;
|
|
12579
12800
|
exports.ArkButton = ArkButton;
|
|
12580
12801
|
exports.ArkCalendar = ArkCalendar;
|
|
12802
|
+
exports.ArkCard = ArkCard;
|
|
12581
12803
|
exports.ArkCarousel = ArkCarousel;
|
|
12804
|
+
exports.ArkCheckbox = ArkCheckbox;
|
|
12582
12805
|
exports.ArkClock = ArkClock;
|
|
12806
|
+
exports.ArkColorSwatches = ArkColorSwatches;
|
|
12807
|
+
exports.ArkCommandItem = ArkCommandItem;
|
|
12808
|
+
exports.ArkCommandPalette = ArkCommandPalette;
|
|
12809
|
+
exports.ArkCopyButton = ArkCopyButton;
|
|
12583
12810
|
exports.ArkDatepicker = ArkDatepicker;
|
|
12584
12811
|
exports.ArkDialog = ArkDialog;
|
|
12812
|
+
exports.ArkDrawer = ArkDrawer;
|
|
12585
12813
|
exports.ArkEmpty = ArkEmpty;
|
|
12814
|
+
exports.ArkFileInput = ArkFileInput;
|
|
12586
12815
|
exports.ArkInput = ArkInput;
|
|
12816
|
+
exports.ArkKbd = ArkKbd;
|
|
12817
|
+
exports.ArkKvEditor = ArkKvEditor;
|
|
12818
|
+
exports.ArkMark = ArkMark;
|
|
12587
12819
|
exports.ArkMenu = ArkMenu;
|
|
12588
12820
|
exports.ArkMenuItem = ArkMenuItem;
|
|
12821
|
+
exports.ArkProgress = ArkProgress;
|
|
12822
|
+
exports.ArkRadio = ArkRadio;
|
|
12589
12823
|
exports.ArkScheduler = ArkScheduler;
|
|
12590
12824
|
exports.ArkSelect = ArkSelect;
|
|
12825
|
+
exports.ArkShapePicker = ArkShapePicker;
|
|
12591
12826
|
exports.ArkSkeleton = ArkSkeleton;
|
|
12827
|
+
exports.ArkSpinner = ArkSpinner;
|
|
12828
|
+
exports.ArkSplitPane = ArkSplitPane;
|
|
12829
|
+
exports.ArkStatusDot = ArkStatusDot;
|
|
12592
12830
|
exports.ArkSwitch = ArkSwitch;
|
|
12593
12831
|
exports.ArkTab = ArkTab;
|
|
12594
12832
|
exports.ArkTabs = ArkTabs;
|
|
@@ -12597,5 +12835,6 @@ exports.ArkToaster = ArkToaster;
|
|
|
12597
12835
|
exports.ArkToggle = ArkToggle;
|
|
12598
12836
|
exports.ArkToggleGroup = ArkToggleGroup;
|
|
12599
12837
|
exports.ArkTooltip = ArkTooltip;
|
|
12838
|
+
exports.normalizeMarkShape = normalizeMarkShape;
|
|
12600
12839
|
exports.registerTooarkComponents = registerTooarkComponents;
|
|
12601
12840
|
//# sourceMappingURL=index.cjs.map
|