react-modular-datepicker 0.0.2-canary.20 → 0.0.2-canary.22
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 +1 -6
- package/dist/adapters/dayjs.d.ts +21 -0
- package/dist/classNames.d.ts +67 -0
- package/dist/components/Calendar.d.ts +14 -0
- package/dist/components/CalendarHeader.d.ts +19 -0
- package/dist/components/Day.d.ts +13 -0
- package/dist/components/MonthSelection.d.ts +13 -0
- package/dist/components/YearSelection.d.ts +12 -0
- package/dist/i18n.d.ts +9 -0
- package/dist/index.css +720 -31
- package/dist/index.d.ts +12 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +316 -0
- package/dist/index.mjs.map +1 -0
- package/dist/types.d.ts +42 -0
- package/dist/useDates-D9EvVlhK.js +2 -0
- package/dist/useDates-D9EvVlhK.js.map +1 -0
- package/dist/useDates-DQabq6Ux.mjs +201 -0
- package/dist/useDates-DQabq6Ux.mjs.map +1 -0
- package/dist/useDates.d.ts +63 -0
- package/dist/useDates.js +1 -0
- package/dist/useDates.mjs +3 -0
- package/dist/utils.d.ts +42 -0
- package/dist/utils.js +2 -0
- package/dist/utils.js.map +1 -0
- package/dist/utils.mjs +169 -0
- package/dist/utils.mjs.map +1 -0
- package/package.json +23 -20
- package/dist/cjs/index.d.ts +0 -106
- package/dist/cjs/index.js +0 -2
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/useDates.d.ts +0 -109
- package/dist/cjs/useDates.js +0 -2
- package/dist/cjs/useDates.js.map +0 -1
- package/dist/cjs/utils.d.ts +0 -84
- package/dist/cjs/utils.js +0 -2
- package/dist/cjs/utils.js.map +0 -1
- package/dist/es/index.d.mts +0 -106
- package/dist/es/index.mjs +0 -2
- package/dist/es/index.mjs.map +0 -1
- package/dist/es/useDates.d.mts +0 -109
- package/dist/es/useDates.mjs +0 -2
- package/dist/es/useDates.mjs.map +0 -1
- package/dist/es/utils.d.mts +0 -84
- package/dist/es/utils.mjs +0 -2
- package/dist/es/utils.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -103,7 +103,6 @@ function BasicExample() {
|
|
|
103
103
|
}
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
https://github.com/Dragate/react-modular-datepicker/tree/test/docs/videos/basic.webm
|
|
107
106
|
</details>
|
|
108
107
|
|
|
109
108
|
<details>
|
|
@@ -118,7 +117,6 @@ Select a start and end date with a beautiful hover preview.
|
|
|
118
117
|
/>
|
|
119
118
|
```
|
|
120
119
|
|
|
121
|
-
https://github.com/Dragate/react-modular-datepicker/tree/test/docs/videos/range.webm
|
|
122
120
|
</details>
|
|
123
121
|
|
|
124
122
|
<details>
|
|
@@ -132,7 +130,6 @@ Select as many dates as you want.
|
|
|
132
130
|
/>
|
|
133
131
|
```
|
|
134
132
|
|
|
135
|
-
https://github.com/Dragate/react-modular-datepicker/tree/test/docs/videos/multiple.webm
|
|
136
133
|
</details>
|
|
137
134
|
|
|
138
135
|
<details>
|
|
@@ -155,7 +152,6 @@ return (
|
|
|
155
152
|
);
|
|
156
153
|
```
|
|
157
154
|
|
|
158
|
-
https://github.com/Dragate/react-modular-datepicker/tree/test/docs/videos/headless.webm
|
|
159
155
|
</details>
|
|
160
156
|
|
|
161
157
|
<details>
|
|
@@ -174,7 +170,6 @@ Easily customize the look and feel using the `classNames` prop.
|
|
|
174
170
|
/>
|
|
175
171
|
```
|
|
176
172
|
|
|
177
|
-
https://github.com/Dragate/react-modular-datepicker/tree/test/docs/videos/styling.webm
|
|
178
173
|
</details>
|
|
179
174
|
|
|
180
175
|
---
|
|
@@ -197,7 +192,7 @@ Start the development server with the example app:
|
|
|
197
192
|
```bash
|
|
198
193
|
pnpm run dev
|
|
199
194
|
```
|
|
200
|
-
This runs `
|
|
195
|
+
This runs `vite` in watch mode for the library and starts the Next.js example app at `http://localhost:3000`.
|
|
201
196
|
|
|
202
197
|
### Testing
|
|
203
198
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Dayjs } from 'dayjs';
|
|
2
|
+
import { DateAdapter } from '../types';
|
|
3
|
+
export declare class DayjsAdapter implements DateAdapter<Dayjs> {
|
|
4
|
+
date(value?: any): Dayjs;
|
|
5
|
+
add(date: Dayjs, amount: number, unit: 'day' | 'month' | 'year'): Dayjs;
|
|
6
|
+
subtract(date: Dayjs, amount: number, unit: 'day' | 'month' | 'year'): Dayjs;
|
|
7
|
+
startOf(date: Dayjs, unit: 'day' | 'month' | 'year'): Dayjs;
|
|
8
|
+
endOf(date: Dayjs, unit: 'day' | 'month' | 'year'): Dayjs;
|
|
9
|
+
isBefore(date: Dayjs, comparison: Dayjs, unit?: 'day' | 'month' | 'year'): boolean;
|
|
10
|
+
isAfter(date: Dayjs, comparison: Dayjs, unit?: 'day' | 'month' | 'year'): boolean;
|
|
11
|
+
isSame(date: Dayjs, comparison: Dayjs, unit?: 'day' | 'month' | 'year'): boolean;
|
|
12
|
+
set(date: Dayjs, unit: 'day' | 'month' | 'year', value: number): Dayjs;
|
|
13
|
+
get(date: Dayjs, unit: 'day' | 'month' | 'year'): number;
|
|
14
|
+
format(date: Dayjs, formatStr: string, locale?: string): string;
|
|
15
|
+
getDaysInMonth(date: Dayjs): number;
|
|
16
|
+
toDate(date: Dayjs): Date;
|
|
17
|
+
diff(date: Dayjs, comparison: Dayjs, unit: 'month' | 'year'): number;
|
|
18
|
+
getMonths(locale?: string): string[];
|
|
19
|
+
getWeekdays(locale?: string): string[];
|
|
20
|
+
}
|
|
21
|
+
export declare const defaultAdapter: DayjsAdapter;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export interface DayClassNames {
|
|
2
|
+
day?: string;
|
|
3
|
+
selected?: string;
|
|
4
|
+
unselected?: string;
|
|
5
|
+
disabled?: string;
|
|
6
|
+
rangeStart?: string;
|
|
7
|
+
rangeEnd?: string;
|
|
8
|
+
rangeBetween?: string;
|
|
9
|
+
rangeHovering?: string;
|
|
10
|
+
[key: string]: string | undefined;
|
|
11
|
+
}
|
|
12
|
+
export declare const defaultClassNames: {
|
|
13
|
+
root: string;
|
|
14
|
+
header: string;
|
|
15
|
+
calendarsContainer: string;
|
|
16
|
+
calendarContainer: string;
|
|
17
|
+
weekdayGrid: string;
|
|
18
|
+
weekday: string;
|
|
19
|
+
daysGrid: string;
|
|
20
|
+
footer: string;
|
|
21
|
+
navButton: string;
|
|
22
|
+
monthYearContainer: string;
|
|
23
|
+
monthYearLabel: string;
|
|
24
|
+
monthYearButton: string;
|
|
25
|
+
day: {
|
|
26
|
+
day: string;
|
|
27
|
+
selected: string;
|
|
28
|
+
unselected: string;
|
|
29
|
+
disabled: string;
|
|
30
|
+
rangeStart: string;
|
|
31
|
+
rangeEnd: string;
|
|
32
|
+
rangeBetween: string;
|
|
33
|
+
rangeHovering: string;
|
|
34
|
+
};
|
|
35
|
+
monthsGrid: string;
|
|
36
|
+
monthButton: string;
|
|
37
|
+
monthButtonSelected: string;
|
|
38
|
+
monthButtonUnselected: string;
|
|
39
|
+
yearsGrid: string;
|
|
40
|
+
yearButton: string;
|
|
41
|
+
yearButtonSelected: string;
|
|
42
|
+
yearButtonUnselected: string;
|
|
43
|
+
};
|
|
44
|
+
export interface CalendarClassNames {
|
|
45
|
+
root?: string;
|
|
46
|
+
header?: string;
|
|
47
|
+
calendarsContainer?: string;
|
|
48
|
+
calendarContainer?: string;
|
|
49
|
+
weekdayGrid?: string;
|
|
50
|
+
weekday?: string;
|
|
51
|
+
daysGrid?: string;
|
|
52
|
+
footer?: string;
|
|
53
|
+
navButton?: string;
|
|
54
|
+
monthYearContainer?: string;
|
|
55
|
+
monthYearLabel?: string;
|
|
56
|
+
monthYearButton?: string;
|
|
57
|
+
day?: DayClassNames;
|
|
58
|
+
monthsGrid?: string;
|
|
59
|
+
monthButton?: string;
|
|
60
|
+
monthButtonSelected?: string;
|
|
61
|
+
monthButtonUnselected?: string;
|
|
62
|
+
yearsGrid?: string;
|
|
63
|
+
yearButton?: string;
|
|
64
|
+
yearButtonSelected?: string;
|
|
65
|
+
yearButtonUnselected?: string;
|
|
66
|
+
}
|
|
67
|
+
export declare const mergeClassNames: (custom?: CalendarClassNames) => Required<CalendarClassNames>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { UseDatesProps } from '../useDates';
|
|
3
|
+
import { Translations } from '../i18n';
|
|
4
|
+
import { DateObj, CalendarClassNames } from '../types';
|
|
5
|
+
interface CalendarProps extends UseDatesProps {
|
|
6
|
+
classNames?: CalendarClassNames;
|
|
7
|
+
locale?: string;
|
|
8
|
+
translations?: Partial<Translations>;
|
|
9
|
+
header?: React.ReactNode | ((props: any) => React.ReactNode);
|
|
10
|
+
footer?: React.ReactNode;
|
|
11
|
+
renderDayTooltip?: (dateObj: DateObj) => React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare const Calendar: React.FC<CalendarProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Calendar, CalendarClassNames } from '../types';
|
|
3
|
+
export interface HeaderProps {
|
|
4
|
+
calendars: Calendar[];
|
|
5
|
+
getBackProps: (args: any) => any;
|
|
6
|
+
getForwardProps: (args: any) => any;
|
|
7
|
+
setView: (view: 'days' | 'months' | 'years') => void;
|
|
8
|
+
monthNames: string[];
|
|
9
|
+
t: {
|
|
10
|
+
back: string;
|
|
11
|
+
forward: string;
|
|
12
|
+
};
|
|
13
|
+
classNames: Required<CalendarClassNames>;
|
|
14
|
+
slideDirection?: 'left' | 'right' | null;
|
|
15
|
+
currentView?: 'days' | 'months' | 'years';
|
|
16
|
+
}
|
|
17
|
+
export declare const ChevronLeftIcon: () => React.JSX.Element;
|
|
18
|
+
export declare const ChevronRightIcon: () => React.JSX.Element;
|
|
19
|
+
export declare const CalendarHeader: React.FC<HeaderProps>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CalendarClassNames, DateObj } from '../types';
|
|
3
|
+
interface DayProps {
|
|
4
|
+
dateObj: DateObj | null;
|
|
5
|
+
getDateProps: (args: {
|
|
6
|
+
dateObj: DateObj;
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}) => any;
|
|
9
|
+
tooltip?: React.ReactNode;
|
|
10
|
+
classNames: Required<CalendarClassNames>;
|
|
11
|
+
}
|
|
12
|
+
export declare const Day: React.FC<DayProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CalendarClassNames } from '../types';
|
|
3
|
+
interface MonthSelectionProps {
|
|
4
|
+
year: number;
|
|
5
|
+
month: number;
|
|
6
|
+
monthNames: string[];
|
|
7
|
+
minDate?: Date | null;
|
|
8
|
+
maxDate?: Date | null;
|
|
9
|
+
onMonthSelect: (month: number) => void;
|
|
10
|
+
classNames: Required<CalendarClassNames>;
|
|
11
|
+
}
|
|
12
|
+
export declare const MonthSelection: React.FC<MonthSelectionProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CalendarClassNames, DateAdapter } from '../types';
|
|
3
|
+
interface YearSelectionProps {
|
|
4
|
+
year: number;
|
|
5
|
+
minDate?: Date | null;
|
|
6
|
+
maxDate?: Date | null;
|
|
7
|
+
adapter: DateAdapter;
|
|
8
|
+
onYearSelect: (year: number) => void;
|
|
9
|
+
classNames: Required<CalendarClassNames>;
|
|
10
|
+
}
|
|
11
|
+
export declare const YearSelection: React.FC<YearSelectionProps>;
|
|
12
|
+
export {};
|
package/dist/i18n.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DateAdapter } from './types';
|
|
2
|
+
export interface Translations {
|
|
3
|
+
months: string[];
|
|
4
|
+
weekdays: string[];
|
|
5
|
+
back: string;
|
|
6
|
+
forward: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function getDefaults(adapter?: DateAdapter, locale?: string): Translations;
|
|
9
|
+
export declare function getTranslations(adapter?: DateAdapter, locale?: string, custom?: Partial<Translations>): Translations;
|