@refraktor/dates 0.0.3 → 0.0.5
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/build/components/date-range-picker/date-range-picker.d.ts +4 -0
- package/build/components/date-range-picker/date-range-picker.d.ts.map +1 -0
- package/build/components/date-range-picker/date-range-picker.js +379 -0
- package/build/components/date-range-picker/date-range-picker.types.d.ts +100 -0
- package/build/components/date-range-picker/date-range-picker.types.d.ts.map +1 -0
- package/build/components/date-range-picker/date-range-picker.types.js +1 -0
- package/build/components/date-range-picker/index.d.ts +3 -0
- package/build/components/date-range-picker/index.d.ts.map +1 -0
- package/build/components/date-range-picker/index.js +1 -0
- package/build/components/time-input/index.d.ts +1 -1
- package/build/components/time-input/index.d.ts.map +1 -1
- package/build/components/time-input/time-input.d.ts.map +1 -1
- package/build/components/time-input/time-input.js +7 -196
- package/build/components/time-input/time-input.types.d.ts +5 -83
- package/build/components/time-input/time-input.types.d.ts.map +1 -1
- package/build/components/time-picker/index.d.ts +1 -1
- package/build/components/time-picker/index.d.ts.map +1 -1
- package/build/components/time-picker/time-picker.d.ts.map +1 -1
- package/build/components/time-picker/time-picker.js +498 -350
- package/build/components/time-picker/time-picker.types.d.ts +96 -61
- package/build/components/time-picker/time-picker.types.d.ts.map +1 -1
- package/build/style.css +2 -2
- package/package.json +33 -4
- package/.turbo/turbo-build.log +0 -4
- package/refraktor-dates-0.0.1-alpha.0.tgz +0 -0
- package/src/components/date-input/date-input.tsx +0 -379
- package/src/components/date-input/date-input.types.ts +0 -161
- package/src/components/date-input/index.ts +0 -13
- package/src/components/date-picker/date-picker.tsx +0 -649
- package/src/components/date-picker/date-picker.types.ts +0 -145
- package/src/components/date-picker/index.ts +0 -15
- package/src/components/dates-provider/context.ts +0 -18
- package/src/components/dates-provider/dates-provider.tsx +0 -136
- package/src/components/dates-provider/index.ts +0 -10
- package/src/components/dates-provider/types.ts +0 -33
- package/src/components/dates-provider/use-dates.ts +0 -5
- package/src/components/index.ts +0 -9
- package/src/components/month-input/index.ts +0 -13
- package/src/components/month-input/month-input.tsx +0 -366
- package/src/components/month-input/month-input.types.ts +0 -139
- package/src/components/month-picker/index.ts +0 -14
- package/src/components/month-picker/month-picker.tsx +0 -458
- package/src/components/month-picker/month-picker.types.ts +0 -117
- package/src/components/picker-shared/index.ts +0 -7
- package/src/components/picker-shared/picker-header.tsx +0 -178
- package/src/components/picker-shared/picker-header.types.ts +0 -49
- package/src/components/picker-shared/picker.styles.ts +0 -69
- package/src/components/picker-shared/picker.types.ts +0 -4
- package/src/components/time-input/index.ts +0 -23
- package/src/components/time-input/time-input.tsx +0 -453
- package/src/components/time-input/time-input.types.ts +0 -163
- package/src/components/time-picker/index.ts +0 -19
- package/src/components/time-picker/time-picker.tsx +0 -737
- package/src/components/time-picker/time-picker.types.ts +0 -135
- package/src/components/year-input/index.ts +0 -13
- package/src/components/year-input/year-input.tsx +0 -350
- package/src/components/year-input/year-input.types.ts +0 -118
- package/src/components/year-picker/index.ts +0 -15
- package/src/components/year-picker/year-picker.tsx +0 -504
- package/src/components/year-picker/year-picker.types.ts +0 -108
- package/src/index.ts +0 -3
- package/src/style.css +0 -1
- package/tsconfig.json +0 -13
|
@@ -1,379 +0,0 @@
|
|
|
1
|
-
import { useId, useUncontrolled } from "@refraktor/utils";
|
|
2
|
-
import { useCallback, useMemo } from "react";
|
|
3
|
-
import {
|
|
4
|
-
createClassNamesConfig,
|
|
5
|
-
createComponentConfig,
|
|
6
|
-
factory,
|
|
7
|
-
Input,
|
|
8
|
-
Transition,
|
|
9
|
-
useClassNames,
|
|
10
|
-
useProps,
|
|
11
|
-
useTheme
|
|
12
|
-
} from "@refraktor/core";
|
|
13
|
-
import {
|
|
14
|
-
autoUpdate,
|
|
15
|
-
flip,
|
|
16
|
-
FloatingFocusManager,
|
|
17
|
-
FloatingPortal,
|
|
18
|
-
inline,
|
|
19
|
-
Middleware,
|
|
20
|
-
offset,
|
|
21
|
-
shift,
|
|
22
|
-
useDismiss,
|
|
23
|
-
useFloating,
|
|
24
|
-
useFocus,
|
|
25
|
-
useInteractions,
|
|
26
|
-
useRole
|
|
27
|
-
} from "@floating-ui/react";
|
|
28
|
-
import { useDates } from "../dates-provider";
|
|
29
|
-
import { DatePicker } from "../date-picker";
|
|
30
|
-
import {
|
|
31
|
-
DateInputClassNames,
|
|
32
|
-
DateInputFactoryPayload,
|
|
33
|
-
DateInputProps
|
|
34
|
-
} from "./date-input.types";
|
|
35
|
-
|
|
36
|
-
const DEFAULT_MONTH_PICKER_COLUMNS = 3;
|
|
37
|
-
const DEFAULT_YEAR_PICKER_YEARS_PER_PAGE = 9;
|
|
38
|
-
const DEFAULT_YEAR_PICKER_COLUMNS = 3;
|
|
39
|
-
const DEFAULT_VALUE_FORMAT = "MMMM D, YYYY";
|
|
40
|
-
|
|
41
|
-
const defaultProps = {
|
|
42
|
-
monthPickerColumns: DEFAULT_MONTH_PICKER_COLUMNS,
|
|
43
|
-
yearPickerYearsPerPage: DEFAULT_YEAR_PICKER_YEARS_PER_PAGE,
|
|
44
|
-
yearPickerColumns: DEFAULT_YEAR_PICKER_COLUMNS,
|
|
45
|
-
valueFormat: DEFAULT_VALUE_FORMAT,
|
|
46
|
-
disabled: false,
|
|
47
|
-
size: "md",
|
|
48
|
-
radius: "default",
|
|
49
|
-
positioning: {
|
|
50
|
-
placement: "bottom-start",
|
|
51
|
-
offset: 4
|
|
52
|
-
},
|
|
53
|
-
middlewares: {
|
|
54
|
-
flip: true,
|
|
55
|
-
shift: true
|
|
56
|
-
},
|
|
57
|
-
withinPortal: true,
|
|
58
|
-
closeOnClickOutside: true,
|
|
59
|
-
closeOnEscape: true
|
|
60
|
-
} satisfies Partial<DateInputProps>;
|
|
61
|
-
|
|
62
|
-
const isValidDate = (value: unknown): value is Date =>
|
|
63
|
-
value instanceof Date && !Number.isNaN(value.getTime());
|
|
64
|
-
|
|
65
|
-
const normalizeDateValue = (value: Date | undefined) => {
|
|
66
|
-
if (!isValidDate(value)) {
|
|
67
|
-
return undefined;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const normalizedValue = new Date(value);
|
|
71
|
-
normalizedValue.setHours(0, 0, 0, 0);
|
|
72
|
-
return normalizedValue;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const DateInput = factory<DateInputFactoryPayload>((_props, ref) => {
|
|
76
|
-
const { cx, getRadius } = useTheme();
|
|
77
|
-
const { createDate } = useDates();
|
|
78
|
-
const {
|
|
79
|
-
id,
|
|
80
|
-
value,
|
|
81
|
-
defaultValue,
|
|
82
|
-
onChange,
|
|
83
|
-
opened,
|
|
84
|
-
defaultOpened,
|
|
85
|
-
onOpenedChange,
|
|
86
|
-
minDate,
|
|
87
|
-
maxDate,
|
|
88
|
-
monthPickerColumns,
|
|
89
|
-
yearPickerYearsPerPage,
|
|
90
|
-
yearPickerColumns,
|
|
91
|
-
getWeekdayLabel,
|
|
92
|
-
getDayLabel,
|
|
93
|
-
getDayAriaLabel,
|
|
94
|
-
getHeaderLabel,
|
|
95
|
-
getNavigationAriaLabel,
|
|
96
|
-
getMonthLabel,
|
|
97
|
-
getMonthAriaLabel,
|
|
98
|
-
getMonthHeaderLabel,
|
|
99
|
-
getMonthNavigationAriaLabel,
|
|
100
|
-
valueFormat,
|
|
101
|
-
disabled,
|
|
102
|
-
size,
|
|
103
|
-
radius,
|
|
104
|
-
positioning,
|
|
105
|
-
middlewares,
|
|
106
|
-
withinPortal,
|
|
107
|
-
closeOnClickOutside,
|
|
108
|
-
closeOnEscape,
|
|
109
|
-
transitionProps,
|
|
110
|
-
inputClassNames,
|
|
111
|
-
className,
|
|
112
|
-
classNames,
|
|
113
|
-
onFocus,
|
|
114
|
-
onBlur,
|
|
115
|
-
onClick,
|
|
116
|
-
onKeyDown,
|
|
117
|
-
...inputProps
|
|
118
|
-
} = useProps("DateInput", defaultProps, _props);
|
|
119
|
-
const classes = useClassNames("DateInput", classNames);
|
|
120
|
-
|
|
121
|
-
const _id = useId(id);
|
|
122
|
-
const dropdownId = `${_id}-dropdown`;
|
|
123
|
-
|
|
124
|
-
const [selectedDateState, setSelectedDate] = useUncontrolled<Date | undefined>({
|
|
125
|
-
value,
|
|
126
|
-
defaultValue,
|
|
127
|
-
finalValue: undefined,
|
|
128
|
-
onChange: (nextDate) => {
|
|
129
|
-
if (nextDate !== undefined) {
|
|
130
|
-
onChange?.(nextDate);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
const [isOpenState, setIsOpen] = useUncontrolled<boolean>({
|
|
136
|
-
value: opened,
|
|
137
|
-
defaultValue: defaultOpened,
|
|
138
|
-
finalValue: false,
|
|
139
|
-
onChange: onOpenedChange
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
const isOpen = isOpenState && !disabled;
|
|
143
|
-
|
|
144
|
-
const middleware = useMemo(() => {
|
|
145
|
-
const middlewareList: Middleware[] = [];
|
|
146
|
-
|
|
147
|
-
middlewareList.push(offset(positioning?.offset ?? 4));
|
|
148
|
-
|
|
149
|
-
if (middlewares?.flip ?? true) {
|
|
150
|
-
middlewareList.push(
|
|
151
|
-
flip(
|
|
152
|
-
typeof middlewares?.flip === "boolean"
|
|
153
|
-
? undefined
|
|
154
|
-
: middlewares.flip
|
|
155
|
-
)
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (middlewares?.shift ?? true) {
|
|
160
|
-
middlewareList.push(
|
|
161
|
-
shift(
|
|
162
|
-
typeof middlewares?.shift === "boolean"
|
|
163
|
-
? undefined
|
|
164
|
-
: middlewares.shift
|
|
165
|
-
)
|
|
166
|
-
);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
if (middlewares?.inline) {
|
|
170
|
-
middlewareList.push(
|
|
171
|
-
inline(
|
|
172
|
-
typeof middlewares.inline === "boolean"
|
|
173
|
-
? undefined
|
|
174
|
-
: middlewares.inline
|
|
175
|
-
)
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
return middlewareList;
|
|
180
|
-
}, [middlewares, positioning?.offset]);
|
|
181
|
-
|
|
182
|
-
const handleOpenChange = useCallback(
|
|
183
|
-
(nextOpen: boolean) => {
|
|
184
|
-
if (disabled && nextOpen) {
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
setIsOpen(nextOpen);
|
|
189
|
-
},
|
|
190
|
-
[disabled, setIsOpen]
|
|
191
|
-
);
|
|
192
|
-
|
|
193
|
-
const floating = useFloating({
|
|
194
|
-
placement: positioning?.placement ?? "bottom-start",
|
|
195
|
-
open: isOpen,
|
|
196
|
-
onOpenChange: handleOpenChange,
|
|
197
|
-
middleware,
|
|
198
|
-
whileElementsMounted: autoUpdate,
|
|
199
|
-
strategy: "fixed"
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
const focus = useFocus(floating.context, {
|
|
203
|
-
enabled: !disabled
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
const dismiss = useDismiss(floating.context, {
|
|
207
|
-
outsidePress: closeOnClickOutside,
|
|
208
|
-
escapeKey: closeOnEscape
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
const role = useRole(floating.context, {
|
|
212
|
-
role: "dialog"
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
const { getReferenceProps, getFloatingProps } = useInteractions([
|
|
216
|
-
focus,
|
|
217
|
-
dismiss,
|
|
218
|
-
role
|
|
219
|
-
]);
|
|
220
|
-
|
|
221
|
-
const setInputRef = useCallback(
|
|
222
|
-
(node: HTMLInputElement | null) => {
|
|
223
|
-
floating.refs.setReference(node);
|
|
224
|
-
|
|
225
|
-
if (typeof ref === "function") {
|
|
226
|
-
ref(node);
|
|
227
|
-
} else if (ref) {
|
|
228
|
-
ref.current = node;
|
|
229
|
-
}
|
|
230
|
-
},
|
|
231
|
-
[floating.refs, ref]
|
|
232
|
-
);
|
|
233
|
-
|
|
234
|
-
const handleInputKeyDown = useCallback(
|
|
235
|
-
(event: React.KeyboardEvent<HTMLInputElement>) => {
|
|
236
|
-
onKeyDown?.(event);
|
|
237
|
-
|
|
238
|
-
if (event.defaultPrevented || disabled) {
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
if (
|
|
243
|
-
event.key === "ArrowDown" ||
|
|
244
|
-
event.key === "Enter" ||
|
|
245
|
-
event.key === " "
|
|
246
|
-
) {
|
|
247
|
-
event.preventDefault();
|
|
248
|
-
setIsOpen(true);
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
if (event.key === "Escape") {
|
|
253
|
-
event.preventDefault();
|
|
254
|
-
setIsOpen(false);
|
|
255
|
-
}
|
|
256
|
-
},
|
|
257
|
-
[disabled, onKeyDown, setIsOpen]
|
|
258
|
-
);
|
|
259
|
-
|
|
260
|
-
const handleDateChange = useCallback(
|
|
261
|
-
(nextDate: Date) => {
|
|
262
|
-
const normalizedDate = normalizeDateValue(nextDate);
|
|
263
|
-
|
|
264
|
-
if (normalizedDate === undefined) {
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
setSelectedDate(normalizedDate);
|
|
269
|
-
setIsOpen(false);
|
|
270
|
-
},
|
|
271
|
-
[setIsOpen, setSelectedDate]
|
|
272
|
-
);
|
|
273
|
-
|
|
274
|
-
const selectedDate = normalizeDateValue(selectedDateState);
|
|
275
|
-
const inputValue =
|
|
276
|
-
selectedDate === undefined ? "" : createDate(selectedDate).format(valueFormat);
|
|
277
|
-
|
|
278
|
-
const mergedReferenceProps = getReferenceProps({
|
|
279
|
-
onFocus,
|
|
280
|
-
onBlur,
|
|
281
|
-
onClick,
|
|
282
|
-
onKeyDown: handleInputKeyDown
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
const dropdownContent = (
|
|
286
|
-
<Transition
|
|
287
|
-
transition="fade"
|
|
288
|
-
duration={150}
|
|
289
|
-
mounted={isOpen}
|
|
290
|
-
style={{ position: "relative", zIndex: 1000 }}
|
|
291
|
-
{...transitionProps}
|
|
292
|
-
>
|
|
293
|
-
<div
|
|
294
|
-
ref={floating.refs.setFloating}
|
|
295
|
-
id={dropdownId}
|
|
296
|
-
style={{
|
|
297
|
-
...floating.floatingStyles,
|
|
298
|
-
zIndex: 1000
|
|
299
|
-
}}
|
|
300
|
-
className={cx(
|
|
301
|
-
"w-80 z-50 border border-[var(--refraktor-border)] bg-[var(--refraktor-bg)] p-2 text-[var(--refraktor-text)] shadow-md",
|
|
302
|
-
getRadius(radius),
|
|
303
|
-
classes.dropdown
|
|
304
|
-
)}
|
|
305
|
-
{...getFloatingProps()}
|
|
306
|
-
>
|
|
307
|
-
<DatePicker
|
|
308
|
-
value={selectedDate}
|
|
309
|
-
onChange={handleDateChange}
|
|
310
|
-
minDate={minDate}
|
|
311
|
-
maxDate={maxDate}
|
|
312
|
-
monthPickerColumns={monthPickerColumns}
|
|
313
|
-
yearPickerYearsPerPage={yearPickerYearsPerPage}
|
|
314
|
-
yearPickerColumns={yearPickerColumns}
|
|
315
|
-
disabled={disabled}
|
|
316
|
-
size={size}
|
|
317
|
-
radius={radius}
|
|
318
|
-
getWeekdayLabel={getWeekdayLabel}
|
|
319
|
-
getDayLabel={getDayLabel}
|
|
320
|
-
getDayAriaLabel={getDayAriaLabel}
|
|
321
|
-
getHeaderLabel={getHeaderLabel}
|
|
322
|
-
getNavigationAriaLabel={getNavigationAriaLabel}
|
|
323
|
-
getMonthLabel={getMonthLabel}
|
|
324
|
-
getMonthAriaLabel={getMonthAriaLabel}
|
|
325
|
-
getMonthHeaderLabel={getMonthHeaderLabel}
|
|
326
|
-
getMonthNavigationAriaLabel={getMonthNavigationAriaLabel}
|
|
327
|
-
className={cx("bg-transparent p-0", classes.datePicker)}
|
|
328
|
-
/>
|
|
329
|
-
</div>
|
|
330
|
-
</Transition>
|
|
331
|
-
);
|
|
332
|
-
|
|
333
|
-
const wrappedContent = isOpen ? (
|
|
334
|
-
<FloatingFocusManager
|
|
335
|
-
context={floating.context}
|
|
336
|
-
modal={false}
|
|
337
|
-
initialFocus={-1}
|
|
338
|
-
returnFocus={false}
|
|
339
|
-
>
|
|
340
|
-
{dropdownContent}
|
|
341
|
-
</FloatingFocusManager>
|
|
342
|
-
) : (
|
|
343
|
-
dropdownContent
|
|
344
|
-
);
|
|
345
|
-
|
|
346
|
-
return (
|
|
347
|
-
<>
|
|
348
|
-
<Input
|
|
349
|
-
ref={setInputRef}
|
|
350
|
-
id={_id}
|
|
351
|
-
readOnly
|
|
352
|
-
value={inputValue}
|
|
353
|
-
disabled={disabled}
|
|
354
|
-
size={size}
|
|
355
|
-
radius={radius}
|
|
356
|
-
role="combobox"
|
|
357
|
-
aria-haspopup="dialog"
|
|
358
|
-
aria-expanded={isOpen}
|
|
359
|
-
aria-controls={isOpen ? dropdownId : undefined}
|
|
360
|
-
className={cx(classes.input, className)}
|
|
361
|
-
classNames={inputClassNames}
|
|
362
|
-
{...inputProps}
|
|
363
|
-
{...(mergedReferenceProps as any)}
|
|
364
|
-
/>
|
|
365
|
-
|
|
366
|
-
{withinPortal ? (
|
|
367
|
-
<FloatingPortal>{wrappedContent}</FloatingPortal>
|
|
368
|
-
) : (
|
|
369
|
-
wrappedContent
|
|
370
|
-
)}
|
|
371
|
-
</>
|
|
372
|
-
);
|
|
373
|
-
});
|
|
374
|
-
|
|
375
|
-
DateInput.displayName = "@refraktor/dates/DateInput";
|
|
376
|
-
DateInput.configure = createComponentConfig<DateInputProps>();
|
|
377
|
-
DateInput.classNames = createClassNamesConfig<DateInputClassNames>();
|
|
378
|
-
|
|
379
|
-
export default DateInput;
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
FlipOptions,
|
|
3
|
-
InlineOptions,
|
|
4
|
-
Placement,
|
|
5
|
-
ShiftOptions
|
|
6
|
-
} from "@floating-ui/react";
|
|
7
|
-
import {
|
|
8
|
-
createClassNamesConfig,
|
|
9
|
-
createComponentConfig,
|
|
10
|
-
FactoryPayload,
|
|
11
|
-
InputFieldClassNames,
|
|
12
|
-
InputProps,
|
|
13
|
-
RefraktorRadius,
|
|
14
|
-
RefraktorSize,
|
|
15
|
-
TransitionProps
|
|
16
|
-
} from "@refraktor/core";
|
|
17
|
-
import type {
|
|
18
|
-
DatePickerGetDayAriaLabel,
|
|
19
|
-
DatePickerGetDayLabel,
|
|
20
|
-
DatePickerGetHeaderLabel,
|
|
21
|
-
DatePickerGetNavigationAriaLabel,
|
|
22
|
-
DatePickerGetWeekdayLabel
|
|
23
|
-
} from "../date-picker";
|
|
24
|
-
import type {
|
|
25
|
-
MonthPickerGetHeaderLabel,
|
|
26
|
-
MonthPickerGetMonthAriaLabel,
|
|
27
|
-
MonthPickerGetMonthLabel,
|
|
28
|
-
MonthPickerGetNavigationAriaLabel
|
|
29
|
-
} from "../month-picker";
|
|
30
|
-
|
|
31
|
-
export type DateInputValue = Date;
|
|
32
|
-
export type DateInputSize = RefraktorSize;
|
|
33
|
-
export type DateInputRadius = RefraktorRadius;
|
|
34
|
-
export type DateInputOnChange = (value: DateInputValue) => void;
|
|
35
|
-
export type DateInputValueFormat = string;
|
|
36
|
-
|
|
37
|
-
export type DateInputPositioning = {
|
|
38
|
-
/** The placement of the dropdown relative to the input @default `bottom-start` */
|
|
39
|
-
placement?: Placement;
|
|
40
|
-
|
|
41
|
-
/** Offset distance from the input in pixels @default `4` */
|
|
42
|
-
offset?: number;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export type DateInputMiddlewares = {
|
|
46
|
-
shift?: boolean | ShiftOptions;
|
|
47
|
-
flip?: boolean | FlipOptions;
|
|
48
|
-
inline?: boolean | InlineOptions;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export type DateInputClassNames = {
|
|
52
|
-
input?: string;
|
|
53
|
-
dropdown?: string;
|
|
54
|
-
datePicker?: string;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
interface _DateInputProps {
|
|
58
|
-
/** Selected date (controlled). */
|
|
59
|
-
value?: DateInputValue;
|
|
60
|
-
|
|
61
|
-
/** Initial selected date (uncontrolled). */
|
|
62
|
-
defaultValue?: DateInputValue;
|
|
63
|
-
|
|
64
|
-
/** Callback called when selected date changes. */
|
|
65
|
-
onChange?: DateInputOnChange;
|
|
66
|
-
|
|
67
|
-
/** Dropdown open state (controlled). */
|
|
68
|
-
opened?: boolean;
|
|
69
|
-
|
|
70
|
-
/** Initial dropdown open state (uncontrolled). */
|
|
71
|
-
defaultOpened?: boolean;
|
|
72
|
-
|
|
73
|
-
/** Callback called when dropdown open state changes. */
|
|
74
|
-
onOpenedChange?: (opened: boolean) => void;
|
|
75
|
-
|
|
76
|
-
/** Minimum selectable date. */
|
|
77
|
-
minDate?: Date;
|
|
78
|
-
|
|
79
|
-
/** Maximum selectable date. */
|
|
80
|
-
maxDate?: Date;
|
|
81
|
-
|
|
82
|
-
/** Month picker columns @default `3` */
|
|
83
|
-
monthPickerColumns?: number;
|
|
84
|
-
|
|
85
|
-
/** Year picker years rendered in one page @default `9` */
|
|
86
|
-
yearPickerYearsPerPage?: number;
|
|
87
|
-
|
|
88
|
-
/** Year picker columns @default `3` */
|
|
89
|
-
yearPickerColumns?: number;
|
|
90
|
-
|
|
91
|
-
/** Custom weekday label renderer. */
|
|
92
|
-
getWeekdayLabel?: DatePickerGetWeekdayLabel;
|
|
93
|
-
|
|
94
|
-
/** Custom day label renderer. */
|
|
95
|
-
getDayLabel?: DatePickerGetDayLabel;
|
|
96
|
-
|
|
97
|
-
/** Custom aria-label generator for day buttons. */
|
|
98
|
-
getDayAriaLabel?: DatePickerGetDayAriaLabel;
|
|
99
|
-
|
|
100
|
-
/** Custom header label renderer for visible month. */
|
|
101
|
-
getHeaderLabel?: DatePickerGetHeaderLabel;
|
|
102
|
-
|
|
103
|
-
/** Custom aria-label generator for previous/next controls. */
|
|
104
|
-
getNavigationAriaLabel?: DatePickerGetNavigationAriaLabel;
|
|
105
|
-
|
|
106
|
-
/** Custom month label renderer in month view. */
|
|
107
|
-
getMonthLabel?: MonthPickerGetMonthLabel;
|
|
108
|
-
|
|
109
|
-
/** Custom aria-label generator for month buttons in month view. */
|
|
110
|
-
getMonthAriaLabel?: MonthPickerGetMonthAriaLabel;
|
|
111
|
-
|
|
112
|
-
/** Custom header label renderer in month view. */
|
|
113
|
-
getMonthHeaderLabel?: MonthPickerGetHeaderLabel;
|
|
114
|
-
|
|
115
|
-
/** Custom aria-label generator for month view navigation controls. */
|
|
116
|
-
getMonthNavigationAriaLabel?: MonthPickerGetNavigationAriaLabel;
|
|
117
|
-
|
|
118
|
-
/** Dayjs format used to render selected date in the input @default `MMMM D, YYYY` */
|
|
119
|
-
valueFormat?: DateInputValueFormat;
|
|
120
|
-
|
|
121
|
-
/** Positioning settings for the dropdown. */
|
|
122
|
-
positioning?: DateInputPositioning;
|
|
123
|
-
|
|
124
|
-
/** Floating middleware settings. */
|
|
125
|
-
middlewares?: DateInputMiddlewares;
|
|
126
|
-
|
|
127
|
-
/** Whether to render dropdown in a portal @default `true` */
|
|
128
|
-
withinPortal?: boolean;
|
|
129
|
-
|
|
130
|
-
/** Whether to close on click outside @default `true` */
|
|
131
|
-
closeOnClickOutside?: boolean;
|
|
132
|
-
|
|
133
|
-
/** Whether to close on Escape key @default `true` */
|
|
134
|
-
closeOnEscape?: boolean;
|
|
135
|
-
|
|
136
|
-
/** Transition props for dropdown, uses Transition internally */
|
|
137
|
-
transitionProps?: Omit<TransitionProps, "children" | "mounted">;
|
|
138
|
-
|
|
139
|
-
/** Used for styling the core Input field parts. */
|
|
140
|
-
inputClassNames?: InputFieldClassNames;
|
|
141
|
-
|
|
142
|
-
/** Used for styling DateInput parts. */
|
|
143
|
-
classNames?: DateInputClassNames;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export type DateInputProps = _DateInputProps &
|
|
147
|
-
Omit<
|
|
148
|
-
InputProps,
|
|
149
|
-
"value" | "defaultValue" | "onChange" | "readOnly" | "classNames"
|
|
150
|
-
>;
|
|
151
|
-
|
|
152
|
-
export interface DateInputFactoryPayload extends FactoryPayload {
|
|
153
|
-
props: DateInputProps;
|
|
154
|
-
ref: HTMLInputElement;
|
|
155
|
-
compound: {
|
|
156
|
-
configure: ReturnType<typeof createComponentConfig<DateInputProps>>;
|
|
157
|
-
classNames: ReturnType<
|
|
158
|
-
typeof createClassNamesConfig<DateInputClassNames>
|
|
159
|
-
>;
|
|
160
|
-
};
|
|
161
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export { default as DateInput } from "./date-input";
|
|
2
|
-
export type {
|
|
3
|
-
DateInputClassNames,
|
|
4
|
-
DateInputFactoryPayload,
|
|
5
|
-
DateInputMiddlewares,
|
|
6
|
-
DateInputOnChange,
|
|
7
|
-
DateInputPositioning,
|
|
8
|
-
DateInputProps,
|
|
9
|
-
DateInputRadius,
|
|
10
|
-
DateInputSize,
|
|
11
|
-
DateInputValue,
|
|
12
|
-
DateInputValueFormat
|
|
13
|
-
} from "./date-input.types";
|