import { Component } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { DatePickerComponent } from '../../../../../ui-essentials/src/lib/components/forms/date-picker/date-picker.component'; @Component({ selector: 'ui-date-picker-demo', standalone: true, imports: [CommonModule, FormsModule, DatePickerComponent], template: `

Date Picker Demo

Sizes

@for (size of sizes; track size) {

{{ size | uppercase }}

}

Variants

@for (variant of variants; track variant) {

{{ variant | titlecase }}

}

States

Default

Error

Success

Warning

Features

Required Field

Disabled

Not Clearable

Date Range Limits

Interactive Example

Selected Date:

{{ interactiveValue ? formatDate(interactiveValue) : 'No date selected' }}

Change count: {{ changeCount }}

Form Integration

Form Valid: {{ demoForm.valid }}

Form Values:

{{ formValues | json }}
`, styleUrl: './date-picker-demo.component.scss' }) export class DatePickerDemoComponent { sizes = ['sm', 'md', 'lg'] as const; variants = ['outlined', 'filled', 'underlined'] as const; sampleValues: Record = { sm: null, md: null, lg: null }; variantValues: Record = { outlined: null, filled: null, underlined: null }; stateValues: Record = { default: null, error: null, success: new Date(), warning: null }; featureValues: Record = { required: null, disabled: new Date(), notClearable: null, limited: null }; interactiveValue: Date | null = null; changeCount = 0; formValues = { startDate: null as Date | null, endDate: null as Date | null }; // Date limits for demo minDate = new Date(2024, 0, 1); // January 1, 2024 maxDate = new Date(2024, 11, 31); // December 31, 2024 onDateChange(date: Date | null): void { this.changeCount++; console.log('Date changed:', date); } onSubmit(): void { console.log('Form submitted:', this.formValues); alert('Form submitted! Check console for values.'); } resetForm(form: any): void { form.resetForm(); this.formValues = { startDate: null, endDate: null }; } formatDate(date: Date): string { return date.toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }); } }