10BC0 GitHub - klajdm/ngx-chronica: πŸ“… Chronica - Complete Angular Date & Time Component Library
[go: up one dir, main page]

Skip to content

klajdm/ngx-chronica

ngx-chronica logo

πŸ—“οΈ NGX-Chronica

Complete Date & Time Picker Suite for Angular

npm version npm downloads Angular 20+ GitHub stars

πŸ“š Documentation β€’ πŸš€ Quick Start β€’ πŸ“¦ Components β€’ 🀝 Contributing


🌟 Overview

NGX-Chronica is a comprehensive Angular library providing 6 specialized date and time picker components that fill critical gaps in the Angular ecosystem. Built with modern Angular practices, full TypeScript support, and zero external dependencies.

🎯 Why NGX-Chronica?

The Angular ecosystem lacks robust, production-ready Date &Time Picker components. NGX-Chronica addresses these gaps with components that are:

  • βœ… Battle-Tested - Used in production applications
  • βœ… Zero Dependencies - No Moment.js, date-fns, or other heavy libraries
  • βœ… Fully Typed - Complete TypeScript definitions
  • βœ… Accessible - WCAG 2.1 AA compliant
  • βœ… Themeable - 8 color themes + dark mode
  • βœ… i18n Ready - 11 built-in locales + custom locale support

πŸ“¦ Components

Component Description Key Features
DatePicker Single date selection with popup Min/max dates, disabled dates, locale support
DateRange Start/end date selection Hover preview, quick presets, validation
InlineCalendar Always-visible calendar Embedded display, no popup overhead
TimePicker Time selection (12h/24h) Step intervals, min/max time, seconds support
DateTimePicker Combined date + time Unified interface, flexible layout
DurationPicker Time span selection Days/hours/minutes/seconds, preset durations

✨ Key Features

  • πŸ—“οΈ 6 Specialized Components - Complete toolkit for all date/time needs
  • 🎨 8 Color Themes - Blue, Green, Purple, Red, Orange, Teal, Pink, Indigo
  • 🌍 11 Built-in Locales - EN, ES, FR, DE, IT, PT, ZH, JA, KO, RU + custom
  • πŸ“± Responsive - Mobile-friendly with touch support
  • 🚫 Smart Validation - Min/max constraints, disabled dates/times
  • πŸ“ Form Integration - Full ControlValueAccessor support
  • ⚑ Standalone Components - Works with standalone or NgModule apps
  • β™Ώ Accessible - Keyboard navigation, ARIA labels, screen readers
  • 🎯 TypeScript First - Comprehensive type definitions
  • 🎨 Customizable - CSS custom properties for theming

πŸ“₯ Installation

npm install ngx-chronica

πŸš€ Quick Start

import { Component } from '@angular/core';
import { ChronicaDatepickerComponent } from 'ngx-chronica';

@Component({
  selector: 'app-example',
  standalone: true,
  imports: [ChronicaDatepickerComponent],
  template: `
    <chronica-datepicker
      [(ngModel)]="selectedDate"
      [config]="{ colorTheme: 'blue', theme: 'light' }"
      (dateSelected)="onDateSelected($event)"
    />
  `,
})
export class ExampleComponent {
  selectedDate: Date | null = new Date();

  onDateSelected(date: Date) {
    console.log('Selected:', date);
  }
}

πŸ“š View Full Documentation

πŸ—οΈ Project Structure

This is a monorepo containing:

ngx-chronica/
β”œβ”€β”€ projects/chronica/          # πŸ“¦ Library source code
β”‚   β”œβ”€β”€ src/lib/
β”‚   β”‚   β”œβ”€β”€ components/         # 6 picker components
β”‚   β”‚   β”œβ”€β”€ models/             # TypeScript interfaces
β”‚   β”‚   β”œβ”€β”€ utils/              # Utility functions
β”‚   β”‚   └── chronica.module.ts  # Optional NgModule
β”‚   └── public-api.ts           # Public API exports
β”œβ”€β”€ src/                        # 🌐 Documentation website
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ components/         # Demo components
β”‚   β”‚   └── features/           # Feature pages
β”‚   └── assets/                 # Static assets
└── docs/                       # πŸ“š Additional documentation

πŸ› οΈ Development

Prerequisites

  • Node.js 18+ and npm 9+
  • Angular CLI 19+

Setup

# Clone the repository
git clone https://github.com/klajdm/ngx-chronica.git
cd ngx-chronica

# Install dependencies
npm install

# Start development server (documentation site)
npm start

# Build the library
npm run build:lib

# Run tests
npm test

# Lint code
npm run lint

