@iclips/ui 3.0.0 → 3.1.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/DESIGN.md +246 -0
- package/README.md +4 -0
- package/dist/components/ui/primitives/badge.cjs +1 -1
- package/dist/components/ui/primitives/badge.cjs.map +1 -1
- package/dist/components/ui/primitives/badge.js +16 -13
- package/dist/components/ui/primitives/badge.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/docs/README.md +44 -0
- package/docs/acoes.md +103 -0
- package/docs/escolha.md +171 -0
- package/docs/formularios.md +137 -0
- package/docs/mensagens.md +114 -0
- package/docs/overlays.md +192 -0
- package/docs/status.md +71 -0
- package/package.json +3 -1
package/DESIGN.md
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
---
|
|
2
|
+
version: 3.0.0
|
|
3
|
+
name: iClips Design Language
|
|
4
|
+
description: The visual language of @iclips/ui 3.0.0 — one purple for action, a lot of grey for structure, and colour only where it means something, set in Inter.
|
|
5
|
+
source: "@iclips/ui 3.0.0 — tokens/*.json, src/styles/tokens.css and the components under src/components/ui"
|
|
6
|
+
scope: Colour, type, radius, buttons and surfaces. Spacing lives in tokens/spacing.json; elevation and motion live in the component styles.
|
|
7
|
+
|
|
8
|
+
colors:
|
|
9
|
+
# semantic tokens — light theme value (dark theme value in the comment)
|
|
10
|
+
background: "#FFFFFF" # dark #1A1F26
|
|
11
|
+
foreground: "#1A1F26" # dark #F2F6FA
|
|
12
|
+
card: "#FFFFFF" # dark #2F3640
|
|
13
|
+
muted: "#E9EEF5" # dark #464E59
|
|
14
|
+
muted-foreground: "#464E59" # dark #C5CDD9
|
|
15
|
+
accent: "#E9EEF5" # hover — dark #464E59
|
|
16
|
+
border: "#DAE1EB" # dark #464E59
|
|
17
|
+
input: "#DAE1EB" # dark #464E59
|
|
18
|
+
primary: "#7F26BF" # dark #DAA6FF (purple-100: passa AA sobre card/popover gray-700)
|
|
19
|
+
primary-foreground: "#FFFFFF" # dark #000000
|
|
20
|
+
secondary: "#F6E9FF" # selection — dark #420F66
|
|
21
|
+
secondary-foreground: "#420F66" # dark #DAA6FF
|
|
22
|
+
ring: "#7F26BF" # dark #BB6DF2
|
|
23
|
+
destructive: "#AB4A43"
|
|
24
|
+
success: "#427748"
|
|
25
|
+
warning: "#E4BB78" # dark #CFA066
|
|
26
|
+
info: "#315687"
|
|
27
|
+
|
|
28
|
+
typography:
|
|
29
|
+
body:
|
|
30
|
+
fontFamily: Inter
|
|
31
|
+
fontSize: 14px
|
|
32
|
+
fontWeight: 400
|
|
33
|
+
caption:
|
|
34
|
+
fontFamily: Inter
|
|
35
|
+
fontSize: 12px
|
|
36
|
+
fontWeight: 400
|
|
37
|
+
label:
|
|
38
|
+
fontFamily: Inter
|
|
39
|
+
fontSize: 14px
|
|
40
|
+
fontWeight: 500
|
|
41
|
+
button:
|
|
42
|
+
fontFamily: Inter
|
|
43
|
+
fontSize: 14px
|
|
44
|
+
fontWeight: 600
|
|
45
|
+
title:
|
|
46
|
+
fontFamily: Inter
|
|
47
|
+
fontWeight: 600
|
|
48
|
+
lineHeight: 1.2
|
|
49
|
+
|
|
50
|
+
rounded:
|
|
51
|
+
sm: 6px
|
|
52
|
+
md: 8px
|
|
53
|
+
lg: 10px
|
|
54
|
+
xl: 14px
|
|
55
|
+
full: 9999px
|
|
56
|
+
|
|
57
|
+
components:
|
|
58
|
+
button-default:
|
|
59
|
+
backgroundColor: "{colors.primary}"
|
|
60
|
+
textColor: "{colors.primary-foreground}"
|
|
61
|
+
typography: "{typography.button}"
|
|
62
|
+
rounded: "{rounded.md}"
|
|
63
|
+
button-secondary:
|
|
64
|
+
backgroundColor: "{colors.secondary}"
|
|
65
|
+
textColor: "{colors.secondary-foreground}"
|
|
66
|
+
typography: "{typography.button}"
|
|
67
|
+
rounded: "{rounded.md}"
|
|
68
|
+
button-outline:
|
|
69
|
+
backgroundColor: "{colors.background}"
|
|
70
|
+
textColor: "{colors.foreground}"
|
|
71
|
+
borderColor: "{colors.border}"
|
|
72
|
+
typography: "{typography.button}"
|
|
73
|
+
rounded: "{rounded.md}"
|
|
74
|
+
button-ghost:
|
|
75
|
+
textColor: "{colors.foreground}"
|
|
76
|
+
typography: "{typography.button}"
|
|
77
|
+
rounded: "{rounded.md}"
|
|
78
|
+
button-link:
|
|
79
|
+
textColor: "{colors.primary}"
|
|
80
|
+
typography: "{typography.button}"
|
|
81
|
+
button-destructive:
|
|
82
|
+
backgroundColor: "color-mix({colors.destructive} 10%)"
|
|
83
|
+
textColor: "{colors.destructive-emphasis}"
|
|
84
|
+
typography: "{typography.button}"
|
|
85
|
+
rounded: "{rounded.md}"
|
|
86
|
+
button-success:
|
|
87
|
+
backgroundColor: "color-mix({colors.success} 10%)"
|
|
88
|
+
textColor: "{colors.success-emphasis}"
|
|
89
|
+
typography: "{typography.button}"
|
|
90
|
+
rounded: "{rounded.md}"
|
|
91
|
+
card:
|
|
92
|
+
backgroundColor: "{colors.card}"
|
|
93
|
+
borderColor: "{colors.border}"
|
|
94
|
+
textColor: "{colors.foreground}"
|
|
95
|
+
rounded: "{rounded.xl}"
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
> **Precedência.** Este documento resume o que a `@iclips/ui` 3.0.0 entrega. A
|
|
99
|
+
> fonte de verdade são `tokens/*.json` (e o `src/styles/tokens.css` gerado) e o
|
|
100
|
+
> código dos componentes; se algo aqui divergir deles, o código vence e este
|
|
101
|
+
> arquivo está desatualizado. Os nomes em `colors.*`, `rounded.*` e
|
|
102
|
+
> `components.*` acima correspondem aos tokens semânticos e às variantes reais —
|
|
103
|
+
> no código, escreva `bg-primary`, `rounded-md`, `<Button variant="outline">`.
|
|
104
|
+
> A página Storybook `Fundamentos/Cores` mostra cada par com o contraste medido.
|
|
105
|
+
|
|
106
|
+
## Overview
|
|
107
|
+
|
|
108
|
+
**Um roxo, muito cinza, e cor só onde ela significa algo.** Roxo é ação — botão
|
|
109
|
+
primário, link, seleção, foco. Cinza é estrutura — fundo, card, borda, texto, onde
|
|
110
|
+
fica a maior parte da tela. Vermelho, verde, amarelo e azul são estado — feedback,
|
|
111
|
+
nunca decoração. Nenhuma outra cor existe na lib: só tokens semânticos viram
|
|
112
|
+
classe, e o `npm run lint` reprova cor crua.
|
|
113
|
+
|
|
114
|
+
**Key characteristics**
|
|
115
|
+
|
|
116
|
+
- Quatro camadas de cor com permissão fechada: estrutura (cinza), ação (roxo),
|
|
117
|
+
estado (feedback), categoria (só em gráfico)
|
|
118
|
+
- Uma cor de ação; a hierarquia entre ações vem do preenchimento
|
|
119
|
+
- Hover é cinza; lavanda significa selecionado
|
|
120
|
+
- Peso 600 marca ação e título; o corpo fica em 400
|
|
121
|
+
- Raios de 6 a 10px no que se clica e no que flutua; 14px nos contêineres
|
|
122
|
+
|
|
123
|
+
## Colours
|
|
124
|
+
|
|
125
|
+
Só existem tokens semânticos como classe. Os primitivos por trás deles — gray
|
|
126
|
+
50–900, purple 50–500 e 700, e o preenchimento de cada estado — são custom
|
|
127
|
+
properties de fiação, sem classe. Os valores estão no cabeçalho deste arquivo,
|
|
128
|
+
claro e escuro.
|
|
129
|
+
|
|
130
|
+
### Estrutura — neutros
|
|
131
|
+
|
|
132
|
+
| Token | Uso |
|
|
133
|
+
| --- | --- |
|
|
134
|
+
| `background` / `foreground` | canvas e texto padrão |
|
|
135
|
+
| `card`, `popover` | superfícies elevadas |
|
|
136
|
+
| `muted` / `muted-foreground` | fundo sutil e texto de apoio |
|
|
137
|
+
| `accent` | hover e realce de item de menu — cinza, sem peso |
|
|
138
|
+
| `border`, `input` | divisória e borda de campo |
|
|
139
|
+
|
|
140
|
+
### Ação — roxo, exclusivo
|
|
141
|
+
|
|
142
|
+
| Token | Uso |
|
|
143
|
+
| --- | --- |
|
|
144
|
+
| `primary` / `primary-foreground` | botão primário, link, foco, progresso |
|
|
145
|
+
| `secondary` / `secondary-foreground` | item selecionado, ação secundária |
|
|
146
|
+
| `ring` | anel de foco |
|
|
147
|
+
| `sidebar-selected` | item ativo da sidebar |
|
|
148
|
+
|
|
149
|
+
Selecionado > focado > sob o cursor: seleção em `secondary` (matiz, tinta e peso
|
|
150
|
+
500), foco em anel, hover em `accent` cinza. Fundo lavanda decorativo só em tela
|
|
151
|
+
sem lista, tabela, menu ou calendário — onde há o que selecionar, ele se lê como
|
|
152
|
+
seleção.
|
|
153
|
+
|
|
154
|
+
### Estado — feedback, nunca decoração
|
|
155
|
+
|
|
156
|
+
Estado é sempre suave: o token cru (`destructive`, `success`, `warning`,
|
|
157
|
+
`info`) nunca é fundo. A receita única é
|
|
158
|
+
`bg-<status>/10 text-<status>-emphasis border-<status>/20`, em Button e Badge de
|
|
159
|
+
estado, Alert e selo. A cor cheia fica só no ícone e na borda de campo inválido.
|
|
160
|
+
Status nunca é roxo e sempre vem com ícone ou rótulo.
|
|
161
|
+
|
|
162
|
+
### Categoria — só dados
|
|
163
|
+
|
|
164
|
+
`chart-1..8` alternam roxo e cinza em luminância, começando pelo roxo. Nunca em
|
|
165
|
+
botão, link, ícone de navegação ou fundo de seção.
|
|
166
|
+
|
|
167
|
+
## Typography
|
|
168
|
+
|
|
169
|
+
A lib não embarca fonte: o app instala **Inter**, e o `body` usa
|
|
170
|
+
`var(--font-sans)`. A lib não estiliza elementos soltos (`h1`…`h6`, `p`, `label`)
|
|
171
|
+
— só o `body` e os próprios componentes.
|
|
172
|
+
|
|
173
|
+
| Papel | Tamanho | Peso | Onde |
|
|
174
|
+
| --- | --- | --- | --- |
|
|
175
|
+
| `{typography.body}` | 14px (`text-sm`) | 400 | texto de componente, campos, menus |
|
|
176
|
+
| `{typography.caption}` | 12px (`text-xs`) | 400 | badge, ajuda, metadado |
|
|
177
|
+
| `{typography.label}` | 14px | 500 | rótulo, item selecionado |
|
|
178
|
+
| `{typography.button}` | 14px | 600 | todas as variantes do `Button` |
|
|
179
|
+
| `{typography.title}` | — | 600 | `CardTitle` e títulos de seção |
|
|
180
|
+
|
|
181
|
+
**Peso 600 significa ação ou título.** Negrito no corpo do texto não tem papel.
|
|
182
|
+
|
|
183
|
+
## Shape
|
|
184
|
+
|
|
185
|
+
Tudo deriva de `--radius` (10px).
|
|
186
|
+
|
|
187
|
+
| Token | Valor | Uso |
|
|
188
|
+
| --- | --- | --- |
|
|
189
|
+
| `{rounded.sm}` | 6px | item de menu, chips, tags |
|
|
190
|
+
| `{rounded.md}` | 8px | botão, input, popover, menu, tooltip |
|
|
191
|
+
| `{rounded.lg}` | 10px | dialog |
|
|
192
|
+
| `{rounded.xl}` | 14px | contêiner — `Card` e painéis grandes |
|
|
193
|
+
| `{rounded.full}` | 9999px | avatar, badge, indicadores |
|
|
194
|
+
|
|
195
|
+
Quanto maior a superfície, maior o raio; não há botão em pílula.
|
|
196
|
+
|
|
197
|
+
## Buttons
|
|
198
|
+
|
|
199
|
+
Sete variantes, todas em `{typography.button}` e `{rounded.md}`, com altura de
|
|
200
|
+
32 (`sm`), 36 (`default`) ou 40px (`lg`); `icon` é 36×36.
|
|
201
|
+
|
|
202
|
+
- **`default`** — roxo cheio. A ação principal da tela; uma por tela.
|
|
203
|
+
- **`secondary`** — lavanda com texto roxo. Ação secundária.
|
|
204
|
+
- **`outline`** — fundo neutro com borda; hover cinza.
|
|
205
|
+
- **`ghost`** — sem fundo; hover cinza. Barras de ferramenta e ações densas.
|
|
206
|
+
- **`link`** — texto roxo sublinhado no hover.
|
|
207
|
+
- **`destructive`** — suave: tinta vermelha a 10%, texto `destructive-emphasis`,
|
|
208
|
+
borda leve. Excluir, ação irreversível.
|
|
209
|
+
- **`success`** — suave, mesma receita em verde. Confirmar um estado positivo.
|
|
210
|
+
|
|
211
|
+
Clique: no `default` o preenchimento vai a 90% (hover) e 80% (pressionado); no
|
|
212
|
+
`destructive`/`success` a tinta sobe de 10% para 15% (hover) e 20% (pressionado).
|
|
213
|
+
O foco é um anel de 3px em `ring`.
|
|
214
|
+
|
|
215
|
+
## Surfaces
|
|
216
|
+
|
|
217
|
+
**`card`** — `bg-card` com borda `border` e `{rounded.xl}`. O contêiner padrão;
|
|
218
|
+
a definição vem da borda, não de sombra.
|
|
219
|
+
|
|
220
|
+
Popover, menus e dialog usam `popover` e sombra; o `Tooltip` é neutro invertido
|
|
221
|
+
(`bg-foreground text-background`).
|
|
222
|
+
|
|
223
|
+
## Do and don't
|
|
224
|
+
|
|
225
|
+
**Do**
|
|
226
|
+
|
|
227
|
+
- Use roxo para a ação principal, links, seleção e foco — e só para isso.
|
|
228
|
+
- Use `text-<status>-emphasis` para texto de estado, sempre com ícone ou rótulo.
|
|
229
|
+
- Use no máximo dois fundos por tela: `muted` e `background`; o terceiro, quando
|
|
230
|
+
existir, é `secondary`.
|
|
231
|
+
- Mantenha um botão `default` por tela; o segundo vira `secondary` ou `outline`.
|
|
232
|
+
|
|
233
|
+
**Don't**
|
|
234
|
+
|
|
235
|
+
- Não escreva cor crua (`bg-gray-100`, `text-purple-600`): ela não gera CSS e o
|
|
236
|
+
lint reprova. Use o token semântico.
|
|
237
|
+
- Não pinte fundo de seção com cor de estado — o badge carrega o estado, não o card.
|
|
238
|
+
- Não use cor de gráfico (`chart-N`) fora de dados.
|
|
239
|
+
- Não use negrito para dar ênfase no corpo do texto.
|
|
240
|
+
|
|
241
|
+
## Scope and limits
|
|
242
|
+
|
|
243
|
+
Este arquivo cobre **cor, tipo, raio, botões e superfícies** da lib. Espaçamento
|
|
244
|
+
está em `tokens/spacing.json`; elevação e movimento, nos estilos dos
|
|
245
|
+
componentes. A régua de cada componente (anatomia, variantes, acessibilidade)
|
|
246
|
+
está em `src/components/ui/AGENTS.md`.
|
package/README.md
CHANGED
|
@@ -17,6 +17,10 @@ import { Button, Dialog } from "@iclips/ui";
|
|
|
17
17
|
import { DocumentEditor } from "@iclips/ui/editor";
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
+
**Para agentes de IA (e para quem monta tela):** o guia de uso — qual componente
|
|
21
|
+
em cada situação, com código pronto — vem no pacote, na versão instalada, em
|
|
22
|
+
`node_modules/@iclips/ui/docs/`. Comece por `docs/README.md`.
|
|
23
|
+
|
|
20
24
|
O JS já é tree-shakeable (um módulo por componente). Falta só o CSS — dois modos:
|
|
21
25
|
|
|
22
26
|
### Modo A — CSS pré-compilado (qualquer stack, sem Tailwind)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),b=require("react"),f=require("@radix-ui/react-slot"),v=require("class-variance-authority"),p=require("../utils.cjs");function m(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const x=m(b),o=v.cva("inline-flex items-center justify-center rounded-full border font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-destructive/20 bg-destructive/10 text-destructive-emphasis [a&]:hover:bg-destructive/15 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",success:"border-success/20 bg-success/10 text-success-emphasis [a&]:hover:bg-success/15 focus-visible:ring-success/20 dark:focus-visible:ring-success/40",warning:"border-warning/20 bg-warning/10 text-warning-emphasis [a&]:hover:bg-warning/15 focus-visible:ring-warning/20 dark:focus-visible:ring-warning/40",info:"border-info/20 bg-info/10 text-info-emphasis [a&]:hover:bg-info/15 focus-visible:ring-info/20 dark:focus-visible:ring-info/40",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",muted:"border-transparent bg-muted text-foreground/70 [a&]:hover:bg-muted/80"},size:{default:"px-2 py-0.5 text-xs",xs:"px-2 py-px text-[9px] uppercase tracking-wide"},dashed:{true:"border-dashed",false:""}},defaultVariants:{variant:"default",size:"default",dashed:!1}}),c=x.forwardRef(({className:e,variant:t,size:r,dashed:i,dot:d,asChild:a=!1,children:n,...u},g)=>{const l=a?f.Slot:"span";return s.jsx(l,{ref:g,"data-slot":"badge",className:p.cn(o({variant:t,size:r,dashed:i}),e),...u,children:a?n:s.jsxs(s.Fragment,{children:[d&&s.jsx("span",{"aria-hidden":"true",className:"inline-block size-1.5 shrink-0 rounded-full bg-current"}),n]})})});c.displayName="Badge";exports.Badge=c;exports.badgeVariants=o;
|
|
2
2
|
//# sourceMappingURL=badge.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.cjs","sources":["../../../../src/components/ui/primitives/badge.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"../utils\";\n\nconst badgeVariants = cva(\n \"inline-flex items-center justify-center rounded-full border font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden\",\n {\n variants: {\n variant: {\n default:\n \"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90\",\n secondary:\n \"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90\",\n destructive:\n \"border-destructive/20 bg-destructive/10 text-destructive-emphasis [a&]:hover:bg-destructive/15 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40\",\n outline:\n \"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground\",\n muted:\n \"border-transparent bg-muted text-foreground/70 [a&]:hover:bg-muted/80\",\n },\n size: {\n default: \"px-2 py-0.5 text-xs\",\n xs: \"px-2 py-px text-[9px] uppercase tracking-wide\",\n },\n dashed: {\n true: \"border-dashed\",\n false: \"\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n dashed: false,\n },\n },\n);\n\nconst Badge = React.forwardRef<\n HTMLSpanElement,\n React.ComponentPropsWithoutRef<\"span\"> &\n VariantProps<typeof badgeVariants> & {\n asChild?: boolean;\n /** Exibe um indicador circular (dot) antes do conteúdo, na cor do texto. @default false */\n dot?: boolean;\n }\n>(({ className, variant, size, dashed, dot, asChild = false, children, ...props }, ref) => {\n const Comp = asChild ? Slot : \"span\";\n\n return (\n <Comp\n ref={ref}\n data-slot=\"badge\"\n className={cn(badgeVariants({ variant, size, dashed }), className)}\n {...props}\n >\n {/* asChild passa por Slot, que exige um único filho — o dot iria junto e\n quebraria React.Children.only; nesse modo o consumidor põe o dot. */}\n {
|
|
1
|
+
{"version":3,"file":"badge.cjs","sources":["../../../../src/components/ui/primitives/badge.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"../utils\";\n\nconst badgeVariants = cva(\n \"inline-flex items-center justify-center rounded-full border font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden\",\n {\n variants: {\n variant: {\n default:\n \"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90\",\n secondary:\n \"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90\",\n destructive:\n \"border-destructive/20 bg-destructive/10 text-destructive-emphasis [a&]:hover:bg-destructive/15 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40\",\n success:\n \"border-success/20 bg-success/10 text-success-emphasis [a&]:hover:bg-success/15 focus-visible:ring-success/20 dark:focus-visible:ring-success/40\",\n warning:\n \"border-warning/20 bg-warning/10 text-warning-emphasis [a&]:hover:bg-warning/15 focus-visible:ring-warning/20 dark:focus-visible:ring-warning/40\",\n info:\n \"border-info/20 bg-info/10 text-info-emphasis [a&]:hover:bg-info/15 focus-visible:ring-info/20 dark:focus-visible:ring-info/40\",\n outline:\n \"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground\",\n muted:\n \"border-transparent bg-muted text-foreground/70 [a&]:hover:bg-muted/80\",\n },\n size: {\n default: \"px-2 py-0.5 text-xs\",\n xs: \"px-2 py-px text-[9px] uppercase tracking-wide\",\n },\n dashed: {\n true: \"border-dashed\",\n false: \"\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n dashed: false,\n },\n },\n);\n\nconst Badge = React.forwardRef<\n HTMLSpanElement,\n React.ComponentPropsWithoutRef<\"span\"> &\n VariantProps<typeof badgeVariants> & {\n asChild?: boolean;\n /** Exibe um indicador circular (dot) antes do conteúdo, na cor do texto. @default false */\n dot?: boolean;\n }\n>(({ className, variant, size, dashed, dot, asChild = false, children, ...props }, ref) => {\n const Comp = asChild ? Slot : \"span\";\n\n return (\n <Comp\n ref={ref}\n data-slot=\"badge\"\n className={cn(badgeVariants({ variant, size, dashed }), className)}\n {...props}\n >\n {/* asChild passa por Slot, que exige um único filho — o dot iria junto e\n quebraria React.Children.only; nesse modo o consumidor põe o dot. */}\n {asChild ? (\n children\n ) : (\n <>\n {dot && <span aria-hidden=\"true\" className=\"inline-block size-1.5 shrink-0 rounded-full bg-current\" />}\n {children}\n </>\n )}\n </Comp>\n );\n});\nBadge.displayName = \"Badge\";\n\nexport { Badge, badgeVariants };"],"names":["badgeVariants","cva","Badge","React","className","variant","size","dashed","dot","asChild","children","props","ref","Comp","Slot","jsx","cn","jsxs","Fragment"],"mappings":"ogBAMMA,EAAgBC,EAAAA,IACpB,+XACA,CACE,SAAU,CACR,QAAS,CACP,QACE,iFACF,UACE,uFACF,YACE,0KACF,QACE,kJACF,QACE,kJACF,KACE,gIACF,QACE,yEACF,MACE,uEAAA,EAEJ,KAAM,CACJ,QAAS,sBACT,GAAI,+CAAA,EAEN,OAAQ,CACN,KAAM,gBACN,MAAO,EAAA,CACT,EAEF,gBAAiB,CACf,QAAS,UACT,KAAM,UACN,OAAQ,EAAA,CACV,CAEJ,EAEMC,EAAQC,EAAM,WAQlB,CAAC,CAAE,UAAAC,EAAW,QAAAC,EAAS,KAAAC,EAAM,OAAAC,EAAQ,IAAAC,EAAK,QAAAC,EAAU,GAAO,SAAAC,EAAU,GAAGC,CAAA,EAASC,IAAQ,CACzF,MAAMC,EAAOJ,EAAUK,EAAAA,KAAO,OAE9B,OACEC,EAAAA,IAACF,EAAA,CACC,IAAAD,EACA,YAAU,QACV,UAAWI,EAAAA,GAAGhB,EAAc,CAAE,QAAAK,EAAS,KAAAC,EAAM,OAAAC,CAAA,CAAQ,EAAGH,CAAS,EAChE,GAAGO,EAIH,SAAAF,EACCC,EAEAO,EAAAA,KAAAC,EAAAA,SAAA,CACG,SAAA,CAAAV,GAAOO,EAAAA,IAAC,OAAA,CAAK,cAAY,OAAO,UAAU,yDAAyD,EACnGL,CAAA,CAAA,CACH,CAAA,CAAA,CAIR,CAAC,EACDR,EAAM,YAAc"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as i, jsxs as u, Fragment as g } from "react/jsx-runtime";
|
|
2
2
|
import * as f from "react";
|
|
3
|
-
import { Slot as
|
|
3
|
+
import { Slot as b } from "@radix-ui/react-slot";
|
|
4
4
|
import { cva as v } from "class-variance-authority";
|
|
5
|
-
import { cn as
|
|
5
|
+
import { cn as l } from "../utils.js";
|
|
6
6
|
const p = v(
|
|
7
7
|
"inline-flex items-center justify-center rounded-full border font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
|
|
8
8
|
{
|
|
@@ -11,6 +11,9 @@ const p = v(
|
|
|
11
11
|
default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
|
12
12
|
secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
|
|
13
13
|
destructive: "border-destructive/20 bg-destructive/10 text-destructive-emphasis [a&]:hover:bg-destructive/15 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",
|
|
14
|
+
success: "border-success/20 bg-success/10 text-success-emphasis [a&]:hover:bg-success/15 focus-visible:ring-success/20 dark:focus-visible:ring-success/40",
|
|
15
|
+
warning: "border-warning/20 bg-warning/10 text-warning-emphasis [a&]:hover:bg-warning/15 focus-visible:ring-warning/20 dark:focus-visible:ring-warning/40",
|
|
16
|
+
info: "border-info/20 bg-info/10 text-info-emphasis [a&]:hover:bg-info/15 focus-visible:ring-info/20 dark:focus-visible:ring-info/40",
|
|
14
17
|
outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
|
|
15
18
|
muted: "border-transparent bg-muted text-foreground/70 [a&]:hover:bg-muted/80"
|
|
16
19
|
},
|
|
@@ -29,22 +32,22 @@ const p = v(
|
|
|
29
32
|
dashed: !1
|
|
30
33
|
}
|
|
31
34
|
}
|
|
32
|
-
),
|
|
33
|
-
e ?
|
|
35
|
+
), m = f.forwardRef(({ className: s, variant: a, size: t, dashed: n, dot: o, asChild: e = !1, children: r, ...d }, c) => /* @__PURE__ */ i(
|
|
36
|
+
e ? b : "span",
|
|
34
37
|
{
|
|
35
|
-
ref:
|
|
38
|
+
ref: c,
|
|
36
39
|
"data-slot": "badge",
|
|
37
|
-
className:
|
|
40
|
+
className: l(p({ variant: a, size: t, dashed: n }), s),
|
|
38
41
|
...d,
|
|
39
|
-
children: [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
]
|
|
42
|
+
children: e ? r : /* @__PURE__ */ u(g, { children: [
|
|
43
|
+
o && /* @__PURE__ */ i("span", { "aria-hidden": "true", className: "inline-block size-1.5 shrink-0 rounded-full bg-current" }),
|
|
44
|
+
r
|
|
45
|
+
] })
|
|
43
46
|
}
|
|
44
47
|
));
|
|
45
|
-
|
|
48
|
+
m.displayName = "Badge";
|
|
46
49
|
export {
|
|
47
|
-
|
|
50
|
+
m as Badge,
|
|
48
51
|
p as badgeVariants
|
|
49
52
|
};
|
|
50
53
|
//# sourceMappingURL=badge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.js","sources":["../../../../src/components/ui/primitives/badge.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"../utils\";\n\nconst badgeVariants = cva(\n \"inline-flex items-center justify-center rounded-full border font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden\",\n {\n variants: {\n variant: {\n default:\n \"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90\",\n secondary:\n \"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90\",\n destructive:\n \"border-destructive/20 bg-destructive/10 text-destructive-emphasis [a&]:hover:bg-destructive/15 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40\",\n outline:\n \"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground\",\n muted:\n \"border-transparent bg-muted text-foreground/70 [a&]:hover:bg-muted/80\",\n },\n size: {\n default: \"px-2 py-0.5 text-xs\",\n xs: \"px-2 py-px text-[9px] uppercase tracking-wide\",\n },\n dashed: {\n true: \"border-dashed\",\n false: \"\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n dashed: false,\n },\n },\n);\n\nconst Badge = React.forwardRef<\n HTMLSpanElement,\n React.ComponentPropsWithoutRef<\"span\"> &\n VariantProps<typeof badgeVariants> & {\n asChild?: boolean;\n /** Exibe um indicador circular (dot) antes do conteúdo, na cor do texto. @default false */\n dot?: boolean;\n }\n>(({ className, variant, size, dashed, dot, asChild = false, children, ...props }, ref) => {\n const Comp = asChild ? Slot : \"span\";\n\n return (\n <Comp\n ref={ref}\n data-slot=\"badge\"\n className={cn(badgeVariants({ variant, size, dashed }), className)}\n {...props}\n >\n {/* asChild passa por Slot, que exige um único filho — o dot iria junto e\n quebraria React.Children.only; nesse modo o consumidor põe o dot. */}\n {
|
|
1
|
+
{"version":3,"file":"badge.js","sources":["../../../../src/components/ui/primitives/badge.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"../utils\";\n\nconst badgeVariants = cva(\n \"inline-flex items-center justify-center rounded-full border font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden\",\n {\n variants: {\n variant: {\n default:\n \"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90\",\n secondary:\n \"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90\",\n destructive:\n \"border-destructive/20 bg-destructive/10 text-destructive-emphasis [a&]:hover:bg-destructive/15 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40\",\n success:\n \"border-success/20 bg-success/10 text-success-emphasis [a&]:hover:bg-success/15 focus-visible:ring-success/20 dark:focus-visible:ring-success/40\",\n warning:\n \"border-warning/20 bg-warning/10 text-warning-emphasis [a&]:hover:bg-warning/15 focus-visible:ring-warning/20 dark:focus-visible:ring-warning/40\",\n info:\n \"border-info/20 bg-info/10 text-info-emphasis [a&]:hover:bg-info/15 focus-visible:ring-info/20 dark:focus-visible:ring-info/40\",\n outline:\n \"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground\",\n muted:\n \"border-transparent bg-muted text-foreground/70 [a&]:hover:bg-muted/80\",\n },\n size: {\n default: \"px-2 py-0.5 text-xs\",\n xs: \"px-2 py-px text-[9px] uppercase tracking-wide\",\n },\n dashed: {\n true: \"border-dashed\",\n false: \"\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n dashed: false,\n },\n },\n);\n\nconst Badge = React.forwardRef<\n HTMLSpanElement,\n React.ComponentPropsWithoutRef<\"span\"> &\n VariantProps<typeof badgeVariants> & {\n asChild?: boolean;\n /** Exibe um indicador circular (dot) antes do conteúdo, na cor do texto. @default false */\n dot?: boolean;\n }\n>(({ className, variant, size, dashed, dot, asChild = false, children, ...props }, ref) => {\n const Comp = asChild ? Slot : \"span\";\n\n return (\n <Comp\n ref={ref}\n data-slot=\"badge\"\n className={cn(badgeVariants({ variant, size, dashed }), className)}\n {...props}\n >\n {/* asChild passa por Slot, que exige um único filho — o dot iria junto e\n quebraria React.Children.only; nesse modo o consumidor põe o dot. */}\n {asChild ? (\n children\n ) : (\n <>\n {dot && <span aria-hidden=\"true\" className=\"inline-block size-1.5 shrink-0 rounded-full bg-current\" />}\n {children}\n </>\n )}\n </Comp>\n );\n});\nBadge.displayName = \"Badge\";\n\nexport { Badge, badgeVariants };"],"names":["badgeVariants","cva","Badge","React","className","variant","size","dashed","dot","asChild","children","props","ref","jsx","Slot","cn","jsxs","Fragment"],"mappings":";;;;;AAMA,MAAMA,IAAgBC;AAAA,EACpB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SACE;AAAA,QACF,WACE;AAAA,QACF,aACE;AAAA,QACF,SACE;AAAA,QACF,SACE;AAAA,QACF,MACE;AAAA,QACF,SACE;AAAA,QACF,OACE;AAAA,MAAA;AAAA,MAEJ,MAAM;AAAA,QACJ,SAAS;AAAA,QACT,IAAI;AAAA,MAAA;AAAA,MAEN,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,OAAO;AAAA,MAAA;AAAA,IACT;AAAA,IAEF,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,MAAM;AAAA,MACN,QAAQ;AAAA,IAAA;AAAA,EACV;AAEJ,GAEMC,IAAQC,EAAM,WAQlB,CAAC,EAAE,WAAAC,GAAW,SAAAC,GAAS,MAAAC,GAAM,QAAAC,GAAQ,KAAAC,GAAK,SAAAC,IAAU,IAAO,UAAAC,GAAU,GAAGC,EAAA,GAASC,MAI/E,gBAAAC;AAAA,EAHWJ,IAAUK,IAAO;AAAA,EAG3B;AAAA,IACC,KAAAF;AAAA,IACA,aAAU;AAAA,IACV,WAAWG,EAAGf,EAAc,EAAE,SAAAK,GAAS,MAAAC,GAAM,QAAAC,EAAA,CAAQ,GAAGH,CAAS;AAAA,IAChE,GAAGO;AAAA,IAIH,UAAAF,IACCC,IAEA,gBAAAM,EAAAC,GAAA,EACG,UAAA;AAAA,MAAAT,KAAO,gBAAAK,EAAC,QAAA,EAAK,eAAY,QAAO,WAAU,0DAAyD;AAAA,MACnGH;AAAA,IAAA,EAAA,CACH;AAAA,EAAA;AAAA,CAIP;AACDR,EAAM,cAAc;"}
|