UNPKG

9.96 kBTypeScriptView Raw
1import { CSSProperties } from "react";
2/**
3 * The UI elements composing DayPicker. These elements are mapped to
4 * {@link CustomComponents}, the {@link ClassNames} and the {@link Styles} used by
5 * DayPicker.
6 *
7 * Some of these elements are extended by flags and modifiers.
8 */
9export declare enum UI {
10 /** The root component displaying the months and the navigation bar. */
11 Root = "root",
12 /** The Chevron SVG element used by navigation buttons and dropdowns. */
13 Chevron = "chevron",
14 /**
15 * The grid cell with the day's date. Extended by {@link DayFlag} and
16 * {@link SelectionFlag}.
17 */
18 Day = "day",
19 /** The button containing the formatted day's date, inside the grid cell. */
20 DayButton = "day_button",
21 /** The caption label of the month (when not showing the dropdown navigation). */
22 CaptionLabel = "caption_label",
23 /** The container of the dropdown navigation (when enabled). */
24 Dropdowns = "dropdowns",
25 /** The dropdown element to select for years and months. */
26 Dropdown = "dropdown",
27 /** The container element of the dropdown. */
28 DropdownRoot = "dropdown_root",
29 /** The root element of the footer. */
30 Footer = "footer",
31 /** The month grid. */
32 MonthGrid = "month_grid",
33 /** Contains the dropdown navigation or the caption label. */
34 MonthCaption = "month_caption",
35 /** The dropdown with the months. */
36 MonthsDropdown = "months_dropdown",
37 /** Wrapper of the month grid. */
38 Month = "month",
39 /** The container of the displayed months. */
40 Months = "months",
41 /** The navigation bar with the previous and next buttons. */
42 Nav = "nav",
43 /**
44 * The next month button in the navigation. *
45 *
46 * @since 9.1.0
47 */
48 NextMonthButton = "button_next",
49 /**
50 * The previous month button in the navigation.
51 *
52 * @since 9.1.0
53 */
54 PreviousMonthButton = "button_previous",
55 /** The row containing the week. */
56 Week = "week",
57 /** The group of row weeks in a month (`tbody`). */
58 Weeks = "weeks",
59 /** The column header with the weekday. */
60 Weekday = "weekday",
61 /** The row grouping the weekdays in the column headers. */
62 Weekdays = "weekdays",
63 /** The cell containing the week number. */
64 WeekNumber = "week_number",
65 /** The cell header of the week numbers column. */
66 WeekNumberHeader = "week_number_header",
67 /** The dropdown with the years. */
68 YearsDropdown = "years_dropdown"
69}
70/** The flags for the {@link UI.Day}. */
71export declare enum DayFlag {
72 /** The day is disabled. */
73 disabled = "disabled",
74 /** The day is hidden. */
75 hidden = "hidden",
76 /** The day is outside the current month. */
77 outside = "outside",
78 /** The day is focused. */
79 focused = "focused",
80 /** The day is today. */
81 today = "today"
82}
83/**
84 * The state that can be applied to the {@link UI.Day} element when in selection
85 * mode.
86 */
87export declare enum SelectionState {
88 /** The day is at the end of a selected range. */
89 range_end = "range_end",
90 /** The day is at the middle of a selected range. */
91 range_middle = "range_middle",
92 /** The day is at the start of a selected range. */
93 range_start = "range_start",
94 /** The day is selected. */
95 selected = "selected"
96}
97/** CSS classes used for animating months and captions. */
98/**
99 * Enum representing different animation states for transitioning between
100 * months.
101 */
102export declare enum Animation {
103 /** The entering weeks when they appear before the exiting month. */
104 weeks_before_enter = "weeks_before_enter",
105 /** The exiting weeks when they disappear before the entering month. */
106 weeks_before_exit = "weeks_before_exit",
107 /** The entering weeks when they appear after the exiting month. */
108 weeks_after_enter = "weeks_after_enter",
109 /** The exiting weeks when they disappear after the entering month. */
110 weeks_after_exit = "weeks_after_exit",
111 /** The entering caption when it appears after the exiting month. */
112 caption_after_enter = "caption_after_enter",
113 /** The exiting caption when it disappears after the entering month. */
114 caption_after_exit = "caption_after_exit",
115 /** The entering caption when it appears before the exiting month. */
116 caption_before_enter = "caption_before_enter",
117 /** The exiting caption when it disappears before the entering month. */
118 caption_before_exit = "caption_before_exit"
119}
120/**
121 * Deprecated UI elements and flags.
122 *
123 * These elements were used in previous version of DayPicker and are kept here
124 * to help the transition to the new {@link UI | UI elements}.
125 *
126 * ```diff
127 * <DayPicker classNames={{
128 * - cell: "my-cell",
129 * + day: "my-cell",
130 * - day: "my-day",
131 * + day_button: "my-day",
132 * - day_disabled: "my-day_disabled",
133 * + disabled: "my-day_disabled",
134 * // etc.
135 * }}/>
136 * ```
137 *
138 * @deprecated
139 * @since 9.0.1
140 * @see https://daypicker.dev/upgrading
141 * @see https://daypicker.dev/docs/styling
142 */
143export type DeprecatedUI<T extends CSSProperties | string> = {
144 /**
145 * This element was applied to the style of any button in DayPicker and it is
146 * replaced by {@link UI.PreviousMonthButton} and {@link UI.NextMonthButton}.
147 *
148 * @deprecated
149 */
150 button: T;
151 /**
152 * This element was resetting the style of any button in DayPicker and it is
153 * replaced by {@link UI.PreviousMonthButton} and {@link UI.NextMonthButton}.
154 *
155 * @deprecated
156 */
157 button_reset: T;
158 /**
159 * This element has been renamed to {@link UI.MonthCaption}.
160 *
161 * @deprecated
162 */
163 caption: T;
164 /**
165 * This element has been removed. Captions are styled via
166 * {@link UI.MonthCaption}.
167 *
168 * @deprecated
169 */
170 caption_between: T;
171 /**
172 * This element has been renamed to {@link UI.Dropdowns}.
173 *
174 * @deprecated
175 */
176 caption_dropdowns: T;
177 /**
178 * This element has been removed. Captions are styled via
179 * {@link UI.MonthCaption}.
180 *
181 * @deprecated
182 */
183 caption_end: T;
184 /**
185 * This element has been removed.
186 *
187 * @deprecated
188 */
189 caption_start: T;
190 /**
191 * This element has been renamed to {@link UI.Day}.
192 *
193 * @deprecated
194 */
195 cell: T;
196 /**
197 * This element has been renamed to {@link DayFlag.disabled}.
198 *
199 * @deprecated
200 */
201 day_disabled: T;
202 /**
203 * This element has been renamed to {@link DayFlag.hidden}.
204 *
205 * @deprecated
206 */
207 day_hidden: T;
208 /**
209 * This element has been renamed to {@link DayFlag.outside}.
210 *
211 * @deprecated
212 */
213 day_outside: T;
214 /**
215 * This element has been renamed to {@link SelectionState.range_end}.
216 *
217 * @deprecated
218 */
219 day_range_end: T;
220 /**
221 * This element has been renamed to {@link SelectionState.range_middle}.
222 *
223 * @deprecated
224 */
225 day_range_middle: T;
226 /**
227 * This element has been renamed to {@link SelectionState.range_start}.
228 *
229 * @deprecated
230 */
231 day_range_start: T;
232 /**
233 * This element has been renamed to {@link SelectionState.selected}.
234 *
235 * @deprecated
236 */
237 day_selected: T;
238 /**
239 * This element has been renamed to {@link DayFlag.today}.
240 *
241 * @deprecated
242 */
243 day_today: T;
244 /**
245 * This element has been removed. The dropdown icon is now {@link UI.Chevron}
246 * inside a {@link UI.CaptionLabel}.
247 *
248 * @deprecated
249 */
250 dropdown_icon: T;
251 /**
252 * This element has been renamed to {@link UI.MonthsDropdown}.
253 *
254 * @deprecated
255 */
256 dropdown_month: T;
257 /**
258 * This element has been renamed to {@link UI.YearsDropdown}.
259 *
260 * @deprecated
261 */
262 dropdown_year: T;
263 /**
264 * This element has been removed.
265 *
266 * @deprecated
267 */
268 head: T;
269 /**
270 * This element has been renamed to {@link UI.Weekday}.
271 *
272 * @deprecated
273 */
274 head_cell: T;
275 /**
276 * This element has been renamed to {@link UI.Weekdays}.
277 *
278 * @deprecated
279 */
280 head_row: T;
281 /**
282 * This flag has been removed. Use `data-multiple-months` in your CSS
283 * selectors.
284 *
285 * @deprecated
286 */
287 multiple_months: T;
288 /**
289 * This element has been removed. To style the navigation buttons, use
290 * {@link UI.PreviousMonthButton} and {@link UI.NextMonthButton}.
291 *
292 * @deprecated
293 */
294 nav_button: T;
295 /**
296 * This element has been renamed to {@link UI.NextMonthButton}.
297 *
298 * @deprecated
299 */
300 nav_button_next: T;
301 /**
302 * This element has been renamed to {@link UI.PreviousMonthButton}.
303 *
304 * @deprecated
305 */
306 nav_button_previous: T;
307 /**
308 * This element has been removed. The dropdown icon is now {@link UI.Chevron}
309 * inside a {@link UI.NextMonthButton} or a {@link UI.PreviousMonthButton}.
310 *
311 * @deprecated
312 */
313 nav_icon: T;
314 /**
315 * This element has been renamed to {@link UI.Week}.
316 *
317 * @deprecated
318 */
319 row: T;
320 /**
321 * This element has been renamed to {@link UI.MonthGrid}.
322 *
323 * @deprecated
324 */
325 table: T;
326 /**
327 * This element has been renamed to {@link UI.Weeks}.
328 *
329 * @deprecated
330 */
331 tbody: T;
332 /**
333 * This element has been removed. The {@link UI.Footer} is now a single element
334 * below the months.
335 *
336 * @deprecated
337 */
338 tfoot: T;
339 /**
340 * This flag has been removed. There are no "visually hidden" elements in
341 * DayPicker 9.
342 *
343 * @deprecated
344 */
345 vhidden: T;
346 /**
347 * This element has been renamed. Use {@link UI.WeekNumber} instead.
348 *
349 * @deprecated
350 */
351 weeknumber: T;
352 /**
353 * This flag has been removed. Use `data-week-numbers` in your CSS.
354 *
355 * @deprecated
356 */
357 with_weeknumber: T;
358};