@praxisui/stepper 1.0.0-beta.17
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/LICENSE +7 -0
- package/README.md +229 -0
- package/fesm2022/praxisui-stepper.mjs +2046 -0
- package/fesm2022/praxisui-stepper.mjs.map +1 -0
- package/index.d.ts +240 -0
- package/package.json +43 -0
package/LICENSE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
# @praxisui/stepper
|
|
2
|
+
|
|
3
|
+
## 🔰 Exemplos / Quickstart
|
|
4
|
+
|
|
5
|
+
Para ver esta biblioteca em funcionamento em uma aplicação completa, utilize o projeto de exemplo (Quickstart):
|
|
6
|
+
|
|
7
|
+
- Repositório: https://github.com/codexrodrigues/praxis-ui-quickstart
|
|
8
|
+
- O Quickstart demonstra a integração das bibliotecas `@praxisui/*` em um app Angular, incluindo instalação, configuração e uso em telas reais.
|
|
9
|
+
|
|
10
|
+
Componente stepper standalone com integração opcional ao `@praxisui/dynamic-form`, suporte a ícones Material Icons/Symbols e editor de configuração embutido.
|
|
11
|
+
|
|
12
|
+
## Instalação
|
|
13
|
+
|
|
14
|
+
Instale a biblioteca junto com as dependências pares (peer dependencies) exigidas pelo componente e pelo editor de configuração:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm i @praxisui/stepper \
|
|
18
|
+
@praxisui/core @praxisui/dynamic-form @praxisui/settings-panel \
|
|
19
|
+
@praxisui/list @praxisui/files-upload @praxisui/page-builder
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Peer dependencies (Angular v20):
|
|
23
|
+
- `@angular/core` `^20.0.0`
|
|
24
|
+
- `@angular/common` `^20.0.0`
|
|
25
|
+
- `@angular/material` `^20.0.0`
|
|
26
|
+
- `@angular/cdk` `^20.0.0`
|
|
27
|
+
- `@praxisui/core` `^0.0.1`
|
|
28
|
+
- `@praxisui/dynamic-form` `^0.0.1`
|
|
29
|
+
- `@praxisui/settings-panel` `^0.0.1`
|
|
30
|
+
- `@praxisui/list` `^0.0.1`
|
|
31
|
+
- `@praxisui/files-upload` `^0.0.1`
|
|
32
|
+
- `@praxisui/page-builder` `^0.0.1`
|
|
33
|
+
|
|
34
|
+
## Quick Start
|
|
35
|
+
|
|
36
|
+
### Uso básico
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { Component } from '@angular/core';
|
|
40
|
+
import { PraxisStepper } from '@praxisui/stepper';
|
|
41
|
+
|
|
42
|
+
@Component({
|
|
43
|
+
selector: 'app-onboarding',
|
|
44
|
+
standalone: true,
|
|
45
|
+
imports: [PraxisStepper],
|
|
46
|
+
template: `
|
|
47
|
+
<praxis-stepper [config]="config" [editModeEnabled]="true"></praxis-stepper>
|
|
48
|
+
`,
|
|
49
|
+
})
|
|
50
|
+
export class OnboardingComponent {
|
|
51
|
+
config = {
|
|
52
|
+
orientation: 'horizontal',
|
|
53
|
+
headerPosition: 'top',
|
|
54
|
+
linear: true,
|
|
55
|
+
steps: [
|
|
56
|
+
{ id: 'profile', label: 'Perfil' },
|
|
57
|
+
{ id: 'confirm', label: 'Confirmação' },
|
|
58
|
+
],
|
|
59
|
+
navigation: { nextLabel: 'Avançar', prevLabel: 'Voltar' },
|
|
60
|
+
} as const;
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Publishing the Library
|
|
65
|
+
|
|
66
|
+
Após gerar os artefatos com o Angular Package Format (APF) via `ng build @praxisui/stepper`, você pode publicar no npm:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Build de produção a partir do monorepo (recomendado)
|
|
70
|
+
cd ../../
|
|
71
|
+
npm run build:praxis-stepper
|
|
72
|
+
|
|
73
|
+
# Publicação manual (diretório de saída da lib)
|
|
74
|
+
cd dist/praxis-stepper
|
|
75
|
+
npm publish --access public
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Observação: a publicação automatizada via CI está documentada no README do workspace e publica todas as libs em `dist/` (incluindo `@praxisui/stepper`).
|
|
79
|
+
|
|
80
|
+
### Integração com Dynamic Form (por etapa)
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
import { Component } from '@angular/core';
|
|
84
|
+
import { PraxisStepper } from '@praxisui/stepper';
|
|
85
|
+
|
|
86
|
+
@Component({
|
|
87
|
+
selector: 'app-cadastro',
|
|
88
|
+
standalone: true,
|
|
89
|
+
imports: [PraxisStepper],
|
|
90
|
+
template: `<praxis-stepper [config]="config"></praxis-stepper>`,
|
|
91
|
+
})
|
|
92
|
+
export class CadastroComponent {
|
|
93
|
+
config = {
|
|
94
|
+
linear: true,
|
|
95
|
+
steps: [
|
|
96
|
+
{
|
|
97
|
+
id: 'dados',
|
|
98
|
+
label: 'Dados do Cliente',
|
|
99
|
+
form: {
|
|
100
|
+
resourcePath: 'human-resources/funcionarios',
|
|
101
|
+
mode: 'create',
|
|
102
|
+
// ou forneça FormConfig diretamente
|
|
103
|
+
// config: { sections: [...] }
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
id: 'endereco',
|
|
108
|
+
label: 'Endereço',
|
|
109
|
+
form: { resourcePath: 'enderecos', mode: 'create' },
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Validação: em modo `linear`, o avanço bloqueia quando o formulário da etapa atual é inválido. Para validação remota, forneça `(serverValidate)` ao componente.
|
|
117
|
+
|
|
118
|
+
```html
|
|
119
|
+
<praxis-stepper
|
|
120
|
+
[config]="config"
|
|
121
|
+
[serverValidate]="validateStep"
|
|
122
|
+
></praxis-stepper>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
validateStep = async ({ step, formGroup, formData }) => {
|
|
127
|
+
// Chamada remota opcional
|
|
128
|
+
const ok = await Promise.resolve(true);
|
|
129
|
+
return { ok };
|
|
130
|
+
};
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## API Surface
|
|
134
|
+
|
|
135
|
+
- Componentes: `PraxisStepper`, `PraxisStepperConfigEditor`
|
|
136
|
+
- Tipos: `StepperMetadata`, `StepConfig`, `StepOrientation`, `StepHeaderPosition`
|
|
137
|
+
- Eventos: `selectedIndexChange`, `selectionChange`, `widgetEvent`, `animationDone`
|
|
138
|
+
- Veja: `projects/praxis-stepper/src/public-api.ts`
|
|
139
|
+
|
|
140
|
+
# Praxis Stepper — Guia de Estilos e Ícones
|
|
141
|
+
|
|
142
|
+
Este guia explica como personalizar estilos (tokens) e ícones do cabeçalho do stepper em apps que consomem a lib `@praxisui/stepper`.
|
|
143
|
+
|
|
144
|
+
## Conjuntos de Ícones (Material Icons vs Material Symbols)
|
|
145
|
+
|
|
146
|
+
O Angular Material, por padrão, usa o conjunto “Material Icons” (ligature). Ícones como `repeat` funcionam imediatamente. Já ícones como `counter_1` pertencem ao “Material Symbols” e precisam de fonte + classe próprias.
|
|
147
|
+
|
|
148
|
+
### Ativar Material Symbols (Outlined)
|
|
149
|
+
|
|
150
|
+
No seu app host (ex.: `src/styles.scss` ou `projects/<app>/src/styles.scss`), adicione:
|
|
151
|
+
|
|
152
|
+
```scss
|
|
153
|
+
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0');
|
|
154
|
+
|
|
155
|
+
.material-symbols-outlined {
|
|
156
|
+
font-family: 'Material Symbols Outlined';
|
|
157
|
+
font-weight: normal;
|
|
158
|
+
font-style: normal;
|
|
159
|
+
font-size: 24px; /* tamanho padrão do ícone */
|
|
160
|
+
line-height: 1;
|
|
161
|
+
display: inline-block;
|
|
162
|
+
-webkit-font-feature-settings: 'liga';
|
|
163
|
+
-webkit-font-smoothing: antialiased;
|
|
164
|
+
font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Se preferir Rounded/Sharp, importe a família correspondente e use `.material-symbols-rounded` ou `.material-symbols-sharp`.
|
|
169
|
+
|
|
170
|
+
### Selecionar o conjunto no editor do Stepper
|
|
171
|
+
|
|
172
|
+
Na aba “Aparência” do editor:
|
|
173
|
+
- Selecione “Conjunto de ícones”:
|
|
174
|
+
- “Material Icons (padrão)” para ícones clássicos (ex.: `repeat`, `looks_one`).
|
|
175
|
+
- “Material Symbols (Outlined/Rounded/Sharp)” para ícones como `counter_1`, `replace_image` etc.
|
|
176
|
+
- Escolha os ícones para estados: número, concluído, edição, erro. O preview reflete o conjunto selecionado.
|
|
177
|
+
|
|
178
|
+
O componente aplica a classe (`material-symbols-*`) quando um conjunto Symbols é escolhido, exibindo corretamente os nomes selecionados.
|
|
179
|
+
|
|
180
|
+
## Tokens de Estilo com `mat.stepper-overrides`
|
|
181
|
+
|
|
182
|
+
Para personalizações visuais (cores, tipografia, densidade), use os tokens do Angular Material. No editor, a aba “Aparência” permite editar tokens e copia um snippet SCSS pronto:
|
|
183
|
+
|
|
184
|
+
```scss
|
|
185
|
+
:root {
|
|
186
|
+
@include mat.stepper-overrides((
|
|
187
|
+
container-color: var(--md-sys-color-surface),
|
|
188
|
+
header-label-text-color: var(--md-sys-color-on-surface),
|
|
189
|
+
header-height: 48px,
|
|
190
|
+
));
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Cole o snippet no arquivo de tema do seu app. Você pode trocar `:root` por uma classe para escopo local.
|
|
195
|
+
|
|
196
|
+
## Dicas de Uso
|
|
197
|
+
|
|
198
|
+
- Altura do cabeçalho / Tamanho do texto / Peso do texto: edite pelos campos rápidos — o editor converte automaticamente para tokens (`header-height`, `header-label-text-size`, `header-label-text-weight`).
|
|
199
|
+
- Ícones pelo site do Google: copie o nome do ícone em https://fonts.google.com/icons e cole no picker. Não é possível capturar automaticamente a seleção do site.
|
|
200
|
+
- Em Material Symbols, nomes como `counter_1`, `replace_image` exigem que o conjunto esteja corretamente importado e selecionado no editor.
|
|
201
|
+
|
|
202
|
+
## Exemplo Mínimo de Configuração
|
|
203
|
+
|
|
204
|
+
```ts
|
|
205
|
+
config = {
|
|
206
|
+
orientation: 'horizontal',
|
|
207
|
+
headerPosition: 'top',
|
|
208
|
+
steps: [
|
|
209
|
+
{ id: 's1', label: 'Dados' },
|
|
210
|
+
{ id: 's2', label: 'Confirmação' },
|
|
211
|
+
],
|
|
212
|
+
appearance: {
|
|
213
|
+
iconsSet: 'material-symbols-outlined',
|
|
214
|
+
icons: { number: 'counter_1', done: 'check', edit: 'edit', error: 'error' },
|
|
215
|
+
tokens: { 'header-height': '48px' },
|
|
216
|
+
},
|
|
217
|
+
};
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Com isso, os ícones e estilos do cabeçalho do stepper serão aplicados como esperado.
|
|
221
|
+
|
|
222
|
+
## Compatibilidade
|
|
223
|
+
|
|
224
|
+
- `@praxisui/stepper` `0.0.x` → Angular `20.x`
|
|
225
|
+
- Formato de módulo: `ESM2022`
|
|
226
|
+
|
|
227
|
+
## Licença
|
|
228
|
+
|
|
229
|
+
Apache-2.0 – veja o `LICENSE` empacotado com esta biblioteca ou o arquivo `LICENSE` na raiz do repositório.
|