lkd-web-kit 0.3.18 → 0.3.19
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.
- package/dist/components/EmptyState/index.cjs +43 -0
- package/dist/{index2.mjs → components/EmptyState/index.js} +1 -1
- package/dist/components/Icon.cjs +54 -0
- package/dist/components/InfinityLoader/index.cjs +46 -0
- package/dist/components/MyDatePickerInput/CalendarIcon.cjs +65 -0
- package/dist/components/MyDatePickerInput/index.cjs +19 -0
- package/dist/{index6.mjs → components/MyDatePickerInput/index.js} +1 -1
- package/dist/components/MyDateTimePicker/index.cjs +19 -0
- package/dist/{index7.mjs → components/MyDateTimePicker/index.js} +1 -1
- package/dist/components/MyMonthPickerInput/index.cjs +19 -0
- package/dist/{index16.mjs → components/MyMonthPickerInput/index.js} +1 -1
- package/dist/components/MyMultiSelect/index.cjs +16 -0
- package/dist/components/MyNotifications/index.cjs +17 -0
- package/dist/{index8.mjs → components/MyNotifications/index.js} +1 -1
- package/dist/components/MyNumberInput/index.cjs +16 -0
- package/dist/components/MySelect/index.cjs +16 -0
- package/dist/components/MyTextInput/index.cjs +16 -0
- package/dist/components/MyTextarea/index.cjs +16 -0
- package/dist/components/MyTimeInput/index.cjs +16 -0
- package/dist/components/NavItems.cjs +40 -0
- package/dist/components/SelectInfinity/index.cjs +118 -0
- package/dist/{index14.mjs → components/SelectInfinity/index.js} +2 -2
- package/dist/consts/http-status.cjs +70 -0
- package/dist/consts/revalidate.cjs +14 -0
- package/dist/contexts/NavigationHistoryContext/index.cjs +66 -0
- package/dist/contexts/PageDataContext/index.cjs +21 -0
- package/dist/form/Form.cjs +30 -0
- package/dist/form/FormButtonSubmit.cjs +24 -0
- package/dist/form/base/FormCheckbox.cjs +18 -0
- package/dist/{index26.mjs → form/base/FormCheckbox.js} +1 -1
- package/dist/form/base/FormDatePickerInput.cjs +17 -0
- package/dist/{index27.mjs → form/base/FormDatePickerInput.js} +2 -2
- package/dist/form/base/FormDateTimePicker.cjs +17 -0
- package/dist/{index28.mjs → form/base/FormDateTimePicker.js} +2 -2
- package/dist/form/base/FormMonthPickerInput.cjs +17 -0
- package/dist/{index37.mjs → form/base/FormMonthPickerInput.js} +2 -2
- package/dist/form/base/FormMultiSelect.cjs +17 -0
- package/dist/{index36.mjs → form/base/FormMultiSelect.js} +2 -2
- package/dist/form/base/FormNumberInput.cjs +17 -0
- package/dist/{index29.mjs → form/base/FormNumberInput.js} +2 -2
- package/dist/form/base/FormRadioGroup.cjs +17 -0
- package/dist/{index30.mjs → form/base/FormRadioGroup.js} +1 -1
- package/dist/form/base/FormSelect.cjs +17 -0
- package/dist/{index31.mjs → form/base/FormSelect.js} +2 -2
- package/dist/form/base/FormSelectInfinity.cjs +17 -0
- package/dist/{index32.mjs → form/base/FormSelectInfinity.js} +2 -2
- package/dist/form/base/FormTextInput.cjs +17 -0
- package/dist/{index34.mjs → form/base/FormTextInput.js} +2 -2
- package/dist/form/base/FormTextarea.cjs +17 -0
- package/dist/{index33.mjs → form/base/FormTextarea.js} +2 -2
- package/dist/form/base/FormTimeInput.cjs +29 -0
- package/dist/{index35.mjs → form/base/FormTimeInput.js} +2 -2
- package/dist/form/utils/nullable-but-required.cjs +16 -0
- package/dist/form/utils/optional-but-required.cjs +16 -0
- package/dist/form/utils/zodValidator.cjs +15 -0
- package/dist/hocs/withForm.cjs +51 -0
- package/dist/{index38.mjs → hocs/withForm.js} +1 -1
- package/dist/hocs/withModalManager.cjs +38 -0
- package/dist/hooks/useBreakpoint.cjs +15 -0
- package/dist/hooks/useFetchNextPageOnScroll.cjs +23 -0
- package/dist/{index41.mjs → hooks/useFetchNextPageOnScroll.js} +1 -1
- package/dist/hooks/useOnScrollProgress.cjs +39 -0
- package/dist/hooks/useUpdateSearchParams.cjs +24 -0
- package/dist/index.cjs +117 -0
- package/dist/index.js +52 -0
- package/dist/mantine/breakpoints-with-px.cjs +14 -0
- package/dist/mantine/my-default-theme.cjs +43 -0
- package/dist/{index46.mjs → mantine/my-default-theme.js} +1 -1
- package/dist/mantine/to-tailwind-colors.cjs +19 -0
- package/dist/utils/array/groupBy.cjs +45 -0
- package/dist/utils/array/shuffleArray.cjs +19 -0
- package/dist/utils/formatBytes.cjs +14 -0
- package/dist/utils/isInfinityEmpty.cjs +7 -0
- package/dist/utils/ky/addBodyJsonHook.cjs +12 -0
- package/dist/{index48.mjs → utils/ky/addBodyJsonHook.js} +1 -1
- package/dist/utils/ky/parseJson.cjs +11 -0
- package/dist/utils/newHref.cjs +24 -0
- package/package.json +11 -2
- package/dist/index.mjs +0 -52
- /package/dist/{index5.mjs → components/Icon.js} +0 -0
- /package/dist/{index3.mjs → components/InfinityLoader/index.js} +0 -0
- /package/dist/{index54.mjs → components/MyDatePickerInput/CalendarIcon.js} +0 -0
- /package/dist/{index15.mjs → components/MyMultiSelect/index.js} +0 -0
- /package/dist/{index9.mjs → components/MyNumberInput/index.js} +0 -0
- /package/dist/{index10.mjs → components/MySelect/index.js} +0 -0
- /package/dist/{index12.mjs → components/MyTextInput/index.js} +0 -0
- /package/dist/{index11.mjs → components/MyTextarea/index.js} +0 -0
- /package/dist/{index13.mjs → components/MyTimeInput/index.js} +0 -0
- /package/dist/{index4.mjs → components/NavItems.js} +0 -0
- /package/dist/{index17.mjs → consts/http-status.js} +0 -0
- /package/dist/{index18.mjs → consts/revalidate.js} +0 -0
- /package/dist/{index19.mjs → contexts/NavigationHistoryContext/index.js} +0 -0
- /package/dist/{index20.mjs → contexts/PageDataContext/index.js} +0 -0
- /package/dist/{index21.mjs → form/Form.js} +0 -0
- /package/dist/{index22.mjs → form/FormButtonSubmit.js} +0 -0
- /package/dist/{index24.mjs → form/utils/nullable-but-required.js} +0 -0
- /package/dist/{index25.mjs → form/utils/optional-but-required.js} +0 -0
- /package/dist/{index23.mjs → form/utils/zodValidator.js} +0 -0
- /package/dist/{index39.mjs → hocs/withModalManager.js} +0 -0
- /package/dist/{index40.mjs → hooks/useBreakpoint.js} +0 -0
- /package/dist/{index42.mjs → hooks/useOnScrollProgress.js} +0 -0
- /package/dist/{index43.mjs → hooks/useUpdateSearchParams.js} +0 -0
- /package/dist/{index44.mjs → mantine/breakpoints-with-px.js} +0 -0
- /package/dist/{index45.mjs → mantine/to-tailwind-colors.js} +0 -0
- /package/dist/{index50.mjs → utils/array/groupBy.js} +0 -0
- /package/dist/{index51.mjs → utils/array/shuffleArray.js} +0 -0
- /package/dist/{index47.mjs → utils/formatBytes.js} +0 -0
- /package/dist/{index53.mjs → utils/isInfinityEmpty.js} +0 -0
- /package/dist/{index49.mjs → utils/ky/parseJson.js} +0 -0
- /package/dist/{index52.mjs → utils/newHref.js} +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
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,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { Controller } from 'react-hook-form';
|
|
4
|
-
import { zodValidator } from '
|
|
4
|
+
import { zodValidator } from '../form/utils/zodValidator.js';
|
|
5
5
|
|
|
6
6
|
const withForm = (WrappedComponent, getControllerProps) => {
|
|
7
7
|
const FormField = (props) => {
|
|
@@ -0,0 +1,38 @@
|
|
|
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 Component = ({
|
|
11
|
+
removeModal,
|
|
12
|
+
opened,
|
|
13
|
+
...props
|
|
14
|
+
}) => {
|
|
15
|
+
const [isOpen, setIsOpen] = react.useState(false);
|
|
16
|
+
const onClose = () => {
|
|
17
|
+
setIsOpen(false);
|
|
18
|
+
setTimeout(() => removeModal(), 200);
|
|
19
|
+
props.onClose?.();
|
|
20
|
+
};
|
|
21
|
+
react.useEffect(() => {
|
|
22
|
+
if (opened) setTimeout(() => setIsOpen(true), 0);
|
|
23
|
+
else onClose();
|
|
24
|
+
}, [opened]);
|
|
25
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
26
|
+
WrappedComponent,
|
|
27
|
+
{
|
|
28
|
+
...props,
|
|
29
|
+
opened: isOpen,
|
|
30
|
+
onClose
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
Component.displayName = `WithModalManager(${WrappedComponent.displayName})`;
|
|
35
|
+
return Component;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
exports.withModalManager = withModalManager;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const core = require('@mantine/core');
|
|
7
|
+
|
|
8
|
+
const useBreakpoint = (breakpoint) => {
|
|
9
|
+
const result = core.useMatches({
|
|
10
|
+
[breakpoint]: true
|
|
11
|
+
});
|
|
12
|
+
return !!result;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
exports.useBreakpoint = useBreakpoint;
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
});
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
exports.useFetchNextPageOnScroll = useFetchNextPageOnScroll;
|
|
@@ -0,0 +1,39 @@
|
|
|
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]);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
exports.useOnScrollProgress = useOnScrollProgress;
|
|
@@ -0,0 +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 };
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
exports.useUpdateSearchParams = useUpdateSearchParams;
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const index = require('./components/EmptyState/index.cjs');
|
|
6
|
+
const index$1 = require('./components/InfinityLoader/index.cjs');
|
|
7
|
+
const NavItems = require('./components/NavItems.cjs');
|
|
8
|
+
const Icon = require('./components/Icon.cjs');
|
|
9
|
+
const index$2 = require('./components/MyDatePickerInput/index.cjs');
|
|
10
|
+
const index$3 = require('./components/MyDateTimePicker/index.cjs');
|
|
11
|
+
const index$4 = require('./components/MyNotifications/index.cjs');
|
|
12
|
+
const index$5 = require('./components/MyNumberInput/index.cjs');
|
|
13
|
+
const index$6 = require('./components/MySelect/index.cjs');
|
|
14
|
+
const index$7 = require('./components/MyTextarea/index.cjs');
|
|
15
|
+
const index$8 = require('./components/MyTextInput/index.cjs');
|
|
16
|
+
const index$9 = require('./components/MyTimeInput/index.cjs');
|
|
17
|
+
const index$a = require('./components/SelectInfinity/index.cjs');
|
|
18
|
+
const index$b = require('./components/MyMultiSelect/index.cjs');
|
|
19
|
+
const index$c = require('./components/MyMonthPickerInput/index.cjs');
|
|
20
|
+
const httpStatus = require('./consts/http-status.cjs');
|
|
21
|
+
const revalidate = require('./consts/revalidate.cjs');
|
|
22
|
+
const index$d = require('./contexts/NavigationHistoryContext/index.cjs');
|
|
23
|
+
const index$e = require('./contexts/PageDataContext/index.cjs');
|
|
24
|
+
const Form = require('./form/Form.cjs');
|
|
25
|
+
const FormButtonSubmit = require('./form/FormButtonSubmit.cjs');
|
|
26
|
+
const zodValidator = require('./form/utils/zodValidator.cjs');
|
|
27
|
+
const nullableButRequired = require('./form/utils/nullable-but-required.cjs');
|
|
28
|
+
const optionalButRequired = require('./form/utils/optional-but-required.cjs');
|
|
29
|
+
const FormCheckbox = require('./form/base/FormCheckbox.cjs');
|
|
30
|
+
const FormDatePickerInput = require('./form/base/FormDatePickerInput.cjs');
|
|
31
|
+
const FormDateTimePicker = require('./form/base/FormDateTimePicker.cjs');
|
|
32
|
+
const FormNumberInput = require('./form/base/FormNumberInput.cjs');
|
|
33
|
+
const FormRadioGroup = require('./form/base/FormRadioGroup.cjs');
|
|
34
|
+
const FormSelect = require('./form/base/FormSelect.cjs');
|
|
35
|
+
const FormSelectInfinity = require('./form/base/FormSelectInfinity.cjs');
|
|
36
|
+
const FormTextarea = require('./form/base/FormTextarea.cjs');
|
|
37
|
+
const FormTextInput = require('./form/base/FormTextInput.cjs');
|
|
38
|
+
const FormTimeInput = require('./form/base/FormTimeInput.cjs');
|
|
39
|
+
const FormMultiSelect = require('./form/base/FormMultiSelect.cjs');
|
|
40
|
+
const FormMonthPickerInput = require('./form/base/FormMonthPickerInput.cjs');
|
|
41
|
+
const withForm = require('./hocs/withForm.cjs');
|
|
42
|
+
const withModalManager = require('./hocs/withModalManager.cjs');
|
|
43
|
+
const useBreakpoint = require('./hooks/useBreakpoint.cjs');
|
|
44
|
+
const useFetchNextPageOnScroll = require('./hooks/useFetchNextPageOnScroll.cjs');
|
|
45
|
+
const useOnScrollProgress = require('./hooks/useOnScrollProgress.cjs');
|
|
46
|
+
const useUpdateSearchParams = require('./hooks/useUpdateSearchParams.cjs');
|
|
47
|
+
const breakpointsWithPx = require('./mantine/breakpoints-with-px.cjs');
|
|
48
|
+
const toTailwindColors = require('./mantine/to-tailwind-colors.cjs');
|
|
49
|
+
const myDefaultTheme = require('./mantine/my-default-theme.cjs');
|
|
50
|
+
const formatBytes = require('./utils/formatBytes.cjs');
|
|
51
|
+
const addBodyJsonHook = require('./utils/ky/addBodyJsonHook.cjs');
|
|
52
|
+
const parseJson = require('./utils/ky/parseJson.cjs');
|
|
53
|
+
const groupBy = require('./utils/array/groupBy.cjs');
|
|
54
|
+
const shuffleArray = require('./utils/array/shuffleArray.cjs');
|
|
55
|
+
const newHref = require('./utils/newHref.cjs');
|
|
56
|
+
const isInfinityEmpty = require('./utils/isInfinityEmpty.cjs');
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
exports.EmptyState = index.EmptyState;
|
|
61
|
+
exports.InfinityLoader = index$1.InfinityLoader;
|
|
62
|
+
exports.NavItems = NavItems.NavItems;
|
|
63
|
+
exports.Icon = Icon.Icon;
|
|
64
|
+
exports.MyDatePickerInput = index$2.MyDatePickerInput;
|
|
65
|
+
exports.MyDateTimePicker = index$3.MyDateTimePicker;
|
|
66
|
+
exports.MyNotifications = index$4.MyNotifications;
|
|
67
|
+
exports.MyNumberInput = index$5.MyNumberInput;
|
|
68
|
+
exports.MySelect = index$6.MySelect;
|
|
69
|
+
exports.MyTextarea = index$7.MyTextarea;
|
|
70
|
+
exports.MyTextInput = index$8.MyTextInput;
|
|
71
|
+
exports.MyTimeInput = index$9.MyTimeInput;
|
|
72
|
+
exports.SelectInfinity = index$a.SelectInfinity;
|
|
73
|
+
exports.MyMultiSelect = index$b.MyMultiSelect;
|
|
74
|
+
exports.MyMonthPickerInput = index$c.MyMonthPickerInput;
|
|
75
|
+
exports.HttpStatus = httpStatus.HttpStatus;
|
|
76
|
+
exports.Revalidate = revalidate.Revalidate;
|
|
77
|
+
exports.NavigationHistoryProvider = index$d.NavigationHistoryProvider;
|
|
78
|
+
exports.QP_BACK_URL_NAME = index$d.QP_BACK_URL_NAME;
|
|
79
|
+
exports.useNavigationHistory = index$d.useNavigationHistory;
|
|
80
|
+
exports.PageDataProvider = index$e.PageDataProvider;
|
|
81
|
+
exports.usePageData = index$e.usePageData;
|
|
82
|
+
exports.Form = Form.Form;
|
|
83
|
+
exports.FormButtonSubmit = FormButtonSubmit.FormButtonSubmit;
|
|
84
|
+
exports.zodValidator = zodValidator.zodValidator;
|
|
85
|
+
exports.nullableButRequired = nullableButRequired.nullableButRequired;
|
|
86
|
+
exports.optionalButRequired = optionalButRequired.optionalButRequired;
|
|
87
|
+
exports.FormCheckbox = FormCheckbox.FormCheckbox;
|
|
88
|
+
exports.FormDatePickerInput = FormDatePickerInput.FormDatePickerInput;
|
|
89
|
+
exports.FormDateTimePicker = FormDateTimePicker.FormDateTimePicker;
|
|
90
|
+
exports.FormNumberInput = FormNumberInput.FormNumberInput;
|
|
91
|
+
exports.FormRadioGroup = FormRadioGroup.FormRadioGroup;
|
|
92
|
+
exports.FormSelect = FormSelect.FormSelect;
|
|
93
|
+
exports.FormSelectInfinity = FormSelectInfinity.FormSelectInfinity;
|
|
94
|
+
exports.FormTextarea = FormTextarea.FormTextarea;
|
|
95
|
+
exports.FormTextInput = FormTextInput.FormTextInput;
|
|
96
|
+
exports.FormTimeInput = FormTimeInput.FormTimeInput;
|
|
97
|
+
exports.numberToTimeInput = FormTimeInput.numberToTimeInput;
|
|
98
|
+
exports.timeInputToNumber = FormTimeInput.timeInputToNumber;
|
|
99
|
+
exports.FormMultiSelect = FormMultiSelect.FormMultiSelect;
|
|
100
|
+
exports.FormMonthPickerInput = FormMonthPickerInput.FormMonthPickerInput;
|
|
101
|
+
exports.withForm = withForm.withForm;
|
|
102
|
+
exports.withModalManager = withModalManager.withModalManager;
|
|
103
|
+
exports.useBreakpoint = useBreakpoint.useBreakpoint;
|
|
104
|
+
exports.useFetchNextPageOnScroll = useFetchNextPageOnScroll.useFetchNextPageOnScroll;
|
|
105
|
+
exports.useOnScrollProgress = useOnScrollProgress.useOnScrollProgress;
|
|
106
|
+
exports.useUpdateSearchParams = useUpdateSearchParams.useUpdateSearchParams;
|
|
107
|
+
exports.breakpointsWithPx = breakpointsWithPx.breakpointsWithPx;
|
|
108
|
+
exports.toTailwindColors = toTailwindColors.toTailwindColors;
|
|
109
|
+
exports.myDefaultTheme = myDefaultTheme.myDefaultTheme;
|
|
110
|
+
exports.formatBytes = formatBytes.formatBytes;
|
|
111
|
+
exports.addBodyJsonHook = addBodyJsonHook.addBodyJsonHook;
|
|
112
|
+
exports.parseJSON = parseJson.parseJSON;
|
|
113
|
+
exports.groupBy = groupBy.groupBy;
|
|
114
|
+
exports.indexBy = groupBy.indexBy;
|
|
115
|
+
exports.shuffleArray = shuffleArray.shuffleArray;
|
|
116
|
+
exports.newHref = newHref.newHref;
|
|
117
|
+
exports.isInfinityEmpty = isInfinityEmpty.isInfinityEmpty;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export { EmptyState } from './components/EmptyState/index.js';
|
|
2
|
+
export { InfinityLoader } from './components/InfinityLoader/index.js';
|
|
3
|
+
export { NavItems } from './components/NavItems.js';
|
|
4
|
+
export { Icon } from './components/Icon.js';
|
|
5
|
+
export { MyDatePickerInput } from './components/MyDatePickerInput/index.js';
|
|
6
|
+
export { MyDateTimePicker } from './components/MyDateTimePicker/index.js';
|
|
7
|
+
export { MyNotifications } from './components/MyNotifications/index.js';
|
|
8
|
+
export { MyNumberInput } from './components/MyNumberInput/index.js';
|
|
9
|
+
export { MySelect } from './components/MySelect/index.js';
|
|
10
|
+
export { MyTextarea } from './components/MyTextarea/index.js';
|
|
11
|
+
export { MyTextInput } from './components/MyTextInput/index.js';
|
|
12
|
+
export { MyTimeInput } from './components/MyTimeInput/index.js';
|
|
13
|
+
export { SelectInfinity } from './components/SelectInfinity/index.js';
|
|
14
|
+
export { MyMultiSelect } from './components/MyMultiSelect/index.js';
|
|
15
|
+
export { MyMonthPickerInput } from './components/MyMonthPickerInput/index.js';
|
|
16
|
+
export { HttpStatus } from './consts/http-status.js';
|
|
17
|
+
export { Revalidate } from './consts/revalidate.js';
|
|
18
|
+
export { NavigationHistoryProvider, QP_BACK_URL_NAME, useNavigationHistory } from './contexts/NavigationHistoryContext/index.js';
|
|
19
|
+
export { PageDataProvider, usePageData } from './contexts/PageDataContext/index.js';
|
|
20
|
+
export { Form } from './form/Form.js';
|
|
21
|
+
export { FormButtonSubmit } from './form/FormButtonSubmit.js';
|
|
22
|
+
export { zodValidator } from './form/utils/zodValidator.js';
|
|
23
|
+
export { nullableButRequired } from './form/utils/nullable-but-required.js';
|
|
24
|
+
export { optionalButRequired } from './form/utils/optional-but-required.js';
|
|
25
|
+
export { FormCheckbox } from './form/base/FormCheckbox.js';
|
|
26
|
+
export { FormDatePickerInput } from './form/base/FormDatePickerInput.js';
|
|
27
|
+
export { FormDateTimePicker } from './form/base/FormDateTimePicker.js';
|
|
28
|
+
export { FormNumberInput } from './form/base/FormNumberInput.js';
|
|
29
|
+
export { FormRadioGroup } from './form/base/FormRadioGroup.js';
|
|
30
|
+
export { FormSelect } from './form/base/FormSelect.js';
|
|
31
|
+
export { FormSelectInfinity } from './form/base/FormSelectInfinity.js';
|
|
32
|
+
export { FormTextarea } from './form/base/FormTextarea.js';
|
|
33
|
+
export { FormTextInput } from './form/base/FormTextInput.js';
|
|
34
|
+
export { FormTimeInput, numberToTimeInput, timeInputToNumber } from './form/base/FormTimeInput.js';
|
|
35
|
+
export { FormMultiSelect } from './form/base/FormMultiSelect.js';
|
|
36
|
+
export { FormMonthPickerInput } from './form/base/FormMonthPickerInput.js';
|
|
37
|
+
export { withForm } from './hocs/withForm.js';
|
|
38
|
+
export { withModalManager } from './hocs/withModalManager.js';
|
|
39
|
+
export { useBreakpoint } from './hooks/useBreakpoint.js';
|
|
40
|
+
export { useFetchNextPageOnScroll } from './hooks/useFetchNextPageOnScroll.js';
|
|
41
|
+
export { useOnScrollProgress } from './hooks/useOnScrollProgress.js';
|
|
42
|
+
export { useUpdateSearchParams } from './hooks/useUpdateSearchParams.js';
|
|
43
|
+
export { breakpointsWithPx } from './mantine/breakpoints-with-px.js';
|
|
44
|
+
export { toTailwindColors } from './mantine/to-tailwind-colors.js';
|
|
45
|
+
export { myDefaultTheme } from './mantine/my-default-theme.js';
|
|
46
|
+
export { formatBytes } from './utils/formatBytes.js';
|
|
47
|
+
export { addBodyJsonHook } from './utils/ky/addBodyJsonHook.js';
|
|
48
|
+
export { parseJSON } from './utils/ky/parseJson.js';
|
|
49
|
+
export { groupBy, indexBy } from './utils/array/groupBy.js';
|
|
50
|
+
export { shuffleArray } from './utils/array/shuffleArray.js';
|
|
51
|
+
export { newHref } from './utils/newHref.js';
|
|
52
|
+
export { isInfinityEmpty } from './utils/isInfinityEmpty.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const breakpointsWithPx = {
|
|
6
|
+
xs: "576px",
|
|
7
|
+
sm: "640px",
|
|
8
|
+
md: "768px",
|
|
9
|
+
lg: "1024px",
|
|
10
|
+
xl: "1280px",
|
|
11
|
+
["2xl"]: "1536px"
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.breakpointsWithPx = breakpointsWithPx;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const core = require('@mantine/core');
|
|
6
|
+
const breakpointsWithPx = require('./breakpoints-with-px.cjs');
|
|
7
|
+
|
|
8
|
+
const myDefaultTheme = {
|
|
9
|
+
breakpoints: breakpointsWithPx.breakpointsWithPx,
|
|
10
|
+
cursorType: "pointer",
|
|
11
|
+
components: {
|
|
12
|
+
Notification: core.Notification.extend({
|
|
13
|
+
defaultProps: {
|
|
14
|
+
withBorder: true
|
|
15
|
+
}
|
|
16
|
+
}),
|
|
17
|
+
AppShell: core.AppShell.extend({
|
|
18
|
+
defaultProps: {
|
|
19
|
+
padding: 0
|
|
20
|
+
}
|
|
21
|
+
}),
|
|
22
|
+
Select: core.Select.extend({
|
|
23
|
+
defaultProps: {
|
|
24
|
+
allowDeselect: false,
|
|
25
|
+
withCheckIcon: false,
|
|
26
|
+
clearable: true
|
|
27
|
+
}
|
|
28
|
+
}),
|
|
29
|
+
Menu: core.Menu.extend({
|
|
30
|
+
defaultProps: {
|
|
31
|
+
position: "bottom-end"
|
|
32
|
+
}
|
|
33
|
+
}),
|
|
34
|
+
Tooltip: core.Tooltip.extend({
|
|
35
|
+
defaultProps: {
|
|
36
|
+
multiline: true,
|
|
37
|
+
maw: 300
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
exports.myDefaultTheme = myDefaultTheme;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const toTailwindColors = (colors) => Object.entries(colors).reduce(
|
|
6
|
+
(acc, [key, value]) => {
|
|
7
|
+
acc[key] = value.reduce(
|
|
8
|
+
(acc2, color, index) => {
|
|
9
|
+
acc2[index] = color;
|
|
10
|
+
return acc2;
|
|
11
|
+
},
|
|
12
|
+
{}
|
|
13
|
+
);
|
|
14
|
+
return acc;
|
|
15
|
+
},
|
|
16
|
+
{}
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
exports.toTailwindColors = toTailwindColors;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
function indexBy(arr, getKey, getValue) {
|
|
6
|
+
if (getValue)
|
|
7
|
+
return arr.reduce(
|
|
8
|
+
(acc, item) => {
|
|
9
|
+
const key = getKey(item);
|
|
10
|
+
if (key === void 0) return acc;
|
|
11
|
+
acc[key] = getValue(item);
|
|
12
|
+
return acc;
|
|
13
|
+
},
|
|
14
|
+
{}
|
|
15
|
+
);
|
|
16
|
+
return arr.reduce(
|
|
17
|
+
(acc, item) => {
|
|
18
|
+
const key = getKey(item);
|
|
19
|
+
if (key === void 0) return acc;
|
|
20
|
+
acc[key] = item;
|
|
21
|
+
return acc;
|
|
22
|
+
},
|
|
23
|
+
{}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
const groupBy = (arr, getKey) => {
|
|
27
|
+
const groups = {};
|
|
28
|
+
arr?.forEach((item) => {
|
|
29
|
+
const key = getKey(item);
|
|
30
|
+
if (key === null) return;
|
|
31
|
+
if (Array.isArray(key)) {
|
|
32
|
+
key.forEach((k) => {
|
|
33
|
+
if (!groups[k]) groups[k] = [];
|
|
34
|
+
groups[k]?.push(item);
|
|
35
|
+
});
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (!groups[key]) groups[key] = [];
|
|
39
|
+
groups[key]?.push(item);
|
|
40
|
+
});
|
|
41
|
+
return groups;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
exports.groupBy = groupBy;
|
|
45
|
+
exports.indexBy = indexBy;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const shuffleArray = (array) => {
|
|
6
|
+
const shuffledArray = [...array];
|
|
7
|
+
let currentIndex = shuffledArray.length, randomIndex;
|
|
8
|
+
while (currentIndex > 0) {
|
|
9
|
+
randomIndex = Math.floor(Math.random() * currentIndex);
|
|
10
|
+
currentIndex--;
|
|
11
|
+
[shuffledArray[currentIndex], shuffledArray[randomIndex]] = [
|
|
12
|
+
shuffledArray[randomIndex],
|
|
13
|
+
shuffledArray[currentIndex]
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
return shuffledArray;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
exports.shuffleArray = shuffleArray;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
function formatBytes(bytes, decimals = 2) {
|
|
6
|
+
if (!+bytes) return "0 Bytes";
|
|
7
|
+
const k = 1024;
|
|
8
|
+
const dm = decimals < 0 ? 0 : decimals;
|
|
9
|
+
const sizes = ["Bytes", "KB", "MB"];
|
|
10
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
11
|
+
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports.formatBytes = formatBytes;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const parseJson = require('./parseJson.cjs');
|
|
6
|
+
|
|
7
|
+
const addBodyJsonHook = async (error) => {
|
|
8
|
+
error.response.bodyJson = await parseJson.parseJSON(error.response);
|
|
9
|
+
return error;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
exports.addBodyJsonHook = addBodyJsonHook;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const parseJSON = async (response) => {
|
|
6
|
+
return response.text().then(function(text) {
|
|
7
|
+
return text ? JSON.parse(text) : {};
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
exports.parseJSON = parseJSON;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const queryString = require('query-string');
|
|
6
|
+
|
|
7
|
+
const newHref = (fn) => (args) => {
|
|
8
|
+
const href = typeof fn === "string" ? fn : fn(
|
|
9
|
+
args ?? {
|
|
10
|
+
params: {},
|
|
11
|
+
searchParams: {}
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
if (args?.searchParams) {
|
|
15
|
+
const qs = queryString.stringify(args.searchParams, {
|
|
16
|
+
skipEmptyString: true,
|
|
17
|
+
skipNull: true
|
|
18
|
+
});
|
|
19
|
+
return `${href}${qs ? `?${qs}` : ""}`;
|
|
20
|
+
}
|
|
21
|
+
return href;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
exports.newHref = newHref;
|
package/package.json
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lkd-web-kit",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.19",
|
|
4
4
|
"description": "A template for creating React component libraries with Vite.",
|
|
5
5
|
"author": "LKD",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./dist/index.cjs",
|
|
9
|
+
"module": "./dist/index.js",
|
|
8
10
|
"types": "./dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"require": "./dist/index.cjs",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
9
18
|
"sideEffects": false,
|
|
10
19
|
"files": [
|
|
11
20
|
"dist"
|