1
0
Fork 0

Added Statistics calculation

Statistics now show calculated values
This commit is contained in:
Techognito 2025-09-04 17:30:00 +02:00
parent fe87374e47
commit fc0f69dacb
2147 changed files with 141321 additions and 39 deletions

View file

@ -0,0 +1,542 @@
import { FieldSectionContentType, FieldSectionType } from "./fields.js";
import { PickersTimezone } from "./timezone.js";
import { PickerValidDate } from "./pickers.js";
export interface AdapterFormats {
/**
* The 4-digit year.
* @example "2019"
*/
year: string;
/**
* The full month name.
* @example "January"
*/
month: string;
/**
* The abbreviated month name.
* @example "Jan"
*/
monthShort: string;
/**
* The day of the month.
* @example "1"
*/
dayOfMonth: string;
/**
* The day of the month with letters.
* @example "2nd"
*/
dayOfMonthFull: string;
/**
* The name of the day of the week.
* @example "Wednesday"
*/
weekday: string;
/**
* The abbreviated name of the day of the week.
* @example "Wed"
* */
weekdayShort: string;
/**
* The hours, 24-hour clock.
* @example "23"
*/
hours24h: string;
/**
* The hours, 12-hour clock.
* @example "11"
*/
hours12h: string;
/**
* The meridiem.
* @example "AM"
*/
meridiem: string;
/**
* The minutes.
* @example "44"
*/
minutes: string;
/**
* The seconds.
* @example "00"
*/
seconds: string;
/** The localized full date.
* Used for the aria-label of the opening button of the `DatePicker`.
* @example "Jan 1, 2019"
*/
fullDate: string;
/**
* A keyboard input friendly date format.
* Used in the date fields.
* @example "02/13/2020"
*/
keyboardDate: string;
/**
* The abbreviated month name and the day of the month.
* Used in the `DateTimePicker` and `DateRangePicker` toolbars.
* @example "Jan 1"
*/
shortDate: string;
/**
* The month name and the day of the month.
* Used in the `DatePicker` toolbar for non-english locales.
* @example "1 January"
*/
normalDate: string;
/**
* The month name, the day of the week and the day of the month.
* Used in the `DatePicker` toolbar for english locales.
* @example "Sun, Jan 1"
*/
normalDateWithWeekday: string;
/**
* The hours with the meridiem and minutes.
* @example "11:44 PM"
*/
fullTime12h: string;
/**
* The hours without the meridiem and minutes.
* @example "23:44"
*/
fullTime24h: string;
/**
* A keyboard input friendly time format for 12-hour clock.
* Used in the date-time fields.
* @example "02/13/2020 11:44 PM"
*/
keyboardDateTime12h: string;
/**
* A keyboard input friendly time format for 24-hour clock.
* Used in the date-time fields.
* @example "02/13/2020 23:44"
*/
keyboardDateTime24h: string;
}
export type FieldFormatTokenMap = {
[formatToken: string]: FieldSectionType | {
sectionType: FieldSectionType;
contentType: FieldSectionContentType;
maxLength?: number;
};
};
type PropertyIfNotNever<PName extends string, PType> = [PType] extends [never] ? {} : { [P in PName]?: PType };
export type AdapterOptions<TLocale, TInstance> = {
formats?: Partial<AdapterFormats>;
locale?: TLocale;
} & PropertyIfNotNever<'instance', TInstance>;
export type DateBuilderReturnType<T extends string | null | undefined> = [T] extends [null] ? null : PickerValidDate;
export interface MuiPickersAdapter<TLocale = any> {
/**
* A boolean confirming that the adapter used is an MUI adapter.
*/
isMUIAdapter: boolean;
isTimezoneCompatible: boolean;
formats: AdapterFormats;
locale?: TLocale;
/**
* Name of the library that is used right now
*/
lib: string;
/**
* The characters used to escape a string inside a format.
*/
escapedCharacters: {
start: string;
end: string;
};
/**
* A map containing all the format that the field components can understand.
*/
formatTokenMap: FieldFormatTokenMap;
/**
* Create a date in the date library format.
* If no `value` parameter is provided, creates a date with the current timestamp.
* If a `value` parameter is provided, pass it to the date library to try to parse it.
* @param {string | null | undefined} value The optional value to parse.
* @param {PickersTimezone} timezone The timezone of the date. Default: "default"
* @returns {PickerValidDate | null} The parsed date.
*/
date<T extends string | null | undefined>(value?: T, timezone?: PickersTimezone): DateBuilderReturnType<T>;
/**
* Creates an invalid date in the date library format.
* @deprecated This method will be removed in the next major release (v9.0.0).
* @returns {PickerValidDate} The invalid date.
*/
getInvalidDate(): PickerValidDate;
/**
* Extracts the timezone from a date.
* @param {PickerValidDate | null} value The date from which we want to get the timezone.
* @returns {PickerValidDate} The timezone of the date.
*/
getTimezone(value: PickerValidDate | null): PickersTimezone;
/**
* Convert a date to another timezone.
* @param {PickerValidDate} value The date to convert.
* @param {PickersTimezone} timezone The timezone to convert the date to.
* @returns {PickerValidDate} The converted date.
*/
setTimezone(value: PickerValidDate, timezone: PickersTimezone): PickerValidDate;
/**
* Convert a date in the library format into a JavaScript `Date` object.
* @param {PickerValidDate} value The value to convert.
* @returns {PickerValidDate} the JavaScript date.
*/
toJsDate(value: PickerValidDate): Date;
/**
* Parse a string date in a specific format.
* @param {string} value The string date to parse.
* @param {string} format The format in which the string date is.
* @returns {PickerValidDate | null} The parsed date.
*/
parse(value: string, format: string): PickerValidDate | null;
/**
* Get the code of the locale currently used by the adapter.
* @returns {string} The code of the locale.
*/
getCurrentLocaleCode(): string;
/**
* Check if the current locale is using 12 hours cycle (i.e: time with meridiem).
* @returns {boolean} `true` if the current locale is using 12 hours cycle.
*/
is12HourCycleInCurrentLocale(): boolean;
/**
* Create a format with no meta-token (for example: `LLL` or `PP`).
* @param {string} format The format to expand.
* @returns {string} The expanded format.
*/
expandFormat(format: string): string;
/**
* Check if the date is valid.
* @param {PickerValidDate | null} value The value to test.
* @returns {boolean} `true` if the value is a valid date according to the date library.
*/
isValid(value: PickerValidDate | null): value is PickerValidDate;
/**
* Format a date using an adapter format string (see the `AdapterFormats` interface)
* @param {PickerValidDate} value The date to format.
* @param {keyof AdapterFormats} formatKey The formatKey to use.
* @returns {string} The stringify date.
*/
format(value: PickerValidDate, formatKey: keyof AdapterFormats): string;
/**
* Format a date using a format of the date library.
* @param {PickerValidDate} value The date to format.
* @param {string} formatString The format to use.
* @returns {string} The stringify date.
*/
formatByString(value: PickerValidDate, formatString: string): string;
/**
* Format a number to be rendered in the clock.
* Is being used in hijri and jalali adapters.
* @param {string} numberToFormat The number to format.
* @returns {string} The formatted number.
*/
formatNumber(numberToFormat: string): string;
/**
* Check if the two dates are equal (which means they represent the same timestamp).
* @param {PickerValidDate | null} value The reference date.
* @param {PickerValidDate | null} comparing The date to compare with the reference date.
* @returns {boolean} `true` if the two dates are equal.
*/
isEqual(value: PickerValidDate | null, comparing: PickerValidDate | null): boolean;
/**
* Check if the two dates are in the same year (using the timezone of the reference date).
* @param {PickerValidDate} value The reference date.
* @param {PickerValidDate} comparing The date to compare with the reference date.
* @returns {boolean} `true` if the two dates are in the same year.
*/
isSameYear(value: PickerValidDate, comparing: PickerValidDate): boolean;
/**
* Check if the two dates are in the same month (using the timezone of the reference date).
* @param {PickerValidDate} value The reference date.
* @param {PickerValidDate} comparing The date to compare with the reference date.
* @returns {boolean} `true` if the two dates are in the same month.
*/
isSameMonth(value: PickerValidDate, comparing: PickerValidDate): boolean;
/**
* Check if the two dates are in the same day (using the timezone of the reference date).
* @param {PickerValidDate} value The reference date.
* @param {PickerValidDate} comparing The date to compare with the reference date.
* @returns {boolean} `true` if the two dates are in the same day.
*/
isSameDay(value: PickerValidDate, comparing: PickerValidDate): boolean;
/**
* Check if the two dates are at the same hour (using the timezone of the reference date).
* @param {PickerValidDate} value The reference date.
* @param {PickerValidDate} comparing The date to compare with the reference date.
* @returns {boolean} `true` if the two dates are in the same hour.
*/
isSameHour(value: PickerValidDate, comparing: PickerValidDate): boolean;
/**
* Check if the reference date is after the second date.
* @param {PickerValidDate} value The reference date.
* @param {PickerValidDate} comparing The date to compare with the reference date.
* @returns {boolean} `true` if the reference date is after the second date.
*/
isAfter(value: PickerValidDate, comparing: PickerValidDate): boolean;
/**
* Check if the year of the reference date is after the year of the second date (using the timezone of the reference date).
* @param {PickerValidDate} value The reference date.
* @param {PickerValidDate} comparing The date to compare with the reference date.
* @returns {boolean} `true` if the year of the reference date is after the year of the second date.
*/
isAfterYear(value: PickerValidDate, comparing: PickerValidDate): boolean;
/**
* Check if the day of the reference date is after the day of the second date (using the timezone of the reference date).
* @param {PickerValidDate} value The reference date.
* @param {PickerValidDate} comparing The date to compare with the reference date.
* @returns {boolean} `true` if the day of the reference date is after the day of the second date.
*/
isAfterDay(value: PickerValidDate, comparing: PickerValidDate): boolean;
/**
* Check if the reference date is before the second date.
* @param {PickerValidDate} value The reference date.
* @param {PickerValidDate} comparing The date to compare with the reference date.
* @returns {boolean} `true` if the reference date is before the second date.
*/
isBefore(value: PickerValidDate, comparing: PickerValidDate): boolean;
/**
* Check if the year of the reference date is before the year of the second date (using the timezone of the reference date).
* @param {PickerValidDate} value The reference date.
* @param {PickerValidDate} comparing The date to compare with the reference date.
* @returns {boolean} `true` if the year of the reference date is before the year of the second date.
*/
isBeforeYear(value: PickerValidDate, comparing: PickerValidDate): boolean;
/**
* Check if the day of the reference date is before the day of the second date (using the timezone of the reference date).
* @param {PickerValidDate} value The reference date.
* @param {PickerValidDate} comparing The date to compare with the reference date.
* @returns {boolean} `true` if the day of the reference date is before the day of the second date.
*/
isBeforeDay(value: PickerValidDate, comparing: PickerValidDate): boolean;
/**
* Check if the value is within the provided range.
* @param {PickerValidDate} value The value to test.
* @param {[PickerValidDate, PickerValidDate]} range The range in which the value should be.
* @returns {boolean} `true` if the value is within the provided range.
*/
isWithinRange(value: PickerValidDate, range: [PickerValidDate, PickerValidDate]): boolean;
/**
* Return the start of the year for the given date.
* @param {PickerValidDate} value The original date.
* @returns {PickerValidDate} The start of the year of the given date.
*/
startOfYear(value: PickerValidDate): PickerValidDate;
/**
* Return the start of the month for the given date.
* @param {PickerValidDate} value The original date.
* @returns {PickerValidDate} The start of the month of the given date.
*/
startOfMonth(value: PickerValidDate): PickerValidDate;
/**
* Return the start of the week for the given date.
* @param {PickerValidDate} value The original date.
* @returns {PickerValidDate} The start of the week of the given date.
*/
startOfWeek(value: PickerValidDate): PickerValidDate;
/**
* Return the start of the day for the given date.
* @param {PickerValidDate} value The original date.
* @returns {PickerValidDate} The start of the day of the given date.
*/
startOfDay(value: PickerValidDate): PickerValidDate;
/**
* Return the end of the year for the given date.
* @param {PickerValidDate} value The original date.
* @returns {PickerValidDate} The end of the year of the given date.
*/
endOfYear(value: PickerValidDate): PickerValidDate;
/**
* Return the end of the month for the given date.
* @param {PickerValidDate} value The original date.
* @returns {PickerValidDate} The end of the month of the given date.
*/
endOfMonth(value: PickerValidDate): PickerValidDate;
/**
* Return the end of the week for the given date.
* @param {PickerValidDate} value The original date.
* @returns {PickerValidDate} The end of the week of the given date.
*/
endOfWeek(value: PickerValidDate): PickerValidDate;
/**
* Return the end of the day for the given date.
* @param {PickerValidDate} value The original date.
* @returns {PickerValidDate} The end of the day of the given date.
*/
endOfDay(value: PickerValidDate): PickerValidDate;
/**
* Add the specified number of years to the given date.
* @param {PickerValidDate} value The date to be changed.
* @param {number} amount The amount of years to be added.
* @returns {PickerValidDate} The new date with the years added.
*/
addYears(value: PickerValidDate, amount: number): PickerValidDate;
/**
* Add the specified number of months to the given date.
* @param {PickerValidDate} value The date to be changed.
* @param {number} amount The amount of months to be added.
* @returns {PickerValidDate} The new date with the months added.
*/
addMonths(value: PickerValidDate, amount: number): PickerValidDate;
/**
* Add the specified number of weeks to the given date.
* @param {PickerValidDate} value The date to be changed.
* @param {number} amount The amount of weeks to be added.
* @returns {PickerValidDate} The new date with the weeks added.
*/
addWeeks(value: PickerValidDate, amount: number): PickerValidDate;
/**
* Add the specified number of days to the given date.
* @param {PickerValidDate} value The date to be changed.
* @param {number} amount The amount of days to be added.
* @returns {PickerValidDate} The new date with the days added.
*/
addDays(value: PickerValidDate, amount: number): PickerValidDate;
/**
* Add the specified number of hours to the given date.
* @param {PickerValidDate} value The date to be changed.
* @param {number} amount The amount of hours to be added.
* @returns {PickerValidDate} The new date with the hours added.
*/
addHours(value: PickerValidDate, amount: number): PickerValidDate;
/**
* Add the specified number of minutes to the given date.
* @param {PickerValidDate} value The date to be changed.
* @param {number} amount The amount of minutes to be added.
* @returns {PickerValidDate} The new date with the minutes added.
*/
addMinutes(value: PickerValidDate, amount: number): PickerValidDate;
/**
* Add the specified number of seconds to the given date.
* @param {PickerValidDate} value The date to be changed.
* @param {number} amount The amount of seconds to be added.
* @returns {PickerValidDate} The new date with the seconds added.
*/
addSeconds(value: PickerValidDate, amount: number): PickerValidDate;
/**
* Get the year of the given date.
* @param {PickerValidDate} value The given date.
* @returns {number} The year of the given date.
*/
getYear(value: PickerValidDate): number;
/**
* Get the month of the given date.
* The value is 0-based, in the Gregorian calendar January = 0, February = 1, ...
* @param {PickerValidDate} value The given date.
* @returns {number} The month of the given date.
*/
getMonth(value: PickerValidDate): number;
/**
* Get the date (day in the month) of the given date.
* @param {PickerValidDate} value The given date.
* @returns {number} The date of the given date.
*/
getDate(value: PickerValidDate): number;
/**
* Get the hours of the given date.
* @param {PickerValidDate} value The given date.
* @returns {number} The hours of the given date.
*/
getHours(value: PickerValidDate): number;
/**
* Get the minutes of the given date.
* @param {PickerValidDate} value The given date.
* @returns {number} The minutes of the given date.
*/
getMinutes(value: PickerValidDate): number;
/**
* Get the seconds of the given date.
* @param {PickerValidDate} value The given date.
* @returns {number} The seconds of the given date.
*/
getSeconds(value: PickerValidDate): number;
/**
* Get the milliseconds of the given date.
* @param {PickerValidDate} value The given date.
* @returns {number} The milliseconds of the given date.
*/
getMilliseconds(value: PickerValidDate): number;
/**
* Set the year to the given date.
* @param {PickerValidDate} value The date to be changed.
* @param {number} year The year of the new date.
* @returns {PickerValidDate} The new date with the year set.
*/
setYear(value: PickerValidDate, year: number): PickerValidDate;
/**
* Set the month to the given date.
* @param {PickerValidDate} value The date to be changed.
* @param {number} month The month of the new date.
* @returns {PickerValidDate} The new date with the month set.
*/
setMonth(value: PickerValidDate, month: number): PickerValidDate;
/**
* Set the date (day in the month) to the given date.
* @param {PickerValidDate} value The date to be changed.
* @param {number} date The date of the new date.
* @returns {PickerValidDate} The new date with the date set.
*/
setDate(value: PickerValidDate, date: number): PickerValidDate;
/**
* Set the hours to the given date.
* @param {PickerValidDate} value The date to be changed.
* @param {number} hours The hours of the new date.
* @returns {PickerValidDate} The new date with the hours set.
*/
setHours(value: PickerValidDate, hours: number): PickerValidDate;
/**
* Set the minutes to the given date.
* @param {PickerValidDate} value The date to be changed.
* @param {number} minutes The minutes of the new date.
* @returns {PickerValidDate} The new date with the minutes set.
*/
setMinutes(value: PickerValidDate, minutes: number): PickerValidDate;
/**
* Set the seconds to the given date.
* @param {PickerValidDate} value The date to be changed.
* @param {number} seconds The seconds of the new date.
* @returns {PickerValidDate} The new date with the seconds set.
*/
setSeconds(value: PickerValidDate, seconds: number): PickerValidDate;
/**
* Set the milliseconds to the given date.
* @param {PickerValidDate} value The date to be changed.
* @param {number} milliseconds The milliseconds of the new date.
* @returns {PickerValidDate} The new date with the milliseconds set.
*/
setMilliseconds(value: PickerValidDate, milliseconds: number): PickerValidDate;
/**
* Get the number of days in a month of the given date.
* @param {PickerValidDate} value The given date.
* @returns {number} The number of days in the month
*/
getDaysInMonth(value: PickerValidDate): number;
/**
* Create a nested list with all the days of the month of the given date grouped by week.
* @param {PickerValidDate} value The given date.
* @returns {PickerValidDate[][]} A nested list with all the days of the month grouped by week.
*/
getWeekArray(value: PickerValidDate): PickerValidDate[][];
/**
* Get the number of the week of the given date.
* @param {PickerValidDate} value The given date.
* @returns {number} The number of the week of the given date.
*/
getWeekNumber(value: PickerValidDate): number;
/**
* Get the number of the day of the week of the given date.
* The value is 1-based, 1 - first day of the week, 7 - last day of the week.
* @param {PickerValidDate} value The given date.
* @returns {number} The number of the day of the week of the given date.
*/
getDayOfWeek(value: PickerValidDate): number;
/**
* Create a list with all the years between the start and the end date.
* @param {[PickerValidDate, PickerValidDate]} range The range of year to create.
* @returns {PickerValidDate[]} List of all the years between the start end the end date.
*/
getYearRange(range: [PickerValidDate, PickerValidDate]): PickerValidDate[];
}
export {};

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,6 @@
export interface TimeStepOptions {
hours?: number;
minutes?: number;
seconds?: number;
}
export type PickerValueType = 'date' | 'time' | 'date-time';

