@seniorsistemas/scala-ng 1.0.0-beta.7

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.
Files changed (53) hide show
  1. package/esm2022/input/public-api.mjs +2 -0
  2. package/esm2022/input/seniorsistemas-scala-ng-input.mjs +5 -0
  3. package/esm2022/input/src/input/input.component.mjs +74 -0
  4. package/esm2022/input-validator/public-api.mjs +2 -0
  5. package/esm2022/input-validator/seniorsistemas-scala-ng-input-validator.mjs +5 -0
  6. package/esm2022/input-validator/src/input-validator/input-validator.component.mjs +44 -0
  7. package/esm2022/lib/components/button/button.component.mjs +47 -0
  8. package/esm2022/lib/theme/create-theme.mjs +67 -0
  9. package/esm2022/lib/theme/semantic-tokens.mjs +2 -0
  10. package/esm2022/lib/theme/theme.service.mjs +38 -0
  11. package/esm2022/locale/fallback.mjs +12 -0
  12. package/esm2022/locale/public-api.mjs +2 -0
  13. package/esm2022/locale/seniorsistemas-scala-ng-locale.mjs +5 -0
  14. package/esm2022/public-api.mjs +9 -0
  15. package/esm2022/seniorsistemas-scala-ng.mjs +5 -0
  16. package/fesm2022/seniorsistemas-scala-ng-input-validator.mjs +51 -0
  17. package/fesm2022/seniorsistemas-scala-ng-input-validator.mjs.map +1 -0
  18. package/fesm2022/seniorsistemas-scala-ng-input.mjs +81 -0
  19. package/fesm2022/seniorsistemas-scala-ng-input.mjs.map +1 -0
  20. package/fesm2022/seniorsistemas-scala-ng-locale.mjs +18 -0
  21. package/fesm2022/seniorsistemas-scala-ng-locale.mjs.map +1 -0
  22. package/fesm2022/seniorsistemas-scala-ng.mjs +162 -0
  23. package/fesm2022/seniorsistemas-scala-ng.mjs.map +1 -0
  24. package/index.d.ts +5 -0
  25. package/input/README.md +160 -0
  26. package/input/index.d.ts +5 -0
  27. package/input/public-api.d.ts +1 -0
  28. package/input/src/input/input.component.d.ts +33 -0
  29. package/input-validator/README.md +156 -0
  30. package/input-validator/index.d.ts +5 -0
  31. package/input-validator/public-api.d.ts +1 -0
  32. package/input-validator/src/input-validator/input-validator.component.d.ts +16 -0
  33. package/lib/components/button/button.component.d.ts +15 -0
  34. package/lib/theme/create-theme.d.ts +80 -0
  35. package/lib/theme/semantic-tokens.d.ts +13 -0
  36. package/lib/theme/theme.service.d.ts +12 -0
  37. package/locale/fallback.d.ts +1 -0
  38. package/locale/index.d.ts +5 -0
  39. package/locale/public-api.d.ts +1 -0
  40. package/package.json +48 -0
  41. package/public-api.d.ts +4 -0
  42. package/schematics/collection.json +10 -0
  43. package/schematics/ng-add/schema.json +8 -0
  44. package/styles/tailwind-preset.js +19 -0
  45. package/styles/tailwind-tokens.js +279 -0
  46. package/styles/tokens/grid.scss +26 -0
  47. package/styles/tokens/index.scss +6 -0
  48. package/styles/tokens/primitive-colors.scss +1620 -0
  49. package/styles/tokens/radius.scss +10 -0
  50. package/styles/tokens/semantic-colors.scss +319 -0
  51. package/styles/tokens/spacing.scss +18 -0
  52. package/styles/tokens/typography.scss +26 -0
  53. package/styles.scss +3 -0
