@selectwin/kit 0.1.174 → 0.1.176
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 +113 -87
- 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
|
@@ -7078,7 +7078,10 @@ var Va = r(function({ children: e, tone: t = "neutral", hideIcon: n = !1, icon:
|
|
|
7078
7078
|
className: "select-section__desc",
|
|
7079
7079
|
children: n
|
|
7080
7080
|
})]
|
|
7081
|
-
}), r
|
|
7081
|
+
}), r ? /* @__PURE__ */ h("div", {
|
|
7082
|
+
className: "select-section__action",
|
|
7083
|
+
children: r
|
|
7084
|
+
}) : null]
|
|
7082
7085
|
}),
|
|
7083
7086
|
/* @__PURE__ */ h("div", {
|
|
7084
7087
|
className: "select-section__body",
|
|
@@ -11647,97 +11650,120 @@ var Yl = r(function({ filters: e, values: t, onChange: n, onClearAll: r, search:
|
|
|
11647
11650
|
ref: l,
|
|
11648
11651
|
...c,
|
|
11649
11652
|
className: `select-filterbar${s ? " " + s : ""}`,
|
|
11650
|
-
children: [
|
|
11651
|
-
|
|
11652
|
-
|
|
11653
|
-
|
|
11654
|
-
|
|
11655
|
-
|
|
11656
|
-
|
|
11657
|
-
|
|
11658
|
-
|
|
11659
|
-
|
|
11660
|
-
|
|
11661
|
-
|
|
11662
|
-
|
|
11663
|
-
|
|
11664
|
-
|
|
11665
|
-
|
|
11666
|
-
|
|
11667
|
-
|
|
11668
|
-
|
|
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"]
|
|
11669
11722
|
}),
|
|
11670
|
-
|
|
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", {
|
|
11671
11752
|
type: "button",
|
|
11672
|
-
className: "select-
|
|
11673
|
-
"aria-label":
|
|
11674
|
-
onClick: () =>
|
|
11753
|
+
className: "select-filterbar__tagx",
|
|
11754
|
+
"aria-label": `Remover filtro ${e.label}`,
|
|
11755
|
+
onClick: () => n(e.key, ""),
|
|
11675
11756
|
children: /* @__PURE__ */ h(le, {})
|
|
11676
11757
|
})
|
|
11677
11758
|
]
|
|
11678
|
-
}),
|
|
11679
|
-
|
|
11680
|
-
|
|
11681
|
-
|
|
11682
|
-
|
|
11683
|
-
|
|
11684
|
-
|
|
11685
|
-
|
|
11686
|
-
disabled: o
|
|
11687
|
-
}, e.key)),
|
|
11688
|
-
S.length > 0 && /* @__PURE__ */ h(fr, {
|
|
11689
|
-
active: _,
|
|
11690
|
-
onClose: () => v(!1),
|
|
11691
|
-
placement: "bottom-start",
|
|
11692
|
-
activator: /* @__PURE__ */ g("button", {
|
|
11693
|
-
type: "button",
|
|
11694
|
-
className: "select-facet select-facet--more",
|
|
11695
|
-
onClick: () => v((e) => !e),
|
|
11696
|
-
disabled: o,
|
|
11697
|
-
"aria-expanded": _,
|
|
11698
|
-
children: [/* @__PURE__ */ h("span", {
|
|
11699
|
-
className: "select-facet__addicon",
|
|
11700
|
-
"aria-hidden": "true",
|
|
11701
|
-
children: /* @__PURE__ */ h(Me, {})
|
|
11702
|
-
}), "Mais filtros"]
|
|
11703
|
-
}),
|
|
11704
|
-
children: /* @__PURE__ */ h("div", {
|
|
11705
|
-
className: "select-facet__options",
|
|
11706
|
-
role: "menu",
|
|
11707
|
-
children: S.map((e) => /* @__PURE__ */ h("button", {
|
|
11708
|
-
type: "button",
|
|
11709
|
-
role: "menuitem",
|
|
11710
|
-
className: "select-facet__opt",
|
|
11711
|
-
onClick: () => T(e.key),
|
|
11712
|
-
children: /* @__PURE__ */ h("span", { children: e.label })
|
|
11713
|
-
}, e.key))
|
|
11714
|
-
})
|
|
11715
|
-
})
|
|
11716
|
-
]
|
|
11717
|
-
}), C.length > 0 && /* @__PURE__ */ g("div", {
|
|
11718
|
-
className: "select-filterbar__applied",
|
|
11719
|
-
children: [C.map((e) => /* @__PURE__ */ g("span", {
|
|
11720
|
-
className: `select-filterbar__tag${e.error ? " is-error" : ""}`,
|
|
11721
|
-
title: e.error || void 0,
|
|
11722
|
-
children: [
|
|
11723
|
-
e.label,
|
|
11724
|
-
": ",
|
|
11725
|
-
ql(e, t[e.key] ?? ""),
|
|
11726
|
-
/* @__PURE__ */ h("button", {
|
|
11727
|
-
type: "button",
|
|
11728
|
-
className: "select-filterbar__tagx",
|
|
11729
|
-
"aria-label": `Remover filtro ${e.label}`,
|
|
11730
|
-
onClick: () => n(e.key, ""),
|
|
11731
|
-
children: /* @__PURE__ */ h(le, {})
|
|
11732
|
-
})
|
|
11733
|
-
]
|
|
11734
|
-
}, e.key)), /* @__PURE__ */ h("button", {
|
|
11735
|
-
type: "button",
|
|
11736
|
-
className: "select-filterbar__clear",
|
|
11737
|
-
onClick: w,
|
|
11738
|
-
children: "Limpar tudo"
|
|
11739
|
-
})]
|
|
11740
|
-
})]
|
|
11759
|
+
}, e.key)), /* @__PURE__ */ h("button", {
|
|
11760
|
+
type: "button",
|
|
11761
|
+
className: "select-filterbar__clear",
|
|
11762
|
+
onClick: w,
|
|
11763
|
+
children: "Limpar tudo"
|
|
11764
|
+
})]
|
|
11765
|
+
})
|
|
11766
|
+
]
|
|
11741
11767
|
});
|
|
11742
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) {
|
|
11743
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) => {
|