persian-date-kit 0.0.10 → 0.0.11

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.
Files changed (2) hide show
  1. package/README.md +82 -53
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -135,64 +135,82 @@ All values you receive in `onChange` are **Gregorian** (`Date | null`). Jalali i
135
135
 
136
136
  ### `PersianDatePicker`
137
137
 
138
- #### Required props
139
- - **`value`**: `Date | null` — controlled value (Gregorian)
140
- - **`onChange`**: `(date: Date | null) => void` controlled change handler
141
-
142
- #### Extra props (single picker)
143
- - **`placeholder?`**: `string` input placeholder (popover mode)
144
- - **`classes?`**: `PersianDatePickerClasses` — per-slot class overrides
138
+ | Prop | Type | Default | Description |
139
+ |---|---|---:|---|
140
+ | `value` | `Date \| null` || Controlled value (**Gregorian**) |
141
+ | `onChange` | `(date: Date \| null) => void` | — | Called with the next value (**Gregorian**) |
142
+ | `placeholder?` | `string` | `undefined` | Input placeholder (popover mode) |
143
+ | `classes?` | `PersianDatePickerClasses` | `undefined` | Per-slot class overrides (see **Classes table** below) |
145
144
 
146
145
  ### `PersianDateRangePicker`
147
146
 
148
- #### Required props
149
- - **`value`**: `{ start: Date | null; end: Date | null }` — controlled range (Gregorian)
150
- - **`onChange`**: `(range: { start: Date | null; end: Date | null }) => void`
151
-
152
- #### Extra props (range picker)
153
- - **`inputVariant?`**: `'two' | 'single'` two inputs (default) or one combined input
154
- - **`placeholder?`**: `string` used for single-input mode
155
- - **`rangeSeparator?`**: `string` separator for single-input text (default: `" - "`)
156
- - **`placeholderStart?` / `placeholderEnd?`**: `string` used for two-input mode
157
- - **`classes?`**: `PersianDateRangePickerClasses` per-slot class overrides
147
+ | Prop | Type | Default | Description |
148
+ |---|---|---:|---|
149
+ | `value` | `{ start: Date \| null; end: Date \| null }` | — | Controlled range (**Gregorian**) |
150
+ | `onChange` | `(range: { start: Date \| null; end: Date \| null }) => void` | — | Called with the next range (**Gregorian**) |
151
+ | `inputVariant?` | `'two' \| 'single'` | `'two'` | Two inputs (start/end) or a single combined input |
152
+ | `placeholder?` | `string` | `undefined` | Placeholder for **single** input mode |
153
+ | `rangeSeparator?` | `string` | `" - "` | Separator used in single-input mode (`start{sep}end`) |
154
+ | `placeholderStart?` | `string` | `undefined` | Placeholder for start input (two-input mode) |
155
+ | `placeholderEnd?` | `string` | `undefined` | Placeholder for end input (two-input mode) |
156
+ | `classes?` | `PersianDateRangePickerClasses` | `undefined` | Per-slot class overrides (see **Classes table** below) |
158
157
 
159
158
  ### Shared props (`BasePickerProps`)
160
159
 
161
160
  These props exist on both pickers:
162
161
 
