Skip to content

Commit f41d74e

Browse files
committed
fix: types export
1 parent 722b55e commit f41d74e

File tree

3 files changed

+4
-84
lines changed

3 files changed

+4
-84
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "svelte-flatpickr-plus",
3-
"version": "2.0.5",
3+
"version": "2.0.6",
44
"description": "Flatpickr is a lightweight and powerful datetime picker. Svelte Flatpickr Plus is a wrapper for Flatpickr with some extra features.",
55
"homepage": "https://github.com/kodaicoder/svelte-flatpickr-plus",
66
"bugs": {

src/lib/index.ts

Lines changed: 1 addition & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,7 @@
11
export { default as default } from './actions.svelte.js';
22
export { default as l10n } from 'flatpickr_plus/dist/l10n';
33
import { default as tc, getCurrentThemeName } from './themeChanger.js';
4-
import type { DateLimit, DateOption, Hook } from './types.js';
5-
export type FlatpickrOptions = {
6-
allowInput?: boolean; // Allows the user to enter a date directly into the input field.
7-
allowInvalidPreload?: boolean; // Allow preloading of an invalid date.
8-
altFormat?: string; // Exactly the same as date format, but for the altInput field.
9-
altInput?: boolean; // Show the user a readable date (as per altFormat).
10-
altInputClass?: string; // Class added to the input element created by the altInput option.
11-
animate?: boolean; // Whether to enable animations, such as month transitions.
12-
appendTo?: HTMLElement; // Appends the calendar to the specified node instead of body.
13-
ariaDateFormat?: string; // Defines how the date will be formatted in the aria-label.
14-
autoFillDefaultTime?: boolean; // Whether the default time should be auto-filled.
15-
clickOpens?: boolean; // Whether clicking on the input should open the picker.
16-
closeOnSelect?: boolean; // Whether the calendar should close after date selection.
17-
conjunction?: string; // Used to join selected dates together for the date input value.
18-
dateFormat?: string; // Defines how the date will be displayed in the input box.
19-
defaultDate?: DateOption | DateOption[]; // The initial selected date(s).
20-
defaultHour?: number; // Initial value of the hour element.
21-
defaultMinute?: number; // Initial value of the minute element.
22-
defaultSeconds?: number; // Initial value of the seconds element.
23-
disable?: DateLimit<DateOption>[]; // Disables certain dates.
24-
disableMobile?: boolean; // Always use the non-native picker on mobile devices.
25-
enable?: DateLimit<DateOption>[]; // Disables all dates except these specified.
26-
enableSeconds?: boolean; // Enables seconds selection in the time picker.
27-
enableTime?: boolean; // Enables the time picker.
28-
errorHandler?: (e: Error) => void; // Custom error handling function.
29-
formatDate?: (date: Date, format: string, locale: any) => string; // Custom date formatting function.
30-
getWeek?: (date: Date) => string | number; // Outputs the week number for a given date.
31-
hourIncrement?: number; // Adjusts the step for the hour input.
32-
ignoredFocusElements?: HTMLElement[]; // Elements that will not close the calendar when clicked.
33-
inline?: boolean; // Displays the calendar inline.
34-
isMonthPicker?: boolean; // Whether the calendar is a month picker.
35-
locale?: any | Partial<any>; // The locale, either as a string or as an object.
36-
maxDate?: DateOption; // The maximum date that a user can pick.
37-
maxTime?: DateOption; // The maximum time that a user can pick.
38-
minDate?: DateOption; // The minimum date that a user can pick.
39-
minTime?: DateOption; // The minimum time that a user can pick.
40-
minuteIncrement?: number; // Adjusts the step for the minute input.
41-
mode?: 'single' | 'multiple' | 'range' | 'time'; // Date selection mode.
42-
monthSelectorType?: 'dropdown' | 'static'; // How the month selector should be shown.
43-
nextArrow?: string; // HTML for the right arrow icon.
44-
noCalendar?: boolean; // Hides the day selection in the calendar.
45-
now?: DateOption; // Specifies the current date and time.
46-
onChange?: Hook | Hook[]; // Fires when the selected dates have changed.
47-
onClose?: Hook | Hook[]; // Fires when the calendar is closed.
48-
onDayCreate?: Hook | Hook[]; // Fires for every day cell in the calendar.
49-
onDestroy?: Hook | Hook[]; // Fires before the calendar instance is destroyed.
50-
onKeyDown?: Hook | Hook[]; // Fires when valid keyboard input for the calendar is detected.
51-
onMonthChange?: Hook | Hook[]; // Fires after the month has changed.
52-
onOpen?: Hook | Hook[]; // Fires after the calendar is opened.
53-
onParseConfig?: Hook | Hook[]; // Fires after the configuration for the calendar is parsed.
54-
onReady?: Hook | Hook[]; // Fires once the calendar instance is ready.
55-
onValueUpdate?: Hook | Hook[]; // Fires immediately after any date changes.
56-
onYearChange?: Hook | Hook[]; // Fires after the year has changed.
57-
onPreCalendarPosition?: Hook | Hook[]; // Fires before the calendar position is calculated.
58-
parseDate?: (date: string, format: string) => Date; // A custom datestring parser.
59-
plugins?: Plugin[]; // Plugins for Flatpickr.
60-
position?:
61-
| 'auto'
62-
| 'above'
63-
| 'below'
64-
| 'auto left'
65-
| 'auto center'
66-
| 'auto right'
67-
| 'above left'
68-
| 'above center'
69-
| 'above right'
70-
| 'below left'
71-
| 'below center'
72-
| 'below right'
73-
| ((self: any, customElement: HTMLElement | undefined) => void); // How the calendar should be positioned.
74-
positionElement?: Element; // The element off of which the calendar will be positioned.
75-
prevArrow?: string; // HTML for the left arrow icon.
76-
shorthandCurrentMonth?: boolean; // Whether to display the current month name in shorthand mode.
77-
shorthand?: boolean; // Whether to display the current date in shorthand mode.
78-
static?: boolean; // Creates a wrapper to position the calendar.
79-
showMonths?: number; // Sets the number of months to show.
80-
time_24hr?: boolean; // Displays time picker in 24-hour mode.
81-
weekNumbers?: boolean; // Display week numbers left of the calendar.
82-
wrap?: boolean; // See external elements for Flatpickr.
83-
useLocaleYear?: boolean; // Handling year as locale year.
84-
resetMoveDefault?: boolean; // Handling reset and move to calendar to default date.
85-
resetToDefault?: boolean; // Handling reset and selected a default date.
86-
};
4+
export type { DateLimit, DateOption, Hook, FlatpickrOptions } from './types.js';
875

886
/**
897
* Enum-like object defining available theme names

src/lib/types.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ export default interface FlatpickrOptions {
114114
resetToDefault?: boolean; // Handling reset and selected a default date.
115115
}
116116

117+
export type FlatpickrOptions = Partial<FlatpickrOptions>;
118+
117119
export type FlatpickrAction<Node extends HTMLElement> = (
118120
node: Node,
119121
parameter?: FlatpickrOptions

0 commit comments

Comments
 (0)