@krak-stack/registry 0.11.1 → 0.11.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/CHANGELOG.md +6 -0
- package/dist/components/agent/react.js +29 -183
- package/dist/components/animated-list/react.js +16 -168
- package/dist/components/animated-number/react.js +8 -162
- package/dist/components/async-action-button/react.js +10 -164
- package/dist/components/audit-log-table/react.js +59 -213
- package/dist/components/code-block/react.js +10 -164
- package/dist/components/copy-button/react.js +10 -164
- package/dist/components/copy-value/html.js +4 -4
- package/dist/components/copy-value/react.js +20 -172
- package/dist/components/danger-confirmation/react.js +13 -167
- package/dist/components/data-table/react.js +59 -213
- package/dist/components/editable-text/react.js +14 -168
- package/dist/components/email-composer/react.js +25 -174
- package/dist/components/email-editor/react.js +34 -186
- package/dist/components/error-component/react.js +15 -169
- package/dist/components/icon-input/react.js +7 -161
- package/dist/components/image-crop-editor/react.js +19 -173
- package/dist/components/markdown/react.js +10 -164
- package/dist/components/presence-transition/react.js +9 -163
- package/dist/components/registry-previews/component-example.js +10 -164
- package/dist/components/rich-text-editor/react.js +9 -161
- package/dist/components/search-menu/react.js +11 -165
- package/dist/components/sidebar-layout/react.js +3 -157
- package/dist/components/support/react.js +14 -168
- package/dist/components/timezone-input/react.js +9 -163
- package/dist/components/webhook-delivery-table/react.js +74 -226
- package/dist/lib/docs.integrations.server.js +16 -35
- package/dist/lib/docs.js +31 -183
- package/dist/lib/docs.server.js +16 -35
- package/dist/lib/documentation-toolkit.js +19 -38
- package/dist/lib/effect-ui-adapter/use-model.js +158 -0
- package/dist/services/agent/client/index.js +29 -183
- package/package.json +5 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { ScrollArea as ScrollAreaPrimitive2 } from "@base-ui/react/scroll-area";
|
|
3
3
|
import { useVirtualizer, useWindowVirtualizer } from "@tanstack/react-virtual";
|
|
4
4
|
import { Formatter, Option as Option4, Schema as Schema6 } from "effect";
|
|
5
|
-
import { Component as Component3, View
|
|
5
|
+
import { Component as Component3, View } from "effect/ui";
|
|
6
6
|
import {
|
|
7
7
|
ArrowDown,
|
|
8
8
|
ArrowUp,
|
|
@@ -27,17 +27,17 @@ import {
|
|
|
27
27
|
X
|
|
28
28
|
} from "lucide-react";
|
|
29
29
|
import {
|
|
30
|
-
createContext
|
|
30
|
+
createContext,
|
|
31
31
|
isValidElement,
|
|
32
|
-
useCallback
|
|
33
|
-
useContext
|
|
34
|
-
useEffect
|
|
32
|
+
useCallback,
|
|
33
|
+
useContext,
|
|
34
|
+
useEffect,
|
|
35
35
|
useId as useId2,
|
|
36
|
-
useLayoutEffect
|
|
36
|
+
useLayoutEffect,
|
|
37
37
|
useMemo as useMemo2,
|
|
38
|
-
useRef
|
|
39
|
-
useState
|
|
40
|
-
useSyncExternalStore
|
|
38
|
+
useRef,
|
|
39
|
+
useState,
|
|
40
|
+
useSyncExternalStore
|
|
41
41
|
} from "react";
|
|
42
42
|
import { createPortal } from "react-dom";
|
|
43
43
|
|
|
@@ -1319,162 +1319,8 @@ var PaginationMeta = Schema3.Struct({
|
|
|
1319
1319
|
examples: [{ page: 0, pageSize: 20, total: 125, pageCount: 7 }]
|
|
1320
1320
|
}));
|
|
1321
1321
|
|
|
1322
|
-
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
1323
|
-
import { MessageLog as MessageLog2 } from "effect/ui";
|
|
1324
|
-
import {
|
|
1325
|
-
createContext,
|
|
1326
|
-
useCallback,
|
|
1327
|
-
useContext,
|
|
1328
|
-
useEffect,
|
|
1329
|
-
useLayoutEffect,
|
|
1330
|
-
useRef,
|
|
1331
|
-
useState,
|
|
1332
|
-
useSyncExternalStore
|
|
1333
|
-
} from "react";
|
|
1334
|
-
|
|
1335
|
-
// ../../src/lib/effect-ui-adapter/model-runtime.ts
|
|
1336
|
-
import { MessageLog, Renderer, View } from "effect/ui";
|
|
1337
|
-
import { BrowserHost, Html } from "effect/ui/html";
|
|
1338
|
-
import { Cause, Effect as Effect2, Fiber } from "effect";
|
|
1339
|
-
var node = () => ({ children: [] });
|
|
1340
|
-
var modelHost = (commit) => {
|
|
1341
|
-
const remove = (child) => {
|
|
1342
|
-
if (!child.parent)
|
|
1343
|
-
return;
|
|
1344
|
-
child.parent.children.splice(child.parent.children.indexOf(child), 1);
|
|
1345
|
-
delete child.parent;
|
|
1346
|
-
};
|
|
1347
|
-
return {
|
|
1348
|
-
createElement: node,
|
|
1349
|
-
createText: node,
|
|
1350
|
-
setText: () => {},
|
|
1351
|
-
setAttr: () => {},
|
|
1352
|
-
setProp: () => {},
|
|
1353
|
-
setEvents: () => {},
|
|
1354
|
-
insertBefore: (parent, child, before) => {
|
|
1355
|
-
if (child === before)
|
|
1356
|
-
return;
|
|
1357
|
-
remove(child);
|
|
1358
|
-
const index = before ? parent.children.indexOf(before) : parent.children.length;
|
|
1359
|
-
parent.children.splice(index, 0, child);
|
|
1360
|
-
child.parent = parent;
|
|
1361
|
-
},
|
|
1362
|
-
remove,
|
|
1363
|
-
parentOf: (child) => child.parent,
|
|
1364
|
-
nextOf: (child) => child.parent?.children[child.parent.children.indexOf(child) + 1],
|
|
1365
|
-
elements: ["html"],
|
|
1366
|
-
controlled: new Set,
|
|
1367
|
-
runsMounts: false,
|
|
1368
|
-
commit
|
|
1369
|
-
};
|
|
1370
|
-
};
|
|
1371
|
-
var mountModel = (component, props, publishSnapshot, messageLog, onEmit) => {
|
|
1372
|
-
let currentProps = props;
|
|
1373
|
-
let root;
|
|
1374
|
-
let active = true;
|
|
1375
|
-
let failure;
|
|
1376
|
-
const publish = () => {
|
|
1377
|
-
if (!active)
|
|
1378
|
-
return;
|
|
1379
|
-
if (failure) {
|
|
1380
|
-
publishSnapshot({ error: failure });
|
|
1381
|
-
return;
|
|
1382
|
-
}
|
|
1383
|
-
const current = root?.model();
|
|
1384
|
-
if (current !== undefined)
|
|
1385
|
-
publishSnapshot({ model: current });
|
|
1386
|
-
};
|
|
1387
|
-
const fiber = Effect2.runFork(Effect2.scoped(Effect2.gen(function* () {
|
|
1388
|
-
const mounted = yield* Renderer.mount(component, Effect2.succeed(props), node(), {
|
|
1389
|
-
head: false,
|
|
1390
|
-
onEmit,
|
|
1391
|
-
fallback: ({ cause }) => {
|
|
1392
|
-
failure = new Error("Effect UI root failed", {
|
|
1393
|
-
cause: Cause.squash(cause)
|
|
1394
|
-
});
|
|
1395
|
-
return View.text("");
|
|
1396
|
-
}
|
|
1397
|
-
});
|
|
1398
|
-
if (!active)
|
|
1399
|
-
return;
|
|
1400
|
-
root = mounted;
|
|
1401
|
-
if (props !== currentProps)
|
|
1402
|
-
mounted.setProps(currentProps);
|
|
1403
|
-
publish();
|
|
1404
|
-
return yield* Effect2.never;
|
|
1405
|
-
}).pipe(Effect2.provide(Renderer.layer(modelHost(publish))), Effect2.provideService(Html.Host, BrowserHost.htmlHost), Effect2.provideService(MessageLog.MessageLog, messageLog))));
|
|
1406
|
-
return {
|
|
1407
|
-
send: (message) => {
|
|
1408
|
-
root?.send(message);
|
|
1409
|
-
publish();
|
|
1410
|
-
},
|
|
1411
|
-
setProps: (next) => {
|
|
1412
|
-
currentProps = next;
|
|
1413
|
-
root?.setProps(next);
|
|
1414
|
-
},
|
|
1415
|
-
dispose: () => {
|
|
1416
|
-
active = false;
|
|
1417
|
-
root = undefined;
|
|
1418
|
-
Effect2.runFork(Fiber.interrupt(fiber));
|
|
1419
|
-
}
|
|
1420
|
-
};
|
|
1421
|
-
};
|
|
1422
|
-
|
|
1423
|
-
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
1424
|
-
"use client";
|
|
1425
|
-
var ModelMessageLogContext = createContext(undefined);
|
|
1426
|
-
var useModel = (component, props, options = {}) => {
|
|
1427
|
-
const contextLog = useContext(ModelMessageLogContext);
|
|
1428
|
-
const messageLog = options.messageLog ?? (contextLog === undefined ? MessageLog2.noop : contextLog);
|
|
1429
|
-
const [store] = useState(() => {
|
|
1430
|
-
const initial = { model: component.init(props).model };
|
|
1431
|
-
let snapshot = initial;
|
|
1432
|
-
const listeners = new Set;
|
|
1433
|
-
return {
|
|
1434
|
-
subscribe: (listener) => {
|
|
1435
|
-
listeners.add(listener);
|
|
1436
|
-
return () => {
|
|
1437
|
-
listeners.delete(listener);
|
|
1438
|
-
};
|
|
1439
|
-
},
|
|
1440
|
-
getSnapshot: () => snapshot,
|
|
1441
|
-
getServerSnapshot: () => initial,
|
|
1442
|
-
publish: (next) => {
|
|
1443
|
-
if ("model" in snapshot && "model" in next && Object.is(snapshot.model, next.model))
|
|
1444
|
-
return;
|
|
1445
|
-
if ("error" in snapshot && "error" in next && snapshot.error === next.error)
|
|
1446
|
-
return;
|
|
1447
|
-
snapshot = next;
|
|
1448
|
-
listeners.forEach((listener) => listener());
|
|
1449
|
-
}
|
|
1450
|
-
};
|
|
1451
|
-
});
|
|
1452
|
-
const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot);
|
|
1453
|
-
const committed = useRef(props);
|
|
1454
|
-
const onEmit = useRef(options.onEmit);
|
|
1455
|
-
const runtime = useRef(undefined);
|
|
1456
|
-
const send = useCallback((message) => runtime.current?.send(message), []);
|
|
1457
|
-
useLayoutEffect(() => {
|
|
1458
|
-
onEmit.current = options.onEmit;
|
|
1459
|
-
committed.current = props;
|
|
1460
|
-
runtime.current?.setProps(props);
|
|
1461
|
-
}, [props, options.onEmit]);
|
|
1462
|
-
useEffect(() => {
|
|
1463
|
-
if (messageLog === null)
|
|
1464
|
-
return;
|
|
1465
|
-
const mounted = mountModel(component, committed.current, store.publish, messageLog, (event) => onEmit.current?.(event));
|
|
1466
|
-
runtime.current = mounted;
|
|
1467
|
-
return () => {
|
|
1468
|
-
runtime.current = undefined;
|
|
1469
|
-
mounted.dispose();
|
|
1470
|
-
};
|
|
1471
|
-
}, [component, messageLog, store]);
|
|
1472
|
-
if ("error" in snapshot)
|
|
1473
|
-
throw snapshot.error;
|
|
1474
|
-
return { model: snapshot.model, send };
|
|
1475
|
-
};
|
|
1476
|
-
|
|
1477
1322
|
// ../../src/components/data-table/react.tsx
|
|
1323
|
+
import { useModel } from "@krak-stack/registry/effect-ui-adapter/react";
|
|
1478
1324
|
import { useKrakstackLocale as useKrakstackLocale3 } from "@krak-stack/registry/krakstack-provider/react";
|
|
1479
1325
|
|
|
1480
1326
|
// ../../src/components/data-table/classes.ts
|
|
@@ -1515,7 +1361,7 @@ var resolveTableClasses = (overrides) => ({
|
|
|
1515
1361
|
});
|
|
1516
1362
|
|
|
1517
1363
|
// ../../src/components/data-table/index.ts
|
|
1518
|
-
import { DateTime as DateTime3, Effect as
|
|
1364
|
+
import { DateTime as DateTime3, Effect as Effect2, Option as Option3, Redacted, Schema as Schema5, Stream } from "effect";
|
|
1519
1365
|
import { Csv } from "effect/encoding";
|
|
1520
1366
|
import { Command, Component as Component2, Subscription, UiSchema as UiSchema2 } from "effect/ui";
|
|
1521
1367
|
|
|
@@ -2422,8 +2268,8 @@ var dataTablePage = (props, model, locale) => {
|
|
|
2422
2268
|
pageSizes: pagination && pagination.pageSizes || defaultPageSizes
|
|
2423
2269
|
};
|
|
2424
2270
|
};
|
|
2425
|
-
var encodeTableCsv = (headers, data) =>
|
|
2426
|
-
` })), Stream.runCollect,
|
|
2271
|
+
var encodeTableCsv = (headers, data) => Effect2.runSync(Stream.fromIterable([headers, ...data]).pipe(Stream.map((row) => row.map((value) => value == null ? "" : String(value))), Stream.pipeThroughChannel(Csv.encodeString({ newline: `
|
|
2272
|
+
` })), Stream.runCollect, Effect2.map((parts) => parts.join("").slice(0, -1))));
|
|
2427
2273
|
var tableExportFilename = (name, extension) => name.includes(".") ? name.replace(/\.[^/.]+$/, `.${extension}`) : `${name}.${extension}`;
|
|
2428
2274
|
var downloadTableBlob = (content, type, filename) => {
|
|
2429
2275
|
const url = window.URL.createObjectURL(new Blob([content], { type }));
|
|
@@ -2464,7 +2310,7 @@ var DownloadTable = Command.make("DataTable/Download", {
|
|
|
2464
2310
|
content: Schema5.Redacted(Schema5.String, { disallowJsonEncode: true }),
|
|
2465
2311
|
type: Schema5.String
|
|
2466
2312
|
}
|
|
2467
|
-
}, ({ filename, content, type }) =>
|
|
2313
|
+
}, ({ filename, content, type }) => Effect2.try(() => downloadTableBlob(Redacted.value(content), type, filename)).pipe(Effect2.match({
|
|
2468
2314
|
onSuccess: () => DataTableMessage.ExportFinished({ failed: false }),
|
|
2469
2315
|
onFailure: () => DataTableMessage.ExportFinished({ failed: true })
|
|
2470
2316
|
})));
|
|
@@ -2773,11 +2619,11 @@ var dataTableBehaviours = {
|
|
|
2773
2619
|
|
|
2774
2620
|
// ../../src/components/data-table/react.tsx
|
|
2775
2621
|
import { jsx as jsx15, jsxs as jsxs9, Fragment } from "react/jsx-runtime";
|
|
2776
|
-
var DataTableStylesContext =
|
|
2777
|
-
var DataTableSlotClassesContext =
|
|
2622
|
+
var DataTableStylesContext = createContext(undefined);
|
|
2623
|
+
var DataTableSlotClassesContext = createContext(resolveTableClasses());
|
|
2778
2624
|
var styledTablePart = (Part, slot, style) => {
|
|
2779
2625
|
const StyledPart = (props) => {
|
|
2780
|
-
const styles =
|
|
2626
|
+
const styles = useContext(DataTableStylesContext);
|
|
2781
2627
|
const className = cn(props.className, style(styles));
|
|
2782
2628
|
return /* @__PURE__ */ jsx15(Part, {
|
|
2783
2629
|
"data-table-slot": slot,
|
|
@@ -2818,8 +2664,8 @@ var DataTableReferenceCell = ({
|
|
|
2818
2664
|
emptyLabel = "—",
|
|
2819
2665
|
imageVariant = "circle"
|
|
2820
2666
|
}) => {
|
|
2821
|
-
const tableClasses =
|
|
2822
|
-
const [failedImage, setFailedImage] =
|
|
2667
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
2668
|
+
const [failedImage, setFailedImage] = useState();
|
|
2823
2669
|
if (!item)
|
|
2824
2670
|
return emptyLabel;
|
|
2825
2671
|
const initials = tableInitials(item.label);
|
|
@@ -3103,10 +2949,10 @@ var reorderDataTableRows = (rows, sourceRowId, targetRowId) => {
|
|
|
3103
2949
|
reordered.splice(targetIndex, 0, source);
|
|
3104
2950
|
return reordered;
|
|
3105
2951
|
};
|
|
3106
|
-
var RowIdContext =
|
|
3107
|
-
var ColumnIdContext =
|
|
2952
|
+
var RowIdContext = createContext(null);
|
|
2953
|
+
var ColumnIdContext = createContext(null);
|
|
3108
2954
|
var useRequiredId = (context) => {
|
|
3109
|
-
const id =
|
|
2955
|
+
const id = useContext(context);
|
|
3110
2956
|
if (!id)
|
|
3111
2957
|
throw new Error("DataTable internal ID context is missing");
|
|
3112
2958
|
return id;
|
|
@@ -3331,7 +3177,7 @@ var DataTableRowActions = ({
|
|
|
3331
3177
|
row,
|
|
3332
3178
|
title
|
|
3333
3179
|
}) => {
|
|
3334
|
-
const tableClasses =
|
|
3180
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
3335
3181
|
const visible = actions.filter((action) => !action.visible || action.visible(row));
|
|
3336
3182
|
if (!visible.length)
|
|
3337
3183
|
return null;
|
|
@@ -3418,9 +3264,9 @@ var DataTableRowActionMenu = ({
|
|
|
3418
3264
|
var DataTableToolbar = ({
|
|
3419
3265
|
table
|
|
3420
3266
|
}) => {
|
|
3421
|
-
const tableClasses =
|
|
3267
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
3422
3268
|
const [store, send] = table;
|
|
3423
|
-
const exportPending =
|
|
3269
|
+
const exportPending = useRef(false);
|
|
3424
3270
|
const { exporting, exportFailed } = store.ui;
|
|
3425
3271
|
const { features, labels } = store.config;
|
|
3426
3272
|
const model = deriveModel(store);
|
|
@@ -3658,7 +3504,7 @@ var FilterEditor = ({
|
|
|
3658
3504
|
}) => {
|
|
3659
3505
|
const inputId = useId2();
|
|
3660
3506
|
const kind = getDataTableFilterKind(column);
|
|
3661
|
-
const [draft, setDraft] =
|
|
3507
|
+
const [draft, setDraft] = useState(() => tableFilterDraft(column.id, current));
|
|
3662
3508
|
const { primary, secondary, operator } = draft;
|
|
3663
3509
|
const operatorOptions = [
|
|
3664
3510
|
{ value: "contains", label: labels.filterContains },
|
|
@@ -3666,8 +3512,8 @@ var FilterEditor = ({
|
|
|
3666
3512
|
{ value: "startsWith", label: labels.filterStartsWith },
|
|
3667
3513
|
{ value: "endsWith", label: labels.filterEndsWith }
|
|
3668
3514
|
];
|
|
3669
|
-
const [invalid, setInvalid] =
|
|
3670
|
-
const [optionSearch, setOptionSearch] =
|
|
3515
|
+
const [invalid, setInvalid] = useState(false);
|
|
3516
|
+
const [optionSearch, setOptionSearch] = useState("");
|
|
3671
3517
|
const apply = (candidate) => {
|
|
3672
3518
|
const decoded = parseTableFilterDraft(kind, candidate);
|
|
3673
3519
|
if (Option4.isNone(decoded)) {
|
|
@@ -4142,7 +3988,7 @@ var ColumnMenu = ({
|
|
|
4142
3988
|
var ResizeHandle = ({
|
|
4143
3989
|
table
|
|
4144
3990
|
}) => {
|
|
4145
|
-
const tableClasses =
|
|
3991
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
4146
3992
|
const [store, send] = table;
|
|
4147
3993
|
const columnId = useRequiredId(ColumnIdContext);
|
|
4148
3994
|
const column = deriveModel(store).columns.find(({ id }) => id === columnId);
|
|
@@ -4193,8 +4039,8 @@ var DragHandle = ({
|
|
|
4193
4039
|
}) => {
|
|
4194
4040
|
const [store] = table;
|
|
4195
4041
|
const rowId = useRequiredId(RowIdContext);
|
|
4196
|
-
const dragRef =
|
|
4197
|
-
const [overlay, setOverlay] =
|
|
4042
|
+
const dragRef = useRef(null);
|
|
4043
|
+
const [overlay, setOverlay] = useState(null);
|
|
4198
4044
|
const reset = (element) => {
|
|
4199
4045
|
clearDragPresentation(element.closest("[data-table-root]"));
|
|
4200
4046
|
dragRef.current = null;
|
|
@@ -4324,7 +4170,7 @@ var TableDataRow = ({
|
|
|
4324
4170
|
virtualIndex,
|
|
4325
4171
|
measureRef
|
|
4326
4172
|
}) => {
|
|
4327
|
-
const tableClasses =
|
|
4173
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
4328
4174
|
const [store, send] = table;
|
|
4329
4175
|
const model = deriveModel(store);
|
|
4330
4176
|
const selection = store.config.features.selection;
|
|
@@ -4436,7 +4282,7 @@ var GroupHeaderRow = ({
|
|
|
4436
4282
|
virtualIndex,
|
|
4437
4283
|
measureRef
|
|
4438
4284
|
}) => {
|
|
4439
|
-
const tableClasses =
|
|
4285
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
4440
4286
|
const [store, send] = table;
|
|
4441
4287
|
const collapsed = !!store.state.collapsedGroups[section.key];
|
|
4442
4288
|
return /* @__PURE__ */ jsx15(TableRow2, {
|
|
@@ -4527,7 +4373,7 @@ var GroupedTable = ({
|
|
|
4527
4373
|
var ColumnHeaderMenu = ({
|
|
4528
4374
|
table
|
|
4529
4375
|
}) => {
|
|
4530
|
-
const tableClasses =
|
|
4376
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
4531
4377
|
const [store, send] = table;
|
|
4532
4378
|
const columnId = useRequiredId(ColumnIdContext);
|
|
4533
4379
|
const model = deriveModel(store);
|
|
@@ -4688,7 +4534,7 @@ var DataTableHeader = ({
|
|
|
4688
4534
|
table,
|
|
4689
4535
|
sticky
|
|
4690
4536
|
}) => {
|
|
4691
|
-
const tableClasses =
|
|
4537
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
4692
4538
|
const [store, send] = table;
|
|
4693
4539
|
const model = deriveModel(store);
|
|
4694
4540
|
const selection = store.config.features.selection;
|
|
@@ -4787,7 +4633,7 @@ var VirtualTableRows = ({
|
|
|
4787
4633
|
result.push({ key: `row:${row.id}`, kind: "data", row });
|
|
4788
4634
|
return result;
|
|
4789
4635
|
}, [rows, sections, state.collapsedGroups]);
|
|
4790
|
-
|
|
4636
|
+
useLayoutEffect(() => {
|
|
4791
4637
|
if (!pageScroll && scrollElement)
|
|
4792
4638
|
scrollElement.scrollTop = 0;
|
|
4793
4639
|
}, [
|
|
@@ -4802,7 +4648,7 @@ var VirtualTableRows = ({
|
|
|
4802
4648
|
]);
|
|
4803
4649
|
const options = {
|
|
4804
4650
|
count: entries.length,
|
|
4805
|
-
getItemKey:
|
|
4651
|
+
getItemKey: useCallback((index) => entries[index].key, [entries]),
|
|
4806
4652
|
estimateSize: () => viewport.options.estimateRowHeight ?? 64,
|
|
4807
4653
|
overscan: viewport.options.overscan ?? 5,
|
|
4808
4654
|
scrollMargin
|
|
@@ -4870,7 +4716,7 @@ var DataTableBody = ({
|
|
|
4870
4716
|
table,
|
|
4871
4717
|
viewport
|
|
4872
4718
|
}) => {
|
|
4873
|
-
const styles =
|
|
4719
|
+
const styles = useContext(DataTableStylesContext);
|
|
4874
4720
|
const [store] = table;
|
|
4875
4721
|
const model = deriveModel(store);
|
|
4876
4722
|
const fields = getActiveGrouping(store);
|
|
@@ -5036,7 +4882,7 @@ var GalleryCard = ({
|
|
|
5036
4882
|
var DataTableGallery = ({
|
|
5037
4883
|
table
|
|
5038
4884
|
}) => {
|
|
5039
|
-
const styles =
|
|
4885
|
+
const styles = useContext(DataTableStylesContext);
|
|
5040
4886
|
const [store, send] = table;
|
|
5041
4887
|
const model = deriveModel(store);
|
|
5042
4888
|
const fields = getActiveGrouping(store);
|
|
@@ -5140,13 +4986,13 @@ var DataTableGallery = ({
|
|
|
5140
4986
|
var DataTablePagination = ({
|
|
5141
4987
|
table
|
|
5142
4988
|
}) => {
|
|
5143
|
-
const styles =
|
|
4989
|
+
const styles = useContext(DataTableStylesContext);
|
|
5144
4990
|
const [store, send] = table;
|
|
5145
4991
|
const model = deriveModel(store);
|
|
5146
4992
|
const pagination = store.config.features.pagination ?? false;
|
|
5147
4993
|
const { paginationVisible, page } = model;
|
|
5148
4994
|
const pageIndex = store.state.page;
|
|
5149
|
-
|
|
4995
|
+
useLayoutEffect(() => {
|
|
5150
4996
|
if (paginationVisible && pagination && pagination.mode === "client" && pageIndex > page) {
|
|
5151
4997
|
send(DataTableMessage.PageRequested({ page }));
|
|
5152
4998
|
}
|
|
@@ -5174,7 +5020,7 @@ var DataTablePagination = ({
|
|
|
5174
5020
|
};
|
|
5175
5021
|
var ReactTableModel = Component3.define(dataTableOptions).make({
|
|
5176
5022
|
...dataTableBehaviours,
|
|
5177
|
-
view: () =>
|
|
5023
|
+
view: () => View.text("")
|
|
5178
5024
|
});
|
|
5179
5025
|
var modelField = (id, definition) => {
|
|
5180
5026
|
const field = {
|
|
@@ -5271,8 +5117,8 @@ var HydratedDataTable = (props) => {
|
|
|
5271
5117
|
}
|
|
5272
5118
|
}
|
|
5273
5119
|
});
|
|
5274
|
-
const [storageKey] =
|
|
5275
|
-
|
|
5120
|
+
const [storageKey] = useState(() => tablePreferencesKey(globalThis.window?.location.pathname ?? "/", columns.map(({ id }) => id), !!props.features?.gallery));
|
|
5121
|
+
useEffect(() => {
|
|
5276
5122
|
if (!model.preferencesLoaded) {
|
|
5277
5123
|
send(DataTableMessage.PreferencesLoaded({
|
|
5278
5124
|
preferences: readTablePreferences(storageKey)
|
|
@@ -5280,8 +5126,8 @@ var HydratedDataTable = (props) => {
|
|
|
5280
5126
|
}
|
|
5281
5127
|
}, [model, send, storageKey]);
|
|
5282
5128
|
const { columnVisibility, columnSizing, grouping, view, preferencesLoaded } = model;
|
|
5283
|
-
const loadedPreferences =
|
|
5284
|
-
|
|
5129
|
+
const loadedPreferences = useRef(false);
|
|
5130
|
+
useEffect(() => {
|
|
5285
5131
|
const preferences = tablePreferences({
|
|
5286
5132
|
columnVisibility,
|
|
5287
5133
|
columnSizing,
|
|
@@ -5367,7 +5213,7 @@ var TablePlaceholder = ({
|
|
|
5367
5213
|
});
|
|
5368
5214
|
var DataTable = (props) => {
|
|
5369
5215
|
const locale = useKrakstackLocale3(props.locale);
|
|
5370
|
-
const hydrated =
|
|
5216
|
+
const hydrated = useSyncExternalStore(subscribeToHydration, clientSnapshot, serverSnapshot);
|
|
5371
5217
|
if (!hydrated)
|
|
5372
5218
|
return /* @__PURE__ */ jsx15(TablePlaceholder, {
|
|
5373
5219
|
props
|
|
@@ -5387,11 +5233,11 @@ var DataTableContent = ({
|
|
|
5387
5233
|
table
|
|
5388
5234
|
}) => {
|
|
5389
5235
|
const [store] = table;
|
|
5390
|
-
const [scrollElement, setScrollElement] =
|
|
5391
|
-
const [headerHeight, setHeaderHeight] =
|
|
5392
|
-
const [pageTable, setPageTable] =
|
|
5393
|
-
const [pageOffset, setPageOffset] =
|
|
5394
|
-
|
|
5236
|
+
const [scrollElement, setScrollElement] = useState(null);
|
|
5237
|
+
const [headerHeight, setHeaderHeight] = useState(48);
|
|
5238
|
+
const [pageTable, setPageTable] = useState(null);
|
|
5239
|
+
const [pageOffset, setPageOffset] = useState();
|
|
5240
|
+
useLayoutEffect(() => {
|
|
5395
5241
|
const header = pageTable?.querySelector("thead");
|
|
5396
5242
|
if (!pageTable || !header)
|
|
5397
5243
|
return;
|
|
@@ -5406,7 +5252,7 @@ var DataTableContent = ({
|
|
|
5406
5252
|
observer?.disconnect();
|
|
5407
5253
|
};
|
|
5408
5254
|
}, [pageTable]);
|
|
5409
|
-
|
|
5255
|
+
useLayoutEffect(() => {
|
|
5410
5256
|
const header = scrollElement?.querySelector("thead");
|
|
5411
5257
|
if (!header)
|
|
5412
5258
|
return;
|
|
@@ -5529,7 +5375,7 @@ var DataTableContent = ({
|
|
|
5529
5375
|
});
|
|
5530
5376
|
};
|
|
5531
5377
|
var DataTableListCell = (props) => {
|
|
5532
|
-
const tableClasses =
|
|
5378
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
5533
5379
|
const locale = useKrakstackLocale3(props.locale);
|
|
5534
5380
|
const resolvedProps = { ...props, locale };
|
|
5535
5381
|
if (resolvedProps.options && (resolvedProps.onAdd || resolvedProps.onRemove)) {
|
|
@@ -5591,9 +5437,9 @@ var EditableDataTableListCell = ({
|
|
|
5591
5437
|
locale = "en",
|
|
5592
5438
|
messages
|
|
5593
5439
|
}) => {
|
|
5594
|
-
const tableClasses =
|
|
5595
|
-
const [selected, setSelected] =
|
|
5596
|
-
const [previousItems, setPreviousItems] =
|
|
5440
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
5441
|
+
const [selected, setSelected] = useState([...items]);
|
|
5442
|
+
const [previousItems, setPreviousItems] = useState(items);
|
|
5597
5443
|
if (previousItems !== items) {
|
|
5598
5444
|
setPreviousItems(items);
|
|
5599
5445
|
setSelected([...items]);
|
|
@@ -5781,8 +5627,8 @@ var DataTableListAddMenu = ({
|
|
|
5781
5627
|
options,
|
|
5782
5628
|
searchLabel
|
|
5783
5629
|
}) => {
|
|
5784
|
-
const [search, setSearch] =
|
|
5785
|
-
const focusSearch =
|
|
5630
|
+
const [search, setSearch] = useState("");
|
|
5631
|
+
const focusSearch = useCallback((input) => {
|
|
5786
5632
|
input?.focus({ preventScroll: true });
|
|
5787
5633
|
}, []);
|
|
5788
5634
|
const labels = dataTableMessages(locale, messages);
|