@usefragments/ui 1.0.0 → 1.0.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/README.md +7 -2
- package/dist/components/DataTable/DataTable.virtual.cjs +7 -7
- package/dist/components/DataTable/DataTable.virtual.js +1 -1
- package/package.json +3 -40
- package/dist/node_modules/.pnpm/@tanstack_react-virtual@3.13.18_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@tanstack/react-virtual/dist/esm/index.cjs +0 -68
- package/dist/node_modules/.pnpm/@tanstack_react-virtual@3.13.18_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@tanstack/react-virtual/dist/esm/index.js +0 -52
- package/dist/node_modules/.pnpm/@tanstack_virtual-core@3.13.18/node_modules/@tanstack/virtual-core/dist/esm/index.cjs +0 -822
- package/dist/node_modules/.pnpm/@tanstack_virtual-core@3.13.18/node_modules/@tanstack/virtual-core/dist/esm/index.js +0 -822
- package/dist/node_modules/.pnpm/@tanstack_virtual-core@3.13.18/node_modules/@tanstack/virtual-core/dist/esm/utils.cjs +0 -72
- package/dist/node_modules/.pnpm/@tanstack_virtual-core@3.13.18/node_modules/@tanstack/virtual-core/dist/esm/utils.js +0 -72
package/README.md
CHANGED
|
@@ -18,10 +18,15 @@ pnpm add @usefragments/ui
|
|
|
18
18
|
# or: npm install @usefragments/ui
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
The root export includes the advanced table, editor, markdown, chart, date,
|
|
22
|
+
color, and code components. Their libraries are therefore required peers rather
|
|
23
|
+
than optional peers. npm and pnpm install them automatically by default. If peer
|
|
24
|
+
auto-install is disabled, install the full peer set explicitly:
|
|
22
25
|
|
|
23
26
|
```bash
|
|
24
|
-
npm install react react-dom
|
|
27
|
+
npm install react react-dom @tanstack/react-table @tanstack/react-virtual \
|
|
28
|
+
@tiptap/extension-link @tiptap/react @tiptap/starter-kit date-fns \
|
|
29
|
+
react-colorful react-day-picker react-markdown recharts remark-gfm shiki
|
|
25
30
|
```
|
|
26
31
|
|
|
27
32
|
## Setup
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
|
-
const
|
|
5
|
+
const reactVirtual = require("@tanstack/react-virtual");
|
|
6
6
|
const table = require("../../table.cjs");
|
|
7
7
|
function _interopNamespaceDefault(e) {
|
|
8
8
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -58,19 +58,19 @@ function useTableVirtualizer({
|
|
|
58
58
|
}) {
|
|
59
59
|
const itemsRef = React__namespace.useRef(items);
|
|
60
60
|
itemsRef.current = items;
|
|
61
|
-
const virtualizer =
|
|
61
|
+
const virtualizer = reactVirtual.useVirtualizer({
|
|
62
62
|
count: enabled ? items.length : 0,
|
|
63
63
|
getScrollElement,
|
|
64
|
-
estimateSize: (
|
|
64
|
+
estimateSize: (index) => estimateSize(itemsRef.current[index], index),
|
|
65
65
|
overscan,
|
|
66
|
-
getItemKey: getItemKey ? (
|
|
66
|
+
getItemKey: getItemKey ? (index) => getItemKey(itemsRef.current[index], index) : void 0
|
|
67
67
|
});
|
|
68
68
|
if (!enabled) {
|
|
69
69
|
return {
|
|
70
|
-
virtualRows: items.map((item,
|
|
71
|
-
index
|
|
70
|
+
virtualRows: items.map((item, index) => ({
|
|
71
|
+
index,
|
|
72
72
|
item,
|
|
73
|
-
key: (getItemKey == null ? void 0 : getItemKey(item,
|
|
73
|
+
key: (getItemKey == null ? void 0 : getItemKey(item, index)) ?? index
|
|
74
74
|
})),
|
|
75
75
|
paddingTop: 0,
|
|
76
76
|
paddingBottom: 0,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { useVirtualizer } from "
|
|
3
|
+
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
4
4
|
import { Table } from "../../table.js";
|
|
5
5
|
function DataTableVirtualRoot({
|
|
6
6
|
caption,
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usefragments/ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Customizable UI components built on Base UI headless primitives",
|
|
6
6
|
"author": "Conan McNicholl",
|
|
7
7
|
"homepage": "https://usefragments.com",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "https://github.com/fragments-sdk/
|
|
10
|
+
"url": "https://github.com/fragments-sdk/fragments",
|
|
11
|
+
"directory": "libs/ui"
|
|
11
12
|
},
|
|
12
13
|
"type": "module",
|
|
13
14
|
"main": "dist/index.cjs",
|
|
@@ -154,44 +155,6 @@
|
|
|
154
155
|
"remark-gfm": ">=4.0.0",
|
|
155
156
|
"shiki": ">=1.0.0"
|
|
156
157
|
},
|
|
157
|
-
"peerDependenciesMeta": {
|
|
158
|
-
"react-markdown": {
|
|
159
|
-
"optional": true
|
|
160
|
-
},
|
|
161
|
-
"recharts": {
|
|
162
|
-
"optional": true
|
|
163
|
-
},
|
|
164
|
-
"remark-gfm": {
|
|
165
|
-
"optional": true
|
|
166
|
-
},
|
|
167
|
-
"react-day-picker": {
|
|
168
|
-
"optional": true
|
|
169
|
-
},
|
|
170
|
-
"date-fns": {
|
|
171
|
-
"optional": true
|
|
172
|
-
},
|
|
173
|
-
"shiki": {
|
|
174
|
-
"optional": true
|
|
175
|
-
},
|
|
176
|
-
"react-colorful": {
|
|
177
|
-
"optional": true
|
|
178
|
-
},
|
|
179
|
-
"@tanstack/react-table": {
|
|
180
|
-
"optional": true
|
|
181
|
-
},
|
|
182
|
-
"@tanstack/react-virtual": {
|
|
183
|
-
"optional": true
|
|
184
|
-
},
|
|
185
|
-
"@tiptap/react": {
|
|
186
|
-
"optional": true
|
|
187
|
-
},
|
|
188
|
-
"@tiptap/starter-kit": {
|
|
189
|
-
"optional": true
|
|
190
|
-
},
|
|
191
|
-
"@tiptap/extension-link": {
|
|
192
|
-
"optional": true
|
|
193
|
-
}
|
|
194
|
-
},
|
|
195
158
|
"scarfSettings": {
|
|
196
159
|
"defaultOptIn": true
|
|
197
160
|
},
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const reactDom = require("react-dom");
|
|
5
|
-
const index = require("../../../../../../@tanstack_virtual-core@3.13.18/node_modules/@tanstack/virtual-core/dist/esm/index.cjs");
|
|
6
|
-
function _interopNamespaceDefault(e) {
|
|
7
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
8
|
-
if (e) {
|
|
9
|
-
for (const k in e) {
|
|
10
|
-
if (k !== "default") {
|
|
11
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: () => e[k]
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
n.default = e;
|
|
20
|
-
return Object.freeze(n);
|
|
21
|
-
}
|
|
22
|
-
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
23
|
-
const useIsomorphicLayoutEffect = typeof document !== "undefined" ? React__namespace.useLayoutEffect : React__namespace.useEffect;
|
|
24
|
-
function useVirtualizerBase({
|
|
25
|
-
useFlushSync = true,
|
|
26
|
-
...options
|
|
27
|
-
}) {
|
|
28
|
-
const rerender = React__namespace.useReducer(() => ({}), {})[1];
|
|
29
|
-
const resolvedOptions = {
|
|
30
|
-
...options,
|
|
31
|
-
onChange: (instance2, sync) => {
|
|
32
|
-
var _a;
|
|
33
|
-
if (useFlushSync && sync) {
|
|
34
|
-
reactDom.flushSync(rerender);
|
|
35
|
-
} else {
|
|
36
|
-
rerender();
|
|
37
|
-
}
|
|
38
|
-
(_a = options.onChange) == null ? void 0 : _a.call(options, instance2, sync);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
const [instance] = React__namespace.useState(
|
|
42
|
-
() => new index.Virtualizer(resolvedOptions)
|
|
43
|
-
);
|
|
44
|
-
instance.setOptions(resolvedOptions);
|
|
45
|
-
useIsomorphicLayoutEffect(() => {
|
|
46
|
-
return instance._didMount();
|
|
47
|
-
}, []);
|
|
48
|
-
useIsomorphicLayoutEffect(() => {
|
|
49
|
-
return instance._willUpdate();
|
|
50
|
-
});
|
|
51
|
-
return instance;
|
|
52
|
-
}
|
|
53
|
-
function useVirtualizer(options) {
|
|
54
|
-
return useVirtualizerBase({
|
|
55
|
-
observeElementRect: index.observeElementRect,
|
|
56
|
-
observeElementOffset: index.observeElementOffset,
|
|
57
|
-
scrollToFn: index.elementScroll,
|
|
58
|
-
...options
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
exports.Virtualizer = index.Virtualizer;
|
|
62
|
-
exports.defaultKeyExtractor = index.defaultKeyExtractor;
|
|
63
|
-
exports.defaultRangeExtractor = index.defaultRangeExtractor;
|
|
64
|
-
exports.elementScroll = index.elementScroll;
|
|
65
|
-
exports.measureElement = index.measureElement;
|
|
66
|
-
exports.observeElementOffset = index.observeElementOffset;
|
|
67
|
-
exports.observeElementRect = index.observeElementRect;
|
|
68
|
-
exports.useVirtualizer = useVirtualizer;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { flushSync } from "react-dom";
|
|
3
|
-
import { Virtualizer, elementScroll, observeElementOffset, observeElementRect } from "../../../../../../@tanstack_virtual-core@3.13.18/node_modules/@tanstack/virtual-core/dist/esm/index.js";
|
|
4
|
-
import { defaultKeyExtractor, defaultRangeExtractor, measureElement } from "../../../../../../@tanstack_virtual-core@3.13.18/node_modules/@tanstack/virtual-core/dist/esm/index.js";
|
|
5
|
-
const useIsomorphicLayoutEffect = typeof document !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
6
|
-
function useVirtualizerBase({
|
|
7
|
-
useFlushSync = true,
|
|
8
|
-
...options
|
|
9
|
-
}) {
|
|
10
|
-
const rerender = React.useReducer(() => ({}), {})[1];
|
|
11
|
-
const resolvedOptions = {
|
|
12
|
-
...options,
|
|
13
|
-
onChange: (instance2, sync) => {
|
|
14
|
-
var _a;
|
|
15
|
-
if (useFlushSync && sync) {
|
|
16
|
-
flushSync(rerender);
|
|
17
|
-
} else {
|
|
18
|
-
rerender();
|
|
19
|
-
}
|
|
20
|
-
(_a = options.onChange) == null ? void 0 : _a.call(options, instance2, sync);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
const [instance] = React.useState(
|
|
24
|
-
() => new Virtualizer(resolvedOptions)
|
|
25
|
-
);
|
|
26
|
-
instance.setOptions(resolvedOptions);
|
|
27
|
-
useIsomorphicLayoutEffect(() => {
|
|
28
|
-
return instance._didMount();
|
|
29
|
-
}, []);
|
|
30
|
-
useIsomorphicLayoutEffect(() => {
|
|
31
|
-
return instance._willUpdate();
|
|
32
|
-
});
|
|
33
|
-
return instance;
|
|
34
|
-
}
|
|
35
|
-
function useVirtualizer(options) {
|
|
36
|
-
return useVirtualizerBase({
|
|
37
|
-
observeElementRect,
|
|
38
|
-
observeElementOffset,
|
|
39
|
-
scrollToFn: elementScroll,
|
|
40
|
-
...options
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
export {
|
|
44
|
-
Virtualizer,
|
|
45
|
-
defaultKeyExtractor,
|
|
46
|
-
defaultRangeExtractor,
|
|
47
|
-
elementScroll,
|
|
48
|
-
measureElement,
|
|
49
|
-
observeElementOffset,
|
|
50
|
-
observeElementRect,
|
|
51
|
-
useVirtualizer
|
|
52
|
-
};
|