@nepdatejs/react 0.0.0-bootstrap → 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 +21 -0
- package/README.md +73 -1
- package/dist/date-text-BT82cZ7i.cjs +84 -0
- package/dist/date-text-BT82cZ7i.cjs.map +1 -0
- package/dist/date-text-Df1gFksR.js +61 -0
- package/dist/date-text-Df1gFksR.js.map +1 -0
- package/dist/date-text-Dipetpbp.d.cts +37 -0
- package/dist/date-text-Dipetpbp.d.ts +37 -0
- package/dist/headless-6BuUOtOR.d.cts +194 -0
- package/dist/headless-BK0XRHKb.js +513 -0
- package/dist/headless-BK0XRHKb.js.map +1 -0
- package/dist/headless-CFZ06zLn.d.ts +194 -0
- package/dist/headless-HxTkvgbz.cjs +572 -0
- package/dist/headless-HxTkvgbz.cjs.map +1 -0
- package/dist/headless.cjs +11 -0
- package/dist/headless.d.cts +2 -0
- package/dist/headless.d.ts +2 -0
- package/dist/headless.js +2 -0
- package/dist/index.cjs +891 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +245 -0
- package/dist/index.d.ts +245 -0
- package/dist/index.js +871 -0
- package/dist/index.js.map +1 -0
- package/dist/server.cjs +6 -0
- package/dist/server.d.cts +2 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +1 -0
- package/package.json +107 -4
- package/src/bindings.ts +247 -0
- package/src/calendar-body.tsx +133 -0
- package/src/calendar.tsx +34 -0
- package/src/date-picker.tsx +350 -0
- package/src/date-range-picker.tsx +223 -0
- package/src/date-text.tsx +110 -0
- package/src/date-time-picker.tsx +287 -0
- package/src/headless.ts +21 -0
- package/src/hooks.ts +474 -0
- package/src/icons.tsx +35 -0
- package/src/index.ts +21 -0
- package/src/multi-date-picker.tsx +243 -0
- package/src/panel.ts +67 -0
- package/src/presets.tsx +44 -0
- package/src/server.ts +8 -0
- package/src/time-columns.tsx +60 -0
- package/src/use-store.ts +113 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { _ as useCalendarBindings, a as DateTimePickerBindings, c as PanelProps, d as useDateRangePicker, f as useDateTimePicker, g as GridProps, h as CalendarBindings, i as DateRangePickerBindings, l as useCalendar, m as ButtonProps, n as useStore, o as InputProps, p as useMultiDatePicker, r as DatePickerBindings, s as MultiDatePickerBindings, t as deepEqual, u as useDatePicker } from "./headless-CFZ06zLn.js";
|
|
2
|
+
import { a as shortDate, i as bothDates, n as DateTextProps, r as ShortDate, t as DateText } from "./date-text-Dipetpbp.js";
|
|
3
|
+
import { ReactElement } from "react";
|
|
4
|
+
import { CalendarDate, CalendarSystem, DateFormatPattern, LocaleCode, Weekday } from "@nepdatejs/core";
|
|
5
|
+
import { CalendarOptions, CalendarSelection, EventMarker, HolidayInput, HolidayLookup } from "@nepdatejs/calendar";
|
|
6
|
+
import { DateDetail, DateTimeDetail, RangeDetail, RangePreset, RangeValue, SinglePreset, TimeCell } from "@nepdatejs/datepicker";
|
|
7
|
+
import { PanelLayout } from "@nepdatejs/dom";
|
|
8
|
+
//#region src/calendar.d.ts
|
|
9
|
+
interface CalendarProps extends Omit<CalendarOptions, "onSelect" | "visibleMonth" | "onVisibleMonthChange"> {
|
|
10
|
+
/** Show this month (any day in it); pair with onMonthChange to control it. */
|
|
11
|
+
month?: CalendarDate | undefined;
|
|
12
|
+
onMonthChange?: ((month: CalendarDate) => void) | undefined;
|
|
13
|
+
onSelect?: ((selection: CalendarSelection) => void) | undefined;
|
|
14
|
+
className?: string | undefined;
|
|
15
|
+
theme?: "light" | "dark" | "auto" | undefined;
|
|
16
|
+
}
|
|
17
|
+
/** A standalone BS/AD month view with keyboard support. */
|
|
18
|
+
export declare function Calendar({ month, onMonthChange, className, theme, ...options }: CalendarProps): ReactElement;
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/date-picker.d.ts
|
|
21
|
+
interface DatePickerProps {
|
|
22
|
+
/** The AD date as "YYYY-MM-DD", or "": the same value a native date input uses. */
|
|
23
|
+
value?: string | undefined;
|
|
24
|
+
/** The starting value when the field keeps its own state, as in a plain form with `name`. */
|
|
25
|
+
defaultValue?: string | undefined;
|
|
26
|
+
onChange?: ((value: string, date: DateDetail | null) => void) | undefined;
|
|
27
|
+
/** Show and type dates in this calendar only, and hide the BS/AD switch. */
|
|
28
|
+
calendar?: CalendarSystem | undefined;
|
|
29
|
+
/** The calendar shown first when the viewer has not chosen one. */
|
|
30
|
+
defaultCalendar?: CalendarSystem | undefined;
|
|
31
|
+
/** Called when the viewer switches BS/AD. */
|
|
32
|
+
onCalendarChange?: ((calendar: CalendarSystem) => void) | undefined;
|
|
33
|
+
/** Earliest and latest allowed days, as AD "YYYY-MM-DD". */
|
|
34
|
+
min?: string | undefined;
|
|
35
|
+
max?: string | undefined;
|
|
36
|
+
isDateDisabled?: ((date: CalendarDate) => boolean) | undefined;
|
|
37
|
+
/** Names, digits and messages; defaults to the page language (ne when <html lang="ne">). */
|
|
38
|
+
locale?: LocaleCode | undefined;
|
|
39
|
+
/** Submit the AD value with a plain form under this name. */
|
|
40
|
+
name?: string | undefined;
|
|
41
|
+
id?: string | undefined;
|
|
42
|
+
placeholder?: string | undefined;
|
|
43
|
+
required?: boolean | undefined;
|
|
44
|
+
disabled?: boolean | undefined;
|
|
45
|
+
clearable?: boolean | undefined;
|
|
46
|
+
/** Show the same day in the other calendar under the field. */
|
|
47
|
+
showEquivalent?: boolean | undefined;
|
|
48
|
+
holidays?: readonly HolidayInput[] | HolidayLookup | undefined;
|
|
49
|
+
events?: ((date: CalendarDate) => readonly EventMarker[]) | undefined;
|
|
50
|
+
weekStartsOn?: Weekday | undefined;
|
|
51
|
+
weekendDays?: readonly Weekday[] | undefined;
|
|
52
|
+
/** Show the other calendar's day number under each day. Default true. */
|
|
53
|
+
showOtherCalendar?: boolean | undefined;
|
|
54
|
+
displayFormat?: DateFormatPattern | undefined;
|
|
55
|
+
closeOnSelect?: boolean | undefined;
|
|
56
|
+
/** Shortcuts beside the calendar: 'today', 'yesterday', 'tomorrow' or { id, label, resolve }. */
|
|
57
|
+
presets?: readonly SinglePreset[] | undefined;
|
|
58
|
+
/** Remember the viewer's BS/AD choice in localStorage under this key. */
|
|
59
|
+
persistCalendar?: string | undefined;
|
|
60
|
+
/** Override "today" (tests, server rendering). */
|
|
61
|
+
today?: CalendarDate | undefined;
|
|
62
|
+
/** Add the dashes of YYYY-MM-DD while the user types digits. Default true. */
|
|
63
|
+
mask?: boolean | undefined;
|
|
64
|
+
/** Show the calendar in the page, always open, instead of in a popover. */
|
|
65
|
+
inline?: boolean | undefined;
|
|
66
|
+
/** 'sheet' opens a bottom sheet; 'popover' sits beside the field; 'auto' (default) uses the sheet below 480px. */
|
|
67
|
+
panelLayout?: PanelLayout | undefined;
|
|
68
|
+
theme?: "light" | "dark" | "auto" | undefined;
|
|
69
|
+
className?: string | undefined;
|
|
70
|
+
"aria-label"?: string | undefined;
|
|
71
|
+
"aria-invalid"?: boolean | undefined;
|
|
72
|
+
"aria-describedby"?: string | undefined;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* A BS/AD date field: type a date or pick it from a calendar. The value is
|
|
76
|
+
* always the AD day as "YYYY-MM-DD", so forms, validation and storage are
|
|
77
|
+
* unchanged and a BS date can never be sent as if it were AD.
|
|
78
|
+
*/
|
|
79
|
+
export declare function DatePicker(props: DatePickerProps): ReactElement;
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/date-range-picker.d.ts
|
|
82
|
+
interface DateRangePickerProps {
|
|
83
|
+
value?: RangeValue | undefined;
|
|
84
|
+
defaultValue?: RangeValue | undefined;
|
|
85
|
+
onChange?: ((value: RangeValue, detail: RangeDetail) => void) | undefined;
|
|
86
|
+
calendar?: CalendarSystem | undefined;
|
|
87
|
+
defaultCalendar?: CalendarSystem | undefined;
|
|
88
|
+
min?: string | undefined;
|
|
89
|
+
max?: string | undefined;
|
|
90
|
+
minDays?: number | undefined;
|
|
91
|
+
maxDays?: number | undefined;
|
|
92
|
+
/** Shortcuts beside the calendar: 'last7Days', 'thisMonth', 'thisFiscalYear', … or { id, label, resolve }. */
|
|
93
|
+
presets?: readonly RangePreset[] | undefined;
|
|
94
|
+
isDateDisabled?: ((date: CalendarDate) => boolean) | undefined;
|
|
95
|
+
holidays?: readonly HolidayInput[] | HolidayLookup | undefined;
|
|
96
|
+
locale?: LocaleCode | undefined;
|
|
97
|
+
weekStartsOn?: Weekday | undefined;
|
|
98
|
+
weekendDays?: readonly Weekday[] | undefined;
|
|
99
|
+
showOtherCalendar?: boolean | undefined;
|
|
100
|
+
today?: CalendarDate | undefined;
|
|
101
|
+
/** Field names for plain form posts. */
|
|
102
|
+
startName?: string | undefined;
|
|
103
|
+
endName?: string | undefined;
|
|
104
|
+
startLabel?: string | undefined;
|
|
105
|
+
endLabel?: string | undefined;
|
|
106
|
+
/** Show a "Fiscal year" button that switches the panel to fiscal-year tiles. */
|
|
107
|
+
fiscalYearView?: boolean | undefined;
|
|
108
|
+
disabled?: boolean | undefined;
|
|
109
|
+
/** Add the dashes of YYYY-MM-DD while the user types digits. Default true. */
|
|
110
|
+
mask?: boolean | undefined;
|
|
111
|
+
/** Show the calendar in the page, always open, instead of in a popover. */
|
|
112
|
+
inline?: boolean | undefined;
|
|
113
|
+
/** 'sheet' opens a bottom sheet; 'popover' sits beside the field; 'auto' (default) uses the sheet below 480px. */
|
|
114
|
+
panelLayout?: PanelLayout | undefined;
|
|
115
|
+
theme?: "light" | "dark" | "auto" | undefined;
|
|
116
|
+
className?: string | undefined;
|
|
117
|
+
}
|
|
118
|
+
/** Two BS/AD date fields sharing one calendar panel in range mode. */
|
|
119
|
+
export declare function DateRangePicker({ startName, endName, startLabel, endLabel, fiscalYearView, disabled, panelLayout, theme, className, ...options }: DateRangePickerProps): ReactElement;
|
|
120
|
+
//#endregion
|
|
121
|
+
//#region src/date-time-picker.d.ts
|
|
122
|
+
interface DateTimePickerProps {
|
|
123
|
+
/** ISO timestamp with offset ("2026-10-18T14:30:00+05:45") or "". */
|
|
124
|
+
value?: string | undefined;
|
|
125
|
+
defaultValue?: string | undefined;
|
|
126
|
+
onChange?: ((value: string, detail: DateTimeDetail | null) => void) | undefined;
|
|
127
|
+
/** The zone the picker shows and the value's offset. Default Asia/Kathmandu (core config). */
|
|
128
|
+
timeZone?: string | undefined;
|
|
129
|
+
hour12?: boolean | undefined;
|
|
130
|
+
/** Minutes in the column (1–30). Default 5. */
|
|
131
|
+
minuteStep?: number | undefined;
|
|
132
|
+
/** Time used when a day is picked first. Default "00:00". */
|
|
133
|
+
defaultTime?: string | undefined;
|
|
134
|
+
calendar?: CalendarSystem | undefined;
|
|
135
|
+
defaultCalendar?: CalendarSystem | undefined;
|
|
136
|
+
/** Earliest and latest days, AD "YYYY-MM-DD". */
|
|
137
|
+
min?: string | undefined;
|
|
138
|
+
max?: string | undefined;
|
|
139
|
+
isDateDisabled?: ((date: CalendarDate) => boolean) | undefined;
|
|
140
|
+
holidays?: readonly HolidayInput[] | HolidayLookup | undefined;
|
|
141
|
+
presets?: readonly SinglePreset[] | undefined;
|
|
142
|
+
locale?: LocaleCode | undefined;
|
|
143
|
+
weekStartsOn?: Weekday | undefined;
|
|
144
|
+
today?: CalendarDate | undefined;
|
|
145
|
+
/** Submit the ISO value with a plain form. */
|
|
146
|
+
name?: string | undefined;
|
|
147
|
+
id?: string | undefined;
|
|
148
|
+
required?: boolean | undefined;
|
|
149
|
+
disabled?: boolean | undefined;
|
|
150
|
+
/** Add the dashes of YYYY-MM-DD while the user types digits. Default true. */
|
|
151
|
+
mask?: boolean | undefined;
|
|
152
|
+
/** Show the calendar in the page, always open, instead of in a popover. */
|
|
153
|
+
inline?: boolean | undefined;
|
|
154
|
+
/** 'sheet' opens a bottom sheet; 'popover' sits beside the field; 'auto' (default) uses the sheet below 480px. */
|
|
155
|
+
panelLayout?: PanelLayout | undefined;
|
|
156
|
+
theme?: "light" | "dark" | "auto" | undefined;
|
|
157
|
+
className?: string | undefined;
|
|
158
|
+
/** Accessible names for the two inputs. */
|
|
159
|
+
"aria-label"?: string | undefined;
|
|
160
|
+
timeLabel?: string | undefined;
|
|
161
|
+
}
|
|
162
|
+
/** A BS/AD date and time field. The value is one instant, with the zone's offset. */
|
|
163
|
+
export declare function DateTimePicker({ name, required, disabled, panelLayout, theme, className, "aria-label": ariaLabel, timeLabel, ...options }: DateTimePickerProps): ReactElement;
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/multi-date-picker.d.ts
|
|
166
|
+
interface MultiDatePickerProps {
|
|
167
|
+
/** AD "YYYY-MM-DD" days. */
|
|
168
|
+
value?: readonly string[] | undefined;
|
|
169
|
+
defaultValue?: readonly string[] | undefined;
|
|
170
|
+
onChange?: ((value: readonly string[], dates: readonly DateDetail[]) => void) | undefined;
|
|
171
|
+
calendar?: CalendarSystem | undefined;
|
|
172
|
+
defaultCalendar?: CalendarSystem | undefined;
|
|
173
|
+
onCalendarChange?: ((calendar: CalendarSystem) => void) | undefined;
|
|
174
|
+
/** Earliest and latest allowed days, as AD "YYYY-MM-DD". */
|
|
175
|
+
min?: string | undefined;
|
|
176
|
+
max?: string | undefined;
|
|
177
|
+
/** The most days that may be chosen. */
|
|
178
|
+
maxDates?: number | undefined;
|
|
179
|
+
isDateDisabled?: ((date: CalendarDate) => boolean) | undefined;
|
|
180
|
+
holidays?: readonly HolidayInput[] | HolidayLookup | undefined;
|
|
181
|
+
events?: ((date: CalendarDate) => readonly EventMarker[]) | undefined;
|
|
182
|
+
locale?: LocaleCode | undefined;
|
|
183
|
+
weekStartsOn?: Weekday | undefined;
|
|
184
|
+
weekendDays?: readonly Weekday[] | undefined;
|
|
185
|
+
showOtherCalendar?: boolean | undefined;
|
|
186
|
+
/** Close the panel after each click. Default false. */
|
|
187
|
+
closeOnSelect?: boolean | undefined;
|
|
188
|
+
/** Add the dashes of YYYY-MM-DD while the user types digits. Default true. */
|
|
189
|
+
mask?: boolean | undefined;
|
|
190
|
+
/** Show the calendar in the page, always open, instead of in a popover. */
|
|
191
|
+
inline?: boolean | undefined;
|
|
192
|
+
/** 'sheet' opens a bottom sheet; 'popover' sits beside the field; 'auto' (default) uses the sheet below 480px. */
|
|
193
|
+
panelLayout?: PanelLayout | undefined;
|
|
194
|
+
/** Submit each day under this name, one hidden input per day. */
|
|
195
|
+
name?: string | undefined;
|
|
196
|
+
id?: string | undefined;
|
|
197
|
+
placeholder?: string | undefined;
|
|
198
|
+
required?: boolean | undefined;
|
|
199
|
+
disabled?: boolean | undefined;
|
|
200
|
+
clearable?: boolean | undefined;
|
|
201
|
+
today?: CalendarDate | undefined;
|
|
202
|
+
theme?: "light" | "dark" | "auto" | undefined;
|
|
203
|
+
className?: string | undefined;
|
|
204
|
+
"aria-label"?: string | undefined;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Several separate BS/AD days in one field (PICK-001): click days in the
|
|
208
|
+
* panel to add or remove them, or type them separated by commas. The value is
|
|
209
|
+
* the sorted AD days as "YYYY-MM-DD" strings.
|
|
210
|
+
*/
|
|
211
|
+
export declare function MultiDatePicker({ name, placeholder, required, disabled, clearable, panelLayout, theme, className, "aria-label": ariaLabel, ...options }: MultiDatePickerProps): ReactElement;
|
|
212
|
+
//#endregion
|
|
213
|
+
//#region src/time-columns.d.ts
|
|
214
|
+
/** Hour and minute columns (Figma "Time Item"); the selected items scroll into view. */
|
|
215
|
+
export declare function TimeColumns({ hours, minutes, locale, onHour, onMinute }: {
|
|
216
|
+
hours: readonly TimeCell[];
|
|
217
|
+
minutes: readonly TimeCell[];
|
|
218
|
+
locale?: LocaleCode | undefined;
|
|
219
|
+
onHour: (hour: number) => void;
|
|
220
|
+
onMinute: (minute: number) => void;
|
|
221
|
+
}): ReactElement;
|
|
222
|
+
//#endregion
|
|
223
|
+
//#region src/calendar-body.d.ts
|
|
224
|
+
/** The calendar markup (@nepdatejs/styles contract) for any set of bindings. */
|
|
225
|
+
export declare function CalendarBody({ bindings, className, theme }: {
|
|
226
|
+
bindings: CalendarBindings;
|
|
227
|
+
className?: string | undefined;
|
|
228
|
+
theme?: string | undefined;
|
|
229
|
+
}): ReactElement;
|
|
230
|
+
//#endregion
|
|
231
|
+
//#region src/icons.d.ts
|
|
232
|
+
declare const PATHS: {
|
|
233
|
+
readonly "chevron-left": readonly ["M10 3.5 5.5 8l4.5 4.5"];
|
|
234
|
+
readonly "chevron-right": readonly ["M6 3.5 10.5 8 6 12.5"];
|
|
235
|
+
readonly calendar: readonly ["M2 6.5h12", "M5.5 1.5v3", "M10.5 1.5v3", "M4 3h8a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2Z"];
|
|
236
|
+
readonly close: readonly ["M4 4l8 8", "M12 4l-8 8"];
|
|
237
|
+
};
|
|
238
|
+
type IconName = keyof typeof PATHS;
|
|
239
|
+
/** The Figma icon set, 16px, stroked with currentColor. */
|
|
240
|
+
export declare function Icon({ name }: {
|
|
241
|
+
name: IconName;
|
|
242
|
+
}): ReactElement;
|
|
243
|
+
//#endregion
|
|
244
|
+
export { type ButtonProps, type CalendarBindings, type CalendarProps, type DatePickerBindings, type DatePickerProps, type DateRangePickerBindings, type DateRangePickerProps, DateText, type DateTextProps, type DateTimePickerBindings, type DateTimePickerProps, type GridProps, type IconName, type InputProps, type MultiDatePickerBindings, type MultiDatePickerProps, type PanelProps, ShortDate, bothDates, deepEqual, shortDate, useCalendar, useCalendarBindings, useDatePicker, useDateRangePicker, useDateTimePicker, useMultiDatePicker, useStore };
|
|
245
|
+
//# sourceMappingURL=index.d.ts.map
|