@dxos/react-ui-stack 0.8.4-main.67995b8 → 0.8.4-main.a4bbb77
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/{chunk-P3TQV4BA.mjs → chunk-K76XHALI.mjs} +399 -177
- package/dist/lib/browser/chunk-K76XHALI.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +5 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/playwright/index.mjs +23 -6
- package/dist/lib/browser/playwright/index.mjs.map +2 -2
- package/dist/lib/browser/testing/index.mjs +3 -3
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/{chunk-3WVEPAJ4.mjs → chunk-2UOARV5Q.mjs} +399 -177
- package/dist/lib/node-esm/chunk-2UOARV5Q.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +5 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/playwright/index.mjs +23 -6
- package/dist/lib/node-esm/playwright/index.mjs.map +2 -2
- package/dist/lib/node-esm/testing/index.mjs +3 -3
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/components/Image/Image.d.ts +11 -0
- package/dist/types/src/components/Image/Image.d.ts.map +1 -0
- package/dist/types/src/components/Image/Image.stories.d.ts +30 -0
- package/dist/types/src/components/Image/Image.stories.d.ts.map +1 -0
- package/dist/types/src/components/Image/index.d.ts +2 -0
- package/dist/types/src/components/Image/index.d.ts.map +1 -0
- package/dist/types/src/components/Stack/Stack.d.ts +10 -2
- 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 +4 -4
- 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.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.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/exemplars/Card/Card.d.ts +3 -5
- package/dist/types/src/exemplars/Card/Card.d.ts.map +1 -1
- package/dist/types/src/exemplars/Card/Card.stories.d.ts +12 -4
- package/dist/types/src/exemplars/Card/Card.stories.d.ts.map +1 -1
- package/dist/types/src/exemplars/Card/fragments.d.ts +3 -2
- package/dist/types/src/exemplars/Card/fragments.d.ts.map +1 -1
- package/dist/types/src/exemplars/CardStack/CardStack.d.ts +3 -1
- package/dist/types/src/exemplars/CardStack/CardStack.d.ts.map +1 -1
- package/dist/types/src/exemplars/CardStack/CardStack.stories.d.ts +9 -3
- package/dist/types/src/exemplars/CardStack/CardStack.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/useStackDropForElements.d.ts +1 -1
- package/dist/types/src/hooks/useStackDropForElements.d.ts.map +1 -1
- package/dist/types/src/testing/CardContainer.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +27 -27
- package/src/components/Image/Image.stories.tsx +56 -0
- package/src/components/Image/Image.tsx +137 -0
- package/src/components/Image/index.ts +5 -0
- package/src/components/Stack/Stack.stories.tsx +8 -9
- package/src/components/Stack/Stack.tsx +215 -18
- package/src/components/StackContext.tsx +2 -1
- package/src/components/StackItem/StackItem.stories.tsx +15 -13
- package/src/components/StackItem/StackItem.tsx +26 -18
- package/src/components/StackItem/StackItemContent.tsx +1 -0
- package/src/components/StackItem/StackItemHeading.tsx +3 -3
- package/src/components/StackItem/StackItemResizeHandle.tsx +2 -1
- package/src/components/StackItem/StackItemSigil.tsx +2 -1
- package/src/components/index.ts +1 -0
- package/src/exemplars/Card/Card.stories.tsx +29 -43
- package/src/exemplars/Card/Card.tsx +11 -11
- package/src/exemplars/Card/fragments.ts +3 -2
- package/src/exemplars/CardStack/CardStack.stories.tsx +11 -10
- package/src/exemplars/CardStack/CardStack.tsx +12 -9
- package/src/hooks/useStackDropForElements.ts +1 -1
- package/src/testing/CardContainer.tsx +9 -6
- package/dist/lib/browser/chunk-P3TQV4BA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3WVEPAJ4.mjs.map +0 -7
|
@@ -1,3 +1,100 @@
|
|
|
1
|
+
// src/components/Image/Image.tsx
|
|
2
|
+
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
3
|
+
import React, { useRef, useState } from "react";
|
|
4
|
+
import { mx } from "@dxos/react-ui-theme";
|
|
5
|
+
var Image = ({ classNames, src, alt = "", crossOrigin = "anonymous", sampleSize = 64, contrast = 0.95 }) => {
|
|
6
|
+
var _effect = _useSignals();
|
|
7
|
+
try {
|
|
8
|
+
const [crossOriginState, setCrossOriginState] = useState(crossOrigin);
|
|
9
|
+
const [dominantColor, setDominantColor] = useState(void 0);
|
|
10
|
+
const [imageLoaded, setImageLoaded] = useState(false);
|
|
11
|
+
const canvasRef = useRef(null);
|
|
12
|
+
const extractDominantColor = (img) => {
|
|
13
|
+
const canvas = canvasRef.current;
|
|
14
|
+
const ctx = canvas?.getContext("2d");
|
|
15
|
+
if (!canvas || !ctx) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
canvas.width = sampleSize;
|
|
19
|
+
canvas.height = sampleSize;
|
|
20
|
+
ctx.drawImage(img, 0, 0, sampleSize, sampleSize);
|
|
21
|
+
try {
|
|
22
|
+
const imageData = ctx.getImageData(0, 0, sampleSize, sampleSize);
|
|
23
|
+
const pixels = imageData.data;
|
|
24
|
+
let r = 0;
|
|
25
|
+
let g = 0;
|
|
26
|
+
let b = 0;
|
|
27
|
+
let totalWeight = 0;
|
|
28
|
+
for (let i = 0; i < pixels.length; i += 4) {
|
|
29
|
+
const red = pixels[i];
|
|
30
|
+
const green = pixels[i + 1];
|
|
31
|
+
const blue = pixels[i + 2];
|
|
32
|
+
const alpha = pixels[i + 3];
|
|
33
|
+
if (alpha === 0) continue;
|
|
34
|
+
const max = Math.max(red, green, blue);
|
|
35
|
+
const min = Math.min(red, green, blue);
|
|
36
|
+
const saturation = max === 0 ? 0 : (max - min) / max;
|
|
37
|
+
const weight = 1 + saturation * 2;
|
|
38
|
+
r += red * weight;
|
|
39
|
+
g += green * weight;
|
|
40
|
+
b += blue * weight;
|
|
41
|
+
totalWeight += weight;
|
|
42
|
+
}
|
|
43
|
+
if (totalWeight > 0) {
|
|
44
|
+
r = Math.round(r / totalWeight);
|
|
45
|
+
g = Math.round(g / totalWeight);
|
|
46
|
+
b = Math.round(b / totalWeight);
|
|
47
|
+
r = Math.round(r * contrast);
|
|
48
|
+
g = Math.round(g * contrast);
|
|
49
|
+
b = Math.round(b * contrast);
|
|
50
|
+
setDominantColor(`rgb(${r}, ${g}, ${b})`);
|
|
51
|
+
}
|
|
52
|
+
} catch {
|
|
53
|
+
setCrossOriginState(void 0);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const handleImageError = () => {
|
|
57
|
+
setCrossOriginState(void 0);
|
|
58
|
+
};
|
|
59
|
+
const handleImageLoad = (ev) => {
|
|
60
|
+
const img = ev.target;
|
|
61
|
+
extractDominantColor(img);
|
|
62
|
+
setImageLoaded(true);
|
|
63
|
+
};
|
|
64
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
65
|
+
className: mx(`relative flex is-full justify-center overflow-hidden transition-all duration-700`, classNames),
|
|
66
|
+
style: {
|
|
67
|
+
backgroundColor: dominantColor
|
|
68
|
+
}
|
|
69
|
+
}, /* @__PURE__ */ React.createElement("canvas", {
|
|
70
|
+
ref: canvasRef,
|
|
71
|
+
style: {
|
|
72
|
+
display: "none"
|
|
73
|
+
},
|
|
74
|
+
"aria-hidden": "true"
|
|
75
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
76
|
+
className: "absolute inset-0 pointer-events-none",
|
|
77
|
+
style: {
|
|
78
|
+
background: dominantColor ? `radial-gradient(circle at center, transparent 30%, ${dominantColor} 100%)` : void 0,
|
|
79
|
+
transition: "opacity 0.7s ease-in-out",
|
|
80
|
+
opacity: 0.5
|
|
81
|
+
}
|
|
82
|
+
}), /* @__PURE__ */ React.createElement("img", {
|
|
83
|
+
src,
|
|
84
|
+
alt,
|
|
85
|
+
crossOrigin: crossOriginState,
|
|
86
|
+
onError: handleImageError,
|
|
87
|
+
onLoad: handleImageLoad,
|
|
88
|
+
className: mx("z-10 object-contain transition-opacity duration-500", classNames),
|
|
89
|
+
style: {
|
|
90
|
+
opacity: imageLoaded ? 1 : 0
|
|
91
|
+
}
|
|
92
|
+
}));
|
|
93
|
+
} finally {
|
|
94
|
+
_effect.f();
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
1
98
|
// src/components/StackContext.tsx
|
|
2
99
|
import { createContext, useContext } from "react";
|
|
3
100
|
var StackContext = /* @__PURE__ */ createContext({
|
|
@@ -22,21 +119,20 @@ var StackItemContext = /* @__PURE__ */ createContext({
|
|
|
22
119
|
var useStackItem = () => useContext(StackItemContext);
|
|
23
120
|
|
|
24
121
|
// src/components/Stack/Stack.tsx
|
|
25
|
-
import { useSignals as
|
|
26
|
-
import { useArrowNavigationGroup } from "@fluentui/react-tabster";
|
|
122
|
+
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
27
123
|
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
28
|
-
import
|
|
29
|
-
import { ListItem } from "@dxos/react-ui";
|
|
30
|
-
import { mx } from "@dxos/react-ui-theme";
|
|
124
|
+
import React2, { Children, forwardRef, useCallback, useEffect, useMemo, useState as useState3 } from "react";
|
|
125
|
+
import { ListItem, useId } from "@dxos/react-ui";
|
|
126
|
+
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
31
127
|
|
|
32
128
|
// src/hooks/useStackDropForElements.ts
|
|
33
129
|
import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine";
|
|
34
130
|
import { dropTargetForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
35
131
|
import { autoScrollForElements } from "@atlaskit/pragmatic-drag-and-drop-auto-scroll/element";
|
|
36
132
|
import { attachClosestEdge, extractClosestEdge } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
|
|
37
|
-
import { useLayoutEffect, useState } from "react";
|
|
133
|
+
import { useLayoutEffect, useState as useState2 } from "react";
|
|
38
134
|
var useStackDropForElements = ({ id, element, scrollElement = element, selfDroppable, orientation, onRearrange }) => {
|
|
39
|
-
const [dropping, setDropping] =
|
|
135
|
+
const [dropping, setDropping] = useState2(false);
|
|
40
136
|
useLayoutEffect(() => {
|
|
41
137
|
if (!element || !selfDroppable) {
|
|
42
138
|
return;
|
|
@@ -100,16 +196,23 @@ var railGridVerticalContainFitContent = "grid-cols-[[rail-start]_var(--rail-size
|
|
|
100
196
|
var autoScrollRootAttributes = {
|
|
101
197
|
"data-drag-autoscroll": "idle"
|
|
102
198
|
};
|
|
103
|
-
var
|
|
104
|
-
|
|
199
|
+
var PERPENDICULAR_FOCUS_THRESHHOLD = 128;
|
|
200
|
+
var scrollIntoViewAndFocus = (el, orientation) => {
|
|
201
|
+
el.scrollIntoView({
|
|
202
|
+
behavior: "instant",
|
|
203
|
+
[orientation === "vertical" ? "block" : "inline"]: "center"
|
|
204
|
+
});
|
|
205
|
+
return el.focus();
|
|
206
|
+
};
|
|
207
|
+
var Stack = /* @__PURE__ */ forwardRef(({ children, classNames, style, orientation = "vertical", rail = true, size = "intrinsic", onRearrange, itemsCount = Children.count(children), getDropElement, separatorOnScroll, circularFocus, ...props }, forwardedRef) => {
|
|
208
|
+
var _effect = _useSignals2();
|
|
105
209
|
try {
|
|
106
|
-
const
|
|
210
|
+
const stackId = useId("stack", props.id);
|
|
211
|
+
const [stackElement, stackRef] = useState3(null);
|
|
212
|
+
const [lastFocusedItem, setLastFocusedItem] = useState3();
|
|
107
213
|
const composedItemRef = composeRefs(stackRef, forwardedRef);
|
|
108
|
-
const arrowNavigationAttrs = useArrowNavigationGroup({
|
|
109
|
-
axis: orientation
|
|
110
|
-
});
|
|
111
214
|
const styles = {
|
|
112
|
-
[orientation === "horizontal" ? "gridTemplateColumns" : "gridTemplateRows"]: `repeat(${itemsCount}, min-content) [tabster-dummies] 0`,
|
|
215
|
+
[orientation === "horizontal" ? "gridTemplateColumns" : "gridTemplateRows"]: size === "split" ? `repeat(${itemsCount}, 1fr)` : `repeat(${itemsCount}, min-content) [tabster-dummies] 0`,
|
|
113
216
|
...style
|
|
114
217
|
};
|
|
115
218
|
const selfDroppable = !!(itemsCount < 1 && onRearrange && props.id);
|
|
@@ -137,14 +240,118 @@ var Stack = /* @__PURE__ */ forwardRef(({ children, classNames, style, orientati
|
|
|
137
240
|
separatorOnScroll,
|
|
138
241
|
orientation
|
|
139
242
|
]);
|
|
243
|
+
const handleBlur = useCallback((event) => {
|
|
244
|
+
if (event.target) {
|
|
245
|
+
const target = event.target;
|
|
246
|
+
const closestStackItem = target.closest(`[data-dx-item-id]`);
|
|
247
|
+
if (closestStackItem?.closest(`[data-dx-stack="${stackId}"]`)) {
|
|
248
|
+
setLastFocusedItem(closestStackItem?.getAttribute("data-dx-item-id") ?? void 0);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
props.onBlur?.(event);
|
|
252
|
+
}, [
|
|
253
|
+
stackId,
|
|
254
|
+
props.onBlur
|
|
255
|
+
]);
|
|
256
|
+
const handleKeyDown = useCallback((event) => {
|
|
257
|
+
const target = event.target;
|
|
258
|
+
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)}"]`)) {
|
|
259
|
+
const closestOwnedItem = target.closest(`[data-dx-stack-item="${stackId}"]`);
|
|
260
|
+
const closestStack = target.closest("[data-dx-stack]");
|
|
261
|
+
const closestStackItems = Array.from(closestStack?.querySelectorAll(`[data-dx-stack-item="${stackId}"]`) ?? []);
|
|
262
|
+
const closestStackOrientation = closestStack?.getAttribute("aria-orientation");
|
|
263
|
+
const ancestorStack = closestStack?.parentElement?.closest("[data-dx-stack]");
|
|
264
|
+
if (closestOwnedItem && closestStack) {
|
|
265
|
+
const ancestorOrientation = ancestorStack?.getAttribute("aria-orientation");
|
|
266
|
+
const parallelDelta = (closestStackOrientation === "vertical" ? event.key === "ArrowUp" : event.key === "ArrowLeft") ? -1 : (closestStackOrientation === "vertical" ? event.key === "ArrowDown" : event.key === "ArrowRight") ? 1 : 0;
|
|
267
|
+
const perpendicularDelta = (closestStackOrientation === "vertical" ? event.key === "ArrowLeft" : event.key === "ArrowUp") ? -1 : (closestStackOrientation === "vertical" ? event.key === "ArrowRight" : event.key === "ArrowDown") ? 1 : 0;
|
|
268
|
+
if (parallelDelta !== 0) {
|
|
269
|
+
const currentIndex = closestStackItems.indexOf(closestOwnedItem);
|
|
270
|
+
const nextIndex = currentIndex + parallelDelta;
|
|
271
|
+
let adjacentItem;
|
|
272
|
+
if (circularFocus) {
|
|
273
|
+
adjacentItem = closestStackItems[(nextIndex + closestStackItems.length) % closestStackItems.length];
|
|
274
|
+
} else {
|
|
275
|
+
if (nextIndex >= 0 && nextIndex < closestStackItems.length) {
|
|
276
|
+
adjacentItem = closestStackItems[nextIndex];
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
if (adjacentItem) {
|
|
280
|
+
event.preventDefault();
|
|
281
|
+
scrollIntoViewAndFocus(adjacentItem, closestStackOrientation);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
if (perpendicularDelta !== 0) {
|
|
285
|
+
if (ancestorStack && ancestorOrientation !== closestStackOrientation) {
|
|
286
|
+
const siblingStacks = Array.from(ancestorStack.querySelectorAll(`[data-dx-stack-item="${ancestorStack.getAttribute("data-dx-stack")}"] [data-dx-stack]`));
|
|
287
|
+
const currentStackIndex = siblingStacks.indexOf(closestStack);
|
|
288
|
+
const nextStackIndex = currentStackIndex + perpendicularDelta;
|
|
289
|
+
let adjacentStack;
|
|
290
|
+
if (ancestorStack.getAttribute("data-dx-stack-circular-focus") === "true") {
|
|
291
|
+
adjacentStack = siblingStacks[(nextStackIndex + siblingStacks.length) % siblingStacks.length];
|
|
292
|
+
} else {
|
|
293
|
+
if (nextStackIndex >= 0 && nextStackIndex < siblingStacks.length) {
|
|
294
|
+
adjacentStack = siblingStacks[nextStackIndex];
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
const adjacentStackSelfItem = adjacentStack?.closest(`[data-dx-stack-item=${ancestorStack.getAttribute("data-dx-stack")}]`);
|
|
298
|
+
const adjacentStackItems = adjacentStack ? Array.from(adjacentStack.querySelectorAll(`[data-dx-stack-item="${adjacentStack.getAttribute("data-dx-stack")}"]`)) : [];
|
|
299
|
+
if (adjacentStack && adjacentStackItems.length > 0) {
|
|
300
|
+
let closestItem = adjacentStackItems[0];
|
|
301
|
+
const lastFocusedItem2 = adjacentStack.querySelector(`[data-dx-item-id="${adjacentStack.getAttribute("data-dx-last-focused-item") ?? "never"}"]`);
|
|
302
|
+
if (lastFocusedItem2) {
|
|
303
|
+
closestItem = lastFocusedItem2;
|
|
304
|
+
} else {
|
|
305
|
+
const ownedItemRect = closestOwnedItem.getBoundingClientRect();
|
|
306
|
+
const targetPosition = closestStackOrientation === "vertical" ? ownedItemRect.top : ownedItemRect.left;
|
|
307
|
+
let closestDistance = Infinity;
|
|
308
|
+
for (const item of adjacentStackItems) {
|
|
309
|
+
const itemRect = item.getBoundingClientRect();
|
|
310
|
+
const itemPosition = closestStackOrientation === "vertical" ? itemRect.top : itemRect.left;
|
|
311
|
+
const distance = Math.abs(itemPosition - targetPosition);
|
|
312
|
+
if (distance < closestDistance) {
|
|
313
|
+
closestDistance = distance;
|
|
314
|
+
closestItem = item;
|
|
315
|
+
}
|
|
316
|
+
if (closestDistance <= PERPENDICULAR_FOCUS_THRESHHOLD) {
|
|
317
|
+
break;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
event.preventDefault();
|
|
322
|
+
scrollIntoViewAndFocus(closestItem, closestStackOrientation);
|
|
323
|
+
} else if (adjacentStackSelfItem) {
|
|
324
|
+
event.preventDefault();
|
|
325
|
+
scrollIntoViewAndFocus(adjacentStackSelfItem, ancestorOrientation);
|
|
326
|
+
}
|
|
327
|
+
} else if (closestOwnedItem) {
|
|
328
|
+
const closestOwnedItemStack = closestOwnedItem.querySelector("[data-dx-stack]");
|
|
329
|
+
const closestOwnedItemStackItems = closestOwnedItemStack ? Array.from(closestOwnedItemStack.querySelectorAll(`[data-dx-stack-item="${closestOwnedItemStack.getAttribute("data-dx-stack")}"]`)) : [];
|
|
330
|
+
if (closestOwnedItemStackItems.length > 0) {
|
|
331
|
+
event.preventDefault();
|
|
332
|
+
scrollIntoViewAndFocus(closestOwnedItemStackItems[[
|
|
333
|
+
"ArrowUp",
|
|
334
|
+
"ArrowLeft"
|
|
335
|
+
].includes(event.key) ? closestOwnedItemStackItems.length - 1 : 0], closestOwnedItemStack?.getAttribute("aria-orientation"));
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
props.onKeyDown?.(event);
|
|
342
|
+
}, [
|
|
343
|
+
props.onKeyDown,
|
|
344
|
+
stackId,
|
|
345
|
+
circularFocus
|
|
346
|
+
]);
|
|
140
347
|
const gridClasses = useMemo(() => {
|
|
141
348
|
if (!rail) {
|
|
142
|
-
return orientation === "horizontal" ? "grid-rows-1 pli-
|
|
349
|
+
return orientation === "horizontal" ? "grid-rows-1 pli-[--stack-gap]" : "grid-cols-1 plb-[--stack-gap]";
|
|
143
350
|
}
|
|
144
351
|
if (orientation === "horizontal") {
|
|
145
|
-
return
|
|
352
|
+
return railGridHorizontal;
|
|
146
353
|
} else {
|
|
147
|
-
return
|
|
354
|
+
return railGridVertical;
|
|
148
355
|
}
|
|
149
356
|
}, [
|
|
150
357
|
rail,
|
|
@@ -169,17 +376,22 @@ var Stack = /* @__PURE__ */ forwardRef(({ children, classNames, style, orientati
|
|
|
169
376
|
stackElement,
|
|
170
377
|
handleScroll
|
|
171
378
|
]);
|
|
172
|
-
return /* @__PURE__ */
|
|
379
|
+
return /* @__PURE__ */ React2.createElement(StackContext.Provider, {
|
|
173
380
|
value: {
|
|
174
381
|
orientation,
|
|
175
382
|
rail,
|
|
176
383
|
size,
|
|
177
|
-
onRearrange
|
|
384
|
+
onRearrange,
|
|
385
|
+
stackId
|
|
178
386
|
}
|
|
179
|
-
}, /* @__PURE__ */
|
|
387
|
+
}, /* @__PURE__ */ React2.createElement("div", {
|
|
180
388
|
...props,
|
|
181
|
-
|
|
182
|
-
|
|
389
|
+
className: mx2("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),
|
|
390
|
+
onKeyDown: handleKeyDown,
|
|
391
|
+
onBlur: handleBlur,
|
|
392
|
+
"data-dx-stack": stackId,
|
|
393
|
+
"data-dx-stack-circular-focus": circularFocus,
|
|
394
|
+
"data-dx-last-focused-item": lastFocusedItem,
|
|
183
395
|
"data-rail": rail,
|
|
184
396
|
"aria-orientation": orientation,
|
|
185
397
|
style: styles,
|
|
@@ -187,7 +399,7 @@ var Stack = /* @__PURE__ */ forwardRef(({ children, classNames, style, orientati
|
|
|
187
399
|
...Number.isFinite(separatorOnScroll) && {
|
|
188
400
|
onScroll: handleScroll
|
|
189
401
|
}
|
|
190
|
-
}, children, selfDroppable && dropping && /* @__PURE__ */
|
|
402
|
+
}, children, selfDroppable && dropping && /* @__PURE__ */ React2.createElement(ListItem.DropIndicator, {
|
|
191
403
|
lineInset: 8,
|
|
192
404
|
terminalInset: -8,
|
|
193
405
|
gap: -8,
|
|
@@ -218,7 +430,7 @@ var translations = [
|
|
|
218
430
|
];
|
|
219
431
|
|
|
220
432
|
// src/components/StackItem/StackItem.tsx
|
|
221
|
-
import { useSignals as
|
|
433
|
+
import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking";
|
|
222
434
|
import { combine as combine2 } from "@atlaskit/pragmatic-drag-and-drop/combine";
|
|
223
435
|
import { draggable, dropTargetForElements as dropTargetForElements2 } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
224
436
|
import { preserveOffsetOnSource } from "@atlaskit/pragmatic-drag-and-drop/element/preserve-offset-on-source";
|
|
@@ -226,18 +438,18 @@ import { setCustomNativeDragPreview } from "@atlaskit/pragmatic-drag-and-drop/el
|
|
|
226
438
|
import { attachClosestEdge as attachClosestEdge2, extractClosestEdge as extractClosestEdge2 } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
|
|
227
439
|
import { useFocusableGroup as useFocusableGroup2 } from "@fluentui/react-tabster";
|
|
228
440
|
import { composeRefs as composeRefs2 } from "@radix-ui/react-compose-refs";
|
|
229
|
-
import
|
|
441
|
+
import React9, { forwardRef as forwardRef5, useCallback as useCallback2, useLayoutEffect as useLayoutEffect2, useMemo as useMemo3, useState as useState5 } from "react";
|
|
230
442
|
import { createPortal } from "react-dom";
|
|
231
443
|
import { ListItem as ListItem2 } from "@dxos/react-ui";
|
|
232
444
|
import { resizeAttributes, sizeStyle } from "@dxos/react-ui-dnd";
|
|
233
|
-
import { mx as
|
|
445
|
+
import { mx as mx6 } from "@dxos/react-ui-theme";
|
|
234
446
|
|
|
235
447
|
// src/components/StackItem/StackItemContent.tsx
|
|
236
|
-
import { useSignals as
|
|
237
|
-
import
|
|
238
|
-
import { mx as
|
|
448
|
+
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
449
|
+
import React3, { forwardRef as forwardRef2, useMemo as useMemo2 } from "react";
|
|
450
|
+
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
239
451
|
var StackItemContent = /* @__PURE__ */ forwardRef2(({ children, toolbar, statusbar, layoutManaged, classNames, size = "intrinsic", ...props }, forwardedRef) => {
|
|
240
|
-
var _effect =
|
|
452
|
+
var _effect = _useSignals3();
|
|
241
453
|
try {
|
|
242
454
|
const { size: stackItemSize } = useStack();
|
|
243
455
|
const { role } = useStackItem();
|
|
@@ -256,10 +468,10 @@ var StackItemContent = /* @__PURE__ */ forwardRef2(({ children, toolbar, statusb
|
|
|
256
468
|
statusbar,
|
|
257
469
|
layoutManaged
|
|
258
470
|
]);
|
|
259
|
-
return /* @__PURE__ */
|
|
471
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
260
472
|
role: "none",
|
|
261
473
|
...props,
|
|
262
|
-
className:
|
|
474
|
+
className: mx3("group grid grid-cols-[100%] density-coarse", stackItemSize === "contain" && "min-bs-0 overflow-hidden", size === "video" ? "aspect-video" : size === "square" && "aspect-square", toolbar && "[&>.dx-toolbar]:relative [&>.dx-toolbar]:border-be [&>.dx-toolbar]:border-subduedSeparator", role === "section" && toolbar && "[&_.dx-toolbar]:sticky [&_.dx-toolbar]:z-[1] [&_.dx-toolbar]:block-start-0 [&_.dx-toolbar]:-mbe-px [&_.dx-toolbar]:min-is-0", classNames),
|
|
263
475
|
style,
|
|
264
476
|
"data-popover-collision-boundary": true,
|
|
265
477
|
ref: forwardedRef
|
|
@@ -270,15 +482,15 @@ var StackItemContent = /* @__PURE__ */ forwardRef2(({ children, toolbar, statusb
|
|
|
270
482
|
});
|
|
271
483
|
|
|
272
484
|
// src/components/StackItem/StackItemDragHandle.tsx
|
|
273
|
-
import { useSignals as
|
|
485
|
+
import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
|
|
274
486
|
import { Slot } from "@radix-ui/react-slot";
|
|
275
|
-
import
|
|
487
|
+
import React4 from "react";
|
|
276
488
|
var StackItemDragHandle = ({ asChild, children }) => {
|
|
277
|
-
var _effect =
|
|
489
|
+
var _effect = _useSignals4();
|
|
278
490
|
try {
|
|
279
491
|
const { selfDragHandleRef } = useStackItem();
|
|
280
492
|
const Root = asChild ? Slot : "div";
|
|
281
|
-
return /* @__PURE__ */
|
|
493
|
+
return /* @__PURE__ */ React4.createElement(Root, {
|
|
282
494
|
ref: selfDragHandleRef,
|
|
283
495
|
role: "button"
|
|
284
496
|
}, children);
|
|
@@ -288,35 +500,35 @@ var StackItemDragHandle = ({ asChild, children }) => {
|
|
|
288
500
|
};
|
|
289
501
|
|
|
290
502
|
// src/components/StackItem/StackItemHeading.tsx
|
|
291
|
-
import { useSignals as
|
|
503
|
+
import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
|
|
292
504
|
import { useFocusableGroup } from "@fluentui/react-tabster";
|
|
293
505
|
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
294
|
-
import
|
|
506
|
+
import React5, { forwardRef as forwardRef3 } from "react";
|
|
295
507
|
import { useAttention } from "@dxos/react-ui-attention";
|
|
296
|
-
import { mx as
|
|
508
|
+
import { mx as mx4 } from "@dxos/react-ui-theme";
|
|
297
509
|
var StackItemHeading = ({ children, classNames, asChild, separateOnScroll, ...props }) => {
|
|
298
|
-
var _effect =
|
|
510
|
+
var _effect = _useSignals5();
|
|
299
511
|
try {
|
|
300
512
|
const { orientation } = useStack();
|
|
301
513
|
const focusableGroupAttrs = useFocusableGroup({
|
|
302
514
|
tabBehavior: "limited"
|
|
303
515
|
});
|
|
304
516
|
const Root = asChild ? Slot2 : "div";
|
|
305
|
-
return /* @__PURE__ */
|
|
517
|
+
return /* @__PURE__ */ React5.createElement(Root, {
|
|
306
518
|
role: "heading",
|
|
307
519
|
...props,
|
|
308
520
|
tabIndex: 0,
|
|
309
521
|
...focusableGroupAttrs,
|
|
310
|
-
className:
|
|
522
|
+
className: mx4("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)
|
|
311
523
|
}, children);
|
|
312
524
|
} finally {
|
|
313
525
|
_effect.f();
|
|
314
526
|
}
|
|
315
527
|
};
|
|
316
528
|
var StackItemHeadingStickyContent = ({ children }) => {
|
|
317
|
-
var _effect =
|
|
529
|
+
var _effect = _useSignals5();
|
|
318
530
|
try {
|
|
319
|
-
return /* @__PURE__ */
|
|
531
|
+
return /* @__PURE__ */ React5.createElement("div", {
|
|
320
532
|
role: "none",
|
|
321
533
|
className: "sticky block-start-0 bg-[--sticky-bg] p-1 is-full"
|
|
322
534
|
}, children);
|
|
@@ -325,13 +537,13 @@ var StackItemHeadingStickyContent = ({ children }) => {
|
|
|
325
537
|
}
|
|
326
538
|
};
|
|
327
539
|
var StackItemHeadingLabel = /* @__PURE__ */ forwardRef3(({ attendableId, related, classNames, ...props }, forwardedRef) => {
|
|
328
|
-
var _effect =
|
|
540
|
+
var _effect = _useSignals5();
|
|
329
541
|
try {
|
|
330
542
|
const { hasAttention, isAncestor, isRelated } = useAttention(attendableId);
|
|
331
|
-
return /* @__PURE__ */
|
|
543
|
+
return /* @__PURE__ */ React5.createElement("h1", {
|
|
332
544
|
...props,
|
|
333
545
|
"data-attention": (related && isRelated || hasAttention || isAncestor).toString(),
|
|
334
|
-
className:
|
|
546
|
+
className: mx4("pli-1 min-is-0 is-0 grow truncate font-medium text-baseText data-[attention=true]:text-accentText self-center", classNames),
|
|
335
547
|
ref: forwardedRef
|
|
336
548
|
});
|
|
337
549
|
} finally {
|
|
@@ -340,17 +552,17 @@ var StackItemHeadingLabel = /* @__PURE__ */ forwardRef3(({ attendableId, related
|
|
|
340
552
|
});
|
|
341
553
|
|
|
342
554
|
// src/components/StackItem/StackItemResizeHandle.tsx
|
|
343
|
-
import { useSignals as
|
|
344
|
-
import
|
|
555
|
+
import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
|
|
556
|
+
import React6 from "react";
|
|
345
557
|
import { ResizeHandle } from "@dxos/react-ui-dnd";
|
|
346
558
|
var MIN_WIDTH = 20;
|
|
347
559
|
var MIN_HEIGHT = 3;
|
|
348
560
|
var StackItemResizeHandle = () => {
|
|
349
|
-
var _effect =
|
|
561
|
+
var _effect = _useSignals6();
|
|
350
562
|
try {
|
|
351
563
|
const { orientation } = useStack();
|
|
352
564
|
const { setSize, size } = useStackItem();
|
|
353
|
-
return /* @__PURE__ */
|
|
565
|
+
return /* @__PURE__ */ React6.createElement(ResizeHandle, {
|
|
354
566
|
side: orientation === "horizontal" ? "inline-end" : "block-end",
|
|
355
567
|
fallbackSize: DEFAULT_EXTRINSIC_SIZE,
|
|
356
568
|
minSize: orientation === "horizontal" ? MIN_WIDTH : MIN_HEIGHT,
|
|
@@ -363,28 +575,28 @@ var StackItemResizeHandle = () => {
|
|
|
363
575
|
};
|
|
364
576
|
|
|
365
577
|
// src/components/StackItem/StackItemSigil.tsx
|
|
366
|
-
import { useSignals as
|
|
367
|
-
import
|
|
578
|
+
import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
|
|
579
|
+
import React8, { Fragment, forwardRef as forwardRef4, useState as useState4 } from "react";
|
|
368
580
|
import { keySymbols } from "@dxos/keyboard";
|
|
369
581
|
import { Button, DropdownMenu, Icon, toLocalizedString, useTranslation } from "@dxos/react-ui";
|
|
370
582
|
import { useAttention as useAttention2 } from "@dxos/react-ui-attention";
|
|
371
|
-
import { descriptionText, mx as
|
|
583
|
+
import { descriptionText, mx as mx5 } from "@dxos/react-ui-theme";
|
|
372
584
|
import { getHostPlatform } from "@dxos/util";
|
|
373
585
|
|
|
374
586
|
// src/components/StackItem/MenuSignifier.tsx
|
|
375
|
-
import { useSignals as
|
|
376
|
-
import
|
|
587
|
+
import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking";
|
|
588
|
+
import React7 from "react";
|
|
377
589
|
var MenuSignifierHorizontal = () => {
|
|
378
|
-
var _effect =
|
|
590
|
+
var _effect = _useSignals7();
|
|
379
591
|
try {
|
|
380
|
-
return /* @__PURE__ */
|
|
592
|
+
return /* @__PURE__ */ React7.createElement("svg", {
|
|
381
593
|
className: "absolute block-end-[7px]",
|
|
382
594
|
width: 20,
|
|
383
595
|
height: 2,
|
|
384
596
|
viewBox: "0 0 20 2",
|
|
385
597
|
stroke: "currentColor",
|
|
386
598
|
opacity: 0.5
|
|
387
|
-
}, /* @__PURE__ */
|
|
599
|
+
}, /* @__PURE__ */ React7.createElement("line", {
|
|
388
600
|
x1: 0.5,
|
|
389
601
|
y1: 0.75,
|
|
390
602
|
x2: 19,
|
|
@@ -401,11 +613,11 @@ var MenuSignifierHorizontal = () => {
|
|
|
401
613
|
|
|
402
614
|
// src/components/StackItem/StackItemSigil.tsx
|
|
403
615
|
var StackItemSigilButton = /* @__PURE__ */ forwardRef4(({ attendableId, classNames, related, isMenu = true, children, ...props }, forwardedRef) => {
|
|
404
|
-
var _effect =
|
|
616
|
+
var _effect = _useSignals8();
|
|
405
617
|
try {
|
|
406
618
|
const { hasAttention, isAncestor, isRelated } = useAttention2(attendableId);
|
|
407
619
|
const variant = related && isRelated || hasAttention || isAncestor ? "primary" : "ghost";
|
|
408
|
-
return /* @__PURE__ */
|
|
620
|
+
return /* @__PURE__ */ React8.createElement(Button, {
|
|
409
621
|
...props,
|
|
410
622
|
variant,
|
|
411
623
|
classNames: [
|
|
@@ -413,50 +625,50 @@ var StackItemSigilButton = /* @__PURE__ */ forwardRef4(({ attendableId, classNam
|
|
|
413
625
|
classNames
|
|
414
626
|
],
|
|
415
627
|
ref: forwardedRef
|
|
416
|
-
}, isMenu && /* @__PURE__ */
|
|
628
|
+
}, isMenu && /* @__PURE__ */ React8.createElement(MenuSignifierHorizontal, null), children);
|
|
417
629
|
} finally {
|
|
418
630
|
_effect.f();
|
|
419
631
|
}
|
|
420
632
|
});
|
|
421
633
|
var StackItemSigil = /* @__PURE__ */ forwardRef4(({ actions: actionGroups, onAction, triggerLabel, attendableId, icon, related, children }, forwardedRef) => {
|
|
422
|
-
var _effect =
|
|
634
|
+
var _effect = _useSignals8();
|
|
423
635
|
try {
|
|
424
636
|
const { t } = useTranslation(translationKey);
|
|
425
|
-
const [optionsMenuOpen, setOptionsMenuOpen] =
|
|
637
|
+
const [optionsMenuOpen, setOptionsMenuOpen] = useState4(false);
|
|
426
638
|
const hasActions = actionGroups && actionGroups.length > 0;
|
|
427
|
-
const button = /* @__PURE__ */
|
|
639
|
+
const button = /* @__PURE__ */ React8.createElement(StackItemSigilButton, {
|
|
428
640
|
attendableId,
|
|
429
641
|
related,
|
|
430
642
|
isMenu: hasActions,
|
|
431
643
|
// TODO(wittjosiah): Better disabling of interactive styles when no action are available.
|
|
432
644
|
// Remove underscore icon when no actions are available?
|
|
433
645
|
classNames: !hasActions && "cursor-default"
|
|
434
|
-
}, /* @__PURE__ */
|
|
646
|
+
}, /* @__PURE__ */ React8.createElement("span", {
|
|
435
647
|
className: "sr-only"
|
|
436
|
-
}, triggerLabel), /* @__PURE__ */
|
|
648
|
+
}, triggerLabel), /* @__PURE__ */ React8.createElement(Icon, {
|
|
437
649
|
icon,
|
|
438
650
|
size: 5
|
|
439
651
|
}));
|
|
440
652
|
if (!hasActions) {
|
|
441
653
|
return button;
|
|
442
654
|
}
|
|
443
|
-
return /* @__PURE__ */
|
|
655
|
+
return /* @__PURE__ */ React8.createElement(DropdownMenu.Root, {
|
|
444
656
|
open: optionsMenuOpen,
|
|
445
657
|
onOpenChange: setOptionsMenuOpen
|
|
446
|
-
}, /* @__PURE__ */
|
|
658
|
+
}, /* @__PURE__ */ React8.createElement(DropdownMenu.Trigger, {
|
|
447
659
|
asChild: true,
|
|
448
660
|
ref: forwardedRef
|
|
449
|
-
}, button), /* @__PURE__ */
|
|
661
|
+
}, button), /* @__PURE__ */ React8.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React8.createElement(DropdownMenu.Content, {
|
|
450
662
|
classNames: "z-[31]"
|
|
451
|
-
}, /* @__PURE__ */
|
|
452
|
-
const separator = index > 0 ? /* @__PURE__ */
|
|
453
|
-
return /* @__PURE__ */
|
|
663
|
+
}, /* @__PURE__ */ React8.createElement(DropdownMenu.Viewport, null, actionGroups?.map((actions, index) => {
|
|
664
|
+
const separator = index > 0 ? /* @__PURE__ */ React8.createElement(DropdownMenu.Separator, null) : null;
|
|
665
|
+
return /* @__PURE__ */ React8.createElement(Fragment, {
|
|
454
666
|
key: index
|
|
455
667
|
}, separator, actions.map((action) => {
|
|
456
668
|
const shortcut = typeof action.properties.keyBinding === "string" ? action.properties.keyBinding : action.properties.keyBinding?.[getHostPlatform()];
|
|
457
669
|
const menuItemType = action.properties.menuItemType;
|
|
458
670
|
const Root = menuItemType === "toggle" ? DropdownMenu.CheckboxItem : DropdownMenu.Item;
|
|
459
|
-
return /* @__PURE__ */
|
|
671
|
+
return /* @__PURE__ */ React8.createElement(Root, {
|
|
460
672
|
key: action.id,
|
|
461
673
|
onClick: (event) => {
|
|
462
674
|
if (action.properties.disabled) {
|
|
@@ -472,21 +684,21 @@ var StackItemSigil = /* @__PURE__ */ forwardRef4(({ actions: actionGroups, onAct
|
|
|
472
684
|
...action.properties?.testId && {
|
|
473
685
|
"data-testid": action.properties.testId
|
|
474
686
|
}
|
|
475
|
-
}, /* @__PURE__ */
|
|
687
|
+
}, /* @__PURE__ */ React8.createElement(Icon, {
|
|
476
688
|
icon: action.properties.icon ?? "ph--placeholder--regular",
|
|
477
689
|
size: 4
|
|
478
|
-
}), /* @__PURE__ */
|
|
690
|
+
}), /* @__PURE__ */ React8.createElement("span", {
|
|
479
691
|
className: "grow truncate"
|
|
480
|
-
}, toLocalizedString(action.properties.label ?? "", t)), menuItemType === "toggle" && /* @__PURE__ */
|
|
692
|
+
}, toLocalizedString(action.properties.label ?? "", t)), menuItemType === "toggle" && /* @__PURE__ */ React8.createElement(DropdownMenu.ItemIndicator, {
|
|
481
693
|
asChild: true
|
|
482
|
-
}, /* @__PURE__ */
|
|
694
|
+
}, /* @__PURE__ */ React8.createElement(Icon, {
|
|
483
695
|
icon: "ph--check--regular",
|
|
484
696
|
size: 4
|
|
485
|
-
})), shortcut && /* @__PURE__ */
|
|
486
|
-
className:
|
|
697
|
+
})), shortcut && /* @__PURE__ */ React8.createElement("span", {
|
|
698
|
+
className: mx5("shrink-0", descriptionText)
|
|
487
699
|
}, keySymbols(shortcut).join("")));
|
|
488
700
|
}));
|
|
489
|
-
}), children), /* @__PURE__ */
|
|
701
|
+
}), children), /* @__PURE__ */ React8.createElement(DropdownMenu.Arrow, null))));
|
|
490
702
|
} finally {
|
|
491
703
|
_effect.f();
|
|
492
704
|
}
|
|
@@ -497,15 +709,15 @@ var DEFAULT_HORIZONTAL_SIZE = 48;
|
|
|
497
709
|
var DEFAULT_VERTICAL_SIZE = "min-content";
|
|
498
710
|
var DEFAULT_EXTRINSIC_SIZE = DEFAULT_HORIZONTAL_SIZE;
|
|
499
711
|
var StackItemRoot = /* @__PURE__ */ forwardRef5(({ item, children, classNames, size: propsSize, onSizeChange, role, order, prevSiblingId, nextSiblingId, style, disableRearrange, focusIndicatorVariant = "over-all", ...props }, forwardedRef) => {
|
|
500
|
-
var _effect =
|
|
712
|
+
var _effect = _useSignals9();
|
|
501
713
|
try {
|
|
502
|
-
const [itemElement, itemRef] =
|
|
503
|
-
const [selfDragHandleElement, selfDragHandleRef] =
|
|
504
|
-
const [closestEdge, setEdge] =
|
|
505
|
-
const [sourceId, setSourceId] =
|
|
506
|
-
const [dragState, setDragState] =
|
|
507
|
-
const { orientation, rail, onRearrange } = useStack();
|
|
508
|
-
const [size = orientation === "horizontal" ? DEFAULT_HORIZONTAL_SIZE : DEFAULT_VERTICAL_SIZE, setInternalSize] =
|
|
714
|
+
const [itemElement, itemRef] = useState5(null);
|
|
715
|
+
const [selfDragHandleElement, selfDragHandleRef] = useState5(null);
|
|
716
|
+
const [closestEdge, setEdge] = useState5(null);
|
|
717
|
+
const [sourceId, setSourceId] = useState5(null);
|
|
718
|
+
const [dragState, setDragState] = useState5(idle);
|
|
719
|
+
const { orientation, rail, onRearrange, size: stackSize, stackId } = useStack();
|
|
720
|
+
const [size = orientation === "horizontal" ? DEFAULT_HORIZONTAL_SIZE : DEFAULT_VERTICAL_SIZE, setInternalSize] = useState5(propsSize);
|
|
509
721
|
const Root = role ?? "div";
|
|
510
722
|
const composedItemRef = composeRefs2(itemRef, forwardedRef);
|
|
511
723
|
const setSize = useCallback2((nextSize, commit) => {
|
|
@@ -652,24 +864,25 @@ var StackItemRoot = /* @__PURE__ */ forwardRef5(({ item, children, classNames, s
|
|
|
652
864
|
setDragState,
|
|
653
865
|
role
|
|
654
866
|
]);
|
|
655
|
-
return /* @__PURE__ */
|
|
867
|
+
return /* @__PURE__ */ React9.createElement(StackItemContext.Provider, {
|
|
656
868
|
value: stackItemContextValue
|
|
657
|
-
}, /* @__PURE__ */
|
|
869
|
+
}, /* @__PURE__ */ React9.createElement(Root, {
|
|
658
870
|
...props,
|
|
659
871
|
tabIndex: 0,
|
|
660
872
|
...focusableGroupAttrs,
|
|
661
|
-
className:
|
|
662
|
-
"data-dx-stack-item":
|
|
873
|
+
className: mx6("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),
|
|
874
|
+
"data-dx-stack-item": stackId,
|
|
875
|
+
"data-dx-item-id": item.id,
|
|
663
876
|
...resizeAttributes,
|
|
664
877
|
style: {
|
|
665
|
-
...sizeStyle(size, orientation),
|
|
878
|
+
...stackSize !== "split" && sizeStyle(size, orientation),
|
|
666
879
|
...Number.isFinite(order) && {
|
|
667
880
|
[orientation === "horizontal" ? "gridColumn" : "gridRow"]: `${order}`
|
|
668
881
|
},
|
|
669
882
|
...style
|
|
670
883
|
},
|
|
671
884
|
ref: composedItemRef
|
|
672
|
-
}, children, shouldShowDropIndicator() && closestEdge && /* @__PURE__ */
|
|
885
|
+
}, children, shouldShowDropIndicator() && closestEdge && /* @__PURE__ */ React9.createElement(ListItem2.DropIndicator, {
|
|
673
886
|
lineInset: 8,
|
|
674
887
|
terminalInset: -8,
|
|
675
888
|
edge: closestEdge
|
|
@@ -700,6 +913,7 @@ var StackItem = {
|
|
|
700
913
|
// src/exemplars/Card/fragments.ts
|
|
701
914
|
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";
|
|
702
915
|
var cardSpacing = "pli-cardSpacingInline mlb-cardSpacingBlock";
|
|
916
|
+
var cardNoSpacing = "pli-0 mlb-0";
|
|
703
917
|
var labelSpacing = "mbs-inputSpacingBlock mbe-labelSpacingBlock";
|
|
704
918
|
var cardDialogContent = "p-0 bs-content min-bs-[8rem] max-bs-full md:max-is-[32rem] overflow-hidden";
|
|
705
919
|
var cardDialogHeader = "pli-cardSpacingInline mbs-cardSpacingBlock flex justify-between";
|
|
@@ -707,18 +921,18 @@ var cardDialogOverflow = "overflow-y-auto min-bs-0 flex-1";
|
|
|
707
921
|
var cardDialogPaddedOverflow = `${cardDialogOverflow} plb-cardSpacingBlock`;
|
|
708
922
|
var cardDialogSearchListRoot = "pli-cardSpacingInline pbs-cardSpacingBlock [&>input]:mbe-0 min-bs-0 flex-1 flex flex-col";
|
|
709
923
|
var cardText = cardSpacing;
|
|
710
|
-
var cardHeading = "text-lg font-medium line-clamp-2";
|
|
711
|
-
var cardChrome = "pli-[--dx-cardSpacingChrome] mlb-[--dx-cardSpacingChrome] [&_.dx-button]:text-start [&_.dx-button]:is-full";
|
|
924
|
+
var cardHeading = "text-lg font-medium line-clamp-2 grow";
|
|
925
|
+
var cardChrome = "pli-[--dx-cardSpacingChrome] mlb-[--dx-cardSpacingChrome] [&_.dx-button]:text-start [&_.dx-button]:is-full [&_.dx-button]:pis-[calc(var(--dx-cardSpacingInline)-var(--dx-cardSpacingChrome))]";
|
|
712
926
|
|
|
713
927
|
// src/exemplars/Card/Card.tsx
|
|
714
|
-
import { useSignals as
|
|
928
|
+
import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
|
|
715
929
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
716
930
|
import { Slot as Slot3 } from "@radix-ui/react-slot";
|
|
717
|
-
import
|
|
931
|
+
import React10, { forwardRef as forwardRef6 } from "react";
|
|
718
932
|
import { Icon as Icon2, IconButton, Toolbar, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
719
|
-
import { hoverableControls, mx as
|
|
933
|
+
import { hoverableControls, mx as mx7 } from "@dxos/react-ui-theme";
|
|
720
934
|
var CardStaticRoot = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "group", ...props }, forwardedRef) => {
|
|
721
|
-
var _effect =
|
|
935
|
+
var _effect = _useSignals10();
|
|
722
936
|
try {
|
|
723
937
|
const Root = asChild ? Slot3 : "div";
|
|
724
938
|
const rootProps = asChild ? {
|
|
@@ -727,10 +941,10 @@ var CardStaticRoot = /* @__PURE__ */ forwardRef6(({ children, classNames, asChil
|
|
|
727
941
|
classNames
|
|
728
942
|
]
|
|
729
943
|
} : {
|
|
730
|
-
className:
|
|
944
|
+
className: mx7(cardRoot, classNames),
|
|
731
945
|
role
|
|
732
946
|
};
|
|
733
|
-
return /* @__PURE__ */
|
|
947
|
+
return /* @__PURE__ */ React10.createElement(Root, {
|
|
734
948
|
...props,
|
|
735
949
|
...rootProps,
|
|
736
950
|
ref: forwardedRef
|
|
@@ -740,23 +954,23 @@ var CardStaticRoot = /* @__PURE__ */ forwardRef6(({ children, classNames, asChil
|
|
|
740
954
|
}
|
|
741
955
|
});
|
|
742
956
|
var CardSurfaceRoot = ({ role = "never", children, classNames }) => {
|
|
743
|
-
var _effect =
|
|
957
|
+
var _effect = _useSignals10();
|
|
744
958
|
try {
|
|
745
959
|
if ([
|
|
746
960
|
"card--popover",
|
|
747
961
|
"card--intrinsic",
|
|
748
962
|
"card--extrinsic"
|
|
749
963
|
].includes(role)) {
|
|
750
|
-
return /* @__PURE__ */
|
|
751
|
-
className:
|
|
964
|
+
return /* @__PURE__ */ React10.createElement("div", {
|
|
965
|
+
className: mx7(role === "card--popover" ? "popover-card-width" : [
|
|
752
966
|
"card--intrinsic",
|
|
753
967
|
"card--extrinsic"
|
|
754
968
|
].includes(role) ? "contents" : "", classNames)
|
|
755
969
|
}, children);
|
|
756
970
|
} else {
|
|
757
|
-
return /* @__PURE__ */
|
|
971
|
+
return /* @__PURE__ */ React10.createElement(CardStaticRoot, {
|
|
758
972
|
classNames: [
|
|
759
|
-
role === "card--transclusion" && "mlb-
|
|
973
|
+
role === "card--transclusion" && "mlb-1",
|
|
760
974
|
role === "card--transclusion" && hoverableControls,
|
|
761
975
|
classNames
|
|
762
976
|
]
|
|
@@ -767,7 +981,7 @@ var CardSurfaceRoot = ({ role = "never", children, classNames }) => {
|
|
|
767
981
|
}
|
|
768
982
|
};
|
|
769
983
|
var CardHeading = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "heading", ...props }, forwardedRef) => {
|
|
770
|
-
var _effect =
|
|
984
|
+
var _effect = _useSignals10();
|
|
771
985
|
try {
|
|
772
986
|
const Root = asChild ? Slot3 : "div";
|
|
773
987
|
const rootProps = asChild ? {
|
|
@@ -777,10 +991,10 @@ var CardHeading = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild,
|
|
|
777
991
|
classNames
|
|
778
992
|
]
|
|
779
993
|
} : {
|
|
780
|
-
className:
|
|
994
|
+
className: mx7(cardHeading, cardText, classNames),
|
|
781
995
|
role
|
|
782
996
|
};
|
|
783
|
-
return /* @__PURE__ */
|
|
997
|
+
return /* @__PURE__ */ React10.createElement(Root, {
|
|
784
998
|
...props,
|
|
785
999
|
...rootProps,
|
|
786
1000
|
ref: forwardedRef
|
|
@@ -790,9 +1004,9 @@ var CardHeading = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild,
|
|
|
790
1004
|
}
|
|
791
1005
|
});
|
|
792
1006
|
var CardToolbar = /* @__PURE__ */ forwardRef6(({ children, classNames, ...props }, forwardedRef) => {
|
|
793
|
-
var _effect =
|
|
1007
|
+
var _effect = _useSignals10();
|
|
794
1008
|
try {
|
|
795
|
-
return /* @__PURE__ */
|
|
1009
|
+
return /* @__PURE__ */ React10.createElement(Toolbar.Root, {
|
|
796
1010
|
...props,
|
|
797
1011
|
classNames: [
|
|
798
1012
|
"bg-transparent density-coarse",
|
|
@@ -807,11 +1021,11 @@ var CardToolbar = /* @__PURE__ */ forwardRef6(({ children, classNames, ...props
|
|
|
807
1021
|
var CardToolbarIconButton = Toolbar.IconButton;
|
|
808
1022
|
var CardToolbarSeparator = Toolbar.Separator;
|
|
809
1023
|
var CardDragHandle = /* @__PURE__ */ forwardRef6(({ toolbarItem }, forwardedRef) => {
|
|
810
|
-
var _effect =
|
|
1024
|
+
var _effect = _useSignals10();
|
|
811
1025
|
try {
|
|
812
1026
|
const { t } = useTranslation2(translationKey);
|
|
813
1027
|
const Root = toolbarItem ? Toolbar.IconButton : IconButton;
|
|
814
|
-
return /* @__PURE__ */
|
|
1028
|
+
return /* @__PURE__ */ React10.createElement(Root, {
|
|
815
1029
|
iconOnly: true,
|
|
816
1030
|
icon: "ph--dots-six-vertical--regular",
|
|
817
1031
|
variant: "ghost",
|
|
@@ -826,22 +1040,25 @@ var CardDragHandle = /* @__PURE__ */ forwardRef6(({ toolbarItem }, forwardedRef)
|
|
|
826
1040
|
var CardDragPreview = StackItem.DragPreview;
|
|
827
1041
|
var CardMenu = Primitive.div;
|
|
828
1042
|
var CardPoster = (props) => {
|
|
829
|
-
var _effect =
|
|
1043
|
+
var _effect = _useSignals10();
|
|
830
1044
|
try {
|
|
831
1045
|
const aspect = props.aspect === "auto" ? "aspect-auto" : "aspect-video";
|
|
832
1046
|
if (props.image) {
|
|
833
|
-
return /* @__PURE__ */
|
|
834
|
-
|
|
1047
|
+
return /* @__PURE__ */ React10.createElement(Image, {
|
|
1048
|
+
classNames: [
|
|
1049
|
+
`dx-card__poster is-full __bs-auto`,
|
|
1050
|
+
aspect
|
|
1051
|
+
],
|
|
835
1052
|
src: props.image,
|
|
836
1053
|
alt: props.alt
|
|
837
1054
|
});
|
|
838
1055
|
}
|
|
839
1056
|
if (props.icon) {
|
|
840
|
-
return /* @__PURE__ */
|
|
1057
|
+
return /* @__PURE__ */ React10.createElement("div", {
|
|
841
1058
|
role: "image",
|
|
842
|
-
className: `dx-card__poster grid
|
|
1059
|
+
className: mx7(`dx-card__poster grid place-items-center bg-inputSurface text-subdued`, aspect),
|
|
843
1060
|
"aria-label": props.alt
|
|
844
|
-
}, /* @__PURE__ */
|
|
1061
|
+
}, /* @__PURE__ */ React10.createElement(Icon2, {
|
|
845
1062
|
icon: props.icon,
|
|
846
1063
|
size: 10
|
|
847
1064
|
}));
|
|
@@ -851,7 +1068,7 @@ var CardPoster = (props) => {
|
|
|
851
1068
|
}
|
|
852
1069
|
};
|
|
853
1070
|
var CardChrome = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
854
|
-
var _effect =
|
|
1071
|
+
var _effect = _useSignals10();
|
|
855
1072
|
try {
|
|
856
1073
|
const Root = asChild ? Slot3 : "div";
|
|
857
1074
|
const rootProps = asChild ? {
|
|
@@ -860,10 +1077,10 @@ var CardChrome = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, r
|
|
|
860
1077
|
classNames
|
|
861
1078
|
]
|
|
862
1079
|
} : {
|
|
863
|
-
className:
|
|
1080
|
+
className: mx7(cardChrome, classNames),
|
|
864
1081
|
role
|
|
865
1082
|
};
|
|
866
|
-
return /* @__PURE__ */
|
|
1083
|
+
return /* @__PURE__ */ React10.createElement(Root, {
|
|
867
1084
|
...props,
|
|
868
1085
|
...rootProps,
|
|
869
1086
|
ref: forwardedRef
|
|
@@ -873,19 +1090,19 @@ var CardChrome = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, r
|
|
|
873
1090
|
}
|
|
874
1091
|
});
|
|
875
1092
|
var CardText = /* @__PURE__ */ forwardRef6(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
876
|
-
var _effect =
|
|
1093
|
+
var _effect = _useSignals10();
|
|
877
1094
|
try {
|
|
878
|
-
const Root = asChild ? Slot3 : "
|
|
1095
|
+
const Root = asChild ? Slot3 : "div";
|
|
879
1096
|
const rootProps = asChild ? {
|
|
880
1097
|
classNames: [
|
|
881
1098
|
cardText,
|
|
882
1099
|
classNames
|
|
883
1100
|
]
|
|
884
1101
|
} : {
|
|
885
|
-
className:
|
|
1102
|
+
className: mx7(cardText, classNames),
|
|
886
1103
|
role
|
|
887
1104
|
};
|
|
888
|
-
return /* @__PURE__ */
|
|
1105
|
+
return /* @__PURE__ */ React10.createElement(Root, {
|
|
889
1106
|
...props,
|
|
890
1107
|
...rootProps,
|
|
891
1108
|
ref: forwardedRef
|
|
@@ -910,13 +1127,13 @@ var Card = {
|
|
|
910
1127
|
};
|
|
911
1128
|
|
|
912
1129
|
// src/exemplars/Card/CardDragPreview.tsx
|
|
913
|
-
import { useSignals as
|
|
914
|
-
import
|
|
915
|
-
import { mx as
|
|
1130
|
+
import { useSignals as _useSignals11 } from "@preact-signals/safe-react/tracking";
|
|
1131
|
+
import React11 from "react";
|
|
1132
|
+
import { mx as mx8 } from "@dxos/react-ui-theme";
|
|
916
1133
|
var CardDragPreviewRoot = ({ children }) => {
|
|
917
|
-
var _effect =
|
|
1134
|
+
var _effect = _useSignals11();
|
|
918
1135
|
try {
|
|
919
|
-
return /* @__PURE__ */
|
|
1136
|
+
return /* @__PURE__ */ React11.createElement("div", {
|
|
920
1137
|
className: "p-2"
|
|
921
1138
|
}, children);
|
|
922
1139
|
} finally {
|
|
@@ -924,10 +1141,10 @@ var CardDragPreviewRoot = ({ children }) => {
|
|
|
924
1141
|
}
|
|
925
1142
|
};
|
|
926
1143
|
var CardDragPreviewContent = ({ children }) => {
|
|
927
|
-
var _effect =
|
|
1144
|
+
var _effect = _useSignals11();
|
|
928
1145
|
try {
|
|
929
|
-
return /* @__PURE__ */
|
|
930
|
-
className:
|
|
1146
|
+
return /* @__PURE__ */ React11.createElement("div", {
|
|
1147
|
+
className: mx8(cardRoot, "ring-focusLine ring-neutralFocusIndicator")
|
|
931
1148
|
}, children);
|
|
932
1149
|
} finally {
|
|
933
1150
|
_effect.f();
|
|
@@ -939,14 +1156,14 @@ var CardDragPreview2 = {
|
|
|
939
1156
|
};
|
|
940
1157
|
|
|
941
1158
|
// src/exemplars/CardStack/CardStack.tsx
|
|
942
|
-
import { useSignals as
|
|
1159
|
+
import { useSignals as _useSignals12 } from "@preact-signals/safe-react/tracking";
|
|
943
1160
|
import { Slot as Slot4 } from "@radix-ui/react-slot";
|
|
944
|
-
import
|
|
945
|
-
import { mx as
|
|
1161
|
+
import React12, { forwardRef as forwardRef7 } from "react";
|
|
1162
|
+
import { mx as mx9 } from "@dxos/react-ui-theme";
|
|
946
1163
|
var CardStackStack = /* @__PURE__ */ forwardRef7(({ children, classNames, itemsCount = 0, ...props }, forwardedRef) => {
|
|
947
|
-
var _effect =
|
|
1164
|
+
var _effect = _useSignals12();
|
|
948
1165
|
try {
|
|
949
|
-
return /* @__PURE__ */
|
|
1166
|
+
return /* @__PURE__ */ React12.createElement(Stack, {
|
|
950
1167
|
orientation: "vertical",
|
|
951
1168
|
size: "contain",
|
|
952
1169
|
rail: false,
|
|
@@ -971,7 +1188,7 @@ var CardStackStack = /* @__PURE__ */ forwardRef7(({ children, classNames, itemsC
|
|
|
971
1188
|
var CardStackDragHandle = Card.DragHandle;
|
|
972
1189
|
var cardStackHeading = "mli-2 order-first bg-transparent rounded-bs-md flex items-center";
|
|
973
1190
|
var CardStackHeading = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "heading", ...props }, forwardedRef) => {
|
|
974
|
-
var _effect =
|
|
1191
|
+
var _effect = _useSignals12();
|
|
975
1192
|
try {
|
|
976
1193
|
const Root = asChild ? Slot4 : "div";
|
|
977
1194
|
const rootProps = asChild ? {
|
|
@@ -980,10 +1197,10 @@ var CardStackHeading = /* @__PURE__ */ forwardRef7(({ children, classNames, asCh
|
|
|
980
1197
|
classNames
|
|
981
1198
|
]
|
|
982
1199
|
} : {
|
|
983
|
-
className:
|
|
1200
|
+
className: mx9(cardStackHeading, classNames),
|
|
984
1201
|
role
|
|
985
1202
|
};
|
|
986
|
-
return /* @__PURE__ */
|
|
1203
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
987
1204
|
...props,
|
|
988
1205
|
...rootProps,
|
|
989
1206
|
ref: forwardedRef
|
|
@@ -994,7 +1211,7 @@ var CardStackHeading = /* @__PURE__ */ forwardRef7(({ children, classNames, asCh
|
|
|
994
1211
|
});
|
|
995
1212
|
var cardStackFooter = 'plb-2 mli-2 border-bs border-transparent [[data-scroll-separator-end="true"]_&]:border-subduedSeparator';
|
|
996
1213
|
var CardStackFooter = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
997
|
-
var _effect =
|
|
1214
|
+
var _effect = _useSignals12();
|
|
998
1215
|
try {
|
|
999
1216
|
const Root = asChild ? Slot4 : "div";
|
|
1000
1217
|
const rootProps = asChild ? {
|
|
@@ -1003,10 +1220,10 @@ var CardStackFooter = /* @__PURE__ */ forwardRef7(({ children, classNames, asChi
|
|
|
1003
1220
|
classNames
|
|
1004
1221
|
]
|
|
1005
1222
|
} : {
|
|
1006
|
-
className:
|
|
1223
|
+
className: mx9(cardStackFooter, classNames),
|
|
1007
1224
|
role
|
|
1008
1225
|
};
|
|
1009
|
-
return /* @__PURE__ */
|
|
1226
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
1010
1227
|
...props,
|
|
1011
1228
|
...rootProps,
|
|
1012
1229
|
ref: forwardedRef
|
|
@@ -1015,24 +1232,27 @@ var CardStackFooter = /* @__PURE__ */ forwardRef7(({ children, classNames, asChi
|
|
|
1015
1232
|
_effect.f();
|
|
1016
1233
|
}
|
|
1017
1234
|
});
|
|
1018
|
-
var cardStackContent =
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
];
|
|
1022
|
-
var CardStackContent = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
1023
|
-
var _effect = _useSignals11();
|
|
1235
|
+
var cardStackContent = "shrink min-bs-0 bg-baseSurface border border-separator rounded-md grid dx-focus-ring-group-x-indicator kanban-drop";
|
|
1236
|
+
var CardStackContent = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", footer = true, ...props }, forwardedRef) => {
|
|
1237
|
+
var _effect = _useSignals12();
|
|
1024
1238
|
try {
|
|
1025
1239
|
const Root = asChild ? Slot4 : "div";
|
|
1240
|
+
const baseClassNames = footer ? [
|
|
1241
|
+
cardStackContent,
|
|
1242
|
+
railGridHorizontalContainFitContent
|
|
1243
|
+
] : [
|
|
1244
|
+
cardStackContent
|
|
1245
|
+
];
|
|
1026
1246
|
const rootProps = asChild ? {
|
|
1027
1247
|
classNames: [
|
|
1028
|
-
...
|
|
1248
|
+
...baseClassNames,
|
|
1029
1249
|
classNames
|
|
1030
1250
|
]
|
|
1031
1251
|
} : {
|
|
1032
|
-
className:
|
|
1252
|
+
className: mx9(...baseClassNames, classNames),
|
|
1033
1253
|
role
|
|
1034
1254
|
};
|
|
1035
|
-
return /* @__PURE__ */
|
|
1255
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
1036
1256
|
...props,
|
|
1037
1257
|
...rootProps,
|
|
1038
1258
|
"data-scroll-separator": "false",
|
|
@@ -1044,7 +1264,7 @@ var CardStackContent = /* @__PURE__ */ forwardRef7(({ children, classNames, asCh
|
|
|
1044
1264
|
});
|
|
1045
1265
|
var cardStackRoot = "flex flex-col pli-2 plb-2";
|
|
1046
1266
|
var CardStackRoot = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
1047
|
-
var _effect =
|
|
1267
|
+
var _effect = _useSignals12();
|
|
1048
1268
|
try {
|
|
1049
1269
|
const Root = asChild ? Slot4 : "div";
|
|
1050
1270
|
const rootProps = asChild ? {
|
|
@@ -1053,10 +1273,10 @@ var CardStackRoot = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild
|
|
|
1053
1273
|
classNames
|
|
1054
1274
|
]
|
|
1055
1275
|
} : {
|
|
1056
|
-
className:
|
|
1276
|
+
className: mx9(cardStackRoot, classNames),
|
|
1057
1277
|
role
|
|
1058
1278
|
};
|
|
1059
|
-
return /* @__PURE__ */
|
|
1279
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
1060
1280
|
...props,
|
|
1061
1281
|
...rootProps,
|
|
1062
1282
|
ref: forwardedRef
|
|
@@ -1067,7 +1287,7 @@ var CardStackRoot = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild
|
|
|
1067
1287
|
});
|
|
1068
1288
|
var cardStackItem = "contain-layout pli-2 plb-1 first-of-type:pbs-0 last-of-type:pbe-0";
|
|
1069
1289
|
var CardStackItem = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild, role = "none", ...props }, forwardedRef) => {
|
|
1070
|
-
var _effect =
|
|
1290
|
+
var _effect = _useSignals12();
|
|
1071
1291
|
try {
|
|
1072
1292
|
const Root = asChild ? Slot4 : "div";
|
|
1073
1293
|
const rootProps = asChild ? {
|
|
@@ -1076,10 +1296,10 @@ var CardStackItem = /* @__PURE__ */ forwardRef7(({ children, classNames, asChild
|
|
|
1076
1296
|
classNames
|
|
1077
1297
|
]
|
|
1078
1298
|
} : {
|
|
1079
|
-
className:
|
|
1299
|
+
className: mx9(cardStackItem, classNames),
|
|
1080
1300
|
role
|
|
1081
1301
|
};
|
|
1082
|
-
return /* @__PURE__ */
|
|
1302
|
+
return /* @__PURE__ */ React12.createElement(Root, {
|
|
1083
1303
|
...props,
|
|
1084
1304
|
...rootProps,
|
|
1085
1305
|
ref: forwardedRef
|
|
@@ -1099,16 +1319,16 @@ var CardStack = {
|
|
|
1099
1319
|
};
|
|
1100
1320
|
|
|
1101
1321
|
// src/exemplars/CardStack/CardStackDragPreview.tsx
|
|
1102
|
-
import { useSignals as
|
|
1103
|
-
import
|
|
1322
|
+
import { useSignals as _useSignals13 } from "@preact-signals/safe-react/tracking";
|
|
1323
|
+
import React13 from "react";
|
|
1104
1324
|
import { IconButton as IconButton2, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
1105
|
-
import { mx as
|
|
1325
|
+
import { mx as mx10 } from "@dxos/react-ui-theme";
|
|
1106
1326
|
var CardStackDragPreviewRoot = ({ children }) => {
|
|
1107
|
-
var _effect =
|
|
1327
|
+
var _effect = _useSignals13();
|
|
1108
1328
|
try {
|
|
1109
|
-
return /* @__PURE__ */
|
|
1329
|
+
return /* @__PURE__ */ React13.createElement("div", {
|
|
1110
1330
|
className: "p-2"
|
|
1111
|
-
}, /* @__PURE__ */
|
|
1331
|
+
}, /* @__PURE__ */ React13.createElement("div", {
|
|
1112
1332
|
className: "rounded-md max-bs-[calc(100dvh-1rem)] overflow-hidden bg-baseSurface border border-separator ring-focusLine ring-neutralFocusIndicator flex flex-col"
|
|
1113
1333
|
}, children));
|
|
1114
1334
|
} finally {
|
|
@@ -1116,12 +1336,12 @@ var CardStackDragPreviewRoot = ({ children }) => {
|
|
|
1116
1336
|
}
|
|
1117
1337
|
};
|
|
1118
1338
|
var CardStackDragPreviewHeading = ({ children }) => {
|
|
1119
|
-
var _effect =
|
|
1339
|
+
var _effect = _useSignals13();
|
|
1120
1340
|
try {
|
|
1121
1341
|
const { t } = useTranslation3(translationKey);
|
|
1122
|
-
return /* @__PURE__ */
|
|
1342
|
+
return /* @__PURE__ */ React13.createElement("div", {
|
|
1123
1343
|
className: "flex items-center p-2"
|
|
1124
|
-
}, /* @__PURE__ */
|
|
1344
|
+
}, /* @__PURE__ */ React13.createElement(IconButton2, {
|
|
1125
1345
|
iconOnly: true,
|
|
1126
1346
|
icon: "ph--dots-six-vertical--regular",
|
|
1127
1347
|
variant: "ghost",
|
|
@@ -1133,19 +1353,19 @@ var CardStackDragPreviewHeading = ({ children }) => {
|
|
|
1133
1353
|
}
|
|
1134
1354
|
};
|
|
1135
1355
|
var CardStackDragPreviewContent = ({ children, itemsCount = 0 }) => {
|
|
1136
|
-
var _effect =
|
|
1356
|
+
var _effect = _useSignals13();
|
|
1137
1357
|
try {
|
|
1138
|
-
return /* @__PURE__ */
|
|
1139
|
-
className:
|
|
1358
|
+
return /* @__PURE__ */ React13.createElement("div", {
|
|
1359
|
+
className: mx10("overflow-y-auto flex-1 pli-2 flex flex-col gap-2", "plb-1", itemsCount > 0 ? "plb-2" : "plb-1")
|
|
1140
1360
|
}, children);
|
|
1141
1361
|
} finally {
|
|
1142
1362
|
_effect.f();
|
|
1143
1363
|
}
|
|
1144
1364
|
};
|
|
1145
1365
|
var CardStackDragPreviewFooter = ({ children }) => {
|
|
1146
|
-
var _effect =
|
|
1366
|
+
var _effect = _useSignals13();
|
|
1147
1367
|
try {
|
|
1148
|
-
return /* @__PURE__ */
|
|
1368
|
+
return /* @__PURE__ */ React13.createElement("div", {
|
|
1149
1369
|
className: "p-2 border-t border-separator"
|
|
1150
1370
|
}, children);
|
|
1151
1371
|
} finally {
|
|
@@ -1160,6 +1380,7 @@ var CardStackDragPreview = {
|
|
|
1160
1380
|
};
|
|
1161
1381
|
|
|
1162
1382
|
export {
|
|
1383
|
+
Image,
|
|
1163
1384
|
StackContext,
|
|
1164
1385
|
railGridHorizontal,
|
|
1165
1386
|
railGridVertical,
|
|
@@ -1176,6 +1397,7 @@ export {
|
|
|
1176
1397
|
StackItem,
|
|
1177
1398
|
cardRoot,
|
|
1178
1399
|
cardSpacing,
|
|
1400
|
+
cardNoSpacing,
|
|
1179
1401
|
labelSpacing,
|
|
1180
1402
|
cardDialogContent,
|
|
1181
1403
|
cardDialogHeader,
|
|
@@ -1195,4 +1417,4 @@ export {
|
|
|
1195
1417
|
CardStack,
|
|
1196
1418
|
CardStackDragPreview
|
|
1197
1419
|
};
|
|
1198
|
-
//# sourceMappingURL=chunk-
|
|
1420
|
+
//# sourceMappingURL=chunk-K76XHALI.mjs.map
|