@krak-stack/registry 0.11.1 → 0.11.3
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 +14 -0
- package/README.md +22 -0
- package/dist/components/agent/react.js +29 -183
- package/dist/components/animated-list/html.js +1 -105
- package/dist/components/animated-list/react.js +16 -168
- package/dist/components/animated-number/react.js +8 -162
- package/dist/components/app-switcher/html.js +1 -103
- package/dist/components/async-action-button/html.js +1 -101
- package/dist/components/async-action-button/react.js +10 -164
- package/dist/components/audit-log-table/react.js +59 -213
- package/dist/components/bulk-list-input/html.js +2 -102
- package/dist/components/choice-cards/html.js +1 -101
- package/dist/components/code-block/html.js +1 -101
- package/dist/components/code-block/react.js +10 -164
- package/dist/components/copy-button/html.d.ts +2 -2
- package/dist/components/copy-button/html.js +1 -101
- package/dist/components/copy-button/react.js +10 -164
- package/dist/components/copy-value/html.js +6 -105
- package/dist/components/copy-value/react.js +20 -172
- package/dist/components/danger-confirmation/react.js +13 -167
- package/dist/components/data-table/html.d.ts +51 -51
- package/dist/components/data-table/html.js +28 -101
- package/dist/components/data-table/react.js +59 -213
- package/dist/components/date-input/html.js +2 -105
- package/dist/components/editable-text/html.d.ts +2 -2
- package/dist/components/editable-text/html.js +4 -102
- package/dist/components/editable-text/react.js +14 -168
- package/dist/components/editing-locale-switcher/html.js +2 -102
- package/dist/components/email-composer/react.js +25 -174
- package/dist/components/email-editor/html.js +8 -107
- package/dist/components/email-editor/react.js +34 -186
- package/dist/components/error-component/html.d.ts +4 -4
- package/dist/components/error-component/html.js +10 -107
- package/dist/components/error-component/react.js +15 -169
- package/dist/components/file-input/html.js +6 -106
- package/dist/components/icon-input/html.js +3 -103
- package/dist/components/icon-input/react.js +7 -161
- package/dist/components/image-crop-editor/html.js +1 -101
- package/dist/components/image-crop-editor/react.js +19 -173
- package/dist/components/loading/html.js +1 -101
- package/dist/components/locale-switcher/html.js +1 -103
- package/dist/components/map-menu/html.d.ts +8 -8
- package/dist/components/map-menu/html.js +7 -106
- package/dist/components/markdown/html.js +1 -101
- package/dist/components/markdown/react.js +10 -164
- package/dist/components/notification-menu/html.js +7 -114
- package/dist/components/pagination/html.js +5 -100
- 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/html.js +14 -108
- package/dist/components/rich-text-editor/react.js +9 -161
- package/dist/components/search-menu/html.js +1 -103
- package/dist/components/search-menu/react.js +11 -165
- package/dist/components/sidebar-layout/html.js +2 -102
- package/dist/components/sidebar-layout/react.js +3 -157
- package/dist/components/stepper/html.js +4 -102
- package/dist/components/support/html.js +1 -101
- package/dist/components/support/react.js +14 -168
- package/dist/components/theme-switcher/html.js +4 -105
- package/dist/components/time-input/html.d.ts +2 -2
- package/dist/components/time-input/html.js +1 -103
- package/dist/components/timezone-input/react.js +9 -163
- package/dist/components/toast/html.js +11 -104
- package/dist/components/upload-attachment/html.d.ts +4 -4
- package/dist/components/upload-attachment/html.js +7 -102
- package/dist/components/webhook-delivery-table/html.js +28 -101
- 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/lib/lucide-effect.d.ts +2432 -0
- package/dist/lib/lucide-effect.js +7428 -0
- package/dist/services/agent/client/index.js +29 -183
- package/package.json +10 -2
|
@@ -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);
|
|
@@ -3107,10 +2953,10 @@ var reorderDataTableRows = (rows, sourceRowId, targetRowId) => {
|
|
|
3107
2953
|
reordered.splice(targetIndex, 0, source);
|
|
3108
2954
|
return reordered;
|
|
3109
2955
|
};
|
|
3110
|
-
var RowIdContext =
|
|
3111
|
-
var ColumnIdContext =
|
|
2956
|
+
var RowIdContext = createContext(null);
|
|
2957
|
+
var ColumnIdContext = createContext(null);
|
|
3112
2958
|
var useRequiredId = (context) => {
|
|
3113
|
-
const id =
|
|
2959
|
+
const id = useContext(context);
|
|
3114
2960
|
if (!id)
|
|
3115
2961
|
throw new Error("DataTable internal ID context is missing");
|
|
3116
2962
|
return id;
|
|
@@ -3336,7 +3182,7 @@ var DataTableRowActions = ({
|
|
|
3336
3182
|
row,
|
|
3337
3183
|
title
|
|
3338
3184
|
}) => {
|
|
3339
|
-
const tableClasses =
|
|
3185
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
3340
3186
|
const visible = actions.filter((action) => !action.visible || action.visible(row));
|
|
3341
3187
|
if (!visible.length)
|
|
3342
3188
|
return null;
|
|
@@ -3423,9 +3269,9 @@ var DataTableRowActionMenu = ({
|
|
|
3423
3269
|
var DataTableToolbar = ({
|
|
3424
3270
|
table
|
|
3425
3271
|
}) => {
|
|
3426
|
-
const tableClasses =
|
|
3272
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
3427
3273
|
const [store, send] = table;
|
|
3428
|
-
const exportPending =
|
|
3274
|
+
const exportPending = useRef(false);
|
|
3429
3275
|
const { exporting, exportFailed } = store.ui;
|
|
3430
3276
|
const { features, labels } = store.config;
|
|
3431
3277
|
const model = deriveModel(store);
|
|
@@ -3663,7 +3509,7 @@ var FilterEditor = ({
|
|
|
3663
3509
|
}) => {
|
|
3664
3510
|
const inputId = useId2();
|
|
3665
3511
|
const kind = getDataTableFilterKind(column);
|
|
3666
|
-
const [draft, setDraft] =
|
|
3512
|
+
const [draft, setDraft] = useState(() => tableFilterDraft(column.id, current));
|
|
3667
3513
|
const { primary, secondary, operator } = draft;
|
|
3668
3514
|
const operatorOptions = [
|
|
3669
3515
|
{ value: "contains", label: labels.filterContains },
|
|
@@ -3671,8 +3517,8 @@ var FilterEditor = ({
|
|
|
3671
3517
|
{ value: "startsWith", label: labels.filterStartsWith },
|
|
3672
3518
|
{ value: "endsWith", label: labels.filterEndsWith }
|
|
3673
3519
|
];
|
|
3674
|
-
const [invalid, setInvalid] =
|
|
3675
|
-
const [optionSearch, setOptionSearch] =
|
|
3520
|
+
const [invalid, setInvalid] = useState(false);
|
|
3521
|
+
const [optionSearch, setOptionSearch] = useState("");
|
|
3676
3522
|
const apply = (candidate) => {
|
|
3677
3523
|
const decoded = parseTableFilterDraft(kind, candidate);
|
|
3678
3524
|
if (Option4.isNone(decoded)) {
|
|
@@ -4147,7 +3993,7 @@ var ColumnMenu = ({
|
|
|
4147
3993
|
var ResizeHandle = ({
|
|
4148
3994
|
table
|
|
4149
3995
|
}) => {
|
|
4150
|
-
const tableClasses =
|
|
3996
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
4151
3997
|
const [store, send] = table;
|
|
4152
3998
|
const columnId = useRequiredId(ColumnIdContext);
|
|
4153
3999
|
const column = deriveModel(store).columns.find(({ id }) => id === columnId);
|
|
@@ -4198,8 +4044,8 @@ var DragHandle = ({
|
|
|
4198
4044
|
}) => {
|
|
4199
4045
|
const [store] = table;
|
|
4200
4046
|
const rowId = useRequiredId(RowIdContext);
|
|
4201
|
-
const dragRef =
|
|
4202
|
-
const [overlay, setOverlay] =
|
|
4047
|
+
const dragRef = useRef(null);
|
|
4048
|
+
const [overlay, setOverlay] = useState(null);
|
|
4203
4049
|
const reset = (element) => {
|
|
4204
4050
|
clearDragPresentation(element.closest("[data-table-root]"));
|
|
4205
4051
|
dragRef.current = null;
|
|
@@ -4329,7 +4175,7 @@ var TableDataRow = ({
|
|
|
4329
4175
|
virtualIndex,
|
|
4330
4176
|
measureRef
|
|
4331
4177
|
}) => {
|
|
4332
|
-
const tableClasses =
|
|
4178
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
4333
4179
|
const [store, send] = table;
|
|
4334
4180
|
const model = deriveModel(store);
|
|
4335
4181
|
const selection = store.config.features.selection;
|
|
@@ -4441,7 +4287,7 @@ var GroupHeaderRow = ({
|
|
|
4441
4287
|
virtualIndex,
|
|
4442
4288
|
measureRef
|
|
4443
4289
|
}) => {
|
|
4444
|
-
const tableClasses =
|
|
4290
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
4445
4291
|
const [store, send] = table;
|
|
4446
4292
|
const collapsed = !!store.state.collapsedGroups[section.key];
|
|
4447
4293
|
return /* @__PURE__ */ jsx15(TableRow2, {
|
|
@@ -4532,7 +4378,7 @@ var GroupedTable = ({
|
|
|
4532
4378
|
var ColumnHeaderMenu = ({
|
|
4533
4379
|
table
|
|
4534
4380
|
}) => {
|
|
4535
|
-
const tableClasses =
|
|
4381
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
4536
4382
|
const [store, send] = table;
|
|
4537
4383
|
const columnId = useRequiredId(ColumnIdContext);
|
|
4538
4384
|
const model = deriveModel(store);
|
|
@@ -4693,7 +4539,7 @@ var DataTableHeader = ({
|
|
|
4693
4539
|
table,
|
|
4694
4540
|
sticky
|
|
4695
4541
|
}) => {
|
|
4696
|
-
const tableClasses =
|
|
4542
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
4697
4543
|
const [store, send] = table;
|
|
4698
4544
|
const model = deriveModel(store);
|
|
4699
4545
|
const selection = store.config.features.selection;
|
|
@@ -4792,7 +4638,7 @@ var VirtualTableRows = ({
|
|
|
4792
4638
|
result.push({ key: `row:${row.id}`, kind: "data", row });
|
|
4793
4639
|
return result;
|
|
4794
4640
|
}, [rows, sections, state.collapsedGroups]);
|
|
4795
|
-
|
|
4641
|
+
useLayoutEffect(() => {
|
|
4796
4642
|
if (!pageScroll && scrollElement)
|
|
4797
4643
|
scrollElement.scrollTop = 0;
|
|
4798
4644
|
}, [
|
|
@@ -4807,7 +4653,7 @@ var VirtualTableRows = ({
|
|
|
4807
4653
|
]);
|
|
4808
4654
|
const options = {
|
|
4809
4655
|
count: entries.length,
|
|
4810
|
-
getItemKey:
|
|
4656
|
+
getItemKey: useCallback((index) => entries[index].key, [entries]),
|
|
4811
4657
|
estimateSize: () => viewport.options.estimateRowHeight ?? 64,
|
|
4812
4658
|
overscan: viewport.options.overscan ?? 5,
|
|
4813
4659
|
scrollMargin
|
|
@@ -4875,7 +4721,7 @@ var DataTableBody = ({
|
|
|
4875
4721
|
table,
|
|
4876
4722
|
viewport
|
|
4877
4723
|
}) => {
|
|
4878
|
-
const styles =
|
|
4724
|
+
const styles = useContext(DataTableStylesContext);
|
|
4879
4725
|
const [store] = table;
|
|
4880
4726
|
const model = deriveModel(store);
|
|
4881
4727
|
const fields = getActiveGrouping(store);
|
|
@@ -5041,7 +4887,7 @@ var GalleryCard = ({
|
|
|
5041
4887
|
var DataTableGallery = ({
|
|
5042
4888
|
table
|
|
5043
4889
|
}) => {
|
|
5044
|
-
const styles =
|
|
4890
|
+
const styles = useContext(DataTableStylesContext);
|
|
5045
4891
|
const [store, send] = table;
|
|
5046
4892
|
const model = deriveModel(store);
|
|
5047
4893
|
const fields = getActiveGrouping(store);
|
|
@@ -5145,13 +4991,13 @@ var DataTableGallery = ({
|
|
|
5145
4991
|
var DataTablePagination = ({
|
|
5146
4992
|
table
|
|
5147
4993
|
}) => {
|
|
5148
|
-
const styles =
|
|
4994
|
+
const styles = useContext(DataTableStylesContext);
|
|
5149
4995
|
const [store, send] = table;
|
|
5150
4996
|
const model = deriveModel(store);
|
|
5151
4997
|
const pagination = store.config.features.pagination ?? false;
|
|
5152
4998
|
const { paginationVisible, page } = model;
|
|
5153
4999
|
const pageIndex = store.state.page;
|
|
5154
|
-
|
|
5000
|
+
useLayoutEffect(() => {
|
|
5155
5001
|
if (paginationVisible && pagination && pagination.mode === "client" && pageIndex > page) {
|
|
5156
5002
|
send(DataTableMessage.PageRequested({ page }));
|
|
5157
5003
|
}
|
|
@@ -5179,7 +5025,7 @@ var DataTablePagination = ({
|
|
|
5179
5025
|
};
|
|
5180
5026
|
var ReactTableModel = Component3.define(dataTableOptions).make({
|
|
5181
5027
|
...dataTableBehaviours,
|
|
5182
|
-
view: () =>
|
|
5028
|
+
view: () => View.text("")
|
|
5183
5029
|
});
|
|
5184
5030
|
var modelField = (id, definition) => {
|
|
5185
5031
|
const field = {
|
|
@@ -5276,8 +5122,8 @@ var HydratedDataTable = (props) => {
|
|
|
5276
5122
|
}
|
|
5277
5123
|
}
|
|
5278
5124
|
});
|
|
5279
|
-
const [storageKey] =
|
|
5280
|
-
|
|
5125
|
+
const [storageKey] = useState(() => tablePreferencesKey(globalThis.window?.location.pathname ?? "/", columns.map(({ id }) => id), !!props.features?.gallery));
|
|
5126
|
+
useEffect(() => {
|
|
5281
5127
|
if (!model.preferencesLoaded) {
|
|
5282
5128
|
send(DataTableMessage.PreferencesLoaded({
|
|
5283
5129
|
preferences: readTablePreferences(storageKey)
|
|
@@ -5285,8 +5131,8 @@ var HydratedDataTable = (props) => {
|
|
|
5285
5131
|
}
|
|
5286
5132
|
}, [model, send, storageKey]);
|
|
5287
5133
|
const { columnVisibility, columnSizing, grouping, view, preferencesLoaded } = model;
|
|
5288
|
-
const loadedPreferences =
|
|
5289
|
-
|
|
5134
|
+
const loadedPreferences = useRef(false);
|
|
5135
|
+
useEffect(() => {
|
|
5290
5136
|
const preferences = tablePreferences({
|
|
5291
5137
|
columnVisibility,
|
|
5292
5138
|
columnSizing,
|
|
@@ -5372,7 +5218,7 @@ var TablePlaceholder = ({
|
|
|
5372
5218
|
});
|
|
5373
5219
|
var DataTable = (props) => {
|
|
5374
5220
|
const locale = useKrakstackLocale3(props.locale);
|
|
5375
|
-
const hydrated =
|
|
5221
|
+
const hydrated = useSyncExternalStore(subscribeToHydration, clientSnapshot, serverSnapshot);
|
|
5376
5222
|
if (!hydrated)
|
|
5377
5223
|
return /* @__PURE__ */ jsx15(TablePlaceholder, {
|
|
5378
5224
|
props
|
|
@@ -5392,11 +5238,11 @@ var DataTableContent = ({
|
|
|
5392
5238
|
table
|
|
5393
5239
|
}) => {
|
|
5394
5240
|
const [store] = table;
|
|
5395
|
-
const [scrollElement, setScrollElement] =
|
|
5396
|
-
const [headerHeight, setHeaderHeight] =
|
|
5397
|
-
const [pageTable, setPageTable] =
|
|
5398
|
-
const [pageOffset, setPageOffset] =
|
|
5399
|
-
|
|
5241
|
+
const [scrollElement, setScrollElement] = useState(null);
|
|
5242
|
+
const [headerHeight, setHeaderHeight] = useState(48);
|
|
5243
|
+
const [pageTable, setPageTable] = useState(null);
|
|
5244
|
+
const [pageOffset, setPageOffset] = useState();
|
|
5245
|
+
useLayoutEffect(() => {
|
|
5400
5246
|
const header = pageTable?.querySelector("thead");
|
|
5401
5247
|
if (!pageTable || !header)
|
|
5402
5248
|
return;
|
|
@@ -5411,7 +5257,7 @@ var DataTableContent = ({
|
|
|
5411
5257
|
observer?.disconnect();
|
|
5412
5258
|
};
|
|
5413
5259
|
}, [pageTable]);
|
|
5414
|
-
|
|
5260
|
+
useLayoutEffect(() => {
|
|
5415
5261
|
const header = scrollElement?.querySelector("thead");
|
|
5416
5262
|
if (!header)
|
|
5417
5263
|
return;
|
|
@@ -5534,7 +5380,7 @@ var DataTableContent = ({
|
|
|
5534
5380
|
});
|
|
5535
5381
|
};
|
|
5536
5382
|
var DataTableListCell = (props) => {
|
|
5537
|
-
const tableClasses =
|
|
5383
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
5538
5384
|
const locale = useKrakstackLocale3(props.locale);
|
|
5539
5385
|
const resolvedProps = { ...props, locale };
|
|
5540
5386
|
if (resolvedProps.options && (resolvedProps.onAdd || resolvedProps.onRemove)) {
|
|
@@ -5596,9 +5442,9 @@ var EditableDataTableListCell = ({
|
|
|
5596
5442
|
locale = "en",
|
|
5597
5443
|
messages
|
|
5598
5444
|
}) => {
|
|
5599
|
-
const tableClasses =
|
|
5600
|
-
const [selected, setSelected] =
|
|
5601
|
-
const [previousItems, setPreviousItems] =
|
|
5445
|
+
const tableClasses = useContext(DataTableSlotClassesContext);
|
|
5446
|
+
const [selected, setSelected] = useState([...items]);
|
|
5447
|
+
const [previousItems, setPreviousItems] = useState(items);
|
|
5602
5448
|
if (previousItems !== items) {
|
|
5603
5449
|
setPreviousItems(items);
|
|
5604
5450
|
setSelected([...items]);
|
|
@@ -5786,8 +5632,8 @@ var DataTableListAddMenu = ({
|
|
|
5786
5632
|
options,
|
|
5787
5633
|
searchLabel
|
|
5788
5634
|
}) => {
|
|
5789
|
-
const [search, setSearch] =
|
|
5790
|
-
const focusSearch =
|
|
5635
|
+
const [search, setSearch] = useState("");
|
|
5636
|
+
const focusSearch = useCallback((input) => {
|
|
5791
5637
|
input?.focus({ preventScroll: true });
|
|
5792
5638
|
}, []);
|
|
5793
5639
|
const labels = dataTableMessages(locale, messages);
|
|
@@ -3,7 +3,6 @@ import { DateTime as DateTime3, Effect, Schema as Schema3, Stream } from "effect
|
|
|
3
3
|
import { Component as Component2, Mount } from "effect/ui";
|
|
4
4
|
import { Html } from "effect/ui/html";
|
|
5
5
|
import { Calendar, Popover } from "effect/ui/kit";
|
|
6
|
-
import { CalendarDays } from "lucide";
|
|
7
6
|
|
|
8
7
|
// ../../src/components/effectcn/button.ts
|
|
9
8
|
import {
|
|
@@ -40,109 +39,7 @@ var Button = (h, options = {}) => KitButton(h, {
|
|
|
40
39
|
|
|
41
40
|
// ../../src/components/effectcn/calendar.ts
|
|
42
41
|
import { DateTime } from "effect";
|
|
43
|
-
|
|
44
|
-
// ../../src/lib/lucide-effect.ts
|
|
45
|
-
import {
|
|
46
|
-
ArrowDown as arrowDown,
|
|
47
|
-
ArrowUp as arrowUp,
|
|
48
|
-
ListFilter as listFilter,
|
|
49
|
-
Check as check,
|
|
50
|
-
ChevronLeft as chevronLeft,
|
|
51
|
-
ChevronDown as chevronDown,
|
|
52
|
-
ChevronRight as chevronRight,
|
|
53
|
-
ChevronsLeft as chevronsLeft,
|
|
54
|
-
ChevronsRight as chevronsRight,
|
|
55
|
-
ChevronsUpDown as chevronsUpDown,
|
|
56
|
-
Copy as copy,
|
|
57
|
-
Download as download,
|
|
58
|
-
Eye as eye,
|
|
59
|
-
EyeOff as eyeOff,
|
|
60
|
-
Ellipsis as ellipsis,
|
|
61
|
-
FileJson as fileJson,
|
|
62
|
-
FileText as fileText,
|
|
63
|
-
GripVertical as gripVertical,
|
|
64
|
-
Image as image,
|
|
65
|
-
LayoutGrid as layoutGrid,
|
|
66
|
-
LoaderCircle as loaderCircle,
|
|
67
|
-
Mail as mail,
|
|
68
|
-
Paperclip as paperclip,
|
|
69
|
-
RefreshCw as refreshCw,
|
|
70
|
-
RotateCcw as rotateCcw,
|
|
71
|
-
Rows3 as rows3,
|
|
72
|
-
Search as search,
|
|
73
|
-
Settings2 as settings2,
|
|
74
|
-
TriangleAlert as triangleAlert,
|
|
75
|
-
X as x
|
|
76
|
-
} from "lucide";
|
|
77
|
-
var createLucideIcon = (icon) => (h, {
|
|
78
|
-
size = 24,
|
|
79
|
-
color = "currentColor",
|
|
80
|
-
strokeWidth = 2,
|
|
81
|
-
className
|
|
82
|
-
} = {}) => h.svg.attrs({
|
|
83
|
-
class: className,
|
|
84
|
-
width: String(size),
|
|
85
|
-
height: String(size),
|
|
86
|
-
viewBox: "0 0 24 24",
|
|
87
|
-
fill: "none",
|
|
88
|
-
stroke: color,
|
|
89
|
-
"stroke-width": String(strokeWidth),
|
|
90
|
-
"stroke-linecap": "round",
|
|
91
|
-
"stroke-linejoin": "round",
|
|
92
|
-
"aria-hidden": "true"
|
|
93
|
-
}).children(...icon.map(([tag, attributes]) => {
|
|
94
|
-
const attrs = Object.fromEntries(Object.entries(attributes).flatMap(([name, value]) => value === undefined ? [] : [[name, String(value)]]));
|
|
95
|
-
switch (tag) {
|
|
96
|
-
case "path":
|
|
97
|
-
return h.path.attrs(attrs);
|
|
98
|
-
case "circle":
|
|
99
|
-
return h.circle.attrs(attrs);
|
|
100
|
-
case "ellipse":
|
|
101
|
-
return h.ellipse.attrs(attrs);
|
|
102
|
-
case "line":
|
|
103
|
-
return h.line.attrs(attrs);
|
|
104
|
-
case "polyline":
|
|
105
|
-
return h.polyline.attrs(attrs);
|
|
106
|
-
case "polygon":
|
|
107
|
-
return h.polygon.attrs(attrs);
|
|
108
|
-
case "rect":
|
|
109
|
-
return h.rect.attrs(attrs);
|
|
110
|
-
default:
|
|
111
|
-
throw new Error(`Unsupported Lucide SVG element: ${tag}`);
|
|
112
|
-
}
|
|
113
|
-
}));
|
|
114
|
-
var Check = createLucideIcon(check);
|
|
115
|
-
var ArrowDown = createLucideIcon(arrowDown);
|
|
116
|
-
var ArrowUp = createLucideIcon(arrowUp);
|
|
117
|
-
var ListFilter = createLucideIcon(listFilter);
|
|
118
|
-
var ChevronLeft = createLucideIcon(chevronLeft);
|
|
119
|
-
var ChevronDown = createLucideIcon(chevronDown);
|
|
120
|
-
var ChevronRight = createLucideIcon(chevronRight);
|
|
121
|
-
var ChevronsLeft = createLucideIcon(chevronsLeft);
|
|
122
|
-
var ChevronsRight = createLucideIcon(chevronsRight);
|
|
123
|
-
var ChevronsUpDown = createLucideIcon(chevronsUpDown);
|
|
124
|
-
var Copy = createLucideIcon(copy);
|
|
125
|
-
var Download = createLucideIcon(download);
|
|
126
|
-
var Eye = createLucideIcon(eye);
|
|
127
|
-
var EyeOff = createLucideIcon(eyeOff);
|
|
128
|
-
var Ellipsis = createLucideIcon(ellipsis);
|
|
129
|
-
var FileJson = createLucideIcon(fileJson);
|
|
130
|
-
var FileText = createLucideIcon(fileText);
|
|
131
|
-
var GripVertical = createLucideIcon(gripVertical);
|
|
132
|
-
var Image = createLucideIcon(image);
|
|
133
|
-
var LayoutGrid = createLucideIcon(layoutGrid);
|
|
134
|
-
var LoaderCircle = createLucideIcon(loaderCircle);
|
|
135
|
-
var Mail = createLucideIcon(mail);
|
|
136
|
-
var Paperclip = createLucideIcon(paperclip);
|
|
137
|
-
var RefreshCw = createLucideIcon(refreshCw);
|
|
138
|
-
var RotateCcw = createLucideIcon(rotateCcw);
|
|
139
|
-
var Rows3 = createLucideIcon(rows3);
|
|
140
|
-
var Search = createLucideIcon(search);
|
|
141
|
-
var Settings2 = createLucideIcon(settings2);
|
|
142
|
-
var TriangleAlert = createLucideIcon(triangleAlert);
|
|
143
|
-
var X = createLucideIcon(x);
|
|
144
|
-
|
|
145
|
-
// ../../src/components/effectcn/calendar.ts
|
|
42
|
+
import { ChevronLeft, ChevronRight } from "@krak-stack/registry/lucide-effect";
|
|
146
43
|
var navClass = "inline-grid size-7 shrink-0 place-items-center rounded-sm border border-input bg-background " + "text-foreground transition-colors duration-150 hover:bg-accent data-[disabled]:cursor-not-allowed " + "data-[disabled]:opacity-40 data-[disabled]:hover:bg-background [&_svg]:size-3.5 rtl:[&_svg]:rotate-180";
|
|
147
44
|
var dayClass = "inline-grid size-8 place-items-center rounded-sm p-0 text-[13px] text-foreground tabular-nums " + "transition-colors duration-150 hover:bg-accent focus-visible:relative focus-visible:outline-offset-1 " + "not-data-[selected]:data-[today]:bg-accent data-[today]:font-semibold " + "not-data-[selected]:data-[outside-month]:text-muted-foreground not-data-[selected]:data-[outside-month]:opacity-55 " + "data-[selected]:bg-primary data-[selected]:text-primary-foreground data-[selected]:hover:bg-primary " + "data-[unavailable]:cursor-not-allowed data-[unavailable]:text-muted-foreground data-[unavailable]:line-through " + "data-[unavailable]:hover:bg-transparent " + "data-[disabled]:cursor-not-allowed data-[disabled]:text-muted-foreground data-[disabled]:opacity-35! " + "data-[disabled]:hover:bg-transparent";
|
|
148
45
|
var CalendarRoot = (h, calendar, options = {}) => calendar.root(h.div.class(cn("inline-flex w-fit flex-col gap-2.5 text-[13px] outline-none data-[disabled]:opacity-60", options.variant !== "ghost" && "bg-card rounded-lg border p-3 shadow-sm", options.class)));
|
|
@@ -177,6 +74,7 @@ var PopoverTitle = (h, popover, options = {}) => popover.title(h.h2.class(cn("m-
|
|
|
177
74
|
|
|
178
75
|
// ../../src/components/date-input/html.ts
|
|
179
76
|
import { krakstackLocaleRead } from "@krak-stack/registry/krakstack-provider/html";
|
|
77
|
+
import { CalendarDays as CalendarIcon, X } from "@krak-stack/registry/lucide-effect";
|
|
180
78
|
|
|
181
79
|
// ../../src/components/date-input/classes.ts
|
|
182
80
|
var dateInputClasses = {
|
|
@@ -318,7 +216,6 @@ var dateInputBehaviours = {
|
|
|
318
216
|
};
|
|
319
217
|
|
|
320
218
|
// ../../src/components/date-input/html.ts
|
|
321
|
-
var CalendarIcon = createLucideIcon(CalendarDays);
|
|
322
219
|
var ApplyDateValidity = Mount.make("ApplyDateValidity", { args: { error: Schema3.String } }, (input, _, changes) => changes.pipe(Stream.runForEach(({ error }) => Effect.sync(() => input.setCustomValidity(error))), Effect.as(Component2.noop)));
|
|
323
220
|
var toUtc = (value) => {
|
|
324
221
|
const date = parseDateOnly(value ?? "");
|
|
@@ -31,8 +31,6 @@ export declare const EditableText: import("effect/ui/Component").Component<"Edit
|
|
|
31
31
|
readonly status: "editing" | "error" | "idle" | "pending";
|
|
32
32
|
readonly draft: Redacted.Redacted<string>;
|
|
33
33
|
}, {
|
|
34
|
-
readonly _tag: "Focused";
|
|
35
|
-
} | {
|
|
36
34
|
readonly _tag: "Opened";
|
|
37
35
|
} | {
|
|
38
36
|
readonly _tag: "Cancelled";
|
|
@@ -43,6 +41,8 @@ export declare const EditableText: import("effect/ui/Component").Component<"Edit
|
|
|
43
41
|
readonly _tag: "Finished";
|
|
44
42
|
readonly value: Redacted.Redacted<string>;
|
|
45
43
|
readonly success: boolean;
|
|
44
|
+
} | {
|
|
45
|
+
readonly _tag: "Focused";
|
|
46
46
|
} | {
|
|
47
47
|
readonly _tag: "Saved";
|
|
48
48
|
}, {
|