@motor-hero/ui-kit 0.46.0 → 0.47.0

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@motor-hero/ui-kit",
3
- "version": "0.46.0",
3
+ "version": "0.47.0",
4
4
  "description": "Componentes React reutilizáveis para o ecossistema MotorHero — shadcn/ui + Tailwind CSS v4",
5
5
  "author": "MotorHero",
6
6
  "license": "UNLICENSED",
@@ -58,10 +58,27 @@ export interface BaseDialogProps {
58
58
 
59
59
  /**
60
60
  * Standardized, responsive dialog shell:
61
- * - mobile: bottom sheet (full width, up to 92vh tall)
62
- * - desktop: centered dialog (up to 90vh tall)
61
+ * - mobile: bottom sheet that can grow to nearly the whole screen
62
+ * - desktop: centered dialog (up to 92dvh tall)
63
63
  * Header and footer stay fixed; only the body scrolls.
64
64
  *
65
+ * The mobile ceiling is the screen minus a slim top gap (safe area or
66
+ * 0.75rem, whichever is larger): a long form gets virtually the whole
67
+ * screen — the old 92dvh cap wasted ~70px on the one device where height is
68
+ * scarce — while the rounded top and the sliver of scrim above it keep the
69
+ * sheet language every other mobile surface in this kit speaks (combobox,
70
+ * pickers, menus are all `rounded-t-2xl` bottom sheets). An edge-to-edge
71
+ * square dialog here read as a foreign screen, not a layer of this app.
72
+ * Short dialogs still hug their content instead of stretching.
73
+ *
74
+ * Heights use `dvh`, not `vh`: on iOS `vh` is locked to the large viewport
75
+ * (toolbars collapsed), so a `vh` cap can exceed the visible area by
76
+ * 10-15%. With the sheet anchored to `bottom-0` the overflow leaves
77
+ * through the top, and since the body is the only scrollable child, what
78
+ * goes off-screen is the header - title and close button. Does not
79
+ * reproduce outside real iOS. The footer pads for the home indicator
80
+ * (`env(safe-area-inset-bottom)`); the top gap already clears the notch.
81
+ *
65
82
  * Also fixes the known Radix bug where `body { pointer-events: none }`
66
83
  * can persist after closing a dialog that contained a Select/Popover,
67
84
  * which would otherwise make the rest of the page unclickable.
@@ -113,7 +130,7 @@ export function BaseDialog({
113
130
  </div>
114
131
  <div className="min-h-0 flex-1 overflow-y-auto px-6 py-4">{children}</div>
115
132
  {footer && (
116
- <div className="flex shrink-0 flex-col-reverse gap-2 border-t px-6 py-3 sm:flex-row sm:justify-end">
133
+ <div className="flex shrink-0 flex-col-reverse gap-2 border-t px-6 py-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] sm:flex-row sm:justify-end">
117
134
  {footer}
118
135
  </div>
119
136
  )}
@@ -153,9 +170,13 @@ export function BaseDialog({
153
170
  document.body.style.pointerEvents = ""
154
171
  }}
155
172
  className={cn(
156
- "fixed z-50 flex max-h-[92vh] flex-col bg-background shadow-lg outline-none",
157
- "inset-x-0 bottom-0 rounded-t-2xl",
158
- "sm:inset-x-auto sm:bottom-auto sm:left-1/2 sm:top-1/2 sm:max-h-[92vh] sm:w-full sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-lg",
173
+ "fixed z-50 flex w-full flex-col bg-background shadow-lg outline-none",
174
+ "inset-x-0 bottom-0 rounded-t-2xl max-h-[calc(100dvh_-_max(0.75rem,env(safe-area-inset-top)))]",
175
+ // Entra deslizando de baixo, como os drawers (vaul) do restante do
176
+ // kit; no desktop os slides sairiam brigando com o translate de
177
+ // centralização, então ficam restritos ao mobile.
178
+ "max-sm:slide-in-from-bottom-8 max-sm:slide-out-to-bottom-8",
179
+ "sm:inset-x-auto sm:bottom-auto sm:left-1/2 sm:top-1/2 sm:max-h-[92dvh] sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-lg",
159
180
  "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
160
181
  sizeClasses[size],
161
182
  className,
@@ -178,7 +178,7 @@ export function Combobox({
178
178
  </div>
179
179
  <CommandPrimitive.List
180
180
  ref={listRef}
181
- className="max-h-[50vh] overflow-y-auto overflow-x-hidden p-1 sm:max-h-60"
181
+ className="max-h-[50dvh] overflow-y-auto overflow-x-hidden p-1 sm:max-h-60"
182
182
  >
183
183
  {!isServer && !showCreate && (
184
184
  <CommandPrimitive.Empty className="py-6 text-center text-sm text-muted-foreground">
@@ -260,7 +260,7 @@ export function Combobox({
260
260
  <DrawerPrimitive.Trigger asChild>{trigger}</DrawerPrimitive.Trigger>
261
261
  <DrawerPrimitive.Portal>
262
262
  <DrawerPrimitive.Overlay className="fixed inset-0 z-50 bg-black/80" />
263
- <DrawerPrimitive.Content className="fixed inset-x-0 bottom-0 z-50 mt-24 flex max-h-[85vh] flex-col rounded-t-2xl border bg-popover text-popover-foreground outline-none">
263
+ <DrawerPrimitive.Content className="fixed inset-x-0 bottom-0 z-50 mt-24 flex max-h-[85dvh] flex-col rounded-t-2xl border bg-popover text-popover-foreground outline-none">
264
264
  <DrawerPrimitive.Title className="sr-only">
265
265
  {placeholder}
266
266
  </DrawerPrimitive.Title>
@@ -351,7 +351,7 @@ function DatePickerImpl({
351
351
  onInteractOutside={(event) => {
352
352
  if (triggerRef.current?.contains(event.target as Node)) event.preventDefault()
353
353
  }}
354
- className="fixed inset-x-0 bottom-0 z-50 mt-24 flex max-h-[85vh] flex-col rounded-t-2xl border bg-popover text-popover-foreground outline-none"
354
+ className="fixed inset-x-0 bottom-0 z-50 mt-24 flex max-h-[85dvh] flex-col rounded-t-2xl border bg-popover text-popover-foreground outline-none"
355
355
  >
356
356
  <DrawerPrimitive.Title className="sr-only">
357
357
  {withTime ? "Selecione a data e o horário" : "Selecione a data"}
@@ -147,7 +147,7 @@ export function FilterPopover({
147
147
  <DrawerPrimitive.Trigger asChild>{trigger}</DrawerPrimitive.Trigger>
148
148
  <DrawerPrimitive.Portal>
149
149
  <DrawerPrimitive.Overlay className="fixed inset-0 z-50 bg-black/80" />
150
- <DrawerPrimitive.Content className="fixed inset-x-0 bottom-0 z-50 mt-24 flex max-h-[85vh] flex-col rounded-t-2xl border bg-popover text-popover-foreground outline-none">
150
+ <DrawerPrimitive.Content className="fixed inset-x-0 bottom-0 z-50 mt-24 flex max-h-[85dvh] flex-col rounded-t-2xl border bg-popover text-popover-foreground outline-none">
151
151
  <DrawerPrimitive.Title className="sr-only">
152
152
  {title ?? label}
153
153
  </DrawerPrimitive.Title>
@@ -180,7 +180,7 @@ export function MultiCombobox({
180
180
  </div>
181
181
  <CommandPrimitive.List
182
182
  ref={listRef}
183
- className="max-h-[50vh] overflow-y-auto overflow-x-hidden p-1 sm:max-h-60"
183
+ className="max-h-[50dvh] overflow-y-auto overflow-x-hidden p-1 sm:max-h-60"
184
184
  >
185
185
  {!isServer && (
186
186
  <CommandPrimitive.Empty className="py-6 text-center text-sm text-muted-foreground">
@@ -248,7 +248,7 @@ export function MultiCombobox({
248
248
  </DrawerPrimitive.Trigger>
249
249
  <DrawerPrimitive.Portal>
250
250
  <DrawerPrimitive.Overlay className="fixed inset-0 z-50 bg-black/80" />
251
- <DrawerPrimitive.Content className="fixed inset-x-0 bottom-0 z-50 mt-24 flex max-h-[85vh] flex-col rounded-t-2xl border bg-popover text-popover-foreground outline-none">
251
+ <DrawerPrimitive.Content className="fixed inset-x-0 bottom-0 z-50 mt-24 flex max-h-[85dvh] flex-col rounded-t-2xl border bg-popover text-popover-foreground outline-none">
252
252
  <DrawerPrimitive.Title className="sr-only">
253
253
  {placeholder}
254
254
  </DrawerPrimitive.Title>
@@ -30,7 +30,10 @@ export function Pagination({
30
30
  }: PaginationProps) {
31
31
  return (
32
32
  <div
33
- className={`flex items-center ${showPageSizeSelector ? "justify-between" : "justify-end"} gap-4 ${className ?? ""}`}
33
+ // Quebra em vez de empurrar: num celular de 360px os dois grupos não
34
+ // cabem na mesma linha e o "Próximo" saía da área visível, com a lista
35
+ // inteira rolando de lado atrás dele.
36
+ className={`flex flex-wrap items-center ${showPageSizeSelector ? "justify-between" : "justify-end"} gap-x-4 gap-y-2 ${className ?? ""}`}
34
37
  >
35
38
  {showPageSizeSelector && (
36
39
  <div className="flex items-center gap-2">