wcz-layout
Version:
1,180 lines (1,179 loc) • 31.9 kB
JavaScript
import { a as getFieldStatus } from "./utils-CqQKSaSs.js";
import { t as NotificationContext } from "./NotificationContext-DBTYc5z-.js";
import { t as useDialogs } from "./useDialogs-BaxhulU9.js";
import { c } from "react/compiler-runtime";
import { Autocomplete, Button, Checkbox, FormControl, FormControlLabel, FormHelperText, FormLabel, Radio, RadioGroup, Slider, Switch, TextField } from "@mui/material";
import { useContext, useEffect, useRef } from "react";
import { useTranslation } from "react-i18next";
import { jsx, jsxs } from "react/jsx-runtime";
import { useInView } from "react-intersection-observer";
import { createFormHook, createFormHookContexts } from "@tanstack/react-form";
import { DatePicker, DateRangePicker, DateTimePicker, DateTimeRangePicker, TimePicker, TimeRangePicker } from "@mui/x-date-pickers-pro";
import { NumericFormat } from "react-number-format";
//#region src/components/form/FormAutocomplete.tsx
const FormAutocomplete = (t0) => {
const $ = c(24);
if ($[0] !== "08d53cad56d2dac80ef56bbd2f830976f2e70d8964a73d7d2d08c54c9f468e3c") {
for (let $i = 0; $i < 24; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "08d53cad56d2dac80ef56bbd2f830976f2e70d8964a73d7d2d08c54c9f468e3c";
}
let autocompleteProps;
let textFieldProps;
if ($[1] !== t0) {
({textFieldProps, ...autocompleteProps} = t0);
$[1] = t0;
$[2] = autocompleteProps;
$[3] = textFieldProps;
} else {
autocompleteProps = $[2];
textFieldProps = $[3];
}
const field = useFieldContext();
let t1;
if ($[4] !== field) {
t1 = getFieldStatus(field);
$[4] = field;
$[5] = t1;
} else t1 = $[5];
const { isTouched, hasError, helperText } = t1;
let t2;
let t3;
if ($[6] !== autocompleteProps.freeSolo || $[7] !== field) {
t2 = (_, value) => !autocompleteProps.freeSolo && field.handleChange(value);
t3 = (__0, value_0, reason) => reason !== "reset" && autocompleteProps.freeSolo && field.handleChange(value_0);
$[6] = autocompleteProps.freeSolo;
$[7] = field;
$[8] = t2;
$[9] = t3;
} else {
t2 = $[8];
t3 = $[9];
}
let t4;
if ($[10] !== field.name || $[11] !== hasError || $[12] !== helperText || $[13] !== isTouched || $[14] !== textFieldProps) {
t4 = (parameters) => /* @__PURE__ */ jsx(TextField, {
...parameters,
name: field.name,
error: isTouched && hasError,
helperText: isTouched && helperText,
...textFieldProps
});
$[10] = field.name;
$[11] = hasError;
$[12] = helperText;
$[13] = isTouched;
$[14] = textFieldProps;
$[15] = t4;
} else t4 = $[15];
let t5;
if ($[16] !== autocompleteProps || $[17] !== field.handleBlur || $[18] !== field.name || $[19] !== field.state.value || $[20] !== t2 || $[21] !== t3 || $[22] !== t4) {
t5 = /* @__PURE__ */ jsx(Autocomplete, {
value: field.state.value,
onChange: t2,
onInputChange: t3,
onBlur: field.handleBlur,
"aria-label": field.name,
...autocompleteProps,
renderInput: t4
});
$[16] = autocompleteProps;
$[17] = field.handleBlur;
$[18] = field.name;
$[19] = field.state.value;
$[20] = t2;
$[21] = t3;
$[22] = t4;
$[23] = t5;
} else t5 = $[23];
return t5;
};
//#endregion
//#region src/components/form/FormCheckbox.tsx
const FormCheckbox = (props) => {
const $ = c(21);
if ($[0] !== "c45ef823da959fcba4cace3352d1647bfefa3bcb5bff7fc0886d583d1409709f") {
for (let $i = 0; $i < 21; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "c45ef823da959fcba4cace3352d1647bfefa3bcb5bff7fc0886d583d1409709f";
}
const field = useFieldContext();
let t0;
if ($[1] !== field) {
t0 = getFieldStatus(field);
$[1] = field;
$[2] = t0;
} else t0 = $[2];
const { isTouched, hasError, helperText } = t0;
const t1 = field.name;
const t2 = Boolean(field.state.value);
let t3;
if ($[3] !== field) {
t3 = (event) => field.handleChange(event.target.checked);
$[3] = field;
$[4] = t3;
} else t3 = $[4];
let t4;
if ($[5] !== field.handleBlur || $[6] !== field.name || $[7] !== props || $[8] !== t2 || $[9] !== t3) {
t4 = /* @__PURE__ */ jsx(Checkbox, {
name: t1,
checked: t2,
onChange: t3,
onBlur: field.handleBlur,
"aria-label": field.name,
...props
});
$[5] = field.handleBlur;
$[6] = field.name;
$[7] = props;
$[8] = t2;
$[9] = t3;
$[10] = t4;
} else t4 = $[10];
const t5 = props.label ?? "";
let t6;
if ($[11] !== t4 || $[12] !== t5) {
t6 = /* @__PURE__ */ jsx(FormControlLabel, {
control: t4,
label: t5
});
$[11] = t4;
$[12] = t5;
$[13] = t6;
} else t6 = $[13];
let t7;
if ($[14] !== hasError || $[15] !== helperText || $[16] !== isTouched) {
t7 = isTouched && hasError && /* @__PURE__ */ jsx(FormHelperText, {
error: hasError,
children: helperText
});
$[14] = hasError;
$[15] = helperText;
$[16] = isTouched;
$[17] = t7;
} else t7 = $[17];
let t8;
if ($[18] !== t6 || $[19] !== t7) {
t8 = /* @__PURE__ */ jsxs(FormControl, {
component: "fieldset",
children: [t6, t7]
});
$[18] = t6;
$[19] = t7;
$[20] = t8;
} else t8 = $[20];
return t8;
};
//#endregion
//#region src/components/form/FormDatePicker.tsx
const FormDatePicker = (props) => {
const $ = c(19);
if ($[0] !== "fd3801846177cf754134f54f40ba317ddd09332641ff63d233cd125421f2c67b") {
for (let $i = 0; $i < 19; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "fd3801846177cf754134f54f40ba317ddd09332641ff63d233cd125421f2c67b";
}
const field = useFieldContext();
let t0;
if ($[1] !== field) {
t0 = getFieldStatus(field);
$[1] = field;
$[2] = t0;
} else t0 = $[2];
const { isTouched, hasError, helperText } = t0;
let t1;
if ($[3] !== field) {
t1 = (value) => field.handleChange(value);
$[3] = field;
$[4] = t1;
} else t1 = $[4];
const t2 = isTouched && hasError;
const t3 = isTouched && helperText;
let t4;
if ($[5] !== field.handleBlur || $[6] !== props.textFieldProps || $[7] !== t2 || $[8] !== t3) {
t4 = {
onBlur: field.handleBlur,
error: t2,
helperText: t3,
...props.textFieldProps
};
$[5] = field.handleBlur;
$[6] = props.textFieldProps;
$[7] = t2;
$[8] = t3;
$[9] = t4;
} else t4 = $[9];
let t5;
if ($[10] !== props.slotProps || $[11] !== t4) {
t5 = {
textField: t4,
...props.slotProps
};
$[10] = props.slotProps;
$[11] = t4;
$[12] = t5;
} else t5 = $[12];
let t6;
if ($[13] !== field.name || $[14] !== field.state.value || $[15] !== props || $[16] !== t1 || $[17] !== t5) {
t6 = /* @__PURE__ */ jsx(DatePicker, {
name: field.name,
value: field.state.value,
onChange: t1,
slotProps: t5,
"aria-label": field.name,
...props
});
$[13] = field.name;
$[14] = field.state.value;
$[15] = props;
$[16] = t1;
$[17] = t5;
$[18] = t6;
} else t6 = $[18];
return t6;
};
//#endregion
//#region src/components/form/FormDateRangePicker.tsx
const FormDateRangePicker = (props) => {
const $ = c(19);
if ($[0] !== "26740a78e061ed162c8cdd3f736bac4bbd8228343542f0a95b626c4370dfec2c") {
for (let $i = 0; $i < 19; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "26740a78e061ed162c8cdd3f736bac4bbd8228343542f0a95b626c4370dfec2c";
}
const field = useFieldContext();
let t0;
if ($[1] !== field) {
t0 = getFieldStatus(field);
$[1] = field;
$[2] = t0;
} else t0 = $[2];
const { isTouched, hasError, helperText } = t0;
let t1;
if ($[3] !== field) {
t1 = (value) => field.handleChange(value);
$[3] = field;
$[4] = t1;
} else t1 = $[4];
const t2 = isTouched && hasError;
const t3 = isTouched && helperText;
let t4;
if ($[5] !== field.handleBlur || $[6] !== props.textFieldProps || $[7] !== t2 || $[8] !== t3) {
t4 = {
onBlur: field.handleBlur,
error: t2,
helperText: t3,
...props.textFieldProps
};
$[5] = field.handleBlur;
$[6] = props.textFieldProps;
$[7] = t2;
$[8] = t3;
$[9] = t4;
} else t4 = $[9];
let t5;
if ($[10] !== props.slotProps || $[11] !== t4) {
t5 = {
textField: t4,
...props.slotProps
};
$[10] = props.slotProps;
$[11] = t4;
$[12] = t5;
} else t5 = $[12];
let t6;
if ($[13] !== field.name || $[14] !== field.state.value || $[15] !== props || $[16] !== t1 || $[17] !== t5) {
t6 = /* @__PURE__ */ jsx(DateRangePicker, {
name: field.name,
value: field.state.value,
onChange: t1,
slotProps: t5,
"aria-label": field.name,
...props
});
$[13] = field.name;
$[14] = field.state.value;
$[15] = props;
$[16] = t1;
$[17] = t5;
$[18] = t6;
} else t6 = $[18];
return t6;
};
//#endregion
//#region src/components/form/FormTimePicker.tsx
const FormTimePicker = (props) => {
const $ = c(19);
if ($[0] !== "aa55e2d0367833e113247906f25693dd58dcaee1a6122e3a6c66663c92c05612") {
for (let $i = 0; $i < 19; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "aa55e2d0367833e113247906f25693dd58dcaee1a6122e3a6c66663c92c05612";
}
const field = useFieldContext();
let t0;
if ($[1] !== field) {
t0 = getFieldStatus(field);
$[1] = field;
$[2] = t0;
} else t0 = $[2];
const { isTouched, hasError, helperText } = t0;
let t1;
if ($[3] !== field) {
t1 = (value) => field.handleChange(value);
$[3] = field;
$[4] = t1;
} else t1 = $[4];
const t2 = isTouched && hasError;
const t3 = isTouched && helperText;
let t4;
if ($[5] !== field.handleBlur || $[6] !== props.textFieldProps || $[7] !== t2 || $[8] !== t3) {
t4 = {
onBlur: field.handleBlur,
error: t2,
helperText: t3,
...props.textFieldProps
};
$[5] = field.handleBlur;
$[6] = props.textFieldProps;
$[7] = t2;
$[8] = t3;
$[9] = t4;
} else t4 = $[9];
let t5;
if ($[10] !== props.slotProps || $[11] !== t4) {
t5 = {
textField: t4,
...props.slotProps
};
$[10] = props.slotProps;
$[11] = t4;
$[12] = t5;
} else t5 = $[12];
let t6;
if ($[13] !== field.name || $[14] !== field.state.value || $[15] !== props || $[16] !== t1 || $[17] !== t5) {
t6 = /* @__PURE__ */ jsx(TimePicker, {
name: field.name,
value: field.state.value,
onChange: t1,
slotProps: t5,
"aria-label": field.name,
...props
});
$[13] = field.name;
$[14] = field.state.value;
$[15] = props;
$[16] = t1;
$[17] = t5;
$[18] = t6;
} else t6 = $[18];
return t6;
};
//#endregion
//#region src/components/form/FormTimeRangePicker.tsx
const FormTimeRangePicker = (props) => {
const $ = c(19);
if ($[0] !== "30660889eec66a781b0a525918a386583e5fce924bb503c7bbb22779b32dfb41") {
for (let $i = 0; $i < 19; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "30660889eec66a781b0a525918a386583e5fce924bb503c7bbb22779b32dfb41";
}
const field = useFieldContext();
let t0;
if ($[1] !== field) {
t0 = getFieldStatus(field);
$[1] = field;
$[2] = t0;
} else t0 = $[2];
const { isTouched, hasError, helperText } = t0;
let t1;
if ($[3] !== field) {
t1 = (value) => field.handleChange(value);
$[3] = field;
$[4] = t1;
} else t1 = $[4];
const t2 = isTouched && hasError;
const t3 = isTouched && helperText;
let t4;
if ($[5] !== field.handleBlur || $[6] !== props.textFieldProps || $[7] !== t2 || $[8] !== t3) {
t4 = {
onBlur: field.handleBlur,
error: t2,
helperText: t3,
...props.textFieldProps
};
$[5] = field.handleBlur;
$[6] = props.textFieldProps;
$[7] = t2;
$[8] = t3;
$[9] = t4;
} else t4 = $[9];
let t5;
if ($[10] !== props.slotProps || $[11] !== t4) {
t5 = {
textField: t4,
...props.slotProps
};
$[10] = props.slotProps;
$[11] = t4;
$[12] = t5;
} else t5 = $[12];
let t6;
if ($[13] !== field.name || $[14] !== field.state.value || $[15] !== props || $[16] !== t1 || $[17] !== t5) {
t6 = /* @__PURE__ */ jsx(TimeRangePicker, {
name: field.name,
value: field.state.value,
onChange: t1,
slotProps: t5,
"aria-label": field.name,
...props
});
$[13] = field.name;
$[14] = field.state.value;
$[15] = props;
$[16] = t1;
$[17] = t5;
$[18] = t6;
} else t6 = $[18];
return t6;
};
//#endregion
//#region src/components/form/FormDateTimePicker.tsx
const FormDateTimePicker = (props) => {
const $ = c(19);
if ($[0] !== "b00d96cea788cb528419859c0fa3a0bfd614231d390c4dc4461c509a72ff1a2b") {
for (let $i = 0; $i < 19; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "b00d96cea788cb528419859c0fa3a0bfd614231d390c4dc4461c509a72ff1a2b";
}
const field = useFieldContext();
let t0;
if ($[1] !== field) {
t0 = getFieldStatus(field);
$[1] = field;
$[2] = t0;
} else t0 = $[2];
const { isTouched, hasError, helperText } = t0;
let t1;
if ($[3] !== field) {
t1 = (value) => field.handleChange(value);
$[3] = field;
$[4] = t1;
} else t1 = $[4];
const t2 = isTouched && hasError;
const t3 = isTouched && helperText;
let t4;
if ($[5] !== field.handleBlur || $[6] !== props.textFieldProps || $[7] !== t2 || $[8] !== t3) {
t4 = {
onBlur: field.handleBlur,
error: t2,
helperText: t3,
...props.textFieldProps
};
$[5] = field.handleBlur;
$[6] = props.textFieldProps;
$[7] = t2;
$[8] = t3;
$[9] = t4;
} else t4 = $[9];
let t5;
if ($[10] !== props.slotProps || $[11] !== t4) {
t5 = {
textField: t4,
...props.slotProps
};
$[10] = props.slotProps;
$[11] = t4;
$[12] = t5;
} else t5 = $[12];
let t6;
if ($[13] !== field.name || $[14] !== field.state.value || $[15] !== props || $[16] !== t1 || $[17] !== t5) {
t6 = /* @__PURE__ */ jsx(DateTimePicker, {
name: field.name,
value: field.state.value,
onChange: t1,
slotProps: t5,
"aria-label": field.name,
...props
});
$[13] = field.name;
$[14] = field.state.value;
$[15] = props;
$[16] = t1;
$[17] = t5;
$[18] = t6;
} else t6 = $[18];
return t6;
};
//#endregion
//#region src/components/form/FormDateTimeRangePicker.tsx
const FormDateTimeRangePicker = (props) => {
const $ = c(19);
if ($[0] !== "90233aef36d5b4bc17041c44cfdbb9dd1cb92164078d619b4751236fb27414a5") {
for (let $i = 0; $i < 19; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "90233aef36d5b4bc17041c44cfdbb9dd1cb92164078d619b4751236fb27414a5";
}
const field = useFieldContext();
let t0;
if ($[1] !== field) {
t0 = getFieldStatus(field);
$[1] = field;
$[2] = t0;
} else t0 = $[2];
const { isTouched, hasError, helperText } = t0;
let t1;
if ($[3] !== field) {
t1 = (value) => field.handleChange(value);
$[3] = field;
$[4] = t1;
} else t1 = $[4];
const t2 = isTouched && hasError;
const t3 = isTouched && helperText;
let t4;
if ($[5] !== field.handleBlur || $[6] !== props.textFieldProps || $[7] !== t2 || $[8] !== t3) {
t4 = {
onBlur: field.handleBlur,
error: t2,
helperText: t3,
...props.textFieldProps
};
$[5] = field.handleBlur;
$[6] = props.textFieldProps;
$[7] = t2;
$[8] = t3;
$[9] = t4;
} else t4 = $[9];
let t5;
if ($[10] !== props.slotProps || $[11] !== t4) {
t5 = {
textField: t4,
...props.slotProps
};
$[10] = props.slotProps;
$[11] = t4;
$[12] = t5;
} else t5 = $[12];
let t6;
if ($[13] !== field.name || $[14] !== field.state.value || $[15] !== props || $[16] !== t1 || $[17] !== t5) {
t6 = /* @__PURE__ */ jsx(DateTimeRangePicker, {
name: field.name,
value: field.state.value,
onChange: t1,
slotProps: t5,
"aria-label": field.name,
...props
});
$[13] = field.name;
$[14] = field.state.value;
$[15] = props;
$[16] = t1;
$[17] = t5;
$[18] = t6;
} else t6 = $[18];
return t6;
};
//#endregion
//#region src/components/form/FormNumberField.tsx
const FormNumberField = (t0) => {
const $ = c(17);
if ($[0] !== "00b816bda1dc4ba09b312c8ae98a88c3418eef08ba63cd4310978775184c98dc") {
for (let $i = 0; $i < 17; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "00b816bda1dc4ba09b312c8ae98a88c3418eef08ba63cd4310978775184c98dc";
}
let options;
let props;
if ($[1] !== t0) {
({options, ...props} = t0);
$[1] = t0;
$[2] = options;
$[3] = props;
} else {
options = $[2];
props = $[3];
}
const field = useFieldContext();
let t1;
if ($[4] !== field) {
t1 = getFieldStatus(field);
$[4] = field;
$[5] = t1;
} else t1 = $[5];
const { isTouched, hasError, helperText } = t1;
const t2 = field.state.value ?? "";
let t3;
if ($[6] !== field) {
t3 = (t4) => {
const { floatValue } = t4;
return field.handleChange(floatValue);
};
$[6] = field;
$[7] = t3;
} else t3 = $[7];
const t4 = isTouched && hasError;
const t5 = isTouched && helperText;
let t6;
if ($[8] !== field.handleBlur || $[9] !== field.name || $[10] !== options || $[11] !== props || $[12] !== t2 || $[13] !== t3 || $[14] !== t4 || $[15] !== t5) {
t6 = /* @__PURE__ */ jsx(NumericFormat, {
customInput: TextField,
name: field.name,
value: t2,
onValueChange: t3,
onBlur: field.handleBlur,
error: t4,
helperText: t5,
"aria-label": field.name,
...props,
...options
});
$[8] = field.handleBlur;
$[9] = field.name;
$[10] = options;
$[11] = props;
$[12] = t2;
$[13] = t3;
$[14] = t4;
$[15] = t5;
$[16] = t6;
} else t6 = $[16];
return t6;
};
//#endregion
//#region src/components/form/FormRadioGroup.tsx
const FormRadioGroup = (t0) => {
const $ = c(28);
if ($[0] !== "a850da04fbd650d370339841fd124049fe34d7b5bc939e2cb4c03f7f04aa21c0") {
for (let $i = 0; $i < 28; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "a850da04fbd650d370339841fd124049fe34d7b5bc939e2cb4c03f7f04aa21c0";
}
let label;
let options;
let props;
if ($[1] !== t0) {
({label, options, ...props} = t0);
$[1] = t0;
$[2] = label;
$[3] = options;
$[4] = props;
} else {
label = $[2];
options = $[3];
props = $[4];
}
const field = useFieldContext();
let t1;
if ($[5] !== field) {
t1 = getFieldStatus(field);
$[5] = field;
$[6] = t1;
} else t1 = $[6];
const { isTouched, hasError, helperText } = t1;
let t2;
if ($[7] !== label) {
t2 = label && /* @__PURE__ */ jsx(FormLabel, {
component: "legend",
children: label
});
$[7] = label;
$[8] = t2;
} else t2 = $[8];
const t3 = field.name;
const t4 = field.state.value ?? "";
let t5;
if ($[9] !== field) {
t5 = (event) => field.handleChange(event.target.value);
$[9] = field;
$[10] = t5;
} else t5 = $[10];
const t6 = field.handleBlur;
const t7 = field.name;
let t8;
if ($[11] !== options) {
t8 = options.map(_temp$2);
$[11] = options;
$[12] = t8;
} else t8 = $[12];
let t9;
if ($[13] !== field.handleBlur || $[14] !== field.name || $[15] !== props || $[16] !== t4 || $[17] !== t5 || $[18] !== t8) {
t9 = /* @__PURE__ */ jsx(RadioGroup, {
name: t3,
value: t4,
onChange: t5,
onBlur: t6,
"aria-label": t7,
...props,
children: t8
});
$[13] = field.handleBlur;
$[14] = field.name;
$[15] = props;
$[16] = t4;
$[17] = t5;
$[18] = t8;
$[19] = t9;
} else t9 = $[19];
let t10;
if ($[20] !== hasError || $[21] !== helperText || $[22] !== isTouched) {
t10 = isTouched && hasError && /* @__PURE__ */ jsx(FormHelperText, {
error: hasError,
children: helperText
});
$[20] = hasError;
$[21] = helperText;
$[22] = isTouched;
$[23] = t10;
} else t10 = $[23];
let t11;
if ($[24] !== t10 || $[25] !== t2 || $[26] !== t9) {
t11 = /* @__PURE__ */ jsxs(FormControl, {
component: "fieldset",
children: [
t2,
t9,
t10
]
});
$[24] = t10;
$[25] = t2;
$[26] = t9;
$[27] = t11;
} else t11 = $[27];
return t11;
};
function _temp$2(option) {
return /* @__PURE__ */ jsx(FormControlLabel, {
value: option.value,
control: /* @__PURE__ */ jsx(Radio, {}),
label: option.label
}, option.value);
}
//#endregion
//#region src/components/form/FormSlider.tsx
const FormSlider = (t0) => {
const $ = c(24);
if ($[0] !== "be365ef369c416103ecb5903710205bb23477213ad4cdc6a06c5febdb6d1bb11") {
for (let $i = 0; $i < 24; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "be365ef369c416103ecb5903710205bb23477213ad4cdc6a06c5febdb6d1bb11";
}
let label;
let props;
if ($[1] !== t0) {
({label, ...props} = t0);
$[1] = t0;
$[2] = label;
$[3] = props;
} else {
label = $[2];
props = $[3];
}
const field = useFieldContext();
let t1;
if ($[4] !== field) {
t1 = getFieldStatus(field);
$[4] = field;
$[5] = t1;
} else t1 = $[5];
const { isTouched, hasError, helperText } = t1;
let t2;
if ($[6] !== label) {
t2 = label && /* @__PURE__ */ jsx(FormLabel, { children: label });
$[6] = label;
$[7] = t2;
} else t2 = $[7];
const t3 = field.state.value ?? 0;
let t4;
if ($[8] !== field) {
t4 = (_, value) => field.handleChange(Array.isArray(value) ? value[0] : value);
$[8] = field;
$[9] = t4;
} else t4 = $[9];
let t5;
if ($[10] !== field.handleBlur || $[11] !== field.name || $[12] !== props || $[13] !== t3 || $[14] !== t4) {
t5 = /* @__PURE__ */ jsx(Slider, {
name: field.name,
value: t3,
onChange: t4,
onBlur: field.handleBlur,
"aria-label": field.name,
...props
});
$[10] = field.handleBlur;
$[11] = field.name;
$[12] = props;
$[13] = t3;
$[14] = t4;
$[15] = t5;
} else t5 = $[15];
let t6;
if ($[16] !== hasError || $[17] !== helperText || $[18] !== isTouched) {
t6 = isTouched && hasError && /* @__PURE__ */ jsx(FormHelperText, {
error: hasError,
children: helperText
});
$[16] = hasError;
$[17] = helperText;
$[18] = isTouched;
$[19] = t6;
} else t6 = $[19];
let t7;
if ($[20] !== t2 || $[21] !== t5 || $[22] !== t6) {
t7 = /* @__PURE__ */ jsxs(FormControl, {
component: "fieldset",
children: [
t2,
t5,
t6
]
});
$[20] = t2;
$[21] = t5;
$[22] = t6;
$[23] = t7;
} else t7 = $[23];
return t7;
};
//#endregion
//#region src/components/form/FormSubmitButton.tsx
const FormSubmitButton = (props) => {
const $ = c(9);
if ($[0] !== "0d6c6a12bdd85da06eaafbc7e088f017537616b39409d83dd1f10cc1b2284731") {
for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "0d6c6a12bdd85da06eaafbc7e088f017537616b39409d83dd1f10cc1b2284731";
}
const form = useFormContext();
let t0;
if ($[1] !== form) {
t0 = (event) => {
event.preventDefault();
event.stopPropagation();
form.handleSubmit();
};
$[1] = form;
$[2] = t0;
} else t0 = $[2];
const handleClick = t0;
let t1;
if ($[3] !== handleClick || $[4] !== props) {
t1 = (t2) => {
const [canSubmit, isSubmitting] = t2;
return /* @__PURE__ */ jsx(Button, {
loading: isSubmitting,
disabled: !canSubmit,
onClick: handleClick,
type: "submit",
"aria-label": "submit",
...props
});
};
$[3] = handleClick;
$[4] = props;
$[5] = t1;
} else t1 = $[5];
let t2;
if ($[6] !== form.Subscribe || $[7] !== t1) {
t2 = /* @__PURE__ */ jsx(form.Subscribe, {
selector: _temp$1,
children: t1
});
$[6] = form.Subscribe;
$[7] = t1;
$[8] = t2;
} else t2 = $[8];
return t2;
};
function _temp$1(state) {
return [state.canSubmit, state.isSubmitting];
}
//#endregion
//#region src/components/form/FormSwitch.tsx
const FormSwitch = (props) => {
const $ = c(21);
if ($[0] !== "b2c73964ddfc177a41aa3103af5a1f6930769d39d28fb1640348d24708ae50df") {
for (let $i = 0; $i < 21; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "b2c73964ddfc177a41aa3103af5a1f6930769d39d28fb1640348d24708ae50df";
}
const field = useFieldContext();
let t0;
if ($[1] !== field) {
t0 = getFieldStatus(field);
$[1] = field;
$[2] = t0;
} else t0 = $[2];
const { isTouched, hasError, helperText } = t0;
const t1 = field.name;
const t2 = Boolean(field.state.value);
let t3;
if ($[3] !== field) {
t3 = (event) => field.handleChange(event.target.checked);
$[3] = field;
$[4] = t3;
} else t3 = $[4];
let t4;
if ($[5] !== field.handleBlur || $[6] !== field.name || $[7] !== props || $[8] !== t2 || $[9] !== t3) {
t4 = /* @__PURE__ */ jsx(Switch, {
name: t1,
checked: t2,
onChange: t3,
onBlur: field.handleBlur,
"aria-label": field.name,
...props
});
$[5] = field.handleBlur;
$[6] = field.name;
$[7] = props;
$[8] = t2;
$[9] = t3;
$[10] = t4;
} else t4 = $[10];
const t5 = props.label ?? "";
let t6;
if ($[11] !== t4 || $[12] !== t5) {
t6 = /* @__PURE__ */ jsx(FormControlLabel, {
control: t4,
label: t5
});
$[11] = t4;
$[12] = t5;
$[13] = t6;
} else t6 = $[13];
let t7;
if ($[14] !== hasError || $[15] !== helperText || $[16] !== isTouched) {
t7 = isTouched && hasError && /* @__PURE__ */ jsx(FormHelperText, {
error: hasError,
children: helperText
});
$[14] = hasError;
$[15] = helperText;
$[16] = isTouched;
$[17] = t7;
} else t7 = $[17];
let t8;
if ($[18] !== t6 || $[19] !== t7) {
t8 = /* @__PURE__ */ jsxs(FormControl, {
component: "fieldset",
children: [t6, t7]
});
$[18] = t6;
$[19] = t7;
$[20] = t8;
} else t8 = $[20];
return t8;
};
//#endregion
//#region src/components/form/FormTextField.tsx
const FormTextField = (props) => {
const $ = c(13);
if ($[0] !== "20e2a782e9425ec2804dbc633150b8a14908f9e4003d07e479eb52b3e3b281c8") {
for (let $i = 0; $i < 13; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "20e2a782e9425ec2804dbc633150b8a14908f9e4003d07e479eb52b3e3b281c8";
}
const field = useFieldContext();
let t0;
if ($[1] !== field) {
t0 = getFieldStatus(field);
$[1] = field;
$[2] = t0;
} else t0 = $[2];
const { isTouched, hasError, helperText } = t0;
const t1 = field.state.value ?? "";
let t2;
if ($[3] !== field) {
t2 = (event) => field.handleChange(event.target.value);
$[3] = field;
$[4] = t2;
} else t2 = $[4];
const t3 = isTouched && hasError;
const t4 = isTouched && helperText;
let t5;
if ($[5] !== field.handleBlur || $[6] !== field.name || $[7] !== props || $[8] !== t1 || $[9] !== t2 || $[10] !== t3 || $[11] !== t4) {
t5 = /* @__PURE__ */ jsx(TextField, {
name: field.name,
value: t1,
onChange: t2,
onBlur: field.handleBlur,
error: t3,
helperText: t4,
"aria-label": field.name,
...props
});
$[5] = field.handleBlur;
$[6] = field.name;
$[7] = props;
$[8] = t1;
$[9] = t2;
$[10] = t3;
$[11] = t4;
$[12] = t5;
} else t5 = $[12];
return t5;
};
//#endregion
//#region src/hooks/useForm.ts
const { fieldContext, useFieldContext, formContext, useFormContext } = createFormHookContexts();
const { useAppForm: useLayoutForm, withForm: withLayoutForm } = createFormHook({
fieldComponents: {
TextField: FormTextField,
NumberField: FormNumberField,
Autocomplete: FormAutocomplete,
Checkbox: FormCheckbox,
Switch: FormSwitch,
RadioGroup: FormRadioGroup,
Slider: FormSlider,
DatePicker: FormDatePicker,
DateRangePicker: FormDateRangePicker,
TimePicker: FormTimePicker,
TimeRangePicker: FormTimeRangePicker,
DateTimePicker: FormDateTimePicker,
DateTimeRangePicker: FormDateTimeRangePicker
},
formComponents: { SubmitButton: FormSubmitButton },
fieldContext,
formContext
});
//#endregion
//#region src/hooks/UseNotification.ts
function useNotification() {
const $ = c(1);
if ($[0] !== "31df58e1a39352333c951b98bda0f81a7329be04b46b7d116ea2d9e4abd63f6d") {
for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "31df58e1a39352333c951b98bda0f81a7329be04b46b7d116ea2d9e4abd63f6d";
}
const context = useContext(NotificationContext);
if (!context) throw new Error("useNotification must be used within a NotificationProvider");
return context;
}
//#endregion
//#region src/hooks/UseScanDetection.ts
const useScanDetection = (t0) => {
const $ = c(29);
if ($[0] !== "2064cc9cc35af60926f6074d4ec52a704ea92900880a656d89b7bfcef3795d71") {
for (let $i = 0; $i < 29; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
$[0] = "2064cc9cc35af60926f6074d4ec52a704ea92900880a656d89b7bfcef3795d71";
}
const { timeToEvaluate: t1, averageWaitTime: t2, startCharacter: t3, endCharacter: t4, onComplete, onError, minLength: t5, ignoreIfFocusOn, stopPropagation: t6, preventDefault: t7, container: t8, enabled: t9 } = t0;
const timeToEvaluate = t1 === void 0 ? 100 : t1;
const averageWaitTime = t2 === void 0 ? 50 : t2;
let t10;
if ($[1] !== t3) {
t10 = t3 === void 0 ? [] : t3;
$[1] = t3;
$[2] = t10;
} else t10 = $[2];
const startCharacter = t10;
let t11;
if ($[3] !== t4) {
t11 = t4 === void 0 ? ["Enter", "Escape"] : t4;
$[3] = t4;
$[4] = t11;
} else t11 = $[4];
const endCharacter = t11;
const minLength = t5 === void 0 ? 1 : t5;
const stopPropagation = t6 === void 0 ? false : t6;
const preventDefault = t7 === void 0 ? false : t7;
const container = t8 === void 0 ? document : t8;
const enabled = t9 === void 0 ? true : t9;
let t12;
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
t12 = [];
$[5] = t12;
} else t12 = $[5];
const buffer = useRef(t12);
const timeout = useRef(false);
let t13;
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
t13 = () => {
buffer.current = [];
};
$[6] = t13;
} else t13 = $[6];
const clearBuffer = t13;
let t14;
if ($[7] !== averageWaitTime || $[8] !== minLength || $[9] !== onComplete || $[10] !== onError || $[11] !== startCharacter) {
t14 = () => {
clearTimeout(timeout.current);
const avg = buffer.current.map(_temp).slice(1).reduce(_temp2, 0) / (buffer.current.length - 1);
const code = buffer.current.slice(startCharacter.length > 0 ? 1 : 0).filter(_temp3).map(_temp4).join("");
if (avg <= averageWaitTime && buffer.current.slice(startCharacter.length > 0 ? 1 : 0).length >= minLength) onComplete(code);
else avg <= averageWaitTime && onError && onError(code);
clearBuffer();
};
$[7] = averageWaitTime;
$[8] = minLength;
$[9] = onComplete;
$[10] = onError;
$[11] = startCharacter;
$[12] = t14;
} else t14 = $[12];
const evaluateBuffer = t14;
let t15;
if ($[13] !== enabled || $[14] !== endCharacter || $[15] !== evaluateBuffer || $[16] !== ignoreIfFocusOn || $[17] !== preventDefault || $[18] !== startCharacter || $[19] !== stopPropagation || $[20] !== timeToEvaluate) {
t15 = (event) => {
if (!enabled) return;
if (event.currentTarget !== ignoreIfFocusOn) {
if (endCharacter.includes(event.key)) evaluateBuffer();
if (buffer.current.length > 0 || startCharacter.includes(event.key) || startCharacter.length === 0) {
clearTimeout(timeout.current);
timeout.current = setTimeout(evaluateBuffer, timeToEvaluate);
buffer.current.push({
time: performance.now(),
char: event.key
});
}
}
if (stopPropagation) event.stopPropagation();
if (preventDefault) event.preventDefault();
};
$[13] = enabled;
$[14] = endCharacter;
$[15] = evaluateBuffer;
$[16] = ignoreIfFocusOn;
$[17] = preventDefault;
$[18] = startCharacter;
$[19] = stopPropagation;
$[20] = timeToEvaluate;
$[21] = t15;
} else t15 = $[21];
const onKeyDown = t15;
let t16;
let t17;
if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
t16 = () => () => {
clearTimeout(timeout.current);
};
t17 = [];
$[22] = t16;
$[23] = t17;
} else {
t16 = $[22];
t17 = $[23];
}
useEffect(t16, t17);
let t18;
if ($[24] !== container || $[25] !== onKeyDown) {
t18 = () => {
container.addEventListener("keydown", onKeyDown);
return () => {
container.removeEventListener("keydown", onKeyDown);
};
};
$[24] = container;
$[25] = onKeyDown;
$[26] = t18;
} else t18 = $[26];
let t19;
if ($[27] !== onKeyDown) {
t19 = [onKeyDown];
$[27] = onKeyDown;
$[28] = t19;
} else t19 = $[28];
useEffect(t18, t19);
};
function _temp(t0, k, arr) {
const { time } = t0;
return k > 0 ? time - arr[k - 1].time : 0;
}
function _temp2(total, delta) {
return total + delta;
}
function _temp3(t0) {
const { char } = t0;
return char !== "Shift" && char !== "Tab";
}
function _temp4(t0) {
const { char: char_0 } = t0;
return char_0;
}
//#endregion
export { useDialogs, useFieldContext, useFormContext, useInView, useLayoutForm, useNotification, useScanDetection, useTranslation, withLayoutForm };
//# sourceMappingURL=hooks.js.map