pjc-fields 0.0.4 → 0.0.6

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, input, forwardRef, Input, inject, ElementRef, ChangeDetectionStrategy, output } from '@angular/core';
2
+ import { Component, input, forwardRef, ChangeDetectionStrategy, Input, inject, ElementRef, output } from '@angular/core';
3
3
  import * as i1 from '@angular/forms';
4
4
  import { FormsModule, NG_VALUE_ACCESSOR, NG_VALIDATORS } from '@angular/forms';
5
5
  import * as i2 from 'primeng/inputmask';
@@ -16,6 +16,8 @@ import { InputGroupModule } from 'primeng/inputgroup';
16
16
  import * as i4 from 'primeng/inputgroupaddon';
17
17
  import { InputGroupAddonModule } from 'primeng/inputgroupaddon';
18
18
  import { ButtonModule } from 'primeng/button';
19
+ import * as i2$3 from 'primeng/select';
20
+ import { SelectModule } from 'primeng/select';
19
21
 
20
22
  class PjcFields {
21
23
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcFields, deps: [], target: i0.ɵɵFactoryTarget.Component });
@@ -33,10 +35,10 @@ class PjcValidators {
33
35
  if (!value)
34
36
  return null;
35
37
  if (value.length !== 11 || /^(\d)\1+$/.test(value)) {
36
- return { cpfInvalid: true };
38
+ return { cpfInvalido: true };
37
39
  }
38
40
  if (!PjcValidators.validateCpfDigits(value)) {
39
- return { cpfInvalid: true };
41
+ return { cpfInvalido: true };
40
42
  }
41
43
  return null;
42
44
  };
@@ -64,10 +66,10 @@ class PjcValidators {
64
66
  return null;
65
67
  // CNPJ deve ter 14 dígitos e não pode ser sequência repetida
66
68
  if (value.length !== 14 || /^(\d)\1+$/.test(value)) {
67
- return { cnpjInvalid: true };
69
+ return { cnpjInvalido: true };
68
70
  }
69
71
  if (!PjcValidators.validateCnpjDigits(value)) {
70
- return { cnpjInvalid: true };
72
+ return { cnpjInvalido: true };
71
73
  }
72
74
  return null;
73
75
  };
@@ -107,11 +109,11 @@ class PjcValidators {
107
109
  return null;
108
110
  // Fixo: DDD (2) + 8 dígitos = 10 | Celular: DDD (2) + 9 dígitos = 11
109
111
  if (digits.length !== 10 && digits.length !== 11) {
110
- return { telefoneInvalid: true };
112
+ return { telefoneInvalido: true };
111
113
  }
112
114
  // Celular deve começar com 9 após o DDD
113
115
  if (digits.length === 11 && digits[2] !== '9') {
114
- return { telefoneInvalid: true };
116
+ return { telefoneInvalido: true };
115
117
  }
116
118
  return null;
117
119
  };
@@ -123,48 +125,48 @@ class PjcValidators {
123
125
  return null;
124
126
  const match = value.match(/^(\d{2}):(\d{2})$/);
125
127
  if (!match)
126
- return { horaInvalid: true };
128
+ return { horaInvalida: true };
127
129
  const hours = parseInt(match[1], 10);
128
130
  const minutes = parseInt(match[2], 10);
129
131
  if (hours > 23 || minutes > 59) {
130
- return { horaInvalid: true };
132
+ return { horaInvalida: true };
131
133
  }
132
134
  return null;
133
135
  };
134
136
  }
