@dxos/react-ui-stack 0.6.12 → 0.6.13-main.041e8aa
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/dist/lib/browser/index.mjs +9 -8
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node/index.cjs +7 -6
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs.map +2 -2
- package/dist/lib/node-esm/index.mjs +378 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/testing/index.mjs +161 -0
- package/dist/lib/node-esm/testing/index.mjs.map +7 -0
- package/dist/types/src/components/CaretDownUp.d.ts.map +1 -1
- package/dist/types/src/components/Deck.stories.d.ts.map +1 -1
- package/dist/types/src/components/Section.d.ts +2 -3
- package/dist/types/src/components/Section.d.ts.map +1 -1
- package/dist/types/src/next/Stack.d.ts +9 -0
- package/dist/types/src/next/Stack.d.ts.map +1 -0
- package/dist/types/src/next/Stack.stories.d.ts +8 -0
- package/dist/types/src/next/Stack.stories.d.ts.map +1 -0
- package/dist/types/src/next/StackItem.d.ts +14 -0
- package/dist/types/src/next/StackItem.d.ts.map +1 -0
- package/dist/types/src/next/index.d.ts +2 -0
- package/dist/types/src/next/index.d.ts.map +1 -0
- package/dist/types/src/playwright/playwright.config.d.ts +2 -2
- package/dist/types/src/playwright/playwright.config.d.ts.map +1 -1
- package/dist/types/src/testing/TableContent.d.ts.map +1 -1
- package/dist/types/src/testing/generator.d.ts +1 -1
- package/dist/types/src/testing/generator.d.ts.map +1 -1
- package/package.json +28 -21
- package/src/components/CaretDownUp.tsx +1 -0
- package/src/components/Deck.stories.tsx +16 -26
- package/src/components/Section.tsx +9 -18
- package/src/next/Stack.stories.tsx +146 -0
- package/src/next/Stack.tsx +30 -0
- package/src/next/StackItem.tsx +78 -0
- package/src/next/index.ts +5 -0
- package/src/playwright/playwright.config.ts +13 -2
- package/src/playwright/smoke.spec.ts +11 -19
- package/src/testing/TableContent.tsx +1 -0
- package/src/testing/generator.ts +3 -3
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// packages/ui/react-ui-stack/src/components/Stack.tsx
|
|
4
|
+
import { useArrowNavigationGroup, useFocusableGroup as useFocusableGroup2 } from "@fluentui/react-tabster";
|
|
5
|
+
import React3, { forwardRef as forwardRef2, useCallback } from "react";
|
|
6
|
+
import { useResizeDetector } from "react-resize-detector";
|
|
7
|
+
import { List as List2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
8
|
+
import { Mosaic, Path, useContainer, useItemsWithPreview, useMosaic as useMosaic2 } from "@dxos/react-ui-mosaic";
|
|
9
|
+
import { dropRingInner } from "@dxos/react-ui-theme";
|
|
10
|
+
|
|
11
|
+
// packages/ui/react-ui-stack/src/components/Section.tsx
|
|
12
|
+
import { useFocusableGroup, useTabsterAttributes } from "@fluentui/react-tabster";
|
|
13
|
+
import { ArrowLineDown, ArrowLineUp, ArrowSquareOut, CaretUpDown, Trash } from "@phosphor-icons/react";
|
|
14
|
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
15
|
+
import React2, { forwardRef, useState } from "react";
|
|
16
|
+
import { Button, DropdownMenu, Icon, List, ListItem, ScrollArea, Toolbar, toLocalizedString, useTranslation } from "@dxos/react-ui";
|
|
17
|
+
import { useAttendableAttributes } from "@dxos/react-ui-attention";
|
|
18
|
+
import { DropDownMenuDragHandleTrigger, resizeHandle, resizeHandleHorizontal } from "@dxos/react-ui-deck";
|
|
19
|
+
import { useMosaic } from "@dxos/react-ui-mosaic";
|
|
20
|
+
import { focusRing, getSize, hoverableControlItem, hoverableControls, hoverableFocusedWithinControls, mx } from "@dxos/react-ui-theme";
|
|
21
|
+
|
|
22
|
+
// packages/ui/react-ui-stack/src/components/CaretDownUp.tsx
|
|
23
|
+
import React from "react";
|
|
24
|
+
var CaretDownUp = ({ children, weight, ...props }) => {
|
|
25
|
+
return /* @__PURE__ */ React.createElement("svg", {
|
|
26
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
27
|
+
viewBox: "0 0 256 256",
|
|
28
|
+
...props
|
|
29
|
+
}, /* @__PURE__ */ React.createElement("rect", {
|
|
30
|
+
width: "256",
|
|
31
|
+
height: "256",
|
|
32
|
+
fill: "none"
|
|
33
|
+
}), /* @__PURE__ */ React.createElement("polyline", {
|
|
34
|
+
points: "80 224 128 176 176 224",
|
|
35
|
+
fill: "none",
|
|
36
|
+
stroke: "currentColor",
|
|
37
|
+
strokeLinecap: "round",
|
|
38
|
+
strokeLinejoin: "round",
|
|
39
|
+
strokeWidth: "16"
|
|
40
|
+
}), /* @__PURE__ */ React.createElement("polyline", {
|
|
41
|
+
points: "80 32 128 80 176 32",
|
|
42
|
+
fill: "none",
|
|
43
|
+
stroke: "currentColor",
|
|
44
|
+
strokeLinecap: "round",
|
|
45
|
+
strokeLinejoin: "round",
|
|
46
|
+
strokeWidth: "16"
|
|
47
|
+
}), children);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// packages/ui/react-ui-stack/src/components/style-fragments.ts
|
|
51
|
+
var stackColumns = "grid-cols-[var(--rail-size)_calc(100%-var(--rail-size))]";
|
|
52
|
+
|
|
53
|
+
// packages/ui/react-ui-stack/src/translations.ts
|
|
54
|
+
var translationKey = "stack";
|
|
55
|
+
var translations_default = [
|
|
56
|
+
{
|
|
57
|
+
"en-US": {
|
|
58
|
+
[translationKey]: {
|
|
59
|
+
"empty stack message": "Drag items into the stack.",
|
|
60
|
+
"remove section label": "Delete",
|
|
61
|
+
"navigate to section label": "Navigate to item",
|
|
62
|
+
"untitled section title": "Untitled section",
|
|
63
|
+
"add section before label": "Add before",
|
|
64
|
+
"add section after label": "Add after",
|
|
65
|
+
"expand label": "Expand",
|
|
66
|
+
"collapse label": "Collapse"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
// packages/ui/react-ui-stack/src/components/Section.tsx
|
|
73
|
+
var sectionActionDimensions = "p-1 shrink-0 min-bs-0 is-[--rail-action] bs-min";
|
|
74
|
+
var resizeHandleStyles = mx(resizeHandle, resizeHandleHorizontal, "is-full bs-[--rail-action] col-start-2");
|
|
75
|
+
var Section = /* @__PURE__ */ forwardRef(({ id, title, icon = "ph--placeholder--regular", size = "intrinsic", collapsed, active, isResizable, draggableProps, draggableStyle, onDelete, onNavigate, onAddBefore, onAddAfter, onCollapseSection, children }, forwardedRef) => {
|
|
76
|
+
const { t } = useTranslation(translationKey);
|
|
77
|
+
const [optionsMenuOpen, setOptionsMenuOpen] = useState(false);
|
|
78
|
+
const sectionActionsToolbar = useTabsterAttributes({
|
|
79
|
+
groupper: {},
|
|
80
|
+
focusable: {},
|
|
81
|
+
mover: {
|
|
82
|
+
cyclic: true,
|
|
83
|
+
direction: 1,
|
|
84
|
+
memorizeCurrent: false
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
const sectionContentGroup = useFocusableGroup({});
|
|
88
|
+
const attendableAttrs = useAttendableAttributes(id);
|
|
89
|
+
return /* @__PURE__ */ React2.createElement(CollapsiblePrimitive.Root, {
|
|
90
|
+
asChild: true,
|
|
91
|
+
open: !collapsed,
|
|
92
|
+
onOpenChange: (nextOpen) => onCollapseSection?.(id, !nextOpen)
|
|
93
|
+
}, /* @__PURE__ */ React2.createElement(ListItem.Root, {
|
|
94
|
+
ref: forwardedRef,
|
|
95
|
+
id,
|
|
96
|
+
...attendableAttrs,
|
|
97
|
+
classNames: [
|
|
98
|
+
"grid col-span-2 group/section",
|
|
99
|
+
active === "overlay" ? stackColumns : "grid-cols-subgrid snap-start"
|
|
100
|
+
],
|
|
101
|
+
style: draggableStyle
|
|
102
|
+
}, /* @__PURE__ */ React2.createElement("div", {
|
|
103
|
+
role: "none",
|
|
104
|
+
className: mx("grid col-span-2 grid-cols-subgrid", "bg-base attention-surface", hoverableControls, hoverableFocusedWithinControls, (active === "origin" || active === "rearrange" || active === "destination") && "opacity-0")
|
|
105
|
+
}, /* @__PURE__ */ React2.createElement("div", {
|
|
106
|
+
role: "toolbar",
|
|
107
|
+
"aria-orientation": "vertical",
|
|
108
|
+
"aria-label": t("section controls label"),
|
|
109
|
+
...!active && {
|
|
110
|
+
tabIndex: 0
|
|
111
|
+
},
|
|
112
|
+
...!active && sectionActionsToolbar,
|
|
113
|
+
className: mx("grid grid-cols-subgrid ch-focus-ring rounded-sm grid-rows-[min-content_min-content_1fr] m-1", "group-has-[[role=toolbar][aria-orientation=horizontal]]/section:pbs-[--rail-action]")
|
|
114
|
+
}, /* @__PURE__ */ React2.createElement("div", {
|
|
115
|
+
role: "none",
|
|
116
|
+
className: "sticky -block-start-px bg-[--sticky-bg]"
|
|
117
|
+
}, /* @__PURE__ */ React2.createElement(DropdownMenu.Root, {
|
|
118
|
+
open: optionsMenuOpen,
|
|
119
|
+
onOpenChange: setOptionsMenuOpen
|
|
120
|
+
}, /* @__PURE__ */ React2.createElement(DropDownMenuDragHandleTrigger, {
|
|
121
|
+
active: !!active,
|
|
122
|
+
variant: "ghost",
|
|
123
|
+
classNames: "m-0",
|
|
124
|
+
...draggableProps
|
|
125
|
+
}, /* @__PURE__ */ React2.createElement(Icon, {
|
|
126
|
+
icon,
|
|
127
|
+
size: 5,
|
|
128
|
+
classNames: "transition-opacity"
|
|
129
|
+
})), /* @__PURE__ */ React2.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Content, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Viewport, null, collapsed ? /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
|
|
130
|
+
onClick: onNavigate,
|
|
131
|
+
"data-testid": "section.navigate-to"
|
|
132
|
+
}, /* @__PURE__ */ React2.createElement(ArrowSquareOut, {
|
|
133
|
+
className: mx(getSize(5), "mr-2")
|
|
134
|
+
}), /* @__PURE__ */ React2.createElement("span", {
|
|
135
|
+
className: "grow"
|
|
136
|
+
}, t("navigate to section label"))) : /* @__PURE__ */ React2.createElement(CollapsiblePrimitive.Trigger, {
|
|
137
|
+
asChild: true
|
|
138
|
+
}, /* @__PURE__ */ React2.createElement(DropdownMenu.Item, null, /* @__PURE__ */ React2.createElement(CaretDownUp, {
|
|
139
|
+
className: mx(getSize(5), "mr-2")
|
|
140
|
+
}), /* @__PURE__ */ React2.createElement("span", {
|
|
141
|
+
className: "grow"
|
|
142
|
+
}, t("collapse label")))), /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
|
|
143
|
+
onClick: onAddBefore,
|
|
144
|
+
"data-testid": "section.add-before"
|
|
145
|
+
}, /* @__PURE__ */ React2.createElement(ArrowLineUp, {
|
|
146
|
+
className: mx(getSize(5), "mr-2")
|
|
147
|
+
}), /* @__PURE__ */ React2.createElement("span", {
|
|
148
|
+
className: "grow"
|
|
149
|
+
}, t("add section before label"))), /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
|
|
150
|
+
onClick: onAddAfter,
|
|
151
|
+
"data-testid": "section.add-after"
|
|
152
|
+
}, /* @__PURE__ */ React2.createElement(ArrowLineDown, {
|
|
153
|
+
className: mx(getSize(5), "mr-2")
|
|
154
|
+
}), /* @__PURE__ */ React2.createElement("span", {
|
|
155
|
+
className: "grow"
|
|
156
|
+
}, t("add section after label"))), /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
|
|
157
|
+
onClick: () => onDelete?.(),
|
|
158
|
+
"data-testid": "section.remove"
|
|
159
|
+
}, /* @__PURE__ */ React2.createElement(Trash, {
|
|
160
|
+
className: mx(getSize(5), "mr-2")
|
|
161
|
+
}), /* @__PURE__ */ React2.createElement("span", {
|
|
162
|
+
className: "grow"
|
|
163
|
+
}, t("remove section label")))), /* @__PURE__ */ React2.createElement(DropdownMenu.Arrow, null)))), collapsed ? /* @__PURE__ */ React2.createElement(CollapsiblePrimitive.Trigger, {
|
|
164
|
+
asChild: true
|
|
165
|
+
}, /* @__PURE__ */ React2.createElement(Button, {
|
|
166
|
+
variant: "ghost",
|
|
167
|
+
classNames: sectionActionDimensions
|
|
168
|
+
}, /* @__PURE__ */ React2.createElement("span", {
|
|
169
|
+
className: "sr-only"
|
|
170
|
+
}, t("expand label")), /* @__PURE__ */ React2.createElement(CaretUpDown, {
|
|
171
|
+
className: getSize(4)
|
|
172
|
+
}))) : /* @__PURE__ */ React2.createElement(Button, {
|
|
173
|
+
variant: "ghost",
|
|
174
|
+
classNames: sectionActionDimensions,
|
|
175
|
+
onClick: onNavigate,
|
|
176
|
+
"data-testid": "section.navigate-to"
|
|
177
|
+
}, /* @__PURE__ */ React2.createElement(ArrowSquareOut, {
|
|
178
|
+
className: mx(getSize(4))
|
|
179
|
+
}), /* @__PURE__ */ React2.createElement("span", {
|
|
180
|
+
className: "sr-only"
|
|
181
|
+
}, t("navigate to section label"))))), /* @__PURE__ */ React2.createElement(ListItem.Heading, {
|
|
182
|
+
classNames: collapsed ? [
|
|
183
|
+
"grid grid-rows-subgrid grid-cols-subgrid items-center",
|
|
184
|
+
focusRing
|
|
185
|
+
] : "sr-only",
|
|
186
|
+
...collapsed && {
|
|
187
|
+
...sectionContentGroup,
|
|
188
|
+
tabIndex: 0
|
|
189
|
+
}
|
|
190
|
+
}, /* @__PURE__ */ React2.createElement("span", {
|
|
191
|
+
className: "truncate"
|
|
192
|
+
}, title)), size === "intrinsic" ? /* @__PURE__ */ React2.createElement(CollapsiblePrimitive.Content, {
|
|
193
|
+
...!collapsed && {
|
|
194
|
+
...sectionContentGroup,
|
|
195
|
+
tabIndex: 0
|
|
196
|
+
},
|
|
197
|
+
// TODO(burdon): Add margin to fragment?
|
|
198
|
+
className: mx(focusRing, "m-[2px]")
|
|
199
|
+
}, children) : /* @__PURE__ */ React2.createElement(CollapsiblePrimitive.Content, {
|
|
200
|
+
asChild: true
|
|
201
|
+
}, /* @__PURE__ */ React2.createElement(ScrollArea.Root, {
|
|
202
|
+
type: "always",
|
|
203
|
+
...!collapsed && {
|
|
204
|
+
...sectionContentGroup,
|
|
205
|
+
tabIndex: 0
|
|
206
|
+
},
|
|
207
|
+
classNames: mx(focusRing, "is-full has-[[data-radix-scroll-area-viewport]]:pbe-4")
|
|
208
|
+
}, /* @__PURE__ */ React2.createElement(ScrollArea.Viewport, null, children), /* @__PURE__ */ React2.createElement(ScrollArea.Scrollbar, {
|
|
209
|
+
orientation: "horizontal",
|
|
210
|
+
variant: "coarse",
|
|
211
|
+
classNames: "hidden has-[div]:flex !inline-end-[max(.25rem,var(--radix-scroll-area-corner-width))]"
|
|
212
|
+
}, /* @__PURE__ */ React2.createElement(ScrollArea.Thumb, null)), /* @__PURE__ */ React2.createElement(ScrollArea.Scrollbar, {
|
|
213
|
+
orientation: "vertical",
|
|
214
|
+
variant: "coarse",
|
|
215
|
+
classNames: "hidden has-[div]:flex"
|
|
216
|
+
}, /* @__PURE__ */ React2.createElement(ScrollArea.Thumb, null)), /* @__PURE__ */ React2.createElement(ScrollArea.Corner, null)))), isResizable && !collapsed && /* @__PURE__ */ React2.createElement("button", {
|
|
217
|
+
className: resizeHandleStyles
|
|
218
|
+
}, /* @__PURE__ */ React2.createElement("span", {
|
|
219
|
+
className: "sr-only"
|
|
220
|
+
}, t("resize section label")))));
|
|
221
|
+
});
|
|
222
|
+
var sectionToolbarLayout = "bs-[--rail-action] bg-[--sticky-bg] sticky block-start-0 __-block-start-px transition-opacity";
|
|
223
|
+
var SectionToolbar = ({ children, classNames }) => {
|
|
224
|
+
return /* @__PURE__ */ React2.createElement(Toolbar.Root, {
|
|
225
|
+
orientation: "horizontal",
|
|
226
|
+
classNames: [
|
|
227
|
+
sectionToolbarLayout,
|
|
228
|
+
hoverableControlItem,
|
|
229
|
+
classNames
|
|
230
|
+
]
|
|
231
|
+
}, children);
|
|
232
|
+
};
|
|
233
|
+
var SectionTile = /* @__PURE__ */ forwardRef(({ path, type, active, draggableStyle, draggableProps, item, itemContext }, forwardedRef) => {
|
|
234
|
+
const { t } = useTranslation(translationKey);
|
|
235
|
+
const { activeItem } = useMosaic();
|
|
236
|
+
const separation = !!itemContext?.separation;
|
|
237
|
+
const isResizable = !!itemContext?.isResizable;
|
|
238
|
+
const { transform, onDeleteSection, onNavigateToSection, onAddSection, onCollapseSection, SectionContent } = itemContext;
|
|
239
|
+
const transformedItem = transform ? transform(
|
|
240
|
+
item,
|
|
241
|
+
// TODO(wittjosiah): `active` doesn't always seem to be accurate here.
|
|
242
|
+
activeItem?.item.id === item.id ? activeItem?.type : type
|
|
243
|
+
) : item;
|
|
244
|
+
const placeholder = transformedItem.metadata?.placeholder ?? [
|
|
245
|
+
"untitled section title",
|
|
246
|
+
{
|
|
247
|
+
ns: translationKey
|
|
248
|
+
}
|
|
249
|
+
];
|
|
250
|
+
const title = transformedItem.view?.title ?? toLocalizedString(placeholder, t);
|
|
251
|
+
const section = /* @__PURE__ */ React2.createElement(Section, {
|
|
252
|
+
ref: forwardedRef,
|
|
253
|
+
title,
|
|
254
|
+
id: transformedItem.id,
|
|
255
|
+
size: transformedItem.view?.size,
|
|
256
|
+
icon: transformedItem.metadata?.icon,
|
|
257
|
+
collapsed: transformedItem.view?.collapsed,
|
|
258
|
+
separation,
|
|
259
|
+
active,
|
|
260
|
+
draggableProps,
|
|
261
|
+
draggableStyle,
|
|
262
|
+
onCollapseSection,
|
|
263
|
+
isResizable,
|
|
264
|
+
onDelete: () => onDeleteSection?.(path),
|
|
265
|
+
onNavigate: () => onNavigateToSection?.(transformedItem),
|
|
266
|
+
onAddAfter: () => onAddSection?.(path, "after"),
|
|
267
|
+
onAddBefore: () => onAddSection?.(path, "before")
|
|
268
|
+
}, SectionContent && /* @__PURE__ */ React2.createElement(SectionContent, {
|
|
269
|
+
data: transformedItem.object
|
|
270
|
+
}));
|
|
271
|
+
return active === "overlay" ? /* @__PURE__ */ React2.createElement(List, null, section) : section;
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
// packages/ui/react-ui-stack/src/components/Stack.tsx
|
|
275
|
+
var DEFAULT_TYPE = "stack-section";
|
|
276
|
+
var Stack = ({ id, type = DEFAULT_TYPE, SectionContent, items = [], separation = true, transform, onOver, onDrop, onAddSection, onDeleteSection, onNavigateToSection, onCollapseSection, ...props }) => {
|
|
277
|
+
const { ref: containerRef, width = 0 } = useResizeDetector({
|
|
278
|
+
refreshRate: 200
|
|
279
|
+
});
|
|
280
|
+
const { operation, overItem } = useMosaic2();
|
|
281
|
+
const itemsWithPreview = useItemsWithPreview({
|
|
282
|
+
path: id,
|
|
283
|
+
items
|
|
284
|
+
});
|
|
285
|
+
const getOverlayStyle = useCallback(() => ({
|
|
286
|
+
width
|
|
287
|
+
}), [
|
|
288
|
+
width
|
|
289
|
+
]);
|
|
290
|
+
const getOverlayProps = useCallback(() => ({
|
|
291
|
+
itemContext: {
|
|
292
|
+
transform,
|
|
293
|
+
SectionContent
|
|
294
|
+
}
|
|
295
|
+
}), [
|
|
296
|
+
transform,
|
|
297
|
+
SectionContent
|
|
298
|
+
]);
|
|
299
|
+
const stackModifier = useCallback((_activeItem, { transform: transform2, activeNodeRect, overlayNodeRect }) => {
|
|
300
|
+
if (activeNodeRect && overlayNodeRect) {
|
|
301
|
+
transform2.y += activeNodeRect?.top - overlayNodeRect?.top;
|
|
302
|
+
}
|
|
303
|
+
return transform2;
|
|
304
|
+
}, []);
|
|
305
|
+
return /* @__PURE__ */ React3.createElement(Mosaic.Container, {
|
|
306
|
+
id,
|
|
307
|
+
type,
|
|
308
|
+
Component: SectionTile,
|
|
309
|
+
getOverlayStyle,
|
|
310
|
+
getOverlayProps,
|
|
311
|
+
onOver,
|
|
312
|
+
onDrop,
|
|
313
|
+
modifier: stackModifier
|
|
314
|
+
}, /* @__PURE__ */ React3.createElement(Mosaic.DroppableTile, {
|
|
315
|
+
path: id,
|
|
316
|
+
type,
|
|
317
|
+
item: {
|
|
318
|
+
id,
|
|
319
|
+
items: itemsWithPreview
|
|
320
|
+
},
|
|
321
|
+
// TODO(wittjosiah): Should this actually be a context?
|
|
322
|
+
itemContext: {
|
|
323
|
+
separation,
|
|
324
|
+
transform,
|
|
325
|
+
onDeleteSection,
|
|
326
|
+
onNavigateToSection,
|
|
327
|
+
onAddSection,
|
|
328
|
+
onCollapseSection,
|
|
329
|
+
SectionContent
|
|
330
|
+
},
|
|
331
|
+
isOver: overItem && !!overItem.path && Path.hasRoot(overItem.path, id) && (operation === "copy" || operation === "transfer"),
|
|
332
|
+
Component: StackTile,
|
|
333
|
+
...props,
|
|
334
|
+
ref: containerRef
|
|
335
|
+
}));
|
|
336
|
+
};
|
|
337
|
+
var StackTile = /* @__PURE__ */ forwardRef2(({ classNames, path, isOver, item: { items }, itemContext, type: _type, emptyComponent, ...props }, forwardedRef) => {
|
|
338
|
+
const { t } = useTranslation2(translationKey);
|
|
339
|
+
const { Component, type } = useContainer();
|
|
340
|
+
const domAttributes = useArrowNavigationGroup({
|
|
341
|
+
axis: "grid"
|
|
342
|
+
});
|
|
343
|
+
const { activeItem } = useMosaic2();
|
|
344
|
+
const _group = useFocusableGroup2();
|
|
345
|
+
return /* @__PURE__ */ React3.createElement(List2, {
|
|
346
|
+
ref: forwardedRef,
|
|
347
|
+
classNames: [
|
|
348
|
+
"grid relative",
|
|
349
|
+
stackColumns,
|
|
350
|
+
isOver && dropRingInner,
|
|
351
|
+
classNames
|
|
352
|
+
],
|
|
353
|
+
...!activeItem && domAttributes,
|
|
354
|
+
...props
|
|
355
|
+
}, items.length > 0 ? /* @__PURE__ */ React3.createElement(Mosaic.SortableContext, {
|
|
356
|
+
items,
|
|
357
|
+
direction: "vertical"
|
|
358
|
+
}, items.map((item, index) => /* @__PURE__ */ React3.createElement(Mosaic.SortableTile, {
|
|
359
|
+
key: item.id,
|
|
360
|
+
item,
|
|
361
|
+
itemContext,
|
|
362
|
+
path,
|
|
363
|
+
type,
|
|
364
|
+
position: index,
|
|
365
|
+
Component
|
|
366
|
+
}))) : emptyComponent !== void 0 ? /* @__PURE__ */ React3.createElement(React3.Fragment, null, emptyComponent) : /* @__PURE__ */ React3.createElement("p", {
|
|
367
|
+
className: "grid col-span-2 text-center p-4 border border-dashed border-neutral-500/50 rounded",
|
|
368
|
+
"data-testid": "stack.empty"
|
|
369
|
+
}, t("empty stack message")));
|
|
370
|
+
});
|
|
371
|
+
export {
|
|
372
|
+
DEFAULT_TYPE,
|
|
373
|
+
SectionToolbar,
|
|
374
|
+
Stack,
|
|
375
|
+
sectionToolbarLayout,
|
|
376
|
+
translations_default as translations
|
|
377
|
+
};
|
|
378
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/Stack.tsx", "../../../src/components/Section.tsx", "../../../src/components/CaretDownUp.tsx", "../../../src/components/style-fragments.ts", "../../../src/translations.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { useArrowNavigationGroup, useFocusableGroup } from '@fluentui/react-tabster';\nimport React, { forwardRef, useCallback } from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { List, useTranslation } from '@dxos/react-ui';\nimport {\n type MosaicContainerProps,\n type MosaicTileComponent,\n Mosaic,\n Path,\n useContainer,\n useItemsWithPreview,\n useMosaic,\n} from '@dxos/react-ui-mosaic';\nimport { dropRingInner } from '@dxos/react-ui-theme';\n\nimport {\n type CollapsedSections,\n type AddSectionPosition,\n SectionTile,\n type StackContextValue,\n type StackItem,\n type StackSectionContent,\n type StackSectionItem,\n} from './Section';\nimport { stackColumns } from './style-fragments';\nimport { translationKey } from '../translations';\n\nexport type Direction = 'horizontal' | 'vertical';\n\nexport type { CollapsedSections, AddSectionPosition };\n\nexport const DEFAULT_TYPE = 'stack-section';\n\nexport type StackProps<TData extends StackSectionContent = StackSectionContent> = Omit<\n MosaicContainerProps<TData, number>,\n 'debug' | 'Component'\n> &\n Omit<StackContextValue<TData>, 'setCollapsedSections'> & {\n items?: StackSectionItem[];\n separation?: boolean; // TODO(burdon): Style.\n onCollapseSection?: (id: string, collapsed: boolean) => void;\n emptyComponent?: React.ReactNode;\n };\n\nexport const Stack = ({\n id,\n type = DEFAULT_TYPE,\n SectionContent,\n items = [],\n separation = true,\n transform,\n onOver,\n onDrop,\n onAddSection,\n onDeleteSection,\n onNavigateToSection,\n onCollapseSection,\n ...props\n}: StackProps) => {\n const { ref: containerRef, width = 0 } = useResizeDetector<HTMLDivElement>({ refreshRate: 200 });\n const { operation, overItem } = useMosaic();\n const itemsWithPreview = useItemsWithPreview({ path: id, items });\n\n const getOverlayStyle = useCallback(() => ({ width }), [width]);\n const getOverlayProps = useCallback(\n () => ({ itemContext: { transform, SectionContent } }),\n [transform, SectionContent],\n );\n\n // TODO(thure): The root cause of the discrepancy between `activeNodeRect.top` and `overlayNodeRect.top` in Composer\n // in particular is not yet known, so this solution may may backfire in unforeseeable cases.\n const stackModifier = useCallback<Exclude<MosaicContainerProps['modifier'], undefined>>(\n (_activeItem, { transform, activeNodeRect, overlayNodeRect }) => {\n if (activeNodeRect && overlayNodeRect) {\n transform.y += activeNodeRect?.top - overlayNodeRect?.top;\n }\n return transform;\n },\n [],\n );\n\n return (\n <Mosaic.Container\n {...{\n id,\n type,\n Component: SectionTile as MosaicTileComponent<StackSectionItem, HTMLDivElement>,\n getOverlayStyle,\n getOverlayProps,\n onOver,\n onDrop,\n modifier: stackModifier,\n }}\n >\n <Mosaic.DroppableTile\n path={id}\n type={type}\n item={{ id, items: itemsWithPreview }}\n // TODO(wittjosiah): Should this actually be a context?\n itemContext={{\n separation,\n transform,\n onDeleteSection,\n onNavigateToSection,\n onAddSection,\n onCollapseSection,\n SectionContent,\n }}\n isOver={\n overItem &&\n !!overItem.path &&\n Path.hasRoot(overItem.path, id) &&\n (operation === 'copy' || operation === 'transfer')\n }\n Component={StackTile}\n {...props}\n ref={containerRef}\n />\n </Mosaic.Container>\n );\n};\n\nconst StackTile: MosaicTileComponent<StackItem, HTMLOListElement, Pick<StackProps, 'emptyComponent'>> = forwardRef(\n ({ classNames, path, isOver, item: { items }, itemContext, type: _type, emptyComponent, ...props }, forwardedRef) => {\n const { t } = useTranslation(translationKey);\n const { Component, type } = useContainer();\n const domAttributes = useArrowNavigationGroup({ axis: 'grid' });\n const { activeItem } = useMosaic();\n\n // NOTE(thure): Ensure “groupper” is available, but no need to use it here.\n const _group = useFocusableGroup();\n\n // NOTE: Keep outer padding the same as MarkdownMain.\n return (\n <List\n ref={forwardedRef}\n classNames={['grid relative', stackColumns, isOver && dropRingInner, classNames]}\n {...(!activeItem && domAttributes)}\n {...props}\n >\n {items.length > 0 ? (\n <Mosaic.SortableContext items={items} direction='vertical'>\n {items.map((item, index) => (\n <Mosaic.SortableTile\n key={item.id}\n item={item}\n itemContext={itemContext}\n path={path}\n type={type}\n position={index}\n Component={Component}\n />\n ))}\n </Mosaic.SortableContext>\n ) : emptyComponent !== undefined ? (\n <>{emptyComponent}</>\n ) : (\n <p\n className='grid col-span-2 text-center p-4 border border-dashed border-neutral-500/50 rounded'\n data-testid='stack.empty'\n >\n {t('empty stack message')}\n </p>\n )}\n </List>\n );\n },\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useFocusableGroup, useTabsterAttributes } from '@fluentui/react-tabster';\nimport { ArrowLineDown, ArrowLineUp, ArrowSquareOut, CaretUpDown, Trash } from '@phosphor-icons/react';\nimport * as CollapsiblePrimitive from '@radix-ui/react-collapsible';\nimport React, {\n forwardRef,\n useState,\n type ForwardRefExoticComponent,\n type RefAttributes,\n type FC,\n type PropsWithChildren,\n type ComponentPropsWithRef,\n} from 'react';\n\nimport {\n Button,\n DropdownMenu,\n Icon,\n type Label,\n List,\n ListItem,\n ScrollArea,\n type ThemedClassName,\n Toolbar,\n toLocalizedString,\n useTranslation,\n} from '@dxos/react-ui';\nimport { useAttendableAttributes } from '@dxos/react-ui-attention';\nimport { DropDownMenuDragHandleTrigger, resizeHandle, resizeHandleHorizontal } from '@dxos/react-ui-deck';\nimport {\n type MosaicActiveType,\n type MosaicDataItem,\n type MosaicTileComponent,\n type MosaicTileProps,\n useMosaic,\n} from '@dxos/react-ui-mosaic';\nimport {\n focusRing,\n getSize,\n hoverableControlItem,\n hoverableControls,\n hoverableFocusedWithinControls,\n mx,\n} from '@dxos/react-ui-theme';\n\nimport { CaretDownUp } from './CaretDownUp';\nimport { stackColumns } from './style-fragments';\nimport { translationKey } from '../translations';\n\nconst sectionActionDimensions = 'p-1 shrink-0 min-bs-0 is-[--rail-action] bs-min';\n\nexport type StackSectionContent = MosaicDataItem;\n\nexport type CollapsedSections = Record<string, boolean>;\n\nexport type AddSectionPosition = 'before' | 'after' | 'beforeAll' | 'afterAll';\n\nexport type StackContextValue<TData extends StackSectionContent = StackSectionContent> = {\n SectionContent: FC<{ data: TData }>;\n separation?: boolean;\n isResizable?: boolean;\n transform?: (item: MosaicDataItem, type?: string) => StackSectionItem;\n onDeleteSection?: (path: string) => void;\n onAddSection?: (path: string, position: AddSectionPosition) => void;\n onNavigateToSection?: (object: MosaicDataItem) => void;\n onCollapseSection?: (id: string, collapsed: boolean) => void;\n};\n\nexport type StackItem = MosaicDataItem & {\n items: StackSectionItem[];\n};\n\nexport type StackSectionItem = MosaicDataItem & {\n object: StackSectionContent;\n // TODO(wittjosiah): Use effect schema? Share schema with echo.\n view?: {\n title?: string;\n size?: SectionSize;\n height?: number;\n collapsed?: boolean;\n custom?: Record<string, any>;\n };\n // TODO(wittjosiah): Common type? Factor out?\n metadata?: {\n icon?: string;\n placeholder?: Label;\n viewActions?: (item: StackSectionItem) => StackAction;\n };\n};\n\nexport type StackAction = {\n icon: string;\n label: Label;\n onClick: () => void;\n};\n\nexport type SectionSize = 'intrinsic' | 'extrinsic';\n\nexport type SectionProps = PropsWithChildren<\n {\n // Data props.\n id: string;\n title: string;\n\n // Tile props.\n active?: MosaicActiveType;\n } & Pick<\n MosaicTileProps,\n 'draggableProps' | 'draggableStyle' | 'onDelete' | 'onNavigate' | 'onAddAfter' | 'onAddBefore'\n > &\n Pick<StackContextValue, 'separation' | 'isResizable' | 'onCollapseSection'> &\n Pick<Required<StackSectionItem>['view'], 'collapsed' | 'size'> &\n Pick<Required<StackSectionItem>['metadata'], 'icon'>\n>;\n\nconst resizeHandleStyles = mx(resizeHandle, resizeHandleHorizontal, 'is-full bs-[--rail-action] col-start-2');\n\nexport const Section: ForwardRefExoticComponent<SectionProps & RefAttributes<HTMLLIElement>> = forwardRef<\n HTMLLIElement,\n SectionProps\n>(\n (\n {\n id,\n title,\n icon = 'ph--placeholder--regular',\n size = 'intrinsic',\n collapsed,\n active,\n isResizable,\n draggableProps,\n draggableStyle,\n onDelete,\n onNavigate,\n onAddBefore,\n onAddAfter,\n onCollapseSection,\n children,\n },\n forwardedRef,\n ) => {\n const { t } = useTranslation(translationKey);\n const [optionsMenuOpen, setOptionsMenuOpen] = useState(false);\n const sectionActionsToolbar = useTabsterAttributes({\n groupper: {},\n focusable: {},\n mover: { cyclic: true, direction: 1, memorizeCurrent: false },\n });\n const sectionContentGroup = useFocusableGroup({});\n const attendableAttrs = useAttendableAttributes(id);\n\n return (\n <CollapsiblePrimitive.Root\n asChild\n open={!collapsed}\n onOpenChange={(nextOpen) => onCollapseSection?.(id, !nextOpen)}\n >\n <ListItem.Root\n ref={forwardedRef}\n id={id}\n {...attendableAttrs}\n classNames={[\n 'grid col-span-2 group/section',\n active === 'overlay' ? stackColumns : 'grid-cols-subgrid snap-start',\n ]}\n style={draggableStyle}\n >\n <div\n role='none'\n className={mx(\n 'grid col-span-2 grid-cols-subgrid',\n 'bg-base attention-surface',\n hoverableControls,\n hoverableFocusedWithinControls,\n (active === 'origin' || active === 'rearrange' || active === 'destination') && 'opacity-0',\n )}\n >\n <div\n role='toolbar'\n aria-orientation='vertical'\n aria-label={t('section controls label')}\n {...(!active && { tabIndex: 0 })}\n {...(!active && sectionActionsToolbar)}\n className={mx(\n 'grid grid-cols-subgrid ch-focus-ring rounded-sm grid-rows-[min-content_min-content_1fr] m-1',\n 'group-has-[[role=toolbar][aria-orientation=horizontal]]/section:pbs-[--rail-action]',\n )}\n >\n <div role='none' className='sticky -block-start-px bg-[--sticky-bg]'>\n <DropdownMenu.Root\n {...{\n open: optionsMenuOpen,\n onOpenChange: setOptionsMenuOpen,\n }}\n >\n <DropDownMenuDragHandleTrigger active={!!active} variant='ghost' classNames='m-0' {...draggableProps}>\n <Icon icon={icon} size={5} classNames='transition-opacity' />\n </DropDownMenuDragHandleTrigger>\n <DropdownMenu.Portal>\n <DropdownMenu.Content>\n <DropdownMenu.Viewport>\n {collapsed ? (\n <DropdownMenu.Item onClick={onNavigate} data-testid='section.navigate-to'>\n <ArrowSquareOut className={mx(getSize(5), 'mr-2')} />\n <span className='grow'>{t('navigate to section label')}</span>\n </DropdownMenu.Item>\n ) : (\n <CollapsiblePrimitive.Trigger asChild>\n <DropdownMenu.Item>\n <CaretDownUp className={mx(getSize(5), 'mr-2')} />\n <span className='grow'>{t('collapse label')}</span>\n </DropdownMenu.Item>\n </CollapsiblePrimitive.Trigger>\n )}\n <DropdownMenu.Item onClick={onAddBefore} data-testid='section.add-before'>\n <ArrowLineUp className={mx(getSize(5), 'mr-2')} />\n <span className='grow'>{t('add section before label')}</span>\n </DropdownMenu.Item>\n <DropdownMenu.Item onClick={onAddAfter} data-testid='section.add-after'>\n <ArrowLineDown className={mx(getSize(5), 'mr-2')} />\n <span className='grow'>{t('add section after label')}</span>\n </DropdownMenu.Item>\n <DropdownMenu.Item onClick={() => onDelete?.()} data-testid='section.remove'>\n <Trash className={mx(getSize(5), 'mr-2')} />\n <span className='grow'>{t('remove section label')}</span>\n </DropdownMenu.Item>\n </DropdownMenu.Viewport>\n <DropdownMenu.Arrow />\n </DropdownMenu.Content>\n </DropdownMenu.Portal>\n </DropdownMenu.Root>\n {collapsed ? (\n <CollapsiblePrimitive.Trigger asChild>\n <Button variant='ghost' classNames={sectionActionDimensions}>\n <span className='sr-only'>{t('expand label')}</span>\n <CaretUpDown className={getSize(4)} />\n </Button>\n </CollapsiblePrimitive.Trigger>\n ) : (\n <Button\n variant='ghost'\n classNames={sectionActionDimensions}\n onClick={onNavigate}\n data-testid='section.navigate-to'\n >\n <ArrowSquareOut className={mx(getSize(4))} />\n <span className='sr-only'>{t('navigate to section label')}</span>\n </Button>\n )}\n </div>\n </div>\n\n {/* Main content */}\n\n <ListItem.Heading\n classNames={collapsed ? ['grid grid-rows-subgrid grid-cols-subgrid items-center', focusRing] : 'sr-only'}\n {...(collapsed && { ...sectionContentGroup, tabIndex: 0 })}\n >\n {/*\n TODO(thure): This needs to be made extensible; Markdown document titles especially are difficult.\n Using `Surface` in a UI package like this would be unprecedented and needs motivation.\n Refactoring to use subcomponents is complicated by sections being a sortable Mosaic Tile.\n Reevaluate when work on collections (Folders, Stacks, etc) settles.\n */}\n <span className='truncate'>{title}</span>\n </ListItem.Heading>\n {size === 'intrinsic' ? (\n <CollapsiblePrimitive.Content\n {...(!collapsed && {\n ...sectionContentGroup,\n tabIndex: 0,\n })}\n // TODO(burdon): Add margin to fragment?\n className={mx(focusRing, 'm-[2px]')}\n >\n {children}\n </CollapsiblePrimitive.Content>\n ) : (\n <CollapsiblePrimitive.Content asChild>\n <ScrollArea.Root\n type='always'\n {...(!collapsed && { ...sectionContentGroup, tabIndex: 0 })}\n classNames={mx(focusRing, 'is-full has-[[data-radix-scroll-area-viewport]]:pbe-4')}\n >\n <ScrollArea.Viewport>{children}</ScrollArea.Viewport>\n <ScrollArea.Scrollbar\n orientation='horizontal'\n variant='coarse'\n classNames='hidden has-[div]:flex !inline-end-[max(.25rem,var(--radix-scroll-area-corner-width))]'\n >\n <ScrollArea.Thumb />\n </ScrollArea.Scrollbar>\n <ScrollArea.Scrollbar orientation='vertical' variant='coarse' classNames='hidden has-[div]:flex'>\n <ScrollArea.Thumb />\n </ScrollArea.Scrollbar>\n <ScrollArea.Corner />\n </ScrollArea.Root>\n </CollapsiblePrimitive.Content>\n )}\n </div>\n {isResizable && !collapsed && (\n <button className={resizeHandleStyles}>\n <span className='sr-only'>{t('resize section label')}</span>\n </button>\n )}\n </ListItem.Root>\n </CollapsiblePrimitive.Root>\n );\n },\n);\n\nexport type SectionToolbarProps = ThemedClassName<ComponentPropsWithRef<'div'>>;\n\n// TODO(burdon): block-start\nexport const sectionToolbarLayout =\n 'bs-[--rail-action] bg-[--sticky-bg] sticky block-start-0 __-block-start-px transition-opacity';\n\nexport const SectionToolbar = ({ children, classNames }: SectionToolbarProps) => {\n return (\n <Toolbar.Root orientation='horizontal' classNames={[sectionToolbarLayout, hoverableControlItem, classNames]}>\n {children}\n </Toolbar.Root>\n );\n};\n\nexport const SectionTile: MosaicTileComponent<\n StackSectionItem,\n HTMLLIElement\n // TODO(wittjosiah): If props is specified there is a type error with Mosaic.Container.\n // { itemContext: StackContextValue }\n> = forwardRef(({ path, type, active, draggableStyle, draggableProps, item, itemContext }, forwardedRef) => {\n const { t } = useTranslation(translationKey);\n const { activeItem } = useMosaic();\n\n const separation = !!itemContext?.separation;\n const isResizable = !!itemContext?.isResizable;\n const { transform, onDeleteSection, onNavigateToSection, onAddSection, onCollapseSection, SectionContent } =\n itemContext as StackContextValue;\n\n const transformedItem = transform\n ? transform(\n item,\n // TODO(wittjosiah): `active` doesn't always seem to be accurate here.\n activeItem?.item.id === item.id ? activeItem?.type : type,\n )\n : item;\n\n const placeholder = transformedItem.metadata?.placeholder ?? ['untitled section title', { ns: translationKey }];\n const title = transformedItem.view?.title ?? toLocalizedString(placeholder, t);\n\n const section = (\n <Section\n ref={forwardedRef}\n title={title}\n id={transformedItem.id}\n size={transformedItem.view?.size}\n icon={transformedItem.metadata?.icon}\n collapsed={transformedItem.view?.collapsed}\n separation={separation}\n active={active}\n draggableProps={draggableProps}\n draggableStyle={draggableStyle}\n onCollapseSection={onCollapseSection}\n isResizable={isResizable}\n onDelete={() => onDeleteSection?.(path)}\n onNavigate={() => onNavigateToSection?.(transformedItem)}\n onAddAfter={() => onAddSection?.(path, 'after')}\n onAddBefore={() => onAddSection?.(path, 'before')}\n >\n {SectionContent && <SectionContent data={transformedItem.object} />}\n </Section>\n );\n\n return active === 'overlay' ? <List>{section}</List> : section;\n});\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { type IconProps } from '@phosphor-icons/react';\nimport React from 'react';\n\nexport const CaretDownUp = ({ children, weight, ...props }: IconProps) => {\n return (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' {...props}>\n <rect width='256' height='256' fill='none' />\n <polyline\n points='80 224 128 176 176 224'\n fill='none'\n stroke='currentColor'\n strokeLinecap='round'\n strokeLinejoin='round'\n strokeWidth='16'\n />\n <polyline\n points='80 32 128 80 176 32'\n fill='none'\n stroke='currentColor'\n strokeLinecap='round'\n strokeLinejoin='round'\n strokeWidth='16'\n />\n {children}\n </svg>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nexport const stackColumns = 'grid-cols-[var(--rail-size)_calc(100%-var(--rail-size))]';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport const translationKey = 'stack';\n\nexport default [\n {\n 'en-US': {\n [translationKey]: {\n 'empty stack message': 'Drag items into the stack.',\n 'remove section label': 'Delete',\n 'navigate to section label': 'Navigate to item',\n 'untitled section title': 'Untitled section',\n 'add section before label': 'Add before',\n 'add section after label': 'Add after',\n 'expand label': 'Expand',\n 'collapse label': 'Collapse',\n },\n },\n },\n];\n"],
|
|
5
|
+
"mappings": ";;;AAIA,SAASA,yBAAyBC,qBAAAA,0BAAyB;AAC3D,OAAOC,UAASC,cAAAA,aAAYC,mBAAmB;AAC/C,SAASC,yBAAyB;AAElC,SAASC,QAAAA,OAAMC,kBAAAA,uBAAsB;AACrC,SAGEC,QACAC,MACAC,cACAC,qBACAC,aAAAA,kBACK;AACP,SAASC,qBAAqB;;;ACd9B,SAASC,mBA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AC5B,QAAMC,gBAAgBC,wBAAwB;IAAEC,MAAM;EAAO,CAAA;AAC7D,QAAM,EAAEC,WAAU,IAAKtC,WAAAA;AAGvB,QAAMuC,SAASC,mBAAAA;AAGf,SACE,gBAAA1B,OAAA,cAAC2B,OAAAA;IACChD,KAAKqC;IACLH,YAAY;MAAC;MAAiBe;MAAcpB,UAAUqB;MAAehB;;IACpE,GAAI,CAACW,cAAcH;IACnB,GAAG3C;KAEHT,MAAM6D,SAAS,IACd,gBAAA9B,OAAA,cAACC,OAAO8B,iBAAe;IAAC9D;IAAc+D,WAAU;KAC7C/D,MAAMgE,IAAI,CAAC1B,MAAM2B,UAChB,gBAAAlC,OAAA,cAACC,OAAOkC,cAAY;IAClBC,KAAK7B,KAAKzC;IACVyC;IACAd;IACAJ;IACAtB;IACAsE,UAAUH;IACV/B;SAIJY,mBAAmBuB,SACrB,gBAAAtC,OAAA,cAAAA,OAAA,UAAA,MAAGe,cAAAA,IAEH,gBAAAf,OAAA,cAACuC,KAAAA;IACCC,WAAU;IACVC,eAAY;KAEXxB,EAAE,qBAAA,CAAA,CAAA;AAKb,CAAA;",
|
|
6
|
+
"names": ["useArrowNavigationGroup", "useFocusableGroup", "React", "forwardRef", "useCallback", "useResizeDetector", "List", "useTranslation", "Mosaic", "Path", "useContainer", "useItemsWithPreview", "useMosaic", "dropRingInner", "useFocusableGroup", "useTabsterAttributes", "ArrowLineDown", "ArrowLineUp", "ArrowSquareOut", "CaretUpDown", "Trash", "CollapsiblePrimitive", "React", "forwardRef", "useState", "Button", "DropdownMenu", "Icon", "List", "ListItem", "ScrollArea", "Toolbar", "toLocalizedString", "useTranslation", "useAttendableAttributes", "DropDownMenuDragHandleTrigger", "resizeHandle", "resizeHandleHorizontal", "useMosaic", "focusRing", "getSize", "hoverableControlItem", "hoverableControls", "hoverableFocusedWithinControls", "mx", "React", "CaretDownUp", "children", "weight", "props", "svg", "xmlns", "viewBox", "rect", "width", "height", "fill", "polyline", "points", "stroke", "strokeLinecap", "strokeLinejoin", "strokeWidth", "stackColumns", "translationKey", "sectionActionDimensions", "resizeHandleStyles", "mx", "resizeHandle", "resizeHandleHorizontal", "Section", "forwardRef", "id", "title", "icon", "size", "collapsed", "active", "isResizable", "draggableProps", "draggableStyle", "onDelete", "onNavigate", "onAddBefore", "onAddAfter", "onCollapseSection", "children", "forwardedRef", "t", "useTranslation", "translationKey", "optionsMenuOpen", "setOptionsMenuOpen", "useState", "sectionActionsToolbar", "useTabsterAttributes", "groupper", "focusable", "mover", "cyclic", "direction", "memorizeCurrent", "sectionContentGroup", "useFocusableGroup", "attendableAttrs", "useAttendableAttributes", "React", "Root", "asChild", "open", "onOpenChange", "nextOpen", "ListItem", "ref", "classNames", "stackColumns", "style", "div", "role", "className", "hoverableControls", "hoverableFocusedWithinControls", "aria-orientation", "aria-label", "tabIndex", "DropdownMenu", "DropDownMenuDragHandleTrigger", "variant", "Icon", "Portal", "Content", "Viewport", "Item", "onClick", "data-testid", "ArrowSquareOut", "getSize", "span", "Trigger", "CaretDownUp", "ArrowLineUp", "ArrowLineDown", "Trash", "Arrow", "Button", "CaretUpDown", "Heading", "focusRing", "ScrollArea", "type", "Scrollbar", "orientation", "Thumb", "Corner", "button", "sectionToolbarLayout", "SectionToolbar", "Toolbar", "hoverableControlItem", "SectionTile", "path", "item", "itemContext", "activeItem", "useMosaic", "separation", "transform", "onDeleteSection", "onNavigateToSection", "onAddSection", "SectionContent", "transformedItem", "placeholder", "metadata", "ns", "view", "toLocalizedString", "section", "data", "object", "List", "DEFAULT_TYPE", "Stack", "id", "type", "SectionContent", "items", "separation", "transform", "onOver", "onDrop", "onAddSection", "onDeleteSection", "onNavigateToSection", "onCollapseSection", "props", "ref", "containerRef", "width", "useResizeDetector", "refreshRate", "operation", "overItem", "useMosaic", "itemsWithPreview", "useItemsWithPreview", "path", "getOverlayStyle", "useCallback", "getOverlayProps", "itemContext", "stackModifier", "_activeItem", "activeNodeRect", "overlayNodeRect", "y", "top", "React", "Mosaic", "Container", "Component", "SectionTile", "modifier", "DroppableTile", "item", "isOver", "Path", "hasRoot", "StackTile", "forwardRef", "classNames", "_type", "emptyComponent", "forwardedRef", "t", "useTranslation", "translationKey", "useContainer", "domAttributes", "useArrowNavigationGroup", "axis", "activeItem", "_group", "useFocusableGroup", "List", "stackColumns", "dropRingInner", "length", "SortableContext", "direction", "map", "index", "SortableTile", "key", "position", "undefined", "p", "className", "data-testid"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"packages/ui/react-ui-stack/src/components/CaretDownUp.tsx":{"bytes":3080,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-stack/src/components/style-fragments.ts":{"bytes":707,"imports":[],"format":"esm"},"packages/ui/react-ui-stack/src/translations.ts":{"bytes":2050,"imports":[],"format":"esm"},"packages/ui/react-ui-stack/src/components/Section.tsx":{"bytes":39706,"imports":[{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"@radix-ui/react-collapsible","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-attention","kind":"import-statement","external":true},{"path":"@dxos/react-ui-deck","kind":"import-statement","external":true},{"path":"@dxos/react-ui-mosaic","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-stack/src/components/CaretDownUp.tsx","kind":"import-statement","original":"./CaretDownUp"},{"path":"packages/ui/react-ui-stack/src/components/style-fragments.ts","kind":"import-statement","original":"./style-fragments"},{"path":"packages/ui/react-ui-stack/src/translations.ts","kind":"import-statement","original":"../translations"}],"format":"esm"},"packages/ui/react-ui-stack/src/components/Stack.tsx":{"bytes":16626,"imports":[{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-mosaic","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-stack/src/components/Section.tsx","kind":"import-statement","original":"./Section"},{"path":"packages/ui/react-ui-stack/src/components/style-fragments.ts","kind":"import-statement","original":"./style-fragments"},{"path":"packages/ui/react-ui-stack/src/translations.ts","kind":"import-statement","original":"../translations"}],"format":"esm"},"packages/ui/react-ui-stack/src/components/index.ts":{"bytes":832,"imports":[{"path":"packages/ui/react-ui-stack/src/components/Stack.tsx","kind":"import-statement","original":"./Stack"},{"path":"packages/ui/react-ui-stack/src/components/Section.tsx","kind":"import-statement","original":"./Section"}],"format":"esm"},"packages/ui/react-ui-stack/src/index.ts":{"bytes":718,"imports":[{"path":"packages/ui/react-ui-stack/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/ui/react-ui-stack/src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"packages/ui/react-ui-stack/src/testing/generator.ts":{"bytes":12336,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/random","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-stack/src/testing/stack-manager.ts":{"bytes":7412,"imports":[],"format":"esm"},"packages/ui/react-ui-stack/src/testing/index.ts":{"bytes":612,"imports":[{"path":"packages/ui/react-ui-stack/src/testing/generator.ts","kind":"import-statement","original":"./generator"},{"path":"packages/ui/react-ui-stack/src/testing/stack-manager.ts","kind":"import-statement","original":"./stack-manager"}],"format":"esm"}},"outputs":{"packages/ui/react-ui-stack/dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":33619},"packages/ui/react-ui-stack/dist/lib/node-esm/index.mjs":{"imports":[{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-mosaic","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"@radix-ui/react-collapsible","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-attention","kind":"import-statement","external":true},{"path":"@dxos/react-ui-deck","kind":"import-statement","external":true},{"path":"@dxos/react-ui-mosaic","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["DEFAULT_TYPE","SectionToolbar","Stack","sectionToolbarLayout","translations"],"entryPoint":"packages/ui/react-ui-stack/src/index.ts","inputs":{"packages/ui/react-ui-stack/src/components/Stack.tsx":{"bytesInOutput":3542},"packages/ui/react-ui-stack/src/components/Section.tsx":{"bytesInOutput":10044},"packages/ui/react-ui-stack/src/components/CaretDownUp.tsx":{"bytesInOutput":779},"packages/ui/react-ui-stack/src/components/style-fragments.ts":{"bytesInOutput":79},"packages/ui/react-ui-stack/src/translations.ts":{"bytesInOutput":508},"packages/ui/react-ui-stack/src/components/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-stack/src/index.ts":{"bytesInOutput":0}},"bytes":15603},"packages/ui/react-ui-stack/dist/lib/node-esm/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9965},"packages/ui/react-ui-stack/dist/lib/node-esm/testing/index.mjs":{"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/random","kind":"import-statement","external":true}],"exports":["Priority","SectionManager","StackManager","Status","TestObjectGenerator","defaultGenerators","range"],"entryPoint":"packages/ui/react-ui-stack/src/testing/index.ts","inputs":{"packages/ui/react-ui-stack/src/testing/generator.ts":{"bytesInOutput":2244},"packages/ui/react-ui-stack/src/testing/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-stack/src/testing/stack-manager.ts":{"bytesInOutput":1569}},"bytes":4176}}}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// packages/ui/react-ui-stack/src/testing/generator.ts
|
|
4
|
+
import { create, S } from "@dxos/echo-schema";
|
|
5
|
+
import { faker } from "@dxos/random";
|
|
6
|
+
var range = (fn, length) => Array.from({
|
|
7
|
+
length
|
|
8
|
+
}).map((_, i) => fn(i)).filter(Boolean);
|
|
9
|
+
var createFactory = ({ createSchema, createData }) => {
|
|
10
|
+
const schema = createSchema?.();
|
|
11
|
+
return {
|
|
12
|
+
schema,
|
|
13
|
+
createObject: () => schema ? create(schema, createData()) : create(createData())
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
var Status = [
|
|
17
|
+
"pending",
|
|
18
|
+
"active",
|
|
19
|
+
"done"
|
|
20
|
+
];
|
|
21
|
+
var Priority = [
|
|
22
|
+
1,
|
|
23
|
+
2,
|
|
24
|
+
3,
|
|
25
|
+
4,
|
|
26
|
+
5
|
|
27
|
+
];
|
|
28
|
+
var defaultGenerators = {
|
|
29
|
+
document: {
|
|
30
|
+
createData: () => ({
|
|
31
|
+
title: faker.lorem.sentence(3),
|
|
32
|
+
body: faker.lorem.sentences({
|
|
33
|
+
min: 1,
|
|
34
|
+
max: faker.number.int({
|
|
35
|
+
min: 1,
|
|
36
|
+
max: 3
|
|
37
|
+
})
|
|
38
|
+
})
|
|
39
|
+
})
|
|
40
|
+
},
|
|
41
|
+
image: {
|
|
42
|
+
createData: () => ({
|
|
43
|
+
title: faker.lorem.sentence(3),
|
|
44
|
+
image: faker.helpers.arrayElement(data.images),
|
|
45
|
+
body: faker.datatype.boolean() ? faker.lorem.sentences() : void 0
|
|
46
|
+
})
|
|
47
|
+
},
|
|
48
|
+
project: {
|
|
49
|
+
createSchema: () => S.Struct({
|
|
50
|
+
title: S.String,
|
|
51
|
+
repo: S.String,
|
|
52
|
+
status: S.String,
|
|
53
|
+
priority: S.Number
|
|
54
|
+
}),
|
|
55
|
+
createData: () => ({
|
|
56
|
+
title: faker.commerce.productName(),
|
|
57
|
+
repo: faker.datatype.boolean({
|
|
58
|
+
probability: 0.3
|
|
59
|
+
}) ? faker.internet.url() : void 0,
|
|
60
|
+
status: faker.helpers.arrayElement(Status),
|
|
61
|
+
priority: faker.helpers.arrayElement(Priority)
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
var TestObjectGenerator = class {
|
|
66
|
+
constructor({ types, factories } = {}) {
|
|
67
|
+
this.factories = factories ?? (types ?? Object.keys(defaultGenerators)).reduce((acc, type) => {
|
|
68
|
+
acc[type] = createFactory(defaultGenerators[type]);
|
|
69
|
+
return acc;
|
|
70
|
+
}, {});
|
|
71
|
+
}
|
|
72
|
+
get schema() {
|
|
73
|
+
return Object.values(this.factories).map((f) => f.schema);
|
|
74
|
+
}
|
|
75
|
+
createObject({ types } = {}) {
|
|
76
|
+
const type = faker.helpers.arrayElement(types ?? Object.keys(this.factories));
|
|
77
|
+
const factory = this.factories[type];
|
|
78
|
+
return factory?.createObject();
|
|
79
|
+
}
|
|
80
|
+
createObjects({ types, length }) {
|
|
81
|
+
return range(() => this.createObject({
|
|
82
|
+
types
|
|
83
|
+
}), length);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
var data = {
|
|
87
|
+
images: [
|
|
88
|
+
"/images/image-1.png",
|
|
89
|
+
"/images/image-2.png",
|
|
90
|
+
"/images/image-3.png",
|
|
91
|
+
"/images/image-4.png",
|
|
92
|
+
"/images/image-5.png",
|
|
93
|
+
"/images/image-6.png"
|
|
94
|
+
]
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// packages/ui/react-ui-stack/src/testing/stack-manager.ts
|
|
98
|
+
var StackManager = class {
|
|
99
|
+
constructor(locator) {
|
|
100
|
+
this.locator = locator;
|
|
101
|
+
this._page = locator.page();
|
|
102
|
+
}
|
|
103
|
+
empty() {
|
|
104
|
+
return this.locator.getByTestId("stack.empty");
|
|
105
|
+
}
|
|
106
|
+
sections() {
|
|
107
|
+
return this.locator.locator("li");
|
|
108
|
+
}
|
|
109
|
+
order() {
|
|
110
|
+
return this.locator.locator("li").evaluateAll((els) => els.map((el) => el.getAttribute("id")));
|
|
111
|
+
}
|
|
112
|
+
section(index) {
|
|
113
|
+
return new SectionManager(this.locator.locator("li").nth(index));
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
var SectionManager = class {
|
|
117
|
+
constructor(locator) {
|
|
118
|
+
this.locator = locator;
|
|
119
|
+
this._page = locator.page();
|
|
120
|
+
}
|
|
121
|
+
async id() {
|
|
122
|
+
return this.locator.getAttribute("id");
|
|
123
|
+
}
|
|
124
|
+
async remove() {
|
|
125
|
+
await this.locator.getByTestId("section.drag-handle-menu-trigger").click();
|
|
126
|
+
await this._page.getByTestId("section.remove").click();
|
|
127
|
+
}
|
|
128
|
+
async navigateTo() {
|
|
129
|
+
await this.locator.getByTestId("section.drag-handle-menu-trigger").click();
|
|
130
|
+
await this._page.getByTestId("section.navigate-to").click();
|
|
131
|
+
}
|
|
132
|
+
async dragTo(target, offset = {
|
|
133
|
+
x: 0,
|
|
134
|
+
y: 0
|
|
135
|
+
}) {
|
|
136
|
+
const active = this.locator.getByTestId("section.drag-handle-menu-trigger");
|
|
137
|
+
const box = await target.boundingBox();
|
|
138
|
+
if (box) {
|
|
139
|
+
await active.hover();
|
|
140
|
+
await this._page.mouse.down();
|
|
141
|
+
await this._page.waitForTimeout(100);
|
|
142
|
+
await this._page.pause();
|
|
143
|
+
await this._page.mouse.move(offset.x + box.x + box.width / 2, offset.y + box.y + box.height / 2, {
|
|
144
|
+
steps: 4
|
|
145
|
+
});
|
|
146
|
+
await this._page.pause();
|
|
147
|
+
await this._page.waitForTimeout(100);
|
|
148
|
+
await this._page.mouse.up();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
export {
|
|
153
|
+
Priority,
|
|
154
|
+
SectionManager,
|
|
155
|
+
StackManager,
|
|
156
|
+
Status,
|
|
157
|
+
TestObjectGenerator,
|
|
158
|
+
defaultGenerators,
|
|
159
|
+
range
|
|
160
|
+
};
|
|
161
|
+
//# sourceMappingURL=index.mjs.map
|