@motor-hero/ui-kit 0.36.1 → 0.36.3
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/components/combobox.d.ts +4 -1
- package/dist/components/combobox.d.ts.map +1 -1
- package/dist/components/search-input.d.ts.map +1 -1
- package/dist/index.cjs +9 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/combobox.tsx +222 -220
- package/src/components/search-input.tsx +36 -31
|
@@ -37,6 +37,9 @@ export interface ComboboxProps {
|
|
|
37
37
|
creatable?: boolean;
|
|
38
38
|
/** Rótulo da linha de criação. Padrão: `Usar "<texto>"`. */
|
|
39
39
|
formatCreateLabel?: (search: string) => string;
|
|
40
|
+
/** Permite limpar a seleção clicando na opção já selecionada (útil em
|
|
41
|
+
* filtros: remover um filtro sem uma opção "Todos"). Emite `onChange("")`. */
|
|
42
|
+
deselectable?: boolean;
|
|
40
43
|
}
|
|
41
44
|
/**
|
|
42
45
|
* Select com busca (combobox) acessível e responsivo.
|
|
@@ -52,5 +55,5 @@ export interface ComboboxProps {
|
|
|
52
55
|
* Aceita `aria-invalid`/`aria-describedby` (encaminhados pelo FormField em
|
|
53
56
|
* estado de erro) e fica com a borda vermelha quando inválido.
|
|
54
57
|
*/
|
|
55
|
-
export declare function Combobox({ options, value, onChange, placeholder, searchPlaceholder, emptyMessage, disabled, id, className, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedby, onSearchChange, onLoadMore, loading, hasMore, selectedOption, creatable, formatCreateLabel, }: ComboboxProps): React.JSX.Element;
|
|
58
|
+
export declare function Combobox({ options, value, onChange, placeholder, searchPlaceholder, emptyMessage, disabled, id, className, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedby, onSearchChange, onLoadMore, loading, hasMore, selectedOption, creatable, formatCreateLabel, deselectable, }: ComboboxProps): React.JSX.Element;
|
|
56
59
|
//# sourceMappingURL=combobox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../src/components/combobox.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../src/components/combobox.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,MAAM,WAAW,cAAc;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC7B,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oCAAoC;IACpC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,+CAA+C;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;IAC5C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;qEACiE;IACjE,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,0DAA0D;IAC1D,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,uEAAuE;IACvE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yDAAyD;IACzD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;wDACoD;IACpD,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;yDAEqD;IACrD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4DAA4D;IAC5D,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IAC/C;mFAC+E;IAC/E,YAAY,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CAAC,EACxB,OAAO,EACP,KAAK,EACL,QAAQ,EACR,WAA4B,EAC5B,iBAA+B,EAC/B,YAA6C,EAC7C,QAAQ,EACR,EAAE,EACF,SAAS,EACT,cAAc,EAAE,WAAW,EAC3B,kBAAkB,EAAE,eAAe,EACnC,cAAc,EACd,UAAU,EACV,OAAO,EACP,OAAO,EACP,cAAc,EACd,SAAS,EACT,iBAAiB,EACjB,YAAY,GACZ,EAAE,aAAa,qBAsKf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-input.d.ts","sourceRoot":"","sources":["../../src/components/search-input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"search-input.d.ts","sourceRoot":"","sources":["../../src/components/search-input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,UAAU,gBAAiB,SAAQ,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC;IAC7E,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,eAAO,MAAM,WAAW,2FAgCvB,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -712,7 +712,8 @@ function Combobox({
|
|
|
712
712
|
hasMore,
|
|
713
713
|
selectedOption,
|
|
714
714
|
creatable,
|
|
715
|
-
formatCreateLabel
|
|
715
|
+
formatCreateLabel,
|
|
716
|
+
deselectable
|
|
716
717
|
}) {
|
|
717
718
|
const [open, setOpen] = React5.useState(false);
|
|
718
719
|
const [search, setSearch] = React5.useState("");
|
|
@@ -724,7 +725,7 @@ function Combobox({
|
|
|
724
725
|
if (!next) setSearch("");
|
|
725
726
|
};
|
|
726
727
|
const handleSelect = (next) => {
|
|
727
|
-
onChange(next);
|
|
728
|
+
onChange(deselectable && next === value ? "" : next);
|
|
728
729
|
handleOpenChange(false);
|
|
729
730
|
};
|
|
730
731
|
const handleSearchChange = (next) => {
|
|
@@ -2187,7 +2188,7 @@ var React10 = __toESM(require("react"), 1);
|
|
|
2187
2188
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2188
2189
|
var SearchInput = React10.forwardRef(
|
|
2189
2190
|
({ containerClassName, className, ...props }, ref) => {
|
|
2190
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className:
|
|
2191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: cn("relative flex-1", containerClassName), children: [
|
|
2191
2192
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2192
2193
|
"svg",
|
|
2193
2194
|
{
|
|
@@ -2200,6 +2201,7 @@ var SearchInput = React10.forwardRef(
|
|
|
2200
2201
|
strokeWidth: "2",
|
|
2201
2202
|
strokeLinecap: "round",
|
|
2202
2203
|
strokeLinejoin: "round",
|
|
2204
|
+
"aria-hidden": "true",
|
|
2203
2205
|
className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",
|
|
2204
2206
|
children: [
|
|
2205
2207
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("circle", { cx: "11", cy: "11", r: "8" }),
|
|
@@ -2212,7 +2214,10 @@ var SearchInput = React10.forwardRef(
|
|
|
2212
2214
|
{
|
|
2213
2215
|
ref,
|
|
2214
2216
|
type: "text",
|
|
2215
|
-
className:
|
|
2217
|
+
className: cn(
|
|
2218
|
+
"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 pl-10 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
2219
|
+
className
|
|
2220
|
+
),
|
|
2216
2221
|
...props
|
|
2217
2222
|
}
|
|
2218
2223
|
)
|