135
- static cep() {
137
+ static placaVeiculo() {
136
138
  return (control) => {
137
- const value = control.value?.replaceAll(/\D/g, '');
139
+ const value = control.value?.toUpperCase().replace('-', '');
138
140
  if (!value)
139
141
  return null;
140
- return value.length === 8 ? null : { cepInvalid: true };
142
+ // Regex para Padrão Antigo (AAA9999) e Mercosul (AAA9A99)
143
+ const plateRegex = /^[A-Z]{3}[0-9][A-Z0-9][0-9]{2}$/;
144
+ return plateRegex.test(value) ? null : { placaInvalida: true };
141
145
  };
142
146
  }
143
- static placaVeiculo() {
147
+ static email() {
144
148
  return (control) => {
145
- const value = control.value?.toUpperCase().replace('-', '');
149
+ const value = control.value;
146
150
  if (!value)
147
151
  return null;
148
- // Regex para Padrão Antigo (AAA9999) e Mercosul (AAA9A99)
149
- const plateRegex = /^[A-Z]{3}[0-9][A-Z0-9][0-9]{2}$/;
150
- return plateRegex.test(value) ? null : { plateInvalid: true };
152
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
153
+ return emailRegex.test(value) ? null : { emailInvalido: true };
151
154
  };
152
155
  }
153
156
  }
154
157
 
155
158
  class PjcCpfFieldComponent {
156
- label = '';
157
- hint = '';
158
- placeholder = '000.000.000-00';
159
- id = `pjc-cpf-${Math.random().toString(36).substring(2, 9)}`;
159
+ label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
160
+ hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
161
+ placeholder = input('000.000.000-00', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
162
+ id = input(`pjc-cpf-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
160
163
  labelVariant = input('over', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
161
164
  value = '';
162
165
  disabled = false;
163
166
  onChange = () => { };
164
167
  onTouched = () => { };
165
- // --- ControlValueAccessor ---
166
168
  writeValue(val) {
167
- this.value = val;
169
+ this.value = val ?? '';
168
170
  }
169
171
  registerOnChange(fn) {
170
172
  this.onChange = fn;
@@ -175,59 +177,58 @@ class PjcCpfFieldComponent {
175
177
  setDisabledState(isDisabled) {
176
178
  this.disabled = isDisabled;
177
179
  }
178
- onModelChange() {
180
+ onModelChange(value) {
181
+ this.value = value ?? '';
179
182
  this.onChange(this.value);
180
183
  }
181
184
  onModelTouched() {
182
185
  this.onTouched();
183
186
  }
184
- // --- Validator ---
185
187
  validate(control) {
186
188
  return PjcValidators.cpf()(control);
187
189
  }
188
190
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCpfFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
189
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcCpfFieldComponent, isStandalone: true, selector: "pjc-cpf-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: false, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: false, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: false, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: false, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
191
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcCpfFieldComponent, isStandalone: true, selector: "pjc-cpf-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
190
192
  {
191
193
  provide: NG_VALUE_ACCESSOR,
192
194
  useExisting: forwardRef(() => PjcCpfFieldComponent),
193
195
  multi: true,
194
196
  },
195
- { provide: NG_VALIDATORS, useValue: PjcValidators.cpf(), multi: true },
196
- ], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id\"\n mask=\"999.999.999-99\"\n [(ngModel)]=\"value\"\n (onInput)=\"onModelChange()\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n <label [for]=\"id\">{{ label }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id\"\n mask=\"999.999.999-99\"\n [(ngModel)]=\"value\"\n (onInput)=\"onModelChange()\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n }\n\n @if (hint) {\n <small class=\"text-xs text-surface-500\">{{ hint }}</small>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputMaskModule }, { kind: "component", type: i2.InputMask, selector: "p-inputmask, p-inputMask, p-input-mask", inputs: ["type", "slotChar", "autoClear", "showClear", "style", "inputId", "styleClass", "placeholder", "tabindex", "title", "ariaLabel", "ariaLabelledBy", "ariaRequired", "readonly", "unmask", "characterPattern", "autofocus", "autocomplete", "keepBuffer", "mask"], outputs: ["onComplete", "onFocus", "onBlur", "onInput", "onKeydown", "onClear"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }] });
197
+ {
198
+ provide: NG_VALIDATORS,
199
+ useExisting: forwardRef(() => PjcCpfFieldComponent),
200
+ multi: true,
201
+ },
202
+ ], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"999.999.999-99\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id()\"\n mask=\"999.999.999-99\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputMaskModule }, { kind: "component", type: i2.InputMask, selector: "p-inputmask, p-inputMask, p-input-mask", inputs: ["type", "slotChar", "autoClear", "showClear", "style", "inputId", "styleClass", "placeholder", "tabindex", "title", "ariaLabel", "ariaLabelledBy", "ariaRequired", "readonly", "unmask", "characterPattern", "autofocus", "autocomplete", "keepBuffer", "mask"], outputs: ["onComplete", "onFocus", "onBlur", "onInput", "onKeydown", "onClear"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
197
203
  }
198
204
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCpfFieldComponent, decorators: [{
199
205
  type: Component,
200
- args: [{ selector: 'pjc-cpf-field', imports: [CommonModule, FormsModule, InputMaskModule, FloatLabelModule], providers: [
206
+ args: [{ selector: 'pjc-cpf-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, InputMaskModule, FloatLabelModule], providers: [
201
207
  {
202
208
  provide: NG_VALUE_ACCESSOR,
203
209
  useExisting: forwardRef(() => PjcCpfFieldComponent),
204
210
  multi: true,
205
211
  },
206
- { provide: NG_VALIDATORS, useValue: PjcValidators.cpf(), multi: true },
207
- ], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id\"\n mask=\"999.999.999-99\"\n [(ngModel)]=\"value\"\n (onInput)=\"onModelChange()\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n <label [for]=\"id\">{{ label }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id\"\n mask=\"999.999.999-99\"\n [(ngModel)]=\"value\"\n (onInput)=\"onModelChange()\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n }\n\n @if (hint) {\n <small class=\"text-xs text-surface-500\">{{ hint }}</small>\n }\n</div>\n" }]
208
- }], propDecorators: { label: [{
209
- type: Input
210
- }], hint: [{
211
- type: Input
212
- }], placeholder: [{
213
- type: Input
214
- }], id: [{
215
- type: Input
216
- }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }] } });
212
+ {
213
+ provide: NG_VALIDATORS,
214
+ useExisting: forwardRef(() => PjcCpfFieldComponent),
215
+ multi: true,
216
+ },
217
+ ], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"999.999.999-99\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id()\"\n mask=\"999.999.999-99\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n</div>\n" }]
218
+ }], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }] } });
217
219
 
218
220
  class PjcCnpjFieldComponent {
219
- label = '';
220
- hint = '';
221
- placeholder = '00.000.000/0000-00';
222
- id = `pjc-cnpj-${Math.random().toString(36).substring(2, 9)}`;
221
+ label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
222
+ hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
223
+ placeholder = input('00.000.000/0000-00', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
224
+ id = input(`pjc-cnpj-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
223
225
  labelVariant = input('over', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
224
226
  value = '';
225
227
  disabled = false;
226
228
  onChange = () => { };
227
229
  onTouched = () => { };
228
- // ControlValueAccessor
229
230
  writeValue(val) {
230
- this.value = val;
231
+ this.value = val ?? '';
231
232
  }
232
233
  registerOnChange(fn) {
233
234
  this.onChange = fn;
@@ -238,45 +239,45 @@ class PjcCnpjFieldComponent {
238
239
  setDisabledState(isDisabled) {
239
240
  this.disabled = isDisabled;
240
241
  }
241
- onModelChange(event) {
242
+ onModelChange(value) {
243
+ this.value = value ?? '';
242
244
  this.onChange(this.value);
243
245
  }
244
246
  onModelTouched() {
245
247
  this.onTouched();
246
248
  }
247
- // Integração com a validação da Lib
248
249
  validate(control) {
249
250
  return PjcValidators.cnpj()(control);
250
251
  }
251
252
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCnpjFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
252
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcCnpjFieldComponent, isStandalone: true, selector: "pjc-cnpj-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: false, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: false, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: false, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: false, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
253
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcCnpjFieldComponent, isStandalone: true, selector: "pjc-cnpj-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
253
254
  {
254
255
  provide: NG_VALUE_ACCESSOR,
255
256
  useExisting: forwardRef(() => PjcCnpjFieldComponent),
256
257
  multi: true,
257
258
  },
258
- { provide: NG_VALIDATORS, useValue: PjcValidators.cnpj(), multi: true },
259
- ], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id\"\n mask=\"99.999.999/9999-99\"\n [(ngModel)]=\"value\"\n (onInput)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n <label [for]=\"id\">{{ label }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id\"\n mask=\"99.999.999/9999-99\"\n [(ngModel)]=\"value\"\n (onInput)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n }\n\n @if (hint) {\n <small class=\"text-xs text-surface-500\">{{ hint }}</small>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputMaskModule }, { kind: "component", type: i2.InputMask, selector: "p-inputmask, p-inputMask, p-input-mask", inputs: ["type", "slotChar", "autoClear", "showClear", "style", "inputId", "styleClass", "placeholder", "tabindex", "title", "ariaLabel", "ariaLabelledBy", "ariaRequired", "readonly", "unmask", "characterPattern", "autofocus", "autocomplete", "keepBuffer", "mask"], outputs: ["onComplete", "onFocus", "onBlur", "onInput", "onKeydown", "onClear"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }] });
259
+ {
260
+ provide: NG_VALIDATORS,
261
+ useExisting: forwardRef(() => PjcCnpjFieldComponent),
262
+ multi: true,
263
+ },
264
+ ], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"99.999.999/9999-99\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id()\"\n mask=\"99.999.999/9999-99\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputMaskModule }, { kind: "component", type: i2.InputMask, selector: "p-inputmask, p-inputMask, p-input-mask", inputs: ["type", "slotChar", "autoClear", "showClear", "style", "inputId", "styleClass", "placeholder", "tabindex", "title", "ariaLabel", "ariaLabelledBy", "ariaRequired", "readonly", "unmask", "characterPattern", "autofocus", "autocomplete", "keepBuffer", "mask"], outputs: ["onComplete", "onFocus", "onBlur", "onInput", "onKeydown", "onClear"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
260
265
  }
261
266
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCnpjFieldComponent, decorators: [{
262
267
  type: Component,
263
- args: [{ selector: 'pjc-cnpj-field', imports: [CommonModule, FormsModule, InputMaskModule, FloatLabelModule], providers: [
268
+ args: [{ selector: 'pjc-cnpj-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, InputMaskModule, FloatLabelModule], providers: [
264
269
  {
265
270
  provide: NG_VALUE_ACCESSOR,
266
271
  useExisting: forwardRef(() => PjcCnpjFieldComponent),
267
272
  multi: true,
268
273
  },
269
- { provide: NG_VALIDATORS, useValue: PjcValidators.cnpj(), multi: true },
270
- ], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id\"\n mask=\"99.999.999/9999-99\"\n [(ngModel)]=\"value\"\n (onInput)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n <label [for]=\"id\">{{ label }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id\"\n mask=\"99.999.999/9999-99\"\n [(ngModel)]=\"value\"\n (onInput)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n }\n\n @if (hint) {\n <small class=\"text-xs text-surface-500\">{{ hint }}</small>\n }\n</div>\n" }]
271
- }], propDecorators: { label: [{
272
- type: Input
273
- }], hint: [{
274
- type: Input
275
- }], placeholder: [{
276
- type: Input
277
- }], id: [{
278
- type: Input
279
- }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }] } });
274
+ {
275
+ provide: NG_VALIDATORS,
276
+ useExisting: forwardRef(() => PjcCnpjFieldComponent),
277
+ multi: true,
278
+ },
279
+ ], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"99.999.999/9999-99\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id()\"\n mask=\"99.999.999/9999-99\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n</div>\n" }]
280
+ }], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }] } });
280
281
 
