@strategicos/ui 0.4.1 → 0.6.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/README.md +22 -1
- package/dist/components/accordion.d.ts +10 -0
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +21 -0
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/chip.d.ts +40 -0
- package/dist/components/chip.d.ts.map +1 -0
- package/dist/components/chip.js +23 -0
- package/dist/components/chip.js.map +1 -0
- package/dist/components/dialog.d.ts +3 -1
- package/dist/components/dialog.d.ts.map +1 -1
- package/dist/components/dialog.js +12 -2
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dropzone.d.ts +38 -0
- package/dist/components/dropzone.d.ts.map +1 -0
- package/dist/components/dropzone.js +67 -0
- package/dist/components/dropzone.js.map +1 -0
- package/dist/components/empty-state.d.ts +24 -0
- package/dist/components/empty-state.d.ts.map +1 -0
- package/dist/components/empty-state.js +21 -0
- package/dist/components/empty-state.js.map +1 -0
- package/dist/components/multi-select.d.ts +44 -0
- package/dist/components/multi-select.d.ts.map +1 -0
- package/dist/components/multi-select.js +72 -0
- package/dist/components/multi-select.js.map +1 -0
- package/dist/components/page-header.d.ts +21 -0
- package/dist/components/page-header.d.ts.map +1 -0
- package/dist/components/page-header.js +20 -0
- package/dist/components/page-header.js.map +1 -0
- package/dist/components/popover.d.ts +10 -0
- package/dist/components/popover.d.ts.map +1 -0
- package/dist/components/popover.js +20 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/progress.d.ts +18 -0
- package/dist/components/progress.d.ts.map +1 -0
- package/dist/components/progress.js +18 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/segmented-control.d.ts +37 -0
- package/dist/components/segmented-control.d.ts.map +1 -0
- package/dist/components/segmented-control.js +26 -0
- package/dist/components/segmented-control.js.map +1 -0
- package/dist/components/sheet.d.ts +11 -1
- package/dist/components/sheet.d.ts.map +1 -1
- package/dist/components/sheet.js +10 -2
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/sidebar.d.ts.map +1 -1
- package/dist/components/sidebar.js +4 -2
- package/dist/components/sidebar.js.map +1 -1
- package/dist/components/stat.d.ts +27 -0
- package/dist/components/stat.d.ts.map +1 -0
- package/dist/components/stat.js +23 -0
- package/dist/components/stat.js.map +1 -0
- package/dist/components/tabs.d.ts +2 -2
- package/package.json +1 -1
- package/src/components/accordion.tsx +55 -0
- package/src/components/chip.tsx +111 -0
- package/src/components/dialog.tsx +20 -2
- package/src/components/dropzone.tsx +124 -0
- package/src/components/empty-state.tsx +56 -0
- package/src/components/multi-select.tsx +206 -0
- package/src/components/page-header.tsx +44 -0
- package/src/components/popover.tsx +44 -0
- package/src/components/progress.tsx +50 -0
- package/src/components/segmented-control.tsx +89 -0
- package/src/components/sheet.tsx +14 -1
- package/src/components/sidebar.tsx +5 -3
- package/src/components/stat.tsx +65 -0
package/src/components/sheet.tsx
CHANGED
|
@@ -45,14 +45,26 @@ function SheetOverlay({
|
|
|
45
45
|
)
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/** Largura máxima das gavetas laterais a partir de `sm`. No celular elas
|
|
49
|
+
* ocupam a largura toda. */
|
|
50
|
+
const sheetSizes = {
|
|
51
|
+
sm: "sm:max-w-sm",
|
|
52
|
+
md: "sm:max-w-[480px]",
|
|
53
|
+
lg: "sm:max-w-[640px]",
|
|
54
|
+
xl: "sm:max-w-[800px]",
|
|
55
|
+
}
|
|
56
|
+
|
|
48
57
|
function SheetContent({
|
|
49
58
|
className,
|
|
50
59
|
children,
|
|
51
60
|
side = "right",
|
|
61
|
+
size = "sm",
|
|
52
62
|
showCloseButton = true,
|
|
53
63
|
...props
|
|
54
64
|
}: React.ComponentProps<typeof SheetPrimitive.Content> & {
|
|
55
65
|
side?: "top" | "right" | "bottom" | "left"
|
|
66
|
+
/** Largura das gavetas `left`/`right` a partir de `sm`: 384, 480, 640 ou 800px. */
|
|
67
|
+
size?: keyof typeof sheetSizes
|
|
56
68
|
showCloseButton?: boolean
|
|
57
69
|
}) {
|
|
58
70
|
return (
|
|
@@ -62,7 +74,8 @@ function SheetContent({
|
|
|
62
74
|
data-slot="sheet-content"
|
|
63
75
|
data-side={side}
|
|
64
76
|
className={cn(
|
|
65
|
-
"fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-
|
|
77
|
+
"fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-full data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-full data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10",
|
|
78
|
+
(side === "left" || side === "right") && sheetSizes[size],
|
|
66
79
|
className
|
|
67
80
|
)}
|
|
68
81
|
{...props}
|
|
@@ -27,7 +27,9 @@ import { PanelLeftIcon } from "lucide-react"
|
|
|
27
27
|
const SIDEBAR_COOKIE_NAME = "sidebar_state"
|
|
28
28
|
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7
|
|
29
29
|
const SIDEBAR_WIDTH = "16rem"
|
|
30
|
-
|
|
30
|
+
// No celular o menu ocupa a tela inteira; quem usa a Sidebar põe o botão de
|
|
31
|
+
// fechar no próprio cabeçalho (o X padrão do Sheet fica escondido).
|
|
32
|
+
const SIDEBAR_WIDTH_MOBILE = "100%"
|
|
31
33
|
const SIDEBAR_WIDTH_ICON = "3rem"
|
|
32
34
|
const SIDEBAR_KEYBOARD_SHORTCUT = "b"
|
|
33
35
|
|
|
@@ -195,8 +197,8 @@ function Sidebar({
|
|
|
195
197
|
side={side}
|
|
196
198
|
>
|
|
197
199
|
<SheetHeader className="sr-only">
|
|
198
|
-
<SheetTitle>
|
|
199
|
-
<SheetDescription>
|
|
200
|
+
<SheetTitle>Menu</SheetTitle>
|
|
201
|
+
<SheetDescription>Navegação principal.</SheetDescription>
|
|
200
202
|
</SheetHeader>
|
|
201
203
|
<div className="flex h-full w-full flex-col">{children}</div>
|
|
202
204
|
</SheetContent>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
import { cn } from "../lib/utils.js"
|
|
4
|
+
import { Badge } from "./badge.js"
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Indicador numérico, como os "StatsGrid" do Mantine: rótulo, valor em
|
|
8
|
+
* destaque, contexto e, opcionalmente, um selo de variação e um ícone.
|
|
9
|
+
*
|
|
10
|
+
* <Stat
|
|
11
|
+
* label="Total após a reforma"
|
|
12
|
+
* value="R$ 1.890.000"
|
|
13
|
+
* description="2024 — primeira fase"
|
|
14
|
+
* delta="−R$ 560k"
|
|
15
|
+
* deltaTone="success"
|
|
16
|
+
* icon={<TrendingDown />}
|
|
17
|
+
* />
|
|
18
|
+
*
|
|
19
|
+
* Use num grid (ex.: `grid gap-4 sm:grid-cols-2 xl:grid-cols-4`).
|
|
20
|
+
*/
|
|
21
|
+
function Stat({
|
|
22
|
+
label,
|
|
23
|
+
value,
|
|
24
|
+
description,
|
|
25
|
+
delta,
|
|
26
|
+
deltaTone = "secondary",
|
|
27
|
+
icon,
|
|
28
|
+
className,
|
|
29
|
+
...props
|
|
30
|
+
}: Omit<React.ComponentProps<"div">, "children"> & {
|
|
31
|
+
label: React.ReactNode
|
|
32
|
+
value: React.ReactNode
|
|
33
|
+
description?: React.ReactNode
|
|
34
|
+
/** Variação ou etiqueta curta, num selo. */
|
|
35
|
+
delta?: React.ReactNode
|
|
36
|
+
deltaTone?: "secondary" | "success" | "warning" | "destructive" | "info"
|
|
37
|
+
icon?: React.ReactNode
|
|
38
|
+
}) {
|
|
39
|
+
return (
|
|
40
|
+
<div
|
|
41
|
+
data-slot="stat"
|
|
42
|
+
className={cn("flex flex-col gap-1 rounded-lg border border-border bg-card p-4 shadow-card", className)}
|
|
43
|
+
{...props}
|
|
44
|
+
>
|
|
45
|
+
<div className="flex items-start justify-between gap-3">
|
|
46
|
+
<p className="text-sm text-muted-foreground">{label}</p>
|
|
47
|
+
{icon && (
|
|
48
|
+
<span className="flex size-8 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground [&_svg]:size-4">
|
|
49
|
+
{icon}
|
|
50
|
+
</span>
|
|
51
|
+
)}
|
|
52
|
+
</div>
|
|
53
|
+
<p className="text-2xl leading-tight font-semibold text-foreground tabular-nums">{value}</p>
|
|
54
|
+
{(description || delta) && (
|
|
55
|
+
<div className="mt-1 flex flex-wrap items-center gap-2">
|
|
56
|
+
{/* normal-case: o Badge é em caixa alta, o que distorce valores ("p.p." → "P.P."). */}
|
|
57
|
+
{delta && <Badge variant={deltaTone} className="normal-case">{delta}</Badge>}
|
|
58
|
+
{description && <span className="text-xs text-muted-foreground">{description}</span>}
|
|
59
|
+
</div>
|
|
60
|
+
)}
|
|
61
|
+
</div>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export { Stat }
|