@vowt-tech/ui 0.0.0-stage → 0.177.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.
Files changed (116) hide show
  1. package/README.md +13 -2
  2. package/bin/vowt-ux-ui-design.mjs +483 -0
  3. package/guia/LEIA-PRIMEIRO.md +106 -0
  4. package/guia/VERSAO +1 -0
  5. package/guia/componentes.md +104 -0
  6. package/guia/regras/atualizar.md +136 -0
  7. package/guia/regras/componentes.md +374 -0
  8. package/guia/regras/fundamentos.md +257 -0
  9. package/guia/regras/marca.md +200 -0
  10. package/guia/regras/medidas.md +114 -0
  11. package/guia/regras/regras-de-base.md +85 -0
  12. package/guia/regras/telas/acoes.md +56 -0
  13. package/guia/regras/telas/direcao-ux.md +327 -0
  14. package/guia/regras/telas/padroes.md +58 -0
  15. package/guia/regras/telas/regras.md +171 -0
  16. package/guia/regras/telas/voz.md +134 -0
  17. package/package.json +72 -4
  18. package/src/brand/icons.ts +215 -0
  19. package/src/brand/logo.tsx +288 -0
  20. package/src/components/accordion.tsx +58 -0
  21. package/src/components/ai-orb.tsx +67 -0
  22. package/src/components/alert-dialog.tsx +227 -0
  23. package/src/components/alert.tsx +128 -0
  24. package/src/components/area-chart.tsx +180 -0
  25. package/src/components/attachment.tsx +339 -0
  26. package/src/components/avatar.tsx +197 -0
  27. package/src/components/badge.tsx +242 -0
  28. package/src/components/bar-chart.tsx +138 -0
  29. package/src/components/bar-list.tsx +85 -0
  30. package/src/components/brand-icon.tsx +52 -0
  31. package/src/components/breadcrumb.tsx +96 -0
  32. package/src/components/button-group.tsx +29 -0
  33. package/src/components/button.tsx +208 -0
  34. package/src/components/calendar.tsx +238 -0
  35. package/src/components/card.tsx +136 -0
  36. package/src/components/chart.tsx +289 -0
  37. package/src/components/checkbox.tsx +42 -0
  38. package/src/components/code-block.tsx +31 -0
  39. package/src/components/collapsible.tsx +114 -0
  40. package/src/components/color-picker.tsx +93 -0
  41. package/src/components/combo-chart.tsx +139 -0
  42. package/src/components/combobox.tsx +200 -0
  43. package/src/components/command.tsx +191 -0
  44. package/src/components/date-picker.tsx +435 -0
  45. package/src/components/description-list.tsx +280 -0
  46. package/src/components/dialog.tsx +192 -0
  47. package/src/components/diff-view.tsx +109 -0
  48. package/src/components/dropdown-menu.tsx +248 -0
  49. package/src/components/emoji-picker.tsx +299 -0
  50. package/src/components/empty.tsx +197 -0
  51. package/src/components/field.tsx +226 -0
  52. package/src/components/file-upload.tsx +186 -0
  53. package/src/components/funnel-chart.tsx +224 -0
  54. package/src/components/gauge-chart.tsx +109 -0
  55. package/src/components/heatmap.tsx +105 -0
  56. package/src/components/hover-card.tsx +47 -0
  57. package/src/components/image-viewer.tsx +174 -0
  58. package/src/components/input-otp.tsx +86 -0
  59. package/src/components/input.tsx +470 -0
  60. package/src/components/item.tsx +94 -0
  61. package/src/components/kbd.tsx +28 -0
  62. package/src/components/label.tsx +21 -0
  63. package/src/components/line-chart.tsx +92 -0
  64. package/src/components/link.tsx +34 -0
  65. package/src/components/message.tsx +903 -0
  66. package/src/components/number-field.tsx +79 -0
  67. package/src/components/pagination.tsx +208 -0
  68. package/src/components/phone-input.tsx +147 -0
  69. package/src/components/pie-chart.tsx +117 -0
  70. package/src/components/popover.tsx +102 -0
  71. package/src/components/powered-by.tsx +39 -0
  72. package/src/components/progress.tsx +278 -0
  73. package/src/components/prose.tsx +42 -0
  74. package/src/components/radar-chart.tsx +66 -0
  75. package/src/components/radial-chart.tsx +73 -0
  76. package/src/components/radio-group.tsx +135 -0
  77. package/src/components/rating.tsx +192 -0
  78. package/src/components/rich-text.tsx +1651 -0
  79. package/src/components/scatter-chart.tsx +115 -0
  80. package/src/components/scroll-area.tsx +50 -0
  81. package/src/components/select.tsx +193 -0
  82. package/src/components/separator.tsx +20 -0
  83. package/src/components/sheet.tsx +142 -0
  84. package/src/components/sidebar.tsx +570 -0
  85. package/src/components/skeleton.tsx +18 -0
  86. package/src/components/slider.tsx +47 -0
  87. package/src/components/sonner.tsx +178 -0
  88. package/src/components/sparkline.tsx +68 -0
  89. package/src/components/spinner.tsx +35 -0
  90. package/src/components/status-dot.tsx +45 -0
  91. package/src/components/stepper.tsx +228 -0
  92. package/src/components/switch.tsx +35 -0
  93. package/src/components/table.tsx +267 -0
  94. package/src/components/tabs.tsx +184 -0
  95. package/src/components/tag-input.tsx +238 -0
  96. package/src/components/textarea.tsx +47 -0
  97. package/src/components/time-picker.tsx +183 -0
  98. package/src/components/timeline.tsx +75 -0
  99. package/src/components/toggle-group.tsx +93 -0
  100. package/src/components/toggle.tsx +51 -0
  101. package/src/components/tooltip.tsx +160 -0
  102. package/src/components/tree.tsx +136 -0
  103. package/src/components/voice-message.tsx +193 -0
  104. package/src/css.d.ts +2 -0
  105. package/src/hooks/use-appearance.ts +57 -0
  106. package/src/hooks/use-mobile.ts +20 -0
  107. package/src/lib/appearance.ts +16 -0
  108. package/src/lib/button-render.ts +32 -0
  109. package/src/lib/char-count.tsx +67 -0
  110. package/src/lib/date.ts +45 -0
  111. package/src/lib/file-accept.ts +59 -0
  112. package/src/lib/markdown.ts +187 -0
  113. package/src/lib/utils.ts +29 -0
  114. package/src/lib/voice.ts +68 -0
  115. package/src/styles/shadcn.css +642 -0
  116. package/src/styles/theme.css +1825 -0