281
282
  class PjcCpfCnpjFieldComponent {
282
283
  label = 'CPF/CNPJ';
@@ -784,10 +785,6 @@ class PjcCepFieldComponent {
784
785
  this.busca.emit(this.value);
785
786
  }
786
787
  }
787
- // --- Validator ---
788
- validate(control) {
789
- return PjcValidators.cep()(control);
790
- }
791
788
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCepFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
792
789
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcCepFieldComponent, isStandalone: true, selector: "pjc-cep-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: false, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: false, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: false, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: false, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { busca: "busca" }, providers: [
793
790
  {
@@ -795,7 +792,6 @@ class PjcCepFieldComponent {
795
792
  useExisting: forwardRef(() => PjcCepFieldComponent),
796
793
  multi: true,
797
794
  },
798
- { provide: NG_VALIDATORS, useValue: PjcValidators.cep(), multi: true },
799
795
  ], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputgroup [class.opacity-60]=\"disabled\">\n <p-inputMask\n [id]=\"id\"\n mask=\"99999-999\"\n [(ngModel)]=\"value\"\n (onInput)=\"onModelChange()\"\n (onBlur)=\"onModelTouched()\"\n (onComplete)=\"onComplete()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n inputStyleClass=\"w-full outline-none bg-transparent\"\n ></p-inputMask>\n\n <p-inputgroup-addon>\n <button\n type=\"button\"\n (click)=\"onSearch()\"\n [disabled]=\"disabled\"\n class=\"cursor-pointer bg-transparent border-none text-surface-500 hover:text-surface-700 disabled:text-surface-300 disabled:cursor-not-allowed transition-colors\"\n aria-label=\"Buscar CEP\"\n >\n <i class=\"pi pi-search\"></i>\n </button>\n </p-inputgroup-addon>\n </p-inputgroup>\n <label [for]=\"id\">{{ label }}</label>\n </p-floatlabel>\n } @else {\n <p-inputgroup [class.opacity-60]=\"disabled\">\n <p-inputMask\n [id]=\"id\"\n mask=\"99999-999\"\n [(ngModel)]=\"value\"\n (onInput)=\"onModelChange()\"\n (onBlur)=\"onModelTouched()\"\n (onComplete)=\"onComplete()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n inputStyleClass=\"w-full outline-none bg-transparent\"\n ></p-inputMask>\n\n <p-inputgroup-addon>\n <button\n type=\"button\"\n (click)=\"onSearch()\"\n [disabled]=\"disabled\"\n class=\"cursor-pointer bg-transparent border-none text-surface-500 hover:text-surface-700 disabled:text-surface-300 disabled:cursor-not-allowed transition-colors\"\n aria-label=\"Buscar CEP\"\n >\n <i class=\"pi pi-search\"></i>\n </button>\n </p-inputgroup-addon>\n </p-inputgroup>\n }\n\n @if (hint) {\n <small class=\"text-xs text-surface-500\">{{ hint }}</small>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputMaskModule }, { kind: "component", type: i2.InputMask, selector: "p-inputmask, p-inputMask, p-input-mask", inputs: ["type", "slotChar", "autoClear", "showClear", "style", "inputId", "styleClass", "placeholder", "tabindex", "title", "ariaLabel", "ariaLabelledBy", "ariaRequired", "readonly", "unmask", "characterPattern", "autofocus", "autocomplete", "keepBuffer", "mask"], outputs: ["onComplete", "onFocus", "onBlur", "onInput", "onKeydown", "onClear"] }, { kind: "ngmodule", type: InputGroupModule }, { kind: "component", type: i3$1.InputGroup, selector: "p-inputgroup, p-inputGroup, p-input-group", inputs: ["styleClass"] }, { kind: "ngmodule", type: InputGroupAddonModule }, { kind: "component", type: i4.InputGroupAddon, selector: "p-inputgroup-addon, p-inputGroupAddon", inputs: ["style", "styleClass"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }] });
