persian-date-kit 1.1.0 → 1.1.2

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/README.md CHANGED
@@ -107,6 +107,96 @@ export function RangeExample() {
107
107
  }
108
108
  ```
109
109
 
110
+ ### Date picker with time
111
+
112
+ ```tsx
113
+ import { useState } from 'react'
114
+ import { PersianDatePicker } from 'persian-date-kit'
115
+
116
+ export function DateTimeExample() {
117
+ const [value, setValue] = useState<Date | null>(new Date())
118
+
119
+ return (
120
+ <PersianDatePicker
121
+ value={value}
122
+ onChange={setValue}
123
+ placeholder="YYYY/MM/DD HH:mm"
124
+ timePicker={{
125
+ enabled: true,
126
+ format: 'HH:mm',
127
+ defaultTime: { hour: 12, minute: 0 },
128
+ hourStep: 1,
129
+ minuteStep: 5,
130
+ }}
131
+ />
132
+ )
133
+ }
134
+ ```
135
+
136
+ Or simply enable with defaults:
137
+
138
+ ```tsx
139
+ <PersianDatePicker
140
+ value={value}
141
+ onChange={setValue}
142
+ timePicker={true} // Uses default time 00:00
143
+ />
144
+ ```
145
+
146
+ With seconds:
147
+
148
+ ```tsx
149
+ <PersianDatePicker
150
+ value={value}
151
+ onChange={setValue}
152
+ timePicker={{
153
+ enabled: true,
154
+ format: 'HH:mm:ss',
155
+ showSeconds: true,
156
+ }}
157
+ />
158
+ ```
159
+
160
+ ### Multiple date selection
161
+
162
+ ```tsx
163
+ import { useState } from 'react'
164
+ import { PersianDatePicker } from 'persian-date-kit'
165
+
166
+ export function MultipleSelectionExample() {
167
+ const [dates, setDates] = useState<Date[]>([])
168
+
169
+ return (
170
+ <PersianDatePicker
171
+ value={dates}
172
+ onChange={setDates}
173
+ multiple={true}
174
+ maxSelections={5} // Optional: limit number of selections
175
+ />
176
+ )
177
+ }
178
+ ```
179
+
180
+ ### Custom calendar button
181
+
182
+ ```tsx
183
+ import { Calendar } from 'lucide-react'
184
+
185
+ // Hide the calendar button
186
+ <PersianDatePicker
187
+ value={value}
188
+ onChange={setValue}
189
+ showCalendarButton={false}
190
+ />
191
+
192
+ // Use custom icon
193
+ <PersianDatePicker
194
+ value={value}
195
+ onChange={setValue}
196
+ calendarIcon={<Calendar className="w-4 h-4" />}
197
+ />
198
+ ```
199
+
110
200
  ## React Hook Form (optional adapter)
111
201
  The core package has **no required** form dependency.
112
202
  If you want React Hook Form integration, import from the subpath:
@@ -141,9 +231,14 @@ All values you receive in `onChange` are **Gregorian** (`Date | null`). Jalali i
141
231
 
142
232
  | Prop | Type | Default | Description |
143
233
  |---|---|---:|---|
144
- | `value` | `Date \| null` | — | Controlled value (**Gregorian**) |
145
- | `onChange` | `(date: Date \| null) => void` | — | Called with the next value (**Gregorian**) |
234
+ | `value` | `Date \| null \| Date[]` | — | Controlled value (**Gregorian**). Can be single date or array for multiple selection |
235
+ | `onChange` | `(date: Date \| null \| Date[]) => void` | — | Called with the next value (**Gregorian**) |
146
236
  | `placeholder?` | `string` | `undefined` | Input placeholder (popover mode) |
237
+ | `multiple?` | `boolean` | `false` | Enable multiple date selection |
238
+ | `maxSelections?` | `number` | `undefined` | Maximum number of selectable dates (multiple mode) |
239
+ | `timePicker?` | `TimePickerConfig \| boolean` | `undefined` | Enable time picker (see **TimePickerConfig** below) |
240
+ | `showCalendarButton?` | `boolean` | `true` | Show/hide the calendar button |
241
+ | `calendarIcon?` | `React.ReactNode` | `undefined` | Custom calendar icon. If not provided, default icon is used |
147
242
  | `classes?` | `PersianDatePickerClasses` | `undefined` | Per-slot class overrides (see **Classes table** below) |
148
243
 
149
244
  ### `PersianDateRangePicker`
@@ -182,6 +277,20 @@ These props exist on both pickers:
182
277
  | `nextIcon?` | `React.ReactNode` | `undefined` | Custom next icon |
183
278
  | `className?` | `string` | `undefined` | Extra class on the root element |
184
279
 
280
+ ### `TimePickerConfig`
281
+
282
+ | Prop | Type | Default | Description |
283
+ |---|---|---:|---|
284
+ | `enabled` | `boolean` | — | Enable time picker |
285
+ | `format?` | `'HH:mm' \| 'HH:mm:ss'` | `'HH:mm'` | Time format |
286
+ | `defaultTime?` | `{ hour: number; minute: number; second?: number }` | `undefined` | Default time when value is null (uses current time if not provided) |
287
+ | `showSeconds?` | `boolean` | `false` | Show seconds stepper (requires `format: 'HH:mm:ss'`) |
288
+ | `hourStep?` | `number` | `1` | Step size for hour increment/decrement |
289
+ | `minuteStep?` | `number` | `1` | Step size for minute increment/decrement |
290
+ | `secondStep?` | `number` | `1` | Step size for second increment/decrement |
291
+
292
+ **Note:** You can also pass `timePicker={true}` as a shorthand to enable with defaults.
293
+
185
294
  ### `PopoverConfig`
186
295
 
187
296
  | Prop | Type | Default | Description |
@@ -216,6 +325,11 @@ You can override class names per slot:
216
325
  | `dayInRange` | **Range picker** day inside range |
217
326
  | `dayRangeStart` | **Range picker** range start day |
218
327
  | `dayRangeEnd` | **Range picker** range end day |
328
+ | `timePicker` | Time picker container |
329
+ | `timeStepper` | Time stepper wrapper (hour/minute/second) |
330
+ | `timeStepperButton` | Stepper increment/decrement buttons |
331
+ | `timeStepperInput` | Time input field |
332
+ | `timeSeparator` | Time separator (`:`) |
219
333
 
220
334
  ## Styling / Theming
221
335