@dxos/react-ui-mosaic 0.8.4-main.fcfe5033a5 → 0.9.0
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/LICENSE +102 -5
- package/dist/lib/browser/{chunk-33NNDFD6.mjs → chunk-I3M5WM6C.mjs} +45 -73
- package/dist/lib/browser/chunk-I3M5WM6C.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +125 -59
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/playwright/index.mjs +118 -10
- package/dist/lib/browser/playwright/index.mjs.map +3 -3
- package/dist/lib/browser/testing/index.mjs +10 -19
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/browser/translations.mjs +18 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-Y4LG7O67.mjs → chunk-DVJLDZLE.mjs} +45 -73
- package/dist/lib/node-esm/chunk-DVJLDZLE.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +125 -59
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/playwright/index.mjs +118 -10
- package/dist/lib/node-esm/playwright/index.mjs.map +3 -3
- package/dist/lib/node-esm/testing/index.mjs +10 -19
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/translations.mjs +20 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/types/src/components/Board/Board.d.ts +12 -4
- package/dist/types/src/components/Board/Board.d.ts.map +1 -1
- package/dist/types/src/components/Board/Board.stories.d.ts +3 -3
- package/dist/types/src/components/Board/Board.stories.d.ts.map +1 -1
- package/dist/types/src/components/Board/Column.d.ts +5 -5
- package/dist/types/src/components/Board/Column.d.ts.map +1 -1
- package/dist/types/src/components/Board/Item.d.ts +1 -1
- package/dist/types/src/components/Board/Item.d.ts.map +1 -1
- package/dist/types/src/components/Mosaic/Container.d.ts +9 -1
- package/dist/types/src/components/Mosaic/Container.d.ts.map +1 -1
- package/dist/types/src/components/Mosaic/Mosaic.d.ts +3 -2
- package/dist/types/src/components/Mosaic/Mosaic.d.ts.map +1 -1
- package/dist/types/src/components/Mosaic/Placeholder.d.ts +8 -8
- package/dist/types/src/components/Mosaic/Placeholder.d.ts.map +1 -1
- package/dist/types/src/components/Mosaic/Stack.d.ts +6 -1
- package/dist/types/src/components/Mosaic/Stack.d.ts.map +1 -1
- package/dist/types/src/components/Mosaic/Stack.stories.d.ts.map +1 -1
- package/dist/types/src/components/Mosaic/Tile.d.ts +6 -2
- package/dist/types/src/components/Mosaic/Tile.d.ts.map +1 -1
- package/dist/types/src/components/Mosaic/extension.d.ts.map +1 -1
- package/dist/types/src/components/Mosaic/styles.d.ts.map +1 -1
- package/dist/types/src/components/Mosaic/types.d.ts.map +1 -1
- package/dist/types/src/components/SearchStack/SearchStack.d.ts +20 -0
- package/dist/types/src/components/SearchStack/SearchStack.d.ts.map +1 -0
- package/dist/types/src/components/SearchStack/SearchStack.stories.d.ts +10 -0
- package/dist/types/src/components/SearchStack/SearchStack.stories.d.ts.map +1 -0
- package/dist/types/src/components/SearchStack/index.d.ts +2 -0
- package/dist/types/src/components/SearchStack/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useContainerDebug.d.ts.map +1 -1
- package/dist/types/src/hooks/useDefaultColumnEventHandler.d.ts.map +1 -1
- package/dist/types/src/hooks/useEventHandlerAdapter.d.ts +1 -1
- package/dist/types/src/hooks/useEventHandlerAdapter.d.ts.map +1 -1
- package/dist/types/src/hooks/useVisibleItems.d.ts.map +1 -1
- package/dist/types/src/playwright/board-manager.d.ts +20 -5
- package/dist/types/src/playwright/board-manager.d.ts.map +1 -1
- package/dist/types/src/playwright/playwright.config.d.ts.map +1 -1
- package/dist/types/src/testing/CardContainer.d.ts.map +1 -1
- package/dist/types/src/testing/DefaultStackTile.d.ts.map +1 -1
- package/dist/types/src/testing/types.d.ts +7 -9
- package/dist/types/src/testing/types.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -3
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +42 -40
- package/src/components/Board/Board.stories.tsx +11 -10
- package/src/components/Board/Board.tsx +4 -3
- package/src/components/Board/Column.tsx +22 -18
- package/src/components/Board/Item.tsx +14 -10
- package/src/components/Mosaic/Container.tsx +18 -2
- package/src/components/Mosaic/Placeholder.tsx +6 -0
- package/src/components/Mosaic/Stack.tsx +20 -5
- package/src/components/Mosaic/Tile.tsx +11 -2
- package/src/components/Mosaic/extension.ts +1 -1
- package/src/components/SearchStack/SearchStack.stories.tsx +47 -0
- package/src/components/SearchStack/SearchStack.tsx +135 -0
- package/src/components/SearchStack/index.ts +5 -0
- package/src/components/index.ts +1 -0
- package/src/hooks/useContainerDebug.tsx +3 -3
- package/src/hooks/useEventHandlerAdapter.ts +1 -1
- package/src/playwright/board-manager.ts +168 -13
- package/src/playwright/smoke.spec.ts +3 -3
- package/src/testing/CardContainer.tsx +2 -5
- package/src/testing/DefaultStackTile.tsx +11 -5
- package/src/testing/types.ts +7 -17
- package/dist/lib/browser/chunk-33NNDFD6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Y4LG7O67.mjs.map +0 -7
|
@@ -9,20 +9,21 @@ import {
|
|
|
9
9
|
useMosaicRootContext,
|
|
10
10
|
useMosaicTileContext,
|
|
11
11
|
useVisibleItems
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-DVJLDZLE.mjs";
|
|
13
13
|
|
|
14
14
|
// src/components/Board/Board.tsx
|
|
15
15
|
import { useAtomValue as useAtomValue2 } from "@effect-atom/atom-react";
|
|
16
16
|
import { createContext as createContext2 } from "@radix-ui/react-context";
|
|
17
|
-
import React4, { forwardRef as forwardRef4, useRef as
|
|
17
|
+
import React4, { forwardRef as forwardRef4, useRef as useRef3, useState as useState3 } from "react";
|
|
18
18
|
import { ScrollArea as ScrollArea2 } from "@dxos/react-ui";
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
19
|
+
import { composable as composable2, composableProps as composableProps2 } from "@dxos/react-ui";
|
|
20
|
+
import { JsonHighlighter as JsonHighlighter2 } from "@dxos/react-ui-syntax-highlighter";
|
|
21
|
+
import { mx as mx3 } from "@dxos/ui-theme";
|
|
21
22
|
|
|
22
23
|
// src/hooks/useContainerDebug.tsx
|
|
23
24
|
import React, { forwardRef, useMemo, useRef } from "react";
|
|
24
25
|
import { createPortal } from "react-dom";
|
|
25
|
-
import {
|
|
26
|
+
import { JsonHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
26
27
|
import { mx } from "@dxos/ui-theme";
|
|
27
28
|
var useContainerDebug = (debug) => {
|
|
28
29
|
const debugRef = useRef(null);
|
|
@@ -35,7 +36,6 @@ var useContainerDebug = (debug) => {
|
|
|
35
36
|
}
|
|
36
37
|
return [
|
|
37
38
|
({ classNames }) => /* @__PURE__ */ React.createElement("div", {
|
|
38
|
-
role: "none",
|
|
39
39
|
className: mx("overflow-hidden", classNames),
|
|
40
40
|
ref: debugRef
|
|
41
41
|
}),
|
|
@@ -50,7 +50,7 @@ var CONTAINER_INFO_NAME = "ContainerInfo";
|
|
|
50
50
|
var ContainerInfo = /* @__PURE__ */ forwardRef(({ classNames }, forwardedRef) => {
|
|
51
51
|
const { id, state, activeLocation, scrolling } = useMosaicContainerContext(CONTAINER_INFO_NAME);
|
|
52
52
|
const counter = useRef(0);
|
|
53
|
-
return /* @__PURE__ */ React.createElement(
|
|
53
|
+
return /* @__PURE__ */ React.createElement(JsonHighlighter, {
|
|
54
54
|
data: {
|
|
55
55
|
id,
|
|
56
56
|
activeLocation,
|
|
@@ -75,12 +75,7 @@ var useEventHandlerAdapter = ({ items, getId, get, make, onChange, ...props }) =
|
|
|
75
75
|
onTake: ({ source }, cb) => {
|
|
76
76
|
log.info("onTake", {
|
|
77
77
|
source
|
|
78
|
-
}, {
|
|
79
|
-
F: __dxlog_file,
|
|
80
|
-
L: 61,
|
|
81
|
-
S: void 0,
|
|
82
|
-
C: (f, a) => f(...a)
|
|
83
|
-
});
|
|
78
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 14, S: void 0 });
|
|
84
79
|
const mutate = (items2) => {
|
|
85
80
|
const from = items2.findIndex((item) => getId(item) === source.id);
|
|
86
81
|
if (from !== -1) {
|
|
@@ -98,12 +93,7 @@ var useEventHandlerAdapter = ({ items, getId, get, make, onChange, ...props }) =
|
|
|
98
93
|
log.info("onDrop", {
|
|
99
94
|
source,
|
|
100
95
|
target
|
|
101
|
-
}, {
|
|
102
|
-
F: __dxlog_file,
|
|
103
|
-
L: 78,
|
|
104
|
-
S: void 0,
|
|
105
|
-
C: (f, a) => f(...a)
|
|
106
|
-
});
|
|
96
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 31, S: void 0 });
|
|
107
97
|
const mutate = (items2) => {
|
|
108
98
|
const to = target?.type === "tile" || target?.type === "placeholder" ? target.location : target?.type === "container" ? items2.length : -1;
|
|
109
99
|
const from = items2.findIndex((item) => getId(item) === source.id);
|
|
@@ -247,7 +237,7 @@ var dropField = StateField.define({
|
|
|
247
237
|
toDOM() {
|
|
248
238
|
const dom = document.createElement("span");
|
|
249
239
|
dom.className = "cm-drop-cursor";
|
|
250
|
-
dom.style.borderLeft = "2px solid var(--color-accent-
|
|
240
|
+
dom.style.borderLeft = "2px solid var(--color-accent-bg)";
|
|
251
241
|
dom.style.display = "inline-block";
|
|
252
242
|
dom.style.height = "1em";
|
|
253
243
|
dom.style.verticalAlign = "middle";
|
|
@@ -267,40 +257,29 @@ var dropField = StateField.define({
|
|
|
267
257
|
// src/components/Board/Column.tsx
|
|
268
258
|
import { useAtomValue } from "@effect-atom/atom-react";
|
|
269
259
|
import { createContext } from "@radix-ui/react-context";
|
|
270
|
-
import React3, { forwardRef as forwardRef3, useMemo as useMemo4,
|
|
260
|
+
import React3, { forwardRef as forwardRef3, useMemo as useMemo4, useState as useState2 } from "react";
|
|
271
261
|
import { Obj as Obj2, Ref } from "@dxos/echo";
|
|
272
262
|
import { useObject } from "@dxos/react-client/echo";
|
|
273
263
|
import { IconButton, ScrollArea, Toolbar as Toolbar2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
264
|
+
import { composable, composableProps } from "@dxos/react-ui";
|
|
274
265
|
import { Menu as Menu2, createMenuAction as createMenuAction2 } from "@dxos/react-ui-menu";
|
|
275
|
-
import {
|
|
276
|
-
|
|
277
|
-
// src/translations.ts
|
|
278
|
-
var translationKey = "@dxos/react-ui-mosaic";
|
|
279
|
-
var translations = [
|
|
280
|
-
{
|
|
281
|
-
"en-US": {
|
|
282
|
-
[translationKey]: {
|
|
283
|
-
"action-menu.label": "Actions",
|
|
284
|
-
"add-item.label": "Add item",
|
|
285
|
-
"delete-menu.label": "Delete"
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
];
|
|
266
|
+
import { mx as mx2 } from "@dxos/ui-theme";
|
|
267
|
+
import { translationKey as translationKey2 } from "#translations";
|
|
290
268
|
|
|
291
269
|
// src/components/Board/Item.tsx
|
|
292
270
|
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
293
|
-
import React2, { forwardRef as forwardRef2, useMemo as useMemo3, useRef as useRef2 } from "react";
|
|
271
|
+
import React2, { forwardRef as forwardRef2, useMemo as useMemo3, useRef as useRef2, useState } from "react";
|
|
294
272
|
import { Obj } from "@dxos/echo";
|
|
295
273
|
import { Card, Tag, Toolbar, useTranslation } from "@dxos/react-ui";
|
|
296
274
|
import { Menu, createMenuAction } from "@dxos/react-ui-menu";
|
|
297
275
|
import { getHashStyles } from "@dxos/ui-theme";
|
|
276
|
+
import { translationKey } from "#translations";
|
|
298
277
|
var BOARD_ITEM_NAME = "Board.Item";
|
|
299
|
-
var BoardItemInner = /* @__PURE__ */ forwardRef2(({ classNames, data, location, debug }, forwardedRef) => {
|
|
278
|
+
var BoardItemInner = /* @__PURE__ */ forwardRef2(({ classNames, data, location, debug, draggable }, forwardedRef) => {
|
|
300
279
|
const { t } = useTranslation(translationKey);
|
|
301
280
|
const rootRef = useRef2(null);
|
|
302
281
|
const composedRef = useComposedRefs(rootRef, forwardedRef);
|
|
303
|
-
const
|
|
282
|
+
const [dragHandle, setDragHandle] = useState(null);
|
|
304
283
|
const { model } = useBoard(BOARD_ITEM_NAME);
|
|
305
284
|
const column = useBoardColumn();
|
|
306
285
|
const items = useMemo3(() => column != null && model.onItemDelete ? [
|
|
@@ -322,7 +301,8 @@ var BoardItemInner = /* @__PURE__ */ forwardRef2(({ classNames, data, location,
|
|
|
322
301
|
return /* @__PURE__ */ React2.createElement(Menu.Root, null, /* @__PURE__ */ React2.createElement(Mosaic.Tile, {
|
|
323
302
|
ref: rootRef,
|
|
324
303
|
asChild: true,
|
|
325
|
-
|
|
304
|
+
draggable,
|
|
305
|
+
dragHandle,
|
|
326
306
|
id: data.id,
|
|
327
307
|
data,
|
|
328
308
|
location,
|
|
@@ -334,8 +314,8 @@ var BoardItemInner = /* @__PURE__ */ forwardRef2(({ classNames, data, location,
|
|
|
334
314
|
"data-testid": "board-item",
|
|
335
315
|
ref: composedRef,
|
|
336
316
|
onClick: (event) => event.currentTarget.focus()
|
|
337
|
-
}, /* @__PURE__ */ React2.createElement(Card.
|
|
338
|
-
ref:
|
|
317
|
+
}, /* @__PURE__ */ React2.createElement(Card.Header, null, /* @__PURE__ */ React2.createElement(Card.DragHandle, {
|
|
318
|
+
ref: setDragHandle,
|
|
339
319
|
testId: "mosaicBoard.cardDragHandle"
|
|
340
320
|
}), /* @__PURE__ */ React2.createElement(Card.Title, {
|
|
341
321
|
"data-testid": "mosaicBoard.cardTitle"
|
|
@@ -355,7 +335,6 @@ var BoardItemInner = /* @__PURE__ */ forwardRef2(({ classNames, data, location,
|
|
|
355
335
|
}, /* @__PURE__ */ React2.createElement(Card.Text, null, description)), /* @__PURE__ */ React2.createElement(Card.Row, {
|
|
356
336
|
icon: "ph--tag--regular"
|
|
357
337
|
}, label && /* @__PURE__ */ React2.createElement("div", {
|
|
358
|
-
role: "none",
|
|
359
338
|
className: "shrink-0 flex gap-1 items-center text-xs"
|
|
360
339
|
}, /* @__PURE__ */ React2.createElement(Tag, {
|
|
361
340
|
palette: getHashStyles(label).hue
|
|
@@ -372,17 +351,16 @@ function useBoardColumn() {
|
|
|
372
351
|
return value?.column;
|
|
373
352
|
}
|
|
374
353
|
var BOARD_COLUMN_ROOT_NAME = "Board.Column.Root";
|
|
375
|
-
var BoardColumnRootInner = composable(({ classNames, children, location, data, debug,
|
|
354
|
+
var BoardColumnRootInner = composable(({ classNames, children, location, data, debug, draggable, dragHandle, ...rest }, forwardedRef) => {
|
|
376
355
|
const { model } = useBoard(BOARD_COLUMN_ROOT_NAME);
|
|
377
|
-
const internalRef = useRef3(null);
|
|
378
|
-
const dragHandleRef = dragHandleRefProp ?? internalRef;
|
|
379
356
|
return /* @__PURE__ */ React3.createElement(Mosaic.Tile, {
|
|
380
357
|
asChild: true,
|
|
381
358
|
location,
|
|
382
359
|
id: model.getColumnId(data),
|
|
383
360
|
data,
|
|
384
361
|
debug,
|
|
385
|
-
|
|
362
|
+
draggable,
|
|
363
|
+
dragHandle
|
|
386
364
|
}, /* @__PURE__ */ React3.createElement(Focus.Group, {
|
|
387
365
|
...rest,
|
|
388
366
|
"data-testid": "board-column",
|
|
@@ -397,7 +375,7 @@ BoardColumnRootInner.displayName = BOARD_COLUMN_ROOT_NAME;
|
|
|
397
375
|
var BoardColumnRoot = BoardColumnRootInner;
|
|
398
376
|
var BOARD_COLUMN_HEADER_NAME = "Board.Column.Header";
|
|
399
377
|
var BoardColumnHeader = composable(({ label, dragHandleRef, ...props }, forwardedRef) => {
|
|
400
|
-
const { t } = useTranslation2(
|
|
378
|
+
const { t } = useTranslation2(translationKey2);
|
|
401
379
|
const { model } = useBoard(BOARD_COLUMN_HEADER_NAME);
|
|
402
380
|
const column = useBoardColumn();
|
|
403
381
|
const columnMenuItems = useMemo4(() => column != null && model.onColumnDelete ? [
|
|
@@ -435,7 +413,7 @@ BoardColumnHeader.displayName = BOARD_COLUMN_HEADER_NAME;
|
|
|
435
413
|
var BOARD_COLUMN_BODY_NAME = "Board.Column.Body";
|
|
436
414
|
var BoardColumnBody = composable(({ data, eventHandler, Tile = BoardItem, debug, ...props }, forwardedRef) => {
|
|
437
415
|
const { model } = useBoard(BOARD_COLUMN_BODY_NAME);
|
|
438
|
-
const [viewport, setViewport] =
|
|
416
|
+
const [viewport, setViewport] = useState2(null);
|
|
439
417
|
const items = useAtomValue(model.items(data));
|
|
440
418
|
return /* @__PURE__ */ React3.createElement(Mosaic.Container, {
|
|
441
419
|
...composableProps(props),
|
|
@@ -463,7 +441,7 @@ var BoardColumnBody = composable(({ data, eventHandler, Tile = BoardItem, debug,
|
|
|
463
441
|
BoardColumnBody.displayName = BOARD_COLUMN_BODY_NAME;
|
|
464
442
|
var BOARD_COLUMN_FOOTER_NAME = "Board.Column.Footer";
|
|
465
443
|
var BoardColumnFooter = /* @__PURE__ */ forwardRef3(({ classNames, data, onAdd }, forwardedRef) => {
|
|
466
|
-
const { t } = useTranslation2(
|
|
444
|
+
const { t } = useTranslation2(translationKey2);
|
|
467
445
|
const { model } = useBoard(BOARD_COLUMN_FOOTER_NAME);
|
|
468
446
|
const handleAdd = onAdd ?? (model.onItemCreate && data ? () => void model.onItemCreate?.(data) : void 0);
|
|
469
447
|
return /* @__PURE__ */ React3.createElement(Toolbar2.Root, {
|
|
@@ -481,15 +459,15 @@ var BoardColumnFooter = /* @__PURE__ */ forwardRef3(({ classNames, data, onAdd }
|
|
|
481
459
|
});
|
|
482
460
|
BoardColumnFooter.displayName = BOARD_COLUMN_FOOTER_NAME;
|
|
483
461
|
var BOARD_DEFAULT_COLUMN_NAME = "Board.DefaultColumn";
|
|
484
|
-
var DefaultBoardColumn = /* @__PURE__ */ forwardRef3(({ classNames, location, data, debug, Tile = BoardItem }, forwardedRef) => {
|
|
462
|
+
var DefaultBoardColumn = /* @__PURE__ */ forwardRef3(({ classNames, location, data, debug, draggable, Tile = BoardItem }, forwardedRef) => {
|
|
485
463
|
const { model } = useBoard(BOARD_DEFAULT_COLUMN_NAME);
|
|
486
464
|
const [DebugInfo, debugHandler] = useContainerDebug(debug);
|
|
487
|
-
const
|
|
465
|
+
const [dragHandle, setDragHandle] = useState2(null);
|
|
488
466
|
const [column, updateColumn] = useObject(data);
|
|
489
467
|
const eventHandler = useEventHandlerAdapter({
|
|
490
468
|
id: model.getColumnId(data),
|
|
491
469
|
items: column?.items ?? [],
|
|
492
|
-
getId: (ref) => ref.target?.id ?? ref.
|
|
470
|
+
getId: (ref) => ref.target?.id ?? ref.uri,
|
|
493
471
|
get: (refOrObj) => Ref.isRef(refOrObj) ? refOrObj.target : refOrObj,
|
|
494
472
|
make: (object) => Ref.make(object),
|
|
495
473
|
canDrop: ({ source }) => {
|
|
@@ -502,18 +480,18 @@ var DefaultBoardColumn = /* @__PURE__ */ forwardRef3(({ classNames, location, da
|
|
|
502
480
|
classNames: mx2("group/column grid", debug ? "grid-rows-[var(--dx-rail-action)_1fr_20rem]" : "grid-rows-[var(--dx-rail-action)_1fr_var(--dx-rail-action)]", classNames),
|
|
503
481
|
location,
|
|
504
482
|
data,
|
|
505
|
-
|
|
483
|
+
draggable,
|
|
484
|
+
dragHandle,
|
|
506
485
|
ref: forwardedRef
|
|
507
486
|
}, /* @__PURE__ */ React3.createElement(BoardColumnHeader, {
|
|
508
487
|
label: Obj2.getLabel(data) ?? data.id,
|
|
509
|
-
dragHandleRef
|
|
488
|
+
dragHandleRef: setDragHandle
|
|
510
489
|
}), /* @__PURE__ */ React3.createElement(BoardColumnBody, {
|
|
511
490
|
data,
|
|
512
491
|
eventHandler,
|
|
513
492
|
debug: debugHandler,
|
|
514
493
|
Tile
|
|
515
494
|
}), /* @__PURE__ */ React3.createElement("div", {
|
|
516
|
-
role: "none",
|
|
517
495
|
className: "flex flex-col col-span-full"
|
|
518
496
|
}, /* @__PURE__ */ React3.createElement(BoardColumnFooter, {
|
|
519
497
|
data
|
|
@@ -545,7 +523,7 @@ var BOARD_CONTENT_NAME = "Board.Content";
|
|
|
545
523
|
var BoardContentInner = composable2(({ id: _id, debug, eventHandler, Tile = DefaultBoardColumn, ...props }, forwardedRef) => {
|
|
546
524
|
const { model } = useBoardContext(BOARD_CONTENT_NAME);
|
|
547
525
|
const [DebugInfo, debugHandler] = useContainerDebug(debug);
|
|
548
|
-
const [viewport, setViewport] =
|
|
526
|
+
const [viewport, setViewport] = useState3(null);
|
|
549
527
|
const items = useAtomValue2(model.columns);
|
|
550
528
|
return /* @__PURE__ */ React4.createElement("div", {
|
|
551
529
|
...composableProps2(props, {
|
|
@@ -591,8 +569,8 @@ BoardPlaceholder.displayName = BOARD_PLACEHOLDER_NAME;
|
|
|
591
569
|
var BOARD_DEBUG_NAME = "Board.Debug";
|
|
592
570
|
var BoardDebug = /* @__PURE__ */ forwardRef4(({ classNames }, forwardedRef) => {
|
|
593
571
|
const { containers, dragging } = useMosaicRootContext(BOARD_DEBUG_NAME);
|
|
594
|
-
const counter =
|
|
595
|
-
return /* @__PURE__ */ React4.createElement(
|
|
572
|
+
const counter = useRef3(0);
|
|
573
|
+
return /* @__PURE__ */ React4.createElement(JsonHighlighter2, {
|
|
596
574
|
data: {
|
|
597
575
|
containers,
|
|
598
576
|
dragging,
|
|
@@ -611,11 +589,99 @@ var Board = {
|
|
|
611
589
|
Placeholder: BoardPlaceholder,
|
|
612
590
|
Debug: BoardDebug
|
|
613
591
|
};
|
|
592
|
+
|
|
593
|
+
// src/components/SearchStack/SearchStack.tsx
|
|
594
|
+
import React5, { forwardRef as forwardRef5, useCallback, useMemo as useMemo5, useState as useState4 } from "react";
|
|
595
|
+
import { Card as Card2, ScrollArea as ScrollArea3 } from "@dxos/react-ui";
|
|
596
|
+
import { composable as composable3, composableProps as composableProps3 } from "@dxos/react-ui";
|
|
597
|
+
var SearchStack = composable3(({ results = [], currentId, onAction, ...props }, forwardedRef) => {
|
|
598
|
+
const [viewport, setViewport] = useState4(null);
|
|
599
|
+
const items = useMemo5(() => results.map((result) => ({
|
|
600
|
+
result,
|
|
601
|
+
onAction
|
|
602
|
+
})), [
|
|
603
|
+
results,
|
|
604
|
+
onAction
|
|
605
|
+
]);
|
|
606
|
+
const handleCurrentChange = useCallback((id) => {
|
|
607
|
+
if (id) {
|
|
608
|
+
onAction?.({
|
|
609
|
+
type: "select",
|
|
610
|
+
resultId: id
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
}, [
|
|
614
|
+
onAction
|
|
615
|
+
]);
|
|
616
|
+
const handleKeyDown = useCallback((event) => {
|
|
617
|
+
if (event.key === "Enter") {
|
|
618
|
+
event.preventDefault();
|
|
619
|
+
document.activeElement?.click();
|
|
620
|
+
}
|
|
621
|
+
}, []);
|
|
622
|
+
return /* @__PURE__ */ React5.createElement(Focus.Group, {
|
|
623
|
+
asChild: true,
|
|
624
|
+
...composableProps3(props),
|
|
625
|
+
onKeyDown: handleKeyDown,
|
|
626
|
+
ref: forwardedRef
|
|
627
|
+
}, /* @__PURE__ */ React5.createElement(Mosaic.Container, {
|
|
628
|
+
asChild: true,
|
|
629
|
+
withFocus: true,
|
|
630
|
+
currentId,
|
|
631
|
+
onCurrentChange: handleCurrentChange
|
|
632
|
+
}, /* @__PURE__ */ React5.createElement(ScrollArea3.Root, {
|
|
633
|
+
orientation: "vertical",
|
|
634
|
+
padding: true,
|
|
635
|
+
centered: true,
|
|
636
|
+
thin: true
|
|
637
|
+
}, /* @__PURE__ */ React5.createElement(ScrollArea3.Viewport, {
|
|
638
|
+
ref: setViewport
|
|
639
|
+
}, /* @__PURE__ */ React5.createElement(Mosaic.VirtualStack, {
|
|
640
|
+
Tile: SearchTile,
|
|
641
|
+
classNames: "my-2",
|
|
642
|
+
gap: 8,
|
|
643
|
+
items,
|
|
644
|
+
draggable: false,
|
|
645
|
+
getId: (item) => item.result.id,
|
|
646
|
+
getScrollElement: () => viewport,
|
|
647
|
+
estimateSize: () => 100
|
|
648
|
+
})))));
|
|
649
|
+
});
|
|
650
|
+
SearchStack.displayName = "SearchStack";
|
|
651
|
+
var SearchTile = /* @__PURE__ */ forwardRef5(({ data, location, current }, forwardedRef) => {
|
|
652
|
+
const { result } = data;
|
|
653
|
+
const { setCurrentId } = useMosaicContainerContext("SearchTile");
|
|
654
|
+
const handleCurrentChange = useCallback(() => {
|
|
655
|
+
setCurrentId(result.id);
|
|
656
|
+
}, [
|
|
657
|
+
result.id,
|
|
658
|
+
setCurrentId
|
|
659
|
+
]);
|
|
660
|
+
return /* @__PURE__ */ React5.createElement(Mosaic.Tile, {
|
|
661
|
+
asChild: true,
|
|
662
|
+
classNames: "dx-hover dx-current",
|
|
663
|
+
id: result.id,
|
|
664
|
+
data,
|
|
665
|
+
location,
|
|
666
|
+
current
|
|
667
|
+
}, /* @__PURE__ */ React5.createElement(Focus.Item, {
|
|
668
|
+
asChild: true,
|
|
669
|
+
current,
|
|
670
|
+
onCurrentChange: handleCurrentChange
|
|
671
|
+
}, /* @__PURE__ */ React5.createElement(Card2.Root, {
|
|
672
|
+
fullWidth: true,
|
|
673
|
+
ref: forwardedRef
|
|
674
|
+
}, /* @__PURE__ */ React5.createElement(Card2.Header, null, /* @__PURE__ */ React5.createElement(Card2.IconBlock, null), /* @__PURE__ */ React5.createElement(Card2.Title, null, result.label)), result.snippet && /* @__PURE__ */ React5.createElement(Card2.Body, null, /* @__PURE__ */ React5.createElement(Card2.Row, null, /* @__PURE__ */ React5.createElement(Card2.Text, {
|
|
675
|
+
variant: "description"
|
|
676
|
+
}, result.snippet))))));
|
|
677
|
+
});
|
|
678
|
+
SearchTile.displayName = "SearchTile";
|
|
614
679
|
export {
|
|
615
680
|
Board,
|
|
616
681
|
BoardDebug,
|
|
617
682
|
Focus,
|
|
618
683
|
Mosaic,
|
|
684
|
+
SearchStack,
|
|
619
685
|
dropHandler,
|
|
620
686
|
getSourceData,
|
|
621
687
|
styles as mosaicStyles,
|