lkd-web-kit 0.4.13 → 0.5.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 (42) hide show
  1. package/dist/components/SelectInfinity/index.cjs +1 -1
  2. package/dist/components/SelectInfinity/index.js +1 -1
  3. package/dist/form/base/FormCheckbox.cjs +2 -2
  4. package/dist/form/base/FormCheckbox.js +2 -2
  5. package/dist/form/base/FormDateInput.cjs +2 -2
  6. package/dist/form/base/FormDateInput.js +2 -2
  7. package/dist/form/base/FormDatePickerInput.cjs +2 -2
  8. package/dist/form/base/FormDatePickerInput.js +2 -2
  9. package/dist/form/base/FormDateTimePicker.cjs +2 -2
  10. package/dist/form/base/FormDateTimePicker.js +2 -2
  11. package/dist/form/base/FormMonthPickerInput.cjs +2 -2
  12. package/dist/form/base/FormMonthPickerInput.js +2 -2
  13. package/dist/form/base/FormMultiSelect.cjs +2 -2
  14. package/dist/form/base/FormMultiSelect.js +2 -2
  15. package/dist/form/base/FormNumberInput.cjs +2 -2
  16. package/dist/form/base/FormNumberInput.js +2 -2
  17. package/dist/form/base/FormRadioGroup.cjs +2 -2
  18. package/dist/form/base/FormRadioGroup.js +2 -2
  19. package/dist/form/base/FormSelect.cjs +2 -2
  20. package/dist/form/base/FormSelect.js +2 -2
  21. package/dist/form/base/FormSelectInfinity.cjs +2 -2
  22. package/dist/form/base/FormSelectInfinity.js +2 -2
  23. package/dist/form/base/FormTextInput.cjs +2 -2
  24. package/dist/form/base/FormTextInput.js +2 -2
  25. package/dist/form/base/FormTextarea.cjs +2 -2
  26. package/dist/form/base/FormTextarea.js +2 -2
  27. package/dist/form/base/FormTimeInput.cjs +2 -2
  28. package/dist/form/base/FormTimeInput.js +2 -2
  29. package/dist/hocs/{withForm.cjs → withController.cjs} +2 -2
  30. package/dist/hocs/{withForm.js → withController.js} +2 -2
  31. package/dist/hocs/withModalManager.cjs +9 -10
  32. package/dist/hocs/withModalManager.js +9 -10
  33. package/dist/index.cjs +2 -2
  34. package/dist/index.d.ts +35 -30
  35. package/dist/index.js +1 -1
  36. package/package.json +10 -10
  37. package/dist/dist/components/InfinityLoader/index.cjs +0 -46
  38. package/dist/dist/components/InfinityLoader/index.js +0 -42
  39. package/dist/dist/form/utils/zodValidator.cjs +0 -15
  40. package/dist/dist/form/utils/zodValidator.js +0 -11
  41. package/dist/dist/hocs/withForm.cjs +0 -51
  42. package/dist/dist/hocs/withForm.js +0 -47
@@ -9,7 +9,7 @@ const core = require('@mantine/core');
9
9
  const hooks = require('@mantine/hooks');
10
10
  const index = require('../../node_modules/@tanstack/react-virtual/dist/esm/index.cjs');
11
11
  const virtualStyles = require('../../utils/virtual-styles.cjs');
12
- const index$1 = require('../../dist/components/InfinityLoader/index.cjs');
12
+ const index$1 = require('../InfinityLoader/index.cjs');
13
13
 
