ngx-opalbytes-components 1.26.0 → 1.27.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 +169 -0
- package/fesm2022/ngx-opalbytes-components.mjs +269 -1
- package/fesm2022/ngx-opalbytes-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/lib/shared/components/checkbox/checkbox.component.css +131 -0
- package/src/lib/shared/components/checkbox/checkbox.component.html +84 -0
- package/src/lib/shared/components/checkbox/checkbox.component.spec.ts +344 -0
- package/src/lib/shared/components/checkbox/checkbox.component.ts +258 -0
- package/src/lib/shared/components/checkbox/checkbox.stories.ts +240 -0
- package/src/lib/shared/components/index.ts +1 -0
- package/types/ngx-opalbytes-components.d.ts +72 -2
package/README.md
CHANGED
|
@@ -238,6 +238,7 @@ src/
|
|
|
238
238
|
| ├── base-input/
|
|
239
239
|
| ├── base-time-range/
|
|
240
240
|
| ├── base-toggle/
|
|
241
|
+
| ├── checkbox/
|
|
241
242
|
| ├── drop-down/
|
|
242
243
|
| ├── footer/
|
|
243
244
|
| ├── kpi/
|
|
@@ -1256,6 +1257,174 @@ compararUsuarios(a: Usuario | null, b: Usuario | null): boolean {
|
|
|
1256
1257
|
|
|
1257
1258
|
---
|
|
1258
1259
|
|
|
1260
|
+
### `CaoCheckboxComponent`
|
|
1261
|
+
|
|
1262
|
+
Um checkbox acessível e customizável no estilo do Material, com suporte a `ngModel` e formulários reativos via `ControlValueAccessor`. Possui os estados marcado, desmarcado e indeterminado, ícones customizáveis e cores configuráveis por inputs ou CSS custom properties. O visual é construído sobre um `input type="checkbox"` nativo oculto, sem depender do Angular Material em runtime.
|
|
1263
|
+
|
|
1264
|
+
**Seletor:** `<cao-checkbox>`
|
|
1265
|
+
|
|
1266
|
+
**Interface `ICaoCheckboxChangeEvent`**
|
|
1267
|
+
|
|
1268
|
+
| Propriedade | Tipo | Descrição |
|
|
1269
|
+
| --- | --- | --- |
|
|
1270
|
+
| `checked` | `boolean` | Novo estado do checkbox. |
|
|
1271
|
+
| `source` | `CaoCheckboxComponent` | Instância que originou o evento. |
|
|
1272
|
+
|
|
1273
|
+
**Atributos (Inputs)**
|
|
1274
|
+
|
|
1275
|
+
| Atributo | Tipo | Padrão | Descrição |
|
|
1276
|
+
| --- | --- | --- | --- |
|
|
1277
|
+
| `checked` | `boolean` | `false` | Estado inicial/atual do checkbox. |
|
|
1278
|
+
| `indeterminate` | `boolean` | `false` | Exibe o estado indeterminado (traço). Tem prioridade sobre `checked`. |
|
|
1279
|
+
| `isDisabled` | `boolean` | `false` | Desabilita o componente. |
|
|
1280
|
+
| `disabled` | `boolean` | `false` | Alias de `isDisabled` (mesmo comportamento). |
|
|
1281
|
+
| `required` | `boolean` | `false` | Marca o input nativo como obrigatório. |
|
|
1282
|
+
| `label` | `string` | `''` | Texto do label. Também aceita conteúdo projetado (`<ng-content>`). |
|
|
1283
|
+
| `labelPosition` | `'before' \| 'after'` | `'after'` | Posição do label em relação ao checkbox. |
|
|
1284
|
+
| `name` | `string` | `''` | Atributo `name` do input nativo. |
|
|
1285
|
+
| `id` | `string` | gerado automaticamente | Atributo `id` do input nativo. |
|
|
1286
|
+
| `ariaLabel` | `string` | `''` | Atributo `aria-label` do input. |
|
|
1287
|
+
| `ariaLabelledBy` | `string` | `''` | Atributo `aria-labelledby` do input. |
|
|
1288
|
+
| `dataCy` | `string` | `''` | Atributo para testes E2E com Cypress. |
|
|
1289
|
+
| `control` | `AbstractControl \| null` | `undefined` | O `FormControl` associado. Usado para exibir os estados de validação. |
|
|
1290
|
+
| `errorMessage` | `string` | `''` | Mensagem de erro. Quando preenchida, aplica o estilo inválido. |
|
|
1291
|
+
| `color` | `string` | `#4f46e5` | Cor de fundo/borda do checkbox marcado ou indeterminado. |
|
|
1292
|
+
| `uncheckedColor` | `string` | `#6b7280` | Cor da borda quando desmarcado. |
|
|
1293
|
+
| `disabledColor` | `string` | `#d1d5db` | Cor do checkbox desabilitado. |
|
|
1294
|
+
| `labelColor` | `string` | `#111827` | Cor do label. |
|
|
1295
|
+
| `disabledLabelColor` | `string` | `#9ca3af` | Cor do label desabilitado. |
|
|
1296
|
+
| `focusRingColor` | `string` | `rgba(79, 70, 229, 0.35)` | Cor do anel de foco. |
|
|
1297
|
+
| `size` | `string` | `20px` | Tamanho do checkbox. |
|
|
1298
|
+
| `borderRadius` | `string` | `4px` | Raio da borda do checkbox. |
|
|
1299
|
+
| `animationDuration` | `string` | `200ms` | Duração das animações. |
|
|
1300
|
+
| `checkedIcon` | `string` | `''` | Ícone exibido quando marcado. Se vazio, usa um check SVG padrão. |
|
|
1301
|
+
| `uncheckedIcon` | `string` | `''` | Ícone exibido quando desmarcado. Se vazio, nenhum ícone é exibido. |
|
|
1302
|
+
| `indeterminateIcon` | `string` | `''` | Ícone exibido no estado indeterminado. Se vazio, usa um traço SVG padrão. |
|
|
1303
|
+
| `isLucideIcon` | `boolean` | `false` | Interpreta os ícones como nomes Lucide. Quando `false`, usa `<img>` (URL ou data URI). |
|
|
1304
|
+
| `iconColor` | `string` | `''` | Cor dos ícones Lucide (fallback para todos os estados). |
|
|
1305
|
+
| `checkedIconColor` | `string` | `''` | Cor do ícone quando marcado. Se vazio, usa `iconColor`. |
|
|
1306
|
+
| `uncheckedIconColor` | `string` | `''` | Cor do ícone quando desmarcado. Se vazio, usa `iconColor`. |
|
|
1307
|
+
| `iconSize` | `string \| number` | `14` | Tamanho do ícone. Números são convertidos para `px`. |
|
|
1308
|
+
| `iconStrokeWidth` | `string \| number` | `2.5` | Espessura do traço dos ícones Lucide. |
|
|
1309
|
+
|
|
1310
|
+
**Eventos (Outputs)**
|
|
1311
|
+
|
|
1312
|
+
| Evento | Tipo | Descrição |
|
|
1313
|
+
| --- | --- | --- |
|
|
1314
|
+
| `checkedChange` | `EventEmitter<boolean>` | Emitido quando o estado marcado muda. |
|
|
1315
|
+
| `indeterminateChange` | `EventEmitter<boolean>` | Emitido quando o estado indeterminado muda. |
|
|
1316
|
+
| `checkboxChange` | `EventEmitter<ICaoCheckboxChangeEvent>` | Emitido com o novo estado e a origem. |
|
|
1317
|
+
|
|
1318
|
+
**Métodos**
|
|
1319
|
+
|
|
1320
|
+
| Método | Descrição |
|
|
1321
|
+
| --- | --- |
|
|
1322
|
+
| `toggle()` | Alterna o estado, se não estiver desabilitado. |
|
|
1323
|
+
| `setChecked(value: boolean, emit = true)` | Define o estado programaticamente e limpa `indeterminate`. Passe `false` em `emit` para não disparar os eventos. |
|
|
1324
|
+
| `setIndeterminate(value: boolean)` | Define o estado indeterminado. |
|
|
1325
|
+
| `enable()` | Habilita o componente. |
|
|
1326
|
+
| `disable()` | Desabilita o componente. |
|
|
1327
|
+
| `writeValue(value)` | Implementação de `ControlValueAccessor`. |
|
|
1328
|
+
| `setDisabledState(isDisabled)` | Implementação de `ControlValueAccessor`. |
|
|
1329
|
+
|
|
1330
|
+
**CSS Custom Properties**
|
|
1331
|
+
|
|
1332
|
+
| Propriedade | Padrão | Descrição |
|
|
1333
|
+
| --- | --- | --- |
|
|
1334
|
+
| `--cao-checkbox-color` | `#4f46e5` | Cor do checkbox marcado/indeterminado. |
|
|
1335
|
+
| `--cao-checkbox-unselected` | `#6b7280` | Cor da borda desmarcada. |
|
|
1336
|
+
| `--cao-checkbox-disabled` | `#d1d5db` | Cor do checkbox desabilitado. |
|
|
1337
|
+
| `--cao-checkbox-label` | `#111827` | Cor do label. |
|
|
1338
|
+
| `--cao-checkbox-label-disabled` | `#9ca3af` | Cor do label desabilitado. |
|
|
1339
|
+
| `--cao-checkbox-focus-ring` | `rgba(79, 70, 229, 0.35)` | Cor do anel de foco. |
|
|
1340
|
+
| `--cao-checkbox-size` | `20px` | Tamanho do checkbox. |
|
|
1341
|
+
| `--cao-checkbox-radius` | `4px` | Raio da borda. |
|
|
1342
|
+
| `--cao-checkbox-duration` | `200ms` | Duração das animações. |
|
|
1343
|
+
| `--cao-checkbox-icon-size` | `14px` | Tamanho do ícone. |
|
|
1344
|
+
| `--cao-checkbox-icon-color` | `#ffffff` | Cor do ícone. |
|
|
1345
|
+
|
|
1346
|
+
**Exemplo com `ngModel`:**
|
|
1347
|
+
|
|
1348
|
+
```html
|
|
1349
|
+
<cao-checkbox
|
|
1350
|
+
label="Aceito os termos"
|
|
1351
|
+
[(ngModel)]="aceitoTermos"
|
|
1352
|
+
(checkedChange)="onCheckedChange($event)">
|
|
1353
|
+
</cao-checkbox>
|
|
1354
|
+
```
|
|
1355
|
+
|
|
1356
|
+
**Exemplo com formulário reativo, validação e estado indeterminado:**
|
|
1357
|
+
|
|
1358
|
+
```html
|
|
1359
|
+
<cao-checkbox
|
|
1360
|
+
label="Selecionar todos"
|
|
1361
|
+
[formControl]="selecionarTodos"
|
|
1362
|
+
[indeterminate]="algunsSelecionados"
|
|
1363
|
+
[control]="selecionarTodos"
|
|
1364
|
+
errorMessage="Selecione ao menos uma opção">
|
|
1365
|
+
</cao-checkbox>
|
|
1366
|
+
```
|
|
1367
|
+
|
|
1368
|
+
```typescript
|
|
1369
|
+
selecionarTodos = new FormControl(false, { validators: Validators.requiredTrue });
|
|
1370
|
+
algunsSelecionados = false;
|
|
1371
|
+
```
|
|
1372
|
+
|
|
1373
|
+
**Exemplo com cores customizadas e label antes:**
|
|
1374
|
+
|
|
1375
|
+
```html
|
|
1376
|
+
<cao-checkbox
|
|
1377
|
+
label="Modo escuro"
|
|
1378
|
+
labelPosition="before"
|
|
1379
|
+
color="#16a34a"
|
|
1380
|
+
uncheckedColor="#94a3b8"
|
|
1381
|
+
labelColor="#166534"
|
|
1382
|
+
size="24px"
|
|
1383
|
+
borderRadius="6px">
|
|
1384
|
+
</cao-checkbox>
|
|
1385
|
+
```
|
|
1386
|
+
|
|
1387
|
+
**Exemplo com ícones Lucide:**
|
|
1388
|
+
|
|
1389
|
+
```html
|
|
1390
|
+
<cao-checkbox
|
|
1391
|
+
label="Notificações"
|
|
1392
|
+
[(ngModel)]="notificacoesAtivas"
|
|
1393
|
+
checkedIcon="check"
|
|
1394
|
+
indeterminateIcon="minus"
|
|
1395
|
+
uncheckedIcon="x"
|
|
1396
|
+
[isLucideIcon]="true"
|
|
1397
|
+
iconColor="#6b7280"
|
|
1398
|
+
checkedIconColor="#16a34a"
|
|
1399
|
+
[iconSize]="16"
|
|
1400
|
+
[iconStrokeWidth]="2.5">
|
|
1401
|
+
</cao-checkbox>
|
|
1402
|
+
```
|
|
1403
|
+
|
|
1404
|
+
**Exemplo com imagem/data URI nos ícones:**
|
|
1405
|
+
|
|
1406
|
+
```html
|
|
1407
|
+
<cao-checkbox
|
|
1408
|
+
label="Ícone customizado"
|
|
1409
|
+
[(ngModel)]="customizado"
|
|
1410
|
+
checkedIcon="assets/icone-marcado.svg"
|
|
1411
|
+
indeterminateIcon="assets/icone-indeterminado.svg"
|
|
1412
|
+
[isLucideIcon]="false"
|
|
1413
|
+
[iconSize]="12">
|
|
1414
|
+
</cao-checkbox>
|
|
1415
|
+
```
|
|
1416
|
+
|
|
1417
|
+
**Observações:**
|
|
1418
|
+
|
|
1419
|
+
- Usa um `input type="checkbox"` nativo oculto, mantendo clique no label, foco, navegação por teclado e suporte a leitores de tela.
|
|
1420
|
+
- O estado `indeterminate` tem prioridade visual sobre `checked`; ao alternar o checkbox, `indeterminate` é limpo e `indeterminateChange(false)` é emitido.
|
|
1421
|
+
- Funciona com `ngModel`, `formControlName` e `FormControl.disable()`.
|
|
1422
|
+
- Os estados `--invalid` e `--valid` são aplicados quando `control.touched` e o controle está inválido/válido; `errorMessage` também força o estilo inválido.
|
|
1423
|
+
- Para ícones Lucide, registre os ícones usados com `provideLucideIcons` (de `@lucide/angular`). Para imagens, informe uma URL ou data URI e mantenha `isLucideIcon` como `false`.
|
|
1424
|
+
- As cores e dimensões podem ser definidas por inputs ou sobrescritas via CSS custom properties.
|
|
1425
|
+
|
|
1426
|
+
---
|
|
1427
|
+
|
|
1259
1428
|
### `DropDown`
|
|
1260
1429
|
Um menu suspenso (dropdown) com busca, que funciona com `ngModel` ou `formControlName`.
|
|
1261
1430
|
|
|
@@ -2942,6 +2942,274 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
|
|
|
2942
2942
|
args: ["style"]
|
|
2943
2943
|
}] } });
|
|
2944
2944
|
|
|
2945
|
+
let nextCheckboxId = 0;
|
|
2946
|
+
class CaoCheckboxComponent {
|
|
2947
|
+
checked = false;
|
|
2948
|
+
indeterminate = false;
|
|
2949
|
+
isDisabled = false;
|
|
2950
|
+
required = false;
|
|
2951
|
+
label = "";
|
|
2952
|
+
labelPosition = "after";
|
|
2953
|
+
name = "";
|
|
2954
|
+
id = "";
|
|
2955
|
+
ariaLabel = "";
|
|
2956
|
+
ariaLabelledBy = "";
|
|
2957
|
+
dataCy = "";
|
|
2958
|
+
control;
|
|
2959
|
+
errorMessage = "";
|
|
2960
|
+
color;
|
|
2961
|
+
uncheckedColor;
|
|
2962
|
+
disabledColor;
|
|
2963
|
+
labelColor;
|
|
2964
|
+
disabledLabelColor;
|
|
2965
|
+
focusRingColor;
|
|
2966
|
+
size;
|
|
2967
|
+
borderRadius;
|
|
2968
|
+
animationDuration;
|
|
2969
|
+
checkedIcon = "";
|
|
2970
|
+
uncheckedIcon = "";
|
|
2971
|
+
indeterminateIcon = "";
|
|
2972
|
+
isLucideIcon = false;
|
|
2973
|
+
iconColor = "";
|
|
2974
|
+
checkedIconColor = "";
|
|
2975
|
+
uncheckedIconColor = "";
|
|
2976
|
+
iconSize = 14;
|
|
2977
|
+
iconStrokeWidth = 2.5;
|
|
2978
|
+
set disabled(value) {
|
|
2979
|
+
this.isDisabled = value;
|
|
2980
|
+
this.cdr.markForCheck();
|
|
2981
|
+
}
|
|
2982
|
+
get disabled() {
|
|
2983
|
+
return this.isDisabled;
|
|
2984
|
+
}
|
|
2985
|
+
checkedChange = new EventEmitter();
|
|
2986
|
+
indeterminateChange = new EventEmitter();
|
|
2987
|
+
checkboxChange = new EventEmitter();
|
|
2988
|
+
cdr = inject(ChangeDetectorRef);
|
|
2989
|
+
uid = `cao-checkbox-${nextCheckboxId++}`;
|
|
2990
|
+
controlSub;
|
|
2991
|
+
onChange = () => { };
|
|
2992
|
+
onTouched = () => { };
|
|
2993
|
+
ngOnChanges(changes) {
|
|
2994
|
+
if (changes["control"]) {
|
|
2995
|
+
this.controlSub?.unsubscribe();
|
|
2996
|
+
this.controlSub = this.control?.statusChanges.subscribe(() => this.cdr.markForCheck());
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
ngOnDestroy() {
|
|
3000
|
+
this.controlSub?.unsubscribe();
|
|
3001
|
+
}
|
|
3002
|
+
get inputId() {
|
|
3003
|
+
return this.id || this.uid;
|
|
3004
|
+
}
|
|
3005
|
+
get hasError() {
|
|
3006
|
+
return !!this.errorMessage;
|
|
3007
|
+
}
|
|
3008
|
+
get hasInvalidState() {
|
|
3009
|
+
return !!(this.control?.touched && this.control?.invalid);
|
|
3010
|
+
}
|
|
3011
|
+
get hasValidState() {
|
|
3012
|
+
return !!(this.control?.touched && this.control?.valid);
|
|
3013
|
+
}
|
|
3014
|
+
get resolvedIconColor() {
|
|
3015
|
+
if (this.indeterminate) {
|
|
3016
|
+
return this.iconColor || this.checkedIconColor;
|
|
3017
|
+
}
|
|
3018
|
+
return this.checked
|
|
3019
|
+
? this.checkedIconColor || this.iconColor
|
|
3020
|
+
: this.uncheckedIconColor || this.iconColor;
|
|
3021
|
+
}
|
|
3022
|
+
get hostStyles() {
|
|
3023
|
+
const styles = {};
|
|
3024
|
+
if (this.color) {
|
|
3025
|
+
styles["--cao-checkbox-color"] = this.color;
|
|
3026
|
+
}
|
|
3027
|
+
if (this.uncheckedColor) {
|
|
3028
|
+
styles["--cao-checkbox-unselected"] = this.uncheckedColor;
|
|
3029
|
+
}
|
|
3030
|
+
if (this.disabledColor) {
|
|
3031
|
+
styles["--cao-checkbox-disabled"] = this.disabledColor;
|
|
3032
|
+
}
|
|
3033
|
+
if (this.labelColor) {
|
|
3034
|
+
styles["--cao-checkbox-label"] = this.labelColor;
|
|
3035
|
+
}
|
|
3036
|
+
if (this.disabledLabelColor) {
|
|
3037
|
+
styles["--cao-checkbox-label-disabled"] = this.disabledLabelColor;
|
|
3038
|
+
}
|
|
3039
|
+
if (this.focusRingColor) {
|
|
3040
|
+
styles["--cao-checkbox-focus-ring"] = this.focusRingColor;
|
|
3041
|
+
}
|
|
3042
|
+
if (this.size) {
|
|
3043
|
+
styles["--cao-checkbox-size"] = this.size;
|
|
3044
|
+
}
|
|
3045
|
+
if (this.borderRadius) {
|
|
3046
|
+
styles["--cao-checkbox-radius"] = this.borderRadius;
|
|
3047
|
+
}
|
|
3048
|
+
if (this.animationDuration) {
|
|
3049
|
+
styles["--cao-checkbox-duration"] = this.animationDuration;
|
|
3050
|
+
}
|
|
3051
|
+
if (this.resolvedIconColor) {
|
|
3052
|
+
styles["--cao-checkbox-icon-color"] = this.resolvedIconColor;
|
|
3053
|
+
}
|
|
3054
|
+
styles["--cao-checkbox-icon-size"] = this.toCssLength(this.iconSize);
|
|
3055
|
+
return styles;
|
|
3056
|
+
}
|
|
3057
|
+
toggle() {
|
|
3058
|
+
if (this.isDisabled) {
|
|
3059
|
+
return;
|
|
3060
|
+
}
|
|
3061
|
+
this.setChecked(!this.checked, true);
|
|
3062
|
+
}
|
|
3063
|
+
setChecked(value, emit = true) {
|
|
3064
|
+
if (this.isDisabled) {
|
|
3065
|
+
return;
|
|
3066
|
+
}
|
|
3067
|
+
const wasIndeterminate = this.indeterminate;
|
|
3068
|
+
this.checked = value;
|
|
3069
|
+
this.indeterminate = false;
|
|
3070
|
+
this.onChange(value);
|
|
3071
|
+
if (emit) {
|
|
3072
|
+
this.checkedChange.emit(value);
|
|
3073
|
+
this.checkboxChange.emit({ checked: value, source: this });
|
|
3074
|
+
}
|
|
3075
|
+
if (wasIndeterminate) {
|
|
3076
|
+
this.indeterminateChange.emit(false);
|
|
3077
|
+
}
|
|
3078
|
+
this.cdr.markForCheck();
|
|
3079
|
+
}
|
|
3080
|
+
setIndeterminate(value) {
|
|
3081
|
+
if (this.isDisabled || this.indeterminate === value) {
|
|
3082
|
+
return;
|
|
3083
|
+
}
|
|
3084
|
+
this.indeterminate = value;
|
|
3085
|
+
this.indeterminateChange.emit(value);
|
|
3086
|
+
this.cdr.markForCheck();
|
|
3087
|
+
}
|
|
3088
|
+
enable() {
|
|
3089
|
+
this.isDisabled = false;
|
|
3090
|
+
this.cdr.markForCheck();
|
|
3091
|
+
}
|
|
3092
|
+
disable() {
|
|
3093
|
+
this.isDisabled = true;
|
|
3094
|
+
this.cdr.markForCheck();
|
|
3095
|
+
}
|
|
3096
|
+
onInputChange(event) {
|
|
3097
|
+
const target = event.target;
|
|
3098
|
+
this.setChecked(target.checked, true);
|
|
3099
|
+
}
|
|
3100
|
+
onBlur() {
|
|
3101
|
+
this.onTouched();
|
|
3102
|
+
}
|
|
3103
|
+
writeValue(value) {
|
|
3104
|
+
this.checked = !!value;
|
|
3105
|
+
this.cdr.markForCheck();
|
|
3106
|
+
}
|
|
3107
|
+
registerOnChange(fn) {
|
|
3108
|
+
this.onChange = fn;
|
|
3109
|
+
}
|
|
3110
|
+
registerOnTouched(fn) {
|
|
3111
|
+
this.onTouched = fn;
|
|
3112
|
+
}
|
|
3113
|
+
setDisabledState(isDisabled) {
|
|
3114
|
+
this.isDisabled = isDisabled;
|
|
3115
|
+
this.cdr.markForCheck();
|
|
3116
|
+
}
|
|
3117
|
+
toCssLength(value) {
|
|
3118
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
3119
|
+
}
|
|
3120
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CaoCheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3121
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: CaoCheckboxComponent, isStandalone: true, selector: "cao-checkbox", inputs: { checked: "checked", indeterminate: "indeterminate", isDisabled: "isDisabled", required: "required", label: "label", labelPosition: "labelPosition", name: "name", id: "id", ariaLabel: "ariaLabel", ariaLabelledBy: "ariaLabelledBy", dataCy: "dataCy", control: "control", errorMessage: "errorMessage", color: "color", uncheckedColor: "uncheckedColor", disabledColor: "disabledColor", labelColor: "labelColor", disabledLabelColor: "disabledLabelColor", focusRingColor: "focusRingColor", size: "size", borderRadius: "borderRadius", animationDuration: "animationDuration", checkedIcon: "checkedIcon", uncheckedIcon: "uncheckedIcon", indeterminateIcon: "indeterminateIcon", isLucideIcon: "isLucideIcon", iconColor: "iconColor", checkedIconColor: "checkedIconColor", uncheckedIconColor: "uncheckedIconColor", iconSize: "iconSize", iconStrokeWidth: "iconStrokeWidth", disabled: "disabled" }, outputs: { checkedChange: "checkedChange", indeterminateChange: "indeterminateChange", checkboxChange: "checkboxChange" }, host: { properties: { "style": "this.hostStyles" } }, providers: [
|
|
3122
|
+
{
|
|
3123
|
+
provide: NG_VALUE_ACCESSOR,
|
|
3124
|
+
useExisting: forwardRef(() => CaoCheckboxComponent),
|
|
3125
|
+
multi: true,
|
|
3126
|
+
},
|
|
3127
|
+
], usesOnChanges: true, ngImport: i0, template: "<label\n class=\"cao-checkbox\"\n [class.cao-checkbox--checked]=\"checked && !indeterminate\"\n [class.cao-checkbox--indeterminate]=\"indeterminate\"\n [class.cao-checkbox--disabled]=\"isDisabled\"\n [class.cao-checkbox--label-before]=\"labelPosition === 'before'\"\n [class.cao-checkbox--invalid]=\"hasInvalidState\"\n [class.cao-checkbox--valid]=\"hasValidState\">\n <input\n #input\n class=\"cao-checkbox__input\"\n type=\"checkbox\"\n [checked]=\"checked\"\n [indeterminate]=\"indeterminate\"\n [disabled]=\"isDisabled\"\n [required]=\"required\"\n [attr.name]=\"name || null\"\n [attr.id]=\"inputId\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy || null\"\n [attr.data-cy]=\"dataCy || null\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onBlur()\" />\n\n <span class=\"cao-checkbox__control\" aria-hidden=\"true\">\n @if (indeterminate) {\n @if (indeterminateIcon) {\n @if (isLucideIcon) {\n <svg\n class=\"cao-checkbox__icon\"\n [lucideIcon]=\"indeterminateIcon\"\n [size]=\"iconSize\"\n [strokeWidth]=\"iconStrokeWidth\"></svg>\n } @else {\n <img class=\"cao-checkbox__icon\" alt=\"\" [src]=\"indeterminateIcon\" />\n }\n } @else {\n <svg\n class=\"cao-checkbox__icon cao-checkbox__icon--default\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\">\n <line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\" />\n </svg>\n }\n } @else if (checked) {\n @if (checkedIcon) {\n @if (isLucideIcon) {\n <svg\n class=\"cao-checkbox__icon\"\n [lucideIcon]=\"checkedIcon\"\n [size]=\"iconSize\"\n [strokeWidth]=\"iconStrokeWidth\"></svg>\n } @else {\n <img class=\"cao-checkbox__icon\" alt=\"\" [src]=\"checkedIcon\" />\n }\n } @else {\n <svg\n class=\"cao-checkbox__icon cao-checkbox__icon--default\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\">\n <polyline points=\"20 6 9 17 4 12\" />\n </svg>\n }\n } @else if (uncheckedIcon) {\n @if (isLucideIcon) {\n <svg\n class=\"cao-checkbox__icon\"\n [lucideIcon]=\"uncheckedIcon\"\n [size]=\"iconSize\"\n [strokeWidth]=\"iconStrokeWidth\"></svg>\n } @else {\n <img class=\"cao-checkbox__icon\" alt=\"\" [src]=\"uncheckedIcon\" />\n }\n }\n </span>\n\n <span class=\"cao-checkbox__label\">\n @if (label) {\n {{ label }}\n } @else {\n <ng-content />\n }\n </span>\n</label>\n", styles: [":host{--cao-checkbox-color: #4f46e5;--cao-checkbox-unselected: #6b7280;--cao-checkbox-disabled: #d1d5db;--cao-checkbox-label: #111827;--cao-checkbox-label-disabled: #9ca3af;--cao-checkbox-focus-ring: rgba(79, 70, 229, .35);--cao-checkbox-size: 20px;--cao-checkbox-radius: 4px;--cao-checkbox-duration: .2s;--cao-checkbox-icon-size: 14px;--cao-checkbox-icon-color: #ffffff;display:inline-flex}.cao-checkbox{display:inline-flex;align-items:center;gap:8px;cursor:pointer;-webkit-user-select:none;user-select:none}.cao-checkbox--disabled{cursor:not-allowed}.cao-checkbox__input{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}.cao-checkbox__control{display:inline-flex;align-items:center;justify-content:center;flex:none;box-sizing:border-box;width:var(--cao-checkbox-size);height:var(--cao-checkbox-size);border:2px solid var(--cao-checkbox-unselected);border-radius:var(--cao-checkbox-radius);background-color:transparent;transition:background-color var(--cao-checkbox-duration) ease,border-color var(--cao-checkbox-duration) ease}.cao-checkbox__icon{flex:none;width:var(--cao-checkbox-icon-size);height:var(--cao-checkbox-icon-size);color:var(--cao-checkbox-icon-color);pointer-events:none;object-fit:contain}.cao-checkbox__icon--default{fill:none;stroke:currentColor;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round}.cao-checkbox__label{color:var(--cao-checkbox-label);font-size:.875rem;line-height:1.25rem}.cao-checkbox__label:empty{display:none}.cao-checkbox:not(.cao-checkbox--disabled):hover .cao-checkbox__control{border-color:var(--cao-checkbox-color)}.cao-checkbox--checked .cao-checkbox__control,.cao-checkbox--indeterminate .cao-checkbox__control{border-color:var(--cao-checkbox-color);background-color:var(--cao-checkbox-color)}.cao-checkbox--invalid .cao-checkbox__control{border-color:var(--error, #dc2626)}.cao-checkbox--valid .cao-checkbox__control{border-color:var(--success, #16a34a)}.cao-checkbox--disabled .cao-checkbox__control{border-color:var(--cao-checkbox-disabled);background-color:transparent}.cao-checkbox--disabled.cao-checkbox--checked .cao-checkbox__control,.cao-checkbox--disabled.cao-checkbox--indeterminate .cao-checkbox__control{background-color:var(--cao-checkbox-disabled)}.cao-checkbox--disabled .cao-checkbox__icon{opacity:.65}.cao-checkbox--disabled .cao-checkbox__label{color:var(--cao-checkbox-label-disabled)}.cao-checkbox__input:focus-visible+.cao-checkbox__control{box-shadow:0 0 0 3px var(--cao-checkbox-focus-ring)}.cao-checkbox--label-before .cao-checkbox__control{order:2}.cao-checkbox--label-before .cao-checkbox__label{order:1}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3128
|
+
}
|
|
3129
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CaoCheckboxComponent, decorators: [{
|
|
3130
|
+
type: Component,
|
|
3131
|
+
args: [{ selector: "cao-checkbox", standalone: true, imports: [CommonModule, LucideDynamicIcon], changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
3132
|
+
{
|
|
3133
|
+
provide: NG_VALUE_ACCESSOR,
|
|
3134
|
+
useExisting: forwardRef(() => CaoCheckboxComponent),
|
|
3135
|
+
multi: true,
|
|
3136
|
+
},
|
|
3137
|
+
], template: "<label\n class=\"cao-checkbox\"\n [class.cao-checkbox--checked]=\"checked && !indeterminate\"\n [class.cao-checkbox--indeterminate]=\"indeterminate\"\n [class.cao-checkbox--disabled]=\"isDisabled\"\n [class.cao-checkbox--label-before]=\"labelPosition === 'before'\"\n [class.cao-checkbox--invalid]=\"hasInvalidState\"\n [class.cao-checkbox--valid]=\"hasValidState\">\n <input\n #input\n class=\"cao-checkbox__input\"\n type=\"checkbox\"\n [checked]=\"checked\"\n [indeterminate]=\"indeterminate\"\n [disabled]=\"isDisabled\"\n [required]=\"required\"\n [attr.name]=\"name || null\"\n [attr.id]=\"inputId\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy || null\"\n [attr.data-cy]=\"dataCy || null\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onBlur()\" />\n\n <span class=\"cao-checkbox__control\" aria-hidden=\"true\">\n @if (indeterminate) {\n @if (indeterminateIcon) {\n @if (isLucideIcon) {\n <svg\n class=\"cao-checkbox__icon\"\n [lucideIcon]=\"indeterminateIcon\"\n [size]=\"iconSize\"\n [strokeWidth]=\"iconStrokeWidth\"></svg>\n } @else {\n <img class=\"cao-checkbox__icon\" alt=\"\" [src]=\"indeterminateIcon\" />\n }\n } @else {\n <svg\n class=\"cao-checkbox__icon cao-checkbox__icon--default\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\">\n <line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\" />\n </svg>\n }\n } @else if (checked) {\n @if (checkedIcon) {\n @if (isLucideIcon) {\n <svg\n class=\"cao-checkbox__icon\"\n [lucideIcon]=\"checkedIcon\"\n [size]=\"iconSize\"\n [strokeWidth]=\"iconStrokeWidth\"></svg>\n } @else {\n <img class=\"cao-checkbox__icon\" alt=\"\" [src]=\"checkedIcon\" />\n }\n } @else {\n <svg\n class=\"cao-checkbox__icon cao-checkbox__icon--default\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\">\n <polyline points=\"20 6 9 17 4 12\" />\n </svg>\n }\n } @else if (uncheckedIcon) {\n @if (isLucideIcon) {\n <svg\n class=\"cao-checkbox__icon\"\n [lucideIcon]=\"uncheckedIcon\"\n [size]=\"iconSize\"\n [strokeWidth]=\"iconStrokeWidth\"></svg>\n } @else {\n <img class=\"cao-checkbox__icon\" alt=\"\" [src]=\"uncheckedIcon\" />\n }\n }\n </span>\n\n <span class=\"cao-checkbox__label\">\n @if (label) {\n {{ label }}\n } @else {\n <ng-content />\n }\n </span>\n</label>\n", styles: [":host{--cao-checkbox-color: #4f46e5;--cao-checkbox-unselected: #6b7280;--cao-checkbox-disabled: #d1d5db;--cao-checkbox-label: #111827;--cao-checkbox-label-disabled: #9ca3af;--cao-checkbox-focus-ring: rgba(79, 70, 229, .35);--cao-checkbox-size: 20px;--cao-checkbox-radius: 4px;--cao-checkbox-duration: .2s;--cao-checkbox-icon-size: 14px;--cao-checkbox-icon-color: #ffffff;display:inline-flex}.cao-checkbox{display:inline-flex;align-items:center;gap:8px;cursor:pointer;-webkit-user-select:none;user-select:none}.cao-checkbox--disabled{cursor:not-allowed}.cao-checkbox__input{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}.cao-checkbox__control{display:inline-flex;align-items:center;justify-content:center;flex:none;box-sizing:border-box;width:var(--cao-checkbox-size);height:var(--cao-checkbox-size);border:2px solid var(--cao-checkbox-unselected);border-radius:var(--cao-checkbox-radius);background-color:transparent;transition:background-color var(--cao-checkbox-duration) ease,border-color var(--cao-checkbox-duration) ease}.cao-checkbox__icon{flex:none;width:var(--cao-checkbox-icon-size);height:var(--cao-checkbox-icon-size);color:var(--cao-checkbox-icon-color);pointer-events:none;object-fit:contain}.cao-checkbox__icon--default{fill:none;stroke:currentColor;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round}.cao-checkbox__label{color:var(--cao-checkbox-label);font-size:.875rem;line-height:1.25rem}.cao-checkbox__label:empty{display:none}.cao-checkbox:not(.cao-checkbox--disabled):hover .cao-checkbox__control{border-color:var(--cao-checkbox-color)}.cao-checkbox--checked .cao-checkbox__control,.cao-checkbox--indeterminate .cao-checkbox__control{border-color:var(--cao-checkbox-color);background-color:var(--cao-checkbox-color)}.cao-checkbox--invalid .cao-checkbox__control{border-color:var(--error, #dc2626)}.cao-checkbox--valid .cao-checkbox__control{border-color:var(--success, #16a34a)}.cao-checkbox--disabled .cao-checkbox__control{border-color:var(--cao-checkbox-disabled);background-color:transparent}.cao-checkbox--disabled.cao-checkbox--checked .cao-checkbox__control,.cao-checkbox--disabled.cao-checkbox--indeterminate .cao-checkbox__control{background-color:var(--cao-checkbox-disabled)}.cao-checkbox--disabled .cao-checkbox__icon{opacity:.65}.cao-checkbox--disabled .cao-checkbox__label{color:var(--cao-checkbox-label-disabled)}.cao-checkbox__input:focus-visible+.cao-checkbox__control{box-shadow:0 0 0 3px var(--cao-checkbox-focus-ring)}.cao-checkbox--label-before .cao-checkbox__control{order:2}.cao-checkbox--label-before .cao-checkbox__label{order:1}\n"] }]
|
|
3138
|
+
}], propDecorators: { checked: [{
|
|
3139
|
+
type: Input
|
|
3140
|
+
}], indeterminate: [{
|
|
3141
|
+
type: Input
|
|
3142
|
+
}], isDisabled: [{
|
|
3143
|
+
type: Input
|
|
3144
|
+
}], required: [{
|
|
3145
|
+
type: Input
|
|
3146
|
+
}], label: [{
|
|
3147
|
+
type: Input
|
|
3148
|
+
}], labelPosition: [{
|
|
3149
|
+
type: Input
|
|
3150
|
+
}], name: [{
|
|
3151
|
+
type: Input
|
|
3152
|
+
}], id: [{
|
|
3153
|
+
type: Input
|
|
3154
|
+
}], ariaLabel: [{
|
|
3155
|
+
type: Input
|
|
3156
|
+
}], ariaLabelledBy: [{
|
|
3157
|
+
type: Input
|
|
3158
|
+
}], dataCy: [{
|
|
3159
|
+
type: Input
|
|
3160
|
+
}], control: [{
|
|
3161
|
+
type: Input
|
|
3162
|
+
}], errorMessage: [{
|
|
3163
|
+
type: Input
|
|
3164
|
+
}], color: [{
|
|
3165
|
+
type: Input
|
|
3166
|
+
}], uncheckedColor: [{
|
|
3167
|
+
type: Input
|
|
3168
|
+
}], disabledColor: [{
|
|
3169
|
+
type: Input
|
|
3170
|
+
}], labelColor: [{
|
|
3171
|
+
type: Input
|
|
3172
|
+
}], disabledLabelColor: [{
|
|
3173
|
+
type: Input
|
|
3174
|
+
}], focusRingColor: [{
|
|
3175
|
+
type: Input
|
|
3176
|
+
}], size: [{
|
|
3177
|
+
type: Input
|
|
3178
|
+
}], borderRadius: [{
|
|
3179
|
+
type: Input
|
|
3180
|
+
}], animationDuration: [{
|
|
3181
|
+
type: Input
|
|
3182
|
+
}], checkedIcon: [{
|
|
3183
|
+
type: Input
|
|
3184
|
+
}], uncheckedIcon: [{
|
|
3185
|
+
type: Input
|
|
3186
|
+
}], indeterminateIcon: [{
|
|
3187
|
+
type: Input
|
|
3188
|
+
}], isLucideIcon: [{
|
|
3189
|
+
type: Input
|
|
3190
|
+
}], iconColor: [{
|
|
3191
|
+
type: Input
|
|
3192
|
+
}], checkedIconColor: [{
|
|
3193
|
+
type: Input
|
|
3194
|
+
}], uncheckedIconColor: [{
|
|
3195
|
+
type: Input
|
|
3196
|
+
}], iconSize: [{
|
|
3197
|
+
type: Input
|
|
3198
|
+
}], iconStrokeWidth: [{
|
|
3199
|
+
type: Input
|
|
3200
|
+
}], disabled: [{
|
|
3201
|
+
type: Input
|
|
3202
|
+
}], checkedChange: [{
|
|
3203
|
+
type: Output
|
|
3204
|
+
}], indeterminateChange: [{
|
|
3205
|
+
type: Output
|
|
3206
|
+
}], checkboxChange: [{
|
|
3207
|
+
type: Output
|
|
3208
|
+
}], hostStyles: [{
|
|
3209
|
+
type: HostBinding,
|
|
3210
|
+
args: ["style"]
|
|
3211
|
+
}] } });
|
|
3212
|
+
|
|
2945
3213
|
class BaseModalService {
|
|
2946
3214
|
constructor() { }
|
|
2947
3215
|
toggleModalEvent = new EventEmitter();
|
|
@@ -4243,5 +4511,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
|
|
|
4243
4511
|
* Generated bundle index. Do not edit.
|
|
4244
4512
|
*/
|
|
4245
4513
|
|
|
4246
|
-
export { BaseAlert, BaseAlertService, BaseDialog, BaseDialogService, BaseFilterTablePaginatedService, BaseFilterTableService, BaseModal, BaseModalService, BasePaginationService, BaseTable, BaseTablePaginated, BaseTableService, BaseTimeRange, CaoAutocompleteComponent, CaoBaseButtonComponent, CaoBaseIcon, CaoBaseInput, CaoBaseToggleComponent, CaoBaseWidgetComponent, CaoCardComponent, CaoDropDownComponent, CaoError, CaoFormField, CaoHint, CaoKpi, CaoRadioButtonComponent, CaoRadioGroupComponent, CaoSkeletonComponent, CaoSlideToggleComponent, CaoTabGroup, CaoTabPanel, CaoWidgetService, DEFAULT_ERROR_STATE_MATCHER, ErrorStateMatcher, Footer, LinksButton, Paginator, ShowOnDirtyErrorStateMatcher, StepComponent, StepperComponent, TablePaginatedService, TimePicker, getPtBrPaginatorIntlBasePaginated, getPtBrPaginatorIntlBaseTable };
|
|
4514
|
+
export { BaseAlert, BaseAlertService, BaseDialog, BaseDialogService, BaseFilterTablePaginatedService, BaseFilterTableService, BaseModal, BaseModalService, BasePaginationService, BaseTable, BaseTablePaginated, BaseTableService, BaseTimeRange, CaoAutocompleteComponent, CaoBaseButtonComponent, CaoBaseIcon, CaoBaseInput, CaoBaseToggleComponent, CaoBaseWidgetComponent, CaoCardComponent, CaoCheckboxComponent, CaoDropDownComponent, CaoError, CaoFormField, CaoHint, CaoKpi, CaoRadioButtonComponent, CaoRadioGroupComponent, CaoSkeletonComponent, CaoSlideToggleComponent, CaoTabGroup, CaoTabPanel, CaoWidgetService, DEFAULT_ERROR_STATE_MATCHER, ErrorStateMatcher, Footer, LinksButton, Paginator, ShowOnDirtyErrorStateMatcher, StepComponent, StepperComponent, TablePaginatedService, TimePicker, getPtBrPaginatorIntlBasePaginated, getPtBrPaginatorIntlBaseTable };
|
|
4247
4515
|
//# sourceMappingURL=ngx-opalbytes-components.mjs.map
|