diff --git a/projects/design-angular-kit/src/lib/components/core/alert/alert.component.spec.ts b/projects/design-angular-kit/src/lib/components/core/alert/alert.component.spec.ts index c96fa2201..d3c3a9684 100644 --- a/projects/design-angular-kit/src/lib/components/core/alert/alert.component.spec.ts +++ b/projects/design-angular-kit/src/lib/components/core/alert/alert.component.spec.ts @@ -60,4 +60,18 @@ describe('ItAlertComponent', () => { const spanElement = fixture.debugElement.query(By.css('div.alert.alert-success')); expect(spanElement).toBeTruthy(); }); + + it('should accept a custom-generated color (e.g. primary-a1 from Bootstrap Italia HSB)', () => { + component.selectedColor = 'primary-a1'; + fixture.detectChanges(); + const el = fixture.debugElement.query(By.css('div.alert.alert-primary-a1')); + expect(el).toBeTruthy(); + }); + + it('should accept an analogue custom color (e.g. analogue-1-a2)', () => { + component.selectedColor = 'analogue-1-a2'; + fixture.detectChanges(); + const el = fixture.debugElement.query(By.css('div.alert.alert-analogue-1-a2')); + expect(el).toBeTruthy(); + }); }); diff --git a/projects/design-angular-kit/src/lib/interfaces/core.ts b/projects/design-angular-kit/src/lib/interfaces/core.ts index dbd7640fe..685100ff0 100644 --- a/projects/design-angular-kit/src/lib/interfaces/core.ts +++ b/projects/design-angular-kit/src/lib/interfaces/core.ts @@ -1,6 +1,6 @@ import { IconName } from './icon'; -export type AlertColor = 'primary' | 'info' | 'success' | 'warning' | 'danger'; +export type AlertColor = 'primary' | 'info' | 'success' | 'warning' | 'danger' | (string & {}); export type ButtonColor = | 'primary' @@ -19,23 +19,24 @@ export type ButtonColor = | 'outline-light' | 'dark' | 'outline-dark' - | 'link'; + | 'link' + | (string & {}); export type ButtonSize = 'lg' | 'sm' | 'xs'; export type ButtonType = 'submit' | 'button'; -export type CalloutColor = 'success' | 'warning' | 'danger' | 'important' | 'note'; +export type CalloutColor = 'success' | 'warning' | 'danger' | 'important' | 'note' | (string & {}); export type CalloutAppearance = 'default' | 'highlight' | 'more'; -export type ChipColor = 'primary' | 'secondary' | 'success' | 'danger' | 'warning'; +export type ChipColor = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | (string & {}); export type ElementPlacement = 'top' | 'bottom' | 'left' | 'right'; -export type ProgressBarColor = 'primary' | 'success' | 'warning' | 'danger' | 'info'; +export type ProgressBarColor = 'primary' | 'success' | 'warning' | 'danger' | 'info' | (string & {}); -export type BadgeColor = 'primary' | 'secondary' | 'success' | 'warning' | 'danger'; +export type BadgeColor = 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | (string & {}); -export type TableColor = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'light' | 'dark'; +export type TableColor = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'light' | 'dark' | (string & {}); export type TableHeadColor = 'light' | 'dark'; diff --git a/projects/design-angular-kit/src/lib/interfaces/icon.ts b/projects/design-angular-kit/src/lib/interfaces/icon.ts index 8ea97937d..51679ca12 100644 --- a/projects/design-angular-kit/src/lib/interfaces/icon.ts +++ b/projects/design-angular-kit/src/lib/interfaces/icon.ts @@ -1,6 +1,6 @@ export type IconSize = 'xs' | 'sm' | 'lg' | 'xl'; -export type IconColor = 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'light' | 'white'; +export type IconColor = 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'light' | 'white' | (string & {}); export type IconName = (typeof IconNameArray)[number]; diff --git a/src/app/alert/alert-custom-color-example/alert-custom-color-example.component.html b/src/app/alert/alert-custom-color-example/alert-custom-color-example.component.html new file mode 100644 index 000000000..94219e66a --- /dev/null +++ b/src/app/alert/alert-custom-color-example/alert-custom-color-example.component.html @@ -0,0 +1,15 @@ +
+ Tutti i componenti con input di colore (AlertColor, ButtonColor, BadgeColor, ecc.) accettano anche
+ stringhe custom oltre ai colori predefiniti. Questo permette di utilizzare le classi CSS generate dal tema Bootstrap Italia
+ personalizzato.
+
alert-teal viene applicata. Richiede che il tema CSS definisca
+ .alert-teal.
+alert-indigo.