@softize/opus 8.8.1 → 8.8.2
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/package.json
CHANGED
|
@@ -310,10 +310,19 @@ function CustomSelect(props: Exclude<SelectProps, SelectNativeProps>): React.Rea
|
|
|
310
310
|
<Popover
|
|
311
311
|
open={open}
|
|
312
312
|
onOpenChange={(v) => {
|
|
313
|
-
// Fechar devolve o foco pro gatilho, e o gatilho abre AO RECEBER FOCO
|
|
314
|
-
// guarda
|
|
315
|
-
//
|
|
316
|
-
|
|
313
|
+
// Fechar devolve o foco pro gatilho, e o gatilho abre AO RECEBER FOCO — sem
|
|
314
|
+
// guarda, o seletor reabre sozinho ("abre, fecha e abre de novo").
|
|
315
|
+
//
|
|
316
|
+
// A guarda vale UM FRAME, não até ser consumida. Fechar clicando noutro lugar da
|
|
317
|
+
// página não devolve o foco pra cá, então uma trava que espera esse retorno ficaria
|
|
318
|
+
// armada pra sempre e engoliria a PRÓXIMA abertura por teclado — trocando um
|
|
319
|
+
// defeito visível por um que só aparece pra quem navega por Tab.
|
|
320
|
+
if (!v) {
|
|
321
|
+
closingRef.current = true
|
|
322
|
+
requestAnimationFrame(() => {
|
|
323
|
+
closingRef.current = false
|
|
324
|
+
})
|
|
325
|
+
}
|
|
317
326
|
setOpen(v)
|
|
318
327
|
}}
|
|
319
328
|
>
|
|
@@ -370,9 +379,12 @@ function CustomSelect(props: Exclude<SelectProps, SelectNativeProps>): React.Rea
|
|
|
370
379
|
o texto rolava pro fim ao ganhar foco (o browser leva o cursor pro final)
|
|
371
380
|
e o começo do título sumia — num campo estreito, a pessoa via o meio de
|
|
372
381
|
uma frase. `<span>` trunca com reticências, que é o certo. */}
|
|
373
|
-
{
|
|
382
|
+
{/* No MÚLTIPLO os chips ocupam o lugar do rótulo — mas quando não há nenhum,
|
|
383
|
+
o gatilho ficaria em branco (o input que carregava o placeholder virou
|
|
384
|
+
invisível). Campo mudo é pior que campo vazio: não diz nem o que é. */}
|
|
385
|
+
{(!props.multiple || selectedValues.length === 0) && (
|
|
374
386
|
<span data-slot="select-trigger-label" className={cn('min-w-0 flex-1 truncate text-left text-sm', selectedOption === undefined && 'text-muted-foreground')}>
|
|
375
|
-
{selectedOption?.triggerLabel ??
|
|
387
|
+
{props.multiple ? placeholder : (selectedOption?.triggerLabel ?? selectedOption?.label ?? placeholder)}
|
|
376
388
|
</span>
|
|
377
389
|
)}
|
|
378
390
|
<input
|