@dxos/react-ui-stack 0.8.4-main.84f28bd → 0.8.4-main.9735255
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 +753 -1001
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{testing → playwright}/index.mjs +5 -1
- package/dist/lib/browser/{testing → playwright}/index.mjs.map +3 -3
- package/dist/lib/node-esm/index.mjs +753 -1001
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{testing → playwright}/index.mjs +5 -1
- package/dist/lib/node-esm/{testing → playwright}/index.mjs.map +3 -3
- package/dist/types/src/{exemplars → components}/CardStack/CardStack.d.ts +20 -13
- package/dist/types/src/components/CardStack/CardStack.d.ts.map +1 -0
- package/dist/types/src/components/CardStack/CardStack.stories.d.ts +15 -0
- package/dist/types/src/components/CardStack/CardStack.stories.d.ts.map +1 -0
- package/dist/types/src/{exemplars → components}/CardStack/CardStackDragPreview.d.ts +1 -1
- package/dist/types/src/components/CardStack/CardStackDragPreview.d.ts.map +1 -0
- package/dist/types/src/components/CardStack/index.d.ts.map +1 -0
- package/dist/types/src/components/Stack/Stack.d.ts +15 -7
- package/dist/types/src/components/Stack/Stack.d.ts.map +1 -1
- package/dist/types/src/components/Stack/Stack.stories.d.ts +12 -3
- package/dist/types/src/components/Stack/Stack.stories.d.ts.map +1 -1
- package/dist/types/src/components/StackContext.d.ts +2 -1
- package/dist/types/src/components/StackContext.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItem.d.ts +9 -12
- package/dist/types/src/components/StackItem/StackItem.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItem.stories.d.ts +13 -5
- package/dist/types/src/components/StackItem/StackItem.stories.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItemContent.d.ts +4 -37
- package/dist/types/src/components/StackItem/StackItemContent.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItemHeading.d.ts +1 -1
- package/dist/types/src/components/StackItem/StackItemHeading.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItemResizeHandle.d.ts.map +1 -1
- package/dist/types/src/components/StackItem/StackItemSigil.d.ts +2 -2
- package/dist/types/src/components/StackItem/StackItemSigil.d.ts.map +1 -1
- package/dist/types/src/components/deprecated/LayoutControls.d.ts +3 -0
- package/dist/types/src/components/deprecated/LayoutControls.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/{defs.d.ts → types.d.ts} +1 -1
- package/dist/types/src/components/types.d.ts.map +1 -0
- package/dist/types/src/hooks/useStackDropForElements.d.ts +9 -7
- package/dist/types/src/hooks/useStackDropForElements.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/playwright/index.d.ts.map +1 -0
- package/dist/types/src/playwright/stack-manager.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +2 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +48 -39
- package/src/{exemplars → components}/CardStack/CardStack.stories.tsx +19 -18
- package/src/{exemplars → components}/CardStack/CardStack.tsx +114 -54
- package/src/{exemplars → components}/CardStack/CardStackDragPreview.tsx +3 -3
- package/src/components/Stack/Stack.stories.tsx +8 -9
- package/src/components/Stack/Stack.tsx +225 -26
- package/src/components/StackContext.tsx +2 -1
- package/src/components/StackItem/StackItem.stories.tsx +19 -15
- package/src/components/StackItem/StackItem.tsx +49 -29
- package/src/components/StackItem/StackItemContent.tsx +19 -40
- package/src/components/StackItem/StackItemHeading.tsx +5 -9
- package/src/components/StackItem/StackItemResizeHandle.tsx +2 -1
- package/src/components/StackItem/StackItemSigil.tsx +5 -4
- package/src/components/deprecated/LayoutControls.tsx +3 -0
- package/src/components/index.ts +2 -1
- package/src/hooks/useStackDropForElements.ts +59 -45
- package/src/index.ts +0 -3
- package/src/{testing → playwright}/index.ts +1 -1
- package/src/playwright/playwright.config.ts +1 -1
- package/src/playwright/smoke.spec.ts +1 -1
- package/src/translations.ts +1 -1
- package/dist/types/src/components/defs.d.ts.map +0 -1
- package/dist/types/src/exemplars/Card/Card.d.ts +0 -57
- package/dist/types/src/exemplars/Card/Card.d.ts.map +0 -1
- package/dist/types/src/exemplars/Card/Card.stories.d.ts +0 -13
- package/dist/types/src/exemplars/Card/Card.stories.d.ts.map +0 -1
- package/dist/types/src/exemplars/Card/CardDragPreview.d.ts +0 -6
- package/dist/types/src/exemplars/Card/CardDragPreview.d.ts.map +0 -1
- package/dist/types/src/exemplars/Card/fragments.d.ts +0 -12
- package/dist/types/src/exemplars/Card/fragments.d.ts.map +0 -1
- package/dist/types/src/exemplars/Card/index.d.ts +0 -4
- package/dist/types/src/exemplars/Card/index.d.ts.map +0 -1
- package/dist/types/src/exemplars/CardStack/CardStack.d.ts.map +0 -1
- package/dist/types/src/exemplars/CardStack/CardStack.stories.d.ts +0 -9
- package/dist/types/src/exemplars/CardStack/CardStack.stories.d.ts.map +0 -1
- package/dist/types/src/exemplars/CardStack/CardStackDragPreview.d.ts.map +0 -1
- package/dist/types/src/exemplars/CardStack/index.d.ts.map +0 -1
- package/dist/types/src/exemplars/index.d.ts +0 -3
- package/dist/types/src/exemplars/index.d.ts.map +0 -1
- package/dist/types/src/testing/index.d.ts.map +0 -1
- package/dist/types/src/testing/stack-manager.d.ts.map +0 -1
- package/src/exemplars/Card/Card.stories.tsx +0 -78
- package/src/exemplars/Card/Card.tsx +0 -167
- package/src/exemplars/Card/CardDragPreview.tsx +0 -22
- package/src/exemplars/Card/fragments.ts +0 -23
- package/src/exemplars/Card/index.ts +0 -7
- package/src/exemplars/index.ts +0 -6
- /package/dist/types/src/{exemplars → components}/CardStack/index.d.ts +0 -0
- /package/dist/types/src/{testing → playwright}/index.d.ts +0 -0
- /package/dist/types/src/{testing → playwright}/stack-manager.d.ts +0 -0
- /package/src/{exemplars → components}/CardStack/index.ts +0 -0
- /package/src/components/{defs.ts → types.ts} +0 -0
- /package/src/{testing → playwright}/stack-manager.ts +0 -0
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
// src/components/CardStack/CardStack.tsx
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
3
|
+
import React2, { forwardRef as forwardRef2 } from "react";
|
|
4
|
+
import { Card } from "@dxos/react-ui-mosaic";
|
|
5
|
+
import { cardDefaultInlineSize, mx as mx2 } from "@dxos/ui-theme";
|
|
6
|
+
|
|
1
7
|
// src/components/Stack/Stack.tsx
|
|
2
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
3
|
-
import { useArrowNavigationGroup } from "@fluentui/react-tabster";
|
|
4
8
|
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
5
|
-
import React, { Children, forwardRef,
|
|
6
|
-
import { ListItem } from "@dxos/react-ui";
|
|
7
|
-
import { mx } from "@dxos/
|
|
9
|
+
import React, { Children, forwardRef, useCallback, useEffect, useMemo, useState as useState2 } from "react";
|
|
10
|
+
import { ListItem, useId } from "@dxos/react-ui";
|
|
11
|
+
import { mx } from "@dxos/ui-theme";
|
|
8
12
|
|
|
9
13
|
// src/hooks/useStackDropForElements.ts
|
|
10
14
|
import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine";
|
|
@@ -12,14 +16,16 @@ import { dropTargetForElements } from "@atlaskit/pragmatic-drag-and-drop/element
|
|
|
12
16
|
import { autoScrollForElements } from "@atlaskit/pragmatic-drag-and-drop-auto-scroll/element";
|
|
13
17
|
import { attachClosestEdge, extractClosestEdge } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
|
|
14
18
|
import { useLayoutEffect, useState } from "react";
|
|
15
|
-
var
|
|
19
|
+
var noop = () => {
|
|
20
|
+
};
|
|
21
|
+
var useStackDropForElements = ({ id, element, scrollElement = element, orientation, selfDroppable, onRearrange }) => {
|
|
16
22
|
const [dropping, setDropping] = useState(false);
|
|
17
23
|
useLayoutEffect(() => {
|
|
18
|
-
if (!element
|
|
24
|
+
if (!element) {
|
|
19
25
|
return;
|
|
20
26
|
}
|
|
21
27
|
const acceptSourceType = orientation === "horizontal" ? "column" : "card";
|
|
22
|
-
return combine(dropTargetForElements({
|
|
28
|
+
return combine(selfDroppable ? dropTargetForElements({
|
|
23
29
|
element,
|
|
24
30
|
getData: ({ input, element: element2 }) => {
|
|
25
31
|
return attachClosestEdge({
|
|
@@ -52,16 +58,16 @@ var useStackDropForElements = ({ id, element, scrollElement = element, selfDropp
|
|
|
52
58
|
onRearrange(source.data, self.data, extractClosestEdge(self.data));
|
|
53
59
|
}
|
|
54
60
|
}
|
|
55
|
-
}), autoScrollForElements({
|
|
61
|
+
}) : noop, scrollElement ? autoScrollForElements({
|
|
56
62
|
element: scrollElement,
|
|
57
63
|
getAllowedAxis: () => orientation
|
|
58
|
-
}));
|
|
64
|
+
}) : noop);
|
|
59
65
|
}, [
|
|
66
|
+
id,
|
|
60
67
|
element,
|
|
61
68
|
scrollElement,
|
|
62
69
|
selfDroppable,
|
|
63
70
|
orientation,
|
|
64
|
-
id,
|
|
65
71
|
onRearrange
|
|
66
72
|
]);
|
|
67
73
|
return {
|
|
@@ -100,583 +106,801 @@ var railGridVerticalContainFitContent = "grid-cols-[[rail-start]_var(--rail-size
|
|
|
100
106
|
var autoScrollRootAttributes = {
|
|
101
107
|
"data-drag-autoscroll": "idle"
|
|
102
108
|
};
|
|
103
|
-
var
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
109
|
+
var PERPENDICULAR_FOCUS_THRESHHOLD = 128;
|
|
110
|
+
var scrollIntoViewAndFocus = (el, orientation) => {
|
|
111
|
+
el.scrollIntoView({
|
|
112
|
+
behavior: "instant",
|
|
113
|
+
[orientation === "vertical" ? "block" : "inline"]: "center"
|
|
114
|
+
});
|
|
115
|
+
return el.focus();
|
|
116
|
+
};
|
|
117
|
+
var Stack = /* @__PURE__ */ forwardRef(({ children, classNames, style, orientation = "vertical", rail = true, size = "intrinsic", onRearrange, itemsCount = Children.count(children), getDropElement, separatorOnScroll, circularFocus, ...props }, forwardedRef) => {
|
|
118
|
+
const stackId = useId("stack", props.id);
|
|
119
|
+
const [stackElement, stackRef] = useState2(null);
|
|
120
|
+
const [lastFocusedItem, setLastFocusedItem] = useState2();
|
|
121
|
+
const composedItemRef = composeRefs(stackRef, forwardedRef);
|
|
122
|
+
const styles = {
|
|
123
|
+
[orientation === "horizontal" ? "gridTemplateColumns" : "gridTemplateRows"]: size === "split" ? `repeat(${itemsCount}, 1fr)` : `repeat(${itemsCount}, min-content) [tabster-dummies] 0`,
|
|
124
|
+
...style
|
|
125
|
+
};
|
|
126
|
+
const selfDroppable = !!(itemsCount < 1 && onRearrange && props.id);
|
|
127
|
+
const { dropping } = useStackDropForElements({
|
|
128
|
+
id: props.id,
|
|
129
|
+
element: getDropElement && stackElement ? getDropElement(stackElement) : stackElement,
|
|
130
|
+
scrollElement: stackElement,
|
|
131
|
+
selfDroppable,
|
|
132
|
+
orientation,
|
|
133
|
+
onRearrange
|
|
134
|
+
});
|
|
135
|
+
const handleScroll = useCallback(() => {
|
|
136
|
+
if (stackElement && Number.isFinite(separatorOnScroll)) {
|
|
137
|
+
const scrollPosition = orientation === "horizontal" ? stackElement.scrollLeft : stackElement.scrollTop;
|
|
138
|
+
const scrollSize = orientation === "horizontal" ? stackElement.scrollWidth : stackElement.scrollHeight;
|
|
139
|
+
const clientSize = orientation === "horizontal" ? stackElement.clientWidth : stackElement.clientHeight;
|
|
140
|
+
const separatorHost = stackElement.closest("[data-scroll-separator]");
|
|
141
|
+
if (separatorHost) {
|
|
142
|
+
separatorHost.setAttribute("data-scroll-separator", String(scrollPosition > separatorOnScroll));
|
|
143
|
+
separatorHost.setAttribute("data-scroll-separator-end", String(scrollSize - (scrollPosition + clientSize) > separatorOnScroll));
|
|
134
144
|
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
145
|
+
}
|
|
146
|
+
}, [
|
|
147
|
+
stackElement,
|
|
148
|
+
separatorOnScroll,
|
|
149
|
+
orientation
|
|
150
|
+
]);
|
|
151
|
+
const handleBlur = useCallback((event) => {
|
|
152
|
+
if (event.target) {
|
|
153
|
+
const target = event.target;
|
|
154
|
+
const closestStackItem = target.closest(`[data-dx-item-id]`);
|
|
155
|
+
if (closestStackItem?.closest(`[data-dx-stack="${stackId}"]`)) {
|
|
156
|
+
setLastFocusedItem(closestStackItem?.getAttribute("data-dx-item-id") ?? void 0);
|
|
143
157
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
158
|
+
}
|
|
159
|
+
props.onBlur?.(event);
|
|
160
|
+
}, [
|
|
161
|
+
stackId,
|
|
162
|
+
props.onBlur
|
|
163
|
+
]);
|
|
164
|
+
const handleKeyDown = useCallback((event) => {
|
|
165
|
+
const target = event.target;
|
|
166
|
+
if (event.key.startsWith("Arrow") && !target.closest(`input, textarea, [role="textbox"], [data-tabster*="mover"], [data-arrow-keys="all"], [data-arrow-keys~="${event.key.toLowerCase().slice(5)}"]`)) {
|
|
167
|
+
const closestOwnedItem = target.closest(`[data-dx-stack-item="${stackId}"]`);
|
|
168
|
+
const closestStack = target.closest("[data-dx-stack]");
|
|
169
|
+
const closestStackItems = Array.from(closestStack?.querySelectorAll(`[data-dx-stack-item="${stackId}"]`) ?? []);
|
|
170
|
+
const closestStackOrientation = closestStack?.getAttribute("aria-orientation");
|
|
171
|
+
const ancestorStack = closestStack?.parentElement?.closest("[data-dx-stack]");
|
|
172
|
+
if (closestOwnedItem && closestStack) {
|
|
173
|
+
const ancestorOrientation = ancestorStack?.getAttribute("aria-orientation");
|
|
174
|
+
const parallelDelta = (closestStackOrientation === "vertical" ? event.key === "ArrowUp" : event.key === "ArrowLeft") ? -1 : (closestStackOrientation === "vertical" ? event.key === "ArrowDown" : event.key === "ArrowRight") ? 1 : 0;
|
|
175
|
+
const perpendicularDelta = (closestStackOrientation === "vertical" ? event.key === "ArrowLeft" : event.key === "ArrowUp") ? -1 : (closestStackOrientation === "vertical" ? event.key === "ArrowRight" : event.key === "ArrowDown") ? 1 : 0;
|
|
176
|
+
if (parallelDelta !== 0) {
|
|
177
|
+
const currentIndex = closestStackItems.indexOf(closestOwnedItem);
|
|
178
|
+
const nextIndex = currentIndex + parallelDelta;
|
|
179
|
+
let adjacentItem;
|
|
180
|
+
if (circularFocus) {
|
|
181
|
+
adjacentItem = closestStackItems[(nextIndex + closestStackItems.length) % closestStackItems.length];
|
|
182
|
+
} else {
|
|
183
|
+
if (nextIndex >= 0 && nextIndex < closestStackItems.length) {
|
|
184
|
+
adjacentItem = closestStackItems[nextIndex];
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (adjacentItem) {
|
|
188
|
+
event.preventDefault();
|
|
189
|
+
scrollIntoViewAndFocus(adjacentItem, closestStackOrientation);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (perpendicularDelta !== 0) {
|
|
193
|
+
if (ancestorStack && ancestorOrientation !== closestStackOrientation) {
|
|
194
|
+
const siblingStacks = Array.from(ancestorStack.querySelectorAll(`[data-dx-stack-item="${ancestorStack.getAttribute("data-dx-stack")}"] [data-dx-stack]`));
|
|
195
|
+
const currentStackIndex = siblingStacks.indexOf(closestStack);
|
|
196
|
+
const nextStackIndex = currentStackIndex + perpendicularDelta;
|
|
197
|
+
let adjacentStack;
|
|
198
|
+
if (ancestorStack.getAttribute("data-dx-stack-circular-focus") === "true") {
|
|
199
|
+
adjacentStack = siblingStacks[(nextStackIndex + siblingStacks.length) % siblingStacks.length];
|
|
200
|
+
} else {
|
|
201
|
+
if (nextStackIndex >= 0 && nextStackIndex < siblingStacks.length) {
|
|
202
|
+
adjacentStack = siblingStacks[nextStackIndex];
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
const adjacentStackSelfItem = adjacentStack?.closest(`[data-dx-stack-item=${ancestorStack.getAttribute("data-dx-stack")}]`);
|
|
206
|
+
const adjacentStackItems = adjacentStack ? Array.from(adjacentStack.querySelectorAll(`[data-dx-stack-item="${adjacentStack.getAttribute("data-dx-stack")}"]`)) : [];
|
|
207
|
+
if (adjacentStack && adjacentStackItems.length > 0) {
|
|
208
|
+
let closestItem = adjacentStackItems[0];
|
|
209
|
+
const lastFocusedItem2 = adjacentStack.querySelector(`[data-dx-item-id="${adjacentStack.getAttribute("data-dx-last-focused-item") ?? "never"}"]`);
|
|
210
|
+
if (lastFocusedItem2) {
|
|
211
|
+
closestItem = lastFocusedItem2;
|
|
212
|
+
} else {
|
|
213
|
+
const ownedItemRect = closestOwnedItem.getBoundingClientRect();
|
|
214
|
+
const targetPosition = closestStackOrientation === "vertical" ? ownedItemRect.top : ownedItemRect.left;
|
|
215
|
+
let closestDistance = Infinity;
|
|
216
|
+
for (const item of adjacentStackItems) {
|
|
217
|
+
const itemRect = item.getBoundingClientRect();
|
|
218
|
+
const itemPosition = closestStackOrientation === "vertical" ? itemRect.top : itemRect.left;
|
|
219
|
+
const distance = Math.abs(itemPosition - targetPosition);
|
|
220
|
+
if (distance < closestDistance) {
|
|
221
|
+
closestDistance = distance;
|
|
222
|
+
closestItem = item;
|
|
223
|
+
}
|
|
224
|
+
if (closestDistance <= PERPENDICULAR_FOCUS_THRESHHOLD) {
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
event.preventDefault();
|
|
230
|
+
scrollIntoViewAndFocus(closestItem, closestStackOrientation);
|
|
231
|
+
} else if (adjacentStackSelfItem) {
|
|
232
|
+
event.preventDefault();
|
|
233
|
+
scrollIntoViewAndFocus(adjacentStackSelfItem, ancestorOrientation);
|
|
234
|
+
}
|
|
235
|
+
} else if (closestOwnedItem) {
|
|
236
|
+
const closestOwnedItemStack = closestOwnedItem.querySelector("[data-dx-stack]");
|
|
237
|
+
const closestOwnedItemStackItems = closestOwnedItemStack ? Array.from(closestOwnedItemStack.querySelectorAll(`[data-dx-stack-item="${closestOwnedItemStack.getAttribute("data-dx-stack")}"]`)) : [];
|
|
238
|
+
if (closestOwnedItemStackItems.length > 0) {
|
|
239
|
+
event.preventDefault();
|
|
240
|
+
scrollIntoViewAndFocus(closestOwnedItemStackItems[[
|
|
241
|
+
"ArrowUp",
|
|
242
|
+
"ArrowLeft"
|
|
243
|
+
].includes(event.key) ? closestOwnedItemStackItems.length - 1 : 0], closestOwnedItemStack?.getAttribute("aria-orientation"));
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
148
247
|
}
|
|
149
|
-
}
|
|
150
|
-
|
|
248
|
+
}
|
|
249
|
+
props.onKeyDown?.(event);
|
|
250
|
+
}, [
|
|
251
|
+
props.onKeyDown,
|
|
252
|
+
stackId,
|
|
253
|
+
circularFocus
|
|
254
|
+
]);
|
|
255
|
+
const gridClasses = useMemo(() => {
|
|
256
|
+
if (!rail) {
|
|
257
|
+
return orientation === "horizontal" ? "grid-rows-1 pli-[--stack-gap]" : "grid-cols-1 plb-[--stack-gap]";
|
|
258
|
+
}
|
|
259
|
+
if (orientation === "horizontal") {
|
|
260
|
+
return railGridHorizontal;
|
|
261
|
+
} else {
|
|
262
|
+
return railGridVertical;
|
|
263
|
+
}
|
|
264
|
+
}, [
|
|
265
|
+
rail,
|
|
266
|
+
orientation,
|
|
267
|
+
size
|
|
268
|
+
]);
|
|
269
|
+
useEffect(() => {
|
|
270
|
+
if (!(stackElement && Number.isFinite(separatorOnScroll))) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
const observer = new MutationObserver(() => {
|
|
274
|
+
handleScroll();
|
|
275
|
+
});
|
|
276
|
+
observer.observe(stackElement, {
|
|
277
|
+
childList: true,
|
|
278
|
+
subtree: true
|
|
279
|
+
});
|
|
280
|
+
return () => {
|
|
281
|
+
observer.disconnect();
|
|
282
|
+
};
|
|
283
|
+
}, [
|
|
284
|
+
stackElement,
|
|
285
|
+
handleScroll
|
|
286
|
+
]);
|
|
287
|
+
return /* @__PURE__ */ React.createElement(StackContext.Provider, {
|
|
288
|
+
value: {
|
|
151
289
|
orientation,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
handleScroll
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
290
|
+
rail,
|
|
291
|
+
size,
|
|
292
|
+
onRearrange,
|
|
293
|
+
stackId
|
|
294
|
+
}
|
|
295
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
296
|
+
...props,
|
|
297
|
+
className: mx("grid relative [--stack-gap:var(--dx-trimXs)]", gridClasses, size === "contain" && (orientation === "horizontal" ? "overflow-x-auto overscroll-x-contain min-bs-0 max-bs-full bs-full" : "overflow-y-auto min-is-0 max-is-full is-full"), classNames),
|
|
298
|
+
onKeyDown: handleKeyDown,
|
|
299
|
+
onBlur: handleBlur,
|
|
300
|
+
"data-dx-stack": stackId,
|
|
301
|
+
"data-dx-stack-circular-focus": circularFocus,
|
|
302
|
+
"data-dx-last-focused-item": lastFocusedItem,
|
|
303
|
+
"data-rail": rail,
|
|
304
|
+
"aria-orientation": orientation,
|
|
305
|
+
style: styles,
|
|
306
|
+
ref: composedItemRef,
|
|
307
|
+
...Number.isFinite(separatorOnScroll) && {
|
|
308
|
+
onScroll: handleScroll
|
|
309
|
+
}
|
|
310
|
+
}, children, selfDroppable && dropping && /* @__PURE__ */ React.createElement(ListItem.DropIndicator, {
|
|
311
|
+
lineInset: 8,
|
|
312
|
+
terminalInset: -8,
|
|
313
|
+
gap: -8,
|
|
314
|
+
edge: orientation === "horizontal" ? "left" : "top"
|
|
315
|
+
})));
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
// src/components/CardStack/CardStack.tsx
|
|
319
|
+
var cardStackDefaultInlineSizeRem = cardDefaultInlineSize + 2.125;
|
|
320
|
+
var cardStackRoot = "flex flex-col";
|
|
321
|
+
var CardStackRoot = /* @__PURE__ */ forwardRef2(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
322
|
+
const Root = asChild ? Slot : "div";
|
|
323
|
+
const rootProps = asChild ? {
|
|
324
|
+
classNames: [
|
|
325
|
+
cardStackRoot,
|
|
326
|
+
classNames
|
|
327
|
+
]
|
|
328
|
+
} : {
|
|
329
|
+
className: mx2(cardStackRoot, classNames),
|
|
330
|
+
role
|
|
331
|
+
};
|
|
332
|
+
return /* @__PURE__ */ React2.createElement(Root, {
|
|
333
|
+
...props,
|
|
334
|
+
...rootProps,
|
|
335
|
+
ref: forwardedRef
|
|
336
|
+
}, children);
|
|
337
|
+
});
|
|
338
|
+
var cardStackContent = "shrink min-bs-0 grid dx-focus-ring-group-x-indicator bg-baseSurface";
|
|
339
|
+
var CardStackContent = /* @__PURE__ */ forwardRef2(({ children, classNames, asChild, role = "none", footer, ...props }, forwardedRef) => {
|
|
340
|
+
const Root = asChild ? Slot : "div";
|
|
341
|
+
const baseClassNames = footer ? [
|
|
342
|
+
cardStackContent,
|
|
343
|
+
railGridHorizontalContainFitContent
|
|
344
|
+
] : [
|
|
345
|
+
cardStackContent
|
|
346
|
+
];
|
|
347
|
+
const rootProps = asChild ? {
|
|
348
|
+
classNames: [
|
|
349
|
+
...baseClassNames,
|
|
350
|
+
classNames
|
|
351
|
+
]
|
|
352
|
+
} : {
|
|
353
|
+
className: mx2(...baseClassNames, classNames),
|
|
354
|
+
role
|
|
355
|
+
};
|
|
356
|
+
return /* @__PURE__ */ React2.createElement(Root, {
|
|
357
|
+
...props,
|
|
358
|
+
...rootProps,
|
|
359
|
+
"data-scroll-separator": "false",
|
|
360
|
+
ref: forwardedRef
|
|
361
|
+
}, children);
|
|
362
|
+
});
|
|
363
|
+
var CardStackStack = /* @__PURE__ */ forwardRef2(({ children, classNames, itemsCount = 0, ...props }, forwardedRef) => {
|
|
364
|
+
return /* @__PURE__ */ React2.createElement(Stack, {
|
|
365
|
+
orientation: "vertical",
|
|
366
|
+
size: "contain",
|
|
367
|
+
rail: false,
|
|
368
|
+
classNames: (
|
|
369
|
+
/* NOTE(thure): Do not let this element have zero intrinsic size, otherwise the drop indicator will not display. See #9035. */
|
|
370
|
+
[
|
|
371
|
+
"plb-2",
|
|
372
|
+
classNames
|
|
373
|
+
]
|
|
374
|
+
),
|
|
375
|
+
itemsCount,
|
|
376
|
+
separatorOnScroll: 9,
|
|
377
|
+
"data-density": "fine",
|
|
378
|
+
...props,
|
|
379
|
+
ref: forwardedRef
|
|
380
|
+
}, children);
|
|
381
|
+
});
|
|
382
|
+
var cardStackItem = "contain-layout pli-2 plb-1 first-of-type:pbs-0 last-of-type:pbe-0";
|
|
383
|
+
var CardStackItem = /* @__PURE__ */ forwardRef2(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
384
|
+
const Root = asChild ? Slot : "div";
|
|
385
|
+
const rootProps = asChild ? {
|
|
386
|
+
classNames: [
|
|
387
|
+
cardStackItem,
|
|
388
|
+
classNames
|
|
389
|
+
]
|
|
390
|
+
} : {
|
|
391
|
+
className: mx2(cardStackItem, classNames),
|
|
392
|
+
role
|
|
393
|
+
};
|
|
394
|
+
return /* @__PURE__ */ React2.createElement(Root, {
|
|
395
|
+
...props,
|
|
396
|
+
...rootProps,
|
|
397
|
+
ref: forwardedRef
|
|
398
|
+
}, children);
|
|
399
|
+
});
|
|
400
|
+
var cardStackHeading = "mli-2 order-first bg-transparent rounded-bs-md flex items-center";
|
|
401
|
+
var CardStackHeading = /* @__PURE__ */ forwardRef2(({ children, classNames, asChild, role = "heading", ...props }, forwardedRef) => {
|
|
402
|
+
const Root = asChild ? Slot : "div";
|
|
403
|
+
const rootProps = asChild ? {
|
|
404
|
+
classNames: [
|
|
405
|
+
cardStackHeading,
|
|
406
|
+
classNames
|
|
407
|
+
]
|
|
408
|
+
} : {
|
|
409
|
+
className: mx2(cardStackHeading, classNames),
|
|
410
|
+
role
|
|
411
|
+
};
|
|
412
|
+
return /* @__PURE__ */ React2.createElement(Root, {
|
|
413
|
+
...props,
|
|
414
|
+
...rootProps,
|
|
415
|
+
ref: forwardedRef
|
|
416
|
+
}, children);
|
|
417
|
+
});
|
|
418
|
+
var cardStackFooter = 'plb-2 mli-2 border-bs border-transparent [[data-scroll-separator-end="true"]_&]:border-subduedSeparator';
|
|
419
|
+
var CardStackFooter = /* @__PURE__ */ forwardRef2(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
420
|
+
const Root = asChild ? Slot : "div";
|
|
421
|
+
const rootProps = asChild ? {
|
|
422
|
+
classNames: [
|
|
423
|
+
cardStackFooter,
|
|
424
|
+
classNames
|
|
425
|
+
]
|
|
426
|
+
} : {
|
|
427
|
+
className: mx2(cardStackFooter, classNames),
|
|
428
|
+
role
|
|
429
|
+
};
|
|
430
|
+
return /* @__PURE__ */ React2.createElement(Root, {
|
|
431
|
+
...props,
|
|
432
|
+
...rootProps,
|
|
433
|
+
ref: forwardedRef
|
|
434
|
+
}, children);
|
|
435
|
+
});
|
|
436
|
+
var CardStackDragHandle = Card.DragHandle;
|
|
437
|
+
var CardStack = {
|
|
438
|
+
Root: CardStackRoot,
|
|
439
|
+
Content: CardStackContent,
|
|
440
|
+
Stack: CardStackStack,
|
|
441
|
+
Heading: CardStackHeading,
|
|
442
|
+
Footer: CardStackFooter,
|
|
443
|
+
DragHandle: CardStackDragHandle,
|
|
444
|
+
Item: CardStackItem
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
// src/components/CardStack/CardStackDragPreview.tsx
|
|
448
|
+
import React3 from "react";
|
|
449
|
+
import { IconButton, useTranslation } from "@dxos/react-ui";
|
|
450
|
+
import { mx as mx3 } from "@dxos/ui-theme";
|
|
451
|
+
|
|
452
|
+
// src/translations.ts
|
|
453
|
+
var translationKey = "@dxos/react-ui-stack";
|
|
454
|
+
var translations = [
|
|
455
|
+
{
|
|
456
|
+
"en-US": {
|
|
457
|
+
[translationKey]: {
|
|
458
|
+
"resize label": "Drag to resize",
|
|
459
|
+
"drag handle label": "Drag to rearrange",
|
|
460
|
+
"pin start label": "Pin to the left sidebar",
|
|
461
|
+
"pin end label": "Pin to the right sidebar",
|
|
462
|
+
"increment start label": "Move to the left",
|
|
463
|
+
"increment end label": "Move to the right",
|
|
464
|
+
"close label": "Close",
|
|
465
|
+
"minify label": "Minify"
|
|
189
466
|
}
|
|
190
|
-
}
|
|
191
|
-
lineInset: 8,
|
|
192
|
-
terminalInset: -8,
|
|
193
|
-
gap: -8,
|
|
194
|
-
edge: orientation === "horizontal" ? "left" : "top"
|
|
195
|
-
})));
|
|
196
|
-
} finally {
|
|
197
|
-
_effect.f();
|
|
467
|
+
}
|
|
198
468
|
}
|
|
199
|
-
|
|
469
|
+
];
|
|
470
|
+
|
|
471
|
+
// src/components/CardStack/CardStackDragPreview.tsx
|
|
472
|
+
var CardStackDragPreviewRoot = ({ children }) => {
|
|
473
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
474
|
+
className: "p-2"
|
|
475
|
+
}, /* @__PURE__ */ React3.createElement("div", {
|
|
476
|
+
className: "rounded-md max-bs-[calc(100dvh-1rem)] overflow-hidden bg-baseSurface border border-separator ring-focusLine ring-neutralFocusIndicator flex flex-col"
|
|
477
|
+
}, children));
|
|
478
|
+
};
|
|
479
|
+
var CardStackDragPreviewHeading = ({ children }) => {
|
|
480
|
+
const { t } = useTranslation(translationKey);
|
|
481
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
482
|
+
className: "flex items-center p-2"
|
|
483
|
+
}, /* @__PURE__ */ React3.createElement(IconButton, {
|
|
484
|
+
iconOnly: true,
|
|
485
|
+
icon: "ph--dots-six-vertical--regular",
|
|
486
|
+
variant: "ghost",
|
|
487
|
+
label: t("column drag handle label"),
|
|
488
|
+
classNames: "pli-2"
|
|
489
|
+
}), children);
|
|
490
|
+
};
|
|
491
|
+
var CardStackDragPreviewContent = ({ children, itemsCount = 0 }) => {
|
|
492
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
493
|
+
className: mx3("overflow-y-auto flex-1 pli-2 flex flex-col gap-2", "plb-1", itemsCount > 0 ? "plb-2" : "plb-1")
|
|
494
|
+
}, children);
|
|
495
|
+
};
|
|
496
|
+
var CardStackDragPreviewFooter = ({ children }) => {
|
|
497
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
498
|
+
className: "p-2 border-bs border-separator"
|
|
499
|
+
}, children);
|
|
500
|
+
};
|
|
501
|
+
var CardStackDragPreview = {
|
|
502
|
+
Root: CardStackDragPreviewRoot,
|
|
503
|
+
Heading: CardStackDragPreviewHeading,
|
|
504
|
+
Content: CardStackDragPreviewContent,
|
|
505
|
+
Footer: CardStackDragPreviewFooter
|
|
506
|
+
};
|
|
200
507
|
|
|
201
508
|
// src/components/StackItem/StackItem.tsx
|
|
202
|
-
import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
|
|
203
509
|
import { combine as combine2 } from "@atlaskit/pragmatic-drag-and-drop/combine";
|
|
204
510
|
import { draggable, dropTargetForElements as dropTargetForElements2 } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
205
511
|
import { preserveOffsetOnSource } from "@atlaskit/pragmatic-drag-and-drop/element/preserve-offset-on-source";
|
|
206
512
|
import { setCustomNativeDragPreview } from "@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview";
|
|
207
513
|
import { attachClosestEdge as attachClosestEdge2, extractClosestEdge as extractClosestEdge2 } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
|
|
208
|
-
import { useFocusableGroup
|
|
514
|
+
import { useFocusableGroup } from "@fluentui/react-tabster";
|
|
209
515
|
import { composeRefs as composeRefs2 } from "@radix-ui/react-compose-refs";
|
|
210
|
-
import
|
|
516
|
+
import React10, { forwardRef as forwardRef6, useCallback as useCallback2, useLayoutEffect as useLayoutEffect2, useMemo as useMemo3, useState as useState4 } from "react";
|
|
211
517
|
import { createPortal } from "react-dom";
|
|
212
518
|
import { ListItem as ListItem2 } from "@dxos/react-ui";
|
|
213
519
|
import { resizeAttributes, sizeStyle } from "@dxos/react-ui-dnd";
|
|
214
|
-
import { mx as
|
|
520
|
+
import { mx as mx7 } from "@dxos/ui-theme";
|
|
215
521
|
|
|
216
522
|
// src/components/StackItem/StackItemContent.tsx
|
|
217
|
-
import {
|
|
218
|
-
import
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
style,
|
|
245
|
-
"data-popover-collision-boundary": true,
|
|
246
|
-
ref: forwardedRef
|
|
247
|
-
}, children);
|
|
248
|
-
} finally {
|
|
249
|
-
_effect.f();
|
|
250
|
-
}
|
|
523
|
+
import React4, { forwardRef as forwardRef3, useMemo as useMemo2 } from "react";
|
|
524
|
+
import { mx as mx4 } from "@dxos/ui-theme";
|
|
525
|
+
var StackItemContent = /* @__PURE__ */ forwardRef3(({ classNames, children, toolbar, statusbar, ...props }, forwardedRef) => {
|
|
526
|
+
const { size: stackItemSize } = useStack();
|
|
527
|
+
const { role } = useStackItem();
|
|
528
|
+
const style = useMemo2(() => ({
|
|
529
|
+
gridTemplateRows: [
|
|
530
|
+
...toolbar ? [
|
|
531
|
+
role === "section" ? "calc(var(--toolbar-size) - 1px)" : "var(--toolbar-size)"
|
|
532
|
+
] : [],
|
|
533
|
+
"1fr",
|
|
534
|
+
...statusbar ? [
|
|
535
|
+
"var(--statusbar-size)"
|
|
536
|
+
] : []
|
|
537
|
+
].join(" ")
|
|
538
|
+
}), [
|
|
539
|
+
toolbar,
|
|
540
|
+
statusbar
|
|
541
|
+
]);
|
|
542
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
543
|
+
...props,
|
|
544
|
+
role: "none",
|
|
545
|
+
style,
|
|
546
|
+
className: mx4("group grid grid-cols-[100%] density-coarse", stackItemSize === "contain" && "min-bs-0 overflow-hidden", role === "section" && toolbar && "[&_.dx-toolbar]:sticky [&_.dx-toolbar]:z-[1] [&_.dx-toolbar]:block-start-0 [&_.dx-toolbar]:-mbe-px [&_.dx-toolbar]:min-is-0", toolbar && "[&>.dx-toolbar]:relative [&>.dx-toolbar]:border-be [&>.dx-toolbar]:border-subduedSeparator", classNames),
|
|
547
|
+
"data-popover-collision-boundary": true,
|
|
548
|
+
ref: forwardedRef
|
|
549
|
+
}, children);
|
|
251
550
|
});
|
|
551
|
+
StackItemContent.displayName = "StackItemContent";
|
|
252
552
|
|
|
253
553
|
// src/components/StackItem/StackItemDragHandle.tsx
|
|
254
|
-
import {
|
|
255
|
-
import
|
|
256
|
-
import React3 from "react";
|
|
554
|
+
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
555
|
+
import React5 from "react";
|
|
257
556
|
var StackItemDragHandle = ({ asChild, children }) => {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
role: "button"
|
|
265
|
-
}, children);
|
|
266
|
-
} finally {
|
|
267
|
-
_effect.f();
|
|
268
|
-
}
|
|
557
|
+
const { selfDragHandleRef } = useStackItem();
|
|
558
|
+
const Root = asChild ? Slot2 : "div";
|
|
559
|
+
return /* @__PURE__ */ React5.createElement(Root, {
|
|
560
|
+
ref: selfDragHandleRef,
|
|
561
|
+
role: "button"
|
|
562
|
+
}, children);
|
|
269
563
|
};
|
|
270
564
|
|
|
271
565
|
// src/components/StackItem/StackItemHeading.tsx
|
|
272
|
-
import {
|
|
273
|
-
import {
|
|
274
|
-
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
275
|
-
import React4, { forwardRef as forwardRef3 } from "react";
|
|
566
|
+
import { Slot as Slot3 } from "@radix-ui/react-slot";
|
|
567
|
+
import React6, { forwardRef as forwardRef4 } from "react";
|
|
276
568
|
import { useAttention } from "@dxos/react-ui-attention";
|
|
277
|
-
import { mx as
|
|
569
|
+
import { mx as mx5 } from "@dxos/ui-theme";
|
|
278
570
|
var StackItemHeading = ({ children, classNames, asChild, separateOnScroll, ...props }) => {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
return /* @__PURE__ */ React4.createElement(Root, {
|
|
287
|
-
role: "heading",
|
|
288
|
-
...props,
|
|
289
|
-
tabIndex: 0,
|
|
290
|
-
...focusableGroupAttrs,
|
|
291
|
-
className: mx3("flex items-center dx-focus-ring-inset-over-all relative !border-is-0 bg-headerSurface", separateOnScroll ? 'border-transparent [[data-scroll-separator="true"]_&]:border-subduedSeparator' : "border-subduedSeparator", orientation === "horizontal" ? "bs-[--rail-size]" : "is-[--rail-size] flex-col", orientation === "horizontal" ? "border-be" : "border-ie", classNames)
|
|
292
|
-
}, children);
|
|
293
|
-
} finally {
|
|
294
|
-
_effect.f();
|
|
295
|
-
}
|
|
571
|
+
const { orientation } = useStack();
|
|
572
|
+
const Root = asChild ? Slot3 : "div";
|
|
573
|
+
return /* @__PURE__ */ React6.createElement(Root, {
|
|
574
|
+
role: "heading",
|
|
575
|
+
...props,
|
|
576
|
+
className: mx5("flex items-center !border-is-0 bg-headerSurface", separateOnScroll ? 'border-transparent [[data-scroll-separator="true"]_&]:border-subduedSeparator' : "border-subduedSeparator", orientation === "horizontal" ? "bs-[--rail-size]" : "is-[--rail-size] flex-col", orientation === "horizontal" ? "border-be" : "border-ie", classNames)
|
|
577
|
+
}, children);
|
|
296
578
|
};
|
|
297
579
|
var StackItemHeadingStickyContent = ({ children }) => {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
className: "sticky block-start-0 bg-[--sticky-bg] p-1 is-full"
|
|
303
|
-
}, children);
|
|
304
|
-
} finally {
|
|
305
|
-
_effect.f();
|
|
306
|
-
}
|
|
580
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
581
|
+
role: "none",
|
|
582
|
+
className: "sticky block-start-0 bg-[--sticky-bg] p-1 is-full"
|
|
583
|
+
}, children);
|
|
307
584
|
};
|
|
308
|
-
var StackItemHeadingLabel = /* @__PURE__ */
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
ref: forwardedRef
|
|
317
|
-
});
|
|
318
|
-
} finally {
|
|
319
|
-
_effect.f();
|
|
320
|
-
}
|
|
585
|
+
var StackItemHeadingLabel = /* @__PURE__ */ forwardRef4(({ attendableId, related, classNames, ...props }, forwardedRef) => {
|
|
586
|
+
const { hasAttention, isAncestor, isRelated } = useAttention(attendableId);
|
|
587
|
+
return /* @__PURE__ */ React6.createElement("h1", {
|
|
588
|
+
...props,
|
|
589
|
+
"data-attention": (related && isRelated || hasAttention || isAncestor).toString(),
|
|
590
|
+
className: mx5("pli-1 min-is-0 is-0 grow truncate font-medium text-baseText data-[attention=true]:text-accentText self-center", classNames),
|
|
591
|
+
ref: forwardedRef
|
|
592
|
+
});
|
|
321
593
|
});
|
|
322
594
|
|
|
323
595
|
// src/components/StackItem/StackItemResizeHandle.tsx
|
|
324
|
-
import
|
|
325
|
-
import React5 from "react";
|
|
596
|
+
import React7 from "react";
|
|
326
597
|
import { ResizeHandle } from "@dxos/react-ui-dnd";
|
|
327
598
|
var MIN_WIDTH = 20;
|
|
328
599
|
var MIN_HEIGHT = 3;
|
|
329
600
|
var StackItemResizeHandle = () => {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
onSizeChange: setSize
|
|
340
|
-
});
|
|
341
|
-
} finally {
|
|
342
|
-
_effect.f();
|
|
343
|
-
}
|
|
601
|
+
const { orientation } = useStack();
|
|
602
|
+
const { setSize, size } = useStackItem();
|
|
603
|
+
return /* @__PURE__ */ React7.createElement(ResizeHandle, {
|
|
604
|
+
side: orientation === "horizontal" ? "inline-end" : "block-end",
|
|
605
|
+
fallbackSize: DEFAULT_EXTRINSIC_SIZE,
|
|
606
|
+
minSize: orientation === "horizontal" ? MIN_WIDTH : MIN_HEIGHT,
|
|
607
|
+
size,
|
|
608
|
+
onSizeChange: setSize
|
|
609
|
+
});
|
|
344
610
|
};
|
|
345
611
|
|
|
346
612
|
// src/components/StackItem/StackItemSigil.tsx
|
|
347
|
-
import {
|
|
348
|
-
import React7, { Fragment, forwardRef as forwardRef4, useState as useState3 } from "react";
|
|
613
|
+
import React9, { Fragment, forwardRef as forwardRef5, useState as useState3 } from "react";
|
|
349
614
|
import { keySymbols } from "@dxos/keyboard";
|
|
350
|
-
import { Button, DropdownMenu, Icon, toLocalizedString, useTranslation } from "@dxos/react-ui";
|
|
615
|
+
import { Button, DropdownMenu, Icon, toLocalizedString, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
351
616
|
import { useAttention as useAttention2 } from "@dxos/react-ui-attention";
|
|
352
|
-
import { descriptionText, mx as
|
|
617
|
+
import { descriptionText, mx as mx6 } from "@dxos/ui-theme";
|
|
353
618
|
import { getHostPlatform } from "@dxos/util";
|
|
354
619
|
|
|
355
620
|
// src/components/StackItem/MenuSignifier.tsx
|
|
356
|
-
import
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
strokeLinecap: "round",
|
|
375
|
-
strokeDasharray: "6 20",
|
|
376
|
-
strokeDashoffset: "-6.5"
|
|
377
|
-
}));
|
|
378
|
-
} finally {
|
|
379
|
-
_effect.f();
|
|
380
|
-
}
|
|
381
|
-
};
|
|
382
|
-
|
|
383
|
-
// src/translations.ts
|
|
384
|
-
var translationKey = "react-ui-stack";
|
|
385
|
-
var translations = [
|
|
386
|
-
{
|
|
387
|
-
"en-US": {
|
|
388
|
-
[translationKey]: {
|
|
389
|
-
"resize label": "Drag to resize",
|
|
390
|
-
"drag handle label": "Drag to rearrange",
|
|
391
|
-
"pin start label": "Pin to the left sidebar",
|
|
392
|
-
"pin end label": "Pin to the right sidebar",
|
|
393
|
-
"increment start label": "Move to the left",
|
|
394
|
-
"increment end label": "Move to the right",
|
|
395
|
-
"close label": "Close",
|
|
396
|
-
"minify label": "Minify"
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
];
|
|
621
|
+
import React8 from "react";
|
|
622
|
+
var MenuSignifierHorizontal = () => /* @__PURE__ */ React8.createElement("svg", {
|
|
623
|
+
className: "absolute block-end-[7px]",
|
|
624
|
+
width: 20,
|
|
625
|
+
height: 2,
|
|
626
|
+
viewBox: "0 0 20 2",
|
|
627
|
+
stroke: "currentColor",
|
|
628
|
+
opacity: 0.5
|
|
629
|
+
}, /* @__PURE__ */ React8.createElement("line", {
|
|
630
|
+
x1: 0.5,
|
|
631
|
+
y1: 0.75,
|
|
632
|
+
x2: 19,
|
|
633
|
+
y2: 0.75,
|
|
634
|
+
strokeWidth: 1.25,
|
|
635
|
+
strokeLinecap: "round",
|
|
636
|
+
strokeDasharray: "6 20",
|
|
637
|
+
strokeDashoffset: "-6.5"
|
|
638
|
+
}));
|
|
401
639
|
|
|
402
640
|
// src/components/StackItem/StackItemSigil.tsx
|
|
403
|
-
var StackItemSigilButton = /* @__PURE__ */
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
classNames
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
ref: forwardedRef
|
|
416
|
-
}, isMenu && /* @__PURE__ */ React7.createElement(MenuSignifierHorizontal, null), children);
|
|
417
|
-
} finally {
|
|
418
|
-
_effect.f();
|
|
419
|
-
}
|
|
641
|
+
var StackItemSigilButton = /* @__PURE__ */ forwardRef5(({ attendableId, classNames, related, isMenu = true, children, ...props }, forwardedRef) => {
|
|
642
|
+
const { hasAttention, isAncestor, isRelated } = useAttention2(attendableId);
|
|
643
|
+
const variant = related && isRelated || hasAttention || isAncestor ? "primary" : "ghost";
|
|
644
|
+
return /* @__PURE__ */ React9.createElement(Button, {
|
|
645
|
+
...props,
|
|
646
|
+
variant,
|
|
647
|
+
classNames: [
|
|
648
|
+
"shrink-0 pli-0 min-bs-0 is-[--rail-action] bs-[--rail-action] relative app-no-drag",
|
|
649
|
+
classNames
|
|
650
|
+
],
|
|
651
|
+
ref: forwardedRef
|
|
652
|
+
}, isMenu && /* @__PURE__ */ React9.createElement(MenuSignifierHorizontal, null), children);
|
|
420
653
|
});
|
|
421
|
-
var StackItemSigil = /* @__PURE__ */
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
if (action.properties.disabled) {
|
|
463
|
-
return;
|
|
464
|
-
}
|
|
465
|
-
event.stopPropagation();
|
|
466
|
-
setOptionsMenuOpen(false);
|
|
467
|
-
onAction?.(action);
|
|
468
|
-
},
|
|
469
|
-
classNames: "gap-2",
|
|
470
|
-
disabled: action.properties.disabled,
|
|
471
|
-
checked: menuItemType === "toggle" ? action.properties.isChecked : void 0,
|
|
472
|
-
...action.properties?.testId && {
|
|
473
|
-
"data-testid": action.properties.testId
|
|
654
|
+
var StackItemSigil = /* @__PURE__ */ forwardRef5(({ actions: actionGroups, onAction, triggerLabel, attendableId, icon, related, children }, forwardedRef) => {
|
|
655
|
+
const { t } = useTranslation2(translationKey);
|
|
656
|
+
const [optionsMenuOpen, setOptionsMenuOpen] = useState3(false);
|
|
657
|
+
const hasActions = actionGroups && actionGroups.length > 0;
|
|
658
|
+
const button = /* @__PURE__ */ React9.createElement(StackItemSigilButton, {
|
|
659
|
+
attendableId,
|
|
660
|
+
related,
|
|
661
|
+
isMenu: hasActions,
|
|
662
|
+
// TODO(wittjosiah): Better disabling of interactive styles when no action are available.
|
|
663
|
+
// Remove underscore icon when no actions are available?
|
|
664
|
+
classNames: !hasActions && "cursor-default"
|
|
665
|
+
}, /* @__PURE__ */ React9.createElement("span", {
|
|
666
|
+
className: "sr-only"
|
|
667
|
+
}, triggerLabel), /* @__PURE__ */ React9.createElement(Icon, {
|
|
668
|
+
icon,
|
|
669
|
+
size: 5
|
|
670
|
+
}));
|
|
671
|
+
if (!hasActions) {
|
|
672
|
+
return button;
|
|
673
|
+
}
|
|
674
|
+
return /* @__PURE__ */ React9.createElement(DropdownMenu.Root, {
|
|
675
|
+
open: optionsMenuOpen,
|
|
676
|
+
onOpenChange: setOptionsMenuOpen
|
|
677
|
+
}, /* @__PURE__ */ React9.createElement(DropdownMenu.Trigger, {
|
|
678
|
+
asChild: true,
|
|
679
|
+
ref: forwardedRef
|
|
680
|
+
}, button), /* @__PURE__ */ React9.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React9.createElement(DropdownMenu.Content, {
|
|
681
|
+
classNames: "z-[31]"
|
|
682
|
+
}, /* @__PURE__ */ React9.createElement(DropdownMenu.Viewport, null, actionGroups?.map((actions, index) => {
|
|
683
|
+
const separator = index > 0 ? /* @__PURE__ */ React9.createElement(DropdownMenu.Separator, null) : null;
|
|
684
|
+
return /* @__PURE__ */ React9.createElement(Fragment, {
|
|
685
|
+
key: index
|
|
686
|
+
}, separator, actions.map((action) => {
|
|
687
|
+
const shortcut = typeof action.properties.keyBinding === "string" ? action.properties.keyBinding : action.properties.keyBinding?.[getHostPlatform()];
|
|
688
|
+
const menuItemType = action.properties.menuItemType;
|
|
689
|
+
const Root = menuItemType === "toggle" ? DropdownMenu.CheckboxItem : DropdownMenu.Item;
|
|
690
|
+
return /* @__PURE__ */ React9.createElement(Root, {
|
|
691
|
+
key: action.id,
|
|
692
|
+
onClick: (event) => {
|
|
693
|
+
if (action.properties.disabled) {
|
|
694
|
+
return;
|
|
474
695
|
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
})
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
696
|
+
event.stopPropagation();
|
|
697
|
+
setOptionsMenuOpen(false);
|
|
698
|
+
onAction?.(action);
|
|
699
|
+
},
|
|
700
|
+
classNames: "gap-2",
|
|
701
|
+
disabled: action.properties.disabled,
|
|
702
|
+
checked: menuItemType === "toggle" ? action.properties.isChecked : void 0,
|
|
703
|
+
...action.properties?.testId && {
|
|
704
|
+
"data-testid": action.properties.testId
|
|
705
|
+
}
|
|
706
|
+
}, /* @__PURE__ */ React9.createElement(Icon, {
|
|
707
|
+
icon: action.properties.icon ?? "ph--placeholder--regular",
|
|
708
|
+
size: 4
|
|
709
|
+
}), /* @__PURE__ */ React9.createElement("span", {
|
|
710
|
+
className: "grow truncate"
|
|
711
|
+
}, toLocalizedString(action.properties.label ?? "", t)), menuItemType === "toggle" && /* @__PURE__ */ React9.createElement(DropdownMenu.ItemIndicator, {
|
|
712
|
+
asChild: true
|
|
713
|
+
}, /* @__PURE__ */ React9.createElement(Icon, {
|
|
714
|
+
icon: "ph--check--regular",
|
|
715
|
+
size: 4
|
|
716
|
+
})), shortcut && /* @__PURE__ */ React9.createElement("span", {
|
|
717
|
+
className: mx6("shrink-0", descriptionText)
|
|
718
|
+
}, keySymbols(shortcut).join("")));
|
|
719
|
+
}));
|
|
720
|
+
}), children), /* @__PURE__ */ React9.createElement(DropdownMenu.Arrow, null))));
|
|
493
721
|
});
|
|
494
722
|
|
|
495
723
|
// src/components/StackItem/StackItem.tsx
|
|
496
724
|
var DEFAULT_HORIZONTAL_SIZE = 48;
|
|
497
725
|
var DEFAULT_VERTICAL_SIZE = "min-content";
|
|
498
726
|
var DEFAULT_EXTRINSIC_SIZE = DEFAULT_HORIZONTAL_SIZE;
|
|
499
|
-
var StackItemRoot = /* @__PURE__ */
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
727
|
+
var StackItemRoot = /* @__PURE__ */ forwardRef6(({ item, children, classNames, size: propsSize, onSizeChange, role, order, prevSiblingId, nextSiblingId, style, disableRearrange, focusIndicatorVariant = "over-all", ...props }, forwardedRef) => {
|
|
728
|
+
const [itemElement, itemRef] = useState4(null);
|
|
729
|
+
const composedItemRef = composeRefs2(itemRef, forwardedRef);
|
|
730
|
+
const [selfDragHandleElement, selfDragHandleRef] = useState4(null);
|
|
731
|
+
const [closestEdge, setEdge] = useState4(null);
|
|
732
|
+
const [sourceId, setSourceId] = useState4(null);
|
|
733
|
+
const [dragState, setDragState] = useState4(idle);
|
|
734
|
+
const { orientation, rail, onRearrange, size: stackSize, stackId } = useStack();
|
|
735
|
+
const [size = orientation === "horizontal" ? DEFAULT_HORIZONTAL_SIZE : DEFAULT_VERTICAL_SIZE, setInternalSize] = useState4(propsSize);
|
|
736
|
+
const Root = role ?? "div";
|
|
737
|
+
const setSize = useCallback2((nextSize, commit) => {
|
|
738
|
+
setInternalSize(nextSize);
|
|
739
|
+
if (commit) {
|
|
740
|
+
onSizeChange?.(nextSize);
|
|
741
|
+
}
|
|
742
|
+
}, [
|
|
743
|
+
onSizeChange
|
|
744
|
+
]);
|
|
745
|
+
const type = orientation === "horizontal" ? "column" : "card";
|
|
746
|
+
useLayoutEffect2(() => {
|
|
747
|
+
if (!itemElement || !onRearrange || disableRearrange) {
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
return combine2(draggable({
|
|
751
|
+
element: itemElement,
|
|
752
|
+
...selfDragHandleElement && {
|
|
753
|
+
dragHandle: selfDragHandleElement
|
|
754
|
+
},
|
|
755
|
+
getInitialData: () => ({
|
|
756
|
+
id: item.id,
|
|
757
|
+
type
|
|
758
|
+
}),
|
|
759
|
+
onGenerateDragPreview: ({ nativeSetDragImage, source, location }) => {
|
|
760
|
+
document.body.setAttribute("data-drag-preview", "true");
|
|
761
|
+
const offsetFn = preserveOffsetOnSource({
|
|
762
|
+
element: source.element,
|
|
763
|
+
input: location.current.input
|
|
764
|
+
});
|
|
765
|
+
const rect = source.element.getBoundingClientRect();
|
|
766
|
+
setCustomNativeDragPreview({
|
|
767
|
+
nativeSetDragImage,
|
|
768
|
+
getOffset: ({ container }) => {
|
|
769
|
+
return offsetFn({
|
|
770
|
+
container
|
|
771
|
+
});
|
|
772
|
+
},
|
|
773
|
+
render: ({ container }) => {
|
|
774
|
+
container.style.width = rect.width + "px";
|
|
775
|
+
setDragState({
|
|
776
|
+
type: "preview",
|
|
777
|
+
container,
|
|
778
|
+
item
|
|
779
|
+
});
|
|
780
|
+
return () => {
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
});
|
|
784
|
+
},
|
|
785
|
+
onDragStart: () => {
|
|
786
|
+
document.body.removeAttribute("data-drag-preview");
|
|
787
|
+
itemElement?.closest("[data-drag-autoscroll]")?.setAttribute("data-drag-autoscroll", "active");
|
|
788
|
+
setDragState({
|
|
789
|
+
type: "is-dragging",
|
|
790
|
+
item
|
|
791
|
+
});
|
|
792
|
+
},
|
|
793
|
+
onDrop: () => {
|
|
794
|
+
itemElement?.closest("[data-drag-autoscroll]")?.setAttribute("data-drag-autoscroll", "idle");
|
|
795
|
+
setDragState(idle);
|
|
523
796
|
}
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
},
|
|
529
|
-
getInitialData: () => ({
|
|
797
|
+
}), dropTargetForElements2({
|
|
798
|
+
element: itemElement,
|
|
799
|
+
getData: ({ input, element }) => {
|
|
800
|
+
return attachClosestEdge2({
|
|
530
801
|
id: item.id,
|
|
531
802
|
type
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
container.style.width = rect.width + "px";
|
|
549
|
-
setDragState({
|
|
550
|
-
type: "preview",
|
|
551
|
-
container,
|
|
552
|
-
item
|
|
553
|
-
});
|
|
554
|
-
return () => {
|
|
555
|
-
};
|
|
556
|
-
}
|
|
557
|
-
});
|
|
558
|
-
},
|
|
559
|
-
onDragStart: () => {
|
|
560
|
-
document.body.removeAttribute("data-drag-preview");
|
|
561
|
-
itemElement?.closest("[data-drag-autoscroll]")?.setAttribute("data-drag-autoscroll", "active");
|
|
562
|
-
setDragState({
|
|
563
|
-
type: "is-dragging",
|
|
564
|
-
item
|
|
565
|
-
});
|
|
566
|
-
},
|
|
567
|
-
onDrop: () => {
|
|
568
|
-
itemElement?.closest("[data-drag-autoscroll]")?.setAttribute("data-drag-autoscroll", "idle");
|
|
569
|
-
setDragState(idle);
|
|
803
|
+
}, {
|
|
804
|
+
input,
|
|
805
|
+
element,
|
|
806
|
+
allowedEdges: orientation === "horizontal" ? [
|
|
807
|
+
"left",
|
|
808
|
+
"right"
|
|
809
|
+
] : [
|
|
810
|
+
"top",
|
|
811
|
+
"bottom"
|
|
812
|
+
]
|
|
813
|
+
});
|
|
814
|
+
},
|
|
815
|
+
onDragEnter: ({ self, source }) => {
|
|
816
|
+
if (source.data.type === self.data.type) {
|
|
817
|
+
setEdge(extractClosestEdge2(self.data));
|
|
818
|
+
setSourceId(source.data.id);
|
|
570
819
|
}
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
});
|
|
588
|
-
},
|
|
589
|
-
onDragEnter: ({ self, source }) => {
|
|
590
|
-
if (source.data.type === self.data.type) {
|
|
591
|
-
setEdge(extractClosestEdge2(self.data));
|
|
592
|
-
setSourceId(source.data.id);
|
|
593
|
-
}
|
|
594
|
-
},
|
|
595
|
-
onDrag: ({ self, source }) => {
|
|
596
|
-
if (source.data.type === self.data.type) {
|
|
597
|
-
setEdge(extractClosestEdge2(self.data));
|
|
598
|
-
setSourceId(source.data.id);
|
|
599
|
-
}
|
|
600
|
-
},
|
|
601
|
-
onDragLeave: () => {
|
|
602
|
-
setEdge(null);
|
|
603
|
-
setSourceId(null);
|
|
604
|
-
},
|
|
605
|
-
onDrop: ({ self, source }) => {
|
|
606
|
-
setEdge(null);
|
|
607
|
-
setSourceId(null);
|
|
608
|
-
if (source.data.type === self.data.type) {
|
|
609
|
-
onRearrange(source.data, self.data, extractClosestEdge2(self.data));
|
|
610
|
-
}
|
|
820
|
+
},
|
|
821
|
+
onDrag: ({ self, source }) => {
|
|
822
|
+
if (source.data.type === self.data.type) {
|
|
823
|
+
setEdge(extractClosestEdge2(self.data));
|
|
824
|
+
setSourceId(source.data.id);
|
|
825
|
+
}
|
|
826
|
+
},
|
|
827
|
+
onDragLeave: () => {
|
|
828
|
+
setEdge(null);
|
|
829
|
+
setSourceId(null);
|
|
830
|
+
},
|
|
831
|
+
onDrop: ({ self, source }) => {
|
|
832
|
+
setEdge(null);
|
|
833
|
+
setSourceId(null);
|
|
834
|
+
if (source.data.type === self.data.type) {
|
|
835
|
+
onRearrange(source.data, self.data, extractClosestEdge2(self.data));
|
|
611
836
|
}
|
|
612
|
-
}));
|
|
613
|
-
}, [
|
|
614
|
-
orientation,
|
|
615
|
-
item,
|
|
616
|
-
onRearrange,
|
|
617
|
-
selfDragHandleElement,
|
|
618
|
-
itemElement
|
|
619
|
-
]);
|
|
620
|
-
const focusableGroupAttrs = useFocusableGroup2({
|
|
621
|
-
tabBehavior: "limited"
|
|
622
|
-
});
|
|
623
|
-
const shouldShowDropIndicator = () => {
|
|
624
|
-
if (!closestEdge || !sourceId) {
|
|
625
|
-
return false;
|
|
626
|
-
}
|
|
627
|
-
if (sourceId === item.id) {
|
|
628
|
-
return false;
|
|
629
|
-
}
|
|
630
|
-
const isTrailingEdgeOfPrevSibling = prevSiblingId !== void 0 && sourceId === prevSiblingId && (orientation === "horizontal" && closestEdge === "left" || orientation === "vertical" && closestEdge === "top");
|
|
631
|
-
if (isTrailingEdgeOfPrevSibling) {
|
|
632
|
-
return false;
|
|
633
|
-
}
|
|
634
|
-
const isLeadingEdgeOfNextSibling = nextSiblingId !== void 0 && sourceId === nextSiblingId && (orientation === "horizontal" && closestEdge === "right" || orientation === "vertical" && closestEdge === "bottom");
|
|
635
|
-
if (isLeadingEdgeOfNextSibling) {
|
|
636
|
-
return false;
|
|
637
837
|
}
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
838
|
+
}));
|
|
839
|
+
}, [
|
|
840
|
+
orientation,
|
|
841
|
+
item,
|
|
842
|
+
onRearrange,
|
|
843
|
+
selfDragHandleElement,
|
|
844
|
+
itemElement
|
|
845
|
+
]);
|
|
846
|
+
const focusableGroupAttrs = useFocusableGroup({
|
|
847
|
+
tabBehavior: "limited"
|
|
848
|
+
});
|
|
849
|
+
const shouldShowDropIndicator = () => {
|
|
850
|
+
if (!closestEdge || !sourceId) {
|
|
851
|
+
return false;
|
|
852
|
+
}
|
|
853
|
+
if (sourceId === item.id) {
|
|
854
|
+
return false;
|
|
855
|
+
}
|
|
856
|
+
const isTrailingEdgeOfPrevSibling = prevSiblingId !== void 0 && sourceId === prevSiblingId && (orientation === "horizontal" && closestEdge === "left" || orientation === "vertical" && closestEdge === "top");
|
|
857
|
+
if (isTrailingEdgeOfPrevSibling) {
|
|
858
|
+
return false;
|
|
859
|
+
}
|
|
860
|
+
const isLeadingEdgeOfNextSibling = nextSiblingId !== void 0 && sourceId === nextSiblingId && (orientation === "horizontal" && closestEdge === "right" || orientation === "vertical" && closestEdge === "bottom");
|
|
861
|
+
if (isLeadingEdgeOfNextSibling) {
|
|
862
|
+
return false;
|
|
863
|
+
}
|
|
864
|
+
return true;
|
|
865
|
+
};
|
|
866
|
+
const stackItemContextValue = useMemo3(() => ({
|
|
867
|
+
selfDragHandleRef,
|
|
868
|
+
size,
|
|
869
|
+
setSize,
|
|
870
|
+
state: dragState,
|
|
871
|
+
setState: setDragState,
|
|
872
|
+
role
|
|
873
|
+
}), [
|
|
874
|
+
selfDragHandleRef,
|
|
875
|
+
size,
|
|
876
|
+
setSize,
|
|
877
|
+
dragState,
|
|
878
|
+
setDragState,
|
|
879
|
+
role
|
|
880
|
+
]);
|
|
881
|
+
return /* @__PURE__ */ React10.createElement(StackItemContext.Provider, {
|
|
882
|
+
value: stackItemContextValue
|
|
883
|
+
}, /* @__PURE__ */ React10.createElement(Root, {
|
|
884
|
+
...props,
|
|
885
|
+
tabIndex: 0,
|
|
886
|
+
...focusableGroupAttrs,
|
|
887
|
+
className: mx7("group/stack-item grid relative", focusIndicatorVariant === "over-all" ? "dx-focus-ring-inset-over-all" : focusIndicatorVariant === "over-all-always" ? "dx-focus-ring-inset-over-all-always" : orientation === "horizontal" ? focusIndicatorVariant === "group-always" ? "dx-focus-ring-group-x-always" : "dx-focus-ring-group-x" : focusIndicatorVariant === "group-always" ? "dx-focus-ring-group-y-always" : "dx-focus-ring-group-y", orientation === "horizontal" ? "grid-rows-subgrid" : "grid-cols-subgrid", rail && (orientation === "horizontal" ? "row-span-2" : "col-span-2"), role === "section" && orientation !== "horizontal" && "border-be border-subduedSeparator", classNames),
|
|
888
|
+
"data-dx-stack-item": stackId,
|
|
889
|
+
"data-dx-item-id": item.id,
|
|
890
|
+
...resizeAttributes,
|
|
891
|
+
style: {
|
|
892
|
+
...stackSize !== "split" && sizeStyle(size, orientation),
|
|
893
|
+
...Number.isFinite(order) && {
|
|
894
|
+
[orientation === "horizontal" ? "gridColumn" : "gridRow"]: `${order}`
|
|
670
895
|
},
|
|
671
|
-
|
|
672
|
-
},
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
}
|
|
896
|
+
...style
|
|
897
|
+
},
|
|
898
|
+
ref: composedItemRef
|
|
899
|
+
}, children, shouldShowDropIndicator() && closestEdge && /* @__PURE__ */ React10.createElement(ListItem2.DropIndicator, {
|
|
900
|
+
lineInset: 8,
|
|
901
|
+
terminalInset: -8,
|
|
902
|
+
edge: closestEdge
|
|
903
|
+
})));
|
|
680
904
|
});
|
|
681
905
|
var StackItemDragPreview = ({ children }) => {
|
|
682
906
|
const { state } = useStackItem();
|
|
@@ -687,477 +911,16 @@ var StackItemDragPreview = ({ children }) => {
|
|
|
687
911
|
var StackItem = {
|
|
688
912
|
Root: StackItemRoot,
|
|
689
913
|
Content: StackItemContent,
|
|
914
|
+
DragHandle: StackItemDragHandle,
|
|
915
|
+
DragPreview: StackItemDragPreview,
|
|
690
916
|
Heading: StackItemHeading,
|
|
691
917
|
HeadingLabel: StackItemHeadingLabel,
|
|
692
918
|
HeadingStickyContent: StackItemHeadingStickyContent,
|
|
693
919
|
ResizeHandle: StackItemResizeHandle,
|
|
694
|
-
DragHandle: StackItemDragHandle,
|
|
695
920
|
Sigil: StackItemSigil,
|
|
696
|
-
SigilButton: StackItemSigilButton
|
|
697
|
-
DragPreview: StackItemDragPreview
|
|
698
|
-
};
|
|
699
|
-
|
|
700
|
-
// src/exemplars/Card/Card.tsx
|
|
701
|
-
import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking";
|
|
702
|
-
import { Primitive } from "@radix-ui/react-primitive";
|
|
703
|
-
import { Slot as Slot3 } from "@radix-ui/react-slot";
|
|
704
|
-
import React9, { forwardRef as forwardRef6 } from "react";
|
|
705
|
-
import { Icon as Icon2, IconButton, Toolbar, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
706
|
-
import { hoverableControls, mx as mx6 } from "@dxos/react-ui-theme";
|
|
707
|
-
|
|
708
|
-
// src/exemplars/Card/fragments.ts
|
|
709
|
-
var cardRoot = "rounded overflow-hidden bg-cardSurface border border-separator dark:border-subduedSeparator dx-focus-ring-group-y-indicator relative min-bs-[--rail-item] group/card";
|
|
710
|
-
var cardSpacing = "pli-cardSpacingInline mlb-cardSpacingBlock";
|
|
711
|
-
var labelSpacing = "mbs-inputSpacingBlock mbe-labelSpacingBlock";
|
|
712
|
-
var cardDialogContent = "p-0 bs-content min-bs-[8rem] max-bs-full md:max-is-[32rem] overflow-hidden";
|
|
713
|
-
var cardDialogHeader = "pli-cardSpacingInline mbs-cardSpacingBlock flex justify-between";
|
|
714
|
-
var cardDialogOverflow = "overflow-y-auto min-bs-0 flex-1";
|
|
715
|
-
var cardDialogPaddedOverflow = `${cardDialogOverflow} plb-cardSpacingBlock`;
|
|
716
|
-
var cardDialogSearchListRoot = "pli-cardSpacingInline pbs-cardSpacingBlock [&>input]:mbe-0 min-bs-0 flex-1 flex flex-col";
|
|
717
|
-
var cardText = cardSpacing;
|
|
718
|
-
var cardHeading = "text-lg font-medium line-clamp-2";
|
|
719
|
-
var cardChrome = "pli-[--dx-cardSpacingChrome] mlb-[--dx-cardSpacingChrome] [&_.dx-button]:text-start [&_.dx-button]:is-full";
|
|
720
|
-
|
|
721
|
-
// src/exemplars/Card/Card.tsx
|
|
722
|
-
var CardStaticRoot = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "group", ...props }, forwardedRef) => {
|
|
723
|
-
var _effect = _useSignals9();
|
|
724
|
-
try {
|
|
725
|
-
const Root = asChild ? Slot3 : "div";
|
|
726
|
-
const rootProps = asChild ? {
|
|
727
|
-
classNames: [
|
|
728
|
-
cardRoot,
|
|
729
|
-
classNames
|
|
730
|
-
]
|
|
731
|
-
} : {
|
|
732
|
-
className: mx6(cardRoot, classNames),
|
|
733
|
-
role
|
|
734
|
-
};
|
|
735
|
-
return /* @__PURE__ */ React9.createElement(Root, {
|
|
736
|
-
...props,
|
|
737
|
-
...rootProps,
|
|
738
|
-
ref: forwardedRef
|
|
739
|
-
}, children);
|
|
740
|
-
} finally {
|
|
741
|
-
_effect.f();
|
|
742
|
-
}
|
|
743
|
-
});
|
|
744
|
-
var CardSurfaceRoot = ({ role = "never", children }) => {
|
|
745
|
-
var _effect = _useSignals9();
|
|
746
|
-
try {
|
|
747
|
-
if ([
|
|
748
|
-
"popover",
|
|
749
|
-
"card--kanban"
|
|
750
|
-
].includes(role)) {
|
|
751
|
-
return /* @__PURE__ */ React9.createElement("div", {
|
|
752
|
-
className: role === "popover" ? "popover-card-width" : role === "card--kanban" ? "contents" : ""
|
|
753
|
-
}, children);
|
|
754
|
-
} else {
|
|
755
|
-
return /* @__PURE__ */ React9.createElement(CardStaticRoot, role === "card--document" && {
|
|
756
|
-
classNames: [
|
|
757
|
-
"mlb-[1em]",
|
|
758
|
-
hoverableControls
|
|
759
|
-
]
|
|
760
|
-
}, children);
|
|
761
|
-
}
|
|
762
|
-
} finally {
|
|
763
|
-
_effect.f();
|
|
764
|
-
}
|
|
765
|
-
};
|
|
766
|
-
var CardHeading = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "heading", ...props }, forwardedRef) => {
|
|
767
|
-
var _effect = _useSignals9();
|
|
768
|
-
try {
|
|
769
|
-
const Root = asChild ? Slot3 : "div";
|
|
770
|
-
const rootProps = asChild ? {
|
|
771
|
-
classNames: [
|
|
772
|
-
cardHeading,
|
|
773
|
-
cardText,
|
|
774
|
-
classNames
|
|
775
|
-
]
|
|
776
|
-
} : {
|
|
777
|
-
className: mx6(cardHeading, cardText, classNames),
|
|
778
|
-
role
|
|
779
|
-
};
|
|
780
|
-
return /* @__PURE__ */ React9.createElement(Root, {
|
|
781
|
-
...props,
|
|
782
|
-
...rootProps,
|
|
783
|
-
ref: forwardedRef
|
|
784
|
-
}, children);
|
|
785
|
-
} finally {
|
|
786
|
-
_effect.f();
|
|
787
|
-
}
|
|
788
|
-
});
|
|
789
|
-
var CardToolbar = /* @__PURE__ */ forwardRef6(({ children, classNames, ...props }, forwardedRef) => {
|
|
790
|
-
var _effect = _useSignals9();
|
|
791
|
-
try {
|
|
792
|
-
return /* @__PURE__ */ React9.createElement(Toolbar.Root, {
|
|
793
|
-
...props,
|
|
794
|
-
classNames: [
|
|
795
|
-
"bg-transparent density-coarse",
|
|
796
|
-
classNames
|
|
797
|
-
],
|
|
798
|
-
ref: forwardedRef
|
|
799
|
-
}, children);
|
|
800
|
-
} finally {
|
|
801
|
-
_effect.f();
|
|
802
|
-
}
|
|
803
|
-
});
|
|
804
|
-
var CardToolbarIconButton = Toolbar.IconButton;
|
|
805
|
-
var CardToolbarSeparator = Toolbar.Separator;
|
|
806
|
-
var CardDragHandle = /* @__PURE__ */ forwardRef6(({ toolbarItem }, forwardedRef) => {
|
|
807
|
-
var _effect = _useSignals9();
|
|
808
|
-
try {
|
|
809
|
-
const { t } = useTranslation2(translationKey);
|
|
810
|
-
const Root = toolbarItem ? Toolbar.IconButton : IconButton;
|
|
811
|
-
return /* @__PURE__ */ React9.createElement(Root, {
|
|
812
|
-
iconOnly: true,
|
|
813
|
-
icon: "ph--dots-six-vertical--regular",
|
|
814
|
-
variant: "ghost",
|
|
815
|
-
label: t("drag handle label"),
|
|
816
|
-
classNames: "pli-2",
|
|
817
|
-
ref: forwardedRef
|
|
818
|
-
});
|
|
819
|
-
} finally {
|
|
820
|
-
_effect.f();
|
|
821
|
-
}
|
|
822
|
-
});
|
|
823
|
-
var CardDragPreview = StackItem.DragPreview;
|
|
824
|
-
var CardMenu = Primitive.div;
|
|
825
|
-
var CardPoster = (props) => {
|
|
826
|
-
var _effect = _useSignals9();
|
|
827
|
-
try {
|
|
828
|
-
const aspect = props.aspect === "auto" ? "aspect-auto" : "aspect-video";
|
|
829
|
-
if (props.image) {
|
|
830
|
-
return /* @__PURE__ */ React9.createElement("img", {
|
|
831
|
-
className: `dx-card__poster ${aspect} object-cover is-full bs-auto`,
|
|
832
|
-
src: props.image,
|
|
833
|
-
alt: props.alt
|
|
834
|
-
});
|
|
835
|
-
}
|
|
836
|
-
if (props.icon) {
|
|
837
|
-
return /* @__PURE__ */ React9.createElement("div", {
|
|
838
|
-
role: "image",
|
|
839
|
-
className: `dx-card__poster grid ${aspect} place-items-center bg-inputSurface text-subdued`,
|
|
840
|
-
"aria-label": props.alt
|
|
841
|
-
}, /* @__PURE__ */ React9.createElement(Icon2, {
|
|
842
|
-
icon: props.icon,
|
|
843
|
-
size: 10
|
|
844
|
-
}));
|
|
845
|
-
}
|
|
846
|
-
} finally {
|
|
847
|
-
_effect.f();
|
|
848
|
-
}
|
|
849
|
-
};
|
|
850
|
-
var CardChrome = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
851
|
-
var _effect = _useSignals9();
|
|
852
|
-
try {
|
|
853
|
-
const Root = asChild ? Slot3 : "div";
|
|
854
|
-
const rootProps = asChild ? {
|
|
855
|
-
classNames: [
|
|
856
|
-
cardChrome,
|
|
857
|
-
classNames
|
|
858
|
-
]
|
|
859
|
-
} : {
|
|
860
|
-
className: mx6(cardChrome, classNames),
|
|
861
|
-
role
|
|
862
|
-
};
|
|
863
|
-
return /* @__PURE__ */ React9.createElement(Root, {
|
|
864
|
-
...props,
|
|
865
|
-
...rootProps,
|
|
866
|
-
ref: forwardedRef
|
|
867
|
-
}, children);
|
|
868
|
-
} finally {
|
|
869
|
-
_effect.f();
|
|
870
|
-
}
|
|
871
|
-
});
|
|
872
|
-
var CardText = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
873
|
-
var _effect = _useSignals9();
|
|
874
|
-
try {
|
|
875
|
-
const Root = asChild ? Slot3 : "p";
|
|
876
|
-
const rootProps = asChild ? {
|
|
877
|
-
classNames: [
|
|
878
|
-
cardText,
|
|
879
|
-
classNames
|
|
880
|
-
]
|
|
881
|
-
} : {
|
|
882
|
-
className: mx6(cardText, classNames),
|
|
883
|
-
role
|
|
884
|
-
};
|
|
885
|
-
return /* @__PURE__ */ React9.createElement(Root, {
|
|
886
|
-
...props,
|
|
887
|
-
...rootProps,
|
|
888
|
-
ref: forwardedRef
|
|
889
|
-
}, children);
|
|
890
|
-
} finally {
|
|
891
|
-
_effect.f();
|
|
892
|
-
}
|
|
893
|
-
});
|
|
894
|
-
var Card = {
|
|
895
|
-
StaticRoot: CardStaticRoot,
|
|
896
|
-
SurfaceRoot: CardSurfaceRoot,
|
|
897
|
-
Heading: CardHeading,
|
|
898
|
-
Toolbar: CardToolbar,
|
|
899
|
-
ToolbarIconButton: CardToolbarIconButton,
|
|
900
|
-
ToolbarSeparator: CardToolbarSeparator,
|
|
901
|
-
DragHandle: CardDragHandle,
|
|
902
|
-
DragPreview: CardDragPreview,
|
|
903
|
-
Menu: CardMenu,
|
|
904
|
-
Poster: CardPoster,
|
|
905
|
-
Chrome: CardChrome,
|
|
906
|
-
Text: CardText
|
|
907
|
-
};
|
|
908
|
-
|
|
909
|
-
// src/exemplars/Card/CardDragPreview.tsx
|
|
910
|
-
import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
|
|
911
|
-
import React10 from "react";
|
|
912
|
-
import { mx as mx7 } from "@dxos/react-ui-theme";
|
|
913
|
-
var CardDragPreviewRoot = ({ children }) => {
|
|
914
|
-
var _effect = _useSignals10();
|
|
915
|
-
try {
|
|
916
|
-
return /* @__PURE__ */ React10.createElement("div", {
|
|
917
|
-
className: "p-2"
|
|
918
|
-
}, children);
|
|
919
|
-
} finally {
|
|
920
|
-
_effect.f();
|
|
921
|
-
}
|
|
922
|
-
};
|
|
923
|
-
var CardDragPreviewContent = ({ children }) => {
|
|
924
|
-
var _effect = _useSignals10();
|
|
925
|
-
try {
|
|
926
|
-
return /* @__PURE__ */ React10.createElement("div", {
|
|
927
|
-
className: mx7(cardRoot, "ring-focusLine ring-neutralFocusIndicator")
|
|
928
|
-
}, children);
|
|
929
|
-
} finally {
|
|
930
|
-
_effect.f();
|
|
931
|
-
}
|
|
932
|
-
};
|
|
933
|
-
var CardDragPreview2 = {
|
|
934
|
-
Root: CardDragPreviewRoot,
|
|
935
|
-
Content: CardDragPreviewContent
|
|
936
|
-
};
|
|
937
|
-
|
|
938
|
-
// src/exemplars/CardStack/CardStack.tsx
|
|
939
|
-
import { useSignals as _useSignals11 } from "@preact-signals/safe-react/tracking";
|
|
940
|
-
import { Slot as Slot4 } from "@radix-ui/react-slot";
|
|
941
|
-
import React11, { forwardRef as forwardRef7 } from "react";
|
|
942
|
-
import { mx as mx8 } from "@dxos/react-ui-theme";
|
|
943
|
-
var CardStackStack = /* @__PURE__ */ forwardRef7(({ children, classNames, itemsCount = 0, ...props }, forwardedRef) => {
|
|
944
|
-
var _effect = _useSignals11();
|
|
945
|
-
try {
|
|
946
|
-
return /* @__PURE__ */ React11.createElement(Stack, {
|
|
947
|
-
orientation: "vertical",
|
|
948
|
-
size: "contain",
|
|
949
|
-
rail: false,
|
|
950
|
-
classNames: (
|
|
951
|
-
/* NOTE(thure): Do not let this element have zero intrinsic size, otherwise the drop indicator will not display. See #9035. */
|
|
952
|
-
[
|
|
953
|
-
"plb-1",
|
|
954
|
-
itemsCount > 0 && "plb-2",
|
|
955
|
-
classNames
|
|
956
|
-
]
|
|
957
|
-
),
|
|
958
|
-
itemsCount,
|
|
959
|
-
separatorOnScroll: 9,
|
|
960
|
-
"data-density": "fine",
|
|
961
|
-
...props,
|
|
962
|
-
ref: forwardedRef
|
|
963
|
-
}, children);
|
|
964
|
-
} finally {
|
|
965
|
-
_effect.f();
|
|
966
|
-
}
|
|
967
|
-
});
|
|
968
|
-
var CardStackDragHandle = Card.DragHandle;
|
|
969
|
-
var cardStackHeading = "mli-2 order-first bg-transparent rounded-bs-md flex items-center";
|
|
970
|
-
var CardStackHeading = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "heading", ...props }, forwardedRef) => {
|
|
971
|
-
var _effect = _useSignals11();
|
|
972
|
-
try {
|
|
973
|
-
const Root = asChild ? Slot4 : "div";
|
|
974
|
-
const rootProps = asChild ? {
|
|
975
|
-
classNames: [
|
|
976
|
-
cardStackHeading,
|
|
977
|
-
classNames
|
|
978
|
-
]
|
|
979
|
-
} : {
|
|
980
|
-
className: mx8(cardStackHeading, classNames),
|
|
981
|
-
role
|
|
982
|
-
};
|
|
983
|
-
return /* @__PURE__ */ React11.createElement(Root, {
|
|
984
|
-
...props,
|
|
985
|
-
...rootProps,
|
|
986
|
-
ref: forwardedRef
|
|
987
|
-
}, children);
|
|
988
|
-
} finally {
|
|
989
|
-
_effect.f();
|
|
990
|
-
}
|
|
991
|
-
});
|
|
992
|
-
var cardStackFooter = 'plb-2 mli-2 border-bs border-transparent [[data-scroll-separator-end="true"]_&]:border-subduedSeparator';
|
|
993
|
-
var CardStackFooter = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
994
|
-
var _effect = _useSignals11();
|
|
995
|
-
try {
|
|
996
|
-
const Root = asChild ? Slot4 : "div";
|
|
997
|
-
const rootProps = asChild ? {
|
|
998
|
-
classNames: [
|
|
999
|
-
cardStackFooter,
|
|
1000
|
-
classNames
|
|
1001
|
-
]
|
|
1002
|
-
} : {
|
|
1003
|
-
className: mx8(cardStackFooter, classNames),
|
|
1004
|
-
role
|
|
1005
|
-
};
|
|
1006
|
-
return /* @__PURE__ */ React11.createElement(Root, {
|
|
1007
|
-
...props,
|
|
1008
|
-
...rootProps,
|
|
1009
|
-
ref: forwardedRef
|
|
1010
|
-
}, children);
|
|
1011
|
-
} finally {
|
|
1012
|
-
_effect.f();
|
|
1013
|
-
}
|
|
1014
|
-
});
|
|
1015
|
-
var cardStackContent = [
|
|
1016
|
-
"shrink min-bs-0 bg-baseSurface border border-separator rounded-md grid dx-focus-ring-group-x-indicator kanban-drop",
|
|
1017
|
-
railGridHorizontalContainFitContent
|
|
1018
|
-
];
|
|
1019
|
-
var CardStackContent = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
1020
|
-
var _effect = _useSignals11();
|
|
1021
|
-
try {
|
|
1022
|
-
const Root = asChild ? Slot4 : "div";
|
|
1023
|
-
const rootProps = asChild ? {
|
|
1024
|
-
classNames: [
|
|
1025
|
-
...cardStackContent,
|
|
1026
|
-
classNames
|
|
1027
|
-
]
|
|
1028
|
-
} : {
|
|
1029
|
-
className: mx8(...cardStackContent, classNames),
|
|
1030
|
-
role
|
|
1031
|
-
};
|
|
1032
|
-
return /* @__PURE__ */ React11.createElement(Root, {
|
|
1033
|
-
...props,
|
|
1034
|
-
...rootProps,
|
|
1035
|
-
"data-scroll-separator": "false",
|
|
1036
|
-
ref: forwardedRef
|
|
1037
|
-
}, children);
|
|
1038
|
-
} finally {
|
|
1039
|
-
_effect.f();
|
|
1040
|
-
}
|
|
1041
|
-
});
|
|
1042
|
-
var cardStackRoot = "flex flex-col pli-2 plb-2";
|
|
1043
|
-
var CardStackRoot = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
1044
|
-
var _effect = _useSignals11();
|
|
1045
|
-
try {
|
|
1046
|
-
const Root = asChild ? Slot4 : "div";
|
|
1047
|
-
const rootProps = asChild ? {
|
|
1048
|
-
classNames: [
|
|
1049
|
-
cardStackRoot,
|
|
1050
|
-
classNames
|
|
1051
|
-
]
|
|
1052
|
-
} : {
|
|
1053
|
-
className: mx8(cardStackRoot, classNames),
|
|
1054
|
-
role
|
|
1055
|
-
};
|
|
1056
|
-
return /* @__PURE__ */ React11.createElement(Root, {
|
|
1057
|
-
...props,
|
|
1058
|
-
...rootProps,
|
|
1059
|
-
ref: forwardedRef
|
|
1060
|
-
}, children);
|
|
1061
|
-
} finally {
|
|
1062
|
-
_effect.f();
|
|
1063
|
-
}
|
|
1064
|
-
});
|
|
1065
|
-
var cardStackItem = "contain-layout pli-2 plb-1 first-of-type:pbs-0 last-of-type:pbe-0";
|
|
1066
|
-
var CardStackItem = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
1067
|
-
var _effect = _useSignals11();
|
|
1068
|
-
try {
|
|
1069
|
-
const Root = asChild ? Slot4 : "div";
|
|
1070
|
-
const rootProps = asChild ? {
|
|
1071
|
-
classNames: [
|
|
1072
|
-
cardStackItem,
|
|
1073
|
-
classNames
|
|
1074
|
-
]
|
|
1075
|
-
} : {
|
|
1076
|
-
className: mx8(cardStackItem, classNames),
|
|
1077
|
-
role
|
|
1078
|
-
};
|
|
1079
|
-
return /* @__PURE__ */ React11.createElement(Root, {
|
|
1080
|
-
...props,
|
|
1081
|
-
...rootProps,
|
|
1082
|
-
ref: forwardedRef
|
|
1083
|
-
}, children);
|
|
1084
|
-
} finally {
|
|
1085
|
-
_effect.f();
|
|
1086
|
-
}
|
|
1087
|
-
});
|
|
1088
|
-
var CardStack = {
|
|
1089
|
-
Root: CardStackRoot,
|
|
1090
|
-
Content: CardStackContent,
|
|
1091
|
-
Stack: CardStackStack,
|
|
1092
|
-
Heading: CardStackHeading,
|
|
1093
|
-
Footer: CardStackFooter,
|
|
1094
|
-
DragHandle: CardStackDragHandle,
|
|
1095
|
-
Item: CardStackItem
|
|
1096
|
-
};
|
|
1097
|
-
|
|
1098
|
-
// src/exemplars/CardStack/CardStackDragPreview.tsx
|
|
1099
|
-
import { useSignals as _useSignals12 } from "@preact-signals/safe-react/tracking";
|
|
1100
|
-
import React12 from "react";
|
|
1101
|
-
import { IconButton as IconButton2, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
1102
|
-
import { mx as mx9 } from "@dxos/react-ui-theme";
|
|
1103
|
-
var CardStackDragPreviewRoot = ({ children }) => {
|
|
1104
|
-
var _effect = _useSignals12();
|
|
1105
|
-
try {
|
|
1106
|
-
return /* @__PURE__ */ React12.createElement("div", {
|
|
1107
|
-
className: "p-2"
|
|
1108
|
-
}, /* @__PURE__ */ React12.createElement("div", {
|
|
1109
|
-
className: "rounded-md max-bs-[calc(100dvh-1rem)] overflow-hidden bg-baseSurface border border-separator ring-focusLine ring-neutralFocusIndicator flex flex-col"
|
|
1110
|
-
}, children));
|
|
1111
|
-
} finally {
|
|
1112
|
-
_effect.f();
|
|
1113
|
-
}
|
|
1114
|
-
};
|
|
1115
|
-
var CardStackDragPreviewHeading = ({ children }) => {
|
|
1116
|
-
var _effect = _useSignals12();
|
|
1117
|
-
try {
|
|
1118
|
-
const { t } = useTranslation3(translationKey);
|
|
1119
|
-
return /* @__PURE__ */ React12.createElement("div", {
|
|
1120
|
-
className: "flex items-center p-2"
|
|
1121
|
-
}, /* @__PURE__ */ React12.createElement(IconButton2, {
|
|
1122
|
-
iconOnly: true,
|
|
1123
|
-
icon: "ph--dots-six-vertical--regular",
|
|
1124
|
-
variant: "ghost",
|
|
1125
|
-
label: t("column drag handle label"),
|
|
1126
|
-
classNames: "pli-2"
|
|
1127
|
-
}), children);
|
|
1128
|
-
} finally {
|
|
1129
|
-
_effect.f();
|
|
1130
|
-
}
|
|
1131
|
-
};
|
|
1132
|
-
var CardStackDragPreviewContent = ({ children, itemsCount = 0 }) => {
|
|
1133
|
-
var _effect = _useSignals12();
|
|
1134
|
-
try {
|
|
1135
|
-
return /* @__PURE__ */ React12.createElement("div", {
|
|
1136
|
-
className: mx9("overflow-y-auto flex-1 pli-2 flex flex-col gap-2", "plb-1", itemsCount > 0 ? "plb-2" : "plb-1")
|
|
1137
|
-
}, children);
|
|
1138
|
-
} finally {
|
|
1139
|
-
_effect.f();
|
|
1140
|
-
}
|
|
1141
|
-
};
|
|
1142
|
-
var CardStackDragPreviewFooter = ({ children }) => {
|
|
1143
|
-
var _effect = _useSignals12();
|
|
1144
|
-
try {
|
|
1145
|
-
return /* @__PURE__ */ React12.createElement("div", {
|
|
1146
|
-
className: "p-2 border-t border-separator"
|
|
1147
|
-
}, children);
|
|
1148
|
-
} finally {
|
|
1149
|
-
_effect.f();
|
|
1150
|
-
}
|
|
1151
|
-
};
|
|
1152
|
-
var CardStackDragPreview = {
|
|
1153
|
-
Root: CardStackDragPreviewRoot,
|
|
1154
|
-
Heading: CardStackDragPreviewHeading,
|
|
1155
|
-
Content: CardStackDragPreviewContent,
|
|
1156
|
-
Footer: CardStackDragPreviewFooter
|
|
921
|
+
SigilButton: StackItemSigilButton
|
|
1157
922
|
};
|
|
1158
923
|
export {
|
|
1159
|
-
Card,
|
|
1160
|
-
CardDragPreview2 as CardDragPreview,
|
|
1161
924
|
CardStack,
|
|
1162
925
|
CardStackDragPreview,
|
|
1163
926
|
DEFAULT_EXTRINSIC_SIZE,
|
|
@@ -1166,24 +929,13 @@ export {
|
|
|
1166
929
|
Stack,
|
|
1167
930
|
StackContext,
|
|
1168
931
|
StackItem,
|
|
1169
|
-
StackItemDragPreview,
|
|
1170
932
|
autoScrollRootAttributes,
|
|
1171
|
-
cardChrome,
|
|
1172
|
-
cardDialogContent,
|
|
1173
|
-
cardDialogHeader,
|
|
1174
|
-
cardDialogOverflow,
|
|
1175
|
-
cardDialogPaddedOverflow,
|
|
1176
|
-
cardDialogSearchListRoot,
|
|
1177
|
-
cardHeading,
|
|
1178
|
-
cardRoot,
|
|
1179
|
-
cardSpacing,
|
|
1180
933
|
cardStackContent,
|
|
934
|
+
cardStackDefaultInlineSizeRem,
|
|
1181
935
|
cardStackFooter,
|
|
1182
936
|
cardStackHeading,
|
|
1183
937
|
cardStackItem,
|
|
1184
938
|
cardStackRoot,
|
|
1185
|
-
cardText,
|
|
1186
|
-
labelSpacing,
|
|
1187
939
|
railGridHorizontal,
|
|
1188
940
|
railGridHorizontalContainFitContent,
|
|
1189
941
|
railGridVertical,
|