Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Task/extend toggle component to support disabled state (#7585)
Thomas Kauld2ad879ddec8
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 5b9af6f4d9..a3714bcdd8 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Changed+- Extended the toggle component to support a disabled state- Extended the toggle component to support icons## 3.46.0 - 2026-08-09diff --git a/libs/ui/src/lib/toggle/toggle.component.html b/libs/ui/src/lib/toggle/toggle.component.htmlindex 8ad5d75b36..bec1bfab3f 100644--- a/libs/ui/src/lib/toggle/toggle.component.html+++ b/libs/ui/src/lib/toggle/toggle.component.html@@ -9,9 +9,11 @@[class]="{'cursor-default': option.value === optionFormControl.value,'cursor-pointer':- !isLoading() && option.value !== optionFormControl.value+ !isDisabled() &&+ !isLoading() &&+ option.value !== optionFormControl.value}"- [disabled]="isLoading()"+ [disabled]="isDisabled() || isLoading()"[title]="option.title ?? ''"[value]="option.value">diff --git a/libs/ui/src/lib/toggle/toggle.component.scss b/libs/ui/src/lib/toggle/toggle.component.scssindex 24d1a29759..76e2404abe 100644--- a/libs/ui/src/lib/toggle/toggle.component.scss+++ b/libs/ui/src/lib/toggle/toggle.component.scss@@ -9,6 +9,14 @@background-color: rgba(var(--dark-dividers));}+ &.mat-mdc-radio-disabled {+ ::ng-deep {+ label {+ color: rgba(var(--dark-disabled-text));+ }+ }+ }+::ng-deep {.mdc-radio {display: none;@@ -31,6 +39,14 @@border: 1px solid rgba(var(--light-disabled-text));}+ &.mat-mdc-radio-disabled {+ ::ng-deep {+ label {+ color: rgba(var(--light-disabled-text));+ }+ }+ }+::ng-deep {label {color: rgba(var(--light-primary-text), 1);diff --git a/libs/ui/src/lib/toggle/toggle.component.stories.ts b/libs/ui/src/lib/toggle/toggle.component.stories.tsindex 30af31c422..f93754c7e2 100644--- a/libs/ui/src/lib/toggle/toggle.component.stories.ts+++ b/libs/ui/src/lib/toggle/toggle.component.stories.ts@@ -26,6 +26,22 @@ type Story = StoryObj<GfToggleComponent>;export const Default: Story = {args: {defaultValue: '1d',+ isDisabled: false,+ isLoading: false,+ options: [+ { label: 'Today', value: '1d' },+ { label: 'YTD', value: 'ytd' },+ { label: '1Y', value: '1y' },+ { label: '5Y', value: '5y' },+ { label: 'Max', value: 'max' }+ ]+ }+};++export const Disabled: Story = {+ args: {+ defaultValue: '1d',+ isDisabled: true,isLoading: false,options: [{ label: 'Today', value: '1d' },@@ -40,6 +56,7 @@ export const Default: Story = {export const WithIcons: Story = {args: {defaultValue: 'TABLE',+ isDisabled: false,isLoading: false,options: [{diff --git a/libs/ui/src/lib/toggle/toggle.component.ts b/libs/ui/src/lib/toggle/toggle.component.tsindex fe8db17a3e..bf9259fd86 100644--- a/libs/ui/src/lib/toggle/toggle.component.ts+++ b/libs/ui/src/lib/toggle/toggle.component.ts@@ -20,6 +20,7 @@ import { IonIcon } from '@ionic/angular/standalone';})export class GfToggleComponent {public readonly defaultValue = input.required<string>();+ public readonly isDisabled = input<boolean>(false);public readonly isLoading = input<boolean>(false);public readonly options = input<ToggleOption[]>([]);