lkd-web-kit 0.8.0 → 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 -17
  25. package/dist/components/MyNotifications/index.js +10 -13
  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 -10
  67. package/dist/form/base/FormMultiSelect.js +9 -6
  68. package/dist/form/base/FormNumberInput.cjs +12 -12
  69. package/dist/form/base/FormNumberInput.js +10 -8
  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 +13 -13
  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 -42
  108. package/dist/mantine/my-default-theme.js +22 -38
  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 -870
  114. package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +701 -863
  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 -14
  126. package/dist/utils/ky/addBodyJsonHook.js +8 -10
  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 +17 -16
@@ -1,52 +1,44 @@
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 withController = (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
- onValueChange: void 0
29
- },
30
- field: {
31
- ...renderProps.field,
32
- onChange: (...value) => {
33
- renderProps.field.onChange(...value);
34
- props.onValueChange?.(...value);
35
- },
36
- label,
37
- placeholder,
38
- description,
39
- error: error?.message
40
- },
41
- ...withFormRestProps
42
- };
43
- return /* @__PURE__ */ jsx(WrappedComponent, { ...fieldProps });
44
- }
45
- }
46
- );
47
- };
48
- FormField.displayName = `WithForm(${WrappedComponent.displayName})`;
49
- return FormField;
1
+ "use client";
2
+ import { zodValidator } from "../form/utils/zodValidator.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { Controller } from "react-hook-form";
5
+ //#region src/hocs/withController.tsx
6
+ var withController = (WrappedComponent, getControllerProps) => {
7
+ const FormField = (props) => {
8
+ const { validate, name = "", placeholder, label, description, ...withFormRestProps } = props;
9
+ return /* @__PURE__ */ jsx(Controller, {
10
+ name,
11
+ defaultValue: "",
12
+ rules: { validate: validate && !props.disabled ? zodValidator(validate) : void 0 },
13
+ disabled: props.disabled,
14
+ ...getControllerProps?.(props),
15
+ render: (renderProps) => {
16
+ const { fieldState: { error } } = renderProps;
17
+ return /* @__PURE__ */ jsx(WrappedComponent, {
18
+ ...renderProps,
19
+ props: {
20
+ ...props,
21
+ validate: void 0,
22
+ onValueChange: void 0
23
+ },
24
+ field: {
25
+ ...renderProps.field,
26
+ onChange: (...value) => {
27
+ renderProps.field.onChange(...value);
28
+ props.onValueChange?.(...value);
29
+ },
30
+ label,
31
+ placeholder,
32
+ description,
33
+ error: error?.message
34
+ },
35
+ ...withFormRestProps
36
+ });
37
+ }
38
+ });
39
+ };
40
+ FormField.displayName = `WithForm(${WrappedComponent.displayName})`;
41
+ return FormField;
50
42
  };
51
-
43
+ //#endregion
52
44
  export { withController };
@@ -1,37 +1,31 @@
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 React = require('react');
8
-
9
- const withModalManager = (WrappedComponent) => {
10
- const Wrapper = ({ removeModal, ...props }) => {
11
- const [isOpen, setIsOpen] = React.useState(false);
12
- const onClose = () => {
13
- setIsOpen(false);
14
- setTimeout(() => removeModal(), 200);
15
- props.modalProps.onClose?.();
16
- };
17
- React.useEffect(() => {
18
- if (props.modalProps.opened) setTimeout(() => setIsOpen(true), 0);
19
- else onClose();
20
- }, [props.modalProps.opened]);
21
- return /* @__PURE__ */ jsxRuntime.jsx(
22
- WrappedComponent,
23
- {
24
- ...props,
25
- modalProps: {
26
- ...props.modalProps,
27
- opened: isOpen,
28
- onClose
29
- }
30
- }
31
- );
32
- };
33
- Wrapper.displayName = `WithModalManager(${WrappedComponent.displayName})`;
34
- return Wrapper;
1
+ "use client";
2
+ require("../../_virtual/_rolldown/runtime.cjs");
3
+ let react = require("react");
4
+ let react_jsx_runtime = require("react/jsx-runtime");
5
+ //#region src/hocs/withModalManager.tsx
6
+ var withModalManager = (WrappedComponent) => {
7
+ const Wrapper = ({ removeModal, ...props }) => {
8
+ const [isOpen, setIsOpen] = (0, react.useState)(false);
9
+ const onClose = () => {
10
+ setIsOpen(false);
11
+ setTimeout(() => removeModal(), 200);
12
+ props.modalProps.onClose?.();
13
+ };
14
+ (0, react.useEffect)(() => {
15
+ if (props.modalProps.opened) setTimeout(() => setIsOpen(true), 0);
16
+ else onClose();
17
+ }, [props.modalProps.opened]);
18
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WrappedComponent, {
19
+ ...props,
20
+ modalProps: {
21
+ ...props.modalProps,
22
+ opened: isOpen,
23
+ onClose
24
+ }
25
+ });
26
+ };
27
+ Wrapper.displayName = `WithModalManager(${WrappedComponent.displayName})`;
28
+ return Wrapper;
35
29
  };
