@motor-hero/ui-kit 0.48.0 → 0.48.1
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.map +1 -1
- package/dist/components/multi-combobox.d.ts.map +1 -1
- package/dist/index.cjs +10 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/combobox.tsx +4 -1
- package/src/components/multi-combobox.tsx +6 -2
package/package.json
CHANGED
|
@@ -116,7 +116,10 @@ export function Combobox({
|
|
|
116
116
|
|
|
117
117
|
const handleOpenChange = (next: boolean) => {
|
|
118
118
|
setOpen(next);
|
|
119
|
-
if (!next)
|
|
119
|
+
if (!next) {
|
|
120
|
+
setSearch("");
|
|
121
|
+
onSearchChange?.("");
|
|
122
|
+
}
|
|
120
123
|
};
|
|
121
124
|
|
|
122
125
|
const handleSelect = (next: string) => {
|
|
@@ -73,6 +73,10 @@ export function MultiCombobox({
|
|
|
73
73
|
const [open, setOpen] = React.useState(false)
|
|
74
74
|
const isDesktop = useIsDesktop()
|
|
75
75
|
const isServer = onSearchChange !== undefined
|
|
76
|
+
const handleOpenChange = (next: boolean) => {
|
|
77
|
+
setOpen(next)
|
|
78
|
+
if (!next) onSearchChange?.("")
|
|
79
|
+
}
|
|
76
80
|
// Em modo servidor `options` é só a página carregada no momento, então um
|
|
77
81
|
// rótulo visto uma vez precisa sobreviver à troca de página: sem esse cache,
|
|
78
82
|
// buscar (ou paginar) fazia o chip de um valor ainda selecionado sumir do
|
|
@@ -223,7 +227,7 @@ export function MultiCombobox({
|
|
|
223
227
|
|
|
224
228
|
if (isDesktop) {
|
|
225
229
|
return (
|
|
226
|
-
<PopoverPrimitive.Root open={open} onOpenChange={
|
|
230
|
+
<PopoverPrimitive.Root open={open} onOpenChange={handleOpenChange}>
|
|
227
231
|
<PopoverPrimitive.Trigger asChild disabled={disabled}>
|
|
228
232
|
{trigger}
|
|
229
233
|
</PopoverPrimitive.Trigger>
|
|
@@ -242,7 +246,7 @@ export function MultiCombobox({
|
|
|
242
246
|
}
|
|
243
247
|
|
|
244
248
|
return (
|
|
245
|
-
<DrawerPrimitive.Root open={open} onOpenChange={
|
|
249
|
+
<DrawerPrimitive.Root open={open} onOpenChange={handleOpenChange}>
|
|
246
250
|
<DrawerPrimitive.Trigger asChild disabled={disabled}>
|
|
247
251
|
{trigger}
|
|
248
252
|
</DrawerPrimitive.Trigger>
|