From 891f900d3122cbeb71ed221bd1798f75d712d567 Mon Sep 17 00:00:00 2001 From: Alex <25013571+alexhb1@users.noreply.github.com> Date: Wed, 1 Jul 2026 10:31:44 +0100 Subject: [PATCH] refactor(ui): migrate controls to lucide (#1840) --- .../design-system.component.html | 44 +++-- .../design-system/design-system.component.ts | 40 ++++- .../forms/device-form.component.html | 14 +- .../forms/device-form.component.ts | 7 + .../forms/everything-form.component.html | 8 +- .../forms/everything-form.component.ts | 4 + .../forms/library-form.component.html | 8 +- .../forms/library-form.component.ts | 4 + .../ui/accordion/app-accordion.component.ts | 7 +- .../app-autocomplete.component.ts | 4 +- .../app-multi-autocomplete.component.ts | 4 +- .../shared/ui/button/app-button.component.ts | 14 +- .../app-date-picker-base.directive.ts | 8 +- .../date-picker/app-date-picker.component.ts | 3 +- .../app-date-range-picker.component.ts | 3 +- .../shared/ui/input/app-input.component.ts | 159 +++++++----------- .../app/shared/ui/input/app-input.variants.ts | 4 +- .../ui/message/app-message.component.ts | 16 +- .../shared/ui/message/app-message.variants.ts | 13 +- .../app-number-input.component.ts | 6 +- .../shared/ui/rating/app-rating.component.ts | 7 +- .../ui/select/app-multi-select.component.ts | 16 +- .../shared/ui/select/app-select.component.ts | 16 +- .../app-split-button.component.ts | 10 +- .../app/shared/ui/tabs/app-tabs.component.ts | 9 +- .../app/shared/ui/tag/app-tag.component.ts | 13 +- .../ui/textarea/app-textarea.component.ts | 4 +- 27 files changed, 233 insertions(+), 212 deletions(-) diff --git a/frontend/src/app/features/design-system/design-system.component.html b/frontend/src/app/features/design-system/design-system.component.html index 59bc6070b..fb38a1cf1 100644 --- a/frontend/src/app/features/design-system/design-system.component.html +++ b/frontend/src/app/features/design-system/design-system.component.html @@ -2,9 +2,9 @@ @@ -21,8 +21,7 @@ [tone]="example.tone" [variant]="example.variant" [size]="size" - icon="pi pi-bolt" - [label]="size" /> + [label]="size"> } @@ -30,9 +29,9 @@
- - - + + +
@@ -45,18 +44,15 @@ + [model]="menuItems"> + [model]="menuItems"> + [model]="menuItems"> @@ -90,20 +86,20 @@
Trailing Action - +
Leading Icon - +
Leading + Trailing + value="Search text"> + + +
@@ -481,7 +477,7 @@ {{ item.title }} - + {{ item.body }} @@ -491,7 +487,7 @@
- {{ item.title }} + {{ item.title }} {{ item.body }} @@ -515,7 +511,7 @@

Menus

- +
@@ -550,7 +546,7 @@
- + Projected content
diff --git a/frontend/src/app/features/design-system/design-system.component.ts b/frontend/src/app/features/design-system/design-system.component.ts index 43eedf117..0caf499ca 100644 --- a/frontend/src/app/features/design-system/design-system.component.ts +++ b/frontend/src/app/features/design-system/design-system.component.ts @@ -3,6 +3,25 @@ import { CdkScrollable } from '@angular/cdk/scrolling'; import { Router } from '@angular/router'; import { email, form, FormField, minLength, required, validate } from '@angular/forms/signals'; import { MenuItem } from 'primeng/api'; +import { + LucideChevronLeft, + LucideDownload, + LucideEllipsisVertical, + LucideFile, + LucideFolder, + LucideFolderOpen, + LucideHeart, + LucideList, + LucideSave, + LucideSearch, + LucideSettings, + LucideSmartphone, + LucideTag, + LucideTrash2, + LucideTriangleAlert, + LucideX, + LucideZap, +} from '@lucide/angular'; import { AppAccordionComponent } from '../../shared/ui/accordion/app-accordion.component'; import { AppAccordionActionsDirective, @@ -76,6 +95,21 @@ interface ButtonExample { AppTagComponent, AppTextareaComponent, AppTooltipDirective, + LucideFolder, + LucideSmartphone, + LucideList, + LucideZap, + LucideChevronLeft, + LucideHeart, + LucideSave, + LucideSettings, + LucideEllipsisVertical, + LucideFolderOpen, + LucideDownload, + LucideTrash2, + LucideSearch, + LucideX, + LucideTriangleAlert, FormField, ], templateUrl: './design-system.component.html', @@ -137,9 +171,9 @@ export class DesignSystemComponent { ]; readonly settingsTabs: TabItem[] = [ - { id: 'general', label: 'General', icon: 'pi pi-cog' }, - { id: 'metadata', label: 'Metadata', icon: 'pi pi-tag' }, - { id: 'formats', label: 'Formats', icon: 'pi pi-file' }, + { id: 'general', label: 'General', icon: LucideSettings.icon }, + { id: 'metadata', label: 'Metadata', icon: LucideTag.icon }, + { id: 'formats', label: 'Formats', icon: LucideFile.icon }, ]; readonly manyTabs: TabItem[] = [ { id: 'general', label: 'General' }, diff --git a/frontend/src/app/features/design-system/forms/device-form.component.html b/frontend/src/app/features/design-system/forms/device-form.component.html index 183010e37..9f2dd48a6 100644 --- a/frontend/src/app/features/design-system/forms/device-form.component.html +++ b/frontend/src/app/features/design-system/forms/device-form.component.html @@ -4,10 +4,9 @@ + (clicked)="back()">

Device settings

@@ -18,7 +17,7 @@ @if (deviceForm().submitting()) { - + }
@@ -27,7 +26,7 @@

- Hardcover + Hardcover

@@ -44,7 +43,7 @@

- Kobo + Kobo

@@ -77,7 +76,7 @@

- KOReader + KOReader

@@ -103,9 +102,8 @@ type="submit" tone="primary" label="Save settings" - icon="pi pi-save" [loading]="deviceForm().submitting()" - [disabled]="deviceForm().submitting()" /> + [disabled]="deviceForm().submitting()"> @if (submitState() === 'saved') { diff --git a/frontend/src/app/features/design-system/forms/device-form.component.ts b/frontend/src/app/features/design-system/forms/device-form.component.ts index 56866c7dd..9779ba39e 100644 --- a/frontend/src/app/features/design-system/forms/device-form.component.ts +++ b/frontend/src/app/features/design-system/forms/device-form.component.ts @@ -11,6 +11,7 @@ import { AppNumberInputComponent } from '../../../shared/ui/number-input/app-num import { AppSliderComponent } from '../../../shared/ui/slider/app-slider.component'; import { AppSwitchComponent } from '../../../shared/ui/switch/app-switch.component'; import { AppTagComponent } from '../../../shared/ui/tag/app-tag.component'; +import { LucideBook, LucideChevronLeft, LucideLoaderCircle, LucideSave, LucideSmartphone, LucideTablet } from '@lucide/angular'; interface DeviceFormModel { hardcover: { enabled: boolean; apiKey: string }; @@ -57,6 +58,12 @@ function createInitialModel(): DeviceFormModel { AppSliderComponent, AppSwitchComponent, AppTagComponent, + LucideBook, + LucideSmartphone, + LucideTablet, + LucideChevronLeft, + LucideSave, + LucideLoaderCircle, ], templateUrl: './device-form.component.html', changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/frontend/src/app/features/design-system/forms/everything-form.component.html b/frontend/src/app/features/design-system/forms/everything-form.component.html index 84cbcb904..41e9acb11 100644 --- a/frontend/src/app/features/design-system/forms/everything-form.component.html +++ b/frontend/src/app/features/design-system/forms/everything-form.component.html @@ -4,10 +4,9 @@ + (clicked)="back()">

Everything

@@ -18,7 +17,7 @@ @if (everythingForm().submitting()) { - + }
@@ -95,9 +94,8 @@ type="submit" tone="primary" label="Save" - icon="pi pi-save" [loading]="everythingForm().submitting()" - [disabled]="everythingForm().submitting()" /> + [disabled]="everythingForm().submitting()"> @if (submitState() === 'saved') { diff --git a/frontend/src/app/features/design-system/forms/everything-form.component.ts b/frontend/src/app/features/design-system/forms/everything-form.component.ts index eecdc0c73..44a4dbd08 100644 --- a/frontend/src/app/features/design-system/forms/everything-form.component.ts +++ b/frontend/src/app/features/design-system/forms/everything-form.component.ts @@ -22,6 +22,7 @@ import { AppDateRangePickerComponent, type DatePickerRange } from '../../../shar import { AppMessageComponent } from '../../../shared/ui/message/app-message.component'; import { AppTagComponent } from '../../../shared/ui/tag/app-tag.component'; import { type SelectOption } from '../../../shared/ui/select/app-select.options'; +import { LucideChevronLeft, LucideLoaderCircle, LucideSave } from '@lucide/angular'; interface EverythingFormModel { text: string; @@ -86,6 +87,9 @@ function createInitialModel(): EverythingFormModel { AppDateRangePickerComponent, AppMessageComponent, AppTagComponent, + LucideChevronLeft, + LucideSave, + LucideLoaderCircle, ], templateUrl: './everything-form.component.html', changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/frontend/src/app/features/design-system/forms/library-form.component.html b/frontend/src/app/features/design-system/forms/library-form.component.html index 1bf2183be..55dbaf52c 100644 --- a/frontend/src/app/features/design-system/forms/library-form.component.html +++ b/frontend/src/app/features/design-system/forms/library-form.component.html @@ -4,10 +4,9 @@ + (clicked)="back()">

Create library

@@ -18,7 +17,7 @@ @if (libraryForm().submitting()) { - + }
@@ -63,9 +62,8 @@ type="submit" tone="primary" label="Save library" - icon="pi pi-save" [loading]="libraryForm().submitting()" - [disabled]="libraryForm().submitting()" /> + [disabled]="libraryForm().submitting()"> @if (submitState() === 'saved') { diff --git a/frontend/src/app/features/design-system/forms/library-form.component.ts b/frontend/src/app/features/design-system/forms/library-form.component.ts index 859e183d7..7bcace3ca 100644 --- a/frontend/src/app/features/design-system/forms/library-form.component.ts +++ b/frontend/src/app/features/design-system/forms/library-form.component.ts @@ -14,6 +14,7 @@ import { AppSelectComponent } from '../../../shared/ui/select/app-select.compone import { AppSwitchComponent } from '../../../shared/ui/switch/app-switch.component'; import { AppTagComponent } from '../../../shared/ui/tag/app-tag.component'; import { type SelectOption } from '../../../shared/ui/select/app-select.options'; +import { LucideChevronLeft, LucideLoaderCircle, LucideSave } from '@lucide/angular'; type OrganizationMode = 'BOOK_PER_FILE' | 'BOOK_PER_FOLDER'; type MetadataSource = 'EMBEDDED' | 'SIDECAR' | 'PREFER_SIDECAR' | 'PREFER_EMBEDDED' | 'NONE'; @@ -61,6 +62,9 @@ function createInitialModel(): LibraryFormModel { AppSelectComponent, AppSwitchComponent, AppTagComponent, + LucideChevronLeft, + LucideSave, + LucideLoaderCircle, ], templateUrl: './library-form.component.html', changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/frontend/src/app/shared/ui/accordion/app-accordion.component.ts b/frontend/src/app/shared/ui/accordion/app-accordion.component.ts index 48f4c532a..b98b950cd 100644 --- a/frontend/src/app/shared/ui/accordion/app-accordion.component.ts +++ b/frontend/src/app/shared/ui/accordion/app-accordion.component.ts @@ -9,6 +9,7 @@ import { numberAttribute, } from '@angular/core'; import { AccordionContent, AccordionGroup, AccordionPanel, AccordionTrigger } from '@angular/aria/accordion'; +import { LucideChevronDown } from '@lucide/angular'; import { AppAccordionActionsDirective, @@ -20,7 +21,7 @@ import { neutralControlBorderClass } from '../control.styles'; @Component({ selector: 'app-accordion', standalone: true, - imports: [NgTemplateOutlet, AccordionGroup, AccordionPanel, AccordionTrigger, AccordionContent], + imports: [NgTemplateOutlet, AccordionGroup, AccordionPanel, AccordionTrigger, AccordionContent, LucideChevronDown], host: { class: 'block' }, changeDetection: ChangeDetectionStrategy.OnPush, template: ` @@ -46,7 +47,7 @@ import { neutralControlBorderClass } from '../control.styles'; {{ item }} } - +
@if (actionsTemplate(); as tpl) { @@ -104,7 +105,7 @@ export class AppAccordionComponent { protected readonly labelClass = 'min-w-0 flex-1 pr-7 text-left'; protected readonly labelWithActionsClass = 'min-w-0 flex-1 pr-24 text-left'; protected readonly chevronClass = - 'pi pi-chevron-down pointer-events-none absolute right-3 top-1/2 shrink-0 -translate-y-1/2 text-xs text-text-muted transition-transform duration-200'; + 'pointer-events-none absolute right-3 top-1/2 size-4 shrink-0 -translate-y-1/2 text-text-muted transition-transform duration-200'; protected readonly actionsOverlayClass = 'pointer-events-none absolute inset-y-0 right-8 flex items-center'; protected readonly actionsClass = 'pointer-events-auto flex shrink-0 items-center gap-1'; protected readonly contentClass = 'surface-page border-t border-border px-3 py-3 text-sm text-text'; diff --git a/frontend/src/app/shared/ui/autocomplete/app-autocomplete.component.ts b/frontend/src/app/shared/ui/autocomplete/app-autocomplete.component.ts index 8b5995f1e..8e352626e 100644 --- a/frontend/src/app/shared/ui/autocomplete/app-autocomplete.component.ts +++ b/frontend/src/app/shared/ui/autocomplete/app-autocomplete.component.ts @@ -4,6 +4,7 @@ import { Combobox, ComboboxInput, ComboboxPopupContainer } from '@angular/aria/c import { Listbox, Option } from '@angular/aria/listbox'; import { OverlayModule } from '@angular/cdk/overlay'; import { TranslocoPipe } from '@jsverse/transloco'; +import { LucideLoaderCircle } from '@lucide/angular'; import { AppAutocompleteBaseDirective } from './app-autocomplete-base.directive'; @@ -18,6 +19,7 @@ import { AppAutocompleteBaseDirective } from './app-autocomplete-base.directive' Listbox, Option, TranslocoPipe, + LucideLoaderCircle, ], host: { class: 'block w-full' }, changeDetection: ChangeDetectionStrategy.OnPush, @@ -55,7 +57,7 @@ import { AppAutocompleteBaseDirective } from './app-autocomplete-base.directive' (blur)="onInputBlur()" [class]="innerInputClass" /> @if (pending()) { - + } diff --git a/frontend/src/app/shared/ui/autocomplete/app-multi-autocomplete.component.ts b/frontend/src/app/shared/ui/autocomplete/app-multi-autocomplete.component.ts index f912de16e..226016aa6 100644 --- a/frontend/src/app/shared/ui/autocomplete/app-multi-autocomplete.component.ts +++ b/frontend/src/app/shared/ui/autocomplete/app-multi-autocomplete.component.ts @@ -13,6 +13,7 @@ import { Combobox, ComboboxInput, ComboboxPopupContainer } from '@angular/aria/c import { Listbox, Option } from '@angular/aria/listbox'; import { OverlayModule } from '@angular/cdk/overlay'; import { TranslocoPipe } from '@jsverse/transloco'; +import { LucideLoaderCircle } from '@lucide/angular'; import { AppTagComponent } from '../tag/app-tag.component'; import { AppAutocompleteBaseDirective } from './app-autocomplete-base.directive'; @@ -29,6 +30,7 @@ import { AppAutocompleteBaseDirective } from './app-autocomplete-base.directive' Option, AppTagComponent, TranslocoPipe, + LucideLoaderCircle, ], host: { class: 'block w-full' }, changeDetection: ChangeDetectionStrategy.OnPush, @@ -76,7 +78,7 @@ import { AppAutocompleteBaseDirective } from './app-autocomplete-base.directive' (blur)="touched.set(true)" [class]="innerInputClass" /> @if (pending()) { - + } diff --git a/frontend/src/app/shared/ui/button/app-button.component.ts b/frontend/src/app/shared/ui/button/app-button.component.ts index 1e0d9d4f3..7a369a295 100644 --- a/frontend/src/app/shared/ui/button/app-button.component.ts +++ b/frontend/src/app/shared/ui/button/app-button.component.ts @@ -31,16 +31,16 @@ import { buttonVariants, type ButtonSize, type ButtonTone, type ButtonVariant } (click)="clicked.emit($event)"> @if (loading()) { - } @else if (icon() && iconPos() === 'left') { - } + + + @if (label()) { {{ label() }} } - - @if (!loading() && icon() && iconPos() === 'right') { - - } `, }) @@ -64,7 +64,6 @@ export class AppButtonComponent { readonly ariaExpanded = input(null); readonly ariaHasPopup = input(null); readonly ariaPressed = input(null); - readonly icon = input(''); readonly iconPos = input<'left' | 'right'>('left'); readonly loading = input(false, { transform: booleanAttribute }); readonly disabled = input(false, { transform: booleanAttribute }); @@ -85,6 +84,5 @@ export class AppButtonComponent { this.styleClass(), ), ); - protected readonly iconClass = computed(() => cn(this.icon(), 'shrink-0 m-0 leading-none')); protected readonly loadingRingClass = cn(SPINNER_RING, 'size-[1em] border-2 shrink-0'); } diff --git a/frontend/src/app/shared/ui/date-picker/app-date-picker-base.directive.ts b/frontend/src/app/shared/ui/date-picker/app-date-picker-base.directive.ts index eac721744..6e6e6bf6e 100644 --- a/frontend/src/app/shared/ui/date-picker/app-date-picker-base.directive.ts +++ b/frontend/src/app/shared/ui/date-picker/app-date-picker-base.directive.ts @@ -122,9 +122,9 @@ export const DATE_PICKER_TEMPLATE = ` @if (pending()) { - + } @else { - + } @@ -150,11 +150,11 @@ export const DATE_PICKER_TEMPLATE = ` (focusout)="onPopupFocusOut($event)">
{{ monthYearLabel() }}
diff --git a/frontend/src/app/shared/ui/date-picker/app-date-picker.component.ts b/frontend/src/app/shared/ui/date-picker/app-date-picker.component.ts index 1f5afd071..38075d321 100644 --- a/frontend/src/app/shared/ui/date-picker/app-date-picker.component.ts +++ b/frontend/src/app/shared/ui/date-picker/app-date-picker.component.ts @@ -3,6 +3,7 @@ import { type FormValueControl } from '@angular/forms/signals'; import { Grid, GridCell, GridCellWidget, GridRow } from '@angular/aria/grid'; import { OverlayModule } from '@angular/cdk/overlay'; import { TranslocoPipe } from '@jsverse/transloco'; +import { LucideCalendar, LucideChevronLeft, LucideChevronRight, LucideLoaderCircle } from '@lucide/angular'; import { AppDatePickerBaseDirective, @@ -16,7 +17,7 @@ const NO_SELECTION: DaySelectionFlags = { point: false, spanStart: false, spanEn @Component({ selector: 'app-date-picker', standalone: true, - imports: [OverlayModule, Grid, GridRow, GridCell, GridCellWidget, TranslocoPipe], + imports: [OverlayModule, Grid, GridRow, GridCell, GridCellWidget, TranslocoPipe, LucideCalendar, LucideChevronLeft, LucideChevronRight, LucideLoaderCircle], host: { class: 'block w-full' }, changeDetection: ChangeDetectionStrategy.OnPush, template: DATE_PICKER_TEMPLATE, diff --git a/frontend/src/app/shared/ui/date-picker/app-date-range-picker.component.ts b/frontend/src/app/shared/ui/date-picker/app-date-range-picker.component.ts index 7470a16ad..d175b5b9d 100644 --- a/frontend/src/app/shared/ui/date-picker/app-date-range-picker.component.ts +++ b/frontend/src/app/shared/ui/date-picker/app-date-range-picker.component.ts @@ -3,6 +3,7 @@ import { type FormValueControl } from '@angular/forms/signals'; import { Grid, GridCell, GridCellWidget, GridRow } from '@angular/aria/grid'; import { OverlayModule } from '@angular/cdk/overlay'; import { TranslocoPipe } from '@jsverse/transloco'; +import { LucideCalendar, LucideChevronLeft, LucideChevronRight, LucideLoaderCircle } from '@lucide/angular'; import { AppDatePickerBaseDirective, @@ -22,7 +23,7 @@ const NO_SELECTION: DaySelectionFlags = { point: false, spanStart: false, spanEn @Component({ selector: 'app-date-range-picker', standalone: true, - imports: [OverlayModule, Grid, GridRow, GridCell, GridCellWidget, TranslocoPipe], + imports: [OverlayModule, Grid, GridRow, GridCell, GridCellWidget, TranslocoPipe, LucideCalendar, LucideChevronLeft, LucideChevronRight, LucideLoaderCircle], host: { class: 'block w-full' }, changeDetection: ChangeDetectionStrategy.OnPush, template: DATE_PICKER_TEMPLATE, diff --git a/frontend/src/app/shared/ui/input/app-input.component.ts b/frontend/src/app/shared/ui/input/app-input.component.ts index b1c7b5496..f5ee9d3fd 100644 --- a/frontend/src/app/shared/ui/input/app-input.component.ts +++ b/frontend/src/app/shared/ui/input/app-input.component.ts @@ -13,14 +13,16 @@ import { } from '@angular/core'; import { type FormValueControl } from '@angular/forms/signals'; import { translateSignal } from '@jsverse/transloco'; +import { LucideEye, LucideEyeOff, LucideLoaderCircle } from '@lucide/angular'; import { cn } from '../cn'; import { APP_FIELD } from '../field/app-field.context'; import { appInputVariants, type AppInputSize, type AppInputVariant } from './app-input.variants'; type AppInputType = 'text' | 'email' | 'password' | 'search' | 'tel' | 'url'; -const TRAILING_ACTION_BUTTON_CLASS = - 'absolute inset-y-0 right-0 inline-flex w-10 items-center justify-center rounded-r-md text-text-muted ' + +const ADORNMENT_CLASS = 'inline-flex shrink-0 items-center text-text-muted empty:hidden [&>svg]:size-4'; +const REVEAL_TOGGLE_CLASS = + 'inline-flex size-7 shrink-0 items-center justify-center rounded-md text-text-muted ' + 'transition-colors hover:text-text-strong ' + 'focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary ' + 'disabled:pointer-events-none disabled:opacity-50'; @@ -28,56 +30,55 @@ const TRAILING_ACTION_BUTTON_CLASS = @Component({ selector: 'app-input', standalone: true, - host: { class: 'relative block w-full' }, + imports: [LucideEye, LucideEyeOff, LucideLoaderCircle], + host: { class: 'block w-full' }, changeDetection: ChangeDetectionStrategy.OnPush, template: ` - @if (leadingIcon()) { - - - - } - - @if (pending()) { - - - - } - @if (showTrailingAction()) { - - } + [readonly]="readonly()" + [required]="required()" + (input)="onInput(input)" + (blur)="touched.set(true)" + (keydown)="keyedDown.emit($event)" + (keyup.enter)="onEnterKeyup($event)" /> + @if (pending()) { + + } + @if (showRevealToggle()) { + + } + + `, }) export class AppInputComponent implements FormValueControl { @@ -103,17 +104,13 @@ export class AppInputComponent implements FormValueControl { readonly minLength = input(undefined); readonly pattern = input([]); readonly revealToggle = input(false, { transform: booleanAttribute }); - readonly leadingIcon = input(''); - readonly trailingIcon = input(''); - readonly trailingAriaLabel = input(''); - readonly trailingPressed = input(null); readonly keyedDown = output(); readonly enterPressed = output(); - readonly trailingClicked = output(); private readonly fieldContext = inject(APP_FIELD, { optional: true }); - protected readonly trailingActionButtonClass = TRAILING_ACTION_BUTTON_CLASS; + protected readonly adornmentClass = ADORNMENT_CLASS; + protected readonly revealToggleClass = REVEAL_TOGGLE_CLASS; protected readonly resolvedInputId = computed(() => this.inputId() || this.fieldContext?.controlId() || null); protected readonly resolvedDescribedBy = computed( () => this.ariaDescribedBy() || this.fieldContext?.describedById() || null, @@ -123,47 +120,22 @@ export class AppInputComponent implements FormValueControl { protected readonly passwordVisible = signal(false); protected readonly showRevealToggle = computed(() => this.type() === 'password' && this.revealToggle()); - protected readonly showTrailingAction = computed(() => this.showRevealToggle() || this.trailingIcon() !== ''); private readonly showPasswordLabel = translateSignal('shared.ui.input.showPassword'); private readonly hidePasswordLabel = translateSignal('shared.ui.input.hidePassword'); - private readonly trailingActionDefaultLabel = translateSignal('shared.ui.input.trailingAction'); protected readonly resolvedType = computed(() => this.showRevealToggle() && this.passwordVisible() ? 'text' : this.type(), ); - protected readonly trailingActionIcon = computed(() => { - if (this.showRevealToggle()) { - return this.passwordVisible() ? 'pi pi-eye-slash' : 'pi pi-eye'; - } - - return this.trailingIcon(); - }); - protected readonly trailingActionAriaLabel = computed(() => { - if (this.showRevealToggle()) { - return this.passwordVisible() ? this.hidePasswordLabel() : this.showPasswordLabel(); - } - - return this.trailingAriaLabel() || this.trailingActionDefaultLabel(); - }); - protected readonly trailingActionPressed = computed(() => { - if (this.showRevealToggle()) { - return this.passwordVisible(); - } - - return this.trailingPressed(); - }); - protected readonly trailingPaddingClass = computed(() => { - const hasTrailingAction = this.showTrailingAction(); - const pending = this.pending(); - - if (hasTrailingAction && pending) return 'pr-20'; - if (hasTrailingAction || pending) return 'pr-10'; - return ''; - }); - protected readonly inputClass = computed(() => + protected readonly revealAriaLabel = computed(() => + this.passwordVisible() ? this.hidePasswordLabel() : this.showPasswordLabel(), + ); + protected readonly inputClass = + 'min-w-0 flex-1 border-0 bg-transparent p-0 text-text-strong outline-hidden placeholder:text-text-muted ' + + '[&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden disabled:cursor-default'; + protected readonly boxClass = computed(() => cn( appInputVariants({ size: this.size(), variant: this.variant() }), - this.leadingIcon() && 'pl-10', - this.trailingPaddingClass(), + 'flex items-center gap-2', + this.disabled() && 'pointer-events-none opacity-50', this.styleClass(), ), ); @@ -182,15 +154,6 @@ export class AppInputComponent implements FormValueControl { this.enterPressed.emit(event as KeyboardEvent); } - protected onTrailingActionClick(event: MouseEvent): void { - if (this.showRevealToggle()) { - this.passwordVisible.update(visible => !visible); - return; - } - - this.trailingClicked.emit(event); - } - focus(options?: FocusOptions): void { this.input()?.nativeElement.focus(options); } diff --git a/frontend/src/app/shared/ui/input/app-input.variants.ts b/frontend/src/app/shared/ui/input/app-input.variants.ts index 43230488f..f46937948 100644 --- a/frontend/src/app/shared/ui/input/app-input.variants.ts +++ b/frontend/src/app/shared/ui/input/app-input.variants.ts @@ -19,8 +19,8 @@ export const appInputVariants = cva( variant: { outlined: `rounded-md border ${neutralControlBorderClass} bg-card shadow-control ` + - 'focus:border-primary/60 focus:outline-1 focus:outline-offset-0 focus:outline-primary/60 ' + - 'aria-invalid:border-danger aria-invalid:focus:border-danger aria-invalid:focus:outline-danger', + 'focus-within:border-primary/60 focus-within:outline-1 focus-within:outline-offset-0 focus-within:outline-primary/60 ' + + 'aria-invalid:border-danger aria-invalid:focus-within:border-danger aria-invalid:focus-within:outline-danger', bare: 'rounded-none border-0 bg-transparent shadow-none aria-invalid:text-danger', }, }, diff --git a/frontend/src/app/shared/ui/message/app-message.component.ts b/frontend/src/app/shared/ui/message/app-message.component.ts index 58fce5cf8..1095f5cf0 100644 --- a/frontend/src/app/shared/ui/message/app-message.component.ts +++ b/frontend/src/app/shared/ui/message/app-message.component.ts @@ -3,6 +3,7 @@ import { booleanAttribute, ChangeDetectionStrategy, Component, computed, inject, import { toSignal } from '@angular/core/rxjs-interop'; import { type FieldState, type ValidationError } from '@angular/forms/signals'; import { TranslocoPipe, TranslocoService } from '@jsverse/transloco'; +import { LucideChevronDown, LucideChevronUp, LucideDynamicIcon } from '@lucide/angular'; import { AppButtonComponent } from '../button/app-button.component'; import { cn } from '../cn'; import { @@ -18,7 +19,7 @@ type SummaryLayout = 'list' | 'inline'; @Component({ selector: 'app-message', standalone: true, - imports: [AppButtonComponent, TranslocoPipe], + imports: [AppButtonComponent, TranslocoPipe, LucideDynamicIcon, LucideChevronUp, LucideChevronDown], host: { '[class.block]': '!inline()', '[class.inline-block]': 'inline()', @@ -28,7 +29,7 @@ type SummaryLayout = 'list' | 'inline'; template: ` @if (visible()) {
- +
@if (field() && summary()) { @if (summaryLayout() === 'inline') { @@ -46,17 +47,15 @@ type SummaryLayout = 'list' | 'inline'; variant="ghost" size="sm" iconOnly - icon="pi pi-chevron-up" [ariaLabel]="'shared.ui.message.previousIssue' | transloco" - (clicked)="focusAdjacentSummaryIssue(-1)" /> + (clicked)="focusAdjacentSummaryIssue(-1)"> + (clicked)="focusAdjacentSummaryIssue(1)">
} @else { @@ -141,9 +140,8 @@ export class AppMessageComponent { }); protected readonly resolvedColor = computed(() => (this.field() ? 'red' : this.color())); protected readonly role = computed(() => (this.resolvedColor() === 'red' ? 'alert' : 'status')); - protected readonly iconClass = computed(() => - cn(MESSAGE_ICONS[this.resolvedColor()], 'mt-0.5 shrink-0 text-[1.05em] leading-none'), - ); + protected readonly messageIcon = computed(() => MESSAGE_ICONS[this.resolvedColor()]); + protected readonly iconClass = computed(() => cn('mt-0.5 size-4 shrink-0 leading-none')); protected readonly rootClass = computed(() => cn(messageVariants({ color: this.resolvedColor() }), this.inline() && 'inline-flex align-middle', this.styleClass()), ); diff --git a/frontend/src/app/shared/ui/message/app-message.variants.ts b/frontend/src/app/shared/ui/message/app-message.variants.ts index 0429eb00c..16792c2a0 100644 --- a/frontend/src/app/shared/ui/message/app-message.variants.ts +++ b/frontend/src/app/shared/ui/message/app-message.variants.ts @@ -1,4 +1,5 @@ import { cva } from 'class-variance-authority'; +import { LucideCircleAlert, LucideCircleCheck, LucideInfo, LucideTriangleAlert, type LucideIconData } from '@lucide/angular'; import { neutralControlBorderClass } from '../control.styles'; export type MessageColor = 'neutral' | 'primary' | 'green' | 'amber' | 'red'; @@ -16,10 +17,10 @@ export const messageVariants = cva('flex min-h-9 items-center gap-2 rounded-md b defaultVariants: { color: 'neutral' }, }); -export const MESSAGE_ICONS: Record = { - neutral: 'pi pi-info-circle', - primary: 'pi pi-info-circle', - green: 'pi pi-check-circle', - amber: 'pi pi-exclamation-triangle', - red: 'pi pi-exclamation-circle', +export const MESSAGE_ICONS: Record = { + neutral: LucideInfo.icon, + primary: LucideInfo.icon, + green: LucideCircleCheck.icon, + amber: LucideTriangleAlert.icon, + red: LucideCircleAlert.icon, }; diff --git a/frontend/src/app/shared/ui/number-input/app-number-input.component.ts b/frontend/src/app/shared/ui/number-input/app-number-input.component.ts index 2113680c4..0d26c1a6d 100644 --- a/frontend/src/app/shared/ui/number-input/app-number-input.component.ts +++ b/frontend/src/app/shared/ui/number-input/app-number-input.component.ts @@ -11,6 +11,7 @@ import { viewChild, } from '@angular/core'; import { transformedValue, type FormValueControl, type ParseResult } from '@angular/forms/signals'; +import { LucideChevronDown, LucideChevronUp } from '@lucide/angular'; import { cn } from '../cn'; import { APP_FIELD } from '../field/app-field.context'; @@ -19,6 +20,7 @@ import { appInputVariants, type AppInputSize } from '../input/app-input.variants @Component({ selector: 'app-number-input', standalone: true, + imports: [LucideChevronDown, LucideChevronUp], host: { class: 'relative block w-full' }, changeDetection: ChangeDetectionStrategy.OnPush, template: ` @@ -59,7 +61,7 @@ import { appInputVariants, type AppInputSize } from '../input/app-input.variants [class]="stepButtonClass" [disabled]="disabled() || atMax()" (click)="nudge(1)"> - + } diff --git a/frontend/src/app/shared/ui/rating/app-rating.component.ts b/frontend/src/app/shared/ui/rating/app-rating.component.ts index db0029e2f..3a9cd6c08 100644 --- a/frontend/src/app/shared/ui/rating/app-rating.component.ts +++ b/frontend/src/app/shared/ui/rating/app-rating.component.ts @@ -13,6 +13,7 @@ import { } from '@angular/core'; import { type FormValueControl } from '@angular/forms/signals'; import { TranslocoPipe, translateSignal } from '@jsverse/transloco'; +import { LucideLoaderCircle } from '@lucide/angular'; import { APP_FIELD } from '../field/app-field.context'; @@ -30,7 +31,7 @@ interface Star { @Component({ selector: 'app-rating', standalone: true, - imports: [TranslocoPipe], + imports: [TranslocoPipe, LucideLoaderCircle], changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'inline-flex' }, template: ` @@ -57,7 +58,7 @@ interface Star { {{ valueLabel() }} } @if (pending()) { - + } } @else { @@ -109,7 +110,7 @@ interface Star { {{ valueLabel() }} } @if (pending()) { - + } } diff --git a/frontend/src/app/shared/ui/select/app-multi-select.component.ts b/frontend/src/app/shared/ui/select/app-multi-select.component.ts index 94adfa877..8042132bb 100644 --- a/frontend/src/app/shared/ui/select/app-multi-select.component.ts +++ b/frontend/src/app/shared/ui/select/app-multi-select.component.ts @@ -10,6 +10,7 @@ import { Combobox, ComboboxInput, ComboboxPopupContainer } from '@angular/aria/c import { Listbox, Option } from '@angular/aria/listbox'; import { OverlayModule } from '@angular/cdk/overlay'; import { TranslocoPipe, translateSignal } from '@jsverse/transloco'; +import { LucideCheck, LucideChevronDown, LucideLoaderCircle, LucideSearch, LucideX } from '@lucide/angular'; import { cn } from '../cn'; import { AppSelectBaseDirective } from './app-select-base.directive'; @@ -27,6 +28,11 @@ import { type SelectOption } from './app-select.options'; Listbox, Option, TranslocoPipe, + LucideCheck, + LucideChevronDown, + LucideLoaderCircle, + LucideSearch, + LucideX, ], host: { class: 'block w-full' }, changeDetection: ChangeDetectionStrategy.OnPush, @@ -70,7 +76,7 @@ import { type SelectOption } from './app-select.options'; [class.w-9]="variant() !== 'bare'" [class.w-7]="variant() === 'bare'" (click)="clear($event)"> - + } @@ -79,9 +85,9 @@ import { type SelectOption } from './app-select.options'; [class.w-9]="variant() !== 'bare'" [class.w-7]="variant() === 'bare'"> @if (pending()) { - + } @else { - + } @@ -111,7 +117,7 @@ import { type SelectOption } from './app-select.options'; [placeholder]="filterPlaceholder() || ('shared.ui.select.search' | transloco)" [readonly]="readonly()" class="h-full min-w-0 flex-1 border-0 bg-transparent px-0 pr-2 text-sm text-text-strong outline-hidden placeholder:text-text-muted focus:outline-hidden" /> - + } @@ -142,7 +148,7 @@ import { type SelectOption } from './app-select.options'; [disabled]="option.disabled === true" [class]="optionClass"> - @if (isSelected(option)) { } + @if (isSelected(option)) { } @if (optionTemplate(); as tpl) { diff --git a/frontend/src/app/shared/ui/select/app-select.component.ts b/frontend/src/app/shared/ui/select/app-select.component.ts index a044f231a..77896e471 100644 --- a/frontend/src/app/shared/ui/select/app-select.component.ts +++ b/frontend/src/app/shared/ui/select/app-select.component.ts @@ -11,6 +11,7 @@ import { Combobox, ComboboxInput, ComboboxPopupContainer } from '@angular/aria/c import { Listbox, Option } from '@angular/aria/listbox'; import { OverlayModule } from '@angular/cdk/overlay'; import { TranslocoPipe } from '@jsverse/transloco'; +import { LucideCheck, LucideChevronDown, LucideLoaderCircle, LucideSearch, LucideX } from '@lucide/angular'; import { AppSelectBaseDirective } from './app-select-base.directive'; import { AppSelectSelectedTemplateDirective } from './app-select.templates'; @@ -28,6 +29,11 @@ import { type SelectOption } from './app-select.options'; Listbox, Option, TranslocoPipe, + LucideCheck, + LucideChevronDown, + LucideLoaderCircle, + LucideSearch, + LucideX, ], host: { class: 'block w-full' }, changeDetection: ChangeDetectionStrategy.OnPush, @@ -79,7 +85,7 @@ import { type SelectOption } from './app-select.options'; [class.w-9]="variant() !== 'bare'" [class.w-7]="variant() === 'bare'" (click)="clear($event)"> - + } @@ -88,9 +94,9 @@ import { type SelectOption } from './app-select.options'; [class.w-9]="variant() !== 'bare'" [class.w-7]="variant() === 'bare'"> @if (pending()) { - + } @else { - + } @@ -120,7 +126,7 @@ import { type SelectOption } from './app-select.options'; [placeholder]="filterPlaceholder() || ('shared.ui.select.search' | transloco)" [readonly]="readonly()" class="h-full min-w-0 flex-1 border-0 bg-transparent px-0 pr-2 text-sm text-text-strong outline-hidden placeholder:text-text-muted focus:outline-hidden" /> - + } @@ -155,7 +161,7 @@ import { type SelectOption } from './app-select.options'; {{ option.label }} } @if (isSelected(option)) { - + } } diff --git a/frontend/src/app/shared/ui/split-button/app-split-button.component.ts b/frontend/src/app/shared/ui/split-button/app-split-button.component.ts index 0cdac305e..425ccb83d 100644 --- a/frontend/src/app/shared/ui/split-button/app-split-button.component.ts +++ b/frontend/src/app/shared/ui/split-button/app-split-button.component.ts @@ -1,5 +1,6 @@ import { booleanAttribute, ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core'; import { type MenuItem } from 'primeng/api'; +import { LucideChevronDown } from '@lucide/angular'; import { cn } from '../cn'; import { connectedGroupClass, connectedItemClass } from '../connected-group'; import { AppButtonComponent } from '../button/app-button.component'; @@ -9,7 +10,7 @@ import { AppMenuComponent } from '../menu/app-menu.component'; @Component({ selector: 'app-split-button', standalone: true, - imports: [AppButtonComponent, AppMenuComponent], + imports: [AppButtonComponent, AppMenuComponent, LucideChevronDown], host: { class: 'inline-block align-middle', '[class.w-full]': 'fluid()', @@ -36,7 +37,6 @@ import { AppMenuComponent } from '../menu/app-menu.component'; [tabIndex]="tabIndex()" [label]="label()" [ariaLabel]="ariaLabel()" - [icon]="icon()" [iconPos]="iconPos()" (clicked)="clicked.emit($event)"> @@ -45,7 +45,6 @@ import { AppMenuComponent } from '../menu/app-menu.component'; [buttonId]="menuButtonId()" type="button" iconOnly - icon="pi pi-chevron-down" [tone]="tone()" [variant]="variant()" [size]="size()" @@ -54,7 +53,9 @@ import { AppMenuComponent } from '../menu/app-menu.component'; [form]="form()" [ariaHasPopup]="'menu'" [ariaLabel]="menuAriaLabel() || ariaLabel() || label()" - (clicked)="menu.toggle($event)" /> + (clicked)="menu.toggle($event)"> + + `, @@ -77,7 +78,6 @@ export class AppSplitButtonComponent { readonly label = input(''); readonly ariaLabel = input(''); readonly menuAriaLabel = input(''); - readonly icon = input(''); readonly iconPos = input<'left' | 'right'>('left'); readonly model = input([]); readonly appendTo = input<'body' | 'self' | HTMLElement>('body'); diff --git a/frontend/src/app/shared/ui/tabs/app-tabs.component.ts b/frontend/src/app/shared/ui/tabs/app-tabs.component.ts index 50024bc83..52ecd7111 100644 --- a/frontend/src/app/shared/ui/tabs/app-tabs.component.ts +++ b/frontend/src/app/shared/ui/tabs/app-tabs.component.ts @@ -14,6 +14,7 @@ import { viewChildren, } from '@angular/core'; import { Tab as NgTab, TabList, Tabs } from '@angular/aria/tabs'; +import { LucideDynamicIcon, type LucideIconData } from '@lucide/angular'; import { AppSelectComponent } from '../select/app-select.component'; import { type SelectOption } from '../select/app-select.options'; import { cn } from '../cn'; @@ -30,7 +31,7 @@ import { export interface TabItem { id: string; label: string; - icon?: string; + icon?: LucideIconData; } const COLLAPSE_HYSTERESIS = 8; @@ -38,7 +39,7 @@ const COLLAPSE_HYSTERESIS = 8; @Component({ selector: 'app-tabs', standalone: true, - imports: [Tabs, TabList, NgTab, AppSelectComponent], + imports: [Tabs, TabList, NgTab, AppSelectComponent, LucideDynamicIcon], changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'relative block min-w-0' }, template: ` @@ -71,8 +72,8 @@ const COLLAPSE_HYSTERESIS = 8; [style.width.px]="indicatorWidth()"> @for (tab of tabs(); track tab.id) { diff --git a/frontend/src/app/shared/ui/tag/app-tag.component.ts b/frontend/src/app/shared/ui/tag/app-tag.component.ts index 3a039b473..ce0c48a76 100644 --- a/frontend/src/app/shared/ui/tag/app-tag.component.ts +++ b/frontend/src/app/shared/ui/tag/app-tag.component.ts @@ -1,11 +1,13 @@ import { booleanAttribute, ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core'; import { translateSignal } from '@jsverse/transloco'; +import { LucideX } from '@lucide/angular'; import { cn } from '../cn'; import { tagRemoveVariants, tagVariants, type TagColor, type TagSize } from './app-tag.variants'; @Component({ selector: 'app-tag', standalone: true, + imports: [LucideX], host: { class: 'inline-flex align-middle' }, changeDetection: ChangeDetectionStrategy.OnPush, template: ` @@ -18,9 +20,7 @@ import { tagRemoveVariants, tagVariants, type TagColor, type TagSize } from './a [style.border-color]="customBorder()" [attr.aria-label]="ariaLabel() || null" (click)="clicked.emit($event)"> - @if (icon()) { - - } + @if (label()) { {{ label() }} } @@ -32,9 +32,7 @@ import { tagRemoveVariants, tagVariants, type TagColor, type TagSize } from './a [style.background-color]="customBg()" [style.color]="customTextColor()" [style.border-color]="customBorder()"> - @if (icon()) { - - } + @if (label()) { {{ label() }} } @@ -45,7 +43,7 @@ import { tagRemoveVariants, tagVariants, type TagColor, type TagSize } from './a [class]="removeClass()" [attr.aria-label]="resolvedRemoveLabel()" (click)="$event.stopPropagation(); remove.emit($event)"> - + } @@ -56,7 +54,6 @@ export class AppTagComponent { readonly color = input('neutral'); readonly size = input('md'); readonly label = input(''); - readonly icon = input(''); readonly styleClass = input(''); readonly customColor = input(''); readonly clickable = input(false, { transform: booleanAttribute }); diff --git a/frontend/src/app/shared/ui/textarea/app-textarea.component.ts b/frontend/src/app/shared/ui/textarea/app-textarea.component.ts index abae14bc7..9fbf78515 100644 --- a/frontend/src/app/shared/ui/textarea/app-textarea.component.ts +++ b/frontend/src/app/shared/ui/textarea/app-textarea.component.ts @@ -11,6 +11,7 @@ import { viewChild, } from '@angular/core'; import { type FormValueControl } from '@angular/forms/signals'; +import { LucideLoaderCircle } from '@lucide/angular'; import { cn } from '../cn'; import { APP_FIELD } from '../field/app-field.context'; import { appTextareaVariants } from './app-textarea.variants'; @@ -18,6 +19,7 @@ import { appTextareaVariants } from './app-textarea.variants'; @Component({ selector: 'app-textarea', standalone: true, + imports: [LucideLoaderCircle], host: { class: 'relative block w-full' }, changeDetection: ChangeDetectionStrategy.OnPush, template: ` @@ -44,7 +46,7 @@ import { appTextareaVariants } from './app-textarea.variants'; (blur)="touched.set(true)"> @if (pending()) { - + } `,