163
- - **`minDate?` / `maxDate?`**: `Date` limits selectable days (Gregorian)
164
- - **`disabled?`**: `boolean`
165
- - **`mode?`**: `'popover' | 'inline'` default is `'popover'`
166
- - **`open?` / `onOpenChange?`**: control popover open state (only meaningful in popover mode)
167
- - **`popover?`**: `PopoverConfig` positioning options (popover mode)
168
- - **`formatValue?`**: `(date: Date) => string` formats input text (default: numeric Jalali `YYYY/MM/DD`)
169
- - **`parseValue?`**: `(text: string) => Date | null` parses input text into Gregorian (default: numeric Jalali `YYYY/MM/DD`)
170
- - **`weekdays?`**: `string[]` 7 labels for weekday header (if omitted, the picker uses numeric labels)
171
- - **`monthLabels?`**: `string[]` 12 labels (index 0 => month 1). If omitted, month numbers are shown.
172
- - **`renderMonthLabel?`**: `(jy: number, jm: number) => React.ReactNode` custom header label
173
- - **`prevIcon?` / `nextIcon?`**: `React.ReactNode` customize navigation icons
174
- - **`className?`**: `string` extra class on root
162
+ | Prop | Type | Default | Description |
163
+ |---|---|---:|---|
164
+ | `minDate?` | `Date` | `undefined` | Minimum selectable day (**Gregorian**) |
165
+ | `maxDate?` | `Date` | `undefined` | Maximum selectable day (**Gregorian**) |
166
+ | `disabled?` | `boolean` | `false` | Disable interactions |
167
+ | `mode?` | `'popover' \| 'inline'` | `'popover'` | `inline` shows calendar without input |
168
+ | `open?` | `boolean` | `undefined` | Control popover open state (popover mode) |
169
+ | `onOpenChange?` | `(open: boolean) => void` | `undefined` | Notified when open state changes (popover mode) |
170
+ | `popover?` | `PopoverConfig` | `{ portal: true }` | Popover positioning options (popover mode) |
171
+ | `formatValue?` | `(date: Date) => string` | built-in | Format input display (default: numeric Jalali `YYYY/MM/DD`) |
172
+ | `parseValue?` | `(text: string) => Date \| null` | built-in | Parse user text into **Gregorian** (default: numeric Jalali `YYYY/MM/DD`) |
173
+ | `weekdays?` | `string[]` | numeric | 7 weekday labels; if omitted, numeric labels are shown |
174
+ | `monthLabels?` | `string[]` | numeric | 12 month labels (index 0 => month 1); if omitted, month numbers |
175
+ | `renderMonthLabel?` | `(jy: number, jm: number) => React.ReactNode` | `undefined` | Custom header label renderer |
176
+ | `prevIcon?` | `React.ReactNode` | `undefined` | Custom previous icon |
177
+ | `nextIcon?` | `React.ReactNode` | `undefined` | Custom next icon |
178
+ | `className?` | `string` | `undefined` | Extra class on the root element |
175
179
 
176
180
  ### `PopoverConfig`
177
181
 
178
- - **`portal?`**: `boolean` (default: `true`) recommended inside modals / overflow containers
179
- - **`gutter?`**: `number` (default: `8`) — gap between anchor and popover
180
- - **`padding?`**: `number` (default: `8`) minimum distance from viewport edges (clamping)
181
- - **`strategy?`**: `'fixed' | 'absolute'` (default: `'fixed'`)
182
- - **`placements?`**: `Array<'bottom' | 'top' | 'left' | 'right'>` (default: `['bottom','top','left','right']`)
183
- - **`align?`**: `'start' | 'center' | 'end'` (default: `'end'`)
182
+ | Prop | Type | Default | Description |
183
+ |---|---|---:|---|
184
+ | `portal?` | `boolean` | `true` | Render popover in a portal (recommended for **modals/overflow** containers) |
185
+ | `gutter?` | `number` | `8` | Gap between anchor and popover |
186
+ | `padding?` | `number` | `8` | Minimum distance from viewport edges (clamping) |
187
+ | `strategy?` | `'fixed' \| 'absolute'` | `'fixed'` | Positioning strategy |
188
+ | `placements?` | `Array<'bottom' \| 'top' \| 'left' \| 'right'>` | `['bottom','top','left','right']` | Preferred placements order (auto-flip chooses best fit) |
189
+ | `align?` | `'start' \| 'center' \| 'end'` | `'end'` | Cross-axis alignment |
184
190
 
185
191
  ### Styling slots (`classes`)
186
192
 