Adding a New Component

  1. Create component in projects/chronica/src/lib/components/
  2. Implement ControlValueAccessor interface
  3. Add models to projects/chronica/src/lib/models/
  4. Export in public-api.ts
  5. Add to ChronicaModule
  6. Create demo page in src/app/features/
  7. Update documentation

Testing

# Run unit tests
npm test

# Run tests with coverage
npm run test:coverage

# Run e2e tests
npm run e2e

πŸ›οΈ Architecture

Design Principles

  • Standalone First - All components are standalone by default
  • Type Safety - Comprehensive TypeScript interfaces
  • Zero Dependencies - No external date libraries
  • Accessibility - WCAG 2.1 AA compliant
  • Performance - OnPush change detection, lazy loading
  • Modularity - Tree-shakeable exports

Component Pattern

All picker components follow this pattern:

@Component({
  standalone: true,
  providers: [
    { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => Component), multi: true },
  ],
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ChronicaComponent implements ControlValueAccessor, OnInit, OnDestroy {
  // Angular CDK Overlay for popups
  private overlayRef: OverlayRef | null = null;

  // ControlValueAccessor implementation
  writeValue(value: T): void {}
  registerOnChange(fn: any): void {}
  registerOnTouched(fn: any): void {}
  setDisabledState(isDisabled: boolean): void {}
}

🀝 Contributing

We welcome contributions! Here's how you can help:

Ways to Contribute

  • πŸ› Report Bugs - Open an issue
  • πŸ’‘ Suggest Features - Start a discussion
  • πŸ“ Improve Docs - Fix typos, add examples
  • πŸ”§ Submit PRs - Fix bugs, add features
  • ⭐ Star the Repo - Show your support!

Contribution Guidelines

  1. Fork the repository
  2. Create a feature branch - git checkout -b feature/amazing-feature
  3. Follow coding standards - Run npm run lint
  4. Write tests - Maintain >90% coverage
  5. Update documentation - Add examples and API docs
  6. Commit with conventional commits - feat:, fix:, docs:, etc.
  7. Push to your fork - git push origin feature/amazing-feature
  8. Open a Pull Request - Describe your changes

Code Style

  • Use TypeScript strict mode
  • Follow Angular style guide
  • Use OnPush change detection
  • Implement ControlValueAccessor for form components
  • Add ARIA attributes for accessibility
  • Write comprehensive tests

Commit Convention

feat(datepicker): add keyboard navigation
fix(time-picker): resolve 12h/24h conversion bug
docs(readme): update installation instructions
test(duration): add validation tests
perf(calendar): optimize date generation
style(components): apply consistent spacing
refactor(utils): extract date utilities
ci(github): add automated testing

πŸ“Š Roadmap

Current Version (v1.x)

  • βœ… DatePicker component
  • βœ… DateRange component
  • βœ… InlineCalendar component
  • βœ… TimePicker component
  • βœ… DateTimePicker component
  • βœ… DurationPicker component
  • βœ… 11 built-in locales
  • βœ… 8 color themes
  • βœ… Dark mode support

Planned Features (v2.x)

  • πŸ”„ Timezone Picker - Global timezone selection
  • πŸ”„ Recurring Event Picker - Schedule repeating events
  • πŸ”„ Calendar Heatmap - Data visualization over time
  • πŸ”„ Month/Year Picker - Quick month/year selection
  • πŸ”„ Week Picker - Select entire weeks
  • πŸ”„ Quarter Picker - Business quarter selection
  • πŸ”„ Age Calculator - Date difference calculations
  • πŸ”„ Countdown Timer - Live countdown displays

Future Enhancements

  • πŸ“± Enhanced mobile gestures (swipe navigation)
  • ⌨️ Advanced keyboard shortcuts
  • 🎨 Theme builder tool
  • 🌐 More locale support (20+ languages)
  • πŸ“¦ Smaller bundle size optimizations
  • πŸ§ͺ Comprehensive E2E test suite

Vote on features

πŸ“ˆ Performance

NGX-Chronica is optimized for performance:

  • Tree-shakeable - Only import what you need
  • OnPush Change Detection - Minimal re-renders
  • Lazy Loading - Components load on demand
  • Small Bundle Size - ~15KB per component (gzipped)
  • No External Dependencies - Zero runtime dependencies
  • Virtual Scrolling - Efficient rendering for large lists

Angular Version Support

Angular NGX-Chronica Status
15.x 1.x βœ… Supported
16.x 1.x βœ… Supported
17.x 1.x βœ… Supported
18.x 1.x βœ… Supported
19.x 1.x βœ… Supported

πŸ“„ License

MIT License - see LICENSE file for details.

πŸ”— Links & Resources


Made with ❀️ for the Angular community

0