wcz-layout
Version:
229 lines (228 loc) • 14.7 kB
TypeScript
import { t as FormOmittedProps } from "./utils-BBQ5S6oM.js";
import { AutocompleteProps, ButtonProps, CheckboxProps, RadioGroupProps, SliderProps, SwitchProps, TextFieldProps } from "@mui/material";
import * as _$react from "react";
import { FC, ReactNode } from "react";
import { useTranslation } from "react-i18next";
import { AlertColor } from "@mui/material/Alert";
import { useInView } from "react-intersection-observer";
import * as _$_tanstack_react_form0 from "@tanstack/react-form";
import { DatePickerProps, DateRangePickerProps, DateTimePickerProps, DateTimeRangePickerProps, TimePickerProps, TimeRangePickerProps } from "@mui/x-date-pickers-pro";
import * as _$_tanstack_form_core0 from "@tanstack/form-core";
import { InputAttributes, NumericFormatProps } from "react-number-format/types/types";
import { PickersTextFieldProps } from "@mui/x-date-pickers/PickersTextField";
//#region src/components/form/FormTextField.d.ts
interface FormTextFieldProps extends Omit<TextFieldProps, FormOmittedProps> {
type?: "color" | "email" | "password" | "search" | "tel" | "text" | "url";
}
//#endregion
//#region src/components/form/FormNumberField.d.ts
interface FormNumberFieldProps extends Omit<TextFieldProps, FormOmittedProps> {
defaultValue?: number | null;
options?: Omit<NumericFormatProps<InputAttributes>, "customInput" | "onValueChange" | keyof InputAttributes>;
}
//#endregion
//#region src/components/form/FormAutocomplete.d.ts
interface FormAutocompleteProps extends Omit<AutocompleteProps<any, boolean, boolean, boolean>, FormOmittedProps> {
textFieldProps?: Omit<TextFieldProps, FormOmittedProps>;
}
//#endregion
//#region src/components/form/FormCheckbox.d.ts
interface FormCheckboxProps extends Omit<CheckboxProps, FormOmittedProps> {
label?: string;
}
//#endregion
//#region src/components/form/FormSwitch.d.ts
interface FormSwitchProps extends Omit<SwitchProps, FormOmittedProps> {
label?: string;
}
//#endregion
//#region src/components/form/FormRadioGroup.d.ts
interface Option {
label: string;
value: string | number;
}
interface FormRadioGroupProps extends Omit<RadioGroupProps, FormOmittedProps> {
label?: string;
options: Array<Option>;
}
//#endregion
//#region src/components/form/FormSlider.d.ts
interface FormSliderProps extends Omit<SliderProps, FormOmittedProps> {
label?: string;
}
//#endregion
//#region src/components/form/FormDatePicker.d.ts
interface FormDatePickerProps extends Omit<DatePickerProps, FormOmittedProps> {
textFieldProps?: Partial<PickersTextFieldProps>;
}
//#endregion
//#region src/components/form/FormDateRangePicker.d.ts
interface FormDateRangePickerProps extends Omit<DateRangePickerProps, FormOmittedProps> {
textFieldProps?: Partial<PickersTextFieldProps>;
}
//#endregion
//#region src/components/form/FormTimePicker.d.ts
interface FormTimePickerProps extends Omit<TimePickerProps, FormOmittedProps> {
textFieldProps?: Partial<PickersTextFieldProps>;
}
//#endregion
//#region src/components/form/FormTimeRangePicker.d.ts
interface FormTimeRangePickerProps extends Omit<TimeRangePickerProps, FormOmittedProps> {
textFieldProps?: Partial<PickersTextFieldProps>;
}
//#endregion
//#region src/components/form/FormDateTimePicker.d.ts
interface FormDateTimePickerProps extends Omit<DateTimePickerProps, FormOmittedProps> {
textFieldProps?: Partial<PickersTextFieldProps>;
}
//#endregion
//#region src/components/form/FormDateTimeRangePicker.d.ts
interface FormDateTimeRangePickerProps extends Omit<DateTimeRangePickerProps, FormOmittedProps> {
textFieldProps?: Partial<PickersTextFieldProps>;
}
//#endregion
//#region src/components/form/FormSubmitButton.d.ts
type FormSubmitButtonProps = Omit<ButtonProps, "loading" | "disabled" | "onClick" | "type">;
declare const useLayoutForm: <TFormData, TOnMount extends _$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined, TOnChange extends _$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined, TOnChangeAsync extends _$_tanstack_form_core0.FormAsyncValidateOrFn<TFormData> | undefined, TOnBlur extends _$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined, TOnBlurAsync extends _$_tanstack_form_core0.FormAsyncValidateOrFn<TFormData> | undefined, TOnSubmit extends _$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined, TOnSubmitAsync extends _$_tanstack_form_core0.FormAsyncValidateOrFn<TFormData> | undefined, TOnDynamic extends _$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined, TOnDynamicAsync extends _$_tanstack_form_core0.FormAsyncValidateOrFn<TFormData> | undefined, TOnServer extends _$_tanstack_form_core0.FormAsyncValidateOrFn<TFormData> | undefined, TSubmitMeta>(props: _$_tanstack_form_core0.FormOptions<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>) => _$_tanstack_react_form0.AppFieldExtendedReactFormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta, {
readonly TextField: _$react.FC<FormTextFieldProps>;
readonly NumberField: _$react.FC<FormNumberFieldProps>;
readonly Autocomplete: _$react.FC<FormAutocompleteProps>;
readonly Checkbox: _$react.FC<FormCheckboxProps>;
readonly Switch: _$react.FC<FormSwitchProps>;
readonly RadioGroup: _$react.FC<FormRadioGroupProps>;
readonly Slider: _$react.FC<FormSliderProps>;
readonly DatePicker: _$react.FC<FormDatePickerProps>;
readonly DateRangePicker: _$react.FC<FormDateRangePickerProps>;
readonly TimePicker: _$react.FC<FormTimePickerProps>;
readonly TimeRangePicker: _$react.FC<FormTimeRangePickerProps>;
readonly DateTimePicker: _$react.FC<FormDateTimePickerProps>;
readonly DateTimeRangePicker: _$react.FC<FormDateTimeRangePickerProps>;
}, {
readonly SubmitButton: _$react.FC<FormSubmitButtonProps>;
}>, withLayoutForm: <TFormData, TOnMount extends _$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined, TOnChange extends _$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined, TOnChangeAsync extends _$_tanstack_form_core0.FormAsyncValidateOrFn<TFormData> | undefined, TOnBlur extends _$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined, TOnBlurAsync extends _$_tanstack_form_core0.FormAsyncValidateOrFn<TFormData> | undefined, TOnSubmit extends _$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined, TOnSubmitAsync extends _$_tanstack_form_core0.FormAsyncValidateOrFn<TFormData> | undefined, TOnDynamic extends _$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined, TOnDynamicAsync extends _$_tanstack_form_core0.FormAsyncValidateOrFn<TFormData> | undefined, TOnServer extends _$_tanstack_form_core0.FormAsyncValidateOrFn<TFormData> | undefined, TSubmitMeta, TRenderProps extends object = {}>({
render,
props
}: _$_tanstack_react_form0.WithFormProps<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta, {
readonly TextField: _$react.FC<FormTextFieldProps>;
readonly NumberField: _$react.FC<FormNumberFieldProps>;
readonly Autocomplete: _$react.FC<FormAutocompleteProps>;
readonly Checkbox: _$react.FC<FormCheckboxProps>;
readonly Switch: _$react.FC<FormSwitchProps>;
readonly RadioGroup: _$react.FC<FormRadioGroupProps>;
readonly Slider: _$react.FC<FormSliderProps>;
readonly DatePicker: _$react.FC<FormDatePickerProps>;
readonly DateRangePicker: _$react.FC<FormDateRangePickerProps>;
readonly TimePicker: _$react.FC<FormTimePickerProps>;
readonly TimeRangePicker: _$react.FC<FormTimeRangePickerProps>;
readonly DateTimePicker: _$react.FC<FormDateTimePickerProps>;
readonly DateTimeRangePicker: _$react.FC<FormDateTimeRangePickerProps>;
}, {
readonly SubmitButton: _$react.FC<FormSubmitButtonProps>;
}, TRenderProps>) => _$react.FunctionComponent<_$react.PropsWithChildren<NoInfer<[unknown] extends [TRenderProps] ? any : TRenderProps> & {
form: _$_tanstack_react_form0.AppFieldExtendedReactFormApi<[unknown] extends [TFormData] ? any : TFormData, [_$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined] extends [TOnMount] ? [TOnMount] extends [TOnMount & (_$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined)] ? any : TOnMount : TOnMount, [_$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined] extends [TOnChange] ? [TOnChange] extends [TOnChange & (_$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined)] ? any : TOnChange : TOnChange, [_$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined] extends [TOnChangeAsync] ? [TOnChangeAsync] extends [TOnChangeAsync & (_$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined)] ? any : TOnChangeAsync : TOnChangeAsync, [_$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined] extends [TOnBlur] ? [TOnBlur] extends [TOnBlur & (_$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined)] ? any : TOnBlur : TOnBlur, [_$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined] extends [TOnBlurAsync] ? [TOnBlurAsync] extends [TOnBlurAsync & (_$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined)] ? any : TOnBlurAsync : TOnBlurAsync, [_$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined] extends [TOnSubmit] ? [TOnSubmit] extends [TOnSubmit & (_$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined)] ? any : TOnSubmit : TOnSubmit, [_$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined] extends [TOnSubmitAsync] ? [TOnSubmitAsync] extends [TOnSubmitAsync & (_$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined)] ? any : TOnSubmitAsync : TOnSubmitAsync, [_$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined] extends [TOnDynamic] ? [TOnDynamic] extends [TOnDynamic & (_$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined)] ? any : TOnDynamic : TOnDynamic, [_$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined] extends [TOnDynamicAsync] ? [TOnDynamicAsync] extends [TOnDynamicAsync & (_$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined)] ? any : TOnDynamicAsync : TOnDynamicAsync, [_$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined] extends [TOnServer] ? [TOnServer] extends [TOnServer & (_$_tanstack_form_core0.FormValidateOrFn<TFormData> | undefined)] ? any : TOnServer : TOnServer, [unknown] extends [TSubmitMeta] ? any : TSubmitMeta, {
readonly TextField: _$react.FC<FormTextFieldProps>;
readonly NumberField: _$react.FC<FormNumberFieldProps>;
readonly Autocomplete: _$react.FC<FormAutocompleteProps>;
readonly Checkbox: _$react.FC<FormCheckboxProps>;
readonly Switch: _$react.FC<FormSwitchProps>;
readonly RadioGroup: _$react.FC<FormRadioGroupProps>;
readonly Slider: _$react.FC<FormSliderProps>;
readonly DatePicker: _$react.FC<FormDatePickerProps>;
readonly DateRangePicker: _$react.FC<FormDateRangePickerProps>;
readonly TimePicker: _$react.FC<FormTimePickerProps>;
readonly TimeRangePicker: _$react.FC<FormTimeRangePickerProps>;
readonly DateTimePicker: _$react.FC<FormDateTimePickerProps>;
readonly DateTimeRangePicker: _$react.FC<FormDateTimeRangePickerProps>;
}, {
readonly SubmitButton: _$react.FC<FormSubmitButtonProps>;
}>;
}>>;
//#endregion
//#region src/hooks/useDialogs.d.ts
interface OpenDialogOptions<TResult> {
onClose?: (result: TResult) => Promise<void>;
}
interface AlertOptions {
title?: ReactNode;
}
interface ConfirmOptions {
title?: ReactNode;
cancelText?: ReactNode;
}
interface DialogProps<TPayload = undefined, TResult = void> {
payload: TPayload;
open: boolean;
onClose: (result: TResult) => Promise<void>;
}
type OpenAlertDialog = (message: ReactNode, options?: AlertOptions) => Promise<void>;
type OpenConfirmDialog = (message: ReactNode, options?: ConfirmOptions) => Promise<boolean>;
type DialogComponent<TPayload, TResult> = React.ComponentType<DialogProps<TPayload, TResult>>;
interface OpenDialog {
<TPayload extends undefined, TResult>(Component: DialogComponent<TPayload, TResult>, payload?: TPayload, options?: OpenDialogOptions<TResult>): Promise<TResult>;
<TPayload, TResult>(Component: DialogComponent<TPayload, TResult>, payload: TPayload, options?: OpenDialogOptions<TResult>): Promise<TResult>;
}
type CloseDialog = <TResult>(dialog: Promise<TResult>, result: TResult) => Promise<TResult>;
interface DialogHook {
alert: OpenAlertDialog;
confirm: OpenConfirmDialog;
open: OpenDialog;
close: CloseDialog;
}
declare function useDialogs(): DialogHook;
//#endregion
//#region src/contexts/NotificationContext.d.ts
interface NotificationOptions {
severity?: AlertColor;
autoHideDuration?: number;
}
interface NotificationContextValue {
notify: (message: string, options?: NotificationOptions) => void;
}
//#endregion
//#region src/hooks/UseNotification.d.ts
declare function useNotification(): NotificationContextValue;
//#endregion
//#region src/hooks/UseScanDetection.d.ts
interface Config {
/** Time to wait from last character to then trigger an evaluation of the buffer. */
timeToEvaluate?: number;
/** Average time between characters in milliseconds. Used to determine if input is from keyboard or a scanner. Defaults to 50ms.*/
averageWaitTime?: number;
/** Character that barcode scanner prefixes input with.*/
startCharacter?: Array<string>;
/** Character that barcode scanner suffixes input with. Defaults to line return.*/
endCharacter?: Array<string>;
/** Callback to use on complete scan input.*/
onComplete: (code: string) => void;
/** Callback to use on error. */
onError?: (error: string) => void;
/** Minimum length a scanned code should be. Defaults to 0.*/
minLength?: number;
/** Ignore scan input if this node is focused.*/
ignoreIfFocusOn?: Node;
/** Stop propagation on keydown event. Defaults to false.*/
stopPropagation?: boolean;
/** Prevent default on keydown event. Defaults to false.*/
preventDefault?: boolean;
/** Bind keydown event to this node. Defaults to document.*/
container?: Node;
/** Indicates if the scanning is enabled. */
enabled?: boolean;
}
declare const useScanDetection: ({
timeToEvaluate,
averageWaitTime,
startCharacter,
endCharacter,
onComplete,
onError,
minLength,
ignoreIfFocusOn,
stopPropagation,
preventDefault,
container,
enabled
}: Config) => void;
//#endregion
export { type DialogProps, useDialogs, useFieldContext, useFormContext, useInView, useLayoutForm, useNotification, useScanDetection, useTranslation, withLayoutForm };
//# sourceMappingURL=hooks.d.ts.map