@wellingtonhlc/shared-ui 0.0.3 → 0.0.4

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,164 @@
1
+ # EloDesk CRM Shared UI
2
+
3
+ Pacote de componentes visuais genericos usados pelos frontends `EloDesk.CRM` e `EloDesk.CRM.Portal`.
4
+
5
+ O objetivo deste pacote e concentrar componentes base, tokens, presets e helpers de UI reutilizaveis, sem regras de negocio de dominio.
6
+
7
+ ## Pacote
8
+
9
+ ```bash
10
+ npm install @wellingtonhlc/shared-ui
11
+ ```
12
+
13
+ Uso basico:
14
+
15
+ ```tsx
16
+ import { Button, Card, Page, Table } from '@wellingtonhlc/shared-ui';
17
+
18
+ export function ExamplePage() {
19
+ return (
20
+ <Page.Root>
21
+ <Card.Root>
22
+ <Card.Header>
23
+ <Card.Title>Clientes</Card.Title>
24
+ <Card.Description>Consulta operacional</Card.Description>
25
+ </Card.Header>
26
+ <Card.Body>
27
+ <Button>Salvar</Button>
28
+ </Card.Body>
29
+ </Card.Root>
30
+ </Page.Root>
31
+ );
32
+ }
33
+ ```
34
+
35
+ ## Escopo
36
+
37
+ Inclua aqui apenas infraestrutura visual generica:
38
+
39
+ - componentes base de interface;
40
+ - campos de formulario reutilizaveis;
41
+ - primitives de acao;
42
+ - tokens, estilos e presets;
43
+ - helpers sem dependencia de dominio.
44
+
45
+ Nao inclua:
46
+
47
+ - services HTTP;
48
+ - rotas;
49
+ - schemas de dominio;
50
+ - permissoes;
51
+ - regras de negocio;
52
+ - componentes acoplados a `customer`, `supplier`, `item`, PDV, financeiro, estoque, licencas, suporte ou relatorios.
53
+
54
+ ## Scripts
55
+
56
+ | Comando | Uso |
57
+ |---------|-----|
58
+ | `npm run build` | Compila TypeScript e copia assets para `dist`. |
59
+ | `npm run prepack` | Executado automaticamente antes de empacotar/publicar. |
60
+ | `npm run storybook` | Sobe o Storybook local. |
61
+ | `npm run build-storybook` | Gera build estatico do Storybook. |
62
+
63
+ ## Exportacoes
64
+
65
+ Entrada principal:
66
+
67
+ ```tsx
68
+ import { Button, Card, Modal, Table, cn } from '@wellingtonhlc/shared-ui';
69
+ ```
70
+
71
+ Estilos:
72
+
73
+ ```tsx
74
+ import '@wellingtonhlc/shared-ui/styles.css';
75
+ ```
76
+
77
+ Preset Tailwind:
78
+
79
+ ```ts
80
+ import sharedUiPreset from '@wellingtonhlc/shared-ui/tailwind-preset';
81
+ ```
82
+
83
+ ## Componentes
84
+
85
+ Componentes disponiveis na API publica:
86
+
87
+ | Grupo | Componentes |
88
+ |-------|-------------|
89
+ | Layout | `AppShell`, `Page`, `Sidebar`, `Card`, `StatCard` |
90
+ | Acoes | `Button`, `ActionPrimitives`, `AppShellActions`, `ConfirmationDialog` |
91
+ | Feedback | `Badge`, `EmptyState`, `PageMessage`, `Tooltip`, `CopyableField` |
92
+ | Formularios | `FieldControl`, `FieldGroup`, `TextField`, `TextareaField`, `SelectField`, `DateField`, `DecimalField`, `MultiSelectField`, `PasswordInput`, `Switch`, `RadioGroup` |
93
+ | Dados | `Table`, `Pagination`, `TabsUnderlined` |
94
+ | Controle de renderizacao | `RenderIf`, `RenderCase` |
95
+ | Tema | `ThemePreferencesSelector` |
96
+
97
+ ## Padroes de implementacao
98
+
99
+ - Exporte sempre o componente e seus tipos publicos em `src/index.ts`.
100
+ - Prefira composicao por slots para componentes com partes internas (`Root`, `Header`, `Body`, `Footer`, `Actions`, etc.).
101
+ - Evite aliases antes da v1; a API deve ser definitiva sempre que possivel.
102
+ - Preserve nomes semanticos e contratos pequenos.
103
+ - Use `cn` para composicao de classes.
104
+ - Mantenha o pacote livre de regra de negocio dos consumidores.
105
+ - Rode `npm run build` antes de publicar.
106
+ - Valide pelo menos um consumidor quando a mudanca puder afetar runtime.
107
+
108
+ ## Versionamento
109
+
110
+ Este pacote segue SemVer, mesmo antes da v1:
111
+
112
+ - `patch`: correcoes internas sem alteracao de contrato.
113
+ - `minor`: novos componentes, novas props opcionais ou novas variantes compativeis.
114
+ - `major` ou `minor` com destaque pre-v1: remocao/renomeacao de API publica ou mudanca que exige migracao nos consumidores.
115
+
116
+ Tabela de historico:
117
+
118
+ | Versao | Data | Tipo | Resumo | Validacao |
119
+ |--------|------|------|--------|-----------|
120
+ | `0.0.4` | 2026-06-14 | Minor pre-v1 | Adiciona `Table.Row isInteractive` para controlar cursor de linhas interativas, com padrao `true`. | `npm run build`. |
121
+ | `0.0.3` | 2026-06-14 | Breaking pre-v1 | Define API final de `Card` por slots explicitos; remove `<Card>` chamavel, `Card.Content` e `CardContentProps`. | `npm run build`; builds de `EloDesk.CRM` e `EloDesk.CRM.Portal`. |
122
+ | `0.0.2` | 2026-06-14 | Minor pre-v1 | Publica pacote no npm publico com novos slots de `Card` ainda retrocompativeis. | `npm run build`. |
123
+ | `0.0.0` | 2026-06-14 | Inicial | Publicacao inicial do pacote `@wellingtonhlc/shared-ui`. | Build do pacote. |
124
+
125
+ Ao criar uma nova versao:
126
+
127
+ 1. Atualize `package.json`.
128
+ 2. Atualize esta tabela com versao, data, tipo, resumo e validacao.
129
+ 3. Rode `npm run build`.
130
+ 4. Publique com `npm publish`.
131
+ 5. Atualize os consumidores afetados.
132
+
133
+ ## Publicacao
134
+
135
+ Publicacao npm:
136
+
137
+ ```bash
138
+ npm run build
139
+ npm publish
140
+ ```
141
+
142
+ Quando o npm exigir OTP:
143
+
144
+ ```bash
145
+ npm publish --otp CODIGO_OTP
146
+ ```
147
+
148
+ Depois de publicar, atualize os consumidores:
149
+
150
+ ```bash
151
+ npm install @wellingtonhlc/shared-ui@^VERSAO
152
+ npm run build
153
+ ```
154
+
155
+ Se o consumidor estiver com dev server Vite em execucao, reinicie com cache limpo:
156
+
157
+ ```powershell
158
+ Remove-Item -Recurse -Force node_modules\.vite -ErrorAction SilentlyContinue
159
+ npm run dev -- --force
160
+ ```
161
+
162
+ ## Template de demanda
163
+
164
+ Use `docs/templates/novo-componente-shared-ui.md` quando solicitar um novo componente para este pacote.
@@ -5,6 +5,9 @@ interface TableRootProps extends TableHTMLAttributes<HTMLTableElement> {
5
5
  density?: 'default' | 'compact';
6
6
  wrapperClassName?: string;
7
7
  }