800
796
  }
801
797
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCepFieldComponent, decorators: [{
@@ -806,7 +802,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
806
802
  useExisting: forwardRef(() => PjcCepFieldComponent),
807
803
  multi: true,
808
804
  },
809
- { provide: NG_VALIDATORS, useValue: PjcValidators.cep(), multi: true },
810
805
  ], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputgroup [class.opacity-60]=\"disabled\">\n <p-inputMask\n [id]=\"id\"\n mask=\"99999-999\"\n [(ngModel)]=\"value\"\n (onInput)=\"onModelChange()\"\n (onBlur)=\"onModelTouched()\"\n (onComplete)=\"onComplete()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n inputStyleClass=\"w-full outline-none bg-transparent\"\n ></p-inputMask>\n\n <p-inputgroup-addon>\n <button\n type=\"button\"\n (click)=\"onSearch()\"\n [disabled]=\"disabled\"\n class=\"cursor-pointer bg-transparent border-none text-surface-500 hover:text-surface-700 disabled:text-surface-300 disabled:cursor-not-allowed transition-colors\"\n aria-label=\"Buscar CEP\"\n >\n <i class=\"pi pi-search\"></i>\n </button>\n </p-inputgroup-addon>\n </p-inputgroup>\n <label [for]=\"id\">{{ label }}</label>\n </p-floatlabel>\n } @else {\n <p-inputgroup [class.opacity-60]=\"disabled\">\n <p-inputMask\n [id]=\"id\"\n mask=\"99999-999\"\n [(ngModel)]=\"value\"\n (onInput)=\"onModelChange()\"\n (onBlur)=\"onModelTouched()\"\n (onComplete)=\"onComplete()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n inputStyleClass=\"w-full outline-none bg-transparent\"\n ></p-inputMask>\n\n <p-inputgroup-addon>\n <button\n type=\"button\"\n (click)=\"onSearch()\"\n [disabled]=\"disabled\"\n class=\"cursor-pointer bg-transparent border-none text-surface-500 hover:text-surface-700 disabled:text-surface-300 disabled:cursor-not-allowed transition-colors\"\n aria-label=\"Buscar CEP\"\n >\n <i class=\"pi pi-search\"></i>\n </button>\n </p-inputgroup-addon>\n </p-inputgroup>\n }\n\n @if (hint) {\n <small class=\"text-xs text-surface-500\">{{ hint }}</small>\n }\n</div>\n" }]