@@ -0,0 +1,570 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { mergeProps } from '@base-ui/react/merge-props';
5
+ import { useRender } from '@base-ui/react/use-render';
6
+ import { cva, type VariantProps } from 'class-variance-authority';
7
+ import { cn } from '../lib/utils';
8
+
9
+ import { useIsMobile } from '../hooks/use-mobile';
10
+ import { Button } from './button';
11
+ import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from './sheet';
12
+ import { Tooltip, TooltipContent, TooltipTrigger } from './tooltip';
13
+ import { PanelLeftIcon } from 'lucide-react';
14
+
15
+ const SIDEBAR_COOKIE_NAME = 'sidebar_state';
16
+ const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
17
+ const SIDEBAR_WIDTH = '16rem';
18
+ const SIDEBAR_WIDTH_MOBILE = '18rem';
19
+ const SIDEBAR_WIDTH_ICON = '3rem';
20
+ const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
21
+
22
+ type SidebarContextProps = {
23
+ state: 'expanded' | 'collapsed';
24
+ open: boolean;
25
+ setOpen: (open: boolean) => void;
26
+ openMobile: boolean;
27
+ setOpenMobile: (open: boolean) => void;
28
+ isMobile: boolean;
29
+ toggleSidebar: () => void;
30
+ };
31
+
32
+ const SidebarContext = React.createContext<SidebarContextProps | null>(null);
33
+
34
+ function useSidebar() {
35
+ const context = React.useContext(SidebarContext);
36
+ if (!context) {
37
+ throw new Error('useSidebar must be used within a SidebarProvider.');
38
+ }
39
+
40
+ return context;
41
+ }
42
+
43
+ function SidebarProvider({
44
+ defaultOpen = true,
45
+ open: openProp,
46
+ onOpenChange: setOpenProp,
47
+ className,
48
+ style,
49
+ children,
50
+ ...props
51
+ }: React.ComponentProps<'div'> & {
52
+ defaultOpen?: boolean;
53
+ open?: boolean;
54
+ onOpenChange?: (open: boolean) => void;
55
+ }) {
56
+ const isMobile = useIsMobile();
57
+ const [openMobile, setOpenMobile] = React.useState(false);
58
+
59
+ // This is the internal state of the sidebar.
60
+ // We use openProp and setOpenProp for control from outside the component.
61
+ const [_open, _setOpen] = React.useState(defaultOpen);
62
+ const open = openProp ?? _open;
63
+ const setOpen = React.useCallback(
64
+ (value: boolean | ((value: boolean) => boolean)) => {
65
+ const openState = typeof value === 'function' ? value(open) : value;
66
+ if (setOpenProp) {
67
+ setOpenProp(openState);
68
+ } else {
69
+ _setOpen(openState);
70
+ }
71
+
72
+ // This sets the cookie to keep the sidebar state.
73
+ document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
74
+ },
75
+ [setOpenProp, open],
76
+ );
77
+
78
+ // Helper to toggle the sidebar.
79
+ const toggleSidebar = React.useCallback(() => {
80
+ return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
81
+ }, [isMobile, setOpen, setOpenMobile]);
82
+
83
+ // Adds a keyboard shortcut to toggle the sidebar.
84
+ React.useEffect(() => {
85
+ const handleKeyDown = (event: KeyboardEvent) => {
86
+ // Num campo, o Ctrl+B é do campo, como o negrito do editor de texto: o menu não fecha.
87
+ const target = event.target as HTMLElement | null;
88
+ if (
89
+ target?.isContentEditable ||
90
+ target?.closest?.(
91
+ 'input, textarea, select, [contenteditable]:not([contenteditable="false"])',
92
+ )
93
+ )
94
+ return;
95
+ if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
96
+ event.preventDefault();
97
+ toggleSidebar();
98
+ }
99
+ };
100
+
101
+ window.addEventListener('keydown', handleKeyDown);
102
+ return () => window.removeEventListener('keydown', handleKeyDown);
103
+ }, [toggleSidebar]);
104
+
105
+ // We add a state so that we can do data-state="expanded" or "collapsed".
106
+ // This makes it easier to style the sidebar with Tailwind classes.
107
+ const state = open ? 'expanded' : 'collapsed';
108
+
109
+ const contextValue = React.useMemo<SidebarContextProps>(
110
+ () => ({
111
+ state,
112
+ open,
113
+ setOpen,
114
+ isMobile,
115
+ openMobile,
116
+ setOpenMobile,
117
+ toggleSidebar,
118
+ }),
119
+ [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar],
120
+ );
121
+
122
+ return (
123
+ <SidebarContext.Provider value={contextValue}>
124
+ <div
125
+ data-slot="sidebar-wrapper"
126
+ style={
127
+ {
128
+ '--sidebar-width': SIDEBAR_WIDTH,
129
+ '--sidebar-width-icon': SIDEBAR_WIDTH_ICON,
130
+ ...style,
131
+ } as React.CSSProperties
132
+ }
133
+ className={cn(
134
+ 'group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar',
135
+ className,
136
+ )}
137
+ {...props}
138
+ >
139
+ {children}
140
+ </div>
141
+ </SidebarContext.Provider>
142
+ );
143
+ }
144
+
145
+ function Sidebar({
146
+ side = 'left',
147
+ variant = 'sidebar',
148
+ collapsible = 'offcanvas',
149
+ tone = 'default',
150
+ className,
151
+ children,
152
+ dir,
153
+ ...props
154
+ }: React.ComponentProps<'div'> & {
155
+ side?: 'left' | 'right';
156
+ variant?: 'sidebar' | 'floating' | 'inset';
157
+ collapsible?: 'offcanvas' | 'icon' | 'none';
158
+ /** "shell" deixa o menu no tom da barra escura, também na gaveta do celular. */
159
+ tone?: 'default' | 'shell';
160
+ }) {
161
+ const shell = tone === 'shell' && 'sidebar-shell';
162
+ const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
163
+
164
+ if (collapsible === 'none') {
165
+ return (
166
+ <div
167
+ data-slot="sidebar"
168
+ className={cn(
169
+ 'flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground',
170
+ className,
171
+ )}
172
+ {...props}
173
+ >
174
+ {children}
175
+ </div>
176
+ );
177
+ }
178
+
179
+ if (isMobile) {
180
+ return (
181
+ <Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>
182
+ <SheetContent
183
+ dir={dir}
184
+ data-sidebar="sidebar"
185
+ data-slot="sidebar"
186
+ data-mobile="true"
187
+ className={cn(
188
+ 'w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden',
189
+ shell,
190
+ )}
191
+ style={
192
+ {
193
+ '--sidebar-width': SIDEBAR_WIDTH_MOBILE,
194
+ } as React.CSSProperties
195
+ }
196
+ side={side}
197
+ >
198
+ <SheetHeader className="sr-only">
199
+ <SheetTitle>Sidebar</SheetTitle>
200
+ <SheetDescription>Displays the mobile sidebar.</SheetDescription>
201
+ </SheetHeader>
202
+ <div className="flex h-full w-full flex-col">{children}</div>
203
+ </SheetContent>
204
+ </Sheet>
205
+ );
206
+ }
207
+
208
+ return (
209
+ <div
210
+ className={cn('group peer hidden text-sidebar-foreground md:block', shell)}
211
+ data-state={state}
212
+ data-collapsible={state === 'collapsed' ? collapsible : ''}
213
+ data-variant={variant}
214
+ data-side={side}
215
+ data-slot="sidebar"
216
+ >
217
+ {/* This is what handles the sidebar gap on desktop */}
218
+ <div
219
+ data-slot="sidebar-gap"
220
+ className={cn(
221
+ 'relative w-(--sidebar-width) bg-transparent transition-[width] duration-(--duration-medium) ease-linear',
222
+ 'group-data-[collapsible=offcanvas]:w-0',
223
+ 'group-data-[side=right]:rotate-180',
224
+ variant === 'floating' || variant === 'inset'
225
+ ? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]'
226
+ : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon)',
227
+ )}
228
+ />
229
+ <div
230
+ data-slot="sidebar-container"
231
+ data-side={side}
232
+ className={cn(
233
+ 'fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-(--duration-medium) ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex',
234
+ // Adjust the padding for floating and inset variants.
235
+ variant === 'floating' || variant === 'inset'
236
+ ? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]'
237
+ : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l',
238
+ className,
239
+ )}
240
+ {...props}
241
+ >
242
+ <div
243
+ data-sidebar="sidebar"
244
+ data-slot="sidebar-inner"
245
+ // tokens-ok: sombra pequena do menu solto, sem papel próprio, D-811
246
+ className="flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-inner group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border"
247
+ >
248
+ {children}
249
+ </div>
250
+ </div>
251
+ </div>
252
+ );
253
+ }
254
+
255
+ function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>) {
256
+ const { toggleSidebar } = useSidebar();
257
+
258
+ return (
259
+ <Button
260
+ data-sidebar="trigger"
261
+ data-slot="sidebar-trigger"
262
+ variant="ghost"
263
+ size="icon-sm"
264
+ className={cn(className)}
265
+ onClick={(event) => {
266
+ onClick?.(event);
267
+ toggleSidebar();
268
+ }}
269
+ {...props}
270
+ >
271
+ <PanelLeftIcon />
272
+ <span className="sr-only">Recolher ou abrir o menu</span>
273
+ </Button>
274
+ );
275
+ }
276
+
277
+ function SidebarInset({ className, ...props }: React.ComponentProps<'main'>) {
278
+ return (
279
+ <main
280
+ data-slot="sidebar-inset"
281
+ className={cn(
282
+ 'relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-card md:peer-data-[variant=inset]:shadow-panel',
283
+ className,
284
+ )}
285
+ {...props}
286
+ />
287
+ );
288
+ }
289
+
290
+ function SidebarHeader({ className, ...props }: React.ComponentProps<'div'>) {
291
+ return (
292
+ <div
293
+ data-slot="sidebar-header"
294
+ data-sidebar="header"
295
+ className={cn('flex flex-col gap-2 p-2', className)}
296
+ {...props}
297
+ />
298
+ );
299
+ }
300
+
301
+ function SidebarFooter({ className, ...props }: React.ComponentProps<'div'>) {
302
+ return (
303
+ <div
304
+ data-slot="sidebar-footer"
305
+ data-sidebar="footer"
306
+ className={cn('flex flex-col gap-2 p-2', className)}
307
+ {...props}
308
+ />
309
+ );
310
+ }
311
+
312
+ function SidebarContent({ className, ...props }: React.ComponentProps<'div'>) {
313
+ return (
314
+ <div
315
+ data-slot="sidebar-content"
316
+ data-sidebar="content"
317
+ className={cn(
318
+ // Recolhido, o menu continua rolando, com a barra escondida para os ícones não saírem do
319
+ // centro: sem isso, os últimos itens ficavam cobertos e sem como descer.
320
+ 'scroll-hover flex min-h-0 flex-1 flex-col gap-0 group-data-[collapsible=icon]:overflow-x-hidden group-data-[collapsible=icon]:[scrollbar-width:none] group-data-[collapsible=icon]:[&::-webkit-scrollbar]:hidden',
321
+ className,
322
+ )}
323
+ {...props}
324
+ />
325
+ );
326
+ }
327
+
328
+ function SidebarGroup({ className, ...props }: React.ComponentProps<'div'>) {
329
+ return (
330
+ <div
331
+ data-slot="sidebar-group"
332
+ data-sidebar="group"
333
+ className={cn('relative flex w-full min-w-0 flex-col p-2', className)}
334
+ {...props}
335
+ />
336
+ );
337
+ }
338
+
339
+ function SidebarGroupLabel({
340
+ className,
341
+ render,
342
+ ...props
343
+ }: useRender.ComponentProps<'div'> & React.ComponentProps<'div'>) {
344
+ return useRender({
345
+ defaultTagName: 'div',
346
+ props: mergeProps<'div'>(
347
+ {
348
+ className: cn(
349
+ 'flex h-8 shrink-0 items-center rounded-control px-2.5 text-body-12 text-label-foreground ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-(--duration-medium) ease-linear group-data-[collapsible=icon]:pointer-events-none group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-icon-lg [&>svg]:shrink-0',
350
+ className,
351
+ ),
352
+ },
353
+ props,
354
+ ),
355
+ render,
356
+ state: {
357
+ slot: 'sidebar-group-label',
358
+ sidebar: 'group-label',
359
+ },
360
+ });
361
+ }
362
+
363
+ function SidebarGroupContent({ className, ...props }: React.ComponentProps<'div'>) {
364
+ return (
365
+ <div
366
+ data-slot="sidebar-group-content"
367
+ data-sidebar="group-content"
368
+ className={cn('w-full text-body-13', className)}
369
+ {...props}
370
+ />
371
+ );
372
+ }
373
+
374
+ function SidebarMenu({ className, ...props }: React.ComponentProps<'ul'>) {
375
+ return (
376
+ <ul
377
+ data-slot="sidebar-menu"
378
+ data-sidebar="menu"
379
+ className={cn('flex w-full min-w-0 flex-col gap-0.5', className)}
380
+ {...props}
381
+ />
382
+ );
383
+ }
384
+
385
+ function SidebarMenuItem({ className, ...props }: React.ComponentProps<'li'>) {
386
+ return (
387
+ <li
388
+ data-slot="sidebar-menu-item"
389
+ data-sidebar="menu-item"
390
+ className={cn('group/menu-item relative', className)}
391
+ {...props}
392
+ />
393
+ );
394
+ }
395
+
396
+ const sidebarMenuButtonVariants = cva(
397
+ 'peer/menu-button group/menu-button flex w-full cursor-pointer items-center gap-2.5 overflow-hidden rounded-control px-2 py-1.5 text-left text-body-13 ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-control-sm! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-hover hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-hover data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground [&_svg]:size-icon-nav [&_svg]:shrink-0 [&_svg]:text-sidebar-icon data-active:[&_svg]:text-sidebar-icon-active',
398
+ {
399
+ variants: {
400
+ variant: {
401
+ default: 'hover:bg-sidebar-hover hover:text-sidebar-accent-foreground',
402
+ outline:
403
+ // tokens-ok: a borda de 1px feita com sombra, para não mudar a altura do item
404
+ 'bg-card shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-hover hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]',
405
+ },
406
+ size: {
407
+ default: 'min-h-control-xs text-body-13',
408
+ sm: 'h-control-xs text-body-12',
409
+ lg: 'h-control-xl text-body-13-medium group-data-[collapsible=icon]:p-0!',
410
+ },
411
+ },
412
+ defaultVariants: {
413
+ variant: 'default',
414
+ size: 'default',
415
+ },
416
+ },
417
+ );
418
+
419
+ function SidebarMenuButton({
420
+ render,
421
+ isActive = false,
422
+ variant = 'default',
423
+ size = 'default',
424
+ tooltip,
425
+ className,
426
+ ...props
427
+ }: useRender.ComponentProps<'button'> &
428
+ React.ComponentProps<'button'> & {
429
+ isActive?: boolean;
430
+ tooltip?: string | React.ComponentProps<typeof TooltipContent>;
431
+ } & VariantProps<typeof sidebarMenuButtonVariants>) {
432
+ // Funciona também fora do SidebarProvider, como no menu do site de documentação.
433
+ const ctx = React.useContext(SidebarContext);
434
+ const isMobile = ctx?.isMobile ?? false;
435
+ const state = ctx?.state ?? 'expanded';
436
+ const comp = useRender({
437
+ defaultTagName: 'button',
438
+ props: mergeProps<'button'>(
439
+ {
440
+ className: cn(sidebarMenuButtonVariants({ variant, size }), className),
441
+ },
442
+ props,
443
+ ),
444
+ render: !tooltip ? render : <TooltipTrigger render={render} />,
445
+ state: {
446
+ slot: 'sidebar-menu-button',
447
+ sidebar: 'menu-button',
448
+ size,
449
+ active: isActive,
450
+ },
451
+ });
452
+
453
+ if (!tooltip) {
454
+ return comp;
455
+ }
456
+
457
+ if (typeof tooltip === 'string') {
458
+ tooltip = {
459
+ children: tooltip,
460
+ };
461
+ }
462
+
463
+ return (
464
+ <Tooltip>
465
+ {comp}
466
+ <TooltipContent
467
+ side="right"
468
+ align="center"
469
+ hidden={state !== 'collapsed' || isMobile}
470
+ {...tooltip}
471
+ />
472
+ </Tooltip>
473
+ );
474
+ }
475
+
476
+ function SidebarMenuBadge({ className, ...props }: React.ComponentProps<'div'>) {
477
+ return (
478
+ <div
479
+ data-slot="sidebar-menu-badge"
480
+ data-sidebar="menu-badge"
481
+ className={cn(
482
+ 'pointer-events-none absolute right-2 flex h-5 min-w-5 items-center justify-center rounded-inner px-1 text-body-12-medium text-sidebar-foreground tabular-nums select-none group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground -translate-y-1/2 peer-data-[size=default]/menu-button:top-[18px] peer-data-[size=lg]/menu-button:top-6 peer-data-[size=sm]/menu-button:top-3.5 peer-data-active/menu-button:text-sidebar-accent-foreground',
483
+ className,
484
+ )}
485
+ {...props}
486
+ />
487
+ );
488
+ }
489
+
490
+ function SidebarMenuSub({ className, ...props }: React.ComponentProps<'ul'>) {
491
+ return (
492
+ <ul
493
+ data-slot="sidebar-menu-sub"
494
+ data-sidebar="menu-sub"
495
+ className={cn(
496
+ // Subitens com a linha à esquerda, saindo do ícone do item de cima (D-315). Num terceiro
497
+ // nível, a linha sai do texto do subitem de cima.
498
+ 'ml-4.75 flex min-w-0 flex-col gap-0.5 border-l border-sidebar-border py-0.5 pl-2 group-data-[collapsible=icon]:hidden in-data-[sidebar=menu-sub]:ml-2.5',
499
+ className,
500
+ )}
501
+ {...props}
502
+ />
503
+ );
504
+ }
505
+
506
+ function SidebarMenuSubItem({ className, ...props }: React.ComponentProps<'li'>) {
507
+ return (
508
+ <li
509
+ data-slot="sidebar-menu-sub-item"
510
+ data-sidebar="menu-sub-item"
511
+ className={cn('group/menu-sub-item relative', className)}
512
+ {...props}
513
+ />
514
+ );
515
+ }
516
+
517
+ function SidebarMenuSubButton({
518
+ render,
519
+ size = 'md',
520
+ isActive = false,
521
+ className,
522
+ ...props
523
+ }: useRender.ComponentProps<'a'> &
524
+ React.ComponentProps<'a'> & {
525
+ size?: 'sm' | 'md';
526
+ isActive?: boolean;
527
+ }) {
528
+ return useRender({
529
+ defaultTagName: 'a',
530
+ props: mergeProps<'a'>(
531
+ {
532
+ className: cn(
533
+ // Subitem igual ao item principal (D-176): 36px, texto 14 em peso 400 e começando na
534
+ // mesma linha do texto do item de cima; o ativo tem o mesmo fundo do item principal.
535
+ 'flex min-h-control-xs min-w-0 cursor-pointer items-center gap-2 overflow-hidden rounded-control py-1 pr-3 pl-2.5 text-body-13 text-sidebar-accent-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-hover focus-visible:ring-2 data-active:bg-sidebar-accent [&>svg]:size-icon-lg [&>svg]:shrink-0',
536
+ className,
537
+ ),
538
+ },
539
+ props,
540
+ ),
541
+ render,
542
+ state: {
543
+ slot: 'sidebar-menu-sub-button',
544
+ sidebar: 'menu-sub-button',
545
+ size,
546
+ active: isActive,
547
+ },
548
+ });
549
+ }
550
+
551
+ export {
552
+ Sidebar,
553
+ SidebarContent,
554
+ SidebarFooter,
555
+ SidebarHeader,
556
+ SidebarGroup,
557
+ SidebarGroupContent,
558
+ SidebarGroupLabel,
559
+ SidebarInset,
560
+ SidebarMenu,
561
+ SidebarMenuBadge,
562
+ SidebarMenuButton,
563
+ SidebarMenuItem,
564
+ SidebarMenuSub,
565
+ SidebarMenuSubButton,
566
+ SidebarMenuSubItem,
567
+ SidebarProvider,
568
+ SidebarTrigger,
569
+ useSidebar,
570
+ };
@@ -0,0 +1,18 @@
1
+ import { cn } from '../lib/utils';
2
+
3
+ // Bloco de carregamento. No escuro sobe um tom, para não sumir no cartão escuro. Nunca passa da
4
+ // largura de quem o contém, mesmo com uma largura fixa como w-64 num cartão estreito.
5
+ function Skeleton({ className, ...props }: React.ComponentProps<'div'>) {
6
+ return (
7
+ <div
8
+ data-slot="skeleton"
9
+ className={cn(
10
+ 'max-w-full animate-pulse rounded-inner bg-muted dark:bg-surface-strong',
11
+ className,
12
+ )}
13
+ {...props}
14
+ />
15
+ );
16
+ }
17
+
18
+ export { Skeleton };
@@ -0,0 +1,47 @@
1
+ 'use client';
2
+
3
+ import { Slider as SliderPrimitive } from '@base-ui/react/slider';
4
+ import { cn } from '../lib/utils';
5
+
6
+ // Escolha de um valor ou de uma faixa arrastando, como a faixa de preço de um filtro ou o desconto
7
+ // de um cupom. Com dois valores, vira faixa. O valor aparece ao lado, escrito pelo app (D-309).
8
+
9
+ function Slider({
10
+ className,
11
+ defaultValue,
12
+ value,
13
+ min = 0,
14
+ max = 100,
15
+ ...props
16
+ }: SliderPrimitive.Root.Props) {
17
+ const values = Array.isArray(value)
18
+ ? value
19
+ : Array.isArray(defaultValue)
20
+ ? defaultValue
21
+ : [value ?? defaultValue ?? min];
22
+ return (
23
+ <SliderPrimitive.Root
24
+ data-slot="slider"
25
+ className={cn('w-full data-disabled:opacity-50', className)}
26
+ defaultValue={defaultValue}
27
+ value={value}
28
+ min={min}
29
+ max={max}
30
+ {...props}
31
+ >
32
+ <SliderPrimitive.Control className="relative flex h-5 w-full touch-none items-center select-none">
33
+ <SliderPrimitive.Track className="relative h-1.5 w-full grow overflow-hidden rounded-full bg-muted">
34
+ <SliderPrimitive.Indicator className="absolute h-full rounded-full bg-selected-strong" />
35
+ </SliderPrimitive.Track>
36
+ {values.map((_, i) => (
37
+ <SliderPrimitive.Thumb
38
+ key={i}
39
+ className="block size-4 rounded-full border-2 border-selected-strong bg-card shadow-raised transition-[box-shadow] outline-none hover:ring-4 hover:ring-ring/30 focus-visible:focus-ring data-dragging:ring-4 data-dragging:ring-ring/50"
40
+ />
41
+ ))}
42
+ </SliderPrimitive.Control>
43
+ </SliderPrimitive.Root>
44
+ );
45
+ }
46
+
47
+ export { Slider };