@selectwin/kit 0.1.107 → 0.1.109
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 +29 -29
- package/dist/SelectFilterBar.d.ts +13 -1
- package/dist/index.js +26 -25
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
# @selectwin/kit
|
|
2
|
-
|
|
3
|
-
Design system da Selectwin — primitivos React, charts SVG (sem dependência de biblioteca de
|
|
4
|
-
gráficos) e tokens CSS, theme-aware (light/dark).
|
|
5
|
-
|
|
6
|
-
Uso interno da Selectwin. Publicado no npm para facilitar a distribuição entre os apps da casa;
|
|
7
|
-
não há suporte, documentação pública nem garantia de estabilidade de API para terceiros.
|
|
8
|
-
|
|
9
|
-
## Uso
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
npm i @selectwin/kit
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
```tsx
|
|
16
|
-
import '@selectwin/kit/styles.css'; // tokens + estilos (uma vez, no root)
|
|
17
|
-
import { SelectButton, SelectSection } from '@selectwin/kit';
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Peer deps: **react**, **react-dom** (obrigatórios); **gsap** (opcional — só componentes animados),
|
|
21
|
-
**react-router-dom** (opcional). Tematização = sobrescrever os tokens CSS `--select-*` / `--sw-*`.
|
|
22
|
-
|
|
23
|
-
## Build
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npm run build # → dist/index.js (ESM) + dist/style.css + dist/index.d.ts
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
`npm publish` roda `prepublishOnly` (= build) e publica só `dist/` (sem sourcemaps).
|
|
1
|
+
# @selectwin/kit
|
|
2
|
+
|
|
3
|
+
Design system da Selectwin — primitivos React, charts SVG (sem dependência de biblioteca de
|
|
4
|
+
gráficos) e tokens CSS, theme-aware (light/dark).
|
|
5
|
+
|
|
6
|
+
Uso interno da Selectwin. Publicado no npm para facilitar a distribuição entre os apps da casa;
|
|
7
|
+
não há suporte, documentação pública nem garantia de estabilidade de API para terceiros.
|
|
8
|
+
|
|
9
|
+
## Uso
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm i @selectwin/kit
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import '@selectwin/kit/styles.css'; // tokens + estilos (uma vez, no root)
|
|
17
|
+
import { SelectButton, SelectSection } from '@selectwin/kit';
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Peer deps: **react**, **react-dom** (obrigatórios); **gsap** (opcional — só componentes animados),
|
|
21
|
+
**react-router-dom** (opcional). Tematização = sobrescrever os tokens CSS `--select-*` / `--sw-*`.
|
|
22
|
+
|
|
23
|
+
## Build
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm run build # → dist/index.js (ESM) + dist/style.css + dist/index.d.ts
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`npm publish` roda `prepublishOnly` (= build) e publica só `dist/` (sem sourcemaps).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef } from 'react';
|
|
1
|
+
import { ReactNode, ComponentPropsWithoutRef } from 'react';
|
|
2
2
|
export interface SelectFilterDef {
|
|
3
3
|
key: string;
|
|
4
4
|
label: string;
|
|
@@ -33,6 +33,18 @@ type SelectFilterBarOwnProps = {
|
|
|
33
33
|
onChange: (value: string) => void;
|
|
34
34
|
placeholder?: string;
|
|
35
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* Recortes que não são faceta — a vista num `SelectSegmented`, um seletor de entidade com busca
|
|
38
|
+
* própria — na MESMA fileira da barra, antes da busca. Passe um fragmento: cada controle vira
|
|
39
|
+
* item da fileira, com o mesmo passo, a mesma altura e a mesma quebra das facetas, e as tags
|
|
40
|
+
* aplicadas continuam embaixo de todos.
|
|
41
|
+
*
|
|
42
|
+
* Por que existe: montados ao LADO da barra (num `SelectInline` junto com ela), os dois viram
|
|
43
|
+
* contêineres flex aninhados. A barra dimensiona pelo max-content e a fileira dela quebra por
|
|
44
|
+
* dentro — a busca sobe, "Mais filtros" desce sozinho — e, quando a fileira de tags aparece, a
|
|
45
|
+
* barra fica mais alta e o controle vizinho desce para o meio dela.
|
|
46
|
+
*/
|
|
47
|
+
leading?: ReactNode;
|
|
36
48
|
disabled?: boolean;
|
|
37
49
|
};
|
|
38
50
|
export type SelectFilterBarProps = SelectFilterBarOwnProps & Omit<ComponentPropsWithoutRef<'div'>, keyof SelectFilterBarOwnProps>;
|
package/dist/index.js
CHANGED
|
@@ -7675,19 +7675,20 @@ function yo({ filter: e, value: t, onChange: n, open: r, onToggle: i, onClose: a
|
|
|
7675
7675
|
]
|
|
7676
7676
|
});
|
|
7677
7677
|
}
|
|
7678
|
-
var bo = r(function({ filters: e, values: t, onChange: n, onClearAll: r, search: i,
|
|
7679
|
-
let [
|
|
7680
|
-
|
|
7681
|
-
},
|
|
7682
|
-
|
|
7678
|
+
var bo = r(function({ filters: e, values: t, onChange: n, onClearAll: r, search: i, leading: a, disabled: o, className: s, ...c }, l) {
|
|
7679
|
+
let [u, f] = d([]), [p, g] = d(null), [_, v] = d(!1), y = (e) => (t[e.key] ?? "").trim() !== "", b = (e) => !!e.pinned || y(e) || u.includes(e.key), x = e.filter(b), S = e.filter((e) => !b(e)), C = e.filter(y), w = () => {
|
|
7680
|
+
f([]), g(null), r();
|
|
7681
|
+
}, T = (e) => {
|
|
7682
|
+
f((t) => t.includes(e) ? t : [...t, e]), v(!1), g(e);
|
|
7683
7683
|
};
|
|
7684
7684
|
return /* @__PURE__ */ h("div", {
|
|
7685
|
-
ref:
|
|
7686
|
-
...
|
|
7687
|
-
className: `select-filterbar${
|
|
7685
|
+
ref: l,
|
|
7686
|
+
...c,
|
|
7687
|
+
className: `select-filterbar${s ? " " + s : ""}`,
|
|
7688
7688
|
children: [/* @__PURE__ */ h("div", {
|
|
7689
7689
|
className: "select-filterbar__row",
|
|
7690
7690
|
children: [
|
|
7691
|
+
a,
|
|
7691
7692
|
i && /* @__PURE__ */ h("div", {
|
|
7692
7693
|
className: "select-filterbar__query",
|
|
7693
7694
|
children: [
|
|
@@ -7702,7 +7703,7 @@ var bo = r(function({ filters: e, values: t, onChange: n, onClearAll: r, search:
|
|
|
7702
7703
|
value: i.value,
|
|
7703
7704
|
placeholder: i.placeholder ?? "Buscar…",
|
|
7704
7705
|
onChange: (e) => i.onChange(e.target.value),
|
|
7705
|
-
disabled:
|
|
7706
|
+
disabled: o
|
|
7706
7707
|
}),
|
|
7707
7708
|
i.value && /* @__PURE__ */ m("button", {
|
|
7708
7709
|
type: "button",
|
|
@@ -7713,25 +7714,25 @@ var bo = r(function({ filters: e, values: t, onChange: n, onClearAll: r, search:
|
|
|
7713
7714
|
})
|
|
7714
7715
|
]
|
|
7715
7716
|
}),
|
|
7716
|
-
|
|
7717
|
+
x.map((e) => /* @__PURE__ */ m(yo, {
|
|
7717
7718
|
filter: e,
|
|
7718
7719
|
value: t[e.key] ?? "",
|
|
7719
7720
|
onChange: (t) => n(e.key, t),
|
|
7720
|
-
open:
|
|
7721
|
-
onToggle: () =>
|
|
7722
|
-
onClose: () =>
|
|
7723
|
-
disabled:
|
|
7721
|
+
open: p === e.key,
|
|
7722
|
+
onToggle: () => g((t) => t === e.key ? null : e.key),
|
|
7723
|
+
onClose: () => g((t) => t === e.key ? null : t),
|
|
7724
|
+
disabled: o
|
|
7724
7725
|
}, e.key)),
|
|
7725
|
-
|
|
7726
|
-
active:
|
|
7727
|
-
onClose: () =>
|
|
7726
|
+
S.length > 0 && /* @__PURE__ */ m(fn, {
|
|
7727
|
+
active: _,
|
|
7728
|
+
onClose: () => v(!1),
|
|
7728
7729
|
placement: "bottom-start",
|
|
7729
7730
|
activator: /* @__PURE__ */ h("button", {
|
|
7730
7731
|
type: "button",
|
|
7731
7732
|
className: "select-facet select-facet--more",
|
|
7732
|
-
onClick: () =>
|
|
7733
|
-
disabled:
|
|
7734
|
-
"aria-expanded":
|
|
7733
|
+
onClick: () => v((e) => !e),
|
|
7734
|
+
disabled: o,
|
|
7735
|
+
"aria-expanded": _,
|
|
7735
7736
|
children: [/* @__PURE__ */ m("span", {
|
|
7736
7737
|
className: "select-facet__addicon",
|
|
7737
7738
|
"aria-hidden": "true",
|
|
@@ -7741,19 +7742,19 @@ var bo = r(function({ filters: e, values: t, onChange: n, onClearAll: r, search:
|
|
|
7741
7742
|
children: /* @__PURE__ */ m("div", {
|
|
7742
7743
|
className: "select-facet__options",
|
|
7743
7744
|
role: "menu",
|
|
7744
|
-
children:
|
|
7745
|
+
children: S.map((e) => /* @__PURE__ */ m("button", {
|
|
7745
7746
|
type: "button",
|
|
7746
7747
|
role: "menuitem",
|
|
7747
7748
|
className: "select-facet__opt",
|
|
7748
|
-
onClick: () =>
|
|
7749
|
+
onClick: () => T(e.key),
|
|
7749
7750
|
children: /* @__PURE__ */ m("span", { children: e.label })
|
|
7750
7751
|
}, e.key))
|
|
7751
7752
|
})
|
|
7752
7753
|
})
|
|
7753
7754
|
]
|
|
7754
|
-
}),
|
|
7755
|
+
}), C.length > 0 && /* @__PURE__ */ h("div", {
|
|
7755
7756
|
className: "select-filterbar__applied",
|
|
7756
|
-
children: [
|
|
7757
|
+
children: [C.map((e) => /* @__PURE__ */ h("span", {
|
|
7757
7758
|
className: `select-filterbar__tag${e.error ? " is-error" : ""}`,
|
|
7758
7759
|
title: e.error || void 0,
|
|
7759
7760
|
children: [
|
|
@@ -7771,7 +7772,7 @@ var bo = r(function({ filters: e, values: t, onChange: n, onClearAll: r, search:
|
|
|
7771
7772
|
}, e.key)), /* @__PURE__ */ m("button", {
|
|
7772
7773
|
type: "button",
|
|
7773
7774
|
className: "select-filterbar__clear",
|
|
7774
|
-
onClick:
|
|
7775
|
+
onClick: w,
|
|
7775
7776
|
children: "Limpar tudo"
|
|
7776
7777
|
})]
|
|
7777
7778
|
})]
|