187
- You can override the class names per slot:
188
-
189
- - **Base slots** (`BasePickerClasses`):
190
- - `root`, `input`, `button`, `popover`, `header`, `navButton`, `monthLabel`, `grid`, `weekday`
191
- - `day`, `dayOutside`, `dayDisabled`, `dayToday`
192
- - **Single picker extra slots** (`PersianDatePickerClasses`):
193
- - `daySelected`
194
- - **Range picker extra slots** (`PersianDateRangePickerClasses`):
195
- - `dayRangeStart`, `dayRangeEnd`, `dayInRange`
193
+ You can override class names per slot:
194
+
195
+ | Slot | Used for |
196
+ |---|---|
197
+ | `root` | Root wrapper |
198
+ | `input` | Input element |
199
+ | `button` | Clear button (single picker) |
200
+ | `popover` | Popover container |
201
+ | `header` | Calendar header |
202
+ | `navButton` | Navigation buttons (prev/next) |
203
+ | `monthLabel` | Header month/year label button |
204
+ | `grid` | Grid container |
205
+ | `weekday` | Weekday header cell |
206
+ | `day` | Day button |
207
+ | `dayOutside` | Day that belongs to adjacent month |
208
+ | `dayDisabled` | Disabled day |
209
+ | `dayToday` | Today day |
210
+ | `daySelected` | **Single picker** selected day |
211
+ | `dayInRange` | **Range picker** day inside range |
212
+ | `dayRangeStart` | **Range picker** range start day |
213
+ | `dayRangeEnd` | **Range picker** range end day |
196
214
 
197
215
  ## Styling / Theming
198
216
 
@@ -208,15 +226,17 @@ The default CSS is built around **CSS variables**, so it’s easy to theme.
208
226
 
209
227
  These variables control most of the look:
210
228
 
211
- - `--dvx-pdp-bg`
212
- - `--dvx-pdp-fg`
213
- - `--dvx-pdp-muted`
214
- - `--dvx-pdp-border`
215
- - `--dvx-pdp-shadow`
216
- - `--dvx-pdp-accent`
217
- - `--dvx-pdp-accentFg`
218
- - `--dvx-pdp-ring`
219
- - `--dvx-pdp-dayHover`
229
+ | CSS variable | Purpose | Default (light) |
230
+ |---|---|---|
231
+ | `--dvx-pdp-bg` | Surface background | `#ffffff` |
232
+ | `--dvx-pdp-fg` | Main text | `#111827` |
233
+ | `--dvx-pdp-muted` | Muted text | `#6b7280` |
234
+ | `--dvx-pdp-border` | Borders | `#e5e7eb` |
235
+ | `--dvx-pdp-shadow` | Popover shadow | `0 10px 20px rgba(0, 0, 0, 0.08)` |
236
+ | `--dvx-pdp-accent` | Accent / selected | `#2563eb` |
237
+ | `--dvx-pdp-accentFg` | Text on accent | `#ffffff` |
238
+ | `--dvx-pdp-ring` | Focus ring | `rgba(37, 99, 235, 0.3)` |
239
+ | `--dvx-pdp-dayHover` | Hover background | `rgba(37, 99, 235, 0.08)` |
220
240
 
221
241
  Example:
222
242
 
@@ -249,6 +269,15 @@ If you **don’t** import `styles.css`, you should provide your own CSS for the
249
269
  component class hooks (ex: `.dvx-pdp`, `.dvx-pdp__input`, `.dvx-pdp__day`, ...),
250
270
  or rely entirely on `classes` and your own styles.
251
271
 
272
+ ### Styling approaches (summary table)
273
+
274
+ | Approach | What you do | Best for |
275
+ |---|---|---|
276
+ | Default styles | Import `persian-date-kit/styles.css` | Fastest start, good baseline |
277
+ | Theme variables | Override `--dvx-pdp-*` in your CSS | Brand theming without rewriting CSS |
278
+ | `classes` overrides | Pass Tailwind/utility classes via `classes` | Integrate into your design system |
279
+ | Full custom | Don’t import `styles.css`; write your own | Complete visual control |
280
+
252
281
  ## Development (this repo)
253
282
 
254
283
  Clone the repository:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "persian-date-kit",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "Production-ready Persian (Jalali) date pickers for React with Gregorian-only values.",
5
5
  "keywords": [
6
6
  "react",