@seniorsistemas/scala-ng 1.0.0-beta.7 → 1.0.0-beta.8
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 +136 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Scala-NG
|
|
2
|
+
|
|
3
|
+
**Design System oficial da [Senior Sistemas](https://www.senior.com.br/)** — biblioteca de componentes Angular construída sobre os fundamentos visuais do Scala.
|
|
4
|
+
|
|
5
|
+
Desenvolvido e mantido pelo time **SDS (Senior Design System)**:
|
|
6
|
+
|
|
7
|
+
### Desenvolvedores responsáveis pelo Framework
|
|
8
|
+
|
|
9
|
+
Eduardo Franz · Moacir Zimermann
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## O que é
|
|
14
|
+
|
|
15
|
+
Scala-NG oferece componentes Angular prontos para uso, alinhados ao guia visual e de experiência da Senior Sistemas. A lib encapsula tokens de design (cores, tipografia, espaçamento, grid) e componentes de interface de forma consistente, acessível e fácil de integrar em qualquer produto Angular da Senior.
|
|
16
|
+
|
|
17
|
+
A arquitetura é baseada em **CSS custom properties** — todos os tokens (incluindo espaçamento, radius e tipografia) são variáveis CSS. Isso permite sobrescrita em tempo de execução para multi-tema, multi-produto e acessibilidade.
|
|
18
|
+
|
|
19
|
+
## Suporte
|
|
20
|
+
|
|
21
|
+
| Tecnologia | Versão mínima |
|
|
22
|
+
| ------------ | ------------- |
|
|
23
|
+
| Angular | >=18 |
|
|
24
|
+
| Tailwind CSS | 3.4 |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Instalação
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
ng add @seniorsistemas/scala-ng
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
O schematic cuida automaticamente de:
|
|
35
|
+
|
|
36
|
+
- Instalar **Tailwind CSS** e dependências (`postcss`, `autoprefixer`)
|
|
37
|
+
- Criar `tailwind.config.js` apontando para os tokens da lib
|
|
38
|
+
- Registrar os estilos globais no `angular.json`
|
|
39
|
+
- Adicionar as diretivas `@tailwind` no `styles.scss` principal
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Uso básico
|
|
44
|
+
|
|
45
|
+
Importe o componente diretamente no componente standalone:
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import { SdsButtonComponent } from "@seniorsistemas/scala-ng";
|
|
49
|
+
|
|
50
|
+
@Component({
|
|
51
|
+
imports: [SdsButtonComponent],
|
|
52
|
+
})
|
|
53
|
+
export class AppComponent {}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```html
|
|
57
|
+
<button sdsButton>Primary</button>
|
|
58
|
+
<button sdsButton variant="secondary">Secondary</button>
|
|
59
|
+
<button sdsButton variant="ghost" size="small">Small Ghost</button>
|
|
60
|
+
<button sdsButton [destructive]="true">Delete</button>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Temas e modos
|
|
66
|
+
|
|
67
|
+
A lib usa dois atributos HTML ortogonais no `<html>`:
|
|
68
|
+
|
|
69
|
+
- **`data-theme`** — identidade visual do produto (`"copa"`, `"alto-contraste"`, `"produto-x"`)
|
|
70
|
+
- **`data-mode`** — modo de cor (`"dark"`; ausente = light)
|
|
71
|
+
|
|
72
|
+
Use o `ThemeService` para controlá-los em Angular:
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
import { ThemeService } from "@seniorsistemas/scala-ng";
|
|
76
|
+
|
|
77
|
+
@Component({ ... })
|
|
78
|
+
export class AppComponent {
|
|
79
|
+
readonly themeService = inject(ThemeService);
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
```html
|
|
84
|
+
<!-- Alternar modo -->
|
|
85
|
+
<button (click)="themeService.toggleMode()">Toggle dark</button>
|
|
86
|
+
|
|
87
|
+
<!-- Ler estado atual -->
|
|
88
|
+
{{ themeService.mode() }}
|
|
89
|
+
<!-- 'light' | 'dark' -->
|
|
90
|
+
{{ themeService.theme() }}
|
|
91
|
+
<!-- 'produto-x' | null -->
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Para criar um tema de produto, use `createTheme`:
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
import { createTheme } from "@seniorsistemas/scala-ng";
|
|
98
|
+
|
|
99
|
+
const meuTema = createTheme("meu-produto", {
|
|
100
|
+
light: {
|
|
101
|
+
"--sds-color-background-interactive-primary": "#7c3aed",
|
|
102
|
+
},
|
|
103
|
+
dark: {
|
|
104
|
+
"--sds-color-background-interactive-primary": "#a78bfa",
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// Em ngOnInit / app startup:
|
|
109
|
+
meuTema.mount();
|
|
110
|
+
themeService.setTheme("meu-produto");
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Componentes
|
|
116
|
+
|
|
117
|
+
| Componente | Entry-point | Documentação |
|
|
118
|
+
| ---------------------------- | ------------------------------------------ | ----------------------------------------------------- |
|
|
119
|
+
| `SdsInputComponent` | `@seniorsistemas/scala-ng/input` | [README](projects/scala-ng/input/README.md) |
|
|
120
|
+
| `SdsInputValidatorComponent` | `@seniorsistemas/scala-ng/input-validator` | [README](projects/scala-ng/input-validator/README.md) |
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Documentação técnica
|
|
125
|
+
|
|
126
|
+
| Documento | Conteúdo |
|
|
127
|
+
| ---------------------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
128
|
+
| [docs/architecture.md](docs/architecture.md) | Decisões de arquitetura, sistema de tokens de 3 camadas, por que não `scala-tailwind-config` |
|
|
129
|
+
| [docs/theming.md](docs/theming.md) | API completa de `ThemeService` e `createTheme`, exemplos de multi-tema |
|
|
130
|
+
| [docs/new-component.md](docs/new-component.md) | Passo a passo para adicionar um novo componente |
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Licença
|
|
135
|
+
|
|
136
|
+
Propriedade da [Senior Sistemas S.A.](https://www.senior.com.br/) — uso interno.
|