@vowt-tech/ui 0.0.0-stage → 0.177.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.
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,248 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { Menu as MenuPrimitive } from '@base-ui/react/menu';
5
+ import { cn } from '../lib/utils';
6
+ import { CheckIcon, ChevronRightIcon } from 'lucide-react';
7
+
8
+ function DropdownMenu({ ...props }: MenuPrimitive.Root.Props) {
9
+ return <MenuPrimitive.Root data-slot="dropdown-menu" {...props} />;
10
+ }
11
+
12
+ function DropdownMenuPortal({ ...props }: MenuPrimitive.Portal.Props) {
13
+ return <MenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />;
14
+ }
15
+
16
+ function DropdownMenuTrigger({ ...props }: MenuPrimitive.Trigger.Props) {
17
+ return <MenuPrimitive.Trigger data-slot="dropdown-menu-trigger" {...props} />;
18
+ }
19
+
20
+ function DropdownMenuContent({
21
+ align = 'start',
22
+ alignOffset = 0,
23
+ side = 'bottom',
24
+ sideOffset = 4,
25
+ className,
26
+ ...props
27
+ }: MenuPrimitive.Popup.Props &
28
+ Pick<MenuPrimitive.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset'>) {
29
+ return (
30
+ <MenuPrimitive.Portal>
31
+ <MenuPrimitive.Positioner
32
+ className="isolate z-50 outline-none"
33
+ align={align}
34
+ alignOffset={alignOffset}
35
+ side={side}
36
+ sideOffset={sideOffset}
37
+ >
38
+ <MenuPrimitive.Popup
39
+ data-slot="dropdown-menu-content"
40
+ className={cn(
41
+ 'z-50 max-h-(--available-height) w-max max-w-[min(32rem,var(--available-width))] min-w-[max(var(--anchor-width),11rem)] origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-menu bg-popover p-1 text-popover-foreground shadow-menu ring-1 ring-border duration-(--duration-fast) outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95',
42
+ className,
43
+ )}
44
+ {...props}
45
+ />
46
+ </MenuPrimitive.Positioner>
47
+ </MenuPrimitive.Portal>
48
+ );
49
+ }
50
+
51
+ function DropdownMenuGroup({ ...props }: MenuPrimitive.Group.Props) {
52
+ return <MenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />;
53
+ }
54
+
55
+ function DropdownMenuLabel({
56
+ className,
57
+ inset,
58
+ ...props
59
+ }: MenuPrimitive.GroupLabel.Props & {
60
+ inset?: boolean;
61
+ }) {
62
+ return (
63
+ <MenuPrimitive.GroupLabel
64
+ data-slot="dropdown-menu-label"
65
+ data-inset={inset}
66
+ className={cn(
67
+ 'px-2.5 py-1.5 text-body-12-medium text-muted-foreground data-inset:pl-9',
68
+ className,
69
+ )}
70
+ {...props}
71
+ />
72
+ );
73
+ }
74
+
75
+ function DropdownMenuItem({
76
+ className,
77
+ inset,
78
+ variant = 'default',
79
+ ...props
80
+ }: MenuPrimitive.Item.Props & {
81
+ inset?: boolean;
82
+ variant?: 'default' | 'destructive';
83
+ }) {
84
+ return (
85
+ <MenuPrimitive.Item
86
+ data-slot="dropdown-menu-item"
87
+ data-inset={inset}
88
+ data-variant={variant}
89
+ className={cn(
90
+ "group/dropdown-menu-item relative flex cursor-default items-center min-h-control-sm gap-2 rounded-item px-2.5 py-1.5 text-body-13 whitespace-nowrap outline-hidden data-highlighted:bg-hover select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-9 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-icon-menu data-[variant=destructive]:*:[svg]:text-destructive",
91
+ className,
92
+ )}
93
+ {...props}
94
+ />
95
+ );
96
+ }
97
+
98
+ function DropdownMenuCheckboxItem({
99
+ className,
100
+ children,
101
+ checked,
102
+ inset,
103
+ ...props
104
+ }: MenuPrimitive.CheckboxItem.Props & {
105
+ inset?: boolean;
106
+ }) {
107
+ return (
108
+ <MenuPrimitive.CheckboxItem
109
+ data-slot="dropdown-menu-checkbox-item"
110
+ data-inset={inset}
111
+ className={cn(
112
+ "relative flex cursor-default items-center min-h-control-sm gap-2 rounded-item py-1.5 pr-8 pl-3 text-body-13 whitespace-nowrap outline-hidden data-highlighted:bg-hover select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-9 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-icon-menu",
113
+ className,
114
+ )}
115
+ checked={checked}
116
+ {...props}
117
+ >
118
+ <span
119
+ className="pointer-events-none absolute right-3 flex items-center justify-center"
120
+ data-slot="dropdown-menu-checkbox-item-indicator"
121
+ >
122
+ <MenuPrimitive.CheckboxItemIndicator>
123
+ <CheckIcon />
124
+ </MenuPrimitive.CheckboxItemIndicator>
125
+ </span>
126
+ {children}
127
+ </MenuPrimitive.CheckboxItem>
128
+ );
129
+ }
130
+
131
+ function DropdownMenuRadioGroup({ ...props }: MenuPrimitive.RadioGroup.Props) {
132
+ return <MenuPrimitive.RadioGroup data-slot="dropdown-menu-radio-group" {...props} />;
133
+ }
134
+
135
+ function DropdownMenuRadioItem({
136
+ className,
137
+ children,
138
+ inset,
139
+ ...props
140
+ }: MenuPrimitive.RadioItem.Props & {
141
+ inset?: boolean;
142
+ }) {
143
+ return (
144
+ <MenuPrimitive.RadioItem
145
+ data-slot="dropdown-menu-radio-item"
146
+ data-inset={inset}
147
+ className={cn(
148
+ "relative flex cursor-default items-center min-h-control-sm gap-2 rounded-item py-1.5 pr-8 pl-3 text-body-13 whitespace-nowrap outline-hidden data-highlighted:bg-hover select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-9 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-icon-menu",
149
+ className,
150
+ )}
151
+ {...props}
152
+ >
153
+ <span
154
+ className="pointer-events-none absolute right-3 flex items-center justify-center"
155
+ data-slot="dropdown-menu-radio-item-indicator"
156
+ >
157
+ <MenuPrimitive.RadioItemIndicator>
158
+ <CheckIcon />
159
+ </MenuPrimitive.RadioItemIndicator>
160
+ </span>
161
+ {children}
162
+ </MenuPrimitive.RadioItem>
163
+ );
164
+ }
165
+
166
+ function DropdownMenuSeparator({ className, ...props }: MenuPrimitive.Separator.Props) {
167
+ return (
168
+ <MenuPrimitive.Separator
169
+ data-slot="dropdown-menu-separator"
170
+ className={cn('-mx-1 my-1 h-px bg-border', className)}
171
+ {...props}
172
+ />
173
+ );
174
+ }
175
+
176
+ function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<'span'>) {
177
+ return (
178
+ <span
179
+ data-slot="dropdown-menu-shortcut"
180
+ className={cn(
181
+ 'ml-auto text-mono-12 text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground',
182
+ className,
183
+ )}
184
+ {...props}
185
+ />
186
+ );
187
+ }
188
+
189
+ // Submenu que abre para o lado, como a lista de empresas no menu da conta, D-722.
190
+ function DropdownMenuSub({ ...props }: MenuPrimitive.SubmenuRoot.Props) {
191
+ return <MenuPrimitive.SubmenuRoot data-slot="dropdown-menu-sub" {...props} />;
192
+ }
193
+
194
+ function DropdownMenuSubTrigger({
195
+ className,
196
+ children,
197
+ ...props
198
+ }: MenuPrimitive.SubmenuTrigger.Props) {
199
+ return (
200
+ <MenuPrimitive.SubmenuTrigger
201
+ data-slot="dropdown-menu-sub-trigger"
202
+ className={cn(
203
+ "flex cursor-default items-center min-h-control-sm gap-2 rounded-item px-2.5 py-1.5 text-body-13 whitespace-nowrap outline-hidden select-none data-highlighted:bg-hover data-popup-open:bg-hover [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-icon-menu",
204
+ className,
205
+ )}
206
+ {...props}
207
+ >
208
+ {children}
209
+ <ChevronRightIcon className="ml-auto text-muted-foreground" />
210
+ </MenuPrimitive.SubmenuTrigger>
211
+ );
212
+ }
213
+
214
+ function DropdownMenuSubContent({
215
+ side = 'right',
216
+ align = 'start',
217
+ sideOffset = 6,
218
+ alignOffset = -4,
219
+ ...props
220
+ }: React.ComponentProps<typeof DropdownMenuContent>) {
221
+ return (
222
+ <DropdownMenuContent
223
+ side={side}
224
+ align={align}
225
+ sideOffset={sideOffset}
226
+ alignOffset={alignOffset}
227
+ {...props}
228
+ />
229
+ );
230
+ }
231
+
232
+ export {
233
+ DropdownMenu,
234
+ DropdownMenuPortal,
235
+ DropdownMenuTrigger,
236
+ DropdownMenuContent,
237
+ DropdownMenuGroup,
238
+ DropdownMenuLabel,
239
+ DropdownMenuItem,
240
+ DropdownMenuCheckboxItem,
241
+ DropdownMenuRadioGroup,
242
+ DropdownMenuRadioItem,
243
+ DropdownMenuSeparator,
244
+ DropdownMenuShortcut,
245
+ DropdownMenuSub,
246
+ DropdownMenuSubContent,
247
+ DropdownMenuSubTrigger,
248
+ };
@@ -0,0 +1,299 @@
1
+ 'use client';
2
+
3
+ import {
4
+ ForkKnifeIcon,
5
+ HandIcon,
6
+ HeartIcon,
7
+ HistoryIcon,
8
+ LeafIcon,
9
+ LightbulbIcon,
10
+ PartyPopperIcon,
11
+ PlaneIcon,
12
+ SmileIcon,
13
+ StarIcon,
14
+ } from 'lucide-react';
15
+ import * as React from 'react';
16
+ import { SearchInput } from './input';
17
+ import { Tabs, TabsContent, TabsList, TabsTrigger } from './tabs';
18
+ import { cn } from '../lib/utils';
19
+
20
+ // Seletor de emoji: categorias em abas, busca pelo nome em português e os recentes, guardados no
21
+ // navegador de quem usa. Os emojis vêm no próprio arquivo, uma seleção dos mais usados em
22
+ // atendimento e vendas, sem biblioteca extra. Com `frequent`, abre na aba Mais usados, como os
23
+ // emojis que a loja mais manda. Vai dentro de um Popover, como no Composer.
24
+
25
+ export type Emoji = { emoji: string; name: string };
26
+
27
+ export type EmojiCategory = {
28
+ id: string;
29
+ label: string;
30
+ icon: React.ReactNode;
31
+ emojis: Emoji[];
32
+ };
33
+
34
+ /** "😀 sorriso|😃 sorriso aberto" vira a lista. O nome inclui palavras para a busca. */
35
+ function list(text: string): Emoji[] {
36
+ return text
37
+ .split('|')
38
+ .map((item) => item.trim())
39
+ .filter(Boolean)
40
+ .map((item) => {
41
+ const space = item.indexOf(' ');
42
+ return { emoji: item.slice(0, space), name: item.slice(space + 1) };
43
+ });
44
+ }
45
+
46
+ export const EMOJI_CATEGORIES: EmojiCategory[] = [
47
+ {
48
+ id: 'rostos',
49
+ label: 'Rostos',
50
+ icon: <SmileIcon />,
51
+ emojis: list(
52
+ '😀 sorriso|😃 sorriso aberto|😄 sorriso com olhos felizes|😁 sorriso largo|😆 rindo|😅 sorriso com suor|😂 chorando de rir|🤣 rolando de rir|🙂 sorriso leve|🙃 de cabeça para baixo|😉 piscando|😊 feliz corado|😇 anjo|🥰 apaixonado com corações|😍 olhos de coração|🤩 deslumbrado estrela|😘 mandando beijo|😋 delícia gostoso|😛 língua de fora|😜 piscando com língua|🤪 maluco|🤗 abraço|🤭 mão na boca|🤫 silêncio segredo|🤔 pensando|🫡 continência saudação|😐 neutro|😑 sem expressão|😶 sem boca|🙄 revirando os olhos|😏 sorriso de canto|😬 careta|😌 aliviado|😔 pensativo triste|😴 dormindo sono|😷 máscara doente|🤒 febre termômetro|🥳 festa comemoração|😎 óculos escuros legal|🤓 nerd|😕 confuso|😟 preocupado|😮 surpreso boca aberta|😲 espantado|🥺 pidão por favor|🥲 sorriso com lágrima|😢 chorando lágrima|😭 chorando muito|😱 gritando de medo|😤 bufando|😡 bravo com raiva|🤯 cabeça explodindo|🫠 derretendo',
53
+ ),
54
+ },
55
+ {
56
+ id: 'gestos',
57
+ label: 'Gestos e pessoas',
58
+ icon: <HandIcon />,
59
+ emojis: list(
60
+ '👍 joinha positivo curti|👎 negativo não curti|👌 ok perfeito|✌️ paz vitória|🤞 dedos cruzados sorte|🤟 te amo|🤘 rock|🤙 me liga|👈 apontando para a esquerda|👉 apontando para a direita|👆 apontando para cima|👇 apontando para baixo|☝️ indicador|👋 tchau oi aceno|🤚 mão levantada|✋ mão pare|🖐️ mão aberta|👏 palmas aplausos|🙌 mãos para cima celebração|🤲 mãos juntas|🙏 por favor obrigado|🤝 aperto de mão acordo|💪 força músculo|✍️ escrevendo|👀 olhos olhando|🧠 cérebro|👶 bebê|👧 menina|👦 menino|👩 mulher|👨 homem|👵 idosa vó|👴 idoso vô|🧑‍💻 pessoa no computador|👩‍💼 mulher executiva|👨‍🍳 cozinheiro|🧑‍🔧 técnico mecânico|🚶 andando|🏃 correndo pressa|💃 dançando|👪 família',
61
+ ),
62
+ },
63
+ {
64
+ id: 'simbolos',
65
+ label: 'Corações e símbolos',
66
+ icon: <HeartIcon />,
67
+ emojis: list(
68
+ '❤️ coração vermelho amor|🧡 coração laranja|💛 coração amarelo|💚 coração verde|💙 coração azul|💜 coração roxo|🖤 coração preto|🤍 coração branco|🤎 coração marrom|💔 coração partido|💕 dois corações|💖 coração brilhando|💯 cem pontos|✅ certo feito marcado|☑️ caixa marcada|✔️ visto|❌ errado x|⚠️ atenção aviso|❗ exclamação|❓ pergunta interrogação|‼️ dupla exclamação|🔴 círculo vermelho|🟢 círculo verde|🟡 círculo amarelo|🔵 círculo azul|⭐ estrela|🌟 estrela brilhante|✨ brilhos|🔥 fogo|💥 explosão|💬 balão de fala mensagem|🆕 novo|🆓 grátis|🔝 topo|♻️ reciclar|➡️ seta para a direita|⬅️ seta para a esquerda|⬆️ seta para cima|⬇️ seta para baixo|🔁 repetir|ℹ️ informação',
69
+ ),
70
+ },
71
+ {
72
+ id: 'natureza',
73
+ label: 'Natureza',
74
+ icon: <LeafIcon />,
75
+ emojis: list(
76
+ '🐶 cachorro|🐱 gato|🐭 rato|🐰 coelho|🦊 raposa|🐻 urso|🐼 panda|🐨 coala|🐯 tigre|🦁 leão|🐮 vaca|🐷 porco|🐸 sapo|🐵 macaco|🐔 galinha|🐧 pinguim|🐦 pássaro|🦜 papagaio arara|🦋 borboleta|🐝 abelha|🐢 tartaruga|🐟 peixe|🐬 golfinho|🌸 flor de cerejeira|🌹 rosa flor|🌻 girassol|🌷 tulipa|🌱 broto planta|🌳 árvore|🌴 palmeira coqueiro|🍀 trevo sorte|🍁 folha de outono|🌵 cacto|☀️ sol|🌤️ sol com nuvem|☁️ nuvem|🌧️ chuva|⛈️ tempestade|❄️ neve floco|🌈 arco-íris|🌙 lua|🌊 onda mar',
77
+ ),
78
+ },
79
+ {
80
+ id: 'comida',
81
+ label: 'Comida e bebida',
82
+ icon: <ForkKnifeIcon />,
83
+ emojis: list(
84
+ '🍎 maçã|🍌 banana|🍓 morango|🍇 uva|🍉 melancia|🍍 abacaxi|🥭 manga|🍊 laranja|🍋 limão|🥑 abacate|🍅 tomate|🥕 cenoura|🌽 milho|🍞 pão|🧀 queijo|🥚 ovo|🍳 ovo frito|🥩 carne|🍗 frango coxa|🍔 hambúrguer|🍟 batata frita|🍕 pizza|🌭 cachorro-quente|🌮 taco|🍝 macarrão|🍣 sushi|🍰 bolo fatia|🎂 bolo de aniversário|🍫 chocolate|🍬 bala doce|🍦 sorvete|🍩 rosquinha|🍪 biscoito cookie|☕ café|🍵 chá|🧃 suco de caixinha|🥤 refrigerante copo|🍺 cerveja|🍷 vinho|🥂 brinde taças|🍾 champanhe',
85
+ ),
86
+ },
87
+ {
88
+ id: 'atividades',
89
+ label: 'Festa e atividades',
90
+ icon: <PartyPopperIcon />,
91
+ emojis: list(
92
+ '🎉 festa confete|🎊 confete bola|🎈 balão|🎁 presente|🎀 laço|🎄 árvore de natal|🎃 abóbora halloween|🎆 fogos de artifício|🏆 troféu|🥇 medalha de ouro primeiro lugar|🥈 medalha de prata|🥉 medalha de bronze|🏅 medalha|⚽ futebol bola|🏀 basquete|🏐 vôlei|🎾 tênis|🏋️ academia peso|🚴 ciclismo bicicleta|🧘 ioga meditação|🎮 videogame|🎲 dado jogo|🎯 alvo meta|🎵 nota musical|🎶 música|🎤 microfone|🎧 fone de ouvido|🎬 cinema filme|📸 câmera foto|🎨 arte pintura',
93
+ ),
94
+ },
95
+ {
96
+ id: 'viagem',
97
+ label: 'Viagem e lugares',
98
+ icon: <PlaneIcon />,
99
+ emojis: list(
100
+ '🚗 carro|🚕 táxi|🚌 ônibus|🚚 caminhão entrega|🚛 carreta|🏍️ moto|🛵 motoboy scooter|🚲 bicicleta|✈️ avião|🚀 foguete|🚢 navio|⛽ posto combustível|🚦 semáforo|🗺️ mapa|📍 alfinete localização|🏠 casa|🏢 prédio escritório|🏪 loja|🏬 shopping|🏦 banco|🏥 hospital|🏫 escola|⛪ igreja|🏖️ praia|⛰️ montanha|🏕️ acampamento|🌎 mundo terra|🧳 mala viagem',
101
+ ),
102
+ },
103
+ {
104
+ id: 'objetos',
105
+ label: 'Objetos e trabalho',
106
+ icon: <LightbulbIcon />,
107
+ emojis: list(
108
+ '📦 caixa pacote encomenda|📫 caixa de correio|✉️ envelope carta|📧 e-mail|📱 celular|💻 notebook computador|🖥️ computador|⌨️ teclado|🖨️ impressora|📞 telefone|☎️ telefone fixo|🔔 sino aviso|🔕 sino mudo|📢 alto-falante anúncio|💡 ideia lâmpada|🔑 chave|🔒 cadeado fechado|🔓 cadeado aberto|🛒 carrinho de compras|🛍️ sacolas de compras|💳 cartão de crédito|💰 saco de dinheiro|💵 nota de dinheiro|🪙 moeda|🧾 recibo nota fiscal|📈 gráfico subindo|📉 gráfico descendo|📊 gráfico de barras|📅 calendário|📆 agenda|⏰ despertador|⏳ ampulheta|📝 anotação|📌 tachinha|📎 clipe anexo|✂️ tesoura|🔍 lupa busca|🧰 caixa de ferramentas|🔧 chave inglesa|🏷️ etiqueta preço|🎟️ ingresso cupom|📄 documento página|📁 pasta',
109
+ ),
110
+ },
111
+ ];
112
+
113
+ const ALL = EMOJI_CATEGORIES.flatMap((c) => c.emojis);
114
+ const NAME = new Map(ALL.map((e) => [e.emoji, e.name]));
115
+
116
+ /** Sem acento e em minúsculas, para "coracao" achar "coração". */
117
+ function plain(text: string): string {
118
+ return text
119
+ .normalize('NFD')
120
+ .replace(/\p{Diacritic}/gu, '')
121
+ .toLowerCase();
122
+ }
123
+
124
+ const RECENT_LIMIT = 24;
125
+
126
+ function readRecent(key: string): string[] {
127
+ try {
128
+ const raw = window.localStorage.getItem(key);
129
+ const parsed: unknown = raw ? JSON.parse(raw) : [];
130
+ return Array.isArray(parsed) ? parsed.filter((e) => typeof e === 'string') : [];
131
+ } catch {
132
+ return [];
133
+ }
134
+ }
135
+
136
+ const COLS = 8;
137
+
138
+ // Foco itinerante: só um emoji entra na ordem do Tab; as setas, Home e End andam pela grade.
139
+ function Grid({
140
+ emojis,
141
+ label,
142
+ onPick,
143
+ }: {
144
+ emojis: string[];
145
+ label: string;
146
+ onPick: (emoji: string) => void;
147
+ }) {
148
+ const [active, setActive] = React.useState(0);
149
+ const refs = React.useRef<(HTMLButtonElement | null)[]>([]);
150
+ const current = Math.min(active, Math.max(0, emojis.length - 1));
151
+
152
+ function onKeyDown(e: React.KeyboardEvent<HTMLButtonElement>, i: number) {
153
+ const last = emojis.length - 1;
154
+ const step: Record<string, number> = {
155
+ ArrowRight: i + 1,
156
+ ArrowLeft: i - 1,
157
+ ArrowDown: i + COLS,
158
+ ArrowUp: i - COLS,
159
+ Home: 0,
160
+ End: last,
161
+ };
162
+ const next = step[e.key];
163
+ if (next === undefined || next < 0 || next > last) return;
164
+ e.preventDefault();
165
+ setActive(next);
166
+ refs.current[next]?.focus();
167
+ }
168
+
169
+ return (
170
+ <div role="group" aria-label={label} className="grid grid-cols-8 gap-0.5">
171
+ {emojis.map((em, i) => {
172
+ const name = NAME.get(em) ?? em;
173
+ return (
174
+ <button
175
+ key={em}
176
+ ref={(el) => {
177
+ refs.current[i] = el;
178
+ }}
179
+ type="button"
180
+ title={name}
181
+ aria-label={name}
182
+ tabIndex={i === current ? 0 : -1}
183
+ onFocus={() => setActive(i)}
184
+ onKeyDown={(e) => onKeyDown(e, i)}
185
+ onClick={() => onPick(em)}
186
+ className="grid size-8 place-items-center rounded-control text-heading-16-regular outline-none hover:bg-hover focus-visible:focus-ring"
187
+ >
188
+ {em}
189
+ </button>
190
+ );
191
+ })}
192
+ </div>
193
+ );
194
+ }
195
+
196
+ function EmojiPicker({
197
+ onSelect,
198
+ frequent,
199
+ frequentLabel = 'Mais usados',
200
+ recentKey = 'vowt-emoji-recentes',
201
+ className,
202
+ }: {
203
+ /** Recebe o emoji escolhido, como "👍". */
204
+ onSelect: (emoji: string) => void;
205
+ /** Primeira aba, como os emojis que a loja mais manda. Use COMPOSER_EMOJIS no atendimento. */
206
+ frequent?: string[];
207
+ frequentLabel?: string;
208
+ /** Onde o navegador guarda os recentes. Use null para não guardar. */
209
+ recentKey?: string | null;
210
+ className?: string;
211
+ }) {
212
+ const [query, setQuery] = React.useState('');
213
+ const [recent, setRecent] = React.useState<string[]>([]);
214
+ React.useEffect(() => {
215
+ if (recentKey) setRecent(readRecent(recentKey));
216
+ }, [recentKey]);
217
+
218
+ const pick = (emoji: string) => {
219
+ onSelect(emoji);
220
+ if (!recentKey) return;
221
+ const next = [emoji, ...recent.filter((e) => e !== emoji)].slice(0, RECENT_LIMIT);
222
+ setRecent(next);
223
+ try {
224
+ window.localStorage.setItem(recentKey, JSON.stringify(next));
225
+ } catch {
226
+ // Navegador sem espaço ou em modo privado: os recentes ficam só nesta tela.
227
+ }
228
+ };
229
+
230
+ const term = plain(query.trim());
231
+ const found = term ? ALL.filter((e) => plain(e.name).includes(term)).map((e) => e.emoji) : [];
232
+
233
+ const tabs = [
234
+ ...(recent.length > 0
235
+ ? [{ id: 'recentes', label: 'Recentes', icon: <HistoryIcon />, emojis: recent }]
236
+ : []),
237
+ ...(frequent && frequent.length > 0
238
+ ? [{ id: 'frequentes', label: frequentLabel, icon: <StarIcon />, emojis: frequent }]
239
+ : []),
240
+ ...EMOJI_CATEGORIES.map((c) => ({ ...c, emojis: c.emojis.map((e) => e.emoji) })),
241
+ ];
242
+ const first = frequent && frequent.length > 0 ? 'frequentes' : (EMOJI_CATEGORIES[0]?.id ?? '');
243
+
244
+ // Uma coluna que não cresce além da largura do seletor: sem ela, a fileira de abas empurrava a
245
+ // busca para fora da caixa.
246
+ return (
247
+ <div
248
+ data-slot="emoji-picker"
249
+ className={cn('grid w-[18.5rem] max-w-full grid-cols-1 gap-2', className)}
250
+ >
251
+ <SearchInput
252
+ size="sm"
253
+ value={query}
254
+ onValueChange={setQuery}
255
+ placeholder="Buscar emoji"
256
+ aria-label="Buscar emoji"
257
+ />
258
+ {term ? (
259
+ <div className="h-60 overflow-y-auto" aria-live="polite">
260
+ {found.length > 0 ? (
261
+ <Grid emojis={found} label={`Emojis com ${query.trim()}`} onPick={pick} />
262
+ ) : (
263
+ <p className="px-1 py-6 text-center text-body-13 text-muted-foreground">
264
+ Nenhum emoji com “{query.trim()}”.
265
+ </p>
266
+ )}
267
+ </div>
268
+ ) : (
269
+ <Tabs defaultValue={first} className="gap-2">
270
+ <TabsList variant="line" className="w-full justify-between gap-0 px-0">
271
+ {tabs.map((t) => (
272
+ <TabsTrigger
273
+ key={t.id}
274
+ value={t.id}
275
+ aria-label={t.label}
276
+ title={t.label}
277
+ className="flex-none px-1"
278
+ >
279
+ {t.icon}
280
+ </TabsTrigger>
281
+ ))}
282
+ </TabsList>
283
+ {tabs.map((t) => (
284
+ <TabsContent
285
+ key={t.id}
286
+ value={t.id}
287
+ className="grid h-60 content-start gap-1.5 overflow-y-auto"
288
+ >
289
+ <p className="px-1 text-body-12 text-muted-foreground">{t.label}</p>
290
+ <Grid emojis={t.emojis} label={t.label} onPick={pick} />
291
+ </TabsContent>
292
+ ))}
293
+ </Tabs>
294
+ )}
295
+ </div>
296
+ );
297
+ }
298
+
299
+ export { EmojiPicker };