lkd-web-kit 0.7.31 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/components/EmptyState/index.cjs +38 -52
- package/dist/components/EmptyState/index.js +37 -48
- package/dist/components/Icon.cjs +46 -50
- package/dist/components/Icon.js +44 -46
- package/dist/components/InfinityLoadMoreButton/index.cjs +30 -42
- package/dist/components/InfinityLoadMoreButton/index.js +28 -38
- package/dist/components/InfinitySelect/index.cjs +126 -168
- package/dist/components/InfinitySelect/index.js +125 -164
- package/dist/components/MyCheckboxGroup/index.cjs +14 -22
- package/dist/components/MyCheckboxGroup/index.js +13 -18
- package/dist/components/MyDateInput/index.cjs +12 -18
- package/dist/components/MyDateInput/index.js +11 -14
- package/dist/components/MyDatePickerInput/CalendarIcon.cjs +45 -64
- package/dist/components/MyDatePickerInput/CalendarIcon.js +43 -61
- package/dist/components/MyDatePickerInput/index.cjs +12 -18
- package/dist/components/MyDatePickerInput/index.js +11 -14
- package/dist/components/MyDateTimePicker/index.cjs +12 -18
- package/dist/components/MyDateTimePicker/index.js +11 -14
- package/dist/components/MyMonthPickerInput/index.cjs +12 -18
- package/dist/components/MyMonthPickerInput/index.js +11 -14
- package/dist/components/MyMultiSelect/index.cjs +9 -9
- package/dist/components/MyMultiSelect/index.js +8 -5
- package/dist/components/MyNotifications/index.cjs +11 -16
- package/dist/components/MyNotifications/index.js +10 -12
- package/dist/components/MyNumberInput/index.cjs +9 -15
- package/dist/components/MyNumberInput/index.js +8 -11
- package/dist/components/MyRadioGroup/index.cjs +14 -22
- package/dist/components/MyRadioGroup/index.js +13 -18
- package/dist/components/MySelect/index.cjs +9 -15
- package/dist/components/MySelect/index.js +8 -11
- package/dist/components/MyTextInput/index.cjs +9 -15
- package/dist/components/MyTextInput/index.js +8 -11
- package/dist/components/MyTextarea/index.cjs +9 -15
- package/dist/components/MyTextarea/index.js +8 -11
- package/dist/components/MyTimeInput/index.cjs +9 -15
- package/dist/components/MyTimeInput/index.js +8 -11
- package/dist/components/NavItems.cjs +28 -38
- package/dist/components/NavItems.js +26 -34
- package/dist/consts/http-status.cjs +66 -69
- package/dist/consts/http-status.js +66 -65
- package/dist/consts/revalidate.cjs +10 -13
- package/dist/consts/revalidate.js +10 -9
- package/dist/contexts/NavigationHistoryContext/hook.cjs +41 -42
- package/dist/contexts/NavigationHistoryContext/hook.js +40 -38
- package/dist/contexts/NavigationHistoryContext/index.cjs +31 -28
- package/dist/contexts/NavigationHistoryContext/index.js +30 -24
- package/dist/contexts/PageDataContext/index.cjs +15 -18
- package/dist/contexts/PageDataContext/index.js +14 -14
- package/dist/form/Form.cjs +19 -28
- package/dist/form/Form.js +18 -24
- package/dist/form/FormSubmitButton.cjs +15 -27
- package/dist/form/FormSubmitButton.js +14 -23
- package/dist/form/base/FormCheckbox.cjs +15 -23
- package/dist/form/base/FormCheckbox.js +14 -19
- package/dist/form/base/FormCheckboxGroup.cjs +10 -16
- package/dist/form/base/FormCheckboxGroup.js +9 -12
- package/dist/form/base/FormDateInput.cjs +10 -16
- package/dist/form/base/FormDateInput.js +9 -12
- package/dist/form/base/FormDatePickerInput.cjs +10 -16
- package/dist/form/base/FormDatePickerInput.js +9 -12
- package/dist/form/base/FormDateTimePicker.cjs +10 -16
- package/dist/form/base/FormDateTimePicker.js +9 -12
- package/dist/form/base/FormMonthPickerInput.cjs +10 -16
- package/dist/form/base/FormMonthPickerInput.js +9 -12
- package/dist/form/base/FormMultiSelect.cjs +10 -16
- package/dist/form/base/FormMultiSelect.js +9 -12
- package/dist/form/base/FormNumberInput.cjs +12 -16
- package/dist/form/base/FormNumberInput.js +10 -12
- package/dist/form/base/FormRadioGroup.cjs +10 -16
- package/dist/form/base/FormRadioGroup.js +9 -12
- package/dist/form/base/FormSelect.cjs +10 -16
- package/dist/form/base/FormSelect.js +9 -12
- package/dist/form/base/FormSelectInfinity.cjs +15 -21
- package/dist/form/base/FormSelectInfinity.js +14 -17
- package/dist/form/base/FormTextInput.cjs +10 -16
- package/dist/form/base/FormTextInput.js +9 -12
- package/dist/form/base/FormTextarea.cjs +10 -10
- package/dist/form/base/FormTextarea.js +9 -6
- package/dist/form/base/FormTimeInput.cjs +18 -24
- package/dist/form/base/FormTimeInput.js +17 -20
- package/dist/form/utils/nullable-but-required.cjs +14 -17
- package/dist/form/utils/nullable-but-required.js +13 -13
- package/dist/form/utils/optional-but-required.cjs +14 -17
- package/dist/form/utils/optional-but-required.js +13 -13
- package/dist/form/utils/zodValidator.cjs +9 -13
- package/dist/form/utils/zodValidator.js +9 -9
- package/dist/hocs/withController.cjs +43 -54
- package/dist/hocs/withController.js +42 -50
- package/dist/hocs/withModalManager.cjs +29 -35
- package/dist/hocs/withModalManager.js +28 -31
- package/dist/hooks/useBreakpoint.cjs +8 -12
- package/dist/hooks/useBreakpoint.js +7 -8
- package/dist/hooks/useFetchNextPageOnScroll.cjs +13 -21
- package/dist/hooks/useFetchNextPageOnScroll.js +13 -17
- package/dist/hooks/useOnScrollProgress.cjs +33 -37
- package/dist/hooks/useOnScrollProgress.js +32 -33
- package/dist/hooks/useUpdateSearchParams.cjs +22 -22
- package/dist/hooks/useUpdateSearchParams.js +21 -18
- package/dist/hooks/useZodConfig.cjs +14 -19
- package/dist/hooks/useZodConfig.js +12 -15
- package/dist/index.cjs +130 -136
- package/dist/index.d.ts +14 -16
- package/dist/index.js +62 -61
- package/dist/mantine/breakpoints-with-px.cjs +9 -12
- package/dist/mantine/breakpoints-with-px.js +9 -8
- package/dist/mantine/my-default-theme.cjs +23 -41
- package/dist/mantine/my-default-theme.js +22 -37
- package/dist/mantine/to-tailwind-colors.cjs +9 -18
- package/dist/mantine/to-tailwind-colors.js +9 -14
- package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.cjs +35 -70
- package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.js +34 -42
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.cjs +700 -811
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +701 -804
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.cjs +44 -64
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.js +44 -60
- package/dist/utils/array/groupBy.cjs +30 -40
- package/dist/utils/array/groupBy.js +30 -36
- package/dist/utils/array/shuffleArray.cjs +11 -17
- package/dist/utils/array/shuffleArray.js +11 -13
- package/dist/utils/formatBytes.cjs +12 -11
- package/dist/utils/formatBytes.js +12 -7
- package/dist/utils/isInfinityEmpty.cjs +3 -6
- package/dist/utils/isInfinityEmpty.js +3 -2
- package/dist/utils/ky/addBodyJsonHook.cjs +9 -10
- package/dist/utils/ky/addBodyJsonHook.js +8 -6
- package/dist/utils/ky/parseJson.cjs +6 -9
- package/dist/utils/ky/parseJson.js +6 -5
- package/dist/utils/new-route.cjs +30 -39
- package/dist/utils/new-route.js +30 -35
- package/dist/utils/query-stringify.cjs +5 -8
- package/dist/utils/query-stringify.js +5 -4
- package/dist/utils/virtual-styles.cjs +21 -26
- package/dist/utils/virtual-styles.js +21 -22
- package/package.json +67 -65
|
@@ -1,66 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
1
|
+
//#region src/consts/http-status.ts
|
|
2
|
+
var HttpStatus = /* @__PURE__ */ function(HttpStatus) {
|
|
3
|
+
HttpStatus[HttpStatus["Continue"] = 100] = "Continue";
|
|
4
|
+
HttpStatus[HttpStatus["SwitchingProtocols"] = 101] = "SwitchingProtocols";
|
|
5
|
+
HttpStatus[HttpStatus["Processing"] = 102] = "Processing";
|
|
6
|
+
HttpStatus[HttpStatus["EarlyHints"] = 103] = "EarlyHints";
|
|
7
|
+
HttpStatus[HttpStatus["Ok"] = 200] = "Ok";
|
|
8
|
+
HttpStatus[HttpStatus["Created"] = 201] = "Created";
|
|
9
|
+
HttpStatus[HttpStatus["Accepted"] = 202] = "Accepted";
|
|
10
|
+
HttpStatus[HttpStatus["NonAuthoritativeInformation"] = 203] = "NonAuthoritativeInformation";
|
|
11
|
+
HttpStatus[HttpStatus["NoContent"] = 204] = "NoContent";
|
|
12
|
+
HttpStatus[HttpStatus["ResetContent"] = 205] = "ResetContent";
|
|
13
|
+
HttpStatus[HttpStatus["PartialContent"] = 206] = "PartialContent";
|
|
14
|
+
HttpStatus[HttpStatus["MultiStatus"] = 207] = "MultiStatus";
|
|
15
|
+
HttpStatus[HttpStatus["AlreadyReported"] = 208] = "AlreadyReported";
|
|
16
|
+
HttpStatus[HttpStatus["ImUsed"] = 226] = "ImUsed";
|
|
17
|
+
HttpStatus[HttpStatus["MultipleChoices"] = 300] = "MultipleChoices";
|
|
18
|
+
HttpStatus[HttpStatus["MovedPermanently"] = 301] = "MovedPermanently";
|
|
19
|
+
HttpStatus[HttpStatus["Found"] = 302] = "Found";
|
|
20
|
+
HttpStatus[HttpStatus["SeeOther"] = 303] = "SeeOther";
|
|
21
|
+
HttpStatus[HttpStatus["NotModified"] = 304] = "NotModified";
|
|
22
|
+
HttpStatus[HttpStatus["UseProxy"] = 305] = "UseProxy";
|
|
23
|
+
HttpStatus[HttpStatus["TemporaryRedirect"] = 307] = "TemporaryRedirect";
|
|
24
|
+
HttpStatus[HttpStatus["PermanentRedirect"] = 308] = "PermanentRedirect";
|
|
25
|
+
HttpStatus[HttpStatus["BadRequest"] = 400] = "BadRequest";
|
|
26
|
+
HttpStatus[HttpStatus["Unauthorized"] = 401] = "Unauthorized";
|
|
27
|
+
HttpStatus[HttpStatus["PaymentRequired"] = 402] = "PaymentRequired";
|
|
28
|
+
HttpStatus[HttpStatus["Forbidden"] = 403] = "Forbidden";
|
|
29
|
+
HttpStatus[HttpStatus["NotFound"] = 404] = "NotFound";
|
|
30
|
+
HttpStatus[HttpStatus["MethodNotAllowed"] = 405] = "MethodNotAllowed";
|
|
31
|
+
HttpStatus[HttpStatus["NotAcceptable"] = 406] = "NotAcceptable";
|
|
32
|
+
HttpStatus[HttpStatus["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
|
|
33
|
+
HttpStatus[HttpStatus["RequestTimeout"] = 408] = "RequestTimeout";
|
|
34
|
+
HttpStatus[HttpStatus["Conflict"] = 409] = "Conflict";
|
|
35
|
+
HttpStatus[HttpStatus["Gone"] = 410] = "Gone";
|
|
36
|
+
HttpStatus[HttpStatus["LengthRequired"] = 411] = "LengthRequired";
|
|
37
|
+
HttpStatus[HttpStatus["PreconditionFailed"] = 412] = "PreconditionFailed";
|
|
38
|
+
HttpStatus[HttpStatus["PayloadTooLarge"] = 413] = "PayloadTooLarge";
|
|
39
|
+
HttpStatus[HttpStatus["UriTooLong"] = 414] = "UriTooLong";
|
|
40
|
+
HttpStatus[HttpStatus["UnsupportedMediaType"] = 415] = "UnsupportedMediaType";
|
|
41
|
+
HttpStatus[HttpStatus["RangeNotSatisfiable"] = 416] = "RangeNotSatisfiable";
|
|
42
|
+
HttpStatus[HttpStatus["ExpectationFailed"] = 417] = "ExpectationFailed";
|
|
43
|
+
HttpStatus[HttpStatus["MisdirectedRequest"] = 421] = "MisdirectedRequest";
|
|
44
|
+
HttpStatus[HttpStatus["UnprocessableEntity"] = 422] = "UnprocessableEntity";
|
|
45
|
+
HttpStatus[HttpStatus["Locked"] = 423] = "Locked";
|
|
46
|
+
HttpStatus[HttpStatus["FailedDependency"] = 424] = "FailedDependency";
|
|
47
|
+
HttpStatus[HttpStatus["TooEarly"] = 425] = "TooEarly";
|
|
48
|
+
HttpStatus[HttpStatus["UpgradeRequired"] = 426] = "UpgradeRequired";
|
|
49
|
+
HttpStatus[HttpStatus["PreconditionRequired"] = 428] = "PreconditionRequired";
|
|
50
|
+
HttpStatus[HttpStatus["TooManyRequests"] = 429] = "TooManyRequests";
|
|
51
|
+
HttpStatus[HttpStatus["RequestHeaderFieldsTooLarge"] = 431] = "RequestHeaderFieldsTooLarge";
|
|
52
|
+
HttpStatus[HttpStatus["UnavailableForLegalReasons"] = 451] = "UnavailableForLegalReasons";
|
|
53
|
+
HttpStatus[HttpStatus["InternalServerError"] = 500] = "InternalServerError";
|
|
54
|
+
HttpStatus[HttpStatus["NotImplemented"] = 501] = "NotImplemented";
|
|
55
|
+
HttpStatus[HttpStatus["BadGateway"] = 502] = "BadGateway";
|
|
56
|
+
HttpStatus[HttpStatus["ServiceUnavailable"] = 503] = "ServiceUnavailable";
|
|
57
|
+
HttpStatus[HttpStatus["GatewayTimeout"] = 504] = "GatewayTimeout";
|
|
58
|
+
HttpStatus[HttpStatus["HttpVersionNotSupported"] = 505] = "HttpVersionNotSupported";
|
|
59
|
+
HttpStatus[HttpStatus["VariantAlsoNegotiates"] = 506] = "VariantAlsoNegotiates";
|
|
60
|
+
HttpStatus[HttpStatus["InsufficientStorage"] = 507] = "InsufficientStorage";
|
|
61
|
+
HttpStatus[HttpStatus["LoopDetected"] = 508] = "LoopDetected";
|
|
62
|
+
HttpStatus[HttpStatus["NotExtended"] = 510] = "NotExtended";
|
|
63
|
+
HttpStatus[HttpStatus["NetworkAuthenticationRequired"] = 511] = "NetworkAuthenticationRequired";
|
|
64
|
+
return HttpStatus;
|
|
65
|
+
}({});
|
|
66
|
+
//#endregion
|
|
66
67
|
export { HttpStatus };
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return Revalidate2;
|
|
12
|
-
})(Revalidate || {});
|
|
13
|
-
|
|
1
|
+
//#region src/consts/revalidate.ts
|
|
2
|
+
var Revalidate = /* @__PURE__ */ function(Revalidate) {
|
|
3
|
+
Revalidate[Revalidate["OneHour"] = 3600] = "OneHour";
|
|
4
|
+
Revalidate[Revalidate["OneDay"] = 86400] = "OneDay";
|
|
5
|
+
Revalidate[Revalidate["OneWeek"] = 604800] = "OneWeek";
|
|
6
|
+
Revalidate[Revalidate["OneMonth"] = 2592e3] = "OneMonth";
|
|
7
|
+
Revalidate[Revalidate["OneYear"] = 31536e3] = "OneYear";
|
|
8
|
+
return Revalidate;
|
|
9
|
+
}({});
|
|
10
|
+
//#endregion
|
|
14
11
|
exports.Revalidate = Revalidate;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
//#region src/consts/revalidate.ts
|
|
2
|
+
var Revalidate = /* @__PURE__ */ function(Revalidate) {
|
|
3
|
+
Revalidate[Revalidate["OneHour"] = 3600] = "OneHour";
|
|
4
|
+
Revalidate[Revalidate["OneDay"] = 86400] = "OneDay";
|
|
5
|
+
Revalidate[Revalidate["OneWeek"] = 604800] = "OneWeek";
|
|
6
|
+
Revalidate[Revalidate["OneMonth"] = 2592e3] = "OneMonth";
|
|
7
|
+
Revalidate[Revalidate["OneYear"] = 31536e3] = "OneYear";
|
|
8
|
+
return Revalidate;
|
|
9
|
+
}({});
|
|
10
|
+
//#endregion
|
|
10
11
|
export { Revalidate };
|
|
@@ -1,46 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const index = require('./index.cjs');
|
|
8
|
-
|
|
9
|
-
const QP_BACK_URL_NAME = "backUrl";
|
|
1
|
+
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_index = require("./index.cjs");
|
|
3
|
+
let react = require("react");
|
|
4
|
+
let next_navigation = require("next/navigation");
|
|
5
|
+
//#region src/contexts/NavigationHistoryContext/hook.ts
|
|
6
|
+
var QP_BACK_URL_NAME = "backUrl";
|
|
10
7
|
function useNavigationHistory() {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
8
|
+
const context = (0, react.useContext)(require_index.NavigationHistoryContext);
|
|
9
|
+
const router = (0, next_navigation.useRouter)();
|
|
10
|
+
if (!context) throw new Error("useNavigationHistory debe usarse dentro de un NavigationHistoryProvider");
|
|
11
|
+
const searchParams = (0, next_navigation.useSearchParams)();
|
|
12
|
+
const { history } = context;
|
|
13
|
+
/**
|
|
14
|
+
* Navega hacia atrás en el historial o a la ruta de fallback
|
|
15
|
+
* @param {string} fallback - Ruta a la que ir si no hay historial previo
|
|
16
|
+
*/
|
|
17
|
+
const goBack = (fallback) => {
|
|
18
|
+
const returnUrl = searchParams.get(QP_BACK_URL_NAME);
|
|
19
|
+
if (returnUrl) {
|
|
20
|
+
router.push(returnUrl);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (history.length <= 1) {
|
|
24
|
+
router.push(fallback ?? "/");
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const previousRoute = history[history.length - 2];
|
|
28
|
+
const currentRoute = history[history.length - 1];
|
|
29
|
+
if (history.length >= 3 && history[history.length - 3] === currentRoute) {
|
|
30
|
+
router.push(fallback ?? "/");
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
router.push(previousRoute ?? "/");
|
|
34
|
+
};
|
|
35
|
+
return {
|
|
36
|
+
history,
|
|
37
|
+
goBack,
|
|
38
|
+
currentRoute: history.length > 0 ? history[history.length - 1] : null,
|
|
39
|
+
hasPreviousRoute: history.length > 1,
|
|
40
|
+
getPreviousRoute: () => history.length >= 2 ? history[history.length - 2] : null
|
|
41
|
+
};
|
|
43
42
|
}
|
|
44
|
-
|
|
43
|
+
//#endregion
|
|
45
44
|
exports.QP_BACK_URL_NAME = QP_BACK_URL_NAME;
|
|
46
45
|
exports.useNavigationHistory = useNavigationHistory;
|
|
@@ -1,41 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useContext } from
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { NavigationHistoryContext } from "./index.js";
|
|
2
|
+
import { useContext } from "react";
|
|
3
|
+
import { useRouter, useSearchParams } from "next/navigation";
|
|
4
|
+
//#region src/contexts/NavigationHistoryContext/hook.ts
|
|
5
|
+
var QP_BACK_URL_NAME = "backUrl";
|
|
6
6
|
function useNavigationHistory() {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
7
|
+
const context = useContext(NavigationHistoryContext);
|
|
8
|
+
const router = useRouter();
|
|
9
|
+
if (!context) throw new Error("useNavigationHistory debe usarse dentro de un NavigationHistoryProvider");
|
|
10
|
+
const searchParams = useSearchParams();
|
|
11
|
+
const { history } = context;
|
|
12
|
+
/**
|
|
13
|
+
* Navega hacia atrás en el historial o a la ruta de fallback
|
|
14
|
+
* @param {string} fallback - Ruta a la que ir si no hay historial previo
|
|
15
|
+
*/
|
|
16
|
+
const goBack = (fallback) => {
|
|
17
|
+
const returnUrl = searchParams.get(QP_BACK_URL_NAME);
|
|
18
|
+
if (returnUrl) {
|
|
19
|
+
router.push(returnUrl);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (history.length <= 1) {
|
|
23
|
+
router.push(fallback ?? "/");
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const previousRoute = history[history.length - 2];
|
|
27
|
+
const currentRoute = history[history.length - 1];
|
|
28
|
+
if (history.length >= 3 && history[history.length - 3] === currentRoute) {
|
|
29
|
+
router.push(fallback ?? "/");
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
router.push(previousRoute ?? "/");
|
|
33
|
+
};
|
|
34
|
+
return {
|
|
35
|
+
history,
|
|
36
|
+
goBack,
|
|
37
|
+
currentRoute: history.length > 0 ? history[history.length - 1] : null,
|
|
38
|
+
hasPreviousRoute: history.length > 1,
|
|
39
|
+
getPreviousRoute: () => history.length >= 2 ? history[history.length - 2] : null
|
|
40
|
+
};
|
|
39
41
|
}
|
|
40
|
-
|
|
42
|
+
//#endregion
|
|
41
43
|
export { QP_BACK_URL_NAME, useNavigationHistory };
|
|
@@ -1,34 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const React = require('react');
|
|
9
|
-
|
|
10
|
-
const NavigationHistoryContext = React.createContext(null);
|
|
1
|
+
"use client";
|
|
2
|
+
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
let react = require("react");
|
|
4
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
+
let next_navigation = require("next/navigation");
|
|
6
|
+
//#region src/contexts/NavigationHistoryContext/index.tsx
|
|
7
|
+
var NavigationHistoryContext = (0, react.createContext)(null);
|
|
11
8
|
function NavigationHistoryProvider({ children }) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
const historyRef = (0, react.useRef)([]);
|
|
10
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(NavigationHistoryContext.Provider, {
|
|
11
|
+
value: { history: historyRef.current },
|
|
12
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Suspense, {
|
|
13
|
+
fallback: null,
|
|
14
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HistoryTracker, { historyRef })
|
|
15
|
+
}), children]
|
|
16
|
+
});
|
|
17
17
|
}
|
|
18
18
|
function HistoryTracker({ historyRef }) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
const pathname = (0, next_navigation.usePathname)();
|
|
20
|
+
const searchParams = (0, next_navigation.useSearchParams)();
|
|
21
|
+
(0, react.useEffect)(() => {
|
|
22
|
+
const fullPath = searchParams?.size ? `${pathname}?${searchParams.toString()}` : pathname;
|
|
23
|
+
if (fullPath) {
|
|
24
|
+
const currentHistory = historyRef.current;
|
|
25
|
+
if (currentHistory.length > 0 && currentHistory[currentHistory.length - 1] === fullPath) return;
|
|
26
|
+
historyRef.current = [...currentHistory, fullPath];
|
|
27
|
+
}
|
|
28
|
+
}, [
|
|
29
|
+
pathname,
|
|
30
|
+
searchParams,
|
|
31
|
+
historyRef
|
|
32
|
+
]);
|
|
33
|
+
return null;
|
|
31
34
|
}
|
|
32
|
-
|
|
35
|
+
//#endregion
|
|
33
36
|
exports.NavigationHistoryContext = NavigationHistoryContext;
|
|
34
37
|
exports.NavigationHistoryProvider = NavigationHistoryProvider;
|
|
@@ -1,29 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { Suspense, createContext, useEffect, useRef } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { usePathname, useSearchParams } from "next/navigation";
|
|
5
|
+
//#region src/contexts/NavigationHistoryContext/index.tsx
|
|
6
|
+
var NavigationHistoryContext = createContext(null);
|
|
7
7
|
function NavigationHistoryProvider({ children }) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
const historyRef = useRef([]);
|
|
9
|
+
return /* @__PURE__ */ jsxs(NavigationHistoryContext.Provider, {
|
|
10
|
+
value: { history: historyRef.current },
|
|
11
|
+
children: [/* @__PURE__ */ jsx(Suspense, {
|
|
12
|
+
fallback: null,
|
|
13
|
+
children: /* @__PURE__ */ jsx(HistoryTracker, { historyRef })
|
|
14
|
+
}), children]
|
|
15
|
+
});
|
|
13
16
|
}
|
|
14
17
|
function HistoryTracker({ historyRef }) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
const pathname = usePathname();
|
|
19
|
+
const searchParams = useSearchParams();
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const fullPath = searchParams?.size ? `${pathname}?${searchParams.toString()}` : pathname;
|
|
22
|
+
if (fullPath) {
|
|
23
|
+
const currentHistory = historyRef.current;
|
|
24
|
+
if (currentHistory.length > 0 && currentHistory[currentHistory.length - 1] === fullPath) return;
|
|
25
|
+
historyRef.current = [...currentHistory, fullPath];
|
|
26
|
+
}
|
|
27
|
+
}, [
|
|
28
|
+
pathname,
|
|
29
|
+
searchParams,
|
|
30
|
+
historyRef
|
|
31
|
+
]);
|
|
32
|
+
return null;
|
|
27
33
|
}
|
|
28
|
-
|
|
34
|
+
//#endregion
|
|
29
35
|
export { NavigationHistoryContext, NavigationHistoryProvider };
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const data = React.useContext(PageData);
|
|
16
|
-
if (data === void 0) throw new Error("Out of context: usePageData");
|
|
17
|
-
return data;
|
|
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/contexts/PageDataContext/index.tsx
|
|
6
|
+
var PageData = (0, react.createContext)(void 0);
|
|
7
|
+
var PageDataProvider = ({ value, children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PageData.Provider, {
|
|
8
|
+
value,
|
|
9
|
+
children
|
|
10
|
+
});
|
|
11
|
+
var usePageData = () => {
|
|
12
|
+
const data = (0, react.useContext)(PageData);
|
|
13
|
+
if (data === void 0) throw new Error("Out of context: usePageData");
|
|
14
|
+
return data;
|
|
18
15
|
};
|
|
19
|
-
|
|
16
|
+
//#endregion
|
|
20
17
|
exports.PageDataProvider = PageDataProvider;
|
|
21
18
|
exports.usePageData = usePageData;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/contexts/PageDataContext/index.tsx
|
|
5
|
+
var PageData = createContext(void 0);
|
|
6
|
+
var PageDataProvider = ({ value, children }) => /* @__PURE__ */ jsx(PageData.Provider, {
|
|
7
|
+
value,
|
|
8
|
+
children
|
|
9
|
+
});
|
|
10
|
+
var usePageData = () => {
|
|
11
|
+
const data = useContext(PageData);
|
|
12
|
+
if (data === void 0) throw new Error("Out of context: usePageData");
|
|
13
|
+
return data;
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
//#endregion
|
|
16
16
|
export { PageDataProvider, usePageData };
|
package/dist/form/Form.cjs
CHANGED
|
@@ -1,30 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
{
|
|
20
|
-
component: "form",
|
|
21
|
-
onSubmit: (e) => {
|
|
22
|
-
e.stopPropagation();
|
|
23
|
-
methods.handleSubmit(onSubmit, onSubmitError)(e);
|
|
24
|
-
},
|
|
25
|
-
...rest
|
|
26
|
-
}
|
|
27
|
-
) });
|
|
1
|
+
"use client";
|
|
2
|
+
require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
|
+
let _mantine_core = require("@mantine/core");
|
|
5
|
+
let react_hook_form = require("react-hook-form");
|
|
6
|
+
//#region src/form/Form.tsx
|
|
7
|
+
var Form = ({ methods, onSubmit = () => {}, onSubmitError, ...rest }) => {
|
|
8
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_hook_form.FormProvider, {
|
|
9
|
+
...methods,
|
|
10
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Box, {
|
|
11
|
+
component: "form",
|
|
12
|
+
onSubmit: (e) => {
|
|
13
|
+
e.stopPropagation();
|
|
14
|
+
methods.handleSubmit(onSubmit, onSubmitError)(e);
|
|
15
|
+
},
|
|
16
|
+
...rest
|
|
17
|
+
})
|
|
18
|
+
});
|
|
28
19
|
};
|
|
29
|
-
|
|
20
|
+
//#endregion
|
|
30
21
|
exports.Form = Form;
|