@selectwin/kit 0.1.175 → 0.1.177
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SelectFilterBar.d.ts +12 -1
- package/dist/index.js +109 -86
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -27,11 +27,22 @@ type SelectFilterBarOwnProps = {
|
|
|
27
27
|
values: Record<string, string>;
|
|
28
28
|
onChange: (key: string, value: string) => void;
|
|
29
29
|
onClearAll: () => void;
|
|
30
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Dedicated free-text query field (the Polaris query). Omit to hide it.
|
|
32
|
+
*
|
|
33
|
+
* `onSubmit` (0.1.176) troca o "busca enquanto digita" por uma busca que só roda no Enter ou no botão dentro do campo
|
|
34
|
+
* (`submitLabel`, padrão "Buscar") — para a busca que custa caro ou é registrada (o destinatário de um e-mail, uma
|
|
35
|
+
* leitura auditada). `error` diz o que há de errado com o que foi digitado, no próprio campo.
|
|
36
|
+
*/
|
|
31
37
|
search?: {
|
|
32
38
|
value: string;
|
|
33
39
|
onChange: (value: string) => void;
|
|
34
40
|
placeholder?: string;
|
|
41
|
+
onSubmit?: () => void;
|
|
42
|
+
submitLabel?: string;
|
|
43
|
+
error?: string;
|
|
44
|
+
/** O nome do campo para o leitor de tela (o placeholder não é rótulo). Padrão: o placeholder. */
|
|
45
|
+
ariaLabel?: string;
|
|
35
46
|
};
|
|
36
47
|
/**
|
|
37
48
|
* Recortes que não são faceta — a vista num `SelectSegmented`, um seletor de entidade com busca
|
package/dist/index.js
CHANGED
|
@@ -11650,97 +11650,120 @@ var Yl = r(function({ filters: e, values: t, onChange: n, onClearAll: r, search:
|
|
|
11650
11650
|
ref: l,
|
|
11651
11651
|
...c,
|
|
11652
11652
|
className: `select-filterbar${s ? " " + s : ""}`,
|
|
11653
|
-
children: [
|
|
11654
|
-
|
|
11655
|
-
|
|
11656
|
-
|
|
11657
|
-
|
|
11658
|
-
|
|
11659
|
-
|
|
11660
|
-
|
|
11661
|
-
|
|
11662
|
-
|
|
11663
|
-
|
|
11664
|
-
|
|
11665
|
-
|
|
11666
|
-
|
|
11667
|
-
|
|
11668
|
-
|
|
11669
|
-
|
|
11670
|
-
|
|
11671
|
-
|
|
11653
|
+
children: [
|
|
11654
|
+
/* @__PURE__ */ g("div", {
|
|
11655
|
+
className: "select-filterbar__row",
|
|
11656
|
+
children: [
|
|
11657
|
+
a,
|
|
11658
|
+
i && /* @__PURE__ */ g("div", {
|
|
11659
|
+
className: `select-filterbar__query${i.error ? " select-filterbar__query--error" : ""}`,
|
|
11660
|
+
children: [
|
|
11661
|
+
/* @__PURE__ */ h("span", {
|
|
11662
|
+
className: "select-filterbar__query-icon",
|
|
11663
|
+
"aria-hidden": "true",
|
|
11664
|
+
children: /* @__PURE__ */ h(oe, {})
|
|
11665
|
+
}),
|
|
11666
|
+
/* @__PURE__ */ h("input", {
|
|
11667
|
+
className: "select-filterbar__query-input",
|
|
11668
|
+
type: "search",
|
|
11669
|
+
value: i.value,
|
|
11670
|
+
placeholder: i.placeholder ?? "Buscar…",
|
|
11671
|
+
onChange: (e) => i.onChange(e.target.value),
|
|
11672
|
+
onKeyDown: i.onSubmit ? (e) => {
|
|
11673
|
+
if (e.key === "Enter") {
|
|
11674
|
+
var t;
|
|
11675
|
+
e.preventDefault(), (t = i.onSubmit) == null || t.call(i);
|
|
11676
|
+
}
|
|
11677
|
+
} : void 0,
|
|
11678
|
+
"aria-label": i.ariaLabel ?? i.placeholder ?? "Buscar",
|
|
11679
|
+
"aria-invalid": i.error ? !0 : void 0,
|
|
11680
|
+
disabled: o
|
|
11681
|
+
}),
|
|
11682
|
+
i.value && /* @__PURE__ */ h("button", {
|
|
11683
|
+
type: "button",
|
|
11684
|
+
className: "select-filterbar__query-clear",
|
|
11685
|
+
"aria-label": "Limpar busca",
|
|
11686
|
+
onClick: () => i.onChange(""),
|
|
11687
|
+
children: /* @__PURE__ */ h(le, {})
|
|
11688
|
+
}),
|
|
11689
|
+
i.onSubmit && /* @__PURE__ */ h("button", {
|
|
11690
|
+
type: "button",
|
|
11691
|
+
className: "select-filterbar__query-submit",
|
|
11692
|
+
onClick: i.onSubmit,
|
|
11693
|
+
disabled: o,
|
|
11694
|
+
children: i.submitLabel ?? "Buscar"
|
|
11695
|
+
})
|
|
11696
|
+
]
|
|
11697
|
+
}),
|
|
11698
|
+
x.map((e) => /* @__PURE__ */ h(Jl, {
|
|
11699
|
+
filter: e,
|
|
11700
|
+
value: t[e.key] ?? "",
|
|
11701
|
+
onChange: (t) => n(e.key, t),
|
|
11702
|
+
open: p === e.key,
|
|
11703
|
+
onToggle: () => m((t) => t === e.key ? null : e.key),
|
|
11704
|
+
onClose: () => m((t) => t === e.key ? null : t),
|
|
11705
|
+
disabled: o
|
|
11706
|
+
}, e.key)),
|
|
11707
|
+
S.length > 0 && /* @__PURE__ */ h(fr, {
|
|
11708
|
+
active: _,
|
|
11709
|
+
onClose: () => v(!1),
|
|
11710
|
+
placement: "bottom-start",
|
|
11711
|
+
activator: /* @__PURE__ */ g("button", {
|
|
11712
|
+
type: "button",
|
|
11713
|
+
className: "select-facet select-facet--more",
|
|
11714
|
+
onClick: () => v((e) => !e),
|
|
11715
|
+
disabled: o,
|
|
11716
|
+
"aria-expanded": _,
|
|
11717
|
+
children: [/* @__PURE__ */ h("span", {
|
|
11718
|
+
className: "select-facet__addicon",
|
|
11719
|
+
"aria-hidden": "true",
|
|
11720
|
+
children: /* @__PURE__ */ h(Me, {})
|
|
11721
|
+
}), "Mais filtros"]
|
|
11672
11722
|
}),
|
|
11673
|
-
|
|
11723
|
+
children: /* @__PURE__ */ h("div", {
|
|
11724
|
+
className: "select-facet__options",
|
|
11725
|
+
role: "menu",
|
|
11726
|
+
children: S.map((e) => /* @__PURE__ */ h("button", {
|
|
11727
|
+
type: "button",
|
|
11728
|
+
role: "menuitem",
|
|
11729
|
+
className: "select-facet__opt",
|
|
11730
|
+
onClick: () => T(e.key),
|
|
11731
|
+
children: /* @__PURE__ */ h("span", { children: e.label })
|
|
11732
|
+
}, e.key))
|
|
11733
|
+
})
|
|
11734
|
+
})
|
|
11735
|
+
]
|
|
11736
|
+
}),
|
|
11737
|
+
i != null && i.error ? /* @__PURE__ */ h("p", {
|
|
11738
|
+
className: "select-filterbar__query-error",
|
|
11739
|
+
role: "alert",
|
|
11740
|
+
children: i.error
|
|
11741
|
+
}) : null,
|
|
11742
|
+
C.length > 0 && /* @__PURE__ */ g("div", {
|
|
11743
|
+
className: "select-filterbar__applied",
|
|
11744
|
+
children: [C.map((e) => /* @__PURE__ */ g("span", {
|
|
11745
|
+
className: `select-filterbar__tag${e.error ? " is-error" : ""}`,
|
|
11746
|
+
title: e.error || void 0,
|
|
11747
|
+
children: [
|
|
11748
|
+
e.label,
|
|
11749
|
+
": ",
|
|
11750
|
+
ql(e, t[e.key] ?? ""),
|
|
11751
|
+
/* @__PURE__ */ h("button", {
|
|
11674
11752
|
type: "button",
|
|
11675
|
-
className: "select-
|
|
11676
|
-
"aria-label":
|
|
11677
|
-
onClick: () =>
|
|
11753
|
+
className: "select-filterbar__tagx",
|
|
11754
|
+
"aria-label": `Remover filtro ${e.label}`,
|
|
11755
|
+
onClick: () => n(e.key, ""),
|
|
11678
11756
|
children: /* @__PURE__ */ h(le, {})
|
|
11679
11757
|
})
|
|
11680
11758
|
]
|
|
11681
|
-
}),
|
|
11682
|
-
|
|
11683
|
-
|
|
11684
|
-
|
|
11685
|
-
|
|
11686
|
-
|
|
11687
|
-
|
|
11688
|
-
|
|
11689
|
-
disabled: o
|
|
11690
|
-
}, e.key)),
|
|
11691
|
-
S.length > 0 && /* @__PURE__ */ h(fr, {
|
|
11692
|
-
active: _,
|
|
11693
|
-
onClose: () => v(!1),
|
|
11694
|
-
placement: "bottom-start",
|
|
11695
|
-
activator: /* @__PURE__ */ g("button", {
|
|
11696
|
-
type: "button",
|
|
11697
|
-
className: "select-facet select-facet--more",
|
|
11698
|
-
onClick: () => v((e) => !e),
|
|
11699
|
-
disabled: o,
|
|
11700
|
-
"aria-expanded": _,
|
|
11701
|
-
children: [/* @__PURE__ */ h("span", {
|
|
11702
|
-
className: "select-facet__addicon",
|
|
11703
|
-
"aria-hidden": "true",
|
|
11704
|
-
children: /* @__PURE__ */ h(Me, {})
|
|
11705
|
-
}), "Mais filtros"]
|
|
11706
|
-
}),
|
|
11707
|
-
children: /* @__PURE__ */ h("div", {
|
|
11708
|
-
className: "select-facet__options",
|
|
11709
|
-
role: "menu",
|
|
11710
|
-
children: S.map((e) => /* @__PURE__ */ h("button", {
|
|
11711
|
-
type: "button",
|
|
11712
|
-
role: "menuitem",
|
|
11713
|
-
className: "select-facet__opt",
|
|
11714
|
-
onClick: () => T(e.key),
|
|
11715
|
-
children: /* @__PURE__ */ h("span", { children: e.label })
|
|
11716
|
-
}, e.key))
|
|
11717
|
-
})
|
|
11718
|
-
})
|
|
11719
|
-
]
|
|
11720
|
-
}), C.length > 0 && /* @__PURE__ */ g("div", {
|
|
11721
|
-
className: "select-filterbar__applied",
|
|
11722
|
-
children: [C.map((e) => /* @__PURE__ */ g("span", {
|
|
11723
|
-
className: `select-filterbar__tag${e.error ? " is-error" : ""}`,
|
|
11724
|
-
title: e.error || void 0,
|
|
11725
|
-
children: [
|
|
11726
|
-
e.label,
|
|
11727
|
-
": ",
|
|
11728
|
-
ql(e, t[e.key] ?? ""),
|
|
11729
|
-
/* @__PURE__ */ h("button", {
|
|
11730
|
-
type: "button",
|
|
11731
|
-
className: "select-filterbar__tagx",
|
|
11732
|
-
"aria-label": `Remover filtro ${e.label}`,
|
|
11733
|
-
onClick: () => n(e.key, ""),
|
|
11734
|
-
children: /* @__PURE__ */ h(le, {})
|
|
11735
|
-
})
|
|
11736
|
-
]
|
|
11737
|
-
}, e.key)), /* @__PURE__ */ h("button", {
|
|
11738
|
-
type: "button",
|
|
11739
|
-
className: "select-filterbar__clear",
|
|
11740
|
-
onClick: w,
|
|
11741
|
-
children: "Limpar tudo"
|
|
11742
|
-
})]
|
|
11743
|
-
})]
|
|
11759
|
+
}, e.key)), /* @__PURE__ */ h("button", {
|
|
11760
|
+
type: "button",
|
|
11761
|
+
className: "select-filterbar__clear",
|
|
11762
|
+
onClick: w,
|
|
11763
|
+
children: "Limpar tudo"
|
|
11764
|
+
})]
|
|
11765
|
+
})
|
|
11766
|
+
]
|
|
11744
11767
|
});
|
|
11745
11768
|
}), Xl = r(function({ label: e, options: t, selected: n, onChange: r, placeholder: i = "Selecionar…", hint: a, help: o, error: s, onBlur: c, size: l = "md", unknownLabel: u, loading: d = !1, loadingLabel: p = "Carregando…", disabled: m = !1, className: _, ...v }, y) {
|
|
11746
11769
|
let [b, x] = f(!1), S = d || m, [C, w] = f(""), T = t.filter((e) => e.label.toLowerCase().includes(C.trim().toLowerCase())), E = (e) => r(n.includes(e) ? n.filter((t) => t !== e) : [...n, e]), D = n.map((e) => {
|