36
-
30
+ //#endregion
37
31
  exports.withModalManager = withModalManager;
@@ -1,33 +1,30 @@
1
- 'use client';
2
- import { jsx } from 'react/jsx-runtime';
3
- import { useState, useEffect } from 'react';
4
-
5
- const withModalManager = (WrappedComponent) => {
6
- const Wrapper = ({ removeModal, ...props }) => {
7
- const [isOpen, setIsOpen] = useState(false);
8
- const onClose = () => {
9
- setIsOpen(false);
10
- setTimeout(() => removeModal(), 200);
11
- props.modalProps.onClose?.();
12
- };
13
- useEffect(() => {
14
- if (props.modalProps.opened) setTimeout(() => setIsOpen(true), 0);
15
- else onClose();
16
- }, [props.modalProps.opened]);
17
- return /* @__PURE__ */ jsx(
18
- WrappedComponent,
19
- {
20
- ...props,
21
- modalProps: {
22
- ...props.modalProps,
23
- opened: isOpen,
24
- onClose
25
- }
26
- }
27
- );
28
- };
29
- Wrapper.displayName = `WithModalManager(${WrappedComponent.displayName})`;
30
- return Wrapper;
1
+ "use client";
2
+ import { useEffect, useState } from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ //#region src/hocs/withModalManager.tsx
5
+ var withModalManager = (WrappedComponent) => {
6
+ const Wrapper = ({ removeModal, ...props }) => {
7
+ const [isOpen, setIsOpen] = useState(false);
8
+ const onClose = () => {
9
+ setIsOpen(false);
10
+ setTimeout(() => removeModal(), 200);
11
+ props.modalProps.onClose?.();
12
+ };
13
+ useEffect(() => {
14
+ if (props.modalProps.opened) setTimeout(() => setIsOpen(true), 0);
15
+ else onClose();
16
+ }, [props.modalProps.opened]);
17
+ return /* @__PURE__ */ jsx(WrappedComponent, {
18
+ ...props,
19
+ modalProps: {
20
+ ...props.modalProps,
21
+ opened: isOpen,
22
+ onClose
23
+ }
24
+ });
25
+ };
26
+ Wrapper.displayName = `WithModalManager(${WrappedComponent.displayName})`;
27
+ return Wrapper;
31
28
  };
32
-
29
+ //#endregion
33
30
  export { withModalManager };
@@ -1,14 +1,10 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
-
6
- const breakpointsWithPx = require('../mantine/breakpoints-with-px.cjs');
7
- const hooks = require('@mantine/hooks');
8
-
9
- const useBreakpoint = (breakpoint) => {
10
- const matches = hooks.useMediaQuery(`(min-width: ${breakpointsWithPx.breakpointsWithPx[breakpoint]})`);
11
- return matches;
1
+ "use client";
2
+ require("../../_virtual/_rolldown/runtime.cjs");
3
+ const require_breakpoints_with_px = require("../mantine/breakpoints-with-px.cjs");
4
+ let _mantine_hooks = require("@mantine/hooks");
5
+ //#region src/hooks/useBreakpoint.ts
6
+ var useBreakpoint = (breakpoint) => {
7
+ return (0, _mantine_hooks.useMediaQuery)(`(min-width: ${require_breakpoints_with_px.breakpointsWithPx[breakpoint]})`);
12
8
  };
13
-
9
+ //#endregion
14
10
  exports.useBreakpoint = useBreakpoint;
@@ -1,10 +1,9 @@
1
- 'use client';
2
- import { breakpointsWithPx } from '../mantine/breakpoints-with-px.js';
3
- import { useMediaQuery } from '@mantine/hooks';
4
-
5
- const useBreakpoint = (breakpoint) => {
6
- const matches = useMediaQuery(`(min-width: ${breakpointsWithPx[breakpoint]})`);
7
- return matches;
1
+ "use client";
2
+ import { breakpointsWithPx } from "../mantine/breakpoints-with-px.js";
3
+ import { useMediaQuery } from "@mantine/hooks";
4
+ //#region src/hooks/useBreakpoint.ts
5
+ var useBreakpoint = (breakpoint) => {
6
+ return useMediaQuery(`(min-width: ${breakpointsWithPx[breakpoint]})`);
8
7
  };
9
-
8
+ //#endregion
10
9
  export { useBreakpoint };
@@ -1,23 +1,15 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
-
6
- const useOnScrollProgress = require('./useOnScrollProgress.cjs');
7
-
8
- const useFetchNextPageOnScroll = ({
9
- infinity,
10
- scrollRef,
11
- disabled = false
12
- }) => {
13
- useOnScrollProgress.useOnScrollProgress({
14
- triggerPercentage: 0.9,
15
- callback: () => {
16
- if (infinity.hasNextPage) infinity.fetchNextPage();
17
- },
18
- scrollRef,
19
- disabled
20
- });
1
+ "use client";
2
+ const require_useOnScrollProgress = require("./useOnScrollProgress.cjs");
3
+ //#region src/hooks/useFetchNextPageOnScroll.ts
4
+ var useFetchNextPageOnScroll = ({ infinity, scrollRef, disabled = false }) => {
5
+ require_useOnScrollProgress.useOnScrollProgress({
6
+ triggerPercentage: .9,
7
+ callback: () => {
8
+ if (infinity.hasNextPage) infinity.fetchNextPage();
9
+ },
10
+ scrollRef,
11
+ disabled
12
+ });
21
13
  };
22
-
14
+ //#endregion
23
15
  exports.useFetchNextPageOnScroll = useFetchNextPageOnScroll;
@@ -1,19 +1,15 @@
1
- 'use client';
2
- import { useOnScrollProgress } from './useOnScrollProgress.js';
3
-
4
- const useFetchNextPageOnScroll = ({
5
- infinity,
6
- scrollRef,
7
- disabled = false
8
- }) => {
9
- useOnScrollProgress({
10
- triggerPercentage: 0.9,
11
- callback: () => {
12
- if (infinity.hasNextPage) infinity.fetchNextPage();
13
- },
14
- scrollRef,
15
- disabled
16
- });
1
+ "use client";
2
+ import { useOnScrollProgress } from "./useOnScrollProgress.js";
3
+ //#region src/hooks/useFetchNextPageOnScroll.ts
4
+ var useFetchNextPageOnScroll = ({ infinity, scrollRef, disabled = false }) => {
5
+ useOnScrollProgress({
6
+ triggerPercentage: .9,
7
+ callback: () => {
8
+ if (infinity.hasNextPage) infinity.fetchNextPage();
9
+ },
10
+ scrollRef,
11
+ disabled
12
+ });
17
13
  };
18
-
14
+ //#endregion
19
15
  export { useFetchNextPageOnScroll };
@@ -1,39 +1,35 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
-
6
- const React = require('react');
7
-
8
- const useOnScrollProgress = ({
9
- triggerPercentage,
10
- callback,
11
- scrollRef,
12
- disabled = false
13
- }) => {
14
- if (triggerPercentage < 0 || triggerPercentage > 1)
15
- throw new Error("El porcentaje debe estar entre 0 y 1");
16
- React.useEffect(() => {
17
- if (disabled || scrollRef && scrollRef.current === null) return;
18
- let hasTriggered = false;
19
- const handleScroll = () => {
20
- const el = scrollRef?.current;
21
- const target = el ?? document.documentElement;
22
- const scrollHeight = target.scrollHeight - target.clientHeight;
23
- const scrollTop = el ? target.scrollTop : window.scrollY;
24
- const scrollProgress = scrollHeight > 0 ? Math.min(1, scrollTop / scrollHeight) : 0;
25
- if (!hasTriggered && scrollProgress >= triggerPercentage) {
26
- callback();
27
- hasTriggered = true;
28
- }
29
- };
30
- const scrollTarget = scrollRef?.current ?? window;
31
- scrollTarget.addEventListener("scroll", handleScroll);
32
- handleScroll();
33
- return () => {
34
- scrollTarget.removeEventListener("scroll", handleScroll);
35
- };
36
- }, [triggerPercentage, callback, scrollRef, disabled]);
1
+ "use client";
2
+ require("../../_virtual/_rolldown/runtime.cjs");
3
+ let react = require("react");
4
+ //#region src/hooks/useOnScrollProgress.ts
5
+ var useOnScrollProgress = ({ triggerPercentage, callback, scrollRef, disabled = false }) => {
6
+ if (triggerPercentage < 0 || triggerPercentage > 1) throw new Error("El porcentaje debe estar entre 0 y 1");
7
+ (0, react.useEffect)(() => {
8
+ if (disabled || scrollRef && scrollRef.current === null) return;
9
+ let hasTriggered = false;
10
+ const handleScroll = () => {
11
+ const el = scrollRef?.current;
12
+ const target = el ?? document.documentElement;
13
+ const scrollHeight = target.scrollHeight - target.clientHeight;
14
+ const scrollTop = el ? target.scrollTop : window.scrollY;
15
+ const scrollProgress = scrollHeight > 0 ? Math.min(1, scrollTop / scrollHeight) : 0;
16
+ if (!hasTriggered && scrollProgress >= triggerPercentage) {
17
+ callback();
18
+ hasTriggered = true;
19
+ }
20
+ };
21
+ const scrollTarget = scrollRef?.current ?? window;
22
+ scrollTarget.addEventListener("scroll", handleScroll);
23
+ handleScroll();
24
+ return () => {
25
+ scrollTarget.removeEventListener("scroll", handleScroll);
26
+ };
27
+ }, [
28
+ triggerPercentage,
29
+ callback,
30
+ scrollRef,
31
+ disabled
32
+ ]);
37
33
  };
38
-
34
+ //#endregion
39
35
  exports.useOnScrollProgress = useOnScrollProgress;
@@ -1,35 +1,34 @@
1
- 'use client';
2
- import { useEffect } from 'react';
3
-
4
- const useOnScrollProgress = ({
5
- triggerPercentage,
6
- callback,
7
- scrollRef,
8
- disabled = false
9
- }) => {
10
- if (triggerPercentage < 0 || triggerPercentage > 1)
11
- throw new Error("El porcentaje debe estar entre 0 y 1");
12
- useEffect(() => {
13
- if (disabled || scrollRef && scrollRef.current === null) return;
14
- let hasTriggered = false;
15
- const handleScroll = () => {
16
- const el = scrollRef?.current;
17
- const target = el ?? document.documentElement;
18
- const scrollHeight = target.scrollHeight - target.clientHeight;
19
- const scrollTop = el ? target.scrollTop : window.scrollY;
20
- const scrollProgress = scrollHeight > 0 ? Math.min(1, scrollTop / scrollHeight) : 0;
21
- if (!hasTriggered && scrollProgress >= triggerPercentage) {
22
- callback();
23
- hasTriggered = true;
24
- }
25
- };
26
- const scrollTarget = scrollRef?.current ?? window;
27
- scrollTarget.addEventListener("scroll", handleScroll);
28
- handleScroll();
29
- return () => {
30
- scrollTarget.removeEventListener("scroll", handleScroll);
31
- };
32
- }, [triggerPercentage, callback, scrollRef, disabled]);
1
+ "use client";
2
+ import { useEffect } from "react";
3
+ //#region src/hooks/useOnScrollProgress.ts
4
+ var useOnScrollProgress = ({ triggerPercentage, callback, scrollRef, disabled = false }) => {
5
+ if (triggerPercentage < 0 || triggerPercentage > 1) throw new Error("El porcentaje debe estar entre 0 y 1");
6
+ useEffect(() => {
7
+ if (disabled || scrollRef && scrollRef.current === null) return;
8
+ let hasTriggered = false;
9
+ const handleScroll = () => {
10
+ const el = scrollRef?.current;
11
+ const target = el ?? document.documentElement;
12
+ const scrollHeight = target.scrollHeight - target.clientHeight;
13
+ const scrollTop = el ? target.scrollTop : window.scrollY;
14
+ const scrollProgress = scrollHeight > 0 ? Math.min(1, scrollTop / scrollHeight) : 0;
15
+ if (!hasTriggered && scrollProgress >= triggerPercentage) {
16
+ callback();
17
+ hasTriggered = true;
18
+ }
19
+ };
20
+ const scrollTarget = scrollRef?.current ?? window;
21
+ scrollTarget.addEventListener("scroll", handleScroll);
22
+ handleScroll();
23
+ return () => {
24
+ scrollTarget.removeEventListener("scroll", handleScroll);
25
+ };
26
+ }, [
27
+ triggerPercentage,
28
+ callback,
29
+ scrollRef,
30
+ disabled
31
+ ]);
33
32
  };
34
-
33
+ //#endregion
35
34
  export { useOnScrollProgress };
@@ -1,24 +1,24 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
-
6
- const navigation = require('next/navigation');
7
-
8
- const useUpdateSearchParams = () => {
9
- const searchParams = navigation.useSearchParams();
10
- const updateSearchParams = (newSearchparams) => {
11
- const params = new URLSearchParams(searchParams.toString());
12
- Object.entries(newSearchparams).forEach(([key, value]) => {
13
- if (value === null) {
14
- params.delete(key);
15
- return;
16
- }
17
- params.set(key, String(value));
18
- });
19
- window?.history?.pushState(null, "", `?${params.toString()}`);
20
- };
21
- return { updateSearchParams, searchParams };
1
+ "use client";
2
+ require("../../_virtual/_rolldown/runtime.cjs");
3
+ let next_navigation = require("next/navigation");
4
+ //#region src/hooks/useUpdateSearchParams.ts
5
+ var useUpdateSearchParams = () => {
6
+ const searchParams = (0, next_navigation.useSearchParams)();
7
+ const updateSearchParams = (newSearchparams) => {
8
+ const params = new URLSearchParams(searchParams.toString());
9
+ Object.entries(newSearchparams).forEach(([key, value]) => {
10
+ if (value === null) {
11
+ params.delete(key);
12
+ return;
13
+ }
14
+ params.set(key, String(value));
15
+ });
16
+ window?.history?.pushState(null, "", `?${params.toString()}`);
17
+ };
18
+ return {
19
+ updateSearchParams,
20
+ searchParams
21
+ };
22
22
  };
23
-
23
+ //#endregion
24
24
  exports.useUpdateSearchParams = useUpdateSearchParams;
@@ -1,20 +1,23 @@
1
- 'use client';
2
- import { useSearchParams } from 'next/navigation';
3
-
4
- const useUpdateSearchParams = () => {
5
- const searchParams = useSearchParams();
6
- const updateSearchParams = (newSearchparams) => {
7
- const params = new URLSearchParams(searchParams.toString());
8
- Object.entries(newSearchparams).forEach(([key, value]) => {
9
- if (value === null) {
10
- params.delete(key);
11
- return;
12
- }
13
- params.set(key, String(value));
14
- });
15
- window?.history?.pushState(null, "", `?${params.toString()}`);
16
- };
17
- return { updateSearchParams, searchParams };
1
+ "use client";
2
+ import { useSearchParams } from "next/navigation";
3
+ //#region src/hooks/useUpdateSearchParams.ts
4
+ var useUpdateSearchParams = () => {
5
+ const searchParams = useSearchParams();
6
+ const updateSearchParams = (newSearchparams) => {
7
+ const params = new URLSearchParams(searchParams.toString());
8
+ Object.entries(newSearchparams).forEach(([key, value]) => {
9
+ if (value === null) {
10
+ params.delete(key);
11
+ return;
12
+ }
13
+ params.set(key, String(value));
14
+ });
15
+ window?.history?.pushState(null, "", `?${params.toString()}`);
16
+ };
17
+ return {
18
+ updateSearchParams,
19
+ searchParams
20
+ };
18
21
  };
19
-
22
+ //#endregion
20
23
  export { useUpdateSearchParams };
@@ -1,21 +1,16 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const React = require('react');
6
- const z = require('zod');
7
-
8
- const useZodConfig = () => {
9
- React.useEffect(() => {
10
- z.config({
11
- customError: (iss) => {
12
- if (iss.code === "too_small")
13
- return iss.minimum === 1 ? `Campo requerido` : `Minimo ${iss.minimum} caracteres`;
14
- if (iss.code === "too_big") return `Maximo ${iss.maximum} caracteres`;
15
- if (iss.code === "invalid_format" && iss.format === "email") return `Email invalido`;
16
- }
17
- });
18
- }, []);
1
+ const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
+ let react = require("react");
3
+ let zod = require("zod");
4
+ zod = require_runtime.__toESM(zod, 1);
5
+ //#region src/hooks/useZodConfig.ts
6
+ var useZodConfig = () => {
7
+ (0, react.useEffect)(() => {
8
+ zod.default.config({ customError: (iss) => {
9
+ if (iss.code === "too_small") return iss.minimum === 1 ? `Campo requerido` : `Minimo ${iss.minimum} caracteres`;
10
+ if (iss.code === "too_big") return `Maximo ${iss.maximum} caracteres`;
11
+ if (iss.code === "invalid_format" && iss.format === "email") return `Email invalido`;
12
+ } });
13
+ }, []);
19
14
  };
20
-
15
+ //#endregion
21
16
  exports.useZodConfig = useZodConfig;
@@ -1,17 +1,14 @@
1
- import { useEffect } from 'react';
2
- import z from 'zod';
3
-
4
- const useZodConfig = () => {
5
- useEffect(() => {
6
- z.config({
7
- customError: (iss) => {
8
- if (iss.code === "too_small")
9
- return iss.minimum === 1 ? `Campo requerido` : `Minimo ${iss.minimum} caracteres`;
10
- if (iss.code === "too_big") return `Maximo ${iss.maximum} caracteres`;
11
- if (iss.code === "invalid_format" && iss.format === "email") return `Email invalido`;
12
- }
13
- });
14
- }, []);
1
+ import { useEffect } from "react";
2
+ import z$1 from "zod";
3
+ //#region src/hooks/useZodConfig.ts
4
+ var useZodConfig = () => {
5
+ useEffect(() => {
6
+ z$1.config({ customError: (iss) => {
7
+ if (iss.code === "too_small") return iss.minimum === 1 ? `Campo requerido` : `Minimo ${iss.minimum} caracteres`;
8
+ if (iss.code === "too_big") return `Maximo ${iss.maximum} caracteres`;
9
+ if (iss.code === "invalid_format" && iss.format === "email") return `Email invalido`;
10
+ } });
11
+ }, []);
15
12
  };
16
-
13
+ //#endregion
17
14
  export { useZodConfig };