14
14
  function InfinitySelect({
15
15
  value,
@@ -5,7 +5,7 @@ import { useCombobox, Combobox, InputBase, Input } from '@mantine/core';
5
5
  import { useUncontrolled } from '@mantine/hooks';
6
6
  import { useVirtualizer } from '../../node_modules/@tanstack/react-virtual/dist/esm/index.js';
7
7
  import { getVirtualContainerProps, getVirtualItemProps } from '../../utils/virtual-styles.js';
8
- import { InfinityLoader } from '../../dist/components/InfinityLoader/index.js';
8
+ import { InfinityLoader } from '../InfinityLoader/index.js';
9
9
 
10
10
  function InfinitySelect({
11
11
  value,
@@ -4,9 +4,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const jsxRuntime = require('react/jsx-runtime');
6
6
  const core = require('@mantine/core');
7
- const withForm = require('../../hocs/withForm.cjs');
7
+ const withController = require('../../hocs/withController.cjs');
8
8
 
9
- const FormCheckbox = withForm.withForm(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
9
+ const FormCheckbox = withController.withController(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
10
10
  core.Checkbox,
11
11
  {
12
12
  ...field,
@@ -1,8 +1,8 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { Checkbox } from '@mantine/core';
3
- import { withForm } from '../../hocs/withForm.js';
3
+ import { withController } from '../../hocs/withController.js';
4
4
 
5
- const FormCheckbox = withForm(({ field, props }) => /* @__PURE__ */ jsx(
5
+ const FormCheckbox = withController(({ field, props }) => /* @__PURE__ */ jsx(
6
6
  Checkbox,
7
7
  {
8
8
  ...field,
@@ -4,9 +4,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const jsxRuntime = require('react/jsx-runtime');
6
6
  const index = require('../../components/MyDateInput/index.cjs');
7
- const withForm = require('../../hocs/withForm.cjs');
7
+ const withController = require('../../hocs/withController.cjs');
8
8
 
9
- const FormDateInput = withForm.withForm(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
9
+ const FormDateInput = withController.withController(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
10
10
  index.MyDateInput,
11
11
  {
12
12
  ...field,
@@ -1,8 +1,8 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { MyDateInput } from '../../components/MyDateInput/index.js';
3
- import { withForm } from '../../hocs/withForm.js';
3
+ import { withController } from '../../hocs/withController.js';
4
4
 
5
- const FormDateInput = withForm(({ field, props }) => /* @__PURE__ */ jsx(
5
+ const FormDateInput = withController(({ field, props }) => /* @__PURE__ */ jsx(
6
6
  MyDateInput,
7
7
  {
8
8
  ...field,
@@ -4,9 +4,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const jsxRuntime = require('react/jsx-runtime');
6
6
  const index = require('../../components/MyDatePickerInput/index.cjs');
7
- const withForm = require('../../hocs/withForm.cjs');
7
+ const withController = require('../../hocs/withController.cjs');
8
8
 
9
- const FormDatePickerInput = withForm.withForm(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
9
+ const FormDatePickerInput = withController.withController(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
10
10
  index.MyDatePickerInput,
11
11
  {
12
12
  ...field,
@@ -1,8 +1,8 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { MyDatePickerInput } from '../../components/MyDatePickerInput/index.js';
3
- import { withForm } from '../../hocs/withForm.js';
3
+ import { withController } from '../../hocs/withController.js';
4
4
 
5
- const FormDatePickerInput = withForm(({ field, props }) => /* @__PURE__ */ jsx(
5
+ const FormDatePickerInput = withController(({ field, props }) => /* @__PURE__ */ jsx(
6
6
  MyDatePickerInput,
7
7
  {
8
8
  ...field,
@@ -4,9 +4,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const jsxRuntime = require('react/jsx-runtime');
6
6
  const index = require('../../components/MyDateTimePicker/index.cjs');
7
- const withForm = require('../../hocs/withForm.cjs');
7
+ const withController = require('../../hocs/withController.cjs');
8
8
 
9
- const FormDateTimePicker = withForm.withForm(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
9
+ const FormDateTimePicker = withController.withController(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
10
10
  index.MyDateTimePicker,
11
11
  {
12
12
  ...field,
@@ -1,8 +1,8 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { MyDateTimePicker } from '../../components/MyDateTimePicker/index.js';
3
- import { withForm } from '../../hocs/withForm.js';
3
+ import { withController } from '../../hocs/withController.js';
4
4
 
5
- const FormDateTimePicker = withForm(({ field, props }) => /* @__PURE__ */ jsx(
5
+ const FormDateTimePicker = withController(({ field, props }) => /* @__PURE__ */ jsx(
6
6
  MyDateTimePicker,
7
7
  {
8
8
  ...field,
@@ -4,9 +4,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const jsxRuntime = require('react/jsx-runtime');
6
6
  const index = require('../../components/MyMonthPickerInput/index.cjs');
7
- const withForm = require('../../hocs/withForm.cjs');
7
+ const withController = require('../../hocs/withController.cjs');
8
8
 
9
- const FormMonthPickerInput = withForm.withForm(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
9
+ const FormMonthPickerInput = withController.withController(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
10
10
  index.MyMonthPickerInput,
11
11
  {
12
12
  ...field,
@@ -1,8 +1,8 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { MyMonthPickerInput } from '../../components/MyMonthPickerInput/index.js';
3
- import { withForm } from '../../hocs/withForm.js';
3
+ import { withController } from '../../hocs/withController.js';
4
4
 
5
- const FormMonthPickerInput = withForm(({ field, props }) => /* @__PURE__ */ jsx(
5
+ const FormMonthPickerInput = withController(({ field, props }) => /* @__PURE__ */ jsx(
6
6
  MyMonthPickerInput,
7
7
  {
8
8
  ...field,
@@ -4,9 +4,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const jsxRuntime = require('react/jsx-runtime');
6
6
  const index = require('../../components/MyMultiSelect/index.cjs');
7
- const withForm = require('../../hocs/withForm.cjs');
7
+ const withController = require('../../hocs/withController.cjs');
8
8
 
9
- const FormMultiSelect = withForm.withForm(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
9
+ const FormMultiSelect = withController.withController(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
10
10
  index.MyMultiSelect,
11
11
  {
12
12
  ...field,
@@ -1,8 +1,8 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { MyMultiSelect } from '../../components/MyMultiSelect/index.js';
3
- import { withForm } from '../../hocs/withForm.js';
3
+ import { withController } from '../../hocs/withController.js';
4
4
 
5
- const FormMultiSelect = withForm(({ field, props }) => /* @__PURE__ */ jsx(
5
+ const FormMultiSelect = withController(({ field, props }) => /* @__PURE__ */ jsx(
6
6
  MyMultiSelect,
7
7
  {
8
8
  ...field,
@@ -4,9 +4,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const jsxRuntime = require('react/jsx-runtime');
6
6
  const index = require('../../components/MyNumberInput/index.cjs');
7
- const withForm = require('../../hocs/withForm.cjs');
7
+ const withController = require('../../hocs/withController.cjs');
8
8
 
9
- const FormNumberInput = withForm.withForm(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
9
+ const FormNumberInput = withController.withController(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
10
10
  index.MyNumberInput,
11
11
  {
12
12
  ...field,
@@ -1,8 +1,8 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { MyNumberInput } from '../../components/MyNumberInput/index.js';
3
- import { withForm } from '../../hocs/withForm.js';
3
+ import { withController } from '../../hocs/withController.js';
4
4
 
5
- const FormNumberInput = withForm(({ field, props }) => /* @__PURE__ */ jsx(
5
+ const FormNumberInput = withController(({ field, props }) => /* @__PURE__ */ jsx(
6
6
  MyNumberInput,
7
7
  {
8
8
  ...field,
@@ -4,9 +4,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const jsxRuntime = require('react/jsx-runtime');
6
6
  const core = require('@mantine/core');
7
- const withForm = require('../../hocs/withForm.cjs');
7
+ const withController = require('../../hocs/withController.cjs');
8
8
 
9
- const FormRadioGroup = withForm.withForm(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
9
+ const FormRadioGroup = withController.withController(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
10
10
  core.Radio.Group,
11
11
  {
12
12
  ...field,
@@ -1,8 +1,8 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { Radio } from '@mantine/core';
3
- import { withForm } from '../../hocs/withForm.js';
3
+ import { withController } from '../../hocs/withController.js';
4
4
 
5
- const FormRadioGroup = withForm(({ field, props }) => /* @__PURE__ */ jsx(
5
+ const FormRadioGroup = withController(({ field, props }) => /* @__PURE__ */ jsx(
6
6
  Radio.Group,
7
7
  {
8
8
  ...field,
@@ -4,9 +4,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const jsxRuntime = require('react/jsx-runtime');
6
6
  const index = require('../../components/MySelect/index.cjs');
7
- const withForm = require('../../hocs/withForm.cjs');
7
+ const withController = require('../../hocs/withController.cjs');
8
8
 
9
- const FormSelect = withForm.withForm(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
9
+ const FormSelect = withController.withController(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
10
10
  index.MySelect,
11
11
  {
12
12
  ...field,
@@ -1,8 +1,8 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { MySelect } from '../../components/MySelect/index.js';
3
- import { withForm } from '../../hocs/withForm.js';
3
+ import { withController } from '../../hocs/withController.js';
4
4
 
5
- const FormSelect = withForm(({ field, props }) => /* @__PURE__ */ jsx(
5
+ const FormSelect = withController(({ field, props }) => /* @__PURE__ */ jsx(
6
6
  MySelect,
7
7
  {
8
8
  ...field,
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const jsxRuntime = require('react/jsx-runtime');
6
- const withForm = require('../../dist/hocs/withForm.cjs');
7
6
  const index = require('../../components/SelectInfinity/index.cjs');
7
+ const withController = require('../../hocs/withController.cjs');
8
8
 
9
- const FormInfinitySelect = withForm.withForm(({ field, props }) => {
9
+ const FormInfinitySelect = withController.withController(({ field, props }) => {
10
10
  return /* @__PURE__ */ jsxRuntime.jsx(
11
11
  index.InfinitySelect,
12
12
  {
@@ -1,8 +1,8 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { withForm } from '../../dist/hocs/withForm.js';
3
2
  import { InfinitySelect } from '../../components/SelectInfinity/index.js';
3
+ import { withController } from '../../hocs/withController.js';
4
4
 
5
- const FormInfinitySelect = withForm(({ field, props }) => {
5
+ const FormInfinitySelect = withController(({ field, props }) => {
6
6
  return /* @__PURE__ */ jsx(
7
7
  InfinitySelect,
8
8
  {
@@ -4,9 +4,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const jsxRuntime = require('react/jsx-runtime');
6
6
  const index = require('../../components/MyTextInput/index.cjs');
7
- const withForm = require('../../hocs/withForm.cjs');
7
+ const withController = require('../../hocs/withController.cjs');
8
8
 
9
- const FormTextInput = withForm.withForm(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
9
+ const FormTextInput = withController.withController(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
10
10
  index.MyTextInput,
11
11
  {
12
12
  ...field,
@@ -1,8 +1,8 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { MyTextInput } from '../../components/MyTextInput/index.js';
3
- import { withForm } from '../../hocs/withForm.js';
3
+ import { withController } from '../../hocs/withController.js';
4
4
 
5
- const FormTextInput = withForm(({ field, props }) => /* @__PURE__ */ jsx(
5
+ const FormTextInput = withController(({ field, props }) => /* @__PURE__ */ jsx(
6
6
  MyTextInput,
7
7
  {
8
8
  ...field,
@@ -4,9 +4,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const jsxRuntime = require('react/jsx-runtime');
6
6
  const index = require('../../components/MyTextarea/index.cjs');
7
- const withForm = require('../../hocs/withForm.cjs');
7
+ const withController = require('../../hocs/withController.cjs');
8
8
 
9
- const FormTextarea = withForm.withForm(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
9
+ const FormTextarea = withController.withController(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
10
10
  index.MyTextarea,
11
11
  {
12
12
  ...field,
@@ -1,8 +1,8 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { MyTextarea } from '../../components/MyTextarea/index.js';
3
- import { withForm } from '../../hocs/withForm.js';
3
+ import { withController } from '../../hocs/withController.js';
4
4
 
5
- const FormTextarea = withForm(({ field, props }) => /* @__PURE__ */ jsx(
5
+ const FormTextarea = withController(({ field, props }) => /* @__PURE__ */ jsx(
6
6
  MyTextarea,
7
7
  {
8
8
  ...field,
@@ -4,9 +4,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const jsxRuntime = require('react/jsx-runtime');
6
6
  const index = require('../../components/MyTimeInput/index.cjs');
7
- const withForm = require('../../hocs/withForm.cjs');
7
+ const withController = require('../../hocs/withController.cjs');
8
8
 
9
- const FormTimeInput = withForm.withForm(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
9
+ const FormTimeInput = withController.withController(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
10
10
  index.MyTimeInput,
11
11
  {
12
12
  ...field,
@@ -1,8 +1,8 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { MyTimeInput } from '../../components/MyTimeInput/index.js';
3
- import { withForm } from '../../hocs/withForm.js';
3
+ import { withController } from '../../hocs/withController.js';
4
4
 
5
- const FormTimeInput = withForm(({ field, props }) => /* @__PURE__ */ jsx(
5
+ const FormTimeInput = withController(({ field, props }) => /* @__PURE__ */ jsx(
6
6
  MyTimeInput,
7
7
  {
8
8
  ...field,
@@ -7,7 +7,7 @@ const jsxRuntime = require('react/jsx-runtime');
7
7
  const reactHookForm = require('react-hook-form');
8
8
  const zodValidator = require('../form/utils/zodValidator.cjs');
9
9
 
10
- const withForm = (WrappedComponent, getControllerProps) => {
10
+ const withController = (WrappedComponent, getControllerProps) => {
11
11
  const FormField = (props) => {
12
12
  const { validate, name = "", placeholder, label, description, ...withFormRestProps } = props;
13
13
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -48,4 +48,4 @@ const withForm = (WrappedComponent, getControllerProps) => {
48
48
  return FormField;
49
49
  };
50
50
 
51
- exports.withForm = withForm;
51
+ exports.withController = withController;
@@ -3,7 +3,7 @@ import { jsx } from 'react/jsx-runtime';
3
3
  import { Controller } from 'react-hook-form';
4
4
  import { zodValidator } from '../form/utils/zodValidator.js';
5
5
 
6
- const withForm = (WrappedComponent, getControllerProps) => {
6
+ const withController = (WrappedComponent, getControllerProps) => {
7
7
  const FormField = (props) => {
8
8
  const { validate, name = "", placeholder, label, description, ...withFormRestProps } = props;
9
9
  return /* @__PURE__ */ jsx(
@@ -44,4 +44,4 @@ const withForm = (WrappedComponent, getControllerProps) => {
44
44
  return FormField;
45
45
  };
46
46
 
47
- export { withForm };
47
+ export { withController };
@@ -7,27 +7,26 @@ const jsxRuntime = require('react/jsx-runtime');
7
7
  const React = require('react');
8
8
 
9
9
  const withModalManager = (WrappedComponent) => {
10
- const Component = ({
11
- removeModal,
12
- opened,
13
- ...props
14
- }) => {
10
+ const Component = ({ removeModal, ...props }) => {
15
11
  const [isOpen, setIsOpen] = React.useState(false);
16
12
  const onClose = () => {
17
13
  setIsOpen(false);
18
14
  setTimeout(() => removeModal(), 200);
19
- props.onClose?.();
15
+ props.modalProps.onClose();
20
16
  };
21
17
  React.useEffect(() => {
22
- if (opened) setTimeout(() => setIsOpen(true), 0);
18
+ if (props.modalProps.opened) setTimeout(() => setIsOpen(true), 0);
23
19
  else onClose();
24
- }, [opened]);
20
+ }, [props.modalProps.opened]);
25
21
  return /* @__PURE__ */ jsxRuntime.jsx(
26
22
  WrappedComponent,
27
23
  {
28
24
  ...props,
29
- opened: isOpen,
30
- onClose
25
+ modalProps: {
26
+ ...props.modalProps,
27
+ opened: isOpen,
28
+ onClose
29
+ }
31
30
  }
32
31
  );
33
32
  };
@@ -3,27 +3,26 @@ import { jsx } from 'react/jsx-runtime';
3
3
  import { useState, useEffect } from 'react';
4
4
 
5
5
  const withModalManager = (WrappedComponent) => {
6
- const Component = ({
7
- removeModal,
8
- opened,
9
- ...props
10
- }) => {
6
+ const Component = ({ removeModal, ...props }) => {
11
7
  const [isOpen, setIsOpen] = useState(false);
12
8
  const onClose = () => {
13
9
  setIsOpen(false);
14
10
  setTimeout(() => removeModal(), 200);
15
- props.onClose?.();
11
+ props.modalProps.onClose();
16
12
  };
17
13
  useEffect(() => {
18
- if (opened) setTimeout(() => setIsOpen(true), 0);
14
+ if (props.modalProps.opened) setTimeout(() => setIsOpen(true), 0);
19
15
  else onClose();
20
- }, [opened]);
16
+ }, [props.modalProps.opened]);
21
17
  return /* @__PURE__ */ jsx(
22
18
  WrappedComponent,
23
19
  {
24
20
  ...props,
25
- opened: isOpen,
26
- onClose
21
+ modalProps: {
22
+ ...props.modalProps,
23
+ opened: isOpen,
24
+ onClose
25
+ }
27
26
  }
28
27
  );
29
28
  };
package/dist/index.cjs CHANGED
@@ -40,7 +40,7 @@ const FormTimeInput = require('./form/base/FormTimeInput.cjs');
40
40
  const FormMultiSelect = require('./form/base/FormMultiSelect.cjs');
41
41
  const FormMonthPickerInput = require('./form/base/FormMonthPickerInput.cjs');
42
42
  const FormDateInput = require('./form/base/FormDateInput.cjs');
43
- const withForm = require('./hocs/withForm.cjs');
43
+ const withController = require('./hocs/withController.cjs');
44
44
  const withModalManager = require('./hocs/withModalManager.cjs');
45
45
  const useBreakpoint = require('./hooks/useBreakpoint.cjs');
46
46
  const useFetchNextPageOnScroll = require('./hooks/useFetchNextPageOnScroll.cjs');
@@ -105,7 +105,7 @@ exports.timeInputToNumber = FormTimeInput.timeInputToNumber;
105
105
  exports.FormMultiSelect = FormMultiSelect.FormMultiSelect;
106
106
  exports.FormMonthPickerInput = FormMonthPickerInput.FormMonthPickerInput;
107
107
  exports.FormDateInput = FormDateInput.FormDateInput;
108
- exports.withForm = withForm.withForm;
108
+ exports.withController = withController.withController;
109
109
  exports.withModalManager = withModalManager.withModalManager;
110
110
  exports.useBreakpoint = useBreakpoint.useBreakpoint;
111
111
  exports.useFetchNextPageOnScroll = useFetchNextPageOnScroll.useFetchNextPageOnScroll;
package/dist/index.d.ts CHANGED
@@ -113,21 +113,21 @@ export declare interface FormButtonSubmitProps extends ButtonProps, ElementProps
113
113
  disabledWhenSuccess?: boolean;
114
114
  }
115
115
 
116
- export declare const FormCheckbox: FC<CheckboxProps & WithFormProps>;
116
+ export declare const FormCheckbox: FC<CheckboxProps & WithControllerProps>;
117
117
 
118
- export declare type FormCheckboxProps = CheckboxProps & WithFormProps;
118
+ export declare type FormCheckboxProps = CheckboxProps & WithControllerProps;
119
119
 
120
- export declare const FormDateInput: FC<WithFormProps & MyDateInputProps>;
120
+ export declare const FormDateInput: FC<WithControllerProps & MyDateInputProps>;
121
121
 
122
- export declare type FormDateInputProps = WithFormProps & MyDateInputProps;
122
+ export declare type FormDateInputProps = WithControllerProps & MyDateInputProps;
123
123
 
124
- export declare const FormDatePickerInput: FC<WithFormProps & MyDatePickerInputProps>;
124
+ export declare const FormDatePickerInput: FC<WithControllerProps & MyDatePickerInputProps>;
125
125
 
126
- export declare type FormDatePickerInputProps = WithFormProps & MyDatePickerInputProps;
126
+ export declare type FormDatePickerInputProps = WithControllerProps & MyDatePickerInputProps;
127
127
 
128
- export declare const FormDateTimePicker: FC<DateTimePickerProps & WithFormProps>;
128
+ export declare const FormDateTimePicker: FC<DateTimePickerProps & WithControllerProps>;
129
129
 
130
- export declare type FormDateTimePickerProps = WithFormProps & MyDateTimePickerProps;
130
+ export declare type FormDateTimePickerProps = WithControllerProps & MyDateTimePickerProps;
131
131
 
132
132
  export declare type FormFieldProps<T = unknown> = Parameters<ControllerProps['render']>[0] & {
133
133
  props: T;
@@ -141,19 +141,19 @@ export declare type FormFieldProps<T = unknown> = Parameters<ControllerProps['re
141
141
 
142
142
  export declare const FormInfinitySelect: <T>(props: FormInfinitySelectProps<T>) => ReactNode;
143
143
 
144
- export declare type FormInfinitySelectProps<T = unknown> = InfinitySelectProps<T> & WithFormProps;
144
+ export declare type FormInfinitySelectProps<T = unknown> = InfinitySelectProps<T> & WithControllerProps;
145
145
 
146
- export declare const FormMonthPickerInput: FC<MyMonthPickerInputProps & WithFormProps>;
146
+ export declare const FormMonthPickerInput: FC<MyMonthPickerInputProps & WithControllerProps>;
147
147
 
148
- export declare type FormMonthPickerInputProps = WithFormProps & MyMonthPickerInputProps;
148
+ export declare type FormMonthPickerInputProps = WithControllerProps & MyMonthPickerInputProps;
149
149
 
150
- export declare const FormMultiSelect: FC<MyMultiSelectProps & WithFormProps>;
150
+ export declare const FormMultiSelect: FC<MyMultiSelectProps & WithControllerProps>;
151
151
 
152
- export declare type FormMultiSelectProps = MyMultiSelectProps & WithFormProps;
152
+ export declare type FormMultiSelectProps = MyMultiSelectProps & WithControllerProps;
153
153
 
154
- export declare const FormNumberInput: FC<MyNumberInputProps & WithFormProps>;
154
+ export declare const FormNumberInput: FC<MyNumberInputProps & WithControllerProps>;
155
155
 
156
- export declare type FormNumberInputProps = MyNumberInputProps & WithFormProps;
156
+ export declare type FormNumberInputProps = MyNumberInputProps & WithControllerProps;
157
157
 
158
158
  declare interface FormProps<T extends FieldValues, TContext = any, TT extends T = T> extends BoxProps, ElementProps<'form', 'onSubmit'> {
159
159
  methods: UseFormReturn<T, TContext, TT>;
@@ -161,25 +161,25 @@ declare interface FormProps<T extends FieldValues, TContext = any, TT extends T
161
161
  onSubmitError?: SubmitErrorHandler<T>;
162
162
  }
163
163
 
164
- export declare const FormRadioGroup: FC<RadioGroupProps & WithFormProps>;
164
+ export declare const FormRadioGroup: FC<RadioGroupProps & WithControllerProps>;
165
165
 
166
- export declare type FormRadioGroupProps = RadioGroupProps & WithFormProps;
166
+ export declare type FormRadioGroupProps = RadioGroupProps & WithControllerProps;
167
167
 
168
- export declare const FormSelect: FC<MySelectProps & WithFormProps>;
168
+ export declare const FormSelect: FC<MySelectProps & WithControllerProps>;
169
169
 
170
- export declare type FormSelectProps = MySelectProps & WithFormProps;
170
+ export declare type FormSelectProps = MySelectProps & WithControllerProps;
171
171
 
172
- export declare const FormTextarea: FC<TextareaProps & WithFormProps>;
172
+ export declare const FormTextarea: FC<TextareaProps & WithControllerProps>;
173
173
 
174
- export declare type FormTextareaProps = MyTextareaProps & WithFormProps;
174
+ export declare type FormTextareaProps = MyTextareaProps & WithControllerProps;
175
175
 
176
- export declare const FormTextInput: FC<WithFormProps & MyTextInputProps>;
176
+ export declare const FormTextInput: FC<WithControllerProps & MyTextInputProps>;
177
177
 
178
- export declare type FormTextInputProps = WithFormProps & MyTextInputProps;
178
+ export declare type FormTextInputProps = WithControllerProps & MyTextInputProps;
179
179
 
180
- export declare type FormTimeInput = MyTimeInputProps & WithFormProps;
180
+ export declare type FormTimeInput = MyTimeInputProps & WithControllerProps;
181
181
 
182
- export declare const FormTimeInput: FC<TimeInputProps & WithFormProps>;
182
+ export declare const FormTimeInput: FC<TimeInputProps & WithControllerProps>;
183
183
 
184
184
  export declare const getVirtualContainerProps: (virtualizer: {
185
185
  getTotalSize: () => number;
@@ -339,6 +339,10 @@ export declare interface LayoutProps {
339
339
  params: Promise<PageParams>;
340
340
  }
341
341
 
342
+ export declare type ModalManagerWrappedComponentProps<T = any> = T & {
343
+ modalProps: ModalProps;
344
+ };
345
+
342
346
  export declare const MyDateInput: (props: MyDateInputProps) => JSX.Element;
343
347
 
344
348
  export declare interface MyDateInputProps extends DateInputProps {
@@ -556,9 +560,9 @@ export declare const useUpdateSearchParams: () => {
556
560
 
557
561
  export declare const useZodConfig: () => void;
558
562
 
559
- export declare const withForm: <P extends unknown>(WrappedComponent: React.ComponentType<FormFieldProps<P>>, getControllerProps?: (fieldProps: P) => Omit<Partial<ControllerProps>, "render">) => FC<P & WithFormProps>;
563
+ export declare const withController: <P extends unknown>(WrappedComponent: React.ComponentType<FormFieldProps<P>>, getControllerProps?: (fieldProps: P) => Omit<Partial<ControllerProps>, "render">) => FC<P & WithControllerProps>;
560
564
 
561
- export declare interface WithFormProps {
565
+ export declare interface WithControllerProps {
562
566
  name?: string;
563
567
  label?: ReactNode;
564
568
  placeholder?: string;
@@ -567,11 +571,12 @@ export declare interface WithFormProps {
567
571
  disabled?: boolean;
568
572
  }
569
573
 
570
- export declare const withModalManager: <P extends Object>(WrappedComponent: React.ComponentType<P & ModalProps>) => FC<P & WithModalManagerProps & ModalProps>;
574
+ export declare const withModalManager: <CustomProps extends Object>(WrappedComponent: React.ComponentType<ModalManagerWrappedComponentProps<CustomProps>>) => FC<CustomProps & {
575
+ modalProps: ModalProps;
576
+ } & WithModalManagerProps>;
571
577
 
572
- export declare interface WithModalManagerProps {
578
+ declare interface WithModalManagerProps {
573
579
  removeModal: () => void;
574
- opened: boolean;
575
580
  }
576
581
 
577
582
  export declare const zodValidator: (schema: ZodType) => (values: any) => string | undefined;
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ export { FormTimeInput, numberToTimeInput, timeInputToNumber } from './form/base
36
36
  export { FormMultiSelect } from './form/base/FormMultiSelect.js';
37
37
  export { FormMonthPickerInput } from './form/base/FormMonthPickerInput.js';
38
38
  export { FormDateInput } from './form/base/FormDateInput.js';
39
- export { withForm } from './hocs/withForm.js';
39
+ export { withController } from './hocs/withController.js';
40
40
  export { withModalManager } from './hocs/withModalManager.js';
41
41
  export { useBreakpoint } from './hooks/useBreakpoint.js';
42
42
  export { useFetchNextPageOnScroll } from './hooks/useFetchNextPageOnScroll.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkd-web-kit",
3
- "version": "0.4.13",
3
+ "version": "0.5.1",
4
4
  "description": "A template for creating React component libraries with Vite.",
5
5
  "author": "LKD",
6
6
  "license": "MIT",
@@ -53,19 +53,19 @@
53
53
  "vitest": "^3.2.4"
54
54
  },
55
55
  "peerDependencies": {
56
- "@mantine/core": "^8.2.1",
57
- "@mantine/dates": "^8.2.1",
58
- "@mantine/hooks": "^8.2.1",
59
- "@mantine/notifications": "^8.2.1",
56
+ "@mantine/core": "^8.2.2",
57
+ "@mantine/dates": "^8.2.2",
58
+ "@mantine/hooks": "^8.2.2",
59
+ "@mantine/notifications": "^8.2.2",
60
60
  "@tanstack/react-query": "^5.83.0",
61
61
  "clsx": "^2.1.1",
62
62
  "ky": "^1.8.2",
63
- "next": "^15.4.2",
64
- "react": "^19.1.0",
65
- "react-dom": "^19.1.0",
66
- "react-hook-form": "^7.60.0",
63
+ "next": "^15.4.5",
64
+ "react": "^19.1.1",
65
+ "react-dom": "^19.1.1",
66
+ "react-hook-form": "^7.61.1",
67
67
  "react-query-kit": "^3.3.1",
68
- "zod": "^4.0.5"
68
+ "zod": "^4.0.14"
69
69
  },
70
70
  "dependencies": {
71
71
  "@tanstack/react-virtual": "^3.13.12"
@@ -1,46 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const jsxRuntime = require('react/jsx-runtime');
6
- const core = require('@mantine/core');
7
- const hooks = require('@mantine/hooks');
8
- const React = require('react');
9
-
10
- const InfinityLoader = ({
11
- root,
12
- infinity,
13
- rootMargin = "0px 0px 0px 0px",
14
- endMessage = "No hay más resultados",
15
- loaderProps,
16
- ...props
17
- }) => {
18
- const { entry, ref } = hooks.useIntersection({
19
- root: root?.current,
20
- rootMargin
21
- });
22
- React.useEffect(() => {
23
- if (entry?.isIntersecting && infinity.hasNextPage) infinity.fetchNextPage();
24
- }, [entry?.isIntersecting]);
25
- React.useEffect(() => {
26
- if (!entry?.isIntersecting) return;
27
- const el = root?.current ?? document.documentElement;
28
- const hasScroll = el?.scrollHeight > el?.clientHeight;
29
- if (!hasScroll) infinity.fetchNextPage();
30
- }, [entry?.isIntersecting, infinity.data?.pages.length]);
31
- return /* @__PURE__ */ jsxRuntime.jsx(
32
- core.Center,
33
- {
34
- ref,
35
- ...props,
36
- style: {
37
- minHeight: "1rem",
38
- fontSize: "14px",
39
- ...props.style
40
- },
41
- children: infinity.isLoading || infinity.isFetchingNextPage ? /* @__PURE__ */ jsxRuntime.jsx(core.Loader, { ...loaderProps }) : infinity.data && infinity.data.pages.length > 1 && !infinity.hasNextPage ? endMessage : null
42
- }
43
- );
44
- };
45
-
46
- exports.InfinityLoader = InfinityLoader;
@@ -1,42 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { Center, Loader } from '@mantine/core';
3
- import { useIntersection } from '@mantine/hooks';
4
- import { useEffect } from 'react';
5
-
6
- const InfinityLoader = ({
7
- root,
8
- infinity,
9
- rootMargin = "0px 0px 0px 0px",
10
- endMessage = "No hay más resultados",
11
- loaderProps,
12
- ...props
13
- }) => {
14
- const { entry, ref } = useIntersection({
15
- root: root?.current,
16
- rootMargin
17
- });
18
- useEffect(() => {
19
- if (entry?.isIntersecting && infinity.hasNextPage) infinity.fetchNextPage();
20
- }, [entry?.isIntersecting]);
21
- useEffect(() => {
22
- if (!entry?.isIntersecting) return;
23
- const el = root?.current ?? document.documentElement;
24
- const hasScroll = el?.scrollHeight > el?.clientHeight;
25
- if (!hasScroll) infinity.fetchNextPage();
26
- }, [entry?.isIntersecting, infinity.data?.pages.length]);
27
- return /* @__PURE__ */ jsx(
28
- Center,
29
- {
30
- ref,
31
- ...props,
32
- style: {
33
- minHeight: "1rem",
34
- fontSize: "14px",
35
- ...props.style
36
- },
37
- children: infinity.isLoading || infinity.isFetchingNextPage ? /* @__PURE__ */ jsx(Loader, { ...loaderProps }) : infinity.data && infinity.data.pages.length > 1 && !infinity.hasNextPage ? endMessage : null
38
- }
39
- );
40
- };
41
-
42
- export { InfinityLoader };
@@ -1,15 +0,0 @@
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
- };
13
- };
14
-
15
- exports.zodValidator = zodValidator;
@@ -1,11 +0,0 @@
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
- };
9
- };
10
-
11
- export { zodValidator };
@@ -1,51 +0,0 @@
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 withForm = (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
- },
33
- field: {
34
- ...renderProps.field,
35
- label,
36
- placeholder,
37
- description,
38
- error: error?.message
39
- },
40
- ...withFormRestProps
41
- };
42
- return /* @__PURE__ */ jsxRuntime.jsx(WrappedComponent, { ...fieldProps });
43
- }
44
- }
45
- );
46
- };
47
- FormField.displayName = `WithForm(${WrappedComponent.displayName})`;
48
- return FormField;
49
- };
50
-
51
- exports.withForm = withForm;
@@ -1,47 +0,0 @@
1
- 'use client';
2
- import { jsx } from 'react/jsx-runtime';
3
- import { Controller } from 'react-hook-form';
4
- import { zodValidator } from '../form/utils/zodValidator.js';
5
-
6
- const withForm = (WrappedComponent, getControllerProps) => {
7
- const FormField = (props) => {
8
- const { validate, name = "", placeholder, label, description, ...withFormRestProps } = props;
9
- return /* @__PURE__ */ jsx(
10
- Controller,
11
- {
12
- name,
13
- defaultValue: "",
14
- rules: {
15
- validate: validate && !props.disabled ? zodValidator(validate) : void 0
16
- },
17
- disabled: props.disabled,
18
- ...getControllerProps?.(props),
19
- render: (renderProps) => {
20
- const {
21
- fieldState: { error }
22
- } = renderProps;
23
- const fieldProps = {
24
- ...renderProps,
25
- props: {
26
- ...props,
27
- validate: void 0
28
- },
29
- field: {
30
- ...renderProps.field,
31
- label,
32
- placeholder,
33
- description,
34
- error: error?.message
35
- },
36
- ...withFormRestProps
37
- };
38
- return /* @__PURE__ */ jsx(WrappedComponent, { ...fieldProps });
39
- }
40
- }
41
- );
42
- };
43
- FormField.displayName = `WithForm(${WrappedComponent.displayName})`;
44
- return FormField;
45
- };
46
-
47
- export { withForm };