View file

@ -0,0 +1 @@
export {};

186
node_modules/@mui/x-date-pickers/esm/models/fields.d.ts generated vendored Normal file
View file

@ -0,0 +1,186 @@
import * as React from 'react';
import { TextFieldProps } from '@mui/material/TextField';
import { FormControlOwnProps } from '@mui/material/FormControl';
import type { ExportedPickersSectionListProps } from "../PickersSectionList/index.js";
import type { UseFieldInternalProps, UseFieldReturnValue } from "../internals/hooks/useField/index.js";
import type { PickersTextFieldProps } from "../PickersTextField/index.js";
import { BaseSingleInputFieldProps, FieldRangeSection, PickerRangeValue, PickerValidValue } from "../internals/models/index.js";
import { PickerOwnerState } from "./pickers.js";
import type { ExportedPickerFieldUIProps } from "../internals/components/PickerFieldUI.js";
export type FieldSectionType = 'year' | 'month' | 'day' | 'weekDay' | 'hours' | 'minutes' | 'seconds' | 'meridiem' | 'empty';
export type FieldSectionContentType = 'digit' | 'digit-with-letter' | 'letter';
export interface FieldSection {
/**
* Value of the section, as rendered inside the input.
* For example, in the date `May 25, 1995`, the value of the month section is "May".
*/
value: string;
/**
* Format token used to parse the value of this section from the date object.
* For example, in the format `MMMM D, YYYY`, the format of the month section is "MMMM".
*/
format: string;
/**
* Maximum length of the value, only defined for "digit" sections.
* Will be used to determine how many leading zeros should be added to the value.
*/
maxLength: number | null;
/**
* Placeholder rendered when the value of this section is empty.
*/
placeholder: string;
/**
* Type of the section.
*/
type: FieldSectionType;
/**
* Type of content of the section.
* Will determine if we should apply a digit-based editing or a letter-based editing.
*/
contentType: FieldSectionContentType;
/**
* If `true`, the value of this section is supposed to have leading zeroes when parsed by the date library.
* For example, the value `1` should be rendered as "01" instead of "1".
*/
hasLeadingZerosInFormat: boolean;
/**
* If `true`, the value of this section is supposed to have leading zeroes when rendered in the input.
* For example, the value `1` should be rendered as "01" instead of "1".
*/
hasLeadingZerosInInput: boolean;
/**
* If `true`, the section value has been modified since the last time the sections were generated from a valid date.
* When we can generate a valid date from the section, we don't directly pass it to `onChange`,
* Otherwise, we would lose all the information contained in the original date, things like:
* - time if the format does not contain it
* - timezone / UTC
*
* To avoid losing that information, we transfer the values of the modified sections from the newly generated date to the original date.
*/
modified: boolean;
/**
* Separator displayed before the value of the section in the input.
* If it contains escaped characters, then it must not have the escaping characters.
* For example, on Day.js, the `year` section of the format `YYYY [year]` has an end separator equal to `year` not `[year]`
*/
startSeparator: string;
/**
* Separator displayed after the value of the section in the input.
* If it contains escaped characters, then it must not have the escaping characters.
* For example, on Day.js, the `year` section of the format `[year] YYYY` has a start separator equal to `[year]`
*/
endSeparator: string;
/**
* If `true`, the `endSeparator` is a format separator (i.e. ":" or "/").
*/
isEndFormatSeparator?: boolean;
}
type IsAny<T> = boolean extends (T extends never ? true : false) ? true : false;
export type InferFieldSection<TValue extends PickerValidValue> = IsAny<TValue> extends true ? FieldSection : TValue extends PickerRangeValue ? FieldRangeSection : FieldSection;
export interface FieldRef<TValue extends PickerValidValue> {
/**
* Returns the sections of the current value.
* @returns {InferFieldSection<TValue>[]} The sections of the current value.
*/
getSections: () => InferFieldSection<TValue>[];
/**
* Returns the index of the active section (the first focused section).
* If no section is active, returns `null`.
* @returns {number | null} The index of the active section.
*/
getActiveSectionIndex: () => number | null;
/**
* Updates the selected sections.
* @param {FieldSelectedSections} selectedSections The sections to select.
*/
setSelectedSections: (selectedSections: FieldSelectedSections) => void;
/**
* Focuses the field.
* @param {FieldSelectedSections | FieldSectionType} newSelectedSection The section to select once focused.
*/
focusField: (newSelectedSection?: number | FieldSectionType) => void;
/**
* Returns `true` if the focused is on the field input.
* @returns {boolean} `true` if the field is focused.
*/
isFieldFocused: () => boolean;
}
export type FieldSelectedSections = number | FieldSectionType | null | 'all';
export interface FieldOwnerState extends PickerOwnerState {
/**
* `true` if the field is disabled, `false` otherwise.
*/
isFieldDisabled: boolean;
/**
* `true` if the field is read-only, `false` otherwise.
*/
isFieldReadOnly: boolean;
/**
* `true` if the field is required, `false` otherwise.
*/
isFieldRequired: boolean;
/**
* The direction of the field.
* Is equal to "ltr" when the field is in left-to-right direction.
* Is equal to "rtl" when the field is in right-to-left direction.
*/
fieldDirection: 'ltr' | 'rtl';
}
/**
* Props the `slotProps.field` of a Picker can receive.
*/
export type PickerFieldSlotProps<TValue extends PickerValidValue, TEnableAccessibleFieldDOMStructure extends boolean> = ExportedPickerFieldUIProps & Pick<UseFieldInternalProps<TValue, TEnableAccessibleFieldDOMStructure, unknown>, 'shouldRespectLeadingZeros' | 'readOnly'> & React.HTMLAttributes<HTMLDivElement> & {
ref?: React.Ref<HTMLDivElement>;
};
/**
* Props the text field receives when used inside a single input Picker.
* Only contains what the MUI components are passing to the text field, not what users can pass using the `props.slotProps.field` and `props.slotProps.textField`.
*/
export type BaseSingleInputPickersTextFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> = Omit<UseFieldReturnValue<TEnableAccessibleFieldDOMStructure, BaseSingleInputFieldProps>, 'slots' | 'slotProps' | 'clearable' | 'onClear' | 'openPickerButtonPosition' | 'clearButtonPosition' | 'openPickerAriaLabel'>;
/**
* Props the built-in text field component can receive.
*/
export type BuiltInFieldTextFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> = TEnableAccessibleFieldDOMStructure extends false ? Omit<TextFieldProps, 'autoComplete' | 'error' | 'maxRows' | 'minRows' | 'multiline' | 'placeholder' | 'rows' | 'select' | 'SelectProps' | 'type'> : Partial<Omit<PickersTextFieldProps, keyof ExportedPickersSectionListProps>>;
export interface PickerTextFieldOwnerState extends FieldOwnerState {
/**
* `true` if the value of the field is currently empty.
*/
isFieldValueEmpty: boolean;
/**
* `true` if the field is focused, `false` otherwise.
*/
isFieldFocused: boolean;
/**
* `true` if the field has an error, `false` otherwise.
*/
hasFieldError: boolean;
/**
* The size of the input.
*/
inputSize: Exclude<FormControlOwnProps['size'], undefined>;
/**
* The color of the input.
*/
inputColor: Exclude<FormControlOwnProps['color'], undefined>;
/**
* `true` if the input takes up the full width of its container.
*/
isInputInFullWidth: boolean;
/**
* `true` if the input has a start adornment, `false` otherwise.
*/
hasStartAdornment: boolean;
/**
* `true` if the input has an end adornment, `false` otherwise.
*/
hasEndAdornment: boolean;
/**
* `true` if the input has a label, `false` otherwise.
*/
inputHasLabel: boolean;
/**
* `true` if the input label is shrunk, `false` otherwise.
*/
isLabelShrunk: boolean;
}
export {};

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,9 @@
export * from "./fields.js";
export * from "./timezone.js";
export * from "./validation.js";
export * from "./views.js";
export * from "./adapters.js";
export * from "./common.js";
export * from "./pickers.js";
export * from "./manager.js";
export type { PropsFromSlot } from '@mui/x-internals/slots';

