lkd-web-kit 0.7.31 → 0.8.1

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.
Files changed (135) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +23 -0
  2. package/dist/components/EmptyState/index.cjs +38 -52
  3. package/dist/components/EmptyState/index.js +37 -48
  4. package/dist/components/Icon.cjs +46 -50
  5. package/dist/components/Icon.js +44 -46
  6. package/dist/components/InfinityLoadMoreButton/index.cjs +30 -42
  7. package/dist/components/InfinityLoadMoreButton/index.js +28 -38
  8. package/dist/components/InfinitySelect/index.cjs +126 -168
  9. package/dist/components/InfinitySelect/index.js +125 -164
  10. package/dist/components/MyCheckboxGroup/index.cjs +14 -22
  11. package/dist/components/MyCheckboxGroup/index.js +13 -18
  12. package/dist/components/MyDateInput/index.cjs +12 -18
  13. package/dist/components/MyDateInput/index.js +11 -14
  14. package/dist/components/MyDatePickerInput/CalendarIcon.cjs +45 -64
  15. package/dist/components/MyDatePickerInput/CalendarIcon.js +43 -61
  16. package/dist/components/MyDatePickerInput/index.cjs +12 -18
  17. package/dist/components/MyDatePickerInput/index.js +11 -14
  18. package/dist/components/MyDateTimePicker/index.cjs +12 -18
  19. package/dist/components/MyDateTimePicker/index.js +11 -14
  20. package/dist/components/MyMonthPickerInput/index.cjs +12 -18
  21. package/dist/components/MyMonthPickerInput/index.js +11 -14
  22. package/dist/components/MyMultiSelect/index.cjs +9 -9
  23. package/dist/components/MyMultiSelect/index.js +8 -5
  24. package/dist/components/MyNotifications/index.cjs +11 -16
  25. package/dist/components/MyNotifications/index.js +10 -12
  26. package/dist/components/MyNumberInput/index.cjs +9 -15
  27. package/dist/components/MyNumberInput/index.js +8 -11
  28. package/dist/components/MyRadioGroup/index.cjs +14 -22
  29. package/dist/components/MyRadioGroup/index.js +13 -18
  30. package/dist/components/MySelect/index.cjs +9 -15
  31. package/dist/components/MySelect/index.js +8 -11
  32. package/dist/components/MyTextInput/index.cjs +9 -15
  33. package/dist/components/MyTextInput/index.js +8 -11
  34. package/dist/components/MyTextarea/index.cjs +9 -15
  35. package/dist/components/MyTextarea/index.js +8 -11
  36. package/dist/components/MyTimeInput/index.cjs +9 -15
  37. package/dist/components/MyTimeInput/index.js +8 -11
  38. package/dist/components/NavItems.cjs +28 -38
  39. package/dist/components/NavItems.js +26 -34
  40. package/dist/consts/http-status.cjs +66 -69
  41. package/dist/consts/http-status.js +66 -65
  42. package/dist/consts/revalidate.cjs +10 -13
  43. package/dist/consts/revalidate.js +10 -9
  44. package/dist/contexts/NavigationHistoryContext/hook.cjs +41 -42
  45. package/dist/contexts/NavigationHistoryContext/hook.js +40 -38
  46. package/dist/contexts/NavigationHistoryContext/index.cjs +31 -28
  47. package/dist/contexts/NavigationHistoryContext/index.js +30 -24
  48. package/dist/contexts/PageDataContext/index.cjs +15 -18
  49. package/dist/contexts/PageDataContext/index.js +14 -14
  50. package/dist/form/Form.cjs +19 -28
  51. package/dist/form/Form.js +18 -24
  52. package/dist/form/FormSubmitButton.cjs +15 -27
  53. package/dist/form/FormSubmitButton.js +14 -23
  54. package/dist/form/base/FormCheckbox.cjs +15 -23
  55. package/dist/form/base/FormCheckbox.js +14 -19
  56. package/dist/form/base/FormCheckboxGroup.cjs +10 -16
  57. package/dist/form/base/FormCheckboxGroup.js +9 -12
  58. package/dist/form/base/FormDateInput.cjs +10 -16
  59. package/dist/form/base/FormDateInput.js +9 -12
  60. package/dist/form/base/FormDatePickerInput.cjs +10 -16
  61. package/dist/form/base/FormDatePickerInput.js +9 -12
  62. package/dist/form/base/FormDateTimePicker.cjs +10 -16
  63. package/dist/form/base/FormDateTimePicker.js +9 -12
  64. package/dist/form/base/FormMonthPickerInput.cjs +10 -16
  65. package/dist/form/base/FormMonthPickerInput.js +9 -12
  66. package/dist/form/base/FormMultiSelect.cjs +10 -16
  67. package/dist/form/base/FormMultiSelect.js +9 -12
  68. package/dist/form/base/FormNumberInput.cjs +12 -16
  69. package/dist/form/base/FormNumberInput.js +10 -12
  70. package/dist/form/base/FormRadioGroup.cjs +10 -16
  71. package/dist/form/base/FormRadioGroup.js +9 -12
  72. package/dist/form/base/FormSelect.cjs +10 -16
  73. package/dist/form/base/FormSelect.js +9 -12
  74. package/dist/form/base/FormSelectInfinity.cjs +15 -21
  75. package/dist/form/base/FormSelectInfinity.js +14 -17
  76. package/dist/form/base/FormTextInput.cjs +10 -16
  77. package/dist/form/base/FormTextInput.js +9 -12
  78. package/dist/form/base/FormTextarea.cjs +10 -10
  79. package/dist/form/base/FormTextarea.js +9 -6
  80. package/dist/form/base/FormTimeInput.cjs +18 -24
  81. package/dist/form/base/FormTimeInput.js +17 -20
  82. package/dist/form/utils/nullable-but-required.cjs +14 -17
  83. package/dist/form/utils/nullable-but-required.js +13 -13
  84. package/dist/form/utils/optional-but-required.cjs +14 -17
  85. package/dist/form/utils/optional-but-required.js +13 -13
  86. package/dist/form/utils/zodValidator.cjs +9 -13
  87. package/dist/form/utils/zodValidator.js +9 -9
  88. package/dist/hocs/withController.cjs +43 -54
  89. package/dist/hocs/withController.js +42 -50
  90. package/dist/hocs/withModalManager.cjs +29 -35
  91. package/dist/hocs/withModalManager.js +28 -31
  92. package/dist/hooks/useBreakpoint.cjs +8 -12
  93. package/dist/hooks/useBreakpoint.js +7 -8
  94. package/dist/hooks/useFetchNextPageOnScroll.cjs +13 -21
  95. package/dist/hooks/useFetchNextPageOnScroll.js +13 -17
  96. package/dist/hooks/useOnScrollProgress.cjs +33 -37
  97. package/dist/hooks/useOnScrollProgress.js +32 -33
  98. package/dist/hooks/useUpdateSearchParams.cjs +22 -22
  99. package/dist/hooks/useUpdateSearchParams.js +21 -18
  100. package/dist/hooks/useZodConfig.cjs +14 -19
  101. package/dist/hooks/useZodConfig.js +12 -15
  102. package/dist/index.cjs +130 -136
  103. package/dist/index.d.ts +14 -16
  104. package/dist/index.js +62 -61
  105. package/dist/mantine/breakpoints-with-px.cjs +9 -12
  106. package/dist/mantine/breakpoints-with-px.js +9 -8
  107. package/dist/mantine/my-default-theme.cjs +23 -41
  108. package/dist/mantine/my-default-theme.js +22 -37
  109. package/dist/mantine/to-tailwind-colors.cjs +9 -18
  110. package/dist/mantine/to-tailwind-colors.js +9 -14
  111. package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.cjs +35 -70
  112. package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.js +34 -42
  113. package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.cjs +700 -811
  114. package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +701 -804
  115. package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.cjs +44 -64
  116. package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.js +44 -60
  117. package/dist/utils/array/groupBy.cjs +30 -40
  118. package/dist/utils/array/groupBy.js +30 -36
  119. package/dist/utils/array/shuffleArray.cjs +11 -17
  120. package/dist/utils/array/shuffleArray.js +11 -13
  121. package/dist/utils/formatBytes.cjs +12 -11
  122. package/dist/utils/formatBytes.js +12 -7
  123. package/dist/utils/isInfinityEmpty.cjs +3 -6
  124. package/dist/utils/isInfinityEmpty.js +3 -2
  125. package/dist/utils/ky/addBodyJsonHook.cjs +9 -10
  126. package/dist/utils/ky/addBodyJsonHook.js +8 -6
  127. package/dist/utils/ky/parseJson.cjs +6 -9
  128. package/dist/utils/ky/parseJson.js +6 -5
  129. package/dist/utils/new-route.cjs +30 -39
  130. package/dist/utils/new-route.js +30 -35
  131. package/dist/utils/query-stringify.cjs +5 -8
  132. package/dist/utils/query-stringify.js +5 -4
  133. package/dist/utils/virtual-styles.cjs +21 -26
  134. package/dist/utils/virtual-styles.js +21 -22
  135. package/package.json +67 -65
