@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,192 @@
1
+ 'use client';
2
+
3
+ import { AngryIcon, FrownIcon, LaughIcon, MehIcon, SmileIcon, StarIcon } from 'lucide-react';
4
+ import { useState } from 'react';
5
+ import { cn } from '../lib/utils';
6
+
7
+ // Nota em estrelas, de 1 a 5 (D-309): só mostra, como a média de um produto, ou deixa escolher,
8
+ // como a avaliação do atendimento. Mostrando, aceita meia estrela. Com `variant="faces"`, as
9
+ // estrelas viram cinco carinhas com o nome embaixo, de Muito ruim a Ótimo.
10
+
11
+ const SIZES = { sm: 'size-3.5', default: 'size-4', lg: 'size-6' } as const;
12
+
13
+ const FACES = [
14
+ { icon: AngryIcon, label: 'Muito ruim' },
15
+ { icon: FrownIcon, label: 'Ruim' },
16
+ { icon: MehIcon, label: 'Regular' },
17
+ { icon: SmileIcon, label: 'Bom' },
18
+ { icon: LaughIcon, label: 'Ótimo' },
19
+ ] as const;
20
+
21
+ /** Nome de cada nota de 1 a 5, como "Bom", para mostrar junto das estrelas. */
22
+ const RATING_LABELS = FACES.map((f) => f.label);
23
+
24
+ function arrows(
25
+ e: React.KeyboardEvent,
26
+ value: number,
27
+ max: number,
28
+ onValueChange: (v: number) => void,
29
+ ) {
30
+ if (e.key === 'ArrowRight' || e.key === 'ArrowUp') {
31
+ e.preventDefault();
32
+ onValueChange(Math.min(max, value + 1));
33
+ }
34
+ if (e.key === 'ArrowLeft' || e.key === 'ArrowDown') {
35
+ e.preventDefault();
36
+ onValueChange(Math.max(1, value - 1));
37
+ }
38
+ }
39
+
40
+ function FacesRating({
41
+ value,
42
+ onValueChange,
43
+ label,
44
+ className,
45
+ }: {
46
+ value: number;
47
+ onValueChange?: (value: number) => void;
48
+ label: string;
49
+ className?: string;
50
+ }) {
51
+ if (!onValueChange) {
52
+ const face = FACES[Math.min(5, Math.max(1, Math.round(value))) - 1]!;
53
+ return (
54
+ <span
55
+ data-slot="rating"
56
+ data-variant="faces"
57
+ role="img"
58
+ aria-label={`${label}: ${face.label}`}
59
+ className={cn('inline-flex items-center gap-1.5 text-body-13-medium', className)}
60
+ >
61
+ <face.icon fill="currentColor" className="size-5 text-warning" />
62
+ {face.label}
63
+ </span>
64
+ );
65
+ }
66
+ return (
67
+ <span
68
+ data-slot="rating"
69
+ data-variant="faces"
70
+ role="radiogroup"
71
+ aria-label={label}
72
+ className={cn('flex w-full justify-between gap-1', className)}
73
+ >
74
+ {FACES.map((f, i) => {
75
+ const n = i + 1;
76
+ const on = value === n;
77
+ return (
78
+ <button
79
+ key={n}
80
+ type="button"
81
+ role="radio"
82
+ aria-checked={on}
83
+ tabIndex={on || (value === 0 && n === 1) ? 0 : -1}
84
+ onClick={() => onValueChange(n)}
85
+ onKeyDown={(e) => arrows(e, value, 5, onValueChange)}
86
+ className={cn(
87
+ 'grid flex-1 content-start justify-items-center gap-1 rounded-control px-1 py-2 text-center text-body-12 text-muted-foreground outline-none hover:bg-hover hover:text-foreground focus-visible:focus-ring',
88
+ on && 'bg-selected text-foreground',
89
+ )}
90
+ >
91
+ <f.icon
92
+ fill={on ? 'currentColor' : 'none'}
93
+ className={cn('size-7', on && 'text-warning')}
94
+ />
95
+ {f.label}
96
+ </button>
97
+ );
98
+ })}
99
+ </span>
100
+ );
101
+ }
102
+
103
+ function Rating({
104
+ value,
105
+ onValueChange,
106
+ max = 5,
107
+ size = 'default',
108
+ label = 'Nota',
109
+ variant = 'stars',
110
+ className,
111
+ }: {
112
+ value: number;
113
+ /** Sem ela, só mostra. */
114
+ onValueChange?: (value: number) => void;
115
+ max?: number;
116
+ size?: keyof typeof SIZES;
117
+ /** Nome para o leitor de tela, como "Nota do atendimento". */
118
+ label?: string;
119
+ /** Estrelas ou cinco carinhas com nome, para pesquisa de satisfação. Carinhas são sempre 5. */
120
+ variant?: 'stars' | 'faces';
121
+ className?: string;
122
+ }) {
123
+ const [hover, setHover] = useState<number | null>(null);
124
+ const shown = hover ?? value;
125
+ const stars = Array.from({ length: max }, (_, i) => i + 1);
126
+ if (variant === 'faces')
127
+ return (
128
+ <FacesRating
129
+ value={value}
130
+ onValueChange={onValueChange}
131
+ label={label}
132
+ className={className}
133
+ />
134
+ );
135
+ const star = (n: number) => {
136
+ const fill = Math.max(0, Math.min(1, shown - (n - 1)));
137
+ return (
138
+ <span className="relative inline-flex">
139
+ <StarIcon fill="currentColor" className={cn(SIZES[size], 'text-border-strong')} />
140
+ {fill > 0 && (
141
+ <span className="absolute inset-0 overflow-hidden" style={{ width: `${fill * 100}%` }}>
142
+ <StarIcon fill="currentColor" className={cn(SIZES[size], 'text-warning')} />
143
+ </span>
144
+ )}
145
+ </span>
146
+ );
147
+ };
148
+
149
+ if (!onValueChange) {
150
+ return (
151
+ <span
152
+ data-slot="rating"
153
+ role="img"
154
+ aria-label={`${label}: ${value.toLocaleString('pt-BR')} de ${max}`}
155
+ className={cn('inline-flex items-center gap-0.5', className)}
156
+ >
157
+ {stars.map((n) => (
158
+ <span key={n}>{star(n)}</span>
159
+ ))}
160
+ </span>
161
+ );
162
+ }
163
+
164
+ return (
165
+ <span
166
+ data-slot="rating"
167
+ role="radiogroup"
168
+ aria-label={label}
169
+ onMouseLeave={() => setHover(null)}
170
+ className={cn('inline-flex items-center gap-0.5', className)}
171
+ >
172
+ {stars.map((n) => (
173
+ <button
174
+ key={n}
175
+ type="button"
176
+ role="radio"
177
+ aria-checked={value === n}
178
+ aria-label={`${n} de ${max}`}
179
+ tabIndex={value === n || (value === 0 && n === 1) ? 0 : -1}
180
+ onMouseEnter={() => setHover(n)}
181
+ onClick={() => onValueChange(n)}
182
+ onKeyDown={(e) => arrows(e, value, max, onValueChange)}
183
+ className="rounded-small outline-none focus-visible:focus-ring"
184
+ >
185
+ {star(n)}
186
+ </button>
187
+ ))}
188
+ </span>
189
+ );
190
+ }
191
+
192
+ export { Rating, RATING_LABELS };