11
node_modules/@mui/x-date-pickers/esm/models/index.js generated vendored Normal file
View file

@ -0,0 +1,11 @@
export * from "./fields.js";
export * from "./timezone.js";
export * from "./validation.js";
export * from "./views.js";
export * from "./adapters.js";
export * from "./common.js";
export * from "./pickers.js";
export * from "./manager.js";
// Utils shared across the X packages
export {};

View file

@ -0,0 +1,78 @@
import type { FieldValueManager, UseFieldInternalProps } from "../internals/hooks/useField/index.js";
import type { PickerValidValue, PickerValueManager } from "../internals/models/index.js";
import type { Validator } from "../validation/index.js";
import type { PickerValueType } from "./common.js";
/**
* Object that contains all the necessary methods and properties to adapt a Picker or a Field for a given value type.
* You should never create your own manager.
* Instead, use the hooks exported from '@mui/x-date-pickers/managers' and '@mui/x-date-pickers-pro/managers'.
*
* ```tsx
* import { useDateManager } from '@mui/x-date-pickers/managers';
* import { useValidation } from '@mui/x-date-pickers/validation';
*
* const manager = useDateManager();
* const { hasValidationError } = useValidation({
* validator: manager.validator,
* value,
* timezone,
* props,
* });
* ```
*/
export interface PickerManager<TValue extends PickerValidValue, TEnableAccessibleFieldDOMStructure extends boolean, TError, TValidationProps extends {}, TFieldInternalProps extends {}> {
/**
* The type of the value (e.g. 'date', 'date-time', 'time').
*/
valueType: PickerValueType;
/**
* Checks if a value is valid and returns an error code otherwise.
* It can be passed to the `useValidation` hook to validate a value:
*
* ```tsx
* import { useDateManager } from '@mui/x-date-pickers/managers';
* import { useValidation } from '@mui/x-date-pickers/validation';
*
* const manager = useDateManager();
* const { hasValidationError } = useValidation({
* validator: manager.validator,
* value,
* timezone,
* props,
* });
* ```
*/
validator: Validator<TValue, TError, TValidationProps>;
/**
* Object containing basic methods to interact with the value of the Picker or Field.
* This property is not part of the public API and should not be used directly.
*/
internal_valueManager: PickerValueManager<TValue, TError>;
/**
* Object containing all the necessary methods to interact with the value of the Field.
* This property is not part of the public API and should not be used directly.
*/
internal_fieldValueManager: FieldValueManager<TValue>;
/**
* `true` if the field is using the accessible DOM structure.
* `false` if the field is using the non-accessible DOM structure.
* This property is not part of the public API and should not be used directly.
*/
internal_enableAccessibleFieldDOMStructure: TEnableAccessibleFieldDOMStructure;
/**
* Applies the default values to the field internal props.
* This usually includes:
* - a default format to display the value in the field
* - some default validation props that are needed to validate the value (e.g: minDate, maxDate)
* This property is not part of the public API and should not be used directly.
* @param {TFieldInternalProps<TFieldInternalProps>} internalProps The field internal props to apply the defaults to.
* @returns {TFieldInternalPropsWithDefaults} The field internal props with the defaults applied.
*/
internal_useApplyDefaultValuesToFieldInternalProps: (internalProps: TFieldInternalProps) => UseFieldInternalProps<TValue, TEnableAccessibleFieldDOMStructure, TError> & TValidationProps;
/**
* Returns a hook that creates the aria-label to apply on the button that opens the Picker.
* @param {TValue} value The value of the Picker.
* @returns {string} The aria-label to apply on the button that opens the Picker.
*/
internal_useOpenPickerButtonAriaLabel: (value: TValue) => string;
}

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,58 @@
import { PickerOrientation, PickerVariant } from "../internals/models/common.js";
import type { PickersShortcutsItemContext } from "../PickersShortcuts/index.js";
export interface PickerChangeHandlerContext<TError> {
validationError: TError;
/**
* Shortcut causing this `onChange` or `onAccept` call.
* If the call has not been caused by a shortcut selection, this property will be `undefined`.
*/
shortcut?: PickersShortcutsItemContext;
}
export interface PickerValidDateLookup {}
export type PickerValidDate = keyof PickerValidDateLookup extends never ? any : PickerValidDateLookup[keyof PickerValidDateLookup];
/**
* Importance of the change when picking a value:
* - "accept": fires `onChange`, fires `onAccept` and closes the Picker.
* - "set": fires `onChange` but do not fire `onAccept` and does not close the Picker.
* @default "accept"
*/
export type PickerChangeImportance = 'set' | 'accept';
export interface PickerOwnerState {
/**
* `true` if the value of the Picker is currently empty.
* Is always `false` if the component you are accessing the ownerState from is not wrapped with a Picker.
*/
isPickerValueEmpty: boolean;
/**
* `true` if the Picker is open, `false` otherwise.
* Is always `false` if the component you are accessing the ownerState from is not wrapped with a Picker.
*/
isPickerOpen: boolean;
/**
* `true` if the Picker is disabled, `false` otherwise.
* Is always `false` if the component you are accessing the ownerState from is not wrapped with a Picker.
*/
isPickerDisabled: boolean;
/**
* `true` if the Picker is read-only, `false` otherwise.
* Is always `false` if the component you are accessing the ownerState from is not wrapped with a Picker.
*/
isPickerReadOnly: boolean;
/**
* The responsive variant of the Picker.
* Is equal to "desktop" when using a desktop Picker (like <DesktopDatePicker />).
* Is equal to "mobile" when using a mobile Picker (like <MobileDatePicker />).
* Is equal to "mobile" or "desktop" when using a responsive Picker (like <DatePicker />) depending on the `desktopModeMediaQuery` prop.
* Is equal to "mobile" or "desktop" when using a static Picker (like <StaticDatePicker />) depending on the `displayStaticWrapperAs` prop.
* Is always equal to "desktop" if the component you are accessing the ownerState from is not wrapped with a Picker.
*/
pickerVariant: PickerVariant;
/**
* The orientation of the Picker.
* Is equal to "landscape" when the Picker is in landscape orientation.
* Is equal to "portrait" when the Picker is in portrait orientation.
* You can use the "orientation" on any Picker component to force the orientation.
* Is always equal to "portrait" if the component you are accessing the ownerState from is not wrapped with a Picker.
*/
pickerOrientation: PickerOrientation;
}

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,11 @@
export type PickersTimezone = 'default' | 'system' | 'UTC' | string;
export interface TimezoneProps {
/**
* Choose which timezone to use for the value.
* Example: "default", "system", "UTC", "America/New_York".
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documentation} for more details.
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
*/
timezone?: PickersTimezone;
}

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,22 @@
import type { PickerValidValue } from "../internals/models/index.js";
/**
* Validation error types applicable to both date and time validation
*/
type CommonDateTimeValidationError = 'invalidDate' | 'disableFuture' | 'disablePast' | null;
export type DateValidationError = CommonDateTimeValidationError | 'shouldDisableDate' | 'shouldDisableMonth' | 'shouldDisableYear' | 'minDate' | 'maxDate';
export type TimeValidationError = CommonDateTimeValidationError | 'minutesStep' | 'minTime' | 'maxTime' | 'shouldDisableTime-hours' | 'shouldDisableTime-minutes' | 'shouldDisableTime-seconds';
export type DateTimeValidationError = DateValidationError | TimeValidationError;
export interface OnErrorProps<TValue extends PickerValidValue, TError> {
/**
* Callback fired when the error associated with the current value changes.
* When a validation error is detected, the `error` parameter contains a non-null value.
* This can be used to render an appropriate form error.
* @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
* @param {TError} error The reason why the current value is not valid.
* @param {TValue} value The value associated with the error.
*/
onError?: (error: TError, value: TValue) => void;
}
export type InferError<TProps> = TProps extends Pick<OnErrorProps<any, any>, 'onError'> ? Parameters<Exclude<TProps['onError'], undefined>>[0] : never;
export {};

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,3 @@
export type DateView = 'year' | 'month' | 'day';
export type TimeView = 'hours' | 'minutes' | 'seconds';
export type DateOrTimeView = DateView | TimeView;

1
node_modules/@mui/x-date-pickers/esm/models/views.js generated vendored Normal file
View file

@ -0,0 +1 @@
export {};