@@ -0,0 +1,81 @@
1
+ import { NgClass } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { input, signal, inject, Component } from '@angular/core';
4
+ import { NgControl } from '@angular/forms';
5
+ import { SdsInputValidatorComponent } from '@seniorsistemas/scala-ng/input-validator';
6
+
7
+ class SdsInputComponent {
8
+ static idCounter = 0;
9
+ _inputId = `sds-input-${++SdsInputComponent.idCounter}`;
10
+ label = input.required();
11
+ subtitle = input();
12
+ icon = input();
13
+ type = input("text");
14
+ placeholder = input("");
15
+ errorMessages = input();
16
+ validMessage = input();
17
+ adviceMessage = input();
18
+ inputId = input(this._inputId);
19
+ isFocused = signal(false);
20
+ isDisabled = signal(false);
21
+ internalValue = signal("");
22
+ ngControl;
23
+ constructor() {
24
+ this.ngControl = inject(NgControl, { self: true, optional: true });
25
+ if (this.ngControl) {
26
+ this.ngControl.valueAccessor = this;
27
+ }
28
+ }
29
+ get borderClass() {
30
+ const control = this.ngControl?.control;
31
+ const focused = this.isFocused();
32
+ return {
33
+ "border-color-border-focused": focused,
34
+ "border-color-border-destructive": !focused && !!control?.touched && !!control?.invalid,
35
+ "border-color-border-positive": !focused && !!control?.touched && !!control?.valid,
36
+ "border-color-border-interactive-secondary": !focused && !control?.touched,
37
+ };
38
+ }
39
+ get control() {
40
+ return this.ngControl.control;
41
+ }
42
+ handleInput(event) {
43
+ const value = event.target.value;
44
+ this.internalValue.set(value);
45
+ this.onChange(value);
46
+ }
47
+ handleBlur() {
48
+ this.isFocused.set(false);
49
+ this.onTouched();
50
+ }
51
+ handleFocus() {
52
+ this.isFocused.set(true);
53
+ }
54
+ writeValue(value) {
55
+ this.internalValue.set(value ?? "");
56
+ }
57
+ registerOnChange(fn) {
58
+ this.onChange = fn;
59
+ }
60
+ registerOnTouched(fn) {
61
+ this.onTouched = fn;
62
+ }
63
+ setDisabledState(isDisabled) {
64
+ this.isDisabled.set(isDisabled);
65
+ }
66
+ onChange = () => { };
67
+ onTouched = () => { };
68
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SdsInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
69
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: SdsInputComponent, isStandalone: true, selector: "sds-input", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, subtitle: { classPropertyName: "subtitle", publicName: "subtitle", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, errorMessages: { classPropertyName: "errorMessages", publicName: "errorMessages", isSignal: true, isRequired: false, transformFunction: null }, validMessage: { classPropertyName: "validMessage", publicName: "validMessage", isSignal: true, isRequired: false, transformFunction: null }, adviceMessage: { classPropertyName: "adviceMessage", publicName: "adviceMessage", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"flex flex-col gap-[6px]\">\n <div class=\"flex h-[16px] items-center gap-1\">\n <label [for]=\"inputId()\" class=\"flex items-center gap-1 text-[14px] font-medium leading-[1.25]\">\n <span class=\"shrink-0 text-color-text-neutral-primary\">{{ label() }}</span>\n @if (subtitle()) {\n <span class=\"shrink-0 text-color-text-neutral-secondary\">({{ subtitle() }})</span>\n }\n </label>\n <span\n class=\"shrink-0 text-[14px] font-medium leading-[1.25] text-color-text-destructive\"\n aria-hidden=\"true\"\n >*</span\n >\n <i\n class=\"fa-solid fa-circle-info shrink-0 text-[12px] text-color-text-neutral-secondary\"\n aria-hidden=\"true\"\n ></i>\n </div>\n\n <div\n class=\"flex h-[40px] items-center gap-2 rounded-[6px] border border-solid bg-color-background-interactive-secondary px-3 transition-colors duration-150\"\n [ngClass]=\"borderClass\"\n >\n @if (icon()) {\n <i\n class=\"fa-solid shrink-0 text-[16px] text-color-text-neutral-secondary\"\n [class]=\"'fa-' + icon()\"\n aria-hidden=\"true\"\n ></i>\n }\n\n <input\n [id]=\"inputId()\"\n class=\"min-w-0 flex-1 border-none bg-[transparent] text-[16px] font-normal leading-[1.5] text-color-text-neutral-primary outline-none placeholder:text-color-text-neutral-secondary\"\n [type]=\"type()\"\n [placeholder]=\"placeholder()\"\n [attr.disabled]=\"isDisabled() ? true : null\"\n [value]=\"internalValue()\"\n (input)=\"handleInput($event)\"\n (blur)=\"handleBlur()\"\n (focus)=\"handleFocus()\"\n />\n </div>\n\n @if (errorMessages() && ngControl?.control) {\n <sds-input-validator\n [control]=\"control\"\n [errorMessages]=\"errorMessages()!\"\n [validMessage]=\"validMessage()\"\n [adviceMessage]=\"adviceMessage()\"\n />\n }\n</div>\n", dependencies: [{ kind: "component", type: SdsInputValidatorComponent, selector: "sds-input-validator", inputs: ["control", "errorMessages", "validMessage", "adviceMessage"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
70
+ }
71
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SdsInputComponent, decorators: [{
72
+ type: Component,
73
+ args: [{ selector: "sds-input", standalone: true, imports: [SdsInputValidatorComponent, NgClass], template: "<div class=\"flex flex-col gap-[6px]\">\n <div class=\"flex h-[16px] items-center gap-1\">\n <label [for]=\"inputId()\" class=\"flex items-center gap-1 text-[14px] font-medium leading-[1.25]\">\n <span class=\"shrink-0 text-color-text-neutral-primary\">{{ label() }}</span>\n @if (subtitle()) {\n <span class=\"shrink-0 text-color-text-neutral-secondary\">({{ subtitle() }})</span>\n }\n </label>\n <span\n class=\"shrink-0 text-[14px] font-medium leading-[1.25] text-color-text-destructive\"\n aria-hidden=\"true\"\n >*</span\n >\n <i\n class=\"fa-solid fa-circle-info shrink-0 text-[12px] text-color-text-neutral-secondary\"\n aria-hidden=\"true\"\n ></i>\n </div>\n\n <div\n class=\"flex h-[40px] items-center gap-2 rounded-[6px] border border-solid bg-color-background-interactive-secondary px-3 transition-colors duration-150\"\n [ngClass]=\"borderClass\"\n >\n @if (icon()) {\n <i\n class=\"fa-solid shrink-0 text-[16px] text-color-text-neutral-secondary\"\n [class]=\"'fa-' + icon()\"\n aria-hidden=\"true\"\n ></i>\n }\n\n <input\n [id]=\"inputId()\"\n class=\"min-w-0 flex-1 border-none bg-[transparent] text-[16px] font-normal leading-[1.5] text-color-text-neutral-primary outline-none placeholder:text-color-text-neutral-secondary\"\n [type]=\"type()\"\n [placeholder]=\"placeholder()\"\n [attr.disabled]=\"isDisabled() ? true : null\"\n [value]=\"internalValue()\"\n (input)=\"handleInput($event)\"\n (blur)=\"handleBlur()\"\n (focus)=\"handleFocus()\"\n />\n </div>\n\n @if (errorMessages() && ngControl?.control) {\n <sds-input-validator\n [control]=\"control\"\n [errorMessages]=\"errorMessages()!\"\n [validMessage]=\"validMessage()\"\n [adviceMessage]=\"adviceMessage()\"\n />\n }\n</div>\n" }]
74
+ }], ctorParameters: () => [] });
75
+
76
+ /**
77
+ * Generated bundle index. Do not edit.
78
+ */
79
+
80
+ export { SdsInputComponent };
81
+ //# sourceMappingURL=seniorsistemas-scala-ng-input.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seniorsistemas-scala-ng-input.mjs","sources":["../../projects/scala-ng/input/src/input/input.component.ts","../../projects/scala-ng/input/src/input/input.component.html","../../projects/scala-ng/input/seniorsistemas-scala-ng-input.ts"],"sourcesContent":["import { NgClass } from \"@angular/common\";\nimport { Component, inject, input, signal } from \"@angular/core\";\nimport { AbstractControl, ControlValueAccessor, NgControl } from \"@angular/forms\";\nimport { SdsInputValidatorComponent } from \"@seniorsistemas/scala-ng/input-validator\";\n\n@Component({\n selector: \"sds-input\",\n standalone: true,\n imports: [SdsInputValidatorComponent, NgClass],\n templateUrl: \"./input.component.html\",\n})\nexport class SdsInputComponent implements ControlValueAccessor {\n private static idCounter = 0;\n\n protected readonly _inputId = `sds-input-${++SdsInputComponent.idCounter}`;\n\n readonly label = input.required<string>();\n readonly subtitle = input<string>();\n readonly icon = input<string>();\n readonly type = input<string>(\"text\");\n readonly placeholder = input<string>(\"\");\n readonly errorMessages = input<Record<string, string>>();\n readonly validMessage = input<string>();\n readonly adviceMessage = input<string>();\n readonly inputId = input<string>(this._inputId);\n\n protected readonly isFocused = signal(false);\n protected readonly isDisabled = signal(false);\n protected readonly internalValue = signal(\"\");\n\n protected readonly ngControl: NgControl | null;\n\n constructor() {\n this.ngControl = inject(NgControl, { self: true, optional: true });\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n protected get borderClass(): Record<string, boolean> {\n const control = this.ngControl?.control;\n const focused = this.isFocused();\n return {\n \"border-color-border-focused\": focused,\n \"border-color-border-destructive\": !focused && !!control?.touched && !!control?.invalid,\n \"border-color-border-positive\": !focused && !!control?.touched && !!control?.valid,\n \"border-color-border-interactive-secondary\": !focused && !control?.touched,\n };\n }\n\n protected get control(): AbstractControl {\n return this.ngControl!.control!;\n }\n\n protected handleInput(event: Event): void {\n const value = (event.target as HTMLInputElement).value;\n this.internalValue.set(value);\n this.onChange(value);\n }\n\n protected handleBlur(): void {\n this.isFocused.set(false);\n this.onTouched();\n }\n\n protected handleFocus(): void {\n this.isFocused.set(true);\n }\n\n writeValue(value: string): void {\n this.internalValue.set(value ?? \"\");\n }\n\n registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.isDisabled.set(isDisabled);\n }\n\n private onChange: (value: string) => void = () => {};\n private onTouched: () => void = () => {};\n}\n","<div class=\"flex flex-col gap-[6px]\">\n <div class=\"flex h-[16px] items-center gap-1\">\n <label [for]=\"inputId()\" class=\"flex items-center gap-1 text-[14px] font-medium leading-[1.25]\">\n <span class=\"shrink-0 text-color-text-neutral-primary\">{{ label() }}</span>\n @if (subtitle()) {\n <span class=\"shrink-0 text-color-text-neutral-secondary\">({{ subtitle() }})</span>\n }\n </label>\n <span\n class=\"shrink-0 text-[14px] font-medium leading-[1.25] text-color-text-destructive\"\n aria-hidden=\"true\"\n >*</span\n >\n <i\n class=\"fa-solid fa-circle-info shrink-0 text-[12px] text-color-text-neutral-secondary\"\n aria-hidden=\"true\"\n ></i>\n </div>\n\n <div\n class=\"flex h-[40px] items-center gap-2 rounded-[6px] border border-solid bg-color-background-interactive-secondary px-3 transition-colors duration-150\"\n [ngClass]=\"borderClass\"\n >\n @if (icon()) {\n <i\n class=\"fa-solid shrink-0 text-[16px] text-color-text-neutral-secondary\"\n [class]=\"'fa-' + icon()\"\n aria-hidden=\"true\"\n ></i>\n }\n\n <input\n [id]=\"inputId()\"\n class=\"min-w-0 flex-1 border-none bg-[transparent] text-[16px] font-normal leading-[1.5] text-color-text-neutral-primary outline-none placeholder:text-color-text-neutral-secondary\"\n [type]=\"type()\"\n [placeholder]=\"placeholder()\"\n [attr.disabled]=\"isDisabled() ? true : null\"\n [value]=\"internalValue()\"\n (input)=\"handleInput($event)\"\n (blur)=\"handleBlur()\"\n (focus)=\"handleFocus()\"\n />\n </div>\n\n @if (errorMessages() && ngControl?.control) {\n <sds-input-validator\n [control]=\"control\"\n [errorMessages]=\"errorMessages()!\"\n [validMessage]=\"validMessage()\"\n [adviceMessage]=\"adviceMessage()\"\n />\n }\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAWa,iBAAiB,CAAA;AACpB,IAAA,OAAO,SAAS,GAAG,CAAC,CAAC;AAEV,IAAA,QAAQ,GAAG,CAAa,UAAA,EAAA,EAAE,iBAAiB,CAAC,SAAS,EAAE,CAAC;AAElE,IAAA,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IACjC,QAAQ,GAAG,KAAK,EAAU,CAAC;IAC3B,IAAI,GAAG,KAAK,EAAU,CAAC;AACvB,IAAA,IAAI,GAAG,KAAK,CAAS,MAAM,CAAC,CAAC;AAC7B,IAAA,WAAW,GAAG,KAAK,CAAS,EAAE,CAAC,CAAC;IAChC,aAAa,GAAG,KAAK,EAA0B,CAAC;IAChD,YAAY,GAAG,KAAK,EAAU,CAAC;IAC/B,aAAa,GAAG,KAAK,EAAU,CAAC;AAChC,IAAA,OAAO,GAAG,KAAK,CAAS,IAAI,CAAC,QAAQ,CAAC,CAAC;AAE7B,IAAA,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;AAC1B,IAAA,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;AAC3B,IAAA,aAAa,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AAE3B,IAAA,SAAS,CAAmB;AAE/C,IAAA,WAAA,GAAA;AACE,QAAA,IAAI,CAAC,SAAS,GAAG,MA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AAA,CAAA,EAAA,QAAA,EAAA,WAAW,cACT,IAAI,EAAA,OAAA,EACP,CAAC,0BAA0B,EAAE,OAAO,CAAC,EAAA,QAAA,EAAA,62DAAA,EAAA,CAAA;;;AERhD;;AAEG;;;;"}
@@ -0,0 +1,18 @@
1
+ /* Auto-generated — do not edit manually. Run: npm run translations */
2
+ const fallback = {
3
+ "platform.scala-ng.required": "Campo obrigatório",
4
+ "platform.scala-ng.min_length": "Mínimo {{ requiredLength }} caracteres",
5
+ "platform.scala-ng.max_length": "Máximo {{ requiredLength }} caracteres",
6
+ "platform.scala-ng.min": "Valor mínimo: {{ min }}",
7
+ "platform.scala-ng.max": "Valor máximo: {{ max }}",
8
+ "platform.scala-ng.email": "E-mail inválido",
9
+ "platform.scala-ng.pattern": "Formato inválido",
10
+ "platform.scala-ng.invalid_value": "Valor inválido"
11
+ };
12
+
13
+ /**
14
+ * Generated bundle index. Do not edit.
15
+ */
16
+
17
+ export { fallback };
18
+ //# sourceMappingURL=seniorsistemas-scala-ng-locale.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seniorsistemas-scala-ng-locale.mjs","sources":["../../projects/scala-ng/locale/fallback.ts","../../projects/scala-ng/locale/seniorsistemas-scala-ng-locale.ts"],"sourcesContent":["/* Auto-generated — do not edit manually. Run: npm run translations */\nexport const fallback: Record<string, string> = {\n \"platform.scala-ng.required\": \"Campo obrigatório\",\n \"platform.scala-ng.min_length\": \"Mínimo {{ requiredLength }} caracteres\",\n \"platform.scala-ng.max_length\": \"Máximo {{ requiredLength }} caracteres\",\n \"platform.scala-ng.min\": \"Valor mínimo: {{ min }}\",\n \"platform.scala-ng.max\": \"Valor máximo: {{ max }}\",\n \"platform.scala-ng.email\": \"E-mail inválido\",\n \"platform.scala-ng.pattern\": \"Formato inválido\",\n \"platform.scala-ng.invalid_value\": \"Valor inválido\"\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAA;AACa,MAAA,QAAQ,GAA2B;AAC5C,IAAA,4BAA4B,EAAE,mBAAmB;AACjD,IAAA,8BAA8B,EAAE,wCAAwC;AACxE,IAAA,8BAA8B,EAAE,wCAAwC;AACxE,IAAA,uBAAuB,EAAE,yBAAyB;AAClD,IAAA,uBAAuB,EAAE,yBAAyB;AAClD,IAAA,yBAAyB,EAAE,iBAAiB;AAC5C,IAAA,2BAA2B,EAAE,kBAAkB;AAC/C,IAAA,iCAAiC,EAAE,gBAAgB;;;ACTvD;;AAEG;;;;"}
@@ -0,0 +1,162 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, signal, Injectable, ElementRef, DestroyRef, input, Component } from '@angular/core';
3
+ import { DOCUMENT } from '@angular/common';
4
+
5
+ class ThemeService {
6
+ _document = inject(DOCUMENT);
7
+ mode = signal("light");
8
+ theme = signal(null);
9
+ setMode(mode) {
10
+ this.mode.set(mode);
11
+ const root = this._document.documentElement;
12
+ if (mode === "dark") {
13
+ root.setAttribute("data-mode", "dark");
14
+ }
15
+ else {
16
+ root.removeAttribute("data-mode");
17
+ }
18
+ }
19
+ setTheme(theme) {
20
+ this.theme.set(theme);
21
+ const root = this._document.documentElement;
22
+ if (theme) {
23
+ root.setAttribute("data-theme", theme);
24
+ }
25
+ else {
26
+ root.removeAttribute("data-theme");
27
+ }
28
+ }
29
+ toggleMode() {
30
+ this.setMode(this.mode() === "light" ? "dark" : "light");
31
+ }
32
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
33
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ThemeService, providedIn: "root" });
34
+ }
35
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ThemeService, decorators: [{
36
+ type: Injectable,
37
+ args: [{ providedIn: "root" }]
38
+ }] });
39
+
40
+ function buildBlock(selector, overrides) {
41
+ const declarations = Object.entries(overrides)
42
+ .map(([token, value]) => ` ${token}: ${value};`)
43
+ .join("\n");
44
+ return `${selector} {\n${declarations}\n}`;
45
+ }
46
+ /**
47
+ * Cria um tema que sobrescreve tokens semânticos do design system.
48
+ *
49
+ * O tema gera seletores CSS usando `[data-theme]` e `[data-mode]`, permitindo
50
+ * que múltiplos temas coexistam na mesma página sem conflito.
51
+ *
52
+ * Para ativar o tema no Angular, use o `ThemeService`:
53
+ * ```ts
54
+ * const produtoXTheme = createTheme('produto-x', { ... });
55
+ * produtoXTheme.mount();
56
+ *
57
+ * themeService.setTheme('produto-x');
58
+ * themeService.setMode('dark');
59
+ * ```
60
+ *
61
+ * @param name - Identificador único do tema. Usado no atributo `data-theme`.
62
+ * @param config - Overrides de tokens por modo (light, dark, variantes extras).
63
+ */
64
+ function createTheme(name, config) {
65
+ function generateCss() {
66
+ const rules = [];
67
+ if (config.light && Object.keys(config.light).length > 0) {
68
+ rules.push(buildBlock(`[data-theme="${name}"]`, config.light));
69
+ }
70
+ if (config.dark && Object.keys(config.dark).length > 0) {
71
+ rules.push(buildBlock(`[data-theme="${name}"][data-mode="dark"]`, config.dark));
72
+ }
73
+ if (config.variants) {
74
+ for (const [variantName, variant] of Object.entries(config.variants)) {
75
+ const baseOverrides = variant.base === "dark" && config.dark ? { ...config.dark } : {};
76
+ const merged = { ...baseOverrides, ...variant.overrides };
77
+ if (Object.keys(merged).length > 0) {
78
+ rules.push(buildBlock(`[data-theme="${name}"][data-mode="${variantName}"]`, merged));
79
+ }
80
+ }
81
+ }
82
+ return rules.join("\n\n");
83
+ }
84
+ let styleEl = null;
85
+ return {
86
+ name,
87
+ css: generateCss,
88
+ mount() {
89
+ if (typeof document === "undefined") {
90
+ return;
91
+ }
92
+ if (styleEl) {
93
+ return;
94
+ }
95
+ styleEl = document.createElement("style");
96
+ styleEl.setAttribute("data-sds-theme", name);
97
+ styleEl.textContent = generateCss();
98
+ document.head.appendChild(styleEl);
99
+ },
100
+ unmount() {
101
+ styleEl?.remove();
102
+ styleEl = null;
103
+ },
104
+ };
105
+ }
106
+
107
+ class SdsButtonComponent {
108
+ _el = inject((ElementRef));
109
+ _destroyRef = inject(DestroyRef);
110
+ _isButton = this._el.nativeElement.tagName === "BUTTON";
111
+ type = input("primary");
112
+ destructive = input(false);
113
+ disabled = input(false);
114
+ loading = input(false);
115
+ ngOnInit() {
116
+ const el = this._el.nativeElement;
117
+ const handler = (event) => {
118
+ if (this.disabled() || this.loading()) {
119
+ event.preventDefault();
120
+ event.stopImmediatePropagation();
121
+ }
122
+ };
123
+ el.addEventListener("click", handler, { capture: true });
124
+ this._destroyRef.onDestroy(() => el.removeEventListener("click", handler, { capture: true }));
125
+ }
126
+ _handleKeydown(event) {
127
+ const key = event.key;
128
+ if ((this.disabled() || this.loading()) && (key === "Enter" || key === " ")) {
129
+ event.preventDefault();
130
+ event.stopImmediatePropagation();
131
+ }
132
+ }
133
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SdsButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
134
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.14", type: SdsButtonComponent, isStandalone: true, selector: "button[sdsButton], a[sdsButton]", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, destructive: { classPropertyName: "destructive", publicName: "destructive", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keydown": "_handleKeydown($event)" }, properties: { "class.sds-button--secondary": "type() === \"secondary\"", "class.sds-button--ghost": "type() === \"ghost\"", "class.sds-button--destructive": "destructive()", "attr.aria-disabled": "disabled() ? \"true\" : null", "attr.aria-busy": "loading() ? \"true\" : null", "attr.tabindex": "disabled() ? \"-1\" : null", "attr.data-disabled": "disabled() ? \"\" : null", "attr.data-loading": "loading() ? \"\" : null", "attr.type": "_isButton ? \"button\" : null" } }, ngImport: i0, template: "<ng-content select=\"[sdsLeadingIcon]\" />\n<ng-content />\n<ng-content select=\"[sdsTrailingIcon]\" />\n", styles: [":host{--_bg: var(--sds-color-background-interactive-primary);--_bg-hover: var(--sds-color-background-interactive-primary-hovered);--_bg-active: var(--sds-color-background-interactive-primary-pressed);--_color: var(--sds-color-text-interactive-primary);--_border: transparent;appearance:none;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;justify-content:center;gap:var(--sds-space-1);padding:var(--sds-space-1-5);height:40px;border:1.5px solid var(--_border);border-radius:var(--sds-radius-medium);overflow:hidden;font-family:var(--sds-inter);font-size:var(--sds-font-size-2);font-weight:var(--sds-font-weight-medium);line-height:1.25;white-space:nowrap;background-color:var(--_bg);color:var(--_color)}:host:hover:not([data-disabled]):not([data-loading]){background-color:var(--_bg-hover)}:host:active:not([data-disabled]):not([data-loading]){background-color:var(--_bg-active)}:host.sds-button--secondary{--_bg: var(--sds-color-background-interactive-secondary);--_bg-hover: var(--sds-color-background-interactive-secondary-hovered);--_bg-active: var(--sds-color-background-interactive-secondary-pressed);--_color: var(--sds-color-text-interactive-secondary);--_border: var(--sds-color-border-interactive-secondary)}:host.sds-button--ghost{--_bg: transparent;--_bg-hover: var(--sds-color-background-interactive-secondary-hovered);--_bg-active: var(--sds-color-background-interactive-secondary-pressed);--_color: var(--sds-color-text-interactive-secondary)}:host.sds-button--destructive{--_bg: var(--sds-color-background-destructive-bold);--_bg-hover: var(--sds-color-background-destructive-bold-hovered);--_bg-active: var(--sds-color-background-destructive-bold-pressed);--_color: var(--sds-color-text-interactive-primary);--_border: transparent}:host.sds-button--secondary.sds-button--destructive{--_bg: var(--sds-color-background-destructive);--_bg-hover: var(--sds-color-background-destructive-hovered);--_bg-active: var(--sds-color-background-destructive-pressed);--_color: var(--sds-color-text-destructive);--_border: var(--sds-color-background-destructive-bold)}:host.sds-button--ghost.sds-button--destructive{--_bg: transparent;--_bg-hover: var(--sds-color-background-destructive);--_bg-active: var(--sds-color-background-destructive-hovered);--_color: var(--sds-color-text-destructive);--_border: transparent}:host[data-disabled]{--_bg: var(--sds-color-background-disable);--_color: var(--sds-color-text-disable);--_border: transparent;cursor:not-allowed}:host[data-disabled].sds-button--secondary{--_border: var(--sds-color-border-interactive-secondary)}:host[data-loading]{cursor:wait;opacity:.7}:host:focus-visible{outline:3px solid var(--sds-color-border-focused);outline-offset:0}:host .sds-button__icon{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:16px;height:16px}\n"] });
135
+ }
136
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SdsButtonComponent, decorators: [{
137
+ type: Component,
138
+ args: [{ selector: "button[sdsButton], a[sdsButton]", standalone: true, host: {
139
+ "[class.sds-button--secondary]": 'type() === "secondary"',
140
+ "[class.sds-button--ghost]": 'type() === "ghost"',
141
+ "[class.sds-button--destructive]": "destructive()",
142
+ "[attr.aria-disabled]": 'disabled() ? "true" : null',
143
+ "[attr.aria-busy]": 'loading() ? "true" : null',
144
+ "[attr.tabindex]": 'disabled() ? "-1" : null',
145
+ "[attr.data-disabled]": 'disabled() ? "" : null',
146
+ "[attr.data-loading]": 'loading() ? "" : null',
147
+ "[attr.type]": '_isButton ? "button" : null',
148
+ "(keydown)": "_handleKeydown($event)",
149
+ }, template: "<ng-content select=\"[sdsLeadingIcon]\" />\n<ng-content />\n<ng-content select=\"[sdsTrailingIcon]\" />\n", styles: [":host{--_bg: var(--sds-color-background-interactive-primary);--_bg-hover: var(--sds-color-background-interactive-primary-hovered);--_bg-active: var(--sds-color-background-interactive-primary-pressed);--_color: var(--sds-color-text-interactive-primary);--_border: transparent;appearance:none;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;justify-content:center;gap:var(--sds-space-1);padding:var(--sds-space-1-5);height:40px;border:1.5px solid var(--_border);border-radius:var(--sds-radius-medium);overflow:hidden;font-family:var(--sds-inter);font-size:var(--sds-font-size-2);font-weight:var(--sds-font-weight-medium);line-height:1.25;white-space:nowrap;background-color:var(--_bg);color:var(--_color)}:host:hover:not([data-disabled]):not([data-loading]){background-color:var(--_bg-hover)}:host:active:not([data-disabled]):not([data-loading]){background-color:var(--_bg-active)}:host.sds-button--secondary{--_bg: var(--sds-color-background-interactive-secondary);--_bg-hover: var(--sds-color-background-interactive-secondary-hovered);--_bg-active: var(--sds-color-background-interactive-secondary-pressed);--_color: var(--sds-color-text-interactive-secondary);--_border: var(--sds-color-border-interactive-secondary)}:host.sds-button--ghost{--_bg: transparent;--_bg-hover: var(--sds-color-background-interactive-secondary-hovered);--_bg-active: var(--sds-color-background-interactive-secondary-pressed);--_color: var(--sds-color-text-interactive-secondary)}:host.sds-button--destructive{--_bg: var(--sds-color-background-destructive-bold);--_bg-hover: var(--sds-color-background-destructive-bold-hovered);--_bg-active: var(--sds-color-background-destructive-bold-pressed);--_color: var(--sds-color-text-interactive-primary);--_border: transparent}:host.sds-button--secondary.sds-button--destructive{--_bg: var(--sds-color-background-destructive);--_bg-hover: var(--sds-color-background-destructive-hovered);--_bg-active: var(--sds-color-background-destructive-pressed);--_color: var(--sds-color-text-destructive);--_border: var(--sds-color-background-destructive-bold)}:host.sds-button--ghost.sds-button--destructive{--_bg: transparent;--_bg-hover: var(--sds-color-background-destructive);--_bg-active: var(--sds-color-background-destructive-hovered);--_color: var(--sds-color-text-destructive);--_border: transparent}:host[data-disabled]{--_bg: var(--sds-color-background-disable);--_color: var(--sds-color-text-disable);--_border: transparent;cursor:not-allowed}:host[data-disabled].sds-button--secondary{--_border: var(--sds-color-border-interactive-secondary)}:host[data-loading]{cursor:wait;opacity:.7}:host:focus-visible{outline:3px solid var(--sds-color-border-focused);outline-offset:0}:host .sds-button__icon{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:16px;height:16px}\n"] }]
150
+ }] });
151
+
152
+ /*
153
+ * Public API Surface of @seniorsistemas/scala-ng
154
+ */
155
+ // Theme
156
+
157
+ /**
158
+ * Generated bundle index. Do not edit.
159
+ */
160
+
161
+ export { SdsButtonComponent, ThemeService, createTheme };
162
+ //# sourceMappingURL=seniorsistemas-scala-ng.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seniorsistemas-scala-ng.mjs","sources":["../../projects/scala-ng/src/lib/theme/theme.service.ts","../../projects/scala-ng/src/lib/theme/create-theme.ts","../../projects/scala-ng/src/lib/components/button/button.component.ts","../../projects/scala-ng/src/lib/components/button/button.component.html","../../projects/scala-ng/src/public-api.ts","../../projects/scala-ng/src/seniorsistemas-scala-ng.ts"],"sourcesContent":["import { inject, Injectable, signal } from \"@angular/core\";\nimport { DOCUMENT } from \"@angular/common\";\n\nexport type Mode = \"light\" | \"dark\";\n\n@Injectable({ providedIn: \"root\" })\nexport class ThemeService {\n private readonly _document = inject(DOCUMENT);\n\n readonly mode = signal<Mode>(\"light\");\n readonly theme = signal<string | null>(null);\n\n setMode(mode: Mode): void {\n this.mode.set(mode);\n const root = this._document.documentElement;\n if (mode === \"dark\") {\n root.setAttribute(\"data-mode\", \"dark\");\n } else {\n root.removeAttribute(\"data-mode\");\n }\n }\n\n setTheme(theme: string | null): void {\n this.theme.set(theme);\n const root = this._document.documentElement;\n if (theme) {\n root.setAttribute(\"data-theme\", theme);\n } else {\n root.removeAttribute(\"data-theme\");\n }\n }\n\n toggleMode(): void {\n this.setMode(this.mode() === \"light\" ? \"dark\" : \"light\");\n }\n}\n","import type { SemanticToken } from \"./semantic-tokens\";\n\n/**\n * Overrides parciais dos tokens semânticos do design system.\n * Cada valor pode ser:\n * - Uma referência a outro token CSS: `'var(--sds-dark-solid-teal-9)'`\n * - Um valor CSS literal: `'#7c3aed'` ou `'rgb(124, 58, 237)'`\n */\nexport type ThemeOverrides = Partial<Record<SemanticToken, string>>;\n\n/**\n * Variante visual adicional além de light e dark.\n * Herda os tokens do modo definido em `base` (padrão: 'light') e sobrescreve\n * apenas os declarados em `overrides`.\n *\n * O seletor gerado é: `[data-theme=\"{name}\"][data-mode=\"{variantName}\"]`\n *\n * @example\n * modes: {\n * natal: {\n * overrides: { '--sds-color-background-interactive-primary': '#c0392b' },\n * },\n * halloween: {\n * base: 'dark',\n * overrides: { '--sds-color-background-interactive-primary': '#e67e22' },\n * },\n * }\n */\nexport interface ThemeVariant {\n base?: \"light\" | \"dark\";\n overrides: ThemeOverrides;\n}\n\nexport interface ThemeConfig {\n /** Tokens aplicados em `[data-theme=\"{name}\"]` (modo claro). */\n light?: ThemeOverrides;\n /** Tokens aplicados em `[data-theme=\"{name}\"][data-mode=\"dark\"]`. */\n dark?: ThemeOverrides;\n /**\n * Modos adicionais além de light e dark.\n * Tokens não declarados herdam do modo definido em `base` (padrão: 'light').\n */\n variants?: Record<string, ThemeVariant>;\n}\n\nexport interface SdsTheme {\n /** Nome do tema passado para `createTheme`. */\n readonly name: string;\n\n /**\n * Injeta os estilos do tema no `<head>` do documento como uma `<style>` tag.\n * Idempotente: chamar múltiplas vezes não duplica os estilos.\n * No-op em ambientes sem `document` (SSR).\n */\n mount(): void;\n\n /**\n * Remove a `<style>` tag previamente injetada por `mount()`.\n * No-op se o tema não estiver montado.\n */\n unmount(): void;\n\n /**\n * Retorna o CSS gerado como string, sem injetar no DOM.\n * Útil para SSR, extração para arquivo estático ou testes.\n */\n css(): string;\n}\n\nfunction buildBlock(selector: string, overrides: ThemeOverrides): string {\n const declarations = Object.entries(overrides)\n .map(([token, value]) => ` ${token}: ${value};`)\n .join(\"\\n\");\n return `${selector} {\\n${declarations}\\n}`;\n}\n\n/**\n * Cria um tema que sobrescreve tokens semânticos do design system.\n *\n * O tema gera seletores CSS usando `[data-theme]` e `[data-mode]`, permitindo\n * que múltiplos temas coexistam na mesma página sem conflito.\n *\n * Para ativar o tema no Angular, use o `ThemeService`:\n * ```ts\n * const produtoXTheme = createTheme('produto-x', { ... });\n * produtoXTheme.mount();\n *\n * themeService.setTheme('produto-x');\n * themeService.setMode('dark');\n * ```\n *\n * @param name - Identificador único do tema. Usado no atributo `data-theme`.\n * @param config - Overrides de tokens por modo (light, dark, variantes extras).\n */\nexport function createTheme(name: string, config: ThemeConfig): SdsTheme {\n function generateCss(): string {\n const rules: string[] = [];\n\n if (config.light && Object.keys(config.light).length > 0) {\n rules.push(buildBlock(`[data-theme=\"${name}\"]`, config.light));\n }\n\n if (config.dark && Object.keys(config.dark).length > 0) {\n rules.push(buildBlock(`[data-theme=\"${name}\"][data-mode=\"dark\"]`, config.dark));\n }\n\n if (config.variants) {\n for (const [variantName, variant] of Object.entries(config.variants)) {\n const baseOverrides = variant.base === \"dark\" && config.dark ? { ...config.dark } : {};\n const merged: ThemeOverrides = { ...baseOverrides, ...variant.overrides };\n\n if (Object.keys(merged).length > 0) {\n rules.push(buildBlock(`[data-theme=\"${name}\"][data-mode=\"${variantName}\"]`, merged));\n }\n }\n }\n\n return rules.join(\"\\n\\n\");\n }\n\n let styleEl: HTMLStyleElement | null = null;\n\n return {\n name,\n\n css: generateCss,\n\n mount(): void {\n if (typeof document === \"undefined\") {\n return;\n }\n\n if (styleEl) {\n return;\n }\n\n styleEl = document.createElement(\"style\");\n styleEl.setAttribute(\"data-sds-theme\", name);\n styleEl.textContent = generateCss();\n\n document.head.appendChild(styleEl);\n },\n\n unmount(): void {\n styleEl?.remove();\n styleEl = null;\n },\n };\n}\n","import { Component, DestroyRef, ElementRef, inject, input, OnInit } from \"@angular/core\";\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: \"button[sdsButton], a[sdsButton]\",\n standalone: true,\n templateUrl: \"./button.component.html\",\n styleUrl: \"./button.component.scss\",\n host: {\n \"[class.sds-button--secondary]\": 'type() === \"secondary\"',\n \"[class.sds-button--ghost]\": 'type() === \"ghost\"',\n \"[class.sds-button--destructive]\": \"destructive()\",\n \"[attr.aria-disabled]\": 'disabled() ? \"true\" : null',\n \"[attr.aria-busy]\": 'loading() ? \"true\" : null',\n \"[attr.tabindex]\": 'disabled() ? \"-1\" : null',\n \"[attr.data-disabled]\": 'disabled() ? \"\" : null',\n \"[attr.data-loading]\": 'loading() ? \"\" : null',\n \"[attr.type]\": '_isButton ? \"button\" : null',\n \"(keydown)\": \"_handleKeydown($event)\",\n },\n})\nexport class SdsButtonComponent implements OnInit {\n private readonly _el = inject(ElementRef<HTMLElement>);\n private readonly _destroyRef = inject(DestroyRef);\n protected readonly _isButton = this._el.nativeElement.tagName === \"BUTTON\";\n\n readonly type = input<\"primary\" | \"secondary\" | \"ghost\">(\"primary\");\n readonly destructive = input<boolean>(false);\n readonly disabled = input<boolean>(false);\n readonly loading = input<boolean>(false);\n\n ngOnInit(): void {\n const el = this._el.nativeElement;\n const handler = (event: Event): void => {\n if (this.disabled() || this.loading()) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n };\n el.addEventListener(\"click\", handler, { capture: true });\n this._destroyRef.onDestroy(() => el.removeEventListener(\"click\", handler, { capture: true }));\n }\n\n protected _handleKeydown(event: Event): void {\n const key = (event as KeyboardEvent).key;\n if ((this.disabled() || this.loading()) && (key === \"Enter\" || key === \" \")) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n }\n}\n","<ng-content select=\"[sdsLeadingIcon]\" />\n<ng-content />\n<ng-content select=\"[sdsTrailingIcon]\" />\n","/*\n * Public API Surface of @seniorsistemas/scala-ng\n */\n\n// Theme\nexport { ThemeService, type Mode } from \"./lib/theme/theme.service\";\nexport { createTheme, type ThemeConfig, type ThemeOverrides, type ThemeVariant, type SdsTheme } from \"./lib/theme/create-theme\";\nexport { type SemanticToken } from \"./lib/theme/semantic-tokens\";\n\n// Components\nexport { SdsButtonComponent } from \"./lib/components/button/button.component\";\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAMa,YAAY,CAAA;AACN,IAAA,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AAErC,IAAA,I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KACF;wGA5BU,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAlB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,kBAAkB,ynCCrB/B,2GAGA,EAAA,MAAA,EAAA,CAAA,iyFAAA,CAAA,EAAA,CAAA,CAAA;;4FDkBa,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAnB9B,SAAS;+BAEE,iCAAiC,EAAA,UAAA,EAC/B,IAAI,EAGV,IAAA,EAAA;AACJ,wBAAA,+BAA+B,EAAE,wBAAwB;AACzD,wBAAA,2BAA2B,EAAE,oBAAoB;AACjD,wBAAA,iCAAiC,EAAE,eAAe;AAClD,wBAAA,sBAAsB,EAAE,4BAA4B;AACpD,wBAAA,kBAAkB,EAAE,2BAA2B;AAC/C,wBAAA,iBAAiB,EAAE,0BAA0B;AAC7C,wBAAA,sBAAsB,EAAE,wBAAwB;AAChD,wBAAA,qBAAqB,EAAE,uBAAuB;AAC9C,wBAAA,aAAa,EAAE,6BAA6B;AAC5C,wBAAA,WAAW,EAAE,wBAAwB;AACtC,qBAAA,EAAA,QAAA,EAAA,2GAAA,EAAA,MAAA,EAAA,CAAA,iyFAAA,CAAA,EAAA,CAAA;;;AEnBH;;AAEG;AAEH;;ACJA;;AAEG;;;;"}
package/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@seniorsistemas/scala-ng" />
5
+ export * from './public-api';
@@ -0,0 +1,160 @@
1
+ # SdsInputComponent
2
+
3
+ > Scala Design System — `@seniorsistemas/scala-ng/input`
4
+
5
+ Campo de texto completo e acessível, integrado com Angular Forms via `ControlValueAccessor`. Suporta `ngModel` e `formControl`, exibe feedback de validação inline e adapta seu visual ao estado do controle.
6
+
7
+ ---
8
+
9
+ ## Usage
10
+
11
+ Substitui um `<input>` + `<sds-input-validator>` manual por um único componente autocontido. Basta importar e usar com `[formControl]` ou `[(ngModel)]`.
12
+
13
+ ## Anatomy
14
+
15
+ | Elemento | Papel |
16
+ | -------------------------------- | ------------------------------------------------------------------------------- |
17
+ | `<label>` | Vinculado ao input via `[for]`; contém o `label` e, opcionalmente, o `subtitle` |
18
+ | Asterisco `*` | Indicador visual de campo obrigatório (`aria-hidden`) |
19
+ | Ícone de info (`fa-circle-info`) | Ícone decorativo no cabeçalho (`aria-hidden`) |
20
+ | Wrapper do input | Container estilizado com borda reativa ao estado de foco e validação |
21
+ | Ícone prefixo (`icon`) | Ícone FontAwesome opcional à esquerda do campo (`aria-hidden`) |
22
+ | `<input>` | Elemento nativo vinculado ao `ControlValueAccessor` |
23
+ | `<sds-input-validator>` | Renderizado condicionalmente quando `errorMessages` é fornecido |
24
+
25
+ ## Behavior
26
+
27
+ - A borda do wrapper reage ao estado do controle:
28
+ - **Focused** — `border-color-border-focused`
29
+ - **Touched + inválido** — `border-color-border-destructive`
30
+ - **Touched + válido** — `border-color-border-positive`
31
+ - **Não tocado** — `border-color-border-interactive-secondary`
32
+ - O `<sds-input-validator>` é renderizado apenas quando `errorMessages` é fornecido e o componente está vinculado a um controle Angular Forms.
33
+ - Suporta `setDisabledState` do `ControlValueAccessor` — o input nativo é desabilitado via `[attr.disabled]`.
34
+ - A propriedade `inputId` é gerada automaticamente com um sufixo incremental para garantir unicidade; pode ser sobrescrita via input.
35
+
36
+ ## Accessibility
37
+
38
+ - O `<label>` usa `[for]="inputId"` para associar corretamente ao input nativo.
39
+ - Ícones decorativos (info, prefixo) são marcados com `aria-hidden="true"`.
40
+ - O asterisco de obrigatoriedade é `aria-hidden="true"` — a obrigatoriedade deve ser comunicada também via `validMessage` ou `adviceMessage` para usuários de tecnologia assistiva.
41
+ - O `<sds-input-validator>` interno herda toda a acessibilidade de `aria-live` e `role="alert"`.
42
+
43
+ ## Best Practices
44
+
45
+ **Quando usar**
46
+
47
+ - Sempre que precisar de um campo de texto com validação visual integrada em formulários reativos ou template-driven.
48
+
49
+ **Quando não usar**
50
+
51
+ - Para `<textarea>` — este componente é exclusivo para inputs de linha única.
52
+ - Quando não há controle Angular Forms associado e o `<sds-input-validator>` não é necessário — nesse caso, use um `<input>` nativo diretamente.
53
+
54
+ **Antipadrões comuns**
55
+
56
+ - Não passe `errorMessages` como objeto inline no template (`[errorMessages]="{ required: '...' }"`); isso recria o objeto a cada ciclo de detecção de mudanças — declare-o no componente pai.
57
+ - Não omita `errorMessages` esperando que o validator apareça — ele só é renderizado quando a propriedade está presente.
58
+
59
+ ## Content Guidelines
60
+
61
+ - `label` deve identificar o campo de forma clara e concisa (ex.: "E-mail", "Nome completo").
62
+ - `subtitle` é indicado para complementos breves como "(Opcional)" ou "(Obrigatório)".
63
+ - `placeholder` deve dar um exemplo de valor esperado (ex.: "Ex: joao@email.com"), não repetir o label.
64
+
65
+ ---
66
+
67
+ ## Installation
68
+
69
+ ```bash
70
+ npm install @seniorsistemas/scala-ng
71
+ ```
72
+
73
+ Importe o componente diretamente no seu standalone component:
74
+
75
+ ```typescript
76
+ import { SdsInputComponent } from "@seniorsistemas/scala-ng/input";
77
+
78
+ @Component({
79
+ imports: [SdsInputComponent, ReactiveFormsModule],
80
+ })
81
+ export class MyComponent {}
82
+ ```
83
+
84
+ ## Properties
85
+
86
+ | Propriedade | Tipo | Padrão | Obrigatório | Descrição |
87
+ | --------------- | ------------------------ | ----------- | ----------- | -------------------------------------------------------------------------------------------------- |
88
+ | `label` | `string` | — | ✅ | Texto do label exibido acima do campo. |
89
+ | `subtitle` | `string` | `undefined` | ❌ | Texto complementar ao label (ex.: "(Opcional)"). |
90
+ | `icon` | `string` | `undefined` | ❌ | Nome do ícone FontAwesome 7 a exibir à esquerda do input (ex.: `"envelope"`, `"phone"`). |
91
+ | `type` | `string` | `"text"` | ❌ | Tipo do input nativo (`"text"`, `"password"`, `"email"`, `"number"`, etc.). |
92
+ | `placeholder` | `string` | `""` | ❌ | Texto de placeholder do input nativo. |
93
+ | `errorMessages` | `Record<string, string>` | `undefined` | ❌ | Mapeamento entre chave de erro e mensagem de exibição. Quando fornecido, renderiza o validator. |
94
+ | `validMessage` | `string` | `undefined` | ❌ | Mensagem exibida quando o campo está válido (repassada ao `sds-input-validator`). |
95
+ | `adviceMessage` | `string` | `undefined` | ❌ | Mensagem de orientação exibida quando o campo ainda não foi tocado (repassada ao validator). |
96
+ | `inputId` | `string` | auto-gerado | ❌ | ID do elemento `<input>`. Gerado automaticamente; sobrescreva se necessário para controle externo. |
97
+
98
+ ---
99
+
100
+ ## Examples
101
+
102
+ ### Campo obrigatório com validação
103
+
104
+ ```typescript
105
+ import { Component } from "@angular/core";
106
+ import { FormControl, ReactiveFormsModule, Validators } from "@angular/forms";
107
+ import { SdsInputComponent } from "@seniorsistemas/scala-ng/input";
108
+
109
+ @Component({
110
+ selector: "app-example",
111
+ imports: [ReactiveFormsModule, SdsInputComponent],
112
+ template: `
113
+ <sds-input
114
+ label="E-mail"
115
+ icon="envelope"
116
+ placeholder="Ex: joao@email.com"
117
+ [formControl]="emailControl"
118
+ [errorMessages]="emailErrors"
119
+ validMessage="E-mail válido."
120
+ />
121
+ `,
122
+ })
123
+ export class ExampleComponent {
124
+ readonly emailControl = new FormControl("", [Validators.required, Validators.email]);
125
+
126
+ readonly emailErrors: Record<string, string> = {
127
+ required: "E-mail é obrigatório.",
128
+ email: "Informe um e-mail válido.",
129
+ };
130
+ }
131
+ ```
132
+
133
+ ### Campo com ngModel
134
+
135
+ ```html
136
+ <sds-input label="Nome" subtitle="(Opcional)" placeholder="Ex: João da Silva" [(ngModel)]="name" />
137
+ ```
138
+
139
+ ### Campo sem validação (sem validator)
140
+
141
+ ```html
142
+ <sds-input label="Observações" placeholder="Digite aqui..." [(ngModel)]="notes" />
143
+ ```
144
+
145
+ O `<sds-input-validator>` não é renderizado quando `errorMessages` é omitido.
146
+
147
+ ---
148
+
149
+ ## Patch Notes
150
+
151
+ ### [1.0.0] — 2026-05-11
152
+
153
+ #### Added
154
+
155
+ - Componente `SdsInputComponent` com integração `ControlValueAccessor` (suporte a `formControl` e `ngModel`).
156
+ - Inputs `label` (obrigatório), `subtitle`, `icon`, `type`, `placeholder`, `inputId`.
157
+ - Inputs `errorMessages`, `validMessage`, `adviceMessage` com renderização condicional do `sds-input-validator`.
158
+ - Borda reativa ao estado do controle (focused, error, success, default).
159
+ - Suporte a `setDisabledState` via `ControlValueAccessor`.
160
+ - Acessibilidade com `<label [for]>` e ícones `aria-hidden`.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@seniorsistemas/scala-ng/input" />
5
+ export * from './public-api';
@@ -0,0 +1 @@
1
+ export { SdsInputComponent } from "./src/input/input.component";
@@ -0,0 +1,33 @@
1
+ import { AbstractControl, ControlValueAccessor, NgControl } from "@angular/forms";
2
+ import * as i0 from "@angular/core";
3
+ export declare class SdsInputComponent implements ControlValueAccessor {
4
+ private static idCounter;
5
+ protected readonly _inputId: string;
6
+ readonly label: import("@angular/core").InputSignal<string>;
7
+ readonly subtitle: import("@angular/core").InputSignal<string | undefined>;
8
+ readonly icon: import("@angular/core").InputSignal<string | undefined>;
9
+ readonly type: import("@angular/core").InputSignal<string>;
10
+ readonly placeholder: import("@angular/core").InputSignal<string>;
11
+ readonly errorMessages: import("@angular/core").InputSignal<Record<string, string> | undefined>;
12
+ readonly validMessage: import("@angular/core").InputSignal<string | undefined>;
13
+ readonly adviceMessage: import("@angular/core").InputSignal<string | undefined>;
14
+ readonly inputId: import("@angular/core").InputSignal<string>;
15
+ protected readonly isFocused: import("@angular/core").WritableSignal<boolean>;
16
+ protected readonly isDisabled: import("@angular/core").WritableSignal<boolean>;
17
+ protected readonly internalValue: import("@angular/core").WritableSignal<string>;
18
+ protected readonly ngControl: NgControl | null;
19
+ constructor();
20
+ protected get borderClass(): Record<string, boolean>;
21
+ protected get control(): AbstractControl;
22
+ protected handleInput(event: Event): void;
23
+ protected handleBlur(): void;
24
+ protected handleFocus(): void;
25
+ writeValue(value: string): void;
26
+ registerOnChange(fn: (value: string) => void): void;
27
+ registerOnTouched(fn: () => void): void;
28
+ setDisabledState(isDisabled: boolean): void;
29
+ private onChange;
30
+ private onTouched;
31
+ static ɵfac: i0.ɵɵFactoryDeclaration<SdsInputComponent, never>;
32
+ static ɵcmp: i0.ɵɵComponentDeclaration<SdsInputComponent, "sds-input", never, { "label": { "alias": "label"; "required": true; "isSignal": true; }; "subtitle": { "alias": "subtitle"; "required": false; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "errorMessages": { "alias": "errorMessages"; "required": false; "isSignal": true; }; "validMessage": { "alias": "validMessage"; "required": false; "isSignal": true; }; "adviceMessage": { "alias": "adviceMessage"; "required": false; "isSignal": true; }; "inputId": { "alias": "inputId"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
33
+ }