8
+ interface TableRowProps extends HTMLAttributes<HTMLTableRowElement> {
9
+ isInteractive?: boolean;
10
+ }
8
11
  interface TableActionProps extends ButtonHTMLAttributes<HTMLButtonElement> {
9
12
  variant?: 'default' | 'ghost' | 'danger';
10
13
  tooltip?: string;
@@ -14,7 +17,7 @@ export declare const Table: {
14
17
  Header: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLTableSectionElement> & import("react").RefAttributes<HTMLTableSectionElement>>;
15
18
  Body: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLTableSectionElement> & import("react").RefAttributes<HTMLTableSectionElement>>;
16
19
  Footer: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLTableSectionElement> & import("react").RefAttributes<HTMLTableSectionElement>>;
17
- Row: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLTableRowElement> & import("react").RefAttributes<HTMLTableRowElement>>;
20
+ Row: import("react").ForwardRefExoticComponent<TableRowProps & import("react").RefAttributes<HTMLTableRowElement>>;
18
21
  Head: import("react").ForwardRefExoticComponent<ThHTMLAttributes<HTMLTableCellElement> & import("react").RefAttributes<HTMLTableCellElement>>;
19
22
  Cell: import("react").ForwardRefExoticComponent<TdHTMLAttributes<HTMLTableCellElement> & import("react").RefAttributes<HTMLTableCellElement>>;
20
23
  ActionCell: import("react").ForwardRefExoticComponent<TdHTMLAttributes<HTMLTableCellElement> & import("react").RefAttributes<HTMLTableCellElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/components/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACtB,MAAM,OAAO,CAAC;AAIf,OAA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@ const Body = forwardRef(({ className, ...props }, ref) => _jsx("tbody", { ref: r
16
16
  Body.displayName = 'Table.Body';
17
17
  const Footer = forwardRef(({ className, ...props }, ref) => (_jsx("tfoot", { ref: ref, className: cn('border-app-border bg-background border-t font-medium', className), ...props })));
18
18
  Footer.displayName = 'Table.Footer';
19
- const Row = forwardRef(({ className, ...props }, ref) => _jsx("tr", { ref: ref, className: cn('transition-colors hover:bg-[color-mix(in_srgb,var(--brand)_5%,transparent)] last:[&>td]:border-b-0', className), ...props }));
19
+ const Row = forwardRef(({ className, isInteractive = true, ...props }, ref) => (_jsx("tr", { ref: ref, className: cn('transition-colors hover:bg-[color-mix(in_srgb,var(--brand)_5%,transparent)] last:[&>td]:border-b-0', isInteractive && 'cursor-pointer', className), ...props })));
20
20
  Row.displayName = 'Table.Row';
21
21
  const Head = forwardRef(({ className, ...props }, ref) => (_jsx("th", { ref: ref, className: cn('border-app-border bg-background-secondary sticky top-0 z-[2] whitespace-nowrap border-b px-3 py-2.5 text-left align-middle text-xs font-extrabold tracking-[0.045em] text-foreground-muted uppercase', className), ...props })));
22
22
  Head.displayName = 'Table.Head';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wellingtonhlc/shared-ui",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",