@mantine/dates 9.0.0-alpha.2 → 9.0.0-alpha.4
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/cjs/components/Calendar/Calendar.cjs +6 -3
- package/cjs/components/Calendar/Calendar.cjs.map +1 -1
- package/cjs/components/DateInput/DateInput.cjs +5 -3
- package/cjs/components/DateInput/DateInput.cjs.map +1 -1
- package/esm/components/Calendar/Calendar.mjs +6 -3
- package/esm/components/Calendar/Calendar.mjs.map +1 -1
- package/esm/components/DateInput/DateInput.mjs +5 -3
- package/esm/components/DateInput/DateInput.mjs.map +1 -1
- package/lib/components/DateInput/DateInput.d.ts +2 -0
- package/package.json +3 -3
- package/cjs/components/MaskedDateInput/MaskedDateInput.cjs +0 -632
- package/cjs/components/MaskedDateInput/MaskedDateInput.cjs.map +0 -1
- package/cjs/components/MaskedDateInput/MaskedDateInput.context.cjs +0 -12
- package/cjs/components/MaskedDateInput/MaskedDateInput.context.cjs.map +0 -1
- package/cjs/components/MaskedDateInput/MaskedDateInput.module.css.cjs +0 -7
- package/cjs/components/MaskedDateInput/MaskedDateInput.module.css.cjs.map +0 -1
- package/cjs/components/MaskedDateInput/use-masked-date-input.cjs +0 -447
- package/cjs/components/MaskedDateInput/use-masked-date-input.cjs.map +0 -1
- package/esm/components/MaskedDateInput/MaskedDateInput.context.mjs +0 -9
- package/esm/components/MaskedDateInput/MaskedDateInput.context.mjs.map +0 -1
- package/esm/components/MaskedDateInput/MaskedDateInput.mjs +0 -626
- package/esm/components/MaskedDateInput/MaskedDateInput.mjs.map +0 -1
- package/esm/components/MaskedDateInput/MaskedDateInput.module.css.mjs +0 -5
- package/esm/components/MaskedDateInput/MaskedDateInput.module.css.mjs.map +0 -1
- package/esm/components/MaskedDateInput/use-masked-date-input.mjs +0 -441
- package/esm/components/MaskedDateInput/use-masked-date-input.mjs.map +0 -1
- package/lib/components/MaskedDateInput/MaskedDateInput.context.d.ts +0 -7
- package/lib/components/MaskedDateInput/MaskedDateInput.d.ts +0 -123
- package/lib/components/MaskedDateInput/MaskedDateInput.types.d.ts +0 -19
- package/lib/components/MaskedDateInput/index.d.ts +0 -12
- package/lib/components/MaskedDateInput/use-masked-date-input.d.ts +0 -56
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { __BaseInputProps, __InputStylesNames, BoxProps, CloseButtonProps, DataAttributes, ElementProps, Factory, InputVariant, MantineSize, PopoverProps, StylesApiProps } from '@mantine/core';
|
|
2
|
-
import { DateStringValue } from '../../types';
|
|
3
|
-
import { CalendarBaseProps, CalendarStylesNames } from '../Calendar';
|
|
4
|
-
import { DecadeLevelSettings } from '../DecadeLevel';
|
|
5
|
-
import { MonthLevelSettings } from '../MonthLevel';
|
|
6
|
-
import { TimePickerAmPmLabels, TimePickerFormat } from '../TimePicker/TimePicker.types';
|
|
7
|
-
import { YearLevelSettings } from '../YearLevel';
|
|
8
|
-
import type { MaskedDateInputOrder, MaskedDateInputPasteSplit } from './MaskedDateInput.types';
|
|
9
|
-
export type MaskedDateInputStylesNames = 'fieldsRoot' | 'fieldsGroup' | 'field' | 'yearField' | 'separator' | 'dropdown' | CalendarStylesNames | __InputStylesNames;
|
|
10
|
-
export interface MaskedDateInputProps extends BoxProps, Omit<__BaseInputProps, 'size'>, CalendarBaseProps, Omit<DecadeLevelSettings, 'size'>, Omit<YearLevelSettings, 'size'>, Omit<MonthLevelSettings, 'size'>, StylesApiProps<MaskedDateInputFactory>, ElementProps<'div', 'onChange' | 'defaultValue' | 'size'> {
|
|
11
|
-
/** Component size */
|
|
12
|
-
size?: MantineSize;
|
|
13
|
-
/** Controlled component value in YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS format */
|
|
14
|
-
value?: DateStringValue | null;
|
|
15
|
-
/** Uncontrolled component default value */
|
|
16
|
-
defaultValue?: DateStringValue | null;
|
|
17
|
-
/** Called when value changes */
|
|
18
|
-
onChange?: (value: DateStringValue | null) => void;
|
|
19
|
-
/** Order of date fields, @default ['day', 'month', 'year'] */
|
|
20
|
-
dateFieldsOrder?: MaskedDateInputOrder;
|
|
21
|
-
/** Separator between date fields, @default '/' */
|
|
22
|
-
dateSeparator?: string;
|
|
23
|
-
/** Separator between time fields, @default ':' */
|
|
24
|
-
timeSeparator?: string;
|
|
25
|
-
/** Separator between date and time fields, @default ' ' */
|
|
26
|
-
dateTimeSeparator?: string;
|
|
27
|
-
/** Determines whether to show time inputs, @default false */
|
|
28
|
-
withTime?: boolean;
|
|
29
|
-
/** Determines whether to show seconds input, @default false */
|
|
30
|
-
withSeconds?: boolean;
|
|
31
|
-
/** Time format, @default '24h' */
|
|
32
|
-
timeFormat?: TimePickerFormat;
|
|
33
|
-
/** Labels used for am/pm values, @default { am: 'AM', pm: 'PM' } */
|
|
34
|
-
amPmLabels?: TimePickerAmPmLabels;
|
|
35
|
-
/** Props passed down to the `Popover` component */
|
|
36
|
-
popoverProps?: PopoverProps;
|
|
37
|
-
/** Determines whether the clear button should be displayed, @default false */
|
|
38
|
-
clearable?: boolean;
|
|
39
|
-
/** Props passed down to clear button */
|
|
40
|
-
clearButtonProps?: CloseButtonProps & ElementProps<'button'> & DataAttributes;
|
|
41
|
-
/** `name` prop passed down to the hidden input */
|
|
42
|
-
name?: string;
|
|
43
|
-
/** `form` prop passed down to the hidden input */
|
|
44
|
-
form?: string;
|
|
45
|
-
/** Called once when one of the inputs is focused */
|
|
46
|
-
onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
47
|
-
/** Called once when the focus is no longer on any of the inputs */
|
|
48
|
-
onBlur?: (event: React.FocusEvent<HTMLDivElement>) => void;
|
|
49
|
-
/** If set, the value cannot be updated */
|
|
50
|
-
readOnly?: boolean;
|
|
51
|
-
/** If set, the component becomes disabled */
|
|
52
|
-
disabled?: boolean;
|
|
53
|
-
/** Props passed down to day input */
|
|
54
|
-
dayInputProps?: React.ComponentProps<'input'> & DataAttributes;
|
|
55
|
-
/** Props passed down to month input */
|
|
56
|
-
monthInputProps?: React.ComponentProps<'input'> & DataAttributes;
|
|
57
|
-
/** Props passed down to year input */
|
|
58
|
-
yearInputProps?: React.ComponentProps<'input'> & DataAttributes;
|
|
59
|
-
/** Props passed down to hours input */
|
|
60
|
-
hoursInputProps?: React.ComponentProps<'input'> & DataAttributes;
|
|
61
|
-
/** Props passed down to minutes input */
|
|
62
|
-
minutesInputProps?: React.ComponentProps<'input'> & DataAttributes;
|
|
63
|
-
/** Props passed down to seconds input */
|
|
64
|
-
secondsInputProps?: React.ComponentProps<'input'> & DataAttributes;
|
|
65
|
-
/** Props passed down to am/pm select */
|
|
66
|
-
amPmSelectProps?: React.ComponentProps<'select'> & DataAttributes;
|
|
67
|
-
/** Props passed down to the hidden input */
|
|
68
|
-
hiddenInputProps?: React.ComponentProps<'input'> & DataAttributes;
|
|
69
|
-
/** A function to transform paste values */
|
|
70
|
-
pasteSplit?: MaskedDateInputPasteSplit;
|
|
71
|
-
/** A ref object to get node reference of the day input */
|
|
72
|
-
dayRef?: React.Ref<HTMLInputElement>;
|
|
73
|
-
/** A ref object to get node reference of the month input */
|
|
74
|
-
monthRef?: React.Ref<HTMLInputElement>;
|
|
75
|
-
/** A ref object to get node reference of the year input */
|
|
76
|
-
yearRef?: React.Ref<HTMLInputElement>;
|
|
77
|
-
/** A ref object to get node reference of the hours input */
|
|
78
|
-
hoursRef?: React.Ref<HTMLInputElement>;
|
|
79
|
-
/** A ref object to get node reference of the minutes input */
|
|
80
|
-
minutesRef?: React.Ref<HTMLInputElement>;
|
|
81
|
-
/** A ref object to get node reference of the seconds input */
|
|
82
|
-
secondsRef?: React.Ref<HTMLInputElement>;
|
|
83
|
-
/** A ref object to get node reference of the am/pm select */
|
|
84
|
-
amPmRef?: React.Ref<HTMLSelectElement>;
|
|
85
|
-
/** Day input placeholder, @default 'DD' */
|
|
86
|
-
dayPlaceholder?: string;
|
|
87
|
-
/** Month input placeholder, @default 'MM' */
|
|
88
|
-
monthPlaceholder?: string;
|
|
89
|
-
/** Year input placeholder, @default 'YYYY' */
|
|
90
|
-
yearPlaceholder?: string;
|
|
91
|
-
/** Hours input placeholder, @default '--' */
|
|
92
|
-
hoursPlaceholder?: string;
|
|
93
|
-
/** Minutes input placeholder, @default '--' */
|
|
94
|
-
minutesPlaceholder?: string;
|
|
95
|
-
/** Seconds input placeholder, @default '--' */
|
|
96
|
-
secondsPlaceholder?: string;
|
|
97
|
-
/** `aria-label` for day input */
|
|
98
|
-
dayInputLabel?: string;
|
|
99
|
-
/** `aria-label` for month input */
|
|
100
|
-
monthInputLabel?: string;
|
|
101
|
-
/** `aria-label` for year input */
|
|
102
|
-
yearInputLabel?: string;
|
|
103
|
-
/** `aria-label` for hours input */
|
|
104
|
-
hoursInputLabel?: string;
|
|
105
|
-
/** `aria-label` for minutes input */
|
|
106
|
-
minutesInputLabel?: string;
|
|
107
|
-
/** `aria-label` for seconds input */
|
|
108
|
-
secondsInputLabel?: string;
|
|
109
|
-
/** `aria-label` of am/pm input */
|
|
110
|
-
amPmInputLabel?: string;
|
|
111
|
-
}
|
|
112
|
-
export type MaskedDateInputFactory = Factory<{
|
|
113
|
-
props: MaskedDateInputProps;
|
|
114
|
-
ref: HTMLDivElement;
|
|
115
|
-
stylesNames: MaskedDateInputStylesNames;
|
|
116
|
-
variant: InputVariant;
|
|
117
|
-
}>;
|
|
118
|
-
export declare const MaskedDateInput: import("@mantine/core").MantineComponent<{
|
|
119
|
-
props: MaskedDateInputProps;
|
|
120
|
-
ref: HTMLDivElement;
|
|
121
|
-
stylesNames: MaskedDateInputStylesNames;
|
|
122
|
-
variant: InputVariant;
|
|
123
|
-
}>;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { TimePickerAmPmLabels, TimePickerFormat } from '../TimePicker/TimePicker.types';
|
|
2
|
-
export type MaskedDateInputField = 'day' | 'month' | 'year';
|
|
3
|
-
export type MaskedDateInputOrder = MaskedDateInputField[];
|
|
4
|
-
export interface MaskedDateInputParsedValue {
|
|
5
|
-
day: number | null;
|
|
6
|
-
month: number | null;
|
|
7
|
-
year: number | null;
|
|
8
|
-
hours: number | null;
|
|
9
|
-
minutes: number | null;
|
|
10
|
-
seconds: number | null;
|
|
11
|
-
amPm: string | null;
|
|
12
|
-
}
|
|
13
|
-
export interface MaskedDateInputPasteSplit {
|
|
14
|
-
(input: {
|
|
15
|
-
value: string;
|
|
16
|
-
format: TimePickerFormat;
|
|
17
|
-
amPmLabels: TimePickerAmPmLabels;
|
|
18
|
-
}): MaskedDateInputParsedValue;
|
|
19
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { MaskedDateInputFactory, MaskedDateInputProps, MaskedDateInputStylesNames } from './MaskedDateInput';
|
|
2
|
-
import type { MaskedDateInputField, MaskedDateInputOrder, MaskedDateInputPasteSplit } from './MaskedDateInput.types';
|
|
3
|
-
export { MaskedDateInput } from './MaskedDateInput';
|
|
4
|
-
export type { MaskedDateInputProps, MaskedDateInputStylesNames, MaskedDateInputFactory, MaskedDateInputField, MaskedDateInputOrder, MaskedDateInputPasteSplit, };
|
|
5
|
-
export declare namespace MaskedDateInput {
|
|
6
|
-
type Props = MaskedDateInputProps;
|
|
7
|
-
type StylesNames = MaskedDateInputStylesNames;
|
|
8
|
-
type Factory = MaskedDateInputFactory;
|
|
9
|
-
type Field = MaskedDateInputField;
|
|
10
|
-
type Order = MaskedDateInputOrder;
|
|
11
|
-
type PasteSplit = MaskedDateInputPasteSplit;
|
|
12
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { DateStringValue } from '../../types';
|
|
2
|
-
import { TimePickerAmPmLabels, TimePickerFormat } from '../TimePicker/TimePicker.types';
|
|
3
|
-
import type { MaskedDateInputPasteSplit } from './MaskedDateInput.types';
|
|
4
|
-
interface UseMaskedDateInputInput {
|
|
5
|
-
value: DateStringValue | undefined;
|
|
6
|
-
defaultValue: DateStringValue | undefined;
|
|
7
|
-
onChange: ((value: DateStringValue | null) => void) | undefined;
|
|
8
|
-
withTime: boolean | undefined;
|
|
9
|
-
withSeconds: boolean | undefined;
|
|
10
|
-
format: TimePickerFormat;
|
|
11
|
-
amPmLabels: TimePickerAmPmLabels;
|
|
12
|
-
min: string | undefined;
|
|
13
|
-
max: string | undefined;
|
|
14
|
-
minDate: DateStringValue | Date | undefined;
|
|
15
|
-
maxDate: DateStringValue | Date | undefined;
|
|
16
|
-
readOnly: boolean | undefined;
|
|
17
|
-
disabled: boolean | undefined;
|
|
18
|
-
clearable: boolean | undefined;
|
|
19
|
-
pasteSplit: MaskedDateInputPasteSplit | undefined;
|
|
20
|
-
}
|
|
21
|
-
export declare function useMaskedDateInput({ value, defaultValue, onChange, withTime, withSeconds, format, amPmLabels, min, max, minDate, maxDate, clearable, readOnly, disabled, pasteSplit, }: UseMaskedDateInputInput): {
|
|
22
|
-
values: {
|
|
23
|
-
day: number | null;
|
|
24
|
-
month: number | null;
|
|
25
|
-
year: number | null;
|
|
26
|
-
hours: number | null;
|
|
27
|
-
minutes: number | null;
|
|
28
|
-
seconds: number | null;
|
|
29
|
-
amPm: string | null;
|
|
30
|
-
};
|
|
31
|
-
setDay: (val: number | null) => void;
|
|
32
|
-
setMonth: (val: number | null) => void;
|
|
33
|
-
setYear: (val: number | null) => void;
|
|
34
|
-
setHours: (val: number | null) => void;
|
|
35
|
-
setMinutes: (val: number | null) => void;
|
|
36
|
-
setSeconds: (val: number | null) => void;
|
|
37
|
-
setAmPm: (val: string | null) => void;
|
|
38
|
-
setDateValue: (dateValue: DateStringValue | null) => void;
|
|
39
|
-
clear: () => void;
|
|
40
|
-
isClearable: boolean | undefined;
|
|
41
|
-
refs: {
|
|
42
|
-
day: import("react").RefObject<HTMLInputElement | null>;
|
|
43
|
-
month: import("react").RefObject<HTMLInputElement | null>;
|
|
44
|
-
year: import("react").RefObject<HTMLInputElement | null>;
|
|
45
|
-
hours: import("react").RefObject<HTMLInputElement | null>;
|
|
46
|
-
minutes: import("react").RefObject<HTMLInputElement | null>;
|
|
47
|
-
seconds: import("react").RefObject<HTMLInputElement | null>;
|
|
48
|
-
amPm: import("react").RefObject<HTMLSelectElement | null>;
|
|
49
|
-
};
|
|
50
|
-
focus: (field: "day" | "month" | "year" | "hours" | "minutes" | "seconds" | "amPm") => void;
|
|
51
|
-
onPaste: (event: React.ClipboardEvent<any>) => void;
|
|
52
|
-
hiddenInputValue: string;
|
|
53
|
-
calendarValue: string | null;
|
|
54
|
-
getDaysInMonth: () => number;
|
|
55
|
-
};
|
|
56
|
-
export {};
|