{"version":3,"file":"koalarx-ui-shared-components-input-field-input-cpf.mjs","sources":["../../projects/koala-ui/shared/components/input-field/input-cpf/cpf.validator.ts","../../projects/koala-ui/shared/components/input-field/input-cpf/input-cpf.ts","../../projects/koala-ui/shared/components/input-field/input-cpf/input-cpf.html","../../projects/koala-ui/shared/components/input-field/input-cpf/koalarx-ui-shared-components-input-field-input-cpf.ts"],"sourcesContent":["import { AbstractControl } from '@angular/forms';\r\nimport { validateCpf } from '@koalarx/utils/KlString';\r\n\r\nexport function CPFValidator(control: AbstractControl) {\r\n  if (control.value && !validateCpf(control.value)) {\r\n    return { cpfInvalid: true };\r\n  }\r\n\r\n  return null;\r\n}\r\n","import {\n  ChangeDetectionStrategy,\n  Component,\n  effect,\n  inject,\n} from '@angular/core';\nimport { AppConfig } from '@koalarx/ui/core/config';\nimport { InputFieldBase } from '@koalarx/ui/shared/components/input-field';\nimport { InputText } from '@koalarx/ui/shared/components/input-field/input-text';\nimport { CPFValidator } from './cpf.validator';\n\n@Component({\n  selector: 'kl-input-cpf',\n  templateUrl: './input-cpf.html',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  imports: [InputText],\n})\nexport class InputCpf extends InputFieldBase {\n  readonly translations = inject(AppConfig).translation.form;\n\n  constructor() {\n    super();\n\n    effect(() => {\n      const control = this.control();\n\n      control.addValidators(CPFValidator);\n    });\n  }\n}\n","<kl-input-text\n  [control]=\"control()\"\n  [label]=\"label()\"\n  [placeholder]=\"placeholder()\"\n  [hint]=\"hint()\"\n  mask=\"000.000.000-00\">\n\n  <ng-container errors>\n    @if (control().errors?.['cpfInvalid']) {\n      <div class=\"error-message\">{{ translations.invalidCPF }}</div>\n    }\n  </ng-container>\n</kl-input-text>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAGM,SAAU,YAAY,CAAC,OAAwB,EAAA;AACnD,IAAA,IAAI,OAAO,CAAC,KAAK,IAAI,CAAC,WAAW,CAAC,OAAO,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