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.
Files changed (136) 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/utils/array/groupBy.cjs +30 -40
  112. package/dist/utils/array/groupBy.js +30 -36
  113. package/dist/utils/array/shuffleArray.cjs +11 -17
  114. package/dist/utils/array/shuffleArray.js +11 -13
  115. package/dist/utils/formatBytes.cjs +12 -11
  116. package/dist/utils/formatBytes.js +12 -7
  117. package/dist/utils/isInfinityEmpty.cjs +3 -6
  118. package/dist/utils/isInfinityEmpty.js +3 -2
  119. package/dist/utils/ky/addBodyJsonHook.cjs +9 -14
  120. package/dist/utils/ky/addBodyJsonHook.js +8 -10
  121. package/dist/utils/ky/parseJson.cjs +6 -9
  122. package/dist/utils/ky/parseJson.js +6 -5
  123. package/dist/utils/new-route.cjs +30 -39
  124. package/dist/utils/new-route.js +30 -35
  125. package/dist/utils/query-stringify.cjs +5 -8
  126. package/dist/utils/query-stringify.js +5 -4
  127. package/dist/utils/virtual-styles.cjs +21 -26
  128. package/dist/utils/virtual-styles.js +21 -22
  129. package/package.json +20 -19
  130. package/dist/node_modules/@mantine/notifications/styles.css +0 -42
  131. package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.cjs +0 -74
  132. package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.js +0 -45
  133. package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.cjs +0 -886
  134. package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +0 -872
  135. package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.cjs +0 -75
  136. package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.js +0 -68
@@ -1,40 +1,35 @@
1
- import { queryStringify } from './query-stringify.js';
2
-
1
+ import { queryStringify } from "./query-stringify.js";
2
+ //#region src/utils/new-route.ts
3
3
  function buildPathFromTemplate(path, params) {
4
- return path.replace(/:([a-zA-Z0-9_]+)/g, (_, key) => {
5
- const value = params[key];
6
- if (value === void 0) {
7
- throw new Error(`Falta el parámetro de ruta: ${key}`);
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
- const globalQueryBuilder = config?.queryBuilder;
14
- function getPathStrategy(arg, options) {
15
- if (options?.pathBuilder) {
16
- return (params) => options.pathBuilder(params);
17
- } else if (typeof arg === "string") {
18
- const template = arg;
19
- return (params) => buildPathFromTemplate(template, params);
20
- } else {
21
- const fn = arg;
22
- return (params) => fn(params);
23
- }
24
- }
25
- function newRoute2(arg, options) {
26
- const pathStrategy = getPathStrategy(arg, options);
27
- const queryBuilder = options?.queryBuilder || globalQueryBuilder;
28
- const queryStrategy = queryBuilder ? (query) => queryBuilder(query) : queryStringify;
29
- return (params = {}) => {
30
- const { query = {}, ...pathParams } = params;
31
- const path = pathStrategy(pathParams);
32
- const queryString = queryStrategy(query);
33
- return path + queryString;
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
- const newRoute = createNewRoute();
39
-
33
+ var newRoute = createNewRoute();
34
+ //#endregion
40
35
  export { createNewRoute, newRoute };
@@ -1,10 +1,7 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
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
- const queryStringify = (query = {}) => {
2
- const entries = Object.entries(query).filter(([, value]) => value !== void 0 && value !== null).map(([key, value]) => [key, String(value)]);
3
- 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()}` : "";
4
5
  };
5
-
6
+ //#endregion
6
7
  export { queryStringify };
@@ -1,30 +1,25 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const getVirtualItemProps = (item, virtualizer) => {
6
- return {
7
- ref: virtualizer.measureElement,
8
- ["data-index"]: item.index,
9
- style: {
10
- position: "absolute",
11
- top: 0,
12
- left: 0,
13
- width: "100%",
14
- transform: `translateY(${item.start - virtualizer.options.scrollMargin}px)`
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
- const getVirtualContainerProps = (virtualizer) => {
20
- return {
21
- style: {
22
- height: virtualizer.getTotalSize(),
23
- width: "100%",
24
- position: "relative"
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
- const getVirtualItemProps = (item, virtualizer) => {
2
- return {
3
- ref: virtualizer.measureElement,
4
- ["data-index"]: item.index,
5
- style: {
6
- position: "absolute",
7
- top: 0,
8
- left: 0,
9
- width: "100%",
10
- transform: `translateY(${item.start - virtualizer.options.scrollMargin}px)`
11
- },
12
- key: item.key
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
- const getVirtualContainerProps = (virtualizer) => {
16
- return {
17
- style: {
18
- height: virtualizer.getTotalSize(),
19
- width: "100%",
20
- position: "relative"
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.0",
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.3.8",
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.11.0",
40
- "@vitest/coverage-v8": "^3.2.4",
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": "^7.1.3",
45
- "vite-plugin-dts": "^4.5.4",
46
- "vitest": "^3.2.4"
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.0",
50
- "@mantine/dates": "^9.1.0",
51
- "@mantine/hooks": "^9.1.0",
52
- "@mantine/notifications": "^9.1.0",
53
- "@tanstack/react-query": "^5.100.0",
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.73.1",
60
- "react-query-kit": "^3.3.2",
61
- "zod": "^4.3.6"
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 };