lkd-web-kit 0.4.13 → 0.5.0

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 +1 -1
  4. package/dist/form/base/FormCheckbox.js +2 -2
  5. package/dist/form/base/FormDateInput.cjs +1 -1
  6. package/dist/form/base/FormDateInput.js +2 -2
  7. package/dist/form/base/FormDatePickerInput.cjs +1 -1
  8. package/dist/form/base/FormDatePickerInput.js +2 -2
  9. package/dist/form/base/FormDateTimePicker.cjs +1 -1
  10. package/dist/form/base/FormDateTimePicker.js +2 -2
  11. package/dist/form/base/FormMonthPickerInput.cjs +1 -1
  12. package/dist/form/base/FormMonthPickerInput.js +2 -2
  13. package/dist/form/base/FormMultiSelect.cjs +1 -1
  14. package/dist/form/base/FormMultiSelect.js +2 -2
  15. package/dist/form/base/FormNumberInput.cjs +1 -1
  16. package/dist/form/base/FormNumberInput.js +2 -2
  17. package/dist/form/base/FormRadioGroup.cjs +1 -1
  18. package/dist/form/base/FormRadioGroup.js +2 -2
  19. package/dist/form/base/FormSelect.cjs +1 -1
  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 +1 -1
  24. package/dist/form/base/FormTextInput.js +2 -2
  25. package/dist/form/base/FormTextarea.cjs +1 -1
  26. package/dist/form/base/FormTextarea.js +2 -2
  27. package/dist/form/base/FormTimeInput.cjs +1 -1
  28. package/dist/form/base/FormTimeInput.js +2 -2
  29. package/dist/hocs/withForm.cjs +2 -2
  30. package/dist/hocs/withForm.js +2 -2
  31. package/dist/hocs/withModalManager.cjs +8 -6
  32. package/dist/hocs/withModalManager.js +8 -6
  33. package/dist/index.cjs +1 -1
  34. package/dist/index.d.ts +9 -4
  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,
@@ -6,7 +6,7 @@ const jsxRuntime = require('react/jsx-runtime');
6
6
  const core = require('@mantine/core');
7
7
  const withForm = require('../../hocs/withForm.cjs');
8
8
 