@@ -1,13 +1,10 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { MyRadioGroup } from '../../components/MyRadioGroup/index.js';
3
- import { withController } from '../../hocs/withController.js';
4
-
5
- const FormRadioGroup = withController(({ field, props }) => /* @__PURE__ */ jsx(
6
- MyRadioGroup,
7
- {
8
- ...field,
9
- ...props
10
- }
11
- ));
12
-
1
+ import { MyRadioGroup } from "../../components/MyRadioGroup/index.js";
2
+ import { withController } from "../../hocs/withController.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ //#region src/form/base/FormRadioGroup.tsx
5
+ var FormRadioGroup = withController(({ field, props }) => /* @__PURE__ */ jsx(MyRadioGroup, {
6
+ ...field,
7
+ ...props
8
+ }));
9
+ //#endregion
13
10
  export { FormRadioGroup };
@@ -1,17 +1,11 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const jsxRuntime = require('react/jsx-runtime');
6
- const index = require('../../components/MySelect/index.cjs');
7
- const withController = require('../../hocs/withController.cjs');
8
-
9
- const FormSelect = withController.withController(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
10
- index.MySelect,
11
- {
12
- ...field,
13
- ...props
14
- }
15
- ));
16
-
1
+ require("../../../_virtual/_rolldown/runtime.cjs");
2
+ const require_index = require("../../components/MySelect/index.cjs");
3
+ const require_withController = require("../../hocs/withController.cjs");
4
+ let react_jsx_runtime = require("react/jsx-runtime");
5
+ //#region src/form/base/FormSelect.tsx
6
+ var FormSelect = require_withController.withController(({ field, props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index.MySelect, {
7
+ ...field,
8
+ ...props
9
+ }));
10
+ //#endregion
17
11
  exports.FormSelect = FormSelect;
@@ -1,13 +1,10 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { MySelect } from '../../components/MySelect/index.js';
3
- import { withController } from '../../hocs/withController.js';
4
-
5
- const FormSelect = withController(({ field, props }) => /* @__PURE__ */ jsx(
6
- MySelect,
7
- {
8
- ...field,
9
- ...props
10
- }
11
- ));
12
-
1
+ import { MySelect } from "../../components/MySelect/index.js";
2
+ import { withController } from "../../hocs/withController.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ //#region src/form/base/FormSelect.tsx
5
+ var FormSelect = withController(({ field, props }) => /* @__PURE__ */ jsx(MySelect, {
6
+ ...field,
7
+ ...props
8
+ }));
9
+ //#endregion
13
10
  export { FormSelect };
@@ -1,23 +1,17 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const jsxRuntime = require('react/jsx-runtime');
6
- const index = require('../../components/InfinitySelect/index.cjs');
7
- const withController = require('../../hocs/withController.cjs');
8
-
9
- const FormInfinitySelect = withController.withController(({ field, props }) => {
10
- return /* @__PURE__ */ jsxRuntime.jsx(
11
- index.InfinitySelect,
12
- {
13
- ...field,
14
- ...props,
15
- onChange: (e) => {
16
- field.onChange(e);
17
- props.onChange?.(e);
18
- }
19
- }
20
- );
1
+ require("../../../_virtual/_rolldown/runtime.cjs");
2
+ const require_index = require("../../components/InfinitySelect/index.cjs");
3
+ const require_withController = require("../../hocs/withController.cjs");
4
+ let react_jsx_runtime = require("react/jsx-runtime");
5
+ //#region src/form/base/FormSelectInfinity.tsx
6
+ var FormInfinitySelect = require_withController.withController(({ field, props }) => {
7
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index.InfinitySelect, {
8
+ ...field,
9
+ ...props,
10
+ onChange: (e) => {
11
+ field.onChange(e);
12
+ props.onChange?.(e);
13
+ }
14
+ });
21
15
  });
22
-
16
+ //#endregion
23
17
  exports.FormInfinitySelect = FormInfinitySelect;
@@ -1,19 +1,16 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { InfinitySelect } from '../../components/InfinitySelect/index.js';
3
- import { withController } from '../../hocs/withController.js';
4
-
5
- const FormInfinitySelect = withController(({ field, props }) => {
6
- return /* @__PURE__ */ jsx(
7
- InfinitySelect,
8
- {
9
- ...field,
10
- ...props,
11
- onChange: (e) => {
12
- field.onChange(e);
13
- props.onChange?.(e);
14
- }
15
- }
16
- );
1
+ import { InfinitySelect } from "../../components/InfinitySelect/index.js";
2
+ import { withController } from "../../hocs/withController.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ //#region src/form/base/FormSelectInfinity.tsx
5
+ var FormInfinitySelect = withController(({ field, props }) => {
6
+ return /* @__PURE__ */ jsx(InfinitySelect, {
7
+ ...field,
8
+ ...props,
9
+ onChange: (e) => {
10
+ field.onChange(e);
11
+ props.onChange?.(e);
12
+ }
13
+ });
17
14
  });
18
-
15
+ //#endregion
19
16
  export { FormInfinitySelect };
@@ -1,17 +1,11 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const jsxRuntime = require('react/jsx-runtime');
6
- const index = require('../../components/MyTextInput/index.cjs');
7
- const withController = require('../../hocs/withController.cjs');
8
-
9
- const FormTextInput = withController.withController(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
10
- index.MyTextInput,
11
- {
12
- ...field,
13
- ...props
14
- }
15
- ));
16
-
1
+ require("../../../_virtual/_rolldown/runtime.cjs");
2
+ const require_index = require("../../components/MyTextInput/index.cjs");
3
+ const require_withController = require("../../hocs/withController.cjs");
4
+ let react_jsx_runtime = require("react/jsx-runtime");
5
+ //#region src/form/base/FormTextInput.tsx
6
+ var FormTextInput = require_withController.withController(({ field, props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index.MyTextInput, {
7
+ ...field,
8
+ ...props
9
+ }));
10
+ //#endregion
17
11
  exports.FormTextInput = FormTextInput;
@@ -1,13 +1,10 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { MyTextInput } from '../../components/MyTextInput/index.js';
3
- import { withController } from '../../hocs/withController.js';
4
-
5
- const FormTextInput = withController(({ field, props }) => /* @__PURE__ */ jsx(
6
- MyTextInput,
7
- {
8
- ...field,
9
- ...props
10
- }
11
- ));
12
-
1
+ import { MyTextInput } from "../../components/MyTextInput/index.js";
2
+ import { withController } from "../../hocs/withController.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ //#region src/form/base/FormTextInput.tsx
5
+ var FormTextInput = withController(({ field, props }) => /* @__PURE__ */ jsx(MyTextInput, {
6
+ ...field,
7
+ ...props
8
+ }));
9
+ //#endregion
13
10
  export { FormTextInput };
@@ -1,11 +1,11 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const jsxRuntime = require('react/jsx-runtime');
6
- const index = require('../../components/MyTextarea/index.cjs');
7
- const withController = require('../../hocs/withController.cjs');
8
-
9
- const FormTextarea = withController.withController(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(index.MyTextarea, { ...field, ...props }));
10
-
1
+ require("../../../_virtual/_rolldown/runtime.cjs");
2
+ const require_index = require("../../components/MyTextarea/index.cjs");
3
+ const require_withController = require("../../hocs/withController.cjs");
4
+ let react_jsx_runtime = require("react/jsx-runtime");
5
+ //#region src/form/base/FormTextarea.tsx
6
+ var FormTextarea = require_withController.withController(({ field, props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index.MyTextarea, {
7
+ ...field,
8
+ ...props
9
+ }));
10
+ //#endregion
11
11
  exports.FormTextarea = FormTextarea;
@@ -1,7 +1,10 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { MyTextarea } from '../../components/MyTextarea/index.js';
3
- import { withController } from '../../hocs/withController.js';
4
-
5
- const FormTextarea = withController(({ field, props }) => /* @__PURE__ */ jsx(MyTextarea, { ...field, ...props }));
6
-
1
+ import { MyTextarea } from "../../components/MyTextarea/index.js";
2
+ import { withController } from "../../hocs/withController.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ //#region src/form/base/FormTextarea.tsx
5
+ var FormTextarea = withController(({ field, props }) => /* @__PURE__ */ jsx(MyTextarea, {
6
+ ...field,
7
+ ...props
8
+ }));
9
+ //#endregion
7
10
  export { FormTextarea };
@@ -1,29 +1,23 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const jsxRuntime = require('react/jsx-runtime');
6
- const index = require('../../components/MyTimeInput/index.cjs');
7
- const withController = require('../../hocs/withController.cjs');
8
-
9
- const FormTimeInput = withController.withController(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
10
- index.MyTimeInput,
11
- {
12
- ...field,
13
- ...props
14
- }
15
- ));
16
- const timeInputToNumber = (timeInput) => {
17
- const [hours, minutes] = timeInput.split(":").map(Number);
18
- const result = hours + minutes / 60;
19
- return Number(result.toFixed(2));
1
+ require("../../../_virtual/_rolldown/runtime.cjs");
2
+ const require_index = require("../../components/MyTimeInput/index.cjs");
3
+ const require_withController = require("../../hocs/withController.cjs");
4
+ let react_jsx_runtime = require("react/jsx-runtime");
5
+ //#region src/form/base/FormTimeInput.tsx
6
+ var FormTimeInput = require_withController.withController(({ field, props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index.MyTimeInput, {
7
+ ...field,
8
+ ...props
9
+ }));
10
+ var timeInputToNumber = (timeInput) => {
11
+ const [hours, minutes] = timeInput.split(":").map(Number);
12
+ const result = hours + minutes / 60;
13
+ return Number(result.toFixed(2));
20
14
  };
21
- const numberToTimeInput = (number) => {
22
- const hours = Math.floor(number);
23
- const minutes = Math.round((number - hours) * 60);
24
- return `${hours.toString().padStart(2, "0")}:${minutes.toString().padStart(2, "0")}`;
15
+ var numberToTimeInput = (number) => {
16
+ const hours = Math.floor(number);
17
+ const minutes = Math.round((number - hours) * 60);
18
+ return `${hours.toString().padStart(2, "0")}:${minutes.toString().padStart(2, "0")}`;
25
19
  };
26
-
20
+ //#endregion
27
21
  exports.FormTimeInput = FormTimeInput;
28
22
  exports.numberToTimeInput = numberToTimeInput;
29
23
  exports.timeInputToNumber = timeInputToNumber;
@@ -1,23 +1,20 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { MyTimeInput } from '../../components/MyTimeInput/index.js';
3
- import { withController } from '../../hocs/withController.js';
4
-
5
- const FormTimeInput = withController(({ field, props }) => /* @__PURE__ */ jsx(
6
- MyTimeInput,
7
- {
8
- ...field,
9
- ...props
10
- }
11
- ));
12
- const timeInputToNumber = (timeInput) => {
13
- const [hours, minutes] = timeInput.split(":").map(Number);
14
- const result = hours + minutes / 60;
15
- return Number(result.toFixed(2));
1
+ import { MyTimeInput } from "../../components/MyTimeInput/index.js";
2
+ import { withController } from "../../hocs/withController.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ //#region src/form/base/FormTimeInput.tsx
5
+ var FormTimeInput = withController(({ field, props }) => /* @__PURE__ */ jsx(MyTimeInput, {
6
+ ...field,
7
+ ...props
8
+ }));
9
+ var timeInputToNumber = (timeInput) => {
10
+ const [hours, minutes] = timeInput.split(":").map(Number);
11
+ const result = hours + minutes / 60;
12
+ return Number(result.toFixed(2));
16
13
  };
17
- const numberToTimeInput = (number) => {
18
- const hours = Math.floor(number);
19
- const minutes = Math.round((number - hours) * 60);
20
- return `${hours.toString().padStart(2, "0")}:${minutes.toString().padStart(2, "0")}`;
14
+ var numberToTimeInput = (number) => {
15
+ const hours = Math.floor(number);
16
+ const minutes = Math.round((number - hours) * 60);
17
+ return `${hours.toString().padStart(2, "0")}:${minutes.toString().padStart(2, "0")}`;
21
18
  };
22
-
19
+ //#endregion
23
20
  export { FormTimeInput, numberToTimeInput, timeInputToNumber };
@@ -1,19 +1,16 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const z = require('zod');
6
-
7
- const nullableButRequired = (schema, message = "Campo requerido") => schema.nullable().transform((val, ctx) => {
8
- if (val === null) {
9
- ctx.addIssue({
10
- code: "custom",
11
- fatal: true,
12
- message
13
- });
14
- return z.z.NEVER;
15
- }
16
- return val;
1
+ require("../../../_virtual/_rolldown/runtime.cjs");
2
+ let zod = require("zod");
3
+ //#region src/form/utils/nullable-but-required.ts
4
+ var nullableButRequired = (schema, message = "Campo requerido") => schema.nullable().transform((val, ctx) => {
5
+ if (val === null) {
6
+ ctx.addIssue({
7
+ code: "custom",
8
+ fatal: true,
9
+ message
10
+ });
11
+ return zod.z.NEVER;
12
+ }
13
+ return val;
17
14
  });
18
-
15
+ //#endregion
19
16
  exports.nullableButRequired = nullableButRequired;
@@ -1,15 +1,15 @@
1
- import { z } from 'zod';
2
-
3
- const nullableButRequired = (schema, message = "Campo requerido") => schema.nullable().transform((val, ctx) => {
4
- if (val === null) {
5
- ctx.addIssue({
6
- code: "custom",
7
- fatal: true,
8
- message
9
- });
10
- return z.NEVER;
11
- }
12
- return val;
1
+ import { z } from "zod";
2
+ //#region src/form/utils/nullable-but-required.ts
3
+ var nullableButRequired = (schema, message = "Campo requerido") => schema.nullable().transform((val, ctx) => {
4
+ if (val === null) {
5
+ ctx.addIssue({
6
+ code: "custom",
7
+ fatal: true,
8
+ message
9
+ });
10
+ return z.NEVER;
11
+ }
12
+ return val;
13
13
  });
14
-
14
+ //#endregion
15
15
  export { nullableButRequired };
@@ -1,19 +1,16 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const z = require('zod');
6
-
7
- const optionalButRequired = (schema, message = "Campo requerido") => schema.optional().transform((val, ctx) => {
8
- if (val === void 0) {
9
- ctx.addIssue({
10
- code: "custom",
11
- fatal: true,
12
- message
13
- });
14
- return z.z.NEVER;
15
- }
16
- return val;
1
+ require("../../../_virtual/_rolldown/runtime.cjs");
2
+ let zod = require("zod");
3
+ //#region src/form/utils/optional-but-required.ts
4
+ var optionalButRequired = (schema, message = "Campo requerido") => schema.optional().transform((val, ctx) => {
5
+ if (val === void 0) {
6
+ ctx.addIssue({
7
+ code: "custom",
8
+ fatal: true,
9
+ message
10
+ });
11
+ return zod.z.NEVER;
12
+ }
13
+ return val;
17
14
  });
18
-
15
+ //#endregion
19
16
  exports.optionalButRequired = optionalButRequired;
@@ -1,15 +1,15 @@
1
- import { z } from 'zod';
2
-
3
- const optionalButRequired = (schema, message = "Campo requerido") => schema.optional().transform((val, ctx) => {
4
- if (val === void 0) {
5
- ctx.addIssue({
6
- code: "custom",
7
- fatal: true,
8
- message
9
- });
10
- return z.NEVER;
11
- }
12
- return val;
1
+ import { z } from "zod";
2
+ //#region src/form/utils/optional-but-required.ts
3
+ var optionalButRequired = (schema, message = "Campo requerido") => schema.optional().transform((val, ctx) => {
4
+ if (val === void 0) {
5
+ ctx.addIssue({
6
+ code: "custom",
7
+ fatal: true,
8
+ message
9
+ });
10
+ return z.NEVER;
11
+ }
12
+ return val;
13
13
  });
14
-
14
+ //#endregion
15
15
  export { optionalButRequired };
@@ -1,15 +1,11 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const zodValidator = (schema) => {
6
- return (values) => {
7
- const result = schema.safeParse(values);
8
- if (result.success) return;
9
- const { error } = result;
10
- const firstError = error.issues[0];
11
- return firstError?.message;
12
- };
1
+ //#region src/form/utils/zodValidator.ts
2
+ var zodValidator = (schema) => {
3
+ return (values) => {
4
+ const result = schema.safeParse(values);
5
+ if (result.success) return;
6
+ const { error } = result;
7
+ return error.issues[0]?.message;
8
+ };
13
9
  };
14
-
10
+ //#endregion
15
11
  exports.zodValidator = zodValidator;
@@ -1,11 +1,11 @@
1
- const zodValidator = (schema) => {
2
- return (values) => {
3
- const result = schema.safeParse(values);
4
- if (result.success) return;
5
- const { error } = result;
6
- const firstError = error.issues[0];
7
- return firstError?.message;
8
- };
1
+ //#region src/form/utils/zodValidator.ts
2
+ var zodValidator = (schema) => {
3
+ return (values) => {
4
+ const result = schema.safeParse(values);
5
+ if (result.success) return;
6
+ const { error } = result;
7
+ return error.issues[0]?.message;
8
+ };
9
9
  };
10
-
10
+ //#endregion
11
11
  export { zodValidator };
@@ -1,56 +1,45 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
-
6
- const jsxRuntime = require('react/jsx-runtime');
7
- const reactHookForm = require('react-hook-form');
8
- const zodValidator = require('../form/utils/zodValidator.cjs');
9
-
10
- const withController = (WrappedComponent, getControllerProps) => {
11
- const FormField = (props) => {
12
- const { validate, name = "", placeholder, label, description, ...withFormRestProps } = props;
13
- return /* @__PURE__ */ jsxRuntime.jsx(
14
- reactHookForm.Controller,
15
- {
16
- name,
17
- defaultValue: "",
18
- rules: {
19
- validate: validate && !props.disabled ? zodValidator.zodValidator(validate) : void 0
20
- },
21
- disabled: props.disabled,
22
- ...getControllerProps?.(props),
23
- render: (renderProps) => {
24
- const {
25
- fieldState: { error }
26
- } = renderProps;
27
- const fieldProps = {
28
- ...renderProps,
29
- props: {
30
- ...props,
31
- validate: void 0,
32
- onValueChange: void 0
33
- },
34
- field: {
35
- ...renderProps.field,
36
- onChange: (...value) => {
37
- renderProps.field.onChange(...value);
38
- props.onValueChange?.(...value);
39
- },
40
- label,
41
- placeholder,
42
- description,
43
- error: error?.message
44
- },
45
- ...withFormRestProps
46
- };
47
- return /* @__PURE__ */ jsxRuntime.jsx(WrappedComponent, { ...fieldProps });
48
- }
49
- }
50
- );
51
- };
52
- FormField.displayName = `WithForm(${WrappedComponent.displayName})`;
53
- return FormField;
1
+ "use client";
2
+ require("../../_virtual/_rolldown/runtime.cjs");
3
+ const require_zodValidator = require("../form/utils/zodValidator.cjs");
4
+ let react_jsx_runtime = require("react/jsx-runtime");
5
+ let react_hook_form = require("react-hook-form");
6
+ //#region src/hocs/withController.tsx
7
+ var withController = (WrappedComponent, getControllerProps) => {
8
+ const FormField = (props) => {
9
+ const { validate, name = "", placeholder, label, description, ...withFormRestProps } = props;
10
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_hook_form.Controller, {
11
+ name,
12
+ defaultValue: "",
13
+ rules: { validate: validate && !props.disabled ? require_zodValidator.zodValidator(validate) : void 0 },
14
+ disabled: props.disabled,
15
+ ...getControllerProps?.(props),
16
+ render: (renderProps) => {
17
+ const { fieldState: { error } } = renderProps;
18
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WrappedComponent, {
19
+ ...renderProps,
20
+ props: {
21
+ ...props,
22
+ validate: void 0,
23
+ onValueChange: void 0
24
+ },
25
+ field: {
26
+ ...renderProps.field,
27
+ onChange: (...value) => {
28
+ renderProps.field.onChange(...value);
29
+ props.onValueChange?.(...value);
30
+ },
31
+ label,
32
+ placeholder,
33
+ description,
34
+ error: error?.message
35
+ },
36
+ ...withFormRestProps
37
+ });
38
+ }
39
+ });
40
+ };
41
+ FormField.displayName = `WithForm(${WrappedComponent.displayName})`;
42
+ return FormField;
54
43
  };
55
-
44
+ //#endregion
56
45
  exports.withController = withController;