lkd-web-kit 0.8.0 → 0.8.2
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 -17
- package/dist/components/MyNotifications/index.js +10 -13
- 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 -10
- package/dist/form/base/FormMultiSelect.js +9 -6
- package/dist/form/base/FormNumberInput.cjs +12 -12
- package/dist/form/base/FormNumberInput.js +10 -8
- 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 +13 -13
- 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 -42
- package/dist/mantine/my-default-theme.js +22 -38
- package/dist/mantine/to-tailwind-colors.cjs +9 -18
- package/dist/mantine/to-tailwind-colors.js +9 -14
- 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 -14
- package/dist/utils/ky/addBodyJsonHook.js +8 -10
- 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 +20 -19
- package/dist/node_modules/@mantine/notifications/styles.css +0 -42
- package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.cjs +0 -74
- package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.js +0 -45
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.cjs +0 -886
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +0 -872
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.cjs +0 -75
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.js +0 -68
package/dist/utils/new-route.js
CHANGED
|
@@ -1,40 +1,35 @@
|
|
|
1
|
-
import { queryStringify } from
|
|
2
|
-
|
|
1
|
+
import { queryStringify } from "./query-stringify.js";
|
|
2
|
+
//#region src/utils/new-route.ts
|
|
3
3
|
function buildPathFromTemplate(path, params) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return encodeURIComponent(String(value));
|
|
10
|
-
});
|
|
4
|
+
return path.replace(/:([a-zA-Z0-9_]+)/g, (_, key) => {
|
|
5
|
+
const value = params[key];
|
|
6
|
+
if (value === void 0) throw new Error(`Falta el parámetro de ruta: ${key}`);
|
|
7
|
+
return encodeURIComponent(String(value));
|
|
8
|
+
});
|
|
11
9
|
}
|
|
12
10
|
function createNewRoute(config) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
return newRoute2;
|
|
11
|
+
const globalQueryBuilder = config?.queryBuilder;
|
|
12
|
+
function getPathStrategy(arg, options) {
|
|
13
|
+
if (options?.pathBuilder) return (params) => options.pathBuilder(params);
|
|
14
|
+
else if (typeof arg === "string") {
|
|
15
|
+
const template = arg;
|
|
16
|
+
return (params) => buildPathFromTemplate(template, params);
|
|
17
|
+
} else {
|
|
18
|
+
const fn = arg;
|
|
19
|
+
return (params) => fn(params);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function newRoute(arg, options) {
|
|
23
|
+
const pathStrategy = getPathStrategy(arg, options);
|
|
24
|
+
const queryBuilder = options?.queryBuilder || globalQueryBuilder;
|
|
25
|
+
const queryStrategy = queryBuilder ? (query) => queryBuilder(query) : queryStringify;
|
|
26
|
+
return (params = {}) => {
|
|
27
|
+
const { query = {}, ...pathParams } = params;
|
|
28
|
+
return pathStrategy(pathParams) + queryStrategy(query);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return newRoute;
|
|
37
32
|
}
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
var newRoute = createNewRoute();
|
|
34
|
+
//#endregion
|
|
40
35
|
export { createNewRoute, newRoute };
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
const queryStringify = (query = {}) => {
|
|
6
|
-
const entries = Object.entries(query).filter(([, value]) => value !== void 0 && value !== null).map(([key, value]) => [key, String(value)]);
|
|
7
|
-
return entries.length ? `?${new URLSearchParams(entries).toString()}` : "";
|
|
1
|
+
//#region src/utils/query-stringify.ts
|
|
2
|
+
var queryStringify = (query = {}) => {
|
|
3
|
+
const entries = Object.entries(query).filter(([, value]) => value !== void 0 && value !== null).map(([key, value]) => [key, String(value)]);
|
|
4
|
+
return entries.length ? `?${new URLSearchParams(entries).toString()}` : "";
|
|
8
5
|
};
|
|
9
|
-
|
|
6
|
+
//#endregion
|
|
10
7
|
exports.queryStringify = queryStringify;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
//#region src/utils/query-stringify.ts
|
|
2
|
+
var queryStringify = (query = {}) => {
|
|
3
|
+
const entries = Object.entries(query).filter(([, value]) => value !== void 0 && value !== null).map(([key, value]) => [key, String(value)]);
|
|
4
|
+
return entries.length ? `?${new URLSearchParams(entries).toString()}` : "";
|
|
4
5
|
};
|
|
5
|
-
|
|
6
|
+
//#endregion
|
|
6
7
|
export { queryStringify };
|
|
@@ -1,30 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
key: item.key
|
|
17
|
-
};
|
|
1
|
+
//#region src/utils/virtual-styles.ts
|
|
2
|
+
var getVirtualItemProps = (item, virtualizer) => {
|
|
3
|
+
return {
|
|
4
|
+
ref: virtualizer.measureElement,
|
|
5
|
+
["data-index"]: item.index,
|
|
6
|
+
style: {
|
|
7
|
+
position: "absolute",
|
|
8
|
+
top: 0,
|
|
9
|
+
left: 0,
|
|
10
|
+
width: "100%",
|
|
11
|
+
transform: `translateY(${item.start - virtualizer.options.scrollMargin}px)`
|
|
12
|
+
},
|
|
13
|
+
key: item.key
|
|
14
|
+
};
|
|
18
15
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
};
|
|
16
|
+
var getVirtualContainerProps = (virtualizer) => {
|
|
17
|
+
return { style: {
|
|
18
|
+
height: virtualizer.getTotalSize(),
|
|
19
|
+
width: "100%",
|
|
20
|
+
position: "relative"
|
|
21
|
+
} };
|
|
27
22
|
};
|
|
28
|
-
|
|
23
|
+
//#endregion
|
|
29
24
|
exports.getVirtualContainerProps = getVirtualContainerProps;
|
|
30
25
|
exports.getVirtualItemProps = getVirtualItemProps;
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
//#region src/utils/virtual-styles.ts
|
|
2
|
+
var getVirtualItemProps = (item, virtualizer) => {
|
|
3
|
+
return {
|
|
4
|
+
ref: virtualizer.measureElement,
|
|
5
|
+
["data-index"]: item.index,
|
|
6
|
+
style: {
|
|
7
|
+
position: "absolute",
|
|
8
|
+
top: 0,
|
|
9
|
+
left: 0,
|
|
10
|
+
width: "100%",
|
|
11
|
+
transform: `translateY(${item.start - virtualizer.options.scrollMargin}px)`
|
|
12
|
+
},
|
|
13
|
+
key: item.key
|
|
14
|
+
};
|
|
14
15
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
};
|
|
16
|
+
var getVirtualContainerProps = (virtualizer) => {
|
|
17
|
+
return { style: {
|
|
18
|
+
height: virtualizer.getTotalSize(),
|
|
19
|
+
width: "100%",
|
|
20
|
+
position: "relative"
|
|
21
|
+
} };
|
|
23
22
|
};
|
|
24
|
-
|
|
23
|
+
//#endregion
|
|
25
24
|
export { getVirtualContainerProps, getVirtualItemProps };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lkd-web-kit",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "A template for creating React component libraries with Vite.",
|
|
5
5
|
"author": "LKD",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"sideEffects": false,
|
|
19
19
|
"engines": {
|
|
20
|
-
"node": ">=22"
|
|
20
|
+
"node": ">=22.12.0"
|
|
21
21
|
},
|
|
22
22
|
"files": ["dist"],
|
|
23
23
|
"scripts": {
|
|
@@ -29,38 +29,39 @@
|
|
|
29
29
|
"prepublishOnly": "npm run build"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@biomejs/biome": "2.
|
|
32
|
+
"@biomejs/biome": "2.4.14",
|
|
33
|
+
"@tanstack/react-virtual": "^3.13.24",
|
|
33
34
|
"@testing-library/jest-dom": "^6.8.0",
|
|
34
35
|
"@testing-library/react": "^16.3.0",
|
|
35
36
|
"@testing-library/user-event": "^14.6.1",
|
|
36
37
|
"@types/node": "^22.17.2",
|
|
37
38
|
"@types/react": "^19.2.14",
|
|
38
39
|
"@types/react-dom": "^19.2.3",
|
|
39
|
-
"@vitejs/plugin-react-swc": "^3.
|
|
40
|
-
"@vitest/coverage-v8": "^
|
|
40
|
+
"@vitejs/plugin-react-swc": "^4.3.0",
|
|
41
|
+
"@vitest/coverage-v8": "^4.1.5",
|
|
41
42
|
"jsdom": "^26.1.0",
|
|
43
|
+
"rollup": "^4.53.3",
|
|
42
44
|
"rollup-preserve-directives": "^1.1.3",
|
|
43
45
|
"typescript": "^5.9.2",
|
|
44
|
-
"vite": "^
|
|
45
|
-
"vite-plugin-dts": "^
|
|
46
|
-
"vitest": "^
|
|
46
|
+
"vite": "^8.0.10",
|
|
47
|
+
"vite-plugin-dts": "^5.0.0",
|
|
48
|
+
"vitest": "^4.1.5"
|
|
47
49
|
},
|
|
48
50
|
"peerDependencies": {
|
|
49
|
-
"@mantine/core": "^9.1.
|
|
50
|
-
"@mantine/dates": "^9.1.
|
|
51
|
-
"@mantine/hooks": "^9.1.
|
|
52
|
-
"@mantine/notifications": "^9.1.
|
|
53
|
-
"@tanstack/react-query": "^5.100.
|
|
51
|
+
"@mantine/core": "^9.1.1",
|
|
52
|
+
"@mantine/dates": "^9.1.1",
|
|
53
|
+
"@mantine/hooks": "^9.1.1",
|
|
54
|
+
"@mantine/notifications": "^9.1.1",
|
|
55
|
+
"@tanstack/react-query": "^5.100.9",
|
|
56
|
+
"@tanstack/react-virtual": "^3.13.24",
|
|
54
57
|
"clsx": "^2.1.1",
|
|
55
58
|
"ky": "^2.0.2",
|
|
56
59
|
"next": "^16.2.4",
|
|
57
60
|
"react": "^19.2.5",
|
|
58
61
|
"react-dom": "^19.2.5",
|
|
59
|
-
"react-hook-form": "^7.
|
|
60
|
-
"react-query-kit": "^3.3.
|
|
61
|
-
"zod": "^4.3
|
|
62
|
+
"react-hook-form": "^7.75.0",
|
|
63
|
+
"react-query-kit": "^3.3.3",
|
|
64
|
+
"zod": "^4.4.3"
|
|
62
65
|
},
|
|
63
|
-
"dependencies": {
|
|
64
|
-
"@tanstack/react-virtual": "^3.13.24"
|
|
65
|
-
}
|
|
66
|
+
"dependencies": {}
|
|
66
67
|
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
.m_b37d9ac7 {
|
|
2
|
-
width: calc(100% - var(--mantine-spacing-md) * 2);
|
|
3
|
-
position: fixed;
|
|
4
|
-
z-index: var(--notifications-z-index);
|
|
5
|
-
max-width: var(--notifications-container-width);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.m_b37d9ac7:where([data-position='top-center']) {
|
|
9
|
-
top: var(--mantine-spacing-md);
|
|
10
|
-
left: 50%;
|
|
11
|
-
transform: translateX(-50%);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.m_b37d9ac7:where([data-position='top-left']) {
|
|
15
|
-
top: var(--mantine-spacing-md);
|
|
16
|
-
left: var(--mantine-spacing-md);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.m_b37d9ac7:where([data-position='top-right']) {
|
|
20
|
-
top: var(--mantine-spacing-md);
|
|
21
|
-
right: var(--mantine-spacing-md);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.m_b37d9ac7:where([data-position='bottom-center']) {
|
|
25
|
-
bottom: var(--mantine-spacing-md);
|
|
26
|
-
left: 50%;
|
|
27
|
-
transform: translateX(-50%);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.m_b37d9ac7:where([data-position='bottom-left']) {
|
|
31
|
-
bottom: var(--mantine-spacing-md);
|
|
32
|
-
left: var(--mantine-spacing-md);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.m_b37d9ac7:where([data-position='bottom-right']) {
|
|
36
|
-
bottom: var(--mantine-spacing-md);
|
|
37
|
-
right: var(--mantine-spacing-md);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.m_5ed0edd0 + .m_5ed0edd0 {
|
|
41
|
-
margin-top: var(--mantine-spacing-md);
|
|
42
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
|
|
5
|
-
const React = require('react');
|
|
6
|
-
const reactDom = require('react-dom');
|
|
7
|
-
const index = require('../../../virtual-core/dist/esm/index.cjs');
|
|
8
|
-
|
|
9
|
-
function _interopNamespaceDefault(e) {
|
|
10
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
11
|
-
if (e) {
|
|
12
|
-
for (const k in e) {
|
|
13
|
-
if (k !== 'default') {
|
|
14
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
get: () => e[k]
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
n.default = e;
|
|
23
|
-
return Object.freeze(n);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
27
|
-
|
|
28
|
-
const useIsomorphicLayoutEffect = typeof document !== "undefined" ? React__namespace.useLayoutEffect : React__namespace.useEffect;
|
|
29
|
-
function useVirtualizerBase({
|
|
30
|
-
useFlushSync = true,
|
|
31
|
-
...options
|
|
32
|
-
}) {
|
|
33
|
-
const rerender = React__namespace.useReducer(() => ({}), {})[1];
|
|
34
|
-
const resolvedOptions = {
|
|
35
|
-
...options,
|
|
36
|
-
onChange: (instance2, sync) => {
|
|
37
|
-
var _a;
|
|
38
|
-
if (useFlushSync && sync) {
|
|
39
|
-
reactDom.flushSync(rerender);
|
|
40
|
-
} else {
|
|
41
|
-
rerender();
|
|
42
|
-
}
|
|
43
|
-
(_a = options.onChange) == null ? void 0 : _a.call(options, instance2, sync);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
const [instance] = React__namespace.useState(
|
|
47
|
-
() => new index.Virtualizer(resolvedOptions)
|
|
48
|
-
);
|
|
49
|
-
instance.setOptions(resolvedOptions);
|
|
50
|
-
useIsomorphicLayoutEffect(() => {
|
|
51
|
-
return instance._didMount();
|
|
52
|
-
}, []);
|
|
53
|
-
useIsomorphicLayoutEffect(() => {
|
|
54
|
-
return instance._willUpdate();
|
|
55
|
-
});
|
|
56
|
-
return instance;
|
|
57
|
-
}
|
|
58
|
-
function useVirtualizer(options) {
|
|
59
|
-
return useVirtualizerBase({
|
|
60
|
-
observeElementRect: index.observeElementRect,
|
|
61
|
-
observeElementOffset: index.observeElementOffset,
|
|
62
|
-
scrollToFn: index.elementScroll,
|
|
63
|
-
...options
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
exports.Virtualizer = index.Virtualizer;
|
|
68
|
-
exports.defaultKeyExtractor = index.defaultKeyExtractor;
|
|
69
|
-
exports.defaultRangeExtractor = index.defaultRangeExtractor;
|
|
70
|
-
exports.elementScroll = index.elementScroll;
|
|
71
|
-
exports.measureElement = index.measureElement;
|
|
72
|
-
exports.observeElementOffset = index.observeElementOffset;
|
|
73
|
-
exports.observeElementRect = index.observeElementRect;
|
|
74
|
-
exports.useVirtualizer = useVirtualizer;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { flushSync } from 'react-dom';
|
|
3
|
-
import { Virtualizer, elementScroll, observeElementOffset, observeElementRect } from '../../../virtual-core/dist/esm/index.js';
|
|
4
|
-
export { defaultKeyExtractor, defaultRangeExtractor, measureElement } from '../../../virtual-core/dist/esm/index.js';
|
|
5
|
-
|
|
6
|
-
const useIsomorphicLayoutEffect = typeof document !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
7
|
-
function useVirtualizerBase({
|
|
8
|
-
useFlushSync = true,
|
|
9
|
-
...options
|
|
10
|
-
}) {
|
|
11
|
-
const rerender = React.useReducer(() => ({}), {})[1];
|
|
12
|
-
const resolvedOptions = {
|
|
13
|
-
...options,
|
|
14
|
-
onChange: (instance2, sync) => {
|
|
15
|
-
var _a;
|
|
16
|
-
if (useFlushSync && sync) {
|
|
17
|
-
flushSync(rerender);
|
|
18
|
-
} else {
|
|
19
|
-
rerender();
|
|
20
|
-
}
|
|
21
|
-
(_a = options.onChange) == null ? void 0 : _a.call(options, instance2, sync);
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
const [instance] = React.useState(
|
|
25
|
-
() => new Virtualizer(resolvedOptions)
|
|
26
|
-
);
|
|
27
|
-
instance.setOptions(resolvedOptions);
|
|
28
|
-
useIsomorphicLayoutEffect(() => {
|
|
29
|
-
return instance._didMount();
|
|
30
|
-
}, []);
|
|
31
|
-
useIsomorphicLayoutEffect(() => {
|
|
32
|
-
return instance._willUpdate();
|
|
33
|
-
});
|
|
34
|
-
return instance;
|
|
35
|
-
}
|
|
36
|
-
function useVirtualizer(options) {
|
|
37
|
-
return useVirtualizerBase({
|
|
38
|
-
observeElementRect,
|
|
39
|
-
observeElementOffset,
|
|
40
|
-
scrollToFn: elementScroll,
|
|
41
|
-
...options
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export { Virtualizer, elementScroll, observeElementOffset, observeElementRect, useVirtualizer };
|