9
- const FormCheckbox = withForm.withForm(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
9
+ const FormCheckbox = withForm.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/withForm.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,
@@ -6,7 +6,7 @@ const jsxRuntime = require('react/jsx-runtime');
6
6
  const index = require('../../components/MyDateInput/index.cjs');
7
7
  const withForm = require('../../hocs/withForm.cjs');
8
8
 
9
- const FormDateInput = withForm.withForm(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
9
+ const FormDateInput = withForm.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/withForm.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,
@@ -6,7 +6,7 @@ const jsxRuntime = require('react/jsx-runtime');
6
6
  const index = require('../../components/MyDatePickerInput/index.cjs');
7
7
  const withForm = require('../../hocs/withForm.cjs');
8
8
 
9
- const FormDatePickerInput = withForm.withForm(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
9
+ const FormDatePickerInput = withForm.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/withForm.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,
@@ -6,7 +6,7 @@ const jsxRuntime = require('react/jsx-runtime');
6
6
  const index = require('../../components/MyDateTimePicker/index.cjs');
7
7
  const withForm = require('../../hocs/withForm.cjs');
8
8
 
9
- const FormDateTimePicker = withForm.withForm(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
9
+ const FormDateTimePicker = withForm.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/withForm.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,
@@ -6,7 +6,7 @@ const jsxRuntime = require('react/jsx-runtime');
6
6
  const index = require('../../components/MyMonthPickerInput/index.cjs');
7
7
  const withForm = require('../../hocs/withForm.cjs');
8
8
 
9
- const FormMonthPickerInput = withForm.withForm(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
9
+ const FormMonthPickerInput = withForm.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/withForm.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,
@@ -6,7 +6,7 @@ const jsxRuntime = require('react/jsx-runtime');
6
6
  const index = require('../../components/MyMultiSelect/index.cjs');
7
7
  const withForm = require('../../hocs/withForm.cjs');
8
8
 
9
- const FormMultiSelect = withForm.withForm(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
9
+ const FormMultiSelect = withForm.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/withForm.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,
@@ -6,7 +6,7 @@ const jsxRuntime = require('react/jsx-runtime');
6
6
  const index = require('../../components/MyNumberInput/index.cjs');
7
7
  const withForm = require('../../hocs/withForm.cjs');
8
8
 
9
- const FormNumberInput = withForm.withForm(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
9
+ const FormNumberInput = withForm.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/withForm.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,
@@ -6,7 +6,7 @@ const jsxRuntime = require('react/jsx-runtime');
6
6
  const core = require('@mantine/core');
7
7
  const withForm = require('../../hocs/withForm.cjs');
8
8
 
9
- const FormRadioGroup = withForm.withForm(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
9
+ const FormRadioGroup = withForm.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/withForm.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,
@@ -6,7 +6,7 @@ const jsxRuntime = require('react/jsx-runtime');
6
6
  const index = require('../../components/MySelect/index.cjs');
7
7
  const withForm = require('../../hocs/withForm.cjs');
8
8
 
9
- const FormSelect = withForm.withForm(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
9
+ const FormSelect = withForm.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/withForm.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 withForm = require('../../hocs/withForm.cjs');
8
8
 
9
- const FormInfinitySelect = withForm.withForm(({ field, props }) => {
9
+ const FormInfinitySelect = withForm.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/withForm.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
  {
@@ -6,7 +6,7 @@ const jsxRuntime = require('react/jsx-runtime');
6
6
  const index = require('../../components/MyTextInput/index.cjs');
7
7
  const withForm = require('../../hocs/withForm.cjs');
8
8
 
9
- const FormTextInput = withForm.withForm(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
9
+ const FormTextInput = withForm.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/withForm.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,
@@ -6,7 +6,7 @@ const jsxRuntime = require('react/jsx-runtime');
6
6
  const index = require('../../components/MyTextarea/index.cjs');
7
7
  const withForm = require('../../hocs/withForm.cjs');
8
8
 
9
- const FormTextarea = withForm.withForm(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
9
+ const FormTextarea = withForm.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/withForm.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,
@@ -6,7 +6,7 @@ const jsxRuntime = require('react/jsx-runtime');
6
6
  const index = require('../../components/MyTimeInput/index.cjs');
7
7
  const withForm = require('../../hocs/withForm.cjs');
8
8
 
9
- const FormTimeInput = withForm.withForm(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
9
+ const FormTimeInput = withForm.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/withForm.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 };
@@ -9,25 +9,27 @@ const React = require('react');
9
9
  const withModalManager = (WrappedComponent) => {
10
10
  const Component = ({
11
11
  removeModal,
12
- opened,
13
12
  ...props
14
13
  }) => {
15
14
  const [isOpen, setIsOpen] = React.useState(false);
16
15
  const onClose = () => {
17
16
  setIsOpen(false);
18
17
  setTimeout(() => removeModal(), 200);
19
- props.onClose?.();
18
+ props.modalProps.onClose();
20
19
  };
21
20
  React.useEffect(() => {
22
- if (opened) setTimeout(() => setIsOpen(true), 0);
21
+ if (props.modalProps.opened) setTimeout(() => setIsOpen(true), 0);
23
22
  else onClose();
24
- }, [opened]);
23
+ }, [props.modalProps.opened]);
25
24
  return /* @__PURE__ */ jsxRuntime.jsx(
26
25
  WrappedComponent,
27
26
  {
28
27
  ...props,
29
- opened: isOpen,
30
- onClose
28
+ modalProps: {
29
+ ...props.modalProps,
30
+ opened: isOpen,
31
+ onClose
32
+ }
31
33
  }
32
34
  );
33
35
  };
@@ -5,25 +5,27 @@ import { useState, useEffect } from 'react';
5
5
  const withModalManager = (WrappedComponent) => {
6
6
  const Component = ({
7
7
  removeModal,
8
- opened,
9
8
  ...props
10
9
  }) => {
11
10
  const [isOpen, setIsOpen] = useState(false);
12
11
  const onClose = () => {
13
12
  setIsOpen(false);
14
13
  setTimeout(() => removeModal(), 200);
15
- props.onClose?.();
14
+ props.modalProps.onClose();
16
15
  };
17
16
  useEffect(() => {
18
- if (opened) setTimeout(() => setIsOpen(true), 0);
17
+ if (props.modalProps.opened) setTimeout(() => setIsOpen(true), 0);
19
18
  else onClose();
20
- }, [opened]);
19
+ }, [props.modalProps.opened]);
21
20
  return /* @__PURE__ */ jsx(
22
21
  WrappedComponent,
23
22
  {
24
23
  ...props,
25
- opened: isOpen,
26
- onClose
24
+ modalProps: {
25
+ ...props.modalProps,
26
+ opened: isOpen,
27
+ onClose
28
+ }
27
29
  }
28
30
  );
29
31
  };
package/dist/index.cjs CHANGED
@@ -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 = withForm.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
@@ -556,7 +556,7 @@ export declare const useUpdateSearchParams: () => {
556
556
 
557
557
  export declare const useZodConfig: () => void;
558
558
 
559
- export declare const withForm: <P extends unknown>(WrappedComponent: React.ComponentType<FormFieldProps<P>>, getControllerProps?: (fieldProps: P) => Omit<Partial<ControllerProps>, "render">) => FC<P & WithFormProps>;
559
+ export declare const withController: <P extends unknown>(WrappedComponent: React.ComponentType<FormFieldProps<P>>, getControllerProps?: (fieldProps: P) => Omit<Partial<ControllerProps>, "render">) => FC<P & WithFormProps>;
560
560
 
561
561
  export declare interface WithFormProps {
562
562
  name?: string;
@@ -567,13 +567,18 @@ export declare interface WithFormProps {
567
567
  disabled?: boolean;
568
568
  }
569
569
 
570
- export declare const withModalManager: <P extends Object>(WrappedComponent: React.ComponentType<P & ModalProps>) => FC<P & WithModalManagerProps & ModalProps>;
570
+ export declare const withModalManager: <CustomProps extends Object>(WrappedComponent: React.ComponentType<WrappedComponentProps<CustomProps>>) => FC<CustomProps & {
571
+ modalProps: ModalProps;
572
+ } & WithModalManagerProps>;
571
573
 
572
- export declare interface WithModalManagerProps {
574
+ declare interface WithModalManagerProps {
573
575
  removeModal: () => void;
574
- opened: boolean;
575
576
  }
576
577
 
578
+ export declare type WrappedComponentProps<T = any> = T & {
579
+ modalProps: ModalProps;
580
+ };
581
+
577
582
  export declare const zodValidator: (schema: ZodType) => (values: any) => string | undefined;
578
583
 
579
584
  export { }
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/withForm.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.0",
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 };