ngx-easy-timepicker 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Reza Salehi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,296 @@
1
- # Temporary Holding Version
1
+ # ngx-easy-timepicker
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![npm version](https://img.shields.io/npm/v/ngx-easy-timepicker.svg)](https://www.npmjs.com/package/ngx-easy-timepicker)
4
+ [![license](https://img.shields.io/npm/l/ngx-easy-timepicker.svg)](./LICENSE)
5
+ [![Angular](https://img.shields.io/badge/Angular-17.2%2B%20%7C%20Signals%20%7C%20Zoneless%20%7C%20SSR-dd0031.svg)](https://angular.dev/)
6
+ [![Zero Dependencies](https://img.shields.io/badge/Dependencies-Zero-10b981.svg)](#why-ngx-easy-timepicker)
7
+ [![TypeScript](https://img.shields.io/badge/TypeScript-Strict-3178c6.svg)](https://www.typescriptlang.org/)
8
+
9
+ **The simplest, most customizable Angular Timepicker.**
10
+ One `<ngx-timepicker>` component with **3 built-in UIs** (Scroll Wheel, Interactive Analog Clock Dial, and Quick Slot Grid), **Time Range** selection, **Custom Styles & Skins** (`accentColor`, `appearance`, `--ntp-*` CSS variables), **Reactive Forms & Signals**, and **zero third-party runtime dependencies**.
11
+
12
+ ---
13
+
14
+ ## Screenshots
15
+
16
+ ### 1. Three Built-in Picker UIs (`wheel`, `dial`, `grid`)
17
+ ![Wheel, Analog Clock Dial, and Quick Slot Grid Timepickers](https://raw.githubusercontent.com/rezasalehidev/ngx-easy-timepicker/main/docs/screenshots/variants-overview.jpg)
18
+
19
+ ### 2. Time Range, Shift Presets, Dark Mode & Custom Styles
20
+ ![Time Range, Dark Mode, Persian RTL, and Custom Styles](https://raw.githubusercontent.com/rezasalehidev/ngx-easy-timepicker/main/docs/screenshots/range-and-custom-styles.jpg)
21
+
22
+ ---
23
+
24
+ ## Table of Contents
25
+
26
+ - [Why ngx-easy-timepicker?](#why-ngx-easy-timepicker)
27
+ - [Installation](#installation)
28
+ - [Quick Start (30 Seconds)](#quick-start-30-seconds)
29
+ - [Pick Your Style (`variant`)](#pick-your-style-variant)
30
+ - [Easy Custom Styling](#easy-custom-styling)
31
+ - [Common Examples](#common-examples)
32
+ - [1. Time Range + Presets](#1-time-range--presets)
33
+ - [2. Reactive Forms + Validation](#2-reactive-forms--validation)
34
+ - [3. Output Types (`valueType`)](#3-output-types-valuetype)
35
+ - [4. Persian (`fa-IR`) & RTL](#4-persian-fa-ir--rtl)
36
+ - [5. Global Defaults (`provideEasyTimepicker`)](#5-global-defaults-provideeasytimepicker)
37
+ - [Documentation Guides](#documentation-guides)
38
+ - [API Reference](#api-reference)
39
+ - [Development & Testing](#development--testing)
40
+ - [License](#license)
41
+
42
+ ---
43
+
44
+ ## Why ngx-easy-timepicker?
45
+
46
+ | Common Angular Headache | How `ngx-easy-timepicker` Solves It |
47
+ | :--- | :--- |
48
+ | Native `<input type="time">` looks completely different across Chrome, Safari, and Firefox | Consistent, modern UI across every browser with **3 built-in styles** (`wheel`, `dial`, `grid`) |
49
+ | Heavy libraries pull in Material, CDK, Moment, or jQuery | **Zero runtime dependencies** (~63 KB) — pure Standalone Angular |
50
+ | Hard to style or override colors without `::ng-deep` | Change accent color in 1 attribute (`accentColor="#10b981"`), pick `appearance`, or tweak `--ntp-*` CSS variables |
51
+ | Users struggle typing `"2:30 PM"` vs `"14:30"` vs `"1430"` | Smart parser accepts `"14:30"`, `"2:30 pm"`, `"1430"`, and `"۱۴:۳۰"` seamlessly |
52
+ | Need shift/booking time ranges (`09:00 → 17:00`) or appointment slots | Built-in `mode="range"`, `[disabledTimes]`, `[minuteStep]`, and `[presets]="true"` |
53
+
54
+ ---
55
+
56
+ ## Installation
57
+
58
+ ```bash
59
+ npm install ngx-easy-timepicker
60
+ # or
61
+ pnpm add ngx-easy-timepicker
62
+ ```
63
+
64
+ Requires Angular `>=17.2.0` (`@angular/core`, `@angular/common`, `@angular/forms`).
65
+
66
+ ---
67
+
68
+ ## Quick Start (30 Seconds)
69
+
70
+ Import `NgxTimepickerComponent` in any standalone component and bind `[(value)]`:
71
+
72
+ ```typescript
73
+ import { Component, signal } from '@angular/core';
74
+ import { NgxTimepickerComponent } from 'ngx-easy-timepicker';
75
+
76
+ @Component({
77
+ selector: 'app-alarm',
78
+ standalone: true,
79
+ imports: [NgxTimepickerComponent],
80
+ template: `
81
+ <ngx-timepicker [(value)]="meetingTime" label="Meeting Time" />
82
+ <p>Selected: {{ meetingTime() }}</p>
83
+ `,
84
+ })
85
+ export class AlarmComponent {
86
+ readonly meetingTime = signal<string | null>('09:30');
87
+ }
88
+ ```
89
+
90
+ That's it! Clicking the input opens the picker, typing `"2:30 pm"` or `"1430"` parses automatically, and `ArrowUp` / `ArrowDown` steps minutes right inside the input.
91
+
92
+ ---
93
+
94
+ ## Pick Your Style (`variant`)
95
+
96
+ Switch between three distinct UIs with one attribute:
97
+
98
+ ```html
99
+ <!-- 1. Clean scrollable columns (default) -->
100
+ <ngx-timepicker [(value)]="time" variant="wheel" [showSeconds]="true" [use24Hour]="false" />
101
+
102
+ <!-- 2. Interactive SVG analog clock dial (12h or 24h inner/outer ring) -->
103
+ <ngx-timepicker [(value)]="time" variant="dial" [use24Hour]="true" />
104
+
105
+ <!-- 3. Clickable booking slot grid (great for clinics, salons, calendars) -->
106
+ <ngx-timepicker [(value)]="time" variant="grid" [minuteStep]="30" minTime="09:00" maxTime="17:00" />
107
+ ```
108
+
109
+ ---
110
+
111
+ ## Easy Custom Styling
112
+
113
+ Customize the look in **3 simple ways** — zero `::ng-deep` required:
114
+
115
+ ### Option A: One-Attribute Color & Skin
116
+ ```html
117
+ <ngx-timepicker
118
+ [(value)]="time"
119
+ theme="dark"
120
+ appearance="filled"
121
+ accentColor="#10b981"
122
+ size="lg"
123
+ />
124
+ ```
125
+ Available `appearance` skins: `'default'` | `'outline'` | `'filled'` | `'minimal'` (underline style).
126
+
127
+ ### Option B: Custom CSS Theme Class
128
+ ```html
129
+ <ngx-timepicker [(value)]="time" class="rose-glass" panelClass="shadow-xl" />
130
+ ```
131
+ ```css
132
+ ngx-timepicker.rose-glass {
133
+ --ntp-accent: #f43f5e;
134
+ --ntp-accent-hover: #e11d48;
135
+ --ntp-bg: #18181b;
136
+ --ntp-surface: #27272a;
137
+ --ntp-border: #3f3f46;
138
+ --ntp-text: #fafafa;
139
+ --ntp-radius: 20px;
140
+ }
141
+ ```
142
+
143
+ See [Custom Styles & Theming Guide](./docs/custom-styles-and-theming.md) for copy-paste themes (Emerald, Rose, Sunset, Minimal).
144
+
145
+ ---
146
+
147
+ ## Common Examples
148
+
149
+ ### 1. Time Range + Presets
150
+
151
+ ```html
152
+ <ngx-timepicker
153
+ [(value)]="shift"
154
+ mode="range"
155
+ variant="grid"
156
+ [minuteStep]="60"
157
+ [presets]="true"
158
+ label="Office Shift Hours"
159
+ />
160
+ ```
161
+
162
+ ### 2. Reactive Forms + Validation
163
+
164
+ ```typescript
165
+ form = this.fb.group({
166
+ startTime: ['09:00', Validators.required],
167
+ });
168
+ ```
169
+ ```html
170
+ <form [formGroup]="form">
171
+ <ngx-timepicker
172
+ formControlName="startTime"
173
+ minTime="08:00"
174
+ maxTime="18:00"
175
+ [disabledTimes]="['12:30', '13:00']"
176
+ label="Check-in Time"
177
+ />
178
+ </form>
179
+ ```
180
+
181
+ ### 3. Output Types (`valueType`)
182
+
183
+ Choose the exact format emitted to your Signal or FormControl:
184
+
185
+ | `valueType` | Example Value | Best For |
186
+ | :--- | :--- | :--- |
187
+ | `'string'` (default) | `'14:30'` or `'14:30:15'` | REST APIs, forms, human-readable DB strings |
188
+ | `'object'` | `{ hours: 14, minutes: 30, seconds: 0 }` | Typed math & duration calculations |
189
+ | `'minutes'` | `870` (minutes since `00:00`) | Scheduling math, sorting, charts |
190
+ | `'date'` | `Date` object | Combining with date pickers |
191
+
192
+ ### 4. Persian (`fa-IR`) & RTL
193
+
194
+ ```html
195
+ <ngx-timepicker
196
+ [(value)]="sessionTime"
197
+ locale="fa-IR"
198
+ variant="dial"
199
+ [persianDigits]="true"
200
+ label="ساعت جلسه"
201
+ />
202
+ ```
203
+
204
+ ### 5. Global Defaults (`provideEasyTimepicker`)
205
+
206
+ Configure app-wide style & defaults once in `app.config.ts`:
207
+
208
+ ```typescript
209
+ import { ApplicationConfig } from '@angular/core';
210
+ import { provideEasyTimepicker } from 'ngx-easy-timepicker';
211
+
212
+ export const appConfig: ApplicationConfig = {
213
+ providers: [
214
+ provideEasyTimepicker({
215
+ variant: 'dial',
216
+ theme: 'auto',
217
+ appearance: 'outline',
218
+ accentColor: '#6366f1',
219
+ minuteStep: 15,
220
+ }),
221
+ ],
222
+ };
223
+ ```
224
+
225
+ ---
226
+
227
+ ## Documentation Guides
228
+
229
+ Read the step-by-step guides in [`docs/`](./docs):
230
+
231
+ - [**Getting Started**](./docs/getting-started.md) — 30-second setup, Standalone/NgModule, Zoneless, SSR & `provideEasyTimepicker`
232
+ - [**Variants, Range & Presets**](./docs/variants-and-presets.md) — Wheel vs Dial vs Grid, Time Range, Inline mode, Custom Presets
233
+ - [**Forms, Signals & Validation**](./docs/forms-and-validation.md) — `[(value)]`, Reactive Forms, `ngModel`, `valueType`, and Error Keys
234
+ - [**Custom Styles & Theming**](./docs/custom-styles-and-theming.md) — `appearance` skins, `accentColor`, `--ntp-*` variables, and copy-paste CSS themes
235
+
236
+ ---
237
+
238
+ ## API Reference
239
+
240
+ ### Inputs (`NgxTimepickerComponent`)
241
+
242
+ | Input | Type | Default | Description |
243
+ | :--- | :--- | :--- | :--- |
244
+ | `value` (model) | `TimepickerValue` | `null` | Two-way Signal model (`[(value)]`) |
245
+ | `mode` | `'single' \| 'range'` | `'single'` | Single time or `{ start, end }` range |
246
+ | `variant` | `'wheel' \| 'dial' \| 'grid'` | `'wheel'` | Visual picker UI |
247
+ | `valueType` | `'string' \| 'object' \| 'date' \| 'minutes'` | `'string'` | Output value format |
248
+ | `use24Hour` | `boolean` | `true` | 24-hour vs 12-hour AM/PM clock |
249
+ | `showSeconds` | `boolean` | `false` | Show seconds column / dial segment |
250
+ | `hourStep` | `number` | `1` | Hour step interval |
251
+ | `minuteStep` | `number` | `5` | Minute step interval (also slot interval in `grid`) |
252
+ | `secondStep` | `number` | `5` | Second step interval |
253
+ | `minTime` | `string \| TimeValue \| Date \| number \| null` | `null` | Minimum allowed time |
254
+ | `maxTime` | `string \| TimeValue \| Date \| number \| null` | `null` | Maximum allowed time |
255
+ | `disabledTimes` | `TimeInput[] \| ((t: TimeValue) => boolean) \| null` | `null` | Disabled slots or predicate |
256
+ | `presets` | `boolean \| TimePreset[]` | `false` | Enable default or custom presets sidebar |
257
+ | `inline` | `boolean` | `false` | Render panel permanently without input trigger |
258
+ | `theme` | `'light' \| 'dark' \| 'auto'` | `'light'` | Color scheme |
259
+ | `appearance` | `'default' \| 'outline' \| 'filled' \| 'minimal'` | `'default'` | Input box visual style |
260
+ | `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Input sizing |
261
+ | `accentColor` | `string \| null` | `null` | Quick brand accent hex/CSS color |
262
+ | `panelClass` | `string` | `''` | Custom CSS class added to the popover panel |
263
+ | `locale` | `string` | `'en-US'` | Locale tag (`'en-US'`, `'fa-IR'`, etc.) |
264
+ | `persianDigits` | `boolean` | Auto for `fa-*` | Render numerals using Persian digits (`۰–۹`) |
265
+ | `dir` | `'auto' \| 'ltr' \| 'rtl'` | `'auto'` | Layout direction |
266
+ | `showNowButton` | `boolean` | `true` | Show `Now` button in footer |
267
+ | `clearable` | `boolean` | `true` | Show clear (`×`) button |
268
+ | `closeOnSelect` | `boolean` | `false` | Auto-close after picking in grid/dial/preset |
269
+ | `disabled` | `boolean` | `false` | Disable interaction |
270
+ | `readonly` | `boolean` | `false` | Prevent manual typing |
271
+ | `label` / `hint` / `error` | `string` | `''` | Optional field label, helper hint, and error text |
272
+
273
+ ### Outputs
274
+
275
+ | Output | Payload | Description |
276
+ | :--- | :--- | :--- |
277
+ | `valueChange` | `TimepickerValue` | Emits whenever selected time changes |
278
+ | `opened` | `void` | Emits when popover opens |
279
+ | `closed` | `void` | Emits when popover closes |
280
+
281
+ ---
282
+
283
+ ## Development & Testing
284
+
285
+ ```bash
286
+ pnpm install
287
+ pnpm run typecheck
288
+ pnpm test
289
+ pnpm run build
290
+ ```
291
+
292
+ ---
293
+
294
+ ## License
295
+
296
+ MIT © [Reza Salehi](./LICENSE)