811
806
  }], propDecorators: { label: [{
812
807
  type: Input
@@ -818,6 +813,140 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
818
813
  type: Input
819
814
  }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], busca: [{ type: i0.Output, args: ["busca"] }] } });
820
815
 
816
+ const ESTADOS = [
817
+ { uf: 'AC', descricao: 'Acre' },
818
+ { uf: 'AL', descricao: 'Alagoas' },
819
+ { uf: 'AP', descricao: 'Amapá' },
820
+ { uf: 'AM', descricao: 'Amazonas' },
821
+ { uf: 'BA', descricao: 'Bahia' },
822
+ { uf: 'CE', descricao: 'Ceará' },
823
+ { uf: 'DF', descricao: 'Distrito Federal' },
824
+ { uf: 'ES', descricao: 'Espírito Santo' },
825
+ { uf: 'GO', descricao: 'Goiás' },
826
+ { uf: 'MA', descricao: 'Maranhão' },
827
+ { uf: 'MT', descricao: 'Mato Grosso' },
828
+ { uf: 'MS', descricao: 'Mato Grosso do Sul' },
829
+ { uf: 'MG', descricao: 'Minas Gerais' },
830
+ { uf: 'PA', descricao: 'Pará' },
831
+ { uf: 'PB', descricao: 'Paraíba' },
832
+ { uf: 'PR', descricao: 'Paraná' },
833
+ { uf: 'PE', descricao: 'Pernambuco' },
834
+ { uf: 'PI', descricao: 'Piauí' },
835
+ { uf: 'RJ', descricao: 'Rio de Janeiro' },
836
+ { uf: 'RN', descricao: 'Rio Grande do Norte' },
837
+ { uf: 'RS', descricao: 'Rio Grande do Sul' },
838
+ { uf: 'RO', descricao: 'Rondônia' },
839
+ { uf: 'RR', descricao: 'Roraima' },
840
+ { uf: 'SC', descricao: 'Santa Catarina' },
841
+ { uf: 'SP', descricao: 'São Paulo' },
842
+ { uf: 'SE', descricao: 'Sergipe' },
843
+ { uf: 'TO', descricao: 'Tocantins' },
844
+ ];
845
+ class PjcUfFieldComponent {
846
+ label = input('UF', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
847
+ hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
848
+ placeholder = input('Selecione o estado', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
849
+ id = input(`pjc-uf-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
850
+ labelVariant = input('over', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
851
+ estados = ESTADOS;
852
+ value = null;
853
+ disabled = false;
854
+ onChange = () => { };
855
+ onTouched = () => { };
856
+ writeValue(val) {
857
+ this.value = val?.uf ? (ESTADOS.find(e => e.uf === val.uf) ?? null) : null;
858
+ }
859
+ registerOnChange(fn) {
860
+ this.onChange = fn;
861
+ }
862
+ registerOnTouched(fn) {
863
+ this.onTouched = fn;
864
+ }
865
+ setDisabledState(isDisabled) {
866
+ this.disabled = isDisabled;
867
+ }
868
+ onModelChange(value) {
869
+ this.value = value;
870
+ this.onChange(value);
871
+ }
872
+ onModelTouched() {
873
+ this.onTouched();
874
+ }
875
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcUfFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
876
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcUfFieldComponent, isStandalone: true, selector: "pjc-uf-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
877
+ {
878
+ provide: NG_VALUE_ACCESSOR,
879
+ useExisting: forwardRef(() => PjcUfFieldComponent),
880
+ multi: true,
881
+ },
882
+ ], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-select\n [inputId]=\"id()\"\n [options]=\"estados\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n optionLabel=\"descricao\"\n dataKey=\"uf\"\n appendTo=\"body\"\n [disabled]=\"disabled\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n class=\"w-full\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-select\n [inputId]=\"id()\"\n [options]=\"estados\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n optionLabel=\"descricao\"\n dataKey=\"uf\"\n appendTo=\"body\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n class=\"w-full\"\n />\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i2$3.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "panelStyle", "styleClass", "panelStyleClass", "readonly", "editable", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "filterValue", "options", "appendTo", "motionOptions"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
883
+ }
884
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcUfFieldComponent, decorators: [{
885
+ type: Component,
886
+ args: [{ selector: 'pjc-uf-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, SelectModule, FloatLabelModule], providers: [
887
+ {
888
+ provide: NG_VALUE_ACCESSOR,
889
+ useExisting: forwardRef(() => PjcUfFieldComponent),
890
+ multi: true,
891
+ },
892
+ ], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-select\n [inputId]=\"id()\"\n [options]=\"estados\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n optionLabel=\"descricao\"\n dataKey=\"uf\"\n appendTo=\"body\"\n [disabled]=\"disabled\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n class=\"w-full\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-select\n [inputId]=\"id()\"\n [options]=\"estados\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n optionLabel=\"descricao\"\n dataKey=\"uf\"\n appendTo=\"body\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n class=\"w-full\"\n />\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n</div>\n" }]
893
+ }], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }] } });
894
+
895
+ class PjcEmailFieldComponent {
896
+ label = input('E-mail', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
897
+ placeholder = input('Digite o e-mail', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
898
+ id = input(`pjc-email-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
899
+ labelVariant = input('over', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
900
+ value = '';
901
+ onChange = () => { };
902
+ onTouched = () => { };
903
+ writeValue(val) {
904
+ this.value = val?.toLowerCase() ?? '';
905
+ }
906
+ registerOnChange(fn) {
907
+ this.onChange = fn;
908
+ }
909
+ registerOnTouched(fn) {
910
+ this.onTouched = fn;
911
+ }
912
+ validate(control) {
913
+ return PjcValidators.email()(control);
914
+ }
915
+ onInput(event) {
916
+ const lower = event.target.value.toLowerCase();
917
+ this.value = lower;
918
+ this.onChange(lower);
919
+ }
920
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcEmailFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
921
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcEmailFieldComponent, isStandalone: true, selector: "pjc-email-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
922
+ {
923
+ provide: NG_VALUE_ACCESSOR,
924
+ useExisting: forwardRef(() => PjcEmailFieldComponent),
925
+ multi: true,
926
+ },
927
+ {
928
+ provide: NG_VALIDATORS,
929
+ useExisting: forwardRef(() => PjcEmailFieldComponent),
930
+ multi: true,
931
+ },
932
+ ], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <input\n pInputText\n type=\"email\"\n [id]=\"id()\"\n [value]=\"value\"\n (input)=\"onInput($event)\"\n (blur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n class=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <input\n pInputText\n type=\"email\"\n [id]=\"id()\"\n [value]=\"value\"\n (input)=\"onInput($event)\"\n (blur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n class=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500\"\n />\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i2$1.InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pInputTextPT", "pInputTextUnstyled", "pSize", "variant", "fluid", "invalid"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }] });
933
+ }
934
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcEmailFieldComponent, decorators: [{
935
+ type: Component,
936
+ args: [{ selector: 'pjc-email-field', imports: [CommonModule, FormsModule, InputTextModule, FloatLabelModule], providers: [
937
+ {
938
+ provide: NG_VALUE_ACCESSOR,
939
+ useExisting: forwardRef(() => PjcEmailFieldComponent),
940
+ multi: true,
941
+ },
942
+ {
943
+ provide: NG_VALIDATORS,
944
+ useExisting: forwardRef(() => PjcEmailFieldComponent),
945
+ multi: true,
946
+ },
947
+ ], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <input\n pInputText\n type=\"email\"\n [id]=\"id()\"\n [value]=\"value\"\n (input)=\"onInput($event)\"\n (blur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n class=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <input\n pInputText\n type=\"email\"\n [id]=\"id()\"\n [value]=\"value\"\n (input)=\"onInput($event)\"\n (blur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n class=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500\"\n />\n }\n</div>\n" }]
948
+ }], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }] } });
949
+
821
950
  /*
822
951
  * Public API Surface of pjc-fields
823
952
  */
@@ -826,5 +955,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
826
955
  * Generated bundle index. Do not edit.
827
956
  */
828
957
 
829
- export { PjcCepFieldComponent, PjcCnpjFieldComponent, PjcCpfCnpjFieldComponent, PjcCpfFieldComponent, PjcDataFieldComponent, PjcFields, PjcHoraFieldComponent, PjcNomeFieldComponent, PjcPlacaFieldComponent, PjcTelefoneFieldComponent, PjcValidators };
958
+ export { PjcCepFieldComponent, PjcCnpjFieldComponent, PjcCpfCnpjFieldComponent, PjcCpfFieldComponent, PjcDataFieldComponent, PjcEmailFieldComponent, PjcFields, PjcHoraFieldComponent, PjcNomeFieldComponent, PjcPlacaFieldComponent, PjcTelefoneFieldComponent, PjcUfFieldComponent, PjcValidators };
830
959
  //# sourceMappingURL=pjc-fields.mjs.map