@acsrocha/ui 1.0.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 ADDED
@@ -0,0 +1,132 @@
1
+ # @csrocha/ui
2
+
3
+ Biblioteca de componentes React reutilizáveis por Carlos Rocha.
4
+
5
+ Construída sobre Tailwind CSS + shadcn/ui primitivos, com componentes de alto nível para sistemas de gestão.
6
+
7
+ ---
8
+
9
+ ## Instalação
10
+
11
+ ```bash
12
+ npm install @csrocha/ui
13
+ ```
14
+
15
+ ### Dependências peer obrigatórias
16
+
17
+ ```bash
18
+ npm install react react-dom framer-motion @tanstack/react-query
19
+ ```
20
+
21
+ ---
22
+
23
+ ## Configuração
24
+
25
+ ### 1. Importar o CSS do tema
26
+
27
+ No `main.tsx` ou `App.tsx` do projeto consumidor:
28
+
29
+ ```tsx
30
+ import '@csrocha/ui/theme.css'
31
+ ```
32
+
33
+ ### 2. Configurar o Tailwind (obrigatório)
34
+
35
+ No `tailwind.config.js` do projeto consumidor, adicionar o path do pacote no `content`:
36
+
37
+ ```js
38
+ content: [
39
+ './src/**/*.{js,ts,jsx,tsx}',
40
+ './node_modules/@csrocha/ui/dist/**/*.js', // ← adicionar esta linha
41
+ ],
42
+ ```
43
+
44
+ E opcionalmente usar o preset para herdar as cores e tokens:
45
+
46
+ ```js
47
+ presets: [require('@csrocha/ui/tailwind.preset')],
48
+ ```
49
+
50
+ ### 3. ThemeProvider (opcional — para customizar o tema)
51
+
52
+ ```tsx
53
+ import { ThemeProvider } from '@csrocha/ui'
54
+
55
+ <ThemeProvider theme={{ primary: '217 91% 60%' }}>
56
+ <App />
57
+ </ThemeProvider>
58
+ ```
59
+
60
+ ---
61
+
62
+ ## Uso
63
+
64
+ ```tsx
65
+ import { PageLayout, PageHeader, StatCard, DataTable, CardView, SmartFilterPanel } from '@csrocha/ui'
66
+ import { Users } from 'lucide-react'
67
+
68
+ function MinhaPage() {
69
+ return (
70
+ <PageLayout
71
+ header={
72
+ <PageHeader
73
+ title="Usuários"
74
+ icon={Users}
75
+ onRefresh={() => refetch()}
76
+ />
77
+ }
78
+ stats={[
79
+ { label: 'Total', value: 120, accentColor: 'blue' },
80
+ { label: 'Ativos', value: 98, accentColor: 'green' },
81
+ ]}
82
+ viewMode="table"
83
+ tableContent={<DataTable columns={columns} data={data} total={120} />}
84
+ />
85
+ )
86
+ }
87
+ ```
88
+
89
+ ---
90
+
91
+ ## Componentes
92
+
93
+ | Componente | Descrição |
94
+ |---|---|
95
+ | `PageLayout` | Container padrão de páginas com header + stats + conteúdo |
96
+ | `PageHeader` | Cabeçalho com título, ações, tabs e seletor de view mode |
97
+ | `StatCard` | Card de métrica com suporte a accent colors e dark mode |
98
+ | `DataTable` | Tabela completa com paginação, filtros, seleção e ordenação |
99
+ | `CardView` | Grid de cards com react-query integrado, filtros e drawer |
100
+ | `SmartFilterPanel` | Painel de filtros com badges, presets, histórico e URL sync |
101
+ | `ConfirmDialog` | Dialog de confirmação com tipos (delete, edit, create, danger) |
102
+ | `Toast` | Notificação flutuante com progress bar |
103
+ | `ThemeProvider` | Injeta variáveis CSS de tema no `:root` |
104
+
105
+ ### Primitivos UI
106
+
107
+ `Button` · `Badge` · `Card` · `Input` · `Table` · `Checkbox` · `Dialog`
108
+
109
+ ---
110
+
111
+ ## Tema
112
+
113
+ O pacote usa variáveis CSS HSL. Você pode sobrescrever qualquer token:
114
+
115
+ ```css
116
+ /* No CSS do seu projeto */
117
+ @import '@csrocha/ui/theme.css';
118
+
119
+ :root {
120
+ --primary: 217 91% 60%; /* azul em vez de verde */
121
+ --radius: 0.5rem;
122
+ }
123
+ ```
124
+
125
+ ---
126
+
127
+ ## Publicação
128
+
129
+ ```bash
130
+ npm run build:all
131
+ npm publish --access public
132
+ ```