@at5/kairo 0.2.1 → 0.2.3

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/dist/index.d.ts CHANGED
@@ -1,297 +1 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import React, { Dispatch } from 'react';
3
-
4
- type ViewMode = "day" | "month" | "year";
5
- type SelectionMode = "single" | "range" | "multiple";
6
- interface DateRange {
7
- start: Date | null;
8
- end: Date | null;
9
- }
10
- interface DayCellMeta {
11
- date: Date;
12
- isCurrentMonth: boolean;
13
- isToday: boolean;
14
- isSelected: boolean;
15
- isDisabled: boolean;
16
- isRangeStart: boolean;
17
- isRangeEnd: boolean;
18
- isInRange: boolean;
19
- isHovered: boolean;
20
- }
21
- interface MonthItem {
22
- value: number;
23
- label: string;
24
- isSelected: boolean;
25
- isDisabled: boolean;
26
- }
27
- interface YearItem$1 {
28
- value: number;
29
- isSelected: boolean;
30
- isDisabled: boolean;
31
- }
32
- interface WeekDayItem {
33
- label: string;
34
- ariaLabel: string;
35
- }
36
- interface DatePickerSharedProps {
37
- locale?: string;
38
- weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
39
- minDate?: Date;
40
- maxDate?: Date;
41
- disabled?: boolean | ((date: Date) => boolean);
42
- readOnly?: boolean;
43
- open?: boolean;
44
- defaultOpen?: boolean;
45
- onOpenChange?: (open: boolean) => void;
46
- modal?: boolean;
47
- closeOnSelect?: boolean;
48
- }
49
- interface DatePickerSingleProps extends DatePickerSharedProps {
50
- mode?: "single";
51
- value?: Date | null;
52
- defaultValue?: Date | null;
53
- onValueChange?: (date: Date | null) => void;
54
- }
55
- interface DatePickerRangeProps extends DatePickerSharedProps {
56
- mode: "range";
57
- value?: DateRange;
58
- defaultValue?: DateRange;
59
- onValueChange?: (range: DateRange) => void;
60
- }
61
- interface DatePickerMultipleProps extends DatePickerSharedProps {
62
- mode: "multiple";
63
- value?: Date[];
64
- defaultValue?: Date[];
65
- onValueChange?: (dates: Date[]) => void;
66
- }
67
- type DatePickerRootProps = DatePickerSingleProps | DatePickerRangeProps | DatePickerMultipleProps;
68
- interface DatePickerConfig {
69
- mode: SelectionMode;
70
- locale: string;
71
- weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
72
- minDate?: Date;
73
- maxDate?: Date;
74
- disabled?: boolean | ((date: Date) => boolean);
75
- readOnly: boolean;
76
- closeOnSelect: boolean;
77
- }
78
-
79
- type RootProps = DatePickerRootProps & {
80
- children: React.ReactNode;
81
- };
82
- declare function Root(props: RootProps): react_jsx_runtime.JSX.Element;
83
-
84
- type LabelProps = React.LabelHTMLAttributes<HTMLLabelElement>;
85
- declare function Label({ children, ...props }: LabelProps): react_jsx_runtime.JSX.Element;
86
-
87
- interface InputProps {
88
- index?: 0 | 1;
89
- segmentLabels?: {
90
- month?: string;
91
- day?: string;
92
- year?: string;
93
- };
94
- className?: string;
95
- style?: React.CSSProperties;
96
- }
97
- declare function Input({ index, segmentLabels, className, style }: InputProps): react_jsx_runtime.JSX.Element;
98
-
99
- type TriggerProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "aria-haspopup" | "aria-expanded" | "aria-controls">;
100
- declare function Trigger({ children, onClick, disabled, ...props }: TriggerProps): react_jsx_runtime.JSX.Element;
101
-
102
- interface ContentProps extends React.HTMLAttributes<HTMLDivElement> {
103
- forceMount?: boolean;
104
- side?: "top" | "bottom" | "left" | "right";
105
- align?: "start" | "center" | "end";
106
- sideOffset?: number;
107
- alignOffset?: number;
108
- avoidCollisions?: boolean;
109
- collisionPadding?: number;
110
- portal?: boolean;
111
- }
112
- declare function Content({ children, forceMount, side, align, sideOffset, alignOffset, avoidCollisions, collisionPadding, portal, style, onKeyDown, ...props }: ContentProps): react_jsx_runtime.JSX.Element | null;
113
-
114
- interface CalendarProps {
115
- className?: string;
116
- }
117
- declare function Calendar({ className }: CalendarProps): react_jsx_runtime.JSX.Element;
118
-
119
- interface ViewProps {
120
- view: ViewMode;
121
- children: React.ReactNode;
122
- }
123
- declare function View({ view, children }: ViewProps): react_jsx_runtime.JSX.Element | null;
124
-
125
- type ViewControlProps = React.HTMLAttributes<HTMLDivElement>;
126
- declare function ViewControl({ children, ...props }: ViewControlProps): react_jsx_runtime.JSX.Element;
127
-
128
- type PrevTriggerProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "aria-label">;
129
- declare function PrevTrigger({ children, onClick, ...props }: PrevTriggerProps): react_jsx_runtime.JSX.Element;
130
-
131
- type NextTriggerProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "aria-label">;
132
- declare function NextTrigger({ children, onClick, ...props }: NextTriggerProps): react_jsx_runtime.JSX.Element;
133
-
134
- type ViewTriggerProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "aria-label">;
135
- declare function ViewTrigger({ children, onClick, ...props }: ViewTriggerProps): react_jsx_runtime.JSX.Element;
136
-
137
- interface WeekDaysProps {
138
- format?: "long" | "short" | "narrow";
139
- className?: string;
140
- }
141
- declare function WeekDays({ format, className }: WeekDaysProps): react_jsx_runtime.JSX.Element;
142
-
143
- interface GridProps {
144
- children?: (ctx: {
145
- weeks: Date[][];
146
- }) => React.ReactNode;
147
- header?: React.ReactNode;
148
- className?: string;
149
- }
150
- declare function Grid({ children, header, className }: GridProps): react_jsx_runtime.JSX.Element;
151
-
152
- interface DayProps {
153
- date: Date;
154
- children?: (meta: DayCellMeta) => React.ReactNode;
155
- className?: string;
156
- style?: React.CSSProperties;
157
- }
158
- declare function Day({ date, children, className, style }: DayProps): react_jsx_runtime.JSX.Element;
159
-
160
- interface MonthGridProps {
161
- children: (ctx: {
162
- months: MonthItem[];
163
- }) => React.ReactNode;
164
- className?: string;
165
- }
166
- declare function MonthGrid({ children, className }: MonthGridProps): react_jsx_runtime.JSX.Element;
167
-
168
- interface MonthCellProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "aria-selected" | "aria-disabled"> {
169
- value: number;
170
- }
171
- declare function MonthCell({ value, children, onClick, ...props }: MonthCellProps): react_jsx_runtime.JSX.Element;
172
-
173
- interface YearItem {
174
- value: number;
175
- isSelected: boolean;
176
- isDisabled: boolean;
177
- }
178
- interface YearGridProps {
179
- children: (ctx: {
180
- years: YearItem[];
181
- }) => React.ReactNode;
182
- className?: string;
183
- }
184
- declare function YearGrid({ children, className }: YearGridProps): react_jsx_runtime.JSX.Element;
185
-
186
- interface YearCellProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "aria-selected" | "aria-disabled"> {
187
- value: number;
188
- }
189
- declare function YearCell({ value, children, onClick, ...props }: YearCellProps): react_jsx_runtime.JSX.Element;
190
-
191
- declare const index_Calendar: typeof Calendar;
192
- declare const index_Content: typeof Content;
193
- type index_ContentProps = ContentProps;
194
- declare const index_Day: typeof Day;
195
- declare const index_Grid: typeof Grid;
196
- declare const index_Input: typeof Input;
197
- declare const index_Label: typeof Label;
198
- declare const index_MonthCell: typeof MonthCell;
199
- declare const index_MonthGrid: typeof MonthGrid;
200
- declare const index_NextTrigger: typeof NextTrigger;
201
- declare const index_PrevTrigger: typeof PrevTrigger;
202
- declare const index_Root: typeof Root;
203
- declare const index_Trigger: typeof Trigger;
204
- declare const index_View: typeof View;
205
- declare const index_ViewControl: typeof ViewControl;
206
- declare const index_ViewTrigger: typeof ViewTrigger;
207
- declare const index_WeekDays: typeof WeekDays;
208
- declare const index_YearCell: typeof YearCell;
209
- declare const index_YearGrid: typeof YearGrid;
210
- declare namespace index {
211
- export { index_Calendar as Calendar, index_Content as Content, type index_ContentProps as ContentProps, index_Day as Day, index_Grid as Grid, index_Input as Input, index_Label as Label, index_MonthCell as MonthCell, index_MonthGrid as MonthGrid, index_NextTrigger as NextTrigger, index_PrevTrigger as PrevTrigger, index_Root as Root, index_Trigger as Trigger, index_View as View, index_ViewControl as ViewControl, index_ViewTrigger as ViewTrigger, index_WeekDays as WeekDays, index_YearCell as YearCell, index_YearGrid as YearGrid };
212
- }
213
-
214
- type OpenSource = "trigger" | "input" | null;
215
- interface DatePickerState {
216
- open: boolean;
217
- openSource: OpenSource;
218
- view: ViewMode;
219
- focusedMonth: number;
220
- focusedYear: number;
221
- focusedDate: Date | null;
222
- selectedDate: Date | null;
223
- rangeStart: Date | null;
224
- rangeEnd: Date | null;
225
- hoverDate: Date | null;
226
- selectedDates: Date[];
227
- inputValue: string;
228
- yearPageStart: number;
229
- }
230
- type DatePickerAction = {
231
- type: "OPEN";
232
- source?: Exclude<OpenSource, null>;
233
- } | {
234
- type: "CLOSE";
235
- } | {
236
- type: "TOGGLE";
237
- source?: Exclude<OpenSource, null>;
238
- } | {
239
- type: "SET_VIEW";
240
- view: ViewMode;
241
- } | {
242
- type: "NAV_PREV";
243
- } | {
244
- type: "NAV_NEXT";
245
- } | {
246
- type: "NAV_TO_DATE";
247
- date: Date;
248
- } | {
249
- type: "FOCUS_DATE";
250
- date: Date;
251
- } | {
252
- type: "SELECT_DATE";
253
- date: Date;
254
- } | {
255
- type: "ANCHOR_DATE";
256
- date: Date;
257
- } | {
258
- type: "EXTEND_RANGE";
259
- date: Date;
260
- } | {
261
- type: "TOGGLE_DATE";
262
- date: Date;
263
- } | {
264
- type: "HOVER_DATE";
265
- date: Date | null;
266
- } | {
267
- type: "SET_INPUT";
268
- value: string;
269
- } | {
270
- type: "COMMIT_INPUT";
271
- } | {
272
- type: "SELECT_MONTH";
273
- month: number;
274
- } | {
275
- type: "SELECT_YEAR";
276
- year: number;
277
- } | {
278
- type: "YEAR_PAGE_PREV";
279
- } | {
280
- type: "YEAR_PAGE_NEXT";
281
- };
282
-
283
- interface DatePickerContextValue {
284
- state: DatePickerState;
285
- dispatch: Dispatch<DatePickerAction>;
286
- config: DatePickerConfig;
287
- ids: {
288
- root: string;
289
- label: string;
290
- input: string;
291
- trigger: string;
292
- content: string;
293
- };
294
- }
295
- declare function useDatePickerContext(): DatePickerContextValue;
296
-
297
- export { index as DatePicker, type DatePickerConfig, type DatePickerMultipleProps, type DatePickerRangeProps, type DatePickerRootProps, type DatePickerSingleProps, type DateRange, type DayCellMeta, type MonthItem, type SelectionMode, type ViewMode, type WeekDayItem, type YearItem$1 as YearItem, useDatePickerContext };
1
+ export * from '@torq-ui/react-date-picker';