@mriqbox/ui-kit 3.6.0 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +561 -34
- package/bin/cli.js +3 -1
- package/dist/components/atoms/MriAvatar.d.ts +6 -0
- package/dist/components/atoms/MriAvatar.stories.d.ts +9 -0
- package/dist/components/atoms/mri-button-variants.d.ts +1 -1
- package/dist/components/molecules/MriAccordion.d.ts +7 -0
- package/dist/components/molecules/MriAccordion.stories.d.ts +8 -0
- package/dist/components/molecules/MriCommand.d.ts +7 -7
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +4158 -3486
- package/dist/index.umd.js +70 -54
- package/dist/style.css +1 -1
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -1,61 +1,327 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 🎨 MRI UI Kit
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-

|
|
3
|
+
> **Biblioteca oficial de componentes UI** para o ecossistema MRI - moderna, responsiva, com suporte nativo a modo escuro.
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
[](https://github.com/mri-Qbox-Brasil/mri-ui-kit/actions)
|
|
6
|
+
[](https://www.npmjs.com/package/@mriqbox/ui-kit)
|
|
7
|
+
[](https://ui.mriqbox.com.br)
|
|
8
|
+
[](https://reactjs.org/)
|
|
9
|
+
[](https://tailwindcss.com/)
|
|
7
10
|
|
|
8
|
-
|
|
11
|
+
---
|
|
9
12
|
|
|
10
|
-
##
|
|
13
|
+
## 📖 Índice
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
- [Visão Geral](#-visão-geral)
|
|
16
|
+
- [Recursos](#-recursos)
|
|
17
|
+
- [Tech Stack](#-tech-stack)
|
|
18
|
+
- [Estrutura de Arquivos](#-estrutura-de-arquivos)
|
|
19
|
+
- [Instalação](#-instalação)
|
|
20
|
+
- [Uso](#-uso)
|
|
21
|
+
- [Componentes Disponíveis](#-componentes-disponíveis)
|
|
22
|
+
- [Uso da CLI](#-uso-da-cli)
|
|
23
|
+
- [Configuração](#-configuração)
|
|
24
|
+
- [Desenvolvimento](#-desenvolvimento)
|
|
25
|
+
- [Storybook](#-storybook)
|
|
26
|
+
- [Build](#-build)
|
|
27
|
+
- [Publicação](#-publicação)
|
|
13
28
|
|
|
14
|
-
|
|
15
|
-
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 🌟 Visão Geral
|
|
32
|
+
|
|
33
|
+
**MRI UI Kit** (`@mriqbox/ui-kit`) é a biblioteca oficial de componentes para o ecossistema **MRI Qbox Brasil**. Projetada para ser moderna, responsiva e com suporte nativo a modo escuro, usa **React**, **Tailwind CSS**, **Radix UI** e segue a arquitetura **shadcn/ui**.
|
|
34
|
+
|
|
35
|
+
### Principais Benefícios
|
|
36
|
+
|
|
37
|
+
| Benefício | Descrição |
|
|
38
|
+
|---------|-------------|
|
|
39
|
+
| 🎨 **Design Moderno** | UI limpa e profissional com Tailwind CSS |
|
|
40
|
+
| 🌒 **Modo Escuro** | Suporte nativo a tema escuro via next-themes |
|
|
41
|
+
| 🧩 **Arquitetura shadcn** | Componentes copy-paste com controle total |
|
|
42
|
+
| 📦 **Pacote NPM** | Instale via npm/pnpm ou use a CLI |
|
|
43
|
+
| 📖 **Storybook** | Documentação ao vivo em [ui.mriqbox.com.br](https://ui.mriqbox.com.br) |
|
|
44
|
+
| 🎯 **Radix UI** | Primitivos acessíveis e sem estilo para componentes complexos |
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## ✨ Recursos
|
|
49
|
+
|
|
50
|
+
### Arquitetura de Componentes
|
|
51
|
+
|
|
52
|
+
Seguindo a metodologia **shadcn/ui**:
|
|
53
|
+
|
|
54
|
+
| Camada | Descrição | Exemplos |
|
|
55
|
+
|-------|-------------|---------|
|
|
56
|
+
| **Átomos** | Blocos básicos de construção | Button, Input, Badge, Spinner, Icons |
|
|
57
|
+
| **Moléculas** | Combinações de átomos | Card, Modal, Dialog, Select, DatePicker |
|
|
58
|
+
| **Organismos** | Seções complexas de UI | Sidebar, Topbar, Calendar, Table, Keyboard Visualizer |
|
|
59
|
+
|
|
60
|
+
### Recursos Técnicos
|
|
61
|
+
|
|
62
|
+
- **TypeScript** - Segurança total de tipos
|
|
63
|
+
- **Tailwind CSS** - Estilização utility-first com tema personalizado
|
|
64
|
+
- **Radix UI** - Primitivos de componentes acessíveis
|
|
65
|
+
- **Class Variance Authority** - Props de variantes type-safe
|
|
66
|
+
- **Tailwind Merge** - Merge inteligente de className
|
|
67
|
+
- **Lucide React** - Belo conjunto de ícones
|
|
68
|
+
- **Storybook** - Documentação e testes de componentes
|
|
69
|
+
- **Vite** - Ferramenta de build extremamente rápida
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 🛠️ Tech Stack
|
|
74
|
+
|
|
75
|
+
| Tecnologia | Versão | Propósito |
|
|
76
|
+
|------------|---------|---------|
|
|
77
|
+
| **React** | 18.2.0+ | Biblioteca UI |
|
|
78
|
+
| **TypeScript** | 5.2.2+ | Segurança de tipos |
|
|
79
|
+
| **Tailwind CSS** | 3.4.1+ | Estilização |
|
|
80
|
+
| **Radix UI** | 1.0+ | Primitivos acessíveis |
|
|
81
|
+
| **Vite** | 5.1.6+ | Ferramenta de build |
|
|
82
|
+
| **Storybook** | 8.6+ | Documentação |
|
|
83
|
+
| **Lucide React** | 0.344+ | Ícones |
|
|
84
|
+
| **next-themes** | 0.4.6+ | Gerenciamento de temas |
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## 📂 Estrutura de Arquivos
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
mri-ui-kit/
|
|
92
|
+
├── src/
|
|
93
|
+
│ ├── index.ts # Arquivo principal de exportação
|
|
94
|
+
│ ├── index.css # Estilos globais + Tailwind
|
|
95
|
+
│ ├── lib/
|
|
96
|
+
│ │ └── utils.ts # Funções utilitárias (cn, etc.)
|
|
97
|
+
│ ├── components/
|
|
98
|
+
│ │ ├── atoms/ # Componentes básicos
|
|
99
|
+
│ │ │ ├── MriButton.tsx
|
|
100
|
+
│ │ │ ├── MriInput.tsx
|
|
101
|
+
│ │ │ ├── MriBadge.tsx
|
|
102
|
+
│ │ │ ├── MriSpinner.tsx
|
|
103
|
+
│ │ │ ├── MriIcons.tsx
|
|
104
|
+
│ │ │ ├── MriScrollArea.tsx
|
|
105
|
+
│ │ │ └── MriStatusBadge.tsx
|
|
106
|
+
│ │ ├── molecules/ # Componentes compostos
|
|
107
|
+
│ │ │ ├── MriCard.tsx
|
|
108
|
+
│ │ │ ├── MriModal.tsx
|
|
109
|
+
│ │ │ ├── MriDialog.tsx
|
|
110
|
+
│ │ │ ├── MriSelect.tsx
|
|
111
|
+
│ │ │ ├── MriDatePicker.tsx
|
|
112
|
+
│ │ │ ├── MriTimePicker.tsx
|
|
113
|
+
│ │ │ ├── MriColorPicker.tsx
|
|
114
|
+
│ │ │ ├── MriCommand.tsx
|
|
115
|
+
│ │ │ ├── MriThemeToggle.tsx
|
|
116
|
+
│ │ │ └── ... (20+ moléculas)
|
|
117
|
+
│ │ └── organisms/ # Seções complexas de UI
|
|
118
|
+
│ │ ├── MriCalendar.tsx
|
|
119
|
+
│ │ ├── MriSidebar.tsx
|
|
120
|
+
│ │ ├── MriTopbar.tsx
|
|
121
|
+
│ │ ├── MriPageHeader.tsx
|
|
122
|
+
│ │ ├── MriTable.tsx
|
|
123
|
+
│ │ ├── MriKeyboardVisualizer.tsx
|
|
124
|
+
│ │ └── MriPlayerScreenStream.tsx
|
|
125
|
+
│ └── stories/ # Stories do Storybook
|
|
126
|
+
│ ├── Introduction.mdx
|
|
127
|
+
│ ├── Colors.mdx
|
|
128
|
+
│ └── Typography.mdx
|
|
129
|
+
├── .storybook/ # Config Storybook
|
|
130
|
+
│ ├── main.ts
|
|
131
|
+
│ ├── preview.ts
|
|
132
|
+
│ ├── manager.ts
|
|
133
|
+
│ └── theme.ts
|
|
134
|
+
├── bin/
|
|
135
|
+
│ └── cli.js # CLI para adicionar componentes
|
|
136
|
+
├── dist/ # Saída do build
|
|
137
|
+
├── tailwind.config.js # Configuração Tailwind
|
|
138
|
+
├── components.json # Config shadcn/ui
|
|
139
|
+
├── vite.config.ts # Configuração Vite
|
|
140
|
+
├── tsconfig.json # Config TypeScript
|
|
141
|
+
├── package.json # Config pacote NPM
|
|
142
|
+
└── README.md
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## 🚀 Instalação
|
|
148
|
+
|
|
149
|
+
### Opção 1: Pacote NPM (Tradicional)
|
|
150
|
+
|
|
151
|
+
Ideal se você quer componentes prontos para uso com atualizações automáticas.
|
|
16
152
|
|
|
17
153
|
```bash
|
|
154
|
+
# Usando pnpm (recomendado)
|
|
18
155
|
pnpm add @mriqbox/ui-kit
|
|
19
|
-
|
|
156
|
+
|
|
157
|
+
# Usando npm
|
|
20
158
|
npm install @mriqbox/ui-kit
|
|
159
|
+
|
|
160
|
+
# Usando yarn
|
|
161
|
+
yarn add @mriqbox/ui-kit
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Opção 2: Shadcn CLI / Copiar & Colar (Controle Total)
|
|
165
|
+
|
|
166
|
+
Ideal se você quer o código fonte do componente no seu projeto para personalização livre ("Own your UI").
|
|
167
|
+
|
|
168
|
+
Este projeto contém um arquivo `components.json`, permitindo o uso da CLI shadcn.
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
# Adicionar componente via CLI
|
|
172
|
+
npx @mriqbox/ui-kit add mri-button
|
|
173
|
+
|
|
174
|
+
# Isso baixa MriButton.tsx para:
|
|
175
|
+
# src/components/ui/MriButton.tsx (ou diretório configurado)
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Nota:** A CLI apenas baixa o arquivo do componente. Verifique se ele tem dependências em outros componentes `Mri*` e adicione-as também se necessário.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## 📦 Uso
|
|
183
|
+
|
|
184
|
+
### Uso do Pacote NPM
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
import { MriButton, MriBadge, MriCard } from '@mriqbox/ui-kit';
|
|
188
|
+
|
|
189
|
+
export default function MyComponent() {
|
|
190
|
+
return (
|
|
191
|
+
<MriCard>
|
|
192
|
+
<h1>Hello World</h1>
|
|
193
|
+
<MriBadge variant="success">Ativo</MriBadge>
|
|
194
|
+
<MriButton onClick={() => alert('Clicado!')}>
|
|
195
|
+
Clique aqui
|
|
196
|
+
</MriButton>
|
|
197
|
+
</MriCard>
|
|
198
|
+
);
|
|
199
|
+
}
|
|
21
200
|
```
|
|
22
201
|
|
|
23
|
-
|
|
202
|
+
### Com CLI (Copiar & Colar)
|
|
203
|
+
|
|
204
|
+
Após adicionar componentes via CLI:
|
|
205
|
+
|
|
24
206
|
```tsx
|
|
25
|
-
|
|
207
|
+
// Importar do seu diretório local de componentes
|
|
208
|
+
import { MriButton } from '@/components/ui/MriButton';
|
|
26
209
|
|
|
27
210
|
export default function MyComponent() {
|
|
28
|
-
return <MriButton>Clique aqui</MriButton>;
|
|
211
|
+
return <MriButton variant="primary">Clique aqui</MriButton>;
|
|
29
212
|
}
|
|
30
213
|
```
|
|
31
214
|
|
|
32
|
-
|
|
33
|
-
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## 🧩 Componentes Disponíveis
|
|
218
|
+
|
|
219
|
+
### Átomos (Blocos Básicos)
|
|
34
220
|
|
|
35
|
-
|
|
221
|
+
| Componente | Descrição | Variantes |
|
|
222
|
+
|-----------|-------------|----------|
|
|
223
|
+
| `MriButton` | Componente de botão flexível | default, destructive, outline, secondary, ghost, link |
|
|
224
|
+
| `MriInput` | Campo de entrada de texto | - |
|
|
225
|
+
| `MriBadge` | Indicador pequeno de status | default, secondary, destructive, outline |
|
|
226
|
+
| `MriSpinner` | Spinner de carregamento | - |
|
|
227
|
+
| `MriIcons` | Componente de ícone (Lucide) | - |
|
|
228
|
+
| `MriScrollArea` | Área de scrollbar personalizada | - |
|
|
229
|
+
| `MriStatusBadge` | Status com indicador de ponto | online, offline, away, busy |
|
|
230
|
+
| `MriSkeleton` | Placeholder de carregamento | - |
|
|
36
231
|
|
|
37
|
-
|
|
38
|
-
|
|
232
|
+
### Moléculas (Componentes Compostos)
|
|
233
|
+
|
|
234
|
+
| Componente | Descrição | Recursos |
|
|
235
|
+
|-----------|-------------|----------|
|
|
236
|
+
| `MriCard` | Container de cartão | Header, Content, Footer |
|
|
237
|
+
| `MriModal` | Dialog modal | Overlay, portal, animações |
|
|
238
|
+
| `MriDialog` | Dialog de confirmação | Title, description, actions |
|
|
239
|
+
| `MriSelect` | Dropdown select | Single/multi select, search |
|
|
240
|
+
| `MriDatePicker` | Seleção de data | Calendar, range, presets |
|
|
241
|
+
| `MriTimePicker` | Seleção de hora | Hours, minutes, AM/PM |
|
|
242
|
+
| `MriColorPicker` | Seleção de cor | Presets, custom, hex/rgb |
|
|
243
|
+
| `MriCommand` | Command palette | Search, groups, shortcuts |
|
|
244
|
+
| `MriPopover` | Popover content | Trigger, content, positioning |
|
|
245
|
+
| `MriThemeToggle` | Toggle dark/light | Switch, icon indicators |
|
|
246
|
+
| `MriDrawer` | Painel deslizante | Left/right, responsive |
|
|
247
|
+
| `MriActionCard` | Cartão orientado a ação | Title, description, button |
|
|
248
|
+
| `MriActionModal` | Confirmação de ação | Destructive/non-destructive |
|
|
249
|
+
| `MriGridActionButton` | Botão de ação em grade | Icon, label, badge |
|
|
250
|
+
| `MriSearchInput` | Busca com limpar | Debounce, icon, clear button |
|
|
251
|
+
| `MriSectionHeader` | Cabeçalho de seção | Title, description, actions |
|
|
252
|
+
| `MriCompactSearch` | Barra de busca compacta | Filters, sort, search |
|
|
253
|
+
| `MriEconomyCard` | Cartão de exibição de economia | Icon, amount, trend |
|
|
254
|
+
| `MriPlayerVitals` | Saúde/stats do jogador | Health, armor, hunger, thirst |
|
|
255
|
+
| `MriVitalAdjustModal` | Ajustar vitais do jogador | Sliders, presets |
|
|
256
|
+
| `MriButtonGroup` | Grupo de botões | Orientation, selection |
|
|
257
|
+
| `MriCopyButton` | Copiar para clipboard | Success feedback |
|
|
258
|
+
| `MriCalendar` | Widget de calendário | Multiple views, events |
|
|
259
|
+
|
|
260
|
+
### Organismos (Seções Complexas de UI)
|
|
261
|
+
|
|
262
|
+
| Componente | Descrição | Caso de Uso |
|
|
263
|
+
|-----------|-------------|----------|
|
|
264
|
+
| `MriSidebar` | Sidebar recolhível | Navigation, groups, collapsible items |
|
|
265
|
+
| `MriTopbar` | Barra de navegação superior | Breadcrumbs, actions, user menu |
|
|
266
|
+
| `MriPageHeader` | Seção de título da página | Title, description, action buttons |
|
|
267
|
+
| `MriTable` | Tabela de dados avançada | Sorting, filtering, pagination |
|
|
268
|
+
| `MriCalendar` | Visualização completa de calendário | Events, multiple views |
|
|
269
|
+
| `MriKeyboardVisualizer` | Exibição de entrada de teclado | NUI keyboard, key bindings |
|
|
270
|
+
| `MriPlayerScreenStream` | Exibição de stream de vídeo | Compartilhamento de tela do jogador |
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## 🖥️ Uso da CLI
|
|
275
|
+
|
|
276
|
+
### Adicionando Componentes
|
|
39
277
|
|
|
40
278
|
```bash
|
|
279
|
+
# Adicionar um único componente
|
|
41
280
|
npx @mriqbox/ui-kit add mri-button
|
|
281
|
+
|
|
282
|
+
# Adicionar múltiplos componentes
|
|
283
|
+
npx @mriqbox/ui-kit add mri-button mri-input mri-card
|
|
284
|
+
|
|
285
|
+
# Adicionar com diretório personalizado (usa config components.json)
|
|
286
|
+
npx @mriqbox/ui-kit add mri-button --dest src/components/ui
|
|
42
287
|
```
|
|
43
|
-
Isso irá baixar o código fonte do `MriButton.tsx` para `src/components/ui/MriButton.tsx` (ou diretório configurado, se detectado).
|
|
44
288
|
|
|
45
|
-
|
|
289
|
+
### Componentes Disponíveis na CLI
|
|
290
|
+
|
|
291
|
+
| Nome CLI | Arquivo de Componente |
|
|
292
|
+
|----------|---------------|
|
|
293
|
+
| `mri-button` | `MriButton.tsx` |
|
|
294
|
+
| `mri-input` | `MriInput.tsx` |
|
|
295
|
+
| `mri-badge` | `MriBadge.tsx` |
|
|
296
|
+
| `mri-spinner` | `MriSpinner.tsx` |
|
|
297
|
+
| `mri-card` | `MriCard.tsx` |
|
|
298
|
+
| `mri-modal` | `MriModal.tsx` |
|
|
299
|
+
| `mri-dialog` | `MriDialog.tsx` |
|
|
300
|
+
| `mri-select` | `MriSelect.tsx` |
|
|
301
|
+
| `mri-date-picker` | `MriDatePicker.tsx` |
|
|
302
|
+
| `mri-theme-toggle` | `MriThemeToggle.tsx` |
|
|
303
|
+
| `mri-sidebar` | `MriSidebar.tsx` |
|
|
304
|
+
| `mri-topbar` | `MriTopbar.tsx` |
|
|
305
|
+
| `mri-table` | `MriTable.tsx` |
|
|
306
|
+
| ... | (30+ componentes disponíveis) |
|
|
46
307
|
|
|
47
|
-
|
|
308
|
+
---
|
|
48
309
|
|
|
49
|
-
|
|
310
|
+
## ⚙️ Configuração
|
|
311
|
+
|
|
312
|
+
### Para Uso NPM
|
|
313
|
+
|
|
314
|
+
#### 1. Importar CSS Global
|
|
315
|
+
|
|
316
|
+
Adicione ao seu arquivo de entrada (ex: `main.tsx` ou `App.tsx`):
|
|
50
317
|
|
|
51
|
-
### 1. Importar CSS Global
|
|
52
|
-
Adicione no seu arquivo de entrada (ex: `main.tsx` ou `App.tsx`):
|
|
53
318
|
```tsx
|
|
54
319
|
import '@mriqbox/ui-kit/dist/style.css';
|
|
55
320
|
```
|
|
56
321
|
|
|
57
|
-
|
|
58
|
-
|
|
322
|
+
#### 2. Configurar Tailwind CSS
|
|
323
|
+
|
|
324
|
+
No seu `tailwind.config.js`, adicione o caminho da biblioteca ao `content`:
|
|
59
325
|
|
|
60
326
|
```js
|
|
61
327
|
module.exports = {
|
|
@@ -63,16 +329,277 @@ module.exports = {
|
|
|
63
329
|
"./src/**/*.{ts,tsx}",
|
|
64
330
|
"./node_modules/@mriqbox/ui-kit/dist/**/*.{js,mjs}" // <--- Adicione esta linha
|
|
65
331
|
],
|
|
66
|
-
|
|
332
|
+
theme: {
|
|
333
|
+
extend: {},
|
|
334
|
+
},
|
|
335
|
+
plugins: [require("tailwindcss-animate")],
|
|
336
|
+
};
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### components.json (para CLI)
|
|
340
|
+
|
|
341
|
+
```json
|
|
342
|
+
{
|
|
343
|
+
"$schema": "https://ui.shadcn.com/schema.json",
|
|
344
|
+
"style": "default",
|
|
345
|
+
"tsx": true,
|
|
346
|
+
"tailwind": {
|
|
347
|
+
"config": "tailwind.config.js",
|
|
348
|
+
"css": "src/index.css",
|
|
349
|
+
"baseColor": "slate",
|
|
350
|
+
"cssVariables": true
|
|
351
|
+
},
|
|
352
|
+
"aliases": {
|
|
353
|
+
"components": "@/components",
|
|
354
|
+
"utils": "@/lib/utils"
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## 💻 Desenvolvimento
|
|
362
|
+
|
|
363
|
+
### Pré-requisitos
|
|
364
|
+
|
|
365
|
+
- **Node.js** 18+
|
|
366
|
+
- **pnpm** (recomendado) ou npm
|
|
367
|
+
|
|
368
|
+
### Configuração
|
|
369
|
+
|
|
370
|
+
```bash
|
|
371
|
+
# Clonar o repositório
|
|
372
|
+
git clone https://github.com/mri-Qbox-Brasil/mri-ui-kit.git
|
|
373
|
+
cd mri-ui-kit
|
|
374
|
+
|
|
375
|
+
# Instalar dependências
|
|
376
|
+
pnpm install
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
### Scripts
|
|
380
|
+
|
|
381
|
+
| Script | Descrição |
|
|
382
|
+
|--------|-------------|
|
|
383
|
+
| `pnpm dev` | Iniciar servidor de desenvolvimento Vite |
|
|
384
|
+
| `pnpm build` | Construir biblioteca (TypeScript + Vite) |
|
|
385
|
+
| `pnpm storybook` | Iniciar servidor de desenvolvimento Storybook (porta 6006) |
|
|
386
|
+
| `pnpm build-storybook` | Construir Storybook estático |
|
|
387
|
+
| `pnpm lint` | Executar ESLint |
|
|
388
|
+
| `pnpm preview` | Visualizar build de produção |
|
|
389
|
+
|
|
390
|
+
---
|
|
391
|
+
|
|
392
|
+
## 📖 Storybook
|
|
393
|
+
|
|
394
|
+
Acesse todos os componentes disponíveis e suas propriedades:
|
|
395
|
+
|
|
396
|
+
**Storybook ao Vivo:** [https://ui.mriqbox.com.br](https://ui.mriqbox.com.br)
|
|
397
|
+
|
|
398
|
+
### Executando Localmente
|
|
399
|
+
|
|
400
|
+
```bash
|
|
401
|
+
pnpm storybook
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
Storybook abrirá em `http://localhost:6006`
|
|
405
|
+
|
|
406
|
+
### Estrutura da Story
|
|
407
|
+
|
|
408
|
+
Cada componente tem um arquivo `.stories.tsx`:
|
|
409
|
+
|
|
410
|
+
```tsx
|
|
411
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
412
|
+
import { MriButton } from './MriButton';
|
|
413
|
+
|
|
414
|
+
const meta: Meta<typeof MriButton> = {
|
|
415
|
+
title: 'Atoms/MriButton',
|
|
416
|
+
component: MriButton,
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
export default meta;
|
|
420
|
+
type Story = StoryObj<typeof MriButton>;
|
|
421
|
+
|
|
422
|
+
export const Primary: Story = {
|
|
423
|
+
args: {
|
|
424
|
+
variant: 'default',
|
|
425
|
+
children: 'Button',
|
|
426
|
+
},
|
|
427
|
+
};
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
---
|
|
431
|
+
|
|
432
|
+
## 🏗️ Build
|
|
433
|
+
|
|
434
|
+
### Construir Biblioteca
|
|
435
|
+
|
|
436
|
+
```bash
|
|
437
|
+
pnpm build
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
Saída em `dist/`:
|
|
441
|
+
|
|
442
|
+
| Arquivo | Descrição |
|
|
443
|
+
|------|-------------|
|
|
444
|
+
| `index.es.js` | Build ES module |
|
|
445
|
+
| `index.umd.js` | Build UMD |
|
|
446
|
+
| `index.d.ts` | Declarações TypeScript |
|
|
447
|
+
| `style.css` | Estilos Tailwind compilados |
|
|
448
|
+
|
|
449
|
+
### Exports do Pacote
|
|
450
|
+
|
|
451
|
+
```json
|
|
452
|
+
{
|
|
453
|
+
"main": "./dist/index.umd.js",
|
|
454
|
+
"module": "./dist/index.es.js",
|
|
455
|
+
"types": "./dist/index.d.ts",
|
|
456
|
+
"exports": {
|
|
457
|
+
".": {
|
|
458
|
+
"import": "./dist/index.es.js",
|
|
459
|
+
"require": "./dist/index.umd.js",
|
|
460
|
+
"types": "./dist/index.d.ts"
|
|
461
|
+
},
|
|
462
|
+
"./dist/style.css": "./dist/style.css"
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
---
|
|
468
|
+
|
|
469
|
+
## 🚀 Publicação
|
|
470
|
+
|
|
471
|
+
### Automatizada (Recomendado)
|
|
472
|
+
|
|
473
|
+
O projeto usa **Semantic Release** com GitHub Actions:
|
|
474
|
+
|
|
475
|
+
| Prefixo de Commit | Bump de Versão | Exemplo |
|
|
476
|
+
|---------------|--------------|---------|
|
|
477
|
+
| `fix:` | Patch (3.5.1 → 3.5.2) | `fix: correct button focus state` |
|
|
478
|
+
| `feat:` | Minor (3.5.1 → 3.6.0) | `feat: add MriDrawer component` |
|
|
479
|
+
| `feat!:` | Major (3.5.1 → 4.0.0) | `feat!: change component API` |
|
|
480
|
+
|
|
481
|
+
### Publicação Manual
|
|
482
|
+
|
|
483
|
+
```bash
|
|
484
|
+
# Login no npm
|
|
485
|
+
npm login
|
|
486
|
+
|
|
487
|
+
# Build
|
|
488
|
+
pnpm build
|
|
489
|
+
|
|
490
|
+
# Publicar (automatizado via CI/CD)
|
|
491
|
+
# OU manual:
|
|
492
|
+
npm publish --access public
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
### Atualização de Versão
|
|
496
|
+
|
|
497
|
+
O script `version` auto-atualiza o arquivo CLI:
|
|
498
|
+
|
|
499
|
+
```json
|
|
500
|
+
{
|
|
501
|
+
"scripts": {
|
|
502
|
+
"version": "node scripts/update-cli-version.js && git add bin/cli.js"
|
|
503
|
+
}
|
|
67
504
|
}
|
|
68
505
|
```
|
|
69
506
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
507
|
+
---
|
|
508
|
+
|
|
509
|
+
## 🎨 Temas
|
|
510
|
+
|
|
511
|
+
### Configuração de Tema Tailwind
|
|
512
|
+
|
|
513
|
+
```js
|
|
514
|
+
// tailwind.config.js
|
|
515
|
+
export default {
|
|
516
|
+
darkMode: ['class'],
|
|
517
|
+
theme: {
|
|
518
|
+
extend: {
|
|
519
|
+
colors: {
|
|
520
|
+
primary: {
|
|
521
|
+
DEFAULT: 'hsl(var(--primary))',
|
|
522
|
+
foreground: 'hsl(var(--primary-foreground))'
|
|
523
|
+
},
|
|
524
|
+
// ... mais cores
|
|
525
|
+
border_primary: '#373A40',
|
|
526
|
+
hover_secondary: '#5c5f66',
|
|
527
|
+
tertiary: '#2C2E33',
|
|
528
|
+
},
|
|
529
|
+
borderRadius: {
|
|
530
|
+
lg: 'var(--radius)',
|
|
531
|
+
md: 'calc(var(--radius) - 2px)',
|
|
532
|
+
sm: 'calc(var(--radius) - 4px)'
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
plugins: [require("tailwindcss-animate")]
|
|
537
|
+
}
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
### Modo Escuro
|
|
541
|
+
|
|
542
|
+
A biblioteca usa `next-themes` para gerenciamento de temas:
|
|
543
|
+
|
|
544
|
+
```tsx
|
|
545
|
+
import { ThemeProvider } from 'next-themes';
|
|
546
|
+
|
|
547
|
+
function App() {
|
|
548
|
+
return (
|
|
549
|
+
<ThemeProvider attribute="class" defaultTheme="dark">
|
|
550
|
+
<YourApp />
|
|
551
|
+
</ThemeProvider>
|
|
552
|
+
);
|
|
553
|
+
}
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
---
|
|
557
|
+
|
|
558
|
+
## 🤝 Contribuindo
|
|
559
|
+
|
|
560
|
+
1. Faça um fork do repositório
|
|
561
|
+
2. Crie sua branch de funcionalidade (`git checkout -b feature/componente-incrivel`)
|
|
562
|
+
3. Commit suas mudanças (`git commit -m 'feat: add amazing component'`)
|
|
563
|
+
4. Push para a branch (`git push origin feature/componente-incrivel`)
|
|
564
|
+
5. Abra um Pull Request
|
|
565
|
+
|
|
566
|
+
### Adicionando um Novo Componente
|
|
567
|
+
|
|
568
|
+
1. Crie o componente em `src/components/atoms/` (ou molecules/organisms)
|
|
569
|
+
2. Adicione arquivo `.stories.tsx` para Storybook
|
|
570
|
+
3. Exporte em `src/index.ts`
|
|
571
|
+
4. Atualize `bin/cli.js` com o mapeamento do componente
|
|
572
|
+
5. Teste no Storybook
|
|
573
|
+
|
|
574
|
+
---
|
|
575
|
+
|
|
576
|
+
## 📞 Suporte & Comunidade
|
|
577
|
+
|
|
578
|
+
- **Discord:** [MRI QBOX Brasil](https://discord.gg/mriqbox)
|
|
579
|
+
- **Storybook:** [ui.mriqbox.com.br](https://ui.mriqbox.com.br)
|
|
580
|
+
- **Issues:** [GitHub Issues](https://github.com/mri-Qbox-Brasil/mri-ui-kit/issues)
|
|
581
|
+
- **NPM:** [@mriqbox/ui-kit](https://www.npmjs.com/package/@mriqbox/ui-kit)
|
|
582
|
+
|
|
583
|
+
---
|
|
584
|
+
|
|
585
|
+
## 📄 Licença
|
|
586
|
+
|
|
587
|
+
Este projeto está licenciado sob a Licença MIT - veja o arquivo LICENSE para detalhes.
|
|
588
|
+
|
|
589
|
+
---
|
|
590
|
+
|
|
591
|
+
## ❤️ Créditos
|
|
592
|
+
|
|
593
|
+
Construído com:
|
|
594
|
+
- **React** + **TypeScript**
|
|
595
|
+
- **Tailwind CSS** + **Radix UI**
|
|
596
|
+
- Arquitetura **shadcn/ui**
|
|
597
|
+
- Ícones **Lucide React**
|
|
598
|
+
|
|
599
|
+
---
|
|
600
|
+
|
|
601
|
+
<div align="center">
|
|
73
602
|
|
|
74
|
-
|
|
603
|
+
**Desenvolvido com ❤️ por [MRI Brasil](https://github.com/mri-Qbox-Brasil)**
|
|
75
604
|
|
|
76
|
-
|
|
77
|
-
2. Instale dependências: `pnpm install`
|
|
78
|
-
3. Inicie o Storybook: `pnpm storybook`
|
|
605
|
+
</div>
|
package/bin/cli.js
CHANGED
|
@@ -17,6 +17,7 @@ const BASE_PREFIX = 'https://raw.githubusercontent.com/mri-Qbox-Brasil/mri-ui-ki
|
|
|
17
17
|
|
|
18
18
|
const COMPONENT_MAP = {
|
|
19
19
|
// Atoms
|
|
20
|
+
'MriAvatar': 'atoms',
|
|
20
21
|
'MriBadge': 'atoms',
|
|
21
22
|
'MriSkeleton': 'atoms',
|
|
22
23
|
'MriSpinner': 'atoms',
|
|
@@ -29,6 +30,7 @@ const COMPONENT_MAP = {
|
|
|
29
30
|
'mri-button-variants': 'atoms',
|
|
30
31
|
|
|
31
32
|
// Molecules
|
|
33
|
+
'MriAccordion': 'molecules',
|
|
32
34
|
'MriActionButton': 'molecules',
|
|
33
35
|
'MriActionDropdown': 'molecules',
|
|
34
36
|
'MriActionModal': 'molecules',
|
|
@@ -180,7 +182,7 @@ async function checkDependencies(filePath, installDir) {
|
|
|
180
182
|
program
|
|
181
183
|
.name('mri-ui')
|
|
182
184
|
.description('Add Mri UI components to your project')
|
|
183
|
-
.version('3.
|
|
185
|
+
.version('3.8.0');
|
|
184
186
|
|
|
185
187
|
program
|
|
186
188
|
.command('add <component>')
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
3
|
+
declare const MriAvatar: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
4
|
+
declare const MriAvatarImage: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarImageProps & React.RefAttributes<HTMLImageElement>, "ref"> & React.RefAttributes<HTMLImageElement>>;
|
|
5
|
+
declare const MriAvatarFallback: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
6
|
+
export { MriAvatar, MriAvatarImage, MriAvatarFallback };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { MriAvatar } from './MriAvatar';
|
|
3
|
+
|
|
4
|
+
declare const meta: Meta<typeof MriAvatar>;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const WithImage: StoryObj;
|
|
7
|
+
export declare const FallbackOnly: StoryObj;
|
|
8
|
+
export declare const Sizes: StoryObj;
|
|
9
|
+
export declare const Group: StoryObj;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const mriButtonVariants: (props?: ({
|
|
2
|
-
variant?: "
|
|
2
|
+
variant?: "link" | "default" | "secondary" | "destructive" | "outline" | "ghost" | null | undefined;
|
|
3
3
|
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
4
4
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
3
|
+
declare const MriAccordion: React.ForwardRefExoticComponent<(AccordionPrimitive.AccordionSingleProps | AccordionPrimitive.AccordionMultipleProps) & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const MriAccordionItem: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const MriAccordionTrigger: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
declare const MriAccordionContent: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export { MriAccordion, MriAccordionItem, MriAccordionTrigger, MriAccordionContent };
|