UNPKG

8.8 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/**
98 * Deprecated UI elements and flags.
99 *
100 * These elements were used in previous version of DayPicker and are kept here
101 * to help the transition to the new {@link UI | UI elements}.
102 *
103 * ```diff
104 * <DayPicker classNames={{
105 * - cell: "my-cell",
106 * + day: "my-cell",
107 * - day: "my-day",
108 * + day_button: "my-day",
109 * - day_disabled: "my-day_disabled",
110 * + disabled: "my-day_disabled",
111 * // etc.
112 * }}/>
113 * ```
114 *
115 * @deprecated
116 * @since 9.0.1
117 * @see https://daypicker.dev/upgrading
118 * @see https://daypicker.dev/docs/styling
119 */
120export type DeprecatedUI<T extends CSSProperties | string> = {
121 /**
122 * This element was applied to the style of any button in DayPicker and it is
123 * replaced by {@link UI.PreviousMonthButton} and {@link UI.NextMonthButton}.
124 *
125 * @deprecated
126 */
127 button: T;
128 /**
129 * This element was resetting the style of any button in DayPicker and it is
130 * replaced by {@link UI.PreviousMonthButton} and {@link UI.NextMonthButton}.
131 *
132 * @deprecated
133 */
134 button_reset: T;
135 /**
136 * This element has been renamed to {@link UI.MonthCaption}.
137 *
138 * @deprecated
139 */
140 caption: T;
141 /**
142 * This element has been removed. Captions are styled via
143 * {@link UI.MonthCaption}.
144 *
145 * @deprecated
146 */
147 caption_between: T;
148 /**
149 * This element has been renamed to {@link UI.Dropdowns}.
150 *
151 * @deprecated
152 */
153 caption_dropdowns: T;
154 /**
155 * This element has been removed. Captions are styled via
156 * {@link UI.MonthCaption}.
157 *
158 * @deprecated
159 */
160 caption_end: T;
161 /**
162 * This element has been removed.
163 *
164 * @deprecated
165 */
166 caption_start: T;
167 /**
168 * This element has been renamed to {@link UI.Day}.
169 *
170 * @deprecated
171 */
172 cell: T;
173 /**
174 * This element has been renamed to {@link DayFlag.disabled}.
175 *
176 * @deprecated
177 */
178 day_disabled: T;
179 /**
180 * This element has been renamed to {@link DayFlag.hidden}.
181 *
182 * @deprecated
183 */
184 day_hidden: T;
185 /**
186 * This element has been renamed to {@link DayFlag.outside}.
187 *
188 * @deprecated
189 */
190 day_outside: T;
191 /**
192 * This element has been renamed to {@link SelectionState.range_end}.
193 *
194 * @deprecated
195 */
196 day_range_end: T;
197 /**
198 * This element has been renamed to {@link SelectionState.range_middle}.
199 *
200 * @deprecated
201 */
202 day_range_middle: T;
203 /**
204 * This element has been renamed to {@link SelectionState.range_start}.
205 *
206 * @deprecated
207 */
208 day_range_start: T;
209 /**
210 * This element has been renamed to {@link SelectionState.selected}.
211 *
212 * @deprecated
213 */
214 day_selected: T;
215 /**
216 * This element has been renamed to {@link DayFlag.today}.
217 *
218 * @deprecated
219 */
220 day_today: T;
221 /**
222 * This element has been removed. The dropdown icon is now {@link UI.Chevron}
223 * inside a {@link UI.CaptionLabel}.
224 *
225 * @deprecated
226 */
227 dropdown_icon: T;
228 /**
229 * This element has been renamed to {@link UI.MonthsDropdown}.
230 *
231 * @deprecated
232 */
233 dropdown_month: T;
234 /**
235 * This element has been renamed to {@link UI.YearsDropdown}.
236 *
237 * @deprecated
238 */
239 dropdown_year: T;
240 /**
241 * This element has been removed.
242 *
243 * @deprecated
244 */
245 head: T;
246 /**
247 * This element has been renamed to {@link UI.Weekday}.
248 *
249 * @deprecated
250 */
251 head_cell: T;
252 /**
253 * This element has been renamed to {@link UI.Weekdays}.
254 *
255 * @deprecated
256 */
257 head_row: T;
258 /**
259 * This flag has been removed. Use `data-multiple-months` in your CSS
260 * selectors.
261 *
262 * @deprecated
263 */
264 multiple_months: T;
265 /**
266 * This element has been removed. To style the navigation buttons, use
267 * {@link UI.PreviousMonthButton} and {@link UI.NextMonthButton}.
268 *
269 * @deprecated
270 */
271 nav_button: T;
272 /**
273 * This element has been renamed to {@link UI.NextMonthButton}.
274 *
275 * @deprecated
276 */
277 nav_button_next: T;
278 /**
279 * This element has been renamed to {@link UI.PreviousMonthButton}.
280 *
281 * @deprecated
282 */
283 nav_button_previous: T;
284 /**
285 * This element has been removed. The dropdown icon is now {@link UI.Chevron}
286 * inside a {@link UI.NextMonthButton} or a {@link UI.PreviousMonthButton}.
287 *
288 * @deprecated
289 */
290 nav_icon: T;
291 /**
292 * This element has been renamed to {@link UI.Week}.
293 *
294 * @deprecated
295 */
296 row: T;
297 /**
298 * This element has been renamed to {@link UI.MonthGrid}.
299 *
300 * @deprecated
301 */
302 table: T;
303 /**
304 * This element has been renamed to {@link UI.Weeks}.
305 *
306 * @deprecated
307 */
308 tbody: T;
309 /**
310 * This element has been removed. The {@link UI.Footer} is now a single element
311 * below the months.
312 *
313 * @deprecated
314 */
315 tfoot: T;
316 /**
317 * This flag has been removed. There are no "visually hidden" elements in
318 * DayPicker 9.
319 *
320 * @deprecated
321 */
322 vhidden: T;
323 /**
324 * This element has been renamed. Use {@link UI.WeekNumber} instead.
325 *
326 * @deprecated
327 */
328 weeknumber: T;
329 /**
330 * This flag has been removed. Use `data-week-numbers` in your CSS.
331 *
332 * @deprecated
333 */
334 with_